massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / pyright-internal.js
1 "use strict";exports.id=194,exports.ids=[194],exports.modules={6673:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAliasDeclaration=void 0,t.resolveAliasDeclaration=function e(t,n,i,s){let r=n;const a=[];let o,l,c=!1,p=!1;for(;;){if(6!==r.type||!r.symbolName)return{declaration:r,isPrivate:c,privatePyTypedImported:o,privatePyTypedImporter:l};if(!i&&r.usesLocalName)return{declaration:r,isPrivate:c,privatePyTypedImported:o,privatePyTypedImporter:l};let d;r.path&&r.loadSymbolsFromPath&&(d=t(r.path));const u=d?d.symbolTable.get(r.symbolName):void 0;if(!u)return r.submoduleFallback?e(t,r.submoduleFallback,i,s):r.isNativeLib?{declaration:void 0,isPrivate:c}:void 0;if(u.isPrivateMember()&&(c=!0),u.isExternallyHidden()&&!s)return;let m=u.getTypedDeclarations();if(0===m.length&&(m=u.getDeclarations(),0===m.length))return;const h=m.filter((e=>!a.includes(e)));if(r=h.length>0?h[h.length-1]:m[m.length-1],p&&(o=null!=o?o:null==r?void 0:r.moduleName),u.isPrivatePyTypedImport()&&(p=!0),p&&(l=null!=l?l:null==r?void 0:r.moduleName),a.find((e=>e===r)))return r.path===n.path&&6===r.type&&r.submoduleFallback?e(t,r.submoduleFallback,i,s):{declaration:n,isPrivate:c,privatePyTypedImported:o,privatePyTypedImporter:l};a.push(r)}}},1241:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeProgram=t.nullCallback=void 0;const a=n(3213),o=r(n(5839)),l=n(8718);t.nullCallback=e=>{},t.analyzeProgram=function(e,n,i,s,r,c){let p=!1;s=null!=s?s:t.nullCallback;try{(0,a.throwIfCancellationRequested)(c);const t=new l.Duration;p=e.analyze(n,c);const r=e.getFilesToAnalyzeCount(),o=e.getDiagnostics(i),d=o.length,u=t.getDurationInSeconds();(d>0||!p)&&s({diagnostics:o,filesInProgram:e.getFileCount(),filesRequiringAnalysis:r,checkingOnlyOpenFiles:e.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:u})}catch(e){if(a.OperationCanceledException.is(e))return!1;const t=o.getErrorString(e);r.error("Error performing analysis: "+t),s({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!0,configParseErrorOccurred:!1,elapsedTime:0,error:o.getSerializableError(e)})}return p}},563:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCodeUnreachable=t.setDunderAllInfo=t.getDunderAllInfo=t.setCodeFlowComplexity=t.getCodeFlowComplexity=t.setCodeFlowExpressions=t.getCodeFlowExpressions=t.setFileInfo=t.getFileInfo=t.setAfterFlowNode=t.getAfterFlowNode=t.setFlowNode=t.getFlowNode=t.setDeclaration=t.getDeclaration=t.setScope=t.getScope=t.setImportInfo=t.getImportInfo=t.cleanNodeAnalysisInfo=void 0;const i=n(4972);function s(e){return e.flowNode}t.cleanNodeAnalysisInfo=function(e){const t=e;delete t.scope,delete t.declaration,delete t.flowNode,delete t.afterFlowNode,delete t.fileInfo,delete t.codeFlowExpressions,delete t.codeFlowComplexity,delete t.dunderAllInfo},t.getImportInfo=function(e){return e.importInfo},t.setImportInfo=function(e,t){e.importInfo=t},t.getScope=function(e){return e.scope},t.setScope=function(e,t){e.scope=t},t.getDeclaration=function(e){return e.declaration},t.setDeclaration=function(e,t){e.declaration=t},t.getFlowNode=s,t.setFlowNode=function(e,t){e.flowNode=t},t.getAfterFlowNode=function(e){return e.afterFlowNode},t.setAfterFlowNode=function(e,t){e.afterFlowNode=t},t.getFileInfo=function(e){for(;36!==e.nodeType;)e=e.parent;return e.fileInfo},t.setFileInfo=function(e,t){e.fileInfo=t},t.getCodeFlowExpressions=function(e){return e.codeFlowExpressions},t.setCodeFlowExpressions=function(e,t){e.codeFlowExpressions=t},t.getCodeFlowComplexity=function(e){var t;return null!==(t=e.codeFlowComplexity)&&void 0!==t?t:0},t.setCodeFlowComplexity=function(e,t){e.codeFlowComplexity=t},t.getDunderAllInfo=function(e){return e.dunderAllInfo},t.setDunderAllInfo=function(e,t){e.dunderAllInfo=t},t.isCodeUnreachable=function(e){let t=e;for(;t;){const e=s(t);if(e)return!!(e.flags&i.FlowFlags.Unreachable);t=t.parent}return!1}},5674:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisProgram=void 0;const i=n(1241),s=n(8408);t.BackgroundAnalysisProgram=class{constructor(e,t,n,i,r,a,o){this._console=e,this._configOptions=t,this._importResolver=n,this._backgroundAnalysis=r,this._maxAnalysisTime=a,this._disableChecker=o,this._program=new s.Program(this._importResolver,this._configOptions,this._console,i,void 0,this._disableChecker)}get configOptions(){return this._configOptions}get importResolver(){return this._importResolver}get program(){return this._program}get host(){return this._importResolver.host}get backgroundAnalysis(){return this._backgroundAnalysis}setConfigOptions(e){var t;this._configOptions=e,null===(t=this._backgroundAnalysis)||void 0===t||t.setConfigOptions(e),this._program.setConfigOptions(e)}setImportResolver(e){var t;this._importResolver=e,null===(t=this._backgroundAnalysis)||void 0===t||t.setImportResolver(e),this._program.setImportResolver(e),this._configOptions.getExecutionEnvironments().forEach((e=>this._ensurePartialStubPackages(e)))}setTrackedFiles(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setTrackedFiles(e);const n=this._program.setTrackedFiles(e);this._reportDiagnosticsForRemovedFiles(n)}setAllowedThirdPartyImports(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setAllowedThirdPartyImports(e),this._program.setAllowedThirdPartyImports(e)}setFileOpened(e,t,n,i){var s;null===(s=this._backgroundAnalysis)||void 0===s||s.setFileOpened(e,t,[{text:n}],i),this._program.setFileOpened(e,t,[{text:n}],i)}updateOpenFileContents(e,t,n,i){var s;null===(s=this._backgroundAnalysis)||void 0===s||s.setFileOpened(e,t,n,i),this._program.setFileOpened(e,t,n,i),this.markFilesDirty([e],!0)}setFileClosed(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setFileClosed(e);const n=this._program.setFileClosed(e);this._reportDiagnosticsForRemovedFiles(n)}markAllFilesDirty(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.markAllFilesDirty(e),this._program.markAllFilesDirty(e)}markFilesDirty(e,t){var n;null===(n=this._backgroundAnalysis)||void 0===n||n.markFilesDirty(e,t),this._program.markFilesDirty(e,t)}setCompletionCallback(e){var t;this._onAnalysisCompletion=e,null===(t=this._backgroundAnalysis)||void 0===t||t.setCompletionCallback(e)}startAnalysis(e){return this._backgroundAnalysis?(this._backgroundAnalysis.startAnalysis(this._indices,e),!1):(0,i.analyzeProgram)(this._program,this._maxAnalysisTime,this._configOptions,this._onAnalysisCompletion,this._console,e)}test_setIndexing(e,t){const n=this._getIndices();for(const[t,i]of e)n.setWorkspaceIndex(t,i);for(const[e,i]of t)for(const[t,s]of i)n.setIndex(e,t,s)}startIndexing(){var e;this._configOptions.indexing&&(null===(e=this._backgroundAnalysis)||void 0===e||e.startIndexing(this._configOptions,this.host.kind,this._getIndices()))}refreshIndexing(){var e;this._configOptions.indexing&&(null===(e=this._backgroundAnalysis)||void 0===e||e.refreshIndexing(this._configOptions,this.host.kind,this._indices))}cancelIndexing(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.cancelIndexing(this._configOptions)}getIndexing(e){var t;return null===(t=this._indices)||void 0===t?void 0:t.getIndex(this._configOptions.findExecEnvironment(e).root)}async getDiagnosticsForRange(e,t,n){return this._backgroundAnalysis?this._backgroundAnalysis.getDiagnosticsForRange(e,t,n):this._program.getDiagnosticsForRange(e,t)}async writeTypeStub(e,t,n,s){return this._backgroundAnalysis?this._backgroundAnalysis.writeTypeStub(e,t,n,s):((0,i.analyzeProgram)(this._program,void 0,this._configOptions,this._onAnalysisCompletion,this._console,s),this._program.writeTypeStub(e,t,n,s))}invalidateAndForceReanalysis(e){var t;e&&this.refreshIndexing(),null===(t=this._backgroundAnalysis)||void 0===t||t.invalidateAndForceReanalysis(),this._importResolver.invalidateCache(),this._program.markAllFilesDirty(!0)}restart(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.restart()}_ensurePartialStubPackages(e){var t;return null===(t=this._backgroundAnalysis)||void 0===t||t.ensurePartialStubPackages(e.root),this._importResolver.ensurePartialStubPackages(e)}_getIndices(){if(!this._indices){const e=this._program,t=new Map;this._indices={setWorkspaceIndex(t,n){var i;null===(i=e.getSourceFile(t))||void 0===i||i.cacheIndexResults(n)},getIndex:e=>t.get(e),setIndex(e,n,i){let s=t.get(e);s||(s=new Map,t.set(e,s)),s.set(n,i)},reset(){t.clear()}}}return this._indices}_reportDiagnosticsForRemovedFiles(e){e.length>0&&!this._backgroundAnalysis&&this._onAnalysisCompletion&&this._onAnalysisCompletion({diagnostics:e,filesInProgram:this._program.getFileCount(),filesRequiringAnalysis:this._program.getFilesToAnalyzeCount(),checkingOnlyOpenFiles:this._program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:0})}}},6052:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ReturnFinder=t.YieldFinder=t.Binder=void 0;const a=n(5839),o=n(9744),l=n(6657),c=n(1464),p=n(3550),d=n(3550),u=n(2122),m=r(n(563)),h=n(4972),y=r(n(8494)),g=n(427),f=n(1561),T=r(n(8235)),_=n(817),v=n(1766);class b extends g.ParseTreeWalker{constructor(e,t=!1){super(),this._moduleSymbolOnly=t,this._deferredBindingTasks=[],this._currentExceptTargets=[],this._finallyTargets=[],this._typingImportAliases=[],this._sysImportAliases=[],this._dataclassesImportAliases=[],this._typingSymbolAliases=new Map,this._dataclassesSymbolAliases=new Map,this._dunderAllStringNodes=[],this._potentialHiddenSymbols=new Map,this._potentialPrivateSymbols=new Map,this._functionCodeFlowComplexity=0,this._fileInfo=e}bindModule(e){var t;const n=void 0===this._fileInfo.builtinsScope;this._createNewScope(n?4:3,this._fileInfo.builtinsScope,(()=>{m.setScope(e,this._currentScope),m.setFlowNode(e,this._currentFlowNode),this._addBuiltInSymbolToCurrentScope("__doc__",e,"str | None"),this._addBuiltInSymbolToCurrentScope("__name__",e,"str"),this._addBuiltInSymbolToCurrentScope("__loader__",e,"Any"),this._addBuiltInSymbolToCurrentScope("__package__",e,"str"),this._addBuiltInSymbolToCurrentScope("__spec__",e,"Any"),this._addBuiltInSymbolToCurrentScope("__path__",e,"Iterable[str]"),this._addBuiltInSymbolToCurrentScope("__file__",e,"str"),this._addBuiltInSymbolToCurrentScope("__cached__",e,"str"),this._addBuiltInSymbolToCurrentScope("__dict__",e,"Dict[str, Any]"),this._addBuiltInSymbolToCurrentScope("__annotations__",e,"Dict[str, Any]"),this._addBuiltInSymbolToCurrentScope("__builtins__",e,"Any"),this._currentFlowNode=this._createStartFlowNode(),this._walkStatementsAndReportUnreachable(e.statements),m.setCodeFlowExpressions(e,this._currentScopeCodeFlowExpressions),m.setAfterFlowNode(e,this._currentFlowNode)})),this._bindDeferred(),this._potentialHiddenSymbols.forEach(((e,t)=>{var n;(null===(n=this._dunderAllNames)||void 0===n?void 0:n.some((e=>e===t)))||(this._fileInfo.isStubFile?e.setIsExternallyHidden():e.setPrivatePyTypedImport())})),this._potentialPrivateSymbols.forEach(((e,t)=>{var n;(null===(n=this._dunderAllNames)||void 0===n?void 0:n.some((e=>e===t)))||e.setIsPrivateMember()})),this._dunderAllNames?m.setDunderAllInfo(e,{names:this._dunderAllNames,stringNodes:this._dunderAllStringNodes}):m.setDunderAllInfo(e,void 0);const i=m.getScope(e);if(i&&this._dunderAllNames)for(const e of this._dunderAllNames)null===(t=i.symbolTable.get(e))||void 0===t||t.setIsInDunderAll()}visitModule(e){return(0,a.fail)("We should never get here"),!1}visitSuite(e){return this._walkStatementsAndReportUnreachable(e.statements),!1}visitModuleName(e){const t=m.getImportInfo(e);if((0,a.assert)(void 0!==t),!t||t.isNativeLib)return!0;if(!t.isImportFound)return this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingImports,o.DiagnosticRule.reportMissingImports,u.Localizer.Diagnostic.importResolveFailure().format({importName:t.importName}),e),!0;if(!t.isStubFile&&1===t.importType&&!t.pyTypedInfo){const n=this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingTypeStubs,o.DiagnosticRule.reportMissingTypeStubs,u.Localizer.Diagnostic.stubFileMissing().format({importName:t.importName}),e);if(n){const e={action:"pyright.createtypestub",moduleName:t.importName};n.addAction(e)}}return t.isStubFile&&0!==t.importType&&t.nonStubImportResult&&!t.nonStubImportResult.isImportFound&&(this._fileInfo.isStubFile||this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingModuleSource,o.DiagnosticRule.reportMissingModuleSource,u.Localizer.Diagnostic.importSourceResolveFailure().format({importName:t.importName}),e)),!0}visitClass(e){this.walkMultiple(e.decorators);const t={type:4,node:e,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.name.start,d.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName},n=this._bindNameToScope(this._currentScope,e.name.value);n&&n.addDeclaration(t),m.setDeclaration(e,t),this.walkMultiple(e.arguments);let i=this._currentScope;for(;2===i.type;)i=i.parent;return this._createNewScope(2,i,(()=>{m.setScope(e,this._currentScope),this._addBuiltInSymbolToCurrentScope("__doc__",e,"str | None"),this._addBuiltInSymbolToCurrentScope("__module__",e,"str"),this._moduleSymbolOnly||this.walk(e.suite)})),this._createAssignmentTargetFlowNodes(e.name,!1,!1),!1}visitFunction(e){m.setFlowNode(e,this._currentFlowNode);const t=this._bindNameToScope(this._currentScope,e.name.value),n=y.getEnclosingClass(e,!0),i={type:3,node:e,isMethod:!!n,isGenerator:!1,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.name.start,d.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t&&t.addDeclaration(i),m.setDeclaration(e,i),this.walkMultiple(e.decorators),e.parameters.forEach((e=>{e.defaultValue&&this.walk(e.defaultValue),e.typeAnnotation&&this.walk(e.typeAnnotation),e.typeAnnotationComment&&this.walk(e.typeAnnotationComment)})),e.returnTypeAnnotation&&this.walk(e.returnTypeAnnotation),e.functionAnnotationComment&&this.walk(e.functionAnnotationComment);let s=e.parent;for(;s&&36!==s.nodeType&&28!==s.nodeType;)s=s.parent;(0,a.assert)(void 0!==s);const r=m.getScope(s);return(0,a.assert)(void 0!==r),this._createNewScope(1,r,(()=>{m.setScope(e,this._currentScope),y.getEnclosingClass(e)&&this._addBuiltInSymbolToCurrentScope("__class__",e,"class"),this._deferBinding((()=>{this._currentFlowNode=this._createStartFlowNode(),this._functionCodeFlowComplexity=0,e.parameters.forEach((e=>{if(e.name){const t=this._bindNameToScope(this._currentScope,e.name.value);if(t){const n={type:2,node:e,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.start,d.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n),m.setDeclaration(e.name,n)}this._createFlowAssignment(e.name)}})),this._targetFunctionDeclaration=i,this._currentReturnTarget=this._createBranchLabel(),this.walk(e.suite),m.setAfterFlowNode(e.suite,this._currentFlowNode),this._addAntecedent(this._currentReturnTarget,this._currentFlowNode);const t=this._finishFlowLabel(this._currentReturnTarget);m.setAfterFlowNode(e,t),m.setCodeFlowExpressions(e,this._currentScopeCodeFlowExpressions),m.setCodeFlowComplexity(e,this._functionCodeFlowComplexity)}))})),this._createAssignmentTargetFlowNodes(e.name,!1,!1),!1}visitLambda(e){return m.setFlowNode(e,this._currentFlowNode),e.parameters.forEach((e=>{e.defaultValue&&this.walk(e.defaultValue)})),this._createNewScope(1,this._currentScope,(()=>{m.setScope(e,this._currentScope),this._deferBinding((()=>{this._currentFlowNode=this._createStartFlowNode(),e.parameters.forEach((e=>{if(e.name){const t=this._bindNameToScope(this._currentScope,e.name.value);if(t){const n={type:2,node:e,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.start,d.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n),m.setDeclaration(e.name,n)}this._createFlowAssignment(e.name),this.walk(e.name)}})),this.walk(e.expression),m.setCodeFlowExpressions(e,this._currentScopeCodeFlowExpressions)}))})),!1}visitCall(e){var t,n;if(this._disableTrueFalseTargets((()=>{this.walk(e.leftExpression),this.walkMultiple(e.arguments)})),this._createCallFlowNode(e),3===this._currentScope.type&&35===e.leftExpression.nodeType&&38===e.leftExpression.leftExpression.nodeType&&"__all__"===e.leftExpression.leftExpression.value){let i=!0;if("extend"===e.leftExpression.memberName.value&&1===e.arguments.length){const t=e.arguments[0].valueExpression;if(31===t.nodeType)t.entries.forEach((e=>{var t,n;48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(e.strings[0].value),null===(n=this._dunderAllStringNodes)||void 0===n||n.push(e.strings[0]),i=!1)}));else if(35===t.nodeType&&38===t.leftExpression.nodeType&&"__all__"===t.memberName.value){const e=this._getDunderAllNamesFromImport(t.leftExpression.value);e&&e.length>0&&(e.forEach((e=>{var t;null===(t=this._dunderAllNames)||void 0===t||t.push(e)})),i=!1)}}else if("remove"===e.leftExpression.memberName.value&&1===e.arguments.length){const t=e.arguments[0].valueExpression;48===t.nodeType&&1===t.strings.length&&49===t.strings[0].nodeType&&this._dunderAllNames&&(this._dunderAllNames=this._dunderAllNames.filter((e=>e!==t.strings[0].value)),this._dunderAllStringNodes=this._dunderAllStringNodes.filter((e=>e.value!==t.strings[0].value)),i=!1)}else if("append"===e.leftExpression.memberName.value&&1===e.arguments.length){const s=e.arguments[0].valueExpression;48===s.nodeType&&1===s.strings.length&&49===s.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(s.strings[0].value),null===(n=this._dunderAllStringNodes)||void 0===n||n.push(s.strings[0]),i=!1)}i&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,o.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.unsupportedDunderAllOperation(),e)}return!1}visitAssignment(e){if(this._handleTypingStubAssignmentOrAnnotation(e))return!1;this._bindPossibleTupleNamedTarget(e.leftExpression),e.typeAnnotationComment&&(this.walk(e.typeAnnotationComment),this._addTypeDeclarationForVariable(e.leftExpression,e.typeAnnotationComment)),this.walk(e.rightExpression);let t=!0;if((y.getEnclosingFunction(e)||9===e.rightExpression.nodeType&&this._fileInfo.isTypingStubFile||y.isWithinLoop(e))&&(t=!1),this._addInferredTypeAssignmentForVariable(e.leftExpression,e.rightExpression,t),this._createAssignmentTargetFlowNodes(e.leftExpression,!0,!1),3===this._currentScope.type&&(38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value||54===e.leftExpression.nodeType&&38===e.leftExpression.valueExpression.nodeType&&"__all__"===e.leftExpression.valueExpression.value)){const t=e.rightExpression;this._dunderAllNames=[];let n=!1;31===t.nodeType?t.entries.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?(this._dunderAllNames.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0])):n=!0})):52===t.nodeType?t.expressions.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?(this._dunderAllNames.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0])):n=!0})):n=!0,n&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,o.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.unsupportedDunderAllOperation(),e)}if(2===this._currentScope.type&&(38===e.leftExpression.nodeType&&"__slots__"===e.leftExpression.value||54===e.leftExpression.nodeType&&38===e.leftExpression.valueExpression.nodeType&&"__slots__"===e.leftExpression.valueExpression.value)){const t=e.rightExpression,n=[];let i=!0;48===t.nodeType?n.push(t):31===t.nodeType?t.entries.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?n.push(e):i=!1})):52===t.nodeType?t.expressions.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?n.push(e):i=!1})):i=!1,i&&this._addSlotsToCurrentScope(n)}return!1}visitAssignmentExpression(e){this._disableTrueFalseTargets((()=>{this.walk(e.rightExpression)}));const t=y.getEvaluationNodeForAssignmentExpression(e);if(t){const n=m.getScope(t);let i=this._currentScope;for(;i&&i!==n;){if(i.lookUpSymbol(e.name.value)){this._addError(u.Localizer.Diagnostic.assignmentExprComprehension().format({name:e.name.value}),e.name);break}i=i.parent}this._bindNameToScope(n,e.name.value),this._addInferredTypeAssignmentForVariable(e.name,e.rightExpression),this._createAssignmentTargetFlowNodes(e.name,!0,!1)}else this._addError(u.Localizer.Diagnostic.assignmentExprContext(),e),this.walk(e.name);return!1}visitAugmentedAssignment(e){if(this.walk(e.leftExpression),this.walk(e.rightExpression),this._bindPossibleTupleNamedTarget(e.destExpression),this._createAssignmentTargetFlowNodes(e.destExpression,!1,!1),1===e.operator&&3===this._currentScope.type&&38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value){const t=e.rightExpression;let n=!0;if(31===t.nodeType)t.entries.forEach((e=>{var t;48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0]))})),n=!1;else if(35===t.nodeType&&38===t.leftExpression.nodeType&&"__all__"===t.memberName.value){const e=this._getDunderAllNamesFromImport(t.leftExpression.value);e&&(e.forEach((e=>{var t;null===(t=this._dunderAllNames)||void 0===t||t.push(e)})),n=!1)}n&&this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,o.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.unsupportedDunderAllOperation(),e)}return!1}visitDel(e){return e.expressions.forEach((e=>{this._bindPossibleTupleNamedTarget(e),this.walk(e),this._createAssignmentTargetFlowNodes(e,!1,!0)})),!1}visitTypeAnnotation(e){if(this._handleTypingStubAssignmentOrAnnotation(e))return!1;this.walk(e.typeAnnotation),this._createVariableAnnotationFlowNode(),this._bindPossibleTupleNamedTarget(e.valueExpression),this._addTypeDeclarationForVariable(e.valueExpression,e.typeAnnotation);const t=[];return this._isNarrowingExpression(e.valueExpression,t)&&t.forEach((e=>{const t=(0,h.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(t)})),this.walk(e.valueExpression),!1}visitFor(e){this._bindPossibleTupleNamedTarget(e.targetExpression),this._addInferredTypeAssignmentForVariable(e.targetExpression,e),this.walk(e.iterableExpression);const t=this._createLoopLabel(),n=this._createBranchLabel(),i=this._createBranchLabel();if(this._addAntecedent(t,this._currentFlowNode),this._currentFlowNode=t,this._addAntecedent(n,this._currentFlowNode),this._createAssignmentTargetFlowNodes(e.targetExpression,!0,!1),this._bindLoopStatement(t,i,(()=>{this.walk(e.forSuite),this._addAntecedent(t,this._currentFlowNode)})),this._currentFlowNode=this._finishFlowLabel(n),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),e.asyncToken){const t=y.getEnclosingFunction(e);t&&t.isAsync||this._addError(u.Localizer.Diagnostic.asyncNotInAsyncFunction(),e.asyncToken)}return!1}visitContinue(e){return this._currentContinueTarget&&this._addAntecedent(this._currentContinueTarget,this._currentFlowNode),this._currentFlowNode=b._unreachableFlowNode,!1}visitBreak(e){return this._currentBreakTarget&&this._addAntecedent(this._currentBreakTarget,this._currentFlowNode),this._currentFlowNode=b._unreachableFlowNode,!1}visitReturn(e){return this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.returnStatements||(this._targetFunctionDeclaration.returnStatements=[]),this._targetFunctionDeclaration.returnStatements.push(e)),e.returnExpression&&this.walk(e.returnExpression),m.setFlowNode(e,this._currentFlowNode),this._currentReturnTarget&&this._addAntecedent(this._currentReturnTarget,this._currentFlowNode),this._finallyTargets.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),this._currentFlowNode=b._unreachableFlowNode,!1}visitYield(e){return this._isInListComprehension(e)&&this._addError(u.Localizer.Diagnostic.yieldWithinListCompr(),e),this._bindYield(e),!1}visitYieldFrom(e){return this._isInListComprehension(e)&&this._addError(u.Localizer.Diagnostic.yieldWithinListCompr(),e),this._bindYield(e),!1}visitMemberAccess(e){return m.setFlowNode(e,this._currentFlowNode),!0}visitName(e){return m.setFlowNode(e,this._currentFlowNode),!1}visitIndex(e){return m.setFlowNode(e,this._currentFlowNode),!0}visitIf(e){const t=this._currentFlowNode,n=this._createBranchLabel(),i=this._createBranchLabel(),s=this._createBranchLabel(t);return s.affectedExpressions=this._trackCodeFlowExpressions((()=>{const t=T.evaluateStaticBoolLikeExpression(e.testExpression,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases);this._bindConditional(e.testExpression,n,i),this._currentFlowNode=!1===t?b._unreachableFlowNode:this._finishFlowLabel(n),this.walk(e.ifSuite),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=!0===t?b._unreachableFlowNode:this._finishFlowLabel(i),e.elseSuite?this.walk(e.elseSuite):this._bindNeverCondition(e.testExpression,s,!1),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(s)})),!1}visitWhile(e){const t=this._createBranchLabel(),n=this._createBranchLabel(),i=this._createBranchLabel(),s=T.evaluateStaticBoolLikeExpression(e.testExpression,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases),r=this._createLoopLabel();return this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=r,this._bindConditional(e.testExpression,t,n),this._currentFlowNode=!1===s?b._unreachableFlowNode:this._finishFlowLabel(t),this._bindLoopStatement(r,i,(()=>{this.walk(e.whileSuite)})),this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=!0===s?b._unreachableFlowNode:this._finishFlowLabel(n),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),!1}visitAssert(e){const t=this._createBranchLabel(),n=this._createBranchLabel();return this._bindConditional(e.testExpression,t,n),e.exceptionExpression&&(this._currentFlowNode=this._finishFlowLabel(n),this.walk(e.exceptionExpression)),this._currentFlowNode=this._finishFlowLabel(t),!1}visitExcept(e){if(e.typeExpression&&this.walk(e.typeExpression),e.name){this.walk(e.name);const t=this._bindNameToScope(this._currentScope,e.name.value);if(this._createAssignmentTargetFlowNodes(e.name,!0,!1),t){const n={type:1,node:e.name,isConstant:(0,v.isConstantName)(e.name.value),inferredTypeSource:e,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.name.start,d.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n)}}return this.walk(e.exceptSuite),e.name&&this._createFlowAssignment(e.name,!0),!1}visitRaise(e){return this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.raiseStatements||(this._targetFunctionDeclaration.raiseStatements=[]),this._targetFunctionDeclaration.raiseStatements.push(e)),e.typeExpression&&this.walk(e.typeExpression),e.valueExpression&&this.walk(e.valueExpression),e.tracebackExpression&&this.walk(e.tracebackExpression),this._finallyTargets.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),this._currentFlowNode=b._unreachableFlowNode,!1}visitTry(e){const t=this._currentFlowNode,n=e.exceptClauses.map((()=>this._createBranchLabel())),i=this._createBranchLabel(t);let s=!1;const r=this._createBranchLabel(t),a={flags:h.FlowFlags.PreFinallyGate,id:(0,h.getUniqueFlowNodeId)(),antecedent:r,isGateClosed:!1};if(i.affectedExpressions=this._trackCodeFlowExpressions((()=>{e.finallySuite&&this._addAntecedent(i,a),e.exceptClauses.some((e=>!e.typeExpression))||n.push(r),n.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),e.finallySuite&&this._finallyTargets.push(r),this._useExceptTargets(n,(()=>{this.walk(e.trySuite)})),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(i,this._currentFlowNode),this._isCodeUnreachable()||(s=!0),e.exceptClauses.forEach(((e,t)=>{this._currentFlowNode=this._finishFlowLabel(n[t]),this.walk(e),this._addAntecedent(i,this._currentFlowNode),this._isCodeUnreachable()||(s=!0)})),e.finallySuite&&this._finallyTargets.pop(),this._currentFlowNode=this._finishFlowLabel(i)})),e.finallySuite){this.walk(e.finallySuite);const t={flags:h.FlowFlags.PostFinally,id:(0,h.getUniqueFlowNodeId)(),finallyNode:e.finallySuite,antecedent:this._currentFlowNode,preFinallyGate:a};this._currentFlowNode=s?t:b._unreachableFlowNode}return this._functionCodeFlowComplexity+=4,!1}visitAwait(e){var t;const n=y.getEnclosingFunction(e);return void 0!==n&&n.isAsync||32!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&this._addError(u.Localizer.Diagnostic.awaitNotInAsync(),e),!0}visitGlobal(e){const t=this._currentScope.getGlobalScope();return e.nameList.forEach((e=>{const n=e.value;0===this._currentScope.getBindingType(n)&&this._addError(u.Localizer.Diagnostic.nonLocalRedefinition().format({name:n}),e);const i=this._currentScope.lookUpSymbolRecursive(n);i&&i.scope===this._currentScope&&this._addError(u.Localizer.Diagnostic.globalReassignment().format({name:n}),e),this._bindNameToScope(t,n),this._currentScope!==t&&this._currentScope.setBindingType(n,1)})),!0}visitNonlocal(e){const t=this._currentScope.getGlobalScope();return this._currentScope===t?this._addError(u.Localizer.Diagnostic.nonLocalInModule(),e):e.nameList.forEach((e=>{const n=e.value;1===this._currentScope.getBindingType(n)&&this._addError(u.Localizer.Diagnostic.globalRedefinition().format({name:n}),e);const i=this._currentScope.lookUpSymbolRecursive(n);i&&i.scope===this._currentScope?this._addError(u.Localizer.Diagnostic.nonLocalReassignment().format({name:n}),e):i&&i.scope!==t||this._addError(u.Localizer.Diagnostic.nonLocalNoBinding().format({name:n}),e),i&&this._currentScope.setBindingType(n,0)})),!0}visitImportAs(e){var t,n,i,s,r,o;if(e.module.nameParts.length>0){const l=e.module.nameParts[0].value;let c;c=e.alias?e.alias.value:l;const p=this._bindNameToScope(this._currentScope,c);!p||3!==this._currentScope.type&&4!==this._currentScope.type||e.alias&&1===e.module.nameParts.length&&e.module.nameParts[0].value===e.alias.value||(this._fileInfo.isStubFile||this._fileInfo.isInPyTypedPackage)&&this._potentialHiddenSymbols.set(c,p);const d=m.getImportInfo(e.module);(0,a.assert)(void 0!==d),p&&this._createAliasDeclarationForMultipartImportName(e,e.alias,d,p),this._createFlowAssignment(e.alias?e.alias:e.module.nameParts[0]),1===e.module.nameParts.length&&("typing"===l||"typing_extensions"===l?this._typingImportAliases.push(null!==(n=null===(t=e.alias)||void 0===t?void 0:t.value)&&void 0!==n?n:l):"sys"===l?this._sysImportAliases.push(null!==(s=null===(i=e.alias)||void 0===i?void 0:i.value)&&void 0!==s?s:l):"dataclasses"===l&&this._dataclassesImportAliases.push(null!==(o=null===(r=e.alias)||void 0===r?void 0:r.value)&&void 0!==o?o:l))}return!0}visitImportFrom(e){const t=["Final","TypeAlias","ClassVar","Required","NotRequired"],n=["InitVar"],i=m.getImportInfo(e.module);let s="";i&&i.isImportFound&&!i.isNativeLib&&(s=i.resolvedPaths[i.resolvedPaths.length-1]);const r=(0,l.stripFileExtension)((0,l.getFileName)(this._fileInfo.filePath)),a="__init__"===r&&1===e.module.leadingDots&&1===e.module.nameParts.length;let o=!1,c=!1;if(1===e.module.nameParts.length){const t=e.module.nameParts[0].value;"typing"!==t&&"typing_extensions"!==t||(o=!0),"dataclasses"===t&&(c=!0)}if(e.isWildcardImport){if((y.getEnclosingClass(e)||y.getEnclosingFunction(e))&&this._addError(u.Localizer.Diagnostic.wildcardInFunction(),e),i){const r=[],l=this._fileInfo.importLookup(s);if(l){const t=this._getWildcardImportNames(l);a&&(t.some((t=>t===e.module.nameParts[0].value))||this._addImplicitFromImport(e,i)),t.forEach((t=>{const n=this._bindNameToScope(this._currentScope,t);if(n)if(l.symbolTable.get(t)){const i={type:6,node:e,path:s,loadSymbolsFromPath:!0,range:(0,p.getEmptyRange)(),usesLocalName:!1,symbolName:t,moduleName:this._fileInfo.moduleName};n.addDeclaration(i),r.push(t)}else if(i&&i.filteredImplicitImports){const r=i.filteredImplicitImports.find((e=>e.name===t));if(r){const i={type:6,node:e,path:r.path,loadSymbolsFromPath:!0,range:(0,p.getEmptyRange)(),usesLocalName:!1,moduleName:this._fileInfo.moduleName},a={type:6,node:e,path:s,loadSymbolsFromPath:!0,usesLocalName:!1,symbolName:t,submoduleFallback:i,range:(0,p.getEmptyRange)(),moduleName:this._fileInfo.moduleName};n.addDeclaration(a)}}}))}this._createFlowWildcardImport(e,r),o&&t.forEach((e=>{this._typingSymbolAliases.set(e,e)})),c&&n.forEach((e=>{this._dataclassesSymbolAliases.set(e,e)}))}}else a&&this._addImplicitFromImport(e,i),e.imports.forEach((a=>{const l=a.name.value,d=a.alias||a.name,u=this._bindNameToScope(this._currentScope,d.value);if(u){let m,h;e.module.nameParts.length>0&&(3!==this._currentScope.type&&4!==this._currentScope.type||a.alias&&a.alias.value===a.name.value||(this._fileInfo.isStubFile||this._fileInfo.isInPyTypedPackage)&&this._potentialHiddenSymbols.set(d.value,u)),i&&i.filteredImplicitImports&&(m=i.filteredImplicitImports.find((e=>e.name===l)));let y=!0;m&&(h={type:6,node:a,path:m.path,loadSymbolsFromPath:!0,range:(0,p.getEmptyRange)(),usesLocalName:!1,moduleName:this._fileInfo.moduleName},"__init__"===r&&1===e.module.leadingDots&&0===e.module.nameParts.length&&(y=!1));const g={type:6,node:a,path:s,loadSymbolsFromPath:y,usesLocalName:!!a.alias,symbolName:l,submoduleFallback:h,range:(0,p.getEmptyRange)(),moduleName:this._fileInfo.moduleName,isNativeLib:null==i?void 0:i.isNativeLib};u.addDeclaration(g),this._createFlowAssignment(a.alias||a.name),o&&t.some((e=>e===a.name.value))&&this._typingSymbolAliases.set(d.value,a.name.value),c&&n.some((e=>e===a.name.value))&&this._dataclassesSymbolAliases.set(d.value,a.name.value)}}));return!0}visitWith(e){e.withItems.forEach((e=>{this.walk(e.expression),e.target&&(this._bindPossibleTupleNamedTarget(e.target),this._addInferredTypeAssignmentForVariable(e.target,e),this._createAssignmentTargetFlowNodes(e.target,!0,!1))}));const t=this._createContextManagerLabel(e.withItems.map((e=>e.expression)),!!e.isAsync);this._addAntecedent(t,this._currentFlowNode);const n=this._currentFlowNode,i=this._createBranchLabel(n);return this._addAntecedent(i,t),i.affectedExpressions=this._trackCodeFlowExpressions((()=>{if(this._useExceptTargets([t],(()=>{this.walk(e.suite)})),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=i,e.asyncToken){const t=y.getEnclosingFunction(e);t&&t.isAsync||this._addError(u.Localizer.Diagnostic.asyncNotInAsyncFunction(),e.asyncToken)}})),!1}visitTernary(e){const t=this._currentFlowNode,n=this._createBranchLabel(),i=this._createBranchLabel(),s=this._createBranchLabel(t);return s.affectedExpressions=this._trackCodeFlowExpressions((()=>{this._bindConditional(e.testExpression,n,i),this._currentFlowNode=this._finishFlowLabel(n),this.walk(e.ifExpression),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),this.walk(e.elseExpression),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(s)})),!1}visitUnaryOperation(e){return 38===e.operator&&this._currentFalseTarget&&this._currentTrueTarget?this._bindConditional(e.expression,this._currentFalseTarget,this._currentTrueTarget):this._disableTrueFalseTargets((()=>{this.walk(e.expression)})),!1}visitBinaryOperation(e){if(36===e.operator||37===e.operator){let t,n=this._currentTrueTarget,i=this._currentFalseTarget;n&&i||(t=this._createBranchLabel(),n=i=t);const s=this._createBranchLabel();36===e.operator?this._bindConditional(e.leftExpression,s,i):this._bindConditional(e.leftExpression,n,s),this._currentFlowNode=this._finishFlowLabel(s),this._bindConditional(e.rightExpression,n,i),t&&(this._currentFlowNode=this._finishFlowLabel(t))}else this._disableTrueFalseTargets((()=>{this.walk(e.leftExpression),this.walk(e.rightExpression)}));return!1}visitListComprehension(e){const t=y.getEnclosingFunction(e);return this._createNewScope(0,this._currentScope,(()=>{var n;m.setScope(e,this._currentScope);const i=this._createBranchLabel(),s=[];for(let i=0;i<e.comprehensions.length;i++){const r=e.comprehensions[i],a=new Map;33===r.nodeType&&(this._bindPossibleTupleNamedTarget(r.targetExpression,a),this._addInferredTypeAssignmentForVariable(r.targetExpression,r),r.asyncToken&&(t&&t.isAsync||31===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&this._addError(u.Localizer.Diagnostic.asyncNotInAsyncFunction(),r.asyncToken))),s.push(a)}for(let t=0;t<e.comprehensions.length;t++){const n=e.comprehensions[t];if(33===n.nodeType){const e=s[t];for(const t of e){const e=this._currentScope.parent.lookUpSymbol(t[0]);e&&this._createAssignmentAliasFlowNode(t[1].id,e.id)}this.walk(n.iterableExpression),this._createAssignmentTargetFlowNodes(n.targetExpression,!0,!1)}else{const e=this._createBranchLabel();this._bindConditional(n.testExpression,e,i),this._currentFlowNode=this._finishFlowLabel(e)}}this.walk(e.expression),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i)})),!1}visitMatch(e){this.walk(e.subjectExpression);const t=[],n=this._isNarrowingExpression(e.subjectExpression,t);n&&t.forEach((e=>{const t=(0,h.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(t)}));const i=this._createBranchLabel();let s=!1;return e.cases.forEach((t=>{const r=this._createBranchLabel(),a=this._createBranchLabel(),o=this._createBranchLabel();this._addAntecedent(a,this._currentFlowNode),t.isIrrefutable?t.guardExpression||(s=!0):this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(a),this.walk(t.pattern),n&&this._createFlowNarrowForPattern(e.subjectExpression,t),t.guardExpression?this._bindConditional(t.guardExpression,o,r):this._addAntecedent(o,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(o),this.walk(t.suite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(r)})),n&&(this._createFlowNarrowForPattern(e.subjectExpression,e),s||this._createFlowExhaustedMatch(e)),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i),!1}visitPatternAs(e){const t=this._createBranchLabel();if(e.orPatterns.forEach((e=>{this.walk(e),this._addAntecedent(t,this._currentFlowNode)})),this._currentFlowNode=this._finishFlowLabel(t),e.target){this.walk(e.target);const t=this._bindNameToScope(this._currentScope,e.target.value);if(this._createAssignmentTargetFlowNodes(e.target,!1,!1),t){const n={type:1,node:e.target,isConstant:(0,v.isConstantName)(e.target.value),inferredTypeSource:e,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.target.start,d.TextRange.getEnd(e.target),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n)}}return!1}visitPatternCapture(e){return e.isWildcard||this._addPatternCaptureTarget(e.target),!0}visitPatternMappingExpandEntry(e){return"_"!==e.target.value&&this._addPatternCaptureTarget(e.target),!0}_addSlotsToCurrentScope(e){(0,a.assert)(2===this._currentScope.type);let t=!1;for(const n of e){const e=n.strings[0].value;if("__dict__"===e){t=!0;continue}let i=this._currentScope.lookUpSymbol(e);if(!i){i=this._currentScope.addSymbol(e,13);const t="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;(0,v.isPrivateOrProtectedName)(e)&&t&&i.setIsPrivateMember()}const s={type:1,node:n,isConstant:(0,v.isConstantName)(e),isDefinedBySlots:!0,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(n.start,n.start+n.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName};i.addDeclaration(s)}t||this._currentScope.setSlotsNames(e.map((e=>e.strings[0].value)))}_isInListComprehension(e){let t=e;for(;t;){if(32===t.nodeType)return!0;t=t.parent}return!1}_addPatternCaptureTarget(e){const t=this._bindNameToScope(this._currentScope,e.value);if(this._createAssignmentTargetFlowNodes(e,!1,!1),t){const n={type:1,node:e,isConstant:(0,v.isConstantName)(e.value),inferredTypeSource:e.parent,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.start,d.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName};t.addDeclaration(n)}}_useExceptTargets(e,t){const n=this._currentExceptTargets;this._currentExceptTargets=e,t(),this._currentExceptTargets=n}_getDunderAllNamesFromImport(e){var t;const n=this._currentScope.lookUpSymbol(e);if(!n)return;const i=n.getDeclarations().find((e=>6===e.type)),s=(null==i?void 0:i.path)&&i.loadSymbolsFromPath?i.path:(null===(t=null==i?void 0:i.submoduleFallback)||void 0===t?void 0:t.path)&&i.submoduleFallback.loadSymbolsFromPath?i.submoduleFallback.path:void 0;if(!s)return;const r=this._fileInfo.importLookup(s);return r?r.dunderAllNames:void 0}_addImplicitFromImport(e,t){const n=e.module.nameParts[0].value,i=this._bindNameToScope(this._currentScope,n);i&&this._createAliasDeclarationForMultipartImportName(e,void 0,t,i),this._createFlowAssignment(e.module.nameParts[0])}_createAliasDeclarationForMultipartImportName(e,t,n,i){const s=e.module.nameParts[0].value;if(n&&n.isImportFound&&!n.isNativeLib&&n.resolvedPaths.length>0){const r=i.getDeclarations().find((e=>6===e.type&&e.firstNamePart===s));let a;if(a=r||{type:6,node:e,path:n.resolvedPaths[n.resolvedPaths.length-1],loadSymbolsFromPath:!1,moduleName:n.importName,range:(0,p.getEmptyRange)(),firstNamePart:s,usesLocalName:!!t},t||1===e.module.nameParts.length)a.path=n.resolvedPaths[n.resolvedPaths.length-1],a.loadSymbolsFromPath=!0,this._addImplicitImportsToLoaderActions(n,a);else{let t=a;for(let i=1;i<e.module.nameParts.length&&!(i>=n.resolvedPaths.length);i++){const s=e.module.nameParts[i].value;let r=t.implicitImports?t.implicitImports.get(s):void 0;r||(r={path:n.resolvedPaths[i],loadSymbolsFromPath:!1,implicitImports:new Map},t.implicitImports||(t.implicitImports=new Map),t.implicitImports.set(s,r)),i===e.module.nameParts.length-1&&(r.path=n.resolvedPaths[i],r.loadSymbolsFromPath=!0,this._addImplicitImportsToLoaderActions(n,r)),t=r}}r||i.addDeclaration(a)}else{const n={type:6,node:e,path:"*** unresolved ***",loadSymbolsFromPath:!0,range:(0,p.getEmptyRange)(),usesLocalName:!!t,moduleName:"",isUnresolved:!0};i.addDeclaration(n)}}_getWildcardImportNames(e){if(e.dunderAllNames)return e.dunderAllNames;const t=[];return e.symbolTable.forEach(((e,n)=>{e.isExternallyHidden()||t.push(n)})),t}_walkStatementsAndReportUnreachable(e){let t=!1;for(const n of e)m.setFlowNode(n,this._currentFlowNode),t||(t=this._isCodeUnreachable()),t?this._targetFunctionDeclaration&&!this._targetFunctionDeclaration.isGenerator&&(new I).checkContainsYield(n)&&(this._targetFunctionDeclaration.isGenerator=!0):this.walk(n);return!1}_createStartFlowNode(){return{flags:h.FlowFlags.Start,id:(0,h.getUniqueFlowNodeId)()}}_createBranchLabel(e){return{flags:h.FlowFlags.BranchLabel,id:(0,h.getUniqueFlowNodeId)(),antecedents:[],preBranchAntecedent:e,affectedExpressions:void 0}}_createFlowNarrowForPattern(e,t){const n={flags:h.FlowFlags.NarrowForPattern,id:(0,h.getUniqueFlowNodeId)(),subjectExpression:e,statement:t,antecedent:this._currentFlowNode};this._currentFlowNode=n}_createContextManagerLabel(e,t){return{flags:h.FlowFlags.PostContextManager|h.FlowFlags.BranchLabel,id:(0,h.getUniqueFlowNodeId)(),antecedents:[],expressions:e,affectedExpressions:void 0,isAsync:t}}_createLoopLabel(){return{flags:h.FlowFlags.LoopLabel,id:(0,h.getUniqueFlowNodeId)(),antecedents:[],affectedExpressions:void 0}}_finishFlowLabel(e){return 0===e.antecedents.length?b._unreachableFlowNode:1===e.antecedents.length&&e.flags===h.FlowFlags.BranchLabel?e.antecedents[0]:(this._functionCodeFlowComplexity+=e.antecedents.length,e)}_bindNeverCondition(e,t,n){const i=[];if(55===e.nodeType&&38===e.operator)this._bindNeverCondition(e.expression,t,!n);else if(7!==e.nodeType||36!==e.operator&&37!==e.operator)this._isNarrowingExpression(e,i,!0)&&i.filter((e=>38===e.nodeType)).length>0&&(this._currentFlowNode=this._createFlowConditional(n?h.FlowFlags.TrueNeverCondition:h.FlowFlags.FalseNeverCondition,this._currentFlowNode,e)),this._addAntecedent(t,this._currentFlowNode);else if(36===e.operator){const i=this._currentFlowNode;this._bindNeverCondition(e.leftExpression,t,n),this._currentFlowNode=i,this._bindNeverCondition(e.rightExpression,t,n)}else{const i=this._currentFlowNode,s=this._createBranchLabel();if(this._bindNeverCondition(e.leftExpression,s,n),i!==this._currentFlowNode){this._currentFlowNode=this._finishFlowLabel(s);const r=this._currentFlowNode;this._bindNeverCondition(e.rightExpression,t,n),r===this._currentFlowNode&&(this._currentFlowNode=i)}}}_bindConditional(e,t,n){this._setTrueFalseTargets(t,n,(()=>{this.walk(e)})),this._isLogicalExpression(e)||(this._addAntecedent(t,this._createFlowConditional(h.FlowFlags.TrueCondition,this._currentFlowNode,e)),this._addAntecedent(n,this._createFlowConditional(h.FlowFlags.FalseCondition,this._currentFlowNode,e)))}_disableTrueFalseTargets(e){this._setTrueFalseTargets(void 0,void 0,e)}_setTrueFalseTargets(e,t,n){const i=this._currentTrueTarget,s=this._currentFalseTarget;this._currentTrueTarget=e,this._currentFalseTarget=t,n(),this._currentTrueTarget=i,this._currentFalseTarget=s}_createFlowConditional(e,t,n){if(t.flags&h.FlowFlags.Unreachable)return t;const i=T.evaluateStaticBoolLikeExpression(n,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases);if(!0===i&&e&h.FlowFlags.FalseCondition||!1===i&&e&h.FlowFlags.TrueCondition)return b._unreachableFlowNode;const s=[];if(!this._isNarrowingExpression(n,s))return t;s.forEach((e=>{const t=(0,h.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(t)}));const r=s.filter((e=>38===e.nodeType)),a={flags:e,id:(0,h.getUniqueFlowNodeId)(),reference:r.length>0?r[0]:void 0,expression:n,antecedent:t};return this._addExceptTargets(a),a}_isLogicalExpression(e){switch(e.nodeType){case 55:return 38===e.operator;case 7:return 36===e.operator||37===e.operator}return!1}_isNarrowingExpression(e,t,n=!1,i=!1){switch(e.nodeType){case 38:case 35:case 24:if(n){if(38!==e.nodeType)return!1;if(!i)return!1}return!!(0,h.isCodeFlowSupportedForReference)(e)&&(t.push(e),!0);case 4:return t.push(e.name),!0;case 7:{const i=39===e.operator||40===e.operator,s=12===e.operator||28===e.operator;if(i||s){if(11===e.rightExpression.nodeType&&26===e.rightExpression.constType)return this._isNarrowingExpression(e.leftExpression,t,n,!0);if(i&&9===e.leftExpression.nodeType&&38===e.leftExpression.leftExpression.nodeType&&"type"===e.leftExpression.leftExpression.value&&1===e.leftExpression.arguments.length&&0===e.leftExpression.arguments[0].argumentCategory)return this._isNarrowingExpression(e.leftExpression.arguments[0].valueExpression,t,n,!0);const r=this._isNarrowingExpression(e.leftExpression,t,n,!0);if(i)return r;if(s){const i=this._isNarrowingExpression(e.rightExpression,t,n,!0);return r||i}}return!(41!==e.operator&&42!==e.operator||!this._isNarrowingExpression(e.rightExpression,t,n,!0))||41===e.operator&&this._isNarrowingExpression(e.leftExpression,t,n,!0)}case 55:return 38===e.operator&&this._isNarrowingExpression(e.expression,t,n,!1);case 5:return this._isNarrowingExpression(e.rightExpression,t,n,!0);case 9:if(38===e.leftExpression.nodeType&&("isinstance"===e.leftExpression.value||"issubclass"===e.leftExpression.value)&&2===e.arguments.length)return this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0);if(38===e.leftExpression.nodeType&&"callable"===e.leftExpression.value&&1===e.arguments.length)return this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0);if(e.arguments.length>=1)return!n&&this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0)}return!1}_createAssignmentTargetFlowNodes(e,t,n){switch(e.nodeType){case 38:case 35:case 24:this._createFlowAssignment(e,n),t&&this.walk(e);break;case 52:e.expressions.forEach((e=>{this._createAssignmentTargetFlowNodes(e,t,n)}));break;case 54:this._createAssignmentTargetFlowNodes(e.valueExpression,!1,n),t&&this.walk(e);break;case 56:this._createAssignmentTargetFlowNodes(e.expression,!1,n),t&&this.walk(e);break;case 31:e.entries.forEach((e=>{this._createAssignmentTargetFlowNodes(e,t,n)}));break;default:t&&this.walk(e)}}_createCallFlowNode(e){if(!this._isCodeUnreachable()){const t={flags:h.FlowFlags.Call,id:(0,h.getUniqueFlowNodeId)(),node:e,antecedent:this._currentFlowNode};this._currentFlowNode=t}m.setFlowNode(e,this._currentFlowNode),this._isCodeUnreachable()||this._addExceptTargets(this._currentFlowNode)}_createAssignmentAliasFlowNode(e,t){if(!this._isCodeUnreachable()){const n={flags:h.FlowFlags.AssignmentAlias,id:(0,h.getUniqueFlowNodeId)(),antecedent:this._currentFlowNode,targetSymbolId:e,aliasSymbolId:t};this._currentFlowNode=n}}_createVariableAnnotationFlowNode(){if(!this._isCodeUnreachable()){const e={flags:h.FlowFlags.VariableAnnotation,id:(0,h.getUniqueFlowNodeId)(),antecedent:this._currentFlowNode};this._currentFlowNode=e}}_createFlowAssignment(e,t=!1){let n=_.indeterminateSymbolId;if(38===e.nodeType){const t=this._currentScope.lookUpSymbolRecursive(e.value);(0,a.assert)(void 0!==t),n=t.symbol.id}const i=this._currentFlowNode;if(!this._isCodeUnreachable()&&(0,h.isCodeFlowSupportedForReference)(e)){const i={flags:h.FlowFlags.Assignment,id:(0,h.getUniqueFlowNodeId)(),node:e,antecedent:this._currentFlowNode,targetSymbolId:n},s=(0,h.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(s),t&&(i.flags|=h.FlowFlags.Unbind),35===e.nodeType&&this._addExceptTargets(i),this._currentFlowNode=i}t&&void 0!==m.getFlowNode(e)||m.setFlowNode(e,t?i:this._currentFlowNode)}_createFlowWildcardImport(e,t){if(!this._isCodeUnreachable()){const n={flags:h.FlowFlags.WildcardImport,id:(0,h.getUniqueFlowNodeId)(),node:e,names:t,antecedent:this._currentFlowNode};this._addExceptTargets(n),this._currentFlowNode=n}m.setFlowNode(e,this._currentFlowNode)}_createFlowExhaustedMatch(e){if(!this._isCodeUnreachable()){const t={flags:h.FlowFlags.ExhaustedMatch,id:(0,h.getUniqueFlowNodeId)(),node:e,antecedent:this._currentFlowNode};this._currentFlowNode=t}m.setFlowNode(e,this._currentFlowNode)}_isCodeUnreachable(){return!!(this._currentFlowNode.flags&h.FlowFlags.Unreachable)}_addExceptTargets(e){this._currentExceptTargets&&this._currentExceptTargets.forEach((t=>{this._addAntecedent(t,e)}))}_trackCodeFlowExpressions(e){const t=this._currentScopeCodeFlowExpressions;this._currentScopeCodeFlowExpressions=new Set,e();const n=this._currentScopeCodeFlowExpressions;return t&&this._currentScopeCodeFlowExpressions.forEach((e=>{t.add(e)})),this._currentScopeCodeFlowExpressions=t,n}_bindLoopStatement(e,t,n){const i=this._currentContinueTarget,s=this._currentBreakTarget,r=this._functionCodeFlowComplexity;this._currentContinueTarget=e,this._currentBreakTarget=t,this._functionCodeFlowComplexity=1,e.affectedExpressions=this._trackCodeFlowExpressions(n),this._currentContinueTarget=i,this._currentBreakTarget=s,this._functionCodeFlowComplexity=2*this._functionCodeFlowComplexity+r}_addAntecedent(e,t){this._currentFlowNode.flags&h.FlowFlags.Unreachable||e.antecedents.some((e=>e.id===t.id))||e.antecedents.push(t)}_bindNameToScope(e,t,n){const i=this._currentScope.getBindingType(t);if(void 0===i){let i=e.lookUpSymbol(t);if(!i){if(i=e.addSymbol(t,5),2===e.type){const n=e.parent.lookUpSymbol(t);n&&this._createAssignmentAliasFlowNode(i.id,n.id)}3!==this._currentScope.type&&4!==this._currentScope.type||(0,v.isPrivateOrProtectedName)(t)&&((0,v.isPrivateName)(t)?i.setIsExternallyHidden():this._fileInfo.isStubFile||this._fileInfo.isInPyTypedPackage?4===this._currentScope.type?i.setIsExternallyHidden():this._potentialPrivateSymbols.set(t,i):i.setIsPrivateMember()),n&&n.set(t,i)}return i}{const e=(0===i?this._currentScope.parent:this._currentScope.getGlobalScope()).lookUpSymbolRecursive(t);if(e)return e.symbol}}_bindPossibleTupleNamedTarget(e,t){switch(e.nodeType){case 38:this._bindNameToScope(this._currentScope,e.value,t);break;case 52:e.expressions.forEach((e=>{this._bindPossibleTupleNamedTarget(e,t)}));break;case 31:e.entries.forEach((e=>{this._bindPossibleTupleNamedTarget(e,t)}));break;case 54:this._bindPossibleTupleNamedTarget(e.valueExpression,t);break;case 56:this._bindPossibleTupleNamedTarget(e.expression,t)}}_addBuiltInSymbolToCurrentScope(e,t,n){const i=this._addSymbolToCurrentScope(e,!1);i&&(i.addDeclaration({type:0,node:t,intrinsicType:n,path:this._fileInfo.filePath,range:(0,p.getEmptyRange)(),moduleName:this._fileInfo.moduleName}),i.setIsIgnoredForProtocolMatch())}_addSymbolToCurrentScope(e,t){let n=this._currentScope.lookUpSymbol(e);if(!n){let i=0;t&&(i|=1),2===this._currentScope.type&&(i|=4),this._fileInfo.isStubFile&&(0,v.isPrivateOrProtectedName)(e)&&(i|=2),n=this._currentScope.addSymbol(e,i)}return n}_createNewScope(e,t,n){const i=this._currentScope,s=new f.Scope(e,t);this._currentScope=s;const r=4===e||3===e||1===e,a=this._currentScopeCodeFlowExpressions;return r&&(this._currentScopeCodeFlowExpressions=new Set),n(),this._currentScopeCodeFlowExpressions=a,this._currentScope=i,s}_addInferredTypeAssignmentForVariable(e,t,n=!1){switch(e.nodeType){case 38:{const i=e,s=this._currentScope.lookUpSymbolRecursive(i.value);if(s&&s.symbol){const r={type:1,node:e,isConstant:(0,v.isConstantName)(e.value),inferredTypeSource:t,typeAliasName:n?e:void 0,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(i.start,d.TextRange.getEnd(i),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};s.symbol.addDeclaration(r)}break}case 35:{const n=this._getMemberAccessInfo(e);if(n){const i=e.memberName;let s=n.classScope.lookUpSymbol(i.value);if(!s){s=n.classScope.addSymbol(i.value,1);const e="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;(0,v.isPrivateOrProtectedName)(i.value)&&e&&s.setIsPrivateMember()}n.isInstanceMember?s.isClassMember()&&s.getDeclarations().some((e=>3===e.type&&e.isMethod))||s.setIsInstanceMember():s.setIsClassMember();const r={type:1,node:e.memberName,isConstant:(0,v.isConstantName)(i.value),inferredTypeSource:t,isDefinedByMemberAccess:!0,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(e.memberName.start,e.memberName.start+e.memberName.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};s.addDeclaration(r)}break}case 52:e.expressions.forEach((e=>{this._addInferredTypeAssignmentForVariable(e,t)}));break;case 54:this._addInferredTypeAssignmentForVariable(e.valueExpression,t);break;case 56:this._addInferredTypeAssignmentForVariable(e.expression,t);break;case 31:e.entries.forEach((e=>{this._addInferredTypeAssignmentForVariable(e,t)}))}}_addTypeDeclarationForVariable(e,t){var n,i,s;let r=!1;switch(e.nodeType){case 38:{const a=e,o=this._currentScope.lookUpSymbolRecursive(a.value);if(o&&o.symbol){const r=this._isAnnotationFinal(t),l=this._isAnnotationTypeAlias(t);let p=t;l?(p=void 0,2!==this._currentScope.type&&3!==this._currentScope.type&&4!==this._currentScope.type&&this._addError(u.Localizer.Diagnostic.typeAliasNotInModuleOrClass(),t)):r.isFinal&&(p=r.finalTypeNode);let m=this._isAnnotationClassVar(t);if(m.isClassVar&&(p=m.classVarTypeNode),r.isFinal){const t=y.getEnclosingClassOrFunction(e);t&&10===t.nodeType&&(3!==(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&3!==(null===(s=null===(i=e.parent)||void 0===i?void 0:i.parent)||void 0===s?void 0:s.nodeType)||(m={isClassVar:!0,classVarTypeNode:void 0}))}const h={type:1,node:e,isConstant:(0,v.isConstantName)(a.value),isFinal:r.isFinal,isRequired:this._isRequiredAnnotation(p),isNotRequired:this._isNotRequiredAnnotation(p),typeAliasAnnotation:l?t:void 0,typeAliasName:l?e:void 0,path:this._fileInfo.filePath,typeAnnotationNode:p,range:(0,c.convertOffsetsToRange)(a.start,d.TextRange.getEnd(a),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};o.symbol.addDeclaration(h),m.isClassVar?o.symbol.setIsClassVar():o.symbol.setIsInstanceMember(),24===t.nodeType&&this._isDataclassesAnnotation(t.baseExpression,"InitVar")&&o.symbol.setIsInitVar()}r=!0;break}case 35:{const n=this._getMemberAccessInfo(e);if(n){const i=e.memberName;let s=n.classScope.lookUpSymbol(i.value);if(!s){s=n.classScope.addSymbol(i.value,1);const e="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;(0,v.isPrivateOrProtectedName)(i.value)&&e&&s.setIsPrivateMember()}n.isInstanceMember?s.setIsInstanceMember():s.setIsClassMember();const a=this._isAnnotationFinal(t),o={type:1,node:e.memberName,isConstant:(0,v.isConstantName)(i.value),isDefinedByMemberAccess:!0,isFinal:a.isFinal,path:this._fileInfo.filePath,typeAnnotationNode:a.isFinal?a.finalTypeNode:t,range:(0,c.convertOffsetsToRange)(e.memberName.start,e.memberName.start+e.memberName.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName,docString:this._getVariableDocString(e)};s.addDeclaration(o),r=!0}break}}r||this._addError(u.Localizer.Diagnostic.annotationNotSupported(),t)}_isTypingAnnotation(e,t){return this._isKnownAnnotation(e,t,this._typingImportAliases,this._typingSymbolAliases)}_isDataclassesAnnotation(e,t){return this._isKnownAnnotation(e,t,this._dataclassesImportAliases,this._dataclassesSymbolAliases)}_isKnownAnnotation(e,t,n,i){if(38===e.nodeType){if(i.get(e.value)===t)return!0}else if(35===e.nodeType&&38===e.leftExpression.nodeType&&e.memberName.value===t){const t=e.leftExpression.value;return n.some((e=>e===t))}return!1}_getVariableDocString(e){var t,n,i,s;let r,a=e;for(;a&&3!==a.nodeType;)54!==a.nodeType||r||(r=a),a=a.parent;if(3!==(null==a?void 0:a.nodeType)){if(!r)return;a=r}const o=a.parent;if(47!==(null==o?void 0:o.nodeType))return;const l=o.parent;if(!l||36!==l.nodeType&&50!==l.nodeType)return;const c=l.statements.findIndex((e=>e===o));if(c<0||c===l.statements.length-1)return;const p=l.statements[c+1];if(47!==p.nodeType||!y.isDocString(p))return;let d=!1;if(36===(null===(t=null==o?void 0:o.parent)||void 0===t?void 0:t.nodeType))d=!0;else if(50===(null===(n=null==o?void 0:o.parent)||void 0===n?void 0:n.nodeType)&&10===(null===(s=null===(i=null==o?void 0:o.parent)||void 0===i?void 0:i.parent)||void 0===s?void 0:s.nodeType))d=!0;else{const e=y.getEnclosingFunction(o);e&&"__init__"===e.name.value&&y.getEnclosingClass(e,!0)&&(d=!0)}if(!d)return;const u=p.statements[0].strings;return 1===u.length?u[0].value:u.map((e=>e.value)).join("")}_isAnnotationFinal(e){let t,n=!1;return e&&(this._isTypingAnnotation(e,"Final")?n=!0:24===e.nodeType&&1===e.items.length&&(!this._isAnnotationFinal(e.baseExpression).isFinal||0!==e.items[0].argumentCategory||e.items[0].name||e.trailingComma||(n=!0,t=e.items[0].valueExpression))),{isFinal:n,finalTypeNode:t}}_isAnnotationClassVar(e){let t,n=!1;return e&&(this._isTypingAnnotation(e,"ClassVar")?n=!0:24===e.nodeType&&1===e.items.length&&(!this._isAnnotationClassVar(e.baseExpression).isClassVar||0!==e.items[0].argumentCategory||e.items[0].name||e.trailingComma||(n=!0,t=e.items[0].valueExpression))),{isClassVar:n,classVarTypeNode:t}}_isRequiredAnnotation(e){return!(!e||24!==e.nodeType||1!==e.items.length||!this._isTypingAnnotation(e.baseExpression,"Required"))}_isNotRequiredAnnotation(e){return!(!e||24!==e.nodeType||1!==e.items.length||!this._isTypingAnnotation(e.baseExpression,"NotRequired"))}_isAnnotationTypeAlias(e){return!!e&&this._isTypingAnnotation(e,"TypeAlias")}_getMemberAccessInfo(e){if(38!==e.leftExpression.nodeType)return;const t=e.leftExpression.value,n=y.getEnclosingFunction(e);if(!n)return;const i=y.getEnclosingClass(n);if(!i)return;let s=!1;if(n.parameters.length<1||!n.parameters[0].name)return;const r=i.name.value,o=n.parameters[0].name.value;if(t===r)s=!1;else{if(t!==o)return;if("__new__"===n.name.value)s=!1;else{s=!0;for(const e of n.decorators)if(38===e.expression.nodeType){const t=e.expression.value;if("staticmethod"===t)return;if("classmethod"===t){s=!1;break}}}}const l=m.getScope(i);return(0,a.assert)(void 0!==l),{classNode:i,methodNode:n,classScope:l,isInstanceMember:s}}_addImplicitImportsToLoaderActions(e,t){e.filteredImplicitImports.forEach((e=>{const n=t.implicitImports?t.implicitImports.get(e.name):void 0;n?(n.path=e.path,n.loadSymbolsFromPath=!0):(t.implicitImports||(t.implicitImports=new Map),t.implicitImports.set(e.name,{path:e.path,loadSymbolsFromPath:!0,implicitImports:new Map}))}))}_handleTypingStubAssignmentOrAnnotation(e){if(!this._fileInfo.isTypingStubFile)return!1;let t;if(54===e.nodeType)t=e;else{if(54!==e.leftExpression.nodeType)return!1;t=e.leftExpression}if(38!==t.valueExpression.nodeType)return!1;const n=t.valueExpression,i=new Map([["Tuple",!0],["Generic",!0],["Protocol",!0],["Callable",!0],["Type",!0],["ClassVar",!0],["Final",!0],["Literal",!0],["TypedDict",!0],["Union",!0],["Optional",!0],["Annotated",!0],["TypeAlias",!0],["OrderedDict",!0],["Concatenate",!0],["TypeGuard",!0],["Unpack",!0],["Self",!0],["NoReturn",!0]]),s=n.value;if(!i.has(s))return!1;const r=this._bindNameToScope(this._currentScope,s);return r&&r.addDeclaration({type:5,node:t,path:this._fileInfo.filePath,range:(0,c.convertOffsetsToRange)(t.start,d.TextRange.getEnd(t),this._fileInfo.lines),moduleName:this._fileInfo.moduleName}),!0}_deferBinding(e){this._moduleSymbolOnly||this._deferredBindingTasks.push({scope:this._currentScope,codeFlowExpressions:this._currentScopeCodeFlowExpressions,callback:e})}_bindDeferred(){for(;this._deferredBindingTasks.length>0;){const e=this._deferredBindingTasks.shift();this._currentScope=e.scope,this._currentScopeCodeFlowExpressions=e.codeFlowExpressions,e.callback()}}_bindYield(e){const t=y.getEnclosingFunction(e);t?t.isAsync&&61===e.nodeType&&this._addError(u.Localizer.Diagnostic.yieldFromOutsideAsync(),e):y.getEnclosingLambda(e)||this._addError(u.Localizer.Diagnostic.yieldOutsideFunction(),e),this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.yieldStatements||(this._targetFunctionDeclaration.yieldStatements=[]),this._targetFunctionDeclaration.yieldStatements.push(e),this._targetFunctionDeclaration.isGenerator=!0),e.expression&&this.walk(e.expression),m.setFlowNode(e,this._currentFlowNode)}_addDiagnostic(e,t,n,i){let s;switch(e){case"error":s=this._addError(n,i);break;case"warning":s=this._addWarning(n,i);break;case"information":s=this._addInformation(n,i);break;case"none":break;default:return(0,a.assertNever)(e,`${e} is not expected`)}return s&&s.setRule(t),s}_addError(e,t){return this._fileInfo.diagnosticSink.addDiagnosticWithTextRange("error",e,t)}_addWarning(e,t){return this._fileInfo.diagnosticSink.addDiagnosticWithTextRange("warning",e,t)}_addInformation(e,t){return this._fileInfo.diagnosticSink.addDiagnosticWithTextRange("information",e,t)}}t.Binder=b,b._unreachableFlowNode={flags:h.FlowFlags.Unreachable,id:(0,h.getUniqueFlowNodeId)()};class I extends g.ParseTreeWalker{constructor(){super(...arguments),this._containsYield=!1}checkContainsYield(e){return this.walk(e),this._containsYield}visitYield(e){return this._containsYield=!0,!1}visitYieldFrom(e){return this._containsYield=!0,!1}}t.YieldFinder=I;class C extends g.ParseTreeWalker{constructor(){super(...arguments),this._containsReturn=!1}checkContainsReturn(e){return this.walk(e),this._containsReturn}visitReturn(e){return this._containsReturn=!0,!1}}t.ReturnFinder=C},6329:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Checker=void 0;const a=n(5839),o=n(1290),l=n(9744),c=n(6886),p=n(3550),d=n(2122),u=n(5275),m=n(5136),h=r(n(563)),y=n(5523),g=n(7012),f=r(n(8494)),T=n(427),_=n(5083),v=n(8235),b=r(n(1766)),I=n(2917),C=n(1133),S=n(5168),F=n(1659),D=new Map([["Tuple",{version:c.PythonVersion.V3_9,fullName:"builtins.tuple",replacementText:"tuple"}],["List",{version:c.PythonVersion.V3_9,fullName:"builtins.list",replacementText:"list"}],["Dict",{version:c.PythonVersion.V3_9,fullName:"builtins.dict",replacementText:"dict"}],["Set",{version:c.PythonVersion.V3_9,fullName:"builtins.set",replacementText:"set"}],["FrozenSet",{version:c.PythonVersion.V3_9,fullName:"builtins.frozenset",replacementText:"frozenset"}],["Type",{version:c.PythonVersion.V3_9,fullName:"builtins.type",replacementText:"type"}],["Deque",{version:c.PythonVersion.V3_9,fullName:"collections.deque",replacementText:"collections.deque"}],["DefaultDict",{version:c.PythonVersion.V3_9,fullName:"collections.defaultdict",replacementText:"collections.defaultdict"}],["OrderedDict",{version:c.PythonVersion.V3_9,fullName:"collections.OrderedDict",replacementText:"collections.OrderedDict"}],["Counter",{version:c.PythonVersion.V3_9,fullName:"collections.Counter",replacementText:"collections.Counter"}],["ChainMap",{version:c.PythonVersion.V3_9,fullName:"collections.ChainMap",replacementText:"collections.ChainMap"}]]),P=new Map([["Optional",{version:c.PythonVersion.V3_10,fullName:"typing.Optional",replacementText:"| None"}],["Union",{version:c.PythonVersion.V3_10,fullName:"typing.Union",replacementText:"|"}]]);class x extends T.ParseTreeWalker{constructor(e,t){super(),this._isUnboundCheckSuppressed=!1,this._scopedNodes=[],this._moduleNode=e,this._fileInfo=h.getFileInfo(e),this._evaluator=t}check(){this._scopedNodes.push(this._moduleNode),this._walkStatementsAndReportUnreachable(this._moduleNode.statements);const e=h.getDunderAllInfo(this._moduleNode);e&&(this._evaluator.markNamesAccessed(this._moduleNode,e.names),this._reportUnusedDunderAllSymbols(e.stringNodes)),this._validateSymbolTables(),this._reportDuplicateImports()}walk(e){h.isCodeUnreachable(e)?this._evaluator.suppressDiagnostics(e,(()=>{super.walk(e)})):super.walk(e)}visitSuite(e){return this._walkStatementsAndReportUnreachable(e.statements),!1}visitStatementList(e){return e.statements.forEach((e=>{(0,u.isExpressionNode)(e)&&this._evaluator.getType(e)})),!0}visitClass(e){const t=this._evaluator.getTypeOfClass(e);return this.walk(e.suite),this.walkMultiple(e.decorators),this.walkMultiple(e.arguments),t&&(C.ClassType.isProtocolClass(t.classType)&&(e.arguments.forEach((e=>{if(!e.name){const n=this._evaluator.getType(e.valueExpression);n&&(0,C.isInstantiableClass)(n)&&!C.ClassType.isBuiltIn(n,"Protocol")&&!C.ClassType.isBuiltIn(n,"Generic")&&(C.ClassType.isProtocolClass(n)||this._evaluator.addError(d.Localizer.Diagnostic.protocolBaseClass().format({classType:this._evaluator.printType(t.classType,!1),baseType:this._evaluator.printType(n,!1)}),e.valueExpression))}})),this._validateProtocolTypeParamVariance(e,t.classType)),this._fileInfo.isStubFile||(this._validateBaseClassOverrides(t.classType),this._validateSlotsClassVarConflict(t.classType)),this._validateFinalMemberOverrides(t.classType),this._validateInstanceVariableInitialization(t.classType),this._validateFinalClassNotAbstract(t.classType,e),this._reportDuplicateEnumMembers(t.classType),C.ClassType.isTypedDictClass(t.classType)&&this._validateTypedDictClassSuite(e.suite),C.ClassType.isEnumClass(t.classType)&&this._validateEnumClassOverride(e,t.classType)),this._scopedNodes.push(e),!1}visitFunction(e){var t;const n=this._evaluator.getTypeOfFunction(e),i=f.getEnclosingClass(e,!0);if(n){let s=!1;e.parameters.forEach(((e,t)=>{if(e.name)if(1===e.category){const t=e.typeAnnotation||e.typeAnnotationComment;if(t&&35===t.nodeType&&"args"===t.memberName.value){const e=this._evaluator.getType(t.leftExpression);e&&(0,C.isTypeVar)(e)&&e.details.isParamSpec&&(s=!0)}}else 2===e.category&&(s=!1);if(e.name&&0===e.category&&s&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.namedParamAfterParamSpecArgs().format({name:e.name.value}),e.name),e.name&&"_"!==e.name.value&&t<n.functionType.details.parameters.length){const i=n.functionType.details.parameters[t].type;if((0,C.isUnknown)(i)||(0,C.isTypeVar)(i)&&i.details.isSynthesized&&!i.details.isSynthesizedSelfCls)this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,d.Localizer.Diagnostic.paramTypeUnknown().format({paramName:e.name.value}),e.name);else if((0,S.isPartlyUnknown)(i)){const t=new o.DiagnosticAddendum;t.addMessage(d.Localizer.DiagnosticAddendum.paramType().format({paramType:this._evaluator.printType(i,!0)})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,d.Localizer.Diagnostic.paramTypePartiallyUnknown().format({paramName:e.name.value})+t.getString(),e.name)}let s=!1;(n.functionType.details.parameters[t].typeAnnotation||(0,C.isTypeVar)(i)&&i.details.isSynthesizedSelfCls)&&(s=!0),s||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingParameterType,l.DiagnosticRule.reportMissingParameterType,d.Localizer.Diagnostic.paramAnnotationMissing().format({name:e.name.value}),e.name)}if(e.defaultValue&&this._fileInfo.isStubFile){const t=this._evaluator.getType(e.defaultValue);t&&(0,S.isEllipsisType)(t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement,l.DiagnosticRule.reportInvalidStubStatement,d.Localizer.Diagnostic.defaultValueNotEllipsis(),e.defaultValue)}}));const r=e.parameters.filter(((e,t)=>{const i=n.functionType.details.parameters[t];if(i.typeAnnotation&&(0,C.isTypeVar)(i.type)&&(0,C.isParamSpec)(i.type)&&0!==i.category){const e=48===i.typeAnnotation.nodeType?i.typeAnnotation.typeAnnotation:i.typeAnnotation;if(35===(null==e?void 0:e.nodeType))return!0}return!1}));1===r.length&&this._evaluator.addError(d.Localizer.Diagnostic.paramSpecArgsKwargsUsage(),r[0].typeAnnotation||r[0].typeAnnotationComment),this._fileInfo.isStubFile&&(e.returnTypeAnnotation||(null===(t=e.functionAnnotationComment)||void 0===t?void 0:t.returnTypeAnnotation)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,d.Localizer.Diagnostic.returnTypeUnknown(),e.name)),i&&this._validateMethod(e,n.functionType,i)}if(e.parameters.forEach(((e,t)=>{if(e.defaultValue&&this.walk(e.defaultValue),e.typeAnnotation&&this.walk(e.typeAnnotation),e.typeAnnotationComment&&this.walk(e.typeAnnotationComment),n){const i=e.typeAnnotation||e.typeAnnotationComment;if(i){const e=n.functionType.details.parameters[t].type;(0,C.isTypeVar)(e)&&1===e.details.variance&&!e.details.isSynthesized&&"__init__"!==n.functionType.details.name&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.paramTypeCovariant(),i)}}})),e.returnTypeAnnotation&&this.walk(e.returnTypeAnnotation),e.functionAnnotationComment&&this.walk(e.functionAnnotationComment),this.walkMultiple(e.decorators),e.parameters.forEach((e=>{e.name&&this.walk(e.name)})),this.walk(e.suite),n&&(this._validateFunctionReturn(e,n.functionType),this._validateDunderSignatures(e,n.functionType,void 0!==i)),this._fileInfo.isStubFile&&"__getattr__"===e.name.value){const t=(0,_.getScopeForNode)(e);3===(null==t?void 0:t.type)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompleteStub,l.DiagnosticRule.reportIncompleteStub,d.Localizer.Diagnostic.stubUsesGetAttr(),e.name)}if(this._scopedNodes.push(e),this._validateFunctionTypeVarUsage(e),n&&(0,C.isOverloadedFunction)(n.decoratedType)){const t=n.decoratedType.overloads;if(t.length>1){const n=100;t.length<n&&this._validateOverloadConsistency(e,t[t.length-1],t.slice(0,t.length-1))}}return!1}visitLambda(e){this._evaluator.getType(e),this.walkMultiple([...e.parameters,e.expression]),e.parameters.forEach((e=>{if(e.name){const t=this._evaluator.getType(e.name);t&&((0,C.isUnknown)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,d.Localizer.Diagnostic.paramTypeUnknown().format({paramName:e.name.value}),e.name):(0,S.isPartlyUnknown)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,d.Localizer.Diagnostic.paramTypePartiallyUnknown().format({paramName:e.name.value}),e.name))}}));const t=this._evaluator.getType(e.expression);return t&&((0,C.isUnknown)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,d.Localizer.Diagnostic.lambdaReturnTypeUnknown(),e.expression):(0,S.isPartlyUnknown)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,d.Localizer.Diagnostic.lambdaReturnTypePartiallyUnknown().format({returnType:this._evaluator.printType(t,!0)}),e.expression)),this._scopedNodes.push(e),!1}visitCall(e){var t;if(this._validateIsInstanceCall(e),this._validateIllegalDefaultParamInitializer(e),("none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCallResult||"none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCoroutine)&&47===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)){const t=this._evaluator.getType(e);t&&this._isTypeValidForUnusedValueTest(t)&&(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCallResult,l.DiagnosticRule.reportUnusedCallResult,d.Localizer.Diagnostic.unusedCallResult().format({type:this._evaluator.printType(t,!1)}),e),(0,C.isClassInstance)(t)&&C.ClassType.isBuiltIn(t,"Coroutine")&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCoroutine,l.DiagnosticRule.reportUnusedCoroutine,d.Localizer.Diagnostic.unusedCoroutine(),e))}return!0}visitAwait(e){var t;if("none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCallResult&&47===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&9===e.expression.nodeType){const t=this._evaluator.getType(e);t&&this._isTypeValidForUnusedValueTest(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCallResult,l.DiagnosticRule.reportUnusedCallResult,d.Localizer.Diagnostic.unusedCallResult().format({type:this._evaluator.printType(t,!1)}),e)}return!0}visitFor(e){return this._evaluator.evaluateTypesForStatement(e),!0}visitList(e){return this._validateIllegalDefaultParamInitializer(e),!0}visitSet(e){return this._validateIllegalDefaultParamInitializer(e),!0}visitDictionary(e){return this._validateIllegalDefaultParamInitializer(e),!0}visitListComprehension(e){return this._scopedNodes.push(e),!0}visitIf(e){return this._evaluator.getType(e.testExpression),!0}visitWhile(e){return this._evaluator.getType(e.testExpression),!0}visitWith(e){return e.withItems.forEach((e=>{this._evaluator.evaluateTypesForStatement(e)})),!0}visitReturn(e){let t;const n=f.getEnclosingFunction(e),i=n?this._evaluator.getFunctionDeclaredReturnType(n):void 0;if(t=e.returnExpression?this._evaluator.getType(e.returnExpression)||C.UnknownType.create():C.NoneType.createInstance(),this._evaluator.isNodeReachable(e,void 0)&&n){if(i)if((0,S.isNoReturnType)(i))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.noReturnContainsReturn(),e);else{const n=new o.DiagnosticAddendum;this._evaluator.canAssignType(i,t,n,void 0,64)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.returnTypeMismatch().format({exprType:this._evaluator.printType(t,!1),returnType:this._evaluator.printType(i,!1)})+n.getString(),e.returnExpression?e.returnExpression:e)}(0,C.isUnknown)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,d.Localizer.Diagnostic.returnTypeUnknown(),e.returnExpression):(0,S.isPartlyUnknown)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,d.Localizer.Diagnostic.returnTypePartiallyUnknown().format({returnType:this._evaluator.printType(t,!0)}),e.returnExpression)}return!0}visitYield(e){const t=e.expression?this._evaluator.getType(e.expression):C.NoneType.createInstance();return this._validateYieldType(e,t||C.UnknownType.create()),!0}visitYieldFrom(e){const t=this._evaluator.getType(e.expression)||C.UnknownType.create();let n=this._evaluator.getTypeFromIterable(t,!1,e)||C.UnknownType.create();const i=(0,S.getGeneratorTypeArgs)(n);return n=i?i.length>=1?i[0]:C.UnknownType.create():this._evaluator.getTypeFromIterator(t,!1,e)||C.UnknownType.create(),this._validateYieldType(e,n),!0}visitRaise(e){if(this._evaluator.verifyRaiseExceptionType(e),e.valueExpression){const t=this._evaluator.getBuiltInType(e,"BaseException"),n=this._evaluator.getType(e.valueExpression);if(n&&t&&(0,C.isInstantiableClass)(t)){const i=new o.DiagnosticAddendum;(0,S.doForEachSubtype)(n,(e=>{e=this._evaluator.makeTopLevelTypeVarsConcrete(e),(0,C.isAnyOrUnknown)(e)||(0,C.isNone)(e)||(0,C.isClass)(e)&&(0,S.derivesFromClassRecursive)(e,t,!1)||i.addMessage(d.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)}))})),i.isEmpty()||this._evaluator.addError(d.Localizer.Diagnostic.expectedExceptionObj()+i.getString(),e.valueExpression)}}return!0}visitExcept(e){if(e.typeExpression){this._evaluator.evaluateTypesForStatement(e);const t=this._evaluator.getType(e.typeExpression);t&&this._validateExceptionType(t,e.typeExpression)}return!0}visitAssert(e){e.exceptionExpression&&this._evaluator.getType(e.exceptionExpression);const t=this._evaluator.getType(e.testExpression);return t&&(0,C.isClassInstance)(t)&&(0,S.isTupleClass)(t)&&t.tupleTypeArguments&&t.tupleTypeArguments.length>0&&((0,S.isOpenEndedTupleClass)(t)||this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportAssertAlwaysTrue,l.DiagnosticRule.reportAssertAlwaysTrue,d.Localizer.Diagnostic.assertAlwaysTrue(),e.testExpression)),!0}visitAssignment(e){return this._evaluator.evaluateTypesForStatement(e),e.typeAnnotationComment&&this._evaluator.getType(e.typeAnnotationComment),!0}visitAssignmentExpression(e){return this._evaluator.getType(e),!0}visitAugmentedAssignment(e){return this._evaluator.evaluateTypesForStatement(e),!0}visitIndex(e){this._evaluator.getType(e);const t=this._evaluator.getType(e.baseExpression);if(t&&(0,C.isClassInstance)(t)&&t.tupleTypeArguments&&!(0,S.isOpenEndedTupleClass)(t)){const n=t.tupleTypeArguments.length;if(1===e.items.length&&!e.trailingComma&&0===e.items[0].argumentCategory&&!e.items[0].name){const t=this._evaluator.getType(e.items[0].valueExpression);if(t&&(0,C.isClassInstance)(t)&&C.ClassType.isBuiltIn(t,"int")&&(0,S.isLiteralType)(t)){const i=t.literalValue;(i>=0&&i>=n||i<0&&i+n<0)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.tupleIndexOutOfRange().format({length:n,index:i}),e)}}}return!0}visitBinaryOperation(e){return 12!==e.operator&&28!==e.operator||f.isWithinAssertExpression(e)||this._validateComparisonTypes(e),this._evaluator.getType(e),!0}visitSlice(e){return this._evaluator.getType(e),!0}visitUnpack(e){return this._evaluator.getType(e),!0}visitTuple(e){return this._evaluator.getType(e),!0}visitUnaryOperation(e){return this._evaluator.getType(e),!0}visitTernary(e){return this._evaluator.getType(e),!0}visitStringList(e){for(const t of e.strings)t.hasUnescapeErrors&&(0,m.getUnescapedString)(t.token).unescapeErrors.forEach((e=>{const n={start:t.token.start+t.token.prefixLength+t.token.quoteMarkLength+e.offset,length:e.length};0===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportInvalidStringEscapeSequence,l.DiagnosticRule.reportInvalidStringEscapeSequence,d.Localizer.Diagnostic.stringUnsupportedEscape(),n):1===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",d.Localizer.Diagnostic.formatStringEscape(),n):2===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",d.Localizer.Diagnostic.formatStringBrace(),n):3===e.errorType&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",d.Localizer.Diagnostic.formatStringUnterminated(),n)}));return e.typeAnnotation&&this._evaluator.getType(e),e.strings.length>1&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportImplicitStringConcatenation,l.DiagnosticRule.reportImplicitStringConcatenation,d.Localizer.Diagnostic.implicitStringConcat(),e),!0}visitFormatString(e){return e.expressions.forEach((e=>{this._evaluator.getType(e)})),!0}visitGlobal(e){return this._suppressUnboundCheck((()=>{e.nameList.forEach((e=>{this._evaluator.getType(e),this.walk(e)}))})),!1}visitNonlocal(e){return this._suppressUnboundCheck((()=>{e.nameList.forEach((e=>{this._evaluator.getType(e),this.walk(e)}))})),!1}visitName(e){return this._conditionallyReportPrivateUsage(e),this._isUnboundCheckSuppressed||this._reportUnboundName(e),!0}visitDel(e){return this._suppressUnboundCheck((()=>{e.expressions.forEach((e=>{this._evaluator.verifyDeleteExpression(e),this.walk(e)}))})),!1}visitMemberAccess(e){return this._evaluator.getType(e),this._conditionallyReportPrivateUsage(e.memberName),this.walk(e.leftExpression),!1}visitImportAs(e){return this._evaluator.evaluateTypesForStatement(e),!1}visitImportFrom(e){if(e.isWildcardImport){const t=h.getImportInfo(e.module);t&&t.isImportFound&&2!==t.importType&&!this._fileInfo.isStubFile&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportWildcardImportFromLibrary,l.DiagnosticRule.reportWildcardImportFromLibrary,d.Localizer.Diagnostic.wildcardLibraryImport(),e.wildcardToken||e)}else e.imports.forEach((e=>{this._evaluator.evaluateTypesForStatement(e)}));return!1}visitTypeAnnotation(e){return this._evaluator.getType(e.typeAnnotation),!0}visitMatch(e){return this._evaluator.getType(e.subjectExpression),!0}visitCase(e){return e.guardExpression&&this._evaluator.getType(e.guardExpression),this._evaluator.evaluateTypesForStatement(e.pattern),!0}visitError(e){return e.child&&this._evaluator.getType(e.child),!1}_suppressUnboundCheck(e){const t=this._isUnboundCheckSuppressed;this._isUnboundCheckSuppressed=!0;try{e()}finally{this._isUnboundCheckSuppressed=t}}_validateIllegalDefaultParamInitializer(e){"none"!==this._fileInfo.diagnosticRuleSet.reportCallInDefaultInitializer&&f.isWithinDefaultParamInitializer(e)&&!this._fileInfo.isStubFile&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportCallInDefaultInitializer,l.DiagnosticRule.reportCallInDefaultInitializer,d.Localizer.Diagnostic.defaultValueContainsCall(),e)}_validateComparisonTypes(e){const t=this._evaluator.getType(e.leftExpression),n=this._evaluator.getType(e.rightExpression);if(t&&n)if((0,S.isLiteralTypeOrUnion)(n)&&(0,S.isLiteralTypeOrUnion)(t)){if(void 0===(0,v.evaluateStaticBoolExpression)(e,this._fileInfo.executionEnvironment)){let i=!1;(0,S.doForEachSubtype)(t,(e=>{this._evaluator.canAssignType(n,e)&&(i=!0)})),i||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison,l.DiagnosticRule.reportUnnecessaryComparison,d.Localizer.Diagnostic.comparisonAlwaysFalse().format({leftType:this._evaluator.printType(t,!0),rightType:this._evaluator.printType(n,!0)}),e)}}else{let i=!1;if((0,S.doForEachSubtype)(t,(e=>{i||(e=this._evaluator.makeTopLevelTypeVarsConcrete(e),(0,S.doForEachSubtype)(n,(t=>{i||(t=this._evaluator.makeTopLevelTypeVarsConcrete(t),this._isTypeComparable(e,t)&&(i=!0))})))})),!i){const i=this._evaluator.printType(t,!0),s=this._evaluator.printType(n,!0),r=12===e.operator?d.Localizer.Diagnostic.comparisonAlwaysFalse():d.Localizer.Diagnostic.comparisonAlwaysTrue();this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison,l.DiagnosticRule.reportUnnecessaryComparison,r.format({leftType:i,rightType:s}),e)}}}_isTypeComparable(e,t){if((0,C.isAnyOrUnknown)(e)||(0,C.isAnyOrUnknown)(t))return!0;if((0,C.isNever)(e)||(0,C.isNever)(t))return!1;if((0,C.isModule)(e)||(0,C.isModule)(t))return!(0,C.isTypeSame)(e,t);if((0,C.isNone)(e)||(0,C.isNone)(t))return!(0,C.isTypeSame)(e,t);if((0,C.isInstantiableClass)(e)){if((0,C.isInstantiableClass)(t)){const n=C.ClassType.cloneForSpecialization(e,void 0,!1),i=C.ClassType.cloneForSpecialization(t,void 0,!1);if(this._evaluator.canAssignType(n,i)||this._evaluator.canAssignType(i,n))return!0}const n=e.details.effectiveMetaclass;return!!(n&&(0,C.isClass)(n)&&(0,S.lookUpClassMember)(n,"__eq__",4))}if((0,C.isClassInstance)(e)){if((0,C.isClassInstance)(t)){const n=C.ClassType.cloneForSpecialization(e,void 0,!1),i=C.ClassType.cloneForSpecialization(t,void 0,!1);if(this._evaluator.canAssignType(n,i)||this._evaluator.canAssignType(i,n))return!0}return!!(0,S.lookUpClassMember)(C.ClassType.cloneAsInstantiable(e),"__eq__",4)}return!0}_isTypeValidForUnusedValueTest(e){return!((0,C.isNone)(e)||(0,S.isNoReturnType)(e)||(0,C.isNever)(e)||(0,C.isAnyOrUnknown)(e))}_validateFunctionTypeVarUsage(e){if("none"===this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse)return;const t=new Map;let n=!0;const i=new f.NameNodeWalker(((i,s,r)=>{const a=this._evaluator.getType(i);if(a&&(0,C.isTypeVar)(a)&&a.scopeId===this._evaluator.getScopeIdForNode(e)){let e=a.details.constraints.length>0||n&&void 0!==a.details.boundType&&void 0!==s||(0,C.isParamSpec)(a);if(!e&&r&&void 0!==s){const t=this._evaluator.getType(r);(null==t?void 0:t.typeAliasInfo)&&t.typeAliasInfo.typeParameters&&s<t.typeAliasInfo.typeParameters.length&&(e=!0)}t.has(a.details.name)?t.get(a.details.name).nodes.push(i):t.set(a.details.name,{nodes:[i],isExempt:e})}}));e.parameters.forEach((e=>{const t=e.typeAnnotation||e.typeAnnotationComment;t&&i.walk(t)})),e.returnTypeAnnotation&&(n=!1,i.walk(e.returnTypeAnnotation)),t.forEach((e=>{1!==e.nodes.length||e.isExempt||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse,l.DiagnosticRule.reportInvalidTypeVarUse,d.Localizer.Diagnostic.typeVarUsedOnlyOnce().format({name:e.nodes[0].value}),e.nodes[0])}))}_validateOverloadConsistency(e,t,n){for(let i=0;i<n.length;i++){const s=n[i];if(C.FunctionType.isOverloaded(t)&&C.FunctionType.isOverloaded(s)&&this._isOverlappingOverload(t,s)){this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportOverlappingOverload,l.DiagnosticRule.reportOverlappingOverload,d.Localizer.Diagnostic.overlappingOverload().format({name:e.name.value,obscured:n.length+1,obscuredBy:i+1}),e.name);break}}for(let i=0;i<n.length;i++){const s=n[i];if(C.FunctionType.isOverloaded(t)&&C.FunctionType.isOverloaded(s)&&this._isOverlappingOverload(s,t)){const r=C.FunctionType.getSpecializedReturnType(s),a=C.FunctionType.getSpecializedReturnType(t);if(r&&a&&!this._evaluator.canAssignType(a,r,void 0,new F.TypeVarMap,8)){const t=this._findNodeForOverload(e,s);this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportOverlappingOverload,l.DiagnosticRule.reportOverlappingOverload,d.Localizer.Diagnostic.overloadReturnTypeMismatch().format({name:e.name.value,newIndex:n.length+1,prevIndex:i+1}),(t||e).name);break}}}}_findNodeForOverload(e,t){const n=this._evaluator.getDeclarationsForNameNode(e.name);if(n)for(const e of n)if(3===e.type){const n=this._evaluator.getTypeOfFunction(e.node);if((null==n?void 0:n.functionType)===t)return e.node}}_isOverlappingOverload(e,t){return(!C.FunctionType.isInstanceMethod(e)||"__get__"!==e.details.name)&&this._evaluator.canAssignType(e,t,void 0,void 0,56)}_isLegalOverloadImplementation(e,t,n){const i=new F.TypeVarMap((0,S.getTypeVarScopeId)(t));let s=this._evaluator.canAssignType(e,t,n,i,290);const r=e.details.declaredReturnType||this._evaluator.getFunctionInferredReturnType(e),a=(0,S.applySolvedTypeVars)(t.details.declaredReturnType||this._evaluator.getFunctionInferredReturnType(t),i),l=new o.DiagnosticAddendum;return this._evaluator.canAssignType(a,r,l.createAddendum(),i,8)||(l.addMessage(d.Localizer.DiagnosticAddendum.functionReturnTypeMismatch().format({sourceType:this._evaluator.printType(r,!1),destType:this._evaluator.printType(a,!1)})),n&&n.addAddendum(l),s=!1),s}_walkStatementsAndReportUnreachable(e){let t,n=!1;for(const i of e){if(!n&&!this._evaluator.isNodeReachable(i,t)){const t=i.start,s=e[e.length-1],r=p.TextRange.getEnd(s);this._evaluator.addUnusedCode(i,{start:t,length:r-t}),n=!0}!n&&this._fileInfo.isStubFile&&this._validateStubStatement(i),this.walk(i),t=i}}_validateStubStatement(e){switch(e.nodeType){case 19:case 28:case 10:case 0:break;case 57:case 26:case 53:case 58:this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement,l.DiagnosticRule.reportInvalidStubStatement,d.Localizer.Diagnostic.invalidStubStatement(),e);break;case 47:for(const t of e.statements)switch(t.nodeType){case 2:case 4:case 5:case 6:case 7:case 9:case 11:case 14:case 15:case 24:case 26:case 27:case 29:case 30:case 31:case 35:case 38:case 39:case 40:case 43:case 44:case 45:case 46:case 51:case 52:case 53:case 55:case 56:case 57:case 58:case 59:case 60:case 61:this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement,l.DiagnosticRule.reportInvalidStubStatement,d.Localizer.Diagnostic.invalidStubStatement(),t)}}}_validateExceptionType(e,t){const n=this._evaluator.getBuiltInType(t,"BaseException"),i=e=>!n||!(0,C.isInstantiableClass)(n)||(0,S.derivesFromClassRecursive)(e,n,!1),s=new o.DiagnosticAddendum;let r;if((0,C.isAnyOrUnknown)(e))r=e;else if((0,C.isInstantiableClass)(e))i(e)||s.addMessage(d.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),r=C.ClassType.cloneAsInstance(e);else if((0,C.isClassInstance)(e)){const n=this._evaluator.getTypeFromIterator(e,!1,t)||C.UnknownType.create();r=(0,S.mapSubtypes)(n,(t=>(0,C.isAnyOrUnknown)(t)?t:(0,C.isInstantiableClass)(t)?(i(t)||s.addMessage(d.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),C.ClassType.cloneAsInstance(t)):(s.addMessage(d.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),C.UnknownType.create())))}return s.isEmpty()||this._evaluator.addError(d.Localizer.Diagnostic.exceptionTypeNotClass().format({type:this._evaluator.printType(e,!1)}),t),r||C.UnknownType.create()}_reportUnusedDunderAllSymbols(e){if("none"===this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll)return;const t=h.getScope(this._moduleNode);t&&e.forEach((e=>{t.symbolTable.has(e.value)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,l.DiagnosticRule.reportUnsupportedDunderAll,d.Localizer.Diagnostic.dunderAllSymbolNotPresent().format({name:e.value}),e)}))}_validateSymbolTables(){for(const e of this._scopedNodes){const t=h.getScope(e);t&&t.symbolTable.forEach(((e,n)=>{this._conditionallyReportUnusedSymbol(n,e,t.type),this._reportIncompatibleDeclarations(n,e),this._reportMultipleFinalDeclarations(n,e,t.type),this._reportMultipleTypeAliasDeclarations(n,e),this._reportInvalidOverload(n,e)}))}}_reportInvalidOverload(e,t){const n=t.getTypedDeclarations();if(n.length>=1){const i=n[0];if(3===i.type){const n=this._evaluator.getEffectiveTypeOfSymbol(t),s=((0,C.isOverloadedFunction)(n)?n.overloads:(0,C.isFunction)(n)?[n]:[]).filter((e=>C.FunctionType.isOverloaded(e)));if(1===s.length&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.singleOverload().format({name:e}),i.node.name),s.forEach((t=>{if(t.details.declaration&&!f.isFunctionSuiteEmpty(t.details.declaration.node)){const n=new o.DiagnosticAddendum;n.addMessage(d.Localizer.DiagnosticAddendum.overloadWithImplementation()),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.overloadWithImplementation().format({name:e})+n.getString(),t.details.declaration.node.name)}})),!this._fileInfo.isStubFile&&s.length>0){let t;if((0,C.isOverloadedFunction)(n)&&!C.FunctionType.isOverloaded(n.overloads[n.overloads.length-1])?t=n.overloads[n.overloads.length-1]:(0,C.isFunction)(n)&&!C.FunctionType.isOverloaded(n)&&(t=n),t)(0,C.isOverloadedFunction)(n)&&n.overloads.forEach(((n,s)=>{if(n===t||!C.FunctionType.isOverloaded(n))return;const r=new o.DiagnosticAddendum;if(!this._isLegalOverloadImplementation(n,t,r)&&t.details.declaration){const a=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.overloadImplementationMismatch().format({name:e,index:s+1})+r.getString(),t.details.declaration.node.name);a&&n.details.declaration&&a.addRelatedInfo(d.Localizer.DiagnosticAddendum.overloadMethod(),i.path,i.range)}}));else{let e=!1;const t=f.getEnclosingClassOrFunction(i.node);if(t&&10===t.nodeType){const n=this._evaluator.getTypeOfClass(t);n&&C.ClassType.isProtocolClass(n.classType)&&(e=!0)}e||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.overloadWithoutImplementation().format({name:i.node.name.value}),i.node.name)}}}}}_reportMultipleFinalDeclarations(e,t,n){if(!(0,I.isFinalVariable)(t))return;const i=t.getDeclarations();let s=!1,r=!1;if(i.forEach((t=>{(0,y.isFinalVariableDeclaration)(t)&&(s&&this._evaluator.addError(d.Localizer.Diagnostic.finalRedeclaration().format({name:e}),t.node),s=!0),1===t.type&&t.inferredTypeSource&&(r&&2!==n&&this._evaluator.addError(d.Localizer.Diagnostic.finalReassigned().format({name:e}),t.node),r=!0)})),!r&&!this._fileInfo.isStubFile){const t=i.find((e=>1===e.type&&e.isFinal));t&&this._evaluator.addError(d.Localizer.Diagnostic.finalUnassigned().format({name:e}),t.node)}}_reportMultipleTypeAliasDeclarations(e,t){const n=t.getDeclarations(),i=n.find((e=>(0,y.isExplicitTypeAliasDeclaration)(e)));i&&n.length>1&&n.forEach((t=>{t!==i&&this._evaluator.addError(d.Localizer.Diagnostic.typeAliasRedeclared().format({name:e}),t.node)}))}_reportIncompatibleDeclarations(e,t){const n=(0,I.getLastTypedDeclaredForSymbol)(t);if(!n)return;if("_"===e)return;let i,s=t.getDeclarations().filter((e=>e!==n));if(3===n.type){const e=this._evaluator.getTypeOfFunction(n.node);s=s.filter((t=>{if(3!==t.type)return!0;const n=this._evaluator.getTypeOfFunction(t.node);return!n||(e&&(0,C.isClassInstance)(e.decoratedType)&&C.ClassType.isPropertyClass(e.decoratedType)&&(0,C.isClassInstance)(n.decoratedType)&&C.ClassType.isPropertyClass(n.decoratedType)?n.decoratedType.details.typeSourceId!==e.decoratedType.details.typeSourceId:!C.FunctionType.isOverloaded(n.functionType))}))}if(0===s.length)return;i=3===n.type?n.isMethod?d.Localizer.DiagnosticAddendum.seeMethodDeclaration():d.Localizer.DiagnosticAddendum.seeFunctionDeclaration():4===n.type?d.Localizer.DiagnosticAddendum.seeClassDeclaration():2===n.type?d.Localizer.DiagnosticAddendum.seeParameterDeclaration():1===n.type?d.Localizer.DiagnosticAddendum.seeVariableDeclaration():d.Localizer.DiagnosticAddendum.seeDeclaration();const r=e=>{if(e){let t;3===n.type||4===n.type?t=n.node.name:1===n.type?38===n.node.nodeType&&(t=n.node):2===n.type&&n.node.name&&(t=n.node.name),t&&e.addRelatedInfo(i,n.path,n.range)}};for(const t of s)if(4===t.type)r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.obscuredClassDeclaration().format({name:e}),t.node.name));else if(3===t.type){const i=this._evaluator.getTypeForDeclaration(n);i&&(0,C.isFunction)(i)&&this._evaluator.getFunctionInferredReturnType(i);let s=!1;const a=this._evaluator.getTypeForDeclaration(t),o=f.getEnclosingSuite(n.node)===f.getEnclosingSuite(t.node);a&&(0,C.isFunction)(a)&&this._evaluator.getFunctionInferredReturnType(a),i&&a&&(0,C.isTypeSame)(i,a)&&(s=!0),(!s||o)&&r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,t.isMethod?d.Localizer.Diagnostic.obscuredMethodDeclaration().format({name:e}):d.Localizer.Diagnostic.obscuredFunctionDeclaration().format({name:e}),t.node.name))}else if(2===t.type)t.node.name&&r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.obscuredParameterDeclaration().format({name:e}),t.node.name));else if(1===t.type){const i=this._evaluator.getTypeForDeclaration(n);if(t.typeAnnotationNode){if(38===t.node.nodeType){let n=!1;const s=this._evaluator.getTypeForDeclaration(t);i&&s&&(0,C.isTypeSame)(i,s)&&(n=!0),n||r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.obscuredVariableDeclaration().format({name:e}),t.node))}}else!i||(0,S.isProperty)(i)||3!==n.type&&4!==n.type||r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.obscuredVariableDeclaration().format({name:e}),t.node))}}_conditionallyReportUnusedSymbol(e,t,n){const i=this._fileInfo.accessedSymbolMap;t.isIgnoredForProtocolMatch()||i.has(t.id)||"_"!==e&&(b.isDunderName(e)||t.getDeclarations().forEach((t=>{this._conditionallyReportUnusedDeclaration(t,this._isSymbolPrivate(e,n))})))}_conditionallyReportUnusedDeclaration(e,t){let n,i,s,r;switch(e.type){case 6:if(n=this._fileInfo.diagnosticRuleSet.reportUnusedImport,r=l.DiagnosticRule.reportUnusedImport,21===e.node.nodeType)if(e.node.alias)this._fileInfo.isStubFile||(i=e.node.alias);else{const t=e.node.module.nameParts;if(t.length>0){const e=t.map((e=>e.value)).join("."),n={start:t[0].start,length:t[0].length};return p.TextRange.extend(n,t[t.length-1]),this._fileInfo.diagnosticSink.addUnusedCodeWithTextRange(d.Localizer.Diagnostic.unaccessedSymbol().format({name:e}),n,{action:"pyright.unusedImport"}),void this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportUnusedImport,l.DiagnosticRule.reportUnusedImport,d.Localizer.Diagnostic.unaccessedImport().format({name:e}),n)}}else if(23===e.node.nodeType){const t=e.node.parent,n=this._fileInfo.isStubFile&&void 0!==e.node.alias,s=1===t.module.nameParts.length&&"__future__"===t.module.nameParts[0].value;n||s||(i=e.node.alias||e.node.name)}i&&(s=d.Localizer.Diagnostic.unaccessedImport().format({name:i.value}));break;case 1:case 2:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedVariable,38===e.node.nodeType?(i=e.node,i.value.startsWith("_")&&(n="none")):41===e.node.nodeType&&(i=e.node.name,n="none"),i&&(r=l.DiagnosticRule.reportUnusedVariable,s=d.Localizer.Diagnostic.unaccessedVariable().format({name:i.value}));break;case 4:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedClass,i=e.node.name,r=l.DiagnosticRule.reportUnusedClass,s=d.Localizer.Diagnostic.unaccessedClass().format({name:i.value});break;case 3:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedFunction,i=e.node.name,r=l.DiagnosticRule.reportUnusedFunction,s=d.Localizer.Diagnostic.unaccessedFunction().format({name:i.value});break;default:return}if(i&&void 0!==r&&s){const e=r===l.DiagnosticRule.reportUnusedImport?{action:"pyright.unusedImport"}:void 0;this._fileInfo.diagnosticSink.addUnusedCodeWithTextRange(d.Localizer.Diagnostic.unaccessedSymbol().format({name:i.value}),i,e),this._evaluator.addDiagnostic(n,r,s,i)}}_validateIsInstanceCall(e){if(38!==e.leftExpression.nodeType||"isinstance"!==e.leftExpression.value&&"issubclass"!==e.leftExpression.value||2!==e.arguments.length)return;const t=e.leftExpression.value,n="isinstance"===t;let i=this._evaluator.getType(e.arguments[0].valueExpression);if(!i)return;i=(0,S.mapSubtypes)(i,(e=>(0,S.transformPossibleRecursiveTypeAlias)(e)));const s=this._evaluator.getType(e.arguments[1].valueExpression);if(!s)return;let r=!0;if((0,S.doForEachSubtype)(s,(e=>{(0,C.isClassInstance)(e)&&C.ClassType.isTupleClass(e)&&e.tupleTypeArguments?e.tupleTypeArguments.some((e=>!this._isTypeSupportedTypeForIsInstance(e,n)))&&(r=!1):this._isTypeSupportedTypeForIsInstance(e,n)||(r=!1)})),!r){const t=new o.DiagnosticAddendum;t.addMessage(d.Localizer.DiagnosticAddendum.typeVarNotAllowed()),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,n?d.Localizer.Diagnostic.isInstanceInvalidType().format({type:this._evaluator.printType(s,!1)})+t.getString():d.Localizer.Diagnostic.isSubclassInvalidType().format({type:this._evaluator.printType(s,!1)})+t.getString(),e.arguments[1])}let a=e;for(;a;){if(2===a.nodeType)return;a=a.parent}const c=["FunctionType","LambdaType","BuiltinFunctionType","BuiltinMethodType","type","Type"],p=[];if((0,S.doForEachSubtype)(s,(e=>{(0,C.isClass)(e)?C.TypeBase.isInstantiable(e)?(p.push(e),C.ClassType.isBuiltIn(e)&&c.some((t=>t===e.details.name))&&(r=!1)):((0,S.isTupleClass)(e)&&e.tupleTypeArguments&&e.tupleTypeArguments.forEach((e=>{(0,C.isInstantiableClass)(e)?p.push(e):r=!1})),C.ClassType.isBuiltIn(e)&&c.some((t=>t===e.details.name))&&(r=!1)):r=!1})),!r)return;if(p.some((e=>C.ClassType.isProtocolClass(e)&&!C.ClassType.isRuntimeCheckable(e)))&&this._evaluator.addError(d.Localizer.Diagnostic.protocolUsedInCall().format({name:t}),e.arguments[1].valueExpression),(0,S.derivesFromAnyOrUnknown)(i))return;const u=e=>(0,C.combineTypes)(e),m=e=>{const t=[];for(const i of p){const s=C.ClassType.isDerivedFrom(e,i)||n&&C.ClassType.isProtocolClass(i)&&this._evaluator.canAssignType(i,e)||C.ClassType.isBuiltIn(i,"dict")&&C.ClassType.isTypedDictClass(e),r=C.ClassType.isDerivedFrom(i,e)||n&&C.ClassType.isProtocolClass(e)&&this._evaluator.canAssignType(e,i);r&&r&&!C.ClassType.isSameGenericClass(e,i)?t.push(C.UnknownType.create()):s?t.push(e):r&&t.push(i)}return n?t.map((e=>(0,C.isInstantiableClass)(e)?C.ClassType.cloneAsInstance(e):e)):t};let h;if(n&&(0,C.isClassInstance)(i))h=u(m(C.ClassType.cloneAsInstantiable(i)));else if(!n&&(0,C.isInstantiableClass)(i))h=u(m(i));else{if(!(0,C.isUnion)(i))return;{let e=[],t=!1;if((0,S.doForEachSubtype)(i,(i=>{(0,C.isAnyOrUnknown)(i)&&(t=!0),n&&(0,C.isClassInstance)(i)?e=e.concat(m(C.ClassType.cloneAsInstantiable(i))):!n&&(0,C.isInstantiableClass)(i)&&(e=e.concat(m(i)))})),h=u(e),t)return}}const y=()=>{const e=p.map((e=>C.ClassType.cloneAsInstance(e)));return(0,C.combineTypes)(e)};(0,C.isTypeSame)(h,i,!0)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryIsInstance,l.DiagnosticRule.reportUnnecessaryIsInstance,n?d.Localizer.Diagnostic.unnecessaryIsInstanceAlways().format({testType:this._evaluator.printType(i,!1),classType:this._evaluator.printType(y(),!1)}):d.Localizer.Diagnostic.unnecessaryIsSubclassAlways().format({testType:this._evaluator.printType(i,!1),classType:this._evaluator.printType(y(),!1)}),e)}_isTypeSupportedTypeForIsInstance(e,t){let n=!0;return(0,S.doForEachSubtype)(e,(e=>{switch((e=this._evaluator.makeTopLevelTypeVarsConcrete(e)).category){case 2:case 1:case 0:break;case 7:e.isTypeArgumentExplicit&&!e.includeSubclasses&&(n=!1);break;case 3:n=!!t&&C.TypeBase.isInstantiable(e);break;case 5:n=C.TypeBase.isInstantiable(e);break;case 9:n=this._isTypeSupportedTypeForIsInstance(e,t);break;default:n=!1}})),n}_isSymbolPrivate(e,t){return 1===t||0===t||(!!b.isPrivateName(e)||!!b.isProtectedName(e)&&!(2===t))}_reportDeprecatedUse(e){var t;const n=null!==(t=D.get(e.value))&&void 0!==t?t:P.get(e.value);if(!n)return;const i=this._evaluator.getType(e);i&&(0,C.isInstantiableClass)(i)&&i.details.fullName===n.fullName&&this._fileInfo.executionEnvironment.pythonVersion>=n.version&&this._evaluator.addDeprecated(d.Localizer.Diagnostic.deprecatedType().format({version:(0,c.versionToString)(n.version),replacement:n.replacementText}),e)}_reportUnboundName(e){if("none"!==this._fileInfo.diagnosticRuleSet.reportUnboundVariable&&!h.isCodeUnreachable(e)){const t=this._evaluator.getType(e);t&&((0,C.isUnbound)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnboundVariable,l.DiagnosticRule.reportUnboundVariable,d.Localizer.Diagnostic.symbolIsUnbound().format({name:e.value}),e):(0,C.isPossiblyUnbound)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnboundVariable,l.DiagnosticRule.reportUnboundVariable,d.Localizer.Diagnostic.symbolIsPossiblyUnbound().format({name:e.value}),e))}}_conditionallyReportPrivateUsage(e){var t;if("none"===this._fileInfo.diagnosticRuleSet.reportPrivateUsage)return;if(this._fileInfo.isStubFile)return;if(1===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.name===e)return;const n=e.value,i=b.isPrivateName(n),s=b.isProtectedName(n);if(!i&&!s)return;const r=this._evaluator.getDeclarationsForNameNode(e);let a,o=r&&r.length>0?r[r.length-1]:void 0;if(!o||o.node===e)return;if(6===o.type){if(o.usesLocalName)return;const e=this._evaluator.resolveAliasDeclarationWithInfo(o,!0);if(!e)return;if(o=e.declaration,!e.isPrivate)return}if(!o||o.node===e)return;o.node&&(a=f.getEnclosingClass(o.node)),o.node&&o.node.parent&&o.node.parent===a&&(a=f.getEnclosingClass(a));let c=!1;if(a&&s){const t=this._evaluator.getTypeOfClass(a);if(t&&(0,C.isInstantiableClass)(t.decoratedType)){if(C.ClassType.isDefinedInStub(t.decoratedType))return;c=!0;const n=f.getEnclosingClass(e);if(n){const e=this._evaluator.getTypeOfClass(n);if(e&&(0,C.isInstantiableClass)(e.decoratedType)&&(0,S.derivesFromClassRecursive)(e.decoratedType,t.decoratedType,!0))return}}}a&&!f.isNodeContainedWithin(e,a)&&(c?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportPrivateUsage,l.DiagnosticRule.reportPrivateUsage,d.Localizer.Diagnostic.protectedUsedOutsideOfClass().format({name:n}),e):this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportPrivateUsage,l.DiagnosticRule.reportPrivateUsage,d.Localizer.Diagnostic.privateUsedOutsideOfClass().format({name:n}),e))}_validateEnumClassOverride(e,t){t.details.baseClasses.forEach(((t,n)=>{if((0,C.isClass)(t)&&C.ClassType.isEnumClass(t)){let i=!1;t.details.fields.forEach((e=>{const n=this._evaluator.getEffectiveTypeOfSymbol(e);(0,C.isClassInstance)(n)&&C.ClassType.isSameGenericClass(n,t)&&(i=!0)})),i&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.enumClassOverride().format({name:t.details.name}),e.arguments[n])}}))}_validateTypedDictClassSuite(e){const t=e=>{this._evaluator.addError(d.Localizer.Diagnostic.typedDictBadVar(),e)};e.statements.forEach((e=>{if(!h.isCodeUnreachable(e))if(47===e.nodeType)for(const n of e.statements)54!==n.nodeType&&18!==n.nodeType&&48!==n.nodeType&&42!==n.nodeType&&t(n);else t(e)}))}_validateDunderSignatures(e,t,n){var i;const s=t.details.name;if(n&&"__init__"===s){const n=e.returnTypeAnnotation||(null===(i=e.functionAnnotationComment)||void 0===i?void 0:i.returnTypeAnnotation),s=t.details.declaredReturnType;if(n&&s)(0,C.isNone)(s)||(0,S.isNoReturnType)(s)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.initMustReturnNone(),n);else{const n=this._evaluator.getFunctionInferredReturnType(t);(0,S.isNoReturnType)(n)||(0,C.isNone)(n)||(0,C.isAnyOrUnknown)(n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.initMustReturnNone(),e.name)}}}_validateFunctionReturn(e,t){var n;if(this._fileInfo.isStubFile)return;const i=e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation);if(i){const n=!this._evaluator.isAfterNodeReachable(e),s=this._evaluator.isAfterNodeReachable(e.suite);let r=t.details.declaredReturnType;if(r){(0,C.isUnknown)(r)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,d.Localizer.Diagnostic.declaredReturnTypeUnknown(),i):(0,S.isPartlyUnknown)(r)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,d.Localizer.Diagnostic.declaredReturnTypePartiallyUnknown().format({returnType:this._evaluator.printType(r,!0)}),i);const e=new o.DiagnosticAddendum;(0,C.isTypeVar)(r)&&2===r.details.variance&&(e.addMessage(d.Localizer.DiagnosticAddendum.typeVarIsContravariant().format({name:C.TypeVarType.getReadableName(r)})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.returnTypeContravariant()+e.getString(),i))}if(C.FunctionType.isGenerator(t)&&(r=(0,S.getDeclaredGeneratorReturnType)(t)),r&&!n&&s)if((0,S.isNoReturnType)(r))f.isSuiteEmpty(e.suite)||C.FunctionType.isOverloaded(t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.noReturnReturnsNone(),i);else if(!C.FunctionType.isAbstractMethod(t)){const n=new o.DiagnosticAddendum;this._evaluator.canAssignType(r,C.NoneType.createInstance(),n)||f.isSuiteEmpty(e.suite)||C.FunctionType.isOverloaded(t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.returnMissing().format({returnType:this._evaluator.printType(r,!1)})+n.getString(),i)}}else{const n=this._evaluator.getFunctionInferredReturnType(t);(0,C.isUnknown)(n)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,d.Localizer.Diagnostic.returnTypeUnknown(),e.name):(0,S.isPartlyUnknown)(n)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,d.Localizer.Diagnostic.returnTypePartiallyUnknown().format({returnType:this._evaluator.printType(n,!0)}),e.name)}}_validateFinalMemberOverrides(e){e.details.fields.forEach(((t,n)=>{const i=(0,S.lookUpClassMember)(e,n,1);if(i&&(0,C.isInstantiableClass)(i.classType)&&(0,I.isFinalVariable)(i.symbol)&&!b.isPrivateName(n)){const e=t.getDeclarations()[0];this._evaluator.addError(d.Localizer.Diagnostic.finalRedeclarationBySubclass().format({name:n,className:i.classType.details.name}),e.node)}}))}_reportDuplicateEnumMembers(e){C.ClassType.isEnumClass(e)&&!C.ClassType.isBuiltIn(e)&&e.details.fields.forEach(((e,t)=>{if(e.getTypedDeclarations().length>0)return;const n=e.getDeclarations();n.length>=2&&1===n[0].type&&this._evaluator.addError(d.Localizer.Diagnostic.duplicateEnumMember().format({name:t}),n[1].node)}))}_validateFinalClassNotAbstract(e,t){if(!C.ClassType.isFinal(e))return;if(!C.ClassType.supportsAbstractMethods(e))return;const n=this._evaluator.getAbstractMethods(e);if(0===n.length)return;const i=new o.DiagnosticAddendum;n.forEach(((e,t)=>{if(2===t)i.addMessage(d.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:n.length-2}));else if(t<2&&(0,C.isInstantiableClass)(e.classType)){const t=e.classType.details.name;i.addMessage(d.Localizer.DiagnosticAddendum.memberIsAbstract().format({type:t,name:e.symbolName}))}})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.finalClassIsAbstract().format({type:e.details.name})+i.getString(),t.name)}_validateInstanceVariableInitialization(e){"none"!==this._fileInfo.diagnosticRuleSet.reportUninitializedInstanceVariable&&e.details.fields.forEach(((t,n)=>{if(!t.isInstanceMember())return;const i=t.getDeclarations();i.find((e=>{const t=f.getEnclosingClassOrFunction(e.node);return!t||10===t.nodeType||"__init__"===t.name.value}))||(0,S.lookUpClassMember)(e,n,1)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUninitializedInstanceVariable,l.DiagnosticRule.reportUninitializedInstanceVariable,d.Localizer.Diagnostic.uninitializedInstanceVariable().format({name:n}),i[0].node)}))}_validateProtocolTypeParamVariance(e,t){const n=t.details.typeParameters.filter((e=>!(0,C.isParamSpec)(e)&&!(0,C.isVariadicTypeVar)(e)));if(0===n.length)return;const i=this._evaluator.getBuiltInType(e,"object");if(!(0,C.isInstantiableClass)(i))return;const s=n.map((e=>C.TypeVarType.cloneAsInvariant(e))),r=C.ClassType.cloneWithNewTypeParameters(t,s),a=C.ClassType.cloneAsInstance(i);s.forEach(((i,o)=>{const c=s.map(((e,t)=>t===o?a:C.AnyType.create())),p=s.map(((e,t)=>t===o?e:C.AnyType.create())),u=C.ClassType.cloneForSpecialization(r,c,!0),m=C.ClassType.cloneForSpecialization(r,p,!0);let h;if(h=this._evaluator.canAssignProtocolClassToSelf(u,m)?1:this._evaluator.canAssignProtocolClassToSelf(m,u)?2:0,h!==n[o].details.variance){let n;n=1===h?d.Localizer.Diagnostic.protocolVarianceCovariant().format({variable:i.details.name,class:t.details.name}):2===h?d.Localizer.Diagnostic.protocolVarianceContravariant().format({variable:i.details.name,class:t.details.name}):d.Localizer.Diagnostic.protocolVarianceInvariant().format({variable:i.details.name,class:t.details.name}),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse,l.DiagnosticRule.reportInvalidTypeVarUse,n,e.name)}}))}_validateSlotsClassVarConflict(e){e.details.localSlotsNames&&e.details.fields.forEach(((e,t)=>{const n=e.getDeclarations();n.some((e=>1===e.type&&e.isDefinedBySlots))&&n.forEach((e=>{1!==e.type||e.isDefinedBySlots||e.isDefinedByMemberAccess||38===e.node.nodeType&&f.isWriteAccess(e.node)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.slotsClassVarConflict().format({name:t}),e.node)}))}))}_validateBaseClassOverrides(e){e.details.fields.forEach(((t,n)=>{if(b.isPrivateName(n))return;if(!t.hasTypedDeclarations())return;const i=this._evaluator.getEffectiveTypeOfSymbol(t);if(!(0,C.isAnyOrUnknown)(i))for(const s of e.details.baseClasses){if(!(0,C.isClass)(s))continue;const r=e.details.mro.find((e=>(0,C.isClass)(e)&&C.ClassType.isSameGenericClass(e,s)));if(!r)continue;const a=(0,S.lookUpClassMember)(r,n,0);if(!a||!(0,C.isInstantiableClass)(a.classType))continue;if(!a.symbol.hasTypedDeclarations())continue;const c=(0,S.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(a.symbol),a.classType);if((0,C.isFunction)(c)||(0,C.isOverloadedFunction)(c)){const e=new o.DiagnosticAddendum;let s;if((0,C.isFunction)(i)?s=i:(0,C.isOverloadedFunction)(i)&&(s=i.overloads[i.overloads.length-1]),s){const i=["__init__","__new__","__init_subclass__"],r=!b.isDunderName(n);if(!i.some((e=>e===n))&&!b.isPrivateName(n)&&!this._evaluator.canOverrideMethod(c,s,e,r)){const t=s.details.declaration;if(t&&3===t.type){const i=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,d.Localizer.Diagnostic.incompatibleMethodOverride().format({name:n,className:a.classType.details.name})+e.getString(),t.node.name),s=(0,I.getLastTypedDeclaredForSymbol)(a.symbol);i&&s&&i.addRelatedInfo(d.Localizer.DiagnosticAddendum.overriddenMethod(),s.path,s.range)}}if((0,C.isFunction)(c)&&!b.isPrivateName(n)&&C.FunctionType.isFinal(c)){const e=(0,I.getLastTypedDeclaredForSymbol)(t);if(e&&3===e.type){const t=this._evaluator.addError(d.Localizer.Diagnostic.finalMethodOverride().format({name:n,className:a.classType.details.name}),e.node.name),i=(0,I.getLastTypedDeclaredForSymbol)(a.symbol);t&&i&&t.addRelatedInfo(d.Localizer.DiagnosticAddendum.finalMethod(),i.path,i.range)}}}else if(!(0,C.isAnyOrUnknown)(i)&&!C.ClassType.isBuiltIn(a.classType,"_TypedDict")){const e=t.getDeclarations();if(e.length>0){const t=e[e.length-1],s=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,d.Localizer.Diagnostic.methodOverridden().format({name:n,className:a.classType.details.name,type:this._evaluator.printType(i,!1)}),t.node),r=(0,I.getLastTypedDeclaredForSymbol)(a.symbol);s&&r&&s.addRelatedInfo(d.Localizer.DiagnosticAddendum.overriddenMethod(),r.path,r.range)}}}else if((0,S.isProperty)(c))if((0,S.isProperty)(i)){const s=c.details.fields,r=i.details.fields,p=a.classType;["fget","fset","fdel"].forEach((i=>{const a=new o.DiagnosticAddendum,c=s.get(i),u=r.get(i);if(c){const s=(0,S.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(c),p);if((0,C.isFunction)(s))if(u){const t=(0,S.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(u),e);if((0,C.isFunction)(t)&&!this._evaluator.canOverrideMethod(s,t,a.createAddendum())){a.addMessage(d.Localizer.DiagnosticAddendum.propertyMethodIncompatible().format({name:i}));const e=t.details.declaration;if(e&&3===e.type){const t=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,d.Localizer.Diagnostic.propertyOverridden().format({name:n,className:p.details.name})+a.getString(),e.node.name),i=s.details.declaration;t&&i&&t.addRelatedInfo(d.Localizer.DiagnosticAddendum.overriddenMethod(),i.path,i.range)}}}else{a.addMessage(d.Localizer.DiagnosticAddendum.propertyMethodMissing().format({name:i}));const e=t.getDeclarations();if(e.length>0){const t=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,d.Localizer.Diagnostic.propertyOverridden().format({name:n,className:p.details.name})+a.getString(),e[e.length-1].node),i=s.details.declaration;t&&i&&t.addRelatedInfo(d.Localizer.DiagnosticAddendum.overriddenMethod(),i.path,i.range)}}}}))}else{const e=t.getDeclarations();e.length>0&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,d.Localizer.Diagnostic.propertyOverridden().format({name:n,className:a.classType.details.name}),e[e.length-1].node)}else if("none"!==this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride){const e=t.getDeclarations();if(e.length>0){const s=e[e.length-1],r=new o.DiagnosticAddendum;if(!this._evaluator.canAssignType(c,i,r)){const e=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,d.Localizer.Diagnostic.symbolOverridden().format({name:n,className:a.classType.details.name})+r.getString(),s.node),t=(0,I.getLastTypedDeclaredForSymbol)(a.symbol);e&&t&&e.addRelatedInfo(d.Localizer.DiagnosticAddendum.overriddenSymbol(),t.path,t.range)}const p=a.symbol.isClassVar();let u=t.isClassVar();if(p&&!u&&(t.hasTypedDeclarations()||(u=!0)),p!==u){const e=t.isClassVar()?d.Localizer.Diagnostic.classVarOverridesInstanceVar():d.Localizer.Diagnostic.instanceVarOverridesClassVar(),i=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,e.format({name:n,className:a.classType.details.name}),s.node),r=(0,I.getLastTypedDeclaredForSymbol)(a.symbol);i&&r&&i.addRelatedInfo(d.Localizer.DiagnosticAddendum.overriddenSymbol(),r.path,r.range)}}}}}))}_validateMethod(e,t,n){const i=this._evaluator.getTypeOfClass(n),s=null==i?void 0:i.classType;if(e.name&&"__new__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&["cls","_cls","__cls","__mcls"].some((t=>e.parameters[0].name.value===t))||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,d.Localizer.Diagnostic.newClsParam(),e.parameters.length>0?e.parameters[0]:e.name),s&&this._validateClsSelfParameterType(t,s,!0);else if(e.name&&"__init_subclass__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&"cls"===e.parameters[0].name.value||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,d.Localizer.Diagnostic.initSubclassClsParam(),e.parameters.length>0?e.parameters[0]:e.name),s&&this._validateClsSelfParameterType(t,s,!0);else if(e.name&&"__class_getitem__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&"cls"===e.parameters[0].name.value||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,d.Localizer.Diagnostic.classGetItemClsParam(),e.parameters.length>0?e.parameters[0]:e.name),s&&this._validateClsSelfParameterType(t,s,!0);else if(C.FunctionType.isStaticMethod(t)){if(e.parameters.length>0&&e.parameters[0].name){const t=e.parameters[0].name.value;"self"!==t&&"cls"!==t||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,d.Localizer.Diagnostic.staticClsSelfParam(),e.parameters[0].name)}}else if(C.FunctionType.isClassMethod(t)){let n="";e.parameters.length>0&&e.parameters[0].name&&(n=e.parameters[0].name.value),"cls"!==n&&(this._fileInfo.isStubFile&&(n.startsWith("_")||"metacls"===n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,d.Localizer.Diagnostic.classMethodClsParam(),e.parameters.length>0?e.parameters[0]:e.name)),s&&this._validateClsSelfParameterType(t,s,!0)}else{if(0===e.decorators.length){let t="",i=!0;if(e.parameters.length>0&&(e.parameters[0].name&&(t=e.parameters[0].name.value),0!==e.parameters[0].category&&(i=!1)),i&&"self"!==t){let i=!1;if("cls"===t){const e=this._evaluator.getTypeOfClass(n),t=this._evaluator.getBuiltInType(n,"type");t&&(0,C.isInstantiableClass)(t)&&e&&(0,C.isInstantiableClass)(e.classType)&&(0,S.derivesFromClassRecursive)(e.classType,t,!0)&&(i=!0)}const s=b.isPrivateOrProtectedName(t);i||s||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,d.Localizer.Diagnostic.instanceMethodSelfParam(),e.parameters.length>0?e.parameters[0]:e.name)}}s&&this._validateClsSelfParameterType(t,s,!1)}}_validateClsSelfParameterType(e,t,n){if(e.details.parameters.length<1)return;const i=e.details.parameters[0];if(!i.typeAnnotation||!i.name)return;if(C.ClassType.isProtocolClass(t))return;const s=this._evaluator.makeTopLevelTypeVarsConcrete(i.type),r=n?t:(0,S.convertToInstance)(t);(0,C.isInstantiableClass)(s)&&C.ClassType.isProtocolClass(s)||(0,C.isClassInstance)(s)&&C.ClassType.isProtocolClass(s)||C.FunctionType.isOverloaded(e)||this._evaluator.canAssignType(s,r)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.clsSelfParamTypeMismatch().format({name:i.name,classType:this._evaluator.printType(r,!1)}),i.typeAnnotation)}_validateYieldType(e,t){let n,i;const s=f.getEnclosingFunction(e);if(s){const e=this._evaluator.getTypeOfFunction(s);e&&((0,a.assert)((0,C.isFunction)(e.functionType)),n=C.FunctionType.getSpecializedReturnType(e.functionType),n&&(i=(0,S.getGeneratorYieldType)(n,!!s.isAsync)),n&&!i&&s.returnTypeAnnotation&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,s.isAsync?d.Localizer.Diagnostic.generatorAsyncReturnType():d.Localizer.Diagnostic.generatorSyncReturnType(),s.returnTypeAnnotation))}if(this._evaluator.isNodeReachable(e,void 0))if(n&&(0,S.isNoReturnType)(n))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.noReturnContainsYield(),e);else if(i){const n=new o.DiagnosticAddendum;this._evaluator.canAssignType(i,t,n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.yieldTypeMismatch().format({exprType:this._evaluator.printType(t,!1),yieldType:this._evaluator.printType(i,!1)})+n.getString(),e.expression||e)}}_reportDuplicateImports(){const e=(0,g.getTopLevelImports)(this._moduleNode),t=new Map;e.orderedImports.forEach((e=>{if(22===e.node.nodeType){const t=new Map;e.node.imports.forEach((e=>{e.alias||(t.get(e.name.value)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportDuplicateImport,l.DiagnosticRule.reportDuplicateImport,d.Localizer.Diagnostic.duplicateImport().format({importName:e.name.value}),e.name):t.set(e.name.value,e))}))}else e.subnode&&!e.subnode.alias&&(t.get(e.moduleName)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportDuplicateImport,l.DiagnosticRule.reportDuplicateImport,d.Localizer.Diagnostic.duplicateImport().format({importName:e.moduleName}),e.subnode):t.set(e.moduleName,e.subnode))}))}}t.Checker=x},2835:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CircularDependency=void 0,t.CircularDependency=class{constructor(){this._paths=[]}appendPath(e){this._paths.push(e)}getPaths(){return this._paths}normalizeOrder(){let e=0;this._paths.forEach(((t,n)=>{t<this._paths[e]&&(e=n)})),0!==e&&(this._paths=this._paths.slice(e).concat(this._paths.slice(0,e)))}isEqual(e){if(e._paths.length!==this._paths.length)return!1;for(let t=0;t<this._paths.length;t++)if(this._paths[t]!==e._paths[t])return!1;return!0}}},4184:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCodeFlowEngine=void 0;const i=n(5839),s=n(563),r=n(4972),a=n(8494),o=n(3090),l=n(4610),c=n(1133),p=n(5168);t.getCodeFlowEngine=function(e,t){const n=new Map,d=new Map,u=new Map;let m=0,h=1;function y(e,t){const s=new Set;if(n.has(e.id))return!0;n.set(e.id,!0);try{return function e(t,n){let a=t;for(;;){if(s.has(a.id))return!1;if(s.add(a.id),a.flags&r.FlowFlags.Unreachable)return!1;if(a===n)return!0;if(a.flags&(r.FlowFlags.VariableAnnotation|r.FlowFlags.Assignment|r.FlowFlags.AssignmentAlias|r.FlowFlags.TrueCondition|r.FlowFlags.FalseCondition|r.FlowFlags.WildcardImport|r.FlowFlags.TrueNeverCondition|r.FlowFlags.FalseNeverCondition|r.FlowFlags.NarrowForPattern|r.FlowFlags.ExhaustedMatch))a=a.antecedent;else{if(!(a.flags&r.FlowFlags.Call)){if(a.flags&(r.FlowFlags.BranchLabel|r.FlowFlags.LoopLabel)){if(a.flags&r.FlowFlags.PostContextManager){const e=a;if(!e.expressions.some((t=>f(t,e.isAsync))))return!1}const t=a;for(const i of t.antecedents)if(e(i,n))return!0;return!1}if(a.flags&r.FlowFlags.Start)return!n;if(a.flags&r.FlowFlags.PreFinallyGate)return!a.isGateClosed;if(a.flags&r.FlowFlags.PostFinally){const t=a,i=t.preFinallyGate.isGateClosed;try{return t.preFinallyGate.isGateClosed=!0,e(t.antecedent,n)}finally{t.preFinallyGate.isGateClosed=i}}return(0,i.fail)("Unexpected flow node flags"),!1}{const e=a;if(g(e.node))return!1;a=e.antecedent}}}}(e,t)}finally{n.delete(e.id)}}function g(t){if(d.has(t.id))return d.get(t.id);d.set(t.id,!1);let n=0,i=0;const s=_(t.leftExpression);s&&(0,p.doForEachSubtype)(s,(t=>{let s;if(i++,(0,c.isFunction)(t))s=t;else if((0,c.isOverloadedFunction)(t)){const e=t;s=e.overloads[e.overloads.length-1]}if(s){const t=s.details.declaredReturnType;if(c.FunctionType.isAsync(s))t&&(0,c.isClassInstance)(t)&&c.ClassType.isBuiltIn(t,"Coroutine")&&t.typeArguments&&t.typeArguments.length>=3&&(0,p.isNoReturnType)(t.typeArguments[2])&&n++;else if(t)(0,p.isNoReturnType)(t)&&n++;else if(s.details.declaration&&!(s.details.declaration.yieldStatements||c.FunctionType.isAbstractMethod(s)||c.FunctionType.isStubDefinition(s)||c.FunctionType.isPyTypedDefinition(s))){const t=s.details.declaration.node.suite.statements;let i=!1;for(const e of t){if(47!==e.nodeType||1!==e.statements.length)break;const t=e.statements[0];if(48!==t.nodeType){if(43===t.nodeType&&t.typeExpression){const e=e=>38===(null==e?void 0:e.nodeType)&&"NotImplementedError"===e.value;(e(t.typeExpression)||9===t.typeExpression.nodeType&&e(t.typeExpression.leftExpression))&&(i=!0)}break}}i||e.isAfterNodeReachable(s.details.declaration.node)||n++}}}));const r=i>0&&n===i;return d.set(t.id,r),r}function f(t,n){var i;if(u.has(t.id))return u.get(t.id);u.set(t.id,!1);let s,r=!1;if(9===t.nodeType){const e=_(t.leftExpression);e&&(0,c.isInstantiableClass)(e)?s=(0,p.convertToInstance)(e):e&&(0,c.isFunction)(e)&&(s=e.details.declaredReturnType)}else 38===t.nodeType&&(s=e.getDeclaredTypeForExpression(t));if(s&&(0,c.isClassInstance)(s)){const a=n?"__aexit__":"__exit__",o=null===(i=e.getTypeFromObjectMember(t,s,a))||void 0===i?void 0:i.type;if(o&&(0,c.isFunction)(o)&&o.details.declaredReturnType){const e=o.details.declaredReturnType;r=(0,c.isClassInstance)(e)&&c.ClassType.isBuiltIn(e,"bool")}}return u.set(t.id,r),r}function T(t,n){const r=(0,s.getImportInfo)(t.node.module);(0,i.assert)(void 0!==r&&r.isImportFound),(0,i.assert)(t.node.isWildcardImport);const a=e.lookUpSymbolRecursive(t.node,n,!1);(0,i.assert)(void 0!==a);const o=a.symbol.getDeclarations().find((e=>e.node===t.node));return o&&e.getInferredTypeOfDeclaration(o)||c.UnknownType.create()}function _(t){var n;if(38===t.nodeType){const i=e.lookUpSymbolRecursive(t,t.value,!1);if(!i)return;const s=i.symbol,r=e.getDeclaredTypeOfSymbol(s);if(r)return r;const a=s.getDeclarations();if(0===a.length)return;const o=a[a.length-1];return 2===o.type?null===(n=e.evaluateTypeForSubnode(o.node.name,(()=>{e.evaluateTypeOfParameter(o.node)})))||void 0===n?void 0:n.type:6===o.type||i.isBeyondExecutionScope?e.getInferredTypeOfDeclaration(o):void 0}if(35===t.nodeType){const n=t.memberName.value;let i=_(t.leftExpression);if(!i)return;i=e.makeTopLevelTypeVarsConcrete(i);const s=(0,p.mapSubtypes)(i,(t=>{let i;if((0,c.isModule)(t))i=c.ModuleType.getField(t,n);else if((0,c.isInstantiableClass)(t)){const e=(0,p.lookUpClassMember)(t,n);i=e?e.symbol:void 0}else if((0,c.isClassInstance)(t)){const e=(0,p.lookUpClassMember)(t,n);i=e?e.symbol:void 0}return i?e.getDeclaredTypeOfSymbol(i):void 0}));if(!(0,c.isNever)(s))return s}if(9===t.nodeType){const e=_(t.leftExpression);if(!e)return;if(e&&(0,c.isInstantiableClass)(e))return(0,p.convertToInstance)(e);if((0,c.isFunction)(e))return e.details.declaredReturnType}}return{createCodeFlowAnalyzer:function(){const n=new Map;return{getTypeFromCodeFlow:function(s,d,u,_,v){const b=void 0!==d?(0,r.createKeyForReference)(d):void 0;let I;const C=void 0!==b&&void 0!==u?b+`.${u.toString()}`:".";let S=n.get(C);function F(e,n,i,s){if(s){const t=S.get(e.id);if(void 0===t)h++;else if(n&&t.isIncompleteType){const e=t;e.type&&!(0,c.isTypeSame)(e.type,n)&&h++}}else h++;const r=s?{isIncompleteType:!0,type:n,incompleteSubtypes:[],generationCount:h}:n;return S.set(e.id,r),t.trackEntry(S,e.id),{type:n,usedOuterScopeAlias:i,isIncomplete:s,generationCount:h,incompleteSubtypes:s?[]:void 0}}function D(e,t,n,s,r,a){const l=S.get(e.id);void 0!==l&&(0,o.isIncompleteType)(l)||(0,i.fail)("setIncompleteSubtype can be called only on a valid incomplete cache entry");const p=l.incompleteSubtypes;if(t<p.length){const e=p[t];e.isIncomplete===s&&void 0!==e.type&&void 0!==n&&(0,c.isTypeSame)(e.type,n)?e.isPending!==r&&(p[t]={type:n,isIncomplete:s,isPending:r}):(p[t]={type:n,isIncomplete:s,isPending:r},h++)}else(0,i.assert)(p.length===t),p.push({type:n,isIncomplete:s,isPending:r}),h++;return x(e,a)}function P(e){var t;const n=S.get(e.id);return void 0!==n&&(0,o.isIncompleteType)(n)||(0,i.fail)("incrementFlowNodeVisitCount can be called only on a valid incomplete cache entry"),n.recursiveVisitCount=(null!==(t=n.recursiveVisitCount)&&void 0!==t?t:0)+1,n.recursiveVisitCount}function x(e,t){if(!S.has(e.id))return;const n=S.get(e.id);if(void 0===n)return{type:n,usedOuterScopeAlias:t,isIncomplete:!1};if(!(0,o.isIncompleteType)(n))return{type:n,usedOuterScopeAlias:t,isIncomplete:!1};let i=n.type;if(n.incompleteSubtypes.length>0){const e=[];n.incompleteSubtypes.forEach((t=>{t.type&&e.push(t.type)})),i=e.length>0?(0,c.combineTypes)(e):void 0}return{type:i,usedOuterScopeAlias:t,isIncomplete:!0,incompleteSubtypes:n.incompleteSubtypes,generationCount:n.generationCount}}function A(t){let n=t.node;const i=t.node.parent;return i&&(28!==i.nodeType&&10!==i.nodeType||(n=i)),e.evaluateTypeForSubnode(n,(()=>{e.evaluateTypesForStatement(t.node)}))}return S||(S=new Map,n.set(C,S)),s?function t(n,s,o,d,u){let _=n,v=!1;const b=m;for(m++,e.checkForCancellation();;){const n=x(_,v);if(n){if(!n.isIncomplete)return n;if(n.generationCount===h)return{type:(null==n?void 0:n.type)?(0,c.removeUnknownFromUnion)(n.type):void 0,usedOuterScopeAlias:v,isIncomplete:!0}}if(_.flags&r.FlowFlags.Unreachable)return F(_,void 0,v,!1);if(_.flags&r.FlowFlags.VariableAnnotation)_=_.antecedent;else if(_.flags&r.FlowFlags.Call){const e=_;if(g(e.node))return F(_,void 0,v,!1);_=e.antecedent}else if(_.flags&r.FlowFlags.Assignment){const e=_;if(s){if(o===e.targetSymbolId&&(0,a.isMatchingExpression)(s,e.node)){if(_.flags&r.FlowFlags.Unbind)return F(_,c.UnboundType.create(),v,!1);if(n&&void 0===n.type)return{type:void 0,usedOuterScopeAlias:v,isIncomplete:!0};F(_,s?void 0:d,v,!0);let t=A(e);return t&&(0,p.isTypeAliasPlaceholder)(t.type)&&(t=void 0),F(_,null==t?void 0:t.type,v,!!(null==t?void 0:t.isIncomplete))}if((0,a.isPartialMatchingExpression)(s,e.node))return{type:d,usedOuterScopeAlias:v,isIncomplete:u}}_=e.antecedent}else if(_.flags&r.FlowFlags.AssignmentAlias){const e=_;o===e.targetSymbolId&&(o=e.aliasSymbolId,v=!0),_=e.antecedent}else{if(_.flags&r.FlowFlags.BranchLabel){const e=_;if(_.flags&r.FlowFlags.PostContextManager){const e=_;if(!e.expressions.some((t=>f(t,e.isAsync))))return F(_,void 0,v,!1)}if(s&&e.preBranchAntecedent&&e.affectedExpressions&&(I||(I=(0,r.createKeysForReferenceSubexpressions)(s)),!I.some((t=>e.affectedExpressions.has(t)))&&y(_,e.preBranchAntecedent))){_=e.preBranchAntecedent;continue}const n=_,i=[];let a=v,l=!1;F(_,s?void 0:d,v,!0),n.antecedents.forEach((e=>{const n=t(e,s,o,d,u);n.isIncomplete&&(l=!0),n.usedOuterScopeAlias&&(a=!0),n.type&&i.push(n.type)}));const p=s||i.length>0?(0,c.combineTypes)(i):void 0;return m-b>16384&&(l=!1),F(_,p,a,l)}if(_.flags&r.FlowFlags.LoopLabel){const e=_;if(s&&(I||(I=(0,r.createKeysForReferenceSubexpressions)(s)),!I.some((t=>e.affectedExpressions.has(t))))){_=e.antecedents[0];continue}let n,i=!1,a=v,l=x(_,v);void 0===l?l=F(_,s?void 0:d,v,!0):n=l.type;const p=void 0!==l.incompleteSubtypes&&l.incompleteSubtypes.some((e=>e.isPending)),h=P(_);if(e.antecedents.forEach(((e,n)=>{var r;l=x(_,v);const c=void 0!==l.incompleteSubtypes&&n<l.incompleteSubtypes.length?l.incompleteSubtypes[n]:void 0;if(void 0===c||!(null==c?void 0:c.isPending)&&(null==c?void 0:c.isIncomplete)){l=D(_,n,null!==(r=null==c?void 0:c.type)&&void 0!==r?r:s?void 0:d,!0,!0,v);try{const r=t(e,s,o,d,u);r.isIncomplete&&(i=!0),r.usedOuterScopeAlias&&(a=!0),l=D(_,n,r.type,r.isIncomplete,!1,a)}catch(e){throw D(_,n,void 0,!0,!1,v),e}}})),p){let e=h>=64?l.incompleteSubtypes[0].isIncomplete:void 0!==s;return m-b>16384&&(e=!1),{type:l.type,usedOuterScopeAlias:v,isIncomplete:e}}return i&&h>1&&n&&l.type&&(0,c.isTypeSame)(n,l.type)&&(i=!1),i?{type:(null==l?void 0:l.type)?(0,c.removeUnknownFromUnion)(l.type):void 0,usedOuterScopeAlias:a,isIncomplete:!0}:F(_,l.type,a,!1)}if(_.flags&(r.FlowFlags.TrueCondition|r.FlowFlags.FalseCondition)){const n=_;if(s){const i=(0,l.getTypeNarrowingCallback)(e,s,n);if(i){F(_,s?void 0:d,v,!0);const e=t(n.antecedent,s,o,d,u);let r=e.type;return r&&(r=i(r)),F(_,r,e.usedOuterScopeAlias,e.isIncomplete)}}_=n.antecedent}else if(_.flags&(r.FlowFlags.TrueNeverCondition|r.FlowFlags.FalseNeverCondition)){const t=_;if(t.reference){const n=e.lookUpSymbolRecursive(t.reference,t.reference.value,!1);if(n&&n.symbol.getTypedDeclarations().length>0){const n=(0,l.getTypeNarrowingCallback)(e,t.reference,t);if(n){const i=e.getTypeOfExpression(t.reference),s=n(i.type)||i.type;if((0,c.isNever)(s))return F(_,void 0,v,!!i.isIncomplete)}}}_=t.antecedent}else if(_.flags&r.FlowFlags.ExhaustedMatch){const t=_,n=e.evaluateTypeForSubnode(t.node,(()=>{e.evaluateTypesForMatchNode(t.node)}));if(n&&(0,c.isNever)(n.type))return F(_,void 0,v,!!n.isIncomplete);_=t.antecedent}else if(_.flags&r.FlowFlags.NarrowForPattern){const t=_;if(!s||(0,a.isMatchingExpression)(s,t.subjectExpression)){const n=e.evaluateTypeForSubnode(t.statement,(()=>{64===t.statement.nodeType?e.evaluateTypesForCaseNode(t.statement):e.evaluateTypesForMatchNode(t.statement)}));if(n){if(s)return F(_,n.type,v,!!n.isIncomplete);if((0,c.isNever)(n.type))return F(_,void 0,v,!!n.isIncomplete)}}_=t.antecedent}else if(_.flags&r.FlowFlags.PreFinallyGate){const e=_;if(e.isGateClosed)return{type:void 0,usedOuterScopeAlias:v,isIncomplete:!1};_=e.antecedent}else{if(_.flags&r.FlowFlags.PostFinally){const n=_,i=n.preFinallyGate.isGateClosed;try{let r;return n.preFinallyGate.isGateClosed=!0,e.useSpeculativeMode(n.finallyNode,(()=>{r=t(n.antecedent,s,o,d,u)})),r.isIncomplete?r:F(_,r.type,r.usedOuterScopeAlias,!1)}finally{n.preFinallyGate.isGateClosed=i}}if(_.flags&r.FlowFlags.Start)return F(_,d,v,u);if(!(_.flags&r.FlowFlags.WildcardImport))return(0,i.fail)("Unexpected flow node flags"),F(_,void 0,v,!1);{const e=_;if(s&&38===s.nodeType){const t=s.value;if(e.names.some((e=>e===t))){const n=T(e,t);return F(_,n,v,!1)}}_=e.antecedent}}}}}(s,d,u,_,v):{type:_,usedOuterScopeAlias:!1,isIncomplete:v}}}},isFlowNodeReachable:y}}},4972:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createKeysForReferenceSubexpressions=t.createKeyForReference=t.isCodeFlowSupportedForReference=t.getUniqueFlowNodeId=t.FlowFlags=void 0;const i=n(5839);var s;(s=t.FlowFlags||(t.FlowFlags={}))[s.Unreachable=1]="Unreachable",s[s.Start=2]="Start",s[s.BranchLabel=4]="BranchLabel",s[s.LoopLabel=8]="LoopLabel",s[s.Assignment=16]="Assignment",s[s.Unbind=32]="Unbind",s[s.WildcardImport=64]="WildcardImport",s[s.TrueCondition=128]="TrueCondition",s[s.FalseCondition=512]="FalseCondition",s[s.Call=1024]="Call",s[s.PreFinallyGate=2048]="PreFinallyGate",s[s.PostFinally=4096]="PostFinally",s[s.AssignmentAlias=8192]="AssignmentAlias",s[s.VariableAnnotation=16384]="VariableAnnotation",s[s.PostContextManager=32768]="PostContextManager",s[s.TrueNeverCondition=65536]="TrueNeverCondition",s[s.FalseNeverCondition=131072]="FalseNeverCondition",s[s.NarrowForPattern=262144]="NarrowForPattern",s[s.ExhaustedMatch=524288]="ExhaustedMatch";let r=1;function a(e){let t;if(38===e.nodeType)t=e.value;else if(35===e.nodeType)t=`${a(e.leftExpression)}.${e.memberName.value}`;else if(24===e.nodeType){const n=a(e.baseExpression);if((0,i.assert)(1===e.items.length),40===e.items[0].valueExpression.nodeType)t=`${n}[${e.items[0].valueExpression.value.toString()}]`;else if(48===e.items[0].valueExpression.nodeType){const s=e.items[0].valueExpression;(0,i.assert)(1===s.strings.length&&49===s.strings[0].nodeType),t=`${n}["${s.strings[0].value}"]`}else(0,i.fail)("createKeyForReference received unexpected index type")}else(0,i.fail)("createKeyForReference received unexpected expression type");return t}t.getUniqueFlowNodeId=function(){return r++},t.isCodeFlowSupportedForReference=function e(t){if(38===t.nodeType)return!0;if(35===t.nodeType)return e(t.leftExpression);if(24===t.nodeType){if(1!==t.items.length||t.trailingComma||void 0!==t.items[0].name||0!==t.items[0].argumentCategory)return!1;const n=t.items[0].valueExpression,i=40===n.nodeType&&!n.isImaginary&&n.isInteger,s=48===n.nodeType&&1===n.strings.length&&49===n.strings[0].nodeType;return!(!i&&!s)&&e(t.baseExpression)}return!1},t.createKeyForReference=a,t.createKeysForReferenceSubexpressions=function e(t){return 38===t.nodeType?[a(t)]:35===t.nodeType?[...e(t.leftExpression),a(t)]:24===t.nodeType?[...e(t.baseExpression),a(t)]:void(0,i.fail)("createKeyForReference received unexpected expression type")}},2272:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFileLevelDirectives=void 0;const i=n(2930);function s(e){const t=(0,i.getStrictDiagnosticRuleSet)(),n=(0,i.getBooleanDiagnosticRules)(),s=(0,i.getDiagLevelDiagnosticRules)(),r=(0,i.getStrictModeNotOverriddenRules)();for(const i of n)r.find((e=>e===i))||t[i]&&(e[i]=!0);for(const n of s){if(r.find((e=>e===n)))continue;const i=t[n],s=e[n];("error"===i||"warning"===i&&"error"!==s||"information"===i&&"error"!==s&&"warning"!==s)&&(e[n]=i)}}function r(e,t){const n=["pyright:","mspython:"].find((t=>e.startsWith(t)));if(n){const i=e.substr(n.length).trim().split(",").map((e=>e.trim()));i.some((e=>"strict"===e))&&s(t);for(const e of i)t=a(e,t)}return t}function a(e,t){const n=e.split("=").map((e=>e.trim()));if(2!==n.length)return t;const s=n[0],r=(0,i.getBooleanDiagnosticRules)();if((0,i.getDiagLevelDiagnosticRules)().find((e=>e===s))){const e=function(e){switch(e){case"false":case"none":return"none";case"true":case"error":return"error";case"warning":return"warning";case"information":return"information";default:return}}(n[1]);void 0!==e&&(t[s]=e)}else if(r.find((e=>e===s))){const e="false"!==(a=n[1])&&("true"===a||void 0);void 0!==e&&(t[s]=e)}var a;return t}t.getFileLevelDirectives=function(e,t,n){let a=(0,i.cloneDiagnosticRuleSet)(t);n&&s(a);for(let t=0;t<e.count;t++){const n=e.getItemAt(t);if(n.comments)for(const e of n.comments)a=r(e.value.trim(),a)}return a}},6168:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.applyDataClassDecorator=t.applyDataClassDefaultBehaviors=t.applyDataClassMetaclassBehaviorOverrides=t.getDataclassDecoratorBehaviors=t.validateDataClassTransformDecorator=t.synthesizeDataClassMethods=void 0;const a=n(5839),o=n(9744),l=n(2122),c=r(n(563)),p=n(118),d=n(8235),u=n(817),m=n(1133),h=n(5168);function y(e,t,n,i,s){const r=c.getFileInfo(t),a=(0,d.evaluateStaticBoolExpression)(s,r.executionEnvironment);switch(i){case"order":!0===a?n.details.flags|=64:!1===a&&(n.details.flags&=-65);break;case"kw_only":!1===a?n.details.flags&=-2097153:!0===a&&(n.details.flags|=2097152);break;case"frozen":{let i=!1,s=!1;n.details.baseClasses.forEach((e=>{(0,m.isInstantiableClass)(e)&&m.ClassType.isDataClass(e)&&(m.ClassType.isFrozenDataClass(e)?s=!0:e.details.declaredMetaclass&&(0,m.isInstantiableClass)(e.details.declaredMetaclass)&&e.details.declaredMetaclass.details.metaclassDataClassTransform||(i=!0))})),(!0===a||s)&&(n.details.flags|=8,i&&e.addDiagnostic(r.diagnosticRuleSet.reportGeneralTypeIssues,o.DiagnosticRule.reportGeneralTypeIssues,l.Localizer.Diagnostic.dataClassBaseClassNotFrozen(),t));break}case"init":!1===a?n.details.flags|=16:!0===a&&(n.details.flags&=-17);break;case"eq":!1===a?n.details.flags|=32:!0===a&&(n.details.flags&=-33);break;case"slots":!0===a?(n.details.flags|=33554432,n.details.localSlotsNames&&e.addDiagnostic(r.diagnosticRuleSet.reportGeneralTypeIssues,o.DiagnosticRule.reportGeneralTypeIssues,l.Localizer.Diagnostic.dataClassSlotsOverwrite(),t)):!1===a&&(n.details.flags&=-33554433);break;case"hash":case"unsafe_hash":!0===a&&(n.details.flags|=67108864)}}function g(e,t){e.details.dataClassBehaviors=t,e.details.flags|=4,t.keywordOnlyParams&&(e.details.flags|=2097152),t.generateEq||(e.details.flags|=32),t.generateOrder&&(e.details.flags|=64)}t.synthesizeDataClassMethods=function(e,t,n,i,s){(0,a.assert)(m.ClassType.isDataClass(n));const r=(0,h.synthesizeTypeVarForSelfCls)(n,!0),o=m.FunctionType.createInstance("__new__","","",65),y=m.FunctionType.createInstance("__init__","","",64);m.FunctionType.addParameter(o,{category:0,name:"cls",type:r,hasDeclaredType:!0}),m.FunctionType.addDefaultParameters(o),o.details.declaredReturnType=(0,h.convertToInstance)(r);const g={category:0,name:"self",type:(0,h.synthesizeTypeVarForSelfCls)(n,!1),hasDeclaredType:!0};m.FunctionType.addParameter(y,g),y.details.declaredReturnType=m.NoneType.createInstance();const f=[],T=[],_=function(e,t){let n=!0;for(let i=e.details.mro.length-1;i>=0;i--){const s=e.details.mro[i];if((0,m.isInstantiableClass)(s)){const e=(0,h.buildTypeVarMapFromSpecializedClass)(s,!1);m.ClassType.getDataClassEntries(s).forEach((n=>{const i=t.findIndex((e=>e.name===n.name)),s={...n};s.type=(0,h.applySolvedTypeVars)(s.type,e),n.isClassVar?i>=0&&t.splice(i,1):i>=0?t[i]=s:t.push(s)}))}else n=!1}return n}(n,T);_||m.FunctionType.addDefaultParameters(y);const v=[];let b=!1;t.suite.statements.forEach((s=>{47===s.nodeType&&s.statements.forEach((s=>{var r;let a,o,p,u,y=!1,g=m.ClassType.isDataClassKeywordOnlyParams(n)||b,_=!0;if(3===s.nodeType){if(54===s.leftExpression.nodeType&&38===s.leftExpression.valueExpression.nodeType&&(a=s.leftExpression.valueExpression,p=()=>e.getTypeOfAnnotation(s.leftExpression.typeAnnotation,{isVariableAnnotation:!0,allowFinal:!0,allowClassVar:!0})),y=!0,u=s.rightExpression,9===s.rightExpression.nodeType){const i=e.getTypeOfExpression(s.rightExpression.leftExpression).type;if(function(e,t){let n;return(0,m.isFunction)(e)?n=e.details.fullName:(0,m.isOverloadedFunction)(e)?n=e.overloads[0].details.fullName:(0,m.isInstantiableClass)(e)&&(n=e.details.fullName),!!n&&t.some((e=>e===n))}(i,(null===(r=n.details.dataClassBehaviors)||void 0===r?void 0:r.fieldDescriptorNames)||[])){const n=s.rightExpression.arguments.find((e=>{var t;return"init"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(n&&n.valueExpression)!1===(0,d.evaluateStaticBoolExpression)(n.valueExpression,c.getFileInfo(t).executionEnvironment)&&(_=!1);else{let t;if((0,m.isFunction)(i))t=i;else if((0,m.isOverloadedFunction)(i))t=e.getBestOverloadForArguments(s.rightExpression,i,s.rightExpression.arguments);else if((0,m.isInstantiableClass)(i)){const n=e.getBoundMethod(i,"__init__");n&&((0,m.isFunction)(n)?t=n:(0,m.isOverloadedFunction)(n)&&(t=e.getBestOverloadForArguments(s.rightExpression,n,s.rightExpression.arguments)))}if(t){const e=t.details.parameters.find((e=>"init"===e.name));e&&e.defaultValueExpression&&e.hasDeclaredType&&(0,m.isClass)(e.type)&&m.ClassType.isBuiltIn(e.type,"bool")&&(0,h.isLiteralType)(e.type)&&!1===e.type.literalValue&&(_=!1)}}const r=s.rightExpression.arguments.find((e=>{var t;return"kw_only"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(r&&r.valueExpression){const e=(0,d.evaluateStaticBoolExpression)(r.valueExpression,c.getFileInfo(t).executionEnvironment);!1===e?g=!1:!0===e&&(g=!0)}y=s.rightExpression.arguments.some((e=>{var t,n,i;return"default"===(null===(t=e.name)||void 0===t?void 0:t.value)||"default_factory"===(null===(n=e.name)||void 0===n?void 0:n.value)||"factory"===(null===(i=e.name)||void 0===i?void 0:i.value)}));const a=s.rightExpression.arguments.find((e=>{var t;return"alias"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(a){const t=e.getTypeOfExpression(a.valueExpression).type;(0,m.isClassInstance)(t)&&m.ClassType.isBuiltIn(t,"str")&&(0,h.isLiteralType)(t)&&(o=t.literalValue)}}}}else if(54===s.nodeType&&38===s.valueExpression.nodeType&&(a=s.valueExpression,p=()=>e.getTypeOfAnnotation(s.typeAnnotation,{isVariableAnnotation:!0,allowFinal:!0,allowClassVar:!0}),"_"===s.valueExpression.value)){const e=p();(0,m.isClassInstance)(e)&&m.ClassType.isBuiltIn(e,"KW_ONLY")&&(b=!0,a=void 0,p=void 0)}if(a&&p){const t=a.value,s=n.details.fields.get(t),r=null==s?void 0:s.getDeclarations().some((e=>1===e.type&&e.isFinal));if((null==s?void 0:s.isClassVar())&&!r){const e=T.findIndex((e=>e.name===t));e>=0&&T.splice(e,1);const n={name:t,alias:o,isKeywordOnly:!1,hasDefault:y,defaultValueExpression:u,includeInInit:_,type:m.UnknownType.create(),isClassVar:!0};f.push(n)}else{const n={name:t,alias:o,isKeywordOnly:g,hasDefault:y,defaultValueExpression:u,includeInInit:_,type:m.UnknownType.create(),isClassVar:!1};v.push({entry:n,evaluator:p});let s=f.findIndex((e=>e.name===t));if(s>=0?f[s]=n:f.push(n),s=T.findIndex((e=>e.name===t)),s>=0?T[s]=n:(T.push(n),s=T.length-1),!g&&_&&!i&&!y){const t=T.findIndex((e=>e.hasDefault&&e.includeInInit&&!e.isKeywordOnly));t>=0&&t<s&&e.addError(l.Localizer.Diagnostic.dataClassFieldWithDefault(),a)}}}}))})),n.details.dataClassEntries=f,v.forEach((e=>{e.entry.type=e.evaluator()}));const I=n.details.fields,C=[];!i&&_&&(T.forEach((e=>{if(e.includeInInit){const t={category:0,name:e.alias||e.name,hasDefault:e.hasDefault,defaultValueExpression:e.defaultValueExpression,type:e.type,hasDeclaredType:!0};e.isKeywordOnly?C.push(t):m.FunctionType.addParameter(y,t)}})),C.length>0&&(m.FunctionType.addParameter(y,{category:1,type:m.AnyType.create()}),C.forEach((e=>{m.FunctionType.addParameter(y,e)}))),I.set("__init__",u.Symbol.createWithType(4,y)),I.set("__new__",u.Symbol.createWithType(4,o)));const S=e.getBuiltInType(t,"str"),F=e.getBuiltInType(t,"tuple");if(F&&(0,m.isInstantiableClass)(F)&&S&&(0,m.isInstantiableClass)(S)&&!I.has("__match_args__")){const e=[];T.forEach((t=>{t.includeInInit&&!t.isKeywordOnly&&e.push(t.name)}));const t=e.map((e=>m.ClassType.cloneAsInstance(m.ClassType.cloneWithLiteral(S,e)))),n=m.ClassType.cloneAsInstance((0,h.specializeTupleClass)(F,t));I.set("__match_args__",u.Symbol.createWithType(4,n))}const D=(n,i)=>{const s=m.FunctionType.createInstance(n,"","",64);m.FunctionType.addParameter(s,g),m.FunctionType.addParameter(s,{category:0,name:"x",type:i,hasDeclaredType:!0}),s.details.declaredReturnType=e.getBuiltInObject(t,"bool"),I.set(n,u.Symbol.createWithType(4,s))};if(m.ClassType.isSkipSynthesizedDataClassEq(n)||D("__eq__",e.getBuiltInObject(t,"object")),m.ClassType.isSynthesizedDataclassOrder(n)){const e=m.ClassType.cloneAsInstance(n);["__lt__","__le__","__gt__","__ge__"].forEach((t=>{D(t,e)}))}let P=!m.ClassType.isSkipSynthesizedDataClassEq(n)&&m.ClassType.isFrozenDataClass(n);const x=!m.ClassType.isSkipSynthesizedDataClassEq(n)&&!m.ClassType.isFrozenDataClass(n);if(s||(P=!1),m.ClassType.isSynthesizeDataClassUnsafeHash(n)&&(P=!0),P){const n=m.FunctionType.createInstance("__hash__","","",64);m.FunctionType.addParameter(n,g),n.details.declaredReturnType=e.getBuiltInObject(t,"int"),I.set("__hash__",u.Symbol.createWithType(4,n))}else x&&!s&&I.set("__hash__",u.Symbol.createWithType(4,m.NoneType.createInstance()));let A=e.getBuiltInType(t,"dict");(0,m.isInstantiableClass)(A)&&(A=m.ClassType.cloneAsInstance(m.ClassType.cloneForSpecialization(A,[e.getBuiltInObject(t,"str"),m.AnyType.create()],!0))),I.set("__dataclass_fields__",u.Symbol.createWithType(4,A)),m.ClassType.isGeneratedDataClassSlots(n)&&void 0===n.details.localSlotsNames&&(n.details.localSlotsNames=f.map((e=>e.name))),(0,p.updateNamedTupleBaseClass)(n,T.map((e=>e.type)),!0)},t.validateDataClassTransformDecorator=function(e,t){if(9!==t.nodeType)return;const n={keywordOnlyParams:!1,generateEq:!0,generateOrder:!1,fieldDescriptorNames:[]},i=c.getFileInfo(t);return t.arguments.forEach((t=>{if(t.name&&0===t.argumentCategory)switch(t.name.value){case"kw_only_default":{const e=(0,d.evaluateStaticBoolExpression)(t.valueExpression,i.executionEnvironment);if(void 0===e)return;n.keywordOnlyParams=e;break}case"eq_default":{const e=(0,d.evaluateStaticBoolExpression)(t.valueExpression,i.executionEnvironment);if(void 0===e)return;n.generateEq=e;break}case"order_default":{const e=(0,d.evaluateStaticBoolExpression)(t.valueExpression,i.executionEnvironment);if(void 0===e)return;n.generateOrder=e;break}case"field_descriptors":{const i=e.getTypeOfExpression(t.valueExpression).type;if(!(0,m.isClassInstance)(i)||!m.ClassType.isBuiltIn(i,"tuple")||!i.tupleTypeArguments||i.tupleTypeArguments.some((e=>!(0,m.isInstantiableClass)(e)&&!(0,m.isFunction)(e)&&!(0,m.isOverloadedFunction)(e))))return;n.fieldDescriptorNames||(n.fieldDescriptorNames=[]),i.tupleTypeArguments.forEach((e=>{(0,m.isInstantiableClass)(e)||(0,m.isFunction)(e)?n.fieldDescriptorNames.push(e.details.fullName):(0,m.isOverloadedFunction)(e)&&n.fieldDescriptorNames.push(e.overloads[0].details.fullName)}));break}}})),n},t.getDataclassDecoratorBehaviors=function(e){let t;if((0,m.isFunction)(e)?t=e:(0,m.isOverloadedFunction)(e)&&(t=e.overloads[0]),t)return t.details.decoratorDataClassBehaviors?t.details.decoratorDataClassBehaviors:"dataclasses.dataclass"===t.details.fullName?{keywordOnlyParams:!1,generateEq:!0,generateOrder:!1,fieldDescriptorNames:["dataclasses.field","dataclasses.Field"]}:void 0},t.applyDataClassMetaclassBehaviorOverrides=function(e,t,n){n.forEach((n=>{n.valueExpression&&n.name&&y(e,n.name,t,n.name.value,n.valueExpression)}))},t.applyDataClassDefaultBehaviors=g,t.applyDataClassDecorator=function(e,t,n,i){g(t,n),(null==i?void 0:i.arguments)&&i.arguments.forEach((n=>{n.name&&n.valueExpression&&y(e,n,t,n.name.value,n.valueExpression)}))}},8905:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isIntrinsicDeclaration=t.isSpecialBuiltInClassDeclaration=t.isAliasDeclaration=t.isVariableDeclaration=t.isParameterDeclaration=t.isClassDeclaration=t.isFunctionDeclaration=void 0,t.isFunctionDeclaration=function(e){return 3===e.type},t.isClassDeclaration=function(e){return 4===e.type},t.isParameterDeclaration=function(e){return 2===e.type},t.isVariableDeclaration=function(e){return 1===e.type},t.isAliasDeclaration=function(e){return 6===e.type},t.isSpecialBuiltInClassDeclaration=function(e){return 5===e.type},t.isIntrinsicDeclaration=function(e){return 0===e.type}},5523:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSynthesizedAliasDeclaration=t.getDeclarationsWithUsesLocalNameRemoved=t.isDefinedInFile=t.getNameFromDeclaration=t.isPossibleTypeAliasDeclaration=t.isExplicitTypeAliasDeclaration=t.isFinalVariableDeclaration=t.areDeclarationsSame=t.hasTypeForDeclaration=void 0;const i=n(3550),s=n(8905),r=n(8494);t.hasTypeForDeclaration=function(e){switch(e.type){case 0:case 4:case 5:case 3:return!0;case 2:{if(e.node.typeAnnotation||e.node.typeAnnotationComment)return!0;const t=e.node.parent;if(28===(null==t?void 0:t.nodeType)&&t.functionAnnotationComment&&!t.functionAnnotationComment.isParamListEllipsis){const n=t.functionAnnotationComment.paramTypeAnnotations;return!(t.parameters.length>n.length&&e.node===t.parameters[0])}return!1}case 1:return!!e.typeAnnotationNode;case 6:return!1}},t.areDeclarationsSame=function(e,t,n=!1){if(e.type!==t.type)return!1;if(e.path!==t.path)return!1;if(e.range.start.line!==t.range.start.line||e.range.start.character!==t.range.start.character)return!1;if(6===e.type&&6===t.type){if(e.symbolName!==t.symbolName||e.usesLocalName!==t.usesLocalName)return!1;if(n)return!0;if(e.firstNamePart!==t.firstNamePart)return!1}return!0},t.isFinalVariableDeclaration=function(e){return 1===e.type&&!!e.isFinal},t.isExplicitTypeAliasDeclaration=function(e){return 1===e.type&&!!e.typeAliasAnnotation},t.isPossibleTypeAliasDeclaration=function(e){var t;if(1!==e.type||!e.typeAliasName||e.typeAnnotationNode)return!1;if(3!==(null===(t=e.node.parent)||void 0===t?void 0:t.nodeType))return!1;switch(e.node.parent.rightExpression.nodeType){case 0:case 55:case 4:case 54:case 6:case 51:case 56:case 52:case 9:case 32:case 46:case 60:case 61:case 30:case 40:case 15:case 31:case 45:return!1}return!0},t.getNameFromDeclaration=function(e){var t;switch(e.type){case 6:return e.symbolName;case 4:case 3:return e.node.name.value;case 2:return null===(t=e.node.name)||void 0===t?void 0:t.value;case 1:return 38===e.node.nodeType?e.node.value:void 0;case 0:case 5:return}throw new Error("Shouldn't reach here")},t.isDefinedInFile=function(e,t){var n;return(0,s.isAliasDeclaration)(e)?(null===(n=(0,r.getFileInfoFromNode)(e.node))||void 0===n?void 0:n.filePath)===t:e.path===t},t.getDeclarationsWithUsesLocalNameRemoved=function(e){return e.map((e=>{if(6!==e.type)return e;const t={...e};return t.usesLocalName=!1,t}))},t.createSynthesizedAliasDeclaration=function(e){return{type:6,node:void 0,path:e,loadSymbolsFromPath:!1,range:(0,i.getEmptyRange)(),implicitImports:new Map,usesLocalName:!1,moduleName:""}}},1272:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertDocStringToPlainText=t.convertDocStringToMarkdown=void 0;const i=n(5678);t.convertDocStringToMarkdown=function(e){return new k(e).convert()},t.convertDocStringToPlainText=function(e){const t=(0,i.cleanAndSplitDocString)(e),n=[];for(const e of t){const t=n.length>0?n[n.length-1]:void 0;w(e)&&w(t)||n.push(e)}return n.join("\n").trimEnd()};const s=/\S|$/,r=/\S/,a=/^\s*~~~+$/,o=/^\s*\+\+\++$/,l=/^\s*===+\s+===+$/,c=/^\s*---+\s+---+$/,p=/^(\s*)-\s/,d=/^(\s*)\*\s/,u=/^(\s*)\d+\.\s/,m=/^(\s+\* )(.*)$/,h=/^\s*\.\. /,y=/^\s*\.\.\s+(\w+)::\s*(.*)$/,g=/ *>>> /,f=/^\s*:(param|arg|type|return|rtype|raise|except|var|ivar|cvar|copyright|license)/,T=/^[.\s\t]+(@\w+)/,_=/^(\.\s{3})|^(\.)/,v=[{exp:/^\s*=+(\s+=+)+$/,replacement:"="},{exp:/^\s*-+(\s+-+)+$/,replacement:"-"},{exp:/^\s*~+(\s+-+)+$/,replacement:"~"},{exp:/^\s*\++(\s+\++)+$/,replacement:"+"}],b=/\s/g,I=/``/g,C=/~/g,S=/\+/g,F=/(?<!\\)([_*~[\]])/g,D=/(\[.*\]\(.*\))/g,P=[{exp:/</g,replacement:"&lt;"},{exp:/>/g,replacement:"&gt;"}],x=/^\s*::$/,A=[{exp:/\s+::$/g,replacement:""},{exp:/(\S)\s*::$/g,replacement:"$1:"},{exp:/:[\w_\-+:.]+:`/g,replacement:"`"},{exp:/`:[\w_\-+:.]+:/g,replacement:"`"}];class k{constructor(e){this._builder="",this._skipAppendEmptyLine=!0,this._insideInlineCode=!1,this._appendDirectiveBlock=!1,this._stateStack=[],this._lineNum=0,this._blockIndent=0,this._state=this._parseText,this._lines=(0,i.cleanAndSplitDocString)(e)}convert(){for(this._lines.some((e=>T.exec(e)))&&(this._lines=this._lines.map((e=>e.replace(_,""))));void 0!==this._currentLineOrUndefined();){const e=this._state,t=this._lineNum;if(this._state(),this._state===e&&this._lineNum===t)break}return this._state===this._parseBacktickBlock||this._state===this._parseDocTest||this._state===this._parseLiteralBlock?this._trimOutputAndAppendLine("```"):this._insideInlineCode&&this._trimOutputAndAppendLine("`",!0),this._builder.trim()}_eatLine(){this._lineNum++}_currentLineOrUndefined(){return this._lineNum<this._lines.length?this._lines[this._lineNum]:void 0}_currentLine(){return this._currentLineOrUndefined()||""}_currentIndent(){return E(this._currentLine())}_prevIndent(){var e;return E(null!==(e=this._lineAt(this._lineNum-1))&&void 0!==e?e:"")}_lineAt(e){return e<this._lines.length?this._lines[e]:void 0}_nextBlockIndent(){return E(this._lines.slice(this._lineNum+1).find((e=>!w(e)))||"")}_currentLineIsOutsideBlock(){return this._currentIndent()<this._blockIndent}_currentLineWithinBlock(){return this._currentLine().substr(this._blockIndent)}_pushAndSetState(e){this._state===this._parseText&&(this._insideInlineCode=!1),this._stateStack.push(this._state),this._state=e}_popState(){this._state=this._stateStack.splice(0,1)[0],this._state===this._parseText&&(this._insideInlineCode=!1)}_parseText(){if(w(this._currentLineOrUndefined()))return void(this._state=this._parseEmpty);if(this._beginBacktickBlock())return;if(this._beginLiteralBlock())return;if(this._beginDocTest())return;if(this._beginDirective())return;if(this._beginList())return;if(this._beginFieldList())return;if(this._beginTableBlock())return;const e=this._formatPlainTextIndent(this._currentLine());this._appendTextLine(e),this._eatLine()}_formatPlainTextIndent(e){const t=this._lineAt(this._lineNum-1),n=this._prevIndent(),i=this._currentIndent();return!(i>n)||w(t)||this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")||N(t)||(this._builder=this._builder.slice(0,-1)+"\\\n"),n>i&&!w(t)&&!this._builder.endsWith("\\\n")&&!this._builder.endsWith("\n\n")&&(this._builder=this._builder.slice(0,-1)+"\\\n"),0===n||this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")?this._convertIndent(e):e.trimStart()}_convertIndent(e){return e.replace(/^([ \t]+)(.+)$/g,((e,t,n)=>"&nbsp;".repeat(t.length)+n))}_escapeHtml(e){return P.forEach((t=>{e=e.replace(t.exp,t.replacement)})),e}_appendTextLine(e){const t=(e=this._preprocessTextLine(e)).split("`");for(let e=0;e<t.length;e++){let n=t[e];if(e>0&&(this._insideInlineCode=!this._insideInlineCode,this._append("`")),this._insideInlineCode)this._append(n);else{if(n=this._escapeHtml(n),0===e){if(1===t.length){for(const e of v)if(e.exp.test(n)){n=n.replace(b,e.replacement);break}if(a.test(n)){this._append(n.replace(C,"-"));continue}if(o.test(n)){this._append(n.replace(S,"-"));continue}}const e=m.exec(n);null!==e&&3===e.length&&(this._append(e[1]),n=e[2])}n.split(D).forEach((e=>{D.test(e)?this._append(e):this._append(e.replace(F,"\\$1"))}))}}this._builder+="\n"}_preprocessTextLine(e){return x.test(e)?"":(A.forEach((t=>e=e.replace(t.exp,t.replacement))),e=e.replace(I,"`"))}_parseEmpty(){if(w(this._currentLineOrUndefined()))return this._appendLine(),void this._eatLine();this._state=this._parseText}_beginMinIndentCodeBlock(e){this._appendLine("```"),this._pushAndSetState(e),this._blockIndent=this._currentIndent()}_beginBacktickBlock(){return!!this._currentLine().startsWith("```")&&(this._appendLine(this._currentLine()),this._pushAndSetState(this._parseBacktickBlock),this._eatLine(),!0)}_parseBacktickBlock(){this._currentLine().startsWith("```")?(this._appendLine("```"),this._appendLine(),this._popState()):this._appendLine(this._currentLine()),this._eatLine()}_beginDocTest(){return!!g.test(this._currentLine())&&(this._beginMinIndentCodeBlock(this._parseDocTest),this._appendLine(this._currentLineWithinBlock()),this._eatLine(),!0)}_parseDocTest(){if(this._currentLineIsOutsideBlock()||w(this._currentLine()))return this._trimOutputAndAppendLine("```"),this._appendLine(),void this._popState();this._appendLine(this._currentLineWithinBlock()),this._eatLine()}_beginLiteralBlock(){const e=this._lineAt(this._lineNum-1);if(void 0===e)return!1;if(!w(e))return!1;let t=this._lineNum-2;for(;t>=0;t--){const e=this._lineAt(t);if(!w(e)){if(e.endsWith("::"))break;return!1}}return!(t<0||(0===this._currentIndent()?(this._appendLine("```"),this._pushAndSetState(this._parseLiteralBlockSingleLine),0):(this._beginMinIndentCodeBlock(this._parseLiteralBlock),0)))}_parseLiteralBlock(){return w(this._currentLineOrUndefined())?(this._appendLine(),void this._eatLine()):this._currentLineIsOutsideBlock()?(this._trimOutputAndAppendLine("```"),this._appendLine(),void this._popState()):(this._appendLine(this._currentLineWithinBlock()),void this._eatLine())}_parseLiteralBlockSingleLine(){this._appendLine(this._currentLine()),this._appendLine("```"),this._appendLine(),this._popState(),this._eatLine()}_beginDirective(){return!!h.test(this._currentLine())&&(this._pushAndSetState(this._parseDirective),this._blockIndent=this._nextBlockIndent(),this._appendDirectiveBlock=!1,!0)}_beginFieldList(){var e,t;if(this._insideInlineCode)return!1;let n=this._currentLine();if(n.startsWith("@"))return this._appendLine(),this._appendTextLine(n),this._eatLine(),!0;const i=!(null==n?void 0:n.endsWith(":"))&&!(null==n?void 0:n.endsWith("::"))&&(null!==(t=null===(e=n.match(/:/g))||void 0===e?void 0:e.length)&&void 0!==t?t:0)%2==1,s=f.test(n);if(i||s){const e=this._lineAt(this._lineNum-1);return this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")||N(e)||(this._builder=this._builder.slice(0,-1)+"\\\n"),n=this._convertIndent(n),this._appendTextLine(n),this._eatLine(),!0}return!1}_beginTableBlock(){if(this._insideInlineCode)return!1;const e=this._currentLine();return!!l.test(e)&&(this._tableState={header:e.trimStart(),inHeader:!0},this._eatLine(),this._pushAndSetState(this._parseTableBlock),!0)}_parseTableBlock(){if(w(this._currentLineOrUndefined())||!this._tableState)return this._tableState=void 0,void this._popState();let e=this._currentLine();if(l.test(e))return this._eatLine(),this._appendLine("\n<br/>\n"),this._popState(),void(this._tableState=void 0);{let t="|";const n=this._tableState.header.split(" "),i=[];if(this._tableState.inHeader){do{let t=0;for(let s=0;s<n.length;s++){const r=n[s].length+1,a=e.slice(t,t+r);void 0===i[s]?i[s]=`${a} `:i[s]=i[s].concat(`<br>${a} `),t+=r}this._eatLine(),e=this._currentLine()}while(!w(this._currentLineOrUndefined())&&!c.test(e)&&!l.test(e));this._tableState.inHeader=!1,i.forEach((e=>{t+=`${e}|`})),this._appendLine(t);const s=e.trimStart().replace(/=/g,"-").replace(" ","|");this._appendLine(`|${s}|`),this._eatLine()}else{let i=0;n.forEach((n=>{const s=n.length+1,r=e.slice(i,i+s);t+=`${r}|`,i+=s})),this._appendLine(t),this._eatLine()}}}_beginList(){if(this._insideInlineCode)return!1;let e=this._currentLine();const t=p.exec(e);if(2===(null==t?void 0:t.length))return t[1].length>=4&&(e=" ".repeat(t[1].length/2)+e.trimLeft()),this._appendTextLine(e),this._eatLine(),this._state!==this._parseList&&this._pushAndSetState(this._parseList),!0;const n=d.exec(e);if(2===(null==n?void 0:n.length))return 0===n[1].length?e=e=" "+e:n[1].length>=4&&(e=" ".repeat(n[1].length/2)+e.trimLeft()),this._appendTextLine(e),this._eatLine(),this._state!==this._parseList&&this._pushAndSetState(this._parseList),!0;const i=u.exec(e);return 2===(null==i?void 0:i.length)&&(this._appendTextLine(e),this._eatLine(),!0)}_parseList(){if(w(this._currentLineOrUndefined())||this._currentLineIsOutsideBlock())this._popState();else if(!this._beginList()){const e=this._currentLine().trimStart();this._appendTextLine(e),this._eatLine()}}_parseDirective(){const e=y.exec(this._currentLine());if(null!==e&&3===e.length){const t=e[1],n=e[2];"class"===t&&(this._appendDirectiveBlock=!0,this._appendLine(),this._appendLine("```"),this._appendLine(n),this._appendLine("```"),this._appendLine())}0===this._blockIndent?this._popState():this._state=this._parseDirectiveBlock,this._eatLine()}_parseDirectiveBlock(){w(this._currentLineOrUndefined())||!this._currentLineIsOutsideBlock()?(this._appendDirectiveBlock&&this._appendTextLine(this._currentLine().trimLeft()),this._eatLine()):this._popState()}_appendLine(e){w(e)?this._skipAppendEmptyLine||(this._builder+="\n",this._skipAppendEmptyLine=!0):(this._builder+=e+"\n",this._skipAppendEmptyLine=!1)}_append(e){this._builder+=e,this._skipAppendEmptyLine=!1}_trimOutputAndAppendLine(e,t=!1){this._builder=this._builder.trimRight(),this._skipAppendEmptyLine=!1,t||this._appendLine(),this._appendLine(e)}}function E(e){return e.search(s)}function w(e){return void 0===e||!r.test(e)}function N(e){var t,n;return void 0!==e&&(null!==(n=null===(t=e.match(/^\s*[#`~=-]{3,}/))||void 0===t?void 0:t.length)&&void 0!==n?n:0)>0}},5678:(e,t)=>{function n(e){const t=e.replace(/\r/g,"").replace(/\t/g,"        ").split("\n");let n=Number.MAX_VALUE;t.forEach(((e,i)=>{if(t.length<=1||i>0){const t=e.trimLeft();t&&(n=Math.min(n,e.length-t.length))}})),n>=Number.MAX_VALUE&&(n=0);const i=[];for(t.forEach(((e,t)=>{0===t?i.push(e.trim()):i.push(e.substr(n).trimRight())}));i.length>0&&0===i[0].length;)i.shift();for(;i.length>0&&0===i[i.length-1].length;)i.pop();return i}Object.defineProperty(t,"__esModule",{value:!0}),t.extractParameterDocumentation=t.cleanAndSplitDocString=t.cleanDocString=void 0,t.cleanDocString=function(e){return n(e).join("\n")},t.cleanAndSplitDocString=n,t.extractParameterDocumentation=function(e,t){if(!e||!t)return;const i=n(e);for(const e of i){const n=e.trim();let i=n.indexOf("@param "+t);if(i>=0)return n.substr(i+7);if(i=n.indexOf(":param "+t),i>=0)return n.substr(i+7);if(i=n.indexOf(t+": "),i>=0)return n.substr(i);if(i=n.indexOf(t+" ("),i>=0)return n.substr(i)}}},2374:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ImportResolver=t.supportedFileExtensions=t.createImportedModuleDescriptor=void 0;const a=n(9489),o=n(3188),l=n(6657),c=n(6886),p=n(7559),d=r(n(7559)),u=n(6956),m=n(1447),h=n(7012),y=n(1012),g=r(n(1887)),f=n(1277),T=n(1766);t.createImportedModuleDescriptor=function(e){return{leadingDots:0,nameParts:e.split("."),importedSymbols:[]}};const _=[".pyd",".so",".dylib"];t.supportedFileExtensions=[".py",".pyi",..._],t.ImportResolver=class{constructor(e,t,n){this.fileSystem=e,this._configOptions=t,this.host=n,this._cachedImportResults=new Map,this._cachedModuleNameResults=new Map,this._cachedEntriesForPath=new Map,this.cachedParentImportResults=new y.ParentDirectoryCache((()=>this.getPythonSearchPaths([])))}invalidateCache(){this._cachedImportResults=new Map,this._cachedModuleNameResults=new Map,this.cachedParentImportResults.reset(),this._invalidateFileSystemCache(),this.fileSystem instanceof m.PyrightFileSystem&&this.fileSystem.clearPartialStubs()}resolveImport(e,t,n){return this._resolveImport(e,t,n)}_resolveImport(e,t,n){const i=this.formatImportName(n),s=this._resolveImportStrict(i,e,t,n,[]);if(s.isImportFound||n.leadingDots>0)return s;e=(0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)(e));const r=(0,l.ensureTrailingDirectorySeparator)((0,l.getDirectoryPath)(e)),a=this.cachedParentImportResults.getImportResult(r,i,s);if(a)return this.filterImplicitImports(a,n.importedSymbols);const o=this.getParentImportResolutionRoot(e,t.root);if(!this.cachedParentImportResults.checkValidPath(this.fileSystem,e,o))return s;const c={importPath:void 0};let p=r;for(;this._shouldWalkUp(p,o,t);){const e=this.resolveAbsoluteImport(p,t,n,i,[],void 0,void 0,!1,!0);if(this.cachedParentImportResults.checked(p,i,c),e.isImportFound)return c.importPath=p,this.cachedParentImportResults.add({importResult:e,path:p,importName:i}),this.filterImplicitImports(e,n.importedSymbols);let s;if([s,p]=this._tryWalkUp(p),!s)break}return this.cachedParentImportResults.checked(p,i,c),s}_resolveImportStrict(e,t,n,i,s){const r={importName:e,isRelative:!1,isImportFound:!1,isPartlyResolved:!1,isNamespacePackage:!1,isStubPackage:!1,importFailureInfo:s,resolvedPaths:[],importType:2,isStubFile:!1,isNativeLib:!1,implicitImports:[],filteredImplicitImports:[],nonStubImportResult:void 0};if(this.ensurePartialStubPackages(n),i.leadingDots>0){const r=this._resolveRelativeImport(t,n,i,e,s);if(r)return r.isRelative=!0,r}else{const s=this._lookUpResultsInCache(n,e,i.importedSymbols);if(s&&(!s.isImportFound||!s.isNamespacePackage||this._isNamespacePackageResolved(i,s.implicitImports)))return s;const a=this._resolveBestAbsoluteImport(t,n,i,!0);if(a)return a.isStubFile&&(a.nonStubImportResult=this._resolveBestAbsoluteImport(t,n,i,!1)||r),this.addResultsToCache(n,e,a,i.importedSymbols)}return this.addResultsToCache(n,e,r,void 0)}getCompletionSuggestions(e,t,n){const i=this._getCompletionSuggestionsStrict(e,t,n);if(n.leadingDots>0)return i;const s=this.getParentImportResolutionRoot(e,t.root);let r=(0,l.ensureTrailingDirectorySeparator)((0,l.getDirectoryPath)((0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)(e))));for(;this._shouldWalkUp(r,s,t);){let s;if(this._getCompletionSuggestionsAbsolute(e,t,r,n,i,!1),[s,r]=this._tryWalkUp(r),!s)break}return i}_getCompletionSuggestionsStrict(e,t,n){const i=[],s=new Set;if(n.leadingDots>0)this._getCompletionSuggestionsRelative(e,t,n,s);else{n.nameParts.length>0&&this._getCompletionSuggestionsTypeshedPath(e,t,n,!0,s),t.root&&this._getCompletionSuggestionsAbsolute(e,t,t.root,n,s);for(const i of t.extraPaths)this._getCompletionSuggestionsAbsolute(e,t,i,n,s);this._configOptions.stubPath&&this._getCompletionSuggestionsAbsolute(e,t,this._configOptions.stubPath,n,s),this._getCompletionSuggestionsTypeshedPath(e,t,n,!1,s);const r=this.getPythonSearchPaths(i);for(const i of r)this._getCompletionSuggestionsAbsolute(e,t,i,n,s)}return s}getSourceFilesFromStub(e,t,n){const i=[];if(this._cachedImportResults.forEach((t=>{t.forEach((t=>{if(t.isStubFile&&t.isImportFound&&t.nonStubImportResult&&t.resolvedPaths[t.resolvedPaths.length-1]===e&&t.nonStubImportResult.isImportFound){const e=t.nonStubImportResult.resolvedPaths[t.nonStubImportResult.resolvedPaths.length-1];e.endsWith(".py")&&i.push(e)}}))})),0===i.length){const t=(0,l.changeAnyExtension)(e,".py");this.dirExistsCached(t)&&i.push(t)}if(0===i.length){const n=this.getImportRoots(t),s=[];for(const t of n)if((0,l.containsPath)(t,e,!0)){const n=(0,l.getRelativePathComponentsFromDirectory)(t,e,!0);if(n.length>1){n[1].endsWith(o.stubsSuffix)&&(n[1]=n[1].substr(0,n[1].length-o.stubsSuffix.length));const e=(0,l.combinePathComponents)(n);e&&s.push(e)}}for(const e of s)for(const t of n){const n=(0,l.resolvePaths)(t,e);let s=(0,l.changeAnyExtension)(n,".py");if(this.fileExistsCached(s))i.push(s);else{const e=(0,l.stripFileExtension)(s);e.endsWith("__init__")?(s=e.substr(0,e.length-9)+".py",this.fileExistsCached(s)&&i.push(s)):(s=(0,l.combinePaths)(e,"__init__.py"),this.fileExistsCached(s)&&i.push(s))}}}return i}getModuleNameForImport(e,t){const n=(0,a.getOrAdd)(this._cachedModuleNameResults,t.root,(()=>new Map));return(0,a.getOrAdd)(n,e,(()=>this._getModuleNameForImport(e,t)))}_getModuleNameForImport(e,t){let n,i=0,s=!1;const r=[],a=this._getStdlibTypeshedPath(t,r);if(a&&(n=this.getModuleNameFromPath(a,e),n)){const e={leadingDots:0,nameParts:n.split("."),importedSymbols:void 0};if(this._isStdlibTypeshedStubValidForVersion(e,t,[]))return{moduleName:n,importType:i,isLocalTypingsFile:s}}t.root&&(n=this.getModuleNameFromPath(t.root,e),i=2);for(const s of t.extraPaths){const t=this.getModuleNameFromPath(s,e);(!n||t&&t.length<n.length)&&(n=t,i=2)}if(this._configOptions.stubPath){const t=this.getModuleNameFromPath(this._configOptions.stubPath,e);(!n||t&&t.length<n.length)&&(n=t,i=2,s=!0)}const o=this._getThirdPartyTypeshedPath(t,r);if(o){const t=this.getModuleNameFromPath(o,e,!0);(!n||t&&t.length<n.length)&&(n=t,i=1)}const l=this.getTypeshedPathEx(t,r);if(l){const t=this.getModuleNameFromPath(l,e);(!n||t&&t.length<n.length)&&(n=t,i=1)}const c=this.getPythonSearchPaths(r);for(const t of c){const s=this.getModuleNameFromPath(t,e);(!n||s&&s.length<n.length)&&(n=s,i=1)}return n?{moduleName:n,importType:i,isLocalTypingsFile:s}:{moduleName:"",importType:2,isLocalTypingsFile:s}}getTypeshedStdLibPath(e){return this._getStdlibTypeshedPath(e,[])}getImportRoots(e,t=!1){const n=[],i=[],s=this._getStdlibTypeshedPath(e,n);if(s&&i.push(s),e.root&&i.push(e.root),i.push(...e.extraPaths),this._configOptions.stubPath&&i.push(this._configOptions.stubPath),t){const t=this._getThirdPartyTypeshedPath(e,n);t&&i.push((0,l.combinePaths)(t,"..."))}else{const t=this._getThirdPartyTypeshedPackageRoots(e,n);i.push(...t)}const r=this.getTypeshedPathEx(e,n);r&&i.push(r);const a=this.getPythonSearchPaths(n);return a.length>0&&i.push(...a),i}readdirEntriesCached(e){const t=this._cachedEntriesForPath.get(e);if(t)return t;let n;try{n=this.fileSystem.readdirEntriesSync(e)}catch{n=[]}return this._cachedEntriesForPath.set(e,n),n}fileExistsCached(e){var t,n;const i=this._splitPath(e);if(!i[0]||!i[1])return!!this.fileSystem.existsSync(e)&&null!==(n=null===(t=(0,l.tryStat)(this.fileSystem,e))||void 0===t?void 0:t.isFile())&&void 0!==n&&n;const s=this.readdirEntriesCached(i[0]).find((e=>e.name===i[1]));if(null==s?void 0:s.isFile())return!0;if(null==s?void 0:s.isSymbolicLink()){const t=(0,l.tryRealpath)(this.fileSystem,e);if(t&&this.fileSystem.existsSync(t)&&(0,l.isFile)(this.fileSystem,t))return!0}return!1}dirExistsCached(e){var t,n;const i=this._splitPath(e);if(!i[0]||!i[1])return!!this.fileSystem.existsSync(e)&&null!==(n=null===(t=(0,l.tryStat)(this.fileSystem,e))||void 0===t?void 0:t.isDirectory())&&void 0!==n&&n;const s=this.readdirEntriesCached(i[0]).find((e=>e.name===i[1]));if(null==s?void 0:s.isDirectory())return!0;if(null==s?void 0:s.isSymbolicLink()){const t=(0,l.tryRealpath)(this.fileSystem,e);if(t&&this.fileSystem.existsSync(t)&&(0,l.isDirectory)(this.fileSystem,t))return!0}return!1}ensurePartialStubPackages(e){if(!(this.fileSystem instanceof m.PyrightFileSystem))return!1;if(this.fileSystem.isPartialStubPackagesScanned(e))return!1;const t=this.fileSystem,n=[],i=[];return s(this._configOptions.stubPath),s(e.root),e.extraPaths.forEach((e=>s(e))),s(this.getTypeshedPathEx(e,n)),this.getPythonSearchPaths(n).forEach((e=>s(e))),this.fileSystem.processPartialStubPackages(i,this.getImportRoots(e)),this._invalidateFileSystemCache(),!0;function s(e){e&&!t.isPathScanned(e)&&i.push(e)}}addResultsToCache(e,t,n,i){return(0,a.getOrAdd)(this._cachedImportResults,e.root,(()=>new Map)).set(t,n),this.filterImplicitImports(n,i)}resolveAbsoluteImport(e,t,n,i,s,r=!1,a=!1,o=!1,l=!0,c=!1){if(l&&o){const a=this._resolveAbsoluteImport(e,t,n,i,s,r,!1,!0,!0,!0);if(a.packageDirectory&&(!a.isNamespacePackage||a.isImportFound))return a}return this._resolveAbsoluteImport(e,t,n,i,s,r,a,!1,l,c)}_invalidateFileSystemCache(){this._cachedEntriesForPath.clear()}_splitPath(e){const t=(0,l.getPathComponents)(e);return t.length<=1?[e,""]:[(0,l.combinePathComponents)(t.slice(0,-1)),t[t.length-1]]}_resolveAbsoluteImport(e,t,n,i,s,r,a,c,p,d){c?s.push(`Attempting to resolve stub package using root path '${e}'`):s.push(`Attempting to resolve using root path '${e}'`);const u=[];let m,h,y,g=e,T=!1,_=!1,v=!1,b=!1,I=[];if(0===n.nameParts.length){const e="__init__",t=(0,l.combinePaths)(g,e+".py"),n=(0,l.combinePaths)(g,e+".pyi");p&&this.fileExistsCached(n)?(s.push(`Resolved import with file '${n}'`),u.push(n),v=!0):this.fileExistsCached(t)?(s.push(`Resolved import with file '${t}'`),u.push(t)):(s.push(`Partially resolved import with directory '${g}'`),u.push(""),T=!0),I=this._findImplicitImports(i,g,[t,n])}else for(let e=0;e<n.nameParts.length;e++){const r=0===e,y=e===n.nameParts.length-1;g=(0,l.combinePaths)(g,n.nameParts[e]),c&&r&&(g+=o.stubsSuffix,_=!0);const C=this.dirExistsCached(g);if(C){r&&(m=g);const e="__init__",t=(0,l.combinePaths)(g,e+".py"),i=(0,l.combinePaths)(g,e+".pyi");let a=!1;if(p&&this.fileExistsCached(i)?(s.push(`Resolved import with file '${i}'`),u.push(i),y&&(v=!0),a=!0):this.fileExistsCached(t)&&(s.push(`Resolved import with file '${t}'`),u.push(t),a=!0),a&&!h&&d&&this.fileExistsCached((0,l.combinePaths)(g,"py.typed"))&&(h=(0,f.getPyTypedInfo)(this.fileSystem,g)),!y){a||(u.push(""),T=!0,h=void 0);continue}if(a){I=this._findImplicitImports(n.nameParts.join("."),g,[t,i]);break}}let S=(0,l.stripTrailingDirectorySeparator)(g);const F=(0,l.getFileName)(S);S=(0,l.getDirectoryPath)(S);const D=(0,l.combinePaths)(S,F+".py"),P=(0,l.combinePaths)(S,F+".pyi");if(p&&this.fileExistsCached(P))s.push(`Resolved import with file '${P}'`),u.push(P),y&&(v=!0);else if(this.fileExistsCached(D))s.push(`Resolved import with file '${D}'`),u.push(D);else{if(a&&this.dirExistsCached(S)){const e=this._getFilesInDirectory(S).find((e=>this._isNativeModuleFileName(F,e)));if(e){const r=(0,l.combinePaths)(S,e);b=this._resolveNativeModuleStub(r,t,i,n,s,u)}}!b&&C?(s.push(`Partially resolved import with directory '${g}'`),u.push(""),y&&(I=this._findImplicitImports(i,g,[D,P]),T=!0)):b&&s.push(`Did not find file '${P}' or '${D}'`)}break}const C=u.length>0&&u.length<n.nameParts.length;return y=r?u.length>0:u.length>=n.nameParts.length,{importName:i,isRelative:!1,isNamespacePackage:T,isStubPackage:_,isImportFound:y,isPartlyResolved:C,importFailureInfo:s,importType:2,resolvedPaths:u,searchPath:e,isStubFile:v,isNativeLib:b,implicitImports:I,pyTypedInfo:h,filteredImplicitImports:I,packageDirectory:m}}getTypeshedPathEx(e,t){}resolveImportEx(e,t,n,i,s=[],r=!0){}resolveNativeImportEx(e,t,n=[]){}getNativeModuleName(e){const t=(0,l.getFileExtension)(e,!1).toLowerCase();if(this._isNativeModuleFileExtension(t))return(0,l.stripFileExtension)((0,l.stripFileExtension)(e))}_lookUpResultsInCache(e,t,n){const i=this._cachedImportResults.get(e.root);if(!i)return;const s=i.get(t);return s?this.filterImplicitImports(s,n):void 0}_isNamespacePackageResolved(e,t){if(e.importedSymbols){if(!e.importedSymbols.some((e=>t.some((t=>t.name===e)))))return!1}else if(0===t.length)return!1;return!0}getModuleNameFromPath(e,t,n=!1){e=(0,l.ensureTrailingDirectorySeparator)(e);let i=(0,l.stripFileExtension)(t);if(this._isNativeModuleFileExtension((0,l.getFileExtension)(t))&&(i=(0,l.stripFileExtension)(i)),!i.startsWith(e))return;i.endsWith("__init__")&&(i=i.substr(0,i.length-9));const s=i.substr(e.length),r=(0,l.getPathComponents)(s);if(r.shift(),n){if(0===r.length)return;r.shift()}return 0===r.length||(r[0].endsWith(o.stubsSuffix)&&(r[0]=r[0].substr(0,r[0].length-o.stubsSuffix.length)),r.some((e=>!this._isIdentifier(e))))?void 0:r.join(".")}_resolveBestAbsoluteImport(e,t,n,i){const s=this.formatImportName(n),r=[];if(i&&n.nameParts.length>0){const e=this._findTypeshedPath(t,n,s,!0,r);if(e)return e.isTypeshedFile=!0,e}if(i&&this._configOptions.stubPath){r.push(`Looking in stubPath '${this._configOptions.stubPath}'`);const e=this.resolveAbsoluteImport(this._configOptions.stubPath,t,n,s,r,void 0,!1,!0,i,!1);if(e.isImportFound)return e.importType=2,e.isLocalTypingsFile=!0,e}let a,o;t.root&&(r.push(`Looking in root directory of execution environment '${t.root}'`),o=this.resolveAbsoluteImport(t.root,t,n,s,r,void 0,!0,!0,i,!1),a=o);for(const e of t.extraPaths)r.push(`Looking in extraPath '${e}'`),o=this.resolveAbsoluteImport(e,t,n,s,r,void 0,!0,!0,i,!1),a=this._pickBestImport(a,o,n);const l=this.getPythonSearchPaths(r);if(l.length>0)for(const e of l){r.push(`Looking in python search path '${e}'`);const o=this.resolveAbsoluteImport(e,t,n,s,r,!1,!0,!0,i,!0);if(o){if(o.importType=1,o.isImportFound&&o.isStubFile)return o;a=this._pickBestImport(a,o,n)}}else r.push("No python interpreter search path");if(t.root!==this._getTypeshedRoot(t,r)&&(null==a?void 0:a.pyTypedInfo)&&!a.isPartlyResolved)return a;const c=this.resolveImportEx(e,t,n,s,r,i);if(void 0!==c)return c;if(i){r.push("Looking for typeshed path");const e=this._findTypeshedPath(t,n,s,!1,r);e&&(e.isTypeshedFile=!0,a=this._pickBestImport(a,e,n))}return a}_pickBestImport(e,t,n){if(!e)return t;if(!t)return e;if(t.isImportFound){if(!e.isImportFound)return t;if(e.isNamespacePackage&&!t.isNamespacePackage)return t;if(2===e.importType&&!e.isNamespacePackage)return e;if(e.isNamespacePackage&&t.isNamespacePackage&&n.importedSymbols&&!this._isNamespacePackageResolved(n,e.implicitImports)&&this._isNamespacePackageResolved(n,t.implicitImports))return t;if(e.pyTypedInfo&&!t.pyTypedInfo)return e;if(!e.pyTypedInfo&&t.pyTypedInfo)return t;if(e.isStubFile&&!t.isStubFile)return e;if(!e.isStubFile&&t.isStubFile)return t;if(e.resolvedPaths.length>t.resolvedPaths.length)return t}else if(t.isPartlyResolved&&e.isNamespacePackage&&!t.isNamespacePackage)return t;return e}_isIdentifier(e){for(let t=0;t<e.length;t++)if(0===t?!(0,u.isIdentifierStartChar)(e.charCodeAt(t)):!(0,u.isIdentifierChar)(e.charCodeAt(t)))return!1;return!0}getPythonSearchPaths(e){if(!this._cachedPythonSearchPaths){const t=(g.findPythonSearchPaths(this.fileSystem,this._configOptions,this.host,e)||[]).map((e=>this.fileSystem.realCasePath(e)));this._cachedPythonSearchPaths=[...new Set(t)]}return this._cachedPythonSearchPaths}_findTypeshedPath(e,t,n,i,s){let r;if(s.push(`Looking for typeshed ${i?g.stdLibFolderName:g.thirdPartyFolderName} path`),i){const n=this._getStdlibTypeshedPath(e,s,t);n&&(r=[n])}else r=this._getThirdPartyTypeshedPackagePaths(t,e,s);if(r)for(const a of r)if(this.dirExistsCached(a)){const r=this.resolveAbsoluteImport(a,e,t,n,s);if(r.isImportFound)return r.importType=i?0:1,r}s.push("Typeshed path not found")}_buildTypeshedThirdPartyPackageMap(e){this._cachedTypeshedThirdPartyPackagePaths=new Map,e&&this.readdirEntriesCached(e).forEach((t=>{if(t.isDirectory()){const n=(0,l.combinePaths)(e,t.name);this.readdirEntriesCached(n).forEach((e=>{if("@python2"!==e.name)if(e.isDirectory()){const t=this._cachedTypeshedThirdPartyPackagePaths.get(e.name);t?t.push(n):this._cachedTypeshedThirdPartyPackagePaths.set(e.name,[n])}else if(e.isFile()&&e.name.endsWith(".pyi")){const t=(0,l.stripFileExtension)(e.name),i=this._cachedTypeshedThirdPartyPackagePaths.get(t);i?i.push(n):this._cachedTypeshedThirdPartyPackagePaths.set(t,[n])}}))}})),this._cachedTypeshedThirdPartyPackageRoots=[...new Set(...this._cachedTypeshedThirdPartyPackagePaths.values())].sort()}_getCompletionSuggestionsTypeshedPath(e,t,n,i,s){const r=[];let a;if(i){const e=this._getStdlibTypeshedPath(t,r,n);e&&(a=[e])}else{a=this._getThirdPartyTypeshedPackagePaths(n,t,r,!1);const e=this.getTypeshedPathEx(t,r);e&&(a=null!=a?a:[],a.push(e))}a&&a.forEach((i=>{this.dirExistsCached(i)&&this._getCompletionSuggestionsAbsolute(e,t,i,n,s)}))}_getStdlibTypeshedPath(e,t,n){const i=this._getTypeshedSubdirectory(!0,e,t);if(!i||!n||this._isStdlibTypeshedStubValidForVersion(n,e,t))return i}_getThirdPartyTypeshedPath(e,t){return this._getTypeshedSubdirectory(!1,e,t)}_isStdlibTypeshedStubValidForVersion(e,t,n){this._cachedTypeshedStdLibModuleVersions||(this._cachedTypeshedStdLibModuleVersions=this._readTypeshedStdLibVersions(t,n));for(let n=1;n<=e.nameParts.length;n++){const i=e.nameParts.slice(0,n),s=this._cachedTypeshedStdLibModuleVersions.get(i.join("."));if(s){if(t.pythonVersion<s.min)return!1;if(void 0!==s.max&&t.pythonVersion>s.max)return!1}}return!0}_readTypeshedStdLibVersions(e,t){const n=new Map,i=this._getTypeshedSubdirectory(!0,e,t);if(i){const e=(0,l.combinePaths)(i,"VERSIONS");try{const i=this.fileSystem.statSync(e);i.size>0&&i.size<262144?this.fileSystem.readFileSync(e,"utf8").split(/\r?\n/).forEach((e=>{const t=e.split("#")[0].split(":");if(2!==t.length)return;const i=t[1].split("-");if(i.length>2)return;const s=t[0].trim();if(!s)return;let r=i[0].trim();r.endsWith("+")&&(r=r.substr(0,r.length-1));let a,o=(0,c.versionFromString)(r);o||(o=c.PythonVersion.V3_0),i.length>1&&(a=(0,c.versionFromString)(i[1].trim())),n.set(s,{min:o,max:a})})):t.push("Typeshed stdlib VERSIONS file is unexpectedly large")}catch(e){t.push(`Could not read typeshed stdlib VERSIONS file: '${JSON.stringify(e)}'`)}}return n}_getThirdPartyTypeshedPackagePaths(e,t,n,i=!0){const s=this._getThirdPartyTypeshedPath(t,n);this._cachedTypeshedThirdPartyPackagePaths||this._buildTypeshedThirdPartyPackageMap(s);const r=e.nameParts.length>0?e.nameParts[0]:"";return i?this._cachedTypeshedThirdPartyPackagePaths.get(r):r?(0,a.flatten)((0,a.getMapValues)(this._cachedTypeshedThirdPartyPackagePaths,(e=>e.startsWith(r)))):[]}_getThirdPartyTypeshedPackageRoots(e,t){const n=this._getThirdPartyTypeshedPath(e,t);return this._cachedTypeshedThirdPartyPackagePaths||this._buildTypeshedThirdPartyPackageMap(n),this._cachedTypeshedThirdPartyPackageRoots}_getTypeshedRoot(e,t){if(void 0!==this._cachedTypeshedRoot)return this._cachedTypeshedRoot;let n="";if(this._configOptions.typeshedPath){const e=this._configOptions.typeshedPath;this.dirExistsCached(e)&&(n=e)}else{const e=this.getPythonSearchPaths(t);for(const t of e){const e=(0,l.combinePaths)(t,"typeshed");if(this.dirExistsCached(e)){n=e;break}}}return n||(n=g.getTypeShedFallbackPath(this.fileSystem)||""),this._cachedTypeshedRoot=n,n}_getTypeshedSubdirectory(e,t,n){if(e){if(void 0!==this._cachedTypeshedStdLibPath)return this._cachedTypeshedStdLibPath}else if(void 0!==this._cachedTypeshedThirdPartyPath)return this._cachedTypeshedThirdPartyPath;let i=this._getTypeshedRoot(t,n);if(i=g.getTypeshedSubdirectory(i,e),this.dirExistsCached(i))return e?this._cachedTypeshedStdLibPath=i:this._cachedTypeshedThirdPartyPath=i,i}_resolveRelativeImport(e,t,n,i,s){s.push("Attempting to resolve relative import");const r=(0,h.getDirectoryLeadingDotsPointsTo)((0,l.getDirectoryPath)(e),n.leadingDots);if(!r)return void s.push(`Invalid relative path '${i}'`);const a=this.resolveAbsoluteImport(r,t,n,i,s,!1,!0);return this.filterImplicitImports(a,n.importedSymbols)}_getCompletionSuggestionsRelative(e,t,n,i){const s=(0,h.getDirectoryLeadingDotsPointsTo)((0,l.getDirectoryPath)(e),n.leadingDots);s&&this._getCompletionSuggestionsAbsolute(e,t,s,n,i)}_getFilesInDirectory(e){const t=this.readdirEntriesCached(e),n=t.filter((e=>e.isFile())).map((e=>e.name));return t.forEach((t=>{var i;const s=(0,l.combinePaths)(e,t.name);t.isSymbolicLink()&&(null===(i=(0,l.tryStat)(this.fileSystem,s))||void 0===i?void 0:i.isFile())&&n.push(t.name)})),n}_getCompletionSuggestionsAbsolute(e,t,n,i,s,r=!0){let a=n;const o=i.nameParts.map((e=>e));i.hasTrailingDot&&o.push("");const c=i.leadingDots,p=o.slice(0,-1);if(0===o.length)this._addFilteredSuggestionsAbsolute(e,t,a,"",s,c,p,r);else for(let n=0;n<o.length&&(n===o.length-1&&this._addFilteredSuggestionsAbsolute(e,t,a,o[n],s,c,p,r),a=(0,l.combinePaths)(a,o[n]),this.dirExistsCached(a));n++);}_addFilteredSuggestionsAbsolute(e,n,i,s,r,a,o,c){const p=(0,l.getFileSystemEntriesFromDirEntries)(this.readdirEntriesCached(i),this.fileSystem,i);p.files.forEach((i=>{const p=(0,l.getFileExtension)(i,!1).toLowerCase(),u=(0,l.stripFileExtension)(i,!0);if(t.supportedFileExtensions.some((e=>e===p))){if("__init__"===u)return;if(s&&!d.isPatternInSymbol(s,u))return;if(!this._isUniqueValidSuggestion(u,r)||!this._isResolvableSuggestion(u,a,o,e,n,c))return;r.add(u)}})),p.directories.forEach((t=>{s&&!t.startsWith(s)||this._isUniqueValidSuggestion(t,r)&&this._isResolvableSuggestion(t,a,o,e,n,c)&&r.add(t)}))}_isResolvableSuggestion(e,t,n,i,s,r){const a={leadingDots:t,nameParts:[...n,e],importedSymbols:[]};if(r){const e=this.formatImportName(a),t=[];return this._resolveImportStrict(e,i,s,a,t).isImportFound}return this._resolveImport(i,s,a).isImportFound}_isUniqueValidSuggestion(e,t){return!(t.has(e)||/[.-]/.test(e)||(0,T.isDunderName)(e)&&"__future__"!==e)}filterImplicitImports(e,t){if(void 0===t){const t=Object.assign({},e);return t.filteredImplicitImports=[],t}if(0===t.length)return e;if(0===e.implicitImports.length)return e;const n=e.implicitImports.filter((e=>t.some((t=>t===e.name))));if(n.length===e.implicitImports.length)return e;const i=Object.assign({},e);return i.filteredImplicitImports=n,i}_findImplicitImports(e,t,n){const i=new Map,s=(0,l.getFileSystemEntriesFromDirEntries)(this.readdirEntriesCached(t),this.fileSystem,t);for(const r of s.files){const s=(0,l.getFileExtension)(r);let a,o=!1;if(".py"===s||".pyi"===s)a=(0,l.stripFileExtension)(r);else{if(!this._isNativeModuleFileExtension(s)||this.fileExistsCached(`${r}.py`)||this.fileExistsCached(`${r}.pyi`))continue;a=r.substr(0,r.indexOf(".")),o=!0}const c=(0,l.combinePaths)(t,r);if(!n.find((e=>e===c))){const n={isStubFile:r.endsWith(".pyi"),isNativeLib:o,name:a,path:c},s=i.get(n.name);if(!s||!s.isStubFile){if(o){const i=(0,l.combinePaths)(t,r),s=this.resolveNativeImportEx(i,`${e}.${a}`,[]);s&&(n.path=s,n.isNativeLib=!1)}i.set(n.name,n)}}}for(const e of s.directories){const s=(0,l.combinePaths)(t,e,"__init__.py"),r=s+"i";let a=!1,o="";if(this.fileExistsCached(r)?(a=!0,o=r):this.fileExistsCached(s)&&(o=s),o&&!n.find((e=>e===o))){const t={isStubFile:a,isNativeLib:!1,name:e,path:o};i.set(t.name,t)}}return[...i.values()]}formatImportName(e){return".".repeat(e.leadingDots)+e.nameParts.join(".")}_resolveNativeModuleStub(e,t,n,i,s,r){let a=n;if(i.leadingDots>0){const n=this.getModuleNameForImport(e,t);a=n.moduleName.length>0?n.moduleName:a}const o=this.resolveNativeImportEx(e,a,s);return o?(s.push(`Resolved native import ${n} with stub '${o}'`),r.push(o),!1):(s.push(`Resolved import with file '${e}'`),r.push(e),!0)}_isNativeModuleFileName(e,t){const n=(0,l.getFileExtension)(t,!1).toLowerCase(),i=(0,l.stripFileExtension)(t,!0);return this._isNativeModuleFileExtension(n)&&(0,p.equateStringsCaseInsensitive)(e,i)}_isNativeModuleFileExtension(e){return _.some((t=>t===e))}_tryWalkUp(e){return(0,l.isDiskPathRoot)(e)?[!1,""]:[!0,(0,l.ensureTrailingDirectorySeparator)((0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)((0,l.combinePaths)(e,".."))))]}_shouldWalkUp(e,t,n){return e.length>t.length||e===t&&!n.root}getParentImportResolutionRoot(e,t){return t?(0,l.ensureTrailingDirectorySeparator)((0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)(t))):(0,l.ensureTrailingDirectorySeparator)((0,l.getDirectoryPath)(e))}}},7012:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getDirectoryLeadingDotsPointsTo=t.getRelativeModuleName=t.getTextRangeForImportNameDeletion=t.getImportGroupFromModuleNameAndType=t.getAllImportNames=t.getContainingImportStatement=t.getTextEditsForAutoImportInsertion=t.getTextEditsForAutoImportInsertions=t.getTextEditsForAutoImportSymbolAddition=t.getTopLevelImports=t.compareImportStatements=t.getImportGroup=void 0;const a=n(3213),o=n(9489),l=n(6657),c=n(1464),p=n(7559),d=n(3550),u=r(n(563)),m=r(n(1766));function h(e){return e.importResult?0===e.importResult.importType?0:1===e.importResult.importType||e.importResult.isLocalTypingsFile?1:e.importResult.isRelative?3:2:2}function y(e){return m.isConstantName(e)?0:m.isTypeAliasName(e)?1:2}function g(e,t){const n=y(e)-y(t);if(0!==n)return n;const i=e.replace(/_/g,"="),s=t.replace(/_/g,"=");return(0,p.compareStringsCaseSensitive)(i,s)}function f(e,t,n,i){let s;for(const t of n.imports){if(g(t.name.value,e)>0)break;s=t}let r=!1,a="";if(n.imports.length>0){const e=(0,c.convertOffsetToPosition)(n.start,i.tokenizerOutput.lines),t=(0,c.convertOffsetToPosition)(n.imports[0].start,i.tokenizerOutput.lines),s=n.imports.length>1?(0,c.convertOffsetToPosition)(n.imports[1].start,i.tokenizerOutput.lines):void 0;if(t.line>e.line&&(void 0===s||s.line>t.line)){const e=i.tokenizerOutput.lines.getItemAt(t.line);a=i.text.substr(e.start,t.character),/^\s*$/.test(a)&&(r=!0)}}const o=s?d.TextRange.getEnd(s):n.imports.length>0?n.imports[0].start:n.start+n.length,l=(0,c.convertOffsetToPosition)(o,i.tokenizerOutput.lines),p=t?`${e} as ${t}`:`${e}`;let u;if(r){const e=i.tokenizerOutput.predominantEndOfLineSequence;u=s?`,${e}${a}${p}`:`${p},${e}${a}`}else u=s?`, ${p}`:`${p}, `;return{range:{start:l,end:l},importName:e,replacementText:u}}function T(e,t){if(t.length<2)return t.map((e=>s(e)));const n=[...(0,o.createMapFromItems)(t,(e=>`${e.importGroup} ${d.Range.print(e.range)}`))].sort(((e,t)=>(0,p.compareStringsCaseSensitive)(e[0],t[0]))).map((e=>e[1])),i=[];for(const t of n)1===t.length?i.push(s(t[0])):i.push({range:t[0].range,replacementText:t[0].preChange+t.map((e=>e.importStatement)).sort(((e,t)=>r(e,t))).join(e.tokenizerOutput.predominantEndOfLineSequence)+t[0].postChange});return i;function s(e){return{range:e.range,replacementText:e.preChange+e.importStatement+e.postChange}}function r(e,t){const n=e.startsWith("import");return n===t.startsWith("import")?e<t?-1:1:n?-1:1}}function _(e,t,n,i,s,r){const a=[];0===(e=Array.isArray(e)?e:[e]).length&&e.push({});const l=(0,o.createMapFromItems)(e,(e=>e.name?"from":"import")),p=l.get("import");p&&y(p,(e=>`import ${e.join(", ")}`));const u=l.get("from");return u&&y(u,(e=>`from ${n} import ${e.join(", ")}`)),a;function y(e,l){const p=e.map((e=>function(e,t){const n=e.name?e.name:t;return{sortText:n,text:e.alias?`${n} as ${e.alias}`:n}}(e,n))).sort(((e,t)=>g(e.sortText,t.sortText))).reduce(((e,t)=>(0,o.addIfUnique)(e,t.text)),[]);a.push(function(e,t,n,i,s,r){let a,o="",l="";const p=(0,c.convertPositionToOffset)(r,s.tokenizerOutput.lines);if(t.orderedImports.length>0&&p>t.orderedImports[0].node.start){let e=!0,r=t.orderedImports[0],p=0;for(const a of t.orderedImports){const l=a.importResult?h(a):p;if(i<l){!e&&p<i&&(o=s.tokenizerOutput.predominantEndOfLineSequence+o);break}if(i===l&&a.moduleName>n)break;if(a.followsNonImportStatement){i>p&&(o=s.tokenizerOutput.predominantEndOfLineSequence+o);break}a===t.orderedImports[t.orderedImports.length-1]&&i>l&&(o=s.tokenizerOutput.predominantEndOfLineSequence+o),e=!e&&i<p&&i===l,p=l,r=a}r?(e?l+=s.tokenizerOutput.predominantEndOfLineSequence:o=s.tokenizerOutput.predominantEndOfLineSequence+o,a=(0,c.convertOffsetToPosition)(e?r.node.start:d.TextRange.getEnd(r.node),s.tokenizerOutput.lines)):a={line:0,character:0}}else{a={line:0,character:0};let e=!1;for(const t of s.parseTree.statements){let n=!0;if(47===t.nodeType&&1===t.statements.length){const e=t.statements[0];(48===e.nodeType||3===e.nodeType&&38===e.leftExpression.nodeType&&m.isDunderName(e.leftExpression.value))&&(n=!1)}if(n){a=(0,c.convertOffsetToPosition)(t.start,s.tokenizerOutput.lines),e=!1;break}a=(0,c.convertOffsetToPosition)(t.start+t.length,s.tokenizerOutput.lines),e=!0}l=l+s.tokenizerOutput.predominantEndOfLineSequence+s.tokenizerOutput.predominantEndOfLineSequence,e?o=s.tokenizerOutput.predominantEndOfLineSequence+o:l+=s.tokenizerOutput.predominantEndOfLineSequence}return{range:{start:a,end:a},preChange:o,importStatement:e,postChange:l,importGroup:i}}(l(p),t,n,i,s,r))}}function v(e){let t="";for(let n=0;n<e.leadingDots;n++)t+=".";return t+=e.nameParts.map((e=>e.value)).join("."),t}function b(e){let t=2;return e.isLocalTypingsFile||1===e.importType?t=1:0===e.importType&&(t=0),t}t.getImportGroup=h,t.compareImportStatements=function(e,t){const n=h(e),i=h(t);return n<i?-1:n>i?1:e.moduleName<t.moduleName?-1:1},t.getTopLevelImports=function(e,t=!1){const n={orderedImports:[],mapByFilePath:new Map};let i=!1,s=!1;return e.statements.forEach((e=>{47===e.nodeType?e.statements.forEach((e=>{20===e.nodeType?(s=!0,function(e,t,n){e.list.forEach((i=>{const s=u.getImportInfo(i.module);let r;s&&s.isImportFound&&(r=s.resolvedPaths[s.resolvedPaths.length-1]);const a={node:e,subnode:i,importResult:s,resolvedPath:r,moduleName:v(i.module),followsNonImportStatement:n};t.orderedImports.push(a),r&&(t.mapByFilePath.has(r)||t.mapByFilePath.set(r,a))}))}(e,n,i),i=!1):22===e.nodeType?(s=!0,function(e,t,n,i){var s;const r=u.getImportInfo(e.module);let a;if(r&&r.isImportFound&&(a=r.resolvedPaths[r.resolvedPaths.length-1]),i&&r){t.implicitImports=null!==(s=t.implicitImports)&&void 0!==s?s:new Map;for(const n of r.implicitImports){const i=e.imports.find((e=>e.name.value===n.name));i&&t.implicitImports.set(n.path,i)}}const o={node:e,importResult:r,resolvedPath:a,moduleName:v(e.module),followsNonImportStatement:n};if(t.orderedImports.push(o),a){const e=t.mapByFilePath.get(a);(!e||20===e.node.nodeType||e.moduleName.length>o.moduleName.length)&&t.mapByFilePath.set(a,o)}}(e,n,i,t),i=!1):i=s})):i=s})),n},t.getTextEditsForAutoImportSymbolAddition=function(e,t,n){const i=[];if(!t.node||22!==t.node.nodeType||t.node.isWildcardImport)return i;const s=t.node;if(0===(e=(Array.isArray(e)?e:[e]).filter((e=>!!e.name&&!s.imports.some((t=>t.name.value===e.name&&t.alias===e.alias))))).length)return i;for(const s of e)i.push(f(s.name,s.alias,t.node,n));const r=(0,o.createMapFromItems)(i,(e=>d.Range.print(e.range))),a=[];for(const e of r.values())1===e.length?a.push(e[0]):a.push({range:e[0].range,replacementText:e.sort(((e,t)=>g(e.importName,t.importName))).map((e=>e.replacementText)).join("")});return a},t.getTextEditsForAutoImportInsertions=function(e,t,n,i){const s=[];if(0===(e=Array.isArray(e)?e:[e]).length)return[];const r=(0,o.createMapFromItems)(e,(e=>e.module.moduleName));for(const e of r.values())s.push(..._(e,t,e[0].module.moduleName,b(e[0].module),n,i));return T(n,s)},t.getTextEditsForAutoImportInsertion=function(e,t,n,i,s,r){return T(s,_(e,t,n,i,s,r))},t.getContainingImportStatement=function(e,t){for(;e&&((0,a.throwIfCancellationRequested)(t),20!==e.nodeType&&22!==e.nodeType);)e=e.parent;return e},t.getAllImportNames=function(e){return 20===e.nodeType?e.list:e.imports},t.getImportGroupFromModuleNameAndType=b,t.getTextRangeForImportNameDeletion=function(e,t){let n;if(1===e.length&&0===t)n=e[0];else if(t===e.length-1){const i=d.TextRange.getEnd(e[t-1]);n={start:i,length:d.TextRange.getEnd(e[t])-i}}else{const i=e[t].start;n={start:i,length:e[t+1].start-i}}return n},t.getRelativeModuleName=function(e,t,n,i=!1,s){let r,a=t;(s=void 0!==s?s:(0,l.isFile)(e,t))&&(a=(0,l.getDirectoryPath)(t));let o=n;if(s){o=(0,l.getDirectoryPath)(n);const e=(0,l.stripFileExtension)((0,l.getFileName)(n));"__init__"!==e?r=e:i&&(r=(0,l.getFileName)(o),o=(0,l.getDirectoryPath)(o))}const c=(0,l.getRelativePathComponentsFromDirectory)(a,o,(t=>e.realCasePath(t)));let p=".";for(let e=1;e<c.length;e++){const t=c[e];p+=".."===t?".":t,".."!==t&&e!==c.length-1&&(p+=".")}return r&&(p="."===p[p.length-1]?p+r:p+"."+r),p},t.getDirectoryLeadingDotsPointsTo=function(e,t){let n=e;for(let e=1;e<t;e++){if(""===n)return;n=(0,l.getDirectoryPath)(n)}return n}},118:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.updateNamedTupleBaseClass=t.createNamedTupleType=void 0;const a=n(1464),o=n(3550),l=n(2122),c=n(563),p=r(n(8494)),d=n(817),u=n(1133),m=n(5168);function h(e,t,n){const i=e.details.mro.findIndex((e=>(0,u.isInstantiableClass)(e)&&u.ClassType.isBuiltIn(e,"NamedTuple")));if(i<0||e.details.mro.length<i+2)return;const s=e.details.mro[i],r=e.details.mro[i+1];if(!(0,u.isInstantiableClass)(r)||!(0,m.isTupleClass)(r))return;const a=(0,m.specializeTupleClass)(r,t,n),o=u.ClassType.cloneForSpecialization(s,[],n);o.details={...o.details},o.details.mro=[...o.details.mro],o.details.mro[1]=a.details.mro[0],o.details.baseClasses=o.details.baseClasses.map((e=>(0,u.isInstantiableClass)(e)&&(0,m.isTupleClass)(e)?a:e)),e.details.mro[i]=o,e.details.mro[i+1]=a,e.details.baseClasses=e.details.baseClasses.map((e=>(0,u.isInstantiableClass)(e)&&u.ClassType.isBuiltIn(e,"NamedTuple")?o:e))}t.createNamedTupleType=function(e,t,n,i){const s=(0,c.getFileInfo)(t);let r="namedtuple";if(0===n.length)e.addError(l.Localizer.Diagnostic.namedTupleFirstArg(),t);else{const i=n[0];0!==i.argumentCategory?e.addError(l.Localizer.Diagnostic.namedTupleFirstArg(),n[0].valueExpression||t):i.valueExpression&&48===i.valueExpression.nodeType&&(r=i.valueExpression.strings.map((e=>e.value)).join(""))}const y=n.find((e=>{var t;return"defaults"===(null===(t=e.name)||void 0===t?void 0:t.value)}));let g=0;if(y&&y.valueExpression){const t=e.getTypeOfExpression(y.valueExpression).type;g=(0,u.isClassInstance)(t)&&(0,m.isTupleClass)(t)&&!(0,m.isOpenEndedTupleClass)(t)&&t.tupleTypeArguments?t.tupleTypeArguments.length:void 0}const f=e.getTypingType(t,"NamedTuple")||u.UnknownType.create(),T=u.ClassType.createInstantiable(r,p.getClassFullName(t,s.moduleName,r),s.moduleName,s.filePath,16777216,p.getTypeSourceId(t),void 0,(0,u.isInstantiableClass)(f)?f.details.effectiveMetaclass:u.UnknownType.create());T.details.baseClasses.push(f),T.details.typeVarScopeId=e.getScopeIdForNode(t);const _=T.details.fields;_.set("__class__",d.Symbol.createWithType(68,T));const v=(0,m.synthesizeTypeVarForSelfCls)(T,!0),b=u.FunctionType.createInstance("__new__","","",65);b.details.declaredReturnType=(0,m.convertToInstance)(v),p.isAssignmentToDefaultsFollowingNamedTuple(t)&&(b.details.flags|=32),u.FunctionType.addParameter(b,{category:0,name:"cls",type:v,hasDeclaredType:!0});const I=[],C={category:0,name:"self",type:(0,m.synthesizeTypeVarForSelfCls)(T,!1),hasDeclaredType:!0};let S=!1;const F=[];if(n.length<2)e.addError(l.Localizer.Diagnostic.namedTupleSecondArg(),t),S=!0;else{const t=n[1];if(0!==t.argumentCategory)S=!0;else if(!i&&t.valueExpression&&48===t.valueExpression.nodeType){const e=t.valueExpression.strings.map((e=>e.value)).join("").split(/[,\s]+/),n=void 0===g?0:Math.max(0,e.length-g);e.forEach(((e,r)=>{if(e=e.trim()){const l=u.UnknownType.create(),c={category:0,name:e,type:l,hasDeclaredType:i,hasDefault:r>=n};u.FunctionType.addParameter(b,c);const p=d.Symbol.createWithType(8,l);I.push(e);const m=t.valueExpression,h={type:1,node:m,path:s.filePath,range:(0,a.convertOffsetsToRange)(m.start,o.TextRange.getEnd(m),s.lines),moduleName:s.moduleName};p.addDeclaration(h),_.set(e,p),F.push(l)}}))}else if(t.valueExpression&&31===t.valueExpression.nodeType){const n=t.valueExpression,r=new Map,c=void 0===g?0:Math.max(0,n.entries.length-g);n.entries.forEach(((t,n)=>{let p,h,y,g="";i?52===t.nodeType&&2===t.expressions.length?(y=t.expressions[0],p=t.expressions[1],h=(0,m.convertToInstance)(e.getTypeForExpressionExpectingType(p,!1).type)):e.addError(l.Localizer.Diagnostic.namedTupleNameType(),t):(y=t,h=u.UnknownType.create()),y&&48===y.nodeType?(g=y.strings.map((e=>e.value)).join(""),g||e.addError(l.Localizer.Diagnostic.namedTupleEmptyName(),y)):S=!0,g||(g=`_${n.toString()}`),r.has(g)&&e.addError(l.Localizer.Diagnostic.namedTupleNameUnique(),y||t),r.set(g,g),h||(h=u.UnknownType.create());const f={category:0,name:g,type:h,hasDeclaredType:i,hasDefault:n>=c};u.FunctionType.addParameter(b,f),F.push(h),I.push(g);const T=d.Symbol.createWithType(8,h);if(y&&48===y.nodeType){const e={type:1,node:y,path:s.filePath,typeAnnotationNode:p,range:(0,a.convertOffsetsToRange)(y.start,o.TextRange.getEnd(y),s.lines),moduleName:s.moduleName};T.addDeclaration(e)}_.set(g,T)}))}else S=!0}S&&(b.details.parameters=[],u.FunctionType.addDefaultParameters(b),F.push(u.AnyType.create(!1)),F.push(u.AnyType.create(!0)));const D=u.FunctionType.createInstance("__init__","","",192);u.FunctionType.addParameter(D,C),u.FunctionType.addDefaultParameters(D),D.details.declaredReturnType=u.NoneType.createInstance(),_.set("__new__",d.Symbol.createWithType(4,b)),_.set("__init__",d.Symbol.createWithType(4,D));const P=u.FunctionType.createInstance("keys","","",64),x=u.FunctionType.createInstance("items","","",64);P.details.declaredReturnType=e.getBuiltInObject(t,"list",[e.getBuiltInObject(t,"str")]),x.details.declaredReturnType=P.details.declaredReturnType,_.set("keys",d.Symbol.createWithType(8,P)),_.set("items",d.Symbol.createWithType(8,x));const A=u.FunctionType.createInstance("__len__","","",64);if(A.details.declaredReturnType=e.getBuiltInObject(t,"int"),u.FunctionType.addParameter(A,C),_.set("__len__",d.Symbol.createWithType(4,A)),S){const n=u.FunctionType.createInstance("__getattribute__","","",64);n.details.declaredReturnType=u.AnyType.create(),u.FunctionType.addParameter(n,C),u.FunctionType.addParameter(n,{category:0,name:"name",type:e.getBuiltInObject(t,"str")}),_.set("__getattribute__",d.Symbol.createWithType(4,n))}const k=e.getBuiltInType(t,"tuple"),E=e.getBuiltInType(t,"str");if(!S&&E&&(0,u.isInstantiableClass)(E)&&k&&(0,u.isInstantiableClass)(k)){const e=I.map((e=>u.ClassType.cloneAsInstance(u.ClassType.cloneWithLiteral(E,e)))),t=u.ClassType.cloneAsInstance((0,m.specializeTupleClass)(k,e));_.set("__match_args__",d.Symbol.createWithType(4,t))}return(0,m.computeMroLinearization)(T),h(T,F,!S),T},t.updateNamedTupleBaseClass=h},3942:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.getEmptyReport=t.SymbolCategory=void 0,(n=t.SymbolCategory||(t.SymbolCategory={}))[n.Indeterminate=0]="Indeterminate",n[n.Module=1]="Module",n[n.Class=2]="Class",n[n.Variable=3]="Variable",n[n.Constant=4]="Constant",n[n.Function=5]="Function",n[n.Method=6]="Method",n[n.TypeVar=7]="TypeVar",n[n.TypeAlias=8]="TypeAlias",t.getEmptyReport=function(e,t,n){return{packageName:e,ignoreExternal:n,rootDirectory:t,pyTypedPath:void 0,missingFunctionDocStringCount:0,missingClassDocStringCount:0,missingDefaultParamCount:0,alternateSymbolNames:new Map,modules:new Map,generalDiagnostics:[],symbols:new Map}}},2559:(e,t,n)=>{e=n.nmd(e),Object.defineProperty(t,"__esModule",{value:!0}),t.PackageTypeVerifier=void 0;const i=n(2930),s=n(5839),r=n(1290),a=n(3584),o=n(6657),l=n(3550),c=n(2374),p=n(3942),d=n(8408),u=n(1277),m=n(5083),h=n(1766),y=n(1133),g=n(5168);class f{constructor(e,t,n=!1){this._fileSystem=e,this._packageName=t,this._ignoreExternal=n,this._configOptions=new i.ConfigOptions(""),n&&(this._configOptions.evaluateUnknownImportsAsAny=!0),this._execEnv=this._configOptions.findExecEnvironment("."),this._importResolver=new c.ImportResolver(this._fileSystem,this._configOptions,new a.FullAccessHost(this._fileSystem)),this._program=new d.Program(this._importResolver,this._configOptions)}verify(){const e=this._packageName.trim(),t=e.split("."),n=(0,p.getEmptyReport)(t[0],this._getDirectoryForPackage(t[0])||"",this._ignoreExternal),i=n.generalDiagnostics;try{if(e)if(n.rootDirectory){const s=(0,u.getPyTypedInfo)(this._fileSystem,n.rootDirectory);if(s){n.pyTypedPath=s.pyTypedPath;const a=this._getListOfPublicModules(n.rootDirectory,t[0],e);0===a.length&&i.push(new r.Diagnostic(0,`Module "${e}" cannot be resolved`,(0,l.getEmptyRange)()));const o=new Map;a.forEach((e=>{this._getPublicSymbolsForModule(e,o,n.alternateSymbolNames)})),a.forEach((e=>{this._verifyTypesForModule(e,o,n)}))}else i.push(new r.Diagnostic(0,"No py.typed file found",(0,l.getEmptyRange)()))}else i.push(new r.Diagnostic(0,`Package "${e}" cannot be resolved`,(0,l.getEmptyRange)()));else i.push(new r.Diagnostic(0,`Package name "${e}" is invalid`,(0,l.getEmptyRange)()))}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);i.push(new r.Diagnostic(0,`An internal error occurred while verifying types: "${t}"`,(0,l.getEmptyRange)()))}return n}static getSymbolCategoryString(e){switch(e){case p.SymbolCategory.Class:return"class";case p.SymbolCategory.Function:return"function";case p.SymbolCategory.Method:return"method";case p.SymbolCategory.Constant:return"constant";case p.SymbolCategory.Variable:return"variable";case p.SymbolCategory.Module:return"module";case p.SymbolCategory.TypeAlias:return"type alias";case p.SymbolCategory.TypeVar:return"type variable";case p.SymbolCategory.Indeterminate:return"symbol"}}_resolveImport(e){return this._importResolver.resolveImport("",this._execEnv,(0,c.createImportedModuleDescriptor)(e))}_getPublicSymbolsForModule(e,t,n){const i=this._resolveImport(e);if(i.isImportFound){const s=i.resolvedPaths[i.resolvedPaths.length-1];this._program.addTrackedFiles([s],!0,!0);const r=this._program.getBoundSourceFile(s);if(r){const i={name:e,path:s,isExported:!0},a=r.getParseResults().parseTree,o=(0,m.getScopeForNode)(a);this._getPublicSymbolsInSymbolTable(t,n,i,i.name,o.symbolTable,3)}}}_getPublicSymbolsInSymbolTable(e,t,n,i,s,r){s.forEach(((s,a)=>{if(!(0,h.isPrivateOrProtectedName)(a)&&!s.isIgnoredForProtocolMatch()&&!this._isSymbolTypeImplied(r,a)){const r=`${i}.${a}`;if(!s.isExternallyHidden()&&!s.isPrivateMember()&&!s.isPrivatePyTypedImport()){const i=this._program.getTypeForSymbol(s);e.set(r,r);const a=s.getTypedDeclarations();a.length>0&&a.find((e=>4===e.type))&&(0,y.isInstantiableClass)(i)&&this._getPublicSymbolsInSymbolTable(e,t,n,r,i.details.fields,2);const o=s.getDeclarations().find((e=>6===e.type));if(o&&6===o.type){const e=(0,g.getFullNameOfType)(this._program.getTypeForSymbol(s));e&&this._addAlternateSymbolName(t,e,r)}}}}))}_addAlternateSymbolName(e,t,n){if(t!==n){let i=e.get(t);i||(i=[],e.set(t,i)),i.some((e=>e===n))||i.push(n)}}_verifyTypesForModule(e,t,n){const i=this._resolveImport(e);if(i.isImportFound)if(i.isStubPackage)n.generalDiagnostics.push(new r.Diagnostic(0,`No inlined types found for module "${e}" because stub package was present`,(0,l.getEmptyRange)()));else{const s=i.resolvedPaths[i.resolvedPaths.length-1],a={name:e,path:s,isExported:!0};n.modules.set(s,a),this._program.addTrackedFiles([s],!0,!0);const o=this._program.getBoundSourceFile(s);if(o){const e=o.getParseResults().parseTree,i=(0,m.getScopeForNode)(e);this._verifySymbolsInSymbolTable(n,a.name,i.symbolTable,3,t)}else n.generalDiagnostics.push(new r.Diagnostic(0,`Could not bind file "${s}"`,(0,l.getEmptyRange)()))}else n.generalDiagnostics.push(new r.Diagnostic(0,`Could not resolve module "${e}"`,(0,l.getEmptyRange)()))}_getListOfPublicModules(e,t,n){let i=[];this._addPublicModulesRecursive(e,t,i);const s=[],r=new Map;return i=i.filter((e=>e.startsWith(n))),i.forEach((e=>{r.has(e)||(s.push(e),r.set(e,e))})),s}_addPublicModulesRecursive(e,t,n){this._fileSystem.readdirEntriesSync(e).forEach((i=>{let s=i.isFile(),r=i.isDirectory();if(i.isSymbolicLink()){const t=(0,o.tryStat)(this._fileSystem,(0,o.combinePaths)(e,i.name));t&&(s=t.isFile(),r=t.isDirectory())}if(s){const e=(0,o.getFileExtension)(i.name);if(".py"===e||".pyi"===e){const e=(0,o.stripFileExtension)(i.name);"__init__"===e?n.push(t):!(0,h.isPrivateOrProtectedName)(e)&&this._isLegalModulePartName(e)&&n.push(`${t}.${e}`)}}else r&&!(0,h.isPrivateOrProtectedName)(i.name)&&this._isLegalModulePartName(i.name)&&this._addPublicModulesRecursive((0,o.combinePaths)(e,i.name),`${t}.${i.name}`,n)}))}_isLegalModulePartName(e){return!!e.match(/[a-z_]+/)}_shouldIgnoreType(e,t){return e.ignoreExternal&&!t.startsWith(e.packageName)}_verifySymbolsInSymbolTable(t,n,i,s,r){if(this._shouldIgnoreType(t,n))return!0;let a=!0;return i.forEach(((i,o)=>{if(!((0,h.isPrivateOrProtectedName)(o)||i.isExternallyHidden()||i.isPrivateMember()||i.isPrivatePyTypedImport()||i.isIgnoredForProtocolMatch()||this._isSymbolTypeImplied(s,o))){const c=`${n}.${o}`,p=t.symbols.get(c);if(p)return void p.referenceCount++;const d=this._program.getTypeForSymbol(i),u=i.getTypedDeclarations(),m=u.length>0?u[u.length-1]:void 0;let h;if(4===(null==m?void 0:m.type)&&(0,y.isInstantiableClass)(d))h=this._getSymbolForClass(t,d,r);else if(6===(null==m?void 0:m.type)&&(0,y.isModule)(d))h=this._getSymbolForModule(t,d,r);else{const n=i.getDeclarations(),a=n.length>0?n[n.length-1]:void 0,p=(null==a?void 0:a.range)||(0,l.getEmptyRange)(),u=(null==a?void 0:a.path)||"",m=this._getSymbolCategory(i,d),y=r.has(c);h={category:m,name:o,fullName:c,filePath:e.path,isExported:y,typeKnownStatus:0,referenceCount:1,diagnostics:[]},this._addSymbol(t,h),this._isSymbolTypeImplied(s,o)||this._validateSymbolType(t,h,d,p,u,r)}0!==h.typeKnownStatus&&(a=!1)}})),a}_validateSymbolType(e,t,n,i,s,a){let o=!0;switch(n.typeAliasInfo&&n.typeAliasInfo.typeArguments&&n.typeAliasInfo.typeArguments.forEach(((e,r)=>{(0,y.isUnknown)(e)?(this._addSymbolError(t,`Type argument ${r+1} for type alias "${n.typeAliasInfo.name}" has unknown type`,i,s),o=!1):(0,g.isPartlyUnknown)(e)&&(this._addSymbolError(t,`Type argument ${r+1} for type alias "${n.typeAliasInfo.name}" has partially unknown type`,i,s),o=!1)})),n.category){case 0:case 2:case 3:case 4:case 10:return o;case 1:return this._addSymbolError(t,`Type unknown for ${f.getSymbolCategoryString(t.category)} "${t.fullName}"`,i,s),t.typeKnownStatus=2,!1;case 9:return(0,g.doForEachSubtype)(n,(n=>{this._validateSymbolType(e,t,n,i,s,a)||(o=!1)})),o||(t.typeKnownStatus=1),o;case 6:for(const r of n.overloads)this._validateSymbolType(e,t,r,i,s,a)||(o=!1);return o||(t.typeKnownStatus=1),o;case 5:return this._shouldIgnoreType(e,n.details.fullName)||this._validateFunctionType(e,n,a,t,i,s)||(t.typeKnownStatus=1,o=!1),o;case 7:if(y.TypeBase.isInstance(n)&&y.ClassType.isPropertyClass(n)){const i=n;return["fget","fset","fdel"].forEach((n=>{const s=i.details.fields.get(n),r=s?this._program.getTypeForSymbol(s):void 0;r&&(this._validateSymbolType(e,t,r,(0,l.getEmptyRange)(),"",a)||(o=!1))})),o}return this._shouldIgnoreType(e,n.details.fullName)||y.ClassType.isBuiltIn(n)||this._getSymbolForClass(e,n,a),n.typeArguments&&n.typeArguments.forEach(((e,a)=>{if((0,y.isUnknown)(e))this._addSymbolError(t,`Type argument ${a+1} for class "${n.details.name}" has unknown type`,i,s),o=!1;else if((0,g.isPartlyUnknown)(e)){const l=new r.DiagnosticAddendum;l.addMessage(`Type is ${this._program.printType(e,!1)}`),this._addSymbolError(t,`Type argument ${a+1} for class "${n.details.name}" has partially unknown type`+l.getString(),i,s),o=!1}})),o||(t.typeKnownStatus=1),o;case 8:if(!this._shouldIgnoreType(e,n.moduleName)){const r=this._getSymbolForModule(e,n,a);0!==r.typeKnownStatus&&(this._addSymbolError(t,`Module "${r.fullName}" is partially unknown`,i,s),o=!1)}return o||(t.typeKnownStatus=1),o}}_validateFunctionType(e,t,n,i,s,a,o){let c=!0;if(t.details.declaration&&!a&&(a=t.details.declaration.path),t.details.parameters.forEach(((p,d)=>{if(p.name)if(p.hasDeclaredType)if((0,y.isUnknown)(p.type))i&&(this._addSymbolError(i,`Type of parameter "${p.name}" is unknown`,s||(0,l.getEmptyRange)(),a||""),o&&o.createAddendum().addMessage(`Type of parameter "${p.name}" is unknown`)),c=!1;else{const t=new r.DiagnosticAddendum;if(!this._isTypeKnown(e,p.type,n,t.createAddendum())){if(t.addMessage(`Parameter type is "${this._program.printType(p.type,!1)}"`),i&&this._addSymbolError(i,`Type of parameter "${p.name}" is partially unknown`+t.getString(),s||(0,l.getEmptyRange)(),a||""),o){const e=o.createAddendum();e.addMessage(`Type of parameter "${p.name}" is partially unknown`),e.addAddendum(t)}c=!1}}else 0===d&&(y.FunctionType.isClassMethod(t)||y.FunctionType.isInstanceMethod(t)||y.FunctionType.isConstructorMethod(t))||(i&&this._addSymbolError(i,`Type annotation for parameter "${p.name}" is missing`,s||(0,l.getEmptyRange)(),a||""),o&&o.createAddendum().addMessage(`Type annotation for parameter "${p.name}" is missing`),c=!1)})),t.details.declaredReturnType)if((0,y.isUnknown)(t.details.declaredReturnType))i&&this._addSymbolError(i,"Return type is unknown",s||(0,l.getEmptyRange)(),a||""),c=!1;else{const p=new r.DiagnosticAddendum;if(!this._isTypeKnown(e,t.details.declaredReturnType,n,p.createAddendum())){if(p.addMessage(`Return type is "${this._program.printType(t.details.declaredReturnType,!1)}"`),i&&this._addSymbolError(i,"Return type is partially unknown"+p.getString(),s||(0,l.getEmptyRange)(),a||""),o){const e=o.createAddendum();e.addMessage("Return type is partially unknown"),e.addAddendum(p)}c=!1}}else"__init__"!==t.details.name&&(i&&this._addSymbolError(i,"Return type annotation is missing",s||(0,l.getEmptyRange)(),a||""),o&&o.createAddendum().addMessage("Return type annotation is missing"),c=!1);return t.details.docString||(null==i?void 0:i.isExported)&&!(0,h.isDunderName)(i.name)&&(i&&this._addSymbolWarning(i,`No docstring found for function "${i.fullName}"`,s||(0,l.getEmptyRange)(),a||""),e.missingFunctionDocStringCount++),t.details.parameters.find((e=>e.defaultType&&(0,g.isEllipsisType)(e.defaultType)))&&(i&&this._addSymbolWarning(i,`One or more default values in function "${i.fullName}" is specified as "..."`,s||(0,l.getEmptyRange)(),a||""),e.missingDefaultParamCount++),!c&&i&&(i.typeKnownStatus=1),c}_getSymbolForClass(e,t,n){const i=e.symbols.get(t.details.fullName);if(i)return i.referenceCount++,i;const s={category:p.SymbolCategory.Class,name:t.details.name,fullName:t.details.fullName,filePath:t.details.filePath,isExported:n.has(t.details.fullName),typeKnownStatus:0,referenceCount:1,diagnostics:[]};if(this._addSymbol(e,s),s.isExported&&!t.details.docString&&(this._addSymbolWarning(s,`No docstring found for class "${t.details.fullName}"`,(0,l.getEmptyRange)(),""),e.missingClassDocStringCount++),this._verifySymbolsInSymbolTable(e,t.details.fullName,t.details.fields,2,n)||(s.typeKnownStatus=1),t.details.effectiveMetaclass)if((0,y.isInstantiableClass)(t.details.effectiveMetaclass)){const i=new r.DiagnosticAddendum;this._isTypeKnown(e,t.details.effectiveMetaclass,n,i)||(this._addSymbolError(s,`Type of metaclass "${t.details.effectiveMetaclass}" is partially unknown`+i.getString(),(0,l.getEmptyRange)(),""),s.typeKnownStatus=1)}else this._addSymbolError(s,"Type of metaclass unknown",(0,l.getEmptyRange)(),""),s.typeKnownStatus=1;return t.details.baseClasses.forEach((t=>{if((0,y.isInstantiableClass)(t)){if(y.ClassType.isBuiltIn(t,"tuple"))return;const i=new r.DiagnosticAddendum;this._isTypeKnown(e,t,n,i)||(this._addSymbolError(s,`Type of base class "${t.details.fullName}" is partially unknown`+i.getString(),(0,l.getEmptyRange)(),""),s.typeKnownStatus=1)}else this._addSymbolError(s,"Type of base class unknown",(0,l.getEmptyRange)(),""),s.typeKnownStatus=1})),s}_getSymbolForModule(e,t,n){const i=e.symbols.get(t.moduleName);if(i)return i.referenceCount++,i;const s={category:p.SymbolCategory.Module,name:t.moduleName,fullName:t.moduleName,filePath:t.filePath,isExported:n.has(t.moduleName),typeKnownStatus:0,referenceCount:1,diagnostics:[]};return this._addSymbol(e,s),this._verifySymbolsInSymbolTable(e,t.moduleName,t.fields,3,n)||(s.typeKnownStatus=1),s}_isTypeKnown(e,t,n,i){let s=!0;switch(t.typeAliasInfo&&t.typeAliasInfo.typeArguments&&t.typeAliasInfo.typeArguments.forEach(((e,n)=>{(0,y.isUnknown)(e)?(i.addMessage(`Type argument ${n+1} for type alias "${t.typeAliasInfo.name}" has unknown type`),s=!1):(0,g.isPartlyUnknown)(e)&&(i.addMessage(`Type argument ${n+1} for type alias "${t.typeAliasInfo.name}" has partially unknown type`),s=!1)})),t.category){case 0:case 2:case 3:case 4:case 10:return s;case 1:return!1;case 9:return(0,g.doForEachSubtype)(t,(t=>{this._isTypeKnown(e,t,n,i.createAddendum())||(s=!1)})),s;case 6:for(const r of t.overloads)this._isTypeKnown(e,r,n,i.createAddendum())||(s=!1);return s;case 5:return this._shouldIgnoreType(e,t.details.fullName)||this._validateFunctionType(e,t,n,void 0,void 0,void 0,i)||(s=!1),s;case 7:return this._shouldIgnoreType(e,t.details.fullName)||y.ClassType.isBuiltIn(t)||this._getSymbolForClass(e,t,n),t.typeArguments&&t.typeArguments.forEach(((e,n)=>{(0,y.isUnknown)(e)?(i.addMessage(`Type argument ${n+1} for class "${t.details.name}" has unknown type`),s=!1):(0,g.isPartlyUnknown)(e)&&(i.addMessage(`Type argument ${n+1} for class "${t.details.name}" has partially unknown type`),s=!1)})),s;case 8:return this._shouldIgnoreType(e,t.moduleName)||0!==this._getSymbolForModule(e,t,n).typeKnownStatus&&(s=!1),s}}_getSymbolCategory(e,t){if(t.typeAliasInfo)return p.SymbolCategory.TypeAlias;switch(t.category){case 5:case 6:{const t=e.getDeclarations().find((e=>3===e.type));return t&&t.isMethod?p.SymbolCategory.Method:p.SymbolCategory.Function}case 7:{if(y.TypeBase.isInstantiable(t))return p.SymbolCategory.Class;const n=e.getDeclarations().find((e=>1===e.type));return n&&(n.isConstant||n.isFinal)?p.SymbolCategory.Constant:p.SymbolCategory.Variable}case 8:return p.SymbolCategory.Module;case 10:return p.SymbolCategory.TypeVar;default:{const t=e.getDeclarations().find((e=>1===e.type));return t?t.isConstant||t.isFinal?p.SymbolCategory.Constant:p.SymbolCategory.Variable:p.SymbolCategory.Indeterminate}}}_getDirectoryForPackage(e){const t=this._importResolver.resolveImport("",this._execEnv,(0,c.createImportedModuleDescriptor)(e));if(t.isImportFound){const e=t.resolvedPaths[t.resolvedPaths.length-1];return(0,o.getDirectoryPath)(e)}}_isSymbolTypeImplied(e,t){return 2===e?["__class__","__dict__","__doc__","__module__","__qualname__","__slots__","__all__","__weakref__"].some((e=>e===t)):3===e&&["__all__","__author__","__copyright__","__email__","__license__","__title__","__uri__","__version__"].some((e=>e===t))}_addSymbol(e,t){(0,s.assert)(!e.symbols.has(t.fullName)),e.symbols.set(t.fullName,t)}_addSymbolError(e,t,n,i){e.diagnostics.push({diagnostic:new r.Diagnostic(0,t,n),filePath:i})}_addSymbolWarning(e,t,n,i){e.diagnostics.push({diagnostic:new r.Diagnostic(1,t,n),filePath:i})}}t.PackageTypeVerifier=f},1012:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParentDirectoryCache=void 0;const i=n(9489),s=n(6657);t.ParentDirectoryCache=class{constructor(e){this._importRootGetter=e,this._importChecked=new Map,this._cachedResults=new Map,this._libPathCache=void 0}getImportResult(e,t,n){var i,s,r,a;const o=null===(i=this._cachedResults.get(t))||void 0===i?void 0:i.get(e);if(o)return null!=o?o:n;const l=null===(s=this._importChecked.get(t))||void 0===s?void 0:s.get(e);return l?l.importPath&&null!==(a=null===(r=this._cachedResults.get(t))||void 0===r?void 0:r.get(l.importPath))&&void 0!==a?a:n:void 0}checkValidPath(e,t,n){var i;return!!t.startsWith(n)&&(this._libPathCache=null!==(i=this._libPathCache)&&void 0!==i?i:this._importRootGetter().map((t=>(0,s.ensureTrailingDirectorySeparator)((0,s.normalizePathCase)(e,(0,s.normalizePath)(t))))).filter((e=>e!==n)).filter((e=>e.startsWith(n))),!this._libPathCache.some((e=>t.startsWith(e))))}checked(e,t,n){(0,i.getOrAdd)(this._importChecked,t,(()=>new Map)).set(e,n)}add(e){(0,i.getOrAdd)(this._cachedResults,e.importName,(()=>new Map)).set(e.path,e.importResult)}reset(){this._importChecked.clear(),this._cachedResults.clear(),this._libPathCache=void 0}}},4482:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ParseTreeCleanerWalker=void 0;const a=r(n(563)),o=n(427);class l extends o.ParseTreeWalker{constructor(e){super(),this._parseTree=e}clean(){this.walk(this._parseTree)}visitNode(e){return a.cleanNodeAnalysisInfo(e),super.visitNode(e)}}t.ParseTreeCleanerWalker=l},8494:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isFromImportModuleName=t.isImportAlias=t.isImportModuleName=t.isFunctionSuiteEmpty=t.getFileInfoFromNode=t.getModuleNode=t.isWriteAccess=t.printParseNodeType=t.getTokenOverlapping=t.getTokenAt=t.getCallNodeAndActiveParameterIndex=t.getEnclosingParameter=t.NameNodeWalker=t.isAssignmentToDefaultsFollowingNamedTuple=t.isDocString=t.getDocString=t.isWithinAssertExpression=t.isWithinTryBlock=t.isWithinLoop=t.isWithinAnnotationComment=t.isWithinTypeAnnotation=t.isWithinDefaultParamInitializer=t.isPartialMatchingExpression=t.isMatchingExpression=t.isSuiteEmpty=t.isNodeContainedWithinNodeType=t.isNodeContainedWithin=t.isClassVarAllowedForAssignmentTarget=t.isFinalAllowedForAssignmentTarget=t.getTypeAnnotationNode=t.getExecutionScopeNode=t.getTypeVarScopeNode=t.getEvaluationScopeNode=t.getEvaluationNodeForAssignmentExpression=t.getEnclosingSuiteOrModule=t.getEnclosingClassOrFunction=t.getEnclosingLambda=t.getEnclosingFunction=t.getEnclosingClassOrModule=t.getEnclosingModule=t.getEnclosingClass=t.getEnclosingSuite=t.printOperator=t.printExpression=t.printArgument=t.getTypeSourceId=t.getClassFullName=t.findNodeByOffset=t.findNodeByPosition=t.getNodeDepth=void 0,t.isUnannotatedFunction=t.getFullStatementRange=t.getStringValueRange=t.getStringNodeValueRange=t.isLastNameOfDottedName=t.isFirstNameOfDottedName=t.getFirstNameOfDottedName=t.getDottedName=t.getDottedNameWithGivenNodeAsLastName=t.getFirstAncestorOrSelf=t.getFirstAncestorOrSelfOfKind=t.isLastNameOfModuleName=t.isFromImportAlias=t.isFromImportName=void 0;const a=r(n(563)),o=n(5839),l=n(1464),c=n(3550),p=n(5275),d=n(563),u=n(427);function m(e,t){if(t<e.start||t>c.TextRange.getEnd(e))return;const n=(new u.ParseTreeWalker).visitNode(e);for(const e of n)if(e){const n=m(e,t);if(n)return n}return e}function h(e,t){let n="";return 1===e.argumentCategory?n="*":2===e.argumentCategory&&(n="**"),e.name&&(n+=e.name.value+"="),n+=y(e.valueExpression,t),n}function y(e,t=0){switch(e.nodeType){case 38:return e.value;case 35:return y(e.leftExpression,t)+"."+e.memberName.value;case 9:return y(e.leftExpression,t)+"("+e.arguments.map((e=>h(e,t))).join(", ")+")";case 24:return y(e.baseExpression,t)+"["+e.items.map((e=>h(e,t))).join(", ")+"]"+(e.trailingComma?",":"");case 55:return g(e.operator)+y(e.expression,t);case 7:{const n=y(e.leftExpression,t)+" "+g(e.operator)+" "+y(e.rightExpression,t);return e.parenthesized?`(${n})`:n}case 40:{let t=e.value.toString();return e.isImaginary&&(t+="j"),t}case 48:return 1&t&&e.typeAnnotation?y(e.typeAnnotation,t):e.strings.map((e=>y(e,t))).join(" ");case 49:{let t="";return 8&e.token.flags&&(t+="r"),16&e.token.flags&&(t+="u"),32&e.token.flags&&(t+="b"),64&e.token.flags&&(t+="f"),4&e.token.flags?1&e.token.flags?t+=`'''${e.token.escapedValue}'''`:t+=`"""${e.token.escapedValue}"""`:1&e.token.flags?t+=`'${e.token.escapedValue}'`:t+=`"${e.token.escapedValue}"`,t}case 3:return y(e.leftExpression,t)+" = "+y(e.rightExpression,t);case 4:return y(e.name,t)+" := "+y(e.rightExpression,t);case 54:return y(e.valueExpression,t)+": "+y(e.typeAnnotation,t);case 5:return y(e.leftExpression,t)+" "+g(e.operator)+" "+y(e.rightExpression,t);case 6:return"await "+y(e.expression,t);case 51:return y(e.ifExpression,t)+" if "+y(e.testExpression,t)+" else "+y(e.elseExpression,t);case 31:return`[${e.entries.map((e=>y(e,t))).join(", ")}]`;case 56:return"*"+y(e.expression,t);case 52:{const n=e.expressions.map((e=>y(e,t)));return 1===n.length?`(${n[0]}, )`:`(${n.join(", ")})`}case 60:return e.expression?"yield "+y(e.expression,t):"yield";case 61:return"yield from "+y(e.expression,t);case 18:return"...";case 32:{let n="<ListExpression>";return(0,p.isExpressionNode)(e.expression)?n=y(e.expression,t):17===e.expression.nodeType&&(n=`${y(e.expression.keyExpression,t)}: ${y(e.expression.valueExpression,t)}`),n+" "+e.comprehensions.map((e=>33===e.nodeType?(e.isAsync?"async ":"")+"for "+y(e.targetExpression,t)+` in ${y(e.iterableExpression,t)}`:`if ${y(e.testExpression,t)}`)).join(" ")}case 46:{let n="";return e.startValue&&(n+=y(e.startValue,t)),e.endValue&&(n+=": "+y(e.endValue,t)),e.stepValue&&(n+=": "+y(e.stepValue,t)),n}case 30:return"lambda "+e.parameters.map((e=>{let n="";return 1===e.category?n+="*":2===e.category&&(n+="**"),e.name&&(n+=e.name.value),e.defaultValue&&(n+=" = "+y(e.defaultValue,t)),n})).join(", ")+": "+y(e.expression,t);case 11:if(33===e.constType)return"True";if(15===e.constType)return"False";if(9===e.constType)return"__debug__";if(26===e.constType)return"None";break;case 15:{const n=`${e.entries.map((e=>17===e.nodeType?`${y(e.keyExpression,t)}: ${y(e.valueExpression,t)}`:y(e,t)))}`;return n?`{ ${n} }`:"{}"}case 16:return`**${y(e.expandExpression,t)}`;case 45:return e.entries.map((e=>y(e,t))).join(", ")}return"<Expression>"}function g(e){const t={0:"+",1:"+=",2:"=",3:"&",4:"&=",5:"~",6:"|",7:"|=",8:"^",9:"^=",10:"/",11:"/=",12:"==",13:"//",14:"//=",15:">",16:">=",17:"<<",18:"<<=",19:"<>",20:"<",21:"<=",22:"@",23:"@=",24:"%",25:"%=",26:"*",27:"*=",28:"!=",29:"**",30:"**=",31:">>",32:">>=",33:"-",34:"-=",36:"and",37:"or",38:"not",39:"is",40:"is not",41:"in",42:"not in"};return t[e]?t[e]:"unknown"}function f(e,t=!1){let n=e.parent;for(;n;){if(10===n.nodeType)return n;if(36===n.nodeType)return;if(28===n.nodeType&&t)return;n=n.parent}}function T(e){let t=e.parent;for(;t;){if(28===t.nodeType)return t;if(10===t.nodeType)return;t=t.parent}}function _(e){let t,n=e,i=!1;for(;n;){switch(41===n.nodeType&&t===n.name&&(i=!0),n.nodeType){case 28:if(n.parameters.some((e=>e===t))){if(i&&void 0!==(0,d.getScope)(n))return n}else if(t===n.suite&&void 0!==(0,d.getScope)(n))return n;break;case 30:if(n.parameters.some((e=>e===t))){if(i&&void 0!==(0,d.getScope)(n))return n}else if((!t||t===n.expression)&&void 0!==(0,d.getScope)(n))return n;break;case 10:if(t===n.suite&&void 0!==(0,d.getScope)(n))return n;break;case 32:case 36:if(void 0!==(0,d.getScope)(n))return n}t=n,n=n.parent}(0,o.fail)("Did not find evaluation scope")}function v(e,t){if(38===e.nodeType)return 38===t.nodeType?e.value===t.value:4===t.nodeType&&e.value===t.name.value;if(35===e.nodeType&&35===t.nodeType)return v(e.leftExpression,t.leftExpression)&&e.memberName.value===t.memberName.value;if(24===e.nodeType&&24===t.nodeType){if(!v(e.baseExpression,t.baseExpression))return!1;if(1!==t.items.length||t.trailingComma||t.items[0].name||0!==t.items[0].argumentCategory)return!1;if(40===e.items[0].valueExpression.nodeType){const n=e.items[0].valueExpression,i=t.items[0].valueExpression;return!(40!==i.nodeType||i.isImaginary||!i.isInteger)&&n.value===i.value}if(48===e.items[0].valueExpression.nodeType){const n=e.items[0].valueExpression,i=t.items[0].valueExpression;if(1===n.strings.length&&49===n.strings[0].nodeType&&48===i.nodeType&&1===i.strings.length&&49===i.strings[0].nodeType)return n.strings[0].value===i.strings[0].value}return!1}return!1}function b(e){if(0===e.statements.length||48!==e.statements[0].nodeType)return!1;const t=e.statements[0].strings;return 0!==t.length&&!t.some((e=>0!=(64&e.token.flags)))}t.getNodeDepth=function(e){let t=0,n=e;for(;n;)t++,n=n.parent;return t},t.findNodeByPosition=function(e,t,n){const i=(0,l.convertPositionToOffset)(t,n);if(void 0!==i)return m(e,i)},t.findNodeByOffset=m,t.getClassFullName=function(e,t,n){const i=[n];let s=e;for(;s;)s=f(s),s&&i.push(s.name.value);return i.push(t),i.reverse().join(".")},t.getTypeSourceId=function(e){return e.start},t.printArgument=h,t.printExpression=y,t.printOperator=g,t.getEnclosingSuite=function(e){let t=e.parent;for(;t;){if(50===t.nodeType)return t;t=t.parent}},t.getEnclosingClass=f,t.getEnclosingModule=function(e){let t=e.parent;for(;t;){if(36===t.nodeType)return t;t=t.parent}(0,o.fail)("Module node not found")},t.getEnclosingClassOrModule=function(e,t=!1){let n=e.parent;for(;n;){if(10===n.nodeType)return n;if(36===n.nodeType)return n;if(28===n.nodeType&&t)return;n=n.parent}},t.getEnclosingFunction=T,t.getEnclosingLambda=function(e){let t=e.parent;for(;t;){if(30===t.nodeType)return t;if(50===t.nodeType)return;t=t.parent}},t.getEnclosingClassOrFunction=function(e){let t=e.parent;for(;t;){if(28===t.nodeType)return t;if(10===t.nodeType)return t;t=t.parent}},t.getEnclosingSuiteOrModule=function(e,t=!1,n=!0){let i=e.parent;for(;i;){if(50===i.nodeType)return i;if(36===i.nodeType)return i;if(30===i.nodeType&&n)return;if(28===i.nodeType&&t)return;i=i.parent}},t.getEvaluationNodeForAssignmentExpression=function(e){let t=!1,n=_(e);for(;void 0!==n;)switch(n.nodeType){case 28:case 30:case 36:return n;case 10:return t?void 0:n;case 32:t=!0,n=_(n.parent);break;default:return}},t.getEvaluationScopeNode=_,t.getTypeVarScopeNode=function(e,t=!1){let n,i=e;for(;i;){switch(i.nodeType){case 28:if((n===i.suite||t)&&!i.decorators.some((e=>e===n)))return i;break;case 10:if(n===i.suite&&!i.decorators.some((e=>e===n)))return i}n=i,i=i.parent}},t.getExecutionScopeNode=function(e){let t=_(e);for(;10===t.nodeType||32===t.nodeType;)t=_(t.parent);return t},t.getTypeAnnotationNode=function(e){let t=e,n=e.parent;for(;n;){if(54===n.nodeType){if(n.typeAnnotation===t)return n;break}t=n,n=n.parent}},t.isFinalAllowedForAssignmentTarget=function(e){if(38===e.nodeType)return!0;if(35===e.nodeType){if(38!==e.leftExpression.nodeType)return!1;if(!f(e))return!1;const t=T(e);return!!t&&"__init__"===t.name.value}return!1},t.isClassVarAllowedForAssignmentTarget=function(e){return!!f(e,!0)},t.isNodeContainedWithin=function(e,t){let n=e;for(;n;){if(n===t)return!0;n=n.parent}return!1},t.isNodeContainedWithinNodeType=function(e,t){let n=e;for(;n;){if(n.nodeType===t)return!0;n=n.parent}return!1},t.isSuiteEmpty=function(e){let t=!1;for(const n of e.statements){if(47!==n.nodeType)return!1;for(const e of n.statements)if(18===e.nodeType)t=!0;else if(48!==e.nodeType)return!1}return t},t.isMatchingExpression=v,t.isPartialMatchingExpression=function e(t,n){return 35===t.nodeType?v(t.leftExpression,n)||e(t.leftExpression,n):24===t.nodeType&&(v(t.baseExpression,n)||e(t.baseExpression,n))},t.isWithinDefaultParamInitializer=function(e){let t,n=e;for(;n;){if(41===n.nodeType&&t===n.defaultValue)return!0;if(30===n.nodeType||28===n.nodeType||10===n.nodeType||36===n.nodeType)return!1;t=n,n=n.parent}return!1},t.isWithinTypeAnnotation=function(e,t){let n,i=e,s=!1;for(;i;){if(41===i.nodeType&&(n===i.typeAnnotation||n===i.typeAnnotationComment))return s||!t;if(28===i.nodeType&&n===i.returnTypeAnnotation)return s||!t;if(28===i.nodeType&&n===i.functionAnnotationComment)return!0;if(54===i.nodeType&&n===i.typeAnnotation)return s||!t;if(3===i.nodeType&&n===i.typeAnnotationComment)return!0;if(48===i.nodeType&&n===i.typeAnnotation&&(s=!0),30===i.nodeType||28===i.nodeType||10===i.nodeType||36===i.nodeType)return!1;n=i,i=i.parent}return!1},t.isWithinAnnotationComment=function(e){let t,n=e;for(;n;){if(28===n.nodeType&&t===n.functionAnnotationComment)return!0;if(3===n.nodeType&&t===n.typeAnnotationComment)return!0;if(30===n.nodeType||28===n.nodeType||10===n.nodeType||36===n.nodeType)return!1;t=n,n=n.parent}return!1},t.isWithinLoop=function(e){let t=e;for(;t;){switch(t.nodeType){case 26:case 57:return!0}t=t.parent}return!1},t.isWithinTryBlock=function(e,t=!1){let n,i=e;for(;i;){switch(i.nodeType){case 53:return i.trySuite===n;case 58:if(t&&i.suite===n)return!0;break;case 28:case 36:case 10:return!1}n=i,i=i.parent}return!1},t.isWithinAssertExpression=function(e){let t,n=e;for(;n;){if(2===n.nodeType)return n.testExpression===t;t=n,n=n.parent}return!1},t.getDocString=function(e){if(0===e.length)return;if(47!==e[0].nodeType)return;if(!b(e[0]))return;const t=e[0].statements[0].strings;return 1===t.length?t[0].value:t.map((e=>e.value)).join("")},t.isDocString=b,t.isAssignmentToDefaultsFollowingNamedTuple=function(e){var t,n;if(9!==e.nodeType||!e.parent||3!==e.parent.nodeType||38!==e.parent.leftExpression.nodeType||!e.parent.parent||47!==e.parent.parent.nodeType)return!1;const i=e.parent.leftExpression.value,s=e.parent.parent;if(s.statements[0]!==e.parent||!s.parent||36!==s.parent.nodeType&&50!==s.parent.nodeType)return!1;const r=s.parent;let a=r.statements.findIndex((e=>e===s));if(a<0)return!1;for(a++;a<r.statements.length;){const e=r.statements[a];if(47!==e.nodeType)break;if(48!==(null===(t=e.statements[0])||void 0===t?void 0:t.nodeType)){if(3===(null===(n=e.statements[0])||void 0===n?void 0:n.nodeType)){const t=e.statements[0];if(35===t.leftExpression.nodeType&&"__defaults__"===t.leftExpression.memberName.value){const e=t.leftExpression.leftExpression;if(35===e.nodeType&&"__new__"===e.memberName.value&&38===e.leftExpression.nodeType&&e.leftExpression.value===i)return!0}}break}a++}return!1};class I extends u.ParseTreeWalker{constructor(e){super(),this._callback=e}visitName(e){return this._callback(e,this._subscriptIndex,this._baseExpression),!0}visitIndex(e){this.walk(e.baseExpression);const t=this._subscriptIndex,n=this._baseExpression;return this._baseExpression=e.baseExpression,e.items.forEach(((e,t)=>{this._subscriptIndex=t,this.walk(e)})),this._subscriptIndex=t,this._baseExpression=n,!1}}function C(e,t){const n=e.getItemAtPosition(t);if(!(n<0))return e.getItemAt(n)}function S(e){let t=e;for(;t&&36!==t.nodeType;)t=t.parent;return t}function F(e,t){return D(e,(e=>e.nodeType===t))}function D(e,t){for(const n of function*(e){for(;void 0!==e;)yield e,e=e.parent}(e))if(t(n))return n}function P(e){const t=e.quoteMarkLength,n=!(65536&e.flags);return c.TextRange.create(e.start+t,e.length-t-(n?t:0))}t.NameNodeWalker=I,t.getEnclosingParameter=function(e){let t=e;for(;t;){if(41===t.nodeType)return t;t=t.parent}},t.getCallNodeAndActiveParameterIndex=function(e,t,n){let i,s=e;for(;void 0!==s;){if(9===s.nodeType&&d(s)){i=s;break}s=s.parent}if(!i||!i.arguments)return;const r=c.TextRange.getEnd(i);if(t>r)return;const a=C(n,r-1);if(t===r&&14===(null==a?void 0:a.type))return;let o=!1,l=-1,p=!1;return i.arguments.forEach(((e,i)=>{if(o)return;let s=e.start;const r=n.getItemAtPosition(s);r>=0&&(s=c.TextRange.getEnd(n.getItemAt(r-1)));let a=c.TextRange.getEnd(e);const d=n.getItemAtPosition(a);if(d>=0)for(let e=d;e<n.count;e++){const t=n.getItemAt(e);switch(t.type){case 12:case 14:break;default:continue}a=c.TextRange.getEnd(t);break}t<a&&(l=i,p=t>=s,o=!0)})),o||(l=i.arguments.length+1),{callNode:i,activeIndex:l,activeOrFake:p};function d(e,i){let s=!0;const r=e.leftExpression.length>0?c.TextRange.getEnd(e.leftExpression)-1:e.leftExpression.start,a=n.getItemAtPosition(r);if(a>=0&&a+1<n.count){const e=n.getItemAt(a+1);13===e.type&&t<c.TextRange.getEnd(e)&&(s=!1)}return s}},t.getTokenAt=C,t.getTokenOverlapping=function(e,t){const n=e.getItemAtPosition(t);if(n<0)return;const i=e.getItemAt(n);return c.TextRange.overlaps(i,t)?i:void 0},t.printParseNodeType=function(e){switch(e){case 0:return"Error";case 1:return"Argument";case 2:return"Assert";case 3:return"Assignment";case 4:return"AssignmentExpression";case 5:return"AugmentedAssignment";case 6:return"Await";case 7:return"BinaryOperation";case 8:return"Break";case 9:return"Call";case 10:return"Class";case 11:return"Constant";case 12:return"Continue";case 13:return"Decorator";case 14:return"Del";case 15:return"Dictionary";case 16:return"DictionaryExpandEntry";case 17:return"DictionaryKeyEntry";case 18:return"Ellipsis";case 19:return"If";case 20:return"Import";case 21:return"ImportAs";case 22:return"ImportFrom";case 23:return"ImportFromAs";case 24:return"Index";case 25:return"Except";case 26:return"For";case 27:return"FormatString";case 28:return"Function";case 29:return"Global";case 30:return"Lambda";case 31:return"List";case 32:return"ListComprehension";case 33:return"ListComprehensionFor";case 34:return"ListComprehensionIf";case 35:return"MemberAccess";case 36:return"Module";case 37:return"ModuleName";case 38:return"Name";case 39:return"Nonlocal";case 40:return"Number";case 41:return"Parameter";case 42:return"Pass";case 43:return"Raise";case 44:return"Return";case 45:return"Set";case 46:return"Slice";case 47:return"StatementList";case 48:return"StringList";case 49:return"String";case 50:return"Suite";case 51:return"Ternary";case 52:return"Tuple";case 53:return"Try";case 54:return"TypeAnnotation";case 55:return"UnaryOperation";case 56:return"Unpack";case 57:return"While";case 58:return"With";case 59:return"WithItem";case 60:return"Yield";case 61:return"YieldFrom";case 62:return"FunctionAnnotation";case 63:return"Match";case 64:return"Case";case 65:return"PatternSequence";case 66:return"PatternAs";case 67:return"PatternLiteral";case 68:return"PatternClass";case 69:return"PatternCapture";case 70:return"PatternMapping";case 71:return"PatternMappingKeyEntry";case 72:return"PatternMappingExpandEntry";case 73:return"PatternValue";case 74:return"PatternClassArgument"}(0,o.assertNever)(e)},t.isWriteAccess=function(e){let t=e,n=t.parent;for(;n;){switch(n.nodeType){case 3:case 5:return t===n.leftExpression;case 4:case 25:return t===n.name;case 14:return!0;case 26:case 33:return t===n.targetExpression;case 21:return t===n.alias||n.module.nameParts.length>0&&t===n.module.nameParts[0];case 23:return t===n.alias||!n.alias&&t===n.name;case 35:if(t!==n.memberName)return!1;break;case 58:return n.withItems.some((e=>e===t));case 54:if(t===n.typeAnnotation)return!1;break;case 28:case 10:case 36:return!1}t=n,n=n.parent}return!1},t.getModuleNode=S,t.getFileInfoFromNode=function(e){const t=S(e);return t?a.getFileInfo(t):void 0},t.isFunctionSuiteEmpty=function(e){let t=!0;return e.suite.statements.forEach((e=>{0!==e.nodeType&&(47===e.nodeType?e.statements.forEach((e=>{18!==e.nodeType&&48!==e.nodeType&&42!==e.nodeType&&(t=!1)})):t=!1)})),t},t.isImportModuleName=function(e){var t,n;return 21===(null===(n=null===(t=F(e,37))||void 0===t?void 0:t.parent)||void 0===n?void 0:n.nodeType)},t.isImportAlias=function(e){var t;return 21===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.alias===e},t.isFromImportModuleName=function(e){var t,n;return 22===(null===(n=null===(t=F(e,37))||void 0===t?void 0:t.parent)||void 0===n?void 0:n.nodeType)},t.isFromImportName=function(e){var t;return 23===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.name===e},t.isFromImportAlias=function(e){var t;return 23===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.alias===e},t.isLastNameOfModuleName=function(e){var t;if(37!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType))return!1;const n=e.parent;return 0!==n.nameParts.length&&n.nameParts[n.nameParts.length-1]===e},t.getFirstAncestorOrSelfOfKind=F,t.getFirstAncestorOrSelf=D,t.getDottedNameWithGivenNodeAsLastName=function(e){var t;return 35!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||e.parent.leftExpression===e?e:e.parent},t.getDottedName=function(e){if(38===e.nodeType)return[e];const t=[];return function e(t,n){return 38===t.nodeType?(n.push(t),!0):(n.push(t.memberName),(38===t.leftExpression.nodeType||35===t.leftExpression.nodeType)&&e(t.leftExpression,n))}(e,t)?t.reverse():void 0},t.getFirstNameOfDottedName=function e(t){return 38===t.nodeType?t:38===t.leftExpression.nodeType||35===t.leftExpression.nodeType?e(t.leftExpression):void 0},t.isFirstNameOfDottedName=function(e){var t;return 35!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||e.parent.leftExpression===e},t.isLastNameOfDottedName=function(e){var t,n;return 35!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||(38===e.parent.leftExpression.nodeType||35===e.parent.leftExpression.nodeType)&&e.parent.leftExpression!==e&&35!==(null===(n=e.parent.parent)||void 0===n?void 0:n.nodeType)},t.getStringNodeValueRange=function(e){return P(e.token)},t.getStringValueRange=P,t.getFullStatementRange=function(e,t){const n=(0,l.convertTextRangeToRange)(e,t.lines),i=function(e,t,n){const i=n.tokens.getItemAtPosition(t);if(i<0)return;let s=i;for(;s<n.tokens.count;s++){const t=n.tokens.getItemAt(s),i=(0,l.convertTextRangeToRange)(t,n.lines);if(e.end.line!==i.start.line)break}for(let e=i;e<s;e++){const t=n.tokens.getItemAt(e);if(11!==t.type&&2!==t.type)return(0,l.convertTextRangeToRange)(t,n.lines).start}}(n,c.TextRange.getEnd(e),t);return i?{start:n.start,end:i}:n.end.line===t.lines.count-1?n:{start:n.start,end:{line:n.end.line+1,character:0}}},t.isUnannotatedFunction=function(e){return void 0===e.returnTypeAnnotation&&e.parameters.every((e=>void 0===e.typeAnnotation&&void 0===e.typeAnnotationComment))}},427:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParseTreeWalker=void 0;const i=n(5839);t.ParseTreeWalker=class{walk(e){const t=this.visitNode(e);t.length>0&&this.walkMultiple(t)}walkMultiple(e){e.forEach((e=>{e&&this.walk(e)}))}visitNode(e){var t;switch(e.nodeType){case 1:if(this.visitArgument(e))return[e.name,e.valueExpression];break;case 2:if(this.visitAssert(e))return[e.testExpression,e.exceptionExpression];break;case 3:if(this.visitAssignment(e))return[e.leftExpression,e.rightExpression,e.typeAnnotationComment];break;case 4:if(this.visitAssignmentExpression(e))return[e.name,e.rightExpression];break;case 5:if(this.visitAugmentedAssignment(e))return[e.leftExpression,e.rightExpression];break;case 6:if(this.visitAwait(e))return[e.expression];break;case 7:if(this.visitBinaryOperation(e))return[e.leftExpression,e.rightExpression];break;case 8:if(this.visitBreak(e))return[];break;case 9:if(this.visitCall(e))return[e.leftExpression,...e.arguments];break;case 64:if(this.visitCase(e))return[e.pattern,e.guardExpression,e.suite];break;case 10:if(this.visitClass(e))return[...e.decorators,e.name,...e.arguments,e.suite];break;case 51:if(this.visitTernary(e))return[e.ifExpression,e.testExpression,e.elseExpression];break;case 11:if(this.visitConstant(e))return[];break;case 12:if(this.visitContinue(e))return[];break;case 13:if(this.visitDecorator(e))return[e.expression];break;case 14:if(this.visitDel(e))return e.expressions;break;case 15:if(this.visitDictionary(e))return e.entries;break;case 17:if(this.visitDictionaryKeyEntry(e))return[e.keyExpression,e.valueExpression];break;case 16:if(this.visitDictionaryExpandEntry(e))return[e.expandExpression];break;case 0:if(this.visitError(e))return[e.child,...null!==(t=e.decorators)&&void 0!==t?t:[]];break;case 19:if(this.visitIf(e))return[e.testExpression,e.ifSuite,e.elseSuite];break;case 20:if(this.visitImport(e))return e.list;break;case 21:if(this.visitImportAs(e))return[e.module,e.alias];break;case 22:if(this.visitImportFrom(e))return[e.module,...e.imports];break;case 23:if(this.visitImportFromAs(e))return[e.name,e.alias];break;case 24:if(this.visitIndex(e))return[e.baseExpression,...e.items];break;case 18:if(this.visitEllipsis(e))return[];break;case 25:if(this.visitExcept(e))return[e.typeExpression,e.name,e.exceptSuite];break;case 26:if(this.visitFor(e))return[e.targetExpression,e.iterableExpression,e.forSuite,e.elseSuite];break;case 27:if(this.visitFormatString(e))return e.expressions;break;case 28:if(this.visitFunction(e))return[...e.decorators,e.name,...e.parameters,e.returnTypeAnnotation,e.functionAnnotationComment,e.suite];break;case 62:if(this.visitFunctionAnnotation(e))return[...e.paramTypeAnnotations,e.returnTypeAnnotation];break;case 29:if(this.visitGlobal(e))return e.nameList;break;case 30:if(this.visitLambda(e))return[...e.parameters,e.expression];break;case 31:if(this.visitList(e))return e.entries;break;case 32:if(this.visitListComprehension(e))return[e.expression,...e.comprehensions];break;case 33:if(this.visitListComprehensionFor(e))return[e.targetExpression,e.iterableExpression];break;case 34:if(this.visitListComprehensionIf(e))return[e.testExpression];break;case 63:if(this.visitMatch(e))return[e.subjectExpression,...e.cases];break;case 35:if(this.visitMemberAccess(e))return[e.leftExpression,e.memberName];break;case 36:if(this.visitModule(e))return[...e.statements];break;case 37:if(this.visitModuleName(e))return e.nameParts;break;case 38:if(this.visitName(e))return[];break;case 39:if(this.visitNonlocal(e))return e.nameList;break;case 40:if(this.visitNumber(e))return[];break;case 41:if(this.visitParameter(e))return[e.name,e.typeAnnotation,e.typeAnnotationComment,e.defaultValue];break;case 42:if(this.visitPass(e))return[];break;case 69:if(this.visitPatternCapture(e))return[e.target];break;case 68:if(this.visitPatternClass(e))return[e.className,...e.arguments];break;case 74:if(this.visitPatternClassArgument(e))return[e.name,e.pattern];break;case 66:if(this.visitPatternAs(e))return[...e.orPatterns,e.target];break;case 67:if(this.visitPatternLiteral(e))return[e.expression];break;case 70:if(this.visitPatternMapping(e))return[...e.entries];break;case 71:if(this.visitPatternMappingKeyEntry(e))return[e.keyPattern,e.valuePattern];break;case 72:if(this.visitPatternMappingExpandEntry(e))return[e.target];break;case 65:if(this.visitPatternSequence(e))return[...e.entries];break;case 73:if(this.visitPatternValue(e))return[e.expression];break;case 43:if(this.visitRaise(e))return[e.typeExpression,e.valueExpression,e.tracebackExpression];break;case 44:if(this.visitReturn(e))return[e.returnExpression];break;case 45:if(this.visitSet(e))return e.entries;break;case 46:if(this.visitSlice(e))return[e.startValue,e.endValue,e.stepValue];break;case 47:if(this.visitStatementList(e))return e.statements;break;case 49:if(this.visitString(e))return[];break;case 48:if(this.visitStringList(e))return[e.typeAnnotation,...e.strings];break;case 50:if(this.visitSuite(e))return[...e.statements];break;case 52:if(this.visitTuple(e))return e.expressions;break;case 53:if(this.visitTry(e))return[e.trySuite,...e.exceptClauses,e.elseSuite,e.finallySuite];break;case 54:if(this.visitTypeAnnotation(e))return[e.valueExpression,e.typeAnnotation];break;case 55:if(this.visitUnaryOperation(e))return[e.expression];break;case 56:if(this.visitUnpack(e))return[e.expression];break;case 57:if(this.visitWhile(e))return[e.testExpression,e.whileSuite,e.elseSuite];break;case 58:if(this.visitWith(e))return[...e.withItems,e.suite];break;case 59:if(this.visitWithItem(e))return[e.expression,e.target];break;case 60:if(this.visitYield(e))return[e.expression];break;case 61:if(this.visitYieldFrom(e))return[e.expression];break;default:(0,i.fail)("Unexpected node type")}return[]}visitArgument(e){return!0}visitAssert(e){return!0}visitAssignment(e){return!0}visitAssignmentExpression(e){return!0}visitAugmentedAssignment(e){return!0}visitAwait(e){return!0}visitBinaryOperation(e){return!0}visitBreak(e){return!0}visitCall(e){return!0}visitCase(e){return!0}visitClass(e){return!0}visitTernary(e){return!0}visitContinue(e){return!0}visitConstant(e){return!0}visitDecorator(e){return!0}visitDel(e){return!0}visitDictionary(e){return!0}visitDictionaryKeyEntry(e){return!0}visitDictionaryExpandEntry(e){return!0}visitError(e){return!0}visitEllipsis(e){return!0}visitIf(e){return!0}visitImport(e){return!0}visitImportAs(e){return!0}visitImportFrom(e){return!0}visitImportFromAs(e){return!0}visitIndex(e){return!0}visitExcept(e){return!0}visitFor(e){return!0}visitFormatString(e){return!0}visitFunction(e){return!0}visitFunctionAnnotation(e){return!0}visitGlobal(e){return!0}visitLambda(e){return!0}visitList(e){return!0}visitListComprehension(e){return!0}visitListComprehensionFor(e){return!0}visitListComprehensionIf(e){return!0}visitMatch(e){return!0}visitMemberAccess(e){return!0}visitModule(e){return!0}visitModuleName(e){return!0}visitName(e){return!0}visitNonlocal(e){return!0}visitNumber(e){return!0}visitParameter(e){return!0}visitPass(e){return!0}visitPatternCapture(e){return!0}visitPatternClass(e){return!0}visitPatternClassArgument(e){return!0}visitPatternAs(e){return!0}visitPatternLiteral(e){return!0}visitPatternMappingExpandEntry(e){return!0}visitPatternSequence(e){return!0}visitPatternValue(e){return!0}visitPatternMappingKeyEntry(e){return!0}visitPatternMapping(e){return!0}visitRaise(e){return!0}visitReturn(e){return!0}visitSet(e){return!0}visitSlice(e){return!0}visitStatementList(e){return!0}visitString(e){return!0}visitStringList(e){return!0}visitSuite(e){return!0}visitTuple(e){return!0}visitTry(e){return!0}visitTypeAnnotation(e){return!0}visitUnaryOperation(e){return!0}visitUnpack(e){return!0}visitWhile(e){return!0}visitWith(e){return!0}visitWithItem(e){return!0}visitYield(e){return!0}visitYieldFrom(e){return!0}}},6061:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.assignTypeToPatternTargets=t.narrowTypeBasedOnPattern=void 0;const i=n(5839),s=n(9744),r=n(2122),a=n(563),o=n(9453),l=n(4610),c=n(1133),p=n(5168),d=n(1659),u=["builtins.bool","builtins.bytearray","builtins.bytes","builtins.dict","builtins.float","builtins.frozenset","builtins.int","builtins.list","builtins.set","builtins.str","builtins.tuple"];function m(e,t,n,i){switch(n.nodeType){case 65:return function(e,t,n,i){if(!i)return t;let s=f(e,t,n.entries.length,n.starEntryIndex);return s=s.filter((t=>{let i=!0;const s=[];let r=t.isTuple;if(n.entries.forEach(((a,o)=>{const l=T(e,n,t,o,n.entries.length,n.starEntryIndex,!0,!1),d=m(e,l,a,!0);o===n.starEntryIndex?(0,c.isClassInstance)(d)&&d.tupleTypeArguments&&!(0,p.isOpenEndedTupleClass)(d)&&d.tupleTypeArguments?s.push(...d.tupleTypeArguments):(s.push(d),r=!1):(s.push(d),(0,c.isNever)(d)&&(i=!1))})),i){if(r){const i=e.getBuiltInType(n,"tuple");i&&(0,c.isInstantiableClass)(i)&&(t.subtype=c.ClassType.cloneAsInstance((0,p.specializeTupleClass)(i,s)))}if(t.isObject){const i=e.getTypingType(n,"Sequence");i&&(0,c.isInstantiableClass)(i)&&(t.subtype=c.ClassType.cloneAsInstance(c.ClassType.cloneForSpecialization(i,[(0,p.stripLiteralValue)((0,c.combineTypes)(s))],!0)))}}return i})),(0,c.combineTypes)(s.map((e=>e.subtype)))}(e,t,n,i);case 67:return function(e,t,n,i){const s=e.getTypeOfExpression(n.expression).type;return i?(0,p.mapSubtypes)(t,(t=>{if(e.canAssignType(t,s))return s})):(0,p.mapSubtypes)(t,(t=>{if(!((0,c.isClassInstance)(s)&&(0,p.isLiteralType)(s)&&(0,c.isClassInstance)(t)&&(0,p.isLiteralType)(t)&&e.canAssignType(s,t)))return(0,c.isClassInstance)(t)&&c.ClassType.isBuiltIn(t,"bool")&&void 0===t.literalValue&&(0,c.isClassInstance)(s)&&c.ClassType.isBuiltIn(s,"bool")&&void 0!==s.literalValue?c.ClassType.cloneWithLiteral(s,!s.literalValue):t}))}(e,t,n,i);case 68:return function(e,t,n,i){let o=e.getTypeOfExpression(n.className,void 0,2).type;(0,c.isClass)(o)&&!o.typeAliasInfo&&(o=(0,p.specializeClassType)(o));const l=o;if(!i){if(!(0,c.isInstantiableClass)(l))return t;let i=n.arguments.length>0;if(1===n.arguments.length&&!n.arguments[0].name&&u.some((e=>l.details.fullName===e))&&(i=!1),i)return t;if(l.details.typeParameters.length>0)return t;const s=(0,p.convertToInstance)(l);return(0,p.mapSubtypes)(t,(t=>{if(!e.canAssignType(s,t))return t}))}return c.TypeBase.isInstantiable(l)?(o.typeAliasInfo&&((0,c.isUnion)(o)?e.addDiagnostic((0,a.getFileInfo)(n).diagnosticRuleSet.reportGeneralTypeIssues,s.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.DiagnosticAddendum.typeNotClass().format({type:e.printType(o)}),n.className):(0,c.isInstantiableClass)(o)&&o.typeArguments&&o.isTypeArgumentExplicit&&e.addDiagnostic((0,a.getFileInfo)(n).diagnosticRuleSet.reportGeneralTypeIssues,s.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.DiagnosticAddendum.classPatternTypeAlias().format({type:e.printType(o)}),n.className)),e.mapSubtypesExpandTypeVars(l,void 0,((i,s)=>(0,c.isAnyOrUnknown)(i)?s:(0,c.isInstantiableClass)(i)?e.mapSubtypesExpandTypeVars(t,void 0,(t=>{const r=e.makeTopLevelTypeVarsConcrete(t);if((0,c.isAnyOrUnknown)(r))return t;if((0,c.isClassInstance)(r)){let a;if(e.canAssignType(i,c.ClassType.cloneAsInstantiable(r)))a=t;else{if(!e.canAssignType(c.ClassType.cloneAsInstantiable(r),i))return;if(a=(0,p.addConditionToType)((0,p.convertToInstance)(s),(0,p.getTypeCondition)(t)),(0,c.isInstantiableClass)(s)&&(0,c.isClassInstance)(t)&&(c.ClassType.isSpecialBuiltIn(s)||s.details.typeParameters.length>0)){const n=new d.TypeVarMap((0,p.getTypeVarScopeId)(s)),i=c.ClassType.cloneForSpecialization(s,void 0,!1);e.populateTypeVarMapBasedOnExpectedType(i,t,n,[])&&(a=(0,p.applySolvedTypeVars)(c.ClassType.cloneAsInstance(i),n,!0))}}let o=[];n.arguments.some((e=>!e.name))&&(o=h(e,i));let l=!0;if(n.arguments.forEach(((t,n)=>{const s=y(e,t,n,o,i);(0,c.isNever)(s)&&(l=!1)})),l)return a}})):void 0))):(e.addDiagnostic((0,a.getFileInfo)(n).diagnosticRuleSet.reportGeneralTypeIssues,s.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.DiagnosticAddendum.typeNotClass().format({type:e.printType(l)}),n.className),c.NeverType.create())}(e,t,n,i);case 66:return function(e,t,n,i){let s=t;if(!i)return n.orPatterns.forEach((t=>{s=m(e,s,t,!1)})),s;const r=n.orPatterns.map((t=>{const n=m(e,s,t,!0);return s=m(e,s,t,!1),n}));return(0,c.combineTypes)(r)}(e,t,n,i);case 70:return function(e,t,n,i){if(!i)return t;let s=g(e,t);return s=s.filter((t=>{let s=!0;return n.entries.forEach((r=>{if(t.typedDict){if(71===r.nodeType){const a=m(e,e.getBuiltInObject(n,"str"),r.keyPattern,i);(0,c.isNever)(a)&&(s=!1);const l=(0,p.mapSubtypes)(a,(n=>{if((0,c.isAnyOrUnknown)(n))return n;if((0,c.isClassInstance)(n)&&c.ClassType.isBuiltIn(n,"str")){if(!(0,p.isLiteralType)(n))return c.UnknownType.create();const i=(0,o.getTypedDictMembersForClass)(e,t.typedDict).get(n.literalValue);if(i){const t=m(e,i.valueType,r.valuePattern,!0);if(!(0,c.isNever)(t))return t}}}));(0,c.isNever)(l)&&(s=!1)}}else if(t.dictTypeArgs&&71===r.nodeType){const n=m(e,t.dictTypeArgs.key,r.keyPattern,i),a=m(e,t.dictTypeArgs.value,r.valuePattern,i);((0,c.isNever)(n)||(0,c.isNever)(a))&&(s=!1)}})),s})),(0,c.combineTypes)(s.map((e=>e.subtype)))}(e,t,n,i);case 73:return function(e,t,n,i){const s=e.getTypeOfExpression(n.expression).type,r=[];return e.mapSubtypesExpandTypeVars(s,void 0,((s,a)=>{r.push(e.mapSubtypesExpandTypeVars(t,(0,p.getTypeCondition)(s),((t,r)=>{if(!i){if((0,c.isClassInstance)(r)&&c.ClassType.isEnumClass(r)&&!(0,p.isLiteralType)(r)&&(0,c.isClassInstance)(a)&&(0,c.isSameWithoutLiteralValue)(r,a)&&(0,p.isLiteralType)(a)){const t=(0,l.enumerateLiteralsForType)(e,r);if(t)return(0,c.combineTypes)(t.filter((e=>!c.ClassType.isLiteralValueSame(a,e))))}else if((0,c.isClassInstance)(r)&&(0,c.isClassInstance)(a)&&c.ClassType.isLiteralValueSame(a,r))return;return r}return(0,c.isNever)(s)||(0,c.isNever)(r)?c.NeverType.create():(0,c.isAnyOrUnknown)(s)||(0,c.isAnyOrUnknown)(r)?(0,c.isUnknown)(s)||(0,c.isUnknown)(r)?c.UnknownType.create():c.AnyType.create():e.useSpeculativeMode(n.expression,(()=>e.getTypeFromMagicMethodReturn(s,[r],"__eq__",n.expression,void 0)))?a:void 0})))})),(0,c.combineTypes)(r)}(e,t,n,i);case 69:return i?t:c.NeverType.create();case 0:return t}}function h(e,t){const n=(0,p.lookUpClassMember)(t,"__match_args__");if(n){const t=e.getTypeOfMember(n);if((0,c.isClassInstance)(t)&&(0,p.isTupleClass)(t)&&!(0,p.isOpenEndedTupleClass)(t)&&t.tupleTypeArguments){const e=t.tupleTypeArguments;if(!e.some((e=>!(0,c.isClassInstance)(e)||!c.ClassType.isBuiltIn(e,"str")||!(0,p.isLiteralType)(e))))return e.map((e=>e.literalValue))}}return[]}function y(e,t,n,i,s){var r;let a,o;return t.name?a=t.name.value:n<i.length&&(a=i[n]),u.some((e=>s.details.fullName===e))&&0===n&&!t.name?o=c.ClassType.cloneAsInstance(s):(a&&(o=null===(r=e.useSpeculativeMode(t,(()=>e.getTypeFromObjectMember(t,c.ClassType.cloneAsInstance(s),a))))||void 0===r?void 0:r.type),o||(o=c.UnknownType.create())),m(e,o,t.pattern,!0)}function g(e,t){const n=[];return(0,p.doForEachSubtype)(t,(t=>{const i=e.makeTopLevelTypeVarsConcrete(t);if((0,c.isAnyOrUnknown)(i))n.push({subtype:t,dictTypeArgs:{key:i,value:i}});else if((0,c.isClassInstance)(i))if(c.ClassType.isTypedDictClass(i))n.push({subtype:t,typedDict:i});else{let e;for(const t of i.details.mro)if((0,c.isInstantiableClass)(t)&&c.ClassType.isBuiltIn(t,"Mapping")){e=t;break}if(e){const s=(0,p.partiallySpecializeType)(e,i);s.typeArguments&&s.typeArguments.length>=2&&n.push({subtype:t,dictTypeArgs:{key:s.typeArguments[0],value:s.typeArguments[1]}})}}})),n}function f(e,t,n,i){const s=[],r=void 0===i?n:n-1;return(0,p.doForEachSubtype)(t,(t=>{const n=e.makeTopLevelTypeVarsConcrete(t);let a;if((0,c.isAnyOrUnknown)(n))s.push({subtype:t,entryTypes:[n],isIndeterminateLength:!0});else if((0,c.isClassInstance)(n)){if(c.ClassType.isBuiltIn(n,"object"))return void s.push({subtype:t,entryTypes:[(0,p.convertToInstance)(n)],isIndeterminateLength:!0,isObject:!0});for(const e of n.details.mro){if(!(0,c.isInstantiableClass)(e))break;if(c.ClassType.isBuiltIn(e,"str")||c.ClassType.isBuiltIn(e,"bytes")||c.ClassType.isBuiltIn(e,"bytearray"))break;if(c.ClassType.isBuiltIn(e,"Sequence")){a=e;break}if((0,p.isTupleClass)(e)){a=e;break}}if(a){const e=(0,p.partiallySpecializeType)(a,n);(0,p.isTupleClass)(e)?e.tupleTypeArguments&&((0,p.isOpenEndedTupleClass)(e)?s.push({subtype:t,entryTypes:[e.tupleTypeArguments[0]],isIndeterminateLength:!0,isTuple:!0}):e.tupleTypeArguments.length>=r&&(void 0!==i||e.tupleTypeArguments.length===r)&&s.push({subtype:t,entryTypes:e.tupleTypeArguments,isIndeterminateLength:!1,isTuple:!0})):s.push({subtype:t,entryTypes:[e.typeArguments&&e.typeArguments.length>0?e.typeArguments[0]:c.UnknownType.create()],isIndeterminateLength:!0})}}})),s}function T(e,t,n,s,r,a,o,l){if(n.isIndeterminateLength){let i=n.entryTypes[0];if(l){const n=e.getBuiltInObject(t,"object");n&&(0,c.isClassInstance)(n)&&(i=n)}return o||s!==a||(0,c.isNever)(i)||(i=_(e,t,i)),i}if(void 0===a||s<a)return n.entryTypes[s];if(s===a){const i=n.entryTypes.slice(a,a+n.entryTypes.length-r+1).map((e=>(0,p.stripLiteralValue)(e)));let s=(0,c.combineTypes)(i);return o||(s=_(e,t,s)),s}const d=n.entryTypes.length-(r-s);return(0,i.assert)(d>=0&&d<n.entryTypes.length),n.entryTypes[d]}function _(e,t,n){if((0,c.isNever)(n))return n;const i=(0,p.convertToInstance)(e.getBuiltInObject(t,"list"));return i&&(0,c.isClassInstance)(i)?c.ClassType.cloneForSpecialization(i,[n],!0):c.UnknownType.create()}t.narrowTypeBasedOnPattern=m,t.assignTypeToPatternTargets=function e(t,n,i,s,r){switch(n=m(t,n,r,!0),r.nodeType){case 65:{const a=f(t,n,r.entries.length,r.starEntryIndex);r.entries.forEach(((n,o)=>{const l=(0,c.combineTypes)(a.map((e=>T(t,r,e,o,r.entries.length,r.starEntryIndex,!1,s))));e(t,l,i,!1,n)}));break}case 66:r.target&&t.assignTypeToExpression(r.target,n,i,r.target),r.orPatterns.forEach((r=>{e(t,n,i,s,r),n=m(t,n,r,!1)}));break;case 69:t.assignTypeToExpression(r.target,r.isWildcard?c.AnyType.create():n,i,r.target);break;case 70:{const s=g(t,n);r.entries.forEach((n=>{const a=[],l=[];s.forEach((e=>{if(e.typedDict)if(71===n.nodeType){const i=m(t,t.getBuiltInObject(r,"str"),n.keyPattern,!0);a.push(i),(0,p.doForEachSubtype)(i,(n=>{if((0,c.isClassInstance)(n)&&c.ClassType.isBuiltIn(n,"str")&&(0,p.isLiteralType)(n)){const i=(0,o.getTypedDictMembersForClass)(t,e.typedDict).get(n.literalValue);l.push(i?i.valueType:c.UnknownType.create())}else l.push(c.UnknownType.create())}))}else 72===n.nodeType&&(a.push(t.getBuiltInObject(r,"str")),l.push(c.UnknownType.create()));else if(e.dictTypeArgs)if(71===n.nodeType){const i=m(t,e.dictTypeArgs.key,n.keyPattern,!0);a.push(i),l.push(m(t,e.dictTypeArgs.value,n.valuePattern,!0))}else 72===n.nodeType&&(a.push(e.dictTypeArgs.key),l.push(e.dictTypeArgs.value))}));const d=(0,c.combineTypes)(a),u=(0,c.combineTypes)(l);if(71===n.nodeType)e(t,d,i,!1,n.keyPattern),e(t,u,i,!1,n.valuePattern);else if(72===n.nodeType){const e=t.getBuiltInType(r,"dict"),s=t.getBuiltInObject(r,"str"),a=e&&(0,c.isInstantiableClass)(e)&&(0,c.isClassInstance)(s)?c.ClassType.cloneAsInstance(c.ClassType.cloneForSpecialization(e,[d,u],!0)):c.UnknownType.create();t.assignTypeToExpression(n.target,a,i,n.target)}}));break}case 68:{const s=r.arguments.map((e=>[]));t.mapSubtypesExpandTypeVars(n,void 0,(e=>{(0,c.isClassInstance)(e)?(0,p.doForEachSubtype)(n,(n=>{const i=t.makeTopLevelTypeVarsConcrete(n);if((0,c.isAnyOrUnknown)(i))r.arguments.forEach(((e,t)=>{s[t].push(i)}));else if((0,c.isClassInstance)(i)){let n=[];r.arguments.some((e=>!e.name))&&(n=h(t,c.ClassType.cloneAsInstantiable(e))),r.arguments.forEach(((i,r)=>{const a=y(t,i,r,n,c.ClassType.cloneAsInstantiable(e));s[r].push(a)}))}})):r.arguments.forEach(((e,t)=>{s[t].push(c.UnknownType.create())}))})),r.arguments.forEach(((n,r)=>{e(t,(0,c.combineTypes)(s[r]),i,!1,n.pattern)}));break}}}},8408:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Program=t.MaxWorkspaceIndexFileCount=void 0;const a=n(4494),o=n(3213),l=n(9489),c=n(2211),p=n(5839),d=n(7345),u=n(6657),m=n(1464),h=n(7559),y=n(3550),g=n(8718),f=n(8566),T=n(7087),_=n(8127),v=n(4952),b=n(1670),I=r(n(563)),C=n(2835),S=n(8905),F=n(8494),D=n(5083),P=n(4221),x=n(8816),A=n(1766),k=n(1943),E=n(558),w=n(2590);t.MaxWorkspaceIndexFileCount=2e3;class N{constructor(e,t,n,i,s,r){this._extension=i,this._disableChecker=r,this._sourceFileList=[],this._sourceFileMap=new Map,this._parsedFileCount=0,this._lookUpImport=e=>{var t;const n=this._getSourceFileInfoFromPath(e);if(!n)return;n.sourceFile.isBindingRequired()&&g.timingStats.typeCheckerTime.subtractFromTime((()=>{this._bindFile(n)}));const i=n.sourceFile.getModuleSymbolTable();if(!i)return;const s=n.sourceFile.getParseResults(),r=s.parseTree;return{symbolTable:i,dunderAllNames:null===(t=I.getDunderAllInfo(s.parseTree))||void 0===t?void 0:t.names,get docString(){return(0,F.getDocString)(r.statements)}}},this._console=n||new c.StandardConsole,this._logTracker=null!=s?s:new d.LogTracker(n,"FG"),this._importResolver=e,this._configOptions=t,this._createNewEvaluator()}get evaluator(){return this._evaluator}setConfigOptions(e){this._configOptions=e,this._createNewEvaluator()}setImportResolver(e){this._importResolver=e,this._createNewEvaluator()}setTrackedFiles(e){if(this._sourceFileList.length>0){const t=new Map;e.forEach((e=>{t.set((0,u.normalizePathCase)(this._fs,e),e)})),this._sourceFileList.forEach((e=>{const n=(0,u.normalizePathCase)(this._fs,e.sourceFile.getFilePath());t.has(n)||(e.isTracked=!1)}))}return this.addTrackedFiles(e),this._removeUnneededFiles()}setPreCheckCallback(e){this._preCheckCallback=e}setAllowedThirdPartyImports(e){this._allowedThirdPartyImports=e}addTrackedFiles(e,t=!1,n=!1){e.forEach((e=>{this.addTrackedFile(e,t,n)}))}addTrackedFile(e,t=!1,n=!1){let i=this._getSourceFileInfoFromPath(e);if(i)return i.isTracked=!0,i.sourceFile;const s=this._getImportNameForFile(e),r=new P.SourceFile(this._fs,e,s,t,n,this._console,this._logTracker);return i={sourceFile:r,isTracked:!0,isOpenByClient:!1,isTypeshedFile:!1,isThirdPartyImport:t,isThirdPartyPyTypedPresent:n,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(i),r}setFileOpened(e,t,n,i=!1){let s=this._getSourceFileInfoFromPath(e);if(s)s.isOpenByClient=!0,s.diagnosticsVersion=0;else{const t=this._getImportNameForFile(e);s={sourceFile:new P.SourceFile(this._fs,e,t,!1,!1,this._console,this._logTracker),isTracked:i,isOpenByClient:!0,isTypeshedFile:!1,isThirdPartyImport:!1,isThirdPartyPyTypedPresent:!1,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(s)}s.sourceFile.setClientVersion(t,n)}setFileClosed(e){const t=this._getSourceFileInfoFromPath(e);return t&&(t.isOpenByClient=!1,t.sourceFile.setClientVersion(null,[])),this._removeUnneededFiles()}markAllFilesDirty(e){const t=new Map;this._sourceFileList.forEach((n=>{e?n.sourceFile.markDirty():n.sourceFile.didContentsChangeOnDisk()&&(n.sourceFile.markDirty(),this._markFileDirtyRecursive(n,t))})),t.size>0&&this._createNewEvaluator()}markFilesDirty(e,t){const n=new Map;e.forEach((e=>{const i=this._getSourceFileInfoFromPath(e);i&&(t||!i.isOpenByClient&&i.sourceFile.didContentsChangeOnDisk())&&(i.sourceFile.markDirty(),this._markFileDirtyRecursive(i,n))})),n.size>0&&this._createNewEvaluator()}getFileCount(){return this._sourceFileList.length}getTracked(){return this._sourceFileList.filter((e=>e.isTracked))}getOpened(){return this._sourceFileList.filter((e=>e.isOpenByClient))}getFilesToAnalyzeCount(){let e=0;return this._disableChecker||this._sourceFileList.forEach((t=>{t.sourceFile.isCheckingRequired()&&this._shouldCheckFile(t)&&e++})),e}isCheckingOnlyOpenFiles(){return this._configOptions.checkOnlyOpenFiles||!1}getSourceFile(e){const t=this._getSourceFileInfoFromPath(e);if(t)return t.sourceFile}getBoundSourceFile(e){const t=this._getSourceFileInfoFromPath(e);if(t)return this._bindFile(t),this.getSourceFile(e)}analyze(e,t=a.CancellationToken.None){return this._runEvaluatorWithCancellationToken(t,(()=>{const t=new g.Duration,n=this._sourceFileList.filter((e=>e.isOpenByClient&&e.sourceFile.isCheckingRequired()));if(n.length>0){const i=e?e.openFilesTimeInMs:Number.MAX_VALUE;for(const e of n)if(this._checkTypes(e)&&t.getDurationInMilliseconds()>i)return!0;if(void 0!==e)return!0}if(!this._configOptions.checkOnlyOpenFiles){const n=e?e.noOpenFilesTimeInMs:Number.MAX_VALUE;for(const e of this._sourceFileList)if(this._isUserCode(e)&&this._checkTypes(e)&&t.getDurationInMilliseconds()>n)return!0}return!1}))}indexWorkspace(e,n){return this._configOptions.indexing?this._runEvaluatorWithCancellationToken(n,(()=>{const s=new Set;for(const e of this._sourceFileList)e.sourceFile.isParseRequired()||s.add(e);let r=0;for(const a of this._sourceFileList){if(!this._isUserCode(a)||!a.sourceFile.isIndexingRequired())continue;this._bindFile(a);const o=a.sourceFile.index({indexingForAutoImportMode:!1},n);if(o){if(++r>t.MaxWorkspaceIndexFileCount)return this._console.warn("Workspace indexing has hit its upper limit: 2000 files"),i(this._sourceFileList,s),r;e(a.sourceFile.getFilePath(),o)}this._handleMemoryHighUsage()}return i(this._sourceFileList,s),r})):0;function i(e,t){for(const n of e)n.sourceFile.isParseRequired()||t.has(n)||n.sourceFile.dropParseAndBindInfo()}}printDependencies(e,t){const n=this._sourceFileList.filter((e=>!e.isTypeshedFile)).sort(((e,t)=>e.sourceFile.getFilePath()<t.sourceFile.getFilePath()?1:-1)),i=[];n.forEach((n=>{this._console.info("");let s=n.sourceFile.getFilePath();const r=(0,u.getRelativePath)(s,e);r&&(s=r),this._console.info(`${s}`),this._console.info(` Imports     ${n.imports.length} file`+(1===n.imports.length?"":"s")),t&&n.imports.forEach((e=>{this._console.info(`    ${e.sourceFile.getFilePath()}`)})),this._console.info(` Imported by ${n.importedBy.length} file`+(1===n.importedBy.length?"":"s")),t&&n.importedBy.forEach((e=>{this._console.info(`    ${e.sourceFile.getFilePath()}`)})),0===n.importedBy.length&&i.push(n.sourceFile)})),i.length>0&&(this._console.info(""),this._console.info(`${i.length} file${1===i.length?"":"s"} not explicitly imported`),i.forEach((e=>{this._console.info(`    ${e.getFilePath()}`)})))}writeTypeStub(e,t,n,i){for(const s of this._sourceFileList){(0,o.throwIfCancellationRequested)(i);const r=s.sourceFile.getFilePath(),a=(0,u.getRelativePath)(r,e);if(void 0!==a){let e=(0,u.normalizePath)((0,u.combinePaths)(n,a));e=t?(0,u.combinePaths)((0,u.getDirectoryPath)(e),"__init__.pyi"):(0,u.stripFileExtension)(e)+".pyi";const r=(0,u.getDirectoryPath)(e);try{(0,u.makeDirectories)(this._fs,r,n)}catch(e){throw new Error(`Could not create directory for '${r}'`)}this._bindFile(s),this._runEvaluatorWithCancellationToken(i,(()=>{new w.TypeStubWriter(e,s.sourceFile,this._evaluator).write()})),this._handleMemoryHighUsage()}}}getTypeForSymbol(e){return this._handleMemoryHighUsage(),(this._evaluator||this._createNewEvaluator()).getEffectiveTypeOfSymbol(e)}printType(e,t){return this._handleMemoryHighUsage(),(this._evaluator||this._createNewEvaluator()).printType(e,t)}static _getPrintTypeFlags(e){let t=0;return e.diagnosticRuleSet.printUnknownAsAny&&(t|=1),e.diagnosticRuleSet.omitConditionalConstraint&&(t|=64),e.diagnosticRuleSet.omitTypeArgsIfAny&&(t|=2),e.diagnosticRuleSet.omitUnannotatedParamType&&(t|=4),e.diagnosticRuleSet.pep604Printing&&(t|=8),t}get _fs(){return this._importResolver.fileSystem}_getImportNameForFile(e){return this._importResolver.getModuleNameForImport(e,this._configOptions.getDefaultExecEnvironment()).moduleName}_addShadowedFile(e,t){let n=this._getSourceFileInfoFromPath(t);if(!n){const e=this._getImportNameForFile(t);n={sourceFile:new P.SourceFile(this._fs,t,e,!1,!1,this._console,this._logTracker),isTracked:!1,isOpenByClient:!1,isTypeshedFile:!1,isThirdPartyImport:!1,isThirdPartyPyTypedPresent:!1,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(n)}return n.shadows.includes(e)||n.shadows.push(e),e.shadowedBy.includes(n)||e.shadowedBy.push(n),n.sourceFile}_createNewEvaluator(){return this._evaluator=(0,E.createTypeEvaluatorWithTracker)(this._lookUpImport,{disableInferenceForPyTypedSources:this._configOptions.disableInferenceForPyTypedSources,printTypeFlags:N._getPrintTypeFlags(this._configOptions),logCalls:this._configOptions.logTypeEvaluationTime,minimumLoggingThreshold:this._configOptions.typeEvaluationTimeThreshold,analyzeUnannotatedFunctions:this._configOptions.analyzeUnannotatedFunctions,evaluateUnknownImportsAsAny:!!this._configOptions.evaluateUnknownImportsAsAny},this._logTracker,this._configOptions.logTypeEvaluationTime?(0,k.createTracePrinter)(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot))):void 0),this._evaluator}_parseFile(e,t){if(this._isFileNeeded(e)&&e.sourceFile.isParseRequired()&&(e.sourceFile.parse(this._configOptions,this._importResolver,t)&&(this._parsedFileCount++,this._updateSourceFileImports(e,this._configOptions)),e.sourceFile.isFileDeleted())){e.isTracked=!1;const t=new Map;this._markFileDirtyRecursive(e,t),this._importResolver.invalidateCache()}}_bindFile(e,t){if(!this._isFileNeeded(e)||!e.sourceFile.isBindingRequired())return;let n;if(this._parseFile(e,t),e.builtinsImport&&e.builtinsImport!==e){this._bindFile(e.builtinsImport);const t=e.builtinsImport.sourceFile.getParseResults();t&&(n=I.getScope(t.parseTree),(0,p.assert)(void 0!==n))}e.sourceFile.bind(this._configOptions,this._lookUpImport,n)}_buildModuleSymbolsMap(e,t,n,i){return(0,f.buildModuleSymbolsMap)(this._sourceFileList.filter((n=>n!==e&&(!t||this._isUserCode(n)))),n,i)}_shouldCheckFile(e){return!!e.isOpenByClient||!(this._configOptions.checkOnlyOpenFiles||!e.isTracked)}_checkTypes(e){return this._logTracker.log(`analyzing: ${e.sourceFile.getFilePath()}`,(t=>{if(!this._isFileNeeded(e))return t.suppress(),!1;if(!e.sourceFile.isCheckingRequired())return t.suppress(),!1;if(!this._shouldCheckFile(e))return t.suppress(),!1;if(this._bindFile(e),this._preCheckCallback){const t=e.sourceFile.getParseResults();t&&this._preCheckCallback(t,this._evaluator)}if(this._disableChecker||e.sourceFile.check(this._evaluator),this._handleMemoryHighUsage(),"none"!==this._configOptions.diagnosticRuleSet.reportImportCycles&&!this._allowedThirdPartyImports){const t=new Map;this._getImportsRecursive(e,t,0),t.forEach((e=>{g.timingStats.cycleDetectionTime.timeOperation((()=>{this._detectAndReportImportCycles(e)}))}))}return!0}))}_getImportsRecursive(e,t,n){const i=(0,u.normalizePathCase)(this._fs,e.sourceFile.getFilePath());if(!t.has(i))if(n>256)e.sourceFile.setHitMaxImportDepth(256);else{t.set(i,e);for(const i of e.imports)this._getImportsRecursive(i,t,n+1)}}_detectAndReportImportCycles(e,t=[],n=new Map){if(e.sourceFile.isStubFile()||e.isThirdPartyImport)return;const i=(0,u.normalizePathCase)(this._fs,e.sourceFile.getFilePath());if(n.has(i))t.length>1&&e===t[0]&&this._logImportCycle(t);else{if(n.has(i))return;n.set(i,!0),t.push(e);for(const i of e.imports)this._detectAndReportImportCycles(i,t,n);n.set(i,!1),t.pop()}}_logImportCycle(e){const t=new C.CircularDependency;e.forEach((e=>{t.appendPath(e.sourceFile.getFilePath())})),t.normalizeOrder();const n=t.getPaths()[0],i=this._getSourceFileInfoFromPath(n);(0,p.assert)(void 0!==i),i.sourceFile.addCircularDependency(t)}_markFileDirtyRecursive(e,t){const n=(0,u.normalizePathCase)(this._fs,e.sourceFile.getFilePath());t.has(n)||(e.sourceFile.markReanalysisRequired(),t.set(n,!0),e.importedBy.forEach((e=>{this._markFileDirtyRecursive(e,t)})))}getTextOnRange(e,t,n){const i=this._sourceFileMap.get(e);if(!i)return;const s=i.sourceFile,r=s.getOpenFileContents();return void 0!==r?this._runEvaluatorWithCancellationToken(n,(()=>{this._parseFile(i);const e=s.getParseResults(),n=(0,m.convertRangeToTextRange)(t,e.tokenizerOutput.lines);if(n)return r.substr(n.start,n.length)})):void 0}getAutoImports(e,t,n,i,s,r,a,o){const l=this._getSourceFileInfoFromPath(e);if(!l)return[];const c=l.sourceFile,p=c.getOpenFileContents();return void 0===p?[]:this._runEvaluatorWithCancellationToken(o,(()=>{this._bindFile(l);const d=c.getParseResults(),u=(0,m.convertRangeToTextRange)(t,d.tokenizerOutput.lines);if(!u)return[];const y=(0,F.findNodeByOffset)(d.parseTree,u.start);if(!y)return[];const g=p.substr(u.start,u.length),T=this._buildModuleSymbolsMap(l,!!s,!0,o),_=new f.AutoImporter(this._configOptions.findExecEnvironment(e),this._importResolver,d,t.start,new Set,T,{lazyEdit:r,allowVariableInAll:a,libraryMap:s,patternMatcher:(e,t)=>(0,h.computeCompletionSimilarity)(e,t)>n}),v=[],b=(0,D.getScopeForNode)(y);if(b){const e=null==i?void 0:i.get(g);e&&v.push(..._.getAutoImportCandidatesForAbbr(g,e,o)),v.push(..._.getAutoImportCandidates(g,n,void 0,o).filter((e=>!b.lookUpSymbolRecursive(e.name))))}return v}))}getDiagnostics(e){const t=this._removeUnneededFiles();return this._sourceFileList.forEach((n=>{if(this._shouldCheckFile(n)){const i=n.sourceFile.getDiagnostics(e,n.diagnosticsVersion);void 0!==i&&(t.push({filePath:n.sourceFile.getFilePath(),version:n.sourceFile.getClientVersion(),diagnostics:i}),n.diagnosticsVersion=n.sourceFile.getDiagnosticVersion())}else!n.isOpenByClient&&e.checkOnlyOpenFiles&&void 0!==n.diagnosticsVersion&&(t.push({filePath:n.sourceFile.getFilePath(),version:n.sourceFile.getClientVersion(),diagnostics:[]}),n.diagnosticsVersion=void 0)})),t}getDiagnosticsForRange(e,t){const n=this.getSourceFile(e);if(!n)return[];const i=n.getDiagnostics(this._configOptions);return i?i.filter((e=>(0,y.doRangesIntersect)(e.range,t))):[]}getDefinitionsForPosition(e,t,n,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const r=this._configOptions.findExecEnvironment(e);return s.sourceFile.getDefinitionsForPosition(this._createSourceMapper(r),t,n,this._evaluator,i)}))}getTypeDefinitionsForPosition(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e);return i.sourceFile.getTypeDefinitionsForPosition(this._createSourceMapper(s,!1,!0),t,this._evaluator,e,n)}))}reportReferencesForPosition(e,t,n,i,s){this._runEvaluatorWithCancellationToken(s,(()=>{const r=this._getSourceFileInfoFromPath(e);if(!r)return;const a=this._isUserCode(r);this._bindFile(r);const l=this._configOptions.findExecEnvironment(e),c=r.sourceFile.getDeclarationForPosition(this._createSourceMapper(l),t,this._evaluator,i,s);if(c)if(c.requiresGlobalSearch){for(const e of this._sourceFileList)if((0,o.throwIfCancellationRequested)(s),e.isOpenByClient||!a||this._isUserCode(e)){const t=e.sourceFile.getFileContent();(!t||t.search(c.symbolName)>=0)&&(this._bindFile(e),e.sourceFile.addReferences(c,n,this._evaluator,s)),this._handleMemoryHighUsage()}if(n)for(const e of c.declarations){if((0,o.throwIfCancellationRequested)(s),c.locations.some((t=>t.path===e.path)))continue;const t=this._getSourceFileInfoFromPath(e.path);if(!t)continue;const i=new v.ReferencesResult(c.requiresGlobalSearch,c.nodeAtOffset,c.symbolName,c.declarations);t.sourceFile.addReferences(i,n,this._evaluator,s);for(const t of i.locations)t.path===e.path&&(0,y.doesRangeContain)(e.range,t.range)&&c.addLocations(t)}}else r.sourceFile.addReferences(c,n,this._evaluator,s)}))}getFileIndex(e,t,n){if(t.indexingForAutoImportMode){const t=(0,u.stripFileExtension)((0,u.getFileName)(e));if((0,A.isPrivateOrProtectedName)(t))return}return this._handleMemoryHighUsage(),this._runEvaluatorWithCancellationToken(n,(()=>{var i;const s=this._getSourceFileInfoFromPath(e);if(!s)return;const r=null!==(i=s.sourceFile.getFileContent())&&void 0!==i?i:"";return t.indexingForAutoImportMode&&!s.sourceFile.isStubFile()&&!s.sourceFile.isThirdPartyPyTypedPresent()&&r.indexOf("__all__")<0?void 0:(this._bindFile(s,r),s.sourceFile.index(t,n))}))}addSymbolsForDocument(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const i=this._getSourceFileInfoFromPath(e);i&&(i.sourceFile.getCachedIndexResults()||this._bindFile(i),i.sourceFile.addHierarchicalSymbolsForDocument(t,n))}))}reportSymbolsForWorkspace(e,t,n){this._runEvaluatorWithCancellationToken(n,(()=>{if(e)for(const i of this._sourceFileList){if(!this._isUserCode(i))continue;i.sourceFile.getCachedIndexResults()||this._bindFile(i);const s=i.sourceFile.getSymbolsForDocument(e,n);s.length>0&&t(s),this._handleMemoryHighUsage()}}))}getHoverForPosition(e,t,n,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const r=this._configOptions.findExecEnvironment(e);return s.sourceFile.getHoverForPosition(this._createSourceMapper(r,!0),t,n,this._evaluator,i)}))}getDocumentHighlight(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e);return i.sourceFile.getDocumentHighlight(this._createSourceMapper(s),t,this._evaluator,n)}))}getSignatureHelpForPosition(e,t,n,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const r=this._configOptions.findExecEnvironment(e);return s.sourceFile.getSignatureHelpForPosition(t,this._createSourceMapper(r,!0),this._evaluator,n,i)}))}async getCompletionsForPosition(e,t,n,i,s,r,a){var o;const l=this._getSourceFileInfoFromPath(e);if(!l)return;const c=this._logTracker.log(`completion at ${e}:${t.line}:${t.character}`,(o=>{var c,p;const d=this._runEvaluatorWithCancellationToken(a,(()=>{this._bindFile(l);const o=this._configOptions.findExecEnvironment(e);return l.sourceFile.getCompletionsForPosition(t,n,this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,i,this._createSourceMapper(o,!0),s,r,(()=>this._buildModuleSymbolsMap(l,!!r,!1,a)),a)}));return o.add(`found ${null!==(p=null===(c=null==d?void 0:d.completionList)||void 0===c?void 0:c.items.length)&&void 0!==p?p:"null"} items`),d}));if(!(null==c?void 0:c.completionList)||!(null===(o=this._extension)||void 0===o?void 0:o.completionListExtension))return c;const p=l.sourceFile.getParseResults();if((null==p?void 0:p.parseTree)&&(null==p?void 0:p.text)){const e=(0,m.convertPositionToOffset)(t,p.tokenizerOutput.lines);void 0!==e&&await this._extension.completionListExtension.updateCompletionResults(c,p,e,a)}return c}resolveCompletionItem(e,t,n,i,s,r){return this._runEvaluatorWithCancellationToken(r,(()=>{const a=this._getSourceFileInfoFromPath(e);if(!a)return;this._bindFile(a);const o=this._configOptions.findExecEnvironment(e);a.sourceFile.resolveCompletionItem(this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,n,this._createSourceMapper(o,!0),i,s,(()=>this._buildModuleSymbolsMap(a,!!s,!1,r)),t,r)}))}renameModule(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{if((0,u.isFile)(this._fs,e)&&!this._getSourceFileInfoFromPath(e))return;const i=b.RenameModuleProvider.createForModule(this._importResolver,this._configOptions,this._evaluator,e,t,n);return i?(this._processModuleReferences(i,i.lastModuleName,e),i.getEdits()):void 0}))}moveSymbolAtPosition(e,t,n,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const r=s.sourceFile.getParseResults();if(!r)return;const a=(0,m.convertPositionToOffset)(n,r.tokenizerOutput.lines);if(void 0===a)return;const o=(0,F.findNodeByOffset)(r.parseTree,a);if(void 0===o)return;if(38!==o.nodeType)return;const l=this._configOptions.findExecEnvironment(e),c=_.DocumentSymbolCollector.getDeclarationsForNode(o,this._evaluator,!1,i,this._createSourceMapper(l)),p=b.RenameModuleProvider.createForSymbol(this._importResolver,this._configOptions,this._evaluator,e,t,c,i);return p?(this._processModuleReferences(p,o.value,e),{edits:p.getEdits(),fileOperations:[]}):void 0}))}renameSymbolAtPosition(e,t,n,i,s){return this._runEvaluatorWithCancellationToken(s,(()=>{const r=this._getSourceFileInfoFromPath(e);if(!r)return;this._bindFile(r);const a=this._configOptions.findExecEnvironment(e),o=r.sourceFile.getDeclarationForPosition(this._createSourceMapper(a),t,this._evaluator,void 0,s);if(!o)return;if((0,l.removeArrayElements)(o.declarations,(e=>{var t;return!(!(0,S.isAliasDeclaration)(e)||e.usesLocalName&&e.node&&22!==e.node.nodeType&&(null===(t=e.node.alias)||void 0===t?void 0:t.value)===o.symbolName)})),0===o.declarations.length)return;if(!i&&o.declarations.some((e=>!this._isUserCode(this._getSourceFileInfoFromPath(e.path)))))return;if(o.requiresGlobalSearch&&!i)for(const e of this._sourceFileList)this._isUserCode(e)&&(this._bindFile(e),e.sourceFile.addReferences(o,!0,this._evaluator,s)),this._handleMemoryHighUsage();else(i||this._isUserCode(r))&&r.sourceFile.addReferences(o,!0,this._evaluator,s);const c=[];return o.locations.forEach((e=>{c.push({filePath:e.path,range:e.range,replacementText:n})})),c}))}getCallForPosition(e,t,n){const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e),r=i.sourceFile.getDeclarationForPosition(this._createSourceMapper(s),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return T.CallHierarchyProvider.getCallForDeclaration(r.symbolName,a,this._evaluator,n)}getIncomingCallsForPosition(e,t,n){const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e),r=i.sourceFile.getDeclarationForPosition(this._createSourceMapper(s),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);let o=[];for(const e of this._sourceFileList)if(this._isUserCode(e)||e.isOpenByClient){this._bindFile(e);const t=T.CallHierarchyProvider.getIncomingCallsForDeclaration(e.sourceFile.getFilePath(),r.symbolName,a,e.sourceFile.getParseResults(),this._evaluator,n);t&&(o=o.concat(...t)),this._handleMemoryHighUsage()}return o}getOutgoingCallsForPosition(e,t,n){const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const s=this._configOptions.findExecEnvironment(e),r=i.sourceFile.getDeclarationForPosition(this._createSourceMapper(s),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=T.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return T.CallHierarchyProvider.getOutgoingCallsForDeclaration(a,i.sourceFile.getParseResults(),this._evaluator,n)}performQuickAction(e,t,n,i){const s=this._getSourceFileInfoFromPath(e);if(s)return this._bindFile(s),s.sourceFile.performQuickAction(t,n,i)}test_createSourceMapper(e){return this._createSourceMapper(e,!1)}_processModuleReferences(e,t,n){var i;for(const s of this._sourceFileList){if(!this._isUserCode(s))continue;const r=s.sourceFile.getFilePath(),a=null!==(i=s.sourceFile.getFileContent())&&void 0!==i?i:"";if(r!==n&&a.indexOf(t)<0)continue;this._bindFile(s,a);const o=s.sourceFile.getParseResults();o&&(e.renameReferences(r,o),this._handleMemoryHighUsage())}}_handleMemoryHighUsage(){if(this._evaluator.getTypeCacheSize()>75e4||this._parsedFileCount>1e3){const e=Math.round(process.memoryUsage().heapUsed/1048576);e>1536&&(this._console.info(`Emptying type cache to avoid heap overflow. Heap size used: ${e}MB`),this._createNewEvaluator(),this._discardCachedParseResults(),this._parsedFileCount=0)}}_discardCachedParseResults(){for(const e of this._sourceFileList)e.sourceFile.dropParseAndBindInfo()}_isUserCode(e){return e&&e.isTracked&&!e.isThirdPartyImport&&!e.isTypeshedFile}_runEvaluatorWithCancellationToken(e,t){try{return e?this._evaluator.runWithCancellationToken(e,t):t()}catch(e){throw e instanceof o.OperationCanceledException||this._createNewEvaluator(),e}}_removeUnneededFiles(){const e=[];for(let t=0;t<this._sourceFileList.length;){const n=this._sourceFileList[t];this._isFileNeeded(n)?(this._shouldCheckFile(n)||void 0===n.diagnosticsVersion||(e.push({filePath:n.sourceFile.getFilePath(),version:n.sourceFile.getClientVersion(),diagnostics:[]}),n.diagnosticsVersion=void 0),t++):(e.push({filePath:n.sourceFile.getFilePath(),version:n.sourceFile.getClientVersion(),diagnostics:[]}),n.sourceFile.prepareForClose(),this._removeSourceFileFromListAndMap(n.sourceFile.getFilePath(),t),n.imports.forEach((i=>{const s=i.importedBy.findIndex((e=>e===n));if((0,p.assert)(s>=0),i.importedBy.splice(s,1),!this._isFileNeeded(i)){const n=this._sourceFileList.findIndex((e=>e===i));n>=0&&n<t&&(e.push({filePath:i.sourceFile.getFilePath(),version:i.sourceFile.getClientVersion(),diagnostics:[]}),i.sourceFile.prepareForClose(),this._removeSourceFileFromListAndMap(i.sourceFile.getFilePath(),n),t--)}})),n.shadowedBy.forEach((e=>{e.shadows=e.shadows.filter((e=>e!==n))})),n.shadowedBy=[])}return e}_isFileNeeded(e){return!e.sourceFile.isFileDeleted()&&(!(!e.isTracked&&!e.isOpenByClient)||e.shadows.length>0||0!==e.importedBy.length&&this._isImportNeededRecursive(e,new Map))}_isImportNeededRecursive(e,t){if(e.isTracked||e.isOpenByClient||e.shadows.length>0)return!0;const n=(0,u.normalizePathCase)(this._fs,e.sourceFile.getFilePath());if(t.has(n))return!1;t.set(n,!0);for(const n of e.importedBy)if(this._isImportNeededRecursive(n,t))return!0;return!1}_createSourceMapper(e,t,n){return new x.SourceMapper(this._importResolver,e,this._evaluator,((e,t)=>{const n=this._getSourceFileInfoFromPath(e);if(n)return this._addShadowedFile(n,t),this.getBoundSourceFile(t)}),(e=>this.getBoundSourceFile(e)),null!=t&&t,null!=n&&n)}_isImportAllowed(e,t,n){if(t.isNativeLib)return!1;let i=this._configOptions.useLibraryCodeForTypes||1===t.importType&&!!t.pyTypedInfo||2===t.importType&&e.isThirdPartyPyTypedPresent;return!((1===t.importType||e.isThirdPartyImport&&2===t.importType)&&(this._allowedThirdPartyImports&&(t.isRelative||this._allowedThirdPartyImports.some((e=>t.importName===e||!!t.importName.startsWith(e+"."))))&&(i=!0),!n))||i}_updateSourceFileImports(e,t){const n=[],i=e.sourceFile.getImports(),s=t=>{let n=!1,i=!1;return 1===t.importType?(n=!0,t.pyTypedInfo&&(i=!0)):e.isThirdPartyImport&&2===t.importType&&(n=!0,e.isThirdPartyPyTypedPresent&&(i=!0)),{isThirdPartyImport:n,isPyTypedPresent:i}},r=new Map;i.forEach((n=>{if(n.isImportFound){if(this._isImportAllowed(e,n,n.isStubFile)&&n.resolvedPaths.length>0){const e=n.resolvedPaths[n.resolvedPaths.length-1];if(e){const t=s(n);r.set((0,u.normalizePathCase)(this._fs,e),{path:e,isTypeshedFile:!!n.isTypeshedFile,isThirdPartyImport:t.isThirdPartyImport,isPyTypedPresent:t.isPyTypedPresent})}}n.filteredImplicitImports.forEach((t=>{if(this._isImportAllowed(e,n,t.isStubFile)&&!t.isNativeLib){const e=s(n);r.set((0,u.normalizePathCase)(this._fs,t.path),{path:t.path,isTypeshedFile:!!n.isTypeshedFile,isThirdPartyImport:e.isThirdPartyImport,isPyTypedPresent:e.isPyTypedPresent})}}))}else t.verboseOutput&&(this._console.info(`Could not import '${n.importName}' in file '${e.sourceFile.getFilePath()}'`),n.importFailureInfo&&n.importFailureInfo.forEach((e=>{this._console.info(`  ${e}`)})))}));const a=new Map;e.imports.forEach((t=>{const n=(0,u.normalizePathCase)(this._fs,t.sourceFile.getFilePath());r.has(n)?a.set(n,t):t.importedBy=t.importedBy.filter((t=>(0,u.normalizePathCase)(this._fs,t.sourceFile.getFilePath())!==(0,u.normalizePathCase)(this._fs,e.sourceFile.getFilePath())))})),r.forEach(((t,i)=>{if(!a.has(i)){let s;if(this._getSourceFileInfoFromPath(t.path))s=this._getSourceFileInfoFromPath(t.path);else{const e=this._getImportNameForFile(t.path);s={sourceFile:new P.SourceFile(this._fs,t.path,e,t.isThirdPartyImport,t.isPyTypedPresent,this._console,this._logTracker),isTracked:!1,isOpenByClient:!1,isTypeshedFile:t.isTypeshedFile,isThirdPartyImport:t.isThirdPartyImport,isThirdPartyPyTypedPresent:t.isPyTypedPresent,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(s),n.push(s)}s.importedBy.push(e),a.set(i,s)}})),e.imports=[],r.forEach(((t,n)=>{this._getSourceFileInfoFromPath(n)&&e.imports.push(this._getSourceFileInfoFromPath(n))})),e.builtinsImport=void 0;const o=e.sourceFile.getBuiltinsImport();if(o&&o.isImportFound){const t=o.resolvedPaths[o.resolvedPaths.length-1];e.builtinsImport=this._getSourceFileInfoFromPath(t)}return n}_getSourceFileInfoFromPath(e){return this._sourceFileMap.get((0,u.normalizePathCase)(this._fs,e))}_removeSourceFileFromListAndMap(e,t){this._sourceFileMap.delete((0,u.normalizePathCase)(this._fs,e)),this._sourceFileList.splice(t,1)}_addToSourceFileListAndMap(e){const t=(0,u.normalizePathCase)(this._fs,e.sourceFile.getFilePath());(0,p.assert)(!this._sourceFileMap.has(t)),this._sourceFileList.push(e),this._sourceFileMap.set(t,e)}}t.Program=N},1277:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getPyTypedInfo=void 0;const i=n(6657);t.getPyTypedInfo=function(e,t){if(!e.existsSync(t)||!(0,i.isDirectory)(e,t))return;let n=!1;const s=(0,i.combinePaths)(t,"py.typed");if(!e.existsSync(t)||!(0,i.isFile)(e,s))return;const r=e.statSync(s);if(r.size>0&&r.size<65536){const t=e.readFileSync(s,"utf8");(t.match(/partial\n/)||t.match(/partial\r\n/))&&(n=!0)}return{pyTypedPath:s,isPartiallyTyped:n}}},1887:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getPathsFromPthFiles=t.isPythonBinary=t.findPythonSearchPaths=t.getTypeshedSubdirectory=t.getTypeShedFallbackPath=t.thirdPartyFolderName=t.stdLibFolderName=void 0;const a=n(2489),o=r(n(3188)),l=n(6657);function c(e,t){const n=[];return e.readdirEntriesSync(t).filter((e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(".pth"))).sort(((e,t)=>(0,a.compareComparableValues)(e.name,t.name))).forEach((i=>{const s=(0,l.combinePaths)(t,i.name),r=(0,l.tryStat)(e,s);(null==r?void 0:r.isFile())&&r.size>0&&r.size<65536&&e.readFileSync(s,"utf8").split(/\r?\n/).forEach((i=>{const s=i.trim();if(s.length>0&&!s.startsWith("#")&&!s.match(/^import\s/)){const i=(0,l.combinePaths)(t,s);e.existsSync(i)&&(0,l.isDirectory)(e,i)&&n.push(i)}}))})),n}function p(e,t){return!e.some((e=>e===t))&&(e.push(t),!0)}t.stdLibFolderName="stdlib",t.thirdPartyFolderName="stubs",t.getTypeShedFallbackPath=function(e){let t=e.getModulePath();if(!t)return;t=(0,l.getDirectoryPath)((0,l.ensureTrailingDirectorySeparator)((0,l.normalizePath)(t)));const n=(0,l.combinePaths)(t,o.typeshedFallback);if(e.existsSync(n))return n;const i=(0,l.combinePaths)((0,l.getDirectoryPath)(t),o.typeshedFallback);return e.existsSync(i)?i:void 0},t.getTypeshedSubdirectory=function(e,n){return(0,l.combinePaths)(e,n?t.stdLibFolderName:t.thirdPartyFolderName)},t.findPythonSearchPaths=function(e,t,n,i,s,r){if(i.push("Finding python search paths"),void 0!==t.venvPath&&t.venv){const n=t.venv,s=(0,l.combinePaths)(t.venvPath,n),r=[],a=[];if([o.lib,o.lib64,o.libAlternate].forEach((t=>{const n=function(e,t,n){if(!e.existsSync(t))return void n.push(`Did not find '${t}'`);n.push(`Found path '${t}'; looking for ${o.sitePackages}`);const i=(0,l.combinePaths)(t,o.sitePackages);if(e.existsSync(i))return n.push(`Found path '${i}'`),i;n.push(`Did not find '${i}', so looking for python subdirectory`);const s=(0,l.getFileSystemEntries)(e,t);for(let i=0;i<s.directories.length;i++){const r=s.directories[i];if(r.startsWith("python")){const i=(0,l.combinePaths)(t,r,o.sitePackages);if(e.existsSync(i))return n.push(`Found path '${i}'`),i;n.push(`Path '${i}' is not a valid directory`)}}}(e,(0,l.combinePaths)(s,t),i);n&&(p(r,n),a.push(n))})),a.forEach((t=>{c(e,t).forEach((e=>{p(r,e)}))})),r.length>0)return i.push(`Found the following '${o.sitePackages}' dirs`),r.forEach((e=>{i.push(`  ${e}`)})),r;i.push(`Did not find any '${o.sitePackages}' dirs. Falling back on python interpreter.`)}const a=n.getPythonSearchPaths(t.pythonPath,i);return s&&r?a.paths.filter((e=>!(0,l.containsPath)(r,e,!0)||(0,l.containsPath)(a.prefix,e,!0))):a.paths},t.isPythonBinary=function(e){return"python"===(e=e.trim())||"python3"===e},t.getPathsFromPthFiles=c},1561:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Scope=void 0;const i=n(5839),s=n(817);t.Scope=class{constructor(e,t){this.symbolTable=new Map,this.notLocalBindings=new Map,this.type=e,this.parent=t}getGlobalScope(){let e=this;for(;e;){if(3===e.type||4===e.type)return e;e=e.parent}return(0,i.fail)("failed to find scope"),this}isIndependentlyExecutable(){return 3===this.type||1===this.type}lookUpSymbol(e){return this.symbolTable.get(e)}lookUpSymbolRecursive(e,t=!1,n=!1){const i=this.symbolTable.get(e);if(i){if(t&&i.isExternallyHidden())return;const e=i.getDeclarations();if(0===e.length||e.some((e=>1!==e.type||!e.isDefinedByMemberAccess)))return{symbol:i,isOutsideCallerModule:t,isBeyondExecutionScope:n,scope:this}}let s;if(s=1===this.notLocalBindings.get(e)?this.getGlobalScope():this.parent,s)return s.lookUpSymbolRecursive(e,t||3===this.type,n||this.isIndependentlyExecutable())}addSymbol(e,t){const n=new s.Symbol(t);return this.symbolTable.set(e,n),n}getBindingType(e){return this.notLocalBindings.get(e)}setBindingType(e,t){return this.notLocalBindings.set(e,t)}setSlotsNames(e){this.slotsNames=e}getSlotsNames(){return this.slotsNames}}},5083:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findTopNodeInScope=t.getScopeHierarchy=t.getScopeForNode=t.getBuiltInScope=void 0;const i=n(563),s=n(8494);function r(e){const t=(0,s.getEvaluationScopeNode)(e);return(0,i.getScope)(t)}t.getBuiltInScope=function(e){let t=e;for(;4!==t.type;)t=t.parent;return t},t.getScopeForNode=r,t.getScopeHierarchy=function(e,t){const n=[];let i=e;for(;i;){const e=r(i);if(!e)return;if(0!==n.length&&n[n.length-1]===e||n.push(e),e===t)return n;i=i.parent}return t?void 0:n},t.findTopNodeInScope=function(e,t){let n,s=e,r=!1;for(;s;){if((0,i.getScope)(s)===t)r=!0;else if(r)return n;n=s,s=s.parent}}},6708:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerService=t.pyprojectTomlName=t.configFileNames=void 0;const a=r(n(2125)),o=r(n(1796)),l=n(3213),c=n(2930),p=n(2211),d=n(7830),u=n(8442),m=n(6657),h=n(8718),y=n(5674),g=n(2374),f=n(1887);t.configFileNames=["pyrightconfig.json"],t.pyprojectTomlName="pyproject.toml";const T=(0,m.normalizeSlashes)("/.git/"),_=/\.pyi?$/;class v{constructor(e,t,n,i,s,r,a,o,d,m,h){this._typeStubTargetIsSingleFile=!1,this._requireTrackedFileUpdate=!0,this._lastUserInteractionTime=Date.now(),this._disposed=!1,this._instanceName=e,this._console=n||new p.StandardConsole,this._executionRootPath="",this._extension=a,this._importResolverFactory=s||v.createImportResolver,this._maxAnalysisTimeInForeground=d,this._backgroundAnalysisProgramFactory=m,this._cancellationProvider=null!=h?h:new l.DefaultCancellationProvider,this._hostFactory=null!=i?i:()=>new u.NoAccessHost,r=null!=r?r:new c.ConfigOptions(process.cwd());const g=this._importResolverFactory(t,r,this._hostFactory());this._backgroundAnalysisProgram=void 0!==m?m(this._console,r,g,this._extension,o,this._maxAnalysisTimeInForeground):new y.BackgroundAnalysisProgram(this._console,r,g,this._extension,o,this._maxAnalysisTimeInForeground)}clone(e,t,n){const i=new v(e,null!=n?n:this._fs,this._console,this._hostFactory,this._importResolverFactory,this._backgroundAnalysisProgram.configOptions,this._extension,t,this._maxAnalysisTimeInForeground,this._backgroundAnalysisProgramFactory,this._cancellationProvider);for(const e of this.backgroundAnalysisProgram.program.getOpened()){const t=e.sourceFile.getClientVersion();void 0!==t&&i.setFileOpened(e.sourceFile.getFilePath(),t,e.sourceFile.getOpenFileContents())}return i}dispose(){this._disposed=!0,this._removeSourceFileWatchers(),this._removeConfigFileWatcher(),this._removeLibraryFileWatcher(),this._clearReloadConfigTimer(),this._clearReanalysisTimer(),this._clearLibraryReanalysisTimer()}get backgroundAnalysisProgram(){return this._backgroundAnalysisProgram}static createImportResolver(e,t,n){return new g.ImportResolver(e,t,n)}setCompletionCallback(e){this._onCompletionCallback=e,this._backgroundAnalysisProgram.setCompletionCallback(e)}setOptions(e){this._commandLineOptions=e;const t=this._hostFactory(),n=this._getConfigOptions(t,e);n.pythonPath&&n.ensureDefaultPythonVersion(t,this._console),n.ensureDefaultPythonPlatform(t,this._console),this._backgroundAnalysisProgram.setConfigOptions(n),this._executionRootPath=(0,m.normalizePath)((0,m.combinePaths)(e.executionRoot,n.projectRoot)),this._applyConfigOptions(t)}isTracked(e){for(const t of this._configOptions.include)if(this._matchIncludeFileSpec(t.regExp,this._configOptions.exclude,e))return!0;return!1}setFileOpened(e,t,n){this._backgroundAnalysisProgram.setFileOpened(e,t,n,this.isTracked(e)),this._scheduleReanalysis(!1)}updateOpenFileContents(e,t,n){this._backgroundAnalysisProgram.updateOpenFileContents(e,t,n,this.isTracked(e)),this._scheduleReanalysis(!1)}test_setIndexing(e,t){this._backgroundAnalysisProgram.test_setIndexing(e,t)}startIndexing(){this._backgroundAnalysisProgram.startIndexing()}setFileClosed(e){this._backgroundAnalysisProgram.setFileClosed(e),this._scheduleReanalysis(!1)}getParseResult(e){var t;return null===(t=this._program.getBoundSourceFile(e))||void 0===t?void 0:t.getParseResults()}getTextOnRange(e,t,n){return this._program.getTextOnRange(e,t,n)}getAutoImports(e,t,n,i,s,r,a){return this._program.getAutoImports(e,t,n,i,this._backgroundAnalysisProgram.getIndexing(e),s,r,a)}getDefinitionForPosition(e,t,n,i){return this._program.getDefinitionsForPosition(e,t,n,i)}getTypeDefinitionForPosition(e,t,n){return this._program.getTypeDefinitionsForPosition(e,t,n)}reportReferencesForPosition(e,t,n,i,s){this._program.reportReferencesForPosition(e,t,n,i,s)}addSymbolsForDocument(e,t,n){this._program.addSymbolsForDocument(e,t,n)}reportSymbolsForWorkspace(e,t,n){this._program.reportSymbolsForWorkspace(e,t,n)}getHoverForPosition(e,t,n,i){return this._program.getHoverForPosition(e,t,n,i)}getDocumentHighlight(e,t,n){return this._program.getDocumentHighlight(e,t,n)}getSignatureHelpForPosition(e,t,n,i){return this._program.getSignatureHelpForPosition(e,t,n,i)}getCompletionsForPosition(e,t,n,i,s,r){return this._program.getCompletionsForPosition(e,t,n,i,s,this._backgroundAnalysisProgram.getIndexing(e),r)}getEvaluator(){return this._program.evaluator}resolveCompletionItem(e,t,n,i,s){this._program.resolveCompletionItem(e,t,n,i,this._backgroundAnalysisProgram.getIndexing(e),s)}performQuickAction(e,t,n,i){return this._program.performQuickAction(e,t,n,i)}renameModule(e,t,n){return this._program.renameModule(e,t,n)}renameSymbolAtPosition(e,t,n,i,s){return this._program.renameSymbolAtPosition(e,t,n,i,s)}getCallForPosition(e,t,n){return this._program.getCallForPosition(e,t,n)}getIncomingCallsForPosition(e,t,n){return this._program.getIncomingCallsForPosition(e,t,n)}getOutgoingCallsForPosition(e,t,n){return this._program.getOutgoingCallsForPosition(e,t,n)}printStats(){this._console.info(""),this._console.info("Analysis stats");const e=this._program.getFileCount();this._console.info("Total files analyzed: "+e.toString())}printDependencies(e){this._program.printDependencies(this._executionRootPath,e)}getDiagnosticsForRange(e,t,n){return this._backgroundAnalysisProgram.getDiagnosticsForRange(e,t,n)}getConfigOptions(){return this._configOptions}getImportResolver(){return this._backgroundAnalysisProgram.importResolver}recordUserInteractionTime(){this._lastUserInteractionTime=Date.now(),this._analyzeTimer&&this._scheduleReanalysis(!1)}get test_program(){return this._program}test_getConfigOptions(e){return this._getConfigOptions(this._backgroundAnalysisProgram.host,e)}test_getFileNamesFromFileSpecs(){return this._getFileNamesFromFileSpecs()}_getConfigOptions(e,t){var n,i,s;let r,a,o=t.executionRoot;t.configFilePath?(r=(0,m.combinePaths)(t.executionRoot,(0,m.normalizePath)(t.configFilePath)),this._fs.existsSync(r)?r.toLowerCase().endsWith(".json")?o=(0,m.getDirectoryPath)(r):(o=r,r=this._findConfigFile(r),r||this._console.info(`Configuration file not found at ${o}.`)):(this._console.info(`Configuration file not found at ${r}.`),r=t.executionRoot)):o&&(r=this._findConfigFile(o),r||t.fromVsCodeExtension||(r=this._findConfigFileHereOrUp(o)),r?o=(0,m.getDirectoryPath)(r):(this._console.info("No configuration file found."),r=void 0)),r||(a=this._findPyprojectTomlFile(o),a||t.fromVsCodeExtension||(a=this._findPyprojectTomlFileHereOrUp(o)),a?(o=(0,m.getDirectoryPath)(a),this._console.info(`pyproject.toml file found at ${o}.`)):this._console.info("No pyproject.toml file found."));const l=new c.ConfigOptions(o,this._typeCheckingMode),p=["**/node_modules","**/__pycache__",".git"];let d;if(t.pythonPath&&(this._console.info(`Setting pythonPath for service "${this._instanceName}": "${t.pythonPath}"`),l.pythonPath=t.pythonPath),l.defaultPythonPlatform=t.pythonPlatform,l.defaultPythonVersion=t.pythonVersion,l.ensureDefaultExtraPaths(this._fs,t.autoSearchPaths||!1,t.extraPaths),t.fileSpecs.length>0?t.fileSpecs.forEach((e=>{l.include.push((0,m.getFileSpec)(o,e))})):r||t.executionRoot&&(l.include.push((0,m.getFileSpec)(t.executionRoot,".")),p.forEach((e=>{l.exclude.push((0,m.getFileSpec)(t.executionRoot,e))}))),this._configFilePath=r||a,r?(this._console.info(`Loading configuration file at ${r}`),d=this._parseJsonConfigFile(r)):a&&(this._console.info(`Loading pyproject.toml file at ${a}`),d=this._parsePyprojectTomlFile(a)),d){l.initializeFromJson(d,this._typeCheckingMode,this._console,e,t.diagnosticSeverityOverrides,t.fileSpecs.length>0);const n=(0,m.getDirectoryPath)(this._configFilePath);0===l.include.length&&(this._console.info(`No include entries specified; assuming ${n}`),l.include.push((0,m.getFileSpec)(n,"."))),0===l.exclude.length&&(p.forEach((e=>{this._console.info(`Auto-excluding ${e}`),l.exclude.push((0,m.getFileSpec)(n,e))})),void 0===l.autoExcludeVenv&&(l.autoExcludeVenv=!0))}else l.autoExcludeVenv=!0,l.applyDiagnosticOverrides(t.diagnosticSeverityOverrides);l.analyzeUnannotatedFunctions=null===(n=t.analyzeUnannotatedFunctions)||void 0===n||n;const u=(e,n)=>{const i=t.fromVsCodeExtension?"the client settings":"a command-line option";this._console.warn(`The ${e} has been specified in both the config file and ${i}. The value in the config file (${n}) will take precedence`)};if(t.venvPath&&(l.venvPath?u("venvPath",l.venvPath):l.venvPath=t.venvPath),t.typeshedPath&&(l.typeshedPath?u("typeshedPath",l.typeshedPath):l.typeshedPath=t.typeshedPath),l.verboseOutput=null!==(i=t.verboseOutput)&&void 0!==i?i:l.verboseOutput,l.checkOnlyOpenFiles=!!t.checkOnlyOpenFiles,l.autoImportCompletions=!!t.autoImportCompletions,l.indexing=!!t.indexing,l.logTypeEvaluationTime=!!t.logTypeEvaluationTime,l.typeEvaluationTimeThreshold=t.typeEvaluationTimeThreshold,void 0===l.useLibraryCodeForTypes?l.useLibraryCodeForTypes=!!t.useLibraryCodeForTypes:void 0!==t.useLibraryCodeForTypes&&u("useLibraryCodeForTypes",l.useLibraryCodeForTypes),t.stubPath?l.stubPath?u("stubPath",l.stubPath):l.stubPath=t.stubPath:l.stubPath||(l.stubPath=(0,m.normalizePath)((0,m.combinePaths)(l.projectRoot,"typings"))),l.venvPath&&(this._fs.existsSync(l.venvPath)&&(0,m.isDirectory)(this._fs,l.venvPath)||this._console.error(`venvPath ${l.venvPath} is not a valid directory.`),l.venv=null!==(s=l.venv)&&void 0!==s?s:this._configOptions.venv,l.venv)){const t=(0,m.combinePaths)(l.venvPath,l.venv);if(this._fs.existsSync(t)&&(0,m.isDirectory)(this._fs,t)){const t=[];void 0===(0,f.findPythonSearchPaths)(this._fs,l,e,t)&&(this._console.error(`site-packages directory cannot be located for venvPath ${l.venvPath} and venv ${l.venv}.`),l.verboseOutput&&t.forEach((e=>{this._console.error(`  ${e}`)})))}else this._console.error(`venv ${l.venv} subdirectory not found in venv path ${l.venvPath}.`)}return l.venv&&(l.venvPath||this._console.warn("venvPath not specified, so venv settings will be ignored.")),l.typeshedPath&&(this._fs.existsSync(l.typeshedPath)&&(0,m.isDirectory)(this._fs,l.typeshedPath)||this._console.error(`typeshedPath ${l.typeshedPath} is not a valid directory.`)),l.stubPath&&(this._fs.existsSync(l.stubPath)&&(0,m.isDirectory)(this._fs,l.stubPath)||this._console.warn(`stubPath ${l.stubPath} is not a valid directory.`)),l}writeTypeStub(e){var t;const n=this._getTypeStubFolder();this._program.writeTypeStub(null!==(t=this._typeStubTargetPath)&&void 0!==t?t:"",this._typeStubTargetIsSingleFile,n,e)}writeTypeStubInBackground(e){var t;const n=this._getTypeStubFolder();return this._backgroundAnalysisProgram.writeTypeStub(null!==(t=this._typeStubTargetPath)&&void 0!==t?t:"",this._typeStubTargetIsSingleFile,n,e)}invalidateAndForceReanalysis(e=!0,t=!1){t&&this._updateTrackedFileList(!1),this._backgroundAnalysisProgram.invalidateAndForceReanalysis(e)}restart(){this._applyConfigOptions(this._hostFactory()),this._backgroundAnalysisProgram.restart()}get _fs(){return this._backgroundAnalysisProgram.importResolver.fileSystem}get _program(){return this._backgroundAnalysisProgram.program}get _configOptions(){return this._backgroundAnalysisProgram.configOptions}get _watchForSourceChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForSourceChanges)}get _watchForLibraryChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForLibraryChanges)}get _watchForConfigChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForConfigChanges)}get _typeCheckingMode(){var e;return null===(e=this._commandLineOptions)||void 0===e?void 0:e.typeCheckingMode}get _verboseOutput(){return!!this._configOptions.verboseOutput}get _typeStubTargetImportName(){var e;return null===(e=this._commandLineOptions)||void 0===e?void 0:e.typeStubTargetImportName}_getTypeStubFolder(){const e=this._configOptions.stubPath;if(!this._typeStubTargetPath||!this._typeStubTargetImportName){const e=`Import '${this._typeStubTargetImportName}' could not be resolved`;throw this._console.error(e),new Error(e)}if(!e){const e="No typings path was specified";throw this._console.info(e),new Error(e)}const t=this._typeStubTargetImportName.split(".");if(0===t[0].length){const e=`Import '${this._typeStubTargetImportName}' could not be resolved`;throw this._console.error(e),new Error(e)}try{this._fs.existsSync(e)||this._fs.mkdirSync(e)}catch(t){const n=`Could not create typings directory '${e}'`;throw this._console.error(n),new Error(n)}const n=(0,m.combinePaths)(e,t[0]),i=(0,m.combinePaths)(e,...t);try{this._fs.existsSync(i)||(0,m.makeDirectories)(this._fs,i,e)}catch(e){const t=`Could not create typings subdirectory '${i}'`;throw this._console.error(t),new Error(t)}return n}_findConfigFileHereOrUp(e){return(0,m.forEachAncestorDirectory)(e,(e=>this._findConfigFile(e)))}_findConfigFile(e){for(const n of t.configFileNames){const t=(0,m.combinePaths)(e,n);if(this._fs.existsSync(t))return t}}_findPyprojectTomlFileHereOrUp(e){return(0,m.forEachAncestorDirectory)(e,(e=>this._findPyprojectTomlFile(e)))}_findPyprojectTomlFile(e){const n=(0,m.combinePaths)(e,t.pyprojectTomlName);if(this._fs.existsSync(n))return n}_parseJsonConfigFile(e){return this._attemptParseFile(e,(e=>o.parse(e)))}_parsePyprojectTomlFile(e){return this._attemptParseFile(e,((t,n)=>{try{const e=a.parse(t);if(e&&e.tool&&e.tool.pyright)return e.tool.pyright}catch(e){throw this._console.error(`Pyproject file parse attempt ${n} error: ${JSON.stringify(e)}`),e}this._console.error(`Pyproject file "${e}" is missing "[tool.pyright]" section.`)}))}_attemptParseFile(e,t){let n="",i=0;for(;;){try{n=this._fs.readFileSync(e,"utf8")}catch{return this._console.error(`Config file "${e}" could not be read.`),void this._reportConfigParseError()}let s=!1;try{return t(n,i+1)}catch(e){s=!0}if(!s)break;if(i++>=5)return this._console.error(`Config file "${e}" could not be parsed. Verify that format is correct.`),void this._reportConfigParseError()}}_getFileNamesFromFileSpecs(){const e=new Map;return h.timingStats.findFilesTime.timeOperation((()=>{const t=this._matchFiles(this._configOptions.include,this._configOptions.exclude);for(const n of t)e.set(n,n)})),[...e.values()]}_updateTrackedFileList(e){if(this._typeStubTargetImportName){const e=this._configOptions.findExecEnvironment(this._executionRootPath),t=(0,g.createImportedModuleDescriptor)(this._typeStubTargetImportName),n=this._backgroundAnalysisProgram.importResolver.resolveImport("",e,t);if(n.isImportFound){const e=[],t=n.resolvedPaths[n.resolvedPaths.length-1],i=(0,m.isFile)(this._fs,t),s=i&&"__init__"===(0,m.stripFileExtension)((0,m.getFileName)(t));let r=t;i&&(r=(0,m.getDirectoryPath)(r));for(let e=n.resolvedPaths.length-2;e>=0;e--)r=n.resolvedPaths[e]?n.resolvedPaths[e]:(0,m.getDirectoryPath)(r);(0,m.isDirectory)(this._fs,r)?this._typeStubTargetPath=r:(0,m.isFile)(this._fs,r)&&(this._typeStubTargetPath=(0,m.getDirectoryPath)(r)),t?(e.push(t),this._typeStubTargetIsSingleFile=1===n.resolvedPaths.length&&!s):this._typeStubTargetIsSingleFile=!1,n.filteredImplicitImports.forEach((t=>{e.push(t.path)})),this._backgroundAnalysisProgram.setAllowedThirdPartyImports([this._typeStubTargetImportName]),this._backgroundAnalysisProgram.setTrackedFiles(e)}else this._console.error(`Import '${this._typeStubTargetImportName}' not found`)}else{let t=[];this._console.info("Searching for source files"),t=this._getFileNamesFromFileSpecs(),this._backgroundAnalysisProgram.setTrackedFiles(t),this._backgroundAnalysisProgram.markAllFilesDirty(e),0===t.length?this._console.info("No source files found."):this._console.info(`Found ${t.length} source `+(1===t.length?"file":"files"))}this._requireTrackedFileUpdate=!1}_matchFiles(e,t){const n=[["bin","activate"],["Scripts","activate"],["pyvenv.cfg"]],i=[],s=Date.now();let r=!1;const a=(e,a)=>{if(r||.001*(Date.now()-s)>=10&&(this._console.error('Enumeration of workspace source files is taking longer than 10 seconds.\nThis may be because:\n* You have opened your home directory or entire hard drive as a workspace\n* Your workspace contains a very large number of directories and files\n* Your workspace contains a symlink to a directory with many files\n* Your workspace is remote, and file enumeration is slow\nTo reduce this time, open a workspace directory with fewer files or add a pyrightconfig.json configuration file with an "exclude" section to exclude subdirectories from your workspace. For more details, refer to https://github.com/microsoft/pyright/blob/main/docs/configuration.md.'),r=!0),this._configOptions.autoExcludeVenv&&n.some((t=>this._fs.existsSync((0,m.combinePaths)(e,...t)))))return void this._console.info(`Auto-excluding ${e}`);const{files:o,directories:c}=(0,m.getFileSystemEntries)(this._fs,e);for(const n of o){const s=(0,m.combinePaths)(e,n);this._matchIncludeFileSpec(a,t,s)&&i.push(s)}for(const n of c){const i=(0,m.combinePaths)(e,n);a.test(i)&&(this._isInExcludePath(i,t)||l(i,a))}},o=new Set,l=(e,t)=>{const n=(0,m.tryRealpath)(this._fs,e);if(n)if(o.has(n))this._console.warn(`Skipping recursive symlink "${e}" -> "${n}"`);else{o.add(n);try{a(e,t)}finally{o.delete(n)}}else this._console.warn(`Skipping broken link "${e}"`)};return e.forEach((e=>{if(!this._isInExcludePath(e.wildcardRoot,t)){let t=!1;const n=(0,m.tryStat)(this._fs,e.wildcardRoot);(null==n?void 0:n.isFile())?this._shouldIncludeFile(e.wildcardRoot)&&(i.push(e.wildcardRoot),t=!0):(null==n?void 0:n.isDirectory())&&(l(e.wildcardRoot,e.regExp),t=!0),t||this._console.error(`File or directory "${e.wildcardRoot}" does not exist.`)}})),i}_removeSourceFileWatchers(){this._sourceFileWatcher&&(this._sourceFileWatcher.close(),this._sourceFileWatcher=void 0)}_updateSourceFileWatchers(){if(this._removeSourceFileWatchers(),this._watchForSourceChanges&&this._configOptions.include.length>0){const e=this._configOptions.include.map((e=>(0,m.combinePaths)(this._executionRootPath,e.wildcardRoot)));try{this._verboseOutput&&this._console.info(`Adding fs watcher for directories:\n ${e.join("\n")}`);const t=(0,d.ignoredWatchEventFunction)(e);this._sourceFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{if(!n)return;if(this._verboseOutput&&this._console.info(`SourceFile: Received fs event '${e}' for path '${n}'`),t(n))return;if(n.endsWith(".tmp")||n.endsWith(".git")||n.includes(T))return;const i=(0,m.tryStat)(this._fs,n);if(!i||!i.isFile()||n.endsWith(".py")||n.endsWith(".pyi"))if("change"===e&&i)this._backgroundAnalysisProgram.markFilesDirty([n],!1),this._scheduleReanalysis(!1);else{const e=(0,m.getFileName)(n).split(".");let t=!1;4===e.length&&e[3]===e[1]&&32===e[2].length&&(t=!0),t||(this.invalidateAndForceReanalysis(!1),this._scheduleReanalysis(!0))}}))}catch{this._console.error(`Exception caught when installing fs watcher for:\n ${e.join("\n")}`)}}}_removeLibraryFileWatcher(){this._libraryFileWatcher&&(this._libraryFileWatcher.close(),this._libraryFileWatcher=void 0)}_updateLibraryFileWatcher(){if(this._removeLibraryFileWatcher(),!this._watchForLibraryChanges)return;const e=(0,f.findPythonSearchPaths)(this._fs,this._backgroundAnalysisProgram.configOptions,this._backgroundAnalysisProgram.host,[],!0,this._executionRootPath);if(e&&e.length>0)try{this._verboseOutput&&this._console.info(`Adding fs watcher for library directories:\n ${e.join("\n")}`);const t=(0,d.ignoredWatchEventFunction)(e);this._libraryFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{n&&(this._verboseOutput&&this._console.info(`LibraryFile: Received fs event '${e}' for path '${n}'}'`),t(n)||this._scheduleLibraryAnalysis())}))}catch{this._console.error(`Exception caught when installing fs watcher for:\n ${e.join("\n")}`)}}_clearLibraryReanalysisTimer(){var e;this._libraryReanalysisTimer&&(clearTimeout(this._libraryReanalysisTimer),this._libraryReanalysisTimer=void 0,null===(e=this._backgroundAnalysisProgram)||void 0===e||e.cancelIndexing())}_scheduleLibraryAnalysis(){this._disposed||(this._clearLibraryReanalysisTimer(),this._libraryReanalysisTimer=setTimeout((()=>{this._clearLibraryReanalysisTimer(),this.invalidateAndForceReanalysis(),this._scheduleReanalysis(!1)}),1e3))}_removeConfigFileWatcher(){this._configFileWatcher&&(this._configFileWatcher.close(),this._configFileWatcher=void 0)}_updateConfigFileWatcher(){this._removeConfigFileWatcher(),this._watchForConfigChanges&&(this._configFilePath?this._configFileWatcher=this._fs.createFileSystemWatcher([this._configFilePath],(e=>{this._verboseOutput&&this._console.info(`Received fs event '${e}' for config file`),this._scheduleReloadConfigFile()})):this._executionRootPath&&(this._configFileWatcher=this._fs.createFileSystemWatcher([this._executionRootPath],((e,n)=>{if(n&&("add"===e||"change"===e)){const i=(0,m.getFileName)(n);i&&t.configFileNames.some((e=>e===i))&&(this._verboseOutput&&this._console.info(`Received fs event '${e}' for config file`),this._commandLineOptions&&this.setOptions(this._commandLineOptions))}}))))}_clearReloadConfigTimer(){this._reloadConfigTimer&&(clearTimeout(this._reloadConfigTimer),this._reloadConfigTimer=void 0)}_scheduleReloadConfigFile(){this._clearReloadConfigTimer(),this._reloadConfigTimer=setTimeout((()=>{this._clearReloadConfigTimer(),this._reloadConfigFile()}),100)}_reloadConfigFile(){if(this._updateConfigFileWatcher(),this._configFilePath){this._console.info(`Reloading configuration file at ${this._configFilePath}`);const e=this._backgroundAnalysisProgram.host,t=this._getConfigOptions(e,this._commandLineOptions);this._backgroundAnalysisProgram.setConfigOptions(t),this._applyConfigOptions(e)}}_applyConfigOptions(e){var t;const n=this._importResolverFactory(this._fs,this._backgroundAnalysisProgram.configOptions,e);if(this._backgroundAnalysisProgram.setImportResolver(n),(null===(t=this._commandLineOptions)||void 0===t?void 0:t.fromVsCodeExtension)||this._configOptions.verboseOutput){const e=this._configOptions.verboseOutput?p.LogLevel.Info:p.LogLevel.Log;for(const t of this._configOptions.getExecutionEnvironments())(0,p.log)(this._console,e,`Search paths for ${t.root||"<default>"}`),n.getImportRoots(t,!0).forEach((t=>{(0,p.log)(this._console,e,`  ${t}`)}))}this._updateLibraryFileWatcher(),this._updateConfigFileWatcher(),this._updateSourceFileWatchers(),this._updateTrackedFileList(!0),this._scheduleReanalysis(!1)}_clearReanalysisTimer(){this._analyzeTimer&&(clearTimeout(this._analyzeTimer),this._analyzeTimer=void 0)}_scheduleReanalysis(e){var t,n;if(this._disposed||!(null===(t=this._commandLineOptions)||void 0===t?void 0:t.enableAmbientAnalysis))return;e&&(this._requireTrackedFileUpdate=!0),null===(n=this._backgroundAnalysisCancellationSource)||void 0===n||n.cancel(),this._clearReanalysisTimer();const i=Date.now()-this._lastUserInteractionTime,s=Math.max(250-i,20);this._analyzeTimer=setTimeout((()=>{this._analyzeTimer=void 0,this._requireTrackedFileUpdate&&this._updateTrackedFileList(!1),this._backgroundAnalysisCancellationSource=this._cancellationProvider.createCancellationTokenSource(),this._backgroundAnalysisProgram.startAnalysis(this._backgroundAnalysisCancellationSource.token)&&this._scheduleReanalysis(!1)}),s)}_reportConfigParseError(){this._onCompletionCallback&&this._onCompletionCallback({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!1,configParseErrorOccurred:!0,elapsedTime:0})}_shouldIncludeFile(e){return _.test(e)}_isInExcludePath(e,t){return!!t.find((t=>t.regExp.test(e)))}_matchIncludeFileSpec(e,t,n){return!(!e.test(n)||this._isInExcludePath(n,t)||!this._shouldIncludeFile(n))}}t.AnalyzerService=v},4221:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SourceFile=void 0;const a=n(2714),o=n(1267),l=r(n(1766)),c=n(3213),p=n(2930),d=n(2211),u=n(5839),m=n(1290),h=n(3980),y=n(7345),g=n(6657),f=r(n(7559)),T=n(3550),_=n(3420),v=n(8718),b=n(9209),I=n(3778),C=n(8221),S=n(2816),F=n(3334),D=n(2858),P=n(4952),x=n(9437),A=n(2122),k=n(5275),E=n(5303),w=r(n(563)),N=n(6052),R=n(6329),M=r(n(2272)),O=n(4482),L=n(2041);t.SourceFile=class{constructor(e,t,n,i,s,r,a){this._isFileDeleted=!1,this._diagnosticVersion=0,this._fileContentsVersion=0,this._lastFileContentLength=void 0,this._lastFileContentHash=void 0,this._analyzedFileContentsVersion=-1,this._parseTreeNeedsCleaning=!1,this._isBindingInProgress=!1,this._parseDiagnostics=[],this._bindDiagnostics=[],this._checkerDiagnostics=[],this._typeIgnoreLines={},this._typeIgnoreAll=!1,this._diagnosticRuleSet=(0,p.getBasicDiagnosticRuleSet)(),this._circularDependencies=[],this._isBindingNeeded=!0,this._isCheckingNeeded=!0,this._indexingNeeded=!0,this.fileSystem=e,this._console=r||new d.StandardConsole,this._filePath=t,this._moduleName=n,this._isStubFile=t.endsWith(".pyi"),this._isThirdPartyImport=i,this._isThirdPartyPyTypedPresent=s;const l=(0,g.getFileName)(t);this._isTypingStubFile=this._isStubFile&&(this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/typing.pyi"))||"typing_extensions.pyi"===l),this._isTypingExtensionsStubFile=this._isStubFile&&"typing_extensions.pyi"===l,this._isBuiltInStubFile=!1,this._isStubFile&&(this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/collections/__init__.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/asyncio/futures.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/asyncio/tasks.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/builtins.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/_importlib_modulespec.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/dataclasses.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/abc.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/enum.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/queue.pyi"))||this._filePath.endsWith((0,g.normalizeSlashes)("stdlib/types.pyi")))&&(this._isBuiltInStubFile=!0),this._logTracker=null!=a?a:new y.LogTracker(r,o.isMainThread?"FG":"BG")}getFilePath(){return this._filePath}getDiagnosticVersion(){return this._diagnosticVersion}isStubFile(){return this._isStubFile}isThirdPartyPyTypedPresent(){return this._isThirdPartyPyTypedPresent}getDiagnostics(e,t){if(this._diagnosticVersion===t)return;let n=!0;this._isThirdPartyImport&&(n=!1);let i=[];if(i=i.concat(this._parseDiagnostics,this._bindDiagnostics,this._checkerDiagnostics),e.diagnosticRuleSet.enableTypeIgnoreComments&&Object.keys(this._typeIgnoreLines).length>0&&(i=i.filter((e=>{if(3!==e.category&&4!==e.category)for(let t=e.range.start.line;t<=e.range.end.line;t++)if(this._typeIgnoreLines[t])return!1;return!0}))),"none"!==e.diagnosticRuleSet.reportImportCycles&&this._circularDependencies.length>0){const t=(0,m.convertLevelToCategory)(e.diagnosticRuleSet.reportImportCycles);this._circularDependencies.forEach((e=>{i.push(new m.Diagnostic(t,A.Localizer.Diagnostic.importCycleDetected()+"\n"+e.getPaths().map((e=>"  "+e)).join("\n"),(0,T.getEmptyRange)()))}))}return void 0!==this._hitMaxImportDepth&&i.push(new m.Diagnostic(0,A.Localizer.Diagnostic.importDepthExceeded().format({depth:this._hitMaxImportDepth}),(0,T.getEmptyRange)())),e.ignore.find((e=>e.regExp.test(this._filePath)))&&(i=[]),e.diagnosticRuleSet.enableTypeIgnoreComments&&this._typeIgnoreAll&&(i=[]),n||(i=i.filter((e=>3===e.category||4===e.category))),i}getImports(){return this._imports||[]}getBuiltinsImport(){return this._builtinsImport}getModuleSymbolTable(){return this._moduleSymbolTable}didContentsChangeOnDisk(){if(this._clientDocument)return!1;if(void 0===this._lastFileContentLength)return!1;try{const e=this.fileSystem.readFileSync(this._filePath,"utf8");if(e.length!==this._lastFileContentLength)return!0;if(f.hashString(e)!==this._lastFileContentHash)return!0}catch(e){return!0}return!1}dropParseAndBindInfo(){this._parseResults=void 0,this._moduleSymbolTable=void 0,this._isBindingNeeded=!0}markDirty(){this._fileContentsVersion++,this._isCheckingNeeded=!0,this._isBindingNeeded=!0,this._indexingNeeded=!0,this._moduleSymbolTable=void 0,this._cachedIndexResults=void 0}markReanalysisRequired(){this._isCheckingNeeded=!0,this._parseResults&&(this._parseResults.containsWildcardImport||void 0!==w.getDunderAllInfo(this._parseResults.parseTree))&&(this._parseTreeNeedsCleaning=!0,this._isBindingNeeded=!0,this._indexingNeeded=!0,this._moduleSymbolTable=void 0,this._cachedIndexResults=void 0)}getClientVersion(){var e;return null===(e=this._clientDocument)||void 0===e?void 0:e.version}getOpenFileContents(){var e;return null===(e=this._clientDocument)||void 0===e?void 0:e.getText()}getFileContent(){const e=this.getOpenFileContents();if(e)return e;try{const e=this.fileSystem.statSync(this._filePath);if(e.size>52428800)throw this._console.error(`File length of "${this._filePath}" is ${e.size} which exceeds the maximum supported file size of 52428800`),new Error("File larger than max");return this.fileSystem.readFileSync(this._filePath,"utf8")}catch(e){return}}setClientVersion(e,t){if(null===e)this._clientDocument=void 0;else{this._clientDocument||(this._clientDocument=a.TextDocument.create(this._filePath,"python",e,"")),this._clientDocument=a.TextDocument.update(this._clientDocument,t,e);const n=this._clientDocument.getText(),i=f.hashString(n);n.length===this._lastFileContentLength&&i===this._lastFileContentHash||this.markDirty(),this._lastFileContentLength=n.length,this._lastFileContentHash=i,this._isFileDeleted=!1}}prepareForClose(){}isFileDeleted(){return this._isFileDeleted}isParseRequired(){return!this._parseResults||this._analyzedFileContentsVersion!==this._fileContentsVersion}isBindingRequired(){return!this._isBindingInProgress&&(!!this.isParseRequired()||this._isBindingNeeded)}isIndexingRequired(){return this._indexingNeeded}isCheckingRequired(){return this._isCheckingNeeded}getParseResults(){if(!this.isParseRequired())return this._parseResults}getCachedIndexResults(){return this._cachedIndexResults}cacheIndexResults(e){this._cachedIndexResults=e}addCircularDependency(e){let t=!1;this._circularDependencies.length<4&&(this._circularDependencies.some((t=>t.isEqual(e)))||(this._circularDependencies.push(e),t=!0)),t&&this._diagnosticVersion++}setHitMaxImportDepth(e){this._hitMaxImportDepth=e}parse(e,t,n){return this._logTracker.log(`parsing: ${this._getPathForLogging(this._filePath)}`,(i=>{var s;if(!this.isParseRequired())return i.suppress(),!1;const r=new h.DiagnosticSink;let a=this.getOpenFileContents();if(void 0===a)try{const e=v.timingStats.readFileTime.totalTime;v.timingStats.readFileTime.timeOperation((()=>{if(a=null!=n?n:this.getFileContent(),void 0===a)throw new Error("Can't get file content");this._lastFileContentLength=a.length,this._lastFileContentHash=f.hashString(a)})),i.add(`fs read ${v.timingStats.readFileTime.totalTime-e}ms`)}catch(e){r.addError("Source file could not be read",(0,T.getEmptyRange)()),a="",this.fileSystem.existsSync(this._filePath)||(this._isFileDeleted=!0)}const o=e.findExecEnvironment(this._filePath),l=new E.ParseOptions;this._filePath.endsWith("pyi")&&(l.isStubFile=!0),l.pythonVersion=o.pythonVersion,l.skipFunctionAndClassBody=null!==(s=e.indexGenerationMode)&&void 0!==s&&s;try{const n=(new E.Parser).parseSourceFile(a,l,r);(0,u.assert)(void 0!==n&&void 0!==n.tokenizerOutput),this._parseResults=n,this._typeIgnoreLines=this._parseResults.tokenizerOutput.typeIgnoreLines,this._typeIgnoreAll=this._parseResults.tokenizerOutput.typeIgnoreAll,v.timingStats.resolveImportsTime.timeOperation((()=>{const e=this._resolveImports(t,n.importedModules,o);this._imports=e.imports,this._builtinsImport=e.builtinsImportResult,this._typingModulePath=e.typingModulePath,this._typeshedModulePath=e.typeshedModulePath,this._collectionsModulePath=e.collectionsModulePath,this._parseDiagnostics=r.fetchAndClear()}));const i=void 0!==e.strict.find((e=>e.regExp.test(this._filePath)));this._diagnosticRuleSet=M.getFileLevelDirectives(this._parseResults.tokenizerOutput.tokens,e.diagnosticRuleSet,i)}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(A.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message:t})),this._parseResults={text:"",parseTree:k.ModuleNode.create({start:0,length:0}),importedModules:[],futureImports:new Map,tokenizerOutput:{tokens:new _.TextRangeCollection([]),lines:new _.TextRangeCollection([]),typeIgnoreAll:!1,typeIgnoreLines:{},predominantEndOfLineSequence:"\n",predominantTabSequence:"    ",predominantSingleQuoteCharacter:"'"},containsWildcardImport:!1},this._imports=void 0,this._builtinsImport=void 0;const n=new h.DiagnosticSink;n.addError(A.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message:t}),(0,T.getEmptyRange)()),this._parseDiagnostics=n.fetchAndClear()}return this._analyzedFileContentsVersion=this._fileContentsVersion,this._indexingNeeded=!0,this._isBindingNeeded=!0,this._isCheckingNeeded=!0,this._parseTreeNeedsCleaning=!1,this._hitMaxImportDepth=void 0,this._diagnosticVersion++,!0}))}index(e,t){return this._logTracker.log(`indexing: ${this._getPathForLogging(this._filePath)}`,(n=>{if(!this._parseResults||!this.isIndexingRequired())return void n.suppress();this._indexingNeeded=!1;const i=S.DocumentSymbolProvider.indexSymbols(w.getFileInfo(this._parseResults.parseTree),this._parseResults,e,t);n.add(`found ${i.length}`);const s=(0,g.stripFileExtension)((0,g.getFileName)(this._filePath));return{privateOrProtected:l.isPrivateOrProtectedName(s),symbols:i}}))}getDefinitionsForPosition(e,t,n,i,s){if(this._parseResults)return I.DefinitionProvider.getDefinitionsForPosition(e,this._parseResults,t,n,i,s)}getTypeDefinitionsForPosition(e,t,n,i,s){if(this._parseResults)return I.DefinitionProvider.getTypeDefinitionsForPosition(e,this._parseResults,t,n,i,s)}getDeclarationForNode(e,t,n,i,s){if(this._parseResults)return P.ReferencesProvider.getDeclarationForNode(e,this._filePath,t,n,i,s)}getDeclarationForPosition(e,t,n,i,s){if(this._parseResults)return P.ReferencesProvider.getDeclarationForPosition(e,this._parseResults,this._filePath,t,n,i,s)}addReferences(e,t,n,i){this._parseResults&&P.ReferencesProvider.addReferences(this._parseResults,this._filePath,e,t,n,i)}addHierarchicalSymbolsForDocument(e,t){(this._parseResults||this._cachedIndexResults)&&S.DocumentSymbolProvider.addHierarchicalSymbolsForDocument(this._parseResults?w.getFileInfo(this._parseResults.parseTree):void 0,this.getCachedIndexResults(),this._parseResults,e,t)}getSymbolsForDocument(e,t){return this._parseResults||this._cachedIndexResults?S.DocumentSymbolProvider.getSymbolsForDocument(this._parseResults?w.getFileInfo(this._parseResults.parseTree):void 0,this.getCachedIndexResults(),this._parseResults,this._filePath,e,t):[]}getHoverForPosition(e,t,n,i,s){if(!this._isBindingNeeded&&this._parseResults)return F.HoverProvider.getHoverForPosition(e,this._parseResults,t,n,i,s)}getDocumentHighlight(e,t,n,i){if(!this._isBindingNeeded&&this._parseResults)return C.DocumentHighlightProvider.getDocumentHighlight(this._parseResults,t,n,i)}getSignatureHelpForPosition(e,t,n,i,s){if(this._parseResults)return x.SignatureHelpProvider.getSignatureHelpForPosition(this._parseResults,e,t,n,i,s)}getCompletionsForPosition(e,t,n,i,s,r,a,o,l,c,p,d){if(!this._parseResults)return;const u=this.getOpenFileContents();return void 0!==u?new b.CompletionProvider(t,this._parseResults,u,i,e,this._filePath,n,s,r,a,o,{nameMap:l,libraryMap:c,getModuleSymbolsMap:p},d).getCompletionsForPosition():void 0}resolveCompletionItem(e,t,n,i,s,r,a,o,l,c,p){const d=this.getOpenFileContents();if(!this._parseResults||void 0===d)return;const u=c.data;new b.CompletionProvider(u.workspacePath,this._parseResults,d,t,u.position,this._filePath,e,n,i,s,r,{nameMap:a,libraryMap:o,getModuleSymbolsMap:l},p).resolveCompletionItem(c)}performQuickAction(e,t,n){if(this._parseResults&&void 0!==this.getClientVersion())return(0,D.performQuickAction)(e,t,this._parseResults,n)}bind(e,t,n){return(0,u.assert)(!this.isParseRequired(),"Bind called before parsing"),(0,u.assert)(this.isBindingRequired(),"Bind called unnecessarily"),(0,u.assert)(!this._isBindingInProgress,"Bind called while binding in progress"),(0,u.assert)(void 0!==this._parseResults,"Parse results not available"),this._logTracker.log(`binding: ${this._getPathForLogging(this._filePath)}`,(()=>{try{v.timingStats.bindTime.timeOperation((()=>{this._cleanParseTreeIfRequired();const i=this._buildFileInfo(e,this._parseResults.text,t,n);w.setFileInfo(this._parseResults.parseTree,i);const s=new N.Binder(i,e.indexGenerationMode);this._isBindingInProgress=!0,s.bindModule(this._parseResults.parseTree),e.internalTestMode&&(new L.TestWalker).walk(this._parseResults.parseTree),this._bindDiagnostics=i.diagnosticSink.fetchAndClear();const r=w.getScope(this._parseResults.parseTree);(0,u.assert)(void 0!==r,"Module scope not returned by binder"),this._moduleSymbolTable=r.symbolTable}))}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(A.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message:t}));const n=new h.DiagnosticSink;n.addError(A.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message:t}),(0,T.getEmptyRange)()),this._bindDiagnostics=n.fetchAndClear()}finally{this._isBindingInProgress=!1}this._diagnosticVersion++,this._isCheckingNeeded=!0,this._indexingNeeded=!0,this._isBindingNeeded=!1}))}check(e){return(0,u.assert)(!this.isParseRequired(),"Check called before parsing"),(0,u.assert)(!this.isBindingRequired(),"Check called before binding"),(0,u.assert)(!this._isBindingInProgress,"Check called while binding in progress"),(0,u.assert)(this.isCheckingRequired(),"Check called unnecessarily"),(0,u.assert)(void 0!==this._parseResults,"Parse results not available"),this._logTracker.log(`checking: ${this._getPathForLogging(this._filePath)}`,(()=>{try{v.timingStats.typeCheckerTime.timeOperation((()=>{new R.Checker(this._parseResults.parseTree,e).check(),this._isCheckingNeeded=!1;const t=w.getFileInfo(this._parseResults.parseTree);this._checkerDiagnostics=t.diagnosticSink.fetchAndClear()}))}catch(e){if(!c.OperationCanceledException.is(e)){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(A.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message:t}));const n=new h.DiagnosticSink;n.addError(A.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message:t}),(0,T.getEmptyRange)()),this._checkerDiagnostics=n.fetchAndClear(),this._isCheckingNeeded=!1}throw e}finally{this._circularDependencies=[],this._diagnosticVersion++}}))}_buildFileInfo(e,t,n,i){(0,u.assert)(void 0!==this._parseResults,"Parse results not available");const s=new h.TextRangeDiagnosticSink(this._parseResults.tokenizerOutput.lines);return{importLookup:n,futureImports:this._parseResults.futureImports,builtinsScope:i,typingModulePath:this._typingModulePath,typeshedModulePath:this._typeshedModulePath,collectionsModulePath:this._collectionsModulePath,diagnosticSink:s,executionEnvironment:e.findExecEnvironment(this._filePath),diagnosticRuleSet:this._diagnosticRuleSet,fileContents:t,lines:this._parseResults.tokenizerOutput.lines,filePath:this._filePath,moduleName:this._moduleName,isStubFile:this._isStubFile,isTypingStubFile:this._isTypingStubFile,isTypingExtensionsStubFile:this._isTypingExtensionsStubFile,isBuiltInStubFile:this._isBuiltInStubFile,isInPyTypedPackage:this._isThirdPartyPyTypedPresent,accessedSymbolMap:new Map}}_cleanParseTreeIfRequired(){this._parseResults&&this._parseTreeNeedsCleaning&&(new O.ParseTreeCleanerWalker(this._parseResults.parseTree).clean(),this._parseTreeNeedsCleaning=!1)}_resolveImports(e,t,n){const i=[];let s=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:["builtins"],importedSymbols:void 0});0===s.resolvedPaths.length||s.resolvedPaths[0]!==this.getFilePath()?i.push(s):s=void 0;const r=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:["typing"],importedSymbols:void 0});let a;0!==r.resolvedPaths.length&&r.resolvedPaths[0]===this.getFilePath()||(i.push(r),a=r.resolvedPaths[0]);const o=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:["_typeshed"],importedSymbols:void 0});let l,c;0!==o.resolvedPaths.length&&o.resolvedPaths[0]===this.getFilePath()||(i.push(o),l=o.resolvedPaths[0]);for(const s of t){const t=e.resolveImport(this._filePath,n,{leadingDots:s.leadingDots,nameParts:s.nameParts,importedSymbols:s.importedSymbols});t.isImportFound&&t.isTypeshedFile&&s.nameParts.length>=1&&"collections"===s.nameParts[0]&&(c=t.resolvedPaths[t.resolvedPaths.length-1]),i.push(t),w.setImportInfo(s.nameNode,t)}return{imports:i,builtinsImportResult:s,typingModulePath:a,typeshedModulePath:l,collectionsModulePath:c}}_getPathForLogging(e){return this.fileSystem.isMappedFilePath(e)?"[virtual] "+e:e}}},8816:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isStubFile=t.SourceMapper=void 0;const a=r(n(563)),o=r(n(8494)),l=n(2489),c=n(6657),p=n(8905),d=n(1133),u=n(5168);function m(e){return".pyi"===(0,c.getAnyExtensionFromPath)(e,[".pyi"],!1)}t.SourceMapper=class{constructor(e,t,n,i,s,r,a){this._importResolver=e,this._execEnv=t,this._evaluator=n,this._fileBinder=i,this._boundSourceGetter=s,this._mapCompiled=r,this._preferStubs=a}findModules(e){return this._getBoundSourceFilesFromStubFile(e).map((e=>{var t;return null===(t=e.getParseResults())||void 0===t?void 0:t.parseTree})).filter(l.isDefined)}findDeclarations(e){return(0,p.isClassDeclaration)(e)?this._findClassOrTypeAliasDeclarations(e):(0,p.isFunctionDeclaration)(e)?this._findFunctionOrTypeAliasDeclarations(e):(0,p.isVariableDeclaration)(e)?this._findVariableDeclarations(e):(0,p.isParameterDeclaration)(e)?this._findParameterDeclarations(e):(0,p.isSpecialBuiltInClassDeclaration)(e)?this._findSpecialBuiltInClassDeclarations(e):[]}findClassDeclarations(e){return this._findClassOrTypeAliasDeclarations(e).filter((e=>(0,p.isClassDeclaration)(e))).map((e=>e))}findClassDeclarationsByType(e,t){const n=[];return this._addClassTypeDeclarations(e,t,n,new Set),n.filter((e=>(0,p.isClassDeclaration)(e))).map((e=>e))}findFunctionDeclarations(e){return this._findFunctionOrTypeAliasDeclarations(e).filter((e=>(0,p.isFunctionDeclaration)(e))).map((e=>e))}_findSpecialBuiltInClassDeclarations(e,t=new Set){if(38===e.node.valueExpression.nodeType){const n=e.node.valueExpression.value;return this._getBoundSourceFilesFromStubFile(e.path).flatMap((e=>this._findClassDeclarationsByName(e,n,t)))}return[]}_findClassOrTypeAliasDeclarations(e,t=new Set){const n=this._getFullClassName(e.node);return this._getBoundSourceFilesFromStubFile(e.path).flatMap((e=>this._findClassDeclarationsByName(e,n,t)))}_findFunctionOrTypeAliasDeclarations(e,t=new Set){const n=e.node.name.value,i=this._getBoundSourceFilesFromStubFile(e.path);if(e.isMethod){const s=o.getEnclosingClass(e.node);if(void 0===s)return[];const r=this._getFullClassName(s);return i.flatMap((e=>this._findMethodDeclarationsByName(e,r,n,t)))}return i.flatMap((e=>this._findFunctionDeclarationsByName(e,n,t)))}_findVariableDeclarations(e,t=new Set){if(38!==e.node.nodeType)return[];const n=e.node.value,i=this._getBoundSourceFilesFromStubFile(e.path),s=o.getEnclosingClass(e.node);if(s){const e=this._getFullClassName(s);return i.flatMap((i=>this._findFieldDeclarationsByName(i,e,n,t)))}return i.flatMap((e=>this._findVariableDeclarationsByName(e,n,t)))}_findParameterDeclarations(e){const t=[];if(!e.node.name)return t;const n=o.getEnclosingFunction(e.node);if(!n)return t;const i=this._evaluator.getDeclarationsForNameNode(n.name);if(!i)return t;const s=new Set;for(const n of i)for(const i of this._findFunctionOrTypeAliasDeclarations(n,s))t.push(...this._lookUpSymbolDeclarations(i.node,e.node.name.value).filter((e=>(0,p.isParameterDeclaration)(e))).map((e=>e)));return t}_findMemberDeclarationsByName(e,t,n,i,s){const r=[],a=this._findClassDeclarationsByName(e,t,s);for(const e of a.filter((e=>(0,p.isClassDeclaration)(e))).map((e=>e))){const t=this._evaluator.getTypeOfClass(e.node);if(!t)continue;const a=(0,u.lookUpClassMember)(t.classType,n);if(a)for(const e of a.symbol.getDeclarations())i(e,s,r)}return r}_findFieldDeclarationsByName(e,t,n,i){let s=[];const r=`@${e.getFilePath()}/c/${t}/v/${n}`;return i.has(r)||(i.add(r),s=this._findMemberDeclarationsByName(e,t,n,((e,t,n)=>{if((0,p.isVariableDeclaration)(e))if(this._isStubThatShouldBeMappedToImplementation(e.path))for(const i of this._findVariableDeclarations(e,t))(0,p.isVariableDeclaration)(i)&&n.push(i);else n.push(e)}),i),i.delete(r)),s}_findMethodDeclarationsByName(e,t,n,i){let s=[];const r=`@${e.getFilePath()}/c/${t}/f/${n}`;return i.has(r)||(i.add(r),s=this._findMemberDeclarationsByName(e,t,n,((e,t,n)=>{(0,p.isFunctionDeclaration)(e)&&(this._isStubThatShouldBeMappedToImplementation(e.path)?n.push(...this._findFunctionOrTypeAliasDeclarations(e,t)):n.push(e))}),i),i.delete(r)),s}_findVariableDeclarationsByName(e,t,n){var i;const s=[],r=`@${e.getFilePath()}/v/${t}`;if(n.has(r))return s;n.add(r);const a=null===(i=e.getParseResults())||void 0===i?void 0:i.parseTree;if(!a)return s;const o=this._lookUpSymbolDeclarations(a,t);if(0===o.length)this._addDeclarationsFollowingWildcardImports(a,t,s,n);else for(const e of o)this._addVariableDeclarations(e,s,n);return n.delete(r),s}_findFunctionDeclarationsByName(e,t,n){var i;const s=[],r=`@${e.getFilePath()}/f/${t}`;if(n.has(r))return s;n.add(r);const a=null===(i=e.getParseResults())||void 0===i?void 0:i.parseTree;if(!a)return s;const o=this._lookUpSymbolDeclarations(a,t);if(0===o.length)this._addDeclarationsFollowingWildcardImports(a,t,s,n);else for(const e of o)this._addClassOrFunctionDeclarations(e,s,n);return n.delete(r),s}_findClassDeclarationsByName(e,t,n){var i;let s=[];const r=null===(i=e.getParseResults())||void 0===i?void 0:i.parseTree;if(r){let i=t.split(".");i.length>0&&(s=this._findClassDeclarations(e,i[0],r,n),i=i.slice(1));for(const t of i)s=s.flatMap((i=>this._findClassDeclarations(e,t,i.node,n)))}return s}_findClassDeclarations(e,t,n,i){const s=[],r=`@${e.getFilePath()}[${n.start}]${t}`;if(i.has(r))return s;i.add(r);const a=this._lookUpSymbolDeclarations(n,t);if(0===a.length&&36===n.nodeType)this._addDeclarationsFollowingWildcardImports(n,t,s,i);else for(const e of a)this._addClassOrFunctionDeclarations(e,s,i);return i.delete(r),s}_addVariableDeclarations(e,t,n){if((0,p.isVariableDeclaration)(e))this._isStubThatShouldBeMappedToImplementation(e.path)?t.push(...this._findVariableDeclarations(e,n)):t.push(e);else if((0,p.isAliasDeclaration)(e)){const i=this._evaluator.resolveAliasDeclaration(e,!0);i&&((0,p.isVariableDeclaration)(i)?this._addVariableDeclarations(i,t,n):((0,p.isClassDeclaration)(i)||(0,p.isFunctionDeclaration)(i))&&this._addClassOrFunctionDeclarations(i,t,n))}}_addClassOrFunctionDeclarations(e,t,n){var i;if((0,p.isClassDeclaration)(e))this._isStubThatShouldBeMappedToImplementation(e.path)?t.push(...this._findClassOrTypeAliasDeclarations(e,n)):t.push(e);else if((0,p.isFunctionDeclaration)(e))this._isStubThatShouldBeMappedToImplementation(e.path)?t.push(...this._findFunctionOrTypeAliasDeclarations(e,n)):t.push(e);else if((0,p.isAliasDeclaration)(e)){const i=this._evaluator.resolveAliasDeclaration(e,!0);i&&!(0,p.isAliasDeclaration)(i)&&this._addClassOrFunctionDeclarations(i,t,n)}else if((0,p.isVariableDeclaration)(e)){this._addVariableDeclarations(e,t,n);const s=null!==(i=e.typeAliasName)&&void 0!==i?i:e.node,r=this._evaluator.getType(s);if(!r)return;if((0,d.isFunction)(r)&&r.details.declaration)this._addClassOrFunctionDeclarations(r.details.declaration,t,n);else if((0,d.isOverloadedFunction)(r))for(const e of r.overloads.map((e=>e.details.declaration)).filter(l.isDefined))this._addClassOrFunctionDeclarations(e,t,n);else(0,d.isInstantiableClass)(r)&&this._addClassTypeDeclarations(e.path,r,t,n)}}_addClassTypeDeclarations(e,t,n,i){const s=this._importResolver.resolveImport(e,this._execEnv,{leadingDots:0,nameParts:t.details.moduleName.split("."),importedSymbols:[]});if(s.isImportFound&&s.resolvedPaths.length>0){const e=s.resolvedPaths[s.resolvedPaths.length-1],r=this._getSourceFiles(e),a=t.details.fullName.substring(t.details.moduleName.length+1);for(const e of r)n.push(...this._findClassDeclarationsByName(e,a,i))}}_getSourceFiles(e){const t=[];if(this._isStubThatShouldBeMappedToImplementation(e))t.push(...this._getBoundSourceFilesFromStubFile(e));else{const n=this._boundSourceGetter(e);n&&t.push(n)}return t}_addDeclarationsFollowingWildcardImports(e,t,n,i){var s,r;const o=null===(s=a.getScope(e))||void 0===s?void 0:s.symbolTable;if(o)for(const e of o.values())for(const s of e.getDeclarations()){if(!(0,p.isAliasDeclaration)(s)||!s.path||22!==s.node.nodeType||!s.node.isWildcardImport)continue;const e=`@${s.path}/l/${t}`;if(i.has(e))continue;i.add(e);const a=this._getSourceFiles(s.path);for(const e of a){const s=null===(r=e.getParseResults())||void 0===r?void 0:r.parseTree;if(!s)continue;const a=this._lookUpSymbolDeclarations(s,t);if(0===a.length)this._addDeclarationsFollowingWildcardImports(s,t,n,i);else for(const e of a){const t=this._evaluator.resolveAliasDeclaration(e,!0);t&&((0,p.isFunctionDeclaration)(t)||(0,p.isClassDeclaration)(t)?this._addClassOrFunctionDeclarations(t,n,i):(0,p.isVariableDeclaration)(t)&&this._addVariableDeclarations(t,n,i))}}}}_lookUpSymbolDeclarations(e,t){if(void 0===e)return[];const n=a.getScope(e),i=null==n?void 0:n.lookUpSymbol(t),s=null==i?void 0:i.getDeclarations();return null!=s?s:[]}_getFullClassName(e){const t=[];let n=e;for(;void 0!==n;)t.push(n.name.value),n=o.getEnclosingClass(n);return t.reverse().join(".")}_getBoundSourceFilesFromStubFile(e){return this._importResolver.getSourceFilesFromStub(e,this._execEnv,this._mapCompiled).map((t=>this._fileBinder(e,t))).filter(l.isDefined)}_isStubThatShouldBeMappedToImplementation(e){return!this._preferStubs&&(!!m(e)&&this._importResolver.getSourceFilesFromStub(e,this._execEnv,this._mapCompiled).every((t=>t!==e)))}},t.isStubFile=m},8235:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateStaticBoolLikeExpression=t.evaluateStaticBoolExpression=void 0;const i=n(2930);function s(e,t,n,c){if(55===e.nodeType){if(37===e.operator||36===e.operator){const i=r(e.expression,t,n,c);if(void 0!==i)return!i}}else if(7===e.nodeType){if(37===e.operator||36===e.operator){const i=s(e.leftExpression,t,n,c),r=s(e.rightExpression,t,n,c);if(void 0===i||void 0===r)return;return 37===e.operator?i||r:i&&r}if(l(e.leftExpression,c)&&52===e.rightExpression.nodeType){const n=function(e){let t;if(e.expressions.length>=2){if(40===e.expressions[0].nodeType&&!e.expressions[0].isImaginary&&40===e.expressions[1].nodeType&&!e.expressions[1].isImaginary){const n=e.expressions[0],i=e.expressions[1];t=256*n.value+i.value}}else 1===e.expressions.length&&(t=256*e.expressions[0].value);return t}(e.rightExpression);return a(e.operator,t.pythonVersion,n)}if(24===e.leftExpression.nodeType&&l(e.leftExpression.baseExpression,c)&&1===e.leftExpression.items.length&&!e.leftExpression.trailingComma&&!e.leftExpression.items[0].name&&0===e.leftExpression.items[0].argumentCategory&&40===e.leftExpression.items[0].valueExpression.nodeType&&!e.leftExpression.items[0].valueExpression.isImaginary&&0===e.leftExpression.items[0].valueExpression.value&&40===e.rightExpression.nodeType)return a(e.operator,Math.floor(t.pythonVersion/256),e.rightExpression.value);if(function(e,t=["sys"]){return!(35!==e.nodeType||38!==e.leftExpression.nodeType||"platform"!==e.memberName.value||!t.some((t=>t===e.leftExpression.value)))}(e.leftExpression,c)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),s=function(e){return e.pythonPlatform===i.PythonPlatform.Darwin?"darwin":e.pythonPlatform===i.PythonPlatform.Windows?"win32":e.pythonPlatform===i.PythonPlatform.Linux?"linux":void 0}(t);return o(e.operator,s,n)}if(function(e){return 35===e.nodeType&&38===e.leftExpression.nodeType&&"os"===e.leftExpression.value&&"name"===e.memberName.value}(e.leftExpression)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),s=function(e){return e.pythonPlatform===i.PythonPlatform.Darwin?"posix":e.pythonPlatform===i.PythonPlatform.Windows?"nt":e.pythonPlatform===i.PythonPlatform.Linux?"posix":void 0}(t);if(void 0!==s)return o(e.operator,s,n)}}else if(11===e.nodeType){if(33===e.constType)return!0;if(15===e.constType)return!1}else if(38===e.nodeType){if("TYPE_CHECKING"===e.value)return!0}else if(n&&35===e.nodeType&&"TYPE_CHECKING"===e.memberName.value&&38===e.leftExpression.nodeType&&n.some((t=>t===e.leftExpression.value)))return!0}function r(e,t,n,i){return(11!==e.nodeType||26!==e.constType)&&s(e,t,n,i)}function a(e,t,n){if(void 0!==t&&void 0!==n){if(20===e)return t<n;if(21===e)return t<=n;if(15===e)return t>n;if(16===e)return t>=n;if(12===e)return t===n;if(28===e)return t!==n}}function o(e,t,n){if(void 0!==t&&void 0!==n){if(12===e)return t===n;if(28===e)return t!==n}}function l(e,t=["sys"]){return!(35!==e.nodeType||38!==e.leftExpression.nodeType||"version_info"!==e.memberName.value||!t.some((t=>t===e.leftExpression.value)))}t.evaluateStaticBoolExpression=s,t.evaluateStaticBoolLikeExpression=r},817:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Symbol=t.indeterminateSymbolId=void 0;const i=n(5523);let s=1;t.indeterminateSymbolId=0;class r{constructor(e=4){this.id=s++,this._flags=e}static createWithType(e,t){const n=new r(e);return n._synthesizedType=t,n}isInitiallyUnbound(){return!!(1&this._flags)}setIsExternallyHidden(){this._flags|=2}isExternallyHidden(){return!!(2&this._flags)}setIsIgnoredForProtocolMatch(){this._flags|=64}isIgnoredForProtocolMatch(){return!!(64&this._flags)}setIsClassMember(){this._flags|=4}isClassMember(){return!!(4&this._flags)}setIsInstanceMember(){this._flags|=8}isInstanceMember(){return!!(8&this._flags)}setIsClassVar(){this._flags|=128}isClassVar(){return!!(128&this._flags)}setIsInitVar(){this._flags|=1024}isInitVar(){return!!(1024&this._flags)}setIsInDunderAll(){this._flags|=256}isInDunderAll(){return!!(256&this._flags)}setIsPrivateMember(){this._flags|=32}isPrivateMember(){return!!(32&this._flags)}setPrivatePyTypedImport(){this._flags|=512}isPrivatePyTypedImport(){return!!(512&this._flags)}addDeclaration(e){if(this._declarations){const t=this._declarations.findIndex((t=>(0,i.areDeclarationsSame)(t,e)));if(t<0)this._declarations.push(e),this._declarations.forEach((e=>{1===e.type&&e.typeAliasName&&delete e.typeAliasName}));else{const n=this._declarations[t];(0,i.hasTypeForDeclaration)(e)?(this._declarations[t]=e,1===n.type&&1===e.type&&!e.inferredTypeSource&&n.inferredTypeSource&&(e.inferredTypeSource=n.inferredTypeSource)):1===e.type&&1===n.type&&(e.isFinal&&(n.isFinal=!0),e.typeAliasAnnotation&&(n.typeAliasAnnotation=e.typeAliasAnnotation,n.typeAliasName=e.typeAliasName),!n.inferredTypeSource&&e.inferredTypeSource&&(n.inferredTypeSource=e.inferredTypeSource))}}else this._declarations=[e]}hasDeclarations(){return!!this._declarations&&this._declarations.length>0}getDeclarations(){return this._declarations?this._declarations:[]}hasTypedDeclarations(){return!!this._synthesizedType||this.getDeclarations().some((e=>(0,i.hasTypeForDeclaration)(e)))}getTypedDeclarations(){return this.getDeclarations().filter((e=>(0,i.hasTypeForDeclaration)(e)))}getSynthesizedType(){return this._synthesizedType}}t.Symbol=r},1766:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPublicConstantOrTypeAlias=t.isTypeAliasName=t.isConstantName=t.isSingleDunderName=t.isDunderName=t.isPrivateOrProtectedName=t.isProtectedName=t.isPrivateName=void 0;const n=/^[A-Z0-9_]+$/,i=/^[_]+$/,s=/^_{0,2}[A-Z][A-Za-z0-9_]+$/;function r(e){return e.length>2&&e.startsWith("__")&&!e.endsWith("__")}function a(e){return e.length>1&&e.startsWith("_")&&!e.startsWith("__")}function o(e){return r(e)||a(e)}function l(e){return!!e.match(n)&&!e.match(i)}function c(e){return!!e.match(s)}t.isPrivateName=r,t.isProtectedName=a,t.isPrivateOrProtectedName=o,t.isDunderName=function(e){return e.length>4&&e.startsWith("__")&&e.endsWith("__")},t.isSingleDunderName=function(e){return e.length>2&&e.startsWith("_")&&e.endsWith("_")},t.isConstantName=l,t.isTypeAliasName=c,t.isPublicConstantOrTypeAlias=function(e){return!o(e)&&(l(e)||c(e))}},2917:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNotRequiredTypedDictVariable=t.isRequiredTypedDictVariable=t.isFinalVariable=t.isTypedDictMemberAccessedThroughIndex=t.getLastTypedDeclaredForSymbol=void 0;const i=n(5523);t.getLastTypedDeclaredForSymbol=function(e){const t=e.getTypedDeclarations();if(t.length>0)return t[t.length-1]},t.isTypedDictMemberAccessedThroughIndex=function(e){const t=e.getTypedDeclarations();return t.length>0&&1===t[t.length-1].type},t.isFinalVariable=function(e){return e.getDeclarations().some((e=>(0,i.isFinalVariableDeclaration)(e)))},t.isRequiredTypedDictVariable=function(e){return e.getDeclarations().some((e=>1===e.type&&!!e.isRequired))},t.isNotRequiredTypedDictVariable=function(e){return e.getDeclarations().some((e=>1===e.type&&!!e.isNotRequired))}},2041:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NameTypeWalker=t.TestWalker=void 0;const i=n(427),s=n(5839),r=n(3550);class a extends i.ParseTreeWalker{constructor(){super()}visitNode(e){const t=super.visitNode(e);return this._verifyParentChildLinks(e,t),this._verifyChildRanges(e,t),t}_verifyParentChildLinks(e,t){t.forEach((t=>{t&&t.parent!==e&&(0,s.fail)(`Child node ${t.nodeType} does not contain a reference to its parent ${e.nodeType}`)}))}_verifyChildRanges(e,t){let n;t.forEach((t=>{if(t){let i=!1;3===e.nodeType&&t===e.typeAnnotationComment&&(i=!0),48===e.nodeType&&t===e.typeAnnotation&&(i=!0),i||((t.start<e.start||r.TextRange.getEnd(t)>r.TextRange.getEnd(e))&&(0,s.fail)(`Child node ${t.nodeType} is not contained within its parent ${e.nodeType}`),n&&t.start<r.TextRange.getEnd(n)&&62!==n.nodeType&&(0,s.fail)("Child node is not after previous child node"),n=t)}}))}}t.TestWalker=a;class o extends i.ParseTreeWalker{constructor(e){super(),this._evaluator=e}visitName(e){var t,n;return 23!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&21!==(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&this._evaluator.isNodeReachable(e,void 0)&&this._evaluator.getType(e),!0}}t.NameTypeWalker=o},1943:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createTracePrinter=void 0;const a=n(2489),o=n(5839),l=n(6657),c=n(5275),p=r(n(563)),d=r(n(8494)),u=n(817),m=n(1133);t.createTracePrinter=function(e){function t(e,t="'"){return e?`${t}${e}${t}`:""}e=e.map((e=>(0,l.ensureTrailingDirectorySeparator)(e))).sort(((e,t)=>e.localeCompare(t))).reverse();const n=/[\\/]/g;function i(t){if(t){for(const i of e)if(t.startsWith(i)){const e=t.substring(i.length);return(0,l.stripFileExtension)(e).replace(n,".")}return t}return""}function s(e){var n,i,r,a,l,c;if(e)switch(e.category){case 2:return`Any ${t(null===(n=e.typeAliasInfo)||void 0===n?void 0:n.fullName)}`;case 7:return m.TypeBase.isInstantiable(e)?`Class '${e.details.name}' (${e.details.moduleName})`:`Object '${e.details.name}' (${e.details.moduleName})`;case 5:return`Function '${e.details.name}' (${e.details.moduleName})`;case 8:return`Module '${e.moduleName}' (${e.moduleName})`;case 4:return`Never ${t(null===(i=e.typeAliasInfo)||void 0===i?void 0:i.fullName)}`;case 3:return`None ${t(null===(r=e.typeAliasInfo)||void 0===r?void 0:r.fullName)}`;case 6:return`OverloadedFunction [${e.overloads.map((e=>t(s(e),'"'))).join(",")}]`;case 10:return`TypeVar '${e.details.name}' ${t(null===(a=e.typeAliasInfo)||void 0===a?void 0:a.fullName)}`;case 0:return`Unbound ${t(null===(l=e.typeAliasInfo)||void 0===l?void 0:l.fullName)}`;case 9:return`Union [${e.subtypes.map((e=>t(s(e),'"'))).join(",")}]`;case 1:return`Unknown ${t(null===(c=e.typeAliasInfo)||void 0===c?void 0:c.fullName)}`;default:(0,o.assertNever)(e)}return""}function r(e){if(e)switch(e.type){case 6:return`Alias, ${h(e.node)} (${i(e.path)})`;case 4:return`Class, ${h(e.node)} (${i(e.path)})`;case 3:return`Function, ${h(e.node)} (${i(e.path)})`;case 0:return`Intrinsic, ${h(e.node)} ${e.intrinsicType} (${i(e.path)})`;case 2:return`Parameter, ${h(e.node)} (${i(e.path)})`;case 5:return`SpecialBuiltInClass, ${h(e.node)} (${i(e.path)})`;case 1:return`Variable, ${h(e.node)} (${i(e.path)})`;default:(0,o.assertNever)(e)}return""}function h(e,n=!1){var s;if(!e)return"";const r=n?`(${i(null===(s=function(e){for(;36!==e.nodeType&&e.parent;)e=e.parent;return 36===e.nodeType?p.getFileInfo(e):void 0}(e))||void 0===s?void 0:s.filePath)})`:"";if((0,c.isExpressionNode)(e))return t(function(e,t=30){return e.length<t?e:e.substring(0,t)+" <shortened> "}(d.printExpression(e)),'"')+` ${r}`;switch(e.nodeType){case 21:return`importAs '${h(e.module)}' ${t(e.alias?h(e.alias):"")} ${r}`;case 22:return`importFrom [${e.imports.map((e=>t(h(e),'"'))).join(",")}]`;case 23:return`ImportFromAs '${h(e.name)}' ${t(e.alias?h(e.alias):"")} ${r}`;case 36:return`module ${r}`;case 10:return`class '${h(e.name)}' ${r}`;case 28:return`function '${h(e.name)}' ${r}`;case 37:return`moduleName '${e.nameParts.map((e=>h(e))).join(".")}' ${r}`;case 1:return`argument '${e.name?h(e.name):"N/A"}' ${r}`;case 41:return`parameter '${e.name?h(e.name):"N/A"}' ${r}`;default:return`${d.printParseNodeType(e.nodeType)} ${r}`}}return{print:function(e){return e?function(e){const t=e;return t&&(0,a.isNumber)(t.nodeType)}(e)?h(e,!0):function(e){const t=e;return t&&(0,a.isNumber)(t.type)&&(0,a.isString)(t.path)&&(0,a.isString)(t.moduleName)}(e)?r(e):e instanceof u.Symbol?(t=e)?t.hasDeclarations()?`symbol ${r(t.getDeclarations()[0])}`:"<symbol>":"":function(e){const t=e;return t&&(0,a.isNumber)(t.category)&&(0,a.isNumber)(t.flags)}(e)?s(e):void(0,o.assertNever)(e):"";var t},printFileOrModuleName:i}}},3090:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.IncompleteTypeTracker=t.SpeculativeTypeTracker=t.isIncompleteType=void 0;const a=n(5839),o=r(n(8494)),l=n(1133);t.isIncompleteType=function(e){return!!e.isIncompleteType},t.SpeculativeTypeTracker=class{constructor(){this._speculativeContextStack=[],this._speculativeTypeCache=new Map}enterSpeculativeContext(e,t){this._speculativeContextStack.push({speculativeRootNode:e,entriesToUndo:[],allowCacheRetention:t})}leaveSpeculativeContext(){(0,a.assert)(this._speculativeContextStack.length>0),this._speculativeContextStack.pop().entriesToUndo.forEach((e=>{e.cache.delete(e.id)}))}isSpeculative(e){if(0===this._speculativeContextStack.length)return!1;if(!e)return!0;for(let t=this._speculativeContextStack.length-1;t>=0;t--)if(o.isNodeContainedWithin(e,this._speculativeContextStack[t].speculativeRootNode))return!0;return!1}trackEntry(e,t){const n=this._speculativeContextStack.length;n>0&&this._speculativeContextStack[n-1].entriesToUndo.push({cache:e,id:t})}disableSpeculativeMode(){const e=this._speculativeContextStack;return this._speculativeContextStack=[],e}enableSpeculativeMode(e){(0,a.assert)(0===this._speculativeContextStack.length),this._speculativeContextStack=e}addSpeculativeType(e,t,n){if((0,a.assert)(this._speculativeContextStack.length>0),this._speculativeContextStack.some((e=>!e.allowCacheRetention)))return;let i=this._speculativeTypeCache.get(e.id);i||(i=[],this._speculativeTypeCache.set(e.id,i)),i.push({type:t,expectedType:n})}getSpeculativeType(e,t){if(this._speculativeContextStack.some((t=>o.isNodeContainedWithin(e,t.speculativeRootNode)))){const n=this._speculativeTypeCache.get(e.id);if(n)for(const e of n)if(t){if(e.expectedType&&(0,l.isTypeSame)(t,e.expectedType))return e.type}else if(!e.expectedType)return e.type}}},t.IncompleteTypeTracker=class{constructor(){this._trackerStack=[],this._isUndoTrackingEnabled=!1}trackEntry(e,t){this._isUndoTrackingEnabled&&this._trackerStack[this._trackerStack.length-1].push({cache:e,id:t})}enterTrackingScope(){this._trackerStack.push([])}exitTrackingScope(){this._trackerStack.pop().forEach((e=>{e.cache.delete(e.id)})),0===this._trackerStack.length&&(this._isUndoTrackingEnabled=!1)}enableUndoTracking(){this._trackerStack.length>0&&(this._isUndoTrackingEnabled=!0)}isUndoTrackingEnabled(){return this._isUndoTrackingEnabled}}},3371:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getVariableDocString=t.getFunctionOrClassDeclDocString=t.getClassDocString=t.getModuleDocString=t.getVariableInStubFileDocStrings=t.getPropertyDocStringInherited=t.getOverloadedFunctionDocStringsInherited=t.getFunctionDocStringInherited=void 0;const a=n(8905),o=r(n(8494)),l=n(8816),c=n(1133),p=n(5168);function d(e,t){if(6===e.category){if(0===e.overloads.length)return!1;e=e.overloads[0]}return"builtins"===e.details.moduleName&&!!t&&!!e.boundToType&&!c.ClassType.isSameGenericClass(t,e.boundToType)}function u(e,t){const n=[];if(!(0,l.isStubFile)(e.path))return n;for(const i of t.findDeclarations(e))if((0,a.isVariableDeclaration)(i)&&i.docString)n.push(i.docString);else if((0,a.isClassDeclaration)(i)||(0,a.isFunctionDeclaration)(i)){const e=m(i);e&&n.push(e)}return n}function m(e){var t,n,i;return o.getDocString(null!==(i=null===(n=null===(t=e.node)||void 0===t?void 0:t.suite)||void 0===n?void 0:n.statements)&&void 0!==i?i:[])}function h(e,t,n){if(!(0,c.isOverloadedFunction)(e))return;const i=[];if(e.overloads.some((e=>e.details.docString)))e.overloads.forEach((e=>{e.details.docString&&i.push(e.details.docString)}));else if(t&&(0,l.isStubFile)(t.path)&&(0,a.isFunctionDeclaration)(t)){const e=g(n.findFunctionDeclarations(t));e&&i.push(e)}return i}function y(e,t){let n=g([e]);return!n&&(0,l.isStubFile)(e.path)&&(n=g(t.findFunctionDeclarations(e))),n}function g(e){for(const t of e){const e=m(t);if(e)return e}}t.getFunctionDocStringInherited=function(e,t,n,i){let s;if(!d(e,i)&&t&&(0,a.isFunctionDeclaration)(t)&&(s=function(e,t,n){if(!(0,c.isFunction)(e))return;let i=e.details.docString;return!i&&t&&(i=y(t,n)),!i&&e.details.declaration&&(i=y(e.details.declaration,n)),i}(e,t,n)),!s&&i){const t=e.details.name,r=(0,p.getClassMemberIterator)(i,t,29);for(const e of r)if(e.symbol.getDeclarations().length>0){const t=e.symbol.getDeclarations().slice(-1)[0];if((0,a.isFunctionDeclaration)(t)&&(s=y(t,n),s))break}}return s},t.getOverloadedFunctionDocStringsInherited=function(e,t,n,i,s){let r;if(!d(e,s)&&(r=h(e,t,n),r&&r.length>0))return r;if(s&&e.overloads.length>0){const t=e.overloads[0].details.name,a=(0,p.getClassMemberIterator)(s,t,29);for(const e of a){const t=e.symbol.getDeclarations().slice(-1)[0],s=i.getTypeForDeclaration(t);if(s&&(r=h(s,t,n),r&&r.length>0))break}}return null!=r?r:[]},t.getPropertyDocStringInherited=function(e,t,n){const i=o.getEnclosingClass(e.node.name,!1),s=i?n.getTypeOfClass(i):void 0;if(s)return function(e,t,n,i){if(!e||!(0,a.isFunctionDeclaration)(e))return;const s=n.getTypeForDeclaration(e);if(!s||!(0,p.isProperty)(s))return;const r=28===e.node.nodeType?e.node.name.value:void 0;if(!r)return;const o=(0,p.getClassIterator)(i,0);for(const[e]of o){if(!(0,c.isInstantiableClass)(e))continue;const i=e.details.fields.get(r),s=null==i?void 0:i.getDeclarations();if(s)for(const e of s)if((0,a.isFunctionDeclaration)(e)){const i=n.getTypeForDeclaration(e);if(i&&(0,p.isProperty)(i)){const n=y(e,t);if(n)return n}}}}(e,t,n,s.classType)},t.getVariableInStubFileDocStrings=u,t.getModuleDocString=function(e,t,n){let i=e.docString;return!i&&t&&(0,l.isStubFile)(t.path)&&(i=function(e){for(const t of e)if(t.statements){const e=o.getDocString(t.statements);if(e)return e}}(n.findModules(t.path))),i},t.getClassDocString=function(e,t,n){let i=e.details.docString;if(!i&&t&&(0,a.isClassDeclaration)(t)&&(i=g([t]),!i&&t&&(0,l.isStubFile)(t.path)&&4===t.type)&&(i=g(n.findClassDeclarations(t))),!i&&t){const s=n.findClassDeclarationsByType(t.path,e);s&&(i=g(s.filter((e=>(0,a.isClassDeclaration)(e))).map((e=>e))))}return i},t.getFunctionOrClassDeclDocString=m,t.getVariableDocString=function(e,t){if(e)return void 0!==e.docString?e.docString:u(e,t).find((e=>e))}},7887:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createTypeEvaluator=void 0;const a=n(3213),o=n(5839),l=n(1290),c=n(9744),p=n(1464),d=n(6886),u=n(3550),m=n(2122),h=n(5275),y=n(5303),g=r(n(6673)),f=r(n(563)),T=n(4184),_=n(4972),v=n(6168),b=n(5523),I=n(118),C=r(n(8494)),S=n(6061),F=r(n(5083)),D=n(8235),P=n(817),x=n(1766),A=n(2917),k=n(3090),E=n(9453),w=r(n(3843)),N=n(1133),R=n(5168),M=n(1659),O={0:["__add__","__radd__",!1],33:["__sub__","__rsub__",!1],26:["__mul__","__rmul__",!1],13:["__floordiv__","__rfloordiv__",!1],10:["__truediv__","__rtruediv__",!1],24:["__mod__","__rmod__",!1],29:["__pow__","__rpow__",!1],22:["__matmul__","__rmatmul__",!1],3:["__and__","__rand__",!1],6:["__or__","__ror__",!1],8:["__xor__","__rxor__",!1],17:["__lshift__","__rlshift__",!1],31:["__rshift__","__rrshift__",!1],12:["__eq__","__ne__",!0],28:["__ne__","__eq__",!0],20:["__lt__","__ge__",!0],21:["__le__","__gt__",!0],15:["__gt__","__le__",!0],16:["__ge__","__lt__",!0]},L={36:!1,37:!1,39:!0,40:!0,41:!0,42:!0},V=new Map([["asyncio.futures.Future",d.PythonVersion.V3_9],["asyncio.tasks.Task",d.PythonVersion.V3_9],["builtins.dict",d.PythonVersion.V3_9],["builtins.frozenset",d.PythonVersion.V3_9],["builtins.list",d.PythonVersion.V3_9],["builtins._PathLike",d.PythonVersion.V3_9],["builtins.set",d.PythonVersion.V3_9],["builtins.tuple",d.PythonVersion.V3_9],["collections.ChainMap",d.PythonVersion.V3_9],["collections.Counter",d.PythonVersion.V3_9],["collections.defaultdict",d.PythonVersion.V3_9],["collections.DefaultDict",d.PythonVersion.V3_9],["collections.deque",d.PythonVersion.V3_9],["collections.OrderedDict",d.PythonVersion.V3_9],["queue.Queue",d.PythonVersion.V3_9]]),U=new Map([["builtins.float",["builtins.int"]],["builtins.complex",["builtins.float","builtins.int"]],["builtins.bytes",["builtins.bytearray","builtins.memoryview"]]]);t.createTypeEvaluator=function(e,t){const n=[],i=new Map,s=new Map,r=new Map,z=new Map,B=new k.SpeculativeTypeTracker,W=new Map,j=[],$=new k.IncompleteTypeTracker;let G,q,K,H,Y,Z,Q,J,X,ee,te,ne,ie=!1;const se=[];let re;function ae(){G&&(0,a.throwIfCancellationRequested)(G)}function oe(e){let t;if(t=re&&pe(e)?re.get(e.id):r.get(e.id),void 0!==t)return(0,o.assert)(!(0,k.isIncompleteType)(t)),t}function le(e,t,n,i,s=!1){if(n)return void(ne&&ne.set(e.id,t));const a=re&&pe(e)?re:r;a.set(e.id,t),B.isSpeculative(e)&&(B.trackEntry(a,e.id),s&&B.addSpeculativeType(e,t,i)),$.trackEntry(a,e.id)}function ce(e){(re&&pe(e)?re:r).delete(e.id)}function pe(e){const t=se.length;if(0===t)return!1;const n=se[t-1];let i=e;for(;i;){if(i===n.functionNode)return!0;i=i.parent}return!1}function de(e,t){return n.findIndex((n=>n.symbolId===e.id&&n.declaration===t))}function ue(e,t){const i=de(e,t);if(i>=0){for(let e=i+1;e<n.length;e++)n[e].isResultValid=!1;return!1}return n.push({symbolId:e.id,declaration:t,isResultValid:!0}),!0}function me(e){const t=n.pop();return(0,o.assert)(t.symbolId===e.id),t.isResultValid}function he(e,t,i){const s=de(e,t);s>=0&&(n[s].partialType=i)}function ye(e,t){const i=de(e,t);if(i>=0)return n[i].partialType}function ge(e){var t;return null===(t=Sn(e,(()=>{bn(e)})))||void 0===t?void 0:t.type}function fe(e){ie||(ie=!0,H=Nn(e,"object"),Y=wn(e,"type"),Z=Nn(e,"function"),Me(e,"Collection"),q=function(e,t){return Oe("NoneType",f.getFileInfo(e).typeshedModulePath)}(e)||N.AnyType.create(),Q=wn(e,"tuple"),J=wn(e,"bool"),X=wn(e,"str"),ee=wn(e,"dict"),te=Me(e,"_TypedDict"))}function Te(e,n,i=0){var s;const r=oe(e);if(r)return{type:r,node:e};{const t=B.getSpeculativeType(e,n);if(t)return{type:t,node:e}}ae();const a=(0,R.transformPossibleRecursiveTypeAlias)(n);let p;fe(e);let u=0!=(64&i);switch(e.nodeType){case 38:p=function(e,n){var i;const s=f.getFileInfo(e),r=e.value;let a,o=!1;const l=0!=(4&n)||s.isStubFile;if(!t.analyzeUnannotatedFunctions){const t=C.getEnclosingFunction(e);if(t&&C.isUnannotatedFunction(t))return{node:e,type:N.AnyType.create(),isIncomplete:!1}}const p=Rn(e,r,!l,l&&0!=(1024&n));if(p){let t=!l;4===p.scope.type&&(t=!1);const d=p.symbol,u=jn(d,t?e:void 0),h=(0,R.transformPossibleRecursiveTypeAlias)(u.type);u.isIncomplete&&(o=!0),u.isRecursiveDefinition&&Le(e)&&$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.recursiveDefinition().format({name:r}),e);const y=!!h&&(0,N.isInstantiableClass)(h)&&N.ClassType.isSpecialBuiltIn(h);if(a=h,t&&!y){const t=p.isBeyondExecutionScope||!d.isInitiallyUnbound()?h:N.UnboundType.create(),n=Dn(e,d.id,t,!1);if(n.type&&(a=n.type),n.isIncomplete&&(o=!0),n.usedOuterScopeAlias){const t=null===(i=p.scope.parent)||void 0===i?void 0:i.lookUpSymbolRecursive(r);t&&Je(s,t.symbol,e)}if(!n.type&&p.isBeyondExecutionScope){const t=function(e,t,n){if(!t.symbol.getDeclarations().every((e=>1===e.type||2===e.type)))return;const i=F.getScopeHierarchy(e,t.scope);if(i&&i.length>=2&&i.every((e=>1===e.type||3===e.type))){const s=F.findTopNodeInScope(e,i[i.length-2]);if(s&&(28===s.nodeType||30===s.nodeType)){const i=f.getFlowNode(s);if(i&&t.symbol.getDeclarations().every((e=>{if(2===e.type)return!0;const t=f.getFlowNode(e.node);return!(!t||t!==i&&fi.isFlowNodeReachable(t,i))})))return Dn(e,t.symbol.id,n,!1,s)}}}(e,p,h);(null==t?void 0:t.type)&&(a=t.type),(null==t?void 0:t.isIncomplete)&&(o=!0)}}a=nt(e,a,n),Je(s,d,e),0!=(1024&n)&&u.includesVariableDecl&&!a.typeAliasInfo&&((0,R.isTypeAliasPlaceholder)(a)||(0,N.isTypeVar)(a)||(0,N.isUnknown)(a)||s.isTypingStubFile||N.TypeBase.isInstantiable(a)||$e(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeAnnotationVariable(),e))}else"reveal_type"!==r&&"reveal_locals"!==r&&$e(s.diagnosticRuleSet.reportUndefinedVariable,c.DiagnosticRule.reportUndefinedVariable,m.Localizer.Diagnostic.symbolIsUndefined().format({name:r}),e),a=N.UnknownType.create();if((0,N.isParamSpec)(a)&&32&n&&(Be(m.Localizer.Diagnostic.paramSpecContext(),e),a=N.UnknownType.create()),(0,N.isTypeVar)(a)&&0==(64&n)&&a.details.name===r){const t=a.details.isVariadic?Me(e,"TypeVarTuple"):Me(e,"TypeVar");a=t&&(0,N.isInstantiableClass)(t)?N.ClassType.cloneAsInstance(t):N.UnknownType.create()}return 0!=(64&n)&&0==(512&n)&&(0,N.isInstantiableClass)(a)&&N.ClassType.isBuiltIn(a,"Generic")&&$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.genericNotAllowed(),e),(0,N.isTypeVar)(a)&&!a.details.isSynthesized&&(a=tt(e,a,n)),{type:a,node:e,isIncomplete:o}}(e,i);break;case 35:p=function(e,t){const n=2|48196&t,i=Te(e.leftExpression,void 0,n);if((0,R.isTypeAliasPlaceholder)(i.type))return{node:e,type:N.UnknownType.create(),isIncomplete:!0};const s=rt(e,i,{method:"get"},t);if((0,_.isCodeFlowSupportedForReference)(e)){le(e,s.type,!0),le(e.memberName,s.type,!0);let n=s.type,r=!!s.isIncomplete;if((0,N.isUnbound)(n)){const t=He(i.type);let s;(0,N.isInstantiableClass)(t)?s=(0,R.lookUpClassMember)(t,e.memberName.value,1):(0,N.isClassInstance)(t)&&(s=(0,R.lookUpObjectMember)(t,e.memberName.value,1)),s&&(n=Yn(s),r=!1)}const a=Dn(e,P.indeterminateSymbolId,n,r);a.type&&(s.type=a.type),a.isIncomplete&&(s.isIncomplete=!0),s.type=nt(e,s.type,t),ce(e),ce(e.memberName)}return i.isIncomplete&&(s.isIncomplete=!0),s}(e,i),(0,R.isTypeAliasPlaceholder)(p.type)||le(e.memberName,p.type,!!p.isIncomplete);break;case 24:p=function(e,t=0){const n=Te(e.baseExpression,void 0,2|t);if(64&t&&48===e.baseExpression.nodeType){const t=f.getFileInfo(e);!t.isStubFile&&t.executionEnvironment.pythonVersion<d.PythonVersion.V3_10&&Be(m.Localizer.Diagnostic.stringNotSubscriptable(),e.baseExpression)}if(0==(4&t)){let i=0!=(32768&t);if(i){const t=C.getExecutionScopeNode(e);36===(null==t?void 0:t.nodeType)&&(i=!1)}if(!i){const t=f.getFileInfo(e);if((0,N.isInstantiableClass)(n.type)&&N.ClassType.isBuiltIn(n.type)&&!n.type.aliasName){const i=V.get(n.type.details.fullName);void 0!==i&&t.executionEnvironment.pythonVersion<i&&!t.isStubFile&&Be(m.Localizer.Diagnostic.classNotRuntimeSubscriptable().format({name:n.type.aliasName||n.type.details.name}),e.baseExpression)}}}const i=pt(e,n.type,{method:"get"},t);if((0,_.isCodeFlowSupportedForReference)(e)){let t=!0;if(Ye(n.type,void 0,(e=>{(0,N.isClassInstance)(e)&&(N.ClassType.isBuiltIn(e)||N.ClassType.isTypedDictClass(e))||(t=!1)})),t){le(e,i.type,!1);const t=Dn(e,P.indeterminateSymbolId,i.type,!!n.isIncomplete||!!i.isIncomplete);t.type&&(i.type=t.type),t.isIncomplete&&(i.isIncomplete=!0),ce(e)}}return n.isIncomplete&&(i.isIncomplete=!0),i}(e,i);break;case 9:0!=(1024&i)?(ft(e,a),$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeAnnotationCall(),e),p={node:e,type:N.UnknownType.create()}):p=ft(e,a);break;case 52:p=function(e,t,n){if(0!=(64&n)&&0===e.expressions.length&&!t)return{type:dt([]),node:e,isEmptyTupleShorthand:!0};let i=t;if(t&&(0,N.isUnion)(t)){let n;(0,R.doForEachSubtype)(t,(t=>{n||On(e,(()=>yt(e,t)))&&(n=t)})),i=n}if(i){const t=yt(e,i);if(t)return t}return function(e,t){const n=e.expressions.map((e=>Te(e,t?N.AnyType.create():void 0))),i=n.some((e=>e.isIncomplete));return Q&&(0,N.isInstantiableClass)(Q)?{type:(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,gt(n))),node:e,isIncomplete:i}:{type:N.UnknownType.create(),node:e}}(e,!!t)}(e,a,i);break;case 11:p=function(e,t){let n;if(26===e.constType?n=0!=(64&t)?N.NoneType.createType():N.NoneType.createInstance():33!==e.constType&&15!==e.constType&&9!==e.constType||(n=Nn(e,"bool"),n&&(0,N.isClassInstance)(n)&&(33===e.constType?n=N.ClassType.cloneWithLiteral(n,!0):15===e.constType&&(n=N.ClassType.cloneWithLiteral(n,!1)))),n)return{type:n,node:e}}(e,i);break;case 48:{const t=0!=(8&i)&&!function(e){if(e.parent&&24===e.parent.nodeType){const t=Te(e.parent.baseExpression).type;if(t&&(0,N.isInstantiableClass)(t)&&N.ClassType.isSpecialBuiltIn(t,"Literal"))return!0}return!1}(e);if(t){if(e.typeAnnotation)p=Te(e.typeAnnotation,void 0,68|i);else if(!e.typeAnnotation&&1===e.strings.length){const t=function(e){const t=f.getFileInfo(e),n=new y.Parser,i=e.strings[0].value,s=e.strings[0].start+e.strings[0].token.prefixLength+e.strings[0].token.quoteMarkLength,r=new y.ParseOptions;r.isStubFile=t.isStubFile,r.pythonVersion=t.executionEnvironment.pythonVersion;const a=n.parseTextExpression(t.fileContents,s,i.length,r);if(a.parseTree)return a.diagnostics.forEach((t=>{Be(t.message,e)})),a.parseTree.parent=e,a.parseTree}(e);t&&(p=Te(t,void 0,68|i))}p||($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.expectedTypeNotString(),e),p={node:e,type:N.UnknownType.create()}),u=!1}else{e.strings.forEach((e=>{27===e.nodeType&&e.expressions.forEach((e=>{Te(e)}))}));const t=0!=(32&e.strings[0].token.flags);p=e.strings.some((e=>27===e.nodeType))?{node:e,type:Nn(e,t?"bytes":"str")}:{node:e,type:qt(e,t?"bytes":"str",e.strings.map((e=>e.value)).join(""))}}break}case 40:p=e.isImaginary?{node:e,type:Nn(e,"complex")}:e.isInteger?{node:e,type:qt(e,"int",e.value)}:{node:e,type:Nn(e,"float")};break;case 18:p=0!=(1&i)?{type:N.AnyType.create(!0),node:e}:0!=(256&i)?{type:N.UnknownType.create(),node:e}:{type:Nn(e,"ellipsis")||N.AnyType.create(),node:e};break;case 55:p=function(e,t){const n=Te(e.expression);let i=He(n.type);const s=n.isIncomplete;if((0,N.isNever)(i))return{node:e,type:N.NeverType.create(),isIncomplete:s};const r={0:"__pos__",33:"__neg__",5:"__invert__"};let a;if(38!==e.operator&&(0,R.isOptionalType)(i)&&($e(f.getFileInfo(e).diagnosticRuleSet.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,m.Localizer.Diagnostic.noneOperator().format({operator:C.printOperator(e.operator)}),e.expression),i=(0,N.removeNoneFromUnion)(i)),38===e.operator?(a=Nn(e,"bool"),a||(a=N.UnknownType.create())):(a=(0,N.isAnyOrUnknown)(i)?i:Ot(i,[],r[e.operator],e,t),a||($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotSupportUnaryOperator().format({operator:C.printOperator(e.operator),type:yi(i)}),e),a=N.UnknownType.create())),(0===e.operator||33===e.operator)&&(0,N.isClassInstance)(a)&&N.ClassType.isBuiltIn(a,"int")&&(0,N.isClassInstance)(i)&&N.ClassType.isBuiltIn(i,"int")&&"number"==typeof i.literalValue){const t=0===e.operator?i.literalValue:-i.literalValue;a=N.ClassType.cloneWithLiteral(a,t)}return{type:a,node:e,isIncomplete:s}}(e,a);break;case 7:p=wt(e,a,i);break;case 5:p=Rt(e,a),Ze(e.destExpression,p.type,!!p.isIncomplete,e.rightExpression);break;case 31:case 45:p=function(e,t){let n=t;if(t&&(0,N.isUnion)(t)){let i;(0,R.doForEachSubtype)(t,(t=>{i||On(e,(()=>Bt(e,t)))&&(i=t)})),n=i}if(n){const t=Bt(e,n);if(t)return t}return function(e,t){const n=31===e.nodeType?"list":"set";let i,s=!1,r=!1;t&&((0,N.isAny)(t)?i=t:(0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"object")&&(i=N.AnyType.create()));let a=[];e.entries.forEach(((e,t)=>{let n;n=32===e.nodeType?$t(e,i):Te(e,i),n.isIncomplete&&(r=!0),t<64&&a.push(n.type)})),a=a.map((e=>(0,R.stripLiteralValue)(e)));let o=t?N.AnyType.create():N.UnknownType.create();if(a.length>0){const i=f.getFileInfo(e);o="list"===n&&i.diagnosticRuleSet.strictListInference||"set"===n&&i.diagnosticRuleSet.strictSetInference||t?(0,N.combineTypes)(a,64):(0,R.areTypesSame)(a,!0)?a[0]:o}else s=!0;const l=wn(e,n);return{type:(0,N.isInstantiableClass)(l)?N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(l,[o],!0,void 0,void 0,s)):N.UnknownType.create(),node:e,isIncomplete:r}}(e,t)}(e,a);break;case 46:p=function(e){return e.startValue&&Te(e.startValue),e.endValue&&Te(e.endValue),e.stepValue&&Te(e.stepValue),{type:Nn(e,"slice"),node:e}}(e);break;case 6:{const t=Te(e.expression,void 0,i);p={type:we(t.type,e.expression),node:e},t.isIncomplete&&(p.isIncomplete=!0);break}case 51:p=function(e,t,n){Te(e.testExpression);const i=[];let s=!1;if(Le(e.ifExpression)){const r=Te(e.ifExpression,n,t);i.push(r.type),r.isIncomplete&&(s=!0)}if(Le(e.elseExpression)){const r=Te(e.elseExpression,n,t);i.push(r.type),r.isIncomplete&&(s=!0)}return{type:(0,R.removeNoReturnFromUnion)((0,N.combineTypes)(i)),node:e,isIncomplete:s}}(e,i,a);break;case 32:p=function(e,t){let n=!1;const i=$t(e);i.isIncomplete&&(n=!0);const s=i.type;let r=e.comprehensions.some((e=>33===e.nodeType&&e.isAsync||34===e.nodeType&&6===e.testExpression.nodeType)),a=N.UnknownType.create();6===e.expression.nodeType&&(r=!0),!r&&t&&(0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"AsyncGenerator")&&(r=!0);const o=Me(e,r?"AsyncGenerator":"Generator");return o&&(0,N.isInstantiableClass)(o)&&(a=N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(o,r?[s,N.NoneType.createInstance()]:[s,N.NoneType.createInstance(),N.NoneType.createInstance()],!0))),{type:a,node:e,isIncomplete:n}}(e,a);break;case 15:p=function(e,t){let n,i=t;if(t&&(0,N.isUnion)(t)){let n;(0,R.doForEachSubtype)(t,(t=>{n||On(e,(()=>Vt(e,t)))&&(n=t)})),i=n}if(i){n=new l.DiagnosticAddendum;const t=Vt(e,i,n);if(t)return t}return{...Ut(e,t),expectedTypeDiagAddendum:n}}(e,a);break;case 30:p=function(e,t){const n=N.FunctionType.createInstance("","","",0);le(e,n,!1);let i=[];if(t){(0,R.mapSubtypes)(t,(e=>{if((0,N.isFunction)(e)&&i.push(e),(0,N.isClassInstance)(e)){const t=(0,R.lookUpObjectMember)(e,"__call__");if(t){const n=Yn(t);if(n&&(0,N.isFunction)(n)){const t=ui(e,n);t&&i.push(t)}}}}));const n=e.parameters.filter((e=>0===e.category&&void 0===e.defaultValue)).length;i=i.filter((e=>{const t=e.details.parameters.filter((e=>!!e.name)).length;return e.details.parameters.some((e=>!!e.name&&0!==e.category))||t===n}))}const s=i.length>0?i[0]:void 0;e.parameters.forEach(((t,i)=>{let r=N.UnknownType.create();s&&i<s.details.parameters.length&&(r=N.FunctionType.getEffectiveParameterType(s,i)),t.name&&le(t.name,an(e,t.category,r),!1),t.defaultValue&&Te(t.defaultValue,void 0,1);const a={category:t.category,name:t.name?t.name.value:void 0,hasDefault:!!t.defaultValue,defaultValueExpression:t.defaultValue,hasDeclaredType:!0,type:r};N.FunctionType.addParameter(n,a)}));const r=s?qn(s):void 0;return B.isSpeculative(e)?On(e.expression,(()=>{n.inferredReturnType=Te(e.expression,r).type}),!1):n.inferredReturnType=Te(e.expression,r).type,{type:n,node:e}}(e,a);break;case 3:p=Te(e.rightExpression),Ze(e.leftExpression,p.type,!1,e.rightExpression,!0);break;case 4:p=Te(e.rightExpression),Ze(e.name,p.type,!1,e.rightExpression,!0);break;case 60:p=function(e){let t,n=!1;const i=C.getEnclosingFunction(e);if(i){const e=nn(i);e&&(t=(0,R.getDeclaredGeneratorSendType)(e.functionType))}return e.expression&&Te(e.expression).isIncomplete&&(n=!0),{type:t||N.UnknownType.create(),node:e,isIncomplete:n}}(e);break;case 61:p=function(e){const t=Te(e.expression).type;let n,i=(0,R.getGeneratorTypeArgs)(t);if(i)n=i.length>=2?i[2]:N.UnknownType.create();else{const s=Re(t,!1,e)||N.UnknownType.create();i=(0,R.getGeneratorTypeArgs)(s),n=i&&i.length>=2?i[2]:N.UnknownType.create()}return{type:n||N.UnknownType.create(),node:e}}(e);break;case 56:{let t;if(a){const n=wn(e,"Iterable");n&&(0,N.isInstantiableClass)(n)&&(t=N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(n,[a],!0)))}const n=Te(e.expression,t,i).type;p=0==(128&i)&&(0,N.isVariadicTypeVar)(n)&&!n.isVariadicUnpacked?{type:N.TypeVarType.cloneForUnpacked(n),node:e}:{type:Ne(n,!1,e)||N.UnknownType.create(),unpackedType:n,node:e};break}case 54:p=Te(e.typeAnnotation,void 0,34024);break;case 0:Mn(e,(()=>{e.child&&Te(e.child)})),p={type:N.UnknownType.create(),node:e}}return p||(0,o.fail)(`Unhandled expression type '${C.printExpression(e)}'`),!u||p.isIncomplete||(128&i&&(0,N.isTypeVar)(p.type)&&p.type.details.isVariadic&&!p.type.isVariadicInUnion&&(Be(m.Localizer.Diagnostic.typeVarTupleContext(),e),p.type=N.UnknownType.create()),N.TypeBase.isInstantiable(p.type))||(0,N.isClassInstance)(p.type)&&N.ClassType.isTupleClass(p.type)&&0===(null===(s=p.type.tupleTypeArguments)||void 0===s?void 0:s.length)||(Ge(p.type,e),p.type=N.UnknownType.create()),65536&i&&(0,R.isTypeAliasPlaceholder)(p.type)&&(p.type.details.illegalRecursionDetected=!0),(0,R.isTypeAliasPlaceholder)(p.type)||(le(e,p.type,!!p.isIncomplete,n,!0),n&&!(0,N.isAnyOrUnknown)(n)&&z.set(e.id,n)),p}function _e(e){return void 0!==e.futureImports.get("annotations")||e.executionEnvironment.pythonVersion>=d.PythonVersion.V3_11||e.isStubFile}function ve(e,t){var n,i,s;const r=f.getFileInfo(e);if(r.isTypingStubFile||r.isTypingExtensionsStubFile){const t=function(e){if(!e.parent||54!==e.parent.nodeType)return;if(38!==e.parent.valueExpression.nodeType)return;const t=e.parent.valueExpression.value,n=new Map([["Tuple",{alias:"tuple",module:"builtins"}],["Generic",{alias:"",module:"builtins"}],["Protocol",{alias:"",module:"builtins"}],["Callable",{alias:"",module:"builtins"}],["Type",{alias:"type",module:"builtins"}],["ClassVar",{alias:"",module:"builtins"}],["Final",{alias:"",module:"builtins"}],["Literal",{alias:"",module:"builtins"}],["TypedDict",{alias:"_TypedDict",module:"self"}],["Union",{alias:"",module:"builtins"}],["Optional",{alias:"",module:"builtins"}],["Annotated",{alias:"",module:"builtins"}],["TypeAlias",{alias:"",module:"builtins"}],["Concatenate",{alias:"",module:"builtins"}],["TypeGuard",{alias:"",module:"builtins"}],["Unpack",{alias:"",module:"builtins"}],["Required",{alias:"",module:"builtins"}],["NotRequired",{alias:"",module:"builtins"}],["Self",{alias:"",module:"builtins"}],["NoReturn",{alias:"",module:"builtins"}]]).get(t);if(n){const i=oe(e);if(i)return(0,o.assert)((0,N.isInstantiableClass)(i)),i;const s=Qt(e,t,n);return le(e,s,!1),s}}(e);if(t)return t}let a=1129;(null==t?void 0:t.isVariableAnnotation)&&(a|=32768),(null==t?void 0:t.allowFinal)||(a|=16),(null==t?void 0:t.allowClassVar)||(a|=131072),(null==t?void 0:t.allowTypeVarTuple)||(a|=128),(null==t?void 0:t.associateTypeVarsWithScope)?a|=8192:a|=4096,(null==t?void 0:t.disallowRecursiveTypeAlias)&&(a|=65536),_e(r)&&(a|=4),3===(null===(n=null==e?void 0:e.parent)||void 0===n?void 0:n.nodeType)&&e.parent.typeAnnotationComment===e?a|=4:62===(null===(i=null==e?void 0:e.parent)||void 0===i?void 0:i.nodeType)?(e.parent.returnTypeAnnotation===e||e.parent.paramTypeAnnotations.some((t=>t===e)))&&(a|=4):41===(null===(s=null==e?void 0:e.parent)||void 0===s?void 0:s.nodeType)&&e.parent.typeAnnotationComment===e&&(a|=4);const l=Te(e,void 0,a).type;return(0,R.convertToInstance)(l)}function be(e,t){const n=Te(e.expression,void 0,9===e.expression.nodeType?0:2);if((0,N.isInstantiableClass)(n.type)&&N.ClassType.isBuiltIn(n.type,"classmethod")&&(0,R.isProperty)(t))return t;const i=[{argumentCategory:0,type:t}],s=St(e.expression,i,n.type,void 0,!0).returnType||N.UnknownType.create();return!(0,N.isFunction)(s)||s.details.declaredReturnType||s.details.parameters.some(((e,t)=>!(e.name&&!e.hasDeclaredType&&(0!==e.category||0===t&&e.isTypeInferred))))?(0,R.isPartlyUnknown)(s)&&(0,N.isFunction)(n.type)&&!n.type.details.parameters.find((e=>void 0!==e.typeAnnotation))&&void 0===n.type.details.declaredReturnType?t:s:t}function Ie(e,t=0){if(t>N.maxTypeRecursionCount)return!0;switch(e.category){case 0:case 1:case 2:case 4:case 3:return!0;case 9:return void 0!==(0,N.findSubtype)(e,(e=>Ie(e,t+1)));case 5:case 6:case 8:case 10:return!1;case 7:{if(N.TypeBase.isInstantiable(e))return!1;if((0,R.isTupleClass)(e)&&e.tupleTypeArguments)return(0,R.isOpenEndedTupleClass)(e)||0===e.tupleTypeArguments.length;if(N.ClassType.isBuiltIn(e,"bool")&&void 0!==e.literalValue)return!1===e.literalValue;if((0,R.lookUpObjectMember)(e,"__len__"))return!0;const t=(0,R.lookUpObjectMember)(e,"__bool__");if(t){const e=Yn(t);if((0,N.isFunction)(e)&&e.details.declaredReturnType){const t=e.details.declaredReturnType;if((0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"bool")&&!0===t.literalValue)return!1}return!0}return!1}}}function Ce(e,t=0){if(t>N.maxTypeRecursionCount)return!0;switch(e.category){case 1:case 5:case 6:case 8:case 10:case 4:case 2:return!0;case 9:return void 0!==(0,N.findSubtype)(e,(e=>Ce(e,t+1)));case 0:case 3:return!1;case 7:{if(N.TypeBase.isInstantiable(e))return!0;if((0,R.isTupleClass)(e)&&e.tupleTypeArguments&&0===e.tupleTypeArguments.length)return!1;if(!1===e.literalValue||0===e.literalValue||""===e.literalValue)return!1;const t=(0,R.lookUpObjectMember)(e,"__bool__");if(t){const e=Yn(t);if((0,N.isFunction)(e)&&e.details.declaredReturnType){const t=e.details.declaredReturnType;if((0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"bool")&&!1===t.literalValue)return!1}}return!0}}}function Se(e){return(0,R.mapSubtypes)(e,(e=>{if((0,N.isClassInstance)(e)){if(void 0!==e.literalValue)return e.literalValue?void 0:e;if(N.ClassType.isBuiltIn(e,"bool"))return N.ClassType.cloneWithLiteral(e,!1)}if(Ie(e))return e}))}function Fe(e){return(0,R.mapSubtypes)(e,(e=>{if((0,N.isClassInstance)(e)){if(void 0!==e.literalValue)return e.literalValue?e:void 0;if(N.ClassType.isBuiltIn(e,"bool"))return N.ClassType.cloneWithLiteral(e,!0)}if(Ce(e))return e}))}function De(e,t,n,i={method:"get"},s,r=0,a){const o=at(e,N.ClassType.cloneAsInstantiable(t),n,i,s,8|r,a);if(o)return{node:e,type:o.type,isIncomplete:!!o.isTypeIncomplete}}function Pe(e,t,n,i={method:"get"},s,r=0,a){let o;if(N.ClassType.isPartiallyConstructed(t))return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.classDefinitionCycle().format({name:t.details.name}),e),{node:e,type:N.UnknownType.create()};if(0==(32&r)&&(o=at(e,t,n,i,s,1|r,a)),!o){const s=t.details.effectiveMetaclass;s&&(0,N.isInstantiableClass)(s)&&!N.ClassType.isSameGenericClass(s,t)&&(o=at(e,s,n,i,void 0,r,t))}return o?{node:e,type:o.type,isIncomplete:!!o.isTypeIncomplete}:void 0}function xe(e,t,n=!1){const i=(0,R.lookUpClassMember)(e,t,8);if(i){const t=Yn(i);if((0,N.isFunction)(t)||(0,N.isOverloadedFunction)(t)){const i=ui(N.ClassType.cloneAsInstance(e),t,void 0,void 0,void 0,n);if(i)return i}}}function Ae(e,t){if(t>=e.parameters.length)return;const n=e.parameters[t];if(n.typeAnnotation)return n.typeAnnotation;if(n.typeAnnotationComment)return n.typeAnnotationComment;if(!e.functionAnnotationComment||e.functionAnnotationComment.isParamListEllipsis)return;let i=0;const s=e.functionAnnotationComment.paramTypeAnnotations;s.length<e.parameters.length&&(i=1);const r=t-i;return r<0||r>=s.length?void 0:s[r]}function ke(e){if(54===e.nodeType&&38===e.valueExpression.nodeType){const t=Rn(e,e.valueExpression.value,!1);if(t)return void 0!==t.symbol.getDeclarations().find((e=>(0,b.isExplicitTypeAliasDeclaration)(e)))}return!1}function Ee(e,t){let n,i,s;switch(e.nodeType){case 38:{const t=Rn(e,e.value,!0);if(t&&(n=t.symbol,void 0===$n(n)&&2===t.scope.type)){const t=C.getEnclosingClassOrFunction(e);if(t&&10===t.nodeType){const i=en(t);if(i){const t=(0,R.lookUpClassMember)(i.classType,e.value,24);t&&(n=t.symbol)}}}break}case 54:return Ee(e.valueExpression);case 35:{const t=He(Te(e.leftExpression).type);let r;(0,N.isClassInstance)(t)?(r=(0,R.lookUpObjectMember)(t,e.memberName.value,16),i=t,s=null==r?void 0:r.classType):(0,N.isInstantiableClass)(t)&&(r=(0,R.lookUpClassMember)(t,e.memberName.value,24),i=t,s=null==r?void 0:r.classType),r&&(n=r.symbol);break}case 24:{const n=Ee(e.baseExpression);if(n&&(0,N.isClassInstance)(n)){const i=(0,R.lookUpClassMember)(n,"__setitem__");if(i){const t=Yn(i);if((0,N.isFunction)(t)){const s=ui(n,t,(0,N.isInstantiableClass)(i.classType)?i.classType:void 0,e,void 0,!1);if(s&&(0,N.isFunction)(s)&&2===s.details.parameters.length){const e=N.FunctionType.getEffectiveParameterType(s,1);if(!(0,N.isAnyOrUnknown)(e))return e}}}else if(N.ClassType.isTypedDictClass(n)){const i=(0,E.getTypeFromIndexedTypedDict)(gi,e,n,t||{method:"get"});if(i)return i.type}}break}}if(n){let t=$n(n);if(t){if((0,R.isProperty)(t)){const e=(0,R.lookUpClassMember)(t,"fset"),n=e?Yn(e):void 0;if(!n||!(0,N.isFunction)(n)||n.details.parameters.length<2)return;t=n.details.parameters[1].type}return i&&(s&&(0,N.isInstantiableClass)(s)&&(t=(0,R.partiallySpecializeType)(t,s)),((0,N.isFunction)(t)||(0,N.isOverloadedFunction)(t))&&(t=ui(i,t,void 0,e))),t}}}function we(e,t){return(0,R.mapSubtypes)(e,(e=>{if((0,N.isAnyOrUnknown)(e))return e;const n=Xe(e);if(n)return n;if((0,N.isClassInstance)(e)){const n=et(e,"__await__",t);if(n){if((0,N.isAnyOrUnknown)(n))return n;if((0,N.isClassInstance)(n)&&et(n,"__iter__",t)){const e=Xe(n);if(e)return e}}}return t&&$e(f.getFileInfo(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotAwaitable().format({type:yi(e)}),t),N.UnknownType.create()}))}function Ne(e,t,n){const i=t?"__aiter__":"__iter__",s=t?"__anext__":"__next__";let r=!0;e=He(e),(0,R.isOptionalType)(e)&&(n&&$e(f.getFileInfo(n).diagnosticRuleSet.reportOptionalIterable,c.DiagnosticRule.reportOptionalIterable,m.Localizer.Diagnostic.noneNotIterable(),n),e=(0,N.removeNoneFromUnion)(e));const a=(0,R.mapSubtypes)(e,(e=>{if(e=He(e),(0,N.isAnyOrUnknown)(e))return e;const a=new l.DiagnosticAddendum;if((0,N.isClass)(e)){let r;if(N.TypeBase.isInstance(e)){if((0,R.isTupleClass)(e)&&e.tupleTypeArguments&&0===e.tupleTypeArguments.length)return N.NeverType.create();r=et(e,i,n)}else N.TypeBase.isInstantiable(e)&&e.details.effectiveMetaclass&&(0,N.isInstantiableClass)(e.details.effectiveMetaclass)&&(r=et(N.ClassType.cloneAsInstance(e.details.effectiveMetaclass),i,n,e));if(r){const e=new l.DiagnosticAddendum,o=Ye(r,void 0,(r=>{if((0,N.isAnyOrUnknown)(r))return r;if((0,N.isClassInstance)(r)){const i=et(r,s,n);if(i)return t?we(i,n):i;e.addMessage(m.Localizer.Diagnostic.methodNotDefinedOnType().format({name:s,type:yi(r)}))}else e.addMessage(m.Localizer.Diagnostic.methodReturnsNonObject().format({name:i}))}));if(e.isEmpty())return o;a.addAddendum(e)}else{if((0,N.isClassInstance)(e)){const t=et(e,"__getitem__",n);if(t)return t}a.addMessage(m.Localizer.Diagnostic.methodNotDefined().format({name:i}))}}n&&$e(f.getFileInfo(n).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotIterable().format({type:yi(e)})+a.getString(),n),r=!1}));return r?a:void 0}function Re(e,t,n){const i=t?"__aiter__":"__iter__";let s=!0;e=He(e),(0,R.isOptionalType)(e)&&(n&&$e(f.getFileInfo(n).diagnosticRuleSet.reportOptionalIterable,c.DiagnosticRule.reportOptionalIterable,m.Localizer.Diagnostic.noneNotIterable(),n),e=(0,N.removeNoneFromUnion)(e));const r=(0,R.mapSubtypes)(e,(e=>{if((0,N.isAnyOrUnknown)(e))return e;if((0,N.isClass)(e)){let t;if(N.TypeBase.isInstance(e)?t=et(e,i,n):N.TypeBase.isInstantiable(e)&&e.details.effectiveMetaclass&&(0,N.isInstantiableClass)(e.details.effectiveMetaclass)&&(t=et(N.ClassType.cloneAsInstance(e.details.effectiveMetaclass),i,n,e)),t)return He(t)}n&&$e(f.getFileInfo(n).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotIterable().format({type:yi(e)}),n),s=!1}));return s?r:void 0}function Me(e,t){return Oe(t,f.getFileInfo(e).typingModulePath)}function Oe(t,n){if(!n)return;const i=e(n);if(!i)return;const s=i.symbolTable.get(t);return s?Wn(s):void 0}function Le(e,t){const n=f.getFlowNode(e);if(!n)return!!e.parent&&Le(e.parent,t);const i=t?f.getFlowNode(t):void 0;return!!fi.isFlowNodeReachable(n,i)}function Ve(e){const t=f.getAfterFlowNode(e);return!!t&&!!fi.isFlowNodeReachable(t)&&!!function(e,t){return void 0!==Pn(Fn(e.id),t,void 0,void 0,N.UnboundType.create(),!1).type}(e,t)}function Ue(e,t){const n=f.getFlowNode(e),i=f.getFlowNode(t);return!(!n||!i)&&(n===i||fi.isFlowNodeReachable(i,n))}function ze(e,t,n){return We("information",e,t,n)}function Be(e,t,n){return We("error",e,t,n)}function We(e,t,n,i){if(!je(n))return f.getFileInfo(n).diagnosticSink.addDiagnosticWithTextRange(e,t,i||n)}function je(e){return j.some((t=>C.isNodeContainedWithin(e,t)))||B.isSpeculative(e)||$.isUndoTrackingEnabled()}function $e(e,t,n,i){if("none"===e)return;const s=We(e,n,i);return s&&s.setRule(t),s}function Ge(e,t){const n=f.getFileInfo(t),i=new l.DiagnosticAddendum;(0,N.isUnion)(e)&&(0,R.doForEachSubtype)(e,(e=>{N.TypeBase.isInstantiable(e)||i.addMessage(m.Localizer.DiagnosticAddendum.typeNotClass().format({type:yi(e)}))})),$e(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeExpectedClass().format({type:yi(e)})+i.getString(),t)}function qe(e,t,n,i,s){const r=e.value,a=Rn(e,r,!1);if(!a)return;const o=a.symbol.getDeclarations();let p=$n(a.symbol);const d=f.getFileInfo(e);if(void 0===p&&2===a.scope.type){const t=C.getEnclosingClass(e);if(t){const n=en(t);if(n){const t=(0,R.lookUpClassMember)(n.classType,e.value,1);(null==t?void 0:t.isTypeDeclared)&&(p=Yn(t))}}}let u=t;if(p&&i){let n=new l.DiagnosticAddendum;ii(p,t,n)?u=pi(p,t):(s&&(n=s),$e(d.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(p)})+n.getString(),i||e),u=p)}else{const t=F.getScopeForNode(e);2===(null==t?void 0:t.type)&&N.TypeBase.isInstance(u)&&!(0,x.isConstantName)(r)&&(u=(0,R.stripLiteralValue)(u))}const h=o.find((e=>1===e.type));h&&1===h.type&&i&&h.isConstant&&e!==o[0].node&&$e(d.diagnosticRuleSet.reportConstantRedefinition,c.DiagnosticRule.reportConstantRedefinition,m.Localizer.Diagnostic.constantRedefinition().format({name:r}),e),le(e,u,n,void 0,!1)}function Ke(e,t,n,i,s){const r=e.memberName.value,a=f.getFileInfo(e),l=C.getEnclosingClass(e);if(!l)return;const p=en(l);if(p&&(0,N.isInstantiableClass)(p.classType)){let l=(0,R.lookUpClassMember)(p.classType,r,i?0:8);const d=p.classType.details.fields;if(l){const n=(0,N.isInstantiableClass)(l.classType)?l.classType:void 0,u=n&&N.ClassType.isSameGenericClass(p.classType,n);if(u&&i&&(null==n?void 0:n.details.inheritedSlotsNames)&&(null==n?void 0:n.details.localSlotsNames)&&n.details.localSlotsNames.length>0&&!n.details.inheritedSlotsNames.some((e=>e===r))){const t=$n(l.symbol);t&&(0,R.isProperty)(t)||$e(a.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.slotsAttributeError().format({name:r}),e.memberName)}if(u&&l.isInstanceMember===i){const t=d.get(r);(0,o.assert)(void 0!==t);const n=t.getDeclarations();n.length>0&&1===n[0].type&&s&&e.memberName!==n[0].node&&n[0].isConstant&&$e(a.diagnosticRuleSet.reportConstantRedefinition,c.DiagnosticRule.reportConstantRedefinition,m.Localizer.Diagnostic.constantRedefinition().format({name:e.memberName.value}),e.memberName)}else{const n=$n(l.symbol);if(n&&!(0,R.isProperty)(n)&&!l.isInstanceMember&&i){Je(a,l.symbol,e.memberName);const n=Yn(l);t=(0,N.combineTypes)([t,n])}}}l=(0,R.lookUpClassMember)(p.classType,r,16),l||!s||n||jt(a.diagnosticRuleSet.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,e.memberName,t,e,!0)}}function He(e,t){return(0,R.mapSubtypes)(e,(e=>{if((0,N.isParamSpec)(e)){if("args"===e.paramSpecAccess)return Q&&(0,N.isInstantiableClass)(Q)&&H&&(0,N.isClassInstance)(H)?N.ClassType.cloneAsInstance((0,R.specializeTupleClass)(Q,[H,N.AnyType.create(!0)])):N.UnknownType.create();if("kwargs"===e.paramSpecAccess)return ee&&(0,N.isInstantiableClass)(ee)&&X&&(0,N.isInstantiableClass)(X)&&H&&(0,N.isClassInstance)(H)?N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(ee,[(0,R.convertToInstance)(X),H],!0)):N.UnknownType.create()}if((0,N.isTypeVar)(e)&&!e.details.recursiveTypeAliasName){if(e.details.boundType){const t=N.TypeBase.isInstantiable(e)?(0,R.convertToInstantiable)(e.details.boundType):e.details.boundType;return e.details.isSynthesized?t:(0,R.addConditionToType)(t,[{typeVarName:N.TypeVarType.getNameWithScope(e),constraintIndex:0,isConstrainedTypeVar:!1}])}if(e.details.recursiveTypeAliasName)return e;if(e.details.constraints.length>0){const n=[];return e.details.constraints.forEach(((i,s)=>{if(t){const n=N.TypeVarType.getNameWithScope(e),i=t.find((e=>e.typeVarName===n));if(i&&i.constraintIndex!==s)return}N.TypeBase.isInstantiable(e)&&(i=(0,R.convertToInstantiable)(i)),n.push((0,R.addConditionToType)(i,[{typeVarName:N.TypeVarType.getNameWithScope(e),constraintIndex:s,isConstrainedTypeVar:!0}]))})),(0,N.combineTypes)(n)}if(N.TypeBase.isInstantiable(e)){if(Y&&(0,N.isInstantiableClass)(Y))return e.details.isSynthesized?Y:(0,R.addConditionToType)(N.ClassType.cloneAsInstance(Y),[{typeVarName:N.TypeVarType.getNameWithScope(e),constraintIndex:0,isConstrainedTypeVar:!1}])}else if(H)return e.details.isSynthesized?H:(0,R.addConditionToType)(H,[{typeVarName:N.TypeVarType.getNameWithScope(e),constraintIndex:0,isConstrainedTypeVar:!1}]);return N.AnyType.create()}return e}))}function Ye(e,t,n){const i=[];let s=!1;const r=e=>{const r=(0,N.isUnion)(e)?e:He(e);(0,R.doForEachSubtype)(r,(r=>{var a;if(t&&!N.TypeCondition.isCompatible((0,R.getTypeCondition)(r),t))return;let o=n(r,e);if(o!==e&&(s=!0),o){const e=null===(a=(0,R.getTypeCondition)(r))||void 0===a?void 0:a.filter((e=>e.isConstrainedTypeVar));e&&e.length>0&&(o=(0,R.addConditionToType)(o,e)),i.push(o)}}))};if((0,N.isUnion)(e)?e.subtypes.forEach((e=>{r(e)})):r(e),!s)return e;const a=(0,N.combineTypes)(i);return 9===a.category&&N.UnionType.addTypeAliasSource(a,e),a}function Ze(e,t,n,i,s=!1,r){if((0,N.isTypeVar)(t)&&i&&9===i.nodeType){const n=Te(i.leftExpression).type;(0,N.isInstantiableClass)(n)&&(N.ClassType.isBuiltIn(n,"TypeVar")||N.ClassType.isBuiltIn(n,"TypeVarTuple")||N.ClassType.isBuiltIn(n,"ParamSpec"))&&(38===e.nodeType&&e.value===t.details.name||Be(t.details.isParamSpec?m.Localizer.Diagnostic.paramSpecAssignedName().format({name:N.TypeVarType.getReadableName(t)}):m.Localizer.Diagnostic.typeVarAssignedName().format({name:N.TypeVarType.getReadableName(t)}),e))}switch(t=(0,N.removeUnbound)(t),e.nodeType){case 38:n||jt(f.getFileInfo(e).diagnosticRuleSet.reportUnknownVariableType,c.DiagnosticRule.reportUnknownVariableType,e,t,e,s),qe(e,t,n,i,r);break;case 35:!function(e,t,n,i,s){const r=Te(e.leftExpression),a=He(r.type);if(38===e.leftExpression.nodeType){const s=C.getEnclosingClass(e);if(s){const r=en(s);if(r&&(0,N.isInstantiableClass)(r.classType)&&((0,N.isClassInstance)(a)?N.ClassType.isSameGenericClass(a,r.classType)&&Ke(e,t,n,!0,i):(0,N.isInstantiableClass)(a)&&N.ClassType.isSameGenericClass(a,r.classType)&&Ke(e,t,n,!1,i),N.ClassType.isProtocolClass(r.classType))){const t=r.classType.details.fields.get(e.memberName.value);t&&0===t.getDeclarations().filter((e=>!C.getEnclosingFunction(e.node))).length&&Be(m.Localizer.Diagnostic.assignmentInProtocol(),e.memberName)}}}rt(e,r,{method:"set",setType:t,setErrorNode:i,setExpectedTypeDiag:s},0),le(e.memberName,t,n,void 0,!1),le(e,t,n,void 0,!1)}(e,t,n,i,r);break;case 24:{const s=Te(e.baseExpression,void 0,2);pt(e,s.type,{method:"set",setType:t,setErrorNode:i,setExpectedTypeDiag:r},0),le(e,t,n);break}case 52:!function(e,t,n,i){const s=new Array(e.expressions.length);for(let t=0;t<e.expressions.length;t++)s[t]=[];const r=e.expressions.findIndex((e=>56===e.nodeType));t=He(t);const a=new l.DiagnosticAddendum;(0,R.doForEachSubtype)(t,(t=>{const n=(0,R.getSpecializedTupleType)(t);if(n&&n.tupleTypeArguments){const i=n.tupleTypeArguments,o=i.length;if((0,R.isOpenEndedTupleClass)(n))for(let n=0;n<e.expressions.length;n++)s[n].push((0,R.addConditionToType)(i[0],(0,R.getTypeCondition)(t)));else{let n=0,l=0;for(l=0;l<e.expressions.length;l++)if(l===r){const r=e.expressions.length-l-1,a=o-n;let c=Math.max(a-r,0);for(;c>0;)s[l].push((0,R.addConditionToType)(i[n],(0,R.getTypeCondition)(t))),n++,c--}else{if(n>=o)break;s[l].push((0,R.addConditionToType)(i[n],(0,R.getTypeCondition)(t))),n++}if(l<e.expressions.length||n<o){const n=r>=0?e.expressions.length-1:e.expressions.length,i=a.createAddendum();i.addMessage(m.Localizer.DiagnosticAddendum.tupleAssignmentMismatch().format({type:yi(t)})),i.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.tupleSizeMismatch().format({expected:n,received:o}))}}}else{const n=Ne(t,!1,i)||N.UnknownType.create();for(let i=0;i<e.expressions.length;i++)s[i].push((0,R.addConditionToType)(n,(0,R.getTypeCondition)(t)))}})),a.isEmpty()||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.tupleAssignmentMismatch().format({type:yi(t)})+a.getString(),e),e.expressions.forEach(((e,t)=>{const a=s[t];let o=0===a.length?N.UnknownType.create():(0,N.combineTypes)(a);if(o=(0,R.removeNoReturnFromUnion)(o),t===r){const t=wn(e,"list");(0,N.isInstantiableClass)(t)&&(o=N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(t,[o],!0)))}Ze(e,o,n,i,!0)})),le(e,t,n)}(e,t,n,i);break;case 54:{const n=ve(e.typeAnnotation,{isVariableAnnotation:!0,allowFinal:C.isFinalAllowedForAssignmentTarget(e.valueExpression),allowClassVar:C.isClassVarAllowedForAssignmentTarget(e.valueExpression)});(0,N.isClassInstance)(n)&&(N.ClassType.isBuiltIn(n,"Final")||N.ClassType.isBuiltIn(n,"ClassVar"))||(0,N.isClassInstance)(n)&&N.ClassType.isBuiltIn(n,"TypeAlias")||ii(n,t)&&((0,N.isClassInstance)(t)&&N.ClassType.isEnumClass(t)||(t=pi(n,t))),Ze(e.valueExpression,t,!1,i,s,r);break}case 56:38===e.expression.nodeType&&qe(e.expression,t,!1,i);break;case 31:{const n=Ne(t,!1,i)||N.UnknownType.create();e.entries.forEach((e=>{Ze(e,n,!1,i,s)}));break}case 0:e.child&&Mn(e.child,(()=>{Te(e.child)}));break;default:Be(m.Localizer.Diagnostic.assignmentTargetExpr(),e)}}function Qe(e){switch(e.nodeType){case 38:Te(e);break;case 35:{const t=Te(e.leftExpression),n=rt(e,t,{method:"del"},0);le(e.memberName,n.type,!1),le(e,n.type,!1);break}case 24:{const t=Te(e.baseExpression,void 0,2);pt(e,t.type,{method:"del"},0),le(e,N.UnboundType.create(),!1);break}case 52:e.expressions.forEach((e=>{Qe(e)}));break;case 0:e.child&&Mn(e.child,(()=>{Te(e.child,void 0)}));break;default:$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.delTargetExpr(),e)}}function Je(e,t,n){B.isSpeculative(n)||$.isUndoTrackingEnabled()||e.accessedSymbolMap.set(t.id,!0)}function Xe(e){if((0,N.isAnyOrUnknown)(e))return e;if((0,N.isClassInstance)(e)&&N.ClassType.isBuiltIn(e,"Generator")){const t=e.typeArguments;if(t&&t.length>=3)return t[2]}}function et(e,t,n,i){const s=(0,R.lookUpObjectMember)(e,t,8);if(!s)return;const r=Yn(s);if((0,N.isAnyOrUnknown)(r))return r;if((0,N.isFunction)(r)){const t=ui(i||e,r,s&&(0,N.isInstantiableClass)(s.classType)?s.classType:void 0,n,void 0,!1,i);if(t)return qn(t)}}function tt(e,t,n){var i;if(N.TypeBase.isInstantiable(t)&&!(0,R.isTypeAliasPlaceholder)(t)){const s=function(e,t){var n;let i=e,s=0;for((0,o.assert)(N.TypeBase.isInstantiable(t));i&&(i=C.getTypeVarScopeNode(i,35===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)),i);){let e;if(10===i.nodeType){const t=en(i);t&&(e=t.classType.details.typeParameters),s++}else if(28===i.nodeType){const t=nn(i);t&&(e=[],t.functionType.details.parameters.forEach((t=>{t.hasDeclaredType&&(0,R.addTypeVarsToListIfUnique)(e,(0,R.getTypeVarArgumentsRecursive)(t.type))})),t.functionType.details.declaredReturnType&&(0,R.addTypeVarsToListIfUnique)(e,(0,R.getTypeVarArgumentsRecursive)(t.functionType.details.declaredReturnType)))}else if(36===i.nodeType)break;if(e){const n=e.find((e=>e.details.name===t.details.name));if(n&&n.scopeId)return{type:s>1?t:(0,R.convertToInstantiable)(n),foundInterveningClass:s>1}}i=i.parent}for(i=e;i;){if(3===i.nodeType){const e=oe(i.leftExpression);if(e&&(0,N.isTypeVar)(e)&&e.details.recursiveTypeAliasScopeId&&e.details.recursiveTypeAliasName)return{type:N.TypeVarType.cloneForScopeId(t,e.details.recursiveTypeAliasScopeId,e.details.recursiveTypeAliasName,2),foundInterveningClass:!1}}i=i.parent}return{type:t,foundInterveningClass:!1}}(e,t);if(t=s.type,0!=(2048&n)&&void 0!==t.scopeId)t.details.isSynthesized||t.details.isParamSpec||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeVarUsedByOuterScope().format({name:t.details.name}),e);else if(0!=(8192&n)){if(void 0===t.scopeId)if(s.foundInterveningClass)$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeVarUsedByOuterScope().format({name:t.details.name}),e);else{let n=C.getEnclosingClassOrFunction(e);if(n&&35===(null===(i=e.parent)||void 0===i?void 0:i.nodeType)&&e.parent.leftExpression===e){const i=e.parent.memberName.value;if("args"===i||"kwargs"===i){const i=C.getEnclosingClassOrFunction(n);28===(null==i?void 0:i.nodeType)?n=i:s.type.scopeId||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.paramSpecNotUsedByOuterScope().format({name:t.details.name}),e)}}n?t=N.TypeVarType.cloneForScopeId(t,it(n),n.name.value,28===n.nodeType?1:0):(0,o.fail)("AssociateTypeVarsWithCurrentScope flag was set but enclosing scope not found")}}else if(0!=(4096&n)&&(void 0===t.scopeId||s.foundInterveningClass)&&!t.details.isSynthesized){const n=(0,N.isParamSpec)(t)?m.Localizer.Diagnostic.paramSpecNotUsedByOuterScope():m.Localizer.Diagnostic.typeVarNotUsedByOuterScope();$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,n.format({name:t.details.name}),e)}}return t.isVariadicUnpacked&&(t=N.TypeVarType.cloneForPacked(t)),t}function nt(e,t,n){return 0==(2&n)&&((0,N.isInstantiableClass)(t)&&(0!=(64&n)&&(0,R.requiresTypeArguments)(t)&&!t.typeArguments&&$e(f.getFileInfo(e).diagnosticRuleSet.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,m.Localizer.Diagnostic.typeArgsMissingForClass().format({name:t.aliasName||t.details.name}),e),t.typeArguments||(t=xn(t,void 0,n,e))),0!=(64&n)&&t.typeAliasInfo&&t.typeAliasInfo.typeParameters&&t.typeAliasInfo.typeParameters.length>0&&!t.typeAliasInfo.typeArguments&&($e(f.getFileInfo(e).diagnosticRuleSet.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,m.Localizer.Diagnostic.typeArgsMissingForAlias().format({name:t.typeAliasInfo.name}),e),t=N.TypeBase.cloneForTypeAlias(t,t.typeAliasInfo.name,t.typeAliasInfo.fullName,t.typeAliasInfo.typeVarScopeId,t.typeAliasInfo.typeParameters,t.typeAliasInfo.typeParameters.map((e=>N.UnknownType.create()))))),t}function it(e){return`${f.getFileInfo(e).filePath}.${e.start.toString()}`}function st(e){const t=[];let n=e;for(;n&&(n=C.getTypeVarScopeNode(n),n);)t.push(it(n)),n=n.parent;return t}function rt(e,n,i,s){let r=n.type;const a=e.memberName.value;let o=new l.DiagnosticAddendum;const p=f.getFileInfo(e);let u,h=!!n.isIncomplete;if(n.isIncomplete&&(0,N.isUnbound)(n.type))return{type:N.UnknownType.create(),node:e,isIncomplete:!0};(0,N.isUnion)(r)&&N.TypeBase.isSpecialForm(r)&&H&&(r=H);const y=()=>{if(q&&(0,N.isInstantiableClass)(q))return De(e.memberName,q,a,i,o,void 0,n.bindToType)};switch((0,N.isParamSpec)(r)&&r.paramSpecAccess&&(r=He(r)),r.category){case 2:case 1:u=r;break;case 4:u=N.UnknownType.create();break;case 10:if(r.details.isParamSpec){if("args"===a){const t=C.getEnclosingParameter(e);return t&&1===t.category?{type:N.TypeVarType.cloneForParamSpecAccess(r,"args"),node:e,isIncomplete:h}:(Be(m.Localizer.Diagnostic.paramSpecArgsUsage(),e),{type:N.UnknownType.create(),node:e,isIncomplete:h})}if("kwargs"===a){const t=C.getEnclosingParameter(e);return t&&2===t.category?{type:N.TypeVarType.cloneForParamSpecAccess(r,"kwargs"),node:e,isIncomplete:h}:(Be(m.Localizer.Diagnostic.paramSpecKwargsUsage(),e),{type:N.UnknownType.create(),node:e,isIncomplete:h})}return h||$e(p.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.paramSpecUnknownMember().format({name:a}),e),{type:N.UnknownType.create(),node:e,isIncomplete:h}}return 64&s?(h||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeVarNoMember().format({type:yi(r),name:a}),e.leftExpression),{type:N.UnknownType.create(),node:e,isIncomplete:h}):r.details.recursiveTypeAliasName?{type:N.UnknownType.create(),node:e,isIncomplete:!0}:rt(e,{type:He(r),node:e,bindToType:r,isIncomplete:h},i,0);case 7:if(N.TypeBase.isInstantiable(r)){const t=Pe(e.memberName,r,a,i,o,0,n.bindToType);u=null==t?void 0:t.type,(null==t?void 0:t.isIncomplete)&&(h=!0)}else if(N.ClassType.isBuiltIn(r,"type")&&H&&(0,N.isClassInstance)(H)){const t=Pe(e.memberName,N.ClassType.cloneAsInstantiable(H),a,i,o,0,n.bindToType?(0,R.convertToInstance)(n.bindToType):void 0);u=null==t?void 0:t.type,(null==t?void 0:t.isIncomplete)&&(h=!0)}else{if(N.ClassType.isEnumClass(r)){const t=r.literalValue;if(t instanceof N.EnumLiteral)if("name"===a||"_name_"===a){const n=wn(e,"str");if((0,N.isInstantiableClass)(n))return{node:e,type:N.ClassType.cloneAsInstance(N.ClassType.cloneWithLiteral(n,t.itemName)),isIncomplete:h}}else if("value"===a||"_value_"===a)return{node:e,type:t.itemType,isIncomplete:h}}const t=De(e.memberName,r,a,i,o,void 0,n.bindToType);t&&(u=(0,R.addConditionToType)(t.type,(0,R.getTypeCondition)(r))),(null==t?void 0:t.isIncomplete)&&(h=!0)}break;case 8:{const n=N.ModuleType.getField(r,a);if(n&&!n.isExternallyHidden())"get"===i.method&&Je(f.getFileInfo(e),n,e.memberName),u=jn(n,void 0,!0).type,(0,N.isTypeVar)(u)&&(u=tt(e,u,s)),(0,N.isUnbound)(u)&&(u=N.UnknownType.create()),n.isPrivateMember()&&$e(f.getFileInfo(e).diagnosticRuleSet.reportPrivateUsage,c.DiagnosticRule.reportPrivateUsage,m.Localizer.Diagnostic.privateUsedOutsideOfModule().format({name:a}),e.memberName),n.isPrivatePyTypedImport()&&$e(f.getFileInfo(e).diagnosticRuleSet.reportPrivateImportUsage,c.DiagnosticRule.reportPrivateImportUsage,m.Localizer.Diagnostic.privateImportFromPyTypedModule().format({name:a,module:r.moduleName}),e.memberName);else{if("get"===i.method){const e=N.ModuleType.getField(r,"__getattr__");if(e&&(p.executionEnvironment.pythonVersion>=d.PythonVersion.V3_7||e.getDeclarations().some((e=>e.path.toLowerCase().endsWith(".pyi"))))){const t=jn(e);(0,N.isFunction)(t.type)&&(u=qn(t.type),t.isIncomplete&&(h=!0))}}u||(h||$e(p.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.moduleUnknownMember().format({name:a}),e.memberName),u=t.evaluateUnknownImportsAsAny?N.AnyType.create():N.UnknownType.create())}break}case 9:u=(0,R.mapSubtypes)(r,(t=>{if((0,N.isNone)(t)){const t=y();return t?(u=(0,R.addConditionToType)(t.type,(0,R.getTypeCondition)(r)),t.isIncomplete&&(h=!0),u):void(h||$e(f.getFileInfo(e).diagnosticRuleSet.reportOptionalMemberAccess,c.DiagnosticRule.reportOptionalMemberAccess,m.Localizer.Diagnostic.noneUnknownMember().format({name:a}),e.memberName))}if(!(0,N.isUnbound)(t)){const n=rt(e,{type:t,node:e},i,0);return n.isIncomplete&&(h=!0),n.type}}));break;case 5:case 6:if("__defaults__"===a)u=N.AnyType.create();else if("__self__"===a){const e=(0,N.isFunction)(r)?r:r.overloads[0];u=e.boundToType}else u=Z?rt(e,{type:Z,node:e},i,s).type:N.AnyType.create();break;case 3:{const e=y();e&&(u=(0,R.addConditionToType)(e.type,(0,R.getTypeCondition)(r)),e.isIncomplete&&(h=!0));break}default:o.addMessage(m.Localizer.DiagnosticAddendum.typeUnsupported().format({type:yi(r)}))}if(!u){let t=m.Localizer.Diagnostic.memberAccess();"set"===i.method?t=m.Localizer.Diagnostic.memberSet():"del"===i.method&&(t=m.Localizer.Diagnostic.memberDelete()),i.setExpectedTypeDiag&&(o=i.setExpectedTypeDiag);const n=(0,N.isFunction)(r)||(0,N.isOverloadedFunction)(r)||(0,N.isClassInstance)(r)&&N.ClassType.isBuiltIn(r,"function"),[s,l]=n?[p.diagnosticRuleSet.reportFunctionMemberAccess,c.DiagnosticRule.reportFunctionMemberAccess]:[p.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues];$e(s,l,t.format({name:a,type:yi(r)})+o.getString(),e.memberName),u=n?N.AnyType.create():N.UnknownType.create()}if(0==(2&s)&&(0,N.isInstantiableClass)(u)&&!u.typeArguments&&(u=xn(u,void 0,s,e)),"get"===i.method){let t=h;(0,N.isInstantiableClass)(u)&&C.isNodeContainedWithinNodeType(e,1)&&(t=!0),t||jt(p.diagnosticRuleSet.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,e.memberName,u,e,!1)}return{type:u,node:e,isIncomplete:h}}function at(e,t,n,i,s,r,a){var l;let c=0;1&r&&(c|=8),2&r&&(c|=2),4&r&&(c|=4),128&r&&(c|=1);let p=(0,R.lookUpClassMember)(t,n,16|c);if(p||(p=(0,R.lookUpClassMember)(t,n,c)),p){let o,c=!1;if(p.symbol.isInitVar())return void(s&&s.addMessage(m.Localizer.DiagnosticAddendum.memberIsInitVar().format({name:n})));if("get"!==i.method){const n=C.getEnclosingClass(e);if(n){const e=null===(l=en(n))||void 0===l?void 0:l.classType;e&&(0,N.isInstantiableClass)(e)&&N.ClassType.isSameGenericClass(e,t)&&(o=$n(p.symbol)||N.UnknownType.create(),o&&(0,N.isInstantiableClass)(p.classType)&&(o=(0,R.partiallySpecializeType)(o,p.classType)))}}if(!o){const n=function(e,t,n,i=!1){if((0,N.isInstantiableClass)(t.classType)){const s=jn(t.symbol);if(s)return Gn(s.type),{node:e,type:(0,R.partiallySpecializeType)(s.type,t.classType,n,i),isIncomplete:!!s.isIncomplete}}}(e,p,a?void 0:t,!0);n?(o=n.type,n.isIncomplete&&(c=!0)):o=N.UnknownType.create()}if(N.ClassType.isTypedDictClass(t)){const e=p.symbol.getTypedDeclarations();if(e.length>0&&1===e[0].type)return void(s&&s.addMessage(m.Localizer.DiagnosticAddendum.memberUnknown().format({name:n})))}"get"===i.method&&(0,N.isInstantiableClass)(p.classType)&&N.ClassType.isSameGenericClass(p.classType,t)&&Je(f.getFileInfo(e),p.symbol,e);const d=ot(o,p,t,a,0==(1&r),r,e,n,i,s);if(!d)return;if(o=d,"set"===i.method&&i.setType){if(!ii(o,i.setType,null==s?void 0:s.createAddendum()))return void(s&&s.addMessage(m.Localizer.DiagnosticAddendum.memberAssignment().format({type:yi(i.setType),name:n,classType:hi(t)})));if((0,N.isInstantiableClass)(p.classType)&&N.ClassType.isFrozenDataClass(p.classType)&&0==(1&r))return void(s&&s.addMessage(m.Localizer.DiagnosticAddendum.dataclassFrozen().format({name:yi(N.ClassType.cloneAsInstance(p.classType))})))}return{type:o,isTypeIncomplete:c,isClassMember:!p.isInstanceMember}}if(0==(65&r)){const l=function(e,t,n){var i,s,r,a;if("get"===n.method){const n=null===(i=Pe(t,e,"__getattribute__",{method:"get"},void 0,4))||void 0===i?void 0:i.type;if(n&&(0,N.isFunction)(n))return qn(n);const r=null===(s=Pe(t,e,"__getattr__",{method:"get"},void 0,4))||void 0===s?void 0:s.type;if(r&&(0,N.isFunction)(r))return qn(r)}else if("set"===n.method){if(null===(r=Pe(t,e,"__setattr__",{method:"get"},void 0,4))||void 0===r?void 0:r.type)return N.AnyType.create()}else if((0,o.assert)("del"===n.method),null===(a=Pe(t,e,"__detattr__",{method:"get"},void 0,4))||void 0===a?void 0:a.type)return N.AnyType.create()}(t,e,i);if(l){const o=ot(l,p,t,a,!!a,r,e,n,i,s);if(!o)return;return{type:o,isTypeIncomplete:!1,isClassMember:!1}}}s&&s.addMessage(m.Localizer.DiagnosticAddendum.memberUnknown().format({name:n}))}function ot(e,t,n,i,s,r,a,o,l,c){const p=0!=(16&r);let d=!0;return e=(0,R.mapSubtypes)(e,(e=>{if((0,N.isClass)(e)){let p=e,u=!1;if(N.TypeBase.isInstantiable(e)&&(e.details.effectiveMetaclass&&(0,N.isInstantiableClass)(e.details.effectiveMetaclass)&&(s||"get"===l.method)?(p=(0,R.convertToInstance)(e.details.effectiveMetaclass),u=!0):p=void 0),p){let h;h="get"===l.method?"__get__":"set"===l.method?"__set__":"__delete__";const y=(0,R.lookUpClassMember)(p,h,8);if(N.ClassType.isPropertyClass(p))if("set"===l.method){if(!y)return c&&c.addMessage(m.Localizer.DiagnosticAddendum.propertyMissingSetter().format({name:o})),void(d=!1)}else if("del"===l.method&&!y)return c&&c.addMessage(m.Localizer.DiagnosticAddendum.propertyMissingDeleter().format({name:o})),void(d=!1);if(y){let o=Yn(y);const h=[{argumentCategory:0,type:N.ClassType.isClassProperty(p)?n:s?i||N.ClassType.cloneAsInstance(n):N.NoneType.createInstance()}];if("get"===l.method?h.push({argumentCategory:0,type:n}):"set"===l.method&&h.push({argumentCategory:0,type:l.setType||N.UnknownType.create()}),N.ClassType.isPropertyClass(p)&&t&&(0,N.isInstantiableClass)(t.classType)&&(Gn(o),o=(0,R.partiallySpecializeType)(o,t.classType),0!=(1&r)&&N.ClassType.isProtocolClass(n)&&(c&&c.addMessage(m.Localizer.DiagnosticAddendum.propertyAccessFromProtocolClass()),d=!1)),o&&((0,N.isFunction)(o)||(0,N.isOverloadedFunction)(o))){const n=o,i=Mn(a,(()=>{let i;N.ClassType.isPropertyClass(e)&&!u?t&&(0,N.isInstantiableClass)(t.classType)&&(i=t.classType):(0,N.isInstantiableClass)(y.classType)&&(i=y.classType);const s=ui(p,n,i,a,void 0,void 0,u?e:void 0);if(s&&((0,N.isFunction)(s)||(0,N.isOverloadedFunction)(s))){const e=new M.TypeVarMap((0,R.getTypeVarScopeId)(s));i&&e.addSolveForScope((0,R.getTypeVarScopeId)(i));const t=St(a,h,s,e,!0);return t.argumentErrors?(d=!1,N.AnyType.create()):"get"===l.method?t.returnType||N.UnknownType.create():N.AnyType.create()}}));if(i)return i}}}}else if(((0,N.isFunction)(e)||(0,N.isOverloadedFunction)(e))&&(!s||t&&!t.isInstanceMember))return ui(s?N.ClassType.cloneAsInstance(n):n,e,t&&(0,N.isInstantiableClass)(t.classType)?t.classType:void 0,a,void 0,p,i);if("set"===l.method){if((null==t?void 0:t.symbol.isClassVar())&&8&r)return c&&c.addMessage(m.Localizer.DiagnosticAddendum.memberSetClassVar().format({name:o})),void(d=!1);const n=null==t?void 0:t.symbol.getDeclarations().find((e=>(0,b.isFinalVariableDeclaration)(e)));if(n&&!C.isNodeContainedWithin(a,n.node)){const e=C.getEnclosingFunction(a);if(!e||"__init__"!==e.name.value)return c&&c.addMessage(m.Localizer.Diagnostic.finalReassigned().format({name:o})),void(d=!1)}if((null==t?void 0:t.isInstanceMember)&&(0,N.isClass)(t.classType)&&N.ClassType.isReadOnlyInstanceVariables(t.classType))return c&&c.addMessage(m.Localizer.DiagnosticAddendum.readOnlyAttribute().format({name:o})),void(d=!1);let i=!1;if((t&&t.symbol.hasTypedDeclarations()||t&&!t.symbol.getDeclarations().some((e=>e.node===a)))&&(i=!0),i){let n=e;return s&&!t.isInstanceMember&&(0,N.isFunction)(e)&&(N.FunctionType.isClassMethod(e)||N.FunctionType.isInstanceMethod(e))&&(n=N.FunctionType.clone(e,!0)),n}}return e})),d?e:void 0}function lt(e,t){const n=t.findIndex((e=>(0,N.isVariadicTypeVar)(e)));if(n>=0&&n<e.length&&Q&&(0,N.isInstantiableClass)(Q)){const i=e.slice(n,n+1+e.length-t.length);if(1===i.length&&(0,N.isVariadicTypeVar)(i[0].type))ct(i[0].type,i[0].node);else{i.forEach(((e,t)=>{Gt(e,0===t,!0)}));const s=1===i.length&&i[0].isEmptyTupleShorthand?[]:i.map((e=>(0,R.convertToInstance)(e.type))),r=(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,s,!0,!0,!0));e=[...e.slice(0,n),{node:e[n].node,type:r},...e.slice(n+1+e.length-t.length,e.length)]}}return e}function ct(e,t){return!!e.isVariadicUnpacked||(Be(m.Localizer.Diagnostic.unpackedTypeVarTupleExpected().format({name1:e.details.name,name2:e.details.name}),t),!1)}function pt(e,t,n,i){var s,r;if((null===(s=t.typeAliasInfo)||void 0===s?void 0:s.typeParameters)&&t.typeAliasInfo.typeParameters.length>0&&!t.typeAliasInfo.typeArguments){const n=t.typeAliasInfo.typeParameters,s=lt(ht(e,i),n);s.length>n.length&&!n.some((e=>e.details.isVariadic))&&Be(m.Localizer.Diagnostic.typeArgsTooMany().format({name:yi(t),expected:n.length,received:s.length}),s[n.length].node);const a=new M.TypeVarMap(t.typeAliasInfo.typeVarScopeId),o=new l.DiagnosticAddendum;n.forEach(((e,t)=>{ni(e,t<s.length?(0,R.convertToInstance)(s[t].type):N.UnknownType.create(),o,a)})),o.isEmpty()||Be(m.Localizer.Diagnostic.typeNotSpecializable().format({type:yi(t)})+o.getString(),e);const c=[];return null===(r=t.typeAliasInfo.typeParameters)||void 0===r||r.forEach((e=>{var t;const n=(0,N.isParamSpec)(e)?null===(t=a.getParamSpec(e))||void 0===t?void 0:t.paramSpec:a.getTypeVarType(e);c.push(n||N.UnknownType.create())})),{type:N.TypeBase.cloneForTypeAlias((0,R.applySolvedTypeVars)(t,a),t.typeAliasInfo.name,t.typeAliasInfo.fullName,t.typeAliasInfo.typeVarScopeId,t.typeAliasInfo.typeParameters,c),node:e}}if((0,R.isTypeAliasPlaceholder)(t)){const n=ht(e,i).map((e=>(0,R.convertToInstance)(e.type)));return{type:N.TypeBase.cloneForTypeAlias(t,t.details.recursiveTypeAliasName,"",t.details.recursiveTypeAliasScopeId,void 0,n),node:e}}let a=!1;const o=Ye(t,void 0,((t,s)=>{var r;if((0,N.isAnyOrUnknown)(t))return t;if(64&i&&(0,N.isTypeVar)(s))return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeVarNotSubscriptable().format({type:yi(s)}),e.baseExpression),ht(e,i,!1,!1),N.UnknownType.create();if((0,N.isInstantiableClass)(t)){if(t.details.effectiveMetaclass&&(0,N.isInstantiableClass)(t.details.effectiveMetaclass)&&!N.ClassType.isBuiltIn(t.details.effectiveMetaclass,"type")&&Pe(e,t,ut(n),void 0,void 0,32))return mt(e,t,n).type;if("set"===n.method?Be(m.Localizer.Diagnostic.genericClassAssigned(),e.baseExpression):"del"===n.method&&Be(m.Localizer.Diagnostic.genericClassDeleted(),e.baseExpression),N.ClassType.isSpecialBuiltIn(t,"Literal"))return function(e,t){if(0===e.items.length)return Be(m.Localizer.Diagnostic.literalEmptyArgs(),e.baseExpression),N.UnknownType.create();const n=[];for(const t of e.items){let i;const s=t.valueExpression;if(0!==t.argumentCategory)Be(m.Localizer.Diagnostic.unpackedArgInTypeArgument(),s),i=N.UnknownType.create();else if(t.name)Be(m.Localizer.Diagnostic.keywordArgInTypeArgument(),s),i=N.UnknownType.create();else if(48===s.nodeType){i=Kt(e,0!=(32&s.strings[0].token.flags)?"bytes":"str",s.strings.map((e=>e.value)).join(""))}else 40===s.nodeType?!s.isImaginary&&s.isInteger&&(i=Kt(e,"int",s.value)):11===s.nodeType?33===s.constType?i=Kt(e,"bool",!0):15===s.constType?i=Kt(e,"bool",!1):26===s.constType&&(i=N.NoneType.createType()):55===s.nodeType&&33===s.operator&&40===s.expression.nodeType&&!s.expression.isImaginary&&s.expression.isInteger&&(i=Kt(e,"int",-s.expression.value));if(!i){const e=Te(s);if((0,N.isClassInstance)(e.type)&&N.ClassType.isEnumClass(e.type)&&void 0!==e.type.literalValue)i=N.ClassType.cloneAsInstantiable(e.type);else{let t=!0;(0,R.doForEachSubtype)(e.type,(e=>{(0,N.isInstantiableClass)(e)&&void 0!==e.literalValue||(t=!1)})),t&&(i=e.type)}}i||(Be(m.Localizer.Diagnostic.literalUnsupportedType(),t),i=N.UnknownType.create()),n.push(i)}return(0,N.combineTypes)(n)}(e);if(N.ClassType.isBuiltIn(t,"InitVar")){const t=ht(e,i);return 1===t.length?t[0].type:(Be(m.Localizer.Diagnostic.typeArgsMismatchOne().format({received:t.length}),e.baseExpression),N.UnknownType.create())}if(N.ClassType.isEnumClass(t))return N.ClassType.cloneAsInstance(t);const s=(0,N.isInstantiableClass)(t)&&N.ClassType.isBuiltIn(t,"Annotated"),a=(0,N.isInstantiableClass)(t)&&N.ClassType.hasCustomClassGetItem(t),o=(null===(r=t.details.typeParameters)||void 0===r?void 0:r.length)>0||N.ClassType.isSpecialBuiltIn(t)||N.ClassType.isBuiltIn(t,"type")||N.ClassType.isPartiallyConstructed(t);let l=ht(e,i,s,a||!o);return s||(l=lt(l,t.details.typeParameters)),a?t:xn(t,l,i,e)}if((0,N.isClassInstance)(t)){const i=mt(e,t,n);return i.isIncomplete&&(a=!0),i.type}return(0,N.isNever)(t)?N.UnknownType.create():(0,N.isNone)(t)?($e(f.getFileInfo(e).diagnosticRuleSet.reportOptionalSubscript,c.DiagnosticRule.reportOptionalSubscript,m.Localizer.Diagnostic.noneNotSubscriptable(),e.baseExpression),N.UnknownType.create()):((0,N.isUnbound)(t)||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotSubscriptable().format({type:yi(t)}),e.baseExpression),N.UnknownType.create())}));return e.items.forEach((e=>{Te(e.valueExpression,void 0,4&i)})),{type:o,node:e,isIncomplete:a}}function dt(e,t=!1){return Q&&(0,N.isInstantiableClass)(Q)?t?(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,[(0,N.combineTypes)(e),N.AnyType.create(!0)])):(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,e)):N.UnknownType.create()}function ut(e){return"get"===e.method?"__getitem__":"set"===e.method?"__setitem__":((0,o.assert)("del"===e.method),"__delitem__")}function mt(e,t,n){var i,s;if((0,N.isClassInstance)(t)&&N.ClassType.isTypedDictClass(t)){const i=(0,E.getTypeFromIndexedTypedDict)(gi,e,t,n);if(i)return i}const r=ut(n),a=(0,N.isClassInstance)(t)?null===(i=De(e,t,r))||void 0===i?void 0:i.type:null===(s=Pe(e,t,r,void 0,void 0,32))||void 0===s?void 0:s.type;if(!a)return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.methodNotDefinedOnType().format({name:r,type:yi(t)}),e.baseExpression),{node:e,type:N.UnknownType.create()};if(1===e.items.length&&!e.trailingComma&&!e.items[0].name&&0===e.items[0].argumentCategory&&(0,N.isClassInstance)(t)){const n=e.items[0].valueExpression,i=Te(n).type;if((0,N.isClassInstance)(i)&&N.ClassType.isBuiltIn(i,"int")&&(0,R.isLiteralType)(i)){const n=i.literalValue,s=(0,R.getSpecializedTupleType)(t);if(s&&s.tupleTypeArguments){if((0,R.isOpenEndedTupleClass)(s))return{node:e,type:s.tupleTypeArguments[0]};if(n>=0&&n<s.tupleTypeArguments.length)return{node:e,type:s.tupleTypeArguments[n]};if(n<0&&s.tupleTypeArguments.length+n>=0)return{node:e,type:s.tupleTypeArguments[s.tupleTypeArguments.length+n]}}}else if((0,N.isClassInstance)(i)&&N.ClassType.isBuiltIn(i,"slice")){const i=(0,R.getSpecializedTupleType)(t);if(i&&i.tupleTypeArguments&&!(0,R.isOpenEndedTupleClass)(i)&&46===n.nodeType&&!n.stepValue){const t=(e,t)=>{let n=t;if(e){const t=Te(e).type;(0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"int")&&(0,R.isLiteralType)(t)?(n=t.literalValue,n<0&&(n=i.tupleTypeArguments.length+n)):n=-1}return n},s=t(n.startValue,0),r=t(n.endValue,i.tupleTypeArguments.length);if(s>=0&&r>0&&r<=i.tupleTypeArguments.length&&Q&&(0,N.isInstantiableClass)(Q))return{node:e,type:N.ClassType.cloneAsInstance((0,R.specializeTupleClass)(Q,i.tupleTypeArguments.slice(s,r)))}}}}const o=e.items.filter((e=>0===e.argumentCategory&&!e.name)),l=e.items.filter((e=>1===e.argumentCategory)),p=e.items.filter((e=>0===e.argumentCategory&&!!e.name)),d=e.items.filter((e=>2===e.argumentCategory));let u;if(1!==o.length||0!==l.length||e.trailingComma)if(0===o.length&&0===l.length)u=Q&&(0,N.isInstantiableClass)(Q)?(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,[])):N.UnknownType.create();else{const e=[];o.forEach((t=>{e.push(Te(t.valueExpression).type)})),l.forEach((t=>{const n=Ne(Te(t.valueExpression).type,!1,t)||N.UnknownType.create();e.push(n)})),u=dt(e,l.length>0)}else u=Te(o[0].valueExpression).type;let h,y=[{argumentCategory:0,type:u}];if("set"===n.method){let e=n.setType||N.AnyType.create();(0,N.isTypeVar)(e)&&e.details.constraints.length>0&&(e=He(e,(0,N.isClassInstance)(t)?t.condition:void 0)),y.push({argumentCategory:0,type:e})}return p.forEach((e=>{y.push({argumentCategory:0,valueExpression:e.valueExpression,node:e,name:e.name})})),d.forEach((e=>{y.push({argumentCategory:2,valueExpression:e.valueExpression,node:e})})),On(e,(()=>{if(h=St(e,y,a),h.argumentErrors&&(0,N.isClassInstance)(u)&&0===p.length&&0===d.length){const t=[...y];if(t[0]={...t[0]},De(e,u,"__index__")){const n=Nn(e,"int");(0,N.isClassInstance)(n)&&(t[0].type=n)}h=St(e,t,a),h.argumentErrors||(y=t)}})),h=St(e,y,a),{node:e,type:h.returnType||N.UnknownType.create(),isIncomplete:!!h.isTypeIncomplete}}function ht(e,t,n=!1,i=!1){const s=[];let r=-163&t;r|=131072;const a=(e,t)=>{let s;return s=i||n&&t>0?Te(e,void 0,131234):function(e,t){let n,i=132185|t;return f.getFileInfo(e).isStubFile&&(i|=4),31===e.nodeType?n={type:N.UnknownType.create(),typeList:e.entries.map((e=>Te(e,void 0,i))),node:e}:(n=Te(e,void 0,i),(0,N.isClass)(n.type)&&N.ClassType.isBuiltIn(n.type,"Protocol")&&Be(m.Localizer.Diagnostic.protocolNotAllowedInTypeArgument(),e),(0,N.isClass)(n.type)&&N.ClassType.isBuiltIn(n.type,"ClassVar")&&Be(m.Localizer.Diagnostic.protocolNotAllowedInTypeArgument(),e)),n}(e,r),s};return 1===e.items.length&&!e.trailingComma&&!e.items[0].name&&52===e.items[0].valueExpression.nodeType&&e.items[0].valueExpression.expressions.length>0?e.items[0].valueExpression.expressions.forEach(((e,t)=>{s.push(a(e,t))})):e.items.forEach(((e,t)=>{const n=a(e.valueExpression,t);0!==e.argumentCategory&&(1===e.argumentCategory&&(0,N.isVariadicTypeVar)(n.type)&&!n.type.isVariadicUnpacked?n.type=N.TypeVarType.cloneForUnpacked(n.type):(Be(m.Localizer.Diagnostic.unpackedArgInTypeArgument(),e.valueExpression),n.type=N.UnknownType.create())),e.name&&Be(m.Localizer.Diagnostic.keywordArgInTypeArgument(),e.valueExpression),s.push(n)})),s}function yt(e,t){if(t=(0,R.transformPossibleRecursiveTypeAlias)(t),!(0,N.isClassInstance)(t))return;if(!Q||!(0,N.isInstantiableClass)(Q))return;const n=[];if((0,R.isTupleClass)(t)&&t.tupleTypeArguments)if((0,R.isOpenEndedTupleClass)(t)){const i=(0,R.transformPossibleRecursiveTypeAlias)(t.tupleTypeArguments[0]);for(let t=0;t<e.expressions.length;t++)n.push(i)}else t.tupleTypeArguments.forEach((e=>{n.push((0,R.transformPossibleRecursiveTypeAlias)(e))}));else{const i=new M.TypeVarMap((0,R.getTypeVarScopeId)(Q));if(!Ct(Q,t,i,st(e)))return;const s=(0,R.applySolvedTypeVars)(Q,i);if(!s.typeArguments||1!==s.typeArguments.length)return;const r=(0,R.transformPossibleRecursiveTypeAlias)(s.typeArguments[0]);for(let t=0;t<e.expressions.length;t++)n.push(r)}const i=e.expressions.map(((e,t)=>Te(e,t<n.length?n[t]:void 0))),s=n.some((e=>(0,R.isLiteralTypeOrUnion)(e)));return{type:(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,gt(i),!0,!s)),node:e}}function gt(e){const t=[];let n=!1;for(const i of e)if(i.unpackedType)if((0,N.isClassInstance)(i.unpackedType)&&(0,R.isTupleClass)(i.unpackedType)){const e=i.unpackedType.tupleTypeArguments;!e||(0,R.isOpenEndedTupleClass)(i.unpackedType)?(t.push(i.type),n=!0):t.push(...e)}else t.push(i.type),n=!0;else t.push(i.type);return n?[(0,N.combineTypes)(t),N.AnyType.create(!0)]:t}function ft(e,t){const n=Te(e.leftExpression,void 0,2),i=e.arguments.map((e=>({valueExpression:e.valueExpression,argumentCategory:e.argumentCategory,node:e,name:e.name})));let s={node:e,type:N.UnknownType.create()};if((0,R.isTypeAliasPlaceholder)(n.type))s.isIncomplete=!0;else{if(38===e.leftExpression.nodeType&&"super"===e.leftExpression.value)s=function(e){let t,n;if(e.arguments.length>2&&Be(m.Localizer.Diagnostic.superCallArgCount(),e.arguments[2]),e.arguments.length>0){t=Te(e.arguments[0].valueExpression).type;const n=He(t);(0,N.isAnyOrUnknown)(n)||(0,N.isInstantiableClass)(n)||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.superCallFirstArg().format({type:yi(t)}),e.arguments[0].valueExpression)}else{const n=C.getEnclosingClass(e);if(n){const e=en(n);t=e?e.classType:N.UnknownType.create()}else Be(m.Localizer.Diagnostic.superCallZeroArgForm(),e.leftExpression),t=N.UnknownType.create()}if(e.arguments.length>1){const i=He(Te(e.arguments[1].valueExpression).type);let s=!1;(0,N.isAnyOrUnknown)(i)||((0,N.isClassInstance)(i)?((0,N.isInstantiableClass)(t)&&((0,R.derivesFromClassRecursive)(N.ClassType.cloneAsInstantiable(i),t,!0)||(s=!0)),n=i):(0,N.isInstantiableClass)(i)?((0,N.isInstantiableClass)(t)&&((0,R.derivesFromClassRecursive)(i,t,!0)||(s=!0)),n=i):s=!0),s&&$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.superCallSecondArg().format({type:yi(t)}),e.arguments[1].valueExpression)}else{const i=C.getEnclosingFunction(e);let s;if(i){const e=nn(i);if(e){const t=e.functionType;N.FunctionType.isClassMethod(t)?t.details.parameters.length>0&&t.details.parameters[0].hasDeclaredType&&(s=He(t.details.parameters[0].type)):N.FunctionType.isInstanceMethod(t)&&t.details.parameters.length>0&&t.details.parameters[0].hasDeclaredType&&(s=He((0,R.convertToInstantiable)(t.details.parameters[0].type)))}}s&&(0,N.isInstantiableClass)(s)?n=s:(0,N.isInstantiableClass)(t)&&(n=t)}let i=!0;const s=C.getEnclosingFunction(e);if(s){const e=nn(s);e&&(N.FunctionType.isStaticMethod(e.functionType)||N.FunctionType.isConstructorMethod(e.functionType)||N.FunctionType.isClassMethod(e.functionType))&&(i=!1)}const r=e.parent;if(35===r.nodeType){const s=r.memberName.value,a=(0,R.lookUpClassMember)(t,s,1);if(a&&(0,N.isInstantiableClass)(a.classType))return{type:i?N.ClassType.cloneAsInstance(a.classType):a.classType,node:e,bindToType:i&&n&&(0,N.isInstantiableClass)(n)?N.ClassType.cloneAsInstance(n):n}}if((0,N.isInstantiableClass)(t)){if(t.details.mro.some((e=>(0,N.isAnyOrUnknown)(e))))return{type:N.UnknownType.create(),node:e};const n=t.details.baseClasses;if(n.length>0){const t=n[0];if((0,N.isInstantiableClass)(t))return{type:i?N.ClassType.cloneAsInstance(t):t,node:e}}}return{type:N.UnknownType.create(),node:e}}(e);else if((0,N.isAnyOrUnknown)(n.type)&&38===e.leftExpression.nodeType&&"reveal_type"===e.leftExpression.value)1===e.arguments.length&&0===e.arguments[0].argumentCategory&&void 0===e.arguments[0].name?s=function(e){const t=Te(e.arguments[0].valueExpression),n=t.type,i=C.printExpression(e.arguments[0].valueExpression),s=yi(n,!0);ze(m.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:i,type:s}),e.arguments[0]);const r=wn(e,"str");let a=N.AnyType.create();return(0,N.isInstantiableClass)(r)&&(a=N.ClassType.cloneAsInstance(N.ClassType.cloneWithLiteral(r,s))),{node:e,type:a,isIncomplete:t.isIncomplete}}(e):Be(m.Localizer.Diagnostic.revealTypeArgs(),e);else if((0,N.isAnyOrUnknown)(n.type)&&38===e.leftExpression.nodeType&&"reveal_locals"===e.leftExpression.value)0===e.arguments.length?s.type=function(e){let t,n=e;for(;n&&(t=F.getScopeForNode(n),!t||0===t.type);)n=n.parent;const i=[];return t&&t.symbolTable.forEach(((e,t)=>{if(!e.isIgnoredForProtocolMatch()){const n=Wn(e);i.push(m.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:t,type:yi(n,!0)}))}})),i.length>0?ze(i.join("\n"),e):ze(m.Localizer.Diagnostic.revealLocalsNone(),e),N.NoneType.createInstance()}(e):Be(m.Localizer.Diagnostic.revealLocalsArgs(),e);else{const r=St(e,i,n.type,void 0,!1,t);s.type=r.returnType||N.UnknownType.create(),(0,N.isUnion)(s.type)&&(s.type=(0,R.removeNoReturnFromUnion)(s.type)),r.argumentErrors&&(s.typeErrors=!0,t&&(s.isIncomplete=!0)),r.isTypeIncomplete&&(s.isIncomplete=!0)}n.isIncomplete&&(s.isIncomplete=!0)}return(0,N.isInstantiableClass)(n.type)&&N.ClassType.isBuiltIn(n.type,"TypeVar")&&f.getFileInfo(e).isTypingStubFile||i.forEach(((e,t)=>{48!==e.node.valueExpression.nodeType&&An(e)})),s}function Tt(e,t,n,i,s,r,a){const o=[],l=[];let c=!1;for(let r=0;r<t.length;r++){let p;const d=t[r],u=d.some((e=>void 0!==e));for(let t=0;t<n.length;t++){const r=n[t];let m=i[t];u&&(m={...i[t]},m.argParams=m.argParams.map(((e,t)=>{if(!d[t])return e;const n={...e};return n.argType=d[t],n})));const h=s?s.clone():new M.TypeVarMap((0,R.getTypeVarScopeId)(r));h.addSolveForScope((0,R.getTypeVarScopeId)(r));const y=On(e,(()=>Dt(e,m,r,h,!0,a)));if(y.isTypeIncomplete&&(c=!0),!y.argumentErrors&&y.returnType){p=r,l.push({overload:p,matchResults:m,typeVarMap:h}),o.push(y.returnType);break}}if(!p)return{argumentErrors:!0,isTypeIncomplete:c}}if(s)for(let n=0;n<t.length;n++){const t=l[n].overload,i=l[n].matchResults;On(e,(()=>(s.addSolveForScope((0,R.getTypeVarScopeId)(t)),s.unlock(),Dt(e,i,t,s,!0,a))))}const p=l[0].overload;return l[0].typeVarMap.unlock(),Dt(e,l[0].matchResults,p,l[0].typeVarMap,r,a).isTypeIncomplete&&(c=!0),{argumentErrors:!1,returnType:(0,N.combineTypes)(o),isTypeIncomplete:c}}function _t(e,t){let n,i=e.length-1;for(;i>=0&&!t[0][i];)i--;if(i++,i>=e.length)return;for(;i<e.length;){const t=e[i];if((0,N.isUnion)(t)){n=t;break}i++}if(!n)return;const s=[];return t.forEach((e=>{(0,R.doForEachSubtype)(n,(t=>{const n=[...e];n[i]=t,s.push(n)}))})),s}function vt(e,t,n,i,s){var r;let a,o=!1,l=!1;const p=e=>(0,N.isFunction)(e)&&N.FunctionType.isSkipConstructorCheck(e),d=null===(r=De(e,N.ClassType.cloneAsInstance(n),"__init__",{method:"get"},void 0,68))||void 0===r?void 0:r.type;if(d&&!p(d)){if(s&&(a=(0,R.mapSubtypes)(s,(s=>{s=(0,R.transformPossibleRecursiveTypeAlias)(s);const r=new M.TypeVarMap((0,R.getTypeVarScopeId)(n));if(Ct(n,s,r,st(e))){let a;if(On(e,(()=>{a=St(e,t,d,r.clone(),i,N.NoneType.createInstance())})),!(null==a?void 0:a.argumentErrors))return St(e,t,d,r,i,N.NoneType.createInstance()),bt(n,s,r)}})),(0,N.isNever)(a)&&(a=void 0)),!a){const s=n.typeArguments?(0,R.buildTypeVarMapFromSpecializedClass)(n,!1):new M.TypeVarMap((0,R.getTypeVarScopeId)(n));s.addSolveForScope((0,R.getTypeVarScopeId)(d)),St(e,t,d,s,i).argumentErrors?l=!0:a=It(n,void 0,s)}o=!0,i=!0}if(!l){const r=n.details.effectiveMetaclass;let c;r&&(0,N.isInstantiableClass)(r)&&!N.ClassType.isBuiltIn(r,"type")&&(c=(0,R.lookUpClassMember)(r,"__call__",28),c&&(0,N.isInstantiableClass)(c.classType)&&N.ClassType.isBuiltIn(c.classType,"type")&&(c=void 0));const d=at(e,n,"__new__",{method:"get"},void 0,21,n);if(!c&&d&&!p(d.type)){const r=d.type,c=new M.TypeVarMap((0,R.getTypeVarScopeId)(n));if(n.typeAliasInfo&&c.addSolveForScope(n.typeAliasInfo.typeVarScopeId),c.addSolveForScope((0,R.getTypeVarScopeId)(r)),r){const p=St(e,t,r,c,i);if(p.argumentErrors)l=!0;else{let e=p.returnType;e&&((0,N.isClassInstance)(e)&&N.ClassType.isSameGenericClass(e,n)?((0,R.isPartlyUnknown)(e)||(0,R.requiresSpecialization)(e))&&void 0!==a||((0,N.isClassInstance)(e)&&N.ClassType.isTupleClass(e)&&!e.tupleTypeArguments&&e.typeArguments&&1===e.typeArguments.length&&(e=(0,R.specializeTupleClass)(e,[e.typeArguments[0],N.AnyType.create(!0)])),a=e):a||(0,N.isUnknown)(e)||(a=e))}a?(0,N.isClassInstance)(a)&&(0,R.isTupleClass)(a)&&!a.tupleTypeArguments&&(a=function(e,t){let n=e;return t&&(0,N.isClassInstance)(t)&&(0,R.isTupleClass)(t)&&t.tupleTypeArguments&&(n=(0,R.specializeTupleClass)(e,t.tupleTypeArguments)),n}(a,s)):a=It(n,s,c),o=!0}}}if(o||t.forEach((e=>{e.valueExpression&&!B.isSpeculative(e.valueExpression)&&Te(e.valueExpression)})),!o&&t.length>0&&(n.details.effectiveMetaclass&&(0,N.isInstantiableClass)(n.details.effectiveMetaclass)&&!N.ClassType.isBuiltIn(n.details.effectiveMetaclass)||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.constructorNoArgs().format({type:n.aliasName||n.details.name}),e)),!a){const t=new M.TypeVarMap((0,R.getTypeVarScopeId)(n));s&&Ct(n,s,t,st(e)),a=It(n,s,t)}return{argumentErrors:l,returnType:a}}function bt(e,t,n){const i=(0,R.applySolvedTypeVars)(N.ClassType.cloneAsInstance(e),n,!0);if(ii(t,i))return(0,N.isAny)(t)?t:i}function It(e,t,n){if(t){const i=(0,R.mapSubtypes)(t,(t=>bt(e,t,n)));if(!(0,N.isNever)(i))return i}const i=(0,R.applySolvedTypeVars)(e,n,!0);return N.ClassType.cloneAsInstance(i)}function Ct(e,t,n,i){if((0,N.isAny)(t))return e.details.typeParameters.forEach((e=>{n.setTypeVarType(e,t)})),!0;if(!(0,N.isClassInstance)(t))return!1;const s=t.typeArguments;if(!s)return ii(e,N.ClassType.cloneAsInstantiable(t),void 0,n);if(N.ClassType.isSameGenericClass(t,e)){const e=(0,R.buildTypeVarMapFromSpecializedClass)(t);return e.getTypeVars().forEach((t=>{const i=e.getTypeVarType(t.typeVar);n.setTypeVarType(t.typeVar,1===t.typeVar.details.variance?void 0:i,2===t.typeVar.details.variance?void 0:i,t.retainLiteral)})),!0}const r=(0,R.getTypeVarScopeId)(t),a=N.ClassType.getTypeParameters(t).map(((e,t)=>{const n=N.TypeVarType.createInstance(`__dest${t}`);return n.details.isSynthesized=!0,n.details.variance=e.details.variance,n.scopeId=r,n})),o=N.ClassType.cloneForSpecialization(N.ClassType.cloneAsInstantiable(t),a,!0),l=N.ClassType.getTypeParameters(e).map(((e,t)=>{const n=N.TypeVarType.createInstance(`__source${t}`);return n.details.isSynthesized=!0,n.details.synthesizedIndex=t,n})),c=N.ClassType.cloneForSpecialization(e,l,!0),p=new M.TypeVarMap(r);return!!ii(o,c,void 0,p)&&(a.forEach(((e,t)=>{const r=p.getTypeVarType(e);if(r&&(0,N.isTypeVar)(r)&&r.details.isSynthesized&&void 0!==r.details.synthesizedIndex){const a=N.ClassType.getTypeParameters(c)[r.details.synthesizedIndex];if(t<s.length){const r=(0,R.transformExpectedTypeForConstructor)(s[t],n,i);r&&n.setTypeVarType(a,1===e.details.variance?void 0:r,2===e.details.variance?void 0:r)}}})),!0)}function St(e,t,n,i,s=!1,r,a=0){let d=!1,h=!1;if(a>N.maxTypeRecursionCount)return{returnType:N.UnknownType.create(),argumentErrors:!0};if(N.TypeBase.isSpecialForm(n)){const t=9===e.nodeType?e.leftExpression:e;return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotCallable().format({expression:C.printExpression(t),type:yi(n,!0)}),t),{returnType:N.UnknownType.create(),argumentErrors:!0}}const y=Ye(n,void 0,((n,y)=>{var g;switch(n.category){case 1:case 2:return t.forEach((e=>{e.valueExpression&&!B.isSpeculative(e.valueExpression)&&An(e)})),n;case 5:{if("namedtuple"===n.details.builtInName)return $e(f.getFileInfo(e).diagnosticRuleSet.reportUntypedNamedTuple,c.DiagnosticRule.reportUntypedNamedTuple,m.Localizer.Diagnostic.namedTupleNoTypes(),e),(0,I.createNamedTupleType)(gi,e,t,!1);let a=i;a||(a=new M.TypeVarMap((0,R.getTypeVarScopeId)(n)),!a.getSolveForScopes()&&N.FunctionType.isConstructorMethod(n)&&a.addSolveForScope(N.WildcardTypeVarScopeId));const o=Pt(e,t,n,a,s,r);return o.argumentErrors&&(d=!0),o.isTypeIncomplete&&(h=!0),o.argumentErrors||"NewType"!==n.details.builtInName?"__import__"===n.details.builtInName?N.AnyType.create():o.returnType:kt(e,t)}case 6:{const a="cast"===n.overloads[0].details.builtInName&&2===t.length;a&&kn(t[0]);const o=function(e,t,n,i,s,r){const a=[],o=[];let p=[];if(On(e,(()=>{n.overloads.forEach((n=>{if(N.FunctionType.isOverloaded(n)){const i=Ft(e,t,n);i.argumentErrors||(a.push(n),o.push(i))}})),p=t.map((e=>e.type?e.type:e.valueExpression?Te(e.valueExpression).type:N.AnyType.create()))})),0===o.length){if(!je(e)){const i=n.overloads[0].details.name||"<anonymous function>",s=new l.DiagnosticAddendum,r=t.map((e=>yi(An(e).type)));s.addMessage(m.Localizer.DiagnosticAddendum.argumentTypes().format({types:r.join(", ")})),$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.noOverload().format({name:i})+s.getString(),e)}return{argumentErrors:!0,isTypeIncomplete:!1}}const d=t=>{const n=a[a.length-1],s=o[a.length-1],l=null!=i?i:new M.TypeVarMap;return l.addSolveForScope((0,R.getTypeVarScopeId)(n)),l.unlock(),Dt(e,s,n,l,t,r)};if(1===o.length)return d(!1);let u=[t.map((e=>{}))],h=!1;for(;;){const t=Tt(e,u,a,o,i,s,r);if(t.isTypeIncomplete&&(h=!0),!t.argumentErrors)return t;if(u=_t(p,u),!u||u.length>64)break}if(!je(e)&&!h){const e=d(!0);return e.returnType=N.UnknownType.create(),e}return{argumentErrors:!0,isTypeIncomplete:!1}}(e,t,n,i,s,r);if(o.argumentErrors&&(d=!0),o.isTypeIncomplete&&(h=!0),a){const n=kn(t[0]).type,i=An(t[1]).type;return(0,N.isInstantiableClass)(n)&&(0,N.isClassInstance)(i)&&(0,N.isTypeSame)(n,N.ClassType.cloneAsInstantiable(i),!0)&&$e(f.getFileInfo(e).diagnosticRuleSet.reportUnnecessaryCast,c.DiagnosticRule.reportUnnecessaryCast,m.Localizer.Diagnostic.unnecessaryCast().format({type:yi(i)}),e),(0,R.convertToInstance)(n)}return o.returnType||N.UnknownType.create()}case 7:if(N.TypeBase.isInstantiable(n)){if(void 0!==n.literalValue)return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.literalNotCallable(),e),d=!0,N.UnknownType.create();if(N.ClassType.isBuiltIn(n)){const i=n.aliasName||n.details.name;if("type"===i){if(vt(e,t,n,s,r),1===t.length){const e=An(t[0]).type;if((0,N.isClassInstance)(e)||(0,N.isTypeVar)(e)&&N.TypeBase.isInstance(e)||(0,N.isNone)(e))return(0,R.convertToInstantiable)((0,R.stripLiteralValue)(e))}else if(t.length>=2)return function(e,t){const n=f.getFileInfo(e),i=An(t[0]).type;if(!(0,N.isClassInstance)(i)||!N.ClassType.isBuiltIn(i,"str"))return;const s=i.literalValue||"_",r=An(t[1]).type;if(!(0,N.isClassInstance)(r)||!(0,R.isTupleClass)(r)||void 0===r.tupleTypeArguments)return;const a=N.ClassType.createInstantiable(s,C.getClassFullName(e,n.moduleName,s),n.moduleName,n.filePath,0,C.getTypeSourceId(e),void 0,r.details.effectiveMetaclass);return r.tupleTypeArguments.forEach((n=>{(0,N.isInstantiableClass)(n)||(0,N.isAnyOrUnknown)(n)?a.details.baseClasses.push(n):Ge(n,t[1].valueExpression||e)})),(0,R.computeMroLinearization)(a)||Be(m.Localizer.Diagnostic.methodOrdering(),e),a}(e,t)||N.AnyType.create();return N.AnyType.create()}if("TypeVar"===i)return function(e,t){var n;let i,s="";if(0===t.length)return void Be(m.Localizer.Diagnostic.typeVarFirstArg(),e);const r=t[0];r.valueExpression&&48===r.valueExpression.nodeType?s=r.valueExpression.strings.map((e=>e.value)).join(""):Be(m.Localizer.Diagnostic.typeVarFirstArg(),r.valueExpression||e);const a=N.TypeVarType.createInstantiable(s,!1);for(let s=1;s<t.length;s++){const r=t[s].name,o=r?r.value:void 0,l=new Map;if(o){if(l.get(o)&&Be(m.Localizer.Diagnostic.duplicateParam().format({name:o}),t[s].valueExpression||e),"bound"===o)if(a.details.constraints.length>0)Be(m.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[s].valueExpression||e);else{const n=kn(t[s]).type;(0,R.requiresSpecialization)(n,!0)&&Be(m.Localizer.Diagnostic.typeVarGeneric(),t[s].valueExpression||e),a.details.boundType=(0,R.convertToInstance)(n)}else"covariant"===o?t[s].valueExpression&&At(t[s].valueExpression)&&(2===a.details.variance?Be(m.Localizer.Diagnostic.typeVarVariance(),t[s].valueExpression):a.details.variance=1):"contravariant"===o?t[s].valueExpression&&At(t[s].valueExpression)&&(1===a.details.variance?Be(m.Localizer.Diagnostic.typeVarVariance(),t[s].valueExpression):a.details.variance=2):Be(m.Localizer.Diagnostic.typeVarUnknownParam().format({name:o}),(null===(n=t[s].node)||void 0===n?void 0:n.name)||t[s].valueExpression||e);l.set(o,o)}else if(a.details.boundType)Be(m.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[s].valueExpression||e);else{const n=kn(t[s]).type;(0,R.requiresSpecialization)(n,!0)&&Be(m.Localizer.Diagnostic.typeVarGeneric(),t[s].valueExpression||e),N.TypeVarType.addConstraint(a,(0,R.convertToInstance)(n)),void 0===i&&(i=t[s])}}return 1===a.details.constraints.length&&i&&$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeVarSingleConstraint(),i.valueExpression||e),a}(e,t);if("TypeVarTuple"===i)return function(e,t){var n,i;let s="";if(0===t.length)return void Be(m.Localizer.Diagnostic.typeVarFirstArg(),e);const r=t[0];r.valueExpression&&48===r.valueExpression.nodeType?s=r.valueExpression.strings.map((e=>e.value)).join(""):Be(m.Localizer.Diagnostic.typeVarFirstArg(),r.valueExpression||e);const a=N.TypeVarType.createInstantiable(s,!1);a.details.isVariadic=!0;for(let s=1;s<t.length;s++)Be(m.Localizer.Diagnostic.typeVarUnknownParam().format({name:(null===(n=t[s].name)||void 0===n?void 0:n.value)||"?"}),(null===(i=t[s].node)||void 0===i?void 0:i.name)||t[s].valueExpression||e);return a}(e,t);if("ParamSpec"===i)return function(e,t){var n,i;if(0===t.length)return void Be(m.Localizer.Diagnostic.paramSpecFirstArg(),e);const s=t[0];let r="";s.valueExpression&&48===s.valueExpression.nodeType?r=s.valueExpression.strings.map((e=>e.value)).join(""):Be(m.Localizer.Diagnostic.paramSpecFirstArg(),s.valueExpression||e);const a=N.TypeVarType.createInstantiable(r,!0);for(let s=1;s<t.length;s++){if(!(null===(n=t[s].name)||void 0===n?void 0:n.value)){Be(m.Localizer.Diagnostic.paramSpecUnknownArg(),t[s].valueExpression||e);break}Be(m.Localizer.Diagnostic.paramSpecUnknownParam().format({name:t[s].name.value}),(null===(i=t[s].node)||void 0===i?void 0:i.name)||t[s].valueExpression||e)}return a}(e,t);if("NamedTuple"===i)return(0,I.createNamedTupleType)(gi,e,t,!0);if("NewType"===i)return kt(e,t);if("Protocol"===i||"Generic"===i||"Callable"===i||"Concatenate"===i||"Type"===i)return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotIntantiable().format({type:i}),e),N.AnyType.create();if("Enum"===i||"IntEnum"===i||"Flag"===i||"IntFlag"===i)return function(e,t,n){const i=f.getFileInfo(e);let s="enum";if(0===n.length)return;{const e=n[0];if(0!==e.argumentCategory||!e.valueExpression||48!==e.valueExpression.nodeType)return;s=e.valueExpression.strings.map((e=>e.value)).join("")}const r=N.ClassType.createInstantiable(s,C.getClassFullName(e,i.moduleName,s),i.moduleName,i.filePath,1048576,C.getTypeSourceId(e),void 0,t.details.effectiveMetaclass);r.details.baseClasses.push(t),(0,R.computeMroLinearization)(r);const a=r.details.fields;if(a.set("__class__",P.Symbol.createWithType(68,r)),!(n.length<2)){{const t=n[1];if(0!==t.argumentCategory||!t.valueExpression||48!==t.valueExpression.nodeType)return;t.valueExpression.strings.map((e=>e.value)).join("").split(" ").forEach((n=>{if(n=n.trim()){const i=N.UnknownType.create(),s=P.Symbol.createWithType(4,i),r=t.valueExpression;(0,o.assert)(48===r.nodeType);const l=f.getFileInfo(e),c={type:1,node:r,path:l.filePath,range:(0,p.convertOffsetsToRange)(r.start,u.TextRange.getEnd(r),l.lines),moduleName:l.moduleName};s.addDeclaration(c),a.set(n,s)}}))}return r}}(e,n,t);if("TypedDict"===i)return(0,E.createTypedDictType)(gi,e,n,t);if("auto"===i&&0===t.length)return Nn(e,"int")}if(N.ClassType.supportsAbstractMethods(n)){const t=di(n);if(t.length>0&&!n.includeSubclasses&&!(0,N.isTypeVar)(y)){const i=new l.DiagnosticAddendum,s=2;t.forEach(((e,n)=>{if(n===s)i.addMessage(m.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:t.length-s}));else if(n<s&&(0,N.isInstantiableClass)(e.classType)){const t=e.classType.details.name;i.addMessage(m.Localizer.DiagnosticAddendum.memberIsAbstract().format({type:t,name:e.symbolName}))}})),$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.instantiateAbstract().format({type:n.details.name})+i.getString(),e)}}N.ClassType.isProtocolClass(n)&&!n.includeSubclasses&&$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.instantiateProtocol().format({type:n.details.name}),e);const i=vt(e,t,n,s,r);i.argumentErrors&&(d=!0);let a=i.returnType;if((0,N.isTypeVar)(y)&&(a=(0,R.convertToInstance)(y)),a&&(0,N.isClassInstance)(a)&&a.details.mro.some((e=>(0,N.isInstantiableClass)(e)&&N.ClassType.isBuiltIn(e,"type")))){const t="__class_"+a.details.name,n=N.ClassType.createInstantiable(t,"","",f.getFileInfo(e).filePath,0,C.getTypeSourceId(e),N.ClassType.cloneAsInstantiable(a),N.ClassType.cloneAsInstantiable(a));return n.details.baseClasses.push(wn(e,"object")),(0,R.computeMroLinearization)(n),n}return a}{let o=null===(g=De(e,n,"__call__"))||void 0===g?void 0:g.type;if(o&&((0,N.isFunction)(o)||(0,N.isOverloadedFunction)(o))){o=(0,R.removeParamSpecVariadicsFromSignature)(o);const n=St(e,t,o,i,s,r,a+1);return n.argumentErrors&&(d=!0),n.returnType||N.UnknownType.create()}return o&&(0,N.isAnyOrUnknown)(o)||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.objectNotCallable().format({type:yi(n)}),e),N.UnknownType.create()}case 3:return void $e(f.getFileInfo(e).diagnosticRuleSet.reportOptionalCall,c.DiagnosticRule.reportOptionalCall,m.Localizer.Diagnostic.noneNotCallable(),e);case 10:{n=(0,R.transformPossibleRecursiveTypeAlias)(n);const o=St(e,t,n,i,s,r,a+1);return o.argumentErrors&&(d=!0),o.returnType||N.UnknownType.create()}}}));return{argumentErrors:d,returnType:(0,N.isNever)(y)?void 0:y,isTypeIncomplete:h}}function Ft(e,t,n){let i=0;const s=n.details.parameters,r=s.find((e=>2===e.category));let a=!1,p=s.findIndex((e=>0===e.category&&!e.name));const d=new Map;s.forEach(((e,t)=>{e.name&&0===e.category&&d.set(e.name,{argsNeeded:0!==e.category||e.hasDefault?0:1,argsReceived:0,isPositionalOnly:p>=0&&t<p})}));let u=s.findIndex((e=>1===e.category&&!e.name));const h=s.findIndex((e=>1===e.category)),y=s.findIndex((e=>2===e.category));let g,T;u<0&&(u=h,u>=0&&u++),u<0&&(u=y);let _=!1;if(h>=0&&y>=0){const e=s[h],t=s[y];(0,N.isParamSpec)(e.type)&&"args"===e.type.paramSpecAccess&&(0,N.isParamSpec)(t.type)&&"kwargs"===t.type.paramSpecAccess&&e.type.details.name===t.type.details.name&&(_=!0,e.type.scopeId===n.details.typeVarScopeId?(g=[],T=N.TypeVarType.cloneForParamSpecAccess(e.type,void 0)):p=h)}t.forEach((e=>{if(e.name){const t=s.findIndex((t=>t.name===e.name.value&&0===t.category));t>=0&&t>p&&(u<0||t<u)&&(u=t)}})),u<0&&(u=s.length);let v=t.findIndex((e=>2===e.argumentCategory||void 0!==e.name));v<0&&(v=t.length);let b,I=[];function C(e,t){e.active&&(b=t)}let S=void 0!==t.find((e=>1===e.argumentCategory)),F=0,D=0,P=0;for(;i<v;){if(F===p){F++;continue}if(i<p&&t[i].name&&($e(f.getFileInfo(t[i].name).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.argPositional(),t[i].name),a=!0),F>=u){S&&1===t[i].argumentCategory||($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===u?m.Localizer.Diagnostic.argPositionalExpectedOne():m.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:u}),t[i].valueExpression||e),a=!0);break}const r=N.FunctionType.getEffectiveParameterType(n,F);if(1===t[i].argumentCategory){if(!t[i].valueExpression)break;const o=1===s[F].category&&(0,N.isVariadicTypeVar)(r);let l=!1;const p=An(t[i]).type;let h,y=!1;n.details.paramSpec&&F<u&&($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===u?m.Localizer.Diagnostic.argPositionalExpectedOne():m.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:u}),t[i].valueExpression||e),a=!0);const T=(0,R.combineSameSizedTuples)(He(p),Q);!o&&T&&(0,N.isClassInstance)(T)&&T.tupleTypeArguments&&T.tupleTypeArguments.length>0?(h=T.tupleTypeArguments[D],S=void 0!==t.find(((e,t)=>t>i&&1===e.argumentCategory)),D++,D>=T.tupleTypeArguments.length&&(D=0,y=!0)):o&&(0,N.isVariadicTypeVar)(p)?(h=p,l=!0):h=(0,N.isParamSpec)(p)&&"args"===p.paramSpecAccess?void 0:Ne(p,!1,t[i].valueExpression)||N.UnknownType.create();const _=h?{argumentCategory:0,type:h}:void 0,v=s[F].name;o&&!l?($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.unpackedArgWithVariadicParam(),t[i].valueExpression||e),a=!0):(g&&g.push(t[i]),_&&I.push({paramCategory:s[F].category,paramType:r,requiresTypeVarMatching:(0,R.requiresSpecialization)(r),argument:_,errorNode:t[i].valueExpression||e,paramName:s[F].isNameSynthesized?void 0:v})),C(t[i],s[F]),v&&0===s[F].category&&d.has(v)&&d.get(v).argsReceived++,(y||1===s[F].category)&&i++,1!==s[F].category&&F++}else if(1===s[F].category){if(C(t[i],s[F]),g)g.push(t[i]);else{let n=s[F].category,o=r;const l=s[F].name;if((0,N.isVariadicTypeVar)(s[F].type)&&(0,N.isClassInstance)(r)&&(0,R.isTupleClass)(r)&&r.tupleTypeArguments&&P<r.tupleTypeArguments.length){o=r.tupleTypeArguments[P],n=(0,N.isVariadicTypeVar)(o)?1:0,P++;const s=v-i-1,l=r.tupleTypeArguments.length-P;P>=r.tupleTypeArguments.length?F++:l>0&&s<=0&&($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===l?m.Localizer.Diagnostic.argMorePositionalExpectedOne():m.Localizer.Diagnostic.argMorePositionalExpectedCount().format({expected:l}),t[i].valueExpression||e),a=!0)}I.push({paramCategory:n,paramType:o,requiresTypeVarMatching:(0,R.requiresSpecialization)(r),argument:t[i],errorNode:t[i].valueExpression||e,paramName:l,mapsToVarArgList:!0})}i++}else{const n=s[F].name;I.push({paramCategory:s[F].category,paramType:r,requiresTypeVarMatching:(0,R.requiresSpecialization)(r),argument:t[i],errorNode:t[i].valueExpression||e,paramName:s[F].isNameSynthesized?void 0:n}),C(t[i],s[F]),n&&d.has(n)&&d.get(n).argsReceived++,i++,F++}}if(p>=0&&F<p&&(!S||_)){const n=s.findIndex((e=>e.hasDefault)),i=(n>=0&&n<p?n:p)-v;i>0&&($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===i?m.Localizer.Diagnostic.argMorePositionalExpectedOne():m.Localizer.Diagnostic.argMorePositionalExpectedCount().format({expected:i}),t.length>v&&t[v].valueExpression||e),a=!0)}if(!a){let T;for(;i<t.length;){if(2===t[i].argumentCategory){const p=An(t[i]).type;if((0,N.isAnyOrUnknown)(p))T=p;else if((0,N.isClassInstance)(p)&&N.ClassType.isTypedDictClass(p)){const u=(0,E.getTypedDictMembersForClass)(gi,p),h=new l.DiagnosticAddendum;u.forEach(((a,l)=>{const c=d.get(l);if(c&&!c.isPositionalOnly)if(c.argsReceived>0)h.addMessage(m.Localizer.Diagnostic.paramAlreadyAssigned().format({name:l}));else{c.argsReceived++;const r=s.findIndex((e=>e.name===l));(0,o.assert)(r>=0);const p=N.FunctionType.getEffectiveParameterType(n,r);I.push({paramCategory:0,paramType:p,requiresTypeVarMatching:(0,R.requiresSpecialization)(p),argument:{argumentCategory:0,type:a.valueType},errorNode:t[i].valueExpression||e,paramName:l})}else if(r){(0,o.assert)(y>=0);const s=N.FunctionType.getEffectiveParameterType(n,y);I.push({paramCategory:2,paramType:s,requiresTypeVarMatching:(0,R.requiresSpecialization)(r.type),argument:{argumentCategory:0,type:a.valueType},errorNode:t[i].valueExpression||e,paramName:l}),d.set(l,{argsNeeded:1,argsReceived:1,isPositionalOnly:!1})}else h.addMessage(m.Localizer.Diagnostic.paramNameMissing().format({name:l}))})),h.isEmpty()||($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.unpackedTypedDictArgument()+h.getString(),t[i].valueExpression||e),a=!0)}else if((0,N.isParamSpec)(p)&&"kwargs"===p.paramSpecAccess)T=N.AnyType.create();else{const n=Me(e,"Mapping"),s=Nn(e,"str");if(n&&(0,N.isInstantiableClass)(n)&&s&&(0,N.isClassInstance)(s)){const r=new M.TypeVarMap((0,R.getTypeVarScopeId)(n));let o=!1;if((0,N.isTypeVar)(p))o=!0;else if(ii(N.ClassType.cloneAsInstance(n),p,void 0,r)){const e=(0,R.applySolvedTypeVars)(n,r).typeArguments;e&&e.length>=2?(ii(s,e[0])&&(o=!0),T=e[1]):(o=!0,T=N.UnknownType.create())}o||($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.unpackedDictArgumentNotMapping(),t[i].valueExpression||e),a=!0)}}g&&g.push(t[i])}else{const l=t[i].name;if(l){const p=l.value,u=d.get(p);if(u&&!u.isPositionalOnly)if(u.argsReceived>0)$e(f.getFileInfo(l).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.paramAlreadyAssigned().format({name:p}),l),a=!0;else{u.argsReceived++;const r=s.findIndex((e=>e.name===p));(0,o.assert)(r>=0);const a=N.FunctionType.getEffectiveParameterType(n,r);I.push({paramCategory:0,paramType:a,requiresTypeVarMatching:(0,R.requiresSpecialization)(a),argument:t[i],errorNode:t[i].valueExpression||e,paramName:p}),C(t[i],s[r])}else if(r){if((0,o.assert)(y>=0),g)g.push(t[i]);else{const s=N.FunctionType.getEffectiveParameterType(n,y);I.push({paramCategory:2,paramType:s,requiresTypeVarMatching:(0,R.requiresSpecialization)(r.type),argument:t[i],errorNode:t[i].valueExpression||e,paramName:p}),d.set(p,{argsNeeded:1,argsReceived:1,isPositionalOnly:!1})}C(t[i],r)}else $e(f.getFileInfo(l).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.paramNameMissing().format({name:l.value}),l),a=!0}else 0===t[i].argumentCategory&&($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===u?m.Localizer.Diagnostic.argPositionalExpectedOne():m.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:u}),t[i].valueExpression||e),a=!0)}i++}if(T&&(!S||h>=0)){const t=S?h+1:p>=0?p+1:0;s.forEach(((i,s)=>{if(s>=t&&0===i.category&&i.name&&!i.hasDefault&&d.has(i.name)&&0===d.get(i.name).argsReceived){const t=N.FunctionType.getEffectiveParameterType(n,s);I.push({paramCategory:0,paramType:t,requiresTypeVarMatching:(0,R.requiresSpecialization)(t),argument:{argumentCategory:0,type:T},errorNode:e,paramName:i.isNameSynthesized?void 0:i.name}),d.get(i.name).argsReceived=1}}))}if(!T&&!N.FunctionType.isDefaultParameterCheckDisabled(n)){const t=[...d.keys()].filter((e=>{const t=d.get(e);return!t||t.argsReceived<t.argsNeeded}));if(t.length>0){const n=t.map((e=>`"${e}"`)).join(", ");$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===t.length?m.Localizer.Diagnostic.argMissingForParam().format({name:n}):m.Localizer.Diagnostic.argMissingForParams().format({names:n}),e),a=!0}s.forEach(((t,n)=>{if(0===t.category&&t.name){const n=d.get(t.name);0===n.argsNeeded&&0===n.argsReceived&&t.defaultType&&!(0,R.isEllipsisType)(t.defaultType)&&(0,R.requiresSpecialization)(t.type)&&I.push({paramCategory:t.category,paramType:t.type,requiresTypeVarMatching:!0,argument:{argumentCategory:0,type:t.defaultType},errorNode:e,paramName:t.isNameSynthesized?void 0:t.name})}}))}}if((!a||!B.isSpeculative(void 0))&&h>=0&&s[h].hasDeclaredType){const t=N.FunctionType.getEffectiveParameterType(n,h),i=I.filter((e=>e.mapsToVarArgList));if((0,N.isTypeVar)(t)&&t.details.isVariadic&&Q&&(0,N.isInstantiableClass)(Q)){const n=i.map((e=>(0,R.stripLiteralValue)(An(e.argument).type))),r={paramCategory:1,paramType:t,requiresTypeVarMatching:!0,argument:{argumentCategory:0,type:N.ClassType.cloneAsInstance((0,R.specializeTupleClass)(Q,n,!0,!0,!0))},errorNode:e,paramName:s[h].name,mapsToVarArgList:!0};I=[...I.filter((e=>!e.mapsToVarArgList)),r]}}return{argumentErrors:a,argParams:I,paramSpecTarget:T,paramSpecArgList:g,activeParam:b}}function Dt(e,t,n,i,s=!1,r){let a=!1,o=!1;const l=(0,R.getTypeCondition)(n);if(n.boundTypeVarScopeId&&(i.addSolveForScope(n.boundTypeVarScopeId),"__init__"===n.details.name&&N.FunctionType.isOverloaded(n)&&n.strippedFirstParamType&&n.boundToType&&(0,N.isClassInstance)(n.strippedFirstParamType)&&(0,N.isClassInstance)(n.boundToType)&&N.ClassType.isSameGenericClass(n.strippedFirstParamType,n.boundToType)&&n.strippedFirstParamType.typeArguments)){const e=n.strippedFirstParamType.details.typeParameters;n.strippedFirstParamType.typeArguments.forEach(((t,n)=>{if(n<e.length){const s=e[n];(0,N.isTypeSame)(s,t,!0)||i.setTypeVarType(e[n],t)}}))}if(r&&!(0,N.isAnyOrUnknown)(r)&&!(0,R.requiresSpecialization)(r)&&n.details.declaredReturnType&&(!(0,N.isUnion)(r)||(0,R.containsLiteralType)(r,!0))){const t=qn(n);let s=r;if((0,N.isClassInstance)(t)&&(0,N.isClassInstance)(r)&&!N.ClassType.isSameGenericClass(t,r)){const n=new M.TypeVarMap((0,R.getTypeVarScopeId)(t));Ct(N.ClassType.cloneAsInstantiable(t),r,n,st(e));const i=N.ClassType.cloneForSpecialization(t,void 0,!1);s=(0,R.applySolvedTypeVars)(i,n)}ii(t,s,void 0,i,132)}["cast","isinstance","issubclass"].some((e=>e===n.details.builtInName))&&(s=!0);const p=t.argParams.filter((e=>e.requiresTypeVarMatching)).length;if(p>0){let r=Math.min(p,2);for(let o=0;o<r;o++)On(e,(()=>{t.argParams.forEach((e=>{if(e.requiresTypeVarMatching){const t=xt(e,i,n.details.name,s,0===o,l);t.isTypeIncomplete&&(a=!0),0===o&&t.skippedOverloadArg&&r++}}))}));i.lock()}t.argParams.forEach((e=>{const t=xt(e,i,n.details.name,s,!1,l);t.isCompatible||(o=!0),t.isTypeIncomplete&&(a=!0)})),t.paramSpecArgList&&t.paramSpecTarget&&(function(e,t,n,i,s){var r;const a=i.getParamSpec(n);if(!a)return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.paramSpecNotBound().format({type:yi(n)}),(null===(r=t[0])||void 0===r?void 0:r.valueExpression)||e),!1;let o=!1;const l=new Map,p=a.parameters;p.forEach((e=>{e.name&&l.set(e.name,e)}));let d=0;if(t.forEach((t=>{if(0===t.argumentCategory){let n;if(t.name){const i=l.get(t.name.value);i?(n=i.type,l.delete(t.name.value)):($e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.paramNameMissing().format({name:t.name.value}),t.valueExpression||e),o=!0)}else{if(d<p.length){const e=p[d];n=e.type,e.name&&l.delete(e.name)}else $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===p.length?m.Localizer.Diagnostic.argPositionalExpectedOne():m.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:p.length}),t.valueExpression||e),o=!0;d++}n&&(xt({paramCategory:0,paramType:n,requiresTypeVarMatching:!1,argument:t,errorNode:t.valueExpression||e},i,"",!1,!1,s)||(o=!0))}else l.clear()})),!o){let t=[...l.keys()];if(t=t.filter((e=>{const t=l.get(e);return 0===t.category&&!t.hasDefault})),t.length>0&&!a.paramSpec){const n=t.map((e=>`"${e}"`)).join(", ");$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,1===t.length?m.Localizer.Diagnostic.argMissingForParam().format({name:n}):m.Localizer.Diagnostic.argMissingForParams().format({names:n}),e),o=!0}}return!o}(e,t.paramSpecArgList,t.paramSpecTarget,i,l)||(o=!0));const d=qn(n,t.argParams);let u=!0,h=e;for(;;){const e=C.getTypeVarScopeNode(h);if(!e)break;const t=it(e);i.hasSolveForScope(t)&&(u=!1),h=e}((0,N.isFunction)(d)||(0,N.isOverloadedFunction)(d))&&(u=!1);let y=(0,R.addConditionToType)((0,R.applySolvedTypeVars)(d,i,!1,!1,u),l);return(0,N.isClassInstance)(y)&&N.ClassType.isBuiltIn(y,"TypeGuard")&&y.typeArguments&&y.typeArguments.length>0&&J&&(0,N.isInstantiableClass)(J)&&(y=N.ClassType.cloneAsInstance(N.ClassType.cloneForTypeGuard(J,y.typeArguments[0]))),(0,N.isFunction)(y)&&!y.details.name&&(y.details={...y.details,typeVarScopeId:N.WildcardTypeVarScopeId}),{argumentErrors:o,returnType:y,isTypeIncomplete:a,activeParam:t.activeParam}}function Pt(e,t,n,i,s=!1,r){const a=Ft(e,t,n);return a.argumentErrors?($.isUndoTrackingEnabled()||t.forEach((e=>{e.valueExpression&&!B.isSpeculative(e.valueExpression)&&Te(e.valueExpression)})),{argumentErrors:!0,activeParam:a.activeParam}):Dt(e,a,n,i,s,r)}function xt(e,t,n,i,s,r){let a,o,p=!1,d=!0;if(e.argument.valueExpression){let n=(0,N.isTypeVar)(e.paramType)?void 0:(0,R.applySolvedTypeVars)(e.paramType,t,!1,!0);if(n&&(0,N.isUnknown)(n)&&(n=void 0),e.argType)a=e.argType;else{const t=Te(e.argument.valueExpression,n);a=t.type,t.isIncomplete&&(p=!0),t.typeErrors&&(d=!1),o=t.expectedTypeDiagAddendum}e.argument&&e.argument.name&&!B.isSpeculative(e.errorNode)&&le(e.argument.name,n||a,p)}else if(e.argType)a=e.argType;else{const t=An(e.argument);a=t.type,t.isIncomplete&&(p=!0)}2===e.paramCategory&&(0,N.isTypeVar)(e.paramType)&&(a=(0,R.stripLiteralValue)(a)),r&&(a=Ye(a,r,(e=>e)));let u=new l.DiagnosticAddendum;if((0,N.isParamSpec)(e.paramType)&&void 0!==e.paramType.paramSpecAccess)return{isCompatible:d,isTypeIncomplete:p};if(s){if((0,N.isOverloadedFunction)(a))return{isCompatible:d,isTypeIncomplete:p,skippedOverloadArg:!0};const t=He(e.paramType);if((0,N.isFunction)(t)||(0,N.isOverloadedFunction)(t)){if((0,N.isInstantiableClass)(a)){const e=ai(a);if(e&&(0,N.isOverloadedFunction)(e))return{isCompatible:d,isTypeIncomplete:p,skippedOverloadArg:!0}}if((0,N.isClassInstance)(a)){const e=(0,R.lookUpObjectMember)(a,"__call__");if(e){const t=Yn(e);if((0,N.isOverloadedFunction)(t))return{isCompatible:d,isTypeIncomplete:p,skippedOverloadArg:!0}}}}}if(!ii(e.paramType,a,u.createAddendum(),t)){if("none"!==f.getFileInfo(e.errorNode).diagnosticRuleSet.reportGeneralTypeIssues&&!je(e.errorNode)){const t=f.getFileInfo(e.errorNode),i=yi(a),s=yi(e.paramType);let r;r=e.paramName?n?m.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:i,paramType:s,functionName:n,paramName:e.paramName}):m.Localizer.Diagnostic.argAssignmentParam().format({argType:i,paramType:s,paramName:e.paramName}):n?m.Localizer.Diagnostic.argAssignmentFunction().format({argType:i,paramType:s,functionName:n}):m.Localizer.Diagnostic.argAssignment().format({argType:i,paramType:s}),o&&(u=o),$e(t.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,r+u.getString(),e.errorNode)}return{isCompatible:!1,isTypeIncomplete:p}}if(!i){const t=(0,N.removeUnbound)(a),i=f.getFileInfo(e.errorNode),s=()=>{const t=new l.DiagnosticAddendum;return e.paramName&&t.addMessage((n?m.Localizer.DiagnosticAddendum.argParamFunction().format({paramName:e.paramName,functionName:n}):m.Localizer.DiagnosticAddendum.argParam().format({paramName:e.paramName}))+t.getString()),t};if("none"!==i.diagnosticRuleSet.reportUnknownArgumentType&&!(0,N.isAny)(e.paramType)&&!p)if((0,N.isUnknown)(t)){const t=s();$e(i.diagnosticRuleSet.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,m.Localizer.Diagnostic.argTypeUnknown()+t.getString(),e.errorNode)}else if((0,R.isPartlyUnknown)(t,!0)){let n=!1;if((0,N.isInstantiableClass)(t)&&(n=!0),(0,R.isPartlyUnknown)(e.paramType)&&(n=!0),!n){const n=s();n.addMessage(m.Localizer.DiagnosticAddendum.argumentType().format({type:yi(t,!0)})),$e(i.diagnosticRuleSet.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,m.Localizer.Diagnostic.argTypePartiallyUnknown()+n.getString(),e.errorNode)}}}return{isCompatible:d,isTypeIncomplete:p}}function At(e){if(11===e.nodeType){if(15===e.constType)return!1;if(33===e.constType)return!0}return Be(m.Localizer.Diagnostic.expectedBoolLiteral(),e),!1}function kt(e,t){const n=f.getFileInfo(e);let i="_";if(t.length>=1){const e=t[0];0===e.argumentCategory&&e.valueExpression&&48===e.valueExpression.nodeType&&(i=e.valueExpression.strings.map((e=>e.value)).join(""))}if(t.length>=2){const s=kn(t[1]).type;if((0,N.isInstantiableClass)(s)){N.ClassType.isProtocolClass(s)?Be(m.Localizer.Diagnostic.newTypeProtocolClass(),t[1].node||e):void 0!==s.literalValue&&Be(m.Localizer.Diagnostic.newTypeLiteral(),t[1].node||e);const r=-4&s.details.flags,a=N.ClassType.createInstantiable(i,C.getClassFullName(e,n.moduleName,i),n.moduleName,n.filePath,r,C.getTypeSourceId(e),void 0,s.details.effectiveMetaclass);a.details.baseClasses.push(s),(0,R.computeMroLinearization)(a);const o=N.FunctionType.createInstance("__init__","","",64);N.FunctionType.addParameter(o,{category:0,name:"self",type:N.ClassType.cloneAsInstance(a),hasDeclaredType:!0}),N.FunctionType.addParameter(o,{category:0,name:"_x",type:N.ClassType.cloneAsInstance(s),hasDeclaredType:!0}),o.details.declaredReturnType=N.NoneType.createInstance(),a.details.fields.set("__init__",P.Symbol.createWithType(4,o));const l=N.FunctionType.createInstance("__new__","","",65);return N.FunctionType.addParameter(l,{category:0,name:"cls",type:a,hasDeclaredType:!0}),N.FunctionType.addDefaultParameters(l),l.details.declaredReturnType=N.ClassType.cloneAsInstance(a),a.details.fields.set("__new__",P.Symbol.createWithType(4,l)),a}(0,N.isAnyOrUnknown)(s)||Be(m.Localizer.Diagnostic.newTypeNotAClass(),t[1].node||e)}}function Et(e){return!(!O[e]||!O[e][2])||!!L[e]}function wt(e,t,n){const i=e.leftExpression;let s=e.rightExpression,r=!1;Et(e.operator)&&7===s.nodeType&&!s.parenthesized&&Et(s.operator)&&(wt(s,t,n),s=s.leftExpression);let a,o=37===e.operator||36===e.operator?t:void 0;26===e.operator&&t&&(0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"list")&&t.typeArguments&&t.typeArguments.length>=1&&31===e.leftExpression.nodeType&&(a=t);const p=Te(i,o||a,n);let u=p.type;o||(37===e.operator||36===e.operator||0===e.operator&&31===e.rightExpression.nodeType)&&(o=u);const h=Te(s,o,n);let y=h.type;if((p.isIncomplete||h.isIncomplete)&&(r=!0),6===e.operator&&!Nt(u,"__or__")&&!Nt(y,"__ror__")){let t=y;if(!(0,N.isNone)(u)&&(0,N.isNone)(y)&&N.TypeBase.isInstance(y)&&(t=N.NoneType.createType()),(0,R.isUnionableType)([u,t])){const i=f.getFileInfo(e);i.isStubFile||0!=(4&n)||i.executionEnvironment.pythonVersion>=d.PythonVersion.V3_10||(0,N.isAnyOrUnknown)(u)||Be(m.Localizer.Diagnostic.unionSyntaxIllegal(),e,e.operatorToken);const s=(0,N.combineTypes)([u,t]);return(0,N.isUnion)(s)&&N.TypeBase.setSpecialForm(s),{type:s,node:e}}}let g=!1;void 0===L[e.operator]&&(12===e.operator||28===e.operator?u=(0,N.removeNoneFromUnion)(u):g=(0,R.isOptionalType)(u),12!==e.operator&&28!==e.operator||(y=(0,N.removeNoneFromUnion)(y)));const T=new l.DiagnosticAddendum;let _=Mt(e.operator,u,y,e,t,T);if(!T.isEmpty()||!_){if(!r){const t=f.getFileInfo(e);g&&1===T.getMessages().length?$e(f.getFileInfo(e).diagnosticRuleSet.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,m.Localizer.Diagnostic.noneOperator().format({operator:C.printOperator(e.operator)}),e.leftExpression):$e(t.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:C.printOperator(e.operator),leftType:yi(u),rightType:yi(y)})+T.getString(),e)}_=N.UnknownType.create()}return{type:_,node:e,isIncomplete:r}}function Nt(e,t){if(!(0,N.isInstantiableClass)(e))return!1;const n=e.details.effectiveMetaclass;if(!n||!(0,N.isInstantiableClass)(n))return!1;if(N.ClassType.isBuiltIn(n,"type"))return!1;const i=(0,R.lookUpClassMember)(n,t);return!(!i||(0,N.isInstantiableClass)(i.classType)&&N.ClassType.isBuiltIn(i.classType,"type"))}function Rt(e,t){const n={1:["__iadd__",0],34:["__isub__",33],27:["__imul__",26],14:["__ifloordiv__",13],11:["__itruediv__",10],25:["__imod__",24],30:["__ipow__",29],23:["__imatmul__",22],4:["__iand__",3],7:["__ior__",6],9:["__ixor__",8],18:["__ilshift__",17],32:["__irshift__",31]};let i;const s=new l.DiagnosticAddendum,r=Te(e.leftExpression),a=r.type,o=Te(e.rightExpression),p=o.type,d=!!o.isIncomplete||!!r.isIncomplete;return(0,N.isNever)(a)||(0,N.isNever)(p)?{node:e,type:N.NeverType.create(),isIncomplete:d}:(i=Ye(a,void 0,((i,r)=>Ye(p,(0,R.getTypeCondition)(i),((a,o)=>{if((0,N.isAnyOrUnknown)(r)||(0,N.isAnyOrUnknown)(o))return(0,N.isUnknown)(r)||(0,N.isUnknown)(o)?N.UnknownType.create():N.AnyType.create();const l=n[e.operator][0];let c=Ot(r,[o],l,e,t);return c||r===i||(c=Ot(i,[o],l,e,t)),c||o===a||(c=Ot(i,[a],l,e,t)),c||(c=Mt(n[e.operator][1],r,o,e,t,s)),c})))),s.isEmpty()&&i&&!(0,N.isNever)(i)||(d||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:C.printOperator(e.operator),leftType:yi(a),rightType:yi(p)})+s.getString(),e),i=N.UnknownType.create()),{node:e,type:i,isIncomplete:d})}function Mt(e,t,n,i,s,r){let a,o=He(t);if((0,N.isNever)(t)||(0,N.isNever)(n))return N.NeverType.create();if(void 0!==L[e]){if(36===e){if(!Ce(o))return t;if(!Ie(o))return n;o=Se(o)}else if(37===e){if(!Ie(o))return t;if(!Ce(o))return n;o=Fe(o)}41===e||42===e?(a=Ye(n,void 0,((t,n)=>Ye(o,(0,R.getTypeCondition)(t),(s=>{if((0,N.isAnyOrUnknown)(s)||(0,N.isAnyOrUnknown)(n))return(0,N.isUnknown)(s)||(0,N.isUnknown)(n)?N.UnknownType.create():N.AnyType.create();let a=Ot(t,[s],"__contains__",i,void 0);if(!a){const e=Ne(t,!1,void 0);e&&ii(e,s)&&(a=Nn(i,"bool"))}return a||r.addMessage(m.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:C.printOperator(e),leftType:yi(s),rightType:yi(t)})),a})))),a&&!(0,N.isNever)(a)&&(a=Nn(i,"bool"))):a=Ye(o,void 0,((t,s)=>Ye(n,(0,R.getTypeCondition)(t),((t,n)=>36===e||37===e?(0,R.removeNoReturnFromUnion)((0,N.combineTypes)([s,n])):Nn(i,"bool")))))}else O[e]&&(a=Ye(t,void 0,((t,a)=>Ye(n,(0,R.getTypeCondition)(t),((n,o)=>{if((0,N.isAnyOrUnknown)(a)||(0,N.isAnyOrUnknown)(o))return(0,N.isUnknown)(a)||(0,N.isUnknown)(o)?N.UnknownType.create():N.AnyType.create();if(0===e&&(0,N.isClassInstance)(t)&&(0,R.isTupleClass)(t)&&t.tupleTypeArguments&&!(0,R.isOpenEndedTupleClass)(t)&&(0,N.isClassInstance)(n)&&(0,R.isTupleClass)(n)&&n.tupleTypeArguments&&!(0,R.isOpenEndedTupleClass)(n)&&Q&&(0,N.isInstantiableClass)(Q))return N.ClassType.cloneAsInstance((0,R.specializeTupleClass)(Q,[...t.tupleTypeArguments,...n.tupleTypeArguments]));const l=O[e][0];let c=Ot(Lt(a),[o],l,i,s);if(c||a===t||(c=Ot(Lt(t),[o],l,i,s)),c||o===n||(c=Ot(Lt(t),[n],l,i,s)),!c){const r=O[e][1];c=Ot(Lt(o),[a],r,i,s),c||o===n||(c=Ot(Lt(n),[a],r,i,s)),c||a===t||(c=Ot(Lt(n),[t],r,i,s))}return c||r.addMessage(m.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:C.printOperator(e),leftType:yi(t),rightType:yi(n)})),c})))));return a&&(0,N.isNever)(a)?void 0:a}function Ot(e,t,n,i,s){let r=!0;const a=e=>{var a,o;let l;const c=He(e);if((0,N.isClassInstance)(c)?l=null===(a=De(i,c,n,void 0,void 0,64,e))||void 0===a?void 0:a.type:(0,N.isInstantiableClass)(c)&&(l=null===(o=Pe(i,c,n,void 0,void 0,96))||void 0===o?void 0:o.type),l){const e=t.map((e=>({argumentCategory:0,type:e})));let n;return On(i,(()=>{n=St(i,e,l,void 0,!0,s)})),n.argumentErrors&&(r=!1),n.returnType}r=!1},o=(0,R.mapSubtypes)(e,(e=>{if((0,N.isAnyOrUnknown)(e))return e;if((0,N.isClassInstance)(e)||(0,N.isInstantiableClass)(e)||(0,N.isTypeVar)(e))return a(e);if((0,N.isNone)(e)){const e=Nn(i,"object");if((0,N.isClassInstance)(e))return a(e)}r=!1}));if(r)return o}function Lt(e){return((0,N.isFunction)(e)||(0,N.isOverloadedFunction)(e))&&H?H:e}function Vt(e,t,n){if(t=(0,R.transformPossibleRecursiveTypeAlias)(t),!(0,N.isClassInstance)(t))return;const i=[],s=[];let r=!1;if(N.ClassType.isTypedDictClass(t)){if(zt(e,i,s,!!t,void 0,void 0,(0,E.getTypedDictMembersForClass)(gi,t),n)&&(r=!0),N.ClassType.isTypedDictClass(t)){const a=(0,E.assignToTypedDict)(gi,t,i,s,n);if(a)return{type:a,node:e,isIncomplete:r}}return}const a=Nn(e,"dict");if(!(0,N.isClassInstance)(a))return;const o=new M.TypeVarMap((0,R.getTypeVarScopeId)(a));if(!Ct(N.ClassType.cloneAsInstantiable(a),t,o,st(e)))return;const l=(0,R.applySolvedTypeVars)(N.ClassType.cloneAsInstantiable(a),o);if(!l.typeArguments||2!==l.typeArguments.length)return;const c=l.typeArguments[0],p=l.typeArguments[1];zt(e,i,s,!!t,c,p,void 0,n)&&(r=!0);const d=(0,N.isClassInstance)(t)&&(N.ClassType.isBuiltIn(t,"dict")||N.ClassType.isBuiltIn(t,"MutableMapping")),u=Wt(c,i,!1),m=Wt(p,s,!d);return u&&m?{type:Nn(e,"dict",[u,m]),node:e,isIncomplete:r}:void 0}function Ut(e,t){let n=t?N.AnyType.create():N.UnknownType.create(),i=t?N.AnyType.create():N.UnknownType.create(),s=[],r=[],a=!1,o=!1;zt(e,s,r,!t,t?N.AnyType.create():void 0,t?N.AnyType.create():void 0)&&(o=!0),s=s.map((e=>(0,R.stripLiteralValue)(e))),r=r.map((e=>(0,R.stripLiteralValue)(e))),n=s.length>0?(0,N.combineTypes)(s):t?N.AnyType.create():N.UnknownType.create(),r.length>0?i=f.getFileInfo(e).diagnosticRuleSet.strictDictionaryInference||t?(0,N.combineTypes)(r):(0,R.areTypesSame)(r,!0)?r[0]:t?N.AnyType.create():N.UnknownType.create():(i=t?N.AnyType.create():N.UnknownType.create(),a=!0);const l=wn(e,"dict");return{type:(0,N.isInstantiableClass)(l)?N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(l,[n,i],!0,void 0,void 0,a)):N.UnknownType.create(),node:e,isIncomplete:o}}function zt(e,t,n,i,s,r,a,o){let l=!1;return e.entries.forEach(((p,d)=>{let u=!0;if(17===p.nodeType){const e=Te(p.keyExpression,s);e.isIncomplete&&(l=!0);let c,m=e.type;if(s){const e=He(s);(0,N.isAnyOrUnknown)(e)||ii(e,m)&&(m=e)}c=a&&(0,N.isClassInstance)(m)&&N.ClassType.isBuiltIn(m,"str")&&(0,R.isLiteralType)(m)&&a.has(m.literalValue)?Te(p.valueExpression,a.get(m.literalValue).valueType):Te(p.valueExpression,r),o&&c.expectedTypeDiagAddendum&&o.addAddendum(c.expectedTypeDiagAddendum);const h=c.type;c.isIncomplete&&(l=!0),(!i||d<64)&&(t.push(m),n.push(h)),u=!1}else if(16===p.nodeType){const s=Te(p.expandExpression);s.isIncomplete&&(l=!0);const r=s.type;if((0,N.isAnyOrUnknown)(r))u=!1;else{const s=Me(e,"Mapping");if(s&&(0,N.isInstantiableClass)(s)){const a=new M.TypeVarMap((0,R.getTypeVarScopeId)(s));if(ii(N.ClassType.cloneAsInstance(s),r,void 0,a)){const e=(0,R.applySolvedTypeVars)(s,a).typeArguments;e&&e.length>=2&&((!i||d<64)&&(t.push(e[0]),n.push(e[1])),u=!1)}else $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.dictUnpackIsNotMapping(),p)}}}else if(32===p.nodeType){const e=$t(p,r,s),a=e.type;if(e.isIncomplete&&(l=!0),(0,N.isClassInstance)(a)&&(0,R.isTupleClass)(a)){const e=a.tupleTypeArguments;e&&2===e.length&&((!i||d<64)&&(t.push(e[0]),n.push(e[1])),u=!1)}}u&&(!i||d<64)&&(t.push(N.UnknownType.create()),n.push(N.UnknownType.create()))})),l}function Bt(e,t){const n=31===e.nodeType?"list":"set";t=(0,R.transformPossibleRecursiveTypeAlias)(t);let i=!1;if(!(0,N.isClassInstance)(t))return;const s=Nn(e,n);if(!(0,N.isClassInstance)(s))return;const r=new M.TypeVarMap((0,R.getTypeVarScopeId)(s));if(!Ct(N.ClassType.cloneAsInstantiable(s),t,r,st(e)))return;const a=(0,R.applySolvedTypeVars)(N.ClassType.cloneAsInstantiable(s),r);if(!a.typeArguments||1!==a.typeArguments.length)return;const o=a.typeArguments[0],l=[];e.entries.forEach((e=>{let t;t=32===e.nodeType?$t(e,o):Te(e,o),l.push(t.type),t.isIncomplete&&(i=!0)}));const c=(0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,n),p=Wt(o,l,!c);return p?{type:Nn(e,n,[p]),node:e,isIncomplete:i}:void 0}function Wt(e,t,n){const i=N.TypeVarType.createInstance("__typeArg");i.details.isSynthesized=!0,i.details.boundType=e,i.scopeId="__typeArgScopeId";let s=new M.TypeVarMap(N.WildcardTypeVarScopeId);if(s.setTypeVarType(i,n?void 0:e,e),!t.some((e=>!ii(i,(0,R.stripLiteralValue)(e),void 0,s)))||(s=new M.TypeVarMap(N.WildcardTypeVarScopeId),s.setTypeVarType(i,n?void 0:e,e,!0),!t.some((e=>!ii(i,e,void 0,s)))))return(0,R.applySolvedTypeVars)(i,s)}function jt(e,t,n,i,s,r){if("none"===e)return;const a=n.value,o=(0,N.removeUnbound)(i);if((0,N.isUnknown)(o))$e(e,t,m.Localizer.Diagnostic.typeUnknown().format({name:a}),s);else if((0,R.isPartlyUnknown)(o)&&(!r||!(0,N.isClassInstance)(i)||!i.isEmptyContainer)){const n=new l.DiagnosticAddendum;n.addMessage(m.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:a,type:yi(o,!0)})),$e(e,t,m.Localizer.Diagnostic.typePartiallyUnknown().format({name:a})+n.getString(),s)}}function $t(e,t,n){let i=!1;for(const t of e.comprehensions)if(33===t.nodeType){const e=Te(t.iterableExpression);e.isIncomplete&&(i=!0);const n=Ne((0,R.stripLiteralValue)(e.type),!!t.isAsync,t.iterableExpression)||N.UnknownType.create();Ze(t.targetExpression,n,!!e.isIncomplete,t.iterableExpression)}else(0,o.assert)(34===t.nodeType),B.isSpeculative(t.testExpression)||Te(t.testExpression);let s=N.UnknownType.create();if(17===e.expression.nodeType){const r=Te(e.expression.keyExpression,n);r.isIncomplete&&(i=!0);let a=r.type;n&&(0,R.containsLiteralType)(n)||(a=(0,R.stripLiteralValue)(a));const o=Te(e.expression.valueExpression,t);o.isIncomplete&&(i=!0);let l=o.type;t&&(0,R.containsLiteralType)(t)||(l=(0,R.stripLiteralValue)(l)),s=dt([a,l])}else if(16===e.expression.nodeType)Te(e.expression.expandExpression,t);else if((0,h.isExpressionNode)(e)){const n=Te(e.expression,t);n.isIncomplete&&(i=!0),s=n.type}return{type:s,node:e,isIncomplete:i}}function Gt(e,t=!1,n=!1,i=!1,s=!1){if(e.typeList){if(!s)return Be(m.Localizer.Diagnostic.typeArgListNotAllowed(),e.node),!1;e.typeList.forEach((e=>{Gt(e)}))}if((0,R.isEllipsisType)(e.type)&&!s)return Be(m.Localizer.Diagnostic.ellipsisContext(),e.node),!1;if((0,N.isModule)(e.type))return Be(m.Localizer.Diagnostic.moduleAsType(),e.node),!1;if((0,N.isParamSpec)(e.type)&&!i)return Be(m.Localizer.Diagnostic.paramSpecContext(),e.node),!1;if((0,N.isVariadicTypeVar)(e.type)&&!e.type.isVariadicInUnion){if(!n)return Be(m.Localizer.Diagnostic.typeVarTupleContext(),e.node),!1;ct(e.type,e.node)}return!(!t&&e.isEmptyTupleShorthand&&(Be(m.Localizer.Diagnostic.zeroLengthTupleNotAllowed(),e.node),1))}function qt(e,t,n){const i=Nn(e,t);return(0,N.isClassInstance)(i)?N.ClassType.cloneWithLiteral(i,n):N.UnknownType.create()}function Kt(e,t,n){const i=wn(e,t);return(0,N.isInstantiableClass)(i)?N.ClassType.cloneWithLiteral(i,n):N.UnknownType.create()}function Ht(e,t,n,i=!1,s=!1){const r=N.ClassType.isTupleClass(e);if(t)if(r&&1===t.length&&t[0].isEmptyTupleShorthand)t=[];else{let e=!1,s=!1;t.forEach(((a,o)=>{(0,R.isEllipsisType)(a.type)?r?2!==t.length||1!==o?Be(m.Localizer.Diagnostic.ellipsisSecondArg(),a.node):(0,N.isTypeVar)(t[0].type)&&(0,N.isVariadicTypeVar)(t[0].type)&&!t[0].type.isVariadicInUnion&&Be(m.Localizer.Diagnostic.typeVarTupleContext(),t[0].node):Be(m.Localizer.Diagnostic.ellipsisContext(),a.node):(0,N.isParamSpec)(a.type)&&i||((0,N.isVariadicTypeVar)(a.type)&&void 0===n?(e&&(s||(Be(m.Localizer.Diagnostic.variadicTypeArgsTooMany(),a.node),s=!0)),ct(a.type,a.node),e=!0):Gt(a))}))}let a,o=t?t.map((e=>(0,R.convertToInstance)(e.type))):[];if(void 0!==n)if(t&&o.length>n)Be(m.Localizer.Diagnostic.typeArgsTooMany().format({name:e.aliasName||e.details.name,expected:n,received:o.length}),t[n].node),o=o.slice(0,n);else if(o.length<n)for(;o.length<n;)o.push(N.UnknownType.create());return r?(t||(o.push(N.UnknownType.create()),o.push(N.AnyType.create(!0))),a=(0,R.specializeTupleClass)(e,o,void 0!==t,!1)):a=N.ClassType.cloneForSpecialization(e,o,void 0!==t),s||N.TypeBase.setSpecialForm(a),a}function Yt(e,t){var n,i,s,r;const a=C.getEnclosingClass(e,!0);if(a){const o=en(a);if(o&&N.ClassType.isEnumClass(o.classType)){let a=3===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&e.parent.leftExpression===e||54===(null===(i=e.parent)||void 0===i?void 0:i.nodeType)&&e.parent.valueExpression===e&&3===(null===(s=e.parent.parent)||void 0===s?void 0:s.nodeType)||f.getFileInfo(e).isStubFile&&54===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&e.parent.valueExpression===e;(0,x.isSingleDunderName)(e.value)&&(a=!1),"name"!==e.value&&"value"!==e.value||(a=!1);const l=t();if((0,N.isClassInstance)(l)&&l.details.fields.get("__get__")&&(a=!1),a)return N.ClassType.cloneAsInstance(N.ClassType.cloneWithLiteral(o.classType,new N.EnumLiteral(o.classType.details.name,e.value,l)))}}}function Zt(e,t,n){if(!N.TypeBase.isInstantiable(e))return e;if((0,R.isTypeAliasPlaceholder)(e))return e;let i=[];(0,N.isTypeVar)(e)&&!N.TypeBase.isAnnotated(e)||(0,R.doForEachSubtype)(e,(e=>{(0,R.addTypeVarsToListIfUnique)(i,(0,R.getTypeVarArgumentsRecursive)(e))})),i=i.filter((e=>!e.details.isSynthesized)),i=i.map((e=>N.TypeBase.isInstance(e)?e:(0,R.convertToInstance)(e)));const s=i.filter((e=>(0,N.isVariadicTypeVar)(e)));s.length>1&&Be(m.Localizer.Diagnostic.variadicTypeParamTooManyAlias().format({names:s.map((e=>`"${e.details.name}"`)).join(", ")}),n);const r=f.getFileInfo(t),a=it(t),o=i.filter((e=>e.scopeId!==a&&0===e.scopeType));return o.length>0&&Be(m.Localizer.Diagnostic.genericTypeAliasBoundTypeVar().format({names:o.map((e=>`${e.details.name}`)).join(", ")}),n),N.TypeBase.cloneForTypeAlias(e,t.value,`${r.moduleName}.${t.value}`,a,i.length>0?i:void 0)}function Qt(t,n,i){const s=f.getFileInfo(t);let r=N.ClassType.createInstantiable(n,C.getClassFullName(t,s.moduleName,n),s.moduleName,s.filePath,3,0,void 0,void 0);s.isTypingExtensionsStubFile&&(r.details.flags|=65536);const a=i.alias||"object";let o;if("builtins"===i.module)o=wn(t,a);else if("collections"===i.module){if(s.collectionsModulePath){const t=e(s.collectionsModulePath);if(t){const e=t.symbolTable.get(a);e&&(o=Wn(e))}}}else if("self"===i.module){const e=Rn(t,a,!1);e&&(o=Wn(e.symbol),(0,N.isInstantiableClass)(o)&&N.ClassType.isBuiltIn(o,"_TypedDict")&&(o.details.flags&=-513))}return o&&(0,N.isInstantiableClass)(o)?i.alias?r=N.ClassType.cloneForTypingAlias(o,n):(r.details.baseClasses.push(o),r.details.effectiveMetaclass=o.details.effectiveMetaclass,(0,R.computeMroLinearization)(r)):(r.details.baseClasses.push(N.UnknownType.create()),r.details.effectiveMetaclass=N.UnknownType.create(),(0,R.computeMroLinearization)(r)),r}function Jt(e){var t;const n=f.getFileInfo(e);if(oe(e))return;let i,s=oe(e.rightExpression),r=!1;if(!s&&((n.isTypingStubFile||n.isTypingExtensionsStubFile)&&(s=function(e){if(38!==e.leftExpression.nodeType)return;const t=e.leftExpression.value;if("Any"===t)return N.AnyType.create();const n=new Map([["overload",{alias:"",module:"builtins"}],["TypeVar",{alias:"",module:"builtins"}],["_promote",{alias:"",module:"builtins"}],["no_type_check",{alias:"",module:"builtins"}],["NoReturn",{alias:"",module:"builtins"}],["Counter",{alias:"Counter",module:"collections"}],["List",{alias:"list",module:"builtins"}],["Dict",{alias:"dict",module:"builtins"}],["DefaultDict",{alias:"defaultdict",module:"collections"}],["Set",{alias:"set",module:"builtins"}],["FrozenSet",{alias:"frozenset",module:"builtins"}],["Deque",{alias:"deque",module:"collections"}],["ChainMap",{alias:"ChainMap",module:"collections"}],["OrderedDict",{alias:"OrderedDict",module:"collections"}]]).get(t);return n?(Te(e.rightExpression),Qt(e,t,n)):void 0}(e),s&&le(e.rightExpression,s,!1)),!s)){const a=Ee(e.leftExpression,{method:"set"});let o,l=2;n.isStubFile&&(l|=256);let p,d=!1;if(ke(e.leftExpression))l|=232,o=e.leftExpression.valueExpression;else if(38===e.leftExpression.nodeType){const t=Rn(e.leftExpression,e.leftExpression.value,!1);if(t){const n=t.symbol.getDeclarations();1===n.length&&(0,b.isPossibleTypeAliasDeclaration)(n[0])&&(o=e.leftExpression,d=!0)}}if(o){p=N.TypeVarType.createInstantiable(`__type_alias_${o.value}`),p.details.isSynthesized=!0,p.details.recursiveTypeAliasName=o.value;const t=it(o);p.details.recursiveTypeAliasScopeId=t,p.scopeId=t,le(e,p,!1),le(e.leftExpression,p,!1),54===e.leftExpression.nodeType&&le(e.leftExpression.valueExpression,p,!1)}const u=Te(e.rightExpression,a,l);let h=u.type;i=u.expectedTypeDiagAddendum,u.isIncomplete&&(r=!0);const y=(0,D.evaluateStaticBoolExpression)(e.rightExpression,n.executionEnvironment);if(void 0!==y){const t=Nn(e,"bool");(0,N.isClassInstance)(t)&&(h=N.ClassType.cloneWithLiteral(t,y))}a&&ii(a,h)&&((0,N.isAnyOrUnknown)(h)||(h=pi(a,h))),s=h,38!==e.leftExpression.nodeType||e.typeAnnotationComment||(s=Yt(e.leftExpression,(()=>s))||s),o&&(ce(e),ce(e.leftExpression),54===e.leftExpression.nodeType&&ce(e.leftExpression.valueExpression),(!d||N.TypeBase.isInstantiable(s)&&!(0,N.isUnknown)(s))&&(s=Zt(s,o,e.rightExpression),(0,R.isTypeAliasRecursive)(p,s)&&$e(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeAliasIsRecursiveDirect().format({name:o.value}),e.rightExpression),p.details.boundType=s,p.details.recursiveTypeParameters=null===(t=s.typeAliasInfo)||void 0===t?void 0:t.typeParameters),p.details.illegalRecursionDetected&&$e(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeAliasIsRecursiveIndirect().format({name:o.value}),e.leftExpression))}Ze(e.leftExpression,s,r,e.rightExpression,!0,i),le(e,s,r)}function Xt(e){if(oe(e))return;const t=Rt(e,void 0);Ze(e.destExpression,t.type,!!t.isIncomplete,e.rightExpression),le(e,t.type,!!t.isIncomplete)}function en(e){const t=oe(e.name);if(t){if(!(0,N.isInstantiableClass)(t))return;return{classType:t,decoratedType:oe(e)||N.UnknownType.create()}}const n=F.getScopeForNode(e),i=f.getFileInfo(e);let s=0;(4===(null==n?void 0:n.type)||i.isTypingStubFile||i.isTypingExtensionsStubFile||i.isBuiltInStubFile)&&(s|=1,i.isTypingExtensionsStubFile&&(s|=65536),"property"===e.name.value&&(s|=2048),"tuple"===e.name.value&&(s|=524288)),i.isStubFile&&(s|=8388608);const r=N.ClassType.createInstantiable(e.name.value,C.getClassFullName(e,i.moduleName,e.name.value),i.moduleName,i.filePath,s,0,void 0,void 0,C.getDocString(e.suite.statements));r.details.typeVarScopeId=it(e);const a=null==n?void 0:n.lookUpSymbol(e.name.value);let o;const p=f.getDeclaration(e);p&&(o=p),o&&a&&he(a,o,r),r.details.flags|=131072,le(e,r,!1),le(e.name,r,!1);const h=[];let y;const g=[];let T,_=272960;i.isStubFile&&(_|=4),e.arguments.forEach((e=>{if(e.name)if("metaclass"===e.name.value)T?Be(m.Localizer.Diagnostic.metaclassDuplicate(),e):T=e.valueExpression;else if("total"===e.name.value&&N.ClassType.isTypedDictClass(r)){const t=(0,D.evaluateStaticBoolExpression)(e.valueExpression,i.executionEnvironment);void 0===t?Be(m.Localizer.Diagnostic.typedDictTotalParam(),e.valueExpression):t||(r.details.flags|=256)}else g.push({argumentCategory:0,node:e,name:e.name,valueExpression:e.valueExpression});else{let t=Te(e.valueExpression,void 0,_).type;if((0,N.isUnion)(t)&&(t=(0,N.removeUnbound)(t)),(0,N.isAnyOrUnknown)(t)||(0,N.isUnbound)(t)||((0,N.isInstantiableClass)(t)?(N.ClassType.isBuiltIn(t,"Protocol")&&(!i.isStubFile&&!N.ClassType.isTypingExtensionClass(t)&&i.executionEnvironment.pythonVersion<d.PythonVersion.V3_7&&Be(m.Localizer.Diagnostic.protocolIllegal(),e.valueExpression),r.details.flags|=8192),N.ClassType.isBuiltIn(t,"property")&&(r.details.flags|=2048),i.executionEnvironment.pythonVersion>=d.PythonVersion.V3_6&&N.ClassType.isBuiltIn(t,"NamedTuple")&&(r.details.flags|=16777220),N.ClassType.isBuiltIn(t,"TypedDict")||N.ClassType.isTypedDictClass(t)?r.details.flags|=128:N.ClassType.isTypedDictClass(r)&&!N.ClassType.isTypedDictClass(t)&&Be(m.Localizer.Diagnostic.typedDictBaseClass(),e),(0,R.derivesFromClassRecursive)(t,r,!0)&&(Be(m.Localizer.Diagnostic.baseClassCircular(),e),t=N.UnknownType.create())):($e(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.baseClassInvalid(),e),t=N.UnknownType.create())),(0,N.isUnknown)(t)&&$e(i.diagnosticRuleSet.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedBaseClass,m.Localizer.Diagnostic.baseClassUnknown(),e),r.details.baseClasses.some((e=>(0,N.isInstantiableClass)(e)&&(0,N.isInstantiableClass)(t)&&N.ClassType.isSameGenericClass(t,e)))&&$e(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.duplicateBaseClass(),e.name||e),r.details.baseClasses.push(t),(0,N.isInstantiableClass)(t)&&(N.ClassType.isEnumClass(t)&&(r.details.flags|=1048576),(N.ClassType.supportsAbstractMethods(t)||N.ClassType.isProtocolClass(t)&&!N.ClassType.isBuiltIn(t))&&(r.details.flags|=512),N.ClassType.isPropertyClass(t)&&(r.details.flags|=2048),N.ClassType.isFinal(t))){const n=hi(t);Be(m.Localizer.Diagnostic.baseClassFinal().format({type:n}),e.valueExpression)}(0,R.addTypeVarsToListIfUnique)(h,(0,R.getTypeVarArgumentsRecursive)(t)),(0,N.isInstantiableClass)(t)&&N.ClassType.isBuiltIn(t,"Generic")&&(y||(y=[],(0,R.addTypeVarsToListIfUnique)(y,(0,R.getTypeVarArgumentsRecursive)(t))))}})),r.details.baseClasses.length>1&&r.details.baseClasses.some((e=>(0,N.isInstantiableClass)(e)&&N.ClassType.isBuiltIn(e,"NamedTuple")))&&$e(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.namedTupleMultipleInheritance(),e.name),N.ClassType.isBuiltIn(r,"object")||r.details.baseClasses.push(wn(e,"object")),y&&function(e,t,n){const i=t.filter((e=>!n.some((t=>t.details.name===e.details.name))));if(i.length>0){const t=new l.DiagnosticAddendum;t.addMessage(m.Localizer.DiagnosticAddendum.typeVarsMissing().format({names:i.map((e=>`"${e.details.name}"`)).join(", ")})),$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeVarsNotInGeneric()+t.getString(),e)}}(e.name,h,y),r.details.typeParameters=y||h;const b=r.details.typeParameters.filter((e=>(0,N.isVariadicTypeVar)(e)));b.length>1&&Be(m.Localizer.Diagnostic.variadicTypeParamTooManyClass().format({names:b.map((e=>`"${e.details.name}"`)).join(", ")}),e.name,u.TextRange.combine(e.arguments)||e.name),(0,R.computeMroLinearization)(r)||Be(m.Localizer.Diagnostic.methodOrdering(),e.name);const I=F.getScopeForNode(e.suite);r.details.fields=(null==I?void 0:I.symbolTable)||new Map;const S=null==I?void 0:I.getSlotsNames();if(S&&(r.details.localSlotsNames=S),N.ClassType.isTypedDictClass(r)&&(0,E.synthesizeTypedDictClassMethods)(gi,e,r),!i.isStubFile&&0===r.details.typeParameters.length){const t=r.details.fields.get("__init__");if(t){const n=t.getTypedDeclarations();if(1===n.length&&3===n[0].type){const t=n[0].node,i=t.parameters;if(i.length>1&&!i.some(((e,n)=>!!Ae(t,n)))){const n=i.filter(((e,t)=>t>0&&e.name&&0===e.category));n.length>0&&(r.details.flags|=16384,r.details.typeParameters=n.map((n=>{const i=N.TypeVarType.createInstance(`__type_of_${n.name.value}`);return i.details.isSynthesized=!0,i.scopeId=it(t),i.details.boundType=N.UnknownType.create(),N.TypeVarType.cloneForScopeId(i,it(e),e.name.value,0)})))}}}}if(0!==r.details.typeParameters.length||N.ClassType.isBuiltIn(r,"type")||(r.details.baseClasses.some((e=>(0,N.isInstantiableClass)(e)&&N.ClassType.hasCustomClassGetItem(e)))||r.details.fields.has("__class_getitem__"))&&(r.details.flags|=262144),T){const e=Te(T,void 0,_).type;((0,N.isInstantiableClass)(e)||(0,N.isUnknown)(e))&&(r.details.declaredMetaclass=e,(0,N.isInstantiableClass)(e)&&(N.ClassType.isBuiltIn(e,"EnumMeta")?r.details.flags|=1048576:N.ClassType.isBuiltIn(e,"ABCMeta")&&(r.details.flags|=512)))}let P=r.details.declaredMetaclass,x=!1;if(!P||(0,N.isInstantiableClass)(P))for(const t of r.details.baseClasses){if(!(0,N.isInstantiableClass)(t)){P=N.UnknownType.create();break}{const n=t.details.effectiveMetaclass||Y;if(!n||!(0,N.isInstantiableClass)(n)){P=n?N.UnknownType.create():void 0;break}P?(0,R.derivesFromClassRecursive)(n,P,!1)?P=n:(0,R.derivesFromClassRecursive)(P,n,!1)||x||($e(i.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.metaclassConflict(),e.name),x=!0):P=n}}if(!P){const t=wn(e,"type");P=t&&(0,N.isInstantiableClass)(t)?t:N.UnknownType.create()}r.details.effectiveMetaclass=P;let A=r,k=!1;for(let t=e.decorators.length-1;t>=0;t--){const n=e.decorators[t],s=tn(A,r,n);(0,R.containsUnknown)(s)?k||($e(i.diagnosticRuleSet.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedClassDecorator,m.Localizer.Diagnostic.classDecoratorTypeUnknown(),e.decorators[t].expression),k=!0):A=s}if((0,N.isInstantiableClass)(P)&&P.details.metaclassDataClassTransform&&((0,v.applyDataClassDefaultBehaviors)(r,P.details.metaclassDataClassTransform),(0,v.applyDataClassMetaclassBehaviorOverrides)(gi,r,g)),r.details.flags&=-131073,N.ClassType.isDataClass(r)){let t=N.ClassType.isSkipSynthesizedDataClassInit(r);if(!t){const e=(0,R.lookUpClassMember)(r,"__init__",2);if(e){const n=Yn(e);(0,N.isFunction)(n)&&N.FunctionType.isSynthesizedMethod(n)||(t=!0)}}let n=!1;const i=(0,R.lookUpClassMember)(r,"__hash__",2);if(i){const e=Yn(i);(0,N.isFunction)(e)&&!N.FunctionType.isSynthesizedMethod(e)&&(n=!0)}(0,v.synthesizeDataClassMethods)(gi,e,r,t,n)}if(r.details.localSlotsNames){let e=!0;const t=[...r.details.localSlotsNames];r.details.baseClasses.forEach((n=>{(0,N.isInstantiableClass)(n)?N.ClassType.isBuiltIn(n,"object")||N.ClassType.isBuiltIn(n,"type")||N.ClassType.isBuiltIn(n,"Generic")||(void 0===n.details.inheritedSlotsNames?e=!1:t.push(...n.details.inheritedSlotsNames)):e=!1})),e&&(r.details.inheritedSlotsNames=t)}return le(e.name,r,!1),le(e,A,!1),function(e,t,n){const i=n.length>0?n[0].node.name:e.name,s=at(i,t,"__init_subclass__",{method:"get"},void 0,133,t);if(s){const e=s.type;e&&St(i,n,e,void 0,!1,N.NoneType.createInstance())}n.forEach((e=>{e.valueExpression&&Te(e.valueExpression)}))}(e,r,g),N.ClassType.isBuiltIn(r,"UnionType")&&(K=N.ClassType.cloneAsInstance(r)),{classType:r,decoratedType:A}}function tn(e,t,n){const i=Te(n.expression).type;if(9===n.expression.nodeType){const e=Te(n.expression.leftExpression).type;(0,N.isFunction)(e)&&"__dataclass_transform__"===e.details.name&&(t.details.metaclassDataClassTransform=(0,v.validateDataClassTransformDecorator)(gi,n.expression))}if((0,N.isOverloadedFunction)(i)){const n=(0,v.getDataclassDecoratorBehaviors)(i);if(n)return(0,v.applyDataClassDecorator)(gi,t,n,void 0),e}else if((0,N.isFunction)(i)){let s,r;if("final"===i.details.builtInName?t.details.flags|=4096:"runtime_checkable"===i.details.builtInName&&(t.details.flags|=32768),9===n.expression.nodeType){r=n.expression;const e=Te(r.leftExpression).type;s=(0,v.getDataclassDecoratorBehaviors)(e)}else{const e=Te(n.expression).type;s=(0,v.getDataclassDecoratorBehaviors)(e)}if(s)return(0,v.applyDataClassDecorator)(gi,t,s,r),e}return be(n,e)}function nn(e){const n=f.getFileInfo(e),i=oe(e.name);if(i){if(!(0,N.isFunction)(i))return;return{functionType:i,decoratedType:oe(e)||N.UnknownType.create()}}let s;const r=f.getDeclaration(e);r&&(s=r);const a=C.getEnclosingClass(e,!0);let o;if(a){const e=en(a);if(!e)return;o=e.classType}let p=on(e,!!a);(null==s?void 0:s.isGenerator)&&(p|=16),a&&"__class_getitem__"===e.name.value&&(p|=2),n.isStubFile?p|=2048:n.isInPyTypedPackage&&t.disableInferenceForPyTypedSources&&(p|=4096),e.isAsync&&(p|=512);const d=N.FunctionType.createInstance(e.name.value,function(e,t,n){const i=[n];let s=e;for(;s;)s=C.getEnclosingClassOrFunction(s),s&&i.push(s.name.value);return i.push(t),i.reverse().join(".")}(e,n.moduleName,e.name.value),n.moduleName,p,C.getDocString(e.suite.statements));d.details.typeVarScopeId=it(e),(n.isBuiltInStubFile||n.isTypingStubFile||n.isTypingExtensionsStubFile)&&(d.details.builtInName=e.name.value),d.details.declaration=s;const u=F.getScopeForNode(e),h=null==u?void 0:u.lookUpSymbolRecursive(e.name.value);s&&h&&he(h.symbol,s,d),le(e,d,!1),le(e.name,d,!1);const y=o&&N.ClassType.isPseudoGenericClass(o)&&"__init__"===e.name.value,g=[];let T=0,_=0;if(o&&0==(4&d.details.flags)&&(_=1),e.functionAnnotationComment&&!e.functionAnnotationComment.isParamListEllipsis){const t=e.parameters.length-_,n=e.functionAnnotationComment.paramTypeAnnotations.length;_>0&&n===e.parameters.length?_=0:n!==t&&Be(m.Localizer.Diagnostic.annotatedParamCountMismatch().format({expected:t,received:n}),e.functionAnnotationComment)}const v=e=>{if(e.name){const t=Rn(e.name,e.name.value,!1);t&&Je(n,t.symbol,e.name)}};if(e.parameters.forEach(((t,i)=>{let s,r,a,p,u=!1;if(t.name&&(0===i&&o&&(N.FunctionType.isClassMethod(d)||N.FunctionType.isInstanceMethod(d)||N.FunctionType.isConstructorMethod(d))||N.FunctionType.isAbstractMethod(d)||o&&N.ClassType.isProtocolClass(o))&&v(t),t.typeAnnotation)a=t.typeAnnotation;else if(t.typeAnnotationComment)a=t.typeAnnotationComment;else if(e.functionAnnotationComment&&!e.functionAnnotationComment.isParamListEllipsis){const t=i-_;t>=0&&t<e.functionAnnotationComment.paramTypeAnnotations.length&&(a=e.functionAnnotationComment.paramTypeAnnotations[t])}if(a&&(r=ve(a,{associateTypeVarsWithScope:!0,allowTypeVarTuple:1===t.category,disallowRecursiveTypeAlias:!0}),(0,N.isVariadicTypeVar)(r)&&!r.isVariadicUnpacked&&(Be(m.Localizer.Diagnostic.unpackedTypeVarTupleExpected().format({name1:r.details.name,name2:r.details.name}),a),r=N.UnknownType.create())),!r&&y&&i>0&&0===t.category&&t.name&&(r=o.details.typeParameters[T],T++),r){const e=sn(t,r);e!==r&&(r=e,u=!0)}if(t.defaultValue&&(p=Te(t.defaultValue,r,1).type),r){if(t.defaultValue&&p){const i=new l.DiagnosticAddendum,s=new M.TypeVarMap(d.details.typeVarScopeId);if(o&&void 0!==o.details.typeVarScopeId&&("__init__"!==e.name.value&&"__new__"!==e.name.value||s.addSolveForScope(o.details.typeVarScopeId)),!ii(r,p,i,s)){const e=$e(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.paramAssignmentMismatch().format({sourceType:yi(p),paramType:yi(r)})+i.getString(),t.defaultValue);if(u&&a){const t={action:"pyright.addoptionalforparam",offsetOfTypeNode:a.start+1};e&&e.addAction(t)}}}s=r}const h={category:t.category,name:t.name?t.name.value:void 0,hasDefault:!!t.defaultValue,defaultValueExpression:t.defaultValue,defaultType:p,type:s||N.UnknownType.create(),typeAnnotation:a,hasDeclaredType:!!a};if(N.FunctionType.addParameter(d,h),t.name){const n=an(e,t.category,h.type);g.push(n)}else g.push(h.type)})),o&&d.details.parameters.length>0&&!Ae(e,0)){const e=rn(d.details.flags,o);e&&(d.details.parameters[0].type=e,(0,N.isAnyOrUnknown)(e)||(d.details.parameters[0].isTypeInferred=!0),g[0]=e)}if(g.forEach(((t,n)=>{const i=e.parameters[n].name;i&&((0,N.isUnknown)(t)&&(d.details.flags|=16384),le(i,t,!1))})),e.returnTypeAnnotation){d.details.declaredReturnType=N.UnknownType.create();const t=ve(e.returnTypeAnnotation,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});d.details.declaredReturnType=t}else if(e.functionAnnotationComment){d.details.declaredReturnType=N.UnknownType.create();const t=ve(e.functionAnnotationComment.returnTypeAnnotation,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});d.details.declaredReturnType=t}else n.isStubFile&&("__init__"===e.name.value?d.details.declaredReturnType=N.NoneType.createInstance():d.details.declaredReturnType=N.UnknownType.create());const b=e.isAsync?function(e,t){var n;const i=N.FunctionType.clone(t);return t.details.declaredReturnType&&(i.details.declaredReturnType=dn(e,t.details.declaredReturnType,!!(null===(n=t.details.declaration)||void 0===n?void 0:n.isGenerator))),i.details.flags|=1024,i}(e,d):d;let I=b,S=!1;for(let t=e.decorators.length-1;t>=0;t--){const i=e.decorators[t],s=ln(I,d,i,e);(0,R.containsUnknown)(s)?S||($e(n.diagnosticRuleSet.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedFunctionDecorator,m.Localizer.Diagnostic.functionDecoratorTypeUnknown(),e.decorators[t].expression),S=!0):I=s}return(0,N.isFunction)(I)&&(N.FunctionType.isOverloaded(I)&&e.parameters.forEach((e=>{v(e)})),I=function(e,t){let n;const i=f.getDeclaration(e);i&&(n=i);const s=Rn(e,e.name.value,!1);if(s){const i=s.symbol.getDeclarations(),r=i.findIndex((e=>e===n));if(r>0){for(let e=0;e<r;e++){const t=i[e];3===t.type&&nn(t.node)}const n=[],s=i[r-1];if(3===s.type){const e=nn(s.node);e&&((0,N.isFunction)(e.decoratedType)?N.FunctionType.isOverloaded(e.decoratedType)&&n.push(e.decoratedType):(0,N.isOverloadedFunction)(e.decoratedType)&&n.push(...e.decoratedType.overloads))}if(n.push(t),1===n.length)return n[0];const a=N.OverloadedFunctionType.create(n),o=n[n.length-2];return N.FunctionType.isAbstractMethod(o)!==N.FunctionType.isAbstractMethod(t)&&$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.overloadAbstractMismatch().format({name:e.name.value}),e.name),a}}return t}(e,I)),le(e.name,d,!1),le(e,I,!1),{functionType:d,decoratedType:I}}function sn(e,t){var n;return 11!==(null===(n=e.defaultValue)||void 0===n?void 0:n.nodeType)||26!==e.defaultValue.constType||(0,R.isOptionalType)(t)||f.getFileInfo(e).diagnosticRuleSet.strictParameterNoneValue||(t=(0,N.combineTypes)([t,N.NoneType.createInstance()])),t}function rn(e,t){if(0==(4&e)&&t){const n=0!=(3&e);return(0,R.synthesizeTypeVarForSelfCls)(t,n)}}function an(e,t,n){switch(t){case 0:return n;case 1:if((0,N.isTypeVar)(n)&&n.paramSpecAccess)return n;if(Q&&(0,N.isInstantiableClass)(Q)){let e,t=!1;return(0,N.isVariadicTypeVar)(n)&&n.isVariadicUnpacked?(e=[n],t=!0):e=[n,N.AnyType.create(!0)],N.ClassType.cloneAsInstance((0,R.specializeTupleClass)(Q,e,!0,!0,t))}return N.UnknownType.create();case 2:{if((0,N.isTypeVar)(n)&&n.paramSpecAccess)return n;const t=wn(e,"dict"),i=Nn(e,"str");return(0,N.isInstantiableClass)(t)&&(0,N.isClassInstance)(i)?N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(t,[i,n],!0)):N.UnknownType.create()}}}function on(e,t){const n=f.getFileInfo(e);let i=0;"__new__"===e.name.value&&t&&(i|=1),"__init_subclass__"===e.name.value&&t&&(i|=2);for(const s of e.decorators){let e=2;n.isStubFile&&(e|=4);const r=Te(s.expression,void 0,e).type;(0,N.isFunction)(r)?"abstractmethod"===r.details.builtInName?t&&(i|=8):"final"===r.details.builtInName&&(i|=8192):(0,N.isInstantiableClass)(r)&&(N.ClassType.isBuiltIn(r,"staticmethod")?t&&(i|=4):N.ClassType.isBuiltIn(r,"classmethod")&&t&&(i|=2))}return i}function ln(e,t,n,i){let s=2;f.getFileInfo(n).isStubFile&&(s|=4);const r=Te(n.expression,void 0,s).type;if(((0,N.isInstantiableClass)(r)&&N.ClassType.isSpecialBuiltIn(r,"overload")||(0,N.isFunction)(r)&&"overload"===r.details.builtInName)&&(0,N.isFunction)(e))return e.details.flags|=256,t.details.flags|=256,e;if(9===n.expression.nodeType){const i=Te(n.expression.leftExpression).type;if((0,N.isFunction)(i)&&"__dataclass_transform__"===i.details.name)return t.details.decoratorDataClassBehaviors=(0,v.validateDataClassTransformDecorator)(gi,n.expression),e}if((0,N.isInstantiableClass)(r)&&N.ClassType.isSpecialBuiltIn(r,"no_type_check"))return e;let a=be(n,e);if((0,N.isFunction)(r)){if("abstractmethod"===r.details.builtInName)return e;if(35===n.expression.nodeType){const t=Te(n.expression.leftExpression).type;if((0,R.isProperty)(t)){const s=n.expression.memberName.value;if("setter"===s)return(0,N.isFunction)(e)?(cn(e,n),function(e,t,n){if(!(0,R.isProperty)(e))return e;const i=e,s=N.ClassType.createInstantiable(i.details.name,i.details.fullName,i.details.moduleName,f.getFileInfo(n).filePath,i.details.flags,i.details.typeSourceId,i.details.declaredMetaclass,i.details.effectiveMetaclass);(0,R.computeMroLinearization)(s);const r=N.ClassType.cloneAsInstance(s),a=s.details.fields;i.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||a.set(t,e)}));const o=f.getFileInfo(n);if("none"!==o.diagnosticRuleSet.reportPropertyTypeMismatch&&n.parameters.length>=2){const e=Ae(n,1);if(e){const t=ei(i,!1);if(t&&!(0,N.isAnyOrUnknown)(t)){const n=ve(e),i=new l.DiagnosticAddendum;ii(t,n,i)||$e(o.diagnosticRuleSet.reportPropertyTypeMismatch,c.DiagnosticRule.reportPropertyTypeMismatch,m.Localizer.Diagnostic.setterGetterTypeMismatch()+i.getString(),e)}}}const p=P.Symbol.createWithType(4,t);a.set("fset",p);const d=N.FunctionType.createInstance("__set__","","",64);d.details.parameters.push({category:0,name:"self",type:e,hasDeclaredType:!0});let u=t.details.parameters.length>0?t.details.parameters[0].type:N.AnyType.create();(0,N.isTypeVar)(u)&&u.details.isSynthesizedSelfCls&&(u=He(u)),d.details.parameters.push({category:0,name:"obj",type:(0,N.combineTypes)([u,N.NoneType.createInstance()]),hasDeclaredType:!0}),d.details.declaredReturnType=N.NoneType.createInstance();let h=N.UnknownType.create();t.details.parameters.length>=2&&0===t.details.parameters[1].category&&t.details.parameters[1].name&&(h=t.details.parameters[1].type),d.details.parameters.push({category:0,name:"value",type:h,hasDeclaredType:!0});const y=P.Symbol.createWithType(4,d);return a.set("__set__",y),r}(t,e,i)):e;if("deleter"===s)return(0,N.isFunction)(e)?(cn(e,n),function(e,t,n){if(!(0,R.isProperty)(e))return e;const i=e,s=N.ClassType.createInstantiable(i.details.name,i.details.fullName,i.details.moduleName,f.getFileInfo(n).filePath,i.details.flags,i.details.typeSourceId,i.details.declaredMetaclass,i.details.effectiveMetaclass);(0,R.computeMroLinearization)(s);const r=N.ClassType.cloneAsInstance(s),a=s.details.fields;i.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||a.set(t,e)}));const o=P.Symbol.createWithType(4,t);a.set("fdel",o);const l=N.FunctionType.createInstance("__delete__","","",64);l.details.parameters.push({category:0,name:"self",type:e,hasDeclaredType:!0});let c=t.details.parameters.length>0?t.details.parameters[0].type:N.AnyType.create();(0,N.isTypeVar)(c)&&c.details.isSynthesizedSelfCls&&(c=He(c)),l.details.parameters.push({category:0,name:"obj",type:(0,N.combineTypes)([c,N.NoneType.createInstance()]),hasDeclaredType:!0}),l.details.declaredReturnType=N.NoneType.createInstance();const p=P.Symbol.createWithType(4,l);return a.set("__delete__",p),r}(t,e,i)):e}}}else if((0,N.isInstantiableClass)(r)){if(N.ClassType.isBuiltIn(r))switch(r.details.name){case"classmethod":case"staticmethod":return e}if(N.ClassType.isPropertyClass(r)){if((0,N.isFunction)(e))return cn(e,n),pn(n,r.details.name,e,C.getTypeSourceId(n));if((0,N.isClassInstance)(e)){const t=(0,R.lookUpObjectMember)(e,"__call__");if(t){const i=Yn(t);if((0,N.isFunction)(i)||(0,N.isOverloadedFunction)(i)){const t=ui(e,i);if(t&&(0,N.isFunction)(t))return pn(n,r.details.name,t,C.getTypeSourceId(n))}}return N.UnknownType.create()}}}return(0,N.isFunction)(e)&&(0,N.isFunction)(a)&&(a=N.FunctionType.clone(a),N.FunctionType.isOverloaded(e)&&(a.details.flags|=256),a.details.docString||(a.details.docString=e.details.docString)),a}function cn(e,t){N.FunctionType.isStaticMethod(e)&&$e(f.getFileInfo(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.propertyStaticMethod(),t)}function pn(e,t,n,i){const s=f.getFileInfo(e),r=wn(e,"type"),a=N.ClassType.createInstantiable(t,C.getClassFullName(e,s.moduleName,`__property_${n.details.name}`),s.moduleName,s.filePath,2048,i,void 0,(0,N.isInstantiableClass)(r)?r:N.UnknownType.create());(0,R.computeMroLinearization)(a);const o=N.ClassType.cloneAsInstance(a),l=a.details.fields,c=P.Symbol.createWithType(4,n);l.set("fget",c),N.FunctionType.isClassMethod(n)&&(a.details.flags|=4194304);const p=N.FunctionType.createInstance("__get__","","",320);p.details.parameters.push({category:0,name:"self",type:o,hasDeclaredType:!0}),p.details.parameters.push({category:0,name:"obj",type:N.NoneType.createInstance(),hasDeclaredType:!0}),p.details.parameters.push({category:0,name:"objtype",type:N.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:N.AnyType.create()}),p.details.declaredReturnType=N.FunctionType.isClassMethod(n)?N.FunctionType.getSpecializedReturnType(n):o,p.details.declaration=n.details.declaration;const d=N.FunctionType.createInstance("__get__","","",320);d.details.parameters.push({category:0,name:"self",type:o,hasDeclaredType:!0});let u=n.details.parameters.length>0?n.details.parameters[0].type:N.AnyType.create();(0,N.isTypeVar)(u)&&u.details.isSynthesizedSelfCls&&(u=He(u)),d.details.parameters.push({category:0,name:"obj",type:u,hasDeclaredType:!0}),d.details.parameters.push({category:0,name:"objtype",type:N.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:N.AnyType.create()}),d.details.declaredReturnType=N.FunctionType.getSpecializedReturnType(n),d.details.declaration=n.details.declaration,d.details.typeVarScopeId=(0,R.getTypeVarScopeId)(n);const m=N.OverloadedFunctionType.create([p,d]),h=P.Symbol.createWithType(4,m);return l.set("__get__",h),["getter","setter","deleter"].forEach((e=>{const t=N.FunctionType.createInstance(e,"","",64);t.details.parameters.push({category:0,name:"self",type:N.AnyType.create(),hasDeclaredType:!0}),t.details.parameters.push({category:0,name:"accessor",type:N.AnyType.create(),hasDeclaredType:!0}),t.details.declaredReturnType=o;const n=P.Symbol.createWithType(4,t);l.set(e,n)})),o}function dn(e,t,n){let i;if((0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t))if("Generator"===t.details.name){const n=Me(e,"AsyncGenerator");if(n&&(0,N.isInstantiableClass)(n)){const e=[],s=t.typeArguments;s&&s.length>0&&e.push(s[0]),s&&s.length>1&&e.push(s[1]),i=N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(n,e,!0))}}else["AsyncGenerator","AsyncIterator","AsyncIterable"].some((e=>e===t.details.name))&&(i=t);if(!i||!n){const n=Me(e,"Coroutine");i=n&&(0,N.isInstantiableClass)(n)?N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(n,[N.AnyType.create(),N.AnyType.create(),t],!0)):N.UnknownType.create()}return i}function un(e,t){var n;if(e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation))return;let s=oe(e.suite);if(s)return s;if(!i.has(e.id)){i.set(e.id,!0);try{let n;const r=f.getDeclaration(e);r&&(n=r);const a=!Ve(e),o=Ve(e.suite);if(f.getFileInfo(e).isStubFile)s=N.UnknownType.create();else{if(a)if(t||function(e){if(!e||!e.isMethod||e.returnStatements||e.yieldStatements||!e.raiseStatements)return!1;for(const t of e.raiseStatements){if(!t.typeExpression||t.valueExpression)return!1;const e=Te(t.typeExpression).type,n=(0,N.isInstantiableClass)(e)||(0,N.isClassInstance)(e)?e:void 0;if(!n||!N.ClassType.isBuiltIn(n,"NotImplementedError"))return!1}return!0}(n))s=N.UnknownType.create();else{const t=Me(e,"NoReturn");s=t&&(0,N.isInstantiableClass)(t)?N.ClassType.cloneAsInstance(t):N.UnknownType.create()}else{const e=[];(null==n?void 0:n.returnStatements)&&n.returnStatements.forEach((t=>{if(Le(t))if(t.returnExpression){const n=Te(t.returnExpression).type;e.push(n||N.UnknownType.create())}else e.push(N.NoneType.createInstance())})),!a&&o&&e.push(N.NoneType.createInstance()),s=(0,N.combineTypes)(e),s=(0,N.removeUnbound)(s),s=(0,R.removeNoReturnFromUnion)(s)}if(null==n?void 0:n.isGenerator){const t=[];n.yieldStatements&&n.yieldStatements.forEach((e=>{if(Le(e))if(61===e.nodeType){const n=Ne(Te(e.expression).type,!1,e);t.push(n||N.UnknownType.create())}else if(e.expression){const n=Te(e.expression).type;t.push(n||N.UnknownType.create())}else t.push(N.NoneType.createInstance())})),0===t.length&&t.push(N.NoneType.createInstance());const i=(0,N.combineTypes)(t),r=Me(e,"Generator");s=r&&(0,N.isInstantiableClass)(r)?N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(r,[i,N.NoneType.createInstance(),(0,R.isNoReturnType)(s)?N.NoneType.createInstance():s],!0)):N.UnknownType.create()}}le(e.suite,s,!1)}finally{i.delete(e.id)}}return s}function mn(e){if(oe(e))return;const t=Te(e.iterableExpression),n=Ne(t.type,!!e.isAsync,e.iterableExpression)||N.UnknownType.create();Ze(e.targetExpression,n,!!t.isIncomplete,e.targetExpression),le(e,n,!!t.isIncomplete)}function hn(e){if((0,o.assert)(void 0!==e.typeExpression),oe(e))return;const t=Te(e.typeExpression).type;function n(e,t){if(e=He(e),(0,N.isAnyOrUnknown)(e))return e;if((0,N.isInstantiableClass)(e))return N.ClassType.cloneAsInstance(e);if((0,N.isClassInstance)(e)){const n=Ne(e,!1,t)||N.UnknownType.create();return(0,R.mapSubtypes)(n,(e=>(0,N.isAnyOrUnknown)(e)?e:N.UnknownType.create()))}return N.UnknownType.create()}const i=(0,R.mapSubtypes)(t,(t=>{const i=(0,R.getSpecializedTupleType)(t);if(i&&i.tupleTypeArguments){const t=i.tupleTypeArguments.map((t=>n(t,e.typeExpression)));return(0,N.combineTypes)(t)}return n(t,e.typeExpression)}));e.name&&Ze(e.name,i,!1,e.name),le(e,i,!1)}function yn(e){if(oe(e))return;const t=Te(e.expression);let n=t.type;const i=e.parent&&58===e.parent.nodeType&&!!e.parent.isAsync;(0,R.isOptionalType)(n)&&($e(f.getFileInfo(e).diagnosticRuleSet.reportOptionalContextManager,c.DiagnosticRule.reportOptionalContextManager,m.Localizer.Diagnostic.noneNotUsableWith(),e.expression),n=(0,N.removeNoneFromUnion)(n));const s=i?"__aenter__":"__enter__",r=(0,R.mapSubtypes)(n,(t=>{var n;if(t=He(t),(0,N.isAnyOrUnknown)(t))return t;const r=new l.DiagnosticAddendum,a=new l.DiagnosticAddendum;if((0,N.isClassInstance)(t)){const o=null===(n=De(e.expression,t,s,{method:"get"},r))||void 0===n?void 0:n.type;if(o){let t;return t=(0,N.isFunction)(o)?qn(o):N.UnknownType.create(),i&&(t=we(t,e)),t}i||De(e.expression,t,"__aenter__",{method:"get"},r)&&a.addMessage(m.Localizer.DiagnosticAddendum.asyncHelp())}return $e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotUsableWith().format({type:yi(t),method:s})+a.getString(),e.expression),N.UnknownType.create()})),a=i?"__aexit__":"__exit__";(0,R.doForEachSubtype)(n,(t=>{if(t=He(t),(0,N.isAnyOrUnknown)(t))return;const n=new l.DiagnosticAddendum;(0,N.isClassInstance)(t)&&De(e.expression,t,a,{method:"get"},n)||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeNotUsableWith().format({type:yi(t),method:a}),e.expression)})),e.target&&Ze(e.target,r,!!t.isIncomplete,e.target),le(e,r,!!t.isIncomplete)}function gn(e){if(oe(e))return;let t;if(t=e.alias?e.alias:e.module.nameParts[0],!t)return;let n=vn(e,t.value)||N.UnknownType.create();const i=oe(e);i&&(0,N.isModule)(i)&&n&&(0,N.isTypeSame)(n,i)&&(n=i),qe(t,n,!1),le(e,n,!1)}function fn(t){var n;if(oe(t))return;const i=t.alias||t.name,s=f.getFileInfo(t);if((null===(n=t.alias)||void 0===n?void 0:n.value)===t.name.value){const e=Rn(t,t.name.value,!0);e&&Je(s,e.symbol,t)}let r=vn(t,i.value);if(!r){const n=t.parent;(0,o.assert)(n&&22===n.nodeType),(0,o.assert)(!n.isWildcardImport);const i=f.getImportInfo(n.module);if(i&&i.isImportFound&&!i.isNativeLib){const n=i.resolvedPaths[i.resolvedPaths.length-1],a=e(n);let o=!1;if(a){if(o=!0,s.executionEnvironment.pythonVersion>=d.PythonVersion.V3_7||s.isStubFile){const e=a.symbolTable.get("__getattr__");if(e){const t=Wn(e);(0,N.isFunction)(t)&&(r=qn(t),o=!1)}}}else n||(o=!0);o&&$e(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.importSymbolUnknown().format({name:t.name.value}),t.name)}r||(r=N.UnknownType.create())}qe(i,r,!1),le(t,r,!1)}function Tn(e){if(oe(e))return;if(!e.parent||63!==e.parent.nodeType)return void(0,o.fail)("Expected parent of case statement to be match statement");const t=Te(e.parent.subjectExpression);let n=t.type;for(const t of e.parent.cases){if(t===e)break;t.guardExpression||(n=(0,S.narrowTypeBasedOnPattern)(gi,n,t.pattern,!1))}let i=!1;(0,R.doForEachSubtype)(He(n),(e=>{(0,N.isClassInstance)(e)&&N.ClassType.isBuiltIn(e,"object")&&(i=!0)})),n=(0,S.narrowTypeBasedOnPattern)(gi,n,e.pattern,!0),(0,S.assignTypeToPatternTargets)(gi,n,!!t.isIncomplete,i,e.pattern),le(e,n,!!t.isIncomplete)}function _n(e){if(oe(e))return;const t=e.module.nameParts[0];let n=vn(e,t.value)||N.UnknownType.create();const i=oe(e);i&&(0,N.isModule)(i)&&n&&(0,N.isTypeSame)(n,i)&&(n=i),qe(t,n,!1),le(e,n,!1)}function vn(e,n){const i=Rn(e,n,!0);if(!i)return;const s=i.symbol.getDeclarations().filter((t=>C.isNodeContainedWithin(e,t.node)&&6===t.type));let r=s.length>0?s[s.length-1]:void 0;if(r||(r=i.symbol.getDeclarations().find((e=>6===e.type))),!r)return;(0,o.assert)(6===r.type);const a=f.getFileInfo(e),p=Bn(r,!0,a.isStubFile);if(p){if(!p.declaration)return t.evaluateUnknownImportsAsAny?N.AnyType.create():N.UnknownType.create();if(23===e.nodeType&&(p.isPrivate&&$e(a.diagnosticRuleSet.reportPrivateUsage,c.DiagnosticRule.reportPrivateUsage,m.Localizer.Diagnostic.privateUsedOutsideOfModule().format({name:e.name.value}),e.name),p.privatePyTypedImporter)){const t=new l.DiagnosticAddendum;p.privatePyTypedImported&&t.addMessage(m.Localizer.DiagnosticAddendum.privateImportFromPyTypedSource().format({module:p.privatePyTypedImported})),$e(a.diagnosticRuleSet.reportPrivateImportUsage,c.DiagnosticRule.reportPrivateImportUsage,m.Localizer.Diagnostic.privateImportFromPyTypedModule().format({name:e.name.value,module:p.privatePyTypedImporter})+t.getString(),e.name)}return Un(r)}}function bn(e){var t,n;let i=e,s=e;function r(e){var t,n,i,s,r;return 41===e.nodeType&&30===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||1===e.nodeType&&(9===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)||24===(null===(i=e.parent)||void 0===i?void 0:i.nodeType))||54===(null===(s=e.parent)||void 0===s?void 0:s.nodeType)||41===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&(e===e.parent.typeAnnotation||e===e.parent.typeAnnotationComment)||9===e.nodeType||24===e.nodeType||15===e.nodeType||27===e.nodeType||31===e.nodeType||30===e.nodeType||35===e.nodeType||45===e.nodeType||49===e.nodeType||52===e.nodeType||56===e.nodeType||17===e.nodeType||16===e.nodeType||32===e.nodeType||33===e.nodeType||34===e.nodeType||65===e.nodeType||67===e.nodeType||68===e.nodeType||74===e.nodeType||66===e.nodeType||69===e.nodeType||70===e.nodeType||73===e.nodeType||71===e.nodeType||72===e.nodeType}if(38===e.nodeType&&e.parent){if(28===e.parent.nodeType&&e.parent.name===e)return void nn(e.parent);if(10===e.parent.nodeType&&e.parent.name===e)return void en(e.parent);if(29===e.parent.nodeType||39===e.parent.nodeType)return void Te(e,void 0,4)}for(;s;){const e=r(s);if(!e&&!(0,h.isExpressionNode)(s))break;e&&(i=s),s=s.parent}const a=i.parent;if(3===a.nodeType)return void(i===a.typeAnnotationComment?ve(i,{isVariableAnnotation:!0,allowTypeVarTuple:C.isFinalAllowedForAssignmentTarget(a.leftExpression)}):Jt(a));if(14===a.nodeType)return void Qe(i);if(5===a.nodeType)return void Xt(a);if(13===a.nodeType)return void(10===(null===(t=a.parent)||void 0===t?void 0:t.nodeType)?en(a.parent):28===(null===(n=a.parent)||void 0===n?void 0:n.nodeType)&&nn(a.parent));const o=e=>{const t=e.parent;if(3===(null==t?void 0:t.nodeType)&&t.leftExpression===a)Jt(t);else{const t=ve(e.typeAnnotation,{isVariableAnnotation:!0,allowFinal:C.isFinalAllowedForAssignmentTarget(e.valueExpression),allowClassVar:C.isClassVarAllowedForAssignmentTarget(e.valueExpression)});t&&le(e.valueExpression,t,!1)}};if(64===a.nodeType&&i!==a.guardExpression)return void Tn(a);if(54===a.nodeType)return void o(a);if(41===a.nodeType&&i!==a.defaultValue)return void In(a);if(37===a.nodeType)return;if(1===a.nodeType&&i===a.name)return;if(44===a.nodeType&&a.returnExpression){const t=C.getEnclosingFunction(e),n=t?Hn(t):void 0;return void Te(a.returnExpression,n,0)}const l=(0,h.isExpressionNode)(a)&&0!==a.nodeType?a:i;54===l.nodeType?o(l):Te(l,void 0,f.getFileInfo(l).isStubFile?4:0)}function In(e){(0,o.assert)(void 0!==e.name);const t=e.parent;if(30===t.nodeType)return void bn(t);(0,o.assert)(28===t.nodeType);const n=t,i=n.parameters.findIndex((t=>t===e)),s=Ae(n,i);if(s){const t=n.parameters[i],r=ve(s,{associateTypeVarsWithScope:!0,allowTypeVarTuple:1===n.parameters[i].category,disallowRecursiveTypeAlias:!0});le(e.name,an(e,e.category,sn(t,r)),!1)}else{if(0===i){const t=C.getEnclosingClass(n,!0);if(t){const i=en(t);if(i){const t=rn(on(n,!0),i.classType);return void le(e.name,t||N.UnknownType.create(),!1)}}}le(e.name,an(e,e.category,N.UnknownType.create()),!1)}}function Cn(e){fe(e);let t=e;for(;t;){switch(t.nodeType){case 3:if(!t.parent||3!==t.parent.nodeType&&4!==t.parent.nodeType&&5!==t.parent.nodeType||t.parent.rightExpression!==t)return void Jt(t);break;case 4:return void Te(t);case 5:return void Xt(t);case 10:return void en(t);case 41:return void In(t);case 30:return void bn(t);case 28:return void nn(t);case 26:return void mn(t);case 25:return void hn(t);case 59:return void yn(t);case 33:{const e=t.parent;return(0,o.assert)(32===e.nodeType),void bn(e)}case 21:return void gn(t);case 23:return void fn(t);case 22:return void _n(t);case 64:return void Tn(t)}t=t.parent}(0,o.fail)("Unexpected assignment target")}function Sn(e,t){let n=oe(e);if(n)return{node:e,type:n};const i=ne;try{if(ne=new Map,t(),n=oe(e),n)return{node:e,type:n};if(n=ne.get(e.id),n)return{node:e,type:n,isIncomplete:!0}}finally{ne=i}}function Fn(e){let t=s.get(e);return t||(t=fi.createCodeFlowAnalyzer(),s.set(e,t)),t}function Dn(e,t,n,i,s){var r;const a=(0,_.createKeyForReference)(e),l=C.getExecutionScopeNode(null!==(r=null==s?void 0:s.parent)&&void 0!==r?r:e),c=f.getCodeFlowExpressions(l);if(!c||!c.has(a))return{type:void 0,usedOuterScopeAlias:!1,isIncomplete:!1};let p;p=pe(l)?function(){const e=se.length;return(0,o.assert)(e>0),se[e-1].codeFlowAnalyzer}():Fn(l.id);const d=f.getFlowNode(null!=s?s:e);return void 0===d?{type:void 0,usedOuterScopeAlias:!1,isIncomplete:!1}:Pn(p,d,e,t,n,i)}function Pn(e,t,n,i,s,r){let a;$.enterTrackingScope();try{a=e.getTypeFromCodeFlow(t,n,i,s,r)}finally{$.exitTrackingScope()}return a.isIncomplete&&$.enableUndoTracking(),a}function xn(e,t,n,i){if(N.ClassType.isSpecialBuiltIn(e)){const s=e.aliasName||e.details.name;switch(s){case"Callable":return function(e,t){const n=N.FunctionType.createInstantiable("","","",0);N.TypeBase.setSpecialForm(n),n.details.declaredReturnType=N.UnknownType.create();const i=C.getEnclosingClassOrFunction(t);if(n.details.typeVarScopeId=i?it(i):N.WildcardTypeVarScopeId,e&&e.length>0){if(e[0].typeList){const t=e[0].typeList;let i=!1,s=!1;t.forEach(((e,t)=>{let r=e.type,a=0;const o=`__p${t.toString()}`;(0,N.isVariadicTypeVar)(r)?(i&&(s||(Be(m.Localizer.Diagnostic.variadicTypeArgsTooMany(),e.node),s=!0)),i=!0,ct(r,e.node),a=0):Gt(e)||(r=N.UnknownType.create()),N.FunctionType.addParameter(n,{category:a,name:o,isNameSynthesized:!0,type:(0,R.convertToInstance)(r),hasDeclaredType:!0})})),N.FunctionType.addParameter(n,{category:0,isNameSynthesized:!1,type:N.UnknownType.create()})}else if((0,R.isEllipsisType)(e[0].type))N.FunctionType.addDefaultParameters(n),n.details.flags|=32768;else if((0,N.isParamSpec)(e[0].type))n.details.paramSpec=e[0].type;else if((0,N.isInstantiableClass)(e[0].type)&&N.ClassType.isBuiltIn(e[0].type,"Concatenate")){const t=e[0].type.typeArguments;t&&t.length>0&&t.forEach(((e,i)=>{i===t.length-1?(0,N.isParamSpec)(e)&&(n.details.paramSpec=e):N.FunctionType.addParameter(n,{category:0,name:`__p${i}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})}))}else Be(m.Localizer.Diagnostic.callableFirstArg(),e[0].node);if(e.length>1){let t=e[1].type;Gt(e[1])||(t=N.UnknownType.create()),n.details.declaredReturnType=(0,R.convertToInstance)(t)}else $e(f.getFileInfo(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.callableSecondArg(),t),n.details.declaredReturnType=N.UnknownType.create();e.length>2&&Be(m.Localizer.Diagnostic.callableExtraArgs(),e[2].node)}else N.FunctionType.addDefaultParameters(n,!0),n.details.flags|=32768;return n}(t,i);case"Optional":return function(e,t){if(!t||1!==t.length)return Be(m.Localizer.Diagnostic.optionalExtraArgs(),e),N.UnknownType.create();let n=t[0].type;Gt(t[0])?N.TypeBase.isInstantiable(n)||(Ge(n,t[0].node),n=N.UnknownType.create()):n=N.UnknownType.create();const i=(0,N.combineTypes)([n,N.NoneType.createType()]);return(0,N.isUnion)(i)&&N.TypeBase.setSpecialForm(i),i}(i,t);case"Type":{let n=Ht(e,t,1);return(0,N.isInstantiableClass)(n)&&(n=(0,R.explodeGenericClass)(n)),n}case"ClassVar":return function(e,t,n,i){var s;if(131072&i)return Be(m.Localizer.Diagnostic.classVarNotAllowed(),t),N.AnyType.create();if(!n)return e;if(0===n.length)return Be(m.Localizer.Diagnostic.classVarFirstArgMissing(),t),N.UnknownType.create();if(n.length>1)return Be(m.Localizer.Diagnostic.classVarTooManyArgs(),n[1].node),N.UnknownType.create();const r=n[0].type;return(0,R.requiresSpecialization)(r,!0)&&$e(f.getFileInfo(t).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.classVarWithTypeVar(),null!==(s=n[0].node)&&void 0!==s?s:t),r}(e,i,t,n);case"Protocol":return Ht(e,t,void 0,!0);case"Tuple":return Ht(e,t,void 0);case"Union":return function(e,t,n,i){const s=[];if(!n)return 0!=(1024&i)?(Be(m.Localizer.Diagnostic.unionTypeArgCount(),t),N.NeverType.create()):e;for(const e of n){let t=e.type;Gt(e,!1,!0)?N.TypeBase.isInstantiable(t)||(Ge(t,e.node),t=N.UnknownType.create()):t=N.UnknownType.create(),(0,N.isTypeVar)(t)&&(0,N.isVariadicTypeVar)(t)&&t.isVariadicUnpacked&&(t=N.TypeVarType.cloneForUnpacked(t,!0)),s.push(t)}1===s.length&&((0,N.isVariadicTypeVar)(s[0])||(0,N.isNone)(s[0])||Be(m.Localizer.Diagnostic.unionTypeArgCount(),t));const r=(0,N.combineTypes)(s);return(0,N.isUnion)(r)&&N.TypeBase.setSpecialForm(r),r}(e,i,t,n);case"Generic":return function(e,t,n,i){if(!n)return 0!=(263168&i)&&Be(m.Localizer.Diagnostic.genericTypeArgMissing(),t),e;const s=[];return n&&(0===n.length&&Be(m.Localizer.Diagnostic.genericTypeArgMissing(),t),n.forEach((e=>{(0,N.isTypeVar)(e.type)?(s.some((t=>(0,N.isTypeSame)(t,e.type)))&&Be(m.Localizer.Diagnostic.genericTypeArgUnique(),e.node),s.push(e.type)):Be(m.Localizer.Diagnostic.genericTypeArgTypeVar(),e.node)}))),Ht(e,n,void 0,!0)}(e,i,t,n);case"Final":return function(e,t,n,i){return 16&i?(Be(m.Localizer.Diagnostic.finalContext(),t),N.AnyType.create()):n&&0!==n.length?(n.length>1&&Be(m.Localizer.Diagnostic.finalTooManyArgs(),t),n[0].type):e}(e,i,t,n);case"Annotated":return function(e,t){if(t&&t.length<2&&Be(m.Localizer.Diagnostic.annotatedTypeArgMissing(),e),!t||0===t.length)return N.AnyType.create();let n=t[0].type;return Gt(t[0])||(n=N.UnknownType.create()),N.TypeBase.cloneForAnnotated(n)}(i,t);case"Concatenate":return function(e,t,n){return n&&0!==n.length?n.forEach(((e,t)=>{t===n.length-1?(0,N.isParamSpec)(e.type)||Be(m.Localizer.Diagnostic.concatenateParamSpecMissing(),e.node):(0,N.isParamSpec)(e.type)&&Be(m.Localizer.Diagnostic.paramSpecContext(),e.node)})):Be(m.Localizer.Diagnostic.concatenateTypeArgsMissing(),e),Ht(t,n,void 0,!0)}(i,e,t);case"TypeGuard":return function(e,t,n){let i;return n&&1===n.length||Be(m.Localizer.Diagnostic.typeGuardArgCount(),e),n&&n.length>0?(i=n[0].type,Gt(n[0])||(i=N.UnknownType.create())):i=N.UnknownType.create(),N.ClassType.cloneForSpecialization(t,[(0,R.convertToInstance)(i)],!!n)}(i,e,t);case"Unpack":return function(e,t){if(!t||1!==t.length)return Be(m.Localizer.Diagnostic.unpackArgCount(),e),N.UnknownType.create();let n=t[0].type;return(0,N.isUnion)(n)&&1===n.subtypes.length&&(n=n.subtypes[0]),!(0,N.isVariadicTypeVar)(n)||n.isVariadicUnpacked?(Be(m.Localizer.Diagnostic.unpackExpectedTypeVarTuple(),e),N.UnknownType.create()):N.TypeVarType.cloneForUnpacked(n)}(i,t);case"Required":case"NotRequired":return function(e,t,n,i){var s;if(!i||1!==i.length)return Be(n?m.Localizer.Diagnostic.requiredArgCount():m.Localizer.Diagnostic.notRequiredArgCount(),t),e;const r=i[0].type,a=C.getEnclosingClass(t,!0),o=a?en(a):void 0;let l=!1;return o&&(0,N.isInstantiableClass)(o.classType)&&N.ClassType.isTypedDictClass(o.classType)&&54===(null===(s=t.parent)||void 0===s?void 0:s.nodeType)&&t.parent.typeAnnotation===t&&(l=!0),l?r:(Be(n?m.Localizer.Diagnostic.requiredNotInTypedDict():m.Localizer.Diagnostic.notRequiredNotInTypedDict(),t),N.ClassType.cloneForSpecialization(e,[(0,R.convertToInstance)(r)],!!i))}(e,i,"Required"===s,t);case"Self":return function(e,t,n){var i;const s=f.getFileInfo(t);n&&$e(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeArgsExpectingNone().format({name:e.details.name}),null!==(i=n[0].node)&&void 0!==i?i:t);const r=C.getEnclosingClass(t),a=r?en(r):void 0;if(!a)return $e(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.selfTypeContext(),t),N.UnknownType.create();const o=C.getEnclosingFunction(t);if(o){if(4&on(o,!0))return $e(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.selfTypeContext(),t),N.UnknownType.create();if(o.parameters.length>0){const e=Ae(o,0);if(e&&!C.isNodeContainedWithin(t,e)){const n=ve(e);(0,N.isTypeVar)(n)&&n.details.isSynthesizedSelfCls||$e(s.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.selfTypeWithTypedSelfOrCls(),t)}}}return(0,R.synthesizeTypeVarForSelfCls)(a.classType,!0)}(e,i,t)}}const s=f.getFileInfo(i);if(s.isStubFile||s.executionEnvironment.pythonVersion>=d.PythonVersion.V3_9||_e(f.getFileInfo(i))||0!=(4&n)){if(N.ClassType.isBuiltIn(e,"type")&&t){const e=Me(i,"Type");if(e&&(0,N.isInstantiableClass)(e)){let n=Ht(e,t,1,void 0,!0);return(0,N.isInstantiableClass)(n)&&(n=(0,R.explodeGenericClass)(n)),n}}if((0,R.isTupleClass)(e))return Ht(e,t,void 0,void 0,!0)}let r=t?t.length:0;const a=N.ClassType.isPseudoGenericClass(e)?[]:N.ClassType.getTypeParameters(e);if(0===a.length&&0===r)return e;const o=a.findIndex((e=>(0,N.isVariadicTypeVar)(e)));if(t){if(r>a.length){if(!N.ClassType.isPartiallyConstructed(e)&&!N.ClassType.isTupleClass(e)){const n=f.getFileInfo(i);0===a.length?$e(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeArgsExpectingNone().format({name:e.aliasName||e.details.name}),t[a.length].node):1===a.length&&(0,N.isParamSpec)(a[0])||$e(n.diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeArgsTooMany().format({name:e.aliasName||e.details.name,expected:a.length,received:r}),t[a.length].node)}r=a.length}else r<a.length&&$e(f.getFileInfo(i).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeArgsTooFew().format({name:e.aliasName||e.details.name,expected:a.length,received:r}),t.length>0?t[0].node.parent:i);t.forEach(((e,t)=>{if(t===o){if((0,N.isClassInstance)(e.type)&&(0,R.isTupleClass)(e.type))return;if((0,N.isVariadicTypeVar)(e.type))return void ct(e.type,e.node)}const n=t<a.length?a[t]:void 0;Gt(e,!1,!1,!0,null==n?void 0:n.details.isParamSpec)}))}const p=[],u=N.ClassType.getTypeParameters(e);if(1===u.length&&u[0].details.isParamSpec&&t)if(t.every((e=>!(0,R.isEllipsisType)(e.type)&&!e.typeList&&!(0,N.isParamSpec)(e.type))))t=[{type:N.UnknownType.create(),node:t[0].node,typeList:t}];else if(t.length>1){const e=t.find((e=>(0,N.isParamSpec)(e.type)));e&&Be(m.Localizer.Diagnostic.paramSpecContext(),e.node);const n=t.find((e=>!!e.typeList));n&&Be(m.Localizer.Diagnostic.typeArgListNotAllowed(),n.node)}return u.forEach(((e,n)=>{if(t&&n<t.length){if(e.details.isParamSpec){const e=t[n],i=N.FunctionType.createInstantiable("","","",65536);if(N.TypeBase.setSpecialForm(i),(0,R.isEllipsisType)(e.type))return N.FunctionType.addDefaultParameters(i),void p.push(i);if(e.typeList)return e.typeList.forEach(((e,t)=>{N.FunctionType.addParameter(i,{category:0,name:`__p${t}`,isNameSynthesized:!0,type:(0,R.convertToInstance)(e.type),hasDeclaredType:!0})})),void p.push(i);if((0,N.isInstantiableClass)(e.type)&&N.ClassType.isBuiltIn(e.type,"Concatenate")){const t=e.type.typeArguments;return t&&t.length>0&&t.forEach(((e,n)=>{n===t.length-1?(0,N.isParamSpec)(e)&&(i.details.paramSpec=e):N.FunctionType.addParameter(i,{category:0,name:`__p${n}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})})),void p.push(i)}}p.push((0,R.convertToInstance)(t[n].type))}else p.push(N.UnknownType.create())})),p.forEach(((e,n)=>{if(n<r){const i=new l.DiagnosticAddendum;(function(e,t,n,i=0,s=0){if(s>N.maxTypeRecursionCount)return!0;if((0,N.isAnyOrUnknown)(t))return!0;let r=t;if((0,N.isTypeVar)(t)){if((0,N.isTypeSame)(t,e,void 0,void 0,s+1))return!0;r=He(t)}if(e.details.boundType&&!ii(e.details.boundType,r,n.createAddendum(),void 0,i,s+1))return e.details.isSynthesized||n.addMessage(m.Localizer.DiagnosticAddendum.typeBound().format({sourceType:yi(r),destType:yi(e.details.boundType),name:N.TypeVarType.getReadableName(e)})),!1;if(e.details.isParamSpec)return!(!(0,N.isParamSpec)(t)&&(!(0,N.isFunction)(t)||!N.FunctionType.isParamSpecValue(t))&&(!(0,N.isClassInstance)(t)||!N.ClassType.isBuiltIn(t,"Concatenate"))&&(n.addMessage(m.Localizer.DiagnosticAddendum.typeParamSpec().format({type:yi(t),name:N.TypeVarType.getReadableName(e)})),1));if((0,N.isTypeVar)(t)&&t.details.isParamSpec)return n.addMessage(m.Localizer.Diagnostic.paramSpecContext()),!1;const a=e.details.constraints;if(0===a.length)return!0;if((0,N.isTypeVar)(t)&&t.details.constraints.length>0){if(t.details.constraints.every((e=>a.some((t=>ii(t,e))))))return!0}else for(const e of a)if(ii(e,r))return!0;return n.addMessage(m.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:yi(t),name:N.TypeVarType.getReadableName(e)})),!1})(a[n],e,i)||(0,N.isClassInstance)(e)&&N.ClassType.isPartiallyConstructed(e)||$e(f.getFileInfo(t[n].node).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.typeVarAssignmentMismatch().format({type:yi(e),name:N.TypeVarType.getReadableName(a[n])})+i.getString(),t[n].node)}})),N.ClassType.cloneForSpecialization(e,p,void 0!==t)}function An(e){return e.type?{type:e.type}:e.valueExpression?Te(e.valueExpression):{type:N.UnknownType.create()}}function kn(e){return e.type?{type:e.type}:En(e.valueExpression)}function En(e,t=!1){let n=131304;return f.getFileInfo(e).isStubFile&&(n|=4),t||(n|=16),Te(e,void 0,n)}function wn(e,t){const n=F.getScopeForNode(e);if(n){const e=F.getBuiltInScope(n).lookUpSymbol(t);if(e)return Wn(e)}return N.UnknownType.create()}function Nn(e,t,n){const i=wn(e,t);if((0,N.isInstantiableClass)(i)){let e=i;return n&&(e=N.ClassType.cloneForSpecialization(e,n,void 0!==n)),N.ClassType.cloneAsInstance(e)}return i}function Rn(e,t,n,i=!1){const s=F.getScopeForNode(e);let r=null==s?void 0:s.lookUpSymbolRecursive(t);if(r&&n&&0===r.symbol.getDeclarations().filter((t=>{if(6!==t.type&&0!==t.type){const n=C.getExecutionScopeNode(e),i=4===t.type||3===t.type?t.node.name:t.node;if(n===C.getExecutionScopeNode(i)&&!Ue(i,e)){const t=f.getFlowNode(e);return!(t&&fi.isFlowNodeReachable(t))}}return!0})).length&&(r=1!==r.scope.type&&r.scope.parent?r.scope.parent.lookUpSymbolRecursive(t,r.isOutsideCallerModule||3===r.scope.type,r.isBeyondExecutionScope||r.scope.isIndependentlyExecutable()):void 0),r&&i){let e=r;for(;3!==e.scope.type&&4!==e.scope.type&&e.scope.parent&&(e=e.scope.parent.lookUpSymbolRecursive(t,e.isOutsideCallerModule,e.isBeyondExecutionScope||e.scope.isIndependentlyExecutable()),e););3!==(null==e?void 0:e.scope.type)&&4!==(null==e?void 0:e.scope.type)||(r=e)}return r}function Mn(e,t){j.push(e);try{return t()}finally{j.pop()}}function On(e,t,n=!0){B.enterSpeculativeContext(e,n);try{return t()}finally{B.leaveSpeculativeContext()}}function Ln(e,t){if((0,N.isFunction)(e)&&e.details.declaration){const n=e.details.declaration;if(3===n.type){const e=n.node,i=f.getScope(e);if(i){const e=i.lookUpSymbol(t);if(e)return e.getDeclarations().find((e=>2===e.type))}}}}function Vn(e){var t;switch(e.type){case 0:{if("Any"===e.intrinsicType)return N.AnyType.create();if("class"===e.intrinsicType){const t=en(C.getEnclosingClass(e.node));return t?t.classType:void 0}const t=Nn(e.node,"str"),n=Nn(e.node,"int");if((0,N.isClassInstance)(n)&&(0,N.isClassInstance)(t)){if("str"===e.intrinsicType)return t;if("str | None"===e.intrinsicType)return(0,N.combineTypes)([t,N.NoneType.createInstance()]);if("int"===e.intrinsicType)return n;if("Iterable[str]"===e.intrinsicType){const n=wn(e.node,"Iterable");if((0,N.isInstantiableClass)(n))return N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(n,[t],!0))}if("Dict[str, Any]"===e.intrinsicType){const n=wn(e.node,"dict");if((0,N.isInstantiableClass)(n))return N.ClassType.cloneAsInstance(N.ClassType.cloneForSpecialization(n,[t,N.AnyType.create()],!0))}}return N.UnknownType.create()}case 4:{const t=en(e.node);return t?t.decoratedType:void 0}case 5:return ve(e.node.typeAnnotation);case 3:{const t=nn(e.node);return t?t.decoratedType:void 0}case 2:{let n=e.node.typeAnnotation||e.node.typeAnnotationComment;if(!n&&28===(null===(t=e.node.parent)||void 0===t?void 0:t.nodeType)){const t=e.node.parent;if(t.functionAnnotationComment&&!t.functionAnnotationComment.isParamListEllipsis){const i=t.parameters.findIndex((t=>t===e.node));n=Ae(t,i)}}if(n){const t=ve(n,{associateTypeVarsWithScope:!0,allowTypeVarTuple:1===e.node.category,disallowRecursiveTypeAlias:!0});return an(e.node,e.node.category,sn(e.node,t))}return}case 1:{const t=e.typeAnnotationNode;if(t){const n=ke(t)?C.getTypeAnnotationNode(t):void 0;let i=ve(t,{isVariableAnnotation:!0,allowClassVar:!e.isFinal&&C.isClassVarAllowedForAssignmentTarget(e.node)});if(i)return 38===e.node.nodeType&&(i=Yt(e.node,(()=>i))||i),n&&38===n.valueExpression.nodeType&&(i=Zt(i,n.valueExpression,e.node)),i}return}case 6:return}}function Un(n){var i,s;const r=zn(n,!0,f.getFileInfo(n.node).isStubFile);if(!r)return t.evaluateUnknownImportsAsAny?N.AnyType.create():N.UnknownType.create();function a(e,n,i){if(n.path&&n.loadSymbolsFromPath){const s=i(n.path);if(!s)return t.evaluateUnknownImportsAsAny?N.AnyType.create():N.UnknownType.create();e.fields=s.symbolTable,e.docString=s.docString}return n.implicitImports&&n.implicitImports.forEach(((t,n)=>{const s=e.moduleName?e.moduleName+"."+n:"",r=a(N.ModuleType.create(s,t.path),t,i),o=P.Symbol.createWithType(0,r);e.loaderFields.set(n,o)})),e}if(6===r.type){let t=r.moduleName;if(6===n.type&&(n.symbolName&&(t+="."+n.symbolName),t.startsWith("."))){const e=f.getFileInfo(n.node).moduleName.split(".");for(t=t.substr(1);t.startsWith(".")&&e.length>0;)t=t.substr(1),e.pop();t=e.join(".")+"."+t}const i=N.ModuleType.create(t,r.path);return r.symbolName&&r.submoduleFallback?a(i,r.submoduleFallback,e):a(i,r,e)}const o=Vn(r);if(o)return o;const l=f.getFileInfo(r.node);let c=!1;if(l.isInPyTypedPackage&&!l.isStubFile&&t.disableInferenceForPyTypedSources){if(1!==r.type)return N.UnknownType.create();const e=C.getEnclosingClass(r.node,!0);let t=!1;if(e){const n=en(e);n&&N.ClassType.isEnumClass(n.classType)&&(t=!0)}if(!r.isFinal&&!r.isConstant&&!t){if(!r.typeAliasName)return N.UnknownType.create();r.typeAliasAnnotation||(c=!0)}}if(2===r.type)return null===(i=Sn(r.node.name,(()=>{In(r.node)})))||void 0===i?void 0:i.type;if(1===r.type&&r.inferredTypeSource){const e=r.typeAliasName&&r.inferredTypeSource.parent?r.inferredTypeSource.parent:r.inferredTypeSource;let t=null===(s=Sn(r.node,(()=>{Cn(e)})))||void 0===s?void 0:s.type;if(t&&38===r.node.nodeType){const e=Yt(r.node,(()=>{var e;return(null===(e=Sn(r.inferredTypeSource,(()=>{Cn(r.inferredTypeSource)})))||void 0===e?void 0:e.type)||N.UnknownType.create()}));e&&(t=e)}if(t&&r.typeAliasName)if(N.TypeBase.isInstantiable(t)&&!(0,N.isAnyOrUnknown)(t))t=Zt(t,r.typeAliasName,r.node);else if(c)return N.UnknownType.create();return t}}function zn(t,n,i=!1){var s;return null===(s=g.resolveAliasDeclaration(e,t,n,i))||void 0===s?void 0:s.declaration}function Bn(t,n,i=!1){return g.resolveAliasDeclaration(e,t,n,i)}function Wn(e){return jn(e).type}function jn(e,t,n=!1){if(e.hasTypedDeclarations()){const t=$n(e);return{type:t||N.UnknownType.create(),isIncomplete:!1,includesVariableDecl:e.getTypedDeclarations().some((e=>1===e.type)),isRecursiveDefinition:!t}}let i=W.get(e.id);const s=t?t.id:void 0;if(i)for(const e of i)if(e.usageNodeId===s&&e.useLastDecl===n)return e.result;const r=[],a=e.getDeclarations(),o=(0,A.isFinalVariable)(e);let l=!1,c=!1,p=!1;if(a.forEach(((i,s)=>{var d,u;let m=!n||s===a.length-1;if(void 0!==t&&6!==i.type&&C.getExecutionScopeNode(t)===C.getExecutionScopeNode(i.node)&&(Ue(i.node,t)||(m=!1)),m){const t=(0,b.isExplicitTypeAliasDeclaration)(i)||(0,b.isPossibleTypeAliasDeclaration)(i);if(t&&1===i.type&&3===(null===(u=null===(d=i.inferredTypeSource)||void 0===d?void 0:d.parent)||void 0===u?void 0:u.nodeType)&&(Jt(i.inferredTypeSource.parent),i.typeAliasAnnotation&&Te(i.typeAliasAnnotation)),ue(e,i))try{let n=Un(i);if(me(e)||(l=!0),n){if(1===i.type){c=!0;let e=1===i.type&&!!i.isConstant;(0,N.isClassInstance)(n)&&N.ClassType.isEnumClass(n)&&function(e){const t=C.getEnclosingClass(e.node,!0);if(!t)return!1;const n=en(t);return!!n&&N.ClassType.isEnumClass(n.classType)}(i)&&(e=!0),!N.TypeBase.isInstance(n)||t||e||o||(n=(0,R.stripLiteralValue)(n))}r.push(n),B.isSpeculative(i.node)&&(p=!0)}else l=!0}catch(t){throw me(e),t}else l=!0}})),r.length>0){const t={type:(0,N.combineTypes)(r),isIncomplete:!1,includesVariableDecl:c,isRecursiveDefinition:!1};return p||(i||(i=[],W.set(e.id,i)),i.push({usageNodeId:s,useLastDecl:n,result:t})),t}return{type:N.UnboundType.create(),isIncomplete:l,includesVariableDecl:c,isRecursiveDefinition:!1}}function $n(e){const t=e.getSynthesizedType();if(t)return t;const n=e.getTypedDeclarations();if(0===n.length)return;let i=n.length-1;for(;i>=0;){const t=n[i],s=ye(e,t);if(s)return s;if(de(e,t)<0&&ue(e,t))try{const n=Vn(t);if(me(e)||4===t.type)return n}catch(t){throw me(e),t}i--}}function Gn(e){(0,N.isFunction)(e)?qn(e):(0,N.isOverloadedFunction)(e)&&e.overloads.forEach((e=>{qn(e)}))}function qn(e,t,n=!0){return N.FunctionType.getSpecializedReturnType(e)||(n?Kn(e,t):N.UnknownType.create())}function Kn(e,n){var i;let s;if(N.FunctionType.isStubDefinition(e)||N.FunctionType.isPyTypedDefinition(e))return N.UnknownType.create();if(e.inferredReturnType)s=e.inferredReturnType;else{if(N.FunctionType.isInstanceMethod(e)&&"__init__"===e.details.name)s=N.NoneType.createInstance();else if(e.details.declaration){const n=e.details.declaration.node;if(t.analyzeUnannotatedFunctions){const t=f.getCodeFlowComplexity(n);(e.details.parameters.length<=1||e.details.parameters.some((e=>e.hasDeclaredType))||t<15)&&(function(t){const i=B.disableSpeculativeMode();try{s=un(n,N.FunctionType.isAbstractMethod(e))}finally{B.enableSpeculativeMode(i)}}(),s&&N.FunctionType.isWrapReturnTypeInAwait(e)&&(s=dn(n,s,!!(null===(i=e.details.declaration)||void 0===i?void 0:i.isGenerator))))}}s||(s=N.UnknownType.create()),e.inferredReturnType=s}if(t.analyzeUnannotatedFunctions&&(0,R.isPartlyUnknown)(s)&&N.FunctionType.hasUnannotatedParams(e)&&!N.FunctionType.isStubDefinition(e)&&!N.FunctionType.isPyTypedDefinition(e)&&n){const t=function(e,t){var n;let i;if(!e.details.declaration)return;const s=e.details.declaration.node;if(t.some((e=>!e.paramName)))return;if(se.some((e=>e.functionNode===s)))return;const r=nn(s);return r&&!(t.length>6||se.length>=2)?(Mn(s,(()=>{const n=re;se.push({functionNode:s,codeFlowAnalyzer:fi.createCodeFlowAnalyzer()});try{re=new Map;let a=!0;s.parameters.forEach(((e,n)=>{if(e.name){let i;const o=t.find((t=>e.name.value===t.paramName));o&&o.argument.valueExpression?(i=Te(o.argument.valueExpression).type,(0,N.isUnknown)(i)||(a=!1)):e.defaultValue?(i=Te(e.defaultValue).type,(0,N.isUnknown)(i)||(a=!1)):0===n&&(N.FunctionType.isInstanceMethod(r.functionType)||N.FunctionType.isClassMethod(r.functionType))&&r.functionType.details.parameters.length>0&&s.parameters[0].name&&(i=r.functionType.details.parameters[0].type),i||(i=N.UnknownType.create()),le(e.name,i,!1)}})),a||(i=un(s,N.FunctionType.isAbstractMethod(e)))}finally{se.pop(),re=n}})),i?(i=(0,N.removeUnbound)(i),N.FunctionType.isWrapReturnTypeInAwait(e)&&!(0,R.isNoReturnType)(i)&&(i=dn(s,i,!!(null===(n=e.details.declaration)||void 0===n?void 0:n.isGenerator))),i):void 0):void 0}(e,n);t&&(s=(0,R.removeNoReturnFromUnion)(t))}return s}function Hn(e){const t=nn(e);return t?N.FunctionType.isAbstractMethod(t.functionType)?N.AnyType.create():N.FunctionType.isGenerator(t.functionType)?(0,R.getDeclaredGeneratorReturnType)(t.functionType):t.functionType.details.declaredReturnType:N.AnyType.create()}function Yn(e){return(0,N.isInstantiableClass)(e.classType)?(0,R.partiallySpecializeType)(Wn(e.symbol),e.classType):N.UnknownType.create()}function Zn(e,t,n,i,s,r,a){if(a>N.maxTypeRecursionCount)return!0;const o=e.details.fields;if(N.ClassType.isSameGenericClass(t,e))return!!(0,N.isTypeSame)(t,e,!0,void 0,a+1)||ti(e,t,n,i,s,a+1);const l=N.ClassType.cloneForSpecialization(e,void 0,!1),c=new M.TypeVarMap((0,R.getTypeVarScopeId)(e)),p=new M.TypeVarMap((0,R.getTypeVarScopeId)(e));(0,R.populateTypeVarMapForSelfType)(p,e,t),N.ClassType.isTypedDictClass(t)&&te&&(0,N.isInstantiableClass)(te)&&(t=te);let d=!0;const u=(0,R.buildTypeVarMapFromSpecializedClass)(t);if(o.forEach(((e,i)=>{if(e.isClassMember()&&!e.isIgnoredForProtocolMatch()){let s,o=!1;if(r&&t.details.effectiveMetaclass&&(0,N.isInstantiableClass)(t.details.effectiveMetaclass)&&(s=(0,R.lookUpClassMember)(t.details.effectiveMetaclass,i),u.addSolveForScope((0,R.getTypeVarScopeId)(t.details.effectiveMetaclass)),o=!0),s||(s=(0,R.lookUpClassMember)(t,i)),s){let r=$n(e);if(r){let l=(0,N.isInstantiableClass)(s.classType)?(0,R.partiallySpecializeType)(Wn(s.symbol),s.classType,t,!0):N.UnknownType.create();if((0,N.isFunction)(l)||(0,N.isOverloadedFunction)(l)){if(o){const e=ui(t,l,void 0,void 0,a+1,!1,t);if(e&&(l=(0,R.removeParamSpecVariadicsFromSignature)(e)),(0,N.isFunction)(r)||(0,N.isOverloadedFunction)(r)){const e=ui(t,r,void 0,void 0,a+1,!1,t);e&&(r=(0,R.removeParamSpecVariadicsFromSignature)(e))}}else if((0,N.isInstantiableClass)(s.classType)){r=(0,R.applySolvedTypeVars)(r,p);const e=ui(N.ClassType.cloneAsInstance(t),l,s.classType,void 0,a+1);if(e&&(l=(0,R.removeParamSpecVariadicsFromSignature)(e)),(0,N.isFunction)(r)||(0,N.isOverloadedFunction)(r)){const e=ui(N.ClassType.cloneAsInstance(t),r,s.classType,void 0,a+1);e&&(r=(0,R.removeParamSpecVariadicsFromSignature)(e))}}}else r=(0,R.applySolvedTypeVars)(r,p);const u=null==n?void 0:n.createAddendum();if((0,N.isClassInstance)(r)&&N.ClassType.isPropertyClass(r))if((0,N.isClassInstance)(l)&&N.ClassType.isPropertyClass(l))Jn(N.ClassType.cloneAsInstantiable(r),N.ClassType.cloneAsInstantiable(l),t,null==u?void 0:u.createAddendum(),c,a+1)||(u&&u.addMessage(m.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),d=!1);else{const e=ei(r,!0);e&&ii(e,l,null==u?void 0:u.createAddendum(),c,0,a+1)||(u&&u.addMessage(m.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),d=!1)}else ii(r,l,null==u?void 0:u.createAddendum(),c,0,a+1)||(u&&u.addMessage(m.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),d=!1);const h=e.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal));h!==s.symbol.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal))&&(h?u&&u.addMessage(m.Localizer.DiagnosticAddendum.memberIsFinalInProtocol().format({name:i})):u&&u.addMessage(m.Localizer.DiagnosticAddendum.memberIsNotFinalInProtocol().format({name:i})),d=!1)}e.isClassVar()&&!s.symbol.isClassMember()&&(n&&n.addMessage(m.Localizer.DiagnosticAddendum.protocolMemberClassVar().format({name:i})),d=!1)}else n&&n.addMessage(m.Localizer.DiagnosticAddendum.protocolMemberMissing().format({name:i})),d=!1}})),e.details.baseClasses.forEach((o=>{!(0,N.isInstantiableClass)(o)||N.ClassType.isBuiltIn(o,"object")||N.ClassType.isBuiltIn(o,"Protocol")||Zn((0,R.specializeForBaseClass)(e,o),t,null==n?void 0:n.createAddendum(),i,s,r,a+1)||(d=!1)})),d&&e.details.typeParameters.length>0&&e.typeArguments){const t=(0,R.applySolvedTypeVars)(l,c);ti(e,t,n,i,s,a+1)||(d=!1)}return d}function Qn(e,t,n,i,s,r){if(r>N.maxTypeRecursionCount)return!0;let a=!0;const o=e.details.fields,l=N.ClassType.cloneForSpecialization(e,void 0,!1),c=new M.TypeVarMap((0,R.getTypeVarScopeId)(e));if(o.forEach(((i,s)=>{if(i.isClassMember()&&!i.isIgnoredForProtocolMatch()){const o=t.fields.get(s);if(o){let t=$n(i);if(t){const i=Wn(o);if(((0,N.isFunction)(i)||(0,N.isOverloadedFunction)(i))&&((0,N.isFunction)(t)||(0,N.isOverloadedFunction)(t))){const n=ui(N.ClassType.cloneAsInstance(e),t,e,void 0,r+1);n&&(t=n)}const l=null==n?void 0:n.createAddendum();ii(t,i,null==l?void 0:l.createAddendum(),c,0,r+1)||(l&&l.addMessage(m.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:s})),a=!1)}}else n&&n.addMessage(m.Localizer.DiagnosticAddendum.protocolMemberMissing().format({name:s})),a=!1}})),e.details.baseClasses.forEach((o=>{!(0,N.isInstantiableClass)(o)||N.ClassType.isBuiltIn(o,"object")||N.ClassType.isBuiltIn(o,"Protocol")||Qn((0,R.specializeForBaseClass)(e,o),t,null==n?void 0:n.createAddendum(),i,s,r+1)||(a=!1)})),a&&e.details.typeParameters.length>0&&e.typeArguments){const t=(0,R.applySolvedTypeVars)(l,c);ti(e,t,n,i,s,r)||(a=!1)}return a}function Jn(e,t,n,i,s,r=0){const a=N.ClassType.cloneAsInstance(n);let o=!0;return[{name:"fget",missingDiagMsg:m.Localizer.DiagnosticAddendum.missingGetter,incompatibleDiagMsg:m.Localizer.DiagnosticAddendum.incompatibleGetter},{name:"fset",missingDiagMsg:m.Localizer.DiagnosticAddendum.missingSetter,incompatibleDiagMsg:m.Localizer.DiagnosticAddendum.incompatibleSetter},{name:"fdel",missingDiagMsg:m.Localizer.DiagnosticAddendum.missingDeleter,incompatibleDiagMsg:m.Localizer.DiagnosticAddendum.incompatibleDeleter}].forEach((n=>{const l=e.details.fields.get(n.name),c=l?$n(l):void 0;if(c&&(0,N.isFunction)(c)){const e=t.details.fields.get(n.name),l=e?$n(e):void 0;if(!l||!(0,N.isFunction)(l))return i&&i.addMessage(n.missingDiagMsg()),void(o=!1);const p=ui(a,c,void 0,void 0,r+1),d=ui(a,l,void 0,void 0,r+1);if(!p||!d||!ii(p,d,null==i?void 0:i.createAddendum(),s,0,r+1))return i&&i.addMessage("getter type is incompatible"),void(o=!1)}})),o}function Xn(e,t,n,i,s,r,a,l=!1){if(N.ClassType.isTypedDictClass(e)&&N.ClassType.isTypedDictClass(t))return!!(0,E.canAssignTypedDict)(gi,e,t,n,r)&&(N.ClassType.isFinal(e)!==N.ClassType.isFinal(t)?(n&&n.addMessage(m.Localizer.DiagnosticAddendum.typedDictFinalMismatch().format({sourceType:yi((0,R.convertToInstance)(t)),destType:yi((0,R.convertToInstance)(e))})),!1):!(0!=(1&s)&&!N.ClassType.isSameGenericClass(e,t))||(0,E.canAssignTypedDict)(gi,t,e,void 0,r));const c=U.get(e.details.fullName);if(c&&c.some((e=>t.details.mro.some((t=>(0,N.isClass)(t)&&e===t.details.fullName))))&&0==(1&s))return!0;const p=[],d=N.ClassType.isDerivedFrom(t,e,p);if(N.ClassType.isProtocolClass(e)&&(!d||l))return!!Zn(e,t,null==n?void 0:n.createAddendum(),i,s,l,r+1)||(n&&n.addMessage(m.Localizer.DiagnosticAddendum.protocolIncompatible().format({sourceType:yi((0,R.convertToInstance)(t)),destType:yi((0,R.convertToInstance)(e))})),!1);if((0==(1&s)||N.ClassType.isSameGenericClass(t,e))&&d)return(0,o.assert)(p.length>0),function(e,t,n,i,s,r,a){let o=t,l=s||new M.TypeVarMap((0,R.getTypeVarScopeId)(e)),c=r;s||(c&=-9);for(let t=n.length-1;t>=0;t--){const s=n[t];if((0,N.isUnknown)(s))return!0;if(N.ClassType.isBuiltIn(s,"object"))return!0;if(t<n.length-1&&(o=(0,R.specializeForBaseClass)(o,s)),0===t&&N.ClassType.isTupleClass(e)){if(e.tupleTypeArguments&&o.tupleTypeArguments){const t=e.tupleTypeArguments;let n=t.length;const s=2===n&&(0,R.isEllipsisType)(t[1]);s&&(n=1);const c=n>0&&(0,N.isVariadicTypeVar)(t[n-1]),p=o.tupleTypeArguments;let d=p.length;const u=2===d&&(0,R.isEllipsisType)(p[1]);if(u&&(d=1),c&&u)return i&&i.addMessage(m.Localizer.DiagnosticAddendum.typeVarTupleRequiresKnownLength()),!1;if(!(p.length===n&&!u||s||c))return u?i&&i.addMessage(m.Localizer.DiagnosticAddendum.tupleSizeMismatchIndeterminate().format({expected:n})):i&&i.addMessage(m.Localizer.DiagnosticAddendum.tupleSizeMismatch().format({expected:n,received:p.length})),!1;{const o=Math.max(n,d);for(let h=0;h<o;h++){let o,y,g=!1;u?o=p[0]:h<p.length?o=p[h]:(o=N.AnyType.create(),e.isTypeArgumentExplicit&&c&&h<n-1&&!s&&(g=!0));let f=!1;if(c&&h>=n-1){if(y=t[n-1],Q&&(0,N.isInstantiableClass)(Q)){const e=p.slice(h);o=(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,e.map((e=>(0,R.stripLiteralValue)(e))),!0,!0,!0)),f=!0}}else y=s?t[0]:h<t.length?t[h]:N.AnyType.create();const T=null==i?void 0:i.createAddendum();if(g||!ii(y,o,null==T?void 0:T.createAddendum(),l,128|r,a+1))return T&&T.addMessage(m.Localizer.DiagnosticAddendum.tupleEntryTypeMismatch().format({entry:h+1})),!1;f&&(h=d)}}}return!0}if(0!==N.ClassType.getTypeParameters(s).length){if(!s.typeArguments)return!0;if(!ti(s,o,i,l,c,a))return!1;l=new M.TypeVarMap((0,R.getTypeVarScopeId)(s)),c&=-9}}if(e.typeArguments){if(!ti(e,o,i,s,r,a))return!1}else if(s&&e.details.typeParameters.length>0&&o.typeArguments&&!s.isLocked()){const t=o.typeArguments;for(let n=0;n<e.details.typeParameters.length;n++){const i=n<t.length?t[n]:N.UnknownType.create();s.setTypeVarType(e.details.typeParameters[n],void 0,i)}N.ClassType.isTupleClass(o)&&o.tupleTypeArguments&&e.details.typeParameters.length>=1&&s.setVariadicTypeVar(e.details.typeParameters[0],o.tupleTypeArguments)}return!0}(e,t,p,n,i,s,r+1);if(N.ClassType.isBuiltIn(e,"object")&&0==(1&s))return!0;const u=a?N.ClassType.cloneAsInstance(e):e,h=a?N.ClassType.cloneAsInstance(t):t;let y=yi(u),g=yi(h);return y===g&&e.details.fullName&&t.details.fullName&&(y=e.details.fullName,g=t.details.fullName),n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeIncompatible().format({sourceType:g,destType:y})),!1}function ei(e,t){if(!N.ClassType.isPropertyClass(e))return;const n=e.details.fields.get("fget");if(n){const e=$n(n);if(e&&(0,N.isFunction)(e))return qn(e,void 0,t)}}function ti(e,t,n,i,s,r){(0,o.assert)(N.ClassType.isSameGenericClass(e,t));const a=N.ClassType.getTypeParameters(e);let c,p;if(!e.typeArguments||!t.typeArguments)return!0;if(N.ClassType.isTupleClass(e)?(c=e.tupleTypeArguments||[],p=t.tupleTypeArguments):(c=e.typeArguments,p=t.typeArguments),p)for(let e=0;e<p.length;e++){const t=p[e],o=e>=c.length?c.length-1:e,d=o>=0?c[o]:N.UnknownType.create(),u=o<a.length?a[o]:void 0,h=new l.DiagnosticAddendum;if(u&&1!==u.details.variance){if(2===u.details.variance){if(!ii(t,d,h,i,2^s|128,r+1)){if(n){const e=n.createAddendum();e.addMessage(m.Localizer.DiagnosticAddendum.typeVarIsContravariant().format({name:N.TypeVarType.getReadableName(u)})),e.addAddendum(h)}return!1}}else if(!ii(d,t,h,i,129|s,r+1)){if(n){const e=n.createAddendum();e.addMessage(m.Localizer.DiagnosticAddendum.typeVarIsInvariant().format({name:N.TypeVarType.getReadableName(u)})),e.addAddendum(h)}return!1}}else if(!ii(d,t,h,i,128|s,r+1)){if(u&&n){const e=n.createAddendum();e.addMessage(m.Localizer.DiagnosticAddendum.typeVarIsCovariant().format({name:N.TypeVarType.getReadableName(u)})),e.addAddendum(h)}return!1}}return!0}function ni(e,t,n,i,s=0,r=0){var a;let o=!0;const c=0!=(2&s);if(!e.scopeId)return!0;if(!i.hasSolveForScope(e.scopeId)){if((0,N.isAnyOrUnknown)(t))return!0;if(o=!1,!e.details.isSynthesized)return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1}if(e.details.isParamSpec){if((0,N.isTypeVar)(t)&&t.details.isParamSpec){const n=i.getParamSpec(e);if(!n)return!i.isLocked()&&o&&i.setParamSpec(e,{flags:0,parameters:[],paramSpec:t}),!0;if(0===n.parameters.length&&n.paramSpec&&(0,N.isTypeSame)(n.paramSpec,t,void 0,void 0,r+1))return!0}else if((0,N.isFunction)(t)){const n=t,s=t.details.parameters.map(((e,t)=>({category:e.category,name:e.name,isNameSynthesized:e.isNameSynthesized,hasDefault:!!e.hasDefault,type:N.FunctionType.getEffectiveParameterType(n,t)}))),a=i.getParamSpec(e);if(!a)return!i.isLocked()&&o&&i.setParamSpec(e,{parameters:s,flags:t.details.flags,paramSpec:void 0}),!0;if(!a.paramSpec&&a.parameters.length===s.length&&!a.parameters.some(((e,t)=>{const n=s[t];return e.category!==n.category||e.name!==n.name||e.hasDefault!==n.hasDefault||!(0,N.isTypeSame)(e.type,n.type,void 0,void 0,r+1)})))return!0}else if((0,N.isAnyOrUnknown)(t))return!0;return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeParamSpec().format({type:yi(t),name:e.details.name})),!1}if(e.details.isVariadic){const e=(0,N.isClassInstance)(t)&&(0,R.isTupleClass)(t)&&!!t.isTupleForUnpackedVariadicTypeVar;(0,N.isVariadicTypeVar)(t)||e||(t=Q&&(0,N.isInstantiableClass)(Q)?(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,[t],!0,!0,!0)):N.UnknownType.create())}const p=i.getTypeVar(e),d=null==p?void 0:p.narrowBound,u=null!==(a=null==p?void 0:p.wideBound)&&void 0!==a?a:e.details.boundType;if(e.details.constraints.length>0){let s;const a=He(t);if((0,N.isTypeVar)(t))ii(e,a,void 0,new M.TypeVarMap(e.scopeId),void 0,r+1)&&(s=t,N.TypeBase.isInstantiable(t)&&(s=(0,R.convertToInstance)(t)));else{let t,n=!0;s=(0,R.mapSubtypes)(a,(i=>{let s,a;return(0,N.isAnyOrUnknown)(i)?i:(e.details.constraints.forEach(((t,n)=>{const o=N.TypeBase.isInstantiable(e)?(0,R.convertToInstantiable)(t):t;ii(o,i,void 0,void 0,void 0,r+1)&&(s&&!ii(s,o,void 0,void 0,void 0,r+1)||(s=(0,R.addConditionToType)(t,(0,R.getTypeCondition)(i)),a=n))})),s||c||(n=!1),void 0===a||(0,R.getTypeCondition)(i)||(void 0!==t&&t!==a&&(n=!1),t=a),s)})),!(0,N.isNever)(s)&&n||(s=void 0),!s&&(0,N.isUnion)(a)&&(s=e.details.constraints.find((t=>ii(N.TypeBase.isInstantiable(e)?(0,R.convertToInstantiable)(t):t,a,void 0,void 0,void 0,r+1))))}if(!s)return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:yi(t),name:e.details.name})),!1;if(d&&!(0,N.isAnyOrUnknown)(d)){if(!ii(d,s,void 0,void 0,void 0,r+1)){if(!ii(s,d,void 0,void 0,void 0,r+1))return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:yi(s),name:yi(d)})),!1;!i.isLocked()&&o&&i.setTypeVarType(e,s)}}else!i.isLocked()&&o&&i.setTypeVarType(e,s);return!0}let h=d,y=u;const g=n?new l.DiagnosticAddendum:void 0,f=0!=(128&s)||i.getRetainLiterals(e)||e.details.boundType&&(0,R.containsLiteralType)(e.details.boundType)||e.details.constraints.some((e=>(0,R.containsLiteralType)(e)));let T=f?t:(0,R.stripLiteralValue)(t);if(N.TypeBase.isInstantiable(e)){if(!N.TypeBase.isInstantiable(T))return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(T),destType:yi(e)})),!1;T=(0,R.convertToInstance)(T)}if(c||0!=(4&s)){if(u){if(!(0,N.isTypeSame)(u,T,void 0,void 0,r+1))if(ii(u,He(T),g,void 0,void 0,r+1))y=T;else if(!ii(T,u,g,void 0,void 0,r+1))return n&&g&&(n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(T),destType:yi(u)})),n.addAddendum(g)),!1}else y=T;if(d&&!ii(y,d,void 0,void 0,void 0,r+1))return n&&g&&(n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(T),destType:yi(d)})),n.addAddendum(g)),!1}else{if(d){if(!(0,N.isTypeSame)(d,T,void 0,void 0,r+1))if(ii(d,T,g,i,s,r+1))h=(0,R.isPartlyUnknown)(d)&&ii(T,d,void 0,i,void 0,r+1)?T:d;else{if(i.isLocked()||(0,N.isTypeVar)(T))return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(d),destType:yi(T)})),!1;if((0,N.isVariadicTypeVar)(e))return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(d),destType:yi(T)})),!1;h=ii(T,d,void 0,i,void 0,r+1)?T:(0,N.isUnion)(d)&&d.subtypes.length>64&&void 0!==e.details.boundType&&H&&(0,N.isClassInstance)(H)?(0,N.combineTypes)([d,H]):(0,N.combineTypes)([d,T])}}else h=T;if(u&&h&&!(0,N.isTypeSame)(u,h,void 0,void 0,r+1)){let e=!0;if((0,N.isTypeVar)(u)&&((0,N.isTypeSame)(h,u)||(0,N.isUnion)(h)&&h.subtypes.some((e=>(0,N.isTypeSame)(e,u))))&&(e=!1),!ii(e?He(u):u,h,void 0,i,void 0,r+1))return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(T),destType:yi(u)})),!1}}if(e.details.boundType){const s=h||y;if(N.TypeBase.isInstantiable(e)&&!N.TypeBase.isInstantiable(t))return!1;if(!ii(e.details.boundType,He(s),null==n?void 0:n.createAddendum(),i,void 0,r+1))return e.details.isSynthesized||n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeBound().format({sourceType:yi(s),destType:yi(e.details.boundType),name:N.TypeVarType.getReadableName(e)})),!1}return!i.isLocked()&&o&&i.setTypeVarType(e,h,y,f),!0}function ii(e,t,n,i,s=0,r=0){if(e=(0,R.transformPossibleRecursiveTypeAlias)(e),t=(0,R.transformPossibleRecursiveTypeAlias)(t),(0,N.isUnion)(e)&&1===e.subtypes.length&&(0,N.isVariadicTypeVar)(e.subtypes[0])&&(e=e.subtypes[0]),(0,N.isUnion)(t)&&1===t.subtypes.length&&(0,N.isVariadicTypeVar)(t.subtypes[0])&&(t=t.subtypes[0]),r>N.maxTypeRecursionCount)return!0;if(e===t)return!0;if((0,N.isUnbound)(e)||(0,N.isUnbound)(t))return!0;const a=s;if(s&=-69,(0,N.isTypeVar)(e)){if((0,N.isTypeSame)(e,(0,N.removeAnyFromUnion)(t),void 0,void 0,r+1))return!0;if(function(e,t,n){return!(0,N.findSubtype)(t,(t=>{var i;if((0,N.isTypeSame)(e,t,!0,void 0,n+1))return!1;const s=N.TypeVarType.getNameWithScope(e),r=(null!==(i=(0,R.getTypeCondition)(t))&&void 0!==i?i:[]).filter((e=>e.typeVarName===s));return 0===r.length||!r.some((i=>{if(e.details.boundType)return(0,o.assert)(0===i.constraintIndex),ii(e.details.boundType,t,void 0,void 0,void 0,n+1);if(e.details.constraints.length>0){(0,o.assert)(i.constraintIndex<e.details.constraints.length);const s=e.details.constraints[i.constraintIndex];return(0,o.assert)(void 0!==s),ii(s,t,void 0,void 0,void 0,n+1)}return(0,o.assert)(0===i.constraintIndex),!0}))}))}(e,t,r+1))return!0;if((0,N.isVariadicTypeVar)(e)&&(0,N.isClassInstance)(t)&&(0,R.isTupleClass)(t)&&t.tupleTypeArguments&&1===t.tupleTypeArguments.length&&(0,N.isTypeSame)(e,t.tupleTypeArguments[0],void 0,void 0,r+1))return!0;if(0==(2&s)||!(0,N.isTypeVar)(t))return 8&s?ii(He(e),He(t),n,void 0,a,r+1):!(!ni(e,t,n,null!=i?i:new M.TypeVarMap,a,r+1)||(0,N.isAnyOrUnknown)(t)&&0!=(16&s))}if((0,N.isTypeVar)(t)){if(0!=(2&s)){if(i&&i.hasSolveForScope((0,R.getTypeVarScopeId)(t))){if(ni(t,e,n,i,4|a,r+1))return!0;let s=!1;return(0,N.isUnion)(e)&&(0,R.doForEachSubtype)(e,(e=>{ni(t,e,n,i,4|a,r+1)&&(s=!0)})),s}return ii(He(e),He(t),n,void 0,a,r+1)}if(0!=(1&s)&&!(0,N.isAnyOrUnknown)(e))return n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1}if((0,N.isAnyOrUnknown)(e))return!0;if((0,N.isAnyOrUnknown)(t)){if(i){const n=(0,R.isEllipsisType)(t)?N.AnyType.create():t;(0,R.setTypeArgumentsRecursive)(e,n,i)}if(0==(16&s))return!0}if((0,N.isNever)(t))return i&&(0,R.setTypeArgumentsRecursive)(e,N.UnknownType.create(),i),!0;if((0,N.isUnion)(t)&&N.TypeBase.isSpecialForm(t)&&(t=K||H||N.AnyType.create()),(0,N.isUnion)(e))if((0,N.isUnion)(t)){if(si(e,t,void 0,i,a,r+1))return!0}else{const n=i?i.clone():void 0;if(ri(e,t,void 0,n,a,r+1))return i&&n&&i.copyFromClone(n),!0}const l=He(t);if((0,N.isUnion)(l))return si(e,l,n,i,a,r+1);if((0,N.isUnion)(e))return ri(e,t,n,i,a,r+1);if((0,N.isNone)(e)&&(0,N.isNone)(t))return N.TypeBase.isInstance(e)===N.TypeBase.isInstance(t);if((0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"type")){const a=t.typeArguments;if(a&&a.length>=1){if((0,N.isAnyOrUnknown)(a[0]))return!(!(0,N.isClassInstance)(e)||!N.ClassType.isBuiltIn(t,"type"))||N.TypeBase.isInstantiable(e);if((0,N.isClassInstance)(a[0])||(0,N.isTypeVar)(a[0]))return!!ii(e,(0,R.convertToInstantiable)(a[0]),null==n?void 0:n.createAddendum(),i,s,r+1)||(n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1)}}if((0,N.isInstantiableClass)(e)){const a=He(t);if((0,N.isInstantiableClass)(a))return!!Xn(e,a,n,i,s,r+1,!1)||(n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1)}if((0,N.isClassInstance)(e)){if(N.ClassType.isBuiltIn(e,"Type")){const a=e.typeArguments;if(a&&a.length>=1&&N.TypeBase.isInstance(a[0])&&N.TypeBase.isInstantiable(t))return ii(a[0],(0,R.convertToInstance)(t),n,i,s,r+1)}else if(N.ClassType.isBuiltIn(e,"type")){if(N.TypeBase.isInstantiable(t))return!0}else if(N.ClassType.isBuiltIn(e,"TypeGuard")&&0!=(64&a)&&(0,N.isClassInstance)(t)&&N.ClassType.isBuiltIn(t,"bool"))return!0;const o=He(t);if((0,N.isClass)(o)&&N.TypeBase.isInstance(o))return void 0===e.literalValue||void 0!==o.literalValue&&N.ClassType.isLiteralValueSame(o,e)?!!Xn(N.ClassType.cloneAsInstantiable(e),N.ClassType.cloneAsInstantiable(o),n,i,s,r+1,!0):(n&&n.addMessage(m.Localizer.DiagnosticAddendum.literalAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1);if((0,N.isFunction)(o)||(0,N.isOverloadedFunction)(o)){const t=oi(e);if(t)return ii(t,o,n,i,s,r+1);if(H&&(0,N.isClassInstance)(H))return ii(e,H,n,i,s,r+1)}else if((0,N.isModule)(o)){if(N.ClassType.isBuiltIn(e,"ModuleType"))return!0;if(N.ClassType.isProtocolClass(e))return Qn(N.ClassType.cloneAsInstantiable(e),o,n,i,s,r+1)}else if((0,N.isInstantiableClass)(o)){const t=oi(e);if(t)return ii(t,o,n,i,s,r+1);const a=o.details.effectiveMetaclass;if(a)return!!(0,N.isAnyOrUnknown)(a)||Xn(N.ClassType.cloneAsInstantiable(e),N.ClassType.isProtocolClass(e)?o:a,n,i,s,r+1,!1,!0)}else{if((0,N.isAnyOrUnknown)(o))return 0==(16&s);if((0,N.isUnion)(o))return ii(e,o,n,i,s,r+1)}}if((0,N.isFunction)(e)){let a,o=He(t);if((0,N.isClassInstance)(o)){const e=(0,R.lookUpObjectMember)(o,"__call__");if(e){const t=Yn(e);if((0,N.isFunction)(t)||(0,N.isOverloadedFunction)(t)){const e=ui(o,t,void 0,void 0,r+1);e&&(o=(0,R.removeParamSpecVariadicsFromSignature)(e))}}}if((0,N.isInstantiableClass)(o)&&void 0===o.literalValue){const e=ai(o);e&&(o=e)}if((0,N.isOverloadedFunction)(o)){if(e.details.paramSpec)return n&&n.addMessage(m.Localizer.DiagnosticAddendum.paramSpecOverload()),!1;const t=o.overloads,l=t.findIndex((t=>{if(!N.FunctionType.isOverloaded(t))return!1;const a=i?i.clone():void 0;return ii(e,t,null==n?void 0:n.createAddendum(),a,s,r+1)}));if(l<0)return n&&n.addMessage(m.Localizer.DiagnosticAddendum.noOverloadAssignable().format({type:yi(e)})),!1;a=t[l]}else if((0,N.isFunction)(o))a=o;else if((0,N.isAnyOrUnknown)(o))return 0==(16&s);if(a){if(i){const t=(0,R.getTypeVarScopeId)(e);t!==N.WildcardTypeVarScopeId&&i.addSolveForScope(t)}if(function(e,t,n,i,s,r){var a,o,l,c,p,d,u;let h=!0;const y=0==(32&s);s&=-33;const g=(0,R.getParameterListDetails)(e),f=(0,R.getParameterListDetails)(t);!function(e,t,n){if(void 0===n.variadicParamIndex)return;if(t.params.length<n.variadicParamIndex)return;if(void 0!==t.argsIndex)return;let i=t.params.findIndex(((e,t)=>t>=n.variadicParamIndex&&e.source===R.ParameterSource.KeywordOnly));i<0&&(i=t.params.length);let s=n.params.length;void 0!==n.kwargsIndex&&n.kwargsIndex>n.variadicParamIndex&&(s=n.kwargsIndex);const r=s-n.variadicParamIndex-1,a=t.params.slice(n.variadicParamIndex,i-r),o=a.map((t=>N.FunctionType.getEffectiveParameterType(e,t.index)));if(1!==o.length||!(0,N.isVariadicTypeVar)(o[0])){let e;e=Q&&(0,N.isInstantiableClass)(Q)?(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,o,!0,!0,!0)):N.UnknownType.create(),t.params=[...t.params.slice(0,n.variadicParamIndex),{param:{category:0,name:"_arg_combined",isNameSynthesized:!0,hasDeclaredType:!0,type:e},index:-1,source:R.ParameterSource.PositionOrKeyword},...t.params.slice(n.variadicParamIndex+a.length,t.params.length)],void 0!==t.kwargsIndex&&(t.kwargsIndex-=a.length-1),void 0!==t.firstKeywordOnlyIndex&&(t.firstKeywordOnlyIndex-=a.length-1)}}(t,f,g);const T=new M.TypeVarMap((0,R.getTypeVarScopeId)(t)),_=0!=(2&s)?!!t.details.paramSpec:!!e.details.paramSpec;if(!N.FunctionType.shouldSkipParamCompatibilityCheck(e)){const y=null!==(o=null!==(a=g.argsIndex)&&void 0!==a?a:g.firstKeywordOnlyIndex)&&void 0!==o?o:g.params.length,v=null!==(c=null!==(l=f.argsIndex)&&void 0!==l?l:f.firstKeywordOnlyIndex)&&void 0!==c?c:f.params.length,b=Math.min(y,v);for(let a=0;a<b;a++){const o=g.params[a],l=f.params[a],c=l.index>=0?N.FunctionType.getEffectiveParameterType(t,l.index):l.param.type,u=N.FunctionType.getEffectiveParameterType(e,o.index),y=null!==(p=o.param.name)&&void 0!==p?p:"",_=null!==(d=l.param.name)&&void 0!==d?d:"";!y||(0,x.isPrivateOrProtectedName)(y)||(0,x.isPrivateOrProtectedName)(_)||o.source===R.ParameterSource.PositionOnly||y===_||(n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.functionParamName().format({srcName:_,destName:y})),h=!1),o.param.hasDefault&&!l.param.hasDefault&&(n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.functionParamDefaultMissing().format({name:_})),h=!1),0===a&&"__init__"===t.details.name&&N.FunctionType.isInstanceMethod(t)&&"__init__"===e.details.name&&N.FunctionType.isInstanceMethod(e)&&N.FunctionType.isOverloaded(e)&&o.param.hasDeclaredType||li(u,c,a,null==n?void 0:n.createAddendum(),i,T,s,r)||0!=(256&s)&&(0,N.isTypeVar)(c)&&c.details.isSynthesized||(h=!1)}if(g.firstPositionOrKeywordIndex<f.positionOnlyParamCount&&!_&&(n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.argsPositionOnly().format({expected:f.positionOnlyParamCount,received:g.firstPositionOrKeywordIndex})),h=!1),void 0!==g.variadicArgsIndex){const a=[];y<v&&a.push(...f.params.slice(y,v).map((e=>e.param.type)));let o,l=!1;if(void 0!==f.argsIndex){const e=N.FunctionType.getEffectiveParameterType(t,f.params[f.argsIndex].index);(0,N.isVariadicTypeVar)(e)?a.push(e):l=!0}if(o=1===a.length&&(0,N.isVariadicTypeVar)(a[0])?a[0]:Q&&(0,N.isInstantiableClass)(Q)?(0,R.convertToInstance)((0,R.specializeTupleClass)(Q,a,!0,!0,!0)):N.UnknownType.create(),l)n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.argsParamWithVariadic().format({paramName:f.params[f.argsIndex].param.name})),h=!1;else if(void 0!==g.argsIndex){const t=g.params[g.argsIndex].index;li(N.FunctionType.getEffectiveParameterType(e,t),o,t,null==n?void 0:n.createAddendum(),i,T,s,r)||(h=!1)}}else if(y<v){if(!_){const a=f.params.filter((e=>!!e.param.name&&!e.param.hasDefault&&0===e.param.category)).length;if(void 0===g.argsIndex)y<a&&g.firstPositionOrKeywordIndex>0&&g.firstPositionOrKeywordIndex<v&&(n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.functionTooFewParams().format({expected:a,received:y})),h=!1);else{const a=N.FunctionType.getEffectiveParameterType(e,g.params[g.argsIndex].index);if(!(0,N.isAnyOrUnknown)(a))for(let e=y;e<v;e++)li(a,N.FunctionType.getEffectiveParameterType(t,f.params[e].index),e,null==n?void 0:n.createAddendum(),i,T,s,r)||(h=!1)}}}else if(v<y)if(void 0!==f.argsIndex){const a=N.FunctionType.getEffectiveParameterType(t,f.params[f.argsIndex].index);for(let t=v;t<y;t++){const o=N.FunctionType.getEffectiveParameterType(e,g.params[t].index);(0,N.isVariadicTypeVar)(o)&&!(0,N.isVariadicTypeVar)(a)?(n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeVarTupleRequiresKnownLength()),h=!1):li(o,a,t,null==n?void 0:n.createAddendum(),i,T,s,r)||(h=!1)}}else n&&n.addMessage(m.Localizer.DiagnosticAddendum.functionTooManyParams().format({expected:v,received:y})),h=!1;if(void 0!==f.argsIndex&&void 0!==g.argsIndex){const a=f.params[f.argsIndex].index,o=N.FunctionType.getEffectiveParameterType(t,a),l=g.params[g.argsIndex].index;li(N.FunctionType.getEffectiveParameterType(e,l),o,l,null==n?void 0:n.createAddendum(),i,T,s,r)||(h=!1)}if(void 0!==f.argsIndex||void 0===g.argsIndex||void 0!==g.variadicArgsIndex||_||(n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.argsParamMissing().format({paramName:null!==(u=g.params[g.argsIndex].param.name)&&void 0!==u?u:""})),h=!1),!_){const a=new Map;void 0!==g.firstKeywordOnlyIndex&&g.params.forEach(((e,t)=>{t>=g.firstKeywordOnlyIndex&&e.param.name&&0===e.param.category&&a.set(e.param.name,e.param)}));let o=void 0!==f.firstKeywordOnlyIndex?f.firstKeywordOnlyIndex:f.params.length;if(y<v&&void 0===g.argsIndex&&(o=y),o>=0&&f.params.forEach(((t,l)=>{if(l>=o&&t.param.name&&0===t.param.category){const o=a.get(t.param.name),l=null==n?void 0:n.createAddendum();if(o){const e=i?(0,R.applySolvedTypeVars)(o.type,i):o.type;ii(t.param.type,e,null==l?void 0:l.createAddendum(),void 0,s,r+1)||(l&&l.addMessage(m.Localizer.DiagnosticAddendum.namedParamTypeMismatch().format({name:t.param.name,sourceType:yi(e),destType:yi(t.param.type)})),h=!1),o.hasDefault&&!t.param.hasDefault&&(n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.functionParamDefaultMissing().format({name:t.param.name})),h=!1),a.delete(t.param.name)}else if(void 0!==g.kwargsIndex||t.param.hasDefault){if(void 0!==g.kwargsIndex){const a=g.params[g.kwargsIndex].index;li(N.FunctionType.getEffectiveParameterType(e,a),t.param.type,a,null==n?void 0:n.createAddendum(),i,T,s,r)||(h=!1)}}else l&&l.addMessage(m.Localizer.DiagnosticAddendum.namedParamMissingInDest().format({name:t.param.name})),h=!1}})),a.forEach(((o,l)=>{if(void 0!==f.kwargsIndex&&o.name){const l=f.params[f.kwargsIndex].index,c=N.FunctionType.getEffectiveParameterType(t,l);li(o.type,c,e.details.parameters.findIndex((e=>e===o)),null==n?void 0:n.createAddendum(),i,T,s,r)||(h=!1),a.delete(o.name)}else n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.namedParamMissingInSource().format({name:l})),h=!1})),void 0!==f.kwargsIndex&&void 0!==g.kwargsIndex){const a=f.params[f.kwargsIndex].index,o=N.FunctionType.getEffectiveParameterType(t,a),l=g.params[g.kwargsIndex].index;li(N.FunctionType.getEffectiveParameterType(e,l),o,l,null==n?void 0:n.createAddendum(),i,T,s,r)||(h=!1)}void 0===f.kwargsIndex&&void 0!==g.kwargsIndex&&(n&&n.createAddendum().addMessage(m.Localizer.DiagnosticAddendum.kwargsParamMissing().format({paramName:g.params[g.kwargsIndex].param.name})),h=!1)}}if(i&&!i.isLocked()&&(T.getTypeVars().forEach((e=>{ii(e.typeVar,T.getTypeVarType(e.typeVar),void 0,i)})),i.getTypeVars().forEach((e=>{if(e.narrowBound){const t=(0,R.applySolvedTypeVars)(e.narrowBound,i);t!==e.narrowBound&&i.setTypeVarType(e.typeVar,t,e.wideBound,e.retainLiteral)}})),_)){const n=0==(2&s)?e:t,r=0==(2&s)?t:e;n.details.paramSpec&&i.setParamSpec(n.details.paramSpec,{parameters:r.details.parameters.map(((e,t)=>({category:e.category,name:e.name,isNameSynthesized:e.isNameSynthesized,hasDefault:!!e.hasDefault,type:N.FunctionType.getEffectiveParameterType(r,t)}))).slice(n.details.parameters.filter((e=>e.name)).length,r.details.parameters.length),flags:r.details.flags,paramSpec:r.details.paramSpec?(0,R.convertToInstance)(r.details.paramSpec):void 0})}if(y){const a=qn(e);if(!(0,N.isAnyOrUnknown)(a)){const e=(0,R.applySolvedTypeVars)(qn(t),T),o=null==n?void 0:n.createAddendum();let l=!1;((0,R.isNoReturnType)(e)||ii(a,e,null==o?void 0:o.createAddendum(),i,s,r+1)||(0,N.isClassInstance)(e)&&N.ClassType.isBuiltIn(e,"TypeGuard")&&J&&(0,N.isInstantiableClass)(J)&&ii(a,N.ClassType.cloneAsInstance(J),null==o?void 0:o.createAddendum(),i,s,r+1))&&(l=!0),l||(o&&o.addMessage(m.Localizer.DiagnosticAddendum.functionReturnTypeMismatch().format({sourceType:yi(e),destType:yi(a)})),h=!1)}}return h}(e,a,null==n?void 0:n.createAddendum(),null!=i?i:new M.TypeVarMap((0,R.getTypeVarScopeId)(e)),s,r+1))return!0}}if((0,N.isOverloadedFunction)(e)){const a=null==n?void 0:n.createAddendum();return!e.overloads.some((e=>!!N.FunctionType.isOverloaded(e)&&(i&&i.addSolveForScope((0,R.getTypeVarScopeId)(e)),!ii(e,t,null==a?void 0:a.createAddendum(),i||new M.TypeVarMap((0,R.getTypeVarScopeId)(e)),s,r+1))))||(a&&a.addMessage(m.Localizer.DiagnosticAddendum.overloadNotAssignable().format({name:e.overloads[0].details.name})),!1)}return!(!(0,N.isClassInstance)(e)||!N.ClassType.isBuiltIn(e,"object")||0!=(1&s))||((0,N.isNone)(t)&&(0,N.isClassInstance)(e)&&N.ClassType.isProtocolClass(e)&&q&&(0,N.isInstantiableClass)(q)?Zn(N.ClassType.cloneAsInstantiable(e),q,n,i,s,!1,r+1):(0,N.isNone)(e)?(n&&n.addMessage(m.Localizer.DiagnosticAddendum.assignToNone()),!1):(n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1))}function si(e,t,n,i,s,r){if((0,N.isTypeSame)(t,e,void 0,void 0,r+1))return!0;if(1&s&&(0,N.isUnion)(e)){const a=[];let o=[...t.subtypes],l=!1;if(e.subtypes.forEach((e=>{if((0,R.requiresSpecialization)(e))a.push(e);else{const t=o.findIndex((t=>(0,N.isTypeSame)(t,e,void 0,void 0,r+1)));t>=0?o.splice(t,1):l=!0}})),l||[...o].forEach((e=>{const t=a.findIndex((t=>(0,N.isClass)(e)&&(0,N.isClass)(t)&&N.TypeBase.isInstance(e)===N.TypeBase.isInstance(t)&&N.ClassType.isSameGenericClass(e,t)));t>=0&&(ii(a[t],e,null==n?void 0:n.createAddendum(),i,s,r+1)||(l=!0),a.splice(t,1),o=o.filter((t=>t!==e)))})),l||0===a.length&&0===o.length||1===a.length&&(0,N.isTypeVar)(a[0])&&ii(a[0],(0,N.combineTypes)(o),null==n?void 0:n.createAddendum(),i,s,r+1)||(l=!0),!l)return!0}if(0!=(4&s)&&(0,N.isUnion)(e)){const n=e.subtypes.filter((e=>!(0,N.isAnyOrUnknown)(e)));if(1===n.length&&(0,N.isTypeVar)(n[0]))return ii(n[0],t,void 0,i,s,r+1),!0}let a=!1;return(0,R.doForEachSubtype)(t,(t=>{ii(e,t,void 0,i,s,r+1)||ii(e,He(t),null==n?void 0:n.createAddendum(),i,s,r+1)||(a=!0)})),!a||(n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1)}function ri(e,t,n,i,s,r){if(1&s){let a=!1;return(0,R.doForEachSubtype)(e,((o,l)=>{if(!a&&!ii(o,t,null==n?void 0:n.createAddendum(),i,s,r+1)){let t=!1;(0,N.isAnyOrUnknown)(o)||(0,R.doForEachSubtype)(e,((e,n)=>{l===n||t||ii(e,o,void 0,void 0,0,r+1)&&(t=!0)})),t||(a=!0)}})),!a||(n&&n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),!1)}const a=n?new l.DiagnosticAddendum:void 0;let o=!1;if((0,N.isNone)(t)&&(0,R.isOptionalType)(e))o=!0;else{let n,l;if((0,N.isClassInstance)(t)&&(0,R.isLiteralType)(t)&&N.UnionType.containsType(e,t,r+1))return!0;(0,R.doForEachSubtype)(e,(e=>{const c=null==i?void 0:i.clone();if(ii(e,t,null==a?void 0:a.createAddendum(),c,s,r+1)&&(o=!0,c)){const e=c.getScore();(void 0===l||l<=e)&&(l=e,n=c)}})),i&&n&&i.copyFromClone(n)}return o||(0,N.isTypeVar)(t)&&t.details.constraints.length>0&&(o=ii(e,He(t),null==a?void 0:a.createAddendum(),i,s,r+1)),!!o||(n&&a&&(n.addMessage(m.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:yi(t),destType:yi(e)})),n.addAddendum(a)),!1)}function ai(e){const t=(0,R.lookUpClassMember)(e,"__init__",12);if(t){const n=Yn(t),i=N.ClassType.cloneAsInstance(e),s=e=>{let t=ui(i,e);return t&&(t=N.FunctionType.clone(t),t.details.declaredReturnType=i,t.specializedTypes&&(t.specializedTypes.returnType=i)),t};if((0,N.isFunction)(n))return s(n);if((0,N.isOverloadedFunction)(n)){const e=[];if(n.overloads.forEach((t=>{const n=s(t);n&&e.push(n)})),0===e.length)return;return 1===e.length?e[0]:N.OverloadedFunctionType.create(e)}}const n=(0,R.lookUpClassMember)(e,"__new__",12);if(n){const t=Yn(n),i=t=>ui(e,t,void 0,void 0,void 0,!0);if((0,N.isFunction)(t))return i(t);if((0,N.isOverloadedFunction)(t)){const e=[];if(t.overloads.forEach((t=>{const n=i(t);n&&e.push(n)})),0===e.length)return;return 1===e.length?e[0]:N.OverloadedFunctionType.create(e)}}const i=N.FunctionType.createInstance("__new__","","",65);return i.details.declaredReturnType=N.ClassType.cloneAsInstance(e),N.FunctionType.addDefaultParameters(i),i}function oi(e){if(!(0,N.isClassInstance)(e)||!N.ClassType.isProtocolClass(e))return;for(const t of e.details.mro)if((0,N.isClass)(t)&&N.ClassType.isProtocolClass(t))for(const e of t.details.fields)if("__call__"!==e[0]&&!e[1].isIgnoredForProtocolMatch()){let t=!1;if(Z&&(0,N.isClass)(Z)&&Z.details.fields.has(e[0])&&(t=!0),!t)return}const t=(0,R.lookUpObjectMember)(e,"__call__");if(!t)return;const n=Yn(t);if((0,N.isFunction)(n)||(0,N.isOverloadedFunction)(n)){const t=ui(e,n);if(t)return(0,R.removeParamSpecVariadicsFromSignature)(t)}}function li(e,t,n,i,s,r,a,o){if((0,N.isTypeVar)(e)&&e.details.isSynthesized&&e.details.boundType&&(0,N.isClassInstance)(e.details.boundType)&&N.ClassType.isProtocolClass(e.details.boundType))return!0;let l=(0,R.applySolvedTypeVars)(e,s);if((0,R.requiresSpecialization)(l)){if(!ii(t,l,void 0,s,2^a,o+1))return i&&i.addMessage(m.Localizer.DiagnosticAddendum.paramAssignment().format({index:n+1,sourceType:yi(e),destType:yi(t)})),!1;l=(0,R.applySolvedTypeVars)(e,s)}return!!ii(t,l,null==i?void 0:i.createAddendum(),r,a,o+1)||(i&&i.addMessage(m.Localizer.DiagnosticAddendum.paramAssignment().format({index:n+1,sourceType:yi(e),destType:yi(t)})),!1)}function ci(e,t){if(t.details.typeParameters.length>0&&t.typeArguments&&t.typeArguments.length<=t.details.typeParameters.length){const n=new M.TypeVarMap((0,R.getTypeVarScopeId)(t));Ct(N.ClassType.cloneForSpecialization(t,void 0,!1),N.ClassType.cloneAsInstance(e),n,[]);let i=!1;const s=t.typeArguments.map(((e,s)=>{const r=t.details.typeParameters[s],a=n.getTypeVarType(r);return a&&((0,N.isAny)(a)||(0,N.isAnyOrUnknown)(e))?(i=!0,a):e}));if(i)return N.ClassType.cloneForSpecialization(t,s,!0)}}function pi(e,t){const n=new l.DiagnosticAddendum,i=(0,R.mapSubtypes)(t,(t=>{const i=(0,R.mapSubtypes)(e,(i=>{if((0,N.isAnyOrUnknown)(e))return e;if(ii(i,t,n)){if((0,N.isInstantiableClass)(i)&&(0,N.isInstantiableClass)(t)){const e=ci(i,t);e&&(t=e)}else if((0,N.isClassInstance)(i)&&(0,N.isClassInstance)(t)){const e=ci(N.ClassType.cloneAsInstantiable(i),N.ClassType.cloneAsInstantiable(t));e&&(t=N.ClassType.cloneAsInstance(e))}else if((0,N.isAnyOrUnknown)(t))return e;return t}}));return(0,N.isNever)(i)?t:i}));return(0,N.isAnyOrUnknown)(t)?e:i}function di(e){const t=new Map;e.details.mro.forEach((e=>{(0,N.isInstantiableClass)(e)&&e.details.fields.forEach(((n,i)=>{if(n.isClassMember()){let s;const r=(0,A.getLastTypedDeclaredForSymbol)(n);s=!(!r||3!==r.type)&&!!(8&on(r.node,!0)),t.has(i)||t.set(i,{symbol:n,symbolName:i,isAbstract:s,classType:e})}}))}));const n=[];return t.forEach((e=>{e.isAbstract&&n.push(e)})),n}function ui(e,t,n,i,s=0,r=!1,a){if((0,N.isFunction)(t)){if(!e)return N.FunctionType.clone(t,!0);if(N.FunctionType.isInstanceMethod(t)){const r=(0,N.isClassInstance)(e)?e:N.ClassType.cloneAsInstance((0,R.specializeClassType)(e));return mi(e,t,n||N.ClassType.cloneAsInstantiable(r),i,s+1,a||r,(0,N.isClassInstance)(e))}if(N.FunctionType.isClassMethod(t)||r&&N.FunctionType.isConstructorMethod(t)){const r=(0,N.isInstantiableClass)(e)?e:N.ClassType.cloneAsInstantiable(e),o=a?(0,N.isInstantiableClass)(e)?a:(0,R.convertToInstantiable)(a):r;return mi(N.TypeBase.isInstance(e)?N.ClassType.cloneAsInstantiable(e):e,t,n||r,i,s+1,o,!0)}if(N.FunctionType.isStaticMethod(t)){const r=(0,N.isInstantiableClass)(e)?e:N.ClassType.cloneAsInstantiable(e);return mi(N.TypeBase.isInstance(e)?N.ClassType.cloneAsInstantiable(e):e,t,n||r,i,s+1,void 0,!1)}}else if((0,N.isOverloadedFunction)(t)){const o=N.OverloadedFunctionType.create();return t.overloads.forEach((t=>{if(N.FunctionType.isOverloaded(t)){const i=ui(e,t,n,void 0,s+1,r,a);i&&N.OverloadedFunctionType.addOverload(o,i)}})),1===o.overloads.length?o.overloads[0]:0===o.overloads.length?void(i&&t.overloads.forEach((t=>{ui(e,t,n,i,s+1,r,a)}))):o}return t}function mi(e,t,n,i,s,r,a=!0){const o=new M.TypeVarMap((0,R.getTypeVarScopeId)(n));if(r&&t.details.parameters.length>0){const n=t.details.parameters[0],a=N.FunctionType.getEffectiveParameterType(t,0),p=(0,R.stripLiteralValue)(r);o.addSolveForScope((0,R.getTypeVarScopeId)(t));const d=new l.DiagnosticAddendum;if((0,N.isTypeVar)(a)&&a.details.boundType&&(0,N.isClassInstance)(a.details.boundType)&&N.ClassType.isProtocolClass(a.details.boundType))o.isLocked()||o.setTypeVarType(a,N.TypeBase.isInstantiable(a)?(0,R.convertToInstance)(p):p);else if(!ii(a,p,d,o,void 0,s+1)&&n.name&&!n.isNameSynthesized&&n.hasDeclaredType){if(!i)return;{const s=t.details.name||"(unnamed)";$e(f.getFileInfo(i).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.bindTypeMismatch().format({type:yi(e),methodName:s,paramName:n.name})+d.getString(),i)}}}qn(t);const p=(0,R.applySolvedTypeVars)(t,o);return N.FunctionType.clone(p,a,e,(0,R.getTypeVarScopeId)(e))}function hi(e){return w.printObjectTypeForClass(e,t.printTypeFlags,qn)}function yi(e,n=!1){let i=t.printTypeFlags;return n&&(i|=32),w.printType(e,i,qn)}const gi={runWithCancellationToken:function(e,t){try{return G=e,t()}finally{G=void 0}},getType:ge,getTypeOfExpression:Te,getTypeOfAnnotation:ve,getTypeOfClass:en,getTypeOfFunction:nn,getTypeForExpressionExpectingType:En,getExpectedType:function(e){bn(e);let t=e;for(;void 0!==t;){const e=z.get(t.id);if(e)return{type:e,node:t};t=t.parent}},evaluateTypeForSubnode:Sn,evaluateTypesForStatement:Cn,evaluateTypesForMatchNode:function(e){if(oe(e))return;const t=Te(e.subjectExpression);let n=t.type;for(const t of e.cases)t.guardExpression||(n=(0,S.narrowTypeBasedOnPattern)(gi,n,t.pattern,!1));le(e,n,!!t.isIncomplete)},evaluateTypesForCaseNode:Tn,evaluateTypeOfParameter:In,canBeTruthy:Ce,canBeFalsy:Ie,removeTruthinessFromType:Se,removeFalsinessFromType:Fe,verifyRaiseExceptionType:function(e){const t=wn(e,"BaseException");if(e.typeExpression){const n=Te(e.typeExpression).type;if(n&&t&&(0,N.isInstantiableClass)(t)){const i=new l.DiagnosticAddendum;(0,R.doForEachSubtype)(n,(n=>{const s=He(n);if(!(0,N.isAnyOrUnknown)(s))if((0,N.isInstantiableClass)(s)&&void 0===s.literalValue)if((0,R.derivesFromClassRecursive)(s,t,!1)){let t;Mn(e.typeExpression,(()=>{t=vt(e.typeExpression,[],s,!1,void 0)})),t&&t.argumentErrors&&i.addMessage(m.Localizer.Diagnostic.exceptionTypeNotInstantiable().format({type:yi(n,!1)}))}else i.addMessage(m.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:yi(n,!1)}));else(0,N.isClassInstance)(s)&&(0,R.derivesFromClassRecursive)(N.ClassType.cloneAsInstantiable(s),t,!1)||i.addMessage(m.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:yi(n,!1)}))})),i.isEmpty()||$e(f.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,m.Localizer.Diagnostic.expectedExceptionClass()+i.getString(),e.typeExpression)}}},verifyDeleteExpression:Qe,isAfterNodeReachable:Ve,isNodeReachable:Le,suppressDiagnostics:Mn,getDeclarationsForNameNode:function(e){var t;if(f.isCodeUnreachable(e))return;const n=[];if(e.parent&&23===e.parent.nodeType&&e.parent.alias&&e===e.parent.name){const t=F.getScopeForNode(e);if(t){const i=t.lookUpSymbolRecursive(e.parent.alias.value);if(i){const t=i.symbol.getDeclarations().filter((t=>6===t.type&&t.node===e.parent));n.push(...(0,b.getDeclarationsWithUsesLocalNameRemoved)(t))}}}else if(e.parent&&35===e.parent.nodeType&&e===e.parent.memberName){let t=ge(e.parent.leftExpression);if(t){t=He(t);const i=e.parent.memberName.value;(0,R.doForEachSubtype)(t,(e=>{let t;if(e=He(e),(0,N.isInstantiableClass)(e)){let n=(0,R.lookUpClassMember)(e,i,16);if(n||(n=(0,R.lookUpClassMember)(e,i)),!n){const t=e.details.effectiveMetaclass;t&&(0,N.isInstantiableClass)(t)&&(n=(0,R.lookUpClassMember)(t,i))}n&&(t=n.symbol)}else if((0,N.isClassInstance)(e)){let n=(0,R.lookUpObjectMember)(e,i,16);n||(n=(0,R.lookUpObjectMember)(e,i)),n&&(t=n.symbol)}else(0,N.isModule)(e)&&(t=N.ModuleType.getField(e,i));if(t){const e=t.getTypedDeclarations();e.length>0?n.push(...e):n.push(...t.getDeclarations())}}))}}else if(e.parent&&37===e.parent.nodeType){const t=e.parent.nameParts.findIndex((t=>t===e)),i=f.getImportInfo(e.parent);t>=0&&i&&!i.isNativeLib&&t<i.resolvedPaths.length&&i.resolvedPaths[t]&&(Cn(e),n.push((0,b.createSynthesizedAliasDeclaration)(i.resolvedPaths[t])))}else if(e.parent&&1===e.parent.nodeType&&e===e.parent.name){const i=e.parent,s=e.value;if(i.parent&&9===i.parent.nodeType){const e=Te(i.parent.leftExpression).type;if(e)if((0,N.isFunction)(e)&&e.details.declaration){const t=Ln(e,s);t&&n.push(t)}else if((0,N.isOverloadedFunction)(e))e.overloads.forEach((e=>{const t=Ln(e,s);t&&n.push(t)}));else if((0,N.isInstantiableClass)(e)){const r=null===(t=De(i.parent.leftExpression,N.ClassType.cloneAsInstance(e),"__init__",{method:"get"},void 0,4))||void 0===t?void 0:t.type;if(r&&(0,N.isFunction)(r)){const t=Ln(r,s);if(t)n.push(t);else if(N.ClassType.isDataClass(e)){const t=(0,R.lookUpClassMember)(e,s);t&&n.push(...t.symbol.getDeclarations())}}}}}else{const t=f.getFileInfo(e),i=C.isWithinTypeAnnotation(e,!_e(f.getFileInfo(e))),s=i||t.isStubFile,r=Rn(e,e.value,!s,i);r&&n.push(...r.symbol.getDeclarations())}return n},getTypeForDeclaration:Vn,resolveAliasDeclaration:zn,resolveAliasDeclarationWithInfo:Bn,getTypeFromIterable:Re,getTypeFromIterator:Ne,getGetterTypeFromProperty:ei,markNamesAccessed:function(e,t){const n=f.getFileInfo(e),i=F.getScopeForNode(e);i&&t.forEach((t=>{const s=i.lookUpSymbolRecursive(t);s&&Je(n,s.symbol,e)}))},getScopeIdForNode:it,makeTopLevelTypeVarsConcrete:He,mapSubtypesExpandTypeVars:Ye,populateTypeVarMapBasedOnExpectedType:Ct,lookUpSymbolRecursive:Rn,getDeclaredTypeOfSymbol:$n,getEffectiveTypeOfSymbol:Wn,getEffectiveTypeOfSymbolForUsage:jn,getInferredTypeOfDeclaration:Un,getDeclaredTypeForExpression:Ee,getFunctionDeclaredReturnType:Hn,getFunctionInferredReturnType:Kn,getBestOverloadForArguments:function(e,t,n){let i;return t.overloads.forEach((t=>{i||On(e,(()=>{if(N.FunctionType.isOverloaded(t)){const s=Ft(e,n,t);if(!s.argumentErrors){const n=Dt(e,s,t,new M.TypeVarMap((0,R.getTypeVarScopeId)(t)),!0,void 0);n&&!n.argumentErrors&&(i=t)}}}))})),i},getBuiltInType:wn,getTypeOfMember:Yn,getTypeFromObjectMember:De,getBoundMethod:xe,getTypeFromMagicMethodReturn:Ot,bindFunctionToClassOrObject:ui,getCallSignatureInfo:function(e,t,n){const i=e.leftExpression,s=ge(i);if(void 0===s)return;const r=[];let a=0;function o(){r.push({argumentCategory:a,type:N.UnknownType.create(),active:!0})}e.arguments.forEach(((e,i)=>{let s=!1;i===t&&(n?s=!0:o()),a=e.argumentCategory,r.push({valueExpression:e.valueExpression,argumentCategory:e.argumentCategory,name:e.name,active:s})})),e.arguments.length<t&&o();const l=[];function c(t){let n;On(e,(()=>{n=Pt(i,r,t,new M.TypeVarMap((0,R.getTypeVarScopeId)(t)),!0)})),l.push({type:t,activeParam:null==n?void 0:n.activeParam})}function p(e){(0,N.isFunction)(e)?c(e):e.overloads.forEach((e=>{N.FunctionType.isOverloaded(e)&&c(e)}))}return(0,R.doForEachSubtype)(s,(e=>{switch(e.category){case 5:case 6:p(e);break;case 7:if(N.TypeBase.isInstantiable(e)){let t;t=xe(e,"__init__");const n=!!t&&(0,N.isFunction)(t)&&"builtins.object.__init__"===t.details.fullName,i=!!t&&(0,N.isFunction)(t)&&N.FunctionType.isSkipConstructorCheck(t);if(!t||n||i){const n=xe(e,"__new__",!0);n&&((0,N.isFunction)(n)&&"builtins.object.__new__"===n.details.fullName||(t=n))}t&&p(t)}else{const t=xe(e,"__call__");t&&p(t)}}})),0!==l.length?{callNode:e,signatures:l}:void 0},getTypeAnnotationForParameter:Ae,getAbstractMethods:di,canAssignType:ii,canOverrideMethod:function(e,t,n,i=!0){if((0,N.isOverloadedFunction)(e)&&(e=e.overloads[e.overloads.length-1]),!(0,N.isFunction)(e))return n.addMessage(m.Localizer.DiagnosticAddendum.overrideType().format({type:yi(e)})),!1;let s=!0;const r=e.details.parameters,a=t.details.parameters,o=a.find((e=>1===e.category&&!!e.name)),l=a.find((e=>2===e.category&&!!e.name));let c=!1;if(a.length<r.length)o&&l||(c=!0);else if(a.length>r.length)for(let e=r.length;e<a.length;e++){const t=a[e];0===t.category&&t.name&&!t.hasDefault&&(c=!0)}c&&(n.addMessage(m.Localizer.DiagnosticAddendum.overrideParamCount().format({baseCount:r.length,overrideCount:a.length})),s=!1);const p=Math.min(r.length,a.length),d=r.findIndex((e=>!e.name&&0===e.category));for(let o=0;o<p;o++){if(0===o&&(N.FunctionType.isInstanceMethod(t)||N.FunctionType.isClassMethod(t)||N.FunctionType.isConstructorMethod(t)))continue;const l=r[o],c=a[o];if(o>d&&!(0,x.isPrivateOrProtectedName)(l.name||"")&&0===l.category&&l.name!==c.name)0===c.category&&i&&(n.addMessage(m.Localizer.DiagnosticAddendum.overrideParamName().format({index:o+1,baseName:l.name||"*",overrideName:c.name||"*"})),s=!1);else{const i=N.FunctionType.getEffectiveParameterType(e,o),r=N.FunctionType.getEffectiveParameterType(t,o),a=(0,N.isTypeVar)(i)&&i.details.isSynthesized,p=(0,N.isTypeVar)(r)&&r.details.isSynthesized;a||p||l.category===c.category&&ii(r,i,n.createAddendum(),void 0,8)||(n.addMessage(m.Localizer.DiagnosticAddendum.overrideParamType().format({index:o+1,baseType:yi(i),overrideType:yi(r)})),s=!1)}}const u=qn(e),h=qn(t);return ii(u,h,n.createAddendum(),void 0,8)||(n.addMessage(m.Localizer.DiagnosticAddendum.overrideReturnType().format({baseType:yi(u),overrideType:yi(h)})),s=!1),s},canAssignProtocolClassToSelf:function e(t,n,i=0){(0,o.assert)(N.ClassType.isProtocolClass(t)),(0,o.assert)(N.ClassType.isProtocolClass(n)),(0,o.assert)(N.ClassType.isSameGenericClass(t,n)),(0,o.assert)(t.details.typeParameters.length>0);const s=new l.DiagnosticAddendum,r=new M.TypeVarMap;let a=!0;return t.details.fields.forEach(((e,l)=>{if(a&&e.isClassMember()&&!e.isIgnoredForProtocolMatch()){const c=(0,R.lookUpClassMember)(n,l);(0,o.assert)(void 0!==c);let p=$n(e);if(p){const o=Yn(c);if(p=(0,R.partiallySpecializeType)(p,t),(0,N.isClassInstance)(p)&&N.ClassType.isPropertyClass(p)&&(0,N.isClassInstance)(o)&&N.ClassType.isPropertyClass(o))Jn(N.ClassType.cloneAsInstantiable(p),N.ClassType.cloneAsInstantiable(o),n,s,r,i+1)||(a=!1);else{const t=e.getDeclarations()[0],n=1!==(null==t?void 0:t.type)||t.isFinal?0:1;ii(p,o,s,r,n,i+1)||(a=!1)}}}})),t.details.baseClasses.forEach((s=>{(0,N.isInstantiableClass)(s)&&N.ClassType.isProtocolClass(s)&&!N.ClassType.isBuiltIn(s,"object")&&!N.ClassType.isBuiltIn(s,"Protocol")&&s.details.typeParameters.length>0&&(e((0,R.specializeForBaseClass)(t,s),(0,R.specializeForBaseClass)(n,s),i+1)||(a=!1))})),a},assignTypeToExpression:Ze,getBuiltInObject:Nn,getTypingType:Me,addError:Be,addWarning:function(e,t,n){return We("warning",e,t,n)},addInformation:ze,addUnusedCode:function(e,t){je(e)||f.getFileInfo(e).diagnosticSink.addUnusedCodeWithTextRange(m.Localizer.Diagnostic.unreachableCode(),t)},addDeprecated:function(e,t){je(t)||f.getFileInfo(t).diagnosticSink.addDeprecatedWithTextRange(e,t)},addDiagnostic:$e,addDiagnosticForTextRange:function(e,t,n,i,s){if("none"===t)return;const r=e.diagnosticSink.addDiagnosticWithTextRange(t,i,s);return n&&r.setRule(n),r},printType:yi,printFunctionParts:function(e){return w.printFunctionParts(e,t.printTypeFlags,qn)},getTypeCacheSize:function(){return r.size},useSpeculativeMode:On,checkForCancellation:ae},fi=(0,T.getCodeFlowEngine)(gi,B);return gi}},558:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTypeEvaluatorWithTracker=void 0;const i=n(2489),s=n(8718),r=n(7887);t.createTypeEvaluatorWithTracker=function(e,t,n,a){if(!t.logCalls&&(0,i.isDebugMode)())return(0,r.createTypeEvaluator)(e,t);function o(e,i,r){return t.logCalls?n.log(e,(e=>(e.add(null==a?void 0:a.print(r)),s.timingStats.typeEvaluationTime.timeOperation(i))),t.minimumLoggingThreshold,!0):s.timingStats.typeEvaluationTime.timeOperation(i)}const l=t.logCalls?i=>n.log("import lookup",(t=>(t.add(null==a?void 0:a.printFileOrModuleName(i)),e(i))),t.minimumLoggingThreshold,!0):e,c=(0,r.createTypeEvaluator)(l,t);return{runWithCancellationToken:c.runWithCancellationToken,getType:e=>o("getType",(()=>c.getType(e)),e),getTypeOfExpression:(e,t,n)=>o("getTypeOfExpression",(()=>c.getTypeOfExpression(e,t,n)),e),getTypeOfAnnotation:c.getTypeOfAnnotation,getTypeOfClass:e=>o("getTypeOfClass",(()=>c.getTypeOfClass(e)),e),getTypeOfFunction:e=>o("getTypeOfFunction",(()=>c.getTypeOfFunction(e)),e),getTypeForExpressionExpectingType:c.getTypeForExpressionExpectingType,evaluateTypeForSubnode:c.evaluateTypeForSubnode,evaluateTypesForStatement:e=>o("evaluateTypesForStatement",(()=>c.evaluateTypesForStatement(e)),e),evaluateTypesForMatchNode:c.evaluateTypesForMatchNode,evaluateTypesForCaseNode:c.evaluateTypesForCaseNode,evaluateTypeOfParameter:c.evaluateTypeOfParameter,canBeTruthy:c.canBeTruthy,canBeFalsy:c.canBeFalsy,removeTruthinessFromType:c.removeTruthinessFromType,removeFalsinessFromType:c.removeFalsinessFromType,getExpectedType:e=>o("getExpectedType",(()=>c.getExpectedType(e)),e),verifyRaiseExceptionType:e=>o("verifyRaiseExceptionType",(()=>c.verifyRaiseExceptionType(e)),e),verifyDeleteExpression:e=>o("verifyDeleteExpression",(()=>c.verifyDeleteExpression(e)),e),isAfterNodeReachable:e=>o("isAfterNodeReachable",(()=>c.isAfterNodeReachable(e)),e),isNodeReachable:(e,t)=>o("isNodeReachable",(()=>c.isNodeReachable(e,t)),e),suppressDiagnostics:(e,t)=>o("suppressDiagnostics",(()=>c.suppressDiagnostics(e,t))),getDeclarationsForNameNode:e=>o("getDeclarationsForNameNode",(()=>c.getDeclarationsForNameNode(e)),e),getTypeForDeclaration:e=>o("getTypeForDeclaration",(()=>c.getTypeForDeclaration(e)),e),resolveAliasDeclaration:(e,t,n)=>o("resolveAliasDeclaration",(()=>c.resolveAliasDeclaration(e,t,n)),e),resolveAliasDeclarationWithInfo:(e,t,n)=>o("resolveAliasDeclarationWithInfo",(()=>c.resolveAliasDeclarationWithInfo(e,t,n)),e),getTypeFromIterable:(e,t,n)=>o("getTypeFromIterable",(()=>c.getTypeFromIterable(e,t,n)),e),getTypeFromIterator:(e,t,n)=>o("getTypeFromIterator",(()=>c.getTypeFromIterator(e,t,n)),e),getGetterTypeFromProperty:(e,t)=>o("getGetterTypeFromProperty",(()=>c.getGetterTypeFromProperty(e,t)),e),markNamesAccessed:(e,t)=>o("markNamesAccessed",(()=>c.markNamesAccessed(e,t)),e),getScopeIdForNode:c.getScopeIdForNode,makeTopLevelTypeVarsConcrete:e=>o("makeTopLevelTypeVarsConcrete",(()=>c.makeTopLevelTypeVarsConcrete(e)),e),mapSubtypesExpandTypeVars:c.mapSubtypesExpandTypeVars,populateTypeVarMapBasedOnExpectedType:c.populateTypeVarMapBasedOnExpectedType,lookUpSymbolRecursive:c.lookUpSymbolRecursive,getDeclaredTypeOfSymbol:c.getDeclaredTypeOfSymbol,getEffectiveTypeOfSymbol:e=>o("getEffectiveTypeOfSymbol",(()=>c.getEffectiveTypeOfSymbol(e)),e),getEffectiveTypeOfSymbolForUsage:(e,t,n)=>o("getEffectiveTypeOfSymbolForUsage",(()=>c.getEffectiveTypeOfSymbolForUsage(e,t,n)),e),getInferredTypeOfDeclaration:c.getInferredTypeOfDeclaration,getDeclaredTypeForExpression:c.getDeclaredTypeForExpression,getFunctionDeclaredReturnType:e=>o("getFunctionDeclaredReturnType",(()=>c.getFunctionDeclaredReturnType(e)),e),getFunctionInferredReturnType:(e,t)=>o("getFunctionInferredReturnType",(()=>c.getFunctionInferredReturnType(e,t)),e),getBestOverloadForArguments:(e,t,n)=>c.getBestOverloadForArguments(e,t,n),getBuiltInType:(e,t)=>o("getBuiltInType",(()=>c.getBuiltInType(e,t)),e),getTypeOfMember:e=>o("getTypeOfMember",(()=>c.getTypeOfMember(e)),e.symbol),getTypeFromObjectMember:c.getTypeFromObjectMember,getBoundMethod:c.getBoundMethod,getTypeFromMagicMethodReturn:c.getTypeFromMagicMethodReturn,bindFunctionToClassOrObject:(e,t)=>o("bindFunctionToClassOrObject",(()=>c.bindFunctionToClassOrObject(e,t)),t),getCallSignatureInfo:(e,t,n)=>o("getCallSignatureInfo",(()=>c.getCallSignatureInfo(e,t,n)),e),getTypeAnnotationForParameter:(e,t)=>o("getTypeAnnotationForParameter",(()=>c.getTypeAnnotationForParameter(e,t)),e),getAbstractMethods:e=>o("getAbstractMethods",(()=>c.getAbstractMethods(e)),e),canAssignType:(e,t,n,i,s)=>o("canAssignType",(()=>c.canAssignType(e,t,n,i,s)),e),canOverrideMethod:(e,t,n,i)=>o("canOverrideMethod",(()=>c.canOverrideMethod(e,t,n,i)),t),canAssignProtocolClassToSelf:(e,t)=>o("canAssignProtocolClassToSelf",(()=>c.canAssignProtocolClassToSelf(e,t))),assignTypeToExpression:c.assignTypeToExpression,getBuiltInObject:c.getBuiltInObject,getTypingType:c.getTypingType,addError:(e,t)=>o("addError",(()=>c.addError(e,t)),t),addWarning:(e,t)=>o("addWarning",(()=>c.addWarning(e,t)),t),addInformation:(e,t)=>o("addInformation",(()=>c.addInformation(e,t)),t),addUnusedCode:(e,t)=>o("addUnusedCode",(()=>c.addUnusedCode(e,t)),e),addDeprecated:(e,t)=>o("addDeprecated",(()=>c.addDeprecated(e,t)),t),addDiagnostic:(e,t,n,i)=>o("addDiagnostic",(()=>c.addDiagnostic(e,t,n,i)),i),addDiagnosticForTextRange:(e,t,n,i,s)=>o("addDiagnosticForTextRange",(()=>c.addDiagnosticForTextRange(e,t,n,i,s))),printType:(e,t)=>o("printType",(()=>c.printType(e,t)),e),printFunctionParts:e=>o("printFunctionParts",(()=>c.printFunctionParts(e)),e),getTypeCacheSize:c.getTypeCacheSize,useSpeculativeMode:c.useSpeculativeMode,checkForCancellation:c.checkForCancellation}}},4610:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.enumerateLiteralsForType=t.getTypeNarrowingCallback=void 0;const a=n(563),o=n(4972),l=r(n(8494)),c=n(817),p=n(9453),d=n(1133),u=n(5168),m=n(1659);function h(e,t,n,i,s,r,o){const c=(0,u.mapSubtypes)(t,(e=>(0,u.transformPossibleRecursiveTypeAlias)(e))),p=(t,c,p,h)=>{const y=[];let g=!1,f=!1;for(const h of n){const n=e.makeTopLevelTypeVarsConcrete(h);if((0,d.isInstantiableClass)(n)){const T=!(0,d.isTypeVar)(h)&&(d.ClassType.isDerivedFrom(t,n)||i&&d.ClassType.isProtocolClass(n)&&e.canAssignType(n,t)||d.ClassType.isBuiltIn(n,"dict")&&d.ClassType.isTypedDictClass(t)),_=d.ClassType.isDerivedFrom(n,t)||i&&d.ClassType.isProtocolClass(t)&&e.canAssignType(t,n);if(T&&(g=!0),_&&T&&!d.ClassType.isSameGenericClass(t,n)&&(f=!0),s)if(T)y.push((0,u.addConditionToType)(t,p));else if(_){let n=h;if((0,d.isClass)(h)&&(d.ClassType.isSpecialBuiltIn(h)||h.details.typeParameters.length>0)){const i=new m.TypeVarMap((0,u.getTypeVarScopeId)(h)),s=d.ClassType.cloneForSpecialization(h,void 0,!1);e.populateTypeVarMapBasedOnExpectedType(s,d.ClassType.cloneAsInstance(t),i,[])&&(n=(0,u.applySolvedTypeVars)(s,i,!0))}y.push((0,u.addConditionToType)(n,p))}else if(r){const e=`<subclass of ${t.details.name} and ${n.details.name}>`,s=(0,a.getFileInfo)(o);let r=d.ClassType.createInstantiable(e,l.getClassFullName(o,s.moduleName,e),s.moduleName,s.filePath,0,l.getTypeSourceId(o),void 0,t.details.effectiveMetaclass,t.details.docString);r.details.baseClasses=[d.ClassType.cloneAsInstantiable(t),n],(0,u.computeMroLinearization)(r),r=(0,u.addConditionToType)(r,n.condition),(0,d.isTypeVar)(c)&&!c.details.isParamSpec&&0===c.details.constraints.length&&(r=(0,u.addConditionToType)(r,[{typeVarName:d.TypeVarType.getNameWithScope(c),constraintIndex:0,isConstrainedTypeVar:!1}])),y.push(i?d.ClassType.cloneAsInstance(r):r)}}else if((0,d.isTypeVar)(h)&&d.TypeBase.isInstantiable(h))i&&d.TypeBase.isInstance(c)?(0,d.isTypeVar)(c)&&(0,d.isTypeSame)((0,u.convertToInstance)(h),c)?s&&y.push(c):s?y.push((0,u.convertToInstance)(h)):(y.push(c),f=!0):!i&&d.TypeBase.isInstantiable(c)&&((0,d.isTypeVar)(c)&&(0,d.isTypeSame)(h,c)?s&&y.push(c):s?y.push(h):(y.push(c),f=!0));else if((0,d.isFunction)(h)&&i){let e=!1;(0,d.isClass)(t)&&(e=!!d.TypeBase.isInstantiable(c)||!!(0,u.lookUpClassMember)(t,"__call__")),e&&(s?y.push(c):g=!0)}}return s||g&&!f||y.push(h),i?y.map((e=>(0,u.convertToInstance)(e))):y},h=[],y=[],g=e.mapSubtypesExpandTypeVars(c,void 0,((t,r)=>{const a=(0,u.getTypeCondition)(t)?t:r,l=(0,d.isClassInstance)(t)&&d.ClassType.isBuiltIn(t,"type");if(s&&(0,d.isAnyOrUnknown)(t))return i?h.push((0,d.combineTypes)(n.map((e=>(0,u.convertToInstance)(e))))):h.push((0,d.combineTypes)(n)),void y.push(t);if(i){if((0,d.isNone)(t)){const e=n.some((e=>(0,d.isNone)(e)&&d.TypeBase.isInstantiable(e)));return s?e?t:void 0:e?void 0:t}if(((0,d.isModule)(t)||(0,d.isClassInstance)(t)&&d.ClassType.isBuiltIn(t,"ModuleType"))&&s){const t=n.filter((t=>{const n=e.makeTopLevelTypeVarsConcrete(t);return(0,d.isInstantiableClass)(n)&&d.ClassType.isProtocolClass(n)}));if(t.length>0)return(0,u.convertToInstance)((0,d.combineTypes)(t))}if((0,d.isClassInstance)(t)&&!l)return(0,d.combineTypes)(p(d.ClassType.cloneAsInstantiable(t),(0,u.convertToInstance)(r),(0,u.getTypeCondition)(t),a));if(((0,d.isFunction)(t)||(0,d.isOverloadedFunction)(t))&&i)return(0,d.combineTypes)(((t,i)=>{const r=[];if(s)for(const s of n){const n=e.makeTopLevelTypeVarsConcrete(s);e.canAssignType(t,(0,u.convertToInstance)(n))&&((0,d.isFunction)(s)?r.push(i):r.push((0,u.convertToInstance)(s)))}else n.some((n=>e.canAssignType(t,(0,u.convertToInstance)(e.makeTopLevelTypeVarsConcrete(n)))))||r.push(i);return r})(t,(0,u.convertToInstance)(r)));if((0,d.isInstantiableClass)(t)||l){const e=n.some((e=>(0,d.isInstantiableClass)(e)&&d.ClassType.isBuiltIn(e,"type")));return s?e?a:void 0:e?void 0:a}}else{if((0,d.isInstantiableClass)(t))return(0,d.combineTypes)(p(t,r,(0,u.getTypeCondition)(t),a));if(l){const n=e.getBuiltInObject(o,"object");if(n&&(0,d.isClassInstance)(n))return(0,d.combineTypes)(p(d.ClassType.cloneAsInstantiable(n),(0,u.convertToInstantiable)(r),(0,u.getTypeCondition)(t),a))}}return s?void 0:a}));return(0,d.isNever)(g)&&h.length>0?(0,d.combineTypes)(h):y.length>0?(0,d.combineTypes)([g,...y]):g}function y(e,t,n,i,s){return(0,u.mapSubtypes)(t,(t=>{if(t=e.makeTopLevelTypeVarsConcrete(t),(0,d.isClassInstance)(t)&&d.ClassType.isSameGenericClass(n,t)){if(void 0!==t.literalValue){const e=d.ClassType.isLiteralValueSame(t,n);if(e&&!i||!e&&i)return;return t}if(i)return n;{const i=g(e,t);if(i)return(0,d.combineTypes)(i.filter((e=>!d.ClassType.isLiteralValueSame(e,n))))}}else if(i&&(s||(0,d.isNone)(t)))return;return t}))}function g(e,t){if(d.ClassType.isBuiltIn(t,"bool"))return[d.ClassType.cloneWithLiteral(t,!0),d.ClassType.cloneWithLiteral(t,!1)];if(d.ClassType.isEnumClass(t)){const n=[];return t.details.fields.forEach(((i,s)=>{if(!i.isIgnoredForProtocolMatch()&&!i.isInstanceMember()){const s=e.getEffectiveTypeOfSymbol(i);(0,d.isClassInstance)(s)&&d.ClassType.isSameGenericClass(t,s)&&void 0!==s.literalValue&&n.push(s)}})),n}}function f(e,t,n,i,s){return e.mapSubtypesExpandTypeVars(t,void 0,(e=>{switch(e.category){case 5:case 6:return n?e:void 0;case 3:case 8:return n?void 0:e;case 7:if(d.TypeBase.isInstantiable(e))return n?e:void 0;if((0,u.lookUpClassMember)(e,"__call__"))return n?e:void 0;if(!n)return e;if(s){const t=`<callable subtype of ${e.details.name}>`,n=(0,a.getFileInfo)(i);let s=d.ClassType.createInstantiable(t,l.getClassFullName(i,n.moduleName,t),n.moduleName,n.filePath,0,l.getTypeSourceId(i),void 0,e.details.effectiveMetaclass,e.details.docString);s.details.baseClasses=[d.ClassType.cloneAsInstantiable(e)],(0,u.computeMroLinearization)(s),s=(0,u.addConditionToType)(s,e.condition);const r=d.FunctionType.createInstance("__call__","","",64),o={category:0,name:"self",type:d.ClassType.cloneAsInstance(s),hasDeclaredType:!0};return d.FunctionType.addParameter(r,o),d.FunctionType.addDefaultParameters(r),r.details.declaredReturnType=d.UnknownType.create(),s.details.fields.set("__call__",c.Symbol.createWithType(4,r)),d.ClassType.cloneAsInstance(s)}return;default:return e}}))}t.getTypeNarrowingCallback=function(e,t,n){let i=n.expression;const s=!!(n.flags&(o.FlowFlags.TrueCondition|o.FlowFlags.TrueNeverCondition));if(4===i.nodeType&&(l.isMatchingExpression(t,i.rightExpression)?i=i.rightExpression:l.isMatchingExpression(t,i.name)&&(i=i.name)),7===i.nodeType){const n=39===i.operator||40===i.operator,r=12===i.operator||28===i.operator;if(n||r){const a=39===i.operator||12===i.operator?s:!s;if(11===i.rightExpression.nodeType&&26===i.rightExpression.constType){let n=i.leftExpression;if(4===n.nodeType&&(n=n.name),l.isMatchingExpression(t,n))return t=>function(e,t,n){const i=(0,u.mapSubtypes)(t,(e=>(0,u.transformPossibleRecursiveTypeAlias)(e)));return e.mapSubtypesExpandTypeVars(i,void 0,((e,t)=>{if((0,d.isAnyOrUnknown)(e))return e;const i=(0,d.isTypeVar)(t)&&0===t.details.constraints.length?t:e;return(0,d.isClassInstance)(e)&&d.ClassType.isBuiltIn(e,"object")?n?d.NoneType.createInstance():i:(0,d.isNone)(e)===n?i:void 0}))}(e,t,a);if(24===n.nodeType&&l.isMatchingExpression(t,n.baseExpression)&&1===n.items.length&&!n.trailingComma&&0===n.items[0].argumentCategory&&!n.items[0].name&&40===n.items[0].valueExpression.nodeType&&n.items[0].valueExpression.isInteger&&!n.items[0].valueExpression.isImaginary){const t=n.items[0].valueExpression.value;return n=>function(e,t,n,i){return e.mapSubtypesExpandTypeVars(t,void 0,(t=>{if(!(0,d.isClassInstance)(t)||!(0,u.isTupleClass)(t)||(0,u.isOpenEndedTupleClass)(t)||!t.tupleTypeArguments)return t;const s=t.tupleTypeArguments.length;if(i<0||i>=s)return t;const r=e.makeTopLevelTypeVarsConcrete(t.tupleTypeArguments[i]);if(n){if(!e.canAssignType(r,d.NoneType.createInstance()))return}else if((0,d.isNone)(r))return;return t}))}(e,n,a,t)}}if(n&&9===i.leftExpression.nodeType){const n=e.getTypeOfExpression(i.leftExpression.leftExpression).type;if((0,d.isInstantiableClass)(n)&&d.ClassType.isBuiltIn(n,"type")&&1===i.leftExpression.arguments.length&&0===i.leftExpression.arguments[0].argumentCategory){const n=i.leftExpression.arguments[0].valueExpression;if(l.isMatchingExpression(t,n)){const t=e.getTypeOfExpression(i.rightExpression).type;if((0,d.isInstantiableClass)(t))return e=>function(e,t,n){return(0,u.mapSubtypes)(e,(e=>{if((0,d.isClassInstance)(e)){const i=d.ClassType.isDerivedFrom(t,d.ClassType.cloneAsInstantiable(e));if(n)return i?d.ClassType.isSameGenericClass(e,t)?e:d.ClassType.cloneAsInstance(t):void 0;if(i&&d.ClassType.isFinal(e))return;return e}return(0,d.isNone)(e)&&n?void 0:e}))}(e,t,a)}}}if(n&&l.isMatchingExpression(t,i.leftExpression)){const t=e.getTypeOfExpression(i.rightExpression).type;if((0,d.isClassInstance)(t)&&(d.ClassType.isEnumClass(t)||d.ClassType.isBuiltIn(t,"bool"))&&void 0!==t.literalValue)return n=>y(e,n,t,a,!0)}if(r){const n=12===i.operator?s:!s;if(l.isMatchingExpression(t,i.leftExpression)){const t=e.getTypeOfExpression(i.rightExpression).type;if((0,d.isClassInstance)(t)&&void 0!==t.literalValue)return i=>y(e,i,t,n,!1)}if(l.isMatchingExpression(t,i.rightExpression)){const t=e.getTypeOfExpression(i.leftExpression).type;if((0,d.isClassInstance)(t)&&void 0!==t.literalValue)return i=>y(e,i,t,n,!1)}if(35===i.leftExpression.nodeType&&l.isMatchingExpression(t,i.leftExpression.leftExpression)){const t=e.getTypeOfExpression(i.rightExpression).type,s=i.leftExpression.memberName;if((0,d.isClassInstance)(t)&&void 0!==t.literalValue)return i=>function(e,t,n,i,s){let r=!0;const a=(0,u.mapSubtypes)(t,(t=>{let a;if((0,d.isClassInstance)(t)?a=(0,u.lookUpObjectMember)(t,n):(0,d.isInstantiableClass)(t)&&(a=(0,u.lookUpClassMember)(t,n)),a&&a.isTypeDeclared){const n=e.getTypeOfMember(a);if((0,u.isLiteralTypeOrUnion)(n))return s?e.canAssignType(n,i)?t:void 0:e.canAssignType(i,n)?void 0:t}return r=!1,t}));return r?a:t}(e,i,s.value,t,n)}if(24===i.leftExpression.nodeType&&1===i.leftExpression.items.length&&!i.leftExpression.trailingComma&&0===i.leftExpression.items[0].argumentCategory&&l.isMatchingExpression(t,i.leftExpression.baseExpression)){const t=e.getTypeOfExpression(i.leftExpression.items[0].valueExpression).type;if((0,d.isClassInstance)(t)&&(0,u.isLiteralType)(t))if(d.ClassType.isBuiltIn(t,"str")){const s=e.getTypeOfExpression(i.rightExpression).type;if((0,d.isClassInstance)(s)&&void 0!==s.literalValue)return i=>function(e,t,n,i,s){let r=!0;const a=(0,u.mapSubtypes)(t,(t=>{if((0,d.isClassInstance)(t)&&d.ClassType.isTypedDictClass(t)){const r=(0,p.getTypedDictMembersForClass)(e,t).get(n.literalValue);if(r&&(0,u.isLiteralTypeOrUnion)(r.valueType))return s?e.canAssignType(r.valueType,i)?t:void 0:e.canAssignType(i,r.valueType)?void 0:t}return r=!1,t}));return r?a:t}(e,i,t,s,n)}else if(d.ClassType.isBuiltIn(t,"int")){const s=e.getTypeOfExpression(i.rightExpression).type;if((0,d.isClassInstance)(s)&&void 0!==s.literalValue)return i=>function(e,t,n,i,s){let r=!0;const a=(0,u.mapSubtypes)(t,(t=>{if((0,d.isClassInstance)(t)&&d.ClassType.isTupleClass(t)&&!(0,u.isOpenEndedTupleClass)(t)){const r=n.literalValue;if(t.tupleTypeArguments&&r>=0&&r<t.tupleTypeArguments.length){const n=t.tupleTypeArguments[r];if(n&&(0,u.isLiteralTypeOrUnion)(n))return s?e.canAssignType(n,i)?t:void 0:e.canAssignType(i,n)?void 0:t}}return r=!1,t}));return r?a:t}(e,i,t,s,n)}}}}if(41===i.operator&&s&&l.isMatchingExpression(t,i.leftExpression)){const t=e.getTypeOfExpression(i.rightExpression).type;return n=>function(e,t,n){if(!(0,d.isClassInstance)(n)||!d.ClassType.isBuiltIn(n))return t;const i=n.details.name;if(!["list","set","frozenset","deque"].some((e=>e===i)))return t;if(!n.typeArguments||1!==n.typeArguments.length)return t;const s=n.typeArguments[0];let r=!0;const a=(0,u.mapSubtypes)(t,(t=>(0,d.isAnyOrUnknown)(t)?(r=!1,t):e.canAssignType(s,t)?t:void 0));return r?a:t}(e,n,t)}if((41===i.operator||42===i.operator)&&l.isMatchingExpression(t,i.rightExpression)){const t=e.getTypeOfExpression(i.leftExpression).type;if((0,d.isClassInstance)(t)&&d.ClassType.isBuiltIn(t,"str")&&(0,u.isLiteralType)(t)){const n=41===i.operator?s:!s;return i=>function(e,t,n,i){return(0,u.mapSubtypes)(t,(t=>{if((0,d.isClassInstance)(t)&&d.ClassType.isTypedDictClass(t)){const s=(0,p.getTypedDictMembersForClass)(e,t,!0).get(n.literalValue);if(i){if(!s)return d.ClassType.isFinal(t)?void 0:t;if(s.isRequired||s.isProvided)return t;const e=t.typedDictNarrowedEntries,i=new Map;return e&&e.forEach(((e,t)=>{i.set(t,e)})),i.set(n.literalValue,{valueType:s.valueType,isRequired:!1,isProvided:!0}),d.ClassType.cloneAsInstance(d.ClassType.cloneForNarrowedTypedDictEntries(d.ClassType.cloneAsInstantiable(t),i))}return void 0!==s&&(s.isRequired||s.isProvided)?void 0:t}return t}))}(e,i,d.ClassType.cloneAsInstantiable(t),n)}}}if(9===i.nodeType){if(38===i.leftExpression.nodeType)if("isinstance"!==i.leftExpression.value&&"issubclass"!==i.leftExpression.value||2!==i.arguments.length){if("callable"===i.leftExpression.value&&1===i.arguments.length){const n=i.arguments[0].valueExpression;if(l.isMatchingExpression(t,n))return t=>{let n=f(e,t,s,i,!1);return s&&(0,d.isNever)(n)&&(n=f(e,t,s,i,!0)),n}}}else{const n="isinstance"===i.leftExpression.value,r=i.arguments[0].valueExpression,a=i.arguments[1].valueExpression;if(l.isMatchingExpression(t,r)){const t=function(e){let t=!1;const n=[],i=e=>{e.forEach((e=>{(0,d.isInstantiableClass)(e)||(0,d.isTypeVar)(e)&&d.TypeBase.isInstantiable(e)||(0,d.isNone)(e)&&d.TypeBase.isInstantiable(e)||(0,d.isFunction)(e)&&2===e.details.parameters.length&&1===e.details.parameters[0].category&&2===e.details.parameters[1].category?n.push(e):t=!0}))};return(0,u.doForEachSubtype)(e,(e=>{(0,d.isClass)(e)&&d.TypeBase.isInstance(e)&&(0,u.isTupleClass)(e)?e.tupleTypeArguments&&i((0,u.isOpenEndedTupleClass)(e)?[e.tupleTypeArguments[0]]:e.tupleTypeArguments):i([e])})),t?void 0:n}(e.getTypeOfExpression(a,void 0,168).type);if(t)return r=>{const a=h(e,r,t,n,s,!1,i);return(0,d.isNever)(a)?h(e,r,t,n,s,!0,i):a}}}if(i.arguments.length>=1){const n=i.arguments[0].valueExpression;if(l.isMatchingExpression(t,n)){const t=e.getTypeOfExpression(i.leftExpression).type;if((0,d.isFunction)(t)&&t.details.declaredReturnType&&(0,d.isClassInstance)(t.details.declaredReturnType)&&d.ClassType.isBuiltIn(t.details.declaredReturnType,"TypeGuard")){const t=e.getTypeOfExpression(i).type;if((0,d.isClassInstance)(t)&&d.ClassType.isBuiltIn(t,"bool")&&t.typeGuardType)return e=>s?t.typeGuardType:e}}}}if(l.isMatchingExpression(t,i))return t=>(0,u.mapSubtypes)(t,(t=>{if(s){if(e.canBeTruthy(t))return e.removeFalsinessFromType(t)}else if(e.canBeFalsy(t))return e.removeTruthinessFromType(t)}))},t.enumerateLiteralsForType=g},3843:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.printFunctionParts=t.printObjectTypeForClass=t.printLiteralValue=t.printType=void 0;const a=r(n(8494)),o=n(1133),l=n(5168),c=/'/g,p=/\\"/g;function d(e,t,n,i=[]){const s=0!=(16&t);if(t&=-17,e.typeAliasInfo){let s=!0;if((0==(32&t)||i.find((t=>t===e)))&&(s=!1),!s)try{i.push(e);let s=e.typeAliasInfo.name;const r=e.typeAliasInfo.typeParameters;if(r){let a;e.typeAliasInfo.typeArguments?(0==(2&t)||e.typeAliasInfo.typeArguments.some((e=>!(0,o.isAnyOrUnknown)(e))))&&(a=[],e.typeAliasInfo.typeArguments.forEach(((e,s)=>{const c=s<r.length?r[s]:r[r.length-1];(0,o.isVariadicTypeVar)(c)&&(0,o.isClassInstance)(e)&&(0,l.isTupleClass)(e)&&e.tupleTypeArguments?e.tupleTypeArguments.forEach((e=>{a.push(d(e,t,n,i))})):a.push(d(e,t,n,i))}))):(0==(2&t)||r.some((e=>!(0,o.isAnyOrUnknown)(e))))&&(a=[],r.forEach((e=>{a.push(d(e,t,n,i))}))),a&&(0===a.length?s+="[()]":s+=`[${a.join(", ")}]`)}if(10!==e.category)return s}finally{i.pop()}}if(i.find((t=>t===e))||i.length>o.maxTypeRecursionCount)return"...";try{i.push(e);const r=0==(64&t),a=e=>void 0!==e.condition&&r?"*":"";switch(e.category){case 0:return"Unbound";case 1:return 0!=(1&t)?"Any":"Unknown";case 8:return`Module("${e.moduleName}")`;case 7:return o.TypeBase.isInstance(e)?void 0!==e.literalValue?`Literal[${u(e)}]`:`${m(e,t,n,i)}${a(e)}`:void 0!==e.literalValue?`Type[Literal[${u(e)}]]${a(e)}`:`Type[${m(e,t,n,i)}]${a(e)}`;case 5:{const s=h(e,t,n,i);if(e.details.paramSpec)return e.details.parameters.length>0?`Callable[Concatenate[${e.details.parameters.map((e=>e.name?d(e.type,t,n,i):0===e.category?"/":"*")).join(", ")}, ${o.TypeVarType.getReadableName(e.details.paramSpec)}], ${s[1]}]`:`Callable[${o.TypeVarType.getReadableName(e.details.paramSpec)}, ${s[1]}]`;const r=`(${s[0].join(", ")})`;return o.FunctionType.isParamSpecValue(e)?r:`${r} -> ${s[1]}`}case 6:return`Overload[${e.overloads.map((e=>d(e,t,n,i))).join(", ")}]`;case 9:{const r=new Set,a=new Set;if(0==(32&t)&&e.typeAliasSources)for(const s of e.typeAliasSources){let l=!0,c=!0;const p=new Set;for(const t of s.subtypes){let n=0,i=!1;for(const s of e.subtypes){if((0,o.isTypeSame)(t,s,void 0,!0)){r.has(n)||(c=!1),p.add(n),i=!0;break}n++}if(!i){l=!1;break}}l&&!c&&(a.add(d(s,t,n,i)),p.forEach((e=>r.add(e))))}const c=e.subtypes.findIndex((e=>(0,o.isNone)(e)));if(c>=0&&!r.has(c)){const s=(0,o.removeNoneFromUnion)(e);if((0,o.isNever)(s))return"None";const r=d(s,t,n,i);return 8&t?r+" | None":"Optional["+r+"]"}const p=new Set,m=new Set;(0,l.doForEachSubtype)(e,((e,s)=>{r.has(s)||((0,o.isClassInstance)(e)&&void 0!==e.literalValue?p.add(u(e)):(0,o.isInstantiableClass)(e)&&void 0!==e.literalValue?m.add(u(e)):a.add(d(e,t,n,i)))}));const h=[];if(a.forEach((e=>h.push(e))),p.size>0){const e=[];p.forEach((t=>e.push(t))),h.push(`Literal[${e.join(", ")}]`)}if(m.size>0){const e=[];m.forEach((t=>e.push(t))),h.push(`Type[Literal[${e.join(", ")}]]`)}if(1===h.length)return h[0];if(8&t){const e=h.join(" | ");return s?`(${e})`:e}return`Union[${h.join(", ")}]`}case 10:{if(e.details.isSynthesized){if(e.details.recursiveTypeAliasName)return 0!=(32&t)&&e.details.boundType?d(e.details.boundType,t,n,i):e.details.recursiveTypeAliasName;if(e.details.isSynthesizedSelfCls&&e.details.boundType){let s=d(e.details.boundType,-33&t,n,i);return(0,o.isAnyOrUnknown)(e.details.boundType)||(s=`Self@${s}`),o.TypeBase.isInstantiable(e)?`Type[${s}]`:s}return 0!=(1&t)?"Any":"Unknown"}if(e.details.isParamSpec)return e.paramSpecAccess?`${e.details.name}.${e.paramSpecAccess}`:`${o.TypeVarType.getReadableName(e)}`;let s=o.TypeVarType.getReadableName(e);return e.isVariadicUnpacked&&(s=`*${s}`),o.TypeBase.isInstantiable(e)?`Type[${s}]`:s}case 3:return`${o.TypeBase.isInstantiable(e)?"NoneType":"None"}${a(e)}`;case 4:return"Never";case 2:return e.isEllipsis?"...":"Any"}return""}finally{i.pop()}}function u(e,t="'"){const n=e.literalValue;if(void 0===n)return"";let i;if("string"==typeof n){const s="bytes"===e.details.name?"b":"";i=JSON.stringify(n).toString(),'"'!==t&&(i=`'${i.substring(1,i.length-1).replace(p,'"').replace(c,"\\'")}'`),s&&(i=`${s}${i}`)}else i="boolean"==typeof n?n?"True":"False":n instanceof o.EnumLiteral?`${n.className}.${n.itemName}`:n.toString();return i}function m(e,t,n,i=[]){let s=e.aliasName||e.details.name;if(!o.ClassType.isPseudoGenericClass(e)){const r=o.ClassType.getTypeParameters(e),a=r.length>0?r[r.length-1]:void 0,l=!!a&&a.details.isVariadic,c=e.tupleTypeArguments||e.typeArguments;if(c)if(c.length>0){const e=[];let a=!0;c.forEach(((s,l)=>{const c=l<r.length?r[l]:void 0;c&&c.details.isVariadic&&(0,o.isClassInstance)(s)&&o.ClassType.isBuiltIn(s,"tuple")&&s.tupleTypeArguments?0===s.tupleTypeArguments.length?((0,o.isAnyOrUnknown)(s)||(a=!1),e.push("()")):e.push(...s.tupleTypeArguments.map((e=>((0,o.isAnyOrUnknown)(e)||(a=!1),d(e,t,n,i))))):((0,o.isAnyOrUnknown)(s)||(a=!1),e.push(d(s,t,n,i)))})),0!=(2&t)&&a||(s+="["+e.join(", ")+"]")}else(o.ClassType.isTupleClass(e)||l)&&(s+="[()]");else r.length>0&&(0==(2&t)||r.some((e=>!(0,o.isAnyOrUnknown)(e))))&&(s+="["+r.map((e=>d(e,t,n,i))).join(", ")+"]")}return s}function h(e,t,n,i=[]){const s=[];let r=!1;e.details.parameters.forEach(((l,c)=>{if(c===e.details.parameters.length-1&&1===l.category&&(0,o.isVariadicTypeVar)(l.type)){const r=o.FunctionType.getEffectiveParameterType(e,c);if((0,o.isClassInstance)(r)&&o.ClassType.isBuiltIn(r,"tuple")&&r.tupleTypeArguments)return void r.tupleTypeArguments.forEach(((e,r)=>{const a=d(e,t,n,i);s.push(a)}))}let p="";1===l.category?p+="*":2===l.category&&(p+="**"),l.name&&!l.isNameSynthesized&&(p+=l.name,r=!0);let u="=";if(l.name)if(l.hasDeclaredType||l.isTypeInferred){const s=o.FunctionType.getEffectiveParameterType(e,c),r=i.length<o.maxTypeRecursionCount?d(s,t,n,i):"";l.isNameSynthesized||(p+=": "),p+=r,(0,o.isParamSpec)(s)&&(1===l.category?p+=".args":2===l.category&&(p+=".kwargs")),u=" = "}else 0==(2&t)&&(l.isNameSynthesized||(p+=": "),p+="Unknown",u=" = ");else if(0===l.category){if(!r)return;p+="/"}l.hasDefault&&(l.defaultValueExpression?p+=u+a.printExpression(l.defaultValueExpression):p+=u+"..."),s.push(p)}));const l=n(e),c=i.length<o.maxTypeRecursionCount?d(l,16|t,n,i):"";return[s,c]}t.printType=d,t.printLiteralValue=u,t.printObjectTypeForClass=m,t.printFunctionParts=h},2590:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TypeStubWriter=void 0;const a=r(n(563)),o=r(n(8494)),l=n(427),c=n(5083),p=r(n(1766)),d=n(1133);class u{constructor(e){this.importName=e,this.isAccessed=!1}}class m extends u{constructor(e,t,n){super(e),this.alias=t,this.symbol=n}}class h extends u{constructor(e,t,n){super(e),this.isWildcardImport=t,this.node=n,this.symbols=[]}addSymbol(e,t,n,i=!1){this.symbols.find((e=>e.name===t))||this.symbols.push({symbol:e,name:t,alias:n,isAccessed:i})}}class y extends l.ParseTreeWalker{constructor(e,t){super(),this._accessedImportedSymbols=e,this._treatStringsAsSymbols=t}analyze(e){this.walk(e)}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitName(e){return this._accessedImportedSymbols.set(e.value,!0),!0}visitString(e){return this._treatStringsAsSymbols&&this._accessedImportedSymbols.set(e.value,!0),!0}}class g extends l.ParseTreeWalker{constructor(e,t,n){super(),this._stubPath=e,this._sourceFile=t,this._evaluator=n,this._indentAmount=0,this._includeAllImports=!1,this._typeStubText="",this._lineEnd="\n",this._tab="    ",this._classNestCount=0,this._functionNestCount=0,this._ifNestCount=0,this._emittedSuite=!1,this._emitDocString=!0,this._trackedImportAs=new Map,this._trackedImportFrom=new Map,this._accessedImportedSymbols=new Map,this._stubPath.endsWith("__init__.pyi")&&(this._includeAllImports=!0)}write(){const e=this._sourceFile.getParseResults();this._lineEnd=e.tokenizerOutput.predominantEndOfLineSequence,this._tab=e.tokenizerOutput.predominantTabSequence,this.walk(e.parseTree),this._writeFile()}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitClass(e){const t=e.name.value;this._emittedSuite=!0,this._emitDocString=!0,this._emitDecorators(e.decorators);let n=`class ${t}`;const i=e.arguments.filter((e=>void 0!==e.name||0!==e.argumentCategory||38!==e.valueExpression.nodeType||"object"!==e.valueExpression.value));return i.length>0&&(n+=`(${i.map((e=>{let t="";return e.name&&(t=e.name.value+"="),t+=this._printExpression(e.valueExpression),t})).join(", ")})`),n+=":",this._emitLine(n),this._emitSuite((()=>{this._classNestCount++,this.walk(e.suite),this._classNestCount--})),this._emitLine(""),this._emitLine(""),!1}visitFunction(e){const t=e.name.value;if(0===this._functionNestCount&&!p.isPrivateOrProtectedName(t)){this._emittedSuite=!0,this._emitDocString=!0,this._emitDecorators(e.decorators);let n,i=e.isAsync?"async ":"";if(i+=`def ${t}`,i+=`(${e.parameters.map(((t,n)=>this._printParameter(t,e,n))).join(", ")})`,e.returnTypeAnnotation?n=this._printExpression(e.returnTypeAnnotation,!0):e.functionAnnotationComment?n=this._printExpression(e.functionAnnotationComment.returnTypeAnnotation,!0):"__init__"===e.name.value?n="None":"__str__"===e.name.value?n="str":["__int__","__hash__"].some((t=>t===e.name.value))?n="int":["__eq__","__ne__","__gt__","__lt__","__ge__","__le__"].some((t=>t===e.name.value))&&(n="bool"),n&&(i+=" -> "+n),i+=":",!n){const t=this._evaluator.getTypeOfFunction(e);if(t&&(0,d.isFunction)(t.functionType)){let e=this._evaluator.getFunctionInferredReturnType(t.functionType);e=(0,d.removeUnknownFromUnion)(e),(0,d.isNever)(e)||(0,d.isUnknown)(e)||(i+=` # -> ${this._evaluator.printType(e,!1)}:`)}}this._emitLine(i),this._emitSuite((()=>{this._functionNestCount++,this.walk(e.suite),this._functionNestCount--})),this._emitLine("")}return!1}visitWhile(e){return this._emitDocString=!1,!1}visitFor(e){return this._emitDocString=!1,!1}visitTry(e){return this._emitDocString=!1,!1}visitWith(e){return this._emitDocString=!1,!1}visitIf(e){if(this._emitDocString=!1,0===this._functionNestCount&&0===this._ifNestCount){this._ifNestCount++,this._emittedSuite=!0,this._emitLine("if "+this._printExpression(e.testExpression)+":"),this._emitSuite((()=>{this.walkMultiple(e.ifSuite.statements)}));const t=e.elseSuite;t&&(this._emitLine("else:"),this._emitSuite((()=>{19===t.nodeType?this.walkMultiple([t.testExpression,t.ifSuite,t.elseSuite]):this.walkMultiple(t.statements)}))),this._ifNestCount--}return!1}visitAssignment(e){let t=!1,n="";if(38===e.leftExpression.nodeType){if("__all__"===e.leftExpression.value)return 0===this._functionNestCount&&0===this._ifNestCount&&(this._emittedSuite=!0,n=this._printExpression(e.leftExpression),n+=" = ",n+=this._printExpression(e.rightExpression),this._emitLine(n)),!1;if(0===this._functionNestCount){n=this._printExpression(e.leftExpression),e.typeAnnotationComment&&(n+=": "+this._printExpression(e.typeAnnotationComment,!0));const i=this._evaluator.getType(e.leftExpression);(null==i?void 0:i.typeAliasInfo)&&(t=!0)}}else if(54===e.leftExpression.nodeType){const t=e.leftExpression.valueExpression;38===t.nodeType&&0===this._functionNestCount&&(n=`${this._printExpression(t)}: ${this._printExpression(e.leftExpression.typeAnnotation,!0)}`)}return n&&(this._emittedSuite=!0,n+=" = ",n+=t?this._printExpression(e.rightExpression):"...",this._emitLine(n)),!1}visitAugmentedAssignment(e){if(38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value&&1===e.operator&&0===this._functionNestCount&&0===this._ifNestCount){let t=this._printExpression(e.leftExpression);t+=" += ",t+=this._printExpression(e.rightExpression),this._emitLine(t)}return!1}visitTypeAnnotation(e){if(0===this._functionNestCount){let t="";if(38===e.valueExpression.nodeType)t=this._printExpression(e.valueExpression);else if(35===e.valueExpression.nodeType){const n=e.valueExpression.leftExpression;if(38===n.nodeType&&"self"===n.value){const n=e.valueExpression.memberName.value;p.isPrivateOrProtectedName(n)||(t=this._printExpression(e.valueExpression))}}t&&(t+=": "+this._printExpression(e.typeAnnotation,!0),this._emitLine(t))}return!1}visitImport(e){if(this._functionNestCount>0||this._classNestCount>0)return!1;const t=(0,c.getScopeForNode)(e);return t&&e.list.forEach((e=>{const n=this._printModuleName(e.module);if(!this._trackedImportAs.has(n)){const i=e.alias?e.alias.value:e.module.nameParts.length>0?e.module.nameParts[0].value:"",s=t.lookUpSymbolRecursive(i);if(s){const t=new m(n,e.alias?e.alias.value:void 0,s.symbol);this._trackedImportAs.set(n,t)}}})),!1}visitImportFrom(e){if(this._functionNestCount>0||this._classNestCount>0)return!1;const t=(0,c.getScopeForNode)(e);if(t){const n=this._printModuleName(e.module);let i=this._trackedImportFrom.get(n);i||(i=new h(n,e.isWildcardImport,e),this._trackedImportFrom.set(n,i)),e.imports.forEach((e=>{const n=e.alias?e.alias.value:e.name.value,s=t.lookUpSymbolRecursive(n);s&&i.addSymbol(s.symbol,e.name.value,e.alias?e.alias.value:void 0,!1)}))}return!1}visitStatementList(e){return e.statements.length>0&&48===e.statements[0].nodeType&&!this._emittedSuite&&this._emitDocString&&this._emitLine(this._printExpression(e.statements[0])),this._emitDocString=!1,this.walkMultiple(e.statements),!1}_emitSuite(e){this._increaseIndent((()=>{const t=this._emittedSuite;this._emittedSuite=!1,e(),this._emittedSuite||this._emitLine("..."),this._emittedSuite=t}))}_increaseIndent(e){this._indentAmount++,e(),this._indentAmount--}_emitDecorators(e){e.forEach((e=>{this._emitLine("@"+this._printExpression(e.expression))}))}_printHeaderDocString(){return'"""'+this._lineEnd+"This type stub file was generated by pyright."+this._lineEnd+'"""'+this._lineEnd+this._lineEnd}_emitLine(e){for(let e=0;e<this._indentAmount;e++)this._typeStubText+=this._tab;this._typeStubText+=e+this._lineEnd}_printModuleName(e){let t="";for(let n=0;n<e.leadingDots;n++)t+=".";return t+=e.nameParts.map((e=>e.value)).join("."),t}_printParameter(e,t,n){let i="";1===e.category?i+="*":2===e.category&&(i+="**"),e.name&&(i+=e.name.value);const s=this._evaluator.getTypeAnnotationForParameter(t,n);let r="";return s&&(r=this._printExpression(s,!0)),r&&(i+=": "+r),e.defaultValue&&(i+=r?" = ...":"=..."),i}_printExpression(e,t=!1,n=!1){return new y(this._accessedImportedSymbols,n).analyze(e),o.printExpression(e,t?1:0)}_printTrackedImports(){let e="",t=!1;return this._trackedImportAs.forEach((n=>{this._accessedImportedSymbols.get(n.alias||n.importName)&&(n.isAccessed=!0),(n.isAccessed||this._includeAllImports)&&(e+=`import ${n.importName}`,n.alias&&(e+=` as ${n.alias}`),e+=this._lineEnd,t=!0)})),this._trackedImportFrom.forEach((n=>{n.symbols.forEach((e=>{this._accessedImportedSymbols.get(e.alias||e.name)&&(e.isAccessed=!0)})),n.isWildcardImport&&(e+=`from ${n.importName} import *`+this._lineEnd,t=!0);const i=n.symbols.filter((e=>e.isAccessed||this._includeAllImports)).sort(((e,t)=>e.name<t.name?-1:e.name>t.name?1:0));i.length>0&&(e+=`from ${n.importName} import `,e+=i.map((e=>{let t=e.name;return e.alias&&(t+=" as "+e.alias),t})).join(", "),e+=this._lineEnd,t=!0)})),t&&(e+=this._lineEnd),e}_writeFile(){let e=this._printHeaderDocString();e+=this._printTrackedImports(),e+=this._typeStubText,this._sourceFile.fileSystem.writeFileSync(this._stubPath,e,"utf8")}}t.TypeStubWriter=g},5168:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMembersForClass=t.convertToInstantiable=t.convertToInstance=t.getGeneratorYieldType=t.getDeclaredGeneratorReturnType=t.getDeclaredGeneratorSendType=t.synthesizeTypeVarForSelfCls=t.derivesFromClassRecursive=t.specializeForBaseClass=t.buildTypeVarMap=t.buildTypeVarMapFromSpecializedClass=t.setTypeArgumentsRecursive=t.specializeClassType=t.getTypeVarArgumentsRecursive=t.addTypeVarsToListIfUnique=t.getClassIterator=t.getClassMemberIterator=t.lookUpClassMember=t.lookUpObjectMember=t.transformExpectedTypeForConstructor=t.applySolvedTypeVars=t.markTypeVarsReplacementExempt=t.populateTypeVarMapForSelfType=t.partiallySpecializeType=t.isOpenEndedTupleClass=t.isTupleClass=t.isProperty=t.removeNoReturnFromUnion=t.isNoReturnType=t.isEllipsisType=t.containsLiteralType=t.isLiteralTypeOrUnion=t.isLiteralType=t.getSpecializedTupleType=t.getTypeVarScopeId=t.transformPossibleRecursiveTypeAlias=t.isTypeAliasRecursive=t.isTypeAliasPlaceholder=t.getTypeCondition=t.addConditionToType=t.stripLiteralValue=t.getFullNameOfType=t.derivesFromAnyOrUnknown=t.isUnionableType=t.areTypesSame=t.doForEachSubtype=t.mapSubtypes=t.isOptionalType=t.getParameterListDetails=t.ParameterSource=void 0,t.getDeclaringModulesForType=t.computeMroLinearization=t.requiresSpecialization=t.requiresTypeArguments=t.getGeneratorTypeArgs=t.removeParamSpecVariadicsFromSignature=t.specializeTupleClass=t.combineSameSizedTuples=t.explodeGenericClass=t.isPartlyUnknown=t.containsUnknown=t.getMembersForModule=void 0;const i=n(5839),s=n(817),r=n(1766),a=n(2917),o=n(1133),l=n(1659);var c;function p(e,t){if((0,o.isUnion)(e)){const n=[];let i=!1;if(e.subtypes.forEach((s=>{const r=t(s);r?r!==s?(n.push(m(r,h(e))),i=!0):n.push(s):i=!0})),!i)return e;const s=(0,o.combineTypes)(n);return 9===s.category&&o.UnionType.addTypeAliasSource(s,e),s}return t(e)||o.NeverType.create()}function d(e,t){(0,o.isUnion)(e)?e.subtypes.forEach(((e,n)=>{t(e,n)})):t(e,0)}function u(e){return(0,o.isClass)(e)?(void 0!==e.literalValue&&(e=o.ClassType.cloneWithLiteral(e,void 0)),e):(0,o.isUnion)(e)?p(e,(e=>u(e))):e}function m(e,t){if(!t)return e;switch(e.category){case 0:case 1:case 2:case 4:case 8:case 10:return e;case 3:case 5:case 7:return o.TypeBase.cloneForCondition(e,o.TypeCondition.combine(e.condition,t));case 6:return o.OverloadedFunctionType.create(e.overloads.map((e=>m(e,t))));case 9:return(0,o.combineTypes)(e.subtypes.map((e=>m(e,t))))}}function h(e){switch(e.category){case 0:case 1:case 2:case 4:case 8:case 10:case 6:case 9:return;case 3:case 7:case 5:return e.condition}}function y(e){return(0,o.isClass)(e)||(0,o.isFunction)(e)?e.details.typeVarScopeId:(0,o.isTypeVar)(e)?e.scopeId:void 0}function g(e){return o.TypeBase.isInstance(e)&&void 0!==e.literalValue}function f(e,t=!1,n=0){if(n>o.maxTypeRecursionCount)return!1;if((0,o.isClassInstance)(e)&&g(e))return!0;if(t&&(0,o.isClass)(e)){const i=e.tupleTypeArguments||e.typeArguments;if(i)return i.some((e=>f(e,t,n+1)))}return!!(0,o.isUnion)(e)&&e.subtypes.some((e=>f(e,t,n+1)))}function T(e){return(0,o.isAny)(e)&&e.isEllipsis}function _(e){return(0,o.isClassInstance)(e)&&o.ClassType.isBuiltIn(e,"NoReturn")}function v(e){return o.ClassType.isBuiltIn(e,"tuple")}function b(e){return e.tupleTypeArguments&&2===e.tupleTypeArguments.length&&T(e.tupleTypeArguments[1])}function I(e,t,n,i=!1){if(o.ClassType.isUnspecialized(t))return e;const s=k(t,void 0,i);return n&&C(s,t,n),F(e,s)}function C(e,t,n){const i=w(t,!1);e.setTypeVarType(i,N(n))}function S(e,t){return new W(t).apply(e)}function F(e,t,n=!1,i=!1,s=!1){return!t.isEmpty()||n||s?new j(t,n,i,s).apply(e):e}function D(e,t,n=0){var i;return null===(i=P(e,t,n).next())||void 0===i?void 0:i.value}function*P(e,t,n=0){const i=0!=(16&n);if((0,o.isClass)(e)){let r=0;1&n&&(r|=1),2&n&&(r|=2),4&n&&(r|=4);const a=x(e,r);for(const[e,r]of a){if(!(0,o.isInstantiableClass)(e)){if(!i){const e={symbol:s.Symbol.createWithType(0,o.UnknownType.create()),isInstanceMember:!1,classType:o.UnknownType.create(),isTypeDeclared:!1};yield e}continue}if(!(0,o.isInstantiableClass)(r))continue;const a=r.details.fields;if(0==(8&n)){const e=a.get(t);if(e&&e.isInstanceMember()){const t=e.hasTypedDeclarations();if(!i||t){const n={symbol:e,isInstanceMember:!0,classType:r,isTypeDeclared:t};yield n}}}const l=a.get(t);if(l&&l.isClassMember()){const e=l.hasTypedDeclarations();if(!i||e){let t=!1;if(o.ClassType.isDataClass(r)||o.ClassType.isTypedDictClass(r)){const e=l.getDeclarations();e.length>0&&1===e[0].type&&(t=!0)}const n={symbol:l,isInstanceMember:t,classType:r,isTypeDeclared:e};yield n}}}}else if((0,o.isAnyOrUnknown)(e)){const e={symbol:s.Symbol.createWithType(0,o.UnknownType.create()),isInstanceMember:!1,classType:o.UnknownType.create(),isTypeDeclared:!1};yield e}}function*x(e,t=0){if((0,o.isClass)(e)){let n=0!=(1&t);for(const i of e.details.mro){if(n){n=!1;continue}const s=I(i,e);if(!(4&t&&(0,o.isInstantiableClass)(s)&&o.ClassType.isBuiltIn(s,"object"))&&(yield[i,s],0!=(2&t)))break}}}function A(e,t){for(const n of t)e.find((e=>(0,o.isTypeSame)(N(e),N(n))))||e.push(n)}function k(e,t=!0,n=!1){const i=o.ClassType.getTypeParameters(e);let s=e.typeArguments;s||t?n&&(s=null==s?void 0:s.map((e=>S(e,i)))):s=i;const r=E(i,s,y(e));return o.ClassType.isTupleClass(e)&&e.tupleTypeArguments&&i.length>=1&&r.setVariadicTypeVar(i[0],e.tupleTypeArguments),r}function E(e,t,n){const i=new l.TypeVarMap(n);return e.forEach(((e,n)=>{let s;if(t)if((0,o.isParamSpec)(e)){if(n<t.length)if(s=t[n],(0,o.isFunction)(s)&&o.FunctionType.isParamSpecValue(s)){const t=[],n=s;s.details.parameters.forEach(((e,i)=>{t.push({category:e.category,name:e.name,hasDefault:!!e.hasDefault,isNameSynthesized:e.isNameSynthesized,type:o.FunctionType.getEffectiveParameterType(n,i)})})),i.setParamSpec(e,{parameters:t,flags:s.details.flags,paramSpec:s.details.paramSpec})}else(0,o.isParamSpec)(s)&&i.setParamSpec(e,{flags:0,parameters:[],paramSpec:s})}else s=n>=t.length?o.AnyType.create():t[n],i.setTypeVarType(e,s,s,!0)})),i}function w(e,t){var n;const i=o.TypeVarType.createInstance("__type_of_self__"),s=null!==(n=y(e))&&void 0!==n?n:"";i.details.isSynthesized=!0,i.details.isSynthesizedSelfCls=!0,i.nameWithScope=o.TypeVarType.makeNameWithScope(i.details.name,s),i.scopeId=s;const r=o.ClassType.cloneForSpecialization(e,o.ClassType.getTypeParameters(e),!1,!0);return i.details.boundType=o.ClassType.cloneAsInstance(r),t?o.TypeVarType.cloneAsInstantiable(i):i}function N(e){let t=p(e,(e=>{switch(e.category){case 7:return o.ClassType.isBuiltIn(e,"Type")?!e.typeArguments||e.typeArguments.length<1?o.UnknownType.create():R(e.typeArguments[0]):o.ClassType.cloneAsInstance(e);case 3:return o.NoneType.createInstance();case 5:if(o.TypeBase.isInstantiable(e))return o.FunctionType.cloneAsInstance(e);break;case 10:if(o.TypeBase.isInstantiable(e))return o.TypeVarType.cloneAsInstance(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=o.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function R(e){let t=p(e,(e=>{switch(e.category){case 7:if(o.TypeBase.isInstance(e))return o.ClassType.cloneAsInstantiable(e);break;case 3:return o.NoneType.createType();case 5:if(o.TypeBase.isInstance(e))return o.FunctionType.cloneAsInstantiable(e);break;case 10:if(o.TypeBase.isInstance(e))return o.TypeVarType.cloneAsInstantiable(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=o.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function M(e,t,n=!0,i=!0,s=!1){let r=o.AnyType.create(!1);r=2===t.length&&T(t[1])?t[0]:(0,o.combineTypes)(t),i&&(r=u(r)),(0,o.isNever)(r)&&(r=o.AnyType.create());const a=o.ClassType.cloneForSpecialization(e,[r],n,void 0,t);return s&&(a.isTupleForUnpackedVariadicTypeVar=!0),a}function O(e){const t=e.details.parameters.length;if(t<2)return e;const n=e.details.parameters[t-2],i=e.details.parameters[t-1];return 1===n.category&&2===i.category&&(0,o.isParamSpec)(n.type)&&(0,o.isParamSpec)(i.type)&&(0,o.isTypeSame)(n.type,i.type)?o.FunctionType.cloneRemoveParamSpecVariadics(e,n.type):e}function L(e){return(0,o.isClassInstance)(e)&&v(e)&&e.tupleTypeArguments&&e.isTupleForUnpackedVariadicTypeVar?(0,o.combineTypes)(e.tupleTypeArguments):e}function V(e){if((0,o.isClassInstance)(e)&&o.ClassType.isBuiltIn(e)){const t=e.details.name;if("Generator"===t||"AsyncGenerator"===t)return e.typeArguments}}function U(e,t=!1,n=0){var i;switch(e.category){case 7:return!(o.ClassType.isPseudoGenericClass(e)&&t||(e.typeArguments?n>o.maxTypeRecursionCount||void 0===e.typeArguments.find((e=>U(e,t,n+1))):!(o.ClassType.getTypeParameters(e).length>0)));case 5:{if(n>o.maxTypeRecursionCount)return!1;if(e.details.paramSpec)return!0;for(let i=0;i<e.details.parameters.length;i++)if(U(o.FunctionType.getEffectiveParameterType(e,i),t,n+1))return!0;const i=e.specializedTypes&&e.specializedTypes.returnType?e.specializedTypes.returnType:e.details.declaredReturnType;if(i){if(U(i,t,n+1))return!0}else if(e.inferredReturnType&&U(e.inferredReturnType,t,n+1))return!0;return!1}case 6:return void 0!==e.overloads.find((e=>U(e,t,n+1)));case 9:return void 0!==(0,o.findSubtype)(e,(e=>U(e,t,n+1)));case 10:if(!e.details.recursiveTypeAliasName)return!0;if(null===(i=e.typeAliasInfo)||void 0===i?void 0:i.typeArguments)return e.typeAliasInfo.typeArguments.some((e=>U(e,t,n+1)))}return!1}function z(e,t,n=0){if(n>o.maxTypeRecursionCount)return;const i=e=>{e&&!t.some((t=>t===e))&&t.push(e)};switch(e.category){case 7:case 5:i(e.details.moduleName);break;case 6:e.overloads.forEach((e=>{z(e,t,n+1)}));break;case 9:d(e,(e=>{z(e,t,n+1)}));break;case 8:i(e.moduleName)}}!function(e){e[e.PositionOnly=0]="PositionOnly",e[e.PositionOrKeyword=1]="PositionOrKeyword",e[e.KeywordOnly=2]="KeywordOnly"}(c=t.ParameterSource||(t.ParameterSource={})),t.getParameterListDetails=function(e){const t={firstPositionOrKeywordIndex:0,positionOnlyParamCount:0,params:[]};let n=e.details.parameters.findIndex((e=>0===e.category&&!e.name));if(n<0)for(let t=0;t<e.details.parameters.length;t++){const i=e.details.parameters[t];if(0!==i.category)break;if(!i.name)break;if((0,r.isDunderName)(i.name)||!i.name.startsWith("__"))break;n=t+1}n>=0&&(t.firstPositionOrKeywordIndex=n);for(let i=0;i<n&&!e.details.parameters[i].hasDefault;i++)t.positionOnlyParamCount++;let i=!1;return e.details.parameters.forEach(((e,s)=>{1===e.category&&(i||(t.firstKeywordOnlyIndex=t.params.length,i=!0),e.name&&void 0===t.argsIndex&&(t.argsIndex=t.params.length,(0,o.isVariadicTypeVar)(e.type)&&(t.variadicArgsIndex=t.params.length))),2===e.category&&void 0===t.kwargsIndex&&(t.kwargsIndex=t.params.length),0===e.category&&(0,o.isVariadicTypeVar)(e.type)&&(t.variadicParamIndex=s),e.name&&t.params.push({param:e,index:s,source:i?c.KeywordOnly:n>=0&&s<n?c.PositionOnly:c.PositionOrKeyword})})),t},t.isOptionalType=function(e){return!!(0,o.isUnion)(e)&&void 0!==(0,o.findSubtype)(e,(e=>(0,o.isNone)(e)))},t.mapSubtypes=p,t.doForEachSubtype=d,t.areTypesSame=function(e,t){if(e.length<2)return!0;for(let n=1;n<e.length;n++)if(!(0,o.isTypeSame)(e[0],e[n],t))return!1;return!0},t.isUnionableType=function(e){let t=3;for(const n of e)t&=n.flags;return 0!=(1&t)&&0==(2&t)},t.derivesFromAnyOrUnknown=function(e){let t=!1;return d(e,(n=>{(0,o.isAnyOrUnknown)(e)?t=!0:(0,o.isInstantiableClass)(n)?o.ClassType.hasUnknownBaseClass(n)&&(t=!0):(0,o.isClassInstance)(n)&&o.ClassType.hasUnknownBaseClass(n)&&(t=!0)})),t},t.getFullNameOfType=function(e){var t;if(null===(t=e.typeAliasInfo)||void 0===t?void 0:t.fullName)return e.typeAliasInfo.fullName;switch(e.category){case 2:case 1:return"typing.Any";case 3:return"builtins.None";case 7:case 5:return e.details.fullName;case 8:return e.moduleName;case 6:return e.overloads[0].details.fullName}},t.stripLiteralValue=u,t.addConditionToType=m,t.getTypeCondition=h,t.isTypeAliasPlaceholder=function(e){return!!(0,o.isTypeVar)(e)&&!!e.details.recursiveTypeAliasName&&!e.details.boundType},t.isTypeAliasRecursive=function(e,t){return 9!==t.category?t===e||(0,o.isUnbound)(t)&&t.typeAliasInfo&&t.typeAliasInfo.name===e.details.recursiveTypeAliasName:void 0!==(0,o.findSubtype)(t,(t=>(0,o.isTypeSame)(e,t)))},t.transformPossibleRecursiveTypeAlias=function(e){var t;if(e&&(0,o.isTypeVar)(e)&&e.details.recursiveTypeAliasName&&e.details.boundType){const n=o.TypeBase.isInstance(e)?N(e.details.boundType):e.details.boundType;return(null===(t=e.typeAliasInfo)||void 0===t?void 0:t.typeArguments)&&e.details.recursiveTypeParameters?F(n,E(e.details.recursiveTypeParameters,e.typeAliasInfo.typeArguments,y(e))):n}return e},t.getTypeVarScopeId=y,t.getSpecializedTupleType=function(e){let t;if((0,o.isInstantiableClass)(e)?t=e:(0,o.isClassInstance)(e)&&(t=o.ClassType.cloneAsInstantiable(e)),!t)return;const n=t.details.mro.find((e=>(0,o.isInstantiableClass)(e)&&v(e)));return n&&(0,o.isInstantiableClass)(n)?o.ClassType.isSameGenericClass(t,n)?t:F(n,k(t)):void 0},t.isLiteralType=g,t.isLiteralTypeOrUnion=function(e){return(0,o.isClassInstance)(e)?void 0!==e.literalValue:!!(0,o.isUnion)(e)&&!(0,o.findSubtype)(e,(e=>!(0,o.isClassInstance)(e)||void 0===e.literalValue))},t.containsLiteralType=f,t.isEllipsisType=T,t.isNoReturnType=_,t.removeNoReturnFromUnion=function(e){return(0,o.removeFromUnion)(e,(e=>_(e)))},t.isProperty=function(e){return(0,o.isClassInstance)(e)&&o.ClassType.isPropertyClass(e)},t.isTupleClass=v,t.isOpenEndedTupleClass=b,t.partiallySpecializeType=I,t.populateTypeVarMapForSelfType=C,t.markTypeVarsReplacementExempt=S,t.applySolvedTypeVars=F,t.transformExpectedTypeForConstructor=function(e,t,n){return(0,o.isTypeVar)(e)?(i=e,n.some((e=>i.scopeId===e))?e:void 0):new $(t,n).apply(e);var i},t.lookUpObjectMember=function(e,t,n=0){if((0,o.isClassInstance)(e))return D(e,t,n)},t.lookUpClassMember=D,t.getClassMemberIterator=P,t.getClassIterator=x,t.addTypeVarsToListIfUnique=A,t.getTypeVarArgumentsRecursive=function e(t,n=0){var i,s;if(n>o.maxTypeRecursionCount)return[];if(null===(i=t.typeAliasInfo)||void 0===i?void 0:i.typeArguments){const i=[];return null===(s=t.typeAliasInfo)||void 0===s||s.typeArguments.forEach((t=>{A(i,e(t,n+1))})),i}if((0,o.isTypeVar)(t))return t.details.recursiveTypeAliasName||(0,o.isParamSpec)(t)&&t.paramSpecAccess?[]:[o.TypeBase.isInstantiable(t)?o.TypeVarType.cloneAsInstance(t):t];if((0,o.isClass)(t))return(t=>{const i=[];return t.typeArguments&&t.typeArguments.forEach((t=>{A(i,e(t,n+1))})),i})(t);if((0,o.isUnion)(t)){const i=[];return d(t,(t=>{A(i,e(t,n+1))})),i}if((0,o.isFunction)(t)){const i=[];for(let s=0;s<t.details.parameters.length;s++)A(i,e(o.FunctionType.getEffectiveParameterType(t,s),n+1));t.details.paramSpec&&A(i,[t.details.paramSpec]);const s=o.FunctionType.getSpecializedReturnType(t);return s&&A(i,e(s,n+1)),i}return[]},t.specializeClassType=function(e){const t=new l.TypeVarMap(y(e));return o.ClassType.getTypeParameters(e).forEach((e=>{t.setTypeVarType(e,o.UnknownType.create())})),F(e,t)},t.setTypeArgumentsRecursive=function e(t,n,i,s=0){if(!(s>o.maxTypeRecursionCount||i.isLocked()))switch(t.category){case 9:d(t,(t=>{e(t,n,i,s+1)}));break;case 7:t.typeArguments&&t.typeArguments.forEach((t=>{e(t,n,i,s+1)})),t.tupleTypeArguments&&t.tupleTypeArguments.forEach((t=>{e(t,n,i,s+1)}));break;case 5:t.specializedTypes?(t.specializedTypes.parameterTypes.forEach((t=>{e(t,n,i,s+1)})),t.specializedTypes.returnType&&e(t.specializedTypes.returnType,n,i,s+1)):(t.details.parameters.forEach((t=>{e(t.type,n,i,s+1)})),t.details.declaredReturnType&&e(t.details.declaredReturnType,n,i,s+1));break;case 6:t.overloads.forEach((t=>{e(t,n,i,s+1)}));break;case 10:i.hasTypeVar(t)||i.setTypeVarType(t,n)}},t.buildTypeVarMapFromSpecializedClass=k,t.buildTypeVarMap=E,t.specializeForBaseClass=function(e,t){if(0===o.ClassType.getTypeParameters(t).length)return t;const n=F(t,k(e));return(0,i.assert)((0,o.isInstantiableClass)(n)),n},t.derivesFromClassRecursive=function e(t,n,i){if(o.ClassType.isSameGenericClass(t,n))return!0;for(const s of t.details.baseClasses)if((0,o.isInstantiableClass)(s)){if(e(s,n,i))return!0}else if(!i&&(0,o.isAnyOrUnknown)(s))return!0;return!1},t.synthesizeTypeVarForSelfCls=w,t.getDeclaredGeneratorSendType=function(e){const t=o.FunctionType.getSpecializedReturnType(e);if(t){const e=V(t);if(e)return e.length>=2?e[1]:o.UnknownType.create()}},t.getDeclaredGeneratorReturnType=function(e){const t=o.FunctionType.getSpecializedReturnType(e);if(t){const e=V(t);if(e)return e.length>=3?e[2]:o.UnknownType.create()}},t.getGeneratorYieldType=function(e,t){let n=!0;const i=p(e,(e=>(0,o.isAnyOrUnknown)(e)?e:(0,o.isClassInstance)(e)&&[["AsyncIterable","Iterable"],["AsyncIterator","Iterator"],["AsyncGenerator","Generator"]].some((n=>o.ClassType.isBuiltIn(e,t?n[0]:n[1])))?e.typeArguments&&e.typeArguments.length>=1?e.typeArguments[0]:o.UnknownType.create():void(n=!1)));return n?i:void 0},t.convertToInstance=N,t.convertToInstantiable=R,t.getMembersForClass=function(e,t,n){for(let i=0;i<e.details.mro.length;i++){const s=e.details.mro[i];if((0,o.isInstantiableClass)(s)){const e=o.ClassType.isTypedDictClass(s);s.details.fields.forEach(((i,s)=>{(i.isClassMember()||n&&i.isInstanceMember())&&(e&&(0,a.isTypedDictMemberAccessedThroughIndex)(i)||i.isInitVar()||t.get(s)||t.set(s,i))}))}}if(!n){const n=e.details.effectiveMetaclass;if(n&&(0,o.isInstantiableClass)(n))for(const e of n.details.mro){if(!(0,o.isInstantiableClass)(e))break;e.details.fields.forEach(((e,n)=>{t.get(n)||t.set(n,e)}))}}},t.getMembersForModule=function(e,t){e.loaderFields&&e.loaderFields.forEach(((e,n)=>{t.set(n,e)})),e.fields.forEach(((e,n)=>{t.set(n,e)}))},t.containsUnknown=function(e){let t=!1;return d(e,(e=>{(0,o.isUnknown)(e)&&(t=!0)})),t},t.isPartlyUnknown=function e(t,n=!1,i=0){var s;if(i>o.maxTypeRecursionCount)return!1;if((0,o.isUnknown)(t))return!0;if((null===(s=t.typeAliasInfo)||void 0===s?void 0:s.typeArguments)&&t.typeAliasInfo.typeArguments.some((t=>e(t,n,i+1))))return!0;if((0,o.isUnion)(t))return void 0!==(0,o.findSubtype)(t,(t=>e(t,n,i+1)));if((0,o.isClass)(t)){if(o.TypeBase.isInstance(t)&&(n=!1),!n&&!o.ClassType.isPseudoGenericClass(t)){const s=t.tupleTypeArguments||t.typeArguments;if(s)for(const t of s)if(e(t,n,i+1))return!0}return!1}if((0,o.isOverloadedFunction)(t))return t.overloads.some((t=>e(t,!1,i+1)));if((0,o.isFunction)(t)){for(let n=0;n<t.details.parameters.length;n++)if(t.details.parameters[n].name&&e(o.FunctionType.getEffectiveParameterType(t,n),!1,i+1))return!0;return!(!t.details.declaredReturnType||!e(t.details.declaredReturnType,!1,i+1))}return!1},t.explodeGenericClass=function(e){return e.typeArguments&&1===e.typeArguments.length&&(0,o.isUnion)(e.typeArguments[0])?(0,o.combineTypes)(e.typeArguments[0].subtypes.map((t=>o.ClassType.cloneForSpecialization(e,[t],!0)))):e},t.combineSameSizedTuples=function(e,t){if(!t||!(0,o.isInstantiableClass)(t))return;let n,i=!0;return d(e,(e=>{if((0,o.isClassInstance)(e)){let t;(0,o.isClass)(e)&&v(e)&&!b(e)&&(t=e),t||(t=e.details.mro.find((e=>(0,o.isClass)(e)&&v(e)&&!b(e)))),t&&(0,o.isClass)(t)&&t.tupleTypeArguments?n?n.length===t.tupleTypeArguments.length?t.tupleTypeArguments.forEach(((e,t)=>{n[t].push(e)})):i=!1:n=t.tupleTypeArguments.map((e=>[e])):i=!1}else i=!1})),i&&n?N(M(t,n.map((e=>(0,o.combineTypes)(e))))):void 0},t.specializeTupleClass=M,t.removeParamSpecVariadicsFromSignature=function(e){if((0,o.isFunction)(e))return O(e);const t=[];let n=!1;for(const i of e.overloads){const e=O(i);t.push(e),e!==i&&(n=!0)}return n?o.OverloadedFunctionType.create(t):e},t.getGeneratorTypeArgs=V,t.requiresTypeArguments=function(e){return e.details.typeParameters.length>0?!e.details.typeParameters[0].details.isSynthesized:!(!o.ClassType.isSpecialBuiltIn(e)||!["Tuple","Callable","Generic","Type","Optional","Union","Literal","Annotated","TypeGuard"].some((t=>t===(e.aliasName||e.details.name))))},t.requiresSpecialization=U,t.computeMroLinearization=function(e){let t=!0;const n=[],i=e.details.baseClasses.filter((e=>!(0,o.isInstantiableClass)(e)||!o.ClassType.isBuiltIn(e,"Generic")));i.forEach((e=>{if((0,o.isInstantiableClass)(e)){const t=k(e,!1);n.push(e.details.mro.map((e=>F(e,t))))}else n.push([e])})),n.push(i.map((t=>F(t,k(e,!1)))));const s=k(e,!1);e.details.mro.push(F(e,s));const r=(e,t)=>t.some((t=>t.findIndex((t=>(0,o.isInstantiableClass)(t)&&o.ClassType.isSameGenericClass(t,e)))>0)),a=(e,t)=>{for(let n=0;n<t.length;n++)t[n]=t[n].filter((t=>!(0,o.isInstantiableClass)(t)||!o.ClassType.isSameGenericClass(t,e)))};for(;;){let i,s=!1;for(let t=0;t<n.length;t++){const l=n[t];if(l.length>0){if(void 0===i&&(i=l),!(0,o.isInstantiableClass)(l[0])){s=!0,e.details.mro.push(l[0]),l.shift();break}if(!r(l[0],n)){s=!0,e.details.mro.push(l[0]),a(l[0],n);break}}}if(!i)break;s||(t=!1,(0,o.isInstantiableClass)(i[0])?(e.details.mro.push(i[0]),a(i[0],n)):(e.details.mro.push(i[0]),i.shift()))}return t},t.getDeclaringModulesForType=function(e){const t=[];return z(e,t),t};class B{apply(e,t=new Set,n=0){var i;if(n>o.maxTypeRecursionCount)return e;if(!U(e))return e;if((0,o.isAnyOrUnknown)(e))return e;if((0,o.isNone)(e))return e;if((0,o.isTypeVar)(e)){if(e.details.recursiveTypeAliasName){if(!(null===(i=e.typeAliasInfo)||void 0===i?void 0:i.typeArguments))return e;let s=!1;const r=e.typeAliasInfo.typeArguments.map((e=>{const i=this.apply(e,t,n+1);return i!==e&&(s=!0),i}));return s?o.TypeBase.cloneForTypeAlias(e,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,r):e}let s=e;const r=o.TypeVarType.getNameWithScope(e);return t.has(r)||(s=this.transformTypeVar(e),t.add(r),s=this.apply(s,t,n+1),(0,o.isVariadicTypeVar)(e)&&e.isVariadicInUnion&&(s=L(s)),t.delete(r)),s}if((0,o.isUnion)(e)){const i=p(e,(e=>{let i=this.apply(e,t,n+1);if((0,o.isVariadicTypeVar)(e)&&!(0,o.isVariadicTypeVar)(i)){const e=[];d(i,(t=>{e.push(L(t))})),i=(0,o.combineTypes)(e)}return i}));return this.transformUnion&&(0,o.isUnion)(i)?this.transformUnion(i):i}if((0,o.isClassInstance)(e)){const i=this._transformTypeVarsInClassType(o.ClassType.cloneAsInstantiable(e),t,n+1);return o.ClassType.cloneAsInstance(i)}if((0,o.isInstantiableClass)(e))return this._transformTypeVarsInClassType(e,t,n+1);if((0,o.isFunction)(e))return this._transformTypeVarsInFunctionType(e,t,n+1);if((0,o.isOverloadedFunction)(e)){let i=!1;const s=[];return e.overloads.forEach((e=>{const r=this._transformTypeVarsInFunctionType(e,t,n);s.push(r),r!==e&&(i=!0)})),i?o.OverloadedFunctionType.create(s):e}return e}transformTypeVar(e){return e}transformVariadicTypeVar(e){}transformParamSpec(e){}transformUnion(e){return e}_transformTypeVarsInClassType(e,t,n){if(0===o.ClassType.getTypeParameters(e).length&&!o.ClassType.isSpecialBuiltIn(e))return e;let i,s=[],r=!1;const a=o.ClassType.getTypeParameters(e),l=e=>{const t=this.transformParamSpec(e);if(!t)return o.UnknownType.create();if(r=!0,t.parameters.length>0){const e=o.FunctionType.createInstance("","","",65536);return t.parameters.forEach((t=>{o.FunctionType.addParameter(e,{category:t.category,name:t.name,hasDefault:t.hasDefault,isNameSynthesized:t.isNameSynthesized,hasDeclaredType:!0,type:t.type})})),e.details.paramSpec=t.paramSpec,e}return t.paramSpec?t.paramSpec:e};return e.typeArguments?s=e.typeArguments.map((e=>{if((0,o.isTypeVar)(e)&&e.details.isParamSpec)return l(e);if((0,o.isTypeVar)(e)&&e.details.isSynthesizedSelfCls&&e.details.boundType){const i=this.apply(e.details.boundType,t,n+1);if(i!==e.details.boundType)return r=!0,i}let i=this.apply(e,t,n+1);return i!==e&&(r=!0,(0,o.isTypeVar)(e)&&(0,o.isVariadicTypeVar)(e)&&e.isVariadicInUnion&&(i=L(i))),i})):a.forEach((e=>{let i=e;if(e.details.isParamSpec)i=l(e),i!==e&&(r=!0);else{const s=o.TypeVarType.getNameWithScope(e);t.has(s)||(i=this.transformTypeVar(e),i!==e&&(t.add(s),i=this.apply(i,t,n+1),t.delete(s),r=!0))}s.push(i)})),o.ClassType.isTupleClass(e)&&(e.tupleTypeArguments?(i=[],e.tupleTypeArguments.forEach((e=>{const s=this.apply(e,t,n+1);s!==e&&(r=!0),(0,o.isVariadicTypeVar)(e)&&(0,o.isClassInstance)(s)&&v(s)&&s.tupleTypeArguments?i.push(...s.tupleTypeArguments):i.push(s)}))):a.length>0&&(i=this.transformVariadicTypeVar(a[0]),i&&(r=!0))),r?o.ClassType.cloneForSpecialization(e,s,!0,void 0,i):e}_transformTypeVarsInFunctionType(e,t,n){let i=e;if(i.details.paramSpec){const e=this.transformParamSpec(i.details.paramSpec);e&&(i=o.FunctionType.cloneForParamSpec(i,e))}const s=i.specializedTypes&&i.specializedTypes.returnType?i.specializedTypes.returnType:i.details.declaredReturnType,r=s?this.apply(s,t,n+1):void 0;let a=s!==r;const l={parameterTypes:[],returnType:r};if(i.details.parameters.length>=2){const e=i.details.parameters[i.details.parameters.length-2],t=i.details.parameters[i.details.parameters.length-1],n=o.FunctionType.getEffectiveParameterType(i,i.details.parameters.length-2),s=o.FunctionType.getEffectiveParameterType(i,i.details.parameters.length-1);if(1===e.category&&2===t.category&&(0,o.isParamSpec)(n)&&(0,o.isParamSpec)(s)&&(0,o.isTypeSame)(n,s)){const e=this.transformParamSpec(n);e&&(i=o.FunctionType.cloneForParamSpecApplication(i,e))}}let c,p,d;for(let e=0;e<i.details.parameters.length;e++){const s=o.FunctionType.getEffectiveParameterType(i,e),r=this.apply(s,t,n+1);l.parameterTypes.push(r),void 0===c&&(0,o.isVariadicTypeVar)(s)&&0===i.details.parameters[e].category&&(c=e,(0,o.isClassInstance)(r)&&v(r)&&r.isTupleForUnpackedVariadicTypeVar&&(p=r.tupleTypeArguments)),s!==r&&(a=!0)}if(!a)return i;if(i.inferredReturnType&&(d=this.apply(i.inferredReturnType,t,n+1)),!p)return o.FunctionType.cloneForSpecialization(i,l,d);const u=o.FunctionType.createInstance("","","",64);return l.parameterTypes.forEach(((e,t)=>{if(t===c)p.forEach((e=>{o.FunctionType.addParameter(u,{category:0,name:`__p${u.details.parameters.length}`,isNameSynthesized:!0,type:e,hasDeclaredType:!0})}));else{const n={...i.details.parameters[t]};n.type=e,n.name&&n.isNameSynthesized&&(n.name=`__p${u.details.parameters.length}`),o.FunctionType.addParameter(u,n)}})),u.details.declaredReturnType=o.FunctionType.getSpecializedReturnType(i),u}}class W extends B{constructor(e){super(),this._exemptTypeVars=e}transformTypeVar(e){return this._exemptTypeVars.some((t=>(0,o.isTypeSame)(e,t)&&!e.isExemptFromReplacement))?o.TypeVarType.cloneAsExemptFromReplacement(e):e}}class j extends B{constructor(e,t=!1,n=!1,i=!1){super(),this._typeVarMap=e,this._unknownIfNotFound=t,this._useNarrowBoundOnly=n,this._eliminateUnsolvedInUnions=i}transformTypeVar(e){if(e.scopeId&&this._typeVarMap.hasSolveForScope(e.scopeId)&&!e.isExemptFromReplacement){let t=this._typeVarMap.getTypeVarType(e,this._useNarrowBoundOnly);if(!t&&this._useNarrowBoundOnly){const n=this._typeVarMap.getTypeVarType(e);n&&f(n,!0)&&(t=n)}if(t)return o.TypeBase.isInstantiable(e)&&(t=R(t)),t;if(this._unknownIfNotFound)return o.UnknownType.create()}return e}transformUnion(e){if(this._eliminateUnsolvedInUnions){const t=p(e,(e=>{if(!(0,o.isTypeVar)(e)||void 0===e.scopeId||!this._typeVarMap.hasSolveForScope(e.scopeId))return e}));return(0,o.isNever)(t)?e:t}return e}transformVariadicTypeVar(e){if(e.scopeId&&this._typeVarMap.hasSolveForScope(e.scopeId))return this._typeVarMap.getVariadicTypeVar(e)}transformParamSpec(e){if(e.scopeId&&this._typeVarMap.hasSolveForScope(e.scopeId))return this._typeVarMap.getParamSpec(e)}}class $ extends B{constructor(e,t){super(),this._typeVarMap=e,this._liveTypeVarScopes=t,this.dummyScopeId="__expected_type_scope_id",this.dummyTypeVarPrefix="__expected_type_",this._typeVarMap.addSolveForScope(this.dummyScopeId)}_isTypeVarLive(e){return this._liveTypeVarScopes.some((t=>e.scopeId===t))}_createDummyTypeVar(e){if(e.details.isSynthesized&&e.details.name.startsWith(this.dummyTypeVarPrefix))return e;const t=o.TypeBase.isInstance(e);let n=o.TypeVarType.createInstance(`__expected_type_${$.synthesizedTypeVarIndexForExpectedType}`);return n.details.isSynthesized=!0,n.scopeId=this.dummyScopeId,n.nameWithScope=o.TypeVarType.makeNameWithScope(n.details.name,this.dummyScopeId),t||(n=R(n)),n.details.boundType=e.details.boundType,n.details.constraints=e.details.constraints,n.details.variance=e.details.variance,$.synthesizedTypeVarIndexForExpectedType++,n}transformTypeVar(e){return this._isTypeVarLive(e)?e:this._createDummyTypeVar(e)}}$.synthesizedTypeVarIndexForExpectedType=1},1659:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeVarMap=void 0;const i=n(5839),s=n(1133),r=n(5168);class a{constructor(e){this._isLocked=!1,Array.isArray(e)?this._solveForScopes=e:this._solveForScopes=void 0!==e?[e]:void 0,this._typeVarMap=new Map,this._paramSpecMap=new Map}clone(){const e=new a;return this._solveForScopes&&(e._solveForScopes=[...this._solveForScopes]),this._typeVarMap.forEach((t=>{e.setTypeVarType(t.typeVar,t.narrowBound,t.wideBound,t.retainLiteral)})),this._paramSpecMap.forEach((t=>{e.setParamSpec(t.paramSpec,t.type)})),this._variadicTypeVarMap&&this._variadicTypeVarMap.forEach((t=>{e.setVariadicTypeVar(t.typeVar,t.types)})),e._isLocked=this._isLocked,e}copyFromClone(e){this._typeVarMap=e._typeVarMap,this._paramSpecMap=e._paramSpecMap,this._variadicTypeVarMap=e._variadicTypeVarMap,this._isLocked=e._isLocked}getSolveForScopes(){return this._solveForScopes}hasSolveForScope(e){return void 0!==e&&void 0!==this._solveForScopes&&this._solveForScopes.some((t=>t===e||t===s.WildcardTypeVarScopeId))}setSolveForScopes(e){this._solveForScopes=e}addSolveForScope(e){void 0===e||this.hasSolveForScope(e)||(this._solveForScopes||(this._solveForScopes=[]),this._solveForScopes.push(e))}isEmpty(){return 0===this._typeVarMap.size&&0===this._paramSpecMap.size}getScore(){let e=0;return this._typeVarMap.forEach((t=>{e+=1;const n=this.getTypeVarType(t.typeVar);e+=this._getSimplicityScoreForType(n)})),e+=this._paramSpecMap.size,e}hasTypeVar(e){return this._typeVarMap.has(this._getKey(e))}getTypeVarType(e,t=!1){const n=this._typeVarMap.get(this._getKey(e));if(n)return n.narrowBound?n.narrowBound:t?void 0:n.wideBound}setTypeVarType(e,t,n,s){(0,i.assert)(!this._isLocked);const r=this._getKey(e);this._typeVarMap.set(r,{typeVar:e,narrowBound:t,wideBound:n,retainLiteral:s})}getVariadicTypeVar(e){var t,n;return null===(n=null===(t=this._variadicTypeVarMap)||void 0===t?void 0:t.get(this._getKey(e)))||void 0===n?void 0:n.types}setVariadicTypeVar(e,t){(0,i.assert)(!this._isLocked);const n=this._getKey(e);this._variadicTypeVarMap||(this._variadicTypeVarMap=new Map),this._variadicTypeVarMap.set(n,{typeVar:e,types:t})}getTypeVar(e){const t=this._getKey(e);return this._typeVarMap.get(t)}getTypeVars(){const e=[];return this._typeVarMap.forEach((t=>{e.push(t)})),e}hasParamSpec(e){return this._paramSpecMap.has(this._getKey(e))}getParamSpec(e){var t;return null===(t=this._paramSpecMap.get(this._getKey(e)))||void 0===t?void 0:t.type}setParamSpec(e,t){(0,i.assert)(!this._isLocked),this._paramSpecMap.set(this._getKey(e),{paramSpec:e,type:t})}typeVarCount(){return this._typeVarMap.size}getWideTypeBound(e){const t=this._typeVarMap.get(this._getKey(e));if(t)return t.wideBound}getRetainLiterals(e){const t=this._typeVarMap.get(this._getKey(e));return!!(null==t?void 0:t.retainLiteral)}lock(){(0,i.assert)(!this._isLocked),this._isLocked=!0}unlock(){this._isLocked=!1}isLocked(){return this._isLocked}_getKey(e){return s.TypeVarType.getNameWithScope(e)}_getSimplicityScoreForType(e,t=0){if(t>s.maxTypeRecursionCount)return 0;switch(e.category){case 5:case 6:return.5;case 10:return 1;case 9:{let n=1;return e.subtypes.length<16&&(0,r.doForEachSubtype)(e,(e=>{const i=this._getSimplicityScoreForType(e,t+1);i<n&&(n=i)})),n/2}case 7:return this._getSimplicityScoreForClass(e,t+1)}return 0}_getSimplicityScoreForClass(e,t){let n=0,i=0,s=.5;return e.tupleTypeArguments?(e.tupleTypeArguments.forEach((e=>{n+=this._getSimplicityScoreForType(e,t+1),i++})),s+=n/i*.45):e.typeArguments?(e.typeArguments.forEach((e=>{n+=this._getSimplicityScoreForType(e,t+1),i++})),s+=n/i*.45):s+=.5,s}}t.TypeVarMap=a},9453:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getTypeFromIndexedTypedDict=t.assignToTypedDict=t.canAssignTypedDict=t.getTypedDictMembersForClass=t.synthesizeTypedDictClassMethods=t.createTypedDictType=void 0;const a=n(5839),o=n(1290),l=n(9744),c=n(1464),p=n(3550),d=n(2122),u=r(n(563)),m=r(n(8494)),h=n(817),y=n(2917),g=n(1133),f=n(5168);function T(e,t,n){(0,a.assert)(g.ClassType.isTypedDictClass(n));const i=g.FunctionType.createInstance("__new__","","",65);g.FunctionType.addParameter(i,{category:0,name:"cls",type:n,hasDeclaredType:!0}),g.FunctionType.addDefaultParameters(i),i.details.declaredReturnType=g.ClassType.cloneAsInstance(n);const s=g.FunctionType.createInstance("__init__","","",64);g.FunctionType.addParameter(s,{category:0,name:"self",type:g.ClassType.cloneAsInstance(n),hasDeclaredType:!0}),s.details.declaredReturnType=g.NoneType.createInstance(),g.FunctionType.addParameter(s,{category:1,type:g.AnyType.create(),hasDeclaredType:!0});const r=_(e,n);r.forEach(((e,t)=>{g.FunctionType.addParameter(s,{category:0,name:t,hasDefault:!e.isRequired,type:e.valueType,hasDeclaredType:!0})}));const o=n.details.fields;o.set("__init__",h.Symbol.createWithType(4,s)),o.set("__new__",h.Symbol.createWithType(4,i));const l=e.getBuiltInType(t,"str");if((0,g.isInstantiableClass)(l)){const i={category:0,name:"self",type:g.ClassType.cloneAsInstance(n),hasDeclaredType:!0},s=e.getScopeIdForNode(t);let a=g.TypeVarType.createInstance(`__${n.details.name}_default`);a.details.isSynthesized=!0,a=g.TypeVarType.cloneForScopeId(a,s,n.details.name,1);const c=(e,t,n)=>{const s=g.FunctionType.createInstance("get","","",320);return g.FunctionType.addParameter(s,i),g.FunctionType.addParameter(s,{category:0,name:"k",type:e,hasDeclaredType:!0}),n?(g.FunctionType.addParameter(s,{category:0,name:"default",type:t,hasDeclaredType:!0,hasDefault:!0}),s.details.declaredReturnType=t):s.details.declaredReturnType=(0,g.combineTypes)([t,g.NoneType.createInstance()]),s},p=(e,t)=>{const n={category:0,name:"k",type:e,hasDeclaredType:!0},r=g.FunctionType.createInstance("pop","","",320);g.FunctionType.addParameter(r,i),g.FunctionType.addParameter(r,n),r.details.declaredReturnType=t;const o=g.FunctionType.createInstance("pop","","",320);return g.FunctionType.addParameter(o,i),g.FunctionType.addParameter(o,n),g.FunctionType.addParameter(o,{category:0,name:"default",hasDeclaredType:!0,type:a,hasDefault:!0}),o.details.declaredReturnType=(0,g.combineTypes)([t,a]),o.details.typeVarScopeId=s,[r,o]},d=(e,t,n=!1)=>{const r=g.FunctionType.createInstance("setdefault","","",320);return g.FunctionType.addParameter(r,i),g.FunctionType.addParameter(r,{category:0,name:"k",hasDeclaredType:!0,type:e}),g.FunctionType.addParameter(r,{category:0,name:"default",hasDeclaredType:!0,type:n?g.AnyType.create():a,hasDefault:!0}),r.details.declaredReturnType=n?t:(0,g.combineTypes)([t,a]),r.details.typeVarScopeId=s,r},u=e=>{const t=g.FunctionType.createInstance("delitem","","",320);return g.FunctionType.addParameter(t,i),g.FunctionType.addParameter(t,{category:0,name:"k",hasDeclaredType:!0,type:e}),t.details.declaredReturnType=g.NoneType.createInstance(),t},m=[],y=[],f=[];r.forEach(((e,t)=>{const n=g.ClassType.cloneAsInstance(g.ClassType.cloneWithLiteral(l,t));e.isRequired||m.push(c(n,e.valueType,!1)),m.push(c(n,e.valueType,!0)),y.push(...p(n,e.valueType)),f.push(d(n,e.valueType,e.isRequired))}));const T=g.ClassType.cloneAsInstance(l);m.push(c(T,g.AnyType.create(),!1)),m.push(c(T,g.AnyType.create(),!0)),y.push(...p(T,g.AnyType.create())),f.push(d(T,g.AnyType.create())),o.set("get",h.Symbol.createWithType(4,g.OverloadedFunctionType.create(m))),o.set("pop",h.Symbol.createWithType(4,g.OverloadedFunctionType.create(y))),o.set("setdefault",h.Symbol.createWithType(4,g.OverloadedFunctionType.create(f))),o.set("__delitem__",h.Symbol.createWithType(4,u(T)))}}function _(e,t,n=!1){if(!t.details.typedDictEntries){const n=new Map;v(e,t,n),t.details.typedDictEntries=n}const i=new Map;return t.details.typedDictEntries.forEach(((e,t)=>{i.set(t,{...e})})),n&&t.typedDictNarrowedEntries&&t.typedDictNarrowedEntries.forEach(((e,t)=>{i.set(t,{...e})})),i}function v(e,t,n,i=0){(0,a.assert)(g.ClassType.isTypedDictClass(t)),i>g.maxTypeRecursionCount||(t.details.baseClasses.forEach((t=>{(0,g.isInstantiableClass)(t)&&g.ClassType.isTypedDictClass(t)&&v(e,t,n,i+1)})),t.details.fields.forEach(((i,s)=>{if(!i.isIgnoredForProtocolMatch()){const r=(0,y.getLastTypedDeclaredForSymbol)(i);if(r&&1===r.type){const a=e.getEffectiveTypeOfSymbol(i);let c=!g.ClassType.isCanOmitDictValues(t);(0,y.isRequiredTypedDictVariable)(i)?c=!0:(0,y.isNotRequiredTypedDictVariable)(i)&&(c=!1);const p=n.get(s);if(p&&!(0,g.isTypeSame)(p.valueType,a)){const t=new o.DiagnosticAddendum;t.addMessage(d.Localizer.DiagnosticAddendum.typedDictFieldRedefinition().format({parentType:e.printType(p.valueType),childType:e.printType(a)})),e.addDiagnostic(u.getFileInfo(r.node).diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,d.Localizer.Diagnostic.typedDictFieldRedefinition().format({name:s})+t.getString(),r.node)}n.set(s,{valueType:a,isRequired:c,isProvided:!1})}}})))}t.createTypedDictType=function(e,t,n,i){const s=u.getFileInfo(t);let r="TypedDict";if(0===i.length)e.addError(d.Localizer.Diagnostic.typedDictFirstArg(),t);else{const n=i[0];0===n.argumentCategory&&n.valueExpression&&48===n.valueExpression.nodeType?r=n.valueExpression.strings.map((e=>e.value)).join(""):e.addError(d.Localizer.Diagnostic.typedDictFirstArg(),i[0].valueExpression||t)}const a=g.ClassType.createInstantiable(r,m.getClassFullName(t,s.moduleName,r),s.moduleName,s.filePath,128,m.getTypeSourceId(t),void 0,n.details.effectiveMetaclass);a.details.baseClasses.push(n),(0,f.computeMroLinearization)(a);const o=a.details.fields;o.set("__class__",h.Symbol.createWithType(68,a));let l=!1;if(i.length<2)e.addError(d.Localizer.Diagnostic.typedDictSecondArgDict(),t);else{const n=i[1],r=new Map;if(0===n.argumentCategory&&n.valueExpression&&15===n.valueExpression.nodeType)l=!0,n.valueExpression.entries.forEach((t=>{if(17!==t.nodeType)return void e.addError(d.Localizer.Diagnostic.typedDictSecondArgDictEntry(),t);if(48!==t.keyExpression.nodeType)return void e.addError(d.Localizer.Diagnostic.typedDictEntryName(),t.keyExpression);const n=t.keyExpression.strings.map((e=>e.value)).join("");if(!n)return void e.addError(d.Localizer.Diagnostic.typedDictEmptyName(),t.keyExpression);if(r.has(n))return void e.addError(d.Localizer.Diagnostic.typedDictEntryUnique(),t.keyExpression);r.set(n,!0),e.getTypeForExpressionExpectingType(t.valueExpression,!0);const i=new h.Symbol(8),a={type:1,node:t.keyExpression,path:s.filePath,typeAnnotationNode:t.valueExpression,range:(0,c.convertOffsetsToRange)(t.keyExpression.start,p.TextRange.getEnd(t.keyExpression),s.lines),moduleName:s.moduleName};i.addDeclaration(a),o.set(n,i)}));else if(n.name)for(let n=1;n<i.length;n++){const s=i[n];if(!s.name||!s.valueExpression)continue;if(r.has(s.name.value)){e.addError(d.Localizer.Diagnostic.typedDictEntryUnique(),s.valueExpression);continue}r.set(s.name.value,!0),e.getTypeForExpressionExpectingType(s.valueExpression,!0);const a=new h.Symbol(8),l=u.getFileInfo(t),m={type:1,node:s.name,path:l.filePath,typeAnnotationNode:s.valueExpression,range:(0,c.convertOffsetsToRange)(s.name.start,p.TextRange.getEnd(s.valueExpression),l.lines),moduleName:l.moduleName};a.addDeclaration(m),o.set(s.name.value,a)}else e.addError(d.Localizer.Diagnostic.typedDictSecondArgDict(),t)}return l&&(i.length>=3&&(!i[2].name||"total"!==i[2].name.value||!i[2].valueExpression||11!==i[2].valueExpression.nodeType||15!==i[2].valueExpression.constType&&33!==i[2].valueExpression.constType?e.addError(d.Localizer.Diagnostic.typedDictTotalParam(),i[2].valueExpression||t):15===i[2].valueExpression.constType&&(a.details.flags|=256)),i.length>3&&e.addError(d.Localizer.Diagnostic.typedDictExtraArgs(),i[3].valueExpression||t)),T(e,t,a),a},t.synthesizeTypedDictClassMethods=T,t.getTypedDictMembersForClass=_,t.canAssignTypedDict=function(e,t,n,i,s=0){let r=!0;const a=_(e,t),o=_(e,n,!0);return a.forEach(((a,l)=>{const c=o.get(l);c?(a.isRequired&&!c.isRequired?(i&&i.addMessage(d.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:l,type:e.printType(t)})),r=!1):!a.isRequired&&c.isRequired&&(i&&i.addMessage(d.Localizer.DiagnosticAddendum.typedDictFieldNotRequired().format({name:l,type:e.printType(t)})),r=!1),e.canAssignType(a.valueType,c.valueType,void 0,void 0,void 0,s+1)||(i&&i.addMessage(d.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:l})),r=!1)):(i&&i.addMessage(d.Localizer.DiagnosticAddendum.typedDictFieldMissing().format({name:l,type:e.printType(n)})),r=!1)})),r},t.assignToTypedDict=function(e,t,n,i,s){(0,a.assert)((0,g.isClassInstance)(t)),(0,a.assert)(g.ClassType.isTypedDictClass(t)),(0,a.assert)(n.length===i.length);let r=!0;const o=new Map,l=_(e,t);if(n.forEach(((n,a)=>{if((0,g.isClassInstance)(n)&&g.ClassType.isBuiltIn(n,"str")&&(0,f.isLiteralType)(n)){const c=n.literalValue,p=l.get(c);p?(e.canAssignType(p.valueType,i[a])||(s&&s.addMessage(d.Localizer.DiagnosticAddendum.typedDictFieldTypeMismatch().format({name:n.literalValue,type:e.printType(i[a])})),r=!1),p.isRequired||o.set(c,{valueType:i[a],isRequired:!1,isProvided:!0}),p.isProvided=!0):(r=!1,s&&s.addMessage(d.Localizer.DiagnosticAddendum.typedDictFieldUndefined().format({name:n.literalValue,type:e.printType(g.ClassType.cloneAsInstance(t))})))}else r=!1})),r&&(l.forEach(((n,i)=>{n.isRequired&&!n.isProvided&&(s&&s.addMessage(d.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:i,type:e.printType(t)})),r=!1)})),r))return 0===o.size?t:g.ClassType.cloneForNarrowedTypedDictEntries(t,o)},t.getTypeFromIndexedTypedDict=function(e,t,n,i){if(1!==t.items.length)return e.addError(d.Localizer.Diagnostic.typeArgsMismatchOne().format({received:t.items.length}),t),{node:t,type:g.UnknownType.create()};if(t.trailingComma||t.items[0].name||0!==t.items[0].argumentCategory)return;const s=_(e,n,!0),r=e.getTypeOfExpression(t.items[0].valueExpression),a=r.type;let c=new o.DiagnosticAddendum,p=!0;const h=(0,f.mapSubtypes)(a,(r=>{if((0,g.isAnyOrUnknown)(r))return r;if((0,g.isClassInstance)(r)&&g.ClassType.isBuiltIn(r,"str")){if(void 0===r.literalValue)return g.UnknownType.create();const a=r.literalValue,o=s.get(a);return o?(o.isRequired||o.isProvided||"get"!==i.method||m.isWithinTryBlock(t,!0)||c.addMessage(d.Localizer.DiagnosticAddendum.keyNotRequired().format({name:a,type:e.printType(n)})),"set"===i.method?e.canAssignType(o.valueType,i.setType||g.AnyType.create(),c):"del"===i.method&&o.isRequired&&(c.addMessage(d.Localizer.DiagnosticAddendum.keyRequiredDeleted().format({name:a})),p=!1),o.valueType):(c.addMessage(d.Localizer.DiagnosticAddendum.keyUndefined().format({name:a,type:e.printType(n)})),p=!1,g.UnknownType.create())}return c.addMessage(d.Localizer.DiagnosticAddendum.typeNotStringLiteral().format({type:e.printType(r)})),p=!1,g.UnknownType.create()}));if(i.setExpectedTypeDiag&&(c=i.setExpectedTypeDiag),!c.isEmpty()){let n;n="set"===i.method?d.Localizer.Diagnostic.typedDictSet():"del"===i.method?d.Localizer.Diagnostic.typedDictDelete():d.Localizer.Diagnostic.typedDictAccess();const s=u.getFileInfo(t);e.addDiagnostic(p?s.diagnosticRuleSet.reportTypedDictNotRequiredAccess:s.diagnosticRuleSet.reportGeneralTypeIssues,p?l.DiagnosticRule.reportTypedDictNotRequiredAccess:l.DiagnosticRule.reportGeneralTypeIssues,n+c.getString(),t)}return{node:t,type:h,isIncomplete:!!r.isIncomplete}}},1133:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isSameWithoutLiteralValue=t.combineTypes=t.findSubtype=t.removeFromUnion=t.removeNoneFromUnion=t.removeUnbound=t.removeUnknownFromUnion=t.removeAnyFromUnion=t.isTypeSame=t.getTypeAliasInfo=t.isOverloadedFunction=t.isFunction=t.isParamSpec=t.isUnpackedVariadicTypeVar=t.isVariadicTypeVar=t.isTypeVar=t.isModule=t.isClassInstance=t.isInstantiableClass=t.isClass=t.isPossiblyUnbound=t.isUnion=t.isUnbound=t.isAnyOrUnknown=t.isUnknown=t.isAny=t.isNone=t.isNever=t.TypeVarType=t.UnionType=t.TypeCondition=t.AnyType=t.NeverType=t.NoneType=t.OverloadedFunctionType=t.FunctionType=t.ClassType=t.ModuleType=t.UnknownType=t.UnboundType=t.TypeBase=t.maxTypeRecursionCount=t.EnumLiteral=t.WildcardTypeVarScopeId=void 0;const i=n(5839);t.WildcardTypeVarScopeId="*";class s{constructor(e,t,n){this.className=e,this.itemName=t,this.itemType=n}}var r,a,o,l,c,p,d,u,m,h;function y(e){return 4===e.category}function g(e){return 3===e.category}function f(e){return 1===e.category}function T(e){return 2===e.category||1===e.category||!!v(e)&&void 0===e.subtypes.find((e=>!T(e)))}function _(e){return 0===e.category}function v(e){return 9===e.category}function b(e){return 7===e.category&&r.isInstantiable(e)}function I(e){return 7===e.category&&r.isInstance(e)}function C(e){return 10===e.category}function S(e,n,i=!1,s=!1,r=0){var a,c;if(e===n)return!0;if(e.category!==n.category)return!1;if(r>t.maxTypeRecursionCount)return!0;if(!s&&e.flags!==n.flags)return!1;switch(e.category){case 7:{const t=n;if(!o.isSameGenericClass(e,t,r+1))return!1;if(!d.isSame(e.condition,n.condition))return!1;if(!i||!o.isPseudoGenericClass(e))if(e.tupleTypeArguments&&t.tupleTypeArguments){const n=e.tupleTypeArguments||[],s=t.tupleTypeArguments||[];if(n.length!==s.length)return!1;for(let e=0;e<n.length;e++)if(!S(n[e],s[e],i,!1,r+1))return!1}else{const n=e.typeArguments||[],s=t.typeArguments||[],a=Math.max(n.length,s.length);for(let e=0;e<a;e++)if(!S(e<n.length?n[e]:p.create(),e<s.length?s[e]:p.create(),i,!1,r+1))return!1}return!!o.isLiteralValueSame(e,t)}case 5:{const t=n,s=e.details.parameters,a=t.details.parameters;if(s.length!==a.length)return!1;const o=s.findIndex((e=>0===e.category&&!e.name)),c=a.findIndex((e=>0===e.category&&!e.name));for(let n=0;n<s.length;n++){const p=s[n],d=a[n];if(p.category!==d.category)return!1;const u=void 0!==o&&n>=o;if(u!==(void 0!==c&&n>=c))return!1;if(u&&p.name!==d.name)return!1;if(!S(l.getEffectiveParameterType(e,n),l.getEffectiveParameterType(t,n),i,!1,r+1))return!1}let p=e.details.declaredReturnType;e.specializedTypes&&e.specializedTypes.returnType&&(p=e.specializedTypes.returnType),!p&&e.inferredReturnType&&(p=e.inferredReturnType);let d=t.details.declaredReturnType;return t.specializedTypes&&t.specializedTypes.returnType&&(d=t.specializedTypes.returnType),!d&&t.inferredReturnType&&(d=t.inferredReturnType),!!(!p&&!d||p&&d&&S(p,d,i,!1,r+1))}case 6:{const t=n;if(e.overloads.length!==t.overloads.length)return!1;for(let n=0;n<e.overloads.length;n++)if(!S(e.overloads[n],t.overloads[n],i,s,r+1))return!1;return!0}case 9:{const t=n,i=e.subtypes,s=t.subtypes;return i.length===s.length&&void 0===D(e,(e=>!u.containsType(t,e,r+1)))}case 10:{const t=n;if(e.scopeId!==t.scopeId)return!1;const s=(null===(a=null==e?void 0:e.typeAliasInfo)||void 0===a?void 0:a.typeArguments)||[],o=(null===(c=null==n?void 0:n.typeAliasInfo)||void 0===c?void 0:c.typeArguments)||[],l=Math.max(s.length,o.length);for(let e=0;e<l;e++)if(!S(e<s.length?s[e]:p.create(),e<o.length?o[e]:p.create(),i,!1,r+1))return!1;if(e.details===t.details)return!0;if(e.details.name!==t.details.name||e.details.isParamSpec!==t.details.isParamSpec||e.details.isVariadic!==t.details.isVariadic||e.details.isSynthesized!==t.details.isSynthesized||e.details.variance!==t.details.variance)return!1;const d=e.details.boundType,u=t.details.boundType;if(d){if(!u||!S(d,u,i,!1,r+1))return!1}else if(u)return!1;const m=e.details.constraints,h=t.details.constraints;if(m.length!==h.length)return!1;for(let e=0;e<m.length;e++)if(!S(m[e],h[e],i,!1,r+1))return!1;return!0}case 8:{const t=n;return e.fields===t.fields||0===e.fields.size&&0===t.fields.size}}return!0}function F(e,t){if(v(e)){const n=e.subtypes.filter((e=>!t(e)));if(n.length<e.subtypes.length){const t=P(n);return v(t)&&u.addTypeAliasSource(t,e),t}}return e}function D(e,t){return v(e)?e.subtypes.find((e=>t(e))):t(e)?e:void 0}function P(e,t){if(0===(e=e.filter((e=>4!==e.category))).length)return c.create();let n=!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0]){n=!1;break}if(n)return e[0];let i=[];const s=[];for(const t of e)v(t)?(i.push(...t.subtypes),t.typeAliasInfo?s.push(t):t.typeAliasSources&&s.push(...t.typeAliasSources)):i.push(t);if(i=i.sort(((e,t)=>I(e)&&void 0!==e.literalValue||b(e)&&void 0!==e.literalValue?1:I(t)&&void 0!==t.literalValue||b(t)&&void 0!==t.literalValue?-1:I(e)&&e.isEmptyContainer?1:I(t)&&t.isEmptyContainer?-1:0)),0===i.length)return a.create();const r=u.create();s.length>0&&(r.typeAliasSources=new Set,s.forEach((e=>{r.typeAliasSources.add(e)})));let l=!1;return i.forEach(((e,n)=>{0===n?u.addType(r,e):void 0===t||r.subtypes.length<t?function(e,t){if(I(t)&&void 0===t.condition){if(o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0!==e.literalStrMap)return void(e.literalStrMap.has(t.literalValue)||u.addType(e,t));if(o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&void 0!==e.literalIntMap)return void(e.literalIntMap.has(t.literalValue)||u.addType(e,t))}for(let n=0;n<e.subtypes.length;n++){const i=e.subtypes[n];if(S(i,t))return;if(I(i)&&I(t)){if(x(i,t)&&void 0===i.literalValue)return;if(o.isBuiltIn(i,"bool")&&!i.condition&&o.isBuiltIn(t,"bool")&&!t.condition&&void 0!==t.literalValue&&!t.literalValue===i.literalValue)return void(e.subtypes[n]=o.cloneWithLiteral(i,void 0))}if(I(t)&&t.isEmptyContainer&&I(i)&&o.isSameGenericClass(i,t))return}u.addType(e,t)}(r,e):l=!0})),l?p.create():1===r.subtypes.length?r.subtypes[0]:r}function x(e,t){return!!S(e,t)||(b(t)&&void 0!==t.literalValue||!(!I(t)||void 0===t.literalValue))&&S(e,t=o.cloneWithLiteral(t,void 0))}t.EnumLiteral=s,t.maxTypeRecursionCount=16,function(e){e.isInstantiable=function(e){return 0!=(1&e.flags)},e.isInstance=function(e){return 0!=(2&e.flags)},e.isAnnotated=function(e){return 0!=(4&e.flags)},e.isSpecialForm=function(e){return 0!=(8&e.flags)},e.setSpecialForm=function(e){return e.flags|=8},e.cloneForTypeAlias=function(e,t,n,i,s,r){const a={...e};return a.typeAliasInfo={name:t,fullName:n,typeParameters:s,typeArguments:r,typeVarScopeId:i},a},e.cloneForAnnotated=function(e){const t={...e};return t.flags|=4,t},e.cloneForCondition=function(e,t){if(void 0===e.condition&&void 0===t)return e;const n={...e};return n.condition=t,n}}(r=t.TypeBase||(t.TypeBase={})),function(e){const t={category:0,flags:3};e.create=function(){return t}}(t.UnboundType||(t.UnboundType={})),function(e){const t={category:1,flags:3};e.create=function(){return t}}(a=t.UnknownType||(t.UnknownType={})),(h=t.ModuleType||(t.ModuleType={})).create=function(e,t,n){return{category:8,fields:n||new Map,loaderFields:new Map,flags:1,moduleName:e,filePath:t}},h.getField=function(e,t){let n=e.fields.get(t);if(e.loaderFields)if(n){if(n.isExternallyHidden()){const i=e.loaderFields.get(t);i&&!i.isExternallyHidden()&&(n=i)}}else n=e.loaderFields.get(t);return n},function(e){function n(e,t){return!!(1&e.details.flags)&&(void 0===t||e.details.name===t||e.aliasName===t)}function i(n,i,s=0){if(s>t.maxTypeRecursionCount)return!0;if(n.details===i.details)return!0;const r=n.details,a=i.details;if(r===a)return!0;if(r.fullName!==a.fullName||r.flags!==a.flags||r.typeSourceId!==a.typeSourceId||r.baseClasses.length!==a.baseClasses.length||r.typeParameters.length!==a.typeParameters.length)return!1;if(e.isBuiltIn(n,"NamedTuple")&&e.isBuiltIn(i,"NamedTuple"))return!0;if(e.isBuiltIn(n,"tuple")&&e.isBuiltIn(i,"tuple"))return!0;for(let e=0;e<r.baseClasses.length;e++)if(!S(r.baseClasses[e],a.baseClasses[e],!0,void 0,s+1))return!1;if((r.declaredMetaclass||a.declaredMetaclass)&&(!r.declaredMetaclass||!a.declaredMetaclass||!S(r.declaredMetaclass,a.declaredMetaclass,!0,void 0,s+1)))return!1;for(let e=0;e<r.typeParameters.length;e++)if(!S(r.typeParameters[e],a.typeParameters[e],!0,void 0,s+1))return!1;return!0}e.createInstantiable=function(e,t,n,i,s,r,a,o,l){return{category:7,details:{name:e,fullName:t,moduleName:n,filePath:i,flags:s,typeSourceId:r,baseClasses:[],declaredMetaclass:a,effectiveMetaclass:o,mro:[],fields:new Map,typeParameters:[],docString:l},flags:1}},e.cloneAsInstance=function(e){if(r.isInstance(e))return e;const t={...e};return t.flags&=~9,t.flags|=2,t.includeSubclasses=!0,t},e.cloneAsInstantiable=function(e){if(r.isInstantiable(e))return e;const t={...e};return t.flags&=-3,t.flags|=1,t},e.cloneForSpecialization=function(e,t,n,i=!1,s,r){const o={...e};return o.typeArguments=t?t.map((e=>y(e)?a.create():e)):void 0,o.isTypeArgumentExplicit=n,i&&(o.includeSubclasses=!0),o.tupleTypeArguments=s?s.map((e=>y(e)?a.create():e)):void 0,void 0!==r&&(o.isEmptyContainer=r),o},e.cloneWithLiteral=function(e,t){const n={...e};return n.literalValue=t,n},e.cloneForTypingAlias=function(e,t){const n={...e};return n.aliasName=t,n},e.cloneForNarrowedTypedDictEntries=function(e,t){const n={...e};return n.typedDictNarrowedEntries=t,n},e.cloneWithNewTypeParameters=function(e,t){const n={...e};return n.details={...n.details},n.details.typeParameters=t,n},e.cloneForTypeGuard=function(e,t){const n={...e};return n.typeGuardType=t,n},e.isLiteralValueSame=function(e,t){return void 0===e.literalValue?void 0===t.literalValue:void 0!==t.literalValue&&(e.literalValue instanceof s?t.literalValue instanceof s&&e.literalValue.itemName===t.literalValue.itemName:e.literalValue===t.literalValue)},e.isUnspecialized=function(e){return e.details.typeParameters.length>0&&void 0===e.typeArguments},e.isSpecialBuiltIn=function(e,t){return!!(2&e.details.flags||e.aliasName)&&(void 0===t||e.details.name===t)},e.isBuiltIn=n,e.supportsAbstractMethods=function(e){return!!(512&e.details.flags)},e.isDataClass=function(e){return!!(4&e.details.flags)},e.isSkipSynthesizedDataClassInit=function(e){return!!(16&e.details.flags)},e.isSkipSynthesizedDataClassEq=function(e){return!!(32&e.details.flags)},e.isFrozenDataClass=function(e){return!!(8&e.details.flags)},e.isSynthesizedDataclassOrder=function(e){return!!(64&e.details.flags)},e.isDataClassKeywordOnlyParams=function(e){return!!(2097152&e.details.flags)},e.isGeneratedDataClassSlots=function(e){return!!(33554432&e.details.flags)},e.isSynthesizeDataClassUnsafeHash=function(e){return!!(67108864&e.details.flags)},e.isTypedDictClass=function(e){return!!(128&e.details.flags)},e.isCanOmitDictValues=function(e){return!!(256&e.details.flags)},e.isEnumClass=function(e){return!!(1048576&e.details.flags)},e.isPropertyClass=function(e){return!!(2048&e.details.flags)},e.isClassProperty=function(e){return!!(4194304&e.details.flags)},e.isFinal=function(e){return!!(4096&e.details.flags)},e.isProtocolClass=function(e){return!!(8192&e.details.flags)},e.isDefinedInStub=function(e){return!!(8388608&e.details.flags)},e.isPseudoGenericClass=function(e){return!!(16384&e.details.flags)},e.getDataClassEntries=function(e){return e.details.dataClassEntries||[]},e.isRuntimeCheckable=function(e){return!!(32768&e.details.flags)},e.isTypingExtensionClass=function(e){return!!(65536&e.details.flags)},e.isPartiallyConstructed=function(e){return!!(131072&e.details.flags)},e.hasCustomClassGetItem=function(e){return!!(262144&e.details.flags)},e.isTupleClass=function(e){return!!(524288&e.details.flags)},e.isReadOnlyInstanceVariables=function(e){return!!(16777216&e.details.flags)},e.getTypeParameters=function(e){return e.details.typeParameters},e.hasUnknownBaseClass=function(e){return e.details.mro.some((e=>T(e)))},e.isSameGenericClass=i,e.isDerivedFrom=function e(t,s,r){if(i(t,s))return r&&r.push(t),!0;if(n(t)&&n(s,"object"))return r&&r.push(s),!0;for(const n of t.details.baseClasses)if(b(n)){if(e(n,s,r))return r&&r.push(t),!0}else if(T(n))return r&&r.push(a.create()),!0;return!1}}(o=t.ClassType||(t.ClassType={})),function(e){function t(e,t,n,i,s,r){return{category:5,details:{name:e,fullName:t,moduleName:n,flags:i,parameters:[],docString:r},flags:s}}function n(e,t){return(0,i.assert)(t<e.details.parameters.length),e.specializedTypes?((0,i.assert)(t<e.specializedTypes.parameterTypes.length),e.specializedTypes.parameterTypes[t]):e.details.parameters[t].type}e.createInstance=function(e,n,i,s,r){return t(e,n,i,s,2,r)},e.createInstantiable=function(e,n,i,s,r){return t(e,n,i,s,1,r)},e.clone=function(e,i=!1,s,r){const a=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return a.details={...e.details},i&&(e.details.parameters.length>0&&0===e.details.parameters[0].category?(e.details.parameters.length>0&&!e.details.parameters[0].isTypeInferred&&(a.strippedFirstParamType=n(e,0)),a.details.parameters=e.details.parameters.slice(1)):i=!1,a.boundToType=s,a.details.flags&=-4,a.details.flags|=4),void 0!==e.typeAliasInfo&&(a.typeAliasInfo=e.typeAliasInfo),e.specializedTypes&&(a.specializedTypes={parameterTypes:i?e.specializedTypes.parameterTypes.slice(1):e.specializedTypes.parameterTypes,returnType:e.specializedTypes.returnType}),a.inferredReturnType=e.inferredReturnType,a.boundTypeVarScopeId=r,a},e.cloneAsInstance=function(e){(0,i.assert)(r.isInstantiable(e));const t={...e};return t.flags&=~9,t.flags|=2,t},e.cloneAsInstantiable=function(e){(0,i.assert)(r.isInstance(e));const t={...e};return t.flags&=-11,t.flags|=1,t},e.cloneForSpecialization=function(e,n,s){const r=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return r.details=e.details,(0,i.assert)(n.parameterTypes.length===e.details.parameters.length),r.specializedTypes=n,s&&(r.inferredReturnType=s),r},e.cloneForParamSpec=function(n,i){const s=t(n.details.name,n.details.fullName,n.details.moduleName,n.details.flags,n.flags,n.details.docString);return s.specializedTypes=n.specializedTypes,s.details={...n.details},delete s.details.paramSpec,i&&(s.details.parameters=[...n.details.parameters,...i.parameters.map((e=>({category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:e.isNameSynthesized,hasDeclaredType:!0,type:e.type})))],s.details.flags=65543&i.flags|64,e.isParamSpecValue(n)&&(s.details.flags|=65536),s.specializedTypes&&i.parameters.forEach((e=>{s.specializedTypes.parameterTypes.push(e.type)})),s.details.paramSpec=i.paramSpec),s},e.cloneForParamSpecApplication=function(e,n){const i=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return i.details={...e.details},i.details.parameters=i.details.parameters.slice(0,i.details.parameters.length-2),n.parameters.forEach((e=>{i.details.parameters.push({category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:e.isNameSynthesized,hasDeclaredType:!0,type:e.type})})),i.details.paramSpec=n.paramSpec,i},e.cloneRemoveParamSpecVariadics=function(e,n){const i=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return i.details={...e.details},i.details.parameters=i.details.parameters.slice(0,i.details.parameters.length-2),e.specializedTypes&&(i.specializedTypes={...e.specializedTypes},i.specializedTypes.parameterTypes=i.specializedTypes.parameterTypes.slice(0,i.specializedTypes.parameterTypes.length-2)),i.details.paramSpec||(i.details.paramSpec=n),i},e.addDefaultParameters=function(t,n=!1){e.addParameter(t,{category:1,name:"args",type:n?a.create():p.create(),hasDeclaredType:!n}),e.addParameter(t,{category:2,name:"kwargs",type:n?a.create():p.create(),hasDeclaredType:!n})},e.isInstanceMethod=function(e){return 0==(7&e.details.flags)},e.isConstructorMethod=function(e){return 0!=(1&e.details.flags)},e.isStaticMethod=function(e){return 0!=(4&e.details.flags)},e.isClassMethod=function(e){return 0!=(2&e.details.flags)},e.isAbstractMethod=function(e){return 0!=(8&e.details.flags)},e.isGenerator=function(e){return 0!=(16&e.details.flags)},e.isSynthesizedMethod=function(e){return 0!=(64&e.details.flags)},e.isSkipConstructorCheck=function(e){return 0!=(128&e.details.flags)},e.isOverloaded=function(e){return 0!=(256&e.details.flags)},e.isDefaultParameterCheckDisabled=function(e){return 0!=(32&e.details.flags)},e.isAsync=function(e){return 0!=(512&e.details.flags)},e.isWrapReturnTypeInAwait=function(e){return 0!=(1024&e.details.flags)},e.isStubDefinition=function(e){return 0!=(2048&e.details.flags)},e.isPyTypedDefinition=function(e){return 0!=(4096&e.details.flags)},e.isFinal=function(e){return 0!=(8192&e.details.flags)},e.hasUnannotatedParams=function(e){return 0!=(16384&e.details.flags)},e.shouldSkipParamCompatibilityCheck=function(e){return 0!=(32768&e.details.flags)},e.isParamSpecValue=function(e){return 0!=(65536&e.details.flags)},e.getEffectiveParameterType=n,e.addParameter=function(e,t){e.details.parameters.push(t)},e.getSpecializedReturnType=function(e){return e.specializedTypes&&e.specializedTypes.returnType?e.specializedTypes.returnType:e.details.declaredReturnType}}(l=t.FunctionType||(t.FunctionType={})),(m=t.OverloadedFunctionType||(t.OverloadedFunctionType={})).create=function(e=[]){return{category:6,overloads:e,flags:2}},m.addOverload=function(e,t){e.overloads.push(t)},function(e){const t={category:3,flags:2},n={category:3,flags:1};e.createInstance=function(){return t},e.createType=function(){return n}}(t.NoneType||(t.NoneType={})),function(e){const t={category:4,flags:3};e.create=function(){return t}}(c=t.NeverType||(t.NeverType={})),function(e){const t={category:2,isEllipsis:!1,flags:3},n={category:2,isEllipsis:!0,flags:3};e.create=function(e=!1){return e?n:t}}(p=t.AnyType||(t.AnyType={})),function(e){function t(e,t){return e.typeVarName<t.typeVarName?-1:e.typeVarName>t.typeVarName?1:e.constraintIndex<t.constraintIndex?-1:e.constraintIndex>t.constraintIndex?1:0}e.combine=function(e,n){if(!e)return n;if(!n)return e;const i=[...e];return n.forEach((e=>{i.some((n=>0===t(e,n)))||i.push(e)})),i.sort(t)},e.isSame=function(e,t){return e?!(!t||e.length!==t.length)&&void 0===e.find(((e,n)=>e.typeVarName!==t[n].typeVarName||e.constraintIndex!==t[n].constraintIndex)):!t},e.isCompatible=function(e,t){if(!e||!t)return!0;for(const n of e){let e=!1;const i=t.find((t=>n.typeVarName===t.typeVarName&&(e=!0,n.constraintIndex===t.constraintIndex)));if(e&&!i)return!1}return!0}}(d=t.TypeCondition||(t.TypeCondition={})),function(e){e.create=function(){return{category:9,subtypes:[],flags:3}},e.addType=function(e,t){I(t)&&o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0===t.condition?(void 0===e.literalStrMap&&(e.literalStrMap=new Map),e.literalStrMap.set(t.literalValue,t)):I(t)&&o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&void 0===t.condition&&(void 0===e.literalIntMap&&(e.literalIntMap=new Map),e.literalIntMap.set(t.literalValue,t)),e.flags&=t.flags,e.subtypes.push(t)},e.containsType=function(e,t,n=0){if(I(t)&&void 0===t.condition){if(o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0!==e.literalStrMap)return e.literalStrMap.has(t.literalValue);if(o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&void 0!==e.literalIntMap)return e.literalIntMap.has(t.literalValue)}return void 0!==e.subtypes.find((e=>S(e,t,void 0,void 0,n+1)))},e.addTypeAliasSource=function(e,t){if(9===t.category){const n=t.typeAliasInfo?[t]:t.typeAliasSources;n&&(e.typeAliasSources||(e.typeAliasSources=new Set),n.forEach((t=>{e.typeAliasSources.add(t)})))}}}(u=t.UnionType||(t.UnionType={})),function(e){function t(e,t){return`${e}.${t}`}function n(e,t,n){return{category:10,details:{name:e,constraints:[],variance:0,isParamSpec:t,isVariadic:!1,isSynthesized:!1},flags:n}}e.createInstance=function(e){return n(e,!1,2)},e.createInstantiable=function(e,t=!1){return n(e,t,1)},e.cloneAsInstance=function(e){(0,i.assert)(r.isInstantiable(e));const t={...e};return t.flags&=~9,t.flags|=2,t},e.cloneAsInstantiable=function(e){(0,i.assert)(r.isInstance(e));const t={...e};return t.flags&=-11,t.flags|=1,t},e.cloneAsExemptFromReplacement=function(e){const t={...e};return t.isExemptFromReplacement=!0,t},e.cloneForScopeId=function(e,n,i,s){const r={...e};return r.nameWithScope=t(e.details.name,n),r.scopeId=n,r.scopeName=i,r.scopeType=s,r},e.cloneForUnpacked=function(e,t=!1){(0,i.assert)(e.details.isVariadic);const n={...e};return n.isVariadicUnpacked=!0,n.isVariadicInUnion=t,n},e.cloneForPacked=function(e){(0,i.assert)(e.details.isVariadic);const t={...e};return t.isVariadicUnpacked=!1,t.isVariadicInUnion=!1,t},e.cloneAsInvariant=function(e){if(e.details.isParamSpec||e.details.isVariadic)return e;if(0===e.details.variance&&void 0===e.details.boundType&&0===e.details.constraints.length)return e;const t={...e};return t.details={...t.details},t.details.variance=0,t.details.boundType=void 0,t.details.constraints=[],t},e.cloneForParamSpecAccess=function(e,t){const n={...e};return n.paramSpecAccess=t,n},e.makeNameWithScope=t,e.addConstraint=function(e,t){e.details.constraints.push(t)},e.getNameWithScope=function(e){return e.nameWithScope||e.details.name},e.getReadableName=function(e){return e.scopeName?`${e.details.name}@${e.scopeName}`:e.details.name}}(t.TypeVarType||(t.TypeVarType={})),t.isNever=y,t.isNone=g,t.isAny=function(e){return 2===e.category},t.isUnknown=f,t.isAnyOrUnknown=T,t.isUnbound=_,t.isUnion=v,t.isPossiblyUnbound=function e(t){return!!_(t)||!!v(t)&&void 0!==t.subtypes.find((t=>e(t)))},t.isClass=function(e){return 7===e.category},t.isInstantiableClass=b,t.isClassInstance=I,t.isModule=function(e){return 8===e.category},t.isTypeVar=C,t.isVariadicTypeVar=function(e){return 10===e.category&&e.details.isVariadic},t.isUnpackedVariadicTypeVar=function(e){return v(e)&&1===e.subtypes.length&&(e=e.subtypes[0]),10===e.category&&e.details.isVariadic&&!!e.isVariadicUnpacked},t.isParamSpec=function(e){return 10===e.category&&e.details.isParamSpec},t.isFunction=function(e){return 5===e.category},t.isOverloadedFunction=function(e){return 6===e.category},t.getTypeAliasInfo=function(e){return e.typeAliasInfo?e.typeAliasInfo:C(e)&&e.details.recursiveTypeAliasName&&e.details.boundType&&e.details.boundType.typeAliasInfo?e.details.boundType.typeAliasInfo:void 0},t.isTypeSame=S,t.removeAnyFromUnion=function(e){return F(e,(e=>T(e)))},t.removeUnknownFromUnion=function(e){return F(e,(e=>f(e)))},t.removeUnbound=function(e){return v(e)?F(e,(e=>_(e))):_(e)?a.create():e},t.removeNoneFromUnion=function(e){return F(e,(e=>g(e)))},t.removeFromUnion=F,t.findSubtype=D,t.combineTypes=P,t.isSameWithoutLiteralValue=x},9560:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisRunner=t.BackgroundAnalysis=void 0;const i=n(1267),s=n(2374),r=n(4795),a=n(3213),o=n(3584);class l extends r.BackgroundAnalysisBase{constructor(e){super(e);const t={rootDirectory:global.__rootDirectory,cancellationFolderName:(0,a.getCancellationFolderName)(),runner:void 0},n=new i.Worker(__filename,{workerData:t});this.setup(n)}}t.BackgroundAnalysis=l;class c extends r.BackgroundAnalysisRunnerBase{constructor(){super()}createHost(){return new o.FullAccessHost(this.fs)}createImportResolver(e,t,n){return new s.ImportResolver(e,t,n)}}t.BackgroundAnalysisRunner=c},4795:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisRunnerBase=t.BackgroundAnalysisBase=void 0;const a=n(1267),o=n(1241),l=n(8408),c=n(5055),p=n(3213),d=n(2930),u=n(2211),m=r(n(5839)),h=n(1290),y=n(9241),g=n(7345);t.BackgroundAnalysisBase=class{constructor(e){this.console=e,this._onAnalysisCompletion=o.nullCallback}setup(e){this._worker=e,e.on("message",(e=>this.onMessage(e))),e.on("error",(e=>{this.log(u.LogLevel.Error,`Error occurred on background thread: ${JSON.stringify(e)}`)}))}onMessage(e){switch(e.requestType){case"log":{const t=e.data;this.log(t.level,t.message);break}case"analysisResult":this._onAnalysisCompletion(T(e.data));break;default:m.fail(`${e.requestType} is not expected`)}}setCompletionCallback(e){this._onAnalysisCompletion=null!=e?e:o.nullCallback}setImportResolver(e){this.enqueueRequest({requestType:"setImportResolver",data:e.host.kind})}setConfigOptions(e){this.enqueueRequest({requestType:"setConfigOptions",data:e})}setTrackedFiles(e){this.enqueueRequest({requestType:"setTrackedFiles",data:e})}setAllowedThirdPartyImports(e){this.enqueueRequest({requestType:"setAllowedThirdPartyImports",data:e})}ensurePartialStubPackages(e){this.enqueueRequest({requestType:"ensurePartialStubPackages",data:{executionRoot:e}})}setFileOpened(e,t,n,i){this.enqueueRequest({requestType:"setFileOpened",data:{filePath:e,version:t,contents:n,isTracked:i}})}setFileClosed(e){this.enqueueRequest({requestType:"setFileClosed",data:e})}markAllFilesDirty(e){this.enqueueRequest({requestType:"markAllFilesDirty",data:e})}markFilesDirty(e,t){this.enqueueRequest({requestType:"markFilesDirty",data:{filePaths:e,evenIfContentsAreSame:t}})}startAnalysis(e,t){this._startOrResumeAnalysis("analyze",e,t)}_startOrResumeAnalysis(e,t,n){const{port1:i,port2:s}=new a.MessageChannel;i.on("message",(e=>{switch(e.requestType){case"analysisResult":this._onAnalysisCompletion(T(e.data));break;case"analysisPaused":s.close(),i.close(),this._startOrResumeAnalysis("resumeAnalysis",t,n);break;case"indexResult":{const{path:n,indexResults:i}=e.data;null==t||t.setWorkspaceIndex(n,i);break}case"analysisDone":(0,y.disposeCancellationToken)(n),s.close(),i.close();break;default:m.fail(`${e.requestType} is not expected`)}}));const r=(0,y.getCancellationTokenId)(n);this.enqueueRequest({requestType:e,data:r,port:s})}startIndexing(e,t,n){}refreshIndexing(e,t,n){}cancelIndexing(e){}async getDiagnosticsForRange(e,t,n){(0,p.throwIfCancellationRequested)(n);const{port1:i,port2:s}=new a.MessageChannel,r=(0,c.getBackgroundWaiter)(i),o=(0,y.getCancellationTokenId)(n);this.enqueueRequest({requestType:"getDiagnosticsForRange",data:{filePath:e,range:t,cancellationId:o},port:s});const l=await r;return s.close(),i.close(),_(l)}async writeTypeStub(e,t,n,i){(0,p.throwIfCancellationRequested)(i);const{port1:s,port2:r}=new a.MessageChannel,o=(0,c.getBackgroundWaiter)(s),l=(0,y.getCancellationTokenId)(i);this.enqueueRequest({requestType:"writeTypeStub",data:{targetImportPath:e,targetIsSingleFile:t,stubPath:n,cancellationId:l},port:r}),await o,r.close(),s.close()}invalidateAndForceReanalysis(){this.enqueueRequest({requestType:"invalidateAndForceReanalysis",data:null})}restart(){this.enqueueRequest({requestType:"restart",data:null})}enqueueRequest(e){this._worker&&this._worker.postMessage(e,e.port?[e.port]:void 0)}log(e,t){(0,u.log)(this.console,e,t)}};class f extends c.BackgroundThreadBase{constructor(e){super(a.workerData),this._extension=e;const t=a.workerData;this.log(u.LogLevel.Info,`Background analysis(${a.threadId}) root directory: ${t.rootDirectory}`),this._configOptions=new d.ConfigOptions(t.rootDirectory),this._host=this.createHost(),this._importResolver=this.createImportResolver(this.fs,this._configOptions,this._host);const n=this.getConsole();this._logTracker=new g.LogTracker(n,`BG(${a.threadId})`),this._program=new l.Program(this._importResolver,this._configOptions,n,this._extension,this._logTracker)}get program(){return this._program}start(){this.log(u.LogLevel.Info,`Background analysis(${a.threadId}) started`),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("message",(e=>this.onMessage(e))),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("error",(e=>m.fail(`failed ${e}`))),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("exit",(e=>{0!==e&&m.fail(`worker stopped with exit code ${e}`)}))}onMessage(e){switch(this.log(u.LogLevel.Log,`Background analysis message: ${e.requestType}`),e.requestType){case"analyze":{const t=e.port,n=(0,y.getCancellationTokenFromId)(e.data),i=this.program.getFilesToAnalyzeCount();this._onAnalysisCompletion(t,{diagnostics:[],filesInProgram:this.program.getFileCount(),filesRequiringAnalysis:i,checkingOnlyOpenFiles:this.program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:0}),this._analyzeOneChunk(t,n,e);break}case"resumeAnalysis":{const t=e.port,n=(0,y.getCancellationTokenFromId)(e.data);this._analyzeOneChunk(t,n,e);break}case"getDiagnosticsForRange":(0,c.run)((()=>{const{filePath:t,range:n,cancellationId:i}=e.data,s=(0,y.getCancellationTokenFromId)(i);return(0,p.throwIfCancellationRequested)(s),this.program.getDiagnosticsForRange(t,n)}),e.port);break;case"writeTypeStub":(0,c.run)((()=>{const{targetImportPath:t,targetIsSingleFile:n,stubPath:i,cancellationId:s}=e.data,r=(0,y.getCancellationTokenFromId)(s);(0,o.analyzeProgram)(this.program,void 0,this._configOptions,o.nullCallback,this.getConsole(),r),this.program.writeTypeStub(t,n,i,r)}),e.port);break;case"setImportResolver":this._importResolver=this.createImportResolver(this.fs,this._configOptions,this.createHost()),this.program.setImportResolver(this._importResolver);break;case"setConfigOptions":this._configOptions=(0,c.createConfigOptionsFrom)(e.data),this._importResolver=this.createImportResolver(this.fs,this._configOptions,this._host),this.program.setConfigOptions(this._configOptions),this.program.setImportResolver(this._importResolver);break;case"setTrackedFiles":{const t=this.program.setTrackedFiles(e.data);this._reportDiagnostics(t,this.program.getFilesToAnalyzeCount(),0);break}case"setAllowedThirdPartyImports":this.program.setAllowedThirdPartyImports(e.data);break;case"ensurePartialStubPackages":{const{executionRoot:t}=e.data,n=this._configOptions.getExecutionEnvironments().find((e=>e.root===t));n&&this._importResolver.ensurePartialStubPackages(n);break}case"setFileOpened":{const{filePath:t,version:n,contents:i,isTracked:s}=e.data;this.program.setFileOpened(t,n,i,s);break}case"setFileClosed":{const t=this.program.setFileClosed(e.data);this._reportDiagnostics(t,this.program.getFilesToAnalyzeCount(),0);break}case"markAllFilesDirty":this.program.markAllFilesDirty(e.data);break;case"markFilesDirty":{const{filePaths:t,evenIfContentsAreSame:n}=e.data;this.program.markFilesDirty(t,n);break}case"invalidateAndForceReanalysis":this._importResolver.invalidateCache(),this.program.markAllFilesDirty(!0);break;case"restart":this._importResolver=this.createImportResolver(this.fs,this._configOptions,this._host),this.program.setImportResolver(this._importResolver);break;default:m.fail(`${e.requestType} is not expected`)}}_analyzeOneChunk(e,t,n){(0,o.analyzeProgram)(this.program,{openFilesTimeInMs:50,noOpenFilesTimeInMs:200},this._configOptions,(t=>this._onAnalysisCompletion(e,t)),this.getConsole(),t)?this._analysisPaused(e,n.data):(this.processIndexing(e,t),this.analysisDone(e,n.data))}processIndexing(e,t){}reportIndex(e,t){e.postMessage({requestType:"indexResult",data:t})}_reportDiagnostics(e,t,n){a.parentPort&&this._onAnalysisCompletion(a.parentPort,{diagnostics:e,filesInProgram:this.program.getFileCount(),filesRequiringAnalysis:t,checkingOnlyOpenFiles:this.program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:n})}_onAnalysisCompletion(e,t){e.postMessage({requestType:"analysisResult",data:t})}_analysisPaused(e,t){e.postMessage({requestType:"analysisPaused",data:t})}analysisDone(e,t){e.postMessage({requestType:"analysisDone",data:t})}}function T(e){return e.diagnostics=e.diagnostics.map((e=>({filePath:e.filePath,version:e.version,diagnostics:_(e.diagnostics)}))),e}function _(e){return e.map((e=>{const t=new h.Diagnostic(e.category,e.message,e.range);if(e._actions)for(const n of e._actions)t.addAction(n);if(e._rule&&t.setRule(e._rule),e._relatedInfo)for(const n of e._relatedInfo)t.addRelatedInfo(n.message,n.filePath,n.range);return t}))}t.BackgroundAnalysisRunnerBase=f},5055:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getBackgroundWaiter=t.run=t.createConfigOptionsFrom=t.BackgroundThreadBase=void 0;const a=n(1267),o=n(3213),l=n(2930),c=n(2211),p=r(n(5839)),d=n(7720),u=n(1447);t.BackgroundThreadBase=class{constructor(e){(0,o.setCancellationFolderName)(e.cancellationFolderName),global.__rootDirectory=e.rootDirectory,this.fs=new u.PyrightFileSystem((0,d.createFromRealFileSystem)(this.getConsole()))}log(e,t){null===a.parentPort||void 0===a.parentPort||a.parentPort.postMessage({requestType:"log",data:{level:e,message:t}})}getConsole(){return{log:e=>{this.log(c.LogLevel.Log,e)},info:e=>{this.log(c.LogLevel.Info,e)},warn:e=>{this.log(c.LogLevel.Warn,e)},error:e=>{this.log(c.LogLevel.Error,e)},level:c.LogLevel.Log}}},t.createConfigOptionsFrom=function(e){const t=new l.ConfigOptions(e.projectRoot),n=e=>({wildcardRoot:e.wildcardRoot,regExp:new RegExp(e.regExp.source)});return t.pythonPath=e.pythonPath,t.typeshedPath=e.typeshedPath,t.stubPath=e.stubPath,t.autoExcludeVenv=e.autoExcludeVenv,t.verboseOutput=e.verboseOutput,t.checkOnlyOpenFiles=e.checkOnlyOpenFiles,t.useLibraryCodeForTypes=e.useLibraryCodeForTypes,t.internalTestMode=e.internalTestMode,t.indexGenerationMode=e.indexGenerationMode,t.venvPath=e.venvPath,t.venv=e.venv,t.defaultPythonVersion=e.defaultPythonVersion,t.defaultPythonPlatform=e.defaultPythonPlatform,t.defaultExtraPaths=e.defaultExtraPaths,t.diagnosticRuleSet=e.diagnosticRuleSet,t.executionEnvironments=e.executionEnvironments,t.autoImportCompletions=e.autoImportCompletions,t.indexing=e.indexing,t.logTypeEvaluationTime=e.logTypeEvaluationTime,t.typeEvaluationTimeThreshold=e.typeEvaluationTimeThreshold,t.include=e.include.map((e=>n(e))),t.exclude=e.exclude.map((e=>n(e))),t.ignore=e.ignore.map((e=>n(e))),t.strict=e.strict.map((e=>n(e))),t},t.run=function(e,t){try{const n=e();t.postMessage({kind:"ok",data:n})}catch(e){if(o.OperationCanceledException.is(e))return void t.postMessage({kind:"cancelled",data:e.message});t.postMessage({kind:"failed",data:`Exception: ${e.message} in ${e.stack}`})}},t.getBackgroundWaiter=function(e){return new Promise(((t,n)=>{e.on("message",(e=>{switch(e.kind){case"ok":t(e.data);break;case"cancelled":n(new o.OperationCanceledException);break;case"failed":n(e.data);break;default:p.fail(`unknown kind ${e.kind}`)}}))}))}},9926:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandController=void 0;const i=n(4494),s=n(739),r=n(7601),a=n(2719);t.CommandController=class{constructor(e){this._createStub=new s.CreateTypeStubCommand(e),this._restartServer=new a.RestartServerCommand(e),this._quickAction=new r.QuickActionCommand(e)}async execute(e,t){switch(e.command){case"pyright.organizeimports":case"pyright.addoptionalforparam":return this._quickAction.execute(e,t);case"pyright.createtypestub":return this._createStub.execute(e,t);case"pyright.restartserver":return this._restartServer.execute(e);default:return new i.ResponseError(1,"Unsupported command")}}isLongRunningCommand(e){return"pyright.createtypestub"===e}}},2921:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandResult=void 0;const i=n(5269);(t.CommandResult||(t.CommandResult={})).is=function(e){return e&&e.edits&&i.WorkspaceEdit.is(e.edits)}},739:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CreateTypeStubCommand=void 0;const i=n(3213),s=n(31);t.CreateTypeStubCommand=class{constructor(e){this._ls=e}async execute(e,t){if(e.arguments&&e.arguments.length>=2){const n=e.arguments[0],r=e.arguments[1],a=e.arguments[2],o=await s.AnalyzerServiceExecutor.cloneService(this._ls,await this._ls.getWorkspaceForFile(null!=a?a:n),r,this._ls.createBackgroundAnalysis());try{await o.writeTypeStubInBackground(t),o.dispose();const e=`Type stub was successfully created for '${r}'.`;this._ls.window.showInformationMessage(e),this._ls.reanalyze()}catch(e){if(i.OperationCanceledException.is(e)){const e=`Type stub creation for '${r}' was canceled`;this._ls.console.error(e)}else{let t="";e instanceof Error&&(t=": "+e.message),t=`An error occurred when creating type stub for '${r}'`+t,this._ls.console.error(t),this._ls.window.showErrorMessage(t)}}}}}},7601:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QuickActionCommand=void 0;const i=n(743);t.QuickActionCommand=class{constructor(e){this._ls=e}async execute(e,t){if(e.arguments&&e.arguments.length>=1){const n=e.arguments[0],s=e.arguments.slice(1),r=this._ls.decodeTextDocumentUri(n),a=await this._ls.getWorkspaceForFile(r);if("pyright.organizeimports"===e.command&&a.disableOrganizeImports)return[];const o=a.serviceInstance.performQuickAction(r,e.command,s,t);return(0,i.convertTextEdits)(n,o)}}}},2719:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RestartServerCommand=void 0,t.RestartServerCommand=class{constructor(e){this._ls=e}async execute(e){this._ls.restart()}}},3213:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCancellationProvider=t.CancelAfter=t.throwIfCancellationRequested=t.OperationCanceledException=t.setCancellationFolderName=t.getCancellationFolderName=void 0;const i=n(6744),s=n(4494),r=n(2489);let a;t.getCancellationFolderName=function(){return a},t.setCancellationFolderName=function(e){a=e};class o extends s.ResponseError{constructor(){super(s.LSPErrorCodes.RequestCancelled,"request cancelled")}static is(e){return e.code===s.LSPErrorCodes.RequestCancelled}}t.OperationCanceledException=o,t.throwIfCancellationRequested=function(e){if(!(0,r.isDebugMode)()&&e.isCancellationRequested)throw new o},t.CancelAfter=function(...e){const t=new i.CancellationTokenSource,n=[];for(const i of e)n.push(i.onCancellationRequested((e=>{t.cancel()})));return n.push(t.token.onCancellationRequested((e=>{n.forEach((e=>e.dispose()))}))),t},t.DefaultCancellationProvider=class{createCancellationTokenSource(){return new i.CancellationTokenSource}}},7646:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ChokidarFileWatcherProvider=void 0;const a=r(n(778)),o="darwin"===process.platform,l="linux"===process.platform;t.ChokidarFileWatcherProvider=class{constructor(e){this._console=e}createFileWatcher(e,t){return this._createFileSystemWatcher(e).on("all",t)}_createFileSystemWatcher(e){var t;const n={ignoreInitial:!0,ignorePermissionErrors:!0,followSymlinks:!0,interval:1e3,binaryInterval:1e3,disableGlobbing:!0,awaitWriteFinish:{stabilityThreshold:1e3,pollInterval:1e3}};o&&(n.usePolling=!1);const i=["**/__pycache__/**"];(o||l)&&e.some((e=>""===e||"/"===e))&&(i.push("/dev/**"),l&&i.push("/proc/**","/sys/**")),n.ignored=i;const s=a.watch(e,n);return s.on("error",(e=>{var t;null===(t=this._console)||void 0===t||t.error("Error returned from file system watcher.")})),o&&!s.options.useFsEvents&&(null===(t=this._console)||void 0===t||t.info("Watcher could not use native fsevents library. File system watcher disabled.")),s}onFileChange(e,t){}}},9489:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMapValues=t.addIfUnique=t.createMapFromItems=t.removeArrayElements=t.getOrAdd=t.getNestedProperty=t.flatten=t.binarySearchKey=t.binarySearch=t.every=t.some=t.map=t.stableSort=t.cloneAndSort=t.insertAt=t.addRange=t.find=t.append=t.contains=t.emptyArray=void 0;const i=n(2489);function s(e,t,n=i.equateValues){if(e)for(const i of e)if(n(i,t))return!0;return!1}function r(e,t){return t<0?e.length+t:t}function a(e,t,n,i){if(void 0===t||0===t.length)return e;if(void 0===e)return t.slice(n,i);n=void 0===n?0:r(t,n),i=void 0===i?t.length:r(t,i);for(let s=n;s<i&&s<t.length;s++)void 0!==t[s]&&e.push(t[s]);return e}function o(e,t){return t}function l(e,t){return!!e&&(t?e.some(t):e.length>0)}function c(e,t,n,i,s){if(!l(e))return-1;let r=s||0,a=e.length-1;for(;r<=a;){const s=r+(a-r>>1);switch(i(n(e[s]),t)){case-1:r=s+1;break;case 0:return s;case 1:a=s-1}}return~r}t.emptyArray=[],t.contains=s,t.append=function(e,t){return void 0===t?e:void 0===e?[t]:(e.push(t),e)},t.find=function(e,t){for(let n=0;n<e.length;n++){const i=e[n];if(t(i,n))return i}},t.addRange=a,t.insertAt=function(e,t,n){if(0===t)e.unshift(n);else if(t===e.length)e.push(n);else{for(let n=e.length;n>t;n--)e[n]=e[n-1];e[t]=n}return e},t.cloneAndSort=function(e,t){return 0===e.length?e:e.slice().sort(t)},t.stableSort=function(e,t){const n=function(e){return e.map(o)}(e);return function(e,t,n){t.sort(((t,s)=>n(e[t],e[s])||(0,i.compareValues)(t,s)))}(e,n,t),n.map((t=>e[t]))},t.map=function(e,t){if(e)return e.map(t)},t.some=l,t.every=function(e,t){return!e||e.every(t)},t.binarySearch=function(e,t,n,i,s){return c(e,n(t),n,i,s)},t.binarySearchKey=c,t.flatten=function(e){const t=[];for(const n of e)n&&((0,i.isArray)(n)?a(t,n):t.push(n));return t},t.getNestedProperty=function(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)},t.getOrAdd=function(e,t,n){const i=e.get(t);if(void 0!==i)return i;const s=n();return e.set(t,s),s},t.removeArrayElements=function(e,t){for(let n=0;n<e.length;n++)t(e[n])&&(e.splice(n,1),n--);return e},t.createMapFromItems=function(e,t){return e.map((e=>t(e))).reduce(((t,n,i)=>(t.set(n,(t.get(n)||[]).concat(e[i])),t)),new Map)},t.addIfUnique=function(e,t,n=i.equateValues){return s(e,t,n)||e.push(t),e},t.getMapValues=function(e,t){const n=[];return e.forEach(((e,i)=>{t(i,e)&&n.push(e)})),n}},1775:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandLineOptions=t.getDiagnosticSeverityOverrides=void 0,t.getDiagnosticSeverityOverrides=function(){return["error","warning","information","none"]},t.CommandLineOptions=class{constructor(e,t){this.fileSpecs=[],this.logTypeEvaluationTime=!1,this.typeEvaluationTimeThreshold=50,this.enableAmbientAnalysis=!0,this.analyzeUnannotatedFunctions=!0,this.executionRoot=e,this.fromVsCodeExtension=t}}},2930:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigOptions=t.getStrictDiagnosticRuleSet=t.getBasicDiagnosticRuleSet=t.getOffDiagnosticRuleSet=t.getStrictModeNotOverriddenRules=t.getDiagLevelDiagnosticRules=t.getBooleanDiagnosticRules=t.cloneDiagnosticRuleSet=t.ExecutionEnvironment=t.PythonPlatform=void 0;const a=n(1017),o=n(1887),l=r(n(3188)),c=n(9744),p=n(6657),d=n(6886);var u;(u=t.PythonPlatform||(t.PythonPlatform={})).Darwin="Darwin",u.Windows="Windows",u.Linux="Linux";class m{constructor(e,t,n,i){this.extraPaths=[],this.root=e||void 0,this.pythonVersion=t||d.latestStablePythonVersion,this.pythonPlatform=n,this.extraPaths=i||[]}}t.ExecutionEnvironment=m,t.cloneDiagnosticRuleSet=function(e){return Object.assign({},e)},t.getBooleanDiagnosticRules=function(){return[c.DiagnosticRule.strictListInference,c.DiagnosticRule.strictSetInference,c.DiagnosticRule.strictDictionaryInference,c.DiagnosticRule.strictParameterNoneValue]},t.getDiagLevelDiagnosticRules=function(){return[c.DiagnosticRule.reportGeneralTypeIssues,c.DiagnosticRule.reportPropertyTypeMismatch,c.DiagnosticRule.reportFunctionMemberAccess,c.DiagnosticRule.reportMissingImports,c.DiagnosticRule.reportMissingModuleSource,c.DiagnosticRule.reportMissingTypeStubs,c.DiagnosticRule.reportImportCycles,c.DiagnosticRule.reportUnusedImport,c.DiagnosticRule.reportUnusedClass,c.DiagnosticRule.reportUnusedFunction,c.DiagnosticRule.reportUnusedVariable,c.DiagnosticRule.reportDuplicateImport,c.DiagnosticRule.reportWildcardImportFromLibrary,c.DiagnosticRule.reportOptionalSubscript,c.DiagnosticRule.reportOptionalMemberAccess,c.DiagnosticRule.reportOptionalCall,c.DiagnosticRule.reportOptionalIterable,c.DiagnosticRule.reportOptionalContextManager,c.DiagnosticRule.reportOptionalOperand,c.DiagnosticRule.reportTypedDictNotRequiredAccess,c.DiagnosticRule.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedNamedTuple,c.DiagnosticRule.reportPrivateUsage,c.DiagnosticRule.reportPrivateImportUsage,c.DiagnosticRule.reportConstantRedefinition,c.DiagnosticRule.reportIncompatibleMethodOverride,c.DiagnosticRule.reportIncompatibleVariableOverride,c.DiagnosticRule.reportOverlappingOverload,c.DiagnosticRule.reportUninitializedInstanceVariable,c.DiagnosticRule.reportInvalidStringEscapeSequence,c.DiagnosticRule.reportUnknownParameterType,c.DiagnosticRule.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownLambdaType,c.DiagnosticRule.reportUnknownVariableType,c.DiagnosticRule.reportUnknownMemberType,c.DiagnosticRule.reportMissingParameterType,c.DiagnosticRule.reportMissingTypeArgument,c.DiagnosticRule.reportInvalidTypeVarUse,c.DiagnosticRule.reportCallInDefaultInitializer,c.DiagnosticRule.reportUnnecessaryIsInstance,c.DiagnosticRule.reportUnnecessaryCast,c.DiagnosticRule.reportUnnecessaryComparison,c.DiagnosticRule.reportAssertAlwaysTrue,c.DiagnosticRule.reportSelfClsParameterName,c.DiagnosticRule.reportImplicitStringConcatenation,c.DiagnosticRule.reportUndefinedVariable,c.DiagnosticRule.reportUnboundVariable,c.DiagnosticRule.reportInvalidStubStatement,c.DiagnosticRule.reportIncompleteStub,c.DiagnosticRule.reportUnsupportedDunderAll,c.DiagnosticRule.reportUnusedCallResult,c.DiagnosticRule.reportUnusedCoroutine]},t.getStrictModeNotOverriddenRules=function(){return[c.DiagnosticRule.reportMissingModuleSource]},t.getOffDiagnosticRuleSet=function(){return{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,omitConditionalConstraint:!0,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"none",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"warning",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"none",reportOptionalSubscript:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportTypedDictNotRequiredAccess:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"none",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none",reportUnusedCoroutine:"none"}},t.getBasicDiagnosticRuleSet=function(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"warning",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"error",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}},t.getStrictDiagnosticRuleSet=function(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!0,strictSetInference:!0,strictDictionaryInference:!0,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"error",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"error",reportImportCycles:"error",reportUnusedImport:"error",reportUnusedClass:"error",reportUnusedFunction:"error",reportUnusedVariable:"error",reportDuplicateImport:"error",reportWildcardImportFromLibrary:"error",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportPrivateImportUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportOverlappingOverload:"error",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingParameterType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportUnnecessaryComparison:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportIncompleteStub:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}};class h{constructor(e,t){this.include=[],this.exclude=[],this.ignore=[],this.strict=[],this.autoImportCompletions=!0,this.indexing=!1,this.logTypeEvaluationTime=!1,this.typeEvaluationTimeThreshold=50,this.disableInferenceForPyTypedSources=!0,this.initializedFromJson=!1,this.analyzeUnannotatedFunctions=!0,this.executionEnvironments=[],this.projectRoot=e,this.typeCheckingMode=t,this.diagnosticRuleSet=h.getDiagnosticRuleSet(t),"off"===t&&(this.disableInferenceForPyTypedSources=!1)}static getDiagnosticRuleSet(e){return"strict"===e?{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!0,strictSetInference:!0,strictDictionaryInference:!0,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"error",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"error",reportImportCycles:"error",reportUnusedImport:"error",reportUnusedClass:"error",reportUnusedFunction:"error",reportUnusedVariable:"error",reportDuplicateImport:"error",reportWildcardImportFromLibrary:"error",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportPrivateImportUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportOverlappingOverload:"error",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingParameterType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportUnnecessaryComparison:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportIncompleteStub:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}:"off"===e?{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,omitConditionalConstraint:!0,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"none",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"warning",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"none",reportOptionalSubscript:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportTypedDictNotRequiredAccess:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"none",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none",reportUnusedCoroutine:"none"}:{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!1,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"warning",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"error",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportOverlappingOverload:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none",reportUnusedCoroutine:"error"}}getDefaultExecEnvironment(){return new m(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform,this.defaultExtraPaths)}findExecEnvironment(e){var t;return null!==(t=this.executionEnvironments.find((t=>{const n=(0,p.ensureTrailingDirectorySeparator)((0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,t.root)));return e.startsWith(n)})))&&void 0!==t?t:this.getDefaultExecEnvironment()}getExecutionEnvironments(){return this.executionEnvironments.length>0?this.executionEnvironments:[this.getDefaultExecEnvironment()]}initializeFromJson(e,t,n,i,s,r=!1){let o;this.initializedFromJson=!0,r||(this.include=[],void 0===e.include)||(Array.isArray(e.include)?e.include.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "include" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "include" array because it is not relative.`):this.include.push((0,p.getFileSpec)(this.projectRoot,e))})):n.error('Config "include" entry must must contain an array.')),this.exclude=[],void 0!==e.exclude&&(Array.isArray(e.exclude)?e.exclude.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "exclude" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "exclude" array because it is not relative.`):this.exclude.push((0,p.getFileSpec)(this.projectRoot,e))})):n.error('Config "exclude" entry must contain an array.')),this.ignore=[],void 0!==e.ignore&&(Array.isArray(e.ignore)?e.ignore.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "ignore" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "ignore" array because it is not relative.`):this.ignore.push((0,p.getFileSpec)(this.projectRoot,e))})):n.error('Config "ignore" entry must contain an array.')),this.strict=[],void 0!==e.strict&&(Array.isArray(e.strict)?e.strict.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "strict" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "strict" array because it is not relative.`):this.strict.push((0,p.getFileSpec)(this.projectRoot,e))})):n.error('Config "strict" entry must contain an array.')),void 0!==e.typeCheckingMode&&("off"===e.typeCheckingMode||"basic"===e.typeCheckingMode||"strict"===e.typeCheckingMode?o=e.typeCheckingMode:n.error('Config "typeCheckingMode" entry must contain "off", "basic", or "strict".')),void 0!==e.useLibraryCodeForTypes&&("boolean"==typeof e.useLibraryCodeForTypes?this.useLibraryCodeForTypes=e.useLibraryCodeForTypes:n.error('Config "useLibraryCodeForTypes" entry must be true or false.')),this.typeCheckingMode=o||t;const l=h.getDiagnosticRuleSet(this.typeCheckingMode);if("off"===this.typeCheckingMode&&(this.disableInferenceForPyTypedSources=!1),this.applyDiagnosticOverrides(s),this.diagnosticRuleSet={printUnknownAsAny:l.printUnknownAsAny,omitTypeArgsIfAny:l.omitTypeArgsIfAny,omitConditionalConstraint:l.omitConditionalConstraint,omitUnannotatedParamType:l.omitUnannotatedParamType,pep604Printing:l.pep604Printing,strictListInference:this._convertBoolean(e.strictListInference,c.DiagnosticRule.strictListInference,l.strictListInference),strictSetInference:this._convertBoolean(e.strictSetInference,c.DiagnosticRule.strictSetInference,l.strictSetInference),strictDictionaryInference:this._convertBoolean(e.strictDictionaryInference,c.DiagnosticRule.strictDictionaryInference,l.strictDictionaryInference),strictParameterNoneValue:this._convertBoolean(e.strictParameterNoneValue,c.DiagnosticRule.strictParameterNoneValue,l.strictParameterNoneValue),enableTypeIgnoreComments:this._convertBoolean(e.enableTypeIgnoreComments,c.DiagnosticRule.enableTypeIgnoreComments,l.enableTypeIgnoreComments),reportGeneralTypeIssues:this._convertDiagnosticLevel(e.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,l.reportGeneralTypeIssues),reportPropertyTypeMismatch:this._convertDiagnosticLevel(e.reportPropertyTypeMismatch,c.DiagnosticRule.reportPropertyTypeMismatch,l.reportPropertyTypeMismatch),reportFunctionMemberAccess:this._convertDiagnosticLevel(e.reportFunctionMemberAccess,c.DiagnosticRule.reportFunctionMemberAccess,l.reportFunctionMemberAccess),reportMissingImports:this._convertDiagnosticLevel(e.reportMissingImports,c.DiagnosticRule.reportMissingImports,l.reportMissingImports),reportUnusedImport:this._convertDiagnosticLevel(e.reportUnusedImport,c.DiagnosticRule.reportUnusedImport,l.reportUnusedImport),reportUnusedClass:this._convertDiagnosticLevel(e.reportUnusedClass,c.DiagnosticRule.reportUnusedClass,l.reportUnusedClass),reportUnusedFunction:this._convertDiagnosticLevel(e.reportUnusedFunction,c.DiagnosticRule.reportUnusedFunction,l.reportUnusedFunction),reportUnusedVariable:this._convertDiagnosticLevel(e.reportUnusedVariable,c.DiagnosticRule.reportUnusedVariable,l.reportUnusedVariable),reportDuplicateImport:this._convertDiagnosticLevel(e.reportDuplicateImport,c.DiagnosticRule.reportDuplicateImport,l.reportDuplicateImport),reportWildcardImportFromLibrary:this._convertDiagnosticLevel(e.reportWildcardImportFromLibrary,c.DiagnosticRule.reportWildcardImportFromLibrary,l.reportWildcardImportFromLibrary),reportMissingModuleSource:this._convertDiagnosticLevel(e.reportMissingModuleSource,c.DiagnosticRule.reportMissingModuleSource,l.reportMissingModuleSource),reportMissingTypeStubs:this._convertDiagnosticLevel(e.reportMissingTypeStubs,c.DiagnosticRule.reportMissingTypeStubs,l.reportMissingTypeStubs),reportImportCycles:this._convertDiagnosticLevel(e.reportImportCycles,c.DiagnosticRule.reportImportCycles,l.reportImportCycles),reportOptionalSubscript:this._convertDiagnosticLevel(e.reportOptionalSubscript,c.DiagnosticRule.reportOptionalSubscript,l.reportOptionalSubscript),reportOptionalMemberAccess:this._convertDiagnosticLevel(e.reportOptionalMemberAccess,c.DiagnosticRule.reportOptionalMemberAccess,l.reportOptionalMemberAccess),reportOptionalCall:this._convertDiagnosticLevel(e.reportOptionalCall,c.DiagnosticRule.reportOptionalCall,l.reportOptionalCall),reportOptionalIterable:this._convertDiagnosticLevel(e.reportOptionalIterable,c.DiagnosticRule.reportOptionalIterable,l.reportOptionalIterable),reportOptionalContextManager:this._convertDiagnosticLevel(e.reportOptionalContextManager,c.DiagnosticRule.reportOptionalContextManager,l.reportOptionalContextManager),reportOptionalOperand:this._convertDiagnosticLevel(e.reportOptionalOperand,c.DiagnosticRule.reportOptionalOperand,l.reportOptionalOperand),reportTypedDictNotRequiredAccess:this._convertDiagnosticLevel(e.reportTypedDictNotRequiredAccess,c.DiagnosticRule.reportTypedDictNotRequiredAccess,l.reportTypedDictNotRequiredAccess),reportUntypedFunctionDecorator:this._convertDiagnosticLevel(e.reportUntypedFunctionDecorator,c.DiagnosticRule.reportUntypedFunctionDecorator,l.reportUntypedFunctionDecorator),reportUntypedClassDecorator:this._convertDiagnosticLevel(e.reportUntypedClassDecorator,c.DiagnosticRule.reportUntypedClassDecorator,l.reportUntypedClassDecorator),reportUntypedBaseClass:this._convertDiagnosticLevel(e.reportUntypedBaseClass,c.DiagnosticRule.reportUntypedBaseClass,l.reportUntypedBaseClass),reportUntypedNamedTuple:this._convertDiagnosticLevel(e.reportUntypedNamedTuple,c.DiagnosticRule.reportUntypedNamedTuple,l.reportUntypedNamedTuple),reportPrivateUsage:this._convertDiagnosticLevel(e.reportPrivateUsage,c.DiagnosticRule.reportPrivateUsage,l.reportPrivateUsage),reportPrivateImportUsage:this._convertDiagnosticLevel(e.reportPrivateImportUsage,c.DiagnosticRule.reportPrivateImportUsage,l.reportPrivateImportUsage),reportConstantRedefinition:this._convertDiagnosticLevel(e.reportConstantRedefinition,c.DiagnosticRule.reportConstantRedefinition,l.reportConstantRedefinition),reportIncompatibleMethodOverride:this._convertDiagnosticLevel(e.reportIncompatibleMethodOverride,c.DiagnosticRule.reportIncompatibleMethodOverride,l.reportIncompatibleMethodOverride),reportIncompatibleVariableOverride:this._convertDiagnosticLevel(e.reportIncompatibleVariableOverride,c.DiagnosticRule.reportIncompatibleVariableOverride,l.reportIncompatibleVariableOverride),reportOverlappingOverload:this._convertDiagnosticLevel(e.reportOverlappingOverload,c.DiagnosticRule.reportOverlappingOverload,l.reportOverlappingOverload),reportUninitializedInstanceVariable:this._convertDiagnosticLevel(e.reportUninitializedInstanceVariable,c.DiagnosticRule.reportUninitializedInstanceVariable,l.reportUninitializedInstanceVariable),reportInvalidStringEscapeSequence:this._convertDiagnosticLevel(e.reportInvalidStringEscapeSequence,c.DiagnosticRule.reportInvalidStringEscapeSequence,l.reportInvalidStringEscapeSequence),reportUnknownParameterType:this._convertDiagnosticLevel(e.reportUnknownParameterType,c.DiagnosticRule.reportUnknownParameterType,l.reportUnknownParameterType),reportUnknownArgumentType:this._convertDiagnosticLevel(e.reportUnknownArgumentType,c.DiagnosticRule.reportUnknownArgumentType,l.reportUnknownArgumentType),reportUnknownLambdaType:this._convertDiagnosticLevel(e.reportUnknownLambdaType,c.DiagnosticRule.reportUnknownLambdaType,l.reportUnknownLambdaType),reportUnknownVariableType:this._convertDiagnosticLevel(e.reportUnknownVariableType,c.DiagnosticRule.reportUnknownVariableType,l.reportUnknownVariableType),reportUnknownMemberType:this._convertDiagnosticLevel(e.reportUnknownMemberType,c.DiagnosticRule.reportUnknownMemberType,l.reportUnknownMemberType),reportMissingParameterType:this._convertDiagnosticLevel(e.reportMissingParameterType,c.DiagnosticRule.reportMissingParameterType,l.reportMissingParameterType),reportMissingTypeArgument:this._convertDiagnosticLevel(e.reportMissingTypeArgument,c.DiagnosticRule.reportMissingTypeArgument,l.reportMissingTypeArgument),reportInvalidTypeVarUse:this._convertDiagnosticLevel(e.reportInvalidTypeVarUse,c.DiagnosticRule.reportInvalidTypeVarUse,l.reportInvalidTypeVarUse),reportCallInDefaultInitializer:this._convertDiagnosticLevel(e.reportCallInDefaultInitializer,c.DiagnosticRule.reportCallInDefaultInitializer,l.reportCallInDefaultInitializer),reportUnnecessaryIsInstance:this._convertDiagnosticLevel(e.reportUnnecessaryIsInstance,c.DiagnosticRule.reportUnnecessaryIsInstance,l.reportUnnecessaryIsInstance),reportUnnecessaryCast:this._convertDiagnosticLevel(e.reportUnnecessaryCast,c.DiagnosticRule.reportUnnecessaryCast,l.reportUnnecessaryCast),reportUnnecessaryComparison:this._convertDiagnosticLevel(e.reportUnnecessaryComparison,c.DiagnosticRule.reportUnnecessaryComparison,l.reportUnnecessaryComparison),reportAssertAlwaysTrue:this._convertDiagnosticLevel(e.reportAssertAlwaysTrue,c.DiagnosticRule.reportAssertAlwaysTrue,l.reportAssertAlwaysTrue),reportSelfClsParameterName:this._convertDiagnosticLevel(e.reportSelfClsParameterName,c.DiagnosticRule.reportSelfClsParameterName,l.reportSelfClsParameterName),reportImplicitStringConcatenation:this._convertDiagnosticLevel(e.reportImplicitStringConcatenation,c.DiagnosticRule.reportImplicitStringConcatenation,l.reportImplicitStringConcatenation),reportUndefinedVariable:this._convertDiagnosticLevel(e.reportUndefinedVariable,c.DiagnosticRule.reportUndefinedVariable,l.reportUndefinedVariable),reportUnboundVariable:this._convertDiagnosticLevel(e.reportUnboundVariable,c.DiagnosticRule.reportUnboundVariable,l.reportUnboundVariable),reportInvalidStubStatement:this._convertDiagnosticLevel(e.reportInvalidStubStatement,c.DiagnosticRule.reportInvalidStubStatement,l.reportInvalidStubStatement),reportIncompleteStub:this._convertDiagnosticLevel(e.reportIncompleteStub,c.DiagnosticRule.reportIncompleteStub,l.reportIncompleteStub),reportUnsupportedDunderAll:this._convertDiagnosticLevel(e.reportUnsupportedDunderAll,c.DiagnosticRule.reportUnsupportedDunderAll,l.reportUnsupportedDunderAll),reportUnusedCallResult:this._convertDiagnosticLevel(e.reportUnusedCallResult,c.DiagnosticRule.reportUnusedCallResult,l.reportUnusedCallResult),reportUnusedCoroutine:this._convertDiagnosticLevel(e.reportUnusedCoroutine,c.DiagnosticRule.reportUnusedCoroutine,l.reportUnusedCoroutine)},this.venvPath=void 0,void 0!==e.venvPath&&("string"!=typeof e.venvPath?n.error('Config "venvPath" field must contain a string.'):this.venvPath=(0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,e.venvPath))),this.venv=void 0,void 0!==e.venv&&("string"!=typeof e.venv?n.error('Config "venv" field must contain a string.'):this.venv=e.venv),void 0!==e.extraPaths&&(this.defaultExtraPaths=[],Array.isArray(e.extraPaths)?e.extraPaths.forEach(((e,t)=>{"string"!=typeof e?n.error(`Config "extraPaths" field ${t} must be a string.`):this.defaultExtraPaths.push((0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,e)))})):n.error('Config "extraPaths" field must contain an array.')),void 0!==e.pythonVersion)if("string"==typeof e.pythonVersion){const t=(0,d.versionFromString)(e.pythonVersion);t?this.defaultPythonVersion=t:n.error('Config "pythonVersion" field contains unsupported version.')}else n.error('Config "pythonVersion" field must contain a string.');this.ensureDefaultPythonVersion(i,n),void 0!==e.pythonPlatform&&("string"!=typeof e.pythonPlatform?n.error('Config "pythonPlatform" field must contain a string.'):this.defaultPythonPlatform=e.pythonPlatform),this.ensureDefaultPythonPlatform(i,n),this.typeshedPath=void 0,void 0!==e.typeshedPath&&("string"!=typeof e.typeshedPath?n.error('Config "typeshedPath" field must contain a string.'):this.typeshedPath=e.typeshedPath?(0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,e.typeshedPath)):""),this.stubPath=void 0,void 0!==e.typingsPath&&("string"!=typeof e.typingsPath?n.error('Config "typingsPath" field must contain a string.'):(n.error('Config "typingsPath" is now deprecated. Please, use stubPath instead.'),this.stubPath=(0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,e.typingsPath)))),void 0!==e.stubPath&&("string"!=typeof e.stubPath?n.error('Config "stubPath" field must contain a string.'):this.stubPath=(0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,e.stubPath))),void 0!==e.verboseOutput&&("boolean"!=typeof e.verboseOutput?n.error('Config "verboseOutput" field must be true or false.'):this.verboseOutput=e.verboseOutput),void 0!==e.useLibraryCodeForTypes&&("boolean"!=typeof e.useLibraryCodeForTypes?n.error('Config "useLibraryCodeForTypes" field must be true or false.'):this.useLibraryCodeForTypes=e.useLibraryCodeForTypes),this.executionEnvironments=[],void 0!==e.executionEnvironments&&(Array.isArray(e.executionEnvironments)?e.executionEnvironments.forEach(((e,t)=>{const i=this._initExecutionEnvironmentFromJson(e,t,n);i&&this.executionEnvironments.push(i)})):n.error('Config "executionEnvironments" field must contain an array.')),void 0!==e.autoImportCompletions&&("boolean"!=typeof e.autoImportCompletions?n.error('Config "autoImportCompletions" field must be true or false.'):this.autoImportCompletions=e.autoImportCompletions),void 0!==e.indexing&&("boolean"!=typeof e.indexing?n.error('Config "indexing" field must be true or false.'):this.indexing=e.indexing),void 0!==e.logTypeEvaluationTime&&("boolean"!=typeof e.logTypeEvaluationTime?n.error('Config "logTypeEvaluationTime" field must be true or false.'):this.logTypeEvaluationTime=e.logTypeEvaluationTime),void 0!==e.typeEvaluationTimeThreshold&&("number"!=typeof e.typeEvaluationTimeThreshold?n.error('Config "typeEvaluationTimeThreshold" field must be a number.'):this.typeEvaluationTimeThreshold=e.typeEvaluationTimeThreshold)}ensureDefaultPythonPlatform(e,t){void 0===this.defaultPythonPlatform&&(this.defaultPythonPlatform=e.getPythonPlatform(),void 0!==this.defaultPythonPlatform&&t.info(`Assuming Python platform ${this.defaultPythonPlatform}`))}ensureDefaultPythonVersion(e,t){if(void 0!==this.defaultPythonVersion)return;const n=[];this.defaultPythonVersion=e.getPythonVersion(this.pythonPath,n),void 0!==this.defaultPythonVersion&&t.info(`Assuming Python version ${(0,d.versionToString)(this.defaultPythonVersion)}`);for(const e of n)t.info(e)}ensureDefaultExtraPaths(e,t,n){const i=[];if(t){const t=(0,p.resolvePaths)(this.projectRoot,l.src);e.existsSync(t)&&!e.existsSync((0,p.resolvePaths)(t,"__init__.py"))&&i.push(t)}if(n&&n.length>0)for(const t of n){const n=(0,p.resolvePaths)(this.projectRoot,t);i.push(n),(0,p.isDirectory)(e,n)&&i.push(...(0,o.getPathsFromPthFiles)(e,n))}i.length>0&&(this.defaultExtraPaths=i)}applyDiagnosticOverrides(e){if(e)for(const[t,n]of Object.entries(e))this.diagnosticRuleSet[t]=n}_convertBoolean(e,t,n){return void 0===e?n:"boolean"==typeof e?!!e:(console.log(`Config "${t}" entry must be true or false.`),n)}_convertDiagnosticLevel(e,t,n){return void 0===e?n:"boolean"==typeof e?e?"error":"none":"string"!=typeof e||"error"!==e&&"warning"!==e&&"information"!==e&&"none"!==e?(console.log(`Config "${t}" entry must be true, false, "error", "warning", "information" or "none".`),n):e}_initExecutionEnvironmentFromJson(e,t,n){try{const i=new m(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform,this.defaultExtraPaths);if(e.root&&"string"==typeof e.root?i.root=(0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,e.root)):n.error(`Config executionEnvironments index ${t}: missing root value.`),e.extraPaths&&(Array.isArray(e.extraPaths)?e.extraPaths.forEach(((e,s)=>{"string"!=typeof e?n.error(`Config executionEnvironments index ${t}: extraPaths field ${s} must be a string.`):i.extraPaths.push((0,p.normalizePath)((0,p.combinePaths)(this.projectRoot,e)))})):n.error(`Config executionEnvironments index ${t}: extraPaths field must contain an array.`)),e.pythonVersion)if("string"==typeof e.pythonVersion){const s=(0,d.versionFromString)(e.pythonVersion);s?i.pythonVersion=s:n.warn(`Config executionEnvironments index ${t} contains unsupported pythonVersion.`)}else n.error(`Config executionEnvironments index ${t} pythonVersion must be a string.`);return e.pythonPlatform&&("string"==typeof e.pythonPlatform?i.pythonPlatform=e.pythonPlatform:n.error(`Config executionEnvironments index ${t} pythonPlatform must be a string.`)),i}catch{n.error(`Config executionEnvironments index ${t} is not accessible.`)}}}t.ConfigOptions=h},2211:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.ConsoleWithLogLevel=t.StderrConsoleWithLevel=t.StderrConsole=t.StandardConsoleWithLevel=t.StandardConsole=t.NullConsole=t.LogLevel=void 0;const a=r(n(5839));var o;!function(e){e.Error="error",e.Warn="warn",e.Info="info",e.Log="log"}(o=t.LogLevel||(t.LogLevel={})),t.NullConsole=class{constructor(){this.logCount=0,this.infoCount=0,this.warnCount=0,this.errorCount=0}log(e){this.logCount++}info(e){this.infoCount++}warn(e){this.warnCount++}error(e){this.errorCount++}};class l{log(e){console.info(e)}info(e){console.info(e)}warn(e){console.warn(e)}error(e){console.error(e)}}t.StandardConsole=l,t.StandardConsoleWithLevel=class extends l{constructor(e=o.Log){super(),this._maxLevel=e}get level(){return this._maxLevel}};class c{log(e){console.error(e)}info(e){console.error(e)}warn(e){console.error(e)}error(e){console.error(e)}}function p(e,t,n){switch(t){case o.Log:e.log(n);break;case o.Info:e.info(n);break;case o.Warn:e.warn(n);break;case o.Error:e.error(n);break;default:a.fail(`${t} is not expected`)}}t.StderrConsole=c,t.StderrConsoleWithLevel=class extends c{constructor(e=o.Log){super(),this._maxLevel=e}get level(){return this._maxLevel}},t.ConsoleWithLogLevel=class{constructor(e){this._console=e,this._levelMap=new Map([[o.Error,0],[o.Warn,1],[o.Info,2],[o.Log,3]]),this._maxLevel=2}get level(){switch(this._maxLevel){case 0:return o.Error;case 1:return o.Warn;case 2:return o.Info}return o.Log}set level(e){let t=this._levelMap.get(e);void 0===t&&(t=this._levelMap.get(o.Info)),this._maxLevel=t}error(e){this._log(o.Error,e)}warn(e){this._log(o.Warn,e)}info(e){this._log(o.Info,e)}log(e){this._log(o.Log,e)}_log(e,t){this._getNumericalLevel(e)>this._maxLevel||p(this._console,e,t)}_getNumericalLevel(e){const t=this._levelMap.get(e);return a.assert(void 0!==t,"Logger: unknown log level."),void 0!==t?t:2}},t.log=p},2489:(e,t)=>{function n(e,t){return e===t?0:void 0===e?-1:void 0===t?1:e<t?-1:1}Object.defineProperty(t,"__esModule",{value:!0}),t.isDefined=t.isThenable=t.isDebugMode=t.toBoolean=t.hasProperty=t.isBoolean=t.isNumber=t.isString=t.isArray=t.compareValues=t.compareComparableValues=t.equateValues=t.toLowerCase=t.identity=t.returnUndefined=t.returnTrue=t.returnFalse=void 0,t.returnFalse=function(){return!1},t.returnTrue=function(){return!0},t.returnUndefined=function(){},t.identity=function(e){return e},t.toLowerCase=function(e){return e.toLowerCase()},t.equateValues=function(e,t){return e===t},t.compareComparableValues=n,t.compareValues=function(e,t){return n(e,t)},t.isArray=function(e){return Array.isArray?Array.isArray(e):e instanceof Array},t.isString=function(e){return"string"==typeof e},t.isNumber=function(e){return"number"==typeof e},t.isBoolean=function(e){return"boolean"==typeof e};const i=Object.prototype.hasOwnProperty;t.hasProperty=function(e,t){return i.call(e,t)},t.toBoolean=function(e){return"TRUE"===(null==e?void 0:e.trim().toUpperCase())},t.isDebugMode=function(){const e=process.execArgv.join();return e.includes("inspect")||e.includes("debug")},t.isThenable=function(e){return"function"==typeof(null==e?void 0:e.then)},t.isDefined=function(e){return void 0!==e}},8916:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytesHex=void 0;const i=n(5839);let s;try{s=n(6113),(null==s?void 0:s.randomBytes)||(s=void 0)}catch{}t.randomBytesHex=function(e){if(s)return s.randomBytes(e).toString("hex");if(crypto){return t=crypto.getRandomValues(new Uint8Array(e)),[...t].map((e=>e.toString(16).padStart(2,"0"))).join("")}var t;(0,i.fail)("crypto library not found")}},5839:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getSerializableError=t.getErrorString=t.formatEnum=t.getFunctionName=t.assertNever=t.assertEachDefined=t.assertDefined=t.fail=t.assert=void 0;const i=n(9489),s=n(2489);function r(e,t){const n=new Error(e?`Debug Failure. ${e}`:"Debug Failure.");throw Error.captureStackTrace&&Error.captureStackTrace(n,t||r),n}function a(e,t,n){null==e&&r(t,n||a)}t.assert=function e(t,n,i,s){t||(i&&(n+="\r\nVerbose Debug Information: "+("string"==typeof i?i:i())),r(n?"False expression: "+n:"False expression.",s||e))},t.fail=r,t.assertDefined=a,t.assertEachDefined=function e(t,n,i){for(const s of t)a(s,n,i||e)},t.assertNever=function e(t,n="Illegal value:",i){r(`${n} ${JSON.stringify(t)}`,i||e)},t.getFunctionName=function(e){if("function"!=typeof e)return"";if((0,s.hasProperty)(e,"name"))return e.name;{const t=Function.prototype.toString.call(e),n=/^function\s+([\w$]+)\s*\(/.exec(t);return n?n[1]:""}},t.formatEnum=function(e=0,t,n){const r=function(e){const t=[];for(const n of Object.keys(e)){const i=e[n];"number"==typeof i&&t.push([i,n])}return(0,i.stableSort)(t,((e,t)=>(0,s.compareValues)(e[0],t[0])))}(t);if(0===e)return r.length>0&&0===r[0][0]?r[0][1]:"0";if(n){let t="",n=e;for(const[i,s]of r){if(i>e)break;0!==i&&i&e&&(t=`${t}${t?"|":""}${s}`,n&=~i)}if(0===n)return t}else for(const[t,n]of r)if(t===e)return n;return e.toString()},t.getErrorString=function(e){return(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e)},t.getSerializableError=function(e){if(e)return JSON.stringify(e).length>2?e:{name:e.name&&(0,s.isString)(e.name)?e.name:"noname",message:e.message&&(0,s.isString)(e.message)?e.message:"nomessage",stack:e.stack&&(0,s.isString)(e.stack)?e.stack:void 0}}},8304:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createDeferredFromPromise=t.createDeferredFrom=t.createDeferred=void 0;class n{constructor(e=null){this._scope=e,this._resolved=!1,this._rejected=!1,this._promise=new Promise(((e,t)=>{this._resolve=e,this._reject=t}))}resolve(e){this._resolve.apply(this._scope?this._scope:this,arguments),this._resolved=!0}reject(e){this._reject.apply(this._scope?this._scope:this,arguments),this._rejected=!0}get promise(){return this._promise}get resolved(){return this._resolved}get rejected(){return this._rejected}get completed(){return this._rejected||this._resolved}}function i(e=null){return new n(e)}t.createDeferred=i,t.createDeferredFrom=function(...e){const t=i();return Promise.all(e).then(t.resolve.bind(t)).catch(t.reject.bind(t)),t},t.createDeferredFromPromise=function(e){const t=i();return e.then(t.resolve.bind(t)).catch(t.reject.bind(t)),t}},1290:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticAddendum=t.Diagnostic=t.convertLevelToCategory=void 0,t.convertLevelToCategory=function(e){switch(e){case"error":return 0;case"warning":return 1;case"information":return 2;default:throw new Error(`${e} is not expected`)}},t.Diagnostic=class{constructor(e,t,n){this.category=e,this.message=t,this.range=n,this._relatedInfo=[]}addAction(e){void 0===this._actions?this._actions=[e]:this._actions.push(e)}getActions(){return this._actions}setRule(e){this._rule=e}getRule(){return this._rule}addRelatedInfo(e,t,n){this._relatedInfo.push({filePath:t,message:e,range:n})}getRelatedInfo(){return this._relatedInfo}};class n{constructor(){this._messages=[],this._childAddenda=[]}addMessage(e){this._messages.push(e)}createAddendum(){const e=new n;return this.addAddendum(e),e}getString(e=5,t=8){let n=this._getLinesRecursive(e,t);n.length>t&&(n=n.slice(0,t),n.push("  ..."));const i=n.join("\n");return i.length>0?"\n"+i:""}isEmpty(){return 0===this._getMessageCount()}addAddendum(e){this._childAddenda.push(e)}getChildren(){return this._childAddenda}getMessages(){return this._messages}_getMessageCount(e=0){if(e>64)return 0;let t=this._messages.length;for(const n of this._childAddenda)t+=n._getMessageCount(e+1);return t}_getLinesRecursive(e,t,n=0){if(e<=0||n>64)return[];let i=[];for(const s of this._childAddenda){const r=this._messages.length>0?e-1:e;if(i.push(...s._getLinesRecursive(r,t,n+1)),i.length>=t){i=i.slice(0,t);break}}const s=this._messages.length>0?"  ":"";return this._messages.concat(i).map((e=>s+e))}}t.DiagnosticAddendum=n},9744:(e,t)=>{var n;Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticRule=void 0,(n=t.DiagnosticRule||(t.DiagnosticRule={})).strictListInference="strictListInference",n.strictSetInference="strictSetInference",n.strictDictionaryInference="strictDictionaryInference",n.strictParameterNoneValue="strictParameterNoneValue",n.enableTypeIgnoreComments="enableTypeIgnoreComments",n.reportGeneralTypeIssues="reportGeneralTypeIssues",n.reportPropertyTypeMismatch="reportPropertyTypeMismatch",n.reportFunctionMemberAccess="reportFunctionMemberAccess",n.reportMissingImports="reportMissingImports",n.reportMissingModuleSource="reportMissingModuleSource",n.reportMissingTypeStubs="reportMissingTypeStubs",n.reportImportCycles="reportImportCycles",n.reportUnusedImport="reportUnusedImport",n.reportUnusedClass="reportUnusedClass",n.reportUnusedFunction="reportUnusedFunction",n.reportUnusedVariable="reportUnusedVariable",n.reportDuplicateImport="reportDuplicateImport",n.reportWildcardImportFromLibrary="reportWildcardImportFromLibrary",n.reportOptionalSubscript="reportOptionalSubscript",n.reportOptionalMemberAccess="reportOptionalMemberAccess",n.reportOptionalCall="reportOptionalCall",n.reportOptionalIterable="reportOptionalIterable",n.reportOptionalContextManager="reportOptionalContextManager",n.reportOptionalOperand="reportOptionalOperand",n.reportTypedDictNotRequiredAccess="reportTypedDictNotRequiredAccess",n.reportUntypedFunctionDecorator="reportUntypedFunctionDecorator",n.reportUntypedClassDecorator="reportUntypedClassDecorator",n.reportUntypedBaseClass="reportUntypedBaseClass",n.reportUntypedNamedTuple="reportUntypedNamedTuple",n.reportPrivateUsage="reportPrivateUsage",n.reportPrivateImportUsage="reportPrivateImportUsage",n.reportConstantRedefinition="reportConstantRedefinition",n.reportIncompatibleMethodOverride="reportIncompatibleMethodOverride",n.reportIncompatibleVariableOverride="reportIncompatibleVariableOverride",n.reportOverlappingOverload="reportOverlappingOverload",n.reportUninitializedInstanceVariable="reportUninitializedInstanceVariable",n.reportInvalidStringEscapeSequence="reportInvalidStringEscapeSequence",n.reportUnknownParameterType="reportUnknownParameterType",n.reportUnknownArgumentType="reportUnknownArgumentType",n.reportUnknownLambdaType="reportUnknownLambdaType",n.reportUnknownVariableType="reportUnknownVariableType",n.reportUnknownMemberType="reportUnknownMemberType",n.reportMissingParameterType="reportMissingParameterType",n.reportMissingTypeArgument="reportMissingTypeArgument",n.reportInvalidTypeVarUse="reportInvalidTypeVarUse",n.reportCallInDefaultInitializer="reportCallInDefaultInitializer",n.reportUnnecessaryIsInstance="reportUnnecessaryIsInstance",n.reportUnnecessaryCast="reportUnnecessaryCast",n.reportUnnecessaryComparison="reportUnnecessaryComparison",n.reportAssertAlwaysTrue="reportAssertAlwaysTrue",n.reportSelfClsParameterName="reportSelfClsParameterName",n.reportImplicitStringConcatenation="reportImplicitStringConcatenation",n.reportUndefinedVariable="reportUndefinedVariable",n.reportUnboundVariable="reportUnboundVariable",n.reportInvalidStubStatement="reportInvalidStubStatement",n.reportIncompleteStub="reportIncompleteStub",n.reportUnsupportedDunderAll="reportUnsupportedDunderAll",n.reportUnusedCallResult="reportUnusedCallResult",n.reportUnusedCoroutine="reportUnusedCoroutine"},3980:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeDiagnosticSink=t.DiagnosticSink=void 0;const i=n(1290),s=n(1464),r=n(7559);class a{constructor(e){this._diagnosticList=e||[],this._diagnosticMap=new Map}fetchAndClear(){const e=this._diagnosticList;return this._diagnosticList=[],this._diagnosticMap.clear(),e}addError(e,t){return this.addDiagnostic(new i.Diagnostic(0,e,t))}addWarning(e,t){return this.addDiagnostic(new i.Diagnostic(1,e,t))}addInformation(e,t){return this.addDiagnostic(new i.Diagnostic(2,e,t))}addUnusedCode(e,t,n){const s=new i.Diagnostic(3,e,t);return n&&s.addAction(n),this.addDiagnostic(s)}addDeprecated(e,t,n){const s=new i.Diagnostic(4,e,t);return n&&s.addAction(n),this.addDiagnostic(s)}addDiagnostic(e){const t=`${e.range.start.line},${e.range.start.character}-${e.range.end.line}-${e.range.end.character}:${(0,r.hashString)(e.message)}}`;return this._diagnosticMap.has(t)||(this._diagnosticList.push(e),this._diagnosticMap.set(t,e)),e}addDiagnostics(e){this._diagnosticList.push(...e)}getErrors(){return this._diagnosticList.filter((e=>0===e.category))}getWarnings(){return this._diagnosticList.filter((e=>1===e.category))}getInformation(){return this._diagnosticList.filter((e=>2===e.category))}getUnusedCode(){return this._diagnosticList.filter((e=>3===e.category))}getDeprecated(){return this._diagnosticList.filter((e=>4===e.category))}}t.DiagnosticSink=a,t.TextRangeDiagnosticSink=class extends a{constructor(e,t){super(t),this._lines=e}addDiagnosticWithTextRange(e,t,n){const i=(0,s.convertOffsetsToRange)(n.start,n.start+n.length,this._lines);switch(e){case"error":return this.addError(t,i);case"warning":return this.addWarning(t,i);case"information":return this.addInformation(t,i);default:throw new Error(`${e} is not expected value`)}}addUnusedCodeWithTextRange(e,t,n){return this.addUnusedCode(e,(0,s.convertOffsetsToRange)(t.start,t.start+t.length,this._lines),n)}addDeprecatedWithTextRange(e,t,n){return this.addDeprecated(e,(0,s.convertOffsetsToRange)(t.start,t.start+t.length,this._lines),n)}}},6755:()=>{Promise.prototype.ignoreErrors=function(){this.catch((()=>{}))}},9241:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.FileBasedCancellationProvider=t.getCancellationTokenId=t.getCancellationTokenFromId=t.disposeCancellationToken=t.getCancellationStrategyFromArgv=void 0;const a=r(n(7147)),o=r(n(2037)),l=r(n(1017)),c=n(6744),p=n(4494),d=n(3213);class u{static shouldCheck(){const e=Date.now().valueOf();return e-this._lastCheckTimestamp>=5&&(this._lastCheckTimestamp=e,!0)}}u._lastCheckTimestamp=0;class m{constructor(e){this.cancellationFilePath=e,this.isCancelled=!1}cancel(){this.isCancelled||(this.isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this._disposeEmitter()))}get isCancellationRequested(){return!!this.isCancelled||(u.shouldCheck()&&this._pipeExists()&&this.cancel(),this.isCancelled)}get onCancellationRequested(){return this._emitter||(this._emitter=new p.Emitter),this._emitter.event}dispose(){this._disposeEmitter()}_disposeEmitter(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}_pipeExists(){try{return a.statSync(this.cancellationFilePath),!0}catch(e){return!1}}}class h extends m{constructor(e){super(e),this._disposed=!1}cancel(){this._disposed||this.isCancelled||(this._createPipe(),super.cancel())}get isCancellationRequested(){return this.isCancelled}dispose(){this._disposed=!0,super.dispose(),this._removePipe()}_createPipe(){try{a.writeFileSync(this.cancellationFilePath,"",{flag:"w"})}catch{}}_removePipe(){try{a.unlinkSync(this.cancellationFilePath)}catch{}}}class y{constructor(e,t=!1){this._cancellationFilePath=e,this._ownFile=t}get token(){return this._token||(this._token=this._ownFile?new h(this._cancellationFilePath):new m(this._cancellationFilePath)),this._token}cancel(){this._token?this._token.cancel():this._token=p.CancellationToken.Cancelled}dispose(){this._token?this._token instanceof m&&this._token.dispose():this._token=p.CancellationToken.None}}function g(e,t){return l.join(function(e){return l.join(o.tmpdir(),"python-languageserver-cancellation",e)}(e),`cancellation-${String(t)}.tmp`)}class f{constructor(e){this.folderName=e}createCancellationTokenSource(e){return new y(g(this.folderName,e))}}t.getCancellationStrategyFromArgv=function(e){let t;for(let i=0;i<e.length;i++){const s=e[i];if("--cancellationReceive"===s)t=n(e[i+1]);else{const e=s.split("=");"--cancellationReceive"===e[0]&&(t=n(e[1]))}}return t&&!(0,d.getCancellationFolderName)()&&(0,d.setCancellationFolderName)(t.folderName),t=t||p.CancellationReceiverStrategy.Message,{receiver:t,sender:p.CancellationSenderStrategy.Message};function n(e){const t=function(e){const t=e.match(/^file:(.+)$/);return t?t[1]:void 0}(e);return t?new f(t):void 0}},t.disposeCancellationToken=function(e){e instanceof m&&e.dispose()},t.getCancellationTokenFromId=function(e){return e?new m(e):p.CancellationToken.None},t.getCancellationTokenId=function(e){return e instanceof m?e.cancellationFilePath:void 0};let T=0;t.FileBasedCancellationProvider=class{constructor(e){this._prefix=e}createCancellationTokenSource(){const e=(0,d.getCancellationFolderName)();return e?new y(g(e,`${this._prefix}-${String(T++)}`),!0):new c.CancellationTokenSource}}},7830:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualDirent=t.nullFileWatcherProvider=t.ignoredWatchEventFunction=void 0,t.ignoredWatchEventFunction=function(e){const t=e.map((e=>e.toLowerCase()));return e=>{if(!e||e.indexOf("__pycache__")>=0)return!0;const n=e.toLowerCase();return t.every((e=>n.indexOf(e)<0))}};const n={close(){}};t.nullFileWatcherProvider={createFileWatcher:(e,t)=>n,onFileChange(e,t){}},t.VirtualDirent=class{constructor(e,t){this.name=e,this._file=t}isFile(){return this._file}isDirectory(){return!this._file}isBlockDevice(){return!1}isCharacterDevice(){return!1}isSymbolicLink(){return!1}isFIFO(){return!1}isSocket(){return!1}}},3584:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.FullAccessHost=t.LimitedAccessHost=void 0;const a=r(n(2081)),o=n(2930),l=n(5839),c=n(8442),p=n(6657),d=n(6886),u=["import os, os.path, sys","normalize = lambda p: os.path.normcase(os.path.normpath(p))","cwd = normalize(os.getcwd())",'sys.path[:] = [p for p in sys.path if p != "" and normalize(p) != cwd]'],m=[...u,"import sys, json","json.dump(dict(path=sys.path, prefix=sys.prefix), sys.stdout)"].join("; "),h=[...u,"import sys, json","json.dump(dict(major=sys.version_info[0], minor=sys.version_info[1]), sys.stdout)"].join("; ");class y extends c.NoAccessHost{get kind(){return 1}getPythonPlatform(e){return"darwin"===process.platform?o.PythonPlatform.Darwin:"linux"===process.platform?o.PythonPlatform.Linux:"win32"===process.platform?o.PythonPlatform.Windows:void 0}}t.LimitedAccessHost=y;class g extends y{constructor(e){super(),this._fs=e}static createHost(e,t){switch(e){case 2:return new c.NoAccessHost;case 1:return new y;case 0:return new g(t);default:(0,l.assertNever)(e)}}get kind(){return 0}getPythonSearchPaths(e,t){const n=null!=t?t:[];let i=this._executePythonInterpreter(e,(e=>this._getSearchPathResultFromInterpreter(this._fs,e,n)));return i||(i={paths:[],prefix:""}),n.push(`Received ${i.paths.length} paths from interpreter`),i.paths.forEach((e=>{n.push(`  ${e}`)})),i}getPythonVersion(e,t){const n=null!=t?t:[];try{const t=["-c",h],i=this._executePythonInterpreter(e,(e=>a.execFileSync(e,t,{encoding:"utf8"}))),s=JSON.parse(i),r=(0,d.versionFromMajorMinor)(s.major,s.minor);return void 0===r?void n.push(`Python version ${s.major}.${s.minor} from interpreter is unsupported`):r}catch{return void n.push("Unable to get Python version from interpreter")}}_executePythonInterpreter(e,t){if(e)return t(e);{let e;try{"win32"!==process.platform&&(e=t("python3"))}catch{}return void 0!==e?e:t("python")}}_getSearchPathResultFromInterpreter(e,t,n){const i={paths:[],prefix:""};try{const s=["-c",m];n.push(`Executing interpreter: '${t}'`);const r=a.execFileSync(t,s,{encoding:"utf8"});try{const t=JSON.parse(r);for(let s of t.path)if(s=s.trim(),s){const t=(0,p.normalizePath)(s);e.existsSync(t)&&(0,p.isDirectory)(e,t)?i.paths.push(t):n.push(`Skipping '${t}' because it is not a valid directory`)}i.prefix=t.prefix,0===i.paths.length&&n.push("Found no valid directories")}catch(e){throw n.push(`Could not parse output: '${r}'`),e}}catch{return}return i}}t.FullAccessHost=g},8442:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoAccessHost=void 0,t.NoAccessHost=class{get kind(){return 2}getPythonSearchPaths(e,t){return null==t||t.push("No access to python executable."),{paths:[],prefix:""}}getPythonVersion(e,t){}getPythonPlatform(e){}}},7345:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LogTracker=void 0;const i=n(2211),s=n(8718);t.LogTracker=class{constructor(e,t){this._console=e,this._prefix=t,this._dummyState=new r,this._indentation="",this._previousTitles=[]}log(e,t,n=-1,s=!1){if(void 0===this._console)return t(this._dummyState);const a=this._console.level;if(void 0===a||a!==i.LogLevel.Log&&a!==i.LogLevel.Info)return t(this._dummyState);const o=this._indentation;this._previousTitles.push(`${o}${e} ...`),this._indentation+="  ";const l=new r;try{return t(l)}finally{const t=l.duration;if(this._indentation=o,this._previousTitles.length>0&&(l.isSuppressed()||t<=n))this._previousTitles.pop();else{this._printPreviousTitles();let n=`[${this._prefix}] ${this._indentation}${e}${l.get()} (${t}ms)`;s&&l.fileReadTotal+l.tokenizeTotal+l.parsingTotal+l.resolveImportsTotal+l.bindingTotal>0&&(n+=` [f:${l.fileReadTotal}, t:${l.tokenizeTotal}, p:${l.parsingTotal}, i:${l.resolveImportsTotal}, b:${l.bindingTotal}]`),this._console.log(n),t>=2e3&&this._console.info(`[${this._prefix}] Long operation: ${e} (${t}ms)`)}}}_printPreviousTitles(){if(this._previousTitles.pop(),!(this._previousTitles.length<=0)){for(const e of this._previousTitles)this._console.log(`[${this._prefix}] ${e}`);this._previousTitles.length=0}}};class r{constructor(){this._start=new s.Duration,this._startFile=s.timingStats.readFileTime.totalTime,this._startToken=s.timingStats.tokenizeFileTime.totalTime,this._startParse=s.timingStats.parseFileTime.totalTime,this._startImport=s.timingStats.resolveImportsTime.totalTime,this._startBind=s.timingStats.bindTime.totalTime}get duration(){return this._start.getDurationInMilliseconds()}get fileReadTotal(){return s.timingStats.readFileTime.totalTime-this._startFile}get tokenizeTotal(){return s.timingStats.tokenizeFileTime.totalTime-this._startToken}get parsingTotal(){return s.timingStats.parseFileTime.totalTime-this._startParse}get resolveImportsTotal(){return s.timingStats.resolveImportsTime.totalTime-this._startImport}get bindingTotal(){return s.timingStats.bindTime.totalTime-this._startBind}add(e){e&&(this._addendum=e)}get(){return this._addendum?` [${this._addendum}]`:""}suppress(){this._suppress=!0}isSuppressed(){return!!this._suppress}}},3188:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.stubsSuffix=t.src=t.distPackages=t.sitePackages=t.lib64=t.libAlternate=t.lib=t.typeshedFallback=void 0,t.typeshedFallback="typeshed-fallback",t.lib="lib",t.libAlternate="Lib",t.lib64="lib64",t.sitePackages="site-packages",t.distPackages="dist-packages",t.src="src",t.stubsSuffix="-stubs"},6657:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getLibraryPathWithoutExtension=t.isFileSystemCaseSensitiveInternal=t.isFileSystemCaseSensitive=t.normalizePathCase=t.convertPathToUri=t.extractPathFromUri=t.convertUriToPath=t.isDiskPathRoot=t.isRootedDiskPath=t.getRegexEscapedSeparator=t.getFileSpec=t.getWildcardRoot=t.getWildcardRegexPattern=t.getFileSystemEntriesFromDirEntries=t.getFileSystemEntries=t.tryRealpath=t.tryStat=t.isFile=t.isDirectory=t.normalizePath=t.stripFileExtension=t.getFileName=t.getFileExtension=t.stripTrailingDirectorySeparator=t.hasTrailingDirectorySeparator=t.ensureTrailingDirectorySeparator=t.comparePathsCaseInsensitive=t.comparePathsCaseSensitive=t.getRelativePathComponentsFromDirectory=t.getRelativePathFromDirectory=t.getBaseFileName=t.getAnyExtensionFromPath=t.changeAnyExtension=t.containsPath=t.comparePaths=t.combinePaths=t.resolvePaths=t.normalizeSlashes=t.directoryExists=t.fileExists=t.getFileSize=t.makeDirectories=t.getRelativePath=t.combinePathComponents=t.reducePathComponents=t.getPathComponents=t.getRootLength=t.getDirectoryPath=t.forEachAncestorDirectory=t.FileSpec=void 0,t.getDirectoryChangeKind=void 0;const a=r(n(1017)),o=n(472),l=n(9489),c=n(2489),p=n(8916),d=r(n(5839)),u=n(7559);let m;function h(e){return e.substr(0,Math.max(y(e),e.lastIndexOf(a.sep)))}function y(e){if(e.charAt(0)===a.sep){if(e.charAt(1)!==a.sep)return 1;const t=e.indexOf(a.sep,2);if(t<0)return 2;const n=e.indexOf(a.sep,t+1);return n<0?t+1:n+1}return":"===e.charAt(1)&&e.charAt(2)===a.sep?3:0}function g(e){const t=v(e),n=y(t),i=t.substring(0,n),s=t.substring(n).split(a.sep);return s.length>0&&!s[s.length-1]&&s.pop(),f([i,...s])}function f(e){if(!(0,l.some)(e))return[];const t=[e[0]];for(let n=1;n<e.length;n++){const i=e[n];if(i&&"."!==i){if(".."===i)if(t.length>1){if(".."!==t[t.length-1]){t.pop();continue}}else if(t[0])continue;t.push(i)}}return t}function T(e){return 0===e.length?"":v((e[0]&&F(e[0]))+e.slice(1).join(a.sep))}(t.FileSpec||(t.FileSpec={})).is=function(e){const t=e;return t&&!!t.wildcardRoot&&!!t.regExp},t.forEachAncestorDirectory=function(e,t){for(;;){const n=t(e);if(void 0!==n)return n;const i=h(e);if(i===e)return;e=i}},t.getDirectoryPath=h,t.getRootLength=y,t.getPathComponents=g,t.reducePathComponents=f,t.combinePathComponents=T,t.getRelativePath=function(e,t){if(!e.startsWith(F(t)))return;const n=g(e);let i=".";for(let e=g(t).length;e<n.length;e++)i+=a.sep+n[e];return i},t.makeDirectories=function(e,t,n){if(!t.startsWith(n))return;const i=g(t);let s=n;for(let t=g(n).length;t<i.length;t++)s=b(s,i[t]),e.existsSync(s)||e.mkdirSync(s)},t.getFileSize=function(e,t){const n=w(e,t);return(null==n?void 0:n.isFile())?n.size:0},t.fileExists=function(e,t){return U(e,t,0)},t.directoryExists=function(e,t){return U(e,t,1)};const _="/"===a.sep?"\\":"/";function v(e){if(e.includes(_)){const t=/[\\/]/g;return e.replace(t,a.sep)}return e}function b(e,...t){e&&(e=v(e));for(let n of t)n&&(n=v(n),e=e&&0===y(n)?F(e)+n:n);return e}function I(e,t,n){if(t)return function(e,t,n){if("string"==typeof t)return V(e,t,n)||"";for(const i of t){const t=V(e,i,n);if(t)return t}return""}(P(e),t,n?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive);const i=C(e),s=i.lastIndexOf(".");return s>=0?i.substring(s):""}function C(e,t,n){if(y(e=v(e))===e.length)return"";const i=(e=P(e)).slice(Math.max(y(e),e.lastIndexOf(a.sep)+1)),s=void 0!==t&&void 0!==n?I(i,t,n):void 0;return s?i.slice(0,i.length-s.length):i}function S(e,t,n){d.assert(y(e)>0==y(t)>0,"Paths must either both be absolute or both be relative");const i="function"==typeof n?n:c.identity,s=function(e,t,n,i){const s=g(e),r=g(t);let a;for(a=0;a<s.length&&a<r.length;a++){const e=i(s[a]),t=i(r[a]);if(!(0===a?u.equateStringsCaseInsensitive:n)(e,t))break}if(0===a)return r;const o=r.slice(a),l=[];for(;a<s.length;a++)l.push("..");return["",...l,...o]}(e,t,"boolean"==typeof n&&n?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive,i);return s}function F(e){return D(e)?e:e+a.sep}function D(e){if(0===e.length)return!1;const t=e.charCodeAt(e.length-1);return 47===t||92===t}function P(e){return D(e)?e.substr(0,e.length-1):e}function x(e,t=!1){if(!t)return a.extname(e);const n=(e=A(e)).indexOf(".");return e.substr(n)}function A(e){return a.basename(e)}function k(e,t=!1){const n=x(e,t);return e.substr(0,e.length-n.length)}function E(e){return v(a.normalize(e))}function w(e,t){try{return e.statSync(t)}catch(e){return}}function N(e,t,n){const i=e.sort(((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)),s=[],r=[];for(const e of i)if("."!==e.name&&".."!==e.name)if(e.isFile())s.push(e.name);else if(e.isDirectory())r.push(e.name);else if(e.isSymbolicLink()){const i=w(t,b(n,e.name));(null==i?void 0:i.isFile())?s.push(e.name):(null==i?void 0:i.isDirectory())&&r.push(e.name)}return{files:s,directories:r}}function R(e,t){let n=E(b(e,t));n.endsWith(".py")||n.endsWith(".pyi")||(n=F(n));const i=g(n),s=O(),r=`(${s}[^${s}.][^${s}]*)*?`,a=new RegExp(`[^\\w\\s${s}]`,"g");i.length>0&&(i[0]=P(i[0]));let o="",l=!0;for(let e of i)"**"===e?o+=r:(l||(e=s+e),o+=e.replace(a,(e=>"*"===e?`[^${s}]*`:"?"===e?`[^${s}]`:"\\"+e)),l=!1);return o}function M(e,t){let n=E(b(e,t));n.endsWith(".py")||n.endsWith(".pyi")||(n=F(n));const i=g(n);if(i.length>0&&(i[0]=P(i[0])),1===i.length&&!i[0])return a.sep;let s="",r=!0;for(let e of i){if("**"===e)break;if(e.match(/[*?]/))break;r||(e=a.sep+e),s+=e,r=!1}return s}function O(){return"/"===a.sep?"/":"\\\\"}function L(e,t,n){if(e===t)return 0;if(void 0===e)return-1;if(void 0===t)return 1;const i=e.substring(0,y(e)),s=t.substring(0,y(t)),r=(0,u.compareStringsCaseInsensitive)(i,s);if(0!==r)return r;const a=O(),o=new RegExp(`(^|${a}).{0,2}($|${a})`),l=e.substring(i.length),p=t.substring(s.length);if(!o.test(l)&&!o.test(p))return n(l,p);const d=g(e),m=g(t),h=Math.min(d.length,m.length);for(let e=1;e<h;e++){const t=n(d[e],m[e]);if(0!==t)return t}return(0,c.compareValues)(d.length,m.length)}function V(e,t,n){if(t.startsWith(".")||(t="."+t),e.length>=t.length&&46===e.charCodeAt(e.length-t.length)){const i=e.slice(e.length-t.length);if(n(i,t))return i}}function U(e,t,n){try{const i=e.statSync(t);switch(n){case 0:return i.isFile();case 1:return i.isDirectory();default:return!1}}catch(e){return!1}}function z(e){let t=E(o.URI.parse(e).path);return t.match(/^\\[a-zA-Z]:\\/)&&(t=t.substr(1)),t}function B(e){return void 0!==m||(m=W(e)),m}function W(e){let t;try{let n,i;do{n=`${(0,p.randomBytesHex)(21)}-a`,t=a.join(e.tmpdir(),n),i=a.join(e.tmpdir(),n.toUpperCase())}while(e.existsSync(t)||e.existsSync(i));return e.writeFileSync(t,"","utf8"),!e.existsSync(i)}catch(e){return!1}finally{t&&e.unlinkSync(t)}}t.normalizeSlashes=v,t.resolvePaths=function(e,...t){return E((0,l.some)(t)?b(e,...t):v(e))},t.combinePaths=b,t.comparePaths=function(e,t,n,i){return e=E(e),t=E(t),"string"==typeof n?(e=b(n,e),t=b(n,t)):"boolean"==typeof n&&(i=n),L(e,t,(0,u.getStringComparer)(i))},t.containsPath=function(e,t,n,i){if("string"==typeof n?(e=b(n,e),t=b(n,t)):"boolean"==typeof n&&(i=n),void 0===e||void 0===t)return!1;if(e===t)return!0;const s=g(e),r=g(t);if(r.length<s.length)return!1;const a=i?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive;for(let e=0;e<s.length;e++)if(!(0===e?u.equateStringsCaseInsensitive:a)(s[e],r[e]))return!1;return!0},t.changeAnyExtension=function(e,t,n,i){const s=void 0!==n&&void 0!==i?I(e,n,i):I(e);return s?e.slice(0,e.length-s.length)+(t.startsWith(".")?t:"."+t):e},t.getAnyExtensionFromPath=I,t.getBaseFileName=C,t.getRelativePathFromDirectory=function(e,t,n){return T(S(e,t,n))},t.getRelativePathComponentsFromDirectory=S,t.comparePathsCaseSensitive=function(e,t){return L(e,t,u.compareStringsCaseSensitive)},t.comparePathsCaseInsensitive=function(e,t){return L(e,t,u.compareStringsCaseInsensitive)},t.ensureTrailingDirectorySeparator=F,t.hasTrailingDirectorySeparator=D,t.stripTrailingDirectorySeparator=P,t.getFileExtension=x,t.getFileName=A,t.stripFileExtension=k,t.normalizePath=E,t.isDirectory=function(e,t){var n,i;return null!==(i=null===(n=w(e,t))||void 0===n?void 0:n.isDirectory())&&void 0!==i&&i},t.isFile=function(e,t){var n,i;return null!==(i=null===(n=w(e,t))||void 0===n?void 0:n.isFile())&&void 0!==i&&i},t.tryStat=w,t.tryRealpath=function(e,t){try{return e.realpathSync(t)}catch(e){return}},t.getFileSystemEntries=function(e,t){try{return N(e.readdirEntriesSync(t||"."),e,t)}catch(e){return{files:[],directories:[]}}},t.getFileSystemEntriesFromDirEntries=N,t.getWildcardRegexPattern=R,t.getWildcardRoot=M,t.getFileSpec=function(e,t){let n=R(e,t);n=`^(${n})($|${O()})`;const i=new RegExp(n);return{wildcardRoot:M(e,t),regExp:i}},t.getRegexEscapedSeparator=O,t.isRootedDiskPath=function(e){return y(e)>0},t.isDiskPathRoot=function(e){const t=y(e);return t>0&&t===e.length},t.convertUriToPath=function(e,t){return e.getMappedFilePath(z(t))},t.extractPathFromUri=z,t.convertPathToUri=function(e,t){return e.getUri(e.getOriginalFilePath(t))},t.normalizePathCase=function(e,t){return B(e)?t:t.toLowerCase()},t.isFileSystemCaseSensitive=B,t.isFileSystemCaseSensitiveInternal=W,t.getLibraryPathWithoutExtension=function(e){let t=k(e);return t.endsWith("__init__")&&(t=t.substr(0,t.length-9)),t},t.getDirectoryChangeKind=function(e,t,n){if(e.realCasePath(t)===e.realCasePath(n))return"Same";const i=S(t,n,(t=>e.realCasePath(t)));return 3===i.length&&".."===i[1]&&".."!==i[2]?"Renamed":"Moved"}},1464:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertTextRangeToRange=t.convertRangeToTextRange=t.convertPositionToOffset=t.convertOffsetsToRange=t.convertOffsetToPosition=void 0;const i=n(5839),s=n(3550);function r(e,t){if(0===t.end)return{line:0,character:0};let n=0;e>=t.end&&(e=t.end-1,n=1);const s=t.getItemContaining(e);(0,i.assert)(s>=0&&s<=t.length);const r=t.getItemAt(s);return(0,i.assert)(void 0!==r),{line:s,character:e-r.start+n}}function a(e,t,n){return{start:r(e,n),end:r(t,n)}}function o(e,t){if(!(e.line>=t.count))return t.getItemAt(e.line).start+e.character}t.convertOffsetToPosition=r,t.convertOffsetsToRange=a,t.convertPositionToOffset=o,t.convertRangeToTextRange=function(e,t){const n=o(e.start,t);if(void 0===n)return;const i=o(e.end,t);return void 0!==i?s.TextRange.fromBounds(n,i):void 0},t.convertTextRangeToRange=function(e,t){return a(e.start,s.TextRange.getEnd(e),t)}},2150:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressReportTracker=void 0,t.ProgressReportTracker=class{constructor(e){this._reporter=e,this._isDisplayingProgress=!1}isEnabled(e){var t;return!!this._isDisplayingProgress||null!==(t=this._reporter.isEnabled(e))&&void 0!==t&&t}begin(){this._isDisplayingProgress||(this._isDisplayingProgress=!0,this._reporter.begin())}report(e){this._isDisplayingProgress&&this._reporter.report(e)}end(){this._isDisplayingProgress&&(this._isDisplayingProgress=!1,this._reporter.end())}}},6886:(e,t)=>{var n;function i(e,t){if(isNaN(e)||isNaN(t))return;if(e>255||t>255)return;const i=256*e+t;return void 0!==n[i]&&s(i)?i:void 0}function s(e){return e>>8==3}Object.defineProperty(t,"__esModule",{value:!0}),t.is3x=t.versionFromMajorMinor=t.versionFromString=t.versionToString=t.latestStablePythonVersion=t.PythonVersion=void 0,function(e){e[e.V3_0=768]="V3_0",e[e.V3_1=769]="V3_1",e[e.V3_2=770]="V3_2",e[e.V3_3=771]="V3_3",e[e.V3_4=772]="V3_4",e[e.V3_5=773]="V3_5",e[e.V3_6=774]="V3_6",e[e.V3_7=775]="V3_7",e[e.V3_8=776]="V3_8",e[e.V3_9=777]="V3_9",e[e.V3_10=778]="V3_10",e[e.V3_11=779]="V3_11"}(n=t.PythonVersion||(t.PythonVersion={})),t.latestStablePythonVersion=n.V3_10,t.versionToString=function(e){return`${e>>8&255}.${255&e}`},t.versionFromString=function(e){const t=e.split(".");if(!(t.length<2))return i(parseInt(t[0],10),parseInt(t[1],10))},t.versionFromMajorMinor=i,t.is3x=s},7720:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceFileWatcherProvider=t.createFromRealFileSystem=void 0;const a=n(742),o=n(2771),l=r(n(7147)),c=r(n(1195)),p=n(472),d=n(2211),u=n(2489),m=n(7830),h=n(6657),y=n(6657);c.setGracefulCleanup(),t.createFromRealFileSystem=function(e,t){return e=null!=e?e:new d.NullConsole,new F(null!=t?t:m.nullFileWatcherProvider,e)};const g=".zip",f=".egg";function T(e){let t=e.indexOf(g);if(t<=0&&(t=e.indexOf(f),t<=0))return null;if(e[t-1]===a.ppath.sep)return null;const n=t+g.length;return e.length>n&&e[n]!==a.ppath.sep?null:e.slice(0,n)}function _(e){return e.endsWith(g)||e.endsWith(f)}const v=[Buffer.from([80,75,3,4]),Buffer.from([80,75,5,6]),Buffer.from([80,75,7,8])];function b(e,t){let n;try{n=e.openSync(t,"r");const i=Buffer.alloc(4);if(e.readSync(n,i,0,4,0)<4)return!1;for(const e of v)if(0===i.compare(e))return!0;return!1}catch{return!1}finally{void 0!==n&&e.closeSync(n)}}class I extends a.ZipOpenFS{getZipSync(e,t){return super.getZipSync(e,t)}findZip(e){if(this.filter&&!this.filter.test(e))return null;let t="";for(;;){const n=T(e.substr(t.length));if(!n)return null;if(t=this.pathUtils.join(t,n),!1===this.isZip.has(t)){if(this.notZip.has(t))continue;try{if(!this.baseFs.lstatSync(t).isFile()){this.notZip.add(t);continue}if(!b(this.baseFs,t)){this.notZip.add(t);continue}try{this.getZipSync(t,(()=>{}))}catch{this.notZip.add(t);continue}}catch{return null}this.isZip.add(t)}return{archivePath:t,subPath:this.pathUtils.join(a.PortablePath.root,e.substr(t.length))}}}}class C extends a.PosixFS{constructor(){const e=new I({libzip:()=>(0,o.getLibzipSync)(),useCache:!0,maxOpenFiles:80,readOnlyArchives:!0});super(new a.VirtualFS({baseFs:e})),this._eggZipOpenFS=e}isZip(e){return!!this._eggZipOpenFS.findZip(this.mapToBase(e))}}const S=new C;class F{constructor(e,t){this._fileWatcherProvider=e,this._console=t}existsSync(e){try{return S.existsSync(e)}catch{return!1}}mkdirSync(e,t){S.mkdirSync(e,t)}chdir(e){process.chdir(e)}readdirSync(e){return S.readdirSync(e)}readdirEntriesSync(e){return S.readdirSync(e,{withFileTypes:!0}).map((t=>_(t.name)&&t.isFile()&&S.isZip(e)?{name:t.name,isFile:()=>!1,isDirectory:()=>!0,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isSymbolicLink:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}:t))}readFileSync(e,t=null){return"utf8"===t||"utf-8"===t?S.readFileSync(e,"utf8"):S.readFileSync(e)}writeFileSync(e,t,n){S.writeFileSync(e,t,n||void 0)}statSync(e){const t=S.statSync(e);return _(e)&&t.isFile()&&S.isZip(e)?{...t,isFile:()=>!1,isDirectory:()=>!0}:t}unlinkSync(e){S.unlinkSync(e)}realpathSync(e){return S.realpathSync(e)}getModulePath(){return global.__rootDirectory}createFileSystemWatcher(e,t){return this._fileWatcherProvider.createFileWatcher(e,t)}createReadStream(e){return S.createReadStream(e)}createWriteStream(e){return S.createWriteStream(e)}copyFileSync(e,t){S.copyFileSync(e,t)}readFile(e){return S.readFilePromise(e)}async readFileText(e,t){return"utf8"===t||"utf-8"===t?S.readFilePromise(e,"utf8"):(await S.readFilePromise(e)).toString(t)}tmpdir(){if(!this._tmpdir){const e=c.dirSync({prefix:"pyright"});this._tmpdir=e.name}return this._tmpdir}tmpfile(e){return c.fileSync({dir:this.tmpdir(),discardDescriptor:!0,...e}).name}realCasePath(e){try{if(!l.existsSync(e))return e;const t=l.realpathSync.native(e),n=(0,y.getRootLength)(t);return n<=0?t:t.substr(0,n).toLowerCase()+t.substr(n)}catch(t){return this._console.error(`Failed to get real file system casing for ${e}: ${t}`),e}}isMappedFilePath(e){return!1}getOriginalFilePath(e){return e}getMappedFilePath(e){return e}getUri(e){return p.URI.file(e).toString()}isInZipOrEgg(e){return/[^\\/]\.(?:egg|zip)[\\/]/.test(e)&&S.isZip(e)}}t.WorkspaceFileWatcherProvider=class{constructor(e,t){this._workspaceMap=e,this._console=t,this._fileWatchers=[]}createFileWatcher(e,t){const n=[],i=[],s=this._workspaceMap.getNonDefaultWorkspaces();e.forEach((e=>{s.some((t=>(0,h.containsPath)(t.rootPath,e)))?n.push(e):i.push(e)}));const r=i.map((e=>{if(l.existsSync(e))try{return l.watch(e,{recursive:!0},((e,n)=>t(e,n)))}catch(e){return void this._console.warn(`Exception received when installing file system watcher: ${e}`)}})).filter(u.isDefined),a=this,o={close(){a._fileWatchers=a._fileWatchers.filter((e=>e!==o)),r.forEach((e=>{e.close()}))},workspacePaths:n,eventHandler:t};return a._fileWatchers.push(o),o}onFileChange(e,t){this._fileWatchers.forEach((n=>{n.workspacePaths.some((e=>(0,h.containsPath)(e,t)))&&n.eventHandler(e,t)}))}}},7559:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getLastDottedString=t.getCharacterCount=t.equateStringsCaseSensitive=t.equateStringsCaseInsensitive=t.getStringComparer=t.compareStringsCaseSensitive=t.compareStringsCaseInsensitive=t.hashString=t.isPatternInSymbol=t.computeCompletionSimilarity=void 0;const s=i(n(7588)),r=n(2489);function a(e,t){return e===t?0:void 0===e?-1:void 0===t?1:(0,r.compareComparableValues)(e.toUpperCase(),t.toUpperCase())}function o(e,t){return(0,r.compareComparableValues)(e,t)}t.computeCompletionSimilarity=function(e,t){if(t.startsWith(e))return 1;const n=t.toLocaleLowerCase(),i=e.toLocaleLowerCase();if(n.startsWith(i))return.75;let r=n.length,a=Number.MAX_VALUE;for(;r>0;){const e=(0,s.default)(n.substr(0,r),i);e<a&&(a=e),r--}return a>=e.length?0:(e.length-a)/e.length*.5},t.isPatternInSymbol=function(e,t){const n=e.toLocaleLowerCase(),i=t.toLocaleLowerCase(),s=n.length,r=i.length;let a=0,o=0;for(;a<s&&o<r;)n[a]===i[o]&&(a+=1),o+=1;return a===s},t.hashString=function(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t},t.compareStringsCaseInsensitive=a,t.compareStringsCaseSensitive=o,t.getStringComparer=function(e){return e?a:o},t.equateStringsCaseInsensitive=function(e,t){return 0===a(e,t)},t.equateStringsCaseSensitive=function(e,t){return 0===o(e,t)},t.getCharacterCount=function(e,t){let n=0;for(let i=0;i<e.length;i++)e[i]===t&&n++;return n},t.getLastDottedString=function(e){const t=e.lastIndexOf(".");return t>0?e.substring(t+1):e}},743:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertTextEdits=void 0,t.convertTextEdits=function(e,t){if(!t)return{};const n=[];return t.forEach((e=>{n.push({range:e.range,newText:e.replacementText})})),{changes:{[e]:n}}}},3550:(e,t)=>{var n,i;function s(e,t){return e.line<t.line?-1:e.line>t.line?1:e.character<t.character?-1:e.character>t.character?1:0}function r(e,t){return 0===s(e,t)}function a(e){return 0===e.character&&0===e.line}function o(e,t){t&&(Array.isArray(t)?t.forEach((t=>{o(e,t)})):(s(t.start,e.start)<0&&(e.start=t.start),s(t.end,e.end)>0&&(e.end=t.end)))}Object.defineProperty(t,"__esModule",{value:!0}),t.combineRange=t.extendRange=t.isEmptyRange=t.isEmptyPosition=t.getEmptyRange=t.rangesAreEqual=t.positionsAreEqual=t.doesRangeContain=t.doRangesIntersect=t.doRangesOverlap=t.getEmptyPosition=t.comparePositions=t.Range=t.Position=t.TextRange=void 0,function(e){function t(e,t){if(e<0)throw new Error("start must be non-negative");if(t<0)throw new Error("length must be non-negative");return{start:e,length:t}}function n(e){return e.start+e.length}function i(e,t){return t>=e.start&&t<=n(e)}function s(e,t){t&&(Array.isArray(t)?t.forEach((t=>{s(e,t)})):(t.start<e.start&&(e.length+=e.start-t.start,e.start=t.start),n(t)>n(e)&&(e.length+=n(t)-n(e))))}e.create=t,e.fromBounds=function(e,n){if(e<0)throw new Error("start must be non-negative");if(e>n)throw new Error("end must be greater than or equal to start");return t(e,n-e)},e.getEnd=n,e.contains=function(e,t){return t>=e.start&&t<n(e)},e.containsRange=function(e,t){return t.start>=e.start&&n(t)<=n(e)},e.overlaps=i,e.overlapsRange=function(e,t){return i(e,t.start)||i(t,e.start)},e.extend=s,e.combine=function(e){if(0===e.length)return;const t=e[0];for(let n=1;n<e.length;n++)s(t,e[n]);return t}}(t.TextRange||(t.TextRange={})),function(e){e.is=function(e){const t=e;return t&&void 0!==t.line&&void 0!==t.character},e.print=function(e){return`(${e.line}:${e.character})`}}(n=t.Position||(t.Position={})),(i=t.Range||(t.Range={})).is=function(e){const t=e;return t&&void 0!==t.start&&void 0!==t.end},i.print=function(e){return`${n.print(e.start)}-${n.print(e.end)}`},t.comparePositions=s,t.getEmptyPosition=function(){return{line:0,character:0}},t.doRangesOverlap=function(e,t){return!(s(t.start,e.end)>=0||s(e.start,t.end)>=0)},t.doRangesIntersect=function(e,t){return!(s(t.start,e.end)>0||s(e.start,t.end)>0)},t.doesRangeContain=function e(t,i){return n.is(i)?s(t.start,i)<=0&&s(t.end,i)>=0:e(t,i.start)&&e(t,i.end)},t.positionsAreEqual=r,t.rangesAreEqual=function(e,t){return r(e.start,t.start)&&r(e.end,t.end)},t.getEmptyRange=function(){return{start:{line:0,character:0},end:{line:0,character:0}}},t.isEmptyPosition=a,t.isEmptyRange=function(e){return a(e.start)&&a(e.end)},t.extendRange=o,t.combineRange=function(e){if(0===e.length)return;const t=e[0];for(let n=1;n<e.length;n++)o(t,e[n]);return t}},3420:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeCollection=void 0;const i=n(3550);t.TextRangeCollection=class{constructor(e){this._items=e}get start(){return this._items.length>0?this._items[0].start:0}get end(){const e=this._items[this._items.length-1];return this._items.length>0?e.start+e.length:0}get length(){return this.end-this.start}get count(){return this._items.length}contains(e){return e>=this.start&&e<this.end}getItemAt(e){if(e<0||e>=this._items.length)throw new Error("index is out of range");return this._items[e]}getItemAtPosition(e){if(0===this.count)return-1;if(e<this.start)return-1;if(e>this.end)return-1;let t=0,n=this.count-1;for(;t<n;){const i=Math.floor(t+(n-t)/2),s=this._items[i];if(e>=s.start&&(i>=this.count-1||e<this._items[i+1].start))return i;e<s.start?n=i-1:t=i+1}return t}getItemContaining(e){if(0===this.count)return-1;if(e<this.start)return-1;if(e>this.end)return-1;let t=0,n=this.count-1;for(;t<=n;){const s=Math.floor(t+(n-t)/2),r=this._items[s];if(i.TextRange.contains(r,e))return s;if(s<this.count-1&&i.TextRange.getEnd(r)<=e&&e<this._items[s+1].start)return-1;e<r.start?n=s-1:t=s+1}return-1}}},8718:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.timingStats=t.TimingStats=t.TimingStat=t.Duration=void 0;class n{constructor(){this._startTime=Date.now()}getDurationInMilliseconds(){return Date.now()-this._startTime}getDurationInSeconds(){return this.getDurationInMilliseconds()/1e3}}t.Duration=n;class i{constructor(){this.totalTime=0,this.callCount=0,this.isTiming=!1}timeOperation(e){if(this.callCount++,this.isTiming)return e();{this.isTiming=!0;const t=new n,i=e();return this.totalTime+=t.getDurationInMilliseconds(),this.isTiming=!1,i}}subtractFromTime(e){if(this.isTiming){this.isTiming=!1;const t=new n;e(),this.totalTime-=t.getDurationInMilliseconds(),this.isTiming=!0}else e()}printTime(){const e=this.totalTime/1e3;return(Math.round(100*e)/100).toString()+"sec"}}t.TimingStat=i;class s{constructor(){this.totalDuration=new n,this.findFilesTime=new i,this.readFileTime=new i,this.tokenizeFileTime=new i,this.parseFileTime=new i,this.resolveImportsTime=new i,this.cycleDetectionTime=new i,this.bindTime=new i,this.typeCheckerTime=new i,this.typeEvaluationTime=new i}printSummary(e){e.info(`Completed in ${this.totalDuration.getDurationInSeconds()}sec`)}printDetails(e){e.info(""),e.info("Timing stats"),e.info("Find Source Files:    "+this.findFilesTime.printTime()),e.info("Read Source Files:    "+this.readFileTime.printTime()),e.info("Tokenize:             "+this.tokenizeFileTime.printTime()),e.info("Parse:                "+this.parseFileTime.printTime()),e.info("Resolve Imports:      "+this.resolveImportsTime.printTime()),e.info("Bind:                 "+this.bindTime.printTime()),e.info("Check:                "+this.typeCheckerTime.printTime()),e.info("Detect Cycles:        "+this.cycleDetectionTime.printTime())}getTotalDuration(){return this.totalDuration.getDurationInSeconds()}}t.TimingStats=s,t.timingStats=new s},2185:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UriParser=void 0;const i=n(6657);t.UriParser=class{constructor(e){this._fs=e}decodeTextDocumentPosition(e,t){return{filePath:(0,i.convertUriToPath)(this._fs,e.uri),position:t}}decodeTextDocumentUri(e){return(0,i.convertUriToPath)(this._fs,e)}}},8798:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertWorkspaceDocumentEdits=t.convertWorkspaceEdits=void 0;const i=n(4494),s=n(6657),r=n(9489);t.convertWorkspaceEdits=function(e,t){const n={changes:{}};return t.forEach((t=>{const i=(0,s.convertPathToUri)(e,t.filePath);n.changes[i]=n.changes[i]||[],n.changes[i].push({range:t.range,newText:t.replacementText})})),n},t.convertWorkspaceDocumentEdits=function(e,t,n,a="default"){const o={documentChanges:[],changeAnnotations:n},l=(0,r.createMapFromItems)(t,(e=>e.filePath));for(const[t,n]of l)o.documentChanges.push(i.TextDocumentEdit.create({uri:(0,s.convertPathToUri)(e,t),version:null},[...n.map((e=>({range:e.range,newText:e.replacementText,annotationId:a})))]));return o}},8992:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageServerBase=void 0,n(6755);const i=n(4494),s=n(7256),r=n(5674),a=n(6708),o=n(2921),l=n(3213),c=n(9489),p=n(1775),d=n(2930),u=n(2211),m=n(8304),h=n(6657),y=n(2150),g=n(8798),f=n(31),T=n(3778),_=n(2816),v=n(3334),b=n(2122),I=(0,s.attachWorkDone)(void 0,void 0);t.LanguageServerBase=class{constructor(e,t,n){var s,r;this._serverOptions=e,this._connection=t,this.console=n,this._lastTriggerKind=i.CompletionTriggerKind.Invoked,this.rootPath="",this.client={hasConfigurationCapability:!1,hasVisualStudioExtensionsCapability:!1,hasWorkspaceFoldersCapability:!1,hasWatchFileCapability:!1,hasActiveParameterCapability:!1,hasSignatureLabelOffsetCapability:!1,hasHierarchicalDocumentSymbolCapability:!1,hasWindowProgressCapability:!1,hasGoToDeclarationCapability:!1,hasDocumentChangeCapability:!1,hasDocumentAnnotationCapability:!1,hoverContentFormat:i.MarkupKind.PlainText,completionDocFormat:i.MarkupKind.PlainText,completionSupportsSnippet:!1,signatureDocFormat:i.MarkupKind.PlainText,supportsDeprecatedDiagnosticTag:!1,supportsUnnecessaryDiagnosticTag:!1,completionItemResolveSupportsAdditionalTextEdits:!1},global.__rootDirectory=e.rootDirectory,this.console.info(`${e.productName} language server ${e.version&&e.version+" "}starting`),this.console.info(`Server root directory: ${e.rootDirectory}`),this._workspaceMap=this._serverOptions.workspaceMap,this._fileWatcherProvider=this._serverOptions.fileWatcherProvider,this.fs=this._serverOptions.fileSystem,this._uriParser=this._serverOptions.uriParser;const a=this.fs.getModulePath();a&&this.fs.chdir(a),this.setupConnection(null!==(s=e.supportedCommands)&&void 0!==s?s:[],null!==(r=e.supportedCodeActions)&&void 0!==r?r:[]),this._progressReporter=new y.ProgressReportTracker(this.createProgressReporter()),this._connection.listen()}decodeTextDocumentUri(e){return this._uriParser.decodeTextDocumentUri(e)}async getConfiguration(e,t){if(this.client.hasConfigurationCapability){const n={};return void 0!==e&&(n.scopeUri=e),void 0!==t&&(n.section=t),this._connection.workspace.getConfiguration(n)}if(this._defaultClientConfig)return(0,c.getNestedProperty)(this._defaultClientConfig,t)}isOpenFilesOnly(e){return"workspace"!==e}getSeverityOverrides(e){const t=e;if((0,p.getDiagnosticSeverityOverrides)().includes(t))return t}getDiagnosticRuleName(e){const t=e;if((0,d.getDiagLevelDiagnosticRules)().includes(t))return t}createBackgroundAnalysisProgram(e,t,n,i,s,a){return new r.BackgroundAnalysisProgram(e,t,n,i,s,a)}setExtension(e){this._serverOptions.extension=e}get window(){return this._connection.window}get supportAdvancedEdits(){return this.client.hasDocumentChangeCapability&&this.client.hasDocumentAnnotationCapability}createAnalyzerService(e){this.console.log(`Starting service instance "${e}"`);const t=new a.AnalyzerService(e,this.fs,this.console,this.createHost.bind(this),this.createImportResolver.bind(this),void 0,this._serverOptions.extension,this.createBackgroundAnalysis(),this._serverOptions.maxAnalysisTimeInForeground,this.createBackgroundAnalysisProgram.bind(this),this._serverOptions.cancellationProvider);return t.setCompletionCallback((e=>this.onAnalysisCompletedHandler(e))),t}async getWorkspaceForFile(e){const t=this._workspaceMap.getWorkspaceForFile(this,e);return await t.isInitialized.promise,t}reanalyze(){this._workspaceMap.forEach((e=>{e.serviceInstance.invalidateAndForceReanalysis()}))}restart(){this._workspaceMap.forEach((e=>{e.serviceInstance.restart()}))}setupConnection(e,t){this._connection.onInitialize((n=>this.initialize(n,e,t))),this._connection.onInitialized((()=>this.onInitialized())),this._connection.onDidChangeConfiguration((e=>this.onDidChangeConfiguration(e))),this._connection.onCodeAction(((e,t)=>this.executeCodeAction(e,t))),this._connection.onDefinition((async(e,t)=>this.onDefinition(e,t))),this._connection.onDeclaration((async(e,t)=>this.onDeclaration(e,t))),this._connection.onTypeDefinition((async(e,t)=>this.onTypeDefinition(e,t))),this._connection.onReferences((async(e,t,n,i)=>this.onReferences(e,t,n,i))),this._connection.onDocumentSymbol((async(e,t)=>this.onDocumentSymbol(e,t))),this._connection.onWorkspaceSymbol((async(e,t,n,i)=>this.onWorkspaceSymbol(e,t,i))),this._connection.onHover((async(e,t)=>this.onHover(e,t))),this._connection.onDocumentHighlight((async(e,t)=>this.onDocumentHighlight(e,t))),this._connection.onSignatureHelp((async(e,t)=>this.onSignatureHelp(e,t))),this._connection.onCompletion(((e,t)=>this.onCompletion(e,t))),this._connection.onCompletionResolve((async(e,t)=>this.onCompletionResolve(e,t))),this._connection.onRenameRequest((async(e,t)=>this.onRenameRequest(e,t)));const n=this._connection.languages.callHierarchy;n.onPrepare((async(e,t)=>this.onPrepare(e,t))),n.onIncomingCalls((async(e,t)=>this.onIncomingCalls(e,t))),n.onOutgoingCalls((async(e,t)=>this.onOutgoingCalls(e,t))),this._connection.onDidOpenTextDocument((async e=>this.onDidOpenTextDocument(e))),this._connection.onDidChangeTextDocument((async e=>this.onDidChangeTextDocument(e))),this._connection.onDidCloseTextDocument((async e=>this.onDidCloseTextDocument(e))),this._connection.onDidChangeWatchedFiles((e=>this.onDidChangeWatchedFiles(e))),this._connection.onExecuteCommand((async(e,t,n)=>this.onExecuteCommand(e,t,n)))}initialize(e,t,n){var s,r,a,o,l,c,p,d,u,m,h,y,g,f,T,_,v,I,C,S,F,D,P,x,A,k,E,w,N,R,M,O,L,V,U,z,B,W;e.locale&&(0,b.setLocaleOverride)(e.locale),this.rootPath=e.rootPath||"";const j=e.capabilities;this.client.hasConfigurationCapability=!!(null===(s=j.workspace)||void 0===s?void 0:s.configuration),this.client.hasWatchFileCapability=!!(null===(a=null===(r=j.workspace)||void 0===r?void 0:r.didChangeWatchedFiles)||void 0===a?void 0:a.dynamicRegistration),this.client.hasWorkspaceFoldersCapability=!!(null===(o=j.workspace)||void 0===o?void 0:o.workspaceFolders),this.client.hasVisualStudioExtensionsCapability=!!j.supportsVisualStudioExtensions,this.client.hasActiveParameterCapability=!!(null===(p=null===(c=null===(l=j.textDocument)||void 0===l?void 0:l.signatureHelp)||void 0===c?void 0:c.signatureInformation)||void 0===p?void 0:p.activeParameterSupport),this.client.hasSignatureLabelOffsetCapability=!!(null===(h=null===(m=null===(u=null===(d=j.textDocument)||void 0===d?void 0:d.signatureHelp)||void 0===u?void 0:u.signatureInformation)||void 0===m?void 0:m.parameterInformation)||void 0===h?void 0:h.labelOffsetSupport),this.client.hasHierarchicalDocumentSymbolCapability=!!(null===(g=null===(y=j.textDocument)||void 0===y?void 0:y.documentSymbol)||void 0===g?void 0:g.hierarchicalDocumentSymbolSupport),this.client.hasDocumentChangeCapability=!!(null===(T=null===(f=j.workspace)||void 0===f?void 0:f.workspaceEdit)||void 0===T?void 0:T.documentChanges)&&!!(null===(_=j.workspace.workspaceEdit)||void 0===_?void 0:_.resourceOperations),this.client.hasDocumentAnnotationCapability=!!(null===(I=null===(v=j.workspace)||void 0===v?void 0:v.workspaceEdit)||void 0===I?void 0:I.changeAnnotationSupport),this.client.hoverContentFormat=this._getCompatibleMarkupKind(null===(S=null===(C=j.textDocument)||void 0===C?void 0:C.hover)||void 0===S?void 0:S.contentFormat),this.client.completionDocFormat=this._getCompatibleMarkupKind(null===(P=null===(D=null===(F=j.textDocument)||void 0===F?void 0:F.completion)||void 0===D?void 0:D.completionItem)||void 0===P?void 0:P.documentationFormat),this.client.completionSupportsSnippet=!!(null===(k=null===(A=null===(x=j.textDocument)||void 0===x?void 0:x.completion)||void 0===A?void 0:A.completionItem)||void 0===k?void 0:k.snippetSupport),this.client.signatureDocFormat=this._getCompatibleMarkupKind(null===(N=null===(w=null===(E=j.textDocument)||void 0===E?void 0:E.signatureHelp)||void 0===w?void 0:w.signatureInformation)||void 0===N?void 0:N.documentationFormat);const $=(null===(O=null===(M=null===(R=j.textDocument)||void 0===R?void 0:R.publishDiagnostics)||void 0===M?void 0:M.tagSupport)||void 0===O?void 0:O.valueSet)||[];return this.client.supportsUnnecessaryDiagnosticTag=$.some((e=>e===i.DiagnosticTag.Unnecessary)),this.client.supportsDeprecatedDiagnosticTag=$.some((e=>e===i.DiagnosticTag.Deprecated)),this.client.hasWindowProgressCapability=!!(null===(L=j.window)||void 0===L?void 0:L.workDoneProgress),this.client.hasGoToDeclarationCapability=!!(null===(V=j.textDocument)||void 0===V?void 0:V.declaration),this.client.completionItemResolveSupportsAdditionalTextEdits=!!(null===(W=null===(B=null===(z=null===(U=j.textDocument)||void 0===U?void 0:U.completion)||void 0===z?void 0:z.completionItem)||void 0===B?void 0:B.resolveSupport)||void 0===W?void 0:W.properties.some((e=>"additionalTextEdits"===e))),e.workspaceFolders?e.workspaceFolders.forEach((e=>{const t=this._uriParser.decodeTextDocumentUri(e.uri);this._workspaceMap.set(t,this.createWorkspaceServiceInstance(e,t))})):e.rootPath&&this._workspaceMap.set(e.rootPath,this.createWorkspaceServiceInstance(void 0,e.rootPath)),{capabilities:{textDocumentSync:i.TextDocumentSyncKind.Incremental,definitionProvider:{workDoneProgress:!0},declarationProvider:{workDoneProgress:!0},typeDefinitionProvider:{workDoneProgress:!0},referencesProvider:{workDoneProgress:!0},documentSymbolProvider:{workDoneProgress:!0},workspaceSymbolProvider:{workDoneProgress:!0},hoverProvider:{workDoneProgress:!0},documentHighlightProvider:{workDoneProgress:!0},renameProvider:{workDoneProgress:!0},completionProvider:{triggerCharacters:this.client.hasVisualStudioExtensionsCapability?[".","[","@"]:[".","["],resolveProvider:!0,workDoneProgress:!0},signatureHelpProvider:{triggerCharacters:["(",",",")"],workDoneProgress:!0},codeActionProvider:{codeActionKinds:n,workDoneProgress:!0},executeCommandProvider:{commands:t,workDoneProgress:!0},callHierarchyProvider:!0}}}onInitialized(){this.client.hasWorkspaceFoldersCapability&&this._connection.workspace.onDidChangeWorkspaceFolders((e=>{e.removed.forEach((e=>{const t=this._uriParser.decodeTextDocumentUri(e.uri);this._workspaceMap.delete(t)})),e.added.forEach((async e=>{const t=this._uriParser.decodeTextDocumentUri(e.uri),n=this.createWorkspaceServiceInstance(e,t);this._workspaceMap.set(t,n),await this.updateSettingsForWorkspace(n)}))})),this.client.hasWatchFileCapability&&this._connection.client.register(i.DidChangeWatchedFilesNotification.type,{watchers:[...a.configFileNames.map((e=>({globPattern:`**/${e}`,kind:i.WatchKind.Create|i.WatchKind.Change|i.WatchKind.Delete}))),{globPattern:"**",kind:i.WatchKind.Create|i.WatchKind.Change|i.WatchKind.Delete}]})}onDidChangeConfiguration(e){this.console.log("Received updated settings"),(null==e?void 0:e.settings)&&(this._defaultClientConfig=null==e?void 0:e.settings),this.updateSettingsForAllWorkspaces()}async onDefinition(e,t){return this.getDefinitions(e,t,this.client.hasGoToDeclarationCapability?T.DefinitionFilter.PreferSource:T.DefinitionFilter.All,((e,t,n,i,s)=>e.serviceInstance.getDefinitionForPosition(t,n,i,s)))}async onDeclaration(e,t){return this.getDefinitions(e,t,this.client.hasGoToDeclarationCapability?T.DefinitionFilter.PreferStubs:T.DefinitionFilter.All,((e,t,n,i,s)=>e.serviceInstance.getDefinitionForPosition(t,n,i,s)))}async onTypeDefinition(e,t){return this.getDefinitions(e,t,T.DefinitionFilter.All,((e,t,n,i,s)=>e.serviceInstance.getTypeDefinitionForPosition(t,n,s)))}async getDefinitions(e,t,n,s){this.recordUserInteractionTime();const{filePath:r,position:a}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),o=await this.getWorkspaceForFile(r);if(o.disableLanguageServices)return;const l=s(o,r,a,n,t);return l?l.filter((e=>!this.fs.isInZipOrEgg(e.path))).map((e=>i.Location.create((0,h.convertPathToUri)(this.fs,e.path),e.range))):void 0}async onReferences(e,t,n,s){this._pendingFindAllRefsCancellationSource&&(this._pendingFindAllRefsCancellationSource.cancel(),this._pendingFindAllRefsCancellationSource=void 0);const r=await this._getProgressReporter(n,b.Localizer.CodeAction.findingReferences(),t),a=r.source;this._pendingFindAllRefsCancellationSource=a;try{const{filePath:t,position:n}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),o=await this.getWorkspaceForFile(t);if(o.disableLanguageServices)return;const l=e=>e.filter((e=>!this.fs.isInZipOrEgg(e.path))).map((e=>i.Location.create((0,h.convertPathToUri)(this.fs,e.path),e.range))),c=[],p=s?e=>s.report(l(e)):e=>c.push(...l(e));return o.serviceInstance.reportReferencesForPosition(t,n,e.context.includeDeclaration,p,a.token),c}finally{r.reporter.done(),a.dispose()}}async onDocumentSymbol(e,t){this.recordUserInteractionTime();const n=this._uriParser.decodeTextDocumentUri(e.textDocument.uri),i=await this.getWorkspaceForFile(n);if(i.disableLanguageServices)return;const s=[];return i.serviceInstance.addSymbolsForDocument(n,s,t),this.client.hasHierarchicalDocumentSymbolCapability?s:(0,_.convertToFlatSymbols)(e.textDocument.uri,s)}async onWorkspaceSymbol(e,t,n){const i=[],s=n?e=>n.report(e):e=>i.push(...e);for(const n of this._workspaceMap.values())await n.isInitialized.promise,n.disableLanguageServices||n.serviceInstance.reportSymbolsForWorkspace(e.query,s,t);return i}async onHover(e,t){const{filePath:n,position:i}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),s=(await this.getWorkspaceForFile(n)).serviceInstance.getHoverForPosition(n,i,this.client.hoverContentFormat,t);return(0,v.convertHoverResults)(this.client.hoverContentFormat,s)}async onDocumentHighlight(e,t){const{filePath:n,position:i}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position);return(await this.getWorkspaceForFile(n)).serviceInstance.getDocumentHighlight(n,i,t)}async onSignatureHelp(e,t){var n,s,r,a;const{filePath:o,position:l}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),c=await this.getWorkspaceForFile(o);if(c.disableLanguageServices)return;const p=c.serviceInstance.getSignatureHelpForPosition(o,l,this.client.signatureDocFormat,t);if(!p)return;const d=p.signatures.map((e=>{let t=[];e.parameters&&(t=e.parameters.map((e=>i.ParameterInformation.create(this.client.hasSignatureLabelOffsetCapability?[e.startOffset,e.endOffset]:e.text,e.documentation))));const n=i.SignatureInformation.create(e.label,void 0,...t);return void 0!==e.documentation&&(n.documentation=e.documentation),void 0!==e.activeParameter&&(n.activeParameter=e.activeParameter),n})),u=e=>{var t;return void 0!==e.activeParameter||!p.callHasParameters&&!(null===(t=e.parameters)||void 0===t?void 0:t.length)};let m=d.findIndex(u);-1===m&&(m=null);let h=null!==m?d[m].activeParameter:null;if((null===(n=e.context)||void 0===n?void 0:n.isRetrigger)&&e.context.triggerKind!==i.SignatureHelpTriggerKind.Invoked){const t=null!==(r=null===(s=e.context.activeSignatureHelp)||void 0===s?void 0:s.activeSignature)&&void 0!==r?r:null;if(null!==t&&t<d.length){const e=d[t];u(e)&&(m=t,h=null!==(a=e.activeParameter)&&void 0!==a?a:null)}}return(this.client.hasActiveParameterCapability||null===m)&&(h=Math.max(...d.map((e=>{var t,n;return null!==(n=null===(t=e.parameters)||void 0===t?void 0:t.length)&&void 0!==n?n:0})))),{signatures:d,activeSignature:m,activeParameter:h}}async onCompletion(e,t){var n,s;const r=this._lastTriggerKind!==i.CompletionTriggerKind.TriggerForIncompleteCompletions||(null===(n=e.context)||void 0===n?void 0:n.triggerKind)!==i.CompletionTriggerKind.TriggerForIncompleteCompletions;this._lastTriggerKind=null===(s=e.context)||void 0===s?void 0:s.triggerKind;const{filePath:a,position:o}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),l=await this.getWorkspaceForFile(a);if(l.disableLanguageServices)return;const c=await this.getWorkspaceCompletionsForPosition(l,a,o,l.rootPath,t);return c&&c.completionList&&(c.completionList.isIncomplete=r),null==c?void 0:c.completionList}async onCompletionResolve(e,t){const n=e.data;if(n&&n.filePath){const i=await this.getWorkspaceForFile(n.workspacePath);this.resolveWorkspaceCompletionItem(i,n.filePath,e,t)}return e}async onRenameRequest(e,t){const{filePath:n,position:i}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return;const r=s.serviceInstance.renameSymbolAtPosition(n,i,e.newName,""===s.rootPath,t);return r?(0,g.convertWorkspaceEdits)(this.fs,r):void 0}async onPrepare(e,t){const{filePath:n,position:i}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;const r=s.serviceInstance.getCallForPosition(n,i,t)||null;return r?this.fs.isInZipOrEgg(r.uri)?null:(r.uri=(0,h.convertPathToUri)(this.fs,r.uri),[r]):null}async onIncomingCalls(e,t){const{filePath:n,position:i}=this._uriParser.decodeTextDocumentPosition(e.item,e.item.range.start),s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;let r=s.serviceInstance.getIncomingCallsForPosition(n,i,t)||null;return r&&0!==r.length?(r=r.filter((e=>!this.fs.isInZipOrEgg(e.from.uri))),r.forEach((e=>{e.from.uri=(0,h.convertPathToUri)(this.fs,e.from.uri)})),r):null}async onOutgoingCalls(e,t){const{filePath:n,position:i}=this._uriParser.decodeTextDocumentPosition(e.item,e.item.range.start),s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return null;let r=s.serviceInstance.getOutgoingCallsForPosition(n,i,t)||null;return r&&0!==r.length?(r=r.filter((e=>!this.fs.isInZipOrEgg(e.to.uri))),r.forEach((e=>{e.to.uri=(0,h.convertPathToUri)(this.fs,e.to.uri)})),r):null}async onDidOpenTextDocument(e){const t=this._uriParser.decodeTextDocumentUri(e.textDocument.uri);this.fs.addUriMap(e.textDocument.uri,t)&&(await this.getWorkspaceForFile(t)).serviceInstance.setFileOpened(t,e.textDocument.version,e.textDocument.text)}async onDidChangeTextDocument(e){this.recordUserInteractionTime();const t=this._uriParser.decodeTextDocumentUri(e.textDocument.uri);this.fs.hasUriMapEntry(e.textDocument.uri,t)&&(await this.getWorkspaceForFile(t)).serviceInstance.updateOpenFileContents(t,e.textDocument.version,e.contentChanges)}async onDidCloseTextDocument(e){const t=this._uriParser.decodeTextDocumentUri(e.textDocument.uri);this.fs.removeUriMap(e.textDocument.uri,t)&&(await this.getWorkspaceForFile(t)).serviceInstance.setFileClosed(t)}onDidChangeWatchedFiles(e){e.changes.forEach((e=>{const t=this._uriParser.decodeTextDocumentUri(e.uri),n=1===e.type?"add":"change";this._fileWatcherProvider.onFileChange(n,t)}))}async onExecuteCommand(e,t,n){this._pendingCommandCancellationSource&&(this._pendingCommandCancellationSource.cancel(),this._pendingCommandCancellationSource=void 0);const s=async t=>{const n=await this.executeCommand(e,t);return i.WorkspaceEdit.is(n)&&this._connection.workspace.applyEdit({label:`Command '${e.command}'`,edit:n}),o.CommandResult.is(n)&&await this._connection.workspace.applyEdit({label:n.label,edit:n.edits}),n};if(!this.isLongRunningCommand(e.command))return await s(t);{const e=await this._getProgressReporter(n,b.Localizer.CodeAction.executingCommand(),t),i=e.source;this._pendingCommandCancellationSource=i;try{return await s(i.token)}finally{e.reporter.done(),i.dispose()}}}resolveWorkspaceCompletionItem(e,t,n,i){e.serviceInstance.resolveCompletionItem(t,n,this.getCompletionOptions(),void 0,i)}getWorkspaceCompletionsForPosition(e,t,n,i,s){return e.serviceInstance.getCompletionsForPosition(t,n,i,this.getCompletionOptions(),void 0,s)}updateSettingsForAllWorkspaces(){this._workspaceMap.forEach((e=>{this.updateSettingsForWorkspace(e).ignoreErrors()}))}getCompletionOptions(){return{format:this.client.completionDocFormat,snippet:this.client.completionSupportsSnippet,lazyEdit:this.client.completionItemResolveSupportsAdditionalTextEdits}}createWorkspaceServiceInstance(e,t){var n,i,s;return{workspaceName:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:"",rootPath:t,rootUri:null!==(i=null==e?void 0:e.uri)&&void 0!==i?i:"",serviceInstance:this.createAnalyzerService(null!==(s=null==e?void 0:e.name)&&void 0!==s?s:t),disableLanguageServices:!1,disableOrganizeImports:!1,isInitialized:(0,m.createDeferred)()}}onAnalysisCompletedHandler(e){if(e.diagnostics.forEach((e=>{this.fs.isInZipOrEgg(e.filePath)||(this._connection.sendDiagnostics({uri:(0,h.convertPathToUri)(this.fs,e.filePath),version:e.version,diagnostics:this._convertDiagnostics(e.diagnostics)}),this.fs.pendingRequest(e.filePath,e.diagnostics.length>0))})),this._progressReporter.isEnabled(e))if(e.filesRequiringAnalysis>0){this._progressReporter.begin();const t=1===e.filesRequiringAnalysis?b.Localizer.CodeAction.filesToAnalyzeOne():b.Localizer.CodeAction.filesToAnalyzeCount().format({count:e.filesRequiringAnalysis});this._progressReporter.report(t)}else this._progressReporter.end();else this._progressReporter.end()}async updateSettingsForWorkspace(e,t){var n;t=null!=t?t:await this.getSettings(e),this.console.level=null!==(n=t.logLevel)&&void 0!==n?n:u.LogLevel.Info,this.updateOptionsAndRestartService(e,t),e.disableLanguageServices=!!t.disableLanguageServices,e.disableOrganizeImports=!!t.disableOrganizeImports,e.isInitialized.resolve(!0)}updateOptionsAndRestartService(e,t,n){f.AnalyzerServiceExecutor.runWithOptions(this.rootPath,e,t,n)}convertLogLevel(e){if(!e)return u.LogLevel.Info;switch(e.toLowerCase()){case"error":return u.LogLevel.Error;case"warning":return u.LogLevel.Warn;default:return u.LogLevel.Info;case"trace":return u.LogLevel.Log}}_getCompatibleMarkupKind(e){const t=[i.MarkupKind.PlainText,i.MarkupKind.Markdown];for(const n of null!=e?e:[])if(t.includes(n))return n;return i.MarkupKind.PlainText}async _getProgressReporter(e,t,n){if(e.constructor!==I.constructor)return{reporter:e,source:(0,l.CancelAfter)(n)};const i=await this._connection.window.createWorkDoneProgress();return i.begin(t,void 0,void 0,!0),{reporter:i,source:(0,l.CancelAfter)(n,i.token)}}_convertDiagnostics(e){const t=[];return e.forEach((e=>{const n=function(e){switch(e){case 0:return i.DiagnosticSeverity.Error;case 1:return i.DiagnosticSeverity.Warning;case 2:return i.DiagnosticSeverity.Information;case 3:case 4:return i.DiagnosticSeverity.Hint}}(e.category),s=e.getRule(),r=i.Diagnostic.create(e.range,e.message,n,s,this._serverOptions.productName);if(3===e.category){if(r.tags=[i.DiagnosticTag.Unnecessary],r.severity=i.DiagnosticSeverity.Hint,!this.client.supportsUnnecessaryDiagnosticTag)return}else if(4===e.category&&(r.tags=[i.DiagnosticTag.Deprecated],r.severity=i.DiagnosticSeverity.Hint,!this.client.supportsDeprecatedDiagnosticTag))return;if(s){const e=this.getDocumentationUrlForDiagnosticRule(s);e&&(r.codeDescription={href:e})}const a=e.getRelatedInfo();a.length>0&&(r.relatedInformation=a.filter((e=>!this.fs.isInZipOrEgg(e.filePath))).map((e=>i.DiagnosticRelatedInformation.create(i.Location.create((0,h.convertPathToUri)(this.fs,e.filePath),e.range),e.message)))),t.push(r)})),t}recordUserInteractionTime(){this._workspaceMap.forEach((e=>{e.serviceInstance.recordUserInteractionTime()}))}getDocumentationUrlForDiagnosticRule(e){return"https://github.com/microsoft/pyright/blob/main/docs/configuration.md"}expandPathVariables(e,t){return t.replace(/\$\{(.*?)\}/g,((t,n)=>{const i=n.trim();return"workspaceFolder"===i?e:"env:HOME"===i&&void 0!==process.env.HOME?process.env.HOME:t}))}}},31:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerServiceExecutor=void 0;const i=n(1887),s=n(1775),r=n(8304),a=n(6657);class o{static runWithOptions(e,t,n,r,o=!0){const l=function(e,t,n,r,o){var l,c;const p=new s.CommandLineOptions(t,!0);return p.checkOnlyOpenFiles=n.openFilesOnly,p.useLibraryCodeForTypes=n.useLibraryCodeForTypes,p.typeCheckingMode=n.typeCheckingMode,p.autoImportCompletions=n.autoImportCompletions,p.indexing=n.indexing,p.logTypeEvaluationTime=null!==(l=n.logTypeEvaluationTime)&&void 0!==l&&l,p.typeEvaluationTimeThreshold=null!==(c=n.typeEvaluationTimeThreshold)&&void 0!==c?c:50,p.enableAmbientAnalysis=r,r?(p.watchForSourceChanges=n.watchForSourceChanges,p.watchForLibraryChanges=n.watchForLibraryChanges,p.watchForConfigChanges=n.watchForConfigChanges):(p.watchForSourceChanges=!1,p.watchForLibraryChanges=!1,p.watchForConfigChanges=!1),n.venvPath&&(p.venvPath=(0,a.combinePaths)(t||e,n.venvPath)),n.pythonPath&&((0,i.isPythonBinary)(n.pythonPath)||(p.pythonPath=(0,a.combinePaths)(t||e,n.pythonPath))),n.typeshedPath&&(p.typeshedPath=n.typeshedPath),n.stubPath&&(p.stubPath=n.stubPath),o&&(p.typeStubTargetImportName=o),p.autoSearchPaths=n.autoSearchPaths,p.extraPaths=n.extraPaths,p.diagnosticSeverityOverrides=n.diagnosticSeverityOverrides,p}(e,t.rootPath,n,o,r);t.serviceInstance.setOptions(l)}static async cloneService(e,t,n,i,s){const a={workspaceName:"temp workspace for cloned service",rootPath:t.rootPath,rootUri:t.rootUri,serviceInstance:t.serviceInstance.clone("cloned service",i,s),disableLanguageServices:!0,disableOrganizeImports:!0,isInitialized:(0,r.createDeferred)()},l=await e.getSettings(t);return o.runWithOptions(e.rootPath,a,l,n,!1),a.serviceInstance}}t.AnalyzerServiceExecutor=o},8566:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.convertSymbolKindToCompletionItemKind=t.AutoImporter=t.buildModuleSymbolsMap=void 0;const a=n(4494),o=n(7012),l=r(n(1766)),c=n(3213),p=n(6657),d=r(n(7559)),u=n(8718);function m(e,t){return{forEach(n){e.symbols.forEach((e=>{e.externallyVisible&&n({importAlias:e.alias,kind:e.kind,itemKind:e.itemKind},e.name,t)}))}}}function h(e){switch(e){case a.SymbolKind.File:return a.CompletionItemKind.File;case a.SymbolKind.Module:case a.SymbolKind.Namespace:return a.CompletionItemKind.Module;case a.SymbolKind.Package:return a.CompletionItemKind.Folder;case a.SymbolKind.Class:return a.CompletionItemKind.Class;case a.SymbolKind.Method:return a.CompletionItemKind.Method;case a.SymbolKind.Property:return a.CompletionItemKind.Property;case a.SymbolKind.Field:return a.CompletionItemKind.Field;case a.SymbolKind.Constructor:return a.CompletionItemKind.Constructor;case a.SymbolKind.Enum:return a.CompletionItemKind.Enum;case a.SymbolKind.Interface:return a.CompletionItemKind.Interface;case a.SymbolKind.Function:return a.CompletionItemKind.Function;case a.SymbolKind.Variable:case a.SymbolKind.Array:return a.CompletionItemKind.Variable;case a.SymbolKind.String:return a.CompletionItemKind.Constant;case a.SymbolKind.Number:case a.SymbolKind.Boolean:return a.CompletionItemKind.Value;case a.SymbolKind.Constant:case a.SymbolKind.Null:return a.CompletionItemKind.Constant;case a.SymbolKind.Object:case a.SymbolKind.Key:return a.CompletionItemKind.Value;case a.SymbolKind.EnumMember:return a.CompletionItemKind.EnumMember;case a.SymbolKind.Struct:return a.CompletionItemKind.Struct;case a.SymbolKind.Event:return a.CompletionItemKind.Event;case a.SymbolKind.Operator:return a.CompletionItemKind.Operator;case a.SymbolKind.TypeParameter:return a.CompletionItemKind.TypeParameter;default:return}}t.buildModuleSymbolsMap=function(e,t,n){const i=new Map;return(0,c.throwIfCancellationRequested)(n),e.forEach((e=>{if(e.shadows.length>0)return;const n=e.sourceFile.getFilePath(),s=e.sourceFile.getModuleSymbolTable();if(s){const e=(0,p.stripFileExtension)((0,p.getFileName)(n));if(l.isPrivateOrProtectedName(e))return;return void i.set(n,{forEach(e){s.forEach(((t,n)=>{if(t.isExternallyHidden())return;const i=t.getDeclarations();if(!i||0===i.length)return;const s=i[0];if(!s)return;if(6===s.type)return;const r=1!==s.type||s.isConstant||s.isFinal?void 0:a.SymbolKind.Variable;e({symbol:t,kind:r},n,!1)}))}})}const r=e.sourceFile.getCachedIndexResults();r&&t&&!r.privateOrProtected&&i.set(n,m(r,!1))})),i},t.AutoImporter=class{constructor(e,t,n,i,s,r,a){this._execEnvironment=e,this._importResolver=t,this._parseResults=n,this._invocationPosition=i,this._excludes=s,this._moduleSymbolMap=r,this._options=a,this._stopWatch=new u.Duration,this._perfInfo={indexUsed:!1,totalInMs:0,moduleTimeInMS:0,indexTimeInMS:0,importAliasTimeInMS:0,symbolCount:0,indexCount:0,importAliasCount:0},this._importStatements=(0,o.getTopLevelImports)(this._parseResults.parseTree,!0),this._perfInfo.indexUsed=!!this._options.libraryMap}getAutoImportCandidatesForAbbr(e,t,n){const i=this._getCandidates(t.importName,1,e,n).get(t.importName);return i?i.filter((e=>e.source===t.importFrom)):[]}getAutoImportCandidates(e,t,n,i){const s=[];return this._getCandidates(e,t,n,i).forEach((e=>s.push(...e))),s}getPerfInfo(){return this._perfInfo.totalInMs=this._stopWatch.getDurationInMilliseconds(),this._perfInfo}_getCandidates(e,t,n,i){const s=new Map,r=new Map;return this._addImportsFromModuleMap(e,t,n,r,s,i),this._addImportsFromLibraryMap(e,t,n,r,s,i),this._addImportsFromImportAliasMap(r,n,s,i),s}_addImportsFromLibraryMap(e,t,n,i,s,r){var a;const o=this._stopWatch.getDurationInMilliseconds();null===(a=this._options.libraryMap)||void 0===a||a.forEach(((a,o)=>{if(a.privateOrProtected)return;if(this._moduleSymbolMap.has(o))return;const l=this._isStubFileOrHasInit(this._options.libraryMap,o);this._processModuleSymbolTable(m(a,!0),o,e,t,l,n,i,s,r)})),this._perfInfo.indexTimeInMS=this._stopWatch.getDurationInMilliseconds()-o}_addImportsFromModuleMap(e,t,n,i,s,r){const a=this._stopWatch.getDurationInMilliseconds();this._moduleSymbolMap.forEach(((a,o)=>{const l=this._isStubFileOrHasInit(this._moduleSymbolMap,o);this._processModuleSymbolTable(a,o,e,t,l,n,i,s,r)})),this._perfInfo.moduleTimeInMS=this._stopWatch.getDurationInMilliseconds()-a}_isStubFileOrHasInit(e,t){const n=(0,p.getDirectoryPath)(t),i=(0,p.combinePaths)(n,"__init__.py"),s=i+"i";return{isStub:t.endsWith(".pyi"),hasInit:e.has(i)||e.has(s)}}_processModuleSymbolTable(e,t,n,i,s,r,o,l,p){(0,c.throwIfCancellationRequested)(p);const[u,m,y]=this._getImportPartsForSymbols(t);if(!u)return;const g=d.getCharacterCount(u,".");if(e.forEach(((e,a,c)=>{var p;if(this._perfIndexCount(e,c),!this._shouldIncludeVariable(e,a,s.isStub,c))return;if(!this._isSimilar(n,a,i))return;if(this._containsName(a,u,l))return;if(e.importAlias)return void this._addToImportAliasMap(e.importAlias,{importParts:{symbolName:a,importName:a,importFrom:u,filePath:t,dotCount:g,moduleNameAndType:y},importGroup:m,symbol:e.symbol,kind:e.importAlias.kind,itemKind:e.importAlias.itemKind},o);const d=this._getTextEditsForAutoImportByFilePath(u,a,r,a,m,t);this._addResult(l,{name:a,alias:r,symbol:e.symbol,source:u,kind:null!==(p=e.itemKind)&&void 0!==p?p:h(e.kind),insertionText:d.insertionText,edits:d.edits})})),!s.isStub&&!s.hasInit)return;const f=this._getImportParts(t);f&&this._isSimilar(n,f.importName,i)&&(this._containsName(f.importName,f.importFrom,l)||this._addToImportAliasMap({modulePath:t,originalName:f.importName,kind:a.SymbolKind.Module,itemKind:a.CompletionItemKind.Module},{importParts:f,importGroup:m,kind:a.SymbolKind.Module,itemKind:a.CompletionItemKind.Module},o))}_shouldIncludeVariable(e,t,n,i){var s;return!(!n&&e.kind===a.SymbolKind.Variable)||!(!this._options.allowVariableInAll||i||!(null===(s=e.symbol)||void 0===s?void 0:s.isInDunderAll()))||l.isPublicConstantOrTypeAlias(t)}_addImportsFromImportAliasMap(e,t,n,i){(0,c.throwIfCancellationRequested)(i);const s=this._stopWatch.getDurationInMilliseconds();e.forEach((e=>{this._perfInfo.importAliasCount+=e.size,e.forEach((e=>{var i,s;if(t){if(this._importStatements.mapByFilePath.has(e.importParts.filePath))return;if(e.importParts.importFrom){const t=this._importStatements.orderedImports.find((t=>t.moduleName===e.importParts.importFrom));if(t&&22===t.node.nodeType&&t.node.imports.some((t=>t.name.value===e.importParts.symbolName)))return}}if(this._containsName(e.importParts.importName,e.importParts.importFrom,n))return;const r=this._getTextEditsForAutoImportByFilePath(null!==(i=e.importParts.importFrom)&&void 0!==i?i:e.importParts.importName,e.importParts.symbolName,t,e.importParts.importName,e.importGroup,e.importParts.filePath);this._addResult(n,{name:e.importParts.importName,alias:t,symbol:e.symbol,kind:null!==(s=e.itemKind)&&void 0!==s?s:h(e.kind),source:e.importParts.importFrom,insertionText:r.insertionText,edits:r.edits})}))})),this._perfInfo.importAliasTimeInMS=this._stopWatch.getDurationInMilliseconds()-s}_addToImportAliasMap(e,t,n){if(!n.has(e.modulePath)){const i=new Map;return i.set(e.originalName,t),void n.set(e.modulePath,i)}const i=n.get(e.modulePath);if(!i.has(e.originalName))return void i.set(e.originalName,t);const s=i.get(e.originalName);this._compareImportAliasData(s,t)<=0||i.set(e.originalName,t)}_compareImportAliasData(e,t){const n=e.importGroup-t.importGroup;if(0!==n)return n;const i=e.importParts.dotCount-t.importParts.dotCount;return 0!==i?i:e.symbol&&!t.symbol?-1:!e.symbol&&t.symbol?1:d.getStringComparer()(e.importParts.importName,t.importParts.importName)}_getImportPartsForSymbols(e){const t=this._importStatements.mapByFilePath.get(e);if(t)return[t.moduleName,(0,o.getImportGroup)(t),{importType:2,isLocalTypingsFile:!1,moduleName:t.moduleName}];{const t=this._getModuleNameAndTypeFromFilePath(e);return[t.moduleName,(0,o.getImportGroupFromModuleNameAndType)(t),t]}}_getImportParts(e){return function(t){const n=t.moduleName;if(!n)return;const i=n.lastIndexOf("."),s=i>0?n.substring(i+1):void 0,r=i>0?n.substring(0,i):void 0;return{symbolName:s,importName:null!=s?s:n,importFrom:r,filePath:e,dotCount:d.getCharacterCount(n,"."),moduleNameAndType:t}}("__init__"===(0,p.stripFileExtension)((0,p.getFileName)(e))?this._getModuleNameAndTypeFromFilePath((0,p.getDirectoryPath)(e)):this._getModuleNameAndTypeFromFilePath(e))}_isSimilar(e,t,n){if(1===n)return e===t;if(e.length<=0||t.length<=0)return!1;if(!this._options.patternMatcher){const n="_"!==e[0]&&"_"===t[0]&&t.length>1?1:0;return e[0].toLocaleLowerCase()===t[n].toLocaleLowerCase()&&d.isPatternInSymbol(e,t)}return this._options.patternMatcher(e,t)}_containsName(e,t,n){if(this._excludes.has(e))return!0;const i=n.get(e);return!!(null==i?void 0:i.some((e=>e.source===t)))}_getModuleNameAndTypeFromFilePath(e){return this._importResolver.getModuleNameForImport(e,this._execEnvironment)}_getTextEditsForAutoImportByFilePath(e,t,n,i,s,r){var a,l,c,p,d,u;const m=this._importStatements.mapByFilePath.get(r);if(m){if(20===m.node.nodeType){const e=null===(l=null===(a=m.subnode)||void 0===a?void 0:a.alias)||void 0===l?void 0:l.value;if(t)return{insertionText:`${null!=e?e:m.moduleName}.${t}`,edits:[]};if(e)return{insertionText:`${e}`,edits:[]}}if(t&&22===m.node.nodeType&&!m.node.isWildcardImport){const s=m.node.imports.find((e=>e.name.value===t));if(s){const e=null===(c=s.alias)||void 0===c?void 0:c.value;return{insertionText:`${null!=e?e:t}`,edits:[]}}if(e===m.moduleName)return{insertionText:null!=n?n:i,edits:this._options.lazyEdit?void 0:(0,o.getTextEditsForAutoImportSymbolAddition)({name:t,alias:n},m,this._parseResults)}}}else if(t){const s=this._importStatements.orderedImports.find((t=>t.moduleName===e));if(s&&22===s.node.nodeType&&!s.node.isWildcardImport){const e=s.node.imports.find((e=>e.name.value===t));if(!e)return{insertionText:null!=n?n:i,edits:this._options.lazyEdit?void 0:(0,o.getTextEditsForAutoImportSymbolAddition)({name:t,alias:n},s,this._parseResults)};{const t=null===(p=e.alias)||void 0===p?void 0:p.value;if(t)return{insertionText:`${t}`,edits:[]}}}const a=null===(d=this._importStatements.implicitImports)||void 0===d?void 0:d.get(r);if(a){const e=null===(u=a.alias)||void 0===u?void 0:u.value;return{insertionText:`${null!=e?e:a.name.value}.${t}`,edits:[]}}}return{insertionText:null!=n?n:i,edits:this._options.lazyEdit?void 0:(0,o.getTextEditsForAutoImportInsertion)({name:t,alias:n},this._importStatements,e,s,this._parseResults,this._invocationPosition)}}_perfIndexCount(e,t){e.symbol?this._perfInfo.symbolCount++:t&&this._perfInfo.indexCount++}_addResult(e,t){let n=e.get(t.name);n||(n=[],e.set(t.name,n)),n.push(t)}},t.convertSymbolKindToCompletionItemKind=h},7087:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CallHierarchyProvider=void 0;const a=n(4494),o=r(n(5523)),l=r(n(8494)),c=n(427),p=n(1133),d=n(5168),u=n(3213),m=n(6657),h=n(1464),y=n(3550);t.CallHierarchyProvider=class{static getCallForDeclaration(e,t,n,i){if((0,u.throwIfCancellationRequested)(i),3===t.type||4===t.type)return{name:e,kind:T(t,n),uri:t.path,range:t.range,selectionRange:t.range}}static getIncomingCallsForDeclaration(e,t,n,i,s,r){(0,u.throwIfCancellationRequested)(r);const a=new f(e,t,n,i,s,r).findCalls();return a.length>0?a:void 0}static getOutgoingCallsForDeclaration(e,t,n,i){let s;if((0,u.throwIfCancellationRequested)(i),3===e.type)s=e.node;else if(4===e.type){const t=n.getTypeForDeclaration(e);if(t&&(0,p.isInstantiableClass)(t)){const e=(0,d.lookUpClassMember)(t,"__init__",14);if(e){const t=n.getTypeOfMember(e);if(t&&(0,p.isFunction)(t)){const t=e.symbol.getDeclarations();if(t&&t.length>0){const e=t[0];3===e.type&&(s=e.node)}}}}}if(!s)return;const r=new g(s,t,n,i).findCalls();return r.length>0?r:void 0}static getTargetDeclaration(e,t){let n=e[0];for(const i of e)if((o.hasTypeForDeclaration(i)||!o.hasTypeForDeclaration(n))&&(3===i.type||4===i.type)&&(n=i,i.node===t))break;return n}};class g extends c.ParseTreeWalker{constructor(e,t,n,i){super(),this._parseRoot=e,this._parseResults=t,this._evaluator=n,this._cancellationToken=i,this._outgoingCalls=[]}findCalls(){return this.walk(this._parseRoot),this._outgoingCalls}visitCall(e){let t;if((0,u.throwIfCancellationRequested)(this._cancellationToken),38===e.leftExpression.nodeType?t=e.leftExpression:35===e.leftExpression.nodeType&&(t=e.leftExpression.memberName),t){const e=this._evaluator.getDeclarationsForNameNode(t);e&&e.forEach((e=>{this._addOutgoingCallForDeclaration(t,e)}))}return!0}visitMemberAccess(e){(0,u.throwIfCancellationRequested)(this._cancellationToken);const t=this._evaluator.getType(e.leftExpression);return t&&(0,d.doForEachSubtype)(t,(t=>{let n=t;if(n=this._evaluator.makeTopLevelTypeVarsConcrete(n),!(0,p.isClassInstance)(n))return;const i=(0,d.lookUpObjectMember)(n,e.memberName.value);if(!i)return;const s=this._evaluator.getTypeOfMember(i),r=i.symbol.getDeclarations();s&&(0,p.isClassInstance)(s)&&p.ClassType.isPropertyClass(s)&&r.forEach((t=>{this._addOutgoingCallForDeclaration(e.memberName,t)}))})),!0}_addOutgoingCallForDeclaration(e,t){const n=this._evaluator.resolveAliasDeclaration(t,!0);if(!n)return;if(3!==n.type&&4!==n.type)return;const i={name:e.value,kind:T(n,this._evaluator),uri:n.path,range:n.range,selectionRange:n.range};let s=this._outgoingCalls.find((e=>e.to.uri===i.uri&&(0,y.rangesAreEqual)(e.to.range,i.range)));s||(s={to:i,fromRanges:[]},this._outgoingCalls.push(s));const r=(0,h.convertOffsetsToRange)(e.start,e.start+e.length,this._parseResults.tokenizerOutput.lines);s.fromRanges.push(r)}}class f extends c.ParseTreeWalker{constructor(e,t,n,i,s,r){super(),this._filePath=e,this._symbolName=t,this._declaration=n,this._parseResults=i,this._evaluator=s,this._cancellationToken=r,this._incomingCalls=[]}findCalls(){return this.walk(this._parseResults.parseTree),this._incomingCalls}visitCall(e){let t;if((0,u.throwIfCancellationRequested)(this._cancellationToken),38===e.leftExpression.nodeType?t=e.leftExpression:35===e.leftExpression.nodeType&&(t=e.leftExpression.memberName),t&&t.value===this._symbolName){const e=this._evaluator.getDeclarationsForNameNode(t);e&&e.map((e=>this._evaluator.resolveAliasDeclaration(e,!0))).filter((e=>void 0!==e)).some((e=>o.areDeclarationsSame(e,this._declaration)))&&this._addIncomingCallForDeclaration(t)}return!0}visitMemberAccess(e){if((0,u.throwIfCancellationRequested)(this._cancellationToken),e.memberName.value===this._symbolName){const t=this._evaluator.getType(e.leftExpression);t&&(0,d.doForEachSubtype)(t,(t=>{let n=t;if(n=this._evaluator.makeTopLevelTypeVarsConcrete(n),!(0,p.isClassInstance)(n))return;const i=(0,d.lookUpObjectMember)(n,e.memberName.value);if(!i)return;const s=this._evaluator.getTypeOfMember(i),r=i.symbol.getDeclarations();s&&r.some((e=>o.areDeclarationsSame(e,this._declaration)))&&this._addIncomingCallForDeclaration(e.memberName)}))}return!0}_addIncomingCallForDeclaration(e){const t=l.getExecutionScopeNode(e);if(!t)return;let n;if(36===t.nodeType){const e=(0,h.convertOffsetsToRange)(0,0,this._parseResults.tokenizerOutput.lines),t=(0,m.getFileName)(this._filePath);n={name:`(module) ${t}`,kind:a.SymbolKind.Module,uri:this._filePath,range:e,selectionRange:e}}else if(30===t.nodeType){const e=(0,h.convertOffsetsToRange)(t.start,t.start+t.length,this._parseResults.tokenizerOutput.lines);n={name:"(lambda)",kind:a.SymbolKind.Function,uri:this._filePath,range:e,selectionRange:e}}else{const e=(0,h.convertOffsetsToRange)(t.name.start,t.name.start+t.name.length,this._parseResults.tokenizerOutput.lines);n={name:t.name.value,kind:a.SymbolKind.Function,uri:this._filePath,range:e,selectionRange:e}}let i=this._incomingCalls.find((e=>e.from.uri===n.uri&&(0,y.rangesAreEqual)(e.from.range,n.range)));i||(i={from:n,fromRanges:[]},this._incomingCalls.push(i));const s=(0,h.convertOffsetsToRange)(e.start,e.start+e.length,this._parseResults.tokenizerOutput.lines);i.fromRanges.push(s)}}function T(e,t){let n;switch(e.type){case 4:case 5:n=a.SymbolKind.Class;break;case 3:if(e.isMethod){const i=t.getTypeForDeclaration(e);n=i&&(0,d.isProperty)(i)?a.SymbolKind.Property:a.SymbolKind.Method}else n=a.SymbolKind.Function;break;default:n=a.SymbolKind.Function}return n}},8590:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionProvider=void 0;const i=n(4494),s=n(3213),r=n(6657),a=n(2122);t.CodeActionProvider=class{static async getCodeActionsForPosition(e,t,n,o){(0,s.throwIfCancellationRequested)(o);const l=[];if(!e.disableLanguageServices){const s=await e.serviceInstance.getDiagnosticsForRange(t,n,o),c=s.find((e=>{const t=e.getActions();return t&&t.find((e=>"pyright.createtypestub"===e.action))}));if(c){const n=c.getActions().find((e=>"pyright.createtypestub"===e.action));if(n){const s=i.CodeAction.create(a.Localizer.CodeAction.createTypeStubFor().format({moduleName:n.moduleName}),i.Command.create(a.Localizer.CodeAction.createTypeStub(),"pyright.createtypestub",e.rootPath,n.moduleName,t),i.CodeActionKind.QuickFix);l.push(s)}}const p=s.find((e=>{const t=e.getActions();return t&&t.find((e=>"pyright.addoptionalforparam"===e.action))}));if(p){const n=p.getActions().find((e=>"pyright.addoptionalforparam"===e.action));if(n){const s=e.serviceInstance.getImportResolver().fileSystem,o=i.CodeAction.create(a.Localizer.CodeAction.addOptionalToAnnotation(),i.Command.create(a.Localizer.CodeAction.addOptionalToAnnotation(),"pyright.addoptionalforparam",(0,r.convertPathToUri)(s,t),n.offsetOfTypeNode),i.CodeActionKind.QuickFix);l.push(o)}}}return l}}},9209:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CompletionProvider=t.dictionaryKeyDetail=t.autoImportDetail=void 0;const a=n(4494),o=r(n(563)),l=n(8905),c=n(5523),p=n(1272),d=r(n(8494)),u=n(8494),m=n(5083),h=n(8816),y=r(n(1766)),g=n(2917),f=n(9453),T=n(3371),_=n(3843),v=n(1133),b=n(5168),I=n(3213),C=r(n(5839)),S=n(5839),F=n(1464),D=n(6886),P=r(n(7559)),x=n(3550),A=n(3550),k=n(8718),E=n(5275),w=n(8566),N=n(8127),R=n(3490);var M,O;!function(e){const t=["True","False","None","and","or","not","is","lambda","yield","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","nonlocal","pass","raise","return","try","while","with"],n=[...t,"async","await"],i=[...n,"case","match"];e.forVersion=function(e){return e>=D.PythonVersion.V3_10?i:e>=D.PythonVersion.V3_5?n:t}}(M||(M={})),function(e){e[e.LikelyKeyword=0]="LikelyKeyword",e[e.RecentImportModuleName=1]="RecentImportModuleName",e[e.ImportModuleName=2]="ImportModuleName",e[e.LiteralValue=3]="LiteralValue",e[e.NamedParameter=4]="NamedParameter",e[e.RecentKeywordOrSymbol=5]="RecentKeywordOrSymbol",e[e.RecentAutoImport=6]="RecentAutoImport",e[e.Keyword=7]="Keyword",e[e.EnumMember=8]="EnumMember",e[e.NormalSymbol=9]="NormalSymbol",e[e.PrivateSymbol=10]="PrivateSymbol",e[e.DunderSymbol=11]="DunderSymbol",e[e.AutoImport=12]="AutoImport"}(O||(O={})),t.autoImportDetail="Auto-import",t.dictionaryKeyDetail="Dictionary key";class L{constructor(e,t,n,i,s,r,a,o,l,c,p,d,u){this._workspacePath=e,this._parseResults=t,this._fileContents=n,this._importResolver=i,this._position=s,this._filePath=r,this._configOptions=a,this._importLookup=o,this._evaluator=l,this._options=c,this._sourceMapper=p,this._autoImportMaps=d,this._cancellationToken=u,this._insideStringLiteral=!1,this._execEnv=this._configOptions.findExecEnvironment(this._filePath)}getCompletionsForPosition(){var e,t;const n=(0,F.convertPositionToOffset)(this._position,this._parseResults.tokenizerOutput.lines);if(void 0===n)return;const i=d.getTokenOverlapping(this._parseResults.tokenizerOutput.tokens,n);5===(null==i?void 0:i.type)&&(this._insideStringLiteral=!!A.TextRange.contains(i,n)||!!(65536&i.flags));let s=d.findNodeByOffset(this._parseResults.parseTree,n);const r=s,o=s?d.getNodeDepth(s):0;if(!r||38!==r.nodeType){let t=n,i=!1;for(;t>=0;){t--;const n=this._fileContents.substr(t,1);if("("===n||"\n"===n||"}"===n)break;","===n&&(i=!0);const a=d.findNodeByOffset(this._parseResults.parseTree,t);if(a&&a!==r){d.getNodeDepth(a)>o&&(s=a,i&&23===(null===(e=s.parent)||void 0===e?void 0:e.nodeType)&&(s=s.parent));break}}}if(void 0===s)return;const l=this._parseResults.tokenizerOutput.lines.getItemAt(this._position.line),c=this._fileContents.substr(l.start,l.length),p=c.substr(0,this._position.character),u=c.substr(this._position.character),m=p.search(/\w+$/),h=m>=0?p.substr(m):"";if(this._isWithinComment(n))return;let y=s;for(;y&&0!==y.nodeType;)y=y.parent;let g=y||s;for(;;){if((0,I.throwIfCancellationRequested)(this._cancellationToken),49===g.nodeType)return this._getLiteralCompletions(g,h,p,u);if(48===g.nodeType||27===g.nodeType)return;if(37===g.nodeType)return this._getImportModuleCompletions(g);if(0===g.nodeType)return this._getExpressionErrorCompletions(g,h,p,u);if(35===g.nodeType)return this._getMemberAccessCompletions(g.leftExpression,h);if(15===g.nodeType){const e=a.CompletionList.create();if(this._addTypedDictKeys(g,void 0,p,u,e))return{completionList:e}}const e=d.getFirstAncestorOrSelfOfKind(g,17);if(e&&15===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)){const t=e.parent;if(t.trailingCommaToken&&t.trailingCommaToken.start<n){const e=a.CompletionList.create();if(this._addTypedDictKeys(t,void 0,p,u,e))return{completionList:e}}}if(38===g.nodeType){const e=this._tryGetNameCompletions(g,n,h);if(e||void 0===e)return e}if(22===g.nodeType)return this._getImportFromCompletions(g,h);if((0,E.isExpressionNode)(g))return this._getExpressionCompletions(g,h,p,u);if(50===g.nodeType){if(g.parent&&25===g.parent.nodeType&&!g.parent.name&&g.parent.typeExpression&&A.TextRange.getEnd(g.parent.typeExpression)<n&&n<=g.parent.exceptSuite.start)return;if(g.parent&&10===g.parent.nodeType&&(!g.parent.name||!g.parent.name.value)&&0===g.parent.arguments.length&&n<=g.parent.suite.start)return;return this._getStatementCompletions(g,h,p,u)}if(36===g.nodeType)return this._getStatementCompletions(g,h,p,u);if(41===g.nodeType&&0===g.length&&g.parent&&30===g.parent.nodeType)return;if(!g.parent)break;g=g.parent}}resolveCompletionItem(e){(0,I.throwIfCancellationRequested)(this._cancellationToken);const t=e.data,n=e.label;let i="";t.autoImportText&&(i=t.autoImportText);const s=L._mostRecentCompletions.findIndex((e=>e.label===n&&e.autoImportText===i));if(s>0&&(L._mostRecentCompletions=L._mostRecentCompletions.splice(s,1)),0!==s&&L._mostRecentCompletions.unshift({label:n,autoImportText:i}),L._mostRecentCompletions.length>128&&L._mostRecentCompletions.pop(),t.symbolLabel)if(this._itemToResolve=e,t.autoImportText){if(!e.additionalTextEdits){const e={completionList:a.CompletionList.create()};this._addAutoImportCompletions(t.symbolLabel,1,!1,e)}}else this.getCompletionsForPosition()}_tryGetNameCompletions(e,t,n){var i;if(!e.parent)return!1;if(21!==e.parent.nodeType||e.parent.alias!==e){if(37===e.parent.nodeType){if(e.parent.parent&&21===e.parent.parent.nodeType&&!e.parent.parent.alias&&A.TextRange.getEnd(e.parent.parent)<t)return;return this._getImportModuleCompletions(e.parent)}if(23===e.parent.nodeType){if(e.parent.alias===e)return;const i=e.parent.parent;if(i&&22===i.nodeType){if(!e.parent.alias&&A.TextRange.getEnd(e.parent)<t)return;return e.parent.name===e?this._getImportFromCompletions(i,n):this._getImportFromCompletions(i,"")}return!1}if(35===e.parent.nodeType&&e===e.parent.memberName)return this._getMemberAccessCompletions(e.parent.leftExpression,n);if(25!==e.parent.nodeType||e!==e.parent.name){if(28===e.parent.nodeType&&e===e.parent.name)return(null===(i=e.parent.decorators)||void 0===i?void 0:i.some((e=>this._isOverload(e))))?this._getMethodOverloadsCompletions(n,e):void 0;if(!(41===e.parent.nodeType&&e===e.parent.name||10===e.parent.nodeType&&e===e.parent.name||26===e.parent.nodeType&&A.TextRange.contains(e.parent.targetExpression,e.start)||33===e.parent.nodeType&&A.TextRange.contains(e.parent.targetExpression,e.start)))return!1}}}_isWithinComment(e){var t,n;const i=function(e,t){const n=t.getItemAtPosition(e);if(n<0)return;let i=t.getItemAt(n);if(!(e>i.start&&e<i.start+i.length)){for(let e=n-1;e>=0;e--){const n=t.getItemAt(e);if(i.start!==n.start)break;i=n}return e<=i.start?i:(C.assert(n+1<t.length),t.getItemAt(n+1))}}(e,this._parseResults.tokenizerOutput.tokens);return!!i&&null!==(n=null===(t=i.comments)||void 0===t?void 0:t.some((t=>A.TextRange.overlaps(t,e))))&&void 0!==n&&n}_getExpressionErrorCompletions(e,t,n,i){var s;switch(e.category){case 0:return this._createSingleKeywordCompletionList("in");case 1:return this._createSingleKeywordCompletionList("else");case 2:case 4:return this._getExpressionCompletions(e,t,n,i);case 3:{let s=this._getLiteralCompletions(e,t,n,i);return s&&s.completionList||(s=this._getExpressionCompletions(e,t,n,i)),s}case 7:if(e.child&&(0,E.isExpressionNode)(e.child))return this._getMemberAccessCompletions(e.child,t);break;case 10:if(e.child&&38===e.child.nodeType)return(null===(s=e.decorators)||void 0===s?void 0:s.some((e=>this._isOverload(e))))?this._getMethodOverloadsCompletions(t,e.child):this._getMethodOverrideCompletions(t,e.child,e.decorators)}}_isOverload(e){return this._checkDecorator(e,"overload")}_checkDecorator(e,t){return 38===e.expression.nodeType&&e.expression.value===t}_createSingleKeywordCompletionList(e){const t=a.CompletionItem.create(e);return t.kind=a.CompletionItemKind.Keyword,t.sortText=this._makeSortText(O.LikelyKeyword,e),{completionList:a.CompletionList.create([t])}}_getMethodOverloadsCompletions(e,t){var n;const i=function(e,t){const n=d.getEnclosingClass(t,!1);if(n){const t=e.getTypeOfClass(n);if(!t)return;const i=new Map;for(const e of t.classType.details.mro)(0,v.isInstantiableClass)(e)&&(0,b.getMembersForClass)(e,i,!1);return i}const i=d.getEnclosingModule(t);if(i){const e=o.getScope(i);return null==e?void 0:e.symbolTable}}(this._evaluator,t);if(!i)return;const s=28===(null===(n=t.parent)||void 0===n?void 0:n.nodeType)||void 0,r=a.CompletionList.create(),l=d.getEnclosingFunction(t);return i.forEach(((n,i)=>{const a=(0,g.getLastTypedDeclaredForSymbol)(n);if(!a||3!==a.type)return;if(!a.node.decorators.some((e=>this._isOverload(e))))return;const o=n.getDeclarations();if((1!==o.length||!o.some((e=>e.node===l)))&&P.isPatternInSymbol(t.value,i)){const o=this._createReplaceEdits(e,t,a.node.name.value);this._addSymbol(i,n,t.value,r,{funcParensDisabled:s,edits:{textEdit:o}})}})),{completionList:r}}_getMethodOverrideCompletions(e,t,n){var i,s;const r=d.getEnclosingClass(t,!0);if(!r)return;const o=this._evaluator.getTypeOfClass(r);if(!o)return;const l=new Map;for(let e=1;e<o.classType.details.mro.length;e++){const t=o.classType.details.mro[e];(0,v.isInstantiableClass)(t)&&(0,b.getMembersForClass)(t,l,!1)}const c=null!==(i=null==n?void 0:n.some((e=>this._checkDecorator(e,"staticmethod"))))&&void 0!==i&&i,p=null!==(s=null==n?void 0:n.some((e=>this._checkDecorator(e,"classmethod"))))&&void 0!==s&&s,u=a.CompletionList.create();return l.forEach(((n,i)=>{let s=(0,g.getLastTypedDeclaredForSymbol)(n);if(s&&3===s.type&&P.isPatternInSymbol(t.value,i)){const r=this._evaluator.getTypeForDeclaration(s);if(!r)return;let l=(0,v.isClassInstance)(r)&&v.ClassType.isPropertyClass(r);if(y.isDunderName(i)&&(l=!1),!(0,v.isFunction)(r)&&!l)return;if(l){const e=n.getTypedDeclarations();e.length>0&&3===e[0].type&&(s=e[0])}const d=(0,v.isFunction)(r)&&v.FunctionType.isStaticMethod(r),m=(0,v.isFunction)(r)&&v.FunctionType.isClassMethod(r)&&"__init_subclass__"!==i;if(c!==d||p!==m)return;const g=this._printMethodSignature(o.classType,s);let f;f=(0,h.isStubFile)(this._filePath)?`${g}: ...`:`${g}:\n${this._printOverriddenMethodBody(o.classType,d,l,s)}`;const T=this._createReplaceEdits(e,t,f);this._addSymbol(i,n,t.value,u,{funcParensDisabled:!0,edits:{format:this._options.snippet?a.InsertTextFormat.Snippet:void 0,textEdit:T}})}})),{completionList:u}}_createReplaceEdits(e,t,n){const i=38===(null==t?void 0:t.nodeType)?this._position.character-e.length+t.value.length:this._position.character,s={start:{line:this._position.line,character:this._position.character-e.length},end:{line:this._position.line,character:i}};return a.TextEdit.replace(s,n)}_printMethodSignature(e,t){const n=t.node;let i;(0,h.isStubFile)(this._filePath)?i=!0:e.details.moduleName===t.moduleName&&(i=!1);const s=(0,h.isStubFile)(this._filePath)?1:void 0,r=n.parameters.map(((e,t)=>{let r="";1===e.category?r+="*":2===e.category&&(r+="**"),e.name&&(r+=e.name.value);const a=this._evaluator.getTypeAnnotationForParameter(n,t);return a&&(r+=": "+d.printExpression(a,s)),e.defaultValue&&(r+=a?" = ":"=",r+=(null!=i?i:!o(e.defaultValue))?"...":d.printExpression(e.defaultValue,s)),r||e.name||0!==e.category?r:"/"})).join(", ");let a=n.name.value+"("+r+")";return n.returnTypeAnnotation?a+=" -> "+d.printExpression(n.returnTypeAnnotation,s):n.functionAnnotationComment&&(a+=" -> "+d.printExpression(n.functionAnnotationComment.returnTypeAnnotation,s)),a;function o(e){switch(e.nodeType){case 40:case 11:return!0;case 49:return 0==(64&e.token.flags);case 48:return e.strings.every(o);case 55:return o(e.expression);case 7:return o(e.leftExpression)&&o(e.rightExpression);default:return!1}}}_printOverriddenMethodBody(e,t,n,i){let s="    ";if(1===e.details.baseClasses.length&&(0,v.isClass)(e.details.baseClasses[0])&&"builtins.object"===e.details.baseClasses[0].details.fullName)return s+=this._options.snippet?"${0:pass}":"pass",s;if(0===i.node.parameters.length)return s+=this._options.snippet?"${0:pass}":"pass",s;const r=t?i.node.parameters.filter((e=>e.name)):i.node.parameters.slice(1).filter((e=>e.name));return"__init__"!==i.node.name.value&&(s+="return "),i.node.isAsync&&(s+="await "),n?s+`super().${i.node.name.value}`:s+`super().${i.node.name.value}(${r.map((function(e){var t;const n=null===(t=e.name)||void 0===t?void 0:t.value;return 1===e.category?`*${n}`:2===e.category?`**${n}`:e.defaultValue?`${n}=${n}`:n})).join(", ")})`}_getMemberAccessCompletions(e,t){const n=new Map,i=a.CompletionList.create();let s={},r=this._evaluator.getType(e);return r&&(r=this._evaluator.makeTopLevelTypeVarsConcrete(r),(0,b.doForEachSubtype)(r,(s=>{if(s=this._evaluator.makeTopLevelTypeVarsConcrete(s),(0,v.isClass)(s))(0,b.getMembersForClass)(s,n,v.TypeBase.isInstance(s));else if((0,v.isModule)(s))(0,b.getMembersForModule)(s,n);else if((0,v.isFunction)(s)||(0,v.isOverloadedFunction)(s)){const t=this._evaluator.getBuiltInType(e,"function");t&&(0,v.isInstantiableClass)(t)&&(0,b.getMembersForClass)(t,n,!0)}else if((0,v.isNone)(s)){const t=this._evaluator.getBuiltInType(e,"object");t&&(0,v.isInstantiableClass)(t)&&(0,b.getMembersForClass)(t,n,v.TypeBase.isInstance(s))}this._addSymbolsForSymbolTable(n,(e=>!0),t,!1,(0,v.isClass)(s)?s:void 0,i)}))),(!r||(0,v.isUnknown)(r)||(0,v.isUnbound)(r))&&(s=this._getLastKnownModule(e,r)),{completionList:i,memberAccessInfo:s}}_getLastKnownModule(e,t){var n;let i=e,s=t,r=35===e.nodeType?null==e?void 0:e.memberName.value:void 0;for(;i&&(9===i.nodeType||35===i.nodeType?(i=i.leftExpression,void 0===r&&(r=35===i.nodeType&&null!==(n=null==i?void 0:i.memberName.value)&&void 0!==n?n:"")):i=void 0,!i||(s=this._evaluator.getType(i),void 0===s||(0,v.isUnknown)(s)||(0,v.isUnbound)(s))););const a={};if(s&&!(0,v.isUnknown)(s)&&!(0,v.isUnbound)(s)&&i){const e=(0,b.getDeclaringModulesForType)(s);a.lastKnownModule=e.find((e=>"typing"!==e)),35===i.nodeType?a.lastKnownMemberName=i.memberName.value:(38===i.nodeType&&(0,v.isInstantiableClass)(s)||38===i.nodeType&&(0,v.isClassInstance)(s))&&(a.lastKnownMemberName=s.details.name),a.unknownMemberName=r}return a}_getStatementCompletions(e,t,n,i){return this._getExpressionCompletions(e,t,n,i)}_getExpressionCompletions(e,n,i,s){var r,o,l,c;const p=this._isIndexArgument(e);if(!p&&40===e.nodeType)return;if(59===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&e.parent===(null===(o=e.parent.target)||void 0===o?void 0:o.parent))return;const d=a.CompletionList.create(),u={completionList:d};if(".."===i.slice(-2))return u;if(this._addCallArgumentCompletions(e,n,i,s,!1,d),this._addSymbols(e,n,d),this._findMatchingKeywords(M.forVersion(this._execEnv.pythonVersion),n).map((e=>{const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,d.items.push(t),t.sortText=this._makeSortText(O.Keyword,e)})),!this._configOptions.autoImportCompletions||n.startsWith("_")||this._itemToResolve||this._addAutoImportCompletions(n,.25,this._options.lazyEdit,u),0===e.nodeType)if(3===e.category&&24===(null===(l=e.parent)||void 0===l?void 0:l.nodeType))this._tryAddTypedDictStringLiteral(e.parent,void 0,void 0,d);else if(2===e.category&&e.parent&&3===e.parent.nodeType){const t=null===(c=this._evaluator.getExpectedType(e))||void 0===c?void 0:c.type;t&&this._addLiteralValuesForTargetType(t,i,n,s,d)}if(p){const i=e.parent.parent,s=new Set(d.items.map((e=>e.label)));this._getDictionaryKeys(i,e).forEach((e=>{s.has(e)||this._addNameToCompletionList(e,a.CompletionItemKind.Constant,n,d,{sortText:this._makeSortText(O.LiteralValue,e),itemDetail:t.dictionaryKeyDetail})}))}return u}_isIndexArgument(e){const t=e.parent;return t&&1===t.nodeType&&0===t.argumentCategory&&t.parent&&24===t.parent.nodeType&&t.parent.baseExpression&&38===t.parent.baseExpression.nodeType}_addCallArgumentCompletions(e,t,n,i,s,r){const a=(0,F.convertPositionToOffset)(this._position,this._parseResults.tokenizerOutput.lines),o=(0,u.getCallNodeAndActiveParameterIndex)(e,a,this._parseResults.tokenizerOutput.tokens);if(!o)return;const l=this._evaluator.getCallSignatureInfo(o.callNode,o.activeIndex,o.activeOrFake);if(l){const e=(0,F.convertOffsetToPosition)(l.callNode.leftExpression.start+l.callNode.leftExpression.length,this._parseResults.tokenizerOutput.lines);(0,x.comparePositions)(this._position,e)>0&&(s||this._addNamedParameters(l,t,r),this._addLiteralValuesForArgument(l,n,t,i,r))}}_addLiteralValuesForArgument(e,t,n,i,s){e.signatures.forEach((e=>{if(!e.activeParam)return;const r=e.type,a=r.details.parameters.indexOf(e.activeParam);if(a<0)return;const o=r.details.parameters[a].type;this._addLiteralValuesForTargetType(o,t,n,i,s)}))}_addLiteralValuesForTargetType(e,t,n,i,s){const r=this._getQuoteValueFromPriorText(t);this._getSubTypesWithLiteralValues(e).forEach((e=>{if(v.ClassType.isBuiltIn(e,"str")){const t=(0,_.printLiteralValue)(e,r.quoteCharacter);void 0===r.stringValue?this._addNameToCompletionList(t,a.CompletionItemKind.Constant,n,s,{sortText:this._makeSortText(O.LiteralValue,e.literalValue)}):this._addStringLiteralToCompletionList(t.substr(1,t.length-2),r.stringValue,i,r.quoteCharacter,s)}}))}_getDictExpressionStringKeys(e,t){const n=function(e){if(15===e.nodeType)return e;let t=e;for(;t&&15!==t.nodeType&&45!==t.nodeType;)if(t=t.parent,!t)return;return t}(e);return n?n.entries.flatMap((e=>17!==e.nodeType||(null==t?void 0:t.has(e.keyExpression.id))?[]:48===e.keyExpression.nodeType?[e.keyExpression.strings.map((e=>e.value)).join("")]:[])):[]}_getSubTypesWithLiteralValues(e){const t=[];return(0,b.doForEachSubtype)(e,(e=>{(0,v.isClassInstance)(e)&&(0,b.isLiteralType)(e)&&t.push(e)})),t}_getDictionaryKeys(e,t){var n,i,s,r,a,o,l,c,p,u;if(38!==e.baseExpression.nodeType)return[];const m=this._evaluator.getType(e.baseExpression);if(!m||!(0,v.isClassInstance)(m))return[];if(!v.ClassType.isBuiltIn(m,"dict")&&!v.ClassType.isBuiltIn(m,"Mapping"))return[];if(2===(null===(n=m.typeArguments)||void 0===n?void 0:n.length)){const e=[];if(this._getSubTypesWithLiteralValues(m.typeArguments[0]).forEach((t=>{(v.ClassType.isBuiltIn(t,"str")||v.ClassType.isBuiltIn(t,"int")||v.ClassType.isBuiltIn(t,"bool")||v.ClassType.isBuiltIn(t,"bytes")||v.ClassType.isEnumClass(t))&&e.push((0,_.printLiteralValue)(t,this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter))})),e.length>0)return e}const h=null!==(i=this._evaluator.getDeclarationsForNameNode(e.baseExpression))&&void 0!==i?i:[],y=h.length>0?h[0]:void 0;if(!y||1!==y.type&&2!==y.type)return[];if(y.path!==this._filePath)return[];let g=e.baseExpression;if(y.node){const e=d.getEvaluationScopeNode(y.node);(null===(s=d.getFileInfoFromNode(g))||void 0===s?void 0:s.filePath)===(null===(r=d.getFileInfoFromNode(e))||void 0===r?void 0:r.filePath)&&(g=e)}const f=N.DocumentSymbolCollector.collectFromNode(e.baseExpression,this._evaluator,this._cancellationToken,g),T=new Set;for(const e of f){const n=54===(null===(a=e.node.parent)||void 0===a?void 0:a.nodeType)?e.node.parent:e.node;if(3===(null===(o=n.parent)||void 0===o?void 0:o.nodeType)||4===(null===(l=n.parent)||void 0===l?void 0:l.nodeType)){if(15===n.parent.rightExpression.nodeType){const e=n.parent.rightExpression;for(const t of e.entries.filter((e=>17===e.nodeType))){const e=this._parseResults.text.substr(t.keyExpression.start,t.keyExpression.length).trim();e.length>0&&T.add(e)}}if(9===n.parent.rightExpression.nodeType){const e=n.parent.rightExpression,t=this._evaluator.getType(e.leftExpression);if(!t||!(0,v.isInstantiableClass)(t)||!v.ClassType.isBuiltIn(t,"dict"))continue;for(const t of e.arguments){const e=null!==(p=null===(c=t.name)||void 0===c?void 0:c.value.trim())&&void 0!==p?p:"",n=this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter;e.length>0&&T.add(`${n}${e}${n}`)}}}if(24===(null===(u=n.parent)||void 0===u?void 0:u.nodeType)&&1===n.parent.items.length&&0!==n.parent.items[0].valueExpression.nodeType&&!A.TextRange.containsRange(n.parent,t)){const e=n.parent.items[0],t=this._parseResults.text.substr(e.valueExpression.start,e.valueExpression.length).trim();t.length>0&&T.add(t)}}return[...T]}_getLiteralCompletions(e,n,i,s){var r,o,l;let c=e.parent;if(!c)return;const p=a.CompletionList.create();if((0,E.isExpressionNode)(c)){const t=this._evaluator.getExpectedType(c);if(t&&(0,b.isLiteralTypeOrUnion)(t.type))return this._addLiteralValuesForTargetType(t.type,i,n,s,p),{completionList:p};if(49===e.nodeType&&(null===(r=e.parent)||void 0===r?void 0:r.parent)){const t=e.parent.parent;let n;if(17===t.nodeType&&t.keyExpression===e.parent&&15===(null===(o=t.parent)||void 0===o?void 0:o.nodeType)?n=t.parent:45===(null==t?void 0:t.nodeType)&&(n=t),n&&this._addTypedDictKeys(n,e,i,s,p))return{completionList:p}}}if(1!==c.nodeType){if(48!==c.nodeType||c.strings.length>1)return;if(c=c.parent,!c)return}if(1===c.nodeType&&24===(null===(l=c.parent)||void 0===l?void 0:l.nodeType)){if(!this._tryAddTypedDictStringLiteral(c.parent,49===e.nodeType?i:"",s,p)){const r=this._getDictionaryKeys(c.parent,e),o=this._getQuoteValueFromPriorText(i);for(const i of r){const r=/^["|'].*["|']$/.test(i);if(49!==e.nodeType||r)if(r){const e=i.substr(1,i.length-2);this._addStringLiteralToCompletionList(e,o.stringValue,s,o.quoteCharacter,p,t.dictionaryKeyDetail)}else this._addNameToCompletionList(i,a.CompletionItemKind.Constant,n,p,{sortText:this._makeSortText(O.LiteralValue,i),itemDetail:t.dictionaryKeyDetail})}if(0===p.items.length)return}}else{C.assert(49===e.nodeType);const t=(0,F.convertPositionToOffset)(this._position,this._parseResults.tokenizerOutput.lines),r=c.start<t&&t<A.TextRange.getEnd(e);this._addCallArgumentCompletions(e,n,i,s,r,p)}return{completionList:p}}_addTypedDictKeys(e,t,n,i,s){var r;const a=this._evaluator.getExpectedType(e);if(!a)return!1;if(d.getNodeDepth(a.node)<d.getNodeDepth(e))return!1;let o=[];if((0,b.doForEachSubtype)(a.type,(e=>{(0,v.isClassInstance)(e)&&v.ClassType.isTypedDictClass(e)&&o.push(e)})),0===o.length)return!1;const l=this._getDictExpressionStringKeys(e,t?new Set([null===(r=t.parent)||void 0===r?void 0:r.id]):void 0);o=this._tryNarrowTypedDicts(o,l);const c=this._getQuoteValueFromPriorText(n),p=new Set(s.items.map((e=>e.label)));return l.forEach((e=>{p.add(e)})),o.forEach((e=>{(0,f.getTypedDictMembersForClass)(this._evaluator,e,!0).forEach(((e,t)=>{p.has(t)||(p.add(t),this._addStringLiteralToCompletionList(t,c?c.stringValue:void 0,i,c?c.quoteCharacter:this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter,s))}))})),!0}_tryNarrowTypedDicts(e,t){const n=e.flatMap((e=>{const n=(0,f.getTypedDictMembersForClass)(this._evaluator,e,!0);for(let e=0;e<t.length;e++)if(!n.has(t[e]))return[];return[e]}));return 0===n.length?e:n}_getQuoteValueFromPriorText(e){if(this._insideStringLiteral){const t=e.lastIndexOf("'"),n=e.lastIndexOf('"');if(t>n)return{quoteCharacter:"'",stringValue:e.substr(t+1)};if(n>t)return{quoteCharacter:'"',stringValue:e.substr(n+1)}}return{stringValue:void 0,quoteCharacter:this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter}}_tryAddTypedDictStringLiteral(e,t,n,i){if(!e)return!1;const s=this._evaluator.getType(e.baseExpression);if(!s||!(0,v.isClassInstance)(s))return!1;if(!v.ClassType.isTypedDictClass(s))return!1;const r=(0,f.getTypedDictMembersForClass)(this._evaluator,s,!0),a=t?this._getQuoteValueFromPriorText(t):void 0;return r.forEach(((e,t)=>{this._addStringLiteralToCompletionList(t,a?a.stringValue:void 0,n,a?a.quoteCharacter:this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter,i)})),!0}_addStringLiteralToCompletionList(e,t,n,i,s,r){if(P.isPatternInSymbol(t||"",e)){const o=`${i}${e}${i}`,l=a.CompletionItem.create(o);l.kind=a.CompletionItemKind.Constant,l.sortText=this._makeSortText(O.LiteralValue,o);let c=this._position.character;void 0!==t&&(c-=t.length+1);let p=this._position.character;void 0!==n&&n.startsWith(i)&&p++;const d={start:{line:this._position.line,character:c},end:{line:this._position.line,character:p}};l.textEdit=a.TextEdit.replace(d,o),l.detail=r,s.items.push(l)}}_addAutoImportCompletions(e,t,n,i){var s,r,o;if(!this._autoImportMaps)return;const l=i.completionList;if(!l)return;const c=this._autoImportMaps.getModuleSymbolsMap(),p=new Set(l.items.filter((e=>{var t;return!(null===(t=e.data)||void 0===t?void 0:t.autoImport)})).map((e=>e.label))),d=new w.AutoImporter(this._execEnv,this._importResolver,this._parseResults,this._position,p,c,{libraryMap:this._autoImportMaps.libraryMap,lazyEdit:n}),u=[],m=null===(s=this._autoImportMaps.nameMap)||void 0===s?void 0:s.get(e);m&&e.length>1&&!p.has(e)&&u.push(...d.getAutoImportCandidatesForAbbr(e,m,this._cancellationToken)),u.push(...d.getAutoImportCandidates(e,t,void 0,this._cancellationToken));const h=d.getPerfInfo(),y=new k.Duration;for(const t of u)t.symbol?this._addSymbol(t.name,t.symbol,e,l,{autoImportSource:t.source,autoImportAlias:t.alias,edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}}):this._addNameToCompletionList(null!==(r=t.alias)&&void 0!==r?r:t.name,null!==(o=t.kind)&&void 0!==o?o:a.CompletionItemKind.Module,e,l,{autoImportText:this._getAutoImportText(t.name,t.source,t.alias),edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}});i.autoImportInfo={indexUsed:h.indexUsed,totalTimeInMS:h.totalInMs,moduleTimeInMS:h.moduleTimeInMS,indexTimeInMS:h.indexTimeInMS,importAliasTimeInMS:h.importAliasTimeInMS,itemCount:u.length,symbolCount:h.symbolCount,indexCount:h.indexCount,importAliasCount:h.importAliasCount,additionTimeInMS:y.getDurationInMilliseconds()}}_getImportFromCompletions(e,t){if(e.isWildcardImport)return;const n=o.getImportInfo(e.module);if(!n)return;const i=a.CompletionList.create(),s=n.resolvedPaths.length>0?n.resolvedPaths[n.resolvedPaths.length-1]:"",r=this._importLookup(s);return r&&this._addSymbolsForSymbolTable(r.symbolTable,(t=>!e.imports.find((e=>e.name.value===t))),t,!0,void 0,i),n.implicitImports.forEach((n=>{e.imports.find((e=>e.name.value===n.name))||this._addNameToCompletionList(n.name,a.CompletionItemKind.Module,t,i)})),{completionList:i}}_findMatchingKeywords(e,t){return e.filter((e=>!t||P.isPatternInSymbol(t,e)))}_addNamedParameters(e,t,n){const i=new Map;e.signatures.forEach((e=>{this._addNamedParametersToMap(e.type,i)})),e.callNode.arguments.forEach((e=>{e.name&&i.delete(e.name.value)})),i.forEach((e=>{if(P.isPatternInSymbol(t,e)){const t=a.CompletionItem.create(e+"=");t.kind=a.CompletionItemKind.Variable;const i={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};t.data=i,t.sortText=this._makeSortText(O.NamedParameter,e),n.items.push(t)}}))}_addNamedParametersToMap(e,t){e.details.parameters.forEach((e=>{e.name&&!e.isNameSynthesized&&(y.isPrivateOrProtectedName(e.name)||t.set(e.name,e.name))}))}_addSymbols(e,t,n){let i=e;for(;i;){let e=(0,m.getScopeForNode)(i);if(e){for(;e;)this._addSymbolsForSymbolTable(e.symbolTable,(()=>!0),t,!1,void 0,n),e=e.parent;if(10===i.nodeType){const e=this._evaluator.getTypeOfClass(i);e&&(0,v.isInstantiableClass)(e.classType)&&e.classType.details.mro.forEach(((e,i)=>{(0,v.isInstantiableClass)(e)&&this._addSymbolsForSymbolTable(e.details.fields,(t=>{const n=e.details.fields.get(t);return!(!n||!n.isClassMember())&&n.getDeclarations().some((e=>1===e.type))}),t,!1,void 0,n)}))}break}i=i.parent}}_addSymbolsForSymbolTable(e,t,n,i,s,r){e.forEach(((e,a)=>{(!e.isExternallyHidden()||e.getDeclarations().some((e=>(0,c.isDefinedInFile)(e,this._filePath))))&&t(a)&&(r.items.some((e=>e.label===a))||this._addSymbol(a,e,n,r,{boundObjectOrClass:s,funcParensDisabled:i}))}))}_addSymbol(e,t,n,i,s){var r,o,c;if(t.isPrivatePyTypedImport())return;let u=(0,g.getLastTypedDeclaredForSymbol)(t);if(!u){const e=t.getDeclarations();e.length>0&&(u=e[e.length-1])}if(u){let m=a.CompletionItemKind.Variable;if(u=this._evaluator.resolveAliasDeclaration(u,!0),u&&(m=this._convertDeclarationTypeToItemKind(u),1===u.type&&s.boundObjectOrClass&&(0,v.isInstantiableClass)(s.boundObjectOrClass)&&v.ClassType.isEnumClass(s.boundObjectOrClass)&&3===(null===(r=u.node.parent)||void 0===r?void 0:r.nodeType)&&(m=a.CompletionItemKind.EnumMember),this._itemToResolve)){const n=this._itemToResolve.data;if(n.symbolLabel===e&&!n.autoImportText){const n=this._evaluator.getEffectiveTypeOfSymbol(t);if(n){let i,r;switch(u.type){case 0:case 1:case 2:{let t=!1;if(n&&v.TypeBase.isInstantiable(n)){const i=(0,v.getTypeAliasInfo)(n);i&&i.name===e&&(t=!0)}i=e+": "+this._evaluator.printType(n,t);break}case 3:{const t=s.boundObjectOrClass&&((0,v.isFunction)(n)||(0,v.isOverloadedFunction)(n))?this._evaluator.bindFunctionToClassOrObject(s.boundObjectOrClass,n):n;if(t)if((0,b.isProperty)(t)&&s.boundObjectOrClass&&(0,v.isClassInstance)(s.boundObjectOrClass)){const n=this._evaluator.getGetterTypeFromProperty(t,!0)||v.UnknownType.create();i=e+": "+this._evaluator.printType(n,!1)+" (property)"}else i=(0,v.isOverloadedFunction)(t)?(0,R.getOverloadedFunctionTooltip)(t,this._evaluator,35):e+": "+this._evaluator.printType(t,!1);break}case 4:case 5:i="class "+e+"()";break;case 6:if(i=e,u.path){const e=this._importLookup(u.path);e&&(r=e.docString)}break;default:i=e}if(1===u.type&&u.typeAliasName&&u.docString)r=u.docString;else if((0,v.isModule)(n))r=(0,T.getModuleDocString)(n,u,this._sourceMapper);else if((0,v.isInstantiableClass)(n))r=(0,T.getClassDocString)(n,u,this._sourceMapper);else if((0,v.isFunction)(n)){const e=s.boundObjectOrClass?this._evaluator.bindFunctionToClassOrObject(s.boundObjectOrClass,n):n;e&&(0,v.isFunction)(e)&&(r=(0,R.getFunctionDocStringFromType)(e,this._sourceMapper,this._evaluator))}else if((0,v.isOverloadedFunction)(n)){const e=(0,l.isFunctionDeclaration)(u)?d.getEnclosingClass(u.node.name,!1):void 0,t=e?this._evaluator.getTypeOfClass(e):void 0,i=s.boundObjectOrClass?this._evaluator.bindFunctionToClassOrObject(s.boundObjectOrClass,n):n;i&&(0,v.isOverloadedFunction)(i)&&(r=(0,T.getOverloadedFunctionDocStringsInherited)(i,u,this._sourceMapper,this._evaluator,null==t?void 0:t.classType).find((e=>e)))}else if(3===(null==u?void 0:u.type))r=(0,T.getPropertyDocStringInherited)(u,this._sourceMapper,this._evaluator);else if(1===(null==u?void 0:u.type)){const e=null!==(o=t.getDeclarations().find((e=>1===e.type&&!!e.docString)))&&void 0!==o?o:u;r=(0,T.getVariableDocString)(e,this._sourceMapper)}if(this._options.format===a.MarkupKind.Markdown){let e="```python\n"+i+"\n```\n";r&&(e+="---\n",e+=(0,p.convertDocStringToMarkdown)(r)),e=e.trimEnd(),this._itemToResolve.documentation={kind:a.MarkupKind.Markdown,value:e}}else if(this._options.format===a.MarkupKind.PlainText){let e=i+"\n";r&&(e+="\n",e+=(0,p.convertDocStringToPlainText)(r)),e=e.trimEnd(),this._itemToResolve.documentation={kind:a.MarkupKind.PlainText,value:e}}else(0,S.fail)(`Unsupported markup type: ${this._options.format}`)}}}const h=s.autoImportSource?this._getAutoImportText(e,s.autoImportSource,s.autoImportAlias):void 0;this._addNameToCompletionList(null!==(c=s.autoImportAlias)&&void 0!==c?c:e,m,n,i,{autoImportText:h,funcParensDisabled:s.funcParensDisabled,edits:s.edits})}else if(t.getSynthesizedType()){const t=a.CompletionItemKind.Variable;this._addNameToCompletionList(e,t,n,i,{funcParensDisabled:s.funcParensDisabled,edits:s.edits})}}_getAutoImportText(e,t,n){const i=(0,R.getAutoImportText)(e,t,n);return this._options.format===a.MarkupKind.Markdown?`\`\`\`\n${i}\n\`\`\``:this._options.format===a.MarkupKind.PlainText?i:void(0,S.fail)(`Unsupported markup type: ${this._options.format}`)}_addNameToCompletionList(e,n,i,s,r){var o,l,c;if(!(null==r?void 0:r.autoImportText)&&!P.isPatternInSymbol(i,e))return;const d=a.CompletionItem.create(e);d.kind=n;const u={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};if((null==r?void 0:r.funcParensDisabled)&&(u.funcParensDisabled=!0),d.data=u,(null==r?void 0:r.sortText)||(null==r?void 0:r.itemDetail)?(d.sortText=r.sortText,d.detail=r.itemDetail):(null==r?void 0:r.autoImportText)?(d.sortText=this._makeSortText(O.AutoImport,e,r.autoImportText),u.autoImportText=r.autoImportText,d.detail=t.autoImportDetail):n===a.CompletionItemKind.EnumMember?d.sortText=this._makeSortText(O.EnumMember,e):y.isDunderName(e)?d.sortText=this._makeSortText(O.DunderSymbol,e):""===i&&y.isPrivateOrProtectedName(e)?d.sortText=this._makeSortText(O.PrivateSymbol,e):d.sortText=this._makeSortText(O.NormalSymbol,e),u.symbolLabel=e,this._options.format===a.MarkupKind.Markdown){let e="";(null==r?void 0:r.autoImportText)&&(e+=r.autoImportText,(r.typeDetail||r.documentation)&&(e+="\n\n")),(null==r?void 0:r.typeDetail)&&(e+="```python\n"+r.typeDetail+"\n```\n"),(null==r?void 0:r.documentation)&&(e+="---\n",e+=(0,p.convertDocStringToMarkdown)(r.documentation)),e=e.trimEnd(),e&&(d.documentation={kind:a.MarkupKind.Markdown,value:e})}else if(this._options.format===a.MarkupKind.PlainText){let e="";(null==r?void 0:r.autoImportText)&&(e+=r.autoImportText,(r.typeDetail||r.documentation)&&(e+="\n\n")),(null==r?void 0:r.typeDetail)&&(e+=r.typeDetail+"\n"),(null==r?void 0:r.documentation)&&(e+="\n"+(0,p.convertDocStringToPlainText)(r.documentation)),e=e.trimEnd(),e&&(d.documentation={kind:a.MarkupKind.PlainText,value:e})}else(0,S.fail)(`Unsupported markup type: ${this._options.format}`);(null===(o=null==r?void 0:r.edits)||void 0===o?void 0:o.format)&&(d.insertTextFormat=r.edits.format),(null===(l=null==r?void 0:r.edits)||void 0===l?void 0:l.textEdit)&&(d.textEdit=r.edits.textEdit),(null===(c=null==r?void 0:r.edits)||void 0===c?void 0:c.additionalTextEdits)&&(d.additionalTextEdits=r.edits.additionalTextEdits.map((e=>({range:{start:{line:e.range.start.line,character:e.range.start.character},end:{line:e.range.end.line,character:e.range.end.character}},newText:e.replacementText}))),this._itemToResolve)&&this._itemToResolve.data.autoImportText===u.autoImportText&&(this._itemToResolve.additionalTextEdits=d.additionalTextEdits),s.items.push(d)}_getRecentListIndex(e,t){return L._mostRecentCompletions.findIndex((n=>n.label===e&&n.autoImportText===t))}_makeSortText(e,t,n=""){const i=this._getRecentListIndex(t,n);return i>=0&&(e===O.AutoImport?e=O.RecentAutoImport:e===O.ImportModuleName?e=O.RecentImportModuleName:e!==O.Keyword&&e!==O.NormalSymbol&&e!==O.PrivateSymbol&&e!==O.DunderSymbol||(e=O.RecentKeywordOrSymbol)),this._formatInteger(e,2)+"."+this._formatInteger(i,4)+"."+t}_formatInteger(e,t){const n="0".charCodeAt(0);let i="";for(let s=0;s<t;s++){let t=Math.floor(e%10);t<0&&(t=9),i=String.fromCharCode(t+n)+i,e=Math.floor(e/10)}return i}_convertDeclarationTypeToItemKind(e){const t=this._evaluator.resolveAliasDeclaration(e,!0);if(!t)return a.CompletionItemKind.Variable;switch(t.type){case 0:return"class"===t.intrinsicType?a.CompletionItemKind.Class:a.CompletionItemKind.Variable;case 2:return a.CompletionItemKind.Variable;case 1:return t.isConstant||t.isFinal?a.CompletionItemKind.Constant:a.CompletionItemKind.Variable;case 3:if(this._isPossiblePropertyDeclaration(t)){const e=this._evaluator.getTypeOfFunction(t.node);if(e&&(0,b.isProperty)(e.decoratedType))return a.CompletionItemKind.Property}return t.isMethod?a.CompletionItemKind.Method:a.CompletionItemKind.Function;case 4:case 5:return a.CompletionItemKind.Class;case 6:return a.CompletionItemKind.Module}}_getImportModuleCompletions(e){const t={leadingDots:e.leadingDots,hasTrailingDot:e.hasTrailingDot||!1,nameParts:e.nameParts.map((e=>e.value)),importedSymbols:[]},n=this._importResolver.getCompletionSuggestions(this._filePath,this._execEnv,t),i=a.CompletionList.create();if(!e.hasTrailingDot&&e.parent&&22===e.parent.nodeType&&e.parent.missingImportKeyword){const e="import",t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,i.items.push(t),t.sortText=this._makeSortText(O.Keyword,e)}return n.forEach((e=>{const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Module,i.items.push(t),t.sortText=this._makeSortText(O.ImportModuleName,e)})),{completionList:i}}_isPossiblePropertyDeclaration(e){return e.isMethod&&e.node.decorators.length>0}}t.CompletionProvider=L,L._mostRecentCompletions=[]},3778:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionProvider=t.DefinitionFilter=void 0;const a=n(563),o=n(8905),l=r(n(8494)),c=n(8816),p=n(1133),d=n(5168),u=n(3213),m=n(2489),h=n(1464),y=n(3550);var g;!function(e){e.All="all",e.PreferSource="preferSource",e.PreferStubs="preferStubs"}(g=t.DefinitionFilter||(t.DefinitionFilter={}));class f{static getDefinitionsForPosition(e,t,n,i,s,r){(0,u.throwIfCancellationRequested)(r);const a=(0,h.convertPositionToOffset)(n,t.tokenizerOutput.lines);if(void 0===a)return;const o=l.findNodeByOffset(t.parseTree,a);if(void 0===o)return;const p=[];if(38===o.nodeType){const t=s.getDeclarationsForNameNode(o);f._resolveDeclarations(t,s,p,e)}if(0===p.length)return;if(i===g.All)return p;const d=i===g.PreferStubs,m=e=>d===(0,c.isStubFile)(e.path);return p.find(m)?p.filter(m):p}static getTypeDefinitionsForPosition(e,t,n,i,s,r){var a;(0,u.throwIfCancellationRequested)(r);const o=(0,h.convertPositionToOffset)(n,t.tokenizerOutput.lines);if(void 0===o)return;const c=l.findNodeByOffset(t.parseTree,o);if(void 0===c)return;const p=[];if(38===c.nodeType){const t=i.getType(c);if(t){let n=[];(0,d.doForEachSubtype)(t,(t=>{7===(null==t?void 0:t.category)&&n.push(...e.findClassDeclarationsByType(s,t))})),0===n.length&&(n=null!==(a=i.getDeclarationsForNameNode(c))&&void 0!==a?a:[]),f._resolveDeclarations(n,i,p,e)}}return 0!==p.length?p:void 0}static _resolveDeclarations(e,t,n,i){e&&e.forEach((e=>{let s=t.resolveAliasDeclaration(e,!0);if(s&&s.path){if(6===s.type&&s.isUnresolved)return;if(6===s.type&&s.symbolName&&s.submoduleFallback&&s.submoduleFallback.path&&(s=s.submoduleFallback),this._addIfUnique(n,{path:s.path,range:s.range}),(0,o.isFunctionDeclaration)(s)){const e=t.getTypeForDeclaration(s);if(e&&(0,p.isOverloadedFunction)(e))for(const t of e.overloads.map((e=>e.details.declaration)).filter(m.isDefined))this._addIfUnique(n,{path:t.path,range:t.range})}if((0,c.isStubFile)(s.path))if(6===s.type)i.findModules(s.path).map((e=>{var t;return null===(t=(0,a.getFileInfo)(e))||void 0===t?void 0:t.filePath})).filter(m.isDefined).forEach((e=>this._addIfUnique(n,this._createModuleEntry(e))));else{const e=i.findDeclarations(s);for(const t of e)t&&t.path&&this._addIfUnique(n,{path:t.path,range:t.range})}}}))}static _createModuleEntry(e){return{path:e,range:{start:{line:0,character:0},end:{line:0,character:0}}}}static _addIfUnique(e,t){for(const n of e)if(n.path===t.path&&(0,y.rangesAreEqual)(n.range,t.range))return;e.push(t)}}t.DefinitionProvider=f},8221:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentHighlightProvider=void 0;const a=n(4494),o=r(n(8494)),l=n(3213),c=n(1464),p=n(3550),d=n(8127);t.DocumentHighlightProvider=class{static getDocumentHighlight(e,t,n,i){(0,l.throwIfCancellationRequested)(i);const s=(0,c.convertPositionToOffset)(t,e.tokenizerOutput.lines);if(void 0===s)return;const r=o.findNodeByOffset(e.parseTree,s);return void 0!==r&&38===r.nodeType?d.DocumentSymbolCollector.collectFromNode(r,n,i,e.parseTree,!0).map((t=>({kind:38===t.node.nodeType&&o.isWriteAccess(t.node)?a.DocumentHighlightKind.Write:a.DocumentHighlightKind.Read,range:(0,c.convertOffsetsToRange)(t.range.start,p.TextRange.getEnd(t.range),e.tokenizerOutput.lines)}))):void 0}}},8127:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentSymbolCollector=void 0;const a=r(n(563)),o=n(8905),l=n(5523),c=n(8494),p=n(427),d=r(n(5083)),u=n(8816),m=n(3213);class h extends p.ParseTreeWalker{constructor(e,t,n,i,s,r=!1){super(),this._symbolName=e,this._declarations=t,this._evaluator=n,this._cancellationToken=i,this._startingNode=s,this._treatModuleInImportAndFromImportSame=r,this._results=[],this._dunderAllNameNodes=new Set,this._setDunderAllNodes(this._startingNode)}static collectFromNode(e,t,n,i,s=!1){const r=e.value,a=this.getDeclarationsForNode(e,t,!0,n);return(i=null!=i?i:(0,c.getModuleNode)(e))?new h(r,a,t,n,i,s).collect():[]}static getDeclarationsForNode(e,t,n,i,s){(0,m.throwIfCancellationRequested)(i);const r=this._getDeclarationsForNode(e,t),a=[];return r.forEach((e=>{const i=t.resolveAliasDeclaration(e,n);if(i&&(a.push(i),s&&(0,u.isStubFile)(i.path))){const e=s.findDeclarations(i);for(const t of e)t&&t.path&&this._addIfUnique(a,t)}})),a}collect(){return this.walk(this._startingNode),this._results}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitName(e){if((0,m.throwIfCancellationRequested)(this._cancellationToken),e.value!==this._symbolName)return!1;if(this._declarations.length>0){const t=h._getDeclarationsForNode(e,this._evaluator);t&&t.length>0&&t.some((e=>this._resultsContainsDeclaration(e)))&&this._addResult(e)}else this._addResult(e);return!1}visitString(e){return(0,m.throwIfCancellationRequested)(this._cancellationToken),this._dunderAllNameNodes.has(e)&&this._addResult(e),!1}_addResult(e){const t=38===e.nodeType?e:(0,c.getStringNodeValueRange)(e);this._results.push({node:e,range:t})}_resultsContainsDeclaration(e){const t=this._evaluator.resolveAliasDeclaration(e,!1);if(!t)return!1;if(this._declarations.some((e=>(0,l.areDeclarationsSame)(e,t,this._treatModuleInImportAndFromImportSame))))return!0;const n=this._getResolveAliasDeclaration(t);return!(!n||n===t)&&this._declarations.some((e=>(0,l.areDeclarationsSame)(e,n,this._treatModuleInImportAndFromImportSame)))}_getResolveAliasDeclaration(e){if(n(e))return(0,l.getDeclarationsWithUsesLocalNameRemoved)([e])[0];const t=this._evaluator.resolveAliasDeclaration(e,!0);return n(t)?(0,l.getDeclarationsWithUsesLocalNameRemoved)([t])[0]:t;function n(e){return!!e&&6===e.type&&e.node&&e.usesLocalName&&21===e.node.nodeType}}_setDunderAllNodes(e){if(36!==e.nodeType)return;const t=a.getDunderAllInfo(e);if(!t)return;const n=d.getScopeForNode(e);n&&t.stringNodes.forEach((e=>{if(e.value!==this._symbolName)return;const t=n.lookUpSymbolRecursive(e.value);t&&t.symbol.getDeclarations().some((e=>this._resultsContainsDeclaration(e)))&&this._dunderAllNameNodes.add(e)}))}static _addIfUnique(e,t){for(const n of e)if((0,l.areDeclarationsSame)(n,t))return;e.push(t)}static _getDeclarationsForNode(e,t){var n,i,s,r,a,c;if(37!==(null===(n=e.parent)||void 0===n?void 0:n.nodeType)){let n=t.getDeclarationsForNameNode(e)||[];if(23===(null===(i=e.parent)||void 0===i?void 0:i.nodeType)&&(n=n.filter((t=>t.node===e.parent))),0===n.length){const n=t.getType(e);if(8===(null==n?void 0:n.category))return[(0,l.createSynthesizedAliasDeclaration)(n.filePath)]}for(const e of n.filter((e=>(0,o.isAliasDeclaration)(e)&&!e.loadSymbolsFromPath))){const i=e.node;23!==i.nodeType&&n.push(...t.getDeclarationsForNameNode(i.module.nameParts[0])||[])}return n}const p=e.parent;if(21===(null===(s=p.parent)||void 0===s?void 0:s.nodeType)||22===(null===(r=p.parent)||void 0===r?void 0:r.nodeType)){const n=p.nameParts.findIndex((t=>t===e));if(0===n){let n=[];const i=1===p.nameParts.length&&21===p.parent.nodeType&&!!p.parent.alias,s=i?p.parent.alias.value:p.nameParts[0].value,r=null===(a=d.getScopeForNode(e))||void 0===a?void 0:a.lookUpSymbolRecursive(s);return r&&1===p.nameParts.length&&(n.push(...r.symbol.getDeclarations().filter((e=>(0,o.isAliasDeclaration)(e)))),n.length>1&&(n=n.filter((e=>void 0!==(e=e).firstNamePart?e.firstNamePart===p.nameParts[0].value:e.node===p.parent))),i&&(n=(0,l.getDeclarationsWithUsesLocalNameRemoved)(n))),n.push(...(null===(c=t.getDeclarationsForNameNode(p.nameParts[0]))||void 0===c?void 0:c.filter((e=>(0,o.isAliasDeclaration)(e))))||[]),n}return n>0&&t.getDeclarationsForNameNode(p.nameParts[n])||[]}return[]}}t.DocumentSymbolCollector=h},2816:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentSymbolProvider=t.convertToFlatSymbols=t.getIndexAliasData=void 0;const a=n(4494),o=n(472),l=n(6673),c=r(n(563)),p=n(5523),d=n(2917),u=n(5168),m=n(3213),h=n(1464),y=r(n(7559)),g=n(8566);function f(e,t){var n;if(!t.symbolName)return;const i=(0,l.resolveAliasDeclaration)(e,t,!0,!1);if(!i||!i.declaration)return;if(i.isPrivate)return;const s=(0,p.getNameFromDeclaration)(i.declaration);if(!s||i.declaration.path.length<=0)return;const r=null!==(n=_(s,i.declaration))&&void 0!==n?n:a.SymbolKind.Module;return{originalName:s,modulePath:i.declaration.path,kind:r,itemKind:(0,g.convertSymbolKindToCompletionItemKind)(r)}}t.getIndexAliasData=f,t.convertToFlatSymbols=function(e,t){const n=[];for(const i of t)C(n,e,i);return n};class T{static getSymbolsForDocument(e,t,n,i,s,r){var a;const o=[];return t||n?(v(null!==(a=null==t?void 0:t.symbols)&&void 0!==a?a:T.indexSymbols(e,n,{indexingForAutoImportMode:!1},r),i,s,"",o,r),o):o}static addHierarchicalSymbolsForDocument(e,t,n,i,s){var r;(t||n)&&b(null!==(r=null==t?void 0:t.symbols)&&void 0!==r?r:T.indexSymbols(e,n,{indexingForAutoImportMode:!1},s),i,s)}static indexSymbols(e,t,n,i){const s=[];return I(e,t,t.parseTree,n,s,i),s}}function _(e,t,n){let i;switch(t.type){case 4:case 5:i=a.SymbolKind.Class;break;case 3:if(t.isMethod){const e=null==n?void 0:n.getTypeForDeclaration(t);i=e&&(0,u.isProperty)(e)?a.SymbolKind.Property:a.SymbolKind.Method}else i=a.SymbolKind.Function;break;case 6:i=a.SymbolKind.Module;break;case 2:if("self"===e||"cls"===e||"_"===e)return;i=a.SymbolKind.Variable;break;case 1:if("_"===e)return;i=t.isConstant||t.isFinal?a.SymbolKind.Constant:a.SymbolKind.Variable;break;default:i=a.SymbolKind.Variable}return i}function v(e,t,n,i,s,r){if((0,m.throwIfCancellationRequested)(r),e)for(const l of e)if(!l.alias){if(y.isPatternInSymbol(n,l.name)){const e={uri:o.URI.file(t).toString(),range:l.selectionRange},n={name:l.name,kind:l.kind,location:e};i.length&&(n.containerName=i),s.push(n)}v(l.children,t,n,a(i,l.name),s,r)}function a(e,t){return e.length>0?`${e}.${t}`:t}}function b(e,t,n){if((0,m.throwIfCancellationRequested)(n),e)for(const i of e){if(i.alias)continue;const e=[];b(i.children,e,n);const s={name:i.name,kind:i.kind,range:i.range,selectionRange:i.selectionRange,children:e};t.push(s)}}function I(e,t,n,i,s,r){(0,m.throwIfCancellationRequested)(r);const a=c.getScope(n);a&&a.symbolTable.forEach(((n,a)=>{if(n.isIgnoredForProtocolMatch())return;if(i.indexingForAutoImportMode&&!e.isStubFile&&!e.isInPyTypedPackage&&!n.isInDunderAll())return;let o=(0,d.getLastTypedDeclaredForSymbol)(n);if(!o&&n.hasDeclarations()&&(o=n.getDeclarations()[0]),o){if(6===o.type){if(!i.indexingForAutoImportMode)return;if(!o.loadSymbolsFromPath||o.path.length<=0)return}!function(e,t,n,i,s,r,a,o){if(i.indexingForAutoImportMode&&!s)return;const l=_(r,n);if(void 0===l)return;const p=n.range;let d=p;const u=[];4!==n.type&&3!==n.type||(i.indexingForAutoImportMode||I(e,t,n.node,i,u,o),d=(0,h.convertOffsetsToRange)(n.node.start,n.node.start+n.node.length,t.tokenizerOutput.lines));const m={name:r,externallyVisible:s,kind:l,itemKind:(0,g.convertSymbolKindToCompletionItemKind)(l),alias:6===n.type?f(c.getFileInfo(t.parseTree).importLookup,n):void 0,range:i.indexingForAutoImportMode?void 0:d,selectionRange:i.indexingForAutoImportMode?void 0:p,children:i.indexingForAutoImportMode?void 0:u};a.push(m)}(e,t,o,i,!n.isExternallyHidden(),a,s,r)}}))}function C(e,t,n,i){const s={name:n.name,kind:n.kind,location:a.Location.create(t,n.range)};if(n.tags&&(s.tags=n.tags),i&&(s.containerName=i.name),e.push(s),n.children)for(const i of n.children)C(e,t,i,n)}t.DocumentSymbolProvider=T},3334:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.convertHoverResults=t.HoverProvider=void 0;const a=n(4494),o=n(1272),l=r(n(8494)),c=n(1133),p=n(5168),d=n(3213),u=n(5839),m=n(1464),h=n(3550),y=n(3490);t.HoverProvider=class{static getHoverForPosition(e,t,n,i,s,r){(0,d.throwIfCancellationRequested)(r);const a=(0,m.convertPositionToOffset)(n,t.tokenizerOutput.lines);if(void 0===a)return;const o=l.findNodeByOffset(t.parseTree,a);if(void 0===o)return;const p={parts:[],range:{start:(0,m.convertOffsetToPosition)(o.start,t.tokenizerOutput.lines),end:(0,m.convertOffsetToPosition)(h.TextRange.getEnd(o),t.tokenizerOutput.lines)}};if(38===o.nodeType){const t=s.getDeclarationsForNameNode(o);if(t&&t.length>0){let n=t[0];6===n.type&&t.length>1&&(n=t[1]),this._addResultsForDeclaration(i,e,p.parts,n,o,s)}else if((!o.parent||37!==o.parent.nodeType)&&0===p.parts.length){const t=s.getType(o)||c.UnknownType.create();let n="";n=(0,c.isModule)(t)?"(module) "+o.value:o.value+": "+s.printType(t,!1),this._addResultsPart(p.parts,n,!0),this._addDocumentationPart(i,e,p.parts,o,s,void 0)}}return p.parts.length>0?p:void 0}static _addResultsForDeclaration(e,t,n,i,s,r){var a;const o=r.resolveAliasDeclaration(i,!0);if(o)switch(o.type){case 0:this._addResultsPart(n,s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,o);break;case 1:{let l=o.isConstant||o.isFinal?"constant":"variable",p=s;21===i.node.nodeType||23===i.node.nodeType?i.node.alias&&s!==i.node.alias&&38===o.node.nodeType&&(p=o.node):1===(null===(a=s.parent)||void 0===a?void 0:a.nodeType)&&s.parent.name===s&&38===i.node.nodeType&&(p=i.node);const d=r.getType(p);let u,m=!1;if(null==d?void 0:d.typeAliasInfo){const e=(0,c.getTypeAliasInfo)(d);(null==e?void 0:e.name)===p.value&&((0,c.isTypeVar)(d)?(l=d.details.isParamSpec?"param spec":"type variable",u=d.details.name):(m=!0,l="type alias"))}const h=u||s.value+this._getTypeText(p,r,m);this._addResultsPart(n,`(${l}) ${h}`,!0),this._addDocumentationPart(e,t,n,s,r,o);break}case 2:this._addResultsPart(n,"(parameter) "+s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,o);break;case 4:case 5:if(this._addInitMethodInsteadIfCallNode(e,s,r,n,t,o))return;this._addResultsPart(n,"(class) "+s.value,!0),this._addDocumentationPart(e,t,n,s,r,o);break;case 3:{let i="function";if(o.isMethod){const e=r.getTypeForDeclaration(o);i=e&&(0,p.isProperty)(e)?"property":"method"}const a=r.getType(s);a&&(0,c.isOverloadedFunction)(a)?this._addResultsPart(n,`(${i})\n${(0,y.getOverloadedFunctionTooltip)(a,r)}`,!0):this._addResultsPart(n,`(${i}) `+s.value+this._getTypeText(s,r),!0),this._addDocumentationPart(e,t,n,s,r,o);break}case 6:this._addResultsPart(n,"(module) "+s.value,!0),this._addDocumentationPart(e,t,n,s,r,o)}else this._addResultsPart(n,"(import) "+s.value+this._getTypeText(s,r),!0)}static _addInitMethodInsteadIfCallNode(e,t,n,i,s,r){let a=t;if(a.parent&&35===a.parent.nodeType&&t===a.parent.memberName&&(a=t.parent),!a||!a.parent||9!==a.parent.nodeType||a.parent.leftExpression!==a)return!1;const o=n.getType(t);if(!o||!(0,c.isInstantiableClass)(o))return!1;const l=(0,p.lookUpClassMember)(o,"__init__",8);if(!l)return!1;const d=n.getType(a.parent),u=n.getTypeOfMember(l);if(!(d&&u&&(0,c.isClassInstance)(d)&&(0,c.isFunction)(u)))return!1;const m=n.bindFunctionToClassOrObject(d,u);if(!m||!(0,c.isFunction)(m))return!1;const h=n.printFunctionParts(m),y=`${t.value}(${h[0].join(", ")})`;return this._addResultsPart(i,"(class) "+y,!0),this._addDocumentationPartForType(e,s,i,m,r,n)||this._addDocumentationPartForType(e,s,i,o,r,n),!0}static _getTypeText(e,t,n=!1){const i=t.getType(e)||c.UnknownType.create();return": "+t.printType(i,n)}static _addDocumentationPart(e,t,n,i,s,r){const a=s.getType(i);a&&this._addDocumentationPartForType(e,t,n,a,r,s)}static _addDocumentationPartForType(e,t,n,i,s,r){const a=(0,y.getDocumentationPartsForTypeAndDecl)(t,i,s,r);let o=!1;for(const t of a)t&&(o=!0,this._addDocumentationResultsPart(e,n,t));return o}static _addDocumentationResultsPart(e,t,n){if(n)if(e===a.MarkupKind.Markdown){const e=(0,o.convertDocStringToMarkdown)(n);t.length>0&&e.length>0&&t.push({text:"---\n"}),this._addResultsPart(t,e)}else e===a.MarkupKind.PlainText?this._addResultsPart(t,(0,o.convertDocStringToPlainText)(n)):(0,u.fail)(`Unsupported markup type: ${e}`)}static _addResultsPart(e,t,n=!1){e.push({python:n,text:t})}},t.convertHoverResults=function(e,t){if(!t)return;const n=t.parts.map((t=>{if(t.python){if(e===a.MarkupKind.Markdown)return"```python\n"+t.text+"\n```\n";if(e===a.MarkupKind.PlainText)return t.text+"\n\n";(0,u.fail)(`Unsupported markup type: ${e}`)}return t.text})).join("").trimEnd();return{contents:{kind:e,value:n},range:t.range}}},4969:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ImportSorter=void 0;const i=n(7012),s=n(3213),r=n(1464),a=n(3550);t.ImportSorter=class{constructor(e,t){this._parseResults=e,this._cancellationToken=t}sort(){(0,s.throwIfCancellationRequested)(this._cancellationToken);const e=[],t=(0,i.getTopLevelImports)(this._parseResults.parseTree),n=t.orderedImports.map((e=>e)).sort(((e,t)=>(0,i.compareImportStatements)(e,t)));if(0===n.length)return[];const r=this._getPrimaryReplacementRange(t.orderedImports);return e.push({range:r,replacementText:this._generateSortedImportText(n)}),this._addSecondaryReplacementRanges(t.orderedImports,e),e}_getPrimaryReplacementRange(e){let t=e.findIndex((e=>e.followsNonImportStatement));t<0&&(t=e.length);const n=e[t-1].node;return{start:(0,r.convertOffsetToPosition)(e[0].node.start,this._parseResults.tokenizerOutput.lines),end:(0,r.convertOffsetToPosition)(a.TextRange.getEnd(n),this._parseResults.tokenizerOutput.lines)}}_addSecondaryReplacementRanges(e,t){let n=e.findIndex((e=>e.followsNonImportStatement));if(!(n<0))for(;;){let i=e.findIndex(((e,t)=>t>n&&e.followsNonImportStatement));if(i<0&&(i=e.length),t.push({range:{start:(0,r.convertOffsetToPosition)(e[n].node.start,this._parseResults.tokenizerOutput.lines),end:(0,r.convertOffsetToPosition)(a.TextRange.getEnd(e[i-1].node),this._parseResults.tokenizerOutput.lines)},replacementText:""}),n=i,n>=e.length)break}}_generateSortedImportText(e){let t="",n=(0,i.getImportGroup)(e[0]);for(const s of e){const r=(0,i.getImportGroup)(s);let a;n!==r&&(t+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence,n=r),a=20===s.node.nodeType?this._formatImportNode(s.subnode,s.moduleName):this._formatImportFromNode(s.node,s.moduleName),s!==e[e.length-1]&&(a+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence),t+=a}return t}_formatImportNode(e,t){let n=`import ${t}`;return e.alias&&(n+=` as ${e.alias.value}`),n}_formatImportFromNode(e,t){const n=e.imports.sort(((e,t)=>this._compareSymbols(e,t))).map((e=>{let t=e.name.value;return e.alias&&(t+=` as ${e.alias.value}`),t}));let i=`from ${t} import `;if(e.isWildcardImport)return i+"*";const s=n.join(", ");if(i.length+s.length<=88)return i+s;i+="("+this._parseResults.tokenizerOutput.predominantEndOfLineSequence;for(const e of n)i+=this._parseResults.tokenizerOutput.predominantTabSequence+e+","+this._parseResults.tokenizerOutput.predominantEndOfLineSequence;return i+=")",i}_compareSymbols(e,t){return e.name.value<t.name.value?-1:1}}},2858:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.performQuickAction=void 0;const a=n(7012),o=r(n(8494)),l=n(3213),c=n(1464),p=n(3550),d=n(4969);t.performQuickAction=function(e,t,n,i){return"pyright.organizeimports"===e?new d.ImportSorter(n,i).sort():"pyright.addoptionalforparam"===e&&t.length>=1?function(e,t,n){(0,l.throwIfCancellationRequested)(n);let i=o.findNodeByOffset(e.parseTree,t);for(;i&&41!==i.nodeType;)i=i.parent;if(!i)return[];const s=i.typeAnnotation||i.typeAnnotationComment;if(!s)return[];const r=[],d=(0,c.convertOffsetToPosition)(s.start,e.tokenizerOutput.lines),u=(0,c.convertOffsetToPosition)(p.TextRange.getEnd(s),e.tokenizerOutput.lines);r.push({range:{start:d,end:d},replacementText:"Optional["}),r.push({range:{start:u,end:u},replacementText:"]"});const m=(0,a.getTopLevelImports)(e.parseTree),h=m.orderedImports.find((e=>"typing"===e.moduleName));if(h&&22===h.node.nodeType&&!h.node.isWildcardImport){const t=(0,a.getTextEditsForAutoImportSymbolAddition)({name:"Optional"},h,e);r.push(...t)}else{const t=(0,a.getTextEditsForAutoImportInsertion)({name:"Optional"},m,"typing",0,e,d);r.push(...t)}return r}(n,parseInt(t[0],10),i):[]}},4952:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ReferencesProvider=t.FindReferencesTreeWalker=t.ReferencesResult=void 0;const a=r(n(8494)),o=n(3213),l=n(1464),c=n(3550),p=n(8127);class d{constructor(e,t,n,i,s){this.requiresGlobalSearch=e,this.nodeAtOffset=t,this.symbolName=n,this.declarations=i,this._reporter=s,this._locations=[]}get locations(){return this._locations}addLocations(...e){0!==e.length&&(this._reporter&&this._reporter(e),this._locations.push(...e))}}t.ReferencesResult=d;class u{constructor(e,t,n,i,s,r){this._parseResults=e,this._filePath=t,this._referencesResult=n,this._includeDeclaration=i,this._evaluator=s,this._cancellationToken=r}findReferences(e=this._parseResults.parseTree){const t=new p.DocumentSymbolCollector(this._referencesResult.symbolName,this._referencesResult.declarations,this._evaluator,this._cancellationToken,e,!0),n=[];for(const e of t.collect())(this._includeDeclaration||e.node!==this._referencesResult.nodeAtOffset)&&n.push({path:this._filePath,range:{start:(0,l.convertOffsetToPosition)(e.range.start,this._parseResults.tokenizerOutput.lines),end:(0,l.convertOffsetToPosition)(c.TextRange.getEnd(e.range),this._parseResults.tokenizerOutput.lines)}});return n}}t.FindReferencesTreeWalker=u,t.ReferencesProvider=class{static getDeclarationForNode(e,t,n,i,s,r){(0,o.throwIfCancellationRequested)(r);const l=p.DocumentSymbolCollector.getDeclarationsForNode(n,i,!1,r,e);if(0===l.length)return;const c=l.some((e=>{var n,i;if(e.path!==t)return!0;const s=a.getEvaluationScopeNode(e.node);return 36===s.nodeType||10===s.nodeType||35===(null===(i=null===(n=e.node)||void 0===n?void 0:n.parent)||void 0===i?void 0:i.nodeType)&&e.node===e.node.parent.memberName}));return new d(c,n,n.value,l,s)}static getDeclarationForPosition(e,t,n,i,s,r,c){(0,o.throwIfCancellationRequested)(c);const p=(0,l.convertPositionToOffset)(i,t.tokenizerOutput.lines);if(void 0===p)return;const d=a.findNodeByOffset(t.parseTree,p);return void 0!==d&&38===d.nodeType?this.getDeclarationForNode(e,n,d,s,r,c):void 0}static addReferences(e,t,n,i,s,r){const a=new u(e,t,n,i,s,r);n.addLocations(...a.findReferences())}}},1670:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenameModuleProvider=void 0;const i=n(4494),s=n(563),r=n(8905),a=n(5523),o=n(2374),l=n(7012),c=n(8494),p=n(427),d=n(8816),u=n(9489),m=n(2489),h=n(5839),y=n(6657),g=n(1464),f=n(3550),T=n(5275),_=n(8127);var v;!function(e){e[e.File=0]="File",e[e.Folder=1]="Folder",e[e.Symbol=2]="Symbol"}(v||(v={}));class b{constructor(e,t,n,i,s,r,a,o,l){if(this._fs=e,this._evaluator=t,this._moduleFilePath=n,this._moduleNameAndType=s,this._newModuleNameAndType=r,this._type=a,this._declarations=o,this._token=l,this._results=new Map,this._aliasIntroduced=new Set,this._newModuleFilePath=(0,y.resolvePaths)(i),this._moduleNames=this._moduleName.split("."),this._newModuleNames=this._newModuleName.split("."),this._moduleNames.length!==this._newModuleNames.length)return void(this._onlyNameChanged=!1);let c=0;for(c=0;c<this._moduleNames.length-1&&this._moduleNames[c]===this._newModuleNames[c];c++);this._onlyNameChanged=c===this._moduleNames.length-1,(0,h.assert)(this._type!==v.Folder||this._onlyNameChanged,"We only support simple rename for folder")}static createForModule(e,t,n,i,s,r){if(e.fileSystem.existsSync(i)){if((0,y.isFile)(e.fileSystem,i))return this._create(e,t,n,i,s,v.File,r);if((0,y.isDirectory)(e.fileSystem,i)){if("Renamed"!==(0,y.getDirectoryChangeKind)(e.fileSystem,i,s))return;let a=(0,y.combinePaths)(i,"__init__.pyi");if(!e.fileSystem.existsSync(a)&&(a=(0,y.combinePaths)(i,"__init__.py"),!e.fileSystem.existsSync(a)))return;return this._create(e,t,n,a,(0,y.combinePaths)(s,(0,y.getFileName)(a)),v.Folder,r)}}}static createForSymbol(e,t,n,i,s,a,o){if(!e.fileSystem.existsSync(i))return;const l=a.filter((e=>(0,r.isClassDeclaration)(e)||(0,r.isFunctionDeclaration)(e)||(0,r.isVariableDeclaration)(e)));return 0!==l.length?this._create(e,t,n,i,s,v.Symbol,l,o):void 0}static _create(e,t,n,s,r,l,c,p){const u=t.findExecEnvironment(s),m=e.getModuleNameForImport(s,u);if(!m.moduleName)return;const h=e.getModuleNameForImport(r,u);if(!h.moduleName)return;p=i.CancellationToken.is(c)?c:p;const y=i.CancellationToken.is(c)?[]:c;return 0===y.length&&(y.push((0,a.createSynthesizedAliasDeclaration)(s)),(0,d.isStubFile)(s)&&(e.resolveImport(s,u,(0,o.createImportedModuleDescriptor)(m.moduleName)),e.getSourceFilesFromStub(s,u,!1).forEach((e=>y.push((0,a.createSynthesizedAliasDeclaration)(e)))))),new b(e.fileSystem,n,s,r,m,h,l,y,p)}renameReferences(e,t){switch(this._type){case v.Folder:return this._renameFolderReferences(e,t);case v.File:return this._renameModuleReferences(e,t);case v.Symbol:return this._updateSymbolReferences(e,t);default:return(0,h.assertNever)(this._type,`${this._type} is unknown`)}}_updateSymbolReferences(e,t){var n,i,s,o;const p=new _.DocumentSymbolCollector(null!==(n=(0,a.getNameFromDeclaration)(this._declarations[0]))&&void 0!==n?n:"",this._declarations,this._evaluator,this._token,t.parseTree,!0),d=(0,l.getTopLevelImports)(t.parseTree,!0),m=d.orderedImports.find((e=>e.moduleName===this._newModuleName)),h=new Set,y=new Map;for(const n of p.collect()){const a=n.node;if(49===a.nodeType)continue;if((0,c.isFromImportName)(a)){const n=null===(i=a.parent)||void 0===i?void 0:i.parent,r=this._getNewModuleName(e,n.module.leadingDots>0,!1);if(1===n.imports.length)this._addResultWithTextRange(e,n.module,t,r);else{const i=a.parent;this._addFromImportNameDeletion(e,t,h,n.imports,i);const o={name:i.name.value,alias:null===(s=i.alias)||void 0===s?void 0:s.value};this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,n,t,h,d,r,[o]))}continue}const l=(0,c.getDottedNameWithGivenNodeAsLastName)(a);if(l===a||35!==l.nodeType)continue;const p=35===l.leftExpression.nodeType?l.leftExpression.memberName:38===l.leftExpression.nodeType?l.leftExpression:void 0;if(!p)continue;const m=null===(o=this._evaluator.getDeclarationsForNameNode(p))||void 0===o?void 0:o.filter((e=>(0,r.isAliasDeclaration)(e)&&(21===e.node.nodeType||23===e.node.nodeType)));if(!m||0===m.length)continue;const g=m[0].node;(0,u.getOrAdd)(y,g,(()=>[])).push(l)}for(const[n,i]of y){let s;if(this._canReplaceImportName(t,n,i)){const i=this._getReferenceModuleName(d,m);if(21===n.nodeType)i?(s=i,this._addImportNameDeletion(e,t,h,n.parent.list,n)):(s=n.alias?n.alias.value:this._newModuleName,this._addResultWithTextRange(e,n.module,t,this._newModuleName));else if(i)s=i,this._addFromImportNameDeletion(e,t,h,n.parent.imports,n);else{const i=n.parent,r=this._getNewModuleName(e,i.module.leadingDots>0,!0);s=n.alias?n.alias.value:this._newLastModuleName,this._addResultWithTextRange(e,i.module,t,r),this._addResultWithTextRange(e,n.name,t,this._newLastModuleName)}}else{const n=this._getReferenceModuleName(d,m);n?s=n:(s=this._newModuleName,this._addResultEdits((0,l.getTextEditsForAutoImportInsertion)([],d,this._newModuleName,(0,l.getImportGroupFromModuleNameAndType)(this._newModuleNameAndType),t,(0,g.convertOffsetToPosition)(t.parseTree.length,t.tokenizerOutput.lines)).map((t=>({filePath:e,range:t.range,replacementText:t.replacementText})))))}for(const n of i)this._addResultWithTextRange(e,n.leftExpression,t,s)}}_getReferenceModuleName(e,t){var n,i;if(t&&20===t.node.nodeType)return(null===(n=t.subnode)||void 0===n?void 0:n.alias)?t.subnode.alias.value:this._newModuleName;if(null===(i=e.implicitImports)||void 0===i?void 0:i.has(this._newModuleFilePath)){const t=e.implicitImports.get(this._newModuleFilePath);return t.alias?t.alias.value:t.name.value}}_canReplaceImportName(e,t,n){var i;const s=null!==(i=t.alias)&&void 0!==i?i:21===t.nodeType?t.module.nameParts[t.module.nameParts.length-1]:t.name,r=_.DocumentSymbolCollector.getDeclarationsForNode(s,this._evaluator,!1,this._token);if(0===r.length)return!1;const a=new _.DocumentSymbolCollector(s.value,r,this._evaluator,this._token,e.parseTree,!0);for(const e of a.collect())if(!((0,c.isImportModuleName)(e.node)||(0,c.isImportAlias)(e.node)||(0,c.isFromImportModuleName)(e.node)||(0,c.isFromImportName)(e.node)||(0,c.isFromImportAlias)(e.node)||n.some((t=>f.TextRange.containsRange(t,e.node)))))return!1;return!0}_renameFolderReferences(e,t){const n=new _.DocumentSymbolCollector(this.lastModuleName,this._declarations,this._evaluator,this._token,t.parseTree,!0);for(const i of n.collect())this._addResultWithTextRange(e,i.range,t,this._newLastModuleName)}_renameModuleReferences(e,t){const n=new _.DocumentSymbolCollector(this.lastModuleName,this._declarations,this._evaluator,this._token,t.parseTree,!0),i=new Set,s=n.collect();this._updateModuleReferences(e,t,i,s),this._updateRelativeModuleNamePath(e,t,i,s)}_updateRelativeModuleNamePath(e,t,n,i){if(e!==this._moduleFilePath)return;let s;for(const r of this._getNewRelativeModuleNamesForFileMoved(e,I.collect(t.parseTree).filter((e=>!i.some((t=>f.TextRange.containsRange(e.parent,t.node))))))){if(this._addResultWithTextRange(e,r.moduleName,t,r.newModuleName),!r.itemsToMove)continue;const i=r.moduleName.parent;for(const s of r.itemsToMove)this._addFromImportNameDeletion(e,t,n,i.imports,s);s=null!=s?s:(0,l.getTopLevelImports)(t.parseTree,!1),this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,i,t,n,s,(0,l.getRelativeModuleName)(this._fs,this._newModuleFilePath,this._newModuleFilePath,!1,!0),r.itemsToMove.map((e=>{var t;return{name:e.name.value,alias:null===(t=e.alias)||void 0===t?void 0:t.value}}))))}}_updateModuleReferences(e,t,n,i){var s,a,o,p,d;let u;for(const m of i){const h=m.node;if(49===h.nodeType){this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}if((0,c.isImportModuleName)(h)){if(!(0,c.isLastNameOfModuleName)(h))continue;const n=(0,c.getFirstAncestorOrSelfOfKind)(h,37);if(1===n.nameParts.length&&21===(null===(s=n.parent)||void 0===s?void 0:s.nodeType)&&!n.parent.alias&&this._newModuleNames.length>1){this._aliasIntroduced.add(n.parent),this._addResultWithTextRange(e,n,t,`${this._newModuleName} as ${this._newLastModuleName}`);continue}this._addResultWithTextRange(e,n,t,this._newModuleName);continue}if((0,c.isImportAlias)(h)){this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}if((0,c.isFromImportModuleName)(h)){if(!(0,c.isLastNameOfModuleName)(h))continue;const s=(0,c.getFirstAncestorOrSelfOfKind)(h,37),r=s.parent,a=[],o=[];for(const e of r.imports)this._isExportedSymbol(e.name)?a.push(e):o.push(e);if(0===o.length){this._addResultWithTextRange(e,s,t,this._getNewModuleName(e,s.leadingDots>0,!1));continue}if(0===a.length)continue;if(r.module.leadingDots>0)for(const n of this._getNewRelativeModuleNamesForFileMoved(e,[r.module]))this._addResultWithTextRange(e,n.moduleName,t,n.newModuleName);for(const i of a)this._addFromImportNameDeletion(e,t,n,r.imports,i);u=null!=u?u:(0,l.getTopLevelImports)(t.parseTree,!1),this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,r,t,n,u,this._newModuleName,a.map((e=>{var t;return{name:i.findIndex((t=>t.node===e.name))>=0?this._newLastModuleName:e.name.value,alias:i.findIndex((t=>t.node===e.alias))>=0?this._newLastModuleName:null===(t=e.alias)||void 0===t?void 0:t.value}}))));continue}if((0,c.isFromImportName)(h)){if(n.has(h.id))continue;const i=null===(a=h.parent)||void 0===a?void 0:a.parent,s=this._getNewModuleName(e,i.module.leadingDots>0,!0);if(this._isExportedSymbol(h)){this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}if(1===i.imports.length)this._addResultWithTextRange(e,i.module,t,s),this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);else{const r=h.parent;if(i.module.leadingDots>0)for(const n of this._getNewRelativeModuleNamesForFileMoved(e,[i.module]))this._addResultWithTextRange(e,n.moduleName,t,n.newModuleName);this._addFromImportNameDeletion(e,t,n,i.imports,r),u=null!=u?u:(0,l.getTopLevelImports)(t.parseTree,!1);const a={name:this._newLastModuleName,alias:(null===(o=r.alias)||void 0===o?void 0:o.value)===this.lastModuleName?this._newLastModuleName:null===(p=r.alias)||void 0===p?void 0:p.value};this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,i,t,n,u,s,[a]))}continue}if((0,c.isFromImportAlias)(h)){if(n.has(h.id))continue;this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}const y=_.DocumentSymbolCollector.getDeclarationsForNode(h,this._evaluator,!1,this._token).filter((e=>(0,r.isAliasDeclaration)(e)));if(this._onlyNameChanged)this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);else if(null==y?void 0:y.some((e=>!(e.usesLocalName||e.node&&21!==e.node.nodeType||this._aliasIntroduced.has(e.node))))){const n=(0,c.getDottedNameWithGivenNodeAsLastName)(h);if(35!==(null===(d=n.parent)||void 0===d?void 0:d.nodeType)){this._addResultWithTextRange(e,n,t,this._newModuleName);continue}const i=this._evaluator.getDeclarationsForNameNode(n.parent.memberName);if(!i||0===i.length)continue;this._addResultWithTextRange(e,n,t,this._newModuleName)}else m.node.value===this._newLastModuleName||this._addResultWithTextRange(e,m.range,t,this._newLastModuleName)}}_getNewRelativeModuleNamesForFileMoved(e,t){if(e!==this._moduleFilePath)return[];const n="__init__"===(0,y.stripFileExtension)((0,y.getFileName)(e)),i=(0,y.getDirectoryPath)(e),s=[];for(const e of t){if(0===e.leadingDots)continue;const t=this._getNewModuleNameInfoForFileMoved(e,n,i);if(!t)continue;const r=(0,l.getRelativeModuleName)(this._fs,t.src,t.dest,!1,!0);s.push({moduleName:e,newModuleName:r,itemsToMove:t.itemsToMove})}return s}_getNewModuleNameInfoForFileMoved(e,t,n){const i=(0,s.getImportInfo)(e);if(!i)return;let r=i.resolvedPaths[i.resolvedPaths.length-1];if(!r){if(0!==e.nameParts.length)return;{const t=(0,l.getDirectoryLeadingDotsPointsTo)(n,e.leadingDots);if(!t)return;r=(0,y.combinePaths)(t,"__init__.py")}}if(this._moduleFilePath!==r||!t)return{src:this._newModuleFilePath,dest:r};const a=[],o=[];for(const t of e.parent.imports)this._isExportedSymbol(t.name)?a.push(t):o.push(t);return 0===o.length?{src:this._newModuleFilePath,dest:this._newModuleFilePath}:0===a.length?{src:this._newModuleFilePath,dest:this._moduleFilePath}:{src:this._newModuleFilePath,dest:this._moduleFilePath,itemsToMove:[...a]}}_isExportedSymbol(e){const t=this._evaluator.getDeclarationsForNameNode(e);return!!t&&!t.some((e=>(0,r.isAliasDeclaration)(e)&&e.submoduleFallback))}_getNewModuleName(e,t,n){const i=e===this._moduleFilePath?this._newModuleFilePath:e,s=t?(0,l.getRelativeModuleName)(this._fs,i,this._newModuleFilePath,n,!0):this._newModuleName;if(n&&s.endsWith(this._newLastModuleName)){const e=s===this._newLastModuleName?0:s.length>this._newLastModuleName.length+1&&"."!==s[s.length-this._newLastModuleName.length-2]?1:0,t=s.length-this._newLastModuleName.length-e,n=s.substr(0,t);return n.length>0?n:"."}return s}getEdits(){const e=[];return this._results.forEach((t=>e.push(...t))),e}get lastModuleName(){return this._moduleNames[this._moduleNames.length-1]}get _moduleName(){return this._moduleNameAndType.moduleName}get _newLastModuleName(){return this._newModuleNames[this._newModuleNames.length-1]}get _newModuleName(){return this._newModuleNameAndType.moduleName}_addImportNameDeletion(e,t,n,i,s){this._addImportNameDeletionInternal(e,t,n,i,s,20),n.add(s.module.id),s.module.nameParts.forEach((e=>n.add(e.id))),s.alias&&n.add(s.alias.id)}_addFromImportNameDeletion(e,t,n,i,s){this._addImportNameDeletionInternal(e,t,n,i,s,22),n.add(s.name.id),s.alias&&n.add(s.alias.id)}_addImportNameDeletionInternal(e,t,n,i,s,r){const a=(0,l.getTextRangeForImportNameDeletion)(i,i.findIndex((e=>e===s)));this._addResultWithTextRange(e,a,t,""),n.add(s.id);let o=0;for(o=i.length-1;o>=0&&n.has(i[o].id);o--);if(-1===o){const n=(0,c.getFirstAncestorOrSelfOfKind)(s,r);n&&this._addResultWithRange(e,(0,c.getFullStatementRange)(n,t.tokenizerOutput),"")}else if(o>=0&&o<i.length-2){const n=f.TextRange.getEnd(i[o]),s=f.TextRange.getEnd(i[o+1])-n;this._addResultWithTextRange(e,{start:n,length:s},t,"")}}_addResultWithTextRange(e,t,n,i){n.text.substr(t.start,t.length)!==i&&this._addResultWithRange(e,(0,g.convertTextRangeToRange)(t,n.tokenizerOutput.lines),i)}_addResultEdits(e){e.forEach((e=>this._addResultWithRange(e.filePath,e.range,e.replacementText)))}_getDeletionsForSpan(e,t){var n;return(0,m.isString)(e)&&(e=null!==(n=this._results.get(e))&&void 0!==n?n:[]),e.filter((e=>""===e.replacementText&&(0,f.doRangesIntersect)(e.range,t)))}_removeEdits(e,t){var n;(0,m.isString)(e)&&(e=null!==(n=this._results.get(e))&&void 0!==n?n:[]),(0,u.removeArrayElements)(e,(e=>t.findIndex((t=>t===e))>=0))}_addResultWithRange(e,t,n){const i=(0,u.getOrAdd)(this._results,e,(()=>[]));if(""===n){const e=this._getDeletionsForSpan(i,t);e.length>0&&(this._removeEdits(i,e),(0,f.extendRange)(t,e.map((e=>e.range))))}i.some((e=>(0,f.rangesAreEqual)(e.range,t)&&e.replacementText===n))||i.push({filePath:e,range:t,replacementText:n})}_getTextEditsForNewOrExistingFromImport(e,t,n,i,s,r,a){const o=s.orderedImports.find((e=>e.moduleName===r));if(o&&22===o.node.nodeType&&!o.node.isWildcardImport){const s=(0,l.getTextEditsForAutoImportSymbolAddition)(a,o,n);if(o.node!==t)return s.map((t=>({filePath:e,range:t.range,replacementText:t.replacementText})));if(this._onlyNameChanged&&1===a.length&&1===s.length){const r=this._getDeletionsForSpan(e,s[0].range);if(0===r.length)return[{filePath:e,range:s[0].range,replacementText:s[0].replacementText}];{const s=a[0].alias===this._newLastModuleName?this.lastModuleName:a[0].alias,o=t.imports.find((e=>{var t;return e.name.value===this.lastModuleName&&(null===(t=e.alias)||void 0===t?void 0:t.value)===s}));if(o)return this._removeEdits(e,r),o.alias&&i.delete(o.alias.id),[{filePath:e,range:(0,g.convertTextRangeToRange)(o.name,n.tokenizerOutput.lines),replacementText:this._newLastModuleName}]}}}return(0,l.getTextEditsForAutoImportInsertion)(a,s,r,(0,l.getImportGroupFromModuleNameAndType)(this._newModuleNameAndType),n,(0,g.convertOffsetToPosition)(n.parseTree.length,n.tokenizerOutput.lines)).map((t=>({filePath:e,range:t.range,replacementText:t.replacementText})))}}t.RenameModuleProvider=b;class I extends p.ParseTreeWalker{constructor(){super(...arguments),this._result=[]}walk(e){(0,T.isExpressionNode)(e)||super.walk(e)}visitModuleName(e){return this._result.push(e),!1}static collect(e){const t=new I;return t.walk(e),t._result}}},9437:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SignatureHelpProvider=void 0;const a=n(4494),o=n(1272),l=n(5678),c=r(n(8494)),p=n(8494),d=n(3213),u=n(1464),m=n(3490);t.SignatureHelpProvider=class{static getSignatureHelpForPosition(e,t,n,i,s,r){var a;(0,d.throwIfCancellationRequested)(r);const o=(0,u.convertPositionToOffset)(t,e.tokenizerOutput.lines);if(void 0===o)return;let l=c.findNodeByOffset(e.parseTree,o);const m=l,h=l?c.getNodeDepth(l):0;let y=o-1;for(;y>=0&&","!==e.text.substr(y,1);){const t=c.findNodeByOffset(e.parseTree,y);if(t&&t!==m){c.getNodeDepth(t)>h&&(l=t);break}y--}if(void 0===l)return;const g=(0,p.getCallNodeAndActiveParameterIndex)(l,o,e.tokenizerOutput.tokens);if(!g)return;const f=i.getCallSignatureInfo(g.callNode,g.activeIndex,g.activeOrFake);return f?{signatures:f.signatures.map((e=>this._makeSignature(f.callNode,e,n,i,s))),callHasParameters:!!(null===(a=f.callNode.arguments)||void 0===a?void 0:a.length)}:void 0}static _makeSignature(e,t,n,i,s){var r;const c=t.type,p=i.printFunctionParts(c),d=[],u=null!==(r=(0,m.getFunctionDocStringFromType)(c,n,i))&&void 0!==r?r:this._getDocStringFromCallNode(e,n,i);let h="(";const y=c.details.parameters;let g;p[0].forEach(((e,t)=>{let n="";t<y.length?n=y[t].name||"":y.length>0&&(n=y[y.length-1].name||""),d.push({startOffset:h.length,endOffset:h.length+e.length,text:e,documentation:(0,l.extractParameterDocumentation)(u||"",n)}),h+=e,t<p[0].length-1&&(h+=", ")})),h+=") -> "+p[1],t.activeParam&&(g=y.indexOf(t.activeParam),-1===g&&(g=void 0));const f={label:h,parameters:d,activeParameter:g};return u&&(s===a.MarkupKind.Markdown?f.documentation={kind:a.MarkupKind.Markdown,value:(0,o.convertDocStringToMarkdown)(u)}:f.documentation={kind:a.MarkupKind.PlainText,value:(0,o.convertDocStringToPlainText)(u)}),f}static _getDocStringFromCallNode(e,t,n){var i;let s;const r=e.leftExpression;if(38===r.nodeType?s=r:35===r.nodeType&&(s=r.memberName),s)for(const e of null!==(i=n.getDeclarationsForNameNode(s))&&void 0!==i?i:[]){const i=n.resolveAliasDeclaration(e,!0);if(!i)continue;const r=n.getType(s);if(!r)continue;const a=(0,m.getDocumentationPartsForTypeAndDecl)(t,r,i,n);if(a.length>0)return a.join("\n\n")}}}},3490:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getAutoImportText=t.getDocumentationPartsForTypeAndDecl=t.getFunctionDocStringFromType=t.getOverloadedFunctionTooltip=void 0;const a=r(n(8494)),o=n(3371),l=n(1133);function c(e,t,n){const i=e.details.declaration,s=i?a.getEnclosingClass(i.node):void 0,r=s?n.getTypeOfClass(s):void 0;return(0,o.getFunctionDocStringInherited)(e,i,t,null==r?void 0:r.classType)}t.getOverloadedFunctionTooltip=function(e,t,n=70){let i="";const s=e.overloads.filter((e=>l.FunctionType.isOverloaded(e))).map((e=>e.details.name+t.printType(e,!1)));for(let e=0;e<s.length;e++)0!==e&&s[e].length>n&&s[e-1].length<=n&&(i+="\n"),i+=s[e],e<s.length-1&&(i+="\n",s[e].length>n&&(i+="\n"));return i},t.getFunctionDocStringFromType=c,t.getDocumentationPartsForTypeAndDecl=function(e,t,n,i){if(1===(null==n?void 0:n.type)&&n.typeAliasName&&n.docString)return[n.docString];if((0,l.isModule)(t)){const i=(0,o.getModuleDocString)(t,n,e);if(i)return[i]}else if((0,l.isInstantiableClass)(t)){const i=(0,o.getClassDocString)(t,n,e);if(i)return[i]}else if((0,l.isFunction)(t)){if(3===(null==n?void 0:n.type)||4===(null==n?void 0:n.type)){const n=c(t,e,i);if(n)return[n]}}else{if((0,l.isOverloadedFunction)(t)){const s=n?a.getEnclosingClass(n.node):void 0,r=s?i.getTypeOfClass(s):void 0;return(0,o.getOverloadedFunctionDocStringsInherited)(t,n,e,i,null==r?void 0:r.classType)}if(1===(null==n?void 0:n.type)){const t=(0,o.getVariableDocString)(n,e);if(t)return[t]}else if(3===(null==n?void 0:n.type)){const t=(0,o.getPropertyDocStringInherited)(n,e,i);if(t)return[t]}}return[]},t.getAutoImportText=function(e,t,n){let i;return i=t?`from ${t} import ${e}`:`import ${e}`,n&&(i=`${i} as ${n}`),i}},2122:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Localizer=t.setLocaleOverride=t.ParameterizedString=void 0;const i=n(5839),s=n(603),r=n(1783),a=n(1859),o=n(3409),l=n(6687),c=n(5491),p=n(3559),d=n(1308);class u{constructor(e){this._formatString=e}format(e){let t=this._formatString;return Object.keys(e).forEach((n=>{t=t.replace(`{${n}}`,e[n].toString())})),t}getFormatString(){return this._formatString}}t.ParameterizedString=u;const m="en-us",h=new Map([["de",r],["en-us",s],["es",a],["fr",o],["ja",l],["ru",c],["zh-cn",p],["zh-tw",d]]);let y,g,f={};function T(e){void 0===y&&(f=function(){const e=v(m);return e||(console.error("Could not load default strings"),{})}(),y=function(e){if(e===m)return{};let t=v(e);if(void 0!==t)return t;const n=e.split("-");return n.length>0&&n[0]&&(t=v(n[0]),void 0!==t)?t:{}}(function(){if(g)return g;try{if(null===navigator||void 0===navigator?void 0:navigator.language)return navigator.language.toLowerCase()}catch{}const e=process.env,t=e.VSCODE_NLS_CONFIG;if(t)try{return JSON.parse(t).locale}catch{}const n=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE;if(n){const e=n.split(".");if(e.length>0&&e[0])return e[0]}return m}()));const t=e.split("."),n=_(y,t)||_(f,t);if(n)return n;(0,i.fail)(`Missing localized string for key "${e}"`)}function _(e,t){let n=e;for(const e of t){if(!n[e])return;n=n[e]}return n}function v(e){return h.get(e)}t.setLocaleOverride=function(e){g=e.toLowerCase()},function(e){let t,n,i,s;!function(e){e.annotatedParamCountMismatch=()=>new u(T("Diagnostic.annotatedParamCountMismatch")),e.annotatedTypeArgMissing=()=>T("Diagnostic.annotatedTypeArgMissing"),e.annotationFormatString=()=>T("Diagnostic.annotationFormatString"),e.annotationNotSupported=()=>T("Diagnostic.annotationNotSupported"),e.annotationSpansStrings=()=>T("Diagnostic.annotationSpansStrings"),e.annotationStringEscape=()=>T("Diagnostic.annotationStringEscape"),e.argAssignment=()=>new u(T("Diagnostic.argAssignment")),e.argAssignmentFunction=()=>new u(T("Diagnostic.argAssignmentFunction")),e.argAssignmentParam=()=>new u(T("Diagnostic.argAssignmentParam")),e.argAssignmentParamFunction=()=>new u(T("Diagnostic.argAssignmentParamFunction")),e.argMissingForParam=()=>new u(T("Diagnostic.argMissingForParam")),e.argMissingForParams=()=>new u(T("Diagnostic.argMissingForParams")),e.argMorePositionalExpectedCount=()=>new u(T("Diagnostic.argMorePositionalExpectedCount")),e.argMorePositionalExpectedOne=()=>T("Diagnostic.argMorePositionalExpectedOne"),e.argPositional=()=>T("Diagnostic.argPositional"),e.argPositionalExpectedCount=()=>new u(T("Diagnostic.argPositionalExpectedCount")),e.argPositionalExpectedOne=()=>T("Diagnostic.argPositionalExpectedOne"),e.argTypePartiallyUnknown=()=>T("Diagnostic.argTypePartiallyUnknown"),e.argTypeUnknown=()=>T("Diagnostic.argTypeUnknown"),e.assertAlwaysTrue=()=>T("Diagnostic.assertAlwaysTrue"),e.assignmentExprContext=()=>T("Diagnostic.assignmentExprContext"),e.assignmentExprComprehension=()=>new u(T("Diagnostic.assignmentExprComprehension")),e.assignmentInProtocol=()=>T("Diagnostic.assignmentInProtocol"),e.assignmentTargetExpr=()=>T("Diagnostic.assignmentTargetExpr"),e.asyncNotInAsyncFunction=()=>T("Diagnostic.asyncNotInAsyncFunction"),e.awaitIllegal=()=>T("Diagnostic.awaitIllegal"),e.awaitNotInAsync=()=>T("Diagnostic.awaitNotInAsync"),e.backticksIllegal=()=>T("Diagnostic.backticksIllegal"),e.baseClassCircular=()=>T("Diagnostic.baseClassCircular"),e.baseClassInvalid=()=>T("Diagnostic.baseClassInvalid"),e.baseClassFinal=()=>new u(T("Diagnostic.baseClassFinal")),e.baseClassUnknown=()=>T("Diagnostic.baseClassUnknown"),e.bindTypeMismatch=()=>new u(T("Diagnostic.bindTypeMismatch")),e.breakOutsideLoop=()=>T("Diagnostic.breakOutsideLoop"),e.callableExtraArgs=()=>T("Diagnostic.callableExtraArgs"),e.callableFirstArg=()=>T("Diagnostic.callableFirstArg"),e.callableSecondArg=()=>T("Diagnostic.callableSecondArg"),e.casePatternIsIrrefutable=()=>T("Diagnostic.casePatternIsIrrefutable"),e.classDecoratorTypeUnknown=()=>T("Diagnostic.classDecoratorTypeUnknown"),e.classDefinitionCycle=()=>new u(T("Diagnostic.classDefinitionCycle")),e.classGetItemClsParam=()=>T("Diagnostic.classGetItemClsParam"),e.classMethodClsParam=()=>T("Diagnostic.classMethodClsParam"),e.classNotRuntimeSubscriptable=()=>new u(T("Diagnostic.classNotRuntimeSubscriptable")),e.classVarNotAllowed=()=>T("Diagnostic.classVarNotAllowed"),e.classVarFirstArgMissing=()=>T("Diagnostic.classVarFirstArgMissing"),e.classVarOverridesInstanceVar=()=>new u(T("Diagnostic.classVarOverridesInstanceVar")),e.classVarTooManyArgs=()=>T("Diagnostic.classVarTooManyArgs"),e.classVarWithTypeVar=()=>T("Diagnostic.classVarWithTypeVar"),e.clsSelfParamTypeMismatch=()=>new u(T("Diagnostic.clsSelfParamTypeMismatch")),e.comparisonAlwaysFalse=()=>new u(T("Diagnostic.comparisonAlwaysFalse")),e.comparisonAlwaysTrue=()=>new u(T("Diagnostic.comparisonAlwaysTrue")),e.comprehensionInDict=()=>T("Diagnostic.comprehensionInDict"),e.comprehensionInSet=()=>T("Diagnostic.comprehensionInSet"),e.concatenateParamSpecMissing=()=>T("Diagnostic.concatenateParamSpecMissing"),e.concatenateTypeArgsMissing=()=>T("Diagnostic.concatenateTypeArgsMissing"),e.constantRedefinition=()=>new u(T("Diagnostic.constantRedefinition")),e.constructorNoArgs=()=>new u(T("Diagnostic.constructorNoArgs")),e.continueInFinally=()=>T("Diagnostic.continueInFinally"),e.continueOutsideLoop=()=>T("Diagnostic.continueOutsideLoop"),e.dataClassBaseClassNotFrozen=()=>T("Diagnostic.dataClassBaseClassNotFrozen"),e.dataClassFieldWithDefault=()=>T("Diagnostic.dataClassFieldWithDefault"),e.dataClassSlotsOverwrite=()=>T("Diagnostic.dataClassSlotsOverwrite"),e.declaredReturnTypePartiallyUnknown=()=>new u(T("Diagnostic.declaredReturnTypePartiallyUnknown")),e.declaredReturnTypeUnknown=()=>T("Diagnostic.declaredReturnTypeUnknown"),e.defaultValueContainsCall=()=>T("Diagnostic.defaultValueContainsCall"),e.defaultValueNotAllowed=()=>T("Diagnostic.defaultValueNotAllowed"),e.defaultValueNotEllipsis=()=>T("Diagnostic.defaultValueNotEllipsis"),e.deprecatedType=()=>new u(T("Diagnostic.deprecatedType")),e.dictExpandIllegalInComprehension=()=>T("Diagnostic.dictExpandIllegalInComprehension"),e.dictInAnnotation=()=>T("Diagnostic.dictInAnnotation"),e.dictKeyValuePairs=()=>T("Diagnostic.dictKeyValuePairs"),e.dictUnpackIsNotMapping=()=>T("Diagnostic.dictUnpackIsNotMapping"),e.delTargetExpr=()=>T("Diagnostic.delTargetExpr"),e.dunderAllSymbolNotPresent=()=>new u(T("Diagnostic.dunderAllSymbolNotPresent")),e.duplicateArgsParam=()=>T("Diagnostic.duplicateArgsParam"),e.duplicateBaseClass=()=>T("Diagnostic.duplicateBaseClass"),e.duplicateCatchAll=()=>T("Diagnostic.duplicateCatchAll"),e.duplicateEnumMember=()=>new u(T("Diagnostic.duplicateEnumMember")),e.duplicateImport=()=>new u(T("Diagnostic.duplicateImport")),e.duplicateKwargsParam=()=>T("Diagnostic.duplicateKwargsParam"),e.duplicateKeywordOnly=()=>T("Diagnostic.duplicateKeywordOnly"),e.duplicateParam=()=>new u(T("Diagnostic.duplicateParam")),e.duplicateCapturePatternTarget=()=>new u(T("Diagnostic.duplicateCapturePatternTarget")),e.duplicateStarPattern=()=>T("Diagnostic.duplicateStarPattern"),e.duplicateStarStarPattern=()=>T("Diagnostic.duplicateStarStarPattern"),e.duplicatePositionOnly=()=>T("Diagnostic.duplicatePositionOnly"),e.duplicateUnpack=()=>T("Diagnostic.duplicateUnpack"),e.ellipsisContext=()=>T("Diagnostic.ellipsisContext"),e.ellipsisSecondArg=()=>T("Diagnostic.ellipsisSecondArg"),e.enumClassOverride=()=>new u(T("Diagnostic.enumClassOverride")),e.exceptionTypeIncorrect=()=>new u(T("Diagnostic.exceptionTypeIncorrect")),e.exceptionTypeNotClass=()=>new u(T("Diagnostic.exceptionTypeNotClass")),e.exceptionTypeNotInstantiable=()=>new u(T("Diagnostic.exceptionTypeNotInstantiable")),e.expectedAfterDecorator=()=>T("Diagnostic.expectedAfterDecorator"),e.expectedArrow=()=>T("Diagnostic.expectedArrow"),e.expectedAsAfterException=()=>T("Diagnostic.expectedAsAfterException"),e.expectedAssignRightHandExpr=()=>T("Diagnostic.expectedAssignRightHandExpr"),e.expectedBinaryRightHandExpr=()=>T("Diagnostic.expectedBinaryRightHandExpr"),e.expectedBoolLiteral=()=>T("Diagnostic.expectedBoolLiteral"),e.expectedCase=()=>T("Diagnostic.expectedCase"),e.expectedClassName=()=>T("Diagnostic.expectedClassName"),e.expectedCloseBrace=()=>T("Diagnostic.expectedCloseBrace"),e.expectedCloseBracket=()=>T("Diagnostic.expectedCloseBracket"),e.expectedCloseParen=()=>T("Diagnostic.expectedCloseParen"),e.expectedColon=()=>T("Diagnostic.expectedColon"),e.expectedComplexNumberLiteral=()=>T("Diagnostic.expectedComplexNumberLiteral"),e.expectedDecoratorExpr=()=>T("Diagnostic.expectedDecoratorExpr"),e.expectedDecoratorName=()=>T("Diagnostic.expectedDecoratorName"),e.expectedDecoratorNewline=()=>T("Diagnostic.expectedDecoratorNewline"),e.expectedDelExpr=()=>T("Diagnostic.expectedDelExpr"),e.expectedElse=()=>T("Diagnostic.expectedElse"),e.expectedExceptionClass=()=>T("Diagnostic.expectedExceptionClass"),e.expectedExceptionObj=()=>T("Diagnostic.expectedExceptionObj"),e.expectedExpr=()=>T("Diagnostic.expectedExpr"),e.expectedImport=()=>T("Diagnostic.expectedImport"),e.expectedImportAlias=()=>T("Diagnostic.expectedImportAlias"),e.expectedImportSymbols=()=>T("Diagnostic.expectedImportSymbols"),e.expectedIdentifier=()=>T("Diagnostic.expectedIdentifier"),e.expectedIndentedBlock=()=>T("Diagnostic.expectedIndentedBlock"),e.expectedIn=()=>T("Diagnostic.expectedIn"),e.expectedInExpr=()=>T("Diagnostic.expectedInExpr"),e.expectedFunctionAfterAsync=()=>T("Diagnostic.expectedFunctionAfterAsync"),e.expectedFunctionName=()=>T("Diagnostic.expectedFunctionName"),e.expectedMemberName=()=>T("Diagnostic.expectedMemberName"),e.expectedModuleName=()=>T("Diagnostic.expectedModuleName"),e.expectedNameAfterAs=()=>T("Diagnostic.expectedNameAfterAs"),e.expectedNamedParameter=()=>T("Diagnostic.expectedNamedParameter"),e.expectedNewline=()=>T("Diagnostic.expectedNewline"),e.expectedNewlineOrSemicolon=()=>T("Diagnostic.expectedNewlineOrSemicolon"),e.expectedOpenParen=()=>T("Diagnostic.expectedOpenParen"),e.expectedParamName=()=>T("Diagnostic.expectedParamName"),e.expectedPatternExpr=()=>T("Diagnostic.expectedPatternExpr"),e.expectedPatternSubjectExpr=()=>T("Diagnostic.expectedPatternSubjectExpr"),e.expectedPatternValue=()=>T("Diagnostic.expectedPatternValue"),e.expectedReturnExpr=()=>T("Diagnostic.expectedReturnExpr"),e.expectedSliceIndex=()=>T("Diagnostic.expectedSliceIndex"),e.expectedTypeNotString=()=>T("Diagnostic.expectedTypeNotString"),e.expectedYieldExpr=()=>T("Diagnostic.expectedYieldExpr"),e.finalClassIsAbstract=()=>new u(T("Diagnostic.finalClassIsAbstract")),e.finalContext=()=>T("Diagnostic.finalContext"),e.finalMethodOverride=()=>new u(T("Diagnostic.finalMethodOverride")),e.finalReassigned=()=>new u(T("Diagnostic.finalReassigned")),e.finalRedeclaration=()=>new u(T("Diagnostic.finalRedeclaration")),e.finalRedeclarationBySubclass=()=>new u(T("Diagnostic.finalRedeclarationBySubclass")),e.finalTooManyArgs=()=>T("Diagnostic.finalTooManyArgs"),e.finalUnassigned=()=>new u(T("Diagnostic.finalUnassigned")),e.formatStringBrace=()=>T("Diagnostic.formatStringBrace"),e.formatStringBytes=()=>T("Diagnostic.formatStringBytes"),e.formatStringEscape=()=>T("Diagnostic.formatStringEscape"),e.formatStringInPattern=()=>T("Diagnostic.formatStringInPattern"),e.formatStringIllegal=()=>T("Diagnostic.formatStringIllegal"),e.formatStringUnicode=()=>T("Diagnostic.formatStringUnicode"),e.formatStringUnterminated=()=>T("Diagnostic.formatStringUnterminated"),e.functionDecoratorTypeUnknown=()=>T("Diagnostic.functionDecoratorTypeUnknown"),e.generatorAsyncReturnType=()=>T("Diagnostic.generatorAsyncReturnType"),e.generatorSyncReturnType=()=>T("Diagnostic.generatorSyncReturnType"),e.genericClassAssigned=()=>T("Diagnostic.genericClassAssigned"),e.genericClassDeleted=()=>T("Diagnostic.genericClassDeleted"),e.genericNotAllowed=()=>T("Diagnostic.genericNotAllowed"),e.genericTypeAliasBoundTypeVar=()=>new u(T("Diagnostic.genericTypeAliasBoundTypeVar")),e.genericTypeArgMissing=()=>T("Diagnostic.genericTypeArgMissing"),e.genericTypeArgTypeVar=()=>T("Diagnostic.genericTypeArgTypeVar"),e.genericTypeArgUnique=()=>T("Diagnostic.genericTypeArgUnique"),e.globalReassignment=()=>new u(T("Diagnostic.globalReassignment")),e.globalRedefinition=()=>new u(T("Diagnostic.globalRedefinition")),e.implicitStringConcat=()=>T("Diagnostic.implicitStringConcat"),e.importCycleDetected=()=>T("Diagnostic.importCycleDetected"),e.importDepthExceeded=()=>new u(T("Diagnostic.importDepthExceeded")),e.importResolveFailure=()=>new u(T("Diagnostic.importResolveFailure")),e.importSourceResolveFailure=()=>new u(T("Diagnostic.importSourceResolveFailure")),e.importSymbolUnknown=()=>new u(T("Diagnostic.importSymbolUnknown")),e.incompatibleMethodOverride=()=>new u(T("Diagnostic.incompatibleMethodOverride")),e.inconsistentIndent=()=>T("Diagnostic.inconsistentIndent"),e.inconsistentTabs=()=>T("Diagnostic.inconsistentTabs"),e.initMustReturnNone=()=>T("Diagnostic.initMustReturnNone"),e.initSubclassClsParam=()=>T("Diagnostic.initSubclassClsParam"),e.instanceMethodSelfParam=()=>T("Diagnostic.instanceMethodSelfParam"),e.instanceVarOverridesClassVar=()=>new u(T("Diagnostic.instanceVarOverridesClassVar")),e.instantiateAbstract=()=>new u(T("Diagnostic.instantiateAbstract")),e.instantiateProtocol=()=>new u(T("Diagnostic.instantiateProtocol")),e.internalBindError=()=>new u(T("Diagnostic.internalBindError")),e.internalParseError=()=>new u(T("Diagnostic.internalParseError")),e.internalTypeCheckingError=()=>new u(T("Diagnostic.internalTypeCheckingError")),e.invalidIdentifierChar=()=>T("Diagnostic.invalidIdentifierChar"),e.invalidStubStatement=()=>T("Diagnostic.invalidStubStatement"),e.invalidTokenChars=()=>new u(T("Diagnostic.invalidTokenChars")),e.isInstanceInvalidType=()=>new u(T("Diagnostic.isInstanceInvalidType")),e.isSubclassInvalidType=()=>new u(T("Diagnostic.isSubclassInvalidType")),e.keyValueInSet=()=>T("Diagnostic.keyValueInSet"),e.keywordArgInTypeArgument=()=>T("Diagnostic.keywordArgInTypeArgument"),e.keywordOnlyAfterArgs=()=>T("Diagnostic.keywordOnlyAfterArgs"),e.keywordSubscriptIllegal=()=>T("Diagnostic.keywordSubscriptIllegal"),e.lambdaReturnTypeUnknown=()=>T("Diagnostic.lambdaReturnTypeUnknown"),e.lambdaReturnTypePartiallyUnknown=()=>new u(T("Diagnostic.lambdaReturnTypePartiallyUnknown")),e.listInAnnotation=()=>T("Diagnostic.listInAnnotation"),e.literalUnsupportedType=()=>T("Diagnostic.literalUnsupportedType"),e.literalEmptyArgs=()=>T("Diagnostic.literalEmptyArgs"),e.literalNotCallable=()=>T("Diagnostic.literalNotCallable"),e.matchIncompatible=()=>T("Diagnostic.matchIncompatible"),e.memberAccess=()=>new u(T("Diagnostic.memberAccess")),e.memberDelete=()=>new u(T("Diagnostic.memberDelete")),e.memberSet=()=>new u(T("Diagnostic.memberSet")),e.metaclassConflict=()=>T("Diagnostic.metaclassConflict"),e.metaclassDuplicate=()=>T("Diagnostic.metaclassDuplicate"),e.methodNotDefined=()=>new u(T("Diagnostic.methodNotDefined")),e.methodNotDefinedOnType=()=>new u(T("Diagnostic.methodNotDefinedOnType")),e.methodOrdering=()=>T("Diagnostic.methodOrdering"),e.methodOverridden=()=>new u(T("Diagnostic.methodOverridden")),e.methodReturnsNonObject=()=>new u(T("Diagnostic.methodReturnsNonObject")),e.moduleAsType=()=>T("Diagnostic.moduleAsType"),e.moduleUnknownMember=()=>new u(T("Diagnostic.moduleUnknownMember")),e.namedExceptAfterCatchAll=()=>T("Diagnostic.namedExceptAfterCatchAll"),e.namedParamAfterParamSpecArgs=()=>new u(T("Diagnostic.namedParamAfterParamSpecArgs")),e.namedTupleEmptyName=()=>T("Diagnostic.namedTupleEmptyName"),e.namedTupleFirstArg=()=>T("Diagnostic.namedTupleFirstArg"),e.namedTupleMultipleInheritance=()=>T("Diagnostic.namedTupleMultipleInheritance"),e.namedTupleNameType=()=>T("Diagnostic.namedTupleNameType"),e.namedTupleNameUnique=()=>T("Diagnostic.namedTupleNameUnique"),e.namedTupleNoTypes=()=>T("Diagnostic.namedTupleNoTypes"),e.namedTupleSecondArg=()=>T("Diagnostic.namedTupleSecondArg"),e.newClsParam=()=>T("Diagnostic.newClsParam"),e.newTypeLiteral=()=>T("Diagnostic.newTypeLiteral"),e.newTypeNotAClass=()=>T("Diagnostic.newTypeNotAClass"),e.newTypeProtocolClass=()=>T("Diagnostic.newTypeProtocolClass"),e.nonDefaultAfterDefault=()=>T("Diagnostic.nonDefaultAfterDefault"),e.noneNotCallable=()=>T("Diagnostic.noneNotCallable"),e.noneNotIterable=()=>T("Diagnostic.noneNotIterable"),e.noneNotSubscriptable=()=>T("Diagnostic.noneNotSubscriptable"),e.noneNotUsableWith=()=>T("Diagnostic.noneNotUsableWith"),e.noneOperator=()=>new u(T("Diagnostic.noneOperator")),e.noneUnknownMember=()=>new u(T("Diagnostic.noneUnknownMember")),e.nonLocalNoBinding=()=>new u(T("Diagnostic.nonLocalNoBinding")),e.nonLocalReassignment=()=>new u(T("Diagnostic.nonLocalReassignment")),e.nonLocalRedefinition=()=>new u(T("Diagnostic.nonLocalRedefinition")),e.nonLocalInModule=()=>T("Diagnostic.nonLocalInModule"),e.noOverload=()=>new u(T("Diagnostic.noOverload")),e.noReturnContainsReturn=()=>T("Diagnostic.noReturnContainsReturn"),e.noReturnContainsYield=()=>T("Diagnostic.noReturnContainsYield"),e.noReturnReturnsNone=()=>T("Diagnostic.noReturnReturnsNone"),e.notRequiredArgCount=()=>T("Diagnostic.notRequiredArgCount"),e.notRequiredNotInTypedDict=()=>T("Diagnostic.notRequiredNotInTypedDict"),e.objectNotCallable=()=>new u(T("Diagnostic.objectNotCallable")),e.obscuredClassDeclaration=()=>new u(T("Diagnostic.obscuredClassDeclaration")),e.obscuredFunctionDeclaration=()=>new u(T("Diagnostic.obscuredFunctionDeclaration")),e.obscuredMethodDeclaration=()=>new u(T("Diagnostic.obscuredMethodDeclaration")),e.obscuredParameterDeclaration=()=>new u(T("Diagnostic.obscuredParameterDeclaration")),e.obscuredVariableDeclaration=()=>new u(T("Diagnostic.obscuredVariableDeclaration")),e.operatorLessOrGreaterDeprecated=()=>T("Diagnostic.operatorLessOrGreaterDeprecated"),e.optionalExtraArgs=()=>T("Diagnostic.optionalExtraArgs"),e.orPatternIrrefutable=()=>T("Diagnostic.orPatternIrrefutable"),e.orPatternMissingName=()=>T("Diagnostic.orPatternMissingName"),e.overlappingOverload=()=>new u(T("Diagnostic.overlappingOverload")),e.overloadAbstractMismatch=()=>new u(T("Diagnostic.overloadAbstractMismatch")),e.overloadImplementationMismatch=()=>new u(T("Diagnostic.overloadImplementationMismatch")),e.overloadReturnTypeMismatch=()=>new u(T("Diagnostic.overloadReturnTypeMismatch")),e.overloadWithImplementation=()=>new u(T("Diagnostic.overloadWithImplementation")),e.overloadWithoutImplementation=()=>new u(T("Diagnostic.overloadWithoutImplementation")),e.paramAfterKwargsParam=()=>T("Diagnostic.paramAfterKwargsParam"),e.paramAlreadyAssigned=()=>new u(T("Diagnostic.paramAlreadyAssigned")),e.paramAnnotationMissing=()=>new u(T("Diagnostic.paramAnnotationMissing")),e.paramNameMissing=()=>new u(T("Diagnostic.paramNameMissing")),e.paramSpecArgsKwargsUsage=()=>T("Diagnostic.paramSpecArgsKwargsUsage"),e.paramSpecArgsUsage=()=>T("Diagnostic.paramSpecArgsUsage"),e.paramSpecAssignedName=()=>new u(T("Diagnostic.paramSpecAssignedName")),e.paramSpecContext=()=>T("Diagnostic.paramSpecContext"),e.paramSpecFirstArg=()=>T("Diagnostic.paramSpecFirstArg"),e.paramSpecKwargsUsage=()=>T("Diagnostic.paramSpecKwargsUsage"),e.paramSpecNotBound=()=>new u(T("Diagnostic.paramSpecNotBound")),e.paramSpecNotUsedByOuterScope=()=>new u(T("Diagnostic.paramSpecNotUsedByOuterScope")),e.paramSpecUnknownArg=()=>T("Diagnostic.paramSpecUnknownArg"),e.paramSpecUnknownMember=()=>new u(T("Diagnostic.paramSpecUnknownMember")),e.paramSpecUnknownParam=()=>new u(T("Diagnostic.paramSpecUnknownParam")),e.paramTypeCovariant=()=>T("Diagnostic.paramTypeCovariant"),e.paramTypeUnknown=()=>new u(T("Diagnostic.paramTypeUnknown")),e.paramAssignmentMismatch=()=>new u(T("Diagnostic.paramAssignmentMismatch")),e.paramTypePartiallyUnknown=()=>new u(T("Diagnostic.paramTypePartiallyUnknown")),e.parenthesizedContextManagerIllegal=()=>T("Diagnostic.parenthesizedContextManagerIllegal"),e.positionArgAfterNamedArg=()=>T("Diagnostic.positionArgAfterNamedArg"),e.privateImportFromPyTypedModule=()=>new u(T("Diagnostic.privateImportFromPyTypedModule")),e.positionOnlyAfterArgs=()=>T("Diagnostic.positionOnlyAfterArgs"),e.positionOnlyAfterKeywordOnly=()=>T("Diagnostic.positionOnlyAfterKeywordOnly"),e.positionOnlyIncompatible=()=>T("Diagnostic.positionOnlyIncompatible"),e.positionOnlyFirstParam=()=>T("Diagnostic.positionOnlyFirstParam"),e.privateUsedOutsideOfClass=()=>new u(T("Diagnostic.privateUsedOutsideOfClass")),e.privateUsedOutsideOfModule=()=>new u(T("Diagnostic.privateUsedOutsideOfModule")),e.propertyOverridden=()=>new u(T("Diagnostic.propertyOverridden")),e.propertyStaticMethod=()=>T("Diagnostic.propertyStaticMethod"),e.protectedUsedOutsideOfClass=()=>new u(T("Diagnostic.protectedUsedOutsideOfClass")),e.protocolBaseClass=()=>new u(T("Diagnostic.protocolBaseClass")),e.protocolIllegal=()=>T("Diagnostic.protocolIllegal"),e.protocolNotAllowedInTypeArgument=()=>T("Diagnostic.protocolNotAllowedInTypeArgument"),e.protocolUsedInCall=()=>new u(T("Diagnostic.protocolUsedInCall")),e.protocolVarianceContravariant=()=>new u(T("Diagnostic.protocolVarianceContravariant")),e.protocolVarianceCovariant=()=>new u(T("Diagnostic.protocolVarianceCovariant")),e.protocolVarianceInvariant=()=>new u(T("Diagnostic.protocolVarianceInvariant")),e.recursiveDefinition=()=>new u(T("Diagnostic.recursiveDefinition")),e.relativeImportNotAllowed=()=>T("Diagnostic.relativeImportNotAllowed"),e.requiredArgCount=()=>T("Diagnostic.requiredArgCount"),e.requiredNotInTypedDict=()=>T("Diagnostic.requiredNotInTypedDict"),e.returnMissing=()=>new u(T("Diagnostic.returnMissing")),e.returnOutsideFunction=()=>T("Diagnostic.returnOutsideFunction"),e.returnTypeContravariant=()=>T("Diagnostic.returnTypeContravariant"),e.returnTypeMismatch=()=>new u(T("Diagnostic.returnTypeMismatch")),e.returnTypeUnknown=()=>T("Diagnostic.returnTypeUnknown"),e.returnTypePartiallyUnknown=()=>new u(T("Diagnostic.returnTypePartiallyUnknown")),e.revealLocalsArgs=()=>T("Diagnostic.revealLocalsArgs"),e.revealLocalsNone=()=>T("Diagnostic.revealLocalsNone"),e.revealTypeArgs=()=>T("Diagnostic.revealTypeArgs"),e.selfTypeContext=()=>T("Diagnostic.selfTypeContext"),e.selfTypeWithTypedSelfOrCls=()=>T("Diagnostic.selfTypeWithTypedSelfOrCls"),e.setterGetterTypeMismatch=()=>T("Diagnostic.setterGetterTypeMismatch"),e.starPatternInAsPattern=()=>T("Diagnostic.starPatternInAsPattern"),e.starPatternInOrPattern=()=>T("Diagnostic.starPatternInOrPattern"),e.singleOverload=()=>new u(T("Diagnostic.singleOverload")),e.slotsAttributeError=()=>new u(T("Diagnostic.slotsAttributeError")),e.slotsClassVarConflict=()=>new u(T("Diagnostic.slotsClassVarConflict")),e.starStarWildcardNotAllowed=()=>T("Diagnostic.starStarWildcardNotAllowed"),e.staticClsSelfParam=()=>T("Diagnostic.staticClsSelfParam"),e.stringNonAsciiBytes=()=>T("Diagnostic.stringNonAsciiBytes"),e.stringNotSubscriptable=()=>T("Diagnostic.stringNotSubscriptable"),e.stringUnsupportedEscape=()=>T("Diagnostic.stringUnsupportedEscape"),e.stringUnterminated=()=>T("Diagnostic.stringUnterminated"),e.stubFileMissing=()=>new u(T("Diagnostic.stubFileMissing")),e.stubUsesGetAttr=()=>T("Diagnostic.stubUsesGetAttr"),e.sublistParamsIncompatible=()=>T("Diagnostic.sublistParamsIncompatible"),e.superCallArgCount=()=>T("Diagnostic.superCallArgCount"),e.superCallFirstArg=()=>new u(T("Diagnostic.superCallFirstArg")),e.superCallSecondArg=()=>new u(T("Diagnostic.superCallSecondArg")),e.superCallZeroArgForm=()=>T("Diagnostic.superCallZeroArgForm"),e.symbolIsUnbound=()=>new u(T("Diagnostic.symbolIsUnbound")),e.symbolIsUndefined=()=>new u(T("Diagnostic.symbolIsUndefined")),e.symbolIsPossiblyUnbound=()=>new u(T("Diagnostic.symbolIsPossiblyUnbound")),e.symbolOverridden=()=>new u(T("Diagnostic.symbolOverridden")),e.trailingCommaInFromImport=()=>T("Diagnostic.trailingCommaInFromImport"),e.tryWithoutExcept=()=>T("Diagnostic.tryWithoutExcept"),e.tupleAssignmentMismatch=()=>new u(T("Diagnostic.tupleAssignmentMismatch")),e.tupleInAnnotation=()=>T("Diagnostic.tupleInAnnotation"),e.tupleIndexOutOfRange=()=>new u(T("Diagnostic.tupleIndexOutOfRange")),e.typeAliasIsRecursiveDirect=()=>new u(T("Diagnostic.typeAliasIsRecursiveDirect")),e.typeAliasIsRecursiveIndirect=()=>new u(T("Diagnostic.typeAliasIsRecursiveIndirect")),e.typeAliasNotInModuleOrClass=()=>T("Diagnostic.typeAliasNotInModuleOrClass"),e.typeAliasRedeclared=()=>new u(T("Diagnostic.typeAliasRedeclared")),e.typeAnnotationCall=()=>T("Diagnostic.typeAnnotationCall"),e.typeAnnotationVariable=()=>T("Diagnostic.typeAnnotationVariable"),e.typeArgListNotAllowed=()=>T("Diagnostic.typeArgListNotAllowed"),e.typeArgsExpectingNone=()=>new u(T("Diagnostic.typeArgsExpectingNone")),e.typeArgsMismatchOne=()=>new u(T("Diagnostic.typeArgsMismatchOne")),e.typeArgsMissingForAlias=()=>new u(T("Diagnostic.typeArgsMissingForAlias")),e.typeArgsMissingForClass=()=>new u(T("Diagnostic.typeArgsMissingForClass")),e.typeArgsTooFew=()=>new u(T("Diagnostic.typeArgsTooFew")),e.typeArgsTooMany=()=>new u(T("Diagnostic.typeArgsTooMany")),e.typeAssignmentMismatch=()=>new u(T("Diagnostic.typeAssignmentMismatch")),e.typeCallNotAllowed=()=>T("Diagnostic.typeCallNotAllowed"),e.typedDictAccess=()=>T("Diagnostic.typedDictAccess"),e.typedDictBadVar=()=>T("Diagnostic.typedDictBadVar"),e.typedDictBaseClass=()=>T("Diagnostic.typedDictBaseClass"),e.typedDictDelete=()=>T("Diagnostic.typedDictDelete"),e.typedDictEmptyName=()=>T("Diagnostic.typedDictEmptyName"),e.typedDictEntryName=()=>T("Diagnostic.typedDictEntryName"),e.typedDictEntryUnique=()=>T("Diagnostic.typedDictEntryUnique"),e.typedDictExtraArgs=()=>T("Diagnostic.typedDictExtraArgs"),e.typedDictFieldRedefinition=()=>new u(T("Diagnostic.typedDictFieldRedefinition")),e.typedDictFirstArg=()=>T("Diagnostic.typedDictFirstArg"),e.typedDictSecondArgDict=()=>T("Diagnostic.typedDictSecondArgDict"),e.typedDictSecondArgDictEntry=()=>T("Diagnostic.typedDictSecondArgDictEntry"),e.typedDictSet=()=>T("Diagnostic.typedDictSet"),e.typedDictTotalParam=()=>T("Diagnostic.typedDictTotalParam"),e.typeExpectedClass=()=>new u(T("Diagnostic.typeExpectedClass")),e.typeGuardArgCount=()=>T("Diagnostic.typeGuardArgCount"),e.typeNotAwaitable=()=>new u(T("Diagnostic.typeNotAwaitable")),e.typeNotCallable=()=>new u(T("Diagnostic.typeNotCallable")),e.typeNotIntantiable=()=>new u(T("Diagnostic.typeNotIntantiable")),e.typeNotIterable=()=>new u(T("Diagnostic.typeNotIterable")),e.typeNotSpecializable=()=>new u(T("Diagnostic.typeNotSpecializable")),e.typeNotSubscriptable=()=>new u(T("Diagnostic.typeNotSubscriptable")),e.typeNotUsableWith=()=>new u(T("Diagnostic.typeNotUsableWith")),e.typeNotSupportBinaryOperator=()=>new u(T("Diagnostic.typeNotSupportBinaryOperator")),e.typeNotSupportUnaryOperator=()=>new u(T("Diagnostic.typeNotSupportUnaryOperator")),e.typePartiallyUnknown=()=>new u(T("Diagnostic.typePartiallyUnknown")),e.typeUnknown=()=>new u(T("Diagnostic.typeUnknown")),e.typeVarAssignedName=()=>new u(T("Diagnostic.typeVarAssignedName")),e.typeVarAssignmentMismatch=()=>new u(T("Diagnostic.typeVarAssignmentMismatch")),e.typeVarBoundAndConstrained=()=>T("Diagnostic.typeVarBoundAndConstrained"),e.typeVarFirstArg=()=>T("Diagnostic.typeVarFirstArg"),e.typeVarGeneric=()=>T("Diagnostic.typeVarGeneric"),e.typeVarNoMember=()=>new u(T("Diagnostic.typeVarNoMember")),e.typeVarNotSubscriptable=()=>new u(T("Diagnostic.typeVarNotSubscriptable")),e.typeVarNotUsedByOuterScope=()=>new u(T("Diagnostic.typeVarNotUsedByOuterScope")),e.typeVarSingleConstraint=()=>T("Diagnostic.typeVarSingleConstraint"),e.typeVarsNotInGeneric=()=>T("Diagnostic.typeVarsNotInGeneric"),e.typeVarTupleContext=()=>T("Diagnostic.typeVarTupleContext"),e.typeVarUnknownParam=()=>new u(T("Diagnostic.typeVarUnknownParam")),e.typeVarUsedByOuterScope=()=>new u(T("Diagnostic.typeVarUsedByOuterScope")),e.typeVarUsedOnlyOnce=()=>new u(T("Diagnostic.typeVarUsedOnlyOnce")),e.typeVarVariance=()=>T("Diagnostic.typeVarVariance"),e.unaccessedClass=()=>new u(T("Diagnostic.unaccessedClass")),e.unaccessedFunction=()=>new u(T("Diagnostic.unaccessedFunction")),e.unaccessedImport=()=>new u(T("Diagnostic.unaccessedImport")),e.unaccessedSymbol=()=>new u(T("Diagnostic.unaccessedSymbol")),e.unaccessedVariable=()=>new u(T("Diagnostic.unaccessedVariable")),e.unexpectedAsyncToken=()=>T("Diagnostic.unexpectedAsyncToken"),e.unexpectedExprToken=()=>T("Diagnostic.unexpectedExprToken"),e.unexpectedIndent=()=>T("Diagnostic.unexpectedIndent"),e.unexpectedUnindent=()=>T("Diagnostic.unexpectedUnindent"),e.unionSyntaxIllegal=()=>T("Diagnostic.unionSyntaxIllegal"),e.unionTypeArgCount=()=>T("Diagnostic.unionTypeArgCount"),e.uninitializedInstanceVariable=()=>new u(T("Diagnostic.uninitializedInstanceVariable")),e.unnecessaryCast=()=>new u(T("Diagnostic.unnecessaryCast")),e.unnecessaryIsInstanceAlways=()=>new u(T("Diagnostic.unnecessaryIsInstanceAlways")),e.unnecessaryIsSubclassAlways=()=>new u(T("Diagnostic.unnecessaryIsSubclassAlways")),e.unpackArgCount=()=>T("Diagnostic.unpackArgCount"),e.unpackedArgInTypeArgument=()=>T("Diagnostic.unpackedArgInTypeArgument"),e.unpackedArgWithVariadicParam=()=>T("Diagnostic.unpackedArgWithVariadicParam"),e.unpackedDictArgumentNotMapping=()=>T("Diagnostic.unpackedDictArgumentNotMapping"),e.unpackedSubscriptIllegal=()=>T("Diagnostic.unpackedSubscriptIllegal"),e.unpackedTypedDictArgument=()=>T("Diagnostic.unpackedTypedDictArgument"),e.unpackedTypeVarTupleExpected=()=>new u(T("Diagnostic.unpackedTypeVarTupleExpected")),e.unpackExpectedTypeVarTuple=()=>T("Diagnostic.unpackExpectedTypeVarTuple"),e.unpackIllegalInComprehension=()=>T("Diagnostic.unpackIllegalInComprehension"),e.unpackInDict=()=>T("Diagnostic.unpackInDict"),e.unpackInSet=()=>T("Diagnostic.unpackInSet"),e.unpackNotAllowed=()=>T("Diagnostic.unpackNotAllowed"),e.unpackTuplesIllegal=()=>T("Diagnostic.unpackTuplesIllegal"),e.unreachableCode=()=>T("Diagnostic.unreachableCode"),e.unsupportedDunderAllOperation=()=>T("Diagnostic.unsupportedDunderAllOperation"),e.unusedCallResult=()=>new u(T("Diagnostic.unusedCallResult")),e.unusedCoroutine=()=>T("Diagnostic.unusedCoroutine"),e.varAnnotationIllegal=()=>T("Diagnostic.varAnnotationIllegal"),e.variadicTypeArgsTooMany=()=>T("Diagnostic.variadicTypeArgsTooMany"),e.variadicTypeParamTooManyAlias=()=>new u(T("Diagnostic.variadicTypeParamTooManyAlias")),e.variadicTypeParamTooManyClass=()=>new u(T("Diagnostic.variadicTypeParamTooManyClass")),e.walrusIllegal=()=>T("Diagnostic.walrusIllegal"),e.walrusNotAllowed=()=>T("Diagnostic.walrusNotAllowed"),e.wildcardInFunction=()=>T("Diagnostic.wildcardInFunction"),e.wildcardLibraryImport=()=>T("Diagnostic.wildcardLibraryImport"),e.yieldFromIllegal=()=>T("Diagnostic.yieldFromIllegal"),e.yieldFromOutsideAsync=()=>T("Diagnostic.yieldFromOutsideAsync"),e.yieldOutsideFunction=()=>T("Diagnostic.yieldOutsideFunction"),e.yieldTypeMismatch=()=>new u(T("Diagnostic.yieldTypeMismatch")),e.yieldWithinListCompr=()=>T("Diagnostic.yieldWithinListCompr"),e.zeroCaseStatementsFound=()=>T("Diagnostic.zeroCaseStatementsFound"),e.zeroLengthTupleNotAllowed=()=>T("Diagnostic.zeroLengthTupleNotAllowed")}(t=e.Diagnostic||(e.Diagnostic={})),function(e){e.argParam=()=>new u(T("DiagnosticAddendum.argParam")),e.argParamFunction=()=>new u(T("DiagnosticAddendum.argParamFunction")),e.argsParamMissing=()=>new u(T("DiagnosticAddendum.argsParamMissing")),e.argsParamWithVariadic=()=>new u(T("DiagnosticAddendum.argsParamWithVariadic")),e.argsPositionOnly=()=>new u(T("DiagnosticAddendum.argsPositionOnly")),e.argumentType=()=>new u(T("DiagnosticAddendum.argumentType")),e.argumentTypes=()=>new u(T("DiagnosticAddendum.argumentTypes")),e.assignToNone=()=>T("DiagnosticAddendum.assignToNone"),e.asyncHelp=()=>T("DiagnosticAddendum.asyncHelp"),e.classPatternTypeAlias=()=>new u(T("DiagnosticAddendum.classPatternTypeAlias")),e.dataclassFrozen=()=>new u(T("DiagnosticAddendum.dataclassFrozen")),e.finalMethod=()=>T("DiagnosticAddendum.finalMethod"),e.functionParamDefaultMissing=()=>new u(T("DiagnosticAddendum.functionParamDefaultMissing")),e.functionParamName=()=>new u(T("DiagnosticAddendum.functionParamName")),e.functionReturnTypeMismatch=()=>new u(T("DiagnosticAddendum.functionReturnTypeMismatch")),e.functionTooFewParams=()=>new u(T("DiagnosticAddendum.functionTooFewParams")),e.incompatibleGetter=()=>T("DiagnosticAddendum.incompatibleGetter"),e.incompatibleSetter=()=>T("DiagnosticAddendum.incompatibleSetter"),e.incompatibleDeleter=()=>T("DiagnosticAddendum.incompatibleDeleter"),e.functionTooManyParams=()=>new u(T("DiagnosticAddendum.functionTooManyParams")),e.keyNotRequired=()=>new u(T("DiagnosticAddendum.keyNotRequired")),e.keyRequiredDeleted=()=>new u(T("DiagnosticAddendum.keyRequiredDeleted")),e.keyUndefined=()=>new u(T("DiagnosticAddendum.keyUndefined")),e.kwargsParamMissing=()=>new u(T("DiagnosticAddendum.kwargsParamMissing")),e.literalAssignmentMismatch=()=>new u(T("DiagnosticAddendum.literalAssignmentMismatch")),e.memberAssignment=()=>new u(T("DiagnosticAddendum.memberAssignment")),e.memberIsAbstract=()=>new u(T("DiagnosticAddendum.memberIsAbstract")),e.memberIsAbstractMore=()=>new u(T("DiagnosticAddendum.memberIsAbstractMore")),e.memberIsFinalInProtocol=()=>new u(T("DiagnosticAddendum.memberIsFinalInProtocol")),e.memberIsInitVar=()=>new u(T("DiagnosticAddendum.memberIsInitVar")),e.memberIsNotFinalInProtocol=()=>new u(T("DiagnosticAddendum.memberIsNotFinalInProtocol")),e.memberSetClassVar=()=>new u(T("DiagnosticAddendum.memberSetClassVar")),e.memberTypeMismatch=()=>new u(T("DiagnosticAddendum.memberTypeMismatch")),e.memberUnknown=()=>new u(T("DiagnosticAddendum.memberUnknown")),e.missingGetter=()=>T("DiagnosticAddendum.missingGetter"),e.missingSetter=()=>T("DiagnosticAddendum.missingSetter"),e.missingDeleter=()=>T("DiagnosticAddendum.missingDeleter"),e.namedParamMissingInDest=()=>new u(T("DiagnosticAddendum.namedParamMissingInDest")),e.namedParamMissingInSource=()=>new u(T("DiagnosticAddendum.namedParamMissingInSource")),e.namedParamTypeMismatch=()=>new u(T("DiagnosticAddendum.namedParamTypeMismatch")),e.noOverloadAssignable=()=>new u(T("DiagnosticAddendum.noOverloadAssignable")),e.orPatternMissingName=()=>new u(T("DiagnosticAddendum.orPatternMissingName")),e.overloadMethod=()=>T("DiagnosticAddendum.overloadMethod"),e.overloadNotAssignable=()=>new u(T("DiagnosticAddendum.overloadNotAssignable")),e.overloadWithImplementation=()=>T("DiagnosticAddendum.overloadWithImplementation"),e.overriddenMethod=()=>T("DiagnosticAddendum.overriddenMethod"),e.overriddenSymbol=()=>T("DiagnosticAddendum.overriddenSymbol"),e.overrideParamCount=()=>new u(T("DiagnosticAddendum.overrideParamCount")),e.overrideParamName=()=>new u(T("DiagnosticAddendum.overrideParamName")),e.overrideParamType=()=>new u(T("DiagnosticAddendum.overrideParamType")),e.overrideReturnType=()=>new u(T("DiagnosticAddendum.overrideReturnType")),e.overrideType=()=>new u(T("DiagnosticAddendum.overrideType")),e.paramAssignment=()=>new u(T("DiagnosticAddendum.paramAssignment")),e.paramSpecOverload=()=>T("DiagnosticAddendum.paramSpecOverload"),e.paramType=()=>new u(T("DiagnosticAddendum.paramType")),e.privateImportFromPyTypedSource=()=>new u(T("DiagnosticAddendum.privateImportFromPyTypedSource")),e.propertyAccessFromProtocolClass=()=>T("DiagnosticAddendum.propertyAccessFromProtocolClass"),e.propertyMethodIncompatible=()=>new u(T("DiagnosticAddendum.propertyMethodIncompatible")),e.propertyMethodMissing=()=>new u(T("DiagnosticAddendum.propertyMethodMissing")),e.propertyMissingDeleter=()=>new u(T("DiagnosticAddendum.propertyMissingDeleter")),e.propertyMissingSetter=()=>new u(T("DiagnosticAddendum.propertyMissingSetter")),e.protocolMemberClassVar=()=>new u(T("DiagnosticAddendum.protocolMemberClassVar")),e.protocolIncompatible=()=>new u(T("DiagnosticAddendum.protocolIncompatible")),e.protocolMemberMissing=()=>new u(T("DiagnosticAddendum.protocolMemberMissing")),e.readOnlyAttribute=()=>new u(T("DiagnosticAddendum.readOnlyAttribute")),e.seeDeclaration=()=>T("DiagnosticAddendum.seeDeclaration"),e.seeClassDeclaration=()=>T("DiagnosticAddendum.seeClassDeclaration"),e.seeFunctionDeclaration=()=>T("DiagnosticAddendum.seeFunctionDeclaration"),e.seeMethodDeclaration=()=>T("DiagnosticAddendum.seeMethodDeclaration"),e.seeParameterDeclaration=()=>T("DiagnosticAddendum.seeParameterDeclaration"),e.seeVariableDeclaration=()=>T("DiagnosticAddendum.seeVariableDeclaration"),e.tupleEntryTypeMismatch=()=>new u(T("DiagnosticAddendum.tupleEntryTypeMismatch")),e.tupleAssignmentMismatch=()=>new u(T("DiagnosticAddendum.tupleAssignmentMismatch")),e.tupleSizeMismatch=()=>new u(T("DiagnosticAddendum.tupleSizeMismatch")),e.tupleSizeMismatchIndeterminate=()=>new u(T("DiagnosticAddendum.tupleSizeMismatchIndeterminate")),e.typeAssignmentMismatch=()=>new u(T("DiagnosticAddendum.typeAssignmentMismatch")),e.typeBound=()=>new u(T("DiagnosticAddendum.typeBound")),e.typeConstrainedTypeVar=()=>new u(T("DiagnosticAddendum.typeConstrainedTypeVar")),e.typedDictFieldMissing=()=>new u(T("DiagnosticAddendum.typedDictFieldMissing")),e.typedDictFieldNotRequired=()=>new u(T("DiagnosticAddendum.typedDictFieldNotRequired")),e.typedDictFieldRedefinition=()=>new u(T("DiagnosticAddendum.typedDictFieldRedefinition")),e.typedDictFieldRequired=()=>new u(T("DiagnosticAddendum.typedDictFieldRequired")),e.typedDictFieldTypeMismatch=()=>new u(T("DiagnosticAddendum.typedDictFieldTypeMismatch")),e.typedDictFieldUndefined=()=>new u(T("DiagnosticAddendum.typedDictFieldUndefined")),e.typedDictFinalMismatch=()=>new u(T("DiagnosticAddendum.typedDictFinalMismatch")),e.typeIncompatible=()=>new u(T("DiagnosticAddendum.typeIncompatible")),e.typeNotCallable=()=>new u(T("DiagnosticAddendum.typeNotCallable")),e.typeNotClass=()=>new u(T("DiagnosticAddendum.typeNotClass")),e.typeParamSpec=()=>new u(T("DiagnosticAddendum.typeParamSpec")),e.typeNotStringLiteral=()=>new u(T("DiagnosticAddendum.typeNotStringLiteral")),e.typeOfSymbol=()=>new u(T("DiagnosticAddendum.typeOfSymbol")),e.typeUnsupported=()=>new u(T("DiagnosticAddendum.typeUnsupported")),e.typeVarIsContravariant=()=>new u(T("DiagnosticAddendum.typeVarIsContravariant")),e.typeVarIsCovariant=()=>new u(T("DiagnosticAddendum.typeVarIsCovariant")),e.typeVarIsInvariant=()=>new u(T("DiagnosticAddendum.typeVarIsInvariant")),e.typeVarTupleRequiresKnownLength=()=>T("DiagnosticAddendum.typeVarTupleRequiresKnownLength"),e.typeVarNotAllowed=()=>T("DiagnosticAddendum.typeVarNotAllowed"),e.typeVarsMissing=()=>new u(T("DiagnosticAddendum.typeVarsMissing")),e.useDictInstead=()=>T("DiagnosticAddendum.useDictInstead"),e.useListInstead=()=>T("DiagnosticAddendum.useListInstead"),e.useTupleInstead=()=>T("DiagnosticAddendum.useTupleInstead"),e.useTypeInstead=()=>T("DiagnosticAddendum.useTypeInstead")}(n=e.DiagnosticAddendum||(e.DiagnosticAddendum={})),function(e){e.addOptionalToAnnotation=()=>T("CodeAction.addOptionalToAnnotation"),e.createTypeStub=()=>T("CodeAction.createTypeStub"),e.createTypeStubFor=()=>new u(T("CodeAction.createTypeStubFor")),e.executingCommand=()=>T("CodeAction.executingCommand"),e.filesToAnalyzeOne=()=>T("CodeAction.filesToAnalyzeOne"),e.filesToAnalyzeCount=()=>new u(T("CodeAction.filesToAnalyzeCount")),e.findingReferences=()=>T("CodeAction.findingReferences"),e.organizeImports=()=>T("CodeAction.organizeImports")}(i=e.CodeAction||(e.CodeAction={})),function(e){e.moveFile=()=>new u(T("Refactoring.moveFile")),e.moveFileLabel=()=>new u(T("Refactoring.moveFileLabel")),e.moveFileDescription=()=>new u(T("Refactoring.moveFileDescription"))}(s=e.Refactoring||(e.Refactoring={}))}(t.Localizer||(t.Localizer={}))},6334:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.main=void 0;const i=n(9560),s=n(4448),r=n(8863);t.main=function(){(0,s.run)((e=>new r.PyrightServer(e)),(()=>{(new i.BackgroundAnalysisRunner).start()}))}},4448:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getConnectionOptions=t.run=void 0;const i=n(4714),s=n(1267),r=n(9241);function a(){return{cancellationStrategy:(0,r.getCancellationStrategyFromArgv)(process.argv)}}t.run=function(e,t){n(5330).install(),s.isMainThread?e((0,i.createConnection)(a())):t()},t.getConnectionOptions=a},9671:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterStream=void 0;const i=n(6956);t.CharacterStream=class{constructor(e){this._text=e,this._position=0,this._currentChar=e.length>0?e.charCodeAt(0):0,this._isEndOfStream=0===e.length}getText(){return this._text}get position(){return this._position}set position(e){this._position=e,this._checkBounds()}get currentChar(){return this._currentChar}getCurrentChar(){return this._currentChar}get nextChar(){return this.position+1<this._text.length?this._text.charCodeAt(this.position+1):0}get prevChar(){return this.position-1>=0?this._text.charCodeAt(this.position-1):0}isEndOfStream(){return this._isEndOfStream}lookAhead(e){const t=this._position+e;return t<0||t>=this._text.length?0:this._text.charCodeAt(t)}advance(e){this.position+=e}moveNext(){return this._position<this._text.length-1?(this._position+=1,this._currentChar=this._text.charCodeAt(this._position),!0):(this.advance(1),!this.isEndOfStream())}isAtWhiteSpace(){return(0,i.isWhiteSpace)(this.currentChar)}isAtLineBreak(){return(0,i.isLineBreak)(this.currentChar)}skipLineBreak(){13===this._currentChar?(this.moveNext(),10===this.currentChar&&this.moveNext()):10===this._currentChar&&this.moveNext()}skipWhitespace(){for(;!this.isEndOfStream()&&this.isAtWhiteSpace();)this.moveNext()}skipToEol(){for(;!this.isEndOfStream()&&!this.isAtLineBreak();)this.moveNext()}skipToWhitespace(){for(;!this.isEndOfStream()&&!this.isAtWhiteSpace();)this.moveNext()}charCodeAt(e){return this._text.charCodeAt(e)}get length(){return this._text.length}_checkBounds(){this._position<0&&(this._position=0),this._isEndOfStream=this._position>=this._text.length,this._isEndOfStream&&(this._position=this._text.length),this._currentChar=this._isEndOfStream?0:this._text.charCodeAt(this._position)}}},6956:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isBinary=t.isOctal=t.isHex=t.isDecimal=t.isNumber=t.isLineBreak=t.isWhiteSpace=t.isSurrogateChar=t.isIdentifierChar=t.isIdentifierStartChar=void 0;const a=r(n(7770));var o;!function(e){e[e.NotIdentifierChar=0]="NotIdentifierChar",e[e.StartIdentifierChar=1]="StartIdentifierChar",e[e.IdentifierChar=2]="IdentifierChar",e[e.SurrogateChar=3]="SurrogateChar"}(o||(o={}));const l=256,c=new Array(l),p={},d={};let u=!1;function m(e){return e>=48&&e<=57||95===e}function h(e,t){if(p[e]!==o.SurrogateChar)return o.NotIdentifierChar;const n=d[e];return n?n[t]:o.NotIdentifierChar}t.isIdentifierStartChar=function(e,t){if(e<l)return c[e]===o.StartIdentifierChar;let n;return u||(b(!1),u=!0),n=void 0!==t?h(e,t):p[e],n===o.StartIdentifierChar},t.isIdentifierChar=function(e,t){return e<l?c[e]===o.StartIdentifierChar||c[e]===o.IdentifierChar:(u||(b(!1),u=!0),void 0!==t?h(e,t):p[e]===o.StartIdentifierChar||p[e]===o.IdentifierChar)},t.isSurrogateChar=function(e){return!(e<l)&&(u||(b(!1),u=!0),p[e]===o.SurrogateChar)},t.isWhiteSpace=function(e){return 32===e||9===e||12===e},t.isLineBreak=function(e){return 13===e||10===e},t.isNumber=function(e){return e>=48&&e<=57||95===e},t.isDecimal=m,t.isHex=function(e){return m(e)||e>=97&&e<=102||e>=65&&e<=70||95===e},t.isOctal=function(e){return e>=48&&e<=55||95===e},t.isBinary=function(e){return 48===e||49===e||95===e};const y=[[95,6277,6278,8472,8494,12443,12444],a.unicodeLu,a.unicodeLl,a.unicodeLt,a.unicodeLo,a.unicodeLm,a.unicodeNl],g=[a.unicodeLuSurrogate,a.unicodeLlSurrogate,a.unicodeLoSurrogate,a.unicodeLmSurrogate,a.unicodeNlSurrogate],f=[[183,903,4969,4970,4971,4972,4973,4974,4975,4976,4977,6618],a.unicodeMn,a.unicodeMc,a.unicodeNd,a.unicodePc],T=[a.unicodeMnSurrogate,a.unicodeMcSurrogate,a.unicodeNdSurrogate];function _(e,t,n,i,s){for(let r=0;r<e.length;r++){const a=e[r];let o,c;Array.isArray(a)?(o=a[0],c=a[1]):o=c=a;for(let e=o;e<=c;e++)e<l?i[e]=t:s[e]=t;if(n&&o>=l)break}}function v(e,t){for(const n in e)d[n]||(d[n]={},p[n]=o.SurrogateChar),_(e[n],t,!1,d[n],d[n])}function b(e){if(c.fill(o.NotIdentifierChar),f.forEach((t=>{_(t,o.IdentifierChar,e,c,p)})),y.forEach((t=>{_(t,o.StartIdentifierChar,e,c,p)})),!e){for(const e of T)v(e,o.IdentifierChar);for(const e of g)v(e,o.StartIdentifierChar)}}b(!0)},5275:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SetNode=t.DictionaryExpandEntryNode=t.DictionaryKeyEntryNode=t.DictionaryNode=t.StringListNode=t.FormatStringNode=t.StringNode=t.NumberNode=t.EllipsisNode=t.ConstantNode=t.NameNode=t.LambdaNode=t.MemberAccessNode=t.YieldFromNode=t.YieldNode=t.SliceNode=t.IndexNode=t.ListComprehensionNode=t.CallNode=t.TupleNode=t.UnpackNode=t.TernaryNode=t.AwaitNode=t.AugmentedAssignmentNode=t.FunctionAnnotationNode=t.TypeAnnotationNode=t.AssignmentNode=t.AssignmentExpressionNode=t.BinaryOperationNode=t.UnaryOperationNode=t.ErrorNode=t.isExpressionNode=t.StatementListNode=t.DecoratorNode=t.WithItemNode=t.WithNode=t.ClassNode=t.ParameterNode=t.FunctionNode=t.ExceptNode=t.TryNode=t.ListComprehensionIfNode=t.ListComprehensionForNode=t.ForNode=t.WhileNode=t.IfNode=t.SuiteNode=t.ModuleNode=t.extendRange=t.getNextNodeId=void 0,t.PatternValueNode=t.PatternMappingExpandEntryNode=t.PatternMappingKeyEntryNode=t.PatternMappingNode=t.PatternCaptureNode=t.PatternClassArgumentNode=t.PatternClassNode=t.PatternLiteralNode=t.PatternAsNode=t.PatternSequenceNode=t.CaseNode=t.MatchNode=t.RaiseNode=t.ReturnNode=t.ContinueNode=t.BreakNode=t.AssertNode=t.NonlocalNode=t.GlobalNode=t.ImportFromAsNode=t.ImportFromNode=t.ImportAsNode=t.ModuleNameNode=t.ImportNode=t.PassNode=t.DelNode=t.ArgumentNode=t.ListNode=void 0;const i=n(3550);let s=1;function r(e,t){t.start<e.start&&(e.length+=e.start-t.start,e.start=t.start),i.TextRange.getEnd(t)>i.TextRange.getEnd(e)&&(e.length=i.TextRange.getEnd(t)-e.start)}var a;t.getNextNodeId=function(){return s++},t.extendRange=r,(t.ModuleNode||(t.ModuleNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:36,id:s++,statements:[]}},(t.SuiteNode||(t.SuiteNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:50,id:s++,statements:[]}},(t.IfNode||(t.IfNode={})).create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:19,id:s++,testExpression:t,ifSuite:n,elseSuite:i};return t.parent=a,n.parent=a,r(a,t),r(a,n),i&&(r(a,i),i.parent=a),a},(t.WhileNode||(t.WhileNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:57,id:s++,testExpression:t,whileSuite:n};return t.parent=i,n.parent=i,r(i,n),i},(t.ForNode||(t.ForNode={})).create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:26,id:s++,targetExpression:t,iterableExpression:n,forSuite:i};return t.parent=a,n.parent=a,i.parent=a,r(a,i),a},(t.ListComprehensionForNode||(t.ListComprehensionForNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:33,id:s++,targetExpression:t,iterableExpression:n};return t.parent=i,n.parent=i,r(i,t),r(i,n),i},(t.ListComprehensionIfNode||(t.ListComprehensionIfNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:34,id:s++,testExpression:t};return t.parent=n,r(n,t),n},(t.TryNode||(t.TryNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:53,id:s++,trySuite:t,exceptClauses:[]};return t.parent=n,r(n,t),n},(t.ExceptNode||(t.ExceptNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:25,id:s++,exceptSuite:t};return t.parent=n,r(n,t),n},(t.FunctionNode||(t.FunctionNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:28,id:s++,decorators:[],name:t,parameters:[],suite:n};return t.parent=i,n.parent=i,r(i,n),i},(t.ParameterNode||(t.ParameterNode={})).create=function(e,t){return{start:e.start,length:e.length,nodeType:41,id:s++,category:t}},(a=t.ClassNode||(t.ClassNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:10,id:s++,decorators:[],name:t,arguments:[],suite:n};return t.parent=i,n.parent=i,r(i,n),i},a.createDummyForDecorators=function(e){const t={start:e[0].start,length:0,nodeType:10,id:s++,decorators:e,name:{start:e[0].start,length:0,id:0,nodeType:38,token:{type:7,start:0,length:0,comments:[],value:""},value:""},arguments:[],suite:{start:e[0].start,length:0,id:0,nodeType:50,statements:[]}};return e.forEach((e=>{e.parent=t,r(t,e)})),t.name.parent=t,t.suite.parent=t,t},(t.WithNode||(t.WithNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:58,id:s++,withItems:[],suite:t};return t.parent=n,r(n,t),n},(t.WithItemNode||(t.WithItemNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:59,id:s++,expression:e};return e.parent=t,t},(t.DecoratorNode||(t.DecoratorNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:13,id:s++,expression:t};return t.parent=n,r(n,t),n},(t.StatementListNode||(t.StatementListNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:47,id:s++,statements:[]}},t.isExpressionNode=function(e){switch(e.nodeType){case 0:case 55:case 7:case 4:case 54:case 6:case 51:case 56:case 52:case 9:case 32:case 24:case 46:case 60:case 61:case 35:case 30:case 38:case 11:case 18:case 40:case 49:case 27:case 48:case 15:case 16:case 31:case 45:return!0;default:return!1}},(t.ErrorNode||(t.ErrorNode={})).create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:0,id:s++,category:t,child:n,decorators:i};return n&&(n.parent=a,r(a,n)),i&&(i.forEach((e=>{e.parent=a})),i.length>0&&r(a,i[0])),a},(t.UnaryOperationNode||(t.UnaryOperationNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:55,id:s++,operator:n,operatorToken:e,expression:t};return t.parent=i,r(i,t),i},(t.BinaryOperationNode||(t.BinaryOperationNode={})).create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:7,id:s++,leftExpression:e,operatorToken:n,operator:i,rightExpression:t};return e.parent=a,t.parent=a,r(a,t),a},(t.AssignmentExpressionNode||(t.AssignmentExpressionNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:4,id:s++,name:e,rightExpression:t};return e.parent=n,t.parent=n,r(n,t),n},(t.AssignmentNode||(t.AssignmentNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:3,id:s++,leftExpression:e,rightExpression:t};return e.parent=n,t.parent=n,r(n,t),n},(t.TypeAnnotationNode||(t.TypeAnnotationNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:54,id:s++,valueExpression:e,typeAnnotation:t};return e.parent=n,t.parent=n,r(n,t),n},(t.FunctionAnnotationNode||(t.FunctionAnnotationNode={})).create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:62,id:s++,isParamListEllipsis:t,paramTypeAnnotations:n,returnTypeAnnotation:i};return n.forEach((e=>{e.parent=a})),i.parent=a,r(a,i),a},(t.AugmentedAssignmentNode||(t.AugmentedAssignmentNode={})).create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:5,id:s++,leftExpression:e,operator:n,rightExpression:t,destExpression:i};return e.parent=a,t.parent=a,i.parent=a,r(a,t),a},(t.AwaitNode||(t.AwaitNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:6,id:s++,expression:t};return t.parent=n,r(n,t),n},(t.TernaryNode||(t.TernaryNode={})).create=function(e,t,n){const i={start:e.start,length:e.length,nodeType:51,id:s++,ifExpression:e,testExpression:t,elseExpression:n};return e.parent=i,t.parent=i,n.parent=i,r(i,n),i},(t.UnpackNode||(t.UnpackNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:56,id:s++,expression:t};return t.parent=n,r(n,t),n},(t.TupleNode||(t.TupleNode={})).create=function(e,t){return{start:e.start,length:e.length,nodeType:52,id:s++,expressions:[],enclosedInParens:t}},(t.CallNode||(t.CallNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:9,id:s++,leftExpression:e,arguments:[]};return e.parent=t,t},(t.ListComprehensionNode||(t.ListComprehensionNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:32,id:s++,expression:e,comprehensions:[]};return e.parent=t,t},(t.IndexNode||(t.IndexNode={})).create=function(e,t,n,i){const a={start:e.start,length:e.length,nodeType:24,id:s++,baseExpression:e,items:t,trailingComma:n};return e.parent=a,t.forEach((e=>{e.parent=a})),r(a,i),a},(t.SliceNode||(t.SliceNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:46,id:s++}},(t.YieldNode||(t.YieldNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:60,id:s++,expression:t};return t&&(t.parent=n,r(n,t)),n},(t.YieldFromNode||(t.YieldFromNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:61,id:s++,expression:t};return t.parent=n,r(n,t),n},(t.MemberAccessNode||(t.MemberAccessNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:35,id:s++,leftExpression:e,memberName:t};return e.parent=n,t.parent=n,r(n,t),n},(t.LambdaNode||(t.LambdaNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:30,id:s++,parameters:[],expression:t};return t.parent=n,r(n,t),n},(t.NameNode||(t.NameNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:38,id:s++,token:e,value:e.value}},(t.ConstantNode||(t.ConstantNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:11,id:s++,constType:e.keywordType}},(t.EllipsisNode||(t.EllipsisNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:18,id:s++}},(t.NumberNode||(t.NumberNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:40,id:s++,value:e.value,isInteger:e.isInteger,isImaginary:e.isImaginary}},(t.StringNode||(t.StringNode={})).create=function(e,t,n){return{start:e.start,length:e.length,nodeType:49,id:s++,token:e,value:t,hasUnescapeErrors:n}},(t.FormatStringNode||(t.FormatStringNode={})).create=function(e,t,n,i){const r={start:e.start,length:e.length,nodeType:27,id:s++,token:e,value:t,hasUnescapeErrors:n,expressions:i};return i.forEach((e=>{e.parent=r})),r},(t.StringListNode||(t.StringListNode={})).create=function(e){const t={start:e[0].start,length:e[0].length,nodeType:48,id:s++,strings:e};return e.length>0&&(e.forEach((e=>{e.parent=t})),r(t,e[e.length-1])),t},(t.DictionaryNode||(t.DictionaryNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:15,id:s++,entries:[]}},(t.DictionaryKeyEntryNode||(t.DictionaryKeyEntryNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:17,id:s++,keyExpression:e,valueExpression:t};return e.parent=n,t.parent=n,r(n,t),n},(t.DictionaryExpandEntryNode||(t.DictionaryExpandEntryNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:16,id:s++,expandExpression:e};return e.parent=t,t},(t.SetNode||(t.SetNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:45,id:s++,entries:[]}},(t.ListNode||(t.ListNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:31,id:s++,entries:[]}},(t.ArgumentNode||(t.ArgumentNode={})).create=function(e,t,n){const i={start:e?e.start:t.start,length:e?e.length:t.length,nodeType:1,id:s++,valueExpression:t,argumentCategory:n};return t.parent=i,r(i,t),i},(t.DelNode||(t.DelNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:14,id:s++,expressions:[]}},(t.PassNode||(t.PassNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:42,id:s++}},(t.ImportNode||(t.ImportNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:20,id:s++,list:[]}},(t.ModuleNameNode||(t.ModuleNameNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:37,id:s++,leadingDots:0,nameParts:[]}},(t.ImportAsNode||(t.ImportAsNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:21,id:s++,module:e};return e.parent=t,t},(t.ImportFromNode||(t.ImportFromNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:22,id:s++,module:t,imports:[],isWildcardImport:!1,usesParens:!1};return t.parent=n,r(n,t),n},(t.ImportFromAsNode||(t.ImportFromAsNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:23,id:s++,name:e};return e.parent=t,t},(t.GlobalNode||(t.GlobalNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:29,id:s++,nameList:[]}},(t.NonlocalNode||(t.NonlocalNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:39,id:s++,nameList:[]}},(t.AssertNode||(t.AssertNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:2,id:s++,testExpression:t};return t.parent=n,r(n,t),n},(t.BreakNode||(t.BreakNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:8,id:s++}},(t.ContinueNode||(t.ContinueNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:12,id:s++}},(t.ReturnNode||(t.ReturnNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:44,id:s++}},(t.RaiseNode||(t.RaiseNode={})).create=function(e){return{start:e.start,length:e.length,nodeType:43,id:s++}},(t.MatchNode||(t.MatchNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:63,id:s++,subjectExpression:t,cases:[]};return t.parent=n,r(n,t),n},(t.CaseNode||(t.CaseNode={})).create=function(e,t,n,i,a){const o={start:e.start,length:e.length,nodeType:64,id:s++,pattern:t,isIrrefutable:n,guardExpression:i,suite:a};return r(o,a),t.parent=o,a.parent=o,i&&(i.parent=o),o},(t.PatternSequenceNode||(t.PatternSequenceNode={})).create=function(e,t){const n=t.findIndex((e=>1===e.orPatterns.length&&69===e.orPatterns[0].nodeType&&e.orPatterns[0].isStar)),i={start:e.start,length:e.length,nodeType:65,id:s++,entries:t,starEntryIndex:n>=0?n:void 0};return t.length>0&&r(i,t[t.length-1]),t.forEach((e=>{e.parent=i})),i},(t.PatternAsNode||(t.PatternAsNode={})).create=function(e,t){const n={start:e[0].start,length:e[0].length,nodeType:66,id:s++,orPatterns:e,target:t};return e.length>1&&r(n,e[e.length-1]),e.forEach((e=>{e.parent=n})),t&&(r(n,t),t.parent=n),n},(t.PatternLiteralNode||(t.PatternLiteralNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:67,id:s++,expression:e};return e.parent=t,t},(t.PatternClassNode||(t.PatternClassNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:68,id:s++,className:e,arguments:t};return e.parent=n,t.forEach((e=>{e.parent=n})),t.length>0&&r(n,t[t.length-1]),n},(t.PatternClassArgumentNode||(t.PatternClassArgumentNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:74,id:s++,pattern:e,name:t};return e.parent=n,t&&(r(n,t),t.parent=n),n},(t.PatternCaptureNode||(t.PatternCaptureNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:69,id:s++,target:e,isStar:void 0!==t,isWildcard:"_"===e.value};return e.parent=n,t&&r(n,t),n},(t.PatternMappingNode||(t.PatternMappingNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:70,id:s++,entries:t};return t.length>0&&r(n,t[t.length-1]),t.forEach((e=>{e.parent=n})),n},(t.PatternMappingKeyEntryNode||(t.PatternMappingKeyEntryNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:71,id:s++,keyPattern:e,valuePattern:t};return e.parent=n,t.parent=n,r(n,t),n},(t.PatternMappingExpandEntryNode||(t.PatternMappingExpandEntryNode={})).create=function(e,t){const n={start:e.start,length:e.length,nodeType:72,id:s++,target:t};return t.parent=n,r(n,t),n},(t.PatternValueNode||(t.PatternValueNode={})).create=function(e){const t={start:e.start,length:e.length,nodeType:73,id:s++,expression:e};return e.parent=t,t}},5303:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),r=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return s(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Parser=t.ParseOptions=void 0;const a=n(5839),o=n(1290),l=n(3980),c=n(1464),p=n(6886),d=n(8718),u=n(2122),m=n(5275),h=r(n(5136)),y=n(7093),g=n(6180);class f{constructor(){this.isStubFile=!1,this.pythonVersion=p.latestStablePythonVersion,this.reportInvalidStringEscapeSequence=!1,this.skipFunctionAndClassBody=!1}}t.ParseOptions=f;class T{constructor(){this._tokenIndex=0,this._areErrorsSuppressed=!1,this._parseOptions=new f,this._diagSink=new l.DiagnosticSink,this._isInLoop=!1,this._isInFunction=!1,this._isInFinally=!1,this._isParsingTypeAnnotation=!1,this._isParsingIndexTrailer=!1,this._futureImportMap=new Map,this._importedModules=[],this._containsWildcardImport=!1,this._assignmentExpressionsAllowed=!0,this._typingImportAliases=[],this._typingSymbolAliases=new Map}parseSourceFile(e,t,n){d.timingStats.tokenizeFileTime.timeOperation((()=>{this._startNewParse(e,0,e.length,t,n)}));const i=m.ModuleNode.create({start:0,length:e.length});return d.timingStats.parseFileTime.timeOperation((()=>{for(;!this._atEof();)if(!this._consumeTokenIfType(2)){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(u.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseStatement();t?(t.parent=i,i.statements.push(t)):this._consumeTokensUntilType([2])}})),(0,a.assert)(void 0!==this._tokenizerOutput),{text:e,parseTree:i,importedModules:this._importedModules,futureImports:this._futureImportMap,tokenizerOutput:this._tokenizerOutput,containsWildcardImport:this._containsWildcardImport}}parseTextExpression(e,t,n,i,s=0,r=0){const a=new l.DiagnosticSink;let o;if(this._startNewParse(e,t,n,i,a,r),1===s)o=this._parseTypeAnnotation();else if(2===s)o=this._parseFunctionTypeAnnotation();else{const e=this._parseTestOrStarExpressionList(!1);e.parseError?o=e.parseError:(0===e.list.length&&this._addError(u.Localizer.Diagnostic.expectedExpr(),this._peekToken()),o=this._makeExpressionOrTuple(e,!1))}return 2===this._peekTokenType()&&this._getNextToken(),this._atEof()||this._addError(u.Localizer.Diagnostic.unexpectedExprToken(),this._peekToken()),{parseTree:o,lines:this._tokenizerOutput.lines,diagnostics:a.fetchAndClear()}}_startNewParse(e,t,n,i,s,r=0){this._fileContents=e,this._parseOptions=i,this._diagSink=s;const a=new y.Tokenizer;this._tokenizerOutput=a.tokenize(e,t,n,r),this._tokenIndex=0}_parseStatement(){switch(this._consumeTokenIfType(4)&&this._addError(u.Localizer.Diagnostic.unexpectedUnindent(),this._peekToken()),this._peekKeywordType()){case 20:return this._parseIfStatement();case 35:return this._parseWhileStatement();case 17:return this._parseForStatement();case 34:return this._parseTryStatement();case 36:return this._parseWithStatement();case 10:return this._parseFunctionDef();case 7:return this._parseClassDef();case 3:return this._parseAsyncStatement();case 25:{const e=this._peekToken(1);let t=!1;if(10===e.type||11===e.type||12===e.type||20===e.type||2===e.type||1===e.type)t=!0;else if(9===e.type){const n=e;26!==n.operatorType&&33!==n.operatorType&&(t=!0)}if(!t){const e=this._parseMatchStatement();if(e)return e}}}return 22===this._peekOperatorType()?this._parseDecorated():this._parseSimpleStatement()}_parseAsyncStatement(){const e=this._getKeywordToken(3);switch(this._peekKeywordType()){case 10:return this._parseFunctionDef(e);case 36:return this._parseWithStatement(e);case 17:return this._parseForStatement(e)}this._addError(u.Localizer.Diagnostic.unexpectedAsyncToken(),e)}_parseMatchStatement(){let e=!1;if(this._suppressErrors((()=>{const t=this._tokenIndex;this._getKeywordToken(25);const n=this._parseTestOrStarListAsExpression(!0,12,u.Localizer.Diagnostic.expectedReturnExpr());e=0!==n.nodeType&&10===this._peekToken().type,this._tokenIndex=t})),!e)return;const t=this._getKeywordToken(25),n=this._parseTestOrStarListAsExpression(!0,12,u.Localizer.Diagnostic.expectedReturnExpr()),i=m.MatchNode.create(t,n),s=this._peekToken();if(this._consumeTokenIfType(10))if(this._consumeTokenIfType(2)){const e=this._peekToken();if(this._consumeTokenIfType(3)){const t=e;t.isIndentAmbiguous&&this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t)}else this._addError(u.Localizer.Diagnostic.expectedIndentedBlock(),this._peekToken());for(;;){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(u.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseCaseStatement();t?(t.parent=i,i.cases.push(t)):this._consumeTokensUntilType([2,10])&&this._getNextToken();const n=this._peekToken();if(this._consumeTokenIfType(4)){n.matchesIndent||this._addError(u.Localizer.Diagnostic.inconsistentIndent(),n),n.isDedentAmbiguous&&this._addError(u.Localizer.Diagnostic.inconsistentTabs(),n);break}if(1===this._peekTokenType())break}i.cases.length>0?(0,m.extendRange)(i,i.cases[i.cases.length-1]):this._addError(u.Localizer.Diagnostic.zeroCaseStatementsFound(),t)}else this._addError(u.Localizer.Diagnostic.expectedNewline(),s);else this._addError(u.Localizer.Diagnostic.expectedColon(),s),this._consumeTokensUntilType([2,10])&&this._getNextToken();this._getLanguageVersion()<p.PythonVersion.V3_10&&this._addError(u.Localizer.Diagnostic.matchIncompatible(),t);for(let e=0;e<i.cases.length-1;e++){const t=i.cases[e];!t.guardExpression&&t.isIrrefutable&&this._addError(u.Localizer.Diagnostic.casePatternIsIrrefutable(),t.pattern)}return i}_parseCaseStatement(){const e=this._peekToken();if(!this._consumeTokenIfKeyword(6))return void this._addError(u.Localizer.Diagnostic.expectedCase(),e);const t=this._parsePatternSequence();let n,i;if(t.parseError)n=t.parseError;else if(0===t.list.length)this._addError(u.Localizer.Diagnostic.expectedPatternExpr(),this._peekToken()),n=m.ErrorNode.create(e,11);else if(1!==t.list.length||t.trailingComma)n=m.PatternSequenceNode.create(t.list[0],t.list);else{const e=t.list[0].orPatterns[0];n=69===e.nodeType&&e.isStar?m.PatternSequenceNode.create(t.list[0],t.list):t.list[0]}this._consumeTokenIfKeyword(20)&&(i=this._parseTestExpression(!0));const s=this._parseSuite(this._isInFunction);return m.CaseNode.create(e,n,this._isPatternIrrefutable(n),i,s)}_isPatternIrrefutable(e){return 69===e.nodeType||66===e.nodeType&&e.orPatterns.some((e=>this._isPatternIrrefutable(e)))}_getPatternTargetNames(e,t){switch(e.nodeType){case 65:e.entries.forEach((e=>{this._getPatternTargetNames(e,t)}));break;case 68:e.arguments.forEach((e=>{this._getPatternTargetNames(e.pattern,t)}));break;case 66:e.target&&t.set(e.target.value,!0),e.orPatterns.forEach((e=>{this._getPatternTargetNames(e,t)}));break;case 69:e.isWildcard||t.set(e.target.value,!0);break;case 70:e.entries.forEach((e=>{72===e.nodeType?t.set(e.target.value,!0):(this._getPatternTargetNames(e.keyPattern,t),this._getPatternTargetNames(e.valuePattern,t))}))}}_parsePatternSequence(){const e=this._parseExpressionListGeneric((()=>this._parsePatternAs())),t=e.list.filter((e=>1===e.orPatterns.length&&69===e.orPatterns[0].nodeType&&e.orPatterns[0].isStar));t.length>1&&this._addError(u.Localizer.Diagnostic.duplicateStarPattern(),t[1].orPatterns[0]);const n=new Map;return e.list.forEach((e=>{e.orPatterns.forEach((e=>{69!==e.nodeType||e.isStar||e.isWildcard||(n.has(e.target.value)?this._addError(u.Localizer.Diagnostic.duplicateCapturePatternTarget().format({name:e.target.value}),e):n.set(e.target.value,e))}))})),e}_parsePatternAs(){const e=[];for(;;){const t=this._parsePatternAtom();if(e.push(t),!this._consumeTokenIfOperator(6))break}let t;if(e.length>1&&e.forEach((e=>{69===e.nodeType&&e.isStar&&this._addError(u.Localizer.Diagnostic.starPatternInOrPattern(),e)})),this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?t=m.NameNode.create(e):this._addError(u.Localizer.Diagnostic.expectedNameAfterAs(),this._peekToken())}t&&1===e.length&&69===e[0].nodeType&&e[0].isStar&&this._addError(u.Localizer.Diagnostic.starPatternInAsPattern(),e[0]),e.forEach(((t,n)=>{n<e.length-1&&this._isPatternIrrefutable(t)&&this._addError(u.Localizer.Diagnostic.orPatternIrrefutable(),t)}));const n=new Map;return e.forEach((e=>{this._getPatternTargetNames(e,n)})),e.forEach((e=>{const t=new Map;if(this._getPatternTargetNames(e,t),t.size<n.size){const i=Array.from(n.keys()).filter((e=>!t.has(e))),s=new o.DiagnosticAddendum;s.addMessage(u.Localizer.DiagnosticAddendum.orPatternMissingName().format({name:i.map((e=>`"${e}"`)).join(", ")})),this._addError(u.Localizer.Diagnostic.orPatternMissingName()+s.getString(),e)}})),m.PatternAsNode.create(e,t)}_parsePatternAtom(){const e=this._parsePatternLiteral();if(e)return e;const t=this._parsePatternCaptureOrValue();if(t){const e=this._peekToken();if(0===t.nodeType||!this._consumeTokenIfType(13))return t;const n=this._parseClassPatternArgList(),i=69===t.nodeType?t.target:t.expression,s=m.PatternClassNode.create(i,n);return this._consumeTokenIfType(14)||(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),e),this._consumeTokensUntilType([2]),(0,m.extendRange)(s,this._peekToken())),s}const n=this._peekToken();if(26===this._peekOperatorType()){const e=this._getNextToken(),t=this._getTokenIfIdentifier();return t?m.PatternCaptureNode.create(m.NameNode.create(t),e):(this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),m.ErrorNode.create(e,2))}if(13===n.type||15===n.type){const e=this._getNextToken(),t=this._parsePatternSequence();let i;if(t.parseError)i=t.parseError;else if(1!==t.list.length||t.trailingComma||13!==e.type)i=m.PatternSequenceNode.create(e,t.list);else{const s=t.list[0].orPatterns[0];i=69===s.nodeType&&s.isStar?m.PatternSequenceNode.create(e,t.list):t.list[0],(0,m.extendRange)(i,n)}const s=this._peekToken();return this._consumeTokenIfType(13===n.type?14:16)?(0,m.extendRange)(i,s):(this._addError(13===n.type?u.Localizer.Diagnostic.expectedCloseParen():u.Localizer.Diagnostic.expectedCloseBracket(),n),this._consumeTokensUntilType([10,13===n.type?14:16])),i}if(17===n.type){const e=this._getNextToken(),t=this._parsePatternMapping(e),i=this._peekToken();return this._consumeTokenIfType(18)?(0,m.extendRange)(t,i):(this._addError(u.Localizer.Diagnostic.expectedCloseBrace(),n),this._consumeTokensUntilType([10,18])),t}return this._handleExpressionParseError(11,u.Localizer.Diagnostic.expectedPatternExpr())}_parseClassPatternArgList(){const e=[];let t=!1;for(;;){const n=this._peekTokenType();if(14===n||2===n||1===n)break;const i=this._parseClassPatternArgument();if(i.name?t=!0:t&&!i.name&&this._addError(u.Localizer.Diagnostic.positionArgAfterNamedArg(),i),e.push(i),!this._consumeTokenIfType(12))break}return e}_parseClassPatternArgument(){const e=this._peekToken(),t=this._peekToken(1);let n;7!==e.type&&8!==e.type||9!==t.type||2!==t.operatorType||(this._getNextToken(),n=m.NameNode.create(e),this._getNextToken());const i=this._parsePatternAs();return m.PatternClassArgumentNode.create(i,n)}_parsePatternLiteral(){const e=this._peekToken(),t=this._peekOperatorType();if(6===e.type||33===t)return this._parsePatternLiteralNumber();if(5===e.type){const e=this._parseAtom();return(0,a.assert)(48===e.nodeType),e.strings.forEach((e=>{64&e.token.flags&&this._addError(u.Localizer.Diagnostic.formatStringInPattern(),e)})),m.PatternLiteralNode.create(e)}if(8===e.type){const t=e;if(15===t.keywordType||33===t.keywordType||26===t.keywordType)return m.PatternLiteralNode.create(this._parseAtom())}}_parsePatternLiteralNumber(){const e=this._parseArithmeticExpression();let t,n;return 7===e.nodeType?33!==e.operator&&0!==e.operator||(t=e.leftExpression,n=e.rightExpression):t=e,t&&(55===t.nodeType&&33===t.operator&&(t=t.expression),(40!==t.nodeType||void 0!==n&&t.isImaginary)&&(this._addError(u.Localizer.Diagnostic.expectedComplexNumberLiteral(),e),n=void 0)),n&&(55===n.nodeType&&33===n.operator&&(n=n.expression),40===n.nodeType&&n.isImaginary||this._addError(u.Localizer.Diagnostic.expectedComplexNumberLiteral(),e)),m.PatternLiteralNode.create(e)}_parsePatternMapping(e){const t=this._parseExpressionListGeneric((()=>this._parsePatternMappingItem()));if(t.list.length>0){const n=t.list.filter((e=>72===e.nodeType));return n.length>1&&this._addError(u.Localizer.Diagnostic.duplicateStarStarPattern(),n[1]),m.PatternMappingNode.create(e,t.list)}return t.parseError||m.ErrorNode.create(this._peekToken(),11)}_parsePatternMappingItem(){let e;const t=this._peekToken();if(this._consumeTokenIfOperator(29)){const e=this._getTokenIfIdentifier();if(!e)return this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),m.ErrorNode.create(this._peekToken(),11);const n=m.NameNode.create(e);return"_"===e.value&&this._addError(u.Localizer.Diagnostic.starStarWildcardNotAllowed(),n),m.PatternMappingExpandEntryNode.create(t,n)}const n=this._parsePatternLiteral();if(n)e=n;else{const t=this._parsePatternCaptureOrValue();t&&(73===t.nodeType?e=t:(this._addError(u.Localizer.Diagnostic.expectedPatternValue(),t),e=m.ErrorNode.create(this._peekToken(),11)))}let i;return e||(this._addError(u.Localizer.Diagnostic.expectedPatternExpr(),this._peekToken()),e=m.ErrorNode.create(this._peekToken(),11)),this._consumeTokenIfType(10)?i=this._parsePatternAs():(this._addError(u.Localizer.Diagnostic.expectedColon(),this._peekToken()),i=m.ErrorNode.create(this._peekToken(),11)),m.PatternMappingKeyEntryNode.create(e,i)}_parsePatternCaptureOrValue(){const e=this._peekToken();if(7===e.type||8===e.type){let e;for(;;){const t=this._getTokenIfIdentifier();if(!t){this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken());break}{const n=m.NameNode.create(t);e=e?m.MemberAccessNode.create(e,n):n}if(!this._consumeTokenIfType(20))break}return e?35===e.nodeType?m.PatternValueNode.create(e):m.PatternCaptureNode.create(e):(this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),m.ErrorNode.create(this._peekToken(),11))}}_parseIfStatement(e=20){const t=this._getKeywordToken(e),n=this._parseTestExpression(!0),i=this._parseSuite(this._isInFunction),s=m.IfNode.create(t,n,i);return this._consumeTokenIfKeyword(13)?(s.elseSuite=this._parseSuite(this._isInFunction),s.elseSuite.parent=s,(0,m.extendRange)(s,s.elseSuite)):12===this._peekKeywordType()&&(s.elseSuite=this._parseIfStatement(12),s.elseSuite.parent=s,(0,m.extendRange)(s,s.elseSuite)),s}_parseLoopSuite(){const e=this._isInLoop,t=this._isInFinally;this._isInLoop=!0,this._isInFinally=!1;const n=this._parseSuite(this._isInFunction);return this._isInLoop=e,this._isInFinally=t,n}_parseSuite(e=!1,t=!1,n){const i=this._peekToken(),s=m.SuiteNode.create(i);if(!this._consumeTokenIfType(10)&&(this._addError(u.Localizer.Diagnostic.expectedColon(),i),this._consumeTokensUntilType([2,10])))if(10===this._peekTokenType())this._getNextToken();else if(3!==this._peekToken(1).type)return this._getNextToken(),s;if(t){if(this._consumeTokenIfType(2)){let e=0;for(;;){const t=this._getNextToken();if(3===t.type&&e++,4===t.type&&(t.isDedentAmbiguous&&this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t),e--,0===e))break;if(1===t.type)break}}else this._parseSimpleStatement();return this._tokenIndex>0&&(0,m.extendRange)(s,this._tokenizerOutput.tokens.getItemAt(this._tokenIndex-1)),s}n&&n();const r=this._isInFunction;if(this._isInFunction=e,this._consumeTokenIfType(2)){n&&n();const e=this._peekToken();if(this._consumeTokenIfType(3)){const t=e;t.isIndentAmbiguous&&this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t)}else this._addError(u.Localizer.Diagnostic.expectedIndentedBlock(),this._peekToken());for(;;){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(u.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(u.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseStatement();t?(t.parent=s,s.statements.push(t)):this._consumeTokensUntilType([2]);const n=this._peekToken();if(this._consumeTokenIfType(4)){n.matchesIndent||this._addError(u.Localizer.Diagnostic.inconsistentIndent(),n),n.isDedentAmbiguous&&this._addError(u.Localizer.Diagnostic.inconsistentTabs(),n);break}if(1===this._peekTokenType())break}}else{const e=this._parseSimpleStatement();s.statements.push(e),e.parent=s}return s.statements.length>0&&(0,m.extendRange)(s,s.statements[s.statements.length-1]),this._isInFunction=r,s}_parseForStatement(e){const t=this._getKeywordToken(17),n=this._parseExpressionListAsPossibleTuple(2,u.Localizer.Diagnostic.expectedExpr(),t);let i,s,r;this._consumeTokenIfKeyword(22)?(i=this._parseTestListAsExpression(2,u.Localizer.Diagnostic.expectedInExpr()),s=this._parseLoopSuite(),this._consumeTokenIfKeyword(13)&&(r=this._parseSuite(this._isInFunction))):(i=this._handleExpressionParseError(0,u.Localizer.Diagnostic.expectedIn()),s=m.SuiteNode.create(this._peekToken()));const a=m.ForNode.create(t,n,i,s);return a.elseSuite=r,r&&((0,m.extendRange)(a,r),r.parent=a),e&&(a.isAsync=!0,a.asyncToken=e,(0,m.extendRange)(a,e)),a}_tryParseListComprehension(e){const t=this._tryParseCompForStatement();if(!t)return;56===e.nodeType?this._addError(u.Localizer.Diagnostic.unpackIllegalInComprehension(),e):16===e.nodeType&&this._addError(u.Localizer.Diagnostic.dictExpandIllegalInComprehension(),e);const n=m.ListComprehensionNode.create(e),i=[t];for(;;){const e=this._tryParseCompForStatement()||this._tryParseCompIfStatement();if(!e)break;e.parent=n,i.push(e)}return n.comprehensions=i,i.length>0&&(i.forEach((e=>{e.parent=n})),(0,m.extendRange)(n,i[i.length-1])),n}_tryParseCompForStatement(){const e=this._peekKeywordType();if(3===e){const e=this._peekToken(1);if(8!==e.type||17!==e.keywordType)return}else if(17!==e)return;let t;3===this._peekKeywordType()&&(t=this._getKeywordToken(3));const n=this._getKeywordToken(17),i=this._parseExpressionListAsPossibleTuple(2,u.Localizer.Diagnostic.expectedExpr(),n);let s;this._consumeTokenIfKeyword(22)?this._disallowAssignmentExpression((()=>{s=this._parseOrTest()})):s=this._handleExpressionParseError(0,u.Localizer.Diagnostic.expectedIn());const r=m.ListComprehensionForNode.create(t||n,i,s);return t&&(r.isAsync=!0,r.asyncToken=t),r}_tryParseCompIfStatement(){if(20!==this._peekKeywordType())return;const e=this._getKeywordToken(20),t=this._tryParseLambdaExpression()||this._parseAssignmentExpression();return m.ListComprehensionIfNode.create(e,t)}_parseWhileStatement(){const e=this._getKeywordToken(35),t=m.WhileNode.create(e,this._parseTestExpression(!0),this._parseLoopSuite());return this._consumeTokenIfKeyword(13)&&(t.elseSuite=this._parseSuite(this._isInFunction),t.elseSuite.parent=t,(0,m.extendRange)(t,t.elseSuite)),t}_parseTryStatement(){const e=this._getKeywordToken(34),t=this._parseSuite(this._isInFunction),n=m.TryNode.create(e,t);let i=!1;for(;;){const e=this._peekToken();if(!this._consumeTokenIfKeyword(14))break;let t,s;if(10!==this._peekTokenType())if(t=this._parseTestExpression(!0),this._consumeTokenIfKeyword(1))s=this._getTokenIfIdentifier(),s||this._addError(u.Localizer.Diagnostic.expectedNameAfterAs(),this._peekToken());else{const e=this._peekToken();this._consumeTokenIfType(12)&&(this._addError(u.Localizer.Diagnostic.expectedAsAfterException(),e),this._parseTestExpression(!1))}t?i&&this._addError(u.Localizer.Diagnostic.namedExceptAfterCatchAll(),t):(i&&this._addError(u.Localizer.Diagnostic.duplicateCatchAll(),e),i=!0);const r=this._parseSuite(this._isInFunction),a=m.ExceptNode.create(e,r);t&&(a.typeExpression=t,a.typeExpression.parent=a),s&&(a.name=m.NameNode.create(s),a.name.parent=a),n.exceptClauses.push(a),a.parent=n}return n.exceptClauses.length>0&&((0,m.extendRange)(n,n.exceptClauses[n.exceptClauses.length-1]),this._consumeTokenIfKeyword(13)&&(n.elseSuite=this._parseSuite(this._isInFunction),n.elseSuite.parent=n,(0,m.extendRange)(n,n.elseSuite))),this._consumeTokenIfKeyword(16)&&(n.finallySuite=this._parseSuite(this._isInFunction),n.finallySuite.parent=n,(0,m.extendRange)(n,n.finallySuite)),n.finallySuite||0!==n.exceptClauses.length||this._addError(u.Localizer.Diagnostic.tryWithoutExcept(),e),n}_parseFunctionDef(e,t){const n=this._getKeywordToken(10),i=this._getTokenIfIdentifier();if(!i)return this._addError(u.Localizer.Diagnostic.expectedFunctionName(),n),m.ErrorNode.create(n,10,void 0,t);const s=this._peekToken();if(!this._consumeTokenIfType(13))return this._addError(u.Localizer.Diagnostic.expectedOpenParen(),this._peekToken()),m.ErrorNode.create(i,10,m.NameNode.create(i),t);const r=this._parseVarArgsList(14,!0);let a,o;this._consumeTokenIfType(14)||(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),s),this._consumeTokensUntilType([10])),this._consumeTokenIfType(21)&&(a=this._parseTypeAnnotation());const l=this._parseSuite(!0,this._parseOptions.skipFunctionAndClassBody,(()=>{o||(o=this._getTypeAnnotationCommentText())})),c=m.FunctionNode.create(n,m.NameNode.create(i),l);return e&&(c.isAsync=!0,(0,m.extendRange)(c,e)),c.parameters=r,r.forEach((e=>{e.parent=c})),t&&(c.decorators=t,t.forEach((e=>{e.parent=c})),t.length>0&&(0,m.extendRange)(c,t[0])),a&&(c.returnTypeAnnotation=a,c.returnTypeAnnotation.parent=c,(0,m.extendRange)(c,a)),o&&this._parseFunctionTypeAnnotationComment(o,c),c}_parseVarArgsList(e,t){const n=new Map,i=[];let s=!1,r=!1,a=!1,o=!1,l=!1,c=!1;for(;this._peekTokenType()!==e;){const p=this._parseParameter(t);if(!p){this._consumeTokensUntilType([e]);break}if(p.name){const e=p.name.value;n.has(e)?this._addError(u.Localizer.Diagnostic.duplicateParam().format({name:e}),p.name):n.set(e,e)}else 0===p.category&&0===i.length&&this._addError(u.Localizer.Diagnostic.positionOnlyFirstParam(),p);0===p.category&&(p.name?p.defaultValue?s=!0:!s||a||l||r||(this._addError(u.Localizer.Diagnostic.nonDefaultAfterDefault(),p),r=!0):(o?this._addError(u.Localizer.Diagnostic.duplicatePositionOnly(),p):a?this._addError(u.Localizer.Diagnostic.positionOnlyAfterKeywordOnly(),p):l&&this._addError(u.Localizer.Diagnostic.positionOnlyAfterArgs(),p),o=!0)),i.push(p),1===p.category&&(p.name?(l&&this._addError(u.Localizer.Diagnostic.duplicateArgsParam(),p),l=!0):(a?this._addError(u.Localizer.Diagnostic.duplicateKeywordOnly(),p):l&&this._addError(u.Localizer.Diagnostic.keywordOnlyAfterArgs(),p),a=!0)),2===p.category?(c&&this._addError(u.Localizer.Diagnostic.duplicateKwargsParam(),p),c=!0):c&&this._addError(u.Localizer.Diagnostic.paramAfterKwargsParam(),p);const d=this._consumeTokenIfType(12);if(t&&!p.typeAnnotation){const e=this._parseVariableTypeAnnotationComment();e&&(p.typeAnnotationComment=e,p.typeAnnotationComment.parent=p,(0,m.extendRange)(p,p.typeAnnotationComment))}if(!d)break}if(i.length>0){const e=i[i.length-1];1!==e.category||e.name||this._addError(u.Localizer.Diagnostic.expectedNamedParameter(),e)}return i}_parseParameter(e){let t=0,n=0;const i=this._peekToken();this._consumeTokenIfOperator(26)?t=1:this._consumeTokenIfOperator(29)?t=2:this._consumeTokenIfOperator(10)&&(this._getLanguageVersion()<p.PythonVersion.V3_8&&!this._parseOptions.isStubFile&&this._addError(u.Localizer.Diagnostic.positionOnlyIncompatible(),i),n=1);const s=this._getTokenIfIdentifier();if(!s){if(1===t)return m.ParameterNode.create(i,1);if(1===n)return m.ParameterNode.create(i,0);if(13===this._peekTokenType()){const e=this._getNextToken();this._consumeTokensUntilType([14])&&this._getNextToken(),this._addError(u.Localizer.Diagnostic.sublistParamsIncompatible(),e)}else this._addError(u.Localizer.Diagnostic.expectedParamName(),this._peekToken())}let r=0;1===t?r=1:2===t&&(r=2);const a=m.ParameterNode.create(i,r);return s&&(a.name=m.NameNode.create(s),a.name.parent=a,(0,m.extendRange)(a,s)),e&&this._consumeTokenIfType(10)&&(a.typeAnnotation=this._parseTypeAnnotation(),a.typeAnnotation.parent=a,(0,m.extendRange)(a,a.typeAnnotation)),this._consumeTokenIfOperator(2)&&(a.defaultValue=this._parseTestExpression(!1),a.defaultValue.parent=a,(0,m.extendRange)(a,a.defaultValue),t>0&&this._addError(u.Localizer.Diagnostic.defaultValueNotAllowed(),a.defaultValue)),a}_parseWithStatement(e){const t=this._getKeywordToken(36);let n=[];const i=this._peekToken();let s=!1;if(13===i.type){const e=this._tokenIndex;this._suppressErrors((()=>{for(this._getNextToken();n.push(this._parseWithItem()),this._consumeTokenIfType(12)&&14!==this._peekToken().type;);14===this._peekToken().type&&10===this._peekToken(1).type&&(s=1!==n.length||void 0!==n[0].target),this._tokenIndex=e,n=[]}))}for(s&&(this._consumeTokenIfType(13),this._getLanguageVersion()<p.PythonVersion.V3_9&&this._addError(u.Localizer.Diagnostic.parenthesizedContextManagerIllegal(),i));n.push(this._parseWithItem()),this._consumeTokenIfType(12)&&14!==this._peekToken().type;);s&&(this._consumeTokenIfType(14)||this._addError(u.Localizer.Diagnostic.expectedCloseParen(),i));const r=this._parseSuite(this._isInFunction),a=m.WithNode.create(t,r);return e&&(a.isAsync=!0,a.asyncToken=e,(0,m.extendRange)(a,e)),a.withItems=n,n.forEach((e=>{e.parent=a})),a}_parseWithItem(){const e=this._parseTestExpression(!0),t=m.WithItemNode.create(e);return this._consumeTokenIfKeyword(1)&&(t.target=this._parseExpression(!1),t.target.parent=t,(0,m.extendRange)(t,t.target)),t}_parseDecorated(){const e=[];for(;22===this._peekOperatorType();)e.push(this._parseDecorator());const t=this._peekToken();if(8===t.type)if(3===t.keywordType){if(this._getNextToken(),10===this._peekKeywordType())return this._parseFunctionDef(t,e);this._addError(u.Localizer.Diagnostic.expectedFunctionAfterAsync(),this._peekToken())}else{if(10===t.keywordType)return this._parseFunctionDef(void 0,e);if(7===t.keywordType)return this._parseClassDef(e)}return this._addError(u.Localizer.Diagnostic.expectedAfterDecorator(),this._peekToken()),m.ClassNode.createDummyForDecorators(e)}_parseDecorator(){const e=this._getNextToken();(0,a.assert)(22===e.operatorType);const t=this._parseTestExpression(!0);if(this._getLanguageVersion()<p.PythonVersion.V3_9){let e=!1;(this._isNameOrMemberAccessExpression(t)||9===t.nodeType&&this._isNameOrMemberAccessExpression(t.leftExpression))&&(e=!0),e||this._addError(u.Localizer.Diagnostic.expectedDecoratorExpr(),t)}const n=m.DecoratorNode.create(e,t);return this._consumeTokenIfType(2)||(this._addError(u.Localizer.Diagnostic.expectedDecoratorNewline(),this._peekToken()),this._consumeTokensUntilType([2])),n}_isNameOrMemberAccessExpression(e){return 38===e.nodeType||35===e.nodeType&&this._isNameOrMemberAccessExpression(e.leftExpression)}_parseClassDef(e){const t=this._getKeywordToken(7);let n=this._getTokenIfIdentifier();n||(this._addError(u.Localizer.Diagnostic.expectedClassName(),this._peekToken()),n=g.IdentifierToken.create(0,0,"",void 0));let i=[];const s=this._peekToken();this._consumeTokenIfType(13)&&(i=this._parseArgList(),this._consumeTokenIfType(14)||this._addError(u.Localizer.Diagnostic.expectedCloseParen(),s));const r=this._parseSuite(!1,this._parseOptions.skipFunctionAndClassBody),a=m.ClassNode.create(t,m.NameNode.create(n),r);return a.arguments=i,i.forEach((e=>{e.parent=a})),e&&(a.decorators=e,e.length>0&&(e.forEach((e=>{e.parent=a})),(0,m.extendRange)(a,e[0]))),a}_parsePassStatement(){return m.PassNode.create(this._getKeywordToken(30))}_parseBreakStatement(){const e=this._getKeywordToken(5);return this._isInLoop||this._addError(u.Localizer.Diagnostic.breakOutsideLoop(),e),m.BreakNode.create(e)}_parseContinueStatement(){const e=this._getKeywordToken(8);return this._isInLoop?this._isInFinally&&this._addError(u.Localizer.Diagnostic.continueInFinally(),e):this._addError(u.Localizer.Diagnostic.continueOutsideLoop(),e),m.ContinueNode.create(e)}_parseReturnStatement(){const e=this._getKeywordToken(32),t=m.ReturnNode.create(e);if(this._isInFunction||this._addError(u.Localizer.Diagnostic.returnOutsideFunction(),e),!this._isNextTokenNeverExpression()){const e=this._parseTestOrStarListAsExpression(!0,2,u.Localizer.Diagnostic.expectedReturnExpr());this._reportConditionalErrorForStarTupleElement(e),t.returnExpression=e,t.returnExpression.parent=t,(0,m.extendRange)(t,e)}return t}_parseFromStatement(){const e=this._getKeywordToken(18),t=this._parseDottedModuleName(!0),n=m.ImportFromNode.create(e,t),i=0===t.leadingDots&&1===t.nameParts.length&&"__future__"===t.nameParts[0].value,s=this._peekToken();if(this._consumeTokenIfKeyword(21)){(0,m.extendRange)(n,s);const e=this._peekToken();if(this._consumeTokenIfOperator(26))(0,m.extendRange)(n,e),n.isWildcardImport=!0,n.wildcardToken=e,this._containsWildcardImport=!0;else{const e=this._peekToken(),t=this._consumeTokenIfType(13);let s;for(;;){const e=this._getTokenIfIdentifier();if(!e)break;s=void 0;const t=m.ImportFromAsNode.create(m.NameNode.create(e));if(this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?(t.alias=m.NameNode.create(e),t.alias.parent=t,(0,m.extendRange)(t,e)):this._addError(u.Localizer.Diagnostic.expectedImportAlias(),this._peekToken())}n.imports.push(t),t.parent=n,(0,m.extendRange)(n,t),i&&this._futureImportMap.set(e.value,!0);const r=this._peekToken();if(!this._consumeTokenIfType(12))break;s=r}if(0===n.imports.length&&this._addError(u.Localizer.Diagnostic.expectedImportSymbols(),this._peekToken()),t){n.usesParens=!0;const t=this._peekToken();this._consumeTokenIfType(14)?(0,m.extendRange)(n,t):this._addError(u.Localizer.Diagnostic.expectedCloseParen(),e)}else s&&this._addError(u.Localizer.Diagnostic.trailingCommaInFromImport(),s)}}else this._addError(u.Localizer.Diagnostic.expectedImport(),this._peekToken()),t.hasTrailingDot||(n.missingImportKeyword=!0);this._importedModules.push({nameNode:n.module,leadingDots:n.module.leadingDots,nameParts:n.module.nameParts.map((e=>e.value)),importedSymbols:n.imports.map((e=>e.name.value))});let r=!1;if(1===n.module.nameParts.length){const e=n.module.nameParts[0].value;"typing"!==e&&"typing_extensions"!==e||(r=!0)}if(r){const e=["Literal","TypeAlias","Annotated"];n.isWildcardImport?e.forEach((e=>{this._typingSymbolAliases.set(e,e)})):n.imports.forEach((t=>{var n;e.some((e=>e===t.name.value))&&this._typingSymbolAliases.set((null===(n=t.alias)||void 0===n?void 0:n.value)||t.name.value,t.name.value)}))}return n}_parseImportStatement(){var e;const t=this._getKeywordToken(21),n=m.ImportNode.create(t);for(;;){const t=this._parseDottedModuleName(),i=m.ImportAsNode.create(t);if(this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?(i.alias=m.NameNode.create(e),i.alias.parent=i,(0,m.extendRange)(i,i.alias)):this._addError(u.Localizer.Diagnostic.expectedImportAlias(),this._peekToken())}if(i.module.leadingDots>0&&this._addError(u.Localizer.Diagnostic.relativeImportNotAllowed(),i.module),n.list.push(i),i.parent=n,this._importedModules.push({nameNode:i.module,leadingDots:i.module.leadingDots,nameParts:i.module.nameParts.map((e=>e.value)),importedSymbols:void 0}),1===t.nameParts.length){const n=t.nameParts[0].value;"typing"!==n&&"typing_extensions"!==n||this._typingImportAliases.push((null===(e=i.alias)||void 0===e?void 0:e.value)||n)}if(!this._consumeTokenIfType(12))break}return n.list.length>0&&(0,m.extendRange)(n,n.list[n.list.length-1]),n}_parseDottedModuleName(e=!1){var t;const n=m.ModuleNameNode.create(this._peekToken());for(;;){const e=null!==(t=this._getTokenIfType(19))&&void 0!==t?t:this._getTokenIfType(20);if(!e)break;19===e.type?n.leadingDots+=3:n.leadingDots++,(0,m.extendRange)(n,e)}for(;;){const t=this._getTokenIfIdentifier();if(!t){(!e||0===n.leadingDots||n.nameParts.length>0)&&(this._addError(u.Localizer.Diagnostic.expectedModuleName(),this._peekToken()),n.hasTrailingDot=!0);break}const i=m.NameNode.create(t);n.nameParts.push(i),i.parent=n,(0,m.extendRange)(n,i);const s=this._peekToken();if(!this._consumeTokenIfType(20))break;(0,m.extendRange)(n,s)}return n}_parseGlobalStatement(){const e=this._getKeywordToken(19),t=m.GlobalNode.create(e);return t.nameList=this._parseNameList(),t.nameList.length>0&&(t.nameList.forEach((e=>{e.parent=t})),(0,m.extendRange)(t,t.nameList[t.nameList.length-1])),t}_parseNonlocalStatement(){const e=this._getKeywordToken(27),t=m.NonlocalNode.create(e);return t.nameList=this._parseNameList(),t.nameList.length>0&&(t.nameList.forEach((e=>{e.parent=t})),(0,m.extendRange)(t,t.nameList[t.nameList.length-1])),t}_parseNameList(){const e=[];for(;;){const t=this._getTokenIfIdentifier();if(!t){this._addError(u.Localizer.Diagnostic.expectedIdentifier(),this._peekToken());break}if(e.push(m.NameNode.create(t)),!this._consumeTokenIfType(12))break}return e}_parseRaiseStatement(){const e=this._getKeywordToken(31),t=m.RaiseNode.create(e);return this._isNextTokenNeverExpression()||(t.typeExpression=this._parseTestExpression(!0),t.typeExpression.parent=t,(0,m.extendRange)(t,t.typeExpression),this._consumeTokenIfKeyword(18)?(t.valueExpression=this._parseTestExpression(!0),t.valueExpression.parent=t,(0,m.extendRange)(t,t.valueExpression)):this._consumeTokenIfType(12)&&(t.valueExpression=this._parseTestExpression(!0),t.valueExpression.parent=t,(0,m.extendRange)(t,t.valueExpression),this._consumeTokenIfType(12)&&(t.tracebackExpression=this._parseTestExpression(!0),t.tracebackExpression.parent=t,(0,m.extendRange)(t,t.tracebackExpression)))),t}_parseAssertStatement(){const e=this._getKeywordToken(2),t=this._parseTestExpression(!0),n=m.AssertNode.create(e,t);if(this._consumeTokenIfType(12)){const e=this._parseTestExpression(!0);n.exceptionExpression=e,n.exceptionExpression.parent=n,(0,m.extendRange)(n,e)}return n}_parseDelStatement(){const e=this._getKeywordToken(11),t=this._parseExpressionList(!0);t.parseError||0!==t.list.length||this._addError(u.Localizer.Diagnostic.expectedDelExpr(),this._peekToken());const n=m.DelNode.create(e);return n.expressions=t.list,n.expressions.length>0&&(n.expressions.forEach((e=>{e.parent=n})),(0,m.extendRange)(n,n.expressions[n.expressions.length-1])),n}_parseYieldExpression(){const e=this._getKeywordToken(37),t=this._peekToken();if(this._consumeTokenIfKeyword(18))return this._getLanguageVersion()<p.PythonVersion.V3_3&&this._addError(u.Localizer.Diagnostic.yieldFromIllegal(),t),m.YieldFromNode.create(e,this._parseTestExpression(!0));let n;return this._isNextTokenNeverExpression()||(n=this._parseTestOrStarListAsExpression(!0,2,u.Localizer.Diagnostic.expectedYieldExpr()),this._reportConditionalErrorForStarTupleElement(n)),m.YieldNode.create(e,n)}_tryParseYieldExpression(){if(37===this._peekKeywordType())return this._parseYieldExpression()}_parseSimpleStatement(){const e=m.StatementListNode.create(this._peekToken());for(;;){if(0===this._peekTokenType()){const e=this._getNextToken(),t=this._fileContents.substr(e.start,e.length).charCodeAt(0);this._addError(u.Localizer.Diagnostic.invalidTokenChars().format({text:`\\u${t.toString(16)}`}),e),this._consumeTokensUntilType([2]);break}const t=this._parseSmallStatement();if(e.statements.push(t),t.parent=e,(0,m.extendRange)(e,t),0===t.nodeType)break;if(!this._consumeTokenIfType(11))break;const n=this._peekTokenType();if(2===n||1===n)break}return this._consumeTokenIfType(2)||this._addError(u.Localizer.Diagnostic.expectedNewlineOrSemicolon(),this._peekToken()),e}_parseSmallStatement(){switch(this._peekKeywordType()){case 30:return this._parsePassStatement();case 5:return this._parseBreakStatement();case 8:return this._parseContinueStatement();case 32:return this._parseReturnStatement();case 18:return this._parseFromStatement();case 21:return this._parseImportStatement();case 19:return this._parseGlobalStatement();case 27:return this._parseNonlocalStatement();case 31:return this._parseRaiseStatement();case 2:return this._parseAssertStatement();case 11:return this._parseDelStatement();case 37:return this._parseYieldExpression()}return this._parseExpressionStatement()}_makeExpressionOrTuple(e,t){if(1===e.list.length&&!e.trailingComma)return 56===e.list[0].nodeType&&this._addError(u.Localizer.Diagnostic.unpackNotAllowed(),e.list[0]),e.list[0];const n=e.list.length>0?e.list[0]:this._peekToken(-1),i=m.TupleNode.create(n,t);return i.expressions=e.list,e.list.length>0&&(e.list.forEach((e=>{e.parent=i})),(0,m.extendRange)(i,e.list[e.list.length-1])),i}_parseExpressionListAsPossibleTuple(e,t,n){if(this._isNextTokenNeverExpression())return this._addError(t,n),m.ErrorNode.create(n,e);const i=this._parseExpressionList(!0);return i.parseError?i.parseError:this._makeExpressionOrTuple(i,!1)}_parseTestListAsExpression(e,t){if(this._isNextTokenNeverExpression())return this._handleExpressionParseError(e,t);const n=this._parseTestExpressionList();return n.parseError?n.parseError:this._makeExpressionOrTuple(n,!1)}_parseTestOrStarListAsExpression(e,t,n){if(this._isNextTokenNeverExpression())return this._handleExpressionParseError(t,n);const i=this._parseTestOrStarExpressionList(e);return i.parseError?i.parseError:this._makeExpressionOrTuple(i,!1)}_parseExpressionList(e){return this._parseExpressionListGeneric((()=>this._parseExpression(e)))}_parseTestExpressionList(){return this._parseExpressionListGeneric((()=>this._parseTestExpression(!1)))}_parseTestOrStarExpressionList(e){const t=this._parseExpressionListGeneric((()=>this._parseTestOrStarExpression(e)));if(!t.parseError){let e=!1;for(const n of t.list)if(56===n.nodeType){if(e){this._addError(u.Localizer.Diagnostic.duplicateUnpack(),n);break}e=!0}}return t}_parseExpression(e){const t=this._peekToken();return e&&this._consumeTokenIfOperator(26)?m.UnpackNode.create(t,this._parseExpression(!1)):this._parseBitwiseOrExpression()}_parseTestOrStarExpression(e){return 26===this._peekOperatorType()?this._parseExpression(!0):this._parseTestExpression(e)}_parseTestExpression(e){if(24===this._peekKeywordType())return this._parseLambdaExpression();const t=e?this._parseAssignmentExpression():this._parseOrTest();if(0===t.nodeType)return t;if(!this._consumeTokenIfKeyword(20))return t;const n=this._parseOrTest();if(0===n.nodeType)return n;if(!this._consumeTokenIfKeyword(13))return this._handleExpressionParseError(1,u.Localizer.Diagnostic.expectedElse());const i=this._parseTestExpression(!0);return 0===i.nodeType?i:m.TernaryNode.create(t,n,i)}_parseAssignmentExpression(){const e=this._parseOrTest();if(0===e.nodeType)return e;if(38!==e.nodeType)return e;const t=this._peekToken();if(!this._consumeTokenIfOperator(35))return e;this._assignmentExpressionsAllowed&&!this._isParsingTypeAnnotation||this._addError(u.Localizer.Diagnostic.walrusNotAllowed(),t),this._getLanguageVersion()<p.PythonVersion.V3_8&&this._addError(u.Localizer.Diagnostic.walrusIllegal(),t);const n=this._parseTestExpression(!1);return m.AssignmentExpressionNode.create(e,n)}_parseOrTest(){let e=this._parseAndTest();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfKeyword(29))break;const n=this._parseAndTest();e=m.BinaryOperationNode.create(e,n,t,37)}return e}_parseAndTest(){let e=this._parseNotTest();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfKeyword(0))break;const n=this._parseNotTest();e=m.BinaryOperationNode.create(e,n,t,36)}return e}_parseNotTest(){const e=this._peekToken();if(this._consumeTokenIfKeyword(28)){const t=this._parseNotTest();return m.UnaryOperationNode.create(e,t,38)}return this._parseComparison()}_parseComparison(){let e=this._parseBitwiseOrExpression();if(0===e.nodeType)return e;for(;;){let t;const n=this._peekToken();if(y.Tokenizer.isOperatorComparison(this._peekOperatorType()))t=this._peekOperatorType(),19===t&&(this._addError(u.Localizer.Diagnostic.operatorLessOrGreaterDeprecated(),n),t=28),this._getNextToken();else if(this._consumeTokenIfKeyword(22))t=41;else if(this._consumeTokenIfKeyword(23))t=this._consumeTokenIfKeyword(28)?40:39;else if(28===this._peekKeywordType()){const e=this._peekToken(1);8===e.type&&22===e.keywordType&&(this._getNextToken(),this._getNextToken(),t=42)}if(void 0===t)break;const i=this._parseComparison();e=m.BinaryOperationNode.create(e,i,n,t)}return e}_parseBitwiseOrExpression(){let e=this._parseBitwiseXorExpression();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfOperator(6))break;const n=this._parseBitwiseXorExpression();e=m.BinaryOperationNode.create(e,n,t,6)}return e}_parseBitwiseXorExpression(){let e=this._parseBitwiseAndExpression();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfOperator(8))break;const n=this._parseBitwiseAndExpression();e=m.BinaryOperationNode.create(e,n,t,8)}return e}_parseBitwiseAndExpression(){let e=this._parseShiftExpression();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfOperator(3))break;const n=this._parseShiftExpression();e=m.BinaryOperationNode.create(e,n,t,3)}return e}_parseShiftExpression(){let e=this._parseArithmeticExpression();if(0===e.nodeType)return e;let t=this._peekToken(),n=this._peekOperatorType();for(;17===n||31===n;){this._getNextToken();const i=this._parseArithmeticExpression();e=m.BinaryOperationNode.create(e,i,t,n),t=this._peekToken(),n=this._peekOperatorType()}return e}_parseArithmeticExpression(){let e=this._parseArithmeticTerm();if(0===e.nodeType)return e;let t=this._peekToken(),n=this._peekOperatorType();for(;0===n||33===n;){this._getNextToken();const i=this._parseArithmeticTerm();if(0===i.nodeType)return i;e=m.BinaryOperationNode.create(e,i,t,n),t=this._peekToken(),n=this._peekOperatorType()}return e}_parseArithmeticTerm(){let e=this._parseArithmeticFactor();if(0===e.nodeType)return e;let t=this._peekToken(),n=this._peekOperatorType();for(;26===n||22===n||10===n||24===n||13===n;){this._getNextToken();const i=this._parseArithmeticFactor();e=m.BinaryOperationNode.create(e,i,t,n),t=this._peekToken(),n=this._peekOperatorType()}return e}_parseArithmeticFactor(){const e=this._peekToken(),t=this._peekOperatorType();if(0===t||33===t||5===t){this._getNextToken();const n=this._parseArithmeticFactor();return m.UnaryOperationNode.create(e,n,t)}const n=this._parseAtomExpression();if(0===n.nodeType)return n;const i=this._peekToken();if(this._consumeTokenIfOperator(29)){const e=this._parseArithmeticFactor();return m.BinaryOperationNode.create(n,e,i,29)}return n}_isTypingAnnotation(e,t){if(38===e.nodeType){if(this._typingSymbolAliases.get(e.value)===t)return!0}else if(35===e.nodeType&&38===e.leftExpression.nodeType&&e.memberName.value===t){const t=e.leftExpression.value;return this._typingImportAliases.some((e=>e===t))}return!1}_parseAtomExpression(){let e;4!==this._peekKeywordType()||this._isParsingTypeAnnotation||(e=this._getKeywordToken(4),this._getLanguageVersion()<p.PythonVersion.V3_5&&this._addError(u.Localizer.Diagnostic.awaitIllegal(),e));let t=this._parseAtom();if(0===t.nodeType)return t;for(;;){const e=this._peekToken();if(this._consumeTokenIfType(13)){const n=this._isParsingTypeAnnotation;this._isParsingTypeAnnotation=!1;const i=this._parseArgList(),s=m.CallNode.create(t);s.arguments=i,i.length>0&&(i.forEach((e=>{e.parent=s})),(0,m.extendRange)(s,i[i.length-1]));const r=this._peekToken();let a=!1;if(this._consumeTokenIfType(14)?((0,m.extendRange)(s,r),a=!0):(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),e),this._consumeTokensUntilType([2]),(0,m.extendRange)(s,this._peekToken())),this._isParsingTypeAnnotation=n,this._isParsingTypeAnnotation){const e=new o.DiagnosticAddendum;38===t.nodeType&&"type"===t.value&&(e.addMessage(u.Localizer.DiagnosticAddendum.useTypeInstead()),this._addError(u.Localizer.Diagnostic.typeCallNotAllowed()+e.getString(),s))}if(t=s,!a)break}else if(this._consumeTokenIfType(15)){const n=this._isParsingIndexTrailer,i=this._isParsingTypeAnnotation;(this._isTypingAnnotation(t,"Literal")||this._isTypingAnnotation(t,"Annotated"))&&(this._isParsingTypeAnnotation=!1),this._isParsingIndexTrailer=!0;const s=this._parseSubscriptList();this._isParsingTypeAnnotation=i,this._isParsingIndexTrailer=n;const r=this._peekToken(),a=m.IndexNode.create(t,s.list,s.trailingComma,r);(0,m.extendRange)(a,a),this._consumeTokenIfType(16)||this._handleExpressionParseError(6,u.Localizer.Diagnostic.expectedCloseBracket(),e,a),t=a}else{if(!this._consumeTokenIfType(20))break;{const n=this._getTokenIfIdentifier();if(!n)return this._handleExpressionParseError(7,u.Localizer.Diagnostic.expectedMemberName(),e,t);t=m.MemberAccessNode.create(t,m.NameNode.create(n))}}}return e?m.AwaitNode.create(e,t):t}_parseSubscriptList(){const e=[];let t=!1,n=!1;for(;;){const i=this._peekToken();if(10!==i.type&&this._isNextTokenNeverExpression())break;let s=0;this._consumeTokenIfOperator(26)?s=1:this._consumeTokenIfOperator(29)&&(s=2);let r,a=this._parsePossibleSlice();if(0===s&&this._consumeTokenIfOperator(2)){const e=a;a=this._parsePossibleSlice(),38===e.nodeType?r=e.token:this._addError(u.Localizer.Diagnostic.expectedParamName(),e)}const o=m.ArgumentNode.create(i,a,s);if(r&&(o.name=m.NameNode.create(r),o.name.parent=o),o.name?t=!0:t&&0===o.argumentCategory&&this._addError(u.Localizer.Diagnostic.positionArgAfterNamedArg(),o),e.push(o),o.name&&this._addError(u.Localizer.Diagnostic.keywordSubscriptIllegal(),o.name),0!==s&&this._addError(u.Localizer.Diagnostic.unpackedSubscriptIllegal(),o),!this._consumeTokenIfType(12)){n=!1;break}n=!0}if(0===e.length){const t=this._handleExpressionParseError(3,u.Localizer.Diagnostic.expectedSliceIndex(),void 0,void 0,[16]);e.push(m.ArgumentNode.create(this._peekToken(),t,0))}return{list:e,trailingComma:n}}_parsePossibleSlice(){const e=this._peekToken(),t=[void 0,void 0,void 0];let n=0,i=!1;for(;;){const e=this._peekTokenType();if(16===e||12===e)break;if(10!==e&&(t[n]=this._parseTestExpression(!1)),n++,n>=3||!this._consumeTokenIfType(10))break;i=!0}if(!i)return t[0]?t[0]:m.ErrorNode.create(this._peekToken(),3);const s=m.SliceNode.create(e);s.startValue=t[0],s.startValue&&(s.startValue.parent=s),s.endValue=t[1],s.endValue&&(s.endValue.parent=s),s.stepValue=t[2],s.stepValue&&(s.stepValue.parent=s);const r=t[2]||t[1]||t[0];return r&&(0,m.extendRange)(s,r),s}_parseArgList(){const e=[];let t=!1;for(;;){const n=this._peekTokenType();if(14===n||2===n||1===n)break;const i=this._parseArgument();if(i.name?t=!0:t&&0===i.argumentCategory&&this._addError(u.Localizer.Diagnostic.positionArgAfterNamedArg(),i),e.push(i),!this._consumeTokenIfType(12))break}return e}_parseArgument(){const e=this._peekToken();let t=0;this._consumeTokenIfOperator(26)?t=1:this._consumeTokenIfOperator(29)&&(t=2);let n,i=this._parseTestExpression(!0);if(0===t)if(this._consumeTokenIfOperator(2)){const e=i;i=this._parseTestExpression(!1),38===e.nodeType?n=e.token:this._addError(u.Localizer.Diagnostic.expectedParamName(),e)}else{const e=this._tryParseListComprehension(i);e&&(i=e)}const s=m.ArgumentNode.create(e,i,t);return n&&(s.name=m.NameNode.create(n),s.name.parent=s),s}_parseAtom(){const e=this._peekToken();if(19===e.type)return m.EllipsisNode.create(this._getNextToken());if(6===e.type)return m.NumberNode.create(this._getNextToken());if(7===e.type)return m.NameNode.create(this._getNextToken());if(5===e.type)return this._parseStringList();if(22===e.type){this._getNextToken(),this._addError(u.Localizer.Diagnostic.backticksIllegal(),e);const t=this._parseTestListAsExpression(2,u.Localizer.Diagnostic.expectedExpr());return this._consumeTokenIfType(22),t}if(13===e.type){const e=this._parseTupleAtom();if(52===e.nodeType&&this._isParsingTypeAnnotation&&!this._isParsingIndexTrailer){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.useTupleInstead()),this._addError(u.Localizer.Diagnostic.tupleInAnnotation()+t.getString(),e)}return 7===e.nodeType&&(e.parenthesized=!0),e}if(15===e.type){const e=this._parseListAtom();if(this._isParsingTypeAnnotation&&!this._isParsingIndexTrailer){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.useListInstead()),this._addError(u.Localizer.Diagnostic.listInAnnotation()+t.getString(),e)}return e}if(17===e.type){const e=this._parseDictionaryOrSetAtom();if(this._isParsingTypeAnnotation){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.useDictInstead()),this._addError(u.Localizer.Diagnostic.dictInAnnotation()+t.getString(),e)}return e}if(8===e.type){const t=e;if(15===t.keywordType||33===t.keywordType||9===t.keywordType||26===t.keywordType)return m.ConstantNode.create(this._getNextToken());const n=this._getTokenIfIdentifier();if(n)return m.NameNode.create(n)}return this._handleExpressionParseError(2,u.Localizer.Diagnostic.expectedExpr())}_handleExpressionParseError(e,t,n,i,s){this._addError(t,null!=n?n:this._peekToken());const r=m.ErrorNode.create(this._peekToken(),e,i),a=[2];return s&&a.push(...s),this._consumeTokensUntilType(a),r}_parseLambdaExpression(e=!0){const t=this._getKeywordToken(24),n=this._parseVarArgsList(10,!1);let i;this._consumeTokenIfType(10)||this._addError(u.Localizer.Diagnostic.expectedColon(),this._peekToken()),i=e?this._parseTestExpression(!1):this._tryParseLambdaExpression(!1)||this._parseOrTest();const s=m.LambdaNode.create(t,i);return s.parameters=n,n.forEach((e=>{e.parent=s})),s}_tryParseLambdaExpression(e=!0){if(24===this._peekKeywordType())return this._parseLambdaExpression(e)}_parseTupleAtom(){var e;const t=this._getNextToken();(0,a.assert)(13===t.type);const n=this._tryParseYieldExpression();if(n)return 14!==this._peekTokenType()?this._handleExpressionParseError(8,u.Localizer.Diagnostic.expectedCloseParen(),t,n):((0,m.extendRange)(n,this._getNextToken()),n);const i=this._parseTestListWithComprehension(),s=this._makeExpressionOrTuple(i,!0),r=1===i.list.length&&!i.trailingComma;if(r||(0,m.extendRange)(s,t),14!==this._peekTokenType())return this._handleExpressionParseError(8,u.Localizer.Diagnostic.expectedCloseParen(),t,null!==(e=i.parseError)&&void 0!==e?e:s);{const e=this._getNextToken();r||(0,m.extendRange)(s,e)}return s}_parseListAtom(){var e;const t=this._getNextToken();(0,a.assert)(15===t.type);const n=this._parseTestListWithComprehension(),i=this._peekToken();return this._consumeTokenIfType(16)?s():this._handleExpressionParseError(9,u.Localizer.Diagnostic.expectedCloseBracket(),t,null!==(e=n.parseError)&&void 0!==e?e:s());function s(){const e=m.ListNode.create(t);return i&&(0,m.extendRange)(e,i),n.list.length>0&&(n.list.forEach((t=>{t.parent=e})),(0,m.extendRange)(e,n.list[n.list.length-1])),e.entries=n.list,e}}_parseTestListWithComprehension(){let e=!1;return this._parseExpressionListGeneric((()=>{let t=this._parseTestOrStarExpression(!0);const n=this._tryParseListComprehension(t);return n&&(t=n,e=!0),t}),(()=>this._isNextTokenNeverExpression()),(()=>e))}_parseDictionaryOrSetAtom(){const e=this._getNextToken();(0,a.assert)(17===e.type);const t=[],n=[];let i,s=!1,r=!1,o=!1,l=!0;for(;18!==this._peekTokenType();){let e,c,p;i=void 0;const d=this._peekToken();if(this._consumeTokenIfOperator(29)?e=this._parseExpression(!1):(c=this._parseTestOrStarExpression(!0),this._consumeTokenIfType(10)&&(p=this._parseTestExpression(!1))),c&&p)if(56===c.nodeType&&this._addError(u.Localizer.Diagnostic.unpackInDict(),c),r)this._addError(u.Localizer.Diagnostic.keyValueInSet(),p);else{const e=m.DictionaryKeyEntryNode.create(c,p);let n=e;const i=this._tryParseListComprehension(e);i&&(n=i,o=!0,l||this._addError(u.Localizer.Diagnostic.comprehensionInDict(),n)),t.push(n),s=!0}else if(e)if(r)this._addError(u.Localizer.Diagnostic.unpackInSet(),e);else{const n=m.DictionaryExpandEntryNode.create(e);(0,m.extendRange)(n,d);let i=n;const r=this._tryParseListComprehension(n);r&&(i=r,o=!0,l||this._addError(u.Localizer.Diagnostic.comprehensionInDict(),e)),t.push(i),s=!0}else if((0,a.assert)(void 0!==c),c)if(s){const e=m.ErrorNode.create(this._peekToken(),13),n=m.DictionaryKeyEntryNode.create(c,e);t.push(n),this._addError(u.Localizer.Diagnostic.dictKeyValuePairs(),c)}else{const e=this._tryParseListComprehension(c);e&&(c=e,o=!0,l||this._addError(u.Localizer.Diagnostic.comprehensionInSet(),c)),n.push(c),r=!0}if(o)break;if(12!==this._peekTokenType())break;i=this._getNextToken(),l=!1}let c=this._peekToken();if(this._consumeTokenIfType(18)||(this._addError(u.Localizer.Diagnostic.expectedCloseBrace(),e),c=void 0),r){const t=m.SetNode.create(e);return c&&(0,m.extendRange)(t,c),n.length>0&&(0,m.extendRange)(t,n[n.length-1]),n.forEach((e=>{e.parent=t})),t.entries=n,t}const p=m.DictionaryNode.create(e);return i&&(p.trailingCommaToken=i,(0,m.extendRange)(p,i)),c&&(0,m.extendRange)(p,c),t.length>0&&(t.forEach((e=>{e.parent=p})),(0,m.extendRange)(p,t[t.length-1])),p.entries=t,p}_parseExpressionListGeneric(e,t=(()=>this._isNextTokenNeverExpression()),n=(()=>!1)){let i=!1;const s=[];let r;for(;!t();){const t=e();if(0===t.nodeType){r=t;break}if(s.push(t),n())break;if(!this._consumeTokenIfType(12)){i=!1;break}i=!0}return{trailingComma:i,list:s,parseError:r}}_parseExpressionStatement(){let e,t=this._parseTestOrStarListAsExpression(!1,2,u.Localizer.Diagnostic.expectedExpr());if(0===t.nodeType)return t;if(this._consumeTokenIfType(10)){if(e=this._parseTypeAnnotation(),t=m.TypeAnnotationNode.create(t,e),!this._parseOptions.isStubFile&&this._getLanguageVersion()<p.PythonVersion.V3_6&&this._addError(u.Localizer.Diagnostic.varAnnotationIllegal(),e),!this._consumeTokenIfOperator(2))return t;const n=this._isTypingAnnotation(e,"TypeAlias"),i=this._isParsingTypeAnnotation;n&&(this._isParsingTypeAnnotation=!0);const s=this._tryParseYieldExpression()||this._parseTestOrStarListAsExpression(!1,2,u.Localizer.Diagnostic.expectedAssignRightHandExpr());return this._isParsingTypeAnnotation=i,m.AssignmentNode.create(t,s)}if(this._consumeTokenIfOperator(2))return this._parseChainAssignments(t);if(y.Tokenizer.isOperatorAssignment(this._peekOperatorType())){const e=this._getNextToken(),n=this._tryParseYieldExpression()||this._parseTestListAsExpression(2,u.Localizer.Diagnostic.expectedBinaryRightHandExpr()),i=Object.assign({},t);return i.id=(0,m.getNextNodeId)(),m.AugmentedAssignmentNode.create(t,n,e.operatorType,i)}return t}_parseChainAssignments(e){let t=this._tryParseYieldExpression()||this._parseTestOrStarListAsExpression(!1,2,u.Localizer.Diagnostic.expectedAssignRightHandExpr());if(0===t.nodeType)return m.AssignmentNode.create(e,t);if(this._consumeTokenIfOperator(2)&&(t=this._parseChainAssignments(t),0===t.nodeType))return t;const n=m.AssignmentNode.create(e,t),i=this._parseVariableTypeAnnotationComment();return i&&(n.typeAnnotationComment=i,n.typeAnnotationComment.parent=n,(0,m.extendRange)(n,n.typeAnnotationComment)),n}_parseFunctionTypeAnnotation(){const e=this._peekToken();if(!this._consumeTokenIfType(13))return void this._addError(u.Localizer.Diagnostic.expectedOpenParen(),this._peekToken());let t=[];for(;;){const e=this._peekTokenType();if(14===e||2===e||1===e)break;this._consumeTokenIfOperator(26)||this._consumeTokenIfOperator(29);const n=this._parseTypeAnnotation();if(t.push(n),!this._consumeTokenIfType(12))break}if(this._consumeTokenIfType(14)||(this._addError(u.Localizer.Diagnostic.expectedCloseParen(),e),this._consumeTokensUntilType([10])),!this._consumeTokenIfType(21))return void this._addError(u.Localizer.Diagnostic.expectedArrow(),this._peekToken());const n=this._parseTypeAnnotation();let i=!1;return 1===t.length&&18===t[0].nodeType&&(t=[],i=!0),m.FunctionAnnotationNode.create(e,i,t,n)}_parseTypeAnnotation(){const e=this._isParsingTypeAnnotation;this._isParsingTypeAnnotation=!0;const t=this._peekToken(),n=this._consumeTokenIfOperator(26);let i=this._parseTestExpression(!1);return n&&(i=m.UnpackNode.create(t,i)),this._isParsingTypeAnnotation=e,i}_reportStringTokenErrors(e,t){65536&e.flags&&this._addError(u.Localizer.Diagnostic.stringUnterminated(),e),t.nonAsciiInBytes&&this._addError(u.Localizer.Diagnostic.stringNonAsciiBytes(),e),64&e.flags&&(this._getLanguageVersion()<p.PythonVersion.V3_6&&this._addError(u.Localizer.Diagnostic.formatStringIllegal(),e),32&e.flags&&this._addError(u.Localizer.Diagnostic.formatStringBytes(),e),16&e.flags&&this._addError(u.Localizer.Diagnostic.formatStringUnicode(),e))}_makeStringNode(e){const t=h.getUnescapedString(e);return this._reportStringTokenErrors(e,t),m.StringNode.create(e,t.value,t.unescapeErrors.length>0)}_getTypeAnnotationCommentText(){if(0===this._tokenIndex)return;const e=this._tokenizerOutput.tokens.getItemAt(this._tokenIndex-1),t=this._tokenizerOutput.tokens.getItemAt(this._tokenIndex);if(e.start+e.length===t.start)return;const n=this._fileContents.substring(e.start+e.length,t.start).match(/^(\s*#\s*type:\s*)([^\r\n]*)/);if(!n)return;const i=n[2];if(i.trim().match(/^ignore(\s|\[|$)/))return;const s=e.start+e.length+n[1].length;return g.StringToken.create(s,i.length,0,i,0,void 0)}_parseVariableTypeAnnotationComment(){const e=this._getTypeAnnotationCommentText();if(!e)return;const t=this._makeStringNode(e),n=m.StringListNode.create([t]),i=(new T).parseTextExpression(this._fileContents,e.start,e.length,this._parseOptions,1);return i.diagnostics.forEach((e=>{this._addError(e.message,n)})),i.parseTree?i.parseTree:void 0}_parseFunctionTypeAnnotationComment(e,t){const n=this._makeStringNode(e),i=m.StringListNode.create([n]),s=(new T).parseTextExpression(this._fileContents,e.start,e.length,this._parseOptions,2);if(s.diagnostics.forEach((e=>{this._addError(e.message,i)})),!s.parseTree||62!==s.parseTree.nodeType)return;const r=s.parseTree;t.functionAnnotationComment=r,r.parent=t,(0,m.extendRange)(t,r)}_parseFormatStringSegment(e,t,n,i){(0,a.assert)(t.isExpression);const s=(new T).parseTextExpression(this._fileContents,e.start+e.prefixLength+e.quoteMarkLength+t.offset+n,i,this._parseOptions,0,1);return s.diagnostics.forEach((t=>{const n=(t.range?(0,c.convertPositionToOffset)(t.range.start,s.lines):e.start)||e.start,i={start:n,length:((t.range?((0,c.convertPositionToOffset)(t.range.end,s.lines)||0)+1:e.start+e.length)||e.start+e.length)-n};this._addError(t.message,i)})),s.parseTree}_parseFormatString(e){const t=h.getUnescapedString(e);this._reportStringTokenErrors(e,t);const n=[];for(const i of t.formatStringSegments)if(i.isExpression){const t=this._getFormatStringExpressionLength(i.value.trimEnd()),s=this._parseFormatStringSegment(e,i,0,t);s&&n.push(s);const r=i.value.substr(t);let a=0,o=0;for(let s=0;s<r.length;s++)if(123===r.charCodeAt(s))0===a&&(o=s+1),a++;else if(125===r.charCodeAt(s)&&a>0&&(a--,0===a)){const r=this._getFormatStringExpressionLength(i.value.substr(t+o,s-o)),a=this._parseFormatStringSegment(e,i,t+o,r);a&&n.push(a)}}return m.FormatStringNode.create(e,t.value,t.unescapeErrors.length>0,n)}_getFormatStringExpressionLength(e){let t=0;const n=[];let i,s=0,r=0,a=0;for(;t<e.length;){const o=e[t],l=n.length>0||s>0||r>0||a>0,c=n.length>0;if("="===o)i=t;else{if(":"===o){if(!l)break}else if("!"===o){if(!l&&(t===e.length-1||"="!==e[t+1]))break}else if("'"===o||'"'===o){let i=o;t+2<e.length&&e[t+1]===o&&e[t+2]===o&&(i=o+o+o,t+=2),n.length>0&&n[n.length-1]===i?n.pop():0===n.length&&n.push(i)}else"("===o?c||r++:")"===o?!c&&r>0&&r--:"{"===o?c||s++:"}"===o?!c&&s>0&&s--:"["===o?c||a++:"]"===o&&!c&&a>0&&a--;" "!==o&&(i=void 0)}t++}return this._parseOptions.pythonVersion>=p.PythonVersion.V3_8&&void 0!==i&&(t=i),t}_parseStringList(){const e=[];for(;5===this._peekTokenType();){const t=this._getNextToken();64&t.flags?e.push(this._parseFormatString(t)):e.push(this._makeStringNode(t))}const t=m.StringListNode.create(e);if(this._isParsingTypeAnnotation)if(t.strings.length>1)this._addError(u.Localizer.Diagnostic.annotationSpansStrings(),t);else if(64&t.strings[0].token.flags)this._addError(u.Localizer.Diagnostic.annotationFormatString(),t);else{const e=t.strings[0].token,n=h.getUnescapedString(t.strings[0].token).value,i=e.start,s=e.prefixLength+e.quoteMarkLength;if(n.length!==e.length-s-e.quoteMarkLength)this._addError(u.Localizer.Diagnostic.annotationStringEscape(),t);else{const e=(new T).parseTextExpression(this._fileContents,i+s,n.length,this._parseOptions,1,0!=(4&t.strings[0].token.flags)?1:0);e.diagnostics.forEach((e=>{this._addError(e.message,t)})),e.parseTree&&(t.typeAnnotation=e.parseTree,t.typeAnnotation.parent=t)}}return t}_reportConditionalErrorForStarTupleElement(e){if(52===e.nodeType&&!(e.enclosedInParens||this._parseOptions.pythonVersion>=p.PythonVersion.V3_8))for(const t of e.expressions)if(56===t.nodeType)return void this._addError(u.Localizer.Diagnostic.unpackTuplesIllegal(),t)}_isNextTokenNeverExpression(){switch(this._peekToken().type){case 8:switch(this._peekKeywordType()){case 17:case 22:case 20:return!0}break;case 9:switch(this._peekOperatorType()){case 1:case 34:case 27:case 11:case 25:case 4:case 7:case 9:case 18:case 32:case 30:case 14:case 2:return!0}break;case 3:case 4:case 2:case 1:case 11:case 14:case 16:case 18:case 12:case 10:return!0}return!1}_disallowAssignmentExpression(e){const t=this._assignmentExpressionsAllowed;this._assignmentExpressionsAllowed=!1,e(),this._assignmentExpressionsAllowed=t}_getNextToken(){const e=this._tokenizerOutput.tokens.getItemAt(this._tokenIndex);return this._atEof()||this._tokenIndex++,e}_atEof(){return this._tokenIndex>=this._tokenizerOutput.tokens.count-1}_peekToken(e=0){return this._tokenIndex+e<0?this._tokenizerOutput.tokens.getItemAt(0):this._tokenIndex+e>=this._tokenizerOutput.tokens.count?this._tokenizerOutput.tokens.getItemAt(this._tokenizerOutput.tokens.count-1):this._tokenizerOutput.tokens.getItemAt(this._tokenIndex+e)}_peekTokenType(){return this._peekToken().type}_peekKeywordType(){const e=this._peekToken();if(8===e.type)return e.keywordType}_peekOperatorType(){const e=this._peekToken();if(9===e.type)return e.operatorType}_getTokenIfIdentifier(){const e=this._peekToken();if(7===e.type)return this._getNextToken();if(0===e.type)return this._getNextToken(),this._addError(u.Localizer.Diagnostic.invalidIdentifierChar(),e),g.IdentifierToken.create(e.start,e.length,"",e.comments);if(8===e.type){const t=this._peekKeywordType();if([9,25,6].find((e=>e===t))){const t=this._fileContents.substr(e.start,e.length);return this._getNextToken(),g.IdentifierToken.create(e.start,e.length,t,e.comments)}}}_consumeTokensUntilType(e){for(;;){const t=this._peekToken();if(e.some((e=>e===t.type)))return!0;if(1===t.type)return!1;this._getNextToken()}}_getTokenIfType(e){if(this._peekTokenType()===e)return this._getNextToken()}_consumeTokenIfType(e){return!!this._getTokenIfType(e)}_consumeTokenIfKeyword(e){return this._peekKeywordType()===e&&(this._getNextToken(),!0)}_consumeTokenIfOperator(e){return this._peekOperatorType()===e&&(this._getNextToken(),!0)}_getKeywordToken(e){const t=this._getNextToken();return(0,a.assert)(8===t.type),(0,a.assert)(t.keywordType===e),t}_getLanguageVersion(){return this._parseOptions.pythonVersion}_suppressErrors(e){try{this._areErrorsSuppressed=!0,e()}finally{this._areErrorsSuppressed=!1}}_addError(e,t){(0,a.assert)(void 0!==t),this._areErrorsSuppressed||this._diagSink.addError(e,(0,c.convertOffsetsToRange)(t.start,t.start+t.length,this._tokenizerOutput.lines))}}t.Parser=T},5136:(e,t)=>{function n(e){return e>=48&&e<=57||e>=97&&e<=122||e>=65&&e<=90}function i(e){return e>=48&&e<=55}function s(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function r(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-97+10:e>=65&&e<=70?e-65+10:0}Object.defineProperty(t,"__esModule",{value:!0}),t.getUnescapedString=void 0,t.getUnescapedString=function(e){const t=e.escapedValue,a=0!=(8&e.flags),o=0!=(64&e.flags);if(a&&!o)return{value:t,unescapeErrors:[],nonAsciiInBytes:!1,formatStringSegments:[]};const l=[];for(let e=0;e<t.length;e++)l.push(t.charCodeAt(e));const c=0!=(32&e.flags);if(!o&&!l.some((e=>13===e||10===e||92===e)))return{value:t,unescapeErrors:[],nonAsciiInBytes:c&&l.some((e=>e>=128)),formatStringSegments:[]};let p=0,d={offset:0,length:0,valueParts:[],isExpression:!1,hasFormatSpecifier:!1},u=0;const m={valueParts:[],unescapeErrors:[],nonAsciiInBytes:!1,formatStringSegments:[]},h=()=>{a||m.unescapeErrors.push({offset:u-1,length:2,errorType:0})},y=(e=0)=>u+e>=l.length?3:l[u+e],g=e=>{let t=!1,n=0,i="";for(let i=0;i<e;i++){const e=y(1+i);if(!s(e)){t=!0;break}n=16*n+r(e)}return t?(h(),i="\\"+String.fromCharCode(y()),u++):(i=String.fromCharCode(n),u+=1+e),i},f=e=>{const t=String.fromCharCode(e);m.valueParts.push(t),d.valueParts.push(t)};for(;;){let e=y();if(3===e)return o&&(d.isExpression&&m.unescapeErrors.push({offset:d.offset,length:u-d.offset,errorType:3}),u!==d.offset&&(d.length=u-d.offset,m.formatStringSegments.push(d))),_=m,{..._,value:_.valueParts.join(""),formatStringSegments:_.formatStringSegments.map((e=>({...e,value:e.valueParts.join("")})))};if(92===e){if(o&&d.isExpression&&!d.hasFormatSpecifier&&m.unescapeErrors.push({offset:u,length:1,errorType:1}),u++,a){f(e);continue}e=y();let t="";if(13===e||10===e)13===e&&10===y(1)&&(a&&(t+=String.fromCharCode(e)),u++,e=y()),a&&(t="\\"+t+String.fromCharCode(e)),u++;else if(a)t="\\"+String.fromCharCode(e),u++;else switch(e){case 92:case 39:case 34:t=String.fromCharCode(e),u++;break;case 97:t="\a",u++;break;case 98:t="\b",u++;break;case 102:t="\f",u++;break;case 110:t="\n",u++;break;case 114:t="\r",u++;break;case 116:t="\t",u++;break;case 118:t="\v",u++;break;case 120:t=g(2);break;case 78:{let i=!1,s=1;if(123!==y(s))i=!0;else for(s++;;){const e=y(s);if(125===e)break;if(!n(e)&&45!==e&&32!==(T=e)&&9!==T){i=!0;break}s++}i?(h(),t="\\"+String.fromCharCode(e),u++):(t="-",u+=1+s);break}case 117:t=g(4);break;case 85:t=g(8);break;default:if(i(e)){let n=e-48;u++,e=y(),i(e)&&(n=8*n+e-48,u++,e=y(),i(e)&&(n=8*n+e-48,u++)),t=String.fromCharCode(n)}else t="\\",h()}m.valueParts.push(t),d.valueParts.push(t)}else if(10===e||13===e)13===e&&10===y(1)&&(f(e),u++,e=y()),f(e),u++;else if(o&&123===e)d.isExpression||123!==y(1)?(0===p?(d.length=u-d.offset,d.length>0&&m.formatStringSegments.push(d),u++,d={offset:u,length:0,valueParts:[],isExpression:!0,hasFormatSpecifier:!1}):(f(e),u++),p++):(f(e),u+=2);else if(o&&125===e)d.isExpression||125!==y(1)?0===p?(m.unescapeErrors.push({offset:u,length:1,errorType:2}),u++):(p--,0===p?(d.length=u-d.offset,m.formatStringSegments.push(d),u++,d={offset:u,length:0,valueParts:[],isExpression:!1,hasFormatSpecifier:!1}):(f(e),u++)):(f(e),u+=2);else if(!d.isExpression||39!==e&&34!==e)d.isExpression&&58===e&&(d.hasFormatSpecifier=!0),c&&e>=128&&(m.nonAsciiInBytes=!0),f(e),u++;else{const t=e;f(e);const n=y(1)===t&&y(2)===t;for(n&&(u+=2,f(e),f(e),m.valueParts.push(String.fromCharCode(e)),m.valueParts.push(String.fromCharCode(e)));;){u++;let e=y();if(3===e)break;if(92!==e){if((10===e||13===e)&&!n)break;if(e===t){if(!n){u++,f(e);break}if(y(1)===t&&y(2)===t){u+=3,f(e),f(e),f(e);break}}f(e)}else f(e),u++,e=y(),f(e)}}}var T,_}},7093:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tokenizer=t.defaultTabSize=void 0;const i=n(3420),s=n(6956),r=n(9671),a=n(6180),o=new Map([["and",0],["as",1],["assert",2],["async",3],["await",4],["break",5],["case",6],["class",7],["continue",8],["__debug__",9],["def",10],["del",11],["elif",12],["else",13],["except",14],["finally",16],["for",17],["from",18],["global",19],["if",20],["import",21],["in",22],["is",23],["lambda",24],["match",25],["nonlocal",27],["not",28],["or",29],["pass",30],["raise",31],["return",32],["try",34],["while",35],["with",36],["yield",37],["False",15],["None",26],["True",33]]),l={0:3,1:4,2:4,3:2,4:4,5:1,6:2,7:4,8:2,9:4,10:2,11:4,12:10,13:2,14:4,15:10,16:10,17:2,18:4,19:26,20:10,21:10,22:2,23:4,24:2,25:4,26:2,27:4,28:10,29:2,30:4,31:2,32:4,33:2,34:4,36:2,37:2,38:1,39:2,40:2,41:2,42:2};t.defaultTabSize=8,t.Tokenizer=class{constructor(){this._cs=new r.CharacterStream(""),this._tokens=[],this._prevLineStart=0,this._parenDepth=0,this._lineRanges=[],this._indentAmounts=[],this._typeIgnoreAll=!1,this._typeIgnoreLines={},this._crCount=0,this._crLfCount=0,this._lfCount=0,this._indentCount=0,this._indentTabCount=0,this._indentSpacesTotal=0,this._singleQuoteCount=0,this._doubleQuoteCount=0}tokenize(e,n,s,o=0){if(void 0===n)n=0;else if(n<0||n>e.length)throw new Error("Invalid range start");if(void 0===s)s=e.length;else{if(s<0||n+s>e.length)throw new Error("Invalid range length");n+s<e.length&&(e=e.substr(0,n+s))}this._cs=new r.CharacterStream(e),this._cs.position=n,this._tokens=[],this._prevLineStart=0,this._parenDepth=o,this._lineRanges=[],this._indentAmounts=[];const l=n+s;for(;!(this._cs.isEndOfStream()||(this._addNextToken(),this._cs.position>=l)););0!==this._tokens.length&&2===this._tokens[this._tokens.length-1].type||this._tokens.push(a.NewLineToken.create(this._cs.position,0,3,this._getComments())),this._setIndent(0,0,!1,!1),this._tokens.push(a.Token.create(1,this._cs.position,0,this._getComments())),this._addLineRange();let c="\n";this._crCount>this._crLfCount&&this._crCount>this._lfCount?c="\r":this._crLfCount>this._crCount&&this._crLfCount>this._lfCount&&(c="\r\n");let p="    ";if(this._indentTabCount>this._indentCount/2)p="\t";else if(this._indentCount>0){let e=Math.round(this._indentSpacesTotal/this._indentCount);e<1?e=1:e>t.defaultTabSize&&(e=t.defaultTabSize),p="";for(let t=0;t<e;t++)p+=" "}return{tokens:new i.TextRangeCollection(this._tokens),lines:new i.TextRangeCollection(this._lineRanges),typeIgnoreLines:this._typeIgnoreLines,typeIgnoreAll:this._typeIgnoreAll,predominantEndOfLineSequence:c,predominantTabSequence:p,predominantSingleQuoteCharacter:this._singleQuoteCount>=this._doubleQuoteCount?"'":'"'}}static getOperatorInfo(e){return l[e]}static isOperatorAssignment(e){return void 0!==e&&void 0!==l[e]&&0!=(4&l[e])}static isOperatorComparison(e){return void 0!==e&&void 0!==l[e]&&0!=(8&l[e])}_addNextToken(){this._cs.skipWhitespace(),this._cs.isEndOfStream()||this._handleCharacter()||this._cs.moveNext()}_handleCharacter(){const e=this._getStringPrefixLength();if(e>=0){let t="";e>0&&(t=this._cs.getText().substr(this._cs.position,e),this._cs.advance(e));const n=this._getQuoteTypeFlags(t);if(0!==n)return this._handleString(n,e),!0}if(35===this._cs.currentChar)return this._handleComment(),!0;switch(this._cs.currentChar){case 65279:return 0!==this._cs.position&&this._handleInvalid();case 13:{const e=10===this._cs.nextChar?2:1,t=2===e?2:0;return this._handleNewLine(e,t),!0}case 10:return this._handleNewLine(1,1),!0;case 92:return 13===this._cs.nextChar?(10===this._cs.lookAhead(2)?this._cs.advance(3):this._cs.advance(2),this._addLineRange(),!0):10===this._cs.nextChar?(this._cs.advance(2),this._addLineRange(),!0):this._handleInvalid();case 40:this._parenDepth++,this._tokens.push(a.Token.create(13,this._cs.position,1,this._getComments()));break;case 41:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(14,this._cs.position,1,this._getComments()));break;case 91:this._parenDepth++,this._tokens.push(a.Token.create(15,this._cs.position,1,this._getComments()));break;case 93:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(16,this._cs.position,1,this._getComments()));break;case 123:this._parenDepth++,this._tokens.push(a.Token.create(17,this._cs.position,1,this._getComments()));break;case 125:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(18,this._cs.position,1,this._getComments()));break;case 44:this._tokens.push(a.Token.create(12,this._cs.position,1,this._getComments()));break;case 96:this._tokens.push(a.Token.create(22,this._cs.position,1,this._getComments()));break;case 59:this._tokens.push(a.Token.create(11,this._cs.position,1,this._getComments()));break;case 58:if(61===this._cs.nextChar){this._tokens.push(a.OperatorToken.create(this._cs.position,2,35,this._getComments())),this._cs.advance(1);break}this._tokens.push(a.Token.create(10,this._cs.position,1,this._getComments()));break;default:if(this._isPossibleNumber()&&this._tryNumber())return!0;if(46===this._cs.currentChar){if(46===this._cs.nextChar&&46===this._cs.lookAhead(2))return this._tokens.push(a.Token.create(19,this._cs.position,3,this._getComments())),this._cs.advance(3),!0;this._tokens.push(a.Token.create(20,this._cs.position,1,this._getComments()));break}return!(!this._tryIdentifier()&&!this._tryOperator())||this._handleInvalid()}return!1}_addLineRange(){const e=this._cs.position-this._prevLineStart;e>0&&this._lineRanges.push({start:this._prevLineStart,length:e}),this._prevLineStart=this._cs.position}_handleNewLine(e,t){0===this._parenDepth&&3!==t&&(0!==this._tokens.length&&2===this._tokens[this._tokens.length-1].type||this._tokens.push(a.NewLineToken.create(this._cs.position,e,t,this._getComments()))),0===t?this._crCount++:2===t?this._crLfCount++:this._lfCount++,this._cs.advance(e),this._addLineRange(),this._readIndentationAfterNewLine()}_readIndentationAfterNewLine(){let e=0,n=0,i=!1,s=!1;for(;!this._cs.isEndOfStream();)switch(this._cs.currentChar){case 32:e++,n++,s=!0,this._cs.moveNext();break;case 9:e++,n+=t.defaultTabSize-n%t.defaultTabSize,i=!0,this._cs.moveNext();break;case 12:e=0,n=0,i=!1,s=!1,this._cs.moveNext();break;default:return void this._setIndent(e,n,s,i);case 35:case 10:case 13:return}}_setIndent(e,t,n,i){if(!(this._parenDepth>0))if(0===this._indentAmounts.length)t>0&&(this._indentCount++,i&&this._indentTabCount++,this._indentSpacesTotal+=t,this._indentAmounts.push({tab1Spaces:e,tab8Spaces:t,isSpacePresent:n,isTabPresent:i}),this._tokens.push(a.IndentToken.create(this._cs.position,0,t,!1,this._getComments())));else{const s=this._indentAmounts[this._indentAmounts.length-1];if(s.tab8Spaces<t){const r=(s.isSpacePresent&&i||s.isTabPresent&&n)&&s.tab1Spaces>=e;this._indentCount++,i&&this._indentTabCount++,this._indentSpacesTotal+=t-this._indentAmounts[this._indentAmounts.length-1].tab8Spaces,this._indentAmounts.push({tab1Spaces:e,tab8Spaces:t,isSpacePresent:n,isTabPresent:i}),this._tokens.push(a.IndentToken.create(this._cs.position,0,t,r,this._getComments()))}else if(s.tab8Spaces===t)(s.isSpacePresent&&i||s.isTabPresent&&n)&&this._tokens.push(a.IndentToken.create(this._cs.position,0,t,!0,this._getComments()));else{let e=s.isSpacePresent&&i||s.isTabPresent&&n;const r=[];for(;this._indentAmounts.length>0&&this._indentAmounts[this._indentAmounts.length-1].tab8Spaces>t;)r.push(this._indentAmounts.length>1?this._indentAmounts[this._indentAmounts.length-2].tab8Spaces:0),this._indentAmounts.pop();r.forEach(((n,i)=>{const s=i<r.length-1||n===t,o=i<r.length-1?n:t;this._tokens.push(a.DedentToken.create(this._cs.position,0,o,s,e,this._getComments())),e=!1}))}}}_tryIdentifier(){const e=()=>{for(;;)if((0,s.isIdentifierChar)(this._cs.currentChar))this._cs.moveNext();else{if(!(0,s.isIdentifierChar)(this._cs.currentChar,this._cs.nextChar))break;this._cs.moveNext(),this._cs.moveNext()}},t=this._cs.position;if((0,s.isIdentifierStartChar)(this._cs.currentChar)?(this._cs.moveNext(),e()):(0,s.isIdentifierStartChar)(this._cs.currentChar,this._cs.nextChar)&&(this._cs.moveNext(),this._cs.moveNext(),e()),this._cs.position>t){const e=this._cs.getText().substr(t,this._cs.position-t);return o.has(e)?this._tokens.push(a.KeywordToken.create(t,this._cs.position-t,o.get(e),this._getComments())):this._tokens.push(a.IdentifierToken.create(t,this._cs.position-t,e,this._getComments())),!0}return!1}_isPossibleNumber(){return!!(0,s.isDecimal)(this._cs.currentChar)||!(46!==this._cs.currentChar||!(0,s.isDecimal)(this._cs.nextChar))}_tryNumber(){const e=this._cs.position;if(48===this._cs.currentChar){let t=0,n=0;if((120===this._cs.nextChar||88===this._cs.nextChar)&&(0,s.isHex)(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;(0,s.isHex)(this._cs.currentChar);)this._cs.moveNext();t=16}if((98===this._cs.nextChar||66===this._cs.nextChar)&&(0,s.isBinary)(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;(0,s.isBinary)(this._cs.currentChar);)this._cs.moveNext();t=2}if((111===this._cs.nextChar||79===this._cs.nextChar)&&(0,s.isOctal)(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;(0,s.isOctal)(this._cs.currentChar);)this._cs.moveNext();t=8}if(t>0){const i=this._cs.getText().substr(e,this._cs.position-e),s=parseInt(i.substr(n).replace(/_/g,""),t);if(!isNaN(s))return this._tokens.push(a.NumberToken.create(e,i.length,s,!0,!1,this._getComments())),!0}}let t=!1,n=!1;if(this._cs.currentChar>=49&&this._cs.currentChar<=57){for(;(0,s.isDecimal)(this._cs.currentChar);)n=!0,this._cs.moveNext();t=46!==this._cs.currentChar&&101!==this._cs.currentChar&&69!==this._cs.currentChar}if(48===this._cs.currentChar){for(n=!0;48===this._cs.currentChar||95===this._cs.currentChar;)this._cs.moveNext();t=46!==this._cs.currentChar&&101!==this._cs.currentChar&&69!==this._cs.currentChar}if(t){let t=this._cs.getText().substr(e,this._cs.position-e);const n=parseInt(t.replace(/_/g,""),10);if(!isNaN(n)){let i=!1;return 106!==this._cs.currentChar&&74!==this._cs.currentChar||(i=!0,t+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()),this._tokens.push(a.NumberToken.create(e,t.length,n,!0,i,this._getComments())),!0}}if(this._cs.position=e,(n||46===this._cs.currentChar&&this._cs.nextChar>=48&&this._cs.nextChar<=57)&&this._skipFloatingPointCandidate()){let t=this._cs.getText().substr(e,this._cs.position-e);const n=parseFloat(t);if(!isNaN(n)){let i=!1;return 106!==this._cs.currentChar&&74!==this._cs.currentChar||(i=!0,t+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()),this._tokens.push(a.NumberToken.create(e,this._cs.position-e,n,!1,i,this._getComments())),!0}}return this._cs.position=e,!1}_tryOperator(){let e=0;const t=this._cs.nextChar;let n;switch(this._cs.currentChar){case 43:e=61===t?2:1,n=2===e?1:0;break;case 38:e=61===t?2:1,n=2===e?4:3;break;case 124:e=61===t?2:1,n=2===e?7:6;break;case 94:e=61===t?2:1,n=2===e?9:8;break;case 61:e=61===t?2:1,n=2===e?12:2;break;case 33:if(61!==t)return!1;e=2,n=28;break;case 37:e=61===t?2:1,n=2===e?25:24;break;case 126:e=1,n=5;break;case 45:if(62===t)return this._tokens.push(a.Token.create(21,this._cs.position,2,this._getComments())),this._cs.advance(2),!0;e=61===t?2:1,n=2===e?34:33;break;case 42:42===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?30:29):(e=61===t?2:1,n=2===e?27:26);break;case 47:47===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?14:13):(e=61===t?2:1,n=2===e?11:10);break;case 60:60===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?18:17):62===t?(e=2,n=19):(e=61===t?2:1,n=2===e?21:20);break;case 62:62===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?32:31):(e=61===t?2:1,n=2===e?16:15);break;case 64:e=61===t?2:1,n=2===e?23:22;break;default:return!1}return this._tokens.push(a.OperatorToken.create(this._cs.position,e,n,this._getComments())),this._cs.advance(e),e>0}_handleInvalid(){const e=this._cs.position;for(;10!==this._cs.currentChar&&13!==this._cs.currentChar&&!this._cs.isAtWhiteSpace()&&!this._cs.isEndOfStream();)(0,s.isSurrogateChar)(this._cs.currentChar)?(this._cs.moveNext(),this._cs.moveNext()):this._cs.moveNext();const t=this._cs.position-e;return t>0&&(this._tokens.push(a.Token.create(0,e,t,this._getComments())),!0)}_getComments(){const e=this._comments;return this._comments=void 0,e}_handleComment(){const e=this._cs.position+1;this._cs.skipToEol();const t=this._cs.position-e,n=this._cs.getText().substr(e,t),i=a.Comment.create(e,t,n);n.match(/^\s*type:\s*ignore(\s|\[|$)/)&&(this._tokens.findIndex((e=>2!==e.type&&e&&3!==e.type))<0?this._typeIgnoreAll=!0:this._typeIgnoreLines[this._lineRanges.length]=!0),this._comments?this._comments.push(i):this._comments=[i]}_getStringPrefixLength(){if(39===this._cs.currentChar||34===this._cs.currentChar)return 0;if(39===this._cs.nextChar||34===this._cs.nextChar)switch(this._cs.currentChar){case 102:case 70:case 114:case 82:case 98:case 66:case 117:case 85:return 1}if(39===this._cs.lookAhead(2)||34===this._cs.lookAhead(2))switch(this._cs.getText().substr(this._cs.position,2).toLowerCase()){case"rf":case"fr":case"ur":case"ru":case"br":case"rb":return 2}return-1}_getQuoteTypeFlags(e){let t=0;e=e.toLowerCase();for(let n=0;n<e.length;n++)switch(e[n]){case"u":t|=16;break;case"b":t|=32;break;case"r":t|=8;break;case"f":t|=64}return 39===this._cs.currentChar?(t|=1,39===this._cs.nextChar&&39===this._cs.lookAhead(2)&&(t|=4)):34===this._cs.currentChar&&(t|=2,34===this._cs.nextChar&&34===this._cs.lookAhead(2)&&(t|=4)),t}_handleString(e,t){const n=this._cs.position-t;4&e?this._cs.advance(3):(this._cs.moveNext(),1&e?this._singleQuoteCount++:this._doubleQuoteCount++);const i=this._skipToEndOfStringLiteral(e),s=this._cs.position;this._tokens.push(a.StringToken.create(n,s-n,i.flags,i.escapedValue,t,this._getComments()))}_skipToEndOfStringLiteral(e){const t=1&e?39:34,n=0!=(4&e);let i=[];for(;;){if(this._cs.isEndOfStream())return e|=65536,{escapedValue:String.fromCharCode.apply(void 0,i),flags:e};if(92===this._cs.currentChar)i.push(this._cs.currentChar),this._cs.moveNext(),13===this._cs.getCurrentChar()||10===this._cs.getCurrentChar()?(13===this._cs.getCurrentChar()&&10===this._cs.nextChar&&(i.push(this._cs.currentChar),this._cs.moveNext()),i.push(this._cs.currentChar),this._cs.moveNext(),this._addLineRange()):(i.push(this._cs.currentChar),this._cs.moveNext());else if(10===this._cs.currentChar||13===this._cs.currentChar){if(!n)return e|=65536,{escapedValue:String.fromCharCode.apply(void 0,i),flags:e};13===this._cs.currentChar&&10===this._cs.nextChar&&(i.push(this._cs.currentChar),this._cs.moveNext()),i.push(this._cs.currentChar),this._cs.moveNext(),this._addLineRange()}else{if(!n&&this._cs.currentChar===t){this._cs.moveNext();break}if(n&&this._cs.currentChar===t&&this._cs.nextChar===t&&this._cs.lookAhead(2)===t){this._cs.advance(3);break}i.push(this._cs.currentChar),this._cs.moveNext()}}return i.length>32768&&(i=i.slice(0,32768),e|=131072),{escapedValue:String.fromCharCode.apply(void 0,i),flags:e}}_skipFloatingPointCandidate(){const e=this._cs.position;return this._skipFractionalNumber(),this._cs.position>e&&(101!==this._cs.currentChar&&69!==this._cs.currentChar||(this._cs.moveNext(),this._skipDecimalNumber(!0))),this._cs.position>e}_skipFractionalNumber(){this._skipDecimalNumber(!1),46===this._cs.currentChar&&this._cs.moveNext(),this._skipDecimalNumber(!1)}_skipDecimalNumber(e){for(!e||45!==this._cs.currentChar&&43!==this._cs.currentChar||this._cs.moveNext();(0,s.isDecimal)(this._cs.currentChar);)this._cs.moveNext()}}},6180:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifierToken=t.OperatorToken=t.NumberToken=t.StringToken=t.KeywordToken=t.NewLineToken=t.DedentToken=t.IndentToken=t.Token=t.Comment=void 0,(t.Comment||(t.Comment={})).create=function(e,t,n){return{start:e,length:t,value:n}},(t.Token||(t.Token={})).create=function(e,t,n,i){return{start:t,length:n,type:e,comments:i}},(t.IndentToken||(t.IndentToken={})).create=function(e,t,n,i,s){return{start:e,length:t,type:3,isIndentAmbiguous:i,comments:s,indentAmount:n}},(t.DedentToken||(t.DedentToken={})).create=function(e,t,n,i,s,r){return{start:e,length:t,type:4,comments:r,indentAmount:n,matchesIndent:i,isDedentAmbiguous:s}},(t.NewLineToken||(t.NewLineToken={})).create=function(e,t,n,i){return{start:e,length:t,type:2,comments:i,newLineType:n}},(t.KeywordToken||(t.KeywordToken={})).create=function(e,t,n,i){return{start:e,length:t,type:8,comments:i,keywordType:n}},(t.StringToken||(t.StringToken={})).create=function(e,t,n,i,s,r){return{start:e,length:t,type:5,flags:n,escapedValue:i,prefixLength:s,quoteMarkLength:4&n?3:1,comments:r}},(t.NumberToken||(t.NumberToken={})).create=function(e,t,n,i,s,r){return{start:e,length:t,type:6,isInteger:i,isImaginary:s,value:n,comments:r}},(t.OperatorToken||(t.OperatorToken={})).create=function(e,t,n,i){return{start:e,length:t,type:9,operatorType:n,comments:i}},(t.IdentifierToken||(t.IdentifierToken={})).create=function(e,t,n,i){return{start:e,length:t,type:7,value:n,comments:i}}},7770:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unicodePc=t.unicodeNdSurrogate=t.unicodeNd=t.unicodeMcSurrogate=t.unicodeMc=t.unicodeMnSurrogate=t.unicodeMn=t.unicodeNlSurrogate=t.unicodeNl=t.unicodeLmSurrogate=t.unicodeLm=t.unicodeLoSurrogate=t.unicodeLo=t.unicodeLt=t.unicodeLlSurrogate=t.unicodeLl=t.unicodeLuSurrogate=t.unicodeLu=void 0,t.unicodeLu=[[65,90],[192,214],[216,222],256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,313,315,317,319,321,323,325,327,330,332,334,336,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,[376,377],379,381,[385,386],388,[390,391],[393,395],[398,401],[403,404],[406,408],[412,413],[415,416],418,420,[422,423],425,428,[430,431],[433,435],437,[439,440],444,452,455,458,461,463,465,467,469,471,473,475,478,480,482,484,486,488,490,492,494,497,500,[502,504],506,508,510,512,514,516,518,520,522,524,526,528,530,532,534,536,538,540,542,544,546,548,550,552,554,556,558,560,562,[570,571],[573,574],577,[579,582],584,586,588,590,880,882,886,895,902,[904,906],908,[910,911],[913,929],[931,939],975,[978,980],984,986,988,990,992,994,996,998,1e3,1002,1004,1006,1012,1015,[1017,1018],[1021,1071],1120,1122,1124,1126,1128,1130,1132,1134,1136,1138,1140,1142,1144,1146,1148,1150,1152,1162,1164,1166,1168,1170,1172,1174,1176,1178,1180,1182,1184,1186,1188,1190,1192,1194,1196,1198,1200,1202,1204,1206,1208,1210,1212,1214,[1216,1217],1219,1221,1223,1225,1227,1229,1232,1234,1236,1238,1240,1242,1244,1246,1248,1250,1252,1254,1256,1258,1260,1262,1264,1266,1268,1270,1272,1274,1276,1278,1280,1282,1284,1286,1288,1290,1292,1294,1296,1298,1300,1302,1304,1306,1308,1310,1312,1314,1316,1318,1320,1322,1324,1326,[1329,1366],[4256,4293],4295,4301,[5024,5109],7680,7682,7684,7686,7688,7690,7692,7694,7696,7698,7700,7702,7704,7706,7708,7710,7712,7714,7716,7718,7720,7722,7724,7726,7728,7730,7732,7734,7736,7738,7740,7742,7744,7746,7748,7750,7752,7754,7756,7758,7760,7762,7764,7766,7768,7770,7772,7774,7776,7778,7780,7782,7784,7786,7788,7790,7792,7794,7796,7798,7800,7802,7804,7806,7808,7810,7812,7814,7816,7818,7820,7822,7824,7826,7828,7838,7840,7842,7844,7846,7848,7850,7852,7854,7856,7858,7860,7862,7864,7866,7868,7870,7872,7874,7876,7878,7880,7882,7884,7886,7888,7890,7892,7894,7896,7898,7900,7902,7904,7906,7908,7910,7912,7914,7916,7918,7920,7922,7924,7926,7928,7930,7932,7934,[7944,7951],[7960,7965],[7976,7983],[7992,7999],[8008,8013],8025,8027,8029,8031,[8040,8047],[8120,8123],[8136,8139],[8152,8155],[8168,8172],[8184,8187],8450,8455,[8459,8461],[8464,8466],8469,[8473,8477],8484,8486,8488,[8490,8493],[8496,8499],[8510,8511],8517,8579,[11264,11310],11360,[11362,11364],11367,11369,11371,[11373,11376],11378,11381,[11390,11392],11394,11396,11398,11400,11402,11404,11406,11408,11410,11412,11414,11416,11418,11420,11422,11424,11426,11428,11430,11432,11434,11436,11438,11440,11442,11444,11446,11448,11450,11452,11454,11456,11458,11460,11462,11464,11466,11468,11470,11472,11474,11476,11478,11480,11482,11484,11486,11488,11490,11499,11501,11506,42560,42562,42564,42566,42568,42570,42572,42574,42576,42578,42580,42582,42584,42586,42588,42590,42592,42594,42596,42598,42600,42602,42604,42624,42626,42628,42630,42632,42634,42636,42638,42640,42642,42644,42646,42648,42650,42786,42788,42790,42792,42794,42796,42798,42802,42804,42806,42808,42810,42812,42814,42816,42818,42820,42822,42824,42826,42828,42830,42832,42834,42836,42838,42840,42842,42844,42846,42848,42850,42852,42854,42856,42858,42860,42862,42873,42875,[42877,42878],42880,42882,42884,42886,42891,42893,42896,42898,42902,42904,42906,42908,42910,42912,42914,42916,42918,42920,[42922,42926],[42928,42932],42934,[65313,65338],[66560,66599],[66736,66771],[68736,68786],[71840,71871],[119808,119833],[119860,119885],[119912,119937],119964,[119966,119967],119970,[119973,119974],[119977,119980],[119982,119989],[120016,120041],[120068,120069],[120071,120074],[120077,120084],[120086,120092],[120120,120121],[120123,120126],[120128,120132],120134,[120138,120144],[120172,120197],[120224,120249],[120276,120301],[120328,120353],[120380,120405],[120432,120457],[120488,120512],[120546,120570],[120604,120628],[120662,120686],[120720,120744],120778,[125184,125217]],t.unicodeLuSurrogate={55297:[[56320,56359],[56496,56531]],55299:[[56448,56498]],55302:[[56480,56511]],55323:[[56896,56927]],55349:[[56320,56345],[56372,56397],[56424,56449],56476,[56478,56479],56482,[56485,56486],[56489,56492],[56494,56501],[56528,56553],[56580,56581],[56583,56586],[56589,56596],[56598,56604],[56632,56633],[56635,56638],[56640,56644],56646,[56650,56656],[56684,56709],[56736,56761],[56788,56813],[56840,56865],[56892,56917],[56944,56969],[57e3,57024],[57058,57082],[57116,57140],[57174,57198],[57232,57256],[57290,57290]],55354:[[56576,56609]]},t.unicodeLl=[[97,122],181,[223,246],[248,255],257,259,261,263,265,267,269,271,273,275,277,279,281,283,285,287,289,291,293,295,297,299,301,303,305,307,309,[311,312],314,316,318,320,322,324,326,[328,329],331,333,335,337,339,341,343,345,347,349,351,353,355,357,359,361,363,365,367,369,371,373,375,378,380,[382,384],387,389,392,[396,397],402,405,[409,411],414,417,419,421,424,[426,427],429,432,436,438,[441,442],[445,447],454,457,460,462,464,466,468,470,472,474,[476,477],479,481,483,485,487,489,491,493,[495,496],499,501,505,507,509,511,513,515,517,519,521,523,525,527,529,531,533,535,537,539,541,543,545,547,549,551,553,555,557,559,561,[563,569],572,[575,576],578,583,585,587,589,[591,659],[661,687],881,883,887,[891,893],912,[940,974],[976,977],[981,983],985,987,989,991,993,995,997,999,1001,1003,1005,[1007,1011],1013,1016,[1019,1020],[1072,1119],1121,1123,1125,1127,1129,1131,1133,1135,1137,1139,1141,1143,1145,1147,1149,1151,1153,1163,1165,1167,1169,1171,1173,1175,1177,1179,1181,1183,1185,1187,1189,1191,1193,1195,1197,1199,1201,1203,1205,1207,1209,1211,1213,1215,1218,1220,1222,1224,1226,1228,[1230,1231],1233,1235,1237,1239,1241,1243,1245,1247,1249,1251,1253,1255,1257,1259,1261,1263,1265,1267,1269,1271,1273,1275,1277,1279,1281,1283,1285,1287,1289,1291,1293,1295,1297,1299,1301,1303,1305,1307,1309,1311,1313,1315,1317,1319,1321,1323,1325,1327,[1377,1415],[5112,5117],[7296,7304],[7424,7467],[7531,7543],[7545,7578],7681,7683,7685,7687,7689,7691,7693,7695,7697,7699,7701,7703,7705,7707,7709,7711,7713,7715,7717,7719,7721,7723,7725,7727,7729,7731,7733,7735,7737,7739,7741,7743,7745,7747,7749,7751,7753,7755,7757,7759,7761,7763,7765,7767,7769,7771,7773,7775,7777,7779,7781,7783,7785,7787,7789,7791,7793,7795,7797,7799,7801,7803,7805,7807,7809,7811,7813,7815,7817,7819,7821,7823,7825,7827,[7829,7837],7839,7841,7843,7845,7847,7849,7851,7853,7855,7857,7859,7861,7863,7865,7867,7869,7871,7873,7875,7877,7879,7881,7883,7885,7887,7889,7891,7893,7895,7897,7899,7901,7903,7905,7907,7909,7911,7913,7915,7917,7919,7921,7923,7925,7927,7929,7931,7933,[7935,7943],[7952,7957],[7968,7975],[7984,7991],[8e3,8005],[8016,8023],[8032,8039],[8048,8061],[8064,8071],[8080,8087],[8096,8103],[8112,8116],[8118,8119],8126,[8130,8132],[8134,8135],[8144,8147],[8150,8151],[8160,8167],[8178,8180],[8182,8183],8458,[8462,8463],8467,8495,8500,8505,[8508,8509],[8518,8521],8526,8580,[11312,11358],11361,[11365,11366],11368,11370,11372,11377,[11379,11380],[11382,11387],11393,11395,11397,11399,11401,11403,11405,11407,11409,11411,11413,11415,11417,11419,11421,11423,11425,11427,11429,11431,11433,11435,11437,11439,11441,11443,11445,11447,11449,11451,11453,11455,11457,11459,11461,11463,11465,11467,11469,11471,11473,11475,11477,11479,11481,11483,11485,11487,11489,[11491,11492],11500,11502,11507,[11520,11557],11559,11565,42561,42563,42565,42567,42569,42571,42573,42575,42577,42579,2581,42583,42585,42587,42589,42591,42593,42595,42597,42599,42601,42603,42605,42625,42627,42629,42631,42633,42635,42637,42639,42641,42643,42645,42647,42649,42651,42787,42789,42791,42793,42795,42797,[42799,42801],42803,42805,42807,42809,42811,42813,42815,42817,42819,42821,42823,42825,42827,42829,42831,42833,42835,42837,42839,42841,42843,42845,42847,42849,42851,42853,42855,42857,42859,42861,42863,[42865,42872],42874,42876,42879,42881,42883,42885,42887,42892,42894,42897,[42899,42901],42903,42905,42907,42909,42911,42913,42915,42917,42919,42921,42933,42935,43002,[43824,43866],[43872,43877],[43888,43967],[64256,64262],[64275,64279],[65345,65370],[66600,66639],[66776,66811],[68800,68850],[71872,71903],[119834,119859],[119886,119892],[119894,119911],[119938,119963],[119990,119993],119995,[119997,120003],[120005,120015],[120042,120067],[120094,120119],[120146,120171],[120198,120223],[120250,120275],[120302,120327],[120354,120379],[120406,120431],[120458,120485],[120514,120538],[120540,120545],[120572,120596],[120598,120603],[120630,120654],[120656,120661],[120688,120712],[120714,120719],[120746,120770],[120772,120777],120779,[125218,125251]],t.unicodeLlSurrogate={55297:[[56360,56399],[56536,56571]],55299:[[56512,56562]],55302:[[56512,56543]],55323:[[56928,56959]],55349:[[56346,56371],[56398,56404],[56406,56423],[56450,56475],[56502,56505],56507,[56509,56515],[56517,56527],[56554,56579],[56606,56631],[56658,56683],[56710,56735],[56762,56787],[56814,56839],[56866,56891],[56918,56943],[56970,56997],[57026,57050],[57052,57057],[57084,57108],[57110,57115],[57142,57166],[57168,57173],[57200,57224],[57226,57231],[57258,57282],[57284,57289],[57291,57291]],55354:[[56610,56643]]},t.unicodeLt=[453,456,459,498,[8072,8079],[8088,8095],[8104,8111],8124,8140,8188],t.unicodeLo=[170,186,443,[448,451],660,[1488,1514],[1520,1522],[1568,1599],[1601,1610],[1646,1647],[1649,1747],1749,[1774,1775],[1786,1788],1791,1808,[1810,1839],[1869,1957],1969,[1994,2026],[2048,2069],[2112,2136],[2144,2154],[2208,2228],[2230,2237],[2308,2361],2365,2384,[2392,2401],[2418,2432],[2437,2444],[2447,2448],[2451,2472],[2474,2480],2482,[2486,2489],2493,2510,[2524,2525],[2527,2529],[2544,2545],2556,[2565,2570],[2575,2576],[2579,2600],[2602,2608],[2610,2611],[2613,2614],[2616,2617],[2649,2652],2654,[2674,2676],[2693,2701],[2703,2705],[2707,2728],[2730,2736],[2738,2739],[2741,2745],2749,2768,[2784,2785],2809,[2821,2828],[2831,2832],[2835,2856],[2858,2864],[2866,2867],[2869,2873],2877,[2908,2909],[2911,2913],2929,2947,[2949,2954],[2958,2960],[2962,2965],[2969,2970],2972,[2974,2975],[2979,2980],[2984,2986],[2990,3001],3024,[3077,3084],[3086,3088],[3090,3112],[3114,3129],3133,[3160,3162],[3168,3169],3200,[3205,3212],[3214,3216],[3218,3240],[3242,3251],[3253,3257],3261,3294,[3296,3297],[3313,3314],[3333,3340],[3342,3344],[3346,3386],3389,3406,[3412,3414],[3423,3425],[3450,3455],[3461,3478],[3482,3505],[3507,3515],3517,[3520,3526],[3585,3632],[3634,3635],[3648,3653],[3713,3714],3716,[3719,3720],3722,3725,[3732,3735],[3737,3743],[3745,3747],3749,3751,[3754,3755],[3757,3760],[3762,3763],3773,[3776,3780],[3804,3807],3840,[3904,3911],[3913,3948],[3976,3980],[4096,4138],4159,[4176,4181],[4186,4189],4193,[4197,4198],[4206,4208],[4213,4225],4238,[4304,4346],[4349,4680],[4682,4685],[4688,4694],4696,[4698,4701],[4704,4744],[4746,4749],[4752,4784],[4786,4789],[4792,4798],4800,[4802,4805],[4808,4822],[4824,4880],[4882,4885],[4888,4954],[4992,5007],[5121,5740],[5743,5759],[5761,5786],[5792,5866],[5873,5880],[5888,5900],[5902,5905],[5920,5937],[5952,5969],[5984,5996],[5998,6e3],[6016,6067],6108,[6176,6210],[6212,6263],[6272,6276],[6279,6312],6314,[6320,6389],[6400,6430],[6480,6509],[6512,6516],[6528,6571],[6576,6601],[6656,6678],[6688,6740],[6917,6963],[6981,6987],[7043,7072],[7086,7087],[7098,7141],[7168,7203],[7245,7247],[7258,7287],[7401,7404],[7406,7409],[7413,7414],[8501,8504],[11568,11623],[11648,11670],[11680,11686],[11688,11694],[11696,11702],[11704,11710],[11712,11718],[11720,11726],[11728,11734],[11736,11742],12294,12348,[12353,12438],12447,[12449,12538],12543,[12549,12590],[12593,12686],[12704,12730],[12784,12799],[13312,19893],[19968,40938],[40960,40980],[40982,42124],[42192,42231],[42240,42507],[42512,42527],[42538,42539],42606,[42656,42725],42895,42999,[43003,43009],[43011,43013],[43015,43018],[43020,43042],[43072,43123],[43138,43187],[43250,43255],43259,43261,[43274,43301],[43312,43334],[43360,43388],[43396,43442],[43488,43492],[43495,43503],[43514,43518],[43520,43560],[43584,43586],[43588,43595],[43616,43631],[43633,43638],43642,[43646,43695],43697,[43701,43702],[43705,43709],43712,43714,[43739,43740],[43744,43754],43762,[43777,43782],[43785,43790],[43793,43798],[43808,43814],[43816,43822],[43968,44002],[44032,55203],[55216,55238],[55243,55291],[63744,64109],[64112,64217],64285,[64287,64296],[64298,64310],[64312,64316],64318,[64320,64321],[64323,64324],[64326,64433],[64467,64829],[64848,64911],[64914,64967],[65008,65019],[65136,65140],[65142,65276],[65382,65391],[65393,65437],[65440,65470],[65474,65479],[65482,65487],[65490,65495],[65498,65500],[65536,65547],[65549,65574],[65576,65594],[65596,65597],[65599,65613],[65616,65629],[65664,65786],[66176,66204],[66208,66256],[66304,66335],[66349,66368],[66370,66377],[66384,66421],[66432,66461],[66464,66499],[66504,66511],[66640,66717],[66816,66855],[66864,66915],[67072,67382],[67392,67413],[67424,67431],[67584,67589],67592,[67594,67637],[67639,67640],67644,[67647,67669],[67680,67702],[67712,67742],[67808,67826],[67828,67829],[67840,67861],[67872,67897],[67968,68023],[68030,68031],68096,[68112,68115],[68117,68119],[68121,68147],[68192,68220],[68224,68252],[68288,68295],[68297,68324],[68352,68405],[68416,68437],[68448,68466],[68480,68497],[68608,68680],[69635,69687],[69763,69807],[69840,69864],[69891,69926],[69968,70002],70006,[70019,70066],[70081,70084],70106,70108,[70144,70161],[70163,70187],[70272,70278],70280,[70282,70285],[70287,70301],[70303,70312],[70320,70366],[70405,70412],[70415,70416],[70419,70440],[70442,70448],[70450,70451],[70453,70457],70461,70480,[70493,70497],[70656,70708],[70727,70730],[70784,70831],[70852,70853],70855,[71040,71086],[71128,71131],[71168,71215],71236,[71296,71338],[71424,71449],71935,72192,[72203,72242],72250,72272,[72284,72323],[72326,72329],[72384,72440],[72704,72712],[72714,72750],72768,[72818,72847],[72960,72966],[72968,72969],[72971,73008],73030,[73728,74649],[74880,75075],[77824,78894],[82944,83526],[92160,92728],[92736,92766],[92880,92909],[92928,92975],[93027,93047],[93053,93071],[93952,94020],94032,[94208,100332],[100352,101106],[110592,110878],[110960,111355],[113664,113770],[113776,113788],[113792,113800],[113808,113817],[124928,125124],[126464,126467],[126469,126495],[126497,126498],126500,126503,[126505,126514],[126516,126519],126521,126523,126530,126535,126537,126539,[126541,126543],[126545,126546],126548,126551,126553,126555,126557,126559,[126561,126562],126564,[126567,126570],[126572,126578],[126580,126583],[126585,126588],126590,[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[131072,173782],[173824,177972],[177984,178205],[178208,183969],[183984,191456],[194560,195101]],t.unicodeLoSurrogate={55296:[[56320,56331],[56333,56358],[56360,56378],[56380,56381],[56383,56397],[56400,56413],[56448,56570],[56960,56988],[56992,57040],[57088,57119],[57133,57152],[57154,57161],[57168,57205],[57216,57245],[57248,57283],[57288,57295]],55297:[[56400,56477],[56576,56615],[56624,56675],[56832,57142],[57152,57173],[57184,57191]],55298:[[56320,56325],[56328,56328],[56330,56373],[56375,56376],[56380,56380],[56383,56405],[56416,56438],[56448,56478],[56544,56562],[56564,56565],[56576,56597],[56608,56633],[56704,56759],[56766,56767],[56832,56832],[56848,56851],[56853,56855],[56857,56885],[56928,56956],[56960,56988],[57024,57031],[57033,57060],[57088,57141],[57152,57173],[57184,57202],[57216,57233]],55299:[[56320,56392],[56576,56611],[56960,57001],[57008,57009],[57088,57116],57127,[57136,57157],[57264,57284],[57312,57334]],55300:[[56323,56375],[56451,56495],[56528,56552],[56579,56614],56644,56647,[56656,56690],56694,[56707,56754],[56769,56772],56794,56796,[56832,56849],[56851,56875],[56960,56966],56968,[56970,56973],[56975,56989],[56991,57e3],[57008,57054],[57093,57100],[57103,57104],[57107,57128],[57130,57136],[57138,57139],[57141,57145],57149,57168,[57181,57185]],55301:[[56320,56372],[56391,56394],[56415,56417],[56448,56495],[56516,56517],56519,[56704,56750],[56792,56795],[56832,56879],56900,[56960,57002],57016,[57088,57114]],55302:[[56320,56363],[56575,56582],56585,[56588,56595],[56597,56598],[56600,56623],56639,56641,[56736,56743],[56746,56784],56801,56803,56832,[56843,56882],56890,56912,[56924,56969],56989,[57024,57080]],55303:[[56320,56328],[56330,56366],56384,56434,[56576,56582],[56584,56585],[56587,56624],56646,[56672,56677],[56679,56680],[56682,56713],56728,[57056,57074],57264],55304:[[56320,57241]],55305:[[56448,56643]],55308:[[56320,57343]],55309:[[56320,56366]],55313:[[56320,56902]],55322:[[56320,56888],[56896,56926],[57040,57069],[57088,57135],[57187,57207],[57213,57231]],55323:[[57088,57162],57168],55324:[56320],55329:[57335],55330:[[56320,57343]],55331:[[56320,56533],[56576,56576],[56584,56584]],55340:[[56320,56606],[56656,56658],[56676,56679],[56688,57083]],55343:[[56320,56426],[56432,56444],[56448,56456],[56464,56473]],55352:[[56576,56620],56654,[57024,57067]],55354:[[56320,56516]],55355:[[56832,56835],[56837,56863],[56865,56866],56868,56871,[56873,56882],[56884,56887],56889,56891,56898,56903,56905,56907,[56909,56911],[56913,56914],56916,56919,56921,56923,56925,56927,[56929,56930],56932,[56935,56938],[56940,56946],[56948,56951],[56953,56956],56958,[56960,56969],[56971,56987],[56993,56995],[56997,57001],[57003,57019]],55360:[56320],55401:[57053,57088],55405:[57140,57152],55406:[56349,56352],55411:[56993,57008],55418:[57312],55422:[[56320,56861]],55424:[56320],55428:[57162]},t.unicodeLm=[[688,705],[710,721],[736,740],748,750,884,890,1369,1600,[1765,1766],[2036,2037],2042,2074,2084,2088,2417,3654,3782,4348,6103,6211,6823,[7288,7293],[7468,7530],7544,[7579,7615],8305,8319,[8336,8348],[11388,11389],11631,11823,12293,[12337,12341],12347,[12445,12446],[12540,12542],40981,[42232,42237],42508,42623,[42652,42653],[42775,42783],42864,42888,[43e3,43001],43471,43494,43632,43741,[43763,43764],[43868,43871],65392,[65438,65439],[92992,92995],[94099,94111],[94176,94177]],t.unicodeLmSurrogate={55322:[[57152,57155]],55323:[[57235,57247],[57312,57313],57315],55352:[[56631,56637]],55354:[56651]},t.unicodeNl=[[5870,5872],[8544,8578],[8581,8584],12295,[12321,12329],[12344,12346],[42726,42735],[65856,65908],66369,66378,[66513,66517],[74752,74862]],t.unicodeNlSurrogate={55296:[[56640,56692],57153,57162,[57297,57301]],55305:[[56320,56430]]},t.unicodeMn=[[768,879],[1155,1159],[1425,1469],1471,[1473,1474],[1476,1477],1479,[1552,1562],[1611,1631],1648,[1750,1756],[1759,1764],[1767,1768],[1770,1773],1809,[1840,1866],[1958,1968],[2027,2035],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],2362,2364,[2369,2376],2381,[2385,2391],[2402,2403],2433,2492,[2497,2500],2509,[2530,2531],[2561,2562],2620,[2625,2626],[2631,2632],[2635,2637],2641,[2672,2673],2677,[2689,2690],2748,[2753,2757],[2759,2760],2765,[2786,2787],[2810,2815],2817,2876,2879,[2881,2884],2893,2902,[2914,2915],2946,3008,3021,3072,[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],3201,3260,3263,3270,[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],3405,[3426,3427],3530,[3538,3540],3542,3633,[3636,3642],[3655,3662],3761,[3764,3769],[3771,3772],[3784,3789],[3864,3865],3893,3895,3897,[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],4038,[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],4226,[4229,4230],4237,4253,[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],6086,[6089,6099],6109,[6155,6157],[6277,6278],6313,[6432,6434],[6439,6440],6450,[6457,6459],[6679,6680],6683,6742,[6744,6750],6752,6754,[6757,6764],[6771,6780],6783,[6832,6845],[6912,6915],6964,[6966,6970],6972,6978,[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],7142,[7144,7145],7149,[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],7405,7412,[7416,7417],[7616,7673],[7675,7679],[8400,8412],8417,[8421,8432],[11503,11505],11647,[11744,11775],[12330,12333],[12441,12442],42607,[42612,42621],[42654,42655],[42736,42737],43010,43014,43019,[43045,43046],[43204,43205],[43232,43249],[43302,43309],[43335,43345],[43392,43394],43443,[43446,43449],43452,43493,[43561,43566],[43569,43570],[43573,43574],43587,43596,43644,43696,[43698,43700],[43703,43704],[43710,43711],43713,[43756,43757],43766,44005,44008,44013,64286,[65024,65039],[65056,65071],66045,66272,[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],68159,[68325,68326],69633,[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69888,69890],[69927,69931],[69933,69940],70003,[70016,70017],[70070,70078],[70090,70092],[70191,70193],70196,[70198,70199],70206,70367,[70371,70378],[70400,70401],70460,70464,[70502,70508],[70512,70516],[70712,70719],[70722,70724],70726,[70835,70840],70842,[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],71229,[71231,71232],71339,71341,[71344,71349],71351,[71453,71455],[71458,71461],[71463,71467],[72193,72198],[72201,72202],[72243,72248],[72251,72254],72263,[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],72767,[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],73018,[73020,73021],[73023,73029],73031,[92912,92916],[92976,92982],[94095,94098],[113821,113822],[119143,119145],[119163,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],121461,121476,[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[125136,125142],[125252,125258],[917760,917999]],t.unicodeMnSurrogate={55296:[56829,57056,[57206,57210]],55298:[[56833,56835],[56837,56838],[56844,56847],[56888,56890],56895,[57061,57062]],55299:[[56612,56615],[57003,57004],[57158,57168]],55300:[56321,[56376,56390],[56447,56449],[56499,56502],[56505,56506],[56576,56578],[56615,56619],[56621,56628],56691,[56704,56705],[56758,56766],[56777,56780],56783,[56879,56881],56884,[56886,56887],56894,57055,[57059,57066],[57088,57089],[57147,57148],57152,[57190,57196],[57200,57204]],55301:[[56376,56383],[56386,56388],56390,56414,[56499,56504],56506,[56511,56512],[56514,56515],[56754,56757],[56764,56765],[56767,56768],[56796,56797],[56883,56890],56893,[56895,56896],57003,57005,[57008,57013],57015,[57117,57119],[57122,57125],[57127,57131]],55302:[[56367,56375],[56377,56378],[56635,56636],56638,56643,[56788,56791],[56794,56795],56800,[56833,56842],[56883,56888],[56891,56894],56903,[56913,56918],[56921,56923],[56970,56982],[56984,56985]],55303:[[56368,56374],[56376,56381],56383,[56466,56487],[56490,56496],[56498,56499],[56501,56502],[56625,56630],56634,[56636,56637],[56639,56645],56647,[56720,56721],56725,56727,[57075,57076]],55322:[[57072,57076],[57136,57142]],55323:[57167,[57231,57234],57316],55343:[[56477,56478]],55348:[[56679,56681],[56699,56706],[56709,56715],[56746,56749],[56898,56900]],55350:[[56832,56886],[56891,56940],56949,56964,[56987,56991],[56993,57007]],55352:[[56320,56326],[56328,56344],[56347,56353],[56355,56356],[56358,56362],[56624,56630],[57068,57071]],55354:[[56528,56534],[56644,56650]],56128:[[56576,56815]]},t.unicodeMc=[2307,2363,[2366,2368],[2377,2380],[2382,2383],[2434,2435],[2494,2496],[2503,2504],[2507,2508],2519,2563,[2622,2624],2691,[2750,2752],2761,[2763,2764],[2818,2819],2878,2880,[2887,2888],[2891,2892],2903,[3006,3007],[3009,3010],[3014,3016],[3018,3020],3031,[3073,3075],[3137,3140],[3202,3203],3262,[3264,3268],[3271,3272],[3274,3275],[3285,3286],[3330,3331],[3390,3392],[3398,3400],[3402,3404],3415,[3458,3459],[3535,3537],[3544,3551],[3570,3571],[3902,3903],3967,[4139,4140],4145,4152,[4155,4156],[4182,4183],[4194,4196],[4199,4205],[4227,4228],[4231,4236],4239,[4250,4252],6070,[6078,6085],[6087,6088],[6435,6438],[6441,6443],[6448,6449],[6451,6456],[6681,6682],6741,6743,6753,[6755,6756],[6765,6770],6916,6965,6971,[6973,6977],[6979,6980],7042,7073,[7078,7079],7082,7143,[7146,7148],7150,[7154,7155],[7204,7211],[7220,7221],7393,[7410,7411],7415,[12334,12335],[43043,43044],43047,[43136,43137],[43188,43203],[43346,43347],43395,[43444,43445],[43450,43451],[43453,43456],[43567,43568],[43571,43572],43597,43643,43645,43755,[43758,43759],43765,[44003,44004],[44006,44007],[44009,44010],44012,69632,69634,69762,[69808,69810],[69815,69816],69932,70018,[70067,70069],[70079,70080],[70188,70190],[70194,70195],70197,[70368,70370],[70402,70403],[70462,70463],[70465,70468],[70471,70472],[70475,70477],70487,[70498,70499],[70709,70711],[70720,70721],70725,[70832,70834],70841,[70843,70846],70849,[71087,71089],[71096,71099],71102,[71216,71218],[71227,71228],71230,71340,[71342,71343],71350,[71456,71457],71462,[72199,72200],72249,[72279,72280],72343,72751,72766,72873,72881,72884,[94033,94078],[119141,119142],[119149,119154]],t.unicodeMcSurrogate={55300:[56320,56322,56450,[56496,56498],[56503,56504],56620,[56645,56646],56706,[56755,56757],[56767,56768],56782,[56876,56878],[56882,56883],56885,[57056,57058],[57090,57091],[57150,57151],[57153,57156],[57159,57160],[57163,57165],57175,[57186,57187]],55301:[[56373,56375],[56384,56385],56389,[56496,56498],56505,[56507,56510],56513,[56751,56753],[56760,56763],56766,[56880,56882],[56891,56892],56894,57004,[57006,57007],57014,[57120,57121],57126],55302:[[56364,56366],56376,[56624,56629],[56631,56632],56637,56640,56642,[56785,56787],[56796,56799],56804,56889,[56919,56920],56983],55303:[56367,56382,56489,56497,56500,[56714,56718],[56723,56724],56726,[57077,57078]],55323:[[57169,57223],[57328,57329]],55348:[[56677,56678],[56685,56690]]},t.unicodeNd=[[48,57],[1632,1641],[1776,1785],[1984,1993],[2406,2415],[2534,2543],[2662,2671],[2790,2799],[2918,2927],[3046,3055],[3174,3183],[3302,3311],[3430,3439],[3558,3567],[3664,3673],[3792,3801],[3872,3881],[4160,4169],[4240,4249],[6112,6121],[6160,6169],[6470,6479],[6608,6617],[6784,6793],[6800,6809],[6992,7001],[7088,7097],[7232,7241],[7248,7257],[42528,42537],[43216,43225],[43264,43273],[43472,43481],[43504,43513],[43600,43609],[44016,44025],[65296,65305],[66720,66729],[69734,69743],[69872,69881],[69942,69951],[70096,70105],[70384,70393],[70736,70745],[70864,70873],[71248,71257],[71360,71369],[71472,71481],[71904,71913],[72784,72793],[73040,73049],[92768,92777],[93008,93017],[120782,120831],[125264,125273]],t.unicodeNdSurrogate={55297:[[56480,56489]],55299:[[56624,56633]],55300:[[56422,56431],[56560,56569],[56630,56639],[56784,56793],[57072,57081]],55301:[[56400,56409],[56528,56537],[56912,56921],[57024,57033],[57136,57145]],55302:[[56544,56553],56656],55303:[[56400,56409],[56656,56665],[56736,56745]],55322:[[56928,56937],[57168,57177]],55349:[[57294,57343]],55352:[[56640,56649],[57072,57081]],55354:[[56656,56665]],55358:[[57328,57337]]},t.unicodePc=[95,[8255,8256],8276,[65075,65076],[65101,65103],65343]},6249:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.main=void 0;const s=n(8718),r=i(n(3893)),a=i(n(2110)),o=n(2559),l=n(6708),c=n(1775),p=n(2211),d=n(6657),u=n(7720),m=n(3550),h=n(6886),y=n(1447),g=n(8304),f=n(3584),T=n(7646);var _;!function(e){e[e.NoErrors=0]="NoErrors",e[e.ErrorsReported=1]="ErrorsReported",e[e.FatalError=2]="FatalError",e[e.ConfigFileParseError=3]="ConfigFileParseError",e[e.ParameterError=4]="ParameterError"}(_||(_={}));const v=Object.freeze({isCancellationRequested:!1,onCancellationRequested:function(){return{dispose(){}}}});function b(e,t){"error"===e.severity?t.summary.errorCount++:"warning"===e.severity?t.summary.warningCount++:"information"===e.severity&&t.summary.informationCount++}function I(){return n(6183).i8.toString()}function C(e,t){return{file:e,severity:0===t.category?"error":1===t.category?"warning":"information",message:t.message,range:(0,m.isEmptyRange)(t.range)?void 0:t.range,rule:t.getRule()}}function S(e,t="  "){let n=t;e.file&&(n+=`${e.file}:`),e.range&&!(0,m.isEmptyRange)(e.range)&&(n+=r.default.yellow(`${e.range.start.line+1}`)+":"+r.default.yellow(`${e.range.start.character+1}`)+" - ");const[i,...s]=e.message.split("\n");n+="error"===e.severity?r.default.red("error"):"warning"===e.severity?r.default.cyan("warning"):r.default.blue("info"),n+=`: ${i}`,s.length>0&&(n+="\n"+t+s.join("\n"+t)),e.rule&&(n+=r.default.gray(` (${e.rule})`)),console.log(n)}t.main=async function(){n(5330).install();const e=await async function(){const e=[{name:"createstub",type:String},{name:"dependencies",type:Boolean},{name:"files",type:String,multiple:!0,defaultOption:!0},{name:"help",alias:"h",type:Boolean},{name:"ignoreexternal",type:Boolean},{name:"lib",type:Boolean},{name:"outputjson",type:Boolean},{name:"project",alias:"p",type:String},{name:"pythonplatform",type:String},{name:"pythonversion",type:String},{name:"skipunannotated",type:Boolean},{name:"stats",type:Boolean},{name:"typeshed-path",alias:"t",type:String},{name:"venv-path",alias:"v",type:String},{name:"verifytypes",type:String},{name:"verbose",type:Boolean},{name:"version",type:Boolean},{name:"warnings",type:Boolean},{name:"watch",alias:"w",type:Boolean}];let t;try{t=(0,a.default)(e)}catch(e){const t=e;return t&&t.optionName?(console.error(`Unexpected option ${t.optionName}.\npyright --help for usage`),_.ParameterError):(console.error("Unexpected error\npyright --help for usage"),_.ParameterError)}if(void 0!==t.help)return console.log("Usage: pyright [options] files...\n  Options:\n  --createstub <IMPORT>              Create type stub file(s) for import\n  --dependencies                     Emit import dependency information\n  -h,--help                          Show this help message\n  --ignoreexternal                   Ignore external imports for --verifytypes\n  --lib                              Use library code to infer types when stubs are missing\n  --outputjson                       Output results in JSON format\n  -p,--project <FILE OR DIRECTORY>   Use the configuration file at this location\n  --pythonplatform <PLATFORM>        Analyze for a specific platform (Darwin, Linux, Windows)\n  --pythonversion <VERSION>          Analyze for a specific version (3.3, 3.4, etc.)\n  --skipunannotated                  Do not analyze functions and methods with no type annotations\n  --stats                            Print detailed performance stats\n  -t,--typeshed-path <DIRECTORY>     Use typeshed type stubs at this location\n  -v,--venv-path <DIRECTORY>         Directory that contains virtual environments\n  --verbose                          Emit verbose diagnostics\n  --verifytypes <PACKAGE>            Verify type completeness of a py.typed package\n  --version                          Print Pyright version\n  --warnings                         Use exit code of 1 if warnings are reported\n  -w,--watch                         Continue to run and watch for changes\n"),_.NoErrors;if(void 0!==t.version)return console.log(`pyright ${I()}`),_.NoErrors;if(t.outputjson){const e=["watch","stats","verbose","createstub","dependencies"];for(const n of e)if(void 0!==t[n])return console.error(`'outputjson' option cannot be used with '${n}' option`),_.ParameterError}if(void 0!==t.verifytypes){const e=["watch","stats","createstub","dependencies","skipunannotated"];for(const n of e)if(void 0!==t[n])return console.error(`'verifytypes' option cannot be used with '${n}' option`),_.ParameterError}if(t.createstub){const e=["watch","stats","verifytypes","dependencies","skipunannotated"];for(const n of e)if(void 0!==t[n])return console.error(`'createstub' option cannot be used with '${n}' option`),_.ParameterError}const n=new c.CommandLineOptions(process.cwd(),!1);if(t.files&&Array.isArray(t.files)?(n.fileSpecs=t.files,n.fileSpecs=n.fileSpecs.map((e=>(0,d.combinePaths)(process.cwd(),e)))):n.fileSpecs=[],t.project&&(n.configFilePath=(0,d.combinePaths)(process.cwd(),(0,d.normalizePath)(t.project))),t.pythonplatform){if("Darwin"!==t.pythonplatform&&"Linux"!==t.pythonplatform&&"Windows"!==t.pythonplatform)return console.error(`'${t.pythonplatform}' is not a supported Python platform; specify Darwin, Linux, or Windows`),_.ParameterError;n.pythonPlatform=t.pythonplatform}if(t.pythonversion){const e=(0,h.versionFromString)(t.pythonversion);if(!e)return console.error(`'${t.pythonversion}' is not a supported Python version; specify 3.3, 3.4, etc.`),_.ParameterError;n.pythonVersion=e}t["venv-path"]&&(n.venvPath=(0,d.combinePaths)(process.cwd(),(0,d.normalizePath)(t["venv-path"]))),t["typeshed-path"]&&(n.typeshedPath=(0,d.combinePaths)(process.cwd(),(0,d.normalizePath)(t["typeshed-path"]))),t.createstub&&(n.typeStubTargetImportName=t.createstub),n.analyzeUnannotatedFunctions=!t.skipunannotated,t.verbose&&(n.verboseOutput=!0),t.lib&&(n.useLibraryCodeForTypes=!0),n.checkOnlyOpenFiles=!1,t.stats&&t.verbose&&(n.logTypeEvaluationTime=!0);const i=!!t.warnings,r=n.logTypeEvaluationTime?p.LogLevel.Log:p.LogLevel.Error,m=t.outputjson?new p.StderrConsoleWithLevel(r):new p.StandardConsoleWithLevel(r),F=new y.PyrightFileSystem((0,u.createFromRealFileSystem)(m,new T.ChokidarFileWatcherProvider(m)));if(void 0!==t.verifytypes)return function(e,t,n,i,r){try{const a=function(e,t){const n={version:I(),time:Date.now().toString(),generalDiagnostics:[],summary:{filesAnalyzed:t.modules.size,errorCount:0,warningCount:0,informationCount:0,timeInSec:s.timingStats.getTotalDuration()}};t.generalDiagnostics.forEach((e=>{const t=C("",e);n.generalDiagnostics.push(t),b(t,n)})),n.typeCompleteness={packageName:e,ignoreUnknownTypesFromImports:t.ignoreExternal,packageRootDirectory:t.rootDirectory,pyTypedPath:t.pyTypedPath,exportedSymbolCounts:{withKnownType:0,withUnknownType:0},otherSymbolCounts:{withKnownType:0,withUnknownType:0},missingFunctionDocStringCount:t.missingFunctionDocStringCount,missingClassDocStringCount:t.missingClassDocStringCount,missingDefaultParamCount:t.missingDefaultParamCount,completenessScore:0,modules:[],symbols:[]},t.modules.forEach((e=>{const t={name:e.name};n.typeCompleteness.modules.push(t)})),t.symbols.forEach((e=>{const i={category:o.PackageTypeVerifier.getSymbolCategoryString(e.category),name:e.fullName,referenceCount:e.referenceCount,isExported:e.isExported,isTypeKnown:0===e.typeKnownStatus,diagnostics:e.diagnostics.map((e=>C(e.filePath,e.diagnostic)))},s=t.alternateSymbolNames.get(e.fullName);s&&(i.alternateNames=s),n.typeCompleteness.symbols.push(i),0===e.typeKnownStatus?e.isExported?n.typeCompleteness.exportedSymbolCounts.withKnownType++:n.typeCompleteness.otherSymbolCounts.withKnownType++:e.isExported?n.typeCompleteness.exportedSymbolCounts.withUnknownType++:n.typeCompleteness.otherSymbolCounts.withUnknownType++}));const i=n.typeCompleteness.exportedSymbolCounts.withUnknownType,r=n.typeCompleteness.exportedSymbolCounts.withKnownType,a=i+r;return a>0&&(n.typeCompleteness.completenessScore=r/a),n}(t,new o.PackageTypeVerifier(e,t,r).verify());return i?console.log(JSON.stringify(a,void 0,4)):function(e,t){const n=e.typeCompleteness;console.log(`Package name: "${n.packageName}"`),void 0!==n.packageRootDirectory&&console.log(`Package directory: "${n.packageRootDirectory}"`),void 0!==n.pyTypedPath&&console.log(`Path of py.typed file: "${n.pyTypedPath}"`),n.modules.length>0&&(console.log(""),console.log(`Public modules: ${n.modules.length}`),n.modules.forEach((e=>{console.log(`   ${e.name}`)}))),n.symbols.length>0&&t&&(console.log(""),console.log(`Exported symbols: ${n.symbols.length}`),n.symbols.forEach((e=>{if(e.isExported){const t=e.referenceCount>1?` (${e.referenceCount} references)`:"";console.log(`   ${e.name}${t}`)}})),console.log(""),console.log(`Other referenced symbols: ${n.symbols.length}`),n.symbols.forEach((e=>{if(!e.isExported){const t=e.referenceCount>1?` (${e.referenceCount} references)`:"";console.log(`   ${e.name}${t}`)}}))),e.generalDiagnostics.forEach((e=>{S(e)})),console.log(""),console.log("Symbols used in public interface:"),e.typeCompleteness.symbols.forEach((e=>{let n=e.diagnostics;t||(n=n.filter((e=>"error"===e.severity))),n.length>0&&(console.log(`${e.name}`),n.forEach((e=>{S(e)})))})),console.log(""),console.log(`Symbols exported by "${n.packageName}": ${n.exportedSymbolCounts.withKnownType+n.exportedSymbolCounts.withUnknownType}`),console.log(`  With known type: ${n.exportedSymbolCounts.withKnownType}`),console.log(`  With partially unknown type: ${n.exportedSymbolCounts.withUnknownType}`),n.ignoreUnknownTypesFromImports&&console.log("    (Ignoring unknown types imported from other packages)"),console.log(`  Functions without docstring: ${n.missingFunctionDocStringCount}`),console.log(`  Functions without default param: ${n.missingDefaultParamCount}`),console.log(`  Classes without docstring: ${n.missingClassDocStringCount}`),console.log(""),console.log(`Other symbols referenced but not exported by "${n.packageName}": ${n.otherSymbolCounts.withKnownType+n.otherSymbolCounts.withUnknownType}`),console.log(`  With known type: ${n.otherSymbolCounts.withKnownType}`),console.log(`  With partially unknown type: ${n.otherSymbolCounts.withUnknownType}`),console.log(""),console.log(`Type completeness score: ${Math.round(1e3*n.completenessScore)/10}%`),console.log(""),console.info(`Completed in ${e.summary.timeInSec}sec`),console.log("")}(a,n),a.typeCompleteness.completenessScore<1?_.ErrorsReported:_.NoErrors}catch(e){let t="";return e instanceof Error&&(t=": "+e.message),console.error("Error occurred when verifying types: "+t),_.FatalError}}(F,t.verifytypes||"",!!t.verbose,!!t.outputjson,t.ignoreexternal);if(void 0!==t.ignoreexternal)return console.error("'--ignoreexternal' is valid only when used with '--verifytypes'"),_.ParameterError;const D=void 0!==t.watch;n.watchForSourceChanges=D,n.watchForConfigChanges=D;const P=new l.AnalyzerService("<default>",F,m,(()=>new f.FullAccessHost(F))),x=(0,g.createDeferred)();return P.setCompletionCallback((e=>{if(e.fatalErrorOccurred)return void x.resolve(_.FatalError);if(e.configParseErrorOccurred)return void x.resolve(_.ConfigFileParseError);let n=0;if(e.diagnostics.length>0&&!t.createstub&&!t.verifytypes)if(t.outputjson){const t=function(e,t,n){const i={version:I(),time:Date.now().toString(),generalDiagnostics:[],summary:{filesAnalyzed:t,errorCount:0,warningCount:0,informationCount:0,timeInSec:n}};return e.forEach((e=>{e.diagnostics.forEach((t=>{if(0===t.category||1===t.category||2===t.category){const n=C(e.filePath,t);i.generalDiagnostics.push(n),b(n,i)}}))})),console.log(JSON.stringify(i,void 0,4)),{errorCount:i.summary.errorCount,warningCount:i.summary.warningCount,informationCount:i.summary.informationCount,diagnosticCount:i.summary.errorCount+i.summary.warningCount+i.summary.informationCount}}(e.diagnostics,e.filesInProgram,e.elapsedTime);n+=t.errorCount,i&&(n+=t.warningCount)}else{const t=function(e){let t=0,n=0,i=0;return e.forEach((e=>{const s=e.diagnostics.filter((e=>3!==e.category&&4!==e.category));s.length>0&&(console.log(`${e.filePath}`),s.forEach((s=>{S(C(e.filePath,s)),0===s.category?t++:1===s.category?n++:2===s.category&&i++})))})),console.log(`${t.toString()} ${1===t?"error":"errors"}, ${n.toString()} ${1===n?"warning":"warnings"}, ${i.toString()} ${1===i?"info":"infos"} `),{errorCount:t,warningCount:n,informationCount:i,diagnosticCount:t+n+i}}(e.diagnostics);n+=t.errorCount,i&&(n+=t.warningCount)}if(t.createstub&&0===e.filesRequiringAnalysis){try{P.writeTypeStub(v),P.dispose(),console.log(`Type stub was created for '${t.createstub}'`)}catch(e){let t="";return e instanceof Error&&(t=": "+e.message),console.error("Error occurred when creating type stub: "+t),void x.resolve(_.FatalError)}x.resolve(_.NoErrors)}else t.outputjson||(D||s.timingStats.printSummary(console),t.stats&&(P.printStats(),s.timingStats.printDetails(console)),t.dependencies&&P.printDependencies(!!t.verbose)),D?t.outputjson||console.log("Watching for file changes..."):x.resolve(n>0?_.ErrorsReported:_.NoErrors)})),P.setOptions(n),await x.promise}();process.exitCode=e}},1447:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PyrightFileSystem=void 0;const i=n(1277),s=n(3188),r=n(6657),a=n(9459);class o extends a.ReadOnlyAugmentedFileSystem{constructor(e){super(e),this._rootSearched=new Set,this._partialStubPackagePaths=new Set,this._conflictMap=new Map,this._customUriMap=new Map}mkdirSync(e,t){this._realFS.mkdirSync(e,t)}chdir(e){this._realFS.chdir(e)}writeFileSync(e,t,n){this._realFS.writeFileSync(this._getOriginalPath(e),t,n)}unlinkSync(e){this._realFS.unlinkSync(this._getOriginalPath(e))}createWriteStream(e){return this._realFS.createWriteStream(this._getOriginalPath(e))}copyFileSync(e,t){this._realFS.copyFileSync(this._getOriginalPath(e),this._getOriginalPath(t))}getUri(e){const t=this._customUriMap.get(this.getMappedFilePath(e));return t?t.uri:this._realFS.getUri(e)}hasUriMapEntry(e,t){const n=this._customUriMap.get(t);return!(!n||n.uri!==e)}addUriMap(e,t){const n=this._customUriMap.get(t);return n?n.uri===e&&(n.closed=!1,!0):(this._customUriMap.set(t,{uri:e,closed:!1,hasPendingRequest:!1}),!0)}removeUriMap(e,t){const n=this._customUriMap.get(t);return!(!n||n.uri!==e||(n.hasPendingRequest?(n.closed=!0,0):(this._customUriMap.delete(t),0)))}pendingRequest(e,t){const n=this._customUriMap.get(e);n&&(t||!n.closed?n.hasPendingRequest=t:this._customUriMap.delete(e))}isPartialStubPackagesScanned(e){var t;return this.isPathScanned(null!==(t=e.root)&&void 0!==t?t:"")}isPathScanned(e){return this._rootSearched.has(e)}processPartialStubPackages(e,t){var n;for(const a of e)if(this._rootSearched.add(a),this._realFS.existsSync(a)&&(0,r.isDirectory)(this._realFS,a))for(const e of this._realFS.readdirEntriesSync(a)){const o=(0,r.combinePaths)(a,e.name);if(!(e.isSymbolicLink()?null===(n=(0,r.tryStat)(this._realFS,o))||void 0===n?void 0:n.isDirectory():e.isDirectory())||!e.name.endsWith(s.stubsSuffix))continue;const l=(0,i.getPyTypedInfo)(this._realFS,o);if(!l||!l.isPartiallyTyped)continue;let c;this._partialStubPackagePaths.add(o);const p=e.name.substr(0,e.name.length-s.stubsSuffix.length);for(const e of t){const t=(0,r.combinePaths)(e,p);try{const e=(0,r.tryStat)(this._realFS,t);if(!(null==e?void 0:e.isDirectory()))continue;const n=(0,i.getPyTypedInfo)(this._realFS,t);if(n&&!n.isPartiallyTyped)continue;c=null!=c?c:this._getRelativePathPartialStubs(o);for(const e of c){const n=(0,r.combinePaths)(o,e),i=(0,r.combinePaths)(t,e);if(this.existsSync(i)){const t=(0,r.changeAnyExtension)(i,"py"),s=(0,r.changeAnyExtension)((0,r.combinePaths)(this.tmpdir(),"conflictFiles",p,e),"py");this._conflictMap.has(i)||this.existsSync(t)||this.existsSync(s)||(this._recordMovedEntry(s,n,!1),this._conflictMap.set(i,s))}else this._recordMovedEntry(i,n)}}catch{}}}}clearPartialStubs(){super._clear(),this._rootSearched.clear(),this._partialStubPackagePaths.clear(),this._conflictMap.clear()}getConflictedFile(e){return this._conflictMap.get(e)}_getRelativePathPartialStubs(e){const t=[],n=(0,r.ensureTrailingDirectorySeparator)(e).length,i=e=>{for(const s of this._realFS.readdirEntriesSync(e)){const a=(0,r.combinePaths)(e,s.name);let o=s.isDirectory(),l=s.isFile();if(s.isSymbolicLink()){const e=(0,r.tryStat)(this._realFS,a);e&&(o=e.isDirectory(),l=e.isFile())}if(o&&i(a),l&&s.name.endsWith(".pyi")){const e=a.substring(n);e&&t.push(e)}}};return i(e),t}_isMovedEntry(e){return this._partialStubPackagePaths.has(e)||super._isMovedEntry(e)}}t.PyrightFileSystem=o},9459:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReadOnlyAugmentedFileSystem=void 0;const i=n(9489),s=n(7830),r=n(6657);t.ReadOnlyAugmentedFileSystem=class{constructor(e){this._realFS=e,this._entryMap=new Map,this._reverseEntryMap=new Map,this._folderMap=new Map}existsSync(e){return!this._isMovedEntry(e)&&this._realFS.existsSync(this._getOriginalPath(e))}mkdirSync(e,t){throw new Error("Operation is not allowed.")}chdir(e){throw new Error("Operation is not allowed.")}readdirEntriesSync(e){const t=(0,r.ensureTrailingDirectorySeparator)(e),n=[],i=this._folderMap.get(t);return i&&!this._realFS.existsSync(e)||n.push(...this._realFS.readdirEntriesSync(e).filter((t=>!this._isMovedEntry((0,r.combinePaths)(e,t.name))))),i?n.concat(i.map((e=>new s.VirtualDirent(e.name,e.isFile)))):n}readdirSync(e){return this.readdirEntriesSync(e).map((e=>e.name))}readFileSync(e,t){return this._realFS.readFileSync(this._getOriginalPath(e),t)}writeFileSync(e,t,n){throw new Error("Operation is not allowed.")}statSync(e){return this._realFS.statSync(this._getOriginalPath(e))}unlinkSync(e){throw new Error("Operation is not allowed.")}realpathSync(e){return this._entryMap.has(e)?e:this._realFS.realpathSync(e)}getModulePath(){return this._realFS.getModulePath()}createFileSystemWatcher(e,t){return this._realFS.createFileSystemWatcher(e,t)}createReadStream(e){return this._realFS.createReadStream(this._getOriginalPath(e))}createWriteStream(e){throw new Error("Operation is not allowed.")}copyFileSync(e,t){throw new Error("Operation is not allowed.")}readFile(e){return this._realFS.readFile(this._getOriginalPath(e))}readFileText(e,t){return this._realFS.readFileText(this._getOriginalPath(e),t)}tmpdir(){return this._realFS.tmpdir()}tmpfile(e){return this._realFS.tmpfile(e)}realCasePath(e){return this._realFS.realCasePath(e)}getUri(e){return this._realFS.getUri(e)}isMappedFilePath(e){return this._entryMap.has(e)||this._realFS.isMappedFilePath(e)}getOriginalFilePath(e){return this._realFS.getOriginalFilePath(this._getOriginalPath(e))}getMappedFilePath(e){var t;const n=this._realFS.getMappedFilePath(e);return null!==(t=this._reverseEntryMap.get(n))&&void 0!==t?t:n}isInZipOrEgg(e){return this._realFS.isInZipOrEgg(e)}_recordMovedEntry(e,t,n=!0,s=!0){this._entryMap.set(e,t),n&&this._reverseEntryMap.set(t,e);const a=(0,r.ensureTrailingDirectorySeparator)((0,r.getDirectoryPath)(e)),o=(0,i.getOrAdd)(this._folderMap,a,(()=>[])),l=(0,r.getFileName)(e);o.some((e=>e.name===l))||o.push({name:l,isFile:s})}_getOriginalPath(e){var t;return null!==(t=this._entryMap.get(e))&&void 0!==t?t:e}_isMovedEntry(e){return this._reverseEntryMap.has(e)}_clear(){this._entryMap.clear(),this._reverseEntryMap.clear(),this._folderMap.clear()}}},8863:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PyrightServer=void 0;const i=n(4494),s=n(2374),r=n(1887),a=n(9560),o=n(9926),l=n(3213),c=n(2211),p=n(2489),d=n(9241),u=n(3584),m=n(6657),h=n(7720),y=n(2185),g=n(8992),f=n(8590),T=n(1447),_=n(214),v={openFilesTimeInMs:50,noOpenFilesTimeInMs:200};class b extends g.LanguageServerBase{constructor(e){const t=n(6183).i8||"",s=global.__rootDirectory||__dirname,r=new c.ConsoleWithLogLevel(e.console),a=new _.WorkspaceMap,l=new h.WorkspaceFileWatcherProvider(a,r),p=(0,h.createFromRealFileSystem)(r,l),u=new T.PyrightFileSystem(p);super({productName:"Pyright",rootDirectory:s,version:t,workspaceMap:a,fileSystem:u,fileWatcherProvider:l,cancellationProvider:new d.FileBasedCancellationProvider("bg"),maxAnalysisTimeInForeground:v,supportedCodeActions:[i.CodeActionKind.QuickFix,i.CodeActionKind.SourceOrganizeImports],uriParser:new y.UriParser(u)},e,r),this._controller=new o.CommandController(this)}async getSettings(e){const t={watchForSourceChanges:!0,watchForLibraryChanges:!0,watchForConfigChanges:!0,openFilesOnly:!0,useLibraryCodeForTypes:!1,disableLanguageServices:!1,disableOrganizeImports:!1,typeCheckingMode:"basic",diagnosticSeverityOverrides:{},logLevel:c.LogLevel.Info,autoImportCompletions:!0};try{const n=await this.getConfiguration(e.rootUri,"python");if(n){const i=n.pythonPath;i&&(0,p.isString)(i)&&!(0,r.isPythonBinary)(i)&&(t.pythonPath=(0,m.resolvePaths)(e.rootPath,this.expandPathVariables(e.rootPath,i)));const s=n.venvPath;s&&(0,p.isString)(s)&&(t.venvPath=(0,m.resolvePaths)(e.rootPath,this.expandPathVariables(e.rootPath,s)))}const i=await this.getConfiguration(e.rootUri,"python.analysis");if(i){const n=i.typeshedPaths;if(n&&Array.isArray(n)&&n.length>0){const i=n[0];i&&(0,p.isString)(i)&&(t.typeshedPath=(0,m.resolvePaths)(e.rootPath,this.expandPathVariables(e.rootPath,i)))}const s=i.stubPath;s&&(0,p.isString)(s)&&(t.stubPath=(0,m.resolvePaths)(e.rootPath,this.expandPathVariables(e.rootPath,s)));const r=i.diagnosticSeverityOverrides;if(r)for(const[e,n]of Object.entries(r)){const i=this.getDiagnosticRuleName(e),s=this.getSeverityOverrides(n);i&&s&&(t.diagnosticSeverityOverrides[i]=s)}void 0!==i.diagnosticMode?t.openFilesOnly=this.isOpenFilesOnly(i.diagnosticMode):void 0!==i.openFilesOnly&&(t.openFilesOnly=!!i.openFilesOnly),void 0!==i.useLibraryCodeForTypes&&(t.useLibraryCodeForTypes=!!i.useLibraryCodeForTypes),t.logLevel=this.convertLogLevel(i.logLevel),t.autoSearchPaths=!!i.autoSearchPaths;const a=i.extraPaths;a&&Array.isArray(a)&&a.length>0&&(t.extraPaths=a.filter((e=>e&&(0,p.isString)(e))).map((t=>(0,m.resolvePaths)(e.rootPath,this.expandPathVariables(e.rootPath,t))))),void 0!==i.typeCheckingMode&&(t.typeCheckingMode=i.typeCheckingMode),void 0!==i.autoImportCompletions&&(t.autoImportCompletions=i.autoImportCompletions),t.logLevel===c.LogLevel.Log&&void 0!==i.logTypeEvaluationTime&&(t.logTypeEvaluationTime=i.logTypeEvaluationTime),void 0!==i.typeEvaluationTimeThreshold&&(t.typeEvaluationTimeThreshold=i.typeEvaluationTimeThreshold)}else t.autoSearchPaths=!0;const s=await this.getConfiguration(e.rootUri,"pyright");if(s){void 0!==s.openFilesOnly&&(t.openFilesOnly=!!s.openFilesOnly),void 0!==s.useLibraryCodeForTypes&&(t.useLibraryCodeForTypes=!!s.useLibraryCodeForTypes),t.disableLanguageServices=!!s.disableLanguageServices,t.disableOrganizeImports=!!s.disableOrganizeImports;const e=s.typeCheckingMode;e&&(0,p.isString)(e)&&(t.typeCheckingMode=e)}}catch(e){this.console.error(`Error reading settings: ${e}`)}return t}createBackgroundAnalysis(){if(!(0,p.isDebugMode)()&&(0,l.getCancellationFolderName)())return new a.BackgroundAnalysis(this.console)}createHost(){return new u.FullAccessHost(this.fs)}createImportResolver(e,t,n){return new s.ImportResolver(e,t,n)}executeCommand(e,t){return this._controller.execute(e,t)}isLongRunningCommand(e){return this._controller.isLongRunningCommand(e)}async executeCodeAction(e,t){this.recordUserInteractionTime();const n=this._uriParser.decodeTextDocumentUri(e.textDocument.uri),i=await this.getWorkspaceForFile(n);return f.CodeActionProvider.getCodeActionsForPosition(i,n,e.range,t)}createProgressReporter(){let e;return{isEnabled:e=>!0,begin:()=>{this.client.hasWindowProgressCapability?(e=this._connection.window.createWorkDoneProgress(),e.then((e=>{e.begin("")})).ignoreErrors()):this._connection.sendNotification("pyright/beginProgress")},report:t=>{e?e.then((e=>{e.report(t)})).ignoreErrors():this._connection.sendNotification("pyright/reportProgress",t)},end:()=>{e?(e.then((e=>{e.done()})).ignoreErrors(),e=void 0):this._connection.sendNotification("pyright/endProgress")}}}}t.PyrightServer=b},214:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceMap=void 0;const i=n(8304);class s extends Map{constructor(){super(...arguments),this._defaultWorkspacePath="<default>"}getNonDefaultWorkspaces(){const e=[];return this.forEach((t=>{t.rootPath&&e.push(t)})),e}getWorkspaceForFile(e,t){let n,s;if(this.forEach((e=>{e.rootPath&&t.startsWith(e.rootPath)&&(void 0===n||e.rootPath.startsWith(n))&&(n=e.rootPath,s=e)})),void 0===s){let t=this.get(this._defaultWorkspacePath);if(!t){const n=[...this.keys()];if(1===n.length)return this.get(n[0]);t={workspaceName:"",rootPath:"",rootUri:"",serviceInstance:e.createAnalyzerService(this._defaultWorkspacePath),disableLanguageServices:!1,disableOrganizeImports:!1,isInitialized:(0,i.createDeferred)()},this.set(this._defaultWorkspacePath,t),e.updateSettingsForWorkspace(t).ignoreErrors()}return t}return s}}t.WorkspaceMap=s},6183:e=>{e.exports={i8:"1.1.192"}},1783:e=>{e.exports={}},603:e=>{e.exports=JSON.parse('{"Diagnostic":{"annotatedParamCountMismatch":"Parameter annotation count mismatch: expected {expected} but received {received}","annotatedTypeArgMissing":"Expected one type argument and one or more annotations for \\"Annotated\\"","annotationFormatString":"Type annotations cannot use format string literals (f-strings)","annotationNotSupported":"Type annotation not supported for this type of expression","annotationSpansStrings":"Type annotations cannot span multiple string literals","annotationStringEscape":"Type annotations cannot contain escape characters","argAssignment":"Argument of type \\"{argType}\\" cannot be assigned to parameter of type \\"{paramType}\\"","argAssignmentFunction":"Argument of type \\"{argType}\\" cannot be assigned to parameter of type \\"{paramType}\\" in function \\"{functionName}\\"","argAssignmentParam":"Argument of type \\"{argType}\\" cannot be assigned to parameter \\"{paramName}\\" of type \\"{paramType}\\"","argAssignmentParamFunction":"Argument of type \\"{argType}\\" cannot be assigned to parameter \\"{paramName}\\" of type \\"{paramType}\\" in function \\"{functionName}\\"","argMissingForParam":"Argument missing for parameter {name}","argMissingForParams":"Arguments missing for parameters {names}","argMorePositionalExpectedCount":"Expected {expected} more positional arguments","argMorePositionalExpectedOne":"Expected 1 more positional argument","argPositional":"Expected positional argument","argPositionalExpectedCount":"Expected {expected} positional arguments","argPositionalExpectedOne":"Expected 1 positional argument","argTypePartiallyUnknown":"Argument type is partially unknown","argTypeUnknown":"Argument type is unknown","assertAlwaysTrue":"Assert expression always evaluates to true","assignmentExprContext":"Assignment expression must be within module, function or lambda","assignmentExprComprehension":"Assignment expression target \\"{name}\\" cannot use same name as comprehension for target","assignmentInProtocol":"Instance or class variables within a Protocol class must be explicitly declared within the class body","assignmentTargetExpr":"Expression cannot be assignment target","asyncNotInAsyncFunction":"Use of \\"async\\" not allowed outside of async function","awaitIllegal":"Use of \\"await\\" requires Python 3.5 or newer","awaitNotInAsync":"\\"await\\" allowed only within async function","backticksIllegal":"Expressions surrounded by backticks are not supported in Python 3.x; use repr instead","baseClassCircular":"Class cannot derive from itself","baseClassFinal":"Base class \\"{type}\\" is marked final and cannot be subclassed","baseClassInvalid":"Argument to class must be a base class","baseClassUnknown":"Base class type is unknown, obscuring type of derived class","bindTypeMismatch":"Could not bind method \\"{methodName}\\" because \\"{type}\\" is not assignable to parameter \\"{paramName}\\"","breakOutsideLoop":"\\"break\\" can be used only within a loop","callableExtraArgs":"Expected only two type arguments to \\"Callable\\"","callableFirstArg":"Expected parameter type list or \\"...\\"","callableSecondArg":"Expected return type as second type argument for \\"Callable\\"","casePatternIsIrrefutable":"Irrefutable pattern is allowed only for the last case statement","classDecoratorTypeUnknown":"Untyped class decorator obscures type of class; ignoring decorator","classDefinitionCycle":"Class definition for \\"{name}\\" depends on itself","classGetItemClsParam":"__class_getitem__ override should take a \\"cls\\" parameter","classMethodClsParam":"Class methods should take a \\"cls\\" parameter","classNotRuntimeSubscriptable":"Subscript for class \\"{name}\\" will generate runtime exception; enclose type annotation in quotes","classVarNotAllowed":"\\"ClassVar\\" is not allowed in this context","classVarFirstArgMissing":"Expected a type argument after \\"ClassVar\\"","classVarOverridesInstanceVar":"Class variable \\"{name}\\" overrides instance variable of same name in class \\"{className}\\"","classVarTooManyArgs":"Expected only one type argument after \\"ClassVar\\"","classVarWithTypeVar":"\\"ClassVar\\" type cannot include type variables","clsSelfParamTypeMismatch":"Type of parameter \\"{name}\\" must be a supertype of its class \\"{classType}\\"","comparisonAlwaysFalse":"Condition will always evaluate to False since the types \\"{leftType}\\" and \\"{rightType}\\" have no overlap","comparisonAlwaysTrue":"Condition will always evaluate to True since the types \\"{leftType}\\" and \\"{rightType}\\" have no overlap","comprehensionInDict":"Comprehension cannot be used with other dictionary entries","comprehensionInSet":"Comprehension cannot be used with other set entries","concatenateParamSpecMissing":"Last type argument for \\"Concatenate\\" must be a ParamSpec","concatenateTypeArgsMissing":"\\"Concatenate\\" requires at least two type arguments","constantRedefinition":"\\"{name}\\" is constant (because it is uppercase) and cannot be redefined","continueInFinally":"\\"continue\\" cannot be used within a finally clause","continueOutsideLoop":"\\"continue\\" can be used only within a loop","constructorNoArgs":"Expected no arguments to \\"{type}\\" constructor","dataClassBaseClassNotFrozen":"A frozen class cannot inherit from a class that is not frozen","dataClassFieldWithDefault":"Fields without default values cannot appear after fields with default values","dataClassSlotsOverwrite":"__slots__ is already defined in class","declaredReturnTypePartiallyUnknown":"Declared return type, \\"{returnType}\\", is partially unknown","declaredReturnTypeUnknown":"Declared return type is unknown","defaultValueContainsCall":"Function calls and mutable objects not allowed within parameter default value expression","defaultValueNotAllowed":"Parameter with \\"*\\" or \\"**\\" cannot have default value","defaultValueNotEllipsis":"Default values in stub files should be specified as \\"...\\"","deprecatedType":"This type is deprecated as of Python {version}; use \\"{replacement}\\" instead","delTargetExpr":"Expression cannot be deleted","dictExpandIllegalInComprehension":"Dictionary expansion not allowed in comprehension","dictInAnnotation":"Dictionary expression not allowed in type annotation","dictKeyValuePairs":"Dictionary entries must contain key/value pairs","dictUnpackIsNotMapping":"Expected mapping for dictionary unpack operator","dunderAllSymbolNotPresent":"\\"{name}\\" is specified in __all__ but is not present in module","duplicateArgsParam":"Only one \\"*\\" parameter allowed","duplicateBaseClass":"Duplicate base class not allowed","duplicateCatchAll":"Only one catch-all except clause allowed","duplicateEnumMember":"Enum member \\"{name}\\" is already declared","duplicateImport":"\\"{importName}\\" is imported more than once","duplicateKwargsParam":"Only one \\"**\\" parameter allowed","duplicateKeywordOnly":"Only one \\"*\\" separator allowed","duplicateParam":"Duplicate parameter \\"{name}\\"","duplicateCapturePatternTarget":"Capture target \\"{name}\\" cannot appear more than once within the same pattern","duplicateStarPattern":"Only one \\"*\\" pattern allowed in a pattern sequence","duplicateStarStarPattern":"Only one \\"**\\" entry allowed","duplicatePositionOnly":"Only one \\"/\\" parameter allowed","duplicateUnpack":"Only one unpack operation allowed in list","ellipsisContext":"\\"...\\" not allowed in this context","ellipsisSecondArg":"\\"...\\" allowed only as the second of two arguments","enumClassOverride":"Enum class \\"{name}\\" is final and cannot be subclassed","exceptionTypeIncorrect":"\\"{type}\\" does not derive from BaseException","exceptionTypeNotClass":"\\"{type}\\" is not valid exception class","exceptionTypeNotInstantiable":"Constructor for exception type \\"{type}\\" requires one or more arguments","expectedAfterDecorator":"Expected function or class declaration after decorator","expectedArrow":"Expected \\"->\\" followed by return type annotation","expectedAsAfterException":"Expected \\"as\\" after exception type","expectedAssignRightHandExpr":"Expected expression to the right of \\"=\\"","expectedBinaryRightHandExpr":"Expected expression to the right of operator","expectedBoolLiteral":"Expected True or False","expectedCase":"Expected \\"case\\" statement","expectedClassName":"Expected class name","expectedCloseBrace":"\\"{\\" was not closed","expectedCloseBracket":"\\"[\\" was not closed","expectedCloseParen":"\\"(\\" was not closed","expectedColon":"Expected \\":\\"","expectedComplexNumberLiteral":"Expected complex number literal for pattern matching","expectedDecoratorExpr":"Expression form not supported for decorator prior to Python 3.9","expectedDecoratorName":"Expected decorator name","expectedDecoratorNewline":"Expected new line at end of decorator","expectedDelExpr":"Expected expression after \\"del\\"","expectedElse":"Expected \\"else\\"","expectedExceptionClass":"Invalid exception class or object","expectedExceptionObj":"Expected exception object, exception class or None","expectedExpr":"Expected expression","expectedIdentifier":"Expected identifier","expectedImport":"Expected \\"import\\"","expectedImportAlias":"Expected symbol after \\"as\\"","expectedImportSymbols":"Expected one or more symbol names after import","expectedIndentedBlock":"Expected indented block","expectedInExpr":"Expected expression after \\"in\\"","expectedIn":"Expected \\"in\\"","expectedFunctionAfterAsync":"Expected function definition after \\"async\\"","expectedFunctionName":"Expected function name after \\"def\\"","expectedMemberName":"Expected member name after \\".\\"","expectedModuleName":"Expected module name","expectedNameAfterAs":"Expected symbol name after \\"as\\"","expectedNamedParameter":"Keyword parameter must follow \\"*\\"","expectedNewline":"Expected newline","expectedNewlineOrSemicolon":"Statements must be separated by newlines or semicolons","expectedOpenParen":"Expected \\"(\\"","expectedParamName":"Expected parameter name","expectedPatternExpr":"Expected pattern expression","expectedPatternSubjectExpr":"Expected pattern subject expression","expectedPatternValue":"Expected pattern value expression of the form \\"a.b\\"","expectedReturnExpr":"Expected expression after \\"return\\"","expectedSliceIndex":"Expected index or slice expression","expectedTypeNotString":"Expected type but received a string literal","expectedYieldExpr":"Expected expression in yield statement","finalClassIsAbstract":"Class \\"{type}\\" is marked final and must implement all abstract methods","finalContext":"\\"Final\\" not allowed in this context","finalMethodOverride":"Method \\"{name}\\" cannot override final method defined in class \\"{className}\\"","finalReassigned":"\\"{name}\\" is declared as Final and cannot be reassigned","finalRedeclaration":"\\"{name}\\" was previously declared as Final","finalRedeclarationBySubclass":"\\"{name}\\" cannot be redeclared because parent class \\"{className}\\" declares it as Final","finalTooManyArgs":"Expected a single type argument after \\"Final\\"","finalUnassigned":"\\"{name}\\" is declared Final, but value is not assigned","formatStringBrace":"Single close brace not allowed within f-string literal; use double close brace","formatStringBytes":"Format string literals (f-strings) cannot be binary","formatStringEscape":"Escape sequence (backslash) not allowed in expression portion of f-string","formatStringInPattern":"Format string not allowed in pattern","formatStringUnicode":"Format string literals (f-strings) cannot be unicode","formatStringIllegal":"Format string literals (f-strings) require Python 3.6 or newer","formatStringUnterminated":"Unterminated expression in f-string; missing close brace","functionDecoratorTypeUnknown":"Untyped function decorator obscures type of function; ignoring decorator","generatorAsyncReturnType":"Return type of async generator function must be \\"AsyncGenerator\\" or \\"AsyncIterable\\"","generatorSyncReturnType":"Return type of generator function must be \\"Generator\\" or \\"Iterable\\"","genericClassAssigned":"Generic class type cannot be assigned","genericClassDeleted":"Generic class type cannot be deleted","genericNotAllowed":"\\"Generic\\" is not valid in this context","genericTypeAliasBoundTypeVar":"Generic type alias within class cannot use bound type variables {names}","genericTypeArgMissing":"\\"Generic\\" requires at least one type argument","genericTypeArgTypeVar":"Type argument for \\"Generic\\" must be a type variable","genericTypeArgUnique":"Type arguments for \\"Generic\\" must be unique","globalReassignment":"\\"{name}\\" is assigned before global declaration","globalRedefinition":"\\"{name}\\" was already declared global","implicitStringConcat":"Implicit string concatenation not allowed","importCycleDetected":"Cycle detected in import chain","importDepthExceeded":"Import chain depth exceeded {depth}","importResolveFailure":"Import \\"{importName}\\" could not be resolved","importSourceResolveFailure":"Import \\"{importName}\\" could not be resolved from source","importSymbolUnknown":"\\"{name}\\" is unknown import symbol","incompatibleMethodOverride":"Method \\"{name}\\" overrides class \\"{className}\\" in an incompatible manner","inconsistentIndent":"Unindent amount does not match previous indent","initMustReturnNone":"Return type of \\"__init__\\" must be None","inconsistentTabs":"Inconsistent use of tabs and spaces in indentation","initSubclassClsParam":"__init_subclass__ override should take a \\"cls\\" parameter","instanceMethodSelfParam":"Instance methods should take a \\"self\\" parameter","instanceVarOverridesClassVar":"Instance variable \\"{name}\\" overrides class variable of same name in class \\"{className}\\"","instantiateAbstract":"Cannot instantiate abstract class \\"{type}\\"","instantiateProtocol":"Cannot instantiate protocol class \\"{type}\\"","internalBindError":"An internal error occurred while binding file \\"{file}\\": {message}","internalParseError":"An internal error occurred while parsing file \\"{file}\\": {message}","internalTypeCheckingError":"An internal error occurred while type checking file \\"{file}\\": {message}","invalidIdentifierChar":"Invalid character in identifier","invalidStubStatement":"Statement is meaningless within a type stub file","invalidTokenChars":"Invalid character \\"{text}\\" in token","isInstanceInvalidType":"Second argument to \\"isinstance\\" must be a class or tuple of classes","isSubclassInvalidType":"Second argument to \\"issubclass\\" must be a class or tuple of classes","keyValueInSet":"Key/value pairs are not allowed within a set","keywordArgInTypeArgument":"Keyword arguments cannot be used in type argument lists","keywordOnlyAfterArgs":"Keyword-only argument separator not allowed after \\"*\\" parameter","keywordSubscriptIllegal":"Keyword arguments within subscripts are not supported","lambdaReturnTypeUnknown":"Return type of lambda is unknown","lambdaReturnTypePartiallyUnknown":"Return type of lambda, \\"{returnType}\\", is partially unknown","listInAnnotation":"List expression not allowed in type annotation","literalUnsupportedType":"Type arguments for \\"Literal\\" must be None, a literal value (int, bool, str, or bytes), or an enum value","literalEmptyArgs":"Expected one or more type arguments after \\"Literal\\"","literalNotCallable":"Literal type cannot be instantiated","matchIncompatible":"Match statements require Python 3.10 or newer","memberAccess":"Cannot access member \\"{name}\\" for type \\"{type}\\"","memberDelete":"Cannot delete member \\"{name}\\" for type \\"{type}\\"","memberSet":"Cannot assign member \\"{name}\\" for type \\"{type}\\"","metaclassConflict":"The metaclass of a derived class must be a subclass of the metaclasses of all its base classes","metaclassDuplicate":"Only one metaclass can be provided","methodNotDefined":"\\"{name}\\" method not defined","methodNotDefinedOnType":"\\"{name}\\" method not defined on type \\"{type}\\"","methodOrdering":"Cannot create consistent method ordering","methodOverridden":"\\"{name}\\" overrides method of same name in class \\"{className}\\" with incompatible type \\"{type}\\"","methodReturnsNonObject":"\\"{name}\\" method does not return an object","moduleAsType":"Module cannot be used as a type","moduleUnknownMember":"\\"{name}\\" is not a known member of module","namedExceptAfterCatchAll":"A named except clause cannot appear after catch-all except clause","namedParamAfterParamSpecArgs":"Keyword parameter \\"{name}\\" cannot appear in signature after ParamSpec args parameter","namedTupleEmptyName":"Names within a named tuple cannot be empty","namedTupleMultipleInheritance":"Multiple inheritance with NamedTuple is not supported","namedTupleFirstArg":"Expected named tuple class name as first argument","namedTupleNameType":"Expected two-entry tuple specifying entry name and type","namedTupleNameUnique":"Names within a named tuple must be unique","namedTupleNoTypes":"\\"namedtuple\\" provides no types for tuple entries; use \\"NamedTuple\\" instead","namedTupleSecondArg":"Expected named tuple entry list as second argument","newClsParam":"__new__ override should take a \\"cls\\" parameter","newTypeLiteral":"NewType cannot be used with Literal type","newTypeNotAClass":"Expected class as second argument to NewType","newTypeProtocolClass":"NewType cannot be used with protocol class","nonDefaultAfterDefault":"Non-default argument follows default argument","noneNotCallable":"Object of type \\"None\\" cannot be called","noneNotIterable":"Object of type \\"None\\" cannot be used as iterable value","noneOperator":"Operator \\"{operator}\\" not supported for \\"None\\"","noneNotSubscriptable":"Object of type \\"None\\" is not subscriptable","noneNotUsableWith":"Object of type \\"None\\" cannot be used with \\"with\\"","noneUnknownMember":"\\"{name}\\" is not a known member of \\"None\\"","nonLocalNoBinding":"No binding for nonlocal \\"{name}\\" found","nonLocalReassignment":"\\"{name}\\" is assigned before nonlocal declaration","nonLocalRedefinition":"\\"{name}\\" was already declared nonlocal","nonLocalInModule":"Nonlocal declaration not allowed at module level","noOverload":"No overloads for \\"{name}\\" match the provided arguments","noReturnContainsReturn":"Function with declared return type \\"NoReturn\\" cannot include a return statement","noReturnContainsYield":"Function with declared return type \\"NoReturn\\" cannot include a yield statement","noReturnReturnsNone":"Function with declared type of \\"NoReturn\\" cannot return \\"None\\"","notRequiredArgCount":"Expected a single type argument after \\"NotRequired\\"","notRequiredNotInTypedDict":"\\"NotRequired\\" is allowed only within TypedDict","objectNotCallable":"Object of type \\"{type}\\" is not callable","obscuredClassDeclaration":"Class declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredFunctionDeclaration":"Function declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredMethodDeclaration":"Method declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredParameterDeclaration":"Parameter declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredVariableDeclaration":"Declaration \\"{name}\\" is obscured by a declaration of the same name","operatorLessOrGreaterDeprecated":"Operator \\"<>\\" is not supported in Python 3; use \\"!=\\" instead","optionalExtraArgs":"Expected one type argument after \\"Optional\\"","orPatternIrrefutable":"Irrefutable pattern allowed only as the last subpattern in an \\"or\\" pattern","orPatternMissingName":"All subpatterns within an \\"or\\" pattern must target the same names","overlappingOverload":"Overload {obscured} for \\"{name}\\" will never be used because its parameters overlap overload {obscuredBy}","overloadAbstractMismatch":"Overloaded methods must all be abstract or not","overloadImplementationMismatch":"Overloaded function implementation is not consistent with signature of overload {index}","overloadReturnTypeMismatch":"Overload {prevIndex} for \\"{name}\\" overlaps overload {newIndex} and returns an incompatible type","overloadWithImplementation":"\\"{name}\\" is marked as overload, but it includes an implementation","overloadWithoutImplementation":"\\"{name}\\" is marked as overload, but no implementation is provided","paramAfterKwargsParam":"Parameter cannot follow \\"**\\" parameter","paramAlreadyAssigned":"Parameter \\"{name}\\" is already assigned","paramAnnotationMissing":"Type annotation is missing for parameter \\"{name}\\"","paramNameMissing":"No parameter named \\"{name}\\"","paramSpecArgsKwargsUsage":"\\"args\\" and \\"kwargs\\" members of ParamSpec must both appear within a function signature","paramSpecArgsUsage":"\\"args\\" member of ParamSpec is valid only when used with *args parameter","paramSpecAssignedName":"ParamSpec must be assigned to a variable named \\"{name}\\"","paramSpecContext":"ParamSpec not allowed in this context","paramSpecFirstArg":"Expected name of ParamSpec as first argument","paramSpecKwargsUsage":"\\"kwargs\\" member of ParamSpec is valid only when used with **kwargs parameter","paramSpecNotBound":"Param spec \\"{type}\\" has no bound value","paramSpecNotUsedByOuterScope":"ParamSpec \\"{name}\\" has no meaning in this context","paramSpecUnknownArg":"ParamSpec does not support more than one argument","paramSpecUnknownMember":"\\"{name}\\" is not a known member of ParamSpec","paramSpecUnknownParam":"\\"{name}\\" is unknown parameter to ParamSpec","paramAssignmentMismatch":"Expression of type \\"{sourceType}\\" cannot be assigned to parameter of type \\"{paramType}\\"","paramTypeCovariant":"Covariant type variable cannot be used in parameter type","paramTypeUnknown":"Type of parameter \\"{paramName}\\" is unknown","paramTypePartiallyUnknown":"Type of parameter \\"{paramName}\\" is partially unknown","parenthesizedContextManagerIllegal":"Parentheses within \\"with\\" statement requires Python 3.9 or newer","positionArgAfterNamedArg":"Positional argument cannot appear after keyword arguments","privateImportFromPyTypedModule":"\\"{name}\\" is not exported from module \\"{module}\\"","positionOnlyAfterArgs":"Position-only argument separator not allowed after \\"*\\" parameter","positionOnlyAfterKeywordOnly":"\\"/\\" parameter must appear before \\"*\\" parameter","positionOnlyIncompatible":"Position-only argument separator requires Python 3.8 or newer","positionOnlyFirstParam":"Position-only argument separator not allowed as first parameter","privateUsedOutsideOfClass":"\\"{name}\\" is private and used outside of the class in which it is declared","privateUsedOutsideOfModule":"\\"{name}\\" is private and used outside of the module in which it is declared","propertyOverridden":"\\"{name}\\" incorrectly overrides property of same name in class \\"{className}\\"","propertyStaticMethod":"Static methods not allowed for property getter, setter or deleter","protectedUsedOutsideOfClass":"\\"{name}\\" is protected and used outside of the class in which it is declared","protocolBaseClass":"Protocol class \\"{classType}\\" cannot derive from non-protocol class \\"{baseType}\\"","protocolIllegal":"Use of \\"Protocol\\" requires Python 3.7 or newer","protocolNotAllowedInTypeArgument":"\\"Protocol\\" cannot be used as a type argument","protocolVarianceContravariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be contravariant","protocolVarianceCovariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be covariant","protocolVarianceInvariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be invariant","protocolUsedInCall":"Protocol class cannot be used in \\"{name}\\" call","relativeImportNotAllowed":"Relative imports cannot be used with \\"import .a\\" form; use \\"from . import a\\" instead","recursiveDefinition":"Type of \\"{name}\\" could not be determined because it refers to itself","requiredArgCount":"Expected a single type argument after \\"Required\\"","requiredNotInTypedDict":"\\"Required\\" is allowed only within TypedDict","returnOutsideFunction":"\\"return\\" can be used only within a function","returnMissing":"Function with declared type of \\"{returnType}\\" must return value","returnTypeContravariant":"Contravariant type variable cannot be used in return type","returnTypeMismatch":"Expression of type \\"{exprType}\\" cannot be assigned to return type \\"{returnType}\\"","returnTypeUnknown":"Return type is unknown","returnTypePartiallyUnknown":"Return type, \\"{returnType}\\", is partially unknown","revealLocalsArgs":"Expected no arguments for \\"reveal_locals\\" call","revealLocalsNone":"No locals in this scope","revealTypeArgs":"Expected a single positional argument for \\"reveal_type\\" call","selfTypeContext":"\\"Self\\" is not valid in this context","selfTypeWithTypedSelfOrCls":"\\"Self\\" cannot be used in a function with a `self` or `cls` parameter that has a type annotation other than \\"Self\\"","setterGetterTypeMismatch":"Property setter value type is not assignable to the getter return type","singleOverload":"\\"{name}\\" is marked as overload, but additional overloads are missing","slotsAttributeError":"\\"{name}\\" is not specified in __slots__","slotsClassVarConflict":"\\"{name}\\" conflicts with instance variable declared in __slots__","starPatternInAsPattern":"Star pattern cannot be used with \\"as\\" target","starPatternInOrPattern":"Star pattern cannot be ORed within other patterns","starStarWildcardNotAllowed":"** cannot be used with wildcard \\"_\\"","staticClsSelfParam":"Static methods should not take a \\"self\\" or \\"cls\\" parameter","stringNonAsciiBytes":"Non-ASCII character not allowed in bytes string literal","stringNotSubscriptable":"String expression cannot be subscripted in type annotation; enclose entire annotation in quotes","stringUnsupportedEscape":"Unsupported escape sequence in string literal","stringUnterminated":"String literal is unterminated","stubFileMissing":"Stub file not found for \\"{importName}\\"","stubUsesGetAttr":"Type stub file is incomplete; \\"__getattr__\\" obscures type errors for module","sublistParamsIncompatible":"Sublist parameters are not supported in Python 3.x","superCallArgCount":"Expected no more than two arguments to \\"super\\" call","superCallFirstArg":"Expected class type as first argument to \\"super\\" call but received \\"{type}\\"","superCallSecondArg":"Second argument to \\"super\\" call must be object or class that derives from \\"{type}\\"","superCallZeroArgForm":"Zero-argument form of \\"super\\" call is valid only within a class","symbolIsUnbound":"\\"{name}\\" is unbound","symbolIsUndefined":"\\"{name}\\" is not defined","symbolIsPossiblyUnbound":"\\"{name}\\" is possibly unbound","symbolOverridden":"\\"{name}\\" overrides symbol of same name in class \\"{className}\\"","trailingCommaInFromImport":"Trailing comma not allowed without surrounding parentheses","tryWithoutExcept":"Try statement must have at least one except or finally clause","tupleAssignmentMismatch":"Expression with type \\"{type}\\" cannot be assigned to target tuple","tupleInAnnotation":"Tuple expression not allowed in type annotation","tupleIndexOutOfRange":"Index {index} is out of range for tuple with length {length}","typeAliasIsRecursiveDirect":"Type alias \\"{name}\\" cannot use itself in its definition","typeAliasIsRecursiveIndirect":"Type alias \\"{name}\\" cannot refer to itself indirectly in its definition","typeAliasNotInModuleOrClass":"A TypeAlias can be defined only within a module or class scope","typeAliasRedeclared":"\\"{name}\\" is declared as a TypeAlias and can be assigned only once","typeArgListNotAllowed":"List expression not allowed for this type argument","typeAnnotationCall":"Illegal type annotation: call expression not allowed","typeAnnotationVariable":"Illegal type annotation: variable not allowed unless it is a type alias","typeArgsExpectingNone":"Expected no type arguments for class \\"{name}\\"","typeArgsMismatchOne":"Expected one type argument but received {received}","typeArgsMissingForAlias":"Expected type arguments for generic type alias \\"{name}\\"","typeArgsMissingForClass":"Expected type arguments for generic class \\"{name}\\"","typeArgsTooFew":"Too few type arguments provided for \\"{name}\\"; expected {expected} but received {received}","typeArgsTooMany":"Too many type arguments provided for \\"{name}\\"; expected {expected} but received {received}","typeAssignmentMismatch":"Expression of type \\"{sourceType}\\" cannot be assigned to declared type \\"{destType}\\"","typeCallNotAllowed":"type() call should not be used in type annotation","typedDictAccess":"Could not access item in TypedDict","typedDictBadVar":"TypedDict classes can contain only type annotations","typedDictBaseClass":"All base classes for \\"TypedDict\\" classes must also be \\"TypedDict\\" classes","typedDictDelete":"Could not delete item in TypedDict","typedDictEmptyName":"Names within a TypedDict cannot be empty","typedDictEntryName":"Expected string literal for dictionary entry name","typedDictEntryUnique":"Names within a dictionary must be unique","typedDictExtraArgs":"Extra TypedDict arguments not supported","typedDictFieldRedefinition":"Type of TypedDict field \\"{name}\\" cannot be redefined","typedDictFirstArg":"Expected TypedDict class name as first argument","typedDictSecondArgDict":"Expected dict or keyword parameter as second parameter","typedDictSecondArgDictEntry":"Expected simple dictionary entry","typedDictSet":"Could not assign item in TypedDict","typedDictTotalParam":"Expected \\"total\\" parameter to have a value of True or False","typeExpectedClass":"Expected class type but received \\"{type}\\"","typeGuardArgCount":"Expected a single type argument after \\"TypeGuard\\"","typeNotAwaitable":"\\"{type}\\" is not awaitable","typeNotCallable":"\\"{expression}\\" has type \\"{type}\\" and is not callable","typeNotIntantiable":"\\"{type}\\" cannot be instantiated","typeNotIterable":"\\"{type}\\" is not iterable","typeNotSpecializable":"Could not specialize type \\"{type}\\"","typeNotSubscriptable":"Object of type \\"{type}\\" is not subscriptable","typeNotUsableWith":"Object of type \\"{type}\\" cannot be used with \\"with\\" because it does not implement {method}","typeNotSupportBinaryOperator":"Operator \\"{operator}\\" not supported for types \\"{leftType}\\" and \\"{rightType}\\"","typeNotSupportUnaryOperator":"Operator \\"{operator}\\" not supported for type \\"{type}\\"","typePartiallyUnknown":"Type of \\"{name}\\" is partially unknown","typeUnknown":"Type of \\"{name}\\" is unknown","typeVarAssignedName":"TypeVar must be assigned to a variable named \\"{name}\\"","typeVarAssignmentMismatch":"Type \\"{type}\\" cannot be assigned to type variable \\"{name}\\"","typeVarBoundAndConstrained":"TypeVar cannot be both bound and constrained","typeVarFirstArg":"Expected name of TypeVar as first argument","typeVarGeneric":"TypeVar bound type cannot be generic","typeVarNoMember":"TypeVar \\"{type}\\" has no member \\"{name}\\"","typeVarNotSubscriptable":"TypeVar \\"{type}\\" is not subscriptable","typeVarNotUsedByOuterScope":"Type variable \\"{name}\\" has no meaning in this context","typeVarSingleConstraint":"TypeVar cannot have only a single constraint","typeVarsNotInGeneric":"Generic[] must include all type variables","typeVarTupleContext":"TypeVarTuple not allowed in this context","typeVarUnknownParam":"\\"{name}\\" is unknown parameter to TypeVar","typeVarUsedByOuterScope":"TypeVar \\"{name}\\" is already in use by an outer scope","typeVarUsedOnlyOnce":"TypeVar \\"{name}\\" appears only once in generic function signature","typeVarVariance":"TypeVar cannot be both covariant and contravariant","unaccessedClass":"Class \\"{name}\\" is not accessed","unaccessedFunction":"Function \\"{name}\\" is not accessed","unaccessedImport":"Import \\"{name}\\" is not accessed","unaccessedSymbol":"\\"{name}\\" is not accessed","unaccessedVariable":"Variable \\"{name}\\" is not accessed","unexpectedAsyncToken":"Expected \\"def\\", \\"with\\" or \\"for\\" to follow \\"async\\"","unexpectedExprToken":"Unexpected token at end of expression","unexpectedIndent":"Unexpected indentation","unexpectedUnindent":"Unindent not expected","unionSyntaxIllegal":"Alternative syntax for unions requires Python 3.10 or newer","unionTypeArgCount":"Union requires two or more type arguments","uninitializedInstanceVariable":"Instance variable \\"{name}\\" is not initialized in the class body or __init__ method","unnecessaryCast":"Unnecessary \\"cast\\" call; type is already \\"{type}\\"","unnecessaryIsInstanceAlways":"Unnecessary isinstance call; \\"{testType}\\" is always an instance of \\"{classType}\\"","unnecessaryIsSubclassAlways":"Unnecessary issubclass call; \\"{testType}\\" is always a subclass of \\"{classType}\\"","unpackArgCount":"Expected a single type argument after \\"Unpack\\"","unpackedArgInTypeArgument":"Unpacked arguments cannot be used in type argument lists","unpackedArgWithVariadicParam":"Unpacked argument cannot be used for TupleTypeVar parameter","unpackedDictArgumentNotMapping":"Argument expression after ** must be a mapping with a \\"str\\" key type","unpackedSubscriptIllegal":"Unpack operator in subscript is not supported","unpackedTypedDictArgument":"Unable to match unpacked TypedDict argument to parameters","unpackedTypeVarTupleExpected":"Expected unpacked TypeVarTuple; use Unpack[{name1}] or *{name2}","unpackExpectedTypeVarTuple":"Expected TypeVarTuple as type argument for Unpack","unpackIllegalInComprehension":"Unpack operation not allowed in comprehension","unpackInDict":"Unpack operation not allowed in dictionaries","unpackInSet":"Unpack operator not allowed within a set","unpackNotAllowed":"Unpack operation not allowed in this context","unpackTuplesIllegal":"Unpack operation not allowed in tuples prior to Python 3.8","unreachableCode":"Code is unreachable","unsupportedDunderAllOperation":"Operation on \\"__all__\\" is not supported, so exported symbol list may be incorrect","unusedCallResult":"Result of call expression is of type \\"{type}\\" and is not used; assign to variable \\"_\\" if this is intentional","unusedCoroutine":"Result of async function call is not used; use \\"await\\" or assign result to variable","varAnnotationIllegal":"Type annotations for variables requires Python 3.6 or newer; use type comment for compatibility with previous versions","variadicTypeArgsTooMany":"Type argument list can have at most one unpacked TypeVarTuple","variadicTypeParamTooManyAlias":"Type alias can have at most one TypeVarTuple type parameter but received multiple ({names})","variadicTypeParamTooManyClass":"Generic class can have at most one TypeVarTuple type parameter but received multiple ({names})","walrusIllegal":"Operator \\":=\\" requires Python 3.8 or newer","walrusNotAllowed":"Operator \\":=\\" not allowed in this context","wildcardInFunction":"Wildcard import not allowed within a class or function","wildcardLibraryImport":"Wildcard import from a library not allowed","yieldFromIllegal":"Use of \\"yield from\\" requires Python 3.3 or newer","yieldFromOutsideAsync":"\\"yield from\\" not allowed in an async function","yieldOutsideFunction":"\\"yield\\" not allowed outside of a function or lambda","yieldTypeMismatch":"Expression of type \\"{exprType}\\" cannot be assigned to yield type \\"{yieldType}\\"","yieldWithinListCompr":"\\"yield\\" not allowed inside a list comprehension","zeroCaseStatementsFound":"Match statement must include at least one case statement","zeroLengthTupleNotAllowed":"Zero-length tuple not allowed in this context"},"DiagnosticAddendum":{"argParam":"Argument corresponds to parameter \\"{paramName}\\"","argParamFunction":"Argument corresponds to parameter \\"{paramName}\\" in function \\"{functionName}\\"","argsParamMissing":"Parameter \\"*{paramName}\\" has no corresponding parameter","argsParamWithVariadic":"Parameter \\"*{paramName}\\" is incompatible with TypeVarTuple","argsPositionOnly":"Position-only parameter mismatch; expected {expected} but received {received}","argumentType":"Argument type is \\"{type}\\"","argumentTypes":"Argument types: ({types})","assignToNone":"Type cannot be assigned to type \\"None\\"","asyncHelp":"Did you mean \\"async with\\"?","classPatternTypeAlias":"\\"{type}\\" cannot be used in a class pattern because it is a specialized type alias","dataclassFrozen":"\\"{name}\\" is frozen","finalMethod":"Final method","keyNotRequired":"\\"{name}\\" is not a required key in \\"{type}\\", so access may result in runtime exception","keyRequiredDeleted":"\\"{name}\\" is a required key and cannot be deleted","keyUndefined":"\\"{name}\\" is not a defined key in \\"{type}\\"","functionParamDefaultMissing":"Parameter \\"{name}\\" is missing default argument","functionParamName":"Parameter name mismatch: \\"{destName}\\" versus \\"{srcName}\\"","functionReturnTypeMismatch":"Function return type \\"{sourceType}\\" is incompatible with type \\"{destType}\\"","functionTooFewParams":"Function accepts too few positional parameters; expected {expected} but received {received}","functionTooManyParams":"Function accepts too many positional parameters; expected {expected} but received {received}","incompatibleGetter":"Property getter method is incompatible","incompatibleSetter":"Property setter method is incompatible","incompatibleDeleter":"Property deleter method is incompatible","kwargsParamMissing":"Parameter \\"**{paramName}\\" has no corresponding parameter","literalAssignmentMismatch":"\\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","memberSetClassVar":"Member \\"{name}\\" cannot be assigned through a class instance because it is a ClassVar","memberAssignment":"Expression of type \\"{type}\\" cannot be assigned to member \\"{name}\\" of class \\"{classType}\\"","memberIsAbstract":"\\"{type}.{name}\\" is abstract","memberIsAbstractMore":"and {count} more...","memberIsFinalInProtocol":"\\"{name}\\" is marked Final in protocol","memberIsInitVar":"Member \\"{name}\\" is an init-only field","memberIsNotFinalInProtocol":"\\"{name}\\" is not marked Final in protocol","memberTypeMismatch":"\\"{name}\\" is an incompatible type","memberUnknown":"Member \\"{name}\\" is unknown","missingGetter":"Property getter method is missing","missingSetter":"Property setter method is missing","missingDeleter":"Property deleter method is missing","namedParamMissingInDest":"Keyword parameter \\"{name}\\" is missing in destination","namedParamMissingInSource":"Keyword parameter \\"{name}\\" is missing in source","namedParamTypeMismatch":"Keyword parameter \\"{name}\\" of type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","noOverloadAssignable":"No overloaded function matches type \\"{type}\\"","orPatternMissingName":"Missing names: {name}","overloadMethod":"Overload method is defined here","overloadNotAssignable":"One or more overloads of \\"{name}\\" is not assignable","overloadWithImplementation":"The body of a function overload should be \\"...\\"","overriddenMethod":"Overridden method","overriddenSymbol":"Overridden symbol","overrideParamCount":"Parameter count mismatch; base method has {baseCount}, but override has {overrideCount}","overrideParamName":"Parameter {index} name mismatch: base parameter is named \\"{baseName}\\", override parameter is named \\"{overrideName}\\"","overrideParamType":"Parameter {index} type mismatch: base parameter is type \\"{baseType}\\", override parameter is type \\"{overrideType}\\"","overrideReturnType":"Return type mismatch: base method returns type \\"{baseType}\\", override returns type \\"{overrideType}\\"","overrideType":"Base class defines type as \\"{type}\\"","paramAssignment":"Parameter {index}: type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","paramSpecOverload":"ParamSpec cannot be used with overloaded function","paramType":"Parameter type is \\"{paramType}\\"","privateImportFromPyTypedSource":"Import from \\"{module}\\" instead","propertyAccessFromProtocolClass":"A property defined within a protocol class cannot be accessed as a class variable","propertyMethodIncompatible":"Property method \\"{name}\\" is incompatible","propertyMethodMissing":"Property method \\"{name}\\" is missing in override","propertyMissingDeleter":"Property \\"{name}\\" has no defined deleter","propertyMissingSetter":"Property \\"{name}\\" has no defined setter","protocolIncompatible":"\\"{sourceType}\\" is incompatible with protocol \\"{destType}\\"","protocolMemberMissing":"\\"{name}\\" is not present","protocolMemberClassVar":"\\"{name}\\" is not a class variable","readOnlyAttribute":"Attribute \\"{name}\\" is read-only","seeDeclaration":"See declaration","seeClassDeclaration":"See class declaration","seeFunctionDeclaration":"See function declaration","seeMethodDeclaration":"See method declaration","seeParameterDeclaration":"See parameter declaration","seeVariableDeclaration":"See variable declaration","tupleEntryTypeMismatch":"Tuple entry {entry} is incorrect type","tupleAssignmentMismatch":"Type \\"{type}\\" is incompatible with target tuple","tupleSizeMismatch":"Tuple size mismatch; expected {expected} but received {received}","tupleSizeMismatchIndeterminate":"Tuple size mismatch; expected {expected} but received indeterminate number","typeAssignmentMismatch":"Type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","typeBound":"Type \\"{sourceType}\\" is incompatible with bound type \\"{destType}\\" for type variable \\"{name}\\"","typeConstrainedTypeVar":"Type \\"{type}\\" is incompatible with constrained type variable \\"{name}\\"","typedDictFieldMissing":"\\"{name}\\" is missing from \\"{type}\\"","typedDictFieldNotRequired":"\\"{name}\\" is not required in \\"{type}\\"","typedDictFieldRequired":"\\"{name}\\" is required in \\"{type}\\"","typedDictFieldTypeMismatch":"Type \\"{type}\\" is not assignable to field \\"{name}\\"","typedDictFieldRedefinition":"Type in parent class is \\"{parentType}\\" and type in child class is \\"{childType}\\"","typedDictFieldUndefined":"\\"{name}\\" is an undefined field in type \\"{type}\\"","typedDictFinalMismatch":"\\"{sourceType}\\" is incompatible with \\"{destType}\\" because of a @final mismatch","typeIncompatible":"\\"{sourceType}\\" is incompatible with \\"{destType}\\"","typeNotCallable":"Type \\"{type}\\" is not callable","typeNotClass":"\\"{type}\\" is not a class","typeParamSpec":"Type \\"{type}\\" is incompatible with ParamSpec \\"{name}\\"","typeNotStringLiteral":"\\"{type}\\" is not a string literal","typeOfSymbol":"Type of \\"{name}\\" is \\"{type}\\"","typeUnsupported":"Type \\"{type}\\" is unsupported","typeVarIsContravariant":"TypeVar \\"{name}\\" is contravariant","typeVarIsCovariant":"TypeVar \\"{name}\\" is covariant","typeVarIsInvariant":"TypeVar \\"{name}\\" is invariant","typeVarNotAllowed":"TypeVar or generic type with type arguments not allowed","typeVarsMissing":"Missing type variables: {names}","typeVarTupleRequiresKnownLength":"TypeVarTuple cannot be bound to a tuple of unknown length","useDictInstead":"Use Dict[T1, T2] to indicate a dictionary type","useListInstead":"Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type","useTupleInstead":"Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type","useTypeInstead":"Use Type[T] instead"},"CodeAction":{"addOptionalToAnnotation":"Add \\"Optional\\" to Type Annotation","createTypeStub":"Create Type Stub","createTypeStubFor":"Create Type Stub For \\"{moduleName}\\"","executingCommand":"Executing command","filesToAnalyzeOne":"1 file to analyze","filesToAnalyzeCount":"{count} files to analyze","findingReferences":"Finding references","organizeImports":"Organize Imports"},"Refactoring":{"moveFile":"Do you want to update all import references for \\"{oldModuleName}\\" to \\"{newModuleName}\\"?","moveFileLabel":"Update all import references for \\"{oldModuleName}\\" to \\"{newModuleName}\\"?","moveFileDescription":"Update all import references for \\"{oldModuleName}\\" to \\"{newModuleName}\\"?"}}')},1859:e=>{e.exports={}},3409:e=>{e.exports={}},6687:e=>{e.exports={}},5491:e=>{e.exports={}},3559:e=>{e.exports={}},1308:e=>{e.exports={}}};
2 //# sourceMappingURL=pyright-internal.js.map