zenstack 0.2.9 → 0.2.10

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.
@@ -4249,7 +4249,7 @@ Node text: ${this._forgottenText}`),new b.errors.InvalidOperationError(r)}return
4249
4249
  `)&&(p=p.replace(/\r?\n$/,"")));let f=Kfe(r,this,this.getChildren());qa({insertPos:f,newText:p,parent:this});let m=this.getChildren();return af(i,m,r,!0)}};function epe(e,r,n){if(b.errors.throwIfWhitespaceOrNotString(r,"newName"),e.getText()===r)return;let i=e._context.languageService.findRenameLocations(e,n),a=new b.KeyValueCache;for(let s of i)a.getOrCreate(s.getSourceFile(),()=>[]).push(s);for(let[s,u]of a.getEntries())b7e({sourceFile:s,renameLocations:u,newName:r})}function rpe(e,r){let n=Zfe(e._getWriterWithIndentation(),r),i=e.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken),a=e.getFirstChildByKindOrThrow(b.SyntaxKind.CloseBraceToken);qa({insertPos:i.getEnd(),newText:n,parent:e,replacing:{textLength:a.getStart()-i.getEnd()}})}function H6(e){return class extends e{getBody(){let r=this.compilerNode.body;if(r==null)throw new b.errors.InvalidOperationError("Bodied node should have a body.");return this._getNodeFromCompilerNode(r)}setBodyText(r){let n=this.getBody();return rpe(n,r),this}getBodyText(){return $H(this.getBody())}}}function HT(e){return class extends e{getBodyOrThrow(){return b.errors.throwIfNullOrUndefined(this.getBody(),"Expected to find the node's body.")}getBody(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.body)}getBodyText(){let r=this.getBody();return r==null?void 0:$H(r)}setBodyText(r){return this.addBody(),rpe(this.getBodyOrThrow(),r),this}hasBody(){return this.compilerNode.body!=null}addBody(){var r;if(this.hasBody())return this;let n=this.getLastChildByKind(b.SyntaxKind.SemicolonToken);return qa({parent:this,insertPos:n==null?this.getEnd():n.getStart(),newText:this._getWriterWithQueuedIndentation().space().block().toString(),replacing:{textLength:(r=n?.getFullWidth())!==null&&r!==void 0?r:0}}),this}removeBody(){let r=this.getBody();return r==null?this:(qa({parent:this,insertPos:r.getPos(),newText:";",replacing:{textLength:r.getFullWidth()}}),this)}}}function Im(e){return class extends e{setOrder(r){let n=this.getChildIndex(),i=this.getParentSyntaxList()||this.getParentSyntaxListOrThrow();return b.errors.throwIfOutOfRange(r,[0,i.getChildCount()-1],"order"),n===r?this:(p7e({parent:i,getSiblingFormatting:HBe,oldIndex:n,newIndex:r}),this)}}}function qT(e){return class extends e{getDecorator(r){return ic(this.getDecorators(),r)}getDecoratorOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDecorator(r),()=>Ou("decorator",r))}getDecorators(){return ij(this.compilerNode).map(r=>this._getNodeFromCompilerNode(r))}addDecorator(r){return this.insertDecorator(ad(ij(this.compilerNode)),r)}addDecorators(r){return this.insertDecorators(ad(ij(this.compilerNode)),r)}insertDecorator(r,n){return this.insertDecorators(r,[n])[0]}insertDecorators(r,n){var i,a,s,u;if(b.ArrayUtils.isNullOrEmpty(n))return[];let p=D7e(this,n),f=this.getDecorators();r=ku(r,f.length);let m=C7e(this,f),g=f[r-1],D=qBe({structures:n,newCodes:p,parent:this,indentationText:this.getIndentationText(),getSeparator:()=>m,previousFormattingKind:g==null?El.None:m,nextFormattingKind:g==null?m:El.None});return qa({parent:(u=(a=(i=f[0])===null||i===void 0?void 0:i.getParentSyntaxListOrThrow())!==null&&a!==void 0?a:(s=this.getModifiers()[0])===null||s===void 0?void 0:s.getParentSyntaxListOrThrow())!==null&&u!==void 0?u:this,insertPos:f[r-1]==null?this.getStart():f[r-1].getEnd(),newText:D}),af(f,this.getDecorators(),r,!1)}set(r){return io(e.prototype,this,r),r.decorators!=null&&(this.getDecorators().forEach(n=>n.remove()),this.addDecorators(r.decorators)),this}getStructure(){return uo(e.prototype,this,{decorators:this.getDecorators().map(r=>r.getStructure())})}}}function ij(e){var r;return b.ts.canHaveDecorators(e)?(r=b.ts.getDecorators(e))!==null&&r!==void 0?r:[]:[]}function D7e(e,r){let n=[];for(let i of r){let a=e._getWriter();e._context.structurePrinterFactory.forDecorator().printText(a,i),n.push(a.toString())}return n}function C7e(e,r){return A7e(e,r)?El.Space:El.Newline}function A7e(e,r){if(r.length<=1)return e.getKind()===b.SyntaxKind.Parameter;let n=r[0].getStartLinePos();for(let i=1;i<r.length;i++)if(r[i].getStartLinePos()!==n)return!1;return!0}function hL(e){return class extends e{getDotDotDotTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDotDotDotToken(),"Expected to find a dot dot dot token (...).")}getDotDotDotToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.dotDotDotToken)}}}function XH(e){return class extends e{hasExclamationToken(){return this.compilerNode.exclamationToken!=null}getExclamationTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.exclamationToken)}getExclamationTokenNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExclamationTokenNode(),"Expected to find an exclamation token.")}setHasExclamationToken(r){let n=this.getExclamationTokenNode(),i=n!=null;if(r===i)return this;if(r){Tr.isQuestionTokenable(this)&&this.setHasQuestionToken(!1);let a=this.getFirstChildByKind(b.SyntaxKind.ColonToken);if(a==null)throw new b.errors.InvalidOperationError("Cannot add an exclamation token to a node that does not have a type.");qa({insertPos:a.getStart(),parent:this,newText:"!"})}else Bs({children:[n]});return this}set(r){return io(e.prototype,this,r),r.hasExclamationToken!=null&&this.setHasExclamationToken(r.hasExclamationToken),this}getStructure(){return uo(e.prototype,this,{hasExclamationToken:this.hasExclamationToken()})}}}function YH(e){return class extends e{hasExportKeyword(){return this.getExportKeyword()!=null}getExportKeyword(){if(Tr.isVariableDeclaration(this)){let r=this.getVariableStatement();return r?.getExportKeyword()}return Tr.isModifierable(this)?this.getFirstModifierByKind(b.SyntaxKind.ExportKeyword):ufe()}getExportKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExportKeyword(),"Expected to find an export keyword.")}hasDefaultKeyword(){return this.getDefaultKeyword()!=null}getDefaultKeyword(){if(Tr.isVariableDeclaration(this)){let r=this.getVariableStatement();return r?.getDefaultKeyword()}return Tr.isModifierable(this)?this.getFirstModifierByKind(b.SyntaxKind.DefaultKeyword):ufe()}getDefaultKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultKeyword(),"Expected to find a default keyword.")}isExported(){if(this.hasExportKeyword())return!0;let r=this.getSymbol(),n=this.getSourceFile().getSymbol();return r==null||n==null?!1:n.getExports().some(i=>i===r||i.getAliasedSymbol()===r)}isDefaultExport(){if(this.hasDefaultKeyword())return!0;let r=this.getSymbol();if(r==null)return!1;let n=this.getSourceFile().getDefaultExportSymbol();if(n==null)return!1;if(r===n)return!0;let i=n.getAliasedSymbol();return r===i}isNamedExport(){let r=this.getSymbol(),n=this.getSourceFile().getSymbol();if(r==null||n==null)return!1;return!i()&&n.getExports().some(a=>a===r||a.getAliasedSymbol()===r);function i(){let a=n.getExport("default");return a==null?!1:r===a||r===a.getAliasedSymbol()}}}}function ufe(){throw new b.errors.NotImplementedError("Not implemented situation where node was not a ModifierableNode.")}function BE(e){return L7e(YH(e))}function L7e(e){return class extends e{setIsDefaultExport(r){if(r===this.isDefaultExport())return this;if(r&&!Tr.isSourceFile(this.getParentOrThrow()))throw new b.errors.InvalidOperationError("The parent must be a source file in order to set this node as a default export.");let n=this.getSourceFile(),i=n.getDefaultExportSymbol();if(i!=null&&n.removeDefaultExport(i),!r)return this;if(Tr.hasName(this)&&a.call(this)){let s=this.getFirstAncestorByKindOrThrow(b.SyntaxKind.SyntaxList),u=this.getName();s.insertChildText(this.getChildIndex()+1,p=>{p.newLine().write(`export default ${u};`)})}else this.addModifier("export"),this.addModifier("default");return this;function a(){return!!(Tr.isEnumDeclaration(this)||Tr.isModuleDeclaration(this)||Tr.isTypeAliasDeclaration(this)||Tr.isAmbientable(this)&&this.isAmbient())}}setIsExported(r){return Tr.isSourceFile(this.getParentOrThrow())&&this.toggleModifier("default",!1),this.toggleModifier("export",r),this}set(r){return io(e.prototype,this,r),r.isExported!=null&&this.setIsExported(r.isExported),r.isDefaultExport!=null&&this.setIsDefaultExport(r.isDefaultExport),this}getStructure(){return uo(e.prototype,this,{isExported:this.hasExportKeyword(),isDefaultExport:this.hasDefaultKeyword()})}}}var of=class{printTextOrWriterFunc(r,n){typeof n=="string"?r.write(n):n?.(r)}getNewWriter(r){return new KR.default(r.getOptions())}getNewWriterWithQueuedChildIndentation(r){let n=new KR.default(r.getOptions());return n.queueIndentationLevel(1),n}getText(r,n){let i=this.getNewWriter(r);return this.printTextOrWriterFunc(i,n),i.toString()}getTextWithQueuedChildIndentation(r,n){let i=this.getNewWriterWithQueuedChildIndentation(r);return this.printTextOrWriterFunc(i,n),i.toString()}},Oj=class extends of{printText(r,n){let{initializer:i}=n;if(i==null)return;let a=this.getText(r,i);b.StringUtils.isNullOrWhitespace(a)||r.hangingIndent(()=>{r.spaceIfLastNot(),r.write(`= ${a}`)})}},kj=class extends of{printText(r,n){let i=n.scope;n.isDefaultExport?r.write("export default "):n.isExported&&r.write("export "),n.hasDeclareKeyword&&r.write("declare "),i!=null&&r.write(`${i} `),n.isStatic&&r.write("static "),n.hasOverrideKeyword&&r.write("override "),n.isAbstract&&r.write("abstract "),n.isAsync&&r.write("async "),n.isReadonly&&r.write("readonly ")}},Rj=class extends of{constructor(r=!1){super(),this.alwaysWrite=r}printText(r,n){let{returnType:i}=n;if(i==null&&this.alwaysWrite===!1)return;i=i??"void";let a=this.getText(r,i);b.StringUtils.isNullOrWhitespace(a)||r.hangingIndent(()=>{r.write(`: ${a}`)})}},Mj=class extends of{constructor(r,n=!1){super(),this.separator=r,this.alwaysWrite=n}printText(r,n){let{type:i}=n;if(i==null&&this.alwaysWrite===!1)return;i=i??"any";let a=this.getText(r,i);b.StringUtils.isNullOrWhitespace(a)||r.hangingIndent(()=>{r.write(`${this.separator} ${a}`)})}},uS=class extends of{constructor(r){super(),this.printer=r}printText(r,n){if(n!=null)for(let i=0;i<n.length;i++)r.conditionalBlankLine(i>0),this.printer.printText(r,n[i])}},Ih=class extends of{constructor(r){super(),this.printer=r}printText(r,n){tpe(this.printer,r,n,()=>r.spaceIfLastNot())}};function tpe(e,r,n,i){if(n!=null)if(n instanceof Function||typeof n=="string")e.printText(r,n);else{let a=new Array(n.length);for(let u=0;u<n.length;u++){u>0&&i();let p=n[u],f=r.getLength();e.printText(r,p);let m=Ffe(pj.getLastCharactersToPos(r,f));a[u]=m===-1?!1:m+f}let s=!1;for(let u=a.length-1;u>=0;u--){let p=a[u];p!==!1&&(s?r.unsafeInsert(p,","):s=!0)}}}var GT=class extends of{constructor(r){super(),this.printer=r}printText(r,n){tpe(this.printer,r,n,()=>r.newLineIfLastNot())}},H_=class extends of{constructor(r){super(),this.printer=r}printText(r,n){if(n!=null)for(let i=0;i<n.length;i++)r.conditionalNewLine(i>0),this.printer.printText(r,n[i])}},wj=class extends of{constructor(r){super(),this.printer=r}printText(r,n){if(n!=null)for(let i=0;i<n.length;i++)r.conditionalWrite(i>0," "),this.printer.printText(r,n[i])}},Ns=class extends of{constructor(r){super(),this.factory=r}printTextWithoutTrivia(r,n){this.printTextInternal(r,n)}printText(r,n){this.printLeadingTrivia(r,n),r.closeComment(),this.printTextInternal(r,n),this.printTrailingTrivia(r,n)}printLeadingTrivia(r,n){let i=n.leadingTrivia;i!=null&&(this.printTrivia(r,i),r.isInComment()&&r.closeComment())}printTrailingTrivia(r,n){let i=n.trailingTrivia;i!=null&&this.printTrivia(r,i)}printTrivia(r,n){if(n instanceof Array)for(let i=0;i<n.length;i++)this.printTextOrWriterFunc(r,n[i]),i!==n.length-1&&r.newLineIfLastNot();else this.printTextOrWriterFunc(r,n)}},Fj=class extends Ns{constructor(r,n){super(r),this.options=n,this.multipleWriter=new uS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=n.hasDeclareKeyword||this.options.isAmbient;this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.printHeader(r,n),r.inlineBlock(()=>{this.factory.forPropertyDeclaration().printTexts(r,n.properties),this.printCtors(r,n,i),this.printGetAndSet(r,n,i),b.ArrayUtils.isNullOrEmpty(n.methods)||(this.conditionalSeparator(r,i),this.factory.forMethodDeclaration({isAmbient:i}).printTexts(r,n.methods))})}printHeader(r,n){this.factory.forModifierableNode().printText(r,n),r.write("class"),b.StringUtils.isNullOrWhitespace(n.name)||r.space().write(n.name),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),r.space(),r.hangingIndent(()=>{if(n.extends!=null){let i=this.getText(r,n.extends);b.StringUtils.isNullOrWhitespace(i)||r.write(`extends ${i} `)}if(n.implements!=null){let i=n.implements instanceof Array?n.implements.map(a=>this.getText(r,a)).join(", "):this.getText(r,n.implements);b.StringUtils.isNullOrWhitespace(i)||r.write(`implements ${i} `)}})}printCtors(r,n,i){if(!b.ArrayUtils.isNullOrEmpty(n.ctors))for(let a of n.ctors)this.conditionalSeparator(r,i),this.factory.forConstructorDeclaration({isAmbient:i}).printText(r,a)}printGetAndSet(r,n,i){var a,s;let u=[...(a=n.getAccessors)!==null&&a!==void 0?a:[]],p=[...(s=n.setAccessors)!==null&&s!==void 0?s:[]],f=this.factory.forGetAccessorDeclaration({isAmbient:i}),m=this.factory.forSetAccessorDeclaration({isAmbient:i});for(let g of u){this.conditionalSeparator(r,i),f.printText(r,g);let D=p.findIndex(P=>P.name===g.name);D>=0&&(this.conditionalSeparator(r,i),m.printText(r,p[D]),p.splice(D,1))}for(let g of p)this.conditionalSeparator(r,i),m.printText(r,g)}conditionalSeparator(r,n){r.isAtStartOfFirstLineOfBlock()||(n?r.newLine():r.blankLine())}};Oe.StructureKind=void 0;(function(e){e[e.AssertEntry=0]="AssertEntry",e[e.CallSignature=1]="CallSignature",e[e.Class=2]="Class",e[e.ClassStaticBlock=3]="ClassStaticBlock",e[e.ConstructSignature=4]="ConstructSignature",e[e.Constructor=5]="Constructor",e[e.ConstructorOverload=6]="ConstructorOverload",e[e.Decorator=7]="Decorator",e[e.Enum=8]="Enum",e[e.EnumMember=9]="EnumMember",e[e.ExportAssignment=10]="ExportAssignment",e[e.ExportDeclaration=11]="ExportDeclaration",e[e.ExportSpecifier=12]="ExportSpecifier",e[e.Function=13]="Function",e[e.FunctionOverload=14]="FunctionOverload",e[e.GetAccessor=15]="GetAccessor",e[e.ImportDeclaration=16]="ImportDeclaration",e[e.ImportSpecifier=17]="ImportSpecifier",e[e.IndexSignature=18]="IndexSignature",e[e.Interface=19]="Interface",e[e.JsxAttribute=20]="JsxAttribute",e[e.JsxSpreadAttribute=21]="JsxSpreadAttribute",e[e.JsxElement=22]="JsxElement",e[e.JsxSelfClosingElement=23]="JsxSelfClosingElement",e[e.JSDoc=24]="JSDoc",e[e.JSDocTag=25]="JSDocTag",e[e.Method=26]="Method",e[e.MethodOverload=27]="MethodOverload",e[e.MethodSignature=28]="MethodSignature",e[e.Module=29]="Module",e[e.Parameter=30]="Parameter",e[e.Property=31]="Property",e[e.PropertyAssignment=32]="PropertyAssignment",e[e.PropertySignature=33]="PropertySignature",e[e.SetAccessor=34]="SetAccessor",e[e.ShorthandPropertyAssignment=35]="ShorthandPropertyAssignment",e[e.SourceFile=36]="SourceFile",e[e.SpreadAssignment=37]="SpreadAssignment",e[e.TypeAlias=38]="TypeAlias",e[e.TypeParameter=39]="TypeParameter",e[e.VariableDeclaration=40]="VariableDeclaration",e[e.VariableStatement=41]="VariableStatement"})(Oe.StructureKind||(Oe.StructureKind={}));var ZA={hasName(e){return typeof e.name=="string"},isAssertEntry(e){return e?.kind===Oe.StructureKind.AssertEntry},isAssertionKeyNamed(e){return e?.kind===Oe.StructureKind.AssertEntry},isCallSignature(e){return e?.kind===Oe.StructureKind.CallSignature},isJSDocable(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.Class:case Oe.StructureKind.ClassStaticBlock:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.Enum:case Oe.StructureKind.EnumMember:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.IndexSignature:case Oe.StructureKind.Interface:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.Module:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.SetAccessor:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableStatement:return!0;default:return!1}},isSignatured(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isParametered(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isReturnTyped(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.IndexSignature:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isTypeParametered(e){switch(e?.kind){case Oe.StructureKind.CallSignature:case Oe.StructureKind.Class:case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.ConstructSignature:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Interface:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.SetAccessor:case Oe.StructureKind.TypeAlias:return!0;default:return!1}},isClass(e){return e?.kind===Oe.StructureKind.Class},isClassLikeDeclarationBase(e){return e?.kind===Oe.StructureKind.Class},isNameable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.Function:return!0;default:return!1}},isImplementsClauseable(e){return e?.kind===Oe.StructureKind.Class},isDecoratable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isAbstractable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isAmbientable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.Enum:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.Interface:case Oe.StructureKind.Module:case Oe.StructureKind.Property:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableStatement:return!0;default:return!1}},isExportable(e){switch(e?.kind){case Oe.StructureKind.Class:case Oe.StructureKind.Enum:case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.Interface:case Oe.StructureKind.Module:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableStatement:return!0;default:return!1}},isClassStaticBlock(e){return e?.kind===Oe.StructureKind.ClassStaticBlock},isStatemented(e){switch(e?.kind){case Oe.StructureKind.ClassStaticBlock:case Oe.StructureKind.Constructor:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.Module:case Oe.StructureKind.SetAccessor:case Oe.StructureKind.SourceFile:return!0;default:return!1}},isConstructorDeclarationOverload(e){return e?.kind===Oe.StructureKind.ConstructorOverload},isScoped(e){switch(e?.kind){case Oe.StructureKind.ConstructorOverload:case Oe.StructureKind.Constructor:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isConstructor(e){return e?.kind===Oe.StructureKind.Constructor},isFunctionLike(e){switch(e?.kind){case Oe.StructureKind.Constructor:case Oe.StructureKind.Function:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isConstructSignature(e){return e?.kind===Oe.StructureKind.ConstructSignature},isDecorator(e){return e?.kind===Oe.StructureKind.Decorator},isEnum(e){return e?.kind===Oe.StructureKind.Enum},isNamed(e){switch(e?.kind){case Oe.StructureKind.Enum:case Oe.StructureKind.Interface:case Oe.StructureKind.JsxAttribute:case Oe.StructureKind.ShorthandPropertyAssignment:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.TypeParameter:return!0;default:return!1}},isEnumMember(e){return e?.kind===Oe.StructureKind.EnumMember},isPropertyNamed(e){switch(e?.kind){case Oe.StructureKind.EnumMember:case Oe.StructureKind.GetAccessor:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.PropertyAssignment:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isInitializerExpressionable(e){switch(e?.kind){case Oe.StructureKind.EnumMember:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isExportAssignment(e){return e?.kind===Oe.StructureKind.ExportAssignment},isExportDeclaration(e){return e?.kind===Oe.StructureKind.ExportDeclaration},isExportSpecifier(e){return e?.kind===Oe.StructureKind.ExportSpecifier},isFunctionDeclarationOverload(e){return e?.kind===Oe.StructureKind.FunctionOverload},isAsyncable(e){switch(e?.kind){case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:return!0;default:return!1}},isGeneratorable(e){switch(e?.kind){case Oe.StructureKind.FunctionOverload:case Oe.StructureKind.Function:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:return!0;default:return!1}},isFunction(e){return e?.kind===Oe.StructureKind.Function},isGetAccessor(e){return e?.kind===Oe.StructureKind.GetAccessor},isStaticable(e){switch(e?.kind){case Oe.StructureKind.GetAccessor:case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Property:case Oe.StructureKind.SetAccessor:return!0;default:return!1}},isImportDeclaration(e){return e?.kind===Oe.StructureKind.ImportDeclaration},isImportSpecifier(e){return e?.kind===Oe.StructureKind.ImportSpecifier},isIndexSignature(e){return e?.kind===Oe.StructureKind.IndexSignature},isReadonlyable(e){switch(e?.kind){case Oe.StructureKind.IndexSignature:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:return!0;default:return!1}},isInterface(e){return e?.kind===Oe.StructureKind.Interface},isExtendsClauseable(e){return e?.kind===Oe.StructureKind.Interface},isTypeElementMembered(e){return e?.kind===Oe.StructureKind.Interface},isJSDoc(e){return e?.kind===Oe.StructureKind.JSDoc},isJSDocTag(e){return e?.kind===Oe.StructureKind.JSDocTag},isJsxAttribute(e){return e?.kind===Oe.StructureKind.JsxAttribute},isJsxElement(e){return e?.kind===Oe.StructureKind.JsxElement},isJsxSelfClosingElement(e){return e?.kind===Oe.StructureKind.JsxSelfClosingElement},isJsxTagNamed(e){return e?.kind===Oe.StructureKind.JsxSelfClosingElement},isJsxAttributed(e){return e?.kind===Oe.StructureKind.JsxSelfClosingElement},isJsxSpreadAttribute(e){return e?.kind===Oe.StructureKind.JsxSpreadAttribute},isMethodDeclarationOverload(e){return e?.kind===Oe.StructureKind.MethodOverload},isQuestionTokenable(e){switch(e?.kind){case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.MethodSignature:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:return!0;default:return!1}},isOverrideable(e){switch(e?.kind){case Oe.StructureKind.MethodOverload:case Oe.StructureKind.Method:case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:return!0;default:return!1}},isMethod(e){return e?.kind===Oe.StructureKind.Method},isMethodSignature(e){return e?.kind===Oe.StructureKind.MethodSignature},isModule(e){return e?.kind===Oe.StructureKind.Module},isModuleNamed(e){return e?.kind===Oe.StructureKind.Module},isParameter(e){return e?.kind===Oe.StructureKind.Parameter},isBindingNamed(e){switch(e?.kind){case Oe.StructureKind.Parameter:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isTyped(e){switch(e?.kind){case Oe.StructureKind.Parameter:case Oe.StructureKind.Property:case Oe.StructureKind.PropertySignature:case Oe.StructureKind.TypeAlias:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isScopeable(e){return e?.kind===Oe.StructureKind.Parameter},isPropertyAssignment(e){return e?.kind===Oe.StructureKind.PropertyAssignment},isProperty(e){return e?.kind===Oe.StructureKind.Property},isExclamationTokenable(e){switch(e?.kind){case Oe.StructureKind.Property:case Oe.StructureKind.VariableDeclaration:return!0;default:return!1}},isPropertySignature(e){return e?.kind===Oe.StructureKind.PropertySignature},isSetAccessor(e){return e?.kind===Oe.StructureKind.SetAccessor},isShorthandPropertyAssignment(e){return e?.kind===Oe.StructureKind.ShorthandPropertyAssignment},isSourceFile(e){return e?.kind===Oe.StructureKind.SourceFile},isSpreadAssignment(e){return e?.kind===Oe.StructureKind.SpreadAssignment},isExpressioned(e){return e?.kind===Oe.StructureKind.SpreadAssignment},isTypeAlias(e){return e?.kind===Oe.StructureKind.TypeAlias},isTypeParameter(e){return e?.kind===Oe.StructureKind.TypeParameter},isVariableDeclaration(e){return e?.kind===Oe.StructureKind.VariableDeclaration},isVariableStatement(e){return e?.kind===Oe.StructureKind.VariableStatement}};function N7e(e,r){if(b.ArrayUtils.isReadonlyArray(e)){for(let n of e){let i=r(n);if(i)return i}return}switch(e.kind){case Oe.StructureKind.CallSignature:return I7e(e,r);case Oe.StructureKind.Class:return O7e(e,r);case Oe.StructureKind.ClassStaticBlock:return R7e(e,r);case Oe.StructureKind.ConstructorOverload:return M7e(e,r);case Oe.StructureKind.Constructor:return w7e(e,r);case Oe.StructureKind.ConstructSignature:return F7e(e,r);case Oe.StructureKind.Enum:return G7e(e,r);case Oe.StructureKind.EnumMember:return B7e(e,r);case Oe.StructureKind.ExportDeclaration:return U7e(e,r);case Oe.StructureKind.FunctionOverload:return K7e(e,r);case Oe.StructureKind.Function:return W7e(e,r);case Oe.StructureKind.GetAccessor:return V7e(e,r);case Oe.StructureKind.ImportDeclaration:return j7e(e,r);case Oe.StructureKind.IndexSignature:return H7e(e,r);case Oe.StructureKind.Interface:return q7e(e,r);case Oe.StructureKind.JSDoc:return z7e(e,r);case Oe.StructureKind.JsxElement:return $7e(e,r);case Oe.StructureKind.JsxSelfClosingElement:return X7e(e,r);case Oe.StructureKind.MethodOverload:return Q7e(e,r);case Oe.StructureKind.Method:return Z7e(e,r);case Oe.StructureKind.MethodSignature:return e9e(e,r);case Oe.StructureKind.Module:return r9e(e,r);case Oe.StructureKind.Parameter:return t9e(e,r);case Oe.StructureKind.Property:return n9e(e,r);case Oe.StructureKind.PropertySignature:return i9e(e,r);case Oe.StructureKind.SetAccessor:return a9e(e,r);case Oe.StructureKind.SourceFile:return o9e(e,r);case Oe.StructureKind.TypeAlias:return s9e(e,r);case Oe.StructureKind.VariableStatement:return l9e(e,r);default:return}}function I7e(e,r){return Pf(e,r)||JT(e,r)||Oh(e,r)}function Pf(e,r){return J6(e.docs,r,Oe.StructureKind.JSDoc)}function JT(e,r){return P7e(e,r)}function P7e(e,r){return kd(e.parameters,r,Oe.StructureKind.Parameter)}function Oh(e,r){return J6(e.typeParameters,r,Oe.StructureKind.TypeParameter)}function O7e(e,r){return k7e(e,r)}function k7e(e,r){return UD(e,r)||Oh(e,r)||Pf(e,r)||kd(e.ctors,r,Oe.StructureKind.Constructor)||kd(e.properties,r,Oe.StructureKind.Property)||kd(e.getAccessors,r,Oe.StructureKind.GetAccessor)||kd(e.setAccessors,r,Oe.StructureKind.SetAccessor)||kd(e.methods,r,Oe.StructureKind.Method)}function UD(e,r){return kd(e.decorators,r,Oe.StructureKind.Decorator)}function R7e(e,r){return Pf(e,r)||q6(e,r)}function q6(e,r){return QR(e.statements,r)}function M7e(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)}function w7e(e,r){return EL(e,r)||kd(e.overloads,r,Oe.StructureKind.ConstructorOverload)}function EL(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)||q6(e,r)}function F7e(e,r){return Pf(e,r)||JT(e,r)||Oh(e,r)}function G7e(e,r){return Pf(e,r)||kd(e.members,r,Oe.StructureKind.EnumMember)}function B7e(e,r){return Pf(e,r)}function U7e(e,r){return J6(e.namedExports,r,Oe.StructureKind.ExportSpecifier)||kd(e.assertElements,r,Oe.StructureKind.AssertEntry)}function K7e(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)}function W7e(e,r){return EL(e,r)||kd(e.overloads,r,Oe.StructureKind.FunctionOverload)}function V7e(e,r){return UD(e,r)||EL(e,r)}function j7e(e,r){return J6(e.namedImports,r,Oe.StructureKind.ImportSpecifier)||kd(e.assertElements,r,Oe.StructureKind.AssertEntry)}function H7e(e,r){return Pf(e,r)}function q7e(e,r){return Oh(e,r)||Pf(e,r)||J7e(e,r)}function J7e(e,r){return kd(e.callSignatures,r,Oe.StructureKind.CallSignature)||kd(e.constructSignatures,r,Oe.StructureKind.ConstructSignature)||kd(e.indexSignatures,r,Oe.StructureKind.IndexSignature)||kd(e.methods,r,Oe.StructureKind.MethodSignature)||kd(e.properties,r,Oe.StructureKind.PropertySignature)}function z7e(e,r){return kd(e.tags,r,Oe.StructureKind.JSDocTag)}function $7e(e,r){return QR(e.attributes,r)||QR(e.children,r)}function X7e(e,r){return Y7e(e,r)}function Y7e(e,r){return QR(e.attributes,r)}function Q7e(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)}function Z7e(e,r){return UD(e,r)||EL(e,r)||kd(e.overloads,r,Oe.StructureKind.MethodOverload)}function e9e(e,r){return Pf(e,r)||JT(e,r)||Oh(e,r)}function r9e(e,r){return Pf(e,r)||q6(e,r)}function t9e(e,r){return UD(e,r)}function n9e(e,r){return Pf(e,r)||UD(e,r)}function i9e(e,r){return Pf(e,r)}function a9e(e,r){return UD(e,r)||EL(e,r)}function o9e(e,r){return q6(e,r)}function s9e(e,r){return Oh(e,r)||Pf(e,r)}function l9e(e,r){return Pf(e,r)||kd(e.declarations,r,Oe.StructureKind.VariableDeclaration)}function kd(e,r,n){if(e!=null)for(let i of e){let a=r(npe(i,n));if(a)return a}}function J6(e,r,n){if(!(e==null||!(e instanceof Array))){for(let i of e)if(ipe(i)){let a=r(npe(i,n));if(a)return a}}}function QR(e,r){if(!(e==null||!(e instanceof Array))){for(let n of e)if(ipe(n)){let i=r(n);if(i)return i}}}function npe(e,r){return e.kind==null&&(e.kind=r),e}function ipe(e){return e!=null&&typeof e.kind=="number"}function QH(e){return e.iterateLastCharCodes(r=>r===ac.CLOSE_BRACE?!0:b.StringUtils.isWhitespaceCharCode(r)?void 0:!1)||!1}var Gj=class extends of{constructor(r,n){super(),this.factory=r,this.options=n}printTexts(r,n){if(n!=null)if(typeof n=="string"||n instanceof Function)this.printText(r,n);else for(let i of n)QH(r)?r.blankLineIfLastNot():r.isAtStartOfFirstLineOfBlock()||r.newLineIfLastNot(),this.printText(r,i)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.Method:this.options.isAmbient||i(),this.factory.forMethodDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Property:this.factory.forPropertyDeclaration().printText(r,n);break;case Oe.StructureKind.GetAccessor:this.options.isAmbient||i(),this.factory.forGetAccessorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.SetAccessor:this.options.isAmbient||i(),this.factory.forSetAccessorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Constructor:this.options.isAmbient||i(),this.factory.forConstructorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.ClassStaticBlock:i(),this.factory.forClassStaticBlockDeclaration().printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}function i(){r.isAtStartOfFirstLineOfBlock()||r.blankLineIfLastNot()}}},Bj=class extends Ns{constructor(r){super(r)}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&r.blankLine(),this.printText(r,n[i])}printTextInternal(r,n){r.write("static"),r.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(r,n)})}},Uj=class extends Ns{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&(this.options.isAmbient?r.newLine():r.blankLine()),this.printText(r,n[i])}printTextInternal(r,n){this.printOverloads(r,i()),this.printHeader(r,n),this.options.isAmbient?r.write(";"):r.space().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)});function i(){let a=b.ObjectUtils.clone(n.overloads);if(!(a==null||a.length===0)){for(let s of a)mu(s,"scope",n.scope);return a}}}printOverloads(r,n){if(!(n==null||n.length===0))for(let i of n)this.printOverload(r,i),r.newLine()}printOverload(r,n){this.printLeadingTrivia(r,n),this.printHeader(r,n),r.write(";"),this.printTrailingTrivia(r,n)}printHeader(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write("constructor"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters)}},Kj=class extends Ns{constructor(r,n){super(r),this.options=n,this.blankLineWriter=new uS(this)}printTexts(r,n){this.blankLineWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.write(`get ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),this.options.isAmbient||n.isAbstract?r.write(";"):r.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)})}},Wj=class extends Ns{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&(this.options.isAmbient?r.newLine():r.blankLine()),this.printText(r,n[i])}printTextInternal(r,n){this.printOverloads(r,n.name,i()),this.printHeader(r,n.name,n),this.options.isAmbient||n.isAbstract?r.write(";"):r.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)});function i(){let a=b.ObjectUtils.clone(n.overloads);if(!(a==null||a.length===0)){for(let s of a)mu(s,"scope",n.scope),mu(s,"isStatic",n.isStatic),mu(s,"isAbstract",n.isAbstract),mu(s,"hasQuestionToken",n.hasQuestionToken);return a}}}printOverloads(r,n,i){if(!(i==null||i.length===0))for(let a of i)this.printOverload(r,n,a),r.newLine()}printOverload(r,n,i){this.printLeadingTrivia(r,i),this.printHeader(r,n,i),r.write(";"),this.printTrailingTrivia(r,i)}printHeader(r,n,i){this.factory.forJSDoc().printDocs(r,i.docs),i.decorators!=null&&this.factory.forDecorator().printTexts(r,i.decorators),this.factory.forModifierableNode().printText(r,i),r.write(n),r.conditionalWrite(i.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,i.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,i.parameters),this.factory.forReturnTypedNode().printText(r,i)}},Vj=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),r.conditionalWrite(n.hasExclamationToken&&!n.hasQuestionToken,"!"),this.factory.forTypedNode(":").printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n),r.write(";")}},jj=class extends Ns{constructor(r,n){super(r),this.options=n,this.multipleWriter=new uS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forDecorator().printTexts(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.write(`set ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),this.options.isAmbient||n.isAbstract?r.write(";"):r.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.options).printText(r,n)})}},tL=class extends of{printText(r,n){typeof n=="string"?r.write(n):n(r)}},Hj=class extends Ns{printTexts(r,n){this.printMultiple(r,n,()=>r.newLine())}printTextsInline(r,n){this.printMultiple(r,n,()=>r.space())}printTextInternal(r,n){r.write(`@${n.name}`),this.printTypeArguments(r,n),this.printArguments(r,n)}printTypeArguments(r,n){if(!(n.typeArguments==null||n.typeArguments.length===0)){r.write("<");for(let i=0;i<n.typeArguments.length;i++)r.conditionalWrite(i>0,", "),r.write(this.getTextWithQueuedChildIndentation(r,n.typeArguments[i]));r.write(">")}}printArguments(r,n){if(n.arguments==null)return;r.write("(");let i=n.arguments instanceof Array?n.arguments:[n.arguments];for(let a=0;a<i.length;a++)r.conditionalWrite(a>0,", "),r.write(this.getTextWithQueuedChildIndentation(r,i[a]));r.write(")")}printMultiple(r,n,i){if(!(n==null||n.length===0))for(let a of n)this.printText(r,a),i()}},qj=class extends Ns{printDocs(r,n){if(n!=null)for(let i of n)this.printText(r,i),r.newLine()}printTextInternal(r,n){let a=f(this).split(/\r?\n/),s=a[0].length===0,u=a.length<=1,p=s?1:0;if(r.write("/**"),u?r.space():r.newLine(),u)r.write(a[p]);else for(let m=p;m<a.length;m++)r.write(" *"),a[m].length>0&&r.write(` ${a[m]}`),r.newLine();r.spaceIfLastNot(),r.write("*/");function f(m){if(typeof n=="string")return n;let g=m.getNewWriter(r);return typeof n=="function"?n(g):(n.description&&GE(g,n.description),n.tags&&n.tags.length>0&&(g.getLength()>0&&g.newLine(),m.factory.forJSDocTag({printStarsOnNewLine:!1}).printTexts(g,n.tags))),g.toString()}}},Jj=class extends Ns{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++)i>0&&(r.newLine(),r.conditionalWrite(this.options.printStarsOnNewLine," * ")),this.printText(r,n[i])}printTextInternal(r,n){let a=s(this).split(/\r?\n/);for(let u=0;u<a.length;u++)u>0&&(r.newLine(),this.options.printStarsOnNewLine&&r.write(" *")),a[u].length>0&&(this.options.printStarsOnNewLine&&u>0&&r.space(),r.write(a[u]));function s(u){if(typeof n=="string")return n;let p=u.getNewWriter(r);if(typeof n=="function")n(p);else{n.text&&GE(p,n.text);let f=p.toString();p.unsafeInsert(0,`@${n.tagName}`+(f.length>0&&!b.StringUtils.startsWithNewLine(f)?" ":""))}return p.toString()}}},zj=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new uS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.conditionalWrite(n.isConst,"const "),r.write(`enum ${n.name} `).inlineBlock(()=>{this.factory.forEnumMember().printTexts(r,n.members)})}},$j=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new GT(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){if(n instanceof Function){n(r);return}else if(typeof n=="string"){r.write(n);return}if(this.factory.forJSDoc().printDocs(r,n.docs),GBe(n.name)||b.StringUtils.isQuoted(n.name)?r.write(n.name):r.quote(n.name),typeof n.value=="string"){let{value:i}=n;r.hangingIndent(()=>r.write(" = ").quote(i))}else typeof n.value=="number"?r.write(` = ${n.value}`):this.factory.forInitializerExpressionableNode().printText(r,n)}},Xj=class extends of{constructor(r){super(),this.factory=r,this.multipleWriter=new GT(this),this.options={isAmbient:!1}}printTexts(r,n){this.multipleWriter.printText(r,n)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.PropertyAssignment:this.factory.forPropertyAssignment().printText(r,n);break;case Oe.StructureKind.ShorthandPropertyAssignment:this.factory.forShorthandPropertyAssignment().printText(r,n);break;case Oe.StructureKind.SpreadAssignment:this.factory.forSpreadAssignment().printText(r,n);break;case Oe.StructureKind.Method:this.factory.forMethodDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.GetAccessor:this.factory.forGetAccessorDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.SetAccessor:this.factory.forSetAccessorDeclaration(this.options).printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}}},Yj=class extends Ns{printTextInternal(r,n){r.hangingIndent(()=>{r.write(`${n.name}: `),GE(r,n.initializer)})}},Qj=class extends Ns{printTextInternal(r,n){r.write(`${n.name}`)}},Zj=class extends Ns{printTextInternal(r,n){r.hangingIndent(()=>{r.write("..."),GE(r,n.expression)})}},eH=class extends Ns{constructor(r,n){super(r),this.options=n}printTexts(r,n){if(n!=null)for(let i=0;i<n.length;i++){let a=n[i];if(i>0){let s=n[i-1];this.options.isAmbient||s.hasDeclareKeyword&&a.hasDeclareKeyword?r.newLine():r.blankLine()}this.printText(r,a)}}printTextInternal(r,n){this.printOverloads(r,n.name,i()),this.printHeader(r,n.name,n),this.options.isAmbient||n.hasDeclareKeyword?r.write(";"):r.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(r,n)});function i(){let a=b.ObjectUtils.clone(n.overloads);if(!(a==null||a.length===0)){for(let s of a)mu(s,"hasDeclareKeyword",n.hasDeclareKeyword),mu(s,"isExported",n.isExported),mu(s,"isDefaultExport",n.isDefaultExport);return a}}}printOverloads(r,n,i){if(!(i==null||i.length===0))for(let a of i)this.printOverload(r,n,a),r.newLine()}printOverload(r,n,i){this.printLeadingTrivia(r,i),this.printHeader(r,n,i),r.write(";"),this.printTrailingTrivia(r,i)}printHeader(r,n,i){this.factory.forJSDoc().printDocs(r,i.docs),this.factory.forModifierableNode().printText(r,i),r.write("function"),r.conditionalWrite(i.isGenerator,"*"),b.StringUtils.isNullOrWhitespace(n)||r.write(` ${n}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,i.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,i.parameters),this.factory.forReturnTypedNode().printText(r,i)}},rH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new Ih(this)}printTextsWithParenthesis(r,n){r.write("("),n!=null&&this.factory.forParameterDeclaration().printTexts(r,n),r.write(")")}printTexts(r,n){n==null||n.length===0||r.hangingIndent(()=>{this.multipleWriter.printText(r,n)})}printTextInternal(r,n){if(n.name==null)throw new b.errors.NotImplementedError("Not implemented scenario where parameter declaration structure doesn't have a name. Please open an issue if you need this.");this.factory.forDecorator().printTextsInline(r,n.decorators),this.factory.forModifierableNode().printText(r,n),r.conditionalWrite(n.isRestParameter,"..."),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),this.factory.forTypedNode(":",n.hasQuestionToken).printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n)}},tH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode(!0).printText(r,n),r.write(";")}},nH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),r.write("new"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),r.write(";")}},iH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(`[${n.keyName||"key"}: ${n.keyType||"string"}]`),this.factory.forReturnTypedNode().printText(r,n),r.write(";")}},aH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new uS(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){if(this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(`interface ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),r.space(),n.extends!=null){let i=n.extends instanceof Array?n.extends.map(a=>this.getText(r,a)).join(", "):this.getText(r,n.extends);b.StringUtils.isNullOrWhitespace(i)||r.hangingIndent(()=>r.write(`extends ${i} `))}r.inlineBlock(()=>{this.factory.forTypeElementMemberedNode().printText(r,n)})}},oH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(r,n.parameters),this.factory.forReturnTypedNode().printText(r,n),r.write(";")}},sH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(n.name),r.conditionalWrite(n.hasQuestionToken,"?"),this.factory.forTypedNode(":").printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n),r.write(";")}},lH=class extends of{constructor(r){super(),this.factory=r}printText(r,n){this.factory.forCallSignatureDeclaration().printTexts(r,n.callSignatures),this.conditionalSeparator(r,n.constructSignatures),this.factory.forConstructSignatureDeclaration().printTexts(r,n.constructSignatures),this.conditionalSeparator(r,n.indexSignatures),this.factory.forIndexSignatureDeclaration().printTexts(r,n.indexSignatures),this.conditionalSeparator(r,n.properties),this.factory.forPropertySignature().printTexts(r,n.properties),this.conditionalSeparator(r,n.methods),this.factory.forMethodSignature().printTexts(r,n.methods)}conditionalSeparator(r,n){!b.ArrayUtils.isNullOrEmpty(n)&&!r.isAtStartOfFirstLineOfBlock()&&r.newLine()}},uH=class extends of{constructor(r){super(),this.factory=r}printTexts(r,n){if(n!=null)if(typeof n=="string"||n instanceof Function)this.printText(r,n);else for(let i of n)QH(r)?r.blankLineIfLastNot():r.isAtStartOfFirstLineOfBlock()||r.newLineIfLastNot(),this.printText(r,i)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.PropertySignature:this.factory.forPropertySignature().printText(r,n);break;case Oe.StructureKind.MethodSignature:this.factory.forMethodSignature().printText(r,n);break;case Oe.StructureKind.CallSignature:this.factory.forCallSignatureDeclaration().printText(r,n);break;case Oe.StructureKind.IndexSignature:this.factory.forIndexSignatureDeclaration().printText(r,n);break;case Oe.StructureKind.ConstructSignature:this.factory.forConstructSignatureDeclaration().printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}}},cH=class extends Ns{printTextInternal(r,n){if(i())this.factory.forJsxAttribute().printTextWithoutTrivia(r,n);else if(n.kind===Oe.StructureKind.JsxSpreadAttribute)this.factory.forJsxSpreadAttribute().printTextWithoutTrivia(r,n);else throw b.errors.throwNotImplementedForNeverValueError(n);function i(a){return n.kind==null||n.kind===Oe.StructureKind.JsxAttribute}}},dH=class extends Ns{printTextInternal(r,n){r.write(n.name),n.initializer!=null&&r.write("=").write(n.initializer)}},fH=class extends Ns{printTextInternal(r,n){i(n)?this.factory.forJsxElement().printText(r,n):n.kind===Oe.StructureKind.JsxSelfClosingElement?this.factory.forJsxSelfClosingElement().printText(r,n):b.errors.throwNotImplementedForNeverValueError(n);function i(a){return a.kind==null||a.kind===Oe.StructureKind.JsxElement}}},pH=class extends Ns{printTextInternal(r,n){r.hangingIndent(()=>{r.write(`<${n.name}`),n.attributes&&this.printAttributes(r,n.attributes),r.write(">")}),this.printChildren(r,n.children),r.write(`</${n.name}>`)}printAttributes(r,n){let i=this.factory.forJsxAttributeDecider();for(let a of n)r.space(),i.printText(r,a)}printChildren(r,n){n!=null&&(r.newLine(),r.indent(()=>{for(let i of n)this.factory.forJsxChildDecider().printText(r,i),r.newLine()}))}},mH=class extends Ns{printTextInternal(r,n){r.hangingIndent(()=>{r.write(`<${n.name}`),n.attributes&&this.printAttributes(r,n.attributes),r.write(" />")})}printAttributes(r,n){let i=this.factory.forJsxAttributeDecider();for(let a of n)r.space(),i.printText(r,a)}},_H=class extends Ns{printTextInternal(r,n){r.hangingIndent(()=>{r.write("{"),r.write("..."),r.write(n.expression),r.write("}")})}},gH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new GT(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printAssertClause(r,n){!n||(r.write("assert "),r.inlineBlock(()=>{this.printTexts(r,n)}))}printTextInternal(r,n){r.write(n.name),r.write(": "),r.quote(n.value)}},yH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){r.write("export"),n.isExportEquals!==!1?r.write(" = "):r.write(" default "),r.write(this.getTextWithQueuedChildIndentation(r,n.expression)).write(";")}},vH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=n.moduleSpecifier!=null&&n.moduleSpecifier.length>0;if(n.namedExports!=null&&n.namedExports.length>0&&n.namespaceExport!=null)throw new b.errors.InvalidOperationError("An export declaration cannot have both a namespace export and a named export.");r.write("export"),n.isTypeOnly&&r.write(" type"),n.namedExports!=null&&n.namedExports.length>0?(r.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(r,n.namedExports)):n.namespaceExport!=null?(r.write(" *"),b.StringUtils.isNullOrWhitespace(n.namespaceExport)||r.write(` as ${n.namespaceExport}`)):i?r.write(" *"):r.write(" {").conditionalWrite(this.factory.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces," ").write("}"),i&&(r.write(" from "),r.quote(n.moduleSpecifier)),n.assertElements&&(r.space(),this.factory.forAssertEntry().printAssertClause(r,n.assertElements)),r.write(";")}},hH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=n.namedImports!=null&&n.namedImports.length>0;if(i&&n.namespaceImport!=null)throw new b.errors.InvalidOperationError("An import declaration cannot have both a namespace import and a named import.");r.write("import"),n.isTypeOnly&&r.write(" type"),n.defaultImport!=null&&(r.write(` ${n.defaultImport}`),r.conditionalWrite(i||n.namespaceImport!=null,",")),n.namespaceImport!=null&&r.write(` * as ${n.namespaceImport}`),n.namedImports!=null&&n.namedImports.length>0&&(r.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(r,n.namedImports)),r.conditionalWrite(n.defaultImport!=null||i||n.namespaceImport!=null," from"),r.write(" "),r.quote(n.moduleSpecifier),n.assertElements&&(r.space(),this.factory.forAssertEntry().printAssertClause(r,n.assertElements)),r.write(";")}},EH=class extends Ns{constructor(r,n){super(r),this.options=n,this.blankLineFormattingWriter=new uS(this)}printTexts(r,n){this.blankLineFormattingWriter.printText(r,n)}printTextInternal(r,n){n=this.validateAndGetStructure(n),this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),n.declarationKind==null||n.declarationKind!==Oe.ModuleDeclarationKind.Global?r.write(`${n.declarationKind||"namespace"} ${n.name}`):r.write("global"),n.hasDeclareKeyword&&b.StringUtils.isQuoted(n.name.trim())&&n.hasOwnProperty(b.nameof(n,"statements"))&&n.statements==null?r.write(";"):(r.write(" "),r.inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:n.hasDeclareKeyword||this.options.isAmbient}).printText(r,n)}))}validateAndGetStructure(r){if(b.StringUtils.isQuoted(r.name.trim())){if(r.declarationKind===Oe.ModuleDeclarationKind.Namespace)throw new b.errors.InvalidOperationError(`Cannot print a namespace with quotes for namespace with name ${r.name}. Use ModuleDeclarationKind.Module instead.`);r=b.ObjectUtils.clone(r),mu(r,"hasDeclareKeyword",!0),mu(r,"declarationKind",Oe.ModuleDeclarationKind.Module)}return r}},bH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new Ih(this)}printTextsWithBraces(r,n){let i=this.factory.getFormatCodeSettings();r.write("{");let a=this.getNewWriter(r);this.printTexts(a,n);let s=a.toString();i.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!b.StringUtils.startsWithNewLine(s)&&r.space(),r.write(s),i.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!b.StringUtils.endsWithNewLine(s)&&r.space(),r.write("}")}printTexts(r,n){n instanceof Function?this.printText(r,n):this.multipleWriter.printText(r,n)}printTextInternal(r,n){let i=this.getNewWriterWithQueuedChildIndentation(r);typeof n=="string"?i.write(n):n instanceof Function?n(i):(i.write(n.name),b.StringUtils.isNullOrWhitespace(n.alias)||(i.isLastNewLine()||i.space(),i.write(`as ${n.alias}`))),r.write(i.toString())}},SH=class extends Ns{constructor(r,n){super(r),this.options=n}printTextInternal(r,n){this.factory.forStatementedNode(this.options).printText(r,n),r.conditionalNewLine(!r.isAtStartOfFirstLineOfBlock()&&!r.isLastNewLine())}},TH=class extends of{constructor(r,n){super(),this.factory=r,this.options=n}printText(r,n){this.factory.forStatement(this.options).printTexts(r,n.statements)}},xH=class extends of{constructor(r,n){super(),this.factory=r,this.options=n}printTexts(r,n){if(n!=null)if(typeof n=="string"||n instanceof Function)this.printText(r,n);else for(let i of n)QH(r)?r.blankLineIfLastNot():r.isAtStartOfFirstLineOfBlock()||r.newLineIfLastNot(),this.printText(r,i)}printText(r,n){if(typeof n=="string"||n instanceof Function||n==null){this.printTextOrWriterFunc(r,n);return}switch(n.kind){case Oe.StructureKind.Function:this.options.isAmbient||i(),this.factory.forFunctionDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Class:i(),this.factory.forClassDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Interface:i(),this.factory.forInterfaceDeclaration().printText(r,n);break;case Oe.StructureKind.TypeAlias:this.factory.forTypeAliasDeclaration().printText(r,n);break;case Oe.StructureKind.VariableStatement:this.factory.forVariableStatement().printText(r,n);break;case Oe.StructureKind.ImportDeclaration:this.factory.forImportDeclaration().printText(r,n);break;case Oe.StructureKind.Module:i(),this.factory.forModuleDeclaration(this.options).printText(r,n);break;case Oe.StructureKind.Enum:i(),this.factory.forEnumDeclaration().printText(r,n);break;case Oe.StructureKind.ExportDeclaration:this.factory.forExportDeclaration().printText(r,n);break;case Oe.StructureKind.ExportAssignment:this.factory.forExportAssignment().printText(r,n);break;default:b.errors.throwNotImplementedForNeverValueError(n)}function i(){r.isAtStartOfFirstLineOfBlock()||r.blankLineIfLastNot()}}};Oe.VariableDeclarationKind=void 0;(function(e){e.Var="var",e.Let="let",e.Const="const"})(Oe.VariableDeclarationKind||(Oe.VariableDeclarationKind={}));var DH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),r.hangingIndent(()=>{this.factory.forModifierableNode().printText(r,n),r.write(`${n.declarationKind||Oe.VariableDeclarationKind.Let} `),this.factory.forVariableDeclaration().printTexts(r,n.declarations),r.write(";")})}},CH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new H_(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){this.factory.forJSDoc().printDocs(r,n.docs),this.factory.forModifierableNode().printText(r,n),r.write(`type ${n.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(r,n.typeParameters),this.factory.forTypedNode(" =").printText(r,n),r.write(";")}},AH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new Ih(this)}printTextsWithBrackets(r,n){n==null||n.length===0||(r.write("<"),this.printTexts(r,n),r.write(">"))}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){if(typeof n=="string"){r.write(n);return}r.hangingIndent(()=>{if(n.variance!=null&&((n.variance&Oe.TypeParameterVariance.In)!==0&&r.write("in "),(n.variance&Oe.TypeParameterVariance.Out)!==0&&r.write("out ")),r.write(n.name),n.constraint!=null){let i=this.getText(r,n.constraint);b.StringUtils.isNullOrWhitespace(i)||r.write(` extends ${i}`)}if(n.default!=null){let i=this.getText(r,n.default);b.StringUtils.isNullOrWhitespace(i)||r.write(` = ${i}`)}})}},LH=class extends Ns{constructor(){super(...arguments),this.multipleWriter=new Ih(this)}printTexts(r,n){this.multipleWriter.printText(r,n)}printTextInternal(r,n){r.write(n.name),r.conditionalWrite(n.hasExclamationToken,"!"),this.factory.forTypedNode(":").printText(r,n),this.factory.forInitializerExpressionableNode().printText(r,n)}};function ape(e){return class extends e{getExtends(){var r;let n=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);return(r=n?.getTypeNodes())!==null&&r!==void 0?r:[]}addExtends(r){return this.insertExtends(this.getExtends().length,r)}insertExtends(r,n){let i=this.getExtends(),a=typeof n=="string";if(typeof n=="string")b.errors.throwIfWhitespaceOrNotString(n,"texts"),n=[n];else if(n.length===0)return[];let s=this._getWriterWithQueuedChildIndentation();if(new Ih(new tL).printText(s,n),r=ku(r,i.length),i.length>0){let f=this.getHeritageClauseByKindOrThrow(b.SyntaxKind.ExtendsKeyword);j_({parent:f.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:s.toString(),useTrailingCommas:!1})}else{let m=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken).getStart(),g=/\s/.test(this.getSourceFile().getFullText()[m-1]),D=`extends ${s.toString()} `;g||(D=" "+D),qa({parent:this,insertPos:m,newText:D})}let p=this.getExtends();return a?p[r]:af(i,p,r,!1)}removeExtends(r){let n=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);if(n==null)throw new b.errors.InvalidOperationError("Cannot remove an extends when none exist.");return n.removeExpression(r),this}set(r){return io(e.prototype,this,r),r.extends!=null&&(this.getExtends().forEach(n=>this.removeExtends(n)),this.addExtends(r.extends)),this}getStructure(){return uo(e.prototype,this,{extends:this.getExtends().map(r=>r.getText())})}}}function zT(e){return class extends e{isGenerator(){return this.compilerNode.asteriskToken!=null}getAsteriskToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.asteriskToken)}getAsteriskTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAsteriskToken(),"Expected to find an asterisk token.")}setIsGenerator(r){let n=this.getAsteriskToken();return n!=null===r?this:(n==null?qa({insertPos:u9e(this),parent:this,newText:"*"}):Nh({children:[n],getSiblingFormatting:()=>El.Space}),this)}set(r){return io(e.prototype,this,r),r.isGenerator!=null&&this.setIsGenerator(r.isGenerator),this}getStructure(){return uo(e.prototype,this,{isGenerator:this.isGenerator()})}}}function u9e(e){if(e.getKind()===b.SyntaxKind.FunctionDeclaration)return e.getFirstChildByKindOrThrow(b.SyntaxKind.FunctionKeyword).getEnd();let r=e;if(r.getName==null)throw new b.errors.NotImplementedError("Expected a name node for a non-function declaration.");return r.getNameNode().getStart()}function ZH(e){return class extends e{getHeritageClauses(){var r;let n=this.compilerNode.heritageClauses;return(r=n?.map(i=>this._getNodeFromCompilerNode(i)))!==null&&r!==void 0?r:[]}getHeritageClauseByKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getHeritageClauseByKind(r),`Expected to have heritage clause of kind ${b.getSyntaxKindName(r)}.`)}getHeritageClauseByKind(r){return this.getHeritageClauses().find(n=>n.compilerNode.token===r)}}}function ope(e){return class extends e{getImplements(){var r;let n=this.getHeritageClauseByKind(b.SyntaxKind.ImplementsKeyword);return(r=n?.getTypeNodes())!==null&&r!==void 0?r:[]}addImplements(r){return this.insertImplements(this.getImplements().length,r)}insertImplements(r,n){let i=this.getImplements(),a=typeof n=="string";if(typeof n=="string")b.errors.throwIfWhitespaceOrNotString(n,"texts"),n=[n];else if(n.length===0)return[];let s=this._getWriterWithQueuedChildIndentation();new Ih(new tL).printText(s,n);let p=this.getHeritageClauses();if(r=ku(r,i.length),i.length>0){let m=this.getHeritageClauseByKindOrThrow(b.SyntaxKind.ImplementsKeyword);j_({parent:m.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:s.toString(),useTrailingCommas:!1})}else{let g=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken).getStart(),D=/\s/.test(this.getSourceFile().getFullText()[g-1]),P=`implements ${s.toString()} `;D||(P=" "+P),qa({parent:p.length===0?this:p[0].getParentSyntaxListOrThrow(),insertPos:g,newText:P})}let f=this.getImplements();return a?f[0]:af(i,f,r,!1)}removeImplements(r){let n=this.getHeritageClauseByKind(b.SyntaxKind.ImplementsKeyword);if(n==null)throw new b.errors.InvalidOperationError("Cannot remove an implements when none exist.");return n.removeExpression(r),this}set(r){return io(e.prototype,this,r),r.implements!=null&&(this.getImplements().forEach(n=>this.removeImplements(n)),this.addImplements(r.implements)),this}getStructure(){return uo(e.prototype,this,{implements:this.getImplements().map(r=>r.getText())})}}}function z6(e){return class extends e{hasInitializer(){return this.compilerNode.initializer!=null}getInitializerIfKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInitializerIfKind(r),`Expected to find an initializer of kind '${b.getSyntaxKindName(r)}'.`)}getInitializerIfKind(r){let n=this.getInitializer();if(!(n!=null&&n.getKind()!==r))return n}getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),"Expected to find an initializer.")}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}}}function $T(e){return c9e(z6(e))}function c9e(e){return class extends e{removeInitializer(){let r=this.getInitializer();if(r==null)return this;let n=r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.EqualsToken);return Bs({children:[n,r],removePrecedingSpaces:!0}),this}setInitializer(r){let n=Xg(this._getWriterWithQueuedChildIndentation(),r);b.errors.throwIfWhitespaceOrNotString(n,"textOrWriterFunction"),this.hasInitializer()&&this.removeInitializer();let i=this.getLastChildIfKind(b.SyntaxKind.SemicolonToken);return qa({insertPos:i!=null?i.getPos():this.getEnd(),parent:this,newText:` = ${n}`}),this}set(r){return io(e.prototype,this,r),r.initializer!=null?this.setInitializer(r.initializer):r.hasOwnProperty(b.nameof(r,"initializer"))&&this.removeInitializer(),this}getStructure(){let r=this.getInitializer();return uo(e.prototype,this,{initializer:r?r.getText():void 0})}}}function sc(e){return class extends e{getJsDocs(){var r;let n=this.compilerNode.jsDoc;return(r=n?.map(i=>this._getNodeFromCompilerNode(i)))!==null&&r!==void 0?r:[]}addJsDoc(r){return this.addJsDocs([r])[0]}addJsDocs(r){return this.insertJsDocs(ad(this.compilerNode.jsDoc),r)}insertJsDoc(r,n){return this.insertJsDocs(r,[n])[0]}insertJsDocs(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this._getWriterWithQueuedIndentation();this._context.structurePrinterFactory.forJSDoc().printDocs(i,n),i.write("");let s=i.toString(),u=this.getJsDocs();r=ku(r,u.length);let p=r===u.length?this.getStart():u[r].getStart();return qa({insertPos:p,parent:this,newText:s}),af(u,this.getJsDocs(),r,!1)}set(r){return io(e.prototype,this,r),r.docs!=null&&(this.getJsDocs().forEach(n=>n.remove()),this.addJsDocs(r.docs)),this}getStructure(){return uo(e.prototype,this,{docs:this.getJsDocs().map(r=>r.getStructure())})}}}function KD(e){return class extends e{getLiteralText(){return this.compilerNode.text}isTerminated(){return!this.compilerNode.isUnterminated}hasExtendedUnicodeEscape(){return this.compilerNode.hasExtendedUnicodeEscape||!1}}}function sf(e){return class extends e{getModifiers(){return this.getCompilerModifiers().map(r=>this._getNodeFromCompilerNode(r))}getFirstModifierByKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getFirstModifierByKind(r),`Expected a modifier of syntax kind: ${b.getSyntaxKindName(r)}`)}getFirstModifierByKind(r){for(let n of this.getCompilerModifiers())if(n.kind===r)return this._getNodeFromCompilerNode(n)}hasModifier(r){return typeof r=="string"?this.getModifiers().some(n=>n.getText()===r):this.getCompilerModifiers().some(n=>n.kind===r)}toggleModifier(r,n){return n==null&&(n=!this.hasModifier(r)),n?this.addModifier(r):this.removeModifier(r),this}addModifier(r){let n=this.getModifiers(),i=this.getModifiers().filter(g=>g.getKind()!==b.SyntaxKind.Decorator),a=i.find(g=>g.getText()===r);if(a!=null)return a;let s=m(this),u,p;return i.length===0||s===i[0].getStart()?(p=r+" ",u=s):(p=" "+r,u=s+1),qa({parent:n.length===0?this:n[0].getParentSyntaxListOrThrow(),insertPos:s,newText:p}),this.getModifiers().find(g=>g.getStart()===u);function m(g){let D=P();for(let B of d9e(r))for(let K=0;K<i.length;K++){let h=i[K];if(h.getText()===B){D<h.getEnd()&&(D=h.getEnd());break}}return D;function P(){if(i.length>0)return i[0].getStart();for(let B of g._getChildrenIterator())if(!(B.getKind()===b.SyntaxKind.SyntaxList||b.ts.isJSDocCommentContainingNode(B.compilerNode)))return B.getStart();return g.getStart()}}}removeModifier(r){let n=this.getModifiers(),i=n.find(a=>a.getText()===r);return i==null?!1:(Bs({children:[n.length===1?i.getParentSyntaxListOrThrow():i],removeFollowingSpaces:!0}),!0)}getCompilerModifiers(){return this.compilerNode.modifiers||[]}}}function d9e(e){switch(e){case"export":return[];case"public":case"protected":case"private":return[];case"default":return["export"];case"const":return["export"];case"declare":return["export","default"];case"static":return["public","protected","private"];case"override":return["public","private","protected","static"];case"abstract":return["export","default","declare","public","private","protected","static","override"];case"async":return["export","default","declare","public","private","protected","static","override","abstract"];case"readonly":return["export","default","declare","public","private","protected","static","override","abstract"];case"out":return["in"];case"in":return[];default:b.errors.throwNotImplementedForNeverValueError(e)}}function eq(e){return class extends e{addImportDeclaration(r){return this.addImportDeclarations([r])[0]}addImportDeclarations(r){let n=this._getCompilerStatementsWithComments();return this.insertImportDeclarations(i(),r);function i(){let a=0,s=!0;for(let u=0;u<n.length;u++){let p=n[u];s&&p.kind===b.SyntaxKind.MultiLineCommentTrivia?a=u+1:(s=!1,p.kind===b.SyntaxKind.ImportDeclaration&&(a=u+1))}return a}}insertImportDeclaration(r,n){return this.insertImportDeclarations(r,[n])[0]}insertImportDeclarations(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ImportDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forImportDeclaration().printTexts(i,n)},{previousNewLine:s=>Tr.isImportDeclaration(s)||rj(s.compilerNode),nextNewLine:s=>Tr.isImportDeclaration(s)})}})}getImportDeclaration(r){return this.getImportDeclarations().find(n());function n(){return typeof r=="string"?i=>i.getModuleSpecifierValue()===r:r}}getImportDeclarationOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getImportDeclaration(r),"Expected to find an import with the provided condition.")}getImportDeclarations(){return this.getStatements().filter(Tr.isImportDeclaration)}addExportDeclaration(r){return this.addExportDeclarations([r])[0]}addExportDeclarations(r){return this.insertExportDeclarations(this.getChildSyntaxListOrThrow().getChildCount(),r)}insertExportDeclaration(r,n){return this.insertExportDeclarations(r,[n])[0]}insertExportDeclarations(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ExportDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forExportDeclaration().printTexts(i,n)},{previousNewLine:s=>Tr.isExportDeclaration(s)||rj(s.compilerNode),nextNewLine:s=>Tr.isExportDeclaration(s)})}})}getExportDeclaration(r){return this.getExportDeclarations().find(n());function n(){return typeof r=="string"?i=>i.getModuleSpecifierValue()===r:r}}getExportDeclarationOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExportDeclaration(r),"Expected to find an export declaration with the provided condition.")}getExportDeclarations(){return this.getStatements().filter(Tr.isExportDeclaration)}addExportAssignment(r){return this.addExportAssignments([r])[0]}addExportAssignments(r){return this.insertExportAssignments(this.getChildSyntaxListOrThrow().getChildCount(),r)}insertExportAssignment(r,n){return this.insertExportAssignments(r,[n])[0]}insertExportAssignments(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ExportAssignment,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forExportAssignment().printTexts(i,n)},{previousNewLine:s=>Tr.isExportAssignment(s)||rj(s.compilerNode),nextNewLine:s=>Tr.isExportAssignment(s)})}})}getExportAssignment(r){return this.getExportAssignments().find(r)}getExportAssignmentOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExportAssignment(r),"Expected to find an export assignment with the provided condition.")}getExportAssignments(){return this.getStatements().filter(Tr.isExportAssignment)}getDefaultExportSymbol(){let r=this.getSymbol();if(r!=null)return r.getExport("default")}getDefaultExportSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultExportSymbol(),"Expected to find a default export symbol")}getExportSymbols(){let r=this.getSymbol();return r==null?[]:this._context.typeChecker.getExportsOfModule(r)}getExportedDeclarations(){let r=new Map,n=this.getExportSymbols();for(let a of n)for(let s of a.getDeclarations()){let u=Array.from(i(s)),p=a.getName(),f=r.get(p);f!=null?f.push(...u):r.set(a.getName(),u)}return r;function*i(a){if(Tr.isExportSpecifier(a))for(let u of a.getLocalTargetDeclarations())yield*i(u);else if(Tr.isExportAssignment(a)){let u=a.getExpression();if(u==null||u.getKind()!==b.SyntaxKind.Identifier){yield u;return}yield*s(u.getSymbol())}else if(Tr.isImportSpecifier(a)){let p=a.getNameNode().getSymbol();if(p==null)return;yield*s(p.getAliasedSymbol()||p)}else if(Tr.isImportClause(a)){let u=a.getDefaultImport();if(u==null)return;let p=u.getSymbol();if(p==null)return;yield*s(p.getAliasedSymbol()||p)}else if(Tr.isNamespaceImport(a)||Tr.isNamespaceExport(a)){let u=a.getNameNode().getSymbol();if(u==null)return;yield*s(u.getAliasedSymbol()||u)}else yield a;function*s(u){if(u!=null)for(let p of u.getDeclarations())yield*i(p)}}}removeDefaultExport(r){if(r=r||this.getDefaultExportSymbol(),r==null)return this;let n=r.getDeclarations()[0];return n.compilerNode.kind===b.SyntaxKind.ExportAssignment?Nh({children:[n],getSiblingFormatting:()=>El.Newline}):Tr.isModifierable(n)&&(n.toggleModifier("default",!1),n.toggleModifier("export",!1)),this}}}function WD(e){return class extends e{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}getName(){return this.getNameNode().getText()}set(r){return io(e.prototype,this,r),r.name!=null&&this.getNameNode().replaceWithText(r.name),this}getStructure(){return uo(e.prototype,this,{name:this.getName()})}}}function kh(e){return class extends e{findReferences(){return this._context.languageService.findReferences(cfe(this))}findReferencesAsNodes(){return this._context.languageService.findReferencesAsNodes(cfe(this))}}}function cfe(e){if(Tr.isIdentifier(e)||Tr.isStringLiteral(e))return e;let r=e.getNodeProperty("name");return r??(Tr.isExportable(e)&&e.getDefaultKeyword()||e)}function _v(e){return class extends e{rename(r,n){return epe(i(this),r,n),this;function i(a){if(Tr.isIdentifier(a)||Tr.isPrivateIdentifier(a)||Tr.isStringLiteral(a))return a;if(a.getNameNode!=null){let s=a.getNameNode();if(b.errors.throwIfNullOrUndefined(s,"Expected to find a name node when renaming."),Tr.isArrayBindingPattern(s)||Tr.isObjectBindingPattern(s))throw new b.errors.NotImplementedError(`Not implemented renameable scenario for ${s.getKindName()}.`);return s}else throw new b.errors.NotImplementedError(`Not implemented renameable scenario for ${a.getKindName()}`)}}}}function spe(e){let r=kh(_v(e));return WD(r)}function $6(e){let r=kh(_v(e));return WD(r)}function lpe(e){let r=kh(_v(e));return WD(r)}function X6(e){return f9e(kh(_v(e)))}function f9e(e){return class extends e{getNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.name)}getNameNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNameNode(),"Expected to have a name node.")}getName(){var r,n;return(n=(r=this.getNameNode())===null||r===void 0?void 0:r.getText())!==null&&n!==void 0?n:void 0}getNameOrThrow(){return b.errors.throwIfNullOrUndefined(this.getName(),"Expected to have a name.")}rename(r){return r===this.getName()?this:b.StringUtils.isNullOrWhitespace(r)?(this.removeName(),this):(this.getNameNode()==null?dfe(this,r):e.prototype.rename.call(this,r),this)}removeName(){let r=this.getNameNode();return r==null?this:(Bs({children:[r],removePrecedingSpaces:!0}),this)}set(r){if(io(e.prototype,this,r),r.name!=null){b.errors.throwIfWhitespaceOrNotString(r.name,"structure.name");let n=this.getNameNode();n==null?dfe(this,r.name):n.replaceWithText(r.name)}else r.hasOwnProperty(b.nameof(r,"name"))&&this.removeName();return this}getStructure(){return uo(e.prototype,this,{name:this.getName()})}}}function dfe(e,r){if(Tr.isClassDeclaration(e)||Tr.isClassExpression(e)){let n=e.getFirstChildByKindOrThrow(b.SyntaxKind.ClassKeyword);qa({insertPos:n.getEnd(),newText:" "+r,parent:e})}else{let n=e.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken);qa({insertPos:n.getStart(),newText:" "+r,parent:e})}}function gv(e){let r=_v(kh(e));return WD(r)}function UE(e){let r=kh(_v(e));return WD(r)}function bL(e){return class extends e{hasOverrideKeyword(){return this.hasModifier(b.SyntaxKind.OverrideKeyword)}getOverrideKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.OverrideKeyword)}getOverrideKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getOverrideKeyword(),"Expected to find an override keyword.")}setHasOverrideKeyword(r){return this.toggleModifier("override",r),this}set(r){return io(e.prototype,this,r),r.hasOverrideKeyword!=null&&this.setHasOverrideKeyword(r.hasOverrideKeyword),this}getStructure(){return uo(e.prototype,this,{hasOverrideKeyword:this.hasOverrideKeyword()})}}}function upe(e){return class extends e{getParameter(r){return ic(this.getParameters(),r)}getParameterOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getParameter(r),()=>Ou("parameter",r))}getParameters(){return this.compilerNode.parameters.map(r=>this._getNodeFromCompilerNode(r))}addParameter(r){return this.addParameters([r])[0]}addParameters(r){return this.insertParameters(ad(this.compilerNode.parameters),r)}insertParameter(r,n){return this.insertParameters(r,[n])[0]}insertParameters(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getParameters(),a=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken).getNextSiblingIfKindOrThrow(b.SyntaxKind.SyntaxList);r=ku(r,i.length);let s=this._getWriterWithQueuedChildIndentation();return this._context.structurePrinterFactory.forParameterDeclaration().printTexts(s,n),j_({parent:a,currentNodes:i,insertIndex:r,newText:s.toString(),useTrailingCommas:!1}),af(i,this.getParameters(),r,!1)}set(r){return io(e.prototype,this,r),r.parameters!=null&&(this.getParameters().forEach(n=>n.remove()),this.addParameters(r.parameters)),this}getStructure(){return uo(e.prototype,this,{parameters:this.getParameters().map(r=>r.getStructure())})}}}function Y6(e){return class extends e{hasQuestionDotToken(){return this.compilerNode.questionDotToken!=null}getQuestionDotTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionDotToken)}getQuestionDotTokenNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionDotTokenNode(),"Expected to find a question dot token.")}setHasQuestionDotToken(r){let n=this.getQuestionDotTokenNode(),i=n!=null;if(r===i)return this;return r?Tr.isPropertyAccessExpression(this)?this.getFirstChildByKindOrThrow(b.SyntaxKind.DotToken).replaceWithText("?."):qa({insertPos:a.call(this),parent:this,newText:"?."}):Tr.isPropertyAccessExpression(this)?n.replaceWithText("."):Bs({children:[n]}),this;function a(){if(Tr.isCallExpression(this))return this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken).getStart();if(Tr.isElementAccessExpression(this))return this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBracketToken).getStart();b.errors.throwNotImplementedForSyntaxKindError(this.compilerNode.kind)}}set(r){return io(e.prototype,this,r),r.hasQuestionDotToken!=null&&this.setHasQuestionDotToken(r.hasQuestionDotToken),this}getStructure(){return uo(e.prototype,this,{hasQuestionDotToken:this.hasQuestionDotToken()})}}}function Rh(e){return class extends e{hasQuestionToken(){return this.compilerNode.questionToken!=null}getQuestionTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionTokenNode(),"Expected to find a question token.")}setHasQuestionToken(r){let n=this.getQuestionTokenNode(),i=n!=null;if(r===i)return this;return r?(Tr.isExclamationTokenable(this)&&this.setHasExclamationToken(!1),qa({insertPos:a.call(this),parent:this,newText:"?"})):Bs({children:[n]}),this;function a(){if(Tr.hasName(this))return this.getNameNode().getEnd();let s=this.getFirstChildByKind(b.SyntaxKind.ColonToken);if(s!=null)return s.getStart();let u=this.getLastChildByKind(b.SyntaxKind.SemicolonToken);return u!=null?u.getStart():this.getEnd()}}set(r){return io(e.prototype,this,r),r.hasQuestionToken!=null&&this.setHasQuestionToken(r.hasQuestionToken),this}getStructure(){return uo(e.prototype,this,{hasQuestionToken:this.hasQuestionToken()})}}}function SL(e){return class extends e{isReadonly(){return this.getReadonlyKeyword()!=null}getReadonlyKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.ReadonlyKeyword)}getReadonlyKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReadonlyKeyword(),"Expected to find a readonly keyword.")}setIsReadonly(r){return this.toggleModifier("readonly",r),this}set(r){return io(e.prototype,this,r),r.isReadonly!=null&&this.setIsReadonly(r.isReadonly),this}getStructure(){return uo(e.prototype,this,{isReadonly:this.isReadonly()})}}}function rq(e){return class extends e{getReturnType(){return this.getSignature().getReturnType()}getReturnTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getReturnTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReturnTypeNode(),"Expected to find a return type node.")}setReturnType(r){let n=Xg(this._getWriterWithQueuedChildIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeReturnType();let i=this.getReturnTypeNode();if(i!=null)return i.getText()!==n&&i.replaceWithText(n),this;return qa({parent:this,insertPos:a(this).getEnd(),newText:`: ${n}`}),this;function a(s){return s.getKind()===b.SyntaxKind.IndexSignature?s.getFirstChildByKindOrThrow(b.SyntaxKind.CloseBracketToken):s.getFirstChildByKindOrThrow(b.SyntaxKind.CloseParenToken)}}removeReturnType(){let r=this.getReturnTypeNode();if(r==null)return this;let n=r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.ColonToken);return Bs({children:[n,r],removePrecedingSpaces:!0}),this}getSignature(){let r=this._context.typeChecker.getSignatureFromNode(this);if(r==null)throw new b.errors.NotImplementedError("Expected the node to have a signature.");return r}set(r){return io(e.prototype,this,r),r.returnType!=null?this.setReturnType(r.returnType):r.hasOwnProperty(b.nameof(r,"returnType"))&&this.removeReturnType(),this}getStructure(){let r=this.getReturnTypeNode();return uo(e.prototype,this,{returnType:r?r.getText({trimLeadingIndentation:!0}):void 0})}}}function cpe(e){return class extends e{getScope(){let r=ZR(this);if(r!=null)return r;if(Tr.isParameterDeclaration(this)&&this.isReadonly())return Oe.Scope.Public}setScope(r){return tq(this,r),this}getScopeKeyword(){return this.getModifiers().find(r=>{let n=r.getText();return n==="public"||n==="protected"||n==="private"})}hasScopeKeyword(){return this.getScopeKeyword()!=null}set(r){return io(e.prototype,this,r),r.hasOwnProperty(b.nameof(r,"scope"))&&this.setScope(r.scope),this}getStructure(){return uo(e.prototype,this,{scope:this.getScope()})}}}function ZR(e){let r=e.getCombinedModifierFlags();return(r&b.ts.ModifierFlags.Private)!==0?Oe.Scope.Private:(r&b.ts.ModifierFlags.Protected)!==0?Oe.Scope.Protected:(r&b.ts.ModifierFlags.Public)!==0?Oe.Scope.Public:void 0}function tq(e,r){e.toggleModifier("public",r===Oe.Scope.Public),e.toggleModifier("protected",r===Oe.Scope.Protected),e.toggleModifier("private",r===Oe.Scope.Private)}function _S(e){return class extends e{getScope(){return ZR(this)||Oe.Scope.Public}setScope(r){return tq(this,r),this}hasScopeKeyword(){return ZR(this)!=null}set(r){return io(e.prototype,this,r),r.hasOwnProperty(b.nameof(r,"scope"))&&this.setScope(r.scope),this}getStructure(){return uo(e.prototype,this,{scope:this.hasScopeKeyword()?this.getScope():void 0})}}}function yv(e){return rq(upe(e))}function VD(e){return class extends e{isStatic(){return this.hasModifier(b.SyntaxKind.StaticKeyword)}getStaticKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.StaticKeyword)}getStaticKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getStaticKeyword(),"Expected to find a static keyword.")}setIsStatic(r){return this.toggleModifier("static",r),this}set(r){return io(e.prototype,this,r),r.isStatic!=null&&this.setIsStatic(r.isStatic),this}getStructure(){return uo(e.prototype,this,{isStatic:this.isStatic()})}}}function ld(e){return class extends e{insertText(r,n){return this.replaceText([r,r],n),this}removeText(r,n){return r==null?this.replaceText(ffe(this),""):this.replaceText([r,n],""),this}replaceText(r,n){let i=this.getChildSyntaxListOrThrow(),a=ffe(this),s=r[0],u=r[1];return p(),qa({insertPos:s,newText:Xg(this._getWriter(),n),parent:i.getParentOrThrow(),replacing:{textLength:u-s,nodes:[i]}}),this;function p(){if(f(s),f(u),s>u)throw new b.errors.ArgumentError("range","Cannot specify a start position greater than the end position.")}function f(m){if(!(m>=a[0]&&m<=a[1]))throw new b.errors.InvalidOperationError(`Cannot insert or replace text outside the bounds of the node. Expected a position between [${a[0]}, ${a[1]}], but received ${m}.`)}}}}function ffe(e){let r=a(),n=Tr.isSourceFile(r)?void 0:r.getPreviousSiblingIfKind(b.SyntaxKind.OpenBraceToken),i=n==null?void 0:r.getNextSiblingIfKind(b.SyntaxKind.CloseBraceToken);if(n!=null&&i!=null)return[n.getEnd(),i.getStart()];return[r.getPos(),r.getEnd()];function a(){return Tr.isSourceFile(e)?e:e.getChildSyntaxListOrThrow()}}function Q6(e){return class extends e{getTypeArguments(){return this.compilerNode.typeArguments==null?[]:this.compilerNode.typeArguments.map(r=>this._getNodeFromCompilerNode(r))}addTypeArgument(r){return this.addTypeArguments([r])[0]}addTypeArguments(r){return this.insertTypeArguments(this.getTypeArguments().length,r)}insertTypeArgument(r,n){return this.insertTypeArguments(r,[n])[0]}insertTypeArguments(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getTypeArguments();if(r=ku(r,i.length),i.length===0){let a=this.getFirstChildByKindOrThrow(b.SyntaxKind.Identifier);qa({insertPos:a.getEnd(),parent:this,newText:`<${n.join(", ")}>`})}else j_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:n.join(", "),useTrailingCommas:!1});return af(i,this.getTypeArguments(),r,!1)}removeTypeArgument(r){let n=this.getTypeArguments();if(n.length===0)throw new b.errors.InvalidOperationError("Cannot remove a type argument when none exist.");let i=typeof r=="number"?a(r):r;if(n.length===1){let s=n[0].getParentSyntaxListOrThrow();Bs({children:[s.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),s,s.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)]})}else mv(i);return this;function a(s){return n[ku(s,n.length-1)]}}}}function KE(e){return class extends e{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Expected to find a type node.")}setType(r){let n=Xg(this._getWriterWithQueuedChildIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeType();let i=this.getTypeNode();if(i!=null&&i.getText()===n)return this;let a=pfe(this),s=this.getFirstChildByKind(a),u,p;return s==null?(u=f(this),p=(a===b.SyntaxKind.EqualsToken?" = ":": ")+n):(u=i.getStart(),p=n),qa({parent:this,insertPos:u,newText:p,replacing:{textLength:i==null?0:i.getWidth()}}),this;function f(g){let D=g.getFirstChildByKindOrThrow(b.SyntaxKind.Identifier),P=D.getNextSibling();return(m(P)?P:D).getEnd()}function m(g){if(g==null)return!1;let D=g.getKind();return D===b.SyntaxKind.QuestionToken||D===b.SyntaxKind.ExclamationToken}}set(r){return io(e.prototype,this,r),r.type!=null?this.setType(r.type):r.hasOwnProperty(b.nameof(r,"type"))&&this.removeType(),this}removeType(){if(this.getKind()===b.SyntaxKind.TypeAliasDeclaration)throw new b.errors.NotSupportedError(`Cannot remove the type of a type alias. Use ${b.nameof("setType")} instead.`);let r=this.getTypeNode();if(r==null)return this;let n=r.getPreviousSiblingIfKindOrThrow(pfe(this));return Bs({children:[n,r],removePrecedingSpaces:!0}),this}getStructure(){let r=this.getTypeNode();return uo(e.prototype,this,{type:r?r.getText({trimLeadingIndentation:!0}):void 0})}}}function pfe(e){switch(e.getKind()){case b.SyntaxKind.TypeAliasDeclaration:return b.SyntaxKind.EqualsToken;default:return b.SyntaxKind.ColonToken}}function nq(e){return class extends e{addMember(r){return this.addMembers([r])[0]}addMembers(r){return this.insertMembers(ad(this.getMembersWithComments()),r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){return Jfe({getIndexedChildren:()=>this.getMembersWithComments(),index:r,parent:this,write:i=>{i.newLineIfLastNot();let a=this._getWriter();this._context.structurePrinterFactory.forTypeElementMember().printTexts(a,n),i.write(a.toString()),i.newLineIfLastNot()}})}addConstructSignature(r){return this.addConstructSignatures([r])[0]}addConstructSignatures(r){return this.insertConstructSignatures(ad(this.getMembersWithComments()),r)}insertConstructSignature(r,n){return this.insertConstructSignatures(r,[n])[0]}insertConstructSignatures(r,n){return QA({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.ConstructSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forConstructSignatureDeclaration()})}getConstructSignature(r){return this.getConstructSignatures().find(r)}getConstructSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getConstructSignature(r),"Expected to find a construct signature with the provided condition.")}getConstructSignatures(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.ConstructSignature).map(r=>this._getNodeFromCompilerNode(r))}addCallSignature(r){return this.addCallSignatures([r])[0]}addCallSignatures(r){return this.insertCallSignatures(ad(this.getMembersWithComments()),r)}insertCallSignature(r,n){return this.insertCallSignatures(r,[n])[0]}insertCallSignatures(r,n){return QA({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.CallSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forCallSignatureDeclaration()})}getCallSignature(r){return this.getCallSignatures().find(r)}getCallSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getCallSignature(r),"Expected to find a call signature with the provided condition.")}getCallSignatures(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.CallSignature).map(r=>this._getNodeFromCompilerNode(r))}addIndexSignature(r){return this.addIndexSignatures([r])[0]}addIndexSignatures(r){return this.insertIndexSignatures(ad(this.getMembersWithComments()),r)}insertIndexSignature(r,n){return this.insertIndexSignatures(r,[n])[0]}insertIndexSignatures(r,n){return QA({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.IndexSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forIndexSignatureDeclaration()})}getIndexSignature(r){return this.getIndexSignatures().find(r)}getIndexSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getIndexSignature(r),"Expected to find a index signature with the provided condition.")}getIndexSignatures(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.IndexSignature).map(r=>this._getNodeFromCompilerNode(r))}addMethod(r){return this.addMethods([r])[0]}addMethods(r){return this.insertMethods(ad(this.getMembersWithComments()),r)}insertMethod(r,n){return this.insertMethods(r,[n])[0]}insertMethods(r,n){return QA({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.MethodSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forMethodSignature()})}getMethod(r){return ic(this.getMethods(),r)}getMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMethod(r),()=>Ou("interface method signature",r))}getMethods(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.MethodSignature).map(r=>this._getNodeFromCompilerNode(r))}addProperty(r){return this.addProperties([r])[0]}addProperties(r){return this.insertProperties(ad(this.getMembersWithComments()),r)}insertProperty(r,n){return this.insertProperties(r,[n])[0]}insertProperties(r,n){return QA({thisNode:this,index:r,structures:n,expectedKind:b.SyntaxKind.PropertySignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forPropertySignature()})}getProperty(r){return ic(this.getProperties(),r)}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("interface property signature",r))}getProperties(){return this.compilerNode.members.filter(r=>r.kind===b.SyntaxKind.PropertySignature).map(r=>this._getNodeFromCompilerNode(r))}getMembers(){return this.compilerNode.members.map(r=>this._getNodeFromCompilerNode(r))}getMembersWithComments(){let r=this.compilerNode;return od.getContainerArray(r,this._sourceFile.compilerNode).map(n=>this._getNodeFromCompilerNode(n))}set(r){return io(e.prototype,this,r),r.callSignatures!=null&&(this.getCallSignatures().forEach(n=>n.remove()),this.addCallSignatures(r.callSignatures)),r.constructSignatures!=null&&(this.getConstructSignatures().forEach(n=>n.remove()),this.addConstructSignatures(r.constructSignatures)),r.indexSignatures!=null&&(this.getIndexSignatures().forEach(n=>n.remove()),this.addIndexSignatures(r.indexSignatures)),r.properties!=null&&(this.getProperties().forEach(n=>n.remove()),this.addProperties(r.properties)),r.methods!=null&&(this.getMethods().forEach(n=>n.remove()),this.addMethods(r.methods)),this}getStructure(){return uo(e.prototype,this,{callSignatures:this.getCallSignatures().map(r=>r.getStructure()),constructSignatures:this.getConstructSignatures().map(r=>r.getStructure()),indexSignatures:this.getIndexSignatures().map(r=>r.getStructure()),methods:this.getMethods().map(r=>r.getStructure()),properties:this.getProperties().map(r=>r.getStructure())})}}}function QA(e){return JH({getIndexedChildren:()=>e.thisNode.getMembersWithComments(),parent:e.thisNode,index:e.index,structures:e.structures,expectedKind:e.expectedKind,write:(r,n)=>{r.newLineIfLastNot(),e.createStructurePrinter().printTexts(r,e.structures),r.newLineIfLastNot()}})}function J_(e){return class extends e{getTypeParameter(r){return ic(this.getTypeParameters(),r)}getTypeParameterOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getTypeParameter(r),()=>Ou("type parameter",r))}getTypeParameters(){let r=this.compilerNode.typeParameters;return r==null?[]:r.map(n=>this._getNodeFromCompilerNode(n))}addTypeParameter(r){return this.addTypeParameters([r])[0]}addTypeParameters(r){return this.insertTypeParameters(ad(this.compilerNode.typeParameters),r)}insertTypeParameter(r,n){return this.insertTypeParameters(r,[n])[0]}insertTypeParameters(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getTypeParameters(),a=this._getWriterWithQueuedChildIndentation(),s=this._context.structurePrinterFactory.forTypeParameterDeclaration();return r=ku(r,i.length),s.printTexts(a,n),i.length===0?qa({insertPos:p9e(this),parent:this,newText:`<${a.toString()}>`}):j_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:a.toString(),useTrailingCommas:!1}),af(i,this.getTypeParameters(),r,!1)}set(r){return io(e.prototype,this,r),r.typeParameters!=null&&(this.getTypeParameters().forEach(n=>n.remove()),this.addTypeParameters(r.typeParameters)),this}getStructure(){return uo(e.prototype,this,{typeParameters:this.getTypeParameters().map(r=>r.getStructure())})}}}function p9e(e){let r=e;if(r.getNameNode!=null)return r.getNameNode().getEnd();if(Tr.isCallSignatureDeclaration(e)||Tr.isFunctionTypeNode(e))return e.getFirstChildByKindOrThrow(b.SyntaxKind.OpenParenToken).getStart();throw new b.errors.NotImplementedError(`Not implemented scenario inserting type parameters for node with kind ${e.getKindName()}.`)}function Z6(e){return class extends e{unwrap(){E7e(this)}}}var eM=class extends Tr{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},m9e=e=>hL($T($6(e))),dpe=m9e(Tr),rM=class extends dpe{getPropertyNameNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getPropertyNameNode(),"Expected to find a property name node.")}getPropertyNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.propertyName)}},tM=class extends Tr{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}};function gS(e){return class extends e{isAbstract(){return this.getAbstractKeyword()!=null}getAbstractKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.AbstractKeyword)}getAbstractKeywordOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAbstractKeyword(),"Expected to find an abstract keyword.")}setIsAbstract(r){return this.toggleModifier("abstract",r),this}set(r){return io(e.prototype,this,r),r.isAbstract!=null&&this.setIsAbstract(r.isAbstract),this}getStructure(){return uo(e.prototype,this,{isAbstract:this.isAbstract()})}}}var oc=class extends Tr{getContextualType(){return this._context.typeChecker.getContextualType(this)}},fpe=oc,nL=class extends fpe{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},ppe=nL,iL=class extends ppe{getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}},mpe=iL,NH=class extends mpe{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},fv=class extends oc{},nM=class extends fv{},MD=class extends nM{},BT=class extends MD{},sd=class extends BT{},iM=class extends sd{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}addElement(r,n){return this.addElements([r],n)[0]}addElements(r,n){return this.insertElements(this.compilerNode.elements.length,r,n)}insertElement(r,n,i){return this.insertElements(r,[n],i)[0]}insertElements(r,n,i={}){let a=this.getElements();r=ku(r,a.length);let s=g(this),u=s?this._getWriterWithChildIndentation():this._getWriterWithQueuedChildIndentation(),p=new tL;return(s?new GT(p):new Ih(p)).printText(u,n),m(this);function m(D){j_({parent:D.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:a,insertIndex:r,newText:u.toString(),useNewLines:s,useTrailingCommas:s&&D._context.manipulationSettings.getUseTrailingCommas()});let P=D.getElements();return af(a,P,r,!1)}function g(D){if(i.useNewLines!=null)return i.useNewLines;if(a.length>1)return P();return D.getStartLineNumber()!==D.getEndLineNumber();function P(){let B=a[0].getStartLineNumber();for(let K=1;K<a.length;K++){let h=a[K].getStartLineNumber();if(B===h)return!1;B=h}return!0}}}removeElement(r){let n=this.getElements();if(n.length===0)throw new b.errors.InvalidOperationError("Cannot remove an element when none exist.");let i=typeof r=="number"?a(r):r;mv(i);function a(s){return n[ku(s,n.length-1)]}}};function TL(e){return class extends e{getExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.expression)}getExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExpression(),"Expected to find an expression.")}getExpressionIfKind(r){let n=this.getExpression();return n?.getKind()===r?n:void 0}getExpressionIfKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExpressionIfKind(r),`An expression with the kind kind ${b.getSyntaxKindName(r)} was expected.`)}}}function jD(e){return class extends e{getExpression(){return this._getNodeFromCompilerNode(this.compilerNode.expression)}getExpressionIfKind(r){let{expression:n}=this.compilerNode;return n.kind===r?this._getNodeFromCompilerNode(n):void 0}getExpressionIfKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExpressionIfKind(r),`An expression of the kind ${b.getSyntaxKindName(r)} was expected.`)}setExpression(r){return this.getExpression().replaceWithText(r,this._getWriterWithQueuedChildIndentation()),this}set(r){return io(e.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}}}function ud(e){return jD(e)}function _9e(e){return jD(e)}function XT(e){return jD(e)}function iq(e){return jD(e)}function HD(e){return jD(e)}var g9e=e=>KE(ud(e)),_pe=g9e(oc),aM=class extends _pe{},gpe=HD(fv),oM=class extends gpe{},y9e=e=>Q6(zH(Y6(XT(e)))),ype=y9e(MD),sM=class extends ype{getReturnType(){return this._context.typeChecker.getTypeAtLocation(this)}},vpe=oc,lM=class extends vpe{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},hpe=oc,uM=class extends hpe{getCondition(){return this._getNodeFromCompilerNode(this.compilerNode.condition)}getQuestionToken(){return this._getNodeFromCompilerNode(this.compilerNode.questionToken)}getWhenTrue(){return this._getNodeFromCompilerNode(this.compilerNode.whenTrue)}getColonToken(){return this._getNodeFromCompilerNode(this.compilerNode.colonToken)}getWhenFalse(){return this._getNodeFromCompilerNode(this.compilerNode.whenFalse)}},Epe=HD(fv),cM=class extends Epe{},v9e=e=>Y6(XT(e)),bpe=v9e(BT),aL=class extends bpe{getArgumentExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.argumentExpression)}getArgumentExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getArgumentExpression(),"Expected to find an argument expression.")}},Spe=sd,dM=class extends Spe{},Tpe=KD(sd),cS=class extends Tpe{},xpe=gv(sd),fM=class extends xpe{getKeywordToken(){return this.compilerNode.keywordToken}},h9e=e=>Q6(zH(XT(e))),Dpe=h9e(sd),pM=class extends Dpe{},Cpe=ud(MD),mM=class extends Cpe{},UT=class extends Tr{remove(){mv(this)}},_M=class extends UT{},Ape=iL,IH=class extends Ape{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},Lpe=sd,gM=class extends Lpe{getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("property",r))}getProperty(r){let n;return typeof r=="string"?n=i=>i[b.nameof("getName")]==null?!1:i.getName()===r:n=r,this.getProperties().find(n)}getProperties(){return this.compilerNode.properties.map(r=>this._getNodeFromCompilerNode(r))}getPropertiesWithComments(){return od.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).map(n=>this._getNodeFromCompilerNode(n))}_getAddIndex(){return od.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).length}addProperty(r){return this.insertProperties(this._getAddIndex(),[r])[0]}addProperties(r){return this.insertProperties(this._getAddIndex(),r)}insertProperty(r,n){return this.insertProperties(r,[n])[0]}insertProperties(r,n){let i=this.getPropertiesWithComments();r=ku(r,i.length);let a=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forObjectLiteralExpressionProperty().printTexts(a,n),j_({parent:this.getChildSyntaxListOrThrow(),currentNodes:i,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(i,this.getPropertiesWithComments(),r,!0)}addPropertyAssignment(r){return this.addPropertyAssignments([r])[0]}addPropertyAssignments(r){return this.insertPropertyAssignments(this._getAddIndex(),r)}insertPropertyAssignment(r,n){return this.insertPropertyAssignments(r,[n])[0]}insertPropertyAssignments(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forPropertyAssignment())}addShorthandPropertyAssignment(r){return this.addShorthandPropertyAssignments([r])[0]}addShorthandPropertyAssignments(r){return this.insertShorthandPropertyAssignments(this._getAddIndex(),r)}insertShorthandPropertyAssignment(r,n){return this.insertShorthandPropertyAssignments(r,[n])[0]}insertShorthandPropertyAssignments(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forShorthandPropertyAssignment())}addSpreadAssignment(r){return this.addSpreadAssignments([r])[0]}addSpreadAssignments(r){return this.insertSpreadAssignments(this._getAddIndex(),r)}insertSpreadAssignment(r,n){return this.insertSpreadAssignments(r,[n])[0]}insertSpreadAssignments(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forSpreadAssignment())}addMethod(r){return this.addMethods([r])[0]}addMethods(r){return this.insertMethods(this._getAddIndex(),r)}insertMethod(r,n){return this.insertMethods(r,[n])[0]}insertMethods(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:!1}))}addGetAccessor(r){return this.addGetAccessors([r])[0]}addGetAccessors(r){return this.insertGetAccessors(this._getAddIndex(),r)}insertGetAccessor(r,n){return this.insertGetAccessors(r,[n])[0]}insertGetAccessors(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:!1}))}addSetAccessor(r){return this.addSetAccessors([r])[0]}addSetAccessors(r){return this.insertSetAccessors(this._getAddIndex(),r)}insertSetAccessor(r,n){return this.insertSetAccessors(r,[n])[0]}insertSetAccessors(r,n){return this._insertProperty(r,n,()=>this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:!1}))}_insertProperty(r,n,i){r=ku(r,this._getAddIndex());let a=this._getWriterWithChildIndentation(),s=new GT(i()),u=this.getPropertiesWithComments();return s.printText(a,n),j_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:u,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(u,this.getPropertiesWithComments(),r,!1)}},E9e=e=>z6(Rh(UE(e))),iR=E9e(UT),yM=class extends iR{removeInitializer(){let r=this.getInitializerOrThrow(),n=r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.ColonToken),i=this.getChildIndex(),a=this._sourceFile.getFullText(),s=this.getStart(),u=a.substring(s,n.getPos())+a.substring(r.getEnd(),this.getEnd()),p=this.getParentSyntaxList()||this.getParentOrThrow();return qa({insertPos:s,newText:u,parent:p,replacing:{textLength:this.getWidth()}}),p.getChildAtIndexIfKindOrThrow(i,b.SyntaxKind.ShorthandPropertyAssignment)}setInitializer(r){let n=this.getInitializerOrThrow();return qa({insertPos:n.getStart(),newText:Xg(this._getWriterWithQueuedChildIndentation(),r),parent:this,replacing:{textLength:n.getWidth()}}),this}set(r){if(io(iR.prototype,this,r),r.initializer!=null)this.setInitializer(r.initializer);else if(r.hasOwnProperty(b.nameof(r,"initializer")))return this.removeInitializer();return this}getStructure(){let r=this.getInitializerOrThrow(),n=uo(iR.prototype,this,{kind:Oe.StructureKind.PropertyAssignment,initializer:r.getText()});return delete n.hasQuestionToken,n}},b9e=e=>z6(Rh(gv(e))),aR=b9e(UT),vM=class extends aR{hasObjectAssignmentInitializer(){return this.compilerNode.objectAssignmentInitializer!=null}getObjectAssignmentInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getObjectAssignmentInitializer(),"Expected to find an object assignment initializer.")}getObjectAssignmentInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.objectAssignmentInitializer)}getEqualsTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getEqualsToken(),"Expected to find an equals token.")}getEqualsToken(){let r=this.compilerNode.equalsToken;if(r!=null)return this._getNodeFromCompilerNode(r)}removeObjectAssignmentInitializer(){return this.hasObjectAssignmentInitializer()?(Bs({children:[this.getEqualsTokenOrThrow(),this.getObjectAssignmentInitializerOrThrow()],removePrecedingSpaces:!0}),this):this}setInitializer(r){let n=this.getParentSyntaxList()||this.getParentOrThrow(),i=this.getChildIndex();return qa({insertPos:this.getStart(),newText:this.getText()+`: ${r}`,parent:n,replacing:{textLength:this.getWidth()}}),n.getChildAtIndexIfKindOrThrow(i,b.SyntaxKind.PropertyAssignment)}set(r){return io(aR.prototype,this,r),this}getStructure(){let r=uo(aR.prototype,this,{kind:Oe.StructureKind.ShorthandPropertyAssignment});return delete r.hasQuestionToken,r}},oR=ud(UT),hM=class extends oR{set(r){return io(oR.prototype,this,r),this}getStructure(){return uo(oR.prototype,this,{kind:Oe.StructureKind.SpreadAssignment,expression:this.getExpression().getText()})}},Npe=oc,EM=class extends Npe{},Ipe=ud(oc),bM=class extends Ipe{},Ppe=ud(oc),SM=class extends Ppe{},Ope=fv,TM=class extends Ope{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},kpe=fv,xM=class extends kpe{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},S9e=e=>gv(Y6(XT(e))),Rpe=S9e(BT),oL=class extends Rpe{},Mpe=ud(oc),DM=class extends Mpe{},wpe=iq(aL),PH=class extends wpe{},Fpe=sd,CM=class extends Fpe{},Gpe=iq(oL),OH=class extends Gpe{},Bpe=sd,AM=class extends Bpe{},T9e=e=>KE(HD(e)),Upe=T9e(fv),LM=class extends Upe{},Kpe=HD(fv),NM=class extends Kpe{},Wpe=HD(fv),IM=class extends Wpe{},Vpe=TL(zT(oc)),PM=class extends Vpe{},jpe=Im(Tr),Cl=class extends jpe{remove(){h7e(this)}};function Mh(e){return class extends e{getStatements(){var r;let n=this._getCompilerStatementsContainer();return((r=n?.statements)!==null&&r!==void 0?r:[]).map(a=>this._getNodeFromCompilerNode(a))}getStatementsWithComments(){return this._getCompilerStatementsWithComments().map(r=>this._getNodeFromCompilerNode(r))}getStatement(r){return this.getStatements().find(r)}getStatementOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStatement(r),"Expected to find a statement matching the provided condition.")}getStatementByKind(r){let n=this._getCompilerStatementsWithComments().find(i=>i.kind===r);return this._getNodeFromCompilerNodeIfExists(n)}getStatementByKindOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStatementByKind(r),`Expected to find a statement with syntax kind ${b.getSyntaxKindName(r)}.`)}addStatements(r){return this.insertStatements(this._getCompilerStatementsWithComments().length,r)}insertStatements(r,n){mfe(this);let i=s=>{this._context.structurePrinterFactory.forStatement({isAmbient:f_(this)}).printTexts(s,n)};return a.call(this).insertChildText(r,i);function a(){let s=this.getChildSyntaxListOrThrow();if(Tr.isCaseClause(this)||Tr.isDefaultClause(this)){let u=s.getFirstChildIfKind(b.SyntaxKind.Block);if(u!=null)return u.getChildSyntaxListOrThrow()}return s}}removeStatement(r){return r=ku(r,this._getCompilerStatementsWithComments().length-1),this.removeStatements([r,r])}removeStatements(r){let n=this.getStatementsWithComments();return b.errors.throwIfRangeOutOfRange(r,[0,n.length],"indexRange"),j6(n.slice(r[0],r[1]+1)),this}addClass(r){return this.addClasses([r])[0]}addClasses(r){return this.insertClasses(this._getCompilerStatementsWithComments().length,r)}insertClass(r,n){return this.insertClasses(r,[n])[0]}insertClasses(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ClassDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forClassDeclaration({isAmbient:f_(this)}).printTexts(i,n)})}})}getClasses(){return this.getStatements().filter(Tr.isClassDeclaration)}getClass(r){return ic(this.getClasses(),r)}getClassOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getClass(r),()=>Ou("class",r))}addEnum(r){return this.addEnums([r])[0]}addEnums(r){return this.insertEnums(this._getCompilerStatementsWithComments().length,r)}insertEnum(r,n){return this.insertEnums(r,[n])[0]}insertEnums(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.EnumDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forEnumDeclaration().printTexts(i,n)})}})}getEnums(){return this.getStatements().filter(Tr.isEnumDeclaration)}getEnum(r){return ic(this.getEnums(),r)}getEnumOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getEnum(r),()=>Ou("enum",r))}addFunction(r){return this.addFunctions([r])[0]}addFunctions(r){return this.insertFunctions(this._getCompilerStatementsWithComments().length,r)}insertFunction(r,n){return this.insertFunctions(r,[n])[0]}insertFunctions(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.FunctionDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:f_(this)}).printTexts(i,n)},{previousNewLine:s=>n[0].hasDeclareKeyword===!0&&Tr.isFunctionDeclaration(s)&&s.getBody()==null,nextNewLine:s=>n[n.length-1].hasDeclareKeyword===!0&&Tr.isFunctionDeclaration(s)&&s.getBody()==null})}})}getFunctions(){return this.getStatements().filter(Tr.isFunctionDeclaration).filter(r=>r.isAmbient()||r.isImplementation())}getFunction(r){return ic(this.getFunctions(),r)}getFunctionOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getFunction(r),()=>Ou("function",r))}addInterface(r){return this.addInterfaces([r])[0]}addInterfaces(r){return this.insertInterfaces(this._getCompilerStatementsWithComments().length,r)}insertInterface(r,n){return this.insertInterfaces(r,[n])[0]}insertInterfaces(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.InterfaceDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forInterfaceDeclaration().printTexts(i,n)})}})}getInterfaces(){return this.getStatements().filter(Tr.isInterfaceDeclaration)}getInterface(r){return ic(this.getInterfaces(),r)}getInterfaceOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInterface(r),()=>Ou("interface",r))}addModule(r){return this.addModules([r])[0]}addModules(r){return this.insertModules(this._getCompilerStatementsWithComments().length,r)}insertModule(r,n){return this.insertModules(r,[n])[0]}insertModules(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.ModuleDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forModuleDeclaration({isAmbient:f_(this)}).printTexts(i,n)})}})}getModules(){return this.getStatements().filter(Tr.isModuleDeclaration)}getModule(r){return ic(this.getModules(),r)}getModuleOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getModule(r),()=>Ou("module",r))}addTypeAlias(r){return this.addTypeAliases([r])[0]}addTypeAliases(r){return this.insertTypeAliases(this._getCompilerStatementsWithComments().length,r)}insertTypeAlias(r,n){return this.insertTypeAliases(r,[n])[0]}insertTypeAliases(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.TypeAliasDeclaration,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forTypeAliasDeclaration().printTexts(i,n)},{previousNewLine:s=>Tr.isTypeAliasDeclaration(s),nextNewLine:s=>Tr.isTypeAliasDeclaration(s)})}})}getTypeAliases(){return this.getStatements().filter(Tr.isTypeAliasDeclaration)}getTypeAlias(r){return ic(this.getTypeAliases(),r)}getTypeAliasOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getTypeAlias(r),()=>Ou("type alias",r))}getVariableStatements(){return this.getStatements().filter(Tr.isVariableStatement)}getVariableStatement(r){return this.getVariableStatements().find(n());function n(){return typeof r=="string"?i=>i.getDeclarations().some(a=>VH(a,r)):r}}getVariableStatementOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getVariableStatement(r),"Expected to find a variable statement that matched the provided condition.")}addVariableStatement(r){return this.addVariableStatements([r])[0]}addVariableStatements(r){return this.insertVariableStatements(this._getCompilerStatementsWithComments().length,r)}insertVariableStatement(r,n){return this.insertVariableStatements(r,[n])[0]}insertVariableStatements(r,n){return this._insertChildren({expectedKind:b.SyntaxKind.VariableStatement,index:r,structures:n,write:(i,a)=>{this._standardWrite(i,a,()=>{this._context.structurePrinterFactory.forVariableStatement().printTexts(i,n)},{previousNewLine:s=>Tr.isVariableStatement(s),nextNewLine:s=>Tr.isVariableStatement(s)})}})}getVariableDeclarations(){let r=[];for(let n of this.getVariableStatements())r.push(...n.getDeclarations());return r}getVariableDeclaration(r){return ic(this.getVariableDeclarations(),r)}getVariableDeclarationOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getVariableDeclaration(r),()=>Ou("variable declaration",r))}getStructure(){let r={};return Tr.isBodyable(this)&&!this.hasBody()?r.statements=void 0:r.statements=this.getStatements().map(n=>Tr._hasStructure(n)?n.getStructure():n.getText({trimLeadingIndentation:!0})),uo(e.prototype,this,r)}set(r){if(Tr.isBodyable(this)&&r.statements==null&&r.hasOwnProperty(b.nameof(r,"statements")))this.removeBody();else if(r.statements!=null){let n=this._getCompilerStatementsWithComments().length;n>0&&this.removeStatements([0,n-1])}return io(e.prototype,this,r),r.statements!=null&&this.addStatements(r.statements),this}_getCompilerStatementsWithComments(){let r=this._getCompilerStatementsContainer();return r==null?[]:od.getContainerArray(r,this._sourceFile.compilerNode)}_getCompilerStatementsContainer(){var r;if(Tr.isSourceFile(this)||Tr.isCaseClause(this)||Tr.isDefaultClause(this))return this.compilerNode;if(Tr.isModuleDeclaration(this)){let n=this._getInnerBody();return n?.compilerNode}else{if(Tr.isBodyable(this)||Tr.isBodied(this))return(r=this.getBody())===null||r===void 0?void 0:r.compilerNode;if(Tr.isBlock(this)||Tr.isModuleBlock(this))return this.compilerNode;throw new b.errors.NotImplementedError(`Could not find the statements for node kind: ${this.getKindName()}, text: ${this.getText()}`)}}_insertChildren(r){return mfe(this),JH({expectedKind:r.expectedKind,getIndexedChildren:()=>this.getStatementsWithComments(),index:r.index,parent:this,structures:r.structures,write:(n,i)=>r.write(n,i)})}_standardWrite(r,n,i,a={}){n.previousMember!=null&&(a.previousNewLine==null||!a.previousNewLine(n.previousMember))&&!Tr.isCommentNode(n.previousMember)?r.blankLine():n.isStartOfFile||r.newLineIfLastNot(),i(),n.nextMember!=null&&(a.nextNewLine==null||!a.nextNewLine(n.nextMember))?r.blankLine():r.newLineIfLastNot()}}}function mfe(e){Tr.isBodyable(e)&&!e.hasBody()&&e.addBody()}var x9e=e=>ld(Mh(e)),Hpe=x9e(Cl),OM=class extends Hpe{},kM=class extends Cl{getLabel(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.label)}getLabelOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLabel(),"Expected to find a label.")}},qpe=ld(Tr),RM=class extends qpe{getClauses(){return(this.compilerNode.clauses||[]).map(n=>this._getNodeFromCompilerNode(n))}removeClause(r){return r=ku(r,this.getClauses().length-1),this.removeClauses([r,r])}removeClauses(r){let n=this.getClauses();return b.errors.throwIfRangeOutOfRange(r,[0,n.length],"indexRange"),$fe(n.slice(r[0],r[1]+1)),this}},D9e=e=>sc(ud(ld(Mh(e)))),Jpe=D9e(Tr),MM=class extends Jpe{remove(){zfe(this)}},zpe=Tr,wM=class extends zpe{getBlock(){return this._getNodeFromCompilerNode(this.compilerNode.block)}getVariableDeclaration(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.variableDeclaration)}getVariableDeclarationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getVariableDeclaration(),"Expected to find a variable declaration.")}},FM=class extends Cl{},GM=class extends Cl{getLabel(){return this.compilerNode.label==null?void 0:this._getNodeFromCompilerNode(this.compilerNode.label)}getLabelOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLabel(),"Expected to find a label.")}},$pe=Cl,BM=class extends $pe{},C9e=e=>ld(Mh(e)),Xpe=C9e(Tr),UM=class extends Xpe{remove(){zfe(this)}},dS=class extends Cl{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},Ype=ud(dS),KM=class extends Ype{},Qpe=Cl,WM=class extends Qpe{},Zpe=ud(sc(Cl)),VM=class extends Zpe{},eme=ud(dS),jM=class extends eme{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},rme=ud(Qfe(dS)),HM=class extends rme{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},tme=dS,qM=class extends tme{getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),"Expected to find an initializer.")}getCondition(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.condition)}getConditionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getCondition(),"Expected to find a condition.")}getIncrementor(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.incrementor)}getIncrementorOrThrow(){return b.errors.throwIfNullOrUndefined(this.getIncrementor(),"Expected to find an incrementor.")}},nme=ud(Cl),JM=class extends nme{getThenStatement(){return this._getNodeFromCompilerNode(this.compilerNode.thenStatement)}getElseStatement(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.elseStatement)}remove(){let r=[];Tr.isIfStatement(this.getParentOrThrow())&&r.push(this.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.ElseKeyword)),r.push(this),j6(r)}},ime=sc(Cl),zM=class extends ime{getLabel(){return this._getNodeFromCompilerNode(this.compilerNode.label)}getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},ame=Cl,$M=class extends ame{},ome=TL(Cl),XM=class extends ome{},sme=ud(Cl),YM=class extends sme{getCaseBlock(){return this._getNodeFromCompilerNode(this.compilerNode.caseBlock)}getClauses(){return this.getCaseBlock().getClauses()}removeClause(r){return this.getCaseBlock().removeClause(r)}removeClauses(r){return this.getCaseBlock().removeClauses(r)}},lme=ud(Cl),QM=class extends lme{},ume=Cl,ZM=class extends ume{getTryBlock(){return this._getNodeFromCompilerNode(this.compilerNode.tryBlock)}getCatchClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.catchClause)}getCatchClauseOrThrow(){return b.errors.throwIfNullOrUndefined(this.getCatchClause(),"Expected to find a catch clause.")}getFinallyBlock(){if(!(this.compilerNode.finallyBlock==null||this.compilerNode.finallyBlock.getFullWidth()===0))return this._getNodeFromCompilerNode(this.compilerNode.finallyBlock)}getFinallyBlockOrThrow(){return b.errors.throwIfNullOrUndefined(this.getFinallyBlock(),"Expected to find a finally block.")}},cme=Tr,ew=class extends cme{setElements(r){return this.replaceWithText(n=>{this._context.structurePrinterFactory.forAssertEntry().printAssertClause(n,r)}),this}getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}},sR=spe(Tr),rw=class extends sR{getValue(){return this._getNodeFromCompilerNode(this.compilerNode.value)}set(r){return io(sR.prototype,this,r),r.value&&this.getValue().replaceWithText(r.value),this}getStructure(){return uo(sR.prototype,this,{kind:Oe.StructureKind.AssertEntry,value:this.getValue().getText()})}},kH=ud(Cl),tw=class extends kH{isExportEquals(){return this.compilerNode.isExportEquals||!1}setIsExportEquals(r){return this.isExportEquals()===r?this:(r?this.getFirstChildByKindOrThrow(b.SyntaxKind.DefaultKeyword).replaceWithText("="):this.getFirstChildByKindOrThrow(b.SyntaxKind.EqualsToken).replaceWithText("default"),this)}set(r){return io(kH.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),r.isExportEquals!=null&&this.setIsExportEquals(r.isExportEquals),this}getStructure(){return uo(Cl.prototype,this,{kind:Oe.StructureKind.ExportAssignment,expression:this.getExpression().getText(),isExportEquals:this.isExportEquals()})}},lR=Cl,nw=class extends lR{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){var n;if(this.isTypeOnly()===r)return this;if(r)qa({parent:this,insertPos:((n=this.getNodeProperty("exportClause"))!==null&&n!==void 0?n:this.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken)).getStart(),newText:"type "});else{let i=this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword);Bs({children:[i],removeFollowingSpaces:!0})}return this}getNamespaceExport(){let r=this.getNodeProperty("exportClause");return r!=null&&Tr.isNamespaceExport(r)?r:void 0}getNamespaceExportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamespaceExport(),"Expected to find a namespace export.")}setNamespaceExport(r){let n=this.getNodeProperty("exportClause"),i=b.StringUtils.isNullOrWhitespace(r)?"*":`* as ${r}`;if(n==null){let a=this.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken);qa({insertPos:a.getStart(),parent:this,newText:i,replacing:{textLength:1}})}else Tr.isNamespaceExport(n)?n.getNameNode().replaceWithText(r):qa({insertPos:n.getStart(),parent:this,newText:i,replacing:{textLength:n.getWidth()}});return this}setModuleSpecifier(r){let n=typeof r=="string"?r:this._sourceFile.getRelativePathAsModuleSpecifierTo(r);if(b.StringUtils.isNullOrEmpty(n))return this.removeModuleSpecifier(),this;let i=this.getModuleSpecifier();if(i==null){let a=this.getLastChildIfKind(b.SyntaxKind.SemicolonToken),s=this._context.manipulationSettings.getQuoteKind();qa({insertPos:a!=null?a.getPos():this.getEnd(),parent:this,newText:` from ${s}${n}${s}`})}else i.setLiteralValue(n);return this}getModuleSpecifier(){let r=this._getNodeFromCompilerNodeIfExists(this.compilerNode.moduleSpecifier);if(r!=null){if(!Tr.isStringLiteral(r))throw new b.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return r}}getModuleSpecifierValue(){let r=this.getModuleSpecifier();return r?.getLiteralValue()}getModuleSpecifierSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),"A module specifier source file was expected.")}getModuleSpecifierSourceFile(){let r=this.getLastChildByKind(b.SyntaxKind.StringLiteral);if(r==null)return;let n=r.getSymbol();if(n==null)return;let i=n.getDeclarations()[0];return i!=null&&Tr.isSourceFile(i)?i:void 0}isModuleSpecifierRelative(){let r=this.getModuleSpecifierValue();return r==null?!1:RE.isModuleSpecifierRelative(r)}removeModuleSpecifier(){let r=this.getModuleSpecifier();if(r==null)return this;if(!this.hasNamedExports())throw new b.errors.InvalidOperationError("Cannot remove the module specifier from an export declaration that has no named exports.");return Bs({children:[this.getFirstChildByKindOrThrow(b.SyntaxKind.FromKeyword),r],removePrecedingNewLines:!0,removePrecedingSpaces:!0}),this}hasModuleSpecifier(){return this.getLastChildByKind(b.SyntaxKind.StringLiteral)!=null}isNamespaceExport(){return!this.hasNamedExports()}hasNamedExports(){var r;return((r=this.compilerNode.exportClause)===null||r===void 0?void 0:r.kind)===b.SyntaxKind.NamedExports}addNamedExport(r){return this.addNamedExports([r])[0]}addNamedExports(r){return this.insertNamedExports(this.getNamedExports().length,r)}insertNamedExport(r,n){return this.insertNamedExports(r,[n])[0]}insertNamedExports(r,n){if(!(n instanceof Function)&&b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getNamedExports(),a=this._getWriterWithIndentation(),s=this._context.structurePrinterFactory.forNamedImportExportSpecifier();r=ku(r,i.length);let u=this.getNodeProperty("exportClause");if(u==null){s.printTextsWithBraces(a,n);let f=this.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken);qa({insertPos:f.getStart(),parent:this,newText:a.toString(),replacing:{textLength:1}})}else u.getKind()===b.SyntaxKind.NamespaceExport?(s.printTextsWithBraces(a,n),qa({insertPos:u.getStart(),parent:this,newText:a.toString(),replacing:{textLength:u.getWidth()}})):(s.printTexts(a,n),j_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.NamedExports).getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:a.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1}));let p=this.getNamedExports();return af(i,p,r,!1)}getNamedExports(){let r=this.compilerNode.exportClause;return r==null||b.ts.isNamespaceExport(r)?[]:r.elements.map(n=>this._getNodeFromCompilerNode(n))}toNamespaceExport(){if(!this.hasModuleSpecifier())throw new b.errors.InvalidOperationError("Cannot change to a namespace export when no module specifier exists.");let r=this.getNodeProperty("exportClause");return r==null?this:(qa({parent:this,newText:"*",insertPos:r.getStart(),replacing:{textLength:r.getWidth()}}),this)}setAssertElements(r){let n=this.getAssertClause();if(n)r?n.setElements(r):n.remove();else if(r){let i=this._context.structurePrinterFactory.forAssertEntry(),a=this._context.createWriter();a.space(),i.printAssertClause(a,r),qa({parent:this,newText:a.toString(),insertPos:this.getSourceFile().getFullText()[this.getEnd()-1]===";"?this.getEnd()-1:this.getEnd()})}return this}getAssertClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertClause)}set(r){return io(lR.prototype,this,r),r.namedExports!=null?(A9e(this),this.addNamedExports(r.namedExports)):r.hasOwnProperty(b.nameof(r,"namedExports"))&&r.moduleSpecifier==null&&this.toNamespaceExport(),r.moduleSpecifier!=null?this.setModuleSpecifier(r.moduleSpecifier):r.hasOwnProperty(b.nameof(r,"moduleSpecifier"))&&this.removeModuleSpecifier(),r.namedExports==null&&r.hasOwnProperty(b.nameof(r,"namedExports"))&&this.toNamespaceExport(),r.namespaceExport!=null&&this.setNamespaceExport(r.namespaceExport),r.isTypeOnly!=null&&this.setIsTypeOnly(r.isTypeOnly),r.hasOwnProperty(b.nameof(r,"assertElements"))&&this.setAssertElements(r.assertElements),this}getStructure(){var r;let n=this.getModuleSpecifier(),i=this.getAssertClause();return uo(lR.prototype,this,{kind:Oe.StructureKind.ExportDeclaration,isTypeOnly:this.isTypeOnly(),moduleSpecifier:n?.getLiteralText(),namedExports:this.getNamedExports().map(a=>a.getStructure()),namespaceExport:(r=this.getNamespaceExport())===null||r===void 0?void 0:r.getName(),assertElements:i?i.getElements().map(a=>a.getStructure()):void 0})}};function A9e(e){let r=e.getNodeProperty("exportClause"),n;if(r!=null){if(e.getNamedExports().length===0)return;n=r}else n=e.getFirstChildByKindOrThrow(b.SyntaxKind.AsteriskToken);qa({parent:e,newText:"{ }",insertPos:n.getStart(),replacing:{textLength:n.getWidth()}})}var RH=Tr,iw=class extends RH{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.propertyName||this.compilerNode.name)}renameAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAliasWithRename(),this;let n=this.getAliasNode();return n==null&&(this.setAlias(this.getName()),n=this.getAliasNode()),n.rename(r),this}setAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAlias(),this;let n=this.getAliasNode();return n==null?qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${r}`}):n.replaceWithText(r),this}removeAlias(){let r=this.getAliasNode();return r==null?this:(Bs({children:[this.getFirstChildByKindOrThrow(b.SyntaxKind.AsKeyword),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}removeAliasWithRename(){let r=this.getAliasNode();return r==null?this:(r.rename(this.getName()),this.removeAlias(),this)}getAliasNode(){if(this.compilerNode.propertyName!=null)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){return this.isTypeOnly()===r?this:(r?qa({insertPos:this.getStart(),parent:this,newText:"type "}):Bs({children:[this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0}),this)}getExportDeclaration(){return this.getFirstAncestorByKindOrThrow(b.SyntaxKind.ExportDeclaration)}getLocalTargetSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLocalTargetSymbol(),"The export specifier's local target symbol was expected.")}getLocalTargetSymbol(){return this._context.typeChecker.getExportSpecifierLocalTargetSymbol(this)}getLocalTargetDeclarations(){var r,n;return(n=(r=this.getLocalTargetSymbol())===null||r===void 0?void 0:r.getDeclarations())!==null&&n!==void 0?n:[]}remove(){let r=this.getExportDeclaration();r.getNamedExports().length>1?mv(this):r.hasModuleSpecifier()?r.toNamespaceExport():r.remove()}set(r){return io(RH.prototype,this,r),r.name!=null&&this.setName(r.name),r.alias!=null?this.setAlias(r.alias):r.hasOwnProperty(b.nameof(r,"alias"))&&this.removeAlias(),this}getStructure(){let r=this.getAliasNode();return uo(Tr.prototype,this,{kind:Oe.StructureKind.ExportSpecifier,alias:r?r.getText():void 0,name:this.getNameNode().getText()})}},dme=TL(Tr),aw=class extends dme{getReferencedSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReferencedSourceFile(),"Expected to find the referenced source file.")}isRelative(){let r=this.getExpression();return r==null||!Tr.isStringLiteral(r)?!1:RE.isModuleSpecifierRelative(r.getLiteralText())}getReferencedSourceFile(){let r=this.getExpression();if(r==null)return;let n=r.getSymbol();if(n!=null)return RE.getReferencedSourceFileFromSymbol(n)}},fme=Tr,ow=class extends fme{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){if(this.isTypeOnly()===r)return this;if(r)qa({parent:this,insertPos:this.getStart(),newText:"type "});else{let n=this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword);Bs({children:[n],removeFollowingSpaces:!0})}return this}getDefaultImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultImport(),"Expected to find a default import.")}getDefaultImport(){return this.getNodeProperty("name")}getNamedBindingsOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamedBindings(),"Expected to find an import declaration's named bindings.")}getNamedBindings(){return this.getNodeProperty("namedBindings")}getNamespaceImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamespaceImport(),"Expected to find a namespace import.")}getNamespaceImport(){let r=this.getNamedBindings();if(!(r==null||!Tr.isNamespaceImport(r)))return r.getNameNode()}getNamedImports(){let r=this.getNamedBindings();return r==null||!Tr.isNamedImports(r)?[]:r.getElements()}},uR=Cl,sw=class extends uR{isTypeOnly(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.isTypeOnly())!==null&&n!==void 0?n:!1}setIsTypeOnly(r){let n=this.getImportClause();if(n==null){if(r)throw new b.errors.InvalidOperationError("Cannot set an import as type only when there is no import clause.");return this}return n.setIsTypeOnly(r),this}setModuleSpecifier(r){let n=typeof r=="string"?r:this._sourceFile.getRelativePathAsModuleSpecifierTo(r);return this.getModuleSpecifier().setLiteralValue(n),this}getModuleSpecifier(){let r=this._getNodeFromCompilerNode(this.compilerNode.moduleSpecifier);if(!Tr.isStringLiteral(r))throw new b.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return r}getModuleSpecifierValue(){return this.getModuleSpecifier().getLiteralValue()}getModuleSpecifierSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),"A module specifier source file was expected.")}getModuleSpecifierSourceFile(){let r=this.getModuleSpecifier().getSymbol();if(r!=null)return RE.getReferencedSourceFileFromSymbol(r)}isModuleSpecifierRelative(){return RE.isModuleSpecifierRelative(this.getModuleSpecifierValue())}setDefaultImport(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeDefaultImport();let n=this.getDefaultImport();if(n!=null)return n.replaceWithText(r),this;let i=this.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword),a=this.getImportClause();return a==null?(qa({insertPos:i.getEnd(),parent:this,newText:` ${r} from`}),this):(qa({insertPos:i.getEnd(),parent:a,newText:` ${r},`}),this)}renameDefaultImport(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeDefaultImport();let n=this.getDefaultImport();return n!=null?(n.rename(r),this):(this.setDefaultImport(r),this)}getDefaultImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefaultImport(),"Expected to find a default import.")}getDefaultImport(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.getDefaultImport())!==null&&n!==void 0?n:void 0}setNamespaceImport(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeNamespaceImport();let n=this.getNamespaceImport();if(n!=null)return n.rename(r),this;if(this.getNamedImports().length>0)throw new b.errors.InvalidOperationError("Cannot add a namespace import to an import declaration that has named imports.");let i=this.getDefaultImport();return i!=null?(qa({insertPos:i.getEnd(),parent:this.getImportClause(),newText:`, * as ${r}`}),this):(qa({insertPos:this.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` * as ${r} from`}),this)}removeNamespaceImport(){let r=this.getNamespaceImport();if(r==null)return this;return Bs({children:n.call(this),removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this;function n(){let i=this.getDefaultImport();return i==null?[this.getImportClauseOrThrow(),this.getLastChildByKindOrThrow(b.SyntaxKind.FromKeyword)]:[i.getNextSiblingIfKindOrThrow(b.SyntaxKind.CommaToken),r]}}removeDefaultImport(){let r=this.getImportClause();if(r==null)return this;let n=r.getDefaultImport();if(n==null)return this;let i=r.getChildCount()===1;return Bs(i?{children:[r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.FromKeyword)],removePrecedingSpaces:!0,removePrecedingNewLines:!0}:{children:[n,n.getNextSiblingIfKindOrThrow(b.SyntaxKind.CommaToken)],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this}getNamespaceImportOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNamespaceImport(),"Expected to find a namespace import.")}getNamespaceImport(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.getNamespaceImport())!==null&&n!==void 0?n:void 0}addNamedImport(r){return this.addNamedImports([r])[0]}addNamedImports(r){return this.insertNamedImports(this.getNamedImports().length,r)}insertNamedImport(r,n){return this.insertNamedImports(r,[n])[0]}insertNamedImports(r,n){if(!(n instanceof Function)&&b.ArrayUtils.isNullOrEmpty(n))return[];let i=this.getNamedImports(),a=this._getWriterWithQueuedIndentation(),s=this._context.structurePrinterFactory.forNamedImportExportSpecifier(),u=this.getImportClause();if(r=ku(r,i.length),i.length===0)if(s.printTextsWithBraces(a,n),u==null)qa({insertPos:this.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` ${a.toString()} from`});else{if(this.getNamespaceImport()!=null)throw pme();if(u.getNamedBindings()!=null){let f=u.getNamedBindingsOrThrow();qa({insertPos:f.getStart(),replacing:{textLength:f.getWidth()},parent:u,newText:a.toString()})}else qa({insertPos:this.getDefaultImport().getEnd(),parent:u,newText:`, ${a.toString()}`})}else{if(u==null)throw new b.errors.NotImplementedError("Expected to have an import clause.");s.printTexts(a,n),j_({parent:u.getFirstChildByKindOrThrow(b.SyntaxKind.NamedImports).getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:i,insertIndex:r,newText:a.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1})}let p=this.getNamedImports();return af(i,p,r,!1)}getNamedImports(){var r,n;return(n=(r=this.getImportClause())===null||r===void 0?void 0:r.getNamedImports())!==null&&n!==void 0?n:[]}removeNamedImports(){let r=this.getImportClause();if(r==null)return this;let n=r.getNamedBindings();if(n==null||n.getKind()!==b.SyntaxKind.NamedImports)return this;let i=this.getDefaultImport();if(i!=null){let s=i.getNextSiblingIfKindOrThrow(b.SyntaxKind.CommaToken);return Bs({children:[s,n]}),this}let a=r.getNextSiblingIfKindOrThrow(b.SyntaxKind.FromKeyword);return Bs({children:[r,a],removePrecedingSpaces:!0}),this}getImportClauseOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImportClause(),"Expected to find an import clause.")}getImportClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.importClause)}setAssertElements(r){let n=this.getAssertClause();if(n)r?n.setElements(r):n.remove();else if(r){let i=this._context.structurePrinterFactory.forAssertEntry(),a=this._context.createWriter();a.space(),i.printAssertClause(a,r),qa({parent:this,newText:a.toString(),insertPos:this.getSourceFile().getFullText()[this.getEnd()-1]===";"?this.getEnd()-1:this.getEnd()})}return this}getAssertClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertClause)}set(r){return io(uR.prototype,this,r),r.defaultImport!=null?this.setDefaultImport(r.defaultImport):r.hasOwnProperty(b.nameof(r,"defaultImport"))&&this.removeDefaultImport(),r.hasOwnProperty(b.nameof(r,"namedImports"))&&this.removeNamedImports(),r.namespaceImport!=null?this.setNamespaceImport(r.namespaceImport):r.hasOwnProperty(b.nameof(r,"namespaceImport"))&&this.removeNamespaceImport(),r.namedImports!=null&&(L9e(this),this.addNamedImports(r.namedImports)),r.moduleSpecifier!=null&&this.setModuleSpecifier(r.moduleSpecifier),r.isTypeOnly!=null&&this.setIsTypeOnly(r.isTypeOnly),r.hasOwnProperty(b.nameof(r,"assertElements"))&&this.setAssertElements(r.assertElements),this}getStructure(){let r=this.getNamespaceImport(),n=this.getDefaultImport(),i=this.getAssertClause();return uo(uR.prototype,this,{kind:Oe.StructureKind.ImportDeclaration,isTypeOnly:this.isTypeOnly(),defaultImport:n?n.getText():void 0,moduleSpecifier:this.getModuleSpecifier().getLiteralText(),namedImports:this.getNamedImports().map(a=>a.getStructure()),namespaceImport:r?r.getText():void 0,assertElements:i?i.getElements().map(a=>a.getStructure()):void 0})}};function L9e(e){let r=e.getNodeProperty("importClause"),n=e._getWriterWithQueuedChildIndentation();e._context.structurePrinterFactory.forNamedImportExportSpecifier().printTextsWithBraces(n,[]);let a=n.toString();if(e.getNamespaceImport()!=null)throw pme();if(r==null){qa({insertPos:e.getFirstChildByKindOrThrow(b.SyntaxKind.ImportKeyword).getEnd(),parent:e,newText:` ${a} from`});return}let s=r.getNamedBindings();if(s!=null){qa({parent:r,newText:a,insertPos:s.getStart(),replacing:{textLength:s.getWidth()}});return}let u=r.getDefaultImport();if(u!=null){qa({insertPos:u.getEnd(),parent:r,newText:`, ${a}`});return}}function pme(){return new b.errors.InvalidOperationError("Cannot add a named import to an import declaration that has a namespace import.")}var N9e=e=>sc(gv(e)),mme=N9e(Cl),lw=class extends mme{isTypeOnly(){var r;return(r=this.compilerNode.isTypeOnly)!==null&&r!==void 0?r:!1}setIsTypeOnly(r){if(this.isTypeOnly()===r)return this;if(r)qa({parent:this,insertPos:this.getNameNode().getStart(),newText:"type "});else{let n=this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword);Bs({children:[n],removeFollowingSpaces:!0})}return this}getModuleReference(){return this._getNodeFromCompilerNode(this.compilerNode.moduleReference)}isExternalModuleReferenceRelative(){let r=this.getModuleReference();return Tr.isExternalModuleReference(r)?r.isRelative():!1}setExternalModuleReference(r){let n=typeof r=="string"?r:this._sourceFile.getRelativePathAsModuleSpecifierTo(r),i=this.getModuleReference();return Tr.isExternalModuleReference(i)&&i.getExpression()!=null?i.getExpressionOrThrow().replaceWithText(a=>a.quote(n)):i.replaceWithText(a=>a.write("require(").quote(n).write(")")),this}getExternalModuleReferenceSourceFileOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExternalModuleReferenceSourceFile(),"Expected to find an external module reference's referenced source file.")}getExternalModuleReferenceSourceFile(){let r=this.getModuleReference();if(!!Tr.isExternalModuleReference(r))return r.getReferencedSourceFile()}},cR=Tr,uw=class extends cR{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){var r;return this._getNodeFromCompilerNode((r=this.compilerNode.propertyName)!==null&&r!==void 0?r:this.compilerNode.name)}renameAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAliasWithRename(),this;let n=this.getAliasNode();return n==null&&(this.setAlias(this.getName()),n=this.getAliasNode()),n.rename(r),this}setAlias(r){if(b.StringUtils.isNullOrWhitespace(r))return this.removeAlias(),this;let n=this.getAliasNode();return n==null?qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${r}`}):n.replaceWithText(r),this}removeAlias(){let r=this.getAliasNode();return r==null?this:(Bs({children:[this.getFirstChildByKindOrThrow(b.SyntaxKind.AsKeyword),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}removeAliasWithRename(){let r=this.getAliasNode();return r==null?this:(r.rename(this.getName()),this.removeAlias(),this)}getAliasNode(){if(this.compilerNode.propertyName!=null)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(r){return this.isTypeOnly()===r?this:(r?qa({insertPos:this.getStart(),parent:this,newText:"type "}):Bs({children:[this.getFirstChildByKindOrThrow(b.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0}),this)}getImportDeclaration(){return this.getFirstAncestorByKindOrThrow(b.SyntaxKind.ImportDeclaration)}remove(){let r=this.getImportDeclaration();r.getNamedImports().length>1?mv(this):r.removeNamedImports()}set(r){return io(cR.prototype,this,r),r.name!=null&&this.setName(r.name),r.alias!=null?this.setAlias(r.alias):r.hasOwnProperty(b.nameof(r,"alias"))&&this.removeAlias(),this}getStructure(){let r=this.getAliasNode();return uo(cR.prototype,this,{kind:Oe.StructureKind.ImportSpecifier,name:this.getName(),alias:r?r.getText():void 0})}},_me=Mh(Cl),cw=class extends _me{};function yS(e){return class extends e{getParentModuleOrThrow(){return b.errors.throwIfNullOrUndefined(this.getParentModule(),"Expected to find the parent module declaration.")}getParentModule(){let r=this.getParentOrThrow();if(!!Tr.isModuleBlock(r)){for(;r.getParentOrThrow().getKind()===b.SyntaxKind.ModuleDeclaration;)r=r.getParentOrThrow();return r}}}}Oe.ModuleDeclarationKind=void 0;(function(e){e.Namespace="namespace",e.Module="module",e.Global="global"})(Oe.ModuleDeclarationKind||(Oe.ModuleDeclarationKind={}));var I9e=e=>eq(Z6(ld(HT(yS(Mh(sc(Ph(BE(sf(lpe(e))))))))))),dR=I9e(Cl),dw=class extends dR{getName(){let r=this.getNameNodes();return r instanceof Array?r.map(n=>n.getText()).join("."):r.getText()}setName(r){let n="Please open an issue if you really need this and I'll up the priority.";if(r.indexOf(".")>=0)throw new b.errors.NotImplementedError(`Not implemented to set a namespace name to a name containing a period. ${n}`);let i=this.getNameNodes();if(i instanceof Array){if(i.length>1)throw new b.errors.NotImplementedError(`Not implemented to set a namespace name that uses dot notation. ${n}`);r!=="global"&&aj(this),b.StringUtils.isQuoted(r)&&P9e(this),i[0].replaceWithText(r)}else i.replaceWithText(r);return this}rename(r,n){if(r.indexOf(".")>=0)throw new b.errors.NotSupportedError("Cannot rename a namespace name to a name containing a period.");let i=this.getNameNodes();if(i instanceof Array){if(i.length>1)throw new b.errors.NotSupportedError(`Cannot rename a namespace name that uses dot notation. Rename the individual nodes via .${b.nameof(this,"getNameNodes")}()`);r!=="global"&&aj(this),i[0].rename(r,n)}else epe(i,b.StringUtils.stripQuotes(r),n);return this}getNameNodes(){let r=this.getNameNode();if(Tr.isStringLiteral(r))return r;{let n=[],i=this;do n.push(this._getNodeFromCompilerNode(i.compilerNode.name)),i=i.getFirstChildByKind(b.SyntaxKind.ModuleDeclaration);while(i!=null);return n}}hasNamespaceKeyword(){return this.getDeclarationKind()===Oe.ModuleDeclarationKind.Namespace}hasModuleKeyword(){return this.getDeclarationKind()===Oe.ModuleDeclarationKind.Module}setDeclarationKind(r){if(this.getDeclarationKind()===r)return this;if(r===Oe.ModuleDeclarationKind.Global){let n=this.getDeclarationKindKeyword();this.getNameNode().replaceWithText("global"),n!=null&&Bs({children:[n],removeFollowingNewLines:!0,removeFollowingSpaces:!0})}else{let n=this.getDeclarationKindKeyword();n!=null?n.replaceWithText(r):qa({parent:this,insertPos:this.getNameNode().getStart(),newText:r+" "})}return this}getDeclarationKind(){let r=this.getFlags();return(r&b.ts.NodeFlags.GlobalAugmentation)!==0?Oe.ModuleDeclarationKind.Global:(r&b.ts.NodeFlags.Namespace)!==0?Oe.ModuleDeclarationKind.Namespace:Oe.ModuleDeclarationKind.Module}getDeclarationKindKeyword(){return this.getFirstChild(r=>r.getKind()===b.SyntaxKind.NamespaceKeyword||r.getKind()===b.SyntaxKind.ModuleKeyword)}set(r){return r.name!=null&&r.name!=="global"&&aj(this),io(dR.prototype,this,r),r.declarationKind!=null&&this.setDeclarationKind(r.declarationKind),this}getStructure(){return uo(dR.prototype,this,{kind:Oe.StructureKind.Module,declarationKind:this.getDeclarationKind()})}_getInnerBody(){let r=this.getBody();for(;r!=null&&Tr.isBodyable(r)&&r.compilerNode.statements==null;)r=r.getBody();return r}};function aj(e){e.getDeclarationKind()===Oe.ModuleDeclarationKind.Global&&e.setDeclarationKind(Oe.ModuleDeclarationKind.Namespace)}function P9e(e){e.hasNamespaceKeyword()&&e.setDeclarationKind(Oe.ModuleDeclarationKind.Module),e.hasDeclareKeyword()||e.setHasDeclareKeyword(!0)}var gme=Tr,fw=class extends gme{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},yme=Tr,pw=class extends yme{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},vme=_v(Tr),mw=class extends vme{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},hme=_v(Tr),_w=class extends hme{setName(r){let n=this.getNameNode();return n.getText()===r?this:(n.replaceWithText(r),this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},kD=class extends rL{constructor(r,n){super(r,n)}getFileName(){return this.compilerObject.fileName}};Oe.FileSystemRefreshResult=void 0;(function(e){e[e.NoChange=0]="NoChange",e[e.Updated=1]="Updated",e[e.Deleted=2]="Deleted"})(Oe.FileSystemRefreshResult||(Oe.FileSystemRefreshResult={}));function co(e,r,n,i){var a=arguments.length,s=a<3?r:i===null?i=Object.getOwnPropertyDescriptor(r,n):i,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,r,n,i);else for(var p=e.length-1;p>=0;p--)(u=e[p])&&(s=(a<3?u(s):a>3?u(r,n,s):u(r,n))||s);return a>3&&s&&Object.defineProperty(r,n,s),s}var fR=eq(ld(Mh(Tr))),kE=class extends fR{constructor(r,n){super(r,n,void 0),this._isSaved=!1,this._modifiedEventContainer=new b.EventContainer,this._preModifiedEventContainer=new b.EventContainer,this._referenceContainer=new fj(this),this.__sourceFile=this;let i=()=>{this.isFromExternalLibrary(),this._preModifiedEventContainer.unsubscribe(i)};this._preModifiedEventContainer.subscribe(i)}_replaceCompilerNodeFromFactory(r){super._replaceCompilerNodeFromFactory(r),this._context.resetProgram(),this._isSaved=!1,this._modifiedEventContainer.fire(this)}_clearInternals(){super._clearInternals(),r(this._referencedFiles),r(this._typeReferenceDirectives),r(this._libReferenceDirectives),delete this._referencedFiles,delete this._typeReferenceDirectives,delete this._libReferenceDirectives;function r(n){n?.forEach(i=>i._forget())}}getFilePath(){return this.compilerNode.fileName}getBaseName(){return b.FileUtils.getBaseName(this.getFilePath())}getBaseNameWithoutExtension(){let r=this.getBaseName(),n=this.getExtension();return r.substring(0,r.length-n.length)}getExtension(){return b.FileUtils.getExtension(this.getFilePath())}getDirectory(){return this._context.compilerFactory.getDirectoryFromCache(this.getDirectoryPath())}getDirectoryPath(){return this._context.fileSystemWrapper.getStandardizedAbsolutePath(b.FileUtils.getDirPath(this.compilerNode.fileName))}getFullText(){return this.compilerNode.text}getLineAndColumnAtPos(r){let n=this.getFullText();return{line:b.StringUtils.getLineNumberAtPos(n,r),column:b.StringUtils.getLengthFromLineStartAtPos(n,r)+1}}getLengthFromLineStartAtPos(r){return b.StringUtils.getLengthFromLineStartAtPos(this.getFullText(),r)}copyToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.copy(b.FileUtils.pathJoin(i,this.getBaseName()),n)}copy(r,n={}){this._throwIfIsInMemoryLibFile();let i=this._copyInternal(r,n);if(i===!1)return this;let a=i;return a.getDirectoryPath()!==this.getDirectoryPath()&&a._updateReferencesForCopyInternal(this._getReferencesForCopyInternal()),a}_copyInternal(r,n={}){let{overwrite:i=!1}=n,{compilerFactory:a,fileSystemWrapper:s}=this._context,u=s.getStandardizedAbsolutePath(r,this.getDirectoryPath());if(u===this.getFilePath())return!1;return p(this);function p(f){try{return a.createSourceFileFromText(u,f.getFullText(),{overwrite:i,markInProject:m()})}catch(g){throw g instanceof b.errors.InvalidOperationError?new b.errors.InvalidOperationError("Did you mean to provide the overwrite option? "+g.message):g}function m(){if(f._isInProject())return!0;let g=a.getSourceFileFromCacheFromFilePath(u);return g!=null&&g._isInProject()}}}_getReferencesForCopyInternal(){return Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries())}_updateReferencesForCopyInternal(r){for(let n of r)n[0]=this.getChildSyntaxListOrThrow().getDescendantAtStartWithWidth(n[0].getStart(),n[0].getWidth());oj(r)}async copyImmediately(r,n){let i=this.copy(r,n);return await i.save(),i}copyImmediatelySync(r,n){let i=this.copy(r,n);return i.saveSync(),i}moveToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.move(b.FileUtils.pathJoin(i,this.getBaseName()),n)}move(r,n={}){this._throwIfIsInMemoryLibFile();let i=this.getDirectoryPath(),a=this._getReferencesForMoveInternal(),s=this.getFilePath();return this._moveInternal(r,n)?(this._context.fileSystemWrapper.queueFileDelete(s),this._updateReferencesForMoveInternal(a,i),this._context.lazyReferenceCoordinator.clearDirtySourceFiles(),this._context.lazyReferenceCoordinator.addDirtySourceFile(this),this):this}_moveInternal(r,n={}){let{overwrite:i=!1}=n,a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getDirectoryPath());if(a===this.getFilePath())return!1;let s=!1;if(i){let u=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(a);u!=null&&(s=u._isInProject(),u.forget())}else this._context.compilerFactory.throwIfFileExists(a,"Did you mean to provide the overwrite option?");return Yfe({newFilePath:a,sourceFile:this}),s&&this._markAsInProject(),this._isInProject()&&this.getDirectory()._markAsInProject(),!0}_getReferencesForMoveInternal(){return{literalReferences:Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries()),referencingLiterals:Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}}_updateReferencesForMoveInternal(r,n){let{literalReferences:i,referencingLiterals:a}=r;n!==this.getDirectoryPath()&&oj(i),oj(a.map(s=>[s,this]))}async moveImmediately(r,n){let i=this.getFilePath(),a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getDirectoryPath());return this.move(r,n),i!==a?(await this._context.fileSystemWrapper.moveFileImmediately(i,a,this.getFullText()),this._isSaved=!0):await this.save(),this}moveImmediatelySync(r,n){let i=this.getFilePath(),a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getDirectoryPath());return this.move(r,n),i!==a?(this._context.fileSystemWrapper.moveFileImmediatelySync(i,a,this.getFullText()),this._isSaved=!0):this.saveSync(),this}delete(){this._throwIfIsInMemoryLibFile();let r=this.getFilePath();this.forget(),this._context.fileSystemWrapper.queueFileDelete(r)}async deleteImmediately(){this._throwIfIsInMemoryLibFile();let r=this.getFilePath();this.forget(),await this._context.fileSystemWrapper.deleteFileImmediately(r)}deleteImmediatelySync(){this._throwIfIsInMemoryLibFile();let r=this.getFilePath();this.forget(),this._context.fileSystemWrapper.deleteFileImmediatelySync(r)}async save(){this._isLibFileInMemory()||(await this._context.fileSystemWrapper.writeFile(this.getFilePath(),this._getTextForSave()),this._isSaved=!0)}saveSync(){this._isLibFileInMemory()||(this._context.fileSystemWrapper.writeFileSync(this.getFilePath(),this._getTextForSave()),this._isSaved=!0)}_getTextForSave(){let r=this.getFullText();return this._hasBom?"\uFEFF"+r:r}getPathReferenceDirectives(){return this._referencedFiles==null&&(this._referencedFiles=(this.compilerNode.referencedFiles||[]).map(r=>new kD(r,this))),this._referencedFiles}getTypeReferenceDirectives(){return this._typeReferenceDirectives==null&&(this._typeReferenceDirectives=(this.compilerNode.typeReferenceDirectives||[]).map(r=>new kD(r,this))),this._typeReferenceDirectives}getLibReferenceDirectives(){return this._libReferenceDirectives==null&&(this._libReferenceDirectives=(this.compilerNode.libReferenceDirectives||[]).map(r=>new kD(r,this))),this._libReferenceDirectives}getReferencingSourceFiles(){return Array.from(this._referenceContainer.getDependentSourceFiles())}getReferencingNodesInOtherSourceFiles(){let r=this.getReferencingLiteralsInOtherSourceFiles();return Array.from(n());function*n(){for(let i of r)yield _fe(i)}}getReferencingLiteralsInOtherSourceFiles(){return Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}getReferencedSourceFiles(){let r=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(new Set(n()).values());function*n(){for(let[,i]of r)yield i}}getNodesReferencingOtherSourceFiles(){let r=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(n());function*n(){for(let[i]of r)yield _fe(i)}}getLiteralsReferencingOtherSourceFiles(){let r=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(n());function*n(){for(let[i]of r)yield i}}getImportStringLiterals(){return this._ensureBound(),(this.compilerNode.imports||[]).filter(n=>n.pos!==-1).map(n=>this._getNodeFromCompilerNode(n))}getLanguageVersion(){return this.compilerNode.languageVersion}getLanguageVariant(){return this.compilerNode.languageVariant}getScriptKind(){return this.compilerNode.scriptKind}isDeclarationFile(){return this.compilerNode.isDeclarationFile}isFromExternalLibrary(){return this._context.program._isCompilerProgramCreated()?this._context.program.compilerObject.isSourceFileFromExternalLibrary(this.compilerNode):!1}isInNodeModules(){return this.getFilePath().indexOf("/node_modules/")>=0}isSaved(){return this._isSaved&&!this._isLibFileInMemory()}_setIsSaved(r){this._isSaved=r}getPreEmitDiagnostics(){return this._context.getPreEmitDiagnostics(this)}unindent(r,n=1){return this.indent(r,n*-1)}indent(r,n=1){if(n===0)return this;let i=this.getFullText(),a=typeof r=="number"?[r,r]:r;b.errors.throwIfRangeOutOfRange(a,[0,i.length],"positionRange");let s=dv(i,a[0],f=>f===ac.NEWLINE),u=V6(i,a[1],f=>f===ac.CARRIAGE_RETURN||f===ac.NEWLINE),p=b.StringUtils.indent(i.substring(s,u),n,{indentText:this._context.manipulationSettings.getIndentationText(),indentSizeInSpaces:this._context.manipulationSettings._getIndentSizeInSpaces(),isInStringAtPos:f=>this.isInStringAtPos(f+s)});return Nj({sourceFile:this,newText:i.substring(0,s)+p+i.substring(u)}),this}emit(r){return this._context.program.emit({targetSourceFile:this,...r})}emitSync(r){return this._context.program.emitSync({targetSourceFile:this,...r})}getEmitOutput(r={}){return this._context.languageService.getEmitOutput(this,r.emitOnlyDtsFiles||!1)}formatText(r={}){Nj({sourceFile:this,newText:this._context.languageService.getFormattedDocumentText(this.getFilePath(),r)})}async refreshFromFileSystem(){let r=await this._context.fileSystemWrapper.readFileOrNotExists(this.getFilePath(),this._context.getEncoding());return this._refreshFromFileSystemInternal(r)}refreshFromFileSystemSync(){let r=this._context.fileSystemWrapper.readFileOrNotExistsSync(this.getFilePath(),this._context.getEncoding());return this._refreshFromFileSystemInternal(r)}getRelativePathTo(r){return this.getDirectory().getRelativePathTo(r)}getRelativePathAsModuleSpecifierTo(r){return this.getDirectory().getRelativePathAsModuleSpecifierTo(r)}onModified(r,n=!0){return n?this._modifiedEventContainer.subscribe(r):this._modifiedEventContainer.unsubscribe(r),this}_doActionPreNextModification(r){let n=()=>{r(),this._preModifiedEventContainer.unsubscribe(n)};return this._preModifiedEventContainer.subscribe(n),this}_firePreModified(){this._preModifiedEventContainer.fire(this)}organizeImports(r={},n={}){return this._context.languageService.organizeImports(this,r,n).forEach(i=>i.applyChanges()),this}fixUnusedIdentifiers(r={},n={}){return this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_delete",r,n).applyChanges(),this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_deleteImports",r,n).applyChanges(),this}fixMissingImports(r={},n={}){let i=this._context.languageService.getCombinedCodeFix(this,"fixMissingImport",r,n),a=this;for(let p of i.getChanges()){let f=p.getTextChanges();s(f),u(f)}return this;function s(p){p.sort((f,m)=>f.getSpan().getStart()-m.getSpan().getStart());for(let f=0;f<p.length-1;f++){let{compilerObject:m}=p[f];m.newText=m.newText.replace(/(\r?)\n\r?\n$/,`$1
4250
4250
  `)}}function u(p){let f=b.ArrayUtils.groupBy(p,g=>g.getSpan().getStart()),m=0;for(let g of f){let D=g[0].getSpan().getStart()+m,P=g.map(B=>B.getNewText()).join("");f7e({sourceFile:a,insertPos:D,newText:P}),m+=P.length}}}applyTextChanges(r){return r.length===0?this:(this.forgetDescendants(),mS({sourceFile:this._sourceFile,start:0,replacingLength:this.getFullWidth(),newText:HH(this,r)}),this)}set(r){return io(fR.prototype,this,r),this}getStructure(){return uo(fR.prototype,this,{kind:Oe.StructureKind.SourceFile})}_refreshFromFileSystemInternal(r){if(r===!1)return this.forget(),Oe.FileSystemRefreshResult.Deleted;let n=r;return n===this.getFullText()?Oe.FileSystemRefreshResult.NoChange:(this.replaceText([0,this.getEnd()],n),this._setIsSaved(!0),Oe.FileSystemRefreshResult.Updated)}_isLibFileInMemory(){return this.compilerNode.fileName.startsWith(b.libFolderInMemoryPath)}_throwIfIsInMemoryLibFile(){if(this._isLibFileInMemory())throw new b.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)}};co([b.Memoize],kE.prototype,"isFromExternalLibrary",null);function oj(e){for(let[r,n]of e)RE.isModuleSpecifierRelative(r.getLiteralText())&&r.setLiteralValue(r._sourceFile.getRelativePathAsModuleSpecifierTo(n))}function _fe(e){let r=e.getParentOrThrow(),n=r.getParent();return n!=null&&Tr.isImportEqualsDeclaration(n)?n:r}var O9e=e=>yS(sc(Ph(BE(sf(e))))),pR=O9e(Cl),gw=class extends pR{getDeclarationList(){return this._getNodeFromCompilerNode(this.compilerNode.declarationList)}getDeclarations(){return this.getDeclarationList().getDeclarations()}getDeclarationKind(){return this.getDeclarationList().getDeclarationKind()}getDeclarationKindKeyword(){return this.getDeclarationList().getDeclarationKindKeyword()}setDeclarationKind(r){return this.getDeclarationList().setDeclarationKind(r)}addDeclaration(r){return this.getDeclarationList().addDeclaration(r)}addDeclarations(r){return this.getDeclarationList().addDeclarations(r)}insertDeclaration(r,n){return this.getDeclarationList().insertDeclaration(r,n)}insertDeclarations(r,n){return this.getDeclarationList().insertDeclarations(r,n)}set(r){if(io(pR.prototype,this,r),r.declarationKind!=null&&this.setDeclarationKind(r.declarationKind),r.declarations!=null){let n=this.getDeclarations();this.addDeclarations(r.declarations),n.forEach(i=>i.remove())}return this}getStructure(){return uo(pR.prototype,this,{kind:Oe.StructureKind.VariableStatement,declarationKind:this.getDeclarationKind(),declarations:this.getDeclarations().map(r=>r.getStructure())})}},Eme=ud(dS),yw=class extends Eme{},bme=ud(Cl),vw=class extends bme{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}};function YT(e){return sc(J_(yv(Mh(sf(e)))))}var k9e=e=>ld(H6(jT(YT(e)))),Sme=k9e(oc),hw=class extends Sme{getEqualsGreaterThan(){return this._getNodeFromCompilerNode(this.compilerNode.equalsGreaterThanToken)}};function eG(e){return class extends e{getOverloads(){return gfe(this).filter(r=>r.isOverload())}getImplementation(){return this.isImplementation()?this:gfe(this).find(r=>r.isImplementation())}getImplementationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImplementation(),"Expected to find a corresponding implementation for the overload.")}isOverload(){return!this.isImplementation()}isImplementation(){return this.getBody()!=null}}}function gfe(e){let r=e.getParentOrThrow(),n=yfe(e),i=e.getKind();return r.forEachChildAsArray().filter(a=>{let s=yfe(a)===n,u=a.getKind()===i;return s&&u})}function yfe(e){let r=e;if(r.getName instanceof Function)return r.getName()}function rG(e){if(e.structures.length===0)return[];let r=e.node.getParentSyntaxListOrThrow(),n=e.node.getImplementation()||e.node,i=e.node.getOverloads(),a=i.length,s=i.length>0?i[0].getChildIndex():n.getChildIndex(),u=ku(e.index,a),p=s+u,f=e.getThisStructure(n),m=e.structures.map(D=>Object.assign(Object.assign({},f),D)),g=n._getWriterWithQueuedIndentation();for(let D of m)g.getLength()>0&&g.newLine(),e.printStructure(g,D);return g.newLine(),g.write(""),qa({parent:r,insertPos:(i[u]||n).getNonWhitespaceStart(),newText:g.toString()}),jfe(r.getChildren(),p,m.length,e.expectedSyntaxKind)}var R9e=e=>Z6(ld(eG(HT(jT(zT(Ph(BE(YT(yS(X6(e))))))))))),mR=R9e(Cl),M9e=e=>Z6(ld(jT(zT(yv(Ph(yS(sc(J_(BE(sf(e))))))))))),Tme=M9e(Cl),Ew=class extends mR{addOverload(r){return this.addOverloads([r])[0]}addOverloads(r){return this.insertOverloads(this.getOverloads().length,r)}insertOverload(r,n){return this.insertOverloads(r,[n])[0]}insertOverloads(r,n){let i=this.getName(),a=this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:this.isAmbient()});return rG({node:this,index:r,structures:n,printStructure:(s,u)=>{a.printOverload(s,i,u)},getThisStructure:i7e,expectedSyntaxKind:b.SyntaxKind.FunctionDeclaration})}remove(){v7e(this)}set(r){return io(mR.prototype,this,r),r.overloads!=null&&(this.getOverloads().forEach(n=>n.remove()),this.addOverloads(r.overloads)),this}getStructure(){let r=this.isOverload(),n=this.getImplementation(),i=r&&n?Tme.prototype:mR.prototype;return uo(i,this,a(this));function a(s){if(n&&r)return u();return p();function u(){return{kind:Oe.StructureKind.FunctionOverload}}function p(){return n?{kind:Oe.StructureKind.Function,overloads:s.getOverloads().map(f=>f.getStructure())}:{kind:Oe.StructureKind.Function}}}}},w9e=e=>sc(ld(H6(jT(zT(Mh(J_(yv(sf(X6(e)))))))))),xme=w9e(sd),bw=class extends xme{},F9e=e=>bL(Rh(qT(cpe(SL(sf(hL(KE($T($6(e)))))))))),_R=F9e(Tr),Sw=class extends _R{isRestParameter(){return this.compilerNode.dotDotDotToken!=null}isParameterProperty(){return this.getScope()!=null||this.isReadonly()||this.hasOverrideKeyword()}setIsRestParameter(r){return this.isRestParameter()===r?this:(r?(nR(this),qa({insertPos:this.getNameNode().getStart(),parent:this,newText:"..."})):Bs({children:[this.getDotDotDotTokenOrThrow()]}),this)}isOptional(){return this.compilerNode.questionToken!=null||this.isRestParameter()||this.hasInitializer()}remove(){mv(this)}set(r){return io(_R.prototype,this,r),r.isRestParameter!=null&&this.setIsRestParameter(r.isRestParameter),this}getStructure(){return uo(_R.prototype,this,{kind:Oe.StructureKind.Parameter,isRestParameter:this.isRestParameter()})}setHasQuestionToken(r){return r&&nR(this),super.setHasQuestionToken(r),this}setInitializer(r){return nR(this),super.setInitializer(r),this}setType(r){return nR(this),super.setType.call(this,r),this}};function nR(e){let r=e.getParentOrThrow();n()&&i();function n(){return Tr.isArrowFunction(r)&&r.compilerNode.parameters.length===1&&e.getParentSyntaxListOrThrow().getPreviousSiblingIfKind(b.SyntaxKind.OpenParenToken)==null}function i(){let a=e.getText();qa({parent:r,insertPos:e.getStart(),newText:`(${a})`,replacing:{textLength:a.length},customMappings:s=>[{currentNode:e,newNode:s.parameters[0]}]})}}var $g=class extends Tr{remove(){let r=this.getParentOrThrow();Tr.isClassDeclaration(r)||Tr.isClassExpression(r)?_7e(this):Tr.isObjectLiteralExpression(r)?mv(this):b.errors.throwNotImplementedForSyntaxKindError(r.getKind())}},G9e=e=>Im(ld(bL(eG(HT(qT(gS(_S(Rh(VD(jT(zT(YT(UE(e)))))))))))))),gR=G9e($g),B9e=e=>sc(Im(ld(bL(_S(J_(gS(Rh(VD(jT(sf(zT(yv(e))))))))))))),Dme=B9e($g),wD=class extends gR{set(r){return io(gR.prototype,this,r),r.overloads!=null&&(this.getOverloads().forEach(n=>n.remove()),this.addOverloads(r.overloads)),this}addOverload(r){return this.addOverloads([r])[0]}addOverloads(r){return this.insertOverloads(this.getOverloads().length,r)}insertOverload(r,n){return this.insertOverloads(r,[n])[0]}insertOverloads(r,n){let i=this.getName(),a=this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:f_(this)});return rG({node:this,index:r,structures:n,printStructure:(s,u)=>{a.printOverload(s,i,u)},getThisStructure:a7e,expectedSyntaxKind:b.SyntaxKind.MethodDeclaration})}getStructure(){let r=this.getImplementation()!=null,n=this.isOverload(),i=n&&r?Dme.prototype:gR.prototype;return uo(i,this,a(this));function a(s){if(r&&n)return u();return p();function u(){return{kind:Oe.StructureKind.MethodOverload}}function p(){return r?{kind:Oe.StructureKind.Method,overloads:s.getOverloads().map(f=>f.getStructure())}:{kind:Oe.StructureKind.Method}}}}};function aq(e){return Cme(X6(ld(ope(ZH(gS(sc(J_(qT(sf(e))))))))))}function Cme(e){return class extends e{setExtends(r){if(r=this._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeExtends();let n=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);if(n!=null){let i=n.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),a=i.getStart();qa({parent:n,newText:r,insertPos:a,replacing:{textLength:i.getEnd()-a}})}else{let i=this.getHeritageClauseByKind(b.SyntaxKind.ImplementsKeyword),a;i!=null?a=i.getStart():a=this.getFirstChildByKindOrThrow(b.SyntaxKind.OpenBraceToken).getStart();let s=/\s/.test(this.getSourceFile().getFullText()[a-1]),u=`extends ${r} `;s||(u=" "+u),qa({parent:i==null?this:i.getParentSyntaxListOrThrow(),insertPos:a,newText:u})}return this}removeExtends(){let r=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);return r==null?this:(r.removeExpression(0),this)}getExtendsOrThrow(){return b.errors.throwIfNullOrUndefined(this.getExtends(),`Expected to find the extends expression for the class ${this.getName()}.`)}getExtends(){let r=this.getHeritageClauseByKind(b.SyntaxKind.ExtendsKeyword);if(r==null)return;let n=r.getTypeNodes();return n.length===0?void 0:n[0]}addMembers(r){return this.insertMembers(ad(this.getMembersWithComments()),r)}addMember(r){return this.insertMember(ad(this.getMembersWithComments()),r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){let i=f_(this);return Jfe({getIndexedChildren:()=>this.getMembersWithComments(),index:r,parent:this,write:(s,u)=>{let p=!i&&u.previousMember!=null&&Tr.isBodyable(u.previousMember)&&u.previousMember.hasBody(),f=!i&&n instanceof Array&&a(n[0]);p||u.previousMember!=null&&f?s.blankLineIfLastNot():s.newLineIfLastNot();let m=this._getWriter();this._context.structurePrinterFactory.forClassMember({isAmbient:i}).printTexts(m,n),s.write(m.toString());let D=!i&&n instanceof Array&&a(n[n.length-1]),P=!i&&u.nextMember!=null&&Tr.isBodyable(u.nextMember)&&u.nextMember.hasBody();u.nextMember!=null&&D||P?s.blankLineIfLastNot():s.newLineIfLastNot()}});function a(s){if(i||s==null||typeof s.kind!="number")return!1;let u=s;return ZA.isMethod(u)||ZA.isGetAccessor(u)||ZA.isSetAccessor(u)||ZA.isConstructor(u)}}addConstructor(r={}){return this.insertConstructor(ad(this.getMembersWithComments()),r)}addConstructors(r){return this.insertConstructors(ad(this.getMembersWithComments()),r)}insertConstructor(r,n={}){return this.insertConstructors(r,[n])[0]}insertConstructors(r,n){let i=f_(this);return ID(this,{index:r,structures:n,expectedKind:b.SyntaxKind.Constructor,write:(a,s)=>{!i&&s.previousMember!=null&&!Tr.isCommentNode(s.previousMember)?a.blankLineIfLastNot():a.newLineIfLastNot(),this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:i}).printTexts(a,n),!i&&s.nextMember!=null?a.blankLineIfLastNot():a.newLineIfLastNot()}})}getConstructors(){return this.getMembers().filter(r=>Tr.isConstructorDeclaration(r))}addStaticBlock(r={}){return this.insertStaticBlock(ad(this.getMembersWithComments()),r)}addStaticBlocks(r){return this.insertStaticBlocks(ad(this.getMembersWithComments()),r)}insertStaticBlock(r,n={}){return this.insertStaticBlocks(r,[n])[0]}insertStaticBlocks(r,n){let i=f_(this);return ID(this,{index:r,structures:n,expectedKind:b.SyntaxKind.ClassStaticBlockDeclaration,write:(a,s)=>{!i&&s.previousMember!=null&&!Tr.isCommentNode(s.previousMember)?a.blankLineIfLastNot():a.newLineIfLastNot(),this._context.structurePrinterFactory.forClassStaticBlockDeclaration().printTexts(a,n),!i&&s.nextMember!=null?a.blankLineIfLastNot():a.newLineIfLastNot()}})}getStaticBlocks(){return this.getMembers().filter(r=>Tr.isClassStaticBlockDeclaration(r))}addGetAccessor(r){return this.addGetAccessors([r])[0]}addGetAccessors(r){return this.insertGetAccessors(ad(this.getMembersWithComments()),r)}insertGetAccessor(r,n){return this.insertGetAccessors(r,[n])[0]}insertGetAccessors(r,n){return ID(this,{index:r,structures:n,expectedKind:b.SyntaxKind.GetAccessor,write:(i,a)=>{a.previousMember!=null&&!Tr.isCommentNode(a.previousMember)?i.blankLineIfLastNot():i.newLineIfLastNot(),this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:f_(this)}).printTexts(i,n),a.nextMember!=null?i.blankLineIfLastNot():i.newLineIfLastNot()}})}addSetAccessor(r){return this.addSetAccessors([r])[0]}addSetAccessors(r){return this.insertSetAccessors(ad(this.getMembersWithComments()),r)}insertSetAccessor(r,n){return this.insertSetAccessors(r,[n])[0]}insertSetAccessors(r,n){return ID(this,{index:r,structures:n,expectedKind:b.SyntaxKind.SetAccessor,write:(i,a)=>{a.previousMember!=null&&!Tr.isCommentNode(a.previousMember)?i.blankLineIfLastNot():i.newLineIfLastNot(),this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:f_(this)}).printTexts(i,n),a.nextMember!=null?i.blankLineIfLastNot():i.newLineIfLastNot()}})}addProperty(r){return this.addProperties([r])[0]}addProperties(r){return this.insertProperties(ad(this.getMembersWithComments()),r)}insertProperty(r,n){return this.insertProperties(r,[n])[0]}insertProperties(r,n){return ID(this,{index:r,structures:n,expectedKind:b.SyntaxKind.PropertyDeclaration,write:(i,a)=>{a.previousMember!=null&&Tr.hasBody(a.previousMember)?i.blankLineIfLastNot():i.newLineIfLastNot(),this._context.structurePrinterFactory.forPropertyDeclaration().printTexts(i,n),a.nextMember!=null&&Tr.hasBody(a.nextMember)?i.blankLineIfLastNot():i.newLineIfLastNot()}})}addMethod(r){return this.addMethods([r])[0]}addMethods(r){return this.insertMethods(ad(this.getMembersWithComments()),r)}insertMethod(r,n){return this.insertMethods(r,[n])[0]}insertMethods(r,n){let i=f_(this);return n=n.map(a=>({...a})),ID(this,{index:r,write:(a,s)=>{!i&&s.previousMember!=null&&!Tr.isCommentNode(s.previousMember)?a.blankLineIfLastNot():a.newLineIfLastNot(),this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:i}).printTexts(a,n),!i&&s.nextMember!=null?a.blankLineIfLastNot():a.newLineIfLastNot()},structures:n,expectedKind:b.SyntaxKind.MethodDeclaration})}getInstanceProperty(r){return ic(this.getInstanceProperties(),r)}getInstancePropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInstanceProperty(r),()=>Ou("class instance property",r))}getInstanceProperties(){return this.getInstanceMembers().filter(r=>Efe(r))}getStaticProperty(r){return ic(this.getStaticProperties(),r)}getStaticPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStaticProperty(r),()=>Ou("class static property",r))}getStaticProperties(){return this.getStaticMembers().filter(r=>Efe(r))}getProperty(r){return ic(this.getProperties(),r)}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("class property declaration",r))}getProperties(){return this.getMembers().filter(r=>Tr.isPropertyDeclaration(r))}getGetAccessor(r){return ic(this.getGetAccessors(),r)}getGetAccessorOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getGetAccessor(r),()=>Ou("class getAccessor declaration",r))}getGetAccessors(){return this.getMembers().filter(r=>Tr.isGetAccessorDeclaration(r))}getSetAccessor(r){return ic(this.getSetAccessors(),r)}getSetAccessorOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getSetAccessor(r),()=>Ou("class setAccessor declaration",r))}getSetAccessors(){return this.getMembers().filter(r=>Tr.isSetAccessorDeclaration(r))}getMethod(r){return ic(this.getMethods(),r)}getMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMethod(r),()=>Ou("class method declaration",r))}getMethods(){return this.getMembers().filter(r=>Tr.isMethodDeclaration(r))}getInstanceMethod(r){return ic(this.getInstanceMethods(),r)}getInstanceMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInstanceMethod(r),()=>Ou("class instance method",r))}getInstanceMethods(){return this.getInstanceMembers().filter(r=>r instanceof wD)}getStaticMethod(r){return ic(this.getStaticMethods(),r)}getStaticMethodOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStaticMethod(r),()=>Ou("class static method",r))}getStaticMethods(){return this.getStaticMembers().filter(r=>r instanceof wD)}getInstanceMember(r){return ic(this.getInstanceMembers(),r)}getInstanceMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getInstanceMember(r),()=>Ou("class instance member",r))}getInstanceMembers(){return this.getMembersWithParameterProperties().filter(r=>Tr.isConstructorDeclaration(r)?!1:Tr.isParameterDeclaration(r)||!r.isStatic())}getStaticMember(r){return ic(this.getStaticMembers(),r)}getStaticMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getStaticMember(r),()=>Ou("class static member",r))}getStaticMembers(){return this.getMembers().filter(r=>Tr.isConstructorDeclaration(r)?!1:!Tr.isParameterDeclaration(r)&&r.isStatic())}getMembersWithParameterProperties(){let r=this.getMembers(),n=r.filter(i=>Tr.isConstructorDeclaration(i)&&i.isImplementation());for(let i of n){let a=r.indexOf(i)+1;for(let s of i.getParameters())s.isParameterProperty()&&(r.splice(a,0,s),a++)}return r}getMembers(){return vfe(this,this.compilerNode.members).filter(r=>bfe(r))}getMembersWithComments(){let r=this.compilerNode,n=od.getContainerArray(r,this.getSourceFile().compilerNode);return vfe(this,n).filter(i=>bfe(i)||Tr.isCommentClassElement(i))}getMember(r){return ic(this.getMembers(),r)}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),()=>Ou("class member",r))}getBaseTypes(){return this.getType().getBaseTypes()}getBaseClassOrThrow(){return b.errors.throwIfNullOrUndefined(this.getBaseClass(),`Expected to find the base class of ${this.getName()}.`)}getBaseClass(){let n=b.ArrayUtils.flatten(this.getBaseTypes().map(i=>i.isIntersection()?i.getIntersectionTypes():[i])).map(i=>i.getSymbol()).filter(i=>i!=null).map(i=>i.getDeclarations()).reduce((i,a)=>i.concat(a),[]).filter(i=>i.getKind()===b.SyntaxKind.ClassDeclaration);if(n.length===1)return n[0]}getDerivedClasses(){let r=hfe(this);for(let n=0;n<r.length;n++){let i=hfe(r[n]);for(let a of i)a!==this&&r.indexOf(a)===-1&&r.push(a)}return r}}}function vfe(e,r){let n=f_(e),i=r.map(a=>e._getNodeFromCompilerNode(a));return n?i:i.filter(a=>!(Tr.isConstructorDeclaration(a)||Tr.isMethodDeclaration(a))||Tr.isMethodDeclaration(a)&&a.isAbstract()?!0:a.isImplementation())}function hfe(e){let r=[],n=e.getNameNode();if(n==null)return r;for(let i of n.findReferencesAsNodes()){let a=i.getParentIfKind(b.SyntaxKind.ExpressionWithTypeArguments);if(a==null)continue;let s=a.getParentIfKind(b.SyntaxKind.HeritageClause);if(s==null||s.getToken()!==b.SyntaxKind.ExtendsKeyword)continue;let u=s.getParentIfKind(b.SyntaxKind.ClassDeclaration);u!=null&&r.push(u)}return r}function Efe(e){return Tr.isPropertyDeclaration(e)||Tr.isSetAccessorDeclaration(e)||Tr.isGetAccessorDeclaration(e)||Tr.isParameterDeclaration(e)}function bfe(e){return Tr.isMethodDeclaration(e)||Tr.isPropertyDeclaration(e)||Tr.isGetAccessorDeclaration(e)||Tr.isSetAccessorDeclaration(e)||Tr.isConstructorDeclaration(e)||Tr.isClassStaticBlockDeclaration(e)}function ID(e,r){return JH({getIndexedChildren:()=>e.getMembersWithComments(),parent:e,...r})}var U9e=e=>yS(Ph(BE(aq(e)))),yR=U9e(Cl),Tw=class extends yR{set(r){return io(yR.prototype,this,r),r.extends!=null?this.setExtends(r.extends):r.hasOwnProperty(b.nameof(r,"extends"))&&this.removeExtends(),r.ctors!=null&&(this.getConstructors().forEach(n=>n.remove()),this.addConstructors(r.ctors)),r.properties!=null&&(this.getProperties().forEach(n=>n.remove()),this.addProperties(r.properties)),r.getAccessors!=null&&(this.getGetAccessors().forEach(n=>n.remove()),this.addGetAccessors(r.getAccessors)),r.setAccessors!=null&&(this.getSetAccessors().forEach(n=>n.remove()),this.addSetAccessors(r.setAccessors)),r.methods!=null&&(this.getMethods().forEach(n=>n.remove()),this.addMethods(r.methods)),this}getStructure(){let r=this.getExtends(),n=this.isAmbient();return uo(yR.prototype,this,{kind:Oe.StructureKind.Class,ctors:this.getConstructors().filter(i=>n||!i.isOverload()).map(i=>i.getStructure()),methods:this.getMethods().filter(i=>n||!i.isOverload()).map(i=>i.getStructure()),properties:this.getProperties().map(i=>i.getStructure()),extends:r?r.getText():void 0,getAccessors:this.getGetAccessors().map(i=>i.getStructure()),setAccessors:this.getSetAccessors().map(i=>i.getStructure())})}extractInterface(r){let{constructors:n,properties:i,methods:a,accessors:s}=Sfe(this,!1),u=b.ArrayUtils.flatten(n.map(p=>p.getParameters().filter(f=>f.isParameterProperty()))).filter(p=>p.getName()!=null&&p.getScope()===Oe.Scope.Public);return{kind:Oe.StructureKind.Interface,name:Tfe(r,this),docs:this.getJsDocs().map(p=>p.getStructure()),typeParameters:this.getTypeParameters().map(p=>p.getStructure()),properties:[...u.map(p=>{let f=b.ArrayUtils.flatten(p.getParentOrThrow().getJsDocs().map(m=>m.getTags())).filter(Tr.isJSDocParameterTag).filter(m=>m.getTagName()==="param"&&m.getName()===p.getName()&&m.getComment()!=null).map(m=>m.getCommentText().trim())[0];return{kind:Oe.StructureKind.PropertySignature,docs:f==null?[]:[{kind:Oe.StructureKind.JSDoc,description:f}],name:p.getName(),type:p.getType().getText(p),hasQuestionToken:p.hasQuestionToken(),isReadonly:p.isReadonly()}}),...i.map(xfe),...s.map(Dfe)],methods:a.map(Cfe)}}extractStaticInterface(r){let{constructors:n,properties:i,methods:a,accessors:s}=Sfe(this,!0),u=Tfe(void 0,this);return{kind:Oe.StructureKind.Interface,name:r,properties:[...i.map(xfe),...s.map(Dfe)],methods:a.map(Cfe),constructSignatures:n.map(p=>({kind:Oe.StructureKind.ConstructSignature,docs:p.getJsDocs().map(f=>f.getStructure()),parameters:p.getParameters().map(f=>({...Ame(f),scope:void 0,isReadonly:!1})),returnType:u}))}}};function Sfe(e,r){let n=b.ArrayUtils.flatten(e.getConstructors().map(u=>u.getOverloads().length>0?u.getOverloads():[u])),i=e.getProperties().filter(u=>u.isStatic()===r&&u.getScope()===Oe.Scope.Public),a=b.ArrayUtils.flatten(e.getMethods().filter(u=>u.isStatic()===r&&u.getScope()===Oe.Scope.Public).map(u=>u.getOverloads().length>0?u.getOverloads():[u]));return{constructors:n,properties:i,methods:a,accessors:s()};function s(){let u=new b.KeyValueCache;for(let p of[...e.getGetAccessors(),...e.getSetAccessors()])p.isStatic()===r&&p.getScope()===Oe.Scope.Public&&u.getOrCreate(p.getName(),()=>[]).push(p);return u.getValuesAsArray()}}function Tfe(e,r){return e=b.StringUtils.isNullOrWhitespace(e)?void 0:e,e||r.getName()||r.getSourceFile().getBaseNameWithoutExtension().replace(/[^a-zA-Z0-9_$]/g,"")}function xfe(e){return{kind:Oe.StructureKind.PropertySignature,docs:e.getJsDocs().map(r=>r.getStructure()),name:e.getName(),type:e.getType().getText(e),hasQuestionToken:e.hasQuestionToken(),isReadonly:e.isReadonly()}}function Dfe(e){return{kind:Oe.StructureKind.PropertySignature,docs:e[0].getJsDocs().map(r=>r.getStructure()),name:e[0].getName(),type:e[0].getType().getText(e[0]),hasQuestionToken:!1,isReadonly:e.every(Tr.isGetAccessorDeclaration)}}function Cfe(e){return{kind:Oe.StructureKind.MethodSignature,docs:e.getJsDocs().map(r=>r.getStructure()),name:e.getName(),hasQuestionToken:e.hasQuestionToken(),returnType:e.getReturnType().getText(e),parameters:e.getParameters().map(Ame),typeParameters:e.getTypeParameters().map(r=>r.getStructure())}}function Ame(e){return{...e.getStructure(),decorators:[]}}var Lme=aq(sd),xw=class extends Lme{},K9e=e=>Im(ld(Mh(sc(H6(e))))),vR=K9e($g),Dw=class extends vR{getName(){return"static"}isStatic(){return!0}set(r){return io(vR.prototype,this,r),this}getStructure(){return uo(vR.prototype,this,{kind:Oe.StructureKind.ClassStaticBlock})}},Cw=class extends $g{},W9e=e=>kh(Im(ld(eG(_S(YT(HT(e))))))),hR=W9e($g),V9e=e=>J_(sc(Im(ld(_S(sf(yv(e))))))),Nme=V9e($g),Aw=class extends hR{set(r){return io(hR.prototype,this,r),r.overloads!=null&&(this.getOverloads().forEach(n=>n.remove()),this.addOverloads(r.overloads)),this}addOverload(r){return this.addOverloads([r])[0]}addOverloads(r){return this.insertOverloads(this.getOverloads().length,r)}insertOverload(r,n){return this.insertOverloads(r,[n])[0]}insertOverloads(r,n){let i=this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:f_(this)});return rG({node:this,index:r,structures:n,printStructure:(a,s)=>{i.printOverload(a,s)},getThisStructure:n7e,expectedSyntaxKind:b.SyntaxKind.Constructor})}getStructure(){let r=this.getImplementation()!=null,n=this.isOverload(),i=n&&r?Nme.prototype:hR.prototype;return uo(i,this,a(this));function a(s){if(r&&n)return u();return p();function u(){return{kind:Oe.StructureKind.ConstructorOverload}}function p(){return r?{kind:Oe.StructureKind.Constructor,overloads:s.getOverloads().map(f=>f.getStructure())}:{kind:Oe.StructureKind.Constructor}}}}},j9e=e=>Im(ld(qT(gS(_S(VD(YT(HT(UE(e))))))))),ER=j9e($g),Lw=class extends ER{set(r){return io(ER.prototype,this,r),this}getSetAccessor(){let r=this.getName(),n=this.isStatic();return this.getParentOrThrow().forEachChild(i=>{if(Tr.isSetAccessorDeclaration(i)&&i.getName()===r&&i.isStatic()===n)return i})}getSetAccessorOrThrow(){return b.errors.throwIfNullOrUndefined(this.getSetAccessor(),()=>`Expected to find a corresponding set accessor for ${this.getName()}.`)}getStructure(){return uo(ER.prototype,this,{kind:Oe.StructureKind.GetAccessor})}},H9e=e=>Im(bL(Ph(qT(gS(_S(VD(sc(SL(XH(Rh($T(KE(UE(sf(e))))))))))))))),bR=H9e($g),Nw=class extends bR{set(r){return io(bR.prototype,this,r),this}remove(){let r=this.getParentOrThrow();switch(r.getKind()){case b.SyntaxKind.ClassDeclaration:super.remove();break;default:throw new b.errors.NotImplementedError(`Not implemented parent syntax kind: ${r.getKindName()}`)}}getStructure(){return uo(bR.prototype,this,{kind:Oe.StructureKind.Property})}},q9e=e=>Im(ld(qT(gS(_S(VD(YT(HT(UE(e))))))))),SR=q9e($g),Iw=class extends SR{set(r){return io(SR.prototype,this,r),this}getGetAccessor(){let r=this.getName(),n=this.isStatic();return this.getParentOrThrow().forEachChild(i=>{if(Tr.isGetAccessorDeclaration(i)&&i.getName()===r&&i.isStatic()===n)return i})}getGetAccessorOrThrow(){return b.errors.throwIfNullOrUndefined(this.getGetAccessor(),()=>`Expected to find a corresponding get accessor for ${this.getName()}.`)}getStructure(){return uo(SR.prototype,this,{kind:Oe.StructureKind.SetAccessor})}},TR=XT(Tr),Pw=class extends TR{getName(){return this.getNameNode().getText()}getNameNode(){let r=this.getCallExpression();if(r)return n(r.getExpression());return n(this._getInnerExpression());function n(a){let s=i(a);if(!Tr.isIdentifier(s))throw new b.errors.NotImplementedError(`Expected the decorator expression '${s.getText()}' to be an identifier. Please deal directly with 'getExpression()' on the decorator to handle more complex scenarios.`);return s}function i(a){return Tr.isPropertyAccessExpression(a)?a.getNameNode():a}}getFullName(){let r=this.getSourceFile();return this.isDecoratorFactory()?this.getCallExpression().getExpression().getText():this.compilerNode.expression.getText(r.compilerNode)}isDecoratorFactory(){return Tr.isCallExpression(this._getInnerExpression())}setIsDecoratorFactory(r){if(this.isDecoratorFactory()===r)return this;if(r){let n=this._getInnerExpression(),i=n.getText();qa({parent:this,insertPos:n.getStart(),newText:`${i}()`,replacing:{textLength:i.length},customMappings:a=>[{currentNode:n,newNode:a.expression.expression}]})}else{let n=this.getCallExpressionOrThrow(),i=n.getExpression(),a=i.getText();qa({parent:this,insertPos:n.getStart(),newText:`${a}`,replacing:{textLength:n.getWidth()},customMappings:s=>[{currentNode:i,newNode:s.expression}]})}return this}getCallExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getCallExpression(),"Expected to find a call expression.")}getCallExpression(){let r=this._getInnerExpression();return Tr.isCallExpression(r)?r:void 0}getArguments(){var r,n;return(n=(r=this.getCallExpression())===null||r===void 0?void 0:r.getArguments())!==null&&n!==void 0?n:[]}getTypeArguments(){var r,n;return(n=(r=this.getCallExpression())===null||r===void 0?void 0:r.getTypeArguments())!==null&&n!==void 0?n:[]}addTypeArgument(r){return this.getCallExpressionOrThrow().addTypeArgument(r)}addTypeArguments(r){return this.getCallExpressionOrThrow().addTypeArguments(r)}insertTypeArgument(r,n){return this.getCallExpressionOrThrow().insertTypeArgument(r,n)}insertTypeArguments(r,n){return this.getCallExpressionOrThrow().insertTypeArguments(r,n)}removeTypeArgument(r){let n=this.getCallExpression();if(n==null)throw new b.errors.InvalidOperationError("Cannot remove a type argument from a decorator that has no type arguments.");return n.removeTypeArgument(r),this}addArgument(r){return this.addArguments([r])[0]}addArguments(r){return this.insertArguments(this.getArguments().length,r)}insertArgument(r,n){return this.insertArguments(r,[n])[0]}insertArguments(r,n){return this.setIsDecoratorFactory(!0),this.getCallExpressionOrThrow().insertArguments(r,n)}removeArgument(r){let n=this.getCallExpression();if(n==null)throw new b.errors.InvalidOperationError("Cannot remove an argument from a decorator that has no arguments.");return n.removeArgument(r),this}remove(){let r=this.getStartLinePos(),n=this.getPreviousSiblingIfKind(b.SyntaxKind.Decorator);n!=null&&n.getStartLinePos()===r?Bs({children:[this],removePrecedingSpaces:!0}):m7e({children:[this],getSiblingFormatting:(i,a)=>a.getStartLinePos()===r?El.Space:El.Newline})}_getInnerExpression(){let r=this.getExpression();for(;Tr.isParenthesizedExpression(r);)r=r.getExpression();return r}set(r){return io(TR.prototype,this,r),r.name!=null&&this.getNameNode().replaceWithText(r.name),r.arguments!=null&&(this.setIsDecoratorFactory(!0),this.getArguments().map(n=>this.removeArgument(n)),this.addArguments(r.arguments)),r.typeArguments!=null&&r.typeArguments.length>0&&(this.setIsDecoratorFactory(!0),this.getTypeArguments().map(n=>this.removeTypeArgument(n)),this.addTypeArguments(r.typeArguments)),this}getStructure(){let r=this.isDecoratorFactory();return uo(TR.prototype,this,{kind:Oe.StructureKind.Decorator,name:this.getName(),arguments:r?this.getArguments().map(n=>n.getText()):void 0,typeArguments:r?this.getTypeArguments().map(n=>n.getText()):void 0})}};function oq(e){return class extends e{getTypeExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}getTypeExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeExpression(),"Expected to find a JS doc type expression.")}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}isBracketed(){return this.compilerNode.isBracketed}}}function tG(e){return class extends e{getTypeExpression(){let r=this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression);if(!(r!=null&&r.getWidth()===0))return r}getTypeExpressionOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeExpression(),"Expected to find the JS doc tag's type expression.")}}}function Ime(e){return class extends e{getTypeParameters(){return this.compilerNode.typeParameters.map(r=>this._getNodeFromCompilerNode(r)).filter(r=>r.getWidth()>0)}}}function MH(e){return e.replace(/^\/\*\*[^\S\n]*\n?/,"").replace(/(\r?\n)?[^\S\n]*\*\/$/,"").split(/\n/).map(i=>{let a=n(i);if(a===-1)return i;let s=i[a+1]===" "?a+2:a+1;return i.substring(s)}).join(`
4251
4251
  `);function n(i){for(let a=0;a<i.length;a++){let s=i.charCodeAt(a);if(s===ac.ASTERISK)return a;if(!b.StringUtils.isWhitespaceCharCode(s))break}return-1}}var xR=Tr,Ow=class extends xR{isMultiLine(){return this.getText().includes(`
4252
- `)}getTags(){var r,n;return(n=(r=this.compilerNode.tags)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getInnerText(){return MH(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){var r,n;let i=this.getSourceFile().getFullText(),a=(n=(r=this.getTags()[0])===null||r===void 0?void 0:r.getStart())!==null&&n!==void 0?n:this.getEnd()-2,s=u(this);return MH(i.substring(s,Math.max(s,p())));function u(f){let m=f.getStart()+3;return i.charCodeAt(m)===ac.SPACE?m+1:m}function p(){let f=dv(i,a,m=>m===ac.NEWLINE||!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK);return dv(i,f,m=>m!==ac.NEWLINE&&m!==ac.CARRIAGE_RETURN)}}setDescription(r){let n=this.getTags(),i=this.getStart()+3,a=n.length>0?dv(this._sourceFile.getFullText(),n[0].getStart(),u=>u===ac.ASTERISK)-1:this.getEnd()-2;return S7e({parent:this,newText:s.call(this),replacePos:i,replacingLength:a-i}),this;function s(){var u,p;let f=this.getIndentationText(),m=this._context.manipulationSettings.getNewLineKindAsString(),g=Xg(this._getWriter(),r).split(/\r?\n/),D=g[0].length===0,P=g.length===1&&((p=(u=this.compilerNode.tags)===null||u===void 0?void 0:u.length)!==null&&p!==void 0?p:0)===0,B=P?g[0]:g.map(K=>K.length===0?`${f} *`:`${f} * ${K}`).slice(D?1:0).join(m);return P?" "+B+" ":m+B+m+f+" "}}addTag(r){return this.addTags([r])[0]}addTags(r){var n,i;return this.insertTags((i=(n=this.compilerNode.tags)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,r)}insertTag(r,n){return this.insertTags(r,[n])[0]}insertTags(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this._getWriterWithQueuedIndentation(),a=this.getTags();if(r=ku(r,a.length),a.length===0&&!this.isMultiLine()){let p=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(f=>{p.printText(f,{description:this.getDescription(),tags:n})})}else{let p=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});i.newLine().write(" * "),p.printTexts(i,n),i.newLine().write(" *"),i.conditionalWrite(r<a.length," ");let f=s.call(this),m=u.call(this);qa({parent:this,insertPos:f,replacing:{textLength:m-f},newText:i.toString()})}return af(a,this.getTags(),r,!1);function s(){let p=r<a.length?a[r].getStart():this.getEnd()-2,f=this.getStart()+3;return Math.max(f,dv(this.getSourceFile().getFullText(),p,m=>!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK))}function u(){return r<a.length?a[r].getStart():this.getEnd()-1}}remove(){Bs({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(r){return io(xR.prototype,this,r),r.tags!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDoc().printText(n,{description:(i=r.description)!==null&&i!==void 0?i:this.getDescription(),tags:r.tags})}):(r.description!=null&&this.setDescription(r.description),this)}getStructure(){return uo(xR.prototype,this,{kind:Oe.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(r=>r.getStructure())})}},wc=class extends Tr{},Pme=Q6(wc),KT=class extends Pme{},kw=class extends wc{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},Rw=class extends wc{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)}},Ome=yv(wc),sL=class extends Ome{},kme=gS(sf(sL)),Mw=class extends kme{},Rme=XT(KT),ww=class extends Rme{},Mme=J_(sL),Fw=class extends Mme{},Gw=class extends Tr{getAssertClause(){return this._getNodeFromCompilerNode(this.compilerNode.assertClause)}isMultiline(){var r;return(r=this.compilerNode.multiLine)!==null&&r!==void 0?r:!1}},Bw=class extends KT{setArgument(r){let n=this.getArgument();if(Tr.isLiteralTypeNode(n)){let i=n.getLiteral();if(Tr.isStringLiteral(i))return i.setLiteralValue(r),this}return n.replaceWithText(i=>i.quote(r),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(r){let n=this.getQualifier();if(n!=null)n.replaceWithText(r,this._getWriterWithQueuedChildIndentation());else{let i=this.getFirstChildByKindOrThrow(b.SyntaxKind.CloseParenToken);qa({insertPos:i.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(r).toString()})}return this}getQualifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQualifier(),()=>`Expected to find a qualifier for the import type: ${this.getText()}`)}getQualifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.qualifier)}getAssertions(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions)}getAssertionsOrThrow(){return b.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions),"Could not find import type assertion container.")}},Uw=class extends wc{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Kw=class extends wc{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Ww=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},Vw=class extends wc{getLiteral(){let r=this.compilerNode.literal;return this._getNodeFromCompilerNode(r)}},jw=class extends wc{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNameTypeNode(),"Type did not exist.")}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReadonlyToken(),"Readonly token did not exist.")}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionToken(),"Question token did not exist.")}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Type did not exist, but was expected to exist.")}},J9e=e=>KE(Rh(hL(sc(gv(e))))),wme=J9e(wc),Hw=class extends wme{getTypeNode(){return super.getTypeNode()}removeType(){throw new b.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},qw=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(r){return this.getTypeNode().replaceWithText(r),this}},Jw=class extends wc{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},zw=class extends wc{},$w=class extends wc{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},z9e=e=>J_(KE(sc(Ph(BE(sf(gv(e))))))),DR=z9e(Cl),Xw=class extends DR{set(r){return io(DR.prototype,this,r),this}getStructure(){return uo(DR.prototype,this,{kind:Oe.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},Fme=nq(wc),Yw=class extends Fme{},Qw=class extends wc{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};Oe.TypeParameterVariance=void 0;(function(e){e[e.None=0]="None",e[e.In=1]="In",e[e.Out=2]="Out",e[e.InOut=3]="InOut"})(Oe.TypeParameterVariance||(Oe.TypeParameterVariance={}));var CR=sf(gv(Tr)),Zw=class extends CR{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the type parameter's constraint.")}setConstraint(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeConstraint(),this;let n=this.getConstraint();if(n!=null)return n.replaceWithText(r),this;let i=this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` extends ${r}`}),this}removeConstraint(){return Afe(this.getConstraint(),b.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find the type parameter's default.")}setDefault(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeDefault(),this;let n=this.getDefault();if(n!=null)return n.replaceWithText(r),this;let i=this.getConstraint()||this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` = ${r}`}),this}removeDefault(){return Afe(this.getDefault(),b.SyntaxKind.EqualsToken),this}setVariance(r){return this.toggleModifier("in",(r&Oe.TypeParameterVariance.In)!==0),this.toggleModifier("out",(r&Oe.TypeParameterVariance.Out)!==0),this}getVariance(){let r=Oe.TypeParameterVariance.None;return this.hasModifier("in")&&(r|=Oe.TypeParameterVariance.In),this.hasModifier("out")&&(r|=Oe.TypeParameterVariance.Out),r}remove(){let r=this.getParentSyntaxListOrThrow();r.getChildrenOfKind(b.SyntaxKind.TypeParameter).length===1?i():mv(this);function i(){let a=[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)];Bs({children:a})}}set(r){return io(CR.prototype,this,r),r.constraint!=null?this.setConstraint(r.constraint):r.hasOwnProperty(b.nameof(r,"constraint"))&&this.removeConstraint(),r.default!=null?this.setDefault(r.default):r.hasOwnProperty(b.nameof(r,"default"))&&this.removeDefault(),r.variance!=null&&this.setVariance(r.variance),this}getStructure(){let r=this.getConstraint(),n=this.getDefault();return uo(CR.prototype,this,{kind:Oe.StructureKind.TypeParameter,constraint:r?.getText({trimLeadingIndentation:!0}),default:n?n.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function Afe(e,r){e!=null&&Bs({children:[e.getPreviousSiblingIfKindOrThrow(r),e],removePrecedingSpaces:!0})}var eF=class extends wc{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAssertsModifier(),"Expected to find an asserts modifier.")}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Expected to find a type node.")}},rF=class extends KT{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},tF=class extends KT{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},nF=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},q_=class extends wc{},iF=class extends q_{},AR=Tr,bc=class extends AR{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(r){return this.set({tagName:r})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let r=this.getParentOrThrow().getStart()+3,n=Ume(this),i=n==null,a=s.call(this);Bs({children:[this],customRemovalPos:a,customRemovalEnd:Bme(this,n),replaceTrivia:u.call(this)});function s(){return Math.max(r,Kme(this,this.getStart()))}function u(){if(a===r&&i)return"";let p=this._context.manipulationSettings.getNewLineKindAsString(),f=this.getParentOrThrow().getIndentationText();return`${p}${f} `+(i?"":"* ")}}set(r){return io(AR.prototype,this,r),r.text!=null||r.tagName!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(n,{tagName:(i=r.tagName)!==null&&i!==void 0?i:this.getTagName(),text:r.text!=null?r.text:Lfe(this)})}):this}replaceWithText(r){let n=Xg(this._getWriterWithQueuedIndentation(),r),i=this.getParentOrThrow(),a=this.getChildIndex(),s=this.getStart();return qa({parent:i,insertPos:s,newText:n,replacing:{textLength:Gme(this)-s}}),i.getChildren()[a]}getStructure(){let r=Lfe(this);return uo(AR.prototype,this,{kind:Oe.StructureKind.JSDocTag,tagName:this.getTagName(),text:r.length===0?void 0:r})}};function Lfe(e){let r=e.getSourceFile().getFullText(),n=e.getTagNameNode().getEnd(),i=Gme(e),a=Math.min(r.charCodeAt(n)===ac.SPACE?n+1:n,i);return MH(r.substring(a,i))}function Gme(e){return Kme(e,Bme(e))}function Bme(e,r){return r=r??Ume(e),r!=null?r.getStart():e.getParentOrThrow().getEnd()-2}function Ume(e){let n=e.getParentIfKindOrThrow(b.SyntaxKind.JSDoc).getTags(),i=n.indexOf(e);return n[i+1]}function Kme(e,r){let n=e.getSourceFile().getFullText();return dv(n,r,i=>i!==ac.ASTERISK&&!b.StringUtils.isWhitespaceCharCode(i))}var aF=class extends bc{},oF=class extends bc{},sF=class extends bc{},lF=class extends bc{},uF=class extends bc{},cF=class extends bc{},Wme=yv(q_),dF=class extends Wme{},fF=class extends bc{},pF=class extends Tr{},mF=class extends Tr{},_F=class extends Tr{},gF=class extends Tr{},yF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},vF=class extends Tr{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},hF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},EF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},bF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},SF=class extends bc{},Vme=oq(bc),TF=class extends Vme{},xF=class extends bc{},jme=oq(bc),DF=class extends jme{},CF=class extends bc{},AF=class extends bc{},LF=class extends bc{},Hme=tG(bc),NF=class extends Hme{},qme=tG(bc),IF=class extends qme{},PF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},lL=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getName(){return this.compilerObject.name}getText(){var r;return(r=this.compilerObject.text)!==null&&r!==void 0?r:[]}},Jme=Ime(bc),OF=class extends Jme{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the JS doc template tag's constraint.")}},kF=class extends Tr{},zme=tG(bc),RF=class extends zme{},MF=class extends bc{},wF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},FF=class extends q_{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(r=>this._getNodeFromCompilerNode(r)):void 0}},GF=class extends bc{getTypeExpression(){let r=this.compilerNode.typeExpression;if(!(r!=null&&r.pos===r.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},BF=class extends bc{},UF=class extends q_{},KF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},WF=class extends Tr{remove(){Nh({children:[this],getSiblingFormatting:()=>El.Newline})}},$9e=e=>ld(yS(sc(Ph(BE(sf(gv(e))))))),LR=$9e(Cl),VF=class extends LR{set(r){return io(LR.prototype,this,r),r.isConst!=null&&this.setIsConstEnum(r.isConst),r.members!=null&&(this.getMembers().forEach(n=>n.remove()),this.addMembers(r.members)),this}addMember(r){return this.addMembers([r])[0]}addMembers(r){return this.insertMembers(this.getMembers().length,r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){if(n.length===0)return[];let i=this.getMembersWithComments();r=ku(r,i.length);let a=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(a,n),j_({parent:this.getChildSyntaxListOrThrow(),currentNodes:i,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(i,this.getMembersWithComments(),r,!u());function u(){return n instanceof Array?n.every(p=>typeof p=="object"):!1}}getMember(r){return ic(this.getMembers(),r)}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),()=>Ou("enum member",r))}getMembers(){return this.compilerNode.members.map(r=>this._getNodeFromCompilerNode(r))}getMembersWithComments(){let r=this.compilerNode;return od.getContainerArray(r,this.getSourceFile().compilerNode).map(n=>this._getNodeFromCompilerNode(n))}setIsConstEnum(r){return this.toggleModifier("const",r)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.ConstKeyword)}getStructure(){return uo(LR.prototype,this,{kind:Oe.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(r=>r.getStructure())})}},X9e=e=>sc($T(UE(e))),NR=X9e(Tr),jF=class extends NR{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(r){let n;if(typeof r=="string"){let i=this._context.manipulationSettings.getQuoteKind();n=i+b.StringUtils.escapeForWithinString(r,i)+i}else n=r.toString();return this.setInitializer(n),this}remove(){let r=[this],n=this.getNextSiblingIfKind(b.SyntaxKind.CommaToken);n!=null&&r.push(n),Nh({children:r,getSiblingFormatting:()=>El.Newline})}set(r){return io(NR.prototype,this,r),r.value!=null?this.setValue(r.value):r.hasOwnProperty(b.nameof(r,"value"))&&r.initializer==null&&this.removeInitializer(),this}getStructure(){return uo(NR.prototype,this,{kind:Oe.StructureKind.EnumMember,value:void 0})}},HF=class extends Tr{getTypeNodes(){var r,n;return(n=(r=this.compilerNode.types)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getToken(){return this.compilerNode.token}removeExpression(r){let n=this.getTypeNodes(),i=typeof r=="number"?a(r):r;if(n.length===1){let s=this.getParentSyntaxListOrThrow().getChildren();s.length===1?Bs({children:[s[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):Bs({children:[this],removePrecedingSpaces:!0})}else mv(i);return this;function a(s){return n[ku(s,n.length-1)]}}},wE=class extends Tr{remove(){g7e(this)}},Y9e=e=>J_(Im(sc(yv(e)))),IR=Y9e(wE),qF=class extends IR{set(r){return io(IR.prototype,this,r),this}getStructure(){return uo(IR.prototype,this,{kind:Oe.StructureKind.CallSignature})}},JF=class extends wE{},Q9e=e=>J_(Im(sc(yv(e)))),PR=Q9e(wE),zF=class extends PR{set(r){return io(PR.prototype,this,r),this}getStructure(){return uo(PR.prototype,this,{kind:Oe.StructureKind.ConstructSignature})}},Z9e=e=>rq(Im(sc(SL(sf(e))))),OR=Z9e(wE),$F=class extends OR{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(r){b.errors.throwIfWhitespaceOrNotString(r,"name"),this.getKeyName()!==r&&this.getKeyNameNode().replaceWithText(r,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(r){b.errors.throwIfWhitespaceOrNotString(r,"type");let n=this.getKeyTypeNode();return n.getText()===r?this:(n.replaceWithText(r,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.type)}set(r){return io(OR.prototype,this,r),r.keyName!=null&&this.setKeyName(r.keyName),r.keyType!=null&&this.setKeyType(r.keyType),this}getStructure(){let r=this.getKeyTypeNode();return uo(OR.prototype,this,{kind:Oe.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:r.getText()})}},eUe=e=>nq(ld(ape(ZH(J_(sc(Ph(yS(BE(sf(gv(e))))))))))),kR=eUe(Cl),XF=class extends kR{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return b.ArrayUtils.flatten(this.getType().getBaseTypes().map(r=>{var n,i;return(i=(n=r.getSymbol())===null||n===void 0?void 0:n.getDeclarations())!==null&&i!==void 0?i:[]}))}getImplementations(){return this.getNameNode().getImplementations()}set(r){return io(kR.prototype,this,r),this}getStructure(){return uo(kR.prototype,this,{kind:Oe.StructureKind.Interface})}},rUe=e=>Im(sc(Rh(J_(yv(UE(e)))))),RR=rUe(wE),YF=class extends RR{set(r){return io(RR.prototype,this,r),this}getStructure(){return uo(RR.prototype,this,{kind:Oe.StructureKind.MethodSignature})}},tUe=e=>Im(sc(SL(Rh($T(KE(UE(sf(e)))))))),MR=tUe(wE),QF=class extends MR{set(r){return io(MR.prototype,this,r),this}getStructure(){return uo(MR.prototype,this,{kind:Oe.StructureKind.PropertySignature})}};function sq(e){return class extends e{getAttributes(){return this.compilerNode.attributes.properties.map(r=>this._getNodeFromCompilerNode(r))}getAttributeOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAttribute(r),()=>Ou("attribute",r))}getAttribute(r){return ic(this.getAttributes(),r)}addAttribute(r){return this.addAttributes([r])[0]}addAttributes(r){return this.insertAttributes(this.compilerNode.attributes.properties.length,r)}insertAttribute(r,n){return this.insertAttributes(r,[n])[0]}insertAttributes(r,n){if(n.length===0)return[];let i=this.compilerNode.attributes.properties.length;r=ku(r,i);let a=r===0?this.getTagNameNode().getEnd():this.getAttributes()[r-1].getEnd(),s=this._getWriterWithQueuedChildIndentation();return new wj(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(s,n),qa({insertPos:a,newText:" "+s.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList)}),af(i,this.getAttributes(),r,!1)}set(r){return io(e.prototype,this,r),r.attributes!=null&&(this.getAttributes().forEach(n=>n.remove()),this.addAttributes(r.attributes)),this}getStructure(){return uo(e.prototype,this,{attributes:this.getAttributes().map(r=>r.getStructure())})}}}function nG(e){return class extends e{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(r){return io(e.prototype,this,r),r.name!=null&&this.getTagNameNode().replaceWithText(r.name),this}getStructure(){return uo(e.prototype,this,{name:this.getTagNameNode().getText()})}}}var wR=gv(Tr),ZF=class extends wR{getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),`Expected to find an initializer for the JSX attribute '${this.getName()}'`)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(r){let n=Xg(this._getWriterWithQueuedIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeInitializer(),this;let i=this.getInitializer();return i!=null?(i.replaceWithText(n),this):(qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${n}`}),this)}removeInitializer(){let r=this.getInitializer();return r==null?this:(Bs({children:[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.EqualsToken),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(wR.prototype,this,r),r.initializer!=null?this.setInitializer(r.initializer):r.hasOwnProperty(b.nameof(r,"initializer"))&&this.removeInitializer(),this}getStructure(){let r=this.getInitializer();return uo(wR.prototype,this,{kind:Oe.StructureKind.JsxAttribute,initializer:r?.getText()})}},nUe=e=>nG(e),$me=nUe(Tr),e6=class extends $me{},r6=class extends oc{},FR=sd,t6=class extends FR{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(r){let n=Zfe(this._getWriterWithIndentation(),r);return Nfe(this,n),this}setBodyTextInline(r){let n=this._getWriterWithQueuedChildIndentation();return GE(n,r),n.isLastNewLine()&&(n.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),n.write("")),Nfe(this,n.toString()),this}set(r){if(io(FR.prototype,this,r),r.attributes!=null){let n=this.getOpeningElement();n.getAttributes().forEach(i=>i.remove()),n.addAttributes(r.attributes)}if(r.children!=null)throw new b.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return r.bodyText!=null?this.setBodyText(r.bodyText):r.hasOwnProperty(b.nameof(r,"bodyText"))&&this.setBodyTextInline(""),r.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(r.name),this.getClosingElement().getTagNameNode().replaceWithText(r.name)),this}getStructure(){let r=this.getOpeningElement(),n=uo(FR.prototype,this,{kind:Oe.StructureKind.JsxElement,name:r.getTagNameNode().getText(),attributes:r.getAttributes().map(i=>i.getStructure()),children:void 0,bodyText:$H(this)});return delete n.children,n}};function Nfe(e,r){let n=e.getOpeningElement(),i=e.getClosingElement();qa({insertPos:n.getEnd(),newText:r,parent:e.getChildSyntaxListOrThrow(),replacing:{textLength:i.getStart()-n.getEnd()}})}var Xme=TL(hL(oc)),n6=class extends Xme{},i6=class extends sd{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},iUe=e=>sq(nG(e)),Yme=iUe(oc),a6=class extends Yme{},o6=class extends oc{},aUe=e=>sq(nG(e)),GR=aUe(sd),s6=class extends GR{set(r){return io(GR.prototype,this,r),this}getStructure(){return uo(GR.prototype,this,{kind:Oe.StructureKind.JsxSelfClosingElement})}},BR=ud(Tr),l6=class extends BR{remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(BR.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}getStructure(){return uo(BR.prototype,this,{kind:Oe.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},Qme=KD(Tr),u6=class extends Qme{containsOnlyTriviaWhiteSpaces(){let r=this.compilerNode;return typeof r.containsOnlyWhiteSpaces=="boolean"?r.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},Zme=cS,c6=class extends Zme{getLiteralValue(){let r=this.compilerNode.text;if(typeof BigInt>"u")throw new b.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let n=r.substring(0,r.length-1);return BigInt(n)}setLiteralValue(r){if(typeof r!="bigint")throw new b.errors.ArgumentTypeError("value","bigint",typeof r);return mS({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString()+"n"}),this}},e_e=sd,d6=class extends e_e{getLiteralValue(){return lq(this)}setLiteralValue(r){return t_e(this,r)}},r_e=sd,f6=class extends r_e{getLiteralValue(){return lq(this)}setLiteralValue(r){return t_e(this,r)}};function t_e(e,r){if(lq(e)===r)return e;let n=e.getParentSyntaxList()||e.getParentOrThrow(),i=e.getChildIndex();return e.replaceWithText(r?"true":"false"),n.getChildAtIndex(i)}function lq(e){return e.getKind()===b.SyntaxKind.TrueKeyword}var n_e=sd,p6=class extends n_e{},i_e=cS,m6=class extends i_e{getLiteralValue(){let r=this.compilerNode.text;return r.indexOf(".")>=0?parseFloat(r):parseInt(r,10)}setLiteralValue(r){return mS({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString(10)}),this}};Oe.QuoteKind=void 0;(function(e){e.Single="'",e.Double='"'})(Oe.QuoteKind||(Oe.QuoteKind={}));var a_e=cS,_6=class extends a_e{getLiteralValue(){let r=/^\/(.*)\/([^\/]*)$/,n=this.compilerNode.text,i=r.exec(n);return new RegExp(i[1],i[2])}setLiteralValue(r,n){let i;return typeof r=="string"?i=r:(i=r.source,n=r.flags),mS({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${i}/${n||""}`}),this}},o_e=cS,g6=class extends o_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:b.StringUtils.escapeForWithinString(r,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?Oe.QuoteKind.Single:Oe.QuoteKind.Double}},s_e=cS,y6=class extends s_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){let n=this.getChildIndex(),i=this.getParentSyntaxList()||this.getParentOrThrow();return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),i.getChildAtIndex(n)}},v6=class extends BT{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){var r;let n=(r=this.getParentSyntaxList())!==null&&r!==void 0?r:this.getParentOrThrow(),i=this.getChildIndex(),a=this.getTemplate();return qa({customMappings:(s,u)=>[{currentNode:a,newNode:s.getChildren(u)[i]}],parent:n,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),n.getChildAtIndex(i)}},l_e=sd,h6=class extends l_e{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},u_e=KD(Tr),E6=class extends u_e{},c_e=KD(Tr),b6=class extends c_e{},d_e=ud(Tr),S6=class extends d_e{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},f_e=KD(Tr),T6=class extends f_e{};function uq(e){return class extends e{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(r=>r.getDeclarationNode()).filter(r=>r!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var p_e=ud(Tr),x6=class extends p_e{},m_e=uq(kh(_v(sd))),D6=class extends m_e{getImplementations(){return this._context.languageService.getImplementations(this)}},__e=uq(kh(_v(Tr))),C6=class extends __e{},A6=class extends Tr{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},oUe=e=>YH(XH(KE($T($6(e))))),UR=oUe(Tr),L6=class extends UR{remove(){let r=this.getParentOrThrow();switch(r.getKind()){case b.SyntaxKind.VariableDeclarationList:n(this);break;case b.SyntaxKind.CatchClause:i(this);break;default:throw new b.errors.NotImplementedError(`Not implemented for syntax kind: ${r.getKindName()}`)}function n(a){let s=r.getParentIfKindOrThrow(b.SyntaxKind.VariableStatement);s.getDeclarations().length===1?s.remove():mv(a)}function i(a){Bs({children:[a.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.OpenParenToken),a,a.getNextSiblingIfKindOrThrow(b.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(){return b.errors.throwIfNullOrUndefined(this.getVariableStatement(),"Expected the grandparent to be a variable statement.")}getVariableStatement(){let r=this.getParentOrThrow().getParentOrThrow();return Tr.isVariableStatement(r)?r:void 0}set(r){return io(UR.prototype,this,r),this}getStructure(){return uo(UR.prototype,this,{kind:Oe.StructureKind.VariableDeclaration})}},g_e=sf(Tr),N6=class extends g_e{getDeclarations(){return this.compilerNode.declarations.map(r=>this._getNodeFromCompilerNode(r))}getDeclarationKind(){let r=this.compilerNode.flags;return r&b.ts.NodeFlags.Let?Oe.VariableDeclarationKind.Let:r&b.ts.NodeFlags.Const?Oe.VariableDeclarationKind.Const:Oe.VariableDeclarationKind.Var}getDeclarationKindKeyword(){let r=this.getDeclarationKind();switch(r){case Oe.VariableDeclarationKind.Const:return this.getFirstChildByKindOrThrow(b.SyntaxKind.ConstKeyword);case Oe.VariableDeclarationKind.Let:return this.getFirstChildByKindOrThrow(b.SyntaxKind.LetKeyword);case Oe.VariableDeclarationKind.Var:return this.getFirstChildByKindOrThrow(b.SyntaxKind.VarKeyword);default:return b.errors.throwNotImplementedForNeverValueError(r)}}setDeclarationKind(r){if(this.getDeclarationKind()===r)return this;let n=this.getDeclarationKindKeyword();return qa({insertPos:n.getStart(),newText:r,parent:this,replacing:{textLength:n.getWidth()}}),this}addDeclaration(r){return this.addDeclarations([r])[0]}addDeclarations(r){return this.insertDeclarations(this.getDeclarations().length,r)}insertDeclaration(r,n){return this.insertDeclarations(r,[n])[0]}insertDeclarations(r,n){let i=this._getWriterWithQueuedChildIndentation(),a=new Ih(this._context.structurePrinterFactory.forVariableDeclaration()),s=this.compilerNode.declarations.length;return r=ku(r,s),a.printText(i,n),j_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:r,newText:i.toString(),useTrailingCommas:!1}),af(s,this.getDeclarations(),r,!1)}},I6=class{constructor(r,n){this._context=r,this._compilerSignature=n}get compilerSignature(){return this._compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(n=>this._context.compilerFactory.getTypeParameter(n))}getParameters(){return this.compilerSignature.parameters.map(r=>this._context.compilerFactory.getSymbol(r))}getReturnType(){return this._context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this._context.typeChecker.compilerObject).map(n=>this._context.compilerFactory.getSymbolDisplayPart(n))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(n=>this._context.compilerFactory.getJSDocTagInfo(n))}getDeclaration(){let{compilerFactory:r}=this._context,n=this.compilerSignature.getDeclaration();return r.getNodeFromCompilerNode(n,r.getSourceFileForNode(n))}},P6=class{constructor(r,n){this._context=r,this._compilerSymbol=n,this.getValueDeclaration(),this.getDeclarations()}get compilerSymbol(){return this._compilerSymbol}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this._context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),"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()&b.SymbolFlags.Alias)===b.SymbolFlags.Alias}isOptional(){return(this.getFlags()&b.SymbolFlags.Optional)===b.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(r){return(this.compilerSymbol.flags&r)===r}getValueDeclarationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getValueDeclaration(),()=>`Expected to find the value declaration of symbol '${this.getName()}'.`)}getValueDeclaration(){let r=this.compilerSymbol.valueDeclaration;if(r!=null)return this._context.compilerFactory.getNodeFromCompilerNode(r,this._context.compilerFactory.getSourceFileForNode(r))}getDeclarations(){var r;return((r=this.compilerSymbol.declarations)!==null&&r!==void 0?r:[]).map(n=>this._context.compilerFactory.getNodeFromCompilerNode(n,this._context.compilerFactory.getSourceFileForNode(n)))}getExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExport(r),`Expected to find export with name: ${r}`)}getExport(r){if(this.compilerSymbol.exports==null)return;let n=this.compilerSymbol.exports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExports(){return this.compilerSymbol.exports==null?[]:b.ArrayUtils.from(this.compilerSymbol.exports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getGlobalExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getGlobalExport(r),`Expected to find global export with name: ${r}`)}getGlobalExport(r){if(this.compilerSymbol.globalExports==null)return;let n=this.compilerSymbol.globalExports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:b.ArrayUtils.from(this.compilerSymbol.globalExports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),`Expected to find member with name: ${r}`)}getMember(r){if(this.compilerSymbol.members==null)return;let n=this.compilerSymbol.members.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getMembers(){return this.compilerSymbol.members==null?[]:b.ArrayUtils.from(this.compilerSymbol.members.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getDeclaredType(){return this._context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(r){return this._context.typeChecker.getTypeOfSymbolAtLocation(this,r)}getFullyQualifiedName(){return this._context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this._context.typeChecker.compilerObject).map(r=>new lL(r))}},FD=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},FE=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getSpan(){return new FD(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};co([b.Memoize],FE.prototype,"getSpan",null);var fS=class{constructor(r,n){this._context=r,this._compilerObject=n;let i=r.compilerFactory.addOrGetSourceFileFromFilePath(r.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName),{markInProject:!1,scriptKind:void 0});this._existingFileExists=i!=null,n.isNewFile||(this._sourceFile=i)}getFilePath(){return this._compilerObject.fileName}getSourceFile(){return this._sourceFile}getTextChanges(){return this._compilerObject.textChanges.map(r=>new FE(r))}applyChanges(r={}){if(this._isApplied)return;if(this.isNewFile()&&this._existingFileExists&&!r.overwrite)throw new b.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 n;if(this.isNewFile()?n=this._context.project.createSourceFile(this.getFilePath(),"",{overwrite:r.overwrite}):n=this.getSourceFile(),n==null)throw new b.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return n.applyTextChanges(this.getTextChanges()),n._markAsInProject(),this._isApplied=!0,this}isNewFile(){return!!this._compilerObject.isNewFile}};co([b.Memoize],fS.prototype,"getTextChanges",null);var O6=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(r=>new fS(this._context,r))}},k6=class extends O6{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},uL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getChanges(){return this.compilerObject.changes.map(r=>new fS(this._context,r))}applyChanges(r){for(let n of this.getChanges())n.applyChanges(r);return this}};co([b.Memoize],uL.prototype,"getChanges",null);var pv=class{constructor(r,n){this._context=r,this._compilerObject=n,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(r.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 FD(this.compilerObject.textSpan)}getNode(){let r=this.getTextSpan(),n=this.getSourceFile(),i=r.getStart(),a=r.getEnd();return s();function s(){let u;return n._context.compilerFactory.forgetNodesCreatedInBlock(p=>{let f,m=n;for(;m!=null;){if(f==null&&(u=m),m.getStart()===i&&m.getWidth()===a)u=f=m;else if(f!=null)break;m=m.getChildAtPos(i)}u!=null&&p(u)}),u}}getOriginalTextSpan(){let{originalTextSpan:r}=this.compilerObject;return r==null?void 0:new FD(r)}getOriginalFileName(){return this.compilerObject.originalFileName}};co([b.Memoize],pv.prototype,"getTextSpan",null);co([b.Memoize],pv.prototype,"getNode",null);co([b.Memoize],pv.prototype,"getOriginalTextSpan",null);var GD=class extends pv{constructor(r,n){super(r,n),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 r=this.getTextSpan().getStart(),n=i(this.getSourceFile());return n?.getParentOrThrow();function i(a){if(a.getKind()===b.SyntaxKind.Identifier&&a.getStart()===r)return a;for(let s of a._getChildrenIterator())if(s.getPos()<=r&&s.getEnd()>r)return i(s)}}};co([b.Memoize],GD.prototype,"getDeclarationNode",null);var pS=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let r=this.compilerObject.next;if(r!=null)return r instanceof Array?r.map(n=>new pS(n)):[new pS(r)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},WT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let r=this.compilerObject.file;return r==null?void 0:this._context.compilerFactory.getSourceFile(r,{markInProject:!1})}getMessageText(){let r=this._compilerObject.messageText;return typeof r=="string"?r:this._context==null?new pS(r):this._context.compilerFactory.getDiagnosticMessageChain(r)}getLineNumber(){let r=this.getSourceFile(),n=this.getStart();if(!(r==null||n==null))return b.StringUtils.getLineNumberAtPos(r.getFullText(),n)}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}};co([b.Memoize],WT.prototype,"getSourceFile",null);var cL=class extends WT{constructor(r,n){super(r,n)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},R6=class{constructor(r,n){this._compilerObject=n,this._context=r}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}},dL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(r=>new R6(this._context,r))}};co([b.Memoize],dL.prototype,"getOutputFiles",null);var VT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(r=>this._context.compilerFactory.getDiagnostic(r))}};co([b.Memoize],VT.prototype,"getDiagnostics",null);var fL=class extends pv{constructor(r,n){super(r,n)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],fL.prototype,"getDisplayParts",null);var M6=class extends VT{constructor(r,n,i){super(r,n),this._files=i}getFiles(){return this._files}saveFiles(){let r=this._context.fileSystemWrapper,n=this._files.map(i=>r.writeFile(i.filePath,i.writeByteOrderMark?"\uFEFF"+i.text:i.text));return Promise.all(n)}saveFilesSync(){let r=this._context.fileSystemWrapper;for(let n of this._files)r.writeFileSync(n.filePath,n.writeByteOrderMark?"\uFEFF"+n.text:n.text)}},pL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEdits(){return this.compilerObject.edits.map(r=>new fS(this._context,r))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(r){for(let n of this.getEdits())n.applyChanges(r);return this}};co([b.Memoize],pL.prototype,"getEdits",null);var mL=class{constructor(r,n){this._context=r,this._compilerObject=n,this._references=this.compilerObject.references.map(i=>r.compilerFactory.getReferencedSymbolEntry(i))}get compilerObject(){return this._compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this._references}};co([b.Memoize],mL.prototype,"getDefinition",null);var _L=class extends GD{constructor(r,n){super(r,n)}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],_L.prototype,"getDisplayParts",null);var w6=class extends pv{constructor(r,n){super(r,n)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},F6=class extends w6{constructor(r,n){super(r,n)}isDefinition(){return this.compilerObject.isDefinition}},G6=class extends pv{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},B6=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},gL=class{constructor(r){this._context=r}get compilerObject(){return this._getCompilerObject()}_reset(r){this._getCompilerObject=r}getAmbientModules(){return this.compilerObject.getAmbientModules().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentType(r){return this._context.compilerFactory.getType(this.compilerObject.getApparentType(r.compilerType))}getConstantValue(r){return this.compilerObject.getConstantValue(r.compilerNode)}getFullyQualifiedName(r){return this.compilerObject.getFullyQualifiedName(r.compilerSymbol)}getTypeAtLocation(r){return this._context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(r.compilerNode))}getContextualType(r){let n=this.compilerObject.getContextualType(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getType(n)}getTypeOfSymbolAtLocation(r,n){return this._context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(r.compilerSymbol,n.compilerNode))}getDeclaredTypeOfSymbol(r){return this._context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(r.compilerSymbol))}getSymbolAtLocation(r){let n=this.compilerObject.getSymbolAtLocation(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getAliasedSymbol(r){if(!r.hasFlags(b.SymbolFlags.Alias))return;let n=this.compilerObject.getAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getImmediatelyAliasedSymbol(r){let n=this.compilerObject.getImmediateAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExportSymbolOfSymbol(r){return this._context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(r.compilerSymbol))}getPropertiesOfType(r){return this.compilerObject.getPropertiesOfType(r.compilerType).map(n=>this._context.compilerFactory.getSymbol(n))}getTypeText(r,n,i){return i==null&&(i=this._getDefaultTypeFormatFlags(n)),this.compilerObject.typeToString(r.compilerType,n?.compilerNode,i)}getReturnTypeOfSignature(r){return this._context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(r.compilerSignature))}getSignatureFromNode(r){let n=this.compilerObject.getSignatureFromDeclaration(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSignature(n)}getExportsOfModule(r){return(this.compilerObject.getExportsOfModule(r.compilerSymbol)||[]).map(i=>this._context.compilerFactory.getSymbol(i))}getExportSpecifierLocalTargetSymbol(r){let n=this.compilerObject.getExportSpecifierLocalTargetSymbol(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getResolvedSignature(r){let n=this.compilerObject.getResolvedSignature(r.compilerNode);if(!(!n||!n.declaration))return this._context.compilerFactory.getSignature(n)}getResolvedSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getResolvedSignature(r),"Signature could not be resolved.")}getBaseTypeOfLiteralType(r){return this._context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(r.compilerType))}getSymbolsInScope(r,n){return this.compilerObject.getSymbolsInScope(r.compilerNode,n).map(i=>this._context.compilerFactory.getSymbol(i))}getTypeArguments(r){return this.compilerObject.getTypeArguments(r.compilerType).map(n=>this._context.compilerFactory.getType(n))}_getDefaultTypeFormatFlags(r){let n=b.TypeFormatFlags.UseTypeOfFunction|b.TypeFormatFlags.NoTruncation|b.TypeFormatFlags.UseFullyQualifiedType|b.TypeFormatFlags.WriteTypeArgumentsOfSignature;return r!=null&&r.getKind()===b.SyntaxKind.TypeAliasDeclaration&&(n|=b.TypeFormatFlags.InTypeAlias),n}},U6=class{constructor(r){this._context=r.context,this._configFileParsingDiagnostics=r.configFileParsingDiagnostics,this._typeChecker=new gL(this._context),this._reset(r.rootNames,r.host)}get compilerObject(){return this._getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this._createdCompilerObject!=null}_reset(r,n){let i=this._context.compilerOptions.get();this._getOrCreateCompilerObject=()=>(this._createdCompilerObject==null&&(this._createdCompilerObject=b.ts.createProgram(r,i,n,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(r={}){if(r.writeFile){let s=`Cannot specify a ${b.nameof(r,"writeFile")} option when emitting asynchrously. Use ${b.nameof(this,"emitSync")}() instead.`;throw new b.errors.InvalidOperationError(s)}let{fileSystemWrapper:n}=this._context,i=[],a=this._emit({writeFile:(s,u,p)=>{i.push(n.writeFile(n.getStandardizedAbsolutePath(s),p?"\uFEFF"+u:u))},...r});return await Promise.all(i),new VT(this._context,a)}emitSync(r={}){return new VT(this._context,this._emit(r))}emitToMemory(r={}){let n=[],{fileSystemWrapper:i}=this._context,a=this._emit({writeFile:(s,u,p)=>{n.push({filePath:i.getStandardizedAbsolutePath(s),text:u,writeByteOrderMark:p||!1})},...r});return new M6(this._context,a,n)}_emit(r={}){let n=r.targetSourceFile!=null?r.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:i,customTransformers:a,writeFile:s}=r,u=void 0;return this.compilerObject.emit(n,s,u,i,a)}getSyntacticDiagnostics(r){return this.compilerObject.getSyntacticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getSemanticDiagnostics(r){return this.compilerObject.getSemanticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnostic(i))}getDeclarationDiagnostics(r){return this.compilerObject.getDeclarationDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getEmitModuleResolutionKind(){return b.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(r){return r.isFromExternalLibrary()}},K6=class{constructor(r){var n;this._projectVersion=0,this._context=r.context;let{languageServiceHost:i,compilerHost:a}=b.createHosts({transactionalFileSystem:this._context.fileSystemWrapper,sourceFileContainer:this._context.getSourceFileContainer(),compilerOptions:this._context.compilerOptions,getNewLine:()=>this._context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this._projectVersion}`,resolutionHost:(n=r.resolutionHost)!==null&&n!==void 0?n:{},libFolderPath:r.libFolderPath,skipLoadingLibFiles:r.skipLoadingLibFiles});this._compilerHost=a,this._compilerObject=b.ts.createLanguageService(i,this._context.compilerFactory.documentRegistry),this._program=new U6({context:this._context,rootNames:Array.from(this._context.compilerFactory.getSourceFilePaths()),host:this._compilerHost,configFileParsingDiagnostics:r.configFileParsingDiagnostics}),this._context.compilerFactory.onSourceFileAdded(s=>{s._isInProject()&&this._reset()}),this._context.compilerFactory.onSourceFileRemoved(()=>this._reset())}get compilerObject(){return this._compilerObject}_reset(){this._projectVersion+=1,this._program._reset(Array.from(this._context.compilerFactory.getSourceFilePaths()),this._compilerHost)}getProgram(){return this._program}getDefinitions(r){return this.getDefinitionsAtPosition(r._sourceFile,r.getStart())}getDefinitionsAtPosition(r,n){return(this.compilerObject.getDefinitionAtPosition(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getDefinitionInfo(a))}getImplementations(r){return this.getImplementationsAtPosition(r._sourceFile,r.getStart())}getImplementationsAtPosition(r,n){return(this.compilerObject.getImplementationAtPosition(r.getFilePath(),n)||[]).map(a=>new fL(this._context,a))}findReferences(r){return this.findReferencesAtPosition(r._sourceFile,r.getStart())}findReferencesAsNodes(r){let n=this.findReferences(r);return Array.from(i());function*i(){for(let a of n){let s=a.getDefinition().getKind()===b.ts.ScriptElementKind.alias,u=a.getReferences();for(let p=0;p<u.length;p++){let f=u[p];(s||!f.isDefinition()||p>0)&&(yield f.getNode())}}}}findReferencesAtPosition(r,n){return(this.compilerObject.findReferences(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getReferencedSymbol(a))}findRenameLocations(r,n={}){let i=n.usePrefixAndSuffixText==null?this._context.manipulationSettings.getUsePrefixAndSuffixTextForRename():n.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(r._sourceFile.getFilePath(),r.getStart(),n.renameInStrings||!1,n.renameInComments||!1,i)||[]).map(s=>new G6(this._context,s))}getSuggestionDiagnostics(r){let n=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getSuggestionDiagnostics(n).map(a=>this._context.compilerFactory.getDiagnosticWithLocation(a))}getFormattingEditsForRange(r,n,i){return(this.compilerObject.getFormattingEditsForRange(r,n[0],n[1],this._getFilledSettings(i))||[]).map(a=>new FE(a))}getFormattingEditsForDocument(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r);return(this.compilerObject.getFormattingEditsForDocument(i,this._getFilledSettings(n))||[]).map(a=>new FE(a))}getFormattedDocumentText(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),a=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(i);if(a==null)throw new b.errors.FileNotFoundError(i);n=this._getFilledSettings(n);let s=this.getFormattingEditsForDocument(i,n),u=HH(a,s),p=n.newLineCharacter;return n.ensureNewLineAtEndOfFile&&!u.endsWith(p)&&(u+=p),u.replace(/\r?\n/g,p)}getEmitOutput(r,n){let i=this._getFilePathFromFilePathOrSourceFile(r),a=this.compilerObject;return new dL(this._context,s());function s(){let u=a.getProgram();return u==null||u.getSourceFile(i)==null?{emitSkipped:!0,outputFiles:[]}:a.getEmitOutput(i,n)}}getIdentationAtPosition(r,n,i){let a=this._getFilePathFromFilePathOrSourceFile(r);return i==null?i=this._context.manipulationSettings.getEditorSettings():jH(i,this._context.manipulationSettings),this.compilerObject.getIndentationAtPosition(a,n,i)}organizeImports(r,n={},i={}){let a={type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)};return this.compilerObject.organizeImports(a,this._getFilledSettings(n),this._getFilledUserPreferences(i)).map(s=>new fS(this._context,s))}getEditsForRefactor(r,n,i,a,s,u={}){let p=this._getFilePathFromFilePathOrSourceFile(r),f=typeof i=="number"?i:{pos:i.getPos(),end:i.getEnd()},m=this.compilerObject.getEditsForRefactor(p,this._getFilledSettings(n),f,a,s,this._getFilledUserPreferences(u));return m!=null?new pL(this._context,m):void 0}getCombinedCodeFix(r,n,i={},a={}){let s=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)},n,this._getFilledSettings(i),this._getFilledUserPreferences(a||{}));return new uL(this._context,s)}getCodeFixesAtPosition(r,n,i,a,s={},u={}){let p=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getCodeFixesAtPosition(p,n,i,a,this._getFilledSettings(s),this._getFilledUserPreferences(u||{})).map(m=>new k6(this._context,m))}_getFilePathFromFilePathOrSourceFile(r){let n=typeof r=="string"?this._context.fileSystemWrapper.getStandardizedAbsolutePath(r):r.getFilePath();if(!this._context.compilerFactory.containsSourceFileAtPath(n))throw new b.errors.FileNotFoundError(n);return n}_getFilledSettings(r){return r._filled||(r=Object.assign(this._context.getFormatCodeSettings(),r),wBe(r,this._context.manipulationSettings),r._filled=!0),r}_getFilledUserPreferences(r){return Object.assign(this._context.getUserPreferences(),r)}},yL=class{constructor(r,n){this._context=r,this._compilerType=n}get compilerType(){return this._compilerType}getText(r,n){return this._context.typeChecker.getTypeText(this,r,n)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(n=>this._context.compilerFactory.getType(n))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getArrayElementType(),"Expected to find an array element type.")}getArrayElementType(){if(!!this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(n=>this._context.compilerFactory.getType(n))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find a constraint.")}getConstraint(){let r=this.compilerType.getConstraint();return r==null?void 0:this._context.compilerFactory.getType(r)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find a default type.")}getDefault(){let r=this.compilerType.getDefault();return r==null?void 0:this._context.compilerFactory.getType(r)}getProperties(){return this.compilerType.getProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("symbol property",r))}getProperty(r){return Zde(this.getProperties(),r)}getApparentProperties(){return this.compilerType.getApparentProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentProperty(r){return Zde(this.getApparentProperties(),r)}isNullable(){return this.getUnionTypes().some(r=>r.isNull()||r.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let r=this.compilerType.getNumberIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getStringIndexType(){let r=this.compilerType.getStringIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetType(){let r=this.compilerType.target||void 0;return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTargetType(),"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(r=>this._context.compilerFactory.getType(r)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(r=>this._context.compilerFactory.getType(r)):[]}getLiteralValue(){var r;return(r=this.compilerType)===null||r===void 0?void 0:r.value}getLiteralValueOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralValue(),"Type was not a literal type.")}getLiteralFreshType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.freshType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralFreshTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),"Type was not a literal type.")}getLiteralRegularType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.regularType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralRegularTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),"Type was not a literal type.")}getSymbol(){let r=this.compilerType.getSymbol();return r==null?void 0:this._context.compilerFactory.getSymbol(r)}getSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getSymbol(),"Expected to find a symbol.")}isAnonymous(){return this._hasObjectFlag(b.ObjectFlags.Anonymous)}isAny(){return this._hasTypeFlag(b.TypeFlags.Any)}isNever(){return this._hasTypeFlag(b.TypeFlags.Never)}isArray(){let r=this.getSymbol();return r==null?!1:(r.getName()==="Array"||r.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let r=this.getSymbol();return r==null?!1:r.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this._hasTypeFlag(b.TypeFlags.TemplateLiteral)}isBoolean(){return this._hasTypeFlag(b.TypeFlags.Boolean)}isString(){return this._hasTypeFlag(b.TypeFlags.String)}isNumber(){return this._hasTypeFlag(b.TypeFlags.Number)}isLiteral(){let r=this.isBooleanLiteral();return this.compilerType.isLiteral()||r}isBooleanLiteral(){return this._hasTypeFlag(b.TypeFlags.BooleanLiteral)}isEnumLiteral(){return this._hasTypeFlag(b.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this._hasTypeFlag(b.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this._hasTypeFlag(b.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let n=this.getSymbol();if(n==null)return!1;let i=n.getValueDeclaration();return i!=null&&Tr.isEnumDeclaration(i)}isInterface(){return this._hasObjectFlag(b.ObjectFlags.Interface)}isObject(){return this._hasTypeFlag(b.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let r=this.getTargetType();return r==null?!1:r._hasObjectFlag(b.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this._hasTypeFlag(b.TypeFlags.Unknown)}isNull(){return this._hasTypeFlag(b.TypeFlags.Null)}isUndefined(){return this._hasTypeFlag(b.TypeFlags.Undefined)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}_hasTypeFlag(r){return(this.compilerType.flags&r)===r}_hasObjectFlag(r){return(this.getObjectFlags()&r)===r}},W6=class extends yL{getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected type parameter to have a constraint.")}getConstraint(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getConstraint();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected type parameter to have a default type.")}getDefault(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getDefault();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}_getTypeParameterDeclaration(){let r=this.getSymbol();if(r==null)return;let n=r.getDeclarations()[0];if(n!=null&&!!Tr.isTypeParameterDeclaration(n))return n}},vL=class{constructor(r,n){this._skippedFilePaths=r,this._outputFilePaths=n}getSkippedFilePaths(){return this._skippedFilePaths}getOutputFilePaths(){return this._outputFilePaths}},OE=class{constructor(r,n){this.__context=r,this._setPathInternal(n)}_setPathInternal(r){this._path=r,this._pathParts=r.split("/").filter(n=>n.length>0)}get _context(){return this._throwIfDeletedOrRemoved(),this.__context}isAncestorOf(r){return OE._isAncestorOfDir(this,r)}isDescendantOf(r){return OE._isAncestorOfDir(r,this)}_getDepth(){return this._pathParts.length}getPath(){return this._throwIfDeletedOrRemoved(),this._path}getBaseName(){return this._pathParts[this._pathParts.length-1]}getParentOrThrow(){return b.errors.throwIfNullOrUndefined(this.getParent(),()=>`Parent directory of ${this.getPath()} does not exist or was never added.`)}getParent(){if(!b.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(b.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>typeof r=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(n)}return this.getDirectories().find(r)}getSourceFileOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getSourceFile(r),()=>typeof r=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n)}for(let n of this._getSourceFilesIterator())if(r(n))return n}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this;if(typeof r=="string"||r instanceof Array){let u=typeof r=="string"?[r]:r;return Array.from(s(u))}else return Array.from(this._getSourceFilesIterator());function*s(u){let p=Array.from(m()),f=b.matchGlobs(p,u,a.getPath());for(let g of f)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(g));function*m(){for(let g of a._getDescendantSourceFilesIterator())yield g.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let r of this._getSourceFilesIterator())yield r;for(let r of this._getDirectoriesIterator())yield*r._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let r of this.getDirectories())yield r,yield*r._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(r){return r=typeof r=="string"?[r]:r,r=r.map(n=>b.FileUtils.pathIsAbsolute(n)?n:b.FileUtils.pathJoin(this.getPath(),n)),this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(i,{...n,markInProject:this._isInProject()})}addDirectoryAtPath(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(i,{...n,markInProject:this._isInProject()})}createDirectory(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(n,{markInProject:this._isInProject()})}createSourceFile(r,n,i){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.createSourceFile(a,n||"",{...i||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(n,{markInProject:this._isInProject()})}addSourceFileAtPath(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(n,{markInProject:this._isInProject()})}async emit(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[],s=[];for(let u of this._emitInternal(r))Ife(u)?s.push(u):(i.push(n.writeFile(u.filePath,u.fileText)),a.push(u.filePath));return await Promise.all(i),new vL(s,a)}emitSync(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[];for(let s of this._emitInternal(r))Ife(s)?a.push(s):(n.writeFileSync(s.filePath,s.fileText),i.push(s.filePath));return new vL(a,i)}_emitInternal(r={}){let{emitOnlyDtsFiles:n=!1}=r,i=r.outDir==null?void 0:/\.js$/i,a=r.outDir==null?void 0:/\.js\.map$/i,s=r.declarationDir==null&&r.outDir==null?void 0:/\.d\.ts$/i,u=g=>g==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(g,this.getPath()),p=(g,D)=>g==null?void 0:b.FileUtils.pathJoin(g,D.getBaseName()),f=this._context.compilerOptions.get().declarationDir!=null||r.declarationDir!=null;return m(this,u(r.outDir),u(r.declarationDir));function*m(g,D,P){for(let B of g.getSourceFiles()){let K=B.getEmitOutput({emitOnlyDtsFiles:n});if(K.getEmitSkipped()){yield B.getFilePath();continue}for(let h of K.getOutputFiles()){let S=h.getFilePath(),U=h.getWriteByteOrderMark()?b.FileUtils.getTextWithByteOrderMark(h.getText()):h.getText();D!=null&&(i.test(S)||a.test(S)||!f&&s.test(S))?S=b.FileUtils.pathJoin(D,b.FileUtils.getBaseName(S)):P!=null&&s.test(S)&&(S=b.FileUtils.pathJoin(P,b.FileUtils.getBaseName(S))),yield{filePath:S,fileText:U}}}for(let B of g.getDirectories())yield*m(B,p(D,B),p(P,B))}}copyToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.copy(b.FileUtils.pathJoin(i,this.getBaseName()),n)}copy(r,n){let i=this.getPath(),a=this._context.fileSystemWrapper,s=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return i===s?this:(n=sj(n),n.includeUntrackedFiles&&a.queueCopyDirectory(i,s),this._copyInternal(s,n))}async copyImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return await this.save(),this;n=sj(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&await i.copyDirectoryImmediately(a,s),await u.save(),u}copyImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return this.saveSync(),this;n=sj(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&i.copyDirectoryImmediatelySync(a,s),u.saveSync(),u}_copyInternal(r,n){if(this.getPath()===r)return this;let{fileSystemWrapper:a,compilerFactory:s}=this._context,u=[this,...this.getDescendantDirectories()].map(f=>({newDirPath:f===this?r:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r)})),p=this.getDescendantSourceFiles().map(f=>({sourceFile:f,newFilePath:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r),references:this._getReferencesForCopy(f)}));for(let{newDirPath:f}of u)this._context.compilerFactory.createDirectoryOrAddIfExists(f,{markInProject:this._isInProject()});for(let{sourceFile:f,newFilePath:m}of p)f._copyInternal(m,n);for(let{references:f,newFilePath:m}of p)this.getSourceFileOrThrow(m)._updateReferencesForCopyInternal(f);return s.getDirectoryFromCache(r)}moveToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.move(b.FileUtils.pathJoin(i,this.getBaseName()),n)}move(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?this:this._moveInternal(s,n,()=>i.queueMoveDirectory(a,s))}async moveImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(await this.save(),this):(this._moveInternal(s,n),await i.moveDirectoryImmediately(a,s),await this.save(),this)}moveImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(this.saveSync(),this):(this._moveInternal(s,n),i.moveDirectoryImmediatelySync(a,s),this.saveSync(),this)}_moveInternal(r,n,i){let a=this.getPath();if(a===r)return this;let s=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(r),u=s!=null&&s._isInProject();i&&i();let p=this._context.fileSystemWrapper,f=this._context.compilerFactory,m=[this,...this.getDescendantDirectories()].map(D=>({directory:D,oldPath:D.getPath(),newDirPath:D===this?r:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r)})),g=this.getDescendantSourceFiles().map(D=>({sourceFile:D,newFilePath:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r),references:this._getReferencesForMove(D)}));for(let{directory:D,oldPath:P,newDirPath:B}of m){f.removeDirectoryFromCache(P);let K=f.getDirectoryFromCache(B);K?._forgetOnlyThis(),D._setPathInternal(B),f.addDirectoryToCache(D)}for(let{sourceFile:D,newFilePath:P}of g)D._moveInternal(P,n);for(let{sourceFile:D,references:P}of g)D._updateReferencesForMoveInternal(P,a);return u&&this._markAsInProject(),this}clear(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this._context.fileSystemWrapper.queueMkdir(r)}async clearImmediately(){let r=this.getPath();this._deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(r)}clearImmediatelySync(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(r)}delete(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this.forget()}_deleteDescendants(){for(let r of this.getSourceFiles())r.delete();for(let r of this.getDirectories())r.delete()}async deleteImmediately(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),await r.deleteDirectoryImmediately(n)}deleteImmediatelySync(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),r.deleteDirectoryImmediatelySync(n)}forget(){if(!this.wasForgotten()){for(let r of this.getSourceFiles())r.forget();for(let r of this.getDirectories())r.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 r=this.getDescendantSourceFiles().filter(n=>!n.isSaved());await Promise.all(r.map(n=>n.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(n=>!n.isSaved()).forEach(n=>n.saveSync())}getRelativePathTo(r){let n=this;return b.FileUtils.getRelativePathTo(this.getPath(),i());function i(){return r instanceof kE?r.getFilePath():r instanceof OE?r.getPath():n._context.fileSystemWrapper.getStandardizedAbsolutePath(r,n.getPath())}}getRelativePathAsModuleSpecifierTo(r){let n=this._context.program.getEmitModuleResolutionKind(),i=this,a=b.FileUtils.getRelativePathTo(this.getPath(),s()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return a.startsWith("../")?a:"./"+a;function s(){return r instanceof kE?u(r):r instanceof OE?p(r):f(i._context.fileSystemWrapper.getStandardizedAbsolutePath(r,i.getPath()));function u(m){return f(m.getFilePath())}function p(m){switch(n){case b.ModuleResolutionKind.NodeJs:return m===i?b.FileUtils.pathJoin(m.getPath(),"index.ts"):m.getPath();case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return b.FileUtils.pathJoin(m.getPath(),"index.ts");default:return b.errors.throwNotImplementedForNeverValueError(n)}}function f(m){let g=b.FileUtils.getDirPath(m);switch(n){case b.ModuleResolutionKind.NodeJs:return g===i.getPath()?m:m.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return m;default:return b.errors.throwNotImplementedForNeverValueError(n)}}}}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(b.FileUtils.getDirPath(this.getPath()))}_throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new b.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}_getReferencesForCopy(r){return r._getReferencesForCopyInternal().filter(i=>!this.isAncestorOf(i[1]))}_getReferencesForMove(r){let{literalReferences:n,referencingLiterals:i}=r._getReferencesForMoveInternal();return{literalReferences:n.filter(a=>!this.isAncestorOf(a[1])),referencingLiterals:i.filter(a=>!this.isAncestorOf(a._sourceFile))}}static _isAncestorOfDir(r,n){if(n instanceof kE&&(n=n.getDirectory(),r===n))return!0;if(r._pathParts.length>=n._pathParts.length)return!1;for(let i=r._pathParts.length-1;i>=0;i--)if(r._pathParts[i]!==n._pathParts[i])return!1;return!0}};function sj(e){return e=b.ObjectUtils.clone(e||{}),mu(e,"includeUntrackedFiles",!0),e}function Ife(e){return typeof e=="string"}var wH=class{constructor(r,n){this.compilerFactory=r,this.fileSystemWrapper=n}addDirectoryAtPathIfExists(r,n){let i=this.compilerFactory.getDirectoryFromPath(r,n);if(i!=null){if(n.recursive)for(let a of b.FileUtils.getDescendantDirectories(this.fileSystemWrapper,r))this.compilerFactory.createDirectoryOrAddIfExists(a,n);return i}}addDirectoryAtPath(r,n){let i=this.addDirectoryAtPathIfExists(r,n);if(i==null)throw new b.errors.DirectoryNotFoundError(r);return i}createDirectoryOrAddIfExists(r,n){return this.compilerFactory.createDirectoryOrAddIfExists(r,n)}addSourceFileAtPathIfExists(r,n){return this.compilerFactory.addOrGetSourceFileFromFilePath(r,{markInProject:n.markInProject,scriptKind:void 0})}addSourceFileAtPath(r,n){let i=this.addSourceFileAtPathIfExists(r,n);if(i==null)throw new b.errors.FileNotFoundError(this.fileSystemWrapper.getStandardizedAbsolutePath(r));return i}addSourceFilesAtPaths(r,n){typeof r=="string"&&(r=[r]);let i=[],a=new Set;for(let s of this.fileSystemWrapper.globSync(r)){let u=this.addSourceFileAtPathIfExists(s,n);u!=null&&i.push(u),a.add(b.FileUtils.getDirPath(s))}for(let s of b.FileUtils.getParentMostPaths(Array.from(a)))this.addDirectoryAtPathIfExists(s,{recursive:!0,markInProject:n.markInProject});return i}},FH=class{constructor(r){this.context=r,this.directoriesByPath=new b.KeyValueCache,this.sourceFilesByDirPath=new b.KeyValueCache,this.directoriesByDirPath=new b.KeyValueCache,this.orphanDirs=new b.KeyValueCache}has(r){return this.directoriesByPath.has(r)}get(r){if(!this.directoriesByPath.has(r)){for(let n of this.orphanDirs.getValues())if(b.FileUtils.pathStartsWith(n.getPath(),r))return this.createOrAddIfExists(r);return}return this.directoriesByPath.get(r)}getOrphans(){return this.orphanDirs.getValues()}getAll(){return this.directoriesByPath.getValuesAsArray()}*getAllByDepth(){let r=new b.KeyValueCache,n=0;for(let a of this.getOrphans())i(a);for(n=Math.min(...Array.from(r.getKeys()));r.getSize()>0;){for(let a of r.get(n)||[])yield a,a.getDirectories().forEach(i);r.removeByKey(n),n++}function i(a){let s=a._getDepth();if(n>s)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${a.getPath()}`);r.getOrCreate(s,()=>[]).push(a)}}remove(r){this.removeFromDirectoriesByDirPath(r),this.directoriesByPath.removeByKey(r),this.orphanDirs.removeByKey(r)}*getChildDirectoriesOfDirectory(r){var n;let i=(n=this.directoriesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}*getChildSourceFilesOfDirectory(r){var n;let i=(n=this.sourceFilesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}addSourceFile(r){let n=r.getDirectoryPath();this.createOrAddIfExists(n),this.sourceFilesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeSourceFile(r){let n=b.FileUtils.getDirPath(r),i=this.sourceFilesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.sourceFilesByDirPath.removeByKey(n))}createOrAddIfExists(r){return this.has(r)?this.get(r):(this.fillParentsOfDirPath(r),this.createDirectory(r))}createDirectory(r){let n=new OE(this.context,r);return this.addDirectory(n),n}addDirectory(r){let n=r.getPath(),i=b.FileUtils.getDirPath(n),a=i===n;for(let s of this.orphanDirs.getValues()){let u=s.getPath(),p=b.FileUtils.getDirPath(u);!(p===u)&&p===n&&this.orphanDirs.removeByKey(u)}a||this.addToDirectoriesByDirPath(r),this.has(i)||this.orphanDirs.set(n,r),this.directoriesByPath.set(n,r),this.context.fileSystemWrapper.directoryExistsSync(n)||this.context.fileSystemWrapper.queueMkdir(n);for(let s of this.orphanDirs.getValues())r.isAncestorOf(s)&&this.fillParentsOfDirPath(s.getPath())}addToDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r.getPath()))return;let n=b.FileUtils.getDirPath(r.getPath());this.directoriesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeFromDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r))return;let n=b.FileUtils.getDirPath(r),i=this.directoriesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.directoriesByDirPath.removeByKey(n))}fillParentsOfDirPath(r){let n=[],i=b.FileUtils.getDirPath(r);for(;r!==i;){if(r=i,i=b.FileUtils.getDirPath(r),this.directoriesByPath.has(r)){for(let a of n)this.createDirectory(a);break}n.unshift(r)}}},GH=class extends b.KeyValueCache{constructor(){super(...arguments),this.forgetStack=[]}getOrCreate(r,n){return super.getOrCreate(r,()=>{let i=n();return this.forgetStack.length>0&&this.forgetStack[this.forgetStack.length-1].add(i),i})}setForgetPoint(){this.forgetStack.push(new Set)}forgetLastPoint(){let r=this.forgetStack.pop();r!=null&&this.forgetNodes(r.values())}rememberNode(r){if(r.wasForgotten())throw new b.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let n=!1;for(let i of this.forgetStack)if(i.delete(r)){n=!0;break}return n&&this.rememberParentOfNode(r),n}rememberParentOfNode(r){let n=r.getParentSyntaxList()||r.getParent();n!=null&&this.rememberNode(n)}forgetNodes(r){for(let n of r)n.wasForgotten()||n.getKind()===b.SyntaxKind.SourceFile||n._forgetOnlyThis()}},sUe={[b.SyntaxKind.SourceFile]:kE,[b.SyntaxKind.ArrayBindingPattern]:eM,[b.SyntaxKind.ArrayLiteralExpression]:iM,[b.SyntaxKind.ArrayType]:kw,[b.SyntaxKind.ArrowFunction]:hw,[b.SyntaxKind.AsExpression]:aM,[b.SyntaxKind.AssertClause]:ew,[b.SyntaxKind.AssertEntry]:rw,[b.SyntaxKind.AwaitExpression]:oM,[b.SyntaxKind.BigIntLiteral]:c6,[b.SyntaxKind.BindingElement]:rM,[b.SyntaxKind.BinaryExpression]:nL,[b.SyntaxKind.Block]:OM,[b.SyntaxKind.BreakStatement]:kM,[b.SyntaxKind.CallExpression]:sM,[b.SyntaxKind.CallSignature]:qF,[b.SyntaxKind.CaseBlock]:RM,[b.SyntaxKind.CaseClause]:MM,[b.SyntaxKind.CatchClause]:wM,[b.SyntaxKind.ClassDeclaration]:Tw,[b.SyntaxKind.ClassExpression]:xw,[b.SyntaxKind.ClassStaticBlockDeclaration]:Dw,[b.SyntaxKind.ConditionalType]:Rw,[b.SyntaxKind.Constructor]:Aw,[b.SyntaxKind.ConstructorType]:Mw,[b.SyntaxKind.ConstructSignature]:zF,[b.SyntaxKind.ContinueStatement]:GM,[b.SyntaxKind.CommaListExpression]:lM,[b.SyntaxKind.ComputedPropertyName]:x6,[b.SyntaxKind.ConditionalExpression]:uM,[b.SyntaxKind.DebuggerStatement]:BM,[b.SyntaxKind.Decorator]:Pw,[b.SyntaxKind.DefaultClause]:UM,[b.SyntaxKind.DeleteExpression]:cM,[b.SyntaxKind.DoStatement]:KM,[b.SyntaxKind.ElementAccessExpression]:aL,[b.SyntaxKind.EmptyStatement]:WM,[b.SyntaxKind.EnumDeclaration]:VF,[b.SyntaxKind.EnumMember]:jF,[b.SyntaxKind.ExportAssignment]:tw,[b.SyntaxKind.ExportDeclaration]:nw,[b.SyntaxKind.ExportSpecifier]:iw,[b.SyntaxKind.ExpressionWithTypeArguments]:ww,[b.SyntaxKind.ExpressionStatement]:VM,[b.SyntaxKind.ExternalModuleReference]:aw,[b.SyntaxKind.QualifiedName]:A6,[b.SyntaxKind.ForInStatement]:jM,[b.SyntaxKind.ForOfStatement]:HM,[b.SyntaxKind.ForStatement]:qM,[b.SyntaxKind.FunctionDeclaration]:Ew,[b.SyntaxKind.FunctionExpression]:bw,[b.SyntaxKind.FunctionType]:Fw,[b.SyntaxKind.GetAccessor]:Lw,[b.SyntaxKind.HeritageClause]:HF,[b.SyntaxKind.Identifier]:D6,[b.SyntaxKind.IfStatement]:JM,[b.SyntaxKind.ImportClause]:ow,[b.SyntaxKind.ImportDeclaration]:sw,[b.SyntaxKind.ImportEqualsDeclaration]:lw,[b.SyntaxKind.ImportSpecifier]:uw,[b.SyntaxKind.ImportType]:Bw,[b.SyntaxKind.ImportTypeAssertionContainer]:Gw,[b.SyntaxKind.IndexedAccessType]:Uw,[b.SyntaxKind.IndexSignature]:$F,[b.SyntaxKind.InferType]:Kw,[b.SyntaxKind.InterfaceDeclaration]:XF,[b.SyntaxKind.IntersectionType]:Ww,[b.SyntaxKind.JSDocAllType]:iF,[b.SyntaxKind.JSDocAugmentsTag]:aF,[b.SyntaxKind.JSDocAuthorTag]:oF,[b.SyntaxKind.JSDocCallbackTag]:sF,[b.SyntaxKind.JSDocClassTag]:lF,[b.SyntaxKind.JSDocDeprecatedTag]:uF,[b.SyntaxKind.JSDocEnumTag]:cF,[b.SyntaxKind.JSDocFunctionType]:dF,[b.SyntaxKind.JSDocImplementsTag]:fF,[b.SyntaxKind.JSDocLink]:pF,[b.SyntaxKind.JSDocLinkCode]:mF,[b.SyntaxKind.JSDocLinkPlain]:_F,[b.SyntaxKind.JSDocMemberName]:gF,[b.SyntaxKind.JSDocNamepathType]:yF,[b.SyntaxKind.JSDocNameReference]:vF,[b.SyntaxKind.JSDocNonNullableType]:hF,[b.SyntaxKind.JSDocNullableType]:EF,[b.SyntaxKind.JSDocOptionalType]:bF,[b.SyntaxKind.JSDocOverrideTag]:SF,[b.SyntaxKind.JSDocParameterTag]:TF,[b.SyntaxKind.JSDocPrivateTag]:xF,[b.SyntaxKind.JSDocPropertyTag]:DF,[b.SyntaxKind.JSDocProtectedTag]:CF,[b.SyntaxKind.JSDocPublicTag]:AF,[b.SyntaxKind.JSDocReturnTag]:NF,[b.SyntaxKind.JSDocReadonlyTag]:LF,[b.SyntaxKind.JSDocSeeTag]:IF,[b.SyntaxKind.JSDocSignature]:PF,[b.SyntaxKind.JSDocTag]:BF,[b.SyntaxKind.JSDocTemplateTag]:OF,[b.SyntaxKind.JSDocText]:kF,[b.SyntaxKind.JSDocThisTag]:RF,[b.SyntaxKind.JSDocTypeExpression]:wF,[b.SyntaxKind.JSDocTypeLiteral]:FF,[b.SyntaxKind.JSDocTypeTag]:GF,[b.SyntaxKind.JSDocTypedefTag]:MF,[b.SyntaxKind.JSDocUnknownType]:UF,[b.SyntaxKind.JSDocVariadicType]:KF,[b.SyntaxKind.JsxAttribute]:ZF,[b.SyntaxKind.JsxClosingElement]:e6,[b.SyntaxKind.JsxClosingFragment]:r6,[b.SyntaxKind.JsxElement]:t6,[b.SyntaxKind.JsxExpression]:n6,[b.SyntaxKind.JsxFragment]:i6,[b.SyntaxKind.JsxOpeningElement]:a6,[b.SyntaxKind.JsxOpeningFragment]:o6,[b.SyntaxKind.JsxSelfClosingElement]:s6,[b.SyntaxKind.JsxSpreadAttribute]:l6,[b.SyntaxKind.JsxText]:u6,[b.SyntaxKind.LabeledStatement]:zM,[b.SyntaxKind.LiteralType]:Vw,[b.SyntaxKind.MappedType]:jw,[b.SyntaxKind.MetaProperty]:fM,[b.SyntaxKind.MethodDeclaration]:wD,[b.SyntaxKind.MethodSignature]:YF,[b.SyntaxKind.ModuleBlock]:cw,[b.SyntaxKind.ModuleDeclaration]:dw,[b.SyntaxKind.NamedExports]:fw,[b.SyntaxKind.NamedImports]:pw,[b.SyntaxKind.NamedTupleMember]:Hw,[b.SyntaxKind.NamespaceExport]:mw,[b.SyntaxKind.NamespaceImport]:_w,[b.SyntaxKind.NewExpression]:pM,[b.SyntaxKind.NonNullExpression]:mM,[b.SyntaxKind.NotEmittedStatement]:$M,[b.SyntaxKind.NoSubstitutionTemplateLiteral]:y6,[b.SyntaxKind.NumericLiteral]:m6,[b.SyntaxKind.ObjectBindingPattern]:tM,[b.SyntaxKind.ObjectLiteralExpression]:gM,[b.SyntaxKind.OmittedExpression]:EM,[b.SyntaxKind.Parameter]:Sw,[b.SyntaxKind.ParenthesizedExpression]:bM,[b.SyntaxKind.ParenthesizedType]:qw,[b.SyntaxKind.PartiallyEmittedExpression]:SM,[b.SyntaxKind.PostfixUnaryExpression]:TM,[b.SyntaxKind.PrefixUnaryExpression]:xM,[b.SyntaxKind.PrivateIdentifier]:C6,[b.SyntaxKind.PropertyAccessExpression]:oL,[b.SyntaxKind.PropertyAssignment]:yM,[b.SyntaxKind.PropertyDeclaration]:Nw,[b.SyntaxKind.PropertySignature]:QF,[b.SyntaxKind.RegularExpressionLiteral]:_6,[b.SyntaxKind.ReturnStatement]:XM,[b.SyntaxKind.SetAccessor]:Iw,[b.SyntaxKind.ShorthandPropertyAssignment]:vM,[b.SyntaxKind.SpreadAssignment]:hM,[b.SyntaxKind.SpreadElement]:DM,[b.SyntaxKind.StringLiteral]:g6,[b.SyntaxKind.SwitchStatement]:YM,[b.SyntaxKind.SyntaxList]:YR,[b.SyntaxKind.TaggedTemplateExpression]:v6,[b.SyntaxKind.TemplateExpression]:h6,[b.SyntaxKind.TemplateHead]:E6,[b.SyntaxKind.TemplateLiteralType]:Jw,[b.SyntaxKind.TemplateMiddle]:b6,[b.SyntaxKind.TemplateSpan]:S6,[b.SyntaxKind.TemplateTail]:T6,[b.SyntaxKind.ThisType]:zw,[b.SyntaxKind.ThrowStatement]:QM,[b.SyntaxKind.TryStatement]:ZM,[b.SyntaxKind.TupleType]:$w,[b.SyntaxKind.TypeAliasDeclaration]:Xw,[b.SyntaxKind.TypeAssertionExpression]:LM,[b.SyntaxKind.TypeLiteral]:Yw,[b.SyntaxKind.TypeOperator]:Qw,[b.SyntaxKind.TypeParameter]:Zw,[b.SyntaxKind.TypePredicate]:eF,[b.SyntaxKind.TypeQuery]:rF,[b.SyntaxKind.TypeReference]:tF,[b.SyntaxKind.UnionType]:nF,[b.SyntaxKind.VariableDeclaration]:L6,[b.SyntaxKind.VariableDeclarationList]:N6,[b.SyntaxKind.VariableStatement]:gw,[b.SyntaxKind.JSDoc]:Ow,[b.SyntaxKind.TypeOfExpression]:NM,[b.SyntaxKind.WhileStatement]:yw,[b.SyntaxKind.WithStatement]:vw,[b.SyntaxKind.YieldExpression]:PM,[b.SyntaxKind.SemicolonToken]:Tr,[b.SyntaxKind.AnyKeyword]:oc,[b.SyntaxKind.BooleanKeyword]:oc,[b.SyntaxKind.FalseKeyword]:f6,[b.SyntaxKind.ImportKeyword]:dM,[b.SyntaxKind.InferKeyword]:Tr,[b.SyntaxKind.NeverKeyword]:Tr,[b.SyntaxKind.NullKeyword]:p6,[b.SyntaxKind.NumberKeyword]:oc,[b.SyntaxKind.ObjectKeyword]:oc,[b.SyntaxKind.StringKeyword]:oc,[b.SyntaxKind.SymbolKeyword]:oc,[b.SyntaxKind.SuperKeyword]:CM,[b.SyntaxKind.ThisKeyword]:AM,[b.SyntaxKind.TrueKeyword]:d6,[b.SyntaxKind.UndefinedKeyword]:oc,[b.SyntaxKind.VoidExpression]:IM},BH=class{constructor(r){this.context=r,this.sourceFileCacheByFilePath=new Map,this.diagnosticCache=new b.WeakCache,this.definitionInfoCache=new b.WeakCache,this.documentSpanCache=new b.WeakCache,this.diagnosticMessageChainCache=new b.WeakCache,this.jsDocTagInfoCache=new b.WeakCache,this.signatureCache=new b.WeakCache,this.symbolCache=new b.WeakCache,this.symbolDisplayPartCache=new b.WeakCache,this.referencedSymbolEntryCache=new b.WeakCache,this.referencedSymbolCache=new b.WeakCache,this.referencedSymbolDefinitionInfoCache=new b.WeakCache,this.typeCache=new b.WeakCache,this.typeParameterCache=new b.WeakCache,this.nodeCache=new GH,this.sourceFileAddedEventContainer=new b.EventContainer,this.sourceFileRemovedEventContainer=new b.EventContainer,this.documentRegistry=new b.DocumentRegistry(r.fileSystemWrapper),this.directoryCache=new FH(r),this.context.compilerOptions.onModified(()=>{let n=Array.from(this.sourceFileCacheByFilePath.values());for(let i of n)T7e(i)})}*getSourceFilesByDirectoryDepth(){for(let r of this.getDirectoriesByDepth())yield*r.getSourceFiles()}getSourceFilePaths(){return this.sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(r){return this.directoryCache.getChildDirectoriesOfDirectory(r)}getChildSourceFilesOfDirectory(r){return this.directoryCache.getChildSourceFilesOfDirectory(r)}onSourceFileAdded(r,n=!0){n?this.sourceFileAddedEventContainer.subscribe(r):this.sourceFileAddedEventContainer.unsubscribe(r)}onSourceFileRemoved(r){this.sourceFileRemovedEventContainer.subscribe(r)}createSourceFile(r,n,i){if(n=n instanceof Function?Xg(this.context.createWriter(),n):n||"",typeof n=="string")return this.createSourceFileFromText(r,n,i);let a=this.context.createWriter();return this.context.structurePrinterFactory.forSourceFile({isAmbient:b.FileUtils.getExtension(r)===".d.ts"}).printText(a,n),this.createSourceFileFromText(r,a.toString(),i)}createSourceFileFromText(r,n,i){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),i.overwrite===!0?this.createOrOverwriteSourceFileFromText(r,n,i):(this.throwIfFileExists(r,"Did you mean to provide the overwrite option?"),this.createSourceFileFromTextInternal(r,n,i))}throwIfFileExists(r,n){if(!(!this.containsSourceFileAtPath(r)&&!this.context.fileSystemWrapper.fileExistsSync(r)))throw n=n==null?"":n+" ",new b.errors.InvalidOperationError(`${n}A source file already exists at the provided file path: ${r}`)}createOrOverwriteSourceFileFromText(r,n,i){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let a=this.addOrGetSourceFileFromFilePath(r,i);return a!=null?(a.getChildren().forEach(s=>s.forget()),this.replaceCompilerNode(a,this.createCompilerSourceFileFromText(r,n,i.scriptKind)),a):this.createSourceFileFromTextInternal(r,n,i)}getSourceFileFromCacheFromFilePath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.get(r)}addOrGetSourceFileFromFilePath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.sourceFileCacheByFilePath.get(r);if(i==null){let a=this.context.fileSystemWrapper.readFileIfExistsSync(r,this.context.getEncoding());a!=null&&(this.context.logger.log(`Loaded file: ${r}`),i=this.createSourceFileFromTextInternal(r,a,n),i._setIsSaved(!0))}return i!=null&&n.markInProject&&i._markAsInProject(),i}containsSourceFileAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.has(r)}containsDirectoryAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.directoryCache.has(r)}getSourceFileForNode(r){let n=r;for(;n.kind!==b.SyntaxKind.SourceFile;){if(n.parent==null)return;n=n.parent}return this.getSourceFile(n,{markInProject:!1})}hasCompilerNode(r){return this.nodeCache.has(r)}getExistingNodeFromCompilerNode(r){return this.nodeCache.get(r)}getNodeFromCompilerNode(r,n){if(r.kind===b.SyntaxKind.SourceFile)return this.getSourceFile(r,{markInProject:!1});return this.nodeCache.getOrCreate(r,()=>{let u=i.call(this);return s.call(this,u),u});function i(){if(a(r))return p_.isCommentStatement(r)?new FM(this.context,r,n):p_.isCommentClassElement(r)?new Cw(this.context,r,n):p_.isCommentTypeElement(r)?new JF(this.context,r,n):p_.isCommentObjectLiteralElement(r)?new _M(this.context,r,n):p_.isCommentEnumMember(r)?new WF(this.context,r,n):b.errors.throwNotImplementedForNeverValueError(r);let u=sUe[r.kind]||Tr;return new u(this.context,r,n)}function a(u){return u._commentKind!=null}function s(u){if(r.parent!=null){let f=this.getNodeFromCompilerNode(r.parent,n);f._wrappedChildCount++}let p=u._getParentSyntaxListIfWrapped();if(p!=null&&p._wrappedChildCount++,r.kind===b.SyntaxKind.SyntaxList){let f=0;for(let m of u._getChildrenInCacheIterator())f++;u._wrappedChildCount=f}}}createSourceFileFromTextInternal(r,n,i){let a=b.StringUtils.hasBom(n);a&&(n=b.StringUtils.stripBom(n));let s=this.getSourceFile(this.createCompilerSourceFileFromText(r,n,i.scriptKind),i);return a&&(s._hasBom=!0),s}createCompilerSourceFileFromText(r,n,i){return this.documentRegistry.createOrUpdateSourceFile(r,this.context.compilerOptions.get(),b.ts.ScriptSnapshot.fromString(n),i)}getSourceFile(r,n){var i;let a=!1,s=(i=this.sourceFileCacheByFilePath.get(r.fileName))!==null&&i!==void 0?i:this.nodeCache.getOrCreate(r,()=>{let u=new kE(this.context,r);return n.markInProject||this.context.inProjectCoordinator.setSourceFileNotInProject(u),this.addSourceFileToCache(u),a=!0,u});return n.markInProject&&s._markAsInProject(),a&&this.sourceFileAddedEventContainer.fire(s),s}addSourceFileToCache(r){this.sourceFileCacheByFilePath.set(r.getFilePath(),r),this.context.fileSystemWrapper.removeFileDelete(r.getFilePath()),this.directoryCache.addSourceFile(r)}getDirectoryFromPath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.directoryCache.get(r);return i==null&&this.context.fileSystemWrapper.directoryExistsSync(r)&&(i=this.directoryCache.createOrAddIfExists(r)),i!=null&&n.markInProject&&i._markAsInProject(),i}createDirectoryOrAddIfExists(r,n){let i=this.directoryCache.createOrAddIfExists(r);return i!=null&&n.markInProject&&i._markAsInProject(),i}getDirectoryFromCache(r){return this.directoryCache.get(r)}getDirectoryFromCacheOnlyIfInCache(r){return this.directoryCache.has(r)?this.directoryCache.get(r):void 0}getDirectoriesByDepth(){return this.directoryCache.getAllByDepth()}getOrphanDirectories(){return this.directoryCache.getOrphans()}getSymbolDisplayPart(r){return this.symbolDisplayPartCache.getOrCreate(r,()=>new B6(r))}getType(r){return(r.flags&b.TypeFlags.TypeParameter)===b.TypeFlags.TypeParameter?this.getTypeParameter(r):this.typeCache.getOrCreate(r,()=>new yL(this.context,r))}getTypeParameter(r){return this.typeParameterCache.getOrCreate(r,()=>new W6(this.context,r))}getSignature(r){return this.signatureCache.getOrCreate(r,()=>new I6(this.context,r))}getSymbol(r){return this.symbolCache.getOrCreate(r,()=>new P6(this.context,r))}getDefinitionInfo(r){return this.definitionInfoCache.getOrCreate(r,()=>new GD(this.context,r))}getDocumentSpan(r){return this.documentSpanCache.getOrCreate(r,()=>new pv(this.context,r))}getReferencedSymbolEntry(r){return this.referencedSymbolEntryCache.getOrCreate(r,()=>new F6(this.context,r))}getReferencedSymbol(r){return this.referencedSymbolCache.getOrCreate(r,()=>new mL(this.context,r))}getReferencedSymbolDefinitionInfo(r){return this.referencedSymbolDefinitionInfoCache.getOrCreate(r,()=>new _L(this.context,r))}getDiagnostic(r){return this.diagnosticCache.getOrCreate(r,()=>r.start!=null?new cL(this.context,r):new WT(this.context,r))}getDiagnosticWithLocation(r){return this.diagnosticCache.getOrCreate(r,()=>new cL(this.context,r))}getDiagnosticMessageChain(r){return this.diagnosticMessageChainCache.getOrCreate(r,()=>new pS(r))}getJSDocTagInfo(r){return this.jsDocTagInfoCache.getOrCreate(r,()=>new lL(r))}replaceCompilerNode(r,n){let i=r instanceof Tr?r.compilerNode:r,a=r instanceof Tr?r:this.nodeCache.get(r);if(i.kind===b.SyntaxKind.SourceFile&&i.fileName!==n.fileName){let s=a;this.removeCompilerNodeFromCache(i),s._replaceCompilerNodeFromFactory(n),this.nodeCache.set(n,s),this.addSourceFileToCache(s),this.sourceFileAddedEventContainer.fire(s)}else this.nodeCache.replaceKey(i,n),a?._replaceCompilerNodeFromFactory(n)}removeNodeFromCache(r){this.removeCompilerNodeFromCache(r.compilerNode)}removeCompilerNodeFromCache(r){if(this.nodeCache.removeByKey(r),r.kind===b.SyntaxKind.SourceFile){let n=r,i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName);this.directoryCache.removeSourceFile(i);let a=this.sourceFileCacheByFilePath.get(i);this.sourceFileCacheByFilePath.delete(i),this.documentRegistry.removeSourceFile(i),a!=null&&this.sourceFileRemovedEventContainer.fire(a)}}addDirectoryToCache(r){this.directoryCache.addDirectory(r)}removeDirectoryFromCache(r){this.directoryCache.remove(r)}forgetNodesCreatedInBlock(r){this.nodeCache.setForgetPoint();let n=!1,i;try{if(i=r((...s)=>{for(let u of s)this.nodeCache.rememberNode(u)}),Tr.isNode(i)&&this.nodeCache.rememberNode(i),a(i))return n=!0,i.then(s=>(Tr.isNode(s)&&this.nodeCache.rememberNode(s),this.nodeCache.forgetLastPoint(),s))}finally{n||this.nodeCache.forgetLastPoint()}return i;function a(s){return s!=null&&typeof s.then=="function"}}},UH=class{constructor(r){this.compilerFactory=r,this.notInProjectFiles=new Set,r.onSourceFileRemoved(n=>{this.notInProjectFiles.delete(n)})}setSourceFileNotInProject(r){this.notInProjectFiles.add(r),r._inProject=!1}markSourceFileAsInProject(r){this.isSourceFileInProject(r)||(this._internalMarkSourceFileAsInProject(r),this.notInProjectFiles.delete(r))}markSourceFilesAsInProjectForResolution(){let r="/node_modules/",n=this.compilerFactory,i=[],a=[];for(let u of[...this.notInProjectFiles.values()])s(u)?(this._internalMarkSourceFileAsInProject(u),this.notInProjectFiles.delete(u),i.push(u)):a.push(u);return{changedSourceFiles:i,unchangedSourceFiles:a};function s(u){let p=u.getFilePath(),f=p.toLowerCase().lastIndexOf(r);if(f===-1)return!0;let m=p.substring(0,f+r.length-1),g=n.getDirectoryFromCacheOnlyIfInCache(m);if(g!=null&&g._isInProject())return!0;let D=u.getDirectory();for(;D!=null&&D.getPath()!==m;){if(D._isInProject())return!0;D=n.getDirectoryFromCacheOnlyIfInCache(b.FileUtils.getDirPath(D.getPath()))}return!1}}_internalMarkSourceFileAsInProject(r){r._inProject=!0,this.markDirectoryAsInProject(r.getDirectory())}isSourceFileInProject(r){return r._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(r){for(let n of r.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(n);for(let n of r.getSourceFiles())delete n._inProject,this.notInProjectFiles.add(n);delete r._inProject}markDirectoryAsInProject(r){if(this.isDirectoryInProject(r))return;let n=this,i=this.compilerFactory;r._inProject=!0,a(r);function a(u){let p=Array.from(s(u)),f=p[p.length-1];if(!(f==null||!n.isDirectoryInProject(f)))for(let m of p)m._inProject=!0}function*s(u){if(b.FileUtils.isRootDirPath(u.getPath()))return;let p=b.FileUtils.getDirPath(u.getPath()),f=i.getDirectoryFromCacheOnlyIfInCache(p);f!=null&&(yield f,n.isDirectoryInProject(f)||(yield*s(f)))}}isDirectoryInProject(r){return r._inProject===!0}},Vo=class{constructor(r){this._getFormatCodeSettings=r}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new Oj}forModifierableNode(){return new kj}forReturnTypedNode(r){return new Rj(r)}forTypedNode(r,n){return new Mj(r,n)}forClassDeclaration(r){return new Fj(this,r)}forClassMember(r){return new Gj(this,r)}forClassStaticBlockDeclaration(){return new Bj(this)}forConstructorDeclaration(r){return new Uj(this,r)}forGetAccessorDeclaration(r){return new Kj(this,r)}forMethodDeclaration(r){return new Wj(this,r)}forPropertyDeclaration(){return new Vj(this)}forSetAccessorDeclaration(r){return new jj(this,r)}forDecorator(){return new Hj(this)}forJSDoc(){return new qj(this)}forJSDocTag(r){return new Jj(this,r)}forEnumDeclaration(){return new zj(this)}forEnumMember(){return new $j(this)}forObjectLiteralExpressionProperty(){return new Xj(this)}forPropertyAssignment(){return new Yj(this)}forShorthandPropertyAssignment(){return new Qj(this)}forSpreadAssignment(){return new Zj(this)}forFunctionDeclaration(r){return new eH(this,r)}forParameterDeclaration(){return new rH(this)}forCallSignatureDeclaration(){return new tH(this)}forConstructSignatureDeclaration(){return new nH(this)}forIndexSignatureDeclaration(){return new iH(this)}forInterfaceDeclaration(){return new aH(this)}forMethodSignature(){return new oH(this)}forPropertySignature(){return new sH(this)}forTypeElementMemberedNode(){return new lH(this)}forTypeElementMember(){return new uH(this)}forJsxAttributeDecider(){return new cH(this)}forJsxAttribute(){return new dH(this)}forJsxChildDecider(){return new fH(this)}forJsxElement(){return new pH(this)}forJsxSelfClosingElement(){return new mH(this)}forJsxSpreadAttribute(){return new _H(this)}forAssertEntry(){return new gH(this)}forExportAssignment(){return new yH(this)}forExportDeclaration(){return new vH(this)}forImportDeclaration(){return new hH(this)}forModuleDeclaration(r){return new EH(this,r)}forNamedImportExportSpecifier(){return new bH(this)}forSourceFile(r){return new SH(this,r)}forStatementedNode(r){return new TH(this,r)}forStatement(r){return new xH(this,r)}forVariableStatement(){return new DH(this)}forTypeAliasDeclaration(){return new CH(this)}forTypeParameterDeclaration(){return new AH(this)}forVariableDeclaration(){return new LH(this)}};co([b.Memoize],Vo.prototype,"forInitializerExpressionableNode",null);co([b.Memoize],Vo.prototype,"forModifierableNode",null);co([b.Memoize],Vo.prototype,"forReturnTypedNode",null);co([b.Memoize],Vo.prototype,"forTypedNode",null);co([b.Memoize],Vo.prototype,"forClassDeclaration",null);co([b.Memoize],Vo.prototype,"forClassMember",null);co([b.Memoize],Vo.prototype,"forClassStaticBlockDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructorDeclaration",null);co([b.Memoize],Vo.prototype,"forGetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodDeclaration",null);co([b.Memoize],Vo.prototype,"forPropertyDeclaration",null);co([b.Memoize],Vo.prototype,"forSetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forDecorator",null);co([b.Memoize],Vo.prototype,"forJSDoc",null);co([b.Memoize],Vo.prototype,"forJSDocTag",null);co([b.Memoize],Vo.prototype,"forEnumDeclaration",null);co([b.Memoize],Vo.prototype,"forEnumMember",null);co([b.Memoize],Vo.prototype,"forObjectLiteralExpressionProperty",null);co([b.Memoize],Vo.prototype,"forPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forShorthandPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forSpreadAssignment",null);co([b.Memoize],Vo.prototype,"forFunctionDeclaration",null);co([b.Memoize],Vo.prototype,"forParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forCallSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forIndexSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forInterfaceDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodSignature",null);co([b.Memoize],Vo.prototype,"forPropertySignature",null);co([b.Memoize],Vo.prototype,"forTypeElementMemberedNode",null);co([b.Memoize],Vo.prototype,"forTypeElementMember",null);co([b.Memoize],Vo.prototype,"forJsxAttributeDecider",null);co([b.Memoize],Vo.prototype,"forJsxAttribute",null);co([b.Memoize],Vo.prototype,"forJsxChildDecider",null);co([b.Memoize],Vo.prototype,"forJsxElement",null);co([b.Memoize],Vo.prototype,"forJsxSelfClosingElement",null);co([b.Memoize],Vo.prototype,"forJsxSpreadAttribute",null);co([b.Memoize],Vo.prototype,"forAssertEntry",null);co([b.Memoize],Vo.prototype,"forExportAssignment",null);co([b.Memoize],Vo.prototype,"forExportDeclaration",null);co([b.Memoize],Vo.prototype,"forImportDeclaration",null);co([b.Memoize],Vo.prototype,"forModuleDeclaration",null);co([b.Memoize],Vo.prototype,"forNamedImportExportSpecifier",null);co([b.Memoize],Vo.prototype,"forSourceFile",null);co([b.Memoize],Vo.prototype,"forStatementedNode",null);co([b.Memoize],Vo.prototype,"forStatement",null);co([b.Memoize],Vo.prototype,"forVariableStatement",null);co([b.Memoize],Vo.prototype,"forTypeAliasDeclaration",null);co([b.Memoize],Vo.prototype,"forTypeParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forVariableDeclaration",null);var BD=class{constructor(r){this.logger=new cj,this.manipulationSettings=new WR,this._project=r.project,this.fileSystemWrapper=r.fileSystemWrapper,this._compilerOptions=r.compilerOptionsContainer,this.compilerFactory=new BH(this),this.inProjectCoordinator=new UH(this.compilerFactory),this.structurePrinterFactory=new Vo(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new dj(this.compilerFactory),this.directoryCoordinator=new wH(this.compilerFactory,r.fileSystemWrapper),this._languageService=r.createLanguageService?new K6({context:this,configFileParsingDiagnostics:r.configFileParsingDiagnostics,resolutionHost:r.resolutionHost&&r.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}):void 0,r.typeChecker!=null&&(b.errors.throwIfTrue(r.createLanguageService,"Cannot specify a type checker and create a language service."),this._customTypeChecker=new gL(this),this._customTypeChecker._reset(()=>r.typeChecker))}get project(){if(this._project==null)throw new b.errors.InvalidOperationError("This operation is not permitted in this context.");return this._project}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 r=this.manipulationSettings.getIndentationText();return new KR.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:r===Oe.IndentationText.Tab?void 0:r.length,useTabs:r===Oe.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===Oe.QuoteKind.Single})}getPreEmitDiagnostics(r){return b.ts.getPreEmitDiagnostics(this.program.compilerObject,r?.compilerNode).map(i=>this.compilerFactory.getDiagnostic(i))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(r,n)=>{var i;return Promise.resolve((i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode)},addOrGetSourceFileFromFilePathSync:(r,n)=>{var i;return(i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode},containsDirectoryAtPath:r=>this.compilerFactory.containsDirectoryAtPath(r),containsSourceFileAtPath:r=>this.compilerFactory.containsSourceFileAtPath(r),getSourceFileFromCacheFromFilePath:r=>{let n=this.compilerFactory.getSourceFileFromCacheFromFilePath(r);return n?.compilerNode},getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:r=>this.compilerFactory.documentRegistry.getSourceFileVersion(r),getChildDirectoriesOfDirectory:r=>{let n=[];for(let i of this.compilerFactory.getChildDirectoriesOfDirectory(r))n.push(i.getPath());return n}}}getModuleResolutionHost(){return b.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}getToolRequiredError(r){return new b.errors.InvalidOperationError(`A ${r} 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 ${r} should be required for this operation.`)}};co([b.Memoize],BD.prototype,"getSourceFileContainer",null);co([b.Memoize],BD.prototype,"getModuleResolutionHost",null);var KH=class{constructor(r={}){var n;f();let i=m(),a=new b.TransactionalFileSystem({fileSystem:i,skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),s=r.tsConfigFilePath==null?void 0:new b.TsConfigResolver(a,a.getStandardizedAbsolutePath(r.tsConfigFilePath),P()),u=g(),p=new b.CompilerOptionsContainer;p.set(u),this._context=new BD({project:this,compilerOptionsContainer:p,fileSystemWrapper:a,createLanguageService:!0,resolutionHost:r.resolutionHost,configFileParsingDiagnostics:(n=s?.getErrors())!==null&&n!==void 0?n:[],skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),r.manipulationSettings!=null&&this._context.manipulationSettings.set(r.manipulationSettings),s!=null&&r.skipAddingFilesFromTsConfig!==!0&&(this._addSourceFilesForTsConfigResolver(s,u),r.skipFileDependencyResolution||this.resolveSourceFileDependencies());function f(){if(r.fileSystem!=null&&r.useInMemoryFileSystem)throw new b.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function m(){var B;return r.useInMemoryFileSystem?new b.InMemoryFileSystemHost:(B=r.fileSystem)!==null&&B!==void 0?B:new b.RealFileSystemHost}function g(){var B;return{...D(),...(B=r.compilerOptions)!==null&&B!==void 0?B:{}}}function D(){var B;return(B=s?.getCompilerOptions())!==null&&B!==void 0?B:{}}function P(){var B;let K="utf-8";return r.compilerOptions!=null&&(B=r.compilerOptions.charset)!==null&&B!==void 0?B:K}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let r=new Set,n=u=>r.add(u),{compilerFactory:i,inProjectCoordinator:a}=this._context;i.onSourceFileAdded(n);try{this.getProgram().compilerObject}finally{i.onSourceFileAdded(n,!1)}let s=a.markSourceFilesAsInProjectForResolution();for(let u of s.changedSourceFiles)r.add(u);for(let u of s.unchangedSourceFiles)r.delete(u);return Array.from(r.values())}addDirectoryAtPathIfExists(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}addDirectoryAtPath(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}createDirectory(r){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r)}`)}getDirectory(r){let{compilerFactory:n}=this._context;return n.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r))}getDirectories(){return Array.from(this._getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator:r}=this._context,n=[];for(let a of this._context.compilerFactory.getOrphanDirectories())for(let s of i(a))n.push(s);return n;function*i(a){if(r.isDirectoryInProject(a)){yield a;return}for(let s of a._getDirectoriesIterator())yield*i(s)}}addSourceFilesAtPaths(r){return this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:!0})}addSourceFileAtPathIfExists(r){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFileAtPath(r){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFilesFromTsConfig(r){let n=new b.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),this._context.getEncoding());return this._addSourceFilesForTsConfigResolver(n,n.getCompilerOptions())}_addSourceFilesForTsConfigResolver(r,n){let i=r.getPaths(n),a=i.filePaths.map(s=>this.addSourceFileAtPath(s));for(let s of i.directoryPaths)this.addDirectoryAtPathIfExists(s);return a}createSourceFile(r,n,i){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),n??"",{...i??{},markInProject:!0})}removeSourceFile(r){let n=r.wasForgotten();return r.forget(),!n}getSourceFileOrThrow(r){let n=this.getSourceFile(r);if(n!=null)return n;if(typeof r=="string"){let i=b.FileUtils.standardizeSlashes(r);if(b.FileUtils.pathIsAbsolute(i)||i.indexOf("/")>=0){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i);throw new b.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${a}`)}else throw new b.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${r}`)}else throw new b.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(r){let n=i(this._context.fileSystemWrapper);if(a(n))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n);return b.IterableUtils.find(this._getProjectSourceFilesByDirectoryDepth(),n);function i(s){if(r instanceof Function)return r;let u=b.FileUtils.standardizeSlashes(r);return b.FileUtils.pathIsAbsolute(u)||u.indexOf("/")>=0?s.getStandardizedAbsolutePath(u):p=>b.FileUtils.pathEndsWith(p.getFilePath(),u)}function a(s){return typeof s=="string"}}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this._getProjectSourceFilesByDirectoryDepth();if(typeof r=="string"||r instanceof Array)return Array.from(s());return Array.from(a);function*s(){let u=Array.from(f()),p=b.matchGlobs(u,r,i.getCurrentDirectory());for(let m of p)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(m));function*f(){for(let m of a)yield m.getFilePath()}}}*_getProjectSourceFilesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getSourceFilesByDirectoryDepth())n.isSourceFileInProject(i)&&(yield i)}*_getProjectDirectoriesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getDirectoriesByDepth())n.isDirectoryInProject(i)&&(yield i)}getAmbientModule(r){return r=Pfe(r),this.getAmbientModules().find(n=>n.getName()===r)}getAmbientModuleOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAmbientModule(r),()=>`Could not find ambient module with name: ${Pfe(r)}`)}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this._getUnsavedSourceFiles().map(r=>r.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let r of this._getUnsavedSourceFiles())r.saveSync()}enableLogging(r=!0){this._context.logger.setEnabled(r)}_getUnsavedSourceFiles(){return Array.from(r(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*r(n){for(let i of n)i.isSaved()||(yield i)}}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(r={}){return this._context.program.emit(r)}emitSync(r={}){return this._context.program.emitSync(r)}emitToMemory(r={}){return this._context.program.emitToMemory(r)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(r){return this._context.compilerFactory.forgetNodesCreatedInBlock(r)}formatDiagnosticsWithColorAndContext(r,n={}){return b.ts.formatDiagnosticsWithColorAndContext(r.map(i=>i.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:i=>i,getNewLine:()=>{var i;return(i=n.newLineChar)!==null&&i!==void 0?i:b.runtime.getEndOfLine()}})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function Pfe(e){return r(e[0])&&r(e[e.length-1])&&(e=e.substring(1,e.length-1)),`"${e}"`;function r(n){return n==='"'||n==="'"}}function lUe(e,r={}){let{compilerOptions:n={},sourceFile:i,typeChecker:a}=r,s=new b.CompilerOptionsContainer;s.set(n);let u=new BD({project:void 0,fileSystemWrapper:new b.TransactionalFileSystem({fileSystem:new b.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer:s,createLanguageService:!1,typeChecker:a,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),p=u.compilerFactory.getSourceFile(f(),{markInProject:!0});return u.compilerFactory.getNodeFromCompilerNode(e,p);function f(){return i??m(e)}function m(g){if(g.kind===b.SyntaxKind.SourceFile)return g;if(g.parent==null)throw new b.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let D=g;for(;D.parent!=null;)D=D.parent;if(D.kind!==b.SyntaxKind.SourceFile)throw new b.errors.NotImplementedError("For some reason the top parent was not a source file.");return D}}var uUe=new Vo(()=>{throw new b.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),WH=class{constructor(){}static object(r){return n=>{let i=Object.keys(r);n.write("{"),i.length>0&&n.indent(()=>{a()}),n.write("}");function a(){for(let s=0;s<i.length;s++){s>0&&n.write(",").newLine();let u=i[s],p=r[u];n.write(u),p!=null&&(n.write(": "),eL(n,p))}n.newLine()}}}static objectType(r){return n=>{n.write("{"),cUe(r)&&n.indent(()=>{uUe.forTypeElementMemberedNode().printText(n,r)}),n.write("}")}}static unionType(r,n,...i){return Ofe("|",[r,n,...i])}static intersectionType(r,n,...i){return Ofe("&",[r,n,...i])}static assertion(r,n){return i=>{eL(i,r),i.spaceIfLastNot().write("as "),eL(i,n)}}static returnStatement(r){return n=>{n.write("return "),n.hangingIndentUnlessBlock(()=>{eL(n,r),n.write(";")})}}};function Ofe(e,r){return n=>{dUe(n,` ${e} `,r)}}function cUe(e){for(let r of Object.keys(e))if(e[r]!=null&&!(e[r]instanceof Array&&e[r].length===0))return!0;return!1}function dUe(e,r,n){for(let i=0;i<n.length;i++)e.conditionalWrite(i>0,r),eL(e,n[i])}function eL(e,r){r instanceof Function?r(e):e.write(r.toString())}var{InvalidOperationError:fUe,FileNotFoundError:pUe,ArgumentError:mUe,ArgumentNullOrWhitespaceError:_Ue,ArgumentOutOfRangeError:gUe,ArgumentTypeError:yUe,BaseError:vUe,DirectoryNotFoundError:hUe,NotImplementedError:EUe,NotSupportedError:bUe,PathNotFoundError:SUe}=b.errors;Object.defineProperty(Oe,"CompilerOptionsContainer",{enumerable:!0,get:function(){return b.CompilerOptionsContainer}});Object.defineProperty(Oe,"DiagnosticCategory",{enumerable:!0,get:function(){return b.DiagnosticCategory}});Object.defineProperty(Oe,"EmitHint",{enumerable:!0,get:function(){return b.EmitHint}});Object.defineProperty(Oe,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return b.InMemoryFileSystemHost}});Object.defineProperty(Oe,"LanguageVariant",{enumerable:!0,get:function(){return b.LanguageVariant}});Object.defineProperty(Oe,"ModuleKind",{enumerable:!0,get:function(){return b.ModuleKind}});Object.defineProperty(Oe,"ModuleResolutionKind",{enumerable:!0,get:function(){return b.ModuleResolutionKind}});Object.defineProperty(Oe,"NewLineKind",{enumerable:!0,get:function(){return b.NewLineKind}});Object.defineProperty(Oe,"NodeFlags",{enumerable:!0,get:function(){return b.NodeFlags}});Object.defineProperty(Oe,"ObjectFlags",{enumerable:!0,get:function(){return b.ObjectFlags}});Object.defineProperty(Oe,"ResolutionHosts",{enumerable:!0,get:function(){return b.ResolutionHosts}});Object.defineProperty(Oe,"ScriptKind",{enumerable:!0,get:function(){return b.ScriptKind}});Object.defineProperty(Oe,"ScriptTarget",{enumerable:!0,get:function(){return b.ScriptTarget}});Object.defineProperty(Oe,"SettingsContainer",{enumerable:!0,get:function(){return b.SettingsContainer}});Object.defineProperty(Oe,"SymbolFlags",{enumerable:!0,get:function(){return b.SymbolFlags}});Object.defineProperty(Oe,"SyntaxKind",{enumerable:!0,get:function(){return b.SyntaxKind}});Object.defineProperty(Oe,"TypeFlags",{enumerable:!0,get:function(){return b.TypeFlags}});Object.defineProperty(Oe,"TypeFormatFlags",{enumerable:!0,get:function(){return b.TypeFormatFlags}});Object.defineProperty(Oe,"ts",{enumerable:!0,get:function(){return b.ts}});Object.defineProperty(Oe,"CodeBlockWriter",{enumerable:!0,get:function(){return KR.default}});Oe.AbstractableNode=gS;Oe.AmbientableNode=Ph;Oe.ArgumentError=mUe;Oe.ArgumentNullOrWhitespaceError=_Ue;Oe.ArgumentOutOfRangeError=gUe;Oe.ArgumentTypeError=yUe;Oe.ArgumentedNode=zH;Oe.ArrayBindingPattern=eM;Oe.ArrayDestructuringAssignment=NH;Oe.ArrayDestructuringAssignmentBase=mpe;Oe.ArrayLiteralExpression=iM;Oe.ArrayTypeNode=kw;Oe.ArrowFunction=hw;Oe.ArrowFunctionBase=Sme;Oe.AsExpression=aM;Oe.AsExpressionBase=_pe;Oe.AssertClause=ew;Oe.AssertClauseBase=cme;Oe.AssertEntry=rw;Oe.AssertEntryBase=sR;Oe.AssertionKeyNamedNode=spe;Oe.AssignmentExpression=iL;Oe.AssignmentExpressionBase=ppe;Oe.AsyncableNode=jT;Oe.AwaitExpression=oM;Oe.AwaitExpressionBase=gpe;Oe.AwaitableNode=Qfe;Oe.BaseError=vUe;Oe.BaseExpressionedNode=jD;Oe.BigIntLiteral=c6;Oe.BigIntLiteralBase=Zme;Oe.BinaryExpression=nL;Oe.BinaryExpressionBase=fpe;Oe.BindingElement=rM;Oe.BindingElementBase=dpe;Oe.BindingNamedNode=$6;Oe.Block=OM;Oe.BlockBase=Hpe;Oe.BodiedNode=H6;Oe.BodyableNode=HT;Oe.BreakStatement=kM;Oe.CallExpression=sM;Oe.CallExpressionBase=ype;Oe.CallSignatureDeclaration=qF;Oe.CallSignatureDeclarationBase=IR;Oe.CaseBlock=RM;Oe.CaseBlockBase=qpe;Oe.CaseClause=MM;Oe.CaseClauseBase=Jpe;Oe.CatchClause=wM;Oe.CatchClauseBase=zpe;Oe.ChildOrderableNode=Im;Oe.ClassDeclaration=Tw;Oe.ClassDeclarationBase=yR;Oe.ClassElement=$g;Oe.ClassExpression=xw;Oe.ClassExpressionBase=Lme;Oe.ClassLikeDeclarationBase=aq;Oe.ClassLikeDeclarationBaseSpecific=Cme;Oe.ClassStaticBlockDeclaration=Dw;Oe.ClassStaticBlockDeclarationBase=vR;Oe.CodeAction=O6;Oe.CodeFixAction=k6;Oe.CombinedCodeActions=uL;Oe.CommaListExpression=lM;Oe.CommaListExpressionBase=vpe;Oe.CommentClassElement=Cw;Oe.CommentEnumMember=WF;Oe.CommentObjectLiteralElement=_M;Oe.CommentRange=XR;Oe.CommentStatement=FM;Oe.CommentTypeElement=JF;Oe.CommonIdentifierBase=uq;Oe.CompilerCommentClassElement=jR;Oe.CompilerCommentEnumMember=JR;Oe.CompilerCommentNode=sS;Oe.CompilerCommentObjectLiteralElement=qR;Oe.CompilerCommentStatement=VR;Oe.CompilerCommentTypeElement=HR;Oe.ComputedPropertyName=x6;Oe.ComputedPropertyNameBase=p_e;Oe.ConditionalExpression=uM;Oe.ConditionalExpressionBase=hpe;Oe.ConditionalTypeNode=Rw;Oe.ConstructSignatureDeclaration=zF;Oe.ConstructSignatureDeclarationBase=PR;Oe.ConstructorDeclaration=Aw;Oe.ConstructorDeclarationBase=hR;Oe.ConstructorDeclarationOverloadBase=Nme;Oe.ConstructorTypeNode=Mw;Oe.ConstructorTypeNodeBase=kme;Oe.ContinueStatement=GM;Oe.DebuggerStatement=BM;Oe.DebuggerStatementBase=$pe;Oe.DecoratableNode=qT;Oe.Decorator=Pw;Oe.DecoratorBase=TR;Oe.DefaultClause=UM;Oe.DefaultClauseBase=Xpe;Oe.DefinitionInfo=GD;Oe.DeleteExpression=cM;Oe.DeleteExpressionBase=Epe;Oe.Diagnostic=WT;Oe.DiagnosticMessageChain=pS;Oe.DiagnosticWithLocation=cL;Oe.Directory=OE;Oe.DirectoryEmitResult=vL;Oe.DirectoryNotFoundError=hUe;Oe.DoStatement=KM;Oe.DoStatementBase=Ype;Oe.DocumentSpan=pv;Oe.DotDotDotTokenableNode=hL;Oe.ElementAccessExpression=aL;Oe.ElementAccessExpressionBase=bpe;Oe.EmitOutput=dL;Oe.EmitResult=VT;Oe.EmptyStatement=WM;Oe.EmptyStatementBase=Qpe;Oe.EnumDeclaration=VF;Oe.EnumDeclarationBase=LR;Oe.EnumMember=jF;Oe.EnumMemberBase=NR;Oe.ExclamationTokenableNode=XH;Oe.ExportAssignment=tw;Oe.ExportAssignmentBase=kH;Oe.ExportDeclaration=nw;Oe.ExportDeclarationBase=lR;Oe.ExportGetableNode=YH;Oe.ExportSpecifier=iw;Oe.ExportSpecifierBase=RH;Oe.ExportableNode=BE;Oe.Expression=oc;Oe.ExpressionStatement=VM;Oe.ExpressionStatementBase=Zpe;Oe.ExpressionWithTypeArguments=ww;Oe.ExpressionWithTypeArgumentsBase=Rme;Oe.ExpressionableNode=TL;Oe.ExpressionedNode=ud;Oe.ExtendsClauseableNode=ape;Oe.ExternalModuleReference=aw;Oe.ExternalModuleReferenceBase=dme;Oe.FalseLiteral=f6;Oe.FalseLiteralBase=r_e;Oe.FileNotFoundError=pUe;Oe.FileReference=kD;Oe.FileTextChanges=fS;Oe.ForInStatement=jM;Oe.ForInStatementBase=eme;Oe.ForOfStatement=HM;Oe.ForOfStatementBase=rme;Oe.ForStatement=qM;Oe.ForStatementBase=tme;Oe.FunctionDeclaration=Ew;Oe.FunctionDeclarationBase=mR;Oe.FunctionDeclarationOverloadBase=Tme;Oe.FunctionExpression=bw;Oe.FunctionExpressionBase=xme;Oe.FunctionLikeDeclaration=YT;Oe.FunctionOrConstructorTypeNodeBase=sL;Oe.FunctionOrConstructorTypeNodeBaseBase=Ome;Oe.FunctionTypeNode=Fw;Oe.FunctionTypeNodeBase=Mme;Oe.GeneratorableNode=zT;Oe.GetAccessorDeclaration=Lw;Oe.GetAccessorDeclarationBase=ER;Oe.HeritageClause=HF;Oe.HeritageClauseableNode=ZH;Oe.Identifier=D6;Oe.IdentifierBase=m_e;Oe.IfStatement=JM;Oe.IfStatementBase=nme;Oe.ImplementationLocation=fL;Oe.ImplementsClauseableNode=ope;Oe.ImportClause=ow;Oe.ImportClauseBase=fme;Oe.ImportDeclaration=sw;Oe.ImportDeclarationBase=uR;Oe.ImportEqualsDeclaration=lw;Oe.ImportEqualsDeclarationBase=mme;Oe.ImportExpression=dM;Oe.ImportExpressionBase=Spe;Oe.ImportExpressionedNode=_9e;Oe.ImportSpecifier=uw;Oe.ImportSpecifierBase=cR;Oe.ImportTypeAssertionContainer=Gw;Oe.ImportTypeNode=Bw;Oe.IndexSignatureDeclaration=$F;Oe.IndexSignatureDeclarationBase=OR;Oe.IndexedAccessTypeNode=Uw;Oe.InferTypeNode=Kw;Oe.InitializerExpressionGetableNode=z6;Oe.InitializerExpressionableNode=$T;Oe.InterfaceDeclaration=XF;Oe.InterfaceDeclarationBase=kR;Oe.IntersectionTypeNode=Ww;Oe.InvalidOperationError=fUe;Oe.IterationStatement=dS;Oe.JSDoc=Ow;Oe.JSDocAllType=iF;Oe.JSDocAugmentsTag=aF;Oe.JSDocAuthorTag=oF;Oe.JSDocBase=xR;Oe.JSDocCallbackTag=sF;Oe.JSDocClassTag=lF;Oe.JSDocDeprecatedTag=uF;Oe.JSDocEnumTag=cF;Oe.JSDocFunctionType=dF;Oe.JSDocFunctionTypeBase=Wme;Oe.JSDocImplementsTag=fF;Oe.JSDocLink=pF;Oe.JSDocLinkCode=mF;Oe.JSDocLinkPlain=_F;Oe.JSDocMemberName=gF;Oe.JSDocNameReference=vF;Oe.JSDocNamepathType=yF;Oe.JSDocNonNullableType=hF;Oe.JSDocNullableType=EF;Oe.JSDocOptionalType=bF;Oe.JSDocOverrideTag=SF;Oe.JSDocParameterTag=TF;Oe.JSDocParameterTagBase=Vme;Oe.JSDocPrivateTag=xF;Oe.JSDocPropertyLikeTag=oq;Oe.JSDocPropertyTag=DF;Oe.JSDocPropertyTagBase=jme;Oe.JSDocProtectedTag=CF;Oe.JSDocPublicTag=AF;Oe.JSDocReadonlyTag=LF;Oe.JSDocReturnTag=NF;Oe.JSDocReturnTagBase=Hme;Oe.JSDocSeeTag=IF;Oe.JSDocSeeTagBase=qme;Oe.JSDocSignature=PF;Oe.JSDocTag=bc;Oe.JSDocTagBase=AR;Oe.JSDocTagInfo=lL;Oe.JSDocTemplateTag=OF;Oe.JSDocTemplateTagBase=Jme;Oe.JSDocText=kF;Oe.JSDocThisTag=RF;Oe.JSDocThisTagBase=zme;Oe.JSDocType=q_;Oe.JSDocTypeExpression=wF;Oe.JSDocTypeExpressionableTag=tG;Oe.JSDocTypeLiteral=FF;Oe.JSDocTypeParameteredTag=Ime;Oe.JSDocTypeTag=GF;Oe.JSDocTypedefTag=MF;Oe.JSDocUnknownTag=BF;Oe.JSDocUnknownType=UF;Oe.JSDocVariadicType=KF;Oe.JSDocableNode=sc;Oe.JsxAttribute=ZF;Oe.JsxAttributeBase=wR;Oe.JsxAttributedNode=sq;Oe.JsxClosingElement=e6;Oe.JsxClosingElementBase=$me;Oe.JsxClosingFragment=r6;Oe.JsxElement=t6;Oe.JsxElementBase=FR;Oe.JsxExpression=n6;Oe.JsxExpressionBase=Xme;Oe.JsxFragment=i6;Oe.JsxOpeningElement=a6;Oe.JsxOpeningElementBase=Yme;Oe.JsxOpeningFragment=o6;Oe.JsxSelfClosingElement=s6;Oe.JsxSelfClosingElementBase=GR;Oe.JsxSpreadAttribute=l6;Oe.JsxSpreadAttributeBase=BR;Oe.JsxTagNamedNode=nG;Oe.JsxText=u6;Oe.JsxTextBase=Qme;Oe.LabeledStatement=zM;Oe.LabeledStatementBase=ime;Oe.LanguageService=K6;Oe.LeftHandSideExpression=MD;Oe.LeftHandSideExpressionedNode=XT;Oe.LiteralExpression=cS;Oe.LiteralExpressionBase=Tpe;Oe.LiteralLikeNode=KD;Oe.LiteralTypeNode=Vw;Oe.ManipulationError=$R;Oe.ManipulationSettingsContainer=WR;Oe.MappedTypeNode=jw;Oe.MemberExpression=BT;Oe.MemoryEmitResult=M6;Oe.MetaProperty=fM;Oe.MetaPropertyBase=xpe;Oe.MethodDeclaration=wD;Oe.MethodDeclarationBase=gR;Oe.MethodDeclarationOverloadBase=Dme;Oe.MethodSignature=YF;Oe.MethodSignatureBase=RR;Oe.ModifierableNode=sf;Oe.ModuleBlock=cw;Oe.ModuleBlockBase=_me;Oe.ModuleChildableNode=yS;Oe.ModuleDeclaration=dw;Oe.ModuleDeclarationBase=dR;Oe.ModuleNamedNode=lpe;Oe.ModuledNode=eq;Oe.NameableNode=X6;Oe.NamedExports=fw;Oe.NamedExportsBase=gme;Oe.NamedImports=pw;Oe.NamedImportsBase=yme;Oe.NamedNode=gv;Oe.NamedNodeBase=WD;Oe.NamedTupleMember=Hw;Oe.NamedTupleMemberBase=wme;Oe.NamespaceExport=mw;Oe.NamespaceExportBase=vme;Oe.NamespaceImport=_w;Oe.NamespaceImportBase=hme;Oe.NewExpression=pM;Oe.NewExpressionBase=Dpe;Oe.NoSubstitutionTemplateLiteral=y6;Oe.NoSubstitutionTemplateLiteralBase=s_e;Oe.Node=Tr;Oe.NodeWithTypeArguments=KT;Oe.NodeWithTypeArgumentsBase=Pme;Oe.NonNullExpression=mM;Oe.NonNullExpressionBase=Cpe;Oe.NotEmittedStatement=$M;Oe.NotEmittedStatementBase=ame;Oe.NotImplementedError=EUe;Oe.NotSupportedError=bUe;Oe.NullLiteral=p6;Oe.NullLiteralBase=n_e;Oe.NumericLiteral=m6;Oe.NumericLiteralBase=i_e;Oe.ObjectBindingPattern=tM;Oe.ObjectDestructuringAssignment=IH;Oe.ObjectDestructuringAssignmentBase=Ape;Oe.ObjectLiteralElement=UT;Oe.ObjectLiteralExpression=gM;Oe.ObjectLiteralExpressionBase=Lpe;Oe.OmittedExpression=EM;Oe.OmittedExpressionBase=Npe;Oe.OutputFile=R6;Oe.OverloadableNode=eG;Oe.OverrideableNode=bL;Oe.ParameterDeclaration=Sw;Oe.ParameterDeclarationBase=_R;Oe.ParameteredNode=upe;Oe.ParenthesizedExpression=bM;Oe.ParenthesizedExpressionBase=Ipe;Oe.ParenthesizedTypeNode=qw;Oe.PartiallyEmittedExpression=SM;Oe.PartiallyEmittedExpressionBase=Ppe;Oe.PathNotFoundError=SUe;Oe.PostfixUnaryExpression=TM;Oe.PostfixUnaryExpressionBase=Ope;Oe.PrefixUnaryExpression=xM;Oe.PrefixUnaryExpressionBase=kpe;Oe.PrimaryExpression=sd;Oe.PrivateIdentifier=C6;Oe.PrivateIdentifierBase=__e;Oe.Program=U6;Oe.Project=KH;Oe.PropertyAccessExpression=oL;Oe.PropertyAccessExpressionBase=Rpe;Oe.PropertyAssignment=yM;Oe.PropertyAssignmentBase=iR;Oe.PropertyDeclaration=Nw;Oe.PropertyDeclarationBase=bR;Oe.PropertyNamedNode=UE;Oe.PropertySignature=QF;Oe.PropertySignatureBase=MR;Oe.QualifiedName=A6;Oe.QuestionDotTokenableNode=Y6;Oe.QuestionTokenableNode=Rh;Oe.ReadonlyableNode=SL;Oe.RefactorEditInfo=pL;Oe.ReferenceEntry=w6;Oe.ReferenceFindableNode=kh;Oe.ReferencedSymbol=mL;Oe.ReferencedSymbolDefinitionInfo=_L;Oe.ReferencedSymbolEntry=F6;Oe.RegularExpressionLiteral=_6;Oe.RegularExpressionLiteralBase=a_e;Oe.RenameLocation=G6;Oe.RenameableNode=_v;Oe.ReturnStatement=XM;Oe.ReturnStatementBase=ome;Oe.ReturnTypedNode=rq;Oe.ScopeableNode=cpe;Oe.ScopedNode=_S;Oe.SetAccessorDeclaration=Iw;Oe.SetAccessorDeclarationBase=SR;Oe.ShorthandPropertyAssignment=vM;Oe.ShorthandPropertyAssignmentBase=aR;Oe.Signature=I6;Oe.SignaturedDeclaration=yv;Oe.SourceFile=kE;Oe.SourceFileBase=fR;Oe.SpreadAssignment=hM;Oe.SpreadAssignmentBase=oR;Oe.SpreadElement=DM;Oe.SpreadElementBase=Mpe;Oe.Statement=Cl;Oe.StatementBase=jpe;Oe.StatementedNode=Mh;Oe.StaticableNode=VD;Oe.StringLiteral=g6;Oe.StringLiteralBase=o_e;Oe.Structure=ZA;Oe.SuperElementAccessExpression=PH;Oe.SuperElementAccessExpressionBase=wpe;Oe.SuperExpression=CM;Oe.SuperExpressionBase=Fpe;Oe.SuperExpressionedNode=iq;Oe.SuperPropertyAccessExpression=OH;Oe.SuperPropertyAccessExpressionBase=Gpe;Oe.SwitchStatement=YM;Oe.SwitchStatementBase=sme;Oe.Symbol=P6;Oe.SymbolDisplayPart=B6;Oe.SyntaxList=YR;Oe.TaggedTemplateExpression=v6;Oe.TemplateExpression=h6;Oe.TemplateExpressionBase=l_e;Oe.TemplateHead=E6;Oe.TemplateHeadBase=u_e;Oe.TemplateLiteralTypeNode=Jw;Oe.TemplateMiddle=b6;Oe.TemplateMiddleBase=c_e;Oe.TemplateSpan=S6;Oe.TemplateSpanBase=d_e;Oe.TemplateTail=T6;Oe.TemplateTailBase=f_e;Oe.TextChange=FE;Oe.TextInsertableNode=ld;Oe.TextRange=rL;Oe.TextSpan=FD;Oe.ThisExpression=AM;Oe.ThisExpressionBase=Bpe;Oe.ThisTypeNode=zw;Oe.ThrowStatement=QM;Oe.ThrowStatementBase=lme;Oe.TrueLiteral=d6;Oe.TrueLiteralBase=e_e;Oe.TryStatement=ZM;Oe.TryStatementBase=ume;Oe.TupleTypeNode=$w;Oe.Type=yL;Oe.TypeAliasDeclaration=Xw;Oe.TypeAliasDeclarationBase=DR;Oe.TypeArgumentedNode=Q6;Oe.TypeAssertion=LM;Oe.TypeAssertionBase=Upe;Oe.TypeChecker=gL;Oe.TypeElement=wE;Oe.TypeElementMemberedNode=nq;Oe.TypeLiteralNode=Yw;Oe.TypeLiteralNodeBase=Fme;Oe.TypeNode=wc;Oe.TypeOfExpression=NM;Oe.TypeOfExpressionBase=Kpe;Oe.TypeOperatorTypeNode=Qw;Oe.TypeParameter=W6;Oe.TypeParameterDeclaration=Zw;Oe.TypeParameterDeclarationBase=CR;Oe.TypeParameteredNode=J_;Oe.TypePredicateNode=eF;Oe.TypeQueryNode=rF;Oe.TypeReferenceNode=tF;Oe.TypedNode=KE;Oe.UnaryExpression=fv;Oe.UnaryExpressionedNode=HD;Oe.UnionTypeNode=nF;Oe.UnwrappableNode=Z6;Oe.UpdateExpression=nM;Oe.VariableDeclaration=L6;Oe.VariableDeclarationBase=UR;Oe.VariableDeclarationList=N6;Oe.VariableDeclarationListBase=g_e;Oe.VariableStatement=gw;Oe.VariableStatementBase=pR;Oe.VoidExpression=IM;Oe.VoidExpressionBase=Wpe;Oe.WhileStatement=yw;Oe.WhileStatementBase=Eme;Oe.WithStatement=vw;Oe.WithStatementBase=bme;Oe.Writers=WH;Oe.YieldExpression=PM;Oe.YieldExpressionBase=Vpe;Oe.createWrappedNode=lUe;Oe.forEachStructureChild=N7e;Oe.getCompilerOptionsFromTsConfig=UBe;Oe.getScopeForNode=ZR;Oe.insertOverloads=rG;Oe.printNode=lj;Oe.setScopeForNode=tq});var Qg=gt((SYe,oG)=>{var S_e,T_e,x_e,D_e,C_e,A_e,L_e,N_e,I_e,iG,cq,P_e,O_e,k_e,qD,R_e,M_e,w_e,F_e,G_e,B_e,U_e,K_e,W_e,aG;(function(e){var r=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(i){e(n(r,n(i)))}):typeof oG=="object"&&typeof oG.exports=="object"?e(n(r,n(oG.exports))):e(n(r));function n(i,a){return i!==r&&(typeof Object.create=="function"?Object.defineProperty(i,"__esModule",{value:!0}):i.__esModule=!0),function(s,u){return i[s]=a?a(s,u):u}}})(function(e){var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(i[s]=a[s])};S_e=function(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(i,a);function s(){this.constructor=i}i.prototype=a===null?Object.create(a):(s.prototype=a.prototype,new s)},T_e=Object.assign||function(i){for(var a,s=1,u=arguments.length;s<u;s++){a=arguments[s];for(var p in a)Object.prototype.hasOwnProperty.call(a,p)&&(i[p]=a[p])}return i},x_e=function(i,a){var s={};for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&a.indexOf(u)<0&&(s[u]=i[u]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var p=0,u=Object.getOwnPropertySymbols(i);p<u.length;p++)a.indexOf(u[p])<0&&Object.prototype.propertyIsEnumerable.call(i,u[p])&&(s[u[p]]=i[u[p]]);return s},D_e=function(i,a,s,u){var p=arguments.length,f=p<3?a:u===null?u=Object.getOwnPropertyDescriptor(a,s):u,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,a,s,u);else for(var g=i.length-1;g>=0;g--)(m=i[g])&&(f=(p<3?m(f):p>3?m(a,s,f):m(a,s))||f);return p>3&&f&&Object.defineProperty(a,s,f),f},C_e=function(i,a){return function(s,u){a(s,u,i)}},A_e=function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},L_e=function(i,a,s,u){function p(f){return f instanceof s?f:new s(function(m){m(f)})}return new(s||(s=Promise))(function(f,m){function g(B){try{P(u.next(B))}catch(K){m(K)}}function D(B){try{P(u.throw(B))}catch(K){m(K)}}function P(B){B.done?f(B.value):p(B.value).then(g,D)}P((u=u.apply(i,a||[])).next())})},N_e=function(i,a){var s={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},u,p,f,m;return m={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function g(P){return function(B){return D([P,B])}}function D(P){if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,p&&(f=P[0]&2?p.return:P[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,P[1])).done)return f;switch(p=0,f&&(P=[P[0]&2,f.value]),P[0]){case 0:case 1:f=P;break;case 4:return s.label++,{value:P[1],done:!1};case 5:s.label++,p=P[1],P=[0];continue;case 7:P=s.ops.pop(),s.trys.pop();continue;default:if(f=s.trys,!(f=f.length>0&&f[f.length-1])&&(P[0]===6||P[0]===2)){s=0;continue}if(P[0]===3&&(!f||P[1]>f[0]&&P[1]<f[3])){s.label=P[1];break}if(P[0]===6&&s.label<f[1]){s.label=f[1],f=P;break}if(f&&s.label<f[2]){s.label=f[2],s.ops.push(P);break}f[2]&&s.ops.pop(),s.trys.pop();continue}P=a.call(i,s)}catch(B){P=[6,B],p=0}finally{u=f=0}if(P[0]&5)throw P[1];return{value:P[0]?P[1]:void 0,done:!0}}},I_e=function(i,a){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(a,s)&&aG(a,i,s)},aG=Object.create?function(i,a,s,u){u===void 0&&(u=s);var p=Object.getOwnPropertyDescriptor(a,s);(!p||("get"in p?!a.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return a[s]}}),Object.defineProperty(i,u,p)}:function(i,a,s,u){u===void 0&&(u=s),i[u]=a[s]},iG=function(i){var a=typeof Symbol=="function"&&Symbol.iterator,s=a&&i[a],u=0;if(s)return s.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&u>=i.length&&(i=void 0),{value:i&&i[u++],done:!i}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")},cq=function(i,a){var s=typeof Symbol=="function"&&i[Symbol.iterator];if(!s)return i;var u=s.call(i),p,f=[],m;try{for(;(a===void 0||a-- >0)&&!(p=u.next()).done;)f.push(p.value)}catch(g){m={error:g}}finally{try{p&&!p.done&&(s=u.return)&&s.call(u)}finally{if(m)throw m.error}}return f},P_e=function(){for(var i=[],a=0;a<arguments.length;a++)i=i.concat(cq(arguments[a]));return i},O_e=function(){for(var i=0,a=0,s=arguments.length;a<s;a++)i+=arguments[a].length;for(var u=Array(i),p=0,a=0;a<s;a++)for(var f=arguments[a],m=0,g=f.length;m<g;m++,p++)u[p]=f[m];return u},k_e=function(i,a,s){if(s||arguments.length===2)for(var u=0,p=a.length,f;u<p;u++)(f||!(u in a))&&(f||(f=Array.prototype.slice.call(a,0,u)),f[u]=a[u]);return i.concat(f||Array.prototype.slice.call(a))},qD=function(i){return this instanceof qD?(this.v=i,this):new qD(i)},R_e=function(i,a,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u=s.apply(i,a||[]),p,f=[];return p={},m("next"),m("throw"),m("return"),p[Symbol.asyncIterator]=function(){return this},p;function m(h){u[h]&&(p[h]=function(S){return new Promise(function(U,C){f.push([h,S,U,C])>1||g(h,S)})})}function g(h,S){try{D(u[h](S))}catch(U){K(f[0][3],U)}}function D(h){h.value instanceof qD?Promise.resolve(h.value.v).then(P,B):K(f[0][2],h)}function P(h){g("next",h)}function B(h){g("throw",h)}function K(h,S){h(S),f.shift(),f.length&&g(f[0][0],f[0][1])}},M_e=function(i){var a,s;return a={},u("next"),u("throw",function(p){throw p}),u("return"),a[Symbol.iterator]=function(){return this},a;function u(p,f){a[p]=i[p]?function(m){return(s=!s)?{value:qD(i[p](m)),done:p==="return"}:f?f(m):m}:f}},w_e=function(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i[Symbol.asyncIterator],s;return a?a.call(i):(i=typeof iG=="function"?iG(i):i[Symbol.iterator](),s={},u("next"),u("throw"),u("return"),s[Symbol.asyncIterator]=function(){return this},s);function u(f){s[f]=i[f]&&function(m){return new Promise(function(g,D){m=i[f](m),p(g,D,m.done,m.value)})}}function p(f,m,g,D){Promise.resolve(D).then(function(P){f({value:P,done:g})},m)}},F_e=function(i,a){return Object.defineProperty?Object.defineProperty(i,"raw",{value:a}):i.raw=a,i};var n=Object.create?function(i,a){Object.defineProperty(i,"default",{enumerable:!0,value:a})}:function(i,a){i.default=a};G_e=function(i){if(i&&i.__esModule)return i;var a={};if(i!=null)for(var s in i)s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)&&aG(a,i,s);return n(a,i),a},B_e=function(i){return i&&i.__esModule?i:{default:i}},U_e=function(i,a,s,u){if(s==="a"&&!u)throw new TypeError("Private accessor was defined without a getter");if(typeof a=="function"?i!==a||!u:!a.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?u:s==="a"?u.call(i):u?u.value:a.get(i)},K_e=function(i,a,s,u,p){if(u==="m")throw new TypeError("Private method is not writable");if(u==="a"&&!p)throw new TypeError("Private accessor was defined without a setter");if(typeof a=="function"?i!==a||!p:!a.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return u==="a"?p.call(i,s):p?p.value=s:a.set(i,s),s},W_e=function(i,a){if(a===null||typeof a!="object"&&typeof a!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?a===i:i.has(a)},e("__extends",S_e),e("__assign",T_e),e("__rest",x_e),e("__decorate",D_e),e("__param",C_e),e("__metadata",A_e),e("__awaiter",L_e),e("__generator",N_e),e("__exportStar",I_e),e("__createBinding",aG),e("__values",iG),e("__read",cq),e("__spread",P_e),e("__spreadArrays",O_e),e("__spreadArray",k_e),e("__await",qD),e("__asyncGenerator",R_e),e("__asyncDelegator",M_e),e("__asyncValues",w_e),e("__makeTemplateObject",F_e),e("__importStar",G_e),e("__importDefault",B_e),e("__classPrivateFieldGet",U_e),e("__classPrivateFieldSet",K_e),e("__classPrivateFieldIn",W_e)})});var V_e=gt(JD=>{"use strict";Object.defineProperty(JD,"__esModule",{value:!0});JD.lowerCase=JD.localeLowerCase=void 0;var TUe={tr:{regexp:/\u0130|\u0049|\u0049\u0307/g,map:{\u0130:"i",I:"\u0131",I\u0307:"i"}},az:{regexp:/\u0130/g,map:{\u0130:"i",I:"\u0131",I\u0307:"i"}},lt:{regexp:/\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,map:{I:"i\u0307",J:"j\u0307",\u012E:"\u012F\u0307",\u00CC:"i\u0307\u0300",\u00CD:"i\u0307\u0301",\u0128:"i\u0307\u0303"}}};function xUe(e,r){var n=TUe[r.toLowerCase()];return dq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}JD.localeLowerCase=xUe;function dq(e){return e.toLowerCase()}JD.lowerCase=dq});var QT=gt(sG=>{"use strict";Object.defineProperty(sG,"__esModule",{value:!0});sG.noCase=void 0;var DUe=V_e(),CUe=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],AUe=/[^A-Z0-9]+/gi;function LUe(e,r){r===void 0&&(r={});for(var n=r.splitRegexp,i=n===void 0?CUe:n,a=r.stripRegexp,s=a===void 0?AUe:a,u=r.transform,p=u===void 0?DUe.lowerCase:u,f=r.delimiter,m=f===void 0?" ":f,g=j_e(j_e(e,i,"$1\0$2"),s,"\0"),D=0,P=g.length;g.charAt(D)==="\0";)D++;for(;g.charAt(P-1)==="\0";)P--;return g.slice(D,P).split("\0").map(p).join(m)}sG.noCase=LUe;function j_e(e,r,n){return r instanceof RegExp?e.replace(r,n):r.reduce(function(i,a){return i.replace(a,n)},e)}});var fq=gt(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});vS.pascalCase=vS.pascalCaseTransformMerge=vS.pascalCaseTransform=void 0;var NUe=Qg(),IUe=QT();function H_e(e,r){var n=e.charAt(0),i=e.substr(1).toLowerCase();return r>0&&n>="0"&&n<="9"?"_"+n+i:""+n.toUpperCase()+i}vS.pascalCaseTransform=H_e;function PUe(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}vS.pascalCaseTransformMerge=PUe;function OUe(e,r){return r===void 0&&(r={}),IUe.noCase(e,NUe.__assign({delimiter:"",transform:H_e},r))}vS.pascalCase=OUe});var J_e=gt(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.camelCase=hS.camelCaseTransformMerge=hS.camelCaseTransform=void 0;var kUe=Qg(),pq=fq();function q_e(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransform(e,r)}hS.camelCaseTransform=q_e;function RUe(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransformMerge(e)}hS.camelCaseTransformMerge=RUe;function MUe(e,r){return r===void 0&&(r={}),pq.pascalCase(e,kUe.__assign({transform:q_e},r))}hS.camelCase=MUe});var mq=gt(lG=>{"use strict";Object.defineProperty(lG,"__esModule",{value:!0});lG.upperCaseFirst=void 0;function wUe(e){return e.charAt(0).toUpperCase()+e.substr(1)}lG.upperCaseFirst=wUe});var _q=gt(zD=>{"use strict";Object.defineProperty(zD,"__esModule",{value:!0});zD.capitalCase=zD.capitalCaseTransform=void 0;var FUe=Qg(),GUe=QT(),BUe=mq();function z_e(e){return BUe.upperCaseFirst(e.toLowerCase())}zD.capitalCaseTransform=z_e;function UUe(e,r){return r===void 0&&(r={}),GUe.noCase(e,FUe.__assign({delimiter:" ",transform:z_e},r))}zD.capitalCase=UUe});var $_e=gt($D=>{"use strict";Object.defineProperty($D,"__esModule",{value:!0});$D.upperCase=$D.localeUpperCase=void 0;var KUe={tr:{regexp:/[\u0069]/g,map:{i:"\u0130"}},az:{regexp:/[\u0069]/g,map:{i:"\u0130"}},lt:{regexp:/[\u0069\u006A\u012F]\u0307|\u0069\u0307[\u0300\u0301\u0303]/g,map:{i\u0307:"I",j\u0307:"J",\u012F\u0307:"\u012E",i\u0307\u0300:"\xCC",i\u0307\u0301:"\xCD",i\u0307\u0303:"\u0128"}}};function WUe(e,r){var n=KUe[r.toLowerCase()];return gq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}$D.localeUpperCase=WUe;function gq(e){return e.toUpperCase()}$D.upperCase=gq});var X_e=gt(uG=>{"use strict";Object.defineProperty(uG,"__esModule",{value:!0});uG.constantCase=void 0;var VUe=Qg(),jUe=QT(),HUe=$_e();function qUe(e,r){return r===void 0&&(r={}),jUe.noCase(e,VUe.__assign({delimiter:"_",transform:HUe.upperCase},r))}uG.constantCase=qUe});var PL=gt(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});cG.dotCase=void 0;var JUe=Qg(),zUe=QT();function $Ue(e,r){return r===void 0&&(r={}),zUe.noCase(e,JUe.__assign({delimiter:"."},r))}cG.dotCase=$Ue});var Y_e=gt(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});dG.headerCase=void 0;var XUe=Qg(),YUe=_q();function QUe(e,r){return r===void 0&&(r={}),YUe.capitalCase(e,XUe.__assign({delimiter:"-"},r))}dG.headerCase=QUe});var Q_e=gt(fG=>{"use strict";Object.defineProperty(fG,"__esModule",{value:!0});fG.paramCase=void 0;var ZUe=Qg(),eKe=PL();function rKe(e,r){return r===void 0&&(r={}),eKe.dotCase(e,ZUe.__assign({delimiter:"-"},r))}fG.paramCase=rKe});var Z_e=gt(pG=>{"use strict";Object.defineProperty(pG,"__esModule",{value:!0});pG.pathCase=void 0;var tKe=Qg(),nKe=PL();function iKe(e,r){return r===void 0&&(r={}),nKe.dotCase(e,tKe.__assign({delimiter:"/"},r))}pG.pathCase=iKe});var rge=gt(XD=>{"use strict";Object.defineProperty(XD,"__esModule",{value:!0});XD.sentenceCase=XD.sentenceCaseTransform=void 0;var aKe=Qg(),oKe=QT(),sKe=mq();function ege(e,r){var n=e.toLowerCase();return r===0?sKe.upperCaseFirst(n):n}XD.sentenceCaseTransform=ege;function lKe(e,r){return r===void 0&&(r={}),oKe.noCase(e,aKe.__assign({delimiter:" ",transform:ege},r))}XD.sentenceCase=lKe});var tge=gt(mG=>{"use strict";Object.defineProperty(mG,"__esModule",{value:!0});mG.snakeCase=void 0;var uKe=Qg(),cKe=PL();function dKe(e,r){return r===void 0&&(r={}),cKe.dotCase(e,uKe.__assign({delimiter:"_"},r))}mG.snakeCase=dKe});var yq=gt(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var vv=Qg();vv.__exportStar(J_e(),z_);vv.__exportStar(_q(),z_);vv.__exportStar(X_e(),z_);vv.__exportStar(PL(),z_);vv.__exportStar(Y_e(),z_);vv.__exportStar(QT(),z_);vv.__exportStar(Q_e(),z_);vv.__exportStar(fq(),z_);vv.__exportStar(Z_e(),z_);vv.__exportStar(rge(),z_);vv.__exportStar(tge(),z_)});var Eq=gt((JYe,fKe)=>{fKe.exports={name:"zenstack",publisher:"zenstack",displayName:"ZenStack Language Tools",description:"ZenStack is a toolkit that simplifies full-stack development",version:"0.2.9",author:{name:"ZenStack Team"},keywords:["fullstack","react","typescript","data modeling"],preview:!0,icon:"asset/logo-light-256.png",repository:{type:"git",url:"https://github.com/zenstackhq/zenstack"},engines:{vscode:"^1.72.0"},categories:["Programming Languages"],contributes:{languages:[{id:"zmodel",aliases:["ZenStack Model","zmodel"],extensions:[".zmodel"],configuration:"./language-configuration.json",icon:{light:"./asset/logo-light-256.png",dark:"./asset/logo-dark-256.png"}}],grammars:[{language:"zmodel",scopeName:"source.zmodel",path:"./syntaxes/zmodel.tmLanguage.json"}]},activationEvents:["onLanguage:zmodel"],files:["bin","src","bundle"],bin:{zenstack:"./bin/cli"},main:"./bundle/extension.js",scripts:{"vscode:publish":"vsce publish --no-dependencies","vscode:prepublish":"cp ../../README.md ./ && pnpm lint && pnpm build","vscode:package":"vsce package --no-dependencies",build:"pnpm langium:generate && tsc --noEmit && pnpm bundle && cp -r src/res/* bundle/res/",bundle:"node build/bundle.js --minify","bundle-watch":"node build/bundle.js --watch","ts:watch":"tsc --watch --noEmit","tsc-alias:watch":"tsc-alias --watch",lint:"eslint src --ext ts","langium:generate":"langium generate","langium:watch":"langium generate --watch",watch:'concurrently --kill-others "npm:langium:watch" "npm:bundle-watch"',test:"jest",prepublishOnly:"cp ../../README.md ./ && pnpm build && pnpm bundle"},dependencies:{"@zenstackhq/internal":"workspace:*","change-case":"^4.1.2",chevrotain:"^9.1.0",colors:"^1.4.0",commander:"^8.3.0",langium:"^0.5.0",pluralize:"^8.0.0",prisma:"^4.5.0",promisify:"^0.0.3","ts-morph":"^16.0.0",uuid:"^9.0.0","vscode-jsonrpc":"^8.0.2","vscode-languageclient":"^8.0.2","vscode-languageserver":"^8.0.2","vscode-languageserver-textdocument":"^1.0.7","vscode-uri":"^3.0.6"},devDependencies:{"@prisma/internals":"^4.5.0","@types/jest":"^29.2.0","@types/node":"^14.18.32","@types/pluralize":"^0.0.29","@types/tmp":"^0.2.3","@types/uuid":"^8.3.4","@types/vscode":"^1.72.0","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0",concurrently:"^7.4.0",esbuild:"^0.15.12",eslint:"^7.32.0",jest:"^29.2.1","langium-cli":"^0.5.0",tmp:"^0.2.1","ts-jest":"^29.0.3","ts-node":"^10.9.1","tsc-alias":"^1.7.0","tsconfig-paths-jest":"^0.0.1",typescript:"^4.8.4",vsce:"^2.13.0"}}});var mKe={};QDe(mKe,{default:()=>pKe,generateAction:()=>dge});module.exports=ZDe(mKe);var vG=Gs(dQ()),uge=Gs(_Q());var goe=Gs(CE()),poe="AbstractDeclaration";var m6e="Expression";var moe="ReferenceTarget";var JO="TypeDeclaration";var Hx="ArrayExpr";function zO(e){return ov.isInstance(e,Hx)}var rK="Attribute";var yoe="AttributeArg";var SA="BinaryExpr";var $O="DataModel";function Lm(e){return ov.isInstance(e,$O)}var tK="DataModelField";function qx(e){return ov.isInstance(e,tK)}var XO="DataSource";function voe(e){return ov.isInstance(e,XO)}var YO="Enum";function hoe(e){return ov.isInstance(e,YO)}var QO="EnumField";function Jx(e){return ov.isInstance(e,QO)}var _oe="Function";var _6e="FunctionParam";var zx="InvocationExpr";function TA(e){return ov.isInstance(e,zx)}var Ub="LiteralExpr";function av(e){return ov.isInstance(e,Ub)}var Kb="MemberAccessExpr";function nK(e){return ov.isInstance(e,Kb)}var xA="NullExpr";var Wb="ReferenceExpr";function Vb(e){return ov.isInstance(e,Wb)}var $x="ThisExpr";function xT(e){return ov.isInstance(e,$x)}var DA="UnaryExpr";var bA=class{getAllTypes(){return["AbstractDeclaration","Argument","ArrayExpr","Attribute","AttributeArg","AttributeParam","AttributeParamType","BinaryExpr","DataModel","DataModelAttribute","DataModelField","DataModelFieldAttribute","DataModelFieldType","DataSource","DataSourceField","Enum","EnumField","Expression","Function","FunctionParam","FunctionParamType","InvocationExpr","LiteralExpr","MemberAccessExpr","Model","NullExpr","ReferenceArg","ReferenceExpr","ReferenceTarget","ThisExpr","TypeDeclaration","UnaryExpr"]}isInstance(r,n){return(0,goe.isAstNode)(r)&&this.isSubtype(r.$type,n)}isSubtype(r,n){if(r===n)return!0;switch(r){case Hx:case SA:case zx:case Ub:case Kb:case xA:case Wb:case $x:case DA:return this.isSubtype(m6e,n);case rK:case XO:case _oe:return this.isSubtype(poe,n);case $O:case YO:return this.isSubtype(poe,n)||this.isSubtype(JO,n);case tK:case QO:case _6e:return this.isSubtype(moe,n);default:return!1}}getReferenceType(r){let n=`${r.container.$type}:${r.property}`;switch(n){case"AttributeParamType:reference":return JO;case"DataModelAttribute:decl":return rK;case"DataModelFieldAttribute:decl":return rK;case"DataModelFieldType:reference":return JO;case"FunctionParamType:reference":return JO;case"InvocationExpr:function":return _oe;case"MemberAccessExpr:member":return tK;case"ReferenceExpr:target":return moe;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(r){switch(r){case"ArrayExpr":return{name:"ArrayExpr",mandatory:[{name:"items",type:"array"}]};case"Attribute":return{name:"Attribute",mandatory:[{name:"params",type:"array"}]};case"AttributeParam":return{name:"AttributeParam",mandatory:[{name:"default",type:"boolean"}]};case"AttributeParamType":return{name:"AttributeParamType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataModel":return{name:"DataModel",mandatory:[{name:"attributes",type:"array"},{name:"fields",type:"array"}]};case"DataModelAttribute":return{name:"DataModelAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelField":return{name:"DataModelField",mandatory:[{name:"attributes",type:"array"}]};case"DataModelFieldAttribute":return{name:"DataModelFieldAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelFieldType":return{name:"DataModelFieldType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataSource":return{name:"DataSource",mandatory:[{name:"fields",type:"array"}]};case"Enum":return{name:"Enum",mandatory:[{name:"fields",type:"array"}]};case"Function":return{name:"Function",mandatory:[{name:"params",type:"array"}]};case"FunctionParamType":return{name:"FunctionParamType",mandatory:[{name:"array",type:"boolean"}]};case"InvocationExpr":return{name:"InvocationExpr",mandatory:[{name:"args",type:"array"}]};case"Model":return{name:"Model",mandatory:[{name:"declarations",type:"array"}]};case"ReferenceExpr":return{name:"ReferenceExpr",mandatory:[{name:"args",type:"array"}]};default:return{name:r,mandatory:[]}}}},ov=new bA;var Eoe=Gs(CE()),ZO,boe=()=>ZO!=null?ZO:ZO=(0,Eoe.loadGrammarFromJson)(`{
4252
+ `)}getTags(){var r,n;return(n=(r=this.compilerNode.tags)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getInnerText(){return MH(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){var r,n;let i=this.getSourceFile().getFullText(),a=(n=(r=this.getTags()[0])===null||r===void 0?void 0:r.getStart())!==null&&n!==void 0?n:this.getEnd()-2,s=u(this);return MH(i.substring(s,Math.max(s,p())));function u(f){let m=f.getStart()+3;return i.charCodeAt(m)===ac.SPACE?m+1:m}function p(){let f=dv(i,a,m=>m===ac.NEWLINE||!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK);return dv(i,f,m=>m!==ac.NEWLINE&&m!==ac.CARRIAGE_RETURN)}}setDescription(r){let n=this.getTags(),i=this.getStart()+3,a=n.length>0?dv(this._sourceFile.getFullText(),n[0].getStart(),u=>u===ac.ASTERISK)-1:this.getEnd()-2;return S7e({parent:this,newText:s.call(this),replacePos:i,replacingLength:a-i}),this;function s(){var u,p;let f=this.getIndentationText(),m=this._context.manipulationSettings.getNewLineKindAsString(),g=Xg(this._getWriter(),r).split(/\r?\n/),D=g[0].length===0,P=g.length===1&&((p=(u=this.compilerNode.tags)===null||u===void 0?void 0:u.length)!==null&&p!==void 0?p:0)===0,B=P?g[0]:g.map(K=>K.length===0?`${f} *`:`${f} * ${K}`).slice(D?1:0).join(m);return P?" "+B+" ":m+B+m+f+" "}}addTag(r){return this.addTags([r])[0]}addTags(r){var n,i;return this.insertTags((i=(n=this.compilerNode.tags)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,r)}insertTag(r,n){return this.insertTags(r,[n])[0]}insertTags(r,n){if(b.ArrayUtils.isNullOrEmpty(n))return[];let i=this._getWriterWithQueuedIndentation(),a=this.getTags();if(r=ku(r,a.length),a.length===0&&!this.isMultiLine()){let p=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(f=>{p.printText(f,{description:this.getDescription(),tags:n})})}else{let p=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});i.newLine().write(" * "),p.printTexts(i,n),i.newLine().write(" *"),i.conditionalWrite(r<a.length," ");let f=s.call(this),m=u.call(this);qa({parent:this,insertPos:f,replacing:{textLength:m-f},newText:i.toString()})}return af(a,this.getTags(),r,!1);function s(){let p=r<a.length?a[r].getStart():this.getEnd()-2,f=this.getStart()+3;return Math.max(f,dv(this.getSourceFile().getFullText(),p,m=>!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK))}function u(){return r<a.length?a[r].getStart():this.getEnd()-1}}remove(){Bs({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(r){return io(xR.prototype,this,r),r.tags!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDoc().printText(n,{description:(i=r.description)!==null&&i!==void 0?i:this.getDescription(),tags:r.tags})}):(r.description!=null&&this.setDescription(r.description),this)}getStructure(){return uo(xR.prototype,this,{kind:Oe.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(r=>r.getStructure())})}},wc=class extends Tr{},Pme=Q6(wc),KT=class extends Pme{},kw=class extends wc{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},Rw=class extends wc{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)}},Ome=yv(wc),sL=class extends Ome{},kme=gS(sf(sL)),Mw=class extends kme{},Rme=XT(KT),ww=class extends Rme{},Mme=J_(sL),Fw=class extends Mme{},Gw=class extends Tr{getAssertClause(){return this._getNodeFromCompilerNode(this.compilerNode.assertClause)}isMultiline(){var r;return(r=this.compilerNode.multiLine)!==null&&r!==void 0?r:!1}},Bw=class extends KT{setArgument(r){let n=this.getArgument();if(Tr.isLiteralTypeNode(n)){let i=n.getLiteral();if(Tr.isStringLiteral(i))return i.setLiteralValue(r),this}return n.replaceWithText(i=>i.quote(r),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(r){let n=this.getQualifier();if(n!=null)n.replaceWithText(r,this._getWriterWithQueuedChildIndentation());else{let i=this.getFirstChildByKindOrThrow(b.SyntaxKind.CloseParenToken);qa({insertPos:i.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(r).toString()})}return this}getQualifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQualifier(),()=>`Expected to find a qualifier for the import type: ${this.getText()}`)}getQualifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.qualifier)}getAssertions(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions)}getAssertionsOrThrow(){return b.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertions),"Could not find import type assertion container.")}},Uw=class extends wc{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Kw=class extends wc{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Ww=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},Vw=class extends wc{getLiteral(){let r=this.compilerNode.literal;return this._getNodeFromCompilerNode(r)}},jw=class extends wc{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getNameTypeNode(),"Type did not exist.")}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getReadonlyToken(),"Readonly token did not exist.")}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(){return b.errors.throwIfNullOrUndefined(this.getQuestionToken(),"Question token did not exist.")}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Type did not exist, but was expected to exist.")}},J9e=e=>KE(Rh(hL(sc(gv(e))))),wme=J9e(wc),Hw=class extends wme{getTypeNode(){return super.getTypeNode()}removeType(){throw new b.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},qw=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(r){return this.getTypeNode().replaceWithText(r),this}},Jw=class extends wc{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},zw=class extends wc{},$w=class extends wc{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},z9e=e=>J_(KE(sc(Ph(BE(sf(gv(e))))))),DR=z9e(Cl),Xw=class extends DR{set(r){return io(DR.prototype,this,r),this}getStructure(){return uo(DR.prototype,this,{kind:Oe.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},Fme=nq(wc),Yw=class extends Fme{},Qw=class extends wc{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};Oe.TypeParameterVariance=void 0;(function(e){e[e.None=0]="None",e[e.In=1]="In",e[e.Out=2]="Out",e[e.InOut=3]="InOut"})(Oe.TypeParameterVariance||(Oe.TypeParameterVariance={}));var CR=sf(gv(Tr)),Zw=class extends CR{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the type parameter's constraint.")}setConstraint(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeConstraint(),this;let n=this.getConstraint();if(n!=null)return n.replaceWithText(r),this;let i=this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` extends ${r}`}),this}removeConstraint(){return Afe(this.getConstraint(),b.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find the type parameter's default.")}setDefault(r){if(r=this.getParentOrThrow()._getTextWithQueuedChildIndentation(r),b.StringUtils.isNullOrWhitespace(r))return this.removeDefault(),this;let n=this.getDefault();if(n!=null)return n.replaceWithText(r),this;let i=this.getConstraint()||this.getNameNode();return qa({parent:this,insertPos:i.getEnd(),newText:` = ${r}`}),this}removeDefault(){return Afe(this.getDefault(),b.SyntaxKind.EqualsToken),this}setVariance(r){return this.toggleModifier("in",(r&Oe.TypeParameterVariance.In)!==0),this.toggleModifier("out",(r&Oe.TypeParameterVariance.Out)!==0),this}getVariance(){let r=Oe.TypeParameterVariance.None;return this.hasModifier("in")&&(r|=Oe.TypeParameterVariance.In),this.hasModifier("out")&&(r|=Oe.TypeParameterVariance.Out),r}remove(){let r=this.getParentSyntaxListOrThrow();r.getChildrenOfKind(b.SyntaxKind.TypeParameter).length===1?i():mv(this);function i(){let a=[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)];Bs({children:a})}}set(r){return io(CR.prototype,this,r),r.constraint!=null?this.setConstraint(r.constraint):r.hasOwnProperty(b.nameof(r,"constraint"))&&this.removeConstraint(),r.default!=null?this.setDefault(r.default):r.hasOwnProperty(b.nameof(r,"default"))&&this.removeDefault(),r.variance!=null&&this.setVariance(r.variance),this}getStructure(){let r=this.getConstraint(),n=this.getDefault();return uo(CR.prototype,this,{kind:Oe.StructureKind.TypeParameter,constraint:r?.getText({trimLeadingIndentation:!0}),default:n?n.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function Afe(e,r){e!=null&&Bs({children:[e.getPreviousSiblingIfKindOrThrow(r),e],removePrecedingSpaces:!0})}var eF=class extends wc{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAssertsModifier(),"Expected to find an asserts modifier.")}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTypeNode(),"Expected to find a type node.")}},rF=class extends KT{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},tF=class extends KT{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},nF=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},q_=class extends wc{},iF=class extends q_{},AR=Tr,bc=class extends AR{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(r){return this.set({tagName:r})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(r=>this._getNodeFromCompilerNodeIfExists(r))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:b.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let r=this.getParentOrThrow().getStart()+3,n=Ume(this),i=n==null,a=s.call(this);Bs({children:[this],customRemovalPos:a,customRemovalEnd:Bme(this,n),replaceTrivia:u.call(this)});function s(){return Math.max(r,Kme(this,this.getStart()))}function u(){if(a===r&&i)return"";let p=this._context.manipulationSettings.getNewLineKindAsString(),f=this.getParentOrThrow().getIndentationText();return`${p}${f} `+(i?"":"* ")}}set(r){return io(AR.prototype,this,r),r.text!=null||r.tagName!=null?this.replaceWithText(n=>{var i;this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(n,{tagName:(i=r.tagName)!==null&&i!==void 0?i:this.getTagName(),text:r.text!=null?r.text:Lfe(this)})}):this}replaceWithText(r){let n=Xg(this._getWriterWithQueuedIndentation(),r),i=this.getParentOrThrow(),a=this.getChildIndex(),s=this.getStart();return qa({parent:i,insertPos:s,newText:n,replacing:{textLength:Gme(this)-s}}),i.getChildren()[a]}getStructure(){let r=Lfe(this);return uo(AR.prototype,this,{kind:Oe.StructureKind.JSDocTag,tagName:this.getTagName(),text:r.length===0?void 0:r})}};function Lfe(e){let r=e.getSourceFile().getFullText(),n=e.getTagNameNode().getEnd(),i=Gme(e),a=Math.min(r.charCodeAt(n)===ac.SPACE?n+1:n,i);return MH(r.substring(a,i))}function Gme(e){return Kme(e,Bme(e))}function Bme(e,r){return r=r??Ume(e),r!=null?r.getStart():e.getParentOrThrow().getEnd()-2}function Ume(e){let n=e.getParentIfKindOrThrow(b.SyntaxKind.JSDoc).getTags(),i=n.indexOf(e);return n[i+1]}function Kme(e,r){let n=e.getSourceFile().getFullText();return dv(n,r,i=>i!==ac.ASTERISK&&!b.StringUtils.isWhitespaceCharCode(i))}var aF=class extends bc{},oF=class extends bc{},sF=class extends bc{},lF=class extends bc{},uF=class extends bc{},cF=class extends bc{},Wme=yv(q_),dF=class extends Wme{},fF=class extends bc{},pF=class extends Tr{},mF=class extends Tr{},_F=class extends Tr{},gF=class extends Tr{},yF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},vF=class extends Tr{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},hF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},EF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},bF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},SF=class extends bc{},Vme=oq(bc),TF=class extends Vme{},xF=class extends bc{},jme=oq(bc),DF=class extends jme{},CF=class extends bc{},AF=class extends bc{},LF=class extends bc{},Hme=tG(bc),NF=class extends Hme{},qme=tG(bc),IF=class extends qme{},PF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},lL=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getName(){return this.compilerObject.name}getText(){var r;return(r=this.compilerObject.text)!==null&&r!==void 0?r:[]}},Jme=Ime(bc),OF=class extends Jme{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find the JS doc template tag's constraint.")}},kF=class extends Tr{},zme=tG(bc),RF=class extends zme{},MF=class extends bc{},wF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},FF=class extends q_{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(r=>this._getNodeFromCompilerNode(r)):void 0}},GF=class extends bc{getTypeExpression(){let r=this.compilerNode.typeExpression;if(!(r!=null&&r.pos===r.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},BF=class extends bc{},UF=class extends q_{},KF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},WF=class extends Tr{remove(){Nh({children:[this],getSiblingFormatting:()=>El.Newline})}},$9e=e=>ld(yS(sc(Ph(BE(sf(gv(e))))))),LR=$9e(Cl),VF=class extends LR{set(r){return io(LR.prototype,this,r),r.isConst!=null&&this.setIsConstEnum(r.isConst),r.members!=null&&(this.getMembers().forEach(n=>n.remove()),this.addMembers(r.members)),this}addMember(r){return this.addMembers([r])[0]}addMembers(r){return this.insertMembers(this.getMembers().length,r)}insertMember(r,n){return this.insertMembers(r,[n])[0]}insertMembers(r,n){if(n.length===0)return[];let i=this.getMembersWithComments();r=ku(r,i.length);let a=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(a,n),j_({parent:this.getChildSyntaxListOrThrow(),currentNodes:i,insertIndex:r,newText:a.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),af(i,this.getMembersWithComments(),r,!u());function u(){return n instanceof Array?n.every(p=>typeof p=="object"):!1}}getMember(r){return ic(this.getMembers(),r)}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),()=>Ou("enum member",r))}getMembers(){return this.compilerNode.members.map(r=>this._getNodeFromCompilerNode(r))}getMembersWithComments(){let r=this.compilerNode;return od.getContainerArray(r,this.getSourceFile().compilerNode).map(n=>this._getNodeFromCompilerNode(n))}setIsConstEnum(r){return this.toggleModifier("const",r)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(b.SyntaxKind.ConstKeyword)}getStructure(){return uo(LR.prototype,this,{kind:Oe.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(r=>r.getStructure())})}},X9e=e=>sc($T(UE(e))),NR=X9e(Tr),jF=class extends NR{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(r){let n;if(typeof r=="string"){let i=this._context.manipulationSettings.getQuoteKind();n=i+b.StringUtils.escapeForWithinString(r,i)+i}else n=r.toString();return this.setInitializer(n),this}remove(){let r=[this],n=this.getNextSiblingIfKind(b.SyntaxKind.CommaToken);n!=null&&r.push(n),Nh({children:r,getSiblingFormatting:()=>El.Newline})}set(r){return io(NR.prototype,this,r),r.value!=null?this.setValue(r.value):r.hasOwnProperty(b.nameof(r,"value"))&&r.initializer==null&&this.removeInitializer(),this}getStructure(){return uo(NR.prototype,this,{kind:Oe.StructureKind.EnumMember,value:void 0})}},HF=class extends Tr{getTypeNodes(){var r,n;return(n=(r=this.compilerNode.types)===null||r===void 0?void 0:r.map(i=>this._getNodeFromCompilerNode(i)))!==null&&n!==void 0?n:[]}getToken(){return this.compilerNode.token}removeExpression(r){let n=this.getTypeNodes(),i=typeof r=="number"?a(r):r;if(n.length===1){let s=this.getParentSyntaxListOrThrow().getChildren();s.length===1?Bs({children:[s[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):Bs({children:[this],removePrecedingSpaces:!0})}else mv(i);return this;function a(s){return n[ku(s,n.length-1)]}}},wE=class extends Tr{remove(){g7e(this)}},Y9e=e=>J_(Im(sc(yv(e)))),IR=Y9e(wE),qF=class extends IR{set(r){return io(IR.prototype,this,r),this}getStructure(){return uo(IR.prototype,this,{kind:Oe.StructureKind.CallSignature})}},JF=class extends wE{},Q9e=e=>J_(Im(sc(yv(e)))),PR=Q9e(wE),zF=class extends PR{set(r){return io(PR.prototype,this,r),this}getStructure(){return uo(PR.prototype,this,{kind:Oe.StructureKind.ConstructSignature})}},Z9e=e=>rq(Im(sc(SL(sf(e))))),OR=Z9e(wE),$F=class extends OR{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(r){b.errors.throwIfWhitespaceOrNotString(r,"name"),this.getKeyName()!==r&&this.getKeyNameNode().replaceWithText(r,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(r){b.errors.throwIfWhitespaceOrNotString(r,"type");let n=this.getKeyTypeNode();return n.getText()===r?this:(n.replaceWithText(r,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let r=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(r.type)}set(r){return io(OR.prototype,this,r),r.keyName!=null&&this.setKeyName(r.keyName),r.keyType!=null&&this.setKeyType(r.keyType),this}getStructure(){let r=this.getKeyTypeNode();return uo(OR.prototype,this,{kind:Oe.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:r.getText()})}},eUe=e=>nq(ld(ape(ZH(J_(sc(Ph(yS(BE(sf(gv(e))))))))))),kR=eUe(Cl),XF=class extends kR{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return b.ArrayUtils.flatten(this.getType().getBaseTypes().map(r=>{var n,i;return(i=(n=r.getSymbol())===null||n===void 0?void 0:n.getDeclarations())!==null&&i!==void 0?i:[]}))}getImplementations(){return this.getNameNode().getImplementations()}set(r){return io(kR.prototype,this,r),this}getStructure(){return uo(kR.prototype,this,{kind:Oe.StructureKind.Interface})}},rUe=e=>Im(sc(Rh(J_(yv(UE(e)))))),RR=rUe(wE),YF=class extends RR{set(r){return io(RR.prototype,this,r),this}getStructure(){return uo(RR.prototype,this,{kind:Oe.StructureKind.MethodSignature})}},tUe=e=>Im(sc(SL(Rh($T(KE(UE(sf(e)))))))),MR=tUe(wE),QF=class extends MR{set(r){return io(MR.prototype,this,r),this}getStructure(){return uo(MR.prototype,this,{kind:Oe.StructureKind.PropertySignature})}};function sq(e){return class extends e{getAttributes(){return this.compilerNode.attributes.properties.map(r=>this._getNodeFromCompilerNode(r))}getAttributeOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAttribute(r),()=>Ou("attribute",r))}getAttribute(r){return ic(this.getAttributes(),r)}addAttribute(r){return this.addAttributes([r])[0]}addAttributes(r){return this.insertAttributes(this.compilerNode.attributes.properties.length,r)}insertAttribute(r,n){return this.insertAttributes(r,[n])[0]}insertAttributes(r,n){if(n.length===0)return[];let i=this.compilerNode.attributes.properties.length;r=ku(r,i);let a=r===0?this.getTagNameNode().getEnd():this.getAttributes()[r-1].getEnd(),s=this._getWriterWithQueuedChildIndentation();return new wj(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(s,n),qa({insertPos:a,newText:" "+s.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList)}),af(i,this.getAttributes(),r,!1)}set(r){return io(e.prototype,this,r),r.attributes!=null&&(this.getAttributes().forEach(n=>n.remove()),this.addAttributes(r.attributes)),this}getStructure(){return uo(e.prototype,this,{attributes:this.getAttributes().map(r=>r.getStructure())})}}}function nG(e){return class extends e{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(r){return io(e.prototype,this,r),r.name!=null&&this.getTagNameNode().replaceWithText(r.name),this}getStructure(){return uo(e.prototype,this,{name:this.getTagNameNode().getText()})}}}var wR=gv(Tr),ZF=class extends wR{getInitializerOrThrow(){return b.errors.throwIfNullOrUndefined(this.getInitializer(),`Expected to find an initializer for the JSX attribute '${this.getName()}'`)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(r){let n=Xg(this._getWriterWithQueuedIndentation(),r);if(b.StringUtils.isNullOrWhitespace(n))return this.removeInitializer(),this;let i=this.getInitializer();return i!=null?(i.replaceWithText(n),this):(qa({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${n}`}),this)}removeInitializer(){let r=this.getInitializer();return r==null?this:(Bs({children:[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.EqualsToken),r],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(wR.prototype,this,r),r.initializer!=null?this.setInitializer(r.initializer):r.hasOwnProperty(b.nameof(r,"initializer"))&&this.removeInitializer(),this}getStructure(){let r=this.getInitializer();return uo(wR.prototype,this,{kind:Oe.StructureKind.JsxAttribute,initializer:r?.getText()})}},nUe=e=>nG(e),$me=nUe(Tr),e6=class extends $me{},r6=class extends oc{},FR=sd,t6=class extends FR{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(r){let n=Zfe(this._getWriterWithIndentation(),r);return Nfe(this,n),this}setBodyTextInline(r){let n=this._getWriterWithQueuedChildIndentation();return GE(n,r),n.isLastNewLine()&&(n.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),n.write("")),Nfe(this,n.toString()),this}set(r){if(io(FR.prototype,this,r),r.attributes!=null){let n=this.getOpeningElement();n.getAttributes().forEach(i=>i.remove()),n.addAttributes(r.attributes)}if(r.children!=null)throw new b.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return r.bodyText!=null?this.setBodyText(r.bodyText):r.hasOwnProperty(b.nameof(r,"bodyText"))&&this.setBodyTextInline(""),r.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(r.name),this.getClosingElement().getTagNameNode().replaceWithText(r.name)),this}getStructure(){let r=this.getOpeningElement(),n=uo(FR.prototype,this,{kind:Oe.StructureKind.JsxElement,name:r.getTagNameNode().getText(),attributes:r.getAttributes().map(i=>i.getStructure()),children:void 0,bodyText:$H(this)});return delete n.children,n}};function Nfe(e,r){let n=e.getOpeningElement(),i=e.getClosingElement();qa({insertPos:n.getEnd(),newText:r,parent:e.getChildSyntaxListOrThrow(),replacing:{textLength:i.getStart()-n.getEnd()}})}var Xme=TL(hL(oc)),n6=class extends Xme{},i6=class extends sd{getJsxChildren(){return this.compilerNode.children.map(r=>this._getNodeFromCompilerNode(r))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},iUe=e=>sq(nG(e)),Yme=iUe(oc),a6=class extends Yme{},o6=class extends oc{},aUe=e=>sq(nG(e)),GR=aUe(sd),s6=class extends GR{set(r){return io(GR.prototype,this,r),this}getStructure(){return uo(GR.prototype,this,{kind:Oe.StructureKind.JsxSelfClosingElement})}},BR=ud(Tr),l6=class extends BR{remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(BR.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}getStructure(){return uo(BR.prototype,this,{kind:Oe.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},Qme=KD(Tr),u6=class extends Qme{containsOnlyTriviaWhiteSpaces(){let r=this.compilerNode;return typeof r.containsOnlyWhiteSpaces=="boolean"?r.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},Zme=cS,c6=class extends Zme{getLiteralValue(){let r=this.compilerNode.text;if(typeof BigInt>"u")throw new b.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let n=r.substring(0,r.length-1);return BigInt(n)}setLiteralValue(r){if(typeof r!="bigint")throw new b.errors.ArgumentTypeError("value","bigint",typeof r);return mS({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString()+"n"}),this}},e_e=sd,d6=class extends e_e{getLiteralValue(){return lq(this)}setLiteralValue(r){return t_e(this,r)}},r_e=sd,f6=class extends r_e{getLiteralValue(){return lq(this)}setLiteralValue(r){return t_e(this,r)}};function t_e(e,r){if(lq(e)===r)return e;let n=e.getParentSyntaxList()||e.getParentOrThrow(),i=e.getChildIndex();return e.replaceWithText(r?"true":"false"),n.getChildAtIndex(i)}function lq(e){return e.getKind()===b.SyntaxKind.TrueKeyword}var n_e=sd,p6=class extends n_e{},i_e=cS,m6=class extends i_e{getLiteralValue(){let r=this.compilerNode.text;return r.indexOf(".")>=0?parseFloat(r):parseInt(r,10)}setLiteralValue(r){return mS({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:r.toString(10)}),this}};Oe.QuoteKind=void 0;(function(e){e.Single="'",e.Double='"'})(Oe.QuoteKind||(Oe.QuoteKind={}));var a_e=cS,_6=class extends a_e{getLiteralValue(){let r=/^\/(.*)\/([^\/]*)$/,n=this.compilerNode.text,i=r.exec(n);return new RegExp(i[1],i[2])}setLiteralValue(r,n){let i;return typeof r=="string"?i=r:(i=r.source,n=r.flags),mS({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${i}/${n||""}`}),this}},o_e=cS,g6=class extends o_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:b.StringUtils.escapeForWithinString(r,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?Oe.QuoteKind.Single:Oe.QuoteKind.Double}},s_e=cS,y6=class extends s_e{getLiteralValue(){return this.compilerNode.text}setLiteralValue(r){let n=this.getChildIndex(),i=this.getParentSyntaxList()||this.getParentOrThrow();return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),i.getChildAtIndex(n)}},v6=class extends BT{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){var r;let n=(r=this.getParentSyntaxList())!==null&&r!==void 0?r:this.getParentOrThrow(),i=this.getChildIndex(),a=this.getTemplate();return qa({customMappings:(s,u)=>[{currentNode:a,newNode:s.getChildren(u)[i]}],parent:n,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),n.getChildAtIndex(i)}},l_e=sd,h6=class extends l_e{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(r=>this._getNodeFromCompilerNode(r))}setLiteralValue(r){var n;let i=this.getChildIndex(),a=(n=this.getParentSyntaxList())!==null&&n!==void 0?n:this.getParentOrThrow();return mS({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:r}),a.getChildAtIndex(i)}},u_e=KD(Tr),E6=class extends u_e{},c_e=KD(Tr),b6=class extends c_e{},d_e=ud(Tr),S6=class extends d_e{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},f_e=KD(Tr),T6=class extends f_e{};function uq(e){return class extends e{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(r=>r.getDeclarationNode()).filter(r=>r!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var p_e=ud(Tr),x6=class extends p_e{},m_e=uq(kh(_v(sd))),D6=class extends m_e{getImplementations(){return this._context.languageService.getImplementations(this)}},__e=uq(kh(_v(Tr))),C6=class extends __e{},A6=class extends Tr{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},oUe=e=>YH(XH(KE($T($6(e))))),UR=oUe(Tr),L6=class extends UR{remove(){let r=this.getParentOrThrow();switch(r.getKind()){case b.SyntaxKind.VariableDeclarationList:n(this);break;case b.SyntaxKind.CatchClause:i(this);break;default:throw new b.errors.NotImplementedError(`Not implemented for syntax kind: ${r.getKindName()}`)}function n(a){let s=r.getParentIfKindOrThrow(b.SyntaxKind.VariableStatement);s.getDeclarations().length===1?s.remove():mv(a)}function i(a){Bs({children:[a.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.OpenParenToken),a,a.getNextSiblingIfKindOrThrow(b.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(){return b.errors.throwIfNullOrUndefined(this.getVariableStatement(),"Expected the grandparent to be a variable statement.")}getVariableStatement(){let r=this.getParentOrThrow().getParentOrThrow();return Tr.isVariableStatement(r)?r:void 0}set(r){return io(UR.prototype,this,r),this}getStructure(){return uo(UR.prototype,this,{kind:Oe.StructureKind.VariableDeclaration})}},g_e=sf(Tr),N6=class extends g_e{getDeclarations(){return this.compilerNode.declarations.map(r=>this._getNodeFromCompilerNode(r))}getDeclarationKind(){let r=this.compilerNode.flags;return r&b.ts.NodeFlags.Let?Oe.VariableDeclarationKind.Let:r&b.ts.NodeFlags.Const?Oe.VariableDeclarationKind.Const:Oe.VariableDeclarationKind.Var}getDeclarationKindKeyword(){let r=this.getDeclarationKind();switch(r){case Oe.VariableDeclarationKind.Const:return this.getFirstChildByKindOrThrow(b.SyntaxKind.ConstKeyword);case Oe.VariableDeclarationKind.Let:return this.getFirstChildByKindOrThrow(b.SyntaxKind.LetKeyword);case Oe.VariableDeclarationKind.Var:return this.getFirstChildByKindOrThrow(b.SyntaxKind.VarKeyword);default:return b.errors.throwNotImplementedForNeverValueError(r)}}setDeclarationKind(r){if(this.getDeclarationKind()===r)return this;let n=this.getDeclarationKindKeyword();return qa({insertPos:n.getStart(),newText:r,parent:this,replacing:{textLength:n.getWidth()}}),this}addDeclaration(r){return this.addDeclarations([r])[0]}addDeclarations(r){return this.insertDeclarations(this.getDeclarations().length,r)}insertDeclaration(r,n){return this.insertDeclarations(r,[n])[0]}insertDeclarations(r,n){let i=this._getWriterWithQueuedChildIndentation(),a=new Ih(this._context.structurePrinterFactory.forVariableDeclaration()),s=this.compilerNode.declarations.length;return r=ku(r,s),a.printText(i,n),j_({parent:this.getFirstChildByKindOrThrow(b.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:r,newText:i.toString(),useTrailingCommas:!1}),af(s,this.getDeclarations(),r,!1)}},I6=class{constructor(r,n){this._context=r,this._compilerSignature=n}get compilerSignature(){return this._compilerSignature}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(n=>this._context.compilerFactory.getTypeParameter(n))}getParameters(){return this.compilerSignature.parameters.map(r=>this._context.compilerFactory.getSymbol(r))}getReturnType(){return this._context.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this._context.typeChecker.compilerObject).map(n=>this._context.compilerFactory.getSymbolDisplayPart(n))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(n=>this._context.compilerFactory.getJSDocTagInfo(n))}getDeclaration(){let{compilerFactory:r}=this._context,n=this.compilerSignature.getDeclaration();return r.getNodeFromCompilerNode(n,r.getSourceFileForNode(n))}},P6=class{constructor(r,n){this._context=r,this._compilerSymbol=n,this.getValueDeclaration(),this.getDeclarations()}get compilerSymbol(){return this._compilerSymbol}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this._context.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),"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()&b.SymbolFlags.Alias)===b.SymbolFlags.Alias}isOptional(){return(this.getFlags()&b.SymbolFlags.Optional)===b.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(r){return(this.compilerSymbol.flags&r)===r}getValueDeclarationOrThrow(){return b.errors.throwIfNullOrUndefined(this.getValueDeclaration(),()=>`Expected to find the value declaration of symbol '${this.getName()}'.`)}getValueDeclaration(){let r=this.compilerSymbol.valueDeclaration;if(r!=null)return this._context.compilerFactory.getNodeFromCompilerNode(r,this._context.compilerFactory.getSourceFileForNode(r))}getDeclarations(){var r;return((r=this.compilerSymbol.declarations)!==null&&r!==void 0?r:[]).map(n=>this._context.compilerFactory.getNodeFromCompilerNode(n,this._context.compilerFactory.getSourceFileForNode(n)))}getExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getExport(r),`Expected to find export with name: ${r}`)}getExport(r){if(this.compilerSymbol.exports==null)return;let n=this.compilerSymbol.exports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExports(){return this.compilerSymbol.exports==null?[]:b.ArrayUtils.from(this.compilerSymbol.exports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getGlobalExportOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getGlobalExport(r),`Expected to find global export with name: ${r}`)}getGlobalExport(r){if(this.compilerSymbol.globalExports==null)return;let n=this.compilerSymbol.globalExports.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:b.ArrayUtils.from(this.compilerSymbol.globalExports.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getMemberOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getMember(r),`Expected to find member with name: ${r}`)}getMember(r){if(this.compilerSymbol.members==null)return;let n=this.compilerSymbol.members.get(b.ts.escapeLeadingUnderscores(r));return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getMembers(){return this.compilerSymbol.members==null?[]:b.ArrayUtils.from(this.compilerSymbol.members.values()).map(r=>this._context.compilerFactory.getSymbol(r))}getDeclaredType(){return this._context.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(r){return this._context.typeChecker.getTypeOfSymbolAtLocation(this,r)}getFullyQualifiedName(){return this._context.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this._context.typeChecker.compilerObject).map(r=>new lL(r))}},FD=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},FE=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getSpan(){return new FD(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}};co([b.Memoize],FE.prototype,"getSpan",null);var fS=class{constructor(r,n){this._context=r,this._compilerObject=n;let i=r.compilerFactory.addOrGetSourceFileFromFilePath(r.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName),{markInProject:!1,scriptKind:void 0});this._existingFileExists=i!=null,n.isNewFile||(this._sourceFile=i)}getFilePath(){return this._compilerObject.fileName}getSourceFile(){return this._sourceFile}getTextChanges(){return this._compilerObject.textChanges.map(r=>new FE(r))}applyChanges(r={}){if(this._isApplied)return;if(this.isNewFile()&&this._existingFileExists&&!r.overwrite)throw new b.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 n;if(this.isNewFile()?n=this._context.project.createSourceFile(this.getFilePath(),"",{overwrite:r.overwrite}):n=this.getSourceFile(),n==null)throw new b.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return n.applyTextChanges(this.getTextChanges()),n._markAsInProject(),this._isApplied=!0,this}isNewFile(){return!!this._compilerObject.isNewFile}};co([b.Memoize],fS.prototype,"getTextChanges",null);var O6=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(r=>new fS(this._context,r))}},k6=class extends O6{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},uL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getChanges(){return this.compilerObject.changes.map(r=>new fS(this._context,r))}applyChanges(r){for(let n of this.getChanges())n.applyChanges(r);return this}};co([b.Memoize],uL.prototype,"getChanges",null);var pv=class{constructor(r,n){this._context=r,this._compilerObject=n,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(r.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 FD(this.compilerObject.textSpan)}getNode(){let r=this.getTextSpan(),n=this.getSourceFile(),i=r.getStart(),a=r.getEnd();return s();function s(){let u;return n._context.compilerFactory.forgetNodesCreatedInBlock(p=>{let f,m=n;for(;m!=null;){if(f==null&&(u=m),m.getStart()===i&&m.getWidth()===a)u=f=m;else if(f!=null)break;m=m.getChildAtPos(i)}u!=null&&p(u)}),u}}getOriginalTextSpan(){let{originalTextSpan:r}=this.compilerObject;return r==null?void 0:new FD(r)}getOriginalFileName(){return this.compilerObject.originalFileName}};co([b.Memoize],pv.prototype,"getTextSpan",null);co([b.Memoize],pv.prototype,"getNode",null);co([b.Memoize],pv.prototype,"getOriginalTextSpan",null);var GD=class extends pv{constructor(r,n){super(r,n),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 r=this.getTextSpan().getStart(),n=i(this.getSourceFile());return n?.getParentOrThrow();function i(a){if(a.getKind()===b.SyntaxKind.Identifier&&a.getStart()===r)return a;for(let s of a._getChildrenIterator())if(s.getPos()<=r&&s.getEnd()>r)return i(s)}}};co([b.Memoize],GD.prototype,"getDeclarationNode",null);var pS=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let r=this.compilerObject.next;if(r!=null)return r instanceof Array?r.map(n=>new pS(n)):[new pS(r)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},WT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let r=this.compilerObject.file;return r==null?void 0:this._context.compilerFactory.getSourceFile(r,{markInProject:!1})}getMessageText(){let r=this._compilerObject.messageText;return typeof r=="string"?r:this._context==null?new pS(r):this._context.compilerFactory.getDiagnosticMessageChain(r)}getLineNumber(){let r=this.getSourceFile(),n=this.getStart();if(!(r==null||n==null))return b.StringUtils.getLineNumberAtPos(r.getFullText(),n)}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}};co([b.Memoize],WT.prototype,"getSourceFile",null);var cL=class extends WT{constructor(r,n){super(r,n)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},R6=class{constructor(r,n){this._compilerObject=n,this._context=r}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}},dL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(r=>new R6(this._context,r))}};co([b.Memoize],dL.prototype,"getOutputFiles",null);var VT=class{constructor(r,n){this._context=r,this._compilerObject=n,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(r=>this._context.compilerFactory.getDiagnostic(r))}};co([b.Memoize],VT.prototype,"getDiagnostics",null);var fL=class extends pv{constructor(r,n){super(r,n)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],fL.prototype,"getDisplayParts",null);var M6=class extends VT{constructor(r,n,i){super(r,n),this._files=i}getFiles(){return this._files}saveFiles(){let r=this._context.fileSystemWrapper,n=this._files.map(i=>r.writeFile(i.filePath,i.writeByteOrderMark?"\uFEFF"+i.text:i.text));return Promise.all(n)}saveFilesSync(){let r=this._context.fileSystemWrapper;for(let n of this._files)r.writeFileSync(n.filePath,n.writeByteOrderMark?"\uFEFF"+n.text:n.text)}},pL=class{constructor(r,n){this._context=r,this._compilerObject=n}get compilerObject(){return this._compilerObject}getEdits(){return this.compilerObject.edits.map(r=>new fS(this._context,r))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(r){for(let n of this.getEdits())n.applyChanges(r);return this}};co([b.Memoize],pL.prototype,"getEdits",null);var mL=class{constructor(r,n){this._context=r,this._compilerObject=n,this._references=this.compilerObject.references.map(i=>r.compilerFactory.getReferencedSymbolEntry(i))}get compilerObject(){return this._compilerObject}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this._references}};co([b.Memoize],mL.prototype,"getDefinition",null);var _L=class extends GD{constructor(r,n){super(r,n)}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],_L.prototype,"getDisplayParts",null);var w6=class extends pv{constructor(r,n){super(r,n)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},F6=class extends w6{constructor(r,n){super(r,n)}isDefinition(){return this.compilerObject.isDefinition}},G6=class extends pv{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},B6=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},gL=class{constructor(r){this._context=r}get compilerObject(){return this._getCompilerObject()}_reset(r){this._getCompilerObject=r}getAmbientModules(){return this.compilerObject.getAmbientModules().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentType(r){return this._context.compilerFactory.getType(this.compilerObject.getApparentType(r.compilerType))}getConstantValue(r){return this.compilerObject.getConstantValue(r.compilerNode)}getFullyQualifiedName(r){return this.compilerObject.getFullyQualifiedName(r.compilerSymbol)}getTypeAtLocation(r){return this._context.compilerFactory.getType(this.compilerObject.getTypeAtLocation(r.compilerNode))}getContextualType(r){let n=this.compilerObject.getContextualType(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getType(n)}getTypeOfSymbolAtLocation(r,n){return this._context.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(r.compilerSymbol,n.compilerNode))}getDeclaredTypeOfSymbol(r){return this._context.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(r.compilerSymbol))}getSymbolAtLocation(r){let n=this.compilerObject.getSymbolAtLocation(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getAliasedSymbol(r){if(!r.hasFlags(b.SymbolFlags.Alias))return;let n=this.compilerObject.getAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getImmediatelyAliasedSymbol(r){let n=this.compilerObject.getImmediateAliasedSymbol(r.compilerSymbol);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getExportSymbolOfSymbol(r){return this._context.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(r.compilerSymbol))}getPropertiesOfType(r){return this.compilerObject.getPropertiesOfType(r.compilerType).map(n=>this._context.compilerFactory.getSymbol(n))}getTypeText(r,n,i){return i==null&&(i=this._getDefaultTypeFormatFlags(n)),this.compilerObject.typeToString(r.compilerType,n?.compilerNode,i)}getReturnTypeOfSignature(r){return this._context.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(r.compilerSignature))}getSignatureFromNode(r){let n=this.compilerObject.getSignatureFromDeclaration(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSignature(n)}getExportsOfModule(r){return(this.compilerObject.getExportsOfModule(r.compilerSymbol)||[]).map(i=>this._context.compilerFactory.getSymbol(i))}getExportSpecifierLocalTargetSymbol(r){let n=this.compilerObject.getExportSpecifierLocalTargetSymbol(r.compilerNode);return n==null?void 0:this._context.compilerFactory.getSymbol(n)}getResolvedSignature(r){let n=this.compilerObject.getResolvedSignature(r.compilerNode);if(!(!n||!n.declaration))return this._context.compilerFactory.getSignature(n)}getResolvedSignatureOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getResolvedSignature(r),"Signature could not be resolved.")}getBaseTypeOfLiteralType(r){return this._context.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(r.compilerType))}getSymbolsInScope(r,n){return this.compilerObject.getSymbolsInScope(r.compilerNode,n).map(i=>this._context.compilerFactory.getSymbol(i))}getTypeArguments(r){return this.compilerObject.getTypeArguments(r.compilerType).map(n=>this._context.compilerFactory.getType(n))}_getDefaultTypeFormatFlags(r){let n=b.TypeFormatFlags.UseTypeOfFunction|b.TypeFormatFlags.NoTruncation|b.TypeFormatFlags.UseFullyQualifiedType|b.TypeFormatFlags.WriteTypeArgumentsOfSignature;return r!=null&&r.getKind()===b.SyntaxKind.TypeAliasDeclaration&&(n|=b.TypeFormatFlags.InTypeAlias),n}},U6=class{constructor(r){this._context=r.context,this._configFileParsingDiagnostics=r.configFileParsingDiagnostics,this._typeChecker=new gL(this._context),this._reset(r.rootNames,r.host)}get compilerObject(){return this._getOrCreateCompilerObject()}_isCompilerProgramCreated(){return this._createdCompilerObject!=null}_reset(r,n){let i=this._context.compilerOptions.get();this._getOrCreateCompilerObject=()=>(this._createdCompilerObject==null&&(this._createdCompilerObject=b.ts.createProgram(r,i,n,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(r={}){if(r.writeFile){let s=`Cannot specify a ${b.nameof(r,"writeFile")} option when emitting asynchrously. Use ${b.nameof(this,"emitSync")}() instead.`;throw new b.errors.InvalidOperationError(s)}let{fileSystemWrapper:n}=this._context,i=[],a=this._emit({writeFile:(s,u,p)=>{i.push(n.writeFile(n.getStandardizedAbsolutePath(s),p?"\uFEFF"+u:u))},...r});return await Promise.all(i),new VT(this._context,a)}emitSync(r={}){return new VT(this._context,this._emit(r))}emitToMemory(r={}){let n=[],{fileSystemWrapper:i}=this._context,a=this._emit({writeFile:(s,u,p)=>{n.push({filePath:i.getStandardizedAbsolutePath(s),text:u,writeByteOrderMark:p||!1})},...r});return new M6(this._context,a,n)}_emit(r={}){let n=r.targetSourceFile!=null?r.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:i,customTransformers:a,writeFile:s}=r,u=void 0;return this.compilerObject.emit(n,s,u,i,a)}getSyntacticDiagnostics(r){return this.compilerObject.getSyntacticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getSemanticDiagnostics(r){return this.compilerObject.getSemanticDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnostic(i))}getDeclarationDiagnostics(r){return this.compilerObject.getDeclarationDiagnostics(r?.compilerNode).map(i=>this._context.compilerFactory.getDiagnosticWithLocation(i))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(n=>this._context.compilerFactory.getDiagnostic(n))}getEmitModuleResolutionKind(){return b.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(r){return r.isFromExternalLibrary()}},K6=class{constructor(r){var n;this._projectVersion=0,this._context=r.context;let{languageServiceHost:i,compilerHost:a}=b.createHosts({transactionalFileSystem:this._context.fileSystemWrapper,sourceFileContainer:this._context.getSourceFileContainer(),compilerOptions:this._context.compilerOptions,getNewLine:()=>this._context.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this._projectVersion}`,resolutionHost:(n=r.resolutionHost)!==null&&n!==void 0?n:{},libFolderPath:r.libFolderPath,skipLoadingLibFiles:r.skipLoadingLibFiles});this._compilerHost=a,this._compilerObject=b.ts.createLanguageService(i,this._context.compilerFactory.documentRegistry),this._program=new U6({context:this._context,rootNames:Array.from(this._context.compilerFactory.getSourceFilePaths()),host:this._compilerHost,configFileParsingDiagnostics:r.configFileParsingDiagnostics}),this._context.compilerFactory.onSourceFileAdded(s=>{s._isInProject()&&this._reset()}),this._context.compilerFactory.onSourceFileRemoved(()=>this._reset())}get compilerObject(){return this._compilerObject}_reset(){this._projectVersion+=1,this._program._reset(Array.from(this._context.compilerFactory.getSourceFilePaths()),this._compilerHost)}getProgram(){return this._program}getDefinitions(r){return this.getDefinitionsAtPosition(r._sourceFile,r.getStart())}getDefinitionsAtPosition(r,n){return(this.compilerObject.getDefinitionAtPosition(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getDefinitionInfo(a))}getImplementations(r){return this.getImplementationsAtPosition(r._sourceFile,r.getStart())}getImplementationsAtPosition(r,n){return(this.compilerObject.getImplementationAtPosition(r.getFilePath(),n)||[]).map(a=>new fL(this._context,a))}findReferences(r){return this.findReferencesAtPosition(r._sourceFile,r.getStart())}findReferencesAsNodes(r){let n=this.findReferences(r);return Array.from(i());function*i(){for(let a of n){let s=a.getDefinition().getKind()===b.ts.ScriptElementKind.alias,u=a.getReferences();for(let p=0;p<u.length;p++){let f=u[p];(s||!f.isDefinition()||p>0)&&(yield f.getNode())}}}}findReferencesAtPosition(r,n){return(this.compilerObject.findReferences(r.getFilePath(),n)||[]).map(a=>this._context.compilerFactory.getReferencedSymbol(a))}findRenameLocations(r,n={}){let i=n.usePrefixAndSuffixText==null?this._context.manipulationSettings.getUsePrefixAndSuffixTextForRename():n.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(r._sourceFile.getFilePath(),r.getStart(),n.renameInStrings||!1,n.renameInComments||!1,i)||[]).map(s=>new G6(this._context,s))}getSuggestionDiagnostics(r){let n=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getSuggestionDiagnostics(n).map(a=>this._context.compilerFactory.getDiagnosticWithLocation(a))}getFormattingEditsForRange(r,n,i){return(this.compilerObject.getFormattingEditsForRange(r,n[0],n[1],this._getFilledSettings(i))||[]).map(a=>new FE(a))}getFormattingEditsForDocument(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r);return(this.compilerObject.getFormattingEditsForDocument(i,this._getFilledSettings(n))||[]).map(a=>new FE(a))}getFormattedDocumentText(r,n){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),a=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(i);if(a==null)throw new b.errors.FileNotFoundError(i);n=this._getFilledSettings(n);let s=this.getFormattingEditsForDocument(i,n),u=HH(a,s),p=n.newLineCharacter;return n.ensureNewLineAtEndOfFile&&!u.endsWith(p)&&(u+=p),u.replace(/\r?\n/g,p)}getEmitOutput(r,n){let i=this._getFilePathFromFilePathOrSourceFile(r),a=this.compilerObject;return new dL(this._context,s());function s(){let u=a.getProgram();return u==null||u.getSourceFile(i)==null?{emitSkipped:!0,outputFiles:[]}:a.getEmitOutput(i,n)}}getIdentationAtPosition(r,n,i){let a=this._getFilePathFromFilePathOrSourceFile(r);return i==null?i=this._context.manipulationSettings.getEditorSettings():jH(i,this._context.manipulationSettings),this.compilerObject.getIndentationAtPosition(a,n,i)}organizeImports(r,n={},i={}){let a={type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)};return this.compilerObject.organizeImports(a,this._getFilledSettings(n),this._getFilledUserPreferences(i)).map(s=>new fS(this._context,s))}getEditsForRefactor(r,n,i,a,s,u={}){let p=this._getFilePathFromFilePathOrSourceFile(r),f=typeof i=="number"?i:{pos:i.getPos(),end:i.getEnd()},m=this.compilerObject.getEditsForRefactor(p,this._getFilledSettings(n),f,a,s,this._getFilledUserPreferences(u));return m!=null?new pL(this._context,m):void 0}getCombinedCodeFix(r,n,i={},a={}){let s=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this._getFilePathFromFilePathOrSourceFile(r)},n,this._getFilledSettings(i),this._getFilledUserPreferences(a||{}));return new uL(this._context,s)}getCodeFixesAtPosition(r,n,i,a,s={},u={}){let p=this._getFilePathFromFilePathOrSourceFile(r);return this.compilerObject.getCodeFixesAtPosition(p,n,i,a,this._getFilledSettings(s),this._getFilledUserPreferences(u||{})).map(m=>new k6(this._context,m))}_getFilePathFromFilePathOrSourceFile(r){let n=typeof r=="string"?this._context.fileSystemWrapper.getStandardizedAbsolutePath(r):r.getFilePath();if(!this._context.compilerFactory.containsSourceFileAtPath(n))throw new b.errors.FileNotFoundError(n);return n}_getFilledSettings(r){return r._filled||(r=Object.assign(this._context.getFormatCodeSettings(),r),wBe(r,this._context.manipulationSettings),r._filled=!0),r}_getFilledUserPreferences(r){return Object.assign(this._context.getUserPreferences(),r)}},yL=class{constructor(r,n){this._context=r,this._compilerType=n}get compilerType(){return this._compilerType}getText(r,n){return this._context.typeChecker.getTypeText(this,r,n)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(n=>this._context.compilerFactory.getType(n))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getArrayElementType(),"Expected to find an array element type.")}getArrayElementType(){if(!!this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(n=>this._context.compilerFactory.getType(n))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(r=>this._context.compilerFactory.getSignature(r))}getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected to find a constraint.")}getConstraint(){let r=this.compilerType.getConstraint();return r==null?void 0:this._context.compilerFactory.getType(r)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected to find a default type.")}getDefault(){let r=this.compilerType.getDefault();return r==null?void 0:this._context.compilerFactory.getType(r)}getProperties(){return this.compilerType.getProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getPropertyOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getProperty(r),()=>Ou("symbol property",r))}getProperty(r){return Zde(this.getProperties(),r)}getApparentProperties(){return this.compilerType.getApparentProperties().map(r=>this._context.compilerFactory.getSymbol(r))}getApparentProperty(r){return Zde(this.getApparentProperties(),r)}isNullable(){return this.getUnionTypes().some(r=>r.isNull()||r.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let r=this.compilerType.getNumberIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getStringIndexType(){let r=this.compilerType.getStringIndexType();return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetType(){let r=this.compilerType.target||void 0;return r==null?void 0:this._context.compilerFactory.getType(r)}getTargetTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getTargetType(),"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(r=>this._context.compilerFactory.getType(r)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(r=>this._context.compilerFactory.getType(r)):[]}getLiteralValue(){var r;return(r=this.compilerType)===null||r===void 0?void 0:r.value}getLiteralValueOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralValue(),"Type was not a literal type.")}getLiteralFreshType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.freshType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralFreshTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),"Type was not a literal type.")}getLiteralRegularType(){var r;let n=(r=this.compilerType)===null||r===void 0?void 0:r.regularType;return n==null?void 0:this._context.compilerFactory.getType(n)}getLiteralRegularTypeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),"Type was not a literal type.")}getSymbol(){let r=this.compilerType.getSymbol();return r==null?void 0:this._context.compilerFactory.getSymbol(r)}getSymbolOrThrow(){return b.errors.throwIfNullOrUndefined(this.getSymbol(),"Expected to find a symbol.")}isAnonymous(){return this._hasObjectFlag(b.ObjectFlags.Anonymous)}isAny(){return this._hasTypeFlag(b.TypeFlags.Any)}isNever(){return this._hasTypeFlag(b.TypeFlags.Never)}isArray(){let r=this.getSymbol();return r==null?!1:(r.getName()==="Array"||r.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let r=this.getSymbol();return r==null?!1:r.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this._hasTypeFlag(b.TypeFlags.TemplateLiteral)}isBoolean(){return this._hasTypeFlag(b.TypeFlags.Boolean)}isString(){return this._hasTypeFlag(b.TypeFlags.String)}isNumber(){return this._hasTypeFlag(b.TypeFlags.Number)}isLiteral(){let r=this.isBooleanLiteral();return this.compilerType.isLiteral()||r}isBooleanLiteral(){return this._hasTypeFlag(b.TypeFlags.BooleanLiteral)}isEnumLiteral(){return this._hasTypeFlag(b.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this._hasTypeFlag(b.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this._hasTypeFlag(b.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let n=this.getSymbol();if(n==null)return!1;let i=n.getValueDeclaration();return i!=null&&Tr.isEnumDeclaration(i)}isInterface(){return this._hasObjectFlag(b.ObjectFlags.Interface)}isObject(){return this._hasTypeFlag(b.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let r=this.getTargetType();return r==null?!1:r._hasObjectFlag(b.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this._hasTypeFlag(b.TypeFlags.Unknown)}isNull(){return this._hasTypeFlag(b.TypeFlags.Null)}isUndefined(){return this._hasTypeFlag(b.TypeFlags.Undefined)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}_hasTypeFlag(r){return(this.compilerType.flags&r)===r}_hasObjectFlag(r){return(this.getObjectFlags()&r)===r}},W6=class extends yL{getConstraintOrThrow(){return b.errors.throwIfNullOrUndefined(this.getConstraint(),"Expected type parameter to have a constraint.")}getConstraint(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getConstraint();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}getDefaultOrThrow(){return b.errors.throwIfNullOrUndefined(this.getDefault(),"Expected type parameter to have a default type.")}getDefault(){let r=this._getTypeParameterDeclaration();if(r==null)return;let n=r.getDefault();if(n!=null)return this._context.typeChecker.getTypeAtLocation(n)}_getTypeParameterDeclaration(){let r=this.getSymbol();if(r==null)return;let n=r.getDeclarations()[0];if(n!=null&&!!Tr.isTypeParameterDeclaration(n))return n}},vL=class{constructor(r,n){this._skippedFilePaths=r,this._outputFilePaths=n}getSkippedFilePaths(){return this._skippedFilePaths}getOutputFilePaths(){return this._outputFilePaths}},OE=class{constructor(r,n){this.__context=r,this._setPathInternal(n)}_setPathInternal(r){this._path=r,this._pathParts=r.split("/").filter(n=>n.length>0)}get _context(){return this._throwIfDeletedOrRemoved(),this.__context}isAncestorOf(r){return OE._isAncestorOfDir(this,r)}isDescendantOf(r){return OE._isAncestorOfDir(r,this)}_getDepth(){return this._pathParts.length}getPath(){return this._throwIfDeletedOrRemoved(),this._path}getBaseName(){return this._pathParts[this._pathParts.length-1]}getParentOrThrow(){return b.errors.throwIfNullOrUndefined(this.getParent(),()=>`Parent directory of ${this.getPath()} does not exist or was never added.`)}getParent(){if(!b.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(b.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>typeof r=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(n)}return this.getDirectories().find(r)}getSourceFileOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getSourceFile(r),()=>typeof r=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(r){if(typeof r=="string"){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n)}for(let n of this._getSourceFilesIterator())if(r(n))return n}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this;if(typeof r=="string"||r instanceof Array){let u=typeof r=="string"?[r]:r;return Array.from(s(u))}else return Array.from(this._getSourceFilesIterator());function*s(u){let p=Array.from(m()),f=b.matchGlobs(p,u,a.getPath());for(let g of f)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(g));function*m(){for(let g of a._getDescendantSourceFilesIterator())yield g.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let r of this._getSourceFilesIterator())yield r;for(let r of this._getDirectoriesIterator())yield*r._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let r of this.getDirectories())yield r,yield*r._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(r){return r=typeof r=="string"?[r]:r,r=r.map(n=>b.FileUtils.pathIsAbsolute(n)?n:b.FileUtils.pathJoin(this.getPath(),n)),this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(i,{...n,markInProject:this._isInProject()})}addDirectoryAtPath(r,n={}){let i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(i,{...n,markInProject:this._isInProject()})}createDirectory(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(n,{markInProject:this._isInProject()})}createSourceFile(r,n,i){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.compilerFactory.createSourceFile(a,n||"",{...i||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(n,{markInProject:this._isInProject()})}addSourceFileAtPath(r){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(n,{markInProject:this._isInProject()})}async emit(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[],s=[];for(let u of this._emitInternal(r))Ife(u)?s.push(u):(i.push(n.writeFile(u.filePath,u.fileText)),a.push(u.filePath));return await Promise.all(i),new vL(s,a)}emitSync(r={}){let{fileSystemWrapper:n}=this._context,i=[],a=[];for(let s of this._emitInternal(r))Ife(s)?a.push(s):(n.writeFileSync(s.filePath,s.fileText),i.push(s.filePath));return new vL(a,i)}_emitInternal(r={}){let{emitOnlyDtsFiles:n=!1}=r,i=r.outDir==null?void 0:/\.js$/i,a=r.outDir==null?void 0:/\.js\.map$/i,s=r.declarationDir==null&&r.outDir==null?void 0:/\.d\.ts$/i,u=g=>g==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(g,this.getPath()),p=(g,D)=>g==null?void 0:b.FileUtils.pathJoin(g,D.getBaseName()),f=this._context.compilerOptions.get().declarationDir!=null||r.declarationDir!=null;return m(this,u(r.outDir),u(r.declarationDir));function*m(g,D,P){for(let B of g.getSourceFiles()){let K=B.getEmitOutput({emitOnlyDtsFiles:n});if(K.getEmitSkipped()){yield B.getFilePath();continue}for(let h of K.getOutputFiles()){let S=h.getFilePath(),U=h.getWriteByteOrderMark()?b.FileUtils.getTextWithByteOrderMark(h.getText()):h.getText();D!=null&&(i.test(S)||a.test(S)||!f&&s.test(S))?S=b.FileUtils.pathJoin(D,b.FileUtils.getBaseName(S)):P!=null&&s.test(S)&&(S=b.FileUtils.pathJoin(P,b.FileUtils.getBaseName(S))),yield{filePath:S,fileText:U}}}for(let B of g.getDirectories())yield*m(B,p(D,B),p(P,B))}}copyToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.copy(b.FileUtils.pathJoin(i,this.getBaseName()),n)}copy(r,n){let i=this.getPath(),a=this._context.fileSystemWrapper,s=this._context.fileSystemWrapper.getStandardizedAbsolutePath(r,this.getPath());return i===s?this:(n=sj(n),n.includeUntrackedFiles&&a.queueCopyDirectory(i,s),this._copyInternal(s,n))}async copyImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return await this.save(),this;n=sj(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&await i.copyDirectoryImmediately(a,s),await u.save(),u}copyImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);if(a===s)return this.saveSync(),this;n=sj(n);let u=this._copyInternal(s,n);return n.includeUntrackedFiles&&i.copyDirectoryImmediatelySync(a,s),u.saveSync(),u}_copyInternal(r,n){if(this.getPath()===r)return this;let{fileSystemWrapper:a,compilerFactory:s}=this._context,u=[this,...this.getDescendantDirectories()].map(f=>({newDirPath:f===this?r:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r)})),p=this.getDescendantSourceFiles().map(f=>({sourceFile:f,newFilePath:a.getStandardizedAbsolutePath(this.getRelativePathTo(f),r),references:this._getReferencesForCopy(f)}));for(let{newDirPath:f}of u)this._context.compilerFactory.createDirectoryOrAddIfExists(f,{markInProject:this._isInProject()});for(let{sourceFile:f,newFilePath:m}of p)f._copyInternal(m,n);for(let{references:f,newFilePath:m}of p)this.getSourceFileOrThrow(m)._updateReferencesForCopyInternal(f);return s.getDirectoryFromCache(r)}moveToDirectory(r,n){let i=typeof r=="string"?r:r.getPath();return this.move(b.FileUtils.pathJoin(i,this.getBaseName()),n)}move(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?this:this._moveInternal(s,n,()=>i.queueMoveDirectory(a,s))}async moveImmediately(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(await this.save(),this):(this._moveInternal(s,n),await i.moveDirectoryImmediately(a,s),await this.save(),this)}moveImmediatelySync(r,n){let i=this._context.fileSystemWrapper,a=this.getPath(),s=i.getStandardizedAbsolutePath(r,a);return a===s?(this.saveSync(),this):(this._moveInternal(s,n),i.moveDirectoryImmediatelySync(a,s),this.saveSync(),this)}_moveInternal(r,n,i){let a=this.getPath();if(a===r)return this;let s=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(r),u=s!=null&&s._isInProject();i&&i();let p=this._context.fileSystemWrapper,f=this._context.compilerFactory,m=[this,...this.getDescendantDirectories()].map(D=>({directory:D,oldPath:D.getPath(),newDirPath:D===this?r:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r)})),g=this.getDescendantSourceFiles().map(D=>({sourceFile:D,newFilePath:p.getStandardizedAbsolutePath(this.getRelativePathTo(D),r),references:this._getReferencesForMove(D)}));for(let{directory:D,oldPath:P,newDirPath:B}of m){f.removeDirectoryFromCache(P);let K=f.getDirectoryFromCache(B);K?._forgetOnlyThis(),D._setPathInternal(B),f.addDirectoryToCache(D)}for(let{sourceFile:D,newFilePath:P}of g)D._moveInternal(P,n);for(let{sourceFile:D,references:P}of g)D._updateReferencesForMoveInternal(P,a);return u&&this._markAsInProject(),this}clear(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this._context.fileSystemWrapper.queueMkdir(r)}async clearImmediately(){let r=this.getPath();this._deleteDescendants(),await this._context.fileSystemWrapper.clearDirectoryImmediately(r)}clearImmediatelySync(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(r)}delete(){let r=this.getPath();this._deleteDescendants(),this._context.fileSystemWrapper.queueDirectoryDelete(r),this.forget()}_deleteDescendants(){for(let r of this.getSourceFiles())r.delete();for(let r of this.getDirectories())r.delete()}async deleteImmediately(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),await r.deleteDirectoryImmediately(n)}deleteImmediatelySync(){let{fileSystemWrapper:r}=this._context,n=this.getPath();this.forget(),r.deleteDirectoryImmediatelySync(n)}forget(){if(!this.wasForgotten()){for(let r of this.getSourceFiles())r.forget();for(let r of this.getDirectories())r.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 r=this.getDescendantSourceFiles().filter(n=>!n.isSaved());await Promise.all(r.map(n=>n.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(n=>!n.isSaved()).forEach(n=>n.saveSync())}getRelativePathTo(r){let n=this;return b.FileUtils.getRelativePathTo(this.getPath(),i());function i(){return r instanceof kE?r.getFilePath():r instanceof OE?r.getPath():n._context.fileSystemWrapper.getStandardizedAbsolutePath(r,n.getPath())}}getRelativePathAsModuleSpecifierTo(r){let n=this._context.program.getEmitModuleResolutionKind(),i=this,a=b.FileUtils.getRelativePathTo(this.getPath(),s()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return a.startsWith("../")?a:"./"+a;function s(){return r instanceof kE?u(r):r instanceof OE?p(r):f(i._context.fileSystemWrapper.getStandardizedAbsolutePath(r,i.getPath()));function u(m){return f(m.getFilePath())}function p(m){switch(n){case b.ModuleResolutionKind.NodeJs:return m===i?b.FileUtils.pathJoin(m.getPath(),"index.ts"):m.getPath();case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return b.FileUtils.pathJoin(m.getPath(),"index.ts");default:return b.errors.throwNotImplementedForNeverValueError(n)}}function f(m){let g=b.FileUtils.getDirPath(m);switch(n){case b.ModuleResolutionKind.NodeJs:return g===i.getPath()?m:m.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case b.ModuleResolutionKind.Classic:case b.ModuleResolutionKind.Node16:case b.ModuleResolutionKind.NodeNext:return m;default:return b.errors.throwNotImplementedForNeverValueError(n)}}}}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(b.FileUtils.getDirPath(this.getPath()))}_throwIfDeletedOrRemoved(){if(this.wasForgotten())throw new b.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}_getReferencesForCopy(r){return r._getReferencesForCopyInternal().filter(i=>!this.isAncestorOf(i[1]))}_getReferencesForMove(r){let{literalReferences:n,referencingLiterals:i}=r._getReferencesForMoveInternal();return{literalReferences:n.filter(a=>!this.isAncestorOf(a[1])),referencingLiterals:i.filter(a=>!this.isAncestorOf(a._sourceFile))}}static _isAncestorOfDir(r,n){if(n instanceof kE&&(n=n.getDirectory(),r===n))return!0;if(r._pathParts.length>=n._pathParts.length)return!1;for(let i=r._pathParts.length-1;i>=0;i--)if(r._pathParts[i]!==n._pathParts[i])return!1;return!0}};function sj(e){return e=b.ObjectUtils.clone(e||{}),mu(e,"includeUntrackedFiles",!0),e}function Ife(e){return typeof e=="string"}var wH=class{constructor(r,n){this.compilerFactory=r,this.fileSystemWrapper=n}addDirectoryAtPathIfExists(r,n){let i=this.compilerFactory.getDirectoryFromPath(r,n);if(i!=null){if(n.recursive)for(let a of b.FileUtils.getDescendantDirectories(this.fileSystemWrapper,r))this.compilerFactory.createDirectoryOrAddIfExists(a,n);return i}}addDirectoryAtPath(r,n){let i=this.addDirectoryAtPathIfExists(r,n);if(i==null)throw new b.errors.DirectoryNotFoundError(r);return i}createDirectoryOrAddIfExists(r,n){return this.compilerFactory.createDirectoryOrAddIfExists(r,n)}addSourceFileAtPathIfExists(r,n){return this.compilerFactory.addOrGetSourceFileFromFilePath(r,{markInProject:n.markInProject,scriptKind:void 0})}addSourceFileAtPath(r,n){let i=this.addSourceFileAtPathIfExists(r,n);if(i==null)throw new b.errors.FileNotFoundError(this.fileSystemWrapper.getStandardizedAbsolutePath(r));return i}addSourceFilesAtPaths(r,n){typeof r=="string"&&(r=[r]);let i=[],a=new Set;for(let s of this.fileSystemWrapper.globSync(r)){let u=this.addSourceFileAtPathIfExists(s,n);u!=null&&i.push(u),a.add(b.FileUtils.getDirPath(s))}for(let s of b.FileUtils.getParentMostPaths(Array.from(a)))this.addDirectoryAtPathIfExists(s,{recursive:!0,markInProject:n.markInProject});return i}},FH=class{constructor(r){this.context=r,this.directoriesByPath=new b.KeyValueCache,this.sourceFilesByDirPath=new b.KeyValueCache,this.directoriesByDirPath=new b.KeyValueCache,this.orphanDirs=new b.KeyValueCache}has(r){return this.directoriesByPath.has(r)}get(r){if(!this.directoriesByPath.has(r)){for(let n of this.orphanDirs.getValues())if(b.FileUtils.pathStartsWith(n.getPath(),r))return this.createOrAddIfExists(r);return}return this.directoriesByPath.get(r)}getOrphans(){return this.orphanDirs.getValues()}getAll(){return this.directoriesByPath.getValuesAsArray()}*getAllByDepth(){let r=new b.KeyValueCache,n=0;for(let a of this.getOrphans())i(a);for(n=Math.min(...Array.from(r.getKeys()));r.getSize()>0;){for(let a of r.get(n)||[])yield a,a.getDirectories().forEach(i);r.removeByKey(n),n++}function i(a){let s=a._getDepth();if(n>s)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${a.getPath()}`);r.getOrCreate(s,()=>[]).push(a)}}remove(r){this.removeFromDirectoriesByDirPath(r),this.directoriesByPath.removeByKey(r),this.orphanDirs.removeByKey(r)}*getChildDirectoriesOfDirectory(r){var n;let i=(n=this.directoriesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}*getChildSourceFilesOfDirectory(r){var n;let i=(n=this.sourceFilesByDirPath.get(r))===null||n===void 0?void 0:n.entries();if(i!=null)for(let a of i)yield a}addSourceFile(r){let n=r.getDirectoryPath();this.createOrAddIfExists(n),this.sourceFilesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeSourceFile(r){let n=b.FileUtils.getDirPath(r),i=this.sourceFilesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.sourceFilesByDirPath.removeByKey(n))}createOrAddIfExists(r){return this.has(r)?this.get(r):(this.fillParentsOfDirPath(r),this.createDirectory(r))}createDirectory(r){let n=new OE(this.context,r);return this.addDirectory(n),n}addDirectory(r){let n=r.getPath(),i=b.FileUtils.getDirPath(n),a=i===n;for(let s of this.orphanDirs.getValues()){let u=s.getPath(),p=b.FileUtils.getDirPath(u);!(p===u)&&p===n&&this.orphanDirs.removeByKey(u)}a||this.addToDirectoriesByDirPath(r),this.has(i)||this.orphanDirs.set(n,r),this.directoriesByPath.set(n,r),this.context.fileSystemWrapper.directoryExistsSync(n)||this.context.fileSystemWrapper.queueMkdir(n);for(let s of this.orphanDirs.getValues())r.isAncestorOf(s)&&this.fillParentsOfDirPath(s.getPath())}addToDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r.getPath()))return;let n=b.FileUtils.getDirPath(r.getPath());this.directoriesByDirPath.getOrCreate(n,()=>new b.SortedKeyValueArray(a=>a.getBaseName(),b.LocaleStringComparer.instance)).set(r)}removeFromDirectoriesByDirPath(r){if(b.FileUtils.isRootDirPath(r))return;let n=b.FileUtils.getDirPath(r),i=this.directoriesByDirPath.get(n);i!=null&&(i.removeByKey(b.FileUtils.getBaseName(r)),i.hasItems()||this.directoriesByDirPath.removeByKey(n))}fillParentsOfDirPath(r){let n=[],i=b.FileUtils.getDirPath(r);for(;r!==i;){if(r=i,i=b.FileUtils.getDirPath(r),this.directoriesByPath.has(r)){for(let a of n)this.createDirectory(a);break}n.unshift(r)}}},GH=class extends b.KeyValueCache{constructor(){super(...arguments),this.forgetStack=[]}getOrCreate(r,n){return super.getOrCreate(r,()=>{let i=n();return this.forgetStack.length>0&&this.forgetStack[this.forgetStack.length-1].add(i),i})}setForgetPoint(){this.forgetStack.push(new Set)}forgetLastPoint(){let r=this.forgetStack.pop();r!=null&&this.forgetNodes(r.values())}rememberNode(r){if(r.wasForgotten())throw new b.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let n=!1;for(let i of this.forgetStack)if(i.delete(r)){n=!0;break}return n&&this.rememberParentOfNode(r),n}rememberParentOfNode(r){let n=r.getParentSyntaxList()||r.getParent();n!=null&&this.rememberNode(n)}forgetNodes(r){for(let n of r)n.wasForgotten()||n.getKind()===b.SyntaxKind.SourceFile||n._forgetOnlyThis()}},sUe={[b.SyntaxKind.SourceFile]:kE,[b.SyntaxKind.ArrayBindingPattern]:eM,[b.SyntaxKind.ArrayLiteralExpression]:iM,[b.SyntaxKind.ArrayType]:kw,[b.SyntaxKind.ArrowFunction]:hw,[b.SyntaxKind.AsExpression]:aM,[b.SyntaxKind.AssertClause]:ew,[b.SyntaxKind.AssertEntry]:rw,[b.SyntaxKind.AwaitExpression]:oM,[b.SyntaxKind.BigIntLiteral]:c6,[b.SyntaxKind.BindingElement]:rM,[b.SyntaxKind.BinaryExpression]:nL,[b.SyntaxKind.Block]:OM,[b.SyntaxKind.BreakStatement]:kM,[b.SyntaxKind.CallExpression]:sM,[b.SyntaxKind.CallSignature]:qF,[b.SyntaxKind.CaseBlock]:RM,[b.SyntaxKind.CaseClause]:MM,[b.SyntaxKind.CatchClause]:wM,[b.SyntaxKind.ClassDeclaration]:Tw,[b.SyntaxKind.ClassExpression]:xw,[b.SyntaxKind.ClassStaticBlockDeclaration]:Dw,[b.SyntaxKind.ConditionalType]:Rw,[b.SyntaxKind.Constructor]:Aw,[b.SyntaxKind.ConstructorType]:Mw,[b.SyntaxKind.ConstructSignature]:zF,[b.SyntaxKind.ContinueStatement]:GM,[b.SyntaxKind.CommaListExpression]:lM,[b.SyntaxKind.ComputedPropertyName]:x6,[b.SyntaxKind.ConditionalExpression]:uM,[b.SyntaxKind.DebuggerStatement]:BM,[b.SyntaxKind.Decorator]:Pw,[b.SyntaxKind.DefaultClause]:UM,[b.SyntaxKind.DeleteExpression]:cM,[b.SyntaxKind.DoStatement]:KM,[b.SyntaxKind.ElementAccessExpression]:aL,[b.SyntaxKind.EmptyStatement]:WM,[b.SyntaxKind.EnumDeclaration]:VF,[b.SyntaxKind.EnumMember]:jF,[b.SyntaxKind.ExportAssignment]:tw,[b.SyntaxKind.ExportDeclaration]:nw,[b.SyntaxKind.ExportSpecifier]:iw,[b.SyntaxKind.ExpressionWithTypeArguments]:ww,[b.SyntaxKind.ExpressionStatement]:VM,[b.SyntaxKind.ExternalModuleReference]:aw,[b.SyntaxKind.QualifiedName]:A6,[b.SyntaxKind.ForInStatement]:jM,[b.SyntaxKind.ForOfStatement]:HM,[b.SyntaxKind.ForStatement]:qM,[b.SyntaxKind.FunctionDeclaration]:Ew,[b.SyntaxKind.FunctionExpression]:bw,[b.SyntaxKind.FunctionType]:Fw,[b.SyntaxKind.GetAccessor]:Lw,[b.SyntaxKind.HeritageClause]:HF,[b.SyntaxKind.Identifier]:D6,[b.SyntaxKind.IfStatement]:JM,[b.SyntaxKind.ImportClause]:ow,[b.SyntaxKind.ImportDeclaration]:sw,[b.SyntaxKind.ImportEqualsDeclaration]:lw,[b.SyntaxKind.ImportSpecifier]:uw,[b.SyntaxKind.ImportType]:Bw,[b.SyntaxKind.ImportTypeAssertionContainer]:Gw,[b.SyntaxKind.IndexedAccessType]:Uw,[b.SyntaxKind.IndexSignature]:$F,[b.SyntaxKind.InferType]:Kw,[b.SyntaxKind.InterfaceDeclaration]:XF,[b.SyntaxKind.IntersectionType]:Ww,[b.SyntaxKind.JSDocAllType]:iF,[b.SyntaxKind.JSDocAugmentsTag]:aF,[b.SyntaxKind.JSDocAuthorTag]:oF,[b.SyntaxKind.JSDocCallbackTag]:sF,[b.SyntaxKind.JSDocClassTag]:lF,[b.SyntaxKind.JSDocDeprecatedTag]:uF,[b.SyntaxKind.JSDocEnumTag]:cF,[b.SyntaxKind.JSDocFunctionType]:dF,[b.SyntaxKind.JSDocImplementsTag]:fF,[b.SyntaxKind.JSDocLink]:pF,[b.SyntaxKind.JSDocLinkCode]:mF,[b.SyntaxKind.JSDocLinkPlain]:_F,[b.SyntaxKind.JSDocMemberName]:gF,[b.SyntaxKind.JSDocNamepathType]:yF,[b.SyntaxKind.JSDocNameReference]:vF,[b.SyntaxKind.JSDocNonNullableType]:hF,[b.SyntaxKind.JSDocNullableType]:EF,[b.SyntaxKind.JSDocOptionalType]:bF,[b.SyntaxKind.JSDocOverrideTag]:SF,[b.SyntaxKind.JSDocParameterTag]:TF,[b.SyntaxKind.JSDocPrivateTag]:xF,[b.SyntaxKind.JSDocPropertyTag]:DF,[b.SyntaxKind.JSDocProtectedTag]:CF,[b.SyntaxKind.JSDocPublicTag]:AF,[b.SyntaxKind.JSDocReturnTag]:NF,[b.SyntaxKind.JSDocReadonlyTag]:LF,[b.SyntaxKind.JSDocSeeTag]:IF,[b.SyntaxKind.JSDocSignature]:PF,[b.SyntaxKind.JSDocTag]:BF,[b.SyntaxKind.JSDocTemplateTag]:OF,[b.SyntaxKind.JSDocText]:kF,[b.SyntaxKind.JSDocThisTag]:RF,[b.SyntaxKind.JSDocTypeExpression]:wF,[b.SyntaxKind.JSDocTypeLiteral]:FF,[b.SyntaxKind.JSDocTypeTag]:GF,[b.SyntaxKind.JSDocTypedefTag]:MF,[b.SyntaxKind.JSDocUnknownType]:UF,[b.SyntaxKind.JSDocVariadicType]:KF,[b.SyntaxKind.JsxAttribute]:ZF,[b.SyntaxKind.JsxClosingElement]:e6,[b.SyntaxKind.JsxClosingFragment]:r6,[b.SyntaxKind.JsxElement]:t6,[b.SyntaxKind.JsxExpression]:n6,[b.SyntaxKind.JsxFragment]:i6,[b.SyntaxKind.JsxOpeningElement]:a6,[b.SyntaxKind.JsxOpeningFragment]:o6,[b.SyntaxKind.JsxSelfClosingElement]:s6,[b.SyntaxKind.JsxSpreadAttribute]:l6,[b.SyntaxKind.JsxText]:u6,[b.SyntaxKind.LabeledStatement]:zM,[b.SyntaxKind.LiteralType]:Vw,[b.SyntaxKind.MappedType]:jw,[b.SyntaxKind.MetaProperty]:fM,[b.SyntaxKind.MethodDeclaration]:wD,[b.SyntaxKind.MethodSignature]:YF,[b.SyntaxKind.ModuleBlock]:cw,[b.SyntaxKind.ModuleDeclaration]:dw,[b.SyntaxKind.NamedExports]:fw,[b.SyntaxKind.NamedImports]:pw,[b.SyntaxKind.NamedTupleMember]:Hw,[b.SyntaxKind.NamespaceExport]:mw,[b.SyntaxKind.NamespaceImport]:_w,[b.SyntaxKind.NewExpression]:pM,[b.SyntaxKind.NonNullExpression]:mM,[b.SyntaxKind.NotEmittedStatement]:$M,[b.SyntaxKind.NoSubstitutionTemplateLiteral]:y6,[b.SyntaxKind.NumericLiteral]:m6,[b.SyntaxKind.ObjectBindingPattern]:tM,[b.SyntaxKind.ObjectLiteralExpression]:gM,[b.SyntaxKind.OmittedExpression]:EM,[b.SyntaxKind.Parameter]:Sw,[b.SyntaxKind.ParenthesizedExpression]:bM,[b.SyntaxKind.ParenthesizedType]:qw,[b.SyntaxKind.PartiallyEmittedExpression]:SM,[b.SyntaxKind.PostfixUnaryExpression]:TM,[b.SyntaxKind.PrefixUnaryExpression]:xM,[b.SyntaxKind.PrivateIdentifier]:C6,[b.SyntaxKind.PropertyAccessExpression]:oL,[b.SyntaxKind.PropertyAssignment]:yM,[b.SyntaxKind.PropertyDeclaration]:Nw,[b.SyntaxKind.PropertySignature]:QF,[b.SyntaxKind.RegularExpressionLiteral]:_6,[b.SyntaxKind.ReturnStatement]:XM,[b.SyntaxKind.SetAccessor]:Iw,[b.SyntaxKind.ShorthandPropertyAssignment]:vM,[b.SyntaxKind.SpreadAssignment]:hM,[b.SyntaxKind.SpreadElement]:DM,[b.SyntaxKind.StringLiteral]:g6,[b.SyntaxKind.SwitchStatement]:YM,[b.SyntaxKind.SyntaxList]:YR,[b.SyntaxKind.TaggedTemplateExpression]:v6,[b.SyntaxKind.TemplateExpression]:h6,[b.SyntaxKind.TemplateHead]:E6,[b.SyntaxKind.TemplateLiteralType]:Jw,[b.SyntaxKind.TemplateMiddle]:b6,[b.SyntaxKind.TemplateSpan]:S6,[b.SyntaxKind.TemplateTail]:T6,[b.SyntaxKind.ThisType]:zw,[b.SyntaxKind.ThrowStatement]:QM,[b.SyntaxKind.TryStatement]:ZM,[b.SyntaxKind.TupleType]:$w,[b.SyntaxKind.TypeAliasDeclaration]:Xw,[b.SyntaxKind.TypeAssertionExpression]:LM,[b.SyntaxKind.TypeLiteral]:Yw,[b.SyntaxKind.TypeOperator]:Qw,[b.SyntaxKind.TypeParameter]:Zw,[b.SyntaxKind.TypePredicate]:eF,[b.SyntaxKind.TypeQuery]:rF,[b.SyntaxKind.TypeReference]:tF,[b.SyntaxKind.UnionType]:nF,[b.SyntaxKind.VariableDeclaration]:L6,[b.SyntaxKind.VariableDeclarationList]:N6,[b.SyntaxKind.VariableStatement]:gw,[b.SyntaxKind.JSDoc]:Ow,[b.SyntaxKind.TypeOfExpression]:NM,[b.SyntaxKind.WhileStatement]:yw,[b.SyntaxKind.WithStatement]:vw,[b.SyntaxKind.YieldExpression]:PM,[b.SyntaxKind.SemicolonToken]:Tr,[b.SyntaxKind.AnyKeyword]:oc,[b.SyntaxKind.BooleanKeyword]:oc,[b.SyntaxKind.FalseKeyword]:f6,[b.SyntaxKind.ImportKeyword]:dM,[b.SyntaxKind.InferKeyword]:Tr,[b.SyntaxKind.NeverKeyword]:Tr,[b.SyntaxKind.NullKeyword]:p6,[b.SyntaxKind.NumberKeyword]:oc,[b.SyntaxKind.ObjectKeyword]:oc,[b.SyntaxKind.StringKeyword]:oc,[b.SyntaxKind.SymbolKeyword]:oc,[b.SyntaxKind.SuperKeyword]:CM,[b.SyntaxKind.ThisKeyword]:AM,[b.SyntaxKind.TrueKeyword]:d6,[b.SyntaxKind.UndefinedKeyword]:oc,[b.SyntaxKind.VoidExpression]:IM},BH=class{constructor(r){this.context=r,this.sourceFileCacheByFilePath=new Map,this.diagnosticCache=new b.WeakCache,this.definitionInfoCache=new b.WeakCache,this.documentSpanCache=new b.WeakCache,this.diagnosticMessageChainCache=new b.WeakCache,this.jsDocTagInfoCache=new b.WeakCache,this.signatureCache=new b.WeakCache,this.symbolCache=new b.WeakCache,this.symbolDisplayPartCache=new b.WeakCache,this.referencedSymbolEntryCache=new b.WeakCache,this.referencedSymbolCache=new b.WeakCache,this.referencedSymbolDefinitionInfoCache=new b.WeakCache,this.typeCache=new b.WeakCache,this.typeParameterCache=new b.WeakCache,this.nodeCache=new GH,this.sourceFileAddedEventContainer=new b.EventContainer,this.sourceFileRemovedEventContainer=new b.EventContainer,this.documentRegistry=new b.DocumentRegistry(r.fileSystemWrapper),this.directoryCache=new FH(r),this.context.compilerOptions.onModified(()=>{let n=Array.from(this.sourceFileCacheByFilePath.values());for(let i of n)T7e(i)})}*getSourceFilesByDirectoryDepth(){for(let r of this.getDirectoriesByDepth())yield*r.getSourceFiles()}getSourceFilePaths(){return this.sourceFileCacheByFilePath.keys()}getChildDirectoriesOfDirectory(r){return this.directoryCache.getChildDirectoriesOfDirectory(r)}getChildSourceFilesOfDirectory(r){return this.directoryCache.getChildSourceFilesOfDirectory(r)}onSourceFileAdded(r,n=!0){n?this.sourceFileAddedEventContainer.subscribe(r):this.sourceFileAddedEventContainer.unsubscribe(r)}onSourceFileRemoved(r){this.sourceFileRemovedEventContainer.subscribe(r)}createSourceFile(r,n,i){if(n=n instanceof Function?Xg(this.context.createWriter(),n):n||"",typeof n=="string")return this.createSourceFileFromText(r,n,i);let a=this.context.createWriter();return this.context.structurePrinterFactory.forSourceFile({isAmbient:b.FileUtils.getExtension(r)===".d.ts"}).printText(a,n),this.createSourceFileFromText(r,a.toString(),i)}createSourceFileFromText(r,n,i){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),i.overwrite===!0?this.createOrOverwriteSourceFileFromText(r,n,i):(this.throwIfFileExists(r,"Did you mean to provide the overwrite option?"),this.createSourceFileFromTextInternal(r,n,i))}throwIfFileExists(r,n){if(!(!this.containsSourceFileAtPath(r)&&!this.context.fileSystemWrapper.fileExistsSync(r)))throw n=n==null?"":n+" ",new b.errors.InvalidOperationError(`${n}A source file already exists at the provided file path: ${r}`)}createOrOverwriteSourceFileFromText(r,n,i){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let a=this.addOrGetSourceFileFromFilePath(r,i);return a!=null?(a.getChildren().forEach(s=>s.forget()),this.replaceCompilerNode(a,this.createCompilerSourceFileFromText(r,n,i.scriptKind)),a):this.createSourceFileFromTextInternal(r,n,i)}getSourceFileFromCacheFromFilePath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.get(r)}addOrGetSourceFileFromFilePath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.sourceFileCacheByFilePath.get(r);if(i==null){let a=this.context.fileSystemWrapper.readFileIfExistsSync(r,this.context.getEncoding());a!=null&&(this.context.logger.log(`Loaded file: ${r}`),i=this.createSourceFileFromTextInternal(r,a,n),i._setIsSaved(!0))}return i!=null&&n.markInProject&&i._markAsInProject(),i}containsSourceFileAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.sourceFileCacheByFilePath.has(r)}containsDirectoryAtPath(r){return r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r),this.directoryCache.has(r)}getSourceFileForNode(r){let n=r;for(;n.kind!==b.SyntaxKind.SourceFile;){if(n.parent==null)return;n=n.parent}return this.getSourceFile(n,{markInProject:!1})}hasCompilerNode(r){return this.nodeCache.has(r)}getExistingNodeFromCompilerNode(r){return this.nodeCache.get(r)}getNodeFromCompilerNode(r,n){if(r.kind===b.SyntaxKind.SourceFile)return this.getSourceFile(r,{markInProject:!1});return this.nodeCache.getOrCreate(r,()=>{let u=i.call(this);return s.call(this,u),u});function i(){if(a(r))return p_.isCommentStatement(r)?new FM(this.context,r,n):p_.isCommentClassElement(r)?new Cw(this.context,r,n):p_.isCommentTypeElement(r)?new JF(this.context,r,n):p_.isCommentObjectLiteralElement(r)?new _M(this.context,r,n):p_.isCommentEnumMember(r)?new WF(this.context,r,n):b.errors.throwNotImplementedForNeverValueError(r);let u=sUe[r.kind]||Tr;return new u(this.context,r,n)}function a(u){return u._commentKind!=null}function s(u){if(r.parent!=null){let f=this.getNodeFromCompilerNode(r.parent,n);f._wrappedChildCount++}let p=u._getParentSyntaxListIfWrapped();if(p!=null&&p._wrappedChildCount++,r.kind===b.SyntaxKind.SyntaxList){let f=0;for(let m of u._getChildrenInCacheIterator())f++;u._wrappedChildCount=f}}}createSourceFileFromTextInternal(r,n,i){let a=b.StringUtils.hasBom(n);a&&(n=b.StringUtils.stripBom(n));let s=this.getSourceFile(this.createCompilerSourceFileFromText(r,n,i.scriptKind),i);return a&&(s._hasBom=!0),s}createCompilerSourceFileFromText(r,n,i){return this.documentRegistry.createOrUpdateSourceFile(r,this.context.compilerOptions.get(),b.ts.ScriptSnapshot.fromString(n),i)}getSourceFile(r,n){var i;let a=!1,s=(i=this.sourceFileCacheByFilePath.get(r.fileName))!==null&&i!==void 0?i:this.nodeCache.getOrCreate(r,()=>{let u=new kE(this.context,r);return n.markInProject||this.context.inProjectCoordinator.setSourceFileNotInProject(u),this.addSourceFileToCache(u),a=!0,u});return n.markInProject&&s._markAsInProject(),a&&this.sourceFileAddedEventContainer.fire(s),s}addSourceFileToCache(r){this.sourceFileCacheByFilePath.set(r.getFilePath(),r),this.context.fileSystemWrapper.removeFileDelete(r.getFilePath()),this.directoryCache.addSourceFile(r)}getDirectoryFromPath(r,n){r=this.context.fileSystemWrapper.getStandardizedAbsolutePath(r);let i=this.directoryCache.get(r);return i==null&&this.context.fileSystemWrapper.directoryExistsSync(r)&&(i=this.directoryCache.createOrAddIfExists(r)),i!=null&&n.markInProject&&i._markAsInProject(),i}createDirectoryOrAddIfExists(r,n){let i=this.directoryCache.createOrAddIfExists(r);return i!=null&&n.markInProject&&i._markAsInProject(),i}getDirectoryFromCache(r){return this.directoryCache.get(r)}getDirectoryFromCacheOnlyIfInCache(r){return this.directoryCache.has(r)?this.directoryCache.get(r):void 0}getDirectoriesByDepth(){return this.directoryCache.getAllByDepth()}getOrphanDirectories(){return this.directoryCache.getOrphans()}getSymbolDisplayPart(r){return this.symbolDisplayPartCache.getOrCreate(r,()=>new B6(r))}getType(r){return(r.flags&b.TypeFlags.TypeParameter)===b.TypeFlags.TypeParameter?this.getTypeParameter(r):this.typeCache.getOrCreate(r,()=>new yL(this.context,r))}getTypeParameter(r){return this.typeParameterCache.getOrCreate(r,()=>new W6(this.context,r))}getSignature(r){return this.signatureCache.getOrCreate(r,()=>new I6(this.context,r))}getSymbol(r){return this.symbolCache.getOrCreate(r,()=>new P6(this.context,r))}getDefinitionInfo(r){return this.definitionInfoCache.getOrCreate(r,()=>new GD(this.context,r))}getDocumentSpan(r){return this.documentSpanCache.getOrCreate(r,()=>new pv(this.context,r))}getReferencedSymbolEntry(r){return this.referencedSymbolEntryCache.getOrCreate(r,()=>new F6(this.context,r))}getReferencedSymbol(r){return this.referencedSymbolCache.getOrCreate(r,()=>new mL(this.context,r))}getReferencedSymbolDefinitionInfo(r){return this.referencedSymbolDefinitionInfoCache.getOrCreate(r,()=>new _L(this.context,r))}getDiagnostic(r){return this.diagnosticCache.getOrCreate(r,()=>r.start!=null?new cL(this.context,r):new WT(this.context,r))}getDiagnosticWithLocation(r){return this.diagnosticCache.getOrCreate(r,()=>new cL(this.context,r))}getDiagnosticMessageChain(r){return this.diagnosticMessageChainCache.getOrCreate(r,()=>new pS(r))}getJSDocTagInfo(r){return this.jsDocTagInfoCache.getOrCreate(r,()=>new lL(r))}replaceCompilerNode(r,n){let i=r instanceof Tr?r.compilerNode:r,a=r instanceof Tr?r:this.nodeCache.get(r);if(i.kind===b.SyntaxKind.SourceFile&&i.fileName!==n.fileName){let s=a;this.removeCompilerNodeFromCache(i),s._replaceCompilerNodeFromFactory(n),this.nodeCache.set(n,s),this.addSourceFileToCache(s),this.sourceFileAddedEventContainer.fire(s)}else this.nodeCache.replaceKey(i,n),a?._replaceCompilerNodeFromFactory(n)}removeNodeFromCache(r){this.removeCompilerNodeFromCache(r.compilerNode)}removeCompilerNodeFromCache(r){if(this.nodeCache.removeByKey(r),r.kind===b.SyntaxKind.SourceFile){let n=r,i=this.context.fileSystemWrapper.getStandardizedAbsolutePath(n.fileName);this.directoryCache.removeSourceFile(i);let a=this.sourceFileCacheByFilePath.get(i);this.sourceFileCacheByFilePath.delete(i),this.documentRegistry.removeSourceFile(i),a!=null&&this.sourceFileRemovedEventContainer.fire(a)}}addDirectoryToCache(r){this.directoryCache.addDirectory(r)}removeDirectoryFromCache(r){this.directoryCache.remove(r)}forgetNodesCreatedInBlock(r){this.nodeCache.setForgetPoint();let n=!1,i;try{if(i=r((...s)=>{for(let u of s)this.nodeCache.rememberNode(u)}),Tr.isNode(i)&&this.nodeCache.rememberNode(i),a(i))return n=!0,i.then(s=>(Tr.isNode(s)&&this.nodeCache.rememberNode(s),this.nodeCache.forgetLastPoint(),s))}finally{n||this.nodeCache.forgetLastPoint()}return i;function a(s){return s!=null&&typeof s.then=="function"}}},UH=class{constructor(r){this.compilerFactory=r,this.notInProjectFiles=new Set,r.onSourceFileRemoved(n=>{this.notInProjectFiles.delete(n)})}setSourceFileNotInProject(r){this.notInProjectFiles.add(r),r._inProject=!1}markSourceFileAsInProject(r){this.isSourceFileInProject(r)||(this._internalMarkSourceFileAsInProject(r),this.notInProjectFiles.delete(r))}markSourceFilesAsInProjectForResolution(){let r="/node_modules/",n=this.compilerFactory,i=[],a=[];for(let u of[...this.notInProjectFiles.values()])s(u)?(this._internalMarkSourceFileAsInProject(u),this.notInProjectFiles.delete(u),i.push(u)):a.push(u);return{changedSourceFiles:i,unchangedSourceFiles:a};function s(u){let p=u.getFilePath(),f=p.toLowerCase().lastIndexOf(r);if(f===-1)return!0;let m=p.substring(0,f+r.length-1),g=n.getDirectoryFromCacheOnlyIfInCache(m);if(g!=null&&g._isInProject())return!0;let D=u.getDirectory();for(;D!=null&&D.getPath()!==m;){if(D._isInProject())return!0;D=n.getDirectoryFromCacheOnlyIfInCache(b.FileUtils.getDirPath(D.getPath()))}return!1}}_internalMarkSourceFileAsInProject(r){r._inProject=!0,this.markDirectoryAsInProject(r.getDirectory())}isSourceFileInProject(r){return r._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(r){for(let n of r.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(n);for(let n of r.getSourceFiles())delete n._inProject,this.notInProjectFiles.add(n);delete r._inProject}markDirectoryAsInProject(r){if(this.isDirectoryInProject(r))return;let n=this,i=this.compilerFactory;r._inProject=!0,a(r);function a(u){let p=Array.from(s(u)),f=p[p.length-1];if(!(f==null||!n.isDirectoryInProject(f)))for(let m of p)m._inProject=!0}function*s(u){if(b.FileUtils.isRootDirPath(u.getPath()))return;let p=b.FileUtils.getDirPath(u.getPath()),f=i.getDirectoryFromCacheOnlyIfInCache(p);f!=null&&(yield f,n.isDirectoryInProject(f)||(yield*s(f)))}}isDirectoryInProject(r){return r._inProject===!0}},Vo=class{constructor(r){this._getFormatCodeSettings=r}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new Oj}forModifierableNode(){return new kj}forReturnTypedNode(r){return new Rj(r)}forTypedNode(r,n){return new Mj(r,n)}forClassDeclaration(r){return new Fj(this,r)}forClassMember(r){return new Gj(this,r)}forClassStaticBlockDeclaration(){return new Bj(this)}forConstructorDeclaration(r){return new Uj(this,r)}forGetAccessorDeclaration(r){return new Kj(this,r)}forMethodDeclaration(r){return new Wj(this,r)}forPropertyDeclaration(){return new Vj(this)}forSetAccessorDeclaration(r){return new jj(this,r)}forDecorator(){return new Hj(this)}forJSDoc(){return new qj(this)}forJSDocTag(r){return new Jj(this,r)}forEnumDeclaration(){return new zj(this)}forEnumMember(){return new $j(this)}forObjectLiteralExpressionProperty(){return new Xj(this)}forPropertyAssignment(){return new Yj(this)}forShorthandPropertyAssignment(){return new Qj(this)}forSpreadAssignment(){return new Zj(this)}forFunctionDeclaration(r){return new eH(this,r)}forParameterDeclaration(){return new rH(this)}forCallSignatureDeclaration(){return new tH(this)}forConstructSignatureDeclaration(){return new nH(this)}forIndexSignatureDeclaration(){return new iH(this)}forInterfaceDeclaration(){return new aH(this)}forMethodSignature(){return new oH(this)}forPropertySignature(){return new sH(this)}forTypeElementMemberedNode(){return new lH(this)}forTypeElementMember(){return new uH(this)}forJsxAttributeDecider(){return new cH(this)}forJsxAttribute(){return new dH(this)}forJsxChildDecider(){return new fH(this)}forJsxElement(){return new pH(this)}forJsxSelfClosingElement(){return new mH(this)}forJsxSpreadAttribute(){return new _H(this)}forAssertEntry(){return new gH(this)}forExportAssignment(){return new yH(this)}forExportDeclaration(){return new vH(this)}forImportDeclaration(){return new hH(this)}forModuleDeclaration(r){return new EH(this,r)}forNamedImportExportSpecifier(){return new bH(this)}forSourceFile(r){return new SH(this,r)}forStatementedNode(r){return new TH(this,r)}forStatement(r){return new xH(this,r)}forVariableStatement(){return new DH(this)}forTypeAliasDeclaration(){return new CH(this)}forTypeParameterDeclaration(){return new AH(this)}forVariableDeclaration(){return new LH(this)}};co([b.Memoize],Vo.prototype,"forInitializerExpressionableNode",null);co([b.Memoize],Vo.prototype,"forModifierableNode",null);co([b.Memoize],Vo.prototype,"forReturnTypedNode",null);co([b.Memoize],Vo.prototype,"forTypedNode",null);co([b.Memoize],Vo.prototype,"forClassDeclaration",null);co([b.Memoize],Vo.prototype,"forClassMember",null);co([b.Memoize],Vo.prototype,"forClassStaticBlockDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructorDeclaration",null);co([b.Memoize],Vo.prototype,"forGetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodDeclaration",null);co([b.Memoize],Vo.prototype,"forPropertyDeclaration",null);co([b.Memoize],Vo.prototype,"forSetAccessorDeclaration",null);co([b.Memoize],Vo.prototype,"forDecorator",null);co([b.Memoize],Vo.prototype,"forJSDoc",null);co([b.Memoize],Vo.prototype,"forJSDocTag",null);co([b.Memoize],Vo.prototype,"forEnumDeclaration",null);co([b.Memoize],Vo.prototype,"forEnumMember",null);co([b.Memoize],Vo.prototype,"forObjectLiteralExpressionProperty",null);co([b.Memoize],Vo.prototype,"forPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forShorthandPropertyAssignment",null);co([b.Memoize],Vo.prototype,"forSpreadAssignment",null);co([b.Memoize],Vo.prototype,"forFunctionDeclaration",null);co([b.Memoize],Vo.prototype,"forParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forCallSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forConstructSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forIndexSignatureDeclaration",null);co([b.Memoize],Vo.prototype,"forInterfaceDeclaration",null);co([b.Memoize],Vo.prototype,"forMethodSignature",null);co([b.Memoize],Vo.prototype,"forPropertySignature",null);co([b.Memoize],Vo.prototype,"forTypeElementMemberedNode",null);co([b.Memoize],Vo.prototype,"forTypeElementMember",null);co([b.Memoize],Vo.prototype,"forJsxAttributeDecider",null);co([b.Memoize],Vo.prototype,"forJsxAttribute",null);co([b.Memoize],Vo.prototype,"forJsxChildDecider",null);co([b.Memoize],Vo.prototype,"forJsxElement",null);co([b.Memoize],Vo.prototype,"forJsxSelfClosingElement",null);co([b.Memoize],Vo.prototype,"forJsxSpreadAttribute",null);co([b.Memoize],Vo.prototype,"forAssertEntry",null);co([b.Memoize],Vo.prototype,"forExportAssignment",null);co([b.Memoize],Vo.prototype,"forExportDeclaration",null);co([b.Memoize],Vo.prototype,"forImportDeclaration",null);co([b.Memoize],Vo.prototype,"forModuleDeclaration",null);co([b.Memoize],Vo.prototype,"forNamedImportExportSpecifier",null);co([b.Memoize],Vo.prototype,"forSourceFile",null);co([b.Memoize],Vo.prototype,"forStatementedNode",null);co([b.Memoize],Vo.prototype,"forStatement",null);co([b.Memoize],Vo.prototype,"forVariableStatement",null);co([b.Memoize],Vo.prototype,"forTypeAliasDeclaration",null);co([b.Memoize],Vo.prototype,"forTypeParameterDeclaration",null);co([b.Memoize],Vo.prototype,"forVariableDeclaration",null);var BD=class{constructor(r){this.logger=new cj,this.manipulationSettings=new WR,this._project=r.project,this.fileSystemWrapper=r.fileSystemWrapper,this._compilerOptions=r.compilerOptionsContainer,this.compilerFactory=new BH(this),this.inProjectCoordinator=new UH(this.compilerFactory),this.structurePrinterFactory=new Vo(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new dj(this.compilerFactory),this.directoryCoordinator=new wH(this.compilerFactory,r.fileSystemWrapper),this._languageService=r.createLanguageService?new K6({context:this,configFileParsingDiagnostics:r.configFileParsingDiagnostics,resolutionHost:r.resolutionHost&&r.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}):void 0,r.typeChecker!=null&&(b.errors.throwIfTrue(r.createLanguageService,"Cannot specify a type checker and create a language service."),this._customTypeChecker=new gL(this),this._customTypeChecker._reset(()=>r.typeChecker))}get project(){if(this._project==null)throw new b.errors.InvalidOperationError("This operation is not permitted in this context.");return this._project}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 r=this.manipulationSettings.getIndentationText();return new KR.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:r===Oe.IndentationText.Tab?void 0:r.length,useTabs:r===Oe.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===Oe.QuoteKind.Single})}getPreEmitDiagnostics(r){return b.ts.getPreEmitDiagnostics(this.program.compilerObject,r?.compilerNode).map(i=>this.compilerFactory.getDiagnostic(i))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(r,n)=>{var i;return Promise.resolve((i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode)},addOrGetSourceFileFromFilePathSync:(r,n)=>{var i;return(i=this.compilerFactory.addOrGetSourceFileFromFilePath(r,n))===null||i===void 0?void 0:i.compilerNode},containsDirectoryAtPath:r=>this.compilerFactory.containsDirectoryAtPath(r),containsSourceFileAtPath:r=>this.compilerFactory.containsSourceFileAtPath(r),getSourceFileFromCacheFromFilePath:r=>{let n=this.compilerFactory.getSourceFileFromCacheFromFilePath(r);return n?.compilerNode},getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:r=>this.compilerFactory.documentRegistry.getSourceFileVersion(r),getChildDirectoriesOfDirectory:r=>{let n=[];for(let i of this.compilerFactory.getChildDirectoriesOfDirectory(r))n.push(i.getPath());return n}}}getModuleResolutionHost(){return b.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}getToolRequiredError(r){return new b.errors.InvalidOperationError(`A ${r} 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 ${r} should be required for this operation.`)}};co([b.Memoize],BD.prototype,"getSourceFileContainer",null);co([b.Memoize],BD.prototype,"getModuleResolutionHost",null);var KH=class{constructor(r={}){var n;f();let i=m(),a=new b.TransactionalFileSystem({fileSystem:i,skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),s=r.tsConfigFilePath==null?void 0:new b.TsConfigResolver(a,a.getStandardizedAbsolutePath(r.tsConfigFilePath),P()),u=g(),p=new b.CompilerOptionsContainer;p.set(u),this._context=new BD({project:this,compilerOptionsContainer:p,fileSystemWrapper:a,createLanguageService:!0,resolutionHost:r.resolutionHost,configFileParsingDiagnostics:(n=s?.getErrors())!==null&&n!==void 0?n:[],skipLoadingLibFiles:r.skipLoadingLibFiles,libFolderPath:r.libFolderPath}),r.manipulationSettings!=null&&this._context.manipulationSettings.set(r.manipulationSettings),s!=null&&r.skipAddingFilesFromTsConfig!==!0&&(this._addSourceFilesForTsConfigResolver(s,u),r.skipFileDependencyResolution||this.resolveSourceFileDependencies());function f(){if(r.fileSystem!=null&&r.useInMemoryFileSystem)throw new b.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function m(){var B;return r.useInMemoryFileSystem?new b.InMemoryFileSystemHost:(B=r.fileSystem)!==null&&B!==void 0?B:new b.RealFileSystemHost}function g(){var B;return{...D(),...(B=r.compilerOptions)!==null&&B!==void 0?B:{}}}function D(){var B;return(B=s?.getCompilerOptions())!==null&&B!==void 0?B:{}}function P(){var B;let K="utf-8";return r.compilerOptions!=null&&(B=r.compilerOptions.charset)!==null&&B!==void 0?B:K}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let r=new Set,n=u=>r.add(u),{compilerFactory:i,inProjectCoordinator:a}=this._context;i.onSourceFileAdded(n);try{this.getProgram().compilerObject}finally{i.onSourceFileAdded(n,!1)}let s=a.markSourceFilesAsInProjectForResolution();for(let u of s.changedSourceFiles)r.add(u);for(let u of s.unchangedSourceFiles)r.delete(u);return Array.from(r.values())}addDirectoryAtPathIfExists(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}addDirectoryAtPath(r,n={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{...n,markInProject:!0})}createDirectory(r){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}getDirectoryOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getDirectory(r),()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(r)}`)}getDirectory(r){let{compilerFactory:n}=this._context;return n.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r))}getDirectories(){return Array.from(this._getProjectDirectoriesByDirectoryDepth())}getRootDirectories(){let{inProjectCoordinator:r}=this._context,n=[];for(let a of this._context.compilerFactory.getOrphanDirectories())for(let s of i(a))n.push(s);return n;function*i(a){if(r.isDirectoryInProject(a)){yield a;return}for(let s of a._getDirectoriesIterator())yield*i(s)}}addSourceFilesAtPaths(r){return this._context.directoryCoordinator.addSourceFilesAtPaths(r,{markInProject:!0})}addSourceFileAtPathIfExists(r){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFileAtPath(r){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),{markInProject:!0})}addSourceFilesFromTsConfig(r){let n=new b.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),this._context.getEncoding());return this._addSourceFilesForTsConfigResolver(n,n.getCompilerOptions())}_addSourceFilesForTsConfigResolver(r,n){let i=r.getPaths(n),a=i.filePaths.map(s=>this.addSourceFileAtPath(s));for(let s of i.directoryPaths)this.addDirectoryAtPathIfExists(s);return a}createSourceFile(r,n,i){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(r),n??"",{...i??{},markInProject:!0})}removeSourceFile(r){let n=r.wasForgotten();return r.forget(),!n}getSourceFileOrThrow(r){let n=this.getSourceFile(r);if(n!=null)return n;if(typeof r=="string"){let i=b.FileUtils.standardizeSlashes(r);if(b.FileUtils.pathIsAbsolute(i)||i.indexOf("/")>=0){let a=this._context.fileSystemWrapper.getStandardizedAbsolutePath(i);throw new b.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${a}`)}else throw new b.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${r}`)}else throw new b.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(r){let n=i(this._context.fileSystemWrapper);if(a(n))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(n);return b.IterableUtils.find(this._getProjectSourceFilesByDirectoryDepth(),n);function i(s){if(r instanceof Function)return r;let u=b.FileUtils.standardizeSlashes(r);return b.FileUtils.pathIsAbsolute(u)||u.indexOf("/")>=0?s.getStandardizedAbsolutePath(u):p=>b.FileUtils.pathEndsWith(p.getFilePath(),u)}function a(s){return typeof s=="string"}}getSourceFiles(r){let{compilerFactory:n,fileSystemWrapper:i}=this._context,a=this._getProjectSourceFilesByDirectoryDepth();if(typeof r=="string"||r instanceof Array)return Array.from(s());return Array.from(a);function*s(){let u=Array.from(f()),p=b.matchGlobs(u,r,i.getCurrentDirectory());for(let m of p)yield n.getSourceFileFromCacheFromFilePath(i.getStandardizedAbsolutePath(m));function*f(){for(let m of a)yield m.getFilePath()}}}*_getProjectSourceFilesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getSourceFilesByDirectoryDepth())n.isSourceFileInProject(i)&&(yield i)}*_getProjectDirectoriesByDirectoryDepth(){let{compilerFactory:r,inProjectCoordinator:n}=this._context;for(let i of r.getDirectoriesByDepth())n.isDirectoryInProject(i)&&(yield i)}getAmbientModule(r){return r=Pfe(r),this.getAmbientModules().find(n=>n.getName()===r)}getAmbientModuleOrThrow(r){return b.errors.throwIfNullOrUndefined(this.getAmbientModule(r),()=>`Could not find ambient module with name: ${Pfe(r)}`)}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this._getUnsavedSourceFiles().map(r=>r.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let r of this._getUnsavedSourceFiles())r.saveSync()}enableLogging(r=!0){this._context.logger.setEnabled(r)}_getUnsavedSourceFiles(){return Array.from(r(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*r(n){for(let i of n)i.isSaved()||(yield i)}}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(r={}){return this._context.program.emit(r)}emitSync(r={}){return this._context.program.emitSync(r)}emitToMemory(r={}){return this._context.program.emitToMemory(r)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(r){return this._context.compilerFactory.forgetNodesCreatedInBlock(r)}formatDiagnosticsWithColorAndContext(r,n={}){return b.ts.formatDiagnosticsWithColorAndContext(r.map(i=>i.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:i=>i,getNewLine:()=>{var i;return(i=n.newLineChar)!==null&&i!==void 0?i:b.runtime.getEndOfLine()}})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function Pfe(e){return r(e[0])&&r(e[e.length-1])&&(e=e.substring(1,e.length-1)),`"${e}"`;function r(n){return n==='"'||n==="'"}}function lUe(e,r={}){let{compilerOptions:n={},sourceFile:i,typeChecker:a}=r,s=new b.CompilerOptionsContainer;s.set(n);let u=new BD({project:void 0,fileSystemWrapper:new b.TransactionalFileSystem({fileSystem:new b.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer:s,createLanguageService:!1,typeChecker:a,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),p=u.compilerFactory.getSourceFile(f(),{markInProject:!0});return u.compilerFactory.getNodeFromCompilerNode(e,p);function f(){return i??m(e)}function m(g){if(g.kind===b.SyntaxKind.SourceFile)return g;if(g.parent==null)throw new b.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let D=g;for(;D.parent!=null;)D=D.parent;if(D.kind!==b.SyntaxKind.SourceFile)throw new b.errors.NotImplementedError("For some reason the top parent was not a source file.");return D}}var uUe=new Vo(()=>{throw new b.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),WH=class{constructor(){}static object(r){return n=>{let i=Object.keys(r);n.write("{"),i.length>0&&n.indent(()=>{a()}),n.write("}");function a(){for(let s=0;s<i.length;s++){s>0&&n.write(",").newLine();let u=i[s],p=r[u];n.write(u),p!=null&&(n.write(": "),eL(n,p))}n.newLine()}}}static objectType(r){return n=>{n.write("{"),cUe(r)&&n.indent(()=>{uUe.forTypeElementMemberedNode().printText(n,r)}),n.write("}")}}static unionType(r,n,...i){return Ofe("|",[r,n,...i])}static intersectionType(r,n,...i){return Ofe("&",[r,n,...i])}static assertion(r,n){return i=>{eL(i,r),i.spaceIfLastNot().write("as "),eL(i,n)}}static returnStatement(r){return n=>{n.write("return "),n.hangingIndentUnlessBlock(()=>{eL(n,r),n.write(";")})}}};function Ofe(e,r){return n=>{dUe(n,` ${e} `,r)}}function cUe(e){for(let r of Object.keys(e))if(e[r]!=null&&!(e[r]instanceof Array&&e[r].length===0))return!0;return!1}function dUe(e,r,n){for(let i=0;i<n.length;i++)e.conditionalWrite(i>0,r),eL(e,n[i])}function eL(e,r){r instanceof Function?r(e):e.write(r.toString())}var{InvalidOperationError:fUe,FileNotFoundError:pUe,ArgumentError:mUe,ArgumentNullOrWhitespaceError:_Ue,ArgumentOutOfRangeError:gUe,ArgumentTypeError:yUe,BaseError:vUe,DirectoryNotFoundError:hUe,NotImplementedError:EUe,NotSupportedError:bUe,PathNotFoundError:SUe}=b.errors;Object.defineProperty(Oe,"CompilerOptionsContainer",{enumerable:!0,get:function(){return b.CompilerOptionsContainer}});Object.defineProperty(Oe,"DiagnosticCategory",{enumerable:!0,get:function(){return b.DiagnosticCategory}});Object.defineProperty(Oe,"EmitHint",{enumerable:!0,get:function(){return b.EmitHint}});Object.defineProperty(Oe,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return b.InMemoryFileSystemHost}});Object.defineProperty(Oe,"LanguageVariant",{enumerable:!0,get:function(){return b.LanguageVariant}});Object.defineProperty(Oe,"ModuleKind",{enumerable:!0,get:function(){return b.ModuleKind}});Object.defineProperty(Oe,"ModuleResolutionKind",{enumerable:!0,get:function(){return b.ModuleResolutionKind}});Object.defineProperty(Oe,"NewLineKind",{enumerable:!0,get:function(){return b.NewLineKind}});Object.defineProperty(Oe,"NodeFlags",{enumerable:!0,get:function(){return b.NodeFlags}});Object.defineProperty(Oe,"ObjectFlags",{enumerable:!0,get:function(){return b.ObjectFlags}});Object.defineProperty(Oe,"ResolutionHosts",{enumerable:!0,get:function(){return b.ResolutionHosts}});Object.defineProperty(Oe,"ScriptKind",{enumerable:!0,get:function(){return b.ScriptKind}});Object.defineProperty(Oe,"ScriptTarget",{enumerable:!0,get:function(){return b.ScriptTarget}});Object.defineProperty(Oe,"SettingsContainer",{enumerable:!0,get:function(){return b.SettingsContainer}});Object.defineProperty(Oe,"SymbolFlags",{enumerable:!0,get:function(){return b.SymbolFlags}});Object.defineProperty(Oe,"SyntaxKind",{enumerable:!0,get:function(){return b.SyntaxKind}});Object.defineProperty(Oe,"TypeFlags",{enumerable:!0,get:function(){return b.TypeFlags}});Object.defineProperty(Oe,"TypeFormatFlags",{enumerable:!0,get:function(){return b.TypeFormatFlags}});Object.defineProperty(Oe,"ts",{enumerable:!0,get:function(){return b.ts}});Object.defineProperty(Oe,"CodeBlockWriter",{enumerable:!0,get:function(){return KR.default}});Oe.AbstractableNode=gS;Oe.AmbientableNode=Ph;Oe.ArgumentError=mUe;Oe.ArgumentNullOrWhitespaceError=_Ue;Oe.ArgumentOutOfRangeError=gUe;Oe.ArgumentTypeError=yUe;Oe.ArgumentedNode=zH;Oe.ArrayBindingPattern=eM;Oe.ArrayDestructuringAssignment=NH;Oe.ArrayDestructuringAssignmentBase=mpe;Oe.ArrayLiteralExpression=iM;Oe.ArrayTypeNode=kw;Oe.ArrowFunction=hw;Oe.ArrowFunctionBase=Sme;Oe.AsExpression=aM;Oe.AsExpressionBase=_pe;Oe.AssertClause=ew;Oe.AssertClauseBase=cme;Oe.AssertEntry=rw;Oe.AssertEntryBase=sR;Oe.AssertionKeyNamedNode=spe;Oe.AssignmentExpression=iL;Oe.AssignmentExpressionBase=ppe;Oe.AsyncableNode=jT;Oe.AwaitExpression=oM;Oe.AwaitExpressionBase=gpe;Oe.AwaitableNode=Qfe;Oe.BaseError=vUe;Oe.BaseExpressionedNode=jD;Oe.BigIntLiteral=c6;Oe.BigIntLiteralBase=Zme;Oe.BinaryExpression=nL;Oe.BinaryExpressionBase=fpe;Oe.BindingElement=rM;Oe.BindingElementBase=dpe;Oe.BindingNamedNode=$6;Oe.Block=OM;Oe.BlockBase=Hpe;Oe.BodiedNode=H6;Oe.BodyableNode=HT;Oe.BreakStatement=kM;Oe.CallExpression=sM;Oe.CallExpressionBase=ype;Oe.CallSignatureDeclaration=qF;Oe.CallSignatureDeclarationBase=IR;Oe.CaseBlock=RM;Oe.CaseBlockBase=qpe;Oe.CaseClause=MM;Oe.CaseClauseBase=Jpe;Oe.CatchClause=wM;Oe.CatchClauseBase=zpe;Oe.ChildOrderableNode=Im;Oe.ClassDeclaration=Tw;Oe.ClassDeclarationBase=yR;Oe.ClassElement=$g;Oe.ClassExpression=xw;Oe.ClassExpressionBase=Lme;Oe.ClassLikeDeclarationBase=aq;Oe.ClassLikeDeclarationBaseSpecific=Cme;Oe.ClassStaticBlockDeclaration=Dw;Oe.ClassStaticBlockDeclarationBase=vR;Oe.CodeAction=O6;Oe.CodeFixAction=k6;Oe.CombinedCodeActions=uL;Oe.CommaListExpression=lM;Oe.CommaListExpressionBase=vpe;Oe.CommentClassElement=Cw;Oe.CommentEnumMember=WF;Oe.CommentObjectLiteralElement=_M;Oe.CommentRange=XR;Oe.CommentStatement=FM;Oe.CommentTypeElement=JF;Oe.CommonIdentifierBase=uq;Oe.CompilerCommentClassElement=jR;Oe.CompilerCommentEnumMember=JR;Oe.CompilerCommentNode=sS;Oe.CompilerCommentObjectLiteralElement=qR;Oe.CompilerCommentStatement=VR;Oe.CompilerCommentTypeElement=HR;Oe.ComputedPropertyName=x6;Oe.ComputedPropertyNameBase=p_e;Oe.ConditionalExpression=uM;Oe.ConditionalExpressionBase=hpe;Oe.ConditionalTypeNode=Rw;Oe.ConstructSignatureDeclaration=zF;Oe.ConstructSignatureDeclarationBase=PR;Oe.ConstructorDeclaration=Aw;Oe.ConstructorDeclarationBase=hR;Oe.ConstructorDeclarationOverloadBase=Nme;Oe.ConstructorTypeNode=Mw;Oe.ConstructorTypeNodeBase=kme;Oe.ContinueStatement=GM;Oe.DebuggerStatement=BM;Oe.DebuggerStatementBase=$pe;Oe.DecoratableNode=qT;Oe.Decorator=Pw;Oe.DecoratorBase=TR;Oe.DefaultClause=UM;Oe.DefaultClauseBase=Xpe;Oe.DefinitionInfo=GD;Oe.DeleteExpression=cM;Oe.DeleteExpressionBase=Epe;Oe.Diagnostic=WT;Oe.DiagnosticMessageChain=pS;Oe.DiagnosticWithLocation=cL;Oe.Directory=OE;Oe.DirectoryEmitResult=vL;Oe.DirectoryNotFoundError=hUe;Oe.DoStatement=KM;Oe.DoStatementBase=Ype;Oe.DocumentSpan=pv;Oe.DotDotDotTokenableNode=hL;Oe.ElementAccessExpression=aL;Oe.ElementAccessExpressionBase=bpe;Oe.EmitOutput=dL;Oe.EmitResult=VT;Oe.EmptyStatement=WM;Oe.EmptyStatementBase=Qpe;Oe.EnumDeclaration=VF;Oe.EnumDeclarationBase=LR;Oe.EnumMember=jF;Oe.EnumMemberBase=NR;Oe.ExclamationTokenableNode=XH;Oe.ExportAssignment=tw;Oe.ExportAssignmentBase=kH;Oe.ExportDeclaration=nw;Oe.ExportDeclarationBase=lR;Oe.ExportGetableNode=YH;Oe.ExportSpecifier=iw;Oe.ExportSpecifierBase=RH;Oe.ExportableNode=BE;Oe.Expression=oc;Oe.ExpressionStatement=VM;Oe.ExpressionStatementBase=Zpe;Oe.ExpressionWithTypeArguments=ww;Oe.ExpressionWithTypeArgumentsBase=Rme;Oe.ExpressionableNode=TL;Oe.ExpressionedNode=ud;Oe.ExtendsClauseableNode=ape;Oe.ExternalModuleReference=aw;Oe.ExternalModuleReferenceBase=dme;Oe.FalseLiteral=f6;Oe.FalseLiteralBase=r_e;Oe.FileNotFoundError=pUe;Oe.FileReference=kD;Oe.FileTextChanges=fS;Oe.ForInStatement=jM;Oe.ForInStatementBase=eme;Oe.ForOfStatement=HM;Oe.ForOfStatementBase=rme;Oe.ForStatement=qM;Oe.ForStatementBase=tme;Oe.FunctionDeclaration=Ew;Oe.FunctionDeclarationBase=mR;Oe.FunctionDeclarationOverloadBase=Tme;Oe.FunctionExpression=bw;Oe.FunctionExpressionBase=xme;Oe.FunctionLikeDeclaration=YT;Oe.FunctionOrConstructorTypeNodeBase=sL;Oe.FunctionOrConstructorTypeNodeBaseBase=Ome;Oe.FunctionTypeNode=Fw;Oe.FunctionTypeNodeBase=Mme;Oe.GeneratorableNode=zT;Oe.GetAccessorDeclaration=Lw;Oe.GetAccessorDeclarationBase=ER;Oe.HeritageClause=HF;Oe.HeritageClauseableNode=ZH;Oe.Identifier=D6;Oe.IdentifierBase=m_e;Oe.IfStatement=JM;Oe.IfStatementBase=nme;Oe.ImplementationLocation=fL;Oe.ImplementsClauseableNode=ope;Oe.ImportClause=ow;Oe.ImportClauseBase=fme;Oe.ImportDeclaration=sw;Oe.ImportDeclarationBase=uR;Oe.ImportEqualsDeclaration=lw;Oe.ImportEqualsDeclarationBase=mme;Oe.ImportExpression=dM;Oe.ImportExpressionBase=Spe;Oe.ImportExpressionedNode=_9e;Oe.ImportSpecifier=uw;Oe.ImportSpecifierBase=cR;Oe.ImportTypeAssertionContainer=Gw;Oe.ImportTypeNode=Bw;Oe.IndexSignatureDeclaration=$F;Oe.IndexSignatureDeclarationBase=OR;Oe.IndexedAccessTypeNode=Uw;Oe.InferTypeNode=Kw;Oe.InitializerExpressionGetableNode=z6;Oe.InitializerExpressionableNode=$T;Oe.InterfaceDeclaration=XF;Oe.InterfaceDeclarationBase=kR;Oe.IntersectionTypeNode=Ww;Oe.InvalidOperationError=fUe;Oe.IterationStatement=dS;Oe.JSDoc=Ow;Oe.JSDocAllType=iF;Oe.JSDocAugmentsTag=aF;Oe.JSDocAuthorTag=oF;Oe.JSDocBase=xR;Oe.JSDocCallbackTag=sF;Oe.JSDocClassTag=lF;Oe.JSDocDeprecatedTag=uF;Oe.JSDocEnumTag=cF;Oe.JSDocFunctionType=dF;Oe.JSDocFunctionTypeBase=Wme;Oe.JSDocImplementsTag=fF;Oe.JSDocLink=pF;Oe.JSDocLinkCode=mF;Oe.JSDocLinkPlain=_F;Oe.JSDocMemberName=gF;Oe.JSDocNameReference=vF;Oe.JSDocNamepathType=yF;Oe.JSDocNonNullableType=hF;Oe.JSDocNullableType=EF;Oe.JSDocOptionalType=bF;Oe.JSDocOverrideTag=SF;Oe.JSDocParameterTag=TF;Oe.JSDocParameterTagBase=Vme;Oe.JSDocPrivateTag=xF;Oe.JSDocPropertyLikeTag=oq;Oe.JSDocPropertyTag=DF;Oe.JSDocPropertyTagBase=jme;Oe.JSDocProtectedTag=CF;Oe.JSDocPublicTag=AF;Oe.JSDocReadonlyTag=LF;Oe.JSDocReturnTag=NF;Oe.JSDocReturnTagBase=Hme;Oe.JSDocSeeTag=IF;Oe.JSDocSeeTagBase=qme;Oe.JSDocSignature=PF;Oe.JSDocTag=bc;Oe.JSDocTagBase=AR;Oe.JSDocTagInfo=lL;Oe.JSDocTemplateTag=OF;Oe.JSDocTemplateTagBase=Jme;Oe.JSDocText=kF;Oe.JSDocThisTag=RF;Oe.JSDocThisTagBase=zme;Oe.JSDocType=q_;Oe.JSDocTypeExpression=wF;Oe.JSDocTypeExpressionableTag=tG;Oe.JSDocTypeLiteral=FF;Oe.JSDocTypeParameteredTag=Ime;Oe.JSDocTypeTag=GF;Oe.JSDocTypedefTag=MF;Oe.JSDocUnknownTag=BF;Oe.JSDocUnknownType=UF;Oe.JSDocVariadicType=KF;Oe.JSDocableNode=sc;Oe.JsxAttribute=ZF;Oe.JsxAttributeBase=wR;Oe.JsxAttributedNode=sq;Oe.JsxClosingElement=e6;Oe.JsxClosingElementBase=$me;Oe.JsxClosingFragment=r6;Oe.JsxElement=t6;Oe.JsxElementBase=FR;Oe.JsxExpression=n6;Oe.JsxExpressionBase=Xme;Oe.JsxFragment=i6;Oe.JsxOpeningElement=a6;Oe.JsxOpeningElementBase=Yme;Oe.JsxOpeningFragment=o6;Oe.JsxSelfClosingElement=s6;Oe.JsxSelfClosingElementBase=GR;Oe.JsxSpreadAttribute=l6;Oe.JsxSpreadAttributeBase=BR;Oe.JsxTagNamedNode=nG;Oe.JsxText=u6;Oe.JsxTextBase=Qme;Oe.LabeledStatement=zM;Oe.LabeledStatementBase=ime;Oe.LanguageService=K6;Oe.LeftHandSideExpression=MD;Oe.LeftHandSideExpressionedNode=XT;Oe.LiteralExpression=cS;Oe.LiteralExpressionBase=Tpe;Oe.LiteralLikeNode=KD;Oe.LiteralTypeNode=Vw;Oe.ManipulationError=$R;Oe.ManipulationSettingsContainer=WR;Oe.MappedTypeNode=jw;Oe.MemberExpression=BT;Oe.MemoryEmitResult=M6;Oe.MetaProperty=fM;Oe.MetaPropertyBase=xpe;Oe.MethodDeclaration=wD;Oe.MethodDeclarationBase=gR;Oe.MethodDeclarationOverloadBase=Dme;Oe.MethodSignature=YF;Oe.MethodSignatureBase=RR;Oe.ModifierableNode=sf;Oe.ModuleBlock=cw;Oe.ModuleBlockBase=_me;Oe.ModuleChildableNode=yS;Oe.ModuleDeclaration=dw;Oe.ModuleDeclarationBase=dR;Oe.ModuleNamedNode=lpe;Oe.ModuledNode=eq;Oe.NameableNode=X6;Oe.NamedExports=fw;Oe.NamedExportsBase=gme;Oe.NamedImports=pw;Oe.NamedImportsBase=yme;Oe.NamedNode=gv;Oe.NamedNodeBase=WD;Oe.NamedTupleMember=Hw;Oe.NamedTupleMemberBase=wme;Oe.NamespaceExport=mw;Oe.NamespaceExportBase=vme;Oe.NamespaceImport=_w;Oe.NamespaceImportBase=hme;Oe.NewExpression=pM;Oe.NewExpressionBase=Dpe;Oe.NoSubstitutionTemplateLiteral=y6;Oe.NoSubstitutionTemplateLiteralBase=s_e;Oe.Node=Tr;Oe.NodeWithTypeArguments=KT;Oe.NodeWithTypeArgumentsBase=Pme;Oe.NonNullExpression=mM;Oe.NonNullExpressionBase=Cpe;Oe.NotEmittedStatement=$M;Oe.NotEmittedStatementBase=ame;Oe.NotImplementedError=EUe;Oe.NotSupportedError=bUe;Oe.NullLiteral=p6;Oe.NullLiteralBase=n_e;Oe.NumericLiteral=m6;Oe.NumericLiteralBase=i_e;Oe.ObjectBindingPattern=tM;Oe.ObjectDestructuringAssignment=IH;Oe.ObjectDestructuringAssignmentBase=Ape;Oe.ObjectLiteralElement=UT;Oe.ObjectLiteralExpression=gM;Oe.ObjectLiteralExpressionBase=Lpe;Oe.OmittedExpression=EM;Oe.OmittedExpressionBase=Npe;Oe.OutputFile=R6;Oe.OverloadableNode=eG;Oe.OverrideableNode=bL;Oe.ParameterDeclaration=Sw;Oe.ParameterDeclarationBase=_R;Oe.ParameteredNode=upe;Oe.ParenthesizedExpression=bM;Oe.ParenthesizedExpressionBase=Ipe;Oe.ParenthesizedTypeNode=qw;Oe.PartiallyEmittedExpression=SM;Oe.PartiallyEmittedExpressionBase=Ppe;Oe.PathNotFoundError=SUe;Oe.PostfixUnaryExpression=TM;Oe.PostfixUnaryExpressionBase=Ope;Oe.PrefixUnaryExpression=xM;Oe.PrefixUnaryExpressionBase=kpe;Oe.PrimaryExpression=sd;Oe.PrivateIdentifier=C6;Oe.PrivateIdentifierBase=__e;Oe.Program=U6;Oe.Project=KH;Oe.PropertyAccessExpression=oL;Oe.PropertyAccessExpressionBase=Rpe;Oe.PropertyAssignment=yM;Oe.PropertyAssignmentBase=iR;Oe.PropertyDeclaration=Nw;Oe.PropertyDeclarationBase=bR;Oe.PropertyNamedNode=UE;Oe.PropertySignature=QF;Oe.PropertySignatureBase=MR;Oe.QualifiedName=A6;Oe.QuestionDotTokenableNode=Y6;Oe.QuestionTokenableNode=Rh;Oe.ReadonlyableNode=SL;Oe.RefactorEditInfo=pL;Oe.ReferenceEntry=w6;Oe.ReferenceFindableNode=kh;Oe.ReferencedSymbol=mL;Oe.ReferencedSymbolDefinitionInfo=_L;Oe.ReferencedSymbolEntry=F6;Oe.RegularExpressionLiteral=_6;Oe.RegularExpressionLiteralBase=a_e;Oe.RenameLocation=G6;Oe.RenameableNode=_v;Oe.ReturnStatement=XM;Oe.ReturnStatementBase=ome;Oe.ReturnTypedNode=rq;Oe.ScopeableNode=cpe;Oe.ScopedNode=_S;Oe.SetAccessorDeclaration=Iw;Oe.SetAccessorDeclarationBase=SR;Oe.ShorthandPropertyAssignment=vM;Oe.ShorthandPropertyAssignmentBase=aR;Oe.Signature=I6;Oe.SignaturedDeclaration=yv;Oe.SourceFile=kE;Oe.SourceFileBase=fR;Oe.SpreadAssignment=hM;Oe.SpreadAssignmentBase=oR;Oe.SpreadElement=DM;Oe.SpreadElementBase=Mpe;Oe.Statement=Cl;Oe.StatementBase=jpe;Oe.StatementedNode=Mh;Oe.StaticableNode=VD;Oe.StringLiteral=g6;Oe.StringLiteralBase=o_e;Oe.Structure=ZA;Oe.SuperElementAccessExpression=PH;Oe.SuperElementAccessExpressionBase=wpe;Oe.SuperExpression=CM;Oe.SuperExpressionBase=Fpe;Oe.SuperExpressionedNode=iq;Oe.SuperPropertyAccessExpression=OH;Oe.SuperPropertyAccessExpressionBase=Gpe;Oe.SwitchStatement=YM;Oe.SwitchStatementBase=sme;Oe.Symbol=P6;Oe.SymbolDisplayPart=B6;Oe.SyntaxList=YR;Oe.TaggedTemplateExpression=v6;Oe.TemplateExpression=h6;Oe.TemplateExpressionBase=l_e;Oe.TemplateHead=E6;Oe.TemplateHeadBase=u_e;Oe.TemplateLiteralTypeNode=Jw;Oe.TemplateMiddle=b6;Oe.TemplateMiddleBase=c_e;Oe.TemplateSpan=S6;Oe.TemplateSpanBase=d_e;Oe.TemplateTail=T6;Oe.TemplateTailBase=f_e;Oe.TextChange=FE;Oe.TextInsertableNode=ld;Oe.TextRange=rL;Oe.TextSpan=FD;Oe.ThisExpression=AM;Oe.ThisExpressionBase=Bpe;Oe.ThisTypeNode=zw;Oe.ThrowStatement=QM;Oe.ThrowStatementBase=lme;Oe.TrueLiteral=d6;Oe.TrueLiteralBase=e_e;Oe.TryStatement=ZM;Oe.TryStatementBase=ume;Oe.TupleTypeNode=$w;Oe.Type=yL;Oe.TypeAliasDeclaration=Xw;Oe.TypeAliasDeclarationBase=DR;Oe.TypeArgumentedNode=Q6;Oe.TypeAssertion=LM;Oe.TypeAssertionBase=Upe;Oe.TypeChecker=gL;Oe.TypeElement=wE;Oe.TypeElementMemberedNode=nq;Oe.TypeLiteralNode=Yw;Oe.TypeLiteralNodeBase=Fme;Oe.TypeNode=wc;Oe.TypeOfExpression=NM;Oe.TypeOfExpressionBase=Kpe;Oe.TypeOperatorTypeNode=Qw;Oe.TypeParameter=W6;Oe.TypeParameterDeclaration=Zw;Oe.TypeParameterDeclarationBase=CR;Oe.TypeParameteredNode=J_;Oe.TypePredicateNode=eF;Oe.TypeQueryNode=rF;Oe.TypeReferenceNode=tF;Oe.TypedNode=KE;Oe.UnaryExpression=fv;Oe.UnaryExpressionedNode=HD;Oe.UnionTypeNode=nF;Oe.UnwrappableNode=Z6;Oe.UpdateExpression=nM;Oe.VariableDeclaration=L6;Oe.VariableDeclarationBase=UR;Oe.VariableDeclarationList=N6;Oe.VariableDeclarationListBase=g_e;Oe.VariableStatement=gw;Oe.VariableStatementBase=pR;Oe.VoidExpression=IM;Oe.VoidExpressionBase=Wpe;Oe.WhileStatement=yw;Oe.WhileStatementBase=Eme;Oe.WithStatement=vw;Oe.WithStatementBase=bme;Oe.Writers=WH;Oe.YieldExpression=PM;Oe.YieldExpressionBase=Vpe;Oe.createWrappedNode=lUe;Oe.forEachStructureChild=N7e;Oe.getCompilerOptionsFromTsConfig=UBe;Oe.getScopeForNode=ZR;Oe.insertOverloads=rG;Oe.printNode=lj;Oe.setScopeForNode=tq});var Qg=gt((SYe,oG)=>{var S_e,T_e,x_e,D_e,C_e,A_e,L_e,N_e,I_e,iG,cq,P_e,O_e,k_e,qD,R_e,M_e,w_e,F_e,G_e,B_e,U_e,K_e,W_e,aG;(function(e){var r=typeof global=="object"?global:typeof self=="object"?self:typeof this=="object"?this:{};typeof define=="function"&&define.amd?define("tslib",["exports"],function(i){e(n(r,n(i)))}):typeof oG=="object"&&typeof oG.exports=="object"?e(n(r,n(oG.exports))):e(n(r));function n(i,a){return i!==r&&(typeof Object.create=="function"?Object.defineProperty(i,"__esModule",{value:!0}):i.__esModule=!0),function(s,u){return i[s]=a?a(s,u):u}}})(function(e){var r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,a){i.__proto__=a}||function(i,a){for(var s in a)Object.prototype.hasOwnProperty.call(a,s)&&(i[s]=a[s])};S_e=function(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");r(i,a);function s(){this.constructor=i}i.prototype=a===null?Object.create(a):(s.prototype=a.prototype,new s)},T_e=Object.assign||function(i){for(var a,s=1,u=arguments.length;s<u;s++){a=arguments[s];for(var p in a)Object.prototype.hasOwnProperty.call(a,p)&&(i[p]=a[p])}return i},x_e=function(i,a){var s={};for(var u in i)Object.prototype.hasOwnProperty.call(i,u)&&a.indexOf(u)<0&&(s[u]=i[u]);if(i!=null&&typeof Object.getOwnPropertySymbols=="function")for(var p=0,u=Object.getOwnPropertySymbols(i);p<u.length;p++)a.indexOf(u[p])<0&&Object.prototype.propertyIsEnumerable.call(i,u[p])&&(s[u[p]]=i[u[p]]);return s},D_e=function(i,a,s,u){var p=arguments.length,f=p<3?a:u===null?u=Object.getOwnPropertyDescriptor(a,s):u,m;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(i,a,s,u);else for(var g=i.length-1;g>=0;g--)(m=i[g])&&(f=(p<3?m(f):p>3?m(a,s,f):m(a,s))||f);return p>3&&f&&Object.defineProperty(a,s,f),f},C_e=function(i,a){return function(s,u){a(s,u,i)}},A_e=function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},L_e=function(i,a,s,u){function p(f){return f instanceof s?f:new s(function(m){m(f)})}return new(s||(s=Promise))(function(f,m){function g(B){try{P(u.next(B))}catch(K){m(K)}}function D(B){try{P(u.throw(B))}catch(K){m(K)}}function P(B){B.done?f(B.value):p(B.value).then(g,D)}P((u=u.apply(i,a||[])).next())})},N_e=function(i,a){var s={label:0,sent:function(){if(f[0]&1)throw f[1];return f[1]},trys:[],ops:[]},u,p,f,m;return m={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function g(P){return function(B){return D([P,B])}}function D(P){if(u)throw new TypeError("Generator is already executing.");for(;s;)try{if(u=1,p&&(f=P[0]&2?p.return:P[0]?p.throw||((f=p.return)&&f.call(p),0):p.next)&&!(f=f.call(p,P[1])).done)return f;switch(p=0,f&&(P=[P[0]&2,f.value]),P[0]){case 0:case 1:f=P;break;case 4:return s.label++,{value:P[1],done:!1};case 5:s.label++,p=P[1],P=[0];continue;case 7:P=s.ops.pop(),s.trys.pop();continue;default:if(f=s.trys,!(f=f.length>0&&f[f.length-1])&&(P[0]===6||P[0]===2)){s=0;continue}if(P[0]===3&&(!f||P[1]>f[0]&&P[1]<f[3])){s.label=P[1];break}if(P[0]===6&&s.label<f[1]){s.label=f[1],f=P;break}if(f&&s.label<f[2]){s.label=f[2],s.ops.push(P);break}f[2]&&s.ops.pop(),s.trys.pop();continue}P=a.call(i,s)}catch(B){P=[6,B],p=0}finally{u=f=0}if(P[0]&5)throw P[1];return{value:P[0]?P[1]:void 0,done:!0}}},I_e=function(i,a){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(a,s)&&aG(a,i,s)},aG=Object.create?function(i,a,s,u){u===void 0&&(u=s);var p=Object.getOwnPropertyDescriptor(a,s);(!p||("get"in p?!a.__esModule:p.writable||p.configurable))&&(p={enumerable:!0,get:function(){return a[s]}}),Object.defineProperty(i,u,p)}:function(i,a,s,u){u===void 0&&(u=s),i[u]=a[s]},iG=function(i){var a=typeof Symbol=="function"&&Symbol.iterator,s=a&&i[a],u=0;if(s)return s.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&u>=i.length&&(i=void 0),{value:i&&i[u++],done:!i}}};throw new TypeError(a?"Object is not iterable.":"Symbol.iterator is not defined.")},cq=function(i,a){var s=typeof Symbol=="function"&&i[Symbol.iterator];if(!s)return i;var u=s.call(i),p,f=[],m;try{for(;(a===void 0||a-- >0)&&!(p=u.next()).done;)f.push(p.value)}catch(g){m={error:g}}finally{try{p&&!p.done&&(s=u.return)&&s.call(u)}finally{if(m)throw m.error}}return f},P_e=function(){for(var i=[],a=0;a<arguments.length;a++)i=i.concat(cq(arguments[a]));return i},O_e=function(){for(var i=0,a=0,s=arguments.length;a<s;a++)i+=arguments[a].length;for(var u=Array(i),p=0,a=0;a<s;a++)for(var f=arguments[a],m=0,g=f.length;m<g;m++,p++)u[p]=f[m];return u},k_e=function(i,a,s){if(s||arguments.length===2)for(var u=0,p=a.length,f;u<p;u++)(f||!(u in a))&&(f||(f=Array.prototype.slice.call(a,0,u)),f[u]=a[u]);return i.concat(f||Array.prototype.slice.call(a))},qD=function(i){return this instanceof qD?(this.v=i,this):new qD(i)},R_e=function(i,a,s){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var u=s.apply(i,a||[]),p,f=[];return p={},m("next"),m("throw"),m("return"),p[Symbol.asyncIterator]=function(){return this},p;function m(h){u[h]&&(p[h]=function(S){return new Promise(function(U,C){f.push([h,S,U,C])>1||g(h,S)})})}function g(h,S){try{D(u[h](S))}catch(U){K(f[0][3],U)}}function D(h){h.value instanceof qD?Promise.resolve(h.value.v).then(P,B):K(f[0][2],h)}function P(h){g("next",h)}function B(h){g("throw",h)}function K(h,S){h(S),f.shift(),f.length&&g(f[0][0],f[0][1])}},M_e=function(i){var a,s;return a={},u("next"),u("throw",function(p){throw p}),u("return"),a[Symbol.iterator]=function(){return this},a;function u(p,f){a[p]=i[p]?function(m){return(s=!s)?{value:qD(i[p](m)),done:p==="return"}:f?f(m):m}:f}},w_e=function(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var a=i[Symbol.asyncIterator],s;return a?a.call(i):(i=typeof iG=="function"?iG(i):i[Symbol.iterator](),s={},u("next"),u("throw"),u("return"),s[Symbol.asyncIterator]=function(){return this},s);function u(f){s[f]=i[f]&&function(m){return new Promise(function(g,D){m=i[f](m),p(g,D,m.done,m.value)})}}function p(f,m,g,D){Promise.resolve(D).then(function(P){f({value:P,done:g})},m)}},F_e=function(i,a){return Object.defineProperty?Object.defineProperty(i,"raw",{value:a}):i.raw=a,i};var n=Object.create?function(i,a){Object.defineProperty(i,"default",{enumerable:!0,value:a})}:function(i,a){i.default=a};G_e=function(i){if(i&&i.__esModule)return i;var a={};if(i!=null)for(var s in i)s!=="default"&&Object.prototype.hasOwnProperty.call(i,s)&&aG(a,i,s);return n(a,i),a},B_e=function(i){return i&&i.__esModule?i:{default:i}},U_e=function(i,a,s,u){if(s==="a"&&!u)throw new TypeError("Private accessor was defined without a getter");if(typeof a=="function"?i!==a||!u:!a.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return s==="m"?u:s==="a"?u.call(i):u?u.value:a.get(i)},K_e=function(i,a,s,u,p){if(u==="m")throw new TypeError("Private method is not writable");if(u==="a"&&!p)throw new TypeError("Private accessor was defined without a setter");if(typeof a=="function"?i!==a||!p:!a.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return u==="a"?p.call(i,s):p?p.value=s:a.set(i,s),s},W_e=function(i,a){if(a===null||typeof a!="object"&&typeof a!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof i=="function"?a===i:i.has(a)},e("__extends",S_e),e("__assign",T_e),e("__rest",x_e),e("__decorate",D_e),e("__param",C_e),e("__metadata",A_e),e("__awaiter",L_e),e("__generator",N_e),e("__exportStar",I_e),e("__createBinding",aG),e("__values",iG),e("__read",cq),e("__spread",P_e),e("__spreadArrays",O_e),e("__spreadArray",k_e),e("__await",qD),e("__asyncGenerator",R_e),e("__asyncDelegator",M_e),e("__asyncValues",w_e),e("__makeTemplateObject",F_e),e("__importStar",G_e),e("__importDefault",B_e),e("__classPrivateFieldGet",U_e),e("__classPrivateFieldSet",K_e),e("__classPrivateFieldIn",W_e)})});var V_e=gt(JD=>{"use strict";Object.defineProperty(JD,"__esModule",{value:!0});JD.lowerCase=JD.localeLowerCase=void 0;var TUe={tr:{regexp:/\u0130|\u0049|\u0049\u0307/g,map:{\u0130:"i",I:"\u0131",I\u0307:"i"}},az:{regexp:/\u0130/g,map:{\u0130:"i",I:"\u0131",I\u0307:"i"}},lt:{regexp:/\u0049|\u004A|\u012E|\u00CC|\u00CD|\u0128/g,map:{I:"i\u0307",J:"j\u0307",\u012E:"\u012F\u0307",\u00CC:"i\u0307\u0300",\u00CD:"i\u0307\u0301",\u0128:"i\u0307\u0303"}}};function xUe(e,r){var n=TUe[r.toLowerCase()];return dq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}JD.localeLowerCase=xUe;function dq(e){return e.toLowerCase()}JD.lowerCase=dq});var QT=gt(sG=>{"use strict";Object.defineProperty(sG,"__esModule",{value:!0});sG.noCase=void 0;var DUe=V_e(),CUe=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],AUe=/[^A-Z0-9]+/gi;function LUe(e,r){r===void 0&&(r={});for(var n=r.splitRegexp,i=n===void 0?CUe:n,a=r.stripRegexp,s=a===void 0?AUe:a,u=r.transform,p=u===void 0?DUe.lowerCase:u,f=r.delimiter,m=f===void 0?" ":f,g=j_e(j_e(e,i,"$1\0$2"),s,"\0"),D=0,P=g.length;g.charAt(D)==="\0";)D++;for(;g.charAt(P-1)==="\0";)P--;return g.slice(D,P).split("\0").map(p).join(m)}sG.noCase=LUe;function j_e(e,r,n){return r instanceof RegExp?e.replace(r,n):r.reduce(function(i,a){return i.replace(a,n)},e)}});var fq=gt(vS=>{"use strict";Object.defineProperty(vS,"__esModule",{value:!0});vS.pascalCase=vS.pascalCaseTransformMerge=vS.pascalCaseTransform=void 0;var NUe=Qg(),IUe=QT();function H_e(e,r){var n=e.charAt(0),i=e.substr(1).toLowerCase();return r>0&&n>="0"&&n<="9"?"_"+n+i:""+n.toUpperCase()+i}vS.pascalCaseTransform=H_e;function PUe(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}vS.pascalCaseTransformMerge=PUe;function OUe(e,r){return r===void 0&&(r={}),IUe.noCase(e,NUe.__assign({delimiter:"",transform:H_e},r))}vS.pascalCase=OUe});var J_e=gt(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.camelCase=hS.camelCaseTransformMerge=hS.camelCaseTransform=void 0;var kUe=Qg(),pq=fq();function q_e(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransform(e,r)}hS.camelCaseTransform=q_e;function RUe(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransformMerge(e)}hS.camelCaseTransformMerge=RUe;function MUe(e,r){return r===void 0&&(r={}),pq.pascalCase(e,kUe.__assign({transform:q_e},r))}hS.camelCase=MUe});var mq=gt(lG=>{"use strict";Object.defineProperty(lG,"__esModule",{value:!0});lG.upperCaseFirst=void 0;function wUe(e){return e.charAt(0).toUpperCase()+e.substr(1)}lG.upperCaseFirst=wUe});var _q=gt(zD=>{"use strict";Object.defineProperty(zD,"__esModule",{value:!0});zD.capitalCase=zD.capitalCaseTransform=void 0;var FUe=Qg(),GUe=QT(),BUe=mq();function z_e(e){return BUe.upperCaseFirst(e.toLowerCase())}zD.capitalCaseTransform=z_e;function UUe(e,r){return r===void 0&&(r={}),GUe.noCase(e,FUe.__assign({delimiter:" ",transform:z_e},r))}zD.capitalCase=UUe});var $_e=gt($D=>{"use strict";Object.defineProperty($D,"__esModule",{value:!0});$D.upperCase=$D.localeUpperCase=void 0;var KUe={tr:{regexp:/[\u0069]/g,map:{i:"\u0130"}},az:{regexp:/[\u0069]/g,map:{i:"\u0130"}},lt:{regexp:/[\u0069\u006A\u012F]\u0307|\u0069\u0307[\u0300\u0301\u0303]/g,map:{i\u0307:"I",j\u0307:"J",\u012F\u0307:"\u012E",i\u0307\u0300:"\xCC",i\u0307\u0301:"\xCD",i\u0307\u0303:"\u0128"}}};function WUe(e,r){var n=KUe[r.toLowerCase()];return gq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}$D.localeUpperCase=WUe;function gq(e){return e.toUpperCase()}$D.upperCase=gq});var X_e=gt(uG=>{"use strict";Object.defineProperty(uG,"__esModule",{value:!0});uG.constantCase=void 0;var VUe=Qg(),jUe=QT(),HUe=$_e();function qUe(e,r){return r===void 0&&(r={}),jUe.noCase(e,VUe.__assign({delimiter:"_",transform:HUe.upperCase},r))}uG.constantCase=qUe});var PL=gt(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});cG.dotCase=void 0;var JUe=Qg(),zUe=QT();function $Ue(e,r){return r===void 0&&(r={}),zUe.noCase(e,JUe.__assign({delimiter:"."},r))}cG.dotCase=$Ue});var Y_e=gt(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});dG.headerCase=void 0;var XUe=Qg(),YUe=_q();function QUe(e,r){return r===void 0&&(r={}),YUe.capitalCase(e,XUe.__assign({delimiter:"-"},r))}dG.headerCase=QUe});var Q_e=gt(fG=>{"use strict";Object.defineProperty(fG,"__esModule",{value:!0});fG.paramCase=void 0;var ZUe=Qg(),eKe=PL();function rKe(e,r){return r===void 0&&(r={}),eKe.dotCase(e,ZUe.__assign({delimiter:"-"},r))}fG.paramCase=rKe});var Z_e=gt(pG=>{"use strict";Object.defineProperty(pG,"__esModule",{value:!0});pG.pathCase=void 0;var tKe=Qg(),nKe=PL();function iKe(e,r){return r===void 0&&(r={}),nKe.dotCase(e,tKe.__assign({delimiter:"/"},r))}pG.pathCase=iKe});var rge=gt(XD=>{"use strict";Object.defineProperty(XD,"__esModule",{value:!0});XD.sentenceCase=XD.sentenceCaseTransform=void 0;var aKe=Qg(),oKe=QT(),sKe=mq();function ege(e,r){var n=e.toLowerCase();return r===0?sKe.upperCaseFirst(n):n}XD.sentenceCaseTransform=ege;function lKe(e,r){return r===void 0&&(r={}),oKe.noCase(e,aKe.__assign({delimiter:" ",transform:ege},r))}XD.sentenceCase=lKe});var tge=gt(mG=>{"use strict";Object.defineProperty(mG,"__esModule",{value:!0});mG.snakeCase=void 0;var uKe=Qg(),cKe=PL();function dKe(e,r){return r===void 0&&(r={}),cKe.dotCase(e,uKe.__assign({delimiter:"_"},r))}mG.snakeCase=dKe});var yq=gt(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var vv=Qg();vv.__exportStar(J_e(),z_);vv.__exportStar(_q(),z_);vv.__exportStar(X_e(),z_);vv.__exportStar(PL(),z_);vv.__exportStar(Y_e(),z_);vv.__exportStar(QT(),z_);vv.__exportStar(Q_e(),z_);vv.__exportStar(fq(),z_);vv.__exportStar(Z_e(),z_);vv.__exportStar(rge(),z_);vv.__exportStar(tge(),z_)});var Eq=gt((JYe,fKe)=>{fKe.exports={name:"zenstack",publisher:"zenstack",displayName:"ZenStack Language Tools",description:"ZenStack is a toolkit that simplifies full-stack development",version:"0.2.10",author:{name:"ZenStack Team"},keywords:["fullstack","react","typescript","data modeling"],preview:!0,icon:"asset/logo-light-256.png",repository:{type:"git",url:"https://github.com/zenstackhq/zenstack"},engines:{vscode:"^1.72.0"},categories:["Programming Languages"],contributes:{languages:[{id:"zmodel",aliases:["ZenStack Model","zmodel"],extensions:[".zmodel"],configuration:"./language-configuration.json",icon:{light:"./asset/logo-light-256.png",dark:"./asset/logo-dark-256.png"}}],grammars:[{language:"zmodel",scopeName:"source.zmodel",path:"./syntaxes/zmodel.tmLanguage.json"}]},activationEvents:["onLanguage:zmodel"],files:["bin","src","bundle"],bin:{zenstack:"./bin/cli"},main:"./bundle/extension.js",scripts:{"vscode:publish":"vsce publish --no-dependencies","vscode:prepublish":"cp ../../README.md ./ && pnpm lint && pnpm build","vscode:package":"vsce package --no-dependencies",build:"pnpm langium:generate && tsc --noEmit && pnpm bundle && cp -r src/res/* bundle/res/",bundle:"node build/bundle.js --minify","bundle-watch":"node build/bundle.js --watch","ts:watch":"tsc --watch --noEmit","tsc-alias:watch":"tsc-alias --watch",lint:"eslint src --ext ts","langium:generate":"langium generate","langium:watch":"langium generate --watch",watch:'concurrently --kill-others "npm:langium:watch" "npm:bundle-watch"',test:"jest",prepublishOnly:"cp ../../README.md ./ && pnpm build && pnpm bundle"},dependencies:{"@zenstackhq/internal":"workspace:*","change-case":"^4.1.2",chevrotain:"^9.1.0",colors:"^1.4.0",commander:"^8.3.0",langium:"^0.5.0",pluralize:"^8.0.0",prisma:"^4.5.0",promisify:"^0.0.3","ts-morph":"^16.0.0",uuid:"^9.0.0","vscode-jsonrpc":"^8.0.2","vscode-languageclient":"^8.0.2","vscode-languageserver":"^8.0.2","vscode-languageserver-textdocument":"^1.0.7","vscode-uri":"^3.0.6"},devDependencies:{"@prisma/internals":"^4.5.0","@types/jest":"^29.2.0","@types/node":"^14.18.32","@types/pluralize":"^0.0.29","@types/tmp":"^0.2.3","@types/uuid":"^8.3.4","@types/vscode":"^1.72.0","@typescript-eslint/eslint-plugin":"^4.33.0","@typescript-eslint/parser":"^4.33.0",concurrently:"^7.4.0",esbuild:"^0.15.12",eslint:"^7.32.0",jest:"^29.2.1","langium-cli":"^0.5.0",tmp:"^0.2.1","ts-jest":"^29.0.3","ts-node":"^10.9.1","tsc-alias":"^1.7.0","tsconfig-paths-jest":"^0.0.1",typescript:"^4.8.4",vsce:"^2.13.0"}}});var mKe={};QDe(mKe,{default:()=>pKe,generateAction:()=>dge});module.exports=ZDe(mKe);var vG=Gs(dQ()),uge=Gs(_Q());var goe=Gs(CE()),poe="AbstractDeclaration";var m6e="Expression";var moe="ReferenceTarget";var JO="TypeDeclaration";var Hx="ArrayExpr";function zO(e){return ov.isInstance(e,Hx)}var rK="Attribute";var yoe="AttributeArg";var SA="BinaryExpr";var $O="DataModel";function Lm(e){return ov.isInstance(e,$O)}var tK="DataModelField";function qx(e){return ov.isInstance(e,tK)}var XO="DataSource";function voe(e){return ov.isInstance(e,XO)}var YO="Enum";function hoe(e){return ov.isInstance(e,YO)}var QO="EnumField";function Jx(e){return ov.isInstance(e,QO)}var _oe="Function";var _6e="FunctionParam";var zx="InvocationExpr";function TA(e){return ov.isInstance(e,zx)}var Ub="LiteralExpr";function av(e){return ov.isInstance(e,Ub)}var Kb="MemberAccessExpr";function nK(e){return ov.isInstance(e,Kb)}var xA="NullExpr";var Wb="ReferenceExpr";function Vb(e){return ov.isInstance(e,Wb)}var $x="ThisExpr";function xT(e){return ov.isInstance(e,$x)}var DA="UnaryExpr";var bA=class{getAllTypes(){return["AbstractDeclaration","Argument","ArrayExpr","Attribute","AttributeArg","AttributeParam","AttributeParamType","BinaryExpr","DataModel","DataModelAttribute","DataModelField","DataModelFieldAttribute","DataModelFieldType","DataSource","DataSourceField","Enum","EnumField","Expression","Function","FunctionParam","FunctionParamType","InvocationExpr","LiteralExpr","MemberAccessExpr","Model","NullExpr","ReferenceArg","ReferenceExpr","ReferenceTarget","ThisExpr","TypeDeclaration","UnaryExpr"]}isInstance(r,n){return(0,goe.isAstNode)(r)&&this.isSubtype(r.$type,n)}isSubtype(r,n){if(r===n)return!0;switch(r){case Hx:case SA:case zx:case Ub:case Kb:case xA:case Wb:case $x:case DA:return this.isSubtype(m6e,n);case rK:case XO:case _oe:return this.isSubtype(poe,n);case $O:case YO:return this.isSubtype(poe,n)||this.isSubtype(JO,n);case tK:case QO:case _6e:return this.isSubtype(moe,n);default:return!1}}getReferenceType(r){let n=`${r.container.$type}:${r.property}`;switch(n){case"AttributeParamType:reference":return JO;case"DataModelAttribute:decl":return rK;case"DataModelFieldAttribute:decl":return rK;case"DataModelFieldType:reference":return JO;case"FunctionParamType:reference":return JO;case"InvocationExpr:function":return _oe;case"MemberAccessExpr:member":return tK;case"ReferenceExpr:target":return moe;default:throw new Error(`${n} is not a valid reference id.`)}}getTypeMetaData(r){switch(r){case"ArrayExpr":return{name:"ArrayExpr",mandatory:[{name:"items",type:"array"}]};case"Attribute":return{name:"Attribute",mandatory:[{name:"params",type:"array"}]};case"AttributeParam":return{name:"AttributeParam",mandatory:[{name:"default",type:"boolean"}]};case"AttributeParamType":return{name:"AttributeParamType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataModel":return{name:"DataModel",mandatory:[{name:"attributes",type:"array"},{name:"fields",type:"array"}]};case"DataModelAttribute":return{name:"DataModelAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelField":return{name:"DataModelField",mandatory:[{name:"attributes",type:"array"}]};case"DataModelFieldAttribute":return{name:"DataModelFieldAttribute",mandatory:[{name:"args",type:"array"}]};case"DataModelFieldType":return{name:"DataModelFieldType",mandatory:[{name:"array",type:"boolean"},{name:"optional",type:"boolean"}]};case"DataSource":return{name:"DataSource",mandatory:[{name:"fields",type:"array"}]};case"Enum":return{name:"Enum",mandatory:[{name:"fields",type:"array"}]};case"Function":return{name:"Function",mandatory:[{name:"params",type:"array"}]};case"FunctionParamType":return{name:"FunctionParamType",mandatory:[{name:"array",type:"boolean"}]};case"InvocationExpr":return{name:"InvocationExpr",mandatory:[{name:"args",type:"array"}]};case"Model":return{name:"Model",mandatory:[{name:"declarations",type:"array"}]};case"ReferenceExpr":return{name:"ReferenceExpr",mandatory:[{name:"args",type:"array"}]};default:return{name:r,mandatory:[]}}}},ov=new bA;var Eoe=Gs(CE()),ZO,boe=()=>ZO!=null?ZO:ZO=(0,Eoe.loadGrammarFromJson)(`{
4253
4253
  "$type": "Grammar",
4254
4254
  "isDeclared": true,
4255
4255
  "name": "ZModel",
@@ -6645,7 +6645,7 @@ Node text: ${this._forgottenText}`),new b.errors.InvalidOperationError(r)}return
6645
6645
  }`}},ok=class{constructor(r,n,i){this.type=r;this.array=n;this.optional=i}toString(){return`${this.type}${this.array?"[]":""}${this.optional?"?":""}`}},_K=class{constructor(r,n,i=[]){this.name=r;this.type=n;this.attributes=i}addAttribute(r,n=[]){let i=new nD(r,n);return this.attributes.push(i),i}toString(){return`${this.name} ${this.type}`+(this.attributes.length>0?" "+this.attributes.map(r=>r.toString()).join(" "):"")}},nD=class{constructor(r,n=[]){this.name=r;this.args=n}toString(){return`${this.name}(`+this.args.map(r=>r.toString()).join(", ")+")"}},kA=class{constructor(r,n=[]){this.name=r;this.args=n}toString(){return`${this.name}(`+this.args.map(r=>r.toString()).join(", ")+")"}},iD=class{constructor(r,n){this.name=r;this.value=n}toString(){return this.name?`${this.name}: ${this.value}`:this.value.toString()}},jg=class{constructor(r,n){this.type=r;this.value=n;switch(r){case"String":if(typeof n!="string")throw new Error("Value must be string");break;case"Number":if(typeof n!="number")throw new Error("Value must be number");break;case"Boolean":if(typeof n!="boolean")throw new Error("Value must be boolean");break;case"Array":if(!Array.isArray(n))throw new Error("Value must be array");break;case"FieldReference":if(typeof n!="string"&&!(n instanceof RA))throw new Error("Value must be string or FieldReference");break;case"FunctionCall":if(!(n instanceof MA))throw new Error("Value must be FunctionCall");break}}toString(){switch(this.type){case"String":return`"${this.value}"`;case"Number":return this.value.toString();case"FieldReference":{if(typeof this.value=="string")return this.value;{let r=this.value,n=r.field;return r.args.length>0&&(n+="("+r.args.map(i=>i.toString()).join(",")+")"),n}}case"FunctionCall":return this.value.toString();case"Boolean":return this.value?"true":"false";case"Array":return"["+this.value.map(r=>r.toString()).join(", ")+"]";default:throw new Error(`Unknown attribute value type ${this.type}`)}}},RA=class{constructor(r,n=[]){this.field=r;this.args=n}},sk=class{constructor(r,n){this.name=r;this.value=n}toString(){return`${this.name}: ${this.value}`}},MA=class{constructor(r,n=[]){this.func=r;this.args=n}toString(){return`${this.func}(`+this.args.map(r=>r.toString()).join(", ")+")"}},lk=class{constructor(r,n){this.name=r;this.value=n}toString(){return this.name?`${this.name}: ${this.value}`:this.value}},gK=class{constructor(r,n){this.name=r;this.fields=n}toString(){return`enum ${this.name} {
6646
6646
  `+Eh(this.fields.join(`
6647
6647
  `))+`
6648
- }`}};var gse=["@@allow","@@deny","@password","@omit"],wA=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let{schema:r}=this.context,n=new ak;for(let a of r.declarations)switch(a.$type){case XO:this.generateDataSource(n,a);break;case YO:this.generateEnum(n,a);break;case $O:this.generateModel(n,a);break}this.generateGenerator(n);let i=yK.default.join(this.context.outDir,"schema.prisma");return yield(0,yse.writeFile)(i,n.toString()),i})}generateDataSource(r,n){let i,a,s;for(let u of n.fields)switch(u.name){case"provider":{if(this.isStringLiteral(u.value))i=u.value.value;else throw new eu("Datasource provider must be set to a string");break}case"url":{let p=this.extractDataSourceUrl(u.value);if(!p)throw new eu("Invalid value for datasource url");a=p;break}case"shadowDatabaseUrl":{let p=this.extractDataSourceUrl(u.value);if(!p)throw new eu("Invalid value for datasource url");s=p;break}}if(!i)throw new eu('Datasource is missing "provider" field');if(!a)throw new eu('Datasource is missing "url" field');r.addDataSource(n.name,i,a,s)}extractDataSourceUrl(r){var n;return this.isStringLiteral(r)?new OA(r.value,!1):TA(r)&&((n=r.function.ref)==null?void 0:n.name)==="env"&&r.args.length===1&&this.isStringLiteral(r.args[0].value)?new OA(r.args[0].value.value,!0):null}generateGenerator(r){r.addGenerator("client","prisma-client-js",yK.default.join("..",this.context.generatedCodeDir,".prisma"),["fieldReference","interactiveTransactions","referentialIntegrity"])}generateModel(r,n){let i=r.addModel(n.name);for(let a of n.fields)this.generateModelField(i,a);i.addField(tD,"Boolean",[new nD("@default",[new iD(void 0,new jg("Boolean",!0))])]),i.addField(dK,"String?"),i.addAttribute("@@index",[new iD(void 0,new jg("Array",[new jg("FieldReference",dK)]))]);for(let a of n.attributes.filter(s=>{var u;return((u=s.decl.ref)==null?void 0:u.name)&&!gse.includes(s.decl.ref.name)}))this.generateModelAttribute(i,a)}generateModelField(r,n){var u,p;let i=n.type.type||((p=(u=n.type.reference)==null?void 0:u.ref)==null?void 0:p.name);if(!i)throw new eu(`Field type is not resolved: ${n.$container.name}.${n.name}`);let a=new ok(i,n.type.array,n.type.optional),s=n.attributes.filter(f=>{var m;return((m=f.decl.ref)==null?void 0:m.name)&&!gse.includes(f.decl.ref.name)}).map(f=>this.makeFieldAttribute(f));r.addField(n.name,a,s)}makeFieldAttribute(r){return new nD(AT(r.decl).name,r.args.map(n=>this.makeAttributeArg(n)))}makeAttributeArg(r){return new iD(r.name,this.makeAttributeArgValue(r.value))}makeAttributeArgValue(r){if(av(r))switch(typeof r.value){case"string":return new jg("String",r.value);case"number":return new jg("Number",r.value);case"boolean":return new jg("Boolean",r.value);default:throw new eu(`Unexpected literal type: ${typeof r.value}`)}else{if(zO(r))return new jg("Array",new Array(...r.items.map(n=>this.makeAttributeArgValue(n))));if(Vb(r))return new jg("FieldReference",new RA(AT(r.target).name,r.args.map(n=>new sk(n.name,n.value))));if(TA(r))return new jg("FunctionCall",this.makeFunctionCall(r));throw new eu(`Unsupported attribute argument expression type: ${r.$type}`)}}makeFunctionCall(r){return new MA(AT(r.function).name,r.args.map(n=>{if(!av(n.value))throw new eu("Function call argument must be literal");return new lk(n.name,n.value.value)}))}generateModelAttribute(r,n){r.attributes.push(new kA(AT(n.decl).name,n.args.map(i=>this.makeAttributeArg(i))))}generateEnum(r,n){r.addEnum(n.name,n.fields.map(i=>i.name))}isStringLiteral(r){return av(r)&&typeof r.value=="string"}};var y_e=Gs(require("path")),AL=Gs(xL());var DL=class{transform(r){switch(r.$type){case Ub:return this.literal(r);case Hx:return this.array(r);case xA:return this.null();case $x:return this.this(r);case Wb:return this.reference(r);case zx:return this.invocation(r);case Kb:return this.memberAccess(r);default:throw new eu(`Unsupported expression type: ${r.$type}`)}}this(r){return"id"}memberAccess(r){if(!r.member.ref)throw new eu("Unresolved MemberAccessExpr");return xT(r.operand)?r.member.ref.name:`${this.transform(r.operand)}?.${r.member.ref.name}`}invocation(r){var n,i;if(((n=r.function.ref)==null?void 0:n.name)!=="auth")throw new eu(`Function invocation is not supported: ${(i=r.function.ref)==null?void 0:i.name}`);return"user"}reference(r){if(!r.target.ref)throw new eu("Unresolved ReferenceExpr");return Jx(r.target.ref)?`${r.target.ref.$container.name}.${r.target.ref.name}`:r.target.ref.name}null(){return"null"}array(r){return`[${r.items.map(n=>this.transform(n)).join(", ")}]`}literal(r){return typeof r.value=="string"?`'${r.value}'`:r.value.toString()}};var CL=class{constructor(r){this.writer=r;this.plainExprBuilder=new DL}write(r){let n=()=>{switch(r.$type){case Ub:this.writeLiteral(r);break;case DA:this.writeUnary(r);break;case SA:this.writeBinary(r);break;case Wb:this.writeReference(r);break;case Kb:this.writeMemberAccess(r);break;default:throw new Error(`Not implemented: ${r.$type}`)}};this.block(n)}writeReference(r){var n;if(Jx(r.target.ref))throw new Error("We should never get here");this.writer.write(`${(n=r.target.ref)==null?void 0:n.name}: true`)}writeMemberAccess(r){this.writeFieldCondition(r.operand,()=>{this.block(()=>{var n;this.writer.write(`${(n=r.member.ref)==null?void 0:n.name}: true`)})},"is")}writeExprList(r){this.writer.writeLine("[");for(let n=0;n<r.length;n++)this.write(r[n]),n!==r.length-1&&this.writer.writeLine(",");this.writer.writeLine("]")}writeBinary(r){switch(r.operator){case"&&":case"||":this.writeLogical(r,r.operator);break;case"==":case"!=":case">":case">=":case"<":case"<=":this.writeComparison(r,r.operator);break;case"?":case"!":case"^":this.writeCollectionPredicate(r,r.operator);break}}writeCollectionPredicate(r,n){this.writeFieldCondition(r.left,()=>{this.write(r.right)},n==="?"?"some":n==="!"?"every":"none")}isFieldAccess(r){return xT(r)?!0:nK(r)?this.isFieldAccess(r.operand):!!(Vb(r)&&qx(r.target.ref))}guard(r){this.writer.write(`${tD}: `),r()}plain(r){this.writer.write(this.plainExprBuilder.transform(r))}writeComparison(r,n){let i=this.isFieldAccess(r.left),a=this.isFieldAccess(r.right);if(i&&a)throw new eu("Comparison between fields are not supported yet");if(!i&&!a){this.guard(()=>{this.plain(r.left),this.writer.write(" "+n+" "),this.plain(r.right)});return}let s,u;i?(s=r.left,u=r.right):(s=r.right,u=r.left,n=this.negateOperator(n)),this.writeFieldCondition(s,()=>{this.block(()=>{this.isModelTyped(s)?(this.writer.write("id: "),this.block(()=>{this.writeOperator(n,()=>{this.plain(u),this.writer.write("?.id")})})):this.writeOperator(n,()=>{this.plain(u)})},!xT(s))},"is")}writeOperator(r,n){r==="!="?(this.writer.write("not: "),this.block(()=>{this.writeOperator("==",n)})):(this.writer.write(`${this.mapOperator(r)}: `),n())}writeFieldCondition(r,n,i){var u,p;let a,s;if(xT(r)){n();return}else if(Vb(r))a=(u=r.target.ref)==null?void 0:u.name;else if(nK(r))a=(p=r.member.ref)==null?void 0:p.name,s=r.operand;else throw new eu(`Unsupported expression type: ${r.$type}`);if(!a)throw new eu("Failed to write FieldAccess expression");s?this.writeFieldCondition(s,()=>{this.block(()=>{this.writer.write(a+": "),this.isModelTyped(r)?this.block(()=>{this.writer.write(`${i}: `),n()}):n()},!xT(s))},"is"):this.isModelTyped(r)?(this.writer.write(a+": "),this.block(()=>{this.writer.write(`${i}: `),n()})):(this.writer.write(a+": "),n())}block(r,n=!0){n?this.writer.block(r):r()}isModelTyped(r){var n;return Lm((n=r.$resolvedType)==null?void 0:n.decl)}mapOperator(r){switch(r){case"==":return"equals";case"!=":throw new Error("Operation != should have been compiled away");case">":return"gt";case">=":return"ge";case"<":return"lt";case"<=":return"le"}}negateOperator(r){switch(r){case">":return"<=";case"<":return">=";case">=":return"<";case"<=":return">";default:return r}}writeLogical(r,n){this.writer.writeLine(`${n==="&&"?"AND":"OR"}: `),this.writeExprList([r.left,r.right])}writeUnary(r){if(r.operator!=="!")throw new eu(`Unary operator "${r.operator}" is not supported`);this.writer.writeLine("NOT: "),this.write(r.operand)}writeLiteral(r){this.guard(()=>{this.plain(r)})}};var LL=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let r=new AL.Project,n=r.createSourceFile(y_e.default.join(this.context.generatedCodeDir,"src/query/guard.ts"),void 0,{overwrite:!0});n.addImportDeclaration({namedImports:[{name:"QueryContext"}],moduleSpecifier:rD,isTypeOnly:!0});for(let a of this.context.schema.declarations.filter(s=>hoe(s)))n.addImportDeclaration({namedImports:[{name:a.name}],moduleSpecifier:"../../.prisma"});let i=this.context.schema.declarations.filter(a=>Lm(a));this.generateFieldMapping(i,n),i.forEach(a=>this.generateQueryGuardForModel(a,n)),n.formatText({}),yield r.save()})}generateFieldMapping(r,n){let i=Object.fromEntries(r.map(a=>[a.name,Object.fromEntries(a.fields.map(s=>{var p;let u={name:s.name,type:s.type.reference?s.type.reference.$refText:s.type.type,isDataModel:Lm((p=s.type.reference)==null?void 0:p.ref),isArray:s.type.array,isOptional:s.type.optional,attributes:this.getFieldAttributes(s)};return[s.name,u]}))]));n.addVariableStatement({isExported:!0,declarationKind:AL.VariableDeclarationKind.Const,declarations:[{name:"_fieldMapping",initializer:JSON.stringify(i)}]})}getFieldAttributes(r){return r.attributes.map(n=>{let i=[];for(let a of n.args){if(!av(a.value))return;i.push({name:a.name,value:a.value.value})}return{name:AT(n.decl).name,args:i}}).filter(n=>!!n)}getPolicyExpressions(r,n,i){return r.attributes.filter(s=>{var u;return((u=s.decl.ref)==null?void 0:u.name)===`@@${n}`}).filter(s=>{if(!av(s.args[0].value)||typeof s.args[0].value.value!="string")return!1;let u=s.args[0].value.value.split(",").map(p=>p.trim());return u.includes(i)||u.includes("all")}).map(s=>s.args[1].value)}generateQueryGuardForModel(r,n){return Au(this,null,function*(){for(let i of["create","update","read","delete"]){let a=n.addFunction({name:r.name+"_"+i,returnType:"any",parameters:[{name:"context",type:"QueryContext"}],isExported:!0}).addBody();a.addStatements(`const user = context.user ?? { id: '${mse}' };`),a.addVariableStatement({declarationKind:AL.VariableDeclarationKind.Const,declarations:[{name:"r",initializer:s=>{let u=new CL(s),p=this.getPolicyExpressions(r,"deny",i),f=this.getPolicyExpressions(r,"allow",i),m=()=>{s.conditionalWrite(p.length>1,"{ AND: ["),p.forEach((D,P)=>{s.block(()=>{s.write("NOT: "),u.write(D)}),s.conditionalWrite(P!==p.length-1,",")}),s.conditionalWrite(p.length>1,"]}")},g=()=>{s.conditionalWrite(f.length>1,"{ OR: ["),f.forEach((D,P)=>{u.write(D),s.conditionalWrite(P!==f.length-1,",")}),s.conditionalWrite(f.length>1,"]}")};f.length>0&&p.length>0?(s.writeLine("{ AND: ["),m(),s.writeLine(","),g(),s.writeLine("]}")):p.length>0?m():f.length>0?g():s.write(`{ ${tD}: false }`)}}]}),a.addStatements("return r;")}})}};var NL=class{generate(r){return Au(this,null,function*(){let n=yield new wA(r).generate();yield this.generatePrismaClient(n),yield new LL(r).generate(),console.log(v_e.default.blue(" \u2714\uFE0F Prisma schema and query guard generated"))})}generatePrismaClient(r){return Au(this,null,function*(){try{eD(`npx prisma generate --schema "${r}"`)}catch(n){throw new eu(`Failed to generate client code with Prisma. Check errors above for clues.
6648
+ }`}};var gse=["@@allow","@@deny","@password","@omit"],wA=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let{schema:r}=this.context,n=new ak;for(let a of r.declarations)switch(a.$type){case XO:this.generateDataSource(n,a);break;case YO:this.generateEnum(n,a);break;case $O:this.generateModel(n,a);break}this.generateGenerator(n);let i=yK.default.join(this.context.outDir,"schema.prisma");return yield(0,yse.writeFile)(i,n.toString()),i})}generateDataSource(r,n){let i,a,s;for(let u of n.fields)switch(u.name){case"provider":{if(this.isStringLiteral(u.value))i=u.value.value;else throw new eu("Datasource provider must be set to a string");break}case"url":{let p=this.extractDataSourceUrl(u.value);if(!p)throw new eu("Invalid value for datasource url");a=p;break}case"shadowDatabaseUrl":{let p=this.extractDataSourceUrl(u.value);if(!p)throw new eu("Invalid value for datasource url");s=p;break}}if(!i)throw new eu('Datasource is missing "provider" field');if(!a)throw new eu('Datasource is missing "url" field');r.addDataSource(n.name,i,a,s)}extractDataSourceUrl(r){var n;return this.isStringLiteral(r)?new OA(r.value,!1):TA(r)&&((n=r.function.ref)==null?void 0:n.name)==="env"&&r.args.length===1&&this.isStringLiteral(r.args[0].value)?new OA(r.args[0].value.value,!0):null}generateGenerator(r){r.addGenerator("client","prisma-client-js",yK.default.join("..",this.context.generatedCodeDir,".prisma"),["fieldReference","interactiveTransactions","referentialIntegrity"])}generateModel(r,n){let i=r.addModel(n.name);for(let a of n.fields)this.generateModelField(i,a);i.addField(tD,"Boolean",[new nD("@default",[new iD(void 0,new jg("Boolean",!0))])]),i.addField(dK,"String?"),i.addAttribute("@@index",[new iD(void 0,new jg("Array",[new jg("FieldReference",dK)]))]);for(let a of n.attributes.filter(s=>{var u;return((u=s.decl.ref)==null?void 0:u.name)&&!gse.includes(s.decl.ref.name)}))this.generateModelAttribute(i,a)}generateModelField(r,n){var u,p;let i=n.type.type||((p=(u=n.type.reference)==null?void 0:u.ref)==null?void 0:p.name);if(!i)throw new eu(`Field type is not resolved: ${n.$container.name}.${n.name}`);let a=new ok(i,n.type.array,n.type.optional),s=n.attributes.filter(f=>{var m;return((m=f.decl.ref)==null?void 0:m.name)&&!gse.includes(f.decl.ref.name)}).map(f=>this.makeFieldAttribute(f));r.addField(n.name,a,s)}makeFieldAttribute(r){return new nD(AT(r.decl).name,r.args.map(n=>this.makeAttributeArg(n)))}makeAttributeArg(r){return new iD(r.name,this.makeAttributeArgValue(r.value))}makeAttributeArgValue(r){if(av(r))switch(typeof r.value){case"string":return new jg("String",r.value);case"number":return new jg("Number",r.value);case"boolean":return new jg("Boolean",r.value);default:throw new eu(`Unexpected literal type: ${typeof r.value}`)}else{if(zO(r))return new jg("Array",new Array(...r.items.map(n=>this.makeAttributeArgValue(n))));if(Vb(r))return new jg("FieldReference",new RA(AT(r.target).name,r.args.map(n=>new sk(n.name,n.value))));if(TA(r))return new jg("FunctionCall",this.makeFunctionCall(r));throw new eu(`Unsupported attribute argument expression type: ${r.$type}`)}}makeFunctionCall(r){return new MA(AT(r.function).name,r.args.map(n=>{if(!av(n.value))throw new eu("Function call argument must be literal");return new lk(n.name,n.value.value)}))}generateModelAttribute(r,n){r.attributes.push(new kA(AT(n.decl).name,n.args.map(i=>this.makeAttributeArg(i))))}generateEnum(r,n){r.addEnum(n.name,n.fields.map(i=>i.name))}isStringLiteral(r){return av(r)&&typeof r.value=="string"}};var y_e=Gs(require("path")),AL=Gs(xL());var DL=class{transform(r){switch(r.$type){case Ub:return this.literal(r);case Hx:return this.array(r);case xA:return this.null();case $x:return this.this(r);case Wb:return this.reference(r);case zx:return this.invocation(r);case Kb:return this.memberAccess(r);default:throw new eu(`Unsupported expression type: ${r.$type}`)}}this(r){return"id"}memberAccess(r){if(!r.member.ref)throw new eu("Unresolved MemberAccessExpr");return xT(r.operand)?r.member.ref.name:`${this.transform(r.operand)}?.${r.member.ref.name}`}invocation(r){var n,i;if(((n=r.function.ref)==null?void 0:n.name)!=="auth")throw new eu(`Function invocation is not supported: ${(i=r.function.ref)==null?void 0:i.name}`);return"user"}reference(r){if(!r.target.ref)throw new eu("Unresolved ReferenceExpr");return Jx(r.target.ref)?`${r.target.ref.$container.name}.${r.target.ref.name}`:r.target.ref.name}null(){return"null"}array(r){return`[${r.items.map(n=>this.transform(n)).join(", ")}]`}literal(r){return typeof r.value=="string"?`'${r.value}'`:r.value.toString()}};var CL=class{constructor(r){this.writer=r;this.plainExprBuilder=new DL}write(r){let n=()=>{switch(r.$type){case Ub:this.writeLiteral(r);break;case DA:this.writeUnary(r);break;case SA:this.writeBinary(r);break;case Wb:this.writeReference(r);break;case Kb:this.writeMemberAccess(r);break;default:throw new Error(`Not implemented: ${r.$type}`)}};this.block(n)}writeReference(r){var n;if(Jx(r.target.ref))throw new Error("We should never get here");this.writer.write(`${(n=r.target.ref)==null?void 0:n.name}: true`)}writeMemberAccess(r){this.writeFieldCondition(r.operand,()=>{this.block(()=>{var n;this.writer.write(`${(n=r.member.ref)==null?void 0:n.name}: true`)})},"is")}writeExprList(r){this.writer.writeLine("[");for(let n=0;n<r.length;n++)this.write(r[n]),n!==r.length-1&&this.writer.writeLine(",");this.writer.writeLine("]")}writeBinary(r){switch(r.operator){case"&&":case"||":this.writeLogical(r,r.operator);break;case"==":case"!=":case">":case">=":case"<":case"<=":this.writeComparison(r,r.operator);break;case"?":case"!":case"^":this.writeCollectionPredicate(r,r.operator);break}}writeCollectionPredicate(r,n){this.writeFieldCondition(r.left,()=>{this.write(r.right)},n==="?"?"some":n==="!"?"every":"none")}isFieldAccess(r){return xT(r)?!0:nK(r)?this.isFieldAccess(r.operand):!!(Vb(r)&&qx(r.target.ref))}guard(r){this.writer.write(`${tD}: `),r()}plain(r){this.writer.write(this.plainExprBuilder.transform(r))}writeComparison(r,n){let i=this.isFieldAccess(r.left),a=this.isFieldAccess(r.right);if(i&&a)throw new eu("Comparison between fields are not supported yet");if(!i&&!a){this.guard(()=>{this.plain(r.left),this.writer.write(" "+n+" "),this.plain(r.right)});return}let s,u;i?(s=r.left,u=r.right):(s=r.right,u=r.left,n=this.negateOperator(n)),this.writeFieldCondition(s,()=>{this.block(()=>{this.isModelTyped(s)?(this.writer.write("id: "),this.block(()=>{this.writeOperator(n,()=>{this.plain(u),this.writer.write("?.id")})})):this.writeOperator(n,()=>{this.plain(u)})},!xT(s))},"is")}writeOperator(r,n){r==="!="?(this.writer.write("not: "),this.block(()=>{this.writeOperator("==",n)})):(this.writer.write(`${this.mapOperator(r)}: `),n())}writeFieldCondition(r,n,i){var u,p;let a,s;if(xT(r)){n();return}else if(Vb(r))a=(u=r.target.ref)==null?void 0:u.name;else if(nK(r))a=(p=r.member.ref)==null?void 0:p.name,s=r.operand;else throw new eu(`Unsupported expression type: ${r.$type}`);if(!a)throw new eu("Failed to write FieldAccess expression");s?this.writeFieldCondition(s,()=>{this.block(()=>{this.writer.write(a+": "),this.isModelTyped(r)?this.block(()=>{this.writer.write(`${i}: `),n()}):n()},!xT(s))},"is"):this.isModelTyped(r)?(this.writer.write(a+": "),this.block(()=>{this.writer.write(`${i}: `),n()})):(this.writer.write(a+": "),n())}block(r,n=!0){n?this.writer.block(r):r()}isModelTyped(r){var n;return Lm((n=r.$resolvedType)==null?void 0:n.decl)}mapOperator(r){switch(r){case"==":return"equals";case"!=":throw new Error("Operation != should have been compiled away");case">":return"gt";case">=":return"ge";case"<":return"lt";case"<=":return"le"}}negateOperator(r){switch(r){case">":return"<=";case"<":return">=";case">=":return"<";case"<=":return">";default:return r}}writeLogical(r,n){this.writer.writeLine(`${n==="&&"?"AND":"OR"}: `),this.writeExprList([r.left,r.right])}writeUnary(r){if(r.operator!=="!")throw new eu(`Unary operator "${r.operator}" is not supported`);this.writer.writeLine("NOT: "),this.write(r.operand)}writeLiteral(r){this.guard(()=>{this.plain(r)})}};var LL=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let r=new AL.Project,n=r.createSourceFile(y_e.default.join(this.context.generatedCodeDir,"src/query/guard.ts"),void 0,{overwrite:!0});n.addImportDeclaration({namedImports:[{name:"QueryContext"}],moduleSpecifier:rD,isTypeOnly:!0});for(let a of this.context.schema.declarations.filter(s=>hoe(s)))n.addImportDeclaration({namedImports:[{name:a.name}],moduleSpecifier:"../../.prisma"});let i=this.context.schema.declarations.filter(a=>Lm(a));this.generateFieldMapping(i,n),i.forEach(a=>this.generateQueryGuardForModel(a,n)),n.formatText({}),yield r.save()})}generateFieldMapping(r,n){let i=Object.fromEntries(r.map(a=>[a.name,Object.fromEntries(a.fields.map(s=>{var p;let u={name:s.name,type:s.type.reference?s.type.reference.$refText:s.type.type,isDataModel:Lm((p=s.type.reference)==null?void 0:p.ref),isArray:s.type.array,isOptional:s.type.optional,attributes:this.getFieldAttributes(s)};return[s.name,u]}))]));n.addVariableStatement({isExported:!0,declarationKind:AL.VariableDeclarationKind.Const,declarations:[{name:"_fieldMapping",initializer:JSON.stringify(i)}]})}getFieldAttributes(r){return r.attributes.map(n=>{let i=[];for(let a of n.args){if(!av(a.value))return;i.push({name:a.name,value:a.value.value})}return{name:AT(n.decl).name,args:i}}).filter(n=>!!n)}getPolicyExpressions(r,n,i){return r.attributes.filter(s=>{var u;return((u=s.decl.ref)==null?void 0:u.name)===`@@${n}`}).filter(s=>{if(!av(s.args[0].value)||typeof s.args[0].value.value!="string")return!1;let u=s.args[0].value.value.split(",").map(p=>p.trim());return u.includes(i)||u.includes("all")}).map(s=>s.args[1].value)}generateQueryGuardForModel(r,n){return Au(this,null,function*(){for(let i of["create","update","read","delete"]){let a=n.addFunction({name:r.name+"_"+i,returnType:"any",parameters:[{name:"context",type:"QueryContext"}],isExported:!0}).addBody();a.addStatements(`const user = context.user?.id ? context.user : { ...context.user, id: '${mse}' };`),a.addVariableStatement({declarationKind:AL.VariableDeclarationKind.Const,declarations:[{name:"r",initializer:s=>{let u=new CL(s),p=this.getPolicyExpressions(r,"deny",i),f=this.getPolicyExpressions(r,"allow",i),m=()=>{s.conditionalWrite(p.length>1,"{ AND: ["),p.forEach((D,P)=>{s.block(()=>{s.write("NOT: "),u.write(D)}),s.conditionalWrite(P!==p.length-1,",")}),s.conditionalWrite(p.length>1,"]}")},g=()=>{s.conditionalWrite(f.length>1,"{ OR: ["),f.forEach((D,P)=>{u.write(D),s.conditionalWrite(P!==f.length-1,",")}),s.conditionalWrite(f.length>1,"]}")};f.length>0&&p.length>0?(s.writeLine("{ AND: ["),m(),s.writeLine(","),g(),s.writeLine("]}")):p.length>0?m():f.length>0?g():s.write(`{ ${tD}: false }`)}}]}),a.addStatements("return r;")}})}};var NL=class{generate(r){return Au(this,null,function*(){let n=yield new wA(r).generate();yield this.generatePrismaClient(n),yield new LL(r).generate(),console.log(v_e.default.blue(" \u2714\uFE0F Prisma schema and query guard generated"))})}generatePrismaClient(r){return Au(this,null,function*(){try{eD(`npx prisma generate --schema "${r}"`)}catch(n){throw new eu(`Failed to generate client code with Prisma. Check errors above for clues.
6649
6649
  This normally shouldn't happen. Please file an issue at: http://go.zenstack.dev/bug.`)}})}};var h_e=Gs(xL()),E_e=Gs(require("path")),b_e=Gs(Hb());var IL=class{generate(r){return Au(this,null,function*(){let n=new h_e.Project,i=n.createSourceFile(E_e.join(r.generatedCodeDir,"src/index.ts"),void 0,{overwrite:!0});i.addStatements(['import { PrismaClient } from "../.prisma";',`import { DefaultService } from "${rD}";`]);let a=i.addClass({name:"ZenStackService",isExported:!0,extends:"DefaultService<PrismaClient>"});a.addMethod({name:"initializePrisma"}).setBodyText(`
6650
6650
  const logConfig = (this.config.log || [])
6651
6651
  .filter(item => typeof item === 'string' ? ['info', 'warn', 'error', 'query'].includes(item): ['info', 'warn', 'error', 'query'].includes(item.level));