@magic5644/graph-it-live 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +88 -17
- package/dist/astWorker.js +1 -1
- package/dist/graph-it.js +193 -173
- package/dist/indexerWorker.js +140 -140
- package/dist/mcpWorker.js +138 -138
- package/dist/queries/csharp.scm +95 -0
- package/dist/queries/go.scm +70 -0
- package/dist/queries/java.scm +71 -0
- package/dist/wasm/tree-sitter-c_sharp.wasm +0 -0
- package/dist/wasm/tree-sitter-go.wasm +0 -0
- package/dist/wasm/tree-sitter-java.wasm +0 -0
- package/package.json +18 -18
package/dist/astWorker.js
CHANGED
|
@@ -42155,7 +42155,7 @@ Node text: ${this.#t}`),new E.errors.InvalidOperationError(o)}return this.#e}con
|
|
|
42155
42155
|
`)}getTags(){return this.compilerNode.tags?.map(o=>this._getNodeFromCompilerNode(o))??[]}getInnerText(){return tDe(this.getText())}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(o=>this._getNodeFromCompilerNodeIfExists(o))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:E.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){let o=this.getSourceFile().getFullText(),u=this.getTags()[0]?.getStart()??this.getEnd()-2,b=x(this);return tDe(o.substring(b,Math.max(b,k())));function x(j){let fe=j.getStart()+3;return o.charCodeAt(fe)===Tf.SPACE?fe+1:fe}function k(){let j=Ax(o,u,fe=>fe===Tf.NEWLINE||!E.StringUtils.isWhitespaceCharCode(fe)&&fe!==Tf.ASTERISK);return Ax(o,j,fe=>fe!==Tf.NEWLINE&&fe!==Tf.CARRIAGE_RETURN)}}setDescription(o){let u=this.getTags(),b=this.getStart()+3,x=u.length>0?Ax(this._sourceFile.getFullText(),u[0].getStart(),j=>j===Tf.ASTERISK)-1:this.getEnd()-2;return ZLt({parent:this,newText:k.call(this),replacePos:b,replacingLength:x-b}),this;function k(){let j=this.getIndentationText(),fe=this._context.manipulationSettings.getNewLineKindAsString(),ke=JE(this._getWriter(),o).split(/\r?\n/),tt=ke[0].length===0,ot=ke.length===1&&(this.compilerNode.tags?.length??0)===0,ut=ot?ke[0]:ke.map(xe=>xe.length===0?`${j} *`:`${j} * ${xe}`).slice(tt?1:0).join(fe);return ot?" "+ut+" ":fe+ut+fe+j+" "}}addTag(o){return this.addTags([o])[0]}addTags(o){return this.insertTags(this.compilerNode.tags?.length??0,o)}insertTag(o,u){return this.insertTags(o,[u])[0]}insertTags(o,u){if(E.ArrayUtils.isNullOrEmpty(u))return[];let b=this._getWriterWithQueuedIndentation(),x=this.getTags();if(o=Lp(o,x.length),x.length===0&&!this.isMultiLine()){let fe=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(ke=>{fe.printText(ke,{description:this.getDescription(),tags:u})})}else{let fe=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});b.newLine().write(" * "),fe.printTexts(b,u),b.newLine().write(" *"),b.conditionalWrite(o<x.length," ");let ke=k.call(this),tt=j.call(this);pa({parent:this,insertPos:ke,replacing:{textLength:tt-ke},newText:b.toString()})}return uh(x,this.getTags(),o,!1);function k(){let fe=o<x.length?x[o].getStart():this.getEnd()-2,ke=this.getStart()+3;return Math.max(ke,Ax(this.getSourceFile().getFullText(),fe,tt=>!E.StringUtils.isWhitespaceCharCode(tt)&&tt!==Tf.ASTERISK))}function j(){return o<x.length?x[o].getStart():this.getEnd()-1}}remove(){mc({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(o){return ja(bee.prototype,this,o),o.tags!=null?this.replaceWithText(u=>{this._context.structurePrinterFactory.forJSDoc().printText(u,{description:o.description??this.getDescription(),tags:o.tags})}):(o.description!=null&&this.setDescription(o.description),this)}getStructure(){return ts(bee.prototype,this,{kind:te.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(o=>o.getStructure())})}},Ef=class extends yn{},xqe=toe(Ef),nw=class extends xqe{},Nne=class extends Ef{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},Rne=class extends Ef{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)}},Aqe=Px(Ef),j5=class extends Aqe{},Dqe=dR(M_(j5)),Mne=class extends Dqe{},Iqe=cw(nw),Lne=class extends Iqe{},Cqe=cT(j5),kne=class extends Cqe{},wne=class extends nw{setArgument(o){let u=this.getArgument();if(yn.isLiteralTypeNode(u)){let b=u.getLiteral();if(yn.isStringLiteral(b))return b.setLiteralValue(o),this}return u.replaceWithText(b=>b.quote(o),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(o){let u=this.getQualifier();if(u!=null)u.replaceWithText(o,this._getWriterWithQueuedChildIndentation());else{let b=this.getFirstChildByKindOrThrow(E.SyntaxKind.CloseParenToken);pa({insertPos:b.getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(o).toString()})}return this}getQualifierOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getQualifier(),o??(()=>`Expected to find a qualifier for the import type: ${this.getText()}`),this)}getQualifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.qualifier)}getAttributes(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes)}getAttributesOrThrow(o){return E.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes),o??"Could not find import type assertion container.",this)}},One=class extends Ef{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},Fne=class extends Ef{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},Wne=class extends Ef{getTypeNodes(){return this.compilerNode.types.map(o=>this._getNodeFromCompilerNode(o))}},Bne=class extends Ef{getLiteral(){let o=this.compilerNode.literal;return this._getNodeFromCompilerNode(o)}},zne=class extends Ef{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getNameTypeNode(),o??"Type did not exist.",this)}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getReadonlyToken(),o??"Readonly token did not exist.",this)}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getQuestionToken(),o??"Question token did not exist.",this)}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getTypeNode(),o??"Type did not exist, but was expected to exist.",this)}},Dwt=h=>V1(G1(Y5(Jp(z1(h))))),Pqe=Dwt(Ef),Gne=class extends Pqe{getTypeNode(){return super.getTypeNode()}removeType(){throw new E.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},Vne=class extends Ef{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},jne=class extends Ef{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(o){return this.getTypeNode().replaceWithText(o),this}},Une=class extends Ef{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},Hne=class extends Ef{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(o=>this._getNodeFromCompilerNode(o))}setLiteralValue(o){let u=this.getChildIndex(),b=this.getParentSyntaxList()??this.getParentOrThrow();return lR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:o}),b.getChildAtIndex(u)}},Kne=class extends Ef{},Jne=class extends Ef{getElements(){return this.compilerNode.elements.map(o=>this._getNodeFromCompilerNode(o))}},Iwt=h=>cT(V1(Jp(O1(F1(M_(z1(h))))))),See=Iwt(Vd),qne=class extends See{set(o){return ja(See.prototype,this,o),this}getStructure(){return ts(See.prototype,this,{kind:te.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},Nqe=EDe(Ef),Xne=class extends Nqe{},$ne=class extends Ef{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}};te.TypeParameterVariance=void 0;(function(h){h[h.None=0]="None",h[h.In=1]="In",h[h.Out=2]="Out",h[h.InOut=3]="InOut"})(te.TypeParameterVariance||(te.TypeParameterVariance={}));var Cwt=h=>M_(z1(h)),Tee=Cwt(yn),Yne=class extends Tee{isConst(){return this.hasModifier(E.SyntaxKind.ConstKeyword)}setIsConst(o){return this.toggleModifier("const",o)}getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected to find the type parameter's constraint.",this)}setConstraint(o){if(o=this.getParentOrThrow()._getTextWithQueuedChildIndentation(o),E.StringUtils.isNullOrWhitespace(o))return this.removeConstraint(),this;let u=this.getConstraint();if(u!=null)return u.replaceWithText(o),this;let b=this.getNameNode();return pa({parent:this,insertPos:b.getEnd(),newText:` extends ${o}`}),this}removeConstraint(){return yKe(this.getConstraint(),E.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getDefault(),o??"Expected to find the type parameter's default.",this)}setDefault(o){if(o=this.getParentOrThrow()._getTextWithQueuedChildIndentation(o),E.StringUtils.isNullOrWhitespace(o))return this.removeDefault(),this;let u=this.getDefault();if(u!=null)return u.replaceWithText(o),this;let b=this.getConstraint()||this.getNameNode();return pa({parent:this,insertPos:b.getEnd(),newText:` = ${o}`}),this}removeDefault(){return yKe(this.getDefault(),E.SyntaxKind.EqualsToken),this}setVariance(o){return this.toggleModifier("in",(o&te.TypeParameterVariance.In)!==0),this.toggleModifier("out",(o&te.TypeParameterVariance.Out)!==0),this}getVariance(){let o=te.TypeParameterVariance.None;return this.hasModifier(E.SyntaxKind.InKeyword)&&(o|=te.TypeParameterVariance.In),this.hasModifier(E.SyntaxKind.OutKeyword)&&(o|=te.TypeParameterVariance.Out),o}remove(){let o=this.getParentSyntaxListOrThrow();o.getChildrenOfKind(E.SyntaxKind.TypeParameter).length===1?b():Ix(this);function b(){let x=[o.getPreviousSiblingIfKindOrThrow(E.SyntaxKind.LessThanToken),o,o.getNextSiblingIfKindOrThrow(E.SyntaxKind.GreaterThanToken)];mc({children:x})}}set(o){return ja(Tee.prototype,this,o),o.isConst!=null&&this.setIsConst(o.isConst),o.constraint!=null?this.setConstraint(o.constraint):o.hasOwnProperty(E.nameof(o,"constraint"))&&this.removeConstraint(),o.default!=null?this.setDefault(o.default):o.hasOwnProperty(E.nameof(o,"default"))&&this.removeDefault(),o.variance!=null&&this.setVariance(o.variance),this}getStructure(){let o=this.getConstraint(),u=this.getDefault();return ts(Tee.prototype,this,{kind:te.StructureKind.TypeParameter,isConst:this.isConst(),constraint:o?.getText({trimLeadingIndentation:!0}),default:u?u.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}};function yKe(h,o){h!=null&&mc({children:[h.getPreviousSiblingIfKindOrThrow(o),h],removePrecedingSpaces:!0})}var Qne=class extends Ef{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return this.compilerNode.assertsModifier!=null}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getAssertsModifier(),o??"Expected to find an asserts modifier.",this)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getTypeNode(),o??"Expected to find a type node.",this)}},Zne=class extends nw{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},ere=class extends nw{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},tre=class extends Ef{getTypeNodes(){return this.compilerNode.types.map(o=>this._getNodeFromCompilerNode(o))}},lT=class extends Ef{},nre=class extends lT{},Eee=yn,fp=class extends Eee{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(o){return this.set({tagName:o})}getComment(){if(this.compilerNode.comment!=null)return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:this.compilerNode.comment.map(o=>this._getNodeFromCompilerNodeIfExists(o))}getCommentText(){return typeof this.compilerNode.comment=="string"?this.compilerNode.comment:E.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let o=this.getParentOrThrow().getStart()+3,u=Lqe(this),b=u==null,x=k.call(this);mc({children:[this],customRemovalPos:x,customRemovalEnd:Mqe(this,u),replaceTrivia:j.call(this)});function k(){return Math.max(o,kqe(this,this.getStart()))}function j(){if(x===o&&b)return"";let fe=this._context.manipulationSettings.getNewLineKindAsString(),ke=this.getParentOrThrow().getIndentationText();return`${fe}${ke} `+(b?"":"* ")}}set(o){return ja(Eee.prototype,this,o),o.text!=null||o.tagName!=null?this.replaceWithText(u=>{this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(u,{tagName:o.tagName??this.getTagName(),text:o.text!=null?o.text:vKe(this)})}):this}replaceWithText(o){let u=JE(this._getWriterWithQueuedIndentation(),o),b=this.getParentOrThrow(),x=this.getChildIndex(),k=this.getStart();return pa({parent:b,insertPos:k,newText:u,replacing:{textLength:Rqe(this)-k}}),b.getChildren()[x]}getStructure(){let o=vKe(this);return ts(Eee.prototype,this,{kind:te.StructureKind.JSDocTag,tagName:this.getTagName(),text:o.length===0?void 0:o})}};function vKe(h){let o=h.getSourceFile().getFullText(),u=h.getTagNameNode().getEnd(),b=Rqe(h),x=Math.min(o.charCodeAt(u)===Tf.SPACE?u+1:u,b);return tDe(o.substring(x,b))}function Rqe(h){return kqe(h,Mqe(h))}function Mqe(h,o){return o=o??Lqe(h),o!=null?o.getStart():h.getParentOrThrow().getEnd()-2}function Lqe(h){let u=h.getParentIfKindOrThrow(E.SyntaxKind.JSDoc).getTags(),b=u.indexOf(h);return u[b+1]}function kqe(h,o){let u=h.getSourceFile().getFullText();return Ax(u,o,b=>b!==Tf.ASTERISK&&!E.StringUtils.isWhitespaceCharCode(b))}var rre=class extends fp{},ire=class extends fp{},ore=class extends fp{},are=class extends fp{},sre=class extends fp{},lre=class extends fp{},wqe=Px(lT),cre=class extends wqe{},dre=class extends fp{},ure=class extends fp{},pre=class extends yn{},fre=class extends yn{},mre=class extends yn{},_re=class extends yn{},hre=class extends lT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},gre=class extends yn{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},yre=class extends lT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},vre=class extends lT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},bre=class extends lT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},Oqe=uw(fp),Sre=class extends Oqe{},Tre=class extends fp{},Fqe=DDe(fp),Ere=class extends Fqe{},xre=class extends fp{},Wqe=DDe(fp),Are=class extends Wqe{},Dre=class extends fp{},Ire=class extends fp{},Cre=class extends fp{},Bqe=uw(fp),Pre=class extends Bqe{},zqe=uw(fp),Nre=class extends zqe{},Gqe=uw(fp),Rre=class extends Gqe{},Mre=class extends lT{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},U5=class{#e;constructor(o){this.#e=o}get compilerObject(){return this.#e}getName(){return this.compilerObject.name}getText(){return this.compilerObject.text??[]}},Vqe=Eqe(fp),Lre=class extends Vqe{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected to find the JS doc template tag's constraint.",this)}},kre=class extends yn{},jqe=uw(fp),wre=class extends jqe{},Uqe=uw(fp),Ore=class extends Uqe{},Fre=class extends fp{},Wre=class extends Ef{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},Bre=class extends lT{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(o=>this._getNodeFromCompilerNode(o)):void 0}},zre=class extends fp{getTypeExpression(){let o=this.compilerNode.typeExpression;if(!(o!=null&&o.pos===o.end))return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},Gre=class extends fp{},Vre=class extends lT{},jre=class extends lT{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},Ure=class extends yn{remove(){k1({children:[this],getSiblingFormatting:()=>Rd.Newline})}},Pwt=h=>u_(uR(Jp(O1(F1(M_(z1(h))))))),xee=Pwt(Vd),Hre=class extends xee{set(o){return ja(xee.prototype,this,o),o.isConst!=null&&this.setIsConstEnum(o.isConst),o.members!=null&&(this.getMembers().forEach(u=>u.remove()),this.addMembers(o.members)),this}addMember(o){return this.addMembers([o])[0]}addMembers(o){return this.insertMembers(this.getMembers().length,o)}insertMember(o,u){return this.insertMembers(o,[u])[0]}insertMembers(o,u){if(u.length===0)return[];let b=this.getMembersWithComments();o=Lp(o,b.length);let x=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(x,u),sT({parent:this.getChildSyntaxListOrThrow(),currentNodes:b,insertIndex:o,newText:x.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),uh(b,this.getMembersWithComments(),o,!j());function j(){return u instanceof Array?u.every(fe=>typeof fe=="object"):!1}}getMember(o){return Mp(this.getMembers(),o)}getMemberOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getMember(o),()=>Xu("enum member",o))}getMembers(){return this.compilerNode.members.map(o=>this._getNodeFromCompilerNode(o))}getMembersWithComments(){let o=this.compilerNode;return Fm.getContainerArray(o,this.getSourceFile().compilerNode).map(u=>this._getNodeFromCompilerNode(u))}setIsConstEnum(o){return this.toggleModifier("const",o)}isConstEnum(){return this.getConstKeyword()!=null}getConstKeyword(){return this.getFirstModifierByKind(E.SyntaxKind.ConstKeyword)}getStructure(){return ts(xee.prototype,this,{kind:te.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(o=>o.getStructure())})}},Nwt=h=>Jp(lw(yC(h))),Aee=Nwt(yn),Kre=class extends Aee{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(o){let u;if(typeof o=="string"){let b=this._context.manipulationSettings.getQuoteKind();u=b+E.StringUtils.escapeForWithinString(o,b)+b}else u=o.toString();return this.setInitializer(u),this}remove(){let o=[this],u=this.getNextSiblingIfKind(E.SyntaxKind.CommaToken);u!=null&&o.push(u),k1({children:o,getSiblingFormatting:()=>Rd.Newline})}set(o){return ja(Aee.prototype,this,o),o.value!=null?this.setValue(o.value):o.hasOwnProperty(E.nameof(o,"value"))&&o.initializer==null&&this.removeInitializer(),this}getStructure(){return ts(Aee.prototype,this,{kind:te.StructureKind.EnumMember,value:void 0})}},Jre=class extends yn{getTypeNodes(){return this.compilerNode.types?.map(o=>this._getNodeFromCompilerNode(o))??[]}getToken(){return this.compilerNode.token}removeExpression(o){let u=this.getTypeNodes(),b=typeof o=="number"?x(o):o;if(u.length===1){let k=this.getParentSyntaxListOrThrow().getChildren();k.length===1?mc({children:[k[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):mc({children:[this],removePrecedingSpaces:!0})}else Ix(b);return this;function x(k){return u[Lp(k,u.length-1)]}}},hC=class extends yn{remove(){BKe(this)}},Rwt=h=>cT(Dv(Jp(Px(h)))),Dee=Rwt(hC),qre=class extends Dee{set(o){return ja(Dee.prototype,this,o),this}getStructure(){return ts(Dee.prototype,this,{kind:te.StructureKind.CallSignature})}},Xre=class extends hC{},Mwt=h=>cT(Dv(Jp(Px(h)))),Iee=Mwt(hC),$re=class extends Iee{set(o){return ja(Iee.prototype,this,o),this}getStructure(){return ts(Iee.prototype,this,{kind:te.StructureKind.ConstructSignature})}},Lwt=h=>SDe(Dv(Jp(e9(M_(h))))),Cee=Lwt(hC),Yre=class extends Cee{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(o){E.errors.throwIfWhitespaceOrNotString(o,"name"),this.getKeyName()!==o&&this.getKeyNameNode().replaceWithText(o,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let o=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(o.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(o){E.errors.throwIfWhitespaceOrNotString(o,"type");let u=this.getKeyTypeNode();return u.getText()===o?this:(u.replaceWithText(o,this._getWriterWithQueuedChildIndentation()),this)}getKeyTypeNode(){let o=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(o.type)}set(o){return ja(Cee.prototype,this,o),o.keyName!=null&&this.setKeyName(o.keyName),o.keyType!=null&&this.setKeyType(o.keyType),this}getStructure(){let o=this.getKeyTypeNode();return ts(Cee.prototype,this,{kind:te.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:o.getText()})}},kwt=h=>EDe(u_(YKe(vDe(cT(Jp(O1(uR(F1(M_(z1(h))))))))))),Pee=kwt(Vd),Qre=class extends Pee{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return this.getType().getBaseTypes().map(o=>o.getSymbol()?.getDeclarations()??[]).flat()}getImplementations(){return this.getNameNode().getImplementations()}set(o){return ja(Pee.prototype,this,o),this}getStructure(){return ts(Pee.prototype,this,{kind:te.StructureKind.Interface})}},wwt=h=>Dv(Jp(G1(cT(Px(yC(h)))))),Nee=wwt(hC),Zre=class extends Nee{set(o){return ja(Nee.prototype,this,o),this}getStructure(){return ts(Nee.prototype,this,{kind:te.StructureKind.MethodSignature})}},Owt=h=>Dv(Jp(e9(G1(lw(V1(yC(M_(h)))))))),Ree=Owt(hC),eie=class extends Ree{set(o){return ja(Ree.prototype,this,o),this}getStructure(){return ts(Ree.prototype,this,{kind:te.StructureKind.PropertySignature})}};function IDe(h){return class extends h{getAttributes(){return this.compilerNode.attributes.properties.map(o=>this._getNodeFromCompilerNode(o))}getAttributeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getAttribute(o),()=>Xu("attribute",o))}getAttribute(o){return Mp(this.getAttributes(),o)}addAttribute(o){return this.addAttributes([o])[0]}addAttributes(o){return this.insertAttributes(this.compilerNode.attributes.properties.length,o)}insertAttribute(o,u){return this.insertAttributes(o,[u])[0]}insertAttributes(o,u){if(u.length===0)return[];let b=this.compilerNode.attributes.properties.length;o=Lp(o,b);let x=o===0?this.getTagNameNode().getEnd():this.getAttributes()[o-1].getEnd(),k=this._getWriterWithQueuedChildIndentation();return new t1e(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(k,u),pa({insertPos:x,newText:" "+k.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(E.SyntaxKind.SyntaxList)}),uh(b,this.getAttributes(),o,!1)}set(o){return ja(h.prototype,this,o),o.attributes!=null&&(this.getAttributes().forEach(u=>u.remove()),this.addAttributes(o.attributes)),this}getStructure(){return ts(h.prototype,this,{attributes:this.getAttributes().map(o=>o.getStructure())})}}}function ooe(h){return class extends h{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(o){return ja(h.prototype,this,o),o.name!=null&&this.getTagNameNode().replaceWithText(o.name),this}getStructure(){return ts(h.prototype,this,{name:this.getTagNameNode().getText()})}}}function CDe(h){return class extends h{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(o=>o.getDeclarationNode()).filter(o=>o!=null)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}var Hqe=Wm(yn),tie=class extends Hqe{},Kqe=CDe(B1(Cx(d_))),H5=class extends Kqe{getImplementations(){return this._context.languageService.getImplementations(this)}},Jqe=CDe(B1(Cx(yn))),nie=class extends Jqe{},rie=class extends yn{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},Mee=yn,iie=class extends Mee{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}setName(o){return this.getNameNode().replaceWithText(u=>{typeof o=="object"?this._context.structurePrinterFactory.forJsxNamespacedName().printText(u,o):u.write(o)}),this}getInitializerOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getInitializer(),o??`Expected to find an initializer for the JSX attribute '${this.getNameNode().getText()}'`,this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(o){let u=JE(this._getWriterWithQueuedIndentation(),o);if(E.StringUtils.isNullOrWhitespace(u))return this.removeInitializer(),this;let b=this.getInitializer();return b!=null?(b.replaceWithText(u),this):(pa({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${u}`}),this)}removeInitializer(){let o=this.getInitializer();return o==null?this:(mc({children:[o.getPreviousSiblingIfKindOrThrow(E.SyntaxKind.EqualsToken),o],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this)}remove(){mc({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(o){return ja(Mee.prototype,this,o),o.name!=null&&this.setName(o.name),o.initializer!=null?this.setInitializer(o.initializer):o.hasOwnProperty(E.nameof(o,"initializer"))&&this.removeInitializer(),this}getStructure(){let o=this.getInitializer(),u=this.getNameNode();return ts(Mee.prototype,this,{name:u instanceof H5?u.getText():u.getStructure(),kind:te.StructureKind.JsxAttribute,initializer:o?.getText()})}},Fwt=h=>ooe(h),qqe=Fwt(yn),oie=class extends qqe{},aie=class extends Kp{},Lee=d_,sie=class extends Lee{getJsxChildren(){return this.compilerNode.children.map(o=>this._getNodeFromCompilerNode(o))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(o){let u=HKe(this._getWriterWithIndentation(),o);return bKe(this,u),this}setBodyTextInline(o){let u=this._getWriterWithQueuedChildIndentation();return gC(u,o),u.isLastNewLine()&&(u.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),u.write("")),bKe(this,u.toString()),this}set(o){if(ja(Lee.prototype,this,o),o.attributes!=null){let u=this.getOpeningElement();u.getAttributes().forEach(b=>b.remove()),u.addAttributes(o.attributes)}if(o.children!=null)throw new E.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return o.bodyText!=null?this.setBodyText(o.bodyText):o.hasOwnProperty(E.nameof(o,"bodyText"))&&this.setBodyTextInline(""),o.name!=null&&(this.getOpeningElement().getTagNameNode().replaceWithText(o.name),this.getClosingElement().getTagNameNode().replaceWithText(o.name)),this}getStructure(){let o=this.getOpeningElement(),u=ts(Lee.prototype,this,{kind:te.StructureKind.JsxElement,name:o.getTagNameNode().getText(),attributes:o.getAttributes().map(b=>b.getStructure()),children:void 0,bodyText:_De(this)});return delete u.children,u}};function bKe(h,o){let u=h.getOpeningElement(),b=h.getClosingElement();pa({insertPos:u.getEnd(),newText:o,parent:h.getChildSyntaxListOrThrow(),replacing:{textLength:b.getStart()-u.getEnd()}})}var Xqe=t9(Y5(Kp)),lie=class extends Xqe{},cie=class extends d_{getJsxChildren(){return this.compilerNode.children.map(o=>this._getNodeFromCompilerNode(o))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},$qe=yn,die=class extends $qe{getNamespaceNode(){return this._getNodeFromCompilerNode(this.compilerNode.namespace)}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}set(o){return this.getNamespaceNode().replaceWithText(o.namespace),this.getNameNode().replaceWithText(o.name),this}getStructure(){return{namespace:this.getNamespaceNode().getText(),name:this.getNameNode().getText()}}},Wwt=h=>IDe(ooe(h)),Yqe=Wwt(Kp),uie=class extends Yqe{},pie=class extends Kp{},Bwt=h=>IDe(ooe(h)),kee=Bwt(d_),fie=class extends kee{set(o){return ja(kee.prototype,this,o),this}getStructure(){return ts(kee.prototype,this,{kind:te.StructureKind.JsxSelfClosingElement})}},wee=Wm(yn),mie=class extends wee{remove(){mc({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(o){return ja(wee.prototype,this,o),o.expression!=null&&this.setExpression(o.expression),this}getStructure(){return ts(wee.prototype,this,{kind:te.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},Qqe=K8(yn),_ie=class extends Qqe{containsOnlyTriviaWhiteSpaces(){let o=this.compilerNode;return typeof o.containsOnlyWhiteSpaces=="boolean"?o.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},Zqe=aR,hie=class extends Zqe{getLiteralValue(){let o=this.compilerNode.text;if(typeof BigInt>"u")throw new E.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");let u=o.substring(0,o.length-1);return BigInt(u)}setLiteralValue(o){if(typeof o!="bigint")throw new E.errors.ArgumentTypeError("value","bigint",typeof o);return lR({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:o.toString()+"n"}),this}},eXe=d_,gie=class extends eXe{getLiteralValue(){return PDe(this)}setLiteralValue(o){return nXe(this,o)}},tXe=d_,yie=class extends tXe{getLiteralValue(){return PDe(this)}setLiteralValue(o){return nXe(this,o)}};function nXe(h,o){if(PDe(h)===o)return h;let u=h.getParentSyntaxList()||h.getParentOrThrow(),b=h.getChildIndex();return h.replaceWithText(o?"true":"false"),u.getChildAtIndex(b)}function PDe(h){return h.getKind()===E.SyntaxKind.TrueKeyword}var rXe=d_,vie=class extends rXe{},iXe=aR,bie=class extends iXe{getLiteralValue(){let o=this.compilerNode.text;return o.indexOf(".")>=0?parseFloat(o):parseInt(o,10)}setLiteralValue(o){return lR({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:o.toString(10)}),this}};te.QuoteKind=void 0;(function(h){h.Single="'",h.Double='"'})(te.QuoteKind||(te.QuoteKind={}));var oXe=aR,Sie=class extends oXe{getLiteralValue(){let o=/^\/(.*)\/([^\/]*)$/,u=this.compilerNode.text,b=o.exec(u);return new RegExp(b[1],b[2])}setLiteralValue(o,u){let b;return typeof o=="string"?b=o:(b=o.source,u=o.flags),lR({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${b}/${u||""}`}),this}},aXe=aR,Tie=class extends aXe{getLiteralValue(){return this.compilerNode.text}setLiteralValue(o){return lR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:E.StringUtils.escapeForWithinString(o,this.getQuoteKind())}),this}getQuoteKind(){return this.getText()[0]==="'"?te.QuoteKind.Single:te.QuoteKind.Double}},sXe=aR,Eie=class extends sXe{getLiteralValue(){return this.compilerNode.text}setLiteralValue(o){let u=this.getChildIndex(),b=this.getParentSyntaxList()||this.getParentOrThrow();return lR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:o}),b.getChildAtIndex(u)}},xie=class extends ew{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){let o=this.getParentSyntaxList()??this.getParentOrThrow(),u=this.getChildIndex(),b=this.getTemplate();return pa({customMappings:(x,k)=>[{currentNode:b,newNode:x.getChildren(k)[u]}],parent:o,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),o.getChildAtIndex(u)}},lXe=d_,Aie=class extends lXe{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(o=>this._getNodeFromCompilerNode(o))}setLiteralValue(o){let u=this.getChildIndex(),b=this.getParentSyntaxList()??this.getParentOrThrow();return lR({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:o}),b.getChildAtIndex(u)}},cXe=K8(yn),Die=class extends cXe{},dXe=K8(yn),Iie=class extends dXe{},uXe=Wm(yn),Cie=class extends uXe{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},pXe=K8(yn),Pie=class extends pXe{},zwt=h=>gDe(hDe(V1(lw(Qie(h))))),Oee=zwt(yn),Nie=class extends Oee{remove(){let o=this.getParentOrThrow();switch(o.getKind()){case E.SyntaxKind.VariableDeclarationList:u(this);break;case E.SyntaxKind.CatchClause:b(this);break;default:throw new E.errors.NotImplementedError(`Not implemented for syntax kind: ${o.getKindName()}`)}function u(x){let k=o.getParentIfKindOrThrow(E.SyntaxKind.VariableStatement);k.getDeclarations().length===1?k.remove():Ix(x)}function b(x){mc({children:[x.getPreviousSiblingIfKindOrThrow(E.SyntaxKind.OpenParenToken),x,x.getNextSiblingIfKindOrThrow(E.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0})}}getVariableStatementOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getVariableStatement(),o??"Expected the grandparent to be a variable statement.",this)}getVariableStatement(){let o=this.getParentOrThrow().getParentOrThrow();return yn.isVariableStatement(o)?o:void 0}set(o){return ja(Oee.prototype,this,o),this}getStructure(){return ts(Oee.prototype,this,{kind:te.StructureKind.VariableDeclaration})}},fXe=M_(yn),Rie=class extends fXe{getDeclarations(){return this.compilerNode.declarations.map(o=>this._getNodeFromCompilerNode(o))}getDeclarationKind(){let o=this.compilerNode.flags;return o&E.ts.NodeFlags.Let?te.VariableDeclarationKind.Let:(o&E.ts.NodeFlags.AwaitUsing)===E.ts.NodeFlags.AwaitUsing?te.VariableDeclarationKind.AwaitUsing:(o&E.ts.NodeFlags.Using)===E.ts.NodeFlags.Using?te.VariableDeclarationKind.Using:o&E.ts.NodeFlags.Const?te.VariableDeclarationKind.Const:te.VariableDeclarationKind.Var}getDeclarationKindKeywords(){let o=this.getDeclarationKind();switch(o){case te.VariableDeclarationKind.Const:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.ConstKeyword)];case te.VariableDeclarationKind.Let:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.LetKeyword)];case te.VariableDeclarationKind.Var:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.VarKeyword)];case te.VariableDeclarationKind.Using:return[this.getFirstChildByKindOrThrow(E.SyntaxKind.UsingKeyword)];case te.VariableDeclarationKind.AwaitUsing:let u=this.getFirstChildByKindOrThrow(E.SyntaxKind.AwaitKeyword),b=u.getNextSiblingIfKindOrThrow(E.SyntaxKind.UsingKeyword);return[u,b];default:return E.errors.throwNotImplementedForNeverValueError(o)}}setDeclarationKind(o){if(this.getDeclarationKind()===o)return this;let u=this.getDeclarationKindKeywords(),b=u[0].getStart(),x=u[u.length-1].getEnd();return pa({insertPos:b,newText:o,parent:this,replacing:{textLength:x-b}}),this}addDeclaration(o){return this.addDeclarations([o])[0]}addDeclarations(o){return this.insertDeclarations(this.getDeclarations().length,o)}insertDeclaration(o,u){return this.insertDeclarations(o,[u])[0]}insertDeclarations(o,u){let b=this._getWriterWithQueuedChildIndentation(),x=new w1(this._context.structurePrinterFactory.forVariableDeclaration()),k=this.compilerNode.declarations.length;return o=Lp(o,k),x.printText(b,u),sT({parent:this.getFirstChildByKindOrThrow(E.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:o,newText:b.toString(),useTrailingCommas:!1}),uh(k,this.getDeclarations(),o,!1)}},Mie=class{#e;#t;constructor(o,u){this.#e=o,this.#t=u}get compilerSignature(){return this.#t}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(u=>this.#e.compilerFactory.getTypeParameter(u))}getParameters(){return this.compilerSignature.parameters.map(o=>this.#e.compilerFactory.getSymbol(o))}getReturnType(){return this.#e.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this.#e.typeChecker.compilerObject).map(u=>this.#e.compilerFactory.getSymbolDisplayPart(u))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(u=>this.#e.compilerFactory.getJSDocTagInfo(u))}getDeclaration(){let{compilerFactory:o}=this.#e,u=this.compilerSignature.getDeclaration();return o.getNodeFromCompilerNode(u,o.getSourceFileForNode(u))}},mXe=class{#e;#t;get compilerSymbol(){return this.#t}constructor(o,u){this.#e=o,this.#t=u,this.getValueDeclaration(),this.getDeclarations()}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),o??"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this.#e.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),o??"Expected to find an immediately aliased symbol.")}getAliasedSymbol(){return this.#e.typeChecker.getAliasedSymbol(this)}getExportSymbol(){return this.#e.typeChecker.getExportSymbolOfSymbol(this)}isAlias(){return(this.getFlags()&E.SymbolFlags.Alias)===E.SymbolFlags.Alias}isOptional(){return(this.getFlags()&E.SymbolFlags.Optional)===E.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(o){return(this.compilerSymbol.flags&o)===o}getValueDeclarationOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getValueDeclaration(),o??(()=>`Expected to find the value declaration of symbol '${this.getName()}'.`))}getValueDeclaration(){let o=this.compilerSymbol.valueDeclaration;if(o!=null)return this.#e.compilerFactory.getNodeFromCompilerNode(o,this.#e.compilerFactory.getSourceFileForNode(o))}getDeclarations(){return(this.compilerSymbol.declarations??[]).map(o=>this.#e.compilerFactory.getNodeFromCompilerNode(o,this.#e.compilerFactory.getSourceFileForNode(o)))}getExportOrThrow(o,u){return E.errors.throwIfNullOrUndefined(this.getExport(o),u??(()=>`Expected to find export with name: ${o}`))}getExport(o){if(this.compilerSymbol.exports==null)return;let u=this.compilerSymbol.exports.get(E.ts.escapeLeadingUnderscores(o));return u==null?void 0:this.#e.compilerFactory.getSymbol(u)}getExports(){return this.compilerSymbol.exports==null?[]:Array.from(this.compilerSymbol.exports.values()).map(o=>this.#e.compilerFactory.getSymbol(o))}getGlobalExportOrThrow(o,u){return E.errors.throwIfNullOrUndefined(this.getGlobalExport(o),u??(()=>`Expected to find global export with name: ${o}`))}getGlobalExport(o){if(this.compilerSymbol.globalExports==null)return;let u=this.compilerSymbol.globalExports.get(E.ts.escapeLeadingUnderscores(o));return u==null?void 0:this.#e.compilerFactory.getSymbol(u)}getGlobalExports(){return this.compilerSymbol.globalExports==null?[]:Array.from(this.compilerSymbol.globalExports.values()).map(o=>this.#e.compilerFactory.getSymbol(o))}getMemberOrThrow(o,u){return E.errors.throwIfNullOrUndefined(this.getMember(o),u??`Expected to find member with name: ${o}`)}getMember(o){if(this.compilerSymbol.members==null)return;let u=this.compilerSymbol.members.get(E.ts.escapeLeadingUnderscores(o));return u==null?void 0:this.#e.compilerFactory.getSymbol(u)}getMembers(){return this.compilerSymbol.members==null?[]:Array.from(this.compilerSymbol.members.values()).map(o=>this.#e.compilerFactory.getSymbol(o))}getDeclaredType(){return this.#e.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(o){return this.#e.typeChecker.getTypeOfSymbolAtLocation(this,o)}getFullyQualifiedName(){return this.#e.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this.#e.typeChecker.compilerObject).map(o=>new U5(o))}},j8=class{#e;constructor(o){this.#e=o}get compilerObject(){return this.#e}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}},U8=(()=>{let h=[],o;return class{static{let b=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],Va(this,null,o,{kind:"method",name:"getSpan",static:!1,private:!1,access:{has:x=>"getSpan"in x,get:x=>x.getSpan},metadata:b},null,h),b&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b})}#e=Iv(this,h);constructor(b){this.#e=b}get compilerObject(){return this.#e}getSpan(){return new j8(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}}})(),n9=(()=>{let h=[],o;return class{static{let b=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],Va(this,null,o,{kind:"method",name:"getTextChanges",static:!1,private:!1,access:{has:x=>"getTextChanges"in x,get:x=>x.getTextChanges},metadata:b},null,h),b&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b})}#e=Iv(this,h);#t;#n;#r;#i;constructor(b,x){this.#e=b,this.#t=x;let k=b.compilerFactory.addOrGetSourceFileFromFilePath(b.fileSystemWrapper.getStandardizedAbsolutePath(x.fileName),{markInProject:!1,scriptKind:void 0});this.#r=k!=null,x.isNewFile||(this.#n=k)}getFilePath(){return this.#t.fileName}getSourceFile(){return this.#n}getTextChanges(){return this.#t.textChanges.map(b=>new U8(b))}applyChanges(b={}){if(this.#i)return;if(this.isNewFile()&&this.#r&&!b.overwrite)throw new E.errors.InvalidOperationError(`Cannot apply file text change for creating a new file when the file exists at path ${this.getFilePath()}. Did you mean to provide the overwrite option?`);let x;if(this.isNewFile()?x=this.#e.project.createSourceFile(this.getFilePath(),"",{overwrite:b.overwrite}):x=this.getSourceFile(),x==null)throw new E.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return x.applyTextChanges(this.getTextChanges()),x._markAsInProject(),this.#i=!0,this}isNewFile(){return!!this.#t.isNewFile}}})(),Lie=class{#e;#t;constructor(o,u){this.#e=o,this.#t=u}get compilerObject(){return this.#t}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(o=>new n9(this.#e,o))}},kie=class extends Lie{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}},_Xe=(()=>{let h=[],o;return class{static{let b=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],Va(this,null,o,{kind:"method",name:"getChanges",static:!1,private:!1,access:{has:x=>"getChanges"in x,get:x=>x.getChanges},metadata:b},null,h),b&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b})}#e=Iv(this,h);#t;constructor(b,x){this.#e=b,this.#t=x}get compilerObject(){return this.#t}getChanges(){return this.compilerObject.changes.map(b=>new n9(this.#e,b))}applyChanges(b){for(let x of this.getChanges())x.applyChanges(b);return this}}})(),Y8=(()=>{let h=[],o,u,b;return class{static{let k=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],u=[E.Memoize],b=[E.Memoize],Va(this,null,o,{kind:"method",name:"getTextSpan",static:!1,private:!1,access:{has:j=>"getTextSpan"in j,get:j=>j.getTextSpan},metadata:k},null,h),Va(this,null,u,{kind:"method",name:"getNode",static:!1,private:!1,access:{has:j=>"getNode"in j,get:j=>j.getNode},metadata:k},null,h),Va(this,null,b,{kind:"method",name:"getOriginalTextSpan",static:!1,private:!1,access:{has:j=>"getOriginalTextSpan"in j,get:j=>j.getOriginalTextSpan},metadata:k},null,h),k&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:k})}_context=Iv(this,h);_compilerObject;_sourceFile;constructor(k,j){this._context=k,this._compilerObject=j,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(k.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 j8(this.compilerObject.textSpan)}getNode(){let k=this.getTextSpan(),j=this.getSourceFile(),fe=k.getStart(),ke=k.getEnd();return tt();function tt(){let ot;return j._context.compilerFactory.forgetNodesCreatedInBlock(ut=>{let xe,gn=j;for(;gn!=null;){if(xe==null&&(ot=gn),gn.getStart()===fe&&gn.getWidth()===ke)ot=xe=gn;else if(xe!=null)break;gn=gn.getChildAtPos(fe)}ot!=null&&ut(ot)}),ot}}getOriginalTextSpan(){let{originalTextSpan:k}=this.compilerObject;return k==null?void 0:new j8(k)}getOriginalFileName(){return this.compilerObject.originalFileName}}})(),NDe=(()=>{let h=Y8,o=[],u;return class extends h{static{let x=typeof Symbol=="function"&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;u=[E.Memoize],Va(this,null,u,{kind:"method",name:"getDeclarationNode",static:!1,private:!1,access:{has:k=>"getDeclarationNode"in k,get:k=>k.getDeclarationNode},metadata:x},null,o),x&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:x})}constructor(x,k){super(x,k),Iv(this,o),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 x=this.getTextSpan().getStart(),k=j(this.getSourceFile());return k?.getParentOrThrow();function j(fe){if(fe.getKind()===E.SyntaxKind.Identifier&&fe.getStart()===x)return fe;for(let ke of fe._getChildrenIterator())if(ke.getPos()<=x&&ke.getEnd()>x)return j(ke)}}}})(),K5=class h{_compilerObject;constructor(o){this._compilerObject=o}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let o=this.compilerObject.next;if(o!=null)return o instanceof Array?o.map(u=>new h(u)):[new h(o)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}},aoe=(()=>{let h=[],o;return class{static{let b=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],Va(this,null,o,{kind:"method",name:"getSourceFile",static:!1,private:!1,access:{has:x=>"getSourceFile"in x,get:x=>x.getSourceFile},metadata:b},null,h),b&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b})}_context=Iv(this,h);_compilerObject;constructor(b,x){this._context=b,this._compilerObject=x,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(this._context==null)return;let b=this.compilerObject.file;return b==null?void 0:this._context.compilerFactory.getSourceFile(b,{markInProject:!1})}getMessageText(){let b=this._compilerObject.messageText;return typeof b=="string"?b:this._context==null?new K5(b):this._context.compilerFactory.getDiagnosticMessageChain(b)}getLineNumber(){let b=this.getSourceFile(),x=this.getStart();if(!(b==null||x==null))return E.StringUtils.getLineNumberAtPos(b.getFullText(),x)}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}}})(),J5=class extends aoe{constructor(o,u){super(o,u)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}},wie=class{#e;#t;constructor(o,u){this.#e=u,this.#t=o}get compilerObject(){return this.#e}getFilePath(){return this.#t.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name)}getWriteByteOrderMark(){return this.compilerObject.writeByteOrderMark||!1}getText(){return this.compilerObject.text}},hXe=(()=>{let h=[],o,u;return class{static{let x=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],u=[E.Memoize],Va(this,null,o,{kind:"method",name:"getDiagnostics",static:!1,private:!1,access:{has:k=>"getDiagnostics"in k,get:k=>k.getDiagnostics},metadata:x},null,h),Va(this,null,u,{kind:"method",name:"getOutputFiles",static:!1,private:!1,access:{has:k=>"getOutputFiles"in k,get:k=>k.getOutputFiles},metadata:x},null,h),x&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:x})}#e=Iv(this,h);#t;constructor(x,k){this.#e=x,this.#t=k}get compilerObject(){return this.#t}getDiagnostics(){return this.compilerObject.diagnostics.map(x=>this.#e.compilerFactory.getDiagnostic(x))}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(x=>new wie(this.#e,x))}}})(),Oie=(()=>{let h=[],o;return class{static{let b=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],Va(this,null,o,{kind:"method",name:"getDiagnostics",static:!1,private:!1,access:{has:x=>"getDiagnostics"in x,get:x=>x.getDiagnostics},metadata:b},null,h),b&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b})}_context=Iv(this,h);_compilerObject;constructor(b,x){this._context=b,this._compilerObject=x,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(b=>this._context.compilerFactory.getDiagnostic(b))}}})(),gXe=(()=>{let h=Y8,o=[],u;return class extends h{static{let x=typeof Symbol=="function"&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;u=[E.Memoize],Va(this,null,u,{kind:"method",name:"getDisplayParts",static:!1,private:!1,access:{has:k=>"getDisplayParts"in k,get:k=>k.getDisplayParts},metadata:x},null,o),x&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:x})}constructor(x,k){super(x,k),Iv(this,o)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(x=>this._context.compilerFactory.getSymbolDisplayPart(x))}}})(),Fie=class extends Oie{#e;constructor(o,u,b){super(o,u),this.#e=b}getFiles(){return this.#e}saveFiles(){let o=this._context.fileSystemWrapper,u=this.#e.map(b=>o.writeFile(b.filePath,b.writeByteOrderMark?"\uFEFF"+b.text:b.text));return Promise.all(u)}saveFilesSync(){let o=this._context.fileSystemWrapper;for(let u of this.#e)o.writeFileSync(u.filePath,u.writeByteOrderMark?"\uFEFF"+u.text:u.text)}},yXe=(()=>{let h=[],o;return class{static{let b=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],Va(this,null,o,{kind:"method",name:"getEdits",static:!1,private:!1,access:{has:x=>"getEdits"in x,get:x=>x.getEdits},metadata:b},null,h),b&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b})}#e=Iv(this,h);#t;constructor(b,x){this.#e=b,this.#t=x}get compilerObject(){return this.#t}getEdits(){return this.compilerObject.edits.map(b=>new n9(this.#e,b))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(b){for(let x of this.getEdits())x.applyChanges(b);return this}}})(),vXe=(()=>{let h=[],o;return class{static{let b=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],Va(this,null,o,{kind:"method",name:"getDefinition",static:!1,private:!1,access:{has:x=>"getDefinition"in x,get:x=>x.getDefinition},metadata:b},null,h),b&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:b})}_context=Iv(this,h);#e;#t;constructor(b,x){this._context=b,this.#e=x,this.#t=this.compilerObject.references.map(k=>b.compilerFactory.getReferencedSymbolEntry(k))}get compilerObject(){return this.#e}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this.#t}}})(),bXe=(()=>{let h=NDe,o=[],u;return class extends h{static{let x=typeof Symbol=="function"&&Symbol.metadata?Object.create(h[Symbol.metadata]??null):void 0;u=[E.Memoize],Va(this,null,u,{kind:"method",name:"getDisplayParts",static:!1,private:!1,access:{has:k=>"getDisplayParts"in k,get:k=>k.getDisplayParts},metadata:x},null,o),x&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:x})}constructor(x,k){super(x,k),Iv(this,o)}getDisplayParts(){return this.compilerObject.displayParts.map(x=>this._context.compilerFactory.getSymbolDisplayPart(x))}}})(),Wie=class extends Y8{constructor(o,u){super(o,u)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}},Bie=class extends Wie{constructor(o,u){super(o,u)}isDefinition(){return this.compilerObject.isDefinition}},zie=class extends Y8{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}},Gie=class{#e;constructor(o){this.#e=o}get compilerObject(){return this.#e}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}},q5=class{#e;#t;constructor(o){this.#e=o}get compilerObject(){return this.#t()}_reset(o){this.#t=o}getAmbientModules(){return this.compilerObject.getAmbientModules().map(o=>this.#e.compilerFactory.getSymbol(o))}getApparentType(o){return this.#e.compilerFactory.getType(this.compilerObject.getApparentType(o.compilerType))}getAwaitedType(o){let u=this.compilerObject.getAwaitedType(o.compilerType);return u?this.#e.compilerFactory.getType(u):void 0}getConstantValue(o){return this.compilerObject.getConstantValue(o.compilerNode)}getFullyQualifiedName(o){return this.compilerObject.getFullyQualifiedName(o.compilerSymbol)}getTypeAtLocation(o){return this.#e.compilerFactory.getType(this.compilerObject.getTypeAtLocation(o.compilerNode))}getContextualType(o){let u=this.compilerObject.getContextualType(o.compilerNode);return u==null?void 0:this.#e.compilerFactory.getType(u)}getTypeOfSymbolAtLocation(o,u){return this.#e.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(o.compilerSymbol,u.compilerNode))}getDeclaredTypeOfSymbol(o){return this.#e.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(o.compilerSymbol))}getSymbolAtLocation(o){let u=this.compilerObject.getSymbolAtLocation(o.compilerNode);return u==null?void 0:this.#e.compilerFactory.getSymbol(u)}getAliasedSymbol(o){if(!o.hasFlags(E.SymbolFlags.Alias))return;let u=this.compilerObject.getAliasedSymbol(o.compilerSymbol);return u==null?void 0:this.#e.compilerFactory.getSymbol(u)}getImmediatelyAliasedSymbol(o){let u=this.compilerObject.getImmediateAliasedSymbol(o.compilerSymbol);return u==null?void 0:this.#e.compilerFactory.getSymbol(u)}getExportSymbolOfSymbol(o){return this.#e.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(o.compilerSymbol))}getPropertiesOfType(o){return this.compilerObject.getPropertiesOfType(o.compilerType).map(u=>this.#e.compilerFactory.getSymbol(u))}getTypeText(o,u,b){return b==null&&(b=this.#n(u)),this.compilerObject.typeToString(o.compilerType,u?.compilerNode,b)}getReturnTypeOfSignature(o){return this.#e.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(o.compilerSignature))}getSignatureFromNode(o){let u=this.compilerObject.getSignatureFromDeclaration(o.compilerNode);return u==null?void 0:this.#e.compilerFactory.getSignature(u)}getExportsOfModule(o){return(this.compilerObject.getExportsOfModule(o.compilerSymbol)||[]).map(b=>this.#e.compilerFactory.getSymbol(b))}getExportSpecifierLocalTargetSymbol(o){let u=this.compilerObject.getExportSpecifierLocalTargetSymbol(o.compilerNode);return u==null?void 0:this.#e.compilerFactory.getSymbol(u)}getResolvedSignature(o){let u=this.compilerObject.getResolvedSignature(o.compilerNode);if(!(!u||!u.declaration))return this.#e.compilerFactory.getSignature(u)}getResolvedSignatureOrThrow(o,u){return E.errors.throwIfNullOrUndefined(this.getResolvedSignature(o),u??"Signature could not be resolved.",o)}getBaseTypeOfLiteralType(o){return this.#e.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(o.compilerType))}getSymbolsInScope(o,u){return this.compilerObject.getSymbolsInScope(o.compilerNode,u).map(b=>this.#e.compilerFactory.getSymbol(b))}getTypeArguments(o){return this.compilerObject.getTypeArguments(o.compilerType).map(u=>this.#e.compilerFactory.getType(u))}isTypeAssignableTo(o,u){return this.compilerObject.isTypeAssignableTo(o.compilerType,u.compilerType)}#n(o){let u=E.TypeFormatFlags.UseTypeOfFunction|E.TypeFormatFlags.NoTruncation|E.TypeFormatFlags.UseFullyQualifiedType|E.TypeFormatFlags.WriteTypeArgumentsOfSignature;return o!=null&&o.getKind()===E.SyntaxKind.TypeAliasDeclaration&&(u|=E.TypeFormatFlags.InTypeAlias),u}getShorthandAssignmentValueSymbol(o){let u=this.compilerObject.getShorthandAssignmentValueSymbol(o.compilerNode);return u?this.#e.compilerFactory.getSymbol(u):void 0}resolveName(o,u,b,x){let k=this.compilerObject.resolveName(o,u?.compilerNode,b,x);return k?this.#e.compilerFactory.getSymbol(k):void 0}},Vie=class{#e;#t;#n;#r;#i;#o;constructor(o){this.#e=o.context,this.#o=o.configFileParsingDiagnostics,this.#t=new q5(this.#e),this._reset(o.rootNames,o.host)}get compilerObject(){return this.#i()}_isCompilerProgramCreated(){return this.#n!=null}_reset(o,u){let b=this.#e.compilerOptions.get();this.#i=()=>(this.#n==null&&(this.#n=E.ts.createProgram(o,b,u,this.#r,this.#o),this.#r=void 0),this.#n),this.#n!=null&&(this.#r=this.#n,this.#n=void 0),this.#t._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this.#t}async emit(o={}){if(o.writeFile){let k=`Cannot specify a ${E.nameof(o,"writeFile")} option when emitting asynchrously. Use ${E.nameof(this,"emitSync")}() instead.`;throw new E.errors.InvalidOperationError(k)}let{fileSystemWrapper:u}=this.#e,b=[],x=this.#a({writeFile:(k,j,fe)=>{b.push(u.writeFile(u.getStandardizedAbsolutePath(k),fe?"\uFEFF"+j:j))},...o});return await Promise.all(b),new Oie(this.#e,x)}emitSync(o={}){return new Oie(this.#e,this.#a(o))}emitToMemory(o={}){let u=[],{fileSystemWrapper:b}=this.#e,x=this.#a({writeFile:(k,j,fe)=>{u.push({filePath:b.getStandardizedAbsolutePath(k),text:j,writeByteOrderMark:fe||!1})},...o});return new Fie(this.#e,x,u)}#a(o={}){let u=o.targetSourceFile!=null?o.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:b,customTransformers:x,writeFile:k}=o;return this.compilerObject.emit(u,k,void 0,b,x)}getSyntacticDiagnostics(o){return this.compilerObject.getSyntacticDiagnostics(o?.compilerNode).map(b=>this.#e.compilerFactory.getDiagnosticWithLocation(b))}getSemanticDiagnostics(o){return this.compilerObject.getSemanticDiagnostics(o?.compilerNode).map(b=>this.#e.compilerFactory.getDiagnostic(b))}getDeclarationDiagnostics(o){return this.compilerObject.getDeclarationDiagnostics(o?.compilerNode).map(b=>this.#e.compilerFactory.getDiagnosticWithLocation(b))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(u=>this.#e.compilerFactory.getDiagnostic(u))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(u=>this.#e.compilerFactory.getDiagnostic(u))}getEmitModuleResolutionKind(){return E.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(o){return o.isFromExternalLibrary()}},jie=class{#e;#t;#n;#r;#i=0;get compilerObject(){return this.#e}constructor(o){this.#r=o.context;let{languageServiceHost:u,compilerHost:b}=E.createHosts({transactionalFileSystem:this.#r.fileSystemWrapper,sourceFileContainer:this.#r.getSourceFileContainer(),compilerOptions:this.#r.compilerOptions,getNewLine:()=>this.#r.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this.#i}`,resolutionHost:o.resolutionHost??{},libFolderPath:o.libFolderPath,skipLoadingLibFiles:o.skipLoadingLibFiles});this.#t=b,this.#e=E.ts.createLanguageService(u,this.#r.compilerFactory.documentRegistry),this.#n=new Vie({context:this.#r,rootNames:Array.from(this.#r.compilerFactory.getSourceFilePaths()),host:this.#t,configFileParsingDiagnostics:o.configFileParsingDiagnostics}),this.#r.compilerFactory.onSourceFileAdded(x=>{x._isInProject()&&this._reset()}),this.#r.compilerFactory.onSourceFileRemoved(()=>this._reset())}_reset(){this.#i+=1,this.#n._reset(Array.from(this.#r.compilerFactory.getSourceFilePaths()),this.#t)}getProgram(){return this.#n}getDefinitions(o){return this.getDefinitionsAtPosition(o._sourceFile,o.getStart())}getDefinitionsAtPosition(o,u){return(this.compilerObject.getDefinitionAtPosition(o.getFilePath(),u)||[]).map(x=>this.#r.compilerFactory.getDefinitionInfo(x))}getImplementations(o){return this.getImplementationsAtPosition(o._sourceFile,o.getStart())}getImplementationsAtPosition(o,u){return(this.compilerObject.getImplementationAtPosition(o.getFilePath(),u)||[]).map(x=>new gXe(this.#r,x))}findReferences(o){return this.findReferencesAtPosition(o._sourceFile,o.getStart())}findReferencesAsNodes(o){let u=this.findReferences(o);return Array.from(b());function*b(){for(let x of u){let k=x.getDefinition().getKind()===E.ts.ScriptElementKind.alias,j=x.getReferences();for(let fe=0;fe<j.length;fe++){let ke=j[fe];(k||!ke.isDefinition()||fe>0)&&(yield ke.getNode())}}}}findReferencesAtPosition(o,u){return(this.compilerObject.findReferences(o.getFilePath(),u)||[]).map(x=>this.#r.compilerFactory.getReferencedSymbol(x))}findRenameLocations(o,u={}){let b=u.usePrefixAndSuffixText==null?this.#r.manipulationSettings.getUsePrefixAndSuffixTextForRename():u.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(o._sourceFile.getFilePath(),o.getStart(),u.renameInStrings||!1,u.renameInComments||!1,b)||[]).map(k=>new zie(this.#r,k))}getSuggestionDiagnostics(o){let u=this.#o(o);return this.compilerObject.getSuggestionDiagnostics(u).map(x=>this.#r.compilerFactory.getDiagnosticWithLocation(x))}getFormattingEditsForRange(o,u,b){return(this.compilerObject.getFormattingEditsForRange(o,u[0],u[1],this.#a(b))||[]).map(x=>new U8(x))}getFormattingEditsForDocument(o,u){let b=this.#r.fileSystemWrapper.getStandardizedAbsolutePath(o);return(this.compilerObject.getFormattingEditsForDocument(b,this.#a(u))||[]).map(x=>new U8(x))}getFormattedDocumentText(o,u){let b=this.#r.fileSystemWrapper.getStandardizedAbsolutePath(o),x=this.#r.compilerFactory.getSourceFileFromCacheFromFilePath(b);if(x==null)throw new E.errors.FileNotFoundError(b);u=this.#a(u);let k=this.getFormattingEditsForDocument(b,u),j=uDe(x,k),fe=u.newLineCharacter;return u.ensureNewLineAtEndOfFile&&!j.endsWith(fe)&&(j+=fe),j.replace(/\r?\n/g,fe)}getEmitOutput(o,u){let b=this.#o(o),x=this.compilerObject;return new hXe(this.#r,k());function k(){let j=x.getProgram();return j==null||j.getSourceFile(b)==null?{emitSkipped:!0,outputFiles:[],diagnostics:[]}:x.getEmitOutput(b,u)}}getIdentationAtPosition(o,u,b){let x=this.#o(o);return b==null?b=this.#r.manipulationSettings.getEditorSettings():dDe(b,this.#r.manipulationSettings),this.compilerObject.getIndentationAtPosition(x,u,b)}organizeImports(o,u={},b={}){let x={type:"file",fileName:this.#o(o)};return this.compilerObject.organizeImports(x,this.#a(u),this.#s(b)).map(k=>new n9(this.#r,k))}getEditsForRefactor(o,u,b,x,k,j={}){let fe=this.#o(o),ke=typeof b=="number"?b:{pos:b.getPos(),end:b.getEnd()},tt=this.compilerObject.getEditsForRefactor(fe,this.#a(u),ke,x,k,this.#s(j));return tt!=null?new yXe(this.#r,tt):void 0}getCombinedCodeFix(o,u,b={},x={}){let k=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this.#o(o)},u,this.#a(b),this.#s(x||{}));return new _Xe(this.#r,k)}getCodeFixesAtPosition(o,u,b,x,k={},j={}){let fe=this.#o(o);return this.compilerObject.getCodeFixesAtPosition(fe,u,b,x,this.#a(k),this.#s(j||{})).map(tt=>new kie(this.#r,tt))}#o(o){let u=typeof o=="string"?this.#r.fileSystemWrapper.getStandardizedAbsolutePath(o):o.getFilePath();if(!this.#r.compilerFactory.containsSourceFileAtPath(u))throw new E.errors.FileNotFoundError(u);return u}#a(o){return o._filled||(o=Object.assign(this.#r.getFormatCodeSettings(),o),hLt(o,this.#r.manipulationSettings),o._filled=!0),o}#s(o){return Object.assign(this.#r.getUserPreferences(),o)}},X5=class{_context;#e;get compilerType(){return this.#e}constructor(o,u){this._context=o,this.#e=u}getText(o,u){return this._context.typeChecker.getTypeText(this,o,u)}getAliasSymbol(){return this.compilerType.aliasSymbol==null?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(u=>this._context.compilerFactory.getType(u))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getAwaitedType(){return this._context.typeChecker.getAwaitedType(this)}getArrayElementTypeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getArrayElementType(),o??"Expected to find an array element type.")}getArrayElementType(){if(this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(u=>this._context.compilerFactory.getType(u))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(o=>this._context.compilerFactory.getSignature(o))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(o=>this._context.compilerFactory.getSignature(o))}getConstraintOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected to find a constraint.")}getConstraint(){let o=this.compilerType.getConstraint();return o==null?void 0:this._context.compilerFactory.getType(o)}getDefaultOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getDefault(),o??"Expected to find a default type.")}getDefault(){let o=this.compilerType.getDefault();return o==null?void 0:this._context.compilerFactory.getType(o)}getProperties(){return this.compilerType.getProperties().map(o=>this._context.compilerFactory.getSymbol(o))}getPropertyOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getProperty(o),()=>Xu("symbol property",o))}getProperty(o){return JHe(this.getProperties(),o)}getApparentProperties(){return this.compilerType.getApparentProperties().map(o=>this._context.compilerFactory.getSymbol(o))}getApparentProperty(o){return JHe(this.getApparentProperties(),o)}isNullable(){return this.getUnionTypes().some(o=>o.isNull()||o.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let o=this.compilerType.getNumberIndexType();return o==null?void 0:this._context.compilerFactory.getType(o)}getStringIndexType(){let o=this.compilerType.getStringIndexType();return o==null?void 0:this._context.compilerFactory.getType(o)}getTargetType(){let o=this.compilerType.target||void 0;return o==null?void 0:this._context.compilerFactory.getType(o)}getTargetTypeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getTargetType(),o??"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(o=>this._context.compilerFactory.getType(o)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(o=>this._context.compilerFactory.getType(o)):[]}getLiteralValue(){return this.compilerType?.value}getLiteralValueOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getLiteralValue(),o??"Type was not a literal type.")}getLiteralFreshType(){let o=this.compilerType?.freshType;return o==null?void 0:this._context.compilerFactory.getType(o)}getLiteralFreshTypeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),o??"Type was not a literal type.")}getLiteralRegularType(){let o=this.compilerType?.regularType;return o==null?void 0:this._context.compilerFactory.getType(o)}getLiteralRegularTypeOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),o??"Type was not a literal type.")}getSymbol(){let o=this.compilerType.getSymbol();return o==null?void 0:this._context.compilerFactory.getSymbol(o)}getSymbolOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getSymbol(),o??"Expected to find a symbol.")}isAssignableTo(o){return this._context.typeChecker.isTypeAssignableTo(this,o)}isAnonymous(){return this.#n(E.ObjectFlags.Anonymous)}isAny(){return this.#t(E.TypeFlags.Any)}isNever(){return this.#t(E.TypeFlags.Never)}isArray(){let o=this.getSymbol();return o==null?!1:(o.getName()==="Array"||o.getName()==="ReadonlyArray")&&this.getTypeArguments().length===1}isReadonlyArray(){let o=this.getSymbol();return o==null?!1:o.getName()==="ReadonlyArray"&&this.getTypeArguments().length===1}isTemplateLiteral(){return this.#t(E.TypeFlags.TemplateLiteral)}isBoolean(){return this.#t(E.TypeFlags.Boolean)}isString(){return this.#t(E.TypeFlags.String)}isNumber(){return this.#t(E.TypeFlags.Number)}isBigInt(){return this.#t(E.TypeFlags.BigInt)}isLiteral(){let o=this.isBooleanLiteral();return this.compilerType.isLiteral()||o}isBooleanLiteral(){return this.#t(E.TypeFlags.BooleanLiteral)}isBigIntLiteral(){return this.#t(E.TypeFlags.BigIntLiteral)}isEnumLiteral(){return this.#t(E.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this.#t(E.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this.#t(E.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let u=this.getSymbol();if(u==null)return!1;let b=u.getValueDeclaration();return b!=null&&yn.isEnumDeclaration(b)}isInterface(){return this.#n(E.ObjectFlags.Interface)}isObject(){return this.#t(E.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let o=this.getTargetType();return o==null?!1:o.#n(E.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this.#t(E.TypeFlags.Unknown)}isNull(){return this.#t(E.TypeFlags.Null)}isUndefined(){return this.#t(E.TypeFlags.Undefined)}isVoid(){return this.#t(E.TypeFlags.Void)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}#t(o){return(this.compilerType.flags&o)===o}#n(o){return(this.getObjectFlags()&o)===o}},Uie=class extends X5{getConstraintOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getConstraint(),o??"Expected type parameter to have a constraint.")}getConstraint(){let o=this.#e();if(o==null)return;let u=o.getConstraint();if(u!=null)return this._context.typeChecker.getTypeAtLocation(u)}getDefaultOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getDefault(),o??"Expected type parameter to have a default type.")}getDefault(){let o=this.#e();if(o==null)return;let u=o.getDefault();if(u!=null)return this._context.typeChecker.getTypeAtLocation(u)}#e(){let o=this.getSymbol();if(o==null)return;let u=o.getDeclarations()[0];if(u!=null&&yn.isTypeParameterDeclaration(u))return u}},$5=class{#e;#t;constructor(o,u){this.#t=o,this.#e=u}getSkippedFilePaths(){return this.#t}getOutputFilePaths(){return this.#e}},Hie=class h{#e;#t;#n;constructor(o,u){this.#e=o,this._setPathInternal(u)}_setPathInternal(o){this.#t=o,this.#n=o.split("/").filter(u=>u.length>0)}get _context(){return this.#s(),this.#e}isAncestorOf(o){return h.#_(this,o)}isDescendantOf(o){return h.#_(o,this)}_getDepth(){return this.#n.length}getPath(){return this.#s(),this.#t}getBaseName(){return this.#n[this.#n.length-1]}getParentOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getParent(),o??(()=>`Parent directory of ${this.getPath()} does not exist or was never added.`))}getParent(){if(!E.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(E.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getDirectory(o),()=>typeof o=="string"?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(o){if(typeof o=="string"){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(u)}return this.getDirectories().find(o)}getSourceFileOrThrow(o){return E.errors.throwIfNullOrUndefined(this.getSourceFile(o),()=>typeof o=="string"?`Could not find child source file at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath())}'.`:"Could not find child source file that matched condition.")}getSourceFile(o){if(typeof o=="string"){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(u)}for(let u of this._getSourceFilesIterator())if(o(u))return u}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(o){let{compilerFactory:u,fileSystemWrapper:b}=this._context,x=this;if(typeof o=="string"||o instanceof Array)return Array.from(k(typeof o=="string"?[o]:o));return Array.from(this._getSourceFilesIterator());function*k(j){let fe=Array.from(tt()),ke=E.matchGlobs(fe,j,x.getPath());for(let ot of ke)yield u.getSourceFileFromCacheFromFilePath(b.getStandardizedAbsolutePath(ot));function*tt(){for(let ot of x._getDescendantSourceFilesIterator())yield ot.getFilePath()}}}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let o of this._getSourceFilesIterator())yield o;for(let o of this._getDirectoriesIterator())yield*o._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let o of this.getDirectories())yield o,yield*o._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(o){return o=typeof o=="string"?[o]:o,o=o.map(u=>E.FileUtils.pathIsAbsolute(u)?u:E.FileUtils.pathJoin(this.getPath(),u)),this._context.directoryCoordinator.addSourceFilesAtPaths(o,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(o,u={}){let b=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(b,{...u,markInProject:this._isInProject()})}addDirectoryAtPath(o,u={}){let b=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(b,{...u,markInProject:this._isInProject()})}createDirectory(o){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(u,{markInProject:this._isInProject()})}createSourceFile(o,u,b){let x=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.compilerFactory.createSourceFile(x,u||"",{...b||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(o){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(u,{markInProject:this._isInProject()})}addSourceFileAtPath(o){let u=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(u,{markInProject:this._isInProject()})}async emit(o={}){let{fileSystemWrapper:u}=this._context,b=[],x=[],k=[];for(let j of this.#r(o))SKe(j)?k.push(j):(b.push(u.writeFile(j.filePath,j.fileText)),x.push(j.filePath));return await Promise.all(b),new $5(k,x)}emitSync(o={}){let{fileSystemWrapper:u}=this._context,b=[],x=[];for(let k of this.#r(o))SKe(k)?x.push(k):(u.writeFileSync(k.filePath,k.fileText),b.push(k.filePath));return new $5(x,b)}#r(o={}){let{emitOnlyDtsFiles:u=!1}=o,b=o.outDir==null?void 0:/\.js$/i,x=o.outDir==null?void 0:/\.js\.map$/i,k=o.declarationDir==null&&o.outDir==null?void 0:/\.d\.ts$/i,j=ot=>ot==null?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(ot,this.getPath()),fe=(ot,ut)=>ot==null?void 0:E.FileUtils.pathJoin(ot,ut.getBaseName()),ke=this._context.compilerOptions.get().declarationDir!=null||o.declarationDir!=null;return tt(this,j(o.outDir),j(o.declarationDir));function*tt(ot,ut,xe){for(let gn of ot.getSourceFiles()){let _t=gn.getEmitOutput({emitOnlyDtsFiles:u});if(_t.getEmitSkipped()){yield gn.getFilePath();continue}for(let dt of _t.getOutputFiles()){let ui=dt.getFilePath(),Ti=dt.getWriteByteOrderMark()?E.FileUtils.getTextWithByteOrderMark(dt.getText()):dt.getText();ut!=null&&(b.test(ui)||x.test(ui)||!ke&&k.test(ui))?ui=E.FileUtils.pathJoin(ut,E.FileUtils.getBaseName(ui)):xe!=null&&k.test(ui)&&(ui=E.FileUtils.pathJoin(xe,E.FileUtils.getBaseName(ui))),yield{filePath:ui,fileText:Ti}}}for(let gn of ot.getDirectories())yield*tt(gn,fe(ut,gn),fe(xe,gn))}}copyToDirectory(o,u){let b=typeof o=="string"?o:o.getPath();return this.copy(E.FileUtils.pathJoin(b,this.getBaseName()),u)}copy(o,u){let b=this.getPath(),x=this._context.fileSystemWrapper,k=this._context.fileSystemWrapper.getStandardizedAbsolutePath(o,this.getPath());return b===k?this:(u=DAe(u),u.includeUntrackedFiles&&x.queueCopyDirectory(b,k),this.#i(k,u))}async copyImmediately(o,u){let b=this._context.fileSystemWrapper,x=this.getPath(),k=b.getStandardizedAbsolutePath(o,x);if(x===k)return await this.save(),this;u=DAe(u);let j=this.#i(k,u);return u.includeUntrackedFiles&&await b.copyDirectoryImmediately(x,k),await j.save(),j}copyImmediatelySync(o,u){let b=this._context.fileSystemWrapper,x=this.getPath(),k=b.getStandardizedAbsolutePath(o,x);if(x===k)return this.saveSync(),this;u=DAe(u);let j=this.#i(k,u);return u.includeUntrackedFiles&&b.copyDirectoryImmediatelySync(x,k),j.saveSync(),j}#i(o,u){if(this.getPath()===o)return this;let{fileSystemWrapper:x,compilerFactory:k}=this._context,j=[this,...this.getDescendantDirectories()].map(ke=>({newDirPath:ke===this?o:x.getStandardizedAbsolutePath(this.getRelativePathTo(ke),o)})),fe=this.getDescendantSourceFiles().map(ke=>({sourceFile:ke,newFilePath:x.getStandardizedAbsolutePath(this.getRelativePathTo(ke),o),references:this.#c(ke)}));for(let{newDirPath:ke}of j)this._context.compilerFactory.createDirectoryOrAddIfExists(ke,{markInProject:this._isInProject()});for(let{sourceFile:ke,newFilePath:tt}of fe)ke._copyInternal(tt,u);for(let{references:ke,newFilePath:tt}of fe)this.getSourceFileOrThrow(tt)._updateReferencesForCopyInternal(ke);return k.getDirectoryFromCache(o)}moveToDirectory(o,u){let b=typeof o=="string"?o:o.getPath();return this.move(E.FileUtils.pathJoin(b,this.getBaseName()),u)}move(o,u){let b=this._context.fileSystemWrapper,x=this.getPath(),k=b.getStandardizedAbsolutePath(o,x);return x===k?this:this.#o(k,u,()=>b.queueMoveDirectory(x,k))}async moveImmediately(o,u){let b=this._context.fileSystemWrapper,x=this.getPath(),k=b.getStandardizedAbsolutePath(o,x);return x===k?(await this.save(),this):(this.#o(k,u),await b.moveDirectoryImmediately(x,k),await this.save(),this)}moveImmediatelySync(o,u){let b=this._context.fileSystemWrapper,x=this.getPath(),k=b.getStandardizedAbsolutePath(o,x);return x===k?(this.saveSync(),this):(this.#o(k,u),b.moveDirectoryImmediatelySync(x,k),this.saveSync(),this)}#o(o,u,b){let x=this.getPath();if(x===o)return this;let k=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(o),j=k!=null&&k._isInProject();b&&b();let fe=this._context.fileSystemWrapper,ke=this._context.compilerFactory,tt=[this,...this.getDescendantDirectories()].map(ut=>({directory:ut,oldPath:ut.getPath(),newDirPath:ut===this?o:fe.getStandardizedAbsolutePath(this.getRelativePathTo(ut),o)})),ot=this.getDescendantSourceFiles().map(ut=>({sourceFile:ut,newFilePath:fe.getStandardizedAbsolutePath(this.getRelativePathTo(ut),o),references:this.#m(ut)}));for(let{directory:ut,oldPath:xe,newDirPath:gn}of tt){ke.removeDirectoryFromCache(xe);let _t=ke.getDirectoryFromCache(gn);_t?._forgetOnlyThis(),ut._setPathInternal(gn),ke.addDirectoryToCache(ut)}for(let{sourceFile:ut,newFilePath:xe}of ot)ut._moveInternal(xe,u);for(let{sourceFile:ut,references:xe}of ot)ut._updateReferencesForMoveInternal(xe,x);return j&&this._markAsInProject(),this}clear(){let o=this.getPath();this.#a(),this._context.fileSystemWrapper.queueDirectoryDelete(o),this._context.fileSystemWrapper.queueMkdir(o)}async clearImmediately(){let o=this.getPath();this.#a(),await this._context.fileSystemWrapper.clearDirectoryImmediately(o)}clearImmediatelySync(){let o=this.getPath();this.#a(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(o)}delete(){let o=this.getPath();this.#a(),this._context.fileSystemWrapper.queueDirectoryDelete(o),this.forget()}#a(){for(let o of this.getSourceFiles())o.delete();for(let o of this.getDirectories())o.delete()}async deleteImmediately(){let{fileSystemWrapper:o}=this._context,u=this.getPath();this.forget(),await o.deleteDirectoryImmediately(u)}deleteImmediatelySync(){let{fileSystemWrapper:o}=this._context,u=this.getPath();this.forget(),o.deleteDirectoryImmediatelySync(u)}forget(){if(!this.wasForgotten()){for(let o of this.getSourceFiles())o.forget();for(let o of this.getDirectories())o.forget();this._forgetOnlyThis()}}_forgetOnlyThis(){this.wasForgotten()||(this._context.compilerFactory.removeDirectoryFromCache(this.getPath()),this.#e=void 0)}async save(){await this._context.fileSystemWrapper.saveForDirectory(this.getPath());let o=this.getDescendantSourceFiles().filter(u=>!u.isSaved());await Promise.all(o.map(u=>u.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(u=>!u.isSaved()).forEach(u=>u.saveSync())}getRelativePathTo(o){let u=this;return E.FileUtils.getRelativePathTo(this.getPath(),b());function b(){return o instanceof B8?o.getFilePath():o instanceof h?o.getPath():u._context.fileSystemWrapper.getStandardizedAbsolutePath(o,u.getPath())}}getRelativePathAsModuleSpecifierTo(o){let u=this._context.program.getEmitModuleResolutionKind(),b=this,x=E.FileUtils.getRelativePathTo(this.getPath(),k()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return x.startsWith("../")?x:"./"+x;function k(){return o instanceof B8?j(o):o instanceof h?fe(o):ke(b._context.fileSystemWrapper.getStandardizedAbsolutePath(o,b.getPath()));function j(tt){return ke(tt.getFilePath())}function fe(tt){switch(u){case E.ModuleResolutionKind.Node10:return tt===b?E.FileUtils.pathJoin(tt.getPath(),"index.ts"):tt.getPath();case E.ModuleResolutionKind.Classic:case E.ModuleResolutionKind.Node16:case E.ModuleResolutionKind.NodeNext:case E.ModuleResolutionKind.Bundler:return E.FileUtils.pathJoin(tt.getPath(),"index.ts");default:return E.errors.throwNotImplementedForNeverValueError(u)}}function ke(tt){let ot=E.FileUtils.getDirPath(tt);switch(u){case E.ModuleResolutionKind.Node10:return ot===b.getPath()?tt:tt.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case E.ModuleResolutionKind.Classic:case E.ModuleResolutionKind.Node16:case E.ModuleResolutionKind.NodeNext:case E.ModuleResolutionKind.Bundler:return tt;default:return E.errors.throwNotImplementedForNeverValueError(u)}}}}getProject(){return this._context.project}wasForgotten(){return this.#e==null}_isInProject(){return this._context.inProjectCoordinator.isDirectoryInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markDirectoryAsInProject(this)}_hasLoadedParent(){return this._context.compilerFactory.containsDirectoryAtPath(E.FileUtils.getDirPath(this.getPath()))}#s(){if(this.wasForgotten())throw new E.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}#c(o){return o._getReferencesForCopyInternal().filter(b=>!this.isAncestorOf(b[1]))}#m(o){let{literalReferences:u,referencingLiterals:b}=o._getReferencesForMoveInternal();return{literalReferences:u.filter(x=>!this.isAncestorOf(x[1])),referencingLiterals:b.filter(x=>!this.isAncestorOf(x._sourceFile))}}static#_(o,u){if(u instanceof B8&&(u=u.getDirectory(),o===u))return!0;if(o.#n.length>=u.#n.length)return!1;for(let b=o.#n.length-1;b>=0;b--)if(o.#n[b]!==u.#n[b])return!1;return!0}};function DAe(h){return h=E.ObjectUtils.clone(h||{}),qu(h,"includeUntrackedFiles",!0),h}function SKe(h){return typeof h=="string"}var nDe=class{#e;#t;constructor(o,u){this.#t=o,this.#e=u}addDirectoryAtPathIfExists(o,u){let b=this.#t.getDirectoryFromPath(o,u);if(b!=null){if(u.recursive)for(let x of E.FileUtils.getDescendantDirectories(this.#e,o))this.#t.createDirectoryOrAddIfExists(x,u);return b}}addDirectoryAtPath(o,u){let b=this.addDirectoryAtPathIfExists(o,u);if(b==null)throw new E.errors.DirectoryNotFoundError(o);return b}createDirectoryOrAddIfExists(o,u){return this.#t.createDirectoryOrAddIfExists(o,u)}addSourceFileAtPathIfExists(o,u){return this.#t.addOrGetSourceFileFromFilePath(o,{markInProject:u.markInProject,scriptKind:void 0})}addSourceFileAtPath(o,u){let b=this.addSourceFileAtPathIfExists(o,u);if(b==null)throw new E.errors.FileNotFoundError(this.#e.getStandardizedAbsolutePath(o));return b}addSourceFilesAtPaths(o,u){typeof o=="string"&&(o=[o]);let b=[],x=new Set;for(let k of this.#e.globSync(o)){let j=this.addSourceFileAtPathIfExists(k,u);j!=null&&b.push(j),x.add(E.FileUtils.getDirPath(k))}for(let k of E.FileUtils.getParentMostPaths(Array.from(x)))this.addDirectoryAtPathIfExists(k,{recursive:!0,markInProject:u.markInProject});return b}},rDe=class{#e;#t=new E.KeyValueCache;#n=new E.KeyValueCache;#r=new E.KeyValueCache;#i=new E.KeyValueCache;constructor(o){this.#e=o}has(o){return this.#t.has(o)}get(o){if(!this.#t.has(o)){for(let u of this.#i.getValues())if(E.FileUtils.pathStartsWith(u.getPath(),o))return this.createOrAddIfExists(o);return}return this.#t.get(o)}getOrphans(){return this.#i.getValues()}getAll(){return this.#t.getValuesAsArray()}*getAllByDepth(){let o=new E.KeyValueCache,u=0;for(let x of this.getOrphans())b(x);for(u=Math.min(...Array.from(o.getKeys()));o.getSize()>0;){for(let x of o.get(u)||[])yield x,x.getDirectories().forEach(b);o.removeByKey(u),u++}function b(x){let k=x._getDepth();if(u>k)throw new Error(`For some reason a subdirectory had a lower depth than the parent directory: ${x.getPath()}`);o.getOrCreate(k,()=>[]).push(x)}}remove(o){this.#s(o),this.#t.removeByKey(o),this.#i.removeByKey(o)}*getChildDirectoriesOfDirectory(o){let u=this.#r.get(o)?.entries();if(u!=null)for(let b of u)yield b}*getChildSourceFilesOfDirectory(o){let u=this.#n.get(o)?.entries();if(u!=null)for(let b of u)yield b}addSourceFile(o){let u=o.getDirectoryPath();this.createOrAddIfExists(u),this.#n.getOrCreate(u,()=>new E.SortedKeyValueArray(x=>x.getBaseName(),E.LocaleStringComparer.instance)).set(o)}removeSourceFile(o){let u=E.FileUtils.getDirPath(o),b=this.#n.get(u);b!=null&&(b.removeByKey(E.FileUtils.getBaseName(o)),b.hasItems()||this.#n.removeByKey(u))}createOrAddIfExists(o){return this.has(o)?this.get(o):(this.#c(o),this.#o(o))}#o(o){let u=new Hie(this.#e,o);return this.addDirectory(u),u}addDirectory(o){let u=o.getPath(),b=E.FileUtils.getDirPath(u),x=b===u;for(let k of this.#i.getValues()){let j=k.getPath(),fe=E.FileUtils.getDirPath(j);!(fe===j)&&fe===u&&this.#i.removeByKey(j)}x||this.#a(o),this.has(b)||this.#i.set(u,o),this.#t.set(u,o),this.#e.fileSystemWrapper.directoryExistsSync(u)||this.#e.fileSystemWrapper.queueMkdir(u);for(let k of this.#i.getValues())o.isAncestorOf(k)&&this.#c(k.getPath())}#a(o){if(E.FileUtils.isRootDirPath(o.getPath()))return;let u=E.FileUtils.getDirPath(o.getPath());this.#r.getOrCreate(u,()=>new E.SortedKeyValueArray(x=>x.getBaseName(),E.LocaleStringComparer.instance)).set(o)}#s(o){if(E.FileUtils.isRootDirPath(o))return;let u=E.FileUtils.getDirPath(o),b=this.#r.get(u);b!=null&&(b.removeByKey(E.FileUtils.getBaseName(o)),b.hasItems()||this.#r.removeByKey(u))}#c(o){let u=[],b=E.FileUtils.getDirPath(o);for(;o!==b;){if(o=b,b=E.FileUtils.getDirPath(o),this.#t.has(o)){for(let x of u)this.#o(x);break}u.unshift(o)}}},iDe=class extends E.KeyValueCache{#e=[];getOrCreate(o,u){return super.getOrCreate(o,()=>{let b=u();return this.#e.length>0&&this.#e[this.#e.length-1].add(b),b})}setForgetPoint(){this.#e.push(new Set)}forgetLastPoint(){let o=this.#e.pop();o!=null&&this.#n(o.values())}rememberNode(o){if(o.wasForgotten())throw new E.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let u=!1;for(let b of this.#e)if(b.delete(o)){u=!0;break}return u&&this.#t(o),u}#t(o){let u=o.getParentSyntaxList()||o.getParent();u!=null&&this.rememberNode(u)}#n(o){for(let u of o)u.wasForgotten()||u.getKind()===E.SyntaxKind.SourceFile||u._forgetOnlyThis()}},Gwt={[E.SyntaxKind.SourceFile]:B8,[E.SyntaxKind.ArrayBindingPattern]:$ee,[E.SyntaxKind.ArrayLiteralExpression]:ete,[E.SyntaxKind.ArrayType]:Nne,[E.SyntaxKind.ArrowFunction]:hne,[E.SyntaxKind.AsExpression]:tte,[E.SyntaxKind.AwaitExpression]:nte,[E.SyntaxKind.BigIntLiteral]:hie,[E.SyntaxKind.BindingElement]:Yee,[E.SyntaxKind.BinaryExpression]:B5,[E.SyntaxKind.Block]:Pte,[E.SyntaxKind.BreakStatement]:Nte,[E.SyntaxKind.CallExpression]:rte,[E.SyntaxKind.CallSignature]:qre,[E.SyntaxKind.CaseBlock]:Rte,[E.SyntaxKind.CaseClause]:Mte,[E.SyntaxKind.CatchClause]:Lte,[E.SyntaxKind.ClassDeclaration]:bne,[E.SyntaxKind.ClassExpression]:Sne,[E.SyntaxKind.ClassStaticBlockDeclaration]:Tne,[E.SyntaxKind.ConditionalType]:Rne,[E.SyntaxKind.Constructor]:xne,[E.SyntaxKind.ConstructorType]:Mne,[E.SyntaxKind.ConstructSignature]:$re,[E.SyntaxKind.ContinueStatement]:wte,[E.SyntaxKind.CommaListExpression]:ite,[E.SyntaxKind.ComputedPropertyName]:tie,[E.SyntaxKind.ConditionalExpression]:ote,[E.SyntaxKind.DebuggerStatement]:Ote,[E.SyntaxKind.Decorator]:Cne,[E.SyntaxKind.DefaultClause]:Fte,[E.SyntaxKind.DeleteExpression]:ate,[E.SyntaxKind.DoStatement]:Wte,[E.SyntaxKind.ElementAccessExpression]:G5,[E.SyntaxKind.EmptyStatement]:Bte,[E.SyntaxKind.EnumDeclaration]:Hre,[E.SyntaxKind.EnumMember]:Kre,[E.SyntaxKind.ExportAssignment]:Yte,[E.SyntaxKind.ExportDeclaration]:Qte,[E.SyntaxKind.ExportSpecifier]:Zte,[E.SyntaxKind.ExpressionWithTypeArguments]:Lne,[E.SyntaxKind.ExpressionStatement]:zte,[E.SyntaxKind.ExternalModuleReference]:ene,[E.SyntaxKind.QualifiedName]:rie,[E.SyntaxKind.ForInStatement]:Gte,[E.SyntaxKind.ForOfStatement]:Vte,[E.SyntaxKind.ForStatement]:jte,[E.SyntaxKind.FunctionDeclaration]:gne,[E.SyntaxKind.FunctionExpression]:yne,[E.SyntaxKind.FunctionType]:kne,[E.SyntaxKind.GetAccessor]:Ane,[E.SyntaxKind.HeritageClause]:Jre,[E.SyntaxKind.Identifier]:H5,[E.SyntaxKind.IfStatement]:Ute,[E.SyntaxKind.ImportClause]:rne,[E.SyntaxKind.ImportDeclaration]:ine,[E.SyntaxKind.ImportEqualsDeclaration]:one,[E.SyntaxKind.ImportSpecifier]:ane,[E.SyntaxKind.ImportType]:wne,[E.SyntaxKind.ImportAttribute]:tne,[E.SyntaxKind.ImportAttributes]:nne,[E.SyntaxKind.IndexedAccessType]:One,[E.SyntaxKind.IndexSignature]:Yre,[E.SyntaxKind.InferType]:Fne,[E.SyntaxKind.InterfaceDeclaration]:Qre,[E.SyntaxKind.IntersectionType]:Wne,[E.SyntaxKind.JSDocAllType]:nre,[E.SyntaxKind.JSDocAugmentsTag]:rre,[E.SyntaxKind.JSDocAuthorTag]:ire,[E.SyntaxKind.JSDocCallbackTag]:ore,[E.SyntaxKind.JSDocClassTag]:are,[E.SyntaxKind.JSDocDeprecatedTag]:sre,[E.SyntaxKind.JSDocEnumTag]:lre,[E.SyntaxKind.JSDocFunctionType]:cre,[E.SyntaxKind.JSDocImplementsTag]:dre,[E.SyntaxKind.JSDocImportTag]:ure,[E.SyntaxKind.JSDocLink]:pre,[E.SyntaxKind.JSDocLinkCode]:fre,[E.SyntaxKind.JSDocLinkPlain]:mre,[E.SyntaxKind.JSDocMemberName]:_re,[E.SyntaxKind.JSDocNamepathType]:hre,[E.SyntaxKind.JSDocNameReference]:gre,[E.SyntaxKind.JSDocNonNullableType]:yre,[E.SyntaxKind.JSDocNullableType]:vre,[E.SyntaxKind.JSDocOptionalType]:bre,[E.SyntaxKind.JSDocOverrideTag]:Tre,[E.SyntaxKind.JSDocParameterTag]:Ere,[E.SyntaxKind.JSDocPrivateTag]:xre,[E.SyntaxKind.JSDocPropertyTag]:Are,[E.SyntaxKind.JSDocProtectedTag]:Dre,[E.SyntaxKind.JSDocPublicTag]:Ire,[E.SyntaxKind.JSDocReturnTag]:Pre,[E.SyntaxKind.JSDocReadonlyTag]:Cre,[E.SyntaxKind.JSDocThrowsTag]:Ore,[E.SyntaxKind.JSDocOverloadTag]:Sre,[E.SyntaxKind.JSDocSatisfiesTag]:Nre,[E.SyntaxKind.JSDocSeeTag]:Rre,[E.SyntaxKind.JSDocSignature]:Mre,[E.SyntaxKind.JSDocTag]:Gre,[E.SyntaxKind.JSDocTemplateTag]:Lre,[E.SyntaxKind.JSDocText]:kre,[E.SyntaxKind.JSDocThisTag]:wre,[E.SyntaxKind.JSDocTypeExpression]:Wre,[E.SyntaxKind.JSDocTypeLiteral]:Bre,[E.SyntaxKind.JSDocTypeTag]:zre,[E.SyntaxKind.JSDocTypedefTag]:Fre,[E.SyntaxKind.JSDocUnknownType]:Vre,[E.SyntaxKind.JSDocVariadicType]:jre,[E.SyntaxKind.JsxAttribute]:iie,[E.SyntaxKind.JsxClosingElement]:oie,[E.SyntaxKind.JsxClosingFragment]:aie,[E.SyntaxKind.JsxElement]:sie,[E.SyntaxKind.JsxExpression]:lie,[E.SyntaxKind.JsxFragment]:cie,[E.SyntaxKind.JsxNamespacedName]:die,[E.SyntaxKind.JsxOpeningElement]:uie,[E.SyntaxKind.JsxOpeningFragment]:pie,[E.SyntaxKind.JsxSelfClosingElement]:fie,[E.SyntaxKind.JsxSpreadAttribute]:mie,[E.SyntaxKind.JsxText]:_ie,[E.SyntaxKind.LabeledStatement]:Hte,[E.SyntaxKind.LiteralType]:Bne,[E.SyntaxKind.MappedType]:zne,[E.SyntaxKind.MetaProperty]:lte,[E.SyntaxKind.MethodDeclaration]:V8,[E.SyntaxKind.MethodSignature]:Zre,[E.SyntaxKind.ModuleBlock]:sne,[E.SyntaxKind.ModuleDeclaration]:lne,[E.SyntaxKind.NamedExports]:cne,[E.SyntaxKind.NamedImports]:dne,[E.SyntaxKind.NamedTupleMember]:Gne,[E.SyntaxKind.NamespaceExport]:une,[E.SyntaxKind.NamespaceImport]:pne,[E.SyntaxKind.NewExpression]:cte,[E.SyntaxKind.NonNullExpression]:dte,[E.SyntaxKind.NotEmittedStatement]:Kte,[E.SyntaxKind.NoSubstitutionTemplateLiteral]:Eie,[E.SyntaxKind.NumericLiteral]:bie,[E.SyntaxKind.ObjectBindingPattern]:Qee,[E.SyntaxKind.ObjectLiteralExpression]:pte,[E.SyntaxKind.OmittedExpression]:hte,[E.SyntaxKind.OptionalType]:Vne,[E.SyntaxKind.Parameter]:vne,[E.SyntaxKind.ParenthesizedExpression]:gte,[E.SyntaxKind.ParenthesizedType]:jne,[E.SyntaxKind.PartiallyEmittedExpression]:yte,[E.SyntaxKind.PostfixUnaryExpression]:vte,[E.SyntaxKind.PrefixUnaryExpression]:bte,[E.SyntaxKind.PrivateIdentifier]:nie,[E.SyntaxKind.PropertyAccessExpression]:V5,[E.SyntaxKind.PropertyAssignment]:fte,[E.SyntaxKind.PropertyDeclaration]:Dne,[E.SyntaxKind.PropertySignature]:eie,[E.SyntaxKind.RegularExpressionLiteral]:Sie,[E.SyntaxKind.RestType]:Une,[E.SyntaxKind.ReturnStatement]:Jte,[E.SyntaxKind.SatisfiesExpression]:Ste,[E.SyntaxKind.SetAccessor]:Ine,[E.SyntaxKind.ShorthandPropertyAssignment]:mte,[E.SyntaxKind.SpreadAssignment]:_te,[E.SyntaxKind.SpreadElement]:Tte,[E.SyntaxKind.StringLiteral]:Tie,[E.SyntaxKind.SwitchStatement]:qte,[E.SyntaxKind.SyntaxList]:Kee,[E.SyntaxKind.TaggedTemplateExpression]:xie,[E.SyntaxKind.TemplateExpression]:Aie,[E.SyntaxKind.TemplateHead]:Die,[E.SyntaxKind.TemplateLiteralType]:Hne,[E.SyntaxKind.TemplateMiddle]:Iie,[E.SyntaxKind.TemplateSpan]:Cie,[E.SyntaxKind.TemplateTail]:Pie,[E.SyntaxKind.ThisType]:Kne,[E.SyntaxKind.ThrowStatement]:Xte,[E.SyntaxKind.TryStatement]:$te,[E.SyntaxKind.TupleType]:Jne,[E.SyntaxKind.TypeAliasDeclaration]:qne,[E.SyntaxKind.TypeAssertionExpression]:Ate,[E.SyntaxKind.TypeLiteral]:Xne,[E.SyntaxKind.TypeOperator]:$ne,[E.SyntaxKind.TypeParameter]:Yne,[E.SyntaxKind.TypePredicate]:Qne,[E.SyntaxKind.TypeQuery]:Zne,[E.SyntaxKind.TypeReference]:ere,[E.SyntaxKind.UnionType]:tre,[E.SyntaxKind.VariableDeclaration]:Nie,[E.SyntaxKind.VariableDeclarationList]:Rie,[E.SyntaxKind.VariableStatement]:fne,[E.SyntaxKind.JSDoc]:Pne,[E.SyntaxKind.TypeOfExpression]:Dte,[E.SyntaxKind.WhileStatement]:mne,[E.SyntaxKind.WithStatement]:_ne,[E.SyntaxKind.YieldExpression]:Cte,[E.SyntaxKind.SemicolonToken]:yn,[E.SyntaxKind.AnyKeyword]:Kp,[E.SyntaxKind.BooleanKeyword]:Kp,[E.SyntaxKind.FalseKeyword]:yie,[E.SyntaxKind.ImportKeyword]:ste,[E.SyntaxKind.InferKeyword]:yn,[E.SyntaxKind.NeverKeyword]:yn,[E.SyntaxKind.NullKeyword]:vie,[E.SyntaxKind.NumberKeyword]:Kp,[E.SyntaxKind.ObjectKeyword]:Kp,[E.SyntaxKind.StringKeyword]:Kp,[E.SyntaxKind.SymbolKeyword]:Kp,[E.SyntaxKind.SuperKeyword]:Ete,[E.SyntaxKind.ThisKeyword]:xte,[E.SyntaxKind.TrueKeyword]:gie,[E.SyntaxKind.UndefinedKeyword]:Kp,[E.SyntaxKind.VoidExpression]:Ite},oDe=class{#e;#t=new Map;#n=new E.WeakCache;#r=new E.WeakCache;#i=new E.WeakCache;#o=new E.WeakCache;#a=new E.WeakCache;#s=new E.WeakCache;#c=new E.WeakCache;#m=new E.WeakCache;#_=new E.WeakCache;#E=new E.WeakCache;#S=new E.WeakCache;#g=new E.WeakCache;#y=new E.WeakCache;#u=new iDe;#p;#h=new E.EventContainer;#T=new E.EventContainer;documentRegistry;constructor(o){this.documentRegistry=new E.DocumentRegistry(o.fileSystemWrapper),this.#p=new rDe(o),o.compilerOptions.onModified(()=>{let u=Array.from(this.#t.values());for(let b of u)ekt(b)}),this.#e=o}*getSourceFilesByDirectoryDepth(){for(let o of this.getDirectoriesByDepth())yield*o.getSourceFiles()}getSourceFilePaths(){return this.#t.keys()}getChildDirectoriesOfDirectory(o){return this.#p.getChildDirectoriesOfDirectory(o)}getChildSourceFilesOfDirectory(o){return this.#p.getChildSourceFilesOfDirectory(o)}onSourceFileAdded(o,u=!0){u?this.#h.subscribe(o):this.#h.unsubscribe(o)}onSourceFileRemoved(o){this.#T.subscribe(o)}createSourceFile(o,u,b){if(u=u instanceof Function?JE(this.#e.createWriter(),u):u||"",typeof u=="string")return this.createSourceFileFromText(o,u,b);let x=this.#e.createWriter();return this.#e.structurePrinterFactory.forSourceFile({isAmbient:E.FileUtils.getExtension(o)===".d.ts"}).printText(x,u),this.createSourceFileFromText(o,x.toString(),b)}createSourceFileFromText(o,u,b){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),b.overwrite===!0?this.#f(o,u,b):(this.throwIfFileExists(o,"Did you mean to provide the overwrite option?"),this.#v(o,u,b))}throwIfFileExists(o,u){if(!(!this.containsSourceFileAtPath(o)&&!this.#e.fileSystemWrapper.fileExistsSync(o)))throw u=u==null?"":u+" ",new E.errors.InvalidOperationError(`${u}A source file already exists at the provided file path: ${o}`)}#f(o,u,b){o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o);let x=this.addOrGetSourceFileFromFilePath(o,b);return x!=null?(x.getChildren().forEach(k=>k.forget()),this.replaceCompilerNode(x,this.createCompilerSourceFileFromText(o,u,b.scriptKind)),x):this.#v(o,u,b)}getSourceFileFromCacheFromFilePath(o){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),this.#t.get(o)}addOrGetSourceFileFromFilePath(o,u){o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o);let b=this.#t.get(o);if(b==null){let x=this.#e.fileSystemWrapper.readFileIfExistsSync(o,this.#e.getEncoding());x!=null&&(this.#e.logger.log(`Loaded file: ${o}`),b=this.#v(o,x,u),b._setIsSaved(!0))}return b!=null&&u.markInProject&&b._markAsInProject(),b}containsSourceFileAtPath(o){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),this.#t.has(o)}containsDirectoryAtPath(o){return o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o),this.#p.has(o)}getSourceFileForNode(o){let u=o;for(;u.kind!==E.SyntaxKind.SourceFile;){if(u.parent==null)return;u=u.parent}return this.getSourceFile(u,{markInProject:!1})}hasCompilerNode(o){return this.#u.has(o)}getExistingNodeFromCompilerNode(o){return this.#u.get(o)}getNodeFromCompilerNode(o,u){if(o.kind===E.SyntaxKind.SourceFile)return this.getSourceFile(o,{markInProject:!1});return this.#u.getOrCreate(o,()=>{let j=b.call(this);return k.call(this,j),j});function b(){if(x(o))return Pb.isCommentStatement(o)?new kte(this.#e,o,u):Pb.isCommentClassElement(o)?new Ene(this.#e,o,u):Pb.isCommentTypeElement(o)?new Xre(this.#e,o,u):Pb.isCommentObjectLiteralElement(o)?new ute(this.#e,o,u):Pb.isCommentEnumMember(o)?new Ure(this.#e,o,u):E.errors.throwNotImplementedForNeverValueError(o);let j=Gwt[o.kind]||yn;return new j(this.#e,o,u)}function x(j){return j._commentKind!=null}function k(j){if(o.parent!=null){let ke=this.getNodeFromCompilerNode(o.parent,u);ke._wrappedChildCount++}let fe=j._getParentSyntaxListIfWrapped();if(fe!=null&&fe._wrappedChildCount++,o.kind===E.SyntaxKind.SyntaxList){let ke=0;for(let tt of j._getChildrenInCacheIterator())ke++;j._wrappedChildCount=ke}}}#v(o,u,b){let x=E.StringUtils.hasBom(u);x&&(u=E.StringUtils.stripBom(u));let k=this.getSourceFile(this.createCompilerSourceFileFromText(o,u,b.scriptKind),b);return x&&(k._hasBom=!0),k}createCompilerSourceFileFromText(o,u,b){return this.documentRegistry.createOrUpdateSourceFile(o,this.#e.compilerOptions.get(),E.ts.ScriptSnapshot.fromString(u),b)}getSourceFile(o,u){let b=!1,x=this.#t.get(o.fileName)??this.#u.getOrCreate(o,()=>{let k=new B8(this.#e,o);return u.markInProject||this.#e.inProjectCoordinator.setSourceFileNotInProject(k),this.#l(k),b=!0,k});return u.markInProject&&x._markAsInProject(),b&&this.#h.fire(x),x}#l(o){this.#t.set(o.getFilePath(),o),this.#e.fileSystemWrapper.removeFileDelete(o.getFilePath()),this.#p.addSourceFile(o)}getDirectoryFromPath(o,u){o=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(o);let b=this.#p.get(o);return b==null&&this.#e.fileSystemWrapper.directoryExistsSync(o)&&(b=this.#p.createOrAddIfExists(o)),b!=null&&u.markInProject&&b._markAsInProject(),b}createDirectoryOrAddIfExists(o,u){let b=this.#p.createOrAddIfExists(o);return b!=null&&u.markInProject&&b._markAsInProject(),b}getDirectoryFromCache(o){return this.#p.get(o)}getDirectoryFromCacheOnlyIfInCache(o){return this.#p.has(o)?this.#p.get(o):void 0}getDirectoriesByDepth(){return this.#p.getAllByDepth()}getOrphanDirectories(){return this.#p.getOrphans()}getSymbolDisplayPart(o){return this.#m.getOrCreate(o,()=>new Gie(o))}getType(o){return(o.flags&E.TypeFlags.TypeParameter)===E.TypeFlags.TypeParameter?this.getTypeParameter(o):this.#g.getOrCreate(o,()=>new X5(this.#e,o))}getTypeParameter(o){return this.#y.getOrCreate(o,()=>new Uie(this.#e,o))}getSignature(o){return this.#s.getOrCreate(o,()=>new Mie(this.#e,o))}getSymbol(o){return this.#c.getOrCreate(o,()=>new mXe(this.#e,o))}getDefinitionInfo(o){return this.#r.getOrCreate(o,()=>new NDe(this.#e,o))}getDocumentSpan(o){return this.#i.getOrCreate(o,()=>new Y8(this.#e,o))}getReferencedSymbolEntry(o){return this.#_.getOrCreate(o,()=>new Bie(this.#e,o))}getReferencedSymbol(o){return this.#E.getOrCreate(o,()=>new vXe(this.#e,o))}getReferencedSymbolDefinitionInfo(o){return this.#S.getOrCreate(o,()=>new bXe(this.#e,o))}getDiagnostic(o){return this.#n.getOrCreate(o,()=>o.start!=null?new J5(this.#e,o):new aoe(this.#e,o))}getDiagnosticWithLocation(o){return this.#n.getOrCreate(o,()=>new J5(this.#e,o))}getDiagnosticMessageChain(o){return this.#o.getOrCreate(o,()=>new K5(o))}getJSDocTagInfo(o){return this.#a.getOrCreate(o,()=>new U5(o))}replaceCompilerNode(o,u){let b=o instanceof yn?o.compilerNode:o,x=o instanceof yn?o:this.#u.get(o);if(b.kind===E.SyntaxKind.SourceFile&&b.fileName!==u.fileName){let k=x;this.#d(b),k._replaceCompilerNodeFromFactory(u),this.#u.set(u,k),this.#l(k),this.#h.fire(k)}else this.#u.replaceKey(b,u),x?._replaceCompilerNodeFromFactory(u)}removeNodeFromCache(o){this.#d(o.compilerNode)}#d(o){if(this.#u.removeByKey(o),o.kind===E.SyntaxKind.SourceFile){let u=o,b=this.#e.fileSystemWrapper.getStandardizedAbsolutePath(u.fileName);this.#p.removeSourceFile(b);let x=this.#t.get(b);this.#t.delete(b),this.documentRegistry.removeSourceFile(b),x!=null&&this.#T.fire(x)}}addDirectoryToCache(o){this.#p.addDirectory(o)}removeDirectoryFromCache(o){this.#p.remove(o)}forgetNodesCreatedInBlock(o){this.#u.setForgetPoint();let u=!1,b;try{if(b=o((...k)=>{for(let j of k)this.#u.rememberNode(j)}),yn.isNode(b)&&this.#u.rememberNode(b),x(b))return u=!0,b.then(k=>(yn.isNode(k)&&this.#u.rememberNode(k),this.#u.forgetLastPoint(),k))}finally{u||this.#u.forgetLastPoint()}return b;function x(k){return k!=null&&typeof k.then=="function"}}},aDe=class{#e;#t=new Set;constructor(o){o.onSourceFileRemoved(u=>{this.#t.delete(u)}),this.#e=o}setSourceFileNotInProject(o){this.#t.add(o),o._inProject=!1}markSourceFileAsInProject(o){this.isSourceFileInProject(o)||(this.#n(o),this.#t.delete(o))}markSourceFilesAsInProjectForResolution(){let o="/node_modules/",u=this.#e,b=[],x=[];for(let j of[...this.#t.values()])k(j)?(this.#n(j),this.#t.delete(j),b.push(j)):x.push(j);return{changedSourceFiles:b,unchangedSourceFiles:x};function k(j){let fe=j.getFilePath(),ke=fe.toLowerCase().lastIndexOf(o);if(ke===-1)return!0;let tt=fe.substring(0,ke+o.length-1),ot=u.getDirectoryFromCacheOnlyIfInCache(tt);if(ot!=null&&ot._isInProject())return!0;let ut=j.getDirectory();for(;ut!=null&&ut.getPath()!==tt;){if(ut._isInProject())return!0;ut=u.getDirectoryFromCacheOnlyIfInCache(E.FileUtils.getDirPath(ut.getPath()))}return!1}}#n(o){o._inProject=!0,this.markDirectoryAsInProject(o.getDirectory())}isSourceFileInProject(o){return o._inProject===!0}setDirectoryAndFilesAsNotInProjectForTesting(o){for(let u of o.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(u);for(let u of o.getSourceFiles())delete u._inProject,this.#t.add(u);delete o._inProject}markDirectoryAsInProject(o){if(this.isDirectoryInProject(o))return;let u=this,b=this.#e;o._inProject=!0,x(o);function x(j){let fe=Array.from(k(j)),ke=fe[fe.length-1];if(!(ke==null||!u.isDirectoryInProject(ke)))for(let tt of fe)tt._inProject=!0}function*k(j){if(E.FileUtils.isRootDirPath(j.getPath()))return;let fe=E.FileUtils.getDirPath(j.getPath()),ke=b.getDirectoryFromCacheOnlyIfInCache(fe);ke!=null&&(yield ke,u.isDirectoryInProject(ke)||(yield*k(ke)))}}isDirectoryInProject(o){return o._inProject===!0}},SXe=(()=>{let h=[],o,u,b,x,k,j,fe,ke,tt,ot,ut,xe,gn,_t,dt,ui,Ti,qi,cs,Cl,Ja,Ur,wn,ki,hi,Or,bi,ud,Pc,fn,Di,Kc,vn,gd,Ys,Jc,aa,dT,uT,Iy,Ll,Gi,mh,Uo,ac,Ko,kl,jd,gt,yd,Wi;return class{static{let Wo=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],u=[E.Memoize],b=[E.Memoize],x=[E.Memoize],k=[E.Memoize],j=[E.Memoize],fe=[E.Memoize],ke=[E.Memoize],tt=[E.Memoize],ot=[E.Memoize],ut=[E.Memoize],xe=[E.Memoize],gn=[E.Memoize],_t=[E.Memoize],dt=[E.Memoize],ui=[E.Memoize],Ti=[E.Memoize],qi=[E.Memoize],cs=[E.Memoize],Cl=[E.Memoize],Ja=[E.Memoize],Ur=[E.Memoize],wn=[E.Memoize],ki=[E.Memoize],hi=[E.Memoize],Or=[E.Memoize],bi=[E.Memoize],ud=[E.Memoize],Pc=[E.Memoize],fn=[E.Memoize],Di=[E.Memoize],Kc=[E.Memoize],vn=[E.Memoize],gd=[E.Memoize],Ys=[E.Memoize],Jc=[E.Memoize],aa=[E.Memoize],dT=[E.Memoize],uT=[E.Memoize],Iy=[E.Memoize],Ll=[E.Memoize],Gi=[E.Memoize],mh=[E.Memoize],Uo=[E.Memoize],ac=[E.Memoize],Ko=[E.Memoize],kl=[E.Memoize],jd=[E.Memoize],gt=[E.Memoize],yd=[E.Memoize],Wi=[E.Memoize],Va(this,null,o,{kind:"method",name:"forInitializerExpressionableNode",static:!1,private:!1,access:{has:jn=>"forInitializerExpressionableNode"in jn,get:jn=>jn.forInitializerExpressionableNode},metadata:Wo},null,h),Va(this,null,u,{kind:"method",name:"forModifierableNode",static:!1,private:!1,access:{has:jn=>"forModifierableNode"in jn,get:jn=>jn.forModifierableNode},metadata:Wo},null,h),Va(this,null,b,{kind:"method",name:"forReturnTypedNode",static:!1,private:!1,access:{has:jn=>"forReturnTypedNode"in jn,get:jn=>jn.forReturnTypedNode},metadata:Wo},null,h),Va(this,null,x,{kind:"method",name:"forTypedNode",static:!1,private:!1,access:{has:jn=>"forTypedNode"in jn,get:jn=>jn.forTypedNode},metadata:Wo},null,h),Va(this,null,k,{kind:"method",name:"forClassDeclaration",static:!1,private:!1,access:{has:jn=>"forClassDeclaration"in jn,get:jn=>jn.forClassDeclaration},metadata:Wo},null,h),Va(this,null,j,{kind:"method",name:"forClassMember",static:!1,private:!1,access:{has:jn=>"forClassMember"in jn,get:jn=>jn.forClassMember},metadata:Wo},null,h),Va(this,null,fe,{kind:"method",name:"forClassStaticBlockDeclaration",static:!1,private:!1,access:{has:jn=>"forClassStaticBlockDeclaration"in jn,get:jn=>jn.forClassStaticBlockDeclaration},metadata:Wo},null,h),Va(this,null,ke,{kind:"method",name:"forConstructorDeclaration",static:!1,private:!1,access:{has:jn=>"forConstructorDeclaration"in jn,get:jn=>jn.forConstructorDeclaration},metadata:Wo},null,h),Va(this,null,tt,{kind:"method",name:"forGetAccessorDeclaration",static:!1,private:!1,access:{has:jn=>"forGetAccessorDeclaration"in jn,get:jn=>jn.forGetAccessorDeclaration},metadata:Wo},null,h),Va(this,null,ot,{kind:"method",name:"forMethodDeclaration",static:!1,private:!1,access:{has:jn=>"forMethodDeclaration"in jn,get:jn=>jn.forMethodDeclaration},metadata:Wo},null,h),Va(this,null,ut,{kind:"method",name:"forPropertyDeclaration",static:!1,private:!1,access:{has:jn=>"forPropertyDeclaration"in jn,get:jn=>jn.forPropertyDeclaration},metadata:Wo},null,h),Va(this,null,xe,{kind:"method",name:"forSetAccessorDeclaration",static:!1,private:!1,access:{has:jn=>"forSetAccessorDeclaration"in jn,get:jn=>jn.forSetAccessorDeclaration},metadata:Wo},null,h),Va(this,null,gn,{kind:"method",name:"forDecorator",static:!1,private:!1,access:{has:jn=>"forDecorator"in jn,get:jn=>jn.forDecorator},metadata:Wo},null,h),Va(this,null,_t,{kind:"method",name:"forJSDoc",static:!1,private:!1,access:{has:jn=>"forJSDoc"in jn,get:jn=>jn.forJSDoc},metadata:Wo},null,h),Va(this,null,dt,{kind:"method",name:"forJSDocTag",static:!1,private:!1,access:{has:jn=>"forJSDocTag"in jn,get:jn=>jn.forJSDocTag},metadata:Wo},null,h),Va(this,null,ui,{kind:"method",name:"forEnumDeclaration",static:!1,private:!1,access:{has:jn=>"forEnumDeclaration"in jn,get:jn=>jn.forEnumDeclaration},metadata:Wo},null,h),Va(this,null,Ti,{kind:"method",name:"forEnumMember",static:!1,private:!1,access:{has:jn=>"forEnumMember"in jn,get:jn=>jn.forEnumMember},metadata:Wo},null,h),Va(this,null,qi,{kind:"method",name:"forObjectLiteralExpressionProperty",static:!1,private:!1,access:{has:jn=>"forObjectLiteralExpressionProperty"in jn,get:jn=>jn.forObjectLiteralExpressionProperty},metadata:Wo},null,h),Va(this,null,cs,{kind:"method",name:"forPropertyAssignment",static:!1,private:!1,access:{has:jn=>"forPropertyAssignment"in jn,get:jn=>jn.forPropertyAssignment},metadata:Wo},null,h),Va(this,null,Cl,{kind:"method",name:"forShorthandPropertyAssignment",static:!1,private:!1,access:{has:jn=>"forShorthandPropertyAssignment"in jn,get:jn=>jn.forShorthandPropertyAssignment},metadata:Wo},null,h),Va(this,null,Ja,{kind:"method",name:"forSpreadAssignment",static:!1,private:!1,access:{has:jn=>"forSpreadAssignment"in jn,get:jn=>jn.forSpreadAssignment},metadata:Wo},null,h),Va(this,null,Ur,{kind:"method",name:"forFunctionDeclaration",static:!1,private:!1,access:{has:jn=>"forFunctionDeclaration"in jn,get:jn=>jn.forFunctionDeclaration},metadata:Wo},null,h),Va(this,null,wn,{kind:"method",name:"forParameterDeclaration",static:!1,private:!1,access:{has:jn=>"forParameterDeclaration"in jn,get:jn=>jn.forParameterDeclaration},metadata:Wo},null,h),Va(this,null,ki,{kind:"method",name:"forCallSignatureDeclaration",static:!1,private:!1,access:{has:jn=>"forCallSignatureDeclaration"in jn,get:jn=>jn.forCallSignatureDeclaration},metadata:Wo},null,h),Va(this,null,hi,{kind:"method",name:"forConstructSignatureDeclaration",static:!1,private:!1,access:{has:jn=>"forConstructSignatureDeclaration"in jn,get:jn=>jn.forConstructSignatureDeclaration},metadata:Wo},null,h),Va(this,null,Or,{kind:"method",name:"forIndexSignatureDeclaration",static:!1,private:!1,access:{has:jn=>"forIndexSignatureDeclaration"in jn,get:jn=>jn.forIndexSignatureDeclaration},metadata:Wo},null,h),Va(this,null,bi,{kind:"method",name:"forInterfaceDeclaration",static:!1,private:!1,access:{has:jn=>"forInterfaceDeclaration"in jn,get:jn=>jn.forInterfaceDeclaration},metadata:Wo},null,h),Va(this,null,ud,{kind:"method",name:"forMethodSignature",static:!1,private:!1,access:{has:jn=>"forMethodSignature"in jn,get:jn=>jn.forMethodSignature},metadata:Wo},null,h),Va(this,null,Pc,{kind:"method",name:"forPropertySignature",static:!1,private:!1,access:{has:jn=>"forPropertySignature"in jn,get:jn=>jn.forPropertySignature},metadata:Wo},null,h),Va(this,null,fn,{kind:"method",name:"forTypeElementMemberedNode",static:!1,private:!1,access:{has:jn=>"forTypeElementMemberedNode"in jn,get:jn=>jn.forTypeElementMemberedNode},metadata:Wo},null,h),Va(this,null,Di,{kind:"method",name:"forTypeElementMember",static:!1,private:!1,access:{has:jn=>"forTypeElementMember"in jn,get:jn=>jn.forTypeElementMember},metadata:Wo},null,h),Va(this,null,Kc,{kind:"method",name:"forJsxAttributeDecider",static:!1,private:!1,access:{has:jn=>"forJsxAttributeDecider"in jn,get:jn=>jn.forJsxAttributeDecider},metadata:Wo},null,h),Va(this,null,vn,{kind:"method",name:"forJsxAttribute",static:!1,private:!1,access:{has:jn=>"forJsxAttribute"in jn,get:jn=>jn.forJsxAttribute},metadata:Wo},null,h),Va(this,null,gd,{kind:"method",name:"forJsxChildDecider",static:!1,private:!1,access:{has:jn=>"forJsxChildDecider"in jn,get:jn=>jn.forJsxChildDecider},metadata:Wo},null,h),Va(this,null,Ys,{kind:"method",name:"forJsxElement",static:!1,private:!1,access:{has:jn=>"forJsxElement"in jn,get:jn=>jn.forJsxElement},metadata:Wo},null,h),Va(this,null,Jc,{kind:"method",name:"forJsxNamespacedName",static:!1,private:!1,access:{has:jn=>"forJsxNamespacedName"in jn,get:jn=>jn.forJsxNamespacedName},metadata:Wo},null,h),Va(this,null,aa,{kind:"method",name:"forJsxSelfClosingElement",static:!1,private:!1,access:{has:jn=>"forJsxSelfClosingElement"in jn,get:jn=>jn.forJsxSelfClosingElement},metadata:Wo},null,h),Va(this,null,dT,{kind:"method",name:"forJsxSpreadAttribute",static:!1,private:!1,access:{has:jn=>"forJsxSpreadAttribute"in jn,get:jn=>jn.forJsxSpreadAttribute},metadata:Wo},null,h),Va(this,null,uT,{kind:"method",name:"forExportAssignment",static:!1,private:!1,access:{has:jn=>"forExportAssignment"in jn,get:jn=>jn.forExportAssignment},metadata:Wo},null,h),Va(this,null,Iy,{kind:"method",name:"forExportDeclaration",static:!1,private:!1,access:{has:jn=>"forExportDeclaration"in jn,get:jn=>jn.forExportDeclaration},metadata:Wo},null,h),Va(this,null,Ll,{kind:"method",name:"forImportAttribute",static:!1,private:!1,access:{has:jn=>"forImportAttribute"in jn,get:jn=>jn.forImportAttribute},metadata:Wo},null,h),Va(this,null,Gi,{kind:"method",name:"forImportDeclaration",static:!1,private:!1,access:{has:jn=>"forImportDeclaration"in jn,get:jn=>jn.forImportDeclaration},metadata:Wo},null,h),Va(this,null,mh,{kind:"method",name:"forModuleDeclaration",static:!1,private:!1,access:{has:jn=>"forModuleDeclaration"in jn,get:jn=>jn.forModuleDeclaration},metadata:Wo},null,h),Va(this,null,Uo,{kind:"method",name:"forNamedImportExportSpecifier",static:!1,private:!1,access:{has:jn=>"forNamedImportExportSpecifier"in jn,get:jn=>jn.forNamedImportExportSpecifier},metadata:Wo},null,h),Va(this,null,ac,{kind:"method",name:"forSourceFile",static:!1,private:!1,access:{has:jn=>"forSourceFile"in jn,get:jn=>jn.forSourceFile},metadata:Wo},null,h),Va(this,null,Ko,{kind:"method",name:"forStatementedNode",static:!1,private:!1,access:{has:jn=>"forStatementedNode"in jn,get:jn=>jn.forStatementedNode},metadata:Wo},null,h),Va(this,null,kl,{kind:"method",name:"forStatement",static:!1,private:!1,access:{has:jn=>"forStatement"in jn,get:jn=>jn.forStatement},metadata:Wo},null,h),Va(this,null,jd,{kind:"method",name:"forVariableStatement",static:!1,private:!1,access:{has:jn=>"forVariableStatement"in jn,get:jn=>jn.forVariableStatement},metadata:Wo},null,h),Va(this,null,gt,{kind:"method",name:"forTypeAliasDeclaration",static:!1,private:!1,access:{has:jn=>"forTypeAliasDeclaration"in jn,get:jn=>jn.forTypeAliasDeclaration},metadata:Wo},null,h),Va(this,null,yd,{kind:"method",name:"forTypeParameterDeclaration",static:!1,private:!1,access:{has:jn=>"forTypeParameterDeclaration"in jn,get:jn=>jn.forTypeParameterDeclaration},metadata:Wo},null,h),Va(this,null,Wi,{kind:"method",name:"forVariableDeclaration",static:!1,private:!1,access:{has:jn=>"forVariableDeclaration"in jn,get:jn=>jn.forVariableDeclaration},metadata:Wo},null,h),Wo&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:Wo})}_getFormatCodeSettings=Iv(this,h);constructor(Wo){this._getFormatCodeSettings=Wo}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new YAe}forModifierableNode(){return new QAe}forReturnTypedNode(Wo){return new ZAe(Wo)}forTypedNode(Wo,jn){return new e1e(Wo,jn)}forClassDeclaration(Wo){return new n1e(this,Wo)}forClassMember(Wo){return new r1e(this,Wo)}forClassStaticBlockDeclaration(){return new i1e(this)}forConstructorDeclaration(Wo){return new o1e(this,Wo)}forGetAccessorDeclaration(Wo){return new a1e(this,Wo)}forMethodDeclaration(Wo){return new s1e(this,Wo)}forPropertyDeclaration(){return new l1e(this)}forSetAccessorDeclaration(Wo){return new c1e(this,Wo)}forDecorator(){return new d1e(this)}forJSDoc(){return new u1e(this)}forJSDocTag(Wo){return new p1e(this,Wo)}forEnumDeclaration(){return new f1e(this)}forEnumMember(){return new m1e(this)}forObjectLiteralExpressionProperty(){return new _1e(this)}forPropertyAssignment(){return new h1e(this)}forShorthandPropertyAssignment(){return new g1e(this)}forSpreadAssignment(){return new y1e(this)}forFunctionDeclaration(Wo){return new v1e(this,Wo)}forParameterDeclaration(){return new b1e(this)}forCallSignatureDeclaration(){return new S1e(this)}forConstructSignatureDeclaration(){return new T1e(this)}forIndexSignatureDeclaration(){return new E1e(this)}forInterfaceDeclaration(){return new x1e(this)}forMethodSignature(){return new A1e(this)}forPropertySignature(){return new D1e(this)}forTypeElementMemberedNode(){return new I1e(this)}forTypeElementMember(){return new C1e(this)}forJsxAttributeDecider(){return new P1e(this)}forJsxAttribute(){return new N1e(this)}forJsxChildDecider(){return new R1e(this)}forJsxElement(){return new M1e(this)}forJsxNamespacedName(){return new L1e(this)}forJsxSelfClosingElement(){return new k1e(this)}forJsxSpreadAttribute(){return new w1e(this)}forExportAssignment(){return new O1e(this)}forExportDeclaration(){return new F1e(this)}forImportAttribute(){return new W1e(this)}forImportDeclaration(){return new B1e(this)}forModuleDeclaration(Wo){return new z1e(this,Wo)}forNamedImportExportSpecifier(){return new G1e(this)}forSourceFile(Wo){return new V1e(this,Wo)}forStatementedNode(Wo){return new j1e(this,Wo)}forStatement(Wo){return new U1e(this,Wo)}forVariableStatement(){return new H1e(this)}forTypeAliasDeclaration(){return new K1e(this)}forTypeParameterDeclaration(){return new J1e(this)}forVariableDeclaration(){return new q1e(this)}}})(),TXe=(()=>{let h=[],o,u;return class{static{let x=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;o=[E.Memoize],u=[E.Memoize],Va(this,null,o,{kind:"method",name:"getSourceFileContainer",static:!1,private:!1,access:{has:k=>"getSourceFileContainer"in k,get:k=>k.getSourceFileContainer},metadata:x},null,h),Va(this,null,u,{kind:"method",name:"getModuleResolutionHost",static:!1,private:!1,access:{has:k=>"getModuleResolutionHost"in k,get:k=>k.getModuleResolutionHost},metadata:x},null,h),x&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:x})}#e=Iv(this,h);#t;#n;#r;get project(){if(this.#r==null)throw new E.errors.InvalidOperationError("This operation is not permitted in this context.");return this.#r}logger=new PAe;lazyReferenceCoordinator;directoryCoordinator;fileSystemWrapper;manipulationSettings=new jee;structurePrinterFactory;compilerFactory;inProjectCoordinator;constructor(x){this.#r=x.project,this.fileSystemWrapper=x.fileSystemWrapper,this.#t=x.compilerOptionsContainer,this.compilerFactory=new oDe(this),this.inProjectCoordinator=new aDe(this.compilerFactory),this.structurePrinterFactory=new SXe(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new NAe(this.compilerFactory),this.directoryCoordinator=new nDe(this.compilerFactory,x.fileSystemWrapper),this.#e=x.createLanguageService?new jie({context:this,configFileParsingDiagnostics:x.configFileParsingDiagnostics,resolutionHost:x.resolutionHost&&x.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:x.skipLoadingLibFiles,libFolderPath:x.libFolderPath}):void 0,x.typeChecker!=null&&(E.errors.throwIfTrue(x.createLanguageService,"Cannot specify a type checker and create a language service."),this.#n=new q5(this),this.#n._reset(()=>x.typeChecker))}get compilerOptions(){return this.#t}get languageService(){if(this.#e==null)throw this.#i("language service");return this.#e}get program(){if(this.#e==null)throw this.#i("program");return this.languageService.getProgram()}get typeChecker(){if(this.#n!=null)return this.#n;if(this.#e==null)throw this.#i("type checker");return this.program.getTypeChecker()}hasLanguageService(){return this.#e!=null}getEncoding(){return this.compilerOptions.getEncoding()}getFormatCodeSettings(){return this.manipulationSettings.getFormatCodeSettings()}getUserPreferences(){return this.manipulationSettings.getUserPreferences()}resetProgram(){this.languageService._reset()}createWriter(){let x=this.manipulationSettings.getIndentationText();return new Fee.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:x===te.IndentationText.Tab?void 0:x.length,useTabs:x===te.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===te.QuoteKind.Single})}getPreEmitDiagnostics(x){return E.ts.getPreEmitDiagnostics(this.program.compilerObject,x?.compilerNode).map(j=>this.compilerFactory.getDiagnostic(j))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(x,k)=>Promise.resolve(this.compilerFactory.addOrGetSourceFileFromFilePath(x,k)?.compilerNode),addOrGetSourceFileFromFilePathSync:(x,k)=>this.compilerFactory.addOrGetSourceFileFromFilePath(x,k)?.compilerNode,containsDirectoryAtPath:x=>this.compilerFactory.containsDirectoryAtPath(x),containsSourceFileAtPath:x=>this.compilerFactory.containsSourceFileAtPath(x),getSourceFileFromCacheFromFilePath:x=>this.compilerFactory.getSourceFileFromCacheFromFilePath(x)?.compilerNode,getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:x=>this.compilerFactory.documentRegistry.getSourceFileVersion(x),getChildDirectoriesOfDirectory:x=>{let k=[];for(let j of this.compilerFactory.getChildDirectoriesOfDirectory(x))k.push(j.getPath());return k}}}getModuleResolutionHost(){return E.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}#i(x){return new E.errors.InvalidOperationError(`A ${x} 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 ${x} should be required for this operation.`)}}})(),sDe=class{_context;constructor(o={}){fe();let u=ke(),b=new E.TransactionalFileSystem({fileSystem:u,skipLoadingLibFiles:o.skipLoadingLibFiles,libFolderPath:o.libFolderPath}),x=o.tsConfigFilePath==null?void 0:new E.TsConfigResolver(b,b.getStandardizedAbsolutePath(o.tsConfigFilePath),ut()),k=tt(),j=new E.CompilerOptionsContainer(o.defaultCompilerOptions);j.set(k),this._context=new TXe({project:this,compilerOptionsContainer:j,fileSystemWrapper:b,createLanguageService:!0,resolutionHost:o.resolutionHost,configFileParsingDiagnostics:x?.getErrors()??[],skipLoadingLibFiles:o.skipLoadingLibFiles,libFolderPath:o.libFolderPath}),o.manipulationSettings!=null&&this._context.manipulationSettings.set(o.manipulationSettings),x!=null&&o.skipAddingFilesFromTsConfig!==!0&&(this.#e(x,k),o.skipFileDependencyResolution||this.resolveSourceFileDependencies());function fe(){if(o.fileSystem!=null&&o.useInMemoryFileSystem)throw new E.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.")}function ke(){return o.useInMemoryFileSystem?new E.InMemoryFileSystemHost:o.fileSystem??new E.RealFileSystemHost}function tt(){return{...ot(),...o.compilerOptions??{}}}function ot(){return x?.getCompilerOptions()??{}}function ut(){let xe="utf-8";return o.compilerOptions!=null?o.compilerOptions.charset??xe:xe}}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let o=new Set,u=j=>o.add(j),{compilerFactory:b,inProjectCoordinator:x}=this._context;b.onSourceFileAdded(u);try{this.getProgram().compilerObject}finally{b.onSourceFileAdded(u,!1)}let k=x.markSourceFilesAsInProjectForResolution();for(let j of k.changedSourceFiles)o.add(j);for(let j of k.unchangedSourceFiles)o.delete(j);return Array.from(o.values())}addDirectoryAtPathIfExists(o,u={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{...u,markInProject:!0})}addDirectoryAtPath(o,u={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{...u,markInProject:!0})}createDirectory(o){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{markInProject:!0})}getDirectoryOrThrow(o,u){return E.errors.throwIfNullOrUndefined(this.getDirectory(o),u??(()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(o)}`))}getDirectory(o){let{compilerFactory:u}=this._context;return u.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o))}getDirectories(){return Array.from(this.#n())}getRootDirectories(){let{inProjectCoordinator:o}=this._context,u=[];for(let x of this._context.compilerFactory.getOrphanDirectories())for(let k of b(x))u.push(k);return u;function*b(x){if(o.isDirectoryInProject(x)){yield x;return}for(let k of x._getDirectoriesIterator())yield*b(k)}}addSourceFilesAtPaths(o){return this._context.directoryCoordinator.addSourceFilesAtPaths(o,{markInProject:!0})}addSourceFileAtPathIfExists(o){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{markInProject:!0})}addSourceFileAtPath(o){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),{markInProject:!0})}addSourceFilesFromTsConfig(o){let u=new E.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),this._context.getEncoding());return this.#e(u,u.getCompilerOptions())}#e(o,u){let b=o.getPaths(u),x=b.filePaths.map(k=>this.addSourceFileAtPath(k));for(let k of b.directoryPaths)this.addDirectoryAtPathIfExists(k);return x}createSourceFile(o,u,b){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(o),u??"",{...b??{},markInProject:!0})}removeSourceFile(o){let u=o.wasForgotten();return o.forget(),!u}getSourceFileOrThrow(o){let u=this.getSourceFile(o);if(u!=null)return u;if(typeof o=="string"){let b=E.FileUtils.standardizeSlashes(o);if(E.FileUtils.pathIsAbsolute(b)||b.indexOf("/")>=0){let x=this._context.fileSystemWrapper.getStandardizedAbsolutePath(b);throw new E.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${x}`)}else throw new E.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${o}`)}else throw new E.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(o){let u=b(this._context.fileSystemWrapper);if(x(u))return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(u);return E.IterableUtils.find(this.#t(),u);function b(k){if(o instanceof Function)return o;let j=E.FileUtils.standardizeSlashes(o);return E.FileUtils.pathIsAbsolute(j)||j.indexOf("/")>=0?k.getStandardizedAbsolutePath(j):fe=>E.FileUtils.pathEndsWith(fe.getFilePath(),j)}function x(k){return typeof k=="string"}}getSourceFiles(o){let{compilerFactory:u,fileSystemWrapper:b}=this._context,x=this.#t();if(typeof o=="string"||o instanceof Array)return Array.from(k());return Array.from(x);function*k(){let j=Array.from(ke()),fe=E.matchGlobs(j,o,b.getCurrentDirectory());for(let tt of fe)yield u.getSourceFileFromCacheFromFilePath(b.getStandardizedAbsolutePath(tt));function*ke(){for(let tt of x)yield tt.getFilePath()}}}*#t(){let{compilerFactory:o,inProjectCoordinator:u}=this._context;for(let b of o.getSourceFilesByDirectoryDepth())u.isSourceFileInProject(b)&&(yield b)}*#n(){let{compilerFactory:o,inProjectCoordinator:u}=this._context;for(let b of o.getDirectoriesByDepth())u.isDirectoryInProject(b)&&(yield b)}getAmbientModule(o){return o=TKe(o),this.getAmbientModules().find(u=>u.getName()===o)}getAmbientModuleOrThrow(o,u){return E.errors.throwIfNullOrUndefined(this.getAmbientModule(o),u??(()=>`Could not find ambient module with name: ${TKe(o)}`))}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this.#r().map(o=>o.save()))}saveSync(){this._context.fileSystemWrapper.flushSync();for(let o of this.#r())o.saveSync()}enableLogging(o=!0){this._context.logger.setEnabled(o)}#r(){return Array.from(o(this._context.compilerFactory.getSourceFilesByDirectoryDepth()));function*o(u){for(let b of u)b.isSaved()||(yield b)}}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(o={}){return this._context.program.emit(o)}emitSync(o={}){return this._context.program.emitSync(o)}emitToMemory(o={}){return this._context.program.emitToMemory(o)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(o){return this._context.compilerFactory.forgetNodesCreatedInBlock(o)}formatDiagnosticsWithColorAndContext(o,u={}){return E.ts.formatDiagnosticsWithColorAndContext(o.map(b=>b.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:b=>b,getNewLine:()=>u.newLineChar??E.runtime.getEndOfLine()})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}};function TKe(h){return o(h[0])&&o(h[h.length-1])&&(h=h.substring(1,h.length-1)),`"${h}"`;function o(u){return u==='"'||u==="'"}}function Vwt(h,o={}){let{compilerOptions:u={},sourceFile:b,typeChecker:x}=o,k=new E.CompilerOptionsContainer;k.set(u);let j=new TXe({project:void 0,fileSystemWrapper:new E.TransactionalFileSystem({fileSystem:new E.RealFileSystemHost,skipLoadingLibFiles:!0,libFolderPath:void 0}),compilerOptionsContainer:k,createLanguageService:!1,typeChecker:x,configFileParsingDiagnostics:[],skipLoadingLibFiles:!0,libFolderPath:void 0}),fe=j.compilerFactory.getSourceFile(ke(),{markInProject:!0});return j.compilerFactory.getNodeFromCompilerNode(h,fe);function ke(){return b??tt(h)}function tt(ot){if(ot.kind===E.SyntaxKind.SourceFile)return ot;if(ot.parent==null)throw new E.errors.InvalidOperationError("Please ensure the node was created from a source file with 'setParentNodes' set to 'true'.");let ut=ot;for(;ut.parent!=null;)ut=ut.parent;if(ut.kind!==E.SyntaxKind.SourceFile)throw new E.errors.NotImplementedError("For some reason the top parent was not a source file.");return ut}}var jwt=new SXe(()=>{throw new E.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")}),lDe=class{constructor(){}static object(o){return u=>{let b=Object.keys(o);u.write("{"),b.length>0&&u.indent(()=>{x()}),u.write("}");function x(){for(let k=0;k<b.length;k++){k>0&&u.write(",").newLine();let j=b[k],fe=o[j];u.write(j),fe!=null&&(u.write(": "),w5(u,fe))}u.newLine()}}}static objectType(o){return u=>{u.write("{"),Uwt(o)&&u.indent(()=>{jwt.forTypeElementMemberedNode().printText(u,o)}),u.write("}")}}static unionType(o,u,...b){return EKe("|",[o,u,...b])}static intersectionType(o,u,...b){return EKe("&",[o,u,...b])}static assertion(o,u){return b=>{w5(b,o),b.spaceIfLastNot().write("as "),w5(b,u)}}static returnStatement(o){return u=>{u.write("return "),u.hangingIndentUnlessBlock(()=>{w5(u,o),u.write(";")})}}};function EKe(h,o){return u=>{Hwt(u,` ${h} `,o)}}function Uwt(h){for(let o of Object.keys(h))if(h[o]!=null&&!(h[o]instanceof Array&&h[o].length===0))return!0;return!1}function Hwt(h,o,u){for(let b=0;b<u.length;b++)h.conditionalWrite(b>0,o),w5(h,u[b])}function w5(h,o){o instanceof Function?o(h):h.write(o.toString())}var{InvalidOperationError:Kwt,FileNotFoundError:Jwt,ArgumentError:qwt,ArgumentNullOrWhitespaceError:Xwt,ArgumentOutOfRangeError:$wt,ArgumentTypeError:Ywt,BaseError:Qwt,DirectoryNotFoundError:Zwt,NotImplementedError:e2t,NotSupportedError:t2t,PathNotFoundError:n2t}=E.errors;Object.defineProperty(te,"CompilerOptionsContainer",{enumerable:!0,get:function(){return E.CompilerOptionsContainer}});Object.defineProperty(te,"DiagnosticCategory",{enumerable:!0,get:function(){return E.DiagnosticCategory}});Object.defineProperty(te,"EmitHint",{enumerable:!0,get:function(){return E.EmitHint}});Object.defineProperty(te,"InMemoryFileSystemHost",{enumerable:!0,get:function(){return E.InMemoryFileSystemHost}});Object.defineProperty(te,"LanguageVariant",{enumerable:!0,get:function(){return E.LanguageVariant}});Object.defineProperty(te,"ModuleKind",{enumerable:!0,get:function(){return E.ModuleKind}});Object.defineProperty(te,"ModuleResolutionKind",{enumerable:!0,get:function(){return E.ModuleResolutionKind}});Object.defineProperty(te,"NewLineKind",{enumerable:!0,get:function(){return E.NewLineKind}});Object.defineProperty(te,"NodeFlags",{enumerable:!0,get:function(){return E.NodeFlags}});Object.defineProperty(te,"ObjectFlags",{enumerable:!0,get:function(){return E.ObjectFlags}});Object.defineProperty(te,"ResolutionHosts",{enumerable:!0,get:function(){return E.ResolutionHosts}});Object.defineProperty(te,"ScriptKind",{enumerable:!0,get:function(){return E.ScriptKind}});Object.defineProperty(te,"ScriptTarget",{enumerable:!0,get:function(){return E.ScriptTarget}});Object.defineProperty(te,"SettingsContainer",{enumerable:!0,get:function(){return E.SettingsContainer}});Object.defineProperty(te,"SymbolFlags",{enumerable:!0,get:function(){return E.SymbolFlags}});Object.defineProperty(te,"SyntaxKind",{enumerable:!0,get:function(){return E.SyntaxKind}});Object.defineProperty(te,"TypeFlags",{enumerable:!0,get:function(){return E.TypeFlags}});Object.defineProperty(te,"TypeFormatFlags",{enumerable:!0,get:function(){return E.TypeFormatFlags}});Object.defineProperty(te,"ts",{enumerable:!0,get:function(){return E.ts}});Object.defineProperty(te,"CodeBlockWriter",{enumerable:!0,get:function(){return Fee.default}});te.AbstractableNode=dR;te.AmbientableNode=O1;te.ArgumentError=qwt;te.ArgumentNullOrWhitespaceError=Xwt;te.ArgumentOutOfRangeError=$wt;te.ArgumentTypeError=Ywt;te.ArgumentedNode=mDe;te.ArrayBindingPattern=$ee;te.ArrayDestructuringAssignment=X1e;te.ArrayDestructuringAssignmentBase=aJe;te.ArrayLiteralExpression=ete;te.ArrayTypeNode=Nne;te.ArrowFunction=hne;te.ArrowFunctionBase=_qe;te.AsExpression=tte;te.AsExpressionBase=sJe;te.AssignmentExpression=z5;te.AssignmentExpressionBase=oJe;te.AsyncableNode=rw;te.AwaitExpression=nte;te.AwaitExpressionBase=lJe;te.AwaitableNode=UKe;te.BaseError=Qwt;te.BaseExpressionedNode=X8;te.BigIntLiteral=hie;te.BigIntLiteralBase=Zqe;te.BinaryExpression=B5;te.BinaryExpressionBase=iJe;te.BindingElement=Yee;te.BindingElementBase=rJe;te.BindingNamedNode=Qie;te.Block=Pte;te.BlockBase=WJe;te.BodiedNode=qie;te.BodyableNode=iw;te.BreakStatement=Nte;te.CallExpression=rte;te.CallExpressionBase=cJe;te.CallSignatureDeclaration=qre;te.CallSignatureDeclarationBase=Dee;te.CaseBlock=Rte;te.CaseBlockBase=BJe;te.CaseClause=Mte;te.CaseClauseBase=zJe;te.CatchClause=Lte;te.CatchClauseBase=GJe;te.ChildOrderableNode=Dv;te.ClassDeclaration=bne;te.ClassDeclarationBase=fee;te.ClassElement=KE;te.ClassExpression=Sne;te.ClassExpressionBase=Sqe;te.ClassLikeDeclarationBase=ADe;te.ClassLikeDeclarationBaseSpecific=vqe;te.ClassStaticBlockDeclaration=Tne;te.ClassStaticBlockDeclarationBase=mee;te.CodeAction=Lie;te.CodeFixAction=kie;te.CombinedCodeActions=_Xe;te.CommaListExpression=ite;te.CommaListExpressionBase=dJe;te.CommentClassElement=Ene;te.CommentEnumMember=Ure;te.CommentObjectLiteralElement=ute;te.CommentRange=Hee;te.CommentStatement=kte;te.CommentTypeElement=Xre;te.CommonIdentifierBase=CDe;te.CompilerCommentClassElement=Bee;te.CompilerCommentEnumMember=Vee;te.CompilerCommentNode=rR;te.CompilerCommentObjectLiteralElement=Gee;te.CompilerCommentStatement=Wee;te.CompilerCommentTypeElement=zee;te.ComputedPropertyName=tie;te.ComputedPropertyNameBase=Hqe;te.ConditionalExpression=ote;te.ConditionalExpressionBase=uJe;te.ConditionalTypeNode=Rne;te.ConstructSignatureDeclaration=$re;te.ConstructSignatureDeclarationBase=Iee;te.ConstructorDeclaration=xne;te.ConstructorDeclarationBase=_ee;te.ConstructorDeclarationOverloadBase=Tqe;te.ConstructorTypeNode=Mne;te.ConstructorTypeNodeBase=Dqe;te.ContinueStatement=wte;te.DebuggerStatement=Ote;te.DebuggerStatementBase=VJe;te.DecoratableNode=ow;te.Decorator=Cne;te.DecoratorBase=vee;te.DefaultClause=Fte;te.DefaultClauseBase=jJe;te.DefinitionInfo=NDe;te.DeleteExpression=ate;te.DeleteExpressionBase=pJe;te.Diagnostic=aoe;te.DiagnosticMessageChain=K5;te.DiagnosticWithLocation=J5;te.Directory=Hie;te.DirectoryEmitResult=$5;te.DirectoryNotFoundError=Zwt;te.DoStatement=Wte;te.DoStatementBase=UJe;te.DocumentSpan=Y8;te.DotDotDotTokenableNode=Y5;te.ElementAccessExpression=G5;te.ElementAccessExpressionBase=fJe;te.EmitOutput=hXe;te.EmitResult=Oie;te.EmptyStatement=Bte;te.EmptyStatementBase=HJe;te.EnumDeclaration=Hre;te.EnumDeclarationBase=xee;te.EnumMember=Kre;te.EnumMemberBase=Aee;te.ExclamationTokenableNode=hDe;te.ExportAssignment=Yte;te.ExportAssignmentBase=Z1e;te.ExportDeclaration=Qte;te.ExportDeclarationBase=ree;te.ExportGetableNode=gDe;te.ExportSpecifier=Zte;te.ExportSpecifierBase=eDe;te.ExportableNode=F1;te.Expression=Kp;te.ExpressionStatement=zte;te.ExpressionStatementBase=KJe;te.ExpressionWithTypeArguments=Lne;te.ExpressionWithTypeArgumentsBase=Iqe;te.ExpressionableNode=t9;te.ExpressionedNode=Wm;te.ExtendsClauseableNode=YKe;te.ExternalModuleReference=ene;te.ExternalModuleReferenceBase=rqe;te.FalseLiteral=yie;te.FalseLiteralBase=tXe;te.FileNotFoundError=Jwt;te.FileReference=W8;te.FileTextChanges=n9;te.ForInStatement=Gte;te.ForInStatementBase=JJe;te.ForOfStatement=Vte;te.ForOfStatementBase=qJe;te.ForStatement=jte;te.ForStatementBase=XJe;te.FunctionDeclaration=gne;te.FunctionDeclarationBase=dee;te.FunctionDeclarationOverloadBase=hqe;te.FunctionExpression=yne;te.FunctionExpressionBase=gqe;te.FunctionLikeDeclaration=dw;te.FunctionOrConstructorTypeNodeBase=j5;te.FunctionOrConstructorTypeNodeBaseBase=Aqe;te.FunctionTypeNode=kne;te.FunctionTypeNodeBase=Cqe;te.GeneratorableNode=sw;te.GetAccessorDeclaration=Ane;te.GetAccessorDeclarationBase=hee;te.HeritageClause=Jre;te.HeritageClauseableNode=vDe;te.Identifier=H5;te.IdentifierBase=Kqe;te.IfStatement=Ute;te.IfStatementBase=$Je;te.ImplementationLocation=gXe;te.ImplementsClauseableNode=QKe;te.ImportAttribute=tne;te.ImportAttributeBase=iee;te.ImportAttributeNamedNode=ZKe;te.ImportAttributes=nne;te.ImportAttributesBase=iqe;te.ImportClause=rne;te.ImportClauseBase=oqe;te.ImportDeclaration=ine;te.ImportDeclarationBase=oee;te.ImportEqualsDeclaration=one;te.ImportEqualsDeclarationBase=sqe;te.ImportExpression=ste;te.ImportExpressionBase=mJe;te.ImportExpressionedNode=Jkt;te.ImportSpecifier=ane;te.ImportSpecifierBase=aee;te.ImportTypeNode=wne;te.IndexSignatureDeclaration=Yre;te.IndexSignatureDeclarationBase=Cee;te.IndexedAccessTypeNode=One;te.InferTypeNode=Fne;te.InitializerExpressionGetableNode=Yie;te.InitializerExpressionableNode=lw;te.InterfaceDeclaration=Qre;te.InterfaceDeclarationBase=Pee;te.IntersectionTypeNode=Wne;te.InvalidOperationError=Kwt;te.IterationStatement=sR;te.JSDoc=Pne;te.JSDocAllType=nre;te.JSDocAugmentsTag=rre;te.JSDocAuthorTag=ire;te.JSDocBase=bee;te.JSDocCallbackTag=ore;te.JSDocClassTag=are;te.JSDocDeprecatedTag=sre;te.JSDocEnumTag=lre;te.JSDocFunctionType=cre;te.JSDocFunctionTypeBase=wqe;te.JSDocImplementsTag=dre;te.JSDocImportTag=ure;te.JSDocLink=pre;te.JSDocLinkCode=fre;te.JSDocLinkPlain=mre;te.JSDocMemberName=_re;te.JSDocNameReference=gre;te.JSDocNamepathType=hre;te.JSDocNonNullableType=yre;te.JSDocNullableType=vre;te.JSDocOptionalType=bre;te.JSDocOverloadTag=Sre;te.JSDocOverloadTagBase=Oqe;te.JSDocOverrideTag=Tre;te.JSDocParameterTag=Ere;te.JSDocParameterTagBase=Fqe;te.JSDocPrivateTag=xre;te.JSDocPropertyLikeTag=DDe;te.JSDocPropertyTag=Are;te.JSDocPropertyTagBase=Wqe;te.JSDocProtectedTag=Dre;te.JSDocPublicTag=Ire;te.JSDocReadonlyTag=Cre;te.JSDocReturnTag=Pre;te.JSDocReturnTagBase=Bqe;te.JSDocSatisfiesTag=Nre;te.JSDocSatisfiesTagBase=zqe;te.JSDocSeeTag=Rre;te.JSDocSeeTagBase=Gqe;te.JSDocSignature=Mre;te.JSDocTag=fp;te.JSDocTagBase=Eee;te.JSDocTagInfo=U5;te.JSDocTemplateTag=Lre;te.JSDocTemplateTagBase=Vqe;te.JSDocText=kre;te.JSDocThisTag=wre;te.JSDocThisTagBase=jqe;te.JSDocThrowsTag=Ore;te.JSDocThrowsTagBase=Uqe;te.JSDocType=lT;te.JSDocTypeExpression=Wre;te.JSDocTypeExpressionableTag=uw;te.JSDocTypeLiteral=Bre;te.JSDocTypeParameteredTag=Eqe;te.JSDocTypeTag=zre;te.JSDocTypedefTag=Fre;te.JSDocUnknownTag=Gre;te.JSDocUnknownType=Vre;te.JSDocVariadicType=jre;te.JSDocableNode=Jp;te.JsxAttribute=iie;te.JsxAttributeBase=Mee;te.JsxAttributedNode=IDe;te.JsxClosingElement=oie;te.JsxClosingElementBase=qqe;te.JsxClosingFragment=aie;te.JsxElement=sie;te.JsxElementBase=Lee;te.JsxExpression=lie;te.JsxExpressionBase=Xqe;te.JsxFragment=cie;te.JsxNamespacedName=die;te.JsxNamespacedNameBase=$qe;te.JsxOpeningElement=uie;te.JsxOpeningElementBase=Yqe;te.JsxOpeningFragment=pie;te.JsxSelfClosingElement=fie;te.JsxSelfClosingElementBase=kee;te.JsxSpreadAttribute=mie;te.JsxSpreadAttributeBase=wee;te.JsxTagNamedNode=ooe;te.JsxText=_ie;te.JsxTextBase=Qqe;te.LabeledStatement=Hte;te.LabeledStatementBase=YJe;te.LanguageService=jie;te.LeftHandSideExpression=G8;te.LeftHandSideExpressionedNode=cw;te.LiteralExpression=aR;te.LiteralExpressionBase=_Je;te.LiteralLikeNode=K8;te.LiteralTypeNode=Bne;te.ManipulationError=Uee;te.ManipulationSettingsContainer=jee;te.MappedTypeNode=zne;te.MemberExpression=ew;te.MemoryEmitResult=Fie;te.MetaProperty=lte;te.MetaPropertyBase=hJe;te.MethodDeclaration=V8;te.MethodDeclarationBase=pee;te.MethodDeclarationOverloadBase=yqe;te.MethodSignature=Zre;te.MethodSignatureBase=Nee;te.ModifierableNode=M_;te.ModuleBlock=sne;te.ModuleBlockBase=lqe;te.ModuleChildableNode=uR;te.ModuleDeclaration=lne;te.ModuleDeclarationBase=see;te.ModuleNamedNode=eJe;te.ModuledNode=bDe;te.NameableNode=Zie;te.NamedExports=cne;te.NamedExportsBase=cqe;te.NamedImports=dne;te.NamedImportsBase=dqe;te.NamedNode=z1;te.NamedNodeBase=J8;te.NamedTupleMember=Gne;te.NamedTupleMemberBase=Pqe;te.NamespaceExport=une;te.NamespaceExportBase=uqe;te.NamespaceImport=pne;te.NamespaceImportBase=pqe;te.NewExpression=cte;te.NewExpressionBase=gJe;te.NoSubstitutionTemplateLiteral=Eie;te.NoSubstitutionTemplateLiteralBase=sXe;te.Node=yn;te.NodeWithTypeArguments=nw;te.NodeWithTypeArgumentsBase=xqe;te.NonNullExpression=dte;te.NonNullExpressionBase=yJe;te.NotEmittedStatement=Kte;te.NotEmittedStatementBase=QJe;te.NotImplementedError=e2t;te.NotSupportedError=t2t;te.NullLiteral=vie;te.NullLiteralBase=rXe;te.NumericLiteral=bie;te.NumericLiteralBase=iXe;te.ObjectBindingPattern=Qee;te.ObjectDestructuringAssignment=$1e;te.ObjectDestructuringAssignmentBase=vJe;te.ObjectLiteralElement=tw;te.ObjectLiteralExpression=pte;te.ObjectLiteralExpressionBase=bJe;te.OmittedExpression=hte;te.OmittedExpressionBase=SJe;te.OptionalTypeNode=Vne;te.OutputFile=wie;te.OverloadableNode=roe;te.OverrideableNode=Z5;te.ParameterDeclaration=vne;te.ParameterDeclarationBase=uee;te.ParameteredNode=tJe;te.ParenthesizedExpression=gte;te.ParenthesizedExpressionBase=TJe;te.ParenthesizedTypeNode=jne;te.PartiallyEmittedExpression=yte;te.PartiallyEmittedExpressionBase=EJe;te.PathNotFoundError=n2t;te.PostfixUnaryExpression=vte;te.PostfixUnaryExpressionBase=xJe;te.PrefixUnaryExpression=bte;te.PrefixUnaryExpressionBase=AJe;te.PrimaryExpression=d_;te.PrivateIdentifier=nie;te.PrivateIdentifierBase=Jqe;te.Program=Vie;te.Project=sDe;te.PropertyAccessExpression=V5;te.PropertyAccessExpressionBase=DJe;te.PropertyAssignment=fte;te.PropertyAssignmentBase=eee;te.PropertyDeclaration=Dne;te.PropertyDeclarationBase=gee;te.PropertyNamedNode=yC;te.PropertySignature=eie;te.PropertySignatureBase=Ree;te.QualifiedName=rie;te.QuestionDotTokenableNode=eoe;te.QuestionTokenableNode=G1;te.ReadonlyableNode=e9;te.RefactorEditInfo=yXe;te.ReferenceEntry=Wie;te.ReferenceFindableNode=B1;te.ReferencedSymbol=vXe;te.ReferencedSymbolDefinitionInfo=bXe;te.ReferencedSymbolEntry=Bie;te.RegularExpressionLiteral=Sie;te.RegularExpressionLiteralBase=oXe;te.RenameLocation=zie;te.RenameableNode=Cx;te.RestTypeNode=Une;te.ReturnStatement=Jte;te.ReturnStatementBase=ZJe;te.ReturnTypedNode=SDe;te.SatisfiesExpression=Ste;te.SatisfiesExpressionBase=IJe;te.ScopeableNode=nJe;te.ScopedNode=cR;te.SetAccessorDeclaration=Ine;te.SetAccessorDeclarationBase=yee;te.ShorthandPropertyAssignment=mte;te.ShorthandPropertyAssignmentBase=tee;te.Signature=Mie;te.SignaturedDeclaration=Px;te.SourceFile=B8;te.SourceFileBase=lee;te.SpreadAssignment=_te;te.SpreadAssignmentBase=nee;te.SpreadElement=Tte;te.SpreadElementBase=CJe;te.Statement=Vd;te.StatementBase=FJe;te.StatementedNode=j1;te.StaticableNode=q8;te.StringLiteral=Tie;te.StringLiteralBase=aXe;te.Structure=k5;te.SuperElementAccessExpression=Y1e;te.SuperElementAccessExpressionBase=PJe;te.SuperExpression=Ete;te.SuperExpressionBase=NJe;te.SuperExpressionedNode=xDe;te.SuperPropertyAccessExpression=Q1e;te.SuperPropertyAccessExpressionBase=RJe;te.SwitchStatement=qte;te.SwitchStatementBase=eqe;te.Symbol=mXe;te.SymbolDisplayPart=Gie;te.SyntaxList=Kee;te.TaggedTemplateExpression=xie;te.TemplateExpression=Aie;te.TemplateExpressionBase=lXe;te.TemplateHead=Die;te.TemplateHeadBase=cXe;te.TemplateLiteralTypeNode=Hne;te.TemplateMiddle=Iie;te.TemplateMiddleBase=dXe;te.TemplateSpan=Cie;te.TemplateSpanBase=uXe;te.TemplateTail=Pie;te.TemplateTailBase=pXe;te.TextChange=U8;te.TextInsertableNode=u_;te.TextRange=F5;te.TextSpan=j8;te.ThisExpression=xte;te.ThisExpressionBase=MJe;te.ThisTypeNode=Kne;te.ThrowStatement=Xte;te.ThrowStatementBase=tqe;te.TrueLiteral=gie;te.TrueLiteralBase=eXe;te.TryStatement=$te;te.TryStatementBase=nqe;te.TupleTypeNode=Jne;te.Type=X5;te.TypeAliasDeclaration=qne;te.TypeAliasDeclarationBase=See;te.TypeArgumentedNode=toe;te.TypeAssertion=Ate;te.TypeAssertionBase=LJe;te.TypeChecker=q5;te.TypeElement=hC;te.TypeElementMemberedNode=EDe;te.TypeLiteralNode=Xne;te.TypeLiteralNodeBase=Nqe;te.TypeNode=Ef;te.TypeOfExpression=Dte;te.TypeOfExpressionBase=kJe;te.TypeOperatorTypeNode=$ne;te.TypeParameter=Uie;te.TypeParameterDeclaration=Yne;te.TypeParameterDeclarationBase=Tee;te.TypeParameteredNode=cT;te.TypePredicateNode=Qne;te.TypeQueryNode=Zne;te.TypeReferenceNode=ere;te.TypedNode=V1;te.UnaryExpression=Dx;te.UnaryExpressionedNode=$8;te.UnionTypeNode=tre;te.UnwrappableNode=noe;te.UpdateExpression=Zee;te.VariableDeclaration=Nie;te.VariableDeclarationBase=Oee;te.VariableDeclarationList=Rie;te.VariableDeclarationListBase=fXe;te.VariableStatement=fne;te.VariableStatementBase=cee;te.VoidExpression=Ite;te.VoidExpressionBase=wJe;te.WhileStatement=mne;te.WhileStatementBase=fqe;te.WithStatement=_ne;te.WithStatementBase=mqe;te.Writers=lDe;te.YieldExpression=Cte;te.YieldExpressionBase=OJe;te.createWrappedNode=Vwt;te.forEachStructureChild=akt;te.getCompilerOptionsFromTsConfig=SLt;te.getScopeForNode=Xee;te.insertOverloads=ioe;te.printNode=IAe;te.setScopeForNode=TDe});var u2t={};module.exports=GCt(u2t);var mw=require("node:worker_threads");var $je={debug:0,info:1,warn:2,error:3,none:4};function VCt(h){let o=globalThis.process,u=h==="stdout"?o?.stdout:o?.stderr;return u?.write?u:null}function jCt(h,o){h&&h.write(o.endsWith(`
|
|
42156
42156
|
`)?o:`${o}
|
|
42157
42157
|
`)}function UCt(h){let o=typeof h.name=="string"?h.name:void 0,u=typeof h.message=="string"?h.message:void 0,b=typeof h.stack=="string"?h.stack:void 0;if(!o&&!u)return null;let x=`${o??"Error"}: ${u??""}`;return b?`${x}
|
|
42158
|
-
${b}`:x}function HCt(h){if(typeof h=="string")return h;if(h instanceof Error)return`${h.name}: ${h.message}`;if(h&&typeof h=="object"){let o=UCt(h);if(o)return o}try{return JSON.stringify(h)}catch{return String(h)}}function KCt(h){return h.length===0?"":" "+h.map(HCt).join(" ")}var xZ=class{_level;prefix;constructor(o="",u="info"){this.prefix=o?`[${o}]`:"",this._level=u}get level(){return this._level}setLevel(o){this._level=o}shouldLog(o){return $je[o]>=$je[this._level]}formatMessage(o,u){return`${new Date().toISOString()} ${this.prefix} [${o.toUpperCase()}] ${u}`}logTo(o,u,b,x){this.shouldLog(u)&&jCt(VCt(o),this.formatMessage(u,b+KCt(x)))}debug(o,...u){this.logTo("stdout","debug",o,u)}info(o,...u){this.logTo("stdout","info",o,u)}warn(o,...u){this.logTo("stderr","warn",o,u)}error(o,...u){this.logTo("stderr","error",o,u)}};var vxe=class{level="none";setLevel(){}debug(){}info(){}warn(){}error(){}},AZ=class{delegate;constructor(o){this.delegate=o}get level(){return this.delegate.level}setLevel(o){this.delegate.setLevel(o)}setDelegate(o){this.delegate=o}debug(o,...u){this.delegate.debug(o,...u)}info(o,...u){this.delegate.info(o,...u)}warn(o,...u){this.delegate.warn(o,...u)}error(o,...u){this.delegate.error(o,...u)}},bxe=class{defaultLevel="info";loggers=new Map;backend;setDefaultLevel(o){this.defaultLevel=o;for(let u of this.loggers.values())u.setLevel(o)}getDefaultLevel(){return this.defaultLevel}getLogger(o){let u=this.loggers.get(o);if(!u){let b=this.backend?this.backend.createLogger(o,this.defaultLevel):new xZ(o,this.defaultLevel);u=new AZ(b),this.loggers.set(o,u)}return u}getNullLogger(){let o=new vxe;return new AZ(o)}clear(){this.loggers.clear()}setBackend(o){this.backend=o;for(let[u,b]of this.loggers.entries()){let x=b.level??this.defaultLevel,k=o?o.createLogger(u,x):new xZ(u,x);b.setDelegate(k)}}getBackend(){return this.backend}},JCt=new bxe;function x8(h){return JCt.getLogger(h)}var Yje=Ex(require("node:path")),qCt={".ts":"typescript",".tsx":"typescript",".mts":"typescript",".cts":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".rs":"rust",".vue":"vue",".svelte":"svelte",".gql":"graphql",".graphql":"graphql"};function Qje(h){let o=h;return h.includes("/")||h.includes("\\")?o=Yje.extname(h).toLowerCase():(o.startsWith(".")||(o="."+o),o=o.toLowerCase()),qCt[o]||"unknown"}var r9=Ex(RDe()),soe=class{project;constructor(){this.project=new r9.Project({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0,compilerOptions:{target:99,module:99,strict:!0}})}extractSignatures(o,u){let b=this.getOrCreateSourceFile(o,u),x=[];for(let k of b.getFunctions()){let j=this.extractFunctionSignature(k);j&&x.push(j)}for(let k of b.getClasses()){let j=k.getName()??"Anonymous",fe=k.getConstructors()[0];fe&&x.push({name:`${j}.constructor`,kind:"constructor",parameters:this.extractParameters(fe.getParameters()),returnType:j,isAsync:!1,line:fe.getStartLineNumber()});for(let ke of k.getMethods()){let tt=ke.getName();x.push({name:`${j}.${tt}`,kind:"method",parameters:this.extractParameters(ke.getParameters()),returnType:this.safeGetTypeText(ke.getReturnType(),"void"),isAsync:ke.isAsync(),isStatic:ke.isStatic(),visibility:this.getVisibility(ke),typeParameters:ke.getTypeParameters().map(ot=>this.safeGetText(ot)),line:ke.getStartLineNumber()})}}for(let k of b.getVariableDeclarations()){let j=k.getInitializer();if(j?.getKind()===r9.SyntaxKind.ArrowFunction){let fe=j.asKindOrThrow(r9.SyntaxKind.ArrowFunction);x.push({name:k.getName(),kind:"arrow",parameters:this.extractParameters(fe.getParameters()),returnType:this.safeGetTypeText(fe.getReturnType(),"unknown"),isAsync:fe.isAsync(),line:k.getStartLineNumber()})}}return x}extractInterfaceMembers(o,u){let b=this.getOrCreateSourceFile(o,u),x=new Map;for(let k of b.getInterfaces()){let j=k.getName(),fe=[];for(let ke of k.getProperties())fe.push({name:ke.getName(),kind:"property",type:this.safeGetTypeText(ke.getType(),"unknown"),isOptional:ke.hasQuestionToken(),isReadonly:ke.isReadonly()});for(let ke of k.getMethods()){let tt=ke.getParameters().map(ut=>`${ut.getName()}: ${this.safeGetTypeText(ut.getType(),"unknown")}`).join(", "),ot=this.safeGetTypeText(ke.getReturnType(),"unknown");fe.push({name:ke.getName(),kind:"method",type:`(${tt}) => ${ot}`,isOptional:ke.hasQuestionToken(),isReadonly:!1})}x.set(j,fe)}return x}extractTypeAliases(o,u){let b=this.getOrCreateSourceFile(o,u),x=[];for(let k of b.getTypeAliases())x.push({name:k.getName(),type:this.safeGetTypeText(k.getType(),"unknown"),typeParameters:k.getTypeParameters().map(j=>this.safeGetText(j))});return x}compareSignatures(o,u){let b=[],x=[];if(this.compareParameters(o,u,b,x),o.returnType!==u.returnType&&b.push({type:"return-type-changed",symbolName:u.name,description:`Return type changed from '${o.returnType}' to '${u.returnType}'`,severity:"error",oldValue:o.returnType,newValue:u.returnType,line:u.line}),o.visibility&&u.visibility){let k={public:3,protected:2,private:1},j=k[o.visibility];k[u.visibility]<j&&b.push({type:"visibility-reduced",symbolName:u.name,description:`Visibility reduced from '${o.visibility}' to '${u.visibility}'`,severity:"error",oldValue:o.visibility,newValue:u.visibility,line:u.line})}return{symbolName:u.name,hasBreakingChanges:b.length>0,breakingChanges:b,nonBreakingChanges:x}}compareInterfaces(o,u,b){let x=[],k=[],j=new Map(u.map(ke=>[ke.name,ke])),fe=new Map(b.map(ke=>[ke.name,ke]));for(let[ke,tt]of j)fe.has(ke)||x.push({type:"member-removed",symbolName:`${o}.${ke}`,description:`Member '${ke}' was removed from interface '${o}'`,severity:"error",oldValue:tt.type});for(let[ke,tt]of fe){let ot=j.get(ke);if(!ot){tt.isOptional?k.push(`New optional member '${ke}' added`):x.push({type:"member-optional-to-required",symbolName:`${o}.${ke}`,description:`New required member '${ke}' added to interface '${o}'`,severity:"error",newValue:tt.type});continue}ot.type!==tt.type&&x.push({type:"member-type-changed",symbolName:`${o}.${ke}`,description:`Type of member '${ke}' changed from '${ot.type}' to '${tt.type}'`,severity:"error",oldValue:ot.type,newValue:tt.type}),ot.isOptional&&!tt.isOptional&&x.push({type:"member-optional-to-required",symbolName:`${o}.${ke}`,description:`Member '${ke}' changed from optional to required`,severity:"error"})}return{symbolName:o,hasBreakingChanges:x.length>0,breakingChanges:x,nonBreakingChanges:k}}compareTypeAliases(o,u){let b=[],x=[];return o.type!==u.type&&b.push({type:"type-alias-changed",symbolName:u.name,description:`Type alias '${u.name}' changed from '${o.type}' to '${u.type}'`,severity:"warning",oldValue:o.type,newValue:u.type}),{symbolName:u.name,hasBreakingChanges:b.length>0,breakingChanges:b,nonBreakingChanges:x}}analyzeBreakingChanges(o,u,b){let x=[];return this.compareFunctions(o,u,b,x),this.compareInterfaceDefinitions(o,u,b,x),this.compareTypeAliasDefinitions(o,u,b,x),x}compareFunctions(o,u,b,x){let k=this.extractSignatures(`${o}.old`,u),j=this.extractSignatures(`${o}.new`,b),fe=new Map(k.map(tt=>[tt.name,tt])),ke=new Map(j.map(tt=>[tt.name,tt]));for(let[tt,ot]of fe){let ut=ke.get(tt);if(ut){let xe=this.compareSignatures(ot,ut);(xe.hasBreakingChanges||xe.nonBreakingChanges.length>0)&&x.push(xe)}else x.push(this.createRemovedResult(tt,"member-removed",`Function '${tt}' was removed`,ot.line))}}compareInterfaceDefinitions(o,u,b,x){let k=this.extractInterfaceMembers(`${o}.old`,u),j=this.extractInterfaceMembers(`${o}.new`,b);for(let[fe,ke]of k){let tt=j.get(fe);if(tt){let ot=this.compareInterfaces(fe,ke,tt);(ot.hasBreakingChanges||ot.nonBreakingChanges.length>0)&&x.push(ot)}else x.push(this.createRemovedResult(fe,"member-removed",`Interface '${fe}' was removed`))}}compareTypeAliasDefinitions(o,u,b,x){let k=this.extractTypeAliases(`${o}.old`,u),j=this.extractTypeAliases(`${o}.new`,b),fe=new Map(k.map(tt=>[tt.name,tt])),ke=new Map(j.map(tt=>[tt.name,tt]));for(let[tt,ot]of fe){let ut=ke.get(tt);if(ut){let xe=this.compareTypeAliases(ot,ut);xe.hasBreakingChanges&&x.push(xe)}else x.push(this.createRemovedResult(tt,"type-alias-changed",`Type alias '${tt}' was removed`))}}createRemovedResult(o,u,b,x){return{symbolName:o,hasBreakingChanges:!0,breakingChanges:[{type:u,symbolName:o,description:b,severity:"error",line:x}],nonBreakingChanges:[]}}getOrCreateSourceFile(o,u){let b=this.project.getSourceFile(o);return b&&this.project.removeSourceFile(b),this.project.createSourceFile(o,u)}extractFunctionSignature(o){let u=o.getName();if(!u)return null;let b;try{let x=o.getReturnType();b=this.safeGetTypeText(x,"void")}catch{b="void"}return{name:u,kind:"function",parameters:this.extractParameters(o.getParameters()),returnType:b,isAsync:o.isAsync(),typeParameters:o.getTypeParameters().map(x=>this.safeGetText(x)),line:o.getStartLineNumber()}}extractParameters(o){return o.map((u,b)=>({name:u.getName(),type:this.safeGetTypeText(u.getType(),"unknown"),isOptional:u.isOptional(),hasDefault:u.hasInitializer(),isRest:u.isRestParameter(),position:b}))}safeGetTypeText(o,u){if(!o)return u;try{let b=o.getText();return b.length>200?o.getBaseTypeOfLiteralType()?.getText()??u:b||u}catch{return u}}safeGetText(o){if(!o)return"";try{return o.getText?.()??""}catch{return""}}getVisibility(o){let u=o.getScope?.();if(!u)return"public";let b=u.toString();return b.includes("Private")?"private":b.includes("Protected")?"protected":"public"}compareParameters(o,u,b,x){let k=o.parameters,j=u.parameters,fe=new Map(k.map(tt=>[tt.name,tt])),ke=new Map(j.map(tt=>[tt.name,tt]));this.detectRemovedParameters(k,ke,u,b),this.detectNewAndChangedParameters(j,fe,u,b,x),this.detectPositionChanges(k,j,x)}detectRemovedParameters(o,u,b,x){for(let k of o)u.has(k.name)||x.push({type:"parameter-removed",symbolName:b.name,description:`Parameter '${k.name}' was removed`,severity:"error",oldValue:`${k.name}: ${k.type}`,line:b.line})}detectNewAndChangedParameters(o,u,b,x,k){for(let j of o){let fe=u.get(j.name);if(!fe){this.handleNewParameter(j,b,x,k);continue}this.handleChangedParameter(fe,j,b,x)}}handleNewParameter(o,u,b,x){o.isOptional||o.hasDefault?x.push(`New optional parameter '${o.name}' added`):b.push({type:"parameter-added-required",symbolName:u.name,description:`New required parameter '${o.name}' added`,severity:"error",newValue:`${o.name}: ${o.type}`,line:u.line})}handleChangedParameter(o,u,b,x){o.type!==u.type&&x.push({type:"parameter-type-changed",symbolName:b.name,description:`Type of parameter '${u.name}' changed from '${o.type}' to '${u.type}'`,severity:"error",oldValue:o.type,newValue:u.type,line:b.line});let k=o.isOptional||o.hasDefault,j=!u.isOptional&&!u.hasDefault;k&&j&&x.push({type:"parameter-optional-to-required",symbolName:b.name,description:`Parameter '${u.name}' changed from optional to required`,severity:"error",line:b.line})}detectPositionChanges(o,u,b){let x=Math.min(o.length,u.length);for(let k=0;k<x;k++)o[k].name!==u[k].name&&b.push(`Parameter order changed at position ${k}: '${o[k].name}' \u2192 '${u[k].name}'`)}};var Md=Ex(RDe());var fw=Ex(require("node:fs/promises")),loe=Ex(require("node:fs"));function pw(h){if(!h)return h;let o=h.replaceAll("\\","/");return o=o.replaceAll(/\/+/g,"/"),/^[A-Za-z]:\//.test(o)&&(o=o[0].toLowerCase()+o.slice(1)),o.length>1&&o.endsWith("/")&&!/^[a-zA-Z]:\/$/.test(o)&&(o=o.slice(0,-1)),o}var Dy=class h extends Error{code;filePath;cause;timestamp;constructor(o,u,b){super(o),this.name="SpiderError",this.code=u,this.filePath=b?.filePath,this.cause=b?.cause,this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,h)}static fromError(o,u){if(o instanceof h)return o;let b=o instanceof Error?o:void 0,x=b?.message||String(o),k="UNKNOWN";if(b){let j=b.code;j==="ENOENT"?k="FILE_NOT_FOUND":j==="EACCES"||j==="EPERM"?k="PERMISSION_DENIED":x.includes("too large")||j==="EFBIG"?k="FILE_TOO_LARGE":x.includes("parse")||x.includes("syntax")?k="PARSE_ERROR":(x.includes("timeout")||j==="ETIMEDOUT")&&(k="TIMEOUT")}return new h(x,k,{filePath:u,cause:b})}isRecoverable(){return["FILE_NOT_FOUND","PERMISSION_DENIED","PARSE_ERROR","RESOLUTION_FAILED"].includes(this.code)}toUserMessage(){switch(this.code){case"FILE_NOT_FOUND":return`File not found: ${this.filePath||"unknown"}`;case"PERMISSION_DENIED":return`Permission denied: ${this.filePath||"unknown"}`;case"FILE_TOO_LARGE":return`File too large to process: ${this.filePath||"unknown"}`;case"PARSE_ERROR":return`Failed to parse: ${this.filePath||"unknown"}`;case"RESOLUTION_FAILED":return`Could not resolve module in: ${this.filePath||"unknown"}`;case"TIMEOUT":return"Operation timed out";case"CIRCULAR_DEPENDENCY":return"Circular dependency detected";default:return this.message}}toJSON(){return{name:this.name,code:this.code,message:this.message,filePath:this.filePath,timestamp:this.timestamp,stack:this.stack}}};var r2t=x8("FileReader"),i2t=5*1024*1024,o2t=64*1024,a2t=3e4,pR=class{maxSize;chunkSize;timeout;constructor(o={}){this.maxSize=o.maxSize??i2t,this.chunkSize=o.chunkSize??o2t,this.timeout=o.timeout??a2t}async getFileSize(o){try{let u=await fw.stat(o);return{size:u.size,isLarge:u.size>this.maxSize,path:o}}catch(u){throw Dy.fromError(u,o)}}async readFile(o,u){let b=u?.maxSize??this.maxSize,x=u?.timeout??this.timeout,k=u?.streaming??!1,j=new Promise((fe,ke)=>{setTimeout(()=>{ke(new Dy(`File read timed out after ${x}ms: ${o}`,"TIMEOUT",{filePath:o}))},x)});try{let fe=await fw.stat(o);if(fe.size>b)throw new Dy(`File too large: ${o} (${this.formatSize(fe.size)} > ${this.formatSize(b)})`,"FILE_TOO_LARGE",{filePath:o});return k||fe.size>1024*1024?(r2t.debug(`Streaming read for large file: ${o} (${this.formatSize(fe.size)})`),await Promise.race([this.readFileStreaming(o),j])):await Promise.race([fw.readFile(o,"utf-8"),j])}catch(fe){throw fe instanceof Dy?fe:Dy.fromError(fe,o)}}async readFileStreaming(o){return new Promise((u,b)=>{let x=[],k=loe.createReadStream(o,{highWaterMark:this.chunkSize});k.on("data",j=>{x.push(Buffer.isBuffer(j)?j:Buffer.from(j))}),k.on("end",()=>{let j=Buffer.concat(x).toString("utf-8");u(j)}),k.on("error",j=>{b(Dy.fromError(j,o))})})}async readFileIfExists(o){try{return await this.readFile(o)}catch(u){if(u instanceof Dy&&u.code==="FILE_NOT_FOUND")return null;throw u}}async canRead(o){try{return await fw.access(o,loe.constants.R_OK),!0}catch{return!1}}formatSize(o){return o<1024?`${o}B`:o<1024*1024?`${(o/1024).toFixed(1)}KB`:`${(o/(1024*1024)).toFixed(1)}MB`}};function MDe(h){switch(h){case"FunctionDeclaration":case"ArrowFunction":case"MethodDeclaration":case"GetAccessor":case"SetAccessor":return"function";case"ClassDeclaration":return"class";case"InterfaceDeclaration":return"interface";case"TypeAliasDeclaration":return"type";case"VariableDeclaration":case"PropertyDeclaration":case"EnumDeclaration":return"variable";default:return"other"}}var EXe=x8("SymbolAnalyzer"),coe=class{project;maxFiles;fileCount=0;fileReader;constructor(o,u={}){this.maxFiles=u.maxFiles??100,this.project=this.createProject(),this.fileReader=new pR}createProject(){return new Md.Project({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0,compilerOptions:{target:99,module:99}})}maybeResetProject(){this.fileCount>=this.maxFiles&&(EXe.debug(`Resetting ts-morph project (${this.fileCount} files in memory)`),this.project=this.createProject(),this.fileCount=0)}getFileCount(){return this.fileCount}reset(){EXe.debug("Forcing ts-morph project reset"),this.project=this.createProject(),this.fileCount=0}analyzeFileContent(o,u){this.maybeResetProject();let b=this.getOrCreateSourceFile(o,u),x=[],k=[],j=this.extractExportedSymbols(b,o,x);return this.extractNonExportedSymbols(b,o,j,x),this.buildDependencies(b,k),{symbols:x,dependencies:k}}getOrCreateSourceFile(o,u){let b=this.project.getSourceFile(o);return b?b.replaceWithText(u):(b=this.project.createSourceFile(o,u),this.fileCount++),b}extractExportedSymbols(o,u,b){let x=o.getExportedDeclarations(),k=new Set(x.keys());for(let[j,fe]of x){let ke=fe[0];ke&&(this.addSymbol(b,j,ke.getKindName(),ke.getStartLineNumber(),u,!0),ke.getKindName()==="ClassDeclaration"&&Md.Node.isClassDeclaration(ke)&&this.extractClassMembers(ke,u,b))}return k}extractNonExportedSymbols(o,u,b,x){let k=o.getStatements();for(let j of k)Md.Node.isVariableStatement(j)?this.extractVariableDeclarations(j,u,b,x):this.extractOtherDeclarations(j,u,b,x)}extractVariableDeclarations(o,u,b,x){let k=o.getDeclarations();for(let j of k){let fe=j.getName();b.has(fe)||this.addSymbol(x,fe,"VariableDeclaration",j.getStartLineNumber(),u,!1)}}extractOtherDeclarations(o,u,b,x){let k=this.getDeclarationInfo(o);!k||b.has(k.name)||(this.addSymbol(x,k.name,k.kind,o.getStartLineNumber(),u,!1),k.isClass&&Md.Node.isClassDeclaration(o)&&this.extractClassMembers(o,u,x))}getDeclarationInfo(o){if(Md.Node.isClassDeclaration(o)){let u=o.getName();if(u)return{name:u,kind:"ClassDeclaration",isClass:!0}}else if(Md.Node.isFunctionDeclaration(o)){let u=o.getName();if(u)return{name:u,kind:"FunctionDeclaration",isClass:!1}}else{if(Md.Node.isInterfaceDeclaration(o))return{name:o.getName(),kind:"InterfaceDeclaration",isClass:!1};if(Md.Node.isTypeAliasDeclaration(o))return{name:o.getName(),kind:"TypeAliasDeclaration",isClass:!1};if(Md.Node.isEnumDeclaration(o))return{name:o.getName(),kind:"EnumDeclaration",isClass:!1}}return null}addSymbol(o,u,b,x,k,j){o.push({name:u,kind:b,line:x,isExported:j,id:`${k}:${u}`,category:MDe(b)})}buildDependencies(o,u){let b=this.buildImportMap(o),x=this.findSymbolUsage(o,b);for(let[k,j]of Object.entries(x))for(let fe of j)u.push({sourceSymbolId:k,targetSymbolId:fe.symbolId,targetFilePath:fe.filePath,isTypeOnly:fe.isTypeOnly})}getInternalExportDependencyGraph(o,u){this.maybeResetProject();let x=this.getOrCreateSourceFile(o,u).getExportedDeclarations(),k=new Set(x.keys()),j=new Map;for(let[fe,ke]of x){let tt=`${o}:${fe}`,ot=this.getOrCreateDependencySet(j,tt);this.collectExportDependencies(ke,fe,k,o,ot)}return j}getOrCreateDependencySet(o,u){let b=o.get(u);return b||(b=new Set,o.set(u,b)),b}collectExportDependencies(o,u,b,x,k){for(let j of o){let fe=j.getDescendantsOfKind(Md.SyntaxKind.Identifier);for(let ke of fe){let tt=ke.getText();this.isValidDependency(tt,u,b)&&k.add(`${x}:${tt}`)}}}isValidDependency(o,u,b){return b.has(o)&&o!==u}buildImportMap(o){let u=new Map,b=o.getImportDeclarations();for(let x of b){let k=x.getModuleSpecifierValue(),j=x.isTypeOnly(),fe=x.getDefaultImport();if(fe){let ot=fe.getText();u.set(ot,{originalName:"default",modulePath:k,isType:j})}let ke=x.getNamedImports();for(let ot of ke){let ut=ot.getNameNode().getText(),xe=ot.getAliasNode(),gn=xe?xe.getText():ut;u.set(gn,{originalName:ut,modulePath:k,isType:j||ot.isTypeOnly()})}let tt=x.getNamespaceImport();if(tt){let ot=tt.getText();u.set(ot,{originalName:"*",modulePath:k,isType:j})}}return u}extractIntraFileCalls(o,u){let b=[],x=u.getFilePath(),k=this.collectFunctionNames(u),j=o.getDescendantsOfKind(Md.SyntaxKind.CallExpression);for(let fe of j)this.processCallExpression(fe,k,x,b);return b}collectFunctionNames(o){let u=new Set;for(let b of o.getFunctions()){let x=b.getName();x&&u.add(x)}for(let b of o.getClasses())for(let x of b.getMethods()){let k=x.getName();k&&u.add(k)}return u}processCallExpression(o,u,b,x){if(!Md.Node.isCallExpression(o))return;let k=o.getExpression();if(Md.Node.isIdentifier(k)){this.addDirectFunctionCall(k,u,b,x);return}Md.Node.isPropertyAccessExpression(k)&&this.addPropertyAccessCall(k,u,b,x)}addDirectFunctionCall(o,u,b,x){let k=o.getText();u.has(k)&&x.push({symbolId:`${b}:${k}`,filePath:b,isTypeOnly:!1})}addPropertyAccessCall(o,u,b,x){if(Md.Node.isPropertyAccessExpression(o)){let k=o.getName();u.has(k)&&x.push({symbolId:`${b}:${k}`,filePath:b,isTypeOnly:!1})}}findSymbolUsage(o,u){let b={},x=o.getFilePath(),k=[...o.getFunctions(),...o.getClasses(),...o.getVariableDeclarations()];for(let ke of k){let tt=ke.getName();if(!tt)continue;let ot=`${x}:${tt}`,ut=this.extractSymbolDependencies(ke,u),xe=this.extractIntraFileCalls(ke,o);ut.push(...xe),b[ot]=ut}let j=o.getStatements(),fe=[];for(let ke of j){if(Md.Node.isFunctionDeclaration(ke)||Md.Node.isClassDeclaration(ke)||Md.Node.isVariableStatement(ke)||Md.Node.isInterfaceDeclaration(ke)||Md.Node.isTypeAliasDeclaration(ke)||Md.Node.isEnumDeclaration(ke)||Md.Node.isImportDeclaration(ke))continue;let tt=this.extractSymbolDependencies(ke,u);fe.push(...tt)}if(fe.length>0){let ke=`${x}:(file)`;b[ke]=fe}return b}extractSymbolDependencies(o,u){let b=[];return this.extractStaticImportDependencies(o,u,b),this.extractDynamicImportDependencies(o,b),b}extractStaticImportDependencies(o,u,b){let x=o.getDescendantsOfKind(Md.SyntaxKind.Identifier);for(let k of x){let j=u.get(k.getText());if(!j)continue;let fe=this.buildTargetSymbolId(j);b.some(ke=>ke.symbolId===fe)||b.push({symbolId:fe,filePath:j.modulePath,isTypeOnly:j.isType})}}extractDynamicImportDependencies(o,u){let b=o.getDescendantsOfKind(Md.SyntaxKind.CallExpression);for(let x of b){let k=this.extractDynamicImportPath(x);if(!k)continue;let j=`${k}:default`;u.some(fe=>fe.symbolId===j)||u.push({symbolId:j,filePath:k,isTypeOnly:!1})}}extractDynamicImportPath(o){if(!Md.Node.isCallExpression(o)||o.getExpression().getKind()!==Md.SyntaxKind.ImportKeyword)return null;let b=o.getArguments();if(b.length===0)return null;let x=b[0];return Md.Node.isStringLiteral(x)?x.getLiteralValue():null}buildTargetSymbolId(o){return o.originalName==="default"?`${o.modulePath}:default`:`${o.modulePath}:${o.originalName}`}extractClassMembers(o,u,b){let x=o.getName();if(!x)return;let k=`${u}:${x}`,j=o.getMembers();for(let fe of j){let ke=fe.getKindName();if(!Md.Node.isMethodDeclaration(fe)&&!Md.Node.isPropertyDeclaration(fe)&&!Md.Node.isGetAccessorDeclaration(fe)&&!Md.Node.isSetAccessorDeclaration(fe))continue;let tt=fe.getName();if(!tt)continue;let ot=fe.isStatic()??!1,ut=`${x}.${tt}`,xe=ot?`Static${ke}`:ke;b.push({name:ut,kind:xe,line:fe.getStartLineNumber(),isExported:!1,id:`${u}:${ut}`,parentSymbolId:k,category:MDe(ke)})}}getExportedSymbols(o,u){let b=this.project.getSourceFile(o);b?b.replaceWithText(u):b=this.project.createSourceFile(o,u);let x=[],k=b.getExportedDeclarations();for(let[j,fe]of k){let ke=fe[0];if(!ke)continue;let tt=ke.getKindName();x.push({name:j,kind:tt,line:ke.getStartLineNumber(),isExported:!0,id:`${o}:${j}`,category:MDe(tt)})}return x}filterRuntimeSymbols(o){let u=new Set(["InterfaceDeclaration","TypeAliasDeclaration","TypeParameter"]);return o.filter(b=>!u.has(b.kind))}async analyzeFile(o){let u=await this.fileReader.readFile(o),b=this.analyzeFileContent(o,u),x=new Map;for(let k of b.symbols)x.set(k.id,k);return x}async getSymbolDependencies(o){let u=await this.fileReader.readFile(o);return this.analyzeFileContent(o,u).dependencies}};var AXe=Ex(require("node:fs/promises")),doe=Ex(require("node:path"));var xXe=Ex(require("node:fs/promises")),Q8=require("web-tree-sitter"),Z8=class h{static instance=null;initPromise=null;parsers=new Map;parserPromises=new Map;languages=new Map;initialized=!1;textEncoder=new TextEncoder;constructor(){}static getInstance(){return h.instance??=new h,h.instance}async init(o){if(!this.initialized){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{try{await Q8.Parser.init({locateFile:()=>o}),this.initialized=!0}catch(u){this.initPromise=null;let b=u instanceof Error?u.message:String(u);throw new Error(`Failed to initialize web-tree-sitter from ${o}: ${b}. Ensure the WASM file exists and is not corrupted.`,{cause:u})}})(),await this.initPromise}}async getParser(o,u){if(!this.initialized)throw new Error("WasmParserFactory must be initialized with init() before creating parsers");if(this.parsers.has(o))return this.parsers.get(o);if(this.parserPromises.has(o))return this.parserPromises.get(o);let b=(async()=>{try{this.languages.has(o)||await this.loadLanguage(o,u);let x=new Q8.Parser,k=this.languages.get(o);return x.setLanguage(k),this.parsers.set(o,x),x}finally{this.parserPromises.delete(o)}})();return this.parserPromises.set(o,b),b}async loadLanguage(o,u){try{let b;try{let x=await xXe.default.readFile(u),k=this.normalizeLegacyDylinkSection(new Uint8Array(x));b=await Q8.Language.load(k)}catch(x){let k=x instanceof Error?x.message:String(x);if(k.includes("ENOENT")||k.includes("not found"))b=await Q8.Language.load(u);else throw x}this.languages.set(o,b)}catch(b){let x=b instanceof Error?b.message:String(b);throw x.includes("ENOENT")||x.includes("not found")?new Error(`Language WASM file not found: ${u}. Ensure the extension is properly installed and WASM files are in the dist directory.`,{cause:b}):x.includes("magic")||x.includes("invalid")?new Error(`Failed to load language WASM from ${u}: ${x}. The WASM file may be corrupted. Try reinstalling the extension.`,{cause:b}):new Error(`Failed to load language WASM from ${u}: ${x}`,{cause:b})}}normalizeLegacyDylinkSection(o){try{if(o.length<12||o[0]!==0||o[1]!==97||o[2]!==115||o[3]!==109)return o;let u=8;if(o[u]!==0)return o;let b=this.readUnsignedLeb128(o,u+1),x=b.nextOffset,k=x+b.value;if(k>o.length)return o;let j=this.readUnsignedLeb128(o,x),fe=j.nextOffset,ke=fe+j.value;if(ke>k||Buffer.from(o.subarray(fe,ke)).toString("utf8")!=="dylink")return o;let ot=ke,ut=this.readUnsignedLeb128(o,ot);ot=ut.nextOffset;let xe=this.readUnsignedLeb128(o,ot);ot=xe.nextOffset;let gn=this.readUnsignedLeb128(o,ot);ot=gn.nextOffset;let _t=this.readUnsignedLeb128(o,ot);ot=_t.nextOffset;let dt=this.readUnsignedLeb128(o,ot);ot=dt.nextOffset;let ui=[];for(let Or=0;Or<dt.value;Or++){let bi=this.readUnsignedLeb128(o,ot);ot=bi.nextOffset;let ud=ot+bi.value;if(ud>k)return o;ui.push(o.subarray(ot,ud)),ot=ud}let Ti=this.concatUint8Arrays(this.encodeUnsignedLeb128(ut.value),this.encodeUnsignedLeb128(xe.value),this.encodeUnsignedLeb128(gn.value),this.encodeUnsignedLeb128(_t.value)),qi=this.concatUint8Arrays(this.encodeUnsignedLeb128(ui.length),...ui.flatMap(Or=>[this.encodeUnsignedLeb128(Or.length),Or])),cs=1,Cl=2,Ja=this.concatUint8Arrays(Uint8Array.of(cs),this.encodeUnsignedLeb128(Ti.length),Ti),Ur=this.concatUint8Arrays(Uint8Array.of(Cl),this.encodeUnsignedLeb128(qi.length),qi),wn=this.textEncoder.encode("dylink.0"),ki=this.concatUint8Arrays(this.encodeUnsignedLeb128(wn.length),wn,Ja,Ur),hi=this.concatUint8Arrays(Uint8Array.of(0),this.encodeUnsignedLeb128(ki.length),ki);return this.concatUint8Arrays(o.subarray(0,8),hi,o.subarray(k))}catch{return o}}readUnsignedLeb128(o,u){let b=0,x=0,k=u;for(;k<o.length;){let j=o[k];if(b|=(j&127)<<x,k++,(j&128)===0)return{value:b,nextOffset:k};if(x+=7,x>35)throw new Error("Invalid LEB128 value")}throw new Error("Unexpected EOF while reading LEB128")}encodeUnsignedLeb128(o){let u=[],b=o>>>0;do{let x=b&127;b>>>=7,b!==0&&(x|=128),u.push(x)}while(b!==0);return Uint8Array.from(u)}concatUint8Arrays(...o){let u=o.reduce((k,j)=>k+j.length,0),b=new Uint8Array(u),x=0;for(let k of o)b.set(k,x),x+=k.length;return b}isInitialized(){return this.initialized}reset(){this.parsers.clear(),this.parserPromises.clear(),this.languages.clear(),this.initialized=!1,this.initPromise=null}};var uoe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,u){this.extensionPath=u??o,this.fileReader=new pR}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure PythonSymbolAnalyzer is constructed with extensionPath parameter.");try{let u=Z8.getInstance(),b=doe.default.join(o,"dist","wasm","tree-sitter.wasm");await u.init(b);let x=doe.default.join(o,"dist","wasm","tree-sitter-python.wasm");this.parser=await u.getParser("python",x)}catch(u){this.initPromise=null;let b=u instanceof Error?u.message:String(u);throw new Error(`Failed to initialize Python WASM parser for symbol analysis: ${b}`,{cause:u})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),u=doe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await AXe.default.access(u),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,u)}catch(u){throw Dy.fromError(u,o)}}analyzeFileFromContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Python file: ${o}`);let x=new Map,k=pw(o);return this.extractSymbols(b.rootNode,k,u,x),x}analyzeFileContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Python file: ${o}`);let x=new Map,k=[],j=pw(o);this.extractSymbols(b.rootNode,j,u,x);let fe=this.buildImportMap(b.rootNode,u);return this.extractDependencies(b.rootNode,j,u,k,x,void 0,fe),{symbols:Array.from(x.values()),dependencies:k}}async getSymbolDependencies(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileContent(o,u).dependencies}catch(u){throw Dy.fromError(u,o)}}extractSymbols(o,u,b,x,k){this.tryExtractSymbolFromNode(o,u,b,x,k)||this.extractSymbolsFromChildren(o,u,b,x,k)}tryExtractSymbolFromNode(o,u,b,x,k){return o.type==="function_definition"?(this.handleFunctionDefinition(o,u,b,x,k),!0):o.type==="class_definition"?(this.handleClassDefinition(o,u,b,x,k),!0):o.type==="decorated_definition"?(this.handleDecoratedDefinition(o,u,b,x,k),!0):!1}handleFunctionDefinition(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasChild(o,"async");x.set(ke,{name:fe,kind:tt?"AsyncFunction":"FunctionDeclaration",line:j.startPosition.row+1,isExported:this.isExported(o,b),id:ke,parentSymbolId:k,category:"function"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleClassDefinition(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`;x.set(ke,{name:fe,kind:"ClassDeclaration",line:j.startPosition.row+1,isExported:this.isExported(o,b),id:ke,parentSymbolId:k,category:"class"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleDecoratedDefinition(o,u,b,x,k){for(let j of o.children)(j.type==="function_definition"||j.type==="class_definition")&&this.extractSymbols(j,u,b,x,k)}extractSymbolsFromChildren(o,u,b,x,k){for(let j of o.children)this.extractSymbols(j,u,b,x,k)}buildImportMap(o,u){let b=new Map;return this.traverseForImports(o,b,u),b}traverseForImports(o,u,b){o.type==="import_from_statement"?this.processFromImport(o,u,b):o.type==="import_statement"&&this.processImportStatement(o,u,b);for(let x of o.children)this.traverseForImports(x,u,b)}processFromImport(o,u,b){let x=o.childForFieldName("module_name");if(!x)return;let k=this.getNodeText(x,b);for(let j of o.children)this.processFromImportChild(j,u,b,k)}processFromImportChild(o,u,b,x){if(o.type==="aliased_import"){this.addAliasedFromImport(o,u,b,x);return}if(o.type==="dotted_name"||o.type==="identifier"){let k=this.getNodeText(o,b);if(k===x||o.parent?.type==="aliased_import")return;u.set(k,x)}}addAliasedFromImport(o,u,b,x){let k=o.childForFieldName("name");if(!k)return;let j=this.getNodeText(k,b),fe=o.childForFieldName("alias"),ke=fe?this.getNodeText(fe,b):j;u.set(ke,x)}processImportStatement(o,u,b){for(let x of o.children)this.processImportStatementChild(x,u,b)}processImportStatementChild(o,u,b){if(o.type==="aliased_import"){let x=o.childForFieldName("name");if(!x)return;let k=this.getNodeText(x,b),j=o.childForFieldName("alias"),fe=j?this.getNodeText(j,b):k;u.set(fe,k);return}if(o.type==="dotted_name"||o.type==="identifier"){let x=this.getNodeText(o,b);x!=="import"&&u.set(x,x)}}extractDependencies(o,u,b,x,k,j,fe){let ke=this.getScopeForNode(o,u,b,j);this.addCallDependencyIfAny(o,u,b,x,k,ke,fe);for(let tt of o.children)this.extractDependencies(tt,u,b,x,k,ke,fe)}getScopeForNode(o,u,b,x){if(o.type!=="function_definition"&&o.type!=="class_definition")return x;let k=o.childForFieldName("name");if(!k)return x;let j=this.getNodeText(k,b);return`${u}:${j}`}addCallDependencyIfAny(o,u,b,x,k,j,fe){if(o.type!=="call")return;let ke=o.childForFieldName("function");if(!ke||!j)return;let tt=this.getCalledName(ke,b),ot=`${u}:${tt}`;if(k.has(ot)){x.push({sourceSymbolId:j,targetSymbolId:ot,targetFilePath:u,isTypeOnly:!1});return}if(fe?.has(tt)){let ut=fe.get(tt);x.push({sourceSymbolId:j,targetSymbolId:`${ut}:${tt}`,targetFilePath:ut,isTypeOnly:!1})}}getCalledName(o,u){if(o.type!=="attribute")return this.getNodeText(o,u);let b=o.childForFieldName("attribute");return b?this.getNodeText(b,u):this.getNodeText(o,u)}isExported(o,u){let b=o.childForFieldName("name");return b?!this.getNodeText(b,u).startsWith("_"):!1}hasChild(o,u){for(let b of o.children)if(b.type===u)return!0;return!1}getNodeText(o,u){return u.slice(o.startIndex,o.endIndex)}};var DXe=Ex(require("node:fs/promises")),poe=Ex(require("node:path"));var foe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,u){this.extensionPath=u??o,this.fileReader=new pR}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure RustSymbolAnalyzer is constructed with extensionPath parameter.");try{let u=Z8.getInstance(),b=poe.default.join(o,"dist","wasm","tree-sitter.wasm");await u.init(b);let x=poe.default.join(o,"dist","wasm","tree-sitter-rust.wasm");this.parser=await u.getParser("rust",x)}catch(u){this.initPromise=null;let b=u instanceof Error?u.message:String(u);throw new Error(`Failed to initialize Rust WASM parser for symbol analysis: ${b}`,{cause:u})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),u=poe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await DXe.default.access(u),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,u)}catch(u){throw Dy.fromError(u,o)}}analyzeFileFromContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Rust file: ${o}`);let x=new Map,k=pw(o);return this.extractSymbols(b.rootNode,k,u,x),x}analyzeFileContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Rust file: ${o}`);let x=new Map,k=[],j=pw(o);this.extractSymbols(b.rootNode,j,u,x);let fe=this.buildImportMap(b.rootNode,u);return this.extractDependencies(b.rootNode,j,u,k,x,void 0,fe),{symbols:Array.from(x.values()),dependencies:k}}async getSymbolDependencies(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileContent(o,u).dependencies}catch(u){throw Dy.fromError(u,o)}}extractSymbols(o,u,b,x,k){this.tryExtractSymbolFromNode(o,u,b,x,k)||this.extractSymbolsFromChildren(o,u,b,x,k)}tryExtractSymbolFromNode(o,u,b,x,k){return o.type==="function_item"?(this.handleFunctionItem(o,u,b,x,k),!0):o.type==="struct_item"?(this.handleStructItem(o,u,b,x,k),!0):o.type==="enum_item"?(this.handleEnumItem(o,u,b,x,k),!0):o.type==="trait_item"?(this.handleTraitItem(o,u,b,x,k),!0):o.type==="impl_item"?(this.handleImplItem(o,u,b,x,k),!0):!1}handleFunctionItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasModifier(o,"async"),ot=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:tt?"AsyncFunction":"FunctionDeclaration",line:j.startPosition.row+1,isExported:ot,id:ke,parentSymbolId:k,category:"function"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleStructItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:"StructDeclaration",line:j.startPosition.row+1,isExported:tt,id:ke,parentSymbolId:k,category:"class"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleEnumItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:"EnumDeclaration",line:j.startPosition.row+1,isExported:tt,id:ke,parentSymbolId:k,category:"type"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleTraitItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:"InterfaceDeclaration",line:j.startPosition.row+1,isExported:tt,id:ke,parentSymbolId:k,category:"type"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleImplItem(o,u,b,x,k){this.extractSymbolsFromChildren(o,u,b,x,k)}extractSymbolsFromChildren(o,u,b,x,k){for(let j of o.children)this.extractSymbols(j,u,b,x,k)}buildImportMap(o,u){let b=new Map,x=k=>{if(k.type==="use_declaration"&&this.extractUseDeclarationImports(k,u,b),k.type==="mod_item"){let j=k.childForFieldName("name");if(j){let fe=this.getNodeText(j,u);b.set(fe,fe)}}for(let j of k.children)x(j)};return x(o),b}extractUseDeclarationImports(o,u,b){this.extractFromUseLists(o,u,b),this.extractFromScopedIdentifiers(o,u,b),this.extractFromUseAsClauses(o,u,b)}extractFromUseLists(o,u,b){let x=this.findAllByType(o,"use_list");for(let k of x){let j=this.findBaseModuleForUseList(k,u);this.extractIdentifiersFromUseList(k,j,u,b)}}findBaseModuleForUseList(o,u){let b=o.parent;for(;b;){if(b.type==="scoped_use_list"){let x=this.findScopedIdentifierInChildren(b,u);if(x)return x}b=b.parent}return""}findScopedIdentifierInChildren(o,u){for(let b of o.children)if(b.type==="scoped_identifier")return this.getNodeText(b,u);return""}extractIdentifiersFromUseList(o,u,b,x){for(let k of o.children)if(k.type==="identifier"){let j=this.getNodeText(k,b);x.set(j,u)}}extractFromScopedIdentifiers(o,u,b){let x=this.findAllByType(o,"scoped_identifier");for(let k of x){if(this.hasAncestorOfType(k,"use_list"))continue;let j=this.getNodeText(k,u),{localName:fe,modulePath:ke}=this.splitModulePath(j);b.set(fe,ke)}}splitModulePath(o){let u=o.split("::"),b=u.at(-1),x=u.slice(0,-1).join("::");return{localName:b,modulePath:x}}extractFromUseAsClauses(o,u,b){let x=this.findAllByType(o,"use_as_clause");for(let k of x){let j=k.childForFieldName("path"),fe=k.childForFieldName("alias");if(j&&fe){let ke=this.getNodeText(j,u),tt=this.getNodeText(fe,u);b.set(tt,ke)}}}extractDependencies(o,u,b,x,k,j,fe){let ke=this.getScopeForNode(o,u,b,j);this.addCallDependencyIfAny(o,u,b,x,k,ke,fe);for(let tt of o.children)this.extractDependencies(tt,u,b,x,k,ke,fe)}getScopeForNode(o,u,b,x){if(o.type!=="function_item")return x;let k=o.childForFieldName("name");if(!k)return x;let j=this.getNodeText(k,b);return`${u}:${j}`}addCallDependencyIfAny(o,u,b,x,k,j,fe){if(o.type!=="call_expression")return;let ke=o.childForFieldName("function");if(!ke||!j)return;let{moduleName:tt,symbolName:ot}=this.extractModuleAndSymbolName(ke,b),ut=`${u}:${ot}`;if(k.has(ut)){x.push({sourceSymbolId:j,targetSymbolId:ut,targetFilePath:u,isTypeOnly:!1});return}if(tt&&fe?.has(tt)){let xe=fe.get(tt);x.push({sourceSymbolId:j,targetSymbolId:`${xe}:${ot}`,targetFilePath:xe,isTypeOnly:!1});return}if(fe?.has(ot)){let xe=fe.get(ot);x.push({sourceSymbolId:j,targetSymbolId:`${xe}:${ot}`,targetFilePath:xe,isTypeOnly:!1})}}extractModuleAndSymbolName(o,u){if(o.type==="field_expression"){let b=o.childForFieldName("field");if(b)return{moduleName:void 0,symbolName:this.getNodeText(b,u)}}if(o.type==="scoped_identifier"){let x=this.getNodeText(o,u).split("::");if(x.length>=2){let k=x.at(-1);return{moduleName:x.slice(0,-1).join("::"),symbolName:k}}return{moduleName:void 0,symbolName:x[0]}}return{moduleName:void 0,symbolName:this.getNodeText(o,u)}}hasVisibilityModifier(o,u){if(o.childForFieldName("visibility_modifier"))return!0;for(let x of o.children)if(x.type==="visibility_modifier")return!0;return!1}hasAncestorOfType(o,u){let b=o.parent;for(;b;){if(b.type===u)return!0;b=b.parent}return!1}hasModifier(o,u){for(let b of o.children)if(b.type===u)return!0;return!1}findAllByType(o,u){let b=[],x=k=>{k.type===u&&b.push(k);for(let j of k.children)x(j)};return x(o),b}getNodeText(o,u){return u.slice(o.startIndex,o.endIndex)}};var s2t=mw.workerData,PXe=s2t.extensionPath??process.cwd(),l2t=x8("AstWorker"),moe=new coe(void 0,{maxFiles:100}),IXe=new uoe(void 0,PXe),CXe=new foe(void 0,PXe),i9=new soe;function c2t(h){let o=Qje(h);return o==="python"?"python":o==="rust"?"rust":"typescript"}async function d2t(h){try{let o;switch(h.type){case"analyzeFile":{let b=c2t(h.filePath);if(b==="python"){await IXe.ensureInitialized();let{symbols:x,dependencies:k}=IXe.analyzeFileContent(h.filePath,h.content);o={symbols:x,dependencies:k}}else if(b==="rust"){await CXe.ensureInitialized();let{symbols:x,dependencies:k}=CXe.analyzeFileContent(h.filePath,h.content);o={symbols:x,dependencies:k}}else{let{symbols:x,dependencies:k}=moe.analyzeFileContent(h.filePath,h.content);o={symbols:x,dependencies:k}}break}case"getInternalExportDeps":{let b=moe.getInternalExportDependencyGraph(h.filePath,h.content);o=Object.fromEntries(Array.from(b.entries()).map(([x,k])=>[x,Array.from(k)]));break}case"extractSignatures":{o=i9.extractSignatures(h.filePath,h.content);break}case"extractInterfaceMembers":{let b=i9.extractInterfaceMembers(h.filePath,h.content);o=Object.fromEntries(b);break}case"extractTypeAliases":{o=i9.extractTypeAliases(h.filePath,h.content);break}case"compareSignatures":{o=i9.compareSignatures(h.oldSig,h.newSig);break}case"analyzeBreakingChanges":{o=i9.analyzeBreakingChanges(h.filePath,h.oldContent,h.newContent);break}case"reset":{moe.reset(),o={success:!0};break}case"getFileCount":{o=moe.getFileCount();break}default:{let b=h;throw new Error(`Unknown message type: ${JSON.stringify(b)}`)}}let u={type:"success",id:h.id,result:o};mw.parentPort?.postMessage(u)}catch(o){let u=o instanceof Error?o.message:String(o),b=o instanceof Error?o.stack:void 0,x={type:"error",id:h.id,error:u,stack:b};mw.parentPort?.postMessage(x)}}mw.parentPort?mw.parentPort.on("message",h=>{d2t(h)}):(l2t.error("parentPort is null - worker not properly initialized"),process.exit(1));
|
|
42158
|
+
${b}`:x}function HCt(h){if(typeof h=="string")return h;if(h instanceof Error)return`${h.name}: ${h.message}`;if(h&&typeof h=="object"){let o=UCt(h);if(o)return o}try{return JSON.stringify(h)}catch{return String(h)}}function KCt(h){return h.length===0?"":" "+h.map(HCt).join(" ")}var xZ=class{_level;prefix;constructor(o="",u="info"){this.prefix=o?`[${o}]`:"",this._level=u}get level(){return this._level}setLevel(o){this._level=o}shouldLog(o){return $je[o]>=$je[this._level]}formatMessage(o,u){return`${new Date().toISOString()} ${this.prefix} [${o.toUpperCase()}] ${u}`}logTo(o,u,b,x){this.shouldLog(u)&&jCt(VCt(o),this.formatMessage(u,b+KCt(x)))}debug(o,...u){this.logTo("stdout","debug",o,u)}info(o,...u){this.logTo("stdout","info",o,u)}warn(o,...u){this.logTo("stderr","warn",o,u)}error(o,...u){this.logTo("stderr","error",o,u)}};var vxe=class{level="none";setLevel(){}debug(){}info(){}warn(){}error(){}},AZ=class{delegate;constructor(o){this.delegate=o}get level(){return this.delegate.level}setLevel(o){this.delegate.setLevel(o)}setDelegate(o){this.delegate=o}debug(o,...u){this.delegate.debug(o,...u)}info(o,...u){this.delegate.info(o,...u)}warn(o,...u){this.delegate.warn(o,...u)}error(o,...u){this.delegate.error(o,...u)}},bxe=class{defaultLevel="info";loggers=new Map;backend;setDefaultLevel(o){this.defaultLevel=o;for(let u of this.loggers.values())u.setLevel(o)}getDefaultLevel(){return this.defaultLevel}getLogger(o){let u=this.loggers.get(o);if(!u){let b=this.backend?this.backend.createLogger(o,this.defaultLevel):new xZ(o,this.defaultLevel);u=new AZ(b),this.loggers.set(o,u)}return u}getNullLogger(){let o=new vxe;return new AZ(o)}clear(){this.loggers.clear()}setBackend(o){this.backend=o;for(let[u,b]of this.loggers.entries()){let x=b.level??this.defaultLevel,k=o?o.createLogger(u,x):new xZ(u,x);b.setDelegate(k)}}getBackend(){return this.backend}},JCt=new bxe;function x8(h){return JCt.getLogger(h)}var Yje=Ex(require("node:path")),qCt={".ts":"typescript",".tsx":"typescript",".mts":"typescript",".cts":"typescript",".js":"javascript",".jsx":"javascript",".mjs":"javascript",".cjs":"javascript",".py":"python",".pyi":"python",".rs":"rust",".vue":"vue",".svelte":"svelte",".gql":"graphql",".graphql":"graphql",".cs":"csharp",".csproj":"csharp",".go":"go",".java":"java"};function Qje(h){let o=h;return h.includes("/")||h.includes("\\")?o=Yje.extname(h).toLowerCase():(o.startsWith(".")||(o="."+o),o=o.toLowerCase()),qCt[o]||"unknown"}var r9=Ex(RDe()),soe=class{project;constructor(){this.project=new r9.Project({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0,compilerOptions:{target:99,module:99,strict:!0}})}extractSignatures(o,u){let b=this.getOrCreateSourceFile(o,u),x=[];for(let k of b.getFunctions()){let j=this.extractFunctionSignature(k);j&&x.push(j)}for(let k of b.getClasses()){let j=k.getName()??"Anonymous",fe=k.getConstructors()[0];fe&&x.push({name:`${j}.constructor`,kind:"constructor",parameters:this.extractParameters(fe.getParameters()),returnType:j,isAsync:!1,line:fe.getStartLineNumber()});for(let ke of k.getMethods()){let tt=ke.getName();x.push({name:`${j}.${tt}`,kind:"method",parameters:this.extractParameters(ke.getParameters()),returnType:this.safeGetTypeText(ke.getReturnType(),"void"),isAsync:ke.isAsync(),isStatic:ke.isStatic(),visibility:this.getVisibility(ke),typeParameters:ke.getTypeParameters().map(ot=>this.safeGetText(ot)),line:ke.getStartLineNumber()})}}for(let k of b.getVariableDeclarations()){let j=k.getInitializer();if(j?.getKind()===r9.SyntaxKind.ArrowFunction){let fe=j.asKindOrThrow(r9.SyntaxKind.ArrowFunction);x.push({name:k.getName(),kind:"arrow",parameters:this.extractParameters(fe.getParameters()),returnType:this.safeGetTypeText(fe.getReturnType(),"unknown"),isAsync:fe.isAsync(),line:k.getStartLineNumber()})}}return x}extractInterfaceMembers(o,u){let b=this.getOrCreateSourceFile(o,u),x=new Map;for(let k of b.getInterfaces()){let j=k.getName(),fe=[];for(let ke of k.getProperties())fe.push({name:ke.getName(),kind:"property",type:this.safeGetTypeText(ke.getType(),"unknown"),isOptional:ke.hasQuestionToken(),isReadonly:ke.isReadonly()});for(let ke of k.getMethods()){let tt=ke.getParameters().map(ut=>`${ut.getName()}: ${this.safeGetTypeText(ut.getType(),"unknown")}`).join(", "),ot=this.safeGetTypeText(ke.getReturnType(),"unknown");fe.push({name:ke.getName(),kind:"method",type:`(${tt}) => ${ot}`,isOptional:ke.hasQuestionToken(),isReadonly:!1})}x.set(j,fe)}return x}extractTypeAliases(o,u){let b=this.getOrCreateSourceFile(o,u),x=[];for(let k of b.getTypeAliases())x.push({name:k.getName(),type:this.safeGetTypeText(k.getType(),"unknown"),typeParameters:k.getTypeParameters().map(j=>this.safeGetText(j))});return x}compareSignatures(o,u){let b=[],x=[];if(this.compareParameters(o,u,b,x),o.returnType!==u.returnType&&b.push({type:"return-type-changed",symbolName:u.name,description:`Return type changed from '${o.returnType}' to '${u.returnType}'`,severity:"error",oldValue:o.returnType,newValue:u.returnType,line:u.line}),o.visibility&&u.visibility){let k={public:3,protected:2,private:1},j=k[o.visibility];k[u.visibility]<j&&b.push({type:"visibility-reduced",symbolName:u.name,description:`Visibility reduced from '${o.visibility}' to '${u.visibility}'`,severity:"error",oldValue:o.visibility,newValue:u.visibility,line:u.line})}return{symbolName:u.name,hasBreakingChanges:b.length>0,breakingChanges:b,nonBreakingChanges:x}}compareInterfaces(o,u,b){let x=[],k=[],j=new Map(u.map(ke=>[ke.name,ke])),fe=new Map(b.map(ke=>[ke.name,ke]));for(let[ke,tt]of j)fe.has(ke)||x.push({type:"member-removed",symbolName:`${o}.${ke}`,description:`Member '${ke}' was removed from interface '${o}'`,severity:"error",oldValue:tt.type});for(let[ke,tt]of fe){let ot=j.get(ke);if(!ot){tt.isOptional?k.push(`New optional member '${ke}' added`):x.push({type:"member-optional-to-required",symbolName:`${o}.${ke}`,description:`New required member '${ke}' added to interface '${o}'`,severity:"error",newValue:tt.type});continue}ot.type!==tt.type&&x.push({type:"member-type-changed",symbolName:`${o}.${ke}`,description:`Type of member '${ke}' changed from '${ot.type}' to '${tt.type}'`,severity:"error",oldValue:ot.type,newValue:tt.type}),ot.isOptional&&!tt.isOptional&&x.push({type:"member-optional-to-required",symbolName:`${o}.${ke}`,description:`Member '${ke}' changed from optional to required`,severity:"error"})}return{symbolName:o,hasBreakingChanges:x.length>0,breakingChanges:x,nonBreakingChanges:k}}compareTypeAliases(o,u){let b=[],x=[];return o.type!==u.type&&b.push({type:"type-alias-changed",symbolName:u.name,description:`Type alias '${u.name}' changed from '${o.type}' to '${u.type}'`,severity:"warning",oldValue:o.type,newValue:u.type}),{symbolName:u.name,hasBreakingChanges:b.length>0,breakingChanges:b,nonBreakingChanges:x}}analyzeBreakingChanges(o,u,b){let x=[];return this.compareFunctions(o,u,b,x),this.compareInterfaceDefinitions(o,u,b,x),this.compareTypeAliasDefinitions(o,u,b,x),x}compareFunctions(o,u,b,x){let k=this.extractSignatures(`${o}.old`,u),j=this.extractSignatures(`${o}.new`,b),fe=new Map(k.map(tt=>[tt.name,tt])),ke=new Map(j.map(tt=>[tt.name,tt]));for(let[tt,ot]of fe){let ut=ke.get(tt);if(ut){let xe=this.compareSignatures(ot,ut);(xe.hasBreakingChanges||xe.nonBreakingChanges.length>0)&&x.push(xe)}else x.push(this.createRemovedResult(tt,"member-removed",`Function '${tt}' was removed`,ot.line))}}compareInterfaceDefinitions(o,u,b,x){let k=this.extractInterfaceMembers(`${o}.old`,u),j=this.extractInterfaceMembers(`${o}.new`,b);for(let[fe,ke]of k){let tt=j.get(fe);if(tt){let ot=this.compareInterfaces(fe,ke,tt);(ot.hasBreakingChanges||ot.nonBreakingChanges.length>0)&&x.push(ot)}else x.push(this.createRemovedResult(fe,"member-removed",`Interface '${fe}' was removed`))}}compareTypeAliasDefinitions(o,u,b,x){let k=this.extractTypeAliases(`${o}.old`,u),j=this.extractTypeAliases(`${o}.new`,b),fe=new Map(k.map(tt=>[tt.name,tt])),ke=new Map(j.map(tt=>[tt.name,tt]));for(let[tt,ot]of fe){let ut=ke.get(tt);if(ut){let xe=this.compareTypeAliases(ot,ut);xe.hasBreakingChanges&&x.push(xe)}else x.push(this.createRemovedResult(tt,"type-alias-changed",`Type alias '${tt}' was removed`))}}createRemovedResult(o,u,b,x){return{symbolName:o,hasBreakingChanges:!0,breakingChanges:[{type:u,symbolName:o,description:b,severity:"error",line:x}],nonBreakingChanges:[]}}getOrCreateSourceFile(o,u){let b=this.project.getSourceFile(o);return b&&this.project.removeSourceFile(b),this.project.createSourceFile(o,u)}extractFunctionSignature(o){let u=o.getName();if(!u)return null;let b;try{let x=o.getReturnType();b=this.safeGetTypeText(x,"void")}catch{b="void"}return{name:u,kind:"function",parameters:this.extractParameters(o.getParameters()),returnType:b,isAsync:o.isAsync(),typeParameters:o.getTypeParameters().map(x=>this.safeGetText(x)),line:o.getStartLineNumber()}}extractParameters(o){return o.map((u,b)=>({name:u.getName(),type:this.safeGetTypeText(u.getType(),"unknown"),isOptional:u.isOptional(),hasDefault:u.hasInitializer(),isRest:u.isRestParameter(),position:b}))}safeGetTypeText(o,u){if(!o)return u;try{let b=o.getText();return b.length>200?o.getBaseTypeOfLiteralType()?.getText()??u:b||u}catch{return u}}safeGetText(o){if(!o)return"";try{return o.getText?.()??""}catch{return""}}getVisibility(o){let u=o.getScope?.();if(!u)return"public";let b=u.toString();return b.includes("Private")?"private":b.includes("Protected")?"protected":"public"}compareParameters(o,u,b,x){let k=o.parameters,j=u.parameters,fe=new Map(k.map(tt=>[tt.name,tt])),ke=new Map(j.map(tt=>[tt.name,tt]));this.detectRemovedParameters(k,ke,u,b),this.detectNewAndChangedParameters(j,fe,u,b,x),this.detectPositionChanges(k,j,x)}detectRemovedParameters(o,u,b,x){for(let k of o)u.has(k.name)||x.push({type:"parameter-removed",symbolName:b.name,description:`Parameter '${k.name}' was removed`,severity:"error",oldValue:`${k.name}: ${k.type}`,line:b.line})}detectNewAndChangedParameters(o,u,b,x,k){for(let j of o){let fe=u.get(j.name);if(!fe){this.handleNewParameter(j,b,x,k);continue}this.handleChangedParameter(fe,j,b,x)}}handleNewParameter(o,u,b,x){o.isOptional||o.hasDefault?x.push(`New optional parameter '${o.name}' added`):b.push({type:"parameter-added-required",symbolName:u.name,description:`New required parameter '${o.name}' added`,severity:"error",newValue:`${o.name}: ${o.type}`,line:u.line})}handleChangedParameter(o,u,b,x){o.type!==u.type&&x.push({type:"parameter-type-changed",symbolName:b.name,description:`Type of parameter '${u.name}' changed from '${o.type}' to '${u.type}'`,severity:"error",oldValue:o.type,newValue:u.type,line:b.line});let k=o.isOptional||o.hasDefault,j=!u.isOptional&&!u.hasDefault;k&&j&&x.push({type:"parameter-optional-to-required",symbolName:b.name,description:`Parameter '${u.name}' changed from optional to required`,severity:"error",line:b.line})}detectPositionChanges(o,u,b){let x=Math.min(o.length,u.length);for(let k=0;k<x;k++)o[k].name!==u[k].name&&b.push(`Parameter order changed at position ${k}: '${o[k].name}' \u2192 '${u[k].name}'`)}};var Md=Ex(RDe());var fw=Ex(require("node:fs/promises")),loe=Ex(require("node:fs"));function pw(h){if(!h)return h;let o=h.replaceAll("\\","/");return o=o.replaceAll(/\/+/g,"/"),/^[A-Za-z]:\//.test(o)&&(o=o[0].toLowerCase()+o.slice(1)),o.length>1&&o.endsWith("/")&&!/^[a-zA-Z]:\/$/.test(o)&&(o=o.slice(0,-1)),o}var Dy=class h extends Error{code;filePath;cause;timestamp;constructor(o,u,b){super(o),this.name="SpiderError",this.code=u,this.filePath=b?.filePath,this.cause=b?.cause,this.timestamp=Date.now(),Error.captureStackTrace&&Error.captureStackTrace(this,h)}static fromError(o,u){if(o instanceof h)return o;let b=o instanceof Error?o:void 0,x=b?.message??(o!==null&&typeof o=="object"?JSON.stringify(o):String(o)),k="UNKNOWN";if(b){let j=b.code;j==="ENOENT"?k="FILE_NOT_FOUND":j==="EACCES"||j==="EPERM"?k="PERMISSION_DENIED":x.includes("too large")||j==="EFBIG"?k="FILE_TOO_LARGE":x.includes("parse")||x.includes("syntax")?k="PARSE_ERROR":(x.includes("timeout")||j==="ETIMEDOUT")&&(k="TIMEOUT")}return new h(x,k,{filePath:u,cause:b})}isRecoverable(){return["FILE_NOT_FOUND","PERMISSION_DENIED","PARSE_ERROR","RESOLUTION_FAILED"].includes(this.code)}toUserMessage(){switch(this.code){case"FILE_NOT_FOUND":return`File not found: ${this.filePath||"unknown"}`;case"PERMISSION_DENIED":return`Permission denied: ${this.filePath||"unknown"}`;case"FILE_TOO_LARGE":return`File too large to process: ${this.filePath||"unknown"}`;case"PARSE_ERROR":return`Failed to parse: ${this.filePath||"unknown"}`;case"RESOLUTION_FAILED":return`Could not resolve module in: ${this.filePath||"unknown"}`;case"TIMEOUT":return"Operation timed out";case"CIRCULAR_DEPENDENCY":return"Circular dependency detected";default:return this.message}}toJSON(){return{name:this.name,code:this.code,message:this.message,filePath:this.filePath,timestamp:this.timestamp,stack:this.stack}}};var r2t=x8("FileReader"),i2t=5*1024*1024,o2t=64*1024,a2t=3e4,pR=class{maxSize;chunkSize;timeout;constructor(o={}){this.maxSize=o.maxSize??i2t,this.chunkSize=o.chunkSize??o2t,this.timeout=o.timeout??a2t}async getFileSize(o){try{let u=await fw.stat(o);return{size:u.size,isLarge:u.size>this.maxSize,path:o}}catch(u){throw Dy.fromError(u,o)}}async readFile(o,u){let b=u?.maxSize??this.maxSize,x=u?.timeout??this.timeout,k=u?.streaming??!1,j=new Promise((fe,ke)=>{setTimeout(()=>{ke(new Dy(`File read timed out after ${x}ms: ${o}`,"TIMEOUT",{filePath:o}))},x)});try{let fe=await fw.stat(o);if(fe.size>b)throw new Dy(`File too large: ${o} (${this.formatSize(fe.size)} > ${this.formatSize(b)})`,"FILE_TOO_LARGE",{filePath:o});return k||fe.size>1024*1024?(r2t.debug(`Streaming read for large file: ${o} (${this.formatSize(fe.size)})`),await Promise.race([this.readFileStreaming(o),j])):await Promise.race([fw.readFile(o,"utf-8"),j])}catch(fe){throw fe instanceof Dy?fe:Dy.fromError(fe,o)}}async readFileStreaming(o){return new Promise((u,b)=>{let x=[],k=loe.createReadStream(o,{highWaterMark:this.chunkSize});k.on("data",j=>{x.push(Buffer.isBuffer(j)?j:Buffer.from(j))}),k.on("end",()=>{let j=Buffer.concat(x).toString("utf-8");u(j)}),k.on("error",j=>{b(Dy.fromError(j,o))})})}async readFileIfExists(o){try{return await this.readFile(o)}catch(u){if(u instanceof Dy&&u.code==="FILE_NOT_FOUND")return null;throw u}}async canRead(o){try{return await fw.access(o,loe.constants.R_OK),!0}catch{return!1}}formatSize(o){return o<1024?`${o}B`:o<1024*1024?`${(o/1024).toFixed(1)}KB`:`${(o/(1024*1024)).toFixed(1)}MB`}};function MDe(h){switch(h){case"FunctionDeclaration":case"ArrowFunction":case"MethodDeclaration":case"GetAccessor":case"SetAccessor":return"function";case"ClassDeclaration":return"class";case"InterfaceDeclaration":return"interface";case"TypeAliasDeclaration":return"type";case"VariableDeclaration":case"PropertyDeclaration":case"EnumDeclaration":return"variable";default:return"other"}}var EXe=x8("SymbolAnalyzer"),coe=class{project;maxFiles;fileCount=0;fileReader;constructor(o,u={}){this.maxFiles=u.maxFiles??100,this.project=this.createProject(),this.fileReader=new pR}createProject(){return new Md.Project({skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0,compilerOptions:{target:99,module:99}})}maybeResetProject(){this.fileCount>=this.maxFiles&&(EXe.debug(`Resetting ts-morph project (${this.fileCount} files in memory)`),this.project=this.createProject(),this.fileCount=0)}getFileCount(){return this.fileCount}reset(){EXe.debug("Forcing ts-morph project reset"),this.project=this.createProject(),this.fileCount=0}analyzeFileContent(o,u){this.maybeResetProject();let b=this.getOrCreateSourceFile(o,u),x=[],k=[],j=this.extractExportedSymbols(b,o,x);return this.extractNonExportedSymbols(b,o,j,x),this.buildDependencies(b,k),{symbols:x,dependencies:k}}getOrCreateSourceFile(o,u){let b=this.project.getSourceFile(o);return b?b.replaceWithText(u):(b=this.project.createSourceFile(o,u),this.fileCount++),b}extractExportedSymbols(o,u,b){let x=o.getExportedDeclarations(),k=new Set(x.keys());for(let[j,fe]of x){let ke=fe[0];ke&&(this.addSymbol(b,j,ke.getKindName(),ke.getStartLineNumber(),u,!0),ke.getKindName()==="ClassDeclaration"&&Md.Node.isClassDeclaration(ke)&&this.extractClassMembers(ke,u,b))}return k}extractNonExportedSymbols(o,u,b,x){let k=o.getStatements();for(let j of k)Md.Node.isVariableStatement(j)?this.extractVariableDeclarations(j,u,b,x):this.extractOtherDeclarations(j,u,b,x)}extractVariableDeclarations(o,u,b,x){let k=o.getDeclarations();for(let j of k){let fe=j.getName();b.has(fe)||this.addSymbol(x,fe,"VariableDeclaration",j.getStartLineNumber(),u,!1)}}extractOtherDeclarations(o,u,b,x){let k=this.getDeclarationInfo(o);!k||b.has(k.name)||(this.addSymbol(x,k.name,k.kind,o.getStartLineNumber(),u,!1),k.isClass&&Md.Node.isClassDeclaration(o)&&this.extractClassMembers(o,u,x))}getDeclarationInfo(o){if(Md.Node.isClassDeclaration(o)){let u=o.getName();if(u)return{name:u,kind:"ClassDeclaration",isClass:!0}}else if(Md.Node.isFunctionDeclaration(o)){let u=o.getName();if(u)return{name:u,kind:"FunctionDeclaration",isClass:!1}}else{if(Md.Node.isInterfaceDeclaration(o))return{name:o.getName(),kind:"InterfaceDeclaration",isClass:!1};if(Md.Node.isTypeAliasDeclaration(o))return{name:o.getName(),kind:"TypeAliasDeclaration",isClass:!1};if(Md.Node.isEnumDeclaration(o))return{name:o.getName(),kind:"EnumDeclaration",isClass:!1}}return null}addSymbol(o,u,b,x,k,j){o.push({name:u,kind:b,line:x,isExported:j,id:`${k}:${u}`,category:MDe(b)})}buildDependencies(o,u){let b=this.buildImportMap(o),x=this.findSymbolUsage(o,b);for(let[k,j]of Object.entries(x))for(let fe of j)u.push({sourceSymbolId:k,targetSymbolId:fe.symbolId,targetFilePath:fe.filePath,isTypeOnly:fe.isTypeOnly})}getInternalExportDependencyGraph(o,u){this.maybeResetProject();let x=this.getOrCreateSourceFile(o,u).getExportedDeclarations(),k=new Set(x.keys()),j=new Map;for(let[fe,ke]of x){let tt=`${o}:${fe}`,ot=this.getOrCreateDependencySet(j,tt);this.collectExportDependencies(ke,fe,k,o,ot)}return j}getOrCreateDependencySet(o,u){let b=o.get(u);return b||(b=new Set,o.set(u,b)),b}collectExportDependencies(o,u,b,x,k){for(let j of o){let fe=j.getDescendantsOfKind(Md.SyntaxKind.Identifier);for(let ke of fe){let tt=ke.getText();this.isValidDependency(tt,u,b)&&k.add(`${x}:${tt}`)}}}isValidDependency(o,u,b){return b.has(o)&&o!==u}buildImportMap(o){let u=new Map,b=o.getImportDeclarations();for(let x of b){let k=x.getModuleSpecifierValue(),j=x.isTypeOnly(),fe=x.getDefaultImport();if(fe){let ot=fe.getText();u.set(ot,{originalName:"default",modulePath:k,isType:j})}let ke=x.getNamedImports();for(let ot of ke){let ut=ot.getNameNode().getText(),xe=ot.getAliasNode(),gn=xe?xe.getText():ut;u.set(gn,{originalName:ut,modulePath:k,isType:j||ot.isTypeOnly()})}let tt=x.getNamespaceImport();if(tt){let ot=tt.getText();u.set(ot,{originalName:"*",modulePath:k,isType:j})}}return u}extractIntraFileCalls(o,u){let b=[],x=u.getFilePath(),k=this.collectFunctionNames(u),j=o.getDescendantsOfKind(Md.SyntaxKind.CallExpression);for(let fe of j)this.processCallExpression(fe,k,x,b);return b}collectFunctionNames(o){let u=new Set;for(let b of o.getFunctions()){let x=b.getName();x&&u.add(x)}for(let b of o.getClasses())for(let x of b.getMethods()){let k=x.getName();k&&u.add(k)}return u}processCallExpression(o,u,b,x){if(!Md.Node.isCallExpression(o))return;let k=o.getExpression();if(Md.Node.isIdentifier(k)){this.addDirectFunctionCall(k,u,b,x);return}Md.Node.isPropertyAccessExpression(k)&&this.addPropertyAccessCall(k,u,b,x)}addDirectFunctionCall(o,u,b,x){let k=o.getText();u.has(k)&&x.push({symbolId:`${b}:${k}`,filePath:b,isTypeOnly:!1})}addPropertyAccessCall(o,u,b,x){if(Md.Node.isPropertyAccessExpression(o)){let k=o.getName();u.has(k)&&x.push({symbolId:`${b}:${k}`,filePath:b,isTypeOnly:!1})}}findSymbolUsage(o,u){let b={},x=o.getFilePath(),k=[...o.getFunctions(),...o.getClasses(),...o.getVariableDeclarations()];for(let ke of k){let tt=ke.getName();if(!tt)continue;let ot=`${x}:${tt}`,ut=this.extractSymbolDependencies(ke,u),xe=this.extractIntraFileCalls(ke,o);ut.push(...xe),b[ot]=ut}let j=o.getStatements(),fe=[];for(let ke of j){if(Md.Node.isFunctionDeclaration(ke)||Md.Node.isClassDeclaration(ke)||Md.Node.isVariableStatement(ke)||Md.Node.isInterfaceDeclaration(ke)||Md.Node.isTypeAliasDeclaration(ke)||Md.Node.isEnumDeclaration(ke)||Md.Node.isImportDeclaration(ke))continue;let tt=this.extractSymbolDependencies(ke,u);fe.push(...tt)}if(fe.length>0){let ke=`${x}:(file)`;b[ke]=fe}return b}extractSymbolDependencies(o,u){let b=[];return this.extractStaticImportDependencies(o,u,b),this.extractDynamicImportDependencies(o,b),b}extractStaticImportDependencies(o,u,b){let x=o.getDescendantsOfKind(Md.SyntaxKind.Identifier);for(let k of x){let j=u.get(k.getText());if(!j)continue;let fe=this.buildTargetSymbolId(j);b.some(ke=>ke.symbolId===fe)||b.push({symbolId:fe,filePath:j.modulePath,isTypeOnly:j.isType})}}extractDynamicImportDependencies(o,u){let b=o.getDescendantsOfKind(Md.SyntaxKind.CallExpression);for(let x of b){let k=this.extractDynamicImportPath(x);if(!k)continue;let j=`${k}:default`;u.some(fe=>fe.symbolId===j)||u.push({symbolId:j,filePath:k,isTypeOnly:!1})}}extractDynamicImportPath(o){if(!Md.Node.isCallExpression(o)||o.getExpression().getKind()!==Md.SyntaxKind.ImportKeyword)return null;let b=o.getArguments();if(b.length===0)return null;let x=b[0];return Md.Node.isStringLiteral(x)?x.getLiteralValue():null}buildTargetSymbolId(o){return o.originalName==="default"?`${o.modulePath}:default`:`${o.modulePath}:${o.originalName}`}extractClassMembers(o,u,b){let x=o.getName();if(!x)return;let k=`${u}:${x}`,j=o.getMembers();for(let fe of j){let ke=fe.getKindName();if(!Md.Node.isMethodDeclaration(fe)&&!Md.Node.isPropertyDeclaration(fe)&&!Md.Node.isGetAccessorDeclaration(fe)&&!Md.Node.isSetAccessorDeclaration(fe))continue;let tt=fe.getName();if(!tt)continue;let ot=fe.isStatic()??!1,ut=`${x}.${tt}`,xe=ot?`Static${ke}`:ke;b.push({name:ut,kind:xe,line:fe.getStartLineNumber(),isExported:!1,id:`${u}:${ut}`,parentSymbolId:k,category:MDe(ke)})}}getExportedSymbols(o,u){let b=this.project.getSourceFile(o);b?b.replaceWithText(u):b=this.project.createSourceFile(o,u);let x=[],k=b.getExportedDeclarations();for(let[j,fe]of k){let ke=fe[0];if(!ke)continue;let tt=ke.getKindName();x.push({name:j,kind:tt,line:ke.getStartLineNumber(),isExported:!0,id:`${o}:${j}`,category:MDe(tt)})}return x}filterRuntimeSymbols(o){let u=new Set(["InterfaceDeclaration","TypeAliasDeclaration","TypeParameter"]);return o.filter(b=>!u.has(b.kind))}async analyzeFile(o){let u=await this.fileReader.readFile(o),b=this.analyzeFileContent(o,u),x=new Map;for(let k of b.symbols)x.set(k.id,k);return x}async getSymbolDependencies(o){let u=await this.fileReader.readFile(o);return this.analyzeFileContent(o,u).dependencies}};var AXe=Ex(require("node:fs/promises")),doe=Ex(require("node:path"));var xXe=Ex(require("node:fs/promises")),Q8=require("web-tree-sitter"),Z8=class h{static instance=null;initPromise=null;parsers=new Map;parserPromises=new Map;languages=new Map;initialized=!1;textEncoder=new TextEncoder;constructor(){}static getInstance(){return h.instance??=new h,h.instance}async init(o){if(!this.initialized){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{try{await Q8.Parser.init({locateFile:()=>o}),this.initialized=!0}catch(u){this.initPromise=null;let b=u instanceof Error?u.message:String(u);throw new Error(`Failed to initialize web-tree-sitter from ${o}: ${b}. Ensure the WASM file exists and is not corrupted.`,{cause:u})}})(),await this.initPromise}}async getParser(o,u){if(!this.initialized)throw new Error("WasmParserFactory must be initialized with init() before creating parsers");if(this.parsers.has(o))return this.parsers.get(o);if(this.parserPromises.has(o))return this.parserPromises.get(o);let b=(async()=>{try{this.languages.has(o)||await this.loadLanguage(o,u);let x=new Q8.Parser,k=this.languages.get(o);return x.setLanguage(k),this.parsers.set(o,x),x}finally{this.parserPromises.delete(o)}})();return this.parserPromises.set(o,b),b}async loadLanguage(o,u){try{let b;try{let x=await xXe.default.readFile(u),k=this.normalizeLegacyDylinkSection(new Uint8Array(x));b=await Q8.Language.load(k)}catch(x){let k=x instanceof Error?x.message:String(x);if(k.includes("ENOENT")||k.includes("not found"))b=await Q8.Language.load(u);else throw x}this.languages.set(o,b)}catch(b){let x=b instanceof Error?b.message:String(b);throw x.includes("ENOENT")||x.includes("not found")?new Error(`Language WASM file not found: ${u}. Ensure the extension is properly installed and WASM files are in the dist directory.`,{cause:b}):x.includes("magic")||x.includes("invalid")?new Error(`Failed to load language WASM from ${u}: ${x}. The WASM file may be corrupted. Try reinstalling the extension.`,{cause:b}):new Error(`Failed to load language WASM from ${u}: ${x}`,{cause:b})}}normalizeLegacyDylinkSection(o){try{if(o.length<12||o[0]!==0||o[1]!==97||o[2]!==115||o[3]!==109)return o;let u=8;if(o[u]!==0)return o;let b=this.readUnsignedLeb128(o,u+1),x=b.nextOffset,k=x+b.value;if(k>o.length)return o;let j=this.readUnsignedLeb128(o,x),fe=j.nextOffset,ke=fe+j.value;if(ke>k||Buffer.from(o.subarray(fe,ke)).toString("utf8")!=="dylink")return o;let ot=ke,ut=this.readUnsignedLeb128(o,ot);ot=ut.nextOffset;let xe=this.readUnsignedLeb128(o,ot);ot=xe.nextOffset;let gn=this.readUnsignedLeb128(o,ot);ot=gn.nextOffset;let _t=this.readUnsignedLeb128(o,ot);ot=_t.nextOffset;let dt=this.readUnsignedLeb128(o,ot);ot=dt.nextOffset;let ui=[];for(let Or=0;Or<dt.value;Or++){let bi=this.readUnsignedLeb128(o,ot);ot=bi.nextOffset;let ud=ot+bi.value;if(ud>k)return o;ui.push(o.subarray(ot,ud)),ot=ud}let Ti=this.concatUint8Arrays(this.encodeUnsignedLeb128(ut.value),this.encodeUnsignedLeb128(xe.value),this.encodeUnsignedLeb128(gn.value),this.encodeUnsignedLeb128(_t.value)),qi=this.concatUint8Arrays(this.encodeUnsignedLeb128(ui.length),...ui.flatMap(Or=>[this.encodeUnsignedLeb128(Or.length),Or])),cs=1,Cl=2,Ja=this.concatUint8Arrays(Uint8Array.of(cs),this.encodeUnsignedLeb128(Ti.length),Ti),Ur=this.concatUint8Arrays(Uint8Array.of(Cl),this.encodeUnsignedLeb128(qi.length),qi),wn=this.textEncoder.encode("dylink.0"),ki=this.concatUint8Arrays(this.encodeUnsignedLeb128(wn.length),wn,Ja,Ur),hi=this.concatUint8Arrays(Uint8Array.of(0),this.encodeUnsignedLeb128(ki.length),ki);return this.concatUint8Arrays(o.subarray(0,8),hi,o.subarray(k))}catch{return o}}readUnsignedLeb128(o,u){let b=0,x=0,k=u;for(;k<o.length;){let j=o[k];if(b|=(j&127)<<x,k++,(j&128)===0)return{value:b,nextOffset:k};if(x+=7,x>35)throw new Error("Invalid LEB128 value")}throw new Error("Unexpected EOF while reading LEB128")}encodeUnsignedLeb128(o){let u=[],b=o>>>0;do{let x=b&127;b>>>=7,b!==0&&(x|=128),u.push(x)}while(b!==0);return Uint8Array.from(u)}concatUint8Arrays(...o){let u=o.reduce((k,j)=>k+j.length,0),b=new Uint8Array(u),x=0;for(let k of o)b.set(k,x),x+=k.length;return b}isInitialized(){return this.initialized}reset(){this.parsers.clear(),this.parserPromises.clear(),this.languages.clear(),this.initialized=!1,this.initPromise=null}};var uoe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,u){this.extensionPath=u??o,this.fileReader=new pR}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure PythonSymbolAnalyzer is constructed with extensionPath parameter.");try{let u=Z8.getInstance(),b=doe.default.join(o,"dist","wasm","tree-sitter.wasm");await u.init(b);let x=doe.default.join(o,"dist","wasm","tree-sitter-python.wasm");this.parser=await u.getParser("python",x)}catch(u){this.initPromise=null;let b=u instanceof Error?u.message:String(u);throw new Error(`Failed to initialize Python WASM parser for symbol analysis: ${b}`,{cause:u})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),u=doe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await AXe.default.access(u),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,u)}catch(u){throw Dy.fromError(u,o)}}analyzeFileFromContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Python file: ${o}`);let x=new Map,k=pw(o);return this.extractSymbols(b.rootNode,k,u,x),x}analyzeFileContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Python file: ${o}`);let x=new Map,k=[],j=pw(o);this.extractSymbols(b.rootNode,j,u,x);let fe=this.buildImportMap(b.rootNode,u);return this.extractDependencies(b.rootNode,j,u,k,x,void 0,fe),{symbols:Array.from(x.values()),dependencies:k}}async getSymbolDependencies(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileContent(o,u).dependencies}catch(u){throw Dy.fromError(u,o)}}extractSymbols(o,u,b,x,k){this.tryExtractSymbolFromNode(o,u,b,x,k)||this.extractSymbolsFromChildren(o,u,b,x,k)}tryExtractSymbolFromNode(o,u,b,x,k){return o.type==="function_definition"?(this.handleFunctionDefinition(o,u,b,x,k),!0):o.type==="class_definition"?(this.handleClassDefinition(o,u,b,x,k),!0):o.type==="decorated_definition"?(this.handleDecoratedDefinition(o,u,b,x,k),!0):!1}handleFunctionDefinition(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasChild(o,"async");x.set(ke,{name:fe,kind:tt?"AsyncFunction":"FunctionDeclaration",line:j.startPosition.row+1,isExported:this.isExported(o,b),id:ke,parentSymbolId:k,category:"function"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleClassDefinition(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`;x.set(ke,{name:fe,kind:"ClassDeclaration",line:j.startPosition.row+1,isExported:this.isExported(o,b),id:ke,parentSymbolId:k,category:"class"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleDecoratedDefinition(o,u,b,x,k){for(let j of o.children)(j.type==="function_definition"||j.type==="class_definition")&&this.extractSymbols(j,u,b,x,k)}extractSymbolsFromChildren(o,u,b,x,k){for(let j of o.children)this.extractSymbols(j,u,b,x,k)}buildImportMap(o,u){let b=new Map;return this.traverseForImports(o,b,u),b}traverseForImports(o,u,b){o.type==="import_from_statement"?this.processFromImport(o,u,b):o.type==="import_statement"&&this.processImportStatement(o,u,b);for(let x of o.children)this.traverseForImports(x,u,b)}processFromImport(o,u,b){let x=o.childForFieldName("module_name");if(!x)return;let k=this.getNodeText(x,b);for(let j of o.children)this.processFromImportChild(j,u,b,k)}processFromImportChild(o,u,b,x){if(o.type==="aliased_import"){this.addAliasedFromImport(o,u,b,x);return}if(o.type==="dotted_name"||o.type==="identifier"){let k=this.getNodeText(o,b);if(k===x||o.parent?.type==="aliased_import")return;u.set(k,x)}}addAliasedFromImport(o,u,b,x){let k=o.childForFieldName("name");if(!k)return;let j=this.getNodeText(k,b),fe=o.childForFieldName("alias"),ke=fe?this.getNodeText(fe,b):j;u.set(ke,x)}processImportStatement(o,u,b){for(let x of o.children)this.processImportStatementChild(x,u,b)}processImportStatementChild(o,u,b){if(o.type==="aliased_import"){let x=o.childForFieldName("name");if(!x)return;let k=this.getNodeText(x,b),j=o.childForFieldName("alias"),fe=j?this.getNodeText(j,b):k;u.set(fe,k);return}if(o.type==="dotted_name"||o.type==="identifier"){let x=this.getNodeText(o,b);x!=="import"&&u.set(x,x)}}extractDependencies(o,u,b,x,k,j,fe){let ke=this.getScopeForNode(o,u,b,j);this.addCallDependencyIfAny(o,u,b,x,k,ke,fe);for(let tt of o.children)this.extractDependencies(tt,u,b,x,k,ke,fe)}getScopeForNode(o,u,b,x){if(o.type!=="function_definition"&&o.type!=="class_definition")return x;let k=o.childForFieldName("name");if(!k)return x;let j=this.getNodeText(k,b);return`${u}:${j}`}addCallDependencyIfAny(o,u,b,x,k,j,fe){if(o.type!=="call")return;let ke=o.childForFieldName("function");if(!ke||!j)return;let tt=this.getCalledName(ke,b),ot=`${u}:${tt}`;if(k.has(ot)){x.push({sourceSymbolId:j,targetSymbolId:ot,targetFilePath:u,isTypeOnly:!1});return}if(fe?.has(tt)){let ut=fe.get(tt);x.push({sourceSymbolId:j,targetSymbolId:`${ut}:${tt}`,targetFilePath:ut,isTypeOnly:!1})}}getCalledName(o,u){if(o.type!=="attribute")return this.getNodeText(o,u);let b=o.childForFieldName("attribute");return b?this.getNodeText(b,u):this.getNodeText(o,u)}isExported(o,u){let b=o.childForFieldName("name");return b?!this.getNodeText(b,u).startsWith("_"):!1}hasChild(o,u){for(let b of o.children)if(b.type===u)return!0;return!1}getNodeText(o,u){return u.slice(o.startIndex,o.endIndex)}};var DXe=Ex(require("node:fs/promises")),poe=Ex(require("node:path"));var foe=class{parser=null;fileReader;initPromise=null;extensionPath;constructor(o,u){this.extensionPath=u??o,this.fileReader=new pR}async ensureInitialized(){if(!this.parser){if(this.initPromise)return this.initPromise;this.initPromise=(async()=>{let o=await this.resolveExtensionPath();if(!o)throw new Error("Extension path required for WASM parser initialization. Ensure RustSymbolAnalyzer is constructed with extensionPath parameter.");try{let u=Z8.getInstance(),b=poe.default.join(o,"dist","wasm","tree-sitter.wasm");await u.init(b);let x=poe.default.join(o,"dist","wasm","tree-sitter-rust.wasm");this.parser=await u.getParser("rust",x)}catch(u){this.initPromise=null;let b=u instanceof Error?u.message:String(u);throw new Error(`Failed to initialize Rust WASM parser for symbol analysis: ${b}`,{cause:u})}})(),await this.initPromise}}async resolveExtensionPath(){if(this.extensionPath)return this.extensionPath;let o=process.cwd(),u=poe.default.join(o,"dist","wasm","tree-sitter.wasm");try{return await DXe.default.access(u),o}catch{return}}async analyzeFile(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileFromContent(o,u)}catch(u){throw Dy.fromError(u,o)}}analyzeFileFromContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileFromContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Rust file: ${o}`);let x=new Map,k=pw(o);return this.extractSymbols(b.rootNode,k,u,x),x}analyzeFileContent(o,u){if(!this.parser)throw new Error("Parser not initialized. Call ensureInitialized() before using analyzeFileContent().");let b=this.parser.parse(u);if(!b)throw new Error(`Failed to parse Rust file: ${o}`);let x=new Map,k=[],j=pw(o);this.extractSymbols(b.rootNode,j,u,x);let fe=this.buildImportMap(b.rootNode,u);return this.extractDependencies(b.rootNode,j,u,k,x,void 0,fe),{symbols:Array.from(x.values()),dependencies:k}}async getSymbolDependencies(o){try{await this.ensureInitialized();let u=await this.fileReader.readFile(o);return this.analyzeFileContent(o,u).dependencies}catch(u){throw Dy.fromError(u,o)}}extractSymbols(o,u,b,x,k){this.tryExtractSymbolFromNode(o,u,b,x,k)||this.extractSymbolsFromChildren(o,u,b,x,k)}tryExtractSymbolFromNode(o,u,b,x,k){return o.type==="function_item"?(this.handleFunctionItem(o,u,b,x,k),!0):o.type==="struct_item"?(this.handleStructItem(o,u,b,x,k),!0):o.type==="enum_item"?(this.handleEnumItem(o,u,b,x,k),!0):o.type==="trait_item"?(this.handleTraitItem(o,u,b,x,k),!0):o.type==="impl_item"?(this.handleImplItem(o,u,b,x,k),!0):!1}handleFunctionItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasModifier(o,"async"),ot=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:tt?"AsyncFunction":"FunctionDeclaration",line:j.startPosition.row+1,isExported:ot,id:ke,parentSymbolId:k,category:"function"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleStructItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:"StructDeclaration",line:j.startPosition.row+1,isExported:tt,id:ke,parentSymbolId:k,category:"class"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleEnumItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:"EnumDeclaration",line:j.startPosition.row+1,isExported:tt,id:ke,parentSymbolId:k,category:"type"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleTraitItem(o,u,b,x,k){let j=o.childForFieldName("name");if(!j)return;let fe=this.getNodeText(j,b),ke=`${u}:${fe}`,tt=this.hasVisibilityModifier(o,"pub");x.set(ke,{name:fe,kind:"InterfaceDeclaration",line:j.startPosition.row+1,isExported:tt,id:ke,parentSymbolId:k,category:"type"}),this.extractSymbolsFromChildren(o,u,b,x,ke)}handleImplItem(o,u,b,x,k){this.extractSymbolsFromChildren(o,u,b,x,k)}extractSymbolsFromChildren(o,u,b,x,k){for(let j of o.children)this.extractSymbols(j,u,b,x,k)}buildImportMap(o,u){let b=new Map,x=k=>{if(k.type==="use_declaration"&&this.extractUseDeclarationImports(k,u,b),k.type==="mod_item"){let j=k.childForFieldName("name");if(j){let fe=this.getNodeText(j,u);b.set(fe,fe)}}for(let j of k.children)x(j)};return x(o),b}extractUseDeclarationImports(o,u,b){this.extractFromUseLists(o,u,b),this.extractFromScopedIdentifiers(o,u,b),this.extractFromUseAsClauses(o,u,b)}extractFromUseLists(o,u,b){let x=this.findAllByType(o,"use_list");for(let k of x){let j=this.findBaseModuleForUseList(k,u);this.extractIdentifiersFromUseList(k,j,u,b)}}findBaseModuleForUseList(o,u){let b=o.parent;for(;b;){if(b.type==="scoped_use_list"){let x=this.findScopedIdentifierInChildren(b,u);if(x)return x}b=b.parent}return""}findScopedIdentifierInChildren(o,u){for(let b of o.children)if(b.type==="scoped_identifier")return this.getNodeText(b,u);return""}extractIdentifiersFromUseList(o,u,b,x){for(let k of o.children)if(k.type==="identifier"){let j=this.getNodeText(k,b);x.set(j,u)}}extractFromScopedIdentifiers(o,u,b){let x=this.findAllByType(o,"scoped_identifier");for(let k of x){if(this.hasAncestorOfType(k,"use_list"))continue;let j=this.getNodeText(k,u),{localName:fe,modulePath:ke}=this.splitModulePath(j);b.set(fe,ke)}}splitModulePath(o){let u=o.split("::"),b=u.at(-1),x=u.slice(0,-1).join("::");return{localName:b,modulePath:x}}extractFromUseAsClauses(o,u,b){let x=this.findAllByType(o,"use_as_clause");for(let k of x){let j=k.childForFieldName("path"),fe=k.childForFieldName("alias");if(j&&fe){let ke=this.getNodeText(j,u),tt=this.getNodeText(fe,u);b.set(tt,ke)}}}extractDependencies(o,u,b,x,k,j,fe){let ke=this.getScopeForNode(o,u,b,j);this.addCallDependencyIfAny(o,u,b,x,k,ke,fe);for(let tt of o.children)this.extractDependencies(tt,u,b,x,k,ke,fe)}getScopeForNode(o,u,b,x){if(o.type!=="function_item")return x;let k=o.childForFieldName("name");if(!k)return x;let j=this.getNodeText(k,b);return`${u}:${j}`}addCallDependencyIfAny(o,u,b,x,k,j,fe){if(o.type!=="call_expression")return;let ke=o.childForFieldName("function");if(!ke||!j)return;let{moduleName:tt,symbolName:ot}=this.extractModuleAndSymbolName(ke,b),ut=`${u}:${ot}`;if(k.has(ut)){x.push({sourceSymbolId:j,targetSymbolId:ut,targetFilePath:u,isTypeOnly:!1});return}if(tt&&fe?.has(tt)){let xe=fe.get(tt);x.push({sourceSymbolId:j,targetSymbolId:`${xe}:${ot}`,targetFilePath:xe,isTypeOnly:!1});return}if(fe?.has(ot)){let xe=fe.get(ot);x.push({sourceSymbolId:j,targetSymbolId:`${xe}:${ot}`,targetFilePath:xe,isTypeOnly:!1})}}extractModuleAndSymbolName(o,u){if(o.type==="field_expression"){let b=o.childForFieldName("field");if(b)return{moduleName:void 0,symbolName:this.getNodeText(b,u)}}if(o.type==="scoped_identifier"){let x=this.getNodeText(o,u).split("::");if(x.length>=2){let k=x.at(-1);return{moduleName:x.slice(0,-1).join("::"),symbolName:k}}return{moduleName:void 0,symbolName:x[0]}}return{moduleName:void 0,symbolName:this.getNodeText(o,u)}}hasVisibilityModifier(o,u){if(o.childForFieldName("visibility_modifier"))return!0;for(let x of o.children)if(x.type==="visibility_modifier")return!0;return!1}hasAncestorOfType(o,u){let b=o.parent;for(;b;){if(b.type===u)return!0;b=b.parent}return!1}hasModifier(o,u){for(let b of o.children)if(b.type===u)return!0;return!1}findAllByType(o,u){let b=[],x=k=>{k.type===u&&b.push(k);for(let j of k.children)x(j)};return x(o),b}getNodeText(o,u){return u.slice(o.startIndex,o.endIndex)}};var s2t=mw.workerData,PXe=s2t.extensionPath??process.cwd(),l2t=x8("AstWorker"),moe=new coe(void 0,{maxFiles:100}),IXe=new uoe(void 0,PXe),CXe=new foe(void 0,PXe),i9=new soe;function c2t(h){let o=Qje(h);return o==="python"?"python":o==="rust"?"rust":"typescript"}async function d2t(h){try{let o;switch(h.type){case"analyzeFile":{let b=c2t(h.filePath);if(b==="python"){await IXe.ensureInitialized();let{symbols:x,dependencies:k}=IXe.analyzeFileContent(h.filePath,h.content);o={symbols:x,dependencies:k}}else if(b==="rust"){await CXe.ensureInitialized();let{symbols:x,dependencies:k}=CXe.analyzeFileContent(h.filePath,h.content);o={symbols:x,dependencies:k}}else{let{symbols:x,dependencies:k}=moe.analyzeFileContent(h.filePath,h.content);o={symbols:x,dependencies:k}}break}case"getInternalExportDeps":{let b=moe.getInternalExportDependencyGraph(h.filePath,h.content);o=Object.fromEntries(Array.from(b.entries()).map(([x,k])=>[x,Array.from(k)]));break}case"extractSignatures":{o=i9.extractSignatures(h.filePath,h.content);break}case"extractInterfaceMembers":{let b=i9.extractInterfaceMembers(h.filePath,h.content);o=Object.fromEntries(b);break}case"extractTypeAliases":{o=i9.extractTypeAliases(h.filePath,h.content);break}case"compareSignatures":{o=i9.compareSignatures(h.oldSig,h.newSig);break}case"analyzeBreakingChanges":{o=i9.analyzeBreakingChanges(h.filePath,h.oldContent,h.newContent);break}case"reset":{moe.reset(),o={success:!0};break}case"getFileCount":{o=moe.getFileCount();break}default:{let b=h;throw new Error(`Unknown message type: ${JSON.stringify(b)}`)}}let u={type:"success",id:h.id,result:o};mw.parentPort?.postMessage(u)}catch(o){let u=o instanceof Error?o.message:String(o),b=o instanceof Error?o.stack:void 0,x={type:"error",id:h.id,error:u,stack:b};mw.parentPort?.postMessage(x)}}mw.parentPort?mw.parentPort.on("message",h=>{d2t(h)}):(l2t.error("parentPort is null - worker not properly initialized"),process.exit(1));
|
|
42159
42159
|
/*! Bundled license information:
|
|
42160
42160
|
|
|
42161
42161
|
@ts-morph/common/dist/typescript.js:
|