@zeroheight/adoption-cli 4.0.2 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -417,10 +417,10 @@ Additional information: BADCLIENT: Bad error code, ${l} not found in range ${a}.
417
417
  `+"Path: "+e.getFilePath()+"\nText: "+JSON.stringify(t.getTextForError(o))+"\nStack: "+s.stack;function a(t){throw new np(e.getFilePath(),i,o,t)}n.length>0&&a("Manipulation error: A syntax error was inserted.\n\n"+e._context.project.formatDiagnosticsWithColorAndContext(n,{newLineChar:"\n"})+"\n"+r),a("Manipulation error: "+r)}}function nm(e){let{insertPos:t,newText:n,parent:r}=e;nf(r._sourceFile,new no({insertPos:t,newText:n,replacingLength:e.replacing?.textLength}),new ne().getForParentRange({parent:r,start:t,end:t+n.length,replacingLength:e.replacing?.textLength,replacingNodes:e.replacing?.nodes,customMappings:e.customMappings}))}function n_(e){let{currentNodes:t,insertIndex:n,parent:r}=e,i=t[n-1],o=function(){for(let e=n-1;e>=0;e--)if(!nL.isCommentNode(t[e]))return t[e]}(),a=t[n],s=function(){for(let e=n;e<t.length;e++)if(!nL.isCommentNode(t[e]))return t[e]}(),l=e.useNewLines?r._context.manipulationSettings.getNewLineKindAsString():" ",c=r.getNextSibling(),d=null!=c&&(c.getKind()===eV.SyntaxKind.CloseBraceToken||c.getKind()===eV.SyntaxKind.CloseBracketToken),{newText:u}=e;if(null!=i){(function(){if(null==o)return p();let e=r.getSourceFile().getFullText(),t=o.getNextSibling(),n="";function a(){let t=l(i)||i.getEnd();n+=e.substring(o.getEnd(),t)}function s(t){let r=l(t);null!=r&&(n+=e.substring(t.getEnd(),r))}function l(e){let t=e.getTrailingCommentRanges(),n=t[t.length-1];return n?.getEnd()}null!=t&&t.getKind()===eV.SyntaxKind.CommaToken?(s(o),n+=",",o===i?s(t):a()):(n+=",",o===i?s(o):a()),p(),u=n+u})(),null!=s||e.useTrailingCommas?f():e.useNewLines||e.surroundWithSpaces?m():_();let t=null==a?d?c.getStart(!0):r.getEnd():a.getStart(!0),n=(o||i).getEnd();nm({insertPos:n,newText:u,parent:r,replacing:{textLength:t-n}})}else if(null!=a){(e.useNewLines||e.surroundWithSpaces)&&p(),null!=s||e.useTrailingCommas?f():m();let t=d?r.getPos():r.getStart(!0);nm({insertPos:t,newText:u,parent:r,replacing:{textLength:a.getStart(!0)-t}})}else e.useNewLines||e.surroundWithSpaces?(p(),e.useTrailingCommas?f():m()):_(),nm({insertPos:r.getPos(),newText:u,parent:r,replacing:{textLength:r.getNextSiblingOrThrow().getStart()-r.getPos()}});function p(){eV.StringUtils.startsWithNewLine(u)||(u=l+u)}function f(){u=function(e){let t=tL(e);return -1===t?e:e.substring(0,t)+","+e.substring(t)}(u),m()}function m(){eV.StringUtils.endsWithNewLine(u)||(u+=l),_()}function _(){(e.useNewLines||eV.StringUtils.endsWithNewLine(u))&&(null!=a?u+=r.getParentOrThrow().getChildIndentationText():u+=r.getParentOrThrow().getIndentationText())}}function nh(e){let{parent:t,index:n,children:r}=e,i=t._sourceFile.getFullText(),o=t.getChildSyntaxListOrThrow(),a=tj(n,o,r),s=function(e,t,n,r){let i;if(e===n.length)if(nL.isSourceFile(t))i=t.getEnd();else if(nL.isCaseClause(t)||nL.isDefaultClause(t))i=t.getEnd();else{let e=tK(t).getLastChildByKind(eV.SyntaxKind.CloseBraceToken);i=null==e?t.getEnd():e.getStart()}else i=n[e].getNonWhitespaceStart();return tG(r,i)}(n,t,r,i)-a,l=function(){let i=t._getWriterWithChildIndentation();return e.write(i,{previousMember:o(r[n-1]),nextMember:o(r[n]),isStartOfFile:0===a}),i.toString();function o(e){return null==e?e:nL.isOverloadable(e)&&e.getImplementation()||e}}();nf(t._sourceFile,new no({insertPos:a,replacingLength:s,newText:l}),new ne().getForParentRange({parent:o,start:a,end:a+l.length,replacingLength:s}))}function ng(e){if(0===e.structures.length)return[];let t=e.getIndexedChildren(),n=e.parent.getChildSyntaxListOrThrow(),r=tX(e.index,t.length),i=function(){let e=0,n=0;for(let i=r-1;i>=0;i--){let r=t[i];if(nL.isCommentNode(r))e++,r.getText().startsWith("/**")&&(n=e);else break}return n}();return nh({parent:e.parent,index:0===r?0:t[r-1].getChildIndex()+1,children:n.getChildren(),write:e.write}),tH(e.getIndexedChildren(),e.index-i,e.structures.length,e.expectedKind)}function ny(e){let t=e.getIndexedChildren(),n=e.parent.getChildSyntaxListOrThrow(),r=tX(e.index,t.length);return nh({parent:e.parent,index:0===r?0:t[r-1].getChildIndex()+1,children:n.getChildren(),write:e.write}),tU(t,e.getIndexedChildren(),r,!0)}function nv(e){let{children:t}=e;0!==t.length&&nf(t[0].getSourceFile(),new na(e),new ne().getForChildIndex({parent:t[0].getParentSyntaxList()||t[0].getParentOrThrow(),childIndex:t[0].getChildIndex(),childCount:-1*t.length}))}function nb(e){let{children:t,getSiblingFormatting:n}=e;0!==t.length&&nf(t[0]._sourceFile,new nl({children:t,getSiblingFormatting:n}),new ne().getForChildIndex({parent:t[0].getParentSyntaxList()||t[0].getParentOrThrow(),childIndex:t[0].getChildIndex(),childCount:-1*t.length}))}function nx(e){nb({getSiblingFormatting:tI,children:e})}function nS(e){nb({getSiblingFormatting:tN,children:e})}function nE(e){let t=[e],n=e.getParentSyntaxListOrThrow(),r=t[0]===n.getFirstChild();(function(){let n=e.getNextSiblingIfKind(eV.SyntaxKind.CommaToken);null!=n&&t.push(n)})(),function(){if(n.getLastChild()!==t[t.length-1])return;let r=e.getPreviousSiblingIfKind(eV.SyntaxKind.CommaToken);null!=r&&t.unshift(r)}(),nv({children:t,removePrecedingSpaces:!r||n.getChildren().length===t.length&&t[0].isFirstNodeOnLine(),removeFollowingSpaces:r,removePrecedingNewLines:!r,removeFollowingNewLines:r})}function nT(e){nb({getSiblingFormatting:tP,children:e})}function nA(e){nb({getSiblingFormatting:tR,children:e})}function nD(e){nf(e.sourceFile,new no({insertPos:e.start,newText:e.newText,replacingLength:e.replacingLength}),new ne().getForForgetChanged(e.sourceFile._context.compilerFactory))}function nC(e){let{sourceFile:t,newText:n}=e;nf(t,new nr(n),new ne().getForStraightReplacement(t._context.compilerFactory))}function nI(e){let{sourceFile:t,newFilePath:n}=e;nf(t,new nd,new ne().getForStraightReplacement(t._context.compilerFactory),n)}function nN(e){return class extends e{getArguments(){return this.compilerNode.arguments?.map(e=>this._getNodeFromCompilerNode(e))??[]}addArgument(e){return this.addArguments([e])[0]}addArguments(e){return this.insertArguments(this.getArguments().length,e)}insertArgument(e,t){return this.insertArguments(e,[t])[0]}insertArguments(e,t){if(t instanceof Function&&(t=[t]),eV.ArrayUtils.isNullOrEmpty(t))return[];this._addParensIfNecessary();let n=this.getArguments();e=tX(e,n.length);let r=this._getWriterWithQueuedChildIndentation();for(let e=0;e<t.length;e++)r.conditionalWrite(e>0,", "),tf(r,t[e]);return n_({parent:this.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenParenToken).getNextSiblingIfKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:n,insertIndex:e,newText:r.toString(),useTrailingCommas:!1}),tU(n,this.getArguments(),e,!1)}removeArgument(e){let t=this.getArguments();if(0===t.length)throw new eV.errors.InvalidOperationError("Cannot remove an argument when none exist.");return nE("number"==typeof e?t[tX(e,t.length-1)]:e),this}_addParensIfNecessary(){let e=this.getFullText();")"!==e[e.length-1]&&nm({insertPos:this.getEnd(),newText:"()",parent:this})}}}function nP(e){return class extends e{isAsync(){return this.hasModifier(eV.SyntaxKind.AsyncKeyword)}getAsyncKeyword(){return this.getFirstModifierByKind(eV.SyntaxKind.AsyncKeyword)}getAsyncKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAsyncKeyword(),e??"Expected to find an async keyword.",this)}setIsAsync(e){return this.toggleModifier("async",e),this}set(t){return tD(e.prototype,this,t),null!=t.isAsync&&this.setIsAsync(t.isAsync),this}getStructure(){return tA(e.prototype,this,{isAsync:this.isAsync()})}}}function nR(e,t){return e.newLineIfLastNot(),("string"!=typeof t||t.length>0)&&e.indent(()=>{tf(e,t)}),e.newLineIfLastNot(),e.write(""),e.toString()}function nM(e){let t=e._sourceFile,n=e.getChildSyntaxList()||e,r=n.getNonWhitespaceStart(),i=Math.max(r,n._getTrailingTriviaNonWhitespaceEnd());if(0==i-r)return"";let o=t.getFullText().substring(r,i);return eV.StringUtils.removeIndentation(o,{indentSizeInSpaces:e._context.manipulationSettings._getIndentSizeInSpaces(),isInStringAtPos:e=>t.isInStringAtPos(e+r)})}class nk{#ta;#eC;constructor(e,t){this.#ta=e,this.#eC=t}get compilerObject(){return this.#ts(),this.#ta}getSourceFile(){return this.#ts(),this.#eC}getPos(){return this.compilerObject.pos}getEnd(){return this.compilerObject.end}getWidth(){return this.getEnd()-this.getPos()}getText(){return this.getSourceFile().getFullText().substring(this.compilerObject.pos,this.compilerObject.end)}_forget(){this.#ta=void 0,this.#eC=void 0}wasForgotten(){return null==this.#ta}#ts(){if(null==this.#ta)throw new eV.errors.InvalidOperationError("Attempted to get a text range that was forgotten. Text ranges are forgotten after a manipulation has occurred. Please re-request the text range after manipulations.")}}class nw extends nk{constructor(e,t){super(e,t)}getKind(){return this.compilerObject.kind}}class nL{#tl;#tc;#td;#tu;#tp;_wrappedChildCount=0;_context;__sourceFile;get _sourceFile(){if(null==this.__sourceFile)throw new eV.errors.InvalidOperationError("Operation cannot be performed on a node that has no source file.");return this.__sourceFile}get compilerNode(){if(null==this.#tl){let e="Attempted to get information from a node that was removed or forgotten.";throw null!=this.#tc&&(e+=`
418
418
 
419
419
  Node text: ${this.#tc}`),new eV.errors.InvalidOperationError(e)}return this.#tl}constructor(e,t,n){if(null==e||null==e.compilerFactory)throw new eV.errors.InvalidOperationError("Constructing a node is not supported. Please create a source file from the default export of the package and manipulate the source file from there.");this._context=e,this.#tl=t,this.__sourceFile=n}forget(){this.wasForgotten()||(this.forgetDescendants(),this._forgetOnlyThis())}forgetDescendants(){for(let e of this._getChildrenInCacheIterator())e.forget()}_forgetOnlyThis(){if(this.wasForgotten())return;let e=this.getParent();null!=e&&e._wrappedChildCount--,this.#tf(),this._context.compilerFactory.removeNodeFromCache(this),this._clearInternals()}wasForgotten(){return null==this.#tl}_hasWrappedChildren(){return this._wrappedChildCount>0||this.#tl?.kind===eV.SyntaxKind.SyntaxList}_replaceCompilerNodeFromFactory(e){null==e&&this.#tf(),this._clearInternals(),this.#tl=e}#tf(){let e=this._sourceFile&&this._sourceFile.compilerNode,t=this.#tl;null!=e&&null!=t&&(this.#tc=function(){let n=t.getStart(e),r=t.end-n,i=Math.min(r,100),o=e.text.substr(n,i);return i!==r?o+"...":o}())}_clearInternals(){function e(e){null!=e&&e.forEach(e=>e._forget())}this.#tl=void 0,this.#td=void 0,e(this.#tu),e(this.#tp),this.#tu=void 0,this.#tp=void 0}getKind(){return this.compilerNode.kind}getKindName(){return eV.getSyntaxKindName(this.compilerNode.kind)}getFlags(){return this.compilerNode.flags}print(e={}){return(null==e.newLineKind&&(e.newLineKind=this._context.manipulationSettings.getNewLineKind()),this.getKind()===eV.SyntaxKind.SourceFile)?tl(this.compilerNode,e):tl(this.compilerNode,this._sourceFile.compilerNode,e)}getSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getSymbol(),e??"Could not find the node's symbol.",this)}getSymbol(){let e=this.compilerNode.symbol;if(null!=e)return this._context.compilerFactory.getSymbol(e);let t=this._context.typeChecker.getSymbolAtLocation(this);if(null!=t)return t;let n=this.compilerNode.name;if(null!=n)return this._getNodeFromCompilerNode(n).getSymbol()}getSymbolsInScope(e){return this._context.typeChecker.getSymbolsInScope(this,e)}getLocalOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getLocal(e),t??(()=>`Expected to find local symbol with name: ${e}`),this)}getLocal(e){let t=this.#tm();if(null==t)return;let n=t.get(eV.ts.escapeLeadingUnderscores(e));return null==n?void 0:this._context.compilerFactory.getSymbol(n)}getLocals(){let e=this.#tm();return null==e?[]:Array.from(e.values()).map(e=>this._context.compilerFactory.getSymbol(e))}#tm(){return this._ensureBound(),this.compilerNode.locals}getType(){return this._context.typeChecker.getTypeAtLocation(this)}containsRange(e,t){return this.getPos()<=e&&t<=this.getEnd()}isInStringAtPos(e){if(eV.errors.throwIfOutOfRange(e,[this.getPos(),this.getEnd()],"pos"),null==this.#td)for(let e of(this.#td=[],this._getCompilerDescendantsIterator()))(function(e){switch(e){case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.TemplateHead:case eV.SyntaxKind.TemplateMiddle:case eV.SyntaxKind.TemplateTail:return!0;default:return!1}})(e.kind)&&this.#td.push([e.getStart(this._sourceFile.compilerNode),e.getEnd()]);return -1!==eV.ArrayUtils.binarySearch(this.#td,new class{compareTo(t){return e<=t[0]?-1:+(e>=t[1]-1)}})}asKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.asKind(e),t??(()=>`Expected the node to be of kind ${eV.getSyntaxKindName(e)}, but it was ${eV.getSyntaxKindName(this.getKind())}.`),this)}isKind(e){return this.getKind()===e}asKind(e){return this.isKind(e)?this:void 0}getFirstChildOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstChild(e),t??"Could not find a child that matched the specified condition.",this)}getFirstChild(e){let t=this._getCompilerFirstChild(nO(this,e));return this._getNodeFromCompilerNodeIfExists(t)}getLastChildOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getLastChild(e),t??"Could not find a child that matched the specified condition.",this)}getLastChild(e){let t=this._getCompilerLastChild(nO(this,e));return this._getNodeFromCompilerNodeIfExists(t)}getFirstDescendantOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstDescendant(e),t??"Could not find a descendant that matched the specified condition.",this)}getFirstDescendant(e){for(let t of this._getDescendantsIterator())if(null==e||e(t))return t}getPreviousSiblingOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getPreviousSibling(e),t??"Could not find the previous sibling.",this)}getPreviousSibling(e){let t=this._getCompilerPreviousSibling(nO(this,e));return this._getNodeFromCompilerNodeIfExists(t)}getNextSiblingOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getNextSibling(e),t??"Could not find the next sibling.",this)}getNextSibling(e){let t=this._getCompilerNextSibling(nO(this,e));return this._getNodeFromCompilerNodeIfExists(t)}getPreviousSiblings(){return this._getCompilerPreviousSiblings().map(e=>this._getNodeFromCompilerNode(e))}getNextSiblings(){return this._getCompilerNextSiblings().map(e=>this._getNodeFromCompilerNode(e))}getChildren(){return this._getCompilerChildren().map(e=>this._getNodeFromCompilerNode(e))}getChildAtIndex(e){return this._getNodeFromCompilerNode(this._getCompilerChildAtIndex(e))}*_getChildrenIterator(){for(let e of this._getCompilerChildren())yield this._getNodeFromCompilerNode(e)}*_getChildrenInCacheIterator(){for(let e of this._getCompilerChildrenFast())this._context.compilerFactory.hasCompilerNode(e)?yield this._context.compilerFactory.getExistingNodeFromCompilerNode(e):e.kind===eV.SyntaxKind.SyntaxList&&(yield this._getNodeFromCompilerNode(e))}getChildSyntaxListOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getChildSyntaxList(),e??"A child syntax list was expected.",this)}getChildSyntaxList(){let e=this;if(nL.isBodyable(e)||nL.isBodied(e))do{let t=(nL.isBodyable(e),e.getBody());if(null==t)return;e=t}while((nL.isBodyable(e)||nL.isBodied(e))&&null==e.compilerNode.statements);if(nL.isSourceFile(e)||nL.isBodyable(this)||nL.isBodied(this)||nL.isCaseBlock(this)||nL.isCaseClause(this)||nL.isDefaultClause(this)||nL.isJsxElement(this))return e.getFirstChildByKind(eV.SyntaxKind.SyntaxList);let t=!1;for(let n of e._getCompilerChildren())if(t){if(n.kind===eV.SyntaxKind.SyntaxList)return this._getNodeFromCompilerNode(n)}else t=n.kind===eV.SyntaxKind.OpenBraceToken}forEachChild(e,t){let n=[];for(let r of(this.compilerNode.forEachChild(e=>{n.push(this._getNodeFromCompilerNode(e))},null==t?void 0:e=>{n.push(e.map(e=>this._getNodeFromCompilerNode(e)))}),n))if(r instanceof Array){let e=r.filter(e=>!e.wasForgotten());if(e.length>0){let n=t(e);if(n)return n}}else if(!r.wasForgotten()){let t=e(r);if(t)return t}}forEachDescendant(e,t){let n={},r={},i=!1,o=!1,a={stop:()=>i=!0,up:()=>o=!0},s=t=>{if(i)return n;let r=!1,s=e(t,{...a,skip:()=>r=!0});return s?s:i?n:r||o||t.wasForgotten()?void 0:d(t)},l=null==t?void 0:e=>{if(i)return n;let r=!1,s=t(e,{...a,skip:()=>r=!0});if(s)return s;if(!r)for(let t of e){if(i)return n;if(o)break;let e=d(t);if(e)return e}},c=d(this);return c===n?void 0:c;function d(e){let t=e.forEachChild(e=>{let t=s(e);return o?(o=!1,t||r):t},null==l?void 0:e=>{let t=l(e);return o?(o=!1,t||r):t});return t===r?void 0:t}}forEachChildAsArray(){let e=[];return this.compilerNode.forEachChild(t=>{e.push(this._getNodeFromCompilerNode(t))}),e}forEachDescendantAsArray(){let e=[];return this.forEachDescendant(t=>{e.push(t)}),e}getDescendants(){return Array.from(this._getDescendantsIterator())}*_getDescendantsIterator(){for(let e of this._getCompilerDescendantsIterator())yield this._getNodeFromCompilerNode(e)}getDescendantStatements(){let e=[];return t(this,this.compilerNode),e;function t(r,i){!function(t,r){if(null==r.statements)return!1;for(let i of t._getNodeFromCompilerNode(r).getStatements())e.push(i),n(t,i.compilerNode);return!0}(r,i)&&(i.kind===eV.SyntaxKind.ArrowFunction?i.body.kind!==eV.SyntaxKind.Block?e.push(r._getNodeFromCompilerNode(i.body)):t(r,i.body):n(r,i))}function n(e,n){eV.ts.forEachChild(n,n=>t(e,n))}}getChildCount(){return this._getCompilerChildren().length}getChildAtPos(e){if(!(e<this.getPos()||e>=this.getEnd())){for(let t of this._getCompilerChildren())if(e>=t.pos&&e<t.end)return this._getNodeFromCompilerNode(t)}}getDescendantAtPos(e){let t;for(;;){let n=(t||this).getChildAtPos(e);if(null==n)return t;t=n}}getDescendantAtStartWithWidth(e,t){let n;return this._context.compilerFactory.forgetNodesCreatedInBlock(r=>{let i=this.getSourceFile();do if(null!=(i=i.getChildAtPos(e))){if(i.getStart()===e&&i.getWidth()===t)n=i;else if(null!=n)break}while(null!=i);null!=n&&r(n)}),n}getPos(){return this.compilerNode.pos}getEnd(){return this.compilerNode.end}getStart(e){return this.compilerNode.getStart(this._sourceFile.compilerNode,e)}getFullStart(){return this.compilerNode.getFullStart()}getNonWhitespaceStart(){return this._context.compilerFactory.forgetNodesCreatedInBlock(()=>{let e,t=this.getParent(),n=this.getPos();if(null!=t&&!nL.isSourceFile(t)&&t.getPos()===n)return this.getStart(!0);let r=this._sourceFile.getFullText(),i=this.getPreviousSibling();return e=null!=i&&nL.isCommentNode(i)?i.getEnd():null!=i?!function(e,t){for(let n=t[0];n<t[1];n++)if("\n"===e[n])return!0;return!1}(r,[n,this.getStart(!0)])?n:i.getTrailingTriviaEnd():this.getPos(),tF(r,e,tB)})}_getTrailingTriviaNonWhitespaceEnd(){return tW(this._sourceFile.getFullText(),this.getTrailingTriviaEnd(),tB)}getWidth(e){return this.getEnd()-this.getStart(e)}getFullWidth(){return this.compilerNode.getFullWidth()}getLeadingTriviaWidth(){return this.compilerNode.getLeadingTriviaWidth(this._sourceFile.compilerNode)}getTrailingTriviaWidth(){return this.getTrailingTriviaEnd()-this.getEnd()}getTrailingTriviaEnd(){let e=this.getParent(),t=this.getEnd();if(null==e||e.getEnd()===t)return t;let n=this.getTrailingCommentRanges(),r=n.length>0?n[n.length-1].getEnd():t;return tF(this._sourceFile.getFullText(),r,e=>e!==eJ.SPACE&&e!==eJ.TAB)}getText(e){let t="object"==typeof e?e:void 0,n=!0===e||null!=t&&t.includeJsDocComments,r=null!=t&&t.trimLeadingIndentation,i=this.getStart(n),o=this._sourceFile.getFullText().substring(i,this.getEnd());return r?eV.StringUtils.removeIndentation(o,{isInStringAtPos:e=>this._sourceFile.isInStringAtPos(e+i),indentSizeInSpaces:this._context.manipulationSettings._getIndentSizeInSpaces()}):o}getFullText(){return this.compilerNode.getFullText(this._sourceFile.compilerNode)}getCombinedModifierFlags(){return eV.ts.getCombinedModifierFlags(this.compilerNode)}getSourceFile(){return this._sourceFile}getProject(){return this._context.project}getNodeProperty(e){let t=this.compilerNode[e];if(null!=t)return t instanceof Array?t.map(e=>n(e)?this._getNodeFromCompilerNode(e):e):n(t)?this._getNodeFromCompilerNode(t):t;function n(e){return"number"==typeof e.kind&&"number"==typeof e.pos&&"number"==typeof e.end}}getAncestors(e=!1){return Array.from(this._getAncestorsIterator(e))}*_getAncestorsIterator(e){let t=n(this);for(;null!=t;)yield t,t=n(t);function n(t){return e&&t.getParentSyntaxList()||t.getParent()}}getParent(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.parent)}getParentOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getParent(),e??"Expected to find a parent.",this)}getParentWhileOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getParentWhile(e),t??"The initial parent did not match the provided condition.",this)}getParentWhile(e){let t,n=this.getParent();for(;n&&e(n,t||this);)n=(t=n).getParent();return t}getParentWhileKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getParentWhileKind(e),t??(()=>`The initial parent was not a syntax kind of ${eV.getSyntaxKindName(e)}.`),this)}getParentWhileKind(e){return this.getParentWhile(t=>t.getKind()===e)}getLastToken(){let e=this.compilerNode.getLastToken(this._sourceFile.compilerNode);if(null==e)throw new eV.errors.NotImplementedError("Not implemented scenario where the last token does not exist.");return this._getNodeFromCompilerNode(e)}isInSyntaxList(){return null!=this.getParentSyntaxList()}getParentSyntaxListOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getParentSyntaxList(),e??"Expected the parent to be a syntax list.",this)}getParentSyntaxList(){let e=this.getKind();if(e===eV.SyntaxKind.SingleLineCommentTrivia||e===eV.SyntaxKind.MultiLineCommentTrivia)return this.getParentOrThrow().getChildSyntaxList();let t=tr(this.compilerNode,this._sourceFile.compilerNode);return this._getNodeFromCompilerNodeIfExists(t)}_getParentSyntaxListIfWrapped(){let e=this.getParent();if(null!=e&&te.hasParsedTokens(e.compilerNode))return this.getParentSyntaxList()}getChildIndex(){let e=(this.getParentSyntaxList()||this.getParentOrThrow())._getCompilerChildren().indexOf(this.compilerNode);if(-1===e)throw new eV.errors.NotImplementedError("For some reason the child's parent did not contain the child.");return e}getIndentationLevel(){let e=this._context.manipulationSettings.getIndentationText();return this._context.languageService.getIdentationAtPosition(this._sourceFile,this.getStart())/e.length}getChildIndentationLevel(){return nL.isSourceFile(this)?0:this.getIndentationLevel()+1}getIndentationText(e=0){return this.#t_(this.getIndentationLevel()+e)}getChildIndentationText(e=0){return this.#t_(this.getChildIndentationLevel()+e)}#t_(e){return this._context.manipulationSettings.getIndentationText().repeat(e)}getStartLinePos(e){return tW(this._sourceFile.getFullText(),this.getStart(e),e=>e===eJ.NEWLINE||e===eJ.CARRIAGE_RETURN)}getStartLineNumber(e){return eV.StringUtils.getLineNumberAtPos(this._sourceFile.getFullText(),this.getStartLinePos(e))}getEndLineNumber(){let e=tW(this._sourceFile.getFullText(),this.getEnd(),e=>e===eJ.NEWLINE||e===eJ.CARRIAGE_RETURN);return eV.StringUtils.getLineNumberAtPos(this._sourceFile.getFullText(),e)}isFirstNodeOnLine(){let e=this._sourceFile.getFullText(),t=this.getNonWhitespaceStart();for(let n=t-1;n>=0;n--){let t=e[n];if(" "!==t&&" "!==t){if("\n"===t)return!0;return!1}}return!0}replaceWithText(e,t){let n=tp(t||this._getWriterWithQueuedIndentation(),e);if(nL.isSourceFile(this))return this.replaceText([this.getPos(),this.getEnd()],n),this;let r=this.getParentSyntaxList()||this.getParentOrThrow(),i=this.getChildIndex(),o=this.getStart(!0);return nm({parent:r,insertPos:o,newText:n,replacing:{textLength:this.getEnd()-o}}),r.getChildren()[i]}prependWhitespace(e){nF(this,this.getStart(!0),e,eV.nameof(this,"prependWhitespace"))}appendWhitespace(e){nF(this,this.getEnd(),e,eV.nameof(this,"appendWhitespace"))}formatText(e={}){let t=this._context.languageService.getFormattingEditsForRange(this._sourceFile.getFilePath(),[this.getStart(!0),this.getEnd()],e);nC({sourceFile:this._sourceFile,newText:tk(this._sourceFile,t)})}transform(e){let t=this._context.compilerFactory,n=eV.ts.createPrinter({newLine:this._context.manipulationSettings.getNewLineKind(),removeComments:!1}),r=[],i=this._sourceFile.compilerNode,o=this.compilerNode,a=n=>o=>(function n(o,a){let s=e({factory:a.factory,visitChildren:()=>o=eV.ts.visitEachChild(o,e=>n(e,a),a),currentNode:o});return function(e,n){let o;if(e===n&&null==n.emitNode)return;let a=e.getStart(i,!0),s=e.end;for(;(o=r[r.length-1])&&o.start>a;)r.pop();let l=t.getExistingNodeFromCompilerNode(e);r.push({start:a,end:s,compilerNode:n}),null!=l&&(e.kind!==n.kind?l.forget():l.forgetDescendants())}(o,s),s})(o,n);if(this.getKind()===eV.ts.SyntaxKind.SourceFile)return eV.ts.transform(o,[a],this._context.compilerOptions.get()),nC({sourceFile:this._sourceFile,newText:s([0,this.getEnd()])}),this;{let e=this.getParentSyntaxList()||this.getParentOrThrow(),t=this.getChildIndex(),n=this.getStart(!0),r=this.getEnd();return eV.ts.transform(o,[a],this._context.compilerOptions.get()),nm({parent:e,insertPos:n,newText:s([n,r]),replacing:{textLength:r-n}}),e.getChildren()[t]}function s(e){let t=i.getFullText(),o="",a=e[0];for(let e of r)o+=t.substring(a,e.start),o+=n.printNode(eV.ts.EmitHint.Unspecified,e.compilerNode,e.compilerNode.getSourceFile()??i),a=e.end;return o+t.substring(a,e[1])}}getLeadingCommentRanges(){return this.#tu||(this.#tu=this.#th(this.getFullStart(),(e,t)=>{let n=eV.ts.getLeadingCommentRanges(e,t)||[];if(this.getKind()!==eV.SyntaxKind.SingleLineCommentTrivia&&this.getKind()!==eV.SyntaxKind.MultiLineCommentTrivia)return n;{let e=this.getPos();return n.filter(t=>t.pos<e)}}))}getTrailingCommentRanges(){return this.#tp??(this.#tp=this.#th(this.getEnd(),eV.ts.getTrailingCommentRanges))}#th(e,t){return this.getKind()===eV.SyntaxKind.SourceFile?[]:(t(this._sourceFile.getFullText(),e)??[]).map(e=>new nw(e,this._sourceFile))}getChildrenOfKind(e){return this._getCompilerChildrenOfKind(e).map(e=>this._getNodeFromCompilerNode(e))}getFirstChildByKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstChildByKind(e),t??(()=>`A child of the kind ${eV.getSyntaxKindName(e)} was expected.`),this)}getFirstChildByKind(e){let t=this._getCompilerChildrenOfKind(e)[0];return null==t?void 0:this._getNodeFromCompilerNode(t)}getFirstChildIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstChildIfKind(e),t??(()=>`A first child of the kind ${eV.getSyntaxKindName(e)} was expected.`),this)}getFirstChildIfKind(e){let t=this._getCompilerFirstChild();return null!=t&&t.kind===e?this._getNodeFromCompilerNode(t):void 0}getLastChildByKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getLastChildByKind(e),t??(()=>`A child of the kind ${eV.getSyntaxKindName(e)} was expected.`),this)}getLastChildByKind(e){let t=this._getCompilerChildrenOfKind(e),n=t[t.length-1];return this._getNodeFromCompilerNodeIfExists(n)}getLastChildIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getLastChildIfKind(e),t??(()=>`A last child of the kind ${eV.getSyntaxKindName(e)} was expected.`),this)}getLastChildIfKind(e){let t=this._getCompilerLastChild();return null!=t&&t.kind===e?this._getNodeFromCompilerNode(t):void 0}getChildAtIndexIfKindOrThrow(e,t,n){return eV.errors.throwIfNullOrUndefined(this.getChildAtIndexIfKind(e,t),n??(()=>`Child at index ${e} was expected to be ${eV.getSyntaxKindName(t)}`),this)}getChildAtIndexIfKind(e,t){let n=this._getCompilerChildAtIndex(e);return n.kind===t?this._getNodeFromCompilerNode(n):void 0}getPreviousSiblingIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getPreviousSiblingIfKind(e),t??(()=>`A previous sibling of kind ${eV.getSyntaxKindName(e)} was expected.`),this)}getNextSiblingIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getNextSiblingIfKind(e),t??(()=>`A next sibling of kind ${eV.getSyntaxKindName(e)} was expected.`),this)}getPreviousSiblingIfKind(e){let t=this._getCompilerPreviousSibling();return null!=t&&t.kind===e?this._getNodeFromCompilerNode(t):void 0}getNextSiblingIfKind(e){let t=this._getCompilerNextSibling();return null!=t&&t.kind===e?this._getNodeFromCompilerNode(t):void 0}getParentIfOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getParentIf(e),t??"The parent did not match the provided condition.",this)}getParentIf(e){return e(this.getParent(),this)?this.getParent():void 0}getParentIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getParentIfKind(e),t??(()=>`The parent was not a syntax kind of ${eV.getSyntaxKindName(e)}.`),this)}getParentIfKind(e){return this.getParentIf(t=>void 0!==t&&t.getKind()===e)}getFirstAncestorByKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstAncestorByKind(e),t??(()=>`Expected an ancestor with a syntax kind of ${eV.getSyntaxKindName(e)}.`),this)}getFirstAncestorByKind(e){for(let t of this._getAncestorsIterator(e===eV.SyntaxKind.SyntaxList))if(t.getKind()===e)return t}getFirstAncestorOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstAncestor(e),t??"Expected to find an ancestor that matched the provided condition.",this)}getFirstAncestor(e){for(let t of this._getAncestorsIterator(!1))if(null==e||e(t))return t}getDescendantsOfKind(e){let t=[];for(let n of this._getCompilerDescendantsOfKindIterator(e))t.push(this._getNodeFromCompilerNode(n));return t}getFirstDescendantByKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstDescendantByKind(e),t??(()=>`A descendant of kind ${eV.getSyntaxKindName(e)} was expected to be found.`),this)}getFirstDescendantByKind(e){for(let t of this._getCompilerDescendantsOfKindIterator(e))return this._getNodeFromCompilerNode(t)}_getCompilerChildren(){return te.getCompilerChildren(this.compilerNode,this._sourceFile.compilerNode)}_getCompilerForEachChildren(){return te.getCompilerForEachChildren(this.compilerNode,this._sourceFile.compilerNode)}_getCompilerChildrenFast(){return te.hasParsedTokens(this.compilerNode)?this._getCompilerChildren():this._getCompilerForEachChildren()}_getCompilerChildrenOfKind(e){return(nz(this,e)?this._getCompilerForEachChildren():this._getCompilerChildren()).filter(t=>t.kind===e)}*_getCompilerDescendantsOfKindIterator(e){for(let t of nz(this,e)?this._getCompilerForEachChildren():this._getCompilerChildren())for(let n of(t.kind===e&&(yield t),nz(t.kind,e)?nW(t):nB(t,this._sourceFile.compilerNode)))n.kind===e&&(yield n)}_getCompilerDescendantsIterator(){return nB(this.compilerNode,this._sourceFile.compilerNode)}_getCompilerForEachDescendantsIterator(){return nW(this.compilerNode)}_getCompilerFirstChild(e){for(let t of this._getCompilerChildren())if(null==e||e(t))return t}_getCompilerLastChild(e){let t=this._getCompilerChildren();for(let n=t.length-1;n>=0;n--){let r=t[n];if(null==e||e(r))return r}}_getCompilerPreviousSiblings(){let e=this.getParentSyntaxList()||this.getParentOrThrow(),t=[];for(let n of e._getCompilerChildren()){if(n===this.compilerNode)break;t.unshift(n)}return t}_getCompilerNextSiblings(){let e=!1,t=this.getParentSyntaxList()||this.getParentOrThrow(),n=[];for(let r of t._getCompilerChildren()){if(!e){e=r===this.compilerNode;continue}n.push(r)}return n}_getCompilerPreviousSibling(e){for(let t of this._getCompilerPreviousSiblings())if(null==e||e(t))return t}_getCompilerNextSibling(e){for(let t of this._getCompilerNextSiblings())if(null==e||e(t))return t}_getCompilerChildAtIndex(e){let t=this._getCompilerChildren();return eV.errors.throwIfOutOfRange(e,[0,t.length-1],"index"),t[e]}_getWriterWithIndentation(){let e=this._getWriter();return e.setIndentationLevel(this.getIndentationLevel()),e}_getWriterWithQueuedIndentation(){let e=this._getWriter();return e.queueIndentationLevel(this.getIndentationLevel()),e}_getWriterWithChildIndentation(){let e=this._getWriter();return e.setIndentationLevel(this.getChildIndentationLevel()),e}_getWriterWithQueuedChildIndentation(){let e=this._getWriter();return e.queueIndentationLevel(this.getChildIndentationLevel()),e}_getTextWithQueuedChildIndentation(e){let t=this._getWriterWithQueuedChildIndentation();return"string"==typeof e?t.write(e):e(t),t.toString()}_getWriter(){return this._context.createWriter()}_getNodeFromCompilerNode(e){return this._context.compilerFactory.getNodeFromCompilerNode(e,this._sourceFile)}_getNodeFromCompilerNodeIfExists(e){return null==e?void 0:this._getNodeFromCompilerNode(e)}_ensureBound(){null==this.compilerNode.symbol&&this.getSymbol()}static hasExpression(e){return e.getExpression?.()!=null}static hasName(e){return"string"==typeof e.getName?.()}static hasBody(e){return e.getBody?.()!=null}static hasStructure(e){return"function"==typeof e.getStructure}static is(e){return t=>t?.getKind()==e}static isNode(e){return null!=e&&null!=e.compilerNode}static isCommentNode(e){let t=e?.getKind();return t===eV.SyntaxKind.SingleLineCommentTrivia||t===eV.SyntaxKind.MultiLineCommentTrivia}static isCommentStatement(e){return e?.compilerNode?._commentKind===t.CommentNodeKind.Statement}static isCommentClassElement(e){return e?.compilerNode?._commentKind===t.CommentNodeKind.ClassElement}static isCommentTypeElement(e){return e?.compilerNode?._commentKind===t.CommentNodeKind.TypeElement}static isCommentObjectLiteralElement(e){return e?.compilerNode?._commentKind===t.CommentNodeKind.ObjectLiteralElement}static isCommentEnumMember(e){return e?.compilerNode?._commentKind==t.CommentNodeKind.EnumMember}static isAbstractable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.ConstructorType:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isAmbientable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.VariableStatement:return!0;default:return!1}}static isAnyKeyword=nL.is(eV.SyntaxKind.AnyKeyword);static isArgumented(e){switch(e?.getKind()){case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.NewExpression:return!0;default:return!1}}static isArrayBindingPattern=nL.is(eV.SyntaxKind.ArrayBindingPattern);static isArrayLiteralExpression=nL.is(eV.SyntaxKind.ArrayLiteralExpression);static isArrayTypeNode(e){return e?.getKind()===eV.SyntaxKind.ArrayType}static isArrowFunction=nL.is(eV.SyntaxKind.ArrowFunction);static isAsExpression=nL.is(eV.SyntaxKind.AsExpression);static isAsyncable(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.MethodDeclaration:return!0;default:return!1}}static isAwaitable(e){return e?.getKind()===eV.SyntaxKind.ForOfStatement}static isAwaitExpression=nL.is(eV.SyntaxKind.AwaitExpression);static isBigIntLiteral=nL.is(eV.SyntaxKind.BigIntLiteral);static isBinaryExpression=nL.is(eV.SyntaxKind.BinaryExpression);static isBindingElement=nL.is(eV.SyntaxKind.BindingElement);static isBindingNamed(e){switch(e?.getKind()){case eV.SyntaxKind.BindingElement:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.VariableDeclaration:return!0;default:return!1}}static isBlock=nL.is(eV.SyntaxKind.Block);static isBodied(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.ClassStaticBlockDeclaration:case eV.SyntaxKind.FunctionExpression:return!0;default:return!1}}static isBodyable(e){switch(e?.getKind()){case eV.SyntaxKind.Constructor:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isBooleanKeyword=nL.is(eV.SyntaxKind.BooleanKeyword);static isBreakStatement=nL.is(eV.SyntaxKind.BreakStatement);static isCallExpression=nL.is(eV.SyntaxKind.CallExpression);static isCallSignatureDeclaration(e){return e?.getKind()===eV.SyntaxKind.CallSignature}static isCaseBlock=nL.is(eV.SyntaxKind.CaseBlock);static isCaseClause=nL.is(eV.SyntaxKind.CaseClause);static isCatchClause=nL.is(eV.SyntaxKind.CatchClause);static isChildOrderable(e){switch(e?.getKind()){case eV.SyntaxKind.Block:case eV.SyntaxKind.BreakStatement:case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassStaticBlockDeclaration:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.ContinueStatement:case eV.SyntaxKind.DebuggerStatement:case eV.SyntaxKind.DoStatement:case eV.SyntaxKind.EmptyStatement:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.ExportAssignment:case eV.SyntaxKind.ExportDeclaration:case eV.SyntaxKind.ExpressionStatement:case eV.SyntaxKind.ForInStatement:case eV.SyntaxKind.ForOfStatement:case eV.SyntaxKind.ForStatement:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.IfStatement:case eV.SyntaxKind.ImportDeclaration:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.IndexSignature:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.LabeledStatement:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.ModuleBlock:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.NotEmittedStatement:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.ReturnStatement:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.SwitchStatement:case eV.SyntaxKind.ThrowStatement:case eV.SyntaxKind.TryStatement:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.VariableStatement:case eV.SyntaxKind.WhileStatement:case eV.SyntaxKind.WithStatement:return!0;default:return!1}}static isClassDeclaration=nL.is(eV.SyntaxKind.ClassDeclaration);static isClassExpression=nL.is(eV.SyntaxKind.ClassExpression);static isClassLikeDeclarationBase(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:return!0;default:return!1}}static isClassStaticBlockDeclaration=nL.is(eV.SyntaxKind.ClassStaticBlockDeclaration);static isCommaListExpression=nL.is(eV.SyntaxKind.CommaListExpression);static isComputedPropertyName=nL.is(eV.SyntaxKind.ComputedPropertyName);static isConditionalExpression=nL.is(eV.SyntaxKind.ConditionalExpression);static isConditionalTypeNode(e){return e?.getKind()===eV.SyntaxKind.ConditionalType}static isConstructorDeclaration(e){return e?.getKind()===eV.SyntaxKind.Constructor}static isConstructorTypeNode(e){return e?.getKind()===eV.SyntaxKind.ConstructorType}static isConstructSignatureDeclaration(e){return e?.getKind()===eV.SyntaxKind.ConstructSignature}static isContinueStatement=nL.is(eV.SyntaxKind.ContinueStatement);static isDebuggerStatement=nL.is(eV.SyntaxKind.DebuggerStatement);static isDecoratable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isDecorator=nL.is(eV.SyntaxKind.Decorator);static isDefaultClause=nL.is(eV.SyntaxKind.DefaultClause);static isDeleteExpression=nL.is(eV.SyntaxKind.DeleteExpression);static isDoStatement=nL.is(eV.SyntaxKind.DoStatement);static isDotDotDotTokenable(e){switch(e?.getKind()){case eV.SyntaxKind.BindingElement:case eV.SyntaxKind.JsxExpression:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.Parameter:return!0;default:return!1}}static isElementAccessExpression=nL.is(eV.SyntaxKind.ElementAccessExpression);static isEmptyStatement=nL.is(eV.SyntaxKind.EmptyStatement);static isEnumDeclaration=nL.is(eV.SyntaxKind.EnumDeclaration);static isEnumMember=nL.is(eV.SyntaxKind.EnumMember);static isExclamationTokenable(e){switch(e?.getKind()){case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.VariableDeclaration:return!0;default:return!1}}static isExportable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.VariableStatement:return!0;default:return!1}}static isExportAssignment=nL.is(eV.SyntaxKind.ExportAssignment);static isExportDeclaration=nL.is(eV.SyntaxKind.ExportDeclaration);static isExportGetable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.VariableDeclaration:case eV.SyntaxKind.VariableStatement:return!0;default:return!1}}static isExportSpecifier=nL.is(eV.SyntaxKind.ExportSpecifier);static isExpression(e){switch(e?.getKind()){case eV.SyntaxKind.AnyKeyword:case eV.SyntaxKind.BooleanKeyword:case eV.SyntaxKind.NumberKeyword:case eV.SyntaxKind.ObjectKeyword:case eV.SyntaxKind.StringKeyword:case eV.SyntaxKind.SymbolKeyword:case eV.SyntaxKind.UndefinedKeyword:case eV.SyntaxKind.ArrayLiteralExpression:case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.AsExpression:case eV.SyntaxKind.AwaitExpression:case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.BinaryExpression:case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.CommaListExpression:case eV.SyntaxKind.ConditionalExpression:case eV.SyntaxKind.DeleteExpression:case eV.SyntaxKind.ElementAccessExpression:case eV.SyntaxKind.FalseKeyword:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportKeyword:case eV.SyntaxKind.JsxClosingFragment:case eV.SyntaxKind.JsxElement:case eV.SyntaxKind.JsxExpression:case eV.SyntaxKind.JsxFragment:case eV.SyntaxKind.JsxOpeningElement:case eV.SyntaxKind.JsxOpeningFragment:case eV.SyntaxKind.JsxSelfClosingElement:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.NonNullExpression:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NullKeyword:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.ObjectLiteralExpression:case eV.SyntaxKind.OmittedExpression:case eV.SyntaxKind.ParenthesizedExpression:case eV.SyntaxKind.PartiallyEmittedExpression:case eV.SyntaxKind.PostfixUnaryExpression:case eV.SyntaxKind.PrefixUnaryExpression:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.SatisfiesExpression:case eV.SyntaxKind.SpreadElement:case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.SuperKeyword:case eV.SyntaxKind.TaggedTemplateExpression:case eV.SyntaxKind.TemplateExpression:case eV.SyntaxKind.ThisKeyword:case eV.SyntaxKind.TrueKeyword:case eV.SyntaxKind.TypeAssertionExpression:case eV.SyntaxKind.TypeOfExpression:case eV.SyntaxKind.VoidExpression:case eV.SyntaxKind.YieldExpression:return!0;default:return!1}}static isExpressionable(e){switch(e?.getKind()){case eV.SyntaxKind.ExternalModuleReference:case eV.SyntaxKind.JsxExpression:case eV.SyntaxKind.ReturnStatement:case eV.SyntaxKind.YieldExpression:return!0;default:return!1}}static isExpressioned(e){switch(e?.getKind()){case eV.SyntaxKind.AsExpression:case eV.SyntaxKind.CaseClause:case eV.SyntaxKind.ComputedPropertyName:case eV.SyntaxKind.DoStatement:case eV.SyntaxKind.ExportAssignment:case eV.SyntaxKind.ExpressionStatement:case eV.SyntaxKind.ForInStatement:case eV.SyntaxKind.ForOfStatement:case eV.SyntaxKind.IfStatement:case eV.SyntaxKind.JsxSpreadAttribute:case eV.SyntaxKind.NonNullExpression:case eV.SyntaxKind.ParenthesizedExpression:case eV.SyntaxKind.PartiallyEmittedExpression:case eV.SyntaxKind.SatisfiesExpression:case eV.SyntaxKind.SpreadAssignment:case eV.SyntaxKind.SpreadElement:case eV.SyntaxKind.SwitchStatement:case eV.SyntaxKind.TemplateSpan:case eV.SyntaxKind.ThrowStatement:case eV.SyntaxKind.WhileStatement:case eV.SyntaxKind.WithStatement:return!0;default:return!1}}static isExpressionStatement=nL.is(eV.SyntaxKind.ExpressionStatement);static isExpressionWithTypeArguments=nL.is(eV.SyntaxKind.ExpressionWithTypeArguments);static isExtendsClauseable(e){return e?.getKind()===eV.SyntaxKind.InterfaceDeclaration}static isExternalModuleReference=nL.is(eV.SyntaxKind.ExternalModuleReference);static isFalseLiteral(e){return e?.getKind()===eV.SyntaxKind.FalseKeyword}static isForInStatement=nL.is(eV.SyntaxKind.ForInStatement);static isForOfStatement=nL.is(eV.SyntaxKind.ForOfStatement);static isForStatement=nL.is(eV.SyntaxKind.ForStatement);static isFunctionDeclaration=nL.is(eV.SyntaxKind.FunctionDeclaration);static isFunctionExpression=nL.is(eV.SyntaxKind.FunctionExpression);static isFunctionLikeDeclaration(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isFunctionTypeNode(e){return e?.getKind()===eV.SyntaxKind.FunctionType}static isGeneratorable(e){switch(e?.getKind()){case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.YieldExpression:return!0;default:return!1}}static isGetAccessorDeclaration(e){return e?.getKind()===eV.SyntaxKind.GetAccessor}static isHeritageClause=nL.is(eV.SyntaxKind.HeritageClause);static isHeritageClauseable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.InterfaceDeclaration:return!0;default:return!1}}static isIdentifier=nL.is(eV.SyntaxKind.Identifier);static isIfStatement=nL.is(eV.SyntaxKind.IfStatement);static isImplementsClauseable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:return!0;default:return!1}}static isImportAttribute=nL.is(eV.SyntaxKind.ImportAttribute);static isImportAttributeNamed(e){return e?.getKind()===eV.SyntaxKind.ImportAttribute}static isImportAttributes=nL.is(eV.SyntaxKind.ImportAttributes);static isImportClause=nL.is(eV.SyntaxKind.ImportClause);static isImportDeclaration=nL.is(eV.SyntaxKind.ImportDeclaration);static isImportEqualsDeclaration=nL.is(eV.SyntaxKind.ImportEqualsDeclaration);static isImportExpression(e){return e?.getKind()===eV.SyntaxKind.ImportKeyword}static isImportSpecifier=nL.is(eV.SyntaxKind.ImportSpecifier);static isImportTypeNode(e){return e?.getKind()===eV.SyntaxKind.ImportType}static isIndexedAccessTypeNode(e){return e?.getKind()===eV.SyntaxKind.IndexedAccessType}static isIndexSignatureDeclaration(e){return e?.getKind()===eV.SyntaxKind.IndexSignature}static isInferKeyword=nL.is(eV.SyntaxKind.InferKeyword);static isInferTypeNode(e){return e?.getKind()===eV.SyntaxKind.InferType}static isInitializerExpressionable(e){switch(e?.getKind()){case eV.SyntaxKind.BindingElement:case eV.SyntaxKind.EnumMember:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.VariableDeclaration:return!0;default:return!1}}static isInitializerExpressionGetable(e){switch(e?.getKind()){case eV.SyntaxKind.BindingElement:case eV.SyntaxKind.EnumMember:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyAssignment:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.ShorthandPropertyAssignment:case eV.SyntaxKind.VariableDeclaration:return!0;default:return!1}}static isInterfaceDeclaration=nL.is(eV.SyntaxKind.InterfaceDeclaration);static isIntersectionTypeNode(e){return e?.getKind()===eV.SyntaxKind.IntersectionType}static isIterationStatement(e){switch(e?.getKind()){case eV.SyntaxKind.DoStatement:case eV.SyntaxKind.ForInStatement:case eV.SyntaxKind.ForOfStatement:case eV.SyntaxKind.ForStatement:case eV.SyntaxKind.WhileStatement:return!0;default:return!1}}static isJSDoc=nL.is(eV.SyntaxKind.JSDoc);static isJSDocable(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.CaseClause:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.ClassStaticBlockDeclaration:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.EnumMember:case eV.SyntaxKind.ExportAssignment:case eV.SyntaxKind.ExpressionStatement:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.IndexSignature:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.LabeledStatement:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.VariableStatement:return!0;default:return!1}}static isJSDocAllType=nL.is(eV.SyntaxKind.JSDocAllType);static isJSDocAugmentsTag=nL.is(eV.SyntaxKind.JSDocAugmentsTag);static isJSDocAuthorTag=nL.is(eV.SyntaxKind.JSDocAuthorTag);static isJSDocCallbackTag=nL.is(eV.SyntaxKind.JSDocCallbackTag);static isJSDocClassTag=nL.is(eV.SyntaxKind.JSDocClassTag);static isJSDocDeprecatedTag=nL.is(eV.SyntaxKind.JSDocDeprecatedTag);static isJSDocEnumTag=nL.is(eV.SyntaxKind.JSDocEnumTag);static isJSDocFunctionType=nL.is(eV.SyntaxKind.JSDocFunctionType);static isJSDocImplementsTag=nL.is(eV.SyntaxKind.JSDocImplementsTag);static isJSDocLink=nL.is(eV.SyntaxKind.JSDocLink);static isJSDocLinkCode=nL.is(eV.SyntaxKind.JSDocLinkCode);static isJSDocLinkPlain=nL.is(eV.SyntaxKind.JSDocLinkPlain);static isJSDocMemberName=nL.is(eV.SyntaxKind.JSDocMemberName);static isJSDocNamepathType=nL.is(eV.SyntaxKind.JSDocNamepathType);static isJSDocNameReference=nL.is(eV.SyntaxKind.JSDocNameReference);static isJSDocNonNullableType=nL.is(eV.SyntaxKind.JSDocNonNullableType);static isJSDocNullableType=nL.is(eV.SyntaxKind.JSDocNullableType);static isJSDocOptionalType=nL.is(eV.SyntaxKind.JSDocOptionalType);static isJSDocOverloadTag=nL.is(eV.SyntaxKind.JSDocOverloadTag);static isJSDocOverrideTag=nL.is(eV.SyntaxKind.JSDocOverrideTag);static isJSDocParameterTag=nL.is(eV.SyntaxKind.JSDocParameterTag);static isJSDocPrivateTag=nL.is(eV.SyntaxKind.JSDocPrivateTag);static isJSDocPropertyLikeTag(e){switch(e?.getKind()){case eV.SyntaxKind.JSDocParameterTag:case eV.SyntaxKind.JSDocPropertyTag:return!0;default:return!1}}static isJSDocPropertyTag=nL.is(eV.SyntaxKind.JSDocPropertyTag);static isJSDocProtectedTag=nL.is(eV.SyntaxKind.JSDocProtectedTag);static isJSDocPublicTag=nL.is(eV.SyntaxKind.JSDocPublicTag);static isJSDocReadonlyTag=nL.is(eV.SyntaxKind.JSDocReadonlyTag);static isJSDocReturnTag=nL.is(eV.SyntaxKind.JSDocReturnTag);static isJSDocSatisfiesTag=nL.is(eV.SyntaxKind.JSDocSatisfiesTag);static isJSDocSeeTag=nL.is(eV.SyntaxKind.JSDocSeeTag);static isJSDocSignature=nL.is(eV.SyntaxKind.JSDocSignature);static isJSDocTag(e){switch(e?.getKind()){case eV.SyntaxKind.JSDocAugmentsTag:case eV.SyntaxKind.JSDocAuthorTag:case eV.SyntaxKind.JSDocCallbackTag:case eV.SyntaxKind.JSDocClassTag:case eV.SyntaxKind.JSDocDeprecatedTag:case eV.SyntaxKind.JSDocEnumTag:case eV.SyntaxKind.JSDocImplementsTag:case eV.SyntaxKind.JSDocOverloadTag:case eV.SyntaxKind.JSDocOverrideTag:case eV.SyntaxKind.JSDocParameterTag:case eV.SyntaxKind.JSDocPrivateTag:case eV.SyntaxKind.JSDocPropertyTag:case eV.SyntaxKind.JSDocProtectedTag:case eV.SyntaxKind.JSDocPublicTag:case eV.SyntaxKind.JSDocReadonlyTag:case eV.SyntaxKind.JSDocReturnTag:case eV.SyntaxKind.JSDocSatisfiesTag:case eV.SyntaxKind.JSDocSeeTag:case eV.SyntaxKind.JSDocTemplateTag:case eV.SyntaxKind.JSDocThisTag:case eV.SyntaxKind.JSDocThrowsTag:case eV.SyntaxKind.JSDocTypedefTag:case eV.SyntaxKind.JSDocTypeTag:case eV.SyntaxKind.JSDocTag:return!0;default:return!1}}static isJSDocTemplateTag=nL.is(eV.SyntaxKind.JSDocTemplateTag);static isJSDocText=nL.is(eV.SyntaxKind.JSDocText);static isJSDocThisTag=nL.is(eV.SyntaxKind.JSDocThisTag);static isJSDocThrowsTag=nL.is(eV.SyntaxKind.JSDocThrowsTag);static isJSDocType(e){switch(e?.getKind()){case eV.SyntaxKind.JSDocAllType:case eV.SyntaxKind.JSDocFunctionType:case eV.SyntaxKind.JSDocNamepathType:case eV.SyntaxKind.JSDocNonNullableType:case eV.SyntaxKind.JSDocNullableType:case eV.SyntaxKind.JSDocOptionalType:case eV.SyntaxKind.JSDocSignature:case eV.SyntaxKind.JSDocTypeLiteral:case eV.SyntaxKind.JSDocUnknownType:case eV.SyntaxKind.JSDocVariadicType:return!0;default:return!1}}static isJSDocTypedefTag=nL.is(eV.SyntaxKind.JSDocTypedefTag);static isJSDocTypeExpression=nL.is(eV.SyntaxKind.JSDocTypeExpression);static isJSDocTypeExpressionableTag(e){switch(e?.getKind()){case eV.SyntaxKind.JSDocOverloadTag:case eV.SyntaxKind.JSDocReturnTag:case eV.SyntaxKind.JSDocSatisfiesTag:case eV.SyntaxKind.JSDocSeeTag:case eV.SyntaxKind.JSDocThisTag:case eV.SyntaxKind.JSDocThrowsTag:return!0;default:return!1}}static isJSDocTypeLiteral=nL.is(eV.SyntaxKind.JSDocTypeLiteral);static isJSDocTypeParameteredTag(e){return e?.getKind()===eV.SyntaxKind.JSDocTemplateTag}static isJSDocTypeTag=nL.is(eV.SyntaxKind.JSDocTypeTag);static isJSDocUnknownTag(e){return e?.getKind()===eV.SyntaxKind.JSDocTag}static isJSDocUnknownType=nL.is(eV.SyntaxKind.JSDocUnknownType);static isJSDocVariadicType=nL.is(eV.SyntaxKind.JSDocVariadicType);static isJsxAttribute=nL.is(eV.SyntaxKind.JsxAttribute);static isJsxAttributed(e){switch(e?.getKind()){case eV.SyntaxKind.JsxOpeningElement:case eV.SyntaxKind.JsxSelfClosingElement:return!0;default:return!1}}static isJsxClosingElement=nL.is(eV.SyntaxKind.JsxClosingElement);static isJsxClosingFragment=nL.is(eV.SyntaxKind.JsxClosingFragment);static isJsxElement=nL.is(eV.SyntaxKind.JsxElement);static isJsxExpression=nL.is(eV.SyntaxKind.JsxExpression);static isJsxFragment=nL.is(eV.SyntaxKind.JsxFragment);static isJsxNamespacedName=nL.is(eV.SyntaxKind.JsxNamespacedName);static isJsxOpeningElement=nL.is(eV.SyntaxKind.JsxOpeningElement);static isJsxOpeningFragment=nL.is(eV.SyntaxKind.JsxOpeningFragment);static isJsxSelfClosingElement=nL.is(eV.SyntaxKind.JsxSelfClosingElement);static isJsxSpreadAttribute=nL.is(eV.SyntaxKind.JsxSpreadAttribute);static isJsxTagNamed(e){switch(e?.getKind()){case eV.SyntaxKind.JsxClosingElement:case eV.SyntaxKind.JsxOpeningElement:case eV.SyntaxKind.JsxSelfClosingElement:return!0;default:return!1}}static isJsxText=nL.is(eV.SyntaxKind.JsxText);static isLabeledStatement=nL.is(eV.SyntaxKind.LabeledStatement);static isLeftHandSideExpression(e){switch(e?.getKind()){case eV.SyntaxKind.ArrayLiteralExpression:case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.ElementAccessExpression:case eV.SyntaxKind.FalseKeyword:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportKeyword:case eV.SyntaxKind.JsxElement:case eV.SyntaxKind.JsxFragment:case eV.SyntaxKind.JsxSelfClosingElement:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.NonNullExpression:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NullKeyword:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.ObjectLiteralExpression:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.SuperKeyword:case eV.SyntaxKind.TaggedTemplateExpression:case eV.SyntaxKind.TemplateExpression:case eV.SyntaxKind.ThisKeyword:case eV.SyntaxKind.TrueKeyword:return!0;default:return!1}}static isLeftHandSideExpressioned(e){switch(e?.getKind()){case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.Decorator:case eV.SyntaxKind.ElementAccessExpression:case eV.SyntaxKind.ExpressionWithTypeArguments:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.PropertyAccessExpression:return!0;default:return!1}}static isLiteralExpression(e){switch(e?.getKind()){case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.StringLiteral:return!0;default:return!1}}static isLiteralLike(e){switch(e?.getKind()){case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.JsxText:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.TemplateHead:case eV.SyntaxKind.TemplateMiddle:case eV.SyntaxKind.TemplateTail:return!0;default:return!1}}static isLiteralTypeNode(e){return e?.getKind()===eV.SyntaxKind.LiteralType}static isMappedTypeNode(e){return e?.getKind()===eV.SyntaxKind.MappedType}static isMemberExpression(e){switch(e?.getKind()){case eV.SyntaxKind.ArrayLiteralExpression:case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.ElementAccessExpression:case eV.SyntaxKind.FalseKeyword:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportKeyword:case eV.SyntaxKind.JsxElement:case eV.SyntaxKind.JsxFragment:case eV.SyntaxKind.JsxSelfClosingElement:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NullKeyword:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.ObjectLiteralExpression:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.SuperKeyword:case eV.SyntaxKind.TaggedTemplateExpression:case eV.SyntaxKind.TemplateExpression:case eV.SyntaxKind.ThisKeyword:case eV.SyntaxKind.TrueKeyword:return!0;default:return!1}}static isMetaProperty=nL.is(eV.SyntaxKind.MetaProperty);static isMethodDeclaration=nL.is(eV.SyntaxKind.MethodDeclaration);static isMethodSignature=nL.is(eV.SyntaxKind.MethodSignature);static isModifierable(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructorType:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.IndexSignature:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.TypeParameter:case eV.SyntaxKind.VariableDeclarationList:case eV.SyntaxKind.VariableStatement:return!0;default:return!1}}static isModuleBlock=nL.is(eV.SyntaxKind.ModuleBlock);static isModuleChildable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.VariableStatement:return!0;default:return!1}}static isModuleDeclaration=nL.is(eV.SyntaxKind.ModuleDeclaration);static isModuled(e){switch(e?.getKind()){case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.SourceFile:return!0;default:return!1}}static isModuleNamed(e){return e?.getKind()===eV.SyntaxKind.ModuleDeclaration}static isNameable(e){switch(e?.getKind()){case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:return!0;default:return!1}}static isNamedExports=nL.is(eV.SyntaxKind.NamedExports);static isNamedImports=nL.is(eV.SyntaxKind.NamedImports);static isNamed(e){switch(e?.getKind()){case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.ShorthandPropertyAssignment:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.TypeParameter:return!0;default:return!1}}static isNamedTupleMember=nL.is(eV.SyntaxKind.NamedTupleMember);static isNamespaceExport=nL.is(eV.SyntaxKind.NamespaceExport);static isNamespaceImport=nL.is(eV.SyntaxKind.NamespaceImport);static isNeverKeyword=nL.is(eV.SyntaxKind.NeverKeyword);static isNewExpression=nL.is(eV.SyntaxKind.NewExpression);static isNodeWithTypeArguments(e){switch(e?.getKind()){case eV.SyntaxKind.ExpressionWithTypeArguments:case eV.SyntaxKind.ImportType:case eV.SyntaxKind.TypeQuery:case eV.SyntaxKind.TypeReference:return!0;default:return!1}}static isNonNullExpression=nL.is(eV.SyntaxKind.NonNullExpression);static isNoSubstitutionTemplateLiteral=nL.is(eV.SyntaxKind.NoSubstitutionTemplateLiteral);static isNotEmittedStatement=nL.is(eV.SyntaxKind.NotEmittedStatement);static isNullLiteral(e){return e?.getKind()===eV.SyntaxKind.NullKeyword}static isNumberKeyword=nL.is(eV.SyntaxKind.NumberKeyword);static isNumericLiteral=nL.is(eV.SyntaxKind.NumericLiteral);static isObjectBindingPattern=nL.is(eV.SyntaxKind.ObjectBindingPattern);static isObjectKeyword=nL.is(eV.SyntaxKind.ObjectKeyword);static isObjectLiteralExpression=nL.is(eV.SyntaxKind.ObjectLiteralExpression);static isOmittedExpression=nL.is(eV.SyntaxKind.OmittedExpression);static isOverloadable(e){switch(e?.getKind()){case eV.SyntaxKind.Constructor:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.MethodDeclaration:return!0;default:return!1}}static isOverrideable(e){switch(e?.getKind()){case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyDeclaration:return!0;default:return!1}}static isParameterDeclaration(e){return e?.getKind()===eV.SyntaxKind.Parameter}static isParametered(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructorType:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.FunctionType:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.JSDocFunctionType:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isParenthesizedExpression=nL.is(eV.SyntaxKind.ParenthesizedExpression);static isParenthesizedTypeNode(e){return e?.getKind()===eV.SyntaxKind.ParenthesizedType}static isPartiallyEmittedExpression=nL.is(eV.SyntaxKind.PartiallyEmittedExpression);static isPostfixUnaryExpression=nL.is(eV.SyntaxKind.PostfixUnaryExpression);static isPrefixUnaryExpression=nL.is(eV.SyntaxKind.PrefixUnaryExpression);static isPrimaryExpression(e){switch(e?.getKind()){case eV.SyntaxKind.ArrayLiteralExpression:case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.FalseKeyword:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportKeyword:case eV.SyntaxKind.JsxElement:case eV.SyntaxKind.JsxFragment:case eV.SyntaxKind.JsxSelfClosingElement:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NullKeyword:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.ObjectLiteralExpression:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.SuperKeyword:case eV.SyntaxKind.TemplateExpression:case eV.SyntaxKind.ThisKeyword:case eV.SyntaxKind.TrueKeyword:return!0;default:return!1}}static isPrivateIdentifier=nL.is(eV.SyntaxKind.PrivateIdentifier);static isPropertyAccessExpression=nL.is(eV.SyntaxKind.PropertyAccessExpression);static isPropertyAssignment=nL.is(eV.SyntaxKind.PropertyAssignment);static isPropertyDeclaration=nL.is(eV.SyntaxKind.PropertyDeclaration);static isPropertyNamed(e){switch(e?.getKind()){case eV.SyntaxKind.EnumMember:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.PropertyAssignment:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isPropertySignature=nL.is(eV.SyntaxKind.PropertySignature);static isQualifiedName=nL.is(eV.SyntaxKind.QualifiedName);static isQuestionDotTokenable(e){switch(e?.getKind()){case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.ElementAccessExpression:case eV.SyntaxKind.PropertyAccessExpression:return!0;default:return!1}}static isQuestionTokenable(e){switch(e?.getKind()){case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyAssignment:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.ShorthandPropertyAssignment:return!0;default:return!1}}static isReadonlyable(e){switch(e?.getKind()){case eV.SyntaxKind.IndexSignature:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:return!0;default:return!1}}static isReferenceFindable(e){switch(e?.getKind()){case eV.SyntaxKind.BindingElement:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.EnumMember:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportAttribute:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PrivateIdentifier:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.PropertyAssignment:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.ShorthandPropertyAssignment:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.TypeParameter:case eV.SyntaxKind.VariableDeclaration:return!0;default:return!1}}static isRegularExpressionLiteral=nL.is(eV.SyntaxKind.RegularExpressionLiteral);static isRenameable(e){switch(e?.getKind()){case eV.SyntaxKind.BindingElement:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.EnumMember:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportAttribute:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.NamespaceExport:case eV.SyntaxKind.NamespaceImport:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PrivateIdentifier:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.PropertyAssignment:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.ShorthandPropertyAssignment:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.TypeParameter:case eV.SyntaxKind.VariableDeclaration:return!0;default:return!1}}static isRestTypeNode(e){return e?.getKind()===eV.SyntaxKind.RestType}static isReturnStatement=nL.is(eV.SyntaxKind.ReturnStatement);static isReturnTyped(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructorType:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.FunctionType:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.IndexSignature:case eV.SyntaxKind.JSDocFunctionType:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isSatisfiesExpression=nL.is(eV.SyntaxKind.SatisfiesExpression);static isScopeable(e){return e?.getKind()===eV.SyntaxKind.Parameter}static isScoped(e){switch(e?.getKind()){case eV.SyntaxKind.Constructor:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isSemicolonToken=nL.is(eV.SyntaxKind.SemicolonToken);static isSetAccessorDeclaration(e){return e?.getKind()===eV.SyntaxKind.SetAccessor}static isShorthandPropertyAssignment=nL.is(eV.SyntaxKind.ShorthandPropertyAssignment);static isSignaturedDeclaration(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructorType:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.FunctionType:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.JSDocFunctionType:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isSourceFile=nL.is(eV.SyntaxKind.SourceFile);static isSpreadAssignment=nL.is(eV.SyntaxKind.SpreadAssignment);static isSpreadElement=nL.is(eV.SyntaxKind.SpreadElement);static isStatement(e){switch(e?.getKind()){case eV.SyntaxKind.Block:case eV.SyntaxKind.BreakStatement:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ContinueStatement:case eV.SyntaxKind.DebuggerStatement:case eV.SyntaxKind.DoStatement:case eV.SyntaxKind.EmptyStatement:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.ExportAssignment:case eV.SyntaxKind.ExportDeclaration:case eV.SyntaxKind.ExpressionStatement:case eV.SyntaxKind.ForInStatement:case eV.SyntaxKind.ForOfStatement:case eV.SyntaxKind.ForStatement:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.IfStatement:case eV.SyntaxKind.ImportDeclaration:case eV.SyntaxKind.ImportEqualsDeclaration:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.LabeledStatement:case eV.SyntaxKind.ModuleBlock:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.NotEmittedStatement:case eV.SyntaxKind.ReturnStatement:case eV.SyntaxKind.SwitchStatement:case eV.SyntaxKind.ThrowStatement:case eV.SyntaxKind.TryStatement:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.VariableStatement:case eV.SyntaxKind.WhileStatement:case eV.SyntaxKind.WithStatement:return!0;default:return!1}}static isStatemented(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.Block:case eV.SyntaxKind.CaseClause:case eV.SyntaxKind.ClassStaticBlockDeclaration:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.DefaultClause:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.ModuleBlock:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.SourceFile:return!0;default:return!1}}static isStaticable(e){switch(e?.getKind()){case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.SetAccessor:return!0;default:return!1}}static isStringKeyword=nL.is(eV.SyntaxKind.StringKeyword);static isStringLiteral=nL.is(eV.SyntaxKind.StringLiteral);static isSuperExpression(e){return e?.getKind()===eV.SyntaxKind.SuperKeyword}static isSwitchStatement=nL.is(eV.SyntaxKind.SwitchStatement);static isSymbolKeyword=nL.is(eV.SyntaxKind.SymbolKeyword);static isSyntaxList=nL.is(eV.SyntaxKind.SyntaxList);static isTaggedTemplateExpression=nL.is(eV.SyntaxKind.TaggedTemplateExpression);static isTemplateExpression=nL.is(eV.SyntaxKind.TemplateExpression);static isTemplateHead=nL.is(eV.SyntaxKind.TemplateHead);static isTemplateLiteralTypeNode(e){return e?.getKind()===eV.SyntaxKind.TemplateLiteralType}static isTemplateMiddle=nL.is(eV.SyntaxKind.TemplateMiddle);static isTemplateSpan=nL.is(eV.SyntaxKind.TemplateSpan);static isTemplateTail=nL.is(eV.SyntaxKind.TemplateTail);static isTextInsertable(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.Block:case eV.SyntaxKind.CaseBlock:case eV.SyntaxKind.CaseClause:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.ClassStaticBlockDeclaration:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.DefaultClause:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.SourceFile:return!0;default:return!1}}static isThisExpression(e){return e?.getKind()===eV.SyntaxKind.ThisKeyword}static isThisTypeNode(e){return e?.getKind()===eV.SyntaxKind.ThisType}static isThrowStatement=nL.is(eV.SyntaxKind.ThrowStatement);static isTrueLiteral(e){return e?.getKind()===eV.SyntaxKind.TrueKeyword}static isTryStatement=nL.is(eV.SyntaxKind.TryStatement);static isTupleTypeNode(e){return e?.getKind()===eV.SyntaxKind.TupleType}static isTypeAliasDeclaration=nL.is(eV.SyntaxKind.TypeAliasDeclaration);static isTypeArgumented(e){switch(e?.getKind()){case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.ExpressionWithTypeArguments:case eV.SyntaxKind.ImportType:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.TypeQuery:case eV.SyntaxKind.TypeReference:return!0;default:return!1}}static isTypeAssertion(e){return e?.getKind()===eV.SyntaxKind.TypeAssertionExpression}static isTyped(e){switch(e?.getKind()){case eV.SyntaxKind.AsExpression:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.SatisfiesExpression:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.TypeAssertionExpression:case eV.SyntaxKind.VariableDeclaration:return!0;default:return!1}}static isTypeElement(e){switch(e?.getKind()){case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.IndexSignature:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.PropertySignature:return!0;default:return!1}}static isTypeElementMembered(e){switch(e?.getKind()){case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.TypeLiteral:return!0;default:return!1}}static isTypeLiteral(e){return e?.getKind()===eV.SyntaxKind.TypeLiteral}static isTypeNode(e){switch(e?.getKind()){case eV.SyntaxKind.ArrayType:case eV.SyntaxKind.ConditionalType:case eV.SyntaxKind.ConstructorType:case eV.SyntaxKind.ExpressionWithTypeArguments:case eV.SyntaxKind.FunctionType:case eV.SyntaxKind.ImportType:case eV.SyntaxKind.IndexedAccessType:case eV.SyntaxKind.InferType:case eV.SyntaxKind.IntersectionType:case eV.SyntaxKind.JSDocAllType:case eV.SyntaxKind.JSDocFunctionType:case eV.SyntaxKind.JSDocNamepathType:case eV.SyntaxKind.JSDocNonNullableType:case eV.SyntaxKind.JSDocNullableType:case eV.SyntaxKind.JSDocOptionalType:case eV.SyntaxKind.JSDocSignature:case eV.SyntaxKind.JSDocTypeExpression:case eV.SyntaxKind.JSDocTypeLiteral:case eV.SyntaxKind.JSDocUnknownType:case eV.SyntaxKind.JSDocVariadicType:case eV.SyntaxKind.LiteralType:case eV.SyntaxKind.MappedType:case eV.SyntaxKind.NamedTupleMember:case eV.SyntaxKind.ParenthesizedType:case eV.SyntaxKind.RestType:case eV.SyntaxKind.TemplateLiteralType:case eV.SyntaxKind.ThisType:case eV.SyntaxKind.TupleType:case eV.SyntaxKind.TypeLiteral:case eV.SyntaxKind.TypeOperator:case eV.SyntaxKind.TypePredicate:case eV.SyntaxKind.TypeQuery:case eV.SyntaxKind.TypeReference:case eV.SyntaxKind.UnionType:return!0;default:return!1}}static isTypeOfExpression=nL.is(eV.SyntaxKind.TypeOfExpression);static isTypeOperatorTypeNode(e){return e?.getKind()===eV.SyntaxKind.TypeOperator}static isTypeParameterDeclaration(e){return e?.getKind()===eV.SyntaxKind.TypeParameter}static isTypeParametered(e){switch(e?.getKind()){case eV.SyntaxKind.ArrowFunction:case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.FunctionType:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.TypeAliasDeclaration:return!0;default:return!1}}static isTypePredicate(e){return e?.getKind()===eV.SyntaxKind.TypePredicate}static isTypeQuery(e){return e?.getKind()===eV.SyntaxKind.TypeQuery}static isTypeReference(e){return e?.getKind()===eV.SyntaxKind.TypeReference}static isUnaryExpression(e){switch(e?.getKind()){case eV.SyntaxKind.ArrayLiteralExpression:case eV.SyntaxKind.AwaitExpression:case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.DeleteExpression:case eV.SyntaxKind.ElementAccessExpression:case eV.SyntaxKind.FalseKeyword:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportKeyword:case eV.SyntaxKind.JsxElement:case eV.SyntaxKind.JsxFragment:case eV.SyntaxKind.JsxSelfClosingElement:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.NonNullExpression:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NullKeyword:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.ObjectLiteralExpression:case eV.SyntaxKind.PostfixUnaryExpression:case eV.SyntaxKind.PrefixUnaryExpression:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.SuperKeyword:case eV.SyntaxKind.TaggedTemplateExpression:case eV.SyntaxKind.TemplateExpression:case eV.SyntaxKind.ThisKeyword:case eV.SyntaxKind.TrueKeyword:case eV.SyntaxKind.TypeAssertionExpression:case eV.SyntaxKind.TypeOfExpression:case eV.SyntaxKind.VoidExpression:return!0;default:return!1}}static isUnaryExpressioned(e){switch(e?.getKind()){case eV.SyntaxKind.AwaitExpression:case eV.SyntaxKind.DeleteExpression:case eV.SyntaxKind.TypeAssertionExpression:case eV.SyntaxKind.TypeOfExpression:case eV.SyntaxKind.VoidExpression:return!0;default:return!1}}static isUndefinedKeyword=nL.is(eV.SyntaxKind.UndefinedKeyword);static isUnionTypeNode(e){return e?.getKind()===eV.SyntaxKind.UnionType}static isUnwrappable(e){switch(e?.getKind()){case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.ModuleDeclaration:return!0;default:return!1}}static isUpdateExpression(e){switch(e?.getKind()){case eV.SyntaxKind.ArrayLiteralExpression:case eV.SyntaxKind.BigIntLiteral:case eV.SyntaxKind.CallExpression:case eV.SyntaxKind.ClassExpression:case eV.SyntaxKind.ElementAccessExpression:case eV.SyntaxKind.FalseKeyword:case eV.SyntaxKind.FunctionExpression:case eV.SyntaxKind.Identifier:case eV.SyntaxKind.ImportKeyword:case eV.SyntaxKind.JsxElement:case eV.SyntaxKind.JsxFragment:case eV.SyntaxKind.JsxSelfClosingElement:case eV.SyntaxKind.MetaProperty:case eV.SyntaxKind.NewExpression:case eV.SyntaxKind.NonNullExpression:case eV.SyntaxKind.NoSubstitutionTemplateLiteral:case eV.SyntaxKind.NullKeyword:case eV.SyntaxKind.NumericLiteral:case eV.SyntaxKind.ObjectLiteralExpression:case eV.SyntaxKind.PropertyAccessExpression:case eV.SyntaxKind.RegularExpressionLiteral:case eV.SyntaxKind.StringLiteral:case eV.SyntaxKind.SuperKeyword:case eV.SyntaxKind.TaggedTemplateExpression:case eV.SyntaxKind.TemplateExpression:case eV.SyntaxKind.ThisKeyword:case eV.SyntaxKind.TrueKeyword:return!0;default:return!1}}static isVariableDeclaration=nL.is(eV.SyntaxKind.VariableDeclaration);static isVariableDeclarationList=nL.is(eV.SyntaxKind.VariableDeclarationList);static isVariableStatement=nL.is(eV.SyntaxKind.VariableStatement);static isVoidExpression=nL.is(eV.SyntaxKind.VoidExpression);static isWhileStatement=nL.is(eV.SyntaxKind.WhileStatement);static isWithStatement=nL.is(eV.SyntaxKind.WithStatement);static isYieldExpression=nL.is(eV.SyntaxKind.YieldExpression);static _hasStructure(e){switch(e?.getKind()){case eV.SyntaxKind.CallSignature:case eV.SyntaxKind.ClassDeclaration:case eV.SyntaxKind.ClassStaticBlockDeclaration:case eV.SyntaxKind.Constructor:case eV.SyntaxKind.ConstructSignature:case eV.SyntaxKind.Decorator:case eV.SyntaxKind.EnumDeclaration:case eV.SyntaxKind.EnumMember:case eV.SyntaxKind.ExportAssignment:case eV.SyntaxKind.ExportDeclaration:case eV.SyntaxKind.ExportSpecifier:case eV.SyntaxKind.FunctionDeclaration:case eV.SyntaxKind.GetAccessor:case eV.SyntaxKind.ImportAttribute:case eV.SyntaxKind.ImportDeclaration:case eV.SyntaxKind.ImportSpecifier:case eV.SyntaxKind.IndexSignature:case eV.SyntaxKind.InterfaceDeclaration:case eV.SyntaxKind.JSDoc:case eV.SyntaxKind.JsxAttribute:case eV.SyntaxKind.JsxElement:case eV.SyntaxKind.JsxNamespacedName:case eV.SyntaxKind.JsxSelfClosingElement:case eV.SyntaxKind.JsxSpreadAttribute:case eV.SyntaxKind.MethodDeclaration:case eV.SyntaxKind.MethodSignature:case eV.SyntaxKind.ModuleDeclaration:case eV.SyntaxKind.Parameter:case eV.SyntaxKind.PropertyAssignment:case eV.SyntaxKind.PropertyDeclaration:case eV.SyntaxKind.PropertySignature:case eV.SyntaxKind.SetAccessor:case eV.SyntaxKind.ShorthandPropertyAssignment:case eV.SyntaxKind.SourceFile:case eV.SyntaxKind.SpreadAssignment:case eV.SyntaxKind.TypeAliasDeclaration:case eV.SyntaxKind.TypeParameter:case eV.SyntaxKind.VariableDeclaration:case eV.SyntaxKind.VariableStatement:return!0;default:return!1}}}function nO(e,t){return null==t?void 0:n=>t(e._getNodeFromCompilerNode(n))}function nF(e,t,n,r){let i=nL.isSourceFile(e)?e.getChildSyntaxListOrThrow():e.getParentSyntaxList()||e.getParentOrThrow(),o=tp(e._getWriterWithQueuedIndentation(),n);if(!/^[\s\r\n]*$/.test(o))throw new eV.errors.InvalidOperationError(`Cannot insert non-whitespace into ${r}.`);nm({parent:i,insertPos:t,newText:o})}function*nW(e){for(let t of function(){let t=[];return e.forEachChild(e=>{t.push(e)}),t}())yield t,yield*nW(t)}function*nB(e,t){for(let n of te.getCompilerChildren(e,t))yield n,yield*nB(n,t)}function nz(e,t){return t>=eV.SyntaxKind.FirstNode&&t<eV.SyntaxKind.FirstJSDocNode&&("number"==typeof e?e:e.compilerNode.kind)!==eV.SyntaxKind.SyntaxList}function nG(e,t,n){if(eV.errors.throwIfWhitespaceOrNotString(t,"newName"),e.getText()===t)return;let r=e._context.languageService.findRenameLocations(e,n),i=new eV.KeyValueCache;for(let e of r)i.getOrCreate(e.getSourceFile(),()=>[]).push(e);for(let[e,n]of i.getEntries()){let{sourceFile:r,renameLocations:i,newName:o}={sourceFile:e,renameLocations:n,newName:t},a=new ne;nf(r,new nc(i,o),a.getForTryOrForget(a.getForRename(r._context.compilerFactory)))}}function nj(e,t){let n=nR(e._getWriterWithIndentation(),t),r=e.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenBraceToken),i=e.getFirstChildByKindOrThrow(eV.SyntaxKind.CloseBraceToken);nm({insertPos:r.getEnd(),newText:n,parent:e,replacing:{textLength:i.getStart()-r.getEnd()}})}function nK(e){return class extends e{getBody(){let e=this.compilerNode.body;if(null==e)throw new eV.errors.InvalidOperationError("Bodied node should have a body.");return this._getNodeFromCompilerNode(e)}setBodyText(e){return nj(this.getBody(),e),this}getBodyText(){return nM(this.getBody())}}}function nV(e){return class extends e{getBodyOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getBody(),e??"Expected to find the node's body.",this)}getBody(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.body)}getBodyText(){let e=this.getBody();return null==e?void 0:nM(e)}setBodyText(e){return this.addBody(),nj(this.getBodyOrThrow(),e),this}hasBody(){return null!=this.compilerNode.body}addBody(){if(this.hasBody())return this;let e=this.getLastChildByKind(eV.SyntaxKind.SemicolonToken);return nm({parent:this,insertPos:null==e?this.getEnd():e.getStart(),newText:this._getWriterWithQueuedIndentation().space().block().toString(),replacing:{textLength:e?.getFullWidth()??0}}),this}removeBody(){let e=this.getBody();return null==e||nm({parent:this,insertPos:e.getPos(),newText:";",replacing:{textLength:e.getFullWidth()}}),this}}}function nU(e){return class extends e{setOrder(e){let t=this.getChildIndex(),n=this.getParentSyntaxList()||this.getParentSyntaxListOrThrow();if(eV.errors.throwIfOutOfRange(e,[0,n.getChildCount()-1],"order"),t===e)return this;var r={parent:n,getSiblingFormatting:tM,oldIndex:t,newIndex:e};let{parent:i}=r;return nf(i._sourceFile,new nn(r),new ne().getForChangingChildOrder(r)),this}}}function nH(e){return class extends e{getDecorator(e){return e$(this.getDecorators(),e)}getDecoratorOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getDecorator(e),t??(()=>eY("decorator",e)),this)}getDecorators(){return nq(this.compilerNode).map(e=>this._getNodeFromCompilerNode(e))}addDecorator(e){return this.insertDecorator(tO(nq(this.compilerNode)),e)}addDecorators(e){return this.insertDecorators(tO(nq(this.compilerNode)),e)}insertDecorator(e,t){return this.insertDecorators(e,[t])[0]}insertDecorators(e,t){var n;if(eV.ArrayUtils.isNullOrEmpty(t))return[];let r=function(e,t){let n=[];for(let r of t){let t=e._getWriter();e._context.structurePrinterFactory.forDecorator().printText(t,r),n.push(t.toString())}return n}(this,t),i=this.getDecorators();e=tX(e,i.length);let o=(n=this,!function(e,t){if(1===t.length){let e=t[0].getPreviousSibling();if(null!=e&&e.getStartLinePos()===t[0].getStartLinePos())return!0}if(t.length<=1)return e.getKind()===eV.SyntaxKind.Parameter;let n=t[0].getStartLinePos();for(let e=1;e<t.length;e++)if(t[e].getStartLinePos()!==n)return!1;return!0}(n,i)?eK.Newline:eK.Space),a=i[e-1],s=function(e){let{structures:t,newCodes:n,parent:r,getSeparator:i,previousFormattingKind:o,nextFormattingKind:a}=e,s=e.indentationText??r.getChildIndentationText(),l=r._context.manipulationSettings.getNewLineKindAsString();return c(o)+function(){let e=n[0];for(let r=1;r<n.length;r++)e+=c(i(t[r-1],t[r])),e+=n[r];return e}()+c(a);function c(e){let t=function(e,t){switch(e){case eK.Space:return" ";case eK.Newline:return t.newLineKind;case eK.Blankline:return t.newLineKind+t.newLineKind;case eK.None:return"";default:throw new eV.errors.NotImplementedError(`Not implemented formatting kind: ${e}`)}}(e,{newLineKind:l});return(e===eK.Newline||e===eK.Blankline)&&(t+=s),t}}({structures:t,newCodes:r,parent:this,indentationText:this.getIndentationText(),getSeparator:()=>o,previousFormattingKind:null==a?eK.None:o,nextFormattingKind:null==a?o:eK.None});return nm({parent:i[0]?.getParentSyntaxListOrThrow()??this.getModifiers()[0]?.getParentSyntaxListOrThrow()??this,insertPos:0===e?(i[0]??this).getStart():i[e-1].getEnd(),newText:s}),tU(i,this.getDecorators(),e,!1)}set(t){return tD(e.prototype,this,t),null!=t.decorators&&(this.getDecorators().forEach(e=>e.remove()),this.addDecorators(t.decorators)),this}getStructure(){return tA(e.prototype,this,{decorators:this.getDecorators().map(e=>e.getStructure())})}}}function nq(e){return eV.ts.canHaveDecorators(e)?eV.ts.getDecorators(e)??[]:[]}function nJ(e){return class extends e{getDotDotDotTokenOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDotDotDotToken(),e??"Expected to find a dot dot dot token (...).",this)}getDotDotDotToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.dotDotDotToken)}}}function n$(e){return class extends e{hasExclamationToken(){return null!=this.compilerNode.exclamationToken}getExclamationTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.exclamationToken)}getExclamationTokenNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getExclamationTokenNode(),e??"Expected to find an exclamation token.",this)}setHasExclamationToken(e){let t=this.getExclamationTokenNode();if(e===(null!=t))return this;if(e){nL.isQuestionTokenable(this)&&this.setHasQuestionToken(!1);let e=this.getFirstChildByKind(eV.SyntaxKind.ColonToken);if(null==e)throw new eV.errors.InvalidOperationError("Cannot add an exclamation token to a node that does not have a type.");nm({insertPos:e.getStart(),parent:this,newText:"!"})}else nv({children:[t]});return this}set(t){return tD(e.prototype,this,t),null!=t.hasExclamationToken&&this.setHasExclamationToken(t.hasExclamationToken),this}getStructure(){return tA(e.prototype,this,{hasExclamationToken:this.hasExclamationToken()})}}}function nX(e){return class extends e{hasExportKeyword(){return null!=this.getExportKeyword()}getExportKeyword(){if(nL.isVariableDeclaration(this)){let e=this.getVariableStatement();return e?.getExportKeyword()}return nL.isModifierable(this)?this.getFirstModifierByKind(eV.SyntaxKind.ExportKeyword):nY()}getExportKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getExportKeyword(),e??"Expected to find an export keyword.",this)}hasDefaultKeyword(){return null!=this.getDefaultKeyword()}getDefaultKeyword(){if(nL.isVariableDeclaration(this)){let e=this.getVariableStatement();return e?.getDefaultKeyword()}return nL.isModifierable(this)?this.getFirstModifierByKind(eV.SyntaxKind.DefaultKeyword):nY()}getDefaultKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDefaultKeyword(),e??"Expected to find a default keyword.",this)}isExported(){if(this.hasExportKeyword())return!0;let e=this.getSymbol(),t=this.getSourceFile().getSymbol();return null!=e&&null!=t&&t.getExports().some(t=>t===e||t.getAliasedSymbol()===e)}isDefaultExport(){if(this.hasDefaultKeyword())return!0;let e=this.getSymbol();if(null==e)return!1;let t=this.getSourceFile().getDefaultExportSymbol();return null!=t&&(e===t||e===t.getAliasedSymbol())}isNamedExport(){let e=this.getSymbol(),t=this.getSourceFile().getSymbol();return null!=e&&null!=t&&!function(){let n=t.getExport("default");return null!=n&&(e===n||e===n.getAliasedSymbol())}()&&t.getExports().some(t=>t===e||t.getAliasedSymbol()===e)}}}function nY(){throw new eV.errors.NotImplementedError("Not implemented situation where node was not a ModifierableNode.")}function nQ(e){var t;return t=nX(e),class extends t{setIsDefaultExport(e){if(e===this.isDefaultExport())return this;if(e&&!nL.isSourceFile(this.getParentOrThrow()))throw new eV.errors.InvalidOperationError("The parent must be a source file in order to set this node as a default export.");let t=this.getSourceFile(),n=t.getDefaultExportSymbol();if(null!=n&&t.removeDefaultExport(n),!e)return this;if(nL.hasName(this)&&(function(){return!!(nL.isEnumDeclaration(this)||nL.isModuleDeclaration(this)||nL.isTypeAliasDeclaration(this)||nL.isAmbientable(this)&&this.isAmbient())}).call(this)){let e=this.getFirstAncestorByKindOrThrow(eV.SyntaxKind.SyntaxList),t=this.getName();e.insertChildText(this.getChildIndex()+1,e=>{e.newLine().write(`export default ${t};`)})}else this.addModifier("export"),this.addModifier("default");return this}setIsExported(e){return nL.isSourceFile(this.getParentOrThrow())&&this.toggleModifier("default",!1),this.toggleModifier("export",e),this}set(e){return tD(t.prototype,this,e),null!=e.isExported&&this.setIsExported(e.isExported),null!=e.isDefaultExport&&this.setIsDefaultExport(e.isDefaultExport),this}getStructure(){return tA(t.prototype,this,{isExported:this.hasExportKeyword(),isDefaultExport:this.hasDefaultKeyword()})}}}t.Scope=void 0,(eR=t.Scope||(t.Scope={})).Public="public",eR.Protected="protected",eR.Private="private";class nZ{printTextOrWriterFunc(e,t){"string"==typeof t?e.write(t):null!=t&&t(e)}getNewWriter(e){return new eH.default(e.getOptions())}getNewWriterWithQueuedChildIndentation(e){let t=new eH.default(e.getOptions());return t.queueIndentationLevel(1),t}getText(e,t){let n=this.getNewWriter(e);return this.printTextOrWriterFunc(n,t),n.toString()}getTextWithQueuedChildIndentation(e,t){let n=this.getNewWriterWithQueuedChildIndentation(e);return this.printTextOrWriterFunc(n,t),n.toString()}}class n0 extends nZ{printText(e,t){let{initializer:n}=t;if(null==n)return;let r=this.getText(e,n);eV.StringUtils.isNullOrWhitespace(r)||e.hangingIndent(()=>{e.spaceIfLastNot(),e.write(`= ${r}`)})}}class n1 extends nZ{printText(e,t){let n=t.scope;t.isDefaultExport?e.write("export default "):t.isExported&&e.write("export "),t.hasDeclareKeyword&&e.write("declare "),null!=n&&e.write(`${n} `),t.isStatic&&e.write("static "),t.hasOverrideKeyword&&e.write("override "),t.isAbstract&&e.write("abstract "),t.isAsync&&e.write("async "),t.isReadonly&&e.write("readonly "),t.hasAccessorKeyword&&e.write("accessor ")}}class n2 extends nZ{#tg;constructor(e=!1){super(),this.#tg=e}printText(e,t){let{returnType:n}=t;if(null==n&&!1===this.#tg)return;n=n??"void";let r=this.getText(e,n);eV.StringUtils.isNullOrWhitespace(r)||e.hangingIndent(()=>{e.write(`: ${r}`)})}}class n8 extends nZ{#ty;#tg;constructor(e,t=!1){super(),this.#tg=t,this.#ty=e}printText(e,t){let{type:n}=t;if(null==n&&!1===this.#tg)return;n=n??"any";let r=this.getText(e,n);eV.StringUtils.isNullOrWhitespace(r)||e.hangingIndent(()=>{e.write(`${this.#ty} ${r}`)})}}class n3 extends nZ{#tv;constructor(e){super(),this.#tv=e}printText(e,t){if(null!=t)for(let n=0;n<t.length;n++)e.conditionalBlankLine(n>0),this.#tv.printText(e,t[n])}}class n6 extends nZ{#tv;constructor(e){super(),this.#tv=e}printText(e,t){n4(this.#tv,e,t,()=>e.spaceIfLastNot())}}function n4(e,t,n,r){if(null!=n)if(n instanceof Function||"string"==typeof n)e.printText(t,n);else{let i=Array(n.length);for(let o=0;o<n.length;o++){o>0&&r();let a=n[o],s=t.getLength();e.printText(t,a);let l=tL(tT.getLastCharactersToPos(t,s));i[o]=-1!==l&&l+s}let o=!1;for(let e=i.length-1;e>=0;e--){let n=i[e];!1!==n&&(o?t.unsafeInsert(n,","):o=!0)}}}class n5 extends nZ{#tv;constructor(e){super(),this.#tv=e}printText(e,t){n4(this.#tv,e,t,()=>e.newLineIfLastNot())}}class n7 extends nZ{#tv;constructor(e){super(),this.#tv=e}printText(e,t){if(null!=t)for(let n=0;n<t.length;n++)e.conditionalNewLine(n>0),this.#tv.printText(e,t[n])}}class n9 extends nZ{#tv;constructor(e){super(),this.#tv=e}printText(e,t){if(null!=t)for(let n=0;n<t.length;n++)e.conditionalWrite(n>0," "),this.#tv.printText(e,t[n])}}class re extends nZ{factory;constructor(e){super(),this.factory=e}printTextWithoutTrivia(e,t){this.printTextInternal(e,t)}printText(e,t){this.printLeadingTrivia(e,t),e.closeComment(),this.printTextInternal(e,t),this.printTrailingTrivia(e,t)}printLeadingTrivia(e,t){let n=t?.leadingTrivia;n&&(this.#tb(e,n),e.isInComment()&&e.closeComment())}printTrailingTrivia(e,t){let n=t?.trailingTrivia;null!=n&&this.#tb(e,n)}#tb(e,t){if(t instanceof Array)for(let n=0;n<t.length;n++)this.printTextOrWriterFunc(e,t[n]),n!==t.length-1&&e.newLineIfLastNot();else this.printTextOrWriterFunc(e,t)}}class rt{#tx;#tS;constructor(e,t){this.#tx=e,this.#tS=t}printGetAndSet(e,t,n,r){for(let i of(t=[...t??[]],n=[...n??[]],t)){this.#tE(e,r),this.#tx.printText(e,i);let t=n.findIndex(e=>e.name===i.name);t>=0&&(this.#tE(e,r),this.#tS.printText(e,n[t]),n.splice(t,1))}for(let t of n)this.#tE(e,r),this.#tS.printText(e,t)}#tE(e,t){e.isAtStartOfFirstLineOfBlock()||(t?e.newLine():e.blankLine())}}class rn extends re{#tT;#tA=new n3(this);constructor(e,t){super(e),this.#tT=t}printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){let n=t.hasDeclareKeyword||this.#tT.isAmbient;this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forDecorator().printTexts(e,t.decorators),this.#tD(e,t),e.inlineBlock(()=>{this.factory.forPropertyDeclaration().printTexts(e,t.properties),this.#tC(e,t),this.#tI(e,t,n),this.#tN(e,t,n),eV.ArrayUtils.isNullOrEmpty(t.methods)||(this.#tE(e,n),this.factory.forMethodDeclaration({isAmbient:n}).printTexts(e,t.methods))})}#tD(e,t){this.factory.forModifierableNode().printText(e,t),e.write("class"),eV.StringUtils.isNullOrWhitespace(t.name)||e.space().write(t.name),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),e.space(),e.hangingIndent(()=>{if(null!=t.extends){let n=this.getText(e,t.extends);eV.StringUtils.isNullOrWhitespace(n)||e.write(`extends ${n} `)}if(null!=t.implements){let n=t.implements instanceof Array?t.implements.map(t=>this.getText(e,t)).join(", "):this.getText(e,t.implements);eV.StringUtils.isNullOrWhitespace(n)||e.write(`implements ${n} `)}})}#tI(e,t,n){if(!eV.ArrayUtils.isNullOrEmpty(t.ctors))for(let r of t.ctors)this.#tE(e,n),this.factory.forConstructorDeclaration({isAmbient:n}).printText(e,r)}#tC(e,t){if(!eV.ArrayUtils.isNullOrEmpty(t.staticBlocks))for(let n of t.staticBlocks)this.#tE(e,!1),this.factory.forClassStaticBlockDeclaration().printText(e,n)}#tN(e,t,n){if(null!=t.getAccessors||null!=t.setAccessors)new rt(this.factory.forGetAccessorDeclaration({isAmbient:n}),this.factory.forSetAccessorDeclaration({isAmbient:n})).printGetAndSet(e,t.getAccessors,t.setAccessors,n)}#tE(e,t){e.isAtStartOfFirstLineOfBlock()||(t?e.newLine():e.blankLine())}}t.StructureKind=void 0,(eM=t.StructureKind||(t.StructureKind={}))[eM.ImportAttribute=0]="ImportAttribute",eM[eM.CallSignature=1]="CallSignature",eM[eM.Class=2]="Class",eM[eM.ClassStaticBlock=3]="ClassStaticBlock",eM[eM.ConstructSignature=4]="ConstructSignature",eM[eM.Constructor=5]="Constructor",eM[eM.ConstructorOverload=6]="ConstructorOverload",eM[eM.Decorator=7]="Decorator",eM[eM.Enum=8]="Enum",eM[eM.EnumMember=9]="EnumMember",eM[eM.ExportAssignment=10]="ExportAssignment",eM[eM.ExportDeclaration=11]="ExportDeclaration",eM[eM.ExportSpecifier=12]="ExportSpecifier",eM[eM.Function=13]="Function",eM[eM.FunctionOverload=14]="FunctionOverload",eM[eM.GetAccessor=15]="GetAccessor",eM[eM.ImportDeclaration=16]="ImportDeclaration",eM[eM.ImportSpecifier=17]="ImportSpecifier",eM[eM.IndexSignature=18]="IndexSignature",eM[eM.Interface=19]="Interface",eM[eM.JsxAttribute=20]="JsxAttribute",eM[eM.JsxSpreadAttribute=21]="JsxSpreadAttribute",eM[eM.JsxElement=22]="JsxElement",eM[eM.JsxSelfClosingElement=23]="JsxSelfClosingElement",eM[eM.JSDoc=24]="JSDoc",eM[eM.JSDocTag=25]="JSDocTag",eM[eM.Method=26]="Method",eM[eM.MethodOverload=27]="MethodOverload",eM[eM.MethodSignature=28]="MethodSignature",eM[eM.Module=29]="Module",eM[eM.Parameter=30]="Parameter",eM[eM.Property=31]="Property",eM[eM.PropertyAssignment=32]="PropertyAssignment",eM[eM.PropertySignature=33]="PropertySignature",eM[eM.SetAccessor=34]="SetAccessor",eM[eM.ShorthandPropertyAssignment=35]="ShorthandPropertyAssignment",eM[eM.SourceFile=36]="SourceFile",eM[eM.SpreadAssignment=37]="SpreadAssignment",eM[eM.TypeAlias=38]="TypeAlias",eM[eM.TypeParameter=39]="TypeParameter",eM[eM.VariableDeclaration=40]="VariableDeclaration",eM[eM.VariableStatement=41]="VariableStatement";let rr={hasName:e=>"string"==typeof e.name,isCallSignature:e=>e?.kind===t.StructureKind.CallSignature,isJSDocable(e){switch(e?.kind){case t.StructureKind.CallSignature:case t.StructureKind.Class:case t.StructureKind.ClassStaticBlock:case t.StructureKind.ConstructorOverload:case t.StructureKind.Constructor:case t.StructureKind.ConstructSignature:case t.StructureKind.Enum:case t.StructureKind.EnumMember:case t.StructureKind.ExportAssignment:case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.GetAccessor:case t.StructureKind.IndexSignature:case t.StructureKind.Interface:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.MethodSignature:case t.StructureKind.Module:case t.StructureKind.Property:case t.StructureKind.PropertySignature:case t.StructureKind.SetAccessor:case t.StructureKind.TypeAlias:case t.StructureKind.VariableStatement:return!0;default:return!1}},isSignatured(e){switch(e?.kind){case t.StructureKind.CallSignature:case t.StructureKind.ConstructorOverload:case t.StructureKind.Constructor:case t.StructureKind.ConstructSignature:case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.GetAccessor:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.MethodSignature:case t.StructureKind.SetAccessor:return!0;default:return!1}},isParametered(e){switch(e?.kind){case t.StructureKind.CallSignature:case t.StructureKind.ConstructorOverload:case t.StructureKind.Constructor:case t.StructureKind.ConstructSignature:case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.GetAccessor:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.MethodSignature:case t.StructureKind.SetAccessor:return!0;default:return!1}},isReturnTyped(e){switch(e?.kind){case t.StructureKind.CallSignature:case t.StructureKind.ConstructorOverload:case t.StructureKind.Constructor:case t.StructureKind.ConstructSignature:case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.GetAccessor:case t.StructureKind.IndexSignature:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.MethodSignature:case t.StructureKind.SetAccessor:return!0;default:return!1}},isTypeParametered(e){switch(e?.kind){case t.StructureKind.CallSignature:case t.StructureKind.Class:case t.StructureKind.ConstructorOverload:case t.StructureKind.Constructor:case t.StructureKind.ConstructSignature:case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.GetAccessor:case t.StructureKind.Interface:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.MethodSignature:case t.StructureKind.SetAccessor:case t.StructureKind.TypeAlias:return!0;default:return!1}},isClass:e=>e?.kind===t.StructureKind.Class,isClassLikeDeclarationBase:e=>e?.kind===t.StructureKind.Class,isNameable(e){switch(e?.kind){case t.StructureKind.Class:case t.StructureKind.Function:return!0;default:return!1}},isImplementsClauseable:e=>e?.kind===t.StructureKind.Class,isDecoratable(e){switch(e?.kind){case t.StructureKind.Class:case t.StructureKind.GetAccessor:case t.StructureKind.Method:case t.StructureKind.Parameter:case t.StructureKind.Property:case t.StructureKind.SetAccessor:return!0;default:return!1}},isAbstractable(e){switch(e?.kind){case t.StructureKind.Class:case t.StructureKind.GetAccessor:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.Property:case t.StructureKind.SetAccessor:return!0;default:return!1}},isAmbientable(e){switch(e?.kind){case t.StructureKind.Class:case t.StructureKind.Enum:case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.Interface:case t.StructureKind.Module:case t.StructureKind.Property:case t.StructureKind.TypeAlias:case t.StructureKind.VariableStatement:return!0;default:return!1}},isExportable(e){switch(e?.kind){case t.StructureKind.Class:case t.StructureKind.Enum:case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.Interface:case t.StructureKind.Module:case t.StructureKind.TypeAlias:case t.StructureKind.VariableStatement:return!0;default:return!1}},isClassStaticBlock:e=>e?.kind===t.StructureKind.ClassStaticBlock,isStatemented(e){switch(e?.kind){case t.StructureKind.ClassStaticBlock:case t.StructureKind.Constructor:case t.StructureKind.Function:case t.StructureKind.GetAccessor:case t.StructureKind.Method:case t.StructureKind.Module:case t.StructureKind.SetAccessor:case t.StructureKind.SourceFile:return!0;default:return!1}},isConstructorDeclarationOverload:e=>e?.kind===t.StructureKind.ConstructorOverload,isScoped(e){switch(e?.kind){case t.StructureKind.ConstructorOverload:case t.StructureKind.Constructor:case t.StructureKind.GetAccessor:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.Property:case t.StructureKind.SetAccessor:return!0;default:return!1}},isConstructor:e=>e?.kind===t.StructureKind.Constructor,isFunctionLike(e){switch(e?.kind){case t.StructureKind.Constructor:case t.StructureKind.Function:case t.StructureKind.GetAccessor:case t.StructureKind.Method:case t.StructureKind.SetAccessor:return!0;default:return!1}},isConstructSignature:e=>e?.kind===t.StructureKind.ConstructSignature,isDecorator:e=>e?.kind===t.StructureKind.Decorator,isEnum:e=>e?.kind===t.StructureKind.Enum,isNamed(e){switch(e?.kind){case t.StructureKind.Enum:case t.StructureKind.Interface:case t.StructureKind.ShorthandPropertyAssignment:case t.StructureKind.TypeAlias:case t.StructureKind.TypeParameter:return!0;default:return!1}},isEnumMember:e=>e?.kind===t.StructureKind.EnumMember,isPropertyNamed(e){switch(e?.kind){case t.StructureKind.EnumMember:case t.StructureKind.GetAccessor:case t.StructureKind.Method:case t.StructureKind.MethodSignature:case t.StructureKind.PropertyAssignment:case t.StructureKind.Property:case t.StructureKind.PropertySignature:case t.StructureKind.SetAccessor:return!0;default:return!1}},isInitializerExpressionable(e){switch(e?.kind){case t.StructureKind.EnumMember:case t.StructureKind.Parameter:case t.StructureKind.Property:case t.StructureKind.PropertySignature:case t.StructureKind.VariableDeclaration:return!0;default:return!1}},isExportAssignment:e=>e?.kind===t.StructureKind.ExportAssignment,isExportDeclaration:e=>e?.kind===t.StructureKind.ExportDeclaration,isExportSpecifier:e=>e?.kind===t.StructureKind.ExportSpecifier,isFunctionDeclarationOverload:e=>e?.kind===t.StructureKind.FunctionOverload,isAsyncable(e){switch(e?.kind){case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.MethodOverload:case t.StructureKind.Method:return!0;default:return!1}},isGeneratorable(e){switch(e?.kind){case t.StructureKind.FunctionOverload:case t.StructureKind.Function:case t.StructureKind.MethodOverload:case t.StructureKind.Method:return!0;default:return!1}},isFunction:e=>e?.kind===t.StructureKind.Function,isGetAccessor:e=>e?.kind===t.StructureKind.GetAccessor,isStaticable(e){switch(e?.kind){case t.StructureKind.GetAccessor:case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.Property:case t.StructureKind.SetAccessor:return!0;default:return!1}},isImportAttribute:e=>e?.kind===t.StructureKind.ImportAttribute,isImportAttributeNamed:e=>e?.kind===t.StructureKind.ImportAttribute,isImportDeclaration:e=>e?.kind===t.StructureKind.ImportDeclaration,isImportSpecifier:e=>e?.kind===t.StructureKind.ImportSpecifier,isIndexSignature:e=>e?.kind===t.StructureKind.IndexSignature,isReadonlyable(e){switch(e?.kind){case t.StructureKind.IndexSignature:case t.StructureKind.Parameter:case t.StructureKind.Property:case t.StructureKind.PropertySignature:return!0;default:return!1}},isInterface:e=>e?.kind===t.StructureKind.Interface,isExtendsClauseable:e=>e?.kind===t.StructureKind.Interface,isTypeElementMembered:e=>e?.kind===t.StructureKind.Interface,isJSDoc:e=>e?.kind===t.StructureKind.JSDoc,isJSDocTag:e=>e?.kind===t.StructureKind.JSDocTag,isJsxAttribute:e=>e?.kind===t.StructureKind.JsxAttribute,isJsxElement:e=>e?.kind===t.StructureKind.JsxElement,isJsxSelfClosingElement:e=>e?.kind===t.StructureKind.JsxSelfClosingElement,isJsxTagNamed:e=>e?.kind===t.StructureKind.JsxSelfClosingElement,isJsxAttributed:e=>e?.kind===t.StructureKind.JsxSelfClosingElement,isJsxSpreadAttribute:e=>e?.kind===t.StructureKind.JsxSpreadAttribute,isMethodDeclarationOverload:e=>e?.kind===t.StructureKind.MethodOverload,isQuestionTokenable(e){switch(e?.kind){case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.MethodSignature:case t.StructureKind.Parameter:case t.StructureKind.Property:case t.StructureKind.PropertySignature:return!0;default:return!1}},isOverrideable(e){switch(e?.kind){case t.StructureKind.MethodOverload:case t.StructureKind.Method:case t.StructureKind.Parameter:case t.StructureKind.Property:return!0;default:return!1}},isMethod:e=>e?.kind===t.StructureKind.Method,isMethodSignature:e=>e?.kind===t.StructureKind.MethodSignature,isModule:e=>e?.kind===t.StructureKind.Module,isModuleNamed:e=>e?.kind===t.StructureKind.Module,isParameter:e=>e?.kind===t.StructureKind.Parameter,isBindingNamed(e){switch(e?.kind){case t.StructureKind.Parameter:case t.StructureKind.VariableDeclaration:return!0;default:return!1}},isTyped(e){switch(e?.kind){case t.StructureKind.Parameter:case t.StructureKind.Property:case t.StructureKind.PropertySignature:case t.StructureKind.TypeAlias:case t.StructureKind.VariableDeclaration:return!0;default:return!1}},isScopeable:e=>e?.kind===t.StructureKind.Parameter,isPropertyAssignment:e=>e?.kind===t.StructureKind.PropertyAssignment,isProperty:e=>e?.kind===t.StructureKind.Property,isExclamationTokenable(e){switch(e?.kind){case t.StructureKind.Property:case t.StructureKind.VariableDeclaration:return!0;default:return!1}},isPropertySignature:e=>e?.kind===t.StructureKind.PropertySignature,isSetAccessor:e=>e?.kind===t.StructureKind.SetAccessor,isShorthandPropertyAssignment:e=>e?.kind===t.StructureKind.ShorthandPropertyAssignment,isSourceFile:e=>e?.kind===t.StructureKind.SourceFile,isSpreadAssignment:e=>e?.kind===t.StructureKind.SpreadAssignment,isExpressioned:e=>e?.kind===t.StructureKind.SpreadAssignment,isTypeAlias:e=>e?.kind===t.StructureKind.TypeAlias,isTypeParameter:e=>e?.kind===t.StructureKind.TypeParameter,isVariableDeclaration:e=>e?.kind===t.StructureKind.VariableDeclaration,isVariableStatement:e=>e?.kind===t.StructureKind.VariableStatement};function ri(e,n){return ro(e.parameters,n,t.StructureKind.Parameter)}function ro(e,t,n){if(null!=e)for(let r of e){let e=t(rs(r,n));if(e)return e}}function ra(e,t,n){if(null!=e&&e instanceof Array){for(let r of e)if(rl(r)){let e=t(rs(r,n));if(e)return e}}}function rs(e,t){return null==e.kind&&(e.kind=t),e}function rl(e){return null!=e&&"number"==typeof e.kind}function rc(e){return e.iterateLastCharCodes(e=>e===eJ.CLOSE_BRACE||!!eV.StringUtils.isWhitespaceCharCode(e)&&void 0)||!1}class rd extends nZ{#tT;#tP;constructor(e,t){super(),this.#tP=e,this.#tT=t}printTexts(e,t){if(null!=t)if("string"==typeof t||t instanceof Function)this.printText(e,t);else for(let n of t)rc(e)?e.blankLineIfLastNot():e.isAtStartOfFirstLineOfBlock()||e.newLineIfLastNot(),this.printText(e,n)}printText(e,n){if("string"==typeof n||n instanceof Function||null==n)return void this.printTextOrWriterFunc(e,n);switch(n.kind){case t.StructureKind.Method:this.#tT.isAmbient||r(),this.#tP.forMethodDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.Property:this.#tP.forPropertyDeclaration().printText(e,n);break;case t.StructureKind.GetAccessor:this.#tT.isAmbient||r(),this.#tP.forGetAccessorDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.SetAccessor:this.#tT.isAmbient||r(),this.#tP.forSetAccessorDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.Constructor:this.#tT.isAmbient||r(),this.#tP.forConstructorDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.ClassStaticBlock:r(),this.#tP.forClassStaticBlockDeclaration().printText(e,n);break;default:eV.errors.throwNotImplementedForNeverValueError(n)}function r(){e.isAtStartOfFirstLineOfBlock()||e.blankLineIfLastNot()}}}class ru extends re{constructor(e){super(e)}printTexts(e,t){if(null!=t)for(let n=0;n<t.length;n++)n>0&&e.blankLine(),this.printText(e,t[n])}printTextInternal(e,t){e.write("static"),e.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(e,t)})}}class rp extends re{#tT;constructor(e,t){super(e),this.#tT=t}printTexts(e,t){if(null!=t)for(let n=0;n<t.length;n++)n>0&&(this.#tT.isAmbient?e.newLine():e.blankLine()),this.printText(e,t[n])}printTextInternal(e,t){this.#tR(e,function(){let e=eV.ObjectUtils.clone(t.overloads);if(null!=e&&0!==e.length){for(let n of e)td(n,"scope",t.scope);return e}}()),this.#tD(e,t),this.#tT.isAmbient?e.write(";"):e.space().inlineBlock(()=>{this.factory.forStatementedNode(this.#tT).printText(e,t)})}#tR(e,t){if(null!=t&&0!==t.length)for(let n of t)this.printOverload(e,n),e.newLine()}printOverload(e,t){this.printLeadingTrivia(e,t),this.#tD(e,t),e.write(";"),this.printTrailingTrivia(e,t)}#tD(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forModifierableNode().printText(e,t),e.write("constructor"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,t.parameters)}}class rf extends re{#tT;#tA;constructor(e,t){super(e),this.#tT=t,this.#tA=this.#tT.isAmbient?new n7(this):new n3(this)}printTexts(e,t){null!=t&&this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forDecorator().printTexts(e,t.decorators),this.factory.forModifierableNode().printText(e,t),e.write(`get ${t.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,t.parameters),this.factory.forReturnTypedNode().printText(e,t),this.#tT.isAmbient||t.isAbstract?e.write(";"):e.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.#tT).printText(e,t)})}}class rm extends re{#tT;constructor(e,t){super(e),this.#tT=t}printTexts(e,t){if(null!=t)for(let n=0;n<t.length;n++)n>0&&(this.#tT.isAmbient?e.newLine():e.blankLine()),this.printText(e,t[n])}printTextInternal(e,t){this.#tR(e,t.name,function(){let e=eV.ObjectUtils.clone(t.overloads);if(null!=e&&0!==e.length){for(let n of e)td(n,"scope",t.scope),td(n,"isStatic",t.isStatic),td(n,"isAbstract",t.isAbstract),td(n,"hasQuestionToken",t.hasQuestionToken);return e}}()),this.#tD(e,t.name,t),this.#tT.isAmbient||t.isAbstract?e.write(";"):e.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.#tT).printText(e,t)})}#tR(e,t,n){if(null!=n&&0!==n.length)for(let r of n)this.printOverload(e,t,r),e.newLine()}printOverload(e,t,n){this.printLeadingTrivia(e,n),this.#tD(e,t,n),e.write(";"),this.printTrailingTrivia(e,n)}#tD(e,t,n){this.factory.forJSDoc().printDocs(e,n.docs),null!=n.decorators&&this.factory.forDecorator().printTexts(e,n.decorators),this.factory.forModifierableNode().printText(e,n),e.conditionalWrite(n.isGenerator,"*"),e.write(t),e.conditionalWrite(n.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,n.parameters),this.factory.forReturnTypedNode().printText(e,n)}}class r_ extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forDecorator().printTexts(e,t.decorators),this.factory.forModifierableNode().printText(e,t),e.write(t.name),e.conditionalWrite(t.hasQuestionToken,"?"),e.conditionalWrite(t.hasExclamationToken&&!t.hasQuestionToken,"!"),this.factory.forTypedNode(":").printText(e,t),this.factory.forInitializerExpressionableNode().printText(e,t),e.write(";")}}class rh extends re{#tT;#tA;constructor(e,t){super(e),this.#tT=t,this.#tA=this.#tT.isAmbient?new n7(this):new n3(this)}printTexts(e,t){null!=t&&this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forDecorator().printTexts(e,t.decorators),this.factory.forModifierableNode().printText(e,t),e.write(`set ${t.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,t.parameters),this.factory.forReturnTypedNode().printText(e,t),this.#tT.isAmbient||t.isAbstract?e.write(";"):e.spaceIfLastNot().inlineBlock(()=>{this.factory.forStatementedNode(this.#tT).printText(e,t)})}}class rg extends nZ{printText(e,t){"string"==typeof t?e.write(t):t(e)}}class ry extends re{printTexts(e,t){this.#tM(e,t,()=>e.newLine())}printTextsInline(e,t){this.#tM(e,t,()=>e.space())}printTextInternal(e,t){e.write(`@${t.name}`),this.#tk(e,t),this.#tw(e,t)}#tk(e,t){if(null!=t.typeArguments&&0!==t.typeArguments.length){e.write("<");for(let n=0;n<t.typeArguments.length;n++)e.conditionalWrite(n>0,", "),e.write(this.getTextWithQueuedChildIndentation(e,t.typeArguments[n]));e.write(">")}}#tw(e,t){if(null==t.arguments)return;e.write("(");let n=t.arguments instanceof Array?t.arguments:[t.arguments];for(let t=0;t<n.length;t++)e.conditionalWrite(t>0,", "),e.write(this.getTextWithQueuedChildIndentation(e,n[t]));e.write(")")}#tM(e,t,n){if(null!=t&&0!==t.length)for(let r of t)this.printText(e,r),n()}}class rv extends re{printDocs(e,t){if(null!=t)for(let n of t)this.printText(e,n),e.newLine()}printTextInternal(e,t){let n=(function(n){if("string"==typeof t)return t;let r=n.getNewWriter(e);return"function"==typeof t?t(r):(t.description&&tf(r,t.description),t.tags&&t.tags.length>0&&(r.getLength()>0&&r.newLine(),n.factory.forJSDocTag({printStarsOnNewLine:!1}).printTexts(r,t.tags))),r.toString()})(this).split(/\r?\n/),r=0===n[0].length,i=n.length<=1,o=+!!r;if(e.write("/**"),i?e.space():e.newLine(),i)e.write(n[o]);else for(let t=o;t<n.length;t++)e.write(" *"),n[t].length>0&&e.write(` ${n[t]}`),e.newLine();e.spaceIfLastNot(),e.write("*/")}}class rb extends re{#tT;constructor(e,t){super(e),this.#tT=t}printTexts(e,t){if(null!=t)for(let n=0;n<t.length;n++)n>0&&(e.newLine(),e.conditionalWrite(this.#tT.printStarsOnNewLine," * ")),this.printText(e,t[n])}printTextInternal(e,t){let n=(function(n){if("string"==typeof t)return t;let r=n.getNewWriter(e);if("function"==typeof t)t(r);else{t.text&&tf(r,t.text);let e=r.toString();r.unsafeInsert(0,`@${t.tagName}`+(e.length>0&&!eV.StringUtils.startsWithNewLine(e)?" ":""))}return r.toString()})(this).split(/\r?\n/);for(let t=0;t<n.length;t++)t>0&&(e.newLine(),this.#tT.printStarsOnNewLine&&e.write(" *")),n[t].length>0&&(this.#tT.printStarsOnNewLine&&t>0&&e.space(),e.write(n[t]))}}class rx extends re{#tA=new n3(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forModifierableNode().printText(e,t),e.conditionalWrite(t.isConst,"const "),e.write(`enum ${t.name} `).inlineBlock(()=>{this.factory.forEnumMember().printTexts(e,t.members)})}}class rS extends re{#tA=new n5(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){if(t instanceof Function)return void t(e);if("string"==typeof t)return void e.write(t);if(this.factory.forJSDoc().printDocs(e,t.docs),ty(t.name)||eV.StringUtils.isQuoted(t.name)?e.write(t.name):e.quote(t.name),"string"==typeof t.value){let{value:n}=t;e.hangingIndent(()=>e.write(" = ").quote(n))}else"number"==typeof t.value?e.write(` = ${t.value}`):this.factory.forInitializerExpressionableNode().printText(e,t)}}class rE extends nZ{#tP;#tA=new n5(this);#tT={isAmbient:!1};constructor(e){super(),this.#tP=e}printTexts(e,t){this.#tA.printText(e,t)}printText(e,n){if("string"==typeof n||n instanceof Function||null==n)return void this.printTextOrWriterFunc(e,n);switch(n.kind){case t.StructureKind.PropertyAssignment:this.#tP.forPropertyAssignment().printText(e,n);break;case t.StructureKind.ShorthandPropertyAssignment:this.#tP.forShorthandPropertyAssignment().printText(e,n);break;case t.StructureKind.SpreadAssignment:this.#tP.forSpreadAssignment().printText(e,n);break;case t.StructureKind.Method:this.#tP.forMethodDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.GetAccessor:this.#tP.forGetAccessorDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.SetAccessor:this.#tP.forSetAccessorDeclaration(this.#tT).printText(e,n);break;default:eV.errors.throwNotImplementedForNeverValueError(n)}}}class rT extends re{printTextInternal(e,t){e.hangingIndent(()=>{e.write(`${t.name}: `),tf(e,t.initializer)})}}class rA extends re{printTextInternal(e,t){e.write(`${t.name}`)}}class rD extends re{printTextInternal(e,t){e.hangingIndent(()=>{e.write("..."),tf(e,t.expression)})}}class rC extends re{#tT;constructor(e,t){super(e),this.#tT=t}printTexts(e,t){if(null!=t)for(let n=0;n<t.length;n++){let r=t[n];if(n>0){let i=t[n-1];this.#tT.isAmbient||i.hasDeclareKeyword&&r.hasDeclareKeyword?e.newLine():e.blankLine()}this.printText(e,r)}}printTextInternal(e,t){this.#tR(e,t.name,function(){let e=eV.ObjectUtils.clone(t.overloads);if(null!=e&&0!==e.length){for(let n of e)td(n,"hasDeclareKeyword",t.hasDeclareKeyword),td(n,"isExported",t.isExported),td(n,"isDefaultExport",t.isDefaultExport);return e}}()),this.#tD(e,t.name,t),this.#tT.isAmbient||t.hasDeclareKeyword?e.write(";"):e.space().inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:!1}).printText(e,t)})}#tR(e,t,n){if(null!=n&&0!==n.length)for(let r of n)this.printOverload(e,t,r),e.newLine()}printOverload(e,t,n){this.printLeadingTrivia(e,n),this.#tD(e,t,n),e.write(";"),this.printTrailingTrivia(e,n)}#tD(e,t,n){this.factory.forJSDoc().printDocs(e,n.docs),this.factory.forModifierableNode().printText(e,n),e.write("function"),e.conditionalWrite(n.isGenerator,"*"),eV.StringUtils.isNullOrWhitespace(t)||e.write(` ${t}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,n.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,n.parameters),this.factory.forReturnTypedNode().printText(e,n)}}class rI extends re{#tA=new n6(this);printTextsWithParenthesis(e,t){e.write("("),null!=t&&this.factory.forParameterDeclaration().printTexts(e,t),e.write(")")}printTexts(e,t){null!=t&&0!==t.length&&e.hangingIndent(()=>{this.#tA.printText(e,t)})}printTextInternal(e,t){if(null==t.name)throw new eV.errors.NotImplementedError("Not implemented scenario where parameter declaration structure doesn't have a name. Please open an issue if you need this.");this.factory.forDecorator().printTextsInline(e,t.decorators),this.factory.forModifierableNode().printText(e,t),e.conditionalWrite(t.isRestParameter,"..."),e.write(t.name),e.conditionalWrite(t.hasQuestionToken,"?"),this.factory.forTypedNode(":",t.hasQuestionToken).printText(e,t),this.factory.forInitializerExpressionableNode().printText(e,t)}}class rN extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,t.parameters),this.factory.forReturnTypedNode(!0).printText(e,t),e.write(";")}}class rP extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),e.write("new"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,t.parameters),this.factory.forReturnTypedNode().printText(e,t),e.write(";")}}class rR extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forModifierableNode().printText(e,t),e.write(`[${t.keyName||"key"}: ${t.keyType||"string"}]`),this.factory.forReturnTypedNode().printText(e,t),e.write(";")}}class rM extends re{#tA=new n3(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){if(this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forModifierableNode().printText(e,t),e.write(`interface ${t.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),e.space(),null!=t.extends){let n=t.extends instanceof Array?t.extends.map(t=>this.getText(e,t)).join(", "):this.getText(e,t.extends);eV.StringUtils.isNullOrWhitespace(n)||e.hangingIndent(()=>e.write(`extends ${n} `))}e.inlineBlock(()=>{this.factory.forTypeElementMemberedNode().printText(e,t)})}}class rk extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),e.write(t.name),e.conditionalWrite(t.hasQuestionToken,"?"),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),this.factory.forParameterDeclaration().printTextsWithParenthesis(e,t.parameters),this.factory.forReturnTypedNode().printText(e,t),e.write(";")}}class rw extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forModifierableNode().printText(e,t),e.write(t.name),e.conditionalWrite(t.hasQuestionToken,"?"),this.factory.forTypedNode(":").printText(e,t),this.factory.forInitializerExpressionableNode().printText(e,t),e.write(";")}}class rL extends nZ{#tP;constructor(e){super(),this.#tP=e}printText(e,t){this.#tP.forCallSignatureDeclaration().printTexts(e,t.callSignatures),this.#tE(e,t.constructSignatures),this.#tP.forConstructSignatureDeclaration().printTexts(e,t.constructSignatures),this.#tE(e,t.indexSignatures),this.#tP.forIndexSignatureDeclaration().printTexts(e,t.indexSignatures),this.#tN(e,t),this.#tE(e,t.properties),this.#tP.forPropertySignature().printTexts(e,t.properties),this.#tE(e,t.methods),this.#tP.forMethodSignature().printTexts(e,t.methods)}#tN(e,t){if(null!=t.getAccessors||null!=t.setAccessors)new rt(this.#tP.forGetAccessorDeclaration({isAmbient:!0}),this.#tP.forSetAccessorDeclaration({isAmbient:!0})).printGetAndSet(e,t.getAccessors,t.setAccessors,!0)}#tE(e,t){eV.ArrayUtils.isNullOrEmpty(t)||e.isAtStartOfFirstLineOfBlock()||e.newLine()}}class rO extends nZ{#tP;constructor(e){super(),this.#tP=e}printTexts(e,t){if(null!=t)if("string"==typeof t||t instanceof Function)this.printText(e,t);else for(let n of t)rc(e)?e.blankLineIfLastNot():e.isAtStartOfFirstLineOfBlock()||e.newLineIfLastNot(),this.printText(e,n)}printText(e,n){if("string"==typeof n||n instanceof Function||null==n)return void this.printTextOrWriterFunc(e,n);switch(n.kind){case t.StructureKind.PropertySignature:this.#tP.forPropertySignature().printText(e,n);break;case t.StructureKind.MethodSignature:this.#tP.forMethodSignature().printText(e,n);break;case t.StructureKind.CallSignature:this.#tP.forCallSignatureDeclaration().printText(e,n);break;case t.StructureKind.IndexSignature:this.#tP.forIndexSignatureDeclaration().printText(e,n);break;case t.StructureKind.ConstructSignature:this.#tP.forConstructSignatureDeclaration().printText(e,n);break;default:eV.errors.throwNotImplementedForNeverValueError(n)}}}class rF extends re{printTextInternal(e,n){var r;if(null==n.kind||n.kind===t.StructureKind.JsxAttribute)this.factory.forJsxAttribute().printTextWithoutTrivia(e,n);else if(n.kind===t.StructureKind.JsxSpreadAttribute)this.factory.forJsxSpreadAttribute().printTextWithoutTrivia(e,n);else throw eV.errors.throwNotImplementedForNeverValueError(n)}}class rW extends re{printTextInternal(e,t){"object"==typeof t.name?this.factory.forJsxNamespacedName().printText(e,t.name):e.write(t.name),null!=t.initializer&&e.write("=").write(t.initializer)}}class rB extends re{printTextInternal(e,n){var r;null==(r=n).kind||r.kind===t.StructureKind.JsxElement?this.factory.forJsxElement().printText(e,n):n.kind===t.StructureKind.JsxSelfClosingElement?this.factory.forJsxSelfClosingElement().printText(e,n):eV.errors.throwNotImplementedForNeverValueError(n)}}class rz extends re{printTextInternal(e,t){e.hangingIndent(()=>{e.write(`<${t.name}`),t.attributes&&this.#tL(e,t.attributes),e.write(">")}),this.#tO(e,t.children),e.write(`</${t.name}>`)}#tL(e,t){let n=this.factory.forJsxAttributeDecider();for(let r of t)e.space(),n.printText(e,r)}#tO(e,t){null!=t&&(e.newLine(),e.indent(()=>{for(let n of t)this.factory.forJsxChildDecider().printText(e,n),e.newLine()}))}}class rG extends re{printTextInternal(e,t){e.write(t.namespace).write(":").write(t.name)}}class rj extends re{printTextInternal(e,t){e.hangingIndent(()=>{e.write(`<${t.name}`),t.attributes&&this.#tL(e,t.attributes),e.write(" />")})}#tL(e,t){let n=this.factory.forJsxAttributeDecider();for(let r of t)e.space(),n.printText(e,r)}}class rK extends re{printTextInternal(e,t){e.hangingIndent(()=>{e.write("{"),e.write("..."),e.write(t.expression),e.write("}")})}}class rV extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),e.write("export"),!1!==t.isExportEquals?e.write(" = "):e.write(" default "),e.write(this.getTextWithQueuedChildIndentation(e,t.expression)).write(";")}}class rU extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){let n=null!=t.moduleSpecifier&&t.moduleSpecifier.length>0;if(null!=t.namedExports&&t.namedExports.length>0&&null!=t.namespaceExport)throw new eV.errors.InvalidOperationError("An export declaration cannot have both a namespace export and a named export.");e.write("export"),t.isTypeOnly&&e.write(" type"),null!=t.namedExports&&t.namedExports.length>0?(e.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(e,t.namedExports)):null!=t.namespaceExport?(e.write(" *"),eV.StringUtils.isNullOrWhitespace(t.namespaceExport)||e.write(` as ${t.namespaceExport}`)):n?e.write(" *"):e.write(" {").conditionalWrite(this.factory.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces," ").write("}"),n&&(e.write(" from "),e.quote(t.moduleSpecifier)),t.attributes&&(e.space(),this.factory.forImportAttribute().printAttributes(e,t.attributes)),e.write(";")}}class rH extends re{#tA=new n5(this);printTexts(e,t){this.#tA.printText(e,t)}printAttributes(e,t){t&&(e.write("with "),e.inlineBlock(()=>{this.printTexts(e,t)}))}printTextInternal(e,t){e.write(t.name),e.write(": "),e.quote(t.value)}}class rq extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){let n=null!=t.namedImports&&t.namedImports.length>0;if(n&&null!=t.namespaceImport)throw new eV.errors.InvalidOperationError("An import declaration cannot have both a namespace import and a named import.");e.write("import"),t.isTypeOnly&&e.write(" type"),null!=t.defaultImport&&(e.write(` ${t.defaultImport}`),e.conditionalWrite(n||null!=t.namespaceImport,",")),null!=t.namespaceImport&&e.write(` * as ${t.namespaceImport}`),null!=t.namedImports&&t.namedImports.length>0&&(e.space(),this.factory.forNamedImportExportSpecifier().printTextsWithBraces(e,t.namedImports)),e.conditionalWrite(null!=t.defaultImport||n||null!=t.namespaceImport," from"),e.write(" "),e.quote(t.moduleSpecifier),t.attributes&&(e.space(),this.factory.forImportAttribute().printAttributes(e,t.attributes)),e.write(";")}}class rJ extends re{#tT;#tF=new n3(this);constructor(e,t){super(e),this.#tT=t}printTexts(e,t){this.#tF.printText(e,t)}printTextInternal(e,n){n=this.#tW(n),this.factory.forJSDoc().printDocs(e,n.docs),this.factory.forModifierableNode().printText(e,n),null==n.declarationKind||n.declarationKind!==t.ModuleDeclarationKind.Global?e.write(`${n.declarationKind||"namespace"} ${n.name}`):e.write("global"),n.hasDeclareKeyword&&eV.StringUtils.isQuoted(n.name.trim())&&n.hasOwnProperty(eV.nameof(n,"statements"))&&null==n.statements?e.write(";"):(e.write(" "),e.inlineBlock(()=>{this.factory.forStatementedNode({isAmbient:n.hasDeclareKeyword||this.#tT.isAmbient}).printText(e,n)}))}#tW(e){if(eV.StringUtils.isQuoted(e.name.trim())){if(e.declarationKind===t.ModuleDeclarationKind.Namespace)throw new eV.errors.InvalidOperationError(`Cannot print a namespace with quotes for namespace with name ${e.name}. Use ModuleDeclarationKind.Module instead.`);td(e=eV.ObjectUtils.clone(e),"hasDeclareKeyword",!0),td(e,"declarationKind",t.ModuleDeclarationKind.Module)}return e}}class r$ extends re{#tA=new n6(this);printTextsWithBraces(e,t){let n=this.factory.getFormatCodeSettings();e.write("{");let r=this.getNewWriter(e);this.printTexts(r,t);let i=r.toString();n.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!eV.StringUtils.startsWithNewLine(i)&&e.space(),e.write(i),n.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces&&!eV.StringUtils.endsWithNewLine(i)&&e.space(),e.write("}")}printTexts(e,t){t instanceof Function?this.printText(e,t):this.#tA.printText(e,t)}printTextInternal(e,t){let n=this.getNewWriterWithQueuedChildIndentation(e);"string"==typeof t?n.write(t):t instanceof Function?t(n):(t.isTypeOnly&&e.write("type "),n.write(t.name),eV.StringUtils.isNullOrWhitespace(t.alias)||(n.isLastNewLine()||n.space(),n.write(`as ${t.alias}`))),e.write(n.toString())}}class rX extends re{#tT;constructor(e,t){super(e),this.#tT=t}printTextInternal(e,t){this.factory.forStatementedNode(this.#tT).printText(e,t),e.conditionalNewLine(!e.isAtStartOfFirstLineOfBlock()&&!e.isLastNewLine())}}class rY extends nZ{#tT;#tP;constructor(e,t){super(),this.#tP=e,this.#tT=t}printText(e,t){this.#tP.forStatement(this.#tT).printTexts(e,t.statements)}}class rQ extends nZ{#tT;#tP;constructor(e,t){super(),this.#tP=e,this.#tT=t}printTexts(e,t){if(null!=t)if("string"==typeof t||t instanceof Function)this.printText(e,t);else for(let n of t)rc(e)?e.blankLineIfLastNot():e.isAtStartOfFirstLineOfBlock()||e.newLineIfLastNot(),this.printText(e,n)}printText(e,n){if("string"==typeof n||n instanceof Function||null==n)return void this.printTextOrWriterFunc(e,n);switch(n.kind){case t.StructureKind.Function:this.#tT.isAmbient||r(),this.#tP.forFunctionDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.Class:r(),this.#tP.forClassDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.Interface:r(),this.#tP.forInterfaceDeclaration().printText(e,n);break;case t.StructureKind.TypeAlias:this.#tP.forTypeAliasDeclaration().printText(e,n);break;case t.StructureKind.VariableStatement:this.#tP.forVariableStatement().printText(e,n);break;case t.StructureKind.ImportDeclaration:this.#tP.forImportDeclaration().printText(e,n);break;case t.StructureKind.Module:r(),this.#tP.forModuleDeclaration(this.#tT).printText(e,n);break;case t.StructureKind.Enum:r(),this.#tP.forEnumDeclaration().printText(e,n);break;case t.StructureKind.ExportDeclaration:this.#tP.forExportDeclaration().printText(e,n);break;case t.StructureKind.ExportAssignment:this.#tP.forExportAssignment().printText(e,n);break;default:eV.errors.throwNotImplementedForNeverValueError(n)}function r(){e.isAtStartOfFirstLineOfBlock()||e.blankLineIfLastNot()}}}t.VariableDeclarationKind=void 0,(ek=t.VariableDeclarationKind||(t.VariableDeclarationKind={})).Var="var",ek.Let="let",ek.Const="const",ek.AwaitUsing="await using",ek.Using="using";class rZ extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,n){this.factory.forJSDoc().printDocs(e,n.docs),e.hangingIndent(()=>{if(this.factory.forModifierableNode().printText(e,n),e.write(`${n.declarationKind||t.VariableDeclarationKind.Let} `),0===n.declarations.length)throw Error("You must provide at least one declaration when inserting a variable statement.");this.factory.forVariableDeclaration().printTexts(e,n.declarations),e.write(";")})}}class r0 extends re{#tA=new n7(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){this.factory.forJSDoc().printDocs(e,t.docs),this.factory.forModifierableNode().printText(e,t),e.write(`type ${t.name}`),this.factory.forTypeParameterDeclaration().printTextsWithBrackets(e,t.typeParameters),this.factory.forTypedNode(" =").printText(e,t),e.write(";")}}class r1 extends re{#tA=new n6(this);printTextsWithBrackets(e,t){null!=t&&0!==t.length&&(e.write("<"),this.printTexts(e,t),e.write(">"))}printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,n){if("string"==typeof n)return void e.write(n);e.hangingIndent(()=>{if(n.isConst&&e.write("const "),null!=n.variance&&((n.variance&t.TypeParameterVariance.In)!=0&&e.write("in "),(n.variance&t.TypeParameterVariance.Out)!=0&&e.write("out ")),e.write(n.name),null!=n.constraint){let t=this.getText(e,n.constraint);eV.StringUtils.isNullOrWhitespace(t)||e.write(` extends ${t}`)}if(null!=n.default){let t=this.getText(e,n.default);eV.StringUtils.isNullOrWhitespace(t)||e.write(` = ${t}`)}})}}class r2 extends re{#tA=new n6(this);printTexts(e,t){this.#tA.printText(e,t)}printTextInternal(e,t){e.write(t.name),e.conditionalWrite(t.hasExclamationToken,"!"),this.factory.forTypedNode(":").printText(e,t),this.factory.forInitializerExpressionableNode().printText(e,t)}}function r8(e){return class extends e{isGenerator(){return null!=this.compilerNode.asteriskToken}getAsteriskToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.asteriskToken)}getAsteriskTokenOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAsteriskToken(),e??"Expected to find an asterisk token.",this)}setIsGenerator(e){let t=this.getAsteriskToken();return null!=t===e||(null==t?nm({insertPos:function(e){if(e.getKind()===eV.SyntaxKind.FunctionDeclaration)return e.getFirstChildByKindOrThrow(eV.SyntaxKind.FunctionKeyword).getEnd();if(null==e.getName)throw new eV.errors.NotImplementedError("Expected a name node for a non-function declaration.");return e.getNameNode().getStart()}(this),parent:this,newText:"*"}):nb({children:[t],getSiblingFormatting:()=>eK.Space})),this}set(t){return tD(e.prototype,this,t),null!=t.isGenerator&&this.setIsGenerator(t.isGenerator),this}getStructure(){return tA(e.prototype,this,{isGenerator:this.isGenerator()})}}}function r3(e){return class extends e{getHeritageClauses(){let e=this.compilerNode.heritageClauses;return e?.map(e=>this._getNodeFromCompilerNode(e))??[]}getHeritageClauseByKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getHeritageClauseByKind(e),t??(()=>`Expected to have heritage clause of kind ${eV.getSyntaxKindName(e)}.`),this)}getHeritageClauseByKind(e){return this.getHeritageClauses().find(t=>t.compilerNode.token===e)}}}function r6(e){return class extends e{hasInitializer(){return null!=this.compilerNode.initializer}getInitializerIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getInitializerIfKind(e),t??`Expected to find an initializer of kind '${eV.getSyntaxKindName(e)}'.`,this)}getInitializerIfKind(e){let t=this.getInitializer();if(null==t||t.getKind()===e)return t}getInitializerOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getInitializer(),e??"Expected to find an initializer.",this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}}}function r4(e){var t;return t=r6(e),class extends t{removeInitializer(){let e=this.getInitializer();return null==e||nv({children:[e.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.EqualsToken),e],removePrecedingSpaces:!0}),this}setInitializer(e){let t=tp(this._getWriterWithQueuedChildIndentation(),e);eV.errors.throwIfWhitespaceOrNotString(t,"textOrWriterFunction"),this.hasInitializer()&&this.removeInitializer();let n=this.getLastChildIfKind(eV.SyntaxKind.SemicolonToken);return nm({insertPos:null!=n?n.getPos():this.getEnd(),parent:this,newText:` = ${t}`}),this}set(e){return tD(t.prototype,this,e),null!=e.initializer?this.setInitializer(e.initializer):e.hasOwnProperty(eV.nameof(e,"initializer"))&&this.removeInitializer(),this}getStructure(){let e=this.getInitializer();return tA(t.prototype,this,{initializer:e?e.getText():void 0})}}}function r5(e){return class extends e{getJsDocs(){let e=this.compilerNode.jsDoc;return e?.map(e=>this._getNodeFromCompilerNode(e))??[]}addJsDoc(e){return this.addJsDocs([e])[0]}addJsDocs(e){return this.insertJsDocs(tO(this.compilerNode.jsDoc),e)}insertJsDoc(e,t){return this.insertJsDocs(e,[t])[0]}insertJsDocs(e,t){if(eV.ArrayUtils.isNullOrEmpty(t))return[];let n=this._getWriterWithQueuedIndentation();this._context.structurePrinterFactory.forJSDoc().printDocs(n,t),n.write("");let r=n.toString(),i=this.getJsDocs();return nm({insertPos:(e=tX(e,i.length))===i.length?this.getStart():i[e].getStart(),parent:this,newText:r}),tU(i,this.getJsDocs(),e,!1)}set(t){return tD(e.prototype,this,t),null!=t.docs&&(this.getJsDocs().forEach(e=>e.remove()),this.addJsDocs(t.docs)),this}getStructure(){return tA(e.prototype,this,{docs:this.getJsDocs().map(e=>e.getStructure())})}}}function r7(e){return class extends e{getLiteralText(){return this.compilerNode.text}isTerminated(){return!this.compilerNode.isUnterminated}hasExtendedUnicodeEscape(){return this.compilerNode.hasExtendedUnicodeEscape||!1}}}function r9(e){return class extends e{getModifiers(){return this.getCompilerModifiers().map(e=>this._getNodeFromCompilerNode(e))}getFirstModifierByKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getFirstModifierByKind(e),t??(()=>`Expected a modifier of syntax kind: ${eV.getSyntaxKindName(e)}`),this)}getFirstModifierByKind(e){for(let t of this.getCompilerModifiers())if(t.kind===e)return this._getNodeFromCompilerNode(t)}hasModifier(e){return"string"==typeof e?this.getModifiers().some(t=>t.getText()===e):this.getCompilerModifiers().some(t=>t.kind===e)}toggleModifier(e,t){return null==t&&(t=!this.hasModifier(e)),t?this.addModifier(e):this.removeModifier(e),this}addModifier(e){let t,n,r=this.getModifiers(),i=this.getModifiers().filter(e=>e.getKind()!==eV.SyntaxKind.Decorator),o=i.find(t=>t.getText()===e);if(null!=o)return o;let a=function(t){let n=function(){if(i.length>0)return i[0].getStart();if(t.getKind()===eV.SyntaxKind.ArrowFunction)return t.getStart();for(let e of t._getChildrenIterator())if(!(e.getKind()===eV.SyntaxKind.SyntaxList||eV.ts.isJSDocCommentContainingNode(e.compilerNode)))return e.getStart();return t.getStart()}();for(let t of function(e){switch(e){case"export":case"public":case"protected":case"private":return[];case"default":case"const":return["export"];case"declare":return["export","default"];case"static":return["public","protected","private"];case"override":return["public","private","protected","static"];case"abstract":return["export","default","declare","public","private","protected","static","override"];case"async":case"readonly":return["export","default","declare","public","private","protected","static","override","abstract"];case"out":return["const","in"];case"in":return["const"];case"accessor":return["public","private","protected","declare","override","static","abstract","readonly"];default:eV.errors.throwNotImplementedForNeverValueError(e)}}(e))for(let e=0;e<i.length;e++){let r=i[e];if(r.getText()===t){n<r.getEnd()&&(n=r.getEnd());break}}return n}(this);return 0===i.length||a===i[0].getStart()?(n=e+" ",t=a):(n=" "+e,t=a+1),nm({parent:0===r.length?this:r[0].getParentSyntaxListOrThrow(),insertPos:a,newText:n}),this.getModifiers().find(e=>e.getStart()===t)}removeModifier(e){let t=this.getModifiers(),n=t.find(t=>t.getText()===e);return null!=n&&(nv({children:[1===t.length?n.getParentSyntaxListOrThrow():n],removeFollowingSpaces:!0}),!0)}getCompilerModifiers(){return this.compilerNode.modifiers??[]}}}function ie(e){return class extends e{addImportDeclaration(e){return this.addImportDeclarations([e])[0]}addImportDeclarations(e){let t=this._getCompilerStatementsWithComments();return this.insertImportDeclarations(function(){let e=0,n=!0;for(let r=0;r<t.length;r++){let i=t[r];n&&i.kind===eV.SyntaxKind.MultiLineCommentTrivia?e=r+1:(n=!1,i.kind===eV.SyntaxKind.ImportDeclaration&&(e=r+1))}return e}(),e)}insertImportDeclaration(e,t){return this.insertImportDeclarations(e,[t])[0]}insertImportDeclarations(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.ImportDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forImportDeclaration().printTexts(e,t)},{previousNewLine:e=>nL.isImportDeclaration(e)||tn(e.compilerNode),nextNewLine:e=>nL.isImportDeclaration(e)})}})}getImportDeclaration(e){return this.getImportDeclarations().find("string"==typeof e?t=>t.getModuleSpecifierValue()===e:e)}getImportDeclarationOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getImportDeclaration(e),t??"Expected to find an import with the provided condition.",this)}getImportDeclarations(){return this.getStatements().filter(nL.isImportDeclaration)}addExportDeclaration(e){return this.addExportDeclarations([e])[0]}addExportDeclarations(e){return this.insertExportDeclarations(this.getChildSyntaxListOrThrow().getChildCount(),e)}insertExportDeclaration(e,t){return this.insertExportDeclarations(e,[t])[0]}insertExportDeclarations(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.ExportDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forExportDeclaration().printTexts(e,t)},{previousNewLine:e=>nL.isExportDeclaration(e)||tn(e.compilerNode),nextNewLine:e=>nL.isExportDeclaration(e)})}})}getExportDeclaration(e){return this.getExportDeclarations().find("string"==typeof e?t=>t.getModuleSpecifierValue()===e:e)}getExportDeclarationOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getExportDeclaration(e),t??"Expected to find an export declaration with the provided condition.",this)}getExportDeclarations(){return this.getStatements().filter(nL.isExportDeclaration)}addExportAssignment(e){return this.addExportAssignments([e])[0]}addExportAssignments(e){return this.insertExportAssignments(this.getChildSyntaxListOrThrow().getChildCount(),e)}insertExportAssignment(e,t){return this.insertExportAssignments(e,[t])[0]}insertExportAssignments(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.ExportAssignment,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forExportAssignment().printTexts(e,t)},{previousNewLine:e=>nL.isExportAssignment(e)||tn(e.compilerNode),nextNewLine:e=>nL.isExportAssignment(e)})}})}getExportAssignment(e){return this.getExportAssignments().find(e)}getExportAssignmentOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getExportAssignment(e),t??"Expected to find an export assignment with the provided condition.",this)}getExportAssignments(){return this.getStatements().filter(nL.isExportAssignment)}getDefaultExportSymbol(){let e=this.getSymbol();if(null!=e)return e.getExport("default")}getDefaultExportSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDefaultExportSymbol(),e??"Expected to find a default export symbol")}getExportSymbols(){let e=this.getSymbol();return null==e?[]:this._context.typeChecker.getExportsOfModule(e)}getExportedDeclarations(){let e=new Map;for(let t of this.getExportSymbols())for(let n of t.getDeclarations()){let r=Array.from(function* e(t){if(nL.isExportSpecifier(t))for(let n of t.getLocalTargetDeclarations())yield*e(n);else if(nL.isExportAssignment(t)){let e=t.getExpression();if(null==e||e.getKind()!==eV.SyntaxKind.Identifier)return void(yield e);yield*n(e.getSymbol())}else if(nL.isImportSpecifier(t)){let e=t.getNameNode().getSymbol();if(null==e)return;yield*n(e.getAliasedSymbol()||e)}else if(nL.isImportClause(t)){let e=t.getDefaultImport();if(null==e)return;let r=e.getSymbol();if(null==r)return;yield*n(r.getAliasedSymbol()||r)}else if(nL.isNamespaceImport(t)||nL.isNamespaceExport(t)){let e=t.getNameNode().getSymbol();if(null==e)return;yield*n(e.getAliasedSymbol()||e)}else yield t;function*n(t){if(null!=t)for(let n of t.getDeclarations())yield*e(n)}}(n)),i=t.getName(),o=e.get(i);null!=o?o.push(...r):e.set(t.getName(),r)}return e}removeDefaultExport(e){if(null==(e=e||this.getDefaultExportSymbol()))return this;let t=e.getDeclarations()[0];return t.compilerNode.kind===eV.SyntaxKind.ExportAssignment?nb({children:[t],getSiblingFormatting:()=>eK.Newline}):nL.isModifierable(t)&&(t.toggleModifier("default",!1),t.toggleModifier("export",!1)),this}}}function it(e){return class extends e{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}getName(){return this.getNameNode().getText()}set(t){return tD(e.prototype,this,t),null!=t.name&&this.getNameNode().replaceWithText(t.name),this}getStructure(){return tA(e.prototype,this,{name:this.getName()})}}}function ir(e){return class extends e{findReferences(){return this._context.languageService.findReferences(ii(this))}findReferencesAsNodes(){return this._context.languageService.findReferencesAsNodes(ii(this))}}}function ii(e){if(nL.isIdentifier(e)||nL.isStringLiteral(e))return e;let t=e.getNodeProperty("name");return null!=t?t:nL.isExportable(e)&&e.getDefaultKeyword()||e}function io(e){return class extends e{rename(e,t){return nG(function(e){if(nL.isIdentifier(e)||nL.isPrivateIdentifier(e)||nL.isStringLiteral(e))return e;if(null!=e.getNameNode){let t=e.getNameNode();if(eV.errors.throwIfNullOrUndefined(t,"Expected to find a name node when renaming."),nL.isArrayBindingPattern(t)||nL.isObjectBindingPattern(t))throw new eV.errors.NotImplementedError(`Not implemented renameable scenario for ${t.getKindName()}.`);return t}throw new eV.errors.NotImplementedError(`Not implemented renameable scenario for ${e.getKindName()}`)}(this),e,t),this}}}function ia(e){return it(ir(io(e)))}function is(e){var t;return t=ir(io(e)),class extends t{getNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.name)}getNameNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getNameNode(),e??"Expected to have a name node.",this)}getName(){return this.getNameNode()?.getText()??void 0}getNameOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getName(),e??"Expected to have a name.",this)}rename(e){return e===this.getName()||(eV.StringUtils.isNullOrWhitespace(e)?this.removeName():null==this.getNameNode()?il(this,e):t.prototype.rename.call(this,e)),this}removeName(){let e=this.getNameNode();return null==e||nv({children:[e],removePrecedingSpaces:!0}),this}set(e){if(tD(t.prototype,this,e),null!=e.name){eV.errors.throwIfWhitespaceOrNotString(e.name,"structure.name");let t=this.getNameNode();null==t?il(this,e.name):t.replaceWithText(e.name)}else e.hasOwnProperty(eV.nameof(e,"name"))&&this.removeName();return this}getStructure(){return tA(t.prototype,this,{name:this.getName()})}}}function il(e,t){nL.isClassDeclaration(e)||nL.isClassExpression(e)?nm({insertPos:e.getFirstChildByKindOrThrow(eV.SyntaxKind.ClassKeyword).getEnd(),newText:" "+t,parent:e}):nm({insertPos:e.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenParenToken).getStart(),newText:" "+t,parent:e})}function ic(e){return it(io(ir(e)))}function id(e){return it(ir(io(e)))}function iu(e){return class extends e{hasOverrideKeyword(){return this.hasModifier(eV.SyntaxKind.OverrideKeyword)}getOverrideKeyword(){return this.getFirstModifierByKind(eV.SyntaxKind.OverrideKeyword)}getOverrideKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getOverrideKeyword(),e??"Expected to find an override keyword.",this)}setHasOverrideKeyword(e){return this.toggleModifier("override",e),this}set(t){return tD(e.prototype,this,t),null!=t.hasOverrideKeyword&&this.setHasOverrideKeyword(t.hasOverrideKeyword),this}getStructure(){return tA(e.prototype,this,{hasOverrideKeyword:this.hasOverrideKeyword()})}}}function ip(e){return class extends e{hasQuestionDotToken(){return null!=this.compilerNode.questionDotToken}getQuestionDotTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionDotToken)}getQuestionDotTokenNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getQuestionDotTokenNode(),e??"Expected to find a question dot token.",this)}setHasQuestionDotToken(e){let t=this.getQuestionDotTokenNode();return e===(null!=t)||(e?nL.isPropertyAccessExpression(this)?this.getFirstChildByKindOrThrow(eV.SyntaxKind.DotToken).replaceWithText("?."):nm({insertPos:(function(){return nL.isCallExpression(this)?this.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenParenToken).getStart():nL.isElementAccessExpression(this)?this.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenBracketToken).getStart():void eV.errors.throwNotImplementedForSyntaxKindError(this.compilerNode.kind)}).call(this),parent:this,newText:"?."}):nL.isPropertyAccessExpression(this)?t.replaceWithText("."):nv({children:[t]})),this}set(t){return tD(e.prototype,this,t),null!=t.hasQuestionDotToken&&this.setHasQuestionDotToken(t.hasQuestionDotToken),this}getStructure(){return tA(e.prototype,this,{hasQuestionDotToken:this.hasQuestionDotToken()})}}}function im(e){return class extends e{hasQuestionToken(){return null!=this.compilerNode.questionToken}getQuestionTokenNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getQuestionTokenNode(),e??"Expected to find a question token.",this)}setHasQuestionToken(e){let t=this.getQuestionTokenNode();return e===(null!=t)||(e?(nL.isExclamationTokenable(this)&&this.setHasExclamationToken(!1),nm({insertPos:(function(){if(nL.hasName(this))return this.getNameNode().getEnd();let e=this.getFirstChildByKind(eV.SyntaxKind.ColonToken);if(null!=e)return e.getStart();let t=this.getLastChildByKind(eV.SyntaxKind.SemicolonToken);return null!=t?t.getStart():this.getEnd()}).call(this),parent:this,newText:"?"})):nv({children:[t]})),this}set(t){return tD(e.prototype,this,t),null!=t.hasQuestionToken&&this.setHasQuestionToken(t.hasQuestionToken),this}getStructure(){return tA(e.prototype,this,{hasQuestionToken:this.hasQuestionToken()})}}}function i_(e){return class extends e{isReadonly(){return null!=this.getReadonlyKeyword()}getReadonlyKeyword(){return this.getFirstModifierByKind(eV.SyntaxKind.ReadonlyKeyword)}getReadonlyKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getReadonlyKeyword(),e??"Expected to find a readonly keyword.",this)}setIsReadonly(e){return this.toggleModifier("readonly",e),this}set(t){return tD(e.prototype,this,t),null!=t.isReadonly&&this.setIsReadonly(t.isReadonly),this}getStructure(){return tA(e.prototype,this,{isReadonly:this.isReadonly()})}}}function ih(e){return class extends e{getReturnType(){return this.getSignature().getReturnType()}getReturnTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getReturnTypeNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getReturnTypeNode(),e??"Expected to find a return type node.",this)}setReturnType(e){var t;let n=tp(this._getWriterWithQueuedChildIndentation(),e);if(eV.StringUtils.isNullOrWhitespace(n))return this.removeReturnType();let r=this.getReturnTypeNode();return null!=r?r.getText()!==n&&r.replaceWithText(n):nm({parent:this,insertPos:(t=this,t.getKind()===eV.SyntaxKind.IndexSignature?t.getFirstChildByKindOrThrow(eV.SyntaxKind.CloseBracketToken):t.getFirstChildByKindOrThrow(eV.SyntaxKind.CloseParenToken)).getEnd(),newText:`: ${n}`}),this}removeReturnType(){let e=this.getReturnTypeNode();return null==e||nv({children:[e.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.ColonToken),e],removePrecedingSpaces:!0}),this}getSignature(){let e=this._context.typeChecker.getSignatureFromNode(this);if(null==e)throw new eV.errors.NotImplementedError("Expected the node to have a signature.");return e}set(t){return tD(e.prototype,this,t),null!=t.returnType?this.setReturnType(t.returnType):t.hasOwnProperty(eV.nameof(t,"returnType"))&&this.removeReturnType(),this}getStructure(){let t=this.getReturnTypeNode();return tA(e.prototype,this,{returnType:t?t.getText({trimLeadingIndentation:!0}):void 0})}}}function ig(e){let n=e.getCombinedModifierFlags();return(n&eV.ts.ModifierFlags.Private)!=0?t.Scope.Private:(n&eV.ts.ModifierFlags.Protected)!=0?t.Scope.Protected:(n&eV.ts.ModifierFlags.Public)!=0?t.Scope.Public:void 0}function iy(e,n){e.toggleModifier("public",n===t.Scope.Public),e.toggleModifier("protected",n===t.Scope.Protected),e.toggleModifier("private",n===t.Scope.Private)}function iv(e){return class extends e{getScope(){return ig(this)||t.Scope.Public}setScope(e){return iy(this,e),this}hasScopeKeyword(){return null!=ig(this)}set(t){return tD(e.prototype,this,t),t.hasOwnProperty(eV.nameof(t,"scope"))&&this.setScope(t.scope),this}getStructure(){return tA(e.prototype,this,{scope:this.hasScopeKeyword()?this.getScope():void 0})}}}function ib(e){var t;return ih((t=e,class extends t{getParameter(e){return e$(this.getParameters(),e)}getParameterOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getParameter(e),()=>eY("parameter",e))}getParameters(){return this.compilerNode.parameters.map(e=>this._getNodeFromCompilerNode(e))}addParameter(e){return this.addParameters([e])[0]}addParameters(e){return this.insertParameters(tO(this.compilerNode.parameters),e)}insertParameter(e,t){return this.insertParameters(e,[t])[0]}insertParameters(e,t){if(eV.ArrayUtils.isNullOrEmpty(t))return[];let n=this.getParameters(),r=this.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenParenToken).getNextSiblingIfKindOrThrow(eV.SyntaxKind.SyntaxList);e=tX(e,n.length);let i=this._getWriterWithQueuedChildIndentation();return this._context.structurePrinterFactory.forParameterDeclaration().printTexts(i,t),n_({parent:r,currentNodes:n,insertIndex:e,newText:i.toString(),useTrailingCommas:!1}),tU(n,this.getParameters(),e,!1)}set(e){return tD(t.prototype,this,e),null!=e.parameters&&(this.getParameters().forEach(e=>e.remove()),this.addParameters(e.parameters)),this}getStructure(){return tA(t.prototype,this,{parameters:this.getParameters().map(e=>e.getStructure())})}}))}function ix(e){return class extends e{isStatic(){return this.hasModifier(eV.SyntaxKind.StaticKeyword)}getStaticKeyword(){return this.getFirstModifierByKind(eV.SyntaxKind.StaticKeyword)}getStaticKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getStaticKeyword(),e??"Expected to find a static keyword.",this)}setIsStatic(e){return this.toggleModifier("static",e),this}set(t){return tD(e.prototype,this,t),null!=t.isStatic&&this.setIsStatic(t.isStatic),this}getStructure(){return tA(e.prototype,this,{isStatic:this.isStatic()})}}}function iS(e){return class extends e{insertText(e,t){return this.replaceText([e,e],t),this}removeText(e,t){return null==e?this.replaceText(iE(this),""):this.replaceText([e,t],""),this}replaceText(e,t){let n=this.getChildSyntaxListOrThrow(),r=iE(this),i=e[0],o=e[1];return function(){if(a(i),a(o),i>o)throw new eV.errors.ArgumentError("range","Cannot specify a start position greater than the end position.")}(),nm({insertPos:i,newText:tp(this._getWriter(),t),parent:n.getParentOrThrow(),replacing:{textLength:o-i,nodes:[n]}}),this;function a(e){if(!(e>=r[0])||!(e<=r[1]))throw new eV.errors.InvalidOperationError(`Cannot insert or replace text outside the bounds of the node. Expected a position between [${r[0]}, ${r[1]}], but received ${e}.`)}}}}function iE(e){let t=nL.isSourceFile(e)?e:e.getChildSyntaxListOrThrow(),n=nL.isSourceFile(t)?void 0:t.getPreviousSiblingIfKind(eV.SyntaxKind.OpenBraceToken),r=null==n?void 0:t.getNextSiblingIfKind(eV.SyntaxKind.CloseBraceToken);return null!=n&&null!=r?[n.getEnd(),r.getStart()]:[t.getPos(),t.getEnd()]}function iT(e){return class extends e{getTypeArguments(){return null==this.compilerNode.typeArguments?[]:this.compilerNode.typeArguments.map(e=>this._getNodeFromCompilerNode(e))}addTypeArgument(e){return this.addTypeArguments([e])[0]}addTypeArguments(e){return this.insertTypeArguments(this.getTypeArguments().length,e)}insertTypeArgument(e,t){return this.insertTypeArguments(e,[t])[0]}insertTypeArguments(e,t){if(eV.ArrayUtils.isNullOrEmpty(t))return[];let n=this.getTypeArguments();return e=tX(e,n.length),0===n.length?nm({insertPos:this.getFirstChildByKindOrThrow(eV.SyntaxKind.Identifier).getEnd(),parent:this,newText:`<${t.join(", ")}>`}):n_({parent:this.getFirstChildByKindOrThrow(eV.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:n,insertIndex:e,newText:t.join(", "),useTrailingCommas:!1}),tU(n,this.getTypeArguments(),e,!1)}removeTypeArgument(e){let t=this.getTypeArguments();if(0===t.length)throw new eV.errors.InvalidOperationError("Cannot remove a type argument when none exist.");let n="number"==typeof e?t[tX(e,t.length-1)]:e;if(1===t.length){let e=t[0].getParentSyntaxListOrThrow();nv({children:[e.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.LessThanToken),e,e.getNextSiblingIfKindOrThrow(eV.SyntaxKind.GreaterThanToken)]})}else nE(n);return this}}}function iA(e){return class extends e{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTypeNode(),e??"Expected to find a type node.",this)}setType(e){let t,n,r=tp(this._getWriterWithQueuedChildIndentation(),e);if(eV.StringUtils.isNullOrWhitespace(r))return this.removeType();let i=this.getTypeNode();if(null!=i&&i.getText()===r)return this;let o=iD(this);return null==this.getFirstChildByKind(o)?(t=function(e){let t=e.getFirstChildByKind(eV.SyntaxKind.Identifier)??e.getFirstChildByKind(eV.SyntaxKind.ArrayBindingPattern)??e.getFirstChildIfKindOrThrow(eV.SyntaxKind.ObjectBindingPattern,"A first child of the kind Identifier, ArrayBindingPattern, or ObjectBindingPattern was expected."),n=t.getNextSibling();return(!function(e){if(null==e)return!1;let t=e.getKind();return t===eV.SyntaxKind.QuestionToken||t===eV.SyntaxKind.ExclamationToken}(n)?t:n).getEnd()}(this),n=(o===eV.SyntaxKind.EqualsToken?" = ":": ")+r):(t=i.getStart(),n=r),nm({parent:this,insertPos:t,newText:n,replacing:{textLength:null==i?0:i.getWidth()}}),this}set(t){return tD(e.prototype,this,t),null!=t.type?this.setType(t.type):t.hasOwnProperty(eV.nameof(t,"type"))&&this.removeType(),this}removeType(){if(this.getKind()===eV.SyntaxKind.TypeAliasDeclaration)throw new eV.errors.NotSupportedError(`Cannot remove the type of a type alias. Use ${eV.nameof("setType")} instead.`);let e=this.getTypeNode();return null==e||nv({children:[e.getPreviousSiblingIfKindOrThrow(iD(this)),e],removePrecedingSpaces:!0}),this}getStructure(){let t=this.getTypeNode();return tA(e.prototype,this,{type:t?t.getText({trimLeadingIndentation:!0}):void 0})}}}function iD(e){return e.getKind()===eV.SyntaxKind.TypeAliasDeclaration?eV.SyntaxKind.EqualsToken:eV.SyntaxKind.ColonToken}function iC(e){return class extends e{addMember(e){return this.addMembers([e])[0]}addMembers(e){return this.insertMembers(tO(this.getMembersWithComments()),e)}insertMember(e,t){return this.insertMembers(e,[t])[0]}insertMembers(e,t){return ny({getIndexedChildren:()=>this.getMembersWithComments(),index:e,parent:this,write:e=>{e.newLineIfLastNot();let n=this._getWriter();this._context.structurePrinterFactory.forTypeElementMember().printTexts(n,t),e.write(n.toString()),e.newLineIfLastNot()}})}addConstructSignature(e){return this.addConstructSignatures([e])[0]}addConstructSignatures(e){return this.insertConstructSignatures(tO(this.getMembersWithComments()),e)}insertConstructSignature(e,t){return this.insertConstructSignatures(e,[t])[0]}insertConstructSignatures(e,t){return iI({thisNode:this,index:e,structures:t,expectedKind:eV.SyntaxKind.ConstructSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forConstructSignatureDeclaration()})}getConstructSignature(e){return this.getConstructSignatures().find(e)}getConstructSignatureOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getConstructSignature(e),t??"Expected to find a construct signature with the provided condition.",this)}getConstructSignatures(){return this.compilerNode.members.filter(e=>e.kind===eV.SyntaxKind.ConstructSignature).map(e=>this._getNodeFromCompilerNode(e))}addCallSignature(e){return this.addCallSignatures([e])[0]}addCallSignatures(e){return this.insertCallSignatures(tO(this.getMembersWithComments()),e)}insertCallSignature(e,t){return this.insertCallSignatures(e,[t])[0]}insertCallSignatures(e,t){return iI({thisNode:this,index:e,structures:t,expectedKind:eV.SyntaxKind.CallSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forCallSignatureDeclaration()})}getCallSignature(e){return this.getCallSignatures().find(e)}getCallSignatureOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getCallSignature(e),t??"Expected to find a call signature with the provided condition.",this)}getCallSignatures(){return this.compilerNode.members.filter(e=>e.kind===eV.SyntaxKind.CallSignature).map(e=>this._getNodeFromCompilerNode(e))}addIndexSignature(e){return this.addIndexSignatures([e])[0]}addIndexSignatures(e){return this.insertIndexSignatures(tO(this.getMembersWithComments()),e)}insertIndexSignature(e,t){return this.insertIndexSignatures(e,[t])[0]}insertIndexSignatures(e,t){return iI({thisNode:this,index:e,structures:t,expectedKind:eV.SyntaxKind.IndexSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forIndexSignatureDeclaration()})}getIndexSignature(e){return this.getIndexSignatures().find(e)}getIndexSignatureOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getIndexSignature(e),t??"Expected to find a index signature with the provided condition.",this)}getIndexSignatures(){return this.compilerNode.members.filter(e=>e.kind===eV.SyntaxKind.IndexSignature).map(e=>this._getNodeFromCompilerNode(e))}addMethod(e){return this.addMethods([e])[0]}addMethods(e){return this.insertMethods(tO(this.getMembersWithComments()),e)}insertMethod(e,t){return this.insertMethods(e,[t])[0]}insertMethods(e,t){return iI({thisNode:this,index:e,structures:t,expectedKind:eV.SyntaxKind.MethodSignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forMethodSignature()})}getMethod(e){return e$(this.getMethods(),e)}getMethodOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getMethod(e),()=>eY("interface method signature",e))}getMethods(){return this.compilerNode.members.filter(e=>e.kind===eV.SyntaxKind.MethodSignature).map(e=>this._getNodeFromCompilerNode(e))}addProperty(e){return this.addProperties([e])[0]}addProperties(e){return this.insertProperties(tO(this.getMembersWithComments()),e)}insertProperty(e,t){return this.insertProperties(e,[t])[0]}insertProperties(e,t){return iI({thisNode:this,index:e,structures:t,expectedKind:eV.SyntaxKind.PropertySignature,createStructurePrinter:()=>this._context.structurePrinterFactory.forPropertySignature()})}getProperty(e){return e$(this.getProperties(),e)}getPropertyOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getProperty(e),()=>eY("interface property signature",e))}getProperties(){return this.compilerNode.members.filter(e=>e.kind===eV.SyntaxKind.PropertySignature).map(e=>this._getNodeFromCompilerNode(e))}addGetAccessor(e){return this.addGetAccessors([e])[0]}addGetAccessors(e){let t=[];for(let n of e){let e=this.getSetAccessor(n.name),r=null==e?tO(this.getMembersWithComments()):e.getChildIndex();t.push(this.insertGetAccessor(r,n))}return t}insertGetAccessor(e,t){return this.insertGetAccessors(e,[t])[0]}insertGetAccessors(e,t){return iI({thisNode:this,index:e,structures:t,expectedKind:eV.SyntaxKind.GetAccessor,createStructurePrinter:()=>this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:!0})})}getGetAccessor(e){return e$(this.getGetAccessors(),e)}getGetAccessorOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getGetAccessor(e),()=>eY("interface get accessor",e))}getGetAccessors(){return this.compilerNode.members.filter(e=>e.kind===eV.SyntaxKind.GetAccessor).map(e=>this._getNodeFromCompilerNode(e))}addSetAccessor(e){return this.addSetAccessors([e])[0]}addSetAccessors(e){let t=[];for(let n of e){let e=this.getGetAccessor(n.name),r=null==e?tO(this.getMembersWithComments()):e.getChildIndex()+1;t.push(this.insertSetAccessor(r,n))}return t}insertSetAccessor(e,t){return this.insertSetAccessors(e,[t])[0]}insertSetAccessors(e,t){return iI({thisNode:this,index:e,structures:t,expectedKind:eV.SyntaxKind.SetAccessor,createStructurePrinter:()=>this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:!0})})}getSetAccessor(e){return e$(this.getSetAccessors(),e)}getSetAccessorOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getSetAccessor(e),()=>eY("interface set accessor",e))}getSetAccessors(){return this.compilerNode.members.filter(e=>e.kind===eV.SyntaxKind.SetAccessor).map(e=>this._getNodeFromCompilerNode(e))}getMembers(){return this.compilerNode.members.map(e=>this._getNodeFromCompilerNode(e))}getMembersWithComments(){let e=this.compilerNode;return te.getContainerArray(e,this._sourceFile.compilerNode).map(e=>this._getNodeFromCompilerNode(e))}set(t){return tD(e.prototype,this,t),null!=t.callSignatures&&(this.getCallSignatures().forEach(e=>e.remove()),this.addCallSignatures(t.callSignatures)),null!=t.constructSignatures&&(this.getConstructSignatures().forEach(e=>e.remove()),this.addConstructSignatures(t.constructSignatures)),null!=t.indexSignatures&&(this.getIndexSignatures().forEach(e=>e.remove()),this.addIndexSignatures(t.indexSignatures)),null!=t.properties&&(this.getProperties().forEach(e=>e.remove()),this.addProperties(t.properties)),null!=t.getAccessors&&(this.getGetAccessors().forEach(e=>e.remove()),this.addGetAccessors(t.getAccessors)),null!=t.setAccessors&&(this.getSetAccessors().forEach(e=>e.remove()),this.addSetAccessors(t.setAccessors)),null!=t.methods&&(this.getMethods().forEach(e=>e.remove()),this.addMethods(t.methods)),this}getStructure(){return tA(e.prototype,this,{callSignatures:this.getCallSignatures().map(e=>e.getStructure()),constructSignatures:this.getConstructSignatures().map(e=>e.getStructure()),getAccessors:this.getGetAccessors().map(e=>e.getStructure()),indexSignatures:this.getIndexSignatures().map(e=>e.getStructure()),methods:this.getMethods().map(e=>e.getStructure()),properties:this.getProperties().map(e=>e.getStructure()),setAccessors:this.getSetAccessors().map(e=>e.getStructure())})}}}function iI(e){return ng({getIndexedChildren:()=>e.thisNode.getMembersWithComments(),parent:e.thisNode,index:e.index,structures:e.structures,expectedKind:e.expectedKind,write:(t,n)=>{t.newLineIfLastNot(),e.createStructurePrinter().printTexts(t,e.structures),t.newLineIfLastNot()}})}function iN(e){return class extends e{getTypeParameter(e){return e$(this.getTypeParameters(),e)}getTypeParameterOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTypeParameter(e),()=>eY("type parameter",e))}getTypeParameters(){let e=this.compilerNode.typeParameters;return null==e?[]:e.map(e=>this._getNodeFromCompilerNode(e))}addTypeParameter(e){return this.addTypeParameters([e])[0]}addTypeParameters(e){return this.insertTypeParameters(tO(this.compilerNode.typeParameters),e)}insertTypeParameter(e,t){return this.insertTypeParameters(e,[t])[0]}insertTypeParameters(e,t){if(eV.ArrayUtils.isNullOrEmpty(t))return[];let n=this.getTypeParameters(),r=this._getWriterWithQueuedChildIndentation(),i=this._context.structurePrinterFactory.forTypeParameterDeclaration();return e=tX(e,n.length),i.printTexts(r,t),0===n.length?nm({insertPos:function(e){if(null!=e.getNameNode)return e.getNameNode().getEnd();if(nL.isCallSignatureDeclaration(e)||nL.isFunctionTypeNode(e))return e.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenParenToken).getStart();throw new eV.errors.NotImplementedError(`Not implemented scenario inserting type parameters for node with kind ${e.getKindName()}.`)}(this),parent:this,newText:`<${r.toString()}>`}):n_({parent:this.getFirstChildByKindOrThrow(eV.SyntaxKind.LessThanToken).getNextSiblingIfKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:n,insertIndex:e,newText:r.toString(),useTrailingCommas:!1}),tU(n,this.getTypeParameters(),e,!1)}set(t){return tD(e.prototype,this,t),null!=t.typeParameters&&(this.getTypeParameters().forEach(e=>e.remove()),this.addTypeParameters(t.typeParameters)),this}getStructure(){return tA(e.prototype,this,{typeParameters:this.getTypeParameters().map(e=>e.getStructure())})}}}function iP(e){return class extends e{unwrap(){nf(this._sourceFile,new nu(this),new ne().getForUnwrappingNode(this))}}}let iR=nJ(r4(ia(nL)));function iM(e){return class extends e{isAbstract(){return null!=this.getAbstractKeyword()}getAbstractKeyword(){return this.getFirstModifierByKind(eV.SyntaxKind.AbstractKeyword)}getAbstractKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAbstractKeyword(),e??"Expected to find an abstract keyword.",this)}setIsAbstract(e){return this.toggleModifier("abstract",e),this}set(t){return tD(e.prototype,this,t),null!=t.isAbstract&&this.setIsAbstract(t.isAbstract),this}getStructure(){return tA(e.prototype,this,{isAbstract:this.isAbstract()})}}}class ik extends nL{getContextualType(){return this._context.typeChecker.getContextualType(this)}}let iw=ik;class iL extends iw{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}}let iO=iL;class iF extends iO{getOperatorToken(){return this._getNodeFromCompilerNode(this.compilerNode.operatorToken)}}class iW extends ik{}class iB extends iW{}class iz extends iB{}class iG extends iz{}class ij extends iG{}function iK(e){return class extends e{getExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.expression)}getExpressionOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getExpression(),e??"Expected to find an expression.",this)}getExpressionIfKind(e){let t=this.getExpression();return t?.getKind()===e?t:void 0}getExpressionIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getExpressionIfKind(e),t??`An expression with the kind kind ${eV.getSyntaxKindName(e)} was expected.`,this)}}}function iV(e){return class extends e{getExpression(){return this._getNodeFromCompilerNode(this.compilerNode.expression)}getExpressionIfKind(e){let{expression:t}=this.compilerNode;return t.kind===e?this._getNodeFromCompilerNode(t):void 0}getExpressionIfKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getExpressionIfKind(e),t??`An expression of the kind ${eV.getSyntaxKindName(e)} was expected.`,this)}setExpression(e){return this.getExpression().replaceWithText(e,this._getWriterWithQueuedChildIndentation()),this}set(t){return tD(e.prototype,this,t),null!=t.expression&&this.setExpression(t.expression),this}}}let iU=iA(iV(ik)),iH=iV(iW),iq=iT(nN(ip(iV(iz)))),iJ=ik,i$=ik,iX=iV(iW),iY=ip(iV(iG));class iQ extends iY{getArgumentExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.argumentExpression)}getArgumentExpressionOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getArgumentExpression(),e??"Expected to find an argument expression.",this)}}let iZ=ij,i0=r7(ij);class i1 extends i0{}let i2=ic(ij),i8=iT(nN(iV(ij))),i3=iV(iz);class i6 extends nL{remove(){nE(this)}}class i4 extends i6{}let i5=ij,i7=r6(im(id(i6))),i9=r6(im(ic(i6))),oe=iV(i6),ot=ik,on=iV(ik),or=iV(ik),oi=iW,oo=iW,oa=ic(ip(iV(iG)));class os extends oa{}let ol=iA(iV(ik)),oc=iV(ik),od=(iV(iQ),ij),ou=(iV(os),ij),op=iA(iV(iW)),of=iV(iW),om=iV(iW),o_=iK(r8(ik)),oh=nU(nL);class og extends oh{remove(){nT([this])}}function oy(e){return class extends e{getStatements(){let e=this._getCompilerStatementsContainer();return(e?.statements??[]).map(e=>this._getNodeFromCompilerNode(e))}getStatementsWithComments(){return this._getCompilerStatementsWithComments().map(e=>this._getNodeFromCompilerNode(e))}getStatement(e){return this.getStatements().find(e)}getStatementOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getStatement(e),t??"Expected to find a statement matching the provided condition.",this)}getStatementByKind(e){let t=this._getCompilerStatementsWithComments().find(t=>t.kind===e);return this._getNodeFromCompilerNodeIfExists(t)}getStatementByKindOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getStatementByKind(e),t??`Expected to find a statement with syntax kind ${eV.getSyntaxKindName(e)}.`,this)}addStatements(e){return this.insertStatements(this._getCompilerStatementsWithComments().length,e)}insertStatements(e,t){return ov(this),(function(){let e=this.getChildSyntaxListOrThrow();if(nL.isCaseClause(this)||nL.isDefaultClause(this)){let t=e.getFirstChildIfKind(eV.SyntaxKind.Block);if(null!=t)return t.getChildSyntaxListOrThrow()}return e}).call(this).insertChildText(e,e=>{this._context.structurePrinterFactory.forStatement({isAmbient:to(this)}).printTexts(e,t)})}removeStatement(e){return e=tX(e,this._getCompilerStatementsWithComments().length-1),this.removeStatements([e,e])}removeStatements(e){let t=this.getStatementsWithComments();return eV.errors.throwIfRangeOutOfRange(e,[0,t.length],"indexRange"),nT(t.slice(e[0],e[1]+1)),this}addClass(e){return this.addClasses([e])[0]}addClasses(e){return this.insertClasses(this._getCompilerStatementsWithComments().length,e)}insertClass(e,t){return this.insertClasses(e,[t])[0]}insertClasses(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.ClassDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forClassDeclaration({isAmbient:to(this)}).printTexts(e,t)})}})}getClasses(){return this.getStatements().filter(nL.isClassDeclaration)}getClass(e){return e$(this.getClasses(),e)}getClassOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getClass(e),()=>eY("class",e))}addEnum(e){return this.addEnums([e])[0]}addEnums(e){return this.insertEnums(this._getCompilerStatementsWithComments().length,e)}insertEnum(e,t){return this.insertEnums(e,[t])[0]}insertEnums(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.EnumDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forEnumDeclaration().printTexts(e,t)})}})}getEnums(){return this.getStatements().filter(nL.isEnumDeclaration)}getEnum(e){return e$(this.getEnums(),e)}getEnumOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getEnum(e),()=>eY("enum",e))}addFunction(e){return this.addFunctions([e])[0]}addFunctions(e){return this.insertFunctions(this._getCompilerStatementsWithComments().length,e)}insertFunction(e,t){return this.insertFunctions(e,[t])[0]}insertFunctions(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.FunctionDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:to(this)}).printTexts(e,t)},{previousNewLine:e=>!0===t[0].hasDeclareKeyword&&nL.isFunctionDeclaration(e)&&null==e.getBody(),nextNewLine:e=>!0===t[t.length-1].hasDeclareKeyword&&nL.isFunctionDeclaration(e)&&null==e.getBody()})}})}getFunctions(){return this.getStatements().filter(nL.isFunctionDeclaration).filter(e=>e.isAmbient()||e.isImplementation())}getFunction(e){return e$(this.getFunctions(),e)}getFunctionOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getFunction(e),()=>eY("function",e))}addInterface(e){return this.addInterfaces([e])[0]}addInterfaces(e){return this.insertInterfaces(this._getCompilerStatementsWithComments().length,e)}insertInterface(e,t){return this.insertInterfaces(e,[t])[0]}insertInterfaces(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.InterfaceDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forInterfaceDeclaration().printTexts(e,t)})}})}getInterfaces(){return this.getStatements().filter(nL.isInterfaceDeclaration)}getInterface(e){return e$(this.getInterfaces(),e)}getInterfaceOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getInterface(e),()=>eY("interface",e))}addModule(e){return this.addModules([e])[0]}addModules(e){return this.insertModules(this._getCompilerStatementsWithComments().length,e)}insertModule(e,t){return this.insertModules(e,[t])[0]}insertModules(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.ModuleDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forModuleDeclaration({isAmbient:to(this)}).printTexts(e,t)})}})}getModules(){return this.getStatements().filter(nL.isModuleDeclaration)}getModule(e){return e$(this.getModules(),e)}getModuleOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getModule(e),()=>eY("module",e))}addTypeAlias(e){return this.addTypeAliases([e])[0]}addTypeAliases(e){return this.insertTypeAliases(this._getCompilerStatementsWithComments().length,e)}insertTypeAlias(e,t){return this.insertTypeAliases(e,[t])[0]}insertTypeAliases(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.TypeAliasDeclaration,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forTypeAliasDeclaration().printTexts(e,t)},{previousNewLine:e=>nL.isTypeAliasDeclaration(e),nextNewLine:e=>nL.isTypeAliasDeclaration(e)})}})}getTypeAliases(){return this.getStatements().filter(nL.isTypeAliasDeclaration)}getTypeAlias(e){return e$(this.getTypeAliases(),e)}getTypeAliasOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTypeAlias(e),()=>eY("type alias",e))}getVariableStatements(){return this.getStatements().filter(nL.isVariableStatement)}getVariableStatement(e){return this.getVariableStatements().find("string"==typeof e?t=>t.getDeclarations().some(t=>eX(t,e)):e)}getVariableStatementOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getVariableStatement(e),t??"Expected to find a variable statement that matched the provided condition.",this)}addVariableStatement(e){return this.addVariableStatements([e])[0]}addVariableStatements(e){return this.insertVariableStatements(this._getCompilerStatementsWithComments().length,e)}insertVariableStatement(e,t){return this.insertVariableStatements(e,[t])[0]}insertVariableStatements(e,t){return this._insertChildren({expectedKind:eV.SyntaxKind.VariableStatement,index:e,structures:t,write:(e,n)=>{this._standardWrite(e,n,()=>{this._context.structurePrinterFactory.forVariableStatement().printTexts(e,t)},{previousNewLine:e=>nL.isVariableStatement(e),nextNewLine:e=>nL.isVariableStatement(e)})}})}getVariableDeclarations(){let e=[];for(let t of this.getVariableStatements())e.push(...t.getDeclarations());return e}getVariableDeclaration(e){return e$(this.getVariableDeclarations(),e)}getVariableDeclarationOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getVariableDeclaration(e),()=>eY("variable declaration",e))}getStructure(){let t={};return nL.isBodyable(this)&&!this.hasBody()?t.statements=void 0:t.statements=this.getStatements().map(e=>nL._hasStructure(e)?e.getStructure():e.getText({trimLeadingIndentation:!0})),tA(e.prototype,this,t)}set(t){if(nL.isBodyable(this)&&null==t.statements&&t.hasOwnProperty(eV.nameof(t,"statements")))this.removeBody();else if(null!=t.statements){let e=this._getCompilerStatementsWithComments().length;e>0&&this.removeStatements([0,e-1])}return tD(e.prototype,this,t),null!=t.statements&&this.addStatements(t.statements),this}_getCompilerStatementsWithComments(){let e=this._getCompilerStatementsContainer();return null==e?[]:te.getContainerArray(e,this._sourceFile.compilerNode)}_getCompilerStatementsContainer(){if(nL.isSourceFile(this)||nL.isCaseClause(this)||nL.isDefaultClause(this))return this.compilerNode;if(nL.isModuleDeclaration(this)){let e=this._getInnerBody();if(null==e)return;return e.compilerNode}if(nL.isBodyable(this)||nL.isBodied(this))return this.getBody()?.compilerNode;if(nL.isBlock(this)||nL.isModuleBlock(this))return this.compilerNode;throw new eV.errors.NotImplementedError(`Could not find the statements for node kind: ${this.getKindName()}, text: ${this.getText()}`)}_insertChildren(e){return ov(this),ng({expectedKind:e.expectedKind,getIndexedChildren:()=>this.getStatementsWithComments(),index:e.index,parent:this,structures:e.structures,write:(t,n)=>e.write(t,n)})}_standardWrite(e,t,n,r={}){null==t.previousMember||null!=r.previousNewLine&&r.previousNewLine(t.previousMember)||nL.isCommentNode(t.previousMember)?t.isStartOfFile||e.newLineIfLastNot():e.blankLine(),n(),null==t.nextMember||null!=r.nextNewLine&&r.nextNewLine(t.nextMember)?e.newLineIfLastNot():e.blankLine()}}}function ov(e){nL.isBodyable(e)&&!e.hasBody()&&e.addBody()}let ob=iS(oy(og)),ox=iS(nL),oS=r5(iV(iS(oy(nL)))),oE=nL;class oT extends og{}let oA=og,oD=iS(oy(nL));class oC extends og{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}}let oI=iV(oC),oN=og,oP=iV(r5(og)),oR=iV(oC),oM=iV((ew=oC,class extends ew{isAwaited(){return null!=this.compilerNode.awaitModifier}getAwaitKeyword(){let e=this.compilerNode.awaitModifier;return this._getNodeFromCompilerNodeIfExists(e)}getAwaitKeywordOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAwaitKeyword(),e??"Expected to find an await token.")}setIsAwaited(e){let t=this.getAwaitKeyword();return null!=t===e||(null==t?nm({insertPos:function(e){if(e.getKind()===eV.SyntaxKind.ForOfStatement)return e.getFirstChildByKindOrThrow(eV.SyntaxKind.ForKeyword).getEnd();throw new eV.errors.NotImplementedError("Expected a for of statement node.")}(this),parent:this,newText:" await"}):nv({children:[t],removePrecedingSpaces:!0})),this}set(e){return tD(ew.prototype,this,e),null!=e.isAwaited&&this.setIsAwaited(e.isAwaited),this}})),ok=oC,ow=iV(og),oL=r5(og),oO=og,oF=iK(og),oW=iV(og),oB=iV(og),oz=og,oG=iV(r5(og)),oj=og,oK=nL,oV=iK(nL),oU=it(ir(io(nL))),oH=nL,oq=nL,oJ=og;function o$(){return new eV.errors.InvalidOperationError("Cannot add a named import to an import declaration that has a namespace import.")}let oX=nQ(r9(r5(ic(og)))),oY=nL,oQ=oy(og);function oZ(e){return class extends e{getParentModuleOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getParentModule(),e??"Expected to find the parent module declaration.",this)}getParentModule(){let e=this.getParentOrThrow();if(nL.isModuleBlock(e)){for(;e.getParentOrThrow().getKind()===eV.SyntaxKind.ModuleDeclaration;)e=e.getParentOrThrow();return e}}}}t.ModuleDeclarationKind=void 0,(eL=t.ModuleDeclarationKind||(t.ModuleDeclarationKind={})).Namespace="namespace",eL.Module="module",eL.Global="global";let o0=ie(iP(iS(nV(oZ(oy(r5(tC(nQ(r9(it(ir(io(og)))))))))))));function o1(e){e.getDeclarationKind()===t.ModuleDeclarationKind.Global&&e.setDeclarationKind(t.ModuleDeclarationKind.Namespace)}let o2=nL,o8=nL,o3=io(nL),o6=io(nL);class o4 extends nk{constructor(e,t){super(e,t)}getFileName(){return this.compilerObject.fileName}}function o5(e,t,n,r,i,o){function a(e){if(void 0!==e&&"function"!=typeof e)throw TypeError("Function expected");return e}for(var s,l=r.kind,c="getter"===l?"get":"setter"===l?"set":"value",d=!t&&e?r.static?e:e.prototype:null,u=t||(d?Object.getOwnPropertyDescriptor(d,r.name):{}),p=!1,f=n.length-1;f>=0;f--){var m={};for(var _ in r)m[_]="access"===_?{}:r[_];for(var _ in r.access)m.access[_]=r.access[_];m.addInitializer=function(e){if(p)throw TypeError("Cannot add initializers after decoration has completed");o.push(a(e||null))};var h=(0,n[f])("accessor"===l?{get:u.get,set:u.set}:u[c],m);if("accessor"===l){if(void 0===h)continue;if(null===h||"object"!=typeof h)throw TypeError("Object expected");(s=a(h.get))&&(u.get=s),(s=a(h.set))&&(u.set=s),(s=a(h.init))&&i.unshift(s)}else(s=a(h))&&("field"===l?i.unshift(s):u[c]=s)}d&&Object.defineProperty(d,r.name,u),p=!0}function o7(e,t,n){for(var r=arguments.length>2,i=0;i<t.length;i++)n=r?t[i].call(e,n):t[i].call(e);return r?n:void 0}t.FileSystemRefreshResult=void 0,(eO=t.FileSystemRefreshResult||(t.FileSystemRefreshResult={}))[eO.NoChange=0]="NoChange",eO[eO.Updated=1]="Updated",eO[eO.Deleted=2]="Deleted","function"==typeof SuppressedError&&SuppressedError;let o9=ie(iS(oy(nL))),ae=(r=o9,i=[],class extends r{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(r[Symbol.metadata]??null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"isFromExternalLibrary",static:!1,private:!1,access:{has:e=>"isFromExternalLibrary"in e,get:e=>e.isFromExternalLibrary},metadata:e},null,i),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#tB=(o7(this,i),!1);#eu=new eV.EventContainer;#tz=new eV.EventContainer;_referenceContainer=new tb(this);#tG;#tj;#tK;_hasBom;constructor(e,t){super(e,t,void 0),this.__sourceFile=this;let n=()=>{this.isFromExternalLibrary(),this.#tz.unsubscribe(n)};this.#tz.subscribe(n)}_replaceCompilerNodeFromFactory(e){super._replaceCompilerNodeFromFactory(e),this._context.resetProgram(),this.#tB=!1,this.#eu.fire(this)}_clearInternals(){function e(e){e?.forEach(e=>e._forget())}super._clearInternals(),e(this.#tG),e(this.#tK),e(this.#tj),this.#tG=void 0,this.#tK=void 0,this.#tj=void 0}getFilePath(){return this.compilerNode.fileName}getBaseName(){return eV.FileUtils.getBaseName(this.getFilePath())}getBaseNameWithoutExtension(){let e=this.getBaseName(),t=this.getExtension();return e.substring(0,e.length-t.length)}getExtension(){return eV.FileUtils.getExtension(this.getFilePath())}getDirectory(){return this._context.compilerFactory.getDirectoryFromCache(this.getDirectoryPath())}getDirectoryPath(){return this._context.fileSystemWrapper.getStandardizedAbsolutePath(eV.FileUtils.getDirPath(this.compilerNode.fileName))}getFullText(){return this.compilerNode.text}getLineAndColumnAtPos(e){let t=this.getFullText();return{line:eV.StringUtils.getLineNumberAtPos(t,e),column:eV.StringUtils.getLengthFromLineStartAtPos(t,e)+1}}getLengthFromLineStartAtPos(e){return eV.StringUtils.getLengthFromLineStartAtPos(this.getFullText(),e)}copyToDirectory(e,t){let n="string"==typeof e?e:e.getPath();return this.copy(eV.FileUtils.pathJoin(n,this.getBaseName()),t)}copy(e,t={}){this._throwIfIsInMemoryLibFile();let n=this._copyInternal(e,t);return!1===n?this:(n.getDirectoryPath()!==this.getDirectoryPath()&&n._updateReferencesForCopyInternal(this._getReferencesForCopyInternal()),n)}_copyInternal(e,t={}){let{overwrite:n=!1}=t,{compilerFactory:r,fileSystemWrapper:i}=this._context,o=i.getStandardizedAbsolutePath(e,this.getDirectoryPath());return o!==this.getFilePath()&&function(e){try{return r.createSourceFileFromText(o,e.getFullText(),{overwrite:n,markInProject:function(){if(e._isInProject())return!0;let t=r.getSourceFileFromCacheFromFilePath(o);return null!=t&&t._isInProject()}()})}catch(e){if(e instanceof eV.errors.InvalidOperationError)throw new eV.errors.InvalidOperationError("Did you mean to provide the overwrite option? "+e.message);throw e}}(this)}_getReferencesForCopyInternal(){return Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries())}_updateReferencesForCopyInternal(e){for(let t of e)t[0]=this.getChildSyntaxListOrThrow().getDescendantAtStartWithWidth(t[0].getStart(),t[0].getWidth());at(e)}async copyImmediately(e,t){let n=this.copy(e,t);return await n.save(),n}copyImmediatelySync(e,t){let n=this.copy(e,t);return n.saveSync(),n}moveToDirectory(e,t){let n="string"==typeof e?e:e.getPath();return this.move(eV.FileUtils.pathJoin(n,this.getBaseName()),t)}move(e,t={}){this._throwIfIsInMemoryLibFile();let n=this.getDirectoryPath(),r=this._getReferencesForMoveInternal(),i=this.getFilePath();return this._moveInternal(e,t)&&(this._context.fileSystemWrapper.queueFileDelete(i),this._updateReferencesForMoveInternal(r,n),this._context.lazyReferenceCoordinator.clearDirtySourceFiles(),this._context.lazyReferenceCoordinator.addDirtySourceFile(this)),this}_moveInternal(e,t={}){let{overwrite:n=!1}=t,r=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getDirectoryPath());if(r===this.getFilePath())return!1;let i=!1;if(n){let e=this._context.compilerFactory.getSourceFileFromCacheFromFilePath(r);null!=e&&(i=e._isInProject(),e.forget())}else this._context.compilerFactory.throwIfFileExists(r,"Did you mean to provide the overwrite option?");return nI({newFilePath:r,sourceFile:this}),i&&this._markAsInProject(),this._isInProject()&&this.getDirectory()._markAsInProject(),!0}_getReferencesForMoveInternal(){return{literalReferences:Array.from(this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries()),referencingLiterals:Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}}_updateReferencesForMoveInternal(e,t){let{literalReferences:n,referencingLiterals:r}=e;t!==this.getDirectoryPath()&&at(n),at(r.map(e=>[e,this]))}async moveImmediately(e,t){let n=this.getFilePath(),r=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getDirectoryPath());return this.move(e,t),n!==r?(await this._context.fileSystemWrapper.moveFileImmediately(n,r,this.getFullText()),this.#tB=!0):await this.save(),this}moveImmediatelySync(e,t){let n=this.getFilePath(),r=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getDirectoryPath());return this.move(e,t),n!==r?(this._context.fileSystemWrapper.moveFileImmediatelySync(n,r,this.getFullText()),this.#tB=!0):this.saveSync(),this}delete(){this._throwIfIsInMemoryLibFile();let e=this.getFilePath();this.forget(),this._context.fileSystemWrapper.queueFileDelete(e)}async deleteImmediately(){this._throwIfIsInMemoryLibFile();let e=this.getFilePath();this.forget(),await this._context.fileSystemWrapper.deleteFileImmediately(e)}deleteImmediatelySync(){this._throwIfIsInMemoryLibFile();let e=this.getFilePath();this.forget(),this._context.fileSystemWrapper.deleteFileImmediatelySync(e)}async save(){this._isLibFileInMemory()||(await this._context.fileSystemWrapper.writeFile(this.getFilePath(),this.#tV()),this.#tB=!0)}saveSync(){this._isLibFileInMemory()||(this._context.fileSystemWrapper.writeFileSync(this.getFilePath(),this.#tV()),this.#tB=!0)}#tV(){let e=this.getFullText();return this._hasBom?"\uFEFF"+e:e}getPathReferenceDirectives(){return null==this.#tG&&(this.#tG=(this.compilerNode.referencedFiles||[]).map(e=>new o4(e,this))),this.#tG}getTypeReferenceDirectives(){return null==this.#tK&&(this.#tK=(this.compilerNode.typeReferenceDirectives||[]).map(e=>new o4(e,this))),this.#tK}getLibReferenceDirectives(){return null==this.#tj&&(this.#tj=(this.compilerNode.libReferenceDirectives||[]).map(e=>new o4(e,this))),this.#tj}getReferencingSourceFiles(){return Array.from(this._referenceContainer.getDependentSourceFiles())}getReferencingNodesInOtherSourceFiles(){let e=this.getReferencingLiteralsInOtherSourceFiles();return Array.from(function*(){for(let t of e)yield an(t)}())}getReferencingLiteralsInOtherSourceFiles(){return Array.from(this._referenceContainer.getReferencingLiteralsInOtherSourceFiles())}getReferencedSourceFiles(){let e=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(new Set(function*(){for(let[,t]of e)yield t}()).values())}getNodesReferencingOtherSourceFiles(){let e=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(function*(){for(let[t]of e)yield an(t)}())}getLiteralsReferencingOtherSourceFiles(){let e=this._referenceContainer.getLiteralsReferencingOtherSourceFilesEntries();return Array.from(function*(){for(let[t]of e)yield t}())}getImportStringLiterals(){return this._ensureBound(),(this.compilerNode.imports||[]).filter(e=>-1!==e.pos).map(e=>this._getNodeFromCompilerNode(e))}getLanguageVersion(){return this.compilerNode.languageVersion}getLanguageVariant(){return this.compilerNode.languageVariant}getScriptKind(){return this.compilerNode.scriptKind}isDeclarationFile(){return this.compilerNode.isDeclarationFile}isFromExternalLibrary(){return!!this._context.program._isCompilerProgramCreated()&&this._context.program.compilerObject.isSourceFileFromExternalLibrary(this.compilerNode)}isInNodeModules(){return this.getFilePath().indexOf("/node_modules/")>=0}isSaved(){return this.#tB&&!this._isLibFileInMemory()}_setIsSaved(e){this.#tB=e}getPreEmitDiagnostics(){return this._context.getPreEmitDiagnostics(this)}unindent(e,t=1){return this.indent(e,-1*t)}indent(e,t=1){if(0===t)return this;let n=this.getFullText(),r="number"==typeof e?[e,e]:e;eV.errors.throwIfRangeOutOfRange(r,[0,n.length],"positionRange");let i=tW(n,r[0],e=>e===eJ.NEWLINE),o=tF(n,r[1],e=>e===eJ.CARRIAGE_RETURN||e===eJ.NEWLINE),a=eV.StringUtils.indent(n.substring(i,o),t,{indentText:this._context.manipulationSettings.getIndentationText(),indentSizeInSpaces:this._context.manipulationSettings._getIndentSizeInSpaces(),isInStringAtPos:e=>this.isInStringAtPos(e+i)});return nC({sourceFile:this,newText:n.substring(0,i)+a+n.substring(o)}),this}emit(e){return this._context.program.emit({targetSourceFile:this,...e})}emitSync(e){return this._context.program.emitSync({targetSourceFile:this,...e})}getEmitOutput(e={}){return this._context.languageService.getEmitOutput(this,e.emitOnlyDtsFiles||!1)}formatText(e={}){nC({sourceFile:this,newText:this._context.languageService.getFormattedDocumentText(this.getFilePath(),e)})}async refreshFromFileSystem(){let e=await this._context.fileSystemWrapper.readFileOrNotExists(this.getFilePath(),this._context.getEncoding());return this.#tU(e)}refreshFromFileSystemSync(){let e=this._context.fileSystemWrapper.readFileOrNotExistsSync(this.getFilePath(),this._context.getEncoding());return this.#tU(e)}getRelativePathTo(e){return this.getDirectory().getRelativePathTo(e)}getRelativePathAsModuleSpecifierTo(e){return this.getDirectory().getRelativePathAsModuleSpecifierTo(e)}onModified(e,t=!0){return t?this.#eu.subscribe(e):this.#eu.unsubscribe(e),this}_doActionPreNextModification(e){let t=()=>{e(),this.#tz.unsubscribe(t)};return this.#tz.subscribe(t),this}_firePreModified(){this.#tz.fire(this)}organizeImports(e={},t={}){return this._context.languageService.organizeImports(this,e,t).forEach(e=>e.applyChanges()),this}fixUnusedIdentifiers(e={},t={}){return this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_delete",e,t).applyChanges(),this._context.languageService.getCombinedCodeFix(this,"unusedIdentifier_deleteImports",e,t).applyChanges(),this}fixMissingImports(e={},t={}){let n=this._context.languageService.getCombinedCodeFix(this,"fixMissingImport",e,t),r=this;for(let e of n.getChanges()){let t=e.getTextChanges();(function(e){e.sort((e,t)=>e.getSpan().getStart()-t.getSpan().getStart());for(let t=0;t<e.length-1;t++){let{compilerObject:n}=e[t];n.newText=n.newText.replace(/(\r?)\n\r?\n$/,"$1\n")}})(t),function(e){let t=eV.ArrayUtils.groupBy(e,e=>e.getSpan().getStart()),n=0;for(let e of t){let t=e[0].getSpan().getStart()+n,i=e.map(e=>e.getNewText()).join(""),{insertPos:o,newText:a,sourceFile:s}={sourceFile:r,insertPos:t,newText:i};nf(s,new no({insertPos:o,newText:a}),new ne().getForRange({sourceFile:s,start:o,end:o+a.length})),n+=i.length}}(t)}return this}applyTextChanges(e){return 0===e.length||(this.forgetDescendants(),nD({sourceFile:this._sourceFile,start:0,replacingLength:this.getFullWidth(),newText:tk(this,e)})),this}set(e){return tD(o9.prototype,this,e),this}getStructure(){return tA(o9.prototype,this,{kind:t.StructureKind.SourceFile})}#tU(e){return!1===e?(this.forget(),t.FileSystemRefreshResult.Deleted):e===this.getFullText()?t.FileSystemRefreshResult.NoChange:(this.replaceText([0,this.getEnd()],e),this._setIsSaved(!0),t.FileSystemRefreshResult.Updated)}_isLibFileInMemory(){return this.compilerNode.fileName.startsWith(eV.libFolderInMemoryPath)}_throwIfIsInMemoryLibFile(){if(this._isLibFileInMemory())throw new eV.errors.InvalidOperationError("This operation is not permitted on an in memory lib folder file.")}_isInProject(){return this._context.inProjectCoordinator.isSourceFileInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markSourceFileAsInProject(this)}});function at(e){for(let[t,n]of e)ts.isModuleSpecifierRelative(t.getLiteralText())&&t.setLiteralValue(t._sourceFile.getRelativePathAsModuleSpecifierTo(n))}function an(e){let t=e.getParentOrThrow(),n=t.getParent();return null!=n&&nL.isImportEqualsDeclaration(n)?n:t}let ar=oZ(r5(tC(nQ(r9(og))))),ai=iV(oC),ao=iV(og);function aa(e){return r5(iN(ib(oy(r9(e)))))}let as=iS(nK(nP(aa(ik))));function al(e){return class extends e{getOverloads(){return ac(this).filter(e=>e.isOverload())}getImplementation(){return this.isImplementation()?this:ac(this).find(e=>e.isImplementation())}getImplementationOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getImplementation(),e??"Expected to find a corresponding implementation for the overload.",this)}isOverload(){return!this.isImplementation()}isImplementation(){return null!=this.getBody()}}}function ac(e){let t=e.getParentOrThrow(),n=ad(e),r=au(e),i=e.getKind();return t.forEachChildAsArray().filter(e=>ad(e)===n&&e.getKind()===i&&au(e)===r)}function ad(e){if(e.getName instanceof Function)return e.getName()}function au(e){return e.isStatic instanceof Function&&e.isStatic()}function ap(e){if(0===e.structures.length)return[];let t=e.node.getParentSyntaxListOrThrow(),n=e.node.getImplementation()||e.node,r=e.node.getOverloads(),i=r.length,o=r.length>0?r[0].getChildIndex():n.getChildIndex(),a=tX(e.index,i),s=e.getThisStructure(n),l=e.structures.map(e=>Object.assign(Object.assign({},s),e)),c=n._getWriterWithQueuedIndentation();for(let t of l)c.getLength()>0&&c.newLine(),e.printStructure(c,t);return c.newLine(),c.write(""),nm({parent:t,insertPos:(r[a]||n).getNonWhitespaceStart(),newText:c.toString()}),tH(t.getChildren(),o+a,l.length,e.expectedSyntaxKind)}let af=iP(iS(al(nV(nP(r8(tC(nQ(aa(oZ(is(og))))))))))),am=iP(iS(nP(r8(ib(tC(oZ(r5(iN(nQ(r9(og))))))))))),a_=r5(iS(nK(nP(r8(oy(iN(ib(r9(is(ij)))))))))),ah=iu(im(nH((eF=i_(r9(nJ(iA(r4(ia(nL)))))),class extends eF{getScope(){let e=ig(this);return null!=e?e:nL.isParameterDeclaration(this)&&this.isReadonly()?t.Scope.Public:void 0}setScope(e){return iy(this,e),this}getScopeKeyword(){return this.getModifiers().find(e=>{let t=e.getText();return"public"===t||"protected"===t||"private"===t})}hasScopeKeyword(){return null!=this.getScopeKeyword()}set(e){return tD(eF.prototype,this,e),e.hasOwnProperty(eV.nameof(e,"scope"))&&this.setScope(e.scope),this}getStructure(){return tA(eF.prototype,this,{scope:this.getScope()})}}))));function ag(e){let t=e.getParentOrThrow();nL.isArrowFunction(t)&&1===t.compilerNode.parameters.length&&null==e.getParentSyntaxListOrThrow().getPreviousSiblingIfKind(eV.SyntaxKind.OpenParenToken)&&function(){let n=e.getText();nm({parent:t,insertPos:e.getStart(),newText:`(${n})`,replacing:{textLength:n.length},customMappings:t=>[{currentNode:e,newNode:t.parameters[0]}]})}()}class ay extends nL{remove(){let e=this.getParentOrThrow();if(nL.isClassDeclaration(e)||nL.isClassExpression(e))if(nL.isOverloadable(this))if(this.isImplementation())nx([...this.getOverloads(),this]);else{let e=this.getParentOrThrow();nL.isAmbientable(e)&&e.isAmbient()?nx([this]):nv({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}else nx([this]);else nL.isObjectLiteralExpression(e)?nE(this):nL.isInterfaceDeclaration(e)?nS([this]):eV.errors.throwNotImplementedForSyntaxKindError(e.getKind())}}let av=nU(iS(iu(al(nV(nH(iM(iv(im(ix(nP(r8(aa(id(ay)))))))))))))),ab=r5(nU(iS(iu(iv(iN(iM(im(ix(nP(r9(r8(ib(ay)))))))))))));class ax extends av{set(e){return tD(av.prototype,this,e),null!=e.overloads&&(this.getOverloads().forEach(e=>e.remove()),this.addOverloads(e.overloads)),this}addOverload(e){return this.addOverloads([e])[0]}addOverloads(e){return this.insertOverloads(this.getOverloads().length,e)}insertOverload(e,t){return this.insertOverloads(e,[t])[0]}insertOverloads(e,t){let n=this.getName(),r=this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:to(this)});return ap({node:this,index:e,structures:t,printStructure:(e,t)=>{r.printOverload(e,n,t)},getThisStructure:t$,expectedSyntaxKind:eV.SyntaxKind.MethodDeclaration})}getStructure(){var e;let n=null!=this.getImplementation(),r=this.isOverload();return tA(r&&n?ab.prototype:av.prototype,this,(e=this,n&&r?{kind:t.StructureKind.MethodOverload}:n?{kind:t.StructureKind.Method,overloads:e.getOverloads().map(e=>e.getStructure())}:{kind:t.StructureKind.Method}))}}function aS(e){var t,n;return n=is(iS((t=r3(iM(r5(iN(nH(r9(e)))))),class extends t{getImplements(){let e=this.getHeritageClauseByKind(eV.SyntaxKind.ImplementsKeyword);return e?.getTypeNodes()??[]}addImplements(e){return this.insertImplements(this.getImplements().length,e)}insertImplements(e,t){let n=this.getImplements(),r="string"==typeof t;if("string"==typeof t)eV.errors.throwIfWhitespaceOrNotString(t,"texts"),t=[t];else if(0===t.length)return[];let i=this._getWriterWithQueuedChildIndentation();new n6(new rg).printText(i,t);let o=this.getHeritageClauses();if(e=tX(e,n.length),n.length>0)n_({parent:this.getHeritageClauseByKindOrThrow(eV.SyntaxKind.ImplementsKeyword).getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:n,insertIndex:e,newText:i.toString(),useTrailingCommas:!1});else{let e=this.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenBraceToken).getStart(),t=/\s/.test(this.getSourceFile().getFullText()[e-1]),n=`implements ${i.toString()} `;t||(n=" "+n),nm({parent:0===o.length?this:o[0].getParentSyntaxListOrThrow(),insertPos:e,newText:n})}let a=this.getImplements();return r?a[0]:tU(n,a,e,!1)}removeImplements(e){let t=this.getHeritageClauseByKind(eV.SyntaxKind.ImplementsKeyword);if(null==t)throw new eV.errors.InvalidOperationError("Cannot remove an implements when none exist.");return t.removeExpression(e),this}set(e){return tD(t.prototype,this,e),null!=e.implements&&(this.getImplements().forEach(e=>this.removeImplements(e)),this.addImplements(e.implements)),this}getStructure(){return tA(t.prototype,this,{implements:this.getImplements().map(e=>e.getText())})}}))),class extends n{setExtends(e){if(e=this._getTextWithQueuedChildIndentation(e),eV.StringUtils.isNullOrWhitespace(e))return this.removeExtends();let t=this.getHeritageClauseByKind(eV.SyntaxKind.ExtendsKeyword);if(null!=t){let n=t.getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),r=n.getStart();nm({parent:t,newText:e,insertPos:r,replacing:{textLength:n.getEnd()-r}})}else{let t,n=this.getHeritageClauseByKind(eV.SyntaxKind.ImplementsKeyword);t=null!=n?n.getStart():this.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenBraceToken).getStart();let r=/\s/.test(this.getSourceFile().getFullText()[t-1]),i=`extends ${e} `;r||(i=" "+i),nm({parent:null==n?this:n.getParentSyntaxListOrThrow(),insertPos:t,newText:i})}return this}removeExtends(){let e=this.getHeritageClauseByKind(eV.SyntaxKind.ExtendsKeyword);return null==e||e.removeExpression(0),this}getExtendsOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getExtends(),e??`Expected to find the extends expression for the class ${this.getName()}.`,this)}getExtends(){let e=this.getHeritageClauseByKind(eV.SyntaxKind.ExtendsKeyword);if(null==e)return;let t=e.getTypeNodes();return 0===t.length?void 0:t[0]}addMembers(e){return this.insertMembers(tO(this.getMembersWithComments()),e)}addMember(e){return this.insertMember(tO(this.getMembersWithComments()),e)}insertMember(e,t){return this.insertMembers(e,[t])[0]}insertMembers(e,t){let n=to(this);return ny({getIndexedChildren:()=>this.getMembersWithComments(),index:e,parent:this,write:(e,i)=>{let o=!n&&null!=i.previousMember&&nL.isBodyable(i.previousMember)&&i.previousMember.hasBody(),a=!n&&t instanceof Array&&r(t[0]);o||null!=i.previousMember&&a?e.blankLineIfLastNot():e.newLineIfLastNot();let s=this._getWriter();this._context.structurePrinterFactory.forClassMember({isAmbient:n}).printTexts(s,t),e.write(s.toString());let l=!n&&t instanceof Array&&r(t[t.length-1]),c=!n&&null!=i.nextMember&&nL.isBodyable(i.nextMember)&&i.nextMember.hasBody();null!=i.nextMember&&l||c?e.blankLineIfLastNot():e.newLineIfLastNot()}});function r(e){return!n&&null!=e&&"number"==typeof e.kind&&(rr.isMethod(e)||rr.isGetAccessor(e)||rr.isSetAccessor(e)||rr.isConstructor(e))}}addConstructor(e={}){return this.insertConstructor(tO(this.getMembersWithComments()),e)}addConstructors(e){return this.insertConstructors(tO(this.getMembersWithComments()),e)}insertConstructor(e,t={}){return this.insertConstructors(e,[t])[0]}insertConstructors(e,t){let n=to(this);return aC(this,{index:e,structures:t,expectedKind:eV.SyntaxKind.Constructor,write:(e,r)=>{n||null==r.previousMember||nL.isCommentNode(r.previousMember)?e.newLineIfLastNot():e.blankLineIfLastNot(),this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:n}).printTexts(e,t),n||null==r.nextMember?e.newLineIfLastNot():e.blankLineIfLastNot()}})}getConstructors(){return this.getMembers().filter(e=>nL.isConstructorDeclaration(e))}addStaticBlock(e={}){return this.insertStaticBlock(tO(this.getMembersWithComments()),e)}addStaticBlocks(e){return this.insertStaticBlocks(tO(this.getMembersWithComments()),e)}insertStaticBlock(e,t={}){return this.insertStaticBlocks(e,[t])[0]}insertStaticBlocks(e,t){let n=to(this);return aC(this,{index:e,structures:t,expectedKind:eV.SyntaxKind.ClassStaticBlockDeclaration,write:(e,r)=>{n||null==r.previousMember||nL.isCommentNode(r.previousMember)?e.newLineIfLastNot():e.blankLineIfLastNot(),this._context.structurePrinterFactory.forClassStaticBlockDeclaration().printTexts(e,t),n||null==r.nextMember?e.newLineIfLastNot():e.blankLineIfLastNot()}})}getStaticBlocks(){return this.getMembers().filter(e=>nL.isClassStaticBlockDeclaration(e))}addGetAccessor(e){return this.addGetAccessors([e])[0]}addGetAccessors(e){return this.insertGetAccessors(tO(this.getMembersWithComments()),e)}insertGetAccessor(e,t){return this.insertGetAccessors(e,[t])[0]}insertGetAccessors(e,t){return aC(this,{index:e,structures:t,expectedKind:eV.SyntaxKind.GetAccessor,write:(e,n)=>{null==n.previousMember||nL.isCommentNode(n.previousMember)?e.newLineIfLastNot():e.blankLineIfLastNot(),this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:to(this)}).printTexts(e,t),null!=n.nextMember?e.blankLineIfLastNot():e.newLineIfLastNot()}})}addSetAccessor(e){return this.addSetAccessors([e])[0]}addSetAccessors(e){return this.insertSetAccessors(tO(this.getMembersWithComments()),e)}insertSetAccessor(e,t){return this.insertSetAccessors(e,[t])[0]}insertSetAccessors(e,t){return aC(this,{index:e,structures:t,expectedKind:eV.SyntaxKind.SetAccessor,write:(e,n)=>{null==n.previousMember||nL.isCommentNode(n.previousMember)?e.newLineIfLastNot():e.blankLineIfLastNot(),this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:to(this)}).printTexts(e,t),null!=n.nextMember?e.blankLineIfLastNot():e.newLineIfLastNot()}})}addProperty(e){return this.addProperties([e])[0]}addProperties(e){return this.insertProperties(tO(this.getMembersWithComments()),e)}insertProperty(e,t){return this.insertProperties(e,[t])[0]}insertProperties(e,t){return aC(this,{index:e,structures:t,expectedKind:eV.SyntaxKind.PropertyDeclaration,write:(e,n)=>{null!=n.previousMember&&nL.hasBody(n.previousMember)?e.blankLineIfLastNot():e.newLineIfLastNot(),this._context.structurePrinterFactory.forPropertyDeclaration().printTexts(e,t),null!=n.nextMember&&nL.hasBody(n.nextMember)?e.blankLineIfLastNot():e.newLineIfLastNot()}})}addMethod(e){return this.addMethods([e])[0]}addMethods(e){return this.insertMethods(tO(this.getMembersWithComments()),e)}insertMethod(e,t){return this.insertMethods(e,[t])[0]}insertMethods(e,t){let n=to(this);return aC(this,{index:e,write:(e,r)=>{n||null==r.previousMember||nL.isCommentNode(r.previousMember)?e.newLineIfLastNot():e.blankLineIfLastNot(),this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:n}).printTexts(e,t),n||null==r.nextMember?e.newLineIfLastNot():e.blankLineIfLastNot()},structures:t=t.map(e=>({...e})),expectedKind:eV.SyntaxKind.MethodDeclaration})}getInstanceProperty(e){return e$(this.getInstanceProperties(),e)}getInstancePropertyOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getInstanceProperty(e),()=>eY("class instance property",e))}getInstanceProperties(){return this.getInstanceMembers().filter(e=>aA(e))}getStaticProperty(e){return e$(this.getStaticProperties(),e)}getStaticPropertyOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getStaticProperty(e),()=>eY("class static property",e))}getStaticProperties(){return this.getStaticMembers().filter(e=>aA(e))}getProperty(e){return e$(this.getProperties(),e)}getPropertyOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getProperty(e),()=>eY("class property declaration",e))}getProperties(){return this.getMembers().filter(e=>nL.isPropertyDeclaration(e))}getGetAccessor(e){return e$(this.getGetAccessors(),e)}getGetAccessorOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getGetAccessor(e),()=>eY("class getAccessor declaration",e))}getGetAccessors(){return this.getMembers().filter(e=>nL.isGetAccessorDeclaration(e))}getSetAccessor(e){return e$(this.getSetAccessors(),e)}getSetAccessorOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getSetAccessor(e),()=>eY("class setAccessor declaration",e))}getSetAccessors(){return this.getMembers().filter(e=>nL.isSetAccessorDeclaration(e))}getMethod(e){return e$(this.getMethods(),e)}getMethodOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getMethod(e),()=>eY("class method declaration",e))}getMethods(){return this.getMembers().filter(e=>nL.isMethodDeclaration(e))}getInstanceMethod(e){return e$(this.getInstanceMethods(),e)}getInstanceMethodOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getInstanceMethod(e),()=>eY("class instance method",e))}getInstanceMethods(){return this.getInstanceMembers().filter(e=>e instanceof ax)}getStaticMethod(e){return e$(this.getStaticMethods(),e)}getStaticMethodOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getStaticMethod(e),()=>eY("class static method",e))}getStaticMethods(){return this.getStaticMembers().filter(e=>e instanceof ax)}getInstanceMember(e){return e$(this.getInstanceMembers(),e)}getInstanceMemberOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getInstanceMember(e),()=>eY("class instance member",e))}getInstanceMembers(){return this.getMembersWithParameterProperties().filter(e=>!nL.isConstructorDeclaration(e)&&(nL.isParameterDeclaration(e)||!e.isStatic()))}getStaticMember(e){return e$(this.getStaticMembers(),e)}getStaticMemberOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getStaticMember(e),()=>eY("class static member",e))}getStaticMembers(){return this.getMembers().filter(e=>!nL.isConstructorDeclaration(e)&&!nL.isParameterDeclaration(e)&&e.isStatic())}getMembersWithParameterProperties(){let e=this.getMembers();for(let t of e.filter(e=>nL.isConstructorDeclaration(e)&&e.isImplementation())){let n=e.indexOf(t)+1;for(let r of t.getParameters())r.isParameterProperty()&&(e.splice(n,0,r),n++)}return e}getMembers(){return aE(this,this.compilerNode.members).filter(e=>aD(e))}getMembersWithComments(){let e=this.compilerNode;return aE(this,te.getContainerArray(e,this.getSourceFile().compilerNode)).filter(e=>aD(e)||nL.isCommentClassElement(e))}getMember(e){return e$(this.getMembers(),e)}getMemberOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getMember(e),()=>eY("class member",e))}getBaseTypes(){return this.getType().getBaseTypes()}getBaseClassOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getBaseClass(),e??`Expected to find the base class of ${this.getName()}.`,this)}getBaseClass(){let e=this.getBaseTypes().map(e=>e.isIntersection()?e.getIntersectionTypes():[e]).flat().map(e=>e.getSymbol()).filter(e=>null!=e).map(e=>e.getDeclarations()).reduce((e,t)=>e.concat(t),[]).filter(e=>e.getKind()===eV.SyntaxKind.ClassDeclaration);if(1===e.length)return e[0]}getDerivedClasses(){let e=aT(this);for(let t=0;t<e.length;t++)for(let n of aT(e[t]))n!==this&&-1===e.indexOf(n)&&e.push(n);return e}}}function aE(e,t){let n=to(e),r=t.map(t=>e._getNodeFromCompilerNode(t));return n?r:r.filter(e=>!!(!(nL.isConstructorDeclaration(e)||nL.isMethodDeclaration(e))||nL.isMethodDeclaration(e)&&e.isAbstract())||e.isImplementation())}function aT(e){let t=[],n=e.getNameNode();if(null==n)return t;for(let e of n.findReferencesAsNodes()){let n=(e=e.getParentWhileKind(eV.SyntaxKind.PropertyAccessExpression)??e).getParentIfKind(eV.SyntaxKind.ExpressionWithTypeArguments);if(null==n)continue;let r=n.getParentIfKind(eV.SyntaxKind.HeritageClause);if(null==r||r.getToken()!==eV.SyntaxKind.ExtendsKeyword)continue;let i=r.getParentIfKind(eV.SyntaxKind.ClassDeclaration);null!=i&&t.push(i)}return t}function aA(e){return nL.isPropertyDeclaration(e)||nL.isSetAccessorDeclaration(e)||nL.isGetAccessorDeclaration(e)||nL.isParameterDeclaration(e)}function aD(e){return nL.isMethodDeclaration(e)||nL.isPropertyDeclaration(e)||nL.isGetAccessorDeclaration(e)||nL.isSetAccessorDeclaration(e)||nL.isConstructorDeclaration(e)||nL.isClassStaticBlockDeclaration(e)}function aC(e,t){return ng({getIndexedChildren:()=>e.getMembersWithComments(),parent:e,...t})}let aI=oZ(tC(nQ(aS(og))));function aN(e,n){let r=e.getConstructors().map(e=>e.getOverloads().length>0?e.getOverloads():[e]).flat();return{constructors:r,properties:e.getProperties().filter(e=>e.isStatic()===n&&e.getScope()===t.Scope.Public),methods:e.getMethods().filter(e=>e.isStatic()===n&&e.getScope()===t.Scope.Public).map(e=>e.getOverloads().length>0?e.getOverloads():[e]).flat(),accessors:function(){let r=new eV.KeyValueCache;for(let i of[...e.getGetAccessors(),...e.getSetAccessors()])i.isStatic()===n&&i.getScope()===t.Scope.Public&&r.getOrCreate(i.getName(),()=>[]).push(i);return r.getValuesAsArray()}()}}function aP(e,t){return(e=eV.StringUtils.isNullOrWhitespace(e)?void 0:e)||t.getName()||t.getSourceFile().getBaseNameWithoutExtension().replace(/[^a-zA-Z0-9_$]/g,"")}function aR(e){return{kind:t.StructureKind.PropertySignature,docs:e.getJsDocs().map(e=>e.getStructure()),name:e.getName(),type:e.getType().getText(e),hasQuestionToken:e.hasQuestionToken(),isReadonly:e.isReadonly()}}function aM(e){return{kind:t.StructureKind.PropertySignature,docs:e[0].getJsDocs().map(e=>e.getStructure()),name:e[0].getName(),type:e[0].getType().getText(e[0]),hasQuestionToken:!1,isReadonly:e.every(nL.isGetAccessorDeclaration)}}function ak(e){return{kind:t.StructureKind.MethodSignature,docs:e.getJsDocs().map(e=>e.getStructure()),name:e.getName(),hasQuestionToken:e.hasQuestionToken(),returnType:e.getReturnType().getText(e),parameters:e.getParameters().map(aw),typeParameters:e.getTypeParameters().map(e=>e.getStructure())}}function aw(e){return{...e.getStructure(),decorators:[]}}let aL=aS(ij),aO=nU(iS(oy(r5(nK(ay)))));class aF extends ay{}let aW=ir(nU(iS(al(iv(aa(nV(ay))))))),aB=iN(r5(nU(iS(iv(r9(ib(ay))))))),az=nU(iS(nH(iM(iv(ix(aa(nV(id(ay))))))))),aG=nU(iu(tC(nH(iM(iv(ix(r5(i_(n$(im(r4(iA(id(r9(ay))))))))))))))),aj=nU(iS(nH(iM(iv(ix(aa(nV(id(ay))))))))),aK=iV(nL);function aV(e){return class extends e{getTypeExpression(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}getTypeExpressionOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTypeExpression(),e??"Expected to find a JS doc type expression.",this)}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}isBracketed(){return this.compilerNode.isBracketed}}}function aU(e){return class extends e{getTypeExpression(){let e=this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression);if(null==e||0!==e.getWidth())return e}getTypeExpressionOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTypeExpression(),e??"Expected to find the JS doc tag's type expression.",this)}}}function aH(e){return e.replace(/^\/\*\*[^\S\n]*\n?/,"").replace(/(\r?\n)?[^\S\n]*\*\/$/,"").split(/\n/).map(e=>{let t=function(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n===eJ.ASTERISK)return t;if(!eV.StringUtils.isWhitespaceCharCode(n))break}return -1}(e);if(-1===t)return e;let n=" "===e[t+1]?t+2:t+1;return e.substring(n)}).join("\n")}let aq=nL;class aJ extends nL{}let a$=iT(aJ);class aX extends a${}let aY=ib(aJ);class aQ extends aY{}let aZ=iM(r9(aQ)),a0=iV(aX),a1=iN(aQ),a2=iA(im(nJ(r5(ic(aJ))))),a8=iN(iA(r5(tC(nQ(r9(ic(og))))))),a3=iC(aJ);t.TypeParameterVariance=void 0,(eW=t.TypeParameterVariance||(t.TypeParameterVariance={}))[eW.None=0]="None",eW[eW.In=1]="In",eW[eW.Out=2]="Out",eW[eW.InOut=3]="InOut";let a6=r9(ic(nL));function a4(e,t){null!=e&&nv({children:[e.getPreviousSiblingIfKindOrThrow(t),e],removePrecedingSpaces:!0})}class a5 extends aJ{}let a7=nL;class a9 extends a7{getTagName(){return this.getTagNameNode().getText()}getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}setTagName(e){return this.set({tagName:e})}getComment(){return null==this.compilerNode.comment?void 0:"string"==typeof this.compilerNode.comment?this.compilerNode.comment:this.compilerNode.comment.map(e=>this._getNodeFromCompilerNodeIfExists(e))}getCommentText(){return"string"==typeof this.compilerNode.comment?this.compilerNode.comment:eV.ts.getTextOfJSDocComment(this.compilerNode.comment)}remove(){let e=this.getParentOrThrow().getStart()+3,t=sn(this),n=null==t,r=(function(){return Math.max(e,sr(this,this.getStart()))}).call(this);nv({children:[this],customRemovalPos:r,customRemovalEnd:st(this,t),replaceTrivia:(function(){if(r===e&&n)return"";let t=this._context.manipulationSettings.getNewLineKindAsString(),i=this.getParentOrThrow().getIndentationText();return`${t}${i} `+(n?"":"* ")}).call(this)})}set(e){return(tD(a7.prototype,this,e),null!=e.text||null!=e.tagName)?this.replaceWithText(t=>{this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0}).printText(t,{tagName:e.tagName??this.getTagName(),text:null!=e.text?e.text:se(this)})}):this}replaceWithText(e){var t;let n=tp(this._getWriterWithQueuedIndentation(),e),r=this.getParentOrThrow(),i=this.getChildIndex(),o=this.getStart();return nm({parent:r,insertPos:o,newText:n,replacing:{textLength:(t=this,sr(t,st(t))-o)}}),r.getChildren()[i]}getStructure(){let e=se(this);return tA(a7.prototype,this,{kind:t.StructureKind.JSDocTag,tagName:this.getTagName(),text:0===e.length?void 0:e})}}function se(e){var t;let n=e.getSourceFile().getFullText(),r=e.getTagNameNode().getEnd(),i=sr(t=e,st(t)),o=Math.min(n.charCodeAt(r)===eJ.SPACE?r+1:r,i);return aH(n.substring(o,i))}function st(e,t){return null!=(t=t??sn(e))?t.getStart():e.getParentOrThrow().getEnd()-2}function sn(e){let t=e.getParentIfKindOrThrow(eV.SyntaxKind.JSDoc).getTags(),n=t.indexOf(e);return t[n+1]}function sr(e,t){return tW(e.getSourceFile().getFullText(),t,e=>e!==eJ.ASTERISK&&!eV.StringUtils.isWhitespaceCharCode(e))}let si=ib(a5),so=aU(a9),sa=aV(a9),ss=aV(a9),sl=aU(a9),sc=aU(a9),sd=aU(a9);class su{#ta;constructor(e){this.#ta=e}get compilerObject(){return this.#ta}getName(){return this.compilerObject.name}getText(){return this.compilerObject.text??[]}}let sp=(eB=a9,class extends eB{getTypeParameters(){return this.compilerNode.typeParameters.map(e=>this._getNodeFromCompilerNode(e)).filter(e=>e.getWidth()>0)}}),sf=aU(a9),sm=aU(a9);class s_ extends nL{remove(){nb({children:[this],getSiblingFormatting:()=>eK.Newline})}}let sh=iS(oZ(r5(tC(nQ(r9(ic(og))))))),sg=r5(r4(id(nL)));class sy extends nL{remove(){nS([this])}}let sv=iN(nU(r5(ib(sy))));class sb extends sy{}let sx=iN(nU(r5(ib(sy)))),sS=ih(nU(r5(i_(r9(sy))))),sE=iC(iS((ez=r3(iN(r5(tC(oZ(nQ(r9(ic(og)))))))),class extends ez{getExtends(){let e=this.getHeritageClauseByKind(eV.SyntaxKind.ExtendsKeyword);return e?.getTypeNodes()??[]}addExtends(e){return this.insertExtends(this.getExtends().length,e)}insertExtends(e,t){let n=this.getExtends(),r="string"==typeof t;if("string"==typeof t)eV.errors.throwIfWhitespaceOrNotString(t,"texts"),t=[t];else if(0===t.length)return[];let i=this._getWriterWithQueuedChildIndentation();if(new n6(new rg).printText(i,t),e=tX(e,n.length),n.length>0)n_({parent:this.getHeritageClauseByKindOrThrow(eV.SyntaxKind.ExtendsKeyword).getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:n,insertIndex:e,newText:i.toString(),useTrailingCommas:!1});else{let e=this.getFirstChildByKindOrThrow(eV.SyntaxKind.OpenBraceToken).getStart(),t=/\s/.test(this.getSourceFile().getFullText()[e-1]),n=`extends ${i.toString()} `;t||(n=" "+n),nm({parent:this,insertPos:e,newText:n})}let o=this.getExtends();return r?o[e]:tU(n,o,e,!1)}removeExtends(e){let t=this.getHeritageClauseByKind(eV.SyntaxKind.ExtendsKeyword);if(null==t)throw new eV.errors.InvalidOperationError("Cannot remove an extends when none exist.");return t.removeExpression(e),this}set(e){return tD(ez.prototype,this,e),null!=e.extends&&(this.getExtends().forEach(e=>this.removeExtends(e)),this.addExtends(e.extends)),this}getStructure(){return tA(ez.prototype,this,{extends:this.getExtends().map(e=>e.getText())})}}))),sT=nU(r5(im(iN(ib(id(sy)))))),sA=nU(r5(i_(im(r4(iA(id(r9(sy))))))));function sD(e){return class extends e{getAttributes(){return this.compilerNode.attributes.properties.map(e=>this._getNodeFromCompilerNode(e))}getAttributeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAttribute(e),()=>eY("attribute",e))}getAttribute(e){return e$(this.getAttributes(),e)}addAttribute(e){return this.addAttributes([e])[0]}addAttributes(e){return this.insertAttributes(this.compilerNode.attributes.properties.length,e)}insertAttribute(e,t){return this.insertAttributes(e,[t])[0]}insertAttributes(e,t){if(0===t.length)return[];let n=this.compilerNode.attributes.properties.length,r=0===(e=tX(e,n))?this.getTagNameNode().getEnd():this.getAttributes()[e-1].getEnd(),i=this._getWriterWithQueuedChildIndentation();return new n9(this._context.structurePrinterFactory.forJsxAttributeDecider()).printText(i,t),nm({insertPos:r,newText:" "+i.toString(),parent:this.getNodeProperty("attributes").getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList)}),tU(n,this.getAttributes(),e,!1)}set(t){return tD(e.prototype,this,t),null!=t.attributes&&(this.getAttributes().forEach(e=>e.remove()),this.addAttributes(t.attributes)),this}getStructure(){return tA(e.prototype,this,{attributes:this.getAttributes().map(e=>e.getStructure())})}}}function sC(e){return class extends e{getTagNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.tagName)}set(t){return tD(e.prototype,this,t),null!=t.name&&this.getTagNameNode().replaceWithText(t.name),this}getStructure(){return tA(e.prototype,this,{name:this.getTagNameNode().getText()})}}}function sI(e){return class extends e{getText(){return this.compilerNode.text}getDefinitionNodes(){return this.getDefinitions().map(e=>e.getDeclarationNode()).filter(e=>null!=e)}getDefinitions(){return this._context.languageService.getDefinitions(this)}}}let sN=iV(nL),sP=sI(ir(io(ij)));class sR extends sP{getImplementations(){return this._context.languageService.getImplementations(this)}}let sM=sI(ir(io(nL))),sk=nL,sw=sC(nL),sL=ij;function sO(e,t){let n=e.getOpeningElement(),r=e.getClosingElement();nm({insertPos:n.getEnd(),newText:t,parent:e.getChildSyntaxListOrThrow(),replacing:{textLength:r.getStart()-n.getEnd()}})}let sF=iK(nJ(ik)),sW=nL,sB=sD(sC(ik)),sz=sD(sC(ij)),sG=iV(nL),sj=r7(nL),sK=i1,sV=ij,sU=ij;function sH(e,t){if(sq(e)===t)return e;let n=e.getParentSyntaxList()||e.getParentOrThrow(),r=e.getChildIndex();return e.replaceWithText(t?"true":"false"),n.getChildAtIndex(r)}function sq(e){return e.getKind()===eV.SyntaxKind.TrueKeyword}let sJ=ij,s$=i1;t.QuoteKind=void 0,(eG=t.QuoteKind||(t.QuoteKind={})).Single="'",eG.Double='"';let sX=i1,sY=i1,sQ=i1,sZ=ij,s0=r7(nL),s1=r7(nL),s2=iV(nL),s8=r7(nL),s3=nX(n$(iA(r4(ia(nL))))),s6=r9(nL);class s4{#tH;#tq;constructor(e,t){this.#tH=e,this.#tq=t}get compilerSignature(){return this.#tq}getTypeParameters(){return(this.compilerSignature.typeParameters||[]).map(e=>this.#tH.compilerFactory.getTypeParameter(e))}getParameters(){return this.compilerSignature.parameters.map(e=>this.#tH.compilerFactory.getSymbol(e))}getReturnType(){return this.#tH.compilerFactory.getType(this.compilerSignature.getReturnType())}getDocumentationComments(){return this.compilerSignature.getDocumentationComment(this.#tH.typeChecker.compilerObject).map(e=>this.#tH.compilerFactory.getSymbolDisplayPart(e))}getJsDocTags(){return this.compilerSignature.getJsDocTags().map(e=>this.#tH.compilerFactory.getJSDocTagInfo(e))}getDeclaration(){let{compilerFactory:e}=this.#tH,t=this.compilerSignature.getDeclaration();return e.getNodeFromCompilerNode(t,e.getSourceFileForNode(t))}}let s5=class{#tH;#tJ;get compilerSymbol(){return this.#tJ}constructor(e,t){this.#tH=e,this.#tJ=t,this.getValueDeclaration(),this.getDeclarations()}getName(){return this.compilerSymbol.getName()}getEscapedName(){return this.compilerSymbol.getEscapedName()}getAliasedSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAliasedSymbol(),e??"Expected to find an aliased symbol.")}getImmediatelyAliasedSymbol(){return this.#tH.typeChecker.getImmediatelyAliasedSymbol(this)}getImmediatelyAliasedSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getImmediatelyAliasedSymbol(),e??"Expected to find an immediately aliased symbol.")}getAliasedSymbol(){return this.#tH.typeChecker.getAliasedSymbol(this)}getExportSymbol(){return this.#tH.typeChecker.getExportSymbolOfSymbol(this)}isAlias(){return(this.getFlags()&eV.SymbolFlags.Alias)===eV.SymbolFlags.Alias}isOptional(){return(this.getFlags()&eV.SymbolFlags.Optional)===eV.SymbolFlags.Optional}getFlags(){return this.compilerSymbol.getFlags()}hasFlags(e){return(this.compilerSymbol.flags&e)===e}getValueDeclarationOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getValueDeclaration(),e??(()=>`Expected to find the value declaration of symbol '${this.getName()}'.`))}getValueDeclaration(){let e=this.compilerSymbol.valueDeclaration;if(null!=e)return this.#tH.compilerFactory.getNodeFromCompilerNode(e,this.#tH.compilerFactory.getSourceFileForNode(e))}getDeclarations(){return(this.compilerSymbol.declarations??[]).map(e=>this.#tH.compilerFactory.getNodeFromCompilerNode(e,this.#tH.compilerFactory.getSourceFileForNode(e)))}getExportOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getExport(e),t??(()=>`Expected to find export with name: ${e}`))}getExport(e){if(null==this.compilerSymbol.exports)return;let t=this.compilerSymbol.exports.get(eV.ts.escapeLeadingUnderscores(e));return null==t?void 0:this.#tH.compilerFactory.getSymbol(t)}getExports(){return null==this.compilerSymbol.exports?[]:Array.from(this.compilerSymbol.exports.values()).map(e=>this.#tH.compilerFactory.getSymbol(e))}getGlobalExportOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getGlobalExport(e),t??(()=>`Expected to find global export with name: ${e}`))}getGlobalExport(e){if(null==this.compilerSymbol.globalExports)return;let t=this.compilerSymbol.globalExports.get(eV.ts.escapeLeadingUnderscores(e));return null==t?void 0:this.#tH.compilerFactory.getSymbol(t)}getGlobalExports(){return null==this.compilerSymbol.globalExports?[]:Array.from(this.compilerSymbol.globalExports.values()).map(e=>this.#tH.compilerFactory.getSymbol(e))}getMemberOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getMember(e),t??`Expected to find member with name: ${e}`)}getMember(e){if(null==this.compilerSymbol.members)return;let t=this.compilerSymbol.members.get(eV.ts.escapeLeadingUnderscores(e));return null==t?void 0:this.#tH.compilerFactory.getSymbol(t)}getMembers(){return null==this.compilerSymbol.members?[]:Array.from(this.compilerSymbol.members.values()).map(e=>this.#tH.compilerFactory.getSymbol(e))}getDeclaredType(){return this.#tH.typeChecker.getDeclaredTypeOfSymbol(this)}getTypeAtLocation(e){return this.#tH.typeChecker.getTypeOfSymbolAtLocation(this,e)}getFullyQualifiedName(){return this.#tH.typeChecker.getFullyQualifiedName(this)}getJsDocTags(){return this.compilerSymbol.getJsDocTags(this.#tH.typeChecker.compilerObject).map(e=>new su(e))}};class s7{#ta;constructor(e){this.#ta=e}get compilerObject(){return this.#ta}getStart(){return this.compilerObject.start}getEnd(){return this.compilerObject.start+this.compilerObject.length}getLength(){return this.compilerObject.length}}let s9=(o=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getSpan",static:!1,private:!1,access:{has:e=>"getSpan"in e,get:e=>e.getSpan},metadata:e},null,o),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#ta=o7(this,o);constructor(e){this.#ta=e}get compilerObject(){return this.#ta}getSpan(){return new s7(this.compilerObject.span)}getNewText(){return this.compilerObject.newText}}),le=(a=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getTextChanges",static:!1,private:!1,access:{has:e=>"getTextChanges"in e,get:e=>e.getTextChanges},metadata:e},null,a),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#tH=o7(this,a);#ta;#eC;#t$;#tX;constructor(e,t){this.#tH=e,this.#ta=t;let n=e.compilerFactory.addOrGetSourceFileFromFilePath(e.fileSystemWrapper.getStandardizedAbsolutePath(t.fileName),{markInProject:!1,scriptKind:void 0});this.#t$=null!=n,t.isNewFile||(this.#eC=n)}getFilePath(){return this.#ta.fileName}getSourceFile(){return this.#eC}getTextChanges(){return this.#ta.textChanges.map(e=>new s9(e))}applyChanges(e={}){let t;if(!this.#tX){if(this.isNewFile()&&this.#t$&&!e.overwrite)throw new eV.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?`);if(null==(t=this.isNewFile()?this.#tH.project.createSourceFile(this.getFilePath(),"",{overwrite:e.overwrite}):this.getSourceFile()))throw new eV.errors.InvalidOperationError(`Cannot apply file text change to modify existing file that doesn't exist at path: ${this.getFilePath()}`);return t.applyTextChanges(this.getTextChanges()),t._markAsInProject(),this.#tX=!0,this}}isNewFile(){return!!this.#ta.isNewFile}});class lt{#tH;#ta;constructor(e,t){this.#tH=e,this.#ta=t}get compilerObject(){return this.#ta}getDescription(){return this.compilerObject.description}getChanges(){return this.compilerObject.changes.map(e=>new le(this.#tH,e))}}class ln extends lt{getFixName(){return this.compilerObject.fixName}getFixId(){return this.compilerObject.fixId}getFixAllDescription(){return this.compilerObject.fixAllDescription}}let lr=(s=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getChanges",static:!1,private:!1,access:{has:e=>"getChanges"in e,get:e=>e.getChanges},metadata:e},null,s),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#tH=o7(this,s);#ta;constructor(e,t){this.#tH=e,this.#ta=t}get compilerObject(){return this.#ta}getChanges(){return this.compilerObject.changes.map(e=>new le(this.#tH,e))}applyChanges(e){for(let t of this.getChanges())t.applyChanges(e);return this}}),li=(u=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;l=[eV.Memoize],c=[eV.Memoize],d=[eV.Memoize],o5(this,null,l,{kind:"method",name:"getTextSpan",static:!1,private:!1,access:{has:e=>"getTextSpan"in e,get:e=>e.getTextSpan},metadata:e},null,u),o5(this,null,c,{kind:"method",name:"getNode",static:!1,private:!1,access:{has:e=>"getNode"in e,get:e=>e.getNode},metadata:e},null,u),o5(this,null,d,{kind:"method",name:"getOriginalTextSpan",static:!1,private:!1,access:{has:e=>"getOriginalTextSpan"in e,get:e=>e.getOriginalTextSpan},metadata:e},null,u),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}_context=o7(this,u);_compilerObject;_sourceFile;constructor(e,t){this._context=e,this._compilerObject=t,this._sourceFile=this._context.compilerFactory.addOrGetSourceFileFromFilePath(e.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 s7(this.compilerObject.textSpan)}getNode(){let e,t=this.getTextSpan(),n=this.getSourceFile(),r=t.getStart(),i=t.getEnd();return n._context.compilerFactory.forgetNodesCreatedInBlock(t=>{let o,a=n;for(;null!=a;){if(null==o&&(e=a),a.getStart()===r&&a.getWidth()===i)e=o=a;else if(null!=o)break;a=a.getChildAtPos(r)}null!=e&&t(e)}),e}getOriginalTextSpan(){let{originalTextSpan:e}=this.compilerObject;return null==e?void 0:new s7(e)}getOriginalFileName(){return this.compilerObject.originalFileName}}),lo=(p=li,f=[],class extends p{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(p[Symbol.metadata]??null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getDeclarationNode",static:!1,private:!1,access:{has:e=>"getDeclarationNode"in e,get:e=>e.getDeclarationNode},metadata:e},null,f),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}constructor(e,t){super(e,t),o7(this,f),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("module"===this.getKind()&&this.getTextSpan().getLength()===this.getSourceFile().getFullWidth())return this.getSourceFile();let e=this.getTextSpan().getStart(),t=function t(n){if(n.getKind()===eV.SyntaxKind.Identifier&&n.getStart()===e)return n;for(let r of n._getChildrenIterator())if(r.getPos()<=e&&r.getEnd()>e)return t(r)}(this.getSourceFile());return null==t?void 0:t.getParentOrThrow()}});class la{_compilerObject;constructor(e){this._compilerObject=e}get compilerObject(){return this._compilerObject}getMessageText(){return this.compilerObject.messageText}getNext(){let e=this.compilerObject.next;if(null!=e)return e instanceof Array?e.map(e=>new la(e)):[new la(e)]}getCode(){return this.compilerObject.code}getCategory(){return this.compilerObject.category}}let ls=(m=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getSourceFile",static:!1,private:!1,access:{has:e=>"getSourceFile"in e,get:e=>e.getSourceFile},metadata:e},null,m),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}_context=o7(this,m);_compilerObject;constructor(e,t){this._context=e,this._compilerObject=t,this.getSourceFile()}get compilerObject(){return this._compilerObject}getSourceFile(){if(null==this._context)return;let e=this.compilerObject.file;return null==e?void 0:this._context.compilerFactory.getSourceFile(e,{markInProject:!1})}getMessageText(){let e=this._compilerObject.messageText;return"string"==typeof e?e:null==this._context?new la(e):this._context.compilerFactory.getDiagnosticMessageChain(e)}getLineNumber(){let e=this.getSourceFile(),t=this.getStart();if(null!=e&&null!=t)return eV.StringUtils.getLineNumberAtPos(e.getFullText(),t)}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}});class ll extends ls{constructor(e,t){super(e,t)}getLineNumber(){return super.getLineNumber()}getStart(){return super.getStart()}getLength(){return super.getLength()}getSourceFile(){return super.getSourceFile()}}class lc{#ta;#tH;constructor(e,t){this.#ta=t,this.#tH=e}get compilerObject(){return this.#ta}getFilePath(){return this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(this.compilerObject.name)}getWriteByteOrderMark(){return this.compilerObject.writeByteOrderMark||!1}getText(){return this.compilerObject.text}}let ld=(g=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;_=[eV.Memoize],h=[eV.Memoize],o5(this,null,_,{kind:"method",name:"getDiagnostics",static:!1,private:!1,access:{has:e=>"getDiagnostics"in e,get:e=>e.getDiagnostics},metadata:e},null,g),o5(this,null,h,{kind:"method",name:"getOutputFiles",static:!1,private:!1,access:{has:e=>"getOutputFiles"in e,get:e=>e.getOutputFiles},metadata:e},null,g),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#tH=o7(this,g);#ta;constructor(e,t){this.#tH=e,this.#ta=t}get compilerObject(){return this.#ta}getDiagnostics(){return this.compilerObject.diagnostics.map(e=>this.#tH.compilerFactory.getDiagnostic(e))}getEmitSkipped(){return this.compilerObject.emitSkipped}getOutputFiles(){return this.compilerObject.outputFiles.map(e=>new lc(this.#tH,e))}}),lu=(y=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getDiagnostics",static:!1,private:!1,access:{has:e=>"getDiagnostics"in e,get:e=>e.getDiagnostics},metadata:e},null,y),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}_context=o7(this,y);_compilerObject;constructor(e,t){this._context=e,this._compilerObject=t,this.getDiagnostics()}get compilerObject(){return this._compilerObject}getEmitSkipped(){return this.compilerObject.emitSkipped}getDiagnostics(){return this.compilerObject.diagnostics.map(e=>this._context.compilerFactory.getDiagnostic(e))}}),lp=(b=li,x=[],class extends b{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(b[Symbol.metadata]??null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getDisplayParts",static:!1,private:!1,access:{has:e=>"getDisplayParts"in e,get:e=>e.getDisplayParts},metadata:e},null,x),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}constructor(e,t){super(e,t),o7(this,x)}getKind(){return this.compilerObject.kind}getDisplayParts(){return this.compilerObject.displayParts.map(e=>this._context.compilerFactory.getSymbolDisplayPart(e))}});class lf extends lu{#tY;constructor(e,t,n){super(e,t),this.#tY=n}getFiles(){return this.#tY}saveFiles(){let e=this._context.fileSystemWrapper;return Promise.all(this.#tY.map(t=>e.writeFile(t.filePath,t.writeByteOrderMark?"\uFEFF"+t.text:t.text)))}saveFilesSync(){let e=this._context.fileSystemWrapper;for(let t of this.#tY)e.writeFileSync(t.filePath,t.writeByteOrderMark?"\uFEFF"+t.text:t.text)}}let lm=(S=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getEdits",static:!1,private:!1,access:{has:e=>"getEdits"in e,get:e=>e.getEdits},metadata:e},null,S),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#tH=o7(this,S);#ta;constructor(e,t){this.#tH=e,this.#ta=t}get compilerObject(){return this.#ta}getEdits(){return this.compilerObject.edits.map(e=>new le(this.#tH,e))}getRenameFilePath(){return this.compilerObject.renameFilename}getRenameLocation(){return this.compilerObject.renameLocation}applyChanges(e){for(let t of this.getEdits())t.applyChanges(e);return this}}),l_=(E=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getDefinition",static:!1,private:!1,access:{has:e=>"getDefinition"in e,get:e=>e.getDefinition},metadata:e},null,E),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}_context=o7(this,E);#ta;#tQ;constructor(e,t){this._context=e,this.#ta=t,this.#tQ=this.compilerObject.references.map(t=>e.compilerFactory.getReferencedSymbolEntry(t))}get compilerObject(){return this.#ta}getDefinition(){return this._context.compilerFactory.getReferencedSymbolDefinitionInfo(this.compilerObject.definition)}getReferences(){return this.#tQ}}),lh=(T=lo,A=[],class extends T{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(T[Symbol.metadata]??null):void 0;o5(this,null,[eV.Memoize],{kind:"method",name:"getDisplayParts",static:!1,private:!1,access:{has:e=>"getDisplayParts"in e,get:e=>e.getDisplayParts},metadata:e},null,A),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}constructor(e,t){super(e,t),o7(this,A)}getDisplayParts(){return this.compilerObject.displayParts.map(e=>this._context.compilerFactory.getSymbolDisplayPart(e))}});class lg extends li{constructor(e,t){super(e,t)}isWriteAccess(){return this.compilerObject.isWriteAccess}isInString(){return this.compilerObject.isInString}}class ly extends lg{constructor(e,t){super(e,t)}isDefinition(){return this.compilerObject.isDefinition}}class lv extends li{getPrefixText(){return this._compilerObject.prefixText}getSuffixText(){return this._compilerObject.suffixText}}class lb{#ta;constructor(e){this.#ta=e}get compilerObject(){return this.#ta}getText(){return this.compilerObject.text}getKind(){return this.compilerObject.kind}}class lx{#tH;#tZ;constructor(e){this.#tH=e}get compilerObject(){return this.#tZ()}_reset(e){this.#tZ=e}getAmbientModules(){return this.compilerObject.getAmbientModules().map(e=>this.#tH.compilerFactory.getSymbol(e))}getApparentType(e){return this.#tH.compilerFactory.getType(this.compilerObject.getApparentType(e.compilerType))}getConstantValue(e){return this.compilerObject.getConstantValue(e.compilerNode)}getFullyQualifiedName(e){return this.compilerObject.getFullyQualifiedName(e.compilerSymbol)}getTypeAtLocation(e){return this.#tH.compilerFactory.getType(this.compilerObject.getTypeAtLocation(e.compilerNode))}getContextualType(e){let t=this.compilerObject.getContextualType(e.compilerNode);return null==t?void 0:this.#tH.compilerFactory.getType(t)}getTypeOfSymbolAtLocation(e,t){return this.#tH.compilerFactory.getType(this.compilerObject.getTypeOfSymbolAtLocation(e.compilerSymbol,t.compilerNode))}getDeclaredTypeOfSymbol(e){return this.#tH.compilerFactory.getType(this.compilerObject.getDeclaredTypeOfSymbol(e.compilerSymbol))}getSymbolAtLocation(e){let t=this.compilerObject.getSymbolAtLocation(e.compilerNode);return null==t?void 0:this.#tH.compilerFactory.getSymbol(t)}getAliasedSymbol(e){if(!e.hasFlags(eV.SymbolFlags.Alias))return;let t=this.compilerObject.getAliasedSymbol(e.compilerSymbol);return null==t?void 0:this.#tH.compilerFactory.getSymbol(t)}getImmediatelyAliasedSymbol(e){let t=this.compilerObject.getImmediateAliasedSymbol(e.compilerSymbol);return null==t?void 0:this.#tH.compilerFactory.getSymbol(t)}getExportSymbolOfSymbol(e){return this.#tH.compilerFactory.getSymbol(this.compilerObject.getExportSymbolOfSymbol(e.compilerSymbol))}getPropertiesOfType(e){return this.compilerObject.getPropertiesOfType(e.compilerType).map(e=>this.#tH.compilerFactory.getSymbol(e))}getTypeText(e,t,n){return null==n&&(n=this.#t0(t)),this.compilerObject.typeToString(e.compilerType,t?.compilerNode,n)}getReturnTypeOfSignature(e){return this.#tH.compilerFactory.getType(this.compilerObject.getReturnTypeOfSignature(e.compilerSignature))}getSignatureFromNode(e){let t=this.compilerObject.getSignatureFromDeclaration(e.compilerNode);return null==t?void 0:this.#tH.compilerFactory.getSignature(t)}getExportsOfModule(e){return(this.compilerObject.getExportsOfModule(e.compilerSymbol)||[]).map(e=>this.#tH.compilerFactory.getSymbol(e))}getExportSpecifierLocalTargetSymbol(e){let t=this.compilerObject.getExportSpecifierLocalTargetSymbol(e.compilerNode);return null==t?void 0:this.#tH.compilerFactory.getSymbol(t)}getResolvedSignature(e){let t=this.compilerObject.getResolvedSignature(e.compilerNode);if(t&&t.declaration)return this.#tH.compilerFactory.getSignature(t)}getResolvedSignatureOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getResolvedSignature(e),t??"Signature could not be resolved.",e)}getBaseTypeOfLiteralType(e){return this.#tH.compilerFactory.getType(this.compilerObject.getBaseTypeOfLiteralType(e.compilerType))}getSymbolsInScope(e,t){return this.compilerObject.getSymbolsInScope(e.compilerNode,t).map(e=>this.#tH.compilerFactory.getSymbol(e))}getTypeArguments(e){return this.compilerObject.getTypeArguments(e.compilerType).map(e=>this.#tH.compilerFactory.getType(e))}isTypeAssignableTo(e,t){return this.compilerObject.isTypeAssignableTo(e.compilerType,t.compilerType)}#t0(e){let t=eV.TypeFormatFlags.UseTypeOfFunction|eV.TypeFormatFlags.NoTruncation|eV.TypeFormatFlags.UseFullyQualifiedType|eV.TypeFormatFlags.WriteTypeArgumentsOfSignature;return null!=e&&e.getKind()===eV.SyntaxKind.TypeAliasDeclaration&&(t|=eV.TypeFormatFlags.InTypeAlias),t}getShorthandAssignmentValueSymbol(e){let t=this.compilerObject.getShorthandAssignmentValueSymbol(e.compilerNode);return t?this.#tH.compilerFactory.getSymbol(t):void 0}resolveName(e,t,n,r){let i=this.compilerObject.resolveName(e,t?.compilerNode,n,r);return i?this.#tH.compilerFactory.getSymbol(i):void 0}}class lS{#tH;#t1;#t2;#t8;#t3;#t6;constructor(e){this.#tH=e.context,this.#t6=e.configFileParsingDiagnostics,this.#t1=new lx(this.#tH),this._reset(e.rootNames,e.host)}get compilerObject(){return this.#t3()}_isCompilerProgramCreated(){return null!=this.#t2}_reset(e,t){let n=this.#tH.compilerOptions.get();this.#t3=()=>(null==this.#t2&&(this.#t2=eV.ts.createProgram(e,n,t,this.#t8,this.#t6),this.#t8=void 0),this.#t2),null!=this.#t2&&(this.#t8=this.#t2,this.#t2=void 0),this.#t1._reset(()=>this.compilerObject.getTypeChecker())}getTypeChecker(){return this.#t1}async emit(e={}){if(e.writeFile){let t=`Cannot specify a ${eV.nameof(e,"writeFile")} option when emitting asynchrously. Use ${eV.nameof(this,"emitSync")}() instead.`;throw new eV.errors.InvalidOperationError(t)}let{fileSystemWrapper:t}=this.#tH,n=[],r=this.#t4({writeFile:(e,r,i)=>{n.push(t.writeFile(t.getStandardizedAbsolutePath(e),i?"\uFEFF"+r:r))},...e});return await Promise.all(n),new lu(this.#tH,r)}emitSync(e={}){return new lu(this.#tH,this.#t4(e))}emitToMemory(e={}){let t=[],{fileSystemWrapper:n}=this.#tH,r=this.#t4({writeFile:(e,r,i)=>{t.push({filePath:n.getStandardizedAbsolutePath(e),text:r,writeByteOrderMark:i||!1})},...e});return new lf(this.#tH,r,t)}#t4(e={}){let t=null!=e.targetSourceFile?e.targetSourceFile.compilerNode:void 0,{emitOnlyDtsFiles:n,customTransformers:r,writeFile:i}=e;return this.compilerObject.emit(t,i,void 0,n,r)}getSyntacticDiagnostics(e){return this.compilerObject.getSyntacticDiagnostics(null==e?void 0:e.compilerNode).map(e=>this.#tH.compilerFactory.getDiagnosticWithLocation(e))}getSemanticDiagnostics(e){return this.compilerObject.getSemanticDiagnostics(e?.compilerNode).map(e=>this.#tH.compilerFactory.getDiagnostic(e))}getDeclarationDiagnostics(e){return this.compilerObject.getDeclarationDiagnostics(e?.compilerNode).map(e=>this.#tH.compilerFactory.getDiagnosticWithLocation(e))}getGlobalDiagnostics(){return this.compilerObject.getGlobalDiagnostics().map(e=>this.#tH.compilerFactory.getDiagnostic(e))}getConfigFileParsingDiagnostics(){return this.compilerObject.getConfigFileParsingDiagnostics().map(e=>this.#tH.compilerFactory.getDiagnostic(e))}getEmitModuleResolutionKind(){return eV.getEmitModuleResolutionKind(this.compilerObject.getCompilerOptions())}isSourceFileFromExternalLibrary(e){return e.isFromExternalLibrary()}}class lE{#ta;#t5;#t7;#tH;#t9=0;get compilerObject(){return this.#ta}constructor(e){this.#tH=e.context;let{languageServiceHost:t,compilerHost:n}=eV.createHosts({transactionalFileSystem:this.#tH.fileSystemWrapper,sourceFileContainer:this.#tH.getSourceFileContainer(),compilerOptions:this.#tH.compilerOptions,getNewLine:()=>this.#tH.manipulationSettings.getNewLineKindAsString(),getProjectVersion:()=>`${this.#t9}`,resolutionHost:e.resolutionHost??{},libFolderPath:e.libFolderPath,skipLoadingLibFiles:e.skipLoadingLibFiles});this.#t5=n,this.#ta=eV.ts.createLanguageService(t,this.#tH.compilerFactory.documentRegistry),this.#t7=new lS({context:this.#tH,rootNames:Array.from(this.#tH.compilerFactory.getSourceFilePaths()),host:this.#t5,configFileParsingDiagnostics:e.configFileParsingDiagnostics}),this.#tH.compilerFactory.onSourceFileAdded(e=>{e._isInProject()&&this._reset()}),this.#tH.compilerFactory.onSourceFileRemoved(()=>this._reset())}_reset(){this.#t9+=1,this.#t7._reset(Array.from(this.#tH.compilerFactory.getSourceFilePaths()),this.#t5)}getProgram(){return this.#t7}getDefinitions(e){return this.getDefinitionsAtPosition(e._sourceFile,e.getStart())}getDefinitionsAtPosition(e,t){return(this.compilerObject.getDefinitionAtPosition(e.getFilePath(),t)||[]).map(e=>this.#tH.compilerFactory.getDefinitionInfo(e))}getImplementations(e){return this.getImplementationsAtPosition(e._sourceFile,e.getStart())}getImplementationsAtPosition(e,t){return(this.compilerObject.getImplementationAtPosition(e.getFilePath(),t)||[]).map(e=>new lp(this.#tH,e))}findReferences(e){return this.findReferencesAtPosition(e._sourceFile,e.getStart())}findReferencesAsNodes(e){let t=this.findReferences(e);return Array.from(function*(){for(let e of t){let t=e.getDefinition().getKind()===eV.ts.ScriptElementKind.alias,n=e.getReferences();for(let e=0;e<n.length;e++){let r=n[e];(t||!r.isDefinition()||e>0)&&(yield r.getNode())}}}())}findReferencesAtPosition(e,t){return(this.compilerObject.findReferences(e.getFilePath(),t)||[]).map(e=>this.#tH.compilerFactory.getReferencedSymbol(e))}findRenameLocations(e,t={}){let n=null==t.usePrefixAndSuffixText?this.#tH.manipulationSettings.getUsePrefixAndSuffixTextForRename():t.usePrefixAndSuffixText;return(this.compilerObject.findRenameLocations(e._sourceFile.getFilePath(),e.getStart(),t.renameInStrings||!1,t.renameInComments||!1,n)||[]).map(e=>new lv(this.#tH,e))}getSuggestionDiagnostics(e){let t=this.#ne(e);return this.compilerObject.getSuggestionDiagnostics(t).map(e=>this.#tH.compilerFactory.getDiagnosticWithLocation(e))}getFormattingEditsForRange(e,t,n){return(this.compilerObject.getFormattingEditsForRange(e,t[0],t[1],this.#nt(n))||[]).map(e=>new s9(e))}getFormattingEditsForDocument(e,t){let n=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e);return(this.compilerObject.getFormattingEditsForDocument(n,this.#nt(t))||[]).map(e=>new s9(e))}getFormattedDocumentText(e,t){let n=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e),r=this.#tH.compilerFactory.getSourceFileFromCacheFromFilePath(n);if(null==r)throw new eV.errors.FileNotFoundError(n);t=this.#nt(t);let i=tk(r,this.getFormattingEditsForDocument(n,t)),o=t.newLineCharacter;return t.ensureNewLineAtEndOfFile&&!i.endsWith(o)&&(i+=o),i.replace(/\r?\n/g,o)}getEmitOutput(e,t){let n=this.#ne(e),r=this.compilerObject;return new ld(this.#tH,function(){let e=r.getProgram();return null==e||null==e.getSourceFile(n)?{emitSkipped:!0,outputFiles:[],diagnostics:[]}:r.getEmitOutput(n,t)}())}getIdentationAtPosition(e,t,n){let r=this.#ne(e);return null==n?n=this.#tH.manipulationSettings.getEditorSettings():tu(n,this.#tH.manipulationSettings),this.compilerObject.getIndentationAtPosition(r,t,n)}organizeImports(e,t={},n={}){let r={type:"file",fileName:this.#ne(e)};return this.compilerObject.organizeImports(r,this.#nt(t),this.#nn(n)).map(e=>new le(this.#tH,e))}getEditsForRefactor(e,t,n,r,i,o={}){let a=this.#ne(e),s="number"==typeof n?n:{pos:n.getPos(),end:n.getEnd()},l=this.compilerObject.getEditsForRefactor(a,this.#nt(t),s,r,i,this.#nn(o));return null!=l?new lm(this.#tH,l):void 0}getCombinedCodeFix(e,t,n={},r={}){let i=this.compilerObject.getCombinedCodeFix({type:"file",fileName:this.#ne(e)},t,this.#nt(n),this.#nn(r||{}));return new lr(this.#tH,i)}getCodeFixesAtPosition(e,t,n,r,i={},o={}){let a=this.#ne(e);return this.compilerObject.getCodeFixesAtPosition(a,t,n,r,this.#nt(i),this.#nn(o||{})).map(e=>new ln(this.#tH,e))}#ne(e){let t="string"==typeof e?this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e):e.getFilePath();if(!this.#tH.compilerFactory.containsSourceFileAtPath(t))throw new eV.errors.FileNotFoundError(t);return t}#nt(e){var t;return e._filled?e:(tu(t=e=Object.assign(this.#tH.getFormatCodeSettings(),e),this.#tH.manipulationSettings),td(t,"insertSpaceAfterCommaDelimiter",!0),td(t,"insertSpaceAfterConstructor",!1),td(t,"insertSpaceAfterSemicolonInForStatements",!0),td(t,"insertSpaceAfterKeywordsInControlFlowStatements",!0),td(t,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces",!0),td(t,"insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets",!1),td(t,"insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces",!1),td(t,"insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces",!1),td(t,"insertSpaceBeforeFunctionParenthesis",!1),td(t,"insertSpaceBeforeAndAfterBinaryOperators",!0),td(t,"placeOpenBraceOnNewLineForFunctions",!1),td(t,"placeOpenBraceOnNewLineForControlBlocks",!1),td(t,"ensureNewLineAtEndOfFile",!0),e._filled=!0,e)}#nn(e){return Object.assign(this.#tH.getUserPreferences(),e)}}class lT{_context;#nr;get compilerType(){return this.#nr}constructor(e,t){this._context=e,this.#nr=t}getText(e,t){return this._context.typeChecker.getTypeText(this,e,t)}getAliasSymbol(){return null==this.compilerType.aliasSymbol?void 0:this._context.compilerFactory.getSymbol(this.compilerType.aliasSymbol)}getAliasSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAliasSymbol(),"Expected to find an alias symbol.")}getAliasTypeArguments(){return(this.compilerType.aliasTypeArguments||[]).map(e=>this._context.compilerFactory.getType(e))}getApparentType(){return this._context.typeChecker.getApparentType(this)}getArrayElementTypeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getArrayElementType(),e??"Expected to find an array element type.")}getArrayElementType(){if(this.isArray())return this.getTypeArguments()[0]}getBaseTypes(){return(this.compilerType.getBaseTypes()||[]).map(e=>this._context.compilerFactory.getType(e))}getBaseTypeOfLiteralType(){return this._context.typeChecker.getBaseTypeOfLiteralType(this)}getCallSignatures(){return this.compilerType.getCallSignatures().map(e=>this._context.compilerFactory.getSignature(e))}getConstructSignatures(){return this.compilerType.getConstructSignatures().map(e=>this._context.compilerFactory.getSignature(e))}getConstraintOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getConstraint(),e??"Expected to find a constraint.")}getConstraint(){let e=this.compilerType.getConstraint();return null==e?void 0:this._context.compilerFactory.getType(e)}getDefaultOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDefault(),e??"Expected to find a default type.")}getDefault(){let e=this.compilerType.getDefault();return null==e?void 0:this._context.compilerFactory.getType(e)}getProperties(){return this.compilerType.getProperties().map(e=>this._context.compilerFactory.getSymbol(e))}getPropertyOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getProperty(e),()=>eY("symbol property",e))}getProperty(e){return ti(this.getProperties(),e)}getApparentProperties(){return this.compilerType.getApparentProperties().map(e=>this._context.compilerFactory.getSymbol(e))}getApparentProperty(e){return ti(this.getApparentProperties(),e)}isNullable(){return this.getUnionTypes().some(e=>e.isNull()||e.isUndefined())}getNonNullableType(){return this._context.compilerFactory.getType(this.compilerType.getNonNullableType())}getNumberIndexType(){let e=this.compilerType.getNumberIndexType();return null==e?void 0:this._context.compilerFactory.getType(e)}getStringIndexType(){let e=this.compilerType.getStringIndexType();return null==e?void 0:this._context.compilerFactory.getType(e)}getTargetType(){let e=this.compilerType.target||void 0;return null==e?void 0:this._context.compilerFactory.getType(e)}getTargetTypeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTargetType(),e??"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(e=>this._context.compilerFactory.getType(e)):[]}getIntersectionTypes(){return this.isIntersection()?this.compilerType.types.map(e=>this._context.compilerFactory.getType(e)):[]}getLiteralValue(){return this.compilerType?.value}getLiteralValueOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getLiteralValue(),e??"Type was not a literal type.")}getLiteralFreshType(){let e=this.compilerType?.freshType;return null==e?void 0:this._context.compilerFactory.getType(e)}getLiteralFreshTypeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getLiteralFreshType(),e??"Type was not a literal type.")}getLiteralRegularType(){let e=this.compilerType?.regularType;return null==e?void 0:this._context.compilerFactory.getType(e)}getLiteralRegularTypeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getLiteralRegularType(),e??"Type was not a literal type.")}getSymbol(){let e=this.compilerType.getSymbol();return null==e?void 0:this._context.compilerFactory.getSymbol(e)}getSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getSymbol(),e??"Expected to find a symbol.")}isAssignableTo(e){return this._context.typeChecker.isTypeAssignableTo(this,e)}isAnonymous(){return this.#ni(eV.ObjectFlags.Anonymous)}isAny(){return this.#no(eV.TypeFlags.Any)}isNever(){return this.#no(eV.TypeFlags.Never)}isArray(){let e=this.getSymbol();return null!=e&&("Array"===e.getName()||"ReadonlyArray"===e.getName())&&1===this.getTypeArguments().length}isReadonlyArray(){let e=this.getSymbol();return null!=e&&"ReadonlyArray"===e.getName()&&1===this.getTypeArguments().length}isTemplateLiteral(){return this.#no(eV.TypeFlags.TemplateLiteral)}isBoolean(){return this.#no(eV.TypeFlags.Boolean)}isString(){return this.#no(eV.TypeFlags.String)}isNumber(){return this.#no(eV.TypeFlags.Number)}isBigInt(){return this.#no(eV.TypeFlags.BigInt)}isLiteral(){let e=this.isBooleanLiteral();return this.compilerType.isLiteral()||e}isBooleanLiteral(){return this.#no(eV.TypeFlags.BooleanLiteral)}isBigIntLiteral(){return this.#no(eV.TypeFlags.BigIntLiteral)}isEnumLiteral(){return this.#no(eV.TypeFlags.EnumLiteral)&&!this.isUnion()}isNumberLiteral(){return this.#no(eV.TypeFlags.NumberLiteral)}isStringLiteral(){return this.compilerType.isStringLiteral()}isClass(){return this.compilerType.isClass()}isClassOrInterface(){return this.compilerType.isClassOrInterface()}isEnum(){if(this.#no(eV.TypeFlags.Enum))return!0;if(this.isEnumLiteral()&&!this.isUnion())return!1;let e=this.getSymbol();if(null==e)return!1;let t=e.getValueDeclaration();return null!=t&&nL.isEnumDeclaration(t)}isInterface(){return this.#ni(eV.ObjectFlags.Interface)}isObject(){return this.#no(eV.TypeFlags.Object)}isTypeParameter(){return this.compilerType.isTypeParameter()}isTuple(){let e=this.getTargetType();return null!=e&&e.#ni(eV.ObjectFlags.Tuple)}isUnion(){return this.compilerType.isUnion()}isIntersection(){return this.compilerType.isIntersection()}isUnionOrIntersection(){return this.compilerType.isUnionOrIntersection()}isUnknown(){return this.#no(eV.TypeFlags.Unknown)}isNull(){return this.#no(eV.TypeFlags.Null)}isUndefined(){return this.#no(eV.TypeFlags.Undefined)}isVoid(){return this.#no(eV.TypeFlags.Void)}getFlags(){return this.compilerType.flags}getObjectFlags(){return this.isObject()&&this.compilerType.objectFlags||0}#no(e){return(this.compilerType.flags&e)===e}#ni(e){return(this.getObjectFlags()&e)===e}}class lA extends lT{getConstraintOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getConstraint(),e??"Expected type parameter to have a constraint.")}getConstraint(){let e=this.#na();if(null==e)return;let t=e.getConstraint();if(null!=t)return this._context.typeChecker.getTypeAtLocation(t)}getDefaultOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDefault(),e??"Expected type parameter to have a default type.")}getDefault(){let e=this.#na();if(null==e)return;let t=e.getDefault();if(null!=t)return this._context.typeChecker.getTypeAtLocation(t)}#na(){let e=this.getSymbol();if(null==e)return;let t=e.getDeclarations()[0];if(null!=t&&nL.isTypeParameterDeclaration(t))return t}}class lD{#ns;#nl;constructor(e,t){this.#nl=e,this.#ns=t}getSkippedFilePaths(){return this.#nl}getOutputFilePaths(){return this.#ns}}class lC{#tH;#nc;#nd;constructor(e,t){this.#tH=e,this._setPathInternal(t)}_setPathInternal(e){this.#nc=e,this.#nd=e.split("/").filter(e=>e.length>0)}get _context(){return this.#nu(),this.#tH}isAncestorOf(e){return lC.#np(this,e)}isDescendantOf(e){return lC.#np(e,this)}_getDepth(){return this.#nd.length}getPath(){return this.#nu(),this.#nc}getBaseName(){return this.#nd[this.#nd.length-1]}getParentOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getParent(),e??(()=>`Parent directory of ${this.getPath()} does not exist or was never added.`))}getParent(){if(!eV.FileUtils.isRootDirPath(this.getPath()))return this.addDirectoryAtPathIfExists(eV.FileUtils.getDirPath(this.getPath()))}getDirectoryOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDirectory(e),()=>"string"==typeof e?`Could not find a directory at path '${this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath())}'.`:"Could not find child directory that matched condition.")}getDirectory(e){if("string"==typeof e){let t=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.compilerFactory.getDirectoryFromCache(t)}return this.getDirectories().find(e)}getSourceFileOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getSourceFile(e),()=>{if("string"==typeof e){let t=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return`Could not find child source file at path '${t}'.`}return"Could not find child source file that matched condition."})}getSourceFile(e){if("string"==typeof e){let t=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.compilerFactory.getSourceFileFromCacheFromFilePath(t)}for(let t of this._getSourceFilesIterator())if(e(t))return t}getDirectories(){return Array.from(this._getDirectoriesIterator())}_getDirectoriesIterator(){return this._context.compilerFactory.getChildDirectoriesOfDirectory(this.getPath())}getSourceFiles(e){let{compilerFactory:t,fileSystemWrapper:n}=this._context,r=this;return"string"==typeof e||e instanceof Array?Array.from(function*(e){let i=Array.from(function*(){for(let e of r._getDescendantSourceFilesIterator())yield e.getFilePath()}());for(let o of eV.matchGlobs(i,e,r.getPath()))yield t.getSourceFileFromCacheFromFilePath(n.getStandardizedAbsolutePath(o))}("string"==typeof e?[e]:e)):Array.from(this._getSourceFilesIterator())}_getSourceFilesIterator(){return this._context.compilerFactory.getChildSourceFilesOfDirectory(this.getPath())}getDescendantSourceFiles(){return Array.from(this._getDescendantSourceFilesIterator())}*_getDescendantSourceFilesIterator(){for(let e of this._getSourceFilesIterator())yield e;for(let e of this._getDirectoriesIterator())yield*e._getDescendantSourceFilesIterator()}getDescendantDirectories(){return Array.from(this._getDescendantDirectoriesIterator())}*_getDescendantDirectoriesIterator(){for(let e of this.getDirectories())yield e,yield*e._getDescendantDirectoriesIterator()}addSourceFilesAtPaths(e){return e=(e="string"==typeof e?[e]:e).map(e=>eV.FileUtils.pathIsAbsolute(e)?e:eV.FileUtils.pathJoin(this.getPath(),e)),this._context.directoryCoordinator.addSourceFilesAtPaths(e,{markInProject:this._isInProject()})}addDirectoryAtPathIfExists(e,t={}){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPathIfExists(n,{...t,markInProject:this._isInProject()})}addDirectoryAtPath(e,t={}){let n=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.directoryCoordinator.addDirectoryAtPath(n,{...t,markInProject:this._isInProject()})}createDirectory(e){let t=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.directoryCoordinator.createDirectoryOrAddIfExists(t,{markInProject:this._isInProject()})}createSourceFile(e,t,n){let r=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.compilerFactory.createSourceFile(r,t||"",{...n||{},markInProject:this._isInProject()})}addSourceFileAtPathIfExists(e){let t=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPathIfExists(t,{markInProject:this._isInProject()})}addSourceFileAtPath(e){let t=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return this._context.directoryCoordinator.addSourceFileAtPath(t,{markInProject:this._isInProject()})}async emit(e={}){let{fileSystemWrapper:t}=this._context,n=[],r=[],i=[];for(let o of this.#nf(e))lN(o)?i.push(o):(n.push(t.writeFile(o.filePath,o.fileText)),r.push(o.filePath));return await Promise.all(n),new lD(i,r)}emitSync(e={}){let{fileSystemWrapper:t}=this._context,n=[],r=[];for(let i of this.#nf(e))lN(i)?r.push(i):(t.writeFileSync(i.filePath,i.fileText),n.push(i.filePath));return new lD(r,n)}#nf(e={}){let{emitOnlyDtsFiles:t=!1}=e,n=null==e.outDir?void 0:/\.js$/i,r=null==e.outDir?void 0:/\.js\.map$/i,i=null==e.declarationDir&&null==e.outDir?void 0:/\.d\.ts$/i,o=e=>null==e?void 0:this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath()),a=(e,t)=>null==e?void 0:eV.FileUtils.pathJoin(e,t.getBaseName()),s=null!=this._context.compilerOptions.get().declarationDir||null!=e.declarationDir;return function* e(o,l,c){for(let e of o.getSourceFiles()){let o=e.getEmitOutput({emitOnlyDtsFiles:t});if(o.getEmitSkipped()){yield e.getFilePath();continue}for(let e of o.getOutputFiles()){let t=e.getFilePath(),o=e.getWriteByteOrderMark()?eV.FileUtils.getTextWithByteOrderMark(e.getText()):e.getText();null!=l&&(n.test(t)||r.test(t)||!s&&i.test(t))?t=eV.FileUtils.pathJoin(l,eV.FileUtils.getBaseName(t)):null!=c&&i.test(t)&&(t=eV.FileUtils.pathJoin(c,eV.FileUtils.getBaseName(t))),yield{filePath:t,fileText:o}}}for(let t of o.getDirectories())yield*e(t,a(l,t),a(c,t))}(this,o(e.outDir),o(e.declarationDir))}copyToDirectory(e,t){let n="string"==typeof e?e:e.getPath();return this.copy(eV.FileUtils.pathJoin(n,this.getBaseName()),t)}copy(e,t){let n=this.getPath(),r=this._context.fileSystemWrapper,i=this._context.fileSystemWrapper.getStandardizedAbsolutePath(e,this.getPath());return n===i?this:((t=lI(t)).includeUntrackedFiles&&r.queueCopyDirectory(n,i),this.#nm(i,t))}async copyImmediately(e,t){let n=this._context.fileSystemWrapper,r=this.getPath(),i=n.getStandardizedAbsolutePath(e,r);if(r===i)return await this.save(),this;t=lI(t);let o=this.#nm(i,t);return t.includeUntrackedFiles&&await n.copyDirectoryImmediately(r,i),await o.save(),o}copyImmediatelySync(e,t){let n=this._context.fileSystemWrapper,r=this.getPath(),i=n.getStandardizedAbsolutePath(e,r);if(r===i)return this.saveSync(),this;t=lI(t);let o=this.#nm(i,t);return t.includeUntrackedFiles&&n.copyDirectoryImmediatelySync(r,i),o.saveSync(),o}#nm(e,t){if(this.getPath()===e)return this;let{fileSystemWrapper:n,compilerFactory:r}=this._context,i=[this,...this.getDescendantDirectories()].map(t=>({newDirPath:t===this?e:n.getStandardizedAbsolutePath(this.getRelativePathTo(t),e)})),o=this.getDescendantSourceFiles().map(t=>({sourceFile:t,newFilePath:n.getStandardizedAbsolutePath(this.getRelativePathTo(t),e),references:this.#n_(t)}));for(let{newDirPath:e}of i)this._context.compilerFactory.createDirectoryOrAddIfExists(e,{markInProject:this._isInProject()});for(let{sourceFile:e,newFilePath:n}of o)e._copyInternal(n,t);for(let{references:e,newFilePath:t}of o)this.getSourceFileOrThrow(t)._updateReferencesForCopyInternal(e);return r.getDirectoryFromCache(e)}moveToDirectory(e,t){let n="string"==typeof e?e:e.getPath();return this.move(eV.FileUtils.pathJoin(n,this.getBaseName()),t)}move(e,t){let n=this._context.fileSystemWrapper,r=this.getPath(),i=n.getStandardizedAbsolutePath(e,r);return r===i?this:this.#nh(i,t,()=>n.queueMoveDirectory(r,i))}async moveImmediately(e,t){let n=this._context.fileSystemWrapper,r=this.getPath(),i=n.getStandardizedAbsolutePath(e,r);return r===i||(this.#nh(i,t),await n.moveDirectoryImmediately(r,i)),await this.save(),this}moveImmediatelySync(e,t){let n=this._context.fileSystemWrapper,r=this.getPath(),i=n.getStandardizedAbsolutePath(e,r);return r===i||(this.#nh(i,t),n.moveDirectoryImmediatelySync(r,i)),this.saveSync(),this}#nh(e,t,n){let r=this.getPath();if(r===e)return this;let i=this._context.compilerFactory.getDirectoryFromCacheOnlyIfInCache(e),o=null!=i&&i._isInProject();n&&n();let a=this._context.fileSystemWrapper,s=this._context.compilerFactory,l=[this,...this.getDescendantDirectories()].map(t=>({directory:t,oldPath:t.getPath(),newDirPath:t===this?e:a.getStandardizedAbsolutePath(this.getRelativePathTo(t),e)})),c=this.getDescendantSourceFiles().map(t=>({sourceFile:t,newFilePath:a.getStandardizedAbsolutePath(this.getRelativePathTo(t),e),references:this.#ng(t)}));for(let{directory:e,oldPath:t,newDirPath:n}of l){s.removeDirectoryFromCache(t);let r=s.getDirectoryFromCache(n);null!=r&&r._forgetOnlyThis(),e._setPathInternal(n),s.addDirectoryToCache(e)}for(let{sourceFile:e,newFilePath:n}of c)e._moveInternal(n,t);for(let{sourceFile:e,references:t}of c)e._updateReferencesForMoveInternal(t,r);return o&&this._markAsInProject(),this}clear(){let e=this.getPath();this.#ny(),this._context.fileSystemWrapper.queueDirectoryDelete(e),this._context.fileSystemWrapper.queueMkdir(e)}async clearImmediately(){let e=this.getPath();this.#ny(),await this._context.fileSystemWrapper.clearDirectoryImmediately(e)}clearImmediatelySync(){let e=this.getPath();this.#ny(),this._context.fileSystemWrapper.clearDirectoryImmediatelySync(e)}delete(){let e=this.getPath();this.#ny(),this._context.fileSystemWrapper.queueDirectoryDelete(e),this.forget()}#ny(){for(let e of this.getSourceFiles())e.delete();for(let e of this.getDirectories())e.delete()}async deleteImmediately(){let{fileSystemWrapper:e}=this._context,t=this.getPath();this.forget(),await e.deleteDirectoryImmediately(t)}deleteImmediatelySync(){let{fileSystemWrapper:e}=this._context,t=this.getPath();this.forget(),e.deleteDirectoryImmediatelySync(t)}forget(){if(!this.wasForgotten()){for(let e of this.getSourceFiles())e.forget();for(let e of this.getDirectories())e.forget();this._forgetOnlyThis()}}_forgetOnlyThis(){this.wasForgotten()||(this._context.compilerFactory.removeDirectoryFromCache(this.getPath()),this.#tH=void 0)}async save(){await this._context.fileSystemWrapper.saveForDirectory(this.getPath());let e=this.getDescendantSourceFiles().filter(e=>!e.isSaved());await Promise.all(e.map(e=>e.save()))}saveSync(){this._context.fileSystemWrapper.saveForDirectorySync(this.getPath()),this.getDescendantSourceFiles().filter(e=>!e.isSaved()).forEach(e=>e.saveSync())}getRelativePathTo(e){let t=this;return eV.FileUtils.getRelativePathTo(this.getPath(),e instanceof ae?e.getFilePath():e instanceof lC?e.getPath():t._context.fileSystemWrapper.getStandardizedAbsolutePath(e,t.getPath()))}getRelativePathAsModuleSpecifierTo(e){let t=this._context.program.getEmitModuleResolutionKind(),n=this,r=eV.FileUtils.getRelativePathTo(this.getPath(),function(){return e instanceof ae?r(e.getFilePath()):e instanceof lC?function(e){switch(t){case eV.ModuleResolutionKind.Node10:if(e===n)return eV.FileUtils.pathJoin(e.getPath(),"index.ts");return e.getPath();case eV.ModuleResolutionKind.Classic:case eV.ModuleResolutionKind.Node16:case eV.ModuleResolutionKind.NodeNext:case eV.ModuleResolutionKind.Bundler:return eV.FileUtils.pathJoin(e.getPath(),"index.ts");default:return eV.errors.throwNotImplementedForNeverValueError(t)}}(e):r(n._context.fileSystemWrapper.getStandardizedAbsolutePath(e,n.getPath()));function r(e){let r=eV.FileUtils.getDirPath(e);switch(t){case eV.ModuleResolutionKind.Node10:if(r===n.getPath())return e;return e.replace(/\/index?(\.d\.ts|\.ts|\.js)$/i,"");case eV.ModuleResolutionKind.Classic:case eV.ModuleResolutionKind.Node16:case eV.ModuleResolutionKind.NodeNext:case eV.ModuleResolutionKind.Bundler:return e;default:return eV.errors.throwNotImplementedForNeverValueError(t)}}}()).replace(/((\.d\.ts$)|(\.[^/.]+$))/i,"");return r.startsWith("../")?r:"./"+r}getProject(){return this._context.project}wasForgotten(){return null==this.#tH}_isInProject(){return this._context.inProjectCoordinator.isDirectoryInProject(this)}_markAsInProject(){this._context.inProjectCoordinator.markDirectoryAsInProject(this)}_hasLoadedParent(){return this._context.compilerFactory.containsDirectoryAtPath(eV.FileUtils.getDirPath(this.getPath()))}#nu(){if(this.wasForgotten())throw new eV.errors.InvalidOperationError("Cannot use a directory that was deleted, removed, or overwritten.")}#n_(e){return e._getReferencesForCopyInternal().filter(e=>!this.isAncestorOf(e[1]))}#ng(e){let{literalReferences:t,referencingLiterals:n}=e._getReferencesForMoveInternal();return{literalReferences:t.filter(e=>!this.isAncestorOf(e[1])),referencingLiterals:n.filter(e=>!this.isAncestorOf(e._sourceFile))}}static #np(e,t){if(t instanceof ae&&e===(t=t.getDirectory()))return!0;if(e.#nd.length>=t.#nd.length)return!1;for(let n=e.#nd.length-1;n>=0;n--)if(e.#nd[n]!==t.#nd[n])return!1;return!0}}function lI(e){return td(e=eV.ObjectUtils.clone(e||{}),"includeUntrackedFiles",!0),e}function lN(e){return"string"==typeof e}class lP{#nv;#ez;constructor(e,t){this.#ez=e,this.#nv=t}addDirectoryAtPathIfExists(e,t){let n=this.#ez.getDirectoryFromPath(e,t);if(null!=n){if(t.recursive)for(let n of eV.FileUtils.getDescendantDirectories(this.#nv,e))this.#ez.createDirectoryOrAddIfExists(n,t);return n}}addDirectoryAtPath(e,t){let n=this.addDirectoryAtPathIfExists(e,t);if(null==n)throw new eV.errors.DirectoryNotFoundError(e);return n}createDirectoryOrAddIfExists(e,t){return this.#ez.createDirectoryOrAddIfExists(e,t)}addSourceFileAtPathIfExists(e,t){return this.#ez.addOrGetSourceFileFromFilePath(e,{markInProject:t.markInProject,scriptKind:void 0})}addSourceFileAtPath(e,t){let n=this.addSourceFileAtPathIfExists(e,t);if(null==n)throw new eV.errors.FileNotFoundError(this.#nv.getStandardizedAbsolutePath(e));return n}addSourceFilesAtPaths(e,t){"string"==typeof e&&(e=[e]);let n=[],r=new Set;for(let i of this.#nv.globSync(e)){let e=this.addSourceFileAtPathIfExists(i,t);null!=e&&n.push(e),r.add(eV.FileUtils.getDirPath(i))}for(let e of eV.FileUtils.getParentMostPaths(Array.from(r)))this.addDirectoryAtPathIfExists(e,{recursive:!0,markInProject:t.markInProject});return n}}class lR{#tH;#nb=new eV.KeyValueCache;#nx=new eV.KeyValueCache;#nS=new eV.KeyValueCache;#nE=new eV.KeyValueCache;constructor(e){this.#tH=e}has(e){return this.#nb.has(e)}get(e){if(!this.#nb.has(e)){for(let t of this.#nE.getValues())if(eV.FileUtils.pathStartsWith(t.getPath(),e))return this.createOrAddIfExists(e);return}return this.#nb.get(e)}getOrphans(){return this.#nE.getValues()}getAll(){return this.#nb.getValuesAsArray()}*getAllByDepth(){let e=new eV.KeyValueCache,t=0;for(let e of this.getOrphans())n(e);for(t=Math.min(...Array.from(e.getKeys()));e.getSize()>0;){for(let r of e.get(t)||[])yield r,r.getDirectories().forEach(n);e.removeByKey(t),t++}function n(n){let r=n._getDepth();if(t>r)throw Error(`For some reason a subdirectory had a lower depth than the parent directory: ${n.getPath()}`);e.getOrCreate(r,()=>[]).push(n)}}remove(e){this.#nT(e),this.#nb.removeByKey(e),this.#nE.removeByKey(e)}*getChildDirectoriesOfDirectory(e){let t=this.#nS.get(e)?.entries();if(null!=t)for(let e of t)yield e}*getChildSourceFilesOfDirectory(e){let t=this.#nx.get(e)?.entries();if(null!=t)for(let e of t)yield e}addSourceFile(e){let t=e.getDirectoryPath();this.createOrAddIfExists(t),this.#nx.getOrCreate(t,()=>new eV.SortedKeyValueArray(e=>e.getBaseName(),eV.LocaleStringComparer.instance)).set(e)}removeSourceFile(e){let t=eV.FileUtils.getDirPath(e),n=this.#nx.get(t);null!=n&&(n.removeByKey(eV.FileUtils.getBaseName(e)),n.hasItems()||this.#nx.removeByKey(t))}createOrAddIfExists(e){return this.has(e)?this.get(e):(this.#nA(e),this.#nD(e))}#nD(e){let t=new lC(this.#tH,e);return this.addDirectory(t),t}addDirectory(e){let t=e.getPath(),n=eV.FileUtils.getDirPath(t),r=n===t;for(let e of this.#nE.getValues()){let n=e.getPath(),r=eV.FileUtils.getDirPath(n);r!==n&&r===t&&this.#nE.removeByKey(n)}for(let i of(r||this.#nC(e),this.has(n)||this.#nE.set(t,e),this.#nb.set(t,e),this.#tH.fileSystemWrapper.directoryExistsSync(t)||this.#tH.fileSystemWrapper.queueMkdir(t),this.#nE.getValues()))e.isAncestorOf(i)&&this.#nA(i.getPath())}#nC(e){if(eV.FileUtils.isRootDirPath(e.getPath()))return;let t=eV.FileUtils.getDirPath(e.getPath());this.#nS.getOrCreate(t,()=>new eV.SortedKeyValueArray(e=>e.getBaseName(),eV.LocaleStringComparer.instance)).set(e)}#nT(e){if(eV.FileUtils.isRootDirPath(e))return;let t=eV.FileUtils.getDirPath(e),n=this.#nS.get(t);null!=n&&(n.removeByKey(eV.FileUtils.getBaseName(e)),n.hasItems()||this.#nS.removeByKey(t))}#nA(e){let t=[],n=eV.FileUtils.getDirPath(e);for(;e!==n;){if(e=n,n=eV.FileUtils.getDirPath(e),this.#nb.has(e)){for(let e of t)this.#nD(e);break}t.unshift(e)}}}class lM extends eV.KeyValueCache{#nI=[];getOrCreate(e,t){return super.getOrCreate(e,()=>{let e=t();return this.#nI.length>0&&this.#nI[this.#nI.length-1].add(e),e})}setForgetPoint(){this.#nI.push(new Set)}forgetLastPoint(){let e=this.#nI.pop();null!=e&&this.#nN(e.values())}rememberNode(e){if(e.wasForgotten())throw new eV.errors.InvalidOperationError("Cannot remember a node that was removed or forgotten.");let t=!1;for(let n of this.#nI)if(n.delete(e)){t=!0;break}return t&&this.#nP(e),t}#nP(e){let t=e.getParentSyntaxList()||e.getParent();null!=t&&this.rememberNode(t)}#nN(e){for(let t of e)t.wasForgotten()||t.getKind()===eV.SyntaxKind.SourceFile||t._forgetOnlyThis()}}let lk={[eV.SyntaxKind.SourceFile]:ae,[eV.SyntaxKind.ArrayBindingPattern]:class extends nL{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.ArrayLiteralExpression]:class extends ij{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}addElement(e,t){return this.addElements([e],t)[0]}addElements(e,t){return this.insertElements(this.compilerNode.elements.length,e,t)}insertElement(e,t,n){return this.insertElements(e,[t],n)[0]}insertElements(e,t,n={}){var r,i;let o=this.getElements();e=tX(e,o.length);let a=(r=this,null!=n.useNewLines?n.useNewLines:o.length>1?function(){let e=o[0].getStartLineNumber();for(let t=1;t<o.length;t++){let n=o[t].getStartLineNumber();if(e===n)return!1;e=n}return!0}():r.getStartLineNumber()!==r.getEndLineNumber()),s=a?this._getWriterWithChildIndentation():this._getWriterWithQueuedChildIndentation(),l=new rg;return(a?new n5(l):new n6(l)).printText(s,t),i=this,n_({parent:i.getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:o,insertIndex:e,newText:s.toString(),useNewLines:a,useTrailingCommas:a&&i._context.manipulationSettings.getUseTrailingCommas()}),tU(o,i.getElements(),e,!1)}removeElement(e){let t=this.getElements();if(0===t.length)throw new eV.errors.InvalidOperationError("Cannot remove an element when none exist.");nE("number"==typeof e?t[tX(e,t.length-1)]:e)}},[eV.SyntaxKind.ArrayType]:class extends aJ{getElementTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.elementType)}},[eV.SyntaxKind.ArrowFunction]:class extends as{getEqualsGreaterThan(){return this._getNodeFromCompilerNode(this.compilerNode.equalsGreaterThanToken)}},[eV.SyntaxKind.AsExpression]:class extends iU{},[eV.SyntaxKind.AwaitExpression]:class extends iH{},[eV.SyntaxKind.BigIntLiteral]:class extends sK{getLiteralValue(){let e=this.compilerNode.text;if("undefined"==typeof BigInt)throw new eV.errors.InvalidOperationError("Runtime environment does not support BigInts. Perhaps work with the text instead?");return BigInt(e.substring(0,e.length-1))}setLiteralValue(e){if("bigint"!=typeof e)throw new eV.errors.ArgumentTypeError("value","bigint",typeof e);return nD({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:e.toString()+"n"}),this}},[eV.SyntaxKind.BindingElement]:class extends iR{getPropertyNameNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getPropertyNameNode(),e??"Expected to find a property name node.",this)}getPropertyNameNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.propertyName)}},[eV.SyntaxKind.BinaryExpression]:iL,[eV.SyntaxKind.Block]:class extends ob{},[eV.SyntaxKind.BreakStatement]:class extends og{getLabel(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.label)}getLabelOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getLabel(),e??"Expected to find a label.",this)}},[eV.SyntaxKind.CallExpression]:class extends iq{getReturnType(){return this._context.typeChecker.getTypeAtLocation(this)}},[eV.SyntaxKind.CallSignature]:class extends sv{set(e){return tD(sv.prototype,this,e),this}getStructure(){return tA(sv.prototype,this,{kind:t.StructureKind.CallSignature})}},[eV.SyntaxKind.CaseBlock]:class extends ox{getClauses(){return(this.compilerNode.clauses||[]).map(e=>this._getNodeFromCompilerNode(e))}removeClause(e){return e=tX(e,this.getClauses().length-1),this.removeClauses([e,e])}removeClauses(e){let t=this.getClauses();return eV.errors.throwIfRangeOutOfRange(e,[0,t.length],"indexRange"),nA(t.slice(e[0],e[1]+1)),this}},[eV.SyntaxKind.CaseClause]:class extends oS{remove(){nA([this])}},[eV.SyntaxKind.CatchClause]:class extends oE{getBlock(){return this._getNodeFromCompilerNode(this.compilerNode.block)}getVariableDeclaration(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.variableDeclaration)}getVariableDeclarationOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getVariableDeclaration(),e??"Expected to find a variable declaration.",this)}},[eV.SyntaxKind.ClassDeclaration]:class extends aI{set(e){return tD(aI.prototype,this,e),null!=e.extends?this.setExtends(e.extends):e.hasOwnProperty(eV.nameof(e,"extends"))&&this.removeExtends(),null!=e.ctors&&(this.getConstructors().forEach(e=>e.remove()),this.addConstructors(e.ctors)),null!=e.staticBlocks&&(this.getStaticBlocks().forEach(e=>e.remove()),this.addStaticBlocks(e.staticBlocks)),null!=e.properties&&(this.getProperties().forEach(e=>e.remove()),this.addProperties(e.properties)),null!=e.getAccessors&&(this.getGetAccessors().forEach(e=>e.remove()),this.addGetAccessors(e.getAccessors)),null!=e.setAccessors&&(this.getSetAccessors().forEach(e=>e.remove()),this.addSetAccessors(e.setAccessors)),null!=e.methods&&(this.getMethods().forEach(e=>e.remove()),this.addMethods(e.methods)),this}getStructure(){let e=this.getExtends(),n=this.isAmbient();return tA(aI.prototype,this,{kind:t.StructureKind.Class,ctors:this.getConstructors().filter(e=>n||!e.isOverload()).map(e=>e.getStructure()),staticBlocks:this.getStaticBlocks().map(e=>e.getStructure()),methods:this.getMethods().filter(e=>n||!e.isOverload()).map(e=>e.getStructure()),properties:this.getProperties().map(e=>e.getStructure()),extends:e?e.getText():void 0,getAccessors:this.getGetAccessors().map(e=>e.getStructure()),setAccessors:this.getSetAccessors().map(e=>e.getStructure())})}extractInterface(e){let{constructors:n,properties:r,methods:i,accessors:o}=aN(this,!1),a=n.map(e=>e.getParameters().filter(e=>e.isParameterProperty())).flat().filter(e=>null!=e.getName()&&e.getScope()===t.Scope.Public);return{kind:t.StructureKind.Interface,name:aP(e,this),docs:this.getJsDocs().map(e=>e.getStructure()),typeParameters:this.getTypeParameters().map(e=>e.getStructure()),properties:[...a.map(e=>{let n=e.getParentOrThrow().getJsDocs().map(e=>e.getTags()).flat().filter(nL.isJSDocParameterTag).filter(t=>"param"===t.getTagName()&&t.getName()===e.getName()&&null!=t.getComment()).map(e=>e.getCommentText().trim())[0];return{kind:t.StructureKind.PropertySignature,docs:null==n?[]:[{kind:t.StructureKind.JSDoc,description:n}],name:e.getName(),type:e.getType().getText(e),hasQuestionToken:e.hasQuestionToken(),isReadonly:e.isReadonly()}}),...r.map(aR),...o.map(aM)],methods:i.map(ak)}}extractStaticInterface(e){let{constructors:n,properties:r,methods:i,accessors:o}=aN(this,!0),a=aP(void 0,this);return{kind:t.StructureKind.Interface,name:e,properties:[...r.map(aR),...o.map(aM)],methods:i.map(ak),constructSignatures:n.map(e=>({kind:t.StructureKind.ConstructSignature,docs:e.getJsDocs().map(e=>e.getStructure()),parameters:e.getParameters().map(e=>({...aw(e),scope:void 0,isReadonly:!1})),returnType:a}))}}},[eV.SyntaxKind.ClassExpression]:class extends aL{},[eV.SyntaxKind.ClassStaticBlockDeclaration]:class extends aO{getName(){return"static"}isStatic(){return!0}set(e){return tD(aO.prototype,this,e),this}getStructure(){return tA(aO.prototype,this,{kind:t.StructureKind.ClassStaticBlock})}},[eV.SyntaxKind.ConditionalType]:class extends aJ{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)}},[eV.SyntaxKind.Constructor]:class extends aW{set(e){return tD(aW.prototype,this,e),null!=e.overloads&&(this.getOverloads().forEach(e=>e.remove()),this.addOverloads(e.overloads)),this}addOverload(e){return this.addOverloads([e])[0]}addOverloads(e){return this.insertOverloads(this.getOverloads().length,e)}insertOverload(e,t){return this.insertOverloads(e,[t])[0]}insertOverloads(e,t){let n=this._context.structurePrinterFactory.forConstructorDeclaration({isAmbient:to(this)});return ap({node:this,index:e,structures:t,printStructure:(e,t)=>{n.printOverload(e,t)},getThisStructure:tq,expectedSyntaxKind:eV.SyntaxKind.Constructor})}getStructure(){var e;let n=null!=this.getImplementation(),r=this.isOverload();return tA(r&&n?aB.prototype:aW.prototype,this,(e=this,n&&r?{kind:t.StructureKind.ConstructorOverload}:n?{kind:t.StructureKind.Constructor,overloads:e.getOverloads().map(e=>e.getStructure())}:{kind:t.StructureKind.Constructor}))}},[eV.SyntaxKind.ConstructorType]:class extends aZ{},[eV.SyntaxKind.ConstructSignature]:class extends sx{set(e){return tD(sx.prototype,this,e),this}getStructure(){return tA(sx.prototype,this,{kind:t.StructureKind.ConstructSignature})}},[eV.SyntaxKind.ContinueStatement]:class extends og{getLabel(){return null==this.compilerNode.label?void 0:this._getNodeFromCompilerNode(this.compilerNode.label)}getLabelOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getLabel(),e??"Expected to find a label.",this)}},[eV.SyntaxKind.CommaListExpression]:class extends iJ{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.ComputedPropertyName]:class extends sN{},[eV.SyntaxKind.ConditionalExpression]:class extends i${getCondition(){return this._getNodeFromCompilerNode(this.compilerNode.condition)}getQuestionToken(){return this._getNodeFromCompilerNode(this.compilerNode.questionToken)}getWhenTrue(){return this._getNodeFromCompilerNode(this.compilerNode.whenTrue)}getColonToken(){return this._getNodeFromCompilerNode(this.compilerNode.colonToken)}getWhenFalse(){return this._getNodeFromCompilerNode(this.compilerNode.whenFalse)}},[eV.SyntaxKind.DebuggerStatement]:class extends oA{},[eV.SyntaxKind.Decorator]:class extends aK{getName(){return this.getNameNode().getText()}getNameNode(){let e=this.getCallExpression();if(e)return t(e.getExpression());return t(this._getInnerExpression());function t(e){var t;let n=(t=e,nL.isPropertyAccessExpression(t)?t.getNameNode():t);if(!nL.isIdentifier(n))throw new eV.errors.NotImplementedError(`Expected the decorator expression '${n.getText()}' to be an identifier. Please deal directly with 'getExpression()' on the decorator to handle more complex scenarios.`);return n}}getFullName(){let e=this.getSourceFile();return this.isDecoratorFactory()?this.getCallExpression().getExpression().getText():this.compilerNode.expression.getText(e.compilerNode)}isDecoratorFactory(){return nL.isCallExpression(this._getInnerExpression())}setIsDecoratorFactory(e){if(this.isDecoratorFactory()===e)return this;if(e){let e=this._getInnerExpression(),t=e.getText();nm({parent:this,insertPos:e.getStart(),newText:`${t}()`,replacing:{textLength:t.length},customMappings:t=>[{currentNode:e,newNode:t.expression.expression}]})}else{let e=this.getCallExpressionOrThrow(),t=e.getExpression(),n=t.getText();nm({parent:this,insertPos:e.getStart(),newText:`${n}`,replacing:{textLength:e.getWidth()},customMappings:e=>[{currentNode:t,newNode:e.expression}]})}return this}getCallExpressionOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getCallExpression(),e??"Expected to find a call expression.",this)}getCallExpression(){let e=this._getInnerExpression();return nL.isCallExpression(e)?e:void 0}getArguments(){return this.getCallExpression()?.getArguments()??[]}getTypeArguments(){return this.getCallExpression()?.getTypeArguments()??[]}addTypeArgument(e){return this.getCallExpressionOrThrow().addTypeArgument(e)}addTypeArguments(e){return this.getCallExpressionOrThrow().addTypeArguments(e)}insertTypeArgument(e,t){return this.getCallExpressionOrThrow().insertTypeArgument(e,t)}insertTypeArguments(e,t){return this.getCallExpressionOrThrow().insertTypeArguments(e,t)}removeTypeArgument(e){let t=this.getCallExpression();if(null==t)throw new eV.errors.InvalidOperationError("Cannot remove a type argument from a decorator that has no type arguments.");return t.removeTypeArgument(e),this}addArgument(e){return this.addArguments([e])[0]}addArguments(e){return this.insertArguments(this.getArguments().length,e)}insertArgument(e,t){return this.insertArguments(e,[t])[0]}insertArguments(e,t){return this.setIsDecoratorFactory(!0),this.getCallExpressionOrThrow().insertArguments(e,t)}removeArgument(e){let t=this.getCallExpression();if(null==t)throw new eV.errors.InvalidOperationError("Cannot remove an argument from a decorator that has no arguments.");return t.removeArgument(e),this}remove(){let e=this.getStartLinePos(),t=this.getPreviousSiblingIfKind(eV.SyntaxKind.Decorator);null!=t&&t.getStartLinePos()===e?nv({children:[this],removePrecedingSpaces:!0}):function(e){let{children:t}=e;if(0===t.length)return;let n=t[0].getParentSyntaxListOrThrow();n.getChildCount()===t.length?nb({children:[n],getSiblingFormatting:()=>eK.None}):nb(e)}({children:[this],getSiblingFormatting:(t,n)=>n.getStartLinePos()===e?eK.Space:eK.Newline})}_getInnerExpression(){let e=this.getExpression();for(;nL.isParenthesizedExpression(e);)e=e.getExpression();return e}set(e){return tD(aK.prototype,this,e),null!=e.name&&this.getNameNode().replaceWithText(e.name),null!=e.arguments&&(this.setIsDecoratorFactory(!0),this.getArguments().map(e=>this.removeArgument(e)),this.addArguments(e.arguments)),null!=e.typeArguments&&e.typeArguments.length>0&&(this.setIsDecoratorFactory(!0),this.getTypeArguments().map(e=>this.removeTypeArgument(e)),this.addTypeArguments(e.typeArguments)),this}getStructure(){let e=this.isDecoratorFactory();return tA(aK.prototype,this,{kind:t.StructureKind.Decorator,name:this.getName(),arguments:e?this.getArguments().map(e=>e.getText()):void 0,typeArguments:e?this.getTypeArguments().map(e=>e.getText()):void 0})}},[eV.SyntaxKind.DefaultClause]:class extends oD{remove(){nA([this])}},[eV.SyntaxKind.DeleteExpression]:class extends iX{},[eV.SyntaxKind.DoStatement]:class extends oI{},[eV.SyntaxKind.ElementAccessExpression]:iQ,[eV.SyntaxKind.EmptyStatement]:class extends oN{},[eV.SyntaxKind.EnumDeclaration]:class extends sh{set(e){return tD(sh.prototype,this,e),null!=e.isConst&&this.setIsConstEnum(e.isConst),null!=e.members&&(this.getMembers().forEach(e=>e.remove()),this.addMembers(e.members)),this}addMember(e){return this.addMembers([e])[0]}addMembers(e){return this.insertMembers(this.getMembers().length,e)}insertMember(e,t){return this.insertMembers(e,[t])[0]}insertMembers(e,t){if(0===t.length)return[];let n=this.getMembersWithComments();e=tX(e,n.length);let r=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forEnumMember().printTexts(r,t),n_({parent:this.getChildSyntaxListOrThrow(),currentNodes:n,insertIndex:e,newText:r.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),tU(n,this.getMembersWithComments(),e,!(t instanceof Array&&t.every(e=>"object"==typeof e)))}getMember(e){return e$(this.getMembers(),e)}getMemberOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getMember(e),()=>eY("enum member",e))}getMembers(){return this.compilerNode.members.map(e=>this._getNodeFromCompilerNode(e))}getMembersWithComments(){let e=this.compilerNode;return te.getContainerArray(e,this.getSourceFile().compilerNode).map(e=>this._getNodeFromCompilerNode(e))}setIsConstEnum(e){return this.toggleModifier("const",e)}isConstEnum(){return null!=this.getConstKeyword()}getConstKeyword(){return this.getFirstModifierByKind(eV.SyntaxKind.ConstKeyword)}getStructure(){return tA(sh.prototype,this,{kind:t.StructureKind.Enum,isConst:this.isConstEnum(),members:this.getMembers().map(e=>e.getStructure())})}},[eV.SyntaxKind.EnumMember]:class extends sg{getValue(){return this._context.typeChecker.getConstantValue(this)}setValue(e){let t;if("string"==typeof e){let n=this._context.manipulationSettings.getQuoteKind();t=n+eV.StringUtils.escapeForWithinString(e,n)+n}else t=e.toString();return this.setInitializer(t),this}remove(){let e=[this],t=this.getNextSiblingIfKind(eV.SyntaxKind.CommaToken);null!=t&&e.push(t),nb({children:e,getSiblingFormatting:()=>eK.Newline})}set(e){return tD(sg.prototype,this,e),null!=e.value?this.setValue(e.value):e.hasOwnProperty(eV.nameof(e,"value"))&&null==e.initializer&&this.removeInitializer(),this}getStructure(){return tA(sg.prototype,this,{kind:t.StructureKind.EnumMember,value:void 0})}},[eV.SyntaxKind.ExportAssignment]:class extends oG{isExportEquals(){return this.compilerNode.isExportEquals||!1}setIsExportEquals(e){return this.isExportEquals()===e||(e?this.getFirstChildByKindOrThrow(eV.SyntaxKind.DefaultKeyword).replaceWithText("="):this.getFirstChildByKindOrThrow(eV.SyntaxKind.EqualsToken).replaceWithText("default")),this}set(e){return tD(oG.prototype,this,e),null!=e.expression&&this.setExpression(e.expression),null!=e.isExportEquals&&this.setIsExportEquals(e.isExportEquals),this}getStructure(){return tA(og.prototype,this,{kind:t.StructureKind.ExportAssignment,expression:this.getExpression().getText(),isExportEquals:this.isExportEquals()})}},[eV.SyntaxKind.ExportDeclaration]:class extends oj{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(e){return this.isTypeOnly()===e||(e?nm({parent:this,insertPos:(this.getNodeProperty("exportClause")??this.getFirstChildByKindOrThrow(eV.SyntaxKind.AsteriskToken)).getStart(),newText:"type "}):nv({children:[this.getFirstChildByKindOrThrow(eV.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0})),this}getNamespaceExport(){let e=this.getNodeProperty("exportClause");return null!=e&&nL.isNamespaceExport(e)?e:void 0}getNamespaceExportOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getNamespaceExport(),e??"Expected to find a namespace export.",this)}setNamespaceExport(e){let t=this.getNodeProperty("exportClause"),n=eV.StringUtils.isNullOrWhitespace(e)?"*":`* as ${e}`;return null==t?nm({insertPos:this.getFirstChildByKindOrThrow(eV.SyntaxKind.AsteriskToken).getStart(),parent:this,newText:n,replacing:{textLength:1}}):nL.isNamespaceExport(t)?t.getNameNode().replaceWithText(e):nm({insertPos:t.getStart(),parent:this,newText:n,replacing:{textLength:t.getWidth()}}),this}setModuleSpecifier(e){let t="string"==typeof e?e:this._sourceFile.getRelativePathAsModuleSpecifierTo(e);if(eV.StringUtils.isNullOrEmpty(t))return this.removeModuleSpecifier(),this;let n=this.getModuleSpecifier();if(null==n){let e=this.getLastChildIfKind(eV.SyntaxKind.SemicolonToken),n=this._context.manipulationSettings.getQuoteKind();nm({insertPos:null!=e?e.getPos():this.getEnd(),parent:this,newText:` from ${n}${t}${n}`})}else n.setLiteralValue(t);return this}getModuleSpecifier(){let e=this._getNodeFromCompilerNodeIfExists(this.compilerNode.moduleSpecifier);if(null!=e){if(!nL.isStringLiteral(e))throw new eV.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return e}}getModuleSpecifierValue(){let e=this.getModuleSpecifier();return e?.getLiteralValue()}getModuleSpecifierSourceFileOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),e??"A module specifier source file was expected.",this)}getModuleSpecifierSourceFile(){let e=this.getLastChildByKind(eV.SyntaxKind.StringLiteral);if(null==e)return;let t=e.getSymbol();if(null==t)return;let n=t.getDeclarations()[0];return null!=n&&nL.isSourceFile(n)?n:void 0}isModuleSpecifierRelative(){let e=this.getModuleSpecifierValue();return null!=e&&ts.isModuleSpecifierRelative(e)}removeModuleSpecifier(){let e=this.getModuleSpecifier();if(null==e)return this;if(!this.hasNamedExports())throw new eV.errors.InvalidOperationError("Cannot remove the module specifier from an export declaration that has no named exports.");return nv({children:[this.getFirstChildByKindOrThrow(eV.SyntaxKind.FromKeyword),e],removePrecedingNewLines:!0,removePrecedingSpaces:!0}),this}hasModuleSpecifier(){return null!=this.getLastChildByKind(eV.SyntaxKind.StringLiteral)}isNamespaceExport(){return!this.hasNamedExports()}hasNamedExports(){return this.compilerNode.exportClause?.kind===eV.SyntaxKind.NamedExports}addNamedExport(e){return this.addNamedExports([e])[0]}addNamedExports(e){return this.insertNamedExports(this.getNamedExports().length,e)}insertNamedExport(e,t){return this.insertNamedExports(e,[t])[0]}insertNamedExports(e,t){if(!(t instanceof Function)&&eV.ArrayUtils.isNullOrEmpty(t))return[];let n=this.getNamedExports(),r=this._getWriterWithIndentation(),i=this._context.structurePrinterFactory.forNamedImportExportSpecifier();e=tX(e,n.length);let o=this.getNodeProperty("exportClause");return null==o?(i.printTextsWithBraces(r,t),nm({insertPos:this.getFirstChildByKindOrThrow(eV.SyntaxKind.AsteriskToken).getStart(),parent:this,newText:r.toString(),replacing:{textLength:1}})):o.getKind()===eV.SyntaxKind.NamespaceExport?(i.printTextsWithBraces(r,t),nm({insertPos:o.getStart(),parent:this,newText:r.toString(),replacing:{textLength:o.getWidth()}})):(i.printTexts(r,t),n_({parent:this.getFirstChildByKindOrThrow(eV.SyntaxKind.NamedExports).getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:n,insertIndex:e,newText:r.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1})),tU(n,this.getNamedExports(),e,!1)}getNamedExports(){let e=this.compilerNode.exportClause;return null==e||eV.ts.isNamespaceExport(e)?[]:e.elements.map(e=>this._getNodeFromCompilerNode(e))}toNamespaceExport(){if(!this.hasModuleSpecifier())throw new eV.errors.InvalidOperationError("Cannot change to a namespace export when no module specifier exists.");let e=this.getNodeProperty("exportClause");return null==e||nm({parent:this,newText:"*",insertPos:e.getStart(),replacing:{textLength:e.getWidth()}}),this}setAttributes(e){let t=this.getAttributes();if(t)e?t.setElements(e):t.remove();else if(e){let t=this._context.structurePrinterFactory.forImportAttribute(),n=this._context.createWriter();n.space(),t.printAttributes(n,e),nm({parent:this,newText:n.toString(),insertPos:";"===this.getSourceFile().getFullText()[this.getEnd()-1]?this.getEnd()-1:this.getEnd()})}return this}getAttributes(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes)}set(e){return tD(oj.prototype,this,e),null!=e.namedExports?(function(e){let t,n=e.getNodeProperty("exportClause");if(null!=n){if(0===e.getNamedExports().length)return;t=n}else t=e.getFirstChildByKindOrThrow(eV.SyntaxKind.AsteriskToken);nm({parent:e,newText:"{ }",insertPos:t.getStart(),replacing:{textLength:t.getWidth()}})}(this),this.addNamedExports(e.namedExports)):e.hasOwnProperty(eV.nameof(e,"namedExports"))&&null==e.moduleSpecifier&&this.toNamespaceExport(),null!=e.moduleSpecifier?this.setModuleSpecifier(e.moduleSpecifier):e.hasOwnProperty(eV.nameof(e,"moduleSpecifier"))&&this.removeModuleSpecifier(),null==e.namedExports&&e.hasOwnProperty(eV.nameof(e,"namedExports"))&&this.toNamespaceExport(),null!=e.namespaceExport&&this.setNamespaceExport(e.namespaceExport),null!=e.isTypeOnly&&this.setIsTypeOnly(e.isTypeOnly),e.hasOwnProperty(eV.nameof(e,"attributes"))&&this.setAttributes(e.attributes),this}getStructure(){let e=this.getModuleSpecifier(),n=this.getAttributes();return tA(oj.prototype,this,{kind:t.StructureKind.ExportDeclaration,isTypeOnly:this.isTypeOnly(),moduleSpecifier:e?.getLiteralText(),namedExports:this.getNamedExports().map(e=>e.getStructure()),namespaceExport:this.getNamespaceExport()?.getName(),attributes:n?n.getElements().map(e=>e.getStructure()):void 0})}},[eV.SyntaxKind.ExportSpecifier]:class extends oK{setName(e){let t=this.getNameNode();return this.getName()===e||(ty(e)?t.replaceWithText(e):t.replaceWithText(`"${e.replaceAll('"','\\"')}"`)),this}getName(){let e=this.getNameNode();return e.getKind()===eV.ts.SyntaxKind.StringLiteral?e.getLiteralText():e.getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.propertyName||this.compilerNode.name)}renameAlias(e){if(eV.StringUtils.isNullOrWhitespace(e))return this.removeAliasWithRename(),this;let t=this.getAliasNode();return null==t&&(this.setAlias(this.getName()),t=this.getAliasNode()),t.getKind()===eV.SyntaxKind.Identifier&&t.rename(e),this}setAlias(e){if(eV.StringUtils.isNullOrWhitespace(e))return this.removeAlias(),this;let t=this.getAliasNode();return null==t?nm({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${e}`}):ty(e)?t.replaceWithText(e):t.replaceWithText(`"${e.replaceAll('"','\\"')}"`),this}removeAlias(){let e=this.getAliasNode();return null==e||nv({children:[this.getFirstChildByKindOrThrow(eV.SyntaxKind.AsKeyword),e],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this}removeAliasWithRename(){let e=this.getAliasNode();return null==e||(e.getKind()===eV.SyntaxKind.Identifier&&e.rename(this.getName()),this.removeAlias()),this}getAliasNode(){if(null!=this.compilerNode.propertyName)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(e){return this.isTypeOnly()===e||(e?nm({insertPos:this.getStart(),parent:this,newText:"type "}):nv({children:[this.getFirstChildByKindOrThrow(eV.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0})),this}getExportDeclaration(){return this.getFirstAncestorByKindOrThrow(eV.SyntaxKind.ExportDeclaration)}getLocalTargetSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getLocalTargetSymbol(),e??"The export specifier's local target symbol was expected.",this)}getLocalTargetSymbol(){return this._context.typeChecker.getExportSpecifierLocalTargetSymbol(this)}getLocalTargetDeclarations(){return this.getLocalTargetSymbol()?.getDeclarations()??[]}remove(){let e=this.getExportDeclaration();e.getNamedExports().length>1||null==e.getNamespaceExport()?nE(this):e.toNamespaceExport()}set(e){return tD(oK.prototype,this,e),null!=e.isTypeOnly&&this.setIsTypeOnly(e.isTypeOnly),null!=e.name&&this.setName(e.name),null!=e.alias?this.setAlias(e.alias):e.hasOwnProperty(eV.nameof(e,"alias"))&&this.removeAlias(),this}getStructure(){let e=this.getAliasNode();return tA(nL.prototype,this,{kind:t.StructureKind.ExportSpecifier,alias:e?e.getText():void 0,name:this.getNameNode().getText(),isTypeOnly:this.isTypeOnly()})}},[eV.SyntaxKind.ExpressionWithTypeArguments]:class extends a0{},[eV.SyntaxKind.ExpressionStatement]:class extends oP{},[eV.SyntaxKind.ExternalModuleReference]:class extends oV{getReferencedSourceFileOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getReferencedSourceFile(),e??"Expected to find the referenced source file.",this)}isRelative(){let e=this.getExpression();return null!=e&&!!nL.isStringLiteral(e)&&ts.isModuleSpecifierRelative(e.getLiteralText())}getReferencedSourceFile(){let e=this.getExpression();if(null==e)return;let t=e.getSymbol();if(null!=t)return ts.getReferencedSourceFileFromSymbol(t)}},[eV.SyntaxKind.QualifiedName]:class extends nL{getLeft(){return this._getNodeFromCompilerNode(this.compilerNode.left)}getRight(){return this._getNodeFromCompilerNode(this.compilerNode.right)}},[eV.SyntaxKind.ForInStatement]:class extends oR{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},[eV.SyntaxKind.ForOfStatement]:class extends oM{getInitializer(){return this._getNodeFromCompilerNode(this.compilerNode.initializer)}},[eV.SyntaxKind.ForStatement]:class extends ok{getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}getInitializerOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getInitializer(),e??"Expected to find an initializer.",this)}getCondition(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.condition)}getConditionOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getCondition(),e??"Expected to find a condition.",this)}getIncrementor(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.incrementor)}getIncrementorOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getIncrementor(),e??"Expected to find an incrementor.",this)}},[eV.SyntaxKind.FunctionDeclaration]:class extends af{addOverload(e){return this.addOverloads([e])[0]}addOverloads(e){return this.insertOverloads(this.getOverloads().length,e)}insertOverload(e,t){return this.insertOverloads(e,[t])[0]}insertOverloads(e,t){let n=this.getName(),r=this._context.structurePrinterFactory.forFunctionDeclaration({isAmbient:this.isAmbient()});return ap({node:this,index:e,structures:t,printStructure:(e,t)=>{r.printOverload(e,n,t)},getThisStructure:tJ,expectedSyntaxKind:eV.SyntaxKind.FunctionDeclaration})}remove(){this.isOverload()?nv({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0}):nT([...this.getOverloads(),this])}set(e){return tD(af.prototype,this,e),null!=e.overloads&&(this.getOverloads().forEach(e=>e.remove()),this.addOverloads(e.overloads)),this}getStructure(){var e;let n=this.isOverload(),r=this.getImplementation();return tA(n&&r?am.prototype:af.prototype,this,(e=this,r&&n?{kind:t.StructureKind.FunctionOverload}:r?{kind:t.StructureKind.Function,overloads:e.getOverloads().map(e=>e.getStructure())}:{kind:t.StructureKind.Function}))}},[eV.SyntaxKind.FunctionExpression]:class extends a_{},[eV.SyntaxKind.FunctionType]:class extends a1{},[eV.SyntaxKind.GetAccessor]:class extends az{set(e){return tD(az.prototype,this,e),this}getSetAccessor(){let e=this.getName(),t=this.isStatic();return this.getParentOrThrow().forEachChild(n=>{if(nL.isSetAccessorDeclaration(n)&&n.getName()===e&&n.isStatic()===t)return n})}getSetAccessorOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getSetAccessor(),e??(()=>`Expected to find a corresponding set accessor for ${this.getName()}.`),this)}getStructure(){return tA(az.prototype,this,{kind:t.StructureKind.GetAccessor})}},[eV.SyntaxKind.HeritageClause]:class extends nL{getTypeNodes(){return this.compilerNode.types?.map(e=>this._getNodeFromCompilerNode(e))??[]}getToken(){return this.compilerNode.token}removeExpression(e){let t=this.getTypeNodes(),n="number"==typeof e?t[tX(e,t.length-1)]:e;if(1===t.length){let e=this.getParentSyntaxListOrThrow().getChildren();1===e.length?nv({children:[e[0].getParentSyntaxListOrThrow()],removePrecedingSpaces:!0}):nv({children:[this],removePrecedingSpaces:!0})}else nE(n);return this}},[eV.SyntaxKind.Identifier]:sR,[eV.SyntaxKind.IfStatement]:class extends ow{getThenStatement(){return this._getNodeFromCompilerNode(this.compilerNode.thenStatement)}getElseStatement(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.elseStatement)}remove(){let e=[];nL.isIfStatement(this.getParentOrThrow())&&e.push(this.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.ElseKeyword)),e.push(this),nT(e)}},[eV.SyntaxKind.ImportClause]:class extends oq{isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(e){return this.isTypeOnly()===e||(e?nm({parent:this,insertPos:this.getStart(),newText:"type "}):nv({children:[this.getFirstChildByKindOrThrow(eV.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0})),this}getDefaultImportOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDefaultImport(),e??"Expected to find a default import.",this)}getDefaultImport(){return this.getNodeProperty("name")}getNamedBindingsOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getNamedBindings(),e??"Expected to find an import declaration's named bindings.",this)}getNamedBindings(){return this.getNodeProperty("namedBindings")}getNamespaceImportOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getNamespaceImport(),e??"Expected to find a namespace import.",this)}getNamespaceImport(){let e=this.getNamedBindings();if(null!=e&&nL.isNamespaceImport(e))return e.getNameNode()}getNamedImports(){let e=this.getNamedBindings();return null!=e&&nL.isNamedImports(e)?e.getElements():[]}},[eV.SyntaxKind.ImportDeclaration]:class extends oJ{isTypeOnly(){return this.getImportClause()?.isTypeOnly()??!1}setIsTypeOnly(e){let t=this.getImportClause();if(null==t)if(!e)return this;else throw new eV.errors.InvalidOperationError("Cannot set an import as type only when there is no import clause.");return t.setIsTypeOnly(e),this}setModuleSpecifier(e){let t="string"==typeof e?e:this._sourceFile.getRelativePathAsModuleSpecifierTo(e);return this.getModuleSpecifier().setLiteralValue(t),this}getModuleSpecifier(){let e=this._getNodeFromCompilerNode(this.compilerNode.moduleSpecifier);if(!nL.isStringLiteral(e))throw new eV.errors.InvalidOperationError("Expected the module specifier to be a string literal.");return e}getModuleSpecifierValue(){return this.getModuleSpecifier().getLiteralValue()}getModuleSpecifierSourceFileOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getModuleSpecifierSourceFile(),e??"A module specifier source file was expected.",this)}getModuleSpecifierSourceFile(){let e=this.getModuleSpecifier().getSymbol();if(null!=e)return ts.getReferencedSourceFileFromSymbol(e)}isModuleSpecifierRelative(){return ts.isModuleSpecifierRelative(this.getModuleSpecifierValue())}setDefaultImport(e){if(eV.StringUtils.isNullOrWhitespace(e))return this.removeDefaultImport();let t=this.getDefaultImport();if(null!=t)return t.replaceWithText(e),this;let n=this.getFirstChildByKindOrThrow(eV.SyntaxKind.ImportKeyword),r=this.getImportClause();return null==r?nm({insertPos:n.getEnd(),parent:this,newText:` ${e} from`}):nm({insertPos:n.getEnd(),parent:r,newText:` ${e},`}),this}renameDefaultImport(e){if(eV.StringUtils.isNullOrWhitespace(e))return this.removeDefaultImport();let t=this.getDefaultImport();return null!=t?t.rename(e):this.setDefaultImport(e),this}getDefaultImportOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDefaultImport(),e??"Expected to find a default import.",this)}getDefaultImport(){return this.getImportClause()?.getDefaultImport()??void 0}setNamespaceImport(e){if(eV.StringUtils.isNullOrWhitespace(e))return this.removeNamespaceImport();let t=this.getNamespaceImport();if(null!=t)return t.rename(e),this;if(this.getNamedImports().length>0)throw new eV.errors.InvalidOperationError("Cannot add a namespace import to an import declaration that has named imports.");let n=this.getDefaultImport();return null!=n?nm({insertPos:n.getEnd(),parent:this.getImportClause(),newText:`, * as ${e}`}):nm({insertPos:this.getFirstChildByKindOrThrow(eV.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` * as ${e} from`}),this}removeNamespaceImport(){let e=this.getNamespaceImport();return null==e||nv({children:(function(){let t=this.getDefaultImport();return null==t?[this.getImportClauseOrThrow(),this.getLastChildByKindOrThrow(eV.SyntaxKind.FromKeyword)]:[t.getNextSiblingIfKindOrThrow(eV.SyntaxKind.CommaToken),e]}).call(this),removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this}removeDefaultImport(){let e=this.getImportClause();if(null==e)return this;let t=e.getDefaultImport();return null==t||(null==e.getNamedBindings()?e.isTypeOnly()?nm({parent:e,newText:"{}",insertPos:t.getStart(),replacing:{textLength:t.getWidth()}}):nv({children:[e,e.getNextSiblingIfKindOrThrow(eV.SyntaxKind.FromKeyword)],removePrecedingSpaces:!0,removePrecedingNewLines:!0}):nv({children:[t,t.getNextSiblingIfKindOrThrow(eV.SyntaxKind.CommaToken)],removePrecedingSpaces:!0,removePrecedingNewLines:!0})),this}getNamespaceImportOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getNamespaceImport(),e??"Expected to find a namespace import.",this)}getNamespaceImport(){return this.getImportClause()?.getNamespaceImport()??void 0}addNamedImport(e){return this.addNamedImports([e])[0]}addNamedImports(e){return this.insertNamedImports(this.getNamedImports().length,e)}insertNamedImport(e,t){return this.insertNamedImports(e,[t])[0]}insertNamedImports(e,t){if(!(t instanceof Function)&&eV.ArrayUtils.isNullOrEmpty(t))return[];let n=this.getNamedImports(),r=this._getWriterWithQueuedIndentation(),i=this._context.structurePrinterFactory.forNamedImportExportSpecifier(),o=this.getImportClause();if(e=tX(e,n.length),0===n.length)if(i.printTextsWithBraces(r,t),null==o)nm({insertPos:this.getFirstChildByKindOrThrow(eV.SyntaxKind.ImportKeyword).getEnd(),parent:this,newText:` ${r.toString()} from`});else if(null!=this.getNamespaceImport())throw o$();else if(null!=o.getNamedBindings()){let e=o.getNamedBindingsOrThrow();nm({insertPos:e.getStart(),replacing:{textLength:e.getWidth()},parent:o,newText:r.toString()})}else nm({insertPos:this.getDefaultImport().getEnd(),parent:o,newText:`, ${r.toString()}`});else{if(null==o)throw new eV.errors.NotImplementedError("Expected to have an import clause.");i.printTexts(r,t),n_({parent:o.getFirstChildByKindOrThrow(eV.SyntaxKind.NamedImports).getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:n,insertIndex:e,newText:r.toString(),surroundWithSpaces:this._context.getFormatCodeSettings().insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces,useTrailingCommas:!1})}return tU(n,this.getNamedImports(),e,!1)}getNamedImports(){return this.getImportClause()?.getNamedImports()??[]}removeNamedImports(){let e=this.getImportClause();if(null==e)return this;let t=e.getNamedBindings();if(null==t||t.getKind()!==eV.SyntaxKind.NamedImports)return this;let n=this.getDefaultImport();if(null!=n)return nv({children:[n.getNextSiblingIfKindOrThrow(eV.SyntaxKind.CommaToken),t]}),this;let r=e.getNextSiblingIfKindOrThrow(eV.SyntaxKind.FromKeyword);return nv({children:[e,r],removePrecedingSpaces:!0}),this}getImportClauseOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getImportClause(),e??"Expected to find an import clause.",this)}getImportClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.importClause)}setAttributes(e){let t=this.getAttributes();if(t)e?t.setElements(e):t.remove();else if(e){let t=this._context.structurePrinterFactory.forImportAttribute(),n=this._context.createWriter();n.space(),t.printAttributes(n,e),nm({parent:this,newText:n.toString(),insertPos:";"===this.getSourceFile().getFullText()[this.getEnd()-1]?this.getEnd()-1:this.getEnd()})}return this}getAttributes(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes)}set(e){return tD(oJ.prototype,this,e),null!=e.defaultImport?this.setDefaultImport(e.defaultImport):e.hasOwnProperty(eV.nameof(e,"defaultImport"))&&this.removeDefaultImport(),e.hasOwnProperty(eV.nameof(e,"namedImports"))&&this.removeNamedImports(),null!=e.namespaceImport?this.setNamespaceImport(e.namespaceImport):e.hasOwnProperty(eV.nameof(e,"namespaceImport"))&&this.removeNamespaceImport(),null!=e.namedImports&&(function(e){let t=e.getNodeProperty("importClause"),n=e._getWriterWithQueuedChildIndentation();e._context.structurePrinterFactory.forNamedImportExportSpecifier().printTextsWithBraces(n,[]);let r=n.toString();if(null!=e.getNamespaceImport())throw o$();if(null==t)return nm({insertPos:e.getFirstChildByKindOrThrow(eV.SyntaxKind.ImportKeyword).getEnd(),parent:e,newText:` ${r} from`});let i=t.getNamedBindings();if(null!=i)return nm({parent:t,newText:r,insertPos:i.getStart(),replacing:{textLength:i.getWidth()}});let o=t.getDefaultImport();null!=o&&nm({insertPos:o.getEnd(),parent:t,newText:`, ${r}`})}(this),this.addNamedImports(e.namedImports)),null!=e.moduleSpecifier&&this.setModuleSpecifier(e.moduleSpecifier),null!=e.isTypeOnly&&this.setIsTypeOnly(e.isTypeOnly),e.hasOwnProperty(eV.nameof(e,"attributes"))&&this.setAttributes(e.attributes),this}getStructure(){let e=this.getNamespaceImport(),n=this.getDefaultImport(),r=this.getAttributes();return tA(oJ.prototype,this,{kind:t.StructureKind.ImportDeclaration,isTypeOnly:this.isTypeOnly(),defaultImport:n?n.getText():void 0,moduleSpecifier:this.getModuleSpecifier().getLiteralText(),namedImports:this.getNamedImports().map(e=>e.getStructure()),namespaceImport:e?e.getText():void 0,attributes:r?r.getElements().map(e=>e.getStructure()):void 0})}},[eV.SyntaxKind.ImportEqualsDeclaration]:class extends oX{isTypeOnly(){return this.compilerNode.isTypeOnly??!1}setIsTypeOnly(e){return this.isTypeOnly()===e||(e?nm({parent:this,insertPos:this.getNameNode().getStart(),newText:"type "}):nv({children:[this.getFirstChildByKindOrThrow(eV.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0})),this}getModuleReference(){return this._getNodeFromCompilerNode(this.compilerNode.moduleReference)}isExternalModuleReferenceRelative(){let e=this.getModuleReference();return!!nL.isExternalModuleReference(e)&&e.isRelative()}setExternalModuleReference(e){let t="string"==typeof e?e:this._sourceFile.getRelativePathAsModuleSpecifierTo(e),n=this.getModuleReference();return nL.isExternalModuleReference(n)&&null!=n.getExpression()?n.getExpressionOrThrow().replaceWithText(e=>e.quote(t)):n.replaceWithText(e=>e.write("require(").quote(t).write(")")),this}getExternalModuleReferenceSourceFileOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getExternalModuleReferenceSourceFile(),e??"Expected to find an external module reference's referenced source file.",this)}getExternalModuleReferenceSourceFile(){let e=this.getModuleReference();if(nL.isExternalModuleReference(e))return e.getReferencedSourceFile()}},[eV.SyntaxKind.ImportSpecifier]:class extends oY{setName(e){let t=this.getNameNode();return this.getName()===e||(ty(e)?t.replaceWithText(e):t.replaceWithText(`"${e.replaceAll('"','\\"')}"`)),this}getName(){let e=this.getNameNode();return e.getKind()===eV.ts.SyntaxKind.StringLiteral?e.getLiteralText():e.getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.propertyName??this.compilerNode.name)}renameAlias(e){if(eV.StringUtils.isNullOrWhitespace(e))return this.removeAliasWithRename(),this;let t=this.getAliasNode();return null==t&&(this.setAlias(this.getName()),t=this.getAliasNode()),t.rename(e),this}setAlias(e){if(eV.StringUtils.isNullOrWhitespace(e))return this.removeAlias(),this;let t=this.getAliasNode();return null==t?nm({insertPos:this.getNameNode().getEnd(),parent:this,newText:` as ${e}`}):t.replaceWithText(e),this}removeAlias(){let e=this.getAliasNode();return null==e||nv({children:[this.getFirstChildByKindOrThrow(eV.SyntaxKind.AsKeyword),e],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this}removeAliasWithRename(){let e=this.getAliasNode();return null==e||(e.rename(this.getName()),this.removeAlias()),this}getAliasNode(){if(null!=this.compilerNode.propertyName)return this._getNodeFromCompilerNode(this.compilerNode.name)}isTypeOnly(){return this.compilerNode.isTypeOnly}setIsTypeOnly(e){return this.isTypeOnly()===e||(e?nm({insertPos:this.getStart(),parent:this,newText:"type "}):nv({children:[this.getFirstChildByKindOrThrow(eV.ts.SyntaxKind.TypeKeyword)],removeFollowingSpaces:!0})),this}getImportDeclaration(){return this.getFirstAncestorByKindOrThrow(eV.SyntaxKind.ImportDeclaration)}remove(){let e=this.getImportDeclaration();e.getNamedImports().length>1||null==e.getNamespaceImport()&&null==e.getDefaultImport()?nE(this):e.removeNamedImports()}set(e){return tD(oY.prototype,this,e),null!=e.isTypeOnly&&this.setIsTypeOnly(e.isTypeOnly),null!=e.name&&this.setName(e.name),null!=e.alias?this.setAlias(e.alias):e.hasOwnProperty(eV.nameof(e,"alias"))&&this.removeAlias(),this}getStructure(){let e=this.getAliasNode();return tA(oY.prototype,this,{kind:t.StructureKind.ImportSpecifier,name:this.getName(),alias:e?e.getText():void 0,isTypeOnly:this.isTypeOnly()})}},[eV.SyntaxKind.ImportType]:class extends aX{setArgument(e){let t=this.getArgument();if(nL.isLiteralTypeNode(t)){let n=t.getLiteral();if(nL.isStringLiteral(n))return n.setLiteralValue(e),this}return t.replaceWithText(t=>t.quote(e),this._getWriterWithQueuedChildIndentation()),this}getArgument(){return this._getNodeFromCompilerNode(this.compilerNode.argument)}setQualifier(e){let t=this.getQualifier();return null!=t?t.replaceWithText(e,this._getWriterWithQueuedChildIndentation()):nm({insertPos:this.getFirstChildByKindOrThrow(eV.SyntaxKind.CloseParenToken).getEnd(),parent:this,newText:this._getWriterWithQueuedIndentation().write(".").write(e).toString()}),this}getQualifierOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getQualifier(),e??(()=>`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(e){return eV.errors.throwIfNullOrUndefined(this._getNodeFromCompilerNodeIfExists(this.compilerNode.attributes),e??"Could not find import type assertion container.",this)}},[eV.SyntaxKind.ImportAttribute]:class extends oU{getValue(){return this._getNodeFromCompilerNode(this.compilerNode.value)}set(e){return tD(oU.prototype,this,e),e.value&&this.getValue().replaceWithText(e.value),this}getStructure(){return tA(oU.prototype,this,{kind:t.StructureKind.ImportAttribute,value:this.getValue().getText()})}},[eV.SyntaxKind.ImportAttributes]:class extends oH{setElements(e){return this.replaceWithText(t=>{this._context.structurePrinterFactory.forImportAttribute().printAttributes(t,e)}),this}getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}remove(){nv({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}},[eV.SyntaxKind.IndexedAccessType]:class extends aJ{getObjectTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.objectType)}getIndexTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.indexType)}},[eV.SyntaxKind.IndexSignature]:class extends sS{getKeyName(){return this.getKeyNameNode().getText()}setKeyName(e){eV.errors.throwIfWhitespaceOrNotString(e,"name"),this.getKeyName()!==e&&this.getKeyNameNode().replaceWithText(e,this._getWriterWithQueuedChildIndentation())}getKeyNameNode(){let e=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(e.name)}getKeyType(){return this.getKeyNameNode().getType()}setKeyType(e){eV.errors.throwIfWhitespaceOrNotString(e,"type");let t=this.getKeyTypeNode();return t.getText()===e||t.replaceWithText(e,this._getWriterWithQueuedChildIndentation()),this}getKeyTypeNode(){let e=this.compilerNode.parameters[0];return this._getNodeFromCompilerNode(e.type)}set(e){return tD(sS.prototype,this,e),null!=e.keyName&&this.setKeyName(e.keyName),null!=e.keyType&&this.setKeyType(e.keyType),this}getStructure(){let e=this.getKeyTypeNode();return tA(sS.prototype,this,{kind:t.StructureKind.IndexSignature,keyName:this.getKeyName(),keyType:e.getText()})}},[eV.SyntaxKind.InferType]:class extends aJ{getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}},[eV.SyntaxKind.InterfaceDeclaration]:class extends sE{getBaseTypes(){return this.getType().getBaseTypes()}getBaseDeclarations(){return this.getType().getBaseTypes().map(e=>e.getSymbol()?.getDeclarations()??[]).flat()}getImplementations(){return this.getNameNode().getImplementations()}set(e){return tD(sE.prototype,this,e),this}getStructure(){return tA(sE.prototype,this,{kind:t.StructureKind.Interface})}},[eV.SyntaxKind.IntersectionType]:class extends aJ{getTypeNodes(){return this.compilerNode.types.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.JSDocAllType]:class extends a5{},[eV.SyntaxKind.JSDocAugmentsTag]:class extends a9{},[eV.SyntaxKind.JSDocAuthorTag]:class extends a9{},[eV.SyntaxKind.JSDocCallbackTag]:class extends a9{},[eV.SyntaxKind.JSDocClassTag]:class extends a9{},[eV.SyntaxKind.JSDocDeprecatedTag]:class extends a9{},[eV.SyntaxKind.JSDocEnumTag]:class extends a9{},[eV.SyntaxKind.JSDocFunctionType]:class extends si{},[eV.SyntaxKind.JSDocImplementsTag]:class extends a9{},[eV.SyntaxKind.JSDocLink]:class extends nL{},[eV.SyntaxKind.JSDocLinkCode]:class extends nL{},[eV.SyntaxKind.JSDocLinkPlain]:class extends nL{},[eV.SyntaxKind.JSDocMemberName]:class extends nL{},[eV.SyntaxKind.JSDocNamepathType]:class extends a5{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},[eV.SyntaxKind.JSDocNameReference]:class extends nL{getName(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},[eV.SyntaxKind.JSDocNonNullableType]:class extends a5{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},[eV.SyntaxKind.JSDocNullableType]:class extends a5{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}isPostfix(){return this.compilerNode.postfix}},[eV.SyntaxKind.JSDocOptionalType]:class extends a5{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},[eV.SyntaxKind.JSDocOverrideTag]:class extends a9{},[eV.SyntaxKind.JSDocParameterTag]:class extends sa{},[eV.SyntaxKind.JSDocPrivateTag]:class extends a9{},[eV.SyntaxKind.JSDocPropertyTag]:class extends ss{},[eV.SyntaxKind.JSDocProtectedTag]:class extends a9{},[eV.SyntaxKind.JSDocPublicTag]:class extends a9{},[eV.SyntaxKind.JSDocReturnTag]:class extends sl{},[eV.SyntaxKind.JSDocReadonlyTag]:class extends a9{},[eV.SyntaxKind.JSDocThrowsTag]:class extends sm{},[eV.SyntaxKind.JSDocOverloadTag]:class extends so{},[eV.SyntaxKind.JSDocSatisfiesTag]:class extends sc{},[eV.SyntaxKind.JSDocSeeTag]:class extends sd{},[eV.SyntaxKind.JSDocSignature]:class extends a5{getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}},[eV.SyntaxKind.JSDocTag]:class extends a9{},[eV.SyntaxKind.JSDocTemplateTag]:class extends sp{getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getConstraint(),e??"Expected to find the JS doc template tag's constraint.",this)}},[eV.SyntaxKind.JSDocText]:class extends nL{},[eV.SyntaxKind.JSDocThisTag]:class extends sf{},[eV.SyntaxKind.JSDocTypeExpression]:class extends aJ{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},[eV.SyntaxKind.JSDocTypeLiteral]:class extends a5{isArrayType(){return this.compilerNode.isArrayType}getPropertyTags(){return this.compilerNode.jsDocPropertyTags?this.compilerNode.jsDocPropertyTags.map(e=>this._getNodeFromCompilerNode(e)):void 0}},[eV.SyntaxKind.JSDocTypeTag]:class extends a9{getTypeExpression(){let e=this.compilerNode.typeExpression;if(null==e||e.pos!==e.end)return this._getNodeFromCompilerNodeIfExists(this.compilerNode.typeExpression)}},[eV.SyntaxKind.JSDocTypedefTag]:class extends a9{},[eV.SyntaxKind.JSDocUnknownType]:class extends a5{},[eV.SyntaxKind.JSDocVariadicType]:class extends a5{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},[eV.SyntaxKind.JsxAttribute]:class extends sk{getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}setName(e){return this.getNameNode().replaceWithText(t=>{"object"==typeof e?this._context.structurePrinterFactory.forJsxNamespacedName().printText(t,e):t.write(e)}),this}getInitializerOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getInitializer(),e??`Expected to find an initializer for the JSX attribute '${this.getNameNode().getText()}'`,this)}getInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.initializer)}setInitializer(e){let t=tp(this._getWriterWithQueuedIndentation(),e);if(eV.StringUtils.isNullOrWhitespace(t))return this.removeInitializer(),this;let n=this.getInitializer();return null!=n?n.replaceWithText(t):nm({insertPos:this.getNameNode().getEnd(),parent:this,newText:`=${t}`}),this}removeInitializer(){let e=this.getInitializer();return null==e||nv({children:[e.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.EqualsToken),e],removePrecedingSpaces:!0,removePrecedingNewLines:!0}),this}remove(){nv({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(e){return tD(sk.prototype,this,e),null!=e.name&&this.setName(e.name),null!=e.initializer?this.setInitializer(e.initializer):e.hasOwnProperty(eV.nameof(e,"initializer"))&&this.removeInitializer(),this}getStructure(){let e=this.getInitializer(),n=this.getNameNode();return tA(sk.prototype,this,{name:n instanceof sR?n.getText():n.getStructure(),kind:t.StructureKind.JsxAttribute,initializer:e?.getText()})}},[eV.SyntaxKind.JsxClosingElement]:class extends sw{},[eV.SyntaxKind.JsxClosingFragment]:class extends ik{},[eV.SyntaxKind.JsxElement]:class extends sL{getJsxChildren(){return this.compilerNode.children.map(e=>this._getNodeFromCompilerNode(e))}getOpeningElement(){return this._getNodeFromCompilerNode(this.compilerNode.openingElement)}getClosingElement(){return this._getNodeFromCompilerNode(this.compilerNode.closingElement)}setBodyText(e){return sO(this,nR(this._getWriterWithIndentation(),e)),this}setBodyTextInline(e){let t=this._getWriterWithQueuedChildIndentation();return tf(t,e),t.isLastNewLine()&&(t.setIndentationLevel(Math.max(0,this.getIndentationLevel()-1)),t.write("")),sO(this,t.toString()),this}set(e){if(tD(sL.prototype,this,e),null!=e.attributes){let t=this.getOpeningElement();t.getAttributes().forEach(e=>e.remove()),t.addAttributes(e.attributes)}if(null!=e.children)throw new eV.errors.NotImplementedError("Setting JSX children is currently not implemented. Please open an issue if you need this.");return null!=e.bodyText?this.setBodyText(e.bodyText):e.hasOwnProperty(eV.nameof(e,"bodyText"))&&this.setBodyTextInline(""),null!=e.name&&(this.getOpeningElement().getTagNameNode().replaceWithText(e.name),this.getClosingElement().getTagNameNode().replaceWithText(e.name)),this}getStructure(){let e=this.getOpeningElement(),n=tA(sL.prototype,this,{kind:t.StructureKind.JsxElement,name:e.getTagNameNode().getText(),attributes:e.getAttributes().map(e=>e.getStructure()),children:void 0,bodyText:nM(this)});return delete n.children,n}},[eV.SyntaxKind.JsxExpression]:class extends sF{},[eV.SyntaxKind.JsxFragment]:class extends ij{getJsxChildren(){return this.compilerNode.children.map(e=>this._getNodeFromCompilerNode(e))}getOpeningFragment(){return this._getNodeFromCompilerNode(this.compilerNode.openingFragment)}getClosingFragment(){return this._getNodeFromCompilerNode(this.compilerNode.closingFragment)}},[eV.SyntaxKind.JsxNamespacedName]:class extends sW{getNamespaceNode(){return this._getNodeFromCompilerNode(this.compilerNode.namespace)}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}set(e){return this.getNamespaceNode().replaceWithText(e.namespace),this.getNameNode().replaceWithText(e.name),this}getStructure(){return{namespace:this.getNamespaceNode().getText(),name:this.getNameNode().getText()}}},[eV.SyntaxKind.JsxOpeningElement]:class extends sB{},[eV.SyntaxKind.JsxOpeningFragment]:class extends ik{},[eV.SyntaxKind.JsxSelfClosingElement]:class extends sz{set(e){return tD(sz.prototype,this,e),this}getStructure(){return tA(sz.prototype,this,{kind:t.StructureKind.JsxSelfClosingElement})}},[eV.SyntaxKind.JsxSpreadAttribute]:class extends sG{remove(){nv({children:[this],removePrecedingNewLines:!0,removePrecedingSpaces:!0})}set(e){return tD(sG.prototype,this,e),null!=e.expression&&this.setExpression(e.expression),this}getStructure(){return tA(sG.prototype,this,{kind:t.StructureKind.JsxSpreadAttribute,expression:this.getExpression().getText()})}},[eV.SyntaxKind.JsxText]:class extends sj{containsOnlyTriviaWhiteSpaces(){let e=this.compilerNode;return"boolean"==typeof e.containsOnlyWhiteSpaces?e.containsOnlyWhiteSpaces:this.compilerNode.containsOnlyTriviaWhiteSpaces}},[eV.SyntaxKind.LabeledStatement]:class extends oL{getLabel(){return this._getNodeFromCompilerNode(this.compilerNode.label)}getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},[eV.SyntaxKind.LiteralType]:class extends aJ{getLiteral(){let e=this.compilerNode.literal;return this._getNodeFromCompilerNode(e)}},[eV.SyntaxKind.MappedType]:class extends aJ{getNameTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.nameType)}getNameTypeNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getNameTypeNode(),e??"Type did not exist.",this)}getReadonlyToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.readonlyToken)}getReadonlyTokenOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getReadonlyToken(),e??"Readonly token did not exist.",this)}getQuestionToken(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.questionToken)}getQuestionTokenOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getQuestionToken(),e??"Question token did not exist.",this)}getTypeParameter(){return this._getNodeFromCompilerNode(this.compilerNode.typeParameter)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTypeNode(),e??"Type did not exist, but was expected to exist.",this)}},[eV.SyntaxKind.MetaProperty]:class extends i2{getKeywordToken(){return this.compilerNode.keywordToken}},[eV.SyntaxKind.MethodDeclaration]:ax,[eV.SyntaxKind.MethodSignature]:class extends sT{set(e){return tD(sT.prototype,this,e),this}getStructure(){return tA(sT.prototype,this,{kind:t.StructureKind.MethodSignature})}},[eV.SyntaxKind.ModuleBlock]:class extends oQ{},[eV.SyntaxKind.ModuleDeclaration]:class extends o0{getName(){let e=this.getNameNodes();return e instanceof Array?e.map(e=>e.getText()).join("."):e.getText()}setName(e){let n="Please open an issue if you really need this and I'll up the priority.";if(e.indexOf(".")>=0)throw new eV.errors.NotImplementedError(`Not implemented to set a namespace name to a name containing a period. ${n}`);let r=this.getNameNodes();if(r instanceof Array){var i;if(r.length>1)throw new eV.errors.NotImplementedError(`Not implemented to set a namespace name that uses dot notation. ${n}`);"global"!==e&&o1(this),eV.StringUtils.isQuoted(e)&&(i=this,i.hasNamespaceKeyword()&&i.setDeclarationKind(t.ModuleDeclarationKind.Module),i.hasDeclareKeyword()||i.setHasDeclareKeyword(!0)),r[0].replaceWithText(e)}else r.replaceWithText(e);return this}rename(e,t){if(e.indexOf(".")>=0)throw new eV.errors.NotSupportedError("Cannot rename a namespace name to a name containing a period.");let n=this.getNameNodes();if(n instanceof Array){if(n.length>1)throw new eV.errors.NotSupportedError(`Cannot rename a namespace name that uses dot notation. Rename the individual nodes via .${eV.nameof(this,"getNameNodes")}()`);"global"!==e&&o1(this),n[0].rename(e,t)}else nG(n,eV.StringUtils.stripQuotes(e),t);return this}getNameNodes(){let e=this.getNameNode();if(nL.isStringLiteral(e))return e;{let e=[],t=this;do e.push(this._getNodeFromCompilerNode(t.compilerNode.name)),t=t.getFirstChildByKind(eV.SyntaxKind.ModuleDeclaration);while(null!=t);return e}}hasNamespaceKeyword(){return this.getDeclarationKind()===t.ModuleDeclarationKind.Namespace}hasModuleKeyword(){return this.getDeclarationKind()===t.ModuleDeclarationKind.Module}setDeclarationKind(e){if(this.getDeclarationKind()===e)return this;if(e===t.ModuleDeclarationKind.Global){let e=this.getDeclarationKindKeyword();this.getNameNode().replaceWithText("global"),null!=e&&nv({children:[e],removeFollowingNewLines:!0,removeFollowingSpaces:!0})}else{let t=this.getDeclarationKindKeyword();null!=t?t.replaceWithText(e):nm({parent:this,insertPos:this.getNameNode().getStart(),newText:e+" "})}return this}getDeclarationKind(){let e=this.getFlags();return(e&eV.ts.NodeFlags.GlobalAugmentation)!=0?t.ModuleDeclarationKind.Global:(e&eV.ts.NodeFlags.Namespace)!=0?t.ModuleDeclarationKind.Namespace:t.ModuleDeclarationKind.Module}getDeclarationKindKeyword(){return this.getFirstChild(e=>e.getKind()===eV.SyntaxKind.NamespaceKeyword||e.getKind()===eV.SyntaxKind.ModuleKeyword)}set(e){return null!=e.name&&"global"!==e.name&&o1(this),tD(o0.prototype,this,e),null!=e.declarationKind&&this.setDeclarationKind(e.declarationKind),this}getStructure(){return tA(o0.prototype,this,{kind:t.StructureKind.Module,declarationKind:this.getDeclarationKind()})}_getInnerBody(){let e=this.getBody();for(;null!=e&&nL.isBodyable(e)&&null==e.compilerNode.statements;)e=e.getBody();return e}},[eV.SyntaxKind.NamedExports]:class extends o2{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.NamedImports]:class extends o8{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.NamedTupleMember]:class extends a2{getTypeNode(){return super.getTypeNode()}removeType(){throw new eV.errors.InvalidOperationError("Cannot remove the type of a named tuple member.")}},[eV.SyntaxKind.NamespaceExport]:class extends o3{setName(e){let t=this.getNameNode();return this.getName()===e||(ty(e)?t.replaceWithText(e):t.replaceWithText(`"${e.replaceAll('"','\\"')}"`)),this}getName(){let e=this.getNameNode();return e.getKind()===eV.ts.SyntaxKind.StringLiteral?e.getLiteralText():e.getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},[eV.SyntaxKind.NamespaceImport]:class extends o6{setName(e){let t=this.getNameNode();return t.getText()===e||t.replaceWithText(e),this}getName(){return this.getNameNode().getText()}getNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.name)}},[eV.SyntaxKind.NewExpression]:class extends i8{},[eV.SyntaxKind.NonNullExpression]:class extends i3{},[eV.SyntaxKind.NotEmittedStatement]:class extends oO{},[eV.SyntaxKind.NoSubstitutionTemplateLiteral]:class extends sQ{getLiteralValue(){return this.compilerNode.text}setLiteralValue(e){let t=this.getChildIndex(),n=this.getParentSyntaxList()||this.getParentOrThrow();return nD({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:e}),n.getChildAtIndex(t)}},[eV.SyntaxKind.NumericLiteral]:class extends s${getLiteralValue(){let e=this.compilerNode.text;return e.indexOf(".")>=0?parseFloat(e):parseInt(e,10)}setLiteralValue(e){return nD({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:e.toString(10)}),this}},[eV.SyntaxKind.ObjectBindingPattern]:class extends nL{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.ObjectLiteralExpression]:class extends i5{getPropertyOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getProperty(e),()=>eY("property",e))}getProperty(e){let t;return t="string"==typeof e?t=>null!=t[eV.nameof("getName")]&&t.getName()===e:e,this.getProperties().find(t)}getProperties(){return this.compilerNode.properties.map(e=>this._getNodeFromCompilerNode(e))}getPropertiesWithComments(){return te.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).map(e=>this._getNodeFromCompilerNode(e))}#nR(){return te.getContainerArray(this.compilerNode,this.getSourceFile().compilerNode).length}addProperty(e){return this.insertProperties(this.#nR(),[e])[0]}addProperties(e){return this.insertProperties(this.#nR(),e)}insertProperty(e,t){return this.insertProperties(e,[t])[0]}insertProperties(e,t){let n=this.getPropertiesWithComments();e=tX(e,n.length);let r=this._getWriterWithChildIndentation();return this._context.structurePrinterFactory.forObjectLiteralExpressionProperty().printTexts(r,t),n_({parent:this.getChildSyntaxListOrThrow(),currentNodes:n,insertIndex:e,newText:r.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),tU(n,this.getPropertiesWithComments(),e,!0)}addPropertyAssignment(e){return this.addPropertyAssignments([e])[0]}addPropertyAssignments(e){return this.insertPropertyAssignments(this.#nR(),e)}insertPropertyAssignment(e,t){return this.insertPropertyAssignments(e,[t])[0]}insertPropertyAssignments(e,t){return this.#nM(e,t,()=>this._context.structurePrinterFactory.forPropertyAssignment())}addShorthandPropertyAssignment(e){return this.addShorthandPropertyAssignments([e])[0]}addShorthandPropertyAssignments(e){return this.insertShorthandPropertyAssignments(this.#nR(),e)}insertShorthandPropertyAssignment(e,t){return this.insertShorthandPropertyAssignments(e,[t])[0]}insertShorthandPropertyAssignments(e,t){return this.#nM(e,t,()=>this._context.structurePrinterFactory.forShorthandPropertyAssignment())}addSpreadAssignment(e){return this.addSpreadAssignments([e])[0]}addSpreadAssignments(e){return this.insertSpreadAssignments(this.#nR(),e)}insertSpreadAssignment(e,t){return this.insertSpreadAssignments(e,[t])[0]}insertSpreadAssignments(e,t){return this.#nM(e,t,()=>this._context.structurePrinterFactory.forSpreadAssignment())}addMethod(e){return this.addMethods([e])[0]}addMethods(e){return this.insertMethods(this.#nR(),e)}insertMethod(e,t){return this.insertMethods(e,[t])[0]}insertMethods(e,t){return this.#nM(e,t,()=>this._context.structurePrinterFactory.forMethodDeclaration({isAmbient:!1}))}addGetAccessor(e){return this.addGetAccessors([e])[0]}addGetAccessors(e){return this.insertGetAccessors(this.#nR(),e)}insertGetAccessor(e,t){return this.insertGetAccessors(e,[t])[0]}insertGetAccessors(e,t){return this.#nM(e,t,()=>this._context.structurePrinterFactory.forGetAccessorDeclaration({isAmbient:!1}))}addSetAccessor(e){return this.addSetAccessors([e])[0]}addSetAccessors(e){return this.insertSetAccessors(this.#nR(),e)}insertSetAccessor(e,t){return this.insertSetAccessors(e,[t])[0]}insertSetAccessors(e,t){return this.#nM(e,t,()=>this._context.structurePrinterFactory.forSetAccessorDeclaration({isAmbient:!1}))}#nM(e,t,n){e=tX(e,this.#nR());let r=this._getWriterWithChildIndentation(),i=new n5(n()),o=this.getPropertiesWithComments();return i.printText(r,t),n_({parent:this.getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:o,insertIndex:e,newText:r.toString(),useNewLines:!0,useTrailingCommas:this._context.manipulationSettings.getUseTrailingCommas()}),tU(o,this.getPropertiesWithComments(),e,!1)}},[eV.SyntaxKind.OmittedExpression]:class extends ot{},[eV.SyntaxKind.Parameter]:class extends ah{isRestParameter(){return null!=this.compilerNode.dotDotDotToken}isParameterProperty(){return null!=this.getScope()||this.isReadonly()||this.hasOverrideKeyword()}setIsRestParameter(e){return this.isRestParameter()===e||(e?(ag(this),nm({insertPos:this.getNameNode().getStart(),parent:this,newText:"..."})):nv({children:[this.getDotDotDotTokenOrThrow()]})),this}isOptional(){return null!=this.compilerNode.questionToken||this.isRestParameter()||this.hasInitializer()}remove(){nE(this)}set(e){return tD(ah.prototype,this,e),null!=e.isRestParameter&&this.setIsRestParameter(e.isRestParameter),this}getStructure(){return tA(ah.prototype,this,{kind:t.StructureKind.Parameter,isRestParameter:this.isRestParameter()})}setHasQuestionToken(e){return e&&ag(this),super.setHasQuestionToken(e),this}setInitializer(e){return ag(this),super.setInitializer(e),this}setType(e){return ag(this),super.setType.call(this,e),this}},[eV.SyntaxKind.ParenthesizedExpression]:class extends on{},[eV.SyntaxKind.ParenthesizedType]:class extends aJ{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}setType(e){return this.getTypeNode().replaceWithText(e),this}},[eV.SyntaxKind.PartiallyEmittedExpression]:class extends or{},[eV.SyntaxKind.PostfixUnaryExpression]:class extends oi{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},[eV.SyntaxKind.PrefixUnaryExpression]:class extends oo{getOperatorToken(){return this.compilerNode.operator}getOperand(){return this._getNodeFromCompilerNode(this.compilerNode.operand)}},[eV.SyntaxKind.PrivateIdentifier]:class extends sM{},[eV.SyntaxKind.PropertyAccessExpression]:os,[eV.SyntaxKind.PropertyAssignment]:class extends i7{removeInitializer(){let e=this.getInitializerOrThrow(),t=e.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.ColonToken),n=this.getChildIndex(),r=this._sourceFile.getFullText(),i=this.getStart(),o=r.substring(i,t.getPos())+r.substring(e.getEnd(),this.getEnd()),a=this.getParentSyntaxList()||this.getParentOrThrow();return nm({insertPos:i,newText:o,parent:a,replacing:{textLength:this.getWidth()}}),a.getChildAtIndexIfKindOrThrow(n,eV.SyntaxKind.ShorthandPropertyAssignment)}setInitializer(e){let t=this.getInitializerOrThrow();return nm({insertPos:t.getStart(),newText:tp(this._getWriterWithQueuedChildIndentation(),e),parent:this,replacing:{textLength:t.getWidth()}}),this}set(e){if(tD(i7.prototype,this,e),null!=e.initializer)this.setInitializer(e.initializer);else if(e.hasOwnProperty(eV.nameof(e,"initializer")))return this.removeInitializer();return this}getStructure(){let e=this.getInitializerOrThrow(),n=tA(i7.prototype,this,{kind:t.StructureKind.PropertyAssignment,initializer:e.getText()});return delete n.hasQuestionToken,n}},[eV.SyntaxKind.PropertyDeclaration]:class extends aG{hasAccessorKeyword(){return this.hasModifier(eV.SyntaxKind.AccessorKeyword)}setHasAccessorKeyword(e){return this.toggleModifier("accessor",e)}set(e){return tD(aG.prototype,this,e),null!=e.hasAccessorKeyword&&this.setHasAccessorKeyword(e.hasAccessorKeyword),this}remove(){let e=this.getParentOrThrow();if(e.getKind()===eV.SyntaxKind.ClassDeclaration)super.remove();else throw new eV.errors.NotImplementedError(`Not implemented parent syntax kind: ${e.getKindName()}`)}getStructure(){return tA(aG.prototype,this,{kind:t.StructureKind.Property,hasAccessorKeyword:this.hasAccessorKeyword()})}},[eV.SyntaxKind.PropertySignature]:class extends sA{set(e){return tD(sA.prototype,this,e),this}getStructure(){return tA(sA.prototype,this,{kind:t.StructureKind.PropertySignature})}},[eV.SyntaxKind.RegularExpressionLiteral]:class extends sX{getLiteralValue(){let e=this.compilerNode.text,t=/^\/(.*)\/([^\/]*)$/.exec(e);return new RegExp(t[1],t[2])}setLiteralValue(e,t){let n;return"string"==typeof e?n=e:(n=e.source,t=e.flags),nD({sourceFile:this._sourceFile,start:this.getStart(),replacingLength:this.getWidth(),newText:`/${n}/${t||""}`}),this}},[eV.SyntaxKind.RestType]:class extends aJ{getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},[eV.SyntaxKind.ReturnStatement]:class extends oF{},[eV.SyntaxKind.SatisfiesExpression]:class extends ol{},[eV.SyntaxKind.SetAccessor]:class extends aj{set(e){return tD(aj.prototype,this,e),this}getGetAccessor(){let e=this.getName(),t=this.isStatic();return this.getParentOrThrow().forEachChild(n=>{if(nL.isGetAccessorDeclaration(n)&&n.getName()===e&&n.isStatic()===t)return n})}getGetAccessorOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getGetAccessor(),e??(()=>`Expected to find a corresponding get accessor for ${this.getName()}.`),this)}getStructure(){return tA(aj.prototype,this,{kind:t.StructureKind.SetAccessor})}},[eV.SyntaxKind.ShorthandPropertyAssignment]:class extends i9{hasObjectAssignmentInitializer(){return null!=this.compilerNode.objectAssignmentInitializer}getObjectAssignmentInitializerOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getObjectAssignmentInitializer(),e??"Expected to find an object assignment initializer.",this)}getObjectAssignmentInitializer(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.objectAssignmentInitializer)}getEqualsTokenOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getEqualsToken(),e??"Expected to find an equals token.",this)}getEqualsToken(){let e=this.compilerNode.equalsToken;if(null!=e)return this._getNodeFromCompilerNode(e)}removeObjectAssignmentInitializer(){return this.hasObjectAssignmentInitializer()&&nv({children:[this.getEqualsTokenOrThrow(),this.getObjectAssignmentInitializerOrThrow()],removePrecedingSpaces:!0}),this}setInitializer(e){let t=this.getParentSyntaxList()||this.getParentOrThrow(),n=this.getChildIndex();return nm({insertPos:this.getStart(),newText:this.getText()+`: ${e}`,parent:t,replacing:{textLength:this.getWidth()}}),t.getChildAtIndexIfKindOrThrow(n,eV.SyntaxKind.PropertyAssignment)}set(e){return tD(i9.prototype,this,e),this}getStructure(){let e=tA(i9.prototype,this,{kind:t.StructureKind.ShorthandPropertyAssignment});return delete e.hasQuestionToken,e}getValueSymbol(){return this._context.typeChecker.getShorthandAssignmentValueSymbol(this)}getValueSymbolOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getValueSymbol(),e??"Expected to find a value symbol.",this)}},[eV.SyntaxKind.SpreadAssignment]:class extends oe{set(e){return tD(oe.prototype,this,e),this}getStructure(){return tA(oe.prototype,this,{kind:t.StructureKind.SpreadAssignment,expression:this.getExpression().getText()})}},[eV.SyntaxKind.SpreadElement]:class extends oc{},[eV.SyntaxKind.StringLiteral]:class extends sY{getLiteralValue(){return this.compilerNode.text}setLiteralValue(e){return nD({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:eV.StringUtils.escapeForWithinString(e,this.getQuoteKind())}),this}getQuoteKind(){return"'"===this.getText()[0]?t.QuoteKind.Single:t.QuoteKind.Double}},[eV.SyntaxKind.SwitchStatement]:class extends oW{getCaseBlock(){return this._getNodeFromCompilerNode(this.compilerNode.caseBlock)}getClauses(){return this.getCaseBlock().getClauses()}removeClause(e){return this.getCaseBlock().removeClause(e)}removeClauses(e){return this.getCaseBlock().removeClauses(e)}},[eV.SyntaxKind.SyntaxList]:class extends nL{addChildText(e){return this.insertChildText(this.getChildCount(),e)}insertChildText(e,t){let n=this.getChildCount(),r=this._context.manipulationSettings.getNewLineKindAsString(),i=this.getParentOrThrow();e=tX(e,n);let o=this!==i.getChildSyntaxList(),a=tp(o?i._getWriterWithQueuedChildIndentation():i._getWriterWithChildIndentation(),t);return 0===a.length?[]:(o?0===e?a+=" ":a=" "+a:0===e&&nL.isSourceFile(i)?a.endsWith("\n")||(a+=r):(a=r+a,!nL.isSourceFile(i)&&e===n&&a.endsWith("\n")&&(a=a.replace(/\r?\n$/,""))),nm({insertPos:tj(e,this,this.getChildren()),newText:a,parent:this}),tU(n,this.getChildren(),e,!0))}},[eV.SyntaxKind.TaggedTemplateExpression]:class extends iG{getTag(){return this._getNodeFromCompilerNode(this.compilerNode.tag)}getTemplate(){return this._getNodeFromCompilerNode(this.compilerNode.template)}removeTag(){let e=this.getParentSyntaxList()??this.getParentOrThrow(),t=this.getChildIndex(),n=this.getTemplate();return nm({customMappings:(e,r)=>[{currentNode:n,newNode:e.getChildren(r)[t]}],parent:e,insertPos:this.getStart(),newText:this.getTemplate().getText(),replacing:{textLength:this.getWidth(),nodes:[this]}}),e.getChildAtIndex(t)}},[eV.SyntaxKind.TemplateExpression]:class extends sZ{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(e=>this._getNodeFromCompilerNode(e))}setLiteralValue(e){let t=this.getChildIndex(),n=this.getParentSyntaxList()??this.getParentOrThrow();return nD({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:e}),n.getChildAtIndex(t)}},[eV.SyntaxKind.TemplateHead]:class extends s0{},[eV.SyntaxKind.TemplateLiteralType]:class extends aJ{getHead(){return this._getNodeFromCompilerNode(this.compilerNode.head)}getTemplateSpans(){return this.compilerNode.templateSpans.map(e=>this._getNodeFromCompilerNode(e))}setLiteralValue(e){let t=this.getChildIndex(),n=this.getParentSyntaxList()??this.getParentOrThrow();return nD({sourceFile:this._sourceFile,start:this.getStart()+1,replacingLength:this.getWidth()-2,newText:e}),n.getChildAtIndex(t)}},[eV.SyntaxKind.TemplateMiddle]:class extends s1{},[eV.SyntaxKind.TemplateSpan]:class extends s2{getLiteral(){return this._getNodeFromCompilerNode(this.compilerNode.literal)}},[eV.SyntaxKind.TemplateTail]:class extends s8{},[eV.SyntaxKind.ThisType]:class extends aJ{},[eV.SyntaxKind.ThrowStatement]:class extends oB{},[eV.SyntaxKind.TryStatement]:class extends oz{getTryBlock(){return this._getNodeFromCompilerNode(this.compilerNode.tryBlock)}getCatchClause(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.catchClause)}getCatchClauseOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getCatchClause(),e??"Expected to find a catch clause.",this)}getFinallyBlock(){if(null!=this.compilerNode.finallyBlock&&0!==this.compilerNode.finallyBlock.getFullWidth())return this._getNodeFromCompilerNode(this.compilerNode.finallyBlock)}getFinallyBlockOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getFinallyBlock(),e??"Expected to find a finally block.",this)}},[eV.SyntaxKind.TupleType]:class extends aJ{getElements(){return this.compilerNode.elements.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.TypeAliasDeclaration]:class extends a8{set(e){return tD(a8.prototype,this,e),this}getStructure(){return tA(a8.prototype,this,{kind:t.StructureKind.TypeAlias,type:this.getTypeNodeOrThrow().getText()})}},[eV.SyntaxKind.TypeAssertionExpression]:class extends op{},[eV.SyntaxKind.TypeLiteral]:class extends a3{},[eV.SyntaxKind.TypeOperator]:class extends aJ{getOperator(){return this.compilerNode.operator}getTypeNode(){return this._getNodeFromCompilerNode(this.compilerNode.type)}},[eV.SyntaxKind.TypeParameter]:class extends a6{isConst(){return this.hasModifier(eV.SyntaxKind.ConstKeyword)}setIsConst(e){return this.toggleModifier("const",e)}getConstraint(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.constraint)}getConstraintOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getConstraint(),e??"Expected to find the type parameter's constraint.",this)}setConstraint(e){if(e=this.getParentOrThrow()._getTextWithQueuedChildIndentation(e),eV.StringUtils.isNullOrWhitespace(e))return this.removeConstraint(),this;let t=this.getConstraint();return null!=t?t.replaceWithText(e):nm({parent:this,insertPos:this.getNameNode().getEnd(),newText:` extends ${e}`}),this}removeConstraint(){return a4(this.getConstraint(),eV.SyntaxKind.ExtendsKeyword),this}getDefault(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.default)}getDefaultOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getDefault(),e??"Expected to find the type parameter's default.",this)}setDefault(e){if(e=this.getParentOrThrow()._getTextWithQueuedChildIndentation(e),eV.StringUtils.isNullOrWhitespace(e))return this.removeDefault(),this;let t=this.getDefault();return null!=t?t.replaceWithText(e):nm({parent:this,insertPos:(this.getConstraint()||this.getNameNode()).getEnd(),newText:` = ${e}`}),this}removeDefault(){return a4(this.getDefault(),eV.SyntaxKind.EqualsToken),this}setVariance(e){return this.toggleModifier("in",(e&t.TypeParameterVariance.In)!=0),this.toggleModifier("out",(e&t.TypeParameterVariance.Out)!=0),this}getVariance(){let e=t.TypeParameterVariance.None;return this.hasModifier(eV.SyntaxKind.InKeyword)&&(e|=t.TypeParameterVariance.In),this.hasModifier(eV.SyntaxKind.OutKeyword)&&(e|=t.TypeParameterVariance.Out),e}remove(){let e=this.getParentSyntaxListOrThrow();1===e.getChildrenOfKind(eV.SyntaxKind.TypeParameter).length?nv({children:[e.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.LessThanToken),e,e.getNextSiblingIfKindOrThrow(eV.SyntaxKind.GreaterThanToken)]}):nE(this)}set(e){return tD(a6.prototype,this,e),null!=e.isConst&&this.setIsConst(e.isConst),null!=e.constraint?this.setConstraint(e.constraint):e.hasOwnProperty(eV.nameof(e,"constraint"))&&this.removeConstraint(),null!=e.default?this.setDefault(e.default):e.hasOwnProperty(eV.nameof(e,"default"))&&this.removeDefault(),null!=e.variance&&this.setVariance(e.variance),this}getStructure(){let e=this.getConstraint(),n=this.getDefault();return tA(a6.prototype,this,{kind:t.StructureKind.TypeParameter,isConst:this.isConst(),constraint:null!=e?e.getText({trimLeadingIndentation:!0}):void 0,default:n?n.getText({trimLeadingIndentation:!0}):void 0,variance:this.getVariance()})}},[eV.SyntaxKind.TypePredicate]:class extends aJ{getParameterNameNode(){return this._getNodeFromCompilerNode(this.compilerNode.parameterName)}hasAssertsModifier(){return null!=this.compilerNode.assertsModifier}getAssertsModifier(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.assertsModifier)}getAssertsModifierOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getAssertsModifier(),e??"Expected to find an asserts modifier.",this)}getTypeNode(){return this._getNodeFromCompilerNodeIfExists(this.compilerNode.type)}getTypeNodeOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getTypeNode(),e??"Expected to find a type node.",this)}},[eV.SyntaxKind.TypeQuery]:class extends aX{getExprName(){return this._getNodeFromCompilerNode(this.compilerNode.exprName)}},[eV.SyntaxKind.TypeReference]:class extends aX{getTypeName(){return this._getNodeFromCompilerNode(this.compilerNode.typeName)}},[eV.SyntaxKind.UnionType]:class extends aJ{getTypeNodes(){return this.compilerNode.types.map(e=>this._getNodeFromCompilerNode(e))}},[eV.SyntaxKind.VariableDeclaration]:class extends s3{remove(){let e=this.getParentOrThrow();switch(e.getKind()){case eV.SyntaxKind.VariableDeclarationList:var t,n=this;let r=e.getParentIfKindOrThrow(eV.SyntaxKind.VariableStatement);1===r.getDeclarations().length?r.remove():nE(n);break;case eV.SyntaxKind.CatchClause:t=this,nv({children:[t.getPreviousSiblingIfKindOrThrow(eV.SyntaxKind.OpenParenToken),t,t.getNextSiblingIfKindOrThrow(eV.SyntaxKind.CloseParenToken)],removePrecedingSpaces:!0});break;default:throw new eV.errors.NotImplementedError(`Not implemented for syntax kind: ${e.getKindName()}`)}}getVariableStatementOrThrow(e){return eV.errors.throwIfNullOrUndefined(this.getVariableStatement(),e??"Expected the grandparent to be a variable statement.",this)}getVariableStatement(){let e=this.getParentOrThrow().getParentOrThrow();return nL.isVariableStatement(e)?e:void 0}set(e){return tD(s3.prototype,this,e),this}getStructure(){return tA(s3.prototype,this,{kind:t.StructureKind.VariableDeclaration})}},[eV.SyntaxKind.VariableDeclarationList]:class extends s6{getDeclarations(){return this.compilerNode.declarations.map(e=>this._getNodeFromCompilerNode(e))}getDeclarationKind(){let e=this.compilerNode.flags;return e&eV.ts.NodeFlags.Let?t.VariableDeclarationKind.Let:(e&eV.ts.NodeFlags.AwaitUsing)===eV.ts.NodeFlags.AwaitUsing?t.VariableDeclarationKind.AwaitUsing:(e&eV.ts.NodeFlags.Using)===eV.ts.NodeFlags.Using?t.VariableDeclarationKind.Using:e&eV.ts.NodeFlags.Const?t.VariableDeclarationKind.Const:t.VariableDeclarationKind.Var}getDeclarationKindKeywords(){let e=this.getDeclarationKind();switch(e){case t.VariableDeclarationKind.Const:return[this.getFirstChildByKindOrThrow(eV.SyntaxKind.ConstKeyword)];case t.VariableDeclarationKind.Let:return[this.getFirstChildByKindOrThrow(eV.SyntaxKind.LetKeyword)];case t.VariableDeclarationKind.Var:return[this.getFirstChildByKindOrThrow(eV.SyntaxKind.VarKeyword)];case t.VariableDeclarationKind.Using:return[this.getFirstChildByKindOrThrow(eV.SyntaxKind.UsingKeyword)];case t.VariableDeclarationKind.AwaitUsing:let n=this.getFirstChildByKindOrThrow(eV.SyntaxKind.AwaitKeyword),r=n.getNextSiblingIfKindOrThrow(eV.SyntaxKind.UsingKeyword);return[n,r];default:return eV.errors.throwNotImplementedForNeverValueError(e)}}setDeclarationKind(e){if(this.getDeclarationKind()===e)return this;let t=this.getDeclarationKindKeywords(),n=t[0].getStart();return nm({insertPos:n,newText:e,parent:this,replacing:{textLength:t[t.length-1].getEnd()-n}}),this}addDeclaration(e){return this.addDeclarations([e])[0]}addDeclarations(e){return this.insertDeclarations(this.getDeclarations().length,e)}insertDeclaration(e,t){return this.insertDeclarations(e,[t])[0]}insertDeclarations(e,t){let n=this._getWriterWithQueuedChildIndentation(),r=new n6(this._context.structurePrinterFactory.forVariableDeclaration()),i=this.compilerNode.declarations.length;return e=tX(e,i),r.printText(n,t),n_({parent:this.getFirstChildByKindOrThrow(eV.SyntaxKind.SyntaxList),currentNodes:this.getDeclarations(),insertIndex:e,newText:n.toString(),useTrailingCommas:!1}),tU(i,this.getDeclarations(),e,!1)}},[eV.SyntaxKind.VariableStatement]:class extends ar{getDeclarationList(){return this._getNodeFromCompilerNode(this.compilerNode.declarationList)}getDeclarations(){return this.getDeclarationList().getDeclarations()}getDeclarationKind(){return this.getDeclarationList().getDeclarationKind()}getDeclarationKindKeywords(){return this.getDeclarationList().getDeclarationKindKeywords()}setDeclarationKind(e){return this.getDeclarationList().setDeclarationKind(e)}addDeclaration(e){return this.getDeclarationList().addDeclaration(e)}addDeclarations(e){return this.getDeclarationList().addDeclarations(e)}insertDeclaration(e,t){return this.getDeclarationList().insertDeclaration(e,t)}insertDeclarations(e,t){return this.getDeclarationList().insertDeclarations(e,t)}set(e){if(tD(ar.prototype,this,e),null!=e.declarationKind&&this.setDeclarationKind(e.declarationKind),null!=e.declarations){let t=this.getDeclarations();this.addDeclarations(e.declarations),t.forEach(e=>e.remove())}return this}getStructure(){return tA(ar.prototype,this,{kind:t.StructureKind.VariableStatement,declarationKind:this.getDeclarationKind(),declarations:this.getDeclarations().map(e=>e.getStructure())})}},[eV.SyntaxKind.JSDoc]:class extends aq{isMultiLine(){return this.getText().includes("\n")}getTags(){return this.compilerNode.tags?.map(e=>this._getNodeFromCompilerNode(e))??[]}getInnerText(){return aH(this.getText())}getComment(){return null==this.compilerNode.comment?void 0:"string"==typeof this.compilerNode.comment?this.compilerNode.comment:this.compilerNode.comment.map(e=>this._getNodeFromCompilerNodeIfExists(e))}getCommentText(){return"string"==typeof this.compilerNode.comment?this.compilerNode.comment:eV.ts.getTextOfJSDocComment(this.compilerNode.comment)}getDescription(){let e=this.getSourceFile().getFullText(),t=this.getTags()[0]?.getStart()??this.getEnd()-2,n=function(t){let n=t.getStart()+3;return e.charCodeAt(n)===eJ.SPACE?n+1:n}(this);return aH(e.substring(n,Math.max(n,function(){let n=tW(e,t,e=>e===eJ.NEWLINE||!eV.StringUtils.isWhitespaceCharCode(e)&&e!==eJ.ASTERISK);return tW(e,n,e=>e!==eJ.NEWLINE&&e!==eJ.CARRIAGE_RETURN)}())))}setDescription(e){let t=this.getTags(),n=this.getStart()+3,r=t.length>0?tW(this._sourceFile.getFullText(),t[0].getStart(),e=>e===eJ.ASTERISK)-1:this.getEnd()-2,{replacePos:i,replacingLength:o,newText:a,parent:s}={parent:this,newText:(function(){let t=this.getIndentationText(),n=this._context.manipulationSettings.getNewLineKindAsString(),r=tp(this._getWriter(),e).split(/\r?\n/),i=0===r[0].length,o=1===r.length&&(this.compilerNode.tags?.length??0)===0,a=o?r[0]:r.map(e=>0===e.length?`${t} *`:`${t} * ${e}`).slice(+!!i).join(n);return o?" "+a+" ":n+a+n+t+" "}).call(this),replacePos:n,replacingLength:r-n};return nf(s._sourceFile,new no({insertPos:i,replacingLength:o,newText:a}),new ne().getForParentRange({parent:s,start:i,end:i+a.length})),this}addTag(e){return this.addTags([e])[0]}addTags(e){return this.insertTags(this.compilerNode.tags?.length??0,e)}insertTag(e,t){return this.insertTags(e,[t])[0]}insertTags(e,t){if(eV.ArrayUtils.isNullOrEmpty(t))return[];let n=this._getWriterWithQueuedIndentation(),r=this.getTags();if(e=tX(e,r.length),0!==r.length||this.isMultiLine()){let i=this._context.structurePrinterFactory.forJSDocTag({printStarsOnNewLine:!0});n.newLine().write(" * "),i.printTexts(n,t),n.newLine().write(" *"),n.conditionalWrite(e<r.length," ");let o=(function(){let t=e<r.length?r[e].getStart():this.getEnd()-2;return Math.max(this.getStart()+3,tW(this.getSourceFile().getFullText(),t,e=>!eV.StringUtils.isWhitespaceCharCode(e)&&e!==eJ.ASTERISK))}).call(this);nm({parent:this,insertPos:o,replacing:{textLength:(function(){return e<r.length?r[e].getStart():this.getEnd()-1}).call(this)-o},newText:n.toString()})}else{let e=this._context.structurePrinterFactory.forJSDoc();this.replaceWithText(n=>{e.printText(n,{description:this.getDescription(),tags:t})})}return tU(r,this.getTags(),e,!1)}remove(){nv({children:[this],removeFollowingSpaces:!0,removeFollowingNewLines:!0})}set(e){return(tD(aq.prototype,this,e),null!=e.tags)?this.replaceWithText(t=>{this._context.structurePrinterFactory.forJSDoc().printText(t,{description:e.description??this.getDescription(),tags:e.tags})}):(null!=e.description&&this.setDescription(e.description),this)}getStructure(){return tA(aq.prototype,this,{kind:t.StructureKind.JSDoc,description:this.getDescription(),tags:this.getTags().map(e=>e.getStructure())})}},[eV.SyntaxKind.TypeOfExpression]:class extends of{},[eV.SyntaxKind.WhileStatement]:class extends ai{},[eV.SyntaxKind.WithStatement]:class extends ao{getStatement(){return this._getNodeFromCompilerNode(this.compilerNode.statement)}},[eV.SyntaxKind.YieldExpression]:class extends o_{},[eV.SyntaxKind.SemicolonToken]:nL,[eV.SyntaxKind.AnyKeyword]:ik,[eV.SyntaxKind.BooleanKeyword]:ik,[eV.SyntaxKind.FalseKeyword]:class extends sU{getLiteralValue(){return sq(this)}setLiteralValue(e){return sH(this,e)}},[eV.SyntaxKind.ImportKeyword]:class extends iZ{},[eV.SyntaxKind.InferKeyword]:nL,[eV.SyntaxKind.NeverKeyword]:nL,[eV.SyntaxKind.NullKeyword]:class extends sJ{},[eV.SyntaxKind.NumberKeyword]:ik,[eV.SyntaxKind.ObjectKeyword]:ik,[eV.SyntaxKind.StringKeyword]:ik,[eV.SyntaxKind.SymbolKeyword]:ik,[eV.SyntaxKind.SuperKeyword]:class extends od{},[eV.SyntaxKind.ThisKeyword]:class extends ou{},[eV.SyntaxKind.TrueKeyword]:class extends sV{getLiteralValue(){return sq(this)}setLiteralValue(e){return sH(this,e)}},[eV.SyntaxKind.UndefinedKeyword]:ik,[eV.SyntaxKind.VoidExpression]:class extends om{}};class lw{#tH;#eo=new Map;#nk=new eV.WeakCache;#nw=new eV.WeakCache;#nL=new eV.WeakCache;#nO=new eV.WeakCache;#nF=new eV.WeakCache;#nW=new eV.WeakCache;#nB=new eV.WeakCache;#nz=new eV.WeakCache;#nG=new eV.WeakCache;#nj=new eV.WeakCache;#nK=new eV.WeakCache;#nV=new eV.WeakCache;#nU=new eV.WeakCache;#nH=new lM;#nq;#nJ=new eV.EventContainer;#n$=new eV.EventContainer;documentRegistry;constructor(e){this.documentRegistry=new eV.DocumentRegistry(e.fileSystemWrapper),this.#nq=new lR(e),e.compilerOptions.onModified(()=>{for(let e of Array.from(this.#eo.values()))nI({sourceFile:e,newFilePath:e.getFilePath()})}),this.#tH=e}*getSourceFilesByDirectoryDepth(){for(let e of this.getDirectoriesByDepth())yield*e.getSourceFiles()}getSourceFilePaths(){return this.#eo.keys()}getChildDirectoriesOfDirectory(e){return this.#nq.getChildDirectoriesOfDirectory(e)}getChildSourceFilesOfDirectory(e){return this.#nq.getChildSourceFilesOfDirectory(e)}onSourceFileAdded(e,t=!0){t?this.#nJ.subscribe(e):this.#nJ.unsubscribe(e)}onSourceFileRemoved(e){this.#n$.subscribe(e)}createSourceFile(e,t,n){if("string"==typeof(t=t instanceof Function?tp(this.#tH.createWriter(),t):t||""))return this.createSourceFileFromText(e,t,n);let r=this.#tH.createWriter();return this.#tH.structurePrinterFactory.forSourceFile({isAmbient:".d.ts"===eV.FileUtils.getExtension(e)}).printText(r,t),this.createSourceFileFromText(e,r.toString(),n)}createSourceFileFromText(e,t,n){return(e=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e),!0===n.overwrite)?this.#nX(e,t,n):(this.throwIfFileExists(e,"Did you mean to provide the overwrite option?"),this.#nY(e,t,n))}throwIfFileExists(e,t){if(this.containsSourceFileAtPath(e)||this.#tH.fileSystemWrapper.fileExistsSync(e))throw t=null==t?"":t+" ",new eV.errors.InvalidOperationError(`${t}A source file already exists at the provided file path: ${e}`)}#nX(e,t,n){e=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e);let r=this.addOrGetSourceFileFromFilePath(e,n);return null!=r?(r.getChildren().forEach(e=>e.forget()),this.replaceCompilerNode(r,this.createCompilerSourceFileFromText(e,t,n.scriptKind)),r):this.#nY(e,t,n)}getSourceFileFromCacheFromFilePath(e){return e=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e),this.#eo.get(e)}addOrGetSourceFileFromFilePath(e,t){e=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e);let n=this.#eo.get(e);if(null==n){let r=this.#tH.fileSystemWrapper.readFileIfExistsSync(e,this.#tH.getEncoding());null!=r&&(this.#tH.logger.log(`Loaded file: ${e}`),(n=this.#nY(e,r,t))._setIsSaved(!0))}return null!=n&&t.markInProject&&n._markAsInProject(),n}containsSourceFileAtPath(e){return e=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e),this.#eo.has(e)}containsDirectoryAtPath(e){return e=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e),this.#nq.has(e)}getSourceFileForNode(e){let t=e;for(;t.kind!==eV.SyntaxKind.SourceFile;){if(null==t.parent)return;t=t.parent}return this.getSourceFile(t,{markInProject:!1})}hasCompilerNode(e){return this.#nH.has(e)}getExistingNodeFromCompilerNode(e){return this.#nH.get(e)}getNodeFromCompilerNode(e,t){if(e.kind===eV.SyntaxKind.SourceFile)return this.getSourceFile(e,{markInProject:!1});return this.#nH.getOrCreate(e,()=>{let e=n.call(this);return r.call(this,e),e});function n(){return null!=e._commentKind?e4.isCommentStatement(e)?new oT(this.#tH,e,t):e4.isCommentClassElement(e)?new aF(this.#tH,e,t):e4.isCommentTypeElement(e)?new sb(this.#tH,e,t):e4.isCommentObjectLiteralElement(e)?new i4(this.#tH,e,t):e4.isCommentEnumMember(e)?new s_(this.#tH,e,t):eV.errors.throwNotImplementedForNeverValueError(e):new(lk[e.kind]||nL)(this.#tH,e,t)}function r(n){if(null!=e.parent){let n=this.getNodeFromCompilerNode(e.parent,t);n._wrappedChildCount++}let r=n._getParentSyntaxListIfWrapped();if(null!=r&&r._wrappedChildCount++,e.kind===eV.SyntaxKind.SyntaxList){let e=0;for(let t of n._getChildrenInCacheIterator())e++;n._wrappedChildCount=e}}}#nY(e,t,n){let r=eV.StringUtils.hasBom(t);r&&(t=eV.StringUtils.stripBom(t));let i=this.getSourceFile(this.createCompilerSourceFileFromText(e,t,n.scriptKind),n);return r&&(i._hasBom=!0),i}createCompilerSourceFileFromText(e,t,n){return this.documentRegistry.createOrUpdateSourceFile(e,this.#tH.compilerOptions.get(),eV.ts.ScriptSnapshot.fromString(t),n)}getSourceFile(e,t){let n=!1,r=this.#eo.get(e.fileName)??this.#nH.getOrCreate(e,()=>{let r=new ae(this.#tH,e);return t.markInProject||this.#tH.inProjectCoordinator.setSourceFileNotInProject(r),this.#nQ(r),n=!0,r});return t.markInProject&&r._markAsInProject(),n&&this.#nJ.fire(r),r}#nQ(e){this.#eo.set(e.getFilePath(),e),this.#tH.fileSystemWrapper.removeFileDelete(e.getFilePath()),this.#nq.addSourceFile(e)}getDirectoryFromPath(e,t){e=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e);let n=this.#nq.get(e);return null==n&&this.#tH.fileSystemWrapper.directoryExistsSync(e)&&(n=this.#nq.createOrAddIfExists(e)),null!=n&&t.markInProject&&n._markAsInProject(),n}createDirectoryOrAddIfExists(e,t){let n=this.#nq.createOrAddIfExists(e);return null!=n&&t.markInProject&&n._markAsInProject(),n}getDirectoryFromCache(e){return this.#nq.get(e)}getDirectoryFromCacheOnlyIfInCache(e){return this.#nq.has(e)?this.#nq.get(e):void 0}getDirectoriesByDepth(){return this.#nq.getAllByDepth()}getOrphanDirectories(){return this.#nq.getOrphans()}getSymbolDisplayPart(e){return this.#nz.getOrCreate(e,()=>new lb(e))}getType(e){return(e.flags&eV.TypeFlags.TypeParameter)===eV.TypeFlags.TypeParameter?this.getTypeParameter(e):this.#nV.getOrCreate(e,()=>new lT(this.#tH,e))}getTypeParameter(e){return this.#nU.getOrCreate(e,()=>new lA(this.#tH,e))}getSignature(e){return this.#nW.getOrCreate(e,()=>new s4(this.#tH,e))}getSymbol(e){return this.#nB.getOrCreate(e,()=>new s5(this.#tH,e))}getDefinitionInfo(e){return this.#nw.getOrCreate(e,()=>new lo(this.#tH,e))}getDocumentSpan(e){return this.#nL.getOrCreate(e,()=>new li(this.#tH,e))}getReferencedSymbolEntry(e){return this.#nG.getOrCreate(e,()=>new ly(this.#tH,e))}getReferencedSymbol(e){return this.#nj.getOrCreate(e,()=>new l_(this.#tH,e))}getReferencedSymbolDefinitionInfo(e){return this.#nK.getOrCreate(e,()=>new lh(this.#tH,e))}getDiagnostic(e){return this.#nk.getOrCreate(e,()=>null!=e.start?new ll(this.#tH,e):new ls(this.#tH,e))}getDiagnosticWithLocation(e){return this.#nk.getOrCreate(e,()=>new ll(this.#tH,e))}getDiagnosticMessageChain(e){return this.#nO.getOrCreate(e,()=>new la(e))}getJSDocTagInfo(e){return this.#nF.getOrCreate(e,()=>new su(e))}replaceCompilerNode(e,t){let n=e instanceof nL?e.compilerNode:e,r=e instanceof nL?e:this.#nH.get(e);n.kind===eV.SyntaxKind.SourceFile&&n.fileName!==t.fileName?(this.#nZ(n),r._replaceCompilerNodeFromFactory(t),this.#nH.set(t,r),this.#nQ(r),this.#nJ.fire(r)):(this.#nH.replaceKey(n,t),null!=r&&r._replaceCompilerNodeFromFactory(t))}removeNodeFromCache(e){this.#nZ(e.compilerNode)}#nZ(e){if(this.#nH.removeByKey(e),e.kind===eV.SyntaxKind.SourceFile){let t=this.#tH.fileSystemWrapper.getStandardizedAbsolutePath(e.fileName);this.#nq.removeSourceFile(t);let n=this.#eo.get(t);this.#eo.delete(t),this.documentRegistry.removeSourceFile(t),null!=n&&this.#n$.fire(n)}}addDirectoryToCache(e){this.#nq.addDirectory(e)}removeDirectoryFromCache(e){this.#nq.remove(e)}forgetNodesCreatedInBlock(e){let t;this.#nH.setForgetPoint();let n=!1;try{var r;if(t=e((...e)=>{for(let t of e)this.#nH.rememberNode(t)}),nL.isNode(t)&&this.#nH.rememberNode(t),r=t,null!=r&&"function"==typeof r.then)return n=!0,t.then(e=>(nL.isNode(e)&&this.#nH.rememberNode(e),this.#nH.forgetLastPoint(),e))}finally{n||this.#nH.forgetLastPoint()}return t}}class lL{#ez;#n0=new Set;constructor(e){e.onSourceFileRemoved(e=>{this.#n0.delete(e)}),this.#ez=e}setSourceFileNotInProject(e){this.#n0.add(e),e._inProject=!1}markSourceFileAsInProject(e){this.isSourceFileInProject(e)||(this.#n1(e),this.#n0.delete(e))}markSourceFilesAsInProjectForResolution(){let e="/node_modules/",t=this.#ez,n=[],r=[];for(let i of[...this.#n0.values()])!function(n){let r=n.getFilePath(),i=r.toLowerCase().lastIndexOf(e);if(-1===i)return!0;let o=r.substring(0,i+e.length-1),a=t.getDirectoryFromCacheOnlyIfInCache(o);if(null!=a&&a._isInProject())return!0;let s=n.getDirectory();for(;null!=s&&s.getPath()!==o;){if(s._isInProject())return!0;s=t.getDirectoryFromCacheOnlyIfInCache(eV.FileUtils.getDirPath(s.getPath()))}return!1}(i)?r.push(i):(this.#n1(i),this.#n0.delete(i),n.push(i));return{changedSourceFiles:n,unchangedSourceFiles:r}}#n1(e){e._inProject=!0,this.markDirectoryAsInProject(e.getDirectory())}isSourceFileInProject(e){return!0===e._inProject}setDirectoryAndFilesAsNotInProjectForTesting(e){for(let t of e.getDirectories())this.setDirectoryAndFilesAsNotInProjectForTesting(t);for(let t of e.getSourceFiles())delete t._inProject,this.#n0.add(t);delete e._inProject}markDirectoryAsInProject(e){if(this.isDirectoryInProject(e))return;let t=this,n=this.#ez;e._inProject=!0,function(e){let r=Array.from(function* e(r){if(eV.FileUtils.isRootDirPath(r.getPath()))return;let i=eV.FileUtils.getDirPath(r.getPath()),o=n.getDirectoryFromCacheOnlyIfInCache(i);null!=o&&(yield o,t.isDirectoryInProject(o)||(yield*e(o)))}(e)),i=r[r.length-1];if(null!=i&&t.isDirectoryInProject(i))for(let e of r)e._inProject=!0}(e)}isDirectoryInProject(e){return!0===e._inProject}}let lO=(eE=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;D=[eV.Memoize],C=[eV.Memoize],I=[eV.Memoize],N=[eV.Memoize],P=[eV.Memoize],R=[eV.Memoize],M=[eV.Memoize],k=[eV.Memoize],w=[eV.Memoize],L=[eV.Memoize],O=[eV.Memoize],F=[eV.Memoize],W=[eV.Memoize],B=[eV.Memoize],z=[eV.Memoize],G=[eV.Memoize],j=[eV.Memoize],K=[eV.Memoize],V=[eV.Memoize],U=[eV.Memoize],H=[eV.Memoize],q=[eV.Memoize],J=[eV.Memoize],$=[eV.Memoize],X=[eV.Memoize],Y=[eV.Memoize],Q=[eV.Memoize],Z=[eV.Memoize],ee=[eV.Memoize],et=[eV.Memoize],en=[eV.Memoize],er=[eV.Memoize],ei=[eV.Memoize],eo=[eV.Memoize],ea=[eV.Memoize],es=[eV.Memoize],el=[eV.Memoize],ec=[eV.Memoize],ed=[eV.Memoize],eu=[eV.Memoize],ep=[eV.Memoize],ef=[eV.Memoize],em=[eV.Memoize],e_=[eV.Memoize],eh=[eV.Memoize],eg=[eV.Memoize],ey=[eV.Memoize],ev=[eV.Memoize],eb=[eV.Memoize],ex=[eV.Memoize],eS=[eV.Memoize],o5(this,null,D,{kind:"method",name:"forInitializerExpressionableNode",static:!1,private:!1,access:{has:e=>"forInitializerExpressionableNode"in e,get:e=>e.forInitializerExpressionableNode},metadata:e},null,eE),o5(this,null,C,{kind:"method",name:"forModifierableNode",static:!1,private:!1,access:{has:e=>"forModifierableNode"in e,get:e=>e.forModifierableNode},metadata:e},null,eE),o5(this,null,I,{kind:"method",name:"forReturnTypedNode",static:!1,private:!1,access:{has:e=>"forReturnTypedNode"in e,get:e=>e.forReturnTypedNode},metadata:e},null,eE),o5(this,null,N,{kind:"method",name:"forTypedNode",static:!1,private:!1,access:{has:e=>"forTypedNode"in e,get:e=>e.forTypedNode},metadata:e},null,eE),o5(this,null,P,{kind:"method",name:"forClassDeclaration",static:!1,private:!1,access:{has:e=>"forClassDeclaration"in e,get:e=>e.forClassDeclaration},metadata:e},null,eE),o5(this,null,R,{kind:"method",name:"forClassMember",static:!1,private:!1,access:{has:e=>"forClassMember"in e,get:e=>e.forClassMember},metadata:e},null,eE),o5(this,null,M,{kind:"method",name:"forClassStaticBlockDeclaration",static:!1,private:!1,access:{has:e=>"forClassStaticBlockDeclaration"in e,get:e=>e.forClassStaticBlockDeclaration},metadata:e},null,eE),o5(this,null,k,{kind:"method",name:"forConstructorDeclaration",static:!1,private:!1,access:{has:e=>"forConstructorDeclaration"in e,get:e=>e.forConstructorDeclaration},metadata:e},null,eE),o5(this,null,w,{kind:"method",name:"forGetAccessorDeclaration",static:!1,private:!1,access:{has:e=>"forGetAccessorDeclaration"in e,get:e=>e.forGetAccessorDeclaration},metadata:e},null,eE),o5(this,null,L,{kind:"method",name:"forMethodDeclaration",static:!1,private:!1,access:{has:e=>"forMethodDeclaration"in e,get:e=>e.forMethodDeclaration},metadata:e},null,eE),o5(this,null,O,{kind:"method",name:"forPropertyDeclaration",static:!1,private:!1,access:{has:e=>"forPropertyDeclaration"in e,get:e=>e.forPropertyDeclaration},metadata:e},null,eE),o5(this,null,F,{kind:"method",name:"forSetAccessorDeclaration",static:!1,private:!1,access:{has:e=>"forSetAccessorDeclaration"in e,get:e=>e.forSetAccessorDeclaration},metadata:e},null,eE),o5(this,null,W,{kind:"method",name:"forDecorator",static:!1,private:!1,access:{has:e=>"forDecorator"in e,get:e=>e.forDecorator},metadata:e},null,eE),o5(this,null,B,{kind:"method",name:"forJSDoc",static:!1,private:!1,access:{has:e=>"forJSDoc"in e,get:e=>e.forJSDoc},metadata:e},null,eE),o5(this,null,z,{kind:"method",name:"forJSDocTag",static:!1,private:!1,access:{has:e=>"forJSDocTag"in e,get:e=>e.forJSDocTag},metadata:e},null,eE),o5(this,null,G,{kind:"method",name:"forEnumDeclaration",static:!1,private:!1,access:{has:e=>"forEnumDeclaration"in e,get:e=>e.forEnumDeclaration},metadata:e},null,eE),o5(this,null,j,{kind:"method",name:"forEnumMember",static:!1,private:!1,access:{has:e=>"forEnumMember"in e,get:e=>e.forEnumMember},metadata:e},null,eE),o5(this,null,K,{kind:"method",name:"forObjectLiteralExpressionProperty",static:!1,private:!1,access:{has:e=>"forObjectLiteralExpressionProperty"in e,get:e=>e.forObjectLiteralExpressionProperty},metadata:e},null,eE),o5(this,null,V,{kind:"method",name:"forPropertyAssignment",static:!1,private:!1,access:{has:e=>"forPropertyAssignment"in e,get:e=>e.forPropertyAssignment},metadata:e},null,eE),o5(this,null,U,{kind:"method",name:"forShorthandPropertyAssignment",static:!1,private:!1,access:{has:e=>"forShorthandPropertyAssignment"in e,get:e=>e.forShorthandPropertyAssignment},metadata:e},null,eE),o5(this,null,H,{kind:"method",name:"forSpreadAssignment",static:!1,private:!1,access:{has:e=>"forSpreadAssignment"in e,get:e=>e.forSpreadAssignment},metadata:e},null,eE),o5(this,null,q,{kind:"method",name:"forFunctionDeclaration",static:!1,private:!1,access:{has:e=>"forFunctionDeclaration"in e,get:e=>e.forFunctionDeclaration},metadata:e},null,eE),o5(this,null,J,{kind:"method",name:"forParameterDeclaration",static:!1,private:!1,access:{has:e=>"forParameterDeclaration"in e,get:e=>e.forParameterDeclaration},metadata:e},null,eE),o5(this,null,$,{kind:"method",name:"forCallSignatureDeclaration",static:!1,private:!1,access:{has:e=>"forCallSignatureDeclaration"in e,get:e=>e.forCallSignatureDeclaration},metadata:e},null,eE),o5(this,null,X,{kind:"method",name:"forConstructSignatureDeclaration",static:!1,private:!1,access:{has:e=>"forConstructSignatureDeclaration"in e,get:e=>e.forConstructSignatureDeclaration},metadata:e},null,eE),o5(this,null,Y,{kind:"method",name:"forIndexSignatureDeclaration",static:!1,private:!1,access:{has:e=>"forIndexSignatureDeclaration"in e,get:e=>e.forIndexSignatureDeclaration},metadata:e},null,eE),o5(this,null,Q,{kind:"method",name:"forInterfaceDeclaration",static:!1,private:!1,access:{has:e=>"forInterfaceDeclaration"in e,get:e=>e.forInterfaceDeclaration},metadata:e},null,eE),o5(this,null,Z,{kind:"method",name:"forMethodSignature",static:!1,private:!1,access:{has:e=>"forMethodSignature"in e,get:e=>e.forMethodSignature},metadata:e},null,eE),o5(this,null,ee,{kind:"method",name:"forPropertySignature",static:!1,private:!1,access:{has:e=>"forPropertySignature"in e,get:e=>e.forPropertySignature},metadata:e},null,eE),o5(this,null,et,{kind:"method",name:"forTypeElementMemberedNode",static:!1,private:!1,access:{has:e=>"forTypeElementMemberedNode"in e,get:e=>e.forTypeElementMemberedNode},metadata:e},null,eE),o5(this,null,en,{kind:"method",name:"forTypeElementMember",static:!1,private:!1,access:{has:e=>"forTypeElementMember"in e,get:e=>e.forTypeElementMember},metadata:e},null,eE),o5(this,null,er,{kind:"method",name:"forJsxAttributeDecider",static:!1,private:!1,access:{has:e=>"forJsxAttributeDecider"in e,get:e=>e.forJsxAttributeDecider},metadata:e},null,eE),o5(this,null,ei,{kind:"method",name:"forJsxAttribute",static:!1,private:!1,access:{has:e=>"forJsxAttribute"in e,get:e=>e.forJsxAttribute},metadata:e},null,eE),o5(this,null,eo,{kind:"method",name:"forJsxChildDecider",static:!1,private:!1,access:{has:e=>"forJsxChildDecider"in e,get:e=>e.forJsxChildDecider},metadata:e},null,eE),o5(this,null,ea,{kind:"method",name:"forJsxElement",static:!1,private:!1,access:{has:e=>"forJsxElement"in e,get:e=>e.forJsxElement},metadata:e},null,eE),o5(this,null,es,{kind:"method",name:"forJsxNamespacedName",static:!1,private:!1,access:{has:e=>"forJsxNamespacedName"in e,get:e=>e.forJsxNamespacedName},metadata:e},null,eE),o5(this,null,el,{kind:"method",name:"forJsxSelfClosingElement",static:!1,private:!1,access:{has:e=>"forJsxSelfClosingElement"in e,get:e=>e.forJsxSelfClosingElement},metadata:e},null,eE),o5(this,null,ec,{kind:"method",name:"forJsxSpreadAttribute",static:!1,private:!1,access:{has:e=>"forJsxSpreadAttribute"in e,get:e=>e.forJsxSpreadAttribute},metadata:e},null,eE),o5(this,null,ed,{kind:"method",name:"forExportAssignment",static:!1,private:!1,access:{has:e=>"forExportAssignment"in e,get:e=>e.forExportAssignment},metadata:e},null,eE),o5(this,null,eu,{kind:"method",name:"forExportDeclaration",static:!1,private:!1,access:{has:e=>"forExportDeclaration"in e,get:e=>e.forExportDeclaration},metadata:e},null,eE),o5(this,null,ep,{kind:"method",name:"forImportAttribute",static:!1,private:!1,access:{has:e=>"forImportAttribute"in e,get:e=>e.forImportAttribute},metadata:e},null,eE),o5(this,null,ef,{kind:"method",name:"forImportDeclaration",static:!1,private:!1,access:{has:e=>"forImportDeclaration"in e,get:e=>e.forImportDeclaration},metadata:e},null,eE),o5(this,null,em,{kind:"method",name:"forModuleDeclaration",static:!1,private:!1,access:{has:e=>"forModuleDeclaration"in e,get:e=>e.forModuleDeclaration},metadata:e},null,eE),o5(this,null,e_,{kind:"method",name:"forNamedImportExportSpecifier",static:!1,private:!1,access:{has:e=>"forNamedImportExportSpecifier"in e,get:e=>e.forNamedImportExportSpecifier},metadata:e},null,eE),o5(this,null,eh,{kind:"method",name:"forSourceFile",static:!1,private:!1,access:{has:e=>"forSourceFile"in e,get:e=>e.forSourceFile},metadata:e},null,eE),o5(this,null,eg,{kind:"method",name:"forStatementedNode",static:!1,private:!1,access:{has:e=>"forStatementedNode"in e,get:e=>e.forStatementedNode},metadata:e},null,eE),o5(this,null,ey,{kind:"method",name:"forStatement",static:!1,private:!1,access:{has:e=>"forStatement"in e,get:e=>e.forStatement},metadata:e},null,eE),o5(this,null,ev,{kind:"method",name:"forVariableStatement",static:!1,private:!1,access:{has:e=>"forVariableStatement"in e,get:e=>e.forVariableStatement},metadata:e},null,eE),o5(this,null,eb,{kind:"method",name:"forTypeAliasDeclaration",static:!1,private:!1,access:{has:e=>"forTypeAliasDeclaration"in e,get:e=>e.forTypeAliasDeclaration},metadata:e},null,eE),o5(this,null,ex,{kind:"method",name:"forTypeParameterDeclaration",static:!1,private:!1,access:{has:e=>"forTypeParameterDeclaration"in e,get:e=>e.forTypeParameterDeclaration},metadata:e},null,eE),o5(this,null,eS,{kind:"method",name:"forVariableDeclaration",static:!1,private:!1,access:{has:e=>"forVariableDeclaration"in e,get:e=>e.forVariableDeclaration},metadata:e},null,eE),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}_getFormatCodeSettings=o7(this,eE);constructor(e){this._getFormatCodeSettings=e}getFormatCodeSettings(){return this._getFormatCodeSettings()}forInitializerExpressionableNode(){return new n0}forModifierableNode(){return new n1}forReturnTypedNode(e){return new n2(e)}forTypedNode(e,t){return new n8(e,t)}forClassDeclaration(e){return new rn(this,e)}forClassMember(e){return new rd(this,e)}forClassStaticBlockDeclaration(){return new ru(this)}forConstructorDeclaration(e){return new rp(this,e)}forGetAccessorDeclaration(e){return new rf(this,e)}forMethodDeclaration(e){return new rm(this,e)}forPropertyDeclaration(){return new r_(this)}forSetAccessorDeclaration(e){return new rh(this,e)}forDecorator(){return new ry(this)}forJSDoc(){return new rv(this)}forJSDocTag(e){return new rb(this,e)}forEnumDeclaration(){return new rx(this)}forEnumMember(){return new rS(this)}forObjectLiteralExpressionProperty(){return new rE(this)}forPropertyAssignment(){return new rT(this)}forShorthandPropertyAssignment(){return new rA(this)}forSpreadAssignment(){return new rD(this)}forFunctionDeclaration(e){return new rC(this,e)}forParameterDeclaration(){return new rI(this)}forCallSignatureDeclaration(){return new rN(this)}forConstructSignatureDeclaration(){return new rP(this)}forIndexSignatureDeclaration(){return new rR(this)}forInterfaceDeclaration(){return new rM(this)}forMethodSignature(){return new rk(this)}forPropertySignature(){return new rw(this)}forTypeElementMemberedNode(){return new rL(this)}forTypeElementMember(){return new rO(this)}forJsxAttributeDecider(){return new rF(this)}forJsxAttribute(){return new rW(this)}forJsxChildDecider(){return new rB(this)}forJsxElement(){return new rz(this)}forJsxNamespacedName(){return new rG(this)}forJsxSelfClosingElement(){return new rj(this)}forJsxSpreadAttribute(){return new rK(this)}forExportAssignment(){return new rV(this)}forExportDeclaration(){return new rU(this)}forImportAttribute(){return new rH(this)}forImportDeclaration(){return new rq(this)}forModuleDeclaration(e){return new rJ(this,e)}forNamedImportExportSpecifier(){return new r$(this)}forSourceFile(e){return new rX(this,e)}forStatementedNode(e){return new rY(this,e)}forStatement(e){return new rQ(this,e)}forVariableStatement(){return new rZ(this)}forTypeAliasDeclaration(){return new r0(this)}forTypeParameterDeclaration(){return new r1(this)}forVariableDeclaration(){return new r2(this)}}),lF=(eD=[],class{static{let e="function"==typeof Symbol&&Symbol.metadata?Object.create(null):void 0;eT=[eV.Memoize],eA=[eV.Memoize],o5(this,null,eT,{kind:"method",name:"getSourceFileContainer",static:!1,private:!1,access:{has:e=>"getSourceFileContainer"in e,get:e=>e.getSourceFileContainer},metadata:e},null,eD),o5(this,null,eA,{kind:"method",name:"getModuleResolutionHost",static:!1,private:!1,access:{has:e=>"getModuleResolutionHost"in e,get:e=>e.getModuleResolutionHost},metadata:e},null,eD),e&&Object.defineProperty(this,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:e})}#n2=o7(this,eD);#n8;#n3;#n6;get project(){if(null==this.#n6)throw new eV.errors.InvalidOperationError("This operation is not permitted in this context.");return this.#n6}logger=new t_;lazyReferenceCoordinator;directoryCoordinator;fileSystemWrapper;manipulationSettings=new tc;structurePrinterFactory;compilerFactory;inProjectCoordinator;constructor(e){this.#n6=e.project,this.fileSystemWrapper=e.fileSystemWrapper,this.#n8=e.compilerOptionsContainer,this.compilerFactory=new lw(this),this.inProjectCoordinator=new lL(this.compilerFactory),this.structurePrinterFactory=new lO(()=>this.manipulationSettings.getFormatCodeSettings()),this.lazyReferenceCoordinator=new tv(this.compilerFactory),this.directoryCoordinator=new lP(this.compilerFactory,e.fileSystemWrapper),this.#n2=e.createLanguageService?new lE({context:this,configFileParsingDiagnostics:e.configFileParsingDiagnostics,resolutionHost:e.resolutionHost&&e.resolutionHost(this.getModuleResolutionHost(),()=>this.compilerOptions.get()),skipLoadingLibFiles:e.skipLoadingLibFiles,libFolderPath:e.libFolderPath}):void 0,null!=e.typeChecker&&(eV.errors.throwIfTrue(e.createLanguageService,"Cannot specify a type checker and create a language service."),this.#n3=new lx(this),this.#n3._reset(()=>e.typeChecker))}get compilerOptions(){return this.#n8}get languageService(){if(null==this.#n2)throw this.#n4("language service");return this.#n2}get program(){if(null==this.#n2)throw this.#n4("program");return this.languageService.getProgram()}get typeChecker(){if(null!=this.#n3)return this.#n3;if(null==this.#n2)throw this.#n4("type checker");return this.program.getTypeChecker()}hasLanguageService(){return null!=this.#n2}getEncoding(){return this.compilerOptions.getEncoding()}getFormatCodeSettings(){return this.manipulationSettings.getFormatCodeSettings()}getUserPreferences(){return this.manipulationSettings.getUserPreferences()}resetProgram(){this.languageService._reset()}createWriter(){let e=this.manipulationSettings.getIndentationText();return new eH.default({newLine:this.manipulationSettings.getNewLineKindAsString(),indentNumberOfSpaces:e===t.IndentationText.Tab?void 0:e.length,useTabs:e===t.IndentationText.Tab,useSingleQuote:this.manipulationSettings.getQuoteKind()===t.QuoteKind.Single})}getPreEmitDiagnostics(e){return eV.ts.getPreEmitDiagnostics(this.program.compilerObject,e?.compilerNode).map(e=>this.compilerFactory.getDiagnostic(e))}getSourceFileContainer(){return{addOrGetSourceFileFromFilePath:(e,t)=>Promise.resolve(this.compilerFactory.addOrGetSourceFileFromFilePath(e,t)?.compilerNode),addOrGetSourceFileFromFilePathSync:(e,t)=>this.compilerFactory.addOrGetSourceFileFromFilePath(e,t)?.compilerNode,containsDirectoryAtPath:e=>this.compilerFactory.containsDirectoryAtPath(e),containsSourceFileAtPath:e=>this.compilerFactory.containsSourceFileAtPath(e),getSourceFileFromCacheFromFilePath:e=>{let t=this.compilerFactory.getSourceFileFromCacheFromFilePath(e);return t?.compilerNode},getSourceFilePaths:()=>this.compilerFactory.getSourceFilePaths(),getSourceFileVersion:e=>this.compilerFactory.documentRegistry.getSourceFileVersion(e),getChildDirectoriesOfDirectory:e=>{let t=[];for(let n of this.compilerFactory.getChildDirectoriesOfDirectory(e))t.push(n.getPath());return t}}}getModuleResolutionHost(){return eV.createModuleResolutionHost({transactionalFileSystem:this.fileSystemWrapper,getEncoding:()=>this.getEncoding(),sourceFileContainer:this.getSourceFileContainer()})}#n4(e){return new eV.errors.InvalidOperationError(`A ${e} 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 ${e} should be required for this operation.`)}});function lW(e){return t(e[0])&&t(e[e.length-1])&&(e=e.substring(1,e.length-1)),`"${e}"`;function t(e){return'"'===e||"'"===e}}new lO(()=>{throw new eV.errors.NotImplementedError("Not implemented scenario for getting code format settings when using a writer function. Please open an issue.")});let{InvalidOperationError:lB,FileNotFoundError:lz,ArgumentError:lG,ArgumentNullOrWhitespaceError:lj,ArgumentOutOfRangeError:lK,ArgumentTypeError:lV,BaseError:lU,DirectoryNotFoundError:lH,NotImplementedError:lq,NotSupportedError:lJ,PathNotFoundError:l$}=eV.errors;Object.defineProperty(t,"SyntaxKind",{enumerable:!0,get:function(){return eV.SyntaxKind}}),t.Project=class{_context;constructor(e={}){if(null!=e.fileSystem&&e.useInMemoryFileSystem)throw new eV.errors.InvalidOperationError("Cannot provide a file system when specifying to use an in-memory file system.");let t=e.useInMemoryFileSystem?new eV.InMemoryFileSystemHost:e.fileSystem??new eV.RealFileSystemHost,n=new eV.TransactionalFileSystem({fileSystem:t,skipLoadingLibFiles:e.skipLoadingLibFiles,libFolderPath:e.libFolderPath}),r=null==e.tsConfigFilePath?void 0:new eV.TsConfigResolver(n,n.getStandardizedAbsolutePath(e.tsConfigFilePath),function(){let t="utf-8";return null!=e.compilerOptions?e.compilerOptions.charset??t:t}()),i={...r?.getCompilerOptions()??{},...e.compilerOptions??{}},o=new eV.CompilerOptionsContainer(e.defaultCompilerOptions);o.set(i),this._context=new lF({project:this,compilerOptionsContainer:o,fileSystemWrapper:n,createLanguageService:!0,resolutionHost:e.resolutionHost,configFileParsingDiagnostics:r?.getErrors()??[],skipLoadingLibFiles:e.skipLoadingLibFiles,libFolderPath:e.libFolderPath}),null!=e.manipulationSettings&&this._context.manipulationSettings.set(e.manipulationSettings),null!=r&&!0!==e.skipAddingFilesFromTsConfig&&(this.#n5(r,i),e.skipFileDependencyResolution||this.resolveSourceFileDependencies())}get manipulationSettings(){return this._context.manipulationSettings}get compilerOptions(){return this._context.compilerOptions}resolveSourceFileDependencies(){let e=new Set,t=t=>e.add(t),{compilerFactory:n,inProjectCoordinator:r}=this._context;n.onSourceFileAdded(t);try{this.getProgram().compilerObject}finally{n.onSourceFileAdded(t,!1)}let i=r.markSourceFilesAsInProjectForResolution();for(let t of i.changedSourceFiles)e.add(t);for(let t of i.unchangedSourceFiles)e.delete(t);return Array.from(e.values())}addDirectoryAtPathIfExists(e,t={}){return this._context.directoryCoordinator.addDirectoryAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(e),{...t,markInProject:!0})}addDirectoryAtPath(e,t={}){return this._context.directoryCoordinator.addDirectoryAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(e),{...t,markInProject:!0})}createDirectory(e){return this._context.directoryCoordinator.createDirectoryOrAddIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(e),{markInProject:!0})}getDirectoryOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getDirectory(e),t??(()=>`Could not find a directory at the specified path: ${this._context.fileSystemWrapper.getStandardizedAbsolutePath(e)}`))}getDirectory(e){let{compilerFactory:t}=this._context;return t.getDirectoryFromCache(this._context.fileSystemWrapper.getStandardizedAbsolutePath(e))}getDirectories(){return Array.from(this.#n7())}getRootDirectories(){let{inProjectCoordinator:e}=this._context,t=[];for(let n of this._context.compilerFactory.getOrphanDirectories())for(let r of function* t(n){if(e.isDirectoryInProject(n))return void(yield n);for(let e of n._getDirectoriesIterator())yield*t(e)}(n))t.push(r);return t}addSourceFilesAtPaths(e){return this._context.directoryCoordinator.addSourceFilesAtPaths(e,{markInProject:!0})}addSourceFileAtPathIfExists(e){return this._context.directoryCoordinator.addSourceFileAtPathIfExists(this._context.fileSystemWrapper.getStandardizedAbsolutePath(e),{markInProject:!0})}addSourceFileAtPath(e){return this._context.directoryCoordinator.addSourceFileAtPath(this._context.fileSystemWrapper.getStandardizedAbsolutePath(e),{markInProject:!0})}addSourceFilesFromTsConfig(e){let t=new eV.TsConfigResolver(this._context.fileSystemWrapper,this._context.fileSystemWrapper.getStandardizedAbsolutePath(e),this._context.getEncoding());return this.#n5(t,t.getCompilerOptions())}#n5(e,t){let n=e.getPaths(t),r=n.filePaths.map(e=>this.addSourceFileAtPath(e));for(let e of n.directoryPaths)this.addDirectoryAtPathIfExists(e);return r}createSourceFile(e,t,n){return this._context.compilerFactory.createSourceFile(this._context.fileSystemWrapper.getStandardizedAbsolutePath(e),t??"",{...n??{},markInProject:!0})}removeSourceFile(e){let t=e.wasForgotten();return e.forget(),!t}getSourceFileOrThrow(e){let t=this.getSourceFile(e);if(null!=t)return t;if("string"==typeof e){let t=eV.FileUtils.standardizeSlashes(e);if(eV.FileUtils.pathIsAbsolute(t)||t.indexOf("/")>=0){let e=this._context.fileSystemWrapper.getStandardizedAbsolutePath(t);throw new eV.errors.InvalidOperationError(`Could not find source file in project at the provided path: ${e}`)}throw new eV.errors.InvalidOperationError(`Could not find source file in project with the provided file name: ${e}`)}throw new eV.errors.InvalidOperationError("Could not find source file in project based on the provided condition.")}getSourceFile(e){let t=function(t){if(e instanceof Function)return e;let n=eV.FileUtils.standardizeSlashes(e);return eV.FileUtils.pathIsAbsolute(n)||n.indexOf("/")>=0?t.getStandardizedAbsolutePath(n):e=>eV.FileUtils.pathEndsWith(e.getFilePath(),n)}(this._context.fileSystemWrapper);return"string"==typeof t?this._context.compilerFactory.getSourceFileFromCacheFromFilePath(t):eV.IterableUtils.find(this.#n9(),t)}getSourceFiles(e){let{compilerFactory:t,fileSystemWrapper:n}=this._context,r=this.#n9();return"string"==typeof e||e instanceof Array?Array.from(function*(){let i=Array.from(function*(){for(let e of r)yield e.getFilePath()}());for(let r of eV.matchGlobs(i,e,n.getCurrentDirectory()))yield t.getSourceFileFromCacheFromFilePath(n.getStandardizedAbsolutePath(r))}()):Array.from(r)}*#n9(){let{compilerFactory:e,inProjectCoordinator:t}=this._context;for(let n of e.getSourceFilesByDirectoryDepth())t.isSourceFileInProject(n)&&(yield n)}*#n7(){let{compilerFactory:e,inProjectCoordinator:t}=this._context;for(let n of e.getDirectoriesByDepth())t.isDirectoryInProject(n)&&(yield n)}getAmbientModule(e){return e=lW(e),this.getAmbientModules().find(t=>t.getName()===e)}getAmbientModuleOrThrow(e,t){return eV.errors.throwIfNullOrUndefined(this.getAmbientModule(e),t??(()=>`Could not find ambient module with name: ${lW(e)}`))}getAmbientModules(){return this.getTypeChecker().getAmbientModules()}async save(){await this._context.fileSystemWrapper.flush(),await Promise.all(this.#re().map(e=>e.save()))}saveSync(){for(let e of(this._context.fileSystemWrapper.flushSync(),this.#re()))e.saveSync()}enableLogging(e=!0){this._context.logger.setEnabled(e)}#re(){return Array.from(function*(e){for(let t of e)t.isSaved()||(yield t)}(this._context.compilerFactory.getSourceFilesByDirectoryDepth()))}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(e={}){return this._context.program.emit(e)}emitSync(e={}){return this._context.program.emitSync(e)}emitToMemory(e={}){return this._context.program.emitToMemory(e)}getCompilerOptions(){return this._context.compilerOptions.get()}getConfigFileParsingDiagnostics(){return this.getProgram().getConfigFileParsingDiagnostics()}createWriter(){return this._context.createWriter()}forgetNodesCreatedInBlock(e){return this._context.compilerFactory.forgetNodesCreatedInBlock(e)}formatDiagnosticsWithColorAndContext(e,t={}){return eV.ts.formatDiagnosticsWithColorAndContext(e.map(e=>e.compilerObject),{getCurrentDirectory:()=>this._context.fileSystemWrapper.getCurrentDirectory(),getCanonicalFileName:e=>e,getNewLine:()=>t.newLineChar??eV.runtime.getEndOfLine()})}getModuleResolutionHost(){return this._context.getModuleResolutionHost()}}},6113:function(e){"use strict";e.exports=i(117)},2361:function(e){"use strict";e.exports=i(178)},7147:function(e){"use strict";e.exports=i(727)},1405:function(e){"use strict";e.exports=i(181)},7561:function(e){"use strict";e.exports=i(561)},3977:function(e){"use strict";e.exports=i(977)},612:function(e){"use strict";e.exports=i(612)},9411:function(e){"use strict";e.exports=i(411)},2037:function(e){"use strict";e.exports=i(445)},1017:function(e){"use strict";e.exports=i(403)},4074:function(e){"use strict";e.exports=i(511)},2781:function(e){"use strict";e.exports=i(290)},3837:function(e){"use strict";e.exports=i(871)},3198:function(e,t,n){"use strict";var r,i;Object.defineProperty(t,"__esModule",{value:!0});let o=n(6393);(i=r||(r={}))[i.Line=0]="Line",i[i.Star=1]="Star";let a={BACK_SLASH:92,FORWARD_SLASH:47,NEW_LINE:10,CARRIAGE_RETURN:13,ASTERISK:42,DOUBLE_QUOTE:34,SINGLE_QUOTE:39,BACK_TICK:96,OPEN_BRACE:123,CLOSE_BRACE:125,DOLLAR_SIGN:36,SPACE:32,TAB:9},s=new Set([a.BACK_SLASH,a.FORWARD_SLASH,a.NEW_LINE,a.CARRIAGE_RETURN,a.ASTERISK,a.DOUBLE_QUOTE,a.SINGLE_QUOTE,a.BACK_TICK,a.OPEN_BRACE,a.CLOSE_BRACE]);class l{constructor(e={}){var t,n;Object.defineProperty(this,"_indentationText",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_newLine",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_useTabs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_quoteChar",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_indentNumberOfSpaces",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_currentIndentation",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_queuedIndentation",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_queuedOnlyIfNotBlock",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_length",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_newLineOnNextWrite",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_currentCommentChar",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_stringCharStack",{enumerable:!0,configurable:!0,writable:!0,value:[]}),Object.defineProperty(this,"_isInRegEx",{enumerable:!0,configurable:!0,writable:!0,value:!1}),Object.defineProperty(this,"_isOnFirstLineOfBlock",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"_texts",{enumerable:!0,configurable:!0,writable:!0,value:[]}),this._newLine=e.newLine||"\n",this._useTabs=e.useTabs||!1,this._indentNumberOfSpaces=e.indentNumberOfSpaces||4,this._indentationText=(t=this._useTabs,n=this._indentNumberOfSpaces,t?" ":Array(n+1).join(" ")),this._quoteChar=e.useSingleQuote?"'":'"'}getOptions(){return{indentNumberOfSpaces:this._indentNumberOfSpaces,newLine:this._newLine,useTabs:this._useTabs,useSingleQuote:"'"===this._quoteChar}}queueIndentationLevel(e){return this._queuedIndentation=this._getIndentationLevelFromArg(e),this._queuedOnlyIfNotBlock=void 0,this}hangingIndent(e){return this._withResetIndentation(()=>this.queueIndentationLevel(this.getIndentationLevel()+1),e)}hangingIndentUnlessBlock(e){return this._withResetIndentation(()=>{this.queueIndentationLevel(this.getIndentationLevel()+1),this._queuedOnlyIfNotBlock=!0},e)}setIndentationLevel(e){return this._currentIndentation=this._getIndentationLevelFromArg(e),this}withIndentationLevel(e,t){return this._withResetIndentation(()=>this.setIndentationLevel(e),t)}_withResetIndentation(e,t){let n=this._getIndentationState();e();try{t()}finally{this._setIndentationState(n)}return this}getIndentationLevel(){return this._currentIndentation}block(e){return this._newLineIfNewLineOnNextWrite(),this.getLength()>0&&!this.isLastNewLine()&&this.spaceIfLastNot(),this.inlineBlock(e),this._newLineOnNextWrite=!0,this}inlineBlock(e){return this._newLineIfNewLineOnNextWrite(),this.write("{"),this._indentBlockInternal(e),this.newLineIfLastNot().write("}"),this}indent(e=1){return"number"==typeof e?(this._newLineIfNewLineOnNextWrite(),this.write(this._indentationText.repeat(e))):(this._indentBlockInternal(e),this.isLastNewLine()||(this._newLineOnNextWrite=!0),this)}_indentBlockInternal(e){null!=this.getLastChar()&&this.newLineIfLastNot(),this._currentIndentation++,this._isOnFirstLineOfBlock=!0,null!=e&&e(),this._isOnFirstLineOfBlock=!1,this._currentIndentation=Math.max(0,this._currentIndentation-1)}conditionalWriteLine(e,t){return e&&this.writeLine((0,o.getStringFromStrOrFunc)(t)),this}writeLine(e){return this._newLineIfNewLineOnNextWrite(),null!=this.getLastChar()&&this.newLineIfLastNot(),this._writeIndentingNewLines(e),this.newLine(),this}newLineIfLastNot(){return this._newLineIfNewLineOnNextWrite(),this.isLastNewLine()||this.newLine(),this}blankLineIfLastNot(){return this.isLastBlankLine()||this.blankLine(),this}conditionalBlankLine(e){return e&&this.blankLine(),this}blankLine(){return this.newLineIfLastNot().newLine()}conditionalNewLine(e){return e&&this.newLine(),this}newLine(){return this._newLineOnNextWrite=!1,this._baseWriteNewline(),this}quote(e){return this._newLineIfNewLineOnNextWrite(),this._writeIndentingNewLines(null==e?this._quoteChar:this._quoteChar+(0,o.escapeForWithinString)(e,this._quoteChar)+this._quoteChar),this}spaceIfLastNot(){return this._newLineIfNewLineOnNextWrite(),this.isLastSpace()||this._writeIndentingNewLines(" "),this}space(e=1){return this._newLineIfNewLineOnNextWrite(),this._writeIndentingNewLines(" ".repeat(e)),this}tabIfLastNot(){return this._newLineIfNewLineOnNextWrite(),this.isLastTab()||this._writeIndentingNewLines(" "),this}tab(e=1){return this._newLineIfNewLineOnNextWrite(),this._writeIndentingNewLines(" ".repeat(e)),this}conditionalWrite(e,t){return e&&this.write((0,o.getStringFromStrOrFunc)(t)),this}write(e){return this._newLineIfNewLineOnNextWrite(),this._writeIndentingNewLines(e),this}closeComment(){switch(this._currentCommentChar){case r.Line:this.newLine();break;case r.Star:this.isLastNewLine()||this.spaceIfLastNot(),this.write("*/")}return this}unsafeInsert(e,t){let n=this._length,r=this._texts;return(function(){if(e<0)throw Error(`Provided position of '${e}' was less than zero.`);if(e>n)throw Error(`Provided position of '${e}' was greater than the text length of '${n}'.`)}(),e===n)?this.write(t):(function(){let{index:i,localIndex:o}=function(){if(e<n/2){let t=0;for(let n=0;n<r.length;n++){let i=r[n],o=t;if((t+=i.length)>=e)return{index:n,localIndex:e-o}}}else{let t=n;for(let n=r.length-1;n>=0;n--)if((t-=r[n].length)<=e)return{index:n,localIndex:e-t}}throw Error("Unhandled situation inserting. This should never happen.")}();if(0===o)r.splice(i,0,t);else if(o===r[i].length)r.splice(i+1,0,t);else{let e=r[i],n=e.substring(0,o),a=e.substring(o);r.splice(i,1,n,t,a)}}(),this._length+=t.length,this)}getLength(){return this._length}isInComment(){return void 0!==this._currentCommentChar}isAtStartOfFirstLineOfBlock(){return this.isOnFirstLineOfBlock()&&(this.isLastNewLine()||null==this.getLastChar())}isOnFirstLineOfBlock(){return this._isOnFirstLineOfBlock}isInString(){return this._stringCharStack.length>0&&this._stringCharStack[this._stringCharStack.length-1]!==a.OPEN_BRACE}isLastNewLine(){let e=this.getLastChar();return"\n"===e||"\r"===e}isLastBlankLine(){let e=0;for(let t=this._texts.length-1;t>=0;t--){let n=this._texts[t];for(let t=n.length-1;t>=0;t--){let r=n.charCodeAt(t);if(r===a.NEW_LINE){if(2==++e)return!0}else if(r!==a.CARRIAGE_RETURN)return!1}}return!1}isLastSpace(){return" "===this.getLastChar()}isLastTab(){return" "===this.getLastChar()}getLastChar(){let e=this._getLastCharCodeWithOffset(0);return null==e?void 0:String.fromCharCode(e)}endsWith(e){let t=this._length;return this.iterateLastCharCodes((n,r)=>{let i=e.length-(t-r);return e.charCodeAt(i)===n&&(0===i||void 0)})||!1}iterateLastChars(e){return this.iterateLastCharCodes((t,n)=>e(String.fromCharCode(t),n))}iterateLastCharCodes(e){let t=this._length;for(let n=this._texts.length-1;n>=0;n--){let r=this._texts[n];for(let n=r.length-1;n>=0;n--){t--;let i=e(r.charCodeAt(n),t);if(null!=i)return i}}}toString(){if(this._texts.length>1){let e=this._texts.join("");this._texts.length=0,this._texts.push(e)}return this._texts[0]||""}_writeIndentingNewLines(e){if(0===(e=e||"").length)return void t(this,"");function t(e,t){!e.isInString()&&(e.isLastNewLine()||null==e.getLastChar())&&e._writeIndentation(),e._updateInternalState(t),e._internalWrite(t)}e.split(l._newLineRegEx).forEach((e,n)=>{n>0&&this._baseWriteNewline(),0!==e.length&&t(this,e)})}_baseWriteNewline(){this._currentCommentChar===r.Line&&(this._currentCommentChar=void 0);let e=this._stringCharStack[this._stringCharStack.length-1];(e===a.DOUBLE_QUOTE||e===a.SINGLE_QUOTE)&&this._getLastCharCodeWithOffset(0)!==a.BACK_SLASH&&this._stringCharStack.pop(),this._internalWrite(this._newLine),this._isOnFirstLineOfBlock=!1,this._dequeueQueuedIndentation()}_dequeueQueuedIndentation(){var e;let t;null!=this._queuedIndentation&&(this._queuedOnlyIfNotBlock&&(e=this,t=!1,e.iterateLastCharCodes(e=>{switch(e){case a.NEW_LINE:if(t)return!1;t=!0;break;case a.CARRIAGE_RETURN:return;case a.OPEN_BRACE:return!0;default:return!1}}))?(this._queuedIndentation=void 0,this._queuedOnlyIfNotBlock=void 0):(this._currentIndentation=this._queuedIndentation,this._queuedIndentation=void 0))}_updateInternalState(e){for(let o=0;o<e.length;o++){let l=e.charCodeAt(o);if(!s.has(l))continue;let c=0===o?this._getLastCharCodeWithOffset(0):e.charCodeAt(o-1),d=0===o?this._getLastCharCodeWithOffset(1):1===o?this._getLastCharCodeWithOffset(0):e.charCodeAt(o-2);if(this._isInRegEx)if((c!==a.FORWARD_SLASH||d===a.BACK_SLASH)&&c!==a.NEW_LINE)continue;else this._isInRegEx=!1;else{var t,n,i;if(!this.isInString()&&!this.isInComment()&&(t=l,n=c,i=d,n===a.FORWARD_SLASH&&t!==a.FORWARD_SLASH&&t!==a.ASTERISK&&i!==a.ASTERISK&&i!==a.FORWARD_SLASH)){this._isInRegEx=!0;continue}}if(this.isInString()||(null==this._currentCommentChar&&c===a.FORWARD_SLASH&&l===a.FORWARD_SLASH?this._currentCommentChar=r.Line:null==this._currentCommentChar&&c===a.FORWARD_SLASH&&l===a.ASTERISK?this._currentCommentChar=r.Star:this._currentCommentChar===r.Star&&c===a.ASTERISK&&l===a.FORWARD_SLASH&&(this._currentCommentChar=void 0)),this.isInComment())continue;let u=0===this._stringCharStack.length?void 0:this._stringCharStack[this._stringCharStack.length-1];c!==a.BACK_SLASH&&(l===a.DOUBLE_QUOTE||l===a.SINGLE_QUOTE||l===a.BACK_TICK)?u===l?this._stringCharStack.pop():(u===a.OPEN_BRACE||void 0===u)&&this._stringCharStack.push(l):d!==a.BACK_SLASH&&c===a.DOLLAR_SIGN&&l===a.OPEN_BRACE&&u===a.BACK_TICK?this._stringCharStack.push(l):l===a.CLOSE_BRACE&&u===a.OPEN_BRACE&&this._stringCharStack.pop()}}_getLastCharCodeWithOffset(e){if(!(e>=this._length)&&!(e<0))for(let t=this._texts.length-1;t>=0;t--){let n=this._texts[t];if(!(e>=n.length))return n.charCodeAt(n.length-1-e);e-=n.length}}_writeIndentation(){let e=Math.floor(this._currentIndentation);this._internalWrite(this._indentationText.repeat(e));let t=this._currentIndentation-e;if(this._useTabs)t>.5&&this._internalWrite(this._indentationText);else{let e=Math.round(this._indentationText.length*t),n="";for(let t=0;t<e;t++)n+=this._indentationText[t];this._internalWrite(n)}}_newLineIfNewLineOnNextWrite(){this._newLineOnNextWrite&&(this._newLineOnNextWrite=!1,this.newLine())}_internalWrite(e){0!==e.length&&(this._texts.push(e),this._length+=e.length)}_getIndentationLevelFromArg(e){if("number"==typeof e){if(e<0)throw Error("Passed in indentation level should be greater than or equal to 0.");return e}if("string"==typeof e){if(!l._spacesOrTabsRegEx.test(e))throw Error("Provided string must be empty or only contain spaces or tabs.");let{spacesCount:t,tabsCount:n}=function(e){let t=0,n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i===a.SPACE?t++:i===a.TAB&&n++}return{spacesCount:t,tabsCount:n}}(e);return n+t/this._indentNumberOfSpaces}throw Error("Argument provided must be a string or number.")}_setIndentationState(e){this._currentIndentation=e.current,this._queuedIndentation=e.queued,this._queuedOnlyIfNotBlock=e.queuedOnlyIfNotBlock}_getIndentationState(){return{current:this._currentIndentation,queued:this._queuedIndentation,queuedOnlyIfNotBlock:this._queuedOnlyIfNotBlock}}}Object.defineProperty(l,"_newLineRegEx",{enumerable:!0,configurable:!0,writable:!0,value:/\r?\n/}),Object.defineProperty(l,"_spacesOrTabsRegEx",{enumerable:!0,configurable:!0,writable:!0,value:/^[ \t]*$/}),t.default=l},6393:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getStringFromStrOrFunc=t.escapeForWithinString=void 0,t.escapeForWithinString=function(e,t){let n="";for(let r=0;r<e.length;r++)e[r]===t?n+="\\":"\r"===e[r]&&"\n"===e[r+1]?(n+="\\r\\n\\",r++):"\n"===e[r]?n+="\\n\\":"\\"===e[r]&&(n+="\\"),n+=e[r];return n},t.getStringFromStrOrFunc=function(e){return e instanceof Function?e():e}},5913:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.assertValidPattern=void 0,t.assertValidPattern=e=>{if("string"!=typeof e)throw TypeError("invalid pattern");if(e.length>65536)throw TypeError("pattern is too long")}},9910:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AST=void 0;let r=n(71),i=n(810),o=new Set(["!","?","+","*","@"]),a=e=>o.has(e),s="(?!\\.)",l=new Set(["[","."]),c=new Set(["..","."]),d=new Set("().*{}+?[]^$\\!"),u=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),p="[^/]",f=p+"*?",m=p+"+?";class _{type;#rt;#rn;#rr=!1;#ri=[];#D;#ro;#ra;#rs=!1;#tT;#rl;#rc=!1;constructor(e,t,n={}){this.type=e,e&&(this.#rn=!0),this.#D=t,this.#rt=this.#D?this.#D.#rt:this,this.#tT=this.#rt===this?n:this.#rt.#tT,this.#ra=this.#rt===this?[]:this.#rt.#ra,"!"!==e||this.#rt.#rs||this.#ra.push(this),this.#ro=this.#D?this.#D.#ri.length:0}get hasMagic(){if(void 0!==this.#rn)return this.#rn;for(let e of this.#ri)if("string"!=typeof e&&(e.type||e.hasMagic))return this.#rn=!0;return this.#rn}toString(){return void 0!==this.#rl?this.#rl:this.type?this.#rl=this.type+"("+this.#ri.map(e=>String(e)).join("|")+")":this.#rl=this.#ri.map(e=>String(e)).join("")}#rd(){let e;if(this!==this.#rt)throw Error("should only call on root");if(this.#rs)return this;for(this.toString(),this.#rs=!0;e=this.#ra.pop();){if("!"!==e.type)continue;let t=e,n=t.#D;for(;n;){for(let r=t.#ro+1;!n.type&&r<n.#ri.length;r++)for(let t of e.#ri){if("string"==typeof t)throw Error("string part in extglob AST??");t.copyIn(n.#ri[r])}n=(t=n).#D}}return this}push(...e){for(let t of e)if(""!==t){if("string"!=typeof t&&!(t instanceof _&&t.#D===this))throw Error("invalid part: "+t);this.#ri.push(t)}}toJSON(){let e=null===this.type?this.#ri.slice().map(e=>"string"==typeof e?e:e.toJSON()):[this.type,...this.#ri.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#rt||this.#rt.#rs&&this.#D?.type==="!")&&e.push({}),e}isStart(){if(this.#rt===this)return!0;if(!this.#D?.isStart())return!1;if(0===this.#ro)return!0;let e=this.#D;for(let t=0;t<this.#ro;t++){let n=e.#ri[t];if(!(n instanceof _&&"!"===n.type))return!1}return!0}isEnd(){if(this.#rt===this||this.#D?.type==="!")return!0;if(!this.#D?.isEnd())return!1;if(!this.type)return this.#D?.isEnd();let e=this.#D?this.#D.#ri.length:0;return this.#ro===e-1}copyIn(e){"string"==typeof e?this.push(e):this.push(e.clone(this))}clone(e){let t=new _(this.type,e);for(let e of this.#ri)t.copyIn(e);return t}static #ru(e,t,n,r){let i=!1,o=!1,s=-1,l=!1;if(null===t.type){let c=n,d="";for(;c<e.length;){let n=e.charAt(c++);if(i||"\\"===n){i=!i,d+=n;continue}if(o){c===s+1?("^"===n||"!"===n)&&(l=!0):"]"!==n||c===s+2&&l||(o=!1),d+=n;continue}if("["===n){o=!0,s=c,l=!1,d+=n;continue}if(!r.noext&&a(n)&&"("===e.charAt(c)){t.push(d),d="";let i=new _(n,t);c=_.#ru(e,i,c,r),t.push(i);continue}d+=n}return t.push(d),c}let c=n+1,d=new _(null,t),u=[],p="";for(;c<e.length;){let n=e.charAt(c++);if(i||"\\"===n){i=!i,p+=n;continue}if(o){c===s+1?("^"===n||"!"===n)&&(l=!0):"]"!==n||c===s+2&&l||(o=!1),p+=n;continue}if("["===n){o=!0,s=c,l=!1,p+=n;continue}if(a(n)&&"("===e.charAt(c)){d.push(p),p="";let t=new _(n,d);d.push(t),c=_.#ru(e,t,c,r);continue}if("|"===n){d.push(p),p="",u.push(d),d=new _(null,t);continue}if(")"===n)return""===p&&0===t.#ri.length&&(t.#rc=!0),d.push(p),p="",t.push(...u,d),c;p+=n}return t.type=null,t.#rn=void 0,t.#ri=[e.substring(n-1)],c}static fromGlob(e,t={}){let n=new _(null,void 0,t);return _.#ru(e,n,0,t),n}toMMPattern(){if(this!==this.#rt)return this.#rt.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();return r||this.#rn||this.#tT.nocase&&!this.#tT.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()?Object.assign(RegExp(`^${t}$`,(this.#tT.nocase?"i":"")+(i?"u":"")),{_src:t,_glob:e}):n}get options(){return this.#tT}toRegExpSource(e){let t=e??!!this.#tT.dot;if(this.#rt===this&&this.#rd(),!this.type){let n=this.isStart()&&this.isEnd(),r=this.#ri.map(t=>{let[r,i,o,a]="string"==typeof t?_.#rp(t,this.#rn,n):t.toRegExpSource(e);return this.#rn=this.#rn||o,this.#rr=this.#rr||a,r}).join(""),o="";if(this.isStart()&&"string"==typeof this.#ri[0]&&!(1===this.#ri.length&&c.has(this.#ri[0]))){let n=t&&l.has(r.charAt(0))||r.startsWith("\\.")&&l.has(r.charAt(2))||r.startsWith("\\.\\.")&&l.has(r.charAt(4)),i=!t&&!e&&l.has(r.charAt(0));o=n?"(?!(?:^|/)\\.\\.?(?:$|/))":i?s:""}let a="";return this.isEnd()&&this.#rt.#rs&&this.#D?.type==="!"&&(a="(?:$|\\/)"),[o+r+a,(0,i.unescape)(r),this.#rn=!!this.#rn,this.#rr]}let n="*"===this.type||"+"===this.type,r="!"===this.type?"(?:(?!(?:":"(?:",o=this.#rf(t);if(this.isStart()&&this.isEnd()&&!o&&"!"!==this.type){let e=this.toString();return this.#ri=[e],this.type=null,this.#rn=void 0,[e,(0,i.unescape)(this.toString()),!1,!1]}let a=!n||e||t||!s?"":this.#rf(!0);a===o&&(a=""),a&&(o=`(?:${o})(?:${a})*?`);let d="";return["!"===this.type&&this.#rc?(this.isStart()&&!t?s:"")+m:r+o+("!"===this.type?"))"+(!this.isStart()||t||e?"":s)+f+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&a?")":"*"===this.type&&a?")?":`)${this.type}`),(0,i.unescape)(o),this.#rn=!!this.#rn,this.#rr]}#rf(e){return this.#ri.map(t=>{if("string"==typeof t)throw Error("string type in extglob ast??");let[n,r,i,o]=t.toRegExpSource(e);return this.#rr=this.#rr||o,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static #rp(e,t,n=!1){let o=!1,a="",s=!1;for(let i=0;i<e.length;i++){let l=e.charAt(i);if(o){o=!1,a+=(d.has(l)?"\\":"")+l;continue}if("\\"===l){i===e.length-1?a+="\\\\":o=!0;continue}if("["===l){let[n,o,l,c]=(0,r.parseClass)(e,i);if(l){a+=n,s=s||o,i+=l-1,t=t||c;continue}}if("*"===l){n&&"*"===e?a+=m:a+=f,t=!0;continue}if("?"===l){a+=p,t=!0;continue}a+=u(l)}return[a,(0,i.unescape)(e),!!t,s]}}t.AST=_},71:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.parseClass=void 0;let n={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},r=e=>e.replace(/[[\]\\-]/g,"\\$&"),i=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),o=e=>e.join("");t.parseClass=(e,t)=>{if("["!==e.charAt(t))throw Error("not in a brace expression");let a=[],s=[],l=t+1,c=!1,d=!1,u=!1,p=!1,f=t,m="";s:for(;l<e.length;){let i=e.charAt(l);if(("!"===i||"^"===i)&&l===t+1){p=!0,l++;continue}if("]"===i&&c&&!u){f=l+1;break}if(c=!0,"\\"===i&&!u){u=!0,l++;continue}if("["===i&&!u){for(let[r,[i,o,c]]of Object.entries(n))if(e.startsWith(r,l)){if(m)return["$.",!1,e.length-t,!0];l+=r.length,c?s.push(i):a.push(i),d=d||o;continue s}}if(u=!1,m){i>m?a.push(r(m)+"-"+r(i)):i===m&&a.push(r(i)),m="",l++;continue}if(e.startsWith("-]",l+1)){a.push(r(i+"-")),l+=2;continue}if(e.startsWith("-",l+1)){m=i,l+=2;continue}a.push(r(i)),l++}if(f<l)return["",!1,0,!1];if(!a.length&&!s.length)return["$.",!1,e.length-t,!0];if(0===s.length&&1===a.length&&/^\\?.$/.test(a[0])&&!p)return[i(2===a[0].length?a[0].slice(-1):a[0]),!1,f-t,!1];let _="["+(p?"^":"")+o(a)+"]",h="["+(p?"":"^")+o(s)+"]";return[a.length&&s.length?"("+_+"|"+h+")":a.length?_:h,d,f-t,!0]}},1737:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.escape=void 0,t.escape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&")},3781:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.unescape=t.escape=t.AST=t.Minimatch=t.match=t.makeRe=t.braceExpand=t.defaults=t.filter=t.GLOBSTAR=t.sep=t.minimatch=void 0;let i=r(n(3644)),o=n(5913),a=n(9910),s=n(1737),l=n(810);t.minimatch=(e,t,n={})=>((0,o.assertValidPattern)(t),(!!n.nocomment||"#"!==t.charAt(0))&&new L(t,n).match(e));let c=/^\*+([^+@!?\*\[\(]*)$/,d=e=>t=>!t.startsWith(".")&&t.endsWith(e),u=e=>t=>t.endsWith(e),p=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),f=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),m=/^\*+\.\*+$/,_=e=>!e.startsWith(".")&&e.includes("."),h=e=>"."!==e&&".."!==e&&e.includes("."),g=/^\.\*+$/,y=e=>"."!==e&&".."!==e&&e.startsWith("."),b=/^\*+$/,x=e=>0!==e.length&&!e.startsWith("."),S=e=>0!==e.length&&"."!==e&&".."!==e,E=/^\?+([^+@!?\*\[\(]*)?$/,T=([e,t=""])=>{let n=I([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},A=([e,t=""])=>{let n=N([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},D=([e,t=""])=>{let n=N([e]);return t?e=>n(e)&&e.endsWith(t):n},C=([e,t=""])=>{let n=I([e]);return t?e=>n(e)&&e.endsWith(t):n},I=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(".")},N=([e])=>{let t=e.length;return e=>e.length===t&&"."!==e&&".."!==e},P="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",R={win32:{sep:"\\"},posix:{sep:"/"}};t.sep="win32"===P?R.win32.sep:R.posix.sep,t.minimatch.sep=t.sep,t.GLOBSTAR=Symbol("globstar **"),t.minimatch.GLOBSTAR=t.GLOBSTAR;t.filter=(e,n={})=>r=>(0,t.minimatch)(r,e,n),t.minimatch.filter=t.filter;let M=(e,t={})=>Object.assign({},e,t);t.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return t.minimatch;let n=t.minimatch;return Object.assign((t,r,i={})=>n(t,r,M(e,i)),{Minimatch:class extends n.Minimatch{constructor(t,n={}){super(t,M(e,n))}static defaults(t){return n.defaults(M(e,t)).Minimatch}},AST:class extends n.AST{constructor(t,n,r={}){super(t,n,M(e,r))}static fromGlob(t,r={}){return n.AST.fromGlob(t,M(e,r))}},unescape:(t,r={})=>n.unescape(t,M(e,r)),escape:(t,r={})=>n.escape(t,M(e,r)),filter:(t,r={})=>n.filter(t,M(e,r)),defaults:t=>n.defaults(M(e,t)),makeRe:(t,r={})=>n.makeRe(t,M(e,r)),braceExpand:(t,r={})=>n.braceExpand(t,M(e,r)),match:(t,r,i={})=>n.match(t,r,M(e,i)),sep:n.sep,GLOBSTAR:t.GLOBSTAR})},t.minimatch.defaults=t.defaults,t.braceExpand=(e,t={})=>((0,o.assertValidPattern)(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e))?[e]:(0,i.default)(e),t.minimatch.braceExpand=t.braceExpand,t.makeRe=(e,t={})=>new L(e,t).makeRe(),t.minimatch.makeRe=t.makeRe,t.match=(e,t,n={})=>{let r=new L(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e},t.minimatch.match=t.match;let k=/[?*]|[+@!]\(.*?\)|\[|\]/,w=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class L{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){(0,o.assertValidPattern)(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||P,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==t.windowsNoMagicRoot?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if("string"!=typeof t)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0)){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=""===e[0]&&""===e[1]&&("?"===e[2]||!k.test(e[2]))&&!k.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>-1===e.indexOf(!1)),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];""===t[0]&&""===t[1]&&"?"===this.globParts[e][2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3])&&(t[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)"**"===e[t][n]&&(e[t][n]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;-1!==(t=e.indexOf("**",t+1));){let n=t;for(;"**"===e[n+1];)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>0===(e=e.reduce((e,t)=>{let n=e[e.length-1];return"**"===t&&"**"===n||(".."===t&&n&&".."!==n&&"."!==n&&"**"!==n?e.pop():e.push(t)),e},[])).length?[""]:e)}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];(1!==n||""!==r||""!==e[0])&&("."===r||""===r)&&(t=!0,e.splice(n,1),n--)}"."===e[0]&&2===e.length&&("."===e[1]||""===e[1])&&(t=!0,e.pop())}let n=0;for(;-1!==(n=e.indexOf("..",n+1));){let r=e[n-1];r&&"."!==r&&".."!==r&&"**"!==r&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return 0===e.length?[""]:e}firstPhasePreProcess(e){let t=!1;do for(let n of(t=!1,e)){let r=-1;for(;-1!==(r=n.indexOf("**",r+1));){let i=r;for(;"**"===n[i+1];)i++;i>r&&n.splice(r+1,i-r);let o=n[r+1],a=n[r+2],s=n[r+3];if(".."!==o||!a||"."===a||".."===a||!s||"."===s||".."===s)continue;t=!0,n.splice(r,1);let l=n.slice(0);l[r]="**",e.push(l),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];(1!==e||""!==r||""!==n[0])&&("."===r||""===r)&&(t=!0,n.splice(e,1),e--)}"."===n[0]&&2===n.length&&("."===n[1]||""===n[1])&&(t=!0,n.pop())}let i=0;for(;-1!==(i=n.indexOf("..",i+1));){let e=n[i-1];if(e&&"."!==e&&".."!==e&&"**"!==e){t=!0;let e=1===i&&"**"===n[i+1]?["."]:[];n.splice(i-1,2,...e),0===n.length&&n.push(""),i-=2}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,o=[],a="";for(;r<e.length&&i<t.length;)if(e[r]===t[i])o.push("b"===a?t[i]:e[r]),r++,i++;else if(n&&"**"===e[r]&&t[i]===e[r+1])o.push(e[r]),r++;else if(n&&"**"===t[i]&&e[r]===t[i+1])o.push(t[i]),i++;else if("*"===e[r]&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&"**"!==t[i]){if("b"===a)return!1;a="a",o.push(e[r]),r++,i++}else{if("*"!==t[i]||!e[r]||!this.options.dot&&e[r].startsWith(".")||"**"===e[r]||"a"===a)return!1;a="b",o.push(t[i]),r++,i++}return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&"!"===e.charAt(r);r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,n,r=!1){let i=this.options;if(this.isWindows){let t="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),r=!t&&""===e[0]&&""===e[1]&&"?"===e[2]&&/^[a-z]:$/i.test(e[3]),i="string"==typeof n[0]&&/^[a-z]:$/i.test(n[0]),o=!i&&""===n[0]&&""===n[1]&&"?"===n[2]&&"string"==typeof n[3]&&/^[a-z]:$/i.test(n[3]),a=r?3:t?0:void 0,s=o?3:i?0:void 0;if("number"==typeof a&&"number"==typeof s){let[t,r]=[e[a],n[s]];t.toLowerCase()===r.toLowerCase()&&(n[s]=t,s>a?n=n.slice(s):a>s&&(e=e.slice(a)))}}let{optimizationLevel:o=1}=this.options;o>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:n}),this.debug("matchOne",e.length,n.length);for(var a=0,s=0,l=e.length,c=n.length;a<l&&s<c;a++,s++){let o;this.debug("matchOne loop");var d=n[s],u=e[a];if(this.debug(n,d,u),!1===d)return!1;if(d===t.GLOBSTAR){this.debug("GLOBSTAR",[n,d,u]);var p=a,f=s+1;if(f===c){for(this.debug("** at the end");a<l;a++)if("."===e[a]||".."===e[a]||!i.dot&&"."===e[a].charAt(0))return!1;return!0}for(;p<l;){var m=e[p];if(this.debug("\nglobstar while",e,p,n,f,m),this.matchOne(e.slice(p),n.slice(f),r))return this.debug("globstar found match!",p,l,m),!0;if("."===m||".."===m||!i.dot&&"."===m.charAt(0)){this.debug("dot detected!",e,p,n,f);break}this.debug("globstar swallow a segment, and continue"),p++}if(r&&(this.debug("\n>>> no match, partial?",e,p,n,f),p===l))return!0;return!1}if("string"==typeof d?(o=u===d,this.debug("string match",d,u,o)):(o=d.test(u),this.debug("pattern match",d,u,o)),!o)return!1}if(a===l&&s===c)return!0;if(a===l)return r;if(s===c)return a===l-1&&""===e[a];throw Error("wtf?")}braceExpand(){return(0,t.braceExpand)(this.pattern,this.options)}parse(e){let n;(0,o.assertValidPattern)(e);let r=this.options;if("**"===e)return t.GLOBSTAR;if(""===e)return"";let i=null;(n=e.match(b))?i=r.dot?S:x:(n=e.match(c))?i=(r.nocase?r.dot?f:p:r.dot?u:d)(n[1]):(n=e.match(E))?i=(r.nocase?r.dot?A:T:r.dot?D:C)(n):(n=e.match(m))?i=r.dot?h:_:(n=e.match(g))&&(i=y);let s=a.AST.fromGlob(e,this.options).toMMPattern();return i&&"object"==typeof s&&Reflect.defineProperty(s,"test",{value:i}),s}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let n=this.options,r=n.noglobstar?"[^/]*?":n.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",i=new Set(n.nocase?["i"]:[]),o=e.map(e=>{let n=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(""))i.add(t);return"string"==typeof e?w(e):e===t.GLOBSTAR?t.GLOBSTAR:e._src});return n.forEach((e,i)=>{let o=n[i+1],a=n[i-1];e===t.GLOBSTAR&&a!==t.GLOBSTAR&&(void 0===a?void 0!==o&&o!==t.GLOBSTAR?n[i+1]="(?:\\/|"+r+"\\/)?"+o:n[i]=r:void 0===o?n[i-1]=a+"(?:\\/|"+r+")?":o!==t.GLOBSTAR&&(n[i-1]=a+"(?:\\/|\\/"+r+"\\/)"+o,n[i+1]=t.GLOBSTAR))}),n.filter(e=>e!==t.GLOBSTAR).join("/")}).join("|"),[a,s]=e.length>1?["(?:",")"]:["",""];o="^"+a+o+s+"$",this.negate&&(o="^(?!"+o+").+$");try{this.regexp=new RegExp(o,[...i].join(""))}catch(e){this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let r=this.slashSplit(e);this.debug(this.pattern,"split",r);let i=this.set;this.debug(this.pattern,"set",i);let o=r[r.length-1];if(!o)for(let e=r.length-2;!o&&e>=0;e--)o=r[e];for(let e=0;e<i.length;e++){let a=i[e],s=r;if(n.matchBase&&1===a.length&&(s=[o]),this.matchOne(s,a,t)){if(n.flipNegate)return!0;return!this.negate}}return!n.flipNegate&&this.negate}static defaults(e){return t.minimatch.defaults(e).Minimatch}}t.Minimatch=L;var O=n(9910);Object.defineProperty(t,"AST",{enumerable:!0,get:function(){return O.AST}});var F=n(1737);Object.defineProperty(t,"escape",{enumerable:!0,get:function(){return F.escape}});var W=n(810);Object.defineProperty(t,"unescape",{enumerable:!0,get:function(){return W.unescape}}),t.minimatch.AST=a.AST,t.minimatch.Minimatch=L,t.minimatch.escape=s.escape,t.minimatch.unescape=l.unescape},810:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.unescape=void 0,t.unescape=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1")}},c={};function d(e){var t=c[e];if(void 0!==t)return t.exports;var n=c[e]={id:e,loaded:!1,exports:{}};return l[e].call(n.exports,n,n.exports,d),n.loaded=!0,n.exports}d.m=l,d.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return d.d(t,{a:t}),t},t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,d.t=function(n,r){if(1&r&&(n=this(n)),8&r||"object"==typeof n&&n&&(4&r&&n.__esModule||16&r&&"function"==typeof n.then))return n;var i=Object.create(null);d.r(i);var o={};e=e||[null,t({}),t([]),t(t)];for(var a=2&r&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach(e=>{o[e]=()=>n[e]});return o.default=()=>n,d.d(i,o),i},d.d=(e,t)=>{for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.f={},d.e=e=>Promise.all(Object.keys(d.f).reduce((t,n)=>(d.f[n](e,t),t),[])),d.u=e=>""+e+".js",d.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),d.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),n={909:1},s=e=>{var t=e.modules,r=e.ids,i=e.runtime;for(var o in t)d.o(t,o)&&(d.m[o]=t[o]);i&&i(d);for(var a=0;a<r.length;a++)n[r[a]]=1},d.f.require=(e,t)=>{n[e]||s(i(880)("./"+d.u(e)))};var u={};for(var p in(()=>{"use strict";d.r(u),d.d(u,{Transformers:()=>t,Analyzers:()=>e});var e={};d.r(e),d.d(e,{analyzeAngularComponentUsage:()=>nM,analyzeComponentUsage:()=>nk,analyzeRawColorUsage:()=>nR,countColorOccurrences:()=>nw});var t={};d.r(t),d.d(t,{transformComponentUsage:()=>nL,transformRawColorUsage:()=>nO});let n=i(292);var r=d(1017),o=d.n(r),a=d(7147),s=d(3644);let l=e=>{if("string"!=typeof e)throw TypeError("invalid pattern");if(e.length>65536)throw TypeError("pattern is too long")},c={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},p=e=>e.replace(/[[\]\\-]/g,"\\$&"),f=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),m=e=>e.join(""),_=(e,t)=>{if("["!==e.charAt(t))throw Error("not in a brace expression");let n=[],r=[],i=t+1,o=!1,a=!1,s=!1,l=!1,d=t,u="";s:for(;i<e.length;){let f=e.charAt(i);if(("!"===f||"^"===f)&&i===t+1){l=!0,i++;continue}if("]"===f&&o&&!s){d=i+1;break}if(o=!0,"\\"===f&&!s){s=!0,i++;continue}if("["===f&&!s){for(let[o,[s,l,d]]of Object.entries(c))if(e.startsWith(o,i)){if(u)return["$.",!1,e.length-t,!0];i+=o.length,d?r.push(s):n.push(s),a=a||l;continue s}}if(s=!1,u){f>u?n.push(p(u)+"-"+p(f)):f===u&&n.push(p(f)),u="",i++;continue}if(e.startsWith("-]",i+1)){n.push(p(f+"-")),i+=2;continue}if(e.startsWith("-",i+1)){u=f,i+=2;continue}n.push(p(f)),i++}if(d<i)return["",!1,0,!1];if(!n.length&&!r.length)return["$.",!1,e.length-t,!0];if(0===r.length&&1===n.length&&/^\\?.$/.test(n[0])&&!l)return[f(2===n[0].length?n[0].slice(-1):n[0]),!1,d-t,!1];let _="["+(l?"^":"")+m(n)+"]",h="["+(l?"":"^")+m(r)+"]";return[n.length&&r.length?"("+_+"|"+h+")":n.length?_:h,a,d-t,!0]},h=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/\[([^\/\\])\]/g,"$1"):e.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1"),g=new Set(["!","?","+","*","@"]),y=e=>g.has(e),b="(?!\\.)",x=new Set(["[","."]),S=new Set(["..","."]),E=new Set("().*{}+?[]^$\\!"),T=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),A="[^/]",D=A+"*?",C=A+"+?";class I{type;#rt;#rn;#rr=!1;#ri=[];#D;#ro;#ra;#rs=!1;#tT;#rl;#rc=!1;constructor(e,t,n={}){this.type=e,e&&(this.#rn=!0),this.#D=t,this.#rt=this.#D?this.#D.#rt:this,this.#tT=this.#rt===this?n:this.#rt.#tT,this.#ra=this.#rt===this?[]:this.#rt.#ra,"!"!==e||this.#rt.#rs||this.#ra.push(this),this.#ro=this.#D?this.#D.#ri.length:0}get hasMagic(){if(void 0!==this.#rn)return this.#rn;for(let e of this.#ri)if("string"!=typeof e&&(e.type||e.hasMagic))return this.#rn=!0;return this.#rn}toString(){return void 0!==this.#rl?this.#rl:this.type?this.#rl=this.type+"("+this.#ri.map(e=>String(e)).join("|")+")":this.#rl=this.#ri.map(e=>String(e)).join("")}#rd(){let e;if(this!==this.#rt)throw Error("should only call on root");if(this.#rs)return this;for(this.toString(),this.#rs=!0;e=this.#ra.pop();){if("!"!==e.type)continue;let t=e,n=t.#D;for(;n;){for(let r=t.#ro+1;!n.type&&r<n.#ri.length;r++)for(let t of e.#ri){if("string"==typeof t)throw Error("string part in extglob AST??");t.copyIn(n.#ri[r])}n=(t=n).#D}}return this}push(...e){for(let t of e)if(""!==t){if("string"!=typeof t&&!(t instanceof I&&t.#D===this))throw Error("invalid part: "+t);this.#ri.push(t)}}toJSON(){let e=null===this.type?this.#ri.slice().map(e=>"string"==typeof e?e:e.toJSON()):[this.type,...this.#ri.map(e=>e.toJSON())];return this.isStart()&&!this.type&&e.unshift([]),this.isEnd()&&(this===this.#rt||this.#rt.#rs&&this.#D?.type==="!")&&e.push({}),e}isStart(){if(this.#rt===this)return!0;if(!this.#D?.isStart())return!1;if(0===this.#ro)return!0;let e=this.#D;for(let t=0;t<this.#ro;t++){let n=e.#ri[t];if(!(n instanceof I&&"!"===n.type))return!1}return!0}isEnd(){if(this.#rt===this||this.#D?.type==="!")return!0;if(!this.#D?.isEnd())return!1;if(!this.type)return this.#D?.isEnd();let e=this.#D?this.#D.#ri.length:0;return this.#ro===e-1}copyIn(e){"string"==typeof e?this.push(e):this.push(e.clone(this))}clone(e){let t=new I(this.type,e);for(let e of this.#ri)t.copyIn(e);return t}static #ru(e,t,n,r){let i=!1,o=!1,a=-1,s=!1;if(null===t.type){let l=n,c="";for(;l<e.length;){let n=e.charAt(l++);if(i||"\\"===n){i=!i,c+=n;continue}if(o){l===a+1?("^"===n||"!"===n)&&(s=!0):"]"!==n||l===a+2&&s||(o=!1),c+=n;continue}if("["===n){o=!0,a=l,s=!1,c+=n;continue}if(!r.noext&&y(n)&&"("===e.charAt(l)){t.push(c),c="";let i=new I(n,t);l=I.#ru(e,i,l,r),t.push(i);continue}c+=n}return t.push(c),l}let l=n+1,c=new I(null,t),d=[],u="";for(;l<e.length;){let n=e.charAt(l++);if(i||"\\"===n){i=!i,u+=n;continue}if(o){l===a+1?("^"===n||"!"===n)&&(s=!0):"]"!==n||l===a+2&&s||(o=!1),u+=n;continue}if("["===n){o=!0,a=l,s=!1,u+=n;continue}if(y(n)&&"("===e.charAt(l)){c.push(u),u="";let t=new I(n,c);c.push(t),l=I.#ru(e,t,l,r);continue}if("|"===n){c.push(u),u="",d.push(c),c=new I(null,t);continue}if(")"===n)return""===u&&0===t.#ri.length&&(t.#rc=!0),c.push(u),u="",t.push(...d,c),l;u+=n}return t.type=null,t.#rn=void 0,t.#ri=[e.substring(n-1)],l}static fromGlob(e,t={}){let n=new I(null,void 0,t);return I.#ru(e,n,0,t),n}toMMPattern(){if(this!==this.#rt)return this.#rt.toMMPattern();let e=this.toString(),[t,n,r,i]=this.toRegExpSource();return r||this.#rn||this.#tT.nocase&&!this.#tT.nocaseMagicOnly&&e.toUpperCase()!==e.toLowerCase()?Object.assign(RegExp(`^${t}$`,(this.#tT.nocase?"i":"")+(i?"u":"")),{_src:t,_glob:e}):n}get options(){return this.#tT}toRegExpSource(e){let t=e??!!this.#tT.dot;if(this.#rt===this&&this.#rd(),!this.type){let n=this.isStart()&&this.isEnd(),r=this.#ri.map(t=>{let[r,i,o,a]="string"==typeof t?I.#rp(t,this.#rn,n):t.toRegExpSource(e);return this.#rn=this.#rn||o,this.#rr=this.#rr||a,r}).join(""),i="";if(this.isStart()&&"string"==typeof this.#ri[0]&&!(1===this.#ri.length&&S.has(this.#ri[0]))){let n=t&&x.has(r.charAt(0))||r.startsWith("\\.")&&x.has(r.charAt(2))||r.startsWith("\\.\\.")&&x.has(r.charAt(4)),o=!t&&!e&&x.has(r.charAt(0));i=n?"(?!(?:^|/)\\.\\.?(?:$|/))":o?b:""}let o="";return this.isEnd()&&this.#rt.#rs&&this.#D?.type==="!"&&(o="(?:$|\\/)"),[i+r+o,h(r),this.#rn=!!this.#rn,this.#rr]}let n="*"===this.type||"+"===this.type,r="!"===this.type?"(?:(?!(?:":"(?:",i=this.#rf(t);if(this.isStart()&&this.isEnd()&&!i&&"!"!==this.type){let e=this.toString();return this.#ri=[e],this.type=null,this.#rn=void 0,[e,h(this.toString()),!1,!1]}let o=!n||e||t||!b?"":this.#rf(!0);o===i&&(o=""),o&&(i=`(?:${i})(?:${o})*?`);let a="";return["!"===this.type&&this.#rc?(this.isStart()&&!t?b:"")+C:r+i+("!"===this.type?"))"+(!this.isStart()||t||e?"":b)+D+")":"@"===this.type?")":"?"===this.type?")?":"+"===this.type&&o?")":"*"===this.type&&o?")?":`)${this.type}`),h(i),this.#rn=!!this.#rn,this.#rr]}#rf(e){return this.#ri.map(t=>{if("string"==typeof t)throw Error("string type in extglob ast??");let[n,r,i,o]=t.toRegExpSource(e);return this.#rr=this.#rr||o,n}).filter(e=>!(this.isStart()&&this.isEnd())||!!e).join("|")}static #rp(e,t,n=!1){let r=!1,i="",o=!1;for(let a=0;a<e.length;a++){let s=e.charAt(a);if(r){r=!1,i+=(E.has(s)?"\\":"")+s;continue}if("\\"===s){a===e.length-1?i+="\\\\":r=!0;continue}if("["===s){let[n,r,s,l]=_(e,a);if(s){i+=n,o=o||r,a+=s-1,t=t||l;continue}}if("*"===s){n&&"*"===e?i+=C:i+=D,t=!0;continue}if("?"===s){i+=A,t=!0;continue}i+=T(s)}return[i,h(e),!!t,o]}}let N=(e,{windowsPathsNoEscape:t=!1}={})=>t?e.replace(/[?*()[\]]/g,"[$&]"):e.replace(/[?*()[\]\\]/g,"\\$&"),P=(e,t,n={})=>(l(t),(!!n.nocomment||"#"!==t.charAt(0))&&new eo(t,n).match(e)),R=/^\*+([^+@!?\*\[\(]*)$/,M=e=>t=>!t.startsWith(".")&&t.endsWith(e),k=e=>t=>t.endsWith(e),w=e=>(e=e.toLowerCase(),t=>!t.startsWith(".")&&t.toLowerCase().endsWith(e)),L=e=>(e=e.toLowerCase(),t=>t.toLowerCase().endsWith(e)),O=/^\*+\.\*+$/,F=e=>!e.startsWith(".")&&e.includes("."),W=e=>"."!==e&&".."!==e&&e.includes("."),B=/^\.\*+$/,z=e=>"."!==e&&".."!==e&&e.startsWith("."),G=/^\*+$/,j=e=>0!==e.length&&!e.startsWith("."),K=e=>0!==e.length&&"."!==e&&".."!==e,V=/^\?+([^+@!?\*\[\(]*)?$/,U=([e,t=""])=>{let n=$([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},H=([e,t=""])=>{let n=X([e]);return t?(t=t.toLowerCase(),e=>n(e)&&e.toLowerCase().endsWith(t)):n},q=([e,t=""])=>{let n=X([e]);return t?e=>n(e)&&e.endsWith(t):n},J=([e,t=""])=>{let n=$([e]);return t?e=>n(e)&&e.endsWith(t):n},$=([e])=>{let t=e.length;return e=>e.length===t&&!e.startsWith(".")},X=([e])=>{let t=e.length;return e=>e.length===t&&"."!==e&&".."!==e},Y="object"==typeof process&&process?"object"==typeof process.env&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",Q={win32:{sep:"\\"},posix:{sep:"/"}};P.sep="win32"===Y?Q.win32.sep:Q.posix.sep;let Z=Symbol("globstar **");P.GLOBSTAR=Z;let ee="[^/]*?";P.filter=(e,t={})=>n=>P(n,e,t);let et=(e,t={})=>Object.assign({},e,t);P.defaults=e=>{if(!e||"object"!=typeof e||!Object.keys(e).length)return P;let t=P;return Object.assign((n,r,i={})=>t(n,r,et(e,i)),{Minimatch:class extends t.Minimatch{constructor(t,n={}){super(t,et(e,n))}static defaults(n){return t.defaults(et(e,n)).Minimatch}},AST:class extends t.AST{constructor(t,n,r={}){super(t,n,et(e,r))}static fromGlob(n,r={}){return t.AST.fromGlob(n,et(e,r))}},unescape:(n,r={})=>t.unescape(n,et(e,r)),escape:(n,r={})=>t.escape(n,et(e,r)),filter:(n,r={})=>t.filter(n,et(e,r)),defaults:n=>t.defaults(et(e,n)),makeRe:(n,r={})=>t.makeRe(n,et(e,r)),braceExpand:(n,r={})=>t.braceExpand(n,et(e,r)),match:(n,r,i={})=>t.match(n,r,et(e,i)),sep:t.sep,GLOBSTAR:Z})};let en=(e,t={})=>(l(e),t.nobrace||!/\{(?:(?!\{).)*\}/.test(e))?[e]:s(e);P.braceExpand=en,P.makeRe=(e,t={})=>new eo(e,t).makeRe(),P.match=(e,t,n={})=>{let r=new eo(t,n);return e=e.filter(e=>r.match(e)),r.options.nonull&&!e.length&&e.push(t),e};let er=/[?*]|[+@!]\(.*?\)|\[|\]/,ei=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class eo{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(e,t={}){l(e),t=t||{},this.options=t,this.pattern=e,this.platform=t.platform||Y,this.isWindows="win32"===this.platform,this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(this.pattern=this.pattern.replace(/\\/g,"/")),this.preserveMultipleSlashes=!!t.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!t.nonegate,this.comment=!1,this.empty=!1,this.partial=!!t.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=void 0!==t.windowsNoMagicRoot?t.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let e of this.set)for(let t of e)if("string"!=typeof t)return!0;return!1}debug(...e){}make(){let e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0)){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],t.debug&&(this.debug=(...e)=>console.error(...e)),this.debug(this.pattern,this.globSet);let n=this.globSet.map(e=>this.slashSplit(e));this.globParts=this.preprocess(n),this.debug(this.pattern,this.globParts);let r=this.globParts.map((e,t,n)=>{if(this.isWindows&&this.windowsNoMagicRoot){let t=""===e[0]&&""===e[1]&&("?"===e[2]||!er.test(e[2]))&&!er.test(e[3]),n=/^[a-z]:/i.test(e[0]);if(t)return[...e.slice(0,4),...e.slice(4).map(e=>this.parse(e))];if(n)return[e[0],...e.slice(1).map(e=>this.parse(e))]}return e.map(e=>this.parse(e))});if(this.debug(this.pattern,r),this.set=r.filter(e=>-1===e.indexOf(!1)),this.isWindows)for(let e=0;e<this.set.length;e++){let t=this.set[e];""===t[0]&&""===t[1]&&"?"===this.globParts[e][2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3])&&(t[2]="?")}this.debug(this.pattern,this.set)}preprocess(e){if(this.options.noglobstar)for(let t=0;t<e.length;t++)for(let n=0;n<e[t].length;n++)"**"===e[t][n]&&(e[t][n]="*");let{optimizationLevel:t=1}=this.options;return t>=2?(e=this.firstPhasePreProcess(e),e=this.secondPhasePreProcess(e)):e=t>=1?this.levelOneOptimize(e):this.adjascentGlobstarOptimize(e),e}adjascentGlobstarOptimize(e){return e.map(e=>{let t=-1;for(;-1!==(t=e.indexOf("**",t+1));){let n=t;for(;"**"===e[n+1];)n++;n!==t&&e.splice(t,n-t)}return e})}levelOneOptimize(e){return e.map(e=>0===(e=e.reduce((e,t)=>{let n=e[e.length-1];return"**"===t&&"**"===n||(".."===t&&n&&".."!==n&&"."!==n&&"**"!==n?e.pop():e.push(t)),e},[])).length?[""]:e)}levelTwoFileOptimize(e){Array.isArray(e)||(e=this.slashSplit(e));let t=!1;do{if(t=!1,!this.preserveMultipleSlashes){for(let n=1;n<e.length-1;n++){let r=e[n];(1!==n||""!==r||""!==e[0])&&("."===r||""===r)&&(t=!0,e.splice(n,1),n--)}"."===e[0]&&2===e.length&&("."===e[1]||""===e[1])&&(t=!0,e.pop())}let n=0;for(;-1!==(n=e.indexOf("..",n+1));){let r=e[n-1];r&&"."!==r&&".."!==r&&"**"!==r&&(t=!0,e.splice(n-1,2),n-=2)}}while(t);return 0===e.length?[""]:e}firstPhasePreProcess(e){let t=!1;do for(let n of(t=!1,e)){let r=-1;for(;-1!==(r=n.indexOf("**",r+1));){let i=r;for(;"**"===n[i+1];)i++;i>r&&n.splice(r+1,i-r);let o=n[r+1],a=n[r+2],s=n[r+3];if(".."!==o||!a||"."===a||".."===a||!s||"."===s||".."===s)continue;t=!0,n.splice(r,1);let l=n.slice(0);l[r]="**",e.push(l),r--}if(!this.preserveMultipleSlashes){for(let e=1;e<n.length-1;e++){let r=n[e];(1!==e||""!==r||""!==n[0])&&("."===r||""===r)&&(t=!0,n.splice(e,1),e--)}"."===n[0]&&2===n.length&&("."===n[1]||""===n[1])&&(t=!0,n.pop())}let i=0;for(;-1!==(i=n.indexOf("..",i+1));){let e=n[i-1];if(e&&"."!==e&&".."!==e&&"**"!==e){t=!0;let e=1===i&&"**"===n[i+1]?["."]:[];n.splice(i-1,2,...e),0===n.length&&n.push(""),i-=2}}}while(t);return e}secondPhasePreProcess(e){for(let t=0;t<e.length-1;t++)for(let n=t+1;n<e.length;n++){let r=this.partsMatch(e[t],e[n],!this.preserveMultipleSlashes);if(r){e[t]=[],e[n]=r;break}}return e.filter(e=>e.length)}partsMatch(e,t,n=!1){let r=0,i=0,o=[],a="";for(;r<e.length&&i<t.length;)if(e[r]===t[i])o.push("b"===a?t[i]:e[r]),r++,i++;else if(n&&"**"===e[r]&&t[i]===e[r+1])o.push(e[r]),r++;else if(n&&"**"===t[i]&&e[r]===t[i+1])o.push(t[i]),i++;else if("*"===e[r]&&t[i]&&(this.options.dot||!t[i].startsWith("."))&&"**"!==t[i]){if("b"===a)return!1;a="a",o.push(e[r]),r++,i++}else{if("*"!==t[i]||!e[r]||!this.options.dot&&e[r].startsWith(".")||"**"===e[r]||"a"===a)return!1;a="b",o.push(t[i]),r++,i++}return e.length===t.length&&o}parseNegate(){if(this.nonegate)return;let e=this.pattern,t=!1,n=0;for(let r=0;r<e.length&&"!"===e.charAt(r);r++)t=!t,n++;n&&(this.pattern=e.slice(n)),this.negate=t}matchOne(e,t,n=!1){let r=this.options;if(this.isWindows){let n="string"==typeof e[0]&&/^[a-z]:$/i.test(e[0]),r=!n&&""===e[0]&&""===e[1]&&"?"===e[2]&&/^[a-z]:$/i.test(e[3]),i="string"==typeof t[0]&&/^[a-z]:$/i.test(t[0]),o=!i&&""===t[0]&&""===t[1]&&"?"===t[2]&&"string"==typeof t[3]&&/^[a-z]:$/i.test(t[3]),a=r?3:n?0:void 0,s=o?3:i?0:void 0;if("number"==typeof a&&"number"==typeof s){let[n,r]=[e[a],t[s]];n.toLowerCase()===r.toLowerCase()&&(t[s]=n,s>a?t=t.slice(s):a>s&&(e=e.slice(a)))}}let{optimizationLevel:i=1}=this.options;i>=2&&(e=this.levelTwoFileOptimize(e)),this.debug("matchOne",this,{file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var o=0,a=0,s=e.length,l=t.length;o<s&&a<l;o++,a++){let i;this.debug("matchOne loop");var c=t[a],d=e[o];if(this.debug(t,c,d),!1===c)return!1;if(c===Z){this.debug("GLOBSTAR",[t,c,d]);var u=o,p=a+1;if(p===l){for(this.debug("** at the end");o<s;o++)if("."===e[o]||".."===e[o]||!r.dot&&"."===e[o].charAt(0))return!1;return!0}for(;u<s;){var f=e[u];if(this.debug("\nglobstar while",e,u,t,p,f),this.matchOne(e.slice(u),t.slice(p),n))return this.debug("globstar found match!",u,s,f),!0;if("."===f||".."===f||!r.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,u,t,p);break}this.debug("globstar swallow a segment, and continue"),u++}if(n&&(this.debug("\n>>> no match, partial?",e,u,t,p),u===s))return!0;return!1}if("string"==typeof c?(i=d===c,this.debug("string match",c,d,i)):(i=c.test(d),this.debug("pattern match",c,d,i)),!i)return!1}if(o===s&&a===l)return!0;if(o===s)return n;if(a===l)return o===s-1&&""===e[o];throw Error("wtf?")}braceExpand(){return en(this.pattern,this.options)}parse(e){let t;l(e);let n=this.options;if("**"===e)return Z;if(""===e)return"";let r=null;(t=e.match(G))?r=n.dot?K:j:(t=e.match(R))?r=(n.nocase?n.dot?L:w:n.dot?k:M)(t[1]):(t=e.match(V))?r=(n.nocase?n.dot?H:U:n.dot?q:J)(t):(t=e.match(O))?r=n.dot?W:F:(t=e.match(B))&&(r=z);let i=I.fromGlob(e,this.options).toMMPattern();return r&&"object"==typeof i&&Reflect.defineProperty(i,"test",{value:r}),i}makeRe(){if(this.regexp||!1===this.regexp)return this.regexp;let e=this.set;if(!e.length)return this.regexp=!1,this.regexp;let t=this.options,n=t.noglobstar?ee:t.dot?"(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?":"(?:(?!(?:\\/|^)\\.).)*?",r=new Set(t.nocase?["i"]:[]),i=e.map(e=>{let t=e.map(e=>{if(e instanceof RegExp)for(let t of e.flags.split(""))r.add(t);return"string"==typeof e?ei(e):e===Z?Z:e._src});return t.forEach((e,r)=>{let i=t[r+1],o=t[r-1];e===Z&&o!==Z&&(void 0===o?void 0!==i&&i!==Z?t[r+1]="(?:\\/|"+n+"\\/)?"+i:t[r]=n:void 0===i?t[r-1]=o+"(?:\\/|"+n+")?":i!==Z&&(t[r-1]=o+"(?:\\/|\\/"+n+"\\/)"+i,t[r+1]=Z))}),t.filter(e=>e!==Z).join("/")}).join("|"),[o,a]=e.length>1?["(?:",")"]:["",""];i="^"+o+i+a+"$",this.negate&&(i="^(?!"+i+").+$");try{this.regexp=new RegExp(i,[...r].join(""))}catch(e){this.regexp=!1}return this.regexp}slashSplit(e){return this.preserveMultipleSlashes?e.split("/"):this.isWindows&&/^\/\/[^\/]+/.test(e)?["",...e.split(/\/+/)]:e.split(/\/+/)}match(e,t=this.partial){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;let n=this.options;this.isWindows&&(e=e.split("\\").join("/"));let r=this.slashSplit(e);this.debug(this.pattern,"split",r);let i=this.set;this.debug(this.pattern,"set",i);let o=r[r.length-1];if(!o)for(let e=r.length-2;!o&&e>=0;e--)o=r[e];for(let e=0;e<i.length;e++){let a=i[e],s=r;if(n.matchBase&&1===a.length&&(s=[o]),this.matchOne(s,a,t)){if(n.flipNegate)return!0;return!this.negate}}return!n.flipNegate&&this.negate}static defaults(e){return P.defaults(e).Minimatch}}P.AST=I,P.Minimatch=eo,P.escape=N,P.unescape=h;let ea=i(41),es="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,el=new Set,ec="object"==typeof process&&process?process:{},ed=(e,t,n,r)=>{"function"==typeof ec.emitWarning?ec.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},eu=globalThis.AbortController,ep=globalThis.AbortSignal;if(void 0===eu){ep=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},eu=class{constructor(){t()}signal=new ep;abort(e){if(!this.signal.aborted){for(let t of(this.signal.reason=e,this.signal.aborted=!0,this.signal._onabort))t(e);this.signal.onabort?.(e)}}};let e=ec.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,ed("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}let ef=e=>!el.has(e);Symbol("type");let em=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),e_=e=>em(e)?e<=256?Uint8Array:e<=65536?Uint16Array:e<=0x100000000?Uint32Array:e<=Number.MAX_SAFE_INTEGER?eh:null:null;class eh extends Array{constructor(e){super(e),this.fill(0)}}class eg{heap;length;static #rm=!1;static create(e){let t=e_(e);if(!t)return[];eg.#rm=!0;let n=new eg(e,t);return eg.#rm=!1,n}constructor(e,t){if(!eg.#rm)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class ey{#r_;#rh;#rg;#ry;#rv;#rb;#rx;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#rS;#rE;#rT;#rA;#rD;#rC;#rI;#rN;#rP;#rR;#rM;#rk;#rw;#rL;#rO;#rF;#rW;#rB;static unsafeExposeInternals(e){return{starts:e.#rw,ttls:e.#rL,sizes:e.#rk,keyMap:e.#rT,keyList:e.#rA,valList:e.#rD,next:e.#rC,prev:e.#rI,get head(){return e.#rN},get tail(){return e.#rP},free:e.#rR,isBackgroundFetch:t=>e.#rz(t),backgroundFetch:(t,n,r,i)=>e.#rG(t,n,r,i),moveToTail:t=>e.#rj(t),indexes:t=>e.#rK(t),rindexes:t=>e.#rV(t),isStale:t=>e.#rU(t)}}get max(){return this.#r_}get maxSize(){return this.#rh}get calculatedSize(){return this.#rE}get size(){return this.#rS}get fetchMethod(){return this.#rb}get memoMethod(){return this.#rx}get dispose(){return this.#rg}get onInsert(){return this.#ry}get disposeAfter(){return this.#rv}constructor(e){let{max:t=0,ttl:n,ttlResolution:r=1,ttlAutopurge:i,updateAgeOnGet:o,updateAgeOnHas:a,allowStale:s,dispose:l,onInsert:c,disposeAfter:d,noDisposeOnSet:u,noUpdateTTL:p,maxSize:f=0,maxEntrySize:m=0,sizeCalculation:_,fetchMethod:h,memoMethod:g,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:b,allowStaleOnFetchRejection:x,allowStaleOnFetchAbort:S,ignoreFetchAbort:E}=e;if(0!==t&&!em(t))throw TypeError("max option must be a nonnegative integer");let T=t?e_(t):Array;if(!T)throw Error("invalid max value: "+t);if(this.#r_=t,this.#rh=f,this.maxEntrySize=m||this.#rh,this.sizeCalculation=_,this.sizeCalculation){if(!this.#rh&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw TypeError("sizeCalculation set to non-function")}if(void 0!==g&&"function"!=typeof g)throw TypeError("memoMethod must be a function if defined");if(this.#rx=g,void 0!==h&&"function"!=typeof h)throw TypeError("fetchMethod must be a function if specified");if(this.#rb=h,this.#rF=!!h,this.#rT=new Map,this.#rA=Array(t).fill(void 0),this.#rD=Array(t).fill(void 0),this.#rC=new T(t),this.#rI=new T(t),this.#rN=0,this.#rP=0,this.#rR=eg.create(t),this.#rS=0,this.#rE=0,"function"==typeof l&&(this.#rg=l),"function"==typeof c&&(this.#ry=c),"function"==typeof d?(this.#rv=d,this.#rM=[]):(this.#rv=void 0,this.#rM=void 0),this.#rO=!!this.#rg,this.#rB=!!this.#ry,this.#rW=!!this.#rv,this.noDisposeOnSet=!!u,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!y,this.allowStaleOnFetchRejection=!!x,this.allowStaleOnFetchAbort=!!S,this.ignoreFetchAbort=!!E,0!==this.maxEntrySize){if(0!==this.#rh&&!em(this.#rh))throw TypeError("maxSize must be a positive integer if specified");if(!em(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#rH()}if(this.allowStale=!!s,this.noDeleteOnStaleGet=!!b,this.updateAgeOnGet=!!o,this.updateAgeOnHas=!!a,this.ttlResolution=em(r)||0===r?r:1,this.ttlAutopurge=!!i,this.ttl=n||0,this.ttl){if(!em(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#rq()}if(0===this.#r_&&0===this.ttl&&0===this.#rh)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#r_&&!this.#rh){let e="LRU_CACHE_UNBOUNDED";ef(e)&&(el.add(e),ed("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,ey))}}getRemainingTTL(e){return this.#rT.has(e)?1/0:0}#rq(){let e=new eh(this.#r_),t=new eh(this.#r_);this.#rL=e,this.#rw=t,this.#rJ=(n,r,i=es.now())=>{if(t[n]=0!==r?i:0,e[n]=r,0!==r&&this.ttlAutopurge){let e=setTimeout(()=>{this.#rU(n)&&this.#r$(this.#rA[n],"expire")},r+1);e.unref&&e.unref()}},this.#rX=n=>{t[n]=0!==e[n]?es.now():0},this.#rY=(i,o)=>{if(e[o]){let a=e[o],s=t[o];if(!a||!s)return;i.ttl=a,i.start=s,i.now=n||r();let l=i.now-s;i.remainingTTL=a-l}};let n=0,r=()=>{let e=es.now();if(this.ttlResolution>0){n=e;let t=setTimeout(()=>n=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=i=>{let o=this.#rT.get(i);if(void 0===o)return 0;let a=e[o],s=t[o];return a&&s?a-((n||r())-s):1/0},this.#rU=i=>{let o=t[i],a=e[i];return!!a&&!!o&&(n||r())-o>a}}#rX=()=>{};#rY=()=>{};#rJ=()=>{};#rU=()=>!1;#rH(){let e=new eh(this.#r_);this.#rE=0,this.#rk=e,this.#rQ=t=>{this.#rE-=e[t],e[t]=0},this.#rZ=(e,t,n,r)=>{if(this.#rz(t))return 0;if(!em(n))if(r){if("function"!=typeof r)throw TypeError("sizeCalculation must be a function");if(!em(n=r(t,e)))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return n},this.#r0=(t,n,r)=>{if(e[t]=n,this.#rh){let n=this.#rh-e[t];for(;this.#rE>n;)this.#r1(!0)}this.#rE+=e[t],r&&(r.entrySize=n,r.totalCalculatedSize=this.#rE)}}#rQ=e=>{};#r0=(e,t,n)=>{};#rZ=(e,t,n,r)=>{if(n||r)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#rK({allowStale:e=this.allowStale}={}){if(this.#rS)for(let t=this.#rP;this.#r2(t)&&((e||!this.#rU(t))&&(yield t),t!==this.#rN);)t=this.#rI[t]}*#rV({allowStale:e=this.allowStale}={}){if(this.#rS)for(let t=this.#rN;this.#r2(t)&&((e||!this.#rU(t))&&(yield t),t!==this.#rP);)t=this.#rC[t]}#r2(e){return void 0!==e&&this.#rT.get(this.#rA[e])===e}*entries(){for(let e of this.#rK())void 0===this.#rD[e]||void 0===this.#rA[e]||this.#rz(this.#rD[e])||(yield[this.#rA[e],this.#rD[e]])}*rentries(){for(let e of this.#rV())void 0===this.#rD[e]||void 0===this.#rA[e]||this.#rz(this.#rD[e])||(yield[this.#rA[e],this.#rD[e]])}*keys(){for(let e of this.#rK()){let t=this.#rA[e];void 0===t||this.#rz(this.#rD[e])||(yield t)}}*rkeys(){for(let e of this.#rV()){let t=this.#rA[e];void 0===t||this.#rz(this.#rD[e])||(yield t)}}*values(){for(let e of this.#rK())void 0===this.#rD[e]||this.#rz(this.#rD[e])||(yield this.#rD[e])}*rvalues(){for(let e of this.#rV())void 0===this.#rD[e]||this.#rz(this.#rD[e])||(yield this.#rD[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(let n of this.#rK()){let r=this.#rD[n],i=this.#rz(r)?r.__staleWhileFetching:r;if(void 0!==i&&e(i,this.#rA[n],this))return this.get(this.#rA[n],t)}}forEach(e,t=this){for(let n of this.#rK()){let r=this.#rD[n],i=this.#rz(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#rA[n],this)}}rforEach(e,t=this){for(let n of this.#rV()){let r=this.#rD[n],i=this.#rz(r)?r.__staleWhileFetching:r;void 0!==i&&e.call(t,i,this.#rA[n],this)}}purgeStale(){let e=!1;for(let t of this.#rV({allowStale:!0}))this.#rU(t)&&(this.#r$(this.#rA[t],"expire"),e=!0);return e}info(e){let t=this.#rT.get(e);if(void 0===t)return;let n=this.#rD[t],r=this.#rz(n)?n.__staleWhileFetching:n;if(void 0===r)return;let i={value:r};if(this.#rL&&this.#rw){let e=this.#rL[t],n=this.#rw[t];e&&n&&(i.ttl=e-(es.now()-n),i.start=Date.now())}return this.#rk&&(i.size=this.#rk[t]),i}dump(){let e=[];for(let t of this.#rK({allowStale:!0})){let n=this.#rA[t],r=this.#rD[t],i=this.#rz(r)?r.__staleWhileFetching:r;if(void 0===i||void 0===n)continue;let o={value:i};if(this.#rL&&this.#rw){o.ttl=this.#rL[t];let e=es.now()-this.#rw[t];o.start=Math.floor(Date.now()-e)}this.#rk&&(o.size=this.#rk[t]),e.unshift([n,o])}return e}load(e){for(let[t,n]of(this.clear(),e)){if(n.start){let e=Date.now()-n.start;n.start=es.now()-e}this.set(t,n.value,n)}}set(e,t,n={}){if(void 0===t)return this.delete(e),this;let{ttl:r=this.ttl,start:i,noDisposeOnSet:o=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:s}=n,{noUpdateTTL:l=this.noUpdateTTL}=n,c=this.#rZ(e,t,n.size||0,a);if(this.maxEntrySize&&c>this.maxEntrySize)return s&&(s.set="miss",s.maxEntrySizeExceeded=!0),this.#r$(e,"set"),this;let d=0===this.#rS?void 0:this.#rT.get(e);if(void 0===d)d=0===this.#rS?this.#rP:0!==this.#rR.length?this.#rR.pop():this.#rS===this.#r_?this.#r1(!1):this.#rS,this.#rA[d]=e,this.#rD[d]=t,this.#rT.set(e,d),this.#rC[this.#rP]=d,this.#rI[d]=this.#rP,this.#rP=d,this.#rS++,this.#r0(d,c,s),s&&(s.set="add"),l=!1,this.#rB&&this.#ry?.(t,e,"add");else{this.#rj(d);let n=this.#rD[d];if(t!==n){if(this.#rF&&this.#rz(n)){n.__abortController.abort(Error("replaced"));let{__staleWhileFetching:t}=n;void 0!==t&&!o&&(this.#rO&&this.#rg?.(t,e,"set"),this.#rW&&this.#rM?.push([t,e,"set"]))}else!o&&(this.#rO&&this.#rg?.(n,e,"set"),this.#rW&&this.#rM?.push([n,e,"set"]));if(this.#rQ(d),this.#r0(d,c,s),this.#rD[d]=t,s){s.set="replace";let e=n&&this.#rz(n)?n.__staleWhileFetching:n;void 0!==e&&(s.oldValue=e)}}else s&&(s.set="update");this.#rB&&this.onInsert?.(t,e,t===n?"update":"replace")}if(0===r||this.#rL||this.#rq(),this.#rL&&(l||this.#rJ(d,r,i),s&&this.#rY(s,d)),!o&&this.#rW&&this.#rM){let e,t=this.#rM;for(;e=t?.shift();)this.#rv?.(...e)}return this}pop(){try{for(;this.#rS;){let e=this.#rD[this.#rN];if(this.#r1(!0),this.#rz(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#rW&&this.#rM){let e,t=this.#rM;for(;e=t?.shift();)this.#rv?.(...e)}}}#r1(e){let t=this.#rN,n=this.#rA[t],r=this.#rD[t];return this.#rF&&this.#rz(r)?r.__abortController.abort(Error("evicted")):(this.#rO||this.#rW)&&(this.#rO&&this.#rg?.(r,n,"evict"),this.#rW&&this.#rM?.push([r,n,"evict"])),this.#rQ(t),e&&(this.#rA[t]=void 0,this.#rD[t]=void 0,this.#rR.push(t)),1===this.#rS?(this.#rN=this.#rP=0,this.#rR.length=0):this.#rN=this.#rC[t],this.#rT.delete(n),this.#rS--,t}has(e,t={}){let{updateAgeOnHas:n=this.updateAgeOnHas,status:r}=t,i=this.#rT.get(e);if(void 0!==i){let e=this.#rD[i];if(this.#rz(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#rU(i))return n&&this.#rX(i),r&&(r.has="hit",this.#rY(r,i)),!0;r&&(r.has="stale",this.#rY(r,i))}else r&&(r.has="miss");return!1}peek(e,t={}){let{allowStale:n=this.allowStale}=t,r=this.#rT.get(e);if(void 0===r||!n&&this.#rU(r))return;let i=this.#rD[r];return this.#rz(i)?i.__staleWhileFetching:i}#rG(e,t,n,r){let i=void 0===t?void 0:this.#rD[t];if(this.#rz(i))return i;let o=new eu,{signal:a}=n;a?.addEventListener("abort",()=>o.abort(a.reason),{signal:o.signal});let s={signal:o.signal,options:n,context:r},l=(r,i=!1)=>{let{aborted:a}=o.signal,l=n.ignoreFetchAbort&&void 0!==r;return(n.status&&(a&&!i?(n.status.fetchAborted=!0,n.status.fetchError=o.signal.reason,l&&(n.status.fetchAbortIgnored=!0)):n.status.fetchResolved=!0),!a||l||i)?(this.#rD[t]===d&&(void 0===r?d.__staleWhileFetching?this.#rD[t]=d.__staleWhileFetching:this.#r$(e,"fetch"):(n.status&&(n.status.fetchUpdated=!0),this.set(e,r,s.options))),r):c(o.signal.reason)},c=r=>{let{aborted:i}=o.signal,a=i&&n.allowStaleOnFetchAbort,s=a||n.allowStaleOnFetchRejection,l=s||n.noDeleteOnFetchRejection;if(this.#rD[t]===d&&(l&&void 0!==d.__staleWhileFetching?a||(this.#rD[t]=d.__staleWhileFetching):this.#r$(e,"fetch")),s)return n.status&&void 0!==d.__staleWhileFetching&&(n.status.returnedStale=!0),d.__staleWhileFetching;if(d.__returned===d)throw r};n.status&&(n.status.fetchDispatched=!0);let d=new Promise((t,r)=>{let a=this.#rb?.(e,i,s);a&&a instanceof Promise&&a.then(e=>t(void 0===e?void 0:e),r),o.signal.addEventListener("abort",()=>{(!n.ignoreFetchAbort||n.allowStaleOnFetchAbort)&&(t(void 0),n.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})}).then(l,e=>(n.status&&(n.status.fetchRejected=!0,n.status.fetchError=e),c(e))),u=Object.assign(d,{__abortController:o,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,u,{...s.options,status:void 0}),t=this.#rT.get(e)):this.#rD[t]=u,u}#rz(e){return!!this.#rF&&!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof eu}async fetch(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,ttl:o=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:s=0,sizeCalculation:l=this.sizeCalculation,noUpdateTTL:c=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:f=this.allowStaleOnFetchAbort,context:m,forceRefresh:_=!1,status:h,signal:g}=t;if(!this.#rF)return h&&(h.fetch="get"),this.get(e,{allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,status:h});let y={allowStale:n,updateAgeOnGet:r,noDeleteOnStaleGet:i,ttl:o,noDisposeOnSet:a,size:s,sizeCalculation:l,noUpdateTTL:c,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:f,ignoreFetchAbort:p,status:h,signal:g},b=this.#rT.get(e);if(void 0===b){h&&(h.fetch="miss");let t=this.#rG(e,b,y,m);return t.__returned=t}{let t=this.#rD[b];if(this.#rz(t)){let e=n&&void 0!==t.__staleWhileFetching;return h&&(h.fetch="inflight",e&&(h.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}let i=this.#rU(b);if(!_&&!i)return h&&(h.fetch="hit"),this.#rj(b),r&&this.#rX(b),h&&this.#rY(h,b),t;let o=this.#rG(e,b,y,m),a=void 0!==o.__staleWhileFetching&&n;return h&&(h.fetch=i?"stale":"refresh",a&&i&&(h.returnedStale=!0)),a?o.__staleWhileFetching:o.__returned=o}}async forceFetch(e,t={}){let n=await this.fetch(e,t);if(void 0===n)throw Error("fetch() returned undefined");return n}memo(e,t={}){let n=this.#rx;if(!n)throw Error("no memoMethod provided to constructor");let{context:r,forceRefresh:i,...o}=t,a=this.get(e,o);if(!i&&void 0!==a)return a;let s=n(e,a,{options:o,context:r});return this.set(e,s,o),s}get(e,t={}){let{allowStale:n=this.allowStale,updateAgeOnGet:r=this.updateAgeOnGet,noDeleteOnStaleGet:i=this.noDeleteOnStaleGet,status:o}=t,a=this.#rT.get(e);if(void 0!==a){let t=this.#rD[a],s=this.#rz(t);return(o&&this.#rY(o,a),this.#rU(a))?(o&&(o.get="stale"),s)?(o&&n&&void 0!==t.__staleWhileFetching&&(o.returnedStale=!0),n?t.__staleWhileFetching:void 0):(i||this.#r$(e,"expire"),o&&n&&(o.returnedStale=!0),n?t:void 0):(o&&(o.get="hit"),s)?t.__staleWhileFetching:(this.#rj(a),r&&this.#rX(a),t)}o&&(o.get="miss")}#r8(e,t){this.#rI[t]=e,this.#rC[e]=t}#rj(e){e!==this.#rP&&(e===this.#rN?this.#rN=this.#rC[e]:this.#r8(this.#rI[e],this.#rC[e]),this.#r8(this.#rP,e),this.#rP=e)}delete(e){return this.#r$(e,"delete")}#r$(e,t){let n=!1;if(0!==this.#rS){let r=this.#rT.get(e);if(void 0!==r)if(n=!0,1===this.#rS)this.#r3(t);else{this.#rQ(r);let n=this.#rD[r];if(this.#rz(n)?n.__abortController.abort(Error("deleted")):(this.#rO||this.#rW)&&(this.#rO&&this.#rg?.(n,e,t),this.#rW&&this.#rM?.push([n,e,t])),this.#rT.delete(e),this.#rA[r]=void 0,this.#rD[r]=void 0,r===this.#rP)this.#rP=this.#rI[r];else if(r===this.#rN)this.#rN=this.#rC[r];else{let e=this.#rI[r];this.#rC[e]=this.#rC[r];let t=this.#rC[r];this.#rI[t]=this.#rI[r]}this.#rS--,this.#rR.push(r)}}if(this.#rW&&this.#rM?.length){let e,t=this.#rM;for(;e=t?.shift();)this.#rv?.(...e)}return n}clear(){return this.#r3("delete")}#r3(e){for(let t of this.#rV({allowStale:!0})){let n=this.#rD[t];if(this.#rz(n))n.__abortController.abort(Error("deleted"));else{let r=this.#rA[t];this.#rO&&this.#rg?.(n,r,e),this.#rW&&this.#rM?.push([n,r,e])}}if(this.#rT.clear(),this.#rD.fill(void 0),this.#rA.fill(void 0),this.#rL&&this.#rw&&(this.#rL.fill(0),this.#rw.fill(0)),this.#rk&&this.#rk.fill(0),this.#rN=0,this.#rP=0,this.#rR.length=0,this.#rE=0,this.#rS=0,this.#rW&&this.#rM){let e,t=this.#rM;for(;e=t?.shift();)this.#rv?.(...e)}}}var ev=d(9411),eb=d(7561),ex=d.t(eb,2),eS=d(3977);let eE=i(673),eT=i(492),eA=i(915),eD="object"==typeof process&&process?process:{stdout:null,stderr:null},eC=e=>!!e&&"object"==typeof e&&(e instanceof ta||e instanceof eT||eI(e)||eN(e)),eI=e=>!!e&&"object"==typeof e&&e instanceof eE.EventEmitter&&"function"==typeof e.pipe&&e.pipe!==eT.Writable.prototype.pipe,eN=e=>!!e&&"object"==typeof e&&e instanceof eE.EventEmitter&&"function"==typeof e.write&&"function"==typeof e.end,eP=Symbol("EOF"),eR=Symbol("maybeEmitEnd"),eM=Symbol("emittedEnd"),ek=Symbol("emittingEnd"),ew=Symbol("emittedError"),eL=Symbol("closed"),eO=Symbol("read"),eF=Symbol("flush"),eW=Symbol("flushChunk"),eB=Symbol("encoding"),ez=Symbol("decoder"),eG=Symbol("flowing"),ej=Symbol("paused"),eK=Symbol("resume"),eV=Symbol("buffer"),eU=Symbol("pipes"),eH=Symbol("bufferLength"),eq=Symbol("bufferPush"),eJ=Symbol("bufferShift"),e$=Symbol("objectMode"),eX=Symbol("destroyed"),eY=Symbol("error"),eQ=Symbol("emitData"),eZ=Symbol("emitEnd"),e0=Symbol("emitEnd2"),e1=Symbol("async"),e2=Symbol("abort"),e8=Symbol("aborted"),e3=Symbol("signal"),e6=Symbol("dataListeners"),e4=Symbol("discarded"),e5=e=>Promise.resolve().then(e),e7=e=>e(),e9=e=>"end"===e||"finish"===e||"prefinish"===e,te=e=>e instanceof ArrayBuffer||!!e&&"object"==typeof e&&e.constructor&&"ArrayBuffer"===e.constructor.name&&e.byteLength>=0,tt=e=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e);class tn{src;dest;opts;ondrain;constructor(e,t,n){this.src=e,this.dest=t,this.opts=n,this.ondrain=()=>e[eK](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}}class tr extends tn{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,t,n){super(e,t,n),this.proxyErrors=e=>t.emit("error",e),e.on("error",this.proxyErrors)}}let ti=e=>!!e.objectMode,to=e=>!e.objectMode&&!!e.encoding&&"buffer"!==e.encoding;class ta extends eE.EventEmitter{[eG]=!1;[ej]=!1;[eU]=[];[eV]=[];[e$];[eB];[e1];[ez];[eP]=!1;[eM]=!1;[ek]=!1;[eL]=!1;[ew]=null;[eH]=0;[eX]=!1;[e3];[e8]=!1;[e6]=0;[e4]=!1;writable=!0;readable=!0;constructor(...e){let t=e[0]||{};if(super(),t.objectMode&&"string"==typeof t.encoding)throw TypeError("Encoding and objectMode may not be used together");ti(t)?(this[e$]=!0,this[eB]=null):to(t)?(this[eB]=t.encoding,this[e$]=!1):(this[e$]=!1,this[eB]=null),this[e1]=!!t.async,this[ez]=this[eB]?new eA.StringDecoder(this[eB]):null,t&&!0===t.debugExposeBuffer&&Object.defineProperty(this,"buffer",{get:()=>this[eV]}),t&&!0===t.debugExposePipes&&Object.defineProperty(this,"pipes",{get:()=>this[eU]});let{signal:n}=t;n&&(this[e3]=n,n.aborted?this[e2]():n.addEventListener("abort",()=>this[e2]()))}get bufferLength(){return this[eH]}get encoding(){return this[eB]}set encoding(e){throw Error("Encoding must be set at instantiation time")}setEncoding(e){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[e$]}set objectMode(e){throw Error("objectMode must be set at instantiation time")}get async(){return this[e1]}set async(e){this[e1]=this[e1]||!!e}[e2](){this[e8]=!0,this.emit("abort",this[e3]?.reason),this.destroy(this[e3]?.reason)}get aborted(){return this[e8]}set aborted(e){}write(e,t,n){if(this[e8])return!1;if(this[eP])throw Error("write after end");if(this[eX])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;"function"==typeof t&&(n=t,t="utf8"),t||(t="utf8");let r=this[e1]?e5:e7;if(!this[e$]&&!Buffer.isBuffer(e)){if(tt(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(te(e))e=Buffer.from(e);else if("string"!=typeof e)throw Error("Non-contiguous data written to non-objectMode stream")}return this[e$]?(this[eG]&&0!==this[eH]&&this[eF](!0),this[eG]?this.emit("data",e):this[eq](e)):e.length&&("string"==typeof e&&(t!==this[eB]||this[ez]?.lastNeed)&&(e=Buffer.from(e,t)),Buffer.isBuffer(e)&&this[eB]&&(e=this[ez].write(e)),this[eG]&&0!==this[eH]&&this[eF](!0),this[eG]?this.emit("data",e):this[eq](e)),0!==this[eH]&&this.emit("readable"),n&&r(n),this[eG]}read(e){if(this[eX])return null;if(this[e4]=!1,0===this[eH]||0===e||e&&e>this[eH])return this[eR](),null;this[e$]&&(e=null),this[eV].length>1&&!this[e$]&&(this[eV]=[this[eB]?this[eV].join(""):Buffer.concat(this[eV],this[eH])]);let t=this[eO](e||null,this[eV][0]);return this[eR](),t}[eO](e,t){if(this[e$])this[eJ]();else{let n=t;e===n.length||null===e?this[eJ]():("string"==typeof n?(this[eV][0]=n.slice(e),t=n.slice(0,e)):(this[eV][0]=n.subarray(e),t=n.subarray(0,e)),this[eH]-=e)}return this.emit("data",t),this[eV].length||this[eP]||this.emit("drain"),t}end(e,t,n){return"function"==typeof e&&(n=e,e=void 0),"function"==typeof t&&(n=t,t="utf8"),void 0!==e&&this.write(e,t),n&&this.once("end",n),this[eP]=!0,this.writable=!1,(this[eG]||!this[ej])&&this[eR](),this}[eK](){this[eX]||(this[e6]||this[eU].length||(this[e4]=!0),this[ej]=!1,this[eG]=!0,this.emit("resume"),this[eV].length?this[eF]():this[eP]?this[eR]():this.emit("drain"))}resume(){return this[eK]()}pause(){this[eG]=!1,this[ej]=!0,this[e4]=!1}get destroyed(){return this[eX]}get flowing(){return this[eG]}get paused(){return this[ej]}[eq](e){this[e$]?this[eH]+=1:this[eH]+=e.length,this[eV].push(e)}[eJ](){return this[e$]?this[eH]-=1:this[eH]-=this[eV][0].length,this[eV].shift()}[eF](e=!1){do;while(this[eW](this[eJ]())&&this[eV].length);e||this[eV].length||this[eP]||this.emit("drain")}[eW](e){return this.emit("data",e),this[eG]}pipe(e,t){if(this[eX])return e;this[e4]=!1;let n=this[eM];return t=t||{},e===eD.stdout||e===eD.stderr?t.end=!1:t.end=!1!==t.end,t.proxyErrors=!!t.proxyErrors,n?t.end&&e.end():(this[eU].push(t.proxyErrors?new tr(this,e,t):new tn(this,e,t)),this[e1]?e5(()=>this[eK]()):this[eK]()),e}unpipe(e){let t=this[eU].find(t=>t.dest===e);t&&(1===this[eU].length?(this[eG]&&0===this[e6]&&(this[eG]=!1),this[eU]=[]):this[eU].splice(this[eU].indexOf(t),1),t.unpipe())}addListener(e,t){return this.on(e,t)}on(e,t){let n=super.on(e,t);return"data"===e?(this[e4]=!1,this[e6]++,this[eU].length||this[eG]||this[eK]()):"readable"===e&&0!==this[eH]?super.emit("readable"):e9(e)&&this[eM]?(super.emit(e),this.removeAllListeners(e)):"error"===e&&this[ew]&&(this[e1]?e5(()=>t.call(this,this[ew])):t.call(this,this[ew])),n}removeListener(e,t){return this.off(e,t)}off(e,t){let n=super.off(e,t);return"data"===e&&(this[e6]=this.listeners("data").length,0!==this[e6]||this[e4]||this[eU].length||(this[eG]=!1)),n}removeAllListeners(e){let t=super.removeAllListeners(e);return("data"===e||void 0===e)&&(this[e6]=0,this[e4]||this[eU].length||(this[eG]=!1)),t}get emittedEnd(){return this[eM]}[eR](){this[ek]||this[eM]||this[eX]||0!==this[eV].length||!this[eP]||(this[ek]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[eL]&&this.emit("close"),this[ek]=!1)}emit(e,...t){let n=t[0];if("error"!==e&&"close"!==e&&e!==eX&&this[eX])return!1;if("data"===e)return(!!this[e$]||!!n)&&(this[e1]?(e5(()=>this[eQ](n)),!0):this[eQ](n));if("end"===e)return this[eZ]();if("close"===e){if(this[eL]=!0,!this[eM]&&!this[eX])return!1;let e=super.emit("close");return this.removeAllListeners("close"),e}if("error"===e){this[ew]=n,super.emit(eY,n);let e=(!this[e3]||!!this.listeners("error").length)&&super.emit("error",n);return this[eR](),e}else if("resume"===e){let e=super.emit("resume");return this[eR](),e}else if("finish"===e||"prefinish"===e){let t=super.emit(e);return this.removeAllListeners(e),t}let r=super.emit(e,...t);return this[eR](),r}[eQ](e){for(let t of this[eU])!1===t.dest.write(e)&&this.pause();let t=!this[e4]&&super.emit("data",e);return this[eR](),t}[eZ](){return!this[eM]&&(this[eM]=!0,this.readable=!1,this[e1]?(e5(()=>this[e0]()),!0):this[e0]())}[e0](){if(this[ez]){let e=this[ez].end();if(e){for(let t of this[eU])t.dest.write(e);this[e4]||super.emit("data",e)}}for(let e of this[eU])e.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[e$]||(e.dataLength=0);let t=this.promise();return this.on("data",t=>{e.push(t),this[e$]||(e.dataLength+=t.length)}),await t,e}async concat(){if(this[e$])throw Error("cannot concat in objectMode");let e=await this.collect();return this[eB]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,t)=>{this.on(eX,()=>t(Error("stream destroyed"))),this.on("error",e=>t(e)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[e4]=!1;let e=!1,t=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{let n,r;if(e)return t();let i=this.read();if(null!==i)return Promise.resolve({done:!1,value:i});if(this[eP])return t();let o=e=>{this.off("data",a),this.off("end",s),this.off(eX,l),t(),r(e)},a=e=>{this.off("error",o),this.off("end",s),this.off(eX,l),this.pause(),n({value:e,done:!!this[eP]})},s=()=>{this.off("error",o),this.off("data",a),this.off(eX,l),t(),n({done:!0,value:void 0})},l=()=>o(Error("stream destroyed"));return new Promise((e,t)=>{r=t,n=e,this.once(eX,l),this.once("error",o),this.once("end",s),this.once("data",a)})},throw:t,return:t,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[e4]=!1;let e=!1,t=()=>(this.pause(),this.off(eY,t),this.off(eX,t),this.off("end",t),e=!0,{done:!0,value:void 0});return this.once("end",t),this.once(eY,t),this.once(eX,t),{next:()=>{if(e)return t();let n=this.read();return null===n?t():{done:!1,value:n}},throw:t,return:t,[Symbol.iterator](){return this}}}destroy(e){return this[eX]||(this[eX]=!0,this[e4]=!0,this[eV].length=0,this[eH]=0,"function"!=typeof this.close||this[eL]||this.close()),e?this.emit("error",e):this.emit(eX),this}static get isStream(){return eC}}let ts=a.realpathSync.native,tl={lstatSync:a.lstatSync,readdir:a.readdir,readdirSync:a.readdirSync,readlinkSync:a.readlinkSync,realpathSync:ts,promises:{lstat:eS.lstat,readdir:eS.readdir,readlink:eS.readlink,realpath:eS.realpath}},tc=e=>e&&e!==tl&&e!==ex?{...tl,...e,promises:{...tl.promises,...e.promises||{}}}:tl,td=/^\\\\\?\\([a-z]:)\\?$/i,tu=e=>e.replace(/\//g,"\\").replace(td,"$1\\"),tp=/[\\\/]/,tf=-16,tm=704,t_=e=>e.isFile()?8:e.isDirectory()?4:e.isSymbolicLink()?10:e.isCharacterDevice()?2:e.isBlockDevice()?6:e.isSocket()?12:+!!e.isFIFO(),th=new Map,tg=e=>{let t=th.get(e);if(t)return t;let n=e.normalize("NFKD");return th.set(e,n),n},ty=new Map,tv=e=>{let t=ty.get(e);if(t)return t;let n=tg(e.toLowerCase());return ty.set(e,n),n};class tb extends ey{constructor(){super({max:256})}}class tx extends ey{constructor(e=16384){super({maxSize:e,sizeCalculation:e=>e.length+1})}}let tS=Symbol("PathScurry setAsCwd");class tE{name;root;roots;parent;nocase;isCWD=!1;#r6;#r4;get dev(){return this.#r4}#r5;get mode(){return this.#r5}#r7;get nlink(){return this.#r7}#r9;get uid(){return this.#r9}#ie;get gid(){return this.#ie}#it;get rdev(){return this.#it}#ir;get blksize(){return this.#ir}#ii;get ino(){return this.#ii}#rS;get size(){return this.#rS}#io;get blocks(){return this.#io}#ia;get atimeMs(){return this.#ia}#is;get mtimeMs(){return this.#is}#il;get ctimeMs(){return this.#il}#ic;get birthtimeMs(){return this.#ic}#id;get atime(){return this.#id}#iu;get mtime(){return this.#iu}#ip;get ctime(){return this.#ip}#im;get birthtime(){return this.#im}#i_;#ih;#ig;#iy;#iv;#ib;#ix;#iS;#iE;#iT;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(e,t=0,n,r,i,o,a){this.name=e,this.#i_=i?tv(e):tg(e),this.#ix=1023&t,this.nocase=i,this.roots=r,this.root=n||this,this.#iS=o,this.#ig=a.fullpath,this.#iv=a.relative,this.#ib=a.relativePosix,this.parent=a.parent,this.parent?this.#r6=this.parent.#r6:this.#r6=tc(a.fs)}depth(){return void 0!==this.#ih?this.#ih:this.parent?this.#ih=this.parent.depth()+1:this.#ih=0}childrenCache(){return this.#iS}resolve(e){if(!e)return this;let t=this.getRootString(e),n=e.substring(t.length).split(this.splitSep);return t?this.getRoot(t).#iA(n):this.#iA(n)}#iA(e){let t=this;for(let n of e)t=t.child(n);return t}children(){let e=this.#iS.get(this);if(e)return e;let t=Object.assign([],{provisional:0});return this.#iS.set(this,t),this.#ix&=-17,t}child(e,t){if(""===e||"."===e)return this;if(".."===e)return this.parent||this;let n=this.children(),r=this.nocase?tv(e):tg(e);for(let e of n)if(e.#i_===r)return e;let i=this.parent?this.sep:"",o=this.#ig?this.#ig+i+e:void 0,a=this.newChild(e,0,{...t,parent:this,fullpath:o});return this.canReaddir()||(a.#ix|=128),n.push(a),a}relative(){if(this.isCWD)return"";if(void 0!==this.#iv)return this.#iv;let e=this.name,t=this.parent;if(!t)return this.#iv=this.name;let n=t.relative();return n+(n&&t.parent?this.sep:"")+e}relativePosix(){if("/"===this.sep)return this.relative();if(this.isCWD)return"";if(void 0!==this.#ib)return this.#ib;let e=this.name,t=this.parent;if(!t)return this.#ib=this.fullpathPosix();let n=t.relativePosix();return n+(n&&t.parent?"/":"")+e}fullpath(){if(void 0!==this.#ig)return this.#ig;let e=this.name,t=this.parent;if(!t)return this.#ig=this.name;let n=t.fullpath()+(t.parent?this.sep:"")+e;return this.#ig=n}fullpathPosix(){if(void 0!==this.#iy)return this.#iy;if("/"===this.sep)return this.#iy=this.fullpath();if(!this.parent){let e=this.fullpath().replace(/\\/g,"/");return/^[a-z]:\//i.test(e)?this.#iy=`//?/${e}`:this.#iy=e}let e=this.parent,t=e.fullpathPosix(),n=t+(t&&e.parent?"/":"")+this.name;return this.#iy=n}isUnknown(){return(15&this.#ix)==0}isType(e){return this[`is${e}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(15&this.#ix)==8}isDirectory(){return(15&this.#ix)==4}isCharacterDevice(){return(15&this.#ix)==2}isBlockDevice(){return(15&this.#ix)==6}isFIFO(){return(15&this.#ix)==1}isSocket(){return(15&this.#ix)==12}isSymbolicLink(){return(10&this.#ix)==10}lstatCached(){return 32&this.#ix?this:void 0}readlinkCached(){return this.#iE}realpathCached(){return this.#iT}readdirCached(){let e=this.children();return e.slice(0,e.provisional)}canReadlink(){if(this.#iE)return!0;if(!this.parent)return!1;let e=15&this.#ix;return!(0!==e&&10!==e||256&this.#ix||128&this.#ix)}calledReaddir(){return!!(16&this.#ix)}isENOENT(){return!!(128&this.#ix)}isNamed(e){return this.nocase?this.#i_===tv(e):this.#i_===tg(e)}async readlink(){let e=this.#iE;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=await this.#r6.promises.readlink(this.fullpath()),t=(await this.parent.realpath())?.resolve(e);if(t)return this.#iE=t}catch(e){this.#iD(e.code);return}}readlinkSync(){let e=this.#iE;if(e)return e;if(this.canReadlink()&&this.parent)try{let e=this.#r6.readlinkSync(this.fullpath()),t=this.parent.realpathSync()?.resolve(e);if(t)return this.#iE=t}catch(e){this.#iD(e.code);return}}#iC(e){this.#ix|=16;for(let t=e.provisional;t<e.length;t++){let n=e[t];n&&n.#iI()}}#iI(){128&this.#ix||(this.#ix=(128|this.#ix)&tf,this.#iN())}#iN(){let e=this.children();for(let t of(e.provisional=0,e))t.#iI()}#iP(){this.#ix|=512,this.#iR()}#iR(){if(64&this.#ix)return;let e=this.#ix;(15&e)==4&&(e&=tf),this.#ix=64|e,this.#iN()}#iM(e=""){"ENOTDIR"===e||"EPERM"===e?this.#iR():"ENOENT"===e?this.#iI():this.children().provisional=0}#ik(e=""){"ENOTDIR"===e?this.parent.#iR():"ENOENT"===e&&this.#iI()}#iD(e=""){let t=this.#ix;t|=256,"ENOENT"===e&&(t|=128),("EINVAL"===e||"UNKNOWN"===e)&&(t&=tf),this.#ix=t,"ENOTDIR"===e&&this.parent&&this.parent.#iR()}#iw(e,t){return this.#iL(e,t)||this.#iO(e,t)}#iO(e,t){let n=t_(e),r=this.newChild(e.name,n,{parent:this}),i=15&r.#ix;return 4!==i&&10!==i&&0!==i&&(r.#ix|=64),t.unshift(r),t.provisional++,r}#iL(e,t){for(let n=t.provisional;n<t.length;n++){let r=t[n];if((this.nocase?tv(e.name):tg(e.name))===r.#i_)return this.#iF(e,r,n,t)}}#iF(e,t,n,r){let i=t.name;return t.#ix=t.#ix&tf|t_(e),i!==e.name&&(t.name=e.name),n!==r.provisional&&(n===r.length-1?r.pop():r.splice(n,1),r.unshift(t)),r.provisional++,t}async lstat(){if((128&this.#ix)==0)try{return this.#iW(await this.#r6.promises.lstat(this.fullpath())),this}catch(e){this.#ik(e.code)}}lstatSync(){if((128&this.#ix)==0)try{return this.#iW(this.#r6.lstatSync(this.fullpath())),this}catch(e){this.#ik(e.code)}}#iW(e){let{atime:t,atimeMs:n,birthtime:r,birthtimeMs:i,blksize:o,blocks:a,ctime:s,ctimeMs:l,dev:c,gid:d,ino:u,mode:p,mtime:f,mtimeMs:m,nlink:_,rdev:h,size:g,uid:y}=e;this.#id=t,this.#ia=n,this.#im=r,this.#ic=i,this.#ir=o,this.#io=a,this.#ip=s,this.#il=l,this.#r4=c,this.#ie=d,this.#ii=u,this.#r5=p,this.#iu=f,this.#is=m,this.#r7=_,this.#it=h,this.#rS=g,this.#r9=y;let b=t_(e);this.#ix=this.#ix&tf|b|32,0!==b&&4!==b&&10!==b&&(this.#ix|=64)}#iB=[];#iz=!1;#iG(e){this.#iz=!1;let t=this.#iB.slice();this.#iB.length=0,t.forEach(t=>t(null,e))}readdirCB(e,t=!1){if(!this.canReaddir())return void(t?e(null,[]):queueMicrotask(()=>e(null,[])));let n=this.children();if(this.calledReaddir()){let r=n.slice(0,n.provisional);t?e(null,r):queueMicrotask(()=>e(null,r));return}if(this.#iB.push(e),this.#iz)return;this.#iz=!0;let r=this.fullpath();this.#r6.readdir(r,{withFileTypes:!0},(e,t)=>{if(e)this.#iM(e.code),n.provisional=0;else{for(let e of t)this.#iw(e,n);this.#iC(n)}this.#iG(n.slice(0,n.provisional))})}#ij;async readdir(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();if(this.#ij)await this.#ij;else{let n=()=>{};this.#ij=new Promise(e=>n=e);try{for(let n of(await this.#r6.promises.readdir(t,{withFileTypes:!0})))this.#iw(n,e);this.#iC(e)}catch(t){this.#iM(t.code),e.provisional=0}this.#ij=void 0,n()}return e.slice(0,e.provisional)}readdirSync(){if(!this.canReaddir())return[];let e=this.children();if(this.calledReaddir())return e.slice(0,e.provisional);let t=this.fullpath();try{for(let n of this.#r6.readdirSync(t,{withFileTypes:!0}))this.#iw(n,e);this.#iC(e)}catch(t){this.#iM(t.code),e.provisional=0}return e.slice(0,e.provisional)}canReaddir(){if(this.#ix&tm)return!1;let e=15&this.#ix;return 0===e||4===e||10===e}shouldWalk(e,t){return(4&this.#ix)==4&&!(this.#ix&tm)&&!e.has(this)&&(!t||t(this))}async realpath(){if(this.#iT)return this.#iT;if(!(896&this.#ix))try{let e=await this.#r6.promises.realpath(this.fullpath());return this.#iT=this.resolve(e)}catch(e){this.#iP()}}realpathSync(){if(this.#iT)return this.#iT;if(!(896&this.#ix))try{let e=this.#r6.realpathSync(this.fullpath());return this.#iT=this.resolve(e)}catch(e){this.#iP()}}[tS](e){if(e===this)return;e.isCWD=!1,this.isCWD=!0;let t=new Set([]),n=[],r=this;for(;r&&r.parent;)t.add(r),r.#iv=n.join(this.sep),r.#ib=n.join("/"),r=r.parent,n.push("..");for(r=e;r&&r.parent&&!t.has(r);)r.#iv=void 0,r.#ib=void 0,r=r.parent}}class tT extends tE{sep="\\";splitSep=tp;constructor(e,t=0,n,r,i,o,a){super(e,t,n,r,i,o,a)}newChild(e,t=0,n={}){return new tT(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}getRootString(e){return ev.win32.parse(e).root}getRoot(e){if((e=tu(e.toUpperCase()))===this.root.name)return this.root;for(let[t,n]of Object.entries(this.roots))if(this.sameRoot(e,t))return this.roots[e]=n;return this.roots[e]=new tC(e,this).root}sameRoot(e,t=this.root.name){return(e=e.toUpperCase().replace(/\//g,"\\").replace(td,"$1\\"))===t}}class tA extends tE{splitSep="/";sep="/";constructor(e,t=0,n,r,i,o,a){super(e,t,n,r,i,o,a)}getRootString(e){return e.startsWith("/")?"/":""}getRoot(e){return this.root}newChild(e,t=0,n={}){return new tA(e,t,this.root,this.roots,this.nocase,this.childrenCache(),n)}}class tD{root;rootPath;roots;cwd;#iK;#iV;#iS;nocase;#r6;constructor(e=process.cwd(),t,n,{nocase:r,childrenCacheSize:i=16384,fs:o=tl}={}){this.#r6=tc(o),(e instanceof URL||e.startsWith("file://"))&&(e=(0,ea.fileURLToPath)(e));let a=t.resolve(e);this.roots=Object.create(null),this.rootPath=this.parseRootPath(a),this.#iK=new tb,this.#iV=new tb,this.#iS=new tx(i);let s=a.substring(this.rootPath.length).split(n);if(1!==s.length||s[0]||s.pop(),void 0===r)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=r,this.root=this.newRoot(this.#r6),this.roots[this.rootPath]=this.root;let l=this.root,c=s.length-1,d=t.sep,u=this.rootPath,p=!1;for(let e of s){let t=c--;l=l.child(e,{relative:Array(t).fill("..").join(d),relativePosix:Array(t).fill("..").join("/"),fullpath:u+=(p?"":d)+e}),p=!0}this.cwd=l}depth(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.depth()}childrenCache(){return this.#iS}resolve(...e){let t="";for(let n=e.length-1;n>=0;n--){let r=e[n];if(r&&"."!==r&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#iK.get(t);if(void 0!==n)return n;let r=this.cwd.resolve(t).fullpath();return this.#iK.set(t,r),r}resolvePosix(...e){let t="";for(let n=e.length-1;n>=0;n--){let r=e[n];if(r&&"."!==r&&(t=t?`${r}/${t}`:r,this.isAbsolute(r)))break}let n=this.#iV.get(t);if(void 0!==n)return n;let r=this.cwd.resolve(t).fullpathPosix();return this.#iV.set(t,r),r}relative(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.relative()}relativePosix(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.relativePosix()}basename(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.name}dirname(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),(e.parent||e).fullpath()}async readdir(e=this.cwd,t={withFileTypes:!0}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd);let{withFileTypes:n}=t;if(!e.canReaddir())return[];{let t=await e.readdir();return n?t:t.map(e=>e.name)}}readdirSync(e=this.cwd,t={withFileTypes:!0}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd);let{withFileTypes:n=!0}=t;return e.canReaddir()?n?e.readdirSync():e.readdirSync().map(e=>e.name):[]}async lstat(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.lstat()}lstatSync(e=this.cwd){return"string"==typeof e&&(e=this.cwd.resolve(e)),e.lstatSync()}async readlink(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e.withFileTypes,e=this.cwd);let n=await e.readlink();return t?n:n?.fullpath()}readlinkSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e.withFileTypes,e=this.cwd);let n=e.readlinkSync();return t?n:n?.fullpath()}async realpath(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e.withFileTypes,e=this.cwd);let n=await e.realpath();return t?n:n?.fullpath()}realpathSync(e=this.cwd,{withFileTypes:t}={withFileTypes:!1}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e.withFileTypes,e=this.cwd);let n=e.realpathSync();return t?n:n?.fullpath()}async walk(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:o}=t,a=[];(!i||i(e))&&a.push(n?e:e.fullpath());let s=new Set,l=(e,t)=>{s.add(e),e.readdirCB((e,c)=>{if(e)return t(e);let d=c.length;if(!d)return t();let u=()=>{0==--d&&t()};for(let e of c)(!i||i(e))&&a.push(n?e:e.fullpath()),r&&e.isSymbolicLink()?e.realpath().then(e=>e?.isUnknown()?e.lstat():e).then(e=>e?.shouldWalk(s,o)?l(e,u):u()):e.shouldWalk(s,o)?l(e,u):u()},!0)},c=e;return new Promise((e,t)=>{l(c,n=>{if(n)return t(n);e(a)})})}walkSync(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:o}=t,a=[];(!i||i(e))&&a.push(n?e:e.fullpath());let s=new Set([e]);for(let e of s)for(let t of e.readdirSync()){(!i||i(t))&&a.push(n?t:t.fullpath());let e=t;if(t.isSymbolicLink()){if(!(r&&(e=t.realpathSync())))continue;e.isUnknown()&&e.lstatSync()}e.shouldWalk(s,o)&&s.add(e)}return a}[Symbol.asyncIterator](){return this.iterate()}iterate(e=this.cwd,t={}){return"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd),this.stream(e,t)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:o}=t;(!i||i(e))&&(yield n?e:e.fullpath());let a=new Set([e]);for(let e of a)for(let t of e.readdirSync()){(!i||i(t))&&(yield n?t:t.fullpath());let e=t;if(t.isSymbolicLink()){if(!(r&&(e=t.realpathSync())))continue;e.isUnknown()&&e.lstatSync()}e.shouldWalk(a,o)&&a.add(e)}}stream(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:o}=t,a=new ta({objectMode:!0});(!i||i(e))&&a.write(n?e:e.fullpath());let s=new Set,l=[e],c=0,d=()=>{let e=!1;for(;!e;){let t=l.shift();if(!t){0===c&&a.end();return}c++,s.add(t);let u=(t,f,m=!1)=>{if(t)return a.emit("error",t);if(r&&!m){let e=[];for(let t of f)t.isSymbolicLink()&&e.push(t.realpath().then(e=>e?.isUnknown()?e.lstat():e));if(e.length)return void Promise.all(e).then(()=>u(null,f,!0))}for(let t of f)t&&(!i||i(t))&&!a.write(n?t:t.fullpath())&&(e=!0);for(let e of(c--,f)){let t=e.realpathCached()||e;t.shouldWalk(s,o)&&l.push(t)}e&&!a.flowing?a.once("drain",d):p||d()},p=!0;t.readdirCB(u,!0),p=!1}};return d(),a}streamSync(e=this.cwd,t={}){"string"==typeof e?e=this.cwd.resolve(e):e instanceof tE||(t=e,e=this.cwd);let{withFileTypes:n=!0,follow:r=!1,filter:i,walkFilter:o}=t,a=new ta({objectMode:!0}),s=new Set;(!i||i(e))&&a.write(n?e:e.fullpath());let l=[e],c=0,d=()=>{let e=!1;for(;!e;){let t=l.shift();if(!t){0===c&&a.end();return}c++,s.add(t);let d=t.readdirSync();for(let t of d)(!i||i(t))&&!a.write(n?t:t.fullpath())&&(e=!0);for(let e of(c--,d)){let t=e;if(e.isSymbolicLink()){if(!(r&&(t=e.realpathSync())))continue;t.isUnknown()&&t.lstatSync()}t.shouldWalk(s,o)&&l.push(t)}}e&&!a.flowing&&a.once("drain",d)};return d(),a}chdir(e=this.cwd){let t=this.cwd;this.cwd="string"==typeof e?this.cwd.resolve(e):e,this.cwd[tS](t)}}class tC extends tD{sep="\\";constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,ev.win32,"\\",{...t,nocase:n}),this.nocase=n;for(let e=this.cwd;e;e=e.parent)e.nocase=this.nocase}parseRootPath(e){return ev.win32.parse(e).root.toUpperCase()}newRoot(e){return new tT(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")||e.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(e)}}class tI extends tD{sep="/";constructor(e=process.cwd(),t={}){let{nocase:n=!1}=t;super(e,ev.posix,"/",{...t,nocase:n}),this.nocase=n}parseRootPath(e){return"/"}newRoot(e){return new tA(this.rootPath,4,void 0,this.roots,this.nocase,this.childrenCache(),{fs:e})}isAbsolute(e){return e.startsWith("/")}}class tN extends tI{constructor(e=process.cwd(),t={}){let{nocase:n=!0}=t;super(e,{...t,nocase:n})}}process.platform;let tP="win32"===process.platform?tC:"darwin"===process.platform?tN:tI,tR=e=>e.length>=1,tM=e=>e.length>=1;class tk{#iU;#iH;#iq;length;#iJ;#i$;#iX;#iY;#iQ;#iZ;#i0=!0;constructor(e,t,n,r){if(!tR(e))throw TypeError("empty pattern list");if(!tM(t))throw TypeError("empty glob list");if(t.length!==e.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=e.length,n<0||n>=this.length)throw TypeError("index out of range");if(this.#iU=e,this.#iH=t,this.#iq=n,this.#iJ=r,0===this.#iq){if(this.isUNC()){let[e,t,n,r,...i]=this.#iU,[o,a,s,l,...c]=this.#iH;""===i[0]&&(i.shift(),c.shift());let d=[e,t,n,r,""].join("/"),u=[o,a,s,l,""].join("/");this.#iU=[d,...i],this.#iH=[u,...c],this.length=this.#iU.length}else if(this.isDrive()||this.isAbsolute()){let[e,...t]=this.#iU,[n,...r]=this.#iH;""===t[0]&&(t.shift(),r.shift()),this.#iU=[e+"/",...t],this.#iH=[n+"/",...r],this.length=this.#iU.length}}}pattern(){return this.#iU[this.#iq]}isString(){return"string"==typeof this.#iU[this.#iq]}isGlobstar(){return this.#iU[this.#iq]===Z}isRegExp(){return this.#iU[this.#iq]instanceof RegExp}globString(){return this.#iX=this.#iX||(0===this.#iq?this.isAbsolute()?this.#iH[0]+this.#iH.slice(1).join("/"):this.#iH.join("/"):this.#iH.slice(this.#iq).join("/"))}hasMore(){return this.length>this.#iq+1}rest(){return void 0!==this.#i$?this.#i$:this.hasMore()?(this.#i$=new tk(this.#iU,this.#iH,this.#iq+1,this.#iJ),this.#i$.#iZ=this.#iZ,this.#i$.#iQ=this.#iQ,this.#i$.#iY=this.#iY,this.#i$):this.#i$=null}isUNC(){let e=this.#iU;return void 0!==this.#iQ?this.#iQ:this.#iQ="win32"===this.#iJ&&0===this.#iq&&""===e[0]&&""===e[1]&&"string"==typeof e[2]&&!!e[2]&&"string"==typeof e[3]&&!!e[3]}isDrive(){let e=this.#iU;return void 0!==this.#iY?this.#iY:this.#iY="win32"===this.#iJ&&0===this.#iq&&this.length>1&&"string"==typeof e[0]&&/^[a-z]:$/i.test(e[0])}isAbsolute(){let e=this.#iU;return void 0!==this.#iZ?this.#iZ:this.#iZ=""===e[0]&&e.length>1||this.isDrive()||this.isUNC()}root(){let e=this.#iU[0];return"string"==typeof e&&this.isAbsolute()&&0===this.#iq?e:""}checkFollowGlobstar(){return!(0===this.#iq||!this.isGlobstar()||!this.#i0)}markFollowGlobstar(){return 0!==this.#iq&&!!this.isGlobstar()&&!!this.#i0&&(this.#i0=!1,!0)}}let tw="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux";class tL{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(e,{nobrace:t,nocase:n,noext:r,noglobstar:i,platform:o=tw}){for(let a of(this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=o,this.mmopts={dot:!0,nobrace:t,nocase:n,noext:r,noglobstar:i,optimizationLevel:2,platform:o,nocomment:!0,nonegate:!0},e))this.add(a)}add(e){let t=new eo(e,this.mmopts);for(let e=0;e<t.set.length;e++){let n=t.set[e],r=t.globParts[e];if(!n||!r)throw Error("invalid pattern object");for(;"."===n[0]&&"."===r[0];)n.shift(),r.shift();let i=new tk(n,r,0,this.platform),o=new eo(i.globString(),this.mmopts),a="**"===r[r.length-1],s=i.isAbsolute();s?this.absolute.push(o):this.relative.push(o),a&&(s?this.absoluteChildren.push(o):this.relativeChildren.push(o))}}ignored(e){let t=e.fullpath(),n=`${t}/`,r=e.relative()||".",i=`${r}/`;for(let e of this.relative)if(e.match(r)||e.match(i))return!0;for(let e of this.absolute)if(e.match(t)||e.match(n))return!0;return!1}childrenIgnored(e){let t=e.fullpath()+"/",n=(e.relative()||".")+"/";for(let e of this.relativeChildren)if(e.match(n))return!0;for(let e of this.absoluteChildren)if(e.match(t))return!0;return!1}}class tO{store;constructor(e=new Map){this.store=e}copy(){return new tO(new Map(this.store))}hasWalked(e,t){return this.store.get(e.fullpath())?.has(t.globString())}storeWalked(e,t){let n=e.fullpath(),r=this.store.get(n);r?r.add(t.globString()):this.store.set(n,new Set([t.globString()]))}}class tF{store=new Map;add(e,t,n){let r=2*!!t|!!n,i=this.store.get(e);this.store.set(e,void 0===i?r:r&i)}entries(){return[...this.store.entries()].map(([e,t])=>[e,!!(2&t),!!(1&t)])}}class tW{store=new Map;add(e,t){if(!e.canReaddir())return;let n=this.store.get(e);n?n.find(e=>e.globString()===t.globString())||n.push(t):this.store.set(e,[t])}get(e){let t=this.store.get(e);if(!t)throw Error("attempting to walk unknown path");return t}entries(){return this.keys().map(e=>[e,this.store.get(e)])}keys(){return[...this.store.keys()].filter(e=>e.canReaddir())}}class tB{hasWalkedCache;matches=new tF;subwalks=new tW;patterns;follow;dot;opts;constructor(e,t){this.opts=e,this.follow=!!e.follow,this.dot=!!e.dot,this.hasWalkedCache=t?t.copy():new tO}processPatterns(e,t){for(let[n,r]of(this.patterns=t,t.map(t=>[e,t]))){let e,t;this.hasWalkedCache.storeWalked(n,r);let i=r.root(),o=r.isAbsolute()&&!1!==this.opts.absolute;if(i){n=n.resolve("/"===i&&void 0!==this.opts.root?this.opts.root:i);let e=r.rest();if(e)r=e;else{this.matches.add(n,!0,!1);continue}}if(n.isENOENT())continue;let a=!1;for(;"string"==typeof(e=r.pattern())&&(t=r.rest());)n=n.resolve(e),r=t,a=!0;if(e=r.pattern(),t=r.rest(),a){if(this.hasWalkedCache.hasWalked(n,r))continue;this.hasWalkedCache.storeWalked(n,r)}if("string"==typeof e){let t=".."===e||""===e||"."===e;this.matches.add(n.resolve(e),o,t);continue}if(e===Z){(!n.isSymbolicLink()||this.follow||r.checkFollowGlobstar())&&this.subwalks.add(n,r);let e=t?.pattern(),i=t?.rest();if(t&&(""!==e&&"."!==e||i)){if(".."===e){let e=n.parent||n;i?this.hasWalkedCache.hasWalked(e,i)||this.subwalks.add(e,i):this.matches.add(e,o,!0)}}else this.matches.add(n,o,""===e||"."===e)}else e instanceof RegExp&&this.subwalks.add(n,r)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new tB(this.opts,this.hasWalkedCache)}filterEntries(e,t){let n=this.subwalks.get(e),r=this.child();for(let e of t)for(let t of n){let n=t.isAbsolute(),i=t.pattern(),o=t.rest();i===Z?r.testGlobstar(e,t,o,n):i instanceof RegExp?r.testRegExp(e,i,o,n):r.testString(e,i,o,n)}return r}testGlobstar(e,t,n,r){if((this.dot||!e.name.startsWith("."))&&(t.hasMore()||this.matches.add(e,r,!1),e.canReaddir()&&(this.follow||!e.isSymbolicLink()?this.subwalks.add(e,t):e.isSymbolicLink()&&(n&&t.checkFollowGlobstar()?this.subwalks.add(e,n):t.markFollowGlobstar()&&this.subwalks.add(e,t)))),n){let t=n.pattern();if("string"==typeof t&&".."!==t&&""!==t&&"."!==t)this.testString(e,t,n.rest(),r);else if(".."===t){let t=e.parent||e;this.subwalks.add(t,n)}else t instanceof RegExp&&this.testRegExp(e,t,n.rest(),r)}}testRegExp(e,t,n,r){t.test(e.name)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}testString(e,t,n,r){e.isNamed(t)&&(n?this.subwalks.add(e,n):this.matches.add(e,r,!1))}}let tz=(e,t)=>"string"==typeof e?new tL([e],t):Array.isArray(e)?new tL(e,t):e;class tG{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#i1=[];#i2;#i8;signal;maxDepth;includeChildMatches;constructor(e,t,n){if(this.patterns=e,this.path=t,this.opts=n,this.#i8=n.posix||"win32"!==n.platform?"/":"\\",this.includeChildMatches=!1!==n.includeChildMatches,(n.ignore||!this.includeChildMatches)&&(this.#i2=tz(n.ignore??[],n),!this.includeChildMatches&&"function"!=typeof this.#i2.add))throw Error("cannot ignore child matches, ignore lacks add() method.");this.maxDepth=n.maxDepth||1/0,n.signal&&(this.signal=n.signal,this.signal.addEventListener("abort",()=>{this.#i1.length=0}))}#i3(e){return this.seen.has(e)||!!this.#i2?.ignored?.(e)}#i6(e){return!!this.#i2?.childrenIgnored?.(e)}pause(){this.paused=!0}resume(){let e;if(!this.signal?.aborted)for(this.paused=!1;!this.paused&&(e=this.#i1.shift());)e()}onResume(e){this.signal?.aborted||(this.paused?this.#i1.push(e):e())}async matchCheck(e,t){let n;if(t&&this.opts.nodir)return;if(this.opts.realpath){if(!(n=e.realpathCached()||await e.realpath()))return;e=n}let r=e.isUnknown()||this.opts.stat?await e.lstat():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=await r.realpath();e&&(e.isUnknown()||this.opts.stat)&&await e.lstat()}return this.matchCheckTest(r,t)}matchCheckTest(e,t){return e&&(this.maxDepth===1/0||e.depth()<=this.maxDepth)&&(!t||e.canReaddir())&&(!this.opts.nodir||!e.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!e.isSymbolicLink()||!e.realpathCached()?.isDirectory())&&!this.#i3(e)?e:void 0}matchCheckSync(e,t){let n;if(t&&this.opts.nodir)return;if(this.opts.realpath){if(!(n=e.realpathCached()||e.realpathSync()))return;e=n}let r=e.isUnknown()||this.opts.stat?e.lstatSync():e;if(this.opts.follow&&this.opts.nodir&&r?.isSymbolicLink()){let e=r.realpathSync();e&&(e?.isUnknown()||this.opts.stat)&&e.lstatSync()}return this.matchCheckTest(r,t)}matchFinish(e,t){if(this.#i3(e))return;if(!this.includeChildMatches&&this.#i2?.add){let t=`${e.relativePosix()}/**`;this.#i2.add(t)}let n=void 0===this.opts.absolute?t:this.opts.absolute;this.seen.add(e);let r=this.opts.mark&&e.isDirectory()?this.#i8:"";if(this.opts.withFileTypes)this.matchEmit(e);else if(n){let t=this.opts.posix?e.fullpathPosix():e.fullpath();this.matchEmit(t+r)}else{let t=this.opts.posix?e.relativePosix():e.relative(),n=this.opts.dotRelative&&!t.startsWith(".."+this.#i8)?"."+this.#i8:"";this.matchEmit(t?n+t+r:"."+r)}}async match(e,t,n){let r=await this.matchCheck(e,n);r&&this.matchFinish(r,t)}matchSync(e,t,n){let r=this.matchCheckSync(e,n);r&&this.matchFinish(r,t)}walkCB(e,t,n){this.signal?.aborted&&n(),this.walkCB2(e,t,new tB(this.opts),n)}walkCB2(e,t,n,r){if(this.#i6(e))return r();if(this.signal?.aborted&&r(),this.paused)return void this.onResume(()=>this.walkCB2(e,t,n,r));n.processPatterns(e,t);let i=1,o=()=>{0==--i&&r()};for(let[e,t,r]of n.matches.entries())this.#i3(e)||(i++,this.match(e,t,r).then(()=>o()));for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirCached();e.calledReaddir()?this.walkCB3(e,t,n,o):e.readdirCB((t,r)=>this.walkCB3(e,r,n,o),!0)}o()}walkCB3(e,t,n,r){n=n.filterEntries(e,t);let i=1,o=()=>{0==--i&&r()};for(let[e,t,r]of n.matches.entries())this.#i3(e)||(i++,this.match(e,t,r).then(()=>o()));for(let[e,t]of n.subwalks.entries())i++,this.walkCB2(e,t,n.child(),o);o()}walkCBSync(e,t,n){this.signal?.aborted&&n(),this.walkCB2Sync(e,t,new tB(this.opts),n)}walkCB2Sync(e,t,n,r){if(this.#i6(e))return r();if(this.signal?.aborted&&r(),this.paused)return void this.onResume(()=>this.walkCB2Sync(e,t,n,r));n.processPatterns(e,t);let i=1,o=()=>{0==--i&&r()};for(let[e,t,r]of n.matches.entries())this.#i3(e)||this.matchSync(e,t,r);for(let e of n.subwalkTargets()){if(this.maxDepth!==1/0&&e.depth()>=this.maxDepth)continue;i++;let t=e.readdirSync();this.walkCB3Sync(e,t,n,o)}o()}walkCB3Sync(e,t,n,r){n=n.filterEntries(e,t);let i=1,o=()=>{0==--i&&r()};for(let[e,t,r]of n.matches.entries())this.#i3(e)||this.matchSync(e,t,r);for(let[e,t]of n.subwalks.entries())i++,this.walkCB2Sync(e,t,n.child(),o);o()}}class tj extends tG{matches=new Set;constructor(e,t,n){super(e,t,n)}matchEmit(e){this.matches.add(e)}async walk(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&await this.path.lstat(),await new Promise((e,t)=>{this.walkCB(this.path,this.patterns,()=>{this.signal?.aborted?t(this.signal.reason):e(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class tK extends tG{results;constructor(e,t,n){super(e,t,n),this.results=new ta({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(e){this.results.write(e),this.results.flowing||this.pause()}stream(){let e=this.path;return e.isUnknown()?e.lstat().then(()=>{this.walkCB(e,this.patterns,()=>this.results.end())}):this.walkCB(e,this.patterns,()=>this.results.end()),this.results}streamSync(){return this.path.isUnknown()&&this.path.lstatSync(),this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}let tV="object"==typeof process&&process&&"string"==typeof process.platform?process.platform:"linux";class tU{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(e,t){if(!t)throw TypeError("glob options required");if(this.withFileTypes=!!t.withFileTypes,this.signal=t.signal,this.follow=!!t.follow,this.dot=!!t.dot,this.dotRelative=!!t.dotRelative,this.nodir=!!t.nodir,this.mark=!!t.mark,t.cwd?(t.cwd instanceof URL||t.cwd.startsWith("file://"))&&(t.cwd=(0,ea.fileURLToPath)(t.cwd)):this.cwd="",this.cwd=t.cwd||"",this.root=t.root,this.magicalBraces=!!t.magicalBraces,this.nobrace=!!t.nobrace,this.noext=!!t.noext,this.realpath=!!t.realpath,this.absolute=t.absolute,this.includeChildMatches=!1!==t.includeChildMatches,this.noglobstar=!!t.noglobstar,this.matchBase=!!t.matchBase,this.maxDepth="number"==typeof t.maxDepth?t.maxDepth:1/0,this.stat=!!t.stat,this.ignore=t.ignore,this.withFileTypes&&void 0!==this.absolute)throw Error("cannot set absolute and withFileTypes:true");if("string"==typeof e&&(e=[e]),this.windowsPathsNoEscape=!!t.windowsPathsNoEscape||!1===t.allowWindowsEscape,this.windowsPathsNoEscape&&(e=e.map(e=>e.replace(/\\/g,"/"))),this.matchBase){if(t.noglobstar)throw TypeError("base matching requires globstar");e=e.map(e=>e.includes("/")?e:`./**/${e}`)}if(this.pattern=e,this.platform=t.platform||tV,this.opts={...t,platform:this.platform},t.scurry){if(this.scurry=t.scurry,void 0!==t.nocase&&t.nocase!==t.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let e="win32"===t.platform?tC:"darwin"===t.platform?tN:t.platform?tI:tP;this.scurry=new e(this.cwd,{nocase:t.nocase,fs:t.fs})}this.nocase=this.scurry.nocase;let n="darwin"===this.platform||"win32"===this.platform,r={...t,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:n,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},[i,o]=this.pattern.map(e=>new eo(e,r)).reduce((e,t)=>(e[0].push(...t.set),e[1].push(...t.globParts),e),[[],[]]);this.patterns=i.map((e,t)=>{let n=o[t];if(!n)throw Error("invalid pattern object");return new tk(e,n,0,this.platform)})}async walk(){return[...await new tj(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new tj(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new tK(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new tK(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}function tH(e,t={}){return new tU(e,t).streamSync()}function tq(e,t={}){return new tU(e,t).stream()}function tJ(e,t={}){return new tU(e,t).walkSync()}async function t$(e,t={}){return new tU(e,t).walk()}function tX(e,t={}){return new tU(e,t).iterateSync()}function tY(e,t={}){return new tU(e,t).iterate()}let tQ=Object.assign(tq,{sync:tH}),tZ=Object.assign(tY,{sync:tX}),t0=Object.assign(tJ,{stream:tH,iterate:tX}),t1=Object.assign(t$,{glob:t$,globSync:tJ,sync:t0,globStream:tq,stream:tQ,globStreamSync:tH,streamSync:tH,globIterate:tY,iterate:tZ,globIterateSync:tX,iterateSync:tX,Glob:tU,hasMagic:(e,t={})=>{for(let n of(Array.isArray(e)||(e=[e]),e))if(new eo(n,t).hasMagic())return!0;return!1},escape:N,unescape:h});t1.glob=t1;var t2=d(5151),t8=d.n(t2);async function t3(e,t,r){let i=await t6(e),s=t8()().add("/**/.*").add("/**/.*/").add("node_modules/").add(i),l=[];try{for await(let i of new tU(t,{cwd:e,ignore:r,fs:a})){let t=o().join(e,i);(await (0,n.stat)(t)).isDirectory()||s.ignores(i)||l.push(t)}}catch(e){throw Error(`Failed to search files with pattern '${t}': ${e.message}
420
- Please check your extensions pattern is valid glob syntax.`)}return l}async function t6(e){let t=o().join(e,".gitignore");try{return await (0,n.readFile)(t,"utf-8")}catch(e){return""}}function t4(e,t,n){return e.filter(e=>{let r=e.getFilePath().replace(n,"");return!t.some(e=>P(r,e))})}function t5(e,t,n,r,i){var o=n?function(e,t){var n=Object.create(t||ne);for(var r in e)n[r]=e[r];return n}(n,r||void 0):r;!function e(t,n,r){o[r||t.type](t,n,e)}(e,t,i)}function t7(e,t,n){n(e,t)}function t9(e,t,n){}var ne={};ne.Program=ne.BlockStatement=ne.StaticBlock=function(e,t,n){for(var r=0,i=e.body;r<i.length;r+=1)n(i[r],t,"Statement")},ne.Statement=t7,ne.EmptyStatement=t9,ne.ExpressionStatement=ne.ParenthesizedExpression=ne.ChainExpression=function(e,t,n){return n(e.expression,t,"Expression")},ne.IfStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Statement"),e.alternate&&n(e.alternate,t,"Statement")},ne.LabeledStatement=function(e,t,n){return n(e.body,t,"Statement")},ne.BreakStatement=ne.ContinueStatement=t9,ne.WithStatement=function(e,t,n){n(e.object,t,"Expression"),n(e.body,t,"Statement")},ne.SwitchStatement=function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0,i=e.cases;r<i.length;r+=1)n(i[r],t)},ne.SwitchCase=function(e,t,n){e.test&&n(e.test,t,"Expression");for(var r=0,i=e.consequent;r<i.length;r+=1)n(i[r],t,"Statement")},ne.ReturnStatement=ne.YieldExpression=ne.AwaitExpression=function(e,t,n){e.argument&&n(e.argument,t,"Expression")},ne.ThrowStatement=ne.SpreadElement=function(e,t,n){return n(e.argument,t,"Expression")},ne.TryStatement=function(e,t,n){n(e.block,t,"Statement"),e.handler&&n(e.handler,t),e.finalizer&&n(e.finalizer,t,"Statement")},ne.CatchClause=function(e,t,n){e.param&&n(e.param,t,"Pattern"),n(e.body,t,"Statement")},ne.WhileStatement=ne.DoWhileStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.body,t,"Statement")},ne.ForStatement=function(e,t,n){e.init&&n(e.init,t,"ForInit"),e.test&&n(e.test,t,"Expression"),e.update&&n(e.update,t,"Expression"),n(e.body,t,"Statement")},ne.ForInStatement=ne.ForOfStatement=function(e,t,n){n(e.left,t,"ForInit"),n(e.right,t,"Expression"),n(e.body,t,"Statement")},ne.ForInit=function(e,t,n){"VariableDeclaration"===e.type?n(e,t):n(e,t,"Expression")},ne.DebuggerStatement=t9,ne.FunctionDeclaration=function(e,t,n){return n(e,t,"Function")},ne.VariableDeclaration=function(e,t,n){for(var r=0,i=e.declarations;r<i.length;r+=1)n(i[r],t)},ne.VariableDeclarator=function(e,t,n){n(e.id,t,"Pattern"),e.init&&n(e.init,t,"Expression")},ne.Function=function(e,t,n){e.id&&n(e.id,t,"Pattern");for(var r=0,i=e.params;r<i.length;r+=1)n(i[r],t,"Pattern");n(e.body,t,e.expression?"Expression":"Statement")},ne.Pattern=function(e,t,n){"Identifier"===e.type?n(e,t,"VariablePattern"):"MemberExpression"===e.type?n(e,t,"MemberPattern"):n(e,t)},ne.VariablePattern=t9,ne.MemberPattern=t7,ne.RestElement=function(e,t,n){return n(e.argument,t,"Pattern")},ne.ArrayPattern=function(e,t,n){for(var r=0,i=e.elements;r<i.length;r+=1){var o=i[r];o&&n(o,t,"Pattern")}},ne.ObjectPattern=function(e,t,n){for(var r=0,i=e.properties;r<i.length;r+=1){var o=i[r];"Property"===o.type?(o.computed&&n(o.key,t,"Expression"),n(o.value,t,"Pattern")):"RestElement"===o.type&&n(o.argument,t,"Pattern")}},ne.Expression=t7,ne.ThisExpression=ne.Super=ne.MetaProperty=t9,ne.ArrayExpression=function(e,t,n){for(var r=0,i=e.elements;r<i.length;r+=1){var o=i[r];o&&n(o,t,"Expression")}},ne.ObjectExpression=function(e,t,n){for(var r=0,i=e.properties;r<i.length;r+=1)n(i[r],t)},ne.FunctionExpression=ne.ArrowFunctionExpression=ne.FunctionDeclaration,ne.SequenceExpression=function(e,t,n){for(var r=0,i=e.expressions;r<i.length;r+=1)n(i[r],t,"Expression")},ne.TemplateLiteral=function(e,t,n){for(var r=0,i=e.quasis;r<i.length;r+=1)n(i[r],t);for(var o=0,a=e.expressions;o<a.length;o+=1)n(a[o],t,"Expression")},ne.TemplateElement=t9,ne.UnaryExpression=ne.UpdateExpression=function(e,t,n){n(e.argument,t,"Expression")},ne.BinaryExpression=ne.LogicalExpression=function(e,t,n){n(e.left,t,"Expression"),n(e.right,t,"Expression")},ne.AssignmentExpression=ne.AssignmentPattern=function(e,t,n){n(e.left,t,"Pattern"),n(e.right,t,"Expression")},ne.ConditionalExpression=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Expression"),n(e.alternate,t,"Expression")},ne.NewExpression=ne.CallExpression=function(e,t,n){if(n(e.callee,t,"Expression"),e.arguments)for(var r=0,i=e.arguments;r<i.length;r+=1)n(i[r],t,"Expression")},ne.MemberExpression=function(e,t,n){n(e.object,t,"Expression"),e.computed&&n(e.property,t,"Expression")},ne.ExportNamedDeclaration=ne.ExportDefaultDeclaration=function(e,t,n){e.declaration&&n(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&n(e.source,t,"Expression")},ne.ExportAllDeclaration=function(e,t,n){e.exported&&n(e.exported,t),n(e.source,t,"Expression")},ne.ImportDeclaration=function(e,t,n){for(var r=0,i=e.specifiers;r<i.length;r+=1)n(i[r],t);n(e.source,t,"Expression")},ne.ImportExpression=function(e,t,n){n(e.source,t,"Expression")},ne.ImportSpecifier=ne.ImportDefaultSpecifier=ne.ImportNamespaceSpecifier=ne.Identifier=ne.PrivateIdentifier=ne.Literal=t9,ne.TaggedTemplateExpression=function(e,t,n){n(e.tag,t,"Expression"),n(e.quasi,t,"Expression")},ne.ClassDeclaration=ne.ClassExpression=function(e,t,n){return n(e,t,"Class")},ne.Class=function(e,t,n){e.id&&n(e.id,t,"Pattern"),e.superClass&&n(e.superClass,t,"Expression"),n(e.body,t)},ne.ClassBody=function(e,t,n){for(var r=0,i=e.body;r<i.length;r+=1)n(i[r],t)},ne.MethodDefinition=ne.PropertyDefinition=ne.Property=function(e,t,n){e.computed&&n(e.key,t,"Expression"),e.value&&n(e.value,t,"Expression")};let nt=["Identifier","TemplateLiteral","ArrowFunctionExpression","StaticMemberExpression","CallExpression","TSAsExpression"],nn=i(764);var nr=d.n(nn),ni=d(9100);let no=null;async function na(){return no||(no=await d.e("89").then(d.bind(d,6515))),no}async function ns(){let{CssSelector:e}=await na();return new e}async function nl(){let{CssSelector:e}=await na();return e}async function nc(){let{SelectorMatcher:e}=await na();return new e}async function nd(...e){let{parseTemplate:t}=await na();return t(...e)}let nu=new Map;function np(e){if(!e.includes(`${o().sep}node_modules${o().sep}`))return;let t=o().dirname(e);for(;t.includes("node_modules");){let e=o().join(t,"package.json");try{if(nu.has(e))return nu.get(e);let t=(0,a.readFileSync)(e,"utf-8"),n=JSON.parse(t);if(n&&"string"==typeof n.name)return nu.set(e,n.name),n.name}catch{}let n=o().dirname(t);if(n===t)break;t=n}}let nf="zh-runtime-value";async function nm(e){let t=await ns();for(let n of(t.setElement(e.name),e.attributes))t.addAttribute(n.name,n.value);return t}async function n_(e,t,n,r,i,a,s){var l;if((l=e)&&"object"==typeof l&&"name"in l&&"attributes"in l&&"inputs"in l&&"outputs"in l&&"children"in l&&"references"in l&&Array.isArray(l.attributes)&&Array.isArray(l.inputs)&&Array.isArray(l.outputs)&&Array.isArray(l.children)&&Array.isArray(l.references)){let l=await nm(e);if(r.match(l,(r,l)=>{let c=i.get(l),d=s.get(l)||(null==c?void 0:c.importSource)||"",u=d;if(d&&d.startsWith(".")){let e=o().dirname(t),r=o().resolve(e,d);u=o().relative(n,r)}let p=u||((null==c?void 0:c.filePath)?o().relative(n,c.filePath).replace(/\.ts$/,""):""),f=o().relative(n,t),m=`${l}@${p}`,_=function(e){var t,n,r,i,o,a,s,l,c,d,u,p,f;let m={};for(let t of e.attributes){let e=t.name,n=t.value;m[e]||(m[e]={type:[],values:[]});let r=m[e];""===n||null==n?(r.type=["BooleanLiteral"],r.values.push(!0)):(r.type=["StringLiteral"],r.values.push(n))}for(let f of e.inputs){let e=f.name;m[e]||(m[e]={type:[],values:[]});let _=m[e],h=(null==(t=f.value)?void 0:t.constructor.name)||"Unknown";switch(h){case"LiteralPrimitive":let g=f.value.value;"string"==typeof g?null==(n=_.type)||n.push("StringLiteral"):"number"==typeof g?null==(r=_.type)||r.push("NumericLiteral"):"boolean"==typeof g&&(null==(i=_.type)||i.push("BooleanLiteral")),_.values.push(g);break;case"PropertyRead":case"SafePropertyRead":null==(o=_.type)||o.push("Identifier"),_.values.push(nf);break;case"MethodCall":case"SafeMethodCall":null==(a=_.type)||a.push("CallExpression"),_.values.push(nf);break;case"Binary":null==(s=_.type)||s.push("BinaryExpression"),_.values.push("zh-binary-value");break;case"LiteralArray":null==(l=_.type)||l.push("ArrayExpression"),_.values.push("zh-array-value");break;case"LiteralMap":null==(c=_.type)||c.push("ObjectExpression"),_.values.push("zh-object-value");break;default:"PropertyRead"===h||"SafePropertyRead"===h?null==(d=_.type)||d.push("Identifier"):"MethodCall"===h||"SafeMethodCall"===h?null==(u=_.type)||u.push("CallExpression"):null==(p=_.type)||p.push("Identifier"),_.values.push(nf)}}for(let t of e.outputs){let e=t.name;m[e]||(m[e]={type:[],values:[]});let n=m[e];null==(f=n.type)||f.push("CallExpression"),n.values.push(nf)}return m}(e);a.has(m)||a.set(m,{name:l,count:0,package:p,files:[],props:{}});let h=a.get(m);for(let[e,t]of(h.count++,h.files.includes(f)||h.files.push(f),Object.entries(_))){h.props[e]||(h.props[e]={type:[],values:[]});let n=h.props[e];if(n){let e=t.type||[];n.type=Array.from(new Set([...n.type||[],...e])),n.values.push(...t.values)}}}),e.children)for(let o of e.children)await n_(o,t,n,r,i,a,s)}else await nh(e,t,n,r,i,a,s)}async function nh(e,t,n,r,i,o,a){let s=async e=>{for(let s of e)await n_(s,t,n,r,i,o,a)};if(e.children&&Array.isArray(e.children)&&await s(e.children),e.body&&Array.isArray(e.body)&&await s(e.body),e.branches&&Array.isArray(e.branches))for(let t of e.branches)t.children&&Array.isArray(t.children)&&await s(t.children);if(e.cases&&Array.isArray(e.cases))for(let t of e.cases)t.children&&Array.isArray(t.children)&&await s(t.children);e.main&&e.main.children&&Array.isArray(e.main.children)&&await s(e.main.children),e.placeholder&&e.placeholder.children&&Array.isArray(e.placeholder.children)&&await s(e.placeholder.children),e.loading&&e.loading.children&&Array.isArray(e.loading.children)&&await s(e.loading.children),e.error&&e.error.children&&Array.isArray(e.error.children)&&await s(e.error.children)}async function ng(e,t,n){let r=await nl(),i=n||await nc();for(let n of t)i.addSelectables(r.parse(n),e);return i}async function ny(e,t,n,r,i,o,a,s){try{for(let t of(await nd(e,"template.html",{enableBlockSyntax:!0,preserveWhitespaces:!1})).nodes)await n_(t,n,r,i,o,a,s)}catch(e){console.error(`Error parsing template for ${t}:`,e instanceof Error?e.message:String(e))}}async function nv(e,t,n,r){var i,o,a;let s=r||new Map,l=n||await nc(),c=e.getDecorator("Component");if(!c)return;let d=c.getCallExpression();if(!d)return;let u=d.getArguments();if(0===u.length)return;let p=u[0];if(!p)return;let f=p.asKind(ni.SyntaxKind.ObjectLiteralExpression);if(!f)return;let m=e.getName();if(!m)return;let _=null==(i=f.getProperty("selector"))?void 0:i.asKind(ni.SyntaxKind.PropertyAssignment);if(_){let n=null==t?void 0:t.get(m),r=null==(a=_.getInitializerIfKind(ni.SyntaxKind.StringLiteral))?void 0:a.getLiteralValue().split(",").map(e=>e.trim());r&&(s.set(m,{selectors:r,filePath:e.getSourceFile().getFilePath(),importSource:n}),await ng(m,r,l))}let h=null==(o=f.getProperty("imports"))?void 0:o.asKind(ni.SyntaxKind.PropertyAssignment);if(!h)return null;let g=h.getInitializerIfKind(ni.SyntaxKind.ArrayLiteralExpression);return g||null}async function nb(e,t,n,r,i,o,a){let s=e.getType().getSymbol();if(!s)return;let l=s.getValueDeclaration(),c=[];if(l){let e=l.asKind(ni.SyntaxKind.ClassDeclaration);e&&c.push(e)}if(0===c.length)for(let e of s.getDeclarations()){var d;let t=null==(d=e.asKind)?void 0:d.call(e,ni.SyntaxKind.ClassDeclaration);t&&c.push(t)}for(let e of c){let s=`${e.getName()}@${e.getSourceFile().getFilePath()}`;a&&a.has(s)||(a&&a.add(s),await nx(e,t,n,r,i,o,a))}}async function nx(e,t,n,r,i,o,a){var s,l;let c=i||new Map,d=o||new Map,u=r||await nc();if(e.getProperty("ɵcmp")){let r=null==(s=e.getProperty("ɵcmp"))?void 0:s.getFirstDescendantByKind(ni.SyntaxKind.TypeReference);if(!r)return;let i=r.getTypeArguments();if(!i||i.length<2)return;let o=i[1];if(!o)return;let a=o.asKind(ni.SyntaxKind.LiteralType);if(!a)return;let l=a.getLiteral().asKind(ni.SyntaxKind.StringLiteral);if(!l)return;let d=e.getName();if(!d)return;let p=null==t?void 0:t.get(d);if(!p&&n&&(p=null==t?void 0:t.get(n)),!p&&e.getSourceFile().getFilePath().includes("node_modules")){let t=np(e.getSourceFile().getFilePath());t&&(p=t)}let f=l.getLiteralValue().split(",").map(e=>e.trim());c.set(d,{selectors:f,filePath:e.getSourceFile().getFilePath(),importSource:p}),await ng(d,f,u)}if(e.getProperty("ɵmod")){let n=null==(l=e.getProperty("ɵmod"))?void 0:l.getFirstDescendantByKind(ni.SyntaxKind.TypeReference);if(!n)return;let s=n.getTypeArguments()[2];if(!s)return;let c=s.asKind(ni.SyntaxKind.TupleType);if(!c)return;let u=c.getElements();if(!u||0===u.length)return;let p=e.getName();if(!p)return;for(let e of u)await nb(e,t||new Map,p,r,i,o,a);d.set(p,{imports:u.map(e=>e.getText()),filePath:e.getSourceFile().getFilePath()})}if(e.getDecorator("Component")){let n=await nv(e,t,r,i);if(!n)return;let s=n.getElements();if(!s||0===s.length)return;for(let e of s)await nb(e,t||new Map,void 0,r,i,o,a)}}async function nS(e,t){let n=e.getCompilerOptions().configFilePath,r="string"==typeof n?o().dirname(n):process.cwd(),i=(null==t?void 0:t.baseDirectory)||r,s=t4(e.getSourceFiles(),(null==t?void 0:t.ignorePattern)||[],i),l=new Map,c=new Map,d=new Map,u=await nc(),p=new Set,f=new Set,m=[];for(let e of s)m.push(e.getFilePath());for(;m.length;){let t=m.shift();if(f.has(t))continue;f.add(t);let n=e.getSourceFile(t);if(!n)continue;let r=n.getImportDeclarations(),i=new Map;for(let e of(r.forEach(e=>{e.getNamedImports().forEach(t=>{i.set(t.getName(),e.getModuleSpecifierValue())})}),n.getClasses())){let t=`${e.getName()}@${e.getSourceFile().getFilePath()}`;p.has(t)||(p.add(t),await nx(e,i,void 0,u,l,c,p))}for(let e of r){let t=e.getModuleSpecifierSourceFile();if(t){let e=t.getFilePath();f.has(e)||m.push(e)}}}for(let e of s){let t=e.getImportDeclarations(),n=new Map;for(let r of(t.forEach(e=>{e.getNamedImports().forEach(t=>{n.set(t.getName(),e.getModuleSpecifierValue())})}),e.getClasses())){var _,h,g;let e=r.getName();if(!e)continue;let t=r.getDecorator("Component");if(!t)continue;let o=t.getCallExpression();if(!o)continue;let s=o.getArguments();if(0===s.length)continue;let c=s[0];if(!c)continue;let p=c.asKind(ni.SyntaxKind.ObjectLiteralExpression);if(!p)continue;let f=null==(_=p.getProperty("templateUrl"))?void 0:_.asKind(ni.SyntaxKind.PropertyAssignment);if(f){let t=null==(g=f.getInitializerIfKind(ni.SyntaxKind.StringLiteral))?void 0:g.getLiteralValue();if(t){let o=r.getSourceFile().getDirectory().getPath()+"/"+t;try{let t=(0,a.readFileSync)(o,"utf-8");await ny(t,e,r.getSourceFile().getFilePath(),i,u,l,d,n)}catch(e){console.error(`Error reading template file ${o}:`,e instanceof Error?e.message:String(e))}}}let m=null==(h=p.getProperty("template"))?void 0:h.asKind(ni.SyntaxKind.PropertyAssignment);if(m){let t,o=m.getInitializer(),a=null==o?void 0:o.asKind(ni.SyntaxKind.StringLiteral);a&&(t=a.getLiteralValue());let s=null==o?void 0:o.asKind(ni.SyntaxKind.NoSubstitutionTemplateLiteral);s&&(t=s.getLiteralValue());let c=null==o?void 0:o.asKind(ni.SyntaxKind.TemplateExpression);c&&(t=c.getText().slice(1,-1)),t&&await ny(t,e,r.getSourceFile().getFilePath(),i,u,l,d,n)}}}let y=Array.from(d.values()).map(e=>({name:e.name,count:e.count,package:e.package,files:e.files,props:e.props,framework:"angular"})),b=null==t?void 0:t.baseDirectory;return y.map(e=>{var t;let n=function(e,t,n){if(!e||!e.startsWith(".")&&!e.startsWith("/")&&!e.includes("node_modules")&&/^[A-Za-z0-9@][A-Za-z0-9@/_.-]*$/.test(e))return e;if(e.includes("node_modules")){let t=np(e);if(t)return t;let n=e.split(o().sep).join("/"),r=n.lastIndexOf("node_modules/");if(-1!==r){let e=n.substring(r+13);return e=(e=e.replace(/\/index\.(d\.ts|js|mjs|ts)$/i,"")).replace(/\.(d\.ts|js|mjs|ts)$/i,"")}return e}let r=n||t,i=e;return e.startsWith(".")&&(i=o().resolve(t,e)),o().isAbsolute(i)||(i=o().resolve(t,i)),(o().relative(r,i)||".").split(o().sep).join("/")}(e.package,i,b),r=null==(t=e.files)?void 0:t.map(e=>b?o().relative(b,o().resolve(i,e)):o().relative(i,o().resolve(i,e)));return{...e,package:n,files:r}})}async function nE(e){let t=o().resolve(e);if(await nT(t))return{isMonorepo:!0,frameworks:await nA(t)};{let e=await nD(t);return{isMonorepo:!1,frameworks:e?[e]:[]}}}async function nT(e){return(await t3(e,"**/package.json",["node_modules/**"])).length>1}async function nA(e){let t=[];for(let n of(await t3(e,"**/package.json",["node_modules/**"]))){let e=o().dirname(n),r=await nD(e);r&&t.push(r)}return t}async function nD(e){let t=await nP(e);if(!t)return null;let n=o().join(e,"package.json"),r=await nN(t);if(r)return{framework:"react",version:r.version,packageJsonPath:n,directory:e};let i=await nC(e,t);return i?{framework:"angular",version:i.version,packageJsonPath:n,directory:e,tsconfigPath:i.tsconfigPath}:{framework:"unknown",packageJsonPath:n,directory:e}}async function nC(e,t){let n={...t.dependencies,...t.devDependencies,...t.peerDependencies};if(n["@angular/core"]){let t=n["@angular/core"];return{version:t,tsconfigPath:await nI(e)}}return null}async function nI(e){let t=["tsconfig.app.json","tsconfig.lib.json","tsconfig.json"];for(let r of t){let t=o().join(e,r);try{return await (0,n.stat)(t),t}catch{}}let r=o().join(e,"src","tsconfig.json");try{return await (0,n.stat)(r),r}catch{}try{let n=await t3(e,"**/tsconfig*.json",["node_modules/**"]);if(n.length>0){for(let e of t){let t=n.find(t=>o().basename(t)===e);if(t)return t}return n[0]}}catch{}}async function nN(e){let t={...e.dependencies,...e.devDependencies,...e.peerDependencies};return t.react?{version:t.react}:null}async function nP(e){try{let t=o().join(e,"package.json"),r=await (0,n.readFile)(t,"utf-8");return JSON.parse(r)}catch{return null}}async function nR(e,t,r,i){let o=await t3(e,t,r);if(0===o.length)throw Error("Can't find any relevant files");null==i||i.info({directory:e,extensions:t,ignorePattern:r,filesFound:o.length},"Starting color usage analysis");let a=[],s=new Map;for(let t of o)try{let r=await (0,n.readFile)(t,"utf-8"),o=nw(r);if(o.totalCount>0){let n=t.slice(e.length);s.set(n,o),null==i||i.info({file:n,colorUsage:o},"Found color usage in file")}}catch(n){let e={file:t,error:n,message:`Error parsing ${t}`};a.push(e),null==i||i.error(e,"Error parsing file for color usage")}return{errors:a,usage:s}}async function nM(e,t,n=[]){let r=[],i=[];try{let o=await nE(e),a=o.frameworks.filter(e=>"angular"===e.framework);if(a.length>0)for(let s of(null==t||t.info({angularProjects:a.length,isMonorepo:o.isMonorepo,projectPaths:a.map(e=>e.directory),allFrameworks:o.frameworks},"Angular projects detected, running Angular analysis"),a)){if(!s.tsconfigPath){null==t||t.info({project:s.directory},"No tsconfig found - skipping");continue}try{let r=new ni.Project({tsConfigFilePath:s.tsconfigPath,skipFileDependencyResolution:!1}),o=r.getSourceFiles(),a=t4(o,n,e);if(a.length>0){null==t||t.info({project:s.directory,tsConfigPath:s.tsconfigPath,fileCount:a.length,totalFileCount:o.length},"Running Angular analysis on project");try{let t=await nS(r,{baseDirectory:e,ignorePattern:n});t.length>0&&i.push(...t)}catch(e){throw null==t||t.error({project:s.directory,error:e,stack:e instanceof Error?e.stack:void 0},"Error during Angular analysis"),Error(`Error during Angular analysis of ${s.directory}: ${e instanceof Error?e.message:String(e)}`)}}}catch(n){let e={file:s.directory,error:n,message:`Error during analysis of ${s.directory}: ${n instanceof Error?n.message:String(n)}`};r.push(e),null==t||t.error({error:n,project:s.directory,tsConfigPath:s.tsconfigPath,errorMessage:n instanceof Error?n.message:String(n)},"Error in Angular analysis for project")}}}catch(n){let e={file:"Framework detection",error:n,message:`Error during framework detection: ${n instanceof Error?n.message:String(n)}`};r.push(e),null==t||t.error({error:n,errorMessage:n instanceof Error?n.message:String(n)},"Error detecting frameworks, skipping Angular analysis")}return{errors:r,usage:i}}async function nk(e,t,r,i){let o=await t3(e,t,r);if(0===o.length)throw Error("Can't find any relevant files");null==i||i.info({directory:e,extensions:t,ignorePattern:r,filesFound:o.length},"Starting component usage analysis");let a=[],s=new Map;for(let t of o)try{let r=await (0,n.readFile)(t,"utf-8"),{ast:o,errors:l}=function(e,t){let n=nr().parseSync(e,{sourceFilename:t,sourceType:"module"});return{ast:JSON.parse(n.program),errors:n.errors}}(r,t);if(l.length>0){let e={file:t,error:l,message:`Error parsing ${t}`};a.push(e),null==i||i.error(e,"AST parsing errors");continue}let c=function(e){let t={components:new Map,props:new Map,imports:new Map},n={CatchClause(){},CatchParameter(){},ComputedMemberExpression(){},JSXText(){},NullLiteral(){},NumericLiteral(){},BooleanLiteral(){},ObjectExpression(){},ObjectProperty(){},StringLiteral(){},TSAsExpression(){},TSEnumDeclaration(){},TSInterfaceDeclaration(){},TSTypeAliasDeclaration(){},TSModuleDeclaration(){},TSSatisfiesExpression(){},StaticMemberExpression(){},RegExpLiteral(){},TSNonNullExpression(){},JSXEmptyExpression(){},JSXFragment(e,t){e.children.forEach(e=>t5(e,t,n,ne))},IfStatement(e,t){t5(e.consequent,t,n,ne),e.alternate&&t5(e.alternate,t,n,ne)},VariableDeclaration(e,t){e.declarations.forEach(e=>{t5(e,t,n,ne)})},ArrowFunctionExpression(e,t){"FunctionBody"===e.body.type&&t5(e.body,t,n,ne)},ParenthesizedExpression(e,t){t5(e.expression,t,n,ne)},ReturnStatement(e,t){e.argument&&t5(e.argument,t,n,ne)},FunctionBody(e,t){e.statements.forEach(e=>t5(e,t,n,ne))},Program(e,t){e.body.forEach(e=>{t5(e,t,n,ne)})},JSXElement(e,t){var r;let i=e.openingElement,o=(e=>{let t=e=>"JSXIdentifier"===e.type?e.name:`${t(e.object)}.${t(e.property)}`;return t(e.name)})(i);if((null==o?void 0:o[0])!==(null==o||null==(r=o[0])?void 0:r.toLocaleLowerCase())){if(i.attributes.length>0){let e=[];i.attributes.forEach(t=>{if(t.name){var n,r,i;if((null==(n=t.value)?void 0:n.type)==="JSXExpressionContainer"){let n=t.value.expression.type;n&&nt.includes(n)?e.push({name:t.name.name,type:[n],values:["zh-runtime-value"]}):n&&"ObjectExpression"===n?e.push({name:t.name.name,type:[n],values:["zh-object-value"]}):n&&"ArrayExpression"===n?e.push({name:t.name.name,type:[n],values:["zh-array-value"]}):n&&"BinaryExpression"===n?e.push({name:t.name.name,type:[n],values:["zh-binary-value"]}):e.push({name:t.name.name,type:[n],values:[t.value.expression.value||t.value.expression.name]})}else e.push({name:t.name.name,type:[null==(r=t.value)?void 0:r.type],values:[null==(i=t.value)?void 0:i.value]})}});let n=t.props.get(o)??[];t.props.set(o,[...e,...n])}t.components.set(o,(t.components.get(o)??0)+1)}e.children.forEach(e=>{t5(e,t,n,ne)})},CallExpression(e,t){e.arguments.forEach(e=>t5(e,t,n,ne))},ExportDefaultDeclaration(e,t){if("FunctionDeclaration"===e.declaration.type){let{statements:r}=e.declaration.body;r.forEach(e=>{t5(e,t,n,ne)})}},JSXExpressionContainer(e,t){t5(e.expression,t,n,ne)},ImportDeclaration(e,t){var n,r;let i=(null==(n=e.source.value)?void 0:n.toString())??"";null==(r=e.specifiers)||r.forEach(e=>{if("ImportNamespaceSpecifier"===e.type)return;let n=e.local.name;"ImportDefaultSpecifier"===e.type||"Identifier"===e.type?n=e.local.name:"ImportSpecifier"===e.type&&(n="Literal"===e.imported.type?e.imported.value:e.imported.name),t.imports.set(e.local.name,{package:i,name:n})})}};try{t5(e,t,n,ne)}finally{return function(e){let t=new Map,n=t=>{if(t.includes(".")){let[n,...r]=t.split(".");if(void 0===n)return;let i=e.imports.get(n);return{...i,name:[(null==i?void 0:i.name)??n,...r].join(".")}}return e.imports.get(t)};for(let[r,i]of e.components){let e=n(r),o=(null==e?void 0:e.name)??r,a=(null==e?void 0:e.package)??"",s=`package:${a} name:${o}`,l=t.get(s)??{name:o,count:0,package:(null==e?void 0:e.package)??"",props:{},framework:"react"};t.set(s,{...l,count:l.count+i,props:{}})}for(let[r,i]of e.props){let e=n(r),o=(null==e?void 0:e.name)??r,a=(null==e?void 0:e.package)??"",s=`package:${a} name:${o}`,l=t.get(s),c=l.props;i.forEach(e=>{var t,n;c[e.name]={type:Array.from(new Set([...(null==(t=c[e.name])?void 0:t.type)??[],...e.type??[]])),values:[...(null==(n=c[e.name])?void 0:n.values)??[],...e.values]}}),t.set(s,{...l,props:c})}return Array.from(t.values())}(t)}}(o);if(c.length>0){let n=t.slice(e.length);s.set(n,c),null==i||i.info({file:n,ast:o,usage:c},"Found component usage in file")}}catch(n){let e={file:t,error:n,message:`Error parsing ${t}`};a.push(e),null==i||i.error(e,"Error parsing file for component usage")}return{errors:a,usage:s}}function nw(e){let t=Array.from(e.match(/#([a-fA-F0-9]{6}|[a-fA-F0-9]{8})\b|#([a-fA-F0-9]{3})\b/gi)??[]),n=Array.from(e.match(/rgba?\(\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),r=Array.from(e.match(/hsl(?:a)?\(\s*(?:(?:none|from\s+[a-zA-Z#0-9()]+)?\s*(?:[a-z\d+\-*/%()\s]+)\s*|(\d+(?:deg|grad|rad|turn)?)\s*(\d+%?)\s*(\d+%?)\s*(?:\/\s*(\d+%?|0?\.\d+))?|(\d+(?:deg|grad|rad|turn)?)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(?:,\s*(\d+(\.\d+)?%?))?)\)/g)??[]),i=Array.from(e.match(/okl(?:ab|ch)\(\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),o=Array.from(e.match(/hwb\(\s*(\d*\.?\d+)(?:deg|turn|rad|grad)?\s*[,\s]\s*(\d*\.?\d+%)\s*[,\s]\s*(\d*\.?\d+%)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),a=Array.from(e.match(/(?<!ok)lab\(\s*(-?\d*\.?\d+%)\s*[,\s]\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),s=Array.from(e.match(/(?<!ok)lch\(\s*(-?\d*\.?\d+%)\s*[,\s]\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),l=Array.from(e.match(/color\(\s*([\w-]+)\s+(?:[-+]?\d*\.?\d+(?:e[-+]?\d+)?%?\s*){3,4}\)/g)??[]);return{hex:t,rgb:n,hsla:r,oklab:i,hwb:o,lab:a,lch:s,colorSpace:l,totalCount:t.length+n.length+r.length+o.length+a.length+s.length+l.length+i.length}}function nL(e){let t=new Map;for(let[n,r]of e)for(let{count:e,package:i,name:a,props:s,framework:l}of r){let r=i;if(i.startsWith(".")){let e=o().dirname(n),t=o().join(e,i);r=o().normalize(t)}let c=`package:${r} name:${a}`,d=t.get(c),u=[...(null==d?void 0:d.files)??[],n];t.set(c,{name:(null==d?void 0:d.name)??a,files:Array.from(new Set(u)),count:e+((null==d?void 0:d.count)??0),package:r,props:function(e,t){if(!t)return e;if(!e)return t;let n=Array.from(new Set([...Object.keys(t),...Object.keys(e)])),r={};return n.forEach(n=>{let i=t[n]??{},o=e[n],a=[...(null==i?void 0:i.values)??[],...(null==o?void 0:o.values)??[]];r[n]={type:Array.from(new Set([...i.type??[],...(null==o?void 0:o.type)??[]])),count:a.length,values:a}}),r}(s,(null==d?void 0:d.props)??{}),framework:(null==d?void 0:d.framework)??l})}return Array.from(t.values())}function nO(e){let t=new Map;for(let[n,{hex:r,rgb:i,hsla:o}]of e)for(let e of[...r,...i,...o]){let r=t.get(e),i=[...(null==r?void 0:r.files)??[],n];t.set(e,{value:e,type:"color",files:i,count:((null==r?void 0:r.count)??0)+1})}return Array.from(t.values())}})(),r.Analyzers=u.Analyzers,r.Transformers=u.Transformers,u)-1===["Analyzers","Transformers"].indexOf(p)&&(r[p]=u[p]);Object.defineProperty(r,"__esModule",{value:!0})})()},880:function(e,t,n){var r={"./89":"182","./89.js":"182","./main":"929","./main.d":"5","./main.d.ts":"5","./main.js":"929"};function i(e){return n(o(e))}function o(e){if(!n.o(r,e)){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}i.keys=function(){return Object.keys(r)},i.resolve=o,e.exports=i,i.id=880},5:function(e,t,n){n.r(t)},584:function(e,t,n){n.a(e,async function(e,r){try{n.d(t,{Z:()=>x});var i=n(810),o=n(725),a=n(92),s=n(381),l=n(468),c=n(307),d=n(772),u=n(306),p=n(512),f=n(448),m=n(999);let e=new o.Command;async function _(){let e=await fetch("https://registry.npmjs.org/@zeroheight/adoption-cli/latest");return(await e.json()).version}let{output:h,cleanup:g}=(0,a.render)(i.createElement(s.Z,null)),{output:y,cleanup:b}=(0,a.render)(i.createElement(l.Z,{latestVersion:await _()}));e.name("zh-adoption").description("CLI for measuring design system usage usage in your products").version("4.0.2").addHelpText("before",h).option("--log-file <path>","Path to write logs to, if not provided logs only error logs will be written to stderr").addOption(new o.Option("--log-level <level>","The lowest level of logs to display").default("error").choices(["fatal","error","warn","info"])).addCommand((0,c.O)()).addCommand((0,d.G)()).addCommand((0,u.C)()).addCommand((0,p.G)()).hook("preAction",async(e,t)=>{f.ZP.level=e.opts().logLevel,e.opts().logFile&&(0,f.H4)(e.opts().logFile),f.ZP.info({command:{name:t.name(),opts:t.opts(),globalOpts:e.opts()}},"Running command");let n=await _();(0,m.lt)("4.0.2",n)&&console.log(y)}),g(),b(),"test"!==process.env.NODE_ENV&&e.parse();let x=e;r()}catch(e){r(e)}},1)},307:function(e,t,n){n.d(t,{O:()=>N});var r=n(810),i=n(149),o=n(725),a=n(904),s=n(367),l=n(165),c=n(950),d=n(795);function u({onContinue:e,dryRun:t}){let[n,o]=r.useState("");return r.createElement(i.Box,null,r.createElement(i.Text,null,t?r.createElement(r.Fragment,null,"Continue to next step? ",r.createElement(i.Text,{dimColor:!0},"(Y/n):")):r.createElement(r.Fragment,null,"Send this data to ",r.createElement(i.Text,{color:"#f63e7c"},"zeroheight"),"?"," ",r.createElement(i.Text,{dimColor:!0},"(Y/n)"))),r.createElement(d.Z,{isChecked:!0,value:n,onChange:o,onSubmit:t=>{e(t)}}))}function p({dataType:e}){return r.createElement(r.Fragment,null,r.createElement(i.Text,null,"Nothing sent to zeroheight, if you want to track ",e," data then remove the ",r.createElement(i.Text,{italic:!0},"--dry-run")," option."),r.createElement(i.Newline,null))}function f({dataType:e}){return r.createElement(r.Fragment,null,r.createElement(p,{dataType:e}),r.createElement(i.Text,null,"\uD83D\uDC4B See you next time!"))}var m=n(432),_=n(40),h=n(22),g=n(829),y=n(651);function b({credentials:e,onRepoNameSelected:t}){let[n,o]=r.default.useState("LOADING"),[a,s]=r.default.useState([]),[c,d]=r.default.useState("");async function u(e){try{let t=await (0,h.ru)(e);if(t.status!==h.Mx.Success)throw Error("Failed to get repo names");let n=t.data.repo_names;s(n),0===n.length?o("ENTER_REPO_NAME"):o("SELECT_REPO_NAME")}catch(e){o("ERROR")}}if(r.default.useEffect(()=>{e&&(o("LOADING"),(0,_.zi)().then(n=>{var r;let i=null==n||null==(r=n.repoNames)?void 0:r[process.cwd()];i?t(i):u(e)}))},[e]),"LOADING"===n)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:"cyan"},r.default.createElement(l.default,{type:"dots"}))," ","Fetching repository names..."));if("ERROR"===n)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:"red"},"Error:"),r.default.createElement(i.Box,{flexDirection:"column",marginLeft:1},r.default.createElement(i.Text,null,"- Failed to fetch repository names")));if("SELECT_REPO_NAME"===n){let e=[{label:"Enter repository name",value:"enter-repository-name"},...a.map(e=>({label:e,value:e}))];return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"Select the repository name"),r.default.createElement(y.Z,{as:"select",options:e,onChange:function(e){if("enter-repository-name"===e)return void o("ENTER_REPO_NAME");t(e)}}))}return"ENTER_REPO_NAME"===n?r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Repository name: "),r.default.createElement(g.default,{value:c,onChange:d,onSubmit:e=>{0!==e.trim().length&&t(e)}})):null}function x({usage:e}){let t=Array.from(e.entries());return r.createElement(i.Box,{flexDirection:"column"},t.map(([e,t])=>r.createElement(i.Box,{key:e,flexDirection:"column"},r.createElement(i.Text,{color:"green"},e),r.createElement(i.Box,{flexDirection:"column",marginLeft:2},t.map(({name:t,count:n})=>r.createElement(i.Box,{gap:2,key:`${t}-${e}`},r.createElement(i.Text,{bold:!0},n),r.createElement(i.Text,null,t)))))))}var S=n(410);let E={hex:"HEX",rgb:"RGB",hsla:"HSL",oklab:"Oklab",hwb:"HWB",lab:"LAB",lch:"LCH",colorSpace:"Color space",totalCount:"Total usage"};function T({usage:e}){let t=Array.from(e.entries());return r.createElement(i.Box,{flexDirection:"column"},t.map(([e,t])=>{let n=Object.entries(t);return r.createElement(i.Box,{key:e,flexDirection:"column"},r.createElement(i.Text,{color:"green"},e),r.createElement(i.Box,{flexDirection:"column",marginLeft:2},r.createElement(i.Box,{flexDirection:"column",marginLeft:2},n.map(([e,t])=>{if("totalCount"===e)return null;let n=t.length;if(0===n)return null;let o=E[e];return r.createElement(i.Box,{gap:2,key:`${e}-${n}`},r.createElement(i.Text,{bold:!0},o,": "),r.createElement(i.Text,null,n))})),r.createElement(i.Text,{bold:!0},"Total usage: ",t.totalCount)))}))}function A({dryRun:e,onAnalyzeFiles:t,onAnalyzeColorUsage:n,shouldAnalyzeComponentUsage:o,shouldAnalyzeTokenUsage:a,repoName:g}){let{exit:y}=(0,i.useApp)(),[E,A]=r.default.useState(0),[D,C]=r.default.useState(new Map),[I,N]=r.default.useState(null),[P,R]=r.default.useState(new Map),[M,k]=r.default.useState([]),[w,L]=r.default.useState(null),[O,F]=r.default.useState(null),[W,B]=r.default.useState((0,h.jM)()),[z,G]=r.default.useState(g),[j,K]=r.default.useState(""),[V,U]=r.default.useState(""),[H,q]=r.default.useState(""),[J,$]=r.default.useState("");async function X(){try{let{errorFile:e,usage:n,angular:r}=await t();L(e),C(n),N(r),A(5)}catch(e){k(t=>[...t,e])}}async function Y(t){if(t){if(e)return void A(12);let t=await Q();if(!t)return void A(8);if(!z)return void A(9);A(10),Z({react:D,angular:I},z,t)}else A(12)}async function Q(){try{let e=await (0,_.zi)();if(e)return F({token:e.token,client:e.client}),{token:e.token,client:e.client};return null}catch(e){return k(e=>[...e,"Failed to load credentials"]),null}}async function Z(e,t,n){try{var r;await (0,h.BW)(e,t,n);let i=await (0,h.lx)(n);if(i.status!==h.Mx.Success)throw Error("Failed to get credentials");let o=null==(r=i.data.project)?void 0:r.id,a=(0,h.jM)();a.pathname=o?`/project/${o}/adoption/`:"/adoption/",B(a),A(11)}catch(t){let e="Failed to send data to zeroheight";t instanceof S.MS&&(e=t.message),k(t=>[...t,e])}}async function ee(e,t){try{await (0,h.lx)({token:t,client:e})}catch{return k(["Auth credentials are not valid"]),y()}}function et(e){e?(A(13),en()):A(1)}async function en(){try{let{errorFile:e,usage:t}=await n();L(e),R(t),A(14)}catch(e){k(t=>[...t,e])}}async function er(t){if(t){if(e)return void A(1);let t=await Q();if(!t)return void A(17);if(!z)return void A(18);A(19),ei(P,z,t)}else A(1),y()}async function ei(e,t,n){try{var r;await (0,h.$O)(e,t,n);let i=await (0,h.lx)(n);if(i.status!==h.Mx.Success)throw Error("Failed to get credentials");let o=null==(r=i.data.project)?void 0:r.id,a=(0,h.jM)();a.pathname=o?`/project/${o}/adoption/`:"/adoption/",B(a),A(20)}catch(t){let e="Failed to send data to zeroheight";t instanceof S.MS&&(e=t.message),k(t=>[...t,e])}}if(r.default.useEffect(()=>{a||o||(k(e=>[...e,"Invalid arguments! --component-usage and --color-usage cannot both be false."]),A(1))},[]),M.length>0)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:"red"},"Error:"),r.default.createElement(i.Box,{flexDirection:"column",marginLeft:1},M.map(e=>r.default.createElement(r.default.Fragment,{key:e},r.default.createElement(i.Text,{key:e},e),r.default.createElement(i.Newline,null)))));if(0===E)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"\uD83D\uDC4B Welcome to the ",r.default.createElement(i.Text,{color:"#f63e7c"},"zeroheight")," analyze tool"),r.default.createElement(i.Newline,null),o&&r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how components are being used (Angular and React)?"," ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(d.Z,{isChecked:!0,value:V,onChange:U,onSubmit:function(e){e?(A(4),X()):a?A(12):(A(1),y())}})),!o&&a&&r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how colors are being used? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(d.Z,{isChecked:!0,value:H,onChange:q,onSubmit:et})));if(4===E)return r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:"green"},r.default.createElement(l.default,{type:"dots"}))," Scanning files for component usage...");if(5===E)if((null==D?void 0:D.size)>0||I&&I.length>0)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:"green"},(0,s.G2)({react:D,angular:I})," ","components found"),w&&r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,{color:"red"},"Error:"),r.default.createElement(i.Text,null," ","Some files could not be parsed. Errors can be found at"," ",r.default.createElement(c.default,{url:w},w)))),r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Show more details? ",r.default.createElement(i.Text,{dimColor:!0},"(y/N)")),r.default.createElement(d.Z,{isChecked:!1,value:J,onChange:$,onSubmit:function(e){e?A(6):A(7)}})));else return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"No files found, try a different directory or change the file extensions you want to include.")),a?r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Continue to token usage analysis? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(d.Z,{isChecked:!0,value:j,onChange:K,onSubmit:function(e){e?A(12):A(1)}})):r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"\uD83D\uDC4B See you next time!")));if(6===E)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(x,{usage:function(e,t){if(null===e)return t;let n=new Map(t);for(let t of e)for(let e of t.files||[]){let r=n.get(e)||[];r.push({name:t.name,count:t.count,package:t.package,props:t.props,framework:t.framework}),n.set(e,r)}return n}(I,D)}),r.default.createElement(i.Newline,null),e?r.default.createElement(r.default.Fragment,null,r.default.createElement(p,{dataType:"component usage"}),r.default.createElement(u,{dryRun:!0,onContinue:()=>Y(!1)})):r.default.createElement(u,{onContinue:Y}));if(7===E)return r.default.createElement(i.Box,{flexDirection:"column"},e?r.default.createElement(r.default.Fragment,null,r.default.createElement(p,{dataType:"component usage"}),r.default.createElement(u,{dryRun:!0,onContinue:()=>Y(!1)})):r.default.createElement(u,{onContinue:Y}));if(8===E||17===E)return r.default.createElement(m.Z,{configPath:(0,_.qA)(),onCheckCredentials:ee,onSaveCredentials:async(e,t,n)=>{F({token:n,client:t}),e&&await (0,_.iL)({client:t,token:n}),8===E?(Y(!0),A(10)):(er(!0),A(19))}});if(9===E||18===E)return r.default.createElement(b,{credentials:O,onRepoNameSelected:function(e){G(e),(0,_.iL)({repoNames:{[process.cwd()]:e}}),9===E?(Y(!0),A(10)):(er(!0),A(19))}});if(10===E||19===E)return r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:"green"},r.default.createElement(l.default,{type:"dots"}))," ","Sending usage data to ",r.default.createElement(i.Text,{color:"#f63e7c"},"zeroheight"),"...");if(11===E)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:"green"},"Successfully sent:")," View your"," ",r.default.createElement(c.default,{url:W.toString()},r.default.createElement(i.Text,{underline:!0,color:"#f63e7c"},"usage data on zeroheight"))),r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how colors are being used? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(d.Z,{isChecked:!0,value:H,onChange:q,onSubmit:et})));if(12===E)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how colors are being used? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(d.Z,{isChecked:!0,value:H,onChange:q,onSubmit:et})));if(13===E)return r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:"green"},r.default.createElement(l.default,{type:"dots"}))," Scanning files for color usage...");if(14===E)if((null==P?void 0:P.size)>0)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:"green"},(0,s.IJ)(P)," instances of raw color usage found"),w&&r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,{color:"red"},"Error:"),r.default.createElement(i.Text,null," ","Some files could not be parsed. Errors can be found at"," ",r.default.createElement(c.default,{url:w},w)))),r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Show more details? ",r.default.createElement(i.Text,{dimColor:!0},"(y/N)")),r.default.createElement(d.Z,{isChecked:!1,value:J,onChange:$,onSubmit:function(e){e?A(15):A(16)}})));else return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"No files found, try a different directory or change the file extensions you want to include."));return 15===E?e?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(T,{usage:P}),r.default.createElement(i.Newline,null),r.default.createElement(f,{dataType:"color usage"})):r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(T,{usage:P}),r.default.createElement(i.Newline,null),r.default.createElement(u,{onContinue:er})):16===E?e?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(f,{dataType:"color usage"})):r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(u,{onContinue:er})):20===E?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:"green"},"Successfully sent:")," View your"," ",r.default.createElement(c.default,{url:W.toString()},r.default.createElement(i.Text,{underline:!0,color:"#f63e7c"},"usage data on zeroheight"))),r.default.createElement(i.Newline,null),r.default.createElement(i.Text,null,"\uD83D\uDC4B See you next time!")):1===E?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"\uD83D\uDC4B See you next time!")):r.default.createElement(i.Text,null,"Analyze complete")}function D({dryRun:e,onAnalyzeFiles:t,onAnalyzeColorUsage:n,shouldAnalyzeComponentUsage:o,shouldAnalyzeTokenUsage:a,repoName:d}){let[u,p]=r.default.useState(!1),[f,m]=r.default.useState(!1),[g,y]=r.default.useState(!1),[b,x]=r.default.useState(null),[E,T]=r.default.useState([]),[A,D]=r.default.useState(null),[C,I]=r.default.useState(null),[N,P]=r.default.useState(null),[R,M]=r.default.useState(null);async function k(){y(!0);try{let e=await (0,_.zi)();return e&&D({token:e.token,client:e.client}),e}catch(e){T(e=>[...e,"Failed to load credentials"])}finally{y(!1)}return null}async function w(e,t,n){p(!0);try{await (0,h.BW)(e,t,n)}catch(t){let e="Failed to send component usage data to zeroheight";t instanceof S.MS&&(e=t.message),T(t=>[...t,e])}finally{p(!1)}}async function L(e,t,n){p(!0);try{await (0,h.$O)(e,t,n)}catch(t){let e="Failed to send color usage data to zeroheight";t instanceof S.MS&&(e=t.message),T(t=>[...t,e])}finally{p(!1)}}async function O(){m(!0);let{errorFile:e,usage:n,angular:r}=await t();return I(n),P(r),e&&x(e),m(!1),{react:n,angular:r}}async function F(){m(!0);let{errorFile:e,usage:t}=await n();return M(t),e&&x(e),m(!1),t}return(r.default.useEffect(()=>{(async()=>{let t=await k();if(t&&d){if(o){let n=await O();e||await w(n,d,t)}if(a){let n=await F();e||await L(n,d,t)}}})()},[]),f||g||u)?r.default.createElement(i.Text,null,r.default.createElement(l.default,{type:"dots"})," ",f&&r.default.createElement(i.Text,null,"Analyzing files"),g&&r.default.createElement(i.Text,null,"Loading credentials"),u&&r.default.createElement(i.Text,null,"Sending data to zeroheight")):E.length>0?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:"red"},"Error:"),r.default.createElement(i.Box,{flexDirection:"column",marginLeft:1},E.map(e=>r.default.createElement(i.Text,{key:e},"- ",e)))):b?r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,{color:"red"},"Error:"),r.default.createElement(i.Text,null," ","Some files could not be parsed. Errors can be found at"," ",r.default.createElement(c.default,{url:b},b)))):d?A?C||R?r.default.createElement(r.default.Fragment,null,C&&r.default.createElement(i.Text,{color:"green"},(0,s.G2)({react:C,angular:N})," ","components found",e?" (dry run - not sent)":" and sent to",!e&&r.default.createElement(i.Text,{color:"#f63e7c"}," zeroheight")),R&&r.default.createElement(i.Text,{color:"green"},(0,s.IJ)(R)," usages of raw colors found",e?" (dry run - not sent)":" and sent to",!e&&r.default.createElement(i.Text,{color:"#f63e7c"}," zeroheight"))):r.default.createElement(i.Text,null,"No usage could be found."):r.default.createElement(i.Text,null,"Credentials not found, please ensure they are set before running the"," ",r.default.createElement(i.Text,{bold:!0},"analyze")," command with"," ",r.default.createElement(i.Text,{italic:!0},"--interactive false")):r.default.createElement(i.Text,null,r.default.createElement(i.Text,{bold:!0},"Repo name")," not found, run the ",r.default.createElement(i.Text,{bold:!0},"analyze")," ","command in interactive mode or provide the"," ",r.default.createElement(i.Text,{italic:!0},"--repo-name ","<my repo name>")," option")}var C=n(448);async function I(e,t){e.interactive?(0,i.render)(r.createElement(A,{dryRun:e.dryRun,onAnalyzeFiles:()=>(0,s.NT)(e.extensions,e.ignore),onAnalyzeColorUsage:()=>(0,s.hS)(e.extensions,e.ignore),shouldAnalyzeComponentUsage:e.componentUsage,shouldAnalyzeTokenUsage:e.colorUsage,repoName:e.repoName}),t):(0,i.render)(r.createElement(D,{dryRun:e.dryRun,onAnalyzeFiles:()=>(0,s.NT)(e.extensions,e.ignore),onAnalyzeColorUsage:()=>(0,s.hS)(e.extensions,e.ignore),shouldAnalyzeComponentUsage:e.componentUsage,shouldAnalyzeTokenUsage:e.colorUsage,repoName:e.repoName}))}function N(){return new o.Command().command("analyze").description("Analyze your codebase to determine component usage metrics").configureHelp({showGlobalOptions:!0}).addOption(new o.Option("-e, --extensions [ext]","glob pattern for file extensions to include when searching for components. Examples: '**/*.{js,jsx,ts,tsx}', '**/*.js', 'src/**/*.{ts,tsx}'").default("**/*.{js,jsx,ts,tsx}","*.js, *.jsx, *.ts, *.tsx files recursively in all directories").argParser(s.Uc)).addOption(new o.Option("-i, --ignore [patterns]","files to ignore when searching for components, use multiple times to add more than one glob pattern").default(["**/*.{test,spec}.*","**/*.d.ts"],"*.test.*, *.spec.* and *.d.ts files").argParser(s.tu)).addOption(new o.Option("-d, --dry-run","don't push results to zeroheight").default(!1)).addOption(new o.Option("-r, --repo-name <string>","name of the repository")).addOption(new o.Option("-in, --interactive [boolean]","disable to skip input (useful when running in CI)").default(!0).argParser(e=>(0,a.default)(e))).addOption(new o.Option("-cu, --component-usage [boolean]","gather data about component and prop usage").default(!0).argParser(e=>(0,a.default)(e))).addOption(new o.Option("-cou, --color-usage [boolean]","gather data about color usage").default(!0).argParser(e=>(0,a.default)(e))).action(async e=>{e.interactive||(0,C.If)();let t="boolean"==typeof e.ignore?[]:e.ignore;try{await I({...e,ignore:t})}catch(e){C.ZP.error({error:e},"Unhandled exception running analyze command"),process.exitCode=1}})}},367:function(e,t,i){i.d(t,{hS:()=>_,IJ:()=>m,tu:()=>h,g8:()=>d,Uc:()=>g,G2:()=>f,NT:()=>p});var o=i(292),a=i(727),s=i(403),l=i(929),c=i(448);async function d(e,t,i){let l=await u(e),c=(0,r.default)().add("/**/.*").add("/**/.*/").add("node_modules/").add(l),d=[];try{for await(let r of new n.Glob(t,{cwd:e,ignore:i,fs:a})){let t=s.default.join(e,r);(await (0,o.stat)(t)).isDirectory()||c.ignores(r)||d.push(t)}}catch(e){throw Error(`Failed to search files with pattern '${t}': ${e.message}
420
+ Please check your extensions pattern is valid glob syntax.`)}return l}async function t6(e){let t=o().join(e,".gitignore");try{return await (0,n.readFile)(t,"utf-8")}catch(e){return""}}function t4(e,t,n){return e.filter(e=>{let r=e.getFilePath().replace(n,"");return!t.some(e=>P(r,e))})}function t5(e,t,n,r,i){var o=n?function(e,t){var n=Object.create(t||ne);for(var r in e)n[r]=e[r];return n}(n,r||void 0):r;!function e(t,n,r){o[r||t.type](t,n,e)}(e,t,i)}function t7(e,t,n){n(e,t)}function t9(e,t,n){}var ne={};ne.Program=ne.BlockStatement=ne.StaticBlock=function(e,t,n){for(var r=0,i=e.body;r<i.length;r+=1)n(i[r],t,"Statement")},ne.Statement=t7,ne.EmptyStatement=t9,ne.ExpressionStatement=ne.ParenthesizedExpression=ne.ChainExpression=function(e,t,n){return n(e.expression,t,"Expression")},ne.IfStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Statement"),e.alternate&&n(e.alternate,t,"Statement")},ne.LabeledStatement=function(e,t,n){return n(e.body,t,"Statement")},ne.BreakStatement=ne.ContinueStatement=t9,ne.WithStatement=function(e,t,n){n(e.object,t,"Expression"),n(e.body,t,"Statement")},ne.SwitchStatement=function(e,t,n){n(e.discriminant,t,"Expression");for(var r=0,i=e.cases;r<i.length;r+=1)n(i[r],t)},ne.SwitchCase=function(e,t,n){e.test&&n(e.test,t,"Expression");for(var r=0,i=e.consequent;r<i.length;r+=1)n(i[r],t,"Statement")},ne.ReturnStatement=ne.YieldExpression=ne.AwaitExpression=function(e,t,n){e.argument&&n(e.argument,t,"Expression")},ne.ThrowStatement=ne.SpreadElement=function(e,t,n){return n(e.argument,t,"Expression")},ne.TryStatement=function(e,t,n){n(e.block,t,"Statement"),e.handler&&n(e.handler,t),e.finalizer&&n(e.finalizer,t,"Statement")},ne.CatchClause=function(e,t,n){e.param&&n(e.param,t,"Pattern"),n(e.body,t,"Statement")},ne.WhileStatement=ne.DoWhileStatement=function(e,t,n){n(e.test,t,"Expression"),n(e.body,t,"Statement")},ne.ForStatement=function(e,t,n){e.init&&n(e.init,t,"ForInit"),e.test&&n(e.test,t,"Expression"),e.update&&n(e.update,t,"Expression"),n(e.body,t,"Statement")},ne.ForInStatement=ne.ForOfStatement=function(e,t,n){n(e.left,t,"ForInit"),n(e.right,t,"Expression"),n(e.body,t,"Statement")},ne.ForInit=function(e,t,n){"VariableDeclaration"===e.type?n(e,t):n(e,t,"Expression")},ne.DebuggerStatement=t9,ne.FunctionDeclaration=function(e,t,n){return n(e,t,"Function")},ne.VariableDeclaration=function(e,t,n){for(var r=0,i=e.declarations;r<i.length;r+=1)n(i[r],t)},ne.VariableDeclarator=function(e,t,n){n(e.id,t,"Pattern"),e.init&&n(e.init,t,"Expression")},ne.Function=function(e,t,n){e.id&&n(e.id,t,"Pattern");for(var r=0,i=e.params;r<i.length;r+=1)n(i[r],t,"Pattern");n(e.body,t,e.expression?"Expression":"Statement")},ne.Pattern=function(e,t,n){"Identifier"===e.type?n(e,t,"VariablePattern"):"MemberExpression"===e.type?n(e,t,"MemberPattern"):n(e,t)},ne.VariablePattern=t9,ne.MemberPattern=t7,ne.RestElement=function(e,t,n){return n(e.argument,t,"Pattern")},ne.ArrayPattern=function(e,t,n){for(var r=0,i=e.elements;r<i.length;r+=1){var o=i[r];o&&n(o,t,"Pattern")}},ne.ObjectPattern=function(e,t,n){for(var r=0,i=e.properties;r<i.length;r+=1){var o=i[r];"Property"===o.type?(o.computed&&n(o.key,t,"Expression"),n(o.value,t,"Pattern")):"RestElement"===o.type&&n(o.argument,t,"Pattern")}},ne.Expression=t7,ne.ThisExpression=ne.Super=ne.MetaProperty=t9,ne.ArrayExpression=function(e,t,n){for(var r=0,i=e.elements;r<i.length;r+=1){var o=i[r];o&&n(o,t,"Expression")}},ne.ObjectExpression=function(e,t,n){for(var r=0,i=e.properties;r<i.length;r+=1)n(i[r],t)},ne.FunctionExpression=ne.ArrowFunctionExpression=ne.FunctionDeclaration,ne.SequenceExpression=function(e,t,n){for(var r=0,i=e.expressions;r<i.length;r+=1)n(i[r],t,"Expression")},ne.TemplateLiteral=function(e,t,n){for(var r=0,i=e.quasis;r<i.length;r+=1)n(i[r],t);for(var o=0,a=e.expressions;o<a.length;o+=1)n(a[o],t,"Expression")},ne.TemplateElement=t9,ne.UnaryExpression=ne.UpdateExpression=function(e,t,n){n(e.argument,t,"Expression")},ne.BinaryExpression=ne.LogicalExpression=function(e,t,n){n(e.left,t,"Expression"),n(e.right,t,"Expression")},ne.AssignmentExpression=ne.AssignmentPattern=function(e,t,n){n(e.left,t,"Pattern"),n(e.right,t,"Expression")},ne.ConditionalExpression=function(e,t,n){n(e.test,t,"Expression"),n(e.consequent,t,"Expression"),n(e.alternate,t,"Expression")},ne.NewExpression=ne.CallExpression=function(e,t,n){if(n(e.callee,t,"Expression"),e.arguments)for(var r=0,i=e.arguments;r<i.length;r+=1)n(i[r],t,"Expression")},ne.MemberExpression=function(e,t,n){n(e.object,t,"Expression"),e.computed&&n(e.property,t,"Expression")},ne.ExportNamedDeclaration=ne.ExportDefaultDeclaration=function(e,t,n){e.declaration&&n(e.declaration,t,"ExportNamedDeclaration"===e.type||e.declaration.id?"Statement":"Expression"),e.source&&n(e.source,t,"Expression")},ne.ExportAllDeclaration=function(e,t,n){e.exported&&n(e.exported,t),n(e.source,t,"Expression")},ne.ImportDeclaration=function(e,t,n){for(var r=0,i=e.specifiers;r<i.length;r+=1)n(i[r],t);n(e.source,t,"Expression")},ne.ImportExpression=function(e,t,n){n(e.source,t,"Expression")},ne.ImportSpecifier=ne.ImportDefaultSpecifier=ne.ImportNamespaceSpecifier=ne.Identifier=ne.PrivateIdentifier=ne.Literal=t9,ne.TaggedTemplateExpression=function(e,t,n){n(e.tag,t,"Expression"),n(e.quasi,t,"Expression")},ne.ClassDeclaration=ne.ClassExpression=function(e,t,n){return n(e,t,"Class")},ne.Class=function(e,t,n){e.id&&n(e.id,t,"Pattern"),e.superClass&&n(e.superClass,t,"Expression"),n(e.body,t)},ne.ClassBody=function(e,t,n){for(var r=0,i=e.body;r<i.length;r+=1)n(i[r],t)},ne.MethodDefinition=ne.PropertyDefinition=ne.Property=function(e,t,n){e.computed&&n(e.key,t,"Expression"),e.value&&n(e.value,t,"Expression")};let nt=["Identifier","TemplateLiteral","ArrowFunctionExpression","StaticMemberExpression","CallExpression","TSAsExpression"],nn=i(764);var nr=d.n(nn),ni=d(9100);let no=null;async function na(){return no||(no=await d.e("89").then(d.bind(d,6515))),no}async function ns(){let{CssSelector:e}=await na();return new e}async function nl(){let{CssSelector:e}=await na();return e}async function nc(){let{SelectorMatcher:e}=await na();return new e}async function nd(...e){let{parseTemplate:t}=await na();return t(...e)}let nu=new Map;function np(e){if(!e.includes(`${o().sep}node_modules${o().sep}`))return;let t=o().dirname(e);for(;t.includes("node_modules");){let e=o().join(t,"package.json");try{if(nu.has(e))return nu.get(e);let t=(0,a.readFileSync)(e,"utf-8"),n=JSON.parse(t);if(n&&"string"==typeof n.name)return nu.set(e,n.name),n.name}catch{}let n=o().dirname(t);if(n===t)break;t=n}}let nf="zh-runtime-value";async function nm(e){let t=await ns();for(let n of(t.setElement(e.name),e.attributes))t.addAttribute(n.name,n.value);return t}async function n_(e,t,n,r,i,a,s){var l;if((l=e)&&"object"==typeof l&&"name"in l&&"attributes"in l&&"inputs"in l&&"outputs"in l&&"children"in l&&"references"in l&&Array.isArray(l.attributes)&&Array.isArray(l.inputs)&&Array.isArray(l.outputs)&&Array.isArray(l.children)&&Array.isArray(l.references)){let l=await nm(e);if(r.match(l,(r,l)=>{let c=i.get(l),d=s.get(l)||(null==c?void 0:c.importSource)||"",u=d;if(d&&d.startsWith(".")){let e=o().dirname(t),r=o().resolve(e,d);u=o().relative(n,r)}let p=u||((null==c?void 0:c.filePath)?o().relative(n,c.filePath).replace(/\.ts$/,""):""),f=o().relative(n,t),m=`${l}@${p}`,_=function(e){var t,n,r,i,o,a,s,l,c,d,u,p,f;let m={};for(let t of e.attributes){let e=t.name,n=t.value;m[e]||(m[e]={type:[],values:[]});let r=m[e];""===n||null==n?(r.type=["BooleanLiteral"],r.values.push(!0)):(r.type=["StringLiteral"],r.values.push(n))}for(let f of e.inputs){let e=f.name;m[e]||(m[e]={type:[],values:[]});let _=m[e],h=(null==(t=f.value)?void 0:t.constructor.name)||"Unknown";switch(h){case"LiteralPrimitive":let g=f.value.value;"string"==typeof g?null==(n=_.type)||n.push("StringLiteral"):"number"==typeof g?null==(r=_.type)||r.push("NumericLiteral"):"boolean"==typeof g&&(null==(i=_.type)||i.push("BooleanLiteral")),_.values.push(g);break;case"PropertyRead":case"SafePropertyRead":null==(o=_.type)||o.push("Identifier"),_.values.push(nf);break;case"MethodCall":case"SafeMethodCall":null==(a=_.type)||a.push("CallExpression"),_.values.push(nf);break;case"Binary":null==(s=_.type)||s.push("BinaryExpression"),_.values.push("zh-binary-value");break;case"LiteralArray":null==(l=_.type)||l.push("ArrayExpression"),_.values.push("zh-array-value");break;case"LiteralMap":null==(c=_.type)||c.push("ObjectExpression"),_.values.push("zh-object-value");break;default:"PropertyRead"===h||"SafePropertyRead"===h?null==(d=_.type)||d.push("Identifier"):"MethodCall"===h||"SafeMethodCall"===h?null==(u=_.type)||u.push("CallExpression"):null==(p=_.type)||p.push("Identifier"),_.values.push(nf)}}for(let t of e.outputs){let e=t.name;m[e]||(m[e]={type:[],values:[]});let n=m[e];null==(f=n.type)||f.push("CallExpression"),n.values.push(nf)}return m}(e);a.has(m)||a.set(m,{name:l,count:0,package:p,files:[],props:{}});let h=a.get(m);for(let[e,t]of(h.count++,h.files.includes(f)||h.files.push(f),Object.entries(_))){h.props[e]||(h.props[e]={type:[],values:[]});let n=h.props[e];if(n){let e=t.type||[];n.type=Array.from(new Set([...n.type||[],...e])),n.values.push(...t.values)}}}),e.children)for(let o of e.children)await n_(o,t,n,r,i,a,s)}else await nh(e,t,n,r,i,a,s)}async function nh(e,t,n,r,i,o,a){let s=async e=>{for(let s of e)await n_(s,t,n,r,i,o,a)};if(e.children&&Array.isArray(e.children)&&await s(e.children),e.body&&Array.isArray(e.body)&&await s(e.body),e.branches&&Array.isArray(e.branches))for(let t of e.branches)t.children&&Array.isArray(t.children)&&await s(t.children);if(e.cases&&Array.isArray(e.cases))for(let t of e.cases)t.children&&Array.isArray(t.children)&&await s(t.children);e.main&&e.main.children&&Array.isArray(e.main.children)&&await s(e.main.children),e.placeholder&&e.placeholder.children&&Array.isArray(e.placeholder.children)&&await s(e.placeholder.children),e.loading&&e.loading.children&&Array.isArray(e.loading.children)&&await s(e.loading.children),e.error&&e.error.children&&Array.isArray(e.error.children)&&await s(e.error.children)}async function ng(e,t,n){let r=await nl(),i=n||await nc();for(let n of t)i.addSelectables(r.parse(n),e);return i}async function ny(e,t,n,r,i,o,a,s){try{for(let t of(await nd(e,"template.html",{enableBlockSyntax:!0,preserveWhitespaces:!1})).nodes)await n_(t,n,r,i,o,a,s)}catch(e){console.error(`Error parsing template for ${t}:`,e instanceof Error?e.message:String(e))}}async function nv(e,t,n,r){var i,o,a;let s=r||new Map,l=n||await nc(),c=e.getDecorator("Component");if(!c)return;let d=c.getCallExpression();if(!d)return;let u=d.getArguments();if(0===u.length)return;let p=u[0];if(!p)return;let f=p.asKind(ni.SyntaxKind.ObjectLiteralExpression);if(!f)return;let m=e.getName();if(!m)return;let _=null==(i=f.getProperty("selector"))?void 0:i.asKind(ni.SyntaxKind.PropertyAssignment);if(_){let n=null==t?void 0:t.get(m),r=null==(a=_.getInitializerIfKind(ni.SyntaxKind.StringLiteral))?void 0:a.getLiteralValue().split(",").map(e=>e.trim());r&&(s.set(m,{selectors:r,filePath:e.getSourceFile().getFilePath(),importSource:n}),await ng(m,r,l))}let h=null==(o=f.getProperty("imports"))?void 0:o.asKind(ni.SyntaxKind.PropertyAssignment);if(!h)return null;let g=h.getInitializerIfKind(ni.SyntaxKind.ArrayLiteralExpression);return g||null}async function nb(e,t,n,r,i,o,a){let s=e.getType().getSymbol();if(!s)return;let l=s.getValueDeclaration(),c=[];if(l){let e=l.asKind(ni.SyntaxKind.ClassDeclaration);e&&c.push(e)}if(0===c.length)for(let e of s.getDeclarations()){var d;let t=null==(d=e.asKind)?void 0:d.call(e,ni.SyntaxKind.ClassDeclaration);t&&c.push(t)}for(let e of c){let s=`${e.getName()}@${e.getSourceFile().getFilePath()}`;a&&a.has(s)||(a&&a.add(s),await nx(e,t,n,r,i,o,a))}}async function nx(e,t,n,r,i,o,a){var s,l;let c=i||new Map,d=o||new Map,u=r||await nc();if(e.getProperty("ɵcmp")){let r=null==(s=e.getProperty("ɵcmp"))?void 0:s.getFirstDescendantByKind(ni.SyntaxKind.TypeReference);if(!r)return;let i=r.getTypeArguments();if(!i||i.length<2)return;let o=i[1];if(!o)return;let a=o.asKind(ni.SyntaxKind.LiteralType);if(!a)return;let l=a.getLiteral().asKind(ni.SyntaxKind.StringLiteral);if(!l)return;let d=e.getName();if(!d)return;let p=null==t?void 0:t.get(d);if(!p&&n&&(p=null==t?void 0:t.get(n)),!p&&e.getSourceFile().getFilePath().includes("node_modules")){let t=np(e.getSourceFile().getFilePath());t&&(p=t)}let f=l.getLiteralValue().split(",").map(e=>e.trim());c.set(d,{selectors:f,filePath:e.getSourceFile().getFilePath(),importSource:p}),await ng(d,f,u)}if(e.getProperty("ɵmod")){let n=null==(l=e.getProperty("ɵmod"))?void 0:l.getFirstDescendantByKind(ni.SyntaxKind.TypeReference);if(!n)return;let s=n.getTypeArguments()[2];if(!s)return;let c=s.asKind(ni.SyntaxKind.TupleType);if(!c)return;let u=c.getElements();if(!u||0===u.length)return;let p=e.getName();if(!p)return;for(let e of u)await nb(e,t||new Map,p,r,i,o,a);d.set(p,{imports:u.map(e=>e.getText()),filePath:e.getSourceFile().getFilePath()})}if(e.getDecorator("Component")){let n=await nv(e,t,r,i);if(!n)return;let s=n.getElements();if(!s||0===s.length)return;for(let e of s)await nb(e,t||new Map,void 0,r,i,o,a)}}async function nS(e,t){let n=e.getCompilerOptions().configFilePath,r="string"==typeof n?o().dirname(n):process.cwd(),i=(null==t?void 0:t.baseDirectory)||r,s=t4(e.getSourceFiles(),(null==t?void 0:t.ignorePattern)||[],i),l=new Map,c=new Map,d=new Map,u=await nc(),p=new Set,f=new Set,m=[];for(let e of s)m.push(e.getFilePath());for(;m.length;){let t=m.shift();if(f.has(t))continue;f.add(t);let n=e.getSourceFile(t);if(!n)continue;let r=n.getImportDeclarations(),i=new Map;for(let e of(r.forEach(e=>{e.getNamedImports().forEach(t=>{i.set(t.getName(),e.getModuleSpecifierValue())})}),n.getClasses())){let t=`${e.getName()}@${e.getSourceFile().getFilePath()}`;p.has(t)||(p.add(t),await nx(e,i,void 0,u,l,c,p))}for(let e of r){let t=e.getModuleSpecifierSourceFile();if(t){let e=t.getFilePath();f.has(e)||m.push(e)}}}for(let e of s){let t=e.getImportDeclarations(),n=new Map;for(let r of(t.forEach(e=>{e.getNamedImports().forEach(t=>{n.set(t.getName(),e.getModuleSpecifierValue())})}),e.getClasses())){var _,h,g;let e=r.getName();if(!e)continue;let t=r.getDecorator("Component");if(!t)continue;let o=t.getCallExpression();if(!o)continue;let s=o.getArguments();if(0===s.length)continue;let c=s[0];if(!c)continue;let p=c.asKind(ni.SyntaxKind.ObjectLiteralExpression);if(!p)continue;let f=null==(_=p.getProperty("templateUrl"))?void 0:_.asKind(ni.SyntaxKind.PropertyAssignment);if(f){let t=null==(g=f.getInitializerIfKind(ni.SyntaxKind.StringLiteral))?void 0:g.getLiteralValue();if(t){let o=r.getSourceFile().getDirectory().getPath()+"/"+t;try{let t=(0,a.readFileSync)(o,"utf-8");await ny(t,e,r.getSourceFile().getFilePath(),i,u,l,d,n)}catch(e){console.error(`Error reading template file ${o}:`,e instanceof Error?e.message:String(e))}}}let m=null==(h=p.getProperty("template"))?void 0:h.asKind(ni.SyntaxKind.PropertyAssignment);if(m){let t,o=m.getInitializer(),a=null==o?void 0:o.asKind(ni.SyntaxKind.StringLiteral);a&&(t=a.getLiteralValue());let s=null==o?void 0:o.asKind(ni.SyntaxKind.NoSubstitutionTemplateLiteral);s&&(t=s.getLiteralValue());let c=null==o?void 0:o.asKind(ni.SyntaxKind.TemplateExpression);c&&(t=c.getText().slice(1,-1)),t&&await ny(t,e,r.getSourceFile().getFilePath(),i,u,l,d,n)}}}let y=Array.from(d.values()).map(e=>({name:e.name,count:e.count,package:e.package,files:e.files,props:e.props,framework:"angular"})),b=null==t?void 0:t.baseDirectory;return y.map(e=>{var t;let n=function(e,t,n){if(!e||!e.startsWith(".")&&!e.startsWith("/")&&!e.includes("node_modules")&&/^[A-Za-z0-9@][A-Za-z0-9@/_.-]*$/.test(e))return e;if(e.includes("node_modules")){let t=np(e);if(t)return t;let n=e.split(o().sep).join("/"),r=n.lastIndexOf("node_modules/");if(-1!==r){let e=n.substring(r+13);return e=(e=e.replace(/\/index\.(d\.ts|js|mjs|ts)$/i,"")).replace(/\.(d\.ts|js|mjs|ts)$/i,"")}return e}let r=n||t,i=e;return e.startsWith(".")&&(i=o().resolve(t,e)),o().isAbsolute(i)||(i=o().resolve(t,i)),(o().relative(r,i)||".").split(o().sep).join("/")}(e.package,i,b),r=null==(t=e.files)?void 0:t.map(e=>b?o().relative(b,o().resolve(i,e)):o().relative(i,o().resolve(i,e)));return{...e,package:n,files:r}})}async function nE(e){let t=o().resolve(e);if(await nT(t))return{isMonorepo:!0,frameworks:await nA(t)};{let e=await nD(t);return{isMonorepo:!1,frameworks:e?[e]:[]}}}async function nT(e){return(await t3(e,"**/package.json",["node_modules/**"])).length>1}async function nA(e){let t=[];for(let n of(await t3(e,"**/package.json",["node_modules/**"]))){let e=o().dirname(n),r=await nD(e);r&&t.push(r)}return t}async function nD(e){let t=await nP(e);if(!t)return null;let n=o().join(e,"package.json"),r=await nN(t);if(r)return{framework:"react",version:r.version,packageJsonPath:n,directory:e};let i=await nC(e,t);return i?{framework:"angular",version:i.version,packageJsonPath:n,directory:e,tsconfigPath:i.tsconfigPath}:{framework:"unknown",packageJsonPath:n,directory:e}}async function nC(e,t){let n={...t.dependencies,...t.devDependencies,...t.peerDependencies};if(n["@angular/core"]){let t=n["@angular/core"];return{version:t,tsconfigPath:await nI(e)}}return null}async function nI(e){let t=["tsconfig.app.json","tsconfig.lib.json","tsconfig.json"];for(let r of t){let t=o().join(e,r);try{return await (0,n.stat)(t),t}catch{}}let r=o().join(e,"src","tsconfig.json");try{return await (0,n.stat)(r),r}catch{}try{let n=await t3(e,"**/tsconfig*.json",["node_modules/**"]);if(n.length>0){for(let e of t){let t=n.find(t=>o().basename(t)===e);if(t)return t}return n[0]}}catch{}}async function nN(e){let t={...e.dependencies,...e.devDependencies,...e.peerDependencies};return t.react?{version:t.react}:null}async function nP(e){try{let t=o().join(e,"package.json"),r=await (0,n.readFile)(t,"utf-8");return JSON.parse(r)}catch{return null}}async function nR(e,t,r,i){let o=await t3(e,t,r);if(0===o.length)throw Error("Can't find any relevant files");null==i||i.info({directory:e,extensions:t,ignorePattern:r,filesFound:o.length},"Starting color usage analysis");let a=[],s=new Map;for(let t of o)try{let r=await (0,n.readFile)(t,"utf-8"),o=nw(r);if(o.totalCount>0){let n=t.slice(e.length);s.set(n,o),null==i||i.info({file:n,colorUsage:o},"Found color usage in file")}}catch(n){let e={file:t,error:n,message:`Error parsing ${t}`};a.push(e),null==i||i.error(e,"Error parsing file for color usage")}return{errors:a,usage:s}}async function nM(e,t,n=[]){let r=[],i=[];try{let o=await nE(e),a=o.frameworks.filter(e=>"angular"===e.framework);if(a.length>0)for(let s of(null==t||t.info({angularProjects:a.length,isMonorepo:o.isMonorepo,projectPaths:a.map(e=>e.directory),allFrameworks:o.frameworks},"Angular projects detected, running Angular analysis"),a)){if(!s.tsconfigPath){null==t||t.info({project:s.directory},"No tsconfig found - skipping");continue}try{let r=new ni.Project({tsConfigFilePath:s.tsconfigPath,skipFileDependencyResolution:!1}),o=r.getSourceFiles(),a=t4(o,n,e);if(a.length>0){null==t||t.info({project:s.directory,tsConfigPath:s.tsconfigPath,fileCount:a.length,totalFileCount:o.length},"Running Angular analysis on project");try{let t=await nS(r,{baseDirectory:e,ignorePattern:n});t.length>0&&i.push(...t)}catch(e){throw null==t||t.error({project:s.directory,error:e,stack:e instanceof Error?e.stack:void 0},"Error during Angular analysis"),Error(`Error during Angular analysis of ${s.directory}: ${e instanceof Error?e.message:String(e)}`)}}}catch(n){let e={file:s.directory,error:n,message:`Error during analysis of ${s.directory}: ${n instanceof Error?n.message:String(n)}`};r.push(e),null==t||t.error({error:n,project:s.directory,tsConfigPath:s.tsconfigPath,errorMessage:n instanceof Error?n.message:String(n)},"Error in Angular analysis for project")}}}catch(n){let e={file:"Framework detection",error:n,message:`Error during framework detection: ${n instanceof Error?n.message:String(n)}`};r.push(e),null==t||t.error({error:n,errorMessage:n instanceof Error?n.message:String(n)},"Error detecting frameworks, skipping Angular analysis")}return{errors:r,usage:i}}async function nk(e,t,r,i){let o=await t3(e,t,r);if(0===o.length)throw Error("Can't find any relevant files");null==i||i.info({directory:e,extensions:t,ignorePattern:r,filesFound:o.length},"Starting component usage analysis");let a=[],s=new Map;for(let t of o)try{let r=await (0,n.readFile)(t,"utf-8"),{ast:o,errors:l}=function(e,t){let n=nr().parseSync(e,{sourceFilename:t,sourceType:"module"});return{ast:JSON.parse(n.program),errors:n.errors}}(r,t);if(l.length>0){let e={file:t,error:l,message:`Error parsing ${t}`};a.push(e),null==i||i.error(e,"AST parsing errors");continue}let c=function(e){let t={components:new Map,props:new Map,imports:new Map},n={CatchClause(){},CatchParameter(){},ComputedMemberExpression(){},JSXText(){},NullLiteral(){},NumericLiteral(){},BooleanLiteral(){},ObjectExpression(){},ObjectProperty(){},StringLiteral(){},TSAsExpression(){},TSEnumDeclaration(){},TSInterfaceDeclaration(){},TSTypeAliasDeclaration(){},TSModuleDeclaration(){},TSSatisfiesExpression(){},StaticMemberExpression(){},RegExpLiteral(){},TSNonNullExpression(){},JSXEmptyExpression(){},JSXFragment(e,t){e.children.forEach(e=>t5(e,t,n,ne))},IfStatement(e,t){t5(e.consequent,t,n,ne),e.alternate&&t5(e.alternate,t,n,ne)},VariableDeclaration(e,t){e.declarations.forEach(e=>{t5(e,t,n,ne)})},ArrowFunctionExpression(e,t){"FunctionBody"===e.body.type&&t5(e.body,t,n,ne)},ParenthesizedExpression(e,t){t5(e.expression,t,n,ne)},ReturnStatement(e,t){e.argument&&t5(e.argument,t,n,ne)},FunctionBody(e,t){e.statements.forEach(e=>t5(e,t,n,ne))},Program(e,t){e.body.forEach(e=>{t5(e,t,n,ne)})},JSXElement(e,t){var r;let i=e.openingElement,o=(e=>{let t=e=>"JSXIdentifier"===e.type?e.name:`${t(e.object)}.${t(e.property)}`;return t(e.name)})(i);if((null==o?void 0:o[0])!==(null==o||null==(r=o[0])?void 0:r.toLocaleLowerCase())){if(i.attributes.length>0){let e=[];i.attributes.forEach(t=>{if(t.name){var n,r,i;if((null==(n=t.value)?void 0:n.type)==="JSXExpressionContainer"){let n=t.value.expression.type;n&&nt.includes(n)?e.push({name:t.name.name,type:[n],values:["zh-runtime-value"]}):n&&"ObjectExpression"===n?e.push({name:t.name.name,type:[n],values:["zh-object-value"]}):n&&"ArrayExpression"===n?e.push({name:t.name.name,type:[n],values:["zh-array-value"]}):n&&"BinaryExpression"===n?e.push({name:t.name.name,type:[n],values:["zh-binary-value"]}):e.push({name:t.name.name,type:[n],values:[t.value.expression.value||t.value.expression.name]})}else e.push({name:t.name.name,type:[null==(r=t.value)?void 0:r.type],values:[null==(i=t.value)?void 0:i.value]})}});let n=t.props.get(o)??[];t.props.set(o,[...e,...n])}t.components.set(o,(t.components.get(o)??0)+1)}e.children.forEach(e=>{t5(e,t,n,ne)})},CallExpression(e,t){e.arguments.forEach(e=>t5(e,t,n,ne))},ExportDefaultDeclaration(e,t){if("FunctionDeclaration"===e.declaration.type){let{statements:r}=e.declaration.body;r.forEach(e=>{t5(e,t,n,ne)})}},JSXExpressionContainer(e,t){t5(e.expression,t,n,ne)},ImportDeclaration(e,t){var n,r;let i=(null==(n=e.source.value)?void 0:n.toString())??"";null==(r=e.specifiers)||r.forEach(e=>{if("ImportNamespaceSpecifier"===e.type)return;let n=e.local.name;"ImportDefaultSpecifier"===e.type||"Identifier"===e.type?n=e.local.name:"ImportSpecifier"===e.type&&(n="Literal"===e.imported.type?e.imported.value:e.imported.name),t.imports.set(e.local.name,{package:i,name:n})})}};try{t5(e,t,n,ne)}finally{return function(e){let t=new Map,n=t=>{if(t.includes(".")){let[n,...r]=t.split(".");if(void 0===n)return;let i=e.imports.get(n);return{...i,name:[(null==i?void 0:i.name)??n,...r].join(".")}}return e.imports.get(t)};for(let[r,i]of e.components){let e=n(r),o=(null==e?void 0:e.name)??r,a=(null==e?void 0:e.package)??"",s=`package:${a} name:${o}`,l=t.get(s)??{name:o,count:0,package:(null==e?void 0:e.package)??"",props:{},framework:"react"};t.set(s,{...l,count:l.count+i,props:{}})}for(let[r,i]of e.props){let e=n(r),o=(null==e?void 0:e.name)??r,a=(null==e?void 0:e.package)??"",s=`package:${a} name:${o}`,l=t.get(s),c=l.props;i.forEach(e=>{var t,n;c[e.name]={type:Array.from(new Set([...(null==(t=c[e.name])?void 0:t.type)??[],...e.type??[]])),values:[...(null==(n=c[e.name])?void 0:n.values)??[],...e.values]}}),t.set(s,{...l,props:c})}return Array.from(t.values())}(t)}}(o);if(c.length>0){let n=t.slice(e.length);s.set(n,c),null==i||i.info({file:n,ast:o,usage:c},"Found component usage in file")}}catch(n){let e={file:t,error:n,message:`Error parsing ${t}`};a.push(e),null==i||i.error(e,"Error parsing file for component usage")}return{errors:a,usage:s}}function nw(e){let t=Array.from(e.match(/#([a-fA-F0-9]{6}|[a-fA-F0-9]{8})\b|#([a-fA-F0-9]{3})\b/gi)??[]),n=Array.from(e.match(/rgba?\(\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})\s*[,\s]\s*(\d{1,3})(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),r=Array.from(e.match(/hsl(?:a)?\(\s*(?:(?:none|from\s+[a-zA-Z#0-9()]+)?\s*(?:[a-z\d+\-*/%()\s]+)\s*|(\d+(?:deg|grad|rad|turn)?)\s*(\d+%?)\s*(\d+%?)\s*(?:\/\s*(\d+%?|0?\.\d+))?|(\d+(?:deg|grad|rad|turn)?)\s*,\s*(\d+%)\s*,\s*(\d+%)\s*(?:,\s*(\d+(\.\d+)?%?))?)\)/g)??[]),i=Array.from(e.match(/okl(?:ab|ch)\(\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),o=Array.from(e.match(/hwb\(\s*(\d*\.?\d+)(?:deg|turn|rad|grad)?\s*[,\s]\s*(\d*\.?\d+%)\s*[,\s]\s*(\d*\.?\d+%)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),a=Array.from(e.match(/(?<!ok)lab\(\s*(-?\d*\.?\d+%)\s*[,\s]\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),s=Array.from(e.match(/(?<!ok)lch\(\s*(-?\d*\.?\d+%)\s*[,\s]\s*(-?\d*\.?\d+)\s*[,\s]\s*(-?\d*\.?\d+)(?:\s*[,\s]\s*(\d*\.?\d+))?\s*\)/g)??[]),l=Array.from(e.match(/color\(\s*([\w-]+)\s+(?:[-+]?\d*\.?\d+(?:e[-+]?\d+)?%?\s*){3,4}\)/g)??[]);return{hex:t,rgb:n,hsla:r,oklab:i,hwb:o,lab:a,lch:s,colorSpace:l,totalCount:t.length+n.length+r.length+o.length+a.length+s.length+l.length+i.length}}function nL(e){let t=new Map;for(let[n,r]of e)for(let{count:e,package:i,name:a,props:s,framework:l}of r){let r=i;if(i.startsWith(".")){let e=o().dirname(n),t=o().join(e,i);r=o().normalize(t)}let c=`package:${r} name:${a}`,d=t.get(c),u=[...(null==d?void 0:d.files)??[],n];t.set(c,{name:(null==d?void 0:d.name)??a,files:Array.from(new Set(u)),count:e+((null==d?void 0:d.count)??0),package:r,props:function(e,t){if(!t)return e;if(!e)return t;let n=Array.from(new Set([...Object.keys(t),...Object.keys(e)])),r={};return n.forEach(n=>{let i=t[n]??{},o=e[n],a=[...(null==i?void 0:i.values)??[],...(null==o?void 0:o.values)??[]];r[n]={type:Array.from(new Set([...i.type??[],...(null==o?void 0:o.type)??[]])),count:a.length,values:a}}),r}(s,(null==d?void 0:d.props)??{}),framework:(null==d?void 0:d.framework)??l})}return Array.from(t.values())}function nO(e){let t=new Map;for(let[n,{hex:r,rgb:i,hsla:o}]of e)for(let e of[...r,...i,...o]){let r=t.get(e),i=[...(null==r?void 0:r.files)??[],n];t.set(e,{value:e,type:"color",files:i,count:((null==r?void 0:r.count)??0)+1})}return Array.from(t.values())}})(),r.Analyzers=u.Analyzers,r.Transformers=u.Transformers,u)-1===["Analyzers","Transformers"].indexOf(p)&&(r[p]=u[p]);Object.defineProperty(r,"__esModule",{value:!0})})()},880:function(e,t,n){var r={"./89":"182","./89.js":"182","./main":"929","./main.d":"5","./main.d.ts":"5","./main.js":"929"};function i(e){return n(o(e))}function o(e){if(!n.o(r,e)){var t=Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}i.keys=function(){return Object.keys(r)},i.resolve=o,e.exports=i,i.id=880},5:function(e,t,n){n.r(t)},584:function(e,t,n){n.a(e,async function(e,r){try{n.d(t,{Z:()=>x});var i=n(810),o=n(725),a=n(92),s=n(381),l=n(468),c=n(307),d=n(772),u=n(306),p=n(512),f=n(448),m=n(999);let e=new o.Command;async function _(){try{let e=await fetch("https://registry.npmjs.org/@zeroheight/adoption-cli/latest");return(await e.json()).version}catch(e){return f.ZP.error(e,"Failed to get latest package version from NPM"),"unknown"}}let{output:h,cleanup:g}=(0,a.render)(i.createElement(s.Z,null)),{output:y,cleanup:b}=(0,a.render)(i.createElement(l.Z,{latestVersion:await _()}));e.name("zh-adoption").description("CLI for measuring design system usage usage in your products").version("4.1.1").addHelpText("before",h).option("--log-file <path>","Path to write logs to, if not provided logs only error logs will be written to stderr").addOption(new o.Option("--log-level <level>","The lowest level of logs to display").default("error").choices(["fatal","error","warn","info"])).addCommand((0,c.O)()).addCommand((0,d.G)()).addCommand((0,u.C)()).addCommand((0,p.G)()).hook("preAction",async(e,t)=>{f.ZP.level=e.opts().logLevel,e.opts().logFile&&(0,f.H4)(e.opts().logFile),f.ZP.info({command:{name:t.name(),opts:t.opts(),globalOpts:e.opts()}},"Running command");let n=await _();(0,m.lt)("4.1.1",n)&&console.log(y)}),g(),b(),"test"!==process.env.NODE_ENV&&e.parse();let x=e;r()}catch(e){r(e)}},1)},307:function(e,t,n){n.d(t,{O:()=>P});var r=n(810),i=n(149),o=n(725),a=n(904),s=n(367),l=n(165),c=n(950),d=n(748),u=n(795);function p({onContinue:e,dryRun:t}){let[n,o]=r.useState("");return r.createElement(i.Box,null,r.createElement(i.Text,null,t?r.createElement(r.Fragment,null,"Continue to next step? ",r.createElement(i.Text,{dimColor:!0},"(Y/n):")):r.createElement(r.Fragment,null,"Send this data to"," ",r.createElement(i.Text,{color:d.n.zh.color.base.brand.primary},"zeroheight"),"?"," ",r.createElement(i.Text,{dimColor:!0},"(Y/n)"))),r.createElement(u.Z,{isChecked:!0,value:n,onChange:o,onSubmit:t=>{e(t)}}))}function f({dataType:e}){return r.createElement(r.Fragment,null,r.createElement(i.Text,null,"Nothing sent to zeroheight, if you want to track ",e," data then remove the ",r.createElement(i.Text,{italic:!0},"--dry-run")," option."),r.createElement(i.Newline,null))}function m({dataType:e}){return r.createElement(r.Fragment,null,r.createElement(f,{dataType:e}),r.createElement(i.Text,null,"\uD83D\uDC4B See you next time!"))}var _=n(432),h=n(40),g=n(22),y=n(829),b=n(651);function x({credentials:e,onRepoNameSelected:t}){let[n,o]=r.default.useState("LOADING"),[a,s]=r.default.useState([]),[c,u]=r.default.useState("");async function p(e){try{let t=await (0,g.ru)(e);if(t.status!==g.Mx.Success)throw Error("Failed to get repo names");let n=t.data.repo_names;s(n),0===n.length?o("ENTER_REPO_NAME"):o("SELECT_REPO_NAME")}catch(e){o("ERROR")}}if(r.default.useEffect(()=>{e&&(o("LOADING"),(0,h.zi)().then(n=>{var r;let i=null==n||null==(r=n.repoNames)?void 0:r[process.cwd()];i?t(i):p(e)}))},[e]),"LOADING"===n)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:"cyan"},r.default.createElement(l.default,{type:"dots"}))," ","Fetching repository names..."));if("ERROR"===n)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.negative},"Error:"),r.default.createElement(i.Box,{flexDirection:"column",marginLeft:1},r.default.createElement(i.Text,null,"- Failed to fetch repository names")));if("SELECT_REPO_NAME"===n){let e=[{label:"Enter repository name",value:"enter-repository-name"},...a.map(e=>({label:e,value:e}))];return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"Select the repository name"),r.default.createElement(b.Z,{as:"select",options:e,onChange:function(e){if("enter-repository-name"===e)return void o("ENTER_REPO_NAME");t(e)}}))}return"ENTER_REPO_NAME"===n?r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Repository name: "),r.default.createElement(y.default,{value:c,onChange:u,onSubmit:e=>{0!==e.trim().length&&t(e)}})):null}function S({usage:e}){let t=Array.from(e.entries());return r.createElement(i.Box,{flexDirection:"column"},t.map(([e,t])=>r.createElement(i.Box,{key:e,flexDirection:"column"},r.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},e),r.createElement(i.Box,{flexDirection:"column",marginLeft:2},t.map(({name:t,count:n})=>r.createElement(i.Box,{gap:2,key:`${t}-${e}`},r.createElement(i.Text,{bold:!0},n),r.createElement(i.Text,null,t)))))))}var E=n(410);let T={hex:"HEX",rgb:"RGB",hsla:"HSL",oklab:"Oklab",hwb:"HWB",lab:"LAB",lch:"LCH",colorSpace:"Color space",totalCount:"Total usage"};function A({usage:e}){let t=Array.from(e.entries());return r.createElement(i.Box,{flexDirection:"column"},t.map(([e,t])=>{let n=Object.entries(t);return r.createElement(i.Box,{key:e,flexDirection:"column"},r.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},e),r.createElement(i.Box,{flexDirection:"column",marginLeft:2},r.createElement(i.Box,{flexDirection:"column",marginLeft:2},n.map(([e,t])=>{if("totalCount"===e)return null;let n=t.length;if(0===n)return null;let o=T[e];return r.createElement(i.Box,{gap:2,key:`${e}-${n}`},r.createElement(i.Text,{bold:!0},o,": "),r.createElement(i.Text,null,n))})),r.createElement(i.Text,{bold:!0},"Total usage: ",t.totalCount)))}))}function D({dryRun:e,onAnalyzeFiles:t,onAnalyzeColorUsage:n,shouldAnalyzeComponentUsage:o,shouldAnalyzeTokenUsage:a,repoName:y}){let{exit:b}=(0,i.useApp)(),[T,D]=r.default.useState(0),[C,I]=r.default.useState(new Map),[N,P]=r.default.useState(null),[R,M]=r.default.useState(new Map),[k,w]=r.default.useState([]),[L,O]=r.default.useState(null),[F,W]=r.default.useState(null),[B,z]=r.default.useState((0,g.jM)()),[G,j]=r.default.useState(y),[K,V]=r.default.useState(""),[U,H]=r.default.useState(""),[q,J]=r.default.useState(""),[$,X]=r.default.useState("");async function Y(){try{let{errorFile:e,usage:n,angular:r}=await t();O(e),I(n),P(r),D(5)}catch(e){w(t=>[...t,e])}}async function Q(t){if(t){if(e)return void D(12);let t=await Z();if(!t)return void D(8);if(!G)return void D(9);D(10),ee({react:C,angular:N},G,t)}else D(12)}async function Z(){try{let e=await (0,h.zi)();if(e)return W({token:e.token,client:e.client}),{token:e.token,client:e.client};return null}catch(e){return w(e=>[...e,"Failed to load credentials"]),null}}async function ee(e,t,n){try{var r;await (0,g.BW)(e,t,n);let i=await (0,g.lx)(n);if(i.status!==g.Mx.Success)throw Error("Failed to get credentials");let o=null==(r=i.data.project)?void 0:r.id,a=(0,g.jM)();a.pathname=o?`/project/${o}/adoption/`:"/adoption/",z(a),D(11)}catch(t){let e="Failed to send data to zeroheight";t instanceof E.MS&&(e=t.message),w(t=>[...t,e])}}async function et(e,t){try{await (0,g.lx)({token:t,client:e})}catch{return w(["Auth credentials are not valid"]),b()}}function en(e){e?(D(13),er()):D(1)}async function er(){try{let{errorFile:e,usage:t}=await n();O(e),M(t),D(14)}catch(e){w(t=>[...t,e])}}async function ei(t){if(t){if(e)return void D(1);let t=await Z();if(!t)return void D(17);if(!G)return void D(18);D(19),eo(R,G,t)}else D(1),b()}async function eo(e,t,n){try{var r;await (0,g.$O)(e,t,n);let i=await (0,g.lx)(n);if(i.status!==g.Mx.Success)throw Error("Failed to get credentials");let o=null==(r=i.data.project)?void 0:r.id,a=(0,g.jM)();a.pathname=o?`/project/${o}/adoption/`:"/adoption/",z(a),D(20)}catch(t){let e="Failed to send data to zeroheight";t instanceof E.MS&&(e=t.message),w(t=>[...t,e])}}if(r.default.useEffect(()=>{a||o||(w(e=>[...e,"Invalid arguments! --component-usage and --color-usage cannot both be false."]),D(1))},[]),k.length>0)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.negative},"Error:"),r.default.createElement(i.Box,{flexDirection:"column",marginLeft:1},k.map(e=>r.default.createElement(r.default.Fragment,{key:e},r.default.createElement(i.Text,{key:e},e),r.default.createElement(i.Newline,null)))));if(0===T)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"\uD83D\uDC4B Welcome to the"," ",r.default.createElement(i.Text,{color:d.n.zh.color.base.brand.primary},"zeroheight")," ","analyze tool"),r.default.createElement(i.Newline,null),o&&r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how components are being used (Angular and React)?"," ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(u.Z,{isChecked:!0,value:U,onChange:H,onSubmit:function(e){e?(D(4),Y()):a?D(12):(D(1),b())}})),!o&&a&&r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how colors are being used? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(u.Z,{isChecked:!0,value:q,onChange:J,onSubmit:en})));if(4===T)return r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(l.default,{type:"dots"}))," Scanning files for component usage...");if(5===T)if((null==C?void 0:C.size)>0||N&&N.length>0)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},(0,s.G2)({react:C,angular:N})," ","components found"),L&&r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.negative},"Error:"),r.default.createElement(i.Text,null," ","Some files could not be parsed. Errors can be found at"," ",r.default.createElement(c.default,{url:L},L)))),r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Show more details? ",r.default.createElement(i.Text,{dimColor:!0},"(y/N)")),r.default.createElement(u.Z,{isChecked:!1,value:$,onChange:X,onSubmit:function(e){e?D(6):D(7)}})));else return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"No files found, try a different directory or change the file extensions you want to include.")),a?r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Continue to token usage analysis? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(u.Z,{isChecked:!0,value:K,onChange:V,onSubmit:function(e){e?D(12):D(1)}})):r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"\uD83D\uDC4B See you next time!")));if(6===T)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(S,{usage:function(e,t){if(null===e)return t;let n=new Map(t);for(let t of e)for(let e of t.files||[]){let r=n.get(e)||[];r.push({name:t.name,count:t.count,package:t.package,props:t.props,framework:t.framework}),n.set(e,r)}return n}(N,C)}),r.default.createElement(i.Newline,null),e?r.default.createElement(r.default.Fragment,null,r.default.createElement(f,{dataType:"component usage"}),r.default.createElement(p,{dryRun:!0,onContinue:()=>Q(!1)})):r.default.createElement(p,{onContinue:Q}));if(7===T)return r.default.createElement(i.Box,{flexDirection:"column"},e?r.default.createElement(r.default.Fragment,null,r.default.createElement(f,{dataType:"component usage"}),r.default.createElement(p,{dryRun:!0,onContinue:()=>Q(!1)})):r.default.createElement(p,{onContinue:Q}));if(8===T||17===T)return r.default.createElement(_.Z,{configPath:(0,h.qA)(),onCheckCredentials:et,onSaveCredentials:async(e,t,n)=>{W({token:n,client:t}),e&&await (0,h.iL)({client:t,token:n}),8===T?(Q(!0),D(10)):(ei(!0),D(19))}});if(9===T||18===T)return r.default.createElement(x,{credentials:F,onRepoNameSelected:function(e){j(e),(0,h.iL)({repoNames:{[process.cwd()]:e}}),9===T?(Q(!0),D(10)):(ei(!0),D(19))}});if(10===T||19===T)return r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(l.default,{type:"dots"}))," ","Sending usage data to"," ",r.default.createElement(i.Text,{color:d.n.zh.color.base.brand.primary},"zeroheight"),"...");if(11===T)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},"Successfully sent:")," View your"," ",r.default.createElement(c.default,{url:B.toString()},r.default.createElement(i.Text,{underline:!0,color:d.n.zh.color.base.brand.primary},"usage data on zeroheight"))),r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how colors are being used? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(u.Z,{isChecked:!0,value:q,onChange:J,onSubmit:en})));if(12===T)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"❓ Would you like us to scan the files in this project to understand how colors are being used? ",r.default.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.default.createElement(u.Z,{isChecked:!0,value:q,onChange:J,onSubmit:en})));if(13===T)return r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(l.default,{type:"dots"}))," Scanning files for color usage...");if(14===T)if((null==R?void 0:R.size)>0)return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},(0,s.IJ)(R)," instances of raw color usage found"),L&&r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.negative},"Error:"),r.default.createElement(i.Text,null," ","Some files could not be parsed. Errors can be found at"," ",r.default.createElement(c.default,{url:L},L)))),r.default.createElement(i.Box,null,r.default.createElement(i.Text,null,"Show more details? ",r.default.createElement(i.Text,{dimColor:!0},"(y/N)")),r.default.createElement(u.Z,{isChecked:!1,value:$,onChange:X,onSubmit:function(e){e?D(15):D(16)}})));else return r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"No files found, try a different directory or change the file extensions you want to include."));return 15===T?e?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(A,{usage:R}),r.default.createElement(i.Newline,null),r.default.createElement(m,{dataType:"color usage"})):r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(A,{usage:R}),r.default.createElement(i.Newline,null),r.default.createElement(p,{onContinue:ei})):16===T?e?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(m,{dataType:"color usage"})):r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(p,{onContinue:ei})):20===T?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},"Successfully sent:")," View your"," ",r.default.createElement(c.default,{url:B.toString()},r.default.createElement(i.Text,{underline:!0,color:d.n.zh.color.base.brand.primary},"usage data on zeroheight"))),r.default.createElement(i.Newline,null),r.default.createElement(i.Text,null,"\uD83D\uDC4B See you next time!")):1===T?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,null,"\uD83D\uDC4B See you next time!")):r.default.createElement(i.Text,null,"Analyze complete")}function C({dryRun:e,onAnalyzeFiles:t,onAnalyzeColorUsage:n,shouldAnalyzeComponentUsage:o,shouldAnalyzeTokenUsage:a,repoName:u}){let[p,f]=r.default.useState(!1),[m,_]=r.default.useState(!1),[y,b]=r.default.useState(!1),[x,S]=r.default.useState(null),[T,A]=r.default.useState([]),[D,C]=r.default.useState(null),[I,N]=r.default.useState(null),[P,R]=r.default.useState(null),[M,k]=r.default.useState(null);async function w(){b(!0);try{let e=await (0,h.zi)();return e&&C({token:e.token,client:e.client}),e}catch(e){A(e=>[...e,"Failed to load credentials"])}finally{b(!1)}return null}async function L(e,t,n){f(!0);try{await (0,g.BW)(e,t,n)}catch(t){let e="Failed to send component usage data to zeroheight";t instanceof E.MS&&(e=t.message),A(t=>[...t,e])}finally{f(!1)}}async function O(e,t,n){f(!0);try{await (0,g.$O)(e,t,n)}catch(t){let e="Failed to send color usage data to zeroheight";t instanceof E.MS&&(e=t.message),A(t=>[...t,e])}finally{f(!1)}}async function F(){_(!0);let{errorFile:e,usage:n,angular:r}=await t();return N(n),R(r),e&&S(e),_(!1),{react:n,angular:r}}async function W(){_(!0);let{errorFile:e,usage:t}=await n();return k(t),e&&S(e),_(!1),t}return(r.default.useEffect(()=>{(async()=>{let t=await w();if(t&&u){if(o){let n=await F();e||await L(n,u,t)}if(a){let n=await W();e||await O(n,u,t)}}})()},[]),m||y||p)?r.default.createElement(i.Text,null,r.default.createElement(l.default,{type:"dots"})," ",m&&r.default.createElement(i.Text,null,"Analyzing files"),y&&r.default.createElement(i.Text,null,"Loading credentials"),p&&r.default.createElement(i.Text,null,"Sending data to zeroheight")):T.length>0?r.default.createElement(i.Box,{flexDirection:"column"},r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.negative},"Error:"),r.default.createElement(i.Box,{flexDirection:"column",marginLeft:1},T.map(e=>r.default.createElement(i.Text,{key:e},"- ",e)))):x?r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Newline,null),r.default.createElement(i.Box,null,r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.negative},"Error:"),r.default.createElement(i.Text,null," ","Some files could not be parsed. Errors can be found at"," ",r.default.createElement(c.default,{url:x},x)))):u?D?I||M?r.default.createElement(r.default.Fragment,null,I&&r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},(0,s.G2)({react:I,angular:P})," ","components found",e?" (dry run - not sent)":" and sent to",!e&&r.default.createElement(i.Text,{color:d.n.zh.color.base.brand.primary}," zeroheight")),M&&r.default.createElement(i.Text,{color:d.n.zh.color.base.text.status.positive},(0,s.IJ)(M)," usages of raw colors found",e?" (dry run - not sent)":" and sent to",!e&&r.default.createElement(i.Text,{color:d.n.zh.color.base.brand.primary}," zeroheight"))):r.default.createElement(i.Text,null,"No usage could be found."):r.default.createElement(i.Text,null,"Credentials not found, please ensure they are set before running the"," ",r.default.createElement(i.Text,{bold:!0},"analyze")," command with"," ",r.default.createElement(i.Text,{italic:!0},"--interactive false")):r.default.createElement(i.Text,null,r.default.createElement(i.Text,{bold:!0},"Repo name")," not found, run the ",r.default.createElement(i.Text,{bold:!0},"analyze")," ","command in interactive mode or provide the"," ",r.default.createElement(i.Text,{italic:!0},"--repo-name ","<my repo name>")," option")}var I=n(448);async function N(e,t){e.interactive?(0,i.render)(r.createElement(D,{dryRun:e.dryRun,onAnalyzeFiles:()=>(0,s.NT)(e.extensions,e.ignore),onAnalyzeColorUsage:()=>(0,s.hS)(e.extensions,e.ignore),shouldAnalyzeComponentUsage:e.componentUsage,shouldAnalyzeTokenUsage:e.colorUsage,repoName:e.repoName}),t):(0,i.render)(r.createElement(C,{dryRun:e.dryRun,onAnalyzeFiles:()=>(0,s.NT)(e.extensions,e.ignore),onAnalyzeColorUsage:()=>(0,s.hS)(e.extensions,e.ignore),shouldAnalyzeComponentUsage:e.componentUsage,shouldAnalyzeTokenUsage:e.colorUsage,repoName:e.repoName}))}function P(){return new o.Command().command("analyze").description("Analyze your codebase to determine component usage metrics").configureHelp({showGlobalOptions:!0}).addOption(new o.Option("-e, --extensions [ext]","glob pattern for file extensions to include when searching for components. Examples: '**/*.{js,jsx,ts,tsx}', '**/*.js', 'src/**/*.{ts,tsx}'").default("**/*.{js,jsx,ts,tsx}","*.js, *.jsx, *.ts, *.tsx files recursively in all directories").argParser(s.Uc)).addOption(new o.Option("-i, --ignore [patterns]","files to ignore when searching for components, use multiple times to add more than one glob pattern").default(["**/*.{test,spec}.*","**/*.d.ts"],"*.test.*, *.spec.* and *.d.ts files").argParser(s.tu)).addOption(new o.Option("-d, --dry-run","don't push results to zeroheight").default(!1)).addOption(new o.Option("-r, --repo-name <string>","name of the repository")).addOption(new o.Option("-in, --interactive [boolean]","disable to skip input (useful when running in CI)").default(!0).argParser(e=>(0,a.default)(e))).addOption(new o.Option("-cu, --component-usage [boolean]","gather data about component and prop usage").default(!0).argParser(e=>(0,a.default)(e))).addOption(new o.Option("-cou, --color-usage [boolean]","gather data about color usage").default(!0).argParser(e=>(0,a.default)(e))).action(async e=>{e.interactive||(0,I.If)();let t="boolean"==typeof e.ignore?[]:e.ignore;try{await N({...e,ignore:t})}catch(e){I.ZP.error({error:e},"Unhandled exception running analyze command"),process.exitCode=1}})}},367:function(e,t,i){i.d(t,{hS:()=>_,IJ:()=>m,tu:()=>h,g8:()=>d,Uc:()=>g,G2:()=>f,NT:()=>p});var o=i(292),a=i(727),s=i(403),l=i(929),c=i(448);async function d(e,t,i){let l=await u(e),c=(0,r.default)().add("/**/.*").add("/**/.*/").add("node_modules/").add(l),d=[];try{for await(let r of new n.Glob(t,{cwd:e,ignore:i,fs:a})){let t=s.default.join(e,r);(await (0,o.stat)(t)).isDirectory()||c.ignores(r)||d.push(t)}}catch(e){throw Error(`Failed to search files with pattern '${t}': ${e.message}
421
421
  Please check your --extensions pattern is valid glob syntax.`)}return d}async function u(e){let t=s.default.join(e,".gitignore");try{return await (0,o.readFile)(t,"utf-8")}catch(e){return""}}async function p(e,t){let n=[],r=await l.Analyzers.analyzeComponentUsage(process.cwd(),e,t,c.ZP);r.errors.length>0&&n.push(...r.errors);let i=await l.Analyzers.analyzeAngularComponentUsage(process.cwd(),c.ZP,t);i.errors.length>0&&n.push(...i.errors);let o=`/tmp/zh-adoption-analyze-errors-${Date.now()}`;if(n.length>0){let e=a.createWriteStream(o);n.forEach(t=>{e.write(JSON.stringify(t)+"\n")}),e.end(),c.ZP.error("Could not parse some files. See error file for more details:",o)}return{errorFile:n.length>0?o:null,usage:r.usage,angular:(null==i?void 0:i.usage)??null}}function f(e){if(e){var t;return Array.from(e.react.entries()).flatMap(e=>e[1]).reduce((e,t)=>e+t.count,0)+((null==(t=e.angular)?void 0:t.reduce((e,t)=>e+t.count,0))??0)}return 0}function m(e){return e?Array.from(e.entries()).flatMap(e=>e[1]).reduce((e,t)=>e+t.totalCount,0):0}async function _(e,t){let n=await l.Analyzers.analyzeRawColorUsage(process.cwd(),e,t,c.ZP),r=`/tmp/zh-adoption-analyze-errors-${Date.now()}`;if(n.errors.length>0){let e=a.createWriteStream(r);n.errors.forEach(t=>{e.write(JSON.stringify(t)+"\n")}),e.end(),c.ZP.error("Could not parse some files. See error file for more details:",r)}return{errorFile:n.errors.length>0?r:null,usage:n.usage}}function h(e,t){return t==this.defaultValue?[e]:Array.isArray(t)?t.concat(e):[e]}function g(e){if(!e||""===e.trim())throw Error("Extensions pattern cannot be empty. Use a glob pattern like '**/*.{js,jsx,ts,tsx}'");try{return new n.Glob(e,{cwd:process.cwd()}),e}catch(t){throw Error(`Invalid glob pattern '${e}'. ${t.message}
422
422
  Valid examples:
423
423
  - **/*.{js,jsx,ts,tsx}
424
424
  - **/*.js
425
425
  - src/**/*.{ts,tsx}
426
- - components/**/*.{js,ts}`)}}},772:function(e,t,n){n.d(t,{G:()=>h});var r=n(810),i=n(725),o=n(149),a=n(795),s=n(432),l=n(40),c=n(950),d=n(314);function u({configPath:e,existingConfig:t}){return r.createElement(o.Box,{flexDirection:"column"},r.createElement(o.Text,{bold:!0,color:"yellow"},"You already have your authentication credentials set up"),r.createElement(o.Newline,null),r.createElement(o.Text,null,"You can find them in: ",r.createElement(c.default,{url:e},e)),r.createElement(d.Z,{client:t.client,token:t.token}))}var p=n(165),f=n(22);function m({token:e,client:t}){let{exit:n}=(0,o.useApp)(),[i,c]=r.default.useState(""),[m,_]=r.default.useState(null),[h,g]=r.default.useState(0);async function y(e,t,n){let r=t??(null==e?void 0:e.client),i=n??(null==e?void 0:e.token);if(!r||!i)return void g(3);try{let e={client:r,token:i};g(0),_(e),await (0,l.iL)(e)}catch{g(3);return}g(4)}async function b(e){e?g(2):g(5)}async function x(e,t){try{await (0,f.lx)({token:t,client:e})}catch{return g(6),n()}}async function S(e,t,n){e?await y(m,t,n):g(5)}switch(r.default.useEffect(()=>{(0,l.zi)().then(n=>{g(0),_(n),n?n&&e||n&&t?y(n,t,e):n&&g(1):g(2)})},[]),h){case 1:return r.default.createElement(r.default.Fragment,null,(null==m?void 0:m.client)&&(null==m?void 0:m.token)&&r.default.createElement(u,{configPath:(0,l.qA)(),existingConfig:m}),r.default.createElement(o.Box,null,r.default.createElement(o.Text,null,"Would you like to overwrite these credentials?"," ",r.default.createElement(o.Text,{dimColor:!0},"(y/N)")),r.default.createElement(a.Z,{isChecked:!1,value:i,onChange:c,onSubmit:b})));case 2:return r.default.createElement(s.Z,{onCheckCredentials:x,onSaveCredentials:S,configPath:(0,l.qA)()});case 4:return r.default.createElement(o.Box,{flexDirection:"column"},r.default.createElement(o.Text,{color:"green"},"Updated credentials"),(null==m?void 0:m.client)&&(null==m?void 0:m.token)&&r.default.createElement(d.Z,{client:m.client,token:m.token}));case 5:return r.default.createElement(o.Box,{flexDirection:"column"},r.default.createElement(o.Text,{color:"yellow"},"Credentials are unchanged"),(null==m?void 0:m.client)&&(null==m?void 0:m.token)&&r.default.createElement(d.Z,{client:m.client,token:m.token}));case 3:return r.default.createElement(o.Text,{color:"yellow"},"Something went wrong, try again.");case 6:return r.default.createElement(o.Text,{color:"red"},"Unable to authenticate. Please re-run the command to try again.");case 0:return r.default.createElement(o.Text,null,r.default.createElement(o.Text,{color:"green"},r.default.createElement(p.default,{type:"dots"}))," Loading config...");default:return r.default.createElement(o.Text,null,"Done")}}async function _(e,t){(0,o.render)(r.createElement(m,{token:e.token,client:e.client}),t)}function h(){return new i.Command().command("auth").description("Authenticate with zeroheight").configureHelp({showGlobalOptions:!0}).addHelpText("before","Set credentials for performing actions with zeroheight. Credentials will default to ZEROHEIGHT_CLIENT_ID and ZEROHEIGHT_ACCESS_TOKEN environment variables if not supplied").option("-c, --client <client_id>","zeroheight Client ID",process.env.ZEROHEIGHT_CLIENT_ID).option("-t, --token <access_token>","zeroheight Access Token",process.env.ZEROHEIGHT_ACCESS_TOKEN).action(async e=>{try{await _(e)}catch(e){console.error(e),process.exitCode=1}})}},306:function(e,t,n){n.d(t,{C:()=>D});var r=n(810),o=n(725),a=n(149),s=n(165),l=n(403),c=n(292),d=n(367);class u{}class p extends u{packages;constructor(e){super();let t=JSON.parse(e);switch(t.lockfileVersion){case 1:this.packages=this.#i4(t);break;case 2:this.packages=this.#i5(t);break;default:this.packages=this.#i7(t)}}#i4(e){return Object.entries(e.dependencies).map(([e,t])=>({name:this.#i9(e),version:t.version}))}#i5(e){return Object.entries(e.packages).map(([e,t])=>({name:this.#i9(e),version:t.version})).filter(e=>e.name&&e.version)}#i7(e){return this.#i5(e)}#i9(e){let t="node_modules/";return e.startsWith(t)?e.slice(t.length):e}}class f extends u{packages;constructor(e){super(),this.packages=[];let t=(0,i.parse)(e);6>parseInt(t.lockfileVersion,10)?this.packages=this.#oe(t):this.packages=this.#ot(t)}#oe(e){return Object.entries(e.dependencies).map(([e,t])=>({name:e,version:t})).filter(e=>e.name&&e.version)}#ot(e){return Object.keys(e.packages).map(e=>{let t=e.lastIndexOf("@"),n=e.slice(0,t),r=e.slice(t+1);return n.startsWith("/")&&(n=n.slice(1)),{name:n,version:r}}).filter(e=>e.name&&e.version)}}class m extends u{packages;constructor(e){super(),this.packages=[];try{let t=(0,i.parse)(e);if(t.__metadata){let e={...t};null==e||delete e.__metadata,this.packages=this.#on(e)}}catch{this.packages=this.#i4(e)}}#i4(e){let t=e.split("\n\n").filter(e=>!e.startsWith("#")).map(e=>e.trimStart()),n=/[^"\s](\S+)(?<!")(?=@)/gi,r=/(?<=")(.+)(?<!")/gi;return t.reduce((e,t)=>{var i,o,a,s,l;let c=t.split("\n").map(e=>e.trim()),d=null==(a=c.at(0))||null==(o=a.match(n))||null==(i=o[0])?void 0:i.replace('"',""),u=null==(l=c.slice(1).find(e=>e.startsWith("version")))||null==(s=l.match(r))?void 0:s[0];return d&&u?e.concat([{name:d,version:u}]):e},[])}#on(e){return Object.entries(e).map(([e,t])=>({name:this.#i9(e),version:t.version.toString()})).filter(e=>e.name)}#i9(e){return e.startsWith("@")?"@"+e.substring(1).split("@").at(0):e.split("@").at(0)}}async function _(e){let t=JSON.parse(await (0,c.readFile)(e,"utf-8"));return{name:t.name,version:t.version}}async function h(e){let t=(0,l.basename)(e),n=function(e){switch(e){case"yarn.lock":return m;case"package-lock.json":return p;case"pnpm-lock.yaml":case"shrinkwrap.yaml":return f;default:return null}}(t);if(!n)throw Error(`Can't find parser for ${t}`);return new n(await (0,c.readFile)(e,"utf-8"))}async function g(e){let t=(0,l.join)(process.cwd(),e??"");return(0,d.g8)(t,"**/**/{package-lock.json,shrinkwrap.yaml,pnpm-lock.yaml,yarn.lock}",[])}var y=n(965),b=n(22),x=n(40),S=n(410);function E({packageDirs:e,packageName:t,dryRun:n}){let[i,o]=r.default.useState(),[c,d]=r.default.useState({});function u(e,t,n){n&&(process.exitCode=1),d(r=>({...r,[e]:{...r[e],step:t,error:n}}))}async function p(){let r=process.cwd(),i=[],a=[];e?(a=(await Promise.all(e.map(g))).flat(),i=(await Promise.all(e.map(y.u1))).flat()):(a=await (0,y.u1)(),i=await g());let s=[...i,...a].map(e=>({base:(0,l.dirname)(e),filename:(0,l.basename)(e)})).reduce((e,t)=>(e[t.base]=[...e[t.base]??[],t.filename],e),{}),c=await (0,x.zi)();if(0===Object.keys(s).length)return void o("No NPM packages found");for(let[e,i]of Object.entries(s)){let a,s=i.filter(e=>"package.json"!==e).at(0);if(!s)continue;try{if(a=await _((0,l.join)(e,"package.json")),t&&(a.name=t),!a.name){o(`Name field is missing in your ${(0,l.basename)(e)}/package.json file. Re-run the command with --package-name <name> to continue.`);continue}}catch(e){continue}u(a.name,2);let d=await h((0,l.join)(e,s)),p=d.packages;d instanceof m&&(p=d.packages.filter(e=>e.name!==a.name));let f=(0,l.join)(e.split(r).pop()??"",s);if(!c){o("No credentials, must authenticate to send data to zeroheight.");continue}try{if(n)u(a.name,0);else{u(a.name,3);let e=await (0,b.iI)(a.name,a.version,f,p,{token:c.token,client:c.client});e.status===b.Mx.Success?u(a.name,0):u(a.name,1,e.message)}}catch(t){let e="Failed to send data to zeroheight";t instanceof S.MS&&(e=t.message),u(a.name,1,e)}}}return r.default.useEffect(()=>{p()},[]),r.default.createElement(r.default.Fragment,null,Object.entries(c).map(([e,{step:t,error:i}])=>r.default.createElement(a.Box,{key:e,flexDirection:"column"},2===t&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:"green"},r.default.createElement(s.default,{type:"dots"})),`${e} - searching for package details...`),3===t&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:"green"},r.default.createElement(s.default,{type:"dots"})),`${e} - sending data to zeroheight...`),0===t&&r.default.createElement(a.Box,{flexDirection:"column"},r.default.createElement(a.Text,{color:"green"},"Success"),r.default.createElement(a.Text,null,"Packages being used by ",e," have been"," ",n?"found (dry run - not sent)":"sent to your zeroheight account")),1===t&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:"red"},"Error: "),`${e} - ${i}`))),i&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:"red"},"Error:")," ",i))}var T=n(448);async function A(e,t){(0,a.render)(r.createElement(E,{packageDirs:e.dir,packageName:e.packageName,dryRun:e.dryRun}))}function D(){return new o.Command().command("monitor-repo").description("Monitor package usage in a repository").configureHelp({showGlobalOptions:!0}).addOption(new o.Option("-d, --dir <path...>","use package directory to find package.json and lockfile")).addOption(new o.Option("-p, --package-name <name>","specify the name used to identify the package in zeroheight")).addOption(new o.Option("--dry-run","don't push results to zeroheight").default(!1)).action(async e=>{(0,T.If)();try{await A(e)}catch(e){console.error(e),process.exitCode=1}})}},512:function(e,t,n){n.d(t,{G:()=>S});var r=n(810),i=n(725),s=n(149),l=n(904),c=n(165),d=n(40),u=n(965),p=n(22),f=n(410);function m({allowedPackages:e,dryRun:t}){let{exit:n}=(0,s.useApp)(),[i,o]=r.default.useState(2),[a,l]=r.default.useState(null),[m,_]=r.default.useState([]),[h,g]=r.default.useState(null),[y,b]=r.default.useState(null);async function x(){let r=await (0,d.zi)()??{token:"temp",client:"temp"},{files:i,error:a}=await (0,u.Rp)(e);try{if(1===i.length){let{name:e,path:a,version:s,exports:c}=i[0];g(e),b(s),o(4);let d=(0,u.ce)(e,c);if(t)o(0),n();else{let t=await (0,p.Yw)(e,a,s,d,{token:r.token,client:r.client});t.status===p.Mx.Success?o(0):(l(t.message),o(1)),n()}}else i.length>1?(_(i),o(3),t||await Promise.all(i.map(async e=>{let t=(0,u.ce)(e.name,e.exports);await (0,p.Yw)(e.name,e.path,e.version,t,{token:r.token,client:r.client})}))):(l(a),o(1),n());o(0),n()}catch(t){let e="Failed to send data to zeroheight";t instanceof f.MS&&(e=t.message),l(e),o(1),n()}}return r.default.useEffect(()=>{x()},[]),r.default.createElement(r.default.Fragment,null,2===i&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},r.default.createElement(c.default,{type:"dots"}))," searching for package file..."),4===i&&r.default.createElement(r.default.Fragment,null,r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},"Details found:")," ",h,"@",y),r.default.createElement(s.Newline,null),!t&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},r.default.createElement(c.default,{type:"dots"}))," sending to zeroheight...")),3===i&&r.default.createElement(r.default.Fragment,null,r.default.createElement(s.Text,{color:"green"},m.length," packages found"),r.default.createElement(s.Newline,null),!t&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},r.default.createElement(c.default,{type:"dots"}))," sending to zeroheight...")),0===i&&r.default.createElement(s.Text,null,"Complete -"," ",m.length>1?`details for ${m.length} packages`:"package details"," ",t?"found (dry run - not sent)":"sent to your zeroheight account"),1===i&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"red"},"Error:")," ",a))}var _=n(795);function h({reservedLines:e=0,children:t}){let{stdout:n}=(0,s.useStdout)(),i=n.rows??24,l=n.columns??80,c=t.props.options,d=Math.max(3,Math.min(i-e,c.length)),u=r.default.useMemo(()=>c.map(e=>({...e,label:(0,a.default)(e.label,l-5,{position:"end",truncationCharacter:o.default.gray("…")})})),[c,l]);return r.default.cloneElement(t,{options:u,visibleOptionCount:d})}var g=n(651);function y({dryRun:e}){let{exit:t}=(0,s.useApp)(),[n,i]=r.default.useState(2),[a,l]=r.default.useState(null),[m,y]=r.default.useState(null),[b,x]=r.default.useState([]),[S,E]=r.default.useState(null),[T,A]=r.default.useState(null),[D,C]=r.default.useState(null),[I,N]=r.default.useState([]),[P,R]=r.default.useState(""),[M,k]=r.default.useState(""),[w,L]=r.default.useState([]),[O,F]=r.default.useState([]);async function W(e,t,n,r){await (0,p.Yw)(e,t,n,r,a)}async function B(){i(5);try{if(b.length>0){let e=b.filter(e=>O.includes(`${e.name}@${e.version}:${e.path}`));e.length>0?await Promise.all(e.map(async e=>{let t=(0,u.ce)(e.name,e.exports);W(e.name,e.path,e.version,t)})):await Promise.all(b.map(async e=>{let t=(0,u.ce)(e.name,e.exports);W(e.name,e.path,e.version,t)}))}else await W(S,T,D,I);i(0)}catch(t){let e="Failed to send data to zeroheight";t instanceof f.MS&&(e=t.message),y(e),i(1)}finally{t()}}let z=async e=>{if(e)return B();t()};switch(r.default.useEffect(()=>{(async()=>{let e=await (0,d.zi)();e&&l({token:e.token,client:e.client});let{files:t,error:n}=await (0,u.Rp)();if(1===t.length){let{name:e,path:n,version:r,exports:o}=t[0];E(e),A(n),C(r),N((0,u.ce)(e,o)),i(7)}else t.length>1?(L(t.map(e=>({label:`${e.name}@${e.version} ${o.default.gray(e.path)}`,value:`${e.name}@${e.version}:${e.path}`}))),x(t),i(3)):(y(n),i(1))})()},[]),n){case 2:return r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},r.default.createElement(c.default,{type:"dots"}))," Searching for package file...");case 7:return r.default.createElement(s.Box,{flexDirection:"column"},r.default.createElement(s.Text,null,"The following package details have been found:"),r.default.createElement(s.Box,{marginLeft:1,marginTop:.5},r.default.createElement(s.Text,null,"\uD83D\uDCE6 ",S,"@",D)),r.default.createElement(s.Newline,null),r.default.createElement(s.Text,null,e?"Press return to complete":"Send details to zeroheight?",!e&&r.default.createElement(s.Text,{dimColor:!0},"(Y/n):")),r.default.createElement(_.Z,{isChecked:!0,onChange:R,onSubmit:e?()=>i(0):z,value:P}));case 3:return r.default.createElement(s.Box,{flexDirection:"column"},r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},"\uD83D\uDCE6 ",b.length," package files found")),r.default.createElement(s.Newline,null),r.default.createElement(s.Text,null,"Select specific package to ",e?"preview":"send","?"," ",r.default.createElement(s.Text,{dimColor:!0},"(Y/n):")),r.default.createElement(_.Z,{isChecked:!0,onChange:k,onSubmit:e=>{e?i(4):z(!0)},value:M}));case 4:return r.default.createElement(r.default.Fragment,null,r.default.createElement(s.Box,null,r.default.createElement(s.Text,null,"Select packages - ↑/↓ to move, Space to toggle, Enter to confirm")),r.default.createElement(h,{reservedLines:4},r.default.createElement(g.Z,{as:"multiselect",options:w,onChange:e=>{F(e),e.includes("continue")&&i(6)},onSubmit:()=>{O.length>0?i(6):(y("No packages selected"),i(1))}})));case 6:return r.default.createElement(s.Box,{flexDirection:"column"},r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},O.length," ",O.length>1?"packages":"package"," selected")),r.default.createElement(s.Newline,null),r.default.createElement(s.Text,null,e?"Press return to complete":"Send details to zeroheight?",!e&&r.default.createElement(s.Text,{dimColor:!0},"(Y/n):")),r.default.createElement(_.Z,{isChecked:!0,onChange:R,onSubmit:e?()=>i(0):z,value:P}));case 5:return r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"green"},r.default.createElement(c.default,{type:"dots"}))," Sending details to zeroheight...");case 0:return r.default.createElement(s.Text,null,"Complete - details"," ",e?"found (dry run - not sent)":"sent to your zeroheight account");case 1:return r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:"red"},"Error:")," ",m);default:return r.default.createElement(s.Text,null,"Done")}}var b=n(448);async function x(e,t){e.interactive?(0,s.render)(r.createElement(y,{dryRun:e.dryRun}),t):(0,s.render)(r.createElement(m,{allowedPackages:e.packages,dryRun:e.dryRun}))}function S(){return new i.Command().command("track-package").description("Track the latest version of your package in zeroheight").configureHelp({showGlobalOptions:!0}).addOption(new i.Option("-in, --interactive [boolean]","disable to skip manual input (useful when running in CI)").default(!0).argParser(e=>(0,l.default)(e))).addOption(new i.Option("-p, --packages [packageNames]","specify the packages to search for, use multiple times to match more than one package").argParser(u.Bi)).addOption(new i.Option("-d, --dry-run","don't push results to zeroheight").default(!1)).action(async e=>{e.interactive||(0,b.If)();try{await x(e)}catch(e){console.error(e),process.exitCode=1}})}},965:function(e,t,n){n.d(t,{Bi:()=>u,Rp:()=>s,ce:()=>d,u1:()=>a});var r=n(292),i=n(403),o=n(367);async function a(e){let t=(0,i.join)(process.cwd(),e??"");return(0,o.g8)(t,"**/**/package.json",[])}async function s(e){let t=process.cwd(),n=await a();if(0===n.length)return{files:[],error:"Can't find any package files"};try{let i=await Promise.all(n.map(async e=>{let n=await (0,r.readFile)(e,"utf-8"),i=JSON.parse(n);return{name:i.name,path:`.${e.split(t).pop()}`,version:i.version??"0.0.0",exports:i.exports}}));if(i.sort(l),(null==e?void 0:e.length)&&!(i=i.filter(t=>e.includes(t.name))).length)return{files:[],error:"Can't find any matching packages"};return{files:i,error:null}}catch{return{files:[],error:`Can't parse file ${n[0]}`}}}function l(e,t){let n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),r=c(e.path),i=c(t.path),o=r.split("/"),a=i.split("/");if(o.length!==a.length)return o.length-a.length;for(let e=0;e<o.length;e++){let t=n.compare(o[e]??"",a[e]??"");if(0!==t)return t}return n.compare(e.name,t.name)}function c(e){let t=e.replace(/\\/g,"/");return t=t.replace(/^(?:\.[/]|[/]{1,2}|[A-Za-z]:[/])/,""),i.default.posix.dirname(t)}function d(e,t){return t?Object.keys(t).map(t=>(0,i.join)(e,t)).filter(t=>t!==e):[]}function u(e,t=[]){return[...t,...e.split(",").map(e=>e.trim()).filter(Boolean)]}},22:function(e,t,n){n.d(t,{$O:()=>p,BW:()=>u,Mx:()=>s,Yw:()=>c,iI:()=>d,jM:()=>l,lx:()=>m,ru:()=>f});var r,i=n(929),o=n(410),a=n(448),s=((r={}).Success="success",r.Error="error",r.Fail="fail",r);function l(){return"dev"===process.env.NODE_ENV?new URL("https://zeroheight.dev"):new URL("https://zeroheight.com")}async function c(e,t,n,r,i){return h("/design_system_packages",{name:e,path:t,latest_version:n,aliases:r},i)}async function d(e,t,n,r,i){return h("/monitored_repositories",{name:e,lock_file_path:n,packages:r,version:t},i)}async function u(e,t,n){return h("/component_usages",{repo_name:t,usage:[...i.Transformers.transformComponentUsage(e.react),...e.angular??[]].filter(Boolean)},n)}async function p(e,t,n){return h("/token_literal_usages",{token_literal_usage:{repo_name:t,usage:i.Transformers.transformRawColorUsage(e)}},n)}async function f(e){return _("/component_usages/repo_names",e)}async function m(e){return _("/auth_tokens",e)}async function _(e,t){return y(e,t,{method:"GET"})}async function h(e,t,n){return y(e,n,{method:"POST",body:JSON.stringify(t)})}async function g(e){return new Promise(t=>setTimeout(t,e))}async function y(e,t,n){let r=l();r.pathname="/open_api/v2"+e,"dev"===process.env.NODE_ENV&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0");let i=0;for(;i<3;){a.ZP.info({request:{url:r.toString(),init:n,retries:i}},"Making API request");let e=await fetch(r,{...n,headers:{"X-API-CLIENT-NAME":"cli","X-API-CLIENT":t.client,"X-API-KEY":t.token,"X-API-CLIENT-VERSION":"4.0.2","Content-Type":"application/json"}});if(401===e.status)throw a.ZP.error({response:{status:e.status,body:await e.text()}},"Unauthorized response from API"),new o.yj;if(429===e.status){i++;let t=1e3*(await e.json()).data.reset_time-Date.now();a.ZP.info(`Rate limited, waiting for ${t}ms`),await g(t);continue}if(e.status<200||e.status>=300){if(a.ZP.error({response:{status:e.status,body:await e.text()}},"API request failed"),403===e.status)throw new o.EP;throw new o.Ko}let s=await e.json();return a.ZP.info({response:{status:e.status,body:s}},"API response"),s}throw new o.P2}},40:function(e,t,n){n.d(t,{iL:()=>l,qA:()=>a,zi:()=>s});var r=n(292),i=n(445),o=n(403);function a(){return o.default.join((0,i.homedir)(),".zeroheight-config.json")}async function s(){try{let e=await (0,r.readFile)(a(),"utf8"),{token:t,client:n,repoNames:i={}}=JSON.parse(e);return{token:t,client:n,repoNames:i}}catch(n){let e=process.env.ZEROHEIGHT_CLIENT_ID,t=process.env.ZEROHEIGHT_ACCESS_TOKEN;if(e&&t)return{token:t,client:e,repoNames:{}};return null}}async function l(e){let t=await s()??{repoNames:{}},n=JSON.stringify({...t,...e,repoNames:{...t.repoNames,...e.repoNames??{}}});return(0,r.writeFile)(a(),n)}},410:function(e,t,n){n.d(t,{EP:()=>o,Ko:()=>a,MS:()=>r,P2:()=>s,yj:()=>i});class r extends Error{constructor(e){super(e),this.name="ApiError"}}class i extends r{constructor(){super("Unauthorized. Please reset your authentication by running: npx @zeroheight/adoption-cli auth")}}class o extends r{constructor(){super("The authentication token used does not have the correct scope. \n\nPlease create a new authentication token with the 'Adoption' scopes and then reset your authentication by running: npx @zeroheight/adoption-cli auth")}}class a extends r{constructor(){super("An unknown error occurred while calling the zeroheight API")}}class s extends r{constructor(){super("Max retries exceeded while calling the zeroheight API")}}},448:function(e,t,n){n.d(t,{If:()=>c,ZP:()=>d,H4:()=>a});var r=n(727);let i={base:null,level:"warn",timestamp:s.pino.stdTimeFunctions.isoTime,formatters:{level:e=>({level:e.toUpperCase()})}},o=s.pino.multistream([]);function a(e){o.add({stream:(0,r.createWriteStream)(e,{flags:"a"})})}function c(){o.add({stream:(0,l.default)({destination:process.stderr,ignore:"pid,hostname"}),level:"error"})}let d=(0,s.pino)(i,o)},314:function(e,t,n){n.d(t,{Z:()=>o});var r=n(810),i=n(149);function o({client:e,token:t}){let n=Array(Math.max(3,t.length-12)).fill("✲");return r.createElement(i.Box,{borderStyle:"single",margin:1,padding:1},r.createElement(i.Box,{flexDirection:"column"},r.createElement(i.Box,{gap:7},r.createElement(i.Text,{bold:!0},"Client ID:"),r.createElement(i.Text,null,e)),r.createElement(i.Box,{gap:4},r.createElement(i.Text,{bold:!0},"Access Token:"),r.createElement(i.Text,null,t.slice(0,6),n,t.slice(t.length-6,t.length)))))}},432:function(e,t,n){n.d(t,{Z:()=>d});var r=n(810),i=n(149),o=n(829),a=n(950),s=n(165),l=n(795),c=n(314);function d({onCheckCredentials:e,onSaveCredentials:t,configPath:n}){let[d,u]=r.useState(""),[p,f]=r.useState(""),[m,_]=r.useState(""),[h,g]=r.useState("client"),y=async()=>{g("authenticating"),await e(d,p),g("write")},b=async e=>{await t(e,d.trim(),p.trim())};return r.createElement(i.Box,{flexDirection:"column"},r.createElement(i.Text,null,"\uD83D\uDC4B Welcome to the ",r.createElement(i.Text,{color:"#f63e7c"},"zeroheight")," adoption CLI tool"),r.createElement(i.Newline,null),r.createElement(i.Text,null,"If you need a new auth token, generate them from the"," ",r.createElement(a.default,{url:"https://zeroheight.com/settings/team/developers"},r.createElement(i.Text,{underline:!0,color:"#f63e7c"},"Developer Settings"))),r.createElement(i.Newline,null),"client"===h&&r.createElement(i.Box,null,r.createElement(i.Text,null,"Client ID: "),r.createElement(o.default,{onChange:u,value:d,onSubmit:e=>{0!==e.trim().length&&g("token")}})),"token"===h&&r.createElement(i.Box,null,r.createElement(i.Text,null,"Access Token: "),r.createElement(o.default,{onChange:f,value:p,onSubmit:e=>{0!==e.trim().length&&y()}})),"authenticating"===h&&r.createElement(i.Text,null,r.createElement(i.Text,{color:"green"},r.createElement(s.default,{type:"dots"}))," checking authentication details..."),"write"===h&&r.createElement(i.Box,{flexDirection:"column"},r.createElement(c.Z,{client:d,token:p}),r.createElement(i.Text,null,"Write updated credentials to"," ",r.createElement(a.default,{url:n},n),"?"," ",r.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.createElement(l.Z,{isChecked:!0,onChange:_,onSubmit:b,value:m})),r.createElement(i.Newline,null))}},381:function(e,t,n){n.d(t,{Z:()=>a});var r=n(810),i=n(149),o=n(950);function a(){return r.createElement(r.Fragment,null,r.createElement(i.Box,{borderStyle:"double",paddingLeft:1,paddingRight:1,marginBottom:1,flexDirection:"column"},r.createElement(i.Box,{justifyContent:"center",marginBottom:1},r.createElement(i.Text,{bold:!0},"Welcome \uD83D\uDC4B")),r.createElement(i.Box,{marginBottom:1},r.createElement(i.Text,null,"Get started with the"," ",r.createElement(i.Text,{color:"#f63e7c",bold:!0},"zeroheight")," ","measurement CLI and start tracking your design system's adoption.")),r.createElement(i.Text,null,"For more information on how to set this up, check"," ",r.createElement(o.default,{url:"https://zeroheight.com/help/article/adoption-private-beta-overview/"},"here"),".")))}},468:function(e,t,n){n.d(t,{Z:()=>s});var r=n(810),i=n(149),o=n(950),a=n(999);function s({latestVersion:e}){let t="major"===(0,a.diff)("4.0.2",e);return r.createElement(r.Fragment,null,r.createElement(i.Box,{borderStyle:"double",paddingLeft:1,paddingRight:1,marginBottom:1,flexDirection:"column"},r.createElement(i.Box,{justifyContent:"center",marginBottom:1},r.createElement(i.Text,null,"\uD83D\uDC4B It seems you're not using the latest version of this package")),r.createElement(i.Box,{flexDirection:"column",alignItems:"center",marginBottom:1},r.createElement(i.Box,null,r.createElement(i.Text,{color:t?"redBright":"blueBright",bold:!0},"4.0.2"),r.createElement(i.Text,{bold:!0}," -> "),r.createElement(i.Text,{color:"green",bold:!0},e)),r.createElement(i.Box,null,r.createElement(i.Text,null,"Update using: "),r.createElement(i.Text,{bold:!0},"npm i @zeroheight/adoption-cli"))),r.createElement(i.Box,{flexDirection:"column",alignItems:"center"},r.createElement(i.Text,null,"For more information on the latest version, check"," ",r.createElement(o.default,{url:"https://www.npmjs.com/package/@zeroheight/adoption-cli"},"here")))))}},795:function(e,t,n){n.d(t,{Z:()=>a});var r=n(810),i=n(829),o=n(904);let a=({isChecked:e,onChange:t,onSubmit:n,placeholder:a,value:s,...l})=>{let c=r.useCallback(t=>{n((0,o.default)(t,{default:e}))},[e,n]);return r.createElement(i.default,{...l,placeholder:a,value:s,onChange:t,onSubmit:c})}},651:function(e,t,n){n.d(t,{Z:()=>o});var r=n(810),i=n(149);function o({options:e,visibleOptionCount:t=5,...n}){let o,[a,s]=(0,r.useState)(0),[l,d]=(0,r.useState)(0),u=Math.min(t,e.length),p=Math.max(0,e.length-u);(0,i.useInput)((t,n)=>{let r=a;if(n.upArrow&&(r=Math.max(0,a-1)),n.downArrow&&(r=Math.min(e.length-1,a+1)),r!==a){let e=l;r<l?e=r:r>l+u-1&&(e=r-u+1),e=Math.min(e,p),s(r),d(e)}});let f=l>0,m=l<p;if("multiselect"===n.as){let{as:t,...i}=n;o=r.default.createElement(c.MultiSelect,{...i,options:e,visibleOptionCount:u})}else{let{as:t,...i}=n;o=r.default.createElement(c.Select,{...i,options:e,visibleOptionCount:u})}return r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Text,{dimColor:!0},f?"↑ more results above":"\xa0"),o,r.default.createElement(i.Text,{dimColor:!0},m?"↓ more results below":"\xa0"))}},725:function(e){e.exports=d},117:function(e){e.exports=u},178:function(e){e.exports=p},727:function(e){e.exports=f},149:function(e){e.exports=m},950:function(e){e.exports=_},92:function(e){e.exports=h},165:function(e){e.exports=g},829:function(e){e.exports=y},181:function(e){e.exports=b},445:function(e){e.exports=x},764:function(e){e.exports=S},403:function(e){e.exports=E},511:function(e){e.exports=T},810:function(e){e.exports=A},999:function(e){e.exports=D},290:function(e){e.exports=C},871:function(e){e.exports=I},904:function(e){e.exports=N},292:function(e){e.exports=P(import.meta.url)("fs/promises")},673:function(e){e.exports=P(import.meta.url)("node:events")},561:function(e){e.exports=P(import.meta.url)("node:fs")},977:function(e){e.exports=P(import.meta.url)("node:fs/promises")},612:function(e){e.exports=P(import.meta.url)("node:os")},411:function(e){e.exports=P(import.meta.url)("node:path")},492:function(e){e.exports=P(import.meta.url)("node:stream")},915:function(e){e.exports=P(import.meta.url)("node:string_decoder")},41:function(e){e.exports=P(import.meta.url)("node:url")}},F={};function W(e){var t=F[e];if(void 0!==t)return t.exports;var n=F[e]={exports:{}};return O[e](n,n.exports,W),n.exports}R="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",M="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",k="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",w=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},L=e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[R])return e;if(e.then){var t=[];t.d=0,e.then(e=>{n[M]=e,w(t)},e=>{n[k]=e,w(t)});var n={};return n[R]=e=>e(t),n}}var r={};return r[R]=function(){},r[M]=e,r}),W.a=(e,t,n)=>{n&&((r=[]).d=-1);var r,i,o,a,s=new Set,l=e.exports,c=new Promise((e,t)=>{a=t,o=e});c[M]=l,c[R]=e=>{r&&e(r),s.forEach(e),c.catch(function(){})},e.exports=c,t(e=>{i=L(e);var t,n=()=>i.map(e=>{if(e[k])throw e[k];return e[M]}),o=new Promise(e=>{(t=()=>e(n)).r=0;var o=e=>e!==r&&!s.has(e)&&(s.add(e),e&&!e.d&&(t.r++,e.push(t)));i.map(e=>e[R](o))});return t.r?o:n()},e=>(e?a(c[k]=e):o(l),w(r))),r&&r.d<0&&(r.d=0)},W.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return W.d(t,{a:t}),t},W.d=(e,t)=>{for(var n in t)W.o(t,n)&&!W.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},W.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),W.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var B=W(584),z=(B=await B).Z;export{z as default};
426
+ - components/**/*.{js,ts}`)}}},772:function(e,t,n){n.d(t,{G:()=>g});var r=n(810),i=n(725),o=n(149),a=n(748),s=n(795),l=n(432),c=n(40),d=n(950),u=n(314);function p({configPath:e,existingConfig:t}){return r.createElement(o.Box,{flexDirection:"column"},r.createElement(o.Text,{bold:!0,color:"yellow"},"You already have your authentication credentials set up"),r.createElement(o.Newline,null),r.createElement(o.Text,null,"You can find them in: ",r.createElement(d.default,{url:e},e)),r.createElement(u.Z,{client:t.client,token:t.token}))}var f=n(165),m=n(22);function _({token:e,client:t}){let{exit:n}=(0,o.useApp)(),[i,d]=r.default.useState(""),[_,h]=r.default.useState(null),[g,y]=r.default.useState(0);async function b(e,t,n){let r=t??(null==e?void 0:e.client),i=n??(null==e?void 0:e.token);if(!r||!i)return void y(3);try{let e={client:r,token:i};y(0),h(e),await (0,c.iL)(e)}catch{y(3);return}y(4)}async function x(e){e?y(2):y(5)}async function S(e,t){try{await (0,m.lx)({token:t,client:e})}catch{return y(6),n()}}async function E(e,t,n){e?await b(_,t,n):y(5)}switch(r.default.useEffect(()=>{(0,c.zi)().then(n=>{y(0),h(n),n?n&&e||n&&t?b(n,t,e):n&&y(1):y(2)})},[]),g){case 1:return r.default.createElement(r.default.Fragment,null,(null==_?void 0:_.client)&&(null==_?void 0:_.token)&&r.default.createElement(p,{configPath:(0,c.qA)(),existingConfig:_}),r.default.createElement(o.Box,null,r.default.createElement(o.Text,null,"Would you like to overwrite these credentials?"," ",r.default.createElement(o.Text,{dimColor:!0},"(y/N)")),r.default.createElement(s.Z,{isChecked:!1,value:i,onChange:d,onSubmit:x})));case 2:return r.default.createElement(l.Z,{onCheckCredentials:S,onSaveCredentials:E,configPath:(0,c.qA)()});case 4:return r.default.createElement(o.Box,{flexDirection:"column"},r.default.createElement(o.Text,{color:a.n.zh.color.base.text.status.positive},"Updated credentials"),(null==_?void 0:_.client)&&(null==_?void 0:_.token)&&r.default.createElement(u.Z,{client:_.client,token:_.token}));case 5:return r.default.createElement(o.Box,{flexDirection:"column"},r.default.createElement(o.Text,{color:"yellow"},"Credentials are unchanged"),(null==_?void 0:_.client)&&(null==_?void 0:_.token)&&r.default.createElement(u.Z,{client:_.client,token:_.token}));case 3:return r.default.createElement(o.Text,{color:"yellow"},"Something went wrong, try again.");case 6:return r.default.createElement(o.Text,{color:a.n.zh.color.base.text.status.negative},"Unable to authenticate. Please re-run the command to try again.");case 0:return r.default.createElement(o.Text,null,r.default.createElement(o.Text,{color:a.n.zh.color.base.text.status.positive},r.default.createElement(f.default,{type:"dots"}))," Loading config...");default:return r.default.createElement(o.Text,null,"Done")}}async function h(e,t){(0,o.render)(r.createElement(_,{token:e.token,client:e.client}),t)}function g(){return new i.Command().command("auth").description("Authenticate with zeroheight").configureHelp({showGlobalOptions:!0}).addHelpText("before","Set credentials for performing actions with zeroheight. Credentials will default to ZEROHEIGHT_CLIENT_ID and ZEROHEIGHT_ACCESS_TOKEN environment variables if not supplied").option("-c, --client <client_id>","zeroheight Client ID",process.env.ZEROHEIGHT_CLIENT_ID).option("-t, --token <access_token>","zeroheight Access Token",process.env.ZEROHEIGHT_ACCESS_TOKEN).action(async e=>{try{await h(e)}catch(e){console.error(e),process.exitCode=1}})}},306:function(e,t,n){n.d(t,{C:()=>C});var r=n(810),o=n(725),a=n(149),s=n(165),l=n(403),c=n(292),d=n(367);class u{}class p extends u{packages;constructor(e){super();let t=JSON.parse(e);switch(t.lockfileVersion){case 1:this.packages=this.#i4(t);break;case 2:this.packages=this.#i5(t);break;default:this.packages=this.#i7(t)}}#i4(e){return Object.entries(e.dependencies).map(([e,t])=>({name:this.#i9(e),version:t.version}))}#i5(e){return Object.entries(e.packages).map(([e,t])=>({name:this.#i9(e),version:t.version})).filter(e=>e.name&&e.version)}#i7(e){return this.#i5(e)}#i9(e){let t="node_modules/";return e.startsWith(t)?e.slice(t.length):e}}class f extends u{packages;constructor(e){super(),this.packages=[];let t=(0,i.parse)(e);6>parseInt(t.lockfileVersion,10)?this.packages=this.#oe(t):this.packages=this.#ot(t)}#oe(e){return Object.entries(e.dependencies).map(([e,t])=>({name:e,version:t})).filter(e=>e.name&&e.version)}#ot(e){return Object.keys(e.packages).map(e=>{let t=e.lastIndexOf("@"),n=e.slice(0,t),r=e.slice(t+1);return n.startsWith("/")&&(n=n.slice(1)),{name:n,version:r}}).filter(e=>e.name&&e.version)}}class m extends u{packages;constructor(e){super(),this.packages=[];try{let t=(0,i.parse)(e);if(t.__metadata){let e={...t};null==e||delete e.__metadata,this.packages=this.#on(e)}}catch{this.packages=this.#i4(e)}}#i4(e){let t=e.split("\n\n").filter(e=>!e.startsWith("#")).map(e=>e.trimStart()),n=/[^"\s](\S+)(?<!")(?=@)/gi,r=/(?<=")(.+)(?<!")/gi;return t.reduce((e,t)=>{var i,o,a,s,l;let c=t.split("\n").map(e=>e.trim()),d=null==(a=c.at(0))||null==(o=a.match(n))||null==(i=o[0])?void 0:i.replace('"',""),u=null==(l=c.slice(1).find(e=>e.startsWith("version")))||null==(s=l.match(r))?void 0:s[0];return d&&u?e.concat([{name:d,version:u}]):e},[])}#on(e){return Object.entries(e).map(([e,t])=>({name:this.#i9(e),version:t.version.toString()})).filter(e=>e.name)}#i9(e){return e.startsWith("@")?"@"+e.substring(1).split("@").at(0):e.split("@").at(0)}}async function _(e){let t=JSON.parse(await (0,c.readFile)(e,"utf-8"));return{name:t.name,version:t.version}}async function h(e){let t=(0,l.basename)(e),n=function(e){switch(e){case"yarn.lock":return m;case"package-lock.json":return p;case"pnpm-lock.yaml":case"shrinkwrap.yaml":return f;default:return null}}(t);if(!n)throw Error(`Can't find parser for ${t}`);return new n(await (0,c.readFile)(e,"utf-8"))}async function g(e){let t=(0,l.join)(process.cwd(),e??"");return(0,d.g8)(t,"**/**/{package-lock.json,shrinkwrap.yaml,pnpm-lock.yaml,yarn.lock}",[])}var y=n(965),b=n(22),x=n(40),S=n(410),E=n(748);function T({packageDirs:e,packageName:t,dryRun:n}){let[i,o]=r.default.useState(),[c,d]=r.default.useState({});function u(e,t,n){n&&(process.exitCode=1),d(r=>({...r,[e]:{...r[e],step:t,error:n}}))}async function p(){let r=process.cwd(),i=[],a=[];e?(a=(await Promise.all(e.map(g))).flat(),i=(await Promise.all(e.map(y.u1))).flat()):(a=await (0,y.u1)(),i=await g());let s=[...i,...a].map(e=>({base:(0,l.dirname)(e),filename:(0,l.basename)(e)})).reduce((e,t)=>(e[t.base]=[...e[t.base]??[],t.filename],e),{}),c=await (0,x.zi)();if(0===Object.keys(s).length)return void o("No NPM packages found");for(let[e,i]of Object.entries(s)){let a,s=i.filter(e=>"package.json"!==e).at(0);if(!s)continue;try{if(a=await _((0,l.join)(e,"package.json")),t&&(a.name=t),!a.name){o(`Name field is missing in your ${(0,l.basename)(e)}/package.json file. Re-run the command with --package-name <name> to continue.`);continue}}catch(e){continue}u(a.name,2);let d=await h((0,l.join)(e,s)),p=d.packages;d instanceof m&&(p=d.packages.filter(e=>e.name!==a.name));let f=(0,l.join)(e.split(r).pop()??"",s);if(!c){o("No credentials, must authenticate to send data to zeroheight.");continue}try{if(n)u(a.name,0);else{u(a.name,3);let e=await (0,b.iI)(a.name,a.version,f,p,{token:c.token,client:c.client});e.status===b.Mx.Success?u(a.name,0):u(a.name,1,e.message)}}catch(t){let e="Failed to send data to zeroheight";t instanceof S.MS&&(e=t.message),u(a.name,1,e)}}}return r.default.useEffect(()=>{p()},[]),r.default.createElement(r.default.Fragment,null,Object.entries(c).map(([e,{step:t,error:i}])=>r.default.createElement(a.Box,{key:e,flexDirection:"column"},2===t&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:E.n.zh.color.base.text.status.positive},r.default.createElement(s.default,{type:"dots"})),`${e} - searching for package details...`),3===t&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:E.n.zh.color.base.text.status.positive},r.default.createElement(s.default,{type:"dots"})),`${e} - sending data to zeroheight...`),0===t&&r.default.createElement(a.Box,{flexDirection:"column"},r.default.createElement(a.Text,{color:E.n.zh.color.base.text.status.positive},"Success"),r.default.createElement(a.Text,null,"Packages being used by ",e," have been"," ",n?"found (dry run - not sent)":"sent to your zeroheight account")),1===t&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:E.n.zh.color.base.text.status.negative},"Error:"," "),`${e} - ${i}`))),i&&r.default.createElement(a.Text,null,r.default.createElement(a.Text,{color:E.n.zh.color.base.text.status.negative},"Error:")," ",i))}var A=n(448);async function D(e,t){(0,a.render)(r.createElement(T,{packageDirs:e.dir,packageName:e.packageName,dryRun:e.dryRun}))}function C(){return new o.Command().command("monitor-repo").description("Monitor package usage in a repository").configureHelp({showGlobalOptions:!0}).addOption(new o.Option("-d, --dir <path...>","use package directory to find package.json and lockfile")).addOption(new o.Option("-p, --package-name <name>","specify the name used to identify the package in zeroheight")).addOption(new o.Option("--dry-run","don't push results to zeroheight").default(!1)).action(async e=>{(0,A.If)();try{await D(e)}catch(e){console.error(e),process.exitCode=1}})}},512:function(e,t,n){n.d(t,{G:()=>E});var r=n(810),i=n(725),s=n(149),l=n(904),c=n(165),d=n(748),u=n(40),p=n(965),f=n(22),m=n(410);function _({allowedPackages:e,dryRun:t}){let{exit:n}=(0,s.useApp)(),[i,o]=r.default.useState(2),[a,l]=r.default.useState(null),[_,h]=r.default.useState([]),[g,y]=r.default.useState(null),[b,x]=r.default.useState(null);async function S(){let r=await (0,u.zi)()??{token:"temp",client:"temp"},{files:i,error:a}=await (0,p.Rp)(e);try{if(1===i.length){let{name:e,path:a,version:s,exports:c}=i[0];y(e),x(s),o(4);let d=(0,p.ce)(e,c);if(t)o(0),n();else{let t=await (0,f.Yw)(e,a,s,d,{token:r.token,client:r.client});t.status===f.Mx.Success?o(0):(l(t.message),o(1)),n()}}else i.length>1?(h(i),o(3),t||await Promise.all(i.map(async e=>{let t=(0,p.ce)(e.name,e.exports);await (0,f.Yw)(e.name,e.path,e.version,t,{token:r.token,client:r.client})}))):(l(a),o(1),n());o(0),n()}catch(t){let e="Failed to send data to zeroheight";t instanceof m.MS&&(e=t.message),l(e),o(1),n()}}return r.default.useEffect(()=>{S()},[]),r.default.createElement(r.default.Fragment,null,2===i&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(c.default,{type:"dots"}))," searching for package file..."),4===i&&r.default.createElement(r.default.Fragment,null,r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},"Details found:")," ",g,"@",b),r.default.createElement(s.Newline,null),!t&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(c.default,{type:"dots"}))," sending to zeroheight...")),3===i&&r.default.createElement(r.default.Fragment,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},_.length," packages found"),r.default.createElement(s.Newline,null),!t&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(c.default,{type:"dots"}))," sending to zeroheight...")),0===i&&r.default.createElement(s.Text,null,"Complete -"," ",_.length>1?`details for ${_.length} packages`:"package details"," ",t?"found (dry run - not sent)":"sent to your zeroheight account"),1===i&&r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.negative},"Error:")," ",a))}var h=n(795);function g({reservedLines:e=0,children:t}){let{stdout:n}=(0,s.useStdout)(),i=n.rows??24,l=n.columns??80,c=t.props.options,d=Math.max(3,Math.min(i-e,c.length)),u=r.default.useMemo(()=>c.map(e=>({...e,label:(0,a.default)(e.label,l-5,{position:"end",truncationCharacter:o.default.gray("…")})})),[c,l]);return r.default.cloneElement(t,{options:u,visibleOptionCount:d})}var y=n(651);function b({dryRun:e}){let{exit:t}=(0,s.useApp)(),[n,i]=r.default.useState(2),[a,l]=r.default.useState(null),[_,b]=r.default.useState(null),[x,S]=r.default.useState([]),[E,T]=r.default.useState(null),[A,D]=r.default.useState(null),[C,I]=r.default.useState(null),[N,P]=r.default.useState([]),[R,M]=r.default.useState(""),[k,w]=r.default.useState(""),[L,O]=r.default.useState([]),[F,W]=r.default.useState([]);async function B(e,t,n,r){await (0,f.Yw)(e,t,n,r,a)}async function z(){i(5);try{if(x.length>0){let e=x.filter(e=>F.includes(`${e.name}@${e.version}:${e.path}`));e.length>0?await Promise.all(e.map(async e=>{let t=(0,p.ce)(e.name,e.exports);B(e.name,e.path,e.version,t)})):await Promise.all(x.map(async e=>{let t=(0,p.ce)(e.name,e.exports);B(e.name,e.path,e.version,t)}))}else await B(E,A,C,N);i(0)}catch(t){let e="Failed to send data to zeroheight";t instanceof m.MS&&(e=t.message),b(e),i(1)}finally{t()}}let G=async e=>{if(e)return z();t()};switch(r.default.useEffect(()=>{(async()=>{let e=await (0,u.zi)();e&&l({token:e.token,client:e.client});let{files:t,error:n}=await (0,p.Rp)();if(1===t.length){let{name:e,path:n,version:r,exports:o}=t[0];T(e),D(n),I(r),P((0,p.ce)(e,o)),i(7)}else t.length>1?(O(t.map(e=>({label:`${e.name}@${e.version} ${o.default.gray(e.path)}`,value:`${e.name}@${e.version}:${e.path}`}))),S(t),i(3)):(b(n),i(1))})()},[]),n){case 2:return r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(c.default,{type:"dots"}))," Searching for package file...");case 7:return r.default.createElement(s.Box,{flexDirection:"column"},r.default.createElement(s.Text,null,"The following package details have been found:"),r.default.createElement(s.Box,{marginLeft:1,marginTop:.5},r.default.createElement(s.Text,null,"\uD83D\uDCE6 ",E,"@",C)),r.default.createElement(s.Newline,null),r.default.createElement(s.Text,null,e?"Press return to complete":"Send details to zeroheight?",!e&&r.default.createElement(s.Text,{dimColor:!0},"(Y/n):")),r.default.createElement(h.Z,{isChecked:!0,onChange:M,onSubmit:e?()=>i(0):G,value:R}));case 3:return r.default.createElement(s.Box,{flexDirection:"column"},r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},"\uD83D\uDCE6 ",x.length," package files found")),r.default.createElement(s.Newline,null),r.default.createElement(s.Text,null,"Select specific package to ",e?"preview":"send","?"," ",r.default.createElement(s.Text,{dimColor:!0},"(Y/n):")),r.default.createElement(h.Z,{isChecked:!0,onChange:w,onSubmit:e=>{e?i(4):G(!0)},value:k}));case 4:return r.default.createElement(r.default.Fragment,null,r.default.createElement(s.Box,null,r.default.createElement(s.Text,null,"Select packages - ↑/↓ to move, Space to toggle, Enter to confirm")),r.default.createElement(g,{reservedLines:4},r.default.createElement(y.Z,{as:"multiselect",options:L,onChange:e=>{W(e),e.includes("continue")&&i(6)},onSubmit:()=>{F.length>0?i(6):(b("No packages selected"),i(1))}})));case 6:return r.default.createElement(s.Box,{flexDirection:"column"},r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},F.length," ",F.length>1?"packages":"package"," selected")),r.default.createElement(s.Newline,null),r.default.createElement(s.Text,null,e?"Press return to complete":"Send details to zeroheight?",!e&&r.default.createElement(s.Text,{dimColor:!0},"(Y/n):")),r.default.createElement(h.Z,{isChecked:!0,onChange:M,onSubmit:e?()=>i(0):G,value:R}));case 5:return r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.positive},r.default.createElement(c.default,{type:"dots"}))," Sending details to zeroheight...");case 0:return r.default.createElement(s.Text,null,"Complete - details"," ",e?"found (dry run - not sent)":"sent to your zeroheight account");case 1:return r.default.createElement(s.Text,null,r.default.createElement(s.Text,{color:d.n.zh.color.base.text.status.negative},"Error:")," ",_);default:return r.default.createElement(s.Text,null,"Done")}}var x=n(448);async function S(e,t){e.interactive?(0,s.render)(r.createElement(b,{dryRun:e.dryRun}),t):(0,s.render)(r.createElement(_,{allowedPackages:e.packages,dryRun:e.dryRun}))}function E(){return new i.Command().command("track-package").description("Track the latest version of your package in zeroheight").configureHelp({showGlobalOptions:!0}).addOption(new i.Option("-in, --interactive [boolean]","disable to skip manual input (useful when running in CI)").default(!0).argParser(e=>(0,l.default)(e))).addOption(new i.Option("-p, --packages [packageNames]","specify the packages to search for, use multiple times to match more than one package").argParser(p.Bi)).addOption(new i.Option("-d, --dry-run","don't push results to zeroheight").default(!1)).action(async e=>{e.interactive||(0,x.If)();try{await S(e)}catch(e){console.error(e),process.exitCode=1}})}},965:function(e,t,n){n.d(t,{Bi:()=>u,Rp:()=>s,ce:()=>d,u1:()=>a});var r=n(292),i=n(403),o=n(367);async function a(e){let t=(0,i.join)(process.cwd(),e??"");return(0,o.g8)(t,"**/**/package.json",[])}async function s(e){let t=process.cwd(),n=await a();if(0===n.length)return{files:[],error:"Can't find any package files"};try{let i=await Promise.all(n.map(async e=>{let n=await (0,r.readFile)(e,"utf-8"),i=JSON.parse(n);return{name:i.name,path:`.${e.split(t).pop()}`,version:i.version??"0.0.0",exports:i.exports}}));if(i.sort(l),(null==e?void 0:e.length)&&!(i=i.filter(t=>e.includes(t.name))).length)return{files:[],error:"Can't find any matching packages"};return{files:i,error:null}}catch{return{files:[],error:`Can't parse file ${n[0]}`}}}function l(e,t){let n=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"}),r=c(e.path),i=c(t.path),o=r.split("/"),a=i.split("/");if(o.length!==a.length)return o.length-a.length;for(let e=0;e<o.length;e++){let t=n.compare(o[e]??"",a[e]??"");if(0!==t)return t}return n.compare(e.name,t.name)}function c(e){let t=e.replace(/\\/g,"/");return t=t.replace(/^(?:\.[/]|[/]{1,2}|[A-Za-z]:[/])/,""),i.default.posix.dirname(t)}function d(e,t){return t?Object.keys(t).map(t=>(0,i.join)(e,t)).filter(t=>t!==e):[]}function u(e,t=[]){return[...t,...e.split(",").map(e=>e.trim()).filter(Boolean)]}},22:function(e,t,n){n.d(t,{$O:()=>p,BW:()=>u,Mx:()=>s,Yw:()=>c,iI:()=>d,jM:()=>l,lx:()=>m,ru:()=>f});var r,i=n(929),o=n(410),a=n(448),s=((r={}).Success="success",r.Error="error",r.Fail="fail",r);function l(){return"dev"===process.env.NODE_ENV?new URL("https://zeroheight.dev"):new URL("https://zeroheight.com")}async function c(e,t,n,r,i){return h("/design_system_packages",{name:e,path:t,latest_version:n,aliases:r},i)}async function d(e,t,n,r,i){return h("/monitored_repositories",{name:e,lock_file_path:n,packages:r,version:t},i)}async function u(e,t,n){return h("/component_usages",{repo_name:t,usage:[...i.Transformers.transformComponentUsage(e.react),...e.angular??[]].filter(Boolean)},n)}async function p(e,t,n){return h("/token_literal_usages",{token_literal_usage:{repo_name:t,usage:i.Transformers.transformRawColorUsage(e)}},n)}async function f(e){return _("/component_usages/repo_names",e)}async function m(e){return _("/auth_tokens",e)}async function _(e,t){return y(e,t,{method:"GET"})}async function h(e,t,n){return y(e,n,{method:"POST",body:JSON.stringify(t)})}async function g(e){return new Promise(t=>setTimeout(t,e))}async function y(e,t,n){let r=l();r.pathname="/open_api/v2"+e,"dev"===process.env.NODE_ENV&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0");let i=0;for(;i<3;){a.ZP.info({request:{url:r.toString(),init:n,retries:i}},"Making API request");let e=await fetch(r,{...n,headers:{"X-API-CLIENT-NAME":"cli","X-API-CLIENT":t.client,"X-API-KEY":t.token,"X-API-CLIENT-VERSION":"4.1.1","Content-Type":"application/json"}});if(401===e.status)throw a.ZP.error({response:{status:e.status,body:await e.text()}},"Unauthorized response from API"),new o.yj;if(429===e.status){i++;let t=1e3*(await e.json()).data.reset_time-Date.now();a.ZP.info(`Rate limited, waiting for ${t}ms`),await g(t);continue}if(e.status<200||e.status>=300){if(a.ZP.error({response:{status:e.status,body:await e.text()}},"API request failed"),403===e.status)throw new o.EP;throw new o.Ko}let s=await e.json();return a.ZP.info({response:{status:e.status,body:s}},"API response"),s}throw new o.P2}},40:function(e,t,n){n.d(t,{iL:()=>l,qA:()=>a,zi:()=>s});var r=n(292),i=n(445),o=n(403);function a(){return o.default.join((0,i.homedir)(),".zeroheight-config.json")}async function s(){try{let e=await (0,r.readFile)(a(),"utf8"),{token:t,client:n,repoNames:i={}}=JSON.parse(e);return{token:t,client:n,repoNames:i}}catch(n){let e=process.env.ZEROHEIGHT_CLIENT_ID,t=process.env.ZEROHEIGHT_ACCESS_TOKEN;if(e&&t)return{token:t,client:e,repoNames:{}};return null}}async function l(e){let t=await s()??{repoNames:{}},n=JSON.stringify({...t,...e,repoNames:{...t.repoNames,...e.repoNames??{}}});return(0,r.writeFile)(a(),n)}},410:function(e,t,n){n.d(t,{EP:()=>o,Ko:()=>a,MS:()=>r,P2:()=>s,yj:()=>i});class r extends Error{constructor(e){super(e),this.name="ApiError"}}class i extends r{constructor(){super("Unauthorized. Please reset your authentication by running: npx @zeroheight/adoption-cli auth")}}class o extends r{constructor(){super("The authentication token used does not have the correct scope. \n\nPlease create a new authentication token with the 'Adoption' scopes and then reset your authentication by running: npx @zeroheight/adoption-cli auth")}}class a extends r{constructor(){super("An unknown error occurred while calling the zeroheight API")}}class s extends r{constructor(){super("Max retries exceeded while calling the zeroheight API")}}},448:function(e,t,n){n.d(t,{If:()=>c,ZP:()=>d,H4:()=>a});var r=n(727);let i={base:null,level:"warn",timestamp:s.pino.stdTimeFunctions.isoTime,formatters:{level:e=>({level:e.toUpperCase()})}},o=s.pino.multistream([]);function a(e){o.add({stream:(0,r.createWriteStream)(e,{flags:"a"})})}function c(){o.add({stream:(0,l.default)({destination:process.stderr,ignore:"pid,hostname"}),level:"error"})}let d=(0,s.pino)(i,o)},314:function(e,t,n){n.d(t,{Z:()=>o});var r=n(810),i=n(149);function o({client:e,token:t}){let n=Array(Math.max(3,t.length-12)).fill("✲");return r.createElement(i.Box,{borderStyle:"single",margin:1,padding:1},r.createElement(i.Box,{flexDirection:"column"},r.createElement(i.Box,{gap:7},r.createElement(i.Text,{bold:!0},"Client ID:"),r.createElement(i.Text,null,e)),r.createElement(i.Box,{gap:4},r.createElement(i.Text,{bold:!0},"Access Token:"),r.createElement(i.Text,null,t.slice(0,6),n,t.slice(t.length-6,t.length)))))}},432:function(e,t,n){n.d(t,{Z:()=>u});var r=n(810),i=n(149),o=n(829),a=n(950),s=n(165),l=n(748),c=n(795),d=n(314);function u({onCheckCredentials:e,onSaveCredentials:t,configPath:n}){let[u,p]=r.useState(""),[f,m]=r.useState(""),[_,h]=r.useState(""),[g,y]=r.useState("client"),b=async()=>{y("authenticating"),await e(u,f),y("write")},x=async e=>{await t(e,u.trim(),f.trim())};return r.createElement(i.Box,{flexDirection:"column"},r.createElement(i.Text,null,"\uD83D\uDC4B Welcome to the"," ",r.createElement(i.Text,{color:l.n.zh.color.base.brand.primary},"zeroheight")," ","adoption CLI tool"),r.createElement(i.Newline,null),r.createElement(i.Text,null,"If you need a new auth token, generate them from the"," ",r.createElement(a.default,{url:"https://zeroheight.com/settings/team/developers"},r.createElement(i.Text,{underline:!0,color:l.n.zh.color.base.text.action.default},"Developer Settings"))),r.createElement(i.Newline,null),"client"===g&&r.createElement(i.Box,null,r.createElement(i.Text,null,"Client ID: "),r.createElement(o.default,{onChange:p,value:u,onSubmit:e=>{0!==e.trim().length&&y("token")}})),"token"===g&&r.createElement(i.Box,null,r.createElement(i.Text,null,"Access Token: "),r.createElement(o.default,{onChange:m,value:f,onSubmit:e=>{0!==e.trim().length&&b()}})),"authenticating"===g&&r.createElement(i.Text,null,r.createElement(i.Text,{color:l.n.zh.color.base.text.status.positive},r.createElement(s.default,{type:"dots"}))," checking authentication details..."),"write"===g&&r.createElement(i.Box,{flexDirection:"column"},r.createElement(d.Z,{client:u,token:f}),r.createElement(i.Text,null,"Write updated credentials to"," ",r.createElement(a.default,{url:n},n),"?"," ",r.createElement(i.Text,{dimColor:!0},"(Y/n)")),r.createElement(c.Z,{isChecked:!0,onChange:h,onSubmit:x,value:_})),r.createElement(i.Newline,null))}},381:function(e,t,n){n.d(t,{Z:()=>s});var r=n(810),i=n(149),o=n(950),a=n(748);function s(){return r.createElement(r.Fragment,null,r.createElement(i.Box,{borderStyle:"double",paddingLeft:1,paddingRight:1,marginBottom:1,flexDirection:"column"},r.createElement(i.Box,{justifyContent:"center",marginBottom:1},r.createElement(i.Text,{bold:!0},"Welcome \uD83D\uDC4B")),r.createElement(i.Box,{marginBottom:1},r.createElement(i.Text,null,"Get started with the"," ",r.createElement(i.Text,{color:a.n.zh.color.base.brand.primary,bold:!0},"zeroheight")," ","measurement CLI and start tracking your design system's adoption.")),r.createElement(i.Text,null,"For more information on how to set this up, check"," ",r.createElement(o.default,{url:"https://help.zeroheight.com/hc/en-us/articles/35887053202459-Introduction-to-measuring-design-system-adoption-in-zeroheight"},"here"),".")))}},468:function(e,t,n){n.d(t,{Z:()=>l});var r=n(810),i=n(149),o=n(950),a=n(999),s=n(748);function l({latestVersion:e}){let t="major"===(0,a.diff)("4.1.1",e);return r.createElement(r.Fragment,null,r.createElement(i.Box,{borderStyle:"double",paddingLeft:1,paddingRight:1,marginBottom:1,flexDirection:"column"},r.createElement(i.Box,{justifyContent:"center",marginBottom:1},r.createElement(i.Text,null,"\uD83D\uDC4B It seems you're not using the latest version of this package")),r.createElement(i.Box,{flexDirection:"column",alignItems:"center",marginBottom:1},r.createElement(i.Box,null,r.createElement(i.Text,{color:t?"redBright":"blueBright",bold:!0},"4.1.1"),r.createElement(i.Text,{bold:!0}," -> "),r.createElement(i.Text,{color:s.n.zh.color.base.text.status.positive,bold:!0},e)),r.createElement(i.Box,null,r.createElement(i.Text,null,"Update using: "),r.createElement(i.Text,{bold:!0},"npm i @zeroheight/adoption-cli"))),r.createElement(i.Box,{flexDirection:"column",alignItems:"center"},r.createElement(i.Text,null,"For more information on the latest version, check"," ",r.createElement(o.default,{url:"https://www.npmjs.com/package/@zeroheight/adoption-cli"},"here")))))}},795:function(e,t,n){n.d(t,{Z:()=>a});var r=n(810),i=n(829),o=n(904);let a=({isChecked:e,onChange:t,onSubmit:n,placeholder:a,value:s,...l})=>{let c=r.useCallback(t=>{n((0,o.default)(t,{default:e}))},[e,n]);return r.createElement(i.default,{...l,placeholder:a,value:s,onChange:t,onSubmit:c})}},651:function(e,t,n){n.d(t,{Z:()=>o});var r=n(810),i=n(149);function o({options:e,visibleOptionCount:t=5,...n}){let o,[a,s]=(0,r.useState)(0),[l,d]=(0,r.useState)(0),u=Math.min(t,e.length),p=Math.max(0,e.length-u);(0,i.useInput)((t,n)=>{let r=a;if(n.upArrow&&(r=Math.max(0,a-1)),n.downArrow&&(r=Math.min(e.length-1,a+1)),r!==a){let e=l;r<l?e=r:r>l+u-1&&(e=r-u+1),e=Math.min(e,p),s(r),d(e)}});let f=l>0,m=l<p;if("multiselect"===n.as){let{as:t,...i}=n;o=r.default.createElement(c.MultiSelect,{...i,options:e,visibleOptionCount:u})}else{let{as:t,...i}=n;o=r.default.createElement(c.Select,{...i,options:e,visibleOptionCount:u})}return r.default.createElement(r.default.Fragment,null,r.default.createElement(i.Text,{dimColor:!0},f?"↑ more results above":"\xa0"),o,r.default.createElement(i.Text,{dimColor:!0},m?"↓ more results below":"\xa0"))}},725:function(e){e.exports=d},117:function(e){e.exports=u},178:function(e){e.exports=p},727:function(e){e.exports=f},149:function(e){e.exports=m},950:function(e){e.exports=_},92:function(e){e.exports=h},165:function(e){e.exports=g},829:function(e){e.exports=y},181:function(e){e.exports=b},445:function(e){e.exports=x},764:function(e){e.exports=S},403:function(e){e.exports=E},511:function(e){e.exports=T},810:function(e){e.exports=A},999:function(e){e.exports=D},290:function(e){e.exports=C},871:function(e){e.exports=I},904:function(e){e.exports=N},292:function(e){e.exports=P(import.meta.url)("fs/promises")},673:function(e){e.exports=P(import.meta.url)("node:events")},561:function(e){e.exports=P(import.meta.url)("node:fs")},977:function(e){e.exports=P(import.meta.url)("node:fs/promises")},612:function(e){e.exports=P(import.meta.url)("node:os")},411:function(e){e.exports=P(import.meta.url)("node:path")},492:function(e){e.exports=P(import.meta.url)("node:stream")},915:function(e){e.exports=P(import.meta.url)("node:string_decoder")},41:function(e){e.exports=P(import.meta.url)("node:url")},748:function(e,t,n){n.d(t,{n:()=>r});var r=JSON.parse('{"sg":{"color":{"callout":{"background":{"color1":"#fbe7c6","color2":"#e2ebf8","color3":"#bdf4e9","color4":"#fce5e4"}},"designUpload":{"annotation":"#9e0045","background":{"default":"#f7f7f7"},"text":{"annotation":"#ffffff","label":"#262626"}},"footer":{"background":{"default":"#ffffff"},"border":{"default":"#4d4d4d"},"textIcon":{"default":"#262626","link":"#2265c9"}},"logo":{"text":"#212121"},"pageContent":{"background":{"default":"#ffffff"},"border":{"default":"#0000001f"},"tabs":{"border":{"active":"#4d4d4d"},"textIcon":{"active":"#262626","default":"#262626"}},"text":{"accent":"#2265c9","body":"#262626","largeHeading":"#262626","links":"#2265c9","mediumHeading":"#262626","pageIntro":"#4d4d4d","pageTitle":"#262626","placeholder":"#595959","secondaryBody":"#4d4d4d","smallHeading":"#262626"}},"rules":{"background":{"caution":"#fbe7c6","do":"#bdf4e9","dont":"#fce5e4","neutral":"#ebebeb"}},"sidebar":{"background":{"active":"#eeeeee","default":"#ffffff","hover":"#f7f7f7"},"border":{"default":"#0000001f"},"icon":{"default":"#4d4d4d"},"text":{"active":"#262626","primary":"#262626","secondary":"#4d4d4d"}},"statusTag":{"background":{"color1":"#fbe7c6","color2":"#e2ebf8","color3":"#bdf4e9","color4":"#fce5e4","color5":"#ebebeb"},"border":{"primary":"#21212126"}},"table":{"background":{"alternate":"#f8f8f8","header":"#f2f1f2"},"border":{"default":"#0000001f"}},"topNavigation":{"background":{"default":"#ffffff"},"border":{"active":"#4d4d4d","default":"#0000001f"},"textIcon":{"active":"#262626","default":"#4d4d4d"}},"uiElement":{"background":{"default":"#ffffff"},"border":{"default":"#0000001f"},"textIcon":{"action":"#3b74c9","primary":"#262626","secondary":"#4d4d4d"}}},"typography":{"pageContent":{"body":{"fontSize":"16px","fontWeight":400,"lineHeight":1.5,"letterSpacing":"0px"},"largeHeading":{"fontSize":"32px","fontWeight":700,"lineHeight":1.25,"letterSpacing":"0px"},"mediumHeading":{"fontSize":"24px","fontWeight":700,"lineHeight":1.33,"letterSpacing":"0px"},"pageIntro":{"fontSize":"24px","fontWeight":300,"lineHeight":1.33,"letterSpacing":"0px"},"pageTitle":{"fontSize":"40px","fontWeight":700,"lineHeight":1.2,"letterSpacing":"0px"},"smallHeading":{"fontSize":"16px","fontWeight":700,"lineHeight":1.5,"letterSpacing":"0px"}}}},"zh":{"color":{"addElementTile":{"background":{"default":"#f3f6fc","hover":"#e2ebf8"}},"avatar":{"background":{"1":"#bc316d","2":"#5e0458","3":"#881a95","4":"#621f9c","5":"#000c91","6":"#00609c","7":"#047c7c","8":"#32824a","9":"#676763"}},"base":{"background":{"comment":{"default":"#ffea6a99","selected":"#ffea6a"},"highlight":{"light":"#f3f6fc","strong":"#e2ebf8"},"message":{"informative":"#e2ebf8","negative":"#fce5e4","neutral":"#ebebeb","positive":"#bdf4e9","warning":"#fbe7c6"},"neutral":{"disabled":"#ebebeb","float":"#262626","hover":"#2626260d","primary":"#ffffff","secondary":"#f8f8f8","softened":"#f8f6f1"},"overlay":"#21212180"},"border":{"active":"#595959","error":"#c81f14","focus":"#9257db","primary":"#0000001f","reversed":{"focus":"#a09aff"},"secondary":"#00000014"},"brand":{"darker":"#9e0045","primary":"#dc2d58"},"icon":{"action":{"darker":"#2265c9","default":"#2265c9"},"neutral":{"primary":"#262626","reversed":{"primary":"#ffffff","secondary":"#f8f8f8","tertiary":"#ebebeb"},"secondary":"#4d4d4d","tertiary":"#595959"},"status":{"active":"#2265c9","negative":"#c81f14","positive":"#0d735e"}},"text":{"action":{"darker":"#2265c9","default":"#2265c9","hover":"#2265c9"},"neutral":{"primary":"#262626","reversed":{"primary":"#ffffff","secondary":"#f8f8f8","tertiary":"#ebebeb"},"secondary":"#4d4d4d","tertiary":"#595959"},"status":{"negative":"#c81f14","positive":"#0d735e"}}},"destructiveButton":{"background":{"default":"#f44336","disabled":"#e0e0e0","focus":"#cd2622","hover":"#fc6860"},"textIcon":{"default":"#ffffff","disabled":"#595959"}},"editorTools":{"background":{"highlight":{"light":"#f3f6fc","strong":"#e2ebf8"}}},"imageToolbar":{"background":"#212121cc","border":"#0000001f","divider":"#ffffff26","icon":"#ffffff","text":"#ffffff"},"input":{"background":{"default":"#ffffff","disabled":"#ebebeb"},"border":{"active":"#4d4d4d","default":"#757575","error":"#c81f14"},"icon":{"content":{"default":"#262626","disabled":"#4d4d4d"},"label":{"default":"#262626"},"message":{"error":"#c81f14","helper":"#4d4d4d"}},"text":{"content":{"default":"#262626","disabled":"#4d4d4d","placeholder":"#595959"},"label":{"default":"#262626"},"message":{"error":"#c81f14","helper":"#4d4d4d"}}},"menu":{"background":{"default":"#ffffff","hover":"#2626260d"},"border":{"default":"#0000001f"},"icon":{"default":"#4d4d4d","disabled":"#595959"},"text":{"default":"#262626","disabled":"#595959"}},"message":{"discovery":{"background":"#f5f5ff","border":"#c1bdff","decoration":"#e7e6ff94","foreground":"#9349d1"},"informative":{"background":"#f3f6fc","border":"#b0c9ed","decoration":"#e2ebf894","foreground":"#2265c9"},"negative":{"background":"#fdf2f1","border":"#f7b9b6","decoration":"#fce5e494","foreground":"#c81f14"},"neutral":{"background":{"onPrimary":"#f8f8f8","onSecondary":"#ffffff"},"border":"#0000001f","decoration":"#ebebeb59","foreground":"#595959"},"positive":{"background":"#dffcf6","border":"#73dec8","decoration":"#bdf4e994","foreground":"#0d735e"},"premium":{"prominent":{"background":"#520023","border":"#520023","decoration":"#9e004559","foreground":"#f2ae3d"},"subtle":{"background":"#f8f6f1","border":"#00000014","decoration":"#efeadd","foreground":"#9e5705"}},"warning":{"background":"#fdf5e7","border":"#f4b958","decoration":"#fbe7c694","foreground":"#9e5705"}},"minimalButton":{"icon":{"default":"#3b74c9","hover":"#3b74c9"},"text":{"default":"#3b74c9","hover":"#3b74c9"}},"navigation":{"background":{"primary":"#ffffff","secondary":"#f8f8f8"},"border":{"active":"#4d4d4d","default":"#00000014"},"icon":{"primary":"#262626","secondary":"#4d4d4d"},"text":{"primary":"#262626","secondary":"#4d4d4d"}},"notification":{"background":"#262626","content":"#ffffff"},"primaryButton":{"background":{"default":"#262626","disabled":"#ebebeb","focus":"#262626","hover":"#4d4d4d","reversed":{"default":"#f8f6f1","disabled":"#b5b5b5","focus":"#f8f6f1","hover":"#efeadd"}},"textIcon":{"default":"#ffffff","disabled":"#949494","reversed":{"default":"#262626","disabled":"#757575"}}},"secondaryButton":{"background":{"default":"#ffffff00","disabled":"#ffffff00","focus":"#ffffff00","hover":"#2626260d","reversed":{"default":"#ffffff00","disabled":"#ffffff00","focus":"#ffffff00","hover":"#ffffff1f"}},"border":{"default":"#757575","disabled":"#b5b5b5","reversed":{"default":"#e0e0e0","disabled":"#949494"}},"textIcon":{"default":"#262626","disabled":"#949494","reversed":{"default":"#ffffff","disabled":"#757575"}}},"styleguideCard":{"background":{"default":"#fafafa"},"border":{"default":"#0000001f"},"text":{"title":{"default":"#262626","onImage":"#ffffff"},"updateMessage":{"default":"#4d4d4d","onImage":"#ffffff"}}},"table":{"background":{"alternate":"#f8f8f8","default":"#ffffff","header":"#ebebeb"}},"tertiaryButton":{"background":{"default":"#ffffff00","disabled":"#ffffff00","focus":"#ffffff00","hover":"#2626260d","reversed":{"default":"#ffffff00","disabled":"#ffffff00","focus":"#ffffff00","hover":"#ffffff1f"}},"textIcon":{"default":"#262626","disabled":"#949494","reversed":{"default":"#ffffff","disabled":"#757575"}}},"toggleButton":{"background":{"active":"#e2ebf8","default":"#ffffff","hover":"#2626260d"},"border":{"active":"#595959","default":"#0000001f"},"icon":{"default":"#262626"},"label":{"default":"#262626"}},"toggleSwitch":{"background":{"off":{"default":"#333333","hover":"#595959"},"on":{"default":"#11a788","hover":"#0f856d"}},"handle":"#ffffff"},"tooltip":{"background":"#262626","content":"#ffffff"}},"radius":{"base":{"large":12,"medium":8,"small":4}},"size":{"base":{"100":8,"150":12,"200":16,"250":20,"300":24,"350":28,"400":32,"450":36,"500":40,"600":48,"700":56}},"space":{"base":{"0":0,"100":8,"150":12,"200":16,"300":24,"400":32,"500":40,"600":48,"800":64,"1000":80,"1200":96,"025":2,"050":4},"cards":{"gap":{"compact":16,"relaxed":24}},"page":{"horizontal":{"compact":32,"relaxed":56},"vertical":{"compact":40,"relaxed":96}}},"elevation":{"level1":{"blur":"4px","color":"#2121211A","spread":"0px","offsetX":"0px","offsetY":"2px"},"level2":{"blur":"16px","color":"#2121211A","spread":"0px","offsetX":"0px","offsetY":"8px"},"level3":{"blur":"48px","color":"#2121211A","spread":"0px","offsetX":"0px","offsetY":"24px"}},"typography":{"code":{"large":{"fontSize":"16px","fontWeight":400,"lineHeight":1.5,"letterSpacing":"0px"},"medium":{"fontSize":"14px","fontWeight":400,"lineHeight":1.43,"letterSpacing":"0px"},"small":{"fontSize":"12px","fontWeight":400,"lineHeight":1.33,"letterSpacing":"0px"}},"display":{"large":{"fontSize":"40px","fontWeight":700,"lineHeight":1.2,"letterSpacing":"0px"},"largeSubtle":{"fontSize":"40px","fontWeight":300,"lineHeight":1.2,"letterSpacing":"0px"},"medium":{"fontSize":"32px","fontWeight":700,"lineHeight":1.25,"letterSpacing":"0px"},"mediumSubtle":{"fontSize":"32px","fontWeight":300,"lineHeight":1.25,"letterSpacing":"0px"},"small":{"fontSize":"24px","fontWeight":700,"lineHeight":1.33,"letterSpacing":"0px"},"smallSubtle":{"fontSize":"24px","fontWeight":300,"lineHeight":1.33,"letterSpacing":"0px"},"xlarge":{"fontSize":"48px","fontWeight":700,"lineHeight":1.25,"letterSpacing":"0px"},"xlargeSubtle":{"fontSize":"48px","fontWeight":300,"lineHeight":1.25,"letterSpacing":"0px"},"xsmall":{"fontSize":"20px","fontWeight":700,"lineHeight":1.4,"letterSpacing":"0px"},"xsmallSubtle":{"fontSize":"20px","fontWeight":300,"lineHeight":1.4,"letterSpacing":"0px"}},"label":{"large":{"fontSize":"16px","fontWeight":500,"lineHeight":1.5,"letterSpacing":"0px"},"medium":{"fontSize":"14px","fontWeight":500,"lineHeight":1.43,"letterSpacing":"0px"},"small":{"fontSize":"12px","fontWeight":500,"lineHeight":1.33,"letterSpacing":"0px"}},"text":{"large":{"fontSize":"16px","fontWeight":400,"lineHeight":1.5,"letterSpacing":"0px"},"largeLinked":{"fontSize":"16px","fontWeight":400,"lineHeight":1.5,"letterSpacing":"0px"},"largeProminent":{"fontSize":"16px","fontWeight":700,"lineHeight":1.5,"letterSpacing":"0px"},"medium":{"fontSize":"14px","fontWeight":400,"lineHeight":1.43,"letterSpacing":"0px"},"mediumLinked":{"fontSize":"14px","fontWeight":400,"lineHeight":1.43,"letterSpacing":"0px"},"mediumProminent":{"fontSize":"14px","fontWeight":700,"lineHeight":1.43,"letterSpacing":"0px"},"small":{"fontSize":"12px","fontWeight":400,"lineHeight":1.33,"letterSpacing":"0px"},"smallLinked":{"fontSize":"12px","fontWeight":400,"lineHeight":1.33,"letterSpacing":"0px"},"smallProminent":{"fontSize":"12px","fontWeight":700,"lineHeight":1.33,"letterSpacing":"0px"}},"utility":{"contextualTitle":{"fontSize":"12px","fontWeight":500,"lineHeight":1.33,"letterSpacing":"0.1px"}}}}}')}},F={};function W(e){var t=F[e];if(void 0!==t)return t.exports;var n=F[e]={exports:{}};return O[e](n,n.exports,W),n.exports}R="function"==typeof Symbol?Symbol("webpack queues"):"__webpack_queues__",M="function"==typeof Symbol?Symbol("webpack exports"):"__webpack_exports__",k="function"==typeof Symbol?Symbol("webpack error"):"__webpack_error__",w=e=>{e&&e.d<1&&(e.d=1,e.forEach(e=>e.r--),e.forEach(e=>e.r--?e.r++:e()))},L=e=>e.map(e=>{if(null!==e&&"object"==typeof e){if(e[R])return e;if(e.then){var t=[];t.d=0,e.then(e=>{n[M]=e,w(t)},e=>{n[k]=e,w(t)});var n={};return n[R]=e=>e(t),n}}var r={};return r[R]=function(){},r[M]=e,r}),W.a=(e,t,n)=>{n&&((r=[]).d=-1);var r,i,o,a,s=new Set,l=e.exports,c=new Promise((e,t)=>{a=t,o=e});c[M]=l,c[R]=e=>{r&&e(r),s.forEach(e),c.catch(function(){})},e.exports=c,t(e=>{i=L(e);var t,n=()=>i.map(e=>{if(e[k])throw e[k];return e[M]}),o=new Promise(e=>{(t=()=>e(n)).r=0;var o=e=>e!==r&&!s.has(e)&&(s.add(e),e&&!e.d&&(t.r++,e.push(t)));i.map(e=>e[R](o))});return t.r?o:n()},e=>(e?a(c[k]=e):o(l),w(r))),r&&r.d<0&&(r.d=0)},W.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return W.d(t,{a:t}),t},W.d=(e,t)=>{for(var n in t)W.o(t,n)&&!W.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},W.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),W.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var B=W(584),z=(B=await B).Z;export{z as default};