@abi-software/mapintegratedvuer 1.7.2 → 1.8.0-isan.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/ContentMixin-CthZZNjI.js +706 -0
  2. package/dist/{Flatmap-fO2lvKFX.js → Flatmap-Bi9esI2v.js} +24 -19
  3. package/dist/{Iframe-C8wxLuOy.js → Iframe-bsYxppii.js} +2 -2
  4. package/dist/{MultiFlatmap-Dijv5l_F.js → MultiFlatmap-BWFsdMgS.js} +49 -35
  5. package/dist/{Plot-iXTevaO7.js → Plot-gX8radCI.js} +2 -2
  6. package/dist/{Scaffold-_QafxYws.js → Scaffold-Dn3GeNi0.js} +10241 -10168
  7. package/dist/Simulation-Zgs0MXh1.js +30 -0
  8. package/dist/{index-DcTjoXV1.js → index-DFkMrKek.js} +22249 -19928
  9. package/dist/mapintegratedvuer.js +1 -1
  10. package/dist/mapintegratedvuer.umd.cjs +1667 -1009
  11. package/dist/{style-C2GyLbPa.js → style-DlUxkFU-.js} +75606 -75481
  12. package/dist/style.css +1 -1
  13. package/package.json +8 -7
  14. package/src/App.vue +39 -18
  15. package/src/assets/header-icon.scss +7 -0
  16. package/src/components/ContentBar.vue +5 -1
  17. package/src/components/DialogToolbarContent.vue +91 -6
  18. package/src/components/FlatmapContextCard.vue +11 -8
  19. package/src/components/MapContent.vue +62 -46
  20. package/src/components/SplitFlow.vue +188 -112
  21. package/src/components/scripts/utilities.js +1 -1
  22. package/src/components/viewers/Flatmap.vue +12 -7
  23. package/src/components/viewers/MultiFlatmap.vue +34 -7
  24. package/src/components/viewers/Scaffold.vue +2 -2
  25. package/src/components/viewers/Simulation.vue +19 -1
  26. package/src/components.d.ts +4 -0
  27. package/src/mixins/ContentMixin.js +155 -47
  28. package/src/mixins/DynamicMarkerMixin.js +3 -1
  29. package/src/stores/settings.js +31 -5
  30. package/dist/ContentMixin-CdE8AlUJ.js +0 -339
  31. package/dist/Simulation-CJ-9g74P.js +0 -22
