@abi-software/map-side-bar 2.14.8-demo.3 → 2.14.8-demo.4

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.
@@ -474,7 +474,7 @@ usage: app.provide(ZINDEX_INJECTION_KEY, { current: 0 })`),{initialZIndex:r,curr
474
474
  ${p}`)}if(f!=null&&f.length){const p=f.map(m=>rs(m)).join(`
475
475
  `);h.push(`<div><strong>Curator Notes:</strong></div>
476
476
  ${p}`)}return h.join(`
477
- `)},somaLocations:function(){return this.cellType.somaLocations.map(t=>{var a;const o=Object.keys(Uy).find(i=>Uy[i]===t)||"";return((a=this.cellType.clusterAttributes)==null?void 0:a[o])?{name:Le(t),id:o}:!1})}},methods:{sanitizeMarkerGeneUri:function(e,t=""){let o=String(e||"").trim();const r=String(t||"").trim();if(!o)return"";if(r){const a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=o.replace(new RegExp(`\\s+${a}$`,"i"),"")}return o.trim()},transformString:function(e){return e?e.replace(/\^(\w+)/g,"<sup>$1</sup>"):""},onCopied:function(){de.emit("trackEvent",{event_name:"portal_maps_cell_card_copy",category:this.cellType.preferredLabel||"",location:"map_sidebar_cell_card"})},openCard:function(){this.$emit("open",this.cellType.id),de.emit("trackEvent",{event_name:"portal_maps_cell_card_open",category:this.cellType.id||"",location:"map_sidebar_cell_card"})},closeCard:function(){this.$emit("close"),de.emit("trackEvent",{event_name:"portal_maps_cell_card_close",category:this.cellType.id||"",location:"map_sidebar_cell_card"})},showSomaLocation:function(e){this.$emit("soma-location-hovered",e)},openDatasetSearch:function(e){var t;this.$emit("dataset-search",{species:Le((t=this.cellType)==null?void 0:t.species),location:e})},openConnectivitySearch:function(e){const t=localStorage.getItem("available-name-curie-mapping"),o=t?JSON.parse(t):{},r=Object.keys(o).find(i=>o[i].toLowerCase()===e.toLowerCase()),a=r?[{facet:`["${r}",[]]`,facetPropPath:"flatmap.connectivity.source.all",tagLabel:e,term:"All"}]:[];this.$emit("connectivity-search",{facets:a,query:""})},onSearchPopoverShow:function(e){this.activeSearchPopoverLocationId=e},onSearchPopoverHide:function(e){this.activeSearchPopoverLocationId===e&&(this.activeSearchPopoverLocationId=null)},showAlertMessage:function(){Zg(this,"alertElement")},formatAlertText:function(e){return rs(e)}}},JV={class:"title-content"},YV={class:"card-title"},ZV={class:"card-keywords"},XV={class:"card-chips"},QV={key:0,class:"source-publication-chip"},eL={class:"card-details"},tL={class:"card-details-inner"},nL={key:0,class:"card-section"},oL={key:1,class:"card-section"},rL={key:2,class:"card-section"},aL={class:"card-list-items"},iL=["onMouseenter"],sL={class:"card-list-search"},lL={class:"search-action-list"},cL=["onClick"],dL=["onClick"],uL={key:3,class:"card-section"},fL={key:4,class:"card-section"},pL={key:5,class:"card-section"},hL={class:"marker-genes-list"},mL=["href"],gL={key:0},yL={key:6,class:"card-section"},bL={class:"card-section-content"},wL={key:7,class:"card-section"},CL={class:"card-section-content success"},kL={key:8,class:"card-section"},SL={class:"related-cell-list"},vL=["onClick"],EL={key:9,class:"card-section source-publication-section"},xL=["href"],_L={key:10,class:"card-section",ref:"alertElement"},TL={class:"alert-block"},NL={key:0,class:"alert-block-section"},OL=["innerHTML"],BL={key:1,class:"alert-block-section"},FL=["innerHTML"];function IL(e,t,o,r,a,i){var h,p,m,b,k,N,C,x;const s=re.WarnTriangleFilled,l=ve,c=Qe,d=n.resolveComponent("CopyToClipboard"),u=re.Close,f=oo,y=re.Search,g=Hy;return n.openBlock(),n.createElementBlock("div",{ref:"cardElementRef",class:n.normalizeClass(["card",{active:o.isActive}]),style:n.normalizeStyle(i.cardStyleVars)},[n.createElementVNode("div",{class:"card-header",onClick:t[1]||(t[1]=(...v)=>i.openCard&&i.openCard(...v))},[n.createElementVNode("div",JV,[n.createElementVNode("div",YV,n.toDisplayString(o.cellType.preferredLabel),1),n.createElementVNode("div",ZV,[n.createElementVNode("span",null,n.toDisplayString(o.cellType.species),1),n.createElementVNode("div",XV,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.somaLocations,v=>(n.openBlock(),n.createElementBlock("span",{class:"card-chip",key:v},n.toDisplayString(v),1))),128))]),o.cellType.sourceNomenclature?(n.openBlock(),n.createElementBlock("span",QV,n.toDisplayString(o.cellType.sourceNomenclatureLabel),1)):n.createCommentVNode("",!0)]),o.isActive&&((h=o.cellType.alertNotes)!=null&&h.length||(p=o.cellType.curatorNotes)!=null&&p.length)?(n.openBlock(),n.createBlock(c,{key:0,round:"",size:"small",class:"alert-chip",onClick:n.withModifiers(i.showAlertMessage,["stop"])},{default:n.withCtx(()=>[n.createVNode(l,{class:"alert"},{default:n.withCtx(()=>[n.createVNode(s)]),_:1}),t[3]||(t[3]=n.createTextVNode(" Notes "))]),_:1},8,["onClick"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",{class:"title-buttons",onClick:t[0]||(t[0]=n.withModifiers(()=>{},["stop"]))},[n.createVNode(d,{onCopied:i.onCopied,content:i.updatedCopyContent},null,8,["onCopied","content"]),n.createVNode(f,{width:"auto",trigger:"hover",teleported:!1,"popper-class":"popover-map-pin"},{reference:n.withCtx(()=>[n.createVNode(c,{class:"button-circle",circle:"",onClick:i.closeCard},{default:n.withCtx(()=>[n.createVNode(l,{color:"white"},{default:n.withCtx(()=>[n.createVNode(u)]),_:1})]),_:1},8,["onClick"])]),default:n.withCtx(()=>[t[4]||(t[4]=n.createElementVNode("span",null,"Close",-1))]),_:1})])]),n.createElementVNode("div",eL,[n.createElementVNode("div",tL,[o.cellType.entity?(n.openBlock(),n.createElementBlock("div",nL,[t[5]||(t[5]=n.createElementVNode("div",{class:"card-section-title"},"Entity",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.entity),1)])):n.createCommentVNode("",!0),o.cellType.species?(n.openBlock(),n.createElementBlock("div",oL,[t[6]||(t[6]=n.createElementVNode("div",{class:"card-section-title"},"Species",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.species),1)])):n.createCommentVNode("",!0),(m=o.cellType.somaLocations)!=null&&m.length?(n.openBlock(),n.createElementBlock("div",rL,[t[7]||(t[7]=n.createElementVNode("div",{class:"card-section-title"},"Soma Location",-1)),n.createElementVNode("div",aL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.somaLocations,v=>(n.openBlock(),n.createElementBlock("div",{class:"card-list-item",key:v.id,onMouseenter:_=>i.showSomaLocation(v.name),onMouseleave:t[2]||(t[2]=_=>i.showSomaLocation())},[n.createElementVNode("span",null,n.toDisplayString(v.name),1),n.createElementVNode("div",sL,[n.createVNode(f,{width:"180",trigger:"hover",teleported:!0,"append-to":a.cardElement,"popper-class":"popover-origin-help popover-search-actions",onShow:_=>i.onSearchPopoverShow(v.id),onHide:_=>i.onSearchPopoverHide(v.id)},{reference:n.withCtx(()=>[n.createVNode(l,{class:n.normalizeClass(["status-search-icon",{"is-visible":a.activeSearchPopoverLocationId===v.id}])},{default:n.withCtx(()=>[n.createVNode(y)]),_:2},1032,["class"])]),default:n.withCtx(()=>[n.createElementVNode("div",lL,[n.createElementVNode("button",{type:"button",class:"search-action-button",onClick:_=>i.openDatasetSearch(v.name)}," Search dataset ",8,cL),n.createElementVNode("button",{type:"button",class:"search-action-button",onClick:_=>i.openConnectivitySearch(v.name)}," Search connectivity ",8,dL)])]),_:2},1032,["append-to","onShow","onHide"])])],40,iL))),128))])])):n.createCommentVNode("",!0),o.cellType.circuitRole?(n.openBlock(),n.createElementBlock("div",uL,[t[8]||(t[8]=n.createElementVNode("div",{class:"card-section-title"},"Circuit Role",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.circuitRole),1)])):n.createCommentVNode("",!0),o.cellType.creLine?(n.openBlock(),n.createElementBlock("div",fL,[t[9]||(t[9]=n.createElementVNode("div",{class:"card-section-title"},"Cre Line",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.creLine),1)])):n.createCommentVNode("",!0),i.formattedMarkerGenes.length?(n.openBlock(),n.createElementBlock("div",pL,[t[10]||(t[10]=n.createElementVNode("div",{class:"card-section-title"},"Marker Genes",-1)),n.createElementVNode("div",hL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.formattedMarkerGenes,v=>(n.openBlock(),n.createElementBlock("a",{key:v.key,class:"marker-gene-link",href:v.uri,target:"_blank",rel:"noopener noreferrer"},[n.createElementVNode("span",null,n.toDisplayString(v.name),1),v.expression?(n.openBlock(),n.createElementBlock("sup",gL,n.toDisplayString(v.expression),1)):n.createCommentVNode("",!0),n.createVNode(g,{class:"external-link-icon"})],8,mL))),128))])])):n.createCommentVNode("",!0),o.cellType.fiberTypeString?(n.openBlock(),n.createElementBlock("div",yL,[t[11]||(t[11]=n.createElementVNode("div",{class:"card-section-title"},"Axon Phenotype",-1)),n.createElementVNode("div",bL,n.toDisplayString(o.cellType.fiberTypeString),1)])):n.createCommentVNode("",!0),o.cellType.physiologyString?(n.openBlock(),n.createElementBlock("div",wL,[t[12]||(t[12]=n.createElementVNode("div",{class:"card-section-title"},"Physiology",-1)),n.createElementVNode("div",CL,n.toDisplayString(o.cellType.physiologyString),1)])):n.createCommentVNode("",!0),(b=o.cellType.relatedCells)!=null&&b.length?(n.openBlock(),n.createElementBlock("div",kL,[t[13]||(t[13]=n.createElementVNode("div",{class:"card-section-title"},"Related Species Variants",-1)),n.createElementVNode("ul",SL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.relatedCells,v=>(n.openBlock(),n.createElementBlock("li",{key:v},[n.createElementVNode("button",{class:"related-cell-item",onClick:n.withModifiers(_=>e.$emit("related-cell-click",v),["stop"]),title:"Click to view this cell type"},n.toDisplayString(v.label),9,vL)]))),128))])])):n.createCommentVNode("",!0),o.cellType.sourceNomenclature?(n.openBlock(),n.createElementBlock("div",EL,[t[14]||(t[14]=n.createElementVNode("div",{class:"card-section-title"},"Source Publication",-1)),n.createElementVNode("p",null,[n.createElementVNode("a",{class:"source-publication-link",href:o.cellType.sourceNomenclature,target:"_blank",rel:"noopener noreferrer"},[n.createTextVNode(n.toDisplayString(o.cellType.sourceNomenclatureLabel)+" ",1),n.createVNode(g,{class:"external-link-icon"})],8,xL)])])):n.createCommentVNode("",!0),(k=o.cellType.alertNotes)!=null&&k.length||(N=o.cellType.curatorNotes)!=null&&N.length?(n.openBlock(),n.createElementBlock("div",_L,[t[17]||(t[17]=n.createElementVNode("div",{class:"card-section-title"},"Notes",-1)),n.createElementVNode("div",TL,[(C=o.cellType.alertNotes)!=null&&C.length?(n.openBlock(),n.createElementBlock("div",NL,[t[15]||(t[15]=n.createElementVNode("div",{class:"alert-block-title"},"Alert Notes:",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.alertNotes,v=>(n.openBlock(),n.createElementBlock("div",{innerHTML:i.formatAlertText(v),class:"alert-block-note"},null,8,OL))),256))])):n.createCommentVNode("",!0),(x=o.cellType.curatorNotes)!=null&&x.length?(n.openBlock(),n.createElementBlock("div",BL,[t[16]||(t[16]=n.createElementVNode("div",{class:"alert-block-title"},"Curator Notes:",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.curatorNotes,v=>(n.openBlock(),n.createElementBlock("div",{innerHTML:i.formatAlertText(v),class:"alert-block-note"},null,8,FL))),256))])):n.createCommentVNode("",!0)])],512)):n.createCommentVNode("",!0)])])],6)}const qy=yt(GV,[["render",IL],["__scopeId","data-v-6a3370b3"]]);let Hc=null,is=null;const AL={components:{SearchFilters:yr,SearchHistory:gr,Button:Qe,Card:Zo,CellCard:qy,Input:Xn,MapSvgIcon:as,Pagination:er},name:"CellCardExplorer",emits:["soma-location-hovered","dataset-search","connectivity-search","soma-locations-ready"],props:{envVars:{type:Object,default:()=>{}},activeSpecies:{type:Array,default:()=>[]}},data:function(){return{bodyStyle:{flex:"1 1 auto","flex-flow":"column",display:"flex"},allCellTypes:[],cellTypes:[],filterOptions:[],activeFilters:[],searchInput:"",numberPerPage:10,page:1,start:0,totalFilteredCount:0,loadingCards:!1,activeCardId:null,cascaderIsReady:!1,geneBaseToDisplay:{},geneDisplayToBase:{}}},computed:{filterEntry:function(){return{numberOfHits:this.totalFilteredCount,filterFacets:this.activeFilters,showFilters:!0,options:this.filterOptions,helper:{within:"'mouse' OR 'human'",between:"'species' AND 'soma location'"}}}},watch:{activeSpecies:{deep:!0,immediate:!0,handler:"syncActiveSpeciesFilters"}},mounted:function(){this.fetchCellTypes(this.envVars.CELL_CARDS_API)},methods:{syncCascaderFromActiveFilters:function(){if(!(!this.cascaderIsReady||!this.$refs.filtersRef)){if(this.activeFilters.length){this.$refs.filtersRef.setCascader(this.activeFilters);return}this.$refs.filtersRef.checkShowAllBoxes()}},syncActiveSpeciesFilters:function(){this.page=1,this.start=0;const e=this.getValidatedActiveSpecies(),t=this.activeFilters.filter(r=>{var a;return((a=r==null?void 0:r.term)==null?void 0:a.toLowerCase())!=="species"}),o=e.map(r=>({facetPropPath:"species",facet:Le(r),term:"Species",tagLabel:Le(r)}));this.activeFilters=[...t,...o],this.syncCascaderFromActiveFilters(),this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions)},getCellCardsData:async function(e){return Hc||(is||(is=fetch(e).then(t=>{if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}).then(t=>(Hc=t,t)).finally(()=>{is=null})),is)},fetchCellTypes:async function(e){if(e){this.loadingCards=!0;try{const t=await this.getCellCardsData(e);if(t.DEFAULT_CELL_TYPES){const o=t.DEFAULT_CELL_TYPES.map(r=>({...r,id:Dc()}));this.setGeneMappings(t.DEFAULT_GENES),this.allCellTypes=o,this.filterOptions=this.buildFilterOptions(o),this.emitSomaLocations(this.filterOptions),this.syncActiveSpeciesFilters()}}catch(t){console.error("Error fetching cell types:",t)}finally{this.loadingCards=!1}}},activateCard:function(e){this.activeCardId=this.activeCardId===e?null:e},openCard:function(e){this.activeCardId=e},closeCard:function(){this.activeCardId=null},openSearch:function(e,t){this.page=1,this.start=0,this.searchInput=String(t||"").trim();const o=e.map(i=>({facetPropPath:"somaLocations",facet:Le(i.facet||""),term:i.term||"",tagLabel:Le(i.facet||"")})),a=this.getValidatedActiveSpecies().map(i=>({facetPropPath:"species",facet:Le(i),term:"Species",tagLabel:Le(i)}));this.activeFilters=[...o,...a],this.syncCascaderFromActiveFilters(),this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),this.searchHistoryUpdate(this.activeFilters,this.searchInput),this.$nextTick(()=>this.scrollToTop())},clearSearchClicked:function(){this.searchInput="",this.searchAndFilterUpdate()},searchEvent:function(e=!1){(e.keyCode===13||e instanceof MouseEvent)&&(this.searchInput=this.searchInput.trim(),this.searchAndFilterUpdate())},onResetClick:function(){var e;this.searchInput="",this.activeFilters=[],this.page=1,this.start=0,(e=this.$refs.filtersRef)==null||e.checkShowAllBoxes(),this.$refs.searchHistory&&(this.$refs.searchHistory.selectValue="Search history"),this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),de.emit("trackEvent",{event_name:"portal_maps_action_filter",category:"reset",location:"map_sidebar_cell_card_explorer"})},searchAndFilterUpdate:function(){this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),this.searchHistoryUpdate(this.activeFilters,this.searchInput)},filterUpdate:function(e){this.activeFilters=[...e],this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),this.searchHistoryUpdate(this.activeFilters,this.searchInput),this.loadingCards=!1},numberPerPageUpdate:function(e){this.numberPerPage=parseInt(e,10)||10,de.emit("trackEvent",{event_name:"portal_maps_cell_card_perPage",category:e+"",location:"map_sidebar_cell_card_explorer"});const t=this.page===1;this.pageChange(1,t)},pageChange:function(e,t=!1){this.page=e,this.start=(e-1)*this.numberPerPage,this.applyFilters(this.activeFilters),this.scrollToTop(),t||de.emit("trackEvent",{event_name:"portal_maps_cell_card_pagination",category:`page_${this.page}`,location:"map_sidebar_cell_card_explorer"})},scrollToTop:function(){this.$refs.content&&this.$refs.content.scroll({top:0,behavior:"smooth"})},filtersLoading:function(){},searchHistoryUpdate:function(e,t){this.$refs.searchHistory&&(this.$refs.searchHistory.selectValue="Search history",(e.length||t!=null&&t.trim())&&this.$refs.searchHistory.addSearchToHistory(e,t))},searchHistorySearch:function(e){this.searchInput=e.search||"",this.activeFilters=Array.isArray(e.filters)?[...e.filters]:[],this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.$refs.filtersRef&&(this.activeFilters.length?this.$refs.filtersRef.setCascader(this.activeFilters):this.$refs.filtersRef.checkShowAllBoxes()),this.emitSomaLocations(this.filterOptions)},cascaderReady:function(){this.cascaderIsReady=!0,this.syncCascaderFromActiveFilters()},normalizeFacetValue:function(e){return String(e||"").trim().toLowerCase()},getSelectedSomaLocationFilters:function(){return(this.activeFilters||[]).filter(e=>this.normalizeFacetValue(e==null?void 0:e.term)==="soma location"&&this.normalizeFacetValue(e==null?void 0:e.facet)!=="show all").map(e=>this.normalizeFacetValue(e==null?void 0:e.facet)).filter(Boolean)},getAvailableSpeciesSet:function(){const e=new Set;return this.allCellTypes.forEach(t=>{const o=this.normalizeFacetValue(t==null?void 0:t.species);o&&e.add(o)}),e},getValidatedActiveSpecies:function(){const e=this.getAvailableSpeciesSet(),t=this.activeSpecies.map(o=>this.normalizeActiveSpeciesFilterTerm(o)).filter(Boolean);return[...new Set(t)].filter(o=>e.has(o))},getCellTypesForActiveSpecies:function(){const e=this.getValidatedActiveSpecies();if(!e.length)return this.allCellTypes;const t=new Set(e);return this.allCellTypes.filter(o=>{const r=this.normalizeActiveSpeciesFilterTerm(o==null?void 0:o.species);return t.has(r)})},normalizeActiveSpeciesFilterTerm:function(e){const t=this.normalizeFacetValue(e);return t==="human male"||t==="human female"?"human":t},setGeneMappings:function(e){const t={},o={};(Array.isArray(e)?e:[]).forEach(r=>{const a=this.normalizeFacetValue(r==null?void 0:r.base),i=String((r==null?void 0:r.display)||"").trim(),s=this.normalizeFacetValue(i);if(a){if(i){t[a]=i,o[s]=a;return}t[a]=a}}),this.geneBaseToDisplay=t,this.geneDisplayToBase=o},normalizeSearchTerms:function(e){return String(e||"").split(",").map(t=>t.trim().toLowerCase()).filter(Boolean)},getCellTypeSearchText:function(e){const t=(e.relatedCells||[]).map(o=>o.label).filter(Boolean).join(" ");return[e.preferredLabel,e.entity,e.species,(e.somaLocations||[]).join(" "),e.circuitRole,e.creLine,e.geneExpressionString,e.fiberTypeString,e.physiologyString,e.sourceNomenclatureLabel,t].filter(Boolean).join(" ").toLowerCase()},matchSearchQuery:function(e,t){if(!t.length)return!0;const o=this.getCellTypeSearchText(e);return t.some(r=>o.includes(r))},buildFacetChildren:function(e,t){const o=new Set;return e.forEach(r=>{const a=r[t];if(Array.isArray(a)){a.forEach(s=>{const l=String(s||"").trim();l&&o.add(l)});return}const i=String(a||"").trim();i&&o.add(i)}),[...o].sort((r,a)=>r.localeCompare(a,void 0,{sensitivity:"base"})).map(r=>({label:r}))},buildFilterOptions:function(e){return[{key:"species",label:"Species",children:this.buildFacetChildren(e,"species")},{key:"somaLocations",label:"Soma location",children:this.buildFacetChildren(e,"somaLocations")},{key:"geneBaseNames",label:"Gene",children:this.buildGeneFacetChildren(e)},{key:"sourceNomenclatureLabel",label:"Source",children:this.buildFacetChildren(e,"sourceNomenclatureLabel")},{key:"notes",label:"Notes",children:[{label:"with notes"},{label:"without notes"}]}].filter(o=>o.children.length>0)},emitSomaLocations:function(e){const t=(e||[]).find(f=>f.key==="somaLocations"),o=localStorage.getItem("available-name-curie-mapping"),r=o?JSON.parse(o):{},a=this.getSelectedSomaLocationFilters(),i=(this.activeFilters||[]).length>0&&a.length>0,s=new Set(a),c=this.getCellTypesForActiveSpecies().reduce((f,y)=>((Array.isArray(y==null?void 0:y.somaLocations)?y.somaLocations:[]).forEach(g=>{const h=String(g||"").trim().toLowerCase();h&&f.set(h,(f.get(h)||0)+1)}),f),new Map),d=((t==null?void 0:t.children)||[]).map(f=>String((f==null?void 0:f.label)||"").trim()).filter(Boolean).filter(f=>i?s.has(f.toLowerCase()):!0).map(f=>{const y=Object.keys(r).find(g=>String(r[g]||"").toLowerCase()===f.toLowerCase())||"";return{label:f,curie:y,count:c.get(f.toLowerCase())||0}}),u=[...new Map(d.map(f=>[f.label.toLowerCase(),f])).values()];this.$emit("soma-locations-ready",u)},buildGeneFacetChildren:function(e){const t=new Set;return e.forEach(o=>{(o.geneBaseNames||[]).forEach(r=>{const a=this.normalizeFacetValue(r);a&&t.add(a)})}),[...t].sort((o,r)=>o.localeCompare(r,void 0,{sensitivity:"base"})).map(o=>({label:this.geneBaseToDisplay[o]||o}))},matchFieldFilter:function(e,t){var a,i;const o=this.normalizeFacetValue(t.facet),r=this.normalizeFacetValue(t.term);if(!o||o==="show all")return!0;if(r==="species")return this.normalizeFacetValue(e.species)===o;if(r==="soma location")return(e.somaLocations||[]).some(s=>this.normalizeFacetValue(s)===o);if(r==="gene"){const s=this.geneDisplayToBase[o]||o;return(e.geneBaseNames||[]).some(l=>this.normalizeFacetValue(l)===s)}if(r==="circuit role")return this.normalizeFacetValue(e.circuitRole)===o;if(r==="source")return this.normalizeFacetValue(e.sourceNomenclatureLabel)===o;if(r==="notes"){const s=((a=e.alertNotes)==null?void 0:a.length)>0||((i=e.curatorNotes)==null?void 0:i.length)>0;return o==="with notes"?s:o==="without notes"?!s:!1}return!1},applyFilters:function(e){const t=this.normalizeSearchTerms(this.searchInput),r=(e||[]).filter(s=>(s==null?void 0:s.term)&&(s==null?void 0:s.facet)&&this.normalizeFacetValue(s.facet)!=="show all").reduce((s,l)=>{const c=this.normalizeFacetValue(l.term);return s[c]||(s[c]=[]),s[c].push(l),s},{}),a=Object.values(r),i=this.allCellTypes.filter(s=>a.every(l=>l.some(c=>this.matchFieldFilter(s,c)))).filter(s=>this.matchSearchQuery(s,t));this.totalFilteredCount=i.length,this.cellTypes=i.slice(this.start,this.start+this.numberPerPage),this.cellTypes.some(s=>s.id===this.activeCardId)||(this.activeCardId=null),this.$emit("search-changed",{query:this.searchInput,filter:e,tabType:"cellType"})},onRelatedCellClick:function(e){const t=e.species,o=e.label,r=this.normalizeActiveSpeciesFilterTerm(t);!this.activeFilters.some(function(s){return this.normalizeFacetValue(s.term)==="species"&&this.normalizeFacetValue(s.facet)===this.normalizeFacetValue(r)},this)&&r&&this.activeFilters.push({facetPropPath:"species",facet:Le(r),term:"Species",tagLabel:Le(r)}),this.searchInput="",this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.syncCascaderFromActiveFilters(),this.emitSomaLocations(this.filterOptions);const i=this.allCellTypes.find(function(s){return(s.preferredLabel||"").toLowerCase()===(o||"").toLowerCase()});i&&(this.activeCardId=i.id),this.$nextTick(function(){this.scrollToTop()})},showSomaLocation:function(e){this.$emit("soma-location-hovered",e)},onDatasetSearch:function(e){this.$emit("dataset-search",e)},onConnectivitySearch:function(e){this.$emit("connectivity-search",e)},getSearch:function(){return this.searchInput},getFilters:function(){return this.activeFilters.some(t=>t.facet.toLowerCase()!=="show all")?this.activeFilters:[]}}},RL={class:"header"},PL={class:"content scrollbar",ref:"content"};function VL(e,t,o,r,a,i){const s=Xn,l=n.resolveComponent("MapSvgIcon"),c=oo,d=Qe,u=yr,f=gr,y=qy,g=er,h=Zo,p=So;return n.openBlock(),n.createBlock(h,{"body-style":e.bodyStyle,class:"content-card"},{header:n.withCtx(()=>[n.createElementVNode("div",RL,[n.createElementVNode("div",{class:n.normalizeClass(["search-input-container",{"is-focus":e.searchInput}])},[n.createVNode(s,{class:"search-input",placeholder:"Search",modelValue:e.searchInput,"onUpdate:modelValue":t[0]||(t[0]=m=>e.searchInput=m),onKeyup:i.searchEvent,clearable:"",onClear:i.clearSearchClicked},null,8,["modelValue","onKeyup","onClear"]),n.createVNode(c,{width:"350",trigger:"hover","popper-class":"filter-help-popover"},{reference:n.withCtx(()=>[n.createVNode(l,{icon:"help",class:"help"})]),default:n.withCtx(()=>[t[2]||(t[2]=n.createElementVNode("div",null,[n.createElementVNode("strong",null,"Search rules:"),n.createElementVNode("ul",null,[n.createElementVNode("li",null,[n.createElementVNode("strong",null,"Multiple Terms:"),n.createTextVNode(" Separate terms with a comma ("),n.createElementVNode("code",null,","),n.createTextVNode('). This will find cell cards that match any of the terms (an "OR" search). ')]),n.createElementVNode("li",null,[n.createElementVNode("strong",null,"Exact Phrase:"),n.createTextVNode(" Terms within a comma block will be matched as an exact phrase. ")])]),n.createElementVNode("br"),n.createElementVNode("strong",null,"Examples:"),n.createElementVNode("ul",null,[n.createElementVNode("li",null,[n.createElementVNode("strong",null,"To find by exact phrase:"),n.createTextVNode(" Searching for "),n.createElementVNode("code",null,"soma location"),n.createTextVNode(" will find any card containing "),n.createElementVNode("code",null,'"soma location"'),n.createTextVNode(". ")]),n.createElementVNode("li",null,[n.createElementVNode("strong",null,"To find by multiple terms:"),n.createTextVNode(" Searching for "),n.createElementVNode("code",null,"mouse, vagal"),n.createTextVNode(" will find cards that contain either "),n.createElementVNode("code",null,"mouse"),n.createTextVNode(" OR "),n.createElementVNode("code",null,"vagal"),n.createTextVNode(". ")])])],-1))]),_:1})],2),n.createVNode(d,{type:"primary",class:"button",onClick:i.searchEvent,size:"large"},{default:n.withCtx(()=>t[3]||(t[3]=[n.createTextVNode(" Search ")])),_:1},8,["onClick"]),n.createVNode(d,{link:"",class:"el-button-link",onClick:i.onResetClick,size:"large"},{default:n.withCtx(()=>t[4]||(t[4]=[n.createTextVNode(" Reset ")])),_:1},8,["onClick"])])]),default:n.withCtx(()=>[n.createVNode(u,{class:"filters",ref:"filtersRef",entry:i.filterEntry,envVars:o.envVars,onFilterResults:i.filterUpdate,onNumberPerPage:i.numberPerPageUpdate,onLoading:i.filtersLoading,onCascaderReady:i.cascaderReady},null,8,["entry","envVars","onFilterResults","onNumberPerPage","onLoading","onCascaderReady"]),n.createVNode(f,{ref:"searchHistory",localStorageKey:"sparc.science-cell-card-search-history",onSearch:i.searchHistorySearch},null,8,["onSearch"]),n.withDirectives((n.openBlock(),n.createElementBlock("div",PL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.cellTypes,m=>(n.openBlock(),n.createBlock(y,{key:m.id,cellType:m,isActive:e.activeCardId===m.id,onOpen:b=>i.openCard(m.id),onClose:i.closeCard,onDatasetSearch:i.onDatasetSearch,onConnectivitySearch:i.onConnectivitySearch,onSomaLocationHovered:i.showSomaLocation,onRelatedCellClick:i.onRelatedCellClick},null,8,["cellType","isActive","onOpen","onClose","onDatasetSearch","onConnectivitySearch","onSomaLocationHovered","onRelatedCellClick"]))),128)),n.createVNode(g,{class:"pagination","current-page":e.page,"onUpdate:currentPage":t[1]||(t[1]=m=>e.page=m),"hide-on-single-page":"",large:"",layout:"prev, pager, next","page-size":e.numberPerPage,total:e.totalFilteredCount,onCurrentChange:i.pageChange},null,8,["current-page","page-size","total","onCurrentChange"])])),[[p,e.loadingCards]])]),_:1},8,["body-style"])}const Ky=yt(AL,[["render",VL],["__scopeId","data-v-d1d202eb"]]),LL=e=>e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()),$L={name:"ConnectivityInfo",components:{Button:Qe,Container:Bx,Icon:ve,ElIconWarning:re.Warning,ElIconLocation:re.Location,ElIconSearch:re.Search,ElIconArrowDown:re.ArrowDown,ElIconArrowUp:re.ArrowUp,ExternalResourceCard:Bn.ExternalResourceCard,CopyToClipboard:Bn.CopyToClipboard,ConnectivityGraph:Bn.ConnectivityGraph,ConnectivityList:Bn.ConnectivityList,ConnectivityReconciliationList:Bn.ConnectivityReconciliationList},props:{connectivityEntry:{type:Array,default:[]},entryData:{type:Object,default:()=>({})},entryId:{type:String,default:""},envVars:{type:Object,default:()=>{}},availableAnatomyFacets:{type:Array,default:()=>[]},withCloseButton:{type:Boolean,default:!1},showLongLabel:{type:Boolean,default:!1}},data:function(){return{updatedCopyContent:"",activeView:"listView",connectivityLoading:!1,connectivitySource:"map",noMapConnectivity:!1,connectivityError:{},graphViewLoaded:!1,connectivityFromMap:null,isTitleExpanded:!1,showTitleToggle:!1}},computed:{entry:function(){return this.connectivityEntry.find(e=>e.featureId[0]===this.entryId)},displayTitle:function(){var e,t,o;return this.showLongLabel?((e=this.entryData)==null?void 0:e["long-label"])||((t=this.entry)==null?void 0:t["long-label"])||"":((o=this.entry)==null?void 0:o.title)||""},hasProvenanceTaxonomyLabel:function(){return this.entry.provenanceTaxonomyLabel&&this.entry.provenanceTaxonomyLabel.length>0},provSpeciesDescription:function(){let e="Studied in";return this.entry.provenanceTaxonomyLabel.forEach(t=>{e+=` ${t},`}),e=e.slice(0,-1),e+=" species",e},connectivityKey:function(){return this.entry.featureId[0]+this.entry.connectivitySource},origins:function(){return this.entry.origins},components:function(){return this.entry.components},destinations:function(){return this.entry.destinations},originsWithDatasets:function(){return this.entry.originsWithDatasets},componentsWithDatasets:function(){return this.entry.componentsWithDatasets},destinationsWithDatasets:function(){return this.entry.destinationsWithDatasets},hasSingleConnectivityList:function(){return this.entry.hasSingleConnectivityList},destinationsCombinations:function(){return this.entry.destinationsCombinations||[]},originsCombinations:function(){return this.entry.originsCombinations||[]},componentsCombinations:function(){return this.entry.componentsCombinations||[]},resources:function(){return this.entry.hyperlinks||[]},sckanVersion:function(){return this.entry.knowledgeSource},flatmapApi:function(){return this.envVars.FLATMAPAPI_LOCATION}},watch:{entry:{deep:!0,immediate:!0,handler:function(e,t){e&&e!==t&&(this.connectivityLoading=!0,this.activeView=localStorage.getItem("connectivity-active-view")||this.activeView,this.activeView==="graphView"&&(this.graphViewLoaded=!0),this.connectivitySource=this.entry.connectivitySource,this.noMapConnectivity=this.entry.noMapConnectivity,this.updateGraphConnectivity(),this.connectivityLoading=!1,(!t||(e==null?void 0:e.featureId[0])!==(t==null?void 0:t.featureId[0]))&&this.$emit("loaded"),this.isTitleExpanded=!1,this.updateTitleToggleVisibility())}},displayTitle:function(){this.isTitleExpanded=!1,this.updateTitleToggleVisibility()}},methods:{titleCase:function(e){return LL(e)},capitalise:function(e){return Le(e)},toggleTitleExpansion:function(){this.isTitleExpanded=!this.isTitleExpanded,this.isTitleExpanded||this.$nextTick(()=>{this.updateTitleToggleVisibility()})},updateTitleToggleVisibility:function(){this.$nextTick(()=>{const e=this.$refs.titleElement;if(!e){this.showTitleToggle=!1;return}const t=this.isTitleExpanded;t&&e.classList.add("title--clamped");const o=e.scrollHeight>e.clientHeight+1;this.showTitleToggle=o,t&&e.classList.remove("title--clamped"),o||(this.isTitleExpanded=!1)})},showConnectivity:function(){const e=this.entry.featureId||[];this.$emit("show-connectivity",e),de.emit("trackEvent",{event_name:"portal_maps_show_connectivity_on_map",category:this.entry.id||"",location:"map_sidebar_connectivity"})},onCopied:function(){de.emit("trackEvent",{event_name:"portal_maps_connectivity_copy",category:this.entry.id||"",location:"map_sidebar_connectivity"})},switchConnectivityView:function(e){this.activeView=e,localStorage.setItem("connectivity-active-view",this.activeView),e==="graphView"&&!this.graphViewLoaded&&this.$nextTick(()=>{this.graphViewLoaded=!0}),de.emit("trackEvent",{event_name:"portal_maps_connectivity_switch_view",category:e,location:"map_sidebar_connectivity"})},openGraphInViewer:function(){const e={entry:this.entry.featureId[0],mapServer:this.flatmapApi,sckanVersion:this.sckanVersion,connectivityFromMap:this.connectivityFromMap,connectivityError:this.connectivityError,origins:this.origins,components:this.components,destinations:this.destinations,originsWithDatasets:this.originsWithDatasets,componentsWithDatasets:this.componentsWithDatasets,destinationsWithDatasets:this.destinationsWithDatasets,hasSingleConnectivityList:this.hasSingleConnectivityList,originsCombinations:this.originsCombinations,componentsCombinations:this.componentsCombinations,destinationsCombinations:this.destinationsCombinations,allWithDatasets:[...this.componentsWithDatasets,...this.destinationsWithDatasets,...this.originsWithDatasets],connectivityInfo:this.entry};de.emit("show-connectivity-graph",e)},onTapNode:function(e){const t=e.map(o=>o.label).join(", ");this.onConnectivityHovered(t)},onShowReferenceConnectivities:function(e){this.$emit("show-reference-connectivities",e)},onReferencesLoaded:function(e){this.updatedCopyContent=this.getUpdateCopyContent(e)},getUpdateCopyContent:function(e){var f,y,g,h,p,m,b,k,N,C,x,v;if(!this.entry)return"";const t=[],o=((f=this.entry)==null?void 0:f.title)||"",r=((y=this.entryData)==null?void 0:y["long-label"])||((g=this.entry)==null?void 0:g["long-label"])||"";let a=this.entry.featureId;const i=[],s=Le(r||o);s&&i.push(`<div><strong>${s}</strong></div>`),a!=null&&a.length&&(typeof a=="object"?i.push(`<div><strong>Id:</strong> ${a[0]}</div>`):i.push(`<div><strong>Id:</strong> ${a}</div>`)),t.push(`<div>${i.join(`
477
+ `)},somaLocations:function(){return this.cellType.somaLocations.map(t=>{var a;const o=Object.keys(Uy).find(i=>Uy[i]===t)||"";return((a=this.cellType.clusterAttributes)==null?void 0:a[o])?{name:Le(t),id:o}:!1})}},methods:{sanitizeMarkerGeneUri:function(e,t=""){let o=String(e||"").trim();const r=String(t||"").trim();if(!o)return"";if(r){const a=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");o=o.replace(new RegExp(`\\s+${a}$`,"i"),"")}return o.trim()},transformString:function(e){return e?e.replace(/\^(\w+)/g,"<sup>$1</sup>"):""},onCopied:function(){de.emit("trackEvent",{event_name:"portal_maps_cell_card_copy",category:this.cellType.preferredLabel||"",location:"map_sidebar_cell_card"})},openCard:function(){this.$emit("open",this.cellType.id),de.emit("trackEvent",{event_name:"portal_maps_cell_card_open",category:this.cellType.id||"",location:"map_sidebar_cell_card"})},closeCard:function(){this.$emit("close"),de.emit("trackEvent",{event_name:"portal_maps_cell_card_close",category:this.cellType.id||"",location:"map_sidebar_cell_card"})},showSomaLocation:function(e){this.$emit("soma-location-hovered",e)},openDatasetSearch:function(e){var t;this.$emit("dataset-search",{species:Le((t=this.cellType)==null?void 0:t.species),location:e})},openConnectivitySearch:function(e){const t=localStorage.getItem("available-name-curie-mapping"),o=t?JSON.parse(t):{},r=Object.keys(o).find(i=>o[i].toLowerCase()===e.toLowerCase()),a=r?[{facet:`["${r}",[]]`,facetPropPath:"flatmap.connectivity.source.all",tagLabel:e,term:"All"}]:[];this.$emit("connectivity-search",{facets:a,query:""})},onSearchPopoverShow:function(e){this.activeSearchPopoverLocationId=e},onSearchPopoverHide:function(e){this.activeSearchPopoverLocationId===e&&(this.activeSearchPopoverLocationId=null)},showAlertMessage:function(){Zg(this,"alertElement")},formatAlertText:function(e){return rs(e)}}},JV={class:"title-content"},YV={class:"card-title"},ZV={class:"card-keywords"},XV={class:"card-chips"},QV={key:0,class:"source-publication-chip"},eL={class:"card-details"},tL={class:"card-details-inner"},nL={key:0,class:"card-section"},oL={key:1,class:"card-section"},rL={key:2,class:"card-section"},aL={class:"card-list-items"},iL=["onMouseenter"],sL={class:"card-list-search"},lL={class:"search-action-list"},cL=["onClick"],dL=["onClick"],uL={key:3,class:"card-section"},fL={key:4,class:"card-section"},pL={key:5,class:"card-section"},hL={class:"marker-genes-list"},mL=["href"],gL={key:0},yL={key:6,class:"card-section"},bL={class:"card-section-content"},wL={key:7,class:"card-section"},CL={class:"card-section-content success"},kL={key:8,class:"card-section"},SL={class:"related-cell-list"},vL=["onClick"],EL={key:9,class:"card-section source-publication-section"},xL=["href"],_L={key:10,class:"card-section",ref:"alertElement"},TL={class:"alert-block"},NL={key:0,class:"alert-block-section"},OL=["innerHTML"],BL={key:1,class:"alert-block-section"},FL=["innerHTML"];function IL(e,t,o,r,a,i){var h,p,m,b,k,N,C,x;const s=re.WarnTriangleFilled,l=ve,c=Qe,d=n.resolveComponent("CopyToClipboard"),u=re.Close,f=oo,y=re.Search,g=Hy;return n.openBlock(),n.createElementBlock("div",{ref:"cardElementRef",class:n.normalizeClass(["card",{active:o.isActive}]),style:n.normalizeStyle(i.cardStyleVars)},[n.createElementVNode("div",{class:"card-header",onClick:t[1]||(t[1]=(...v)=>i.openCard&&i.openCard(...v))},[n.createElementVNode("div",JV,[n.createElementVNode("div",YV,n.toDisplayString(o.cellType.preferredLabel),1),n.createElementVNode("div",ZV,[n.createElementVNode("span",null,n.toDisplayString(o.cellType.species),1),n.createElementVNode("div",XV,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.somaLocations,v=>(n.openBlock(),n.createElementBlock("span",{class:"card-chip",key:v},n.toDisplayString(v),1))),128))]),o.cellType.sourceNomenclature?(n.openBlock(),n.createElementBlock("span",QV,n.toDisplayString(o.cellType.sourceNomenclatureLabel),1)):n.createCommentVNode("",!0)]),o.isActive&&((h=o.cellType.alertNotes)!=null&&h.length||(p=o.cellType.curatorNotes)!=null&&p.length)?(n.openBlock(),n.createBlock(c,{key:0,round:"",size:"small",class:"alert-chip",onClick:n.withModifiers(i.showAlertMessage,["stop"])},{default:n.withCtx(()=>[n.createVNode(l,{class:"alert"},{default:n.withCtx(()=>[n.createVNode(s)]),_:1}),t[3]||(t[3]=n.createTextVNode(" Notes "))]),_:1},8,["onClick"])):n.createCommentVNode("",!0)]),n.createElementVNode("div",{class:"title-buttons",onClick:t[0]||(t[0]=n.withModifiers(()=>{},["stop"]))},[n.createVNode(d,{onCopied:i.onCopied,content:i.updatedCopyContent},null,8,["onCopied","content"]),n.createVNode(f,{width:"auto",trigger:"hover",teleported:!1,"popper-class":"popover-map-pin"},{reference:n.withCtx(()=>[n.createVNode(c,{class:"button-circle",circle:"",onClick:i.closeCard},{default:n.withCtx(()=>[n.createVNode(l,{color:"white"},{default:n.withCtx(()=>[n.createVNode(u)]),_:1})]),_:1},8,["onClick"])]),default:n.withCtx(()=>[t[4]||(t[4]=n.createElementVNode("span",null,"Close",-1))]),_:1})])]),n.createElementVNode("div",eL,[n.createElementVNode("div",tL,[o.cellType.entity?(n.openBlock(),n.createElementBlock("div",nL,[t[5]||(t[5]=n.createElementVNode("div",{class:"card-section-title"},"Entity",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.entity),1)])):n.createCommentVNode("",!0),o.cellType.species?(n.openBlock(),n.createElementBlock("div",oL,[t[6]||(t[6]=n.createElementVNode("div",{class:"card-section-title"},"Species",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.species),1)])):n.createCommentVNode("",!0),(m=o.cellType.somaLocations)!=null&&m.length?(n.openBlock(),n.createElementBlock("div",rL,[t[7]||(t[7]=n.createElementVNode("div",{class:"card-section-title"},"Soma Location",-1)),n.createElementVNode("div",aL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.somaLocations,v=>(n.openBlock(),n.createElementBlock("div",{class:"card-list-item",key:v.id,onMouseenter:_=>i.showSomaLocation(v.name),onMouseleave:t[2]||(t[2]=_=>i.showSomaLocation())},[n.createElementVNode("span",null,n.toDisplayString(v.name),1),n.createElementVNode("div",sL,[n.createVNode(f,{width:"180",trigger:"hover",teleported:!0,"append-to":a.cardElement,"popper-class":"popover-origin-help popover-search-actions",onShow:_=>i.onSearchPopoverShow(v.id),onHide:_=>i.onSearchPopoverHide(v.id)},{reference:n.withCtx(()=>[n.createVNode(l,{class:n.normalizeClass(["status-search-icon",{"is-visible":a.activeSearchPopoverLocationId===v.id}])},{default:n.withCtx(()=>[n.createVNode(y)]),_:2},1032,["class"])]),default:n.withCtx(()=>[n.createElementVNode("div",lL,[n.createElementVNode("button",{type:"button",class:"search-action-button",onClick:_=>i.openDatasetSearch(v.name)}," Search dataset ",8,cL),n.createElementVNode("button",{type:"button",class:"search-action-button",onClick:_=>i.openConnectivitySearch(v.name)}," Search connectivity ",8,dL)])]),_:2},1032,["append-to","onShow","onHide"])])],40,iL))),128))])])):n.createCommentVNode("",!0),o.cellType.circuitRole?(n.openBlock(),n.createElementBlock("div",uL,[t[8]||(t[8]=n.createElementVNode("div",{class:"card-section-title"},"Circuit Role",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.circuitRole),1)])):n.createCommentVNode("",!0),o.cellType.creLine?(n.openBlock(),n.createElementBlock("div",fL,[t[9]||(t[9]=n.createElementVNode("div",{class:"card-section-title"},"Cre Line",-1)),n.createElementVNode("span",null,n.toDisplayString(o.cellType.creLine),1)])):n.createCommentVNode("",!0),i.formattedMarkerGenes.length?(n.openBlock(),n.createElementBlock("div",pL,[t[10]||(t[10]=n.createElementVNode("div",{class:"card-section-title"},"Marker Genes",-1)),n.createElementVNode("div",hL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(i.formattedMarkerGenes,v=>(n.openBlock(),n.createElementBlock("a",{key:v.key,class:"marker-gene-link",href:v.uri,target:"_blank",rel:"noopener noreferrer"},[n.createElementVNode("span",null,n.toDisplayString(v.name),1),v.expression?(n.openBlock(),n.createElementBlock("sup",gL,n.toDisplayString(v.expression),1)):n.createCommentVNode("",!0),n.createVNode(g,{class:"external-link-icon"})],8,mL))),128))])])):n.createCommentVNode("",!0),o.cellType.fiberTypeString?(n.openBlock(),n.createElementBlock("div",yL,[t[11]||(t[11]=n.createElementVNode("div",{class:"card-section-title"},"Axon Phenotype",-1)),n.createElementVNode("div",bL,n.toDisplayString(o.cellType.fiberTypeString),1)])):n.createCommentVNode("",!0),o.cellType.physiologyString?(n.openBlock(),n.createElementBlock("div",wL,[t[12]||(t[12]=n.createElementVNode("div",{class:"card-section-title"},"Physiology",-1)),n.createElementVNode("div",CL,n.toDisplayString(o.cellType.physiologyString),1)])):n.createCommentVNode("",!0),(b=o.cellType.relatedCells)!=null&&b.length?(n.openBlock(),n.createElementBlock("div",kL,[t[13]||(t[13]=n.createElementVNode("div",{class:"card-section-title"},"Related Species Variants",-1)),n.createElementVNode("ul",SL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.relatedCells,v=>(n.openBlock(),n.createElementBlock("li",{key:v},[n.createElementVNode("button",{class:"related-cell-item",onClick:n.withModifiers(_=>e.$emit("related-cell-click",v),["stop"]),title:"Click to view this cell type"},n.toDisplayString(v.label),9,vL)]))),128))])])):n.createCommentVNode("",!0),o.cellType.sourceNomenclature?(n.openBlock(),n.createElementBlock("div",EL,[t[14]||(t[14]=n.createElementVNode("div",{class:"card-section-title"},"Source Publication",-1)),n.createElementVNode("p",null,[n.createElementVNode("a",{class:"source-publication-link",href:o.cellType.sourceNomenclature,target:"_blank",rel:"noopener noreferrer"},[n.createTextVNode(n.toDisplayString(o.cellType.sourceNomenclatureLabel)+" ",1),n.createVNode(g,{class:"external-link-icon"})],8,xL)])])):n.createCommentVNode("",!0),(k=o.cellType.alertNotes)!=null&&k.length||(N=o.cellType.curatorNotes)!=null&&N.length?(n.openBlock(),n.createElementBlock("div",_L,[t[17]||(t[17]=n.createElementVNode("div",{class:"card-section-title"},"Notes",-1)),n.createElementVNode("div",TL,[(C=o.cellType.alertNotes)!=null&&C.length?(n.openBlock(),n.createElementBlock("div",NL,[t[15]||(t[15]=n.createElementVNode("div",{class:"alert-block-title"},"Alert Notes:",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.alertNotes,v=>(n.openBlock(),n.createElementBlock("div",{innerHTML:i.formatAlertText(v),class:"alert-block-note"},null,8,OL))),256))])):n.createCommentVNode("",!0),(x=o.cellType.curatorNotes)!=null&&x.length?(n.openBlock(),n.createElementBlock("div",BL,[t[16]||(t[16]=n.createElementVNode("div",{class:"alert-block-title"},"Curator Notes:",-1)),(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(o.cellType.curatorNotes,v=>(n.openBlock(),n.createElementBlock("div",{innerHTML:i.formatAlertText(v),class:"alert-block-note"},null,8,FL))),256))])):n.createCommentVNode("",!0)])],512)):n.createCommentVNode("",!0)])])],6)}const qy=yt(GV,[["render",IL],["__scopeId","data-v-6a3370b3"]]);let Hc=null,is=null;const AL={components:{SearchFilters:yr,SearchHistory:gr,Button:Qe,Card:Zo,CellCard:qy,Input:Xn,MapSvgIcon:as,Pagination:er},name:"CellCardExplorer",emits:["soma-location-hovered","dataset-search","connectivity-search","soma-locations-ready"],props:{envVars:{type:Object,default:()=>{}},activeSpecies:{type:Array,default:()=>[]}},data:function(){return{bodyStyle:{flex:"1 1 auto","flex-flow":"column",display:"flex"},allCellTypes:[],cellTypes:[],filterOptions:[],activeFilters:[],searchInput:"",numberPerPage:10,page:1,start:0,totalFilteredCount:0,loadingCards:!1,activeCardId:null,cascaderIsReady:!1,geneBaseToDisplay:{},geneDisplayToBase:{}}},computed:{filterEntry:function(){return{numberOfHits:this.totalFilteredCount,filterFacets:this.activeFilters,showFilters:!0,options:this.filterOptions,helper:{within:"'mouse' OR 'human'",between:"'species' AND 'soma location'"}}}},watch:{activeSpecies:{deep:!0,immediate:!0,handler:"syncActiveSpeciesFilters"}},mounted:function(){this.fetchCellTypes(this.envVars.CELL_CARDS_API)},methods:{syncCascaderFromActiveFilters:function(){if(!(!this.cascaderIsReady||!this.$refs.filtersRef)){if(this.activeFilters.length){this.$refs.filtersRef.setCascader(this.activeFilters);return}this.$refs.filtersRef.checkShowAllBoxes()}},syncActiveSpeciesFilters:function(){this.page=1,this.start=0;const e=this.getValidatedActiveSpecies(),t=this.activeFilters.filter(r=>{var a;return((a=r==null?void 0:r.term)==null?void 0:a.toLowerCase())!=="species"}),o=e.map(r=>({facetPropPath:"species",facet:Le(r),term:"Species",tagLabel:Le(r)}));this.activeFilters=[...t,...o],this.syncCascaderFromActiveFilters(),this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions)},getCellCardsData:async function(e){return Hc||(is||(is=fetch(e).then(t=>{if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);return t.json()}).then(t=>(Hc=t,t)).finally(()=>{is=null})),is)},fetchCellTypes:async function(e){if(e){this.loadingCards=!0;try{const t=await this.getCellCardsData(e);if(t.DEFAULT_CELL_TYPES){const o=t.DEFAULT_CELL_TYPES.map(r=>({...r,id:Dc()}));this.setGeneMappings(t.DEFAULT_GENES),this.allCellTypes=o,this.filterOptions=this.buildFilterOptions(o),this.emitSomaLocations(this.filterOptions),this.syncActiveSpeciesFilters()}}catch(t){console.error("Error fetching cell types:",t)}finally{this.loadingCards=!1}}},activateCard:function(e){this.activeCardId=this.activeCardId===e?null:e},openCard:function(e){this.activeCardId=e},closeCard:function(){this.activeCardId=null},openSearch:function(e,t){this.page=1,this.start=0,this.searchInput=String(t||"").trim();const o=e.map(i=>({facetPropPath:"somaLocations",facet:Le(i.facet||""),term:i.term||"",tagLabel:Le(i.facet||"")})),a=this.getValidatedActiveSpecies().map(i=>({facetPropPath:"species",facet:Le(i),term:"Species",tagLabel:Le(i)}));this.activeFilters=[...o,...a],this.syncCascaderFromActiveFilters(),this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),this.searchHistoryUpdate(this.activeFilters,this.searchInput),this.$nextTick(()=>this.scrollToTop())},clearSearchClicked:function(){this.searchInput="",this.searchAndFilterUpdate()},searchEvent:function(e=!1){(e.keyCode===13||e instanceof MouseEvent)&&(this.searchInput=this.searchInput.trim(),this.searchAndFilterUpdate())},onResetClick:function(){var e;this.searchInput="",this.activeFilters=[],this.page=1,this.start=0,(e=this.$refs.filtersRef)==null||e.checkShowAllBoxes(),this.$refs.searchHistory&&(this.$refs.searchHistory.selectValue="Search history"),this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),de.emit("trackEvent",{event_name:"portal_maps_action_filter",category:"reset",location:"map_sidebar_cell_card_explorer"})},searchAndFilterUpdate:function(){this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),this.searchHistoryUpdate(this.activeFilters,this.searchInput)},filterUpdate:function(e){this.activeFilters=[...e],this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.emitSomaLocations(this.filterOptions),this.searchHistoryUpdate(this.activeFilters,this.searchInput),this.loadingCards=!1},numberPerPageUpdate:function(e){this.numberPerPage=parseInt(e,10)||10,de.emit("trackEvent",{event_name:"portal_maps_cell_card_perPage",category:e+"",location:"map_sidebar_cell_card_explorer"});const t=this.page===1;this.pageChange(1,t)},pageChange:function(e,t=!1){this.page=e,this.start=(e-1)*this.numberPerPage,this.applyFilters(this.activeFilters),this.scrollToTop(),t||de.emit("trackEvent",{event_name:"portal_maps_cell_card_pagination",category:`page_${this.page}`,location:"map_sidebar_cell_card_explorer"})},scrollToTop:function(){this.$refs.content&&this.$refs.content.scroll({top:0,behavior:"smooth"})},filtersLoading:function(){},searchHistoryUpdate:function(e,t){this.$refs.searchHistory&&(this.$refs.searchHistory.selectValue="Search history",(e.length||t!=null&&t.trim())&&this.$refs.searchHistory.addSearchToHistory(e,t))},searchHistorySearch:function(e){this.searchInput=e.search||"",this.activeFilters=Array.isArray(e.filters)?[...e.filters]:[],this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.$refs.filtersRef&&(this.activeFilters.length?this.$refs.filtersRef.setCascader(this.activeFilters):this.$refs.filtersRef.checkShowAllBoxes()),this.emitSomaLocations(this.filterOptions)},cascaderReady:function(){this.cascaderIsReady=!0,this.syncCascaderFromActiveFilters()},normalizeFacetValue:function(e){return String(e||"").trim().toLowerCase()},getSelectedSomaLocationFilters:function(){return(this.activeFilters||[]).filter(e=>this.normalizeFacetValue(e==null?void 0:e.term)==="soma location"&&this.normalizeFacetValue(e==null?void 0:e.facet)!=="show all").map(e=>this.normalizeFacetValue(e==null?void 0:e.facet)).filter(Boolean)},getAvailableSpeciesSet:function(){const e=new Set;return this.allCellTypes.forEach(t=>{const o=this.normalizeFacetValue(t==null?void 0:t.species);o&&e.add(o)}),e},getValidatedActiveSpecies:function(){const e=this.getAvailableSpeciesSet(),t=this.activeSpecies.map(o=>this.normalizeActiveSpeciesFilterTerm(o)).filter(Boolean);return[...new Set(t)].filter(o=>e.has(o))},getCellTypesForActiveSpecies:function(){const e=this.getValidatedActiveSpecies();if(!e.length)return this.allCellTypes;const t=new Set(e);return this.allCellTypes.filter(o=>{const r=this.normalizeActiveSpeciesFilterTerm(o==null?void 0:o.species);return t.has(r)})},normalizeActiveSpeciesFilterTerm:function(e){const t=this.normalizeFacetValue(e);return t==="human male"||t==="human female"?"human":t},setGeneMappings:function(e){const t={},o={};(Array.isArray(e)?e:[]).forEach(r=>{const a=this.normalizeFacetValue(r==null?void 0:r.base),i=String((r==null?void 0:r.display)||"").trim(),s=this.normalizeFacetValue(i);if(a){if(i){t[a]=i,o[s]=a;return}t[a]=a}}),this.geneBaseToDisplay=t,this.geneDisplayToBase=o},normalizeSearchTerms:function(e){return String(e||"").split(",").map(t=>t.trim().toLowerCase()).filter(Boolean)},getCellTypeSearchText:function(e){const t=(e.relatedCells||[]).map(o=>o.label).filter(Boolean).join(" ");return[e.preferredLabel,e.entity,e.species,(e.somaLocations||[]).join(" "),e.circuitRole,e.creLine,e.geneExpressionString,e.fiberTypeString,e.physiologyString,e.sourceNomenclatureLabel,t].filter(Boolean).join(" ").toLowerCase()},matchSearchQuery:function(e,t){if(!t.length)return!0;const o=this.getCellTypeSearchText(e);return t.some(r=>o.includes(r))},buildFacetChildren:function(e,t){const o=new Set;return e.forEach(r=>{const a=r[t];if(Array.isArray(a)){a.forEach(s=>{const l=String(s||"").trim();l&&o.add(l)});return}const i=String(a||"").trim();i&&o.add(i)}),[...o].sort((r,a)=>r.localeCompare(a,void 0,{sensitivity:"base"})).map(r=>({label:r}))},buildFilterOptions:function(e){return[{key:"species",label:"Species",children:this.buildFacetChildren(e,"species")},{key:"somaLocations",label:"Soma location",children:this.buildFacetChildren(e,"somaLocations")},{key:"geneBaseNames",label:"Gene",children:this.buildGeneFacetChildren(e)},{key:"sourceNomenclatureLabel",label:"Source",children:this.buildFacetChildren(e,"sourceNomenclatureLabel")},{key:"notes",label:"Notes",children:[{label:"with notes"},{label:"without notes"}]}].filter(o=>o.children.length>0)},emitSomaLocations:function(e){const t=(e||[]).find(f=>f.key==="somaLocations"),o=localStorage.getItem("available-name-curie-mapping"),r=o?JSON.parse(o):{},a=this.getSelectedSomaLocationFilters(),i=(this.activeFilters||[]).length>0&&a.length>0,s=new Set(a),c=this.getFilteredCellTypes(this.activeFilters,this.searchInput).reduce((f,y)=>((Array.isArray(y==null?void 0:y.somaLocations)?y.somaLocations:[]).forEach(g=>{const h=String(g||"").trim().toLowerCase();h&&f.set(h,(f.get(h)||0)+1)}),f),new Map),d=((t==null?void 0:t.children)||[]).map(f=>String((f==null?void 0:f.label)||"").trim()).filter(Boolean).filter(f=>i?s.has(f.toLowerCase()):!0).map(f=>{const y=Object.keys(r).find(g=>String(r[g]||"").toLowerCase()===f.toLowerCase())||"";return{label:f,curie:y,count:c.get(f.toLowerCase())||0}}),u=[...new Map(d.map(f=>[f.label.toLowerCase(),f])).values()];this.$emit("soma-locations-ready",u)},buildGeneFacetChildren:function(e){const t=new Set;return e.forEach(o=>{(o.geneBaseNames||[]).forEach(r=>{const a=this.normalizeFacetValue(r);a&&t.add(a)})}),[...t].sort((o,r)=>o.localeCompare(r,void 0,{sensitivity:"base"})).map(o=>({label:this.geneBaseToDisplay[o]||o}))},matchFieldFilter:function(e,t){var a,i;const o=this.normalizeFacetValue(t.facet),r=this.normalizeFacetValue(t.term);if(!o||o==="show all")return!0;if(r==="species")return this.normalizeFacetValue(e.species)===o;if(r==="soma location")return(e.somaLocations||[]).some(s=>this.normalizeFacetValue(s)===o);if(r==="gene"){const s=this.geneDisplayToBase[o]||o;return(e.geneBaseNames||[]).some(l=>this.normalizeFacetValue(l)===s)}if(r==="circuit role")return this.normalizeFacetValue(e.circuitRole)===o;if(r==="source")return this.normalizeFacetValue(e.sourceNomenclatureLabel)===o;if(r==="notes"){const s=((a=e.alertNotes)==null?void 0:a.length)>0||((i=e.curatorNotes)==null?void 0:i.length)>0;return o==="with notes"?s:o==="without notes"?!s:!1}return!1},getFilteredCellTypes:function(e=this.activeFilters,t=this.searchInput){const o=this.normalizeSearchTerms(t),a=(e||[]).filter(s=>(s==null?void 0:s.term)&&(s==null?void 0:s.facet)&&this.normalizeFacetValue(s.facet)!=="show all").reduce((s,l)=>{const c=this.normalizeFacetValue(l.term);return s[c]||(s[c]=[]),s[c].push(l),s},{}),i=Object.values(a);return this.allCellTypes.filter(s=>i.every(l=>l.some(c=>this.matchFieldFilter(s,c)))).filter(s=>this.matchSearchQuery(s,o))},applyFilters:function(e){const t=this.getFilteredCellTypes(e,this.searchInput);this.totalFilteredCount=t.length,this.cellTypes=t.slice(this.start,this.start+this.numberPerPage),this.cellTypes.some(o=>o.id===this.activeCardId)||(this.activeCardId=null),this.$emit("search-changed",{query:this.searchInput,filter:e,tabType:"cellType"})},onRelatedCellClick:function(e){const t=e.species,o=e.label,r=this.normalizeActiveSpeciesFilterTerm(t);!this.activeFilters.some(function(s){return this.normalizeFacetValue(s.term)==="species"&&this.normalizeFacetValue(s.facet)===this.normalizeFacetValue(r)},this)&&r&&this.activeFilters.push({facetPropPath:"species",facet:Le(r),term:"Species",tagLabel:Le(r)}),this.searchInput="",this.page=1,this.start=0,this.applyFilters(this.activeFilters),this.syncCascaderFromActiveFilters(),this.emitSomaLocations(this.filterOptions);const i=this.allCellTypes.find(function(s){return(s.preferredLabel||"").toLowerCase()===(o||"").toLowerCase()});i&&(this.activeCardId=i.id),this.$nextTick(function(){this.scrollToTop()})},showSomaLocation:function(e){this.$emit("soma-location-hovered",e)},onDatasetSearch:function(e){this.$emit("dataset-search",e)},onConnectivitySearch:function(e){this.$emit("connectivity-search",e)},getSearch:function(){return this.searchInput},getFilters:function(){return this.activeFilters.some(t=>t.facet.toLowerCase()!=="show all")?this.activeFilters:[]}}},RL={class:"header"},PL={class:"content scrollbar",ref:"content"};function VL(e,t,o,r,a,i){const s=Xn,l=n.resolveComponent("MapSvgIcon"),c=oo,d=Qe,u=yr,f=gr,y=qy,g=er,h=Zo,p=So;return n.openBlock(),n.createBlock(h,{"body-style":e.bodyStyle,class:"content-card"},{header:n.withCtx(()=>[n.createElementVNode("div",RL,[n.createElementVNode("div",{class:n.normalizeClass(["search-input-container",{"is-focus":e.searchInput}])},[n.createVNode(s,{class:"search-input",placeholder:"Search",modelValue:e.searchInput,"onUpdate:modelValue":t[0]||(t[0]=m=>e.searchInput=m),onKeyup:i.searchEvent,clearable:"",onClear:i.clearSearchClicked},null,8,["modelValue","onKeyup","onClear"]),n.createVNode(c,{width:"350",trigger:"hover","popper-class":"filter-help-popover"},{reference:n.withCtx(()=>[n.createVNode(l,{icon:"help",class:"help"})]),default:n.withCtx(()=>[t[2]||(t[2]=n.createElementVNode("div",null,[n.createElementVNode("strong",null,"Search rules:"),n.createElementVNode("ul",null,[n.createElementVNode("li",null,[n.createElementVNode("strong",null,"Multiple Terms:"),n.createTextVNode(" Separate terms with a comma ("),n.createElementVNode("code",null,","),n.createTextVNode('). This will find cell cards that match any of the terms (an "OR" search). ')]),n.createElementVNode("li",null,[n.createElementVNode("strong",null,"Exact Phrase:"),n.createTextVNode(" Terms within a comma block will be matched as an exact phrase. ")])]),n.createElementVNode("br"),n.createElementVNode("strong",null,"Examples:"),n.createElementVNode("ul",null,[n.createElementVNode("li",null,[n.createElementVNode("strong",null,"To find by exact phrase:"),n.createTextVNode(" Searching for "),n.createElementVNode("code",null,"soma location"),n.createTextVNode(" will find any card containing "),n.createElementVNode("code",null,'"soma location"'),n.createTextVNode(". ")]),n.createElementVNode("li",null,[n.createElementVNode("strong",null,"To find by multiple terms:"),n.createTextVNode(" Searching for "),n.createElementVNode("code",null,"mouse, vagal"),n.createTextVNode(" will find cards that contain either "),n.createElementVNode("code",null,"mouse"),n.createTextVNode(" OR "),n.createElementVNode("code",null,"vagal"),n.createTextVNode(". ")])])],-1))]),_:1})],2),n.createVNode(d,{type:"primary",class:"button",onClick:i.searchEvent,size:"large"},{default:n.withCtx(()=>t[3]||(t[3]=[n.createTextVNode(" Search ")])),_:1},8,["onClick"]),n.createVNode(d,{link:"",class:"el-button-link",onClick:i.onResetClick,size:"large"},{default:n.withCtx(()=>t[4]||(t[4]=[n.createTextVNode(" Reset ")])),_:1},8,["onClick"])])]),default:n.withCtx(()=>[n.createVNode(u,{class:"filters",ref:"filtersRef",entry:i.filterEntry,envVars:o.envVars,onFilterResults:i.filterUpdate,onNumberPerPage:i.numberPerPageUpdate,onLoading:i.filtersLoading,onCascaderReady:i.cascaderReady},null,8,["entry","envVars","onFilterResults","onNumberPerPage","onLoading","onCascaderReady"]),n.createVNode(f,{ref:"searchHistory",localStorageKey:"sparc.science-cell-card-search-history",onSearch:i.searchHistorySearch},null,8,["onSearch"]),n.withDirectives((n.openBlock(),n.createElementBlock("div",PL,[(n.openBlock(!0),n.createElementBlock(n.Fragment,null,n.renderList(e.cellTypes,m=>(n.openBlock(),n.createBlock(y,{key:m.id,cellType:m,isActive:e.activeCardId===m.id,onOpen:b=>i.openCard(m.id),onClose:i.closeCard,onDatasetSearch:i.onDatasetSearch,onConnectivitySearch:i.onConnectivitySearch,onSomaLocationHovered:i.showSomaLocation,onRelatedCellClick:i.onRelatedCellClick},null,8,["cellType","isActive","onOpen","onClose","onDatasetSearch","onConnectivitySearch","onSomaLocationHovered","onRelatedCellClick"]))),128)),n.createVNode(g,{class:"pagination","current-page":e.page,"onUpdate:currentPage":t[1]||(t[1]=m=>e.page=m),"hide-on-single-page":"",large:"",layout:"prev, pager, next","page-size":e.numberPerPage,total:e.totalFilteredCount,onCurrentChange:i.pageChange},null,8,["current-page","page-size","total","onCurrentChange"])])),[[p,e.loadingCards]])]),_:1},8,["body-style"])}const Ky=yt(AL,[["render",VL],["__scopeId","data-v-68d46a03"]]),LL=e=>e.replace(/\w\S*/g,t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()),$L={name:"ConnectivityInfo",components:{Button:Qe,Container:Bx,Icon:ve,ElIconWarning:re.Warning,ElIconLocation:re.Location,ElIconSearch:re.Search,ElIconArrowDown:re.ArrowDown,ElIconArrowUp:re.ArrowUp,ExternalResourceCard:Bn.ExternalResourceCard,CopyToClipboard:Bn.CopyToClipboard,ConnectivityGraph:Bn.ConnectivityGraph,ConnectivityList:Bn.ConnectivityList,ConnectivityReconciliationList:Bn.ConnectivityReconciliationList},props:{connectivityEntry:{type:Array,default:[]},entryData:{type:Object,default:()=>({})},entryId:{type:String,default:""},envVars:{type:Object,default:()=>{}},availableAnatomyFacets:{type:Array,default:()=>[]},withCloseButton:{type:Boolean,default:!1},showLongLabel:{type:Boolean,default:!1}},data:function(){return{updatedCopyContent:"",activeView:"listView",connectivityLoading:!1,connectivitySource:"map",noMapConnectivity:!1,connectivityError:{},graphViewLoaded:!1,connectivityFromMap:null,isTitleExpanded:!1,showTitleToggle:!1}},computed:{entry:function(){return this.connectivityEntry.find(e=>e.featureId[0]===this.entryId)},displayTitle:function(){var e,t,o;return this.showLongLabel?((e=this.entryData)==null?void 0:e["long-label"])||((t=this.entry)==null?void 0:t["long-label"])||"":((o=this.entry)==null?void 0:o.title)||""},hasProvenanceTaxonomyLabel:function(){return this.entry.provenanceTaxonomyLabel&&this.entry.provenanceTaxonomyLabel.length>0},provSpeciesDescription:function(){let e="Studied in";return this.entry.provenanceTaxonomyLabel.forEach(t=>{e+=` ${t},`}),e=e.slice(0,-1),e+=" species",e},connectivityKey:function(){return this.entry.featureId[0]+this.entry.connectivitySource},origins:function(){return this.entry.origins},components:function(){return this.entry.components},destinations:function(){return this.entry.destinations},originsWithDatasets:function(){return this.entry.originsWithDatasets},componentsWithDatasets:function(){return this.entry.componentsWithDatasets},destinationsWithDatasets:function(){return this.entry.destinationsWithDatasets},hasSingleConnectivityList:function(){return this.entry.hasSingleConnectivityList},destinationsCombinations:function(){return this.entry.destinationsCombinations||[]},originsCombinations:function(){return this.entry.originsCombinations||[]},componentsCombinations:function(){return this.entry.componentsCombinations||[]},resources:function(){return this.entry.hyperlinks||[]},sckanVersion:function(){return this.entry.knowledgeSource},flatmapApi:function(){return this.envVars.FLATMAPAPI_LOCATION}},watch:{entry:{deep:!0,immediate:!0,handler:function(e,t){e&&e!==t&&(this.connectivityLoading=!0,this.activeView=localStorage.getItem("connectivity-active-view")||this.activeView,this.activeView==="graphView"&&(this.graphViewLoaded=!0),this.connectivitySource=this.entry.connectivitySource,this.noMapConnectivity=this.entry.noMapConnectivity,this.updateGraphConnectivity(),this.connectivityLoading=!1,(!t||(e==null?void 0:e.featureId[0])!==(t==null?void 0:t.featureId[0]))&&this.$emit("loaded"),this.isTitleExpanded=!1,this.updateTitleToggleVisibility())}},displayTitle:function(){this.isTitleExpanded=!1,this.updateTitleToggleVisibility()}},methods:{titleCase:function(e){return LL(e)},capitalise:function(e){return Le(e)},toggleTitleExpansion:function(){this.isTitleExpanded=!this.isTitleExpanded,this.isTitleExpanded||this.$nextTick(()=>{this.updateTitleToggleVisibility()})},updateTitleToggleVisibility:function(){this.$nextTick(()=>{const e=this.$refs.titleElement;if(!e){this.showTitleToggle=!1;return}const t=this.isTitleExpanded;t&&e.classList.add("title--clamped");const o=e.scrollHeight>e.clientHeight+1;this.showTitleToggle=o,t&&e.classList.remove("title--clamped"),o||(this.isTitleExpanded=!1)})},showConnectivity:function(){const e=this.entry.featureId||[];this.$emit("show-connectivity",e),de.emit("trackEvent",{event_name:"portal_maps_show_connectivity_on_map",category:this.entry.id||"",location:"map_sidebar_connectivity"})},onCopied:function(){de.emit("trackEvent",{event_name:"portal_maps_connectivity_copy",category:this.entry.id||"",location:"map_sidebar_connectivity"})},switchConnectivityView:function(e){this.activeView=e,localStorage.setItem("connectivity-active-view",this.activeView),e==="graphView"&&!this.graphViewLoaded&&this.$nextTick(()=>{this.graphViewLoaded=!0}),de.emit("trackEvent",{event_name:"portal_maps_connectivity_switch_view",category:e,location:"map_sidebar_connectivity"})},openGraphInViewer:function(){const e={entry:this.entry.featureId[0],mapServer:this.flatmapApi,sckanVersion:this.sckanVersion,connectivityFromMap:this.connectivityFromMap,connectivityError:this.connectivityError,origins:this.origins,components:this.components,destinations:this.destinations,originsWithDatasets:this.originsWithDatasets,componentsWithDatasets:this.componentsWithDatasets,destinationsWithDatasets:this.destinationsWithDatasets,hasSingleConnectivityList:this.hasSingleConnectivityList,originsCombinations:this.originsCombinations,componentsCombinations:this.componentsCombinations,destinationsCombinations:this.destinationsCombinations,allWithDatasets:[...this.componentsWithDatasets,...this.destinationsWithDatasets,...this.originsWithDatasets],connectivityInfo:this.entry};de.emit("show-connectivity-graph",e)},onTapNode:function(e){const t=e.map(o=>o.label).join(", ");this.onConnectivityHovered(t)},onShowReferenceConnectivities:function(e){this.$emit("show-reference-connectivities",e)},onReferencesLoaded:function(e){this.updatedCopyContent=this.getUpdateCopyContent(e)},getUpdateCopyContent:function(e){var f,y,g,h,p,m,b,k,N,C,x,v;if(!this.entry)return"";const t=[],o=((f=this.entry)==null?void 0:f.title)||"",r=((y=this.entryData)==null?void 0:y["long-label"])||((g=this.entry)==null?void 0:g["long-label"])||"";let a=this.entry.featureId;const i=[],s=Le(r||o);s&&i.push(`<div><strong>${s}</strong></div>`),a!=null&&a.length&&(typeof a=="object"?i.push(`<div><strong>Id:</strong> ${a[0]}</div>`):i.push(`<div><strong>Id:</strong> ${a}</div>`)),t.push(`<div>${i.join(`
478
478
  `)}</div>`),(h=this.entry.provenanceTaxonomyLabel)!=null&&h.length&&t.push(`<div>${this.provSpeciesDescription}</div>`),this.entry.paths&&t.push(`<div>${this.entry.paths}</div>`);let l=!1,c=!1;function d(_,O,I=[]){let R=`<div><strong>${_}</strong></div>`;const P=[];O.forEach(j=>{let M=[];j.split(",").forEach(H=>{const F=I.find(D=>D.name===H.trim());F?M.push(`${Le(H)} (${F.id})`):M.push(`${Le(H)}`)}),P.push(M.join(","))});const V=P.map(j=>`<li>${j}</li>`).join(`
479
479
  `);return R+=`
480
480
  `,R+=`<ul>${V}</ul>`,R}function u(_,O=[]){let I=`<div><strong>${_}</strong></div>`;const R=[...O].sort((M,H)=>{const F=((M==null?void 0:M.sckanLabel)||(M==null?void 0:M.mapLabel)||"").toLowerCase(),D=((H==null?void 0:H.sckanLabel)||(H==null?void 0:H.mapLabel)||"").toLowerCase();return F.localeCompare(D)}),P=M=>{if(!(M!=null&&M.length))return null;const H=M[0];return typeof H=="string"?H:(H==null?void 0:H[0])||null},j=R.map(M=>{var ge;if((M==null?void 0:M.sckanId)&&(M==null?void 0:M.mapId)&&JSON.stringify(M.sckanId)===JSON.stringify(M.mapId)){const Ce=P(M.mapId),ue=Le(M.sckanLabel||M.mapLabel||"-");return Ce?`${ue} (${Ce})`:ue}const F=M!=null&&M.sckanLabel?Le(M.sckanLabel):"-",D=P(M.sckanId),oe=D?`${F} (${D})`:F;if(!((ge=M==null?void 0:M.mapId)!=null&&ge.length)||!(M!=null&&M.mapLabel))return l=!0,`<s>${oe}</s> (unavailable on <strong>Map</strong>) *`;const se=Le(M.mapLabel),fe=P(M.mapId),Ne=fe?`${se} (${fe})`:se;return c=!0,`<s>${oe}</s> (<strong>Map:</strong> ${Ne}) **`}).map(M=>`<li>${M}</li>`).join(`