jbrowse-plugin-msaview 5.1.0 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.d.ts +3 -4
- package/dist/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.js +22 -17
- package/dist/LaunchMsaView/components/BlastQuery/BlastAutomaticPanel.js +4 -4
- package/dist/LaunchMsaView/components/BlastQuery/BlastPanel.js +1 -1
- package/dist/LaunchMsaView/components/BlastQuery/CachedBlastResults.d.ts +4 -1
- package/dist/LaunchMsaView/components/BlastQuery/CachedBlastResults.js +5 -8
- package/dist/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.js +10 -9
- package/dist/LaunchMsaView/components/OrthologQuery/QuerySpeciesSelect.js +10 -1
- package/dist/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.js +12 -9
- package/dist/LaunchMsaView/components/SubmitCancelActions.d.ts +1 -2
- package/dist/LaunchMsaView/components/SubmitCancelActions.js +2 -2
- package/dist/LaunchMsaView/components/TabPanel.d.ts +1 -1
- package/dist/LaunchMsaView/components/TabPanel.js +2 -2
- package/dist/LaunchMsaView/components/TranscriptSelector.js +3 -1
- package/dist/LaunchMsaView/components/launchConnectedView.js +8 -1
- package/dist/LaunchMsaView/components/useFeatureSequence.js +6 -4
- package/dist/LaunchMsaView/useQueryRowName.js +6 -2
- package/dist/LaunchMsaView/useQueryRowName.test.js +11 -0
- package/dist/MsaViewPanel/afterCreateAutoruns.d.ts +3 -13
- package/dist/MsaViewPanel/afterCreateAutoruns.js +57 -57
- package/dist/MsaViewPanel/components/MsaViewPanel.js +6 -6
- package/dist/MsaViewPanel/components/MsaViewPanel.test.js +13 -1
- package/dist/MsaViewPanel/doLaunchBlast.d.ts +2 -6
- package/dist/MsaViewPanel/doLaunchBlast.js +28 -15
- package/dist/MsaViewPanel/doLaunchOrthologs.d.ts +1 -0
- package/dist/MsaViewPanel/doLaunchOrthologs.js +3 -1
- package/dist/MsaViewPanel/fetchIndexedMsa.js +1 -1
- package/dist/MsaViewPanel/loadProteinDomains.d.ts +5 -14
- package/dist/MsaViewPanel/loadProteinDomains.js +6 -20
- package/dist/MsaViewPanel/loadProteinDomains.test.js +1 -2
- package/dist/MsaViewPanel/model.d.ts +45 -43
- package/dist/MsaViewPanel/model.js +0 -3
- package/dist/MsaViewPanel/runLaunch.d.ts +3 -2
- package/dist/MsaViewPanel/runLaunch.js +4 -1
- package/dist/MsaViewPanel/util.d.ts +1 -0
- package/dist/MsaViewPanel/util.js +1 -1
- package/dist/chunks/{AboutDialog-WT6GXMXU.js → AboutDialog-IRBPUPJK.js} +2 -2
- package/dist/chunks/{AboutDialog-WT6GXMXU.js.map → AboutDialog-IRBPUPJK.js.map} +2 -2
- package/dist/chunks/AnnotationFileDialog-FCYYZ4JN.js +2 -0
- package/dist/chunks/{AnnotationFileDialog-34R7LFHB.js.map → AnnotationFileDialog-FCYYZ4JN.js.map} +2 -2
- package/dist/chunks/{BgzipFastaMsaAdapter-ZMUARSUQ.js → BgzipFastaMsaAdapter-WWIGI57O.js} +2 -2
- package/dist/chunks/BgzipFastaMsaAdapter-WWIGI57O.js.map +7 -0
- package/dist/chunks/ExportSVGDialog-TYYPI6VB.js +2 -0
- package/dist/chunks/ExportSVGDialog-TYYPI6VB.js.map +7 -0
- package/dist/chunks/{FeatureDialog-XNHIA5PS.js → FeatureDialog-ZBX3XQZ5.js} +1 -1
- package/dist/chunks/{FeatureDialog-XNHIA5PS.js.map → FeatureDialog-ZBX3XQZ5.js.map} +1 -1
- package/dist/chunks/LaunchMsaViewDialog-GJAUPGFC.js +5 -0
- package/dist/chunks/LaunchMsaViewDialog-GJAUPGFC.js.map +7 -0
- package/dist/chunks/MetadataDialog-KZWQFRF7.js +2 -0
- package/dist/chunks/{MetadataDialog-2WT6EX4M.js.map → MetadataDialog-KZWQFRF7.js.map} +2 -2
- package/dist/chunks/MsaViewPanel-RUZAKFCB.js +2 -0
- package/dist/chunks/MsaViewPanel-RUZAKFCB.js.map +7 -0
- package/dist/chunks/{TrackInfoDialog-TYCMLUKG.js → TrackInfoDialog-IFIG77WO.js} +2 -2
- package/dist/chunks/{TrackInfoDialog-TYCMLUKG.js.map → TrackInfoDialog-IFIG77WO.js.map} +1 -1
- package/dist/chunks/TreeNodeInfoDialog-VRCVIF26.js +2 -0
- package/dist/chunks/{TreeNodeInfoDialog-BFF6JRCO.js.map → TreeNodeInfoDialog-VRCVIF26.js.map} +2 -2
- package/dist/chunks/{chunk-O7JNDIKD.js → chunk-F3EC6OCO.js} +1 -1
- package/dist/chunks/{chunk-O7JNDIKD.js.map → chunk-F3EC6OCO.js.map} +1 -1
- package/dist/chunks/chunk-F726IWCW.js +2 -0
- package/dist/chunks/chunk-F726IWCW.js.map +7 -0
- package/dist/chunks/{chunk-ZTQYZDWK.js → chunk-GDFVLZYX.js} +2 -2
- package/dist/chunks/{chunk-ZTQYZDWK.js.map → chunk-GDFVLZYX.js.map} +1 -1
- package/dist/chunks/{chunk-5ORPTTMR.js → chunk-GIHMPOCO.js} +1 -1
- package/dist/chunks/{chunk-5ORPTTMR.js.map → chunk-GIHMPOCO.js.map} +1 -1
- package/dist/chunks/{chunk-ENTWPX2K.js → chunk-H6IQBAW7.js} +5 -5
- package/dist/chunks/{chunk-ENTWPX2K.js.map → chunk-H6IQBAW7.js.map} +1 -1
- package/dist/chunks/{chunk-TITP6LCV.js → chunk-JFL3LJPO.js} +2 -2
- package/dist/chunks/{chunk-TITP6LCV.js.map → chunk-JFL3LJPO.js.map} +2 -2
- package/dist/chunks/chunk-NI3VGKQP.js +3 -0
- package/dist/chunks/chunk-NI3VGKQP.js.map +7 -0
- package/dist/chunks/chunk-NMYD2GWF.js +18 -0
- package/dist/chunks/chunk-NMYD2GWF.js.map +7 -0
- package/dist/chunks/chunk-QQ5LZUIO.js +11 -0
- package/dist/chunks/chunk-QQ5LZUIO.js.map +7 -0
- package/dist/chunks/chunk-QUWPHTZQ.js +2 -0
- package/dist/chunks/chunk-QUWPHTZQ.js.map +7 -0
- package/dist/chunks/{chunk-P77DPK6B.js → chunk-YOTSFJMU.js} +1 -1
- package/dist/chunks/{chunk-P77DPK6B.js.map → chunk-YOTSFJMU.js.map} +1 -1
- package/dist/chunks/chunk-ZCT7RD24.js +2 -0
- package/dist/chunks/chunk-ZCT7RD24.js.map +7 -0
- package/dist/chunks/{dist-UX5CKLQJ.js → dist-CMWKVHC7.js} +1 -1
- package/dist/chunks/{dist-UX5CKLQJ.js.map → dist-CMWKVHC7.js.map} +1 -1
- package/dist/chunks/dist-R73J3CC3.js +2 -0
- package/dist/chunks/model-VE7IYWNU.js +12 -0
- package/dist/chunks/model-VE7IYWNU.js.map +7 -0
- package/dist/chunks/{renderToSvg-B7RCHRO3.js → renderToSvg-VDXAB7TT.js} +2 -2
- package/dist/jbrowse-plugin-msaview.esm.js +2 -2
- package/dist/jbrowse-plugin-msaview.esm.js.map +1 -1
- package/dist/utils/ebiBlast.d.ts +8 -13
- package/dist/utils/ebiBlast.js +20 -45
- package/dist/utils/ebiJobDispatcher.d.ts +4 -4
- package/dist/utils/ebiJobDispatcher.js +4 -4
- package/dist/utils/eutils.js +1 -1
- package/dist/utils/fetch.d.ts +4 -0
- package/dist/utils/fetch.js +7 -1
- package/dist/utils/homologSearch.d.ts +6 -2
- package/dist/utils/msaRows.d.ts +1 -2
- package/dist/utils/msaRows.js +13 -1
- package/dist/utils/ncbiDomains.d.ts +1 -1
- package/dist/utils/ncbiDomains.js +19 -7
- package/dist/utils/ncbiDomains.test.js +36 -0
- package/dist/utils/ncbiOrthologs.d.ts +24 -5
- package/dist/utils/ncbiOrthologs.js +55 -19
- package/dist/utils/ncbiOrthologs.test.js +58 -8
- package/dist/utils/pantherOrthologs.js +4 -1
- package/dist/utils/phmmer.js +4 -8
- package/dist/utils/taxonomyNames.d.ts +6 -1
- package/dist/utils/taxonomyNames.js +7 -1
- package/dist/utils/taxonomyNames.test.js +12 -0
- package/dist/utils/unirefHomologs.d.ts +6 -0
- package/dist/utils/unirefHomologs.js +25 -10
- package/dist/utils/unirefHomologs.test.js +49 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +18 -18
- package/src/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.ts +23 -20
- package/src/LaunchMsaView/components/BlastQuery/BlastAutomaticPanel.tsx +4 -4
- package/src/LaunchMsaView/components/BlastQuery/BlastPanel.tsx +3 -1
- package/src/LaunchMsaView/components/BlastQuery/CachedBlastResults.tsx +7 -19
- package/src/LaunchMsaView/components/ManualMSALoader/ManualMSALoader.tsx +10 -9
- package/src/LaunchMsaView/components/OrthologQuery/QuerySpeciesSelect.tsx +12 -1
- package/src/LaunchMsaView/components/PreLoadedMSA/PreLoadedMSADataPanel.tsx +12 -8
- package/src/LaunchMsaView/components/SubmitCancelActions.tsx +1 -3
- package/src/LaunchMsaView/components/TabPanel.tsx +1 -2
- package/src/LaunchMsaView/components/TranscriptSelector.tsx +3 -1
- package/src/LaunchMsaView/components/launchConnectedView.ts +8 -1
- package/src/LaunchMsaView/components/useFeatureSequence.ts +8 -2
- package/src/LaunchMsaView/useQueryRowName.test.ts +15 -0
- package/src/LaunchMsaView/useQueryRowName.ts +7 -2
- package/src/MsaViewPanel/afterCreateAutoruns.ts +74 -58
- package/src/MsaViewPanel/components/MsaViewPanel.test.tsx +18 -1
- package/src/MsaViewPanel/components/MsaViewPanel.tsx +15 -16
- package/src/MsaViewPanel/doLaunchBlast.ts +37 -17
- package/src/MsaViewPanel/doLaunchOrthologs.ts +4 -1
- package/src/MsaViewPanel/fetchIndexedMsa.ts +1 -1
- package/src/MsaViewPanel/loadProteinDomains.test.ts +1 -2
- package/src/MsaViewPanel/loadProteinDomains.ts +13 -28
- package/src/MsaViewPanel/model.ts +0 -3
- package/src/MsaViewPanel/runLaunch.ts +8 -8
- package/src/MsaViewPanel/types.ts +1 -1
- package/src/MsaViewPanel/util.ts +1 -1
- package/src/utils/ebiBlast.ts +29 -56
- package/src/utils/ebiJobDispatcher.ts +4 -4
- package/src/utils/eutils.ts +1 -1
- package/src/utils/fetch.ts +12 -2
- package/src/utils/homologSearch.ts +6 -2
- package/src/utils/msaRows.ts +18 -4
- package/src/utils/ncbiDomains.test.ts +53 -0
- package/src/utils/ncbiDomains.ts +21 -8
- package/src/utils/ncbiOrthologs.test.ts +70 -7
- package/src/utils/ncbiOrthologs.ts +81 -24
- package/src/utils/pantherOrthologs.ts +7 -1
- package/src/utils/phmmer.ts +3 -7
- package/src/utils/taxonomyNames.test.ts +15 -0
- package/src/utils/taxonomyNames.ts +7 -0
- package/src/utils/unirefHomologs.test.ts +57 -2
- package/src/utils/unirefHomologs.ts +38 -13
- package/src/version.ts +1 -1
- package/dist/LaunchMsaView/components/util.d.ts +0 -7
- package/dist/LaunchMsaView/components/util.js +0 -16
- package/dist/MsaViewPanel/components/ErrorBoundary.d.ts +0 -19
- package/dist/MsaViewPanel/components/ErrorBoundary.js +0 -21
- package/dist/chunks/AnnotationFileDialog-34R7LFHB.js +0 -2
- package/dist/chunks/BgzipFastaMsaAdapter-ZMUARSUQ.js.map +0 -7
- package/dist/chunks/ExportSVGDialog-NMVUHFGY.js +0 -2
- package/dist/chunks/ExportSVGDialog-NMVUHFGY.js.map +0 -7
- package/dist/chunks/LaunchMsaViewDialog-WBXEEHJL.js +0 -5
- package/dist/chunks/LaunchMsaViewDialog-WBXEEHJL.js.map +0 -7
- package/dist/chunks/MetadataDialog-2WT6EX4M.js +0 -2
- package/dist/chunks/MsaViewPanel-YYP4CYYO.js +0 -2
- package/dist/chunks/MsaViewPanel-YYP4CYYO.js.map +0 -7
- package/dist/chunks/TreeNodeInfoDialog-BFF6JRCO.js +0 -2
- package/dist/chunks/chunk-FCNT6B47.js +0 -2
- package/dist/chunks/chunk-FCNT6B47.js.map +0 -7
- package/dist/chunks/chunk-MBI4TMKR.js +0 -2
- package/dist/chunks/chunk-MBI4TMKR.js.map +0 -7
- package/dist/chunks/chunk-MHBTV7BZ.js +0 -3
- package/dist/chunks/chunk-MHBTV7BZ.js.map +0 -7
- package/dist/chunks/chunk-PJZ3XTMG.js +0 -6
- package/dist/chunks/chunk-PJZ3XTMG.js.map +0 -7
- package/dist/chunks/chunk-QAC6JSDZ.js +0 -5
- package/dist/chunks/chunk-QAC6JSDZ.js.map +0 -7
- package/dist/chunks/chunk-QMLPITS4.js +0 -18
- package/dist/chunks/chunk-QMLPITS4.js.map +0 -7
- package/dist/chunks/chunk-RTKNCGDF.js +0 -8
- package/dist/chunks/chunk-RTKNCGDF.js.map +0 -7
- package/dist/chunks/dist-2T65ZS4E.js +0 -2
- package/dist/chunks/model-7VBTOIJX.js +0 -12
- package/dist/chunks/model-7VBTOIJX.js.map +0 -7
- package/dist/utils/types.d.ts +0 -18
- package/src/LaunchMsaView/components/util.ts +0 -22
- package/src/MsaViewPanel/components/ErrorBoundary.tsx +0 -41
- package/src/utils/types.ts +0 -17
- /package/dist/chunks/{dist-2T65ZS4E.js.map → dist-R73J3CC3.js.map} +0 -0
- /package/dist/chunks/{renderToSvg-B7RCHRO3.js.map → renderToSvg-VDXAB7TT.js.map} +0 -0
- /package/dist/utils/{types.js → ncbiDomains.test.d.ts} +0 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["global-externals:@jbrowse/core/data_adapters/BaseAdapter", "../../src/BgzipFastaMsaAdapter/BgzipFastaMsaAdapter.ts", "../../node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/isFunction.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/createErrorClass.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/UnsubscriptionError.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/arrRemove.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/Subscription.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/config.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/scheduler/timeoutProvider.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/reportUnhandledError.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/noop.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/NotificationFactories.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/errorContext.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/Subscriber.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/lift.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/operators/OperatorSubscriber.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/util/EmptyError.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/firstValueFrom.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/operators/scanInternals.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/operators/reduce.ts", "../../node_modules/.pnpm/rxjs@7.8.2/node_modules/rxjs/src/internal/operators/toArray.ts"],
|
|
4
|
+
"sourcesContent": ["module.exports = JBrowseExports[\"@jbrowse/core/data_adapters/BaseAdapter\"];", "import { readConfObject } from '@jbrowse/core/configuration'\nimport { BaseAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\nimport { firstValueFrom, toArray } from 'rxjs'\n\nimport type { BaseFeatureDataAdapter } from '@jbrowse/core/data_adapters/BaseAdapter'\n\nexport default class BgzipFastaMsaAdapter extends BaseAdapter {\n configureP: Promise<BaseFeatureDataAdapter> | undefined\n\n msaRowsP: Promise<Map<string, string[]>> | undefined\n\n async configurePre() {\n const getSubAdapter = this.getSubAdapter\n if (getSubAdapter) {\n const adapter = await getSubAdapter({\n ...readConfObject(this.config),\n type: 'BgzipFastaAdapter',\n })\n\n return adapter.dataAdapter as BaseFeatureDataAdapter\n } else {\n throw new Error('no get subadapter')\n }\n }\n configure() {\n this.configureP ??= this.configurePre().catch((e: unknown) => {\n this.configureP = undefined\n throw e\n })\n return this.configureP\n }\n\n async groupRows() {\n const adapter = await this.configure()\n const separator = new RegExp(this.getConf('msaRegex'))\n const rows = new Map<string, string[]>()\n for (const refName of await adapter.getRefNames()) {\n const msaId = refName.split(separator)[0]!\n const group = rows.get(msaId)\n if (group) {\n group.push(refName)\n } else {\n rows.set(msaId, [refName])\n }\n }\n return rows\n }\n\n getMSARows() {\n this.msaRowsP ??= this.groupRows().catch((e: unknown) => {\n this.msaRowsP = undefined\n throw e\n })\n return this.msaRowsP\n }\n\n async getMSAList() {\n return [...(await this.getMSARows()).keys()]\n }\n\n async getMSA(id: string) {\n const adapter = await this.configure()\n const rows = (await this.getMSARows()).get(id) ?? []\n return firstValueFrom(\n adapter\n .getFeaturesInMultipleRegions(\n rows.map(refName => ({\n refName,\n start: 0,\n end: 1_000_000_000,\n assemblyName: '',\n })),\n )\n .pipe(toArray()),\n )\n }\n}\n", "/******************************************************************************\nCopyright (c) Microsoft Corporation.\n\nPermission to use, copy, modify, and/or distribute this software for any\npurpose with or without fee is hereby granted.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\nPERFORMANCE OF THIS SOFTWARE.\n***************************************************************************** */\n/* global Reflect, Promise, SuppressedError, Symbol, Iterator */\n\nvar extendStatics = function(d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n};\n\nexport function __extends(d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n}\n\nexport var __assign = function() {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n }\n return __assign.apply(this, arguments);\n}\n\nexport function __rest(s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n}\n\nexport function __decorate(decorators, target, key, desc) {\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n return c > 3 && r && Object.defineProperty(target, key, r), r;\n}\n\nexport function __param(paramIndex, decorator) {\n return function (target, key) { decorator(target, key, paramIndex); }\n}\n\nexport function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {\n function accept(f) { if (f !== void 0 && typeof f !== \"function\") throw new TypeError(\"Function expected\"); return f; }\n var kind = contextIn.kind, key = kind === \"getter\" ? \"get\" : kind === \"setter\" ? \"set\" : \"value\";\n var target = !descriptorIn && ctor ? contextIn[\"static\"] ? ctor : ctor.prototype : null;\n var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});\n var _, done = false;\n for (var i = decorators.length - 1; i >= 0; i--) {\n var context = {};\n for (var p in contextIn) context[p] = p === \"access\" ? {} : contextIn[p];\n for (var p in contextIn.access) context.access[p] = contextIn.access[p];\n context.addInitializer = function (f) { if (done) throw new TypeError(\"Cannot add initializers after decoration has completed\"); extraInitializers.push(accept(f || null)); };\n var result = (0, decorators[i])(kind === \"accessor\" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);\n if (kind === \"accessor\") {\n if (result === void 0) continue;\n if (result === null || typeof result !== \"object\") throw new TypeError(\"Object expected\");\n if (_ = accept(result.get)) descriptor.get = _;\n if (_ = accept(result.set)) descriptor.set = _;\n if (_ = accept(result.init)) initializers.unshift(_);\n }\n else if (_ = accept(result)) {\n if (kind === \"field\") initializers.unshift(_);\n else descriptor[key] = _;\n }\n }\n if (target) Object.defineProperty(target, contextIn.name, descriptor);\n done = true;\n};\n\nexport function __runInitializers(thisArg, initializers, value) {\n var useValue = arguments.length > 2;\n for (var i = 0; i < initializers.length; i++) {\n value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);\n }\n return useValue ? value : void 0;\n};\n\nexport function __propKey(x) {\n return typeof x === \"symbol\" ? x : \"\".concat(x);\n};\n\nexport function __setFunctionName(f, name, prefix) {\n if (typeof name === \"symbol\") name = name.description ? \"[\".concat(name.description, \"]\") : \"\";\n return Object.defineProperty(f, \"name\", { configurable: true, value: prefix ? \"\".concat(prefix, \" \", name) : name });\n};\n\nexport function __metadata(metadataKey, metadataValue) {\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\n}\n\nexport function __awaiter(thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n}\n\nexport function __generator(thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === \"function\" ? Iterator : Object).prototype);\n return g.next = verb(0), g[\"throw\"] = verb(1), g[\"return\"] = verb(2), typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n}\n\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n});\n\nexport function __exportStar(m, o) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\n}\n\nexport function __values(o) {\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\n if (m) return m.call(o);\n if (o && typeof o.length === \"number\") return {\n next: function () {\n if (o && i >= o.length) o = void 0;\n return { value: o && o[i++], done: !o };\n }\n };\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\n}\n\nexport function __read(o, n) {\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\n if (!m) return o;\n var i = m.call(o), r, ar = [], e;\n try {\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\n }\n catch (error) { e = { error: error }; }\n finally {\n try {\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\n }\n finally { if (e) throw e.error; }\n }\n return ar;\n}\n\n/** @deprecated */\nexport function __spread() {\n for (var ar = [], i = 0; i < arguments.length; i++)\n ar = ar.concat(__read(arguments[i]));\n return ar;\n}\n\n/** @deprecated */\nexport function __spreadArrays() {\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\n r[k] = a[j];\n return r;\n}\n\nexport function __spreadArray(to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n}\n\nexport function __await(v) {\n return this instanceof __await ? (this.v = v, this) : new __await(v);\n}\n\nexport function __asyncGenerator(thisArg, _arguments, generator) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\n return i = Object.create((typeof AsyncIterator === \"function\" ? AsyncIterator : Object).prototype), verb(\"next\"), verb(\"throw\"), verb(\"return\", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;\n function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }\n function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\n function fulfill(value) { resume(\"next\", value); }\n function reject(value) { resume(\"throw\", value); }\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\n}\n\nexport function __asyncDelegator(o) {\n var i, p;\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }\n}\n\nexport function __asyncValues(o) {\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\n var m = o[Symbol.asyncIterator], i;\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\n}\n\nexport function __makeTemplateObject(cooked, raw) {\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\n return cooked;\n};\n\nvar __setModuleDefault = Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n};\n\nvar ownKeys = function(o) {\n ownKeys = Object.getOwnPropertyNames || function (o) {\n var ar = [];\n for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;\n return ar;\n };\n return ownKeys(o);\n};\n\nexport function __importStar(mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== \"default\") __createBinding(result, mod, k[i]);\n __setModuleDefault(result, mod);\n return result;\n}\n\nexport function __importDefault(mod) {\n return (mod && mod.__esModule) ? mod : { default: mod };\n}\n\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\n}\n\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\n}\n\nexport function __classPrivateFieldIn(state, receiver) {\n if (receiver === null || (typeof receiver !== \"object\" && typeof receiver !== \"function\")) throw new TypeError(\"Cannot use 'in' operator on non-object\");\n return typeof state === \"function\" ? receiver === state : state.has(receiver);\n}\n\nexport function __addDisposableResource(env, value, async) {\n if (value !== null && value !== void 0) {\n if (typeof value !== \"object\" && typeof value !== \"function\") throw new TypeError(\"Object expected.\");\n var dispose, inner;\n if (async) {\n if (!Symbol.asyncDispose) throw new TypeError(\"Symbol.asyncDispose is not defined.\");\n dispose = value[Symbol.asyncDispose];\n }\n if (dispose === void 0) {\n if (!Symbol.dispose) throw new TypeError(\"Symbol.dispose is not defined.\");\n dispose = value[Symbol.dispose];\n if (async) inner = dispose;\n }\n if (typeof dispose !== \"function\") throw new TypeError(\"Object not disposable.\");\n if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };\n env.stack.push({ value: value, dispose: dispose, async: async });\n }\n else if (async) {\n env.stack.push({ async: true });\n }\n return value;\n}\n\nvar _SuppressedError = typeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\n var e = new Error(message);\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\n};\n\nexport function __disposeResources(env) {\n function fail(e) {\n env.error = env.hasError ? new _SuppressedError(e, env.error, \"An error was suppressed during disposal.\") : e;\n env.hasError = true;\n }\n var r, s = 0;\n function next() {\n while (r = env.stack.pop()) {\n try {\n if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);\n if (r.dispose) {\n var result = r.dispose.call(r.value);\n if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });\n }\n else s |= 1;\n }\n catch (e) {\n fail(e);\n }\n }\n if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();\n if (env.hasError) throw env.error;\n }\n return next();\n}\n\nexport function __rewriteRelativeImportExtension(path, preserveJsx) {\n if (typeof path === \"string\" && /^\\.\\.?\\//.test(path)) {\n return path.replace(/\\.(tsx)$|((?:\\.d)?)((?:\\.[^./]+?)?)\\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {\n return tsx ? preserveJsx ? \".jsx\" : \".js\" : d && (!ext || !cm) ? m : (d + ext + \".\" + cm.toLowerCase() + \"js\");\n });\n }\n return path;\n}\n\nexport default {\n __extends,\n __assign,\n __rest,\n __decorate,\n __param,\n __esDecorate,\n __runInitializers,\n __propKey,\n __setFunctionName,\n __metadata,\n __awaiter,\n __generator,\n __createBinding,\n __exportStar,\n __values,\n __read,\n __spread,\n __spreadArrays,\n __spreadArray,\n __await,\n __asyncGenerator,\n __asyncDelegator,\n __asyncValues,\n __makeTemplateObject,\n __importStar,\n __importDefault,\n __classPrivateFieldGet,\n __classPrivateFieldSet,\n __classPrivateFieldIn,\n __addDisposableResource,\n __disposeResources,\n __rewriteRelativeImportExtension,\n};\n", "/**\n * Returns true if the object is a function.\n * @param value The value to check\n */\nexport function isFunction(value: any): value is (...args: any[]) => any {\n return typeof value === 'function';\n}\n", "/**\n * Used to create Error subclasses until the community moves away from ES5.\n *\n * This is because compiling from TypeScript down to ES5 has issues with subclassing Errors\n * as well as other built-in types: https://github.com/Microsoft/TypeScript/issues/12123\n *\n * @param createImpl A factory function to create the actual constructor implementation. The returned\n * function should be a named function that calls `_super` internally.\n */\nexport function createErrorClass<T>(createImpl: (_super: any) => any): T {\n const _super = (instance: any) => {\n Error.call(instance);\n instance.stack = new Error().stack;\n };\n\n const ctorFunc = createImpl(_super);\n ctorFunc.prototype = Object.create(Error.prototype);\n ctorFunc.prototype.constructor = ctorFunc;\n return ctorFunc;\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface UnsubscriptionError extends Error {\n readonly errors: any[];\n}\n\nexport interface UnsubscriptionErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (errors: any[]): UnsubscriptionError;\n}\n\n/**\n * An error thrown when one or more errors have occurred during the\n * `unsubscribe` of a {@link Subscription}.\n */\nexport const UnsubscriptionError: UnsubscriptionErrorCtor = createErrorClass(\n (_super) =>\n function UnsubscriptionErrorImpl(this: any, errors: (Error | string)[]) {\n _super(this);\n this.message = errors\n ? `${errors.length} errors occurred during unsubscription:\n${errors.map((err, i) => `${i + 1}) ${err.toString()}`).join('\\n ')}`\n : '';\n this.name = 'UnsubscriptionError';\n this.errors = errors;\n }\n);\n", "/**\n * Removes an item from an array, mutating it.\n * @param arr The array to remove the item from\n * @param item The item to remove\n */\nexport function arrRemove<T>(arr: T[] | undefined | null, item: T) {\n if (arr) {\n const index = arr.indexOf(item);\n 0 <= index && arr.splice(index, 1);\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { UnsubscriptionError } from './util/UnsubscriptionError';\nimport { SubscriptionLike, TeardownLogic, Unsubscribable } from './types';\nimport { arrRemove } from './util/arrRemove';\n\n/**\n * Represents a disposable resource, such as the execution of an Observable. A\n * Subscription has one important method, `unsubscribe`, that takes no argument\n * and just disposes the resource held by the subscription.\n *\n * Additionally, subscriptions may be grouped together through the `add()`\n * method, which will attach a child Subscription to the current Subscription.\n * When a Subscription is unsubscribed, all its children (and its grandchildren)\n * will be unsubscribed as well.\n */\nexport class Subscription implements SubscriptionLike {\n public static EMPTY = (() => {\n const empty = new Subscription();\n empty.closed = true;\n return empty;\n })();\n\n /**\n * A flag to indicate whether this Subscription has already been unsubscribed.\n */\n public closed = false;\n\n private _parentage: Subscription[] | Subscription | null = null;\n\n /**\n * The list of registered finalizers to execute upon unsubscription. Adding and removing from this\n * list occurs in the {@link #add} and {@link #remove} methods.\n */\n private _finalizers: Exclude<TeardownLogic, void>[] | null = null;\n\n /**\n * @param initialTeardown A function executed first as part of the finalization\n * process that is kicked off when {@link #unsubscribe} is called.\n */\n constructor(private initialTeardown?: () => void) {}\n\n /**\n * Disposes the resources held by the subscription. May, for instance, cancel\n * an ongoing Observable execution or cancel any other type of work that\n * started when the Subscription was created.\n */\n unsubscribe(): void {\n let errors: any[] | undefined;\n\n if (!this.closed) {\n this.closed = true;\n\n // Remove this from it's parents.\n const { _parentage } = this;\n if (_parentage) {\n this._parentage = null;\n if (Array.isArray(_parentage)) {\n for (const parent of _parentage) {\n parent.remove(this);\n }\n } else {\n _parentage.remove(this);\n }\n }\n\n const { initialTeardown: initialFinalizer } = this;\n if (isFunction(initialFinalizer)) {\n try {\n initialFinalizer();\n } catch (e) {\n errors = e instanceof UnsubscriptionError ? e.errors : [e];\n }\n }\n\n const { _finalizers } = this;\n if (_finalizers) {\n this._finalizers = null;\n for (const finalizer of _finalizers) {\n try {\n execFinalizer(finalizer);\n } catch (err) {\n errors = errors ?? [];\n if (err instanceof UnsubscriptionError) {\n errors = [...errors, ...err.errors];\n } else {\n errors.push(err);\n }\n }\n }\n }\n\n if (errors) {\n throw new UnsubscriptionError(errors);\n }\n }\n }\n\n /**\n * Adds a finalizer to this subscription, so that finalization will be unsubscribed/called\n * when this subscription is unsubscribed. If this subscription is already {@link #closed},\n * because it has already been unsubscribed, then whatever finalizer is passed to it\n * will automatically be executed (unless the finalizer itself is also a closed subscription).\n *\n * Closed Subscriptions cannot be added as finalizers to any subscription. Adding a closed\n * subscription to a any subscription will result in no operation. (A noop).\n *\n * Adding a subscription to itself, or adding `null` or `undefined` will not perform any\n * operation at all. (A noop).\n *\n * `Subscription` instances that are added to this instance will automatically remove themselves\n * if they are unsubscribed. Functions and {@link Unsubscribable} objects that you wish to remove\n * will need to be removed manually with {@link #remove}\n *\n * @param teardown The finalization logic to add to this subscription.\n */\n add(teardown: TeardownLogic): void {\n // Only add the finalizer if it's not undefined\n // and don't add a subscription to itself.\n if (teardown && teardown !== this) {\n if (this.closed) {\n // If this subscription is already closed,\n // execute whatever finalizer is handed to it automatically.\n execFinalizer(teardown);\n } else {\n if (teardown instanceof Subscription) {\n // We don't add closed subscriptions, and we don't add the same subscription\n // twice. Subscription unsubscribe is idempotent.\n if (teardown.closed || teardown._hasParent(this)) {\n return;\n }\n teardown._addParent(this);\n }\n (this._finalizers = this._finalizers ?? []).push(teardown);\n }\n }\n }\n\n /**\n * Checks to see if a this subscription already has a particular parent.\n * This will signal that this subscription has already been added to the parent in question.\n * @param parent the parent to check for\n */\n private _hasParent(parent: Subscription) {\n const { _parentage } = this;\n return _parentage === parent || (Array.isArray(_parentage) && _parentage.includes(parent));\n }\n\n /**\n * Adds a parent to this subscription so it can be removed from the parent if it\n * unsubscribes on it's own.\n *\n * NOTE: THIS ASSUMES THAT {@link _hasParent} HAS ALREADY BEEN CHECKED.\n * @param parent The parent subscription to add\n */\n private _addParent(parent: Subscription) {\n const { _parentage } = this;\n this._parentage = Array.isArray(_parentage) ? (_parentage.push(parent), _parentage) : _parentage ? [_parentage, parent] : parent;\n }\n\n /**\n * Called on a child when it is removed via {@link #remove}.\n * @param parent The parent to remove\n */\n private _removeParent(parent: Subscription) {\n const { _parentage } = this;\n if (_parentage === parent) {\n this._parentage = null;\n } else if (Array.isArray(_parentage)) {\n arrRemove(_parentage, parent);\n }\n }\n\n /**\n * Removes a finalizer from this subscription that was previously added with the {@link #add} method.\n *\n * Note that `Subscription` instances, when unsubscribed, will automatically remove themselves\n * from every other `Subscription` they have been added to. This means that using the `remove` method\n * is not a common thing and should be used thoughtfully.\n *\n * If you add the same finalizer instance of a function or an unsubscribable object to a `Subscription` instance\n * more than once, you will need to call `remove` the same number of times to remove all instances.\n *\n * All finalizer instances are removed to free up memory upon unsubscription.\n *\n * @param teardown The finalizer to remove from this subscription\n */\n remove(teardown: Exclude<TeardownLogic, void>): void {\n const { _finalizers } = this;\n _finalizers && arrRemove(_finalizers, teardown);\n\n if (teardown instanceof Subscription) {\n teardown._removeParent(this);\n }\n }\n}\n\nexport const EMPTY_SUBSCRIPTION = Subscription.EMPTY;\n\nexport function isSubscription(value: any): value is Subscription {\n return (\n value instanceof Subscription ||\n (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe))\n );\n}\n\nfunction execFinalizer(finalizer: Unsubscribable | (() => void)) {\n if (isFunction(finalizer)) {\n finalizer();\n } else {\n finalizer.unsubscribe();\n }\n}\n", "import { Subscriber } from './Subscriber';\nimport { ObservableNotification } from './types';\n\n/**\n * The {@link GlobalConfig} object for RxJS. It is used to configure things\n * like how to react on unhandled errors.\n */\nexport const config: GlobalConfig = {\n onUnhandledError: null,\n onStoppedNotification: null,\n Promise: undefined,\n useDeprecatedSynchronousErrorHandling: false,\n useDeprecatedNextContext: false,\n};\n\n/**\n * The global configuration object for RxJS, used to configure things\n * like how to react on unhandled errors. Accessible via {@link config}\n * object.\n */\nexport interface GlobalConfig {\n /**\n * A registration point for unhandled errors from RxJS. These are errors that\n * cannot were not handled by consuming code in the usual subscription path. For\n * example, if you have this configured, and you subscribe to an observable without\n * providing an error handler, errors from that subscription will end up here. This\n * will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onUnhandledError: ((err: any) => void) | null;\n\n /**\n * A registration point for notifications that cannot be sent to subscribers because they\n * have completed, errored or have been explicitly unsubscribed. By default, next, complete\n * and error notifications sent to stopped subscribers are noops. However, sometimes callers\n * might want a different behavior. For example, with sources that attempt to report errors\n * to stopped subscribers, a caller can configure RxJS to throw an unhandled error instead.\n * This will _always_ be called asynchronously on another job in the runtime. This is because\n * we do not want errors thrown in this user-configured handler to interfere with the\n * behavior of the library.\n */\n onStoppedNotification: ((notification: ObservableNotification<any>, subscriber: Subscriber<any>) => void) | null;\n\n /**\n * The promise constructor used by default for {@link Observable#toPromise toPromise} and {@link Observable#forEach forEach}\n * methods.\n *\n * @deprecated As of version 8, RxJS will no longer support this sort of injection of a\n * Promise constructor. If you need a Promise implementation other than native promises,\n * please polyfill/patch Promise as you see appropriate. Will be removed in v8.\n */\n Promise?: PromiseConstructorLike;\n\n /**\n * If true, turns on synchronous error rethrowing, which is a deprecated behavior\n * in v6 and higher. This behavior enables bad patterns like wrapping a subscribe\n * call in a try/catch block. It also enables producer interference, a nasty bug\n * where a multicast can be broken for all observers by a downstream consumer with\n * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME\n * FOR MIGRATION REASONS.\n *\n * @deprecated As of version 8, RxJS will no longer support synchronous throwing\n * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad\n * behaviors described above. Will be removed in v8.\n */\n useDeprecatedSynchronousErrorHandling: boolean;\n\n /**\n * If true, enables an as-of-yet undocumented feature from v5: The ability to access\n * `unsubscribe()` via `this` context in `next` functions created in observers passed\n * to `subscribe`.\n *\n * This is being removed because the performance was severely problematic, and it could also cause\n * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have\n * their `this` context overwritten.\n *\n * @deprecated As of version 8, RxJS will no longer support altering the\n * context of next functions provided as part of an observer to Subscribe. Instead,\n * you will have access to a subscription or a signal or token that will allow you to do things like\n * unsubscribe and test closed status. Will be removed in v8.\n */\n useDeprecatedNextContext: boolean;\n}\n", "import type { TimerHandle } from './timerHandle';\ntype SetTimeoutFunction = (handler: () => void, timeout?: number, ...args: any[]) => TimerHandle;\ntype ClearTimeoutFunction = (handle: TimerHandle) => void;\n\ninterface TimeoutProvider {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n delegate:\n | {\n setTimeout: SetTimeoutFunction;\n clearTimeout: ClearTimeoutFunction;\n }\n | undefined;\n}\n\nexport const timeoutProvider: TimeoutProvider = {\n // When accessing the delegate, use the variable rather than `this` so that\n // the functions can be called without being bound to the provider.\n setTimeout(handler: () => void, timeout?: number, ...args) {\n const { delegate } = timeoutProvider;\n if (delegate?.setTimeout) {\n return delegate.setTimeout(handler, timeout, ...args);\n }\n return setTimeout(handler, timeout, ...args);\n },\n clearTimeout(handle) {\n const { delegate } = timeoutProvider;\n return (delegate?.clearTimeout || clearTimeout)(handle as any);\n },\n delegate: undefined,\n};\n", "import { config } from '../config';\nimport { timeoutProvider } from '../scheduler/timeoutProvider';\n\n/**\n * Handles an error on another job either with the user-configured {@link onUnhandledError},\n * or by throwing it on that new job so it can be picked up by `window.onerror`, `process.on('error')`, etc.\n *\n * This should be called whenever there is an error that is out-of-band with the subscription\n * or when an error hits a terminal boundary of the subscription and no error handler was provided.\n *\n * @param err the error to report\n */\nexport function reportUnhandledError(err: any) {\n timeoutProvider.setTimeout(() => {\n const { onUnhandledError } = config;\n if (onUnhandledError) {\n // Execute the user-configured error handler.\n onUnhandledError(err);\n } else {\n // Throw so it is picked up by the runtime's uncaught error mechanism.\n throw err;\n }\n });\n}\n", "/* tslint:disable:no-empty */\nexport function noop() { }\n", "import { CompleteNotification, NextNotification, ErrorNotification } from './types';\n\n/**\n * A completion object optimized for memory use and created to be the\n * same \"shape\" as other notifications in v8.\n * @internal\n */\nexport const COMPLETE_NOTIFICATION = (() => createNotification('C', undefined, undefined) as CompleteNotification)();\n\n/**\n * Internal use only. Creates an optimized error notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function errorNotification(error: any): ErrorNotification {\n return createNotification('E', undefined, error) as any;\n}\n\n/**\n * Internal use only. Creates an optimized next notification that is the same \"shape\"\n * as other notifications.\n * @internal\n */\nexport function nextNotification<T>(value: T) {\n return createNotification('N', value, undefined) as NextNotification<T>;\n}\n\n/**\n * Ensures that all notifications created internally have the same \"shape\" in v8.\n *\n * TODO: This is only exported to support a crazy legacy test in `groupBy`.\n * @internal\n */\nexport function createNotification(kind: 'N' | 'E' | 'C', value: any, error: any) {\n return {\n kind,\n value,\n error,\n };\n}\n", "import { config } from '../config';\n\nlet context: { errorThrown: boolean; error: any } | null = null;\n\n/**\n * Handles dealing with errors for super-gross mode. Creates a context, in which\n * any synchronously thrown errors will be passed to {@link captureError}. Which\n * will record the error such that it will be rethrown after the call back is complete.\n * TODO: Remove in v8\n * @param cb An immediately executed function.\n */\nexport function errorContext(cb: () => void) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n const isRoot = !context;\n if (isRoot) {\n context = { errorThrown: false, error: null };\n }\n cb();\n if (isRoot) {\n const { errorThrown, error } = context!;\n context = null;\n if (errorThrown) {\n throw error;\n }\n }\n } else {\n // This is the general non-deprecated path for everyone that\n // isn't crazy enough to use super-gross mode (useDeprecatedSynchronousErrorHandling)\n cb();\n }\n}\n\n/**\n * Captures errors only in super-gross mode.\n * @param err the error to capture\n */\nexport function captureError(err: any) {\n if (config.useDeprecatedSynchronousErrorHandling && context) {\n context.errorThrown = true;\n context.error = err;\n }\n}\n", "import { isFunction } from './util/isFunction';\nimport { Observer, ObservableNotification } from './types';\nimport { isSubscription, Subscription } from './Subscription';\nimport { config } from './config';\nimport { reportUnhandledError } from './util/reportUnhandledError';\nimport { noop } from './util/noop';\nimport { nextNotification, errorNotification, COMPLETE_NOTIFICATION } from './NotificationFactories';\nimport { timeoutProvider } from './scheduler/timeoutProvider';\nimport { captureError } from './util/errorContext';\n\n/**\n * Implements the {@link Observer} interface and extends the\n * {@link Subscription} class. While the {@link Observer} is the public API for\n * consuming the values of an {@link Observable}, all Observers get converted to\n * a Subscriber, in order to provide Subscription-like capabilities such as\n * `unsubscribe`. Subscriber is a common type in RxJS, and crucial for\n * implementing operators, but it is rarely used as a public API.\n */\nexport class Subscriber<T> extends Subscription implements Observer<T> {\n /**\n * A static factory for a Subscriber, given a (potentially partial) definition\n * of an Observer.\n * @param next The `next` callback of an Observer.\n * @param error The `error` callback of an\n * Observer.\n * @param complete The `complete` callback of an\n * Observer.\n * @return A Subscriber wrapping the (partially defined)\n * Observer represented by the given arguments.\n * @deprecated Do not use. Will be removed in v8. There is no replacement for this\n * method, and there is no reason to be creating instances of `Subscriber` directly.\n * If you have a specific use case, please file an issue.\n */\n static create<T>(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber<T> {\n return new SafeSubscriber(next, error, complete);\n }\n\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected isStopped: boolean = false;\n /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */\n protected destination: Subscriber<any> | Observer<any>; // this `any` is the escape hatch to erase extra type param (e.g. R)\n\n /**\n * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8.\n * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons.\n */\n constructor(destination?: Subscriber<any> | Observer<any>) {\n super();\n if (destination) {\n this.destination = destination;\n // Automatically chain subscriptions together here.\n // if destination is a Subscription, then it is a Subscriber.\n if (isSubscription(destination)) {\n destination.add(this);\n }\n } else {\n this.destination = EMPTY_OBSERVER;\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `next` from\n * the Observable, with a value. The Observable may call this method 0 or more\n * times.\n * @param value The `next` value.\n */\n next(value: T): void {\n if (this.isStopped) {\n handleStoppedNotification(nextNotification(value), this);\n } else {\n this._next(value!);\n }\n }\n\n /**\n * The {@link Observer} callback to receive notifications of type `error` from\n * the Observable, with an attached `Error`. Notifies the Observer that\n * the Observable has experienced an error condition.\n * @param err The `error` exception.\n */\n error(err?: any): void {\n if (this.isStopped) {\n handleStoppedNotification(errorNotification(err), this);\n } else {\n this.isStopped = true;\n this._error(err);\n }\n }\n\n /**\n * The {@link Observer} callback to receive a valueless notification of type\n * `complete` from the Observable. Notifies the Observer that the Observable\n * has finished sending push-based notifications.\n */\n complete(): void {\n if (this.isStopped) {\n handleStoppedNotification(COMPLETE_NOTIFICATION, this);\n } else {\n this.isStopped = true;\n this._complete();\n }\n }\n\n unsubscribe(): void {\n if (!this.closed) {\n this.isStopped = true;\n super.unsubscribe();\n this.destination = null!;\n }\n }\n\n protected _next(value: T): void {\n this.destination.next(value);\n }\n\n protected _error(err: any): void {\n try {\n this.destination.error(err);\n } finally {\n this.unsubscribe();\n }\n }\n\n protected _complete(): void {\n try {\n this.destination.complete();\n } finally {\n this.unsubscribe();\n }\n }\n}\n\n/**\n * This bind is captured here because we want to be able to have\n * compatibility with monoid libraries that tend to use a method named\n * `bind`. In particular, a library called Monio requires this.\n */\nconst _bind = Function.prototype.bind;\n\nfunction bind<Fn extends (...args: any[]) => any>(fn: Fn, thisArg: any): Fn {\n return _bind.call(fn, thisArg);\n}\n\n/**\n * Internal optimization only, DO NOT EXPOSE.\n * @internal\n */\nclass ConsumerObserver<T> implements Observer<T> {\n constructor(private partialObserver: Partial<Observer<T>>) {}\n\n next(value: T): void {\n const { partialObserver } = this;\n if (partialObserver.next) {\n try {\n partialObserver.next(value);\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n\n error(err: any): void {\n const { partialObserver } = this;\n if (partialObserver.error) {\n try {\n partialObserver.error(err);\n } catch (error) {\n handleUnhandledError(error);\n }\n } else {\n handleUnhandledError(err);\n }\n }\n\n complete(): void {\n const { partialObserver } = this;\n if (partialObserver.complete) {\n try {\n partialObserver.complete();\n } catch (error) {\n handleUnhandledError(error);\n }\n }\n }\n}\n\nexport class SafeSubscriber<T> extends Subscriber<T> {\n constructor(\n observerOrNext?: Partial<Observer<T>> | ((value: T) => void) | null,\n error?: ((e?: any) => void) | null,\n complete?: (() => void) | null\n ) {\n super();\n\n let partialObserver: Partial<Observer<T>>;\n if (isFunction(observerOrNext) || !observerOrNext) {\n // The first argument is a function, not an observer. The next\n // two arguments *could* be observers, or they could be empty.\n partialObserver = {\n next: (observerOrNext ?? undefined) as ((value: T) => void) | undefined,\n error: error ?? undefined,\n complete: complete ?? undefined,\n };\n } else {\n // The first argument is a partial observer.\n let context: any;\n if (this && config.useDeprecatedNextContext) {\n // This is a deprecated path that made `this.unsubscribe()` available in\n // next handler functions passed to subscribe. This only exists behind a flag\n // now, as it is *very* slow.\n context = Object.create(observerOrNext);\n context.unsubscribe = () => this.unsubscribe();\n partialObserver = {\n next: observerOrNext.next && bind(observerOrNext.next, context),\n error: observerOrNext.error && bind(observerOrNext.error, context),\n complete: observerOrNext.complete && bind(observerOrNext.complete, context),\n };\n } else {\n // The \"normal\" path. Just use the partial observer directly.\n partialObserver = observerOrNext;\n }\n }\n\n // Wrap the partial observer to ensure it's a full observer, and\n // make sure proper error handling is accounted for.\n this.destination = new ConsumerObserver(partialObserver);\n }\n}\n\nfunction handleUnhandledError(error: any) {\n if (config.useDeprecatedSynchronousErrorHandling) {\n captureError(error);\n } else {\n // Ideal path, we report this as an unhandled error,\n // which is thrown on a new call stack.\n reportUnhandledError(error);\n }\n}\n\n/**\n * An error handler used when no error handler was supplied\n * to the SafeSubscriber -- meaning no error handler was supplied\n * do the `subscribe` call on our observable.\n * @param err The error to handle\n */\nfunction defaultErrorHandler(err: any) {\n throw err;\n}\n\n/**\n * A handler for notifications that cannot be sent to a stopped subscriber.\n * @param notification The notification being sent.\n * @param subscriber The stopped subscriber.\n */\nfunction handleStoppedNotification(notification: ObservableNotification<any>, subscriber: Subscriber<any>) {\n const { onStoppedNotification } = config;\n onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber));\n}\n\n/**\n * The observer used as a stub for subscriptions where the user did not\n * pass any arguments to `subscribe`. Comes with the default error handling\n * behavior.\n */\nexport const EMPTY_OBSERVER: Readonly<Observer<any>> & { closed: true } = {\n closed: true,\n next: noop,\n error: defaultErrorHandler,\n complete: noop,\n};\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { OperatorFunction } from '../types';\nimport { isFunction } from './isFunction';\n\n/**\n * Used to determine if an object is an Observable with a lift function.\n */\nexport function hasLift(source: any): source is { lift: InstanceType<typeof Observable>['lift'] } {\n return isFunction(source?.lift);\n}\n\n/**\n * Creates an `OperatorFunction`. Used to define operators throughout the library in a concise way.\n * @param init The logic to connect the liftedSource to the subscriber at the moment of subscription.\n */\nexport function operate<T, R>(\n init: (liftedSource: Observable<T>, subscriber: Subscriber<R>) => (() => void) | void\n): OperatorFunction<T, R> {\n return (source: Observable<T>) => {\n if (hasLift(source)) {\n return source.lift(function (this: Subscriber<R>, liftedSource: Observable<T>) {\n try {\n return init(liftedSource, this);\n } catch (err) {\n this.error(err);\n }\n });\n }\n throw new TypeError('Unable to lift unknown Observable type');\n };\n}\n", "import { Subscriber } from '../Subscriber';\n\n/**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional teardown logic here. This will only be called on teardown if the\n * subscriber itself is not already closed. This is called after all other teardown logic is executed.\n */\nexport function createOperatorSubscriber<T>(\n destination: Subscriber<any>,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n onFinalize?: () => void\n): Subscriber<T> {\n return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);\n}\n\n/**\n * A generic helper for allowing operators to be created with a Subscriber and\n * use closures to capture necessary state from the operator function itself.\n */\nexport class OperatorSubscriber<T> extends Subscriber<T> {\n /**\n * Creates an instance of an `OperatorSubscriber`.\n * @param destination The downstream subscriber.\n * @param onNext Handles next values, only called if this subscriber is not stopped or closed. Any\n * error that occurs in this function is caught and sent to the `error` method of this subscriber.\n * @param onError Handles errors from the subscription, any errors that occur in this handler are caught\n * and send to the `destination` error handler.\n * @param onComplete Handles completion notification from the subscription. Any errors that occur in\n * this handler are sent to the `destination` error handler.\n * @param onFinalize Additional finalization logic here. This will only be called on finalization if the\n * subscriber itself is not already closed. This is called after all other finalization logic is executed.\n * @param shouldUnsubscribe An optional check to see if an unsubscribe call should truly unsubscribe.\n * NOTE: This currently **ONLY** exists to support the strange behavior of {@link groupBy}, where unsubscription\n * to the resulting observable does not actually disconnect from the source if there are active subscriptions\n * to any grouped observable. (DO NOT EXPOSE OR USE EXTERNALLY!!!)\n */\n constructor(\n destination: Subscriber<any>,\n onNext?: (value: T) => void,\n onComplete?: () => void,\n onError?: (err: any) => void,\n private onFinalize?: () => void,\n private shouldUnsubscribe?: () => boolean\n ) {\n // It's important - for performance reasons - that all of this class's\n // members are initialized and that they are always initialized in the same\n // order. This will ensure that all OperatorSubscriber instances have the\n // same hidden class in V8. This, in turn, will help keep the number of\n // hidden classes involved in property accesses within the base class as\n // low as possible. If the number of hidden classes involved exceeds four,\n // the property accesses will become megamorphic and performance penalties\n // will be incurred - i.e. inline caches won't be used.\n //\n // The reasons for ensuring all instances have the same hidden class are\n // further discussed in this blog post from Benedikt Meurer:\n // https://benediktmeurer.de/2018/03/23/impact-of-polymorphism-on-component-based-frameworks-like-react/\n super(destination);\n this._next = onNext\n ? function (this: OperatorSubscriber<T>, value: T) {\n try {\n onNext(value);\n } catch (err) {\n destination.error(err);\n }\n }\n : super._next;\n this._error = onError\n ? function (this: OperatorSubscriber<T>, err: any) {\n try {\n onError(err);\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._error;\n this._complete = onComplete\n ? function (this: OperatorSubscriber<T>) {\n try {\n onComplete();\n } catch (err) {\n // Send any errors that occur down stream.\n destination.error(err);\n } finally {\n // Ensure finalization.\n this.unsubscribe();\n }\n }\n : super._complete;\n }\n\n unsubscribe() {\n if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {\n const { closed } = this;\n super.unsubscribe();\n // Execute additional teardown if we have any and we didn't already do so.\n !closed && this.onFinalize?.();\n }\n }\n}\n", "import { createErrorClass } from './createErrorClass';\n\nexport interface EmptyError extends Error {}\n\nexport interface EmptyErrorCtor {\n /**\n * @deprecated Internal implementation detail. Do not construct error instances.\n * Cannot be tagged as internal: https://github.com/ReactiveX/rxjs/issues/6269\n */\n new (): EmptyError;\n}\n\n/**\n * An error thrown when an Observable or a sequence was queried but has no\n * elements.\n *\n * @see {@link first}\n * @see {@link last}\n * @see {@link single}\n * @see {@link firstValueFrom}\n * @see {@link lastValueFrom}\n */\nexport const EmptyError: EmptyErrorCtor = createErrorClass(\n (_super) =>\n function EmptyErrorImpl(this: any) {\n _super(this);\n this.name = 'EmptyError';\n this.message = 'no elements in sequence';\n }\n);\n", "import { Observable } from './Observable';\nimport { EmptyError } from './util/EmptyError';\nimport { SafeSubscriber } from './Subscriber';\n\nexport interface FirstValueFromConfig<T> {\n defaultValue: T;\n}\n\nexport function firstValueFrom<T, D>(source: Observable<T>, config: FirstValueFromConfig<D>): Promise<T | D>;\nexport function firstValueFrom<T>(source: Observable<T>): Promise<T>;\n\n/**\n * Converts an observable to a promise by subscribing to the observable,\n * and returning a promise that will resolve as soon as the first value\n * arrives from the observable. The subscription will then be closed.\n *\n * If the observable stream completes before any values were emitted, the\n * returned promise will reject with {@link EmptyError} or will resolve\n * with the default value if a default was specified.\n *\n * If the observable stream emits an error, the returned promise will reject\n * with that error.\n *\n * **WARNING**: Only use this with observables you *know* will emit at least one value,\n * *OR* complete. If the source observable does not emit one value or complete, you will\n * end up with a promise that is hung up, and potentially all of the state of an\n * async function hanging out in memory. To avoid this situation, look into adding\n * something like {@link timeout}, {@link take}, {@link takeWhile}, or {@link takeUntil}\n * amongst others.\n *\n * ## Example\n *\n * Wait for the first value from a stream and emit it from a promise in\n * an async function\n *\n * ```ts\n * import { interval, firstValueFrom } from 'rxjs';\n *\n * async function execute() {\n * const source$ = interval(2000);\n * const firstNumber = await firstValueFrom(source$);\n * console.log(`The first number is ${ firstNumber }`);\n * }\n *\n * execute();\n *\n * // Expected output:\n * // 'The first number is 0'\n * ```\n *\n * @see {@link lastValueFrom}\n *\n * @param source the observable to convert to a promise\n * @param config a configuration object to define the `defaultValue` to use if the source completes without emitting a value\n */\nexport function firstValueFrom<T, D>(source: Observable<T>, config?: FirstValueFromConfig<D>): Promise<T | D> {\n const hasConfig = typeof config === 'object';\n return new Promise<T | D>((resolve, reject) => {\n const subscriber = new SafeSubscriber<T>({\n next: (value) => {\n resolve(value);\n subscriber.unsubscribe();\n },\n error: reject,\n complete: () => {\n if (hasConfig) {\n resolve(config!.defaultValue);\n } else {\n reject(new EmptyError());\n }\n },\n });\n source.subscribe(subscriber);\n });\n}\n", "import { Observable } from '../Observable';\nimport { Subscriber } from '../Subscriber';\nimport { createOperatorSubscriber } from './OperatorSubscriber';\n\n/**\n * A basic scan operation. This is used for `scan` and `reduce`.\n * @param accumulator The accumulator to use\n * @param seed The seed value for the state to accumulate\n * @param hasSeed Whether or not a seed was provided\n * @param emitOnNext Whether or not to emit the state on next\n * @param emitBeforeComplete Whether or not to emit the before completion\n */\n\nexport function scanInternals<V, A, S>(\n accumulator: (acc: V | A | S, value: V, index: number) => A,\n seed: S,\n hasSeed: boolean,\n emitOnNext: boolean,\n emitBeforeComplete?: undefined | true\n) {\n return (source: Observable<V>, subscriber: Subscriber<any>) => {\n // Whether or not we have state yet. This will only be\n // false before the first value arrives if we didn't get\n // a seed value.\n let hasState = hasSeed;\n // The state that we're tracking, starting with the seed,\n // if there is one, and then updated by the return value\n // from the accumulator on each emission.\n let state: any = seed;\n // An index to pass to the accumulator function.\n let index = 0;\n\n // Subscribe to our source. All errors and completions are passed through.\n source.subscribe(\n createOperatorSubscriber(\n subscriber,\n (value) => {\n // Always increment the index.\n const i = index++;\n // Set the state\n state = hasState\n ? // We already have state, so we can get the new state from the accumulator\n accumulator(state, value, i)\n : // We didn't have state yet, a seed value was not provided, so\n\n // we set the state to the first value, and mark that we have state now\n ((hasState = true), value);\n\n // Maybe send it to the consumer.\n emitOnNext && subscriber.next(state);\n },\n // If an onComplete was given, call it, otherwise\n // just pass through the complete notification to the consumer.\n emitBeforeComplete &&\n (() => {\n hasState && subscriber.next(state);\n subscriber.complete();\n })\n )\n );\n };\n}\n", "import { scanInternals } from './scanInternals';\nimport { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\n\nexport function reduce<V, A = V>(accumulator: (acc: A | V, value: V, index: number) => A): OperatorFunction<V, V | A>;\nexport function reduce<V, A>(accumulator: (acc: A, value: V, index: number) => A, seed: A): OperatorFunction<V, A>;\nexport function reduce<V, A, S = A>(accumulator: (acc: A | S, value: V, index: number) => A, seed: S): OperatorFunction<V, A>;\n\n/**\n * Applies an accumulator function over the source Observable, and returns the\n * accumulated result when the source completes, given an optional seed value.\n *\n * <span class=\"informal\">Combines together all values emitted on the source,\n * using an accumulator function that knows how to join a new source value into\n * the accumulation from the past.</span>\n *\n * \n *\n * Like\n * [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce),\n * `reduce` applies an `accumulator` function against an accumulation and each\n * value of the source Observable (from the past) to reduce it to a single\n * value, emitted on the output Observable. Note that `reduce` will only emit\n * one value, only when the source Observable completes. It is equivalent to\n * applying operator {@link scan} followed by operator {@link last}.\n *\n * Returns an Observable that applies a specified `accumulator` function to each\n * item emitted by the source Observable. If a `seed` value is specified, then\n * that value will be used as the initial value for the accumulator. If no seed\n * value is specified, the first item of the source is used as the seed.\n *\n * ## Example\n *\n * Count the number of click events that happened in 5 seconds\n *\n * ```ts\n * import { fromEvent, takeUntil, interval, map, reduce } from 'rxjs';\n *\n * const clicksInFiveSeconds = fromEvent(document, 'click')\n * .pipe(takeUntil(interval(5000)));\n *\n * const ones = clicksInFiveSeconds.pipe(map(() => 1));\n * const seed = 0;\n * const count = ones.pipe(reduce((acc, one) => acc + one, seed));\n *\n * count.subscribe(x => console.log(x));\n * ```\n *\n * @see {@link count}\n * @see {@link expand}\n * @see {@link mergeScan}\n * @see {@link scan}\n *\n * @param accumulator The accumulator function called on each source value.\n * @param seed The initial accumulation value.\n * @return A function that returns an Observable that emits a single value that\n * is the result of accumulating the values emitted by the source Observable.\n */\nexport function reduce<V, A>(accumulator: (acc: V | A, value: V, index: number) => A, seed?: any): OperatorFunction<V, V | A> {\n return operate(scanInternals(accumulator, seed, arguments.length >= 2, false, true));\n}\n", "import { reduce } from './reduce';\nimport { OperatorFunction } from '../types';\nimport { operate } from '../util/lift';\n\nconst arrReducer = (arr: any[], value: any) => (arr.push(value), arr);\n\n/**\n * Collects all source emissions and emits them as an array when the source completes.\n *\n * <span class=\"informal\">Get all values inside an array when the source completes</span>\n *\n * \n *\n * `toArray` will wait until the source Observable completes before emitting\n * the array containing all emissions. When the source Observable errors no\n * array will be emitted.\n *\n * ## Example\n *\n * ```ts\n * import { interval, take, toArray } from 'rxjs';\n *\n * const source = interval(1000);\n * const example = source.pipe(\n * take(10),\n * toArray()\n * );\n *\n * example.subscribe(value => console.log(value));\n *\n * // output: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]\n * ```\n *\n * @return A function that returns an Observable that emits an array of items\n * emitted by the source Observable when source completes.\n */\nexport function toArray<T>(): OperatorFunction<T, T[]> {\n // Because arrays are mutable, and we're mutating the array in this\n // reducer process, we have to encapsulate the creation of the initial\n // array within this `operate` function.\n return operate((source, subscriber) => {\n reduce(arrReducer, [] as T[])(source).subscribe(subscriber);\n });\n}\n"],
|
|
5
|
+
"mappings": "yFAAA,IAAAA,EAAAC,GAAA,CAAAC,GAAAC,IAAA,CAAAA,EAAO,QAAU,eAAe,yCAAyC,ICAzE,IAAAC,EAA+B,QAC/BC,GAA4B,OCe5B,IAAIC,EAAgB,SAASC,EAAGC,EAAG,CACjC,OAAAF,EAAgB,OAAO,gBAClB,CAAE,UAAW,CAAC,CAAE,YAAa,OAAS,SAAUC,EAAGC,EAAG,CAAED,EAAE,UAAYC,CAAG,GAC1E,SAAUD,EAAGC,EAAG,CAAE,QAASC,KAAKD,EAAO,OAAO,UAAU,eAAe,KAAKA,EAAGC,CAAC,IAAGF,EAAEE,CAAC,EAAID,EAAEC,CAAC,EAAG,EAC7FH,EAAcC,EAAGC,CAAC,CAC3B,EAEO,SAASE,EAAUH,EAAGC,EAAG,CAC9B,GAAI,OAAOA,GAAM,YAAcA,IAAM,KACjC,MAAM,IAAI,UAAU,uBAAyB,OAAOA,CAAC,EAAI,+BAA+B,EAC5FF,EAAcC,EAAGC,CAAC,EAClB,SAASG,G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MAAM,YAAa,CACjB,MAAO,CAAC,IAAI,MAAM,KAAK,WAAW,GAAG,KAAK,CAAC,CAC7C,CAEA,MAAM,OAAOO,EAAY,CACvB,IAAMN,EAAU,MAAM,KAAK,UAAU,EAC/BE,GAAQ,MAAM,KAAK,WAAW,GAAG,IAAII,CAAE,GAAK,CAAC,EACnD,OAAOC,EACLP,EACG,6BACCE,EAAK,IAAIC,IAAY,CACnB,QAAAA,EACA,MAAO,EACP,IAAK,IACL,aAAc,EAChB,EAAE,CACJ,EACC,KAAKK,EAAQ,CAAC,CACnB,CACF,CACF",
|
|
6
|
+
"names": ["require_BaseAdapter", "__commonJSMin", "exports", "module", "import_configuration", "import_BaseAdapter", "extendStatics", "d", "b", "p", "__extends", "__", "__values", "o", "s", "m", "i", "__read", "n", "r", "ar", "e", "error", "__spreadArray", "to", "from", "pack", "i", "l", "ar", "isFunction", "value", "createErrorClass", "createImpl", "_super", "instance", "ctorFunc", "UnsubscriptionError", "createErrorClass", "_super", "errors", "err", "i", "arrRemove", "arr", "item", "index", "Subscription", "initialTeardown", "errors", "_parentage", "_parentage_1", "__values", "_parentage_1_1", "parent_1", "initialFinalizer", "isFunction", "e", "UnsubscriptionError", "_finalizers", "_finalizers_1", "_finalizers_1_1", "finalizer", "execFinalizer", "err", "__spreadArray", "__read", "teardown", "_a", "parent", "arrRemove", "empty", "EMPTY_SUBSCRIPTION", "Subscription", "isSubscription", "value", "isFunction", "execFinalizer", "finalizer", "config", "timeoutProvider", "handler", "timeout", "args", "_i", "delegate", "__spreadArray", "__read", "handle", "reportUnhandledError", "err", "timeoutProvider", "onUnhandledError", "config", "noop", "COMPLETE_NOTIFICATION", "createNotification", "errorNotification", "error", "nextNotification", "value", "kind", "context", "captureError", "err", "config", "context", "Subscriber", "_super", "__extends", "destination", "_this", "isSubscription", "EMPTY_OBSERVER", "next", "error", "complete", "SafeSubscriber", "value", "handleStoppedNotification", "nextNotification", "err", "errorNotification", "COMPLETE_NOTIFICATION", "Subscription", "_bind", "bind", "fn", "thisArg", "ConsumerObserver", "partialObserver", "value", "error", "handleUnhandledError", "err", "SafeSubscriber", "_super", "__extends", "observerOrNext", "complete", "_this", "isFunction", "context_1", "config", "Subscriber", "handleUnhandledError", "error", "config", "captureError", "reportUnhandledError", "defaultErrorHandler", "err", "handleStoppedNotification", "notification", "subscriber", "onStoppedNotification", "timeoutProvider", "EMPTY_OBSERVER", "noop", "hasLift", "source", "isFunction", "operate", "init", "liftedSource", "err", "createOperatorSubscriber", "destination", "onNext", "onComplete", "onError", "onFinalize", "OperatorSubscriber", "_super", "__extends", "shouldUnsubscribe", "_this", "value", "err", "closed_1", "_a", "Subscriber", "EmptyError", "createErrorClass", "_super", "firstValueFrom", "source", "config", "hasConfig", "resolve", "reject", "subscriber", "SafeSubscriber", "value", "EmptyError", "scanInternals", "accumulator", "seed", "hasSeed", "emitOnNext", "emitBeforeComplete", "source", "subscriber", "hasState", "state", "index", "createOperatorSubscriber", "value", "i", "reduce", "accumulator", "seed", "operate", "scanInternals", "arrReducer", "arr", "value", "toArray", "operate", "source", "subscriber", "reduce", "BgzipFastaMsaAdapter", "getSubAdapter", "e", "adapter", "separator", "rows", "refName", "msaId", "group", "id", "firstValueFrom", "toArray"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as p}from"./chunk-YOTSFJMU.js";import{a as P}from"./chunk-CVLB4VFP.js";import{a as R}from"./chunk-DNFD5II2.js";import{a as q}from"./chunk-BX4Z274Q.js";import{a as W}from"./chunk-J6KYLXRD.js";import{b as a}from"./chunk-FY3BTKY4.js";var t=a(W(),1),i=a(R(),1),e=a(q(),1),v=a(P(),1);function z(r){requestAnimationFrame(()=>{requestAnimationFrame(r)})}var O=(0,v.observer)(function({model:r,onClose:c}){let[s,f]=(0,t.useState)(!0),[n,x]=(0,t.useState)(!0),[o,k]=(0,t.useState)("viewport"),[h,y]=(0,t.useState)(),[m,d]=(0,t.useState)(!1),T=(0,e.useTheme)(),{totalWidth:C,totalHeight:b,effectiveTreeAreaWidth:w,rowPanelsWidth:M,turnedOnTracks:A,totalTrackAreaHeight:S,numColumns:F,leaves:G,showMsaLetters:I,treeOverviewHeight:D}=r,E=A.length>0,H=C+w+M,L=b+(n?S:0)+D,g=I&&o==="entire"?F*G.length:0,V=g>1e5;return t.default.createElement(i.Dialog,{onClose:()=>{c()},open:!0,title:"Export SVG"},t.default.createElement(e.DialogContent,null,h?t.default.createElement(i.ErrorMessage,{error:h}):null,t.default.createElement(e.Typography,null,"Settings:"),t.default.createElement(p,{label:"Include minimap?",disabled:o==="entire",checked:s,onChange:()=>{f(!s)}}),E?t.default.createElement(p,{label:"Include tracks?",checked:n,onChange:()=>{x(!n)}}):null,t.default.createElement("div",null,t.default.createElement(e.FormControl,null,t.default.createElement(e.FormLabel,null,"Export type"),t.default.createElement(e.RadioGroup,{value:o,onChange:l=>{let{value:u}=l.target;(u==="entire"||u==="viewport")&&k(u)}},t.default.createElement(e.FormControlLabel,{value:"entire",control:t.default.createElement(e.Radio,null),label:"Entire MSA"}),t.default.createElement(e.FormControlLabel,{value:"viewport",control:t.default.createElement(e.Radio,null),label:"Current viewport only"})))),V?t.default.createElement(e.Alert,{severity:"warning",style:{marginTop:8}},"The entire MSA is ",Math.round(H),"x",Math.round(L)," pixels and draws"," ",Math.round(g/1e3),"k residue letters, each its own SVG element. Export may be slow or fail \u2014 zooming out far enough to hide the letters exports the same alignment as an image instead."):null),t.default.createElement(e.DialogActions,null,t.default.createElement(e.Button,{variant:"contained",color:"primary",disabled:m,startIcon:m?t.default.createElement(e.CircularProgress,{size:16,color:"inherit"}):null,onClick:()=>{d(!0),z(()=>{r.exportSVG({theme:T,includeMinimap:s,includeTracks:E&&n,exportType:o}).then(()=>{c()}).catch(l=>{console.error(l),y(l)}).finally(()=>{d(!1)})})}},m?"Exporting\u2026":"Export"),t.default.createElement(e.Button,{variant:"contained",color:"secondary",onClick:()=>{c()}},"Cancel")))}),_=O;export{_ as default};
|
|
2
|
+
//# sourceMappingURL=ExportSVGDialog-TYYPI6VB.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/react-msaview@9.0.0_3e54acfe76b6ad0d26e91cd532b7f775/node_modules/react-msaview/src/components/dialogs/ExportSVGDialog.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { Dialog, ErrorMessage } from '@jbrowse/core/ui'\nimport {\n Alert,\n Button,\n CircularProgress,\n DialogActions,\n DialogContent,\n FormControl,\n FormControlLabel,\n FormLabel,\n Radio,\n RadioGroup,\n Typography,\n useTheme,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport Checkbox2 from '../Checkbox2.tsx'\n\nimport type { MsaViewModel } from '../../model.ts'\n\n// Run after the browser has painted. A requestAnimationFrame callback still\n// runs *before* the frame it was queued for, so one alone hands the main thread\n// to the render with the spinner not yet on screen; the second fires once that\n// frame is out.\nfunction afterPaint(fn: () => void) {\n requestAnimationFrame(() => {\n requestAnimationFrame(fn)\n })\n}\n\nconst ExportSVGDialog = observer(function ({\n model,\n onClose,\n}: {\n model: MsaViewModel\n onClose: () => void\n}) {\n const [includeMinimap, setIncludeMinimap] = useState(true)\n const [includeTracks, setIncludeTracks] = useState(true)\n const [exportType, setExportType] = useState<'entire' | 'viewport'>(\n 'viewport',\n )\n const [error, setError] = useState<unknown>()\n const [exporting, setExporting] = useState(false)\n const theme = useTheme()\n const {\n totalWidth,\n totalHeight,\n effectiveTreeAreaWidth,\n rowPanelsWidth,\n turnedOnTracks,\n totalTrackAreaHeight,\n numColumns,\n leaves,\n showMsaLetters,\n treeOverviewHeight,\n } = model\n const hasTracks = turnedOnTracks.length > 0\n const entireWidth = totalWidth + effectiveTreeAreaWidth + rowPanelsWidth\n const entireHeight =\n totalHeight +\n (includeTracks ? totalTrackAreaHeight : 0) +\n treeOverviewHeight\n // the background is one raster image whatever its size, so what the figure\n // actually costs is its residue letters: each is an svg element of its own.\n // Past roughly this many the export runs to tens of seconds and can exhaust\n // the tab's memory outright\n const glyphs =\n showMsaLetters && exportType === 'entire' ? numColumns * leaves.length : 0\n const isLargeExport = glyphs > 100_000\n return (\n <Dialog\n onClose={() => {\n onClose()\n }}\n open\n title=\"Export SVG\"\n >\n <DialogContent>\n {error ? <ErrorMessage error={error} /> : null}\n <Typography>Settings:</Typography>\n <Checkbox2\n label=\"Include minimap?\"\n disabled={exportType === 'entire'}\n checked={includeMinimap}\n onChange={() => {\n setIncludeMinimap(!includeMinimap)\n }}\n />\n {hasTracks ? (\n <Checkbox2\n label=\"Include tracks?\"\n checked={includeTracks}\n onChange={() => {\n setIncludeTracks(!includeTracks)\n }}\n />\n ) : null}\n <div>\n <FormControl>\n <FormLabel>Export type</FormLabel>\n <RadioGroup\n value={exportType}\n onChange={event => {\n const { value } = event.target\n if (value === 'entire' || value === 'viewport') {\n setExportType(value)\n }\n }}\n >\n <FormControlLabel\n value=\"entire\"\n control={<Radio />}\n label=\"Entire MSA\"\n />\n <FormControlLabel\n value=\"viewport\"\n control={<Radio />}\n label=\"Current viewport only\"\n />\n </RadioGroup>\n </FormControl>\n </div>\n {isLargeExport ? (\n <Alert severity=\"warning\" style={{ marginTop: 8 }}>\n The entire MSA is {Math.round(entireWidth)}x\n {Math.round(entireHeight)} pixels and draws{' '}\n {Math.round(glyphs / 1000)}k residue letters, each its own SVG\n element. Export may be slow or fail \u2014 zooming out far enough to hide\n the letters exports the same alignment as an image instead.\n </Alert>\n ) : null}\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"contained\"\n color=\"primary\"\n // rendering runs on the main thread and a large figure holds it for\n // seconds; without this the button stays live through the freeze and\n // a second click starts a second export\n disabled={exporting}\n startIcon={\n exporting ? <CircularProgress size={16} color=\"inherit\" /> : null\n }\n onClick={() => {\n setExporting(true)\n afterPaint(() => {\n void model\n .exportSVG({\n theme,\n includeMinimap,\n includeTracks: hasTracks && includeTracks,\n exportType,\n })\n .then(() => {\n onClose()\n })\n .catch((e: unknown) => {\n console.error(e)\n setError(e)\n })\n .finally(() => {\n setExporting(false)\n })\n })\n }}\n >\n {exporting ? 'Exporting\u2026' : 'Export'}\n </Button>\n <Button\n variant=\"contained\"\n color=\"secondary\"\n onClick={() => {\n onClose()\n }}\n >\n Cancel\n </Button>\n </DialogActions>\n </Dialog>\n )\n})\n\nexport default ExportSVGDialog\n"],
|
|
5
|
+
"mappings": "gPAAA,IAAAA,EAAgC,SAEhCC,EAAqC,SACrCC,EAaO,SACPC,EAAyB,SAUzB,SAASC,EAAWC,EAAc,CAChC,sBAAsB,IAAK,CACzB,sBAAsBA,CAAE,CAC1B,CAAC,CACH,CAEA,IAAMC,KAAkB,YAAS,SAAU,CACzC,MAAAC,EACA,QAAAC,CAAO,EAIR,CACC,GAAM,CAACC,EAAgBC,CAAiB,KAAI,YAAS,EAAI,EACnD,CAACC,EAAeC,CAAgB,KAAI,YAAS,EAAI,EACjD,CAACC,EAAYC,CAAa,KAAI,YAClC,UAAU,EAEN,CAACC,EAAOC,CAAQ,KAAI,YAAQ,EAC5B,CAACC,EAAWC,CAAY,KAAI,YAAS,EAAK,EAC1CC,KAAQ,YAAQ,EAChB,CACJ,WAAAC,EACA,YAAAC,EACA,uBAAAC,EACA,eAAAC,EACA,eAAAC,EACA,qBAAAC,EACA,WAAAC,EACA,OAAAC,EACA,eAAAC,EACA,mBAAAC,CAAkB,EAChBtB,EACEuB,EAAYN,EAAe,OAAS,EACpCO,EAAcX,EAAaE,EAAyBC,EACpDS,EACJX,GACCV,EAAgBc,EAAuB,GACxCI,EAKII,EACJL,GAAkBf,IAAe,SAAWa,EAAaC,EAAO,OAAS,EACrEO,EAAgBD,EAAS,IAC/B,OACE,EAAAE,QAAA,cAAC,SAAM,CACL,QAAS,IAAK,CACZ3B,EAAO,CACT,EACA,KAAI,GACJ,MAAM,YAAY,EAElB,EAAA2B,QAAA,cAAC,gBAAa,KACXpB,EAAQ,EAAAoB,Q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AAM,SAAS,CAAA,EAAM,KAE/D,QAAS,IAAK,CACZjB,EAAa,EAAI,EACjBd,EAAW,IAAK,CACTG,EACF,UAAU,CACT,MAAAY,EACA,eAAAV,EACA,cAAeqB,GAAanB,EAC5B,WAAAE,EACD,EACA,KAAK,IAAK,CACTL,EAAO,CACT,CAAC,EACA,MAAO+B,GAAc,CACpB,QAAQ,MAAMA,CAAC,EACfvB,EAASuB,CAAC,CACZ,CAAC,EACA,QAAQ,IAAK,CACZrB,EAAa,EAAK,CACpB,CAAC,CACL,CAAC,CACH,CAAC,EAEAD,EAAY,kBAAe,QAAQ,EAEtC,EAAAkB,QAAA,cAAC,SAAM,CACL,QAAQ,YACR,MAAM,YACN,QAAS,IAAK,CACZ3B,EAAO,CACT,CAAC,EAAA,QAAA,CAGM,CACK,CAGtB,CAAC,EAEDgC,EAAelC",
|
|
6
|
+
"names": ["import_react", "import_ui", "import_material", "import_mobx_react", "afterPaint", "fn", "ExportSVGDialog", "model", "onClose", "includeMinimap", "setIncludeMinimap", "includeTracks", "setIncludeTracks", "exportType", "setExportType", "error", "setError", "exporting", "setExporting", "theme", "totalWidth", "totalHeight", "effectiveTreeAreaWidth", "rowPanelsWidth", "turnedOnTracks", "totalTrackAreaHeight", "numColumns", "leaves", "showMsaLetters", "treeOverviewHeight", "hasTracks", "entireWidth", "entireHeight", "glyphs", "isLargeExport", "React", "Checkbox2", "event", "value", "e", "ExportSVGDialog_default"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{a as C}from"./chunk-CVLB4VFP.js";import{a as F}from"./chunk-DNFD5II2.js";import{a as k}from"./chunk-BX4Z274Q.js";import{a as T}from"./chunk-J6KYLXRD.js";import{b as c}from"./chunk-FY3BTKY4.js";var e=c(T(),1),p=c(F(),1),t=c(k(),1),s=c(C(),1);function w(n,a){return[n.accession,n.name,n.description].some(o=>o?.toLowerCase().includes(a))}var x=(0,s.observer)(function({model:n,accessions:a}){let o=u=>{for(let m of a)n.setFilter(m,u)};return e.default.createElement("div",null,e.default.createElement(t.Button,{onClick:()=>{o(!0)}},"Toggle all on"),e.default.createElement(t.Button,{onClick:()=>{o(!1)}},"Toggle all off"))}),v=(0,s.observer)(function({model:n}){let{annotationTypes:a,annotations:o,featureColors:u,fillPalette:m}=n,[f,h]=(0,e.useState)(""),g=f.trim().toLowerCase(),d=[...a.values()].filter(l=>!g||w(l,g)),i=new Map,E=new Map;for(let l of o){let{accession:r}=l;i.set(r,(i.get(r)??0)+1),E.has(r)||E.set(r,u.get(l)?.fill??m[r])}return e.default.createElement(e.default.Fragment,null,e.default.createElement(t.TextField,{label:"Filter",size:"small",value:f,onChange:l=>{h(l.target.value)}}),e.default.createElement(x,{model:n,accessions:d.map(l=>l.accession)}),e.default.createElement(t.Table,{size:"small"},e.default.createElement(t.TableHead,null,e.default.createElement(t.TableRow,null,e.default.createElement(t.TableCell,{padding:"checkbox"}),e.default.createElement(t.TableCell,null,"color"),e.default.createElement(t.TableCell,null,"accession"),e.default.createElement(t.TableCell,null,"name"),e.default.createElement(t.TableCell,null,"count"),e.default.createElement(t.TableCell,null,"description"))),e.default.createElement(t.TableBody,null,d.map(({accession:l,name:r,description:b})=>e.default.createElement(t.TableRow,{key:l},e.default.createElement(t.TableCell,{padding:"checkbox"},e.default.createElement(t.Checkbox,{checked:!n.turnedOffFeatures.get(l),onChange:()=>{n.setFilter(l,!!n.turnedOffFeatures.get(l))}})),e.default.createElement(t.TableCell,null,e.default.createElement("div",{style:{width:20,height:20,background:E.get(l)}})),e.default.createElement(t.TableCell,null,l),e.default.createElement(t.TableCell,null,r),e.default.createElement(t.TableCell,null,i.get(l)),e.default.createElement(t.TableCell,null,b))))))}),y=(0,s.observer)(function({onClose:n,model:a}){return e.default.createElement(p.Dialog,{onClose:()=>{n()},open:!0,title:"Feature filters",maxWidth:"xl"},e.default.createElement(t.DialogContent,null,e.default.createElement(v,{model:a})))}),D=y;export{D as default};
|
|
2
|
-
//# sourceMappingURL=FeatureDialog-
|
|
2
|
+
//# sourceMappingURL=FeatureDialog-ZBX3XQZ5.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../node_modules/.pnpm/react-msaview@
|
|
3
|
+
"sources": ["../../node_modules/.pnpm/react-msaview@9.0.0_3e54acfe76b6ad0d26e91cd532b7f775/node_modules/react-msaview/src/components/dialogs/FeatureDialog.tsx"],
|
|
4
4
|
"sourcesContent": ["import React, { useState } from 'react'\n\nimport { Dialog } from '@jbrowse/core/ui'\nimport {\n Button,\n Checkbox,\n DialogContent,\n Table,\n TableBody,\n TableCell,\n TableHead,\n TableRow,\n TextField,\n} from '@mui/material'\nimport { observer } from 'mobx-react'\n\nimport type { MsaViewModel } from '../../model.ts'\nimport type { Annotation } from '../../types.ts'\n\nfunction matches(type: Annotation, query: string) {\n return [type.accession, type.name, type.description].some(field =>\n field?.toLowerCase().includes(query),\n )\n}\n\nconst Toggles = observer(function ({\n model,\n accessions,\n}: {\n model: MsaViewModel\n accessions: string[]\n}) {\n const setAll = (shown: boolean) => {\n for (const accession of accessions) {\n model.setFilter(accession, shown)\n }\n }\n return (\n <div>\n <Button\n onClick={() => {\n setAll(true)\n }}\n >\n Toggle all on\n </Button>\n\n <Button\n onClick={() => {\n setAll(false)\n }}\n >\n Toggle all off\n </Button>\n </div>\n )\n})\n\nconst FeatureTable = observer(function ({ model }: { model: MsaViewModel }) {\n const { annotationTypes, annotations, featureColors, fillPalette } = model\n const [query, setQuery] = useState('')\n const needle = query.trim().toLowerCase()\n const types = [...annotationTypes.values()].filter(\n type => !needle || matches(type, needle),\n )\n const counts = new Map<string, number>()\n const swatches = new Map<string, string>()\n for (const annot of annotations) {\n const { accession } = annot\n counts.set(accession, (counts.get(accession) ?? 0) + 1)\n if (!swatches.has(accession)) {\n swatches.set(\n accession,\n featureColors.get(annot)?.fill ?? fillPalette[accession]!,\n )\n }\n }\n return (\n <>\n <TextField\n label=\"Filter\"\n size=\"small\"\n value={query}\n onChange={event => {\n setQuery(event.target.value)\n }}\n />\n <Toggles model={model} accessions={types.map(t => t.accession)} />\n <Table size=\"small\">\n <TableHead>\n <TableRow>\n <TableCell padding=\"checkbox\" />\n <TableCell>color</TableCell>\n <TableCell>accession</TableCell>\n <TableCell>name</TableCell>\n <TableCell>count</TableCell>\n <TableCell>description</TableCell>\n </TableRow>\n </TableHead>\n <TableBody>\n {types.map(({ accession, name, description }) => (\n <TableRow key={accession}>\n <TableCell padding=\"checkbox\">\n <Checkbox\n checked={!model.turnedOffFeatures.get(accession)}\n onChange={() => {\n model.setFilter(\n accession,\n !!model.turnedOffFeatures.get(accession),\n )\n }}\n />\n </TableCell>\n <TableCell>\n <div\n style={{\n width: 20,\n height: 20,\n background: swatches.get(accession),\n }}\n />\n </TableCell>\n <TableCell>{accession}</TableCell>\n <TableCell>{name}</TableCell>\n <TableCell>{counts.get(accession)}</TableCell>\n <TableCell>{description}</TableCell>\n </TableRow>\n ))}\n </TableBody>\n </Table>\n </>\n )\n})\n\nconst FeatureTypeDialog = observer(function ({\n onClose,\n model,\n}: {\n onClose: () => void\n model: MsaViewModel\n}) {\n return (\n <Dialog\n onClose={() => {\n onClose()\n }}\n open\n title=\"Feature filters\"\n maxWidth=\"xl\"\n >\n <DialogContent>\n <FeatureTable model={model} />\n </DialogContent>\n </Dialog>\n )\n})\n\nexport default FeatureTypeDialog\n"],
|
|
5
5
|
"mappings": "wMAAA,IAAAA,EAAgC,SAEhCC,EAAuB,SACvBC,EAUO,SACPC,EAAyB,SAKzB,SAASC,EAAQC,EAAkBC,EAAa,CAC9C,MAAO,CAACD,EAAK,UAAWA,EAAK,KAAMA,EAAK,WAAW,EAAE,KAAKE,GACxDA,GAAO,YAAW,EAAG,SAASD,CAAK,CAAC,CAExC,CAEA,IAAME,KAAU,YAAS,SAAU,CACjC,MAAAC,EACA,WAAAC,CAAU,EAIX,CACC,IAAMC,EAAUC,GAAkB,CAChC,QAAWC,KAAaH,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,EAAO,CACT,EACA,KAAI,GACJ,MAAM,kBACN,SAAS,IAAI,EAEb,EAAAjB,QAAA,cAAC,gBAAa,KACZ,EAAAA,QAAA,cAACC,EAAY,CAAC,MAAON,CAAK,CAAA,CAAI,CAChB,CAGtB,CAAC,EAEDuB,EAAeF",
|
|
6
6
|
"names": ["import_react", "import_ui", "import_material", "import_mobx_react", "matches", "type", "query", "field", "Toggles", "model", "accessions", "setAll", "shown", "accession", "React", "FeatureTable", "annotationTypes", "annotations", "featureColors", "fillPalette", "setQuery", "needle", "types", "counts", "swatches", "annot", "event", "t", "name", "description", "FeatureTypeDialog", "onClose", "FeatureDialog_default"]
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{a as Ft}from"./chunk-6YFCSBEE.js";import{D as Et,a as G,c as bt,d as pe,e as se,f as fe,g as te,h as vt,i as Be,j as qe,k as Ee,l as rr,m as Mt,q as kt,r as ot,s as _e,v as Ve,x as qt}from"./chunk-NI3VGKQP.js";import{g as de,h as St,i as Ne,k as tt,l as De,m as At,n as Oe,o as Ct,p as Lt,r as je,s as $e,t as Nt}from"./chunk-F726IWCW.js";import{a as yt,b as Bt,c as nr}from"./chunk-YUKJI2AH.js";import{e as Pt,f as It}from"./chunk-QQ5LZUIO.js";import{a as wt,b as ke,c as xt,d as Tt}from"./chunk-DECSTFAT.js";import{a as V}from"./chunk-NSASZ5FM.js";import{a as be,c as Ie,d as gt}from"./chunk-IBBQUV2I.js";import{a as or}from"./chunk-2IWD4OO4.js";import"./chunk-73KAPCJ2.js";import{a as ve}from"./chunk-CVLB4VFP.js";import{a as we}from"./chunk-DNFD5II2.js";import{a as L}from"./chunk-BX4Z274Q.js";import{a as f}from"./chunk-J6KYLXRD.js";import{a as tr,b as s}from"./chunk-FY3BTKY4.js";var Qo=tr((us,Go)=>{Go.exports=JBrowseExports["@jbrowse/core/data_adapters/dataAdapterCache"]});var A=s(f()),Zo=s(we()),Ro=s(be()),ye=s(L());var K=s(f());var Dt=s(gt(),1),Ot=(0,Ie.createSvgIcon)((0,Dt.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var Ke=s(L()),Lo=s(V());var w=s(f());var U=s(L()),ho=s(ve()),go=s(V());var rt=s(f()),jt=s(L());function ar({children:e,...t}){return rt.default.createElement("div",null,rt.default.createElement(jt.TextField,{...t},e))}var g=ar;var nt=s(f()),$t=s(we()),_t=s(L()),Vt=s(V()),sr=(0,Vt.makeStyles)()({dialogContent:{width:"80em"}});function Y({error:e,children:t}){let{classes:o}=sr();return nt.default.createElement(_t.DialogContent,{className:o.dialogContent},e?nt.default.createElement($t.ErrorMessage,{error:e}):null,t)}var at=s(f()),Gt=s(we()),Qt=s(L());function ie({status:e}){return e==="loading"?at.default.createElement(Gt.LoadingEllipses,{message:"Translating transcript"}):e==="missing"?at.default.createElement(Qt.Typography,{color:"textSecondary",variant:"body2"},"no coding sequence to align"):null}var ce=s(f()),Ut=s(be()),me=s(L());var le=s(f());var Ht=(0,le.createContext)(void 0);function Wt({children:e}){let t=(0,le.useState)(()=>ke()==="splitRight");return le.default.createElement(Ht.Provider,{value:t},e)}function Ge(){let e=(0,le.useContext)(Ht),t=(0,le.useState)(()=>ke()==="splitRight");return e??t}function ir({checked:e,onChange:t}){return ce.default.createElement(me.FormControlLabel,{label:"Open beside the genome view",control:ce.default.createElement(me.Checkbox,{checked:e,onChange:o=>{t(o.target.checked)}})})}function X({onSubmit:e,onCancel:t,submitDisabled:o,hint:r,submitLabel:n="Submit",model:a}){let[i,u]=Ge(),c=!!a&&wt((0,Ut.getSession)(a));return ce.default.createElement(me.DialogActions,{sx:{flexWrap:"wrap",rowGap:1}},c?ce.default.createElement(ir,{checked:i,onChange:u}):null,ce.default.createElement("div",{style:{display:"flex",alignItems:"center",gap:8,marginLeft:"auto"}},r,ce.default.createElement(me.Button,{sx:{flexShrink:0},color:"primary",variant:"contained",disabled:o,onClick:()=>{if(c){let l=i?"splitRight":"stack";xt(l),e(l)}else e(ke())}},n),ce.default.createElement(me.Button,{sx:{flexShrink:0},color:"secondary",variant:"contained",onClick:()=>{t()}},"Cancel")))}var Z=s(f()),xe=s(L()),Jt=s(V());var zt=s(f()),Kt=s(V());var lr=(0,Kt.makeStyles)()({textAreaFont:{fontFamily:"Courier New"}});function st({value:e}){let{classes:t}=lr();return zt.default.createElement(g,{variant:"outlined",multiline:!0,minRows:5,maxRows:10,fullWidth:!0,value:e,slotProps:{input:{readOnly:!0,classes:{input:t.textAreaFont}}}})}var mr=(0,Jt.makeStyles)()({flex:{display:"flex"},minWidth:{minWidth:300},centered:{alignContent:"center",marginLeft:20}});function R({feature:e,options:t,selectedId:o,selectedTranscript:r,setSelectedId:n,proteinSequence:a,sequenceStatus:i="ready",validIds:u}){let{classes:c}=mr(),[l,p]=(0,Z.useState)(!1);return Z.default.createElement(Z.default.Fragment,null,Z.default.createElement("div",{className:c.flex},Z.default.createElement(xe.TextField,{variant:"outlined",label:`Choose isoform of ${te(e)}`,helperText:"the query row, so the alignment stays linked to the genome view",select:!0,className:c.minWidth,value:o,onChange:d=>{n(d.target.value)}},t.map(d=>{let m=u?u.some(v=>se(d,v)):!0,{len:b,mod:S}=bt(d);return Z.default.createElement(xe.MenuItem,{value:pe(d),key:d.id(),disabled:!m},fe(d)," (",b," aa)"," ",S?" (possible fragment)":"",u?m?" (has data)":" (no data)":"")})),Z.default.createElement("div",{className:c.centered},Z.default.createElement(xe.Button,{variant:"contained",color:"primary",onClick:()=>{p(!l)}},l?"Hide sequence":"Show sequence"))),l?Z.default.createElement(st,{value:a?`>${fe(r)}
|
|
2
|
+
${a}`:i==="missing"?"This transcript has no coding sequence, so there is nothing to translate.":i==="error"?"The sequence could not be fetched.":"Loading..."}):null)}var Qe=s(f()),Yt=s(be());var Te={drawNodeBubbles:!0,colWidth:10,rowHeight:12};function Q({view:e,feature:t,placement:o,...r}){return Tt((0,Yt.getSession)(e),{placement:o,connectedViewId:e.id,connectedFeature:t?.toJSON(),...r})}function oe(e){let[t,o]=(0,Qe.useState)(),r=(0,Qe.useRef)(!1);return{launchError:t,submit:n=>{r.current||(r.current=!0,o(void 0),n().then(e,a=>{r.current=!1,console.error(a),o(a)}))}}}var We=s(f());var Zt=s(f()),Rt=s(be()),eo=s(rr());var H=s(f()),Xt=e=>e==null||e===!1;function ur(e){return Xt(e)||Array.isArray(e)&&e.some(Xt)?null:JSON.stringify(e)}function W(e,t,{onSuccess:o}={}){let r=ur(e),[n,a]=(0,H.useState)(0),[i,u]=(0,H.useState)(),c=r===null?null:`${n}\0${r}`,l=i?.attempt===c,p=i?.question===r,d=(0,H.useRef)({fetcher:t,onSuccess:o});return(0,H.useEffect)(()=>{d.current={fetcher:t,onSuccess:o}}),(0,H.useEffect)(()=>{if(c===null||r===null)return;let m=new AbortController;return d.current.fetcher(m.signal).then(b=>{m.signal.aborted||(u({attempt:c,question:r,data:b}),d.current.onSuccess?.(b))}).catch(b=>{m.signal.aborted||u({attempt:c,question:r,error:b})}),()=>{m.abort()}},[c,r]),{data:p?i.data:void 0,error:l?i.error:void 0,isLoading:c!==null&&!l,mutate:(0,H.useCallback)(()=>{a(m=>m+1)},[])}}function He(e,t){let[o,r]=(0,H.useState)(e);return(0,H.useEffect)(()=>{let n=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(n)}},[e,t]),o}function to({view:e,feature:t}){let o=e?.assemblyNames?.[0],{data:r,error:n,isLoading:a}=W(t&&o?[t.id(),o,"feature-sequence"]:null,async()=>{let{start:u,end:c,refName:l}=t.toJSON();return Mt({start:u,end:c,refName:l,assemblyName:o,session:(0,Rt.getSession)(e)})});return{proteinSequence:(0,Zt.useMemo)(()=>r&&t?(0,eo.translateTranscript)({transcript:t,...r})?.protein??"":"",[r,t]),sequence:r,error:n,isLoading:a}}function cr(e,t,o){if(!o?.length)return e;let r=i=>o.some(u=>se(i,u)),n=t.find(i=>pe(i)===e);if(n&&r(n))return e;let a=t.find(r);return a?pe(a):e}function dr({error:e,isLoading:t,proteinSequence:o}){return e?"error":t?"loading":o?"ready":"missing"}function re({feature:e,view:t,validIds:o,preferredTranscriptId:r}){let n=(0,We.useMemo)(()=>Be(e),[e]),[a,i]=(0,We.useState)(()=>pe(n.find(m=>se(m,r??""))??n[0])),u=cr(a,n,o),c=n.find(m=>pe(m)===u),{proteinSequence:l,error:p,isLoading:d}=to({view:t,feature:c});return{options:n,selectedId:u,setSelectedId:i,selectedTranscript:c,proteinSequence:l,error:p,isLoading:d,sequenceStatus:dr({error:p,isLoading:d,proteinSequence:l}),validIds:o}}var q=s(f()),ao=s(we());var oo=s(gt(),1),ro=(0,Ie.createSvgIcon)((0,oo.jsx)("path",{d:"M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"}),"Delete");var E=s(L()),so=s(ve()),io=s(V());var pr=(0,io.makeStyles)()({header:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:8},resultList:{maxHeight:300,overflow:"auto"}});function no(e){let t=[e.geneName,e.transcriptName!==e.geneName?e.transcriptName:void 0].filter(o=>!!o);return t.length>0?t.join(" - "):e.geneId??e.transcriptId??"Unknown"}function fr(e){return[e.blastDatabase,e.searchProgram??e.blastProgram??"blastp",e.msaAlgorithm].filter(Boolean).join(" / ")}var hr=(0,so.observer)(function({model:e,handleClose:t,feature:o,cached:{results:r,handleDelete:n,handleClearAll:a}}){let{classes:i}=pr(),u=G(e),[c,l]=(0,q.useState)(),[p]=Ge(),d=m=>{let{transcriptId:b,msa:S,tree:v,treeMetadata:j}=m;Q({view:u,feature:b?Be(o).find(M=>se(M,b)):void 0,placement:p?"splitRight":"stack",displayName:`BLAST - ${no(m)}`,...Te,data:{msa:S,tree:v,treeMetadata:j}}).then(t,M=>{console.error(M),l(M)})};return q.default.createElement("div",null,c?q.default.createElement(ao.ErrorMessage,{error:c}):null,q.default.createElement("div",{className:i.header},q.default.createElement(E.Typography,{variant:"subtitle1"},"Cached BLAST Results (",r.length,")"),q.default.createElement(E.Button,{size:"small",color:"error",onClick:async()=>{try{l(void 0),await a()}catch(m){l(m)}}},"Clear results for this gene")),q.default.createElement(E.List,{dense:!0,className:i.resultList},r.map(m=>q.default.createElement(E.ListItem,{key:m.id,disablePadding:!0,secondaryAction:q.default.createElement(E.IconButton,{edge:"end",size:"small",onClick:async b=>{b.stopPropagation();try{l(void 0),await n(m.id)}catch(S){l(S)}}},q.default.createElement(ro,{fontSize:"small"}))},q.default.createElement(E.ListItemButton,{onClick:()=>{d(m)}},q.default.createElement(E.ListItemText,{primary:`${no(m)} - ${fr(m)}`,secondary:`${new Date(m.timestamp).toLocaleString()} - Seq: ${m.proteinSequence.slice(0,30)}...`}))))))}),lo=hr;var it=s(f()),mo=s(L());function Fe({value:e,onChange:t,className:o}){return it.default.createElement(g,{variant:"outlined",label:"MSA Algorithm",className:o,select:!0,value:e,helperText:e==="browser"?"no EBI job; rows aligned to the query":void 0,onChange:r=>{t(r.target.value)}},De.map(r=>it.default.createElement(mo.MenuItem,{value:r,key:r},At[r])))}var gr="msaView-blastSearch",Sr="msaView-msaAlgorithm",uo=je("blastp"),co="clustalo";function yr(e){let{program:t,database:o}=e??{},r=Oe.find(n=>n===t);return r&&$e(r).some(n=>n===o)?{program:r,database:o}:uo}function br(e){return De.find(t=>t===e)??co}function po(){let[e,t]=de(gr,uo);return[yr(e),o=>{t(o)}]}function Ue(){let[e,t]=de(Sr,co);return[br(e),o=>{t(o)}]}function fo(e){let{data:t,error:o,isLoading:r,mutate:n}=W(`cached-blast-${e.join(",")}`,async()=>(await kt()).filter(i=>i.geneId&&e.includes(i.geneId)));return{results:t??[],error:o,isLoading:r,handleDelete:async a=>{await ot(a),n()},handleClearAll:async()=>{await Promise.all((t??[]).map(a=>ot(a.id))),n()}}}var vr=(0,go.makeStyles)()({selectField:{width:150},databaseField:{width:260},cachedResultsAccordion:{marginTop:20},infoText:{marginTop:20}}),wr=(0,ho.observer)(function({handleClose:e,feature:t,model:o,children:r,preferredTranscriptId:n}){let{classes:a}=vr(),i=G(o),{launchError:u,submit:c}=oe(e),[l,p]=po(),[d,m]=Ue(),[b,S]=(0,w.useState)(String(Lt)),v=Number(b),j=Number.isInteger(v)&&v>=1,M=l.program==="phmmer",P=(0,w.useMemo)(()=>Ee(t),[t]),C=fo(P),I=re({feature:t,view:i,preferredTranscriptId:n}),{selectedTranscript:k,proteinSequence:F,sequenceStatus:$}=I,_=I.error??u??C.error;return w.default.createElement(w.default.Fragment,null,w.default.createElement(Y,{error:_},r,w.default.createElement(g,{variant:"outlined",label:"Search program",className:a.selectField,select:!0,value:l.program,onChange:x=>{p(je(x.target.value))}},Oe.map(x=>w.default.createElement(U.MenuItem,{value:x,key:x},Ct[x]))),w.default.createElement(g,{variant:"outlined",label:"Database",className:a.databaseField,select:!0,value:l.database,onChange:x=>{p({program:l.program,database:x.target.value})}},$e(l.program).map(x=>w.default.createElement(U.MenuItem,{value:x,key:x},Nt(x)))),M?null:w.default.createElement(Fe,{className:a.selectField,value:d,onChange:m}),w.default.createElement(g,{variant:"outlined",label:"Hits",className:a.selectField,type:"number",value:b,onChange:x=>{S(x.target.value)},error:!j,helperText:"best-scoring sequences to keep"}),w.default.createElement(R,{feature:t,...I}),w.default.createElement(U.Typography,{variant:"body2",className:a.infoText},M?"phmmer aligns the hits as it finds them, so nothing is realigned afterwards.":"The hits come back from EBI and are then run through the chosen aligner."," ","The EBI queue is the wait, and it runs from seconds to many minutes."),C.results.length>0?w.default.createElement(U.Accordion,{className:a.cachedResultsAccordion},w.default.createElement(U.AccordionSummary,{expandIcon:w.default.createElement(yt,null)},w.default.createElement(U.Typography,null,"Previous BLAST Results")),w.default.createElement(U.AccordionDetails,null,w.default.createElement(lo,{model:o,handleClose:e,feature:t,cached:C}))):null),w.default.createElement(X,{model:o,hint:w.default.createElement(ie,{status:$}),submitDisabled:!F||!j,onSubmit:x=>{if(k){let ue=l.program==="phmmer"?{searchProgram:"phmmer",blastDatabase:l.database,maxHits:v,selectedTranscript:k.toJSON(),proteinSequence:F}:{searchProgram:"blastp",blastDatabase:l.database,msaAlgorithm:d,maxHits:v,selectedTranscript:k.toJSON(),proteinSequence:F};c(()=>Q({view:i,feature:k,placement:x,displayName:vt(t,k),...Te,blastParams:ue}))}},onCancel:e}))}),So=wr;var y=s(f()),xo=s(be()),ge=s(L()),To=s(ve()),Mo=s(V());var ze=s(f());function yo(e){return qe(e).toUpperCase()}function xr(e,t){let o=Math.min(e.length,t.length);if(o===0)return 0;let r=0;for(let n=0;n<o;n++)e[n]===t[n]&&r++;return r/o}var Tr=.9,Mr=.5;function bo(e,t){if(!e.trim())return{names:[]};let o;try{o=Pt(e)}catch{return{names:[]}}let r=o.getNames(),n=yo(t);return{names:r,match:n?Ar(o,r,n):void 0}}function Ar(e,t,o){let r=[];for(let a of t){let i=yo(It(e.getRow(a)));if(!i)continue;if(i===o)return{name:a,quality:"exact",identity:1,offset:0};let u=o.indexOf(i),c=i.indexOf(o);if(u!==-1||c!==-1){let p=Math.min(i.length,o.length)/Math.max(i.length,o.length);p>=Mr&&r.push({name:a,quality:"partial",identity:p,offset:u===-1?-c:u});continue}let l=xr(i,o);l>=Tr&&r.push({name:a,quality:"similar",identity:l,offset:0})}let n=["partial","similar"];return r.sort((a,i)=>n.indexOf(a.quality)-n.indexOf(i.quality)||i.identity-a.identity)[0]}function vo(e,t){return e.querySeqName||(e.names.includes(t)?t:"")}function Me(e,t){let[o,r]=(0,ze.useState)(),{names:n,match:a}=(0,ze.useMemo)(()=>bo(e,t),[e,t]),i=o!==void 0&&(n.length===0||n.includes(o))?o:void 0,u=i??a?.name??"";return{detected:a,names:n,querySeqName:u,querySeqOffset:u===a?.name?a.offset:0,setQuerySeqName:r,isAutoDetected:i===void 0&&!!a}}var ee=s(f()),Ae=s(L()),wo=s(V());var Cr=(0,wo.makeStyles)()({field:{marginTop:20},alert:{marginTop:10}});function Lr({identity:e,offset:t}){let o=`, covering ${Math.round(e*100)}% of it`;return t>0?`${o} from residue ${t+1}`:t<0?`${o} and running ${-t} residues past its start`:o}function he({names:e,detected:t,querySeqName:o,setQuerySeqName:r,isAutoDetected:n}){let{classes:a}=Cr();return ee.default.createElement(ee.default.Fragment,null,e.length>0?ee.default.createElement(g,{variant:"outlined",label:"MSA row matching the selected transcript",select:!0,fullWidth:!0,className:a.field,value:e.includes(o)?o:"",onChange:i=>{r(i.target.value)}},e.map(i=>ee.default.createElement(Ae.MenuItem,{value:i,key:i},i,t?.name===i?" \u2014 matches your protein":""))):ee.default.createElement(g,{variant:"outlined",label:"MSA row matching the selected transcript",fullWidth:!0,className:a.field,helperText:"Paste an alignment above and this fills in on its own",value:o,onChange:i=>{r(i.target.value)}}),n&&t?t.quality==="similar"?ee.default.createElement(Ae.Alert,{severity:"warning",className:a.alert},ee.default.createElement("strong",null,t.name)," is"," ",Math.round(t.identity*100),"% identical to your protein but is not the same sequence. Clicking the alignment navigates the genome view, approximately: wherever the two differ by an insertion or a deletion, every residue after it lands one codon off."):ee.default.createElement(Ae.Alert,{severity:"success",className:a.alert},"Matched ",ee.default.createElement("strong",null,t.name)," to your protein sequence",t.quality==="exact"?"":Lr(t),". Clicking the alignment will navigate the genome view."):e.length>0&&!o?ee.default.createElement(Ae.Alert,{severity:"warning",className:a.alert},"No row matched your protein sequence \u2014 pick the one for your gene above. Without it the alignment still renders, but clicking it will not navigate the genome view."):null)}var Nr=(0,Mo.makeStyles)()({ncbiLink:{wordBreak:"break-all"},textAreaFont:{fontFamily:"Courier New"},msaInput:{marginBottom:20},step:{marginTop:20},stepBody:{marginLeft:20,marginTop:8}}),kr=(0,To.observer)(function({handleClose:e,feature:t,model:o,children:r,preferredTranscriptId:n}){let{classes:a}=Nr(),i=G(o),{launchError:u,submit:c}=oe(e),[l,p]=(0,y.useState)(""),[d,m]=(0,y.useState)(""),b=re({feature:t,view:i,preferredTranscriptId:n}),{proteinSequence:S,selectedTranscript:v,error:j}=b,M=Me(l,S),P=qe(S),C=`${tt}?PAGE_TYPE=BlastSearch&PAGE=Proteins&PROGRAM=blastp&QUERY=${P}`,I=`${tt}?PAGE_TYPE=BlastSearch&PAGE=Proteins&PROGRAM=blastp&QUERY=${(0,xo.shorten2)(P,10)}`;return y.default.createElement(y.default.Fragment,null,y.default.createElement(Y,{error:u??j},r,y.default.createElement(R,{feature:t,...b}),y.default.createElement("div",{className:a.step},y.default.createElement(ge.Typography,{variant:"subtitle2"},"1. Run the search at NCBI"),y.default.createElement("div",{className:a.stepBody},S?y.default.createElement("div",{className:a.ncbiLink},y.default.createElement(Ft,{href:C},I)):y.default.createElement(ge.Alert,{severity:"info"},"Pick a transcript above to get a link carrying its protein sequence."))),y.default.createElement("div",{className:a.step},y.default.createElement(ge.Typography,{variant:"subtitle2"},"2. Align the hits"),y.default.createElement("div",{className:a.stepBody},y.default.createElement(ge.Typography,null,`On the results page click "Multiple Alignment" to run COBALT, NCBI's aligner. Download the alignment (.aln) and, if you want the tree drawn, the Newick tree (.nh).`))),y.default.createElement("div",{className:a.step},y.default.createElement(ge.Typography,{variant:"subtitle2"},"3. Paste the results back here"),y.default.createElement("div",{className:a.stepBody},y.default.createElement(g,{variant:"outlined",label:"Alignment",multiline:!0,minRows:5,maxRows:10,fullWidth:!0,className:a.msaInput,slotProps:{input:{className:a.textAreaFont}},placeholder:"Paste the .aln contents here",value:l,onChange:k=>{p(k.target.value)}}),y.default.createElement(g,{variant:"outlined",label:"Tree (optional)",multiline:!0,minRows:3,maxRows:10,fullWidth:!0,slotProps:{input:{className:a.textAreaFont}},placeholder:"Paste the .nh Newick tree here",value:d,onChange:k=>{m(k.target.value)}}),y.default.createElement(he,{...M})))),y.default.createElement(X,{model:o,submitDisabled:!v||!l.trim(),onSubmit:k=>{v&&c(()=>Q({view:i,feature:v,placement:k,displayName:te(v),querySeqName:M.querySeqName,querySeqOffset:M.querySeqOffset,data:{msa:l,tree:d}}))},onCancel:e}))}),Ao=kr;var Se=s(f()),ne=s(L());function lt({lookupMethod:e,setLookupMethod:t}){return Se.default.createElement(ne.FormControl,{component:"fieldset"},Se.default.createElement(ne.RadioGroup,{row:!0,value:e,onChange:o=>{t(o.target.value)}},Se.default.createElement(ne.FormControlLabel,{value:"automatic",control:Se.default.createElement(ne.Radio,null),label:"Automatic"}),Se.default.createElement(ne.FormControlLabel,{value:"manual",control:Se.default.createElement(ne.Radio,null),label:"Manual"})))}var z=s(f()),D=s(L()),Co=s(V());var Fr=(0,Co.makeStyles)()({field:{minWidth:300},help:{marginBottom:8}});function mt({handleClose:e,ebiEmail:t}){let{classes:o}=Fr(),[r,n]=(0,z.useState)(t);return z.default.createElement(D.Dialog,{open:!0,maxWidth:"lg",onClose:()=>{e()}},z.default.createElement(D.DialogTitle,null,"EBI settings"),z.default.createElement(D.DialogContent,null,z.default.createElement(D.Typography,{variant:"subtitle2",className:o.help},"Every search this tab runs is submitted to EBI with this address, which is how they reach whoever is generating the load. If your site sends real volume, use your own."),z.default.createElement(g,{autoFocus:!0,margin:"dense",label:"EBI contact email",fullWidth:!0,variant:"outlined",value:r,className:o.field,onChange:a=>{n(a.target.value)}}),z.default.createElement(D.Button,{variant:"contained",onClick:()=>{n(Ne)}},"Reset")),z.default.createElement(D.DialogActions,null,z.default.createElement(D.Button,{variant:"contained",color:"secondary",onClick:()=>{e()}},"Cancel"),z.default.createElement(D.Button,{color:"primary",variant:"contained",onClick:()=>{e({ebiEmail:r})}},"Save")))}var Pr=(0,Lo.makeStyles)()({settingsButton:{float:"right"}}),Ir={automatic:So,manual:Ao};function ut({handleClose:e,model:t,feature:o,preferredTranscriptId:r}){let[n,a]=(0,K.useState)("automatic"),[i,u]=de(St,Ne),[c,l]=(0,K.useState)(!1),{classes:p}=Pr(),d=Ir[n];return K.default.createElement(K.default.Fragment,null,K.default.createElement(Ke.Tooltip,{title:`EBI settings \u2014 jobs are submitted with ${i.trim()||Ne}`},K.default.createElement(Ke.IconButton,{className:p.settingsButton,"aria-label":"EBI settings",size:"small",onClick:()=>{l(!0)}},K.default.createElement(Ot,null))),K.default.createElement(d,{model:t,feature:o,handleClose:e,preferredTranscriptId:r},K.default.createElement(lt,{lookupMethod:n,setLookupMethod:a})),c?K.default.createElement(mt,{ebiEmail:i,handleClose:m=>{m&&u(m.ebiEmail),l(!1)}}):null)}var O=s(f());var Je=s(L()),Br=(0,O.lazy)(()=>import("./HelpDialog-DF4Y536X.js"));function ct(){let[e,t]=(0,O.useState)(!1);return O.default.createElement(O.default.Fragment,null,O.default.createElement(Je.Tooltip,{title:"What each tab does"},O.default.createElement(Je.IconButton,{"aria-label":"Help",onClick:()=>{t(!0)}},O.default.createElement(Bt,null))),e?O.default.createElement(O.Suspense,{fallback:null},O.default.createElement(Br,{handleClose:()=>{t(!1)}})):null)}var h=s(f()),dt=s(we()),No=s(nr()),ae=s(L()),ko=s(ve()),Fo=s(V());function qr(e){let t=He(e,500),{data:o,error:r,isLoading:n}=W(t?[JSON.stringify(t),"msa-file-text"]:null,()=>(0,No.openLocation)(t).readFile("utf8"));return{text:o??"",error:r,isLoading:n||t!==e}}var Er=(0,Fo.makeStyles)()({inputContainer:{marginBottom:30},fileContainer:{maxWidth:500},msaInput:{marginBottom:20}}),Dr=(0,ko.observer)(function({model:t,feature:o,handleClose:r,preferredTranscriptId:n}){let a=G(t),{classes:i}=Er(),{launchError:u,submit:c}=oe(r),[l,p]=(0,h.useState)("file"),[d,m]=(0,h.useState)(""),[b,S]=(0,h.useState)(""),[v,j]=(0,h.useState)(),[M,P]=(0,h.useState)(),C=re({feature:o,view:a,preferredTranscriptId:n}),{selectedTranscript:I,proteinSequence:k,error:F,sequenceStatus:$}=C,_=qr(l==="file"?v:void 0),x=Me(l==="file"?_.text:d,k),ue=u??F??_.error;return h.default.createElement(h.default.Fragment,null,h.default.createElement(Y,{error:ue},h.default.createElement(ae.FormControl,{component:"fieldset"},h.default.createElement(ae.RadioGroup,{row:!0,value:l,onChange:J=>{p(J.target.value)}},h.default.createElement(ae.FormControlLabel,{value:"file",control:h.default.createElement(ae.Radio,null),label:"Open files"}),h.default.createElement(ae.FormControlLabel,{value:"text",control:h.default.createElement(ae.Radio,null),label:"Paste text"}))),h.default.createElement("div",{className:i.inputContainer},l==="file"?h.default.createElement("div",{className:i.fileContainer},h.default.createElement(dt.FileSelector,{name:"MSA File .aln (Clustal), .fa/.mfa (aligned FASTA), .stock (Stockholm), etc)",inline:!0,location:v,setLocation:j}),h.default.createElement(dt.FileSelector,{name:"Tree file .nh (Newick) or .asn (NCBI COBALT ASN.1)",inline:!0,location:M,setLocation:P})):h.default.createElement(h.default.Fragment,null,h.default.createElement(g,{variant:"outlined",name:"MSA",multiline:!0,minRows:5,className:i.msaInput,maxRows:10,fullWidth:!0,placeholder:"Paste MSA here",value:d,onChange:J=>{m(J.target.value)}}),h.default.createElement(g,{variant:"outlined",name:"Tree",multiline:!0,minRows:5,maxRows:10,fullWidth:!0,placeholder:"Paste newick tree (optional)",value:b,onChange:J=>{S(J.target.value)}}))),h.default.createElement(R,{feature:o,...C}),h.default.createElement(he,{...x})),h.default.createElement(X,{model:t,hint:h.default.createElement(ie,{status:$}),submitDisabled:!I||l==="file"&&(!v||_.isLoading)||l==="text"&&!d.trim(),onSubmit:J=>{I&&c(()=>Q({view:a,feature:I,placement:J,displayName:te(I),querySeqName:x.querySeqName,querySeqOffset:x.querySeqOffset,...l==="file"?{msaFilehandle:v,treeFilehandle:M}:{data:{msa:d,tree:b}}}))},onCancel:r}))}),Po=Dr;var N=s(f()),jo=s(L()),$o=s(ve()),_o=s(V());var pt=s(f()),Io=s(L());var Or="msaview-ortholog-source",Bo={ncbi:"NCBI orthologs",panther:"PANTHER",uniref:"UniRef cluster"},qo=Object.keys(Bo);function jr(e){return qo.find(t=>t===e)??"ncbi"}function Eo(){let[e,t]=de(Or,"ncbi");return[jr(e),o=>{t(o)}]}var $r={ncbi:"vertebrates and insects",panther:"also yeast, worm, fly and plants",uniref:"all of UniProtKB within 50% identity"};function ft({value:e,onChange:t,className:o}){return pt.default.createElement(g,{variant:"outlined",label:"Source",className:o,select:!0,value:e,helperText:$r[e],onChange:r=>{t(r.target.value)}},qo.map(r=>pt.default.createElement(Io.MenuItem,{value:r,key:r},Bo[r])))}var Ye=s(f());async function Do(e,t){let o=e.trim();if(!o)return;if(/^\d+$/.test(o))return Number(o);let n=(await Ve(_e("esearch",{db:"taxonomy",term:o,retmax:"1",retmode:"json"}),{signal:t})).esearchresult?.idlist?.[0];return n?Number(n):void 0}async function Oo(e,t){let o=e.trim();if(!o)return;let n=(await Ve(_e("esearch",{db:"assembly",term:o,retmax:"1",retmode:"json"}),{signal:t})).esearchresult?.idlist?.[0];if(!n)return;let i=(await Ve(_e("esummary",{db:"assembly",id:n,retmode:"json"}),{signal:t})).result?.[n],u=Number(i?.speciestaxid);return i?.speciesname&&u?{taxId:u,speciesName:i.speciesname}:void 0}async function _r(e,t){let o=await Do(e,t);if(!o)throw new Error(`No NCBI taxon matches "${e}"`);let r=[],n=(await Et([o],t,i=>{r.push(i)})).get(o);if(!n&&r.length>0)throw new Error(`NCBI did not answer for the name of taxon ${o}`,{cause:r[0]});let a=[n?.sciname,n?.commonName&&`(${n.commonName})`].filter(Boolean).join(" ");return{taxId:o,label:a||`taxon ${o}`}}function ht({value:e,assemblyName:t,onChange:o,className:r}){let[n,a]=(0,Ye.useState)(),i=He(n,400),{data:u}=W(t&&n===void 0?[t,"assembly-species"]:null,m=>Oo(t,m),{onSuccess:m=>{m&&o(m.taxId)}}),{data:c,error:l}=W(i?.trim()?[i.trim(),"taxon"]:null,m=>_r(i,m),{onSuccess:({taxId:m})=>{o(m)}}),p=n??u?.speciesName??"human",d=n===void 0?u?.speciesName:c?.label;return Ye.default.createElement(g,{variant:"outlined",label:"Query species",className:r,value:p,onChange:m=>{a(m.target.value)},error:!!l,helperText:l?`${l}`:d??`the species this gene is from (taxon ${e})`})}var Vr=(0,_o.makeStyles)()({selectField:{width:180}}),Gr={ncbi:e=>`the ${e} closest species NCBI has`,panther:e=>`the ${e} closest species PANTHER has`,uniref:e=>`${e} rows, one per species, reviewed entries first`},Qr=(0,$o.observer)(function({handleClose:e,feature:t,model:o,preferredTranscriptId:r}){let{classes:n}=Vr(),a=G(o),{launchError:i,submit:u}=oe(e),[c,l]=(0,N.useState)(9606),[p,d]=Eo(),[m,b]=Ue(),[S,v]=(0,N.useState)(String(qt)),j=(0,N.useMemo)(()=>Ee(t),[t]),M=re({feature:t,view:a,preferredTranscriptId:r}),{selectedTranscript:P,proteinSequence:C,sequenceStatus:I}=M,k=M.error??i,F=Number(S),$=Number.isInteger(F)&&F>=2;return N.default.createElement(N.default.Fragment,null,N.default.createElement(Y,{error:k},N.default.createElement(jo.Typography,{variant:"body2"},"Precomputed orthologs, one gene per species, looked up rather than searched for. No BLAST job to queue, and with the in-browser aligner no job at all."),N.default.createElement("div",null,N.default.createElement(ft,{className:n.selectField,value:p,onChange:d}),N.default.createElement(ht,{className:n.selectField,value:c,assemblyName:a.assemblyNames[0],onChange:l}),N.default.createElement(Fe,{className:n.selectField,value:m,onChange:b}),N.default.createElement(g,{variant:"outlined",label:"Rows to align",className:n.selectField,type:"number",value:S,onChange:_=>{v(_.target.value)},error:!$,helperText:$?Gr[p](F):"a whole number, 2 or more"})),N.default.createElement(R,{feature:t,...M})),N.default.createElement(X,{model:o,hint:N.default.createElement(ie,{status:I}),submitDisabled:!C||!$,onSubmit:_=>{P&&u(()=>Q({view:a,feature:P,placement:_,displayName:`Orthologs - ${te(t)} - ${fe(P)}`,...Te,orthologParams:{taxId:c,source:p,maxSpecies:F,geneCandidates:j,msaAlgorithm:m,selectedTranscript:P.toJSON(),proteinSequence:C}}))},onCancel:e}))}),Vo=Qr;var T=s(f()),Ce=s(we()),Ze=s(be()),Re=s(L()),Jo=s(ve()),Yo=s(V());var Ho=s(Qo());async function Wo(e,t){return(await(0,Ho.getAdapter)(e,"msa",t)).dataAdapter}async function Uo({config:e,pluginManager:t}){return(await Wo(t,e)).getMSAList()}async function zo({config:e,pluginManager:t,msaId:o}){return(await Wo(t,e)).getMSA(o)}var Ko=s(or());function Xe(e){return(0,Ko.readConfObject)(e,["msa","datasets"])}var Hr=(0,Yo.makeStyles)()({selectedContainer:{marginTop:50}}),Wr=(0,Jo.observer)(function({model:e,feature:t,handleClose:o,preferredTranscriptId:r}){let n=(0,Ze.getSession)(e),a=G(e),{classes:i}=Hr(),{pluginManager:u}=(0,Ze.getEnv)(e),{assemblyNames:c}=a,{launchError:l,submit:p}=oe(o),d=Xe(n.jbrowse),[m,b]=(0,T.useState)(d?.[0]?.datasetId),S=d?.find(B=>B.datasetId===m),{data:v,isLoading:j,error:M}=W(S?`${S.datasetId}-msa-list`:null,()=>Uo({config:S.adapter,pluginManager:u})),P=re({feature:t,view:a,validIds:v,preferredTranscriptId:r}),{selectedTranscript:C,proteinSequence:I,sequenceStatus:k}=P,F=C?v?.find(B=>se(C,B)):void 0,{data:$,isLoading:_,error:x}=W(F&&S?`${S.datasetId}-${F}-msa`:null,()=>zo({msaId:F,config:S.adapter,pluginManager:u})),ue=(0,T.useMemo)(()=>$?.map(B=>`>${B.get("refName")}
|
|
3
|
+
${B.get("seq")}`).join(`
|
|
4
|
+
`)??"",[$]),J=Me(ue,I),Pe=vo(J,`${F??""}_${c[0]??""}`),er=M??x??P.error??l;return T.default.createElement(T.default.Fragment,null,T.default.createElement(Y,{error:er},T.default.createElement(g,{select:!0,label:"Select MSA dataset",value:m,onChange:B=>{b(B.target.value)}},d?.map(B=>T.default.createElement(Re.MenuItem,{key:B.datasetId,value:B.datasetId},B.name))),S?T.default.createElement("div",{className:i.selectedContainer},!j&&_?T.default.createElement(Ce.LoadingEllipses,{variant:"h6",message:`Loading MSA for ${fe(C)||F}`}):null,j?T.default.createElement(Ce.LoadingEllipses,{variant:"h6",message:`Loading available MSAs for (${S.name})`}):null,v?T.default.createElement("div",null,T.default.createElement(Ce.SanitizedHTML,{html:S.description}),T.default.createElement(R,{feature:t,...P}),ue?T.default.createElement(he,{...J,querySeqName:Pe}):null):null):null),T.default.createElement(X,{model:e,hint:_?T.default.createElement(Ce.LoadingEllipses,{message:"Loading alignment"}):$?.length&&!Pe?T.default.createElement(Re.Typography,{color:"textSecondary",variant:"body2"},"no row matches this transcript"):T.default.createElement(ie,{status:k}),submitDisabled:!C||!$?.length||!Pe,onSubmit:B=>{C&&ue&&p(()=>Q({view:a,feature:C,placement:B,displayName:te(C),drawNodeBubbles:!1,labelsAlignRight:!0,showBranchLen:!1,colWidth:10,rowHeight:12,colorSchemeName:"percent_identity_dynamic",querySeqName:Pe,querySeqOffset:J.querySeqOffset,data:{msa:ue}}))},onCancel:o}))}),Xo=Wr;var et=s(f());function Le({children:e,value:t,index:o}){let r=t===o,[n,a]=(0,et.useState)(r);return r&&!n&&a(!0),et.default.createElement("div",{role:"tabpanel",hidden:!r},n||r?e:null)}function Ur({handleClose:e,feature:t,model:o,preferredTranscriptId:r}){let n=(0,Ro.getSession)(o),i=!!Xe(n.jbrowse)?.length,[u,c]=(0,A.useState)("orthologs");return A.default.createElement(Zo.Dialog,{maxWidth:"xl",title:"Launch MSA view",open:!0,onClose:e},A.default.createElement(Wt,null,A.default.createElement("div",{style:{display:"flex",alignItems:"center"}},A.default.createElement(ye.Tabs,{value:u,onChange:(l,p)=>{c(p)}},A.default.createElement(ye.Tab,{label:"Orthologs",value:"orthologs"}),A.default.createElement(ye.Tab,{label:"BLAST query",value:"ncbi_blast"}),i?A.default.createElement(ye.Tab,{label:"Pre-loaded MSA datasets",value:"preloaded_msa"}):null,A.default.createElement(ye.Tab,{label:"Manual upload",value:"manual_msa"})),A.default.createElement(ct,null)),A.default.createElement(Le,{value:u,index:"orthologs"},A.default.createElement(Vo,{handleClose:e,feature:t,model:o,preferredTranscriptId:r})),A.default.createElement(Le,{value:u,index:"ncbi_blast"},A.default.createElement(ut,{handleClose:e,feature:t,model:o,preferredTranscriptId:r})),i?A.default.createElement(Le,{value:u,index:"preloaded_msa"},A.default.createElement(Xo,{model:o,feature:t,handleClose:e,preferredTranscriptId:r})):null,A.default.createElement(Le,{value:u,index:"manual_msa"},A.default.createElement(Po,{model:o,feature:t,handleClose:e,preferredTranscriptId:r}))))}export{Ur as default};
|
|
5
|
+
//# sourceMappingURL=LaunchMsaViewDialog-GJAUPGFC.js.map
|