@@ -0,0 +1,706 @@
1
+ import { markRaw as $ } from "vue";
2
+ import { u as H, c as N, E as c, T as L, d as F, e as T } from "./index-DFkMrKek.js";
3
+ import { mapStores as k } from "pinia";
4
+ const d = function(e) {
5
+ return e ? [...new Set(e.map((t) => JSON.stringify(t)))].map(
6
+ (t) => JSON.parse(t)
7
+ ) : [];
8
+ }, g = [], A = async function(e, t) {
9
+ const n = t.filter(
10
+ (o) => g.some((a) => a.taxon === o)
11
+ ), i = g.filter(
12
+ (o) => n.includes(o.taxon)
13
+ ), s = t.filter(
14
+ (o) => !n.includes(o)
15
+ );
16
+ if (s.length) {
17
+ const o = await e.queryLabels(s);
18
+ if (o.length)
19
+ return o.forEach((a) => {
20
+ let { entity: r, label: l } = a;
21
+ l === "Mammalia" && (l = "Mammalia not otherwise specified");
22
+ const f = { taxon: r, label: l };
23
+ i.push(f), g.push(f);
24
+ }), i;
25
+ } else
26
+ return i;
27
+ }, y = function(e, t) {
28
+ if (!e || !t) return !1;
29
+ let n = JSON.stringify(e), i = JSON.stringify(t);
30
+ return n.indexOf(i) !== -1;
31
+ }, u = (e, t) => {
32
+ const n = e.name ?? e, i = t.name ?? t, s = n.toUpperCase(), o = i.toUpperCase();
33
+ return s < o ? -1 : s > o ? 1 : 0;
34
+ };
35
+ let E = function() {
36
+ this.initialise = function(e) {
37
+ this.flatmapApi = e, this.destinations = [], this.origins = [], this.components = [], this.rawURLs = [], this.controller = void 0, this.uberons = [], this.lookUp = [], this.connectivitySource = "sckan";
38
+ }, this.createTooltipData = async function(e, t) {
39
+ let n = [];
40
+ t.feature.hyperlinks && t.feature.hyperlinks.length > 0 ? n = t.feature.hyperlinks : n = this.rawURLs;
41
+ let i;
42
+ if (t.provenanceTaxonomy) {
43
+ i = [];
44
+ try {
45
+ const o = await A(e, t.provenanceTaxonomy);
46
+ o.length && o.forEach((a) => {
47
+ const { label: r } = a;
48
+ i.push(r);
49
+ });
50
+ } catch (o) {
51
+ console.log(o);
52
+ }
53
+ }
54
+ return {
55
+ destinations: this.destinations,
56
+ origins: this.origins,
57
+ components: this.components,
58
+ destinationsWithDatasets: this.destinationsWithDatasets,
59
+ originsWithDatasets: this.originsWithDatasets,
60
+ componentsWithDatasets: this.componentsWithDatasets,
61
+ title: t.label,
62
+ featureId: t.resource,
63
+ hyperlinks: n,
64
+ provenanceTaxonomy: t.provenanceTaxonomy,
65
+ provenanceTaxonomyLabel: i,
66
+ connectivitySource: this.connectivitySource
67
+ };
68
+ }, this.updateTooltipData = function(e) {
69
+ return {
70
+ ...e,
71
+ origins: this.origins,
72
+ originsWithDatasets: this.originsWithDatasets,
73
+ components: this.components,
74
+ componentsWithDatasets: this.componentsWithDatasets,
75
+ destinations: this.destinations,
76
+ destinationsWithDatasets: this.destinationsWithDatasets,
77
+ connectivitySource: this.connectivitySource
78
+ };
79
+ }, this.createComponentsLabelList = function(e, t) {
80
+ let n = [];
81
+ return e.forEach((i) => {
82
+ n.push(this.createLabelFromNeuralNode(i[0]), t), i.length === 2 && n.push(this.createLabelFromNeuralNode(i[1]), t);
83
+ }), n;
84
+ }, this.createLabelLookup = function(e, t) {
85
+ return new Promise(async (n) => {
86
+ let i = {};
87
+ this.uberons = [];
88
+ const s = await A(e, t);
89
+ s.length && (s.forEach((o) => {
90
+ const { taxon: a, label: r } = o;
91
+ i[a] = r, this.uberons.push({
92
+ id: a,
93
+ name: r
94
+ });
95
+ }), n(i));
96
+ });
97
+ }, this.buildConnectivitySqlStatement = function(e) {
98
+ let t = "select knowledge from knowledge where entity in (";
99
+ if (e.length === 1)
100
+ t += `'${e[0]}')`;
101
+ else if (e.length > 1)
102
+ for (let n in e)
103
+ t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
104
+ return t;
105
+ }, this.buildLabelSqlStatement = function(e) {
106
+ let t = "select entity, label from labels where entity in (";
107
+ if (e.length === 1)
108
+ t += `'${e[0]}')`;
109
+ else if (e.length > 1)
110
+ for (let n in e)
111
+ t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
112
+ return t;
113
+ }, this.findAllIdsFromConnectivity = function(e) {
114
+ let t = e.connectivity.flat(), n = [...new Set(t)], i = [];
115
+ return n.forEach((s) => {
116
+ Array.isArray(s) ? i.push(s.flat()) : i.push(s);
117
+ }), [...new Set(i.flat())];
118
+ }, this.flattenConnectivity = function(e) {
119
+ let t = e.flat(), n = [...new Set(t)], i = [];
120
+ return n.forEach((s) => {
121
+ Array.isArray(s) ? i.push(s.flat()) : i.push(s);
122
+ }), i.flat();
123
+ }, this.findComponents = function(e, t, n, i) {
124
+ let s = e.connectivity.flat(), o = d(s), a = [], r = !1;
125
+ return o.forEach((l) => {
126
+ r = !1, y(t, l) && (r = !0), i && y(i, l) && (r = !0), y(n, l) && (r = !0), r || a.push(l);
127
+ }), a;
128
+ }, this.retrieveFlatmapKnowledgeForEvent = async function(e, t) {
129
+ this.controller && this.controller.abort(), this.controller = new AbortController(), this.controller.signal;
130
+ const n = t.resource;
131
+ if (this.destinations = [], this.origins = [], this.components = [], this.rawURLs = [], !n || n.length === 0 || !n[0]) return;
132
+ let i = this.queryForConnectivityNew(e, n[0]);
133
+ return await Promise.all([i]);
134
+ }, this.queryForConnectivityNew = function(e, t, n = "sckan", i = !0) {
135
+ return this.connectivitySource = n, new Promise((s) => {
136
+ (n === "map" ? this.queryMapConnectivity(e.provenance.uuid, t) : e.queryKnowledge(t)).then((a) => {
137
+ if (this.checkConnectivityExists(a)) {
138
+ let r = a;
139
+ i ? this.processConnectivity(e, r).then((l) => {
140
+ a.references && (this.rawURLs = [...a.references]), s(l);
141
+ }) : s(r);
142
+ } else
143
+ s(!1);
144
+ }).catch((a) => {
145
+ a.name === "AbortError" || console.warn(`Unable to get the knowledge for the entity ${t}.`), s(!1);
146
+ });
147
+ });
148
+ }, this.queryMapConnectivity = async function(e, t) {
149
+ const n = this.flatmapApi + `flatmap/${e}/connectivity/${t}`;
150
+ try {
151
+ const i = await fetch(n);
152
+ if (!i.ok)
153
+ throw new Error(`Response status: ${i.status}`);
154
+ return await i.json();
155
+ } catch (i) {
156
+ throw new Error(i);
157
+ }
158
+ }, this.queryForConnectivity = function(e, t, n, i = !0) {
159
+ const s = { sql: this.buildConnectivitySqlStatement(t) }, o = {
160
+ method: "POST",
161
+ headers: {
162
+ "Content-Type": "application/json"
163
+ },
164
+ body: JSON.stringify(s),
165
+ ...n ? { signal: n } : {}
166
+ // add signal to header if it exists
167
+ };
168
+ return new Promise((a) => {
169
+ fetch(`${this.flatmapApi}knowledge/query/`, o).then((r) => r.json()).then((r) => {
170
+ if (this.connectivityExists(r)) {
171
+ let l = JSON.parse(r.values[0][0]);
172
+ i ? this.processConnectivity(e, l).then((f) => {
173
+ a(f);
174
+ }) : a(l);
175
+ } else
176
+ a(!1);
177
+ }).catch((r) => {
178
+ r.name === "AbortError" || console.error("Error:", r), a(!1);
179
+ });
180
+ });
181
+ }, this.checkConnectivityExists = function(e) {
182
+ var t;
183
+ return e && ((t = e.connectivity) == null ? void 0 : t.length);
184
+ }, this.connectivityExists = function(e) {
185
+ return !!(e.values && e.values.length > 0 && JSON.parse(e.values[0][0]).connectivity && JSON.parse(e.values[0][0]).connectivity.length > 0);
186
+ }, this.findIfNodeIsSingle = function(e) {
187
+ return e.length === 1 ? (console.error("Server returns a single node", e), e[0]) : e.length === 2 && e[1].length === 0 ? e[0] : !1;
188
+ }, this.createLabelFromNeuralNode = function(e, t) {
189
+ let n = this.findIfNodeIsSingle(e);
190
+ if (n)
191
+ return t[n];
192
+ let i = t[e[0]];
193
+ return e.length === 2 && e[1].length > 0 && e[1].forEach((s) => {
194
+ t[s] == null ? i += `, ${s}` : i += `, ${t[s]}`;
195
+ }), i;
196
+ }, this.flattenAndFindDatasets = function(e, t, n) {
197
+ let i = this.flattenConnectivity(e), s = this.flattenConnectivity(t), o = this.flattenConnectivity(n);
198
+ this.originsWithDatasets = this.uberons.filter(
199
+ (a) => i.indexOf(a.id) !== -1
200
+ ).sort(u), this.componentsWithDatasets = this.uberons.filter(
201
+ (a) => s.indexOf(a.id) !== -1
202
+ ).sort(u), this.destinationsWithDatasets = this.uberons.filter(
203
+ (a) => o.indexOf(a.id) !== -1
204
+ ).sort(u);
205
+ }, this.processConnectivity = function(e, t) {
206
+ return new Promise((n) => {
207
+ let i = [], s = [], o;
208
+ if (t && t["node-phenotypes"]) {
209
+ const l = ["ilxtr:hasSomaLocatedIn"], f = ["ilxtr:hasAxonPresynapticElementIn", "ilxtr:hasAxonSensorySubcellularElementIn"];
210
+ l.forEach((h) => {
211
+ i.push(...t["node-phenotypes"][h]);
212
+ }), i = d(i), f.forEach((h) => {
213
+ s.push(...t["node-phenotypes"][h]);
214
+ }), s = d(s);
215
+ } else
216
+ s = d(t.axons), t.somas && t.somas.length > 0 && i.push(...t.somas), t.dendrites && t.dendrites.length > 0 && i.push(...t.dendrites), o = t.somas;
217
+ const a = this.findComponents(t, s, i, o), r = this.findAllIdsFromConnectivity(t);
218
+ this.createLabelLookup(e, r).then((l) => {
219
+ this.origins = i.map(
220
+ (f) => this.createLabelFromNeuralNode(f, l)
221
+ ).sort(u), this.components = a.map(
222
+ (f) => this.createLabelFromNeuralNode(f, l)
223
+ ).sort(u), this.destinations = s.map(
224
+ (f) => this.createLabelFromNeuralNode(f, l)
225
+ ).sort(u), this.flattenAndFindDatasets(i, a, s), n({
226
+ ids: {
227
+ dendrites: i,
228
+ components: a,
229
+ axons: s
230
+ },
231
+ labels: {
232
+ origins: this.origins,
233
+ components: this.components,
234
+ destinations: this.destinations
235
+ }
236
+ });
237
+ });
238
+ });
239
+ }, this.buildPubmedSqlStatement = function(e) {
240
+ let t = "select distinct publication from publications where entity in (";
241
+ if (e.length === 1)
242
+ t += `'${e[0]}')`;
243
+ else if (e.length > 1)
244
+ for (let n in e)
245
+ t += `'${e[n]}'${n >= e.length - 1 ? ")" : ","} `;
246
+ return t;
247
+ }, this.buildPubmedSqlStatementForModels = function(e) {
248
+ return `select distinct publication from publications where entity = '${e}'`;
249
+ }, this.flatmapQuery = function(e) {
250
+ const t = { sql: e };
251
+ return fetch(`${this.flatmapApi}knowledge/query/`, {
252
+ method: "POST",
253
+ headers: {
254
+ "Content-Type": "application/json"
255
+ },
256
+ body: JSON.stringify(t)
257
+ }).then((n) => n.json()).catch((n) => {
258
+ console.error("Error:", n);
259
+ });
260
+ };
261
+ };
262
+ function I(e) {
263
+ var n;
264
+ let t = "";
265
+ if ((n = e.provenance) != null && n.connectivity) {
266
+ const i = e.provenance.connectivity;
267
+ "knowledge-source" in i ? t = i["knowledge-source"] : "npo" in i && (t = `${i.npo.release}-npo`);
268
+ }
269
+ return t;
270
+ }
271
+ async function x(e, t) {
272
+ const n = I(e), i = `select knowledge from knowledge
273
+ where source="${n}"
274
+ order by source desc`;
275
+ q();
276
+ const s = sessionStorage.getItem("flatmap-knowledge"), o = sessionStorage.getItem("flatmap-knowledge-source");
277
+ if (!s || o !== n) {
278
+ const l = (await t.flatmapQuery(i)).values.map((f) => f[0]).map((f) => JSON.parse(f));
279
+ return sessionStorage.setItem("flatmap-knowledge", JSON.stringify(l)), sessionStorage.setItem("flatmap-knowledge-source", n), D(), l;
280
+ }
281
+ return JSON.parse(s);
282
+ }
283
+ function D() {
284
+ const n = (/* @__PURE__ */ new Date()).getTime() + 864e5;
285
+ sessionStorage.setItem("flatmap-knowledge-expiry", n);
286
+ }
287
+ function P() {
288
+ [
289
+ "flatmap-knowledge",
290
+ "flatmap-knowledge-expiry",
291
+ "flatmap-knowledge-source"
292
+ ].forEach((t) => {
293
+ sessionStorage.removeItem(t);
294
+ });
295
+ }
296
+ function q() {
297
+ const e = sessionStorage.getItem("flatmap-knowledge-expiry");
298
+ (/* @__PURE__ */ new Date()).getTime() > e && P();
299
+ }
300
+ function O(e) {
301
+ return e[0].toUpperCase() + e.substring(1);
302
+ }
303
+ const W = {
304
+ emits: ["flatmap-provenance-ready", "resource-selected", "species-changed"],
305
+ props: {
306
+ /**
307
+ * Object containing information for
308
+ * the required viewing.
309
+ */
310
+ entry: Object,
311
+ visible: {
312
+ type: Boolean,
313
+ default: !0
314
+ },
315
+ mouseHovered: {
316
+ type: Boolean,
317
+ default: !1
318
+ }
319
+ },
320
+ computed: {
321
+ ...k(H, N),
322
+ idNamePair() {
323
+ return this.splitFlowStore.idNamePair;
324
+ },
325
+ syncMode() {
326
+ return this.splitFlowStore.syncMode;
327
+ },
328
+ useHelpModeDialog() {
329
+ return this.settingsStore.useHelpModeDialog;
330
+ },
331
+ connectivityInfoSidebar() {
332
+ return this.settingsStore.connectivityInfoSidebar;
333
+ },
334
+ annotationSidebar() {
335
+ return this.settingsStore.annotationSidebar;
336
+ }
337
+ },
338
+ mounted: function() {
339
+ c.on("startHelp", () => {
340
+ this.startHelp();
341
+ }), this.multiflatmapRef = this.$refs.multiflatmap, this.flatmapRef = this.$refs.flatmap, this.scaffoldRef = this.$refs.scaffold;
342
+ },
343
+ methods: {
344
+ toggleSyncMode: function() {
345
+ },
346
+ getState: function() {
347
+ },
348
+ openMap: function(e) {
349
+ e === "SYNC" ? (this.toggleSyncMode(), this.trackOpenMap("toggle_map_sync_mode")) : (c.emit("OpenNewMap", e), this.trackOpenMap(`open_new_${e}_map`));
350
+ },
351
+ onMapmanagerLoaded: function(e) {
352
+ this.settingsStore.updateMapManager(e);
353
+ },
354
+ trackOpenMap: function(e) {
355
+ L.sendEvent({
356
+ event: "interaction_event",
357
+ event_name: "portal_maps_open_map",
358
+ category: e,
359
+ location: "open_new_map"
360
+ });
361
+ },
362
+ updateWithViewUrl: function() {
363
+ },
364
+ /**
365
+ * Perform a local search on this contentvuer
366
+ */
367
+ search: function() {
368
+ return !1;
369
+ },
370
+ /**
371
+ * Get a list of search suggestions on this contentvuer
372
+ */
373
+ searchSuggestions: function() {
374
+ },
375
+ /**
376
+ * Callback when the vuers emit a selected event.
377
+ */
378
+ resourceSelected: function(e, t) {
379
+ var a, r, l, f, h, w, S, v, b;
380
+ const n = t[0];
381
+ if (n && this.resourceHasAction(n)) {
382
+ c.emit("PopoverActionClick", n);
383
+ return;
384
+ }
385
+ let i, s = !1;
386
+ const o = {
387
+ paneIndex: this.entry.id,
388
+ type: e,
389
+ resource: t,
390
+ internalName: void 0,
391
+ eventType: void 0
392
+ };
393
+ if (e == "MultiFlatmap" || e == "Flatmap") {
394
+ const m = this.getFlatmapImp();
395
+ if (o.internalName = (a = n == null ? void 0 : n.feature) != null && a.label ? n.feature.label : this.idNamePair[n.feature.models], n.eventType == "click")
396
+ if (o.eventType = "selected", n.feature.type == "marker") {
397
+ let M = o.internalName;
398
+ if (this.settingsStore.isFeaturedMarkerIdentifier(n.feature.id))
399
+ i = {
400
+ type: "Search",
401
+ term: this.settingsStore.featuredMarkerDoi(n.feature.id),
402
+ featuredDataset: !0
403
+ };
404
+ else {
405
+ i = {
406
+ type: "Facet",
407
+ facet: M,
408
+ facetPropPath: "anatomy.organ.category.name",
409
+ facetSubPropPath: "anatomy.organ.name",
410
+ term: "Anatomical structure"
411
+ };
412
+ let p = /* @__PURE__ */ new Set();
413
+ n != null && n.feature["marker-terms"] ? (n.feature["marker-terms"].forEach((C) => {
414
+ p.add(C.label);
415
+ }), p.add(M), p.size > 0 && (i = {
416
+ type: "Facets",
417
+ labels: [...p]
418
+ })) : (r = n == null ? void 0 : n.feature) != null && r.models && (i = {
419
+ type: "PMRSearch",
420
+ term: n.feature.models
421
+ });
422
+ }
423
+ s = !0, e == "MultiFlatmap" && m.clearSearchResults();
424
+ } else n.feature.type == "feature" && (m.options && m.options.style === "functional" && (f = (l = n.feature) == null ? void 0 : l.hyperlinks) != null && f.pmr && (i = {
425
+ type: "URL",
426
+ resource: (w = (h = n.feature) == null ? void 0 : h.hyperlinks) == null ? void 0 : w.pmr
427
+ }), this.syncMode && (s = !0));
428
+ else n.eventType == "mouseenter" && (o.eventType = "highlighted", s = !0);
429
+ } else e == "Scaffold" && (n && ((((S = n.data) == null ? void 0 : S.id) === void 0 || ((v = n.data) == null ? void 0 : v.id) === "") && (n.data.id = (b = n.data) == null ? void 0 : b.group), o.internalName = n.data.id, n.data.lastActionOnMarker === !0 && (i = {
430
+ type: "Facet",
431
+ facet: O(n.data.id),
432
+ facetPropPath: "anatomy.organ.category.name",
433
+ term: "Anatomical structure"
434
+ })), o.eventType = "selected", s = !0);
435
+ i && c.emit("PopoverActionClick", i), s && this.$emit("resource-selected", o);
436
+ },
437
+ resourceHasAction: function(e) {
438
+ return e.type === "URL" || e.type === "Search" || e.type === "Neuron Search" || e.type == "Facet" || e.type == "Facets";
439
+ },
440
+ /**
441
+ * Check if this viewer is currently visible
442
+ */
443
+ isVisible: function() {
444
+ return this.splitFlowStore.getPaneNameById(this.entry.id) !== void 0;
445
+ },
446
+ displayTooltip: function() {
447
+ },
448
+ /**
449
+ * Get the term to zoom/highlight in a synchronisation event,
450
+ * if it cannot be found in the map, it will perform several
451
+ * calls to try to ge a valid name/id.
452
+ */
453
+ getNameAndIdFromSyncData: async function(e) {
454
+ let t = e.internalName;
455
+ t === void 0 && e.resource && (t = e.resource.label);
456
+ let n;
457
+ if (e.resource && e.resource.resource && (n = e.resource.resource[0]), this.entry.type === "Scaffold") {
458
+ if (this.$refs.scaffold.findObjectsWithGroupName(t).length === 0) {
459
+ if (e.resource && e.resource.feature) {
460
+ const o = F(e.resource.feature.models);
461
+ if (o.length > 0) return o;
462
+ }
463
+ let s = T(t);
464
+ if (s)
465
+ return s;
466
+ if (n && e.eventType === "selected")
467
+ return fetch(`${this.apiLocation}get-related-terms/${n}`).then((o) => o.json()).then((o) => {
468
+ var a;
469
+ if (((a = o.uberon) == null ? void 0 : a.array.length) > 0)
470
+ return t = o.uberon.array[0].name.charAt(0).toUpperCase() + o.uberon.array[0].name.slice(1), n = o.uberon.array[0].id.toUpperCase(), { id: n, name: t };
471
+ });
472
+ }
473
+ } else if (this.entry.type === "MultiFlatmap")
474
+ if (t === "Bladder")
475
+ t = "Urinary Bladder";
476
+ else {
477
+ const i = F(t);
478
+ i.length > 0 && (t = i[0]);
479
+ }
480
+ return { id: n, name: t };
481
+ },
482
+ // Get the species and andaotmy info for the featured datasets
483
+ getDatasetAnatomyInfo: function(e) {
484
+ fetch(`${this.apiLocation}dataset_info/anatomy?identifier=${e}`).then((t) => t.json()).then((t) => {
485
+ const n = t.result[0];
486
+ let i;
487
+ try {
488
+ i = n.anatomy.organ[0].curie;
489
+ } catch {
490
+ i = void 0;
491
+ }
492
+ let s;
493
+ try {
494
+ s = n.item.curie;
495
+ } catch {
496
+ s = void 0;
497
+ }
498
+ let o;
499
+ try {
500
+ let a = 0, r = !1;
501
+ for (; !r && a < n.organisms.subject.length; ) {
502
+ const l = n.organisms.subject[a];
503
+ l.species && (o = l.species.name, r = !0), a += 1;
504
+ }
505
+ } catch {
506
+ o = void 0;
507
+ }
508
+ this.settingsStore.updateFeaturedMarker({
509
+ identifier: e,
510
+ marker: i,
511
+ doi: s,
512
+ species: o
513
+ });
514
+ });
515
+ },
516
+ // Check if the old featured dataset api has any info
517
+ oldFeaturedDatasetApiHasInfo: async function() {
518
+ let t = await (await fetch(`${this.apiLocation}get_featured_datasets_identifiers`)).json();
519
+ return !t.identifiers || t.identifiers.length == 0 ? !1 : t.identifiers;
520
+ },
521
+ // Check if the new featured dataset api has any info
522
+ newFeaturedDatasetApiHasInfo: async function() {
523
+ let t = await (await fetch(`${this.apiLocation}get_featured_dataset`)).json();
524
+ return !t.datasets || t.datasets.length == 0 ? !1 : t.datasets.map((n) => n.id);
525
+ },
526
+ /**
527
+ * Get a list of featured datasets to display.
528
+ */
529
+ getFeaturedDatasets: async function() {
530
+ let e = [], t = await this.oldFeaturedDatasetApiHasInfo();
531
+ if (t) e = t;
532
+ else {
533
+ let n = await this.newFeaturedDatasetApiHasInfo();
534
+ n && (e = n);
535
+ }
536
+ this.settingsStore.updateFeatured(e), e.forEach((n) => {
537
+ this.getDatasetAnatomyInfo(n);
538
+ });
539
+ },
540
+ zoomToFeatures: function() {
541
+ },
542
+ handleSyncMouseEvent: async function(e) {
543
+ let t = await this.getNameAndIdFromSyncData(e);
544
+ e.eventType === "highlighted" ? this.highlightFeatures(t) : e.eventType === "selected" && this.displayTooltip(t);
545
+ },
546
+ /**
547
+ * Handle sync pan zoom event
548
+ */
549
+ handleSyncPanZoomEvent: function() {
550
+ },
551
+ highlightFeatures: function() {
552
+ },
553
+ receiveSynchronisedEvent: async function(e) {
554
+ if (e.paneIndex !== this.entry.id)
555
+ e.eventType == "panZoom" || this.handleSyncMouseEvent(e);
556
+ else if (e.eventType == "selected") {
557
+ let t = await this.getNameAndIdFromSyncData(e);
558
+ this.zoomToFeatures(t, !1);
559
+ }
560
+ },
561
+ requestSynchronisedEvent: function() {
562
+ },
563
+ flatmapMarkerUpdate() {
564
+ },
565
+ onResize: function() {
566
+ },
567
+ startHelp: function() {
568
+ this.isInHelp === !1 && (this.helpMode = !0, window.addEventListener("mousedown", this.checkEndHelpMouseDown), this.isInHelp = !0);
569
+ },
570
+ endHelp: function() {
571
+ window.removeEventListener("mousedown", this.checkEndHelpMouseDown), this.helpMode = !1, setTimeout(() => {
572
+ this.isInHelp = !1;
573
+ }, 200);
574
+ },
575
+ onHelpModeShowNext: function() {
576
+ this.helpModeActiveItem += 1;
577
+ },
578
+ onHelpModeLastItem: function(e) {
579
+ e && (this.helpModeLastItem = !0);
580
+ },
581
+ onFinishHelpMode: function() {
582
+ this.helpMode = !1, this.helpModeActiveItem = 0, this.helpModeLastItem = !1;
583
+ },
584
+ onTooltipShown: function() {
585
+ 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();
586
+ },
587
+ onMapTooltipShown: function() {
588
+ 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();
589
+ },
590
+ /**
591
+ * End help-mode only if user clicks outside of help mode dialog.
592
+ */
593
+ checkEndHelpMouseDown: function(e) {
594
+ e.target.closest(".help-mode-dialog") || this.endHelp();
595
+ },
596
+ flatmapHighlight: async function(e, t, n, i) {
597
+ let s = [...t, ...i];
598
+ const o = this.settingsStore.globalSettings;
599
+ if (o.highlightConnectedPaths) {
600
+ const a = t.length ? t : i.length ? i : [], r = await e.retrieveConnectedPaths(a);
601
+ r && s.push(...r);
602
+ }
603
+ if (o.highlightDOIPaths) {
604
+ const a = await e.searchConnectivitiesByReference(n);
605
+ a && s.push(...a);
606
+ }
607
+ return s = [...new Set(s)], s;
608
+ },
609
+ cardHoverHighlight: function() {
610
+ if (this.visible) {
611
+ const e = this.settingsStore.hoverAnatomies, t = this.settingsStore.hoverOrgans, n = this.settingsStore.hoverDOI, i = this.settingsStore.hoverConnectivity;
612
+ let s = null, o = null;
613
+ this.flatmapRef && (s = this.$flatmapRef), this.multiflatmapRef && (s = this.$multiflatmapRef), this.scaffoldRef && (o = this.$scaffoldRef), (this.multiflatmapRef || this.flatmapRef) && s ? s.mapImp.clearSearchResults() : this.scaffoldRef && o && o.changeHighlightedByName(t, "", !1), (e.length || t.length || n || i.length) && ((this.multiflatmapRef || this.flatmapRef) && s ? this.flatmapHighlight(s, e, n, i).then((a) => {
614
+ try {
615
+ s.zoomToFeatures(a);
616
+ } catch (r) {
617
+ console.log(r);
618
+ }
619
+ }) : this.scaffoldRef && o && o.changeHighlightedByName(t, "", !1));
620
+ }
621
+ },
622
+ onAnnotationOpen: function(e) {
623
+ c.emit("annotation-open", e);
624
+ },
625
+ onAnnotationClose: function() {
626
+ c.emit("annotation-close");
627
+ },
628
+ onConnectivityInfoOpen: function(e) {
629
+ c.emit("connectivity-info-open", e);
630
+ },
631
+ onConnectivityGraphError: function(e) {
632
+ c.emit("connectivity-graph-error", e);
633
+ },
634
+ loadConnectivityKnowledge: async function(e) {
635
+ const t = I(e), n = $(new E());
636
+ n.initialise(this.flatmapAPI);
637
+ const i = await x(e, n);
638
+ this.connectivityKnowledge = i.filter((s) => {
639
+ var o;
640
+ return !!(s.source === t && ((o = s.connectivity) != null && o.length));
641
+ }), c.emit("connectivity-knowledge", this.connectivityKnowledge);
642
+ },
643
+ connectivityQueryFilter: async function(e, t) {
644
+ let n = this.connectivityKnowledge;
645
+ if (t.type === "query-update")
646
+ this.query !== t.value && (this.target = []), this.query = t.value;
647
+ else if (t.type === "filter-update")
648
+ this.filter = t.value, this.target = [];
649
+ else if (t.type === "query-filter-update") {
650
+ this.query = t.query, this.filter = t.filter, this.target = t.data, this.query || c.emit("connectivity-knowledge", [...n]);
651
+ return;
652
+ }
653
+ if (this.query) {
654
+ let i = "", s = [], o = [], a = [];
655
+ this.searchSuggestions(this.query, o);
656
+ const r = [...new Set(o)];
657
+ if (i = "label", s = r, r.length === 1) {
658
+ const l = {
659
+ type: this.filter.map((f) => f.facet.toLowerCase()),
660
+ target: this.target.map((f) => f.id)
661
+ };
662
+ a = await e.retrieveConnectedPaths([this.query], l), i = "id", s = [this.query, ...a.filter((f) => f !== this.query)];
663
+ }
664
+ n = n.filter((l) => a.includes(l.id) || r.includes(l.label)), n.sort((l, f) => s.indexOf(l[i]) - s.indexOf(f[i]));
665
+ }
666
+ c.emit("connectivity-knowledge", n);
667
+ }
668
+ },
669
+ data: function() {
670
+ return {
671
+ apiLocation: void 0,
672
+ activeSpecies: "Human Male",
673
+ scaffoldCamera: void 0,
674
+ mainStyle: {
675
+ height: this.entry.datasetTitle ? "calc(100% - 30px)" : "100%",
676
+ width: "100%",
677
+ bottom: "0px"
678
+ },
679
+ helpMode: !1,
680
+ helpModeActiveItem: 0,
681
+ helpModeLastItem: !1,
682
+ multiflatmapRef: null,
683
+ flatmapRef: null,
684
+ scaffoldRef: null,
685
+ scaffoldLoaded: !1,
686
+ isInHelp: !1,
687
+ mapManager: void 0,
688
+ connectivityKnowledge: [],
689
+ query: "",
690
+ filter: [],
691
+ target: []
692
+ // Support origins/components/destinations term search
693
+ };
694
+ },
695
+ created: function() {
696
+ 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);
697
+ },
698
+ watch: {
699
+ helpMode: function(e) {
700
+ e || (this.helpModeActiveItem = 0);
701
+ }
702
+ }
703
+ };
704
+ export {
705
+ W as C
706
+ };