diff --git a/.env b/.env index e10a70f1c..f60921e48 100644 --- a/.env +++ b/.env @@ -1,3 +1,6 @@ VITE_VERSION=$npm_package_version VITE_NAME=$npm_package_name VITE_FULL_URL=/ +VITE_SANITY_PROJECT=ajwvhvgo +VITE_SANITY_DATASET=apps +VITE_SANITY_PREVIEW_DATASET=apps-preview \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0468d4d9c..5f5797c28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -27,9 +27,9 @@ jobs: steps: # Note: This workflow disables deployment steps and micro:bit branding installation on forks. - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Configure node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: 20.x cache: "npm" @@ -37,7 +37,7 @@ jobs: - run: npm ci env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: npm install --no-save @microbit-foundation/python-editor-v3-microbit@0.2.0-dev.37 @microbit-foundation/website-deploy-aws@0.6.0 @microbit-foundation/website-deploy-aws-config@0.9.0 @microbit-foundation/circleci-npm-package-versioner@1 + - run: npm install --no-save @microbit-foundation/python-editor-v3-microbit@0.2.0-dev.43 @microbit-foundation/website-deploy-aws@0.6.0 @microbit-foundation/website-deploy-aws-config@0.9.0 @microbit-foundation/circleci-npm-package-versioner@1 if: github.repository_owner == 'microbit-foundation' env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/bin/update-translations.sh b/bin/update-translations.sh index b38aee490..c2bbfc4ac 100755 --- a/bin/update-translations.sh +++ b/bin/update-translations.sh @@ -15,7 +15,7 @@ if [ $# -eq 0 ]; then exit 1 fi -languages="ca de fr es-ES ja ko nl zh-CN zh-TW" +languages="ca de fr es-ES ja ko nl zh-CN zh-TW lol" mkdir -p crowdin/translated for language in $languages; do diff --git a/docs/tech-overview.md b/docs/tech-overview.md index d253c2bbe..3c58e556c 100644 --- a/docs/tech-overview.md +++ b/docs/tech-overview.md @@ -32,7 +32,11 @@ To produce the correct data format to flash a micro:bit, we use the Foundation's ## The sidebar and educational content -The Reference and Ideas sidebar tabs show educational content that is managed in the Micro:bit Educational Foundation's content management system (CMS). The content is currently sourced live from the CMS. For non-localhost deploys this will require CORS configuration on our end. Please open an issue to discuss this. +The Reference and Ideas sidebar tabs show educational content that is managed in the Micro:bit Educational Foundation's content management system (Sanity CMS). This content is not Open Source. The content is sourced live from the CMS APIs. It will work for local development but non-Foundation deployments will see CORS errors. + +You can substitute your own content by setting `VITE_SANITY_PROJECT` and `VITE_SANITY_DATASET` environment variables, overriding the defaults in `.env`. The schemas we use for Sanity CMS are [packaged as a plugin in this GitHub project](https://github.com/microbit-foundation/sanity-plugin-python-editor-v3/). + +We also plan to explore adding Markdown documentation support as an alternative to Sanity CMS. You can follow the discussion on [#1160](https://github.com/microbit-foundation/python-editor-v3/issues/1160). The API tab shows detailed documentation of the MicroPython API for users who need more detail than the curated content in the Reference tab provides. The API tab content is generated at runtime from the bundled type stubs for MicroPython. We do this using an enhancement to the Foundation's fork of Pyright. For more details see [Python code intelligence](#python-code-intelligence). diff --git a/index.html b/index.html index 149dbcbe5..9037b7050 100644 --- a/index.html +++ b/index.html @@ -35,6 +35,17 @@ window.dataLayer.push(arguments); }; + <% } %> diff --git a/lang/ui.ca.json b/lang/ui.ca.json index f0079db42..883b8e86a 100644 --- a/lang/ui.ca.json +++ b/lang/ui.ca.json @@ -742,6 +742,14 @@ "defaultMessage": "Canviar mòduls de tercers pot significar que no funcionin com s'havia previst.", "description": "Checkbox setting label" }, + "setting-warn-on-v2-only-features": { + "defaultMessage": "Show warnings about V2-only features", + "description": "Checkbox setting label" + }, + "setting-warn-on-v2-only-features-info": { + "defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected", + "description": "Checkbox setting label" + }, "settings": { "defaultMessage": "Configuració", "description": "Settings text" @@ -1110,6 +1118,10 @@ "defaultMessage": "visita microbit.org (s'obre en una pestanya nova)", "description": "alt text for logo link to .org" }, + "warn-on-v2-only-features-action": { + "defaultMessage": "Disable warnings about V2-only features", + "description": "Label for editor action" + }, "webusb-error-clear-connect-description-1": { "defaultMessage": "Un altre procés està connectat a aquest dispositiu.", "description": "Part of WebUSB error message" @@ -1130,14 +1142,6 @@ "defaultMessage": "Torna a connectar la teva micro:bit i torna-ho a provar.", "description": "Part of WebUSB error message" }, - "webusb-error-update-req-description": { - "defaultMessage": "Has d'actualitzar el microprogramari de la teva micro:bit per fer ús d'aquesta característica.", - "description": "WebUSB error telling user to update firmware" - }, - "webusb-error-update-req-title": { - "defaultMessage": "Actualitza el microprogramari de la micro:bit ", - "description": "Error text telling user to update firmware" - }, "webusb-not-supported": { "defaultMessage": "Malauradament, WebUSB no és compatible amb aquest navegador i el teu programa es desarà al teu ordinador. Segueix els passos de la pantalla següent per transferir-lo ala teva micro:bit. Et recomanem Google Chrome o Microsoft Edge perquè et puguis connectar directament a la teva micro:bit.", "description": "Explantion shown when user's browser doesn't support WebUSB" @@ -1158,6 +1162,10 @@ "defaultMessage": "Benvingut a l'Editor Python de la micro:bit", "description": "Title for the welcome dialog" }, + "welcome-video-alt": { + "defaultMessage": "video introducing the Python Editor", + "description": "iframe title for the welcome video" + }, "zoom-in-action": { "defaultMessage": "Amplia", "description": "Text label for zoom in button" diff --git a/lang/ui.de.json b/lang/ui.de.json index 540f14631..d3650bc9b 100644 --- a/lang/ui.de.json +++ b/lang/ui.de.json @@ -742,6 +742,14 @@ "defaultMessage": "Wenn du Module von Drittanbietern änderst, kann es sein, dass sie nicht mehr wie vorgesehen funktionieren.", "description": "Checkbox setting label" }, + "setting-warn-on-v2-only-features": { + "defaultMessage": "Show warnings about V2-only features", + "description": "Checkbox setting label" + }, + "setting-warn-on-v2-only-features-info": { + "defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected", + "description": "Checkbox setting label" + }, "settings": { "defaultMessage": "Einstellungen", "description": "Settings text" @@ -1110,6 +1118,10 @@ "defaultMessage": "besuche microbit.org (öffnet in neuen Tab)", "description": "alt text for logo link to .org" }, + "warn-on-v2-only-features-action": { + "defaultMessage": "Disable warnings about V2-only features", + "description": "Label for editor action" + }, "webusb-error-clear-connect-description-1": { "defaultMessage": "Ein anderer Prozess ist mit diesem Gerät verbunden.", "description": "Part of WebUSB error message" @@ -1130,14 +1142,6 @@ "defaultMessage": "Bitte schließe deinen micro:bit erneut an und versuche es nochmal.", "description": "Part of WebUSB error message" }, - "webusb-error-update-req-description": { - "defaultMessage": "Um diese Funktion nutzen zu können, musst du deine micro:bit Firmware aktualisieren .", - "description": "WebUSB error telling user to update firmware" - }, - "webusb-error-update-req-title": { - "defaultMessage": "Bitte aktualisiere die micro:bit Firmware", - "description": "Error text telling user to update firmware" - }, "webusb-not-supported": { "defaultMessage": "Leider wird WebUSB in diesem Browser nicht unterstützt und dein Programm wird stattdessen auf deinem Computer gespeichert. Folge den Schritten auf dem nächsten Bildschirm, um es auf deinen micro:bit zu übertragen. Wir empfehlen Google Chrome oder Microsoft Edge, damit du dich direkt mit deinem micro:bit verbinden kannst.", "description": "Explantion shown when user's browser doesn't support WebUSB" @@ -1158,6 +1162,10 @@ "defaultMessage": "Willkommen zum micro:bit Python-Editor", "description": "Title for the welcome dialog" }, + "welcome-video-alt": { + "defaultMessage": "video introducing the Python Editor", + "description": "iframe title for the welcome video" + }, "zoom-in-action": { "defaultMessage": "Vergrößern", "description": "Text label for zoom in button" diff --git a/lang/ui.en.json b/lang/ui.en.json index 88b44ba07..c863be945 100644 --- a/lang/ui.en.json +++ b/lang/ui.en.json @@ -743,6 +743,14 @@ "defaultMessage": "Changing third-party modules may mean they don’t work as intended.", "description": "Checkbox setting label" }, + "setting-warn-on-v2-only-features": { + "defaultMessage": "Show warnings about V2-only features", + "description": "Checkbox setting label" + }, + "setting-warn-on-v2-only-features-info": { + "defaultMessage": "Warnings are shown in the editor when a micro:bit V1 is connected", + "description": "Checkbox setting label" + }, "settings": { "defaultMessage": "Settings", "description": "Settings text" @@ -1111,6 +1119,10 @@ "defaultMessage": "visit microbit.org (opens in a new tab)", "description": "alt text for logo link to .org" }, + "warn-on-v2-only-features-action": { + "defaultMessage": "Disable warnings about V2-only features", + "description": "Label for editor action" + }, "webusb-error-clear-connect-description-1": { "defaultMessage": "Another process is connected to this device.", "description": "Part of WebUSB error message" @@ -1120,7 +1132,7 @@ "description": "Part of WebUSB error message" }, "webusb-error-clear-connect-title": { - "defaultMessage": "Unable to claim interface", + "defaultMessage": "Another page or browser tab is connected to this micro:bit", "description": "Title of error for WebUsb connection" }, "webusb-error-default-title": { @@ -1128,17 +1140,9 @@ "description": "Default title for error messages relating to WebUSB" }, "webusb-error-reconnect-microbit-description": { - "defaultMessage": "Please reconnect your micro:bit and try again.", + "defaultMessage": "
Please follow these steps, then try again:
>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===a&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,c[u++]=255&t),1===a&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,i=e.length,r=i%3,s=[],o=16383,a=0,l=i-r;a {const t=l.get(e);return 0===t.category&&!t.hasDefault})),t.length>0&&!o.paramSpec){const n=t.map((e=>`"${e}"`)).join(", ");_e(qt(e).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,1===t.length?ml.Diagnostic.argMissingForParam().format({name:n}):ml.Diagnostic.argMissingForParams().format({names:n}),e),a=!0}}return!a}(e,t.paramSpecArgList,t.paramSpecTarget,n,l)||(a=!0));const u=Un(r,t.argParams);let p=!0,d=e;for(;;){const e=Pr(d);if(!e)break;const t=Pe(e);n.hasSolveForScope(t)&&(p=!1),d=e}(Eo(u)||ko(u))&&(p=!1);let h=Zo(fa(u,n,!1,!1,p),l);return xo(h)&&(h=Zs.cloneForUnpacked(h,!1)),vo(h)&&Zs.isBuiltIn(h,["TypeGuard","StrictTypeGuard"])&&h.typeArguments&&h.typeArguments.length>0&&b&&_o(b)&&(h=Zs.cloneAsInstance(Zs.cloneForTypeGuard(b,h.typeArguments[0],Zs.isBuiltIn(h,"StrictTypeGuard")))),Eo(h)&&!h.details.name&&(h.details={...h.details,typeVarScopeId:$s}),s&&(s=fa(s,n)),{argumentErrors:a,returnType:h,isTypeIncomplete:o,activeParam:t.activeParam,specializedInitSelfType:s}}function rt(e,t,n,i,r=!1,s){const o=tt(e,t,n,0);return o.argumentErrors?(d.isUndoTrackingEnabled()||t.forEach((e=>{e.valueExpression&&!c.isSpeculative(e.valueExpression)&&$(e.valueExpression)})),{argumentErrors:!0,activeParam:o.activeParam}):nt(e,o,i,r,s)}function st(e,t,n,i,r,s,o){let a,l,u=!1,p=!0;const d=null==n?void 0:n.details.name;if(e.argument.valueExpression){let i=bo(e.paramType)&&void 0!==n&&e.paramType.scopeId===n.details.typeVarScopeId?void 0:fa(e.paramType,t,!1,s);if(i&&po(i)&&(i=void 0),e.argType)a=e.argType;else{const t=e.expectingType?168:0,n=$(e.argument.valueExpression,i,t);a=n.type,n.isIncomplete&&(u=!0),n.typeErrors&&(p=!1),l=n.expectedTypeDiagAddendum}e.argument&&e.argument.name&&!c.isSpeculative(e.errorNode)&&N(e.argument.name,i||a,0,u)}else if(e.argType)a=e.argType;else if(e.expectingType&&!e.argument.type&&e.argument.valueExpression){const t=$(e.argument.valueExpression,void 0,168);a=t.type,t.isIncomplete&&(u=!0)}else{const t=bn(e.argument);a=t.type,t.isIncomplete&&(u=!0)}2===e.paramCategory&&bo(e.paramType)&&(a=Qo(a)),o&&(a=Se(a,o,(e=>e)));let h=new il;if(wo(e.paramType)&&void 0!==e.paramType.paramSpecAccess)return{isCompatible:p,isTypeIncomplete:u};if(r){if(ko(a))return{isCompatible:p,isTypeIncomplete:u,skippedOverloadArg:!0};const t=Ie(e.paramType);if(Eo(t)||ko(t)){if(_o(a)){const e=Zn(a);if(e&&ko(e))return{isCompatible:p,isTypeIncomplete:u,skippedOverloadArg:!0}}if(vo(a)){const e=_a(a,"__call__");if(e&&ko(Bn(e)))return{isCompatible:p,isTypeIncomplete:u,skippedOverloadArg:!0}}}}if(!Jn(e.paramType,a,h.createAddendum(),t)){if("none"!==qt(e.errorNode).diagnosticRuleSet.reportGeneralTypeIssues&&!ye(e.errorNode)){const t=qt(e.errorNode),n=ai(a),i=ai(e.paramType);let r;r=e.paramName?d?ml.Diagnostic.argAssignmentParamFunction().format({argType:n,paramType:i,functionName:d,paramName:e.paramName}):ml.Diagnostic.argAssignmentParam().format({argType:n,paramType:i,paramName:e.paramName}):d?ml.Diagnostic.argAssignmentFunction().format({argType:n,paramType:i,functionName:d}):ml.Diagnostic.argAssignment().format({argType:n,paramType:i}),l&&(h=l),_e(t.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,r+al(h),e.errorNode)}return{isCompatible:!1,isTypeIncomplete:u}}if(!i){const t=Ro(a),n=qt(e.errorNode),i=()=>{const t=new il;return e.paramName&&t.addMessage((d?ml.DiagnosticAddendum.argParamFunction().format({paramName:e.paramName,functionName:d}):ml.DiagnosticAddendum.argParam().format({paramName:e.paramName}))+t.getString()),t};if("none"!==n.diagnosticRuleSet.reportUnknownArgumentType&&!uo(e.paramType)&&!u)if(po(t)){const t=i();_e(n.diagnosticRuleSet.reportUnknownArgumentType,$o.reportUnknownArgumentType,ml.Diagnostic.argTypeUnknown()+t.getString(),e.errorNode)}else if(La(t,!0)){let r=!1;if(_o(t)&&(r=!0),La(e.paramType)&&(r=!0),vo(t)&&t.isEmptyContainer&&(r=!0),!r){const r=i();r.addMessage(ml.DiagnosticAddendum.argumentType().format({type:ai(t,!0)})),_e(n.diagnosticRuleSet.reportUnknownArgumentType,$o.reportUnknownArgumentType,ml.Diagnostic.argTypePartiallyUnknown()+r.getString(),e.errorNode)}}}return{isCompatible:p,isTypeIncomplete:u}}function ot(e){if(11===e.nodeType){if(15===e.constType)return!1;if(33===e.constType)return!0}return fe(ml.Diagnostic.expectedBoolLiteral(),e),!1}function at(e,t){const n=qt(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 r=In(t[1]).type;if(_o(r)){Zs.isProtocolClass(r)?fe(ml.Diagnostic.newTypeProtocolClass(),t[1].node||e):void 0!==r.literalValue&&fe(ml.Diagnostic.newTypeLiteral(),t[1].node||e);const s=-4&r.details.flags,o=Zs.createInstantiable(i,br(e,n.moduleName,i),n.moduleName,n.filePath,s,Ir(e),void 0,r.details.effectiveMetaclass);o.details.baseClasses.push(r),Ha(o);const a=Xs.createInstance("__init__","","",64);Xs.addParameter(a,{category:0,name:"self",type:Zs.cloneAsInstance(o),hasDeclaredType:!0}),Xs.addParameter(a,{category:0,name:"_x",type:Zs.cloneAsInstance(r),hasDeclaredType:!0}),a.details.declaredReturnType=to.createInstance(),o.details.fields.set("__init__",Vo.createWithType(4,a));const l=Xs.createInstance("__new__","","",65);return Xs.addParameter(l,{category:0,name:"cls",type:o,hasDeclaredType:!0}),Xs.addDefaultParameters(l),l.details.declaredReturnType=Zs.cloneAsInstance(o),o.details.fields.set("__new__",Vo.createWithType(4,l)),o}ho(r)||fe(ml.Diagnostic.newTypeNotAClass(),t[1].node||e)}}function lt(e){return!(!Ku[e]||!Ku[e][2])||!!Ju[e]}function ut(e,t,n){const i=e.leftExpression;let r=e.rightExpression,s=!1;lt(e.operator)&&7===r.nodeType&&!r.parenthesized&<(r.operator)&&(ut(r,t,n),r=r.leftExpression);let o,a=37===e.operator||36===e.operator?t:void 0;26===e.operator&&t&&vo(t)&&Zs.isBuiltIn(t,"list")&&t.typeArguments&&t.typeArguments.length>=1&&31===e.leftExpression.nodeType&&(o=t);const l=$(i,a||o,n);let c=l.type;a||(37===e.operator||36===e.operator||0===e.operator&&31===e.rightExpression.nodeType||6===e.operator)&&(a=c);const u=$(r,a,n);let p=u.type;if((l.isIncomplete||u.isIncomplete)&&(s=!0),6===e.operator&&!pt(c,"__or__")&&!pt(p,"__ror__")){let t=p;if(!lo(c)&&lo(p)&&Ks.isInstance(p)&&(t=to.createType()),function(e){let t=3;for(const n of e)t&=n.flags;return 0!=(1&t)&&0==(2&t)}([c,t])){const i=qt(e);i.isStubFile||0!=(4&n)||i.executionEnvironment.pythonVersion>=De.V3_10||ho(c)||fe(ml.Diagnostic.unionSyntaxIllegal(),e,e.operatorToken);const r=Oo([c,t]);return fo(r)&&Ks.setSpecialForm(r),{type:r,node:e}}}let d=!1;void 0===Ju[e.operator]&&(12===e.operator||28===e.operator?c=Fo(c):d=Go(c),12!==e.operator&&28!==e.operator||(p=Fo(p)));const h=new il,m=!l.isIncomplete&&!u.isIncomplete;let f=mt(e.operator,c,p,e,t,h,m);if(!h.isEmpty()||!f){if(!s){const t=qt(e);d&&1===h.getMessages().length?_e(qt(e).diagnosticRuleSet.reportOptionalOperand,$o.reportOptionalOperand,ml.Diagnostic.noneOperator().format({operator:Cr(e.operator)}),e.leftExpression):_e(t.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeNotSupportBinaryOperator().format({operator:Cr(e.operator),leftType:ai(c),rightType:ai(p)})+al(h),e)}f=Ys.create()}return{type:f,node:e,isIncomplete:s}}function pt(e,t){if(!_o(e))return!1;const n=e.details.effectiveMetaclass;if(!n||!_o(n))return!1;if(Zs.isBuiltIn(n,"type"))return!1;const i=va(n,t);return!(!i||_o(i.classType)&&Zs.isBuiltIn(i.classType,"type"))}function ht(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 r=new il,s=$(e.leftExpression),o=s.type;let a;7===e.operator&&(a=o);const l=$(e.rightExpression,a),c=l.type,u=!!l.isIncomplete||!!s.isIncomplete;return ao(o)||ao(c)?{node:e,type:no.createNever(),isIncomplete:u}:(i=Se(o,void 0,((i,o)=>Se(c,Xo(i),((a,c)=>{if(ho(o)||ho(c))return po(o)||po(c)?Ys.create():io.create();const u=n[e.operator][0];let p=gt(o,[c],u,e,t);if(p||o===i||(p=gt(i,[c],u,e,t)),p||c===a||(p=gt(i,[a],u,e,t)),!p){const i=n[e.operator][1],a=!s.isIncomplete&&!l.isIncomplete;p=mt(i,o,c,e,t,r,a)}return p})))),r.isEmpty()&&i&&!ao(i)||(u||_e(qt(e).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeNotSupportBinaryOperator().format({operator:Cr(e.operator),leftType:ai(o),rightType:ai(c)})+al(r),e),i=Ys.create()),{node:e,type:i,isIncomplete:u})}function mt(e,t,n,i,r,s,o){let a,l=Ie(t);if(void 0!==Ju[e]){if(36===e){if(!Q(l))return t;if(!Y(l))return n;l=Z(l)}else if(37===e){if(!Y(l))return t;if(!Q(l))return n;l=X(l)}if(ao(t)||ao(n))return no.createNever();41===e||42===e?(a=Se(n,void 0,((t,n)=>Se(l,Xo(t),(r=>{if(ho(r)||ho(n))return po(r)||po(n)?Ys.create():io.create();let o=gt(t,[r],"__contains__",i,void 0);if(!o){const e=ae(t,!1,void 0);e&&Jn(e,r)&&(o=Cn(i,"bool"))}return o||s.addMessage(ml.Diagnostic.typeNotSupportBinaryOperator().format({operator:Cr(e),leftType:ai(r),rightType:ai(t)})),o})))),a&&!ao(a)&&(a=Cn(i,"bool"))):a=Se(l,void 0,((t,r)=>Se(n,Xo(t),((t,n)=>36===e||37===e?Oo([r,n]):Cn(i,"bool")))))}else if(Ku[e]){if(ao(t)||ao(n))return no.createNever();if(o){const i=aa(t);if(i&&!Xo(t)){const r=64;if(i===aa(n)&&!Xo(n)&&la(t)*la(n)e.length)throw new RangeError("Index out of range")}function N(e,t,n,i,r){W(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function M(e,t,n,i,r){W(t,i,r,e,n,7);let s=Number(t&BigInt(4294967295));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function O(e,t,n,i,r,s){if(n+i>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,4),r.write(e,t,n,i,23,4),n+4}function U(e,t,n,i,s){return t=+t,n>>>=0,s||O(e,0,n,8),r.write(e,t,n,i,52,8),n+8}l.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),tl?u>l?l+1:u:u>c?c+1:u;return l};e.exports=i,e.exports.default=i},2797:(e,t,n)=>{"use strict";e.exports=n(3374)},3374:function(e,t,n){"use strict";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]}),r=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.BrowserMessageWriter=t.BrowserMessageReader=void 0,n(485).default.install();const s=n(7504);r(n(7504),t);class o extends s.AbstractMessageReader{constructor(e){super(),this._onData=new s.Emitter,this._messageListener=e=>{this._onData.fire(e.data)},e.addEventListener("error",(e=>this.fireError(e))),e.onmessage=this._messageListener}listen(e){return this._onData.event(e)}}t.BrowserMessageReader=o;class a extends s.AbstractMessageWriter{constructor(e){super(),this.context=e,this.errorCount=0,e.addEventListener("error",(e=>this.fireError(e)))}write(e){try{return this.context.postMessage(e),Promise.resolve()}catch(t){return this.handleError(t,e),Promise.reject(t)}}handleError(e,t){this.errorCount++,this.fireError(e,t,this.errorCount)}end(){}}t.BrowserMessageWriter=a,t.createMessageConnection=function(e,t,n,i){return void 0===n&&(n=s.NullLogger),s.ConnectionStrategy.is(i)&&(i={connectionStrategy:i}),s.createMessageConnection(e,t,n,i)}},485:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});const i=n(9872),r=n(4469),s=n(2479),o=n(9053);class a extends o.AbstractMessageBuffer{constructor(e="utf-8"){super(e),this.asciiDecoder=new TextDecoder("ascii")}emptyBuffer(){return a.emptyBuffer}fromString(e,t){return(new TextEncoder).encode(e)}toString(e,t){return"ascii"===t?this.asciiDecoder.decode(e):new TextDecoder(t).decode(e)}asNative(e,t){return void 0===t?e:e.slice(0,t)}allocNative(e){return new Uint8Array(e)}}a.emptyBuffer=new Uint8Array(0);class l{constructor(e){this.socket=e,this._onData=new s.Emitter,this._messageListener=e=>{e.data.arrayBuffer().then((e=>{this._onData.fire(new Uint8Array(e))}))},this.socket.addEventListener("message",this._messageListener)}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create((()=>this.socket.removeEventListener("end",e)))}onData(e){return this._onData.event(e)}}class c{constructor(e){this.socket=e}onClose(e){return this.socket.addEventListener("close",e),r.Disposable.create((()=>this.socket.removeEventListener("close",e)))}onError(e){return this.socket.addEventListener("error",e),r.Disposable.create((()=>this.socket.removeEventListener("error",e)))}onEnd(e){return this.socket.addEventListener("end",e),r.Disposable.create((()=>this.socket.removeEventListener("end",e)))}write(e,t){if("string"==typeof e){if(void 0!==t&&"utf-8"!==t)throw new Error(`In a Browser environments only utf-8 text encding is supported. But got encoding: ${t}`);this.socket.send(e)}else this.socket.send(e);return Promise.resolve()}end(){this.socket.close()}}const u=new TextEncoder,p=Object.freeze({messageBuffer:Object.freeze({create:e=>new a(e)}),applicationJson:Object.freeze({encoder:Object.freeze({name:"application/json",encode:(e,t)=>{if("utf-8"!==t.charset)throw new Error(`In a Browser environments only utf-8 text encding is supported. But got encoding: ${t.charset}`);return Promise.resolve(u.encode(JSON.stringify(e,void 0,0)))}}),decoder:Object.freeze({name:"application/json",decode:(e,t)=>{if(!(e instanceof Uint8Array))throw new Error("In a Browser environments only Uint8Arrays are supported.");return Promise.resolve(JSON.parse(new TextDecoder(t.charset).decode(e)))}})}),stream:Object.freeze({asReadableStream:e=>new l(e),asWritableStream:e=>new c(e)}),console,timer:Object.freeze({setTimeout:(e,t,...n)=>setTimeout(e,t,...n),clearTimeout(e){clearTimeout(e)},setImmediate:(e,...t)=>setTimeout(e,0,...t),clearImmediate(e){clearTimeout(e)}})});function d(){return p}!function(e){e.install=function(){i.default.install(p)}}(d||(d={})),t.default=d},7504:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.Trace=t.ProgressType=t.createMessageConnection=t.NullLogger=t.ConnectionOptions=t.ConnectionStrategy=t.WriteableStreamMessageWriter=t.AbstractMessageWriter=t.MessageWriter=t.ReadableStreamMessageReader=t.AbstractMessageReader=t.MessageReader=t.CancellationToken=t.CancellationTokenSource=t.Emitter=t.Event=t.Disposable=t.ParameterStructures=t.NotificationType9=t.NotificationType8=t.NotificationType7=t.NotificationType6=t.NotificationType5=t.NotificationType4=t.NotificationType3=t.NotificationType2=t.NotificationType1=t.NotificationType0=t.NotificationType=t.ErrorCodes=t.ResponseError=t.RequestType9=t.RequestType8=t.RequestType7=t.RequestType6=t.RequestType5=t.RequestType4=t.RequestType3=t.RequestType2=t.RequestType1=t.RequestType0=t.RequestType=t.RAL=void 0,t.CancellationStrategy=void 0;const i=n(9263);Object.defineProperty(t,"RequestType",{enumerable:!0,get:function(){return i.RequestType}}),Object.defineProperty(t,"RequestType0",{enumerable:!0,get:function(){return i.RequestType0}}),Object.defineProperty(t,"RequestType1",{enumerable:!0,get:function(){return i.RequestType1}}),Object.defineProperty(t,"RequestType2",{enumerable:!0,get:function(){return i.RequestType2}}),Object.defineProperty(t,"RequestType3",{enumerable:!0,get:function(){return i.RequestType3}}),Object.defineProperty(t,"RequestType4",{enumerable:!0,get:function(){return i.RequestType4}}),Object.defineProperty(t,"RequestType5",{enumerable:!0,get:function(){return i.RequestType5}}),Object.defineProperty(t,"RequestType6",{enumerable:!0,get:function(){return i.RequestType6}}),Object.defineProperty(t,"RequestType7",{enumerable:!0,get:function(){return i.RequestType7}}),Object.defineProperty(t,"RequestType8",{enumerable:!0,get:function(){return i.RequestType8}}),Object.defineProperty(t,"RequestType9",{enumerable:!0,get:function(){return i.RequestType9}}),Object.defineProperty(t,"ResponseError",{enumerable:!0,get:function(){return i.ResponseError}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return i.ErrorCodes}}),Object.defineProperty(t,"NotificationType",{enumerable:!0,get:function(){return i.NotificationType}}),Object.defineProperty(t,"NotificationType0",{enumerable:!0,get:function(){return i.NotificationType0}}),Object.defineProperty(t,"NotificationType1",{enumerable:!0,get:function(){return i.NotificationType1}}),Object.defineProperty(t,"NotificationType2",{enumerable:!0,get:function(){return i.NotificationType2}}),Object.defineProperty(t,"NotificationType3",{enumerable:!0,get:function(){return i.NotificationType3}}),Object.defineProperty(t,"NotificationType4",{enumerable:!0,get:function(){return i.NotificationType4}}),Object.defineProperty(t,"NotificationType5",{enumerable:!0,get:function(){return i.NotificationType5}}),Object.defineProperty(t,"NotificationType6",{enumerable:!0,get:function(){return i.NotificationType6}}),Object.defineProperty(t,"NotificationType7",{enumerable:!0,get:function(){return i.NotificationType7}}),Object.defineProperty(t,"NotificationType8",{enumerable:!0,get:function(){return i.NotificationType8}}),Object.defineProperty(t,"NotificationType9",{enumerable:!0,get:function(){return i.NotificationType9}}),Object.defineProperty(t,"ParameterStructures",{enumerable:!0,get:function(){return i.ParameterStructures}});const r=n(4469);Object.defineProperty(t,"Disposable",{enumerable:!0,get:function(){return r.Disposable}});const s=n(2479);Object.defineProperty(t,"Event",{enumerable:!0,get:function(){return s.Event}}),Object.defineProperty(t,"Emitter",{enumerable:!0,get:function(){return s.Emitter}});const o=n(6368);Object.defineProperty(t,"CancellationTokenSource",{enumerable:!0,get:function(){return o.CancellationTokenSource}}),Object.defineProperty(t,"CancellationToken",{enumerable:!0,get:function(){return o.CancellationToken}});const a=n(5132);Object.defineProperty(t,"MessageReader",{enumerable:!0,get:function(){return a.MessageReader}}),Object.defineProperty(t,"AbstractMessageReader",{enumerable:!0,get:function(){return a.AbstractMessageReader}}),Object.defineProperty(t,"ReadableStreamMessageReader",{enumerable:!0,get:function(){return a.ReadableStreamMessageReader}});const l=n(8633);Object.defineProperty(t,"MessageWriter",{enumerable:!0,get:function(){return l.MessageWriter}}),Object.defineProperty(t,"AbstractMessageWriter",{enumerable:!0,get:function(){return l.AbstractMessageWriter}}),Object.defineProperty(t,"WriteableStreamMessageWriter",{enumerable:!0,get:function(){return l.WriteableStreamMessageWriter}});const c=n(3467);Object.defineProperty(t,"ConnectionStrategy",{enumerable:!0,get:function(){return c.ConnectionStrategy}}),Object.defineProperty(t,"ConnectionOptions",{enumerable:!0,get:function(){return c.ConnectionOptions}}),Object.defineProperty(t,"NullLogger",{enumerable:!0,get:function(){return c.NullLogger}}),Object.defineProperty(t,"createMessageConnection",{enumerable:!0,get:function(){return c.createMessageConnection}}),Object.defineProperty(t,"ProgressType",{enumerable:!0,get:function(){return c.ProgressType}}),Object.defineProperty(t,"Trace",{enumerable:!0,get:function(){return c.Trace}}),Object.defineProperty(t,"TraceFormat",{enumerable:!0,get:function(){return c.TraceFormat}}),Object.defineProperty(t,"SetTraceNotification",{enumerable:!0,get:function(){return c.SetTraceNotification}}),Object.defineProperty(t,"LogTraceNotification",{enumerable:!0,get:function(){return c.LogTraceNotification}}),Object.defineProperty(t,"ConnectionErrors",{enumerable:!0,get:function(){return c.ConnectionErrors}}),Object.defineProperty(t,"ConnectionError",{enumerable:!0,get:function(){return c.ConnectionError}}),Object.defineProperty(t,"CancellationReceiverStrategy",{enumerable:!0,get:function(){return c.CancellationReceiverStrategy}}),Object.defineProperty(t,"CancellationSenderStrategy",{enumerable:!0,get:function(){return c.CancellationSenderStrategy}}),Object.defineProperty(t,"CancellationStrategy",{enumerable:!0,get:function(){return c.CancellationStrategy}});const u=n(9872);t.RAL=u.default},6368:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CancellationTokenSource=t.CancellationToken=void 0;const i=n(9872),r=n(5306),s=n(2479);var o;!function(e){e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:s.Event.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:s.Event.None}),e.is=function(t){const n=t;return n&&(n===e.None||n===e.Cancelled||r.boolean(n.isCancellationRequested)&&!!n.onCancellationRequested)}}(o=t.CancellationToken||(t.CancellationToken={}));const a=Object.freeze((function(e,t){const n=i.default().timer.setTimeout(e.bind(t),0);return{dispose(){i.default().timer.clearTimeout(n)}}}));class l{constructor(){this._isCancelled=!1}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?a:(this._emitter||(this._emitter=new s.Emitter),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}}t.CancellationTokenSource=class{get token(){return this._token||(this._token=new l),this._token}cancel(){this._token?this._token.cancel():this._token=o.Cancelled}dispose(){this._token?this._token instanceof l&&this._token.dispose():this._token=o.None}}},3467:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createMessageConnection=t.ConnectionOptions=t.CancellationStrategy=t.CancellationSenderStrategy=t.CancellationReceiverStrategy=t.ConnectionStrategy=t.ConnectionError=t.ConnectionErrors=t.LogTraceNotification=t.SetTraceNotification=t.TraceFormat=t.Trace=t.NullLogger=t.ProgressType=void 0;const i=n(9872),r=n(5306),s=n(9263),o=n(3820),a=n(2479),l=n(6368);var c,u,p,d,h,m,f,g,y,_,v,T,b;!function(e){e.type=new s.NotificationType("$/cancelRequest")}(c||(c={})),function(e){e.type=new s.NotificationType("$/progress")}(u||(u={})),t.ProgressType=class{constructor(){}},function(e){e.is=function(e){return r.func(e)}}(p||(p={})),t.NullLogger=Object.freeze({error:()=>{},warn:()=>{},info:()=>{},log:()=>{}}),function(e){e[e.Off=0]="Off",e[e.Messages=1]="Messages",e[e.Verbose=2]="Verbose"}(d=t.Trace||(t.Trace={})),function(e){e.fromString=function(t){if(!r.string(t))return e.Off;switch(t=t.toLowerCase()){case"off":return e.Off;case"messages":return e.Messages;case"verbose":return e.Verbose;default:return e.Off}},e.toString=function(t){switch(t){case e.Off:return"off";case e.Messages:return"messages";case e.Verbose:return"verbose";default:return"off"}}}(d=t.Trace||(t.Trace={})),function(e){e.Text="text",e.JSON="json"}(t.TraceFormat||(t.TraceFormat={})),function(e){e.fromString=function(t){return"json"===(t=t.toLowerCase())?e.JSON:e.Text}}(h=t.TraceFormat||(t.TraceFormat={})),function(e){e.type=new s.NotificationType("$/setTrace")}(m=t.SetTraceNotification||(t.SetTraceNotification={})),function(e){e.type=new s.NotificationType("$/logTrace")}(f=t.LogTraceNotification||(t.LogTraceNotification={})),function(e){e[e.Closed=1]="Closed",e[e.Disposed=2]="Disposed",e[e.AlreadyListening=3]="AlreadyListening"}(g=t.ConnectionErrors||(t.ConnectionErrors={}));class I extends Error{constructor(e,t){super(t),this.code=e,Object.setPrototypeOf(this,I.prototype)}}t.ConnectionError=I,function(e){e.is=function(e){const t=e;return t&&r.func(t.cancelUndispatched)}}(y=t.ConnectionStrategy||(t.ConnectionStrategy={})),function(e){e.Message=Object.freeze({createCancellationTokenSource:e=>new l.CancellationTokenSource}),e.is=function(e){const t=e;return t&&r.func(t.createCancellationTokenSource)}}(_=t.CancellationReceiverStrategy||(t.CancellationReceiverStrategy={})),function(e){e.Message=Object.freeze({sendCancellation(e,t){e.sendNotification(c.type,{id:t})},cleanup(e){}}),e.is=function(e){const t=e;return t&&r.func(t.sendCancellation)&&r.func(t.cleanup)}}(v=t.CancellationSenderStrategy||(t.CancellationSenderStrategy={})),function(e){e.Message=Object.freeze({receiver:_.Message,sender:v.Message}),e.is=function(e){const t=e;return t&&_.is(t.receiver)&&v.is(t.sender)}}(T=t.CancellationStrategy||(t.CancellationStrategy={})),(t.ConnectionOptions||(t.ConnectionOptions={})).is=function(e){const t=e;return t&&(T.is(t.cancellationStrategy)||y.is(t.connectionStrategy))},function(e){e[e.New=1]="New",e[e.Listening=2]="Listening",e[e.Closed=3]="Closed",e[e.Disposed=4]="Disposed"}(b||(b={})),t.createMessageConnection=function(e,n,y,_){const v=void 0!==y?y:t.NullLogger;let S=0,x=0,C=0;const w="2.0";let E;const k=Object.create(null);let D;const A=Object.create(null),P=new Map;let R,F,N=new o.LinkedMap,M=Object.create(null),O=Object.create(null),L=d.Off,U=h.Text,V=b.New;const q=new a.Emitter,B=new a.Emitter,W=new a.Emitter,j=new a.Emitter,z=new a.Emitter,$=_&&_.cancellationStrategy?_.cancellationStrategy:T.Message;function H(e){if(null===e)throw new Error("Can't send requests with id null since the response can't be correlated.");return"req-"+e.toString()}function G(e){}function K(){return V===b.Listening}function J(){return V===b.Closed}function Y(){return V===b.Disposed}function Q(){V!==b.New&&V!==b.Listening||(V=b.Closed,B.fire(void 0))}function Z(){R||0===N.size||(R=i.default().timer.setImmediate((()=>{R=void 0,function(){if(0===N.size)return;const e=N.shift();try{s.isRequestMessage(e)?function(e){if(Y())return;function t(t,i,r){const o={jsonrpc:w,id:e.id};t instanceof s.ResponseError?o.error=t.toJson():o.result=void 0===t?null:t,ee(o,i,r),n.write(o)}function i(t,i,r){const s={jsonrpc:w,id:e.id,error:t.toJson()};ee(s,i,r),n.write(s)}!function(e){if(L!==d.Off&&F)if(U===h.Text){let t;L===d.Verbose&&e.params&&(t=`Params: ${JSON.stringify(e.params,null,4)}\n\n`),F.log(`Received request '${e.method} - (${e.id})'.`,t)}else te("receive-request",e)}(e);const o=k[e.method];let a,l;o&&(a=o.type,l=o.handler);const c=Date.now();if(l||E){const o=String(e.id),u=$.receiver.createCancellationTokenSource(o);O[o]=u;try{let p;if(l)if(void 0===e.params){if(void 0!==a&&0!==a.numberOfParams)return void i(new s.ResponseError(s.ErrorCodes.InvalidParams,`Request ${e.method} defines ${a.numberOfParams} params but recevied none.`),e.method,c);p=l(u.token)}else if(Array.isArray(e.params)){if(void 0!==a&&a.parameterStructures===s.ParameterStructures.byName)return void i(new s.ResponseError(s.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by name but received parameters by position`),e.method,c);p=l(...e.params,u.token)}else{if(void 0!==a&&a.parameterStructures===s.ParameterStructures.byPosition)return void i(new s.ResponseError(s.ErrorCodes.InvalidParams,`Request ${e.method} defines parameters by position but received parameters by name`),e.method,c);p=l(e.params,u.token)}else E&&(p=E(e.method,e.params,u.token));const d=p;p?d.then?d.then((n=>{delete O[o],t(n,e.method,c)}),(t=>{delete O[o],t instanceof s.ResponseError?i(t,e.method,c):t&&r.string(t.message)?i(new s.ResponseError(s.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${t.message}`),e.method,c):i(new s.ResponseError(s.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,c)})):(delete O[o],t(p,e.method,c)):(delete O[o],function(t,i,r){void 0===t&&(t=null);const s={jsonrpc:w,id:e.id,result:t};ee(s,i,r),n.write(s)}(p,e.method,c))}catch(n){delete O[o],n instanceof s.ResponseError?t(n,e.method,c):n&&r.string(n.message)?i(new s.ResponseError(s.ErrorCodes.InternalError,`Request ${e.method} failed with message: ${n.message}`),e.method,c):i(new s.ResponseError(s.ErrorCodes.InternalError,`Request ${e.method} failed unexpectedly without providing any details.`),e.method,c)}}else i(new s.ResponseError(s.ErrorCodes.MethodNotFound,`Unhandled method ${e.method}`),e.method,c)}(e):s.isNotificationMessage(e)?function(e){if(Y())return;let t,n;if(e.method===c.type.method)n=e=>{const t=e.id,n=O[String(t)];n&&n.cancel()};else{const i=A[e.method];i&&(n=i.handler,t=i.type)}if(n||D)try{!function(e){if(L!==d.Off&&F&&e.method!==f.type.method)if(U===h.Text){let t;L===d.Verbose&&(t=e.params?`Params: ${JSON.stringify(e.params,null,4)}\n\n`:"No parameters provided.\n\n"),F.log(`Received notification '${e.method}'.`,t)}else te("receive-notification",e)}(e),n?void 0===e.params?(void 0!==t&&0!==t.numberOfParams&&t.parameterStructures!==s.ParameterStructures.byName&&v.error(`Notification ${e.method} defines ${t.numberOfParams} params but recevied none.`),n()):Array.isArray(e.params)?(void 0!==t&&(t.parameterStructures===s.ParameterStructures.byName&&v.error(`Notification ${e.method} defines parameters by name but received parameters by position`),t.numberOfParams!==e.params.length&&v.error(`Notification ${e.method} defines ${t.numberOfParams} params but received ${e.params.length} argumennts`)),n(...e.params)):(void 0!==t&&t.parameterStructures===s.ParameterStructures.byPosition&&v.error(`Notification ${e.method} defines parameters by position but received parameters by name`),n(e.params)):D&&D(e.method,e.params)}catch(t){t.message?v.error(`Notification handler '${e.method}' failed with message: ${t.message}`):v.error(`Notification handler '${e.method}' failed unexpectedly.`)}else W.fire(e)}(e):s.isResponseMessage(e)?function(e){if(!Y())if(null===e.id)e.error?v.error(`Received response message without id: Error is: \n${JSON.stringify(e.error,void 0,4)}`):v.error("Received response message without id. No further error information provided.");else{const t=String(e.id),n=M[t];if(function(e,t){if(L!==d.Off&&F)if(U===h.Text){let n;if(L===d.Verbose&&(e.error&&e.error.data?n=`Error data: ${JSON.stringify(e.error.data,null,4)}\n\n`:e.result?n=`Result: ${JSON.stringify(e.result,null,4)}\n\n`:void 0===e.error&&(n="No result returned.\n\n")),t){const i=e.error?` Request failed: ${e.error.message} (${e.error.code}).`:"";F.log(`Received response '${t.method} - (${e.id})' in ${Date.now()-t.timerStart}ms.${i}`,n)}else F.log(`Received response ${e.id} without active response promise.`,n)}else te("receive-response",e)}(e,n),n){delete M[t];try{if(e.error){const t=e.error;n.reject(new s.ResponseError(t.code,t.message,t.data))}else{if(void 0===e.result)throw new Error("Should never happen.");n.resolve(e.result)}}catch(e){e.message?v.error(`Response handler '${n.method}' failed with message: ${e.message}`):v.error(`Response handler '${n.method}' failed unexpectedly.`)}}}}(e):function(e){if(!e)return void v.error("Received empty message.");v.error(`Received message which is neither a response nor a notification message:\n${JSON.stringify(e,null,4)}`);const t=e;if(r.string(t.id)||r.number(t.id)){const e=String(t.id),n=M[e];n&&n.reject(new Error("The received response has neither a result nor an error property."))}}(e)}finally{Z()}}()})))}e.onClose(Q),e.onError((function(e){q.fire([e,void 0,void 0])})),n.onClose(Q),n.onError((function(e){q.fire(e)}));const X=e=>{try{if(s.isNotificationMessage(e)&&e.method===c.type.method){const t=H(e.params.id),i=N.get(t);if(s.isRequestMessage(i)){const r=null==_?void 0:_.connectionStrategy,s=r&&r.cancelUndispatched?r.cancelUndispatched(i,G):void 0;if(s&&(void 0!==s.error||void 0!==s.result))return N.delete(t),s.id=i.id,ee(s,e.method,Date.now()),void n.write(s)}}!function(e,t){var n;s.isRequestMessage(t)?e.set(H(t.id),t):s.isResponseMessage(t)?e.set(null===(n=t.id)?"res-unknown-"+(++C).toString():"res-"+n.toString(),t):e.set("not-"+(++x).toString(),t)}(N,e)}finally{Z()}};function ee(e,t,n){if(L!==d.Off&&F)if(U===h.Text){let i;L===d.Verbose&&(e.error&&e.error.data?i=`Error data: ${JSON.stringify(e.error.data,null,4)}\n\n`:e.result?i=`Result: ${JSON.stringify(e.result,null,4)}\n\n`:void 0===e.error&&(i="No result returned.\n\n")),F.log(`Sending response '${t} - (${e.id})'. Processing request took ${Date.now()-n}ms`,i)}else te("send-response",e)}function te(e,t){if(!F||L===d.Off)return;const n={isLSPMessage:!0,type:e,message:t,timestamp:Date.now()};F.log(n)}function ne(){if(J())throw new I(g.Closed,"Connection is closed.");if(Y())throw new I(g.Disposed,"Connection is disposed.")}function ie(e){return void 0===e?null:e}function re(e){return null===e?void 0:e}function se(e){return null!=e&&!Array.isArray(e)&&"object"==typeof e}function oe(e,t){switch(e){case s.ParameterStructures.auto:return se(t)?re(t):[ie(t)];case s.ParameterStructures.byName:if(!se(t))throw new Error("Recevied parameters by name but param is not an object literal.");return re(t);case s.ParameterStructures.byPosition:return[ie(t)];default:throw new Error(`Unknown parameter structure ${e.toString()}`)}}function ae(e,t){let n;const i=e.numberOfParams;switch(i){case 0:n=void 0;break;case 1:n=oe(e.parameterStructures,t[0]);break;default:n=[];for(let e=0;e{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(447)})();const{URI:x,Utils:C}=I;function w(e,t,n,i){e||(n&&(t+="\r\nVerbose Debug Information: "+("string"==typeof n?n:n())),E(t?"False expression: "+t:"False expression.",i||w))}function E(e,t){const n=new Error(e?`Debug Failure. ${e}`:"Debug Failure.");throw Error.captureStackTrace&&Error.captureStackTrace(n,t||E),n}function k(e,t="Illegal value:",n){E(`${t} ${JSON.stringify(e)}`,n||k)}function D(e){if(e)return JSON.stringify(e).length>2?e:{name:e.name&&r(e.name)?e.name:"noname",message:e.message&&r(e.message)?e.message:"nomessage",stack:e.stack&&r(e.stack)?e.stack:void 0}}let A;try{A=__webpack_require__(2016),(null==A?void 0:A.randomBytes)||(A=void 0)}catch{}function P(e){if(A)return A.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;E("crypto library not found")}var R=__webpack_require__(7588),F=__webpack_require__.n(R);function N(e,t){const n=e.toLocaleLowerCase(),i=t.toLocaleLowerCase(),r=n.length,s=i.length;let o=0,a=0;for(;o
\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 r=0;rQo(e))));return o||(i=Iu(e,t,i)),i}const l=n.entryTypes.length-(r-i);return w(l>=0&&l{t.argParams.forEach((e=>{if(e.requiresTypeVarMatching){const t=st(e,n,r,i,0===a,s>1&&0===a,l);t.isTypeIncomplete&&(o=!0),0===a&&t.skippedOverloadArg&&s++}}))}));n.lock()}t.argParams.forEach((e=>{const t=st(e,n,r,i,!1,!1,l);t.isCompatible||(a=!0),t.isTypeIncomplete&&(o=!0)})),t.paramSpecArgList&&t.paramSpecTarget&&(function(e,t,n,i,r){var s;const o=i.getParamSpec(n);if(!o)return _e(qt(e).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.paramSpecNotBound().format({type:ai(n)}),(null===(s=t[0])||void 0===s?void 0:s.valueExpression)||e),!1;i.addSolveForScope(o.typeVarScopeId);let a=!1;const l=new Map,c=o.parameters;c.forEach((e=>{e.name&&l.set(e.name,e)}));let u=0,p=c.findIndex((e=>0!==e.category));p<0&&(p=c.length);const d=c.find((e=>1===e.category)),h=c.find((e=>2===e.category));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)):h?n=h.type:(_e(qt(e).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.paramNameMissing().format({name:t.name.value}),t.valueExpression||e),a=!0)}else{if(u{e.entry.type=e.evaluator()}));const f=n.details.fields,g=[];i||r||!d||(p.forEach((t=>{var i;if(t.includeInInit){let r=t.type;if(t.classType!==n&&$a(r)){const e=new jo(na(t.classType));ma(e,t.classType,n),r=fa(r,e)}(null===(i=n.details.dataClassBehaviors)||void 0===i?void 0:i.transformDescriptorTypes)&&(r=function(e,t){if(!vo(t))return t;const n=_a(t,"__set__");if(!n)return t;const i=e.getTypeOfMember(n);if(!Eo(i))return t;const r=e.bindFunctionToClassOrObject(t,i);return!r||!Eo(r)||r.details.parameters.length<2?t:Xs.getEffectiveParameterType(r,1)}(e,r));const s={category:0,name:t.alias||t.name,hasDefault:t.hasDefault,defaultValueExpression:t.defaultValueExpression,type:r,hasDeclaredType:!0};t.isKeywordOnly?g.push(s):Xs.addParameter(l,s)}})),g.length>0&&(Xs.addParameter(l,{category:1,type:io.create()}),g.forEach((e=>{Xs.addParameter(l,e)}))),f.set("__init__",Vo.createWithType(4,l)),f.set("__new__",Vo.createWithType(4,a)));const y=e.getBuiltInType(t,"str"),_=e.getBuiltInType(t,"tuple");if(_&&_o(_)&&y&&_o(y)&&!f.has("__match_args__")){const e=[];p.forEach((t=>{t.includeInInit&&!t.isKeywordOnly&&e.push(t.name)}));const t=e.map((e=>({type:Zs.cloneAsInstance(Zs.cloneWithLiteral(y,e)),isUnbounded:!1}))),n=Zs.cloneAsInstance(qa(_,t));f.set("__match_args__",Vo.createWithType(4,n))}const v=(n,i)=>{const r=Xs.createInstance(n,"","",64);Xs.addParameter(r,c),Xs.addParameter(r,{category:0,name:"other",type:i,hasDeclaredType:!0}),r.details.declaredReturnType=e.getBuiltInObject(t,"bool"),f.set(n,Vo.createWithType(4,r))};if(Zs.isSkipSynthesizedDataClassEq(n)||v("__eq__",e.getBuiltInObject(t,"object")),Zs.isSynthesizedDataclassOrder(n)){const e=Zs.cloneAsInstance(n);["__lt__","__le__","__gt__","__ge__"].forEach((t=>{v(t,e)}))}let T=!Zs.isSkipSynthesizedDataClassEq(n)&&Zs.isFrozenDataClass(n);const b=!Zs.isSkipSynthesizedDataClassEq(n)&&!Zs.isFrozenDataClass(n);if(s&&(T=!1),Zs.isSynthesizeDataClassUnsafeHash(n)&&(T=!0),T){const n=Xs.createInstance("__hash__","","",64);Xs.addParameter(n,c),n.details.declaredReturnType=e.getBuiltInObject(t,"int"),f.set("__hash__",Vo.createWithType(4,n))}else b&&!s&&f.set("__hash__",Vo.createWithType(4,to.createInstance()));let I=e.getBuiltInType(t,"dict");_o(I)&&(I=Zs.cloneAsInstance(Zs.cloneForSpecialization(I,[e.getBuiltInObject(t,"str"),io.create()],!0))),f.set("__dataclass_fields__",Vo.createWithType(4,I)),Zs.isGeneratedDataClassSlots(n)&&void 0===n.details.localSlotsNames&&(n.details.localSlotsNames=u.map((e=>e.name))),Uu(n,p.map((e=>e.type)),!0)}(li,e,s,t,n,i)}if(s.details.localSlotsNames){let e=!0;const t=[...s.details.localSlotsNames];s.details.baseClasses.forEach((n=>{_o(n)?Zs.isBuiltIn(n,"object")||Zs.isBuiltIn(n,"type")||Zs.isBuiltIn(n,"Generic")||(void 0===n.details.inheritedSlotsNames?e=!1:t.push(...n.details.inheritedSlotsNames)):e=!1})),e&&(s.details.inheritedSlotsNames=t)}return N(e.name,s,0,!1),N(e,I,0,!1),function(e,t,n){const i=n.length>0?n[0].node.name:e.name,r=Ne(i,t,"__init_subclass__",{method:"get"},void 0,133,t);if(r){const e=r.type;e&&et(i,n,e,void 0,!1,to.createInstance())}else if(t.details.effectiveMetaclass&&yo(t.details.effectiveMetaclass)){const r=va(t.details.effectiveMetaclass,"__new__",32);if(r){const t=Bn(r);if(Eo(t)){const r=Ho(t);if(void 0!==r.firstKeywordOnlyIndex){const s=new Map;for(let e=r.firstKeywordOnlyIndex;e{var i,r;const s=e.parameters[n];return(null===(i=s.name)||void 0===i?void 0:i.value)===(null===(r=t.name)||void 0===r?void 0:r.value)&&s.category===t.category}))){const t=i.parameters[n],s=null!==(r=t.typeAnnotation)&&void 0!==r?r:t.typeAnnotationComment;if(s){let t=G(s,e.parameters[n].category);const i=qt(e);return i.isInPyTypedPackage&&!i.isStubFile&&(t=Ks.cloneForAmbiguousType(t)),t}}}}}const s=e.parameters[n].defaultValue;if(s){const t=$(s,void 0,1).type;let n;if(lo(t)?n=Oo([to.createInstance(),Ys.create()]):vo(t)&&Zs.isBuiltIn(t,["tuple","list","set","dict"])||(n=Qo(t)),n){const t=qt(e);t.isInPyTypedPackage&&!t.isStubFile&&(n=Ks.cloneForAmbiguousType(n))}return n}}function Xt(e,t,n){switch(t){case 0:return n;case 1:return bo(n)&&n.paramSpecAccess?n:xo(n)?Zs.cloneForUnpacked(n,!1):T&&_o(T)?Zs.cloneAsInstance(qa(T,[{type:n,isUnbounded:!Io(n)}],!0,!0)):Ys.create();case 2:{if(bo(n)&&n.paramSpecAccess)return n;if(vo(n)&&Zs.isTypedDictClass(n)&&n.isUnpacked)return n;const t=xn(e,"dict"),i=Cn(e,"str");return _o(t)&&vo(i)?Zs.cloneAsInstance(Zs.cloneForSpecialization(t,[i,n],!0)):Ys.create()}}}function en(e,t){const n=qt(e);let i=0;"__new__"===e.name.value&&t&&(i|=1),"__init_subclass__"===e.name.value&&t&&(i|=2);for(const r of e.decorators){let e=n.isStubFile?4:0;9!==r.expression.nodeType&&(e|=2);const s=$(r.expression,void 0,e).type;Eo(s)?"abstractmethod"===s.details.builtInName?t&&(i|=8):"final"===s.details.builtInName&&(i|=8192):_o(s)&&(Zs.isBuiltIn(s,"staticmethod")?t&&(i|=4):Zs.isBuiltIn(s,"classmethod")&&t&&(i|=2))}return i}function tn(e,t,n,i){let r=qt(n).isStubFile?4:0;9!==n.expression.nodeType&&(r|=2);const s=$(n.expression,void 0,r).type;if((_o(s)&&Zs.isSpecialBuiltIn(s,"overload")||Eo(s)&&"overload"===s.details.builtInName)&&Eo(e))return e.details.flags|=256,t.details.flags|=256,e;if(9===n.expression.nodeType){const i=$(n.expression.leftExpression,void 0,2|r).type;if(Eo(i)&&("__dataclass_transform__"===i.details.name||"dataclass_transform"===i.details.builtInName))return t.details.decoratorDataClassBehaviors=Vu(li,n.expression),e}let o=J(n,e);if(Eo(s)){if("abstractmethod"===s.details.builtInName)return e;if(35===n.expression.nodeType){const t=$(n.expression.leftExpression,void 0,2|r).type;if(ua(t)){const r=n.expression.memberName.value;if("setter"===r)return Eo(e)?($u(li,e,n),function(e,t,n,i){if(!ua(t))return t;const r=t,s=r.details.flags;let o=!!r.isAsymmetricDescriptor;const a=qt(i);if(i.parameters.length>=2){const t=e.getTypeAnnotationForParameter(i,1);if(t){const n=e.getGetterTypeFromProperty(r,!1);if(n&&!ho(n)){const i=e.getTypeOfAnnotation(t,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});if("none"!==a.diagnosticRuleSet.reportPropertyTypeMismatch){const r=new il;e.canAssignType(n,i,r)||e.addDiagnostic(a.diagnosticRuleSet.reportPropertyTypeMismatch,$o.reportPropertyTypeMismatch,ml.Diagnostic.setterGetterTypeMismatch()+r.getString(),t)}Ao(n,i)||(o=!0)}}}const l=Zs.createInstantiable(r.details.name,r.details.fullName,r.details.moduleName,qt(i).filePath,s,r.details.typeSourceId,r.details.declaredMetaclass,r.details.effectiveMetaclass);l.details.typeVarScopeId=r.details.typeVarScopeId,Ha(l);const c=Zs.cloneAsInstance(l);l.isAsymmetricDescriptor=o;const u=l.details.fields;r.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||u.set(t,e)}));const p=Vo.createWithType(4,n);u.set("fset",p);const d=Xs.createInstance("__set__","","",64);Xs.addParameter(d,{category:0,name:"self",type:t,hasDeclaredType:!0});let h=n.details.parameters.length>0?n.details.parameters[0].type:io.create();bo(h)&&h.details.isSynthesizedSelf&&(h=e.makeTopLevelTypeVarsConcrete(h)),Xs.addParameter(d,{category:0,name:"obj",type:Oo([h,to.createInstance()]),hasDeclaredType:!0}),d.details.declaredReturnType=to.createInstance();let m=Ys.create();n.details.parameters.length>=2&&0===n.details.parameters[1].category&&n.details.parameters[1].name&&(m=n.details.parameters[1].type),Xs.addParameter(d,{category:0,name:"value",type:m,hasDeclaredType:!0});const f=Vo.createWithType(4,d);return u.set("__set__",f),c}(li,t,e,i)):e;if("deleter"===r)return Eo(e)?($u(li,e,n),function(e,t,n,i){var r;if(!ua(t))return t;const s=t,o=Zs.createInstantiable(s.details.name,s.details.fullName,s.details.moduleName,qt(i).filePath,s.details.flags,s.details.typeSourceId,s.details.declaredMetaclass,s.details.effectiveMetaclass);o.details.typeVarScopeId=s.details.typeVarScopeId,Ha(o);const a=Zs.cloneAsInstance(o);o.isAsymmetricDescriptor=null!==(r=s.isAsymmetricDescriptor)&&void 0!==r&&r;const l=o.details.fields;s.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||l.set(t,e)}));const c=Vo.createWithType(4,n);l.set("fdel",c);const u=Xs.createInstance("__delete__","","",64);Xs.addParameter(u,{category:0,name:"self",type:t,hasDeclaredType:!0});let p=n.details.parameters.length>0?n.details.parameters[0].type:io.create();bo(p)&&p.details.isSynthesizedSelf&&(p=e.makeTopLevelTypeVarsConcrete(p)),Xs.addParameter(u,{category:0,name:"obj",type:Oo([p,to.createInstance()]),hasDeclaredType:!0}),u.details.declaredReturnType=to.createInstance();const d=Vo.createWithType(4,u);return l.set("__delete__",d),a}(li,t,e,i)):e}}}else if(_o(s)){if(Zs.isBuiltIn(s))switch(s.details.name){case"classmethod":case"staticmethod":{const t="classmethod"===s.details.name?2:4;if(Eo(e)&&0==(e.details.flags&t)){const n=Xs.clone(e);return n.details.flags&=-8,n.details.flags|=t,n}return e}}if(Zs.isPropertyClass(s)){if(Eo(e))return $u(li,e,n),Hu(li,n,s,e);if(vo(e)){const t=_a(e,"__call__");if(t){const i=Bn(t);if(Eo(i)||ko(i)){const t=ri(e,i);if(t&&Eo(t))return Hu(li,n,s,t)}}return Ys.create()}}}return Eo(e)&&Eo(o)&&(o=Xs.clone(o),Xs.isOverloaded(e)&&(o.details.flags|=256),o.details.docString||(o.details.docString=e.details.docString)),o}function nn(e,t,n){let i;if(vo(t)&&Zs.isBuiltIn(t))if("Generator"===t.details.name){const n=ce(e,"AsyncGenerator");if(n&&_o(n)){const e=[],r=t.typeArguments;r&&r.length>0&&e.push(r[0]),r&&r.length>1&&e.push(r[1]),i=Zs.cloneAsInstance(Zs.cloneForSpecialization(n,e,!0))}}else["AsyncGenerator","AsyncIterator","AsyncIterable"].some((e=>e===t.details.name))&&(i=t);if(!i||!n){const n=ce(e,"Coroutine");i=n&&_o(n)?Zs.cloneAsInstance(Zs.cloneForSpecialization(n,[io.create(),io.create(),t],!0)):Ys.create()}return i}function rn(e,t){var n;if(e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation))return;let r=F(e.suite,0);if(r)return r;if(!i.has(e.id)){i.set(e.id,!0);try{let n;const s=Mt(e);s&&(n=s);const o=!de(e),a=de(e.suite);if(qt(e).isStubFile)r=Ys.create();else{if(o)r=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=$(t.typeExpression).type,n=_o(e)||vo(e)?e:void 0;if(!n||!Zs.isBuiltIn(n,"NotImplementedError"))return!1}return!0}(n)?Ys.create():no.createNoReturn();else{const e=[];(null==n?void 0:n.returnStatements)&&n.returnStatements.forEach((t=>{if(pe(t))if(t.returnExpression){const n=$(t.returnExpression).type;e.push(n||Ys.create())}else e.push(to.createInstance())})),!o&&a&&e.push(to.createInstance()),r=Oo(e),r=Ro(r)}if(null==n?void 0:n.isGenerator){const t=[];let i=!1;n.yieldStatements&&n.yieldStatements.forEach((e=>{if(pe(e))if(61===e.nodeType){const n=$(e.expression).type;if(vo(n)&&Zs.isBuiltIn(n,"Coroutine"))t.push(),i=!0;else{const i=ae(n,!1,e);t.push(i||Ys.create())}}else if(e.expression){const n=$(e.expression).type;t.push(n||Ys.create())}else t.push(to.createInstance())})),0===t.length&&t.push(to.createInstance());const s=Oo(t),o=ce(e,i?"AwaitableGenerator":"Generator");if(o&&_o(o)){const e=[];i&&e.push(io.create()),e.push(s,to.createInstance(),ao(r)?to.createInstance():r),r=Zs.cloneAsInstance(Zs.cloneForSpecialization(o,e,!0))}else r=Ys.create()}}N(e.suite,r,0,!1)}finally{i.delete(e.id)}}return r}function sn(e){if(F(e,0))return;const t=$(e.iterableExpression),n=ae(t.type,!!e.isAsync,e.iterableExpression)||Ys.create();xe(e.targetExpression,n,!!t.isIncomplete,e.targetExpression),N(e,n,0,!!t.isIncomplete)}function on(e){if(w(void 0!==e.typeExpression),F(e,0))return;function t(e,t){return ho(e=Ie(e))?e:_o(e)?Zs.cloneAsInstance(e):vo(e)?Ko(ae(e,!1,t)||Ys.create(),(e=>ho(e)?e:Ys.create())):Ys.create()}const n=Ko($(e.typeExpression).type,(n=>{const i=ia(n);return i&&i.tupleTypeArguments?Oo(i.tupleTypeArguments.map((n=>t(n.type,e.typeExpression)))):t(n,e.typeExpression)}));e.name&&xe(e.name,n,!1,e.name),N(e,n,0,!1)}function an(e){if(F(e,0))return;const t=$(e.expression);let n=t.type;const i=e.parent&&58===e.parent.nodeType&&!!e.parent.isAsync;Go(n)&&(_e(qt(e).diagnosticRuleSet.reportOptionalContextManager,$o.reportOptionalContextManager,ml.Diagnostic.noneNotUsableWith(),e.expression),n=Fo(n));const r=i?"__aenter__":"__enter__",s=Ko(n,(t=>{var n;if(ho(t=Ie(t)))return t;const s=new il,o=new il;if(vo(t)){const a=null===(n=ee(e.expression,t,r,{method:"get"},s))||void 0===n?void 0:n.type;if(a){let t;return t=Eo(a)?Un(a):Ys.create(),i&&(t=oe(t,e)),t}i||ee(e.expression,t,"__aenter__",{method:"get"},s)&&o.addMessage(ml.DiagnosticAddendum.asyncHelp())}return _e(qt(e).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeNotUsableWith().format({type:ai(t),method:r})+o.getString(),e.expression),Ys.create()})),o=i?"__aexit__":"__exit__";Jo(n,(t=>{if(ho(t=Ie(t)))return;const n=new il;vo(t)&&ee(e.expression,t,o,{method:"get"},n)||_e(qt(e).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeNotUsableWith().format({type:ai(t),method:o}),e.expression)})),e.target&&xe(e.target,s,!!t.isIncomplete,e.target),N(e,s,0,!!t.isIncomplete)}function ln(e){if(F(e,0))return;let t;if(t=e.alias?e.alias:e.module.nameParts[0],!t)return;let n=dn(e,t.value)||Ys.create();const i=F(e,0);i&&To(i)&&n&&Ao(n,i)&&(n=i),Te(t,n,!1),N(e,n,0,!1)}function cn(t){var n;if(F(t,0))return;const i=t.alias||t.name,r=qt(t);if((null===(n=t.alias)||void 0===n?void 0:n.value)===t.name.value){const e=wn(t,t.name.value,!0);e&&we(r,e.symbol,t)}let s=dn(t,i.value);if(!s){const n=t.parent;w(n&&22===n.nodeType),w(!n.isWildcardImport);const i=Rt(n.module);if(i&&i.isImportFound&&!i.isNativeLib){const n=i.resolvedPaths[i.resolvedPaths.length-1],o=e(n);let a=!1;if(o){if(a=!0,r.executionEnvironment.pythonVersion>=De.V3_7||r.isStubFile){const e=o.symbolTable.get("__getattr__");if(e){const t=Nn(e);Eo(t)&&(s=Un(t),a=!1)}}}else n||(a=!0);a&&_e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.importSymbolUnknown().format({name:t.name.value,moduleName:i.importName}),t.name)}s||(s=Ys.create())}Te(i,s,!1),N(t,s,0,!1)}function un(e){if(F(e,0))return;if(!e.parent||63!==e.parent.nodeType)return void E("Expected parent of case statement to be match statement");const t=$(e.parent.subjectExpression);let n=t.type;for(const t of e.parent.cases){if(t===e)break;t.guardExpression||(n=fu(li,n,t.pattern,!1))}let i=!1;Jo(Ie(n),(e=>{vo(e)&&Zs.isBuiltIn(e,"object")&&(i=!0)})),n=fu(li,n,e.pattern,!0),bu(li,n,!!t.isIncomplete,i,e.pattern),N(e,n,0,!!t.isIncomplete)}function pn(e){if(F(e,0))return;const t=e.module.nameParts[0];let n=dn(e,t.value)||Ys.create();const i=F(e,0);i&&To(i)&&n&&Ao(n,i)&&(n=i),Te(t,n,!1),N(e,n,0,!1)}function dn(e,n){const i=wn(e,n,!0);if(!i)return;const r=i.symbol.getDeclarations().filter((t=>Mr(e,t.node)&&6===t.type));let s=r.length>0?r[r.length-1]:void 0;if(s||(s=i.symbol.getDeclarations().find((e=>6===e.type))),!s)return;w(6===s.type);const o=qt(e),a=Fn(s,!0,o.isStubFile);if(a){if(!a.declaration)return t.evaluateUnknownImportsAsAny?io.create():Ys.create();if(23===e.nodeType&&(a.isPrivate&&_e(o.diagnosticRuleSet.reportPrivateUsage,$o.reportPrivateUsage,ml.Diagnostic.privateUsedOutsideOfModule().format({name:e.name.value}),e.name),a.privatePyTypedImporter)){const t=new il;a.privatePyTypedImported&&t.addMessage(ml.DiagnosticAddendum.privateImportFromPyTypedSource().format({module:a.privatePyTypedImported})),_e(o.diagnosticRuleSet.reportPrivateImportUsage,$o.reportPrivateImportUsage,ml.Diagnostic.privateImportFromPyTypedModule().format({name:e.name.value,module:a.privatePyTypedImporter})+t.getString(),e.name)}return Pn(i.symbol,s)}}function hn(e){var t,n,i;let r=e,s=e;function o(e){var t,n,i,r,s;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===(r=e.parent)||void 0===r?void 0:r.nodeType)||41===(null===(s=e.parent)||void 0===s?void 0:s.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||48===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 Gt(e.parent);if(10===e.parent.nodeType&&e.parent.name===e)return void $t(e.parent);if(29===e.parent.nodeType||39===e.parent.nodeType)return void $(e,void 0,4)}for(;s;){const e=o(s);if(!e&&!yr(s))break;e&&(r=s),s=s.parent}const a=r.parent;if(3===a.nodeType)return void(r===a.typeAnnotationComment?K(r,{isVariableAnnotation:!0,allowFinal:Fr(a.leftExpression),allowClassVar:Nr(a.leftExpression)}):Wt(a));if(14===a.nodeType)return void Ce(r);if(5===a.nodeType)return void jt(a);if(13===a.nodeType)return void(10===(null===(t=a.parent)||void 0===t?void 0:t.nodeType)?$t(a.parent):28===(null===(n=a.parent)||void 0===n?void 0:n.nodeType)&&Gt(a.parent));const l=e=>{const t=e.parent;if(3===(null==t?void 0:t.nodeType)&&t.leftExpression===a)Wt(t);else{const t=K(e.typeAnnotation,{isVariableAnnotation:!0,allowFinal:Fr(e.valueExpression),allowClassVar:Nr(e.valueExpression)});N(e.valueExpression,t,0,!1)}};if(64===a.nodeType&&r!==a.guardExpression)return void un(a);if(54===a.nodeType)return void l(a);if(41===a.nodeType&&r!==a.defaultValue)return void mn(a);if(28===a.nodeType&&(r===a.returnTypeAnnotation||r===a.functionAnnotationComment))return void K(r,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});if(37===a.nodeType)return;if(1===a.nodeType&&r===a.name)return;if(1===a.nodeType&&10===(null===(i=a.parent)||void 0===i?void 0:i.nodeType))return void $t(a.parent);if(44===a.nodeType&&a.returnExpression){const t=kr(e),n=t?qn(t):void 0;return void $(a.returnExpression,n,0)}const c=yr(a)&&0!==a.nodeType?a:r;54===c.nodeType?l(c):$(c,void 0,qt(c).isStubFile?4:0)}function mn(e){if(!e.name)return;const t=e.parent;if(30===t.nodeType)return void hn(t);w(28===t.nodeType);const n=t,i=n.parameters.findIndex((t=>t===e)),r=ie(n,i);if(r){const t=n.parameters[i],s=G(r,n.parameters[i].category),o=Xt(e,e.category,Jt(t,s));return void N(e.name,o,0,!1)}const s=Er(n,!0);if(s){const t=$t(s);if(t){const r=Qt(n,en(n,!0),i,t.classType);if(r)return void N(e.name,Xt(e,e.category,r),0,!1)}}N(e.name,Xt(e,e.category,Ys.create()),0,!1)}function fn(e){z(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 Wt(t);break;case 4:return void $(t);case 5:return void jt(t);case 10:return void $t(t);case 41:return void mn(t);case 30:return void hn(t);case 28:return void Gt(t);case 26:return void sn(t);case 25:return void on(t);case 59:return void an(t);case 33:{const e=t.parent;if(w(32===e.nodeType),t===e.expression)hn(e);else for(const n of e.forIfNodes)if(Ct(n),n===t)break;return}case 21:return void ln(t);case 23:return void cn(t);case 22:return void pn(t);case 64:return void un(t)}t=t.parent}E("Unexpected statement")}function gn(e,t){let n=F(e,void 0);if(n)return{node:e,type:n};const i=C;try{if(C=new Map,t(),n=F(e,void 0),n)return{node:e,type:n};if(n=C.get(e.id),n)return{node:e,type:n,isIncomplete:!0};C=i}catch(e){throw C=i,e}}function yn(e){let t=r.get(e);return t||(t=ci.createCodeFlowAnalyzer(),r.set(e,t)),t}function _n(e,t,n,i,r){var s;const o=At(e),a=Rr(null!==(s=null==r?void 0:r.parent)&&void 0!==s?s:e),l=a.codeFlowExpressions;if(!l||!l.has(o))return{type:void 0,isIncomplete:!1};let c;c=L(a)?function(){const e=D.length;return w(e>0),D[e-1].codeFlowAnalyzer}():yn(a.id);const u=Lt(null!=r?r:e);return void 0===u?{type:void 0,isIncomplete:!1}:vn(c,u,e,t,n,i)}function vn(e,t,n,i,r,s){let o;d.enterTrackingScope();try{o=e.getTypeFromCodeFlow(t,n,i,r,s),d.exitTrackingScope()}catch(e){throw d.exitTrackingScope(),e}return o.isIncomplete&&d.enableUndoTracking(),o}function Tn(e,t,n,i){if(Zs.isSpecialBuiltIn(e)){const r=e.aliasName||e.details.name;switch(r){case"Callable":return function(e,t){const n=Xs.createInstantiable("","","",0);Ks.setSpecialForm(n),n.details.declaredReturnType=Ys.create();const i=Dr(t);if(n.details.typeVarScopeId=i?Pe(i):$s,e&&e.length>0){if(e[0].typeList){const t=e[0].typeList;let i=!1,r=!1;const s=e=>{i&&(r||(fe(ml.Diagnostic.variadicTypeArgsTooMany(),e.node),r=!0)),i=!0};t.forEach(((e,t)=>{let i=e.type,r=0;const o=`__p${t.toString()}`;Io(i)?(Oe(i,e.node),r=1,s(e)):Et(e,{allowUnpackedTuples:!0})?xo(i)&&(r=1,s(e)):i=Ys.create(),Xs.addParameter(n,{category:r,name:o,isNameSynthesized:!0,type:Fa(i),hasDeclaredType:!0})})),Xs.addParameter(n,{category:0,isNameSynthesized:!1,type:Ys.create()})}else if(ca(e[0].type))Xs.addDefaultParameters(n),n.details.flags|=32768;else if(wo(e[0].type))n.details.paramSpec=e[0].type;else if(_o(e[0].type)&&Zs.isBuiltIn(e[0].type,"Concatenate")){const t=e[0].type.typeArguments;t&&t.length>0&&t.forEach(((e,i)=>{i===t.length-1?(Xs.addParameter(n,{category:0,isNameSynthesized:!1,type:Ys.create()}),wo(e)&&(n.details.paramSpec=e)):Xs.addParameter(n,{category:0,name:`__p${i}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})}))}else fe(ml.Diagnostic.callableFirstArg(),e[0].node);if(e.length>1){let t=e[1].type;Et(e[1])||(t=Ys.create()),n.details.declaredReturnType=Fa(t)}else _e(qt(t).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.callableSecondArg(),t),n.details.declaredReturnType=Ys.create();e.length>2&&fe(ml.Diagnostic.callableExtraArgs(),e[2].node)}else Xs.addDefaultParameters(n,!0),n.details.flags|=32768;return n}(t,i);case"Never":return t&&t.length>0&&fe(ml.Diagnostic.typeArgsExpectingNone().format({name:"Never"}),t[0].node),no.createNever();case"NoReturn":return t&&t.length>0&&fe(ml.Diagnostic.typeArgsExpectingNone().format({name:"NoReturn"}),t[0].node),no.createNoReturn();case"Optional":return function(e,t,n,i){if(!n)return 0!=(1024&i)?(fe(ml.Diagnostic.optionalExtraArgs(),t),Ys.create()):e;if(n.length>1)return fe(ml.Diagnostic.optionalExtraArgs(),t),Ys.create();let r=n[0].type;Et(n[0])?Ks.isInstantiable(r)||(ve(r,n[0].node),r=Ys.create()):r=Ys.create();const s=Oo([r,to.createType()]);return fo(s)&&Ks.setSpecialForm(s),s}(e,i,t,n);case"Type":{if(1===(null==t?void 0:t.length)&&ho(t[0].type)&&_&&_o(_))return _;let n=Ot(e,t,1);return _o(n)&&(n=Ua(n)),n}case"ClassVar":return function(e,t,n,i){var r;if(131072&i)return fe(ml.Diagnostic.classVarNotAllowed(),t),io.create();if(!n)return e;if(0===n.length)return fe(ml.Diagnostic.classVarFirstArgMissing(),t),Ys.create();if(n.length>1)return fe(ml.Diagnostic.classVarTooManyArgs(),n[1].node),Ys.create();const s=n[0].type;return $a(s,!0,!0)&&_e(qt(t).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.classVarWithTypeVar(),null!==(r=n[0].node)&&void 0!==r?r:t),s}(e,i,t,n);case"Protocol":return Ot(e,t,void 0,!0);case"Tuple":return Ot(e,t,void 0);case"Union":return function(e,t,n,i){const r=[];if(!n)return 0!=(1024&i)?(fe(ml.Diagnostic.unionTypeArgCount(),t),no.createNever()):e;for(const e of n){let t=e.type;Et(e,{allowVariadicTypeVar:!0,allowUnpackedTuples:!0})?Ks.isInstantiable(t)||(ve(t,e.node),t=Ys.create()):t=Ys.create(),xo(e.type)&&e.type.tupleTypeArguments?e.type.tupleTypeArguments.forEach((e=>{r.push(Na(e.type))})):(bo(t)&&Io(t)&&t.isVariadicUnpacked&&(t=oo.cloneForUnpacked(t,!0)),r.push(t))}1===r.length&&(Io(r[0])||Co(r[0])||lo(r[0])||fe(ml.Diagnostic.unionTypeArgCount(),t));const s=Oo(r);return fo(s)&&Ks.setSpecialForm(s),s}(e,i,t,n);case"Generic":return function(e,t,n,i){if(!n)return 0!=(263168&i)&&fe(ml.Diagnostic.genericTypeArgMissing(),t),e;const r=[];return n&&(0===n.length&&fe(ml.Diagnostic.genericTypeArgMissing(),t),n.forEach((e=>{bo(e.type)?(r.some((t=>Ao(t,e.type)))&&fe(ml.Diagnostic.genericTypeArgUnique(),e.node),r.push(e.type)):fe(ml.Diagnostic.genericTypeArgTypeVar(),e.node)}))),Ot(e,n,void 0,!0)}(e,i,t,n);case"Final":return function(e,t,n,i){return 16&i?(fe(ml.Diagnostic.finalContext(),t),io.create()):n&&0!==n.length?(n.length>1&&fe(ml.Diagnostic.finalTooManyArgs(),t),n[0].type):e}(e,i,t,n);case"Annotated":return function(e,t){return t&&t.length<2&&fe(ml.Diagnostic.annotatedTypeArgMissing(),e),t&&0!==t.length?Ks.cloneForAnnotated(t[0].type):io.create()}(i,t);case"Concatenate":return function(e,t,n){return n&&0!==n.length?n.forEach(((e,t)=>{t===n.length-1?wo(e.type)||fe(ml.Diagnostic.concatenateParamSpecMissing(),e.node):wo(e.type)&&fe(ml.Diagnostic.paramSpecContext(),e.node)})):fe(ml.Diagnostic.concatenateTypeArgsMissing(),e),Ot(t,n,void 0,!0)}(i,e,t);case"TypeGuard":case"StrictTypeGuard":return function(e,t,n,i){if(!n)return 0!=(1024&i)&&fe(ml.Diagnostic.typeGuardArgCount(),e),t;if(1!==n.length)return fe(ml.Diagnostic.typeGuardArgCount(),e),Ys.create();const r=n.map((e=>Fa(Et(e)?e.type:Ys.create())));return Zs.cloneForSpecialization(t,r,!0)}(i,e,t,n);case"Unpack":return function(e,t,n){if(!t||1!==t.length)return fe(ml.Diagnostic.unpackArgCount(),e),Ys.create();let i=t[0].type;fo(i)&&1===i.subtypes.length&&(i=i.subtypes[0]);const r=qt(e);return 0!=(2097152&n)?_o(i)&&!i.includeSubclasses&&pa(i)?Zs.cloneForUnpacked(i):Io(i)&&!i.isVariadicUnpacked?oo.cloneForUnpacked(i):(_e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.unpackExpectedTypeVarTuple(),e),Ys.create()):0!=(8388608&n)?_o(i)&&Zs.isTypedDictClass(i)?Zs.cloneForUnpacked(i):(_e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.unpackExpectedTypedDict(),e),Ys.create()):(_e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.unpackNotAllowed(),e),Ys.create())}(i,t,n);case"Required":case"NotRequired":return function(e,t,n,i,r){var s;if(!i&&0==(1024&r))return e;if(!i||1!==i.length)return fe(n?ml.Diagnostic.requiredArgCount():ml.Diagnostic.notRequiredArgCount(),t),e;const o=i[0].type,a=Er(t,!0),l=a?$t(a):void 0;let c=!1;return l&&_o(l.classType)&&Zs.isTypedDictClass(l.classType)&&54===(null===(s=t.parent)||void 0===s?void 0:s.nodeType)&&t.parent.typeAnnotation===t&&(c=!0),0!=(1048576&r)&&(c=!0),c?o:(fe(n?ml.Diagnostic.requiredNotInTypedDict():ml.Diagnostic.notRequiredNotInTypedDict(),t),Zs.cloneForSpecialization(e,[Fa(o)],!!i))}(e,i,"Required"===r,t,n);case"Self":return function(e,t,n){var i;const r=qt(t);n&&_e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeArgsExpectingNone().format({name:e.details.name}),null!==(i=n[0].node)&&void 0!==i?i:t);const s=Er(t),o=s?$t(s):void 0;if(!o)return _e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.selfTypeContext(),t),Ys.create();const a=kr(t);if(a){if(4&en(a,!0))return _e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.selfTypeContext(),t),Ys.create();if(a.parameters.length>0){const e=ie(a,0);if(e&&!Mr(t,e)){const n=K(e,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});bo(n)&&n.details.isSynthesizedSelf||_e(r.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.selfTypeWithTypedSelfOrCls(),t)}}}return Aa(o.classType,!0)}(e,i,t);case"LiteralString":return Ot(e,t,0)}}const r=qt(i);if(r.isStubFile||r.executionEnvironment.pythonVersion>=De.V3_9||H(qt(i))||0!=(4&n)){if(Zs.isBuiltIn(e,"type")&&t){if(1===t.length&&ho(t[0].type))return e;const n=ce(i,"Type");if(n&&_o(n)){let e=Ot(n,t,1,void 0,!0);return _o(e)&&(e=Ua(e)),e}}if(pa(e))return Ot(e,t,void 0,void 0,!0)}let s=t?t.length:0;const o=Zs.isPseudoGenericClass(e)?[]:Zs.getTypeParameters(e);if(0===o.length&&0===s)return e;const a=o.findIndex((e=>Io(e)));if(t){if(s>o.length){if(!Zs.isPartiallyConstructed(e)&&!Zs.isTupleClass(e)){const n=qt(i);0===o.length?_e(n.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeArgsExpectingNone().format({name:e.aliasName||e.details.name}),t[o.length].node):1===o.length&&wo(o[0])||_e(n.diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeArgsTooMany().format({name:e.aliasName||e.details.name,expected:o.length,received:s}),t[o.length].node)}s=o.length}else sGs)return t;if(r++,ho(t))return t;let s=t;if(bo(t)){if(Ao(t,e,void 0,void 0,r))return t;s=Ie(t)}if(e.details.boundType&&!Jn(e.details.boundType,s,n.createAddendum(),void 0,i,r))return void(e.details.isSynthesized||n.addMessage(ml.DiagnosticAddendum.typeBound().format({sourceType:ai(s),destType:ai(e.details.boundType),name:oo.getReadableName(e)})));if(e.details.isParamSpec)return wo(t)||Eo(t)&&Xs.isParamSpecValue(t)||vo(t)&&Zs.isBuiltIn(t,"Concatenate")?t:void n.addMessage(ml.DiagnosticAddendum.typeParamSpec().format({type:ai(t),name:oo.getReadableName(e)}));if(bo(t)&&t.details.isParamSpec)return void n.addMessage(ml.Diagnostic.paramSpecContext());const o=e.details.constraints;if(0===o.length)return t;if(bo(t)&&t.details.constraints.length>0){if(t.details.constraints.every((e=>o.some((t=>Jn(t,e,void 0,void 0,void 0,r))))))return t}else{let e;for(const t of o)Jn(t,s,void 0,void 0,void 0,r)&&(e&&!Jn(e,t,void 0,void 0,void 0,r)||(e=t));if(e)return e}n.addMessage(ml.DiagnosticAddendum.typeConstrainedTypeVar().format({type:ai(t),name:oo.getReadableName(e)}))}(o[n],e,i);r?e=r:vo(e)&&Zs.isPartiallyConstructed(e)||_e(qt(t[n].node).diagnosticRuleSet.reportGeneralTypeIssues,$o.reportGeneralTypeIssues,ml.Diagnostic.typeVarAssignmentMismatch().format({type:ai(e),name:oo.getReadableName(o[n])})+i.getString(),t[n].node)}return e})),Zs.cloneForSpecialization(e,l,void 0!==t)}function bn(e){return e.type?{type:e.type}:e.valueExpression?$(e.valueExpression):{type:Ys.create()}}function In(e){return e.type?{type:e.type}:Sn(e.valueExpression)}function Sn(e,t=!1,n=!1,i=!1){let r=131304;return qt(e).isStubFile?r|=4:r|=4194304,t||(r|=16),n&&(r|=1048576),$(e,void 0,r)}function xn(e,t){const n=zs(e);if(n){const e=function(e){let t=e;for(;4!==t.type;)t=t.parent;return t}(n).lookUpSymbol(t);if(e)return Nn(e)}return Ys.create()}function Cn(e,t,n){const i=xn(e,t);if(_o(i)){let e=i;return n&&(e=Zs.cloneForSpecialization(e,n,void 0!==n)),Zs.cloneAsInstance(e)}return i}function wn(e,t,n,i=!1){var r;const s=zs(e);let o=null==s?void 0:s.lookUpSymbolRecursive(t);const a=null!==(r=null==s?void 0:s.type)&&void 0!==r?r:3;if(o&&n&&1!==a&&0!==a&&0===o.symbol.getDeclarations().filter((t=>{if(6!==t.type&&0!==t.type){const n=Rr(e),i=4===t.type||3===t.type?t.node.name:t.node;if(n===Rr(i)&&!he(i,e)){const t=Lt(e);return!(t&&ci.isFlowNodeReachable(t))}}return!0})).length&&(o=1!==o.scope.type&&o.scope.parent?o.scope.parent.lookUpSymbolRecursive(t,o.isOutsideCallerModule||3===o.scope.type,o.isBeyondExecutionScope||o.scope.isIndependentlyExecutable()):void 0),o&&i){let e=o;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)||(o=e)}return o}function En(e,t){p.push(e);try{const e=t();return p.pop(),e}catch(e){throw p.pop(),e}}function kn(e,t,n=!0){c.enterSpeculativeContext(e,n);try{const e=t();return c.leaveSpeculativeContext(),e}catch(e){throw c.leaveSpeculativeContext(),e}}function Dn(e,t){if(Eo(e)&&e.details.declaration){const n=e.details.declaration;if(3===n.type){const e=Ft(n.node);if(e){const n=e.lookUpSymbol(t);if(n)return n.getDeclarations().find((e=>2===e.type))}}}}function An(e){var t,n;switch(e.type){case 0:{if("Any"===e.intrinsicType)return io.create();if("class"===e.intrinsicType){const t=$t(Er(e.node));return t?t.classType:void 0}const t=Cn(e.node,"str"),n=Cn(e.node,"int");if(vo(n)&&vo(t)){if("str"===e.intrinsicType)return t;if("str | None"===e.intrinsicType)return Oo([t,to.createInstance()]);if("int"===e.intrinsicType)return n;if("Iterable[str]"===e.intrinsicType){const n=xn(e.node,"Iterable");if(_o(n))return Zs.cloneAsInstance(Zs.cloneForSpecialization(n,[t],!0))}if("Dict[str, Any]"===e.intrinsicType){const n=xn(e.node,"dict");if(_o(n))return Zs.cloneAsInstance(Zs.cloneForSpecialization(n,[t,io.create()],!0))}}return Ys.create()}case 4:{const t=$t(e.node);return t?t.decoratedType:void 0}case 5:return K(e.node.typeAnnotation);case 3:{const t=Gt(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=ie(t,i)}}if(n){const t=G(n,e.node.category);return Xt(e.node,e.node.category,Jt(e.node,t))}return}case 1:{const t=e.typeAnnotationNode;if(t){const i=re(t)?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):void 0;let r;if(e.isRuntimeTypeExpression)r=Fa(Sn(t,!0,!0).type);else{const i=e.isDefinedByMemberAccess&&35===(null===(n=e.node.parent)||void 0===n?void 0:n.nodeType)?e.node.parent:e.node;r=K(t,{isVariableAnnotation:!0,allowClassVar:Nr(i),allowFinal:Fr(i)})}if(r)return 38===e.node.nodeType&&(r=Ut(e.node,(()=>r))||r),i&&38===i.valueExpression.nodeType&&(r=Vt(r,i.valueExpression,e.node)),r}return}case 6:return}}function Pn(n,i){var r,s;const o=Rn(i,!0,qt(i.node).isStubFile);if(!o)return t.evaluateUnknownImportsAsAny?io.create():Ys.create();function a(e,n,i){if(n.path&&n.loadSymbolsFromPath){const r=i(n.path);if(!r)return t.evaluateUnknownImportsAsAny?io.create():Ys.create();e.fields=r.symbolTable,e.docString=r.docString}return n.implicitImports&&n.implicitImports.forEach(((t,n)=>{const r=e.moduleName?e.moduleName+"."+n:"",s=a(Qs.create(r,t.path),t,i),o=Vo.createWithType(0,s);e.loaderFields.set(n,o)})),e}if(6===o.type){let t=o.moduleName;if(6===i.type&&(i.symbolName&&(t+="."+i.symbolName),t.startsWith("."))){const e=qt(i.node).moduleName.split(".");for(t=t.substr(1);t.startsWith(".")&&e.length>0;)t=t.substr(1),e.pop();t=e.join(".")+"."+t}const n=Qs.create(t,o.path);return o.symbolName&&o.submoduleFallback?a(n,o.submoduleFallback,e):a(n,o,e)}const l=An(o);if(l)return l;const c=qt(o.node);let u=!c.isInPyTypedPackage||c.isStubFile;if(!u&&1===o.type){const e=Er(o.node,!0);if(e){const t=$t(e);t&&Zs.isEnumClass(t.classType)&&(u=!0)}(o.isFinal||o.isConstant)&&(u=!0)}if(2===o.type)return null===(r=gn(o.node.name,(()=>{mn(o.node)})))||void 0===r?void 0:r.type;if(1===o.type&&o.inferredTypeSource){const e=o.typeAliasName&&o.inferredTypeSource.parent?o.inferredTypeSource.parent:o.inferredTypeSource;let t=null===(s=gn(o.node,(()=>{fn(e)})))||void 0===s?void 0:s.type;if(t&&38===o.node.nodeType){const e=Ut(o.node,(()=>{var e;return(null===(e=gn(o.inferredTypeSource,(()=>{fn(o.inferredTypeSource)})))||void 0===e?void 0:e.type)||Ys.create()}));e&&(t=e)}return t&&o.typeAliasName&&(!Ks.isInstantiable(t)||po(t)||ca(t)||(t=Vt(t,o.typeAliasName,o.node),u=!0)),t&&c.isInPyTypedPackage&&!c.isStubFile&&(u||function(e,t,n){var i;const r=e.getDeclarations().filter((e=>1!==e.type||!e.isInferenceAllowedInPyTyped));if(r.length>1)return!1;if(1!==t.type)return!1;if(0===r.length)return!0;if(bo(n))return!0;let s;const o=t.node.parent;if(o&&(3===o.nodeType?s=o:35===o.nodeType&&3===(null===(i=o.parent)||void 0===i?void 0:i.nodeType)&&(s=o.parent)),!s)return!1;const a=$(s.rightExpression).type;return!(!vo(a)||!ra(a))||38===s.rightExpression.nodeType&&!Ks.isAmbiguous(a)}(n,i,t)&&(u=!0),u||(t=Ks.cloneForAmbiguousType(t))),t}}function Rn(t,n,i=!1){var r;return null===(r=Rc(e,t,n,i))||void 0===r?void 0:r.declaration}function Fn(t,n,i=!1){return Rc(e,t,n,i)}function Nn(e){return Mn(e).type}function Mn(e,t,n=!1){if(e.hasTypedDeclarations()){const n=On(e,t);return{type:n||Ys.create(),isIncomplete:!1,includesVariableDecl:e.getTypedDeclarations().some((e=>1===e.type)),isRecursiveDefinition:!n}}let i=u.get(e.id);const r=t?t.id:void 0;if(i)for(const e of i)if(e.usageNodeId===r&&e.useLastDecl===n)return e.result;const s=[],o=e.getDeclarations(),a=Wo(e);let l,p=!1,d=!1,h=!1;if(n&&o.forEach(((e,t)=>{e.isInExceptSuite||(l=t)})),o.forEach(((n,i)=>{var r,o;let u=void 0===l||i===l;if(void 0!==t&&6!==n.type&&Rr(t)===Rr(n.node)&&(he(n.node,t)||(u=!1)),u){const t=ss(n);if((t||os(n))&&1===n.type&&3===(null===(o=null===(r=n.inferredTypeSource)||void 0===r?void 0:r.parent)||void 0===o?void 0:o.nodeType)&&(Wt(n.inferredTypeSource.parent),n.typeAliasAnnotation&&K(n.typeAliasAnnotation,{isVariableAnnotation:!0,allowFinal:Fr(n.node),allowClassVar:Nr(n.node)})),V(e,n))try{let i=Pn(e,n);if(q(e)||(p=!0),i){if(1===n.type){d=!0;let e=1===n.type&&!!n.isConstant;vo(i)&&Zs.isEnumClass(i)&&function(e){const t=Er(e.node,!0);if(!t)return!1;const n=$t(t);return!!n&&Zs.isEnumClass(n.classType)}(n)&&(e=!0),!Ks.isInstance(i)||t||e||a||(i=Qo(i))}s.push(i),c.isSpeculative(n.node)&&(h=!0)}else p=!0}catch(t){throw q(e),t}else p=!0}})),s.length>0){const t={type:Oo(s),isIncomplete:!1,includesVariableDecl:d,isRecursiveDefinition:!1};return h||(i||(i=[],u.set(e.id,i)),i.push({usageNodeId:r,useLastDecl:n,result:t})),t}return{type:Js.create(),isIncomplete:p,includesVariableDecl:d,isRecursiveDefinition:!1}}function On(e,t){const n=e.getSynthesizedType();if(n)return n;let i=e.getTypedDeclarations();if(0===i.length)return;if(i.length>1&&t){const e=i.filter((e=>!(6!==e.type&&Rr(t)===Rr(e.node)&&!he(e.node,t,!1))));e.length>0&&(i=e)}let r=i.length-1;for(;r>=0;){const t=i[r],n=W(e,t);if(n)return n;if(U(e,t)<0&&V(e,t))try{const n=An(t);if(q(e)||4===t.type)return n}catch(t){throw q(e),t}r--}}function Ln(e){Eo(e)?Un(e):ko(e)&&e.overloads.forEach((e=>{Un(e)}))}function Un(e,t,n=!0){return Xs.getSpecializedReturnType(e)||(n?Vn(e,t):Ys.create())}function Vn(e,n){var i;let r;if(Xs.isStubDefinition(e))return Ys.create();if(e.inferredReturnType)r=e.inferredReturnType;else{if(Xs.isInstanceMethod(e)&&"__init__"===e.details.name)r=to.createInstance();else if(e.details.declaration){const n=e.details.declaration.node;if(t.analyzeUnannotatedFunctions){const t=function(e){var t;return null!==(t=e.codeFlowComplexity)&&void 0!==t?t:0}(n);(e.details.parameters.length<=1||e.details.parameters.some((e=>e.hasDeclaredType))||t<15)&&(function(t){const i=c.disableSpeculativeMode();try{r=rn(n,Xs.isAbstractMethod(e)),c.enableSpeculativeMode(i)}catch(e){throw c.enableSpeculativeMode(i),e}}(),r&&Xs.isWrapReturnTypeInAwait(e)&&(r=nn(n,r,!!(null===(i=e.details.declaration)||void 0===i?void 0:i.isGenerator))))}}r||(r=Ys.create()),e.inferredReturnType=r}if(t.analyzeUnannotatedFunctions&&La(r)&&Xs.hasUnannotatedParams(e)&&!Xs.isStubDefinition(e)&&!Xs.isPyTypedDefinition(e)&&n){const t=function(e,t){var n;let i;if(!e.details.declaration)return;const r=e.details.declaration.node;if(t.some((e=>!e.paramName)))return;if(D.some((e=>e.functionNode===r)))return;const s=Gt(r);return s&&!(t.length>6||D.length>=2)?(En(r,(()=>{const n=A;D.push({functionNode:r,codeFlowAnalyzer:ci.createCodeFlowAnalyzer()});try{A=new Map;let o=!0;r.parameters.forEach(((e,n)=>{if(e.name){let i;const a=t.find((t=>e.name.value===t.paramName));a&&a.argument.valueExpression?(i=$(a.argument.valueExpression).type,po(i)||(o=!1)):e.defaultValue?(i=$(e.defaultValue).type,po(i)||(o=!1)):0===n&&(Xs.isInstanceMethod(s.functionType)||Xs.isClassMethod(s.functionType))&&s.functionType.details.parameters.length>0&&r.parameters[0].name&&(i=s.functionType.details.parameters[0].type),i||(i=Ys.create()),N(e.name,i,0,!1)}})),o||(i=rn(r,Xs.isAbstractMethod(e)))}finally{D.pop(),A=n}})),i?(i=Ro(i),Xs.isWrapReturnTypeInAwait(e)&&!ao(i)&&(i=nn(r,i,!!(null===(n=e.details.declaration)||void 0===n?void 0:n.isGenerator))),i):void 0):void 0}(e,n);t&&(r=t)}return r}function qn(e){const t=Gt(e);return t?Xs.isAbstractMethod(t.functionType)?io.create():Xs.isGenerator(t.functionType)?Pa(t.functionType):t.functionType.details.declaredReturnType:io.create()}function Bn(e){return _o(e.classType)?ha(Nn(e.symbol),e.classType):Ys.create()}function Wn(e,t,n,i,r,s,o){if(o>Gs)return!0;if(o++,h.some((n=>Ao(n.srcType,t)&&Ao(n.destType,e))))return!0;h.push({srcType:t,destType:e});let a=!0;try{a=function(e,t,n,i,r,s,o){const a=e.details.fields,l=Zs.cloneForSpecialization(e,void 0,!1),c=new jo(na(e)),u=new jo(na(e));ma(u,e,t),Zs.isTypedDictClass(t)&&x&&_o(x)&&(t=x);let p=!0;const d=wa(t),h=oa(t,!0)?128:0;if(a.forEach(((e,i)=>{if(e.isClassMember()&&!e.isIgnoredForProtocolMatch()){let r,a=!1;if(!s&&"__class_getitem__"===i)return;if("__slots__"===i)return;if(s&&t.details.effectiveMetaclass&&_o(t.details.effectiveMetaclass)&&(r=va(t.details.effectiveMetaclass,i),r&&(d.addSolveForScope(na(t.details.effectiveMetaclass)),a=!0)),r||(r=va(t,i)),r){let l=On(e);if(l){let d=_o(r.classType)?ha(Nn(r.symbol),r.classType,t):Ys.create();if(Eo(d)||ko(d)){if(a){const e=ri(t,d,void 0,void 0,o,!1,t);if(e&&(d=Ba(e)),Eo(l)||ko(l)){const e=ri(t,l,void 0,void 0,o,!1,t);e&&(l=Ba(e))}}else if(_o(r.classType)){l=fa(l,u);const e=ri(s?t:Zs.cloneAsInstance(t),d,r.classType,void 0,o);if(e&&(d=Ba(e)),Eo(l)||ko(l)){const e=ri(Zs.cloneAsInstance(t),l,r.classType,void 0,o);e&&(l=Ba(e))}}}else l=fa(l,u);const m=null==n?void 0:n.createAddendum();if(vo(l)&&Zs.isPropertyClass(l))if(vo(d)&&Zs.isPropertyClass(d)&&!s)Gu(li,Zs.cloneAsInstantiable(l),Zs.cloneAsInstantiable(d),t,null==m?void 0:m.createAddendum(),c,o)||(m&&m.addMessage(ml.DiagnosticAddendum.memberTypeMismatch().format({name:i})),p=!1);else{const e=Hn(l,!0);e&&Jn(e,d,null==m?void 0:m.createAddendum(),c,h,o)||(m&&m.addMessage(ml.DiagnosticAddendum.memberTypeMismatch().format({name:i})),p=!1)}else Jn(l,d,null==m?void 0:m.createAddendum(),c,h,o)||(m&&m.addMessage(ml.DiagnosticAddendum.memberTypeMismatch().format({name:i})),p=!1);const f=e.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal));f!==r.symbol.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal))&&(f?m&&m.addMessage(ml.DiagnosticAddendum.memberIsFinalInProtocol().format({name:i})):m&&m.addMessage(ml.DiagnosticAddendum.memberIsNotFinalInProtocol().format({name:i})),p=!1)}e.isClassVar()&&!r.symbol.isClassMember()&&(n&&n.addMessage(ml.DiagnosticAddendum.protocolMemberClassVar().format({name:i})),p=!1)}else n&&n.addMessage(ml.DiagnosticAddendum.protocolMemberMissing().format({name:i})),p=!1}})),e.details.baseClasses.forEach((a=>{!_o(a)||Zs.isBuiltIn(a,"object")||Zs.isBuiltIn(a,"Protocol")||Wn(ka(e,a),t,null==n?void 0:n.createAddendum(),i,r,s,o)||(p=!1)})),p&&e.details.typeParameters.length>0&&e.typeArguments){const t=fa(l,c);Gn(e,t,n,i,r,o)||(p=!1)}return p}(e,t,n,i,r,s,o)}catch(e){throw h.pop(),e}return h.pop(),a}function jn(e,t,n,i,r,s){if(s>Gs)return!0;s++;let o=!0;const a=e.details.fields,l=Zs.cloneForSpecialization(e,void 0,!1),c=new jo(na(e));if(a.forEach(((i,r)=>{if(i.isClassMember()&&!i.isIgnoredForProtocolMatch()){const a=t.fields.get(r);if(a){let t=On(i);if(t){const i=Nn(a);if((Eo(i)||ko(i))&&(Eo(t)||ko(t))){const n=ri(Zs.cloneAsInstance(e),t,e,void 0,s);n&&(t=n)}const l=null==n?void 0:n.createAddendum();Jn(t,i,null==l?void 0:l.createAddendum(),c,0,s)||(l&&l.addMessage(ml.DiagnosticAddendum.memberTypeMismatch().format({name:r})),o=!1)}}else n&&n.addMessage(ml.DiagnosticAddendum.protocolMemberMissing().format({name:r})),o=!1}})),e.details.baseClasses.forEach((a=>{!_o(a)||Zs.isBuiltIn(a,"object")||Zs.isBuiltIn(a,"Protocol")||jn(ka(e,a),t,null==n?void 0:n.createAddendum(),i,r,s)||(o=!1)})),o&&e.details.typeParameters.length>0&&e.typeArguments){const t=fa(l,c);Gn(e,t,n,i,r,s)||(o=!1)}return o}function zn(e,t,n,i,r,s,o){if(Zs.isTypedDictClass(e)&&Zs.isTypedDictClass(t))return!!_l(li,e,t,n,s)&&(Zs.isFinal(e)!==Zs.isFinal(t)?(n&&n.addMessage(ml.DiagnosticAddendum.typedDictFinalMismatch().format({sourceType:ai(Fa(t)),destType:ai(Fa(e))})),!1):!(0!=(1&r)&&!Zs.isSameGenericClass(e,t))||_l(li,t,e,void 0,s));const a=Qu.get(e.details.fullName);if(a&&a.some((e=>t.details.mro.some((t=>yo(t)&&e===t.details.fullName))))&&0==(1&r))return!0;const l=[],c=Zs.isDerivedFrom(t,e,l);if(Zs.isProtocolClass(e)&&!c)return!!Wn(e,t,null==n?void 0:n.createAddendum(),i,r,!1,s)||(n&&n.addMessage(ml.DiagnosticAddendum.protocolIncompatible().format({sourceType:ai(Fa(t)),destType:ai(Fa(e))})),!1);if((0==(1&r)||Zs.isSameGenericClass(t,e))&&c)return w(l.length>0),function(e,t,n,i,r,s,o){let a=t,l=r||new jo(na(e)),c=s;r||(c&=-9);for(let t=n.length-1;t>=0;t--){const r=n[t];if(po(r))return!0;if(Zs.isBuiltIn(r,"object"))return!0;if(t