@abi-software/flatmapvuer 1.16.0 → 1.16.1-demo.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flatmapvuer.js +434 -378
- package/dist/flatmapvuer.umd.cjs +11 -3
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/components/FlatmapVuer.vue +2 -1
- package/src/services/somaLocationMarkers.js +125 -0
package/dist/flatmapvuer.umd.cjs
CHANGED
|
@@ -17,13 +17,21 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:i,curr
|
|
|
17
17
|
where source="${e_(e)}" and
|
|
18
18
|
knowledge like "%${t}%" order by source desc`;return(await n.queryKnowledge(r)).map(e=>JSON.parse(e)).map(e=>e.id)}function e_(e){return t_(e.mapMetadata)}function t_(e){let t=``;if(e?.connectivity){let n=e.connectivity;`knowledge-source`in n?t=n[`knowledge-source`]:`npo`in n&&(t=`${n.npo.release}-npo`)}return t}async function n_(e,t){let n=e_(e),r=`select knowledge from knowledge
|
|
19
19
|
where source="${n}"
|
|
20
|
-
order by source desc`;a_();let i=sessionStorage.getItem(`flatmap-knowledge`),a=sessionStorage.getItem(`flatmap-knowledge-source`);if(!i||a!==n){let e=(await t.queryKnowledge(r)).map(e=>JSON.parse(e));return sessionStorage.setItem(`flatmap-knowledge`,JSON.stringify(e)),sessionStorage.setItem(`flatmap-knowledge-source`,n),r_(),e}return JSON.parse(i)}function r_(){let e=new Date().getTime()+864e5;sessionStorage.setItem(`flatmap-knowledge-expiry`,e)}function i_(){[`flatmap-knowledge`,`flatmap-knowledge-expiry`,`flatmap-knowledge-source`].forEach(e=>{sessionStorage.removeItem(e)})}function a_(){let e=sessionStorage.getItem(`flatmap-knowledge-expiry`);new Date().getTime()>e&&i_()}var o_=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),s_=e=>{if(e==null)return[];if(Array.isArray(e))return e.flatMap(e=>s_(e));if(typeof e==`string`){let t=e.trim();if(!t)return[];try{let n=JSON.parse(t);if(n!==e)return s_(n)}catch{}return[t]}return typeof e==`number`||typeof e==`boolean`?[String(e)]:[]},c_=`<svg width="195px" height="24px" viewBox="0 0 200 24" fill="yellow"><path d="M22.0748 3.25583C22.4141 2.42845 23.5859 2.42845 23.9252 3.25583L25.6493 7.45955C25.793 7.80979 26.1221 8.04889 26.4995 8.07727L31.0303 8.41798C31.922 8.48504 32.2841 9.59942 31.6021 10.1778L28.1369 13.1166C27.8482 13.3614 27.7225 13.7483 27.8122 14.1161L28.8882 18.5304C29.1 19.3992 28.152 20.0879 27.3912 19.618L23.5255 17.2305C23.2034 17.0316 22.7966 17.0316 22.4745 17.2305L18.60881 19.618C17.84796 20.0879 16.9 19.3992 17.1118 18.5304L18.18785 14.1161C18.2775 13.7483 18.1518 13.3614 17.86309 13.1166L14.3979 10.1778C13.71588 9.59942 14.07796 8.48504 14.96971 8.41798L19.50046 8.07727C19.87794 8.04889 20.20704 7.80979 20.35068 7.45955L22.0748 3.25583Z" stroke="#000000" stroke-width="2"/><text x="47" y="52%" style="white-space: pre" dominant-baseline="middle" text-anchor="start" font-family="Asap, sans-serif" font-size="12" fill="#333333">Featured dataset marker</text></svg>`,l_=v(g(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define(r):typeof e==`object`?t.exports=r():n.ResizeSensor=r()})(typeof window<`u`?window:e,function(){if(typeof window>`u`)return null;var e=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)(),t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||function(t){return e.setTimeout(t,20)},n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||function(t){e.clearTimeout(t)};function r(e,t){var n=Object.prototype.toString.call(e),r=n===`[object Array]`||n===`[object NodeList]`||n===`[object HTMLCollection]`||n===`[object Object]`||typeof jQuery<`u`&&e instanceof jQuery||typeof Elements<`u`&&e instanceof Elements,i=0,a=e.length;if(r)for(;i<a;i++)t(e[i]);else t(e)}function i(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function a(e,t){Object.keys(t).forEach(function(n){e.style[n]=t[n]})}var o=function(e,s){var c=0;function l(){var e=[];this.add=function(t){e.push(t)};var t,n;this.call=function(r){for(t=0,n=e.length;t<n;t++)e[t].call(this,r)},this.remove=function(r){var i=[];for(t=0,n=e.length;t<n;t++)e[t]!==r&&i.push(e[t]);e=i},this.length=function(){return e.length}}function u(e,n){if(e){if(e.resizedAttached){e.resizedAttached.add(n);return}e.resizedAttached=new l,e.resizedAttached.add(n),e.resizeSensor=document.createElement(`div`),e.resizeSensor.dir=`ltr`,e.resizeSensor.className=`resize-sensor`;var r={pointerEvents:`none`,position:`absolute`,left:`0px`,top:`0px`,right:`0px`,bottom:`0px`,overflow:`hidden`,zIndex:`-1`,visibility:`hidden`,maxWidth:`100%`},o={position:`absolute`,left:`0px`,top:`0px`,transition:`0s`};a(e.resizeSensor,r);var s=document.createElement(`div`);s.className=`resize-sensor-expand`,a(s,r);var u=document.createElement(`div`);a(u,o),s.appendChild(u);var d=document.createElement(`div`);d.className=`resize-sensor-shrink`,a(d,r);var f=document.createElement(`div`);a(f,o),a(f,{width:`200%`,height:`200%`}),d.appendChild(f),e.resizeSensor.appendChild(s),e.resizeSensor.appendChild(d),e.appendChild(e.resizeSensor);var p=window.getComputedStyle(e),m=p?p.getPropertyValue(`position`):null;m!==`absolute`&&m!==`relative`&&m!==`fixed`&&m!==`sticky`&&(e.style.position=`relative`);var h=!1,g=0,_=i(e),v=0,y=0,b=!0;c=0;var x=function(){var t=e.offsetWidth,n=e.offsetHeight;u.style.width=t+10+`px`,u.style.height=n+10+`px`,s.scrollLeft=t+10,s.scrollTop=n+10,d.scrollLeft=t+10,d.scrollTop=n+10},S=function(){if(b){if(e.offsetWidth===0&&e.offsetHeight===0){c||=t(function(){c=0,S()});return}b=!1}x()};e.resizeSensor.resetSensor=S;var C=function(){g=0,h&&(v=_.width,y=_.height,e.resizedAttached&&e.resizedAttached.call(_))},w=function(){_=i(e),h=_.width!==v||_.height!==y,h&&!g&&(g=t(C)),S()},T=function(e,t,n){e.attachEvent?e.attachEvent(`on`+t,n):e.addEventListener(t,n)};T(s,`scroll`,w),T(d,`scroll`,w),c=t(function(){c=0,S()})}}r(e,function(e){u(e,s)}),this.detach=function(t){c||=(n(c),0),o.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};if(o.reset=function(e){r(e,function(e){e.resizeSensor.resetSensor()})},o.detach=function(e,t){r(e,function(e){e&&(e.resizedAttached&&typeof t==`function`&&(e.resizedAttached.remove(t),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached))})},typeof MutationObserver<`u`){var s=new MutationObserver(function(e){for(var t in e)if(e.hasOwnProperty(t))for(var n=e[t].addedNodes,r=0;r<n.length;r++)n[r].resizeSensor&&o.reset(n[r])});document.addEventListener(`DOMContentLoaded`,function(e){s.observe(document.body,{childList:!0,subtree:!0})})}return o})}))()),u_=o,d_=(0,c.defineStore)(`main`,{state:()=>({userProfile:{token:``}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function f_(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var p_=new f_,m_=`cannot be found on the map.`,h_=e=>{let t={lng:0,lat:0},n;return e.type===`Polygon`?e.coordinates.length&&(n=e.coordinates[0]):n=e.coordinates,n&&(e.type===`Point`?(t.lng+=parseFloat(n[0]),t.lat+=parseFloat(n[1])):(n.map(e=>{t.lng+=parseFloat(e[0]),t.lat+=parseFloat(e[1])}),t.lng/=n.length,t.lat/=n.length)),t},g_=(e,t)=>{let n=[],r=e.organs?e.organs:e.ftus,i=r?r.filter((e,t)=>r.findIndex(t=>t.label===e.label)===t):void 0;return i&&i.forEach(e=>{let r={label:e.label,models:e.models,key:`${t}.${e.label}`},i=g_(e,r.key);i.length>0&&(r.children=i),n.push(r)}),n},__={name:`FlatmapVuer`,components:{Button:$p,Col:Sh,Loading:lg,Radio:gh,Icon:yd,RadioGroup:_h,Row:xh,Select:Fm,Dialog:Hh,MapSvgIcon:r.MapSvgIcon,MapSvgSpriteColor:r.MapSvgSpriteColor,Tooltip:a.Tooltip,TreeControls:a.TreeControls,SelectionsGroup:vg,SvgLegends:Ug,ElIconWarningFilled:n.WarningFilled,ElIconArrowDown:n.ArrowDown,ElIconArrowLeft:n.ArrowLeft,DrawToolbar:a.DrawToolbar,FlatmapError:Rg},beforeCreate:function(){this.setStateRequired=!1},setup(e){let n=(0,t.inject)(`$annotator`);return n||(n=(0,t.markRaw)(new s.AnnotationService(`${e.flatmapAPI}annotator`)),(0,t.provide)(`$annotator`,n)),{annotator:n}},methods:{enableFeatureResetOnClick:function(e){this.mapImp&&this.mapImp.enableFeatureResetOnClick(e)},setVisibilityFilter:function(e){this.mapImp&&(this.mapImp.contextLost?this.filterToRestore=e?(0,t.markRaw)(JSON.parse(JSON.stringify(e))):void 0:(e?this.mapImp.setVisibilityFilter(e):this.mapImp.clearVisibilityFilter(),this.filterToRestore=void 0))},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){let t=Number(e),n={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(t=>t.id===e.trim())}};this.checkAndCreatePopups([n],!1)}else this.closeTooltip()}},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent],!1),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){let e=t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${e}`})}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()),!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){let e=Object.values(this.connectionEntry),t={type:`connectivity`,source:e[0],target:e[e.length-1],intermediates:e.filter((t,n)=>n!==0&&n!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},forceContextLoss:function(){this.mapImp&&!this.mapImp.contextLost&&!this.loading&&this.mapImp.forceContextLoss()},forceContextRestore:function(){this.mapImp&&(this.flatmapError=null,this.mapImp.forceContextRestore())},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 n;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.resource===this.serverURL).map(e=>e.item.id)):(n=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),`resource`in n&&(n=n.itemIds)),n},setFeatureAnnotated:async function(){if(this.mapImp){let e=await this.fetchAnnotatedItemIds();for(let t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let n;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.feature&&e.resource===this.serverURL).map(e=>e.feature);else{let r=await this.fetchAnnotatedItemIds(e,t);n=await this.annotator.drawnFeatures(this.userToken,this.serverURL,r),`resource`in n&&(n=n.features)}return n},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);let 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`,n=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=n,this.loading=!1,!this.featureAnnotationSubmitted)for(let e of n)this.mapImp.addAnnotationFeature(e)}},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`);let 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){let t={label:`All`,key:`All`,children:[]};e.forEach(e=>{let n={colour:e.colour,enabled:e.enabled,label:e.id,key:e.id},r=g_(e,n.key);r.length>0&&(n.children=r),t.children.push(n)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,Jg(this.mapImp,e).then(e=>{e.length&&e.forEach(e=>{let n=!0;t&&(n=t.checkAll?!0:t.checked.includes(e.taxon)),this.taxonConnectivity.push({...e,enabled:n}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.taxon,n)})})},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){let e=this.mapImp.map,n=this.mapImp.options.bounds,r=[[n[0],n[1]],[n[2],n[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=(0,t.markRaw)({initBounds:r})}},resetView:function(){if(this.mapImp){let 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={}){if(this.mapImp){let n=[],r=t.target?.length?t.target:[],i=[...this.mapImp.pathModelNodes(e)],a=await this.mapImp.queryPathsForFeatures(e);if(i.length){if(!r.length){let n=t.type?.length?t.type:[`all`],i=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),a=i?.ids?.dendrites.flat(1/0),o=i?.ids?.components.flat(1/0),s=i?.ids?.axons.flat(1/0),c=[];n.includes(`origins`)&&c.push(...a),n.includes(`components`)&&c.push(...o),n.includes(`destinations`)&&c.push(...s),n.includes(`all`)&&c.push(...a,...o,...s),r=[...new Set(c)]}i.forEach(e=>{this.mapImp.nodePathModels(e).forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)})})}else a.length&&(r.length?a.forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)}):n=a);return n=[...new Set([...n,...e])],n}},resetMapFilter:function(){let e=this.mapFilters.alert,t,n={"tile-layer":`pathways`},r={NOT:n};e.with&&!e.without?t={OR:[r,{AND:[n,{HAS:`alert`}]}]}:!e.with&&e.without?t={OR:[r,{AND:[n,{NOT:{HAS:`alert`}}]}]}:!e.with&&!e.without&&(t=r),this.setVisibilityFilter(t)},alertMouseEnterEmitted:function(e){if(this.mapImp){if(e.value){let t,n={"tile-layer":`pathways`},r={NOT:n};(e.key===`alert`||e.key===`withoutAlert`)&&(t={OR:[r,{AND:[n,e.key===`alert`?{HAS:`alert`}:{NOT:{HAS:`alert`}}]}]}),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,!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 n=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,n)})},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){let t=this.existDrawnFeatures.find(e=>e.id===this.selectedDrawnFeature.id);t&&t.connection&&(this.connectionEntry=t.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`);let n=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=n}t.type===`created`?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type===`updated`&&(this.previousEditEvent=t),this.previousDeletedEvent=t.type===`deleted`?t:{}},getTaxons:function(e){let t;return e.taxons&&(t=typeof e.taxons==`object`?e.taxons:JSON.parse(e.taxons)),t},eventCallback:function(){return(e,t,...n)=>{if(e===`annotation`){let r={feature:t,userData:n,eventType:e};this.annotationEventCallback(r,t)}else if(e===`context-lost`)this.onContextLost();else if(e===`context-restored`)this.onContextRestored();else if(e===`pan-zoom`)this.$emit(`pan-zoom-callback`,t);else{let r=t.label,i=[t.models],a=this.entry,o=this.biologicalSex,s=s_(t.alert),c=this.getTaxons(t),l=[{dataset:t.dataset,biologicalSex:o,taxonomy:a,resource:i,label:r,feature:t,userData:n,eventType:e,provenanceTaxonomy:c,alert:s}];if(e===`mouseenter`&&(this.lastHoveredFeature=t),e===`click`){let r=!t[0];if(!r){l=[];let r=t.mapUUID,i=new Set;for(let[s,c]of Object.entries(t))if(s!==`mapUUID`){let t=c.featureId,s=c.label,u=[c.models],d=this.getTaxons(c);if(i.has(t))continue;i.add(t),l.push({dataset:c.dataset,biologicalSex:o,taxonomy:a,resource:u,label:s,feature:c,userData:n,eventType:e,provenanceTaxonomy:d,alert:s_(c.alert),mapUUID:r})}}let i=r?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,i),this.viewingMode!==`Neuron Connection`&&(this.currentActive=i.models?i.models:``,this.activeDrawTool&&!this.isValidDrawnCreated)){let e=i.featureId||this.existDrawnFeatures.find(e=>e.id===i.id);if(this.activeDrawTool===`LineString`&&e){let e=i.featureId?i.featureId:i.id,t=i.label?i.label:`Feature ${i.id}`;this.connectionEntry[` ${e}`]=Object.assign({label:t},Object.fromEntries(Object.entries(i).filter(([e])=>[`featureId`,`models`].includes(e)).map(([e,t])=>[e===`featureId`?`id`:e,t])))}}t&&t.type!==`marker`&&!this.activeDrawTool&&this.checkAndCreatePopups(l)}else e===`mouseenter`&&this.viewingMode!==`Neuron Connection`&&(this.currentHover=t.models?t.models:``);this.$emit(`resource-selected`,l)}}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=e===`Exploration`?t.models?.startsWith(`ilxtr:`)?t.models:``:t.featureId||t.id},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(`.flatmap-tooltip-popup`).forEach(e=>e.remove()),this.lastHoveredFeature=null},createTooltipForConnectivity:function(e,t){let n=document.createElement(`div`);n.classList.add(`flatmap-feature-label`),e.forEach((t,r)=>{let{label:i}=t;if(n.append(o_(i)),r+1<e.length){let e=document.createElement(`hr`);n.appendChild(e)}}),this.mapImp.showPopup(t,n,{className:`custom-popup flatmap-tooltip-popup`,positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){let{connectivityInfo:t,data:n}=e,r=[],i=[],a=[],o=[];if(this.lastHoveredFeature=null,t&&t.featureId&&r.push(...t.featureId),this.mapImp){if(n.forEach(e=>{let t=this.mapImp.search(e.id);if(t?.results.length){let n=t?.results[0].featureId;a.push({featureId:n,...e})}else o.push(e)}),a.length){let e=a[0].featureId;this.mapImp.annotations.forEach(t=>{let n=t[`anatomical-nodes`];if(n){let r=n.join(``);a.every(e=>r.indexOf(e.id)!==-1)&&(e=t.featureId,i.push(e))}}),this.createTooltipForConnectivity(a,e)}else this.removeActiveTooltips();o.length&&this.emitConnectivityError(o);let e=r.reduce((e,t)=>{let n=this.mapImp.pathways.paths[t],r=n?n.connectivity:null;if(r){let t=r.flat(1/0);e.push(...t)}return e},[]),t=[...new Set(e)],s=[...r,...t],c=[...this.mapImp.modelFeatureIdList(s),...i];this.mapImp.selectGeoJSONFeatures(c)}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(e=>{this.mapImp.selectFeatures(e)})},searchConnectivitiesByReference:async function(e){let t=sessionStorage.getItem(`flatmap-knowledge`),n=[];return n=t?await Qg(e):await $g(this.mapImp,e,this.flatmapQueries),n},getFlatmapKnowledge:function(){let e=[],t=sessionStorage.getItem(`flatmap-knowledge`);return t&&(e=JSON.parse(t)),e},emitConnectivityError:function(e){this.$emit(`connectivity-error`,{data:{errorData:e,errorMessage:m_}})},checkConnectivityTooltipEntry:function(e){return e?.length?e.find(e=>e?.destinations?.length||e?.components?.length)!==void 0:!1},changeConnectivitySource:async function(e){let{entry:t,connectivitySource:n}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],n),this.tooltipEntry=this.tooltipEntry.map(e=>e.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(e):e),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit(`connectivity-info-open`,this.tooltipEntry))},checkAndCreatePopups:async function(e,t=!0){if(this.viewingMode===`Annotation`){let t=e.filter(e=>e.feature).map(e=>e.feature);if(t.length>0){if(this.annotationSidebar&&this.previousDeletedEvent.type===`deleted`&&(this.annotationEntry=[{...this.previousDeletedEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:`aborted`})),this.annotationEntry=[],t.forEach(e=>{this.annotationEntry.push({...e,resourceId:this.serverURL,featureId:e.featureId?e.featureId:e.feature?.id,offline:this.offlineAnnotationEnabled})}),t[0].feature)this.activeDrawTool||this.activeDrawMode||this.isValidDrawnCreated?(this.featureAnnotationSubmitted=!1,this.activeDrawTool&&this.createConnectivityBody(),this.displayTooltip(t[0].feature.id,h_(t[0].feature.geometry))):this.rollbackAnnotationEvent();else{let e=this.annotationEntry.filter(e=>e.featureId&&e.models).map(e=>e.models);e.length>0&&this.displayTooltip(e)}}else this.annotation={}}else if(this.viewingMode===`Neuron Connection`&&t){let t=e.map(e=>e.resource[0]);if(t.find(e=>!e.startsWith(`ilxtr:`))){let n=Array.isArray(t)?[...t]:[t];n.length===1&&n.push([]);let r=e[0].feature?.featureId,i=this.mapImp.annotations.get(r),o=i?.[`anatomical-nodes`],s=i?.models,c,l=n,u=i?.models;o?.length&&(c=o.find(e=>JSON.parse(e)[0]===s)),c?l=JSON.parse(c):u&&(l=[u,[]]);let d=this.mapImp.knowledgeSource,f=l.flat(1/0),p=[...new Set(f)],m=(await(0,a.fetchLabels)(this.flatmapAPI,p)).reduce((e,t)=>{let n=t[0],r=JSON.parse(t[1]);return e.push({id:n,label:r.label,source:r.source}),e},[]);m.sort((e,t)=>e.id===t.id?e.source===d&&t.source!==d?-1:+(e.source!==d&&t.source===d):e.id.localeCompare(t.id));let h=[];for(let e=0;e<p.length;e++){let t=m.find(t=>t.id===p[e]);t&&h.push(t.label)}let g=o_(h.join(`, `)),_={facet:JSON.stringify(l),facetPropPath:`flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,tagLabel:g,term:this.connectionType};this.connectivityFilters.some(e=>e.facet===_.facet&&e.facetPropPath===_.facetPropPath)||this.connectivityFilters.push(_),this.$emit(`neuron-connection-feature-click`,{filters:this.connectivityFilters,search:``})}else await this.openConnectivityInfo(e)}else await this.openConnectivityInfo(e)},openConnectivityInfo:async function(e){n_(this.mapImp,this.flatmapQueries);let t=[];if(this.tooltipEntry=e.filter(e=>e.resource[0]in this.mapImp.pathways.paths).map(e=>({title:e.label,featureId:e.resource,ready:!1})),this.tooltipEntry.length){this.$emit(`connectivity-info-open`,this.tooltipEntry);for(let n=0;n<e.length;n++)t.push(await this.getKnowledgeTooltip(e[n]));this.tooltipEntry=await Promise.all(t);let n=this.tooltipEntry.map(e=>e.featureId[0]);n.length>0&&this.displayTooltip(n)}},updateConnectivityFilters:function(e){e.length&&(this.connectivityFilters=e.filter(e=>e.facet.toLowerCase()!==`show all`))},resetConnectivityfilters:function(e){this.connectivityFilters=e.length?this.connectivityFilters.filter(t=>e.some(e=>e.facetPropPath===t.facetPropPath&&e.facet!==t.facet)):[]},getKnowledgeTooltip:async function(e){let t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e),n=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(n.featuresAlert=s_(e.alert),n.knowledgeSource=e_(this.mapImp),n.mapId=this.mapImp.mapMetadata.id,n.mapuuid=this.mapImp.mapMetadata.uuid),n.ready=!0,n},popUpCssHacks:function(){let 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`}),this.lastHoveredFeature=null},showPopup:function(e,t,n){let r=n;this.mapImp&&(r?r.className||(r.className=`custom-popup`):r={className:`custom-popup`,positionAtLastClick:!0},this.mapImp.showPopup(e,t,r))},showMarkerPopup:function(e,t,n){this.mapImp&&this.mapImp.showMarkerPopup(e,t,n)},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){let t=this.hoverVisibilities.length,n=t-1,r=this.hoverVisibilities[this.helpModeActiveIndex];if(r){let t=r?.refs,n=r?.ref,i=this.$refs[t||n];if(i){let{parentElement:e,nextElementSibling:t}=i.$el,n=e=>e&&(e.classList.contains(`pathway-container`)||e.classList.contains(`pathway-location`));(n(e)||n(t))&&(this.requiresDrawer?this.drawerOpen=!0:this.helpModeActiveIndex+=1)}else this.helpModeActiveIndex+=1,this.setHelpMode(e)}this.hoverVisibilities[this.helpModeActiveIndex]?.ref===`checkBoxPopover`&&!this.showPathwayFilter&&(this.helpModeActiveIndex+=1,this.setHelpMode(e)),e||(this.helpModeActiveIndex=this.helpModeInitialIndex),this.viewingMode!==`Annotation`&&this.helpModeActiveIndex>9&&(this.helpModeActiveIndex=n),e&&this.helpModeActiveIndex>=n&&this.$emit(`help-mode-last-item`,!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(e=>{e.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1?(this.closeFlatmapHelpPopup(),setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.value=!1}),this.showTooltip(this.helpModeActiveIndex,200)},300)):this.helpModeActiveIndex===-1&&this.openFlatmapHelpPopup():(this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.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 n,r={className:`flatmapvuer-popover`};if(t)n=e,r.annotationFeatureGeometry=t,this.annotationEntry.length&&(r.annotationEvent={type:this.annotationEntry[0].type,feature:this.annotationEntry[0].feature});else{let t=Array.isArray(e)?e[0]:e;t&&(n=this.mapImp.modelFeatureIds(t)[0]),this.activeDrawTool||(r.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}),n&&!this.disableUI&&(this.viewingMode===`Annotation`&&!this.annotationSidebar||this.viewingMode===`Exploration`&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(n,this.$refs.tooltip.$el,r),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){let{offsetX:n=0,offsetY:r=0,zoom:i=4}=t,a=this.mapImp.map,o=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),o?.length&&setTimeout(()=>{a.fitBounds(o,{offset:[n,r],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 n of t.values())n.label&&e.push(n.label);return Array.from(new Set(e))}},getVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=this.$refs[t];n&&(e[t]=n.getState())}),this.$refs.treeControls&&(e.systemsSelection=this.$refs.treeControls.$refs.regionTree.getCheckedKeys().filter(e=>!e.includes(`.`)))},setVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=e[t];if(n){let e=this.$refs[t];e&&e.setState(n)}}),`systemsSelection`in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(t=>{this.mapImp.enableSystem(t.key,e.systemsSelection.includes(t.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()},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){let t=e.searchTerm;this.searchAndShowResult(t,!0,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){let t=1.6;(e===t||e>t)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0,this.flatmapError=null;let t={taxon:this.entry};this.uuid&&(t.uuid=this.uuid),e?(e.uuid?t={uuid:e.uuid}:e.entry&&(t.taxon=e.entry),e.biologicalSex?t.biologicalSex=e.biologicalSex:t.taxon===`NCBITaxon:9606`&&(t.biologicalSex=`PATO:0000384`)):this.biologicalSex&&(t.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(t,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:!1,container:this.$refs.display,tooltipDelay:15}).then(t=>{this.mapImp=t,this.serverURL=this.mapImp.makeServerUrl(``).slice(0,-1);let n=this.mapImp.details.version;this.setFlightPathInfo(n);let r=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(r),this.$nextTick(()=>this.restoreMapState(r))}).catch(e=>{if(console.error(`Flatmap loading error:`,e),this.flatmapError={},e.message&&e.message.indexOf(`Unknown map`)!==-1?(this.flatmapError.title=`Unknown Map!`,this.flatmapError.messages=Object.keys(t).map(e=>`${e===`uuid`?`UUID`:o_(e)}: ${t[e]}`)):(this.flatmapError.title=`Error Loading Map!`,this.flatmapError.messages=[e.message?e.message:e.toString(),`Please try again later or contact support if the problem persists.`]),this.$parent?.$refs?.multiContainer){let e=this.$parent;this.flatmapError.button={text:`Load Default Map`,callback:()=>{let t=e.initial;e.setSpecies(t,void 0,3)}}}this.loading=!1})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){let e=this.$refs.display;if(e){let t=getComputedStyle(e),n=parseInt(t.paddingTop)+parseInt(t.paddingBottom),r=e.clientHeight-n;this.pathwaysMaxHeight=r-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&this.mapImp.resize()}catch{console.error(`Map resize error`)}},getFilterSources:function(){let e=[`kind`,`taxons`],t=new Set,n=new Set,r=new Map;for(let i of this.mapImp.annotations.values())if(i.source){`alert`in i?t.add(i.source):n.add(i.source);for(let[t,n]of Object.entries(i))if(e.includes(t)){r.has(t)||r.set(t,new Map);let e=r.get(t),a=t=>{let n=t;e.has(n)||e.set(n,new Set),e.get(n).add(`${i.source}`)};Array.isArray(n)?n.forEach(a):a(n)}}let i={alert:{with:[...t],without:[...n]}};for(let[e,t]of r.entries()){i[e]={};for(let[n,r]of t.entries())i[e][n]=[...r.values()]}return i},getFilterOptions:async function(e,t){let n=t||this.getFlatmapKnowledge(),r=this.pathways;return await(0,a.getFlatmapFilterOptions)(this.flatmapAPI,e,n,r)},onFlatmapReady:function(e){this.sensor=(0,t.markRaw)(new l_.default(this.$refs.display,this.mapResize)),this.mapImp.options?.style===`functional`&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.pathways=this.pathways.filter(e=>e.enabled&&e.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.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.$emit(`ready`,this)},handleMapClick:function(){let e=this.mapImp.map;e&&e.on(`click`,e=>{this.connectivityDataSource||this.$emit(`connectivity-info-close`),this.connectivityDataSource=``})},onContextLost:function(){this.lastViewport=(0,t.markRaw)(this.mapImp.getState()),this.flatmapError={},this.flatmapError.title=`GL context lost!`,this.flatmapError.messages=[`A display issue has occurred due
|
|
20
|
+
order by source desc`;a_();let i=sessionStorage.getItem(`flatmap-knowledge`),a=sessionStorage.getItem(`flatmap-knowledge-source`);if(!i||a!==n){let e=(await t.queryKnowledge(r)).map(e=>JSON.parse(e));return sessionStorage.setItem(`flatmap-knowledge`,JSON.stringify(e)),sessionStorage.setItem(`flatmap-knowledge-source`,n),r_(),e}return JSON.parse(i)}function r_(){let e=new Date().getTime()+864e5;sessionStorage.setItem(`flatmap-knowledge-expiry`,e)}function i_(){[`flatmap-knowledge`,`flatmap-knowledge-expiry`,`flatmap-knowledge-source`].forEach(e=>{sessionStorage.removeItem(e)})}function a_(){let e=sessionStorage.getItem(`flatmap-knowledge-expiry`);new Date().getTime()>e&&i_()}var o_=e=>e&&e.charAt(0).toUpperCase()+e.slice(1),s_=e=>{if(e==null)return[];if(Array.isArray(e))return e.flatMap(e=>s_(e));if(typeof e==`string`){let t=e.trim();if(!t)return[];try{let n=JSON.parse(t);if(n!==e)return s_(n)}catch{}return[t]}return typeof e==`number`||typeof e==`boolean`?[String(e)]:[]},c_=`<svg width="195px" height="24px" viewBox="0 0 200 24" fill="yellow"><path d="M22.0748 3.25583C22.4141 2.42845 23.5859 2.42845 23.9252 3.25583L25.6493 7.45955C25.793 7.80979 26.1221 8.04889 26.4995 8.07727L31.0303 8.41798C31.922 8.48504 32.2841 9.59942 31.6021 10.1778L28.1369 13.1166C27.8482 13.3614 27.7225 13.7483 27.8122 14.1161L28.8882 18.5304C29.1 19.3992 28.152 20.0879 27.3912 19.618L23.5255 17.2305C23.2034 17.0316 22.7966 17.0316 22.4745 17.2305L18.60881 19.618C17.84796 20.0879 16.9 19.3992 17.1118 18.5304L18.18785 14.1161C18.2775 13.7483 18.1518 13.3614 17.86309 13.1166L14.3979 10.1778C13.71588 9.59942 14.07796 8.48504 14.96971 8.41798L19.50046 8.07727C19.87794 8.04889 20.20704 7.80979 20.35068 7.45955L22.0748 3.25583Z" stroke="#000000" stroke-width="2"/><text x="47" y="52%" style="white-space: pre" dominant-baseline="middle" text-anchor="start" font-family="Asap, sans-serif" font-size="12" fill="#333333">Featured dataset marker</text></svg>`,l_=v(g(((e,t)=>{(function(n,r){typeof define==`function`&&define.amd?define(r):typeof e==`object`?t.exports=r():n.ResizeSensor=r()})(typeof window<`u`?window:e,function(){if(typeof window>`u`)return null;var e=typeof window<`u`&&window.Math==Math?window:typeof self<`u`&&self.Math==Math?self:Function(`return this`)(),t=e.requestAnimationFrame||e.mozRequestAnimationFrame||e.webkitRequestAnimationFrame||function(t){return e.setTimeout(t,20)},n=e.cancelAnimationFrame||e.mozCancelAnimationFrame||e.webkitCancelAnimationFrame||function(t){e.clearTimeout(t)};function r(e,t){var n=Object.prototype.toString.call(e),r=n===`[object Array]`||n===`[object NodeList]`||n===`[object HTMLCollection]`||n===`[object Object]`||typeof jQuery<`u`&&e instanceof jQuery||typeof Elements<`u`&&e instanceof Elements,i=0,a=e.length;if(r)for(;i<a;i++)t(e[i]);else t(e)}function i(e){if(!e.getBoundingClientRect)return{width:e.offsetWidth,height:e.offsetHeight};var t=e.getBoundingClientRect();return{width:Math.round(t.width),height:Math.round(t.height)}}function a(e,t){Object.keys(t).forEach(function(n){e.style[n]=t[n]})}var o=function(e,s){var c=0;function l(){var e=[];this.add=function(t){e.push(t)};var t,n;this.call=function(r){for(t=0,n=e.length;t<n;t++)e[t].call(this,r)},this.remove=function(r){var i=[];for(t=0,n=e.length;t<n;t++)e[t]!==r&&i.push(e[t]);e=i},this.length=function(){return e.length}}function u(e,n){if(e){if(e.resizedAttached){e.resizedAttached.add(n);return}e.resizedAttached=new l,e.resizedAttached.add(n),e.resizeSensor=document.createElement(`div`),e.resizeSensor.dir=`ltr`,e.resizeSensor.className=`resize-sensor`;var r={pointerEvents:`none`,position:`absolute`,left:`0px`,top:`0px`,right:`0px`,bottom:`0px`,overflow:`hidden`,zIndex:`-1`,visibility:`hidden`,maxWidth:`100%`},o={position:`absolute`,left:`0px`,top:`0px`,transition:`0s`};a(e.resizeSensor,r);var s=document.createElement(`div`);s.className=`resize-sensor-expand`,a(s,r);var u=document.createElement(`div`);a(u,o),s.appendChild(u);var d=document.createElement(`div`);d.className=`resize-sensor-shrink`,a(d,r);var f=document.createElement(`div`);a(f,o),a(f,{width:`200%`,height:`200%`}),d.appendChild(f),e.resizeSensor.appendChild(s),e.resizeSensor.appendChild(d),e.appendChild(e.resizeSensor);var p=window.getComputedStyle(e),m=p?p.getPropertyValue(`position`):null;m!==`absolute`&&m!==`relative`&&m!==`fixed`&&m!==`sticky`&&(e.style.position=`relative`);var h=!1,g=0,_=i(e),v=0,y=0,b=!0;c=0;var x=function(){var t=e.offsetWidth,n=e.offsetHeight;u.style.width=t+10+`px`,u.style.height=n+10+`px`,s.scrollLeft=t+10,s.scrollTop=n+10,d.scrollLeft=t+10,d.scrollTop=n+10},S=function(){if(b){if(e.offsetWidth===0&&e.offsetHeight===0){c||=t(function(){c=0,S()});return}b=!1}x()};e.resizeSensor.resetSensor=S;var C=function(){g=0,h&&(v=_.width,y=_.height,e.resizedAttached&&e.resizedAttached.call(_))},w=function(){_=i(e),h=_.width!==v||_.height!==y,h&&!g&&(g=t(C)),S()},T=function(e,t,n){e.attachEvent?e.attachEvent(`on`+t,n):e.addEventListener(t,n)};T(s,`scroll`,w),T(d,`scroll`,w),c=t(function(){c=0,S()})}}r(e,function(e){u(e,s)}),this.detach=function(t){c||=(n(c),0),o.detach(e,t)},this.reset=function(){e.resizeSensor.resetSensor()}};if(o.reset=function(e){r(e,function(e){e.resizeSensor.resetSensor()})},o.detach=function(e,t){r(e,function(e){e&&(e.resizedAttached&&typeof t==`function`&&(e.resizedAttached.remove(t),e.resizedAttached.length())||e.resizeSensor&&(e.contains(e.resizeSensor)&&e.removeChild(e.resizeSensor),delete e.resizeSensor,delete e.resizedAttached))})},typeof MutationObserver<`u`){var s=new MutationObserver(function(e){for(var t in e)if(e.hasOwnProperty(t))for(var n=e[t].addedNodes,r=0;r<n.length;r++)n[r].resizeSensor&&o.reset(n[r])});document.addEventListener(`DOMContentLoaded`,function(e){s.observe(document.body,{childList:!0,subtree:!0})})}return o})}))()),u_=o,d_=`#1b7f6b`,f_=`#f4f1de`,p_=`#12312b`,m_=`99+`,h_=function(e){return(Array.isArray(e)?e:[]).map(e=>({label:String(e?.label||``).trim(),curie:String(e?.curie||``).trim(),count:Number(e?.count||0)})).filter(e=>e.curie&&e.count>0)},g_=function(e){return e>99?m_:String(e)},__=function(e){let t=document.createElement(`div`);return t.className=`flatmapvuer-soma-location-marker`,t.title=e.label||e.curie,t.style.width=`34px`,t.style.height=`48px`,t.style.display=`flex`,t.style.alignItems=`center`,t.style.justifyContent=`center`,t.style.transform=`translate(-50%, -100%)`,t.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="-1 -1 27 42" width="34" height="48" aria-hidden="true">
|
|
21
|
+
<ellipse style="fill: rgb(0, 0, 0); fill-opacity: 0.18;" cx="12" cy="36" rx="8" ry="4"/>
|
|
22
|
+
<path d="M12.25.25a12.254 12.254 0 0 0-12 12.494
|
|
23
|
+
c0 6.444 6.488 12.109 11.059 22.564.549 1.256 1.333 1.256 1.882 0
|
|
24
|
+
C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z"
|
|
25
|
+
style="fill:${d_};stroke:${f_};stroke-width:1.1"/>
|
|
26
|
+
<circle cx="12.5" cy="12.5" r="8" fill="${f_}"/>
|
|
27
|
+
<text x="12.5" y="16.1" text-anchor="middle" style="font-size:7.5px;font-weight:700;fill:${p_};font-family:Arial, sans-serif">${g_(e.count)}</text>
|
|
28
|
+
</svg>`,t},v_=function(e,t){let n=Array.isArray(e?.modelFeatureIds?.(t))?e.modelFeatureIds(t):[],r=[],i=new Set;for(let t of n){let n=e.annotation(t),a=String(n?.uri||``).trim();a&&!i.has(a)&&(i.add(a),r.push({type:`feature-uri`,value:a}))}return!r.length&&n.length&&r.push({type:`model`,value:t}),r},y_=function(e){if(!e||e.addSomaLocationMarkers)return e;let t=[];return e.clearSomaLocationMarkers=function(){t.forEach(t=>{e.removeMarker(t)}),t=[]},e.addSomaLocationMarkers=function(n){let r=h_(n),i=[];return e.clearSomaLocationMarkers(),r.forEach(n=>{let r=v_(e,n.curie);if(!r.length)return;let a=!1;r.forEach(r=>{let i=__(n),o=[];if(r.type===`feature-uri`)o=e.addMarkerByFeatureUri(r.value,{element:i});else if(r.type===`model`){let t=e.addMarker(r.value,{element:i});o=t>-1?[t]:[]}o.length&&(t.push(...o),a=!0)}),a&&i.push(n)}),i},e},b_=(0,c.defineStore)(`main`,{state:()=>({userProfile:{token:``}}),getters:{userToken(e){return e.userProfile.token}},actions:{setUserToken(e){this.userProfile.token=e}}});function x_(e){return{all:e||=new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map(function(e){e(n)}),(r=e.get(`*`))&&r.slice().map(function(e){e(t,n)})}}}var S_=new x_,C_=`cannot be found on the map.`,w_=e=>{let t={lng:0,lat:0},n;return e.type===`Polygon`?e.coordinates.length&&(n=e.coordinates[0]):n=e.coordinates,n&&(e.type===`Point`?(t.lng+=parseFloat(n[0]),t.lat+=parseFloat(n[1])):(n.map(e=>{t.lng+=parseFloat(e[0]),t.lat+=parseFloat(e[1])}),t.lng/=n.length,t.lat/=n.length)),t},T_=(e,t)=>{let n=[],r=e.organs?e.organs:e.ftus,i=r?r.filter((e,t)=>r.findIndex(t=>t.label===e.label)===t):void 0;return i&&i.forEach(e=>{let r={label:e.label,models:e.models,key:`${t}.${e.label}`},i=T_(e,r.key);i.length>0&&(r.children=i),n.push(r)}),n},E_={name:`FlatmapVuer`,components:{Button:$p,Col:Sh,Loading:lg,Radio:gh,Icon:yd,RadioGroup:_h,Row:xh,Select:Fm,Dialog:Hh,MapSvgIcon:r.MapSvgIcon,MapSvgSpriteColor:r.MapSvgSpriteColor,Tooltip:a.Tooltip,TreeControls:a.TreeControls,SelectionsGroup:vg,SvgLegends:Ug,ElIconWarningFilled:n.WarningFilled,ElIconArrowDown:n.ArrowDown,ElIconArrowLeft:n.ArrowLeft,DrawToolbar:a.DrawToolbar,FlatmapError:Rg},beforeCreate:function(){this.setStateRequired=!1},setup(e){let n=(0,t.inject)(`$annotator`);return n||(n=(0,t.markRaw)(new s.AnnotationService(`${e.flatmapAPI}annotator`)),(0,t.provide)(`$annotator`,n)),{annotator:n}},methods:{enableFeatureResetOnClick:function(e){this.mapImp&&this.mapImp.enableFeatureResetOnClick(e)},setVisibilityFilter:function(e){this.mapImp&&(this.mapImp.contextLost?this.filterToRestore=e?(0,t.markRaw)(JSON.parse(JSON.stringify(e))):void 0:(e?this.mapImp.setVisibilityFilter(e):this.mapImp.clearVisibilityFilter(),this.filterToRestore=void 0))},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){let t=Number(e),n={feature:t?this.mapImp.featureProperties(t):{feature:this.existDrawnFeatures.find(t=>t.id===e.trim())}};this.checkAndCreatePopups([n],!1)}else this.closeTooltip()}},confirmDrawnFeature:function(){this.isValidDrawnCreated&&(this.checkAndCreatePopups([this.drawnCreatedEvent],!1),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){let e=t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`);this.changeAnnotationDrawMode({mode:`draw${e}`})}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()),!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){let e=Object.values(this.connectionEntry),t={type:`connectivity`,source:e[0],target:e[e.length-1],intermediates:e.filter((t,n)=>n!==0&&n!==e.length-1)};this.annotationEntry[0].body=t}},changeAnnotationDrawMode:function(e){this.mapImp&&this.mapImp.changeAnnotationDrawMode(e)},clearAnnotationFeature:function(){this.mapImp&&this.mapImp.clearAnnotationFeature()},forceContextLoss:function(){this.mapImp&&!this.mapImp.contextLost&&!this.loading&&this.mapImp.forceContextLoss()},forceContextRestore:function(){this.mapImp&&(this.flatmapError=null,this.mapImp.forceContextRestore())},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 n;return this.offlineAnnotationEnabled?(this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.resource===this.serverURL).map(e=>e.item.id)):(n=await this.annotator.annotatedItemIds(this.userToken,this.serverURL,e,t),`resource`in n&&(n=n.itemIds)),n},setFeatureAnnotated:async function(){if(this.mapImp){let e=await this.fetchAnnotatedItemIds();for(let t of e)this.mapImp.setFeatureAnnotated(t)}},fetchDrawnFeatures:async function(e,t){let n;if(this.offlineAnnotationEnabled)this.offlineAnnotations=JSON.parse(sessionStorage.getItem(`anonymous-annotation`))||[],n=this.offlineAnnotations.filter(e=>e.feature&&e.resource===this.serverURL).map(e=>e.feature);else{let r=await this.fetchAnnotatedItemIds(e,t);n=await this.annotator.drawnFeatures(this.userToken,this.serverURL,r),`resource`in n&&(n=n.features)}return n},addAnnotationFeature:async function(){if(this.mapImp){this.featureAnnotationSubmitted||(this.clearAnnotationFeature(),this.loading=!0);let 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`,n=await this.fetchDrawnFeatures(e,t);if(this.existDrawnFeatures=n,this.loading=!1,!this.featureAnnotationSubmitted)for(let e of n)this.mapImp.addAnnotationFeature(e)}},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`);let 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){let t={label:`All`,key:`All`,children:[]};e.forEach(e=>{let n={colour:e.colour,enabled:e.enabled,label:e.id,key:e.id},r=T_(e,n.key);r.length>0&&(n.children=r),t.children.push(n)}),this.systems.push(t)}},processTaxon:function(e,t){this.taxonConnectivity.length=0,Jg(this.mapImp,e).then(e=>{e.length&&e.forEach(e=>{let n=!0;t&&(n=t.checkAll?!0:t.checked.includes(e.taxon)),this.taxonConnectivity.push({...e,enabled:n}),this.mapImp&&this.mapImp.enableConnectivityByTaxonIds(e.taxon,n)})})},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){let e=this.mapImp.map,n=this.mapImp.options.bounds,r=[[n[0],n[1]],[n[2],n[3]]];e.setMaxBounds(null),e.setRenderWorldCopies(!1),this.initMapState=(0,t.markRaw)({initBounds:r})}},resetView:function(){if(this.mapImp){let 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={}){if(this.mapImp){let n=[],r=t.target?.length?t.target:[],i=[...this.mapImp.pathModelNodes(e)],a=await this.mapImp.queryPathsForFeatures(e);if(i.length){if(!r.length){let n=t.type?.length?t.type:[`all`],i=await this.flatmapQueries.queryForConnectivityNew(this.mapImp,e[0]),a=i?.ids?.dendrites.flat(1/0),o=i?.ids?.components.flat(1/0),s=i?.ids?.axons.flat(1/0),c=[];n.includes(`origins`)&&c.push(...a),n.includes(`components`)&&c.push(...o),n.includes(`destinations`)&&c.push(...s),n.includes(`all`)&&c.push(...a,...o,...s),r=[...new Set(c)]}i.forEach(e=>{this.mapImp.nodePathModels(e).forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)})})}else a.length&&(r.length?a.forEach(e=>{let t=this.mapImp.pathModelNodes(e).map(e=>this.mapImp.featureProperties(e).models);r.filter(e=>t.includes(e)).length&&!n.includes(e)&&n.push(e)}):n=a);return n=[...new Set([...n,...e])],n}},resetMapFilter:function(){let e=this.mapFilters.alert,t,n={"tile-layer":`pathways`},r={NOT:n};e.with&&!e.without?t={OR:[r,{AND:[n,{HAS:`alert`}]}]}:!e.with&&e.without?t={OR:[r,{AND:[n,{NOT:{HAS:`alert`}}]}]}:!e.with&&!e.without&&(t=r),this.setVisibilityFilter(t)},alertMouseEnterEmitted:function(e){if(this.mapImp){if(e.value){let t,n={"tile-layer":`pathways`},r={NOT:n};(e.key===`alert`||e.key===`withoutAlert`)&&(t={OR:[r,{AND:[n,e.key===`alert`?{HAS:`alert`}:{NOT:{HAS:`alert`}}]}]}),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,!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 n=e.checked.includes(t.taxon);this.mapImp.enableConnectivityByTaxonIds(t.taxon,n)})},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){let t=this.existDrawnFeatures.find(e=>e.id===this.selectedDrawnFeature.id);t&&t.connection&&(this.connectionEntry=t.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`);let n=this.mapImp.refreshAnnotationFeatureGeometry(t.feature);e.feature.feature=n}t.type===`created`?this.drawnCreatedEvent=e:this.checkAndCreatePopups([e])}t.type===`updated`&&(this.previousEditEvent=t),this.previousDeletedEvent=t.type===`deleted`?t:{}},getTaxons:function(e){let t;return e.taxons&&(t=typeof e.taxons==`object`?e.taxons:JSON.parse(e.taxons)),t},eventCallback:function(){return(e,t,...n)=>{if(e===`annotation`){let r={feature:t,userData:n,eventType:e};this.annotationEventCallback(r,t)}else if(e===`context-lost`)this.onContextLost();else if(e===`context-restored`)this.onContextRestored();else if(e===`pan-zoom`)this.$emit(`pan-zoom-callback`,t);else{let r=t.label,i=[t.models],a=this.entry,o=this.biologicalSex,s=s_(t.alert),c=this.getTaxons(t),l=[{dataset:t.dataset,biologicalSex:o,taxonomy:a,resource:i,label:r,feature:t,userData:n,eventType:e,provenanceTaxonomy:c,alert:s}];if(e===`mouseenter`&&(this.lastHoveredFeature=t),e===`click`){let r=!t[0];if(!r){l=[];let r=t.mapUUID,i=new Set;for(let[s,c]of Object.entries(t))if(s!==`mapUUID`){let t=c.featureId,s=c.label,u=[c.models],d=this.getTaxons(c);if(i.has(t))continue;i.add(t),l.push({dataset:c.dataset,biologicalSex:o,taxonomy:a,resource:u,label:s,feature:c,userData:n,eventType:e,provenanceTaxonomy:d,alert:s_(c.alert),mapUUID:r})}}let i=r?t:t[0];if(this.setConnectivityDataSource(this.viewingMode,i),this.viewingMode!==`Neuron Connection`&&(this.currentActive=i.models?i.models:``,this.activeDrawTool&&!this.isValidDrawnCreated)){let e=i.featureId||this.existDrawnFeatures.find(e=>e.id===i.id);if(this.activeDrawTool===`LineString`&&e){let e=i.featureId?i.featureId:i.id,t=i.label?i.label:`Feature ${i.id}`;this.connectionEntry[` ${e}`]=Object.assign({label:t},Object.fromEntries(Object.entries(i).filter(([e])=>[`featureId`,`models`].includes(e)).map(([e,t])=>[e===`featureId`?`id`:e,t])))}}t&&t.type!==`marker`&&!this.activeDrawTool&&this.checkAndCreatePopups(l)}else e===`mouseenter`&&this.viewingMode!==`Neuron Connection`&&(this.currentHover=t.models?t.models:``);this.$emit(`resource-selected`,l)}}},setConnectivityDataSource:function(e,t){this.connectivityDataSource=e===`Exploration`?t.models?.startsWith(`ilxtr:`)?t.models:``:t.featureId||t.id},changeViewingMode:function(e){e&&(this.viewingMode=e),this.manualAbortedOnClose()},removeActiveTooltips:function(){this.mapImp&&this.mapImp.removePopup(),this.$el.querySelectorAll(`.flatmap-tooltip-popup`).forEach(e=>e.remove()),this.lastHoveredFeature=null},createTooltipForConnectivity:function(e,t){let n=document.createElement(`div`);n.classList.add(`flatmap-feature-label`),e.forEach((t,r)=>{let{label:i}=t;if(n.append(o_(i)),r+1<e.length){let e=document.createElement(`hr`);n.appendChild(e)}}),this.mapImp.showPopup(t,n,{className:`custom-popup flatmap-tooltip-popup`,positionAtLastClick:!1,preserveSelection:!0})},showConnectivityTooltips:function(e){let{connectivityInfo:t,data:n}=e,r=[],i=[],a=[],o=[];if(this.lastHoveredFeature=null,t&&t.featureId&&r.push(...t.featureId),this.mapImp){if(n.forEach(e=>{let t=this.mapImp.search(e.id);if(t?.results.length){let n=t?.results[0].featureId;a.push({featureId:n,...e})}else o.push(e)}),a.length){let e=a[0].featureId;this.mapImp.annotations.forEach(t=>{let n=t[`anatomical-nodes`];if(n){let r=n.join(``);a.every(e=>r.indexOf(e.id)!==-1)&&(e=t.featureId,i.push(e))}}),this.createTooltipForConnectivity(a,e)}else this.removeActiveTooltips();o.length&&this.emitConnectivityError(o);let e=r.reduce((e,t)=>{let n=this.mapImp.pathways.paths[t],r=n?n.connectivity:null;if(r){let t=r.flat(1/0);e.push(...t)}return e},[]),t=[...new Set(e)],s=[...r,...t],c=[...this.mapImp.modelFeatureIdList(s),...i];this.mapImp.selectGeoJSONFeatures(c)}},showConnectivitiesByReference:function(e){this.searchConnectivitiesByReference(e).then(e=>{this.mapImp.selectFeatures(e)})},searchConnectivitiesByReference:async function(e){let t=sessionStorage.getItem(`flatmap-knowledge`),n=[];return n=t?await Qg(e):await $g(this.mapImp,e,this.flatmapQueries),n},getFlatmapKnowledge:function(){let e=[],t=sessionStorage.getItem(`flatmap-knowledge`);return t&&(e=JSON.parse(t)),e},emitConnectivityError:function(e){this.$emit(`connectivity-error`,{data:{errorData:e,errorMessage:C_}})},checkConnectivityTooltipEntry:function(e){return e?.length?e.find(e=>e?.destinations?.length||e?.components?.length)!==void 0:!1},changeConnectivitySource:async function(e){let{entry:t,connectivitySource:n}=e;t.mapId===this.mapImp.id&&(await this.flatmapQueries.queryForConnectivityNew(this.mapImp,t.featureId[0],n),this.tooltipEntry=this.tooltipEntry.map(e=>e.featureId[0]===t.featureId[0]?this.flatmapQueries.updateTooltipData(e):e),this.checkConnectivityTooltipEntry(this.tooltipEntry)&&this.$emit(`connectivity-info-open`,this.tooltipEntry))},checkAndCreatePopups:async function(e,t=!0){if(this.viewingMode===`Annotation`){let t=e.filter(e=>e.feature).map(e=>e.feature);if(t.length>0){if(this.annotationSidebar&&this.previousDeletedEvent.type===`deleted`&&(this.annotationEntry=[{...this.previousDeletedEvent,resourceId:this.serverURL}],this.annotationEventCallback({},{type:`aborted`})),this.annotationEntry=[],t.forEach(e=>{this.annotationEntry.push({...e,resourceId:this.serverURL,featureId:e.featureId?e.featureId:e.feature?.id,offline:this.offlineAnnotationEnabled})}),t[0].feature)this.activeDrawTool||this.activeDrawMode||this.isValidDrawnCreated?(this.featureAnnotationSubmitted=!1,this.activeDrawTool&&this.createConnectivityBody(),this.displayTooltip(t[0].feature.id,w_(t[0].feature.geometry))):this.rollbackAnnotationEvent();else{let e=this.annotationEntry.filter(e=>e.featureId&&e.models).map(e=>e.models);e.length>0&&this.displayTooltip(e)}}else this.annotation={}}else if(this.viewingMode===`Neuron Connection`&&t){let t=e.map(e=>e.resource[0]);if(t.find(e=>!e.startsWith(`ilxtr:`))){let n=Array.isArray(t)?[...t]:[t];n.length===1&&n.push([]);let r=e[0].feature?.featureId,i=this.mapImp.annotations.get(r),o=i?.[`anatomical-nodes`],s=i?.models,c,l=n,u=i?.models;o?.length&&(c=o.find(e=>JSON.parse(e)[0]===s)),c?l=JSON.parse(c):u&&(l=[u,[]]);let d=this.mapImp.knowledgeSource,f=l.flat(1/0),p=[...new Set(f)],m=(await(0,a.fetchLabels)(this.flatmapAPI,p)).reduce((e,t)=>{let n=t[0],r=JSON.parse(t[1]);return e.push({id:n,label:r.label,source:r.source}),e},[]);m.sort((e,t)=>e.id===t.id?e.source===d&&t.source!==d?-1:+(e.source!==d&&t.source===d):e.id.localeCompare(t.id));let h=[];for(let e=0;e<p.length;e++){let t=m.find(t=>t.id===p[e]);t&&h.push(t.label)}let g=o_(h.join(`, `)),_={facet:JSON.stringify(l),facetPropPath:`flatmap.connectivity.source.${this.connectionType.toLowerCase()}`,tagLabel:g,term:this.connectionType};this.connectivityFilters.some(e=>e.facet===_.facet&&e.facetPropPath===_.facetPropPath)||this.connectivityFilters.push(_),this.$emit(`neuron-connection-feature-click`,{filters:this.connectivityFilters,search:``})}else await this.openConnectivityInfo(e)}else await this.openConnectivityInfo(e)},openConnectivityInfo:async function(e){n_(this.mapImp,this.flatmapQueries);let t=[];if(this.tooltipEntry=e.filter(e=>e.resource[0]in this.mapImp.pathways.paths).map(e=>({title:e.label,featureId:e.resource,ready:!1})),this.tooltipEntry.length){this.$emit(`connectivity-info-open`,this.tooltipEntry);for(let n=0;n<e.length;n++)t.push(await this.getKnowledgeTooltip(e[n]));this.tooltipEntry=await Promise.all(t);let n=this.tooltipEntry.map(e=>e.featureId[0]);n.length>0&&this.displayTooltip(n)}},updateConnectivityFilters:function(e){e.length&&(this.connectivityFilters=e.filter(e=>e.facet.toLowerCase()!==`show all`))},resetConnectivityfilters:function(e){this.connectivityFilters=e.length?this.connectivityFilters.filter(t=>e.some(e=>e.facetPropPath===t.facetPropPath&&e.facet!==t.facet)):[]},getKnowledgeTooltip:async function(e){let t=await this.flatmapQueries.retrieveFlatmapKnowledgeForEvent(this.mapImp,e),n=await this.flatmapQueries.createTooltipData(this.mapImp,e);return(t&&t[0]||e.feature.hyperlinks&&e.feature.hyperlinks.length>0)&&(n.featuresAlert=s_(e.alert),n.knowledgeSource=e_(this.mapImp),n.mapId=this.mapImp.mapMetadata.id,n.mapuuid=this.mapImp.mapMetadata.uuid),n.ready=!0,n},popUpCssHacks:function(){let 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`}),this.lastHoveredFeature=null},showPopup:function(e,t,n){let r=n;this.mapImp&&(r?r.className||(r.className=`custom-popup`):r={className:`custom-popup`,positionAtLastClick:!0},this.mapImp.showPopup(e,t,r))},showMarkerPopup:function(e,t,n){this.mapImp&&this.mapImp.showMarkerPopup(e,t,n)},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){let t=this.hoverVisibilities.length,n=t-1,r=this.hoverVisibilities[this.helpModeActiveIndex];if(r){let t=r?.refs,n=r?.ref,i=this.$refs[t||n];if(i){let{parentElement:e,nextElementSibling:t}=i.$el,n=e=>e&&(e.classList.contains(`pathway-container`)||e.classList.contains(`pathway-location`));(n(e)||n(t))&&(this.requiresDrawer?this.drawerOpen=!0:this.helpModeActiveIndex+=1)}else this.helpModeActiveIndex+=1,this.setHelpMode(e)}this.hoverVisibilities[this.helpModeActiveIndex]?.ref===`checkBoxPopover`&&!this.showPathwayFilter&&(this.helpModeActiveIndex+=1,this.setHelpMode(e)),e||(this.helpModeActiveIndex=this.helpModeInitialIndex),this.viewingMode!==`Annotation`&&this.helpModeActiveIndex>9&&(this.helpModeActiveIndex=n),e&&this.helpModeActiveIndex>=n&&this.$emit(`help-mode-last-item`,!0),e&&!this.helpModeDialog?(this.inHelp=!0,this.hoverVisibilities.forEach(e=>{e.value=!0})):e&&this.helpModeDialog&&t>this.helpModeActiveIndex?this.helpModeActiveIndex>-1?(this.closeFlatmapHelpPopup(),setTimeout(()=>{this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.value=!1}),this.showTooltip(this.helpModeActiveIndex,200)},300)):this.helpModeActiveIndex===-1&&this.openFlatmapHelpPopup():(this.inHelp=!1,this.hoverVisibilities.forEach(e=>{e.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 n,r={className:`flatmapvuer-popover`};if(t)n=e,r.annotationFeatureGeometry=t,this.annotationEntry.length&&(r.annotationEvent={type:this.annotationEntry[0].type,feature:this.annotationEntry[0].feature});else{let t=Array.isArray(e)?e[0]:e;t&&(n=this.mapImp.modelFeatureIds(t)[0]),this.activeDrawTool||(r.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}),n&&!this.disableUI&&(this.viewingMode===`Annotation`&&!this.annotationSidebar||this.viewingMode===`Exploration`&&!this.connectivityInfoSidebar)&&(this.tooltipDisplay=!0,this.$nextTick(()=>{this.mapImp.showPopup(n,this.$refs.tooltip.$el,r),this.popUpCssHacks()}))},moveMap:function(e,t={}){if(this.mapImp){let{offsetX:n=0,offsetY:r=0,zoom:i=4}=t,a=this.mapImp.map,o=this.mapImp.bounds.toArray();this.mapImp.zoomToFeatures(e,{noZoomIn:!0}),this.showPathwaysDrawer(!1),o?.length&&setTimeout(()=>{a.fitBounds(o,{offset:[n,r],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 n of t.values())n.label&&e.push(n.label);return Array.from(new Set(e))}},getVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=this.$refs[t];n&&(e[t]=n.getState())}),this.$refs.treeControls&&(e.systemsSelection=this.$refs.treeControls.$refs.regionTree.getCheckedKeys().filter(e=>!e.includes(`.`)))},setVisibilityState:function(e){[`alertSelection`,`pathwaysSelection`,`taxonSelection`].forEach(t=>{let n=e[t];if(n){let e=this.$refs[t];e&&e.setState(n)}}),`systemsSelection`in e&&this.$refs.treeControls&&(this.$refs.treeControls.$refs.regionTree.setCheckedKeys(e.systemsSelection),this.systems[0].children.forEach(t=>{this.mapImp.enableSystem(t.key,e.systemsSelection.includes(t.key))}))},getState:function(){if(this.mapImp){let e={entry:this.entry,viewport:this.mapImp.getState()},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){let t=e.searchTerm;this.searchAndShowResult(t,!0,!0)}this.setVisibilityState(e)}},setFlightPathInfo:function(e){let t=1.6;(e===t||e>t)&&(this.displayFlightPathOption=!0,this.setFlightPath3D(!1))},createFlatmap:function(e){if(!this.mapImp&&!this.loading){this.loading=!0,this.flatmapError=null;let t={taxon:this.entry};this.uuid&&(t.uuid=this.uuid),e?(e.uuid?t={uuid:e.uuid}:e.entry&&(t.taxon=e.entry),e.biologicalSex?t.biologicalSex=e.biologicalSex:t.taxon===`NCBITaxon:9606`&&(t.biologicalSex=`PATO:0000384`)):this.biologicalSex&&(t.biologicalSex=this.biologicalSex),this.mapManagerRef.loadMap(t,this.eventCallback(),{minZoom:this.minZoom,tooltips:this.tooltips,minimap:!1,container:this.$refs.display,tooltipDelay:15}).then(t=>{this.mapImp=y_(t),this.serverURL=this.mapImp.makeServerUrl(``).slice(0,-1);let n=this.mapImp.details.version;this.setFlightPathInfo(n);let r=this._stateToBeSet?this._stateToBeSet:e;this.onFlatmapReady(r),this.$nextTick(()=>this.restoreMapState(r))}).catch(e=>{if(console.error(`Flatmap loading error:`,e),this.flatmapError={},e.message&&e.message.indexOf(`Unknown map`)!==-1?(this.flatmapError.title=`Unknown Map!`,this.flatmapError.messages=Object.keys(t).map(e=>`${e===`uuid`?`UUID`:o_(e)}: ${t[e]}`)):(this.flatmapError.title=`Error Loading Map!`,this.flatmapError.messages=[e.message?e.message:e.toString(),`Please try again later or contact support if the problem persists.`]),this.$parent?.$refs?.multiContainer){let e=this.$parent;this.flatmapError.button={text:`Load Default Map`,callback:()=>{let t=e.initial;e.setSpecies(t,void 0,3)}}}this.loading=!1})}else e&&(this._stateToBeSet={...e},this.mapImp&&!this.loading&&this.restoreMapState(this._stateToBeSet))},computePathControlsMaximumHeight(){let e=this.$refs.display;if(e){let t=getComputedStyle(e),n=parseInt(t.paddingTop)+parseInt(t.paddingBottom),r=e.clientHeight-n;this.pathwaysMaxHeight=r-170}},mapResize:function(){try{this.computePathControlsMaximumHeight(),this.mapImp&&this.mapImp.resize()}catch{console.error(`Map resize error`)}},getFilterSources:function(){let e=[`kind`,`taxons`],t=new Set,n=new Set,r=new Map;for(let i of this.mapImp.annotations.values())if(i.source){`alert`in i?t.add(i.source):n.add(i.source);for(let[t,n]of Object.entries(i))if(e.includes(t)){r.has(t)||r.set(t,new Map);let e=r.get(t),a=t=>{let n=t;e.has(n)||e.set(n,new Set),e.get(n).add(`${i.source}`)};Array.isArray(n)?n.forEach(a):a(n)}}let i={alert:{with:[...t],without:[...n]}};for(let[e,t]of r.entries()){i[e]={};for(let[n,r]of t.entries())i[e][n]=[...r.values()]}return i},getFilterOptions:async function(e,t){let n=t||this.getFlatmapKnowledge(),r=this.pathways;return await(0,a.getFlatmapFilterOptions)(this.flatmapAPI,e,n,r)},onFlatmapReady:function(e){this.sensor=(0,t.markRaw)(new l_.default(this.$refs.display,this.mapResize)),this.mapImp.options?.style===`functional`&&(this.isFC=!0),this.mapImp.setBackgroundOpacity(1),this.backgroundChangeCallback(this.currentBackground),this.pathways=this.mapImp.pathTypes(),this.pathways=this.pathways.filter(e=>e.enabled&&e.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.loading=!1,this.computePathControlsMaximumHeight(),this.mapResize(),this.handleMapClick(),this.setInitMapState(),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.$emit(`ready`,this)},handleMapClick:function(){let e=this.mapImp.map;e&&e.on(`click`,e=>{this.connectivityDataSource||this.$emit(`connectivity-info-close`),this.connectivityDataSource=``})},onContextLost:function(){this.lastViewport=(0,t.markRaw)(this.mapImp.getState()),this.flatmapError={},this.flatmapError.title=`GL context lost!`,this.flatmapError.messages=[`A display issue has occurred due
|
|
21
29
|
to a limit on available WebGL contexts. You can restore the display
|
|
22
30
|
using the Restore Context button. Please see the
|
|
23
31
|
<a href="https://docs.sparc.science/docs/integrated-maps-viewer-overview#limit-on-available-webgl-contexts" target='_blank'>documentation</a>
|
|
24
|
-
for more details.`],this.flatmapError.button={text:`Restore Context`,callback:()=>{this.forceContextRestore()}}},onContextRestored:function(){if(this.mapImp){this.handleMapClick(),this.setInitMapState();let e=this.getState();e&&(e.viewport=this.lastViewport),this.restoreMapState(e),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.filterToRestore&&=(this.mapImp.setVisibilityFilter(this.filterToRestore),void 0),this.$emit(`context-restored`,this)}},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t,n=!0){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;{let r=this.mapImp.search(e);if(r?.results?.length){if(this.mapImp.showSearchResults(r),t){let e;for(let t=0;t<r.results.length;t++){e=r.results[t].featureId;let n=this.mapImp.annotation(e);if(e&&n?.label)break}if(e){let t=this.mapImp.featureProperties(e),r={resource:[t.models],feature:t,label:t.label,provenanceTaxonomy:t.taxons,alert:s_(t.alert)};this.checkAndCreatePopups([r],n);let i=t.id.startsWith(`ilxtr:`)||t.id.startsWith(`ilx:`);i?(this.lastHoveredFeature=t,this.lastHoveredFeature.mapUUID=this.mapImp.uuid):this.lastHoveredFeature=null,this.mapImp.showPopup(e,o_(t.label),{className:i?`flatmap-tooltip-popup`:`custom-popup`,positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}this.mapImp.clearSearchResults()}}return!1},highlightConnectedPaths:function(e){if(e.length){let t=e.filter(e=>e in this.mapImp.pathways.paths),n=this.mapImp.modelFeatureIdList(t);this.mapImp.selectGeoJSONFeatures(n)}},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){p_.emit(`onActionClick`,e)},setConnectionType:function(e){this.connectionType=e},_handleTooltipMutation:function(e){for(let t of e)for(let e of t.addedNodes)if(e.nodeType===1){if(e.matches&&e.matches(`.flatmap-tooltip-popup`))this._applyCustomTooltipContent(e);else if(e.querySelector){let t=e.querySelector(`.flatmap-tooltip-popup`);t&&this._applyCustomTooltipContent(t)}}},_applyCustomTooltipContent:function(e){if(!(!this.tooltipContentProvider||!this.lastHoveredFeature))try{let t=this.lastHoveredFeature,n=t[0]&&typeof t[0]==`object`,r;if(n){let e=[],n=t.mapUUID;for(let[r,i]of Object.entries(t))r!==`mapUUID`&&i&&typeof i==`object`&&e.push({...i,mapUUID:n});r=this.tooltipContentProvider(e.length>1?e:e[0])}else r=this.tooltipContentProvider(t);if(r){let t=e.querySelector(`.maplibregl-popup-content`);t&&(t.innerHTML=r)}}catch(e){console.warn(`[flatmapvuer] Error in tooltipContentProvider:`,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},render:{type:Boolean,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},externalLegends:{type:Array,default:function(){return[]}},tooltipContentProvider:{type:Function,default:null}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken}},data:function(){return{filterToRestore:void 0,flatmapError:null,sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:(0,t.markRaw)({}),sckanDisplay:[{label:`Display Path with SCKAN`,key:`VALID`}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipWait:(0,t.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:c_,isFC:!1,inHelp:!1,currentBackground:`white`,availableBackground:[`white`,`lightskyblue`,`black`],loading:!1,flatmapMarker:Wg,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:{},lastHoveredFeature:null,tooltipObserver:null,connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:`Display Path With Notes`,key:`alert`,enabled:!0},{label:`Display Path Without Notes`,key:`withoutAlert`,enabled:!0}],mapFilters:(0,t.markRaw)({alert:{with:!0,without:!0}}),searchTerm:``,taxonLeaveDelay:void 0,connectivityFilters:[],flatmapLegends:[],lastViewport:void 0}},computed:{...(0,c.mapState)(d_,[`userToken`]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){return this.loading?(this.drawerOpen=!1,!1):this.systems?.length>0||this.containsAlert&&this.alertOptions||this.pathways?.length>0||this.taxonConnectivity?.length>0||this.legendEntry?.length>0?(this.drawerOpen=!0,!0):(this.drawerOpen=!1,!1)},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode===`Annotation`?this.authorisedUser?e[1]:e[0]:e},legendEntry:function(){return[...this.flatmapLegends,...this.externalLegends]},showDatasetMarkerTooltip:function(){return this.hoverVisibilities[9].value}},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))},render:function(e){e&&this.mapImp&&this.mapImp.contextLost&&!this.loading&&this.$nextTick(()=>{this.forceContextRestore()})},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(e=>{e.name&&e.email&&e.canUpdate?(this.authorisedUser=e,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=[],n={x:null,y:null},r=this.$el.querySelector(`.maplibregl-canvas`),i=()=>{r.removeEventListener(`keydown`,a),r.removeEventListener(`click`,o)},a=n=>{if(![`Escape`,`Enter`].includes(n.key))return;let r=e===`Point`&&t.length===1||e===`LineString`&&t.length>=2||e===`Polygon`&&t.length>=3;(n.key===`Escape`||n.key===`Enter`&&!r)&&(this.activeDrawTool=void 0),i()},o=e=>{let a=r.getBoundingClientRect(),o=e.clientX-a.left,s=e.clientY-a.top;if(Math.sqrt((o-n.x)**2+(s-n.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}n={x:o,y:s},t.push(n)};e&&(i(),r.addEventListener(`keydown`,a),r.addEventListener(`click`,o))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new u_.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef))},mounted:function(){this.openMapRef=(0,t.shallowRef)(this.$refs.openMapRef),this.backgroundIconRef=(0,t.shallowRef)(this.$refs.backgroundIconRef),this.tooltipWait.length=this.hoverVisibilities.length,this.flatmapQueries=(0,t.markRaw)(new Zg),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),a_(),this.tooltipContentProvider&&this.$nextTick(()=>{let e=this.$refs.flatmapContainer||this.$el;e&&(this.tooltipObserver=new MutationObserver(this._handleTooltipMutation.bind(this)),this.tooltipObserver.observe(e,{childList:!0,subtree:!0}))})},beforeUnmount:function(){this.tooltipObserver&&=(this.tooltipObserver.disconnect(),null)}},v_={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`}},b_={style:{height:`100%`,width:`100%`},ref:`display`,class:`flatmap-display`},x_={class:`beta-popovers`},S_={key:2,class:`warning-text`},C_={class:`bottom-right-control`},w_=[`innerHTML`],T_={style:{"margin-bottom":`2px`}},E_={key:0,class:`viewing-mode-title`},D_=[`onClick`],O_=[`onClick`];function k_(e,r,i,a,o,s){let c=(0,t.resolveComponent)(`map-svg-sprite-color`),l=Rg,u=n.WarningFilled,d=yd,f=Zh,p=n.ArrowDown,m=(0,t.resolveComponent)(`DrawToolbar`),h=(0,t.resolveComponent)(`map-svg-icon`),g=kg,_=(0,t.resolveComponent)(`tree-controls`),v=vg,y=n.ArrowLeft,b=$p,x=xh,S=Sh,C=Im,w=Fm,T=gh,E=_h,D=(0,t.resolveComponent)(`Tooltip`),O=Xh,k=cg;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,v_,[(0,t.createVNode)(c),(0,t.createElementVNode)(`div`,y_,[(0,t.createElementVNode)(`div`,b_,null,512),e.flatmapError?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,flatmapError:e.flatmapError},null,8,[`flatmapError`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,x_,[(0,t.createElementVNode)(`div`,null,[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,"popper-class":`warning-popper flatmap-popper`,teleported:!1,visible:e.hoverVisibilities[7].value,ref:`warningPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`warning-icon`,onMouseover:r[7]||=e=>s.showTooltip(7),onMouseout:r[8]||=e=>s.hideTooltip(7)},[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(d,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1})):(0,t.createCommentVNode)(``,!0),i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[r[31]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`Legacy Map`,-1),(0,t.createElementVNode)(`div`,{class:`latest-map-text`,onClick:r[6]||=(...e)=>s.viewLatestMap&&s.viewLatestMap(...e)},` Click here for the latest map `)],64)):i.displayWarning?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,S_,`Beta`)):(0,t.createCommentVNode)(``,!0)],32)]),default:(0,t.withCtx)(()=>[i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:0,onMouseover:r[0]||=e=>s.showTooltip(7),onMouseout:r[1]||=e=>s.hideTooltip(7)},` This is a legacy map, you may view the latest map instead. `,32)):e.isFC?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:1,onMouseover:r[2]||=e=>s.showTooltip(7),onMouseout:r[3]||=e=>s.hideTooltip(7)},[...r[29]||=[(0,t.createTextVNode)(` This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(`. `,-1)]],32)):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:2,onMouseover:r[4]||=e=>s.showTooltip(7),onMouseout:r[5]||=e=>s.hideTooltip(7)},[...r[30]||=[(0,t.createTextVNode)(` This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(`. New connectivity and species specificity will be added as the SPARC program progresses. `,-1)]],32))]),_:1},8,[`visible`])):(0,t.createCommentVNode)(``,!0)]),i.displayLatestChanges?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,teleported:!1,trigger:`manual`,"popper-class":`warning-popper flatmap-popper`,visible:e.hoverVisibilities[8].value,ref:`whatsNewPopover`},{reference:(0,t.withCtx)(()=>[i.displayLatestChanges?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`latest-changesicon`,onMouseover:r[9]||=e=>s.showTooltip(8),onMouseout:r[10]||=e=>s.hideTooltip(8)},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),r[32]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`What's new?`,-1)],32)):(0,t.createCommentVNode)(``,!0)]),default:(0,t.withCtx)(()=>[...r[33]||=[(0,t.createElementVNode)(`b`,null,`Connectivity References`,-1),(0,t.createElementVNode)(`p`,null,` Connectivity references have been improved and available in various formats. `,-1),(0,t.createElementVNode)(`b`,null,`Improved state storing`,-1),(0,t.createElementVNode)(`p`,null,` Current selection and visibility filters are now stored when creating a permalink. `,-1)]]),_:1},8,[`visible`])):(0,t.createCommentVNode)(``,!0)],512),[[t.vShow,!i.disableUI]]),(0,t.withDirectives)((0,t.createVNode)(d,{class:(0,t.normalizeClass)([`minimap-resize`,{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:`minimapResize`,onClick:s.closeMinimap},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p)]),_:1},8,[`class`,`onClick`]),[[t.vShow,e.minimapResizeShow]]),e.viewingMode===`Annotation`&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!i.disableUI?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,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:s.toolbarEvent,onFeatureTooltip:s.connectedFeatureTooltip,onConfirmDrawn:s.confirmDrawnFeature,onCancelDrawn:s.cancelDrawnFeature,onShowTooltip:s.showTooltip,onHideTooltip:s.hideTooltip,ref:`toolbarPopover`},null,8,[`mapCanvas`,`toolbarOptions`,`activeDrawTool`,`activeDrawMode`,`newlyDrawnEntry`,`connectionEntry`,`hoverVisibilities`,`onClickToolbar`,`onFeatureTooltip`,`onConfirmDrawn`,`onCancelDrawn`,`onShowTooltip`,`onHideTooltip`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,C_,[(0,t.createVNode)(f,{content:`Zoom in`,placement:`left`,teleported:!1,trigger:`manual`,width:`70`,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[1].value,ref:`zoomInPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`icon-button-container`,onClick:r[11]||=e=>s.zoomIn(),onMouseover:r[12]||=e=>s.showTooltip(1),onMouseout:r[13]||=e=>s.hideTooltip(1)},[(0,t.createVNode)(h,{class:`icon-button zoomIn`,icon:`zoomIn`})],32)]),_:1},8,[`visible`]),(0,t.createVNode)(f,{content:`Zoom out`,placement:`top-end`,teleported:!1,trigger:`manual`,width:`70`,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[2].value,ref:`zoomOutPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`icon-button-container`,onClick:r[14]||=e=>s.zoomOut(),onMouseover:r[15]||=e=>s.showTooltip(2),onMouseout:r[16]||=e=>s.hideTooltip(2)},[(0,t.createVNode)(h,{class:`icon-button zoomOut`,icon:`zoomOut`})],32)]),_:1},8,[`visible`]),(0,t.createVNode)(f,{content:`Reset`,placement:`top`,teleported:!1,trigger:`manual`,width:`70`,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[3].value,ref:`zoomFitPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`icon-button-container`,onClick:r[17]||=e=>s.resetView(),onMouseover:r[18]||=e=>s.showTooltip(3),onMouseout:r[19]||=e=>s.hideTooltip(3)},[(0,t.createVNode)(h,{class:`icon-button fitWindow`,icon:`fitWindow`})],32)]),default:(0,t.withCtx)(()=>[r[34]||=(0,t.createElementVNode)(`div`,null,[(0,t.createTextVNode)(` Fit to `),(0,t.createElementVNode)(`br`),(0,t.createTextVNode)(` window `)],-1)]),_:1},8,[`visible`])],512),[[t.vShow,!i.disableUI]]),(0,t.createVNode)(f,{content:`Change pathway visibility`,placement:`right`,teleported:!1,trigger:`manual`,offset:-18,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[6].value,ref:`checkBoxPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`pathway-location`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`pathway-container`,{open:e.drawerOpen,close:!e.drawerOpen}]),style:(0,t.normalizeStyle)({"max-height":e.pathwaysMaxHeight+`px`})},[s.legendEntry.length?((0,t.openBlock)(),(0,t.createBlock)(g,{key:0,identifierKey:`prompt`,colourKey:`colour`,styleKey:`style`,legends:s.legendEntry,showStarInLegend:!0,showDatasetMarkerTooltip:s.showDatasetMarkerTooltip,ref:`featuredMarkerPopover`,class:`svg-legends-container`},null,8,[`legends`,`showDatasetMarkerTooltip`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{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:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:`flatmap-marker-help`,innerHTML:e.flatmapMarker},null,8,w_),[[t.vShow,e.hoverVisibilities[0].value],[O,void 0,`markerPopover`]])]),_:1},8,[`visible`]),e.isFC&&e.systems&&e.systems.length>0?((0,t.openBlock)(),(0,t.createBlock)(_,{key:1,class:`treeControls`,mapType:`flatmap`,title:`Systems`,treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:s.systemSelected,onCheckAll:s.checkAllSystems,onChangeActive:s.ftuSelected,ref:`treeControls`},null,8,[`treeData`,`active`,`hover`,`onCheckChanged`,`onCheckAll`,`onChangeActive`])):(0,t.createCommentVNode)(``,!0),e.containsAlert&&e.alertOptions&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Notes`,labelKey:`label`,identifierKey:`key`,selections:e.alertOptions,onChanged:s.alertSelected,onCheckboxMouseEnter:s.alertMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllAlerts,ref:`alertSelection`,key:`alertSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.pathways&&e.pathways.length>0?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Pathways`,labelKey:`label`,identifierKey:`type`,colourStyle:`line`,selections:e.pathways,showAsLegend:!i.showPathwayFilter,onChanged:s.pathwaysSelected,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllPathways,ref:`pathwaysSelection`,key:`pathwaysSelection`},null,8,[`selections`,`showAsLegend`,`onChanged`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{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:s.taxonsSelected,onCheckboxMouseEnter:s.taxonMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllTaxons,ref:`taxonSelection`,key:`taxonSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0)],6)),[[O,void 0,`checkBoxPopover`]]),(0,t.createElementVNode)(`div`,{onClick:r[20]||=(...e)=>s.toggleDrawer&&s.toggleDrawer(...e),class:(0,t.normalizeClass)([`drawer-button`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(y)]),_:1})],2)],2),[[t.vShow,!i.disableUI&&s.requiresDrawer]])]),_:1},8,[`visible`]),e.openMapRef?((0,t.openBlock)(),(0,t.createBlock)(f,{key:2,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:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(i.openMapOptions,n=>((0,t.openBlock)(),(0,t.createBlock)(x,{key:n.key},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(b,{type:`primary`,plain:``,onClick:t=>e.$emit(`open-map`,n.key)},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(n.display),1)]),_:2},1032,[`onClick`])]),_:2},1024))),128))]),_:1},8,[`virtual-ref`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{ref:`backgroundPopover`,"virtual-ref":e.backgroundIconRef,placement:`top-start`,width:`320`,teleported:!1,trigger:`click`,"popper-class":`background-popper h-auto`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,null,[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[35]||=[(0,t.createTextVNode)(`Viewing Mode`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,T_,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.viewingModes,(n,r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[r===e.viewingMode?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,E_,[(0,t.createElementVNode)(`b`,null,(0,t.toDisplayString)(r),1)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`viewing-mode-unselected`,onClick:e=>s.changeViewingMode(r)},(0,t.toDisplayString)(r),9,D_))],64))),128))]),(0,t.createVNode)(x,{class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(s.modeDescription),1)]),_:1}),e.viewingMode===`Annotation`&&e.offlineAnnotationEnabled?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0,class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[...r[36]||=[(0,t.createTextVNode)(` (Anonymous annotate) `,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1}),e.viewingMode===`Annotation`&&e.authorisedUser?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[37]||=[(0,t.createTextVNode)(`Annotations From`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":r[21]||=t=>e.annotationFrom=t,placeholder:`Select`,class:`select-box`,"popper-class":`flatmap_dropdown`,onChange:s.setAnnotationFrom},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.annotatedSource,e=>((0,t.openBlock)(),(0,t.createBlock)(C,{key:e,label:e,value:e},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(x,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(S,{span:12},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])]),_:1})],64)):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1,class:`backgroundSpacer`})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:2,class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[38]||=[(0,t.createTextVNode)(`Flight path display`,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:3,class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":r[22]||=t=>e.flightPath3DRadio=t,class:`flatmap-radio`,onChange:s.setFlightPath3D},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[39]||=[(0,t.createTextVNode)(`2D`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[40]||=[(0,t.createTextVNode)(`3D`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[41]||=[(0,t.createTextVNode)(`Organs display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.colourRadio,"onUpdate:modelValue":r[23]||=t=>e.colourRadio=t,class:`flatmap-radio`,onChange:s.setColour},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[42]||=[(0,t.createTextVNode)(`Colour`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[43]||=[(0,t.createTextVNode)(`Greyscale`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[44]||=[(0,t.createTextVNode)(`Outlines display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.outlinesRadio,"onUpdate:modelValue":r[24]||=t=>e.outlinesRadio=t,class:`flatmap-radio`,onChange:s.setOutlines},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[45]||=[(0,t.createTextVNode)(`Show`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[46]||=[(0,t.createTextVNode)(`Hide`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[47]||=[(0,t.createTextVNode)(`Change background`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.availableBackground,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)([`backgroundChoice`,n,n==e.currentBackground?`active`:``]),onClick:e=>s.backgroundChangeCallback(n)},null,10,O_))),128))]),_:1})])]),_:1},8,[`virtual-ref`]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`settings-group`,{open:e.drawerOpen,close:!e.drawerOpen}])},[i.showOpenMapButton?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{visible:e.hoverVisibilities[4].value,content:`Open new map`,placement:`right`,teleported:!1,"popper-class":`flatmap-popper`,ref:`openMapPopover`},{reference:(0,t.withCtx)(()=>[i.enableOpenMapUI&&i.openMapOptions.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref:`openMapRef`,class:`icon-button-container`,onMouseover:r[25]||=e=>s.showTooltip(4),onMouseout:r[26]||=e=>s.hideTooltip(4)},[(0,t.createVNode)(h,{icon:`openMap`,class:`icon-button open-map-button`})],544)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0),i.showLocalSettings?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{content:`Change settings`,placement:`right`,visible:e.hoverVisibilities[5].value,teleported:!1,trigger:`manual`,"popper-class":`flatmap-popper`,ref:`settingsPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{ref:`backgroundIconRef`,class:`icon-button-container`,onMouseover:r[27]||=e=>s.showTooltip(5),onMouseout:r[28]||=e=>s.hideTooltip(5)},[(0,t.createVNode)(h,{icon:`changeBckgd`,class:`icon-button`})],544)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0)],2),[[t.vShow,!i.disableUI]]),e.tooltipDisplay?((0,t.openBlock)(),(0,t.createBlock)(D,{key:3,ref:`tooltip`,class:`tooltip`,annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode===`Annotation`,onAnnotation:s.commitAnnotationEvent,onOnActionClick:s.onActionClick},null,8,[`annotationEntry`,`tooltipEntry`,`annotationDisplay`,`onAnnotation`,`onOnActionClick`])):(0,t.createCommentVNode)(``,!0)])])),[[k,e.loading]])}var A_=ug(__,[[`render`,k_],[`__scopeId`,`data-v-c6c6b030`]]),j_={"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`},M_={name:`MultiFlatmapVuer`,components:{Col:Sh,Row:xh,Option:Im,Select:Fm,Popover:Zh,FlatmapVuer:A_},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),p_.on(`onActionClick`,e=>{this.resourceSelected(e)}),p_.on(`open-pubmed-url`,e=>{this.$emit(`open-pubmed-url`,e)})},methods:{initialise:function(){return this.multiflatmapError=null,new Promise(e=>{if(this.requireInitialisation){this.requireInitialisation=!1;let t=new AbortController,n=t.signal,r=setTimeout(()=>t.abort(),5e3);fetch(this.flatmapAPI,{signal:n}).then(t=>{if(!t.ok){if(t.status===404)return this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded because the specified
|
|
32
|
+
for more details.`],this.flatmapError.button={text:`Restore Context`,callback:()=>{this.forceContextRestore()}}},onContextRestored:function(){if(this.mapImp){this.handleMapClick(),this.setInitMapState();let e=this.getState();e&&(e.viewport=this.lastViewport),this.restoreMapState(e),this.displayMinimap&&(this.mapImp.createMinimap({position:`top-right`}),this.addResizeButtonToMinimap()),this.filterToRestore&&=(this.mapImp.setVisibilityFilter(this.filterToRestore),void 0),this.$emit(`context-restored`,this)}},showPathwaysDrawer:function(e){this.drawerOpen=e},searchAndShowResult:function(e,t,n=!0){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;{let r=this.mapImp.search(e);if(r?.results?.length){if(this.mapImp.showSearchResults(r),t){let e;for(let t=0;t<r.results.length;t++){e=r.results[t].featureId;let n=this.mapImp.annotation(e);if(e&&n?.label)break}if(e){let t=this.mapImp.featureProperties(e),r={resource:[t.models],feature:t,label:t.label,provenanceTaxonomy:t.taxons,alert:s_(t.alert)};this.checkAndCreatePopups([r],n);let i=t.id.startsWith(`ilxtr:`)||t.id.startsWith(`ilx:`);i?(this.lastHoveredFeature=t,this.lastHoveredFeature.mapUUID=this.mapImp.uuid):this.lastHoveredFeature=null,this.mapImp.showPopup(e,o_(t.label),{className:i?`flatmap-tooltip-popup`:`custom-popup`,positionAtLastClick:!1,preserveSelection:!0})}}return this.searchTerm=e,!0}this.mapImp.clearSearchResults()}}return!1},highlightConnectedPaths:function(e){if(e.length){let t=e.filter(e=>e in this.mapImp.pathways.paths),n=this.mapImp.modelFeatureIdList(t);this.mapImp.selectGeoJSONFeatures(n)}},searchSuggestions:function(e){return this.mapImp?this.mapImp.search(e):[]},onActionClick:function(e){S_.emit(`onActionClick`,e)},setConnectionType:function(e){this.connectionType=e},_handleTooltipMutation:function(e){for(let t of e)for(let e of t.addedNodes)if(e.nodeType===1){if(e.matches&&e.matches(`.flatmap-tooltip-popup`))this._applyCustomTooltipContent(e);else if(e.querySelector){let t=e.querySelector(`.flatmap-tooltip-popup`);t&&this._applyCustomTooltipContent(t)}}},_applyCustomTooltipContent:function(e){if(!(!this.tooltipContentProvider||!this.lastHoveredFeature))try{let t=this.lastHoveredFeature,n=t[0]&&typeof t[0]==`object`,r;if(n){let e=[],n=t.mapUUID;for(let[r,i]of Object.entries(t))r!==`mapUUID`&&i&&typeof i==`object`&&e.push({...i,mapUUID:n});r=this.tooltipContentProvider(e.length>1?e:e[0])}else r=this.tooltipContentProvider(t);if(r){let t=e.querySelector(`.maplibregl-popup-content`);t&&(t.innerHTML=r)}}catch(e){console.warn(`[flatmapvuer] Error in tooltipContentProvider:`,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},render:{type:Boolean,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},externalLegends:{type:Array,default:function(){return[]}},tooltipContentProvider:{type:Function,default:null}},provide(){return{flatmapAPI:this.flatmapAPI,sparcAPI:this.sparcAPI,userApiKey:this.userToken}},data:function(){return{filterToRestore:void 0,flatmapError:null,sensor:null,mapManagerRef:void 0,flatmapQueries:void 0,annotationEntry:[],tooltipDisplay:!1,serverURL:void 0,layers:[],pathways:[],initMapState:(0,t.markRaw)({}),sckanDisplay:[{label:`Display Path with SCKAN`,key:`VALID`}],systems:[],taxonConnectivity:[],pathwaysMaxHeight:1e3,tooltipWait:(0,t.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:c_,isFC:!1,inHelp:!1,currentBackground:`white`,availableBackground:[`white`,`lightskyblue`,`black`],loading:!1,flatmapMarker:Wg,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:{},lastHoveredFeature:null,tooltipObserver:null,connectionEntry:{},existDrawnFeatures:[],doubleClickedFeature:!1,containsAlert:!1,alertOptions:[{label:`Display Path With Notes`,key:`alert`,enabled:!0},{label:`Display Path Without Notes`,key:`withoutAlert`,enabled:!0}],mapFilters:(0,t.markRaw)({alert:{with:!0,without:!0}}),searchTerm:``,taxonLeaveDelay:void 0,connectivityFilters:[],flatmapLegends:[],lastViewport:void 0}},computed:{...(0,c.mapState)(b_,[`userToken`]),isValidDrawnCreated:function(){return Object.keys(this.drawnCreatedEvent).length>0},requiresDrawer:function(){return this.loading?(this.drawerOpen=!1,!1):this.systems?.length>0||this.containsAlert&&this.alertOptions||this.pathways?.length>0||this.taxonConnectivity?.length>0||this.legendEntry?.length>0?(this.drawerOpen=!0,!0):(this.drawerOpen=!1,!1)},modeDescription:function(){let e=this.viewingModes[this.viewingMode];return this.viewingMode===`Annotation`?this.authorisedUser?e[1]:e[0]:e},legendEntry:function(){return[...this.flatmapLegends,...this.externalLegends]},showDatasetMarkerTooltip:function(){return this.hoverVisibilities[9].value}},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))},render:function(e){e&&this.mapImp&&this.mapImp.contextLost&&!this.loading&&this.$nextTick(()=>{this.forceContextRestore()})},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(e=>{e.name&&e.email&&e.canUpdate?(this.authorisedUser=e,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=[],n={x:null,y:null},r=this.$el.querySelector(`.maplibregl-canvas`),i=()=>{r.removeEventListener(`keydown`,a),r.removeEventListener(`click`,o)},a=n=>{if(![`Escape`,`Enter`].includes(n.key))return;let r=e===`Point`&&t.length===1||e===`LineString`&&t.length>=2||e===`Polygon`&&t.length>=3;(n.key===`Escape`||n.key===`Enter`&&!r)&&(this.activeDrawTool=void 0),i()},o=e=>{let a=r.getBoundingClientRect(),o=e.clientX-a.left,s=e.clientY-a.top;if(Math.sqrt((o-n.x)**2+(s-n.y)**2)<8){this.isValidDrawnCreated||(this.activeDrawTool=void 0),i();return}n={x:o,y:s},t.push(n)};e&&(i(),r.addEventListener(`keydown`,a),r.addEventListener(`click`,o))}},created:function(){this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new u_.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef))},mounted:function(){this.openMapRef=(0,t.shallowRef)(this.$refs.openMapRef),this.backgroundIconRef=(0,t.shallowRef)(this.$refs.backgroundIconRef),this.tooltipWait.length=this.hoverVisibilities.length,this.flatmapQueries=(0,t.markRaw)(new Zg),this.flatmapQueries.initialise(this.flatmapAPI),this.state?this.setStateRequired&&this.setState(this.state):this.renderAtMounted&&this.createFlatmap(),a_(),this.tooltipContentProvider&&this.$nextTick(()=>{let e=this.$refs.flatmapContainer||this.$el;e&&(this.tooltipObserver=new MutationObserver(this._handleTooltipMutation.bind(this)),this.tooltipObserver.observe(e,{childList:!0,subtree:!0}))})},beforeUnmount:function(){this.tooltipObserver&&=(this.tooltipObserver.disconnect(),null)}},D_={class:`flatmap-container`,ref:`flatmapContainer`,"element-loading-text":`Loading...`,"element-loading-background":`rgba(0, 0, 0, 0.3)`},O_={style:{height:`100%`,width:`100%`,position:`relative`,"overflow-y":`none`}},k_={style:{height:`100%`,width:`100%`},ref:`display`,class:`flatmap-display`},A_={class:`beta-popovers`},j_={key:2,class:`warning-text`},M_={class:`bottom-right-control`},N_=[`innerHTML`],P_={style:{"margin-bottom":`2px`}},F_={key:0,class:`viewing-mode-title`},I_=[`onClick`],L_=[`onClick`];function R_(e,r,i,a,o,s){let c=(0,t.resolveComponent)(`map-svg-sprite-color`),l=Rg,u=n.WarningFilled,d=yd,f=Zh,p=n.ArrowDown,m=(0,t.resolveComponent)(`DrawToolbar`),h=(0,t.resolveComponent)(`map-svg-icon`),g=kg,_=(0,t.resolveComponent)(`tree-controls`),v=vg,y=n.ArrowLeft,b=$p,x=xh,S=Sh,C=Im,w=Fm,T=gh,E=_h,D=(0,t.resolveComponent)(`Tooltip`),O=Xh,k=cg;return(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,D_,[(0,t.createVNode)(c),(0,t.createElementVNode)(`div`,O_,[(0,t.createElementVNode)(`div`,k_,null,512),e.flatmapError?((0,t.openBlock)(),(0,t.createBlock)(l,{key:0,flatmapError:e.flatmapError},null,8,[`flatmapError`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,A_,[(0,t.createElementVNode)(`div`,null,[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,"popper-class":`warning-popper flatmap-popper`,teleported:!1,visible:e.hoverVisibilities[7].value,ref:`warningPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`warning-icon`,onMouseover:r[7]||=e=>s.showTooltip(7),onMouseout:r[8]||=e=>s.hideTooltip(7)},[i.displayWarning||i.isLegacy?((0,t.openBlock)(),(0,t.createBlock)(d,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1})):(0,t.createCommentVNode)(``,!0),i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:1},[r[31]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`Legacy Map`,-1),(0,t.createElementVNode)(`div`,{class:`latest-map-text`,onClick:r[6]||=(...e)=>s.viewLatestMap&&s.viewLatestMap(...e)},` Click here for the latest map `)],64)):i.displayWarning?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,j_,`Beta`)):(0,t.createCommentVNode)(``,!0)],32)]),default:(0,t.withCtx)(()=>[i.isLegacy?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:0,onMouseover:r[0]||=e=>s.showTooltip(7),onMouseout:r[1]||=e=>s.hideTooltip(7)},` This is a legacy map, you may view the latest map instead. `,32)):e.isFC?((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:1,onMouseover:r[2]||=e=>s.showTooltip(7),onMouseout:r[3]||=e=>s.hideTooltip(7)},[...r[29]||=[(0,t.createTextVNode)(` This map displays the connectivity of individual neurons. Specifically, those which align with (parts of) the neuron populations from the `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(`. `,-1)]],32)):((0,t.openBlock)(),(0,t.createElementBlock)(`p`,{key:2,onMouseover:r[4]||=e=>s.showTooltip(7),onMouseout:r[5]||=e=>s.hideTooltip(7)},[...r[30]||=[(0,t.createTextVNode)(` This map displays the connectivity of neuron populations. Specifically, those from the primarily rat-based `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/1ZUKXU2YmLcn2reCyXjlew`,target:`_blank`},` ApiNATOMY `,-1),(0,t.createTextVNode)(` models available in `,-1),(0,t.createElementVNode)(`a`,{href:`https://sparc.science/resources/6eg3VpJbwQR4B84CjrvmyD`,target:`_blank`},` SCKAN `,-1),(0,t.createTextVNode)(`. New connectivity and species specificity will be added as the SPARC program progresses. `,-1)]],32))]),_:1},8,[`visible`])):(0,t.createCommentVNode)(``,!0)]),i.displayLatestChanges?((0,t.openBlock)(),(0,t.createBlock)(f,{key:0,placement:`right`,teleported:!1,trigger:`manual`,"popper-class":`warning-popper flatmap-popper`,visible:e.hoverVisibilities[8].value,ref:`whatsNewPopover`},{reference:(0,t.withCtx)(()=>[i.displayLatestChanges?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,class:`latest-changesicon`,onMouseover:r[9]||=e=>s.showTooltip(8),onMouseout:r[10]||=e=>s.hideTooltip(8)},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(u)]),_:1}),r[32]||=(0,t.createElementVNode)(`span`,{class:`warning-text`},`What's new?`,-1)],32)):(0,t.createCommentVNode)(``,!0)]),default:(0,t.withCtx)(()=>[...r[33]||=[(0,t.createElementVNode)(`b`,null,`Connectivity References`,-1),(0,t.createElementVNode)(`p`,null,` Connectivity references have been improved and available in various formats. `,-1),(0,t.createElementVNode)(`b`,null,`Improved state storing`,-1),(0,t.createElementVNode)(`p`,null,` Current selection and visibility filters are now stored when creating a permalink. `,-1)]]),_:1},8,[`visible`])):(0,t.createCommentVNode)(``,!0)],512),[[t.vShow,!i.disableUI]]),(0,t.withDirectives)((0,t.createVNode)(d,{class:(0,t.normalizeClass)([`minimap-resize`,{enlarge:e.minimapSmall,shrink:!e.minimapSmall}]),ref:`minimapResize`,onClick:s.closeMinimap},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(p)]),_:1},8,[`class`,`onClick`]),[[t.vShow,e.minimapResizeShow]]),e.viewingMode===`Annotation`&&(e.authorisedUser||e.offlineAnnotationEnabled)&&!i.disableUI?((0,t.openBlock)(),(0,t.createBlock)(m,{key:1,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:s.toolbarEvent,onFeatureTooltip:s.connectedFeatureTooltip,onConfirmDrawn:s.confirmDrawnFeature,onCancelDrawn:s.cancelDrawnFeature,onShowTooltip:s.showTooltip,onHideTooltip:s.hideTooltip,ref:`toolbarPopover`},null,8,[`mapCanvas`,`toolbarOptions`,`activeDrawTool`,`activeDrawMode`,`newlyDrawnEntry`,`connectionEntry`,`hoverVisibilities`,`onClickToolbar`,`onFeatureTooltip`,`onConfirmDrawn`,`onCancelDrawn`,`onShowTooltip`,`onHideTooltip`])):(0,t.createCommentVNode)(``,!0),(0,t.withDirectives)((0,t.createElementVNode)(`div`,M_,[(0,t.createVNode)(f,{content:`Zoom in`,placement:`left`,teleported:!1,trigger:`manual`,width:`70`,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[1].value,ref:`zoomInPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`icon-button-container`,onClick:r[11]||=e=>s.zoomIn(),onMouseover:r[12]||=e=>s.showTooltip(1),onMouseout:r[13]||=e=>s.hideTooltip(1)},[(0,t.createVNode)(h,{class:`icon-button zoomIn`,icon:`zoomIn`})],32)]),_:1},8,[`visible`]),(0,t.createVNode)(f,{content:`Zoom out`,placement:`top-end`,teleported:!1,trigger:`manual`,width:`70`,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[2].value,ref:`zoomOutPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`icon-button-container`,onClick:r[14]||=e=>s.zoomOut(),onMouseover:r[15]||=e=>s.showTooltip(2),onMouseout:r[16]||=e=>s.hideTooltip(2)},[(0,t.createVNode)(h,{class:`icon-button zoomOut`,icon:`zoomOut`})],32)]),_:1},8,[`visible`]),(0,t.createVNode)(f,{content:`Reset`,placement:`top`,teleported:!1,trigger:`manual`,width:`70`,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[3].value,ref:`zoomFitPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{class:`icon-button-container`,onClick:r[17]||=e=>s.resetView(),onMouseover:r[18]||=e=>s.showTooltip(3),onMouseout:r[19]||=e=>s.hideTooltip(3)},[(0,t.createVNode)(h,{class:`icon-button fitWindow`,icon:`fitWindow`})],32)]),default:(0,t.withCtx)(()=>[r[34]||=(0,t.createElementVNode)(`div`,null,[(0,t.createTextVNode)(` Fit to `),(0,t.createElementVNode)(`br`),(0,t.createTextVNode)(` window `)],-1)]),_:1},8,[`visible`])],512),[[t.vShow,!i.disableUI]]),(0,t.createVNode)(f,{content:`Change pathway visibility`,placement:`right`,teleported:!1,trigger:`manual`,offset:-18,"popper-class":`flatmap-popper`,visible:e.hoverVisibilities[6].value,ref:`checkBoxPopover`},{reference:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`pathway-location`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{class:(0,t.normalizeClass)([`pathway-container`,{open:e.drawerOpen,close:!e.drawerOpen}]),style:(0,t.normalizeStyle)({"max-height":e.pathwaysMaxHeight+`px`})},[s.legendEntry.length?((0,t.openBlock)(),(0,t.createBlock)(g,{key:0,identifierKey:`prompt`,colourKey:`colour`,styleKey:`style`,legends:s.legendEntry,showStarInLegend:!0,showDatasetMarkerTooltip:s.showDatasetMarkerTooltip,ref:`featuredMarkerPopover`,class:`svg-legends-container`},null,8,[`legends`,`showDatasetMarkerTooltip`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{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:(0,t.withCtx)(()=>[(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:`flatmap-marker-help`,innerHTML:e.flatmapMarker},null,8,N_),[[t.vShow,e.hoverVisibilities[0].value],[O,void 0,`markerPopover`]])]),_:1},8,[`visible`]),e.isFC&&e.systems&&e.systems.length>0?((0,t.openBlock)(),(0,t.createBlock)(_,{key:1,class:`treeControls`,mapType:`flatmap`,title:`Systems`,treeData:e.systems,active:e.currentActive,hover:e.currentHover,onCheckChanged:s.systemSelected,onCheckAll:s.checkAllSystems,onChangeActive:s.ftuSelected,ref:`treeControls`},null,8,[`treeData`,`active`,`hover`,`onCheckChanged`,`onCheckAll`,`onChangeActive`])):(0,t.createCommentVNode)(``,!0),e.containsAlert&&e.alertOptions&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Notes`,labelKey:`label`,identifierKey:`key`,selections:e.alertOptions,onChanged:s.alertSelected,onCheckboxMouseEnter:s.alertMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllAlerts,ref:`alertSelection`,key:`alertSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.pathways&&e.pathways.length>0?((0,t.openBlock)(),(0,t.createBlock)(v,{title:`Pathways`,labelKey:`label`,identifierKey:`type`,colourStyle:`line`,selections:e.pathways,showAsLegend:!i.showPathwayFilter,onChanged:s.pathwaysSelected,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllPathways,ref:`pathwaysSelection`,key:`pathwaysSelection`},null,8,[`selections`,`showAsLegend`,`onChanged`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0),e.taxonConnectivity&&e.taxonConnectivity.length>0&&i.showPathwayFilter?((0,t.openBlock)(),(0,t.createBlock)(v,{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:s.taxonsSelected,onCheckboxMouseEnter:s.taxonMouseEnterEmitted,onSelectionsDataChanged:s.onSelectionsDataChanged,onCheckAll:s.checkAllTaxons,ref:`taxonSelection`,key:`taxonSelection`},null,8,[`selections`,`onChanged`,`onCheckboxMouseEnter`,`onSelectionsDataChanged`,`onCheckAll`])):(0,t.createCommentVNode)(``,!0)],6)),[[O,void 0,`checkBoxPopover`]]),(0,t.createElementVNode)(`div`,{onClick:r[20]||=(...e)=>s.toggleDrawer&&s.toggleDrawer(...e),class:(0,t.normalizeClass)([`drawer-button`,{open:e.drawerOpen,close:!e.drawerOpen}])},[(0,t.createVNode)(d,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(y)]),_:1})],2)],2),[[t.vShow,!i.disableUI&&s.requiresDrawer]])]),_:1},8,[`visible`]),e.openMapRef?((0,t.openBlock)(),(0,t.createBlock)(f,{key:2,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:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(i.openMapOptions,n=>((0,t.openBlock)(),(0,t.createBlock)(x,{key:n.key},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(b,{type:`primary`,plain:``,onClick:t=>e.$emit(`open-map`,n.key)},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(n.display),1)]),_:2},1032,[`onClick`])]),_:2},1024))),128))]),_:1},8,[`virtual-ref`])):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(f,{ref:`backgroundPopover`,"virtual-ref":e.backgroundIconRef,placement:`top-start`,width:`320`,teleported:!1,trigger:`click`,"popper-class":`background-popper h-auto`,"virtual-triggering":``},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,null,[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[35]||=[(0,t.createTextVNode)(`Viewing Mode`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,P_,[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.viewingModes,(n,r,i)=>((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:r},[r===e.viewingMode?((0,t.openBlock)(),(0,t.createElementBlock)(`span`,F_,[(0,t.createElementVNode)(`b`,null,(0,t.toDisplayString)(r),1)])):((0,t.openBlock)(),(0,t.createElementBlock)(`span`,{key:1,class:`viewing-mode-unselected`,onClick:e=>s.changeViewingMode(r)},(0,t.toDisplayString)(r),9,I_))],64))),128))]),(0,t.createVNode)(x,{class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(s.modeDescription),1)]),_:1}),e.viewingMode===`Annotation`&&e.offlineAnnotationEnabled?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0,class:`viewing-mode-description`},{default:(0,t.withCtx)(()=>[...r[36]||=[(0,t.createTextVNode)(` (Anonymous annotate) `,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0)]),_:1}),e.viewingMode===`Annotation`&&e.authorisedUser?((0,t.openBlock)(),(0,t.createElementBlock)(t.Fragment,{key:0},[(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[37]||=[(0,t.createTextVNode)(`Annotations From`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(w,{teleported:!1,modelValue:e.annotationFrom,"onUpdate:modelValue":r[21]||=t=>e.annotationFrom=t,placeholder:`Select`,class:`select-box`,"popper-class":`flatmap_dropdown`,onChange:s.setAnnotationFrom},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.annotatedSource,e=>((0,t.openBlock)(),(0,t.createBlock)(C,{key:e,label:e,value:e},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(x,null,{default:(0,t.withCtx)(()=>[(0,t.createVNode)(S,{span:12},{default:(0,t.withCtx)(()=>[(0,t.createTextVNode)((0,t.toDisplayString)(e),1)]),_:2},1024)]),_:2},1024)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])]),_:1})],64)):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1,class:`backgroundSpacer`})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:2,class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[38]||=[(0,t.createTextVNode)(`Flight path display`,-1)]]),_:1})):(0,t.createCommentVNode)(``,!0),e.displayFlightPathOption?((0,t.openBlock)(),(0,t.createBlock)(x,{key:3,class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.flightPath3DRadio,"onUpdate:modelValue":r[22]||=t=>e.flightPath3DRadio=t,class:`flatmap-radio`,onChange:s.setFlightPath3D},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[39]||=[(0,t.createTextVNode)(`2D`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[40]||=[(0,t.createTextVNode)(`3D`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1})):(0,t.createCommentVNode)(``,!0),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[41]||=[(0,t.createTextVNode)(`Organs display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.colourRadio,"onUpdate:modelValue":r[23]||=t=>e.colourRadio=t,class:`flatmap-radio`,onChange:s.setColour},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[42]||=[(0,t.createTextVNode)(`Colour`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[43]||=[(0,t.createTextVNode)(`Greyscale`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[44]||=[(0,t.createTextVNode)(`Outlines display`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(E,{modelValue:e.outlinesRadio,"onUpdate:modelValue":r[24]||=t=>e.outlinesRadio=t,class:`flatmap-radio`,onChange:s.setOutlines},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(T,{value:!0},{default:(0,t.withCtx)(()=>[...r[45]||=[(0,t.createTextVNode)(`Show`,-1)]]),_:1}),(0,t.createVNode)(T,{value:!1},{default:(0,t.withCtx)(()=>[...r[46]||=[(0,t.createTextVNode)(`Hide`,-1)]]),_:1})]),_:1},8,[`modelValue`,`onChange`])]),_:1}),(0,t.createVNode)(x,{class:`backgroundSpacer`}),(0,t.createVNode)(x,{class:`backgroundText`},{default:(0,t.withCtx)(()=>[...r[47]||=[(0,t.createTextVNode)(`Change background`,-1)]]),_:1}),(0,t.createVNode)(x,{class:`backgroundControl`},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.availableBackground,n=>((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:n,class:(0,t.normalizeClass)([`backgroundChoice`,n,n==e.currentBackground?`active`:``]),onClick:e=>s.backgroundChangeCallback(n)},null,10,L_))),128))]),_:1})])]),_:1},8,[`virtual-ref`]),(0,t.withDirectives)((0,t.createElementVNode)(`div`,{class:(0,t.normalizeClass)([`settings-group`,{open:e.drawerOpen,close:!e.drawerOpen}])},[i.showOpenMapButton?((0,t.openBlock)(),(0,t.createBlock)(x,{key:0},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{visible:e.hoverVisibilities[4].value,content:`Open new map`,placement:`right`,teleported:!1,"popper-class":`flatmap-popper`,ref:`openMapPopover`},{reference:(0,t.withCtx)(()=>[i.enableOpenMapUI&&i.openMapOptions.length>0?((0,t.openBlock)(),(0,t.createElementBlock)(`div`,{key:0,ref:`openMapRef`,class:`icon-button-container`,onMouseover:r[25]||=e=>s.showTooltip(4),onMouseout:r[26]||=e=>s.hideTooltip(4)},[(0,t.createVNode)(h,{icon:`openMap`,class:`icon-button open-map-button`})],544)):(0,t.createCommentVNode)(``,!0)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0),i.showLocalSettings?((0,t.openBlock)(),(0,t.createBlock)(x,{key:1},{default:(0,t.withCtx)(()=>[(0,t.createVNode)(f,{content:`Change settings`,placement:`right`,visible:e.hoverVisibilities[5].value,teleported:!1,trigger:`manual`,"popper-class":`flatmap-popper`,ref:`settingsPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`div`,{ref:`backgroundIconRef`,class:`icon-button-container`,onMouseover:r[27]||=e=>s.showTooltip(5),onMouseout:r[28]||=e=>s.hideTooltip(5)},[(0,t.createVNode)(h,{icon:`changeBckgd`,class:`icon-button`})],544)]),_:1},8,[`visible`])]),_:1})):(0,t.createCommentVNode)(``,!0)],2),[[t.vShow,!i.disableUI]]),e.tooltipDisplay?((0,t.openBlock)(),(0,t.createBlock)(D,{key:3,ref:`tooltip`,class:`tooltip`,annotationEntry:e.annotationEntry,tooltipEntry:e.tooltipEntry,annotationDisplay:e.viewingMode===`Annotation`,onAnnotation:s.commitAnnotationEvent,onOnActionClick:s.onActionClick},null,8,[`annotationEntry`,`tooltipEntry`,`annotationDisplay`,`onAnnotation`,`onOnActionClick`])):(0,t.createCommentVNode)(``,!0)])])),[[k,e.loading]])}var z_=ug(E_,[[`render`,R_],[`__scopeId`,`data-v-b0121717`]]),B_={"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`},V_={name:`MultiFlatmapVuer`,components:{Col:Sh,Row:xh,Option:Im,Select:Fm,Popover:Zh,FlatmapVuer:z_},created:function(){this.loadMapManager()},mounted:function(){this.initialise(),S_.on(`onActionClick`,e=>{this.resourceSelected(e)}),S_.on(`open-pubmed-url`,e=>{this.$emit(`open-pubmed-url`,e)})},methods:{initialise:function(){return this.multiflatmapError=null,new Promise(e=>{if(this.requireInitialisation){this.requireInitialisation=!1;let t=new AbortController,n=t.signal,r=setTimeout(()=>t.abort(),5e3);fetch(this.flatmapAPI,{signal:n}).then(t=>{if(!t.ok){if(t.status===404)return this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded because the specified
|
|
25
33
|
flatmap API endpoint is incorrect. Please check the endpoint URL
|
|
26
34
|
or contact support if the problem persists.`],this.initialised=!0,e(),this.resolveList.forEach(e=>e()),Promise.reject({handled:!0});throw Error(`HTTP ${t.status}: ${t.statusText}`)}return t.json()}).then(t=>{if(t&&t.status_code===404){console.error(`Flatmap API endpoint is incorrect`,t),this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded because the specified
|
|
27
35
|
flatmap API endpoint is incorrect. Please check the endpoint URL
|
|
28
36
|
or contact support if the problem persists.`],this.initialised=!0,e(),this.resolveList.forEach(e=>e());return}Object.keys(this.availableSpecies).forEach(e=>{let n=this.availableSpecies[e].uuid;if(n&&t.length&&t.map(e=>e.uuid).indexOf(n)>0)this.speciesList[e]=this.availableSpecies[e];else for(let n=0;n<t.length;n++)if(this.availableSpecies[e].taxo===t[n].taxon){if(this.availableSpecies[e].biologicalSex){if(t[n].biologicalSex&&t[n].biologicalSex===this.availableSpecies[e].biologicalSex){this.speciesList[e]=this.availableSpecies[e];break}}else{this.speciesList[e]=this.availableSpecies[e];break}}});let n=this.initial;if(this.state){let e=this.state.state;n=(!e||!e.uuid&&!e.entry)&&this.state.species?this.state.species:void 0}n&&(this.activeSpecies=n&&this.speciesList[n]!==void 0?n:Object.keys(this.speciesList)[0],this.setSpecies(this.activeSpecies,this.state?this.state.state:void 0,5)),this.initialised=!0,e(),this.resolveList.forEach(e=>{e()})}).catch(t=>{t&&t.handled||(console.error(`Error fetching flatmap:`,t),this.initialised=!0,this.multiflatmapError={},this.multiflatmapError.title=`MultiFlatmap Error!`,this.multiflatmapError.messages=[`Sorry, the component could not be loaded due to an unexpected error.
|
|
29
|
-
Please try again later or contact support if the problem persists.`],e(),this.resolveList.forEach(e=>{e()}))}).finally(()=>{clearTimeout(r)})}else this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new u_.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef)))},resourceSelected:function(e){this.$emit(`resource-selected`,e)},onContextRestored:function(e){this.$emit(`context-restored`,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,n){this.getCurrentFlatmap().showPopup(e,t,n)},showMarkerPopup:function(e,t,n){this.getCurrentFlatmap().showMarkerPopup(e,t,n)},setSpecies:function(e,t,n){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit(`flatmapChanged`,this.activeSpecies);else if(n){let r=n-1;r>=0&&this.$nextTick(()=>{this.setSpecies(e,t,r)})}},viewLatestMap:function(e){let t=Object.keys(this.speciesList);for(let n=0;n<t.length;n++){let r=this.speciesList[t[n]];if(!r.isLegacy&&r.taxo===e.entry&&r.biologicalSex===e.biologicalSex){this.setSpecies(t[n],e,0);return}}},createLegacyEntry:function(e,t,n){if(n&&t){let r=`Legacy`;return e.species&&(e.species.slice(0,6)===`Legacy`?r=e.species:r+=` ${e.species}`),this.speciesList[r]={taxo:t,isLegacy:!0,displayWarning:!0},{species:r,state:{entry:t,uuid:n,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){let n=e.state;if(!n.uuid){if(n.entry){let r=n.entry in
|
|
37
|
+
Please try again later or contact support if the problem persists.`],e(),this.resolveList.forEach(e=>{e()}))}).finally(()=>{clearTimeout(r)})}else this.initialised?e():this.resolveList.push(e)})},loadMapManager:function(){this.mapManagerRef||(this.mapManager?this.mapManagerRef=this.mapManager:(this.mapManagerRef=(0,t.markRaw)(new u_.MapViewer(this.flatmapAPI,{container:void 0})),this.$emit(`mapmanager-loaded`,this.mapManagerRef)))},resourceSelected:function(e){this.$emit(`resource-selected`,e)},onContextRestored:function(e){this.$emit(`context-restored`,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,n){this.getCurrentFlatmap().showPopup(e,t,n)},showMarkerPopup:function(e,t,n){this.getCurrentFlatmap().showMarkerPopup(e,t,n)},setSpecies:function(e,t,n){if(this.$refs&&e in this.$refs)this.activeSpecies=e,this.$refs[this.activeSpecies][0].createFlatmap(t),this.$emit(`flatmapChanged`,this.activeSpecies);else if(n){let r=n-1;r>=0&&this.$nextTick(()=>{this.setSpecies(e,t,r)})}},viewLatestMap:function(e){let t=Object.keys(this.speciesList);for(let n=0;n<t.length;n++){let r=this.speciesList[t[n]];if(!r.isLegacy&&r.taxo===e.entry&&r.biologicalSex===e.biologicalSex){this.setSpecies(t[n],e,0);return}}},createLegacyEntry:function(e,t,n){if(n&&t){let r=`Legacy`;return e.species&&(e.species.slice(0,6)===`Legacy`?r=e.species:r+=` ${e.species}`),this.speciesList[r]={taxo:t,isLegacy:!0,displayWarning:!0},{species:r,state:{entry:t,uuid:n,viewport:e.state.viewport,searchTerm:e.state.searchTerm}}}},updateState:function(e){return new Promise(t=>{if(e&&e.state){let n=e.state;if(!n.uuid){if(n.entry){let r=n.entry in B_?B_[n.entry]:void 0;t(this.createLegacyEntry(e,n.entry,r)||e)}}else if(n.entry)return new Promise(()=>{let r={taxon:n.entry};n.biologicalSex&&(r.biologicalSex=n.biologicalSex),this.mapManagerRef.findMap(r).then(t=>{if(t.uuid!==n.uuid)return this.createLegacyEntry(e,n.entry,n.uuid)}).then(n=>{t(n||e)}).catch(()=>{t(e)})})}t(e)})},getState:function(){let e={species:this.activeSpecies,state:void 0};return e.state=this.getCurrentFlatmap().getState(),e},setState:function(e){e&&(this.loadMapManager(),this.updateState(e).then(e=>{this.initialise().then(()=>{e.species&&e.species!==this.activeSpecies?this.setSpecies(e.species,e.state,5):e.state&&this.getCurrentFlatmap().setState(e.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){let t=this.getCurrentFlatmap();t&&t.changeViewingMode(e)},setConnectionType:function(e){this.getCurrentFlatmap().setConnectionType(e)}},props:{initial:{type:String,default:``},minZoom:{type:Number,default:1},renderAtMounted:{type:Boolean,default:!1},render:{type:Boolean,default:!0},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},externalLegends:{type:Array,default:function(){return[]}},tooltipContentProvider:{type:Function,default:null}},data:function(){return{activeSpecies:void 0,speciesList:{},requireInitialisation:!0,resolveList:(0,t.markRaw)([]),initialised:!1,mapManagerRef:void 0,multiflatmapError:null}},watch:{state:{handler:function(e){this.setState(e)},immediate:!0,deep:!0},activeSpecies:{handler:function(e,t){t&&this.$refs[t][0].forceContextLoss()}}}},H_={class:`multi-container`,ref:`multiContainer`},U_={key:0,style:{position:`absolute`,"z-index":`100`}},W_={class:`select-box-icon`};function G_(e,n,r,i,a,o){let s=Im,c=Fm,l=Zh,u=z_,d=Rg;return(0,t.openBlock)(),(0,t.createElementBlock)(`div`,H_,[r.disableUI?(0,t.createCommentVNode)(``,!0):((0,t.openBlock)(),(0,t.createElementBlock)(`div`,U_,[n[2]||=(0,t.createElementVNode)(`div`,{class:`species-display-text`},`Species`,-1),(0,t.createVNode)(l,{content:`Select a species`,placement:`right`,trigger:`manual`,"popper-class":`flatmap-popper flatmap-teleport-popper right-popper`,width:`max-content`,visible:o.activateTooltipByIndex(0),teleported:!1,ref:`selectPopover`},{reference:(0,t.withCtx)(()=>[(0,t.createVNode)(c,{id:`flatmap-select`,teleported:!1,modelValue:e.activeSpecies,"onUpdate:modelValue":n[0]||=t=>e.activeSpecies=t,placeholder:`Select`,class:`select-box`,"popper-class":`flatmap-dropdown`,onChange:o.setSpecies},{default:(0,t.withCtx)(()=>[((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.speciesList,(e,n)=>((0,t.openBlock)(),(0,t.createBlock)(s,{key:n,label:n,value:n},{default:(0,t.withCtx)(()=>[(0,t.createElementVNode)(`span`,W_,[(0,t.createElementVNode)(`i`,{class:(0,t.normalizeClass)(e.iconClass)},null,2)]),(0,t.createTextVNode)(` `+(0,t.toDisplayString)(n),1)]),_:2},1032,[`label`,`value`]))),128))]),_:1},8,[`modelValue`,`onChange`])]),_:1},8,[`visible`])])),((0,t.openBlock)(!0),(0,t.createElementBlock)(t.Fragment,null,(0,t.renderList)(e.speciesList,(i,a)=>(0,t.withDirectives)(((0,t.openBlock)(),(0,t.createBlock)(u,{key:a,entry:i.taxo,uuid:i.uuid,biologicalSex:i.biologicalSex,displayWarning:i.displayWarning,displayLatestChanges:i.displayLatestChanges,isLegacy:i.isLegacy,ref_for:!0,ref:a,enableOpenMapUI:r.enableOpenMapUI,openMapOptions:r.openMapOptions,disableUI:r.disableUI,onContextRestored:o.onContextRestored,onViewLatestMap:o.viewLatestMap,onResourceSelected:o.resourceSelected,onReady:o.FlatmapReady,onPanZoomCallback:o.panZoomCallback,annotationSidebar:r.annotationSidebar,onAnnotationOpen:o.onAnnotationOpen,onAnnotationClose:o.onAnnotationClose,onUpdateOfflineAnnotationEnabled:o.updateOfflineAnnotationEnabled,connectivityInfoSidebar:r.connectivityInfoSidebar,onConnectivityInfoOpen:o.onConnectivityInfoOpen,onConnectivityInfoClose:o.onConnectivityInfoClose,onConnectivityError:o.onConnectivityError,onNeuronConnectionFeatureClick:o.onNeuronConnectionFeatureClick,onOpenMap:n[1]||=t=>e.$emit(`open-map`,t),onPathwaySelectionChanged:o.onSelectionsDataChanged,minZoom:r.minZoom,helpMode:e.activeSpecies==a&&r.helpMode,helpModeActiveItem:r.helpModeActiveItem,helpModeDialog:r.helpModeDialog,helpModeInitialIndex:-2,onHelpModeLastItem:o.onHelpModeLastItem,onShownTooltip:o.onTooltipShown,onShownMapTooltip:o.onMapTooltipShown,renderAtMounted:r.renderAtMounted,render:r.render&&e.activeSpecies==a,displayMinimap:r.displayMinimap,showStarInLegend:r.showStarInLegend,style:{height:`100%`},mapManager:e.mapManagerRef,flatmapAPI:r.flatmapAPI,sparcAPI:r.sparcAPI,showLocalSettings:r.showLocalSettings,showOpenMapButton:r.showOpenMapButton,showPathwayFilter:r.showPathwayFilter,externalLegends:r.externalLegends,tooltipContentProvider:r.tooltipContentProvider},null,8,`entry.uuid.biologicalSex.displayWarning.displayLatestChanges.isLegacy.enableOpenMapUI.openMapOptions.disableUI.onContextRestored.onViewLatestMap.onResourceSelected.onReady.onPanZoomCallback.annotationSidebar.onAnnotationOpen.onAnnotationClose.onUpdateOfflineAnnotationEnabled.connectivityInfoSidebar.onConnectivityInfoOpen.onConnectivityInfoClose.onConnectivityError.onNeuronConnectionFeatureClick.onPathwaySelectionChanged.minZoom.helpMode.helpModeActiveItem.helpModeDialog.onHelpModeLastItem.onShownTooltip.onShownMapTooltip.renderAtMounted.render.displayMinimap.showStarInLegend.mapManager.flatmapAPI.sparcAPI.showLocalSettings.showOpenMapButton.showPathwayFilter.externalLegends.tooltipContentProvider`.split(`.`))),[[t.vShow,e.activeSpecies==a]])),128)),e.multiflatmapError?((0,t.openBlock)(),(0,t.createBlock)(d,{key:1,flatmapError:e.multiflatmapError},null,8,[`flatmapError`])):(0,t.createCommentVNode)(``,!0)],512)}var K_=ug(V_,[[`render`,G_],[`__scopeId`,`data-v-1c8f035d`]]);e.FlatmapVuer=z_,e.MultiFlatmapVuer=K_});
|