@abi-software/flatmapvuer 1.10.3-beta.8 → 1.10.3-beta.9
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/flatmapvuer.js
CHANGED
|
@@ -8568,9 +8568,6 @@ const Ei = new Ey(), ky = "cannot be found on the map.", Ty = (e) => {
|
|
|
8568
8568
|
return t || (t = qe(new cu(`${e.flatmapAPI}annotator`)), fe("$annotator", t)), { annotator: t };
|
|
8569
8569
|
},
|
|
8570
8570
|
methods: {
|
|
8571
|
-
enableFeatureResetOnClick: function(e) {
|
|
8572
|
-
this.mapImp && this.mapImp.enableFeatureResetOnClick(e);
|
|
8573
|
-
},
|
|
8574
8571
|
/**
|
|
8575
8572
|
*
|
|
8576
8573
|
* @param filter format should follow #makeStyleFilter (flatmap-viewer)
|
|
@@ -11156,7 +11153,7 @@ function By(e, t, n, o, i, a) {
|
|
|
11156
11153
|
[j, e.loading]
|
|
11157
11154
|
]);
|
|
11158
11155
|
}
|
|
11159
|
-
const yl = /* @__PURE__ */ Wn(Ay, [["render", By], ["__scopeId", "data-v-
|
|
11156
|
+
const yl = /* @__PURE__ */ Wn(Ay, [["render", By], ["__scopeId", "data-v-3a537729"]]), ks = {
|
|
11160
11157
|
"NCBITaxon:10114": "01fedbf9-d783-509c-a10c-827941ab13da",
|
|
11161
11158
|
"NCBITaxon:9823": "a336ac04-24db-561f-a25f-1c994fe17410",
|
|
11162
11159
|
"NCBITaxon:9606": "42ed6323-f645-5fbe-bada-9581819cf689",
|
package/dist/flatmapvuer.umd.cjs
CHANGED
|
@@ -21,4 +21,4 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:a,curr
|
|
|
21
21
|
where source="${sa(e)}" and
|
|
22
22
|
knowledge like "%${t}%" order by source desc`;return(await o.flatmapQuery(i)).values.map(c=>c[0]).map(c=>JSON.parse(c)).map(c=>c.id)}function sa(e){return vy(e.provenance)}function vy(e){let t="";if(e!=null&&e.connectivity){const o=e.connectivity;"knowledge-source"in o?t=o["knowledge-source"]:"npo"in o&&(t=`${o.npo.release}-npo`)}return t}async function Sy(e,t){const o=sa(e),a=`select knowledge from knowledge
|
|
23
23
|
where source="${o}"
|
|
24
|
-
order by source desc`;ps();const i=sessionStorage.getItem("flatmap-knowledge"),r=sessionStorage.getItem("flatmap-knowledge-source");if(!i||r!==o){const d=(await t.flatmapQuery(a)).values.map(c=>c[0]).map(c=>JSON.parse(c));return sessionStorage.setItem("flatmap-knowledge",JSON.stringify(d)),sessionStorage.setItem("flatmap-knowledge-source",o),ky(),d}return JSON.parse(i)}function ky(){const o=new Date().getTime()+864e5;sessionStorage.setItem("flatmap-knowledge-expiry",o)}function Ey(){["flatmap-knowledge","flatmap-knowledge-expiry","flatmap-knowledge-source"].forEach(t=>{sessionStorage.removeItem(t)})}function ps(){const e=sessionStorage.getItem("flatmap-knowledge-expiry");new Date().getTime()>e&&Ey()}const la=e=>e&&e.charAt(0).toUpperCase()+e.slice(1);var hs={exports:{}};(function(e,t){(function(o,a){e.exports=a()})(typeof window<"u"?window:hm,function(){if(typeof window>"u")return null;var o=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")(),a=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||function(f){return o.setTimeout(f,20)},i=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||function(f){o.clearTimeout(f)};function r(f,h){var p=Object.prototype.toString.call(f),g=p==="[object Array]"||p==="[object NodeList]"||p==="[object HTMLCollection]"||p==="[object Object]"||typeof jQuery<"u"&&f instanceof jQuery||typeof Elements<"u"&&f instanceof Elements,u=0,m=f.length;if(g)for(;u<m;u++)h(f[u]);else h(f)}function s(f){if(!f.getBoundingClientRect)return{width:f.offsetWidth,height:f.offsetHeight};var h=f.getBoundingClientRect();return{width:Math.round(h.width),height:Math.round(h.height)}}function l(f,h){Object.keys(h).forEach(function(p){f.style[p]=h[p]})}var d=function(f,h){var p=0;function g(){var m=[];this.add=function(w){m.push(w)};var y,b;this.call=function(w){for(y=0,b=m.length;y<b;y++)m[y].call(this,w)},this.remove=function(w){var T=[];for(y=0,b=m.length;y<b;y++)m[y]!==w&&T.push(m[y]);m=T},this.length=function(){return m.length}}function u(m,y){if(m){if(m.resizedAttached){m.resizedAttached.add(y);return}m.resizedAttached=new g,m.resizedAttached.add(y),m.resizeSensor=document.createElement("div"),m.resizeSensor.dir="ltr",m.resizeSensor.className="resize-sensor";var b={pointerEvents:"none",position:"absolute",left:"0px",top:"0px",right:"0px",bottom:"0px",overflow:"hidden",zIndex:"-1",visibility:"hidden",maxWidth:"100%"},w={position:"absolute",left:"0px",top:"0px",transition:"0s"};l(m.resizeSensor,b);var T=document.createElement("div");T.className="resize-sensor-expand",l(T,b);var S=document.createElement("div");l(S,w),T.appendChild(S);var v=document.createElement("div");v.className="resize-sensor-shrink",l(v,b);var E=document.createElement("div");l(E,w),l(E,{width:"200%",height:"200%"}),v.appendChild(E),m.resizeSensor.appendChild(T),m.resizeSensor.appendChild(v),m.appendChild(m.resizeSensor);var I=window.getComputedStyle(m),M=I?I.getPropertyValue("position"):null;M!=="absolute"&&M!=="relative"&&M!=="fixed"&&M!=="sticky"&&(m.style.position="relative");var B=!1,x=0,k=s(m),_=0,V=0,q=!0;p=0;var F=function(){var Z=m.offsetWidth,ce=m.offsetHeight;S.style.width=Z+10+"px",S.style.height=ce+10+"px",T.scrollLeft=Z+10,T.scrollTop=ce+10,v.scrollLeft=Z+10,v.scrollTop=ce+10},O=function(){if(q){var Z=m.offsetWidth===0&&m.offsetHeight===0;if(Z){p||(p=a(function(){p=0,O()}));return}else q=!1}F()};m.resizeSensor.resetSensor=O;var $=function(){x=0,B&&(_=k.width,V=k.height,m.resizedAttached&&m.resizedAttached.call(k))},pe=function(){k=s(m),B=k.width!==_||k.height!==V,B&&!x&&(x=a($)),O()},Y=function(Z,ce,Ee){Z.attachEvent?Z.attachEvent("on"+ce,Ee):Z.addEventListener(ce,Ee)};Y(T,"scroll",pe),Y(v,"scroll",pe),p=a(function(){p=0,O()})}}r(f,function(m){u(m,h)}),this.detach=function(m){p||(i(p),p=0),d.detach(f,m)},this.reset=function(){f.resizeSensor.resetSensor()}};if(d.reset=function(f){r(f,function(h){h.resizeSensor.resetSensor()})},d.detach=function(f,h){r(f,function(p){p&&(p.resizedAttached&&typeof h=="function"&&(p.resizedAttached.remove(h),p.resizedAttached.length())||p.resizeSensor&&(p.contains(p.resizeSensor)&&p.removeChild(p.resizeSensor),delete p.resizeSensor,delete p.resizedAttached))})},typeof MutationObserver<"u"){var c=new MutationObserver(function(f){for(var h in f)if(f.hasOwnProperty(h))for(var p=f[h].addedNodes,g=0;g<p.length;g++)p[g].resizeSensor&&d.reset(p[g])});document.addEventListener("DOMContentLoaded",function(f){c.observe(document.body,{childList:!0,subtree:!0})})}return d})})(hs);var Iy=hs.exports;const Ty=mm(Iy),Ay=ga.defineStore("main",{state:()=>({userProfile:{token:""}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function Oy(e){return{all:e=e||new Map,on:function(t,o){var a=e.get(t);a?a.push(o):e.set(t,[o])},off:function(t,o){var a=e.get(t);a&&(o?a.splice(a.indexOf(o)>>>0,1):e.set(t,[]))},emit:function(t,o){var a=e.get(t);a&&a.slice().map(function(i){i(o)}),(a=e.get("*"))&&a.slice().map(function(i){i(t,o)})}}}const ca=new Oy,My="cannot be found on the map.",By=e=>{let t={lng:0,lat:0},o;return e.type==="Polygon"?e.coordinates.length&&(o=e.coordinates[0]):o=e.coordinates,o&&(e.type!=="Point"?(o.map(a=>{t.lng+=parseFloat(a[0]),t.lat+=parseFloat(a[1])}),t.lng=t.lng/o.length,t.lat=t.lat/o.length):(t.lng+=parseFloat(o[0]),t.lat+=parseFloat(o[1]))),t},ms=(e,t)=>{const o=[];let a=e.organs?e.organs:e.ftus;const i=a?a.filter((r,s)=>a.findIndex(l=>l.label===r.label)===s):void 0;return i&&i.forEach(r=>{const s={label:r.label,models:r.models,key:`${t}.${r.label}`},l=ms(r,s.key);l.length>0&&(s.children=l),o.push(s)}),o},xy={name:"FlatmapVuer",components:{Button:Fr,Col:en,Loading:Yg,Radio:Xr,Icon:ke,RadioGroup:es,Row:Xt,Select:Hn,Dialog:mg,MapSvgIcon:ma.MapSvgIcon,MapSvgSpriteColor:ma.MapSvgSpriteColor,Tooltip:Re.Tooltip,TreeControls:Re.TreeControls,SelectionsGroup:fs,SvgLegends:gy,ElIconWarningFilled:K.WarningFilled,ElIconArrowDown:K.ArrowDown,ElIconArrowLeft:K.ArrowLeft,DrawToolbar:Re.DrawToolbar},beforeCreate:function(){this.setStateRequired=!1},setup(e){let t=n.inject("$annotator");return t||(t=n.markRaw(new Is.AnnotationService(`${e.flatmapAPI}annotator`)),n.provide("$annotator",t)),{annotator:t}},methods:{enableFeatureResetOnClick:function(e){this.mapImp&&this.mapImp.enableFeatureResetOnClick(e)},setVisibilityFilter:function(e){this.mapImp&&(e?this.mapImp.setVisibilityFilter(e):this.mapImp.clearVisibilityFilter())},manualAbortedOnClose:function(){this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEventCallback({},{type:"aborted"}),this.initialiseDrawing()},initialiseDrawing:function(){this.connectionEntry={},this.activeDrawTool=void 0,this.activeDrawMode=void 0,this.drawnCreatedEvent={}},cancelDrawnFeature:function(){this.isValidDrawnCreated&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[{...this.drawnCreatedEvent.feature,resourceId:this.serverURL}],this.rollbackAnnotationEvent(),this.initialiseDrawing())},connectedFeatureTooltip:function(e){if(this.mapImp)if(e){const t=Number(e);let a={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(i=>i.id===e.trim())}};this.checkAndCreatePopups([a])}else this.closeTooltip()},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent]),Object.keys(this.connectionEntry).length>0&&(this.annotationEntry[0].feature.connection=this.connectionEntry),this.initialiseDrawing())},toolbarEvent:function(e,t){if(!this.isValidDrawnCreated){if(this.manualAbortedOnClose(),this.doubleClickedFeature=!1,this.changeAnnotationDrawMode({mode:"simple_select"}),e==="mode")this.activeDrawMode=t;else if(e==="tool"){if(this.cancelDrawnFeature(),t){const o=t.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${o}`})}this.activeDrawTool=t}}},annotationDrawModeEvent:function(e){this.activeDrawMode==="Edit"?this.doubleClickedFeature&&(e.feature.feature.geometry.type!=="Point"&&(this.changeAnnotationDrawMode({mode:"direct_select",options:{featureId:e.feature.feature.id}}),this.modifyAnnotationFeature()),this.doubleClickedFeature=!1):this.activeDrawMode==="Delete"&&(this.changeAnnotationDrawMode({mode:"simple_select",options:{featureIds:[e.feature.feature.id]}}),this.modifyAnnotationFeature())},createConnectivityBody:function(){if(Object.keys(this.connectionEntry).length>0){const e=Object.values(this.connectionEntry),t={type:"connectivity",source:e[0],target:e[e.length-1],intermediates:e.filter((o,a)=>a!==0&&a!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},modifyAnnotationFeature:function(){this.mapImp&&this.mapImp.removeAnnotationFeature()},rollbackAnnotationEvent:function(){this.mapImp&&this.annotationEntry.length>0&&["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.mapImp.rollbackAnnotationEvent(this.annotationEntry[0]),this.annotationEntry=[])},commitAnnotationEvent:function(e){this.mapImp&&(this.offlineAnnotationEnabled&&(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],this.offlineAnnotations.push(e),this.annotationEntry[0].type==="deleted"&&(this.offlineAnnotations=this.offlineAnnotations.filter(t=>t.resource!==this.serverURL||t.item.id!==e.item.id)),sessionStorage.setItem("anonymous-annotation",JSON.stringify(this.offlineAnnotations))),["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.featureAnnotationSubmitted=!0,this.mapImp.commitAnnotationEvent(this.annotationEntry[0]),e.body.comment==="Position Updated"?this.annotationEntry[0].positionUpdated=!1:this.annotationEntry[0].type==="deleted"&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[]),this.addAnnotationFeature()))},fetchAnnotatedItemIds:async function(e=void 0,t=void 0){let o;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.resource===this.serverURL).map(a=>a.item.id)):(o=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),"resource"in o&&(o=o.itemIds)),o},setFeatureAnnotated:async function(){if(this.mapImp){const e=await this.fetchAnnotatedItemIds();for(const t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let o;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.feature&&a.resource===this.serverURL).map(a=>a.feature);else{const a=await this.fetchAnnotatedItemIds(e,t);o=await this.annotator.drawnFeatures(this.userToken,this.serverURL,a),"resource"in o&&(o=o.features)}return o},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);const e=this.annotationFrom==="Anyone"?void 0:this.authorisedUser.orcid?this.authorisedUser.orcid:"0000-0000-0000-0000",t=this.annotationFrom==="Anyone"?void 0:this.annotationFrom==="Me",o=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=o,this.loading=!1,!this.featureAnnotationSubmitted)for(const a of o)this.mapImp.addAnnotationFeature(a)}},showAnnotator:function(e){this.mapImp&&(this.mapImp.showAnnotator(e),this.$el.querySelector(".maplibregl-ctrl-group").style.display="none")},setAnnotationFrom:function(e){this.annotationFrom=e,this.mapImp&&(this.manualAbortedOnClose(),this.addAnnotationFeature())},emitOfflineAnnotationUpdate:function(){this.$emit("update-offline-annotation-enabled",this.offlineAnnotationEnabled)},setFlightPath3D:function(e){this.flightPath3DRadio=e,this.mapImp&&this.mapImp.enableFlightPaths(e)},viewLatestMap:function(){let e=this.biologicalSex?this.biologicalSex:void 0;this.entry==="NCBITaxon:9606"&&(e="PATO:0000384");const t={entry:this.entry,biologicalSex:e,viewport:this.mapImp.getState()};this.$emit("view-latest-map",t)},backgroundChangeCallback:function(e){this.currentBackground=e,this.mapImp&&this.mapImp.setBackgroundColour(this.currentBackground,1)},processSystems:function(e){if(this.systems.length=0,e&&e.length>0){const t={label:"All",key:"All",children:[]};e.forEach(o=>{const a={colour:o.colour,enabled:o.enabled,label:o.id,key:o.id},i=ms(o,a.key);i.length>0&&(a.children=i),t.children.push(a)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,qn(this.mapImp,e).then(o=>{o.length&&o.forEach(a=>{let i=!0;t&&(i=t.checkAll?!0:t.checked.includes(a.taxon)),this.taxonConnectivity.push({...a,enabled:i}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(a.taxon,i)})})},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen},setColour:function(e){this.colourRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:e,outlined:this.outlinesRadio})},setOutlines:function(e){this.outlinesRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:this.colourRadio,outlined:e})},setInitMapState:function(){if(this.mapImp){const e=this.mapImp.map,t=this.mapImp.options.bounds,o=[[t[0],t[1]],[t[2],t[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=n.markRaw({initBounds:o})}},resetView:function(){if(this.mapImp){const e=this.mapImp.map,{initBounds:t}=this.initMapState;e.resetNorthPitch({animate:!1}),t&&e.fitBounds(t,{animate:!1}),this.$refs.skcanSelection&&this.$refs.skcanSelection.reset(),this.$refs.layersSelection&&this.$refs.layersSelection.reset(),this.$refs.systemsSelection&&this.$refs.pathwaysSelection.reset(),this.$refs.pathwaysSelection&&this.$refs.pathwaysSelection.reset()}},zoomIn:function(){this.mapImp&&this.mapImp.zoomIn()},zoomOut:function(){this.mapImp&&this.mapImp.zoomOut()},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},sckanSelected:function(e){this.mapImp&&this.mapImp.enableSckanPath(e.key,e.value)},checkAllSCKAN:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableSckanPath(t,e.value))},zoomToFeatures:function(e){this.mapImp&&this.mapImp.zoomToFeatures(e)},retrieveConnectedPaths:async function(e,t={}){var o,a,i,r,s;if(this.viewingMode==="Neuron Connection"&&this.connectionType.toLowerCase()==="all"){const l=this.mapImp.uuid;return await Re.queryAllConnectedPaths(this.flatmapAPI,l,e)}if(this.mapImp){let l=[],d=(o=t.target)!=null&&o.length?t.target:[];const c=[...this.mapImp.pathModelNodes(e)],f=await this.mapImp.queryPathsForFeatures(e);if(c.length){if(!d.length){const h=(a=t.type)!=null&&a.length?t.type:["all"],p=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),g=(i=p==null?void 0:p.ids)==null?void 0:i.dendrites.flat(1/0),u=(r=p==null?void 0:p.ids)==null?void 0:r.components.flat(1/0),m=(s=p==null?void 0:p.ids)==null?void 0:s.axons.flat(1/0);let y=[];h.includes("origins")&&y.push(...g),h.includes("components")&&y.push(...u),h.includes("destinations")&&y.push(...m),h.includes("all")&&y.push(...g,...u,...m),d=[...new Set(y)]}c.forEach(h=>{this.mapImp.nodePathModels(h).forEach(g=>{const m=this.mapImp.pathModelNodes(g).map(b=>this.mapImp.featureProperties(b).models);d.filter(b=>m.includes(b)).length&&!l.includes(g)&&l.push(g)})})}else f.length&&(d.length?f.forEach(h=>{const g=this.mapImp.pathModelNodes(h).map(m=>this.mapImp.featureProperties(m).models);d.filter(m=>g.includes(m)).length&&!l.includes(h)&&l.push(h)}):l=f);return l=[...new Set([...l,...e])],l}},resetMapFilter:function(){const e=this.mapFilters.alert;let t;const o={"tile-layer":"pathways"},a={NOT:o};e.with&&!e.without?t={OR:[a,{AND:[o,{HAS:"alert"}]}]}:!e.with&&e.without?t={OR:[a,{AND:[o,{NOT:{HAS:"alert"}}]}]}:!e.with&&!e.without&&(t=a),this.setVisibilityFilter(t)},alertMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){let t;const o={"tile-layer":"pathways"},a={NOT:o};if(e.key==="alert"||e.key==="withoutAlert"){const i=e.key==="alert"?{HAS:"alert"}:{NOT:{HAS:"alert"}};t={OR:[a,{AND:[o,i]}]}}this.setVisibilityFilter(t)}else this.resetMapFilter()},alertSelected:function(e){this.mapImp&&(e.key==="alert"?e.value?this.mapFilters.alert.with=!0:this.mapFilters.alert.with=!1:e.key==="withoutAlert"&&(e.value?this.mapFilters.alert.without=!0:this.mapFilters.alert.without=!1),this.resetMapFilter())},checkAllAlerts:function(e){this.mapImp&&(e.value?(this.mapFilters.alert.without=!0,this.mapFilters.alert.with=!0):(this.mapFilters.alert.without=!1,this.mapFilters.alert.with=!1),this.resetMapFilter())},systemSelected:function(e){this.mapImp&&this.mapImp.enableSystem(e.key,e.value)},checkAllSystems:function(e){this.mapImp&&this.systems[0].children.forEach(t=>this.mapImp.enableSystem(t.label,e))},ftuSelected:function(e){this.searchAndShowResult(e,!0)},layersSelected:function(e){this.mapImp&&this.mapImp.enableLayer(e.key,e.value)},checkAllLayers:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableLayer(t,e.value))},taxonsSelected:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.key,e.value)},taxonMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){clearTimeout(this.taxonLeaveDelay);let t=this.mapImp.taxonFeatureIds(e.key);this.mapImp.enableConnectivityByTaxonIds(e.key,e.value),this.mapImp.zoomToGeoJSONFeatures(t,{noZoomIn:!0})}else this.taxonLeaveDelay=setTimeout(()=>{this.mapImp.unselectGeoJSONFeatures(),e.selections.forEach(t=>{let o=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,o)})},1e3)},checkAllTaxons:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.keys,e.value)},pathwaysSelected:function(e){this.mapImp&&this.mapImp.enablePath(e.key,e.value)},checkAllPathways:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enablePath(t,e.value))},enablePanZoomEvents:function(e){this.mapImp.enablePanZoomEvents(e)},annotationEventCallback:function(e,t){if(t.type==="aborted")this.featureAnnotationSubmitted?this.featureAnnotationSubmitted=!1:this.rollbackAnnotationEvent(),this.annotationEntry=[];else if(t.type==="modeChanged")t.feature.mode==="direct_select"&&(this.doubleClickedFeature=!0),this.annotationSidebar&&t.feature.mode==="simple_select"&&this.activeDrawMode==="Deleted"&&this.annotationEventCallback({},{type:"aborted"});else if(t.type==="selectionChanged"){if(this.selectedDrawnFeature=t.feature.features.length===0?void 0:t.feature.features[0],e.feature.feature=this.selectedDrawnFeature,!this.activeDrawTool)if(this.connectionEntry={},this.selectedDrawnFeature){const o=this.existDrawnFeatures.find(a=>a.id===this.selectedDrawnFeature.id);o&&o.connection&&(this.connectionEntry=o.connection),this.annotationDrawModeEvent(e)}else this.annotationSidebar&&this.previousEditEvent.type==="updated"&&(this.annotationEntry=[{...this.previousEditEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.previousEditEvent={}}else{if(t.type==="created"||t.type==="updated"){t.type==="updated"&&t.feature.action&&(t.positionUpdated=t.feature.action==="move");const o=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=o}t.type==="created"?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type==="updated"&&(this.previousEditEvent=t),t.type==="deleted"?this.previousDeletedEvent=t:this.previousDeletedEvent={}},eventCallback:function(){return(e,t,...o)=>{if(e==="annotation"){const a={feature:t,userData:o,eventType:e};this.annotationEventCallback(a,t)}else if(e!=="pan-zoom"){const a=t.label,i=[t.models],r=this.entry,s=this.biologicalSex,l=t.alert;let d;t.taxons&&(typeof t.taxons!="object"?d=JSON.parse(t.taxons):d=t.taxons);let c=[{dataset:t.dataset,biologicalSex:s,taxonomy:r,resource:i,label:a,feature:t,userData:o,eventType:e,provenanceTaxonomy:d,alert:l}];if(e==="click"){const f=Object.keys(t).includes("id");if(!f){c=[];const p=t.mapUUID,g=new Set;for(let[u,m]of Object.entries(t))if(u!=="mapUUID"){const y=m.id,b=m.label,w=[m.models];let T;if(m.taxons&&(typeof m.taxons!="object"?T=JSON.parse(m.taxons):T=m.taxons),g.has(y))continue;g.add(y),c.push({dataset:m.dataset,biologicalSex:s,taxonomy:r,resource:w,label:b,feature:m,userData:o,eventType:e,provenanceTaxonomy:T,alert:m.alert,mapUUID:p})}}const h=f?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,h),this.viewingMode!=="Neuron Connection"){if(this.currentActive=h.models?h.models:"",this.activeDrawTool&&!this.isValidDrawnCreated){const p=h.featureId||this.existDrawnFeatures.find(g=>g.id===h.id);if(this.activeDrawTool==="LineString"&&p){const g=h.featureId?h.featureId:h.id,u=h.label?h.label:`Feature ${h.id}`;this.connectionEntry[` ${g}`]=Object.assign({label:u},Object.fromEntries(Object.entries(h).filter(([m])=>["featureId","models"].includes(m)).map(([m,y])=>[m==="featureId"?"id":m,y])))}}}}else e==="mouseenter"&&this.viewingMode!=="Neuron Connection"&&(this.currentHover=t.models?t.models:"");t&&t.type!=="marker"&&e==="click"&&!this.activeDrawTool&&this.checkAndCreatePopups(c),this.$emit("resource-selected",c)}else this.$emit("pan-zoom-callback",t)}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=t.source,(e==="Neuron Connection"||e==="Annotation")&&(this.connectivityDataSource=t.featureId)},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(".flatmap-tooltip-popup").forEach(t=>t.remove())},createTooltipForConnectivity:function(e,t){const o=document.createElement("div");o.classList.add("flatmap-feature-label"),e.forEach((a,i)=>{const{label:r}=a;if(o.append(la(r)),i+1<e.length){const s=document.createElement("hr");o.appendChild(s)}}),this.mapImp.showPopup(t,o,{className:"custom-popup flatmap-tooltip-popup",positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){const{connectivityInfo:t,data:o}=e,a=[],i=[],r=[],s=[];if(t&&t.featureId&&a.push(...t.featureId),this.mapImp){if(o.forEach(p=>{const g=this.mapImp.search(p.id);if(g!=null&&g.results.length){const u=g==null?void 0:g.results[0].featureId;r.push({featureId:u,...p})}else s.push(p)}),r.length){let p=r[0].featureId;this.mapImp.annotations.forEach(g=>{const u=g["anatomical-nodes"];if(u){const m=u.join("");r.every(b=>m.indexOf(b.id)!==-1)&&(p=g.featureId,i.push(p))}}),this.createTooltipForConnectivity(r,p)}else this.removeActiveTooltips();this.emitConnectivityError(s);const l=a.reduce((p,g)=>{const u=this.mapImp.pathways.paths[g],m=u?u.connectivity:null;if(m){const y=m.flat(1/0);p.push(...y)}return p},[]),d=[...new Set(l)],c=[...a,...d],h=[...this.mapImp.modelFeatureIdList(c),...i];this.mapImp.selectGeoJSONFeatures(h)}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(t=>{this.mapImp.selectFeatures(t)})},searchConnectivitiesByReference:async function(e){const t=sessionStorage.getItem("flatmap-knowledge");let o=[];return t?o=await wy(e):o=await Cy(this.mapImp,e,this.flatmapQueries),o},getFlatmapKnowledge:function(){let e=[];const t=sessionStorage.getItem("flatmap-knowledge");return t&&(e=JSON.parse(t)),e},emitConnectivityError:function(e){this.$emit("connectivity-error",{data:{errorData:e,errorMessage:My}})},checkConnectivityTooltipEntry:function(e){return e!=null&&e.length?e.find(t=>{var o,a;return((o=t==null?void 0:t.destinations)==null?void 0:o.length)||((a=t==null?void 0:t.components)==null?void 0:a.length)})!==void 0:!1},changeConnectivitySource:async function(e){const{entry:t,connectivitySource:o}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],o),this.tooltipEntry=this.tooltipEntry.map(a=>a.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(a):a),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry))},checkAndCreatePopups:async function(e,t){var o;if(this.viewingMode==="Annotation"){const a=e.filter(i=>i.feature).map(i=>i.feature);if(a.length>0)if(this.annotationSidebar&&this.previousDeletedEvent.type==="deleted"&&(this.annotationEntry=[{...this.previousDeletedEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.annotationEntry=[],a.forEach(i=>{var r;this.annotationEntry.push({...i,resourceId:this.serverURL,featureId:i.featureId?i.featureId:(r=i.feature)==null?void 0:r.id,offline:this.offlineAnnotationEnabled})}),a[0].feature)this.activeDrawTool||this.activeDrawMode||this.isValidDrawnCreated?(this.featureAnnotationSubmitted=!1,this.activeDrawTool&&this.createConnectivityBody(),this.displayTooltip(a[0].feature.id,By(a[0].feature.geometry))):this.rollbackAnnotationEvent();else{const i=this.annotationEntry.filter(r=>r.featureId&&r.models).map(r=>r.models);i.length>0&&this.displayTooltip(i)}else this.annotation={}}else if(this.viewingMode==="Neuron Connection"&&!t){const a=e.map(r=>r.resource[0]);if(a.find(r=>!r.startsWith("ilxtr:"))){const r=Array.isArray(a)?[...a]:[a];r.length===1&&r.push([]);const s=(o=e[0].feature)==null?void 0:o.featureId,l=this.mapImp.annotations.get(s),d=l==null?void 0:l["anatomical-nodes"];let c,f=r;const h=l==null?void 0:l.models;d!=null&&d.length&&(c=d[d.length-1]),c?f=JSON.parse(c):h&&(f=[h,[]]);const p=f.flat(1/0),g=[...new Set(p)],m=(await Re.fetchLabels(this.flatmapAPI,g)).reduce((S,v)=>{const E=v[0],I=JSON.parse(v[1]);return I.source===this.mapImp.knowledgeSource&&S.push({id:E,label:I.label}),S},[]),y=[];for(let S=0;S<g.length;S++){const v=m.find(E=>E.id===g[S]);v&&y.push(v.label)}const b=la(y.join(", ")),w={facet:JSON.stringify(f),facetPropPath:`flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,tagLabel:b,term:this.connectionType};if(this.connectivityFilters.some(S=>S.facet===w.facet&&S.facetPropPath===w.facetPropPath)||this.connectivityFilters.push(w),this.connectionType.toLowerCase()==="all"){const S=g.join();this.$emit("neuron-connection-feature-click",{filters:[],search:S})}else this.$emit("neuron-connection-feature-click",{filters:this.connectivityFilters,search:""})}else{const r=a.join();this.connectionType.toLowerCase()==="all"&&this.$emit("neuron-connection-feature-click",{filters:[],search:r})}}else{Sy(this.mapImp,this.flatmapQueries);let a=[];if(this.tooltipEntry=e.filter(i=>i.resource[0]in this.mapImp.pathways.paths).map(i=>({title:i.label,featureId:i.resource,ready:!1})),this.tooltipEntry.length){this.$emit("connectivity-info-open",this.tooltipEntry);for(let r=0;r<e.length;r++)a.push(await this.getKnowledgeTooltip(e[r]));this.tooltipEntry=await Promise.all(a);const i=this.tooltipEntry.map(r=>r.featureId[0]);i.length>0&&this.displayTooltip(i)}}},updateConnectivityFilters:function(e){e.length&&(this.connectivityFilters=e.filter(t=>t.facet.toLowerCase()!=="show all"))},resetConnectivityfilters:function(e){e.length?this.connectivityFilters=this.connectivityFilters.filter(t=>e.some(o=>o.facetPropPath===t.facetPropPath&&o.facet!==t.facet)):this.connectivityFilters=[]},getKnowledgeTooltip:async function(e){const t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e);let o=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(o.featuresAlert=e.alert,o.knowledgeSource=sa(this.mapImp),o.mapId=this.mapImp.provenance.id,o.mapuuid=this.mapImp.provenance.uuid),o.ready=!0,o},popUpCssHacks:function(){const e=document.querySelector(".flatmap-tooltip-popup"),t=document.querySelector(".maplibregl-popup-close-button");e&&(e.style.display="none"),t.style.display="block",this.$refs.tooltip.$el.style.display="flex",t.onclick=()=>{this.$emit("connectivity-info-close"),e&&(e.style.display="block")}},closeTooltip:function(){this.$refs.tooltip&&(this.$refs.tooltip.$el.style.display="none"),document.querySelectorAll(".maplibregl-popup").forEach(e=>{e.style.display="none"})},showPopup:function(e,t,o){let a=o;this.mapImp&&(a?a.className||(a.className="custom-popup"):a={className:"custom-popup",positionAtLastClick:!0},this.mapImp.showPopup(e,t,a))},showMarkerPopup:function(e,t,o){this.mapImp&&this.mapImp.showMarkerPopup(e,t,o)},closeMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");this.minimapSmall?(e.classList.add("enlarge"),e.classList.remove("shrink")):(e.classList.add("shrink"),e.classList.remove("enlarge")),this.minimapSmall=!this.minimapSmall},addResizeButtonToMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");e&&(this.$refs.minimapResize&&this.$refs.minimapResize.$el.parentNode&&this.$refs.minimapResize.$el.parentNode.removeChild(this.$refs.minimapResize.$el),e.appendChild(this.$refs.minimapResize.$el),this.minimapResizeShow=!0)},setHelpMode:function(e){const t=this.hoverVisibilities.length,o=t-1,a=this.hoverVisibilities[this.helpModeActiveIndex];if(a){const i=a==null?void 0:a.refs,r=a==null?void 0:a.ref,s=this.$refs[i||r];if(s){const{parentElement:l,nextElementSibling:d}=s.$el,c=f=>f&&(f.classList.contains("pathway-container")||f.classList.contains("pathway-location"));(c(l)||c(d))&&(this.requiresDrawer?this.drawerOpen=!0:this.helpModeActiveIndex+=1)}else this.helpModeActiveIndex+=1}e||(this.helpModeActiveIndex=this.helpModeInitialIndex),this.viewingMode!=="Annotation"&&this.helpModeActiveIndex>9&&(this.helpModeActiveIndex=o),e&&this.helpModeActiveIndex>=o&&this.$emit("help-mode-last-item",!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(i=>{i.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1?(this.closeFlatmapHelpPopup(),setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.showTooltip(this.helpModeActiveIndex,200)},300)):this.helpModeActiveIndex===-1&&this.openFlatmapHelpPopup():(this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.closeFlatmapHelpPopup())},showTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!0,this.$emit("shown-tooltip")},t))},hideTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!1},t))},displayTooltip:function(e,t=void 0){let o,a={className:"flatmapvuer-popover"};if(t)o=e,a.annotationFeatureGeometry=t;else{const i=Array.isArray(e)?e[0]:e;i&&(o=this.mapImp.modelFeatureIds(i)[0]),this.activeDrawTool||(a.positionAtLastClick=!0)}this.connectivityInfoSidebar&&this.tooltipEntry.length&&this.viewingMode!=="Annotation"&&this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry),this.annotationSidebar&&this.viewingMode==="Annotation"&&this.$emit("annotation-open",{annotationEntry:this.annotationEntry,commitCallback:this.commitAnnotationEvent}),o&&!this.disableUI&&(this.viewingMode==="Annotation"&&!this.annotationSidebar||this.viewingMode==="Exploration"&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(o,this.$refs.tooltip.$el,a),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){const{offsetX:o=0,offsetY:a=0,zoom:i=4}=t,r=this.mapImp.map,s=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),s!=null&&s.length&&setTimeout(()=>{r.fitBounds(s,{offset:[o,a],zoom:i,animate:!0})})}},openFlatmapHelpPopup:function(){if(this.mapImp){let e=this.mapImp.modelFeatureIds("UBERON:0000948");e&&e.length>0&&(this.mapImp.showPopup(e[0],"Click for more information",{anchor:"top",className:"flatmap-popup-popper"}),this.$emit("shown-map-tooltip"))}},closeFlatmapHelpPopup:function(){this.$el.querySelectorAll(".maplibregl-popup-close-button").forEach(e=>{e.click()})},getLabels:function(){let e=[];if(this.mapImp){let t=this.mapImp.annotations;for(let o of t.values())o.label&&e.push(o.label);return Array.from(new Set(e))}},getVisibilityState:function(e){if(["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{let a=this.$refs[o];a&&(e[o]=a.getState())}),this.$refs.treeControls){const o=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();e.systemsSelection=o.filter(a=>!a.includes("."))}},setVisibilityState:function(e){["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{const a=e[o];if(a){const i=this.$refs[o];i&&i.setState(a)}}),"systemsSelection"in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(o=>{this.mapImp.enableSystem(o.key,e.systemsSelection.includes(o.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()};const t=this.mapImp.getIdentifier();return this.biologicalSex?e.biologicalSex=this.biologicalSex:t&&t.biologicalSex&&(e.biologicalSex=t.biologicalSex),t&&t.uuid&&(e.uuid=t.uuid),e.viewingMode=this.viewingMode,e.searchTerm=this.searchTerm,e.flightPath3D=this.flightPath3DRadio,e.colour=this.colourRadio,e.outlines=this.outlinesRadio,e.background=this.currentBackground,this.offlineAnnotationEnabled&&(e.offlineAnnotations=sessionStorage.getItem("anonymous-annotation")),this.getVisibilityState(e),e}},setState:function(e){e&&(this.mapImp&&e.entry&&this.entry==e.entry&&(!e.biologicalSex||e.biologicalSex===this.biologicalSex)?this.restoreMapState(e):this.createFlatmap(e),this.setStateRequired=!1)},restoreMapState:function(e){if(e){if(e.viewport&&this.mapImp.setState(e.viewport),e.offlineAnnotations&&sessionStorage.setItem("anonymous-annotation",e.offlineAnnotations),e.viewingMode&&this.changeViewingMode(e.viewingMode),"flightPath3D"in e&&this.setFlightPath3D(e.flightPath3D),"colour"in e&&this.setColour(e.colour),"outlines"in e&&this.setOutlines(e.outlines),e.background&&this.backgroundChangeCallback(e.background),e.searchTerm){const t=e.searchTerm;this.searchAndShowResult(t,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){(e===1.6||e>1.6)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0;let t=!1;this.displayMinimap&&(t={position:"top-right"});let o={taxon:this.entry};this.uuid&&(o.uuid=this.uuid),e?(e.uuid?o={uuid:e.uuid}:e.entry&&(o.taxon=e.entry),e.biologicalSex?o.biologicalSex=e.biologicalSex:o.taxon==="NCBITaxon:9606"&&(o.biologicalSex="PATO:0000384")):this.biologicalSex&&(o.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(o,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:t,container:this.$refs.display}).then(i=>{this.mapImp=i,this.serverURL=this.mapImp.makeServerUrl("").slice(0,-1);let r=this.mapImp.details.version;this.setFlightPathInfo(r);const s=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(s),this.$nextTick(()=>this.restoreMapState(s))})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){const e=this.$refs.display;if(e){const t=getComputedStyle(e),o=parseInt(t.paddingTop)+parseInt(t.paddingBottom),a=e.clientHeight-o;this.pathwaysMaxHeight=a-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&(this.mapImp.resize(),this.showMinimap(this.displayMinimap))}catch{console.error("Map resize error")}},getFilterSources:function(){const e=["kind","taxons"];let t=new Set,o=new Set,a=new Map;for(const r of this.mapImp.annotations.values())if(r.source){"alert"in r?t.add(r.source):o.add(r.source);for(const[s,l]of Object.entries(r))if(e.includes(s)){a.has(s)||a.set(s,new Map);const d=a.get(s),c=f=>{const h=f;d.has(h)||d.set(h,new Set),d.get(h).add(`${r.source}`)};Array.isArray(l)?l.forEach(c):c(l)}}let i={alert:{with:[...t],without:[...o]}};for(const[r,s]of a.entries()){i[r]={};for(const[l,d]of s.entries())i[r][l]=[...d.values()]}return i},getFilterOptions:async function(e){let t=[];if(this.mapImp){const o=this.mapImp.featureFilterRanges();for(const[p,g]of Object.entries(o)){let u={key:`flatmap.connectivity.${p}`,label:"",children:[]},m=[];if(p==="kind"){u.label="Pathways";for(const y of g){const b=this.pathways.find(w=>w.type===y);b&&m.push({key:`${u.key}.${y}`,label:b.label,colour:b.colour,colourStyle:"line",dashed:b.dashed})}}else if(p==="taxons"){u.label="Studied in";const y=await qn(this.mapImp,this.mapImp.taxonIdentifiers);if(y.length)for(const b of g){const w=y.find(T=>T.taxon===b);w&&m.push({key:`${u.key}.${b}`,label:`${w.label} `})}}else if(p==="alert"){u.label="Alert";for(const y of["with","without"])m.push({key:`${u.key}.${y}`,label:`${y} alerts`})}u.children=m.sort((y,b)=>y.label.localeCompare(b.label)),u.label&&u.children.length&&t.push(u)}const a=[],i=e||this.getFlatmapKnowledge(),r=this.mapImp.pathways.paths,s=i.reduce((p,g)=>{const u=g.id;if(u){const m=r[u];if(m){const y=m.connectivity,b=m["node-phenotypes"];g.connectivity=[...y];for(let w in g["node-phenotypes"])b[w]&&(g["node-phenotypes"][w]=[...b[w]]);p.push(JSON.parse(JSON.stringify(g)))}}return p},[]),l=this.mapImp.knowledgeSource,d=await Re.extractOriginItems(this.flatmapAPI,l,s),c=await Re.extractViaItems(this.flatmapAPI,l,s),f=await Re.extractDestinationItems(this.flatmapAPI,l,s),h=(p,g)=>{const u=JSON.stringify(g.key);return{key:`flatmap.connectivity.source.${p}.${u}`,label:g.label||u}};for(const p of["origin","via","destination"]){let g=[];p==="origin"?g=d.map(u=>h(p,u)):p==="via"?g=c.map(u=>h(p,u)):p==="destination"&&(g=f.map(u=>h(p,u))),g=g.sort((u,m)=>{const y=T=>/^[a-zA-Z]/.test(T),b=y(u.label),w=y(m.label);return b&&!w?-1:!b&&w?1:u.label.localeCompare(m.label)}),a.push({key:`flatmap.connectivity.source.${p}`,label:p,children:g})}t.push(...a)}return t},onFlatmapReady:function(e){var t;this.sensor=n.markRaw(new Ty(this.$refs.display,this.mapResize)),((t=this.mapImp.options)==null?void 0:t.style)==="functional"&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.pathways=this.pathways.filter(o=>o.enabled&&o.type!=="other"),this.processSystems(this.mapImp.getSystems()),this.processTaxon(this.mapImp.taxonIdentifiers,e?e.taxonSelection:void 0),this.containsAlert="alert"in this.mapImp.featureFilterRanges(),this.flatmapLegends=this.mapImp.flatmapLegend,this.addResizeButtonToMinimap(),this.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.$emit("ready",this)},handleMapClick:function(){const e=this.mapImp.map;e&&e.on("click",t=>{this.connectivityDataSource||this.$emit("connectivity-info-close"),this.connectivityDataSource=""})},showMinimap:function(e){this.mapImp&&this.mapImp.showMinimap(e)},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t,o){var a;if(this.mapImp){if(e===void 0||e==="")return this.mapImp.clearSearchResults(),this.viewingMode==="Exploration"?this.$emit("connectivity-info-close"):this.viewingMode==="Annotation"&&this.manualAbortedOnClose(),this.searchTerm="",!0;{const i=this.mapImp.search(e);if((a=i==null?void 0:i.results)!=null&&a.length){if(this.mapImp.showSearchResults(i),t){let r;for(let s=0;s<i.results.length;s++){r=i.results[s].featureId;const l=this.mapImp.annotation(r);if(r&&(l!=null&&l.label))break}if(r){const s=this.mapImp.featureProperties(r),l={resource:[s.models],feature:s,label:s.label,provenanceTaxonomy:s.taxons,alert:s.alert};this.checkAndCreatePopups([l],o),this.mapImp.showPopup(r,la(s.label),{className:"custom-popup",positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}else this.mapImp.clearSearchResults()}}return!1},highlightConnectedPaths:function(e){if(e.length){const t=e.filter(a=>a in this.mapImp.pathways.paths),o=this.mapImp.modelFeatureIdList(t);this.mapImp.selectGeoJSONFeatures(o)}},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){ca.emit("onActionClick",e)},setConnectionType:function(e){this.connectionType=e}},props:{entry:{type:String,required:!0},uuid:String,biologicalSex:{type:String,default:""},minZoom:{type:Number,default:1},tooltips:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},helpModeInitialIndex:{type:Number,default:0},renderAtMounted:{type:Boolean,default:!0},displayMinimap:{type:Boolean,default:!1},displayWarning:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array,default:function(){return[{display:"Open AC Map",key:"AC"},{display:"Open FC Map",key:"FC"},{display:"Open 3D Human Map",key:"3D"}]}},showStarInLegend:{type:Boolean,default:!1},isLegacy:{type:Boolean,default:!1},displayLatestChanges:{type:Boolean,default:!1},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken}},data:function(){return{sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:n.markRaw({}),sckanDisplay:[{label:"Display Path with SCKAN",key:"VALID"}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipWait:n.markRaw([]),hoverVisibilities:[{value:!1,ref:"markerPopover"},{value:!1,ref:"zoomInPopover"},{value:!1,ref:"zoomOutPopover"},{value:!1,ref:"zoomFitPopover"},{value:!1,ref:"openMapPopover"},{value:!1,ref:"settingsPopover"},{value:!1,ref:"checkBoxPopover"},{value:!1,ref:"warningPopover"},{value:!1,ref:"whatsNewPopover"},{value:!1,ref:"featuredMarkerPopover"},{value:!1,refs:"toolbarPopover",ref:"editPopover"},{value:!1,refs:"toolbarPopover",ref:"deletePopover"},{value:!1,refs:"toolbarPopover",ref:"pointPopover"},{value:!1,refs:"toolbarPopover",ref:"lineStringPopover"},{value:!1,refs:"toolbarPopover",ref:"polygonPopover"},{value:!1,refs:"toolbarPopover",ref:"connectionPopover"}],helpModeActiveIndex:this.helpModeInitialIndex,yellowstar:us,isFC:!1,inHelp:!1,currentBackground:"white",availableBackground:["white","lightskyblue","black"],loading:!1,flatmapMarker:yy,tooltipEntry:[],connectivityDataSource:"",connectivityTooltipVisible:!1,drawerOpen:!1,flightPath3DRadio:!1,displayFlightPathOption:!1,colourRadio:!0,outlinesRadio:!0,minimapResizeShow:!1,minimapSmall:!1,currentActive:"",selectedDrawnFeature:void 0,currentHover:"",viewingMode:"Exploration",viewingModes:{Exploration:"Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources","Neuron Connection":"Discover Neuron connections by selecting a neuron and viewing its associated network connections",Annotation:["View feature annotations","Add, comment on and view feature annotations"]},connectionType:"All",offlineAnnotationEnabled:!1,offlineAnnotations:[],annotationFrom:"Anyone",annotatedSource:["Anyone","Me","Others"],openMapRef:void 0,backgroundIconRef:void 0,toolbarOptions:["Edit","Delete","Point","LineString","Polygon","Connection"],annotator:void 0,authorisedUser:void 0,activeDrawMode:void 0,activeDrawTool:void 0,featureAnnotationSubmitted:!1,drawnCreatedEvent:{},previousEditEvent:{},previousDeletedEvent:{},connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:"Display Path With Alerts",key:"alert",enabled:!0},{label:"Display Path Without Alerts",key:"withoutAlert",enabled:!0}],mapFilters:n.markRaw({alert:{with:!0,without:!0}}),searchTerm:"",taxonLeaveDelay:void 0,connectivityFilters:[],flatmapLegends:[]}},computed:{...ga.mapState(Ay,["userToken"]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){var e,t,o;if(this.loading)return this.drawerOpen=!1,!1;if(this.isFC){if(((e=this.systems)==null?void 0:e.length)>0||this.containsAlert&&this.alertOptions||((t=this.pathways)==null?void 0:t.length)>0||((o=this.taxonConnectivity)==null?void 0:o.length)>0)return this.drawerOpen=!0,!0}else return this.drawerOpen=!0,!0;return this.drawerOpen=!1,!0},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode==="Annotation"?this.authorisedUser?e[1]:e[0]:e}},watch:{entry:function(){this.state||this.createFlatmap()},helpMode:function(e,t){e!==t&&this.setHelpMode(e)},helpModeActiveItem:function(){this.helpMode&&(this.helpModeActiveIndex+=1,this.setHelpMode(this.helpMode))},state:{handler:function(e,t){e!==t&&(this.mapManagerRef?this.setState(e):this.setStateRequired=!0)},immediate:!0,deep:!0},viewingMode:function(e){this.clearAnnotationFeature(),e==="Annotation"&&(this.loading=!0,this.annotator.authenticate(this.userToken).then(t=>{t.name&&t.email&&t.canUpdate?(this.authorisedUser=t,this.offlineAnnotationEnabled=!1):(this.authorisedUser=void 0,this.offlineAnnotationEnabled=!0),this.emitOfflineAnnotationUpdate(),this.setFeatureAnnotated(),this.addAnnotationFeature(),this.loading=!1}))},disableUI:function(e){e&&this.closeTooltip()},activeDrawTool:function(e){let t=[],o={x:null,y:null};const a=this.$el.querySelector(".maplibregl-canvas"),i=()=>{a.removeEventListener("keydown",r),a.removeEventListener("click",s)},r=l=>{if(!["Escape","Enter"].includes(l.key))return;const d=e==="Point"&&t.length===1||e==="LineString"&&t.length>=2||e==="Polygon"&&t.length>=3;(l.key==="Escape"||l.key==="Enter"&&!d)&&(this.activeDrawTool=void 0),i()},s=l=>{const d=a.getBoundingClientRect(),c=l.clientX-d.left,f=l.clientY-d.top;if(Math.sqrt((c-o.x)**2+(f-o.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}o={x:c,y:f},t.push(o)};e&&(i(),a.addEventListener("keydown",r),a.addEventListener("click",s))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ya.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef))},mounted:function(){this.openMapRef=n.shallowRef(this.$refs.openMapRef),this.backgroundIconRef=n.shallowRef(this.$refs.backgroundIconRef),this.tooltipWait.length=this.hoverVisibilities.length,this.flatmapQueries=n.markRaw(new by),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),ps()}},Ny={class:"flatmap-container",ref:"flatmapContainer","element-loading-text":"Loading...","element-loading-background":"rgba(0, 0, 0, 0.3)"},_y={style:{height:"100%",width:"100%",position:"relative","overflow-y":"none"}},Py={style:{height:"100%",width:"100%"},ref:"display"},Vy={class:"beta-popovers"},Ly={key:2,class:"warning-text"},Ry={class:"bottom-right-control"},Fy=["innerHTML"],Dy={style:{"margin-bottom":"2px"}},$y={key:0,class:"viewing-mode-title"},zy=["onClick"],jy=["onClick"];function Hy(e,t,o,a,i,r){const s=n.resolveComponent("map-svg-sprite-color"),l=K.WarningFilled,d=ke,c=Kn,f=K.ArrowDown,h=n.resolveComponent("DrawToolbar"),p=n.resolveComponent("map-svg-icon"),g=fy,u=n.resolveComponent("tree-controls"),m=fs,y=K.ArrowLeft,b=Fr,w=Xt,T=en,S=na,v=Hn,E=Xr,I=es,M=n.resolveComponent("Tooltip"),B=ls,x=aa;return n.withDirectives((n.openBlock(),n.createElementBlock("div",Ny,[n.createVNode(s),n.createElementVNode("div",_y,[n.createElementVNode("div",Py,null,512),n.withDirectives(n.createElementVNode("div",Vy,[n.createElementVNode("div",null,[n.createVNode(c,{placement:"right","popper-class":"warning-popper flatmap-popper",teleported:!1,visible:e.hoverVisibilities[7].value,ref:"warningPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"warning-icon",onMouseover:t[7]||(t[7]=k=>r.showTooltip(7)),onMouseout:t[8]||(t[8]=k=>r.hideTooltip(7))},[o.displayWarning||o.isLegacy?(n.openBlock(),n.createBlock(d,{key:0},{default:n.withCtx(()=>[n.createVNode(l)]),_:1})):n.createCommentVNode("",!0),o.isLegacy?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t[31]||(t[31]=n.createElementVNode("span",{class:"warning-text"},"Legacy Map",-1)),n.createElementVNode("div",{class:"latest-map-text",onClick:t[6]||(t[6]=(...k)=>r.viewLatestMap&&r.viewLatestMap(...k))}," Click here for the latest map ")],64)):o.displayWarning?(n.openBlock(),n.createElementBlock("span",Ly,"Beta")):n.createCommentVNode("",!0)],32)]),default:n.withCtx(()=>[o.isLegacy?(n.openBlock(),n.createElementBlock("p",{key:0,onMouseover:t[0]||(t[0]=k=>r.showTooltip(7)),onMouseout:t[1]||(t[1]=k=>r.hideTooltip(7))}," This is a legacy map, you may view the latest map instead. ",32)):e.isFC?(n.openBlock(),n.createElementBlock("p",{key:1,onMouseover:t[2]||(t[2]=k=>r.showTooltip(7)),onMouseout:t[3]||(t[3]=k=>r.hideTooltip(7))},t[29]||(t[29]=[n.createTextVNode(" This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". ")]),32)):(n.openBlock(),n.createElementBlock("p",{key:2,onMouseover:t[4]||(t[4]=k=>r.showTooltip(7)),onMouseout:t[5]||(t[5]=k=>r.hideTooltip(7))},t[30]||(t[30]=[n.createTextVNode(" This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". New connectivity and species specificity will be added as the SPARC program progresses. ")]),32))]),_:1},8,["visible"])]),o.displayLatestChanges?(n.openBlock(),n.createBlock(c,{key:0,placement:"right",teleported:!1,trigger:"manual","popper-class":"warning-popper flatmap-popper",visible:e.hoverVisibilities[8].value,ref:"whatsNewPopover"},{reference:n.withCtx(()=>[o.displayLatestChanges?(n.openBlock(),n.createElementBlock("div",{key:0,class:"latest-changesicon",onMouseover:t[9]||(t[9]=k=>r.showTooltip(8)),onMouseout:t[10]||(t[10]=k=>r.hideTooltip(8))},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(l)]),_:1}),t[32]||(t[32]=n.createElementVNode("span",{class:"warning-text"},"What's new?",-1))],32)):n.createCommentVNode("",!0)]),default:n.withCtx(()=>t[33]||(t[33]=[n.createElementVNode("b",null,"Connectivity References",-1),n.createElementVNode("p",null," Connectivity references have been improved and available in various formats. ",-1),n.createElementVNode("b",null,"Improved state storing",-1),n.createElementVNode("p",null," Current selection and visibility filters are now stored when creating a permalink. ",-1)])),_:1},8,["visible"])):n.createCommentVNode("",!0)],512),[[n.vShow,!o.disableUI]]),n.withDirectives(n.createVNode(d,{class:n.normalizeClass(["minimap-resize",{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:"minimapResize",onClick:r.closeMinimap},{default:n.withCtx(()=>[n.createVNode(f)]),_:1},8,["class","onClick"]),[[n.vShow,e.minimapResizeShow]]),e.viewingMode==="Annotation"&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!o.disableUI?(n.openBlock(),n.createBlock(h,{key:0,mapCanvas:{containerHTML:this.$el,class:".maplibregl-canvas"},toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,newlyDrawnEntry:e.drawnCreatedEvent,connectionEntry:e.connectionEntry,hoverVisibilities:e.hoverVisibilities,onClickToolbar:r.toolbarEvent,onFeatureTooltip:r.connectedFeatureTooltip,onConfirmDrawn:r.confirmDrawnFeature,onCancelDrawn:r.cancelDrawnFeature,onShowTooltip:r.showTooltip,onHideTooltip:r.hideTooltip,ref:"toolbarPopover"},null,8,["mapCanvas","toolbarOptions","activeDrawTool","activeDrawMode","newlyDrawnEntry","connectionEntry","hoverVisibilities","onClickToolbar","onFeatureTooltip","onConfirmDrawn","onCancelDrawn","onShowTooltip","onHideTooltip"])):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",Ry,[n.createVNode(c,{content:"Zoom in",placement:"left",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[1].value,ref:"zoomInPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[11]||(t[11]=k=>r.zoomIn()),onMouseover:t[12]||(t[12]=k=>r.showTooltip(1)),onMouseout:t[13]||(t[13]=k=>r.hideTooltip(1))},[n.createVNode(p,{class:"icon-button zoomIn",icon:"zoomIn"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Zoom out",placement:"top-end",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[2].value,ref:"zoomOutPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[14]||(t[14]=k=>r.zoomOut()),onMouseover:t[15]||(t[15]=k=>r.showTooltip(2)),onMouseout:t[16]||(t[16]=k=>r.hideTooltip(2))},[n.createVNode(p,{class:"icon-button zoomOut",icon:"zoomOut"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Reset",placement:"top",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[3].value,ref:"zoomFitPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[17]||(t[17]=k=>r.resetView()),onMouseover:t[18]||(t[18]=k=>r.showTooltip(3)),onMouseout:t[19]||(t[19]=k=>r.hideTooltip(3))},[n.createVNode(p,{class:"icon-button fitWindow",icon:"fitWindow"})],32)]),default:n.withCtx(()=>[t[34]||(t[34]=n.createElementVNode("div",null,[n.createTextVNode(" Fit to "),n.createElementVNode("br"),n.createTextVNode(" window ")],-1))]),_:1},8,["visible"])],512),[[n.vShow,!o.disableUI]]),n.createVNode(c,{content:"Change pathway visibility",placement:"right",teleported:!1,trigger:"manual",offset:-18,"popper-class":"flatmap-popper",visible:e.hoverVisibilities[6].value,ref:"checkBoxPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["pathway-location",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["pathway-container",{open:e.drawerOpen,close:!e.drawerOpen}]),style:n.normalizeStyle({"max-height":e.pathwaysMaxHeight+"px"})},[e.isFC?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(g,{key:0,identifierKey:"prompt",colourKey:"colour",styleKey:"style",legends:e.flatmapLegends,showStarInLegend:o.showStarInLegend,class:"svg-legends-container"},null,8,["legends","showStarInLegend"])),n.createVNode(c,{content:"Find these markers for data. The number inside the markers is the number of datasets available for each marker.",placement:"right",teleported:!1,width:"200",trigger:"manual","popper-class":"flatmap-popper flatmap-marker-popper",visible:e.hoverVisibilities[0].value,ref:"markerPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:"flatmap-marker-help",innerHTML:e.flatmapMarker},null,8,Fy),[[n.vShow,e.hoverVisibilities[0].value],[B,void 0,"markerPopover"]])]),_:1},8,["visible"]),e.isFC&&e.systems&&e.systems.length>0?(n.openBlock(),n.createBlock(u,{key:1,class:"treeControls",mapType:"flatmap",title:"Systems",treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:r.systemSelected,onCheckAll:r.checkAllSystems,onChangeActive:r.ftuSelected,ref:"treeControls"},null,8,["treeData","active","hover","onCheckChanged","onCheckAll","onChangeActive"])):n.createCommentVNode("",!0),e.containsAlert&&e.alertOptions&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Alert",labelKey:"label",identifierKey:"key",selections:e.alertOptions,onChanged:r.alertSelected,onCheckboxMouseEnter:r.alertMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllAlerts,ref:"alertSelection",key:"alertSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.pathways&&e.pathways.length>0?(n.openBlock(),n.createBlock(m,{title:"Pathways",labelKey:"label",identifierKey:"type",colourStyle:"line",selections:e.pathways,showAsLegend:!o.showPathwayFilter,onChanged:r.pathwaysSelected,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllPathways,ref:"pathwaysSelection",key:"pathwaysSelection"},null,8,["selections","showAsLegend","onChanged","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Studied in",labelKey:"label",identifierKey:"taxon",helpMessage:"Evidence exists that this set of neuron populations have been studied in the given species.",selections:e.taxonConnectivity,onChanged:r.taxonsSelected,onCheckboxMouseEnter:r.taxonMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllTaxons,ref:"taxonSelection",key:"taxonSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0)],6)),[[B,void 0,"checkBoxPopover"]]),n.createElementVNode("div",{onClick:t[20]||(t[20]=(...k)=>r.toggleDrawer&&r.toggleDrawer(...k)),class:n.normalizeClass(["drawer-button",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(y)]),_:1})],2)],2),[[n.vShow,!o.disableUI&&r.requiresDrawer]])]),_:1},8,["visible"]),e.openMapRef?(n.openBlock(),n.createBlock(c,{key:1,ref:"open-map-popover","virtual-ref":e.openMapRef,placement:"top-start",width:"136",teleported:!1,trigger:"click","popper-class":"open-map-popper non-selectable","virtual-triggering":""},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.openMapOptions,k=>(n.openBlock(),n.createBlock(w,{key:k.key},{default:n.withCtx(()=>[n.createVNode(b,{type:"primary",plain:"",onClick:_=>e.$emit("open-map",k.key)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(k.display),1)]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1},8,["virtual-ref"])):n.createCommentVNode("",!0),n.createVNode(c,{ref:"backgroundPopover","virtual-ref":e.backgroundIconRef,placement:"top-start",width:"320",teleported:!1,trigger:"click","popper-class":"background-popper h-auto","virtual-triggering":""},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[35]||(t[35]=[n.createTextVNode("Viewing Mode")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createElementVNode("div",Dy,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.viewingModes,(k,_,V)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:_},[_===e.viewingMode?(n.openBlock(),n.createElementBlock("span",$y,[n.createElementVNode("b",null,n.toDisplayString(_),1)])):(n.openBlock(),n.createElementBlock("span",{key:1,class:"viewing-mode-unselected",onClick:q=>r.changeViewingMode(_)},n.toDisplayString(_),9,zy))],64))),128))]),n.createVNode(w,{class:"viewing-mode-description"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.modeDescription),1)]),_:1}),e.viewingMode==="Annotation"&&e.offlineAnnotationEnabled?(n.openBlock(),n.createBlock(w,{key:0,class:"viewing-mode-description"},{default:n.withCtx(()=>t[36]||(t[36]=[n.createTextVNode(" (Anonymous annotate) ")])),_:1})):n.createCommentVNode("",!0)]),_:1}),e.viewingMode==="Annotation"&&e.authorisedUser?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[37]||(t[37]=[n.createTextVNode("Annotations From")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(v,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":t[21]||(t[21]=k=>e.annotationFrom=k),placeholder:"Select",class:"select-box","popper-class":"flatmap_dropdown",onChange:r.setAnnotationFrom},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.annotatedSource,k=>(n.openBlock(),n.createBlock(S,{key:k,label:k,value:k},{default:n.withCtx(()=>[n.createVNode(w,null,{default:n.withCtx(()=>[n.createVNode(T,{span:12},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(k),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1})],64)):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:1,class:"backgroundSpacer"})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:2,class:"backgroundText"},{default:n.withCtx(()=>t[38]||(t[38]=[n.createTextVNode("Flight path display")])),_:1})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:3,class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":t[22]||(t[22]=k=>e.flightPath3DRadio=k),class:"flatmap-radio",onChange:r.setFlightPath3D},{default:n.withCtx(()=>[n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[39]||(t[39]=[n.createTextVNode("2D")])),_:1}),n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[40]||(t[40]=[n.createTextVNode("3D")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[41]||(t[41]=[n.createTextVNode("Organs display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.colourRadio,"onUpdate:modelValue":t[23]||(t[23]=k=>e.colourRadio=k),class:"flatmap-radio",onChange:r.setColour},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[42]||(t[42]=[n.createTextVNode("Colour")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[43]||(t[43]=[n.createTextVNode("Greyscale")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[44]||(t[44]=[n.createTextVNode("Outlines display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.outlinesRadio,"onUpdate:modelValue":t[24]||(t[24]=k=>e.outlinesRadio=k),class:"flatmap-radio",onChange:r.setOutlines},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[45]||(t[45]=[n.createTextVNode("Show")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[46]||(t[46]=[n.createTextVNode("Hide")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[47]||(t[47]=[n.createTextVNode("Change background")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.availableBackground,k=>(n.openBlock(),n.createElementBlock("div",{key:k,class:n.normalizeClass(["backgroundChoice",k,k==e.currentBackground?"active":""]),onClick:_=>r.backgroundChangeCallback(k)},null,10,jy))),128))]),_:1})])]),_:1},8,["virtual-ref"]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["settings-group",{open:e.drawerOpen,close:!e.drawerOpen}])},[o.showOpenMapButton?(n.openBlock(),n.createBlock(w,{key:0},{default:n.withCtx(()=>[n.createVNode(c,{visible:e.hoverVisibilities[4].value,content:"Open new map",placement:"right",teleported:!1,"popper-class":"flatmap-popper",ref:"openMapPopover"},{reference:n.withCtx(()=>[o.enableOpenMapUI&&o.openMapOptions.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,ref:"openMapRef",class:"icon-button-container",onMouseover:t[25]||(t[25]=k=>r.showTooltip(4)),onMouseout:t[26]||(t[26]=k=>r.hideTooltip(4))},[n.createVNode(p,{icon:"openMap",class:"icon-button open-map-button"})],544)):n.createCommentVNode("",!0)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0),o.showLocalSettings?(n.openBlock(),n.createBlock(w,{key:1},{default:n.withCtx(()=>[n.createVNode(c,{content:"Change settings",placement:"right",visible:e.hoverVisibilities[5].value,teleported:!1,trigger:"manual","popper-class":"flatmap-popper",ref:"settingsPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{ref:"backgroundIconRef",class:"icon-button-container",onMouseover:t[27]||(t[27]=k=>r.showTooltip(5)),onMouseout:t[28]||(t[28]=k=>r.hideTooltip(5))},[n.createVNode(p,{icon:"changeBckgd",class:"icon-button"})],544)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0)],2),[[n.vShow,!o.disableUI]]),e.tooltipDisplay?(n.openBlock(),n.createBlock(M,{key:2,ref:"tooltip",class:"tooltip",annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode==="Annotation",onAnnotation:r.commitAnnotationEvent,onOnActionClick:r.onActionClick},null,8,["annotationEntry","tooltipEntry","annotationDisplay","onAnnotation","onOnActionClick"])):n.createCommentVNode("",!0)])])),[[x,e.loading]])}const da=tn(xy,[["render",Hy],["__scopeId","data-v-d8b9d467"]]),gs={"NCBITaxon:10114":"01fedbf9-d783-509c-a10c-827941ab13da","NCBITaxon:9823":"a336ac04-24db-561f-a25f-1c994fe17410","NCBITaxon:9606":"42ed6323-f645-5fbe-bada-9581819cf689","NCBITaxon:10090":"25285fab-48a0-5620-a6a0-f9a0374837d5","NCBITaxon:9685":"73060497-46a6-52bf-b975-cac511c127cb"},Ky={name:"MultiFlatmapVuer",components:{Col:en,Row:Xt,Option:na,Select:Hn,Popover:Kn,FlatmapVuer:da},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),ca.on("onActionClick",e=>{this.resourceSelected(e)}),ca.on("open-pubmed-url",e=>{this.$emit("open-pubmed-url",e)})},methods:{initialise:function(){return new Promise(e=>{this.requireInitialisation?(this.requireInitialisation=!1,fetch(this.flatmapAPI).then(t=>t.json()).then(t=>{Object.keys(this.availableSpecies).forEach(a=>{const i=this.availableSpecies[a].uuid;if(i&&t.map(r=>r.uuid).indexOf(i)>0)this.speciesList[a]=this.availableSpecies[a];else for(let r=0;r<t.length;r++)if(this.availableSpecies[a].taxo===t[r].taxon)if(this.availableSpecies[a].biologicalSex){if(t[r].biologicalSex&&t[r].biologicalSex===this.availableSpecies[a].biologicalSex){this.speciesList[a]=this.availableSpecies[a];break}}else{this.speciesList[a]=this.availableSpecies[a];break}});let o=this.initial;if(this.state){const a=this.state.state;(!a||!a.uuid&&!a.entry)&&this.state.species?o=this.state.species:o=void 0}o&&(o&&this.speciesList[o]!==void 0?this.activeSpecies=o:this.activeSpecies=Object.keys(this.speciesList)[0],this.setSpecies(this.activeSpecies,this.state?this.state.state:void 0,5)),this.initialised=!0,e(),this.resolveList.forEach(a=>{a()})})):this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ya.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef)))},resourceSelected:function(e){this.$emit("resource-selected",e)},FlatmapReady:function(e){this.$emit("ready",e)},getCurrentFlatmap:function(){return this.$refs[this.activeSpecies][0]},panZoomCallback:function(e){this.$emit("pan-zoom-callback",e)},onAnnotationClose:function(){this.$emit("annotation-close")},onAnnotationOpen:function(e){this.$emit("annotation-open",e)},updateOfflineAnnotationEnabled:function(e){this.$emit("update-offline-annotation-enabled",e)},onConnectivityInfoClose:function(){this.$emit("connectivity-info-close")},onConnectivityInfoOpen:function(e){this.$emit("connectivity-info-open",e)},onConnectivityError:function(e){this.$emit("connectivity-error",e)},onNeuronConnectionFeatureClick:function(e){this.$emit("neuron-connection-feature-click",e)},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},showPopup:function(e,t,o){this.getCurrentFlatmap().showPopup(e,t,o)},showMarkerPopup:function(e,t,o){this.getCurrentFlatmap().showMarkerPopup(e,t,o)},setSpecies:function(e,t,o){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit("flatmapChanged",this.activeSpecies);else if(o){const a=o-1;a>=0&&this.$nextTick(()=>{this.setSpecies(e,t,a)})}},viewLatestMap:function(e){const t=Object.keys(this.speciesList);for(let o=0;o<t.length;o++){const a=this.speciesList[t[o]];if(!a.isLegacy&&a.taxo===e.entry&&a.biologicalSex===e.biologicalSex){this.setSpecies(t[o],e,0);return}}},createLegacyEntry:function(e,t,o){if(o&&t){let a="Legacy";return e.species&&(e.species.slice(0,6)==="Legacy"?a=e.species:a=a+` ${e.species}`),this.speciesList[a]={taxo:t,isLegacy:!0,displayWarning:!0},{species:a,state:{entry:t,uuid:o,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){const o=e.state;if(o.uuid){if(o.entry)return new Promise(()=>{const a={taxon:o.entry};o.biologicalSex&&(a.biologicalSex=o.biologicalSex),this.mapManagerRef.findMap(a).then(i=>{if(i.uuid!==o.uuid)return this.createLegacyEntry(e,o.entry,o.uuid)}).then(i=>{t(i||e)}).catch(()=>{t(e)})})}else if(o.entry){const a=o.entry in gs?gs[o.entry]:void 0,i=this.createLegacyEntry(e,o.entry,a);t(i||e)}}t(e)})},getState:function(){let e={species:this.activeSpecies,state:void 0},t=this.getCurrentFlatmap();return e.state=t.getState(),e},setState:function(e){e&&(this.loadMapManager(),this.updateState(e).then(t=>{this.initialise().then(()=>{t.species&&t.species!==this.activeSpecies?this.setSpecies(t.species,t.state,5):t.state&&this.getCurrentFlatmap().setState(t.state)})}))},activateTooltipByIndex:function(e){return e===this.helpModeActiveItem&&this.helpMode},onHelpModeLastItem:function(e){e&&this.$emit("help-mode-last-item",!0)},onTooltipShown:function(){this.$emit("shown-tooltip")},onMapTooltipShown:function(){this.$emit("shown-map-tooltip")},changeViewingMode:function(e){this.getCurrentFlatmap().changeViewingMode(e)},setConnectionType:function(e){this.getCurrentFlatmap().setConnectionType(e)}},props:{initial:{type:String,default:""},minZoom:{type:Number,default:1},renderAtMounted:{type:Boolean,default:!1},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},displayMinimap:{type:Boolean,default:!1},showStarInLegend:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array},availableSpecies:{type:Object,default:function(){return{"Human Female":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000383",iconClass:"mapicon-icon_human",displayWarning:!0},"Human Male":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000384",iconClass:"mapicon-icon_human",displayWarning:!0},Rat:{taxo:"NCBITaxon:10114",iconClass:"mapicon-icon_rat",displayLatestChanges:!0},Mouse:{taxo:"NCBITaxon:10090",iconClass:"mapicon-icon_mouse",displayWarning:!0},Pig:{taxo:"NCBITaxon:9823",iconClass:"mapicon-icon_pig",displayWarning:!0},Cat:{taxo:"NCBITaxon:9685",iconClass:"mapicon-icon_cat",displayWarning:!0}}}},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},data:function(){return{activeSpecies:void 0,speciesList:{},requireInitialisation:!0,resolveList:n.markRaw([]),initialised:!1,mapManagerRef:void 0}},watch:{state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0}}},Uy={class:"multi-container",ref:"multiContainer"},Wy={key:0,style:{position:"absolute","z-index":"100"}},qy={class:"select-box-icon"};function Gy(e,t,o,a,i,r){const s=na,l=Hn,d=Kn,c=da;return n.openBlock(),n.createElementBlock("div",Uy,[o.disableUI?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",Wy,[t[2]||(t[2]=n.createElementVNode("div",{class:"species-display-text"},"Species",-1)),n.createVNode(d,{content:"Select a species",placement:"right",trigger:"manual","popper-class":"flatmap-popper flatmap-teleport-popper right-popper",width:"max-content",visible:r.activateTooltipByIndex(0),teleported:!1,ref:"selectPopover"},{reference:n.withCtx(()=>[n.createVNode(l,{id:"flatmap-select",teleported:!1,modelValue:e.activeSpecies,"onUpdate:modelValue":t[0]||(t[0]=f=>e.activeSpecies=f),placeholder:"Select",class:"select-box","popper-class":"flatmap-dropdown",onChange:r.setSpecies},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,h)=>(n.openBlock(),n.createBlock(s,{key:h,label:h,value:h},{default:n.withCtx(()=>[n.createElementVNode("span",qy,[n.createElementVNode("i",{class:n.normalizeClass(f.iconClass)},null,2)]),n.createTextVNode(" "+n.toDisplayString(h),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1},8,["visible"])])),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,h)=>n.withDirectives((n.openBlock(),n.createBlock(c,{key:h,entry:f.taxo,uuid:f.uuid,biologicalSex:f.biologicalSex,displayWarning:f.displayWarning,displayLatestChanges:f.displayLatestChanges,isLegacy:f.isLegacy,ref_for:!0,ref:h,enableOpenMapUI:o.enableOpenMapUI,openMapOptions:o.openMapOptions,disableUI:o.disableUI,onViewLatestMap:r.viewLatestMap,onResourceSelected:r.resourceSelected,onReady:r.FlatmapReady,onPanZoomCallback:r.panZoomCallback,annotationSidebar:o.annotationSidebar,onAnnotationOpen:r.onAnnotationOpen,onAnnotationClose:r.onAnnotationClose,onUpdateOfflineAnnotationEnabled:r.updateOfflineAnnotationEnabled,connectivityInfoSidebar:o.connectivityInfoSidebar,onConnectivityInfoOpen:r.onConnectivityInfoOpen,onConnectivityInfoClose:r.onConnectivityInfoClose,onConnectivityError:r.onConnectivityError,onNeuronConnectionFeatureClick:r.onNeuronConnectionFeatureClick,onOpenMap:t[1]||(t[1]=p=>e.$emit("open-map",p)),onPathwaySelectionChanged:r.onSelectionsDataChanged,minZoom:o.minZoom,helpMode:e.activeSpecies==h&&o.helpMode,helpModeActiveItem:o.helpModeActiveItem,helpModeDialog:o.helpModeDialog,helpModeInitialIndex:-2,onHelpModeLastItem:r.onHelpModeLastItem,onShownTooltip:r.onTooltipShown,onShownMapTooltip:r.onMapTooltipShown,renderAtMounted:o.renderAtMounted,displayMinimap:o.displayMinimap,showStarInLegend:o.showStarInLegend,style:{height:"100%"},mapManager:e.mapManagerRef,flatmapAPI:o.flatmapAPI,sparcAPI:o.sparcAPI,showLocalSettings:o.showLocalSettings,showOpenMapButton:o.showOpenMapButton,showPathwayFilter:o.showPathwayFilter},null,8,["entry","uuid","biologicalSex","displayWarning","displayLatestChanges","isLegacy","enableOpenMapUI","openMapOptions","disableUI","onViewLatestMap","onResourceSelected","onReady","onPanZoomCallback","annotationSidebar","onAnnotationOpen","onAnnotationClose","onUpdateOfflineAnnotationEnabled","connectivityInfoSidebar","onConnectivityInfoOpen","onConnectivityInfoClose","onConnectivityError","onNeuronConnectionFeatureClick","onPathwaySelectionChanged","minZoom","helpMode","helpModeActiveItem","helpModeDialog","onHelpModeLastItem","onShownTooltip","onShownMapTooltip","renderAtMounted","displayMinimap","showStarInLegend","mapManager","flatmapAPI","sparcAPI","showLocalSettings","showOpenMapButton","showPathwayFilter"])),[[n.vShow,e.activeSpecies==h]])),128))],512)}const Jy=tn(Ky,[["render",Gy],["__scopeId","data-v-d3a99b3e"]]);H.FlatmapVuer=da,H.MultiFlatmapVuer=Jy,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
|
|
24
|
+
order by source desc`;ps();const i=sessionStorage.getItem("flatmap-knowledge"),r=sessionStorage.getItem("flatmap-knowledge-source");if(!i||r!==o){const d=(await t.flatmapQuery(a)).values.map(c=>c[0]).map(c=>JSON.parse(c));return sessionStorage.setItem("flatmap-knowledge",JSON.stringify(d)),sessionStorage.setItem("flatmap-knowledge-source",o),ky(),d}return JSON.parse(i)}function ky(){const o=new Date().getTime()+864e5;sessionStorage.setItem("flatmap-knowledge-expiry",o)}function Ey(){["flatmap-knowledge","flatmap-knowledge-expiry","flatmap-knowledge-source"].forEach(t=>{sessionStorage.removeItem(t)})}function ps(){const e=sessionStorage.getItem("flatmap-knowledge-expiry");new Date().getTime()>e&&Ey()}const la=e=>e&&e.charAt(0).toUpperCase()+e.slice(1);var hs={exports:{}};(function(e,t){(function(o,a){e.exports=a()})(typeof window<"u"?window:hm,function(){if(typeof window>"u")return null;var o=typeof window<"u"&&window.Math==Math?window:typeof self<"u"&&self.Math==Math?self:Function("return this")(),a=o.requestAnimationFrame||o.mozRequestAnimationFrame||o.webkitRequestAnimationFrame||function(f){return o.setTimeout(f,20)},i=o.cancelAnimationFrame||o.mozCancelAnimationFrame||o.webkitCancelAnimationFrame||function(f){o.clearTimeout(f)};function r(f,h){var p=Object.prototype.toString.call(f),g=p==="[object Array]"||p==="[object NodeList]"||p==="[object HTMLCollection]"||p==="[object Object]"||typeof jQuery<"u"&&f instanceof jQuery||typeof Elements<"u"&&f instanceof Elements,u=0,m=f.length;if(g)for(;u<m;u++)h(f[u]);else h(f)}function s(f){if(!f.getBoundingClientRect)return{width:f.offsetWidth,height:f.offsetHeight};var h=f.getBoundingClientRect();return{width:Math.round(h.width),height:Math.round(h.height)}}function l(f,h){Object.keys(h).forEach(function(p){f.style[p]=h[p]})}var d=function(f,h){var p=0;function g(){var m=[];this.add=function(w){m.push(w)};var y,b;this.call=function(w){for(y=0,b=m.length;y<b;y++)m[y].call(this,w)},this.remove=function(w){var T=[];for(y=0,b=m.length;y<b;y++)m[y]!==w&&T.push(m[y]);m=T},this.length=function(){return m.length}}function u(m,y){if(m){if(m.resizedAttached){m.resizedAttached.add(y);return}m.resizedAttached=new g,m.resizedAttached.add(y),m.resizeSensor=document.createElement("div"),m.resizeSensor.dir="ltr",m.resizeSensor.className="resize-sensor";var b={pointerEvents:"none",position:"absolute",left:"0px",top:"0px",right:"0px",bottom:"0px",overflow:"hidden",zIndex:"-1",visibility:"hidden",maxWidth:"100%"},w={position:"absolute",left:"0px",top:"0px",transition:"0s"};l(m.resizeSensor,b);var T=document.createElement("div");T.className="resize-sensor-expand",l(T,b);var S=document.createElement("div");l(S,w),T.appendChild(S);var v=document.createElement("div");v.className="resize-sensor-shrink",l(v,b);var E=document.createElement("div");l(E,w),l(E,{width:"200%",height:"200%"}),v.appendChild(E),m.resizeSensor.appendChild(T),m.resizeSensor.appendChild(v),m.appendChild(m.resizeSensor);var I=window.getComputedStyle(m),M=I?I.getPropertyValue("position"):null;M!=="absolute"&&M!=="relative"&&M!=="fixed"&&M!=="sticky"&&(m.style.position="relative");var B=!1,x=0,k=s(m),_=0,V=0,q=!0;p=0;var F=function(){var Z=m.offsetWidth,ce=m.offsetHeight;S.style.width=Z+10+"px",S.style.height=ce+10+"px",T.scrollLeft=Z+10,T.scrollTop=ce+10,v.scrollLeft=Z+10,v.scrollTop=ce+10},O=function(){if(q){var Z=m.offsetWidth===0&&m.offsetHeight===0;if(Z){p||(p=a(function(){p=0,O()}));return}else q=!1}F()};m.resizeSensor.resetSensor=O;var $=function(){x=0,B&&(_=k.width,V=k.height,m.resizedAttached&&m.resizedAttached.call(k))},pe=function(){k=s(m),B=k.width!==_||k.height!==V,B&&!x&&(x=a($)),O()},Y=function(Z,ce,Ee){Z.attachEvent?Z.attachEvent("on"+ce,Ee):Z.addEventListener(ce,Ee)};Y(T,"scroll",pe),Y(v,"scroll",pe),p=a(function(){p=0,O()})}}r(f,function(m){u(m,h)}),this.detach=function(m){p||(i(p),p=0),d.detach(f,m)},this.reset=function(){f.resizeSensor.resetSensor()}};if(d.reset=function(f){r(f,function(h){h.resizeSensor.resetSensor()})},d.detach=function(f,h){r(f,function(p){p&&(p.resizedAttached&&typeof h=="function"&&(p.resizedAttached.remove(h),p.resizedAttached.length())||p.resizeSensor&&(p.contains(p.resizeSensor)&&p.removeChild(p.resizeSensor),delete p.resizeSensor,delete p.resizedAttached))})},typeof MutationObserver<"u"){var c=new MutationObserver(function(f){for(var h in f)if(f.hasOwnProperty(h))for(var p=f[h].addedNodes,g=0;g<p.length;g++)p[g].resizeSensor&&d.reset(p[g])});document.addEventListener("DOMContentLoaded",function(f){c.observe(document.body,{childList:!0,subtree:!0})})}return d})})(hs);var Iy=hs.exports;const Ty=mm(Iy),Ay=ga.defineStore("main",{state:()=>({userProfile:{token:""}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function Oy(e){return{all:e=e||new Map,on:function(t,o){var a=e.get(t);a?a.push(o):e.set(t,[o])},off:function(t,o){var a=e.get(t);a&&(o?a.splice(a.indexOf(o)>>>0,1):e.set(t,[]))},emit:function(t,o){var a=e.get(t);a&&a.slice().map(function(i){i(o)}),(a=e.get("*"))&&a.slice().map(function(i){i(t,o)})}}}const ca=new Oy,My="cannot be found on the map.",By=e=>{let t={lng:0,lat:0},o;return e.type==="Polygon"?e.coordinates.length&&(o=e.coordinates[0]):o=e.coordinates,o&&(e.type!=="Point"?(o.map(a=>{t.lng+=parseFloat(a[0]),t.lat+=parseFloat(a[1])}),t.lng=t.lng/o.length,t.lat=t.lat/o.length):(t.lng+=parseFloat(o[0]),t.lat+=parseFloat(o[1]))),t},ms=(e,t)=>{const o=[];let a=e.organs?e.organs:e.ftus;const i=a?a.filter((r,s)=>a.findIndex(l=>l.label===r.label)===s):void 0;return i&&i.forEach(r=>{const s={label:r.label,models:r.models,key:`${t}.${r.label}`},l=ms(r,s.key);l.length>0&&(s.children=l),o.push(s)}),o},xy={name:"FlatmapVuer",components:{Button:Fr,Col:en,Loading:Yg,Radio:Xr,Icon:ke,RadioGroup:es,Row:Xt,Select:Hn,Dialog:mg,MapSvgIcon:ma.MapSvgIcon,MapSvgSpriteColor:ma.MapSvgSpriteColor,Tooltip:Re.Tooltip,TreeControls:Re.TreeControls,SelectionsGroup:fs,SvgLegends:gy,ElIconWarningFilled:K.WarningFilled,ElIconArrowDown:K.ArrowDown,ElIconArrowLeft:K.ArrowLeft,DrawToolbar:Re.DrawToolbar},beforeCreate:function(){this.setStateRequired=!1},setup(e){let t=n.inject("$annotator");return t||(t=n.markRaw(new Is.AnnotationService(`${e.flatmapAPI}annotator`)),n.provide("$annotator",t)),{annotator:t}},methods:{setVisibilityFilter:function(e){this.mapImp&&(e?this.mapImp.setVisibilityFilter(e):this.mapImp.clearVisibilityFilter())},manualAbortedOnClose:function(){this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEventCallback({},{type:"aborted"}),this.initialiseDrawing()},initialiseDrawing:function(){this.connectionEntry={},this.activeDrawTool=void 0,this.activeDrawMode=void 0,this.drawnCreatedEvent={}},cancelDrawnFeature:function(){this.isValidDrawnCreated&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[{...this.drawnCreatedEvent.feature,resourceId:this.serverURL}],this.rollbackAnnotationEvent(),this.initialiseDrawing())},connectedFeatureTooltip:function(e){if(this.mapImp)if(e){const t=Number(e);let a={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(i=>i.id===e.trim())}};this.checkAndCreatePopups([a])}else this.closeTooltip()},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent]),Object.keys(this.connectionEntry).length>0&&(this.annotationEntry[0].feature.connection=this.connectionEntry),this.initialiseDrawing())},toolbarEvent:function(e,t){if(!this.isValidDrawnCreated){if(this.manualAbortedOnClose(),this.doubleClickedFeature=!1,this.changeAnnotationDrawMode({mode:"simple_select"}),e==="mode")this.activeDrawMode=t;else if(e==="tool"){if(this.cancelDrawnFeature(),t){const o=t.replace(/[A-Z]/g,a=>`_${a.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${o}`})}this.activeDrawTool=t}}},annotationDrawModeEvent:function(e){this.activeDrawMode==="Edit"?this.doubleClickedFeature&&(e.feature.feature.geometry.type!=="Point"&&(this.changeAnnotationDrawMode({mode:"direct_select",options:{featureId:e.feature.feature.id}}),this.modifyAnnotationFeature()),this.doubleClickedFeature=!1):this.activeDrawMode==="Delete"&&(this.changeAnnotationDrawMode({mode:"simple_select",options:{featureIds:[e.feature.feature.id]}}),this.modifyAnnotationFeature())},createConnectivityBody:function(){if(Object.keys(this.connectionEntry).length>0){const e=Object.values(this.connectionEntry),t={type:"connectivity",source:e[0],target:e[e.length-1],intermediates:e.filter((o,a)=>a!==0&&a!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},modifyAnnotationFeature:function(){this.mapImp&&this.mapImp.removeAnnotationFeature()},rollbackAnnotationEvent:function(){this.mapImp&&this.annotationEntry.length>0&&["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.mapImp.rollbackAnnotationEvent(this.annotationEntry[0]),this.annotationEntry=[])},commitAnnotationEvent:function(e){this.mapImp&&(this.offlineAnnotationEnabled&&(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],this.offlineAnnotations.push(e),this.annotationEntry[0].type==="deleted"&&(this.offlineAnnotations=this.offlineAnnotations.filter(t=>t.resource!==this.serverURL||t.item.id!==e.item.id)),sessionStorage.setItem("anonymous-annotation",JSON.stringify(this.offlineAnnotations))),["created","updated","deleted"].includes(this.annotationEntry[0].type)&&(this.featureAnnotationSubmitted=!0,this.mapImp.commitAnnotationEvent(this.annotationEntry[0]),e.body.comment==="Position Updated"?this.annotationEntry[0].positionUpdated=!1:this.annotationEntry[0].type==="deleted"&&(this.annotationSidebar&&this.$emit("annotation-close"),this.closeTooltip(),this.annotationEntry=[]),this.addAnnotationFeature()))},fetchAnnotatedItemIds:async function(e=void 0,t=void 0){let o;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.resource===this.serverURL).map(a=>a.item.id)):(o=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),"resource"in o&&(o=o.itemIds)),o},setFeatureAnnotated:async function(){if(this.mapImp){const e=await this.fetchAnnotatedItemIds();for(const t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let o;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem("anonymous-annotation"))||[],o=this.offlineAnnotations.filter(a=>a.feature&&a.resource===this.serverURL).map(a=>a.feature);else{const a=await this.fetchAnnotatedItemIds(e,t);o=await this.annotator.drawnFeatures(this.userToken,this.serverURL,a),"resource"in o&&(o=o.features)}return o},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);const e=this.annotationFrom==="Anyone"?void 0:this.authorisedUser.orcid?this.authorisedUser.orcid:"0000-0000-0000-0000",t=this.annotationFrom==="Anyone"?void 0:this.annotationFrom==="Me",o=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=o,this.loading=!1,!this.featureAnnotationSubmitted)for(const a of o)this.mapImp.addAnnotationFeature(a)}},showAnnotator:function(e){this.mapImp&&(this.mapImp.showAnnotator(e),this.$el.querySelector(".maplibregl-ctrl-group").style.display="none")},setAnnotationFrom:function(e){this.annotationFrom=e,this.mapImp&&(this.manualAbortedOnClose(),this.addAnnotationFeature())},emitOfflineAnnotationUpdate:function(){this.$emit("update-offline-annotation-enabled",this.offlineAnnotationEnabled)},setFlightPath3D:function(e){this.flightPath3DRadio=e,this.mapImp&&this.mapImp.enableFlightPaths(e)},viewLatestMap:function(){let e=this.biologicalSex?this.biologicalSex:void 0;this.entry==="NCBITaxon:9606"&&(e="PATO:0000384");const t={entry:this.entry,biologicalSex:e,viewport:this.mapImp.getState()};this.$emit("view-latest-map",t)},backgroundChangeCallback:function(e){this.currentBackground=e,this.mapImp&&this.mapImp.setBackgroundColour(this.currentBackground,1)},processSystems:function(e){if(this.systems.length=0,e&&e.length>0){const t={label:"All",key:"All",children:[]};e.forEach(o=>{const a={colour:o.colour,enabled:o.enabled,label:o.id,key:o.id},i=ms(o,a.key);i.length>0&&(a.children=i),t.children.push(a)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,qn(this.mapImp,e).then(o=>{o.length&&o.forEach(a=>{let i=!0;t&&(i=t.checkAll?!0:t.checked.includes(a.taxon)),this.taxonConnectivity.push({...a,enabled:i}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(a.taxon,i)})})},toggleDrawer:function(){this.drawerOpen=!this.drawerOpen},setColour:function(e){this.colourRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:e,outlined:this.outlinesRadio})},setOutlines:function(e){this.outlinesRadio=e,this.mapImp&&this.mapImp.setPaint({coloured:this.colourRadio,outlined:e})},setInitMapState:function(){if(this.mapImp){const e=this.mapImp.map,t=this.mapImp.options.bounds,o=[[t[0],t[1]],[t[2],t[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=n.markRaw({initBounds:o})}},resetView:function(){if(this.mapImp){const e=this.mapImp.map,{initBounds:t}=this.initMapState;e.resetNorthPitch({animate:!1}),t&&e.fitBounds(t,{animate:!1}),this.$refs.skcanSelection&&this.$refs.skcanSelection.reset(),this.$refs.layersSelection&&this.$refs.layersSelection.reset(),this.$refs.systemsSelection&&this.$refs.pathwaysSelection.reset(),this.$refs.pathwaysSelection&&this.$refs.pathwaysSelection.reset()}},zoomIn:function(){this.mapImp&&this.mapImp.zoomIn()},zoomOut:function(){this.mapImp&&this.mapImp.zoomOut()},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},sckanSelected:function(e){this.mapImp&&this.mapImp.enableSckanPath(e.key,e.value)},checkAllSCKAN:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableSckanPath(t,e.value))},zoomToFeatures:function(e){this.mapImp&&this.mapImp.zoomToFeatures(e)},retrieveConnectedPaths:async function(e,t={}){var o,a,i,r,s;if(this.viewingMode==="Neuron Connection"&&this.connectionType.toLowerCase()==="all"){const l=this.mapImp.uuid;return await Re.queryAllConnectedPaths(this.flatmapAPI,l,e)}if(this.mapImp){let l=[],d=(o=t.target)!=null&&o.length?t.target:[];const c=[...this.mapImp.pathModelNodes(e)],f=await this.mapImp.queryPathsForFeatures(e);if(c.length){if(!d.length){const h=(a=t.type)!=null&&a.length?t.type:["all"],p=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),g=(i=p==null?void 0:p.ids)==null?void 0:i.dendrites.flat(1/0),u=(r=p==null?void 0:p.ids)==null?void 0:r.components.flat(1/0),m=(s=p==null?void 0:p.ids)==null?void 0:s.axons.flat(1/0);let y=[];h.includes("origins")&&y.push(...g),h.includes("components")&&y.push(...u),h.includes("destinations")&&y.push(...m),h.includes("all")&&y.push(...g,...u,...m),d=[...new Set(y)]}c.forEach(h=>{this.mapImp.nodePathModels(h).forEach(g=>{const m=this.mapImp.pathModelNodes(g).map(b=>this.mapImp.featureProperties(b).models);d.filter(b=>m.includes(b)).length&&!l.includes(g)&&l.push(g)})})}else f.length&&(d.length?f.forEach(h=>{const g=this.mapImp.pathModelNodes(h).map(m=>this.mapImp.featureProperties(m).models);d.filter(m=>g.includes(m)).length&&!l.includes(h)&&l.push(h)}):l=f);return l=[...new Set([...l,...e])],l}},resetMapFilter:function(){const e=this.mapFilters.alert;let t;const o={"tile-layer":"pathways"},a={NOT:o};e.with&&!e.without?t={OR:[a,{AND:[o,{HAS:"alert"}]}]}:!e.with&&e.without?t={OR:[a,{AND:[o,{NOT:{HAS:"alert"}}]}]}:!e.with&&!e.without&&(t=a),this.setVisibilityFilter(t)},alertMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){let t;const o={"tile-layer":"pathways"},a={NOT:o};if(e.key==="alert"||e.key==="withoutAlert"){const i=e.key==="alert"?{HAS:"alert"}:{NOT:{HAS:"alert"}};t={OR:[a,{AND:[o,i]}]}}this.setVisibilityFilter(t)}else this.resetMapFilter()},alertSelected:function(e){this.mapImp&&(e.key==="alert"?e.value?this.mapFilters.alert.with=!0:this.mapFilters.alert.with=!1:e.key==="withoutAlert"&&(e.value?this.mapFilters.alert.without=!0:this.mapFilters.alert.without=!1),this.resetMapFilter())},checkAllAlerts:function(e){this.mapImp&&(e.value?(this.mapFilters.alert.without=!0,this.mapFilters.alert.with=!0):(this.mapFilters.alert.without=!1,this.mapFilters.alert.with=!1),this.resetMapFilter())},systemSelected:function(e){this.mapImp&&this.mapImp.enableSystem(e.key,e.value)},checkAllSystems:function(e){this.mapImp&&this.systems[0].children.forEach(t=>this.mapImp.enableSystem(t.label,e))},ftuSelected:function(e){this.searchAndShowResult(e,!0)},layersSelected:function(e){this.mapImp&&this.mapImp.enableLayer(e.key,e.value)},checkAllLayers:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enableLayer(t,e.value))},taxonsSelected:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.key,e.value)},taxonMouseEnterEmitted:function(e){if(this.mapImp)if(e.value){clearTimeout(this.taxonLeaveDelay);let t=this.mapImp.taxonFeatureIds(e.key);this.mapImp.enableConnectivityByTaxonIds(e.key,e.value),this.mapImp.zoomToGeoJSONFeatures(t,{noZoomIn:!0})}else this.taxonLeaveDelay=setTimeout(()=>{this.mapImp.unselectGeoJSONFeatures(),e.selections.forEach(t=>{let o=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,o)})},1e3)},checkAllTaxons:function(e){this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.keys,e.value)},pathwaysSelected:function(e){this.mapImp&&this.mapImp.enablePath(e.key,e.value)},checkAllPathways:function(e){this.mapImp&&e.keys.forEach(t=>this.mapImp.enablePath(t,e.value))},enablePanZoomEvents:function(e){this.mapImp.enablePanZoomEvents(e)},annotationEventCallback:function(e,t){if(t.type==="aborted")this.featureAnnotationSubmitted?this.featureAnnotationSubmitted=!1:this.rollbackAnnotationEvent(),this.annotationEntry=[];else if(t.type==="modeChanged")t.feature.mode==="direct_select"&&(this.doubleClickedFeature=!0),this.annotationSidebar&&t.feature.mode==="simple_select"&&this.activeDrawMode==="Deleted"&&this.annotationEventCallback({},{type:"aborted"});else if(t.type==="selectionChanged"){if(this.selectedDrawnFeature=t.feature.features.length===0?void 0:t.feature.features[0],e.feature.feature=this.selectedDrawnFeature,!this.activeDrawTool)if(this.connectionEntry={},this.selectedDrawnFeature){const o=this.existDrawnFeatures.find(a=>a.id===this.selectedDrawnFeature.id);o&&o.connection&&(this.connectionEntry=o.connection),this.annotationDrawModeEvent(e)}else this.annotationSidebar&&this.previousEditEvent.type==="updated"&&(this.annotationEntry=[{...this.previousEditEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.previousEditEvent={}}else{if(t.type==="created"||t.type==="updated"){t.type==="updated"&&t.feature.action&&(t.positionUpdated=t.feature.action==="move");const o=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=o}t.type==="created"?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type==="updated"&&(this.previousEditEvent=t),t.type==="deleted"?this.previousDeletedEvent=t:this.previousDeletedEvent={}},eventCallback:function(){return(e,t,...o)=>{if(e==="annotation"){const a={feature:t,userData:o,eventType:e};this.annotationEventCallback(a,t)}else if(e!=="pan-zoom"){const a=t.label,i=[t.models],r=this.entry,s=this.biologicalSex,l=t.alert;let d;t.taxons&&(typeof t.taxons!="object"?d=JSON.parse(t.taxons):d=t.taxons);let c=[{dataset:t.dataset,biologicalSex:s,taxonomy:r,resource:i,label:a,feature:t,userData:o,eventType:e,provenanceTaxonomy:d,alert:l}];if(e==="click"){const f=Object.keys(t).includes("id");if(!f){c=[];const p=t.mapUUID,g=new Set;for(let[u,m]of Object.entries(t))if(u!=="mapUUID"){const y=m.id,b=m.label,w=[m.models];let T;if(m.taxons&&(typeof m.taxons!="object"?T=JSON.parse(m.taxons):T=m.taxons),g.has(y))continue;g.add(y),c.push({dataset:m.dataset,biologicalSex:s,taxonomy:r,resource:w,label:b,feature:m,userData:o,eventType:e,provenanceTaxonomy:T,alert:m.alert,mapUUID:p})}}const h=f?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,h),this.viewingMode!=="Neuron Connection"){if(this.currentActive=h.models?h.models:"",this.activeDrawTool&&!this.isValidDrawnCreated){const p=h.featureId||this.existDrawnFeatures.find(g=>g.id===h.id);if(this.activeDrawTool==="LineString"&&p){const g=h.featureId?h.featureId:h.id,u=h.label?h.label:`Feature ${h.id}`;this.connectionEntry[` ${g}`]=Object.assign({label:u},Object.fromEntries(Object.entries(h).filter(([m])=>["featureId","models"].includes(m)).map(([m,y])=>[m==="featureId"?"id":m,y])))}}}}else e==="mouseenter"&&this.viewingMode!=="Neuron Connection"&&(this.currentHover=t.models?t.models:"");t&&t.type!=="marker"&&e==="click"&&!this.activeDrawTool&&this.checkAndCreatePopups(c),this.$emit("resource-selected",c)}else this.$emit("pan-zoom-callback",t)}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=t.source,(e==="Neuron Connection"||e==="Annotation")&&(this.connectivityDataSource=t.featureId)},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(".flatmap-tooltip-popup").forEach(t=>t.remove())},createTooltipForConnectivity:function(e,t){const o=document.createElement("div");o.classList.add("flatmap-feature-label"),e.forEach((a,i)=>{const{label:r}=a;if(o.append(la(r)),i+1<e.length){const s=document.createElement("hr");o.appendChild(s)}}),this.mapImp.showPopup(t,o,{className:"custom-popup flatmap-tooltip-popup",positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){const{connectivityInfo:t,data:o}=e,a=[],i=[],r=[],s=[];if(t&&t.featureId&&a.push(...t.featureId),this.mapImp){if(o.forEach(p=>{const g=this.mapImp.search(p.id);if(g!=null&&g.results.length){const u=g==null?void 0:g.results[0].featureId;r.push({featureId:u,...p})}else s.push(p)}),r.length){let p=r[0].featureId;this.mapImp.annotations.forEach(g=>{const u=g["anatomical-nodes"];if(u){const m=u.join("");r.every(b=>m.indexOf(b.id)!==-1)&&(p=g.featureId,i.push(p))}}),this.createTooltipForConnectivity(r,p)}else this.removeActiveTooltips();this.emitConnectivityError(s);const l=a.reduce((p,g)=>{const u=this.mapImp.pathways.paths[g],m=u?u.connectivity:null;if(m){const y=m.flat(1/0);p.push(...y)}return p},[]),d=[...new Set(l)],c=[...a,...d],h=[...this.mapImp.modelFeatureIdList(c),...i];this.mapImp.selectGeoJSONFeatures(h)}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(t=>{this.mapImp.selectFeatures(t)})},searchConnectivitiesByReference:async function(e){const t=sessionStorage.getItem("flatmap-knowledge");let o=[];return t?o=await wy(e):o=await Cy(this.mapImp,e,this.flatmapQueries),o},getFlatmapKnowledge:function(){let e=[];const t=sessionStorage.getItem("flatmap-knowledge");return t&&(e=JSON.parse(t)),e},emitConnectivityError:function(e){this.$emit("connectivity-error",{data:{errorData:e,errorMessage:My}})},checkConnectivityTooltipEntry:function(e){return e!=null&&e.length?e.find(t=>{var o,a;return((o=t==null?void 0:t.destinations)==null?void 0:o.length)||((a=t==null?void 0:t.components)==null?void 0:a.length)})!==void 0:!1},changeConnectivitySource:async function(e){const{entry:t,connectivitySource:o}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],o),this.tooltipEntry=this.tooltipEntry.map(a=>a.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(a):a),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry))},checkAndCreatePopups:async function(e,t){var o;if(this.viewingMode==="Annotation"){const a=e.filter(i=>i.feature).map(i=>i.feature);if(a.length>0)if(this.annotationSidebar&&this.previousDeletedEvent.type==="deleted"&&(this.annotationEntry=[{...this.previousDeletedEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:"aborted"})),this.annotationEntry=[],a.forEach(i=>{var r;this.annotationEntry.push({...i,resourceId:this.serverURL,featureId:i.featureId?i.featureId:(r=i.feature)==null?void 0:r.id,offline:this.offlineAnnotationEnabled})}),a[0].feature)this.activeDrawTool||this.activeDrawMode||this.isValidDrawnCreated?(this.featureAnnotationSubmitted=!1,this.activeDrawTool&&this.createConnectivityBody(),this.displayTooltip(a[0].feature.id,By(a[0].feature.geometry))):this.rollbackAnnotationEvent();else{const i=this.annotationEntry.filter(r=>r.featureId&&r.models).map(r=>r.models);i.length>0&&this.displayTooltip(i)}else this.annotation={}}else if(this.viewingMode==="Neuron Connection"&&!t){const a=e.map(r=>r.resource[0]);if(a.find(r=>!r.startsWith("ilxtr:"))){const r=Array.isArray(a)?[...a]:[a];r.length===1&&r.push([]);const s=(o=e[0].feature)==null?void 0:o.featureId,l=this.mapImp.annotations.get(s),d=l==null?void 0:l["anatomical-nodes"];let c,f=r;const h=l==null?void 0:l.models;d!=null&&d.length&&(c=d[d.length-1]),c?f=JSON.parse(c):h&&(f=[h,[]]);const p=f.flat(1/0),g=[...new Set(p)],m=(await Re.fetchLabels(this.flatmapAPI,g)).reduce((S,v)=>{const E=v[0],I=JSON.parse(v[1]);return I.source===this.mapImp.knowledgeSource&&S.push({id:E,label:I.label}),S},[]),y=[];for(let S=0;S<g.length;S++){const v=m.find(E=>E.id===g[S]);v&&y.push(v.label)}const b=la(y.join(", ")),w={facet:JSON.stringify(f),facetPropPath:`flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,tagLabel:b,term:this.connectionType};if(this.connectivityFilters.some(S=>S.facet===w.facet&&S.facetPropPath===w.facetPropPath)||this.connectivityFilters.push(w),this.connectionType.toLowerCase()==="all"){const S=g.join();this.$emit("neuron-connection-feature-click",{filters:[],search:S})}else this.$emit("neuron-connection-feature-click",{filters:this.connectivityFilters,search:""})}else{const r=a.join();this.connectionType.toLowerCase()==="all"&&this.$emit("neuron-connection-feature-click",{filters:[],search:r})}}else{Sy(this.mapImp,this.flatmapQueries);let a=[];if(this.tooltipEntry=e.filter(i=>i.resource[0]in this.mapImp.pathways.paths).map(i=>({title:i.label,featureId:i.resource,ready:!1})),this.tooltipEntry.length){this.$emit("connectivity-info-open",this.tooltipEntry);for(let r=0;r<e.length;r++)a.push(await this.getKnowledgeTooltip(e[r]));this.tooltipEntry=await Promise.all(a);const i=this.tooltipEntry.map(r=>r.featureId[0]);i.length>0&&this.displayTooltip(i)}}},updateConnectivityFilters:function(e){e.length&&(this.connectivityFilters=e.filter(t=>t.facet.toLowerCase()!=="show all"))},resetConnectivityfilters:function(e){e.length?this.connectivityFilters=this.connectivityFilters.filter(t=>e.some(o=>o.facetPropPath===t.facetPropPath&&o.facet!==t.facet)):this.connectivityFilters=[]},getKnowledgeTooltip:async function(e){const t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e);let o=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(o.featuresAlert=e.alert,o.knowledgeSource=sa(this.mapImp),o.mapId=this.mapImp.provenance.id,o.mapuuid=this.mapImp.provenance.uuid),o.ready=!0,o},popUpCssHacks:function(){const e=document.querySelector(".flatmap-tooltip-popup"),t=document.querySelector(".maplibregl-popup-close-button");e&&(e.style.display="none"),t.style.display="block",this.$refs.tooltip.$el.style.display="flex",t.onclick=()=>{this.$emit("connectivity-info-close"),e&&(e.style.display="block")}},closeTooltip:function(){this.$refs.tooltip&&(this.$refs.tooltip.$el.style.display="none"),document.querySelectorAll(".maplibregl-popup").forEach(e=>{e.style.display="none"})},showPopup:function(e,t,o){let a=o;this.mapImp&&(a?a.className||(a.className="custom-popup"):a={className:"custom-popup",positionAtLastClick:!0},this.mapImp.showPopup(e,t,a))},showMarkerPopup:function(e,t,o){this.mapImp&&this.mapImp.showMarkerPopup(e,t,o)},closeMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");this.minimapSmall?(e.classList.add("enlarge"),e.classList.remove("shrink")):(e.classList.add("shrink"),e.classList.remove("enlarge")),this.minimapSmall=!this.minimapSmall},addResizeButtonToMinimap:function(){let e=this.$refs.flatmapContainer.querySelector(".maplibregl-ctrl-minimap");e&&(this.$refs.minimapResize&&this.$refs.minimapResize.$el.parentNode&&this.$refs.minimapResize.$el.parentNode.removeChild(this.$refs.minimapResize.$el),e.appendChild(this.$refs.minimapResize.$el),this.minimapResizeShow=!0)},setHelpMode:function(e){const t=this.hoverVisibilities.length,o=t-1,a=this.hoverVisibilities[this.helpModeActiveIndex];if(a){const i=a==null?void 0:a.refs,r=a==null?void 0:a.ref,s=this.$refs[i||r];if(s){const{parentElement:l,nextElementSibling:d}=s.$el,c=f=>f&&(f.classList.contains("pathway-container")||f.classList.contains("pathway-location"));(c(l)||c(d))&&(this.requiresDrawer?this.drawerOpen=!0:this.helpModeActiveIndex+=1)}else this.helpModeActiveIndex+=1}e||(this.helpModeActiveIndex=this.helpModeInitialIndex),this.viewingMode!=="Annotation"&&this.helpModeActiveIndex>9&&(this.helpModeActiveIndex=o),e&&this.helpModeActiveIndex>=o&&this.$emit("help-mode-last-item",!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(i=>{i.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1?(this.closeFlatmapHelpPopup(),setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.showTooltip(this.helpModeActiveIndex,200)},300)):this.helpModeActiveIndex===-1&&this.openFlatmapHelpPopup():(this.inHelp=!1,this.hoverVisibilities.forEach(i=>{i.value=!1}),this.closeFlatmapHelpPopup())},showTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!0,this.$emit("shown-tooltip")},t))},hideTooltip:function(e,t=500){this.inHelp||(clearTimeout(this.tooltipWait[e]),this.tooltipWait[e]=setTimeout(()=>{this.hoverVisibilities[e].value=!1},t))},displayTooltip:function(e,t=void 0){let o,a={className:"flatmapvuer-popover"};if(t)o=e,a.annotationFeatureGeometry=t;else{const i=Array.isArray(e)?e[0]:e;i&&(o=this.mapImp.modelFeatureIds(i)[0]),this.activeDrawTool||(a.positionAtLastClick=!0)}this.connectivityInfoSidebar&&this.tooltipEntry.length&&this.viewingMode!=="Annotation"&&this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit("connectivity-info-open",this.tooltipEntry),this.annotationSidebar&&this.viewingMode==="Annotation"&&this.$emit("annotation-open",{annotationEntry:this.annotationEntry,commitCallback:this.commitAnnotationEvent}),o&&!this.disableUI&&(this.viewingMode==="Annotation"&&!this.annotationSidebar||this.viewingMode==="Exploration"&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(o,this.$refs.tooltip.$el,a),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){const{offsetX:o=0,offsetY:a=0,zoom:i=4}=t,r=this.mapImp.map,s=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),s!=null&&s.length&&setTimeout(()=>{r.fitBounds(s,{offset:[o,a],zoom:i,animate:!0})})}},openFlatmapHelpPopup:function(){if(this.mapImp){let e=this.mapImp.modelFeatureIds("UBERON:0000948");e&&e.length>0&&(this.mapImp.showPopup(e[0],"Click for more information",{anchor:"top",className:"flatmap-popup-popper"}),this.$emit("shown-map-tooltip"))}},closeFlatmapHelpPopup:function(){this.$el.querySelectorAll(".maplibregl-popup-close-button").forEach(e=>{e.click()})},getLabels:function(){let e=[];if(this.mapImp){let t=this.mapImp.annotations;for(let o of t.values())o.label&&e.push(o.label);return Array.from(new Set(e))}},getVisibilityState:function(e){if(["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{let a=this.$refs[o];a&&(e[o]=a.getState())}),this.$refs.treeControls){const o=this.$refs.treeControls.$refs.regionTree.getCheckedKeys();e.systemsSelection=o.filter(a=>!a.includes("."))}},setVisibilityState:function(e){["alertSelection","pathwaysSelection","taxonSelection"].forEach(o=>{const a=e[o];if(a){const i=this.$refs[o];i&&i.setState(a)}}),"systemsSelection"in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(o=>{this.mapImp.enableSystem(o.key,e.systemsSelection.includes(o.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()};const t=this.mapImp.getIdentifier();return this.biologicalSex?e.biologicalSex=this.biologicalSex:t&&t.biologicalSex&&(e.biologicalSex=t.biologicalSex),t&&t.uuid&&(e.uuid=t.uuid),e.viewingMode=this.viewingMode,e.searchTerm=this.searchTerm,e.flightPath3D=this.flightPath3DRadio,e.colour=this.colourRadio,e.outlines=this.outlinesRadio,e.background=this.currentBackground,this.offlineAnnotationEnabled&&(e.offlineAnnotations=sessionStorage.getItem("anonymous-annotation")),this.getVisibilityState(e),e}},setState:function(e){e&&(this.mapImp&&e.entry&&this.entry==e.entry&&(!e.biologicalSex||e.biologicalSex===this.biologicalSex)?this.restoreMapState(e):this.createFlatmap(e),this.setStateRequired=!1)},restoreMapState:function(e){if(e){if(e.viewport&&this.mapImp.setState(e.viewport),e.offlineAnnotations&&sessionStorage.setItem("anonymous-annotation",e.offlineAnnotations),e.viewingMode&&this.changeViewingMode(e.viewingMode),"flightPath3D"in e&&this.setFlightPath3D(e.flightPath3D),"colour"in e&&this.setColour(e.colour),"outlines"in e&&this.setOutlines(e.outlines),e.background&&this.backgroundChangeCallback(e.background),e.searchTerm){const t=e.searchTerm;this.searchAndShowResult(t,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){(e===1.6||e>1.6)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0;let t=!1;this.displayMinimap&&(t={position:"top-right"});let o={taxon:this.entry};this.uuid&&(o.uuid=this.uuid),e?(e.uuid?o={uuid:e.uuid}:e.entry&&(o.taxon=e.entry),e.biologicalSex?o.biologicalSex=e.biologicalSex:o.taxon==="NCBITaxon:9606"&&(o.biologicalSex="PATO:0000384")):this.biologicalSex&&(o.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(o,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:t,container:this.$refs.display}).then(i=>{this.mapImp=i,this.serverURL=this.mapImp.makeServerUrl("").slice(0,-1);let r=this.mapImp.details.version;this.setFlightPathInfo(r);const s=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(s),this.$nextTick(()=>this.restoreMapState(s))})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){const e=this.$refs.display;if(e){const t=getComputedStyle(e),o=parseInt(t.paddingTop)+parseInt(t.paddingBottom),a=e.clientHeight-o;this.pathwaysMaxHeight=a-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&(this.mapImp.resize(),this.showMinimap(this.displayMinimap))}catch{console.error("Map resize error")}},getFilterSources:function(){const e=["kind","taxons"];let t=new Set,o=new Set,a=new Map;for(const r of this.mapImp.annotations.values())if(r.source){"alert"in r?t.add(r.source):o.add(r.source);for(const[s,l]of Object.entries(r))if(e.includes(s)){a.has(s)||a.set(s,new Map);const d=a.get(s),c=f=>{const h=f;d.has(h)||d.set(h,new Set),d.get(h).add(`${r.source}`)};Array.isArray(l)?l.forEach(c):c(l)}}let i={alert:{with:[...t],without:[...o]}};for(const[r,s]of a.entries()){i[r]={};for(const[l,d]of s.entries())i[r][l]=[...d.values()]}return i},getFilterOptions:async function(e){let t=[];if(this.mapImp){const o=this.mapImp.featureFilterRanges();for(const[p,g]of Object.entries(o)){let u={key:`flatmap.connectivity.${p}`,label:"",children:[]},m=[];if(p==="kind"){u.label="Pathways";for(const y of g){const b=this.pathways.find(w=>w.type===y);b&&m.push({key:`${u.key}.${y}`,label:b.label,colour:b.colour,colourStyle:"line",dashed:b.dashed})}}else if(p==="taxons"){u.label="Studied in";const y=await qn(this.mapImp,this.mapImp.taxonIdentifiers);if(y.length)for(const b of g){const w=y.find(T=>T.taxon===b);w&&m.push({key:`${u.key}.${b}`,label:`${w.label} `})}}else if(p==="alert"){u.label="Alert";for(const y of["with","without"])m.push({key:`${u.key}.${y}`,label:`${y} alerts`})}u.children=m.sort((y,b)=>y.label.localeCompare(b.label)),u.label&&u.children.length&&t.push(u)}const a=[],i=e||this.getFlatmapKnowledge(),r=this.mapImp.pathways.paths,s=i.reduce((p,g)=>{const u=g.id;if(u){const m=r[u];if(m){const y=m.connectivity,b=m["node-phenotypes"];g.connectivity=[...y];for(let w in g["node-phenotypes"])b[w]&&(g["node-phenotypes"][w]=[...b[w]]);p.push(JSON.parse(JSON.stringify(g)))}}return p},[]),l=this.mapImp.knowledgeSource,d=await Re.extractOriginItems(this.flatmapAPI,l,s),c=await Re.extractViaItems(this.flatmapAPI,l,s),f=await Re.extractDestinationItems(this.flatmapAPI,l,s),h=(p,g)=>{const u=JSON.stringify(g.key);return{key:`flatmap.connectivity.source.${p}.${u}`,label:g.label||u}};for(const p of["origin","via","destination"]){let g=[];p==="origin"?g=d.map(u=>h(p,u)):p==="via"?g=c.map(u=>h(p,u)):p==="destination"&&(g=f.map(u=>h(p,u))),g=g.sort((u,m)=>{const y=T=>/^[a-zA-Z]/.test(T),b=y(u.label),w=y(m.label);return b&&!w?-1:!b&&w?1:u.label.localeCompare(m.label)}),a.push({key:`flatmap.connectivity.source.${p}`,label:p,children:g})}t.push(...a)}return t},onFlatmapReady:function(e){var t;this.sensor=n.markRaw(new Ty(this.$refs.display,this.mapResize)),((t=this.mapImp.options)==null?void 0:t.style)==="functional"&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.pathways=this.pathways.filter(o=>o.enabled&&o.type!=="other"),this.processSystems(this.mapImp.getSystems()),this.processTaxon(this.mapImp.taxonIdentifiers,e?e.taxonSelection:void 0),this.containsAlert="alert"in this.mapImp.featureFilterRanges(),this.flatmapLegends=this.mapImp.flatmapLegend,this.addResizeButtonToMinimap(),this.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.$emit("ready",this)},handleMapClick:function(){const e=this.mapImp.map;e&&e.on("click",t=>{this.connectivityDataSource||this.$emit("connectivity-info-close"),this.connectivityDataSource=""})},showMinimap:function(e){this.mapImp&&this.mapImp.showMinimap(e)},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t,o){var a;if(this.mapImp){if(e===void 0||e==="")return this.mapImp.clearSearchResults(),this.viewingMode==="Exploration"?this.$emit("connectivity-info-close"):this.viewingMode==="Annotation"&&this.manualAbortedOnClose(),this.searchTerm="",!0;{const i=this.mapImp.search(e);if((a=i==null?void 0:i.results)!=null&&a.length){if(this.mapImp.showSearchResults(i),t){let r;for(let s=0;s<i.results.length;s++){r=i.results[s].featureId;const l=this.mapImp.annotation(r);if(r&&(l!=null&&l.label))break}if(r){const s=this.mapImp.featureProperties(r),l={resource:[s.models],feature:s,label:s.label,provenanceTaxonomy:s.taxons,alert:s.alert};this.checkAndCreatePopups([l],o),this.mapImp.showPopup(r,la(s.label),{className:"custom-popup",positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}else this.mapImp.clearSearchResults()}}return!1},highlightConnectedPaths:function(e){if(e.length){const t=e.filter(a=>a in this.mapImp.pathways.paths),o=this.mapImp.modelFeatureIdList(t);this.mapImp.selectGeoJSONFeatures(o)}},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){ca.emit("onActionClick",e)},setConnectionType:function(e){this.connectionType=e}},props:{entry:{type:String,required:!0},uuid:String,biologicalSex:{type:String,default:""},minZoom:{type:Number,default:1},tooltips:{type:Boolean,default:!0},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},helpModeInitialIndex:{type:Number,default:0},renderAtMounted:{type:Boolean,default:!0},displayMinimap:{type:Boolean,default:!1},displayWarning:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array,default:function(){return[{display:"Open AC Map",key:"AC"},{display:"Open FC Map",key:"FC"},{display:"Open 3D Human Map",key:"3D"}]}},showStarInLegend:{type:Boolean,default:!1},isLegacy:{type:Boolean,default:!1},displayLatestChanges:{type:Boolean,default:!1},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken}},data:function(){return{sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:n.markRaw({}),sckanDisplay:[{label:"Display Path with SCKAN",key:"VALID"}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipWait:n.markRaw([]),hoverVisibilities:[{value:!1,ref:"markerPopover"},{value:!1,ref:"zoomInPopover"},{value:!1,ref:"zoomOutPopover"},{value:!1,ref:"zoomFitPopover"},{value:!1,ref:"openMapPopover"},{value:!1,ref:"settingsPopover"},{value:!1,ref:"checkBoxPopover"},{value:!1,ref:"warningPopover"},{value:!1,ref:"whatsNewPopover"},{value:!1,ref:"featuredMarkerPopover"},{value:!1,refs:"toolbarPopover",ref:"editPopover"},{value:!1,refs:"toolbarPopover",ref:"deletePopover"},{value:!1,refs:"toolbarPopover",ref:"pointPopover"},{value:!1,refs:"toolbarPopover",ref:"lineStringPopover"},{value:!1,refs:"toolbarPopover",ref:"polygonPopover"},{value:!1,refs:"toolbarPopover",ref:"connectionPopover"}],helpModeActiveIndex:this.helpModeInitialIndex,yellowstar:us,isFC:!1,inHelp:!1,currentBackground:"white",availableBackground:["white","lightskyblue","black"],loading:!1,flatmapMarker:yy,tooltipEntry:[],connectivityDataSource:"",connectivityTooltipVisible:!1,drawerOpen:!1,flightPath3DRadio:!1,displayFlightPathOption:!1,colourRadio:!0,outlinesRadio:!0,minimapResizeShow:!1,minimapSmall:!1,currentActive:"",selectedDrawnFeature:void 0,currentHover:"",viewingMode:"Exploration",viewingModes:{Exploration:"Find relevant research and view detail of neural pathways by selecting a pathway to view its connections and data sources","Neuron Connection":"Discover Neuron connections by selecting a neuron and viewing its associated network connections",Annotation:["View feature annotations","Add, comment on and view feature annotations"]},connectionType:"All",offlineAnnotationEnabled:!1,offlineAnnotations:[],annotationFrom:"Anyone",annotatedSource:["Anyone","Me","Others"],openMapRef:void 0,backgroundIconRef:void 0,toolbarOptions:["Edit","Delete","Point","LineString","Polygon","Connection"],annotator:void 0,authorisedUser:void 0,activeDrawMode:void 0,activeDrawTool:void 0,featureAnnotationSubmitted:!1,drawnCreatedEvent:{},previousEditEvent:{},previousDeletedEvent:{},connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:"Display Path With Alerts",key:"alert",enabled:!0},{label:"Display Path Without Alerts",key:"withoutAlert",enabled:!0}],mapFilters:n.markRaw({alert:{with:!0,without:!0}}),searchTerm:"",taxonLeaveDelay:void 0,connectivityFilters:[],flatmapLegends:[]}},computed:{...ga.mapState(Ay,["userToken"]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){var e,t,o;if(this.loading)return this.drawerOpen=!1,!1;if(this.isFC){if(((e=this.systems)==null?void 0:e.length)>0||this.containsAlert&&this.alertOptions||((t=this.pathways)==null?void 0:t.length)>0||((o=this.taxonConnectivity)==null?void 0:o.length)>0)return this.drawerOpen=!0,!0}else return this.drawerOpen=!0,!0;return this.drawerOpen=!1,!0},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode==="Annotation"?this.authorisedUser?e[1]:e[0]:e}},watch:{entry:function(){this.state||this.createFlatmap()},helpMode:function(e,t){e!==t&&this.setHelpMode(e)},helpModeActiveItem:function(){this.helpMode&&(this.helpModeActiveIndex+=1,this.setHelpMode(this.helpMode))},state:{handler:function(e,t){e!==t&&(this.mapManagerRef?this.setState(e):this.setStateRequired=!0)},immediate:!0,deep:!0},viewingMode:function(e){this.clearAnnotationFeature(),e==="Annotation"&&(this.loading=!0,this.annotator.authenticate(this.userToken).then(t=>{t.name&&t.email&&t.canUpdate?(this.authorisedUser=t,this.offlineAnnotationEnabled=!1):(this.authorisedUser=void 0,this.offlineAnnotationEnabled=!0),this.emitOfflineAnnotationUpdate(),this.setFeatureAnnotated(),this.addAnnotationFeature(),this.loading=!1}))},disableUI:function(e){e&&this.closeTooltip()},activeDrawTool:function(e){let t=[],o={x:null,y:null};const a=this.$el.querySelector(".maplibregl-canvas"),i=()=>{a.removeEventListener("keydown",r),a.removeEventListener("click",s)},r=l=>{if(!["Escape","Enter"].includes(l.key))return;const d=e==="Point"&&t.length===1||e==="LineString"&&t.length>=2||e==="Polygon"&&t.length>=3;(l.key==="Escape"||l.key==="Enter"&&!d)&&(this.activeDrawTool=void 0),i()},s=l=>{const d=a.getBoundingClientRect(),c=l.clientX-d.left,f=l.clientY-d.top;if(Math.sqrt((c-o.x)**2+(f-o.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}o={x:c,y:f},t.push(o)};e&&(i(),a.addEventListener("keydown",r),a.addEventListener("click",s))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ya.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef))},mounted:function(){this.openMapRef=n.shallowRef(this.$refs.openMapRef),this.backgroundIconRef=n.shallowRef(this.$refs.backgroundIconRef),this.tooltipWait.length=this.hoverVisibilities.length,this.flatmapQueries=n.markRaw(new by),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),ps()}},Ny={class:"flatmap-container",ref:"flatmapContainer","element-loading-text":"Loading...","element-loading-background":"rgba(0, 0, 0, 0.3)"},_y={style:{height:"100%",width:"100%",position:"relative","overflow-y":"none"}},Py={style:{height:"100%",width:"100%"},ref:"display"},Vy={class:"beta-popovers"},Ly={key:2,class:"warning-text"},Ry={class:"bottom-right-control"},Fy=["innerHTML"],Dy={style:{"margin-bottom":"2px"}},$y={key:0,class:"viewing-mode-title"},zy=["onClick"],jy=["onClick"];function Hy(e,t,o,a,i,r){const s=n.resolveComponent("map-svg-sprite-color"),l=K.WarningFilled,d=ke,c=Kn,f=K.ArrowDown,h=n.resolveComponent("DrawToolbar"),p=n.resolveComponent("map-svg-icon"),g=fy,u=n.resolveComponent("tree-controls"),m=fs,y=K.ArrowLeft,b=Fr,w=Xt,T=en,S=na,v=Hn,E=Xr,I=es,M=n.resolveComponent("Tooltip"),B=ls,x=aa;return n.withDirectives((n.openBlock(),n.createElementBlock("div",Ny,[n.createVNode(s),n.createElementVNode("div",_y,[n.createElementVNode("div",Py,null,512),n.withDirectives(n.createElementVNode("div",Vy,[n.createElementVNode("div",null,[n.createVNode(c,{placement:"right","popper-class":"warning-popper flatmap-popper",teleported:!1,visible:e.hoverVisibilities[7].value,ref:"warningPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"warning-icon",onMouseover:t[7]||(t[7]=k=>r.showTooltip(7)),onMouseout:t[8]||(t[8]=k=>r.hideTooltip(7))},[o.displayWarning||o.isLegacy?(n.openBlock(),n.createBlock(d,{key:0},{default:n.withCtx(()=>[n.createVNode(l)]),_:1})):n.createCommentVNode("",!0),o.isLegacy?(n.openBlock(),n.createElementBlock(n.Fragment,{key:1},[t[31]||(t[31]=n.createElementVNode("span",{class:"warning-text"},"Legacy Map",-1)),n.createElementVNode("div",{class:"latest-map-text",onClick:t[6]||(t[6]=(...k)=>r.viewLatestMap&&r.viewLatestMap(...k))}," Click here for the latest map ")],64)):o.displayWarning?(n.openBlock(),n.createElementBlock("span",Ly,"Beta")):n.createCommentVNode("",!0)],32)]),default:n.withCtx(()=>[o.isLegacy?(n.openBlock(),n.createElementBlock("p",{key:0,onMouseover:t[0]||(t[0]=k=>r.showTooltip(7)),onMouseout:t[1]||(t[1]=k=>r.hideTooltip(7))}," This is a legacy map, you may view the latest map instead. ",32)):e.isFC?(n.openBlock(),n.createElementBlock("p",{key:1,onMouseover:t[2]||(t[2]=k=>r.showTooltip(7)),onMouseout:t[3]||(t[3]=k=>r.hideTooltip(7))},t[29]||(t[29]=[n.createTextVNode(" This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". ")]),32)):(n.openBlock(),n.createElementBlock("p",{key:2,onMouseover:t[4]||(t[4]=k=>r.showTooltip(7)),onMouseout:t[5]||(t[5]=k=>r.hideTooltip(7))},t[30]||(t[30]=[n.createTextVNode(" This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based "),n.createElementVNode("a",{href:"https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew",target:"_blank"}," ApiNATOMY ",-1),n.createTextVNode(" models available in "),n.createElementVNode("a",{href:"https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD",target:"_blank"}," SCKAN ",-1),n.createTextVNode(". New connectivity and species specificity will be added as the SPARC program progresses. ")]),32))]),_:1},8,["visible"])]),o.displayLatestChanges?(n.openBlock(),n.createBlock(c,{key:0,placement:"right",teleported:!1,trigger:"manual","popper-class":"warning-popper flatmap-popper",visible:e.hoverVisibilities[8].value,ref:"whatsNewPopover"},{reference:n.withCtx(()=>[o.displayLatestChanges?(n.openBlock(),n.createElementBlock("div",{key:0,class:"latest-changesicon",onMouseover:t[9]||(t[9]=k=>r.showTooltip(8)),onMouseout:t[10]||(t[10]=k=>r.hideTooltip(8))},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(l)]),_:1}),t[32]||(t[32]=n.createElementVNode("span",{class:"warning-text"},"What's new?",-1))],32)):n.createCommentVNode("",!0)]),default:n.withCtx(()=>t[33]||(t[33]=[n.createElementVNode("b",null,"Connectivity References",-1),n.createElementVNode("p",null," Connectivity references have been improved and available in various formats. ",-1),n.createElementVNode("b",null,"Improved state storing",-1),n.createElementVNode("p",null," Current selection and visibility filters are now stored when creating a permalink. ",-1)])),_:1},8,["visible"])):n.createCommentVNode("",!0)],512),[[n.vShow,!o.disableUI]]),n.withDirectives(n.createVNode(d,{class:n.normalizeClass(["minimap-resize",{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:"minimapResize",onClick:r.closeMinimap},{default:n.withCtx(()=>[n.createVNode(f)]),_:1},8,["class","onClick"]),[[n.vShow,e.minimapResizeShow]]),e.viewingMode==="Annotation"&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!o.disableUI?(n.openBlock(),n.createBlock(h,{key:0,mapCanvas:{containerHTML:this.$el,class:".maplibregl-canvas"},toolbarOptions:e.toolbarOptions,activeDrawTool:e.activeDrawTool,activeDrawMode:e.activeDrawMode,newlyDrawnEntry:e.drawnCreatedEvent,connectionEntry:e.connectionEntry,hoverVisibilities:e.hoverVisibilities,onClickToolbar:r.toolbarEvent,onFeatureTooltip:r.connectedFeatureTooltip,onConfirmDrawn:r.confirmDrawnFeature,onCancelDrawn:r.cancelDrawnFeature,onShowTooltip:r.showTooltip,onHideTooltip:r.hideTooltip,ref:"toolbarPopover"},null,8,["mapCanvas","toolbarOptions","activeDrawTool","activeDrawMode","newlyDrawnEntry","connectionEntry","hoverVisibilities","onClickToolbar","onFeatureTooltip","onConfirmDrawn","onCancelDrawn","onShowTooltip","onHideTooltip"])):n.createCommentVNode("",!0),n.withDirectives(n.createElementVNode("div",Ry,[n.createVNode(c,{content:"Zoom in",placement:"left",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[1].value,ref:"zoomInPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[11]||(t[11]=k=>r.zoomIn()),onMouseover:t[12]||(t[12]=k=>r.showTooltip(1)),onMouseout:t[13]||(t[13]=k=>r.hideTooltip(1))},[n.createVNode(p,{class:"icon-button zoomIn",icon:"zoomIn"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Zoom out",placement:"top-end",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[2].value,ref:"zoomOutPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[14]||(t[14]=k=>r.zoomOut()),onMouseover:t[15]||(t[15]=k=>r.showTooltip(2)),onMouseout:t[16]||(t[16]=k=>r.hideTooltip(2))},[n.createVNode(p,{class:"icon-button zoomOut",icon:"zoomOut"})],32)]),_:1},8,["visible"]),n.createVNode(c,{content:"Reset",placement:"top",teleported:!1,trigger:"manual",width:"70","popper-class":"flatmap-popper",visible:e.hoverVisibilities[3].value,ref:"zoomFitPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{class:"icon-button-container",onClick:t[17]||(t[17]=k=>r.resetView()),onMouseover:t[18]||(t[18]=k=>r.showTooltip(3)),onMouseout:t[19]||(t[19]=k=>r.hideTooltip(3))},[n.createVNode(p,{class:"icon-button fitWindow",icon:"fitWindow"})],32)]),default:n.withCtx(()=>[t[34]||(t[34]=n.createElementVNode("div",null,[n.createTextVNode(" Fit to "),n.createElementVNode("br"),n.createTextVNode(" window ")],-1))]),_:1},8,["visible"])],512),[[n.vShow,!o.disableUI]]),n.createVNode(c,{content:"Change pathway visibility",placement:"right",teleported:!1,trigger:"manual",offset:-18,"popper-class":"flatmap-popper",visible:e.hoverVisibilities[6].value,ref:"checkBoxPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["pathway-location",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.withDirectives((n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["pathway-container",{open:e.drawerOpen,close:!e.drawerOpen}]),style:n.normalizeStyle({"max-height":e.pathwaysMaxHeight+"px"})},[e.isFC?n.createCommentVNode("",!0):(n.openBlock(),n.createBlock(g,{key:0,identifierKey:"prompt",colourKey:"colour",styleKey:"style",legends:e.flatmapLegends,showStarInLegend:o.showStarInLegend,class:"svg-legends-container"},null,8,["legends","showStarInLegend"])),n.createVNode(c,{content:"Find these markers for data. The number inside the markers is the number of datasets available for each marker.",placement:"right",teleported:!1,width:"200",trigger:"manual","popper-class":"flatmap-popper flatmap-marker-popper",visible:e.hoverVisibilities[0].value,ref:"markerPopover"},{reference:n.withCtx(()=>[n.withDirectives(n.createElementVNode("div",{class:"flatmap-marker-help",innerHTML:e.flatmapMarker},null,8,Fy),[[n.vShow,e.hoverVisibilities[0].value],[B,void 0,"markerPopover"]])]),_:1},8,["visible"]),e.isFC&&e.systems&&e.systems.length>0?(n.openBlock(),n.createBlock(u,{key:1,class:"treeControls",mapType:"flatmap",title:"Systems",treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:r.systemSelected,onCheckAll:r.checkAllSystems,onChangeActive:r.ftuSelected,ref:"treeControls"},null,8,["treeData","active","hover","onCheckChanged","onCheckAll","onChangeActive"])):n.createCommentVNode("",!0),e.containsAlert&&e.alertOptions&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Alert",labelKey:"label",identifierKey:"key",selections:e.alertOptions,onChanged:r.alertSelected,onCheckboxMouseEnter:r.alertMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllAlerts,ref:"alertSelection",key:"alertSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.pathways&&e.pathways.length>0?(n.openBlock(),n.createBlock(m,{title:"Pathways",labelKey:"label",identifierKey:"type",colourStyle:"line",selections:e.pathways,showAsLegend:!o.showPathwayFilter,onChanged:r.pathwaysSelected,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllPathways,ref:"pathwaysSelection",key:"pathwaysSelection"},null,8,["selections","showAsLegend","onChanged","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&o.showPathwayFilter?(n.openBlock(),n.createBlock(m,{title:"Studied in",labelKey:"label",identifierKey:"taxon",helpMessage:"Evidence exists that this set of neuron populations have been studied in the given species.",selections:e.taxonConnectivity,onChanged:r.taxonsSelected,onCheckboxMouseEnter:r.taxonMouseEnterEmitted,onSelectionsDataChanged:r.onSelectionsDataChanged,onCheckAll:r.checkAllTaxons,ref:"taxonSelection",key:"taxonSelection"},null,8,["selections","onChanged","onCheckboxMouseEnter","onSelectionsDataChanged","onCheckAll"])):n.createCommentVNode("",!0)],6)),[[B,void 0,"checkBoxPopover"]]),n.createElementVNode("div",{onClick:t[20]||(t[20]=(...k)=>r.toggleDrawer&&r.toggleDrawer(...k)),class:n.normalizeClass(["drawer-button",{open:e.drawerOpen,close:!e.drawerOpen}])},[n.createVNode(d,null,{default:n.withCtx(()=>[n.createVNode(y)]),_:1})],2)],2),[[n.vShow,!o.disableUI&&r.requiresDrawer]])]),_:1},8,["visible"]),e.openMapRef?(n.openBlock(),n.createBlock(c,{key:1,ref:"open-map-popover","virtual-ref":e.openMapRef,placement:"top-start",width:"136",teleported:!1,trigger:"click","popper-class":"open-map-popper non-selectable","virtual-triggering":""},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.openMapOptions,k=>(n.openBlock(),n.createBlock(w,{key:k.key},{default:n.withCtx(()=>[n.createVNode(b,{type:"primary",plain:"",onClick:_=>e.$emit("open-map",k.key)},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(k.display),1)]),_:2},1032,["onClick"])]),_:2},1024))),128))]),_:1},8,["virtual-ref"])):n.createCommentVNode("",!0),n.createVNode(c,{ref:"backgroundPopover","virtual-ref":e.backgroundIconRef,placement:"top-start",width:"320",teleported:!1,trigger:"click","popper-class":"background-popper h-auto","virtual-triggering":""},{default:n.withCtx(()=>[n.createElementVNode("div",null,[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[35]||(t[35]=[n.createTextVNode("Viewing Mode")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createElementVNode("div",Dy,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.viewingModes,(k,_,V)=>(n.openBlock(),n.createElementBlock(n.Fragment,{key:_},[_===e.viewingMode?(n.openBlock(),n.createElementBlock("span",$y,[n.createElementVNode("b",null,n.toDisplayString(_),1)])):(n.openBlock(),n.createElementBlock("span",{key:1,class:"viewing-mode-unselected",onClick:q=>r.changeViewingMode(_)},n.toDisplayString(_),9,zy))],64))),128))]),n.createVNode(w,{class:"viewing-mode-description"},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(r.modeDescription),1)]),_:1}),e.viewingMode==="Annotation"&&e.offlineAnnotationEnabled?(n.openBlock(),n.createBlock(w,{key:0,class:"viewing-mode-description"},{default:n.withCtx(()=>t[36]||(t[36]=[n.createTextVNode(" (Anonymous annotate) ")])),_:1})):n.createCommentVNode("",!0)]),_:1}),e.viewingMode==="Annotation"&&e.authorisedUser?(n.openBlock(),n.createElementBlock(n.Fragment,{key:0},[n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[37]||(t[37]=[n.createTextVNode("Annotations From")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(v,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":t[21]||(t[21]=k=>e.annotationFrom=k),placeholder:"Select",class:"select-box","popper-class":"flatmap_dropdown",onChange:r.setAnnotationFrom},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.annotatedSource,k=>(n.openBlock(),n.createBlock(S,{key:k,label:k,value:k},{default:n.withCtx(()=>[n.createVNode(w,null,{default:n.withCtx(()=>[n.createVNode(T,{span:12},{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(k),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1})],64)):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:1,class:"backgroundSpacer"})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:2,class:"backgroundText"},{default:n.withCtx(()=>t[38]||(t[38]=[n.createTextVNode("Flight path display")])),_:1})):n.createCommentVNode("",!0),e.displayFlightPathOption?(n.openBlock(),n.createBlock(w,{key:3,class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":t[22]||(t[22]=k=>e.flightPath3DRadio=k),class:"flatmap-radio",onChange:r.setFlightPath3D},{default:n.withCtx(()=>[n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[39]||(t[39]=[n.createTextVNode("2D")])),_:1}),n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[40]||(t[40]=[n.createTextVNode("3D")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1})):n.createCommentVNode("",!0),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[41]||(t[41]=[n.createTextVNode("Organs display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.colourRadio,"onUpdate:modelValue":t[23]||(t[23]=k=>e.colourRadio=k),class:"flatmap-radio",onChange:r.setColour},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[42]||(t[42]=[n.createTextVNode("Colour")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[43]||(t[43]=[n.createTextVNode("Greyscale")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[44]||(t[44]=[n.createTextVNode("Outlines display")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[n.createVNode(I,{modelValue:e.outlinesRadio,"onUpdate:modelValue":t[24]||(t[24]=k=>e.outlinesRadio=k),class:"flatmap-radio",onChange:r.setOutlines},{default:n.withCtx(()=>[n.createVNode(E,{value:!0},{default:n.withCtx(()=>t[45]||(t[45]=[n.createTextVNode("Show")])),_:1}),n.createVNode(E,{value:!1},{default:n.withCtx(()=>t[46]||(t[46]=[n.createTextVNode("Hide")])),_:1})]),_:1},8,["modelValue","onChange"])]),_:1}),n.createVNode(w,{class:"backgroundSpacer"}),n.createVNode(w,{class:"backgroundText"},{default:n.withCtx(()=>t[47]||(t[47]=[n.createTextVNode("Change background")])),_:1}),n.createVNode(w,{class:"backgroundControl"},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.availableBackground,k=>(n.openBlock(),n.createElementBlock("div",{key:k,class:n.normalizeClass(["backgroundChoice",k,k==e.currentBackground?"active":""]),onClick:_=>r.backgroundChangeCallback(k)},null,10,jy))),128))]),_:1})])]),_:1},8,["virtual-ref"]),n.withDirectives(n.createElementVNode("div",{class:n.normalizeClass(["settings-group",{open:e.drawerOpen,close:!e.drawerOpen}])},[o.showOpenMapButton?(n.openBlock(),n.createBlock(w,{key:0},{default:n.withCtx(()=>[n.createVNode(c,{visible:e.hoverVisibilities[4].value,content:"Open new map",placement:"right",teleported:!1,"popper-class":"flatmap-popper",ref:"openMapPopover"},{reference:n.withCtx(()=>[o.enableOpenMapUI&&o.openMapOptions.length>0?(n.openBlock(),n.createElementBlock("div",{key:0,ref:"openMapRef",class:"icon-button-container",onMouseover:t[25]||(t[25]=k=>r.showTooltip(4)),onMouseout:t[26]||(t[26]=k=>r.hideTooltip(4))},[n.createVNode(p,{icon:"openMap",class:"icon-button open-map-button"})],544)):n.createCommentVNode("",!0)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0),o.showLocalSettings?(n.openBlock(),n.createBlock(w,{key:1},{default:n.withCtx(()=>[n.createVNode(c,{content:"Change settings",placement:"right",visible:e.hoverVisibilities[5].value,teleported:!1,trigger:"manual","popper-class":"flatmap-popper",ref:"settingsPopover"},{reference:n.withCtx(()=>[n.createElementVNode("div",{ref:"backgroundIconRef",class:"icon-button-container",onMouseover:t[27]||(t[27]=k=>r.showTooltip(5)),onMouseout:t[28]||(t[28]=k=>r.hideTooltip(5))},[n.createVNode(p,{icon:"changeBckgd",class:"icon-button"})],544)]),_:1},8,["visible"])]),_:1})):n.createCommentVNode("",!0)],2),[[n.vShow,!o.disableUI]]),e.tooltipDisplay?(n.openBlock(),n.createBlock(M,{key:2,ref:"tooltip",class:"tooltip",annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode==="Annotation",onAnnotation:r.commitAnnotationEvent,onOnActionClick:r.onActionClick},null,8,["annotationEntry","tooltipEntry","annotationDisplay","onAnnotation","onOnActionClick"])):n.createCommentVNode("",!0)])])),[[x,e.loading]])}const da=tn(xy,[["render",Hy],["__scopeId","data-v-3a537729"]]),gs={"NCBITaxon:10114":"01fedbf9-d783-509c-a10c-827941ab13da","NCBITaxon:9823":"a336ac04-24db-561f-a25f-1c994fe17410","NCBITaxon:9606":"42ed6323-f645-5fbe-bada-9581819cf689","NCBITaxon:10090":"25285fab-48a0-5620-a6a0-f9a0374837d5","NCBITaxon:9685":"73060497-46a6-52bf-b975-cac511c127cb"},Ky={name:"MultiFlatmapVuer",components:{Col:en,Row:Xt,Option:na,Select:Hn,Popover:Kn,FlatmapVuer:da},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),ca.on("onActionClick",e=>{this.resourceSelected(e)}),ca.on("open-pubmed-url",e=>{this.$emit("open-pubmed-url",e)})},methods:{initialise:function(){return new Promise(e=>{this.requireInitialisation?(this.requireInitialisation=!1,fetch(this.flatmapAPI).then(t=>t.json()).then(t=>{Object.keys(this.availableSpecies).forEach(a=>{const i=this.availableSpecies[a].uuid;if(i&&t.map(r=>r.uuid).indexOf(i)>0)this.speciesList[a]=this.availableSpecies[a];else for(let r=0;r<t.length;r++)if(this.availableSpecies[a].taxo===t[r].taxon)if(this.availableSpecies[a].biologicalSex){if(t[r].biologicalSex&&t[r].biologicalSex===this.availableSpecies[a].biologicalSex){this.speciesList[a]=this.availableSpecies[a];break}}else{this.speciesList[a]=this.availableSpecies[a];break}});let o=this.initial;if(this.state){const a=this.state.state;(!a||!a.uuid&&!a.entry)&&this.state.species?o=this.state.species:o=void 0}o&&(o&&this.speciesList[o]!==void 0?this.activeSpecies=o:this.activeSpecies=Object.keys(this.speciesList)[0],this.setSpecies(this.activeSpecies,this.state?this.state.state:void 0,5)),this.initialised=!0,e(),this.resolveList.forEach(a=>{a()})})):this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=n.markRaw(new ya.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit("mapmanager-loaded",this.mapManagerRef)))},resourceSelected:function(e){this.$emit("resource-selected",e)},FlatmapReady:function(e){this.$emit("ready",e)},getCurrentFlatmap:function(){return this.$refs[this.activeSpecies][0]},panZoomCallback:function(e){this.$emit("pan-zoom-callback",e)},onAnnotationClose:function(){this.$emit("annotation-close")},onAnnotationOpen:function(e){this.$emit("annotation-open",e)},updateOfflineAnnotationEnabled:function(e){this.$emit("update-offline-annotation-enabled",e)},onConnectivityInfoClose:function(){this.$emit("connectivity-info-close")},onConnectivityInfoOpen:function(e){this.$emit("connectivity-info-open",e)},onConnectivityError:function(e){this.$emit("connectivity-error",e)},onNeuronConnectionFeatureClick:function(e){this.$emit("neuron-connection-feature-click",e)},onSelectionsDataChanged:function(e){this.$emit("pathway-selection-changed",e)},showPopup:function(e,t,o){this.getCurrentFlatmap().showPopup(e,t,o)},showMarkerPopup:function(e,t,o){this.getCurrentFlatmap().showMarkerPopup(e,t,o)},setSpecies:function(e,t,o){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit("flatmapChanged",this.activeSpecies);else if(o){const a=o-1;a>=0&&this.$nextTick(()=>{this.setSpecies(e,t,a)})}},viewLatestMap:function(e){const t=Object.keys(this.speciesList);for(let o=0;o<t.length;o++){const a=this.speciesList[t[o]];if(!a.isLegacy&&a.taxo===e.entry&&a.biologicalSex===e.biologicalSex){this.setSpecies(t[o],e,0);return}}},createLegacyEntry:function(e,t,o){if(o&&t){let a="Legacy";return e.species&&(e.species.slice(0,6)==="Legacy"?a=e.species:a=a+` ${e.species}`),this.speciesList[a]={taxo:t,isLegacy:!0,displayWarning:!0},{species:a,state:{entry:t,uuid:o,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){const o=e.state;if(o.uuid){if(o.entry)return new Promise(()=>{const a={taxon:o.entry};o.biologicalSex&&(a.biologicalSex=o.biologicalSex),this.mapManagerRef.findMap(a).then(i=>{if(i.uuid!==o.uuid)return this.createLegacyEntry(e,o.entry,o.uuid)}).then(i=>{t(i||e)}).catch(()=>{t(e)})})}else if(o.entry){const a=o.entry in gs?gs[o.entry]:void 0,i=this.createLegacyEntry(e,o.entry,a);t(i||e)}}t(e)})},getState:function(){let e={species:this.activeSpecies,state:void 0},t=this.getCurrentFlatmap();return e.state=t.getState(),e},setState:function(e){e&&(this.loadMapManager(),this.updateState(e).then(t=>{this.initialise().then(()=>{t.species&&t.species!==this.activeSpecies?this.setSpecies(t.species,t.state,5):t.state&&this.getCurrentFlatmap().setState(t.state)})}))},activateTooltipByIndex:function(e){return e===this.helpModeActiveItem&&this.helpMode},onHelpModeLastItem:function(e){e&&this.$emit("help-mode-last-item",!0)},onTooltipShown:function(){this.$emit("shown-tooltip")},onMapTooltipShown:function(){this.$emit("shown-map-tooltip")},changeViewingMode:function(e){this.getCurrentFlatmap().changeViewingMode(e)},setConnectionType:function(e){this.getCurrentFlatmap().setConnectionType(e)}},props:{initial:{type:String,default:""},minZoom:{type:Number,default:1},renderAtMounted:{type:Boolean,default:!1},helpMode:{type:Boolean,default:!1},helpModeActiveItem:{type:Number,default:0},helpModeDialog:{type:Boolean,default:!1},helpModeLastItem:{type:Boolean,default:!1},displayMinimap:{type:Boolean,default:!1},showStarInLegend:{type:Boolean,default:!1},enableOpenMapUI:{type:Boolean,default:!1},openMapOptions:{type:Array},availableSpecies:{type:Object,default:function(){return{"Human Female":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000383",iconClass:"mapicon-icon_human",displayWarning:!0},"Human Male":{taxo:"NCBITaxon:9606",biologicalSex:"PATO:0000384",iconClass:"mapicon-icon_human",displayWarning:!0},Rat:{taxo:"NCBITaxon:10114",iconClass:"mapicon-icon_rat",displayLatestChanges:!0},Mouse:{taxo:"NCBITaxon:10090",iconClass:"mapicon-icon_mouse",displayWarning:!0},Pig:{taxo:"NCBITaxon:9823",iconClass:"mapicon-icon_pig",displayWarning:!0},Cat:{taxo:"NCBITaxon:9685",iconClass:"mapicon-icon_cat",displayWarning:!0}}}},state:{type:Object,default:void 0},mapManager:{type:Object,default:void 0},flatmapAPI:{type:String,default:"https://mapcore-demo.org/current/flatmap/v3/"},sparcAPI:{type:String,default:"https://api.sparc.science/"},disableUI:{type:Boolean,default:!1},connectivityInfoSidebar:{type:Boolean,default:!1},annotationSidebar:{type:Boolean,default:!1},showLocalSettings:{type:Boolean,default:!0},showOpenMapButton:{type:Boolean,default:!0},showPathwayFilter:{type:Boolean,default:!0}},data:function(){return{activeSpecies:void 0,speciesList:{},requireInitialisation:!0,resolveList:n.markRaw([]),initialised:!1,mapManagerRef:void 0}},watch:{state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0}}},Uy={class:"multi-container",ref:"multiContainer"},Wy={key:0,style:{position:"absolute","z-index":"100"}},qy={class:"select-box-icon"};function Gy(e,t,o,a,i,r){const s=na,l=Hn,d=Kn,c=da;return n.openBlock(),n.createElementBlock("div",Uy,[o.disableUI?n.createCommentVNode("",!0):(n.openBlock(),n.createElementBlock("div",Wy,[t[2]||(t[2]=n.createElementVNode("div",{class:"species-display-text"},"Species",-1)),n.createVNode(d,{content:"Select a species",placement:"right",trigger:"manual","popper-class":"flatmap-popper flatmap-teleport-popper right-popper",width:"max-content",visible:r.activateTooltipByIndex(0),teleported:!1,ref:"selectPopover"},{reference:n.withCtx(()=>[n.createVNode(l,{id:"flatmap-select",teleported:!1,modelValue:e.activeSpecies,"onUpdate:modelValue":t[0]||(t[0]=f=>e.activeSpecies=f),placeholder:"Select",class:"select-box","popper-class":"flatmap-dropdown",onChange:r.setSpecies},{default:n.withCtx(()=>[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,h)=>(n.openBlock(),n.createBlock(s,{key:h,label:h,value:h},{default:n.withCtx(()=>[n.createElementVNode("span",qy,[n.createElementVNode("i",{class:n.normalizeClass(f.iconClass)},null,2)]),n.createTextVNode(" "+n.toDisplayString(h),1)]),_:2},1032,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),_:1},8,["visible"])])),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.speciesList,(f,h)=>n.withDirectives((n.openBlock(),n.createBlock(c,{key:h,entry:f.taxo,uuid:f.uuid,biologicalSex:f.biologicalSex,displayWarning:f.displayWarning,displayLatestChanges:f.displayLatestChanges,isLegacy:f.isLegacy,ref_for:!0,ref:h,enableOpenMapUI:o.enableOpenMapUI,openMapOptions:o.openMapOptions,disableUI:o.disableUI,onViewLatestMap:r.viewLatestMap,onResourceSelected:r.resourceSelected,onReady:r.FlatmapReady,onPanZoomCallback:r.panZoomCallback,annotationSidebar:o.annotationSidebar,onAnnotationOpen:r.onAnnotationOpen,onAnnotationClose:r.onAnnotationClose,onUpdateOfflineAnnotationEnabled:r.updateOfflineAnnotationEnabled,connectivityInfoSidebar:o.connectivityInfoSidebar,onConnectivityInfoOpen:r.onConnectivityInfoOpen,onConnectivityInfoClose:r.onConnectivityInfoClose,onConnectivityError:r.onConnectivityError,onNeuronConnectionFeatureClick:r.onNeuronConnectionFeatureClick,onOpenMap:t[1]||(t[1]=p=>e.$emit("open-map",p)),onPathwaySelectionChanged:r.onSelectionsDataChanged,minZoom:o.minZoom,helpMode:e.activeSpecies==h&&o.helpMode,helpModeActiveItem:o.helpModeActiveItem,helpModeDialog:o.helpModeDialog,helpModeInitialIndex:-2,onHelpModeLastItem:r.onHelpModeLastItem,onShownTooltip:r.onTooltipShown,onShownMapTooltip:r.onMapTooltipShown,renderAtMounted:o.renderAtMounted,displayMinimap:o.displayMinimap,showStarInLegend:o.showStarInLegend,style:{height:"100%"},mapManager:e.mapManagerRef,flatmapAPI:o.flatmapAPI,sparcAPI:o.sparcAPI,showLocalSettings:o.showLocalSettings,showOpenMapButton:o.showOpenMapButton,showPathwayFilter:o.showPathwayFilter},null,8,["entry","uuid","biologicalSex","displayWarning","displayLatestChanges","isLegacy","enableOpenMapUI","openMapOptions","disableUI","onViewLatestMap","onResourceSelected","onReady","onPanZoomCallback","annotationSidebar","onAnnotationOpen","onAnnotationClose","onUpdateOfflineAnnotationEnabled","connectivityInfoSidebar","onConnectivityInfoOpen","onConnectivityInfoClose","onConnectivityError","onNeuronConnectionFeatureClick","onPathwaySelectionChanged","minZoom","helpMode","helpModeActiveItem","helpModeDialog","onHelpModeLastItem","onShownTooltip","onShownMapTooltip","renderAtMounted","displayMinimap","showStarInLegend","mapManager","flatmapAPI","sparcAPI","showLocalSettings","showOpenMapButton","showPathwayFilter"])),[[n.vShow,e.activeSpecies==h]])),128))],512)}const Jy=tn(Ky,[["render",Gy],["__scopeId","data-v-d3a99b3e"]]);H.FlatmapVuer=da,H.MultiFlatmapVuer=Jy,Object.defineProperty(H,Symbol.toStringTag,{value:"Module"})});
|