zenstack 0.1.57 → 0.2.0

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())h7e({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 q6(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:(d7e({parent:i,getSiblingFormatting:VBe,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=T7e(this,n),f=this.getDecorators();r=ku(r,f.length);let m=x7e(this,f),g=f[r-1],D=jBe({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 T7e(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 x7e(e,r){return D7e(e,r)?El.Space:El.Newline}function D7e(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 EL(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 C7e(YH(e))}function C7e(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 WR.default(r.getOptions())}getNewWriterWithQueuedChildIndentation(r){let n=new WR.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 eL={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 A7e(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 L7e(e,r);case Oe.StructureKind.Class:return I7e(e,r);case Oe.StructureKind.ClassStaticBlock:return O7e(e,r);case Oe.StructureKind.ConstructorOverload:return k7e(e,r);case Oe.StructureKind.Constructor:return R7e(e,r);case Oe.StructureKind.ConstructSignature:return M7e(e,r);case Oe.StructureKind.Enum:return w7e(e,r);case Oe.StructureKind.EnumMember:return F7e(e,r);case Oe.StructureKind.ExportDeclaration:return G7e(e,r);case Oe.StructureKind.FunctionOverload:return B7e(e,r);case Oe.StructureKind.Function:return U7e(e,r);case Oe.StructureKind.GetAccessor:return K7e(e,r);case Oe.StructureKind.ImportDeclaration:return W7e(e,r);case Oe.StructureKind.IndexSignature:return V7e(e,r);case Oe.StructureKind.Interface:return j7e(e,r);case Oe.StructureKind.JSDoc:return q7e(e,r);case Oe.StructureKind.JsxElement:return J7e(e,r);case Oe.StructureKind.JsxSelfClosingElement:return z7e(e,r);case Oe.StructureKind.MethodOverload:return X7e(e,r);case Oe.StructureKind.Method:return Y7e(e,r);case Oe.StructureKind.MethodSignature:return Q7e(e,r);case Oe.StructureKind.Module:return Z7e(e,r);case Oe.StructureKind.Parameter:return e9e(e,r);case Oe.StructureKind.Property:return r9e(e,r);case Oe.StructureKind.PropertySignature:return t9e(e,r);case Oe.StructureKind.SetAccessor:return n9e(e,r);case Oe.StructureKind.SourceFile:return i9e(e,r);case Oe.StructureKind.TypeAlias:return a9e(e,r);case Oe.StructureKind.VariableStatement:return o9e(e,r);default:return}}function L7e(e,r){return Pf(e,r)||JT(e,r)||Oh(e,r)}function Pf(e,r){return z6(e.docs,r,Oe.StructureKind.JSDoc)}function JT(e,r){return N7e(e,r)}function N7e(e,r){return kd(e.parameters,r,Oe.StructureKind.Parameter)}function Oh(e,r){return z6(e.typeParameters,r,Oe.StructureKind.TypeParameter)}function I7e(e,r){return P7e(e,r)}function P7e(e,r){return BD(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 BD(e,r){return kd(e.decorators,r,Oe.StructureKind.Decorator)}function O7e(e,r){return Pf(e,r)||J6(e,r)}function J6(e,r){return ZR(e.statements,r)}function k7e(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)}function R7e(e,r){return bL(e,r)||kd(e.overloads,r,Oe.StructureKind.ConstructorOverload)}function bL(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)||J6(e,r)}function M7e(e,r){return Pf(e,r)||JT(e,r)||Oh(e,r)}function w7e(e,r){return Pf(e,r)||kd(e.members,r,Oe.StructureKind.EnumMember)}function F7e(e,r){return Pf(e,r)}function G7e(e,r){return z6(e.namedExports,r,Oe.StructureKind.ExportSpecifier)||kd(e.assertElements,r,Oe.StructureKind.AssertEntry)}function B7e(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)}function U7e(e,r){return bL(e,r)||kd(e.overloads,r,Oe.StructureKind.FunctionOverload)}function K7e(e,r){return BD(e,r)||bL(e,r)}function W7e(e,r){return z6(e.namedImports,r,Oe.StructureKind.ImportSpecifier)||kd(e.assertElements,r,Oe.StructureKind.AssertEntry)}function V7e(e,r){return Pf(e,r)}function j7e(e,r){return Oh(e,r)||Pf(e,r)||H7e(e,r)}function H7e(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 q7e(e,r){return kd(e.tags,r,Oe.StructureKind.JSDocTag)}function J7e(e,r){return ZR(e.attributes,r)||ZR(e.children,r)}function z7e(e,r){return $7e(e,r)}function $7e(e,r){return ZR(e.attributes,r)}function X7e(e,r){return JT(e,r)||Oh(e,r)||Pf(e,r)}function Y7e(e,r){return BD(e,r)||bL(e,r)||kd(e.overloads,r,Oe.StructureKind.MethodOverload)}function Q7e(e,r){return Pf(e,r)||JT(e,r)||Oh(e,r)}function Z7e(e,r){return Pf(e,r)||J6(e,r)}function e9e(e,r){return BD(e,r)}function r9e(e,r){return Pf(e,r)||BD(e,r)}function t9e(e,r){return Pf(e,r)}function n9e(e,r){return BD(e,r)||bL(e,r)}function i9e(e,r){return J6(e,r)}function a9e(e,r){return Oh(e,r)||Pf(e,r)}function o9e(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 z6(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 ZR(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)})}},nL=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),wBe(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 nL).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:s9e(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 s9e(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 nL).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 $6(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 l9e($6(e))}function l9e(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=$g(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 UD(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 u9e(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 u9e(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 KD(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 pv(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(pv(e));return KD(r)}function X6(e){let r=kh(pv(e));return KD(r)}function lpe(e){let r=kh(pv(e));return KD(r)}function Y6(e){return c9e(kh(pv(e)))}function c9e(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 mv(e){let r=pv(kh(e));return KD(r)}function UE(e){let r=kh(pv(e));return KD(r)}function SL(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 Q6(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 TL(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=$g(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=eM(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 eM(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 eM(this)||Oe.Scope.Public}setScope(r){return tq(this,r),this}hasScopeKeyword(){return eM(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 _v(e){return rq(upe(e))}function WD(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:$g(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 Z6(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 fv(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=$g(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 ZA({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 ZA({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 ZA({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 ZA({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 ZA({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 ZA(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:d9e(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 d9e(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 eG(e){return class extends e{unwrap(){v7e(this)}}}var rM=class extends Tr{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},f9e=e=>EL($T(X6(e))),dpe=f9e(Tr),tM=class extends dpe{getPropertyNameNodeOrThrow(){return b.errors.throwIfNullOrUndefined(this.getPropertyNameNode(),"Expected to find a property name node.")}getPropertyNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.propertyName)}},nM=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,iL=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=iL,aL=class extends ppe{getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}},mpe=aL,NH=class extends mpe{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},cv=class extends oc{},iM=class extends cv{},RD=class extends iM{},BT=class extends RD{},sd=class extends BT{},aM=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 nL;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;fv(i);function a(s){return n[ku(s,n.length-1)]}}};function xL(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 VD(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 VD(e)}function p9e(e){return VD(e)}function XT(e){return VD(e)}function iq(e){return VD(e)}function jD(e){return VD(e)}var m9e=e=>KE(ud(e)),_pe=m9e(oc),oM=class extends _pe{},gpe=jD(cv),sM=class extends gpe{},_9e=e=>Z6(zH(Q6(XT(e)))),ype=_9e(RD),lM=class extends ype{getReturnType(){return this._context.typeChecker.getTypeAtLocation(this)}},vpe=oc,uM=class extends vpe{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},hpe=oc,cM=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=jD(cv),dM=class extends Epe{},g9e=e=>Q6(XT(e)),bpe=g9e(BT),oL=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,fM=class extends Spe{},Tpe=UD(sd),cS=class extends Tpe{},xpe=mv(sd),pM=class extends xpe{getKeywordToken(){return this.compilerNode.keywordToken}},y9e=e=>Z6(zH(XT(e))),Dpe=y9e(sd),mM=class extends Dpe{},Cpe=ud(RD),_M=class extends Cpe{},UT=class extends Tr{remove(){fv(this)}},gM=class extends UT{},Ape=aL,IH=class extends Ape{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}},Lpe=sd,yM=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)}},v9e=e=>$6(Rh(UE(e))),aR=v9e(UT),vM=class extends aR{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:$g(this._getWriterWithQueuedChildIndentation(),r),parent:this,replacing:{textLength:n.getWidth()}}),this}set(r){if(io(aR.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(aR.prototype,this,{kind:Oe.StructureKind.PropertyAssignment,initializer:r.getText()});return delete n.hasQuestionToken,n}},h9e=e=>$6(Rh(mv(e))),oR=h9e(UT),hM=class extends oR{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(oR.prototype,this,r),this}getStructure(){let r=uo(oR.prototype,this,{kind:Oe.StructureKind.ShorthandPropertyAssignment});return delete r.hasQuestionToken,r}},sR=ud(UT),EM=class extends sR{set(r){return io(sR.prototype,this,r),this}getStructure(){return uo(sR.prototype,this,{kind:Oe.StructureKind.SpreadAssignment,expression:this.getExpression().getText()})}},Npe=oc,bM=class extends Npe{},Ipe=ud(oc),SM=class extends Ipe{},Ppe=ud(oc),TM=class extends Ppe{},Ope=cv,xM=class extends Ope{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},kpe=cv,DM=class extends kpe{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},E9e=e=>mv(Q6(XT(e))),Rpe=E9e(BT),sL=class extends Rpe{},Mpe=ud(oc),CM=class extends Mpe{},wpe=iq(oL),PH=class extends wpe{},Fpe=sd,AM=class extends Fpe{},Gpe=iq(sL),OH=class extends Gpe{},Bpe=sd,LM=class extends Bpe{},b9e=e=>KE(jD(e)),Upe=b9e(cv),NM=class extends Upe{},Kpe=jD(cv),IM=class extends Kpe{},Wpe=jD(cv),PM=class extends Wpe{},Vpe=xL(zT(oc)),OM=class extends Vpe{},jpe=Im(Tr),Cl=class extends jpe{remove(){y7e(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"),H6(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 S9e=e=>ld(Mh(e)),Hpe=S9e(Cl),kM=class extends Hpe{},RM=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),MM=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}},T9e=e=>sc(ud(ld(Mh(e)))),Jpe=T9e(Tr),wM=class extends Jpe{remove(){zfe(this)}},zpe=Tr,FM=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.")}},GM=class extends Cl{},BM=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,UM=class extends $pe{},x9e=e=>ld(Mh(e)),Xpe=x9e(Tr),KM=class extends Xpe{remove(){zfe(this)}},dS=class extends Cl{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},Ype=ud(dS),WM=class extends Ype{},Qpe=Cl,VM=class extends Qpe{},Zpe=ud(sc(Cl)),jM=class extends Zpe{},eme=ud(dS),HM=class extends eme{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},rme=ud(Qfe(dS)),qM=class extends rme{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},tme=dS,JM=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),zM=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),H6(r)}},ime=sc(Cl),$M=class extends ime{getLabel(){return this._getNodeFromCompilerNode(this.compilerNode.label)}getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},ame=Cl,XM=class extends ame{},ome=xL(Cl),YM=class extends ome{},sme=ud(Cl),QM=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),ZM=class extends lme{},ume=Cl,ew=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,rw=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})}},lR=spe(Tr),tw=class extends lR{getValue(){return this._getNodeFromCompilerNode(this.compilerNode.value)}set(r){return io(lR.prototype,this,r),r.value&&this.getValue().replaceWithText(r.value),this}getStructure(){return uo(lR.prototype,this,{kind:Oe.StructureKind.AssertEntry,value:this.getValue().getText()})}},kH=ud(Cl),nw=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()})}},uR=Cl,iw=class extends uR{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(uR.prototype,this,r),r.namedExports!=null?(D9e(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(uR.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 D9e(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,aw=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?fv(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=xL(Tr),ow=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,sw=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()}},cR=Cl,lw=class extends cR{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(cR.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&&(C9e(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(cR.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 C9e(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 A9e=e=>sc(mv(e)),mme=A9e(Cl),uw=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()}},dR=Tr,cw=class extends dR{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?fv(this):r.removeNamedImports()}set(r){return io(dR.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(dR.prototype,this,{kind:Oe.StructureKind.ImportSpecifier,name:this.getName(),alias:r?r.getText():void 0})}},_me=Mh(Cl),dw=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 L9e=e=>eq(eG(ld(HT(yS(Mh(sc(Ph(BE(sf(lpe(e))))))))))),fR=L9e(Cl),fw=class extends fR{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)&&N9e(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(fR.prototype,this,r),r.declarationKind!=null&&this.setDeclarationKind(r.declarationKind),this}getStructure(){return uo(fR.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 N9e(e){e.hasNamespaceKeyword()&&e.setDeclarationKind(Oe.ModuleDeclarationKind.Module),e.hasDeclareKeyword()||e.setHasDeclareKeyword(!0)}var gme=Tr,pw=class extends gme{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},yme=Tr,mw=class extends yme{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},vme=pv(Tr),_w=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=pv(Tr),gw=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)}},OD=class extends tL{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 pR=eq(ld(Mh(Tr))),kE=class extends pR{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 OD(r,this))),this._referencedFiles}getTypeReferenceDirectives(){return this._typeReferenceDirectives==null&&(this._typeReferenceDirectives=(this.compilerNode.typeReferenceDirectives||[]).map(r=>new OD(r,this))),this._typeReferenceDirectives}getLibReferenceDirectives(){return this._libReferenceDirectives==null&&(this._libReferenceDirectives=(this.compilerNode.libReferenceDirectives||[]).map(r=>new OD(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=uv(i,a[0],f=>f===ac.NEWLINE),u=j6(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("");c7e({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(pR.prototype,this,r),this}getStructure(){return uo(pR.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 I9e=e=>yS(sc(Ph(BE(sf(e))))),mR=I9e(Cl),yw=class extends mR{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(mR.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(mR.prototype,this,{kind:Oe.StructureKind.VariableStatement,declarationKind:this.getDeclarationKind(),declarations:this.getDeclarations().map(r=>r.getStructure())})}},Eme=ud(dS),vw=class extends Eme{},bme=ud(Cl),hw=class extends bme{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}};function YT(e){return sc(J_(_v(Mh(sf(e)))))}var P9e=e=>ld(q6(jT(YT(e)))),Sme=P9e(oc),Ew=class extends Sme{getEqualsGreaterThan(){return this._getNodeFromCompilerNode(this.compilerNode.equalsGreaterThanToken)}};function rG(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 tG(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 O9e=e=>eG(ld(rG(HT(jT(zT(Ph(BE(YT(yS(Y6(e))))))))))),_R=O9e(Cl),k9e=e=>eG(ld(jT(zT(_v(Ph(yS(sc(J_(BE(sf(e))))))))))),Tme=k9e(Cl),bw=class extends _R{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 tG({node:this,index:r,structures:n,printStructure:(s,u)=>{a.printOverload(s,i,u)},getThisStructure:t7e,expectedSyntaxKind:b.SyntaxKind.FunctionDeclaration})}remove(){g7e(this)}set(r){return io(_R.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:_R.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}}}}},R9e=e=>sc(ld(q6(jT(zT(Mh(J_(_v(sf(Y6(e)))))))))),xme=R9e(sd),Sw=class extends xme{},M9e=e=>SL(Rh(qT(cpe(TL(sf(EL(KE($T(X6(e)))))))))),gR=M9e(Tr),Tw=class extends gR{isRestParameter(){return this.compilerNode.dotDotDotToken!=null}isParameterProperty(){return this.getScope()!=null||this.isReadonly()||this.hasOverrideKeyword()}setIsRestParameter(r){return this.isRestParameter()===r?this:(r?(iR(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(){fv(this)}set(r){return io(gR.prototype,this,r),r.isRestParameter!=null&&this.setIsRestParameter(r.isRestParameter),this}getStructure(){return uo(gR.prototype,this,{kind:Oe.StructureKind.Parameter,isRestParameter:this.isRestParameter()})}setHasQuestionToken(r){return r&&iR(this),super.setHasQuestionToken(r),this}setInitializer(r){return iR(this),super.setInitializer(r),this}setType(r){return iR(this),super.setType.call(this,r),this}};function iR(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 zg=class extends Tr{remove(){let r=this.getParentOrThrow();Tr.isClassDeclaration(r)||Tr.isClassExpression(r)?p7e(this):Tr.isObjectLiteralExpression(r)?fv(this):b.errors.throwNotImplementedForSyntaxKindError(r.getKind())}},w9e=e=>Im(ld(SL(rG(HT(qT(gS(_S(Rh(WD(jT(zT(YT(UE(e)))))))))))))),yR=w9e(zg),F9e=e=>sc(Im(ld(SL(_S(J_(gS(Rh(WD(jT(sf(zT(_v(e))))))))))))),Dme=F9e(zg),MD=class extends yR{set(r){return io(yR.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 tG({node:this,index:r,structures:n,printStructure:(s,u)=>{a.printOverload(s,i,u)},getThisStructure:n7e,expectedSyntaxKind:b.SyntaxKind.MethodDeclaration})}getStructure(){let r=this.getImplementation()!=null,n=this.isOverload(),i=n&&r?Dme.prototype:yR.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(Y6(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 eL.isMethod(u)||eL.isGetAccessor(u)||eL.isSetAccessor(u)||eL.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 ND(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 ND(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 ND(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 ND(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 ND(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})),ND(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 MD)}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 MD)}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 ND(e,r){return JH({getIndexedChildren:()=>e.getMembersWithComments(),parent:e,...r})}var G9e=e=>yS(Ph(BE(aq(e)))),vR=G9e(Cl),xw=class extends vR{set(r){return io(vR.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(vR.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),Dw=class extends Lme{},B9e=e=>Im(ld(Mh(sc(q6(e))))),hR=B9e(zg),Cw=class extends hR{getName(){return"static"}isStatic(){return!0}set(r){return io(hR.prototype,this,r),this}getStructure(){return uo(hR.prototype,this,{kind:Oe.StructureKind.ClassStaticBlock})}},Aw=class extends zg{},U9e=e=>kh(Im(ld(rG(_S(YT(HT(e))))))),ER=U9e(zg),K9e=e=>J_(sc(Im(ld(_S(sf(_v(e))))))),Nme=K9e(zg),Lw=class extends ER{set(r){return io(ER.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 tG({node:this,index:r,structures:n,printStructure:(a,s)=>{i.printOverload(a,s)},getThisStructure:r7e,expectedSyntaxKind:b.SyntaxKind.Constructor})}getStructure(){let r=this.getImplementation()!=null,n=this.isOverload(),i=n&&r?Nme.prototype:ER.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}}}}},W9e=e=>Im(ld(qT(gS(_S(WD(YT(HT(UE(e))))))))),bR=W9e(zg),Nw=class extends bR{set(r){return io(bR.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(bR.prototype,this,{kind:Oe.StructureKind.GetAccessor})}},V9e=e=>Im(SL(Ph(qT(gS(_S(WD(sc(TL(XH(Rh($T(KE(UE(sf(e))))))))))))))),SR=V9e(zg),Iw=class extends SR{set(r){return io(SR.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(SR.prototype,this,{kind:Oe.StructureKind.Property})}},j9e=e=>Im(ld(qT(gS(_S(WD(YT(HT(UE(e))))))))),TR=j9e(zg),Pw=class extends TR{set(r){return io(TR.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(TR.prototype,this,{kind:Oe.StructureKind.SetAccessor})}},xR=XT(Tr),Ow=class extends xR{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}):f7e({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(xR.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(xR.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 nG(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 DR=Tr,kw=class extends DR{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=uv(i,a,m=>m===ac.NEWLINE||!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK);return uv(i,f,m=>m!==ac.NEWLINE&&m!==ac.CARRIAGE_RETURN)}}setDescription(r){let n=this.getTags(),i=this.getStart()+3,a=n.length>0?uv(this._sourceFile.getFullText(),n[0].getStart(),u=>u===ac.ASTERISK)-1:this.getEnd()-2;return E7e({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=$g(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,uv(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(DR.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(DR.prototype,this,{kind:Oe.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(r=>r.getStructure())})}},wc=class extends Tr{},Pme=Z6(wc),KT=class extends Pme{},Rw=class extends wc{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},Mw=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=_v(wc),lL=class extends Ome{},kme=gS(sf(lL)),ww=class extends kme{},Rme=XT(KT),Fw=class extends Rme{},Mme=J_(lL),Gw=class extends Mme{},Bw=class extends Tr{getAssertClause(){return this._getNodeFromCompilerNode(this.compilerNode.assertClause)}isMultiline(){var r;return(r=this.compilerNode.multiLine)!==null&&r!==void 0?r:!1}},Uw=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.")}},Kw=class extends wc{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Ww=class extends wc{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Vw=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},jw=class extends wc{getLiteral(){let r=this.compilerNode.literal;return this._getNodeFromCompilerNode(r)}},Hw=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.")}},H9e=e=>KE(Rh(EL(sc(mv(e))))),wme=H9e(wc),qw=class extends wme{getTypeNode(){return super.getTypeNode()}removeType(){throw new b.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},Jw=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(r){return this.getTypeNode().replaceWithText(r),this}},zw=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)}},$w=class extends wc{},Xw=class extends wc{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},q9e=e=>J_(KE(sc(Ph(BE(sf(mv(e))))))),CR=q9e(Cl),Yw=class extends CR{set(r){return io(CR.prototype,this,r),this}getStructure(){return uo(CR.prototype,this,{kind:Oe.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},Fme=nq(wc),Qw=class extends Fme{},Zw=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 AR=sf(mv(Tr)),eF=class extends AR{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():fv(this);function i(){let a=[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)];Bs({children:a})}}set(r){return io(AR.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(AR.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 rF=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.")}},tF=class extends KT{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},nF=class extends KT{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},iF=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},q_=class extends wc{},aF=class extends q_{},LR=Tr,bc=class extends LR{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(LR.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=$g(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(LR.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 uv(n,r,i=>i!==ac.ASTERISK&&!b.StringUtils.isWhitespaceCharCode(i))}var oF=class extends bc{},sF=class extends bc{},lF=class extends bc{},uF=class extends bc{},cF=class extends bc{},dF=class extends bc{},Wme=_v(q_),fF=class extends Wme{},pF=class extends bc{},mF=class extends Tr{},_F=class extends Tr{},gF=class extends Tr{},yF=class extends Tr{},vF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},hF=class extends Tr{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},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)}isPostfix(){return this.compilerNode.postfix}},SF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},TF=class extends bc{},Vme=oq(bc),xF=class extends Vme{},DF=class extends bc{},jme=oq(bc),CF=class extends jme{},AF=class extends bc{},LF=class extends bc{},NF=class extends bc{},Hme=nG(bc),IF=class extends Hme{},qme=nG(bc),PF=class extends qme{},OF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},uL=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),kF=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.")}},RF=class extends Tr{},zme=nG(bc),MF=class extends zme{},wF=class extends bc{},FF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},GF=class extends q_{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(r=>this._getNodeFromCompilerNode(r)):void 0}},BF=class extends bc{getTypeExpression(){let r=this.compilerNode.typeExpression;if(!(r!=null&&r.pos===r.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},UF=class extends bc{},KF=class extends q_{},WF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},VF=class extends Tr{remove(){Nh({children:[this],getSiblingFormatting:()=>El.Newline})}},J9e=e=>ld(yS(sc(Ph(BE(sf(mv(e))))))),NR=J9e(Cl),jF=class extends NR{set(r){return io(NR.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(NR.prototype,this,{kind:Oe.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(r=>r.getStructure())})}},z9e=e=>sc($T(UE(e))),IR=z9e(Tr),HF=class extends IR{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(IR.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(IR.prototype,this,{kind:Oe.StructureKind.EnumMember,value:void 0})}},qF=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 fv(i);return this;function a(s){return n[ku(s,n.length-1)]}}},wE=class extends Tr{remove(){m7e(this)}},$9e=e=>J_(Im(sc(_v(e)))),PR=$9e(wE),JF=class extends PR{set(r){return io(PR.prototype,this,r),this}getStructure(){return uo(PR.prototype,this,{kind:Oe.StructureKind.CallSignature})}},zF=class extends wE{},X9e=e=>J_(Im(sc(_v(e)))),OR=X9e(wE),$F=class extends OR{set(r){return io(OR.prototype,this,r),this}getStructure(){return uo(OR.prototype,this,{kind:Oe.StructureKind.ConstructSignature})}},Y9e=e=>rq(Im(sc(TL(sf(e))))),kR=Y9e(wE),XF=class extends kR{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(kR.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(kR.prototype,this,{kind:Oe.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:r.getText()})}},Q9e=e=>nq(ld(ape(ZH(J_(sc(Ph(yS(BE(sf(mv(e))))))))))),RR=Q9e(Cl),YF=class extends RR{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(RR.prototype,this,r),this}getStructure(){return uo(RR.prototype,this,{kind:Oe.StructureKind.Interface})}},Z9e=e=>Im(sc(Rh(J_(_v(UE(e)))))),MR=Z9e(wE),QF=class extends MR{set(r){return io(MR.prototype,this,r),this}getStructure(){return uo(MR.prototype,this,{kind:Oe.StructureKind.MethodSignature})}},eUe=e=>Im(sc(TL(Rh($T(KE(UE(sf(e)))))))),wR=eUe(wE),ZF=class extends wR{set(r){return io(wR.prototype,this,r),this}getStructure(){return uo(wR.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 iG(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 FR=mv(Tr),e6=class extends FR{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=$g(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(FR.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(FR.prototype,this,{kind:Oe.StructureKind.JsxAttribute,initializer:r?.getText()})}},rUe=e=>iG(e),$me=rUe(Tr),r6=class extends $me{},t6=class extends oc{},GR=sd,n6=class extends GR{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(GR.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(GR.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=xL(EL(oc)),i6=class extends Xme{},a6=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)}},tUe=e=>sq(iG(e)),Yme=tUe(oc),o6=class extends Yme{},s6=class extends oc{},nUe=e=>sq(iG(e)),BR=nUe(sd),l6=class extends BR{set(r){return io(BR.prototype,this,r),this}getStructure(){return uo(BR.prototype,this,{kind:Oe.StructureKind.JsxSelfClosingElement})}},UR=ud(Tr),u6=class extends UR{remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(UR.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}getStructure(){return uo(UR.prototype,this,{kind:Oe.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},Qme=UD(Tr),c6=class extends Qme{containsOnlyTriviaWhiteSpaces(){let r=this.compilerNode;return typeof r.containsOnlyWhiteSpaces=="boolean"?r.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},Zme=cS,d6=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,f6=class extends e_e{getLiteralValue(){return lq(this)}setLiteralValue(r){return t_e(this,r)}},r_e=sd,p6=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,m6=class extends n_e{},i_e=cS,_6=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,g6=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,y6=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,v6=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)}},h6=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,E6=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=UD(Tr),b6=class extends u_e{},c_e=UD(Tr),S6=class extends c_e{},d_e=ud(Tr),T6=class extends d_e{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},f_e=UD(Tr),x6=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),D6=class extends p_e{},m_e=uq(kh(pv(sd))),C6=class extends m_e{getImplementations(){return this._context.languageService.getImplementations(this)}},__e=uq(kh(pv(Tr))),A6=class extends __e{},L6=class extends Tr{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},iUe=e=>YH(XH(KE($T(X6(e))))),KR=iUe(Tr),N6=class extends KR{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():fv(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(KR.prototype,this,r),this}getStructure(){return uo(KR.prototype,this,{kind:Oe.StructureKind.VariableDeclaration})}},g_e=sf(Tr),I6=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)}},P6=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))}},O6=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 uL(r))}},wD=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 wD(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 k6=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))}},R6=class extends k6{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},cL=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],cL.prototype,"getChanges",null);var dv=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 wD(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 wD(r)}getOriginalFileName(){return this.compilerObject.originalFileName}};co([b.Memoize],dv.prototype,"getTextSpan",null);co([b.Memoize],dv.prototype,"getNode",null);co([b.Memoize],dv.prototype,"getOriginalTextSpan",null);var FD=class extends dv{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],FD.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 dL=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()}},M6=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}},fL=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 M6(this._context,r))}};co([b.Memoize],fL.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 pL=class extends dv{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],pL.prototype,"getDisplayParts",null);var w6=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)}},mL=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],mL.prototype,"getEdits",null);var _L=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],_L.prototype,"getDefinition",null);var gL=class extends FD{constructor(r,n){super(r,n)}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],gL.prototype,"getDisplayParts",null);var F6=class extends dv{constructor(r,n){super(r,n)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},G6=class extends F6{constructor(r,n){super(r,n)}isDefinition(){return this.compilerObject.isDefinition}},B6=class extends dv{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},U6=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},yL=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}},K6=class{constructor(r){this._context=r.context,this._configFileParsingDiagnostics=r.configFileParsingDiagnostics,this._typeChecker=new yL(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 w6(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()}},W6=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 K6({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 pL(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 B6(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 fL(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 mL(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 cL(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 R6(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),RBe(r,this._context.manipulationSettings),r._filled=!0),r}_getFilledUserPreferences(r){return Object.assign(this._context.getUserPreferences(),r)}},vL=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}},V6=class extends vL{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}},hL=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 hL(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 hL(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()}},aUe={[b.SyntaxKind.SourceFile]:kE,[b.SyntaxKind.ArrayBindingPattern]:rM,[b.SyntaxKind.ArrayLiteralExpression]:aM,[b.SyntaxKind.ArrayType]:Rw,[b.SyntaxKind.ArrowFunction]:Ew,[b.SyntaxKind.AsExpression]:oM,[b.SyntaxKind.AssertClause]:rw,[b.SyntaxKind.AssertEntry]:tw,[b.SyntaxKind.AwaitExpression]:sM,[b.SyntaxKind.BigIntLiteral]:d6,[b.SyntaxKind.BindingElement]:tM,[b.SyntaxKind.BinaryExpression]:iL,[b.SyntaxKind.Block]:kM,[b.SyntaxKind.BreakStatement]:RM,[b.SyntaxKind.CallExpression]:lM,[b.SyntaxKind.CallSignature]:JF,[b.SyntaxKind.CaseBlock]:MM,[b.SyntaxKind.CaseClause]:wM,[b.SyntaxKind.CatchClause]:FM,[b.SyntaxKind.ClassDeclaration]:xw,[b.SyntaxKind.ClassExpression]:Dw,[b.SyntaxKind.ClassStaticBlockDeclaration]:Cw,[b.SyntaxKind.ConditionalType]:Mw,[b.SyntaxKind.Constructor]:Lw,[b.SyntaxKind.ConstructorType]:ww,[b.SyntaxKind.ConstructSignature]:$F,[b.SyntaxKind.ContinueStatement]:BM,[b.SyntaxKind.CommaListExpression]:uM,[b.SyntaxKind.ComputedPropertyName]:D6,[b.SyntaxKind.ConditionalExpression]:cM,[b.SyntaxKind.DebuggerStatement]:UM,[b.SyntaxKind.Decorator]:Ow,[b.SyntaxKind.DefaultClause]:KM,[b.SyntaxKind.DeleteExpression]:dM,[b.SyntaxKind.DoStatement]:WM,[b.SyntaxKind.ElementAccessExpression]:oL,[b.SyntaxKind.EmptyStatement]:VM,[b.SyntaxKind.EnumDeclaration]:jF,[b.SyntaxKind.EnumMember]:HF,[b.SyntaxKind.ExportAssignment]:nw,[b.SyntaxKind.ExportDeclaration]:iw,[b.SyntaxKind.ExportSpecifier]:aw,[b.SyntaxKind.ExpressionWithTypeArguments]:Fw,[b.SyntaxKind.ExpressionStatement]:jM,[b.SyntaxKind.ExternalModuleReference]:ow,[b.SyntaxKind.QualifiedName]:L6,[b.SyntaxKind.ForInStatement]:HM,[b.SyntaxKind.ForOfStatement]:qM,[b.SyntaxKind.ForStatement]:JM,[b.SyntaxKind.FunctionDeclaration]:bw,[b.SyntaxKind.FunctionExpression]:Sw,[b.SyntaxKind.FunctionType]:Gw,[b.SyntaxKind.GetAccessor]:Nw,[b.SyntaxKind.HeritageClause]:qF,[b.SyntaxKind.Identifier]:C6,[b.SyntaxKind.IfStatement]:zM,[b.SyntaxKind.ImportClause]:sw,[b.SyntaxKind.ImportDeclaration]:lw,[b.SyntaxKind.ImportEqualsDeclaration]:uw,[b.SyntaxKind.ImportSpecifier]:cw,[b.SyntaxKind.ImportType]:Uw,[b.SyntaxKind.ImportTypeAssertionContainer]:Bw,[b.SyntaxKind.IndexedAccessType]:Kw,[b.SyntaxKind.IndexSignature]:XF,[b.SyntaxKind.InferType]:Ww,[b.SyntaxKind.InterfaceDeclaration]:YF,[b.SyntaxKind.IntersectionType]:Vw,[b.SyntaxKind.JSDocAllType]:aF,[b.SyntaxKind.JSDocAugmentsTag]:oF,[b.SyntaxKind.JSDocAuthorTag]:sF,[b.SyntaxKind.JSDocCallbackTag]:lF,[b.SyntaxKind.JSDocClassTag]:uF,[b.SyntaxKind.JSDocDeprecatedTag]:cF,[b.SyntaxKind.JSDocEnumTag]:dF,[b.SyntaxKind.JSDocFunctionType]:fF,[b.SyntaxKind.JSDocImplementsTag]:pF,[b.SyntaxKind.JSDocLink]:mF,[b.SyntaxKind.JSDocLinkCode]:_F,[b.SyntaxKind.JSDocLinkPlain]:gF,[b.SyntaxKind.JSDocMemberName]:yF,[b.SyntaxKind.JSDocNamepathType]:vF,[b.SyntaxKind.JSDocNameReference]:hF,[b.SyntaxKind.JSDocNonNullableType]:EF,[b.SyntaxKind.JSDocNullableType]:bF,[b.SyntaxKind.JSDocOptionalType]:SF,[b.SyntaxKind.JSDocOverrideTag]:TF,[b.SyntaxKind.JSDocParameterTag]:xF,[b.SyntaxKind.JSDocPrivateTag]:DF,[b.SyntaxKind.JSDocPropertyTag]:CF,[b.SyntaxKind.JSDocProtectedTag]:AF,[b.SyntaxKind.JSDocPublicTag]:LF,[b.SyntaxKind.JSDocReturnTag]:IF,[b.SyntaxKind.JSDocReadonlyTag]:NF,[b.SyntaxKind.JSDocSeeTag]:PF,[b.SyntaxKind.JSDocSignature]:OF,[b.SyntaxKind.JSDocTag]:UF,[b.SyntaxKind.JSDocTemplateTag]:kF,[b.SyntaxKind.JSDocText]:RF,[b.SyntaxKind.JSDocThisTag]:MF,[b.SyntaxKind.JSDocTypeExpression]:FF,[b.SyntaxKind.JSDocTypeLiteral]:GF,[b.SyntaxKind.JSDocTypeTag]:BF,[b.SyntaxKind.JSDocTypedefTag]:wF,[b.SyntaxKind.JSDocUnknownType]:KF,[b.SyntaxKind.JSDocVariadicType]:WF,[b.SyntaxKind.JsxAttribute]:e6,[b.SyntaxKind.JsxClosingElement]:r6,[b.SyntaxKind.JsxClosingFragment]:t6,[b.SyntaxKind.JsxElement]:n6,[b.SyntaxKind.JsxExpression]:i6,[b.SyntaxKind.JsxFragment]:a6,[b.SyntaxKind.JsxOpeningElement]:o6,[b.SyntaxKind.JsxOpeningFragment]:s6,[b.SyntaxKind.JsxSelfClosingElement]:l6,[b.SyntaxKind.JsxSpreadAttribute]:u6,[b.SyntaxKind.JsxText]:c6,[b.SyntaxKind.LabeledStatement]:$M,[b.SyntaxKind.LiteralType]:jw,[b.SyntaxKind.MappedType]:Hw,[b.SyntaxKind.MetaProperty]:pM,[b.SyntaxKind.MethodDeclaration]:MD,[b.SyntaxKind.MethodSignature]:QF,[b.SyntaxKind.ModuleBlock]:dw,[b.SyntaxKind.ModuleDeclaration]:fw,[b.SyntaxKind.NamedExports]:pw,[b.SyntaxKind.NamedImports]:mw,[b.SyntaxKind.NamedTupleMember]:qw,[b.SyntaxKind.NamespaceExport]:_w,[b.SyntaxKind.NamespaceImport]:gw,[b.SyntaxKind.NewExpression]:mM,[b.SyntaxKind.NonNullExpression]:_M,[b.SyntaxKind.NotEmittedStatement]:XM,[b.SyntaxKind.NoSubstitutionTemplateLiteral]:v6,[b.SyntaxKind.NumericLiteral]:_6,[b.SyntaxKind.ObjectBindingPattern]:nM,[b.SyntaxKind.ObjectLiteralExpression]:yM,[b.SyntaxKind.OmittedExpression]:bM,[b.SyntaxKind.Parameter]:Tw,[b.SyntaxKind.ParenthesizedExpression]:SM,[b.SyntaxKind.ParenthesizedType]:Jw,[b.SyntaxKind.PartiallyEmittedExpression]:TM,[b.SyntaxKind.PostfixUnaryExpression]:xM,[b.SyntaxKind.PrefixUnaryExpression]:DM,[b.SyntaxKind.PrivateIdentifier]:A6,[b.SyntaxKind.PropertyAccessExpression]:sL,[b.SyntaxKind.PropertyAssignment]:vM,[b.SyntaxKind.PropertyDeclaration]:Iw,[b.SyntaxKind.PropertySignature]:ZF,[b.SyntaxKind.RegularExpressionLiteral]:g6,[b.SyntaxKind.ReturnStatement]:YM,[b.SyntaxKind.SetAccessor]:Pw,[b.SyntaxKind.ShorthandPropertyAssignment]:hM,[b.SyntaxKind.SpreadAssignment]:EM,[b.SyntaxKind.SpreadElement]:CM,[b.SyntaxKind.StringLiteral]:y6,[b.SyntaxKind.SwitchStatement]:QM,[b.SyntaxKind.SyntaxList]:QR,[b.SyntaxKind.TaggedTemplateExpression]:h6,[b.SyntaxKind.TemplateExpression]:E6,[b.SyntaxKind.TemplateHead]:b6,[b.SyntaxKind.TemplateLiteralType]:zw,[b.SyntaxKind.TemplateMiddle]:S6,[b.SyntaxKind.TemplateSpan]:T6,[b.SyntaxKind.TemplateTail]:x6,[b.SyntaxKind.ThisType]:$w,[b.SyntaxKind.ThrowStatement]:ZM,[b.SyntaxKind.TryStatement]:ew,[b.SyntaxKind.TupleType]:Xw,[b.SyntaxKind.TypeAliasDeclaration]:Yw,[b.SyntaxKind.TypeAssertionExpression]:NM,[b.SyntaxKind.TypeLiteral]:Qw,[b.SyntaxKind.TypeOperator]:Zw,[b.SyntaxKind.TypeParameter]:eF,[b.SyntaxKind.TypePredicate]:rF,[b.SyntaxKind.TypeQuery]:tF,[b.SyntaxKind.TypeReference]:nF,[b.SyntaxKind.UnionType]:iF,[b.SyntaxKind.VariableDeclaration]:N6,[b.SyntaxKind.VariableDeclarationList]:I6,[b.SyntaxKind.VariableStatement]:yw,[b.SyntaxKind.JSDoc]:kw,[b.SyntaxKind.TypeOfExpression]:IM,[b.SyntaxKind.WhileStatement]:vw,[b.SyntaxKind.WithStatement]:hw,[b.SyntaxKind.YieldExpression]:OM,[b.SyntaxKind.SemicolonToken]:Tr,[b.SyntaxKind.AnyKeyword]:oc,[b.SyntaxKind.BooleanKeyword]:oc,[b.SyntaxKind.FalseKeyword]:p6,[b.SyntaxKind.ImportKeyword]:fM,[b.SyntaxKind.InferKeyword]:Tr,[b.SyntaxKind.NeverKeyword]:Tr,[b.SyntaxKind.NullKeyword]:m6,[b.SyntaxKind.NumberKeyword]:oc,[b.SyntaxKind.ObjectKeyword]:oc,[b.SyntaxKind.StringKeyword]:oc,[b.SyntaxKind.SymbolKeyword]:oc,[b.SyntaxKind.SuperKeyword]:AM,[b.SyntaxKind.ThisKeyword]:LM,[b.SyntaxKind.TrueKeyword]:f6,[b.SyntaxKind.UndefinedKeyword]:oc,[b.SyntaxKind.VoidExpression]:PM},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)b7e(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?$g(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 GM(this.context,r,n):p_.isCommentClassElement(r)?new Aw(this.context,r,n):p_.isCommentTypeElement(r)?new zF(this.context,r,n):p_.isCommentObjectLiteralElement(r)?new gM(this.context,r,n):p_.isCommentEnumMember(r)?new VF(this.context,r,n):b.errors.throwNotImplementedForNeverValueError(r);let u=aUe[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 U6(r))}getType(r){return(r.flags&b.TypeFlags.TypeParameter)===b.TypeFlags.TypeParameter?this.getTypeParameter(r):this.typeCache.getOrCreate(r,()=>new vL(this.context,r))}getTypeParameter(r){return this.typeParameterCache.getOrCreate(r,()=>new V6(this.context,r))}getSignature(r){return this.signatureCache.getOrCreate(r,()=>new P6(this.context,r))}getSymbol(r){return this.symbolCache.getOrCreate(r,()=>new O6(this.context,r))}getDefinitionInfo(r){return this.definitionInfoCache.getOrCreate(r,()=>new FD(this.context,r))}getDocumentSpan(r){return this.documentSpanCache.getOrCreate(r,()=>new dv(this.context,r))}getReferencedSymbolEntry(r){return this.referencedSymbolEntryCache.getOrCreate(r,()=>new G6(this.context,r))}getReferencedSymbol(r){return this.referencedSymbolCache.getOrCreate(r,()=>new _L(this.context,r))}getReferencedSymbolDefinitionInfo(r){return this.referencedSymbolDefinitionInfoCache.getOrCreate(r,()=>new gL(this.context,r))}getDiagnostic(r){return this.diagnosticCache.getOrCreate(r,()=>r.start!=null?new dL(this.context,r):new WT(this.context,r))}getDiagnosticWithLocation(r){return this.diagnosticCache.getOrCreate(r,()=>new dL(this.context,r))}getDiagnosticMessageChain(r){return this.diagnosticMessageChainCache.getOrCreate(r,()=>new pS(r))}getJSDocTagInfo(r){return this.jsDocTagInfoCache.getOrCreate(r,()=>new uL(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 GD=class{constructor(r){this.logger=new cj,this.manipulationSettings=new VR,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 W6({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 yL(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 WR.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],GD.prototype,"getSourceFileContainer",null);co([b.Memoize],GD.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 GD({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 oUe(e,r={}){let{compilerOptions:n={},sourceFile:i,typeChecker:a}=r,s=new b.CompilerOptionsContainer;s.set(n);let u=new GD({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 sUe=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(": "),rL(n,p))}n.newLine()}}}static objectType(r){return n=>{n.write("{"),lUe(r)&&n.indent(()=>{sUe.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=>{rL(i,r),i.spaceIfLastNot().write("as "),rL(i,n)}}static returnStatement(r){return n=>{n.write("return "),n.hangingIndentUnlessBlock(()=>{rL(n,r),n.write(";")})}}};function Ofe(e,r){return n=>{uUe(n,` ${e} `,r)}}function lUe(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 uUe(e,r,n){for(let i=0;i<n.length;i++)e.conditionalWrite(i>0,r),rL(e,n[i])}function rL(e,r){r instanceof Function?r(e):e.write(r.toString())}var{InvalidOperationError:cUe,FileNotFoundError:dUe,ArgumentError:fUe,ArgumentNullOrWhitespaceError:pUe,ArgumentOutOfRangeError:mUe,ArgumentTypeError:_Ue,BaseError:gUe,DirectoryNotFoundError:yUe,NotImplementedError:vUe,NotSupportedError:hUe,PathNotFoundError:EUe}=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 WR.default}});Oe.AbstractableNode=gS;Oe.AmbientableNode=Ph;Oe.ArgumentError=fUe;Oe.ArgumentNullOrWhitespaceError=pUe;Oe.ArgumentOutOfRangeError=mUe;Oe.ArgumentTypeError=_Ue;Oe.ArgumentedNode=zH;Oe.ArrayBindingPattern=rM;Oe.ArrayDestructuringAssignment=NH;Oe.ArrayDestructuringAssignmentBase=mpe;Oe.ArrayLiteralExpression=aM;Oe.ArrayTypeNode=Rw;Oe.ArrowFunction=Ew;Oe.ArrowFunctionBase=Sme;Oe.AsExpression=oM;Oe.AsExpressionBase=_pe;Oe.AssertClause=rw;Oe.AssertClauseBase=cme;Oe.AssertEntry=tw;Oe.AssertEntryBase=lR;Oe.AssertionKeyNamedNode=spe;Oe.AssignmentExpression=aL;Oe.AssignmentExpressionBase=ppe;Oe.AsyncableNode=jT;Oe.AwaitExpression=sM;Oe.AwaitExpressionBase=gpe;Oe.AwaitableNode=Qfe;Oe.BaseError=gUe;Oe.BaseExpressionedNode=VD;Oe.BigIntLiteral=d6;Oe.BigIntLiteralBase=Zme;Oe.BinaryExpression=iL;Oe.BinaryExpressionBase=fpe;Oe.BindingElement=tM;Oe.BindingElementBase=dpe;Oe.BindingNamedNode=X6;Oe.Block=kM;Oe.BlockBase=Hpe;Oe.BodiedNode=q6;Oe.BodyableNode=HT;Oe.BreakStatement=RM;Oe.CallExpression=lM;Oe.CallExpressionBase=ype;Oe.CallSignatureDeclaration=JF;Oe.CallSignatureDeclarationBase=PR;Oe.CaseBlock=MM;Oe.CaseBlockBase=qpe;Oe.CaseClause=wM;Oe.CaseClauseBase=Jpe;Oe.CatchClause=FM;Oe.CatchClauseBase=zpe;Oe.ChildOrderableNode=Im;Oe.ClassDeclaration=xw;Oe.ClassDeclarationBase=vR;Oe.ClassElement=zg;Oe.ClassExpression=Dw;Oe.ClassExpressionBase=Lme;Oe.ClassLikeDeclarationBase=aq;Oe.ClassLikeDeclarationBaseSpecific=Cme;Oe.ClassStaticBlockDeclaration=Cw;Oe.ClassStaticBlockDeclarationBase=hR;Oe.CodeAction=k6;Oe.CodeFixAction=R6;Oe.CombinedCodeActions=cL;Oe.CommaListExpression=uM;Oe.CommaListExpressionBase=vpe;Oe.CommentClassElement=Aw;Oe.CommentEnumMember=VF;Oe.CommentObjectLiteralElement=gM;Oe.CommentRange=YR;Oe.CommentStatement=GM;Oe.CommentTypeElement=zF;Oe.CommonIdentifierBase=uq;Oe.CompilerCommentClassElement=HR;Oe.CompilerCommentEnumMember=zR;Oe.CompilerCommentNode=sS;Oe.CompilerCommentObjectLiteralElement=JR;Oe.CompilerCommentStatement=jR;Oe.CompilerCommentTypeElement=qR;Oe.ComputedPropertyName=D6;Oe.ComputedPropertyNameBase=p_e;Oe.ConditionalExpression=cM;Oe.ConditionalExpressionBase=hpe;Oe.ConditionalTypeNode=Mw;Oe.ConstructSignatureDeclaration=$F;Oe.ConstructSignatureDeclarationBase=OR;Oe.ConstructorDeclaration=Lw;Oe.ConstructorDeclarationBase=ER;Oe.ConstructorDeclarationOverloadBase=Nme;Oe.ConstructorTypeNode=ww;Oe.ConstructorTypeNodeBase=kme;Oe.ContinueStatement=BM;Oe.DebuggerStatement=UM;Oe.DebuggerStatementBase=$pe;Oe.DecoratableNode=qT;Oe.Decorator=Ow;Oe.DecoratorBase=xR;Oe.DefaultClause=KM;Oe.DefaultClauseBase=Xpe;Oe.DefinitionInfo=FD;Oe.DeleteExpression=dM;Oe.DeleteExpressionBase=Epe;Oe.Diagnostic=WT;Oe.DiagnosticMessageChain=pS;Oe.DiagnosticWithLocation=dL;Oe.Directory=OE;Oe.DirectoryEmitResult=hL;Oe.DirectoryNotFoundError=yUe;Oe.DoStatement=WM;Oe.DoStatementBase=Ype;Oe.DocumentSpan=dv;Oe.DotDotDotTokenableNode=EL;Oe.ElementAccessExpression=oL;Oe.ElementAccessExpressionBase=bpe;Oe.EmitOutput=fL;Oe.EmitResult=VT;Oe.EmptyStatement=VM;Oe.EmptyStatementBase=Qpe;Oe.EnumDeclaration=jF;Oe.EnumDeclarationBase=NR;Oe.EnumMember=HF;Oe.EnumMemberBase=IR;Oe.ExclamationTokenableNode=XH;Oe.ExportAssignment=nw;Oe.ExportAssignmentBase=kH;Oe.ExportDeclaration=iw;Oe.ExportDeclarationBase=uR;Oe.ExportGetableNode=YH;Oe.ExportSpecifier=aw;Oe.ExportSpecifierBase=RH;Oe.ExportableNode=BE;Oe.Expression=oc;Oe.ExpressionStatement=jM;Oe.ExpressionStatementBase=Zpe;Oe.ExpressionWithTypeArguments=Fw;Oe.ExpressionWithTypeArgumentsBase=Rme;Oe.ExpressionableNode=xL;Oe.ExpressionedNode=ud;Oe.ExtendsClauseableNode=ape;Oe.ExternalModuleReference=ow;Oe.ExternalModuleReferenceBase=dme;Oe.FalseLiteral=p6;Oe.FalseLiteralBase=r_e;Oe.FileNotFoundError=dUe;Oe.FileReference=OD;Oe.FileTextChanges=fS;Oe.ForInStatement=HM;Oe.ForInStatementBase=eme;Oe.ForOfStatement=qM;Oe.ForOfStatementBase=rme;Oe.ForStatement=JM;Oe.ForStatementBase=tme;Oe.FunctionDeclaration=bw;Oe.FunctionDeclarationBase=_R;Oe.FunctionDeclarationOverloadBase=Tme;Oe.FunctionExpression=Sw;Oe.FunctionExpressionBase=xme;Oe.FunctionLikeDeclaration=YT;Oe.FunctionOrConstructorTypeNodeBase=lL;Oe.FunctionOrConstructorTypeNodeBaseBase=Ome;Oe.FunctionTypeNode=Gw;Oe.FunctionTypeNodeBase=Mme;Oe.GeneratorableNode=zT;Oe.GetAccessorDeclaration=Nw;Oe.GetAccessorDeclarationBase=bR;Oe.HeritageClause=qF;Oe.HeritageClauseableNode=ZH;Oe.Identifier=C6;Oe.IdentifierBase=m_e;Oe.IfStatement=zM;Oe.IfStatementBase=nme;Oe.ImplementationLocation=pL;Oe.ImplementsClauseableNode=ope;Oe.ImportClause=sw;Oe.ImportClauseBase=fme;Oe.ImportDeclaration=lw;Oe.ImportDeclarationBase=cR;Oe.ImportEqualsDeclaration=uw;Oe.ImportEqualsDeclarationBase=mme;Oe.ImportExpression=fM;Oe.ImportExpressionBase=Spe;Oe.ImportExpressionedNode=p9e;Oe.ImportSpecifier=cw;Oe.ImportSpecifierBase=dR;Oe.ImportTypeAssertionContainer=Bw;Oe.ImportTypeNode=Uw;Oe.IndexSignatureDeclaration=XF;Oe.IndexSignatureDeclarationBase=kR;Oe.IndexedAccessTypeNode=Kw;Oe.InferTypeNode=Ww;Oe.InitializerExpressionGetableNode=$6;Oe.InitializerExpressionableNode=$T;Oe.InterfaceDeclaration=YF;Oe.InterfaceDeclarationBase=RR;Oe.IntersectionTypeNode=Vw;Oe.InvalidOperationError=cUe;Oe.IterationStatement=dS;Oe.JSDoc=kw;Oe.JSDocAllType=aF;Oe.JSDocAugmentsTag=oF;Oe.JSDocAuthorTag=sF;Oe.JSDocBase=DR;Oe.JSDocCallbackTag=lF;Oe.JSDocClassTag=uF;Oe.JSDocDeprecatedTag=cF;Oe.JSDocEnumTag=dF;Oe.JSDocFunctionType=fF;Oe.JSDocFunctionTypeBase=Wme;Oe.JSDocImplementsTag=pF;Oe.JSDocLink=mF;Oe.JSDocLinkCode=_F;Oe.JSDocLinkPlain=gF;Oe.JSDocMemberName=yF;Oe.JSDocNameReference=hF;Oe.JSDocNamepathType=vF;Oe.JSDocNonNullableType=EF;Oe.JSDocNullableType=bF;Oe.JSDocOptionalType=SF;Oe.JSDocOverrideTag=TF;Oe.JSDocParameterTag=xF;Oe.JSDocParameterTagBase=Vme;Oe.JSDocPrivateTag=DF;Oe.JSDocPropertyLikeTag=oq;Oe.JSDocPropertyTag=CF;Oe.JSDocPropertyTagBase=jme;Oe.JSDocProtectedTag=AF;Oe.JSDocPublicTag=LF;Oe.JSDocReadonlyTag=NF;Oe.JSDocReturnTag=IF;Oe.JSDocReturnTagBase=Hme;Oe.JSDocSeeTag=PF;Oe.JSDocSeeTagBase=qme;Oe.JSDocSignature=OF;Oe.JSDocTag=bc;Oe.JSDocTagBase=LR;Oe.JSDocTagInfo=uL;Oe.JSDocTemplateTag=kF;Oe.JSDocTemplateTagBase=Jme;Oe.JSDocText=RF;Oe.JSDocThisTag=MF;Oe.JSDocThisTagBase=zme;Oe.JSDocType=q_;Oe.JSDocTypeExpression=FF;Oe.JSDocTypeExpressionableTag=nG;Oe.JSDocTypeLiteral=GF;Oe.JSDocTypeParameteredTag=Ime;Oe.JSDocTypeTag=BF;Oe.JSDocTypedefTag=wF;Oe.JSDocUnknownTag=UF;Oe.JSDocUnknownType=KF;Oe.JSDocVariadicType=WF;Oe.JSDocableNode=sc;Oe.JsxAttribute=e6;Oe.JsxAttributeBase=FR;Oe.JsxAttributedNode=sq;Oe.JsxClosingElement=r6;Oe.JsxClosingElementBase=$me;Oe.JsxClosingFragment=t6;Oe.JsxElement=n6;Oe.JsxElementBase=GR;Oe.JsxExpression=i6;Oe.JsxExpressionBase=Xme;Oe.JsxFragment=a6;Oe.JsxOpeningElement=o6;Oe.JsxOpeningElementBase=Yme;Oe.JsxOpeningFragment=s6;Oe.JsxSelfClosingElement=l6;Oe.JsxSelfClosingElementBase=BR;Oe.JsxSpreadAttribute=u6;Oe.JsxSpreadAttributeBase=UR;Oe.JsxTagNamedNode=iG;Oe.JsxText=c6;Oe.JsxTextBase=Qme;Oe.LabeledStatement=$M;Oe.LabeledStatementBase=ime;Oe.LanguageService=W6;Oe.LeftHandSideExpression=RD;Oe.LeftHandSideExpressionedNode=XT;Oe.LiteralExpression=cS;Oe.LiteralExpressionBase=Tpe;Oe.LiteralLikeNode=UD;Oe.LiteralTypeNode=jw;Oe.ManipulationError=XR;Oe.ManipulationSettingsContainer=VR;Oe.MappedTypeNode=Hw;Oe.MemberExpression=BT;Oe.MemoryEmitResult=w6;Oe.MetaProperty=pM;Oe.MetaPropertyBase=xpe;Oe.MethodDeclaration=MD;Oe.MethodDeclarationBase=yR;Oe.MethodDeclarationOverloadBase=Dme;Oe.MethodSignature=QF;Oe.MethodSignatureBase=MR;Oe.ModifierableNode=sf;Oe.ModuleBlock=dw;Oe.ModuleBlockBase=_me;Oe.ModuleChildableNode=yS;Oe.ModuleDeclaration=fw;Oe.ModuleDeclarationBase=fR;Oe.ModuleNamedNode=lpe;Oe.ModuledNode=eq;Oe.NameableNode=Y6;Oe.NamedExports=pw;Oe.NamedExportsBase=gme;Oe.NamedImports=mw;Oe.NamedImportsBase=yme;Oe.NamedNode=mv;Oe.NamedNodeBase=KD;Oe.NamedTupleMember=qw;Oe.NamedTupleMemberBase=wme;Oe.NamespaceExport=_w;Oe.NamespaceExportBase=vme;Oe.NamespaceImport=gw;Oe.NamespaceImportBase=hme;Oe.NewExpression=mM;Oe.NewExpressionBase=Dpe;Oe.NoSubstitutionTemplateLiteral=v6;Oe.NoSubstitutionTemplateLiteralBase=s_e;Oe.Node=Tr;Oe.NodeWithTypeArguments=KT;Oe.NodeWithTypeArgumentsBase=Pme;Oe.NonNullExpression=_M;Oe.NonNullExpressionBase=Cpe;Oe.NotEmittedStatement=XM;Oe.NotEmittedStatementBase=ame;Oe.NotImplementedError=vUe;Oe.NotSupportedError=hUe;Oe.NullLiteral=m6;Oe.NullLiteralBase=n_e;Oe.NumericLiteral=_6;Oe.NumericLiteralBase=i_e;Oe.ObjectBindingPattern=nM;Oe.ObjectDestructuringAssignment=IH;Oe.ObjectDestructuringAssignmentBase=Ape;Oe.ObjectLiteralElement=UT;Oe.ObjectLiteralExpression=yM;Oe.ObjectLiteralExpressionBase=Lpe;Oe.OmittedExpression=bM;Oe.OmittedExpressionBase=Npe;Oe.OutputFile=M6;Oe.OverloadableNode=rG;Oe.OverrideableNode=SL;Oe.ParameterDeclaration=Tw;Oe.ParameterDeclarationBase=gR;Oe.ParameteredNode=upe;Oe.ParenthesizedExpression=SM;Oe.ParenthesizedExpressionBase=Ipe;Oe.ParenthesizedTypeNode=Jw;Oe.PartiallyEmittedExpression=TM;Oe.PartiallyEmittedExpressionBase=Ppe;Oe.PathNotFoundError=EUe;Oe.PostfixUnaryExpression=xM;Oe.PostfixUnaryExpressionBase=Ope;Oe.PrefixUnaryExpression=DM;Oe.PrefixUnaryExpressionBase=kpe;Oe.PrimaryExpression=sd;Oe.PrivateIdentifier=A6;Oe.PrivateIdentifierBase=__e;Oe.Program=K6;Oe.Project=KH;Oe.PropertyAccessExpression=sL;Oe.PropertyAccessExpressionBase=Rpe;Oe.PropertyAssignment=vM;Oe.PropertyAssignmentBase=aR;Oe.PropertyDeclaration=Iw;Oe.PropertyDeclarationBase=SR;Oe.PropertyNamedNode=UE;Oe.PropertySignature=ZF;Oe.PropertySignatureBase=wR;Oe.QualifiedName=L6;Oe.QuestionDotTokenableNode=Q6;Oe.QuestionTokenableNode=Rh;Oe.ReadonlyableNode=TL;Oe.RefactorEditInfo=mL;Oe.ReferenceEntry=F6;Oe.ReferenceFindableNode=kh;Oe.ReferencedSymbol=_L;Oe.ReferencedSymbolDefinitionInfo=gL;Oe.ReferencedSymbolEntry=G6;Oe.RegularExpressionLiteral=g6;Oe.RegularExpressionLiteralBase=a_e;Oe.RenameLocation=B6;Oe.RenameableNode=pv;Oe.ReturnStatement=YM;Oe.ReturnStatementBase=ome;Oe.ReturnTypedNode=rq;Oe.ScopeableNode=cpe;Oe.ScopedNode=_S;Oe.SetAccessorDeclaration=Pw;Oe.SetAccessorDeclarationBase=TR;Oe.ShorthandPropertyAssignment=hM;Oe.ShorthandPropertyAssignmentBase=oR;Oe.Signature=P6;Oe.SignaturedDeclaration=_v;Oe.SourceFile=kE;Oe.SourceFileBase=pR;Oe.SpreadAssignment=EM;Oe.SpreadAssignmentBase=sR;Oe.SpreadElement=CM;Oe.SpreadElementBase=Mpe;Oe.Statement=Cl;Oe.StatementBase=jpe;Oe.StatementedNode=Mh;Oe.StaticableNode=WD;Oe.StringLiteral=y6;Oe.StringLiteralBase=o_e;Oe.Structure=eL;Oe.SuperElementAccessExpression=PH;Oe.SuperElementAccessExpressionBase=wpe;Oe.SuperExpression=AM;Oe.SuperExpressionBase=Fpe;Oe.SuperExpressionedNode=iq;Oe.SuperPropertyAccessExpression=OH;Oe.SuperPropertyAccessExpressionBase=Gpe;Oe.SwitchStatement=QM;Oe.SwitchStatementBase=sme;Oe.Symbol=O6;Oe.SymbolDisplayPart=U6;Oe.SyntaxList=QR;Oe.TaggedTemplateExpression=h6;Oe.TemplateExpression=E6;Oe.TemplateExpressionBase=l_e;Oe.TemplateHead=b6;Oe.TemplateHeadBase=u_e;Oe.TemplateLiteralTypeNode=zw;Oe.TemplateMiddle=S6;Oe.TemplateMiddleBase=c_e;Oe.TemplateSpan=T6;Oe.TemplateSpanBase=d_e;Oe.TemplateTail=x6;Oe.TemplateTailBase=f_e;Oe.TextChange=FE;Oe.TextInsertableNode=ld;Oe.TextRange=tL;Oe.TextSpan=wD;Oe.ThisExpression=LM;Oe.ThisExpressionBase=Bpe;Oe.ThisTypeNode=$w;Oe.ThrowStatement=ZM;Oe.ThrowStatementBase=lme;Oe.TrueLiteral=f6;Oe.TrueLiteralBase=e_e;Oe.TryStatement=ew;Oe.TryStatementBase=ume;Oe.TupleTypeNode=Xw;Oe.Type=vL;Oe.TypeAliasDeclaration=Yw;Oe.TypeAliasDeclarationBase=CR;Oe.TypeArgumentedNode=Z6;Oe.TypeAssertion=NM;Oe.TypeAssertionBase=Upe;Oe.TypeChecker=yL;Oe.TypeElement=wE;Oe.TypeElementMemberedNode=nq;Oe.TypeLiteralNode=Qw;Oe.TypeLiteralNodeBase=Fme;Oe.TypeNode=wc;Oe.TypeOfExpression=IM;Oe.TypeOfExpressionBase=Kpe;Oe.TypeOperatorTypeNode=Zw;Oe.TypeParameter=V6;Oe.TypeParameterDeclaration=eF;Oe.TypeParameterDeclarationBase=AR;Oe.TypeParameteredNode=J_;Oe.TypePredicateNode=rF;Oe.TypeQueryNode=tF;Oe.TypeReferenceNode=nF;Oe.TypedNode=KE;Oe.UnaryExpression=cv;Oe.UnaryExpressionedNode=jD;Oe.UnionTypeNode=iF;Oe.UnwrappableNode=eG;Oe.UpdateExpression=iM;Oe.VariableDeclaration=N6;Oe.VariableDeclarationBase=KR;Oe.VariableDeclarationList=I6;Oe.VariableDeclarationListBase=g_e;Oe.VariableStatement=yw;Oe.VariableStatementBase=mR;Oe.VoidExpression=PM;Oe.VoidExpressionBase=Wpe;Oe.WhileStatement=vw;Oe.WhileStatementBase=Eme;Oe.WithStatement=hw;Oe.WithStatementBase=bme;Oe.Writers=WH;Oe.YieldExpression=OM;Oe.YieldExpressionBase=Vpe;Oe.createWrappedNode=oUe;Oe.forEachStructureChild=A7e;Oe.getCompilerOptionsFromTsConfig=GBe;Oe.getScopeForNode=eM;Oe.insertOverloads=tG;Oe.printNode=lj;Oe.setScopeForNode=tq});var Yg=gt((hYe,sG)=>{var b_e,S_e,T_e,x_e,D_e,C_e,A_e,L_e,N_e,aG,cq,I_e,P_e,O_e,qD,k_e,R_e,M_e,w_e,F_e,G_e,B_e,U_e,K_e,oG;(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 sG=="object"&&typeof sG.exports=="object"?e(n(r,n(sG.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])};b_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)},S_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},T_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},x_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},D_e=function(i,a){return function(s,u){a(s,u,i)}},C_e=function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},A_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())})},L_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}}},N_e=function(i,a){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(a,s)&&oG(a,i,s)},oG=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]},aG=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},I_e=function(){for(var i=[],a=0;a<arguments.length;a++)i=i.concat(cq(arguments[a]));return i},P_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},O_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)},k_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])}},R_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}},M_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 aG=="function"?aG(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)}},w_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};F_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)&&oG(a,i,s);return n(a,i),a},G_e=function(i){return i&&i.__esModule?i:{default:i}},B_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)},U_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},K_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",b_e),e("__assign",S_e),e("__rest",T_e),e("__decorate",x_e),e("__param",D_e),e("__metadata",C_e),e("__awaiter",A_e),e("__generator",L_e),e("__exportStar",N_e),e("__createBinding",oG),e("__values",aG),e("__read",cq),e("__spread",I_e),e("__spreadArrays",P_e),e("__spreadArray",O_e),e("__await",qD),e("__asyncGenerator",k_e),e("__asyncDelegator",R_e),e("__asyncValues",M_e),e("__makeTemplateObject",w_e),e("__importStar",F_e),e("__importDefault",G_e),e("__classPrivateFieldGet",B_e),e("__classPrivateFieldSet",U_e),e("__classPrivateFieldIn",K_e)})});var W_e=gt(JD=>{"use strict";Object.defineProperty(JD,"__esModule",{value:!0});JD.lowerCase=JD.localeLowerCase=void 0;var bUe={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 SUe(e,r){var n=bUe[r.toLowerCase()];return dq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}JD.localeLowerCase=SUe;function dq(e){return e.toLowerCase()}JD.lowerCase=dq});var QT=gt(lG=>{"use strict";Object.defineProperty(lG,"__esModule",{value:!0});lG.noCase=void 0;var TUe=W_e(),xUe=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],DUe=/[^A-Z0-9]+/gi;function CUe(e,r){r===void 0&&(r={});for(var n=r.splitRegexp,i=n===void 0?xUe:n,a=r.stripRegexp,s=a===void 0?DUe:a,u=r.transform,p=u===void 0?TUe.lowerCase:u,f=r.delimiter,m=f===void 0?" ":f,g=V_e(V_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)}lG.noCase=CUe;function V_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 AUe=Yg(),LUe=QT();function j_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=j_e;function NUe(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}vS.pascalCaseTransformMerge=NUe;function IUe(e,r){return r===void 0&&(r={}),LUe.noCase(e,AUe.__assign({delimiter:"",transform:j_e},r))}vS.pascalCase=IUe});var q_e=gt(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.camelCase=hS.camelCaseTransformMerge=hS.camelCaseTransform=void 0;var PUe=Yg(),pq=fq();function H_e(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransform(e,r)}hS.camelCaseTransform=H_e;function OUe(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransformMerge(e)}hS.camelCaseTransformMerge=OUe;function kUe(e,r){return r===void 0&&(r={}),pq.pascalCase(e,PUe.__assign({transform:H_e},r))}hS.camelCase=kUe});var mq=gt(uG=>{"use strict";Object.defineProperty(uG,"__esModule",{value:!0});uG.upperCaseFirst=void 0;function RUe(e){return e.charAt(0).toUpperCase()+e.substr(1)}uG.upperCaseFirst=RUe});var _q=gt(zD=>{"use strict";Object.defineProperty(zD,"__esModule",{value:!0});zD.capitalCase=zD.capitalCaseTransform=void 0;var MUe=Yg(),wUe=QT(),FUe=mq();function J_e(e){return FUe.upperCaseFirst(e.toLowerCase())}zD.capitalCaseTransform=J_e;function GUe(e,r){return r===void 0&&(r={}),wUe.noCase(e,MUe.__assign({delimiter:" ",transform:J_e},r))}zD.capitalCase=GUe});var z_e=gt($D=>{"use strict";Object.defineProperty($D,"__esModule",{value:!0});$D.upperCase=$D.localeUpperCase=void 0;var BUe={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 UUe(e,r){var n=BUe[r.toLowerCase()];return gq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}$D.localeUpperCase=UUe;function gq(e){return e.toUpperCase()}$D.upperCase=gq});var $_e=gt(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});cG.constantCase=void 0;var KUe=Yg(),WUe=QT(),VUe=z_e();function jUe(e,r){return r===void 0&&(r={}),WUe.noCase(e,KUe.__assign({delimiter:"_",transform:VUe.upperCase},r))}cG.constantCase=jUe});var OL=gt(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});dG.dotCase=void 0;var HUe=Yg(),qUe=QT();function JUe(e,r){return r===void 0&&(r={}),qUe.noCase(e,HUe.__assign({delimiter:"."},r))}dG.dotCase=JUe});var X_e=gt(fG=>{"use strict";Object.defineProperty(fG,"__esModule",{value:!0});fG.headerCase=void 0;var zUe=Yg(),$Ue=_q();function XUe(e,r){return r===void 0&&(r={}),$Ue.capitalCase(e,zUe.__assign({delimiter:"-"},r))}fG.headerCase=XUe});var Y_e=gt(pG=>{"use strict";Object.defineProperty(pG,"__esModule",{value:!0});pG.paramCase=void 0;var YUe=Yg(),QUe=OL();function ZUe(e,r){return r===void 0&&(r={}),QUe.dotCase(e,YUe.__assign({delimiter:"-"},r))}pG.paramCase=ZUe});var Q_e=gt(mG=>{"use strict";Object.defineProperty(mG,"__esModule",{value:!0});mG.pathCase=void 0;var eKe=Yg(),rKe=OL();function tKe(e,r){return r===void 0&&(r={}),rKe.dotCase(e,eKe.__assign({delimiter:"/"},r))}mG.pathCase=tKe});var ege=gt(XD=>{"use strict";Object.defineProperty(XD,"__esModule",{value:!0});XD.sentenceCase=XD.sentenceCaseTransform=void 0;var nKe=Yg(),iKe=QT(),aKe=mq();function Z_e(e,r){var n=e.toLowerCase();return r===0?aKe.upperCaseFirst(n):n}XD.sentenceCaseTransform=Z_e;function oKe(e,r){return r===void 0&&(r={}),iKe.noCase(e,nKe.__assign({delimiter:" ",transform:Z_e},r))}XD.sentenceCase=oKe});var rge=gt(_G=>{"use strict";Object.defineProperty(_G,"__esModule",{value:!0});_G.snakeCase=void 0;var sKe=Yg(),lKe=OL();function uKe(e,r){return r===void 0&&(r={}),lKe.dotCase(e,sKe.__assign({delimiter:"_"},r))}_G.snakeCase=uKe});var yq=gt(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var gv=Yg();gv.__exportStar(q_e(),z_);gv.__exportStar(_q(),z_);gv.__exportStar($_e(),z_);gv.__exportStar(OL(),z_);gv.__exportStar(X_e(),z_);gv.__exportStar(QT(),z_);gv.__exportStar(Y_e(),z_);gv.__exportStar(fq(),z_);gv.__exportStar(Q_e(),z_);gv.__exportStar(ege(),z_);gv.__exportStar(rge(),z_)});var Eq=gt((jYe,cKe)=>{cKe.exports={name:"zenstack",publisher:"zenstack",displayName:"ZenStack Language Tools",description:"ZenStack is a toolkit that simplifies full-stack development",version:"0.1.57",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":"pnpm lint && pnpm build && pnpm bundle","vscode:package":"vsce package --no-dependencies",build:"pnpm langium:generate && tsc --noEmit",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:"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 fKe={};XDe(fKe,{default:()=>dKe,generateAction:()=>uge});module.exports=YDe(fKe);var hG=Gs(dQ()),sge=Gs(_Q());var goe=Gs(CE()),poe="AbstractDeclaration";var f6e="Expression";var moe="ReferenceTarget";var zO="TypeDeclaration";var Hx="ArrayExpr";function $O(e){return iv.isInstance(e,Hx)}var tK="Attribute";var yoe="AttributeArg";var SA="BinaryExpr";var XO="DataModel";function Lm(e){return iv.isInstance(e,XO)}var nK="DataModelField";function qx(e){return iv.isInstance(e,nK)}var YO="DataSource";function voe(e){return iv.isInstance(e,YO)}var QO="Enum";function hoe(e){return iv.isInstance(e,QO)}var ZO="EnumField";function Jx(e){return iv.isInstance(e,ZO)}var _oe="Function";var p6e="FunctionParam";var zx="InvocationExpr";function TA(e){return iv.isInstance(e,zx)}var Ub="LiteralExpr";function vh(e){return iv.isInstance(e,Ub)}var Kb="MemberAccessExpr";function iK(e){return iv.isInstance(e,Kb)}var xA="NullExpr";var Wb="ReferenceExpr";function Vb(e){return iv.isInstance(e,Wb)}var $x="ThisExpr";function xT(e){return iv.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(f6e,n);case tK:case YO:case _oe:return this.isSubtype(poe,n);case XO:case QO:return this.isSubtype(poe,n)||this.isSubtype(zO,n);case nK:case ZO:case p6e:return this.isSubtype(moe,n);default:return!1}}getReferenceType(r){let n=`${r.container.$type}:${r.property}`;switch(n){case"AttributeParamType:reference":return zO;case"DataModelAttribute:decl":return tK;case"DataModelFieldAttribute:decl":return tK;case"DataModelFieldType:reference":return zO;case"FunctionParamType:reference":return zO;case"InvocationExpr:function":return _oe;case"MemberAccessExpr:member":return nK;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:[]}}}},iv=new bA;var Eoe=Gs(CE()),ek,boe=()=>ek!=null?ek:ek=(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=uv(i,a,m=>m===ac.NEWLINE||!b.StringUtils.isWhitespaceCharCode(m)&&m!==ac.ASTERISK);return uv(i,f,m=>m!==ac.NEWLINE&&m!==ac.CARRIAGE_RETURN)}}setDescription(r){let n=this.getTags(),i=this.getStart()+3,a=n.length>0?uv(this._sourceFile.getFullText(),n[0].getStart(),u=>u===ac.ASTERISK)-1:this.getEnd()-2;return E7e({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=$g(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,uv(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(DR.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(DR.prototype,this,{kind:Oe.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(r=>r.getStructure())})}},wc=class extends Tr{},Pme=Z6(wc),KT=class extends Pme{},Rw=class extends wc{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},Mw=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=_v(wc),lL=class extends Ome{},kme=gS(sf(lL)),ww=class extends kme{},Rme=XT(KT),Fw=class extends Rme{},Mme=J_(lL),Gw=class extends Mme{},Bw=class extends Tr{getAssertClause(){return this._getNodeFromCompilerNode(this.compilerNode.assertClause)}isMultiline(){var r;return(r=this.compilerNode.multiLine)!==null&&r!==void 0?r:!1}},Uw=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.")}},Kw=class extends wc{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Ww=class extends wc{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Vw=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},jw=class extends wc{getLiteral(){let r=this.compilerNode.literal;return this._getNodeFromCompilerNode(r)}},Hw=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.")}},H9e=e=>KE(Rh(EL(sc(mv(e))))),wme=H9e(wc),qw=class extends wme{getTypeNode(){return super.getTypeNode()}removeType(){throw new b.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},Jw=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(r){return this.getTypeNode().replaceWithText(r),this}},zw=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)}},$w=class extends wc{},Xw=class extends wc{getElements(){return this.compilerNode.elements.map(r=>this._getNodeFromCompilerNode(r))}},q9e=e=>J_(KE(sc(Ph(BE(sf(mv(e))))))),CR=q9e(Cl),Yw=class extends CR{set(r){return io(CR.prototype,this,r),this}getStructure(){return uo(CR.prototype,this,{kind:Oe.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},Fme=nq(wc),Qw=class extends Fme{},Zw=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 AR=sf(mv(Tr)),eF=class extends AR{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():fv(this);function i(){let a=[r.getPreviousSiblingIfKindOrThrow(b.SyntaxKind.LessThanToken),r,r.getNextSiblingIfKindOrThrow(b.SyntaxKind.GreaterThanToken)];Bs({children:a})}}set(r){return io(AR.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(AR.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 rF=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.")}},tF=class extends KT{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},nF=class extends KT{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},iF=class extends wc{getTypeNodes(){return this.compilerNode.types.map(r=>this._getNodeFromCompilerNode(r))}},q_=class extends wc{},aF=class extends q_{},LR=Tr,bc=class extends LR{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(LR.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=$g(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(LR.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 uv(n,r,i=>i!==ac.ASTERISK&&!b.StringUtils.isWhitespaceCharCode(i))}var oF=class extends bc{},sF=class extends bc{},lF=class extends bc{},uF=class extends bc{},cF=class extends bc{},dF=class extends bc{},Wme=_v(q_),fF=class extends Wme{},pF=class extends bc{},mF=class extends Tr{},_F=class extends Tr{},gF=class extends Tr{},yF=class extends Tr{},vF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},hF=class extends Tr{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},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)}isPostfix(){return this.compilerNode.postfix}},SF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},TF=class extends bc{},Vme=oq(bc),xF=class extends Vme{},DF=class extends bc{},jme=oq(bc),CF=class extends jme{},AF=class extends bc{},LF=class extends bc{},NF=class extends bc{},Hme=nG(bc),IF=class extends Hme{},qme=nG(bc),PF=class extends qme{},OF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},uL=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),kF=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.")}},RF=class extends Tr{},zme=nG(bc),MF=class extends zme{},wF=class extends bc{},FF=class extends wc{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},GF=class extends q_{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(r=>this._getNodeFromCompilerNode(r)):void 0}},BF=class extends bc{getTypeExpression(){let r=this.compilerNode.typeExpression;if(!(r!=null&&r.pos===r.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},UF=class extends bc{},KF=class extends q_{},WF=class extends q_{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},VF=class extends Tr{remove(){Nh({children:[this],getSiblingFormatting:()=>El.Newline})}},J9e=e=>ld(yS(sc(Ph(BE(sf(mv(e))))))),NR=J9e(Cl),jF=class extends NR{set(r){return io(NR.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(NR.prototype,this,{kind:Oe.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(r=>r.getStructure())})}},z9e=e=>sc($T(UE(e))),IR=z9e(Tr),HF=class extends IR{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(IR.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(IR.prototype,this,{kind:Oe.StructureKind.EnumMember,value:void 0})}},qF=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 fv(i);return this;function a(s){return n[ku(s,n.length-1)]}}},wE=class extends Tr{remove(){m7e(this)}},$9e=e=>J_(Im(sc(_v(e)))),PR=$9e(wE),JF=class extends PR{set(r){return io(PR.prototype,this,r),this}getStructure(){return uo(PR.prototype,this,{kind:Oe.StructureKind.CallSignature})}},zF=class extends wE{},X9e=e=>J_(Im(sc(_v(e)))),OR=X9e(wE),$F=class extends OR{set(r){return io(OR.prototype,this,r),this}getStructure(){return uo(OR.prototype,this,{kind:Oe.StructureKind.ConstructSignature})}},Y9e=e=>rq(Im(sc(TL(sf(e))))),kR=Y9e(wE),XF=class extends kR{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(kR.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(kR.prototype,this,{kind:Oe.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:r.getText()})}},Q9e=e=>nq(ld(ape(ZH(J_(sc(Ph(yS(BE(sf(mv(e))))))))))),RR=Q9e(Cl),YF=class extends RR{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(RR.prototype,this,r),this}getStructure(){return uo(RR.prototype,this,{kind:Oe.StructureKind.Interface})}},Z9e=e=>Im(sc(Rh(J_(_v(UE(e)))))),MR=Z9e(wE),QF=class extends MR{set(r){return io(MR.prototype,this,r),this}getStructure(){return uo(MR.prototype,this,{kind:Oe.StructureKind.MethodSignature})}},eUe=e=>Im(sc(TL(Rh($T(KE(UE(sf(e)))))))),wR=eUe(wE),ZF=class extends wR{set(r){return io(wR.prototype,this,r),this}getStructure(){return uo(wR.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 iG(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 FR=mv(Tr),e6=class extends FR{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=$g(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(FR.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(FR.prototype,this,{kind:Oe.StructureKind.JsxAttribute,initializer:r?.getText()})}},rUe=e=>iG(e),$me=rUe(Tr),r6=class extends $me{},t6=class extends oc{},GR=sd,n6=class extends GR{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(GR.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(GR.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=xL(EL(oc)),i6=class extends Xme{},a6=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)}},tUe=e=>sq(iG(e)),Yme=tUe(oc),o6=class extends Yme{},s6=class extends oc{},nUe=e=>sq(iG(e)),BR=nUe(sd),l6=class extends BR{set(r){return io(BR.prototype,this,r),this}getStructure(){return uo(BR.prototype,this,{kind:Oe.StructureKind.JsxSelfClosingElement})}},UR=ud(Tr),u6=class extends UR{remove(){Bs({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(r){return io(UR.prototype,this,r),r.expression!=null&&this.setExpression(r.expression),this}getStructure(){return uo(UR.prototype,this,{kind:Oe.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},Qme=UD(Tr),c6=class extends Qme{containsOnlyTriviaWhiteSpaces(){let r=this.compilerNode;return typeof r.containsOnlyWhiteSpaces=="boolean"?r.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},Zme=cS,d6=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,f6=class extends e_e{getLiteralValue(){return lq(this)}setLiteralValue(r){return t_e(this,r)}},r_e=sd,p6=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,m6=class extends n_e{},i_e=cS,_6=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,g6=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,y6=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,v6=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)}},h6=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,E6=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=UD(Tr),b6=class extends u_e{},c_e=UD(Tr),S6=class extends c_e{},d_e=ud(Tr),T6=class extends d_e{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},f_e=UD(Tr),x6=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),D6=class extends p_e{},m_e=uq(kh(pv(sd))),C6=class extends m_e{getImplementations(){return this._context.languageService.getImplementations(this)}},__e=uq(kh(pv(Tr))),A6=class extends __e{},L6=class extends Tr{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},iUe=e=>YH(XH(KE($T(X6(e))))),KR=iUe(Tr),N6=class extends KR{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():fv(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(KR.prototype,this,r),this}getStructure(){return uo(KR.prototype,this,{kind:Oe.StructureKind.VariableDeclaration})}},g_e=sf(Tr),I6=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)}},P6=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))}},O6=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 uL(r))}},wD=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 wD(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 k6=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))}},R6=class extends k6{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},cL=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],cL.prototype,"getChanges",null);var dv=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 wD(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 wD(r)}getOriginalFileName(){return this.compilerObject.originalFileName}};co([b.Memoize],dv.prototype,"getTextSpan",null);co([b.Memoize],dv.prototype,"getNode",null);co([b.Memoize],dv.prototype,"getOriginalTextSpan",null);var FD=class extends dv{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],FD.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 dL=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()}},M6=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}},fL=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 M6(this._context,r))}};co([b.Memoize],fL.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 pL=class extends dv{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],pL.prototype,"getDisplayParts",null);var w6=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)}},mL=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],mL.prototype,"getEdits",null);var _L=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],_L.prototype,"getDefinition",null);var gL=class extends FD{constructor(r,n){super(r,n)}getDisplayParts(){return this.compilerObject.displayParts.map(r=>this._context.compilerFactory.getSymbolDisplayPart(r))}};co([b.Memoize],gL.prototype,"getDisplayParts",null);var F6=class extends dv{constructor(r,n){super(r,n)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},G6=class extends F6{constructor(r,n){super(r,n)}isDefinition(){return this.compilerObject.isDefinition}},B6=class extends dv{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},U6=class{constructor(r){this._compilerObject=r}get compilerObject(){return this._compilerObject}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},yL=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}},K6=class{constructor(r){this._context=r.context,this._configFileParsingDiagnostics=r.configFileParsingDiagnostics,this._typeChecker=new yL(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 w6(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()}},W6=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 K6({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 pL(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 B6(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 fL(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 mL(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 cL(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 R6(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),RBe(r,this._context.manipulationSettings),r._filled=!0),r}_getFilledUserPreferences(r){return Object.assign(this._context.getUserPreferences(),r)}},vL=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}},V6=class extends vL{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}},hL=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 hL(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 hL(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()}},aUe={[b.SyntaxKind.SourceFile]:kE,[b.SyntaxKind.ArrayBindingPattern]:rM,[b.SyntaxKind.ArrayLiteralExpression]:aM,[b.SyntaxKind.ArrayType]:Rw,[b.SyntaxKind.ArrowFunction]:Ew,[b.SyntaxKind.AsExpression]:oM,[b.SyntaxKind.AssertClause]:rw,[b.SyntaxKind.AssertEntry]:tw,[b.SyntaxKind.AwaitExpression]:sM,[b.SyntaxKind.BigIntLiteral]:d6,[b.SyntaxKind.BindingElement]:tM,[b.SyntaxKind.BinaryExpression]:iL,[b.SyntaxKind.Block]:kM,[b.SyntaxKind.BreakStatement]:RM,[b.SyntaxKind.CallExpression]:lM,[b.SyntaxKind.CallSignature]:JF,[b.SyntaxKind.CaseBlock]:MM,[b.SyntaxKind.CaseClause]:wM,[b.SyntaxKind.CatchClause]:FM,[b.SyntaxKind.ClassDeclaration]:xw,[b.SyntaxKind.ClassExpression]:Dw,[b.SyntaxKind.ClassStaticBlockDeclaration]:Cw,[b.SyntaxKind.ConditionalType]:Mw,[b.SyntaxKind.Constructor]:Lw,[b.SyntaxKind.ConstructorType]:ww,[b.SyntaxKind.ConstructSignature]:$F,[b.SyntaxKind.ContinueStatement]:BM,[b.SyntaxKind.CommaListExpression]:uM,[b.SyntaxKind.ComputedPropertyName]:D6,[b.SyntaxKind.ConditionalExpression]:cM,[b.SyntaxKind.DebuggerStatement]:UM,[b.SyntaxKind.Decorator]:Ow,[b.SyntaxKind.DefaultClause]:KM,[b.SyntaxKind.DeleteExpression]:dM,[b.SyntaxKind.DoStatement]:WM,[b.SyntaxKind.ElementAccessExpression]:oL,[b.SyntaxKind.EmptyStatement]:VM,[b.SyntaxKind.EnumDeclaration]:jF,[b.SyntaxKind.EnumMember]:HF,[b.SyntaxKind.ExportAssignment]:nw,[b.SyntaxKind.ExportDeclaration]:iw,[b.SyntaxKind.ExportSpecifier]:aw,[b.SyntaxKind.ExpressionWithTypeArguments]:Fw,[b.SyntaxKind.ExpressionStatement]:jM,[b.SyntaxKind.ExternalModuleReference]:ow,[b.SyntaxKind.QualifiedName]:L6,[b.SyntaxKind.ForInStatement]:HM,[b.SyntaxKind.ForOfStatement]:qM,[b.SyntaxKind.ForStatement]:JM,[b.SyntaxKind.FunctionDeclaration]:bw,[b.SyntaxKind.FunctionExpression]:Sw,[b.SyntaxKind.FunctionType]:Gw,[b.SyntaxKind.GetAccessor]:Nw,[b.SyntaxKind.HeritageClause]:qF,[b.SyntaxKind.Identifier]:C6,[b.SyntaxKind.IfStatement]:zM,[b.SyntaxKind.ImportClause]:sw,[b.SyntaxKind.ImportDeclaration]:lw,[b.SyntaxKind.ImportEqualsDeclaration]:uw,[b.SyntaxKind.ImportSpecifier]:cw,[b.SyntaxKind.ImportType]:Uw,[b.SyntaxKind.ImportTypeAssertionContainer]:Bw,[b.SyntaxKind.IndexedAccessType]:Kw,[b.SyntaxKind.IndexSignature]:XF,[b.SyntaxKind.InferType]:Ww,[b.SyntaxKind.InterfaceDeclaration]:YF,[b.SyntaxKind.IntersectionType]:Vw,[b.SyntaxKind.JSDocAllType]:aF,[b.SyntaxKind.JSDocAugmentsTag]:oF,[b.SyntaxKind.JSDocAuthorTag]:sF,[b.SyntaxKind.JSDocCallbackTag]:lF,[b.SyntaxKind.JSDocClassTag]:uF,[b.SyntaxKind.JSDocDeprecatedTag]:cF,[b.SyntaxKind.JSDocEnumTag]:dF,[b.SyntaxKind.JSDocFunctionType]:fF,[b.SyntaxKind.JSDocImplementsTag]:pF,[b.SyntaxKind.JSDocLink]:mF,[b.SyntaxKind.JSDocLinkCode]:_F,[b.SyntaxKind.JSDocLinkPlain]:gF,[b.SyntaxKind.JSDocMemberName]:yF,[b.SyntaxKind.JSDocNamepathType]:vF,[b.SyntaxKind.JSDocNameReference]:hF,[b.SyntaxKind.JSDocNonNullableType]:EF,[b.SyntaxKind.JSDocNullableType]:bF,[b.SyntaxKind.JSDocOptionalType]:SF,[b.SyntaxKind.JSDocOverrideTag]:TF,[b.SyntaxKind.JSDocParameterTag]:xF,[b.SyntaxKind.JSDocPrivateTag]:DF,[b.SyntaxKind.JSDocPropertyTag]:CF,[b.SyntaxKind.JSDocProtectedTag]:AF,[b.SyntaxKind.JSDocPublicTag]:LF,[b.SyntaxKind.JSDocReturnTag]:IF,[b.SyntaxKind.JSDocReadonlyTag]:NF,[b.SyntaxKind.JSDocSeeTag]:PF,[b.SyntaxKind.JSDocSignature]:OF,[b.SyntaxKind.JSDocTag]:UF,[b.SyntaxKind.JSDocTemplateTag]:kF,[b.SyntaxKind.JSDocText]:RF,[b.SyntaxKind.JSDocThisTag]:MF,[b.SyntaxKind.JSDocTypeExpression]:FF,[b.SyntaxKind.JSDocTypeLiteral]:GF,[b.SyntaxKind.JSDocTypeTag]:BF,[b.SyntaxKind.JSDocTypedefTag]:wF,[b.SyntaxKind.JSDocUnknownType]:KF,[b.SyntaxKind.JSDocVariadicType]:WF,[b.SyntaxKind.JsxAttribute]:e6,[b.SyntaxKind.JsxClosingElement]:r6,[b.SyntaxKind.JsxClosingFragment]:t6,[b.SyntaxKind.JsxElement]:n6,[b.SyntaxKind.JsxExpression]:i6,[b.SyntaxKind.JsxFragment]:a6,[b.SyntaxKind.JsxOpeningElement]:o6,[b.SyntaxKind.JsxOpeningFragment]:s6,[b.SyntaxKind.JsxSelfClosingElement]:l6,[b.SyntaxKind.JsxSpreadAttribute]:u6,[b.SyntaxKind.JsxText]:c6,[b.SyntaxKind.LabeledStatement]:$M,[b.SyntaxKind.LiteralType]:jw,[b.SyntaxKind.MappedType]:Hw,[b.SyntaxKind.MetaProperty]:pM,[b.SyntaxKind.MethodDeclaration]:MD,[b.SyntaxKind.MethodSignature]:QF,[b.SyntaxKind.ModuleBlock]:dw,[b.SyntaxKind.ModuleDeclaration]:fw,[b.SyntaxKind.NamedExports]:pw,[b.SyntaxKind.NamedImports]:mw,[b.SyntaxKind.NamedTupleMember]:qw,[b.SyntaxKind.NamespaceExport]:_w,[b.SyntaxKind.NamespaceImport]:gw,[b.SyntaxKind.NewExpression]:mM,[b.SyntaxKind.NonNullExpression]:_M,[b.SyntaxKind.NotEmittedStatement]:XM,[b.SyntaxKind.NoSubstitutionTemplateLiteral]:v6,[b.SyntaxKind.NumericLiteral]:_6,[b.SyntaxKind.ObjectBindingPattern]:nM,[b.SyntaxKind.ObjectLiteralExpression]:yM,[b.SyntaxKind.OmittedExpression]:bM,[b.SyntaxKind.Parameter]:Tw,[b.SyntaxKind.ParenthesizedExpression]:SM,[b.SyntaxKind.ParenthesizedType]:Jw,[b.SyntaxKind.PartiallyEmittedExpression]:TM,[b.SyntaxKind.PostfixUnaryExpression]:xM,[b.SyntaxKind.PrefixUnaryExpression]:DM,[b.SyntaxKind.PrivateIdentifier]:A6,[b.SyntaxKind.PropertyAccessExpression]:sL,[b.SyntaxKind.PropertyAssignment]:vM,[b.SyntaxKind.PropertyDeclaration]:Iw,[b.SyntaxKind.PropertySignature]:ZF,[b.SyntaxKind.RegularExpressionLiteral]:g6,[b.SyntaxKind.ReturnStatement]:YM,[b.SyntaxKind.SetAccessor]:Pw,[b.SyntaxKind.ShorthandPropertyAssignment]:hM,[b.SyntaxKind.SpreadAssignment]:EM,[b.SyntaxKind.SpreadElement]:CM,[b.SyntaxKind.StringLiteral]:y6,[b.SyntaxKind.SwitchStatement]:QM,[b.SyntaxKind.SyntaxList]:QR,[b.SyntaxKind.TaggedTemplateExpression]:h6,[b.SyntaxKind.TemplateExpression]:E6,[b.SyntaxKind.TemplateHead]:b6,[b.SyntaxKind.TemplateLiteralType]:zw,[b.SyntaxKind.TemplateMiddle]:S6,[b.SyntaxKind.TemplateSpan]:T6,[b.SyntaxKind.TemplateTail]:x6,[b.SyntaxKind.ThisType]:$w,[b.SyntaxKind.ThrowStatement]:ZM,[b.SyntaxKind.TryStatement]:ew,[b.SyntaxKind.TupleType]:Xw,[b.SyntaxKind.TypeAliasDeclaration]:Yw,[b.SyntaxKind.TypeAssertionExpression]:NM,[b.SyntaxKind.TypeLiteral]:Qw,[b.SyntaxKind.TypeOperator]:Zw,[b.SyntaxKind.TypeParameter]:eF,[b.SyntaxKind.TypePredicate]:rF,[b.SyntaxKind.TypeQuery]:tF,[b.SyntaxKind.TypeReference]:nF,[b.SyntaxKind.UnionType]:iF,[b.SyntaxKind.VariableDeclaration]:N6,[b.SyntaxKind.VariableDeclarationList]:I6,[b.SyntaxKind.VariableStatement]:yw,[b.SyntaxKind.JSDoc]:kw,[b.SyntaxKind.TypeOfExpression]:IM,[b.SyntaxKind.WhileStatement]:vw,[b.SyntaxKind.WithStatement]:hw,[b.SyntaxKind.YieldExpression]:OM,[b.SyntaxKind.SemicolonToken]:Tr,[b.SyntaxKind.AnyKeyword]:oc,[b.SyntaxKind.BooleanKeyword]:oc,[b.SyntaxKind.FalseKeyword]:p6,[b.SyntaxKind.ImportKeyword]:fM,[b.SyntaxKind.InferKeyword]:Tr,[b.SyntaxKind.NeverKeyword]:Tr,[b.SyntaxKind.NullKeyword]:m6,[b.SyntaxKind.NumberKeyword]:oc,[b.SyntaxKind.ObjectKeyword]:oc,[b.SyntaxKind.StringKeyword]:oc,[b.SyntaxKind.SymbolKeyword]:oc,[b.SyntaxKind.SuperKeyword]:AM,[b.SyntaxKind.ThisKeyword]:LM,[b.SyntaxKind.TrueKeyword]:f6,[b.SyntaxKind.UndefinedKeyword]:oc,[b.SyntaxKind.VoidExpression]:PM},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)b7e(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?$g(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 GM(this.context,r,n):p_.isCommentClassElement(r)?new Aw(this.context,r,n):p_.isCommentTypeElement(r)?new zF(this.context,r,n):p_.isCommentObjectLiteralElement(r)?new gM(this.context,r,n):p_.isCommentEnumMember(r)?new VF(this.context,r,n):b.errors.throwNotImplementedForNeverValueError(r);let u=aUe[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 U6(r))}getType(r){return(r.flags&b.TypeFlags.TypeParameter)===b.TypeFlags.TypeParameter?this.getTypeParameter(r):this.typeCache.getOrCreate(r,()=>new vL(this.context,r))}getTypeParameter(r){return this.typeParameterCache.getOrCreate(r,()=>new V6(this.context,r))}getSignature(r){return this.signatureCache.getOrCreate(r,()=>new P6(this.context,r))}getSymbol(r){return this.symbolCache.getOrCreate(r,()=>new O6(this.context,r))}getDefinitionInfo(r){return this.definitionInfoCache.getOrCreate(r,()=>new FD(this.context,r))}getDocumentSpan(r){return this.documentSpanCache.getOrCreate(r,()=>new dv(this.context,r))}getReferencedSymbolEntry(r){return this.referencedSymbolEntryCache.getOrCreate(r,()=>new G6(this.context,r))}getReferencedSymbol(r){return this.referencedSymbolCache.getOrCreate(r,()=>new _L(this.context,r))}getReferencedSymbolDefinitionInfo(r){return this.referencedSymbolDefinitionInfoCache.getOrCreate(r,()=>new gL(this.context,r))}getDiagnostic(r){return this.diagnosticCache.getOrCreate(r,()=>r.start!=null?new dL(this.context,r):new WT(this.context,r))}getDiagnosticWithLocation(r){return this.diagnosticCache.getOrCreate(r,()=>new dL(this.context,r))}getDiagnosticMessageChain(r){return this.diagnosticMessageChainCache.getOrCreate(r,()=>new pS(r))}getJSDocTagInfo(r){return this.jsDocTagInfoCache.getOrCreate(r,()=>new uL(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 GD=class{constructor(r){this.logger=new cj,this.manipulationSettings=new VR,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 W6({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 yL(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 WR.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],GD.prototype,"getSourceFileContainer",null);co([b.Memoize],GD.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 GD({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 oUe(e,r={}){let{compilerOptions:n={},sourceFile:i,typeChecker:a}=r,s=new b.CompilerOptionsContainer;s.set(n);let u=new GD({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 sUe=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(": "),rL(n,p))}n.newLine()}}}static objectType(r){return n=>{n.write("{"),lUe(r)&&n.indent(()=>{sUe.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=>{rL(i,r),i.spaceIfLastNot().write("as "),rL(i,n)}}static returnStatement(r){return n=>{n.write("return "),n.hangingIndentUnlessBlock(()=>{rL(n,r),n.write(";")})}}};function Ofe(e,r){return n=>{uUe(n,` ${e} `,r)}}function lUe(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 uUe(e,r,n){for(let i=0;i<n.length;i++)e.conditionalWrite(i>0,r),rL(e,n[i])}function rL(e,r){r instanceof Function?r(e):e.write(r.toString())}var{InvalidOperationError:cUe,FileNotFoundError:dUe,ArgumentError:fUe,ArgumentNullOrWhitespaceError:pUe,ArgumentOutOfRangeError:mUe,ArgumentTypeError:_Ue,BaseError:gUe,DirectoryNotFoundError:yUe,NotImplementedError:vUe,NotSupportedError:hUe,PathNotFoundError:EUe}=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 WR.default}});Oe.AbstractableNode=gS;Oe.AmbientableNode=Ph;Oe.ArgumentError=fUe;Oe.ArgumentNullOrWhitespaceError=pUe;Oe.ArgumentOutOfRangeError=mUe;Oe.ArgumentTypeError=_Ue;Oe.ArgumentedNode=zH;Oe.ArrayBindingPattern=rM;Oe.ArrayDestructuringAssignment=NH;Oe.ArrayDestructuringAssignmentBase=mpe;Oe.ArrayLiteralExpression=aM;Oe.ArrayTypeNode=Rw;Oe.ArrowFunction=Ew;Oe.ArrowFunctionBase=Sme;Oe.AsExpression=oM;Oe.AsExpressionBase=_pe;Oe.AssertClause=rw;Oe.AssertClauseBase=cme;Oe.AssertEntry=tw;Oe.AssertEntryBase=lR;Oe.AssertionKeyNamedNode=spe;Oe.AssignmentExpression=aL;Oe.AssignmentExpressionBase=ppe;Oe.AsyncableNode=jT;Oe.AwaitExpression=sM;Oe.AwaitExpressionBase=gpe;Oe.AwaitableNode=Qfe;Oe.BaseError=gUe;Oe.BaseExpressionedNode=VD;Oe.BigIntLiteral=d6;Oe.BigIntLiteralBase=Zme;Oe.BinaryExpression=iL;Oe.BinaryExpressionBase=fpe;Oe.BindingElement=tM;Oe.BindingElementBase=dpe;Oe.BindingNamedNode=X6;Oe.Block=kM;Oe.BlockBase=Hpe;Oe.BodiedNode=q6;Oe.BodyableNode=HT;Oe.BreakStatement=RM;Oe.CallExpression=lM;Oe.CallExpressionBase=ype;Oe.CallSignatureDeclaration=JF;Oe.CallSignatureDeclarationBase=PR;Oe.CaseBlock=MM;Oe.CaseBlockBase=qpe;Oe.CaseClause=wM;Oe.CaseClauseBase=Jpe;Oe.CatchClause=FM;Oe.CatchClauseBase=zpe;Oe.ChildOrderableNode=Im;Oe.ClassDeclaration=xw;Oe.ClassDeclarationBase=vR;Oe.ClassElement=zg;Oe.ClassExpression=Dw;Oe.ClassExpressionBase=Lme;Oe.ClassLikeDeclarationBase=aq;Oe.ClassLikeDeclarationBaseSpecific=Cme;Oe.ClassStaticBlockDeclaration=Cw;Oe.ClassStaticBlockDeclarationBase=hR;Oe.CodeAction=k6;Oe.CodeFixAction=R6;Oe.CombinedCodeActions=cL;Oe.CommaListExpression=uM;Oe.CommaListExpressionBase=vpe;Oe.CommentClassElement=Aw;Oe.CommentEnumMember=VF;Oe.CommentObjectLiteralElement=gM;Oe.CommentRange=YR;Oe.CommentStatement=GM;Oe.CommentTypeElement=zF;Oe.CommonIdentifierBase=uq;Oe.CompilerCommentClassElement=HR;Oe.CompilerCommentEnumMember=zR;Oe.CompilerCommentNode=sS;Oe.CompilerCommentObjectLiteralElement=JR;Oe.CompilerCommentStatement=jR;Oe.CompilerCommentTypeElement=qR;Oe.ComputedPropertyName=D6;Oe.ComputedPropertyNameBase=p_e;Oe.ConditionalExpression=cM;Oe.ConditionalExpressionBase=hpe;Oe.ConditionalTypeNode=Mw;Oe.ConstructSignatureDeclaration=$F;Oe.ConstructSignatureDeclarationBase=OR;Oe.ConstructorDeclaration=Lw;Oe.ConstructorDeclarationBase=ER;Oe.ConstructorDeclarationOverloadBase=Nme;Oe.ConstructorTypeNode=ww;Oe.ConstructorTypeNodeBase=kme;Oe.ContinueStatement=BM;Oe.DebuggerStatement=UM;Oe.DebuggerStatementBase=$pe;Oe.DecoratableNode=qT;Oe.Decorator=Ow;Oe.DecoratorBase=xR;Oe.DefaultClause=KM;Oe.DefaultClauseBase=Xpe;Oe.DefinitionInfo=FD;Oe.DeleteExpression=dM;Oe.DeleteExpressionBase=Epe;Oe.Diagnostic=WT;Oe.DiagnosticMessageChain=pS;Oe.DiagnosticWithLocation=dL;Oe.Directory=OE;Oe.DirectoryEmitResult=hL;Oe.DirectoryNotFoundError=yUe;Oe.DoStatement=WM;Oe.DoStatementBase=Ype;Oe.DocumentSpan=dv;Oe.DotDotDotTokenableNode=EL;Oe.ElementAccessExpression=oL;Oe.ElementAccessExpressionBase=bpe;Oe.EmitOutput=fL;Oe.EmitResult=VT;Oe.EmptyStatement=VM;Oe.EmptyStatementBase=Qpe;Oe.EnumDeclaration=jF;Oe.EnumDeclarationBase=NR;Oe.EnumMember=HF;Oe.EnumMemberBase=IR;Oe.ExclamationTokenableNode=XH;Oe.ExportAssignment=nw;Oe.ExportAssignmentBase=kH;Oe.ExportDeclaration=iw;Oe.ExportDeclarationBase=uR;Oe.ExportGetableNode=YH;Oe.ExportSpecifier=aw;Oe.ExportSpecifierBase=RH;Oe.ExportableNode=BE;Oe.Expression=oc;Oe.ExpressionStatement=jM;Oe.ExpressionStatementBase=Zpe;Oe.ExpressionWithTypeArguments=Fw;Oe.ExpressionWithTypeArgumentsBase=Rme;Oe.ExpressionableNode=xL;Oe.ExpressionedNode=ud;Oe.ExtendsClauseableNode=ape;Oe.ExternalModuleReference=ow;Oe.ExternalModuleReferenceBase=dme;Oe.FalseLiteral=p6;Oe.FalseLiteralBase=r_e;Oe.FileNotFoundError=dUe;Oe.FileReference=OD;Oe.FileTextChanges=fS;Oe.ForInStatement=HM;Oe.ForInStatementBase=eme;Oe.ForOfStatement=qM;Oe.ForOfStatementBase=rme;Oe.ForStatement=JM;Oe.ForStatementBase=tme;Oe.FunctionDeclaration=bw;Oe.FunctionDeclarationBase=_R;Oe.FunctionDeclarationOverloadBase=Tme;Oe.FunctionExpression=Sw;Oe.FunctionExpressionBase=xme;Oe.FunctionLikeDeclaration=YT;Oe.FunctionOrConstructorTypeNodeBase=lL;Oe.FunctionOrConstructorTypeNodeBaseBase=Ome;Oe.FunctionTypeNode=Gw;Oe.FunctionTypeNodeBase=Mme;Oe.GeneratorableNode=zT;Oe.GetAccessorDeclaration=Nw;Oe.GetAccessorDeclarationBase=bR;Oe.HeritageClause=qF;Oe.HeritageClauseableNode=ZH;Oe.Identifier=C6;Oe.IdentifierBase=m_e;Oe.IfStatement=zM;Oe.IfStatementBase=nme;Oe.ImplementationLocation=pL;Oe.ImplementsClauseableNode=ope;Oe.ImportClause=sw;Oe.ImportClauseBase=fme;Oe.ImportDeclaration=lw;Oe.ImportDeclarationBase=cR;Oe.ImportEqualsDeclaration=uw;Oe.ImportEqualsDeclarationBase=mme;Oe.ImportExpression=fM;Oe.ImportExpressionBase=Spe;Oe.ImportExpressionedNode=p9e;Oe.ImportSpecifier=cw;Oe.ImportSpecifierBase=dR;Oe.ImportTypeAssertionContainer=Bw;Oe.ImportTypeNode=Uw;Oe.IndexSignatureDeclaration=XF;Oe.IndexSignatureDeclarationBase=kR;Oe.IndexedAccessTypeNode=Kw;Oe.InferTypeNode=Ww;Oe.InitializerExpressionGetableNode=$6;Oe.InitializerExpressionableNode=$T;Oe.InterfaceDeclaration=YF;Oe.InterfaceDeclarationBase=RR;Oe.IntersectionTypeNode=Vw;Oe.InvalidOperationError=cUe;Oe.IterationStatement=dS;Oe.JSDoc=kw;Oe.JSDocAllType=aF;Oe.JSDocAugmentsTag=oF;Oe.JSDocAuthorTag=sF;Oe.JSDocBase=DR;Oe.JSDocCallbackTag=lF;Oe.JSDocClassTag=uF;Oe.JSDocDeprecatedTag=cF;Oe.JSDocEnumTag=dF;Oe.JSDocFunctionType=fF;Oe.JSDocFunctionTypeBase=Wme;Oe.JSDocImplementsTag=pF;Oe.JSDocLink=mF;Oe.JSDocLinkCode=_F;Oe.JSDocLinkPlain=gF;Oe.JSDocMemberName=yF;Oe.JSDocNameReference=hF;Oe.JSDocNamepathType=vF;Oe.JSDocNonNullableType=EF;Oe.JSDocNullableType=bF;Oe.JSDocOptionalType=SF;Oe.JSDocOverrideTag=TF;Oe.JSDocParameterTag=xF;Oe.JSDocParameterTagBase=Vme;Oe.JSDocPrivateTag=DF;Oe.JSDocPropertyLikeTag=oq;Oe.JSDocPropertyTag=CF;Oe.JSDocPropertyTagBase=jme;Oe.JSDocProtectedTag=AF;Oe.JSDocPublicTag=LF;Oe.JSDocReadonlyTag=NF;Oe.JSDocReturnTag=IF;Oe.JSDocReturnTagBase=Hme;Oe.JSDocSeeTag=PF;Oe.JSDocSeeTagBase=qme;Oe.JSDocSignature=OF;Oe.JSDocTag=bc;Oe.JSDocTagBase=LR;Oe.JSDocTagInfo=uL;Oe.JSDocTemplateTag=kF;Oe.JSDocTemplateTagBase=Jme;Oe.JSDocText=RF;Oe.JSDocThisTag=MF;Oe.JSDocThisTagBase=zme;Oe.JSDocType=q_;Oe.JSDocTypeExpression=FF;Oe.JSDocTypeExpressionableTag=nG;Oe.JSDocTypeLiteral=GF;Oe.JSDocTypeParameteredTag=Ime;Oe.JSDocTypeTag=BF;Oe.JSDocTypedefTag=wF;Oe.JSDocUnknownTag=UF;Oe.JSDocUnknownType=KF;Oe.JSDocVariadicType=WF;Oe.JSDocableNode=sc;Oe.JsxAttribute=e6;Oe.JsxAttributeBase=FR;Oe.JsxAttributedNode=sq;Oe.JsxClosingElement=r6;Oe.JsxClosingElementBase=$me;Oe.JsxClosingFragment=t6;Oe.JsxElement=n6;Oe.JsxElementBase=GR;Oe.JsxExpression=i6;Oe.JsxExpressionBase=Xme;Oe.JsxFragment=a6;Oe.JsxOpeningElement=o6;Oe.JsxOpeningElementBase=Yme;Oe.JsxOpeningFragment=s6;Oe.JsxSelfClosingElement=l6;Oe.JsxSelfClosingElementBase=BR;Oe.JsxSpreadAttribute=u6;Oe.JsxSpreadAttributeBase=UR;Oe.JsxTagNamedNode=iG;Oe.JsxText=c6;Oe.JsxTextBase=Qme;Oe.LabeledStatement=$M;Oe.LabeledStatementBase=ime;Oe.LanguageService=W6;Oe.LeftHandSideExpression=RD;Oe.LeftHandSideExpressionedNode=XT;Oe.LiteralExpression=cS;Oe.LiteralExpressionBase=Tpe;Oe.LiteralLikeNode=UD;Oe.LiteralTypeNode=jw;Oe.ManipulationError=XR;Oe.ManipulationSettingsContainer=VR;Oe.MappedTypeNode=Hw;Oe.MemberExpression=BT;Oe.MemoryEmitResult=w6;Oe.MetaProperty=pM;Oe.MetaPropertyBase=xpe;Oe.MethodDeclaration=MD;Oe.MethodDeclarationBase=yR;Oe.MethodDeclarationOverloadBase=Dme;Oe.MethodSignature=QF;Oe.MethodSignatureBase=MR;Oe.ModifierableNode=sf;Oe.ModuleBlock=dw;Oe.ModuleBlockBase=_me;Oe.ModuleChildableNode=yS;Oe.ModuleDeclaration=fw;Oe.ModuleDeclarationBase=fR;Oe.ModuleNamedNode=lpe;Oe.ModuledNode=eq;Oe.NameableNode=Y6;Oe.NamedExports=pw;Oe.NamedExportsBase=gme;Oe.NamedImports=mw;Oe.NamedImportsBase=yme;Oe.NamedNode=mv;Oe.NamedNodeBase=KD;Oe.NamedTupleMember=qw;Oe.NamedTupleMemberBase=wme;Oe.NamespaceExport=_w;Oe.NamespaceExportBase=vme;Oe.NamespaceImport=gw;Oe.NamespaceImportBase=hme;Oe.NewExpression=mM;Oe.NewExpressionBase=Dpe;Oe.NoSubstitutionTemplateLiteral=v6;Oe.NoSubstitutionTemplateLiteralBase=s_e;Oe.Node=Tr;Oe.NodeWithTypeArguments=KT;Oe.NodeWithTypeArgumentsBase=Pme;Oe.NonNullExpression=_M;Oe.NonNullExpressionBase=Cpe;Oe.NotEmittedStatement=XM;Oe.NotEmittedStatementBase=ame;Oe.NotImplementedError=vUe;Oe.NotSupportedError=hUe;Oe.NullLiteral=m6;Oe.NullLiteralBase=n_e;Oe.NumericLiteral=_6;Oe.NumericLiteralBase=i_e;Oe.ObjectBindingPattern=nM;Oe.ObjectDestructuringAssignment=IH;Oe.ObjectDestructuringAssignmentBase=Ape;Oe.ObjectLiteralElement=UT;Oe.ObjectLiteralExpression=yM;Oe.ObjectLiteralExpressionBase=Lpe;Oe.OmittedExpression=bM;Oe.OmittedExpressionBase=Npe;Oe.OutputFile=M6;Oe.OverloadableNode=rG;Oe.OverrideableNode=SL;Oe.ParameterDeclaration=Tw;Oe.ParameterDeclarationBase=gR;Oe.ParameteredNode=upe;Oe.ParenthesizedExpression=SM;Oe.ParenthesizedExpressionBase=Ipe;Oe.ParenthesizedTypeNode=Jw;Oe.PartiallyEmittedExpression=TM;Oe.PartiallyEmittedExpressionBase=Ppe;Oe.PathNotFoundError=EUe;Oe.PostfixUnaryExpression=xM;Oe.PostfixUnaryExpressionBase=Ope;Oe.PrefixUnaryExpression=DM;Oe.PrefixUnaryExpressionBase=kpe;Oe.PrimaryExpression=sd;Oe.PrivateIdentifier=A6;Oe.PrivateIdentifierBase=__e;Oe.Program=K6;Oe.Project=KH;Oe.PropertyAccessExpression=sL;Oe.PropertyAccessExpressionBase=Rpe;Oe.PropertyAssignment=vM;Oe.PropertyAssignmentBase=aR;Oe.PropertyDeclaration=Iw;Oe.PropertyDeclarationBase=SR;Oe.PropertyNamedNode=UE;Oe.PropertySignature=ZF;Oe.PropertySignatureBase=wR;Oe.QualifiedName=L6;Oe.QuestionDotTokenableNode=Q6;Oe.QuestionTokenableNode=Rh;Oe.ReadonlyableNode=TL;Oe.RefactorEditInfo=mL;Oe.ReferenceEntry=F6;Oe.ReferenceFindableNode=kh;Oe.ReferencedSymbol=_L;Oe.ReferencedSymbolDefinitionInfo=gL;Oe.ReferencedSymbolEntry=G6;Oe.RegularExpressionLiteral=g6;Oe.RegularExpressionLiteralBase=a_e;Oe.RenameLocation=B6;Oe.RenameableNode=pv;Oe.ReturnStatement=YM;Oe.ReturnStatementBase=ome;Oe.ReturnTypedNode=rq;Oe.ScopeableNode=cpe;Oe.ScopedNode=_S;Oe.SetAccessorDeclaration=Pw;Oe.SetAccessorDeclarationBase=TR;Oe.ShorthandPropertyAssignment=hM;Oe.ShorthandPropertyAssignmentBase=oR;Oe.Signature=P6;Oe.SignaturedDeclaration=_v;Oe.SourceFile=kE;Oe.SourceFileBase=pR;Oe.SpreadAssignment=EM;Oe.SpreadAssignmentBase=sR;Oe.SpreadElement=CM;Oe.SpreadElementBase=Mpe;Oe.Statement=Cl;Oe.StatementBase=jpe;Oe.StatementedNode=Mh;Oe.StaticableNode=WD;Oe.StringLiteral=y6;Oe.StringLiteralBase=o_e;Oe.Structure=eL;Oe.SuperElementAccessExpression=PH;Oe.SuperElementAccessExpressionBase=wpe;Oe.SuperExpression=AM;Oe.SuperExpressionBase=Fpe;Oe.SuperExpressionedNode=iq;Oe.SuperPropertyAccessExpression=OH;Oe.SuperPropertyAccessExpressionBase=Gpe;Oe.SwitchStatement=QM;Oe.SwitchStatementBase=sme;Oe.Symbol=O6;Oe.SymbolDisplayPart=U6;Oe.SyntaxList=QR;Oe.TaggedTemplateExpression=h6;Oe.TemplateExpression=E6;Oe.TemplateExpressionBase=l_e;Oe.TemplateHead=b6;Oe.TemplateHeadBase=u_e;Oe.TemplateLiteralTypeNode=zw;Oe.TemplateMiddle=S6;Oe.TemplateMiddleBase=c_e;Oe.TemplateSpan=T6;Oe.TemplateSpanBase=d_e;Oe.TemplateTail=x6;Oe.TemplateTailBase=f_e;Oe.TextChange=FE;Oe.TextInsertableNode=ld;Oe.TextRange=tL;Oe.TextSpan=wD;Oe.ThisExpression=LM;Oe.ThisExpressionBase=Bpe;Oe.ThisTypeNode=$w;Oe.ThrowStatement=ZM;Oe.ThrowStatementBase=lme;Oe.TrueLiteral=f6;Oe.TrueLiteralBase=e_e;Oe.TryStatement=ew;Oe.TryStatementBase=ume;Oe.TupleTypeNode=Xw;Oe.Type=vL;Oe.TypeAliasDeclaration=Yw;Oe.TypeAliasDeclarationBase=CR;Oe.TypeArgumentedNode=Z6;Oe.TypeAssertion=NM;Oe.TypeAssertionBase=Upe;Oe.TypeChecker=yL;Oe.TypeElement=wE;Oe.TypeElementMemberedNode=nq;Oe.TypeLiteralNode=Qw;Oe.TypeLiteralNodeBase=Fme;Oe.TypeNode=wc;Oe.TypeOfExpression=IM;Oe.TypeOfExpressionBase=Kpe;Oe.TypeOperatorTypeNode=Zw;Oe.TypeParameter=V6;Oe.TypeParameterDeclaration=eF;Oe.TypeParameterDeclarationBase=AR;Oe.TypeParameteredNode=J_;Oe.TypePredicateNode=rF;Oe.TypeQueryNode=tF;Oe.TypeReferenceNode=nF;Oe.TypedNode=KE;Oe.UnaryExpression=cv;Oe.UnaryExpressionedNode=jD;Oe.UnionTypeNode=iF;Oe.UnwrappableNode=eG;Oe.UpdateExpression=iM;Oe.VariableDeclaration=N6;Oe.VariableDeclarationBase=KR;Oe.VariableDeclarationList=I6;Oe.VariableDeclarationListBase=g_e;Oe.VariableStatement=yw;Oe.VariableStatementBase=mR;Oe.VoidExpression=PM;Oe.VoidExpressionBase=Wpe;Oe.WhileStatement=vw;Oe.WhileStatementBase=Eme;Oe.WithStatement=hw;Oe.WithStatementBase=bme;Oe.Writers=WH;Oe.YieldExpression=OM;Oe.YieldExpressionBase=Vpe;Oe.createWrappedNode=oUe;Oe.forEachStructureChild=A7e;Oe.getCompilerOptionsFromTsConfig=GBe;Oe.getScopeForNode=eM;Oe.insertOverloads=tG;Oe.printNode=lj;Oe.setScopeForNode=tq});var Yg=gt((hYe,sG)=>{var b_e,S_e,T_e,x_e,D_e,C_e,A_e,L_e,N_e,aG,cq,I_e,P_e,O_e,qD,k_e,R_e,M_e,w_e,F_e,G_e,B_e,U_e,K_e,oG;(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 sG=="object"&&typeof sG.exports=="object"?e(n(r,n(sG.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])};b_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)},S_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},T_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},x_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},D_e=function(i,a){return function(s,u){a(s,u,i)}},C_e=function(i,a){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,a)},A_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())})},L_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}}},N_e=function(i,a){for(var s in i)s!=="default"&&!Object.prototype.hasOwnProperty.call(a,s)&&oG(a,i,s)},oG=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]},aG=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},I_e=function(){for(var i=[],a=0;a<arguments.length;a++)i=i.concat(cq(arguments[a]));return i},P_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},O_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)},k_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])}},R_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}},M_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 aG=="function"?aG(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)}},w_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};F_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)&&oG(a,i,s);return n(a,i),a},G_e=function(i){return i&&i.__esModule?i:{default:i}},B_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)},U_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},K_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",b_e),e("__assign",S_e),e("__rest",T_e),e("__decorate",x_e),e("__param",D_e),e("__metadata",C_e),e("__awaiter",A_e),e("__generator",L_e),e("__exportStar",N_e),e("__createBinding",oG),e("__values",aG),e("__read",cq),e("__spread",I_e),e("__spreadArrays",P_e),e("__spreadArray",O_e),e("__await",qD),e("__asyncGenerator",k_e),e("__asyncDelegator",R_e),e("__asyncValues",M_e),e("__makeTemplateObject",w_e),e("__importStar",F_e),e("__importDefault",G_e),e("__classPrivateFieldGet",B_e),e("__classPrivateFieldSet",U_e),e("__classPrivateFieldIn",K_e)})});var W_e=gt(JD=>{"use strict";Object.defineProperty(JD,"__esModule",{value:!0});JD.lowerCase=JD.localeLowerCase=void 0;var bUe={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 SUe(e,r){var n=bUe[r.toLowerCase()];return dq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}JD.localeLowerCase=SUe;function dq(e){return e.toLowerCase()}JD.lowerCase=dq});var QT=gt(lG=>{"use strict";Object.defineProperty(lG,"__esModule",{value:!0});lG.noCase=void 0;var TUe=W_e(),xUe=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],DUe=/[^A-Z0-9]+/gi;function CUe(e,r){r===void 0&&(r={});for(var n=r.splitRegexp,i=n===void 0?xUe:n,a=r.stripRegexp,s=a===void 0?DUe:a,u=r.transform,p=u===void 0?TUe.lowerCase:u,f=r.delimiter,m=f===void 0?" ":f,g=V_e(V_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)}lG.noCase=CUe;function V_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 AUe=Yg(),LUe=QT();function j_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=j_e;function NUe(e){return e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}vS.pascalCaseTransformMerge=NUe;function IUe(e,r){return r===void 0&&(r={}),LUe.noCase(e,AUe.__assign({delimiter:"",transform:j_e},r))}vS.pascalCase=IUe});var q_e=gt(hS=>{"use strict";Object.defineProperty(hS,"__esModule",{value:!0});hS.camelCase=hS.camelCaseTransformMerge=hS.camelCaseTransform=void 0;var PUe=Yg(),pq=fq();function H_e(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransform(e,r)}hS.camelCaseTransform=H_e;function OUe(e,r){return r===0?e.toLowerCase():pq.pascalCaseTransformMerge(e)}hS.camelCaseTransformMerge=OUe;function kUe(e,r){return r===void 0&&(r={}),pq.pascalCase(e,PUe.__assign({transform:H_e},r))}hS.camelCase=kUe});var mq=gt(uG=>{"use strict";Object.defineProperty(uG,"__esModule",{value:!0});uG.upperCaseFirst=void 0;function RUe(e){return e.charAt(0).toUpperCase()+e.substr(1)}uG.upperCaseFirst=RUe});var _q=gt(zD=>{"use strict";Object.defineProperty(zD,"__esModule",{value:!0});zD.capitalCase=zD.capitalCaseTransform=void 0;var MUe=Yg(),wUe=QT(),FUe=mq();function J_e(e){return FUe.upperCaseFirst(e.toLowerCase())}zD.capitalCaseTransform=J_e;function GUe(e,r){return r===void 0&&(r={}),wUe.noCase(e,MUe.__assign({delimiter:" ",transform:J_e},r))}zD.capitalCase=GUe});var z_e=gt($D=>{"use strict";Object.defineProperty($D,"__esModule",{value:!0});$D.upperCase=$D.localeUpperCase=void 0;var BUe={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 UUe(e,r){var n=BUe[r.toLowerCase()];return gq(n?e.replace(n.regexp,function(i){return n.map[i]}):e)}$D.localeUpperCase=UUe;function gq(e){return e.toUpperCase()}$D.upperCase=gq});var $_e=gt(cG=>{"use strict";Object.defineProperty(cG,"__esModule",{value:!0});cG.constantCase=void 0;var KUe=Yg(),WUe=QT(),VUe=z_e();function jUe(e,r){return r===void 0&&(r={}),WUe.noCase(e,KUe.__assign({delimiter:"_",transform:VUe.upperCase},r))}cG.constantCase=jUe});var OL=gt(dG=>{"use strict";Object.defineProperty(dG,"__esModule",{value:!0});dG.dotCase=void 0;var HUe=Yg(),qUe=QT();function JUe(e,r){return r===void 0&&(r={}),qUe.noCase(e,HUe.__assign({delimiter:"."},r))}dG.dotCase=JUe});var X_e=gt(fG=>{"use strict";Object.defineProperty(fG,"__esModule",{value:!0});fG.headerCase=void 0;var zUe=Yg(),$Ue=_q();function XUe(e,r){return r===void 0&&(r={}),$Ue.capitalCase(e,zUe.__assign({delimiter:"-"},r))}fG.headerCase=XUe});var Y_e=gt(pG=>{"use strict";Object.defineProperty(pG,"__esModule",{value:!0});pG.paramCase=void 0;var YUe=Yg(),QUe=OL();function ZUe(e,r){return r===void 0&&(r={}),QUe.dotCase(e,YUe.__assign({delimiter:"-"},r))}pG.paramCase=ZUe});var Q_e=gt(mG=>{"use strict";Object.defineProperty(mG,"__esModule",{value:!0});mG.pathCase=void 0;var eKe=Yg(),rKe=OL();function tKe(e,r){return r===void 0&&(r={}),rKe.dotCase(e,eKe.__assign({delimiter:"/"},r))}mG.pathCase=tKe});var ege=gt(XD=>{"use strict";Object.defineProperty(XD,"__esModule",{value:!0});XD.sentenceCase=XD.sentenceCaseTransform=void 0;var nKe=Yg(),iKe=QT(),aKe=mq();function Z_e(e,r){var n=e.toLowerCase();return r===0?aKe.upperCaseFirst(n):n}XD.sentenceCaseTransform=Z_e;function oKe(e,r){return r===void 0&&(r={}),iKe.noCase(e,nKe.__assign({delimiter:" ",transform:Z_e},r))}XD.sentenceCase=oKe});var rge=gt(_G=>{"use strict";Object.defineProperty(_G,"__esModule",{value:!0});_G.snakeCase=void 0;var sKe=Yg(),lKe=OL();function uKe(e,r){return r===void 0&&(r={}),lKe.dotCase(e,sKe.__assign({delimiter:"_"},r))}_G.snakeCase=uKe});var yq=gt(z_=>{"use strict";Object.defineProperty(z_,"__esModule",{value:!0});var gv=Yg();gv.__exportStar(q_e(),z_);gv.__exportStar(_q(),z_);gv.__exportStar($_e(),z_);gv.__exportStar(OL(),z_);gv.__exportStar(X_e(),z_);gv.__exportStar(QT(),z_);gv.__exportStar(Y_e(),z_);gv.__exportStar(fq(),z_);gv.__exportStar(Q_e(),z_);gv.__exportStar(ege(),z_);gv.__exportStar(rge(),z_)});var Eq=gt((jYe,cKe)=>{cKe.exports={name:"zenstack",publisher:"zenstack",displayName:"ZenStack Language Tools",description:"ZenStack is a toolkit that simplifies full-stack development",version:"0.2.0",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":"pnpm lint && pnpm build && pnpm bundle","vscode:package":"vsce package --no-dependencies",build:"pnpm langium:generate && tsc --noEmit",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:"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 fKe={};XDe(fKe,{default:()=>dKe,generateAction:()=>uge});module.exports=YDe(fKe);var hG=Gs(dQ()),sge=Gs(_Q());var goe=Gs(CE()),poe="AbstractDeclaration";var f6e="Expression";var moe="ReferenceTarget";var zO="TypeDeclaration";var Hx="ArrayExpr";function $O(e){return iv.isInstance(e,Hx)}var tK="Attribute";var yoe="AttributeArg";var SA="BinaryExpr";var XO="DataModel";function Lm(e){return iv.isInstance(e,XO)}var nK="DataModelField";function qx(e){return iv.isInstance(e,nK)}var YO="DataSource";function voe(e){return iv.isInstance(e,YO)}var QO="Enum";function hoe(e){return iv.isInstance(e,QO)}var ZO="EnumField";function Jx(e){return iv.isInstance(e,ZO)}var _oe="Function";var p6e="FunctionParam";var zx="InvocationExpr";function TA(e){return iv.isInstance(e,zx)}var Ub="LiteralExpr";function vh(e){return iv.isInstance(e,Ub)}var Kb="MemberAccessExpr";function iK(e){return iv.isInstance(e,Kb)}var xA="NullExpr";var Wb="ReferenceExpr";function Vb(e){return iv.isInstance(e,Wb)}var $x="ThisExpr";function xT(e){return iv.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(f6e,n);case tK:case YO:case _oe:return this.isSubtype(poe,n);case XO:case QO:return this.isSubtype(poe,n)||this.isSubtype(zO,n);case nK:case ZO:case p6e:return this.isSubtype(moe,n);default:return!1}}getReferenceType(r){let n=`${r.container.$type}:${r.property}`;switch(n){case"AttributeParamType:reference":return zO;case"DataModelAttribute:decl":return tK;case"DataModelFieldAttribute:decl":return tK;case"DataModelFieldType:reference":return zO;case"FunctionParamType:reference":return zO;case"InvocationExpr:function":return _oe;case"MemberAccessExpr:member":return nK;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:[]}}}},iv=new bA;var Eoe=Gs(CE()),ek,boe=()=>ek!=null?ek:ek=(0,Eoe.loadGrammarFromJson)(`{
4253
4253
  "$type": "Grammar",
4254
4254
  "isDeclared": true,
4255
4255
  "name": "ZModel",
@@ -6637,7 +6637,7 @@ Node text: ${this._forgottenText}`),new b.errors.InvalidOperationError(r)}return
6637
6637
  `)+(this.shadowDatabaseUrl?hh(`shadowDatabaseurl=${this.shadowDatabaseUrl}
6638
6638
  `):"")+"}"}},OA=class{constructor(r,n){this.value=r;this.isEnv=n}toString(){return this.isEnv?`env("${this.value}")`:`"${this.value}"`}},pK=class{constructor(r,n,i,a){this.name=r;this.provider=n;this.output=i;this.previewFeatures=a}toString(){var r;return`generator ${this.name} {
6639
6639
  `+hh(`provider = "${this.provider}"
6640
- `)+hh(`output = "${this.output}"
6640
+ `)+hh(`output = ${JSON.stringify(this.output)}
6641
6641
  `)+(this.previewFeatures?hh(`previewFeatures = [${(r=this.previewFeatures)==null?void 0:r.map(n=>'"'+n+'"').join(", ")}]
6642
6642
  `):"")+"}"}},mK=class{constructor(r){this.name=r;this.fields=[];this.attributes=[]}addField(r,n,i=[]){let a=new _K(r,n,i);return this.fields.push(a),a}addAttribute(r,n=[]){let i=new kA(r,n);return this.attributes.push(i),i}toString(){return`model ${this.name} {
6643
6643
  `+hh([...this.fields,...this.attributes].map(r=>r.toString()).join(`
@@ -6645,7 +6645,7 @@ Node text: ${this._forgottenText}`),new b.errors.InvalidOperationError(r)}return
6645
6645
  }`}},sk=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(", ")+")"}},RA=class{constructor(r,n){this.name=r;this.value=n}toString(){return this.name?`${this.name}: ${this.value}`:this.value.toString()}},Eh=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 MA))throw new Error("Value must be string or FieldReference");break;case"FunctionCall":if(!(n instanceof wA))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}`)}}},MA=class{constructor(r,n=[]){this.field=r;this.args=n}},lk=class{constructor(r,n){this.name=r;this.value=n}toString(){return`${this.name}: ${this.value}`}},wA=class{constructor(r,n=[]){this.func=r;this.args=n}toString(){return`${this.func}(`+this.args.map(r=>r.toString()).join(", ")+")"}},uk=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
  `+hh(this.fields.join(`
6647
6647
  `))+`
6648
- }`}};var gse=["@@allow","@@deny"],FA=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let{schema:r}=this.context,n=new ok;for(let a of r.declarations)switch(a.$type){case YO:this.generateDataSource(n,a);break;case QO:this.generateEnum(n,a);break;case XO: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 RA(void 0,new Eh("Boolean",!0))])]),i.addField(fse,"String?");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 sk(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 RA(r.name,this.makeAttributeArgValue(r.value))}makeAttributeArgValue(r){if(vh(r))switch(typeof r.value){case"string":return new Eh("String",r.value);case"number":return new Eh("Number",r.value);case"boolean":return new Eh("Boolean",r.value);default:throw new eu(`Unexpected literal type: ${typeof r.value}`)}else{if($O(r))return new Eh("Array",new Array(...r.items.map(n=>this.makeAttributeArgValue(n))));if(Vb(r))return new Eh("FieldReference",new MA(AT(r.target).name,r.args.map(n=>new lk(n.name,n.value))));if(TA(r))return new Eh("FunctionCall",this.makeFunctionCall(r));throw new eu(`Unsupported attribute argument expression type: ${r.$type}`)}}makeFunctionCall(r){return new wA(AT(r.function).name,r.args.map(n=>{if(!vh(n.value))throw new eu("Function call argument must be literal");return new uk(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 vh(r)&&typeof r.value=="string"}};var y_e=Gs(require("path")),LL=Gs(DL());var CL=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 AL=class{constructor(r){this.writer=r;this.plainExprBuilder=new CL}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:iK(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(iK(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 NL=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let r=new LL.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.filter(s=>{var u;return Lm((u=s.type.reference)==null?void 0:u.ref)}).map(s=>[s.name,{type:AT(s.type.reference).name,isArray:s.type.array}]))]));n.addVariableStatement({isExported:!0,declarationKind:LL.VariableDeclarationKind.Const,declarations:[{name:"_fieldMapping",initializer:JSON.stringify(i)}]})}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(!vh(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;"),a.addVariableStatement({declarationKind:LL.VariableDeclarationKind.Const,declarations:[{name:"r",initializer:s=>{let u=new AL(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 IL=class{generate(r){return Au(this,null,function*(){let n=yield new FA(r).generate();yield this.generatePrismaClient(n),yield new NL(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"],FA=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let{schema:r}=this.context,n=new ok;for(let a of r.declarations)switch(a.$type){case YO:this.generateDataSource(n,a);break;case QO:this.generateEnum(n,a);break;case XO: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 RA(void 0,new Eh("Boolean",!0))])]),i.addField(fse,"String?");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 sk(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 RA(r.name,this.makeAttributeArgValue(r.value))}makeAttributeArgValue(r){if(vh(r))switch(typeof r.value){case"string":return new Eh("String",r.value);case"number":return new Eh("Number",r.value);case"boolean":return new Eh("Boolean",r.value);default:throw new eu(`Unexpected literal type: ${typeof r.value}`)}else{if($O(r))return new Eh("Array",new Array(...r.items.map(n=>this.makeAttributeArgValue(n))));if(Vb(r))return new Eh("FieldReference",new MA(AT(r.target).name,r.args.map(n=>new lk(n.name,n.value))));if(TA(r))return new Eh("FunctionCall",this.makeFunctionCall(r));throw new eu(`Unsupported attribute argument expression type: ${r.$type}`)}}makeFunctionCall(r){return new wA(AT(r.function).name,r.args.map(n=>{if(!vh(n.value))throw new eu("Function call argument must be literal");return new uk(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 vh(r)&&typeof r.value=="string"}};var y_e=Gs(require("path")),LL=Gs(DL());var CL=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 AL=class{constructor(r){this.writer=r;this.plainExprBuilder=new CL}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:iK(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(iK(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 NL=class{constructor(r){this.context=r}generate(){return Au(this,null,function*(){let r=new LL.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.filter(s=>{var u;return Lm((u=s.type.reference)==null?void 0:u.ref)}).map(s=>[s.name,{type:AT(s.type.reference).name,isArray:s.type.array}]))]));n.addVariableStatement({isExported:!0,declarationKind:LL.VariableDeclarationKind.Const,declarations:[{name:"_fieldMapping",initializer:JSON.stringify(i)}]})}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(!vh(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;"),a.addVariableStatement({declarationKind:LL.VariableDeclarationKind.Const,declarations:[{name:"r",initializer:s=>{let u=new AL(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 IL=class{generate(r){return Au(this,null,function*(){let n=yield new FA(r).generate();yield this.generatePrismaClient(n),yield new NL(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 HD=Gs(DL()),h_e=Gs(require("path")),E_e=Gs(Hb());var PL=class{generate(r){return Au(this,null,function*(){let n=new HD.Project,i=n.createSourceFile(h_e.join(r.generatedCodeDir,"src/index.ts"),void 0,{overwrite:!0});i.addImportDeclaration({namedImports:["PrismaClient"],moduleSpecifier:"../.prisma"}),i.addImportDeclaration({namedImports:["Service","PolicyOperationKind","QueryContext"],moduleSpecifier:rD,isTypeOnly:!0}),i.addVariableStatement({declarationKind:HD.VariableDeclarationKind.Let,declarations:[{name:"guardModule",type:"any"}]});let a=i.addClass({name:"ZenStackService",isExported:!0,implements:["Service<PrismaClient>"]});a.addMember({kind:HD.StructureKind.Property,name:"private readonly _prisma",initializer:"new PrismaClient()"}),a.addGetAccessor({name:"db"}).addBody().setBodyText("return this._prisma;"),a.addMethod({name:"resolveField",isAsync:!0,parameters:[{name:"model",type:"string"},{name:"field",type:"string"}]}).addBody().setBodyText(`
6650
6650
  if (!guardModule) {
6651
6651
  guardModule = await import('./query/guard');