import "vue"; import { u as p, b as g, E as l, T as y, c as m, d as w } from "./index-DsKXfcyp.js"; import { mapStores as A } from "pinia"; let c = 7, s = 5; const v = [ { id: "UBERON:0000948", name: "heart", showAtZoom: 1 }, { id: "UBERON:0001759", name: "vagus nerve", showAtZoom: 1 }, { id: "UBERON:0001155", name: "colon", showAtZoom: 1 }, { id: "UBERON:0000945", name: "stomach", showAtZoom: 1 }, { id: "UBERON:0001013", name: "adipose tissue", showAtZoom: 1 }, { id: "UBERON:0001255", name: "urinary bladder", showAtZoom: 1 }, { id: "UBERON:0001348", name: "brown adipose tissue", showAtZoom: 6 }, { id: "UBERON:0002008", name: "cardiac nerve plexus", showAtZoom: 1 }, { id: "UBERON:0002240", name: "spinal cord", showAtZoom: 1 }, { id: "UBERON:0002005", name: "Enteric Nervous System", showAtZoom: 4 }, { id: "UBERON:0013702", name: "body proper", showAtZoom: 1 }, { id: "UBERON:0002298", name: "brainstem", showAtZoom: 1 }, { id: "UBERON:0002439", name: "myenteric nerve plexus", showAtZoom: 6 }, { id: "UBERON:0000010", name: "peripheral nervous system", showAtZoom: 6 }, { id: "UBERON:0002048", name: "lung", showAtZoom: 1 }, { id: "UBERON:0002410", name: "autonomic nervous system", showAtZoom: 6 }, { id: "UBERON:0002441", name: "cervicothoracic ganglion", showAtZoom: 6 }, { id: "UBERON:0005363", name: "inferior vagus X ganglion", showAtZoom: 6 }, { id: "UBERON:0001264", name: "pancreas", showAtZoom: 1 }, { id: "UBERON:0001884", name: "phrenic nerve", showAtZoom: 6 }, { id: "UBERON:0002059", name: "submandibular ganglion", showAtZoom: 7 }, { id: "UBERON:0001347", name: "white adipose tissue", showAtZoom: 6 }, { id: "UBERON:0001556", name: "lower urinary tract", showAtZoom: 1 }, { id: "UBERON:0002262", name: "celiac ganglion", showAtZoom: 5 }, { id: "UBERON:0000955", name: "Brain", showAtZoom: 1 }, { id: "UBERON:0000160", name: "intestine", showAtZoom: 1 }, { id: "UBERON:0001322", name: "sciatic nerve", showAtZoom: 1 }, { id: "UBERON:0001649", name: "glossopharyngeal nerve", showAtZoom: 6 }, { id: "UBERON:0002063", name: "sinus venosus", showAtZoom: 6 }, { id: "UBERON:0002107", name: "liver", showAtZoom: 1 }, { id: "UBERON:0002113", name: "kidney", showAtZoom: 1 }, { id: "UBERON:0002481", name: "bone tissue", showAtZoom: 1 }, { id: "UBERON:0004907", name: "lower digestive tract", showAtZoom: 4 }, { id: "UBERON:0000044", name: "Dorsal root ganglion", showAtZoom: 5 }, // New levels from Keeran { id: "UBERON:0001736", name: "Submandibular gland", showAtZoom: c, keyword: !0 }, { id: "UBERON:0001103", name: "Diaphragm", showAtZoom: s, keyword: !0 }, { id: "UBERON:0001160", name: "Fundus of stomach", showAtZoom: s, keyword: !0 }, { id: "UBERON:0000955", name: "Brain", showAtZoom: s, keyword: !0 }, { id: "UBERON:0003708", name: "Carotid sinus", showAtZoom: c, keyword: !0 }, { id: "UBERON:0002079", name: "Left cardiac atrium", showAtZoom: s, keyword: !0 }, { id: "ILX:0485722", name: "Nodose ganglion", showAtZoom: c, keyword: !0 }, { id: "UBERON:0002078", name: "Right cardiac atrium", showAtZoom: s, keyword: !0 }, { id: "UBERON:0002084", name: "Heart left ventricle", showAtZoom: s, keyword: !0 }, { id: "UBERON:0002080", name: "Heart right ventricle", showAtZoom: s, keyword: !0 }, { id: "UBERON:0001508", name: "Arch of Aorta", showAtZoom: s, keyword: !0 }, { id: "UBERON:0001738", name: "Thyroid cartilage", showAtZoom: s, keyword: !0 }, { id: "UBERON:0000388", name: "Epiglottis", showAtZoom: s, keyword: !0 } ]; function N(e) { return e[0].toUpperCase() + e.substring(1); } const O = { emits: ["flatmap-provenance-ready", "resource-selected", "species-changed"], props: { /** * Object containing information for * the required viewing. */ entry: Object, visible: { type: Boolean, default: !0 }, mouseHovered: { type: Boolean, default: !1 } }, computed: { ...A(p, g), idNamePair() { return this.splitFlowStore.idNamePair; }, syncMode() { return this.splitFlowStore.syncMode; }, useHelpModeDialog() { return this.settingsStore.useHelpModeDialog; }, connectivityInfoSidebar() { return this.settingsStore.connectivityInfoSidebar; }, annotationSidebar() { return this.settingsStore.annotationSidebar; } }, mounted: function() { l.on("startHelp", () => { this.startHelp(); }), this.multiflatmapRef = this.$refs.multiflatmap, this.flatmapRef = this.$refs.flatmap, this.scaffoldRef = this.$refs.scaffold; }, methods: { toggleSyncMode: function() { }, getState: function() { }, openMap: function(e) { e === "SYNC" ? (this.toggleSyncMode(), this.trackOpenMap("toggle_map_sync_mode")) : (l.emit("OpenNewMap", e), this.trackOpenMap(`open_new_${e}_map`)), this.onConnectivityInfoClose(); }, onMapmanagerLoaded: function(e) { this.settingsStore.updateMapManager(e); }, trackOpenMap: function(e) { y.sendEvent({ event: "interaction_event", event_name: "portal_maps_open_map", category: e, location: "open_new_map" }); }, updateWithViewUrl: function() { }, /** * Perform a local search on this contentvuer */ search: function() { return !1; }, /** * Get a list of search suggestions on this contentvuer */ searchSuggestions: function() { }, /** * Callback when the vuers emit a selected event. */ resourceSelected: function(e, t) { var o, r, f; if (this.resourceHasAction(t)) { l.emit("PopoverActionClick", t); return; } let i, n = !1; const a = { paneIndex: this.entry.id, type: e, resource: t, internalName: void 0, eventType: void 0 }; if (e == "MultiFlatmap" || e == "Flatmap") if (a.internalName = this.idNamePair[t.feature.models], t.eventType == "click") if (a.eventType = "selected", t.feature.type == "marker") { let d = this.idNamePair[t.feature.models], u = v.filter( (h) => h.id === t.feature.models ); this.settingsStore.isFeaturedMarkerIdentifier( t.feature.id ) ? i = { type: "Search", term: this.settingsStore.featuredMarkerDoi( t.feature.id ), featuredDataset: !0 } : u.filter((h) => h.keyword).length > 0 ? i = { type: "Search", term: "http://purl.obolibrary.org/obo/" + t.feature.models.replace(":", "_") } : i = { type: "Facet", facet: d, facetPropPath: "anatomy.organ.category.name", term: "Anatomical structure" }, n = !0, e == "MultiFlatmap" && this.$refs.multiflatmap.getCurrentFlatmap().mapImp.clearSearchResults(); } else t.feature.type == "feature" && this.syncMode && (n = !0); else t.eventType == "mouseenter" && (a.eventType = "highlighted", n = !0); else e == "Scaffold" && (t && t[0] && ((((o = t[0].data) == null ? void 0 : o.id) === void 0 || ((r = t[0].data) == null ? void 0 : r.id) === "") && (t[0].data.id = (f = t[0].data) == null ? void 0 : f.group), a.internalName = t[0].data.id, t[0].data.lastActionOnMarker === !0 && (i = { type: "Facet", facet: N(t[0].data.id), facetPropPath: "anatomy.organ.category.name", term: "Anatomical structure" })), a.eventType = "selected", n = !0); i && l.emit("PopoverActionClick", i), n && this.$emit("resource-selected", a); }, resourceHasAction: function(e) { return e.type === "URL" || e.type === "Search" || e.type === "Neuron Search" || e.type == "Facet" || e.type == "Facets"; }, /** * Check if this viewer is currently visible */ isVisible: function() { return this.splitFlowStore.getPaneNameById(this.entry.id) !== void 0; }, displayTooltip: function() { }, /** * Get the term to zoom/highlight in a synchronisation event, * if it cannot be found in the map, it will perform several * calls to try to ge a valid name/id. */ getNameAndIdFromSyncData: async function(e) { let t = e.internalName; t === void 0 && e.resource && (t = e.resource.label); let i; if (e.resource && e.resource.resource && (i = e.resource.resource[0]), this.entry.type === "Scaffold") { if (this.$refs.scaffold.findObjectsWithGroupName(t).length === 0) { if (e.resource && e.resource.feature) { const o = m(e.resource.feature.models); if (o.length > 0) return o; } let a = w(t); if (a) return a; if (i && e.eventType === "selected") return fetch(`${this.apiLocation}get-related-terms/${i}`).then((o) => o.json()).then((o) => { if (o.uberon.array.length > 0) return t = o.uberon.array[0].name.charAt(0).toUpperCase() + o.uberon.array[0].name.slice(1), i = o.uberon.array[0].id.toUpperCase(), { id: i, name: t }; }); } } else if (this.entry.type === "MultiFlatmap") if (t === "Bladder") t = "Urinary Bladder"; else { const n = m(t); n.length > 0 && (t = n[0]); } return { id: i, name: t }; }, // Get the species and andaotmy info for the featured datasets getDatasetAnatomyInfo: function(e) { fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${e}`).then((t) => t.json()).then((t) => { const i = t.result[0]; let n; try { n = i.anatomy.organ[0].curie; } catch { n = void 0; } let a; try { a = i.item.curie; } catch { a = void 0; } let o; try { let r = 0, f = !1; for (; !f && r < i.organisms.subject.length; ) { const d = i.organisms.subject[r]; d.species && (o = d.species.name, f = !0), r += 1; } } catch { o = void 0; } this.settingsStore.updateFeaturedMarker({ identifier: e, marker: n, doi: a, species: o }); }); }, // Check if the old featured dataset api has any info oldFeaturedDatasetApiHasInfo: async function() { let t = await (await fetch(`${this.apiLocation}get_featured_datasets_identifiers`)).json(); return !t.identifiers || t.identifiers.length == 0 ? !1 : t.identifiers; }, // Check if the new featured dataset api has any info newFeaturedDatasetApiHasInfo: async function() { let t = await (await fetch(`${this.apiLocation}get_featured_dataset`)).json(); return !t.datasets || t.datasets.length == 0 ? !1 : t.datasets.map((i) => i.id); }, /** * Get a list of featured datasets to display. */ getFeaturedDatasets: async function() { let e = [], t = await this.oldFeaturedDatasetApiHasInfo(); if (t) e = t; else { let i = await this.newFeaturedDatasetApiHasInfo(); i && (e = i); } this.settingsStore.updateFeatured(e), e.forEach((i) => { this.getDatasetAnatomyInfo(i); }); }, zoomToFeatures: function() { }, handleSyncMouseEvent: async function(e) { let t = await this.getNameAndIdFromSyncData(e); e.eventType === "highlighted" ? this.highlightFeatures(t) : e.eventType === "selected" && this.displayTooltip(t); }, /** * Handle sync pan zoom event */ handleSyncPanZoomEvent: function() { }, highlightFeatures: function() { }, receiveSynchronisedEvent: async function(e) { if (e.paneIndex !== this.entry.id) e.eventType == "panZoom" || this.handleSyncMouseEvent(e); else if (e.eventType == "selected") { let t = await this.getNameAndIdFromSyncData(e); this.zoomToFeatures(t, !1); } }, requestSynchronisedEvent: function() { }, flatmapMarkerUpdate() { }, onResize: function() { }, startHelp: function() { this.isInHelp === !1 && (this.helpMode = !0, window.addEventListener("mousedown", this.checkEndHelpMouseDown), this.isInHelp = !0); }, endHelp: function() { window.removeEventListener("mousedown", this.checkEndHelpMouseDown), this.helpMode = !1, setTimeout(() => { this.isInHelp = !1; }, 200); }, onHelpModeShowNext: function() { this.helpModeActiveItem += 1; }, onHelpModeLastItem: function(e) { e && (this.helpModeLastItem = !0); }, onFinishHelpMode: function() { this.helpMode = !1, this.helpModeActiveItem = 0, this.helpModeLastItem = !1; }, onTooltipShown: function() { this.$refs.multiflatmap && this.$refs.multiflatmapHelp && this.$refs.multiflatmapHelp.toggleTooltipHighlight(), this.$refs.flatmap && this.$refs.flatmapHelp && this.$refs.flatmapHelp.toggleTooltipHighlight(), this.$refs.scaffold && this.$refs.scaffoldHelp && this.$refs.scaffoldHelp.toggleTooltipHighlight(); }, onMapTooltipShown: function() { this.$refs.multiflatmap && this.$refs.multiflatmapHelp && this.$refs.multiflatmapHelp.toggleTooltipPinHighlight(), this.$refs.flatmap && this.$refs.flatmapHelp && this.$refs.flatmapHelp.toggleTooltipPinHighlight(), this.$refs.scaffold && this.$refs.scaffoldHelp && this.$refs.scaffoldHelp.toggleTooltipPinHighlight(); }, /** * End help-mode only if user clicks outside of help mode dialog. */ checkEndHelpMouseDown: function(e) { e.target.closest(".help-mode-dialog") || this.endHelp(); }, mapHoverHighlight: function(e) { if (this.visible) { const t = this.settingsStore.hoverAnatomies, i = this.settingsStore.hoverOrgans; t.length || i.length ? (clearTimeout(this.hoverDelay), this.multiflatmapRef || this.flatmapRef ? e == null || e.zoomToFeatures(t, { noZoomIn: !0 }) : this.scaffoldRef && (e == null || e.changeHighlightedByName(i, "", !1))) : this.hoverDelay = setTimeout(() => { this.multiflatmapRef || this.flatmapRef ? e == null || e.clearSearchResults() : this.scaffoldRef && (e == null || e.changeHighlightedByName(i, "", !1)); }, 500); } }, onAnnotationOpen: function(e) { l.emit("annotation-open", e); }, onAnnotationClose: function() { l.emit("annotation-close"); }, onConnectivityInfoOpen: function(e) { l.emit("connectivity-info-open", e); }, onConnectivityInfoClose: function() { l.emit("connectivity-info-close"); }, onConnectivityGraphError: function(e) { l.emit("connectivity-graph-error", e); } }, data: function() { return { apiLocation: void 0, activeSpecies: "Human Male", scaffoldCamera: void 0, mainStyle: { height: this.entry.datasetTitle ? "calc(100% - 30px)" : "100%", width: "100%", bottom: "0px" }, helpMode: !1, helpModeActiveItem: 0, helpModeLastItem: !1, multiflatmapRef: null, flatmapRef: null, scaffoldRef: null, scaffoldLoaded: !1, isInHelp: !1, hoverDelay: void 0, mapManager: void 0 }; }, created: function() { this.flatmapAPI = void 0, this.apiLocation = void 0, this.settingsStore.flatmapAPI && (this.flatmapAPI = this.settingsStore.flatmapAPI), this.settingsStore.sparcApi && (this.apiLocation = this.settingsStore.sparcApi), this.settingsStore.mapManager && (this.mapManager = this.settingsStore.mapManager); }, watch: { helpMode: function(e) { e || (this.helpModeActiveItem = 0); } } }; export { O as C };