@abi-software/flatmapvuer 1.1.2-alpha-3 → 1.1.2-alpha-5

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.
@@ -39439,11 +39439,13 @@ class W8t {
39439
39439
  "icon-size": 0.8,
39440
39440
  "text-field": Z8t(It(this, L0)),
39441
39441
  "text-size": 10,
39442
- "text-offset": [0, -1.93]
39442
+ "text-offset": [0, -1.93],
39443
+ "text-allow-overlap": !0,
39444
+ "text-ignore-placement": !0
39443
39445
  },
39444
39446
  paint: {
39445
- "icon-opacity": ["case", ["boolean", ["get", "hidden"], !1], 0.2, 1],
39446
- "text-opacity": ["case", ["boolean", ["get", "hidden"], !1], 0.2, 1]
39447
+ "icon-opacity": ["case", ["boolean", ["get", "hidden"], !1], 0, 1],
39448
+ "text-opacity": ["case", ["boolean", ["get", "hidden"], !1], 0, 1]
39447
39449
  }
39448
39450
  });
39449
39451
  }
@@ -96831,7 +96833,7 @@ class DCt {
96831
96833
  s !== "" && this._infoControl.show(s), this.__showToolTip(h, t.lngLat, T);
96832
96834
  }
96833
96835
  __showToolTip(t, r, n = null) {
96834
- if (t !== "" || this._flatmap.options.showId && n !== null) {
96836
+ if (t !== "" || this._flatmap.options.showPosition || this._flatmap.options.showId && n !== null) {
96835
96837
  let i = "";
96836
96838
  if (this._flatmap.options.showPosition) {
96837
96839
  const o = gD(r.toArray()), a = blt(o).geometry.coordinates;
@@ -616,7 +616,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
616
616
  C17.762 24.853 24.25 19.186 24.25 12.744A12.254 12.254 0 0 0 12.25.25Z"
617
617
  style="fill:{color};stroke:{secondaryColor};stroke-width:1"/>
618
618
  <circle cx="12.5" cy="12.5" r="5" fill="{secondaryColor}"/>
619
- </svg>`,!1);const n=new x6t(e);await n.createFromTemplate($O,"marker-large-circle","#EE5900","#fff"),await n.createFromTemplate(b5t,"marker-small-circle","#005974","#fff")}function x5t(e){const t=["step",["zoom"]];for(let r=0;r<=e;r+=1)r>0&&t.push(r),t.push(["to-string",["at",r,["get","zoom-count"]]]);return t}var d6,G7,p6,Ph,T6,f6,i5,o5,U7,Ih,$7,Rh;class w5t{constructor(t,r){$e(this,U7),$e(this,$7),$e(this,d6,new Map),$e(this,G7,void 0),$e(this,p6,void 0),$e(this,Ph,void 0),$e(this,T6,new Map),$e(this,f6,void 0),$e(this,i5,{type:"FeatureCollection",features:[]}),$e(this,o5,void 0),Qr(this,o5,r),Qr(this,G7,t),Qr(this,p6,t.map),Qr(this,f6,kt(this,p6).getMaxZoom()),Qr(this,Ph,t.mapTermGraph),kt(this,p6).addSource(Gy,{type:"geojson",data:kt(this,i5)}),kt(this,p6).addLayer({id:zy,type:"symbol",source:Gy,filter:["let","index",["min",["floor",["zoom"]],kt(this,f6)-1],[">",["at",["var","index"],["get","zoom-count"]],0]],layout:{"icon-image":$O,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-offset":[0,-17],"icon-size":.8,"text-field":x5t(kt(this,f6)),"text-size":10,"text-offset":[0,-1.93]},paint:{"icon-opacity":["case",["boolean",["get","hidden"],!1],.2,1],"text-opacity":["case",["boolean",["get","hidden"],!1],.2,1]}})}addDatasetMarkers(t){for(const r of t)r.terms.length&&kt(this,T6).set(r.id,new v5t(r,kt(this,Ph)));lr(this,$7,Rh).call(this)}clearDatasetMarkers(){kt(this,T6).clear(),lr(this,$7,Rh).call(this)}removeDatasetMarker(t){kt(this,T6).has(t)&&kt(this,T6).delete(t),lr(this,$7,Rh).call(this)}removeFeatureState(t,r){if(r==="hidden"&&kt(this,d6).has(+t)){const n=kt(this,d6).get(+t);"hidden"in n.properties&&(delete n.properties.hidden,lr(this,U7,Ih).call(this))}}setFeatureState(t,r){if("hidden"in r&&kt(this,d6).has(+t)){const n=kt(this,d6).get(+t);n.properties.hidden=r.hidden,lr(this,U7,Ih).call(this)}}}d6=new WeakMap,G7=new WeakMap,p6=new WeakMap,Ph=new WeakMap,T6=new WeakMap,f6=new WeakMap,i5=new WeakMap,o5=new WeakMap,U7=new WeakSet,Ih=function(){kt(this,p6).getSource(Gy).setData(kt(this,i5))},$7=new WeakSet,Rh=function(){const e=new Map;for(const t of kt(this,T6).values())for(const r of t.markers){if(!e.has(r.term)){const o=Array(kt(this,f6)+1).fill(0),a=[],s=[];for(const h of kt(this,G7).modelFeatureIds(r.term)){const d=kt(this,G7).annotation(h);if(!("markerPosition"in d)&&!d.geometry.includes("Polygon"))continue;const f=kt(this,o5).nextMarkerId(),Q=kt(this,o5).markerPosition(h,d),m={type:"Feature",id:f,properties:{"dataset-ids":a,featureId:h,label:d.label,models:r.term,"zoom-count":o},geometry:{type:"Point",coordinates:Q}},_=kt(this,o5).getFeatureState(h);_&&"hidden"in _&&(m.properties.hidden=_.hidden),kt(this,d6).set(+h,m),s.push(m)}e.set(r.term,s)}const n=e.get(r.term)[0],i=n.properties["zoom-count"];for(let o=0;o<=kt(this,f6);o+=1)r.minZoom<=o&&o<r.maxZoom&&(i[o]+=1);n.properties["dataset-ids"].push(r.datasetId)}kt(this,i5).features=[];for(const t of e.values())kt(this,i5).features.push(...t);lr(this,U7,Ih).call(this)};const Uy="vector-tiles",ZO="blue",WO="#C8F",Z7="#0F0",W7="#D8D8D8",qO="#888",XO="#CCC",E5t="black",M5t="#222",H5t="red",Nh=["interpolate",["exponential",2],["zoom"],2,["*",["var","width"],["^",2,-.5]],7,["*",["var","width"],["^",2,2.5]],9,["*",["var","width"],["^",2,3]]];class Do{constructor(t,r,n){this.__id=`${t}_${r}`,this.__sourceLayer=n,this.__lastPaintStyle={}}get id(){return this.__id}makeFilter(t){return null}defaultFilter(){return null}paintStyle(t,r=!1){return{}}__paintChanges(t){const r={};for(const[n,i]of Object.entries(t))(!(n in this.__lastPaintStyle)||JSON.stringify(i)!==JSON.stringify(this.__lastPaintStyle[n]))&&(r[n]=i);return r}changedPaintStyle(t,r=!1){const n=r?this.__paintChanges(t):t;return this.__lastPaintStyle=t,n}style(){return{id:this.__id,source:Uy,"source-layer":this.__sourceLayer}}}class S5t extends Do{constructor(t,r){super(t,"body",r)}style(t){return{...super.style(),type:"fill",filter:["all",["==",["geometry-type"],"Polygon"],["==",["get","models"],"UBERON:0013702"]],paint:{"fill-color":"#CCC","fill-opacity":.1}}}}class C5t extends Do{constructor(t,r){super(t,"fill",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["!=",["get","models"],"UBERON:0013702"],["!",["has","node"]]]}paintStyle(t,r=!1){const n=!("colour"in t)||t.colour,i="dimmed"in t&&t.dimmed,o={"fill-color":["case",["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","hidden"],!1],W7,["has","colour"],["get","colour"],["boolean",["feature-state","active"],!1],n?"#D88":"#CCC","white"],"fill-opacity":["case",["boolean",["feature-state","hidden"],!1],.1,["boolean",["feature-state","selected"],!1],.2,["has","opacity"],["get","opacity"],["has","colour"],1,["boolean",["feature-state","active"],!1],.7,n&&!i?.01:.1]};return super.changedPaintStyle(o,r)}style(t){return{...super.style(),type:"fill",filter:this.defaultFilter(),layout:{"fill-sort-key":["get","scale"]},paint:this.paintStyle(t)}}}class A5t extends Do{constructor(t,r){super(t,"border",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["!",["has","node"]]]}paintStyle(t,r=!1){const n=!("colour"in t)||t.colour,i=!("outline"in t)||t.outline,o="dimmed"in t&&t.dimmed,a="activeRasterLayer"in t&&t.activeRasterLayer,s=["case"];s.push(["boolean",["feature-state","hidden"],!1],W7),s.push(["boolean",["feature-state","selected"],!1],E5t),n&&i&&s.push(["boolean",["feature-state","active"],!1],ZO),s.push(["boolean",["feature-state","annotated"],!1],WO),s.push(["has","colour"],["get","colour"]),s.push("#444");const h=["case"];h.push(["boolean",["feature-state","hidden"],!1],.05),n&&i&&h.push(["boolean",["feature-state","active"],!1],.9),h.push(["boolean",["feature-state","selected"],!1],.9),h.push(["boolean",["feature-state","annotated"],!1],.9),a?h.push(i&&!o?.3:.1):h.push(.5);const d=["case"];return d.push(["boolean",["get","invisible"],!1],.2),d.push(["boolean",["feature-state","selected"],!1],1.5),n&&i&&d.push(["boolean",["feature-state","active"],!1],1.5),d.push(["boolean",["feature-state","annotated"],!1],3.5),d.push(["has","colour"],.7),d.push(n&&i?.5:.1),super.changedPaintStyle({"line-color":s,"line-opacity":h,"line-width":d},r)}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:this.paintStyle(t)}}}class KO extends Do{constructor(t,r,n={}){const i="dashed"in n&&n.dashed;super(t,`feature-${i?"line-dash":"line"}`,r),this.__dashed=i}defaultFilter(){return["all",["==",["geometry-type"],"LineString"],this.__dashed?["==",["get","type"],"line-dash"]:["any",["==",["get","type"],"bezier"],["==",["get","type"],"line"]]]}paintStyle(t,r=!1){const n=!("colour"in t)||t.colour,i={"line-color":["case",["boolean",["feature-state","hidden"],!1],W7,["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","active"],!1],n?"#888":"#CCC",["has","colour"],["get","colour"],["==",["get","type"],"network"],"#AFA202",t.authoring?"#C44":"#444"],"line-opacity":["case",["boolean",["feature-state","hidden"],!1],.01,["boolean",["feature-state","selected"],!1],1,["has","colour"],1,["boolean",["feature-state","active"],!1],1,.3],"line-width":["let","width",["*",["case",["has","stroke-width"],["get","stroke-width"],1],["case",["boolean",["feature-state","selected"],!1],1.2,["boolean",["feature-state","active"],!1],1.2,t.authoring?.7:.5]],Nh]};return this.__dashed&&(i["line-dasharray"]=[3,2]),super.changedPaintStyle(i,r)}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:this.paintStyle(t)}}}class O5t extends KO{constructor(t,r){super(t,r,{dashed:!0})}}function YO(e){const t=!1 in e?"all":e.sckan.toLowerCase();return t=="none"?[["!",["has","sckan"]]]:t=="valid"?[["any",["!",["has","sckan"]],["all",["has","sckan"],["==",["get","sckan"],!0]]]]:t=="invalid"?[["any",["!",["has","sckan"]],["all",["has","sckan"],["!=",["get","sckan"],!0]]]]:[]}class k5t extends Do{constructor(t,r){super(t,"annotated-path",r)}makeFilter(t={}){return["all",...YO(t)]}paintStyle(t={},r=!1){const n="dimmed"in t&&t.dimmed,i="excludeAnnotated"in t&&t.excludeAnnotated,o={"line-color":WO,"line-dasharray":[5,.5,3,.5],"line-opacity":["case",["boolean",["feature-state","active"],!1],.8,["boolean",["feature-state","selected"],!1],.8,["boolean",["feature-state","hidden"],!1],.05,["boolean",["feature-state","annotated"],!1],i||n?.05:.8,.6],"line-width":["let","width",["case",["boolean",["feature-state","hidden"],!1],0,["boolean",["feature-state","annotated"],!1],i?0:["*",1.1,["case",["has","stroke-width"],["get","stroke-width"],["boolean",["feature-state","active"],!1],1.1,["boolean",["feature-state","active"],!1],1.1,1]],0],Nh]};return super.changedPaintStyle(o,r)}style(t){return{...super.style(),type:"line",filter:this.makeFilter(t),paint:this.paintStyle(t),layout:{"line-cap":"square"}}}}class Bh extends Do{constructor(t,r,n={}){const i="dashed"in n&&n.dashed,o="highlight"in n&&n.highlight;super(t,`path${o?"-highlight":""}-${i?"line-dash":"line"}`,r),this.__dashed=i,this.__highlight=o}makeFilter(t={}){const r=YO(t);let n=[];if("taxons"in t)if(t.taxons.length){n.push("any");for(const i of t.taxons)i!==rF?n.push(["in",i,["get","taxons"]]):n.push(["case",["has","taxons"],!1,!0]);n=[n]}else n.push(!1);return this.__dashed?["all",["==",["get","type"],"line-dash"],...r,...n]:["all",["any",["==",["get","type"],"bezier"],["all",["==",["get","type"],"line"],...r,...n]]]}paintStyle(t={},r=!1){const n="dimmed"in t&&t.dimmed,i="excludeAnnotated"in t&&t.excludeAnnotated,o={"line-color":["let","active",["to-number",["feature-state","active"],0],["case",["boolean",["feature-state","hidden"],!1],W7,["==",["get","type"],"bezier"],"red",...XA,"#888"]],"line-opacity":this.__highlight?["case",["boolean",["feature-state","hidden"],!1],0,["boolean",["get","invisible"],!1],0,["boolean",["feature-state","selected"],!1],1,["boolean",["feature-state","active"],!1],1,0]:["case",["boolean",["feature-state","hidden"],!1],.01,["==",["get","type"],"bezier"],1,["==",["get","kind"],"error"],1,["boolean",["get","invisible"],!1],.001,["boolean",["feature-state","selected"],!1],0,["boolean",["feature-state","active"],!1],0,n?.1:.8],"line-width":["let","width",["*",this.__highlight?["case",["boolean",["get","invisible"],!1],.1,["boolean",["feature-state","selected"],!1],["case",["boolean",["feature-state","active"],!1],2,.9],["boolean",["feature-state","active"],!1],1.8,0]:["case",["==",["get","type"],"bezier"],.1,["==",["get","kind"],"error"],1,["==",["get","kind"],"unknown"],1,["boolean",["get","invisible"],!1],.1,["boolean",["feature-state","selected"],!1],0,["boolean",["feature-state","active"],!1],0,.6],["case",["boolean",["feature-state","annotated"],!1],i?0:1,1],["case",["has","stroke-width"],["get","stroke-width"],1]],Nh]};return this.__dashed&&(o["line-dasharray"]=[1,1]),super.changedPaintStyle(o,r)}style(t={}){return{...super.style(),type:"line",filter:this.makeFilter(t),layout:{"line-cap":"butt"},paint:this.paintStyle(t)}}}class V5t extends Bh{constructor(t,r){super(t,r,{dashed:!0})}}class P5t extends Bh{constructor(t,r){super(t,r,{highlight:!0})}}class I5t extends Bh{constructor(t,r){super(t,r,{dashed:!0,highlight:!0})}}class JO extends Do{constructor(t,r,n){super(t,`centreline-${r}`,n),this.__type=r}defaultFilter(){return["all",["==",["geometry-type"],"LineString"],["==",["get","kind"],"centreline"],["has","label"]]}paintStyle(t,r=!1){!("colour"in t)||t.colour;const n={"line-color":this.__type=="edge"?"#000":["case",["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","active"],!1],qO,XO],"line-opacity":["case",["boolean",["feature-state","hidden"],!1],0,["boolean",["feature-state","selected"],!1],1,["boolean",["feature-state","active"],!1],1,this.__type=="edge"?.4:.8],"line-width":["let","width",this.__type=="edge"?1.6:1.2,Nh]};return super.changedPaintStyle(n,r)}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:this.paintStyle(t),layout:{"line-cap":"round","line-join":"bevel"}}}}class R5t extends JO{constructor(t,r){super(t,"edge",r)}}class N5t extends JO{constructor(t,r){super(t,"track",r)}}class B5t extends Do{constructor(t,r){super(t,"node-fill",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["has","node"]]}paintStyle(t={},r=!1){const n=t.showCentrelines||!1,i={"fill-color":["case",["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","active"],!1],qO,XO],"fill-opacity":n?.8:.01};return super.changedPaintStyle(i,r)}style(t){return{...super.style(),type:"fill",filter:this.defaultFilter(),layout:{"fill-sort-key":["get","scale"]},paint:this.paintStyle(t)}}}class D5t extends Do{constructor(t,r){super(t,"nerve-path",r)}defaultFilter(){return["all",["==",["geometry-type"],"LineString"],["!=",["get","kind"],"centreline"],["==",["get","type"],"nerve"]]}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:{"line-color":["case",["boolean",["feature-state","hidden"],!1],W7,["boolean",["feature-state","selected"],!1],H5t,["boolean",["feature-state","active"],!1],M5t,"#888"],"line-opacity":["case",["boolean",["feature-state","hidden"],!1],.3,["boolean",["get","invisible"],!1],.001,["boolean",["feature-state","active"],!1],.9,["boolean",["feature-state","selected"],!1],.9,.9],"line-dasharray":[2,1],"line-width":["let","width",["case",["boolean",["feature-state","active"],!1],.8,["boolean",["feature-state","selected"],!1],1.2,.6],["interpolate",["exponential",2],["zoom"],2,["*",["var","width"],["^",2,-1]],10,["*",["var","width"],["^",2,6]]]]}}}}class F5t extends Do{constructor(t,r){super(t,"nerve-border",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["==",["get","type"],"nerve-section"]]}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:{"line-color":["case",["boolean",["feature-state","active"],!1],ZO,["boolean",["feature-state","selected"],!1],"red","#444"],"line-opacity":["case",["boolean",["get","invisible"],!1],.05,["boolean",["feature-state","active"],!1],.9,["boolean",["feature-state","selected"],!1],.9,.3],"line-width":["case",["boolean",["get","invisible"],!1],.5,["boolean",["feature-state","selected"],!1],6,2]}}}}class j5t extends Do{constructor(t,r){super(t,"nerve-fill",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["any",["==",["get","type"],"arrow"],["==",["get","type"],"bezier"],["==",["get","type"],"junction"],["==",["get","type"],"nerve"],["==",["get","type"],"nerve-section"]]]}paintStyle(t={},r=!1){const n="dimmed"in t&&t.dimmed,i={"fill-color":["let","active",["to-number",["feature-state","active"],0],["case",["all",["==",["var","active"],0],["==",["get","type"],"arrow"],["boolean",["feature-state","selected"],!1]],Z7,["==",["get","kind"],"bezier-end"],"red",["==",["get","kind"],"bezier-control"],"green",...XA,"white"]],"fill-opacity":["case",["boolean",["feature-state","hidden"],!1],.01,["boolean",["feature-state","selected"],!1],.8,["boolean",["feature-state","active"],!1],.9,["==",["get","type"],"bezier"],.9,["any",["==",["get","type"],"arrow"],["==",["get","type"],"junction"]],n?.1:.5,.01]};return super.changedPaintStyle(i,r)}style(t={}){return{...super.style(),filter:this.defaultFilter(),type:"fill",paint:this.paintStyle(t)}}}class z5t extends Do{constructor(t,r){super(t,"large-symbol",r)}defaultFilter(){return["all",["has","labelled"],["has","label"]]}style(t){return{...super.style(),type:"symbol",minzoom:3,filter:this.defaultFilter(),layout:{visibility:"visible","icon-allow-overlap":!0,"icon-image":"label-background","text-allow-overlap":!0,"text-field":"{label}","text-font":["Open Sans Regular"],"text-line-height":1,"text-max-width":5,"text-size":16,"icon-text-fit":"both"},paint:{"text-color":["case",["boolean",["feature-state","active"],!1],"#8300bf","#000"]}}}}class G5t extends Do{constructor(t,r){super(t,"small-symbol",r)}defaultFilter(){return["all",["has","label"],[">",["get","scale"],5]]}style(t){return{...super.style(),type:"symbol",minzoom:6,filter:this.defaultFilter(),layout:{visibility:"visible","icon-allow-overlap":!0,"icon-image":"label-background","text-allow-overlap":!0,"text-field":"{label}","text-font":["Open Sans Regular"],"text-line-height":1,"text-max-width":5,"text-size":{stops:[[5,8],[7,12],[9,20]]},"icon-text-fit":"both"},paint:{"text-color":["case",["boolean",["feature-state","active"],!1],"#8300bf","#000"]}}}}class U5t{constructor(){this.__id="background"}get id(){return this.__id}style(t,r=1){return{id:this.__id,type:"background",paint:{"background-color":t,"background-opacity":r}}}}class $5t{constructor(t){this.__id=t}get id(){return this.__id}style(t){const r=!("colour"in t)||t.colour;return{id:this.__id,source:this.__id,type:"raster",visibility:r?"visible":"none"}}}function q7(e){"@babel/helpers - typeof";return q7=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q7(e)}function Z5t(e,t){if(q7(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(q7(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W5t(e){var t=Z5t(e,"string");return q7(t)=="symbol"?t:t+""}function dt(e,t,r){return t=W5t(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dh(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const $y=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),tk=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);tk&&parseFloat(tk[1]);const q5t="3.4.15";function Bs(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const Fh=typeof process!="object"||String(process)!=="[object process]"||process.browser,X5t=typeof window<"u"&&typeof window.orientation<"u",ek=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);ek&&parseFloat(ek[1]);class K5t{constructor(t,r){dt(this,"name",void 0),dt(this,"workerThread",void 0),dt(this,"isRunning",!0),dt(this,"result",void 0),dt(this,"_resolve",()=>{}),dt(this,"_reject",()=>{}),this.name=t,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){Bs(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Bs(this.isRunning),this.isRunning=!1,this._reject(t)}}let Zy=class{terminate(){}};const Wy=new Map;function Y5t(e){Bs(e.source&&!e.url||!e.source&&e.url);let t=Wy.get(e.source||e.url);return t||(e.url&&(t=J5t(e.url),Wy.set(e.url,t)),e.source&&(t=rk(e.source),Wy.set(e.source,t))),Bs(t),t}function J5t(e){if(!e.startsWith("http"))return e;const t=tlt(e);return rk(t)}function rk(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function tlt(e){return`try {
619
+ </svg>`,!1);const n=new x6t(e);await n.createFromTemplate($O,"marker-large-circle","#EE5900","#fff"),await n.createFromTemplate(b5t,"marker-small-circle","#005974","#fff")}function x5t(e){const t=["step",["zoom"]];for(let r=0;r<=e;r+=1)r>0&&t.push(r),t.push(["to-string",["at",r,["get","zoom-count"]]]);return t}var d6,G7,p6,Ph,T6,f6,i5,o5,U7,Ih,$7,Rh;class w5t{constructor(t,r){$e(this,U7),$e(this,$7),$e(this,d6,new Map),$e(this,G7,void 0),$e(this,p6,void 0),$e(this,Ph,void 0),$e(this,T6,new Map),$e(this,f6,void 0),$e(this,i5,{type:"FeatureCollection",features:[]}),$e(this,o5,void 0),Qr(this,o5,r),Qr(this,G7,t),Qr(this,p6,t.map),Qr(this,f6,kt(this,p6).getMaxZoom()),Qr(this,Ph,t.mapTermGraph),kt(this,p6).addSource(Gy,{type:"geojson",data:kt(this,i5)}),kt(this,p6).addLayer({id:zy,type:"symbol",source:Gy,filter:["let","index",["min",["floor",["zoom"]],kt(this,f6)-1],[">",["at",["var","index"],["get","zoom-count"]],0]],layout:{"icon-image":$O,"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-offset":[0,-17],"icon-size":.8,"text-field":x5t(kt(this,f6)),"text-size":10,"text-offset":[0,-1.93],"text-allow-overlap":!0,"text-ignore-placement":!0},paint:{"icon-opacity":["case",["boolean",["get","hidden"],!1],0,1],"text-opacity":["case",["boolean",["get","hidden"],!1],0,1]}})}addDatasetMarkers(t){for(const r of t)r.terms.length&&kt(this,T6).set(r.id,new v5t(r,kt(this,Ph)));lr(this,$7,Rh).call(this)}clearDatasetMarkers(){kt(this,T6).clear(),lr(this,$7,Rh).call(this)}removeDatasetMarker(t){kt(this,T6).has(t)&&kt(this,T6).delete(t),lr(this,$7,Rh).call(this)}removeFeatureState(t,r){if(r==="hidden"&&kt(this,d6).has(+t)){const n=kt(this,d6).get(+t);"hidden"in n.properties&&(delete n.properties.hidden,lr(this,U7,Ih).call(this))}}setFeatureState(t,r){if("hidden"in r&&kt(this,d6).has(+t)){const n=kt(this,d6).get(+t);n.properties.hidden=r.hidden,lr(this,U7,Ih).call(this)}}}d6=new WeakMap,G7=new WeakMap,p6=new WeakMap,Ph=new WeakMap,T6=new WeakMap,f6=new WeakMap,i5=new WeakMap,o5=new WeakMap,U7=new WeakSet,Ih=function(){kt(this,p6).getSource(Gy).setData(kt(this,i5))},$7=new WeakSet,Rh=function(){const e=new Map;for(const t of kt(this,T6).values())for(const r of t.markers){if(!e.has(r.term)){const o=Array(kt(this,f6)+1).fill(0),a=[],s=[];for(const h of kt(this,G7).modelFeatureIds(r.term)){const d=kt(this,G7).annotation(h);if(!("markerPosition"in d)&&!d.geometry.includes("Polygon"))continue;const f=kt(this,o5).nextMarkerId(),Q=kt(this,o5).markerPosition(h,d),m={type:"Feature",id:f,properties:{"dataset-ids":a,featureId:h,label:d.label,models:r.term,"zoom-count":o},geometry:{type:"Point",coordinates:Q}},_=kt(this,o5).getFeatureState(h);_&&"hidden"in _&&(m.properties.hidden=_.hidden),kt(this,d6).set(+h,m),s.push(m)}e.set(r.term,s)}const n=e.get(r.term)[0],i=n.properties["zoom-count"];for(let o=0;o<=kt(this,f6);o+=1)r.minZoom<=o&&o<r.maxZoom&&(i[o]+=1);n.properties["dataset-ids"].push(r.datasetId)}kt(this,i5).features=[];for(const t of e.values())kt(this,i5).features.push(...t);lr(this,U7,Ih).call(this)};const Uy="vector-tiles",ZO="blue",WO="#C8F",Z7="#0F0",W7="#D8D8D8",qO="#888",XO="#CCC",E5t="black",M5t="#222",H5t="red",Nh=["interpolate",["exponential",2],["zoom"],2,["*",["var","width"],["^",2,-.5]],7,["*",["var","width"],["^",2,2.5]],9,["*",["var","width"],["^",2,3]]];class Do{constructor(t,r,n){this.__id=`${t}_${r}`,this.__sourceLayer=n,this.__lastPaintStyle={}}get id(){return this.__id}makeFilter(t){return null}defaultFilter(){return null}paintStyle(t,r=!1){return{}}__paintChanges(t){const r={};for(const[n,i]of Object.entries(t))(!(n in this.__lastPaintStyle)||JSON.stringify(i)!==JSON.stringify(this.__lastPaintStyle[n]))&&(r[n]=i);return r}changedPaintStyle(t,r=!1){const n=r?this.__paintChanges(t):t;return this.__lastPaintStyle=t,n}style(){return{id:this.__id,source:Uy,"source-layer":this.__sourceLayer}}}class S5t extends Do{constructor(t,r){super(t,"body",r)}style(t){return{...super.style(),type:"fill",filter:["all",["==",["geometry-type"],"Polygon"],["==",["get","models"],"UBERON:0013702"]],paint:{"fill-color":"#CCC","fill-opacity":.1}}}}class C5t extends Do{constructor(t,r){super(t,"fill",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["!=",["get","models"],"UBERON:0013702"],["!",["has","node"]]]}paintStyle(t,r=!1){const n=!("colour"in t)||t.colour,i="dimmed"in t&&t.dimmed,o={"fill-color":["case",["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","hidden"],!1],W7,["has","colour"],["get","colour"],["boolean",["feature-state","active"],!1],n?"#D88":"#CCC","white"],"fill-opacity":["case",["boolean",["feature-state","hidden"],!1],.1,["boolean",["feature-state","selected"],!1],.2,["has","opacity"],["get","opacity"],["has","colour"],1,["boolean",["feature-state","active"],!1],.7,n&&!i?.01:.1]};return super.changedPaintStyle(o,r)}style(t){return{...super.style(),type:"fill",filter:this.defaultFilter(),layout:{"fill-sort-key":["get","scale"]},paint:this.paintStyle(t)}}}class A5t extends Do{constructor(t,r){super(t,"border",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["!",["has","node"]]]}paintStyle(t,r=!1){const n=!("colour"in t)||t.colour,i=!("outline"in t)||t.outline,o="dimmed"in t&&t.dimmed,a="activeRasterLayer"in t&&t.activeRasterLayer,s=["case"];s.push(["boolean",["feature-state","hidden"],!1],W7),s.push(["boolean",["feature-state","selected"],!1],E5t),n&&i&&s.push(["boolean",["feature-state","active"],!1],ZO),s.push(["boolean",["feature-state","annotated"],!1],WO),s.push(["has","colour"],["get","colour"]),s.push("#444");const h=["case"];h.push(["boolean",["feature-state","hidden"],!1],.05),n&&i&&h.push(["boolean",["feature-state","active"],!1],.9),h.push(["boolean",["feature-state","selected"],!1],.9),h.push(["boolean",["feature-state","annotated"],!1],.9),a?h.push(i&&!o?.3:.1):h.push(.5);const d=["case"];return d.push(["boolean",["get","invisible"],!1],.2),d.push(["boolean",["feature-state","selected"],!1],1.5),n&&i&&d.push(["boolean",["feature-state","active"],!1],1.5),d.push(["boolean",["feature-state","annotated"],!1],3.5),d.push(["has","colour"],.7),d.push(n&&i?.5:.1),super.changedPaintStyle({"line-color":s,"line-opacity":h,"line-width":d},r)}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:this.paintStyle(t)}}}class KO extends Do{constructor(t,r,n={}){const i="dashed"in n&&n.dashed;super(t,`feature-${i?"line-dash":"line"}`,r),this.__dashed=i}defaultFilter(){return["all",["==",["geometry-type"],"LineString"],this.__dashed?["==",["get","type"],"line-dash"]:["any",["==",["get","type"],"bezier"],["==",["get","type"],"line"]]]}paintStyle(t,r=!1){const n=!("colour"in t)||t.colour,i={"line-color":["case",["boolean",["feature-state","hidden"],!1],W7,["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","active"],!1],n?"#888":"#CCC",["has","colour"],["get","colour"],["==",["get","type"],"network"],"#AFA202",t.authoring?"#C44":"#444"],"line-opacity":["case",["boolean",["feature-state","hidden"],!1],.01,["boolean",["feature-state","selected"],!1],1,["has","colour"],1,["boolean",["feature-state","active"],!1],1,.3],"line-width":["let","width",["*",["case",["has","stroke-width"],["get","stroke-width"],1],["case",["boolean",["feature-state","selected"],!1],1.2,["boolean",["feature-state","active"],!1],1.2,t.authoring?.7:.5]],Nh]};return this.__dashed&&(i["line-dasharray"]=[3,2]),super.changedPaintStyle(i,r)}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:this.paintStyle(t)}}}class O5t extends KO{constructor(t,r){super(t,r,{dashed:!0})}}function YO(e){const t=!1 in e?"all":e.sckan.toLowerCase();return t=="none"?[["!",["has","sckan"]]]:t=="valid"?[["any",["!",["has","sckan"]],["all",["has","sckan"],["==",["get","sckan"],!0]]]]:t=="invalid"?[["any",["!",["has","sckan"]],["all",["has","sckan"],["!=",["get","sckan"],!0]]]]:[]}class k5t extends Do{constructor(t,r){super(t,"annotated-path",r)}makeFilter(t={}){return["all",...YO(t)]}paintStyle(t={},r=!1){const n="dimmed"in t&&t.dimmed,i="excludeAnnotated"in t&&t.excludeAnnotated,o={"line-color":WO,"line-dasharray":[5,.5,3,.5],"line-opacity":["case",["boolean",["feature-state","active"],!1],.8,["boolean",["feature-state","selected"],!1],.8,["boolean",["feature-state","hidden"],!1],.05,["boolean",["feature-state","annotated"],!1],i||n?.05:.8,.6],"line-width":["let","width",["case",["boolean",["feature-state","hidden"],!1],0,["boolean",["feature-state","annotated"],!1],i?0:["*",1.1,["case",["has","stroke-width"],["get","stroke-width"],["boolean",["feature-state","active"],!1],1.1,["boolean",["feature-state","active"],!1],1.1,1]],0],Nh]};return super.changedPaintStyle(o,r)}style(t){return{...super.style(),type:"line",filter:this.makeFilter(t),paint:this.paintStyle(t),layout:{"line-cap":"square"}}}}class Bh extends Do{constructor(t,r,n={}){const i="dashed"in n&&n.dashed,o="highlight"in n&&n.highlight;super(t,`path${o?"-highlight":""}-${i?"line-dash":"line"}`,r),this.__dashed=i,this.__highlight=o}makeFilter(t={}){const r=YO(t);let n=[];if("taxons"in t)if(t.taxons.length){n.push("any");for(const i of t.taxons)i!==rF?n.push(["in",i,["get","taxons"]]):n.push(["case",["has","taxons"],!1,!0]);n=[n]}else n.push(!1);return this.__dashed?["all",["==",["get","type"],"line-dash"],...r,...n]:["all",["any",["==",["get","type"],"bezier"],["all",["==",["get","type"],"line"],...r,...n]]]}paintStyle(t={},r=!1){const n="dimmed"in t&&t.dimmed,i="excludeAnnotated"in t&&t.excludeAnnotated,o={"line-color":["let","active",["to-number",["feature-state","active"],0],["case",["boolean",["feature-state","hidden"],!1],W7,["==",["get","type"],"bezier"],"red",...XA,"#888"]],"line-opacity":this.__highlight?["case",["boolean",["feature-state","hidden"],!1],0,["boolean",["get","invisible"],!1],0,["boolean",["feature-state","selected"],!1],1,["boolean",["feature-state","active"],!1],1,0]:["case",["boolean",["feature-state","hidden"],!1],.01,["==",["get","type"],"bezier"],1,["==",["get","kind"],"error"],1,["boolean",["get","invisible"],!1],.001,["boolean",["feature-state","selected"],!1],0,["boolean",["feature-state","active"],!1],0,n?.1:.8],"line-width":["let","width",["*",this.__highlight?["case",["boolean",["get","invisible"],!1],.1,["boolean",["feature-state","selected"],!1],["case",["boolean",["feature-state","active"],!1],2,.9],["boolean",["feature-state","active"],!1],1.8,0]:["case",["==",["get","type"],"bezier"],.1,["==",["get","kind"],"error"],1,["==",["get","kind"],"unknown"],1,["boolean",["get","invisible"],!1],.1,["boolean",["feature-state","selected"],!1],0,["boolean",["feature-state","active"],!1],0,.6],["case",["boolean",["feature-state","annotated"],!1],i?0:1,1],["case",["has","stroke-width"],["get","stroke-width"],1]],Nh]};return this.__dashed&&(o["line-dasharray"]=[1,1]),super.changedPaintStyle(o,r)}style(t={}){return{...super.style(),type:"line",filter:this.makeFilter(t),layout:{"line-cap":"butt"},paint:this.paintStyle(t)}}}class V5t extends Bh{constructor(t,r){super(t,r,{dashed:!0})}}class P5t extends Bh{constructor(t,r){super(t,r,{highlight:!0})}}class I5t extends Bh{constructor(t,r){super(t,r,{dashed:!0,highlight:!0})}}class JO extends Do{constructor(t,r,n){super(t,`centreline-${r}`,n),this.__type=r}defaultFilter(){return["all",["==",["geometry-type"],"LineString"],["==",["get","kind"],"centreline"],["has","label"]]}paintStyle(t,r=!1){!("colour"in t)||t.colour;const n={"line-color":this.__type=="edge"?"#000":["case",["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","active"],!1],qO,XO],"line-opacity":["case",["boolean",["feature-state","hidden"],!1],0,["boolean",["feature-state","selected"],!1],1,["boolean",["feature-state","active"],!1],1,this.__type=="edge"?.4:.8],"line-width":["let","width",this.__type=="edge"?1.6:1.2,Nh]};return super.changedPaintStyle(n,r)}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:this.paintStyle(t),layout:{"line-cap":"round","line-join":"bevel"}}}}class R5t extends JO{constructor(t,r){super(t,"edge",r)}}class N5t extends JO{constructor(t,r){super(t,"track",r)}}class B5t extends Do{constructor(t,r){super(t,"node-fill",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["has","node"]]}paintStyle(t={},r=!1){const n=t.showCentrelines||!1,i={"fill-color":["case",["boolean",["feature-state","selected"],!1],Z7,["boolean",["feature-state","active"],!1],qO,XO],"fill-opacity":n?.8:.01};return super.changedPaintStyle(i,r)}style(t){return{...super.style(),type:"fill",filter:this.defaultFilter(),layout:{"fill-sort-key":["get","scale"]},paint:this.paintStyle(t)}}}class D5t extends Do{constructor(t,r){super(t,"nerve-path",r)}defaultFilter(){return["all",["==",["geometry-type"],"LineString"],["!=",["get","kind"],"centreline"],["==",["get","type"],"nerve"]]}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:{"line-color":["case",["boolean",["feature-state","hidden"],!1],W7,["boolean",["feature-state","selected"],!1],H5t,["boolean",["feature-state","active"],!1],M5t,"#888"],"line-opacity":["case",["boolean",["feature-state","hidden"],!1],.3,["boolean",["get","invisible"],!1],.001,["boolean",["feature-state","active"],!1],.9,["boolean",["feature-state","selected"],!1],.9,.9],"line-dasharray":[2,1],"line-width":["let","width",["case",["boolean",["feature-state","active"],!1],.8,["boolean",["feature-state","selected"],!1],1.2,.6],["interpolate",["exponential",2],["zoom"],2,["*",["var","width"],["^",2,-1]],10,["*",["var","width"],["^",2,6]]]]}}}}class F5t extends Do{constructor(t,r){super(t,"nerve-border",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["==",["get","type"],"nerve-section"]]}style(t){return{...super.style(),type:"line",filter:this.defaultFilter(),paint:{"line-color":["case",["boolean",["feature-state","active"],!1],ZO,["boolean",["feature-state","selected"],!1],"red","#444"],"line-opacity":["case",["boolean",["get","invisible"],!1],.05,["boolean",["feature-state","active"],!1],.9,["boolean",["feature-state","selected"],!1],.9,.3],"line-width":["case",["boolean",["get","invisible"],!1],.5,["boolean",["feature-state","selected"],!1],6,2]}}}}class j5t extends Do{constructor(t,r){super(t,"nerve-fill",r)}defaultFilter(){return["all",["==",["geometry-type"],"Polygon"],["any",["==",["get","type"],"arrow"],["==",["get","type"],"bezier"],["==",["get","type"],"junction"],["==",["get","type"],"nerve"],["==",["get","type"],"nerve-section"]]]}paintStyle(t={},r=!1){const n="dimmed"in t&&t.dimmed,i={"fill-color":["let","active",["to-number",["feature-state","active"],0],["case",["all",["==",["var","active"],0],["==",["get","type"],"arrow"],["boolean",["feature-state","selected"],!1]],Z7,["==",["get","kind"],"bezier-end"],"red",["==",["get","kind"],"bezier-control"],"green",...XA,"white"]],"fill-opacity":["case",["boolean",["feature-state","hidden"],!1],.01,["boolean",["feature-state","selected"],!1],.8,["boolean",["feature-state","active"],!1],.9,["==",["get","type"],"bezier"],.9,["any",["==",["get","type"],"arrow"],["==",["get","type"],"junction"]],n?.1:.5,.01]};return super.changedPaintStyle(i,r)}style(t={}){return{...super.style(),filter:this.defaultFilter(),type:"fill",paint:this.paintStyle(t)}}}class z5t extends Do{constructor(t,r){super(t,"large-symbol",r)}defaultFilter(){return["all",["has","labelled"],["has","label"]]}style(t){return{...super.style(),type:"symbol",minzoom:3,filter:this.defaultFilter(),layout:{visibility:"visible","icon-allow-overlap":!0,"icon-image":"label-background","text-allow-overlap":!0,"text-field":"{label}","text-font":["Open Sans Regular"],"text-line-height":1,"text-max-width":5,"text-size":16,"icon-text-fit":"both"},paint:{"text-color":["case",["boolean",["feature-state","active"],!1],"#8300bf","#000"]}}}}class G5t extends Do{constructor(t,r){super(t,"small-symbol",r)}defaultFilter(){return["all",["has","label"],[">",["get","scale"],5]]}style(t){return{...super.style(),type:"symbol",minzoom:6,filter:this.defaultFilter(),layout:{visibility:"visible","icon-allow-overlap":!0,"icon-image":"label-background","text-allow-overlap":!0,"text-field":"{label}","text-font":["Open Sans Regular"],"text-line-height":1,"text-max-width":5,"text-size":{stops:[[5,8],[7,12],[9,20]]},"icon-text-fit":"both"},paint:{"text-color":["case",["boolean",["feature-state","active"],!1],"#8300bf","#000"]}}}}class U5t{constructor(){this.__id="background"}get id(){return this.__id}style(t,r=1){return{id:this.__id,type:"background",paint:{"background-color":t,"background-opacity":r}}}}class $5t{constructor(t){this.__id=t}get id(){return this.__id}style(t){const r=!("colour"in t)||t.colour;return{id:this.__id,source:this.__id,type:"raster",visibility:r?"visible":"none"}}}function q7(e){"@babel/helpers - typeof";return q7=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q7(e)}function Z5t(e,t){if(q7(e)!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t||"default");if(q7(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function W5t(e){var t=Z5t(e,"string");return q7(t)=="symbol"?t:t+""}function dt(e,t,r){return t=W5t(t),t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Dh(e,t){if(!e)throw new Error(t||"loader assertion failed.")}const $y=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser),tk=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);tk&&parseFloat(tk[1]);const q5t="3.4.15";function Bs(e,t){if(!e)throw new Error(t||"loaders.gl assertion failed.")}const Fh=typeof process!="object"||String(process)!=="[object process]"||process.browser,X5t=typeof window<"u"&&typeof window.orientation<"u",ek=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version);ek&&parseFloat(ek[1]);class K5t{constructor(t,r){dt(this,"name",void 0),dt(this,"workerThread",void 0),dt(this,"isRunning",!0),dt(this,"result",void 0),dt(this,"_resolve",()=>{}),dt(this,"_reject",()=>{}),this.name=t,this.workerThread=r,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,r){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:r})}done(t){Bs(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){Bs(this.isRunning),this.isRunning=!1,this._reject(t)}}let Zy=class{terminate(){}};const Wy=new Map;function Y5t(e){Bs(e.source&&!e.url||!e.source&&e.url);let t=Wy.get(e.source||e.url);return t||(e.url&&(t=J5t(e.url),Wy.set(e.url,t)),e.source&&(t=rk(e.source),Wy.set(e.source,t))),Bs(t),t}function J5t(e){if(!e.startsWith("http"))return e;const t=tlt(e);return rk(t)}function rk(e){const t=new Blob([e],{type:"application/javascript"});return URL.createObjectURL(t)}function tlt(e){return`try {
620
620
  importScripts('`.concat(e,`');
621
621
  } catch (error) {
622
622
  console.error(error);
@@ -1708,7 +1708,7 @@ ${t.vs}`,t}setDataProperty(t,r,n){const i=kt(this,E5).get(+t);i&&(!(r in i)||i[r
1708
1708
  `;)e.i++;e.i++},Math:function(e,t){e.saveText();for(var r=e.i,n,i,o=0;i=e.GetNext();)switch(n=e.i++,i){case"\\":var a=e.GetCS();a===")"&&(i="\\(");case"$":if(o===0&&t===i){var s=e.texParser.configuration,h=new IMt.default(e.string.substr(r,n-r),e.stack.env,s).mml();e.PushMath(h);return}break;case"{":o++;break;case"}":o===0&&e.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace"),o--;break}e.Error("MathNotTerminated","Math-mode is not properly terminated")},MathModeOnly:function(e,t){e.Error("MathModeOnly","'%1' allowed only in math mode",t)},Misplaced:function(e,t){e.Error("Misplaced","'%1' can not be used here",t)},OpenBrace:function(e,t){var r=e.stack.env;e.envStack.push(r),e.stack.env=Object.assign({},r)},CloseBrace:function(e,t){e.envStack.length?(e.saveText(),e.stack.env=e.envStack.pop()):e.Error("ExtraCloseMissingOpen","Extra close brace or missing open brace")},OpenQuote:function(e,t){e.string.charAt(e.i)===t?(e.text+="“",e.i++):e.text+="‘"},CloseQuote:function(e,t){e.string.charAt(e.i)===t?(e.text+="”",e.i++):e.text+="’"},Tilde:function(e,t){e.text+=" "},Space:function(e,t){for(e.text+=" ";e.GetNext().match(/\s/);)e.i++},SelfQuote:function(e,t){e.text+=t.substr(1)},Insert:function(e,t,r){e.text+=r},Accent:function(e,t,r){var n=e.ParseArg(t),i=e.create("token","mo",{},r);e.addAttributes(i),e.Push(e.create("node","mover",[n,i]))},Emph:function(e,t){var r=e.stack.env.mathvariant==="-tex-mathit"?"normal":"-tex-mathit";e.Push(e.ParseTextArg(t,{mathvariant:r}))},SetFont:function(e,t,r){e.saveText(),e.stack.env.mathvariant=r},SetSize:function(e,t,r){e.saveText(),e.stack.env.mathsize=r},CheckAutoload:function(e,t){var r=e.configuration.packageData.get("autoload"),n=e.texParser;t=t.slice(1);var i=n.lookup("macro",t);if(!i||r&&i._func===r.Autoload){if(n.parse("macro",[n,t]),!i)return;(0,RMt.retryAfter)(Promise.resolve())}n.parse("macro",[e,t])},Macro:cl.default.Macro,Spacer:cl.default.Spacer,Hskip:cl.default.Hskip,rule:cl.default.rule,Rule:cl.default.Rule,HandleRef:cl.default.HandleRef};var nu={},NMt=I&&I.__extends||function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),UD=I&&I.__values||function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},BMt=I&&I.__read||function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o},DMt=I&&I.__spreadArray||function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Gf=I&&I.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(nu,"__esModule",{value:!0}),nu.TextParser=void 0;var FMt=Gf(j1()),$D=Gf(pn),jMt=Gf(Un()),zMt=Lr,ZD=Gf(Gn),WD=yr,GMt=function(e){NMt(t,e);function t(r,n,i,o){var a=e.call(this,r,n,i)||this;return a.level=o,a}return Object.defineProperty(t.prototype,"texParser",{get:function(){return this.configuration.packageData.get("textmacros").texParser},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tags",{get:function(){return this.texParser.tags},enumerable:!1,configurable:!0}),t.prototype.mml=function(){return this.level!=null?this.create("node","mstyle",this.nodes,{displaystyle:!1,scriptlevel:this.level}):this.nodes.length===1?this.nodes[0]:this.create("node","mrow",this.nodes)},t.prototype.Parse=function(){this.text="",this.nodes=[],this.envStack=[],e.prototype.Parse.call(this)},t.prototype.saveText=function(){if(this.text){var r=this.stack.env.mathvariant,n=jMt.default.internalText(this,this.text,r?{mathvariant:r}:{});this.text="",this.Push(n)}},t.prototype.Push=function(r){if(this.text&&this.saveText(),r instanceof WD.StopItem)return e.prototype.Push.call(this,r);if(r instanceof WD.StyleItem){this.stack.env.mathcolor=this.stack.env.color;return}r instanceof zMt.AbstractMmlNode&&(this.addAttributes(r),this.nodes.push(r))},t.prototype.PushMath=function(r){var n,i,o=this.stack.env;r.isKind("TeXAtom")||(r=this.create("node","TeXAtom",[r]));try{for(var a=UD(["mathsize","mathcolor"]),s=a.next();!s.done;s=a.next()){var h=s.value;o[h]&&!r.attributes.getExplicit(h)&&(!r.isToken&&!r.isKind("mstyle")&&(r=this.create("node","mstyle",[r])),ZD.default.setAttribute(r,h,o[h]))}}catch(d){n={error:d}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r.isInferred&&(r=this.create("node","mrow",r.childNodes)),this.nodes.push(r)},t.prototype.addAttributes=function(r){var n,i,o=this.stack.env;if(r.isToken)try{for(var a=UD(["mathsize","mathcolor","mathvariant"]),s=a.next();!s.done;s=a.next()){var h=s.value;o[h]&&!r.attributes.getExplicit(h)&&ZD.default.setAttribute(r,h,o[h])}}catch(d){n={error:d}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}},t.prototype.ParseTextArg=function(r,n){var i=this.GetArgument(r);return n=Object.assign(Object.assign({},this.stack.env),n),new t(i,n,this.configuration).mml()},t.prototype.ParseArg=function(r){return new t(this.GetArgument(r),this.stack.env,this.configuration).mml()},t.prototype.Error=function(r,n){for(var i=[],o=2;o<arguments.length;o++)i[o-2]=arguments[o];throw new($D.default.bind.apply($D.default,DMt([void 0,r,n],BMt(i),!1)))},t}(FMt.default);nu.TextParser=GMt;var UMt=I&&I.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},$Mt=wr,w2=S1,ZMt=ll,WMt=UMt(Un()),qMt=nu;new $Mt.CommandMap("textcomp-macros",{textasciicircum:["Insert","^"],textasciitilde:["Insert","~"],textasteriskcentered:["Insert","*"],textbackslash:["Insert","\\"],textbar:["Insert","|"],textbraceleft:["Insert","{"],textbraceright:["Insert","}"],textbullet:["Insert","•"],textdagger:["Insert","†"],textdaggerdbl:["Insert","‡"],textellipsis:["Insert","…"],textemdash:["Insert","—"],textendash:["Insert","–"],textexclamdown:["Insert","¡"],textgreater:["Insert",">"],textless:["Insert","<"],textordfeminine:["Insert","ª"],textordmasculine:["Insert","º"],textparagraph:["Insert","¶"],textperiodcentered:["Insert","·"],textquestiondown:["Insert","¿"],textquotedblleft:["Insert","“"],textquotedblright:["Insert","”"],textquoteleft:["Insert","‘"],textquoteright:["Insert","’"],textsection:["Insert","§"],textunderscore:["Insert","_"],textvisiblespace:["Insert","␣"],textacutedbl:["Insert","˝"],textasciiacute:["Insert","´"],textasciibreve:["Insert","˘"],textasciicaron:["Insert","ˇ"],textasciidieresis:["Insert","¨"],textasciimacron:["Insert","¯"],textgravedbl:["Insert","˵"],texttildelow:["Insert","˷"],textbaht:["Insert","฿"],textcent:["Insert","¢"],textcolonmonetary:["Insert","₡"],textcurrency:["Insert","¤"],textdollar:["Insert","$"],textdong:["Insert","₫"],texteuro:["Insert","€"],textflorin:["Insert","ƒ"],textguarani:["Insert","₲"],textlira:["Insert","₤"],textnaira:["Insert","₦"],textpeso:["Insert","₱"],textsterling:["Insert","£"],textwon:["Insert","₩"],textyen:["Insert","¥"],textcircledP:["Insert","℗"],textcompwordmark:["Insert","‌"],textcopyleft:["Insert","🄯"],textcopyright:["Insert","©"],textregistered:["Insert","®"],textservicemark:["Insert","℠"],texttrademark:["Insert","™"],textbardbl:["Insert","‖"],textbigcircle:["Insert","◯"],textblank:["Insert","␢"],textbrokenbar:["Insert","¦"],textdiscount:["Insert","⁒"],textestimated:["Insert","℮"],textinterrobang:["Insert","‽"],textinterrobangdown:["Insert","⸘"],textmusicalnote:["Insert","♪"],textnumero:["Insert","№"],textopenbullet:["Insert","◦"],textpertenthousand:["Insert","‱"],textperthousand:["Insert","‰"],textrecipe:["Insert","℞"],textreferencemark:["Insert","※"],textlangle:["Insert","〈"],textrangle:["Insert","〉"],textlbrackdbl:["Insert","⟦"],textrbrackdbl:["Insert","⟧"],textlquill:["Insert","⁅"],textrquill:["Insert","⁆"],textcelsius:["Insert","℃"],textdegree:["Insert","°"],textdiv:["Insert","÷"],textdownarrow:["Insert","↓"],textfractionsolidus:["Insert","⁄"],textleftarrow:["Insert","←"],textlnot:["Insert","¬"],textmho:["Insert","℧"],textminus:["Insert","−"],textmu:["Insert","µ"],textohm:["Insert","Ω"],textonehalf:["Insert","½"],textonequarter:["Insert","¼"],textonesuperior:["Insert","¹"],textpm:["Insert","±"],textrightarrow:["Insert","→"],textsurd:["Insert","√"],textthreequarters:["Insert","¾"],textthreesuperior:["Insert","³"],texttimes:["Insert","×"],texttwosuperior:["Insert","²"],textuparrow:["Insert","↑"],textborn:["Insert","*"],textdied:["Insert","†"],textdivorced:["Insert","⚮"],textmarried:["Insert","⚭"],textcentoldstyle:["Insert","¢",w2.TexConstant.Variant.OLDSTYLE],textdollaroldstyle:["Insert","$",w2.TexConstant.Variant.OLDSTYLE],textzerooldstyle:["Insert","0",w2.TexConstant.Variant.OLDSTYLE],textoneoldstyle:["Insert","1",w2.TexConstant.Variant.OLDSTYLE],texttwooldstyle:["Insert","2",w2.TexConstant.Variant.OLDSTYLE],textthreeoldstyle:["Insert","3",w2.TexConstant.Variant.OLDSTYLE],textfouroldstyle:["Insert","4",w2.TexConstant.Variant.OLDSTYLE],textfiveoldstyle:["Insert","5",w2.TexConstant.Variant.OLDSTYLE],textsixoldstyle:["Insert","6",w2.TexConstant.Variant.OLDSTYLE],textsevenoldstyle:["Insert","7",w2.TexConstant.Variant.OLDSTYLE],texteightoldstyle:["Insert","8",w2.TexConstant.Variant.OLDSTYLE],textnineoldstyle:["Insert","9",w2.TexConstant.Variant.OLDSTYLE]},{Insert:function(e,t,r,n){if(e instanceof qMt.TextParser){if(!n){ZMt.TextMacrosMethods.Insert(e,t,r);return}e.saveText()}e.Push(WMt.default.internalText(e,r,n?{mathvariant:n}:{}))}}),Object.defineProperty(sx,"__esModule",{value:!0}),sx.TextcompConfiguration=void 0;var XMt=nn;sx.TextcompConfiguration=XMt.Configuration.create("textcomp",{handler:{macro:["textcomp-macros"]}});var iu={},qD=wr,qa=S1,XD=ll,X6=Fa;new qD.MacroMap("text-special",{$:"Math","%":"Comment","^":"MathModeOnly",_:"MathModeOnly","&":"Misplaced","#":"Misplaced","~":"Tilde"," ":"Space"," ":"Space","\r":"Space","\n":"Space"," ":"Tilde","{":"OpenBrace","}":"CloseBrace","`":"OpenQuote","'":"CloseQuote"},XD.TextMacrosMethods),new qD.CommandMap("text-macros",{"(":"Math",$:"SelfQuote",_:"SelfQuote","%":"SelfQuote","{":"SelfQuote","}":"SelfQuote"," ":"SelfQuote","&":"SelfQuote","#":"SelfQuote","\\":"SelfQuote","'":["Accent","´"],"’":["Accent","´"],"`":["Accent","`"],"‘":["Accent","`"],"^":["Accent","^"],'"':["Accent","¨"],"~":["Accent","~"],"=":["Accent","¯"],".":["Accent","˙"],u:["Accent","˘"],v:["Accent","ˇ"],emph:"Emph",rm:["SetFont",qa.TexConstant.Variant.NORMAL],mit:["SetFont",qa.TexConstant.Variant.ITALIC],oldstyle:["SetFont",qa.TexConstant.Variant.OLDSTYLE],cal:["SetFont",qa.TexConstant.Variant.CALLIGRAPHIC],it:["SetFont","-tex-mathit"],bf:["SetFont",qa.TexConstant.Variant.BOLD],bbFont:["SetFont",qa.TexConstant.Variant.DOUBLESTRUCK],scr:["SetFont",qa.TexConstant.Variant.SCRIPT],frak:["SetFont",qa.TexConstant.Variant.FRAKTUR],sf:["SetFont",qa.TexConstant.Variant.SANSSERIF],tt:["SetFont",qa.TexConstant.Variant.MONOSPACE],tiny:["SetSize",.5],Tiny:["SetSize",.6],scriptsize:["SetSize",.7],small:["SetSize",.85],normalsize:["SetSize",1],large:["SetSize",1.2],Large:["SetSize",1.44],LARGE:["SetSize",1.73],huge:["SetSize",2.07],Huge:["SetSize",2.49],Bbb:["Macro","{\\bbFont #1}",1],textnormal:["Macro","{\\rm #1}",1],textup:["Macro","{\\rm #1}",1],textrm:["Macro","{\\rm #1}",1],textit:["Macro","{\\it #1}",1],textbf:["Macro","{\\bf #1}",1],textsf:["Macro","{\\sf #1}",1],texttt:["Macro","{\\tt #1}",1],dagger:["Insert","†"],ddagger:["Insert","‡"],S:["Insert","§"],",":["Spacer",X6.MATHSPACE.thinmathspace],":":["Spacer",X6.MATHSPACE.mediummathspace],">":["Spacer",X6.MATHSPACE.mediummathspace],";":["Spacer",X6.MATHSPACE.thickmathspace],"!":["Spacer",X6.MATHSPACE.negativethinmathspace],enspace:["Spacer",.5],quad:["Spacer",1],qquad:["Spacer",2],thinspace:["Spacer",X6.MATHSPACE.thinmathspace],negthinspace:["Spacer",X6.MATHSPACE.negativethinmathspace],hskip:"Hskip",hspace:"Hskip",kern:"Hskip",mskip:"Hskip",mspace:"Hskip",mkern:"Hskip",rule:"rule",Rule:["Rule"],Space:["Rule","blank"],color:"CheckAutoload",textcolor:"CheckAutoload",colorbox:"CheckAutoload",fcolorbox:"CheckAutoload",href:"CheckAutoload",style:"CheckAutoload",class:"CheckAutoload",cssId:"CheckAutoload",unicode:"CheckAutoload",ref:["HandleRef",!1],eqref:["HandleRef",!0]},XD.TextMacrosMethods);var KMt=I&&I.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},ul;Object.defineProperty(iu,"__esModule",{value:!0}),iu.TextMacrosConfiguration=iu.TextBaseConfiguration=void 0;var lx=nn,YMt=KMt(Xd),KD=Ws,m4=yr,YD=nu,JMt=ll;iu.TextBaseConfiguration=lx.Configuration.create("text-base",{parser:"text",handler:{character:["command","text-special"],macro:["text-macros"]},fallback:{character:function(e,t){e.text+=t},macro:function(e,t){var r=e.texParser,n=r.lookup("macro",t);n&&n._func!==JMt.TextMacrosMethods.Macro&&e.Error("MathMacro","%1 is only supported in math mode","\\"+t),r.parse("macro",[e,t])}},items:(ul={},ul[m4.StartItem.prototype.kind]=m4.StartItem,ul[m4.StopItem.prototype.kind]=m4.StopItem,ul[m4.MmlItem.prototype.kind]=m4.MmlItem,ul[m4.StyleItem.prototype.kind]=m4.StyleItem,ul)});function tHt(e,t,r,n){var i=e.configuration.packageData.get("textmacros");return e instanceof YD.TextParser||(i.texParser=e),[new YD.TextParser(t,n?{mathvariant:n}:{},i.parseOptions,r).mml()]}iu.TextMacrosConfiguration=lx.Configuration.create("textmacros",{config:function(e,t){var r=new lx.ParserConfiguration(t.parseOptions.options.textmacros.packages,["tex","text"]);r.init();var n=new YMt.default(r,[]);n.options=t.parseOptions.options,r.config(t),KD.TagsFactory.addTags(r.tags),n.tags=KD.TagsFactory.getDefault(),n.tags.configuration=n,n.packageData=t.parseOptions.packageData,n.packageData.set("textmacros",{parseOptions:n,jax:t,texParser:null}),n.options.internalMath=tHt},preprocessors:[function(e){var t=e.data.packageData.get("textmacros");t.parseOptions.nodeFactory.setMmlFactory(t.jax.mmlFactory)}],options:{textmacros:{packages:["text-base"]}}});var cx={};Object.defineProperty(cx,"__esModule",{value:!0}),cx.UpgreekConfiguration=void 0;var eHt=nn,rHt=wr,nHt=S1;function iHt(e,t){var r=t.attributes||{};r.mathvariant=nHt.TexConstant.Variant.NORMAL;var n=e.create("token","mi",r,t.char);e.Push(n)}new rHt.CharacterMap("upgreek",iHt,{upalpha:"α",upbeta:"β",upgamma:"γ",updelta:"δ",upepsilon:"ϵ",upzeta:"ζ",upeta:"η",uptheta:"θ",upiota:"ι",upkappa:"κ",uplambda:"λ",upmu:"μ",upnu:"ν",upxi:"ξ",upomicron:"ο",uppi:"π",uprho:"ρ",upsigma:"σ",uptau:"τ",upupsilon:"υ",upphi:"ϕ",upchi:"χ",uppsi:"ψ",upomega:"ω",upvarepsilon:"ε",upvartheta:"ϑ",upvarpi:"ϖ",upvarrho:"ϱ",upvarsigma:"ς",upvarphi:"φ",Upgamma:"Γ",Updelta:"Δ",Uptheta:"Θ",Uplambda:"Λ",Upxi:"Ξ",Uppi:"Π",Upsigma:"Σ",Upupsilon:"Υ",Upphi:"Φ",Uppsi:"Ψ",Upomega:"Ω"}),cx.UpgreekConfiguration=eHt.Configuration.create("upgreek",{handler:{macro:["upgreek"]}});var oHt={};(function(e){var t=I&&I.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(e,"__esModule",{value:!0}),e.UnicodeConfiguration=e.UnicodeMethods=void 0;var r=nn,n=t(pn),i=wr,o=t(Un()),a=t(Gn),s=B8;e.UnicodeMethods={};var h={};e.UnicodeMethods.Unicode=function(d,f){var Q=d.GetBrackets(f),m=null,_=null;Q&&(Q.replace(/ /g,"").match(/^(\d+(\.\d*)?|\.\d+),(\d+(\.\d*)?|\.\d+)$/)?(m=Q.replace(/ /g,"").split(/,/),_=d.GetBrackets(f)):_=Q);var v=o.default.trimSpaces(d.GetArgument(f)).replace(/^0x/,"x");if(!v.match(/^(x[0-9A-Fa-f]+|[0-9]+)$/))throw new n.default("BadUnicode","Argument to \\unicode must be a number");var b=parseInt(v.match(/^x/)?"0"+v:v);h[b]?_||(_=h[b][2]):h[b]=[800,200,_,b],m&&(h[b][0]=Math.floor(parseFloat(m[0])*1e3),h[b][1]=Math.floor(parseFloat(m[1])*1e3));var M=d.stack.env.font,E={};_?(h[b][2]=E.fontfamily=_.replace(/'/g,"'"),M&&(M.match(/bold/)&&(E.fontweight="bold"),M.match(/italic|-mathit/)&&(E.fontstyle="italic"))):M&&(E.mathvariant=M);var O=d.create("token","mtext",E,(0,s.numeric)(v));a.default.setProperty(O,"unicode",!0),d.Push(O)},new i.CommandMap("unicode",{unicode:"Unicode"},e.UnicodeMethods),e.UnicodeConfiguration=r.Configuration.create("unicode",{handler:{macro:["unicode"]}})})(oHt);var aHt={};(function(e){var t=I&&I.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.VerbConfiguration=e.VerbMethods=void 0;var r=nn,n=S1,i=wr,o=t(pn);e.VerbMethods={},e.VerbMethods.Verb=function(a,s){var h=a.GetNext(),d=++a.i;if(h==="")throw new o.default("MissingArgFor","Missing argument for %1",s);for(;a.i<a.string.length&&a.string.charAt(a.i)!==h;)a.i++;if(a.i===a.string.length)throw new o.default("NoClosingDelim","Can't find closing delimiter for %1",a.currentCS);var f=a.string.slice(d,a.i).replace(/ /g," ");a.i++,a.Push(a.create("token","mtext",{mathvariant:n.TexConstant.Variant.MONOSPACE},f))},new i.CommandMap("verb",{verb:"Verb"},e.VerbMethods),e.VerbConfiguration=r.Configuration.create("verb",{handler:{macro:["verb"]}})})(aHt),Object.defineProperty(cL,"__esModule",{value:!0});var JD=cL.AllPackages=void 0;kD(),typeof MathJax<"u"&&MathJax.loader&&MathJax.loader.preLoad("[tex]/action","[tex]/ams","[tex]/amscd","[tex]/bbox","[tex]/boldsymbol","[tex]/braket","[tex]/bussproofs","[tex]/cancel","[tex]/cases","[tex]/centernot","[tex]/color","[tex]/colorv2","[tex]/colortbl","[tex]/empheq","[tex]/enclose","[tex]/extpfeil","[tex]/gensymb","[tex]/html","[tex]/mathtools","[tex]/mhchem","[tex]/newcommand","[tex]/noerrors","[tex]/noundefined","[tex]/physics","[tex]/upgreek","[tex]/unicode","[tex]/verb","[tex]/configmacros","[tex]/tagformat","[tex]/textcomp","[tex]/textmacros","[tex]/setoptions"),JD=cL.AllPackages=["base","action","ams","amscd","bbox","boldsymbol","braket","bussproofs","cancel","cases","centernot","color","colortbl","empheq","enclose","extpfeil","gensymb","html","mathtools","mhchem","newcommand","noerrors","noundefined","upgreek","unicode","verb","configmacros","tagformat","textcomp","textmacros"];const sHt=16,lHt=8,cHt=["svg a{fill:blue;stroke:blue}",'[data-mml-node="mstyle"]>rect[data-bgcolor="true"]{rx: 8%; ry: 12%}','[data-mml-node="merror"]>g{fill:red;stroke:red}','[data-mml-node="merror"]>rect[data-background]{fill:yellow;stroke:none}',"[data-frame],[data-line]{stroke-width:70px;fill:none}",".mjx-dashed{stroke-dasharray:140}",".mjx-dotted{stroke-linecap:round;stroke-dasharray:0,140}","use[data-c]{stroke-width:3px}"].join(""),tF=YN();AB(tF);const uHt=new wR({packages:JD}),hHt=new hxt.SVG({fontCache:"local"}),dHt=Bd.mathjax.document("",{InputJax:uHt,OutputJax:hHt});function pHt(e){const t=dHt.convert(e,{display:!1,em:2*sHt,ex:2*lHt});return tF.innerHTML(t).replace(/<defs>/,`<defs><style>${cHt}</style>`)}function eF(e,t,r){return e===null?[t[0]-r.lng,t[1]-r.lat,t[2]+r.lng,t[3]+r.lat]:[Math.min(e[0],t[0]-r.lng),Math.min(e[1],t[1]-r.lat),Math.max(e[2],t[2]+r.lng),Math.max(e[3],t[3]+r.lat)]}function THt(e){if(e.geometry.type==="Point")return e.geometry.coordinates;const t=e.geometry.coordinates,r="area"in e.properties?Math.sqrt(e.properties.area)/5e5:.1;return d6t(t,r)}function fHt(e){if(!("renderedLabel"in e)){const t="label"in e?e.label:"user_label"in e?e.user_label:"",r=t!==""?(t.substr(0,1).toUpperCase()+t.substr(1)).replaceAll(`
1709
1709
  `,"<br/>"):"";e.renderedLabel=r.replaceAll(/`\$([^\$]*)\$`/g,n=>pHt(n.slice(2,-2)))}return e.renderedLabel}var xi,ou,au,g4,K6,su,Uf,hl,lu,dl,cu,pl,uu,$f,ux;class QHt{constructor(t){$e(this,g4),$e(this,su),$e(this,hl),$e(this,dl),$e(this,pl),$e(this,$f),$e(this,xi,null),$e(this,ou,9e5),$e(this,au,null),this._flatmap=t,this._map=t.map,this._activeFeatures=new Set,this._selectedFeatureIds=new Map,this._currentPopup=null,this._infoControl=null,this._tooltip=null,this._inQuery=!1,this._modal=!1,this.__colourOptions={colour:!0,outline:!0},this.__activeMarker=null,this.__markerIdByMarker=new Map,this.__markerIdByFeatureId=new Map,this.__annotationByMarkerId=new Map,this.__markerPositions=new Map,t.setInitialPosition(),this.__featureEnabledCount=new Map(Array.from(this._flatmap.annotations.keys()).map(i=>[+i,0]));const r=t.options.style!=="functional";this.__pathManager=new L6t(t,this,r);const n=this.__pathManager.pathTypes();this._layerManager=new SQt(t,this),this.__pathManager.enablePathLines(!0,!0);for(const i of n)this.__pathManager.enablePathsByType(i.type,i.enabled,!0);if(this.__pathManager.haveCentrelines&&this.enableCentrelines(this.__pathManager.enabledCentrelines,!0),this.__systemsManager=new CQt(this._flatmap,this,r),this.__enabledConnectivityTaxons=new Set(this._flatmap.taxonIdentifiers),t.options.minimap&&(Qr(this,au,new UQt(t,t.options.minimap)),this._map.addControl(kt(this,au))),t.options.fullscreenControl===!0&&this._map.addControl(new no.FullscreenControl,"top-right"),t.options.navigationControl){const i=t.options.navigationControl,o=typeof i=="string"&&["top-left","top-right","bottom-right","bottom-left"].includes(i)?i:"bottom-right";this._map.addControl(new NavigationControl(t),o)}t.options.standalone&&(this._map.addControl(new zQt(t)),this._infoControl=new OQt(t),this._map.addControl(this._infoControl),this._map.addControl(new NQt(t)),this._map.addControl(new FQt(t,n)),this._map.addControl(new VQt(t,this._layerManager)),this.__pathManager.haveCentrelines&&this._map.addControl(new IQt(t,this._layerManager,{showCentrelines:!1})),t.options.style==="functional"?(this._map.addControl(new $Qt(t,this.__systemsManager.systems)),this._map.addControl(new PQt(t,t.options.layerOptions))):this._map.addControl(new ZQt(t)),t.has_flightpaths&&this._map.addControl(new jQt(this,t.options.flightPaths)),t.options.annotator&&this._map.addControl(new RQt(t))),this.__setupAnnotation(),Qr(this,xi,new DQt(t,!1)),this._map.addControl(kt(this,xi)),t.options.flightPaths===!0&&this._layerManager.setFlightPathMode(!0),this._map.on("click",this.clickEvent_.bind(this)),this._map.on("touchend",this.clickEvent_.bind(this)),this._map.on("mousemove",this.mouseMoveEvent_.bind(this)),this._lastFeatureMouseEntered=null,this._lastFeatureModelsMouse=null,this.__lastClickLngLat=null,this._map.on("move",this.panZoomEvent_.bind(this,"pan")),this._map.on("zoom",this.panZoomEvent_.bind(this,"zoom")),this.__pan_zoom_enabled=!1}get minimap(){return kt(this,au)}get pathManager(){return this.__pathManager}getState(){return{center:this._map.getCenter().toArray(),zoom:this._map.getZoom(),bearing:this._map.getBearing(),pitch:this._map.getPitch()}}setState(t){const r=Object.assign({},t);"zoom"in r&&("center"in r?r.around=r.center:r.around=[0,0]),Object.keys(r).length>0&&this._map.jumpTo(r)}showAnnotator(t=!0){kt(this,xi)&&kt(this,xi).show(t)}commitAnnotationEvent(t){kt(this,xi)&&kt(this,xi).commitEvent(t)}abortAnnotationEvent(t){kt(this,xi)&&kt(this,xi).abortEvent(t)}rollbackAnnotationEvent(t){kt(this,xi)&&kt(this,xi).rollbackEvent(t)}clearAnnotationFeatures(){kt(this,xi)&&kt(this,xi).clearFeatures()}removeAnnotationFeature(){kt(this,xi)&&kt(this,xi).removeFeature()}addAnnotationFeature(t){kt(this,xi)&&kt(this,xi).addFeature(t)}refreshAnnotationFeatureGeometry(t){if(kt(this,xi))return kt(this,xi).refreshGeometry(t)}changeAnnotationDrawMode(t){kt(this,xi)&&kt(this,xi).changeMode(t)}__setupAnnotation(){this.__featureIdToMapId=new Map([...this._flatmap.annotations.entries()].map(t=>[t[1].id,t[0]]));for(const t of this.__featureIdToMapId.values()){const r=this.mapFeature(t);r!==void 0&&this._map.setFeatureState(r,{"map-annotation":!0})}}setFeatureAnnotated(t){const r=this.__featureIdToMapId.get(t);if(r){const n=this.mapFeature(r);n!==void 0&&this._map.setFeatureState(n,{annotated:!0})}}setPaint(t){this.__colourOptions=t,lr(this,g4,K6).call(this,t)}getLayers(){return this._layerManager.layers}enableLayer(t,r=!0){this._layerManager.activate(t,r)}enableFlightPaths(t=!0){this._layerManager.setFlightPathMode(t)}getSystems(){return this.__systemsManager.systems}enableSystem(t,r=!0){this.__systemsManager.enable(t,r)}mapFeature(t){const r=this._flatmap.annotation(t);if(r!==void 0)return{id:t,source:Uy,sourceLayer:(this._flatmap.options.separateLayers?`${r.layer}_${r["tile-layer"]}`:r["tile-layer"]).replaceAll("/","_"),children:r.children||[]}}getFeatureState(t){const r=this.mapFeature(t);if(r){const n=this._map.getFeatureState(r);if(Object.keys(n).length)return n}}enableMapFeature(t,r=!0){if(t!==void 0){const n=lr(this,hl,lu).call(this,t);"hidden"in n?r?lr(this,dl,cu).call(this,t,"hidden"):n.hidden||lr(this,pl,uu).call(this,t,{hidden:!0}):r||lr(this,pl,uu).call(this,t,{hidden:!0}),this.__enableFeatureMarker(t.id,r)}}enableFeature(t,r=!0,n=!1){const i=this.__featureEnabledCount.get(+t);(n||r&&i===0||!r&&i==1)&&this.enableMapFeature(this.mapFeature(t),r),n?this.__featureEnabledCount.set(+t,r?1:0):this.__featureEnabledCount.set(+t,i+(r?1:-1))}enableFeatureWithChildren(t,r=!0,n=!1){const i=this.mapFeature(t);if(i!==void 0){this.enableFeature(t,r,n);for(const o of i.children)this.enableFeatureWithChildren(o,r,n)}}__enableFeatureMarker(t,r=!0){const n=this.__markerIdByFeatureId.get(+t);if(n!==void 0){const i=document.getElementById(`marker-${n}`);i&&(i.style.visibility=r?"visible":"hidden")}}__featureEnabled(t){if(t.id){const r=lr(this,hl,lu).call(this,t);return r!==void 0&&(!("hidden"in r)||!r.hidden)}return jv.includes(t.layer.id)}featureSelected_(t){return this._selectedFeatureIds.has(+t)}selectFeature(t,r=!0){const n=this._flatmap.annotation(t);if(n&&"sckan"in n){const a=this._layerManager.sckanState;if(a==="none"||a==="valid"&&!n.sckan||a==="invalid"&&n.sckan)return!1}t=+t;let i=!1;const o=this._selectedFeatureIds.size===0;if(this._selectedFeatureIds.has(t))this._selectedFeatureIds.set(t,this._selectedFeatureIds.get(t)+1),i=!0;else{const a=this.mapFeature(t);if(a!==void 0){const s=lr(this,hl,lu).call(this,a);s!==void 0&&(!("hidden"in s)||!s.hidden)&&(lr(this,pl,uu).call(this,a,{selected:!0}),this._selectedFeatureIds.set(t,1),i=!0)}}return i&&o&&lr(this,g4,K6).call(this,{...this.__colourOptions,dimmed:r}),i}unselectFeature(t){if(t=+t,this._selectedFeatureIds.has(t)){const r=this._selectedFeatureIds.get(t);if(r>1)this._selectedFeatureIds.set(t,r-1);else{const n=this.mapFeature(t);n!==void 0&&(lr(this,dl,cu).call(this,n,"selected"),this._selectedFeatureIds.delete(+t))}}this._selectedFeatureIds.size===0&&lr(this,g4,K6).call(this,{...this.__colourOptions,dimmed:!1})}unselectFeatures(){for(const t of this._selectedFeatureIds.keys()){const r=this.mapFeature(t);r!==void 0&&lr(this,dl,cu).call(this,r,"selected")}this._selectedFeatureIds.clear(),lr(this,g4,K6).call(this,{...this.__colourOptions,dimmed:!1})}activateFeature(t){t!==void 0&&(lr(this,pl,uu).call(this,t,{active:!0}),this._activeFeatures.add(t))}activateLineFeatures(t){for(const r of t){+r.properties.featureId,this.activateFeature(r);const n=new Set(t.map(i=>i.properties.featureId));for(const i of this.__pathManager.lineFeatureIds(n))this.activateFeature(this.mapFeature(i))}}resetActiveFeatures_(){for(const t of this._activeFeatures)lr(this,dl,cu).call(this,t,"active");this._activeFeatures.clear()}smallestAnnotatedPolygonFeature_(t){let r=0,n=null;for(const i of t)if(i.geometry.type.includes("Polygon")&&lr(this,hl,lu).call(this,i)["map-annotation"]){const o=G4t(i.geometry.type,i.geometry.coordinates),a=Y4t(o);(n===null||r>a)&&(n=i,r=a)}return n}setModal_(t){this._modal=!0}__clearModal(t){this._modal=!1}reset(){this.__clearModal(),this.__clearActiveMarker(),this.unselectFeatures()}clearSearchResults(t=!0){this.unselectFeatures()}selectFeatures(t){if(t.length){this.unselectFeatures();for(const r of t){const n=this._flatmap.annotation(r);if(n&&this.selectFeature(r)&&"type"in n&&n.type.startsWith("line"))for(const i of this.__pathManager.lineFeatureIds([r]))this.selectFeature(i)}}}showSearchResults(t){this.unselectFeatures(),this.zoomToFeatures(t,{noZoomIn:!0})}zoomToFeatures(t,r=null){if(r=l6(r,{noZoomIn:!1,padding:10}),t.length){this.unselectFeatures();let n=null;if(r.noZoomIn){const o=this._map.getBounds().toArray();n=[...o[0],...o[1]]}const i=this._map.unproject({x:r.padding,y:r.padding});i.lng-=n[0],i.lat=n[3]-i.lat;for(const o of t){const a=this._flatmap.annotation(o);if(a&&this.selectFeature(o)&&(n=eF(n,a.bounds,i),"type"in a&&a.type.startsWith("line"))){for(const s of this.__pathManager.lineFeatureIds([o]))if(this.selectFeature(s)){const h=this._flatmap.annotation(s);n=eF(n,h.bounds,i)}}}n!==null&&this._map.fitBounds(n,{padding:0,animate:!1})}}showPopup(t,r,n={}){const i=this._flatmap.annotation(t),o=n&&n.annotationFeatureGeometry;if(i||o){this._currentPopup&&(n&&n.preserveSelection&&(this._currentPopup.options.preserveSelection=n.preserveSelection),this._currentPopup.remove()),n&&n.preserveSelection?delete n.preserveSelection:this.unselectFeatures(),this.selectFeature(t);let a=null;"positionAtLastClick"in n&&n.positionAtLastClick&&this.__lastClickLngLat!==null?a=this.__lastClickLngLat:o?a=n.annotationFeatureGeometry:a=this.markerPosition(t,i),this._map.getBounds().contains(a)||this._map.panTo(a),this.setModal_(),this._currentPopup=new no.Popup(n).addTo(this._map),this._currentPopup.on("close",this.__onCloseCurrentPopup.bind(this)),o&&this._currentPopup.on("close",this.abortAnnotationEvent.bind(this)),this._currentPopup.setLngLat(a),typeof r=="object"?this._currentPopup.setDOMContent(r):this._currentPopup.setText(r)}}__onCloseCurrentPopup(){this._currentPopup&&(this.__clearModal(),this._currentPopup.options&&this._currentPopup.options.preserveSelection||this.unselectFeatures(),this._currentPopup=null)}removeTooltip_(){this._tooltip&&(this._tooltip.remove(),this._tooltip=null)}lineTooltip_(t){const r=[];for(const n of t){const i=n.properties;if("error"in i&&r.push(`<div class="feature-error">Error: ${i.error}</div>`),"warning"in i&&r.push(`<div class="feature-error">Warning: ${i.warning}</div>`),"label"in i&&(!("tooltip"in i)||i.tooltip)){const o=i.label,a=(o.substr(0,1).toUpperCase()+o.substr(1)).replaceAll(`
1710
1710
  `,"<br/>");r.includes(a)||r.push(a)}}return r.length===0?"":`<div class='flatmap-feature-label'>${r.join("<hr/>")}</div>`}tooltipHtml_(t,r=!1){const n=[];if("error"in t&&n.push(`<div class="feature-error">Error: ${t.error}</div>`),"warning"in t&&n.push(`<div class="feature-error">Warning: ${t.warning}</div>`),("label"in t||"hyperlink"in t||"user_label"in t)&&(r||!("tooltip"in t)||t.tooltip)){const i=fHt(t);"hyperlink"in t?i===""?n.push(`<a href='${t.hyperlink}'>${t.hyperlink}</a>`):n.push(`<a href='${t.hyperlink}'>${i}</a></div>`):n.push(i)}return n.length===0?"":`<div class='flatmap-feature-label'>${n.join("<hr/>")}</div>`}__featureEvent(t,r){return Bv(r)?this._flatmap.markerEvent(t,r.id,r.properties):r.sourceLayer===f2?this._flatmap.featureEvent(t,this.__pathManager.pathProperties(r)):"properties"in r?this._flatmap.featureEvent(t,r.properties):!1}__resetFeatureDisplay(){this.removeTooltip_(),this._map.getCanvas().style.cursor="default",this.resetActiveFeatures_()}mouseMoveEvent_(t){if(this._modal)return;this.__resetFeatureDisplay();const r=this._infoControl&&this._infoControl.active;r&&this._infoControl.reset();const n=lr(this,$f,ux).call(this,t.point);if(n.length===0){this._lastFeatureMouseEntered=null,this._lastFeatureModelsMouse=null;return}const i=n[0],o=Bv(i)?i.id:i.properties.featureId,a="properties"in i&&"models"in i.properties?i.properties.models:null;this._lastFeatureMouseEntered!==o&&(this._lastFeatureModelsMouse===null||this._lastFeatureModelsMouse!==a)&&(this.__featureEvent("mouseenter",i)?(this._lastFeatureMouseEntered=o,this._lastFeatureModelsMouse=a):(this._lastFeatureMouseEntered=null,this._lastFeatureModelsMouse=null));let s="",h="";r&&("tooltip"in n[0].properties||this.activateFeature(n[0]),s=this._infoControl.featureInformation(n,t.lngLat));const d=n.filter(Q=>"centreline"in Q.properties||"type"in Q.properties&&Q.properties.type.startsWith("line"));let f=null;if(d.length>0)h=this.lineTooltip_(d),f=d[0],this.activateLineFeatures(d);else{let Q=n.filter(m=>("hyperlink"in m.properties||"label"in m.properties||"user_label"in m.properties)&&(!("tooltip"in m.properties)||m.properties.tooltip)).sort((m,_)=>m.properties.area-_.properties.area);if(Q.length>0){const m=this._map.getZoom(),_=Q.filter(b=>b.properties.group&&m<b.properties.scale+1);_.length>0&&(Q=_);const v=Q[0];if(v.properties.user_drawn&&(v.id=v.properties.id),h=this.tooltipHtml_(v.properties),f=v,this._flatmap.options.debug){const b=["featureId","nerveId","tile-layer","type",...Dv],M=[],E=[];for(const O of Q)if(!E.includes(O.id)){E.push(O.id);for(const V of b)V in O.properties&&(M.push(`<span class="info-name">${V}:</span>`),M.push(`<span class="info-value">${O.properties[V]}</span>`))}this._flatmap.options.debug||(s=`<div id="info-control-info">${M.join(`
1711
- `)}</div>`)}this.activateFeature(v),this.__activateRelatedFeatures(v),"hyperlink"in v.properties&&(this._map.getCanvas().style.cursor="pointer")}}s!==""&&this._infoControl.show(s),this.__showToolTip(h,t.lngLat,f)}__showToolTip(t,r,n=null){if(t!==""||this._flatmap.options.showId&&n!==null){let i="";if(this._flatmap.options.showPosition){const o=MA(r.toArray()),a=r6t(o).geometry.coordinates;i=n===null?JSON.stringify(a):`${JSON.stringify(a)} (${n.id})`}this._flatmap.options.showId&&n!==null&&"id"in n.properties&&(i=`${i} ${n.properties.id}`),i!==""&&(t=`<span>${i}</span><br/>${t}`),t!==""&&(this._tooltip=new no.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none",className:"flatmap-tooltip-popup"}),this._tooltip.setLngLat(r).setHTML(t).addTo(this._map))}}selectionEvent_(t,r){if(r!==void 0){const n=+r.id,i=!("properties"in r&&"kind"in r.properties&&["cell-type","scaffold","tissue"].includes(r.properties.kind));if(t.ctrlKey||t.metaKey){const o=this.featureSelected_(n);for(const a of this._activeFeatures)o?this.unselectFeature(a.id):this.selectFeature(a.id,i)}else{let o=!0;for(const a of this._selectedFeatureIds.keys())if(a===n){o=!1;break}if(this.unselectFeatures(),o)for(const a of this._activeFeatures)this.selectFeature(a.id,i)}}}clickEvent_(t){if(this._modal)return;this.__clearActiveMarker();const r=lr(this,$f,ux).call(this,t.point);if(r.length==0){this.unselectFeatures();return}const n=r.filter(o=>!o.id),i=r.filter(o=>o.id)[0];if(this.selectionEvent_(t.originalEvent,i),this._modal)this.__resetFeatureDisplay(),this.unselectFeatures(),this.__clearModal();else if(n.length>0){const o=n.filter(s=>s.source==="mapbox-gl-draw-cold")[0],a=n.filter(s=>s.source==="mapbox-gl-draw-hot")[0];this.__featureEvent("click",o||i||a)}else i&&(this.__lastClickLngLat=t.lngLat,this.__featureEvent("click",i),"properties"in i&&"hyperlink"in i.properties&&window.open(i.properties.hyperlink,"_blank"))}__activateRelatedFeatures(t){if("nerveId"in t.properties){const r=t.properties.nerveId;r!==t.id&&this.activateFeature(this.mapFeature(r));for(const n of this.__pathManager.nerveFeatureIds(r))this.activateFeature(this.mapFeature(n))}if("nodeId"in t.properties)for(const r of this.__pathManager.pathFeatureIds(t.properties.nodeId))this.activateFeature(this.mapFeature(r))}clearVisibilityFilter(){this._layerManager.clearVisibilityFilter()}setVisibilityFilter(t=!0){this._layerManager.setVisibilityFilter(new H8(t))}enablePathsBySystem(t,r=!0,n=!1){this.__pathManager.enablePathsBySystem(t,r,n)}enablePathsByType(t,r=!0){this.__pathManager.enablePathsByType(t,r)}pathFeatureIds(t){const r=new Qh;return r.extend(this.__pathManager.connectivityModelFeatureIds(t)),r.extend(this.__pathManager.pathModelFeatureIds(t)),r}pathModelNodes(t){return this.__pathManager.pathModelNodes(t)}nodePathModels(t){return this.__pathManager.nodePathModels(t)}enableCentrelines(t=!0,r=!1){this.__pathManager.enablePathsByType("centreline",t,r),lr(this,g4,K6).call(this,{showCentrelines:t})}enableSckanPaths(t,r=!0){this._layerManager.enableSckanPaths(t,r)}enableConnectivityByTaxonIds(t,r=!0){if(r)for(const n of t)this.__enabledConnectivityTaxons.add(n);else for(const n of t)this.__enabledConnectivityTaxons.delete(n);this._layerManager.setFilter({taxons:[...this.__enabledConnectivityTaxons.values()]})}excludeAnnotated(t=!1){lr(this,g4,K6).call(this,{excludeAnnotated:t})}markerPosition(t,r){if(this.__markerPositions.has(t))return this.__markerPositions.get(t);let n=r.markerPosition||r.centroid;if(n===null||n==null){const i=this._map.querySourceFeatures(Uy,{sourceLayer:this._flatmap.options.separateLayers?`${r.layer}_${r["tile-layer"]}`:r["tile-layer"],filter:["all",["==",["id"],parseInt(t)],["==",["geometry-type"],"Polygon"]]});i.length>0&&(n=THt(i[0]))}return this.__markerPositions.set(t,n),n}nextMarkerId(){return Qr(this,ou,kt(this,ou)+1),kt(this,ou)}addMarker(t,r={}){const n=this._flatmap.modelFeatureIds(t);let i=-1;for(const o of n){const a=this._flatmap.annotation(o);if(!(!("markerPosition"in a)&&!a.geometry.includes("Polygon"))&&!("marker"in a)){i===-1&&(i=this.nextMarkerId());const s=r.colour||"#005974",h=r.element?new no.Marker({element:r.element}):new no.Marker({color:s,scale:.5}),d=document.createElement("div"),f=document.createElement("div");f.innerHTML=h.getElement().innerHTML,d.id=`marker-${i}`,d.appendChild(f);const Q={element:d};"className"in r&&(Q.className=r.className);const m=this.markerPosition(o,a);if(r.cluster&&this._layerManager)this._layerManager.addMarker(i,m,a);else{const _=new no.Marker(Q).setLngLat(m).addTo(this._map);d.addEventListener("mouseenter",this.markerMouseEvent_.bind(this,_,t)),d.addEventListener("mousemove",this.markerMouseEvent_.bind(this,_,t)),d.addEventListener("mouseleave",this.markerMouseEvent_.bind(this,_,t)),d.addEventListener("click",this.markerMouseEvent_.bind(this,_,t)),this.__markerIdByMarker.set(_,i),this.__markerIdByFeatureId.set(+o,i),this.__annotationByMarkerId.set(i,a),this.__featureEnabled(this.mapFeature(+o))||(d.style.visibility="hidden")}}}return i===-1&&console.warn(`Unable to find feature '${t}' on which to place marker`),i}clearMarkers(){this._layerManager&&this._layerManager.clearMarkers();for(const t of this.__markerIdByMarker.keys())t.remove();this.__markerIdByMarker.clear(),this.__annotationByMarkerId.clear()}removeMarker(t){for(const[r,n]of this.__markerIdByMarker.entries())if(t===n){r.remove(),this.__markerIdByMarker.remove(r),this.__annotationByMarkerId.remove(n);break}}addDatasetMarkers(t){if(this._layerManager)return this._layerManager.addDatasetMarkers(t)}clearDatasetMarkers(){this._layerManager&&this._layerManager.clearDatasetMarkers()}removeDatasetMarker(t){this._layerManager&&this._layerManager.removeDatasetMarker(markedatasetIdrId)}visibleMarkerAnatomicalIds(){const t=[],r=this._map.getBounds();for(const[n,i]of this.__markerIdByMarker.entries())if(r.contains(n.getLngLat())){const o=this.__annotationByMarkerId.get(i);t.includes(o.models)||t.push(o.models)}return t}markerMouseEvent_(t,r,n){if(!(this._modal||this.__activeMarker!==null&&n.type==="mouseleave")&&["mouseenter","mousemove","click"].includes(n.type)){this.__activeMarker=t,t.setPopup(null),t.getElement().style.cursor="default";const i=this.__markerIdByMarker.get(t),o=this.__annotationByMarkerId.get(i);this.markerEvent_(n,i,t.getLngLat(),o),n.stopPropagation()}}markerEvent_(t,r,n,i){if(["mousemove","click"].includes(t.type)&&(this.removeTooltip_(),["mouseenter","mousemove","click"].includes(t.type))){const o=this.mapFeature(i.featureId);o!==void 0&&(t.type==="mouseenter"?(this.resetActiveFeatures_(),this.activateFeature(o)):this.selectionEvent_(t,o));const a=this.tooltipHtml_(i,!0);this.__showToolTip(a,n),this._flatmap.markerEvent(t.type,r,i)}}__clearActiveMarker(){this.__activeMarker!==null&&(this.__activeMarker.setPopup(null),this.__activeMarker=null)}showMarkerPopup(t,r,n){const i=this.__activeMarker;if(t!==this.__markerIdByMarker.get(i))return this.__clearActiveMarker(),!1;const o=i.getLngLat();this._map.getBounds().contains(o)||this._map.panTo(o);const a=document.createElement("div");return typeof r=="object"?a.appendChild(r):a.innerHTML=r,a.addEventListener("click",s=>this.__clearActiveMarker()),this._tooltip=new no.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none",className:"flatmap-marker-popup"}),this._tooltip.setLngLat(o).setDOMContent(a),i.setPopup(this._tooltip),i.togglePopup(),!0}enablePanZoomEvents(t=!0){this.__pan_zoom_enabled=t}panZoomEvent_(t){this.__pan_zoom_enabled&&this._flatmap.panZoomEvent(t)}}xi=new WeakMap,ou=new WeakMap,au=new WeakMap,g4=new WeakSet,K6=function(e){this._layerManager.setPaint(e)},su=new WeakSet,Uf=function(e){return Bv(e)?this.mapFeature(e.properties.featureId):e},hl=new WeakSet,lu=function(e){return e=lr(this,su,Uf).call(this,e),this._map.getFeatureState(e)},dl=new WeakSet,cu=function(e,t){e=lr(this,su,Uf).call(this,e),this._map.removeFeatureState(e,t),this._layerManager.removeFeatureState(e,t)},pl=new WeakSet,uu=function(e,t){e=lr(this,su,Uf).call(this,e),this._map.setFeatureState(e,t),this._layerManager.setFeatureState(e,t)},$f=new WeakSet,ux=function(e){return this._layerManager.featuresAtPoint(e).filter(t=>this.__featureEnabled(t))};const mHt=[{id:"label-background",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAAAmCAIAAADbSlUzAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAJOgAACToAYJjBRwAAACVSURBVFhH7dixDoJAEIThfXqMBcYKrTQ+jkYSStDYkVhZINxyEshJcZXJtC7FfNlmur9eyXb7Vqf6+bI9HUKyWkt5e4RlOF9ycerjsqbqpfefuKzNJawBWIOxBmMNxhqMNRhrMNZgrMFYg7EGYw3GGow1GGuw5dU07y4ua22nUlb3uKxd80IOx1Pjxp+f4P/P+ZButl+YrbXnPs+YmAAAAABJRU5ErkJggg==",options:{content:[21,4,28,33],stretchX:[[21,28]],stretchY:[[4,33]]}},{id:"xlabel-background",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAmCAYAAAD9XArwAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/TSotUROwg4pChioIFURFHrUIRKoRaoVUHk0s/hCYNSYqLo+BacPBjserg4qyrg6sgCH6AODk6KbpIif9LCi1iPTjux7t7j7t3gFArMc0KjAGabpupRFzMZFfE4CsC6EEIIxiWmWXMSlISbcfXPXx8vYvxrPbn/hxdas5igE8knmGGaROvE09t2gbnfeIIK8oq8TnxqEkXJH7kuuLxG+eCywLPjJjp1BxxhFgstLDSwqxoasSTxFFV0ylfyHisct7irJUqrHFP/sJwTl9e4jrNASSwgEVIEKGggg2UYCNGq06KhRTtx9v4+12/RC6FXBtg5JhHGRpk1w/+B7+7tfIT415SOA50vDjOxyAQ3AXqVcf5Pnac+gngfwau9Ka/XAOmP0mvNrXoEdC9DVxcNzVlD7jcAfqeDNmUXclPU8jngfcz+qYs0HsLdK56vTX2cfoApKmr5A1wcAgMFSh7rc27Q629/Xum0d8PfM1yq13h+DEAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfkBBEJExO2pF7NAAAAqUlEQVQ4y+3OIQ6CYBiH8ef9MDhxc8yABjeP4LwAx3BWTwE3oHkMrBa7JJN3YBogfQkjr0HcDCg0C0/+7f2/AjghycLFj0ECYMarHPRcUoQx25uEJMsR/lUQj4YUtQ+K9aC+1IgABPFc/NjUcy1JYD5++tXM0LEe9rCHPfwXzDu43ChV2qaUKjWWLFLUfkdqLVnkXDiWK4LDkMlckCkwfs8p1cmSbfbs7k+jIi/gASaPYQAAAABJRU5ErkJggg==",options:{content:[4,4,5,33],stretchX:[[4,5]],stretchY:[[4,33]]}},{id:"ylabel-background",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAmCAYAAAD9XArwAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/TSotUROwg4pChioIFURFHrUIRKoRaoVUHk0s/hCYNSYqLo+BacPBjserg4qyrg6sgCH6AODk6KbpIif9LCi1iPTjux7t7j7t3gFArMc0KjAGabpupRFzMZFfE4CsC6EEIIxiWmWXMSlISbcfXPXx8vYvxrPbn/hxdas5igE8knmGGaROvE09t2gbnfeIIK8oq8TnxqEkXJH7kuuLxG+eCywLPjJjp1BxxhFgstLDSwqxoasSTxFFV0ylfyHisct7irJUqrHFP/sJwTl9e4jrNASSwgEVIEKGggg2UYCNGq06KhRTtx9v4+12/RC6FXBtg5JhHGRpk1w/+B7+7tfIT415SOA50vDjOxyAQ3AXqVcf5Pnac+gngfwau9Ka/XAOmP0mvNrXoEdC9DVxcNzVlD7jcAfqeDNmUXclPU8jngfcz+qYs0HsLdK56vTX2cfoApKmr5A1wcAgMFSh7rc27Q629/Xum0d8PfM1yq13h+DEAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfkBBEJEyeXEKp4AAAAwklEQVQ4y+3ULU/DUBhA4XO/2rUgwV1ZBWLJBP9fI0gQuMktWcJSwUq79n68qAoSGnCYHv3oowBD09jz88t1CpGcBQCtFYWz3D3tNuz3EXgojqdWLt0gKWWZSynLpRvkeGqFpinVuf2QsnDc3mz4qe7zyjgF9BQidVWyVF2VTCGicxa0VotQa0XOguaPrXCFK1zhv8D5VkvNt9POGvphXIT9MOKsAbyvfl2z95UCCrw3769vfYjp2+ydNdxvH2sOh/QFh8F7PWWiL5EAAAAASUVORK5CYII=",options:{content:[4,4,5,33],stretchX:[[4,5]],stretchY:[[4,33]]}},{id:"rounded-rectangle",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAGmSURBVDiNldPBitpAGAfwv5mMmy85JCistD5Ai/gCPYovYJENCPZQF8VD36HXUkrfQws9R8WLF58gh2h2W2PpoeTWxBgzMr1spd3uUvOHOQ2//3yHb4C/UyGi95Zl3XLOUwASgFRVNTVN8ysRfQTwFA+FMdYhoqjf7+9ns5kMgkCGYSjDMJTb7VbO53M5HA4PRBRzzl//g8vlcrxYLE7osbNcLmWlUok459cAULgb+2YymRi1Wu3B6e7H9300Go1dkiTPGRG97Xa7LzqdjnqWBlAqlRBFEVzXNZRisXhl2/bFufh3bNvmAF4WOOd73/cvDMPIVSCEQLVaFUqWZbkxAKiqCsaYVHLLe1E452kcx7mhEALH47Gg6Lr+3fO83AXr9Rq6rofK4XD4NB6P07wFo9Eok1J+LgC41DTt1nEco16vn4VXqxWazeYuSZJnCoAfWZZdt9vtneu6/8We56HVasVCiDcAvp0uGGM2Ef3s9Xp7x3HkZrM57X8QBHI6ncrBYJASUcQYe/XYA5eapr2zLOuGc77H3XfmnKemaX4hog8AnvwJfgHMKs1jQ++4tQAAAABJRU5ErkJggg==",options:{content:[3,3,13,13],stretchX:[[7,9]],stretchY:[[7,9]]}}],gHt="2.8.8",yHt=1.4,_Ht=1.6,rF="NCBITaxon:2787823",vHt=["bounds","class","featureId","geometry","id","label","layer","markerPosition","name","nerveId","nodeId","pathStartPosition","pathEndPosition","source","tile-layer"];var hu,du,Zf,Tl,Wf,hx;class bHt{constructor(t,r,n,i){$e(this,Wf),$e(this,hu,void 0),$e(this,du,void 0),$e(this,Zf,new _5t),$e(this,Tl,new Map),Qr(this,du,r),Qr(this,hu,r.url()),this.__id=n.id,this.__uuid=n.uuid,this.__details=n.details,this.__provenance=n.provenance,this.__created=n.created,this.__taxon=n.taxon,this.__biologicalSex=n.biologicalSex,this._mapNumber=n.number,this._callback=n.callback,this._layers=n.layers,this._markers=n.markers,this._options=n.options,this._pathways=n.pathways,this._resolve=i,this._map=null,this.__searchIndex=new j4t(this),this.__idToAnnotation=new Map,this.__datasetToFeatureIds=new Map,this.__modelToFeatureIds=new Map,this.__mapSourceToFeatureIds=new Map,this.__annIdToFeatureId=new Map,this.__taxonToFeatureIds=new Map,this.__featurePropertyValues=new Map;for(const[a,s]of Object.entries(n.annotations))this.__addAnnotation(a,s),this.__searchIndex.indexMetadata(a,s);for(const[a,s]of Object.entries(n.style.sources))if(s.url&&(s.url=this.makeServerUrl(s.url)),s.tiles){const h=[];for(const d of s.tiles)h.push(this.makeServerUrl(d));s.tiles=h}"images"in n.options||(n.options.images=[]);for(const a of mHt){let s=!1;for(const h of n.options.images)if(a.id===h.id){s=!0;break}s||n.options.images.push(a)}const o={style:n.style,container:t,attributionControl:!1};"maxZoom"in n.options&&(o.maxZoom=n.options.maxZoom),"minZoom"in n.options&&(o.minZoom=n.options.minZoom),o.hash=n.options.debug===!0,this._map=new no.Map(o),n.options.debug===!0&&(this._map.showTileBoundaries=!0),this._map.setRenderWorldCopies(!1),this._userInteractions=null,this._initialState=null,this._map.on("idle",()=>{if(this._userInteractions===null)this.setupUserInteractions_();else if(this._initialState===null){this._map.setMinZoom(3),this._map.setMaxBounds(null),this._map.setRenderWorldCopies(!0),this._bounds=this._map.getBounds();const a=this._bounds.toArray(),s=no.MercatorCoordinate.fromLngLat(a[0]),h=no.MercatorCoordinate.fromLngLat(a[1]);this.__normalised_origin=[s.x,h.y],this.__normalised_size=[h.x-s.x,s.y-h.y],"state"in this._options&&this._userInteractions.setState(this._options.state),this._initialState=this.getState(),this._userInteractions.minimap&&this._userInteractions.minimap.initialise(),this._resolve(this)}})}async setupUserInteractions_(){await lr(this,Wf,hx).call(this,this.__taxon);for(const r of this.taxonIdentifiers)await lr(this,Wf,hx).call(this,r);for(const r of this._options.images)await this.addImage(r.id,r.url,"",r.options);await L5t(this._map);const t=await kt(this,du).loadJSON(`flatmap/${this.__uuid}/termgraph`);kt(this,Zf).load(t),this._userInteractions=new QHt(this)}get bounds(){return this._bounds}get has_flightpaths(){return"version"in this.__details&&this.__details.version>=_Ht}get mapTermGraph(){return kt(this,Zf)}featureFilterRanges(){const t={};for(const[r,n]of this.__featurePropertyValues.entries())t[r]=[...n.values()];return t}clearVisibilityFilter(){this._userInteractions!==null&&this._userInteractions.clearVisibilityFilter()}setVisibilityFilter(t=!0){this._userInteractions!==null&&this._userInteractions.setVisibilityFilter(t)}resetMap(){this._initialState!==null&&this.setState(this._initialState),this._userInteractions!==null&&this._userInteractions.reset()}zoomIn(){this._map.zoomIn()}zoomOut(){this._map.zoomOut()}pathTypes(){if(this._userInteractions!==null)return this._userInteractions.pathManager.pathTypes()}enablePath(t,r=!0){this._userInteractions!==null&&this._userInteractions.enablePathsByType(t,r)}enableSckanPath(t,r=!0){this._userInteractions!==null&&this._userInteractions.enableSckanPaths(t,r)}enableConnectivityByTaxonIds(t,r=!0){this._userInteractions!==null&&(Array.isArray(t)?this._userInteractions.enableConnectivityByTaxonIds(t,r):this._userInteractions.enableConnectivityByTaxonIds([t],r))}enableCentrelines(t=!0){this._userInteractions!==null&&this._userInteractions.enableCentrelines(t)}loadImage_(t){return new Promise((r,n)=>{this._map.loadImage(t,(i,o)=>{i?n(i):r(o)})})}loadEncodedImage_(t){return new Promise((r,n)=>{const i=new Image;i.src=t,i.onload=o=>r(o.target)})}async addImage(t,r,n,i={}){if(!this._map.hasImage(t)){const o=await(r.startsWith("data:image")?this.loadEncodedImage_(r):this.loadImage_(r.startsWith("/")?this.makeServerUrl(r):new URL(r,n)));this._map.addImage(t,o,i)}}makeServerUrl(t,r="flatmap/"){return t.startsWith("http://")||t.startsWith("https://")?t:t.startsWith("/")?`${kt(this,hu)}${r}${this.__uuid}${t}`:`${kt(this,hu)}${r}${this.__uuid}/${t}`}get taxon(){return this.__taxon}get biologicalSex(){return this.__biologicalSex}get created(){return this.__created}get id(){return this.__id}get uuid(){return this.__uuid}get url(){let t=this.makeServerUrl("");return t.endsWith("/")?t.substring(0,t.length-1):t}get details(){return this.__details}get provenance(){return this.__provenance}get uniqueId(){return`${this.__uuid}-${this._mapNumber}`}get annotations(){return this.__idToAnnotation}annotation(t){return this.__idToAnnotation.get(t.toString())}setFeatureAnnotated(t){this._userInteractions!==null&&this._userInteractions.setFeatureAnnotated(t)}__updateFeatureIdMapEntry(t,r,n){const i=mh(t),o=r.get(i);o?o.push(n):r.set(i,[n])}__updateFeatureIdMap(t,r,n,i=null){if(t in n&&n[t].length){const o=n[t];if(Array.isArray(o))for(const a of o)this.__updateFeatureIdMapEntry(a,r,n.featureId);else this.__updateFeatureIdMapEntry(o,r,n.featureId)}else i!==null&&"models"in n&&n.models.startsWith(v6t)&&this.__updateFeatureIdMapEntry(i,r,n.featureId)}__addAnnotation(t,r){r.featureId=t,this.__idToAnnotation.set(t,r),this.__updateFeatureIdMap("dataset",this.__datasetToFeatureIds,r),this.__updateFeatureIdMap("models",this.__modelToFeatureIds,r),this.__updateFeatureIdMap("source",this.__mapSourceToFeatureIds,r),this.__updateFeatureIdMap("taxons",this.__taxonToFeatureIds,r,rF);for(const[n,i]of Object.entries(r))if(!vHt.includes(n)){this.__featurePropertyValues.has(n)||this.__featurePropertyValues.set(n,new A7);const o=this.__featurePropertyValues.get(n);Array.isArray(i)?this.__featurePropertyValues.set(n,o.union(new A7(i.map(a=>`${a}`)))):o.add(`${i}`)}this.__annIdToFeatureId.set(r.id,t)}modelFeatureIds(t){return this.__modelToFeatureIds.get(mh(t))||[]}modelFeatureIdList(t){const r=new Qh;if(Array.isArray(t))for(const n of t)r.extend(this.modelFeatureIds(n));else r.extend(this.modelFeatureIds(t));return r.length==0&&(r.extend(this.__datasetToFeatureIds.get(t)),r.extend(this.__mapSourceToFeatureIds.get(t))),r.length==0&&this._userInteractions!==null&&r.extend(this._userInteractions.pathFeatureIds(t)),r}modelForFeature(t){const r=this.__idToAnnotation.get(t);return r&&"models"in r?mh(r.models):null}nodePathModels(t){if(this._userInteractions!==null)return this._userInteractions.nodePathModels(t)}pathModelNodes(t){if(this._userInteractions!==null)return[...this._userInteractions.pathModelNodes(t)]}taxonFeatureIds(t){const r=this.__taxonToFeatureIds.get(mh(t));return[...new A7(r||[])]}taxonName(t){return kt(this,Tl).has(t)?kt(this,Tl).get(t):t}get layers(){return this._layers}get map(){return this._map}get markers(){return this._markers}get anatomicalIdentifiers(){return[...this.__modelToFeatureIds.keys()]}get taxonIdentifiers(){return[...this.__taxonToFeatureIds.keys()]}get datasets(){return[...this.__datasetToFeatureIds.keys()]}get options(){return this._options}get pathways(){return this._pathways}getZoom(){return{mapUUID:this.__uuid,minZoom:this._map.getMinZoom(),zoom:this._map.getZoom(),maxZoom:this._map.getMaxZoom()}}callback(t,r,...n){if(this._callback)return r.mapUUID=this.__uuid,this._callback(t,r,...n)}setInitialPosition(){"bounds"in this._options&&this._map.fitBounds(this._options.bounds,{animate:!1}),"center"in this._options&&this._map.setCenter(this._options.center),"zoom"in this._options&&this._map.setZoom(this._options.zoom)}close(){this._map&&(this._map.remove(),this._map=null)}resize(){this._map.resize()}getIdentifier(){return{taxon:this.__taxon,biologicalSex:this.__biologicalSex,uuid:this.__uuid}}getState(){return this._userInteractions!==null?this._userInteractions.getState():{}}setState(t){this._userInteractions!==null&&this._userInteractions.setState(t)}showPopup(t,r,n){this._userInteractions!==null&&this._userInteractions.showPopup(t,r,n)}setPaint(t=null){t=l6(t,{colour:!0,outline:!0}),this._userInteractions!==null&&this._userInteractions.setPaint(t)}setColour(t=null){console.log("`setColour()` is deprecated; please use `setPaint()` instead."),this.setPaint(t)}getBackgroundColour(){return this._map.getPaintProperty("background","background-color")}getBackgroundOpacity(){return this._map.getPaintProperty("background","background-opacity")}setBackgroundColour(t){localStorage.setItem("flatmap-background-colour",t),this._map.setPaintProperty("background","background-color",t),this._userInteractions.minimap&&this._userInteractions.minimap.setBackgroundColour(t)}setBackgroundOpacity(t){this._map.setPaintProperty("background","background-opacity",t),this._userInteractions.minimap&&this._userInteractions.minimap.setBackgroundOpacity(t)}showMinimap(t){this._userInteractions.minimap&&this._userInteractions.minimap.show(t)}getLayers(){if(this._userInteractions!==null)return this._userInteractions.getLayers()}enableLayer(t,r=!0){if(this._userInteractions!==null)return this._userInteractions.enableLayer(t,r)}enableFlightPaths(t=!0){this._userInteractions!==null&&this._userInteractions.enableFlightPaths(t)}getSystems(){if(this._userInteractions!==null)return this._userInteractions.getSystems()}enableSystem(t,r=!0){if(this._userInteractions!==null)return this._userInteractions.enableSystem(t,r)}addMarker(t,r={}){return r=Object.assign({cluster:!0},r),this._userInteractions!==null?this._userInteractions.addMarker(t,r):-1}addMarkers(t,r={}){r=Object.assign({cluster:!0},r);const n=[];for(const i of t)this._userInteractions!==null?n.push(this._userInteractions.addMarker(i,r)):n.push(-1);return n}removeMarker(t){t>-1&&this._userInteractions!==null&&this._userInteractions.removeMarker(t)}clearMarkers(){this._userInteractions!==null&&this._userInteractions.clearMarkers()}addDatasetMarkers(t){this._userInteractions!==null&&this._userInteractions.addDatasetMarkers(t)}clearDatasetMarkers(){this._userInteractions!==null&&this._userInteractions.clearDatasetMarkers()}removeDatasetMarker(t){this._userInteractions!==null&&this._userInteractions.removeDatasetMarker(t)}visibleMarkerAnatomicalIds(){if(this._userInteractions!==null)return this._userInteractions.visibleMarkerAnatomicalIds()}showMarkerPopup(t,r,n={}){return this._userInteractions!==null?this._userInteractions.showMarkerPopup(t,r,n):!1}__exportedProperties(t){const r={},n=["id","featureId","connectivity","dataset","dataset-ids","kind","label","models","source","taxons","hyperlinks","completeness","missing-nodes","alert","biological-sex"];for(const i of n)if(i in t){const o=t[i];o!==void 0&&(Array.isArray(o)&&o.length||o.constructor===Object&&Object.keys(o).length?r[i]=o:i==="featureId"?r[i]=+o:i==="dataset-ids"?r[i]=JSON.parse(o):r[i]=o)}return Object.keys(r).length>0&&(r.type="feature"),r}showAnnotator(t=!0){this._userInteractions!==null&&this._userInteractions.showAnnotator(t)}annotationEvent(t,r){this.callback("annotation",{type:t,feature:r})}commitAnnotationEvent(t){this._userInteractions&&this._userInteractions.commitAnnotationEvent(t)}rollbackAnnotationEvent(t){this._userInteractions&&this._userInteractions.rollbackAnnotationEvent(t)}clearAnnotationFeature(){this._userInteractions&&this._userInteractions.clearAnnotationFeatures()}removeAnnotationFeature(){this._userInteractions&&this._userInteractions.removeAnnotationFeature()}addAnnotationFeature(t){this._userInteractions&&this._userInteractions.addAnnotationFeature(t)}refreshAnnotationFeatureGeometry(t){if(this._userInteractions)return this._userInteractions.refreshAnnotationFeatureGeometry(t)}changeAnnotationDrawMode(t){this._userInteractions&&this._userInteractions.changeAnnotationDrawMode(t)}featureEvent(t,r){const n=this.__exportedProperties(r);return Object.keys(n).length>0?(this.callback(t,n),!0):!1}featureProperties(t){const r=this.annotation(t);return r?this.__exportedProperties(r):{}}markerEvent(t,r,n){const i=Object.assign({},this.__exportedProperties(n),{type:"marker",id:r});this.callback(t,i)}controlEvent(t,r,n){this.callback(t,{type:"control",control:r,value:n})}enablePanZoomEvents(t=!0){this._userInteractions!==null&&this._userInteractions.enablePanZoomEvents(t)}panZoomEvent(t){const r=this._map.getBounds();if(this.__normalised_origin!==void 0){const n=no.MercatorCoordinate.fromLngLat(r.toArray()[0]),i=no.MercatorCoordinate.fromLngLat(r.toArray()[1]),o=[(n.x-this.__normalised_origin[0])/this.__normalised_size[0],(i.y-this.__normalised_origin[1])/this.__normalised_size[1]],a=[(i.x-n.x)/this.__normalised_size[0],(n.y-i.y)/this.__normalised_size[1]];this.callback("pan-zoom",{type:t,origin:o,size:a})}}panZoomTo(t,r){if(this.__normalised_origin!==void 0){const n=t[0]*this.__normalised_size[0]+this.__normalised_origin[0],i=t[1]*this.__normalised_size[1]+this.__normalised_origin[1],o=n+r[0]*this.__normalised_size[0],a=i+r[1]*this.__normalised_size[1],s=new no.MercatorCoordinate(n,a,0).toLngLat(),h=new no.MercatorCoordinate(o,i,0).toLngLat();this._map.fitBounds([s,h],{animate:!1})}}search(t,r=!1){return r?this.__searchIndex.auto_suggest(t):this.__searchIndex.search(t)}clearSearchResults(){this._userInteractions!==null&&this._userInteractions.clearSearchResults()}showSearchResults(t){this._userInteractions!==null&&this._userInteractions.showSearchResults(t.featureIds)}selectFeatures(t){if(this._userInteractions!==null){const r=this.modelFeatureIdList(t);this._userInteractions.selectFeatures(r)}}zoomToFeatures(t,r=null){if(r=l6(r,{select:!0,highlight:!1,padding:100}),this._userInteractions!==null){const n=this.modelFeatureIdList(t);this._userInteractions.zoomToFeatures(n,r)}}selectGeoJSONFeatures(t){this._userInteractions!==null&&this._userInteractions.selectFeatures(t)}zoomToGeoJSONFeatures(t,r=null){r=l6(r,{select:!0,highlight:!1,padding:100}),this._userInteractions!==null&&this._userInteractions.zoomToFeatures(t,r)}}hu=new WeakMap,du=new WeakMap,Zf=new WeakMap,Tl=new WeakMap,Wf=new WeakSet,hx=async function(e){if(!kt(this,Tl).has(e)){const t=await kt(this,du).loadJSON(`knowledge/label/${e}`);if("label"in t)return kt(this,Tl).set(e,t.label)}};class dx{constructor(t,r={}){this._mapServer=new f4t(t),this._options=r,this._mapList=[],this._mapNumber=0,this._initialisingMutex=new _6t,this._initialised=!1}async ensureInitialised_(){return await this._initialisingMutex.dispatch(async()=>{if(!this._initialised){this._mapList=[];const t=await this._mapServer.loadJSON("");for(const r of t)r.separateLayers="version"in r&&r.version>=yHt,this._mapList.push(r);await jO.load(this._mapServer),this._initialised=!0}})}allMaps(){return new Promise(async(t,r)=>{await this.ensureInitialised_();const n={};for(const i of this._mapList){const o="uuid"in i?i.uuid:i.id;n[o]=i}t(n)})}findMap_(t){return new Promise(async(r,n)=>{await this.ensureInitialised_(),r(this.lookupMap_(t))})}latestMap_(t){const r=t.constructor.name==="String"?t:"uuid"in t?t.uuid:"taxon"in t?t.taxon:null;if(r===null)return null;let n=null,i="";for(const o of this._mapList)if(("uuid"in o&&r===o.uuid||r===o.id||"taxon"in o&&r===o.taxon||r===o.source)&&(!("biologicalSex"in t)||"biologicalSex"in o&&t.biologicalSex===o.biologicalSex))if("created"in o)i<o.created&&(i=o.created,n=o);else{n=o;break}return n}lookupMap_(t){return typeof t=="object"?this.latestMap_(t):this.latestMap_({uuid:t})}loadMap(t,r,n,i={}){return new Promise(async(o,a)=>{try{const s=await this.findMap_(t);s===null&&a(`Unknown map: ${JSON.stringify(t)}`);const h="uuid"in s?s.uuid:s.id,d=await this._mapServer.loadJSON(`flatmap/${h}/`),f="uuid"in d?d.uuid:d.id;if(h!==f)throw new Error(`Map '${h}' has wrong ID in index`);const Q=Object.assign({},this._options,i);!("bounds"in i)&&"bounds"in d&&(Q.bounds=d.bounds),"style"in d?Q.style=d.style:Q.style="flatmap",!("image-layers"in d)&&"image_layer"in d&&(d["image-layers"]=d.image_layer);let m=[];if(!("version"in d)||d.version<=1)for(const O of d.layers)typeof O=="string"?m.push({id:O,description:O.charAt(0).toUpperCase()+O.slice(1),selectable:!0}):m.push(O);else m=await this._mapServer.loadJSON(`flatmap/${h}/layers`);const _=await this._mapServer.loadJSON(`flatmap/${h}/style`);"glyphs"in _||(_.glyphs="https://fonts.openmaptiles.org/{fontstack}/{range}.pbf");const v=await this._mapServer.loadJSON(`flatmap/${h}/pathways`),b=await this._mapServer.loadJSON(`flatmap/${h}/annotations`),M=await this._mapServer.loadJSON(`flatmap/${h}/metadata`),E=await this._mapServer.loadJSON(`flatmap/${h}/markers`);return"vector-tiles"in _.sources&&("minZoom"in Q||(Q.minZoom=_.sources["vector-tiles"].minzoom),"maxZoom"in Q||(Q.maxZoom=_.sources["vector-tiles"].maxzoom)),"layerOptions"in Q?("colour"in Q.layerOptions||(Q.layerOptions.colour=!0),"outline"in Q.layerOptions||(Q.layerOptions.outline=!0)):Q.layerOptions={colour:!0,outline:!0},Q.layerOptions.authoring="authoring"in d?d.authoring:!1,Q.separateLayers=s.separateLayers,this._mapNumber+=1,new bHt(r,this._mapServer,{id:s,uuid:h,details:d,taxon:s.taxon,biologicalSex:s.biologicalSex,style:_,options:Q,layers:m,markers:E,annotations:b,number:this._mapNumber,pathways:v,provenance:M,provenance:M,callback:n},o)}catch(s){a(s)}})}}Wm(dx,"version",gHt);/*! js-cookie v3.0.5 | MIT */function qf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var LHt={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function px(e,t){function r(i,o,a){if(!(typeof document>"u")){a=qf({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var h in a)a[h]&&(s+="; "+h,a[h]!==!0&&(s+="="+a[h].split(";")[0]));return document.cookie=i+"="+e.write(o,i)+s}}function n(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var o=document.cookie?document.cookie.split("; "):[],a={},s=0;s<o.length;s++){var h=o[s].split("="),d=h.slice(1).join("=");try{var f=decodeURIComponent(h[0]);if(a[f]=e.read(d,f),i===f)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,o){r(i,"",qf({},o,{expires:-1}))},withAttributes:function(i){return px(this.converter,qf({},this.attributes,i))},withConverter:function(i){return px(qf({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Tx=px(LHt,{path:"/"}),Xa=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},wi=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},l3,pu,Ka,G1,y4;const xHt=1e4;class wHt{constructor(t){l3.add(this),pu.set(this,void 0),Ka.set(this,null),G1.set(this,null),t.slice(-1)==="/"?Xa(this,pu,t.slice(0,-1),"f"):Xa(this,pu,t,"f")}get currentUser(){return wi(this,Ka,"f")}get currentError(){return wi(this,G1,"f")}async authenticate(t){Xa(this,G1,null,"f"),Xa(this,Ka,null,"f");const r=await wi(this,l3,"m",y4).call(this,t,"authenticate");return"error"in r?(Tx.remove("annotation-key"),Promise.resolve(wi(this,G1,"f"))):(Tx.set("annotation-key",r.session,{secure:!0,expires:1}),Xa(this,Ka,r.data,"f"),Promise.resolve(wi(this,Ka,"f")))}async unauthenticate(t){Xa(this,G1,null,"f"),Xa(this,Ka,null,"f");const r=await wi(this,l3,"m",y4).call(this,t,"unauthenticate");return"success"in r?Promise.resolve(r):Promise.resolve(wi(this,G1,"f"))}async annotatedItemIds(t,r,n,i){const o={resource:r};n!==void 0&&(o.user=n),i!==void 0&&(o.participated=i);const a=await wi(this,l3,"m",y4).call(this,t,"items/","GET",o);return"error"in a?Promise.resolve(wi(this,G1,"f")):Promise.resolve(a)}async drawnFeatures(t,r,n){const i={resource:r};n!==void 0&&(i.items=n);const o=await wi(this,l3,"m",y4).call(this,t,"features/","GET",i);return"error"in o?Promise.resolve(wi(this,G1,"f")):Promise.resolve(o)}async itemAnnotations(t,r,n){const i=await wi(this,l3,"m",y4).call(this,t,"annotations/","GET",{resource:r,item:n});return"error"in i?Promise.resolve(wi(this,G1,"f")):Promise.resolve(i)}async annotation(t,r){const n=await wi(this,l3,"m",y4).call(this,t,"annotation/","GET",{annotation:r});return"error"in n?Promise.resolve(wi(this,G1,"f")):Promise.resolve(n)}async addAnnotation(t,r){if(wi(this,Ka,"f")&&wi(this,Ka,"f").canUpdate){const n=Object.assign({creator:wi(this,Ka,"f"),created:new Date().toISOString()},r),i=await wi(this,l3,"m",y4).call(this,t,"annotation/","POST",{data:n});if(!("error"in i))return Promise.resolve(i);Xa(this,G1,i,"f")}else Xa(this,G1,{error:"user cannot add annotation"},"f");return Promise.resolve(wi(this,G1,"f"))}}pu=new WeakMap,Ka=new WeakMap,G1=new WeakMap,l3=new WeakSet,y4=async function(t,r,n="GET",i={}){let o=!0;const a=new AbortController;setTimeout(()=>{o&&(console.log("Annotation server timeout..."),a.abort())},xHt);const s={method:n,signal:a.signal};let h=`${wi(this,pu,"f")}/${r}`;const d=Tx.get("annotation-key")||"";if(n==="GET"){const Q=[];for(const[m,_]of Object.entries(i))Q.push(`${m}=${encodeURIComponent(JSON.stringify(_))}`);Q.push(`key=${encodeURIComponent(t)}`),Q.push(`session=${encodeURIComponent(d)}`),h+="?"+Q.join("&"),s.headers={Accept:"application/json; charset=utf-8","Cache-Control":"no-store"}}else if(n==="POST"){const Q=Object.assign({key:t,session:d},i);s.body=JSON.stringify(Q),s.headers={Accept:"application/json; charset=utf-8","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}}const f=await fetch(h,s);return o=!1,f.ok?Promise.resolve(await f.json()):(Xa(this,G1,{error:`${f.status} ${f.statusText}`},"f"),Promise.resolve(wi(this,G1,"f")))};var EHt=!1;function Xf(e,t,r){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,r),r):(e[t]=r,r)}function fx(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}/*!
1711
+ `)}</div>`)}this.activateFeature(v),this.__activateRelatedFeatures(v),"hyperlink"in v.properties&&(this._map.getCanvas().style.cursor="pointer")}}s!==""&&this._infoControl.show(s),this.__showToolTip(h,t.lngLat,f)}__showToolTip(t,r,n=null){if(t!==""||this._flatmap.options.showPosition||this._flatmap.options.showId&&n!==null){let i="";if(this._flatmap.options.showPosition){const o=MA(r.toArray()),a=r6t(o).geometry.coordinates;i=n===null?JSON.stringify(a):`${JSON.stringify(a)} (${n.id})`}this._flatmap.options.showId&&n!==null&&"id"in n.properties&&(i=`${i} ${n.properties.id}`),i!==""&&(t=`<span>${i}</span><br/>${t}`),t!==""&&(this._tooltip=new no.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none",className:"flatmap-tooltip-popup"}),this._tooltip.setLngLat(r).setHTML(t).addTo(this._map))}}selectionEvent_(t,r){if(r!==void 0){const n=+r.id,i=!("properties"in r&&"kind"in r.properties&&["cell-type","scaffold","tissue"].includes(r.properties.kind));if(t.ctrlKey||t.metaKey){const o=this.featureSelected_(n);for(const a of this._activeFeatures)o?this.unselectFeature(a.id):this.selectFeature(a.id,i)}else{let o=!0;for(const a of this._selectedFeatureIds.keys())if(a===n){o=!1;break}if(this.unselectFeatures(),o)for(const a of this._activeFeatures)this.selectFeature(a.id,i)}}}clickEvent_(t){if(this._modal)return;this.__clearActiveMarker();const r=lr(this,$f,ux).call(this,t.point);if(r.length==0){this.unselectFeatures();return}const n=r.filter(o=>!o.id),i=r.filter(o=>o.id)[0];if(this.selectionEvent_(t.originalEvent,i),this._modal)this.__resetFeatureDisplay(),this.unselectFeatures(),this.__clearModal();else if(n.length>0){const o=n.filter(s=>s.source==="mapbox-gl-draw-cold")[0],a=n.filter(s=>s.source==="mapbox-gl-draw-hot")[0];this.__featureEvent("click",o||i||a)}else i&&(this.__lastClickLngLat=t.lngLat,this.__featureEvent("click",i),"properties"in i&&"hyperlink"in i.properties&&window.open(i.properties.hyperlink,"_blank"))}__activateRelatedFeatures(t){if("nerveId"in t.properties){const r=t.properties.nerveId;r!==t.id&&this.activateFeature(this.mapFeature(r));for(const n of this.__pathManager.nerveFeatureIds(r))this.activateFeature(this.mapFeature(n))}if("nodeId"in t.properties)for(const r of this.__pathManager.pathFeatureIds(t.properties.nodeId))this.activateFeature(this.mapFeature(r))}clearVisibilityFilter(){this._layerManager.clearVisibilityFilter()}setVisibilityFilter(t=!0){this._layerManager.setVisibilityFilter(new H8(t))}enablePathsBySystem(t,r=!0,n=!1){this.__pathManager.enablePathsBySystem(t,r,n)}enablePathsByType(t,r=!0){this.__pathManager.enablePathsByType(t,r)}pathFeatureIds(t){const r=new Qh;return r.extend(this.__pathManager.connectivityModelFeatureIds(t)),r.extend(this.__pathManager.pathModelFeatureIds(t)),r}pathModelNodes(t){return this.__pathManager.pathModelNodes(t)}nodePathModels(t){return this.__pathManager.nodePathModels(t)}enableCentrelines(t=!0,r=!1){this.__pathManager.enablePathsByType("centreline",t,r),lr(this,g4,K6).call(this,{showCentrelines:t})}enableSckanPaths(t,r=!0){this._layerManager.enableSckanPaths(t,r)}enableConnectivityByTaxonIds(t,r=!0){if(r)for(const n of t)this.__enabledConnectivityTaxons.add(n);else for(const n of t)this.__enabledConnectivityTaxons.delete(n);this._layerManager.setFilter({taxons:[...this.__enabledConnectivityTaxons.values()]})}excludeAnnotated(t=!1){lr(this,g4,K6).call(this,{excludeAnnotated:t})}markerPosition(t,r){if(this.__markerPositions.has(t))return this.__markerPositions.get(t);let n=r.markerPosition||r.centroid;if(n===null||n==null){const i=this._map.querySourceFeatures(Uy,{sourceLayer:this._flatmap.options.separateLayers?`${r.layer}_${r["tile-layer"]}`:r["tile-layer"],filter:["all",["==",["id"],parseInt(t)],["==",["geometry-type"],"Polygon"]]});i.length>0&&(n=THt(i[0]))}return this.__markerPositions.set(t,n),n}nextMarkerId(){return Qr(this,ou,kt(this,ou)+1),kt(this,ou)}addMarker(t,r={}){const n=this._flatmap.modelFeatureIds(t);let i=-1;for(const o of n){const a=this._flatmap.annotation(o);if(!(!("markerPosition"in a)&&!a.geometry.includes("Polygon"))&&!("marker"in a)){i===-1&&(i=this.nextMarkerId());const s=r.colour||"#005974",h=r.element?new no.Marker({element:r.element}):new no.Marker({color:s,scale:.5}),d=document.createElement("div"),f=document.createElement("div");f.innerHTML=h.getElement().innerHTML,d.id=`marker-${i}`,d.appendChild(f);const Q={element:d};"className"in r&&(Q.className=r.className);const m=this.markerPosition(o,a);if(r.cluster&&this._layerManager)this._layerManager.addMarker(i,m,a);else{const _=new no.Marker(Q).setLngLat(m).addTo(this._map);d.addEventListener("mouseenter",this.markerMouseEvent_.bind(this,_,t)),d.addEventListener("mousemove",this.markerMouseEvent_.bind(this,_,t)),d.addEventListener("mouseleave",this.markerMouseEvent_.bind(this,_,t)),d.addEventListener("click",this.markerMouseEvent_.bind(this,_,t)),this.__markerIdByMarker.set(_,i),this.__markerIdByFeatureId.set(+o,i),this.__annotationByMarkerId.set(i,a),this.__featureEnabled(this.mapFeature(+o))||(d.style.visibility="hidden")}}}return i===-1&&console.warn(`Unable to find feature '${t}' on which to place marker`),i}clearMarkers(){this._layerManager&&this._layerManager.clearMarkers();for(const t of this.__markerIdByMarker.keys())t.remove();this.__markerIdByMarker.clear(),this.__annotationByMarkerId.clear()}removeMarker(t){for(const[r,n]of this.__markerIdByMarker.entries())if(t===n){r.remove(),this.__markerIdByMarker.remove(r),this.__annotationByMarkerId.remove(n);break}}addDatasetMarkers(t){if(this._layerManager)return this._layerManager.addDatasetMarkers(t)}clearDatasetMarkers(){this._layerManager&&this._layerManager.clearDatasetMarkers()}removeDatasetMarker(t){this._layerManager&&this._layerManager.removeDatasetMarker(markedatasetIdrId)}visibleMarkerAnatomicalIds(){const t=[],r=this._map.getBounds();for(const[n,i]of this.__markerIdByMarker.entries())if(r.contains(n.getLngLat())){const o=this.__annotationByMarkerId.get(i);t.includes(o.models)||t.push(o.models)}return t}markerMouseEvent_(t,r,n){if(!(this._modal||this.__activeMarker!==null&&n.type==="mouseleave")&&["mouseenter","mousemove","click"].includes(n.type)){this.__activeMarker=t,t.setPopup(null),t.getElement().style.cursor="default";const i=this.__markerIdByMarker.get(t),o=this.__annotationByMarkerId.get(i);this.markerEvent_(n,i,t.getLngLat(),o),n.stopPropagation()}}markerEvent_(t,r,n,i){if(["mousemove","click"].includes(t.type)&&(this.removeTooltip_(),["mouseenter","mousemove","click"].includes(t.type))){const o=this.mapFeature(i.featureId);o!==void 0&&(t.type==="mouseenter"?(this.resetActiveFeatures_(),this.activateFeature(o)):this.selectionEvent_(t,o));const a=this.tooltipHtml_(i,!0);this.__showToolTip(a,n),this._flatmap.markerEvent(t.type,r,i)}}__clearActiveMarker(){this.__activeMarker!==null&&(this.__activeMarker.setPopup(null),this.__activeMarker=null)}showMarkerPopup(t,r,n){const i=this.__activeMarker;if(t!==this.__markerIdByMarker.get(i))return this.__clearActiveMarker(),!1;const o=i.getLngLat();this._map.getBounds().contains(o)||this._map.panTo(o);const a=document.createElement("div");return typeof r=="object"?a.appendChild(r):a.innerHTML=r,a.addEventListener("click",s=>this.__clearActiveMarker()),this._tooltip=new no.Popup({closeButton:!1,closeOnClick:!1,maxWidth:"none",className:"flatmap-marker-popup"}),this._tooltip.setLngLat(o).setDOMContent(a),i.setPopup(this._tooltip),i.togglePopup(),!0}enablePanZoomEvents(t=!0){this.__pan_zoom_enabled=t}panZoomEvent_(t){this.__pan_zoom_enabled&&this._flatmap.panZoomEvent(t)}}xi=new WeakMap,ou=new WeakMap,au=new WeakMap,g4=new WeakSet,K6=function(e){this._layerManager.setPaint(e)},su=new WeakSet,Uf=function(e){return Bv(e)?this.mapFeature(e.properties.featureId):e},hl=new WeakSet,lu=function(e){return e=lr(this,su,Uf).call(this,e),this._map.getFeatureState(e)},dl=new WeakSet,cu=function(e,t){e=lr(this,su,Uf).call(this,e),this._map.removeFeatureState(e,t),this._layerManager.removeFeatureState(e,t)},pl=new WeakSet,uu=function(e,t){e=lr(this,su,Uf).call(this,e),this._map.setFeatureState(e,t),this._layerManager.setFeatureState(e,t)},$f=new WeakSet,ux=function(e){return this._layerManager.featuresAtPoint(e).filter(t=>this.__featureEnabled(t))};const mHt=[{id:"label-background",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC8AAAAmCAIAAADbSlUzAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAAJOgAACToAYJjBRwAAACVSURBVFhH7dixDoJAEIThfXqMBcYKrTQ+jkYSStDYkVhZINxyEshJcZXJtC7FfNlmur9eyXb7Vqf6+bI9HUKyWkt5e4RlOF9ycerjsqbqpfefuKzNJawBWIOxBmMNxhqMNRhrMNZgrMFYg7EGYw3GGow1GGuw5dU07y4ua22nUlb3uKxd80IOx1Pjxp+f4P/P+ZButl+YrbXnPs+YmAAAAABJRU5ErkJggg==",options:{content:[21,4,28,33],stretchX:[[21,28]],stretchY:[[4,33]]}},{id:"xlabel-background",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAmCAYAAAD9XArwAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/TSotUROwg4pChioIFURFHrUIRKoRaoVUHk0s/hCYNSYqLo+BacPBjserg4qyrg6sgCH6AODk6KbpIif9LCi1iPTjux7t7j7t3gFArMc0KjAGabpupRFzMZFfE4CsC6EEIIxiWmWXMSlISbcfXPXx8vYvxrPbn/hxdas5igE8knmGGaROvE09t2gbnfeIIK8oq8TnxqEkXJH7kuuLxG+eCywLPjJjp1BxxhFgstLDSwqxoasSTxFFV0ylfyHisct7irJUqrHFP/sJwTl9e4jrNASSwgEVIEKGggg2UYCNGq06KhRTtx9v4+12/RC6FXBtg5JhHGRpk1w/+B7+7tfIT415SOA50vDjOxyAQ3AXqVcf5Pnac+gngfwau9Ka/XAOmP0mvNrXoEdC9DVxcNzVlD7jcAfqeDNmUXclPU8jngfcz+qYs0HsLdK56vTX2cfoApKmr5A1wcAgMFSh7rc27Q629/Xum0d8PfM1yq13h+DEAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfkBBEJExO2pF7NAAAAqUlEQVQ4y+3OIQ6CYBiH8ef9MDhxc8yABjeP4LwAx3BWTwE3oHkMrBa7JJN3YBogfQkjr0HcDCg0C0/+7f2/AjghycLFj0ECYMarHPRcUoQx25uEJMsR/lUQj4YUtQ+K9aC+1IgABPFc/NjUcy1JYD5++tXM0LEe9rCHPfwXzDu43ChV2qaUKjWWLFLUfkdqLVnkXDiWK4LDkMlckCkwfs8p1cmSbfbs7k+jIi/gASaPYQAAAABJRU5ErkJggg==",options:{content:[4,4,5,33],stretchX:[[4,5]],stretchY:[[4,33]]}},{id:"ylabel-background",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAmCAYAAAD9XArwAAABhWlDQ1BJQ0MgcHJvZmlsZQAAKJF9kT1Iw0AcxV/TSotUROwg4pChioIFURFHrUIRKoRaoVUHk0s/hCYNSYqLo+BacPBjserg4qyrg6sgCH6AODk6KbpIif9LCi1iPTjux7t7j7t3gFArMc0KjAGabpupRFzMZFfE4CsC6EEIIxiWmWXMSlISbcfXPXx8vYvxrPbn/hxdas5igE8knmGGaROvE09t2gbnfeIIK8oq8TnxqEkXJH7kuuLxG+eCywLPjJjp1BxxhFgstLDSwqxoasSTxFFV0ylfyHisct7irJUqrHFP/sJwTl9e4jrNASSwgEVIEKGggg2UYCNGq06KhRTtx9v4+12/RC6FXBtg5JhHGRpk1w/+B7+7tfIT415SOA50vDjOxyAQ3AXqVcf5Pnac+gngfwau9Ka/XAOmP0mvNrXoEdC9DVxcNzVlD7jcAfqeDNmUXclPU8jngfcz+qYs0HsLdK56vTX2cfoApKmr5A1wcAgMFSh7rc27Q629/Xum0d8PfM1yq13h+DEAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfkBBEJEyeXEKp4AAAAwklEQVQ4y+3ULU/DUBhA4XO/2rUgwV1ZBWLJBP9fI0gQuMktWcJSwUq79n68qAoSGnCYHv3oowBD09jz88t1CpGcBQCtFYWz3D3tNuz3EXgojqdWLt0gKWWZSynLpRvkeGqFpinVuf2QsnDc3mz4qe7zyjgF9BQidVWyVF2VTCGicxa0VotQa0XOguaPrXCFK1zhv8D5VkvNt9POGvphXIT9MOKsAbyvfl2z95UCCrw3769vfYjp2+ydNdxvH2sOh/QFh8F7PWWiL5EAAAAASUVORK5CYII=",options:{content:[4,4,5,33],stretchX:[[4,5]],stretchY:[[4,33]]}},{id:"rounded-rectangle",url:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAGmSURBVDiNldPBitpAGAfwv5mMmy85JCistD5Ai/gCPYovYJENCPZQF8VD36HXUkrfQws9R8WLF58gh2h2W2PpoeTWxBgzMr1spd3uUvOHOQ2//3yHb4C/UyGi95Zl3XLOUwASgFRVNTVN8ysRfQTwFA+FMdYhoqjf7+9ns5kMgkCGYSjDMJTb7VbO53M5HA4PRBRzzl//g8vlcrxYLE7osbNcLmWlUok459cAULgb+2YymRi1Wu3B6e7H9300Go1dkiTPGRG97Xa7LzqdjnqWBlAqlRBFEVzXNZRisXhl2/bFufh3bNvmAF4WOOd73/cvDMPIVSCEQLVaFUqWZbkxAKiqCsaYVHLLe1E452kcx7mhEALH47Gg6Lr+3fO83AXr9Rq6rofK4XD4NB6P07wFo9Eok1J+LgC41DTt1nEco16vn4VXqxWazeYuSZJnCoAfWZZdt9vtneu6/8We56HVasVCiDcAvp0uGGM2Ef3s9Xp7x3HkZrM57X8QBHI6ncrBYJASUcQYe/XYA5eapr2zLOuGc77H3XfmnKemaX4hog8AnvwJfgHMKs1jQ++4tQAAAABJRU5ErkJggg==",options:{content:[3,3,13,13],stretchX:[[7,9]],stretchY:[[7,9]]}}],gHt="2.8.8",yHt=1.4,_Ht=1.6,rF="NCBITaxon:2787823",vHt=["bounds","class","featureId","geometry","id","label","layer","markerPosition","name","nerveId","nodeId","pathStartPosition","pathEndPosition","source","tile-layer"];var hu,du,Zf,Tl,Wf,hx;class bHt{constructor(t,r,n,i){$e(this,Wf),$e(this,hu,void 0),$e(this,du,void 0),$e(this,Zf,new _5t),$e(this,Tl,new Map),Qr(this,du,r),Qr(this,hu,r.url()),this.__id=n.id,this.__uuid=n.uuid,this.__details=n.details,this.__provenance=n.provenance,this.__created=n.created,this.__taxon=n.taxon,this.__biologicalSex=n.biologicalSex,this._mapNumber=n.number,this._callback=n.callback,this._layers=n.layers,this._markers=n.markers,this._options=n.options,this._pathways=n.pathways,this._resolve=i,this._map=null,this.__searchIndex=new j4t(this),this.__idToAnnotation=new Map,this.__datasetToFeatureIds=new Map,this.__modelToFeatureIds=new Map,this.__mapSourceToFeatureIds=new Map,this.__annIdToFeatureId=new Map,this.__taxonToFeatureIds=new Map,this.__featurePropertyValues=new Map;for(const[a,s]of Object.entries(n.annotations))this.__addAnnotation(a,s),this.__searchIndex.indexMetadata(a,s);for(const[a,s]of Object.entries(n.style.sources))if(s.url&&(s.url=this.makeServerUrl(s.url)),s.tiles){const h=[];for(const d of s.tiles)h.push(this.makeServerUrl(d));s.tiles=h}"images"in n.options||(n.options.images=[]);for(const a of mHt){let s=!1;for(const h of n.options.images)if(a.id===h.id){s=!0;break}s||n.options.images.push(a)}const o={style:n.style,container:t,attributionControl:!1};"maxZoom"in n.options&&(o.maxZoom=n.options.maxZoom),"minZoom"in n.options&&(o.minZoom=n.options.minZoom),o.hash=n.options.debug===!0,this._map=new no.Map(o),n.options.debug===!0&&(this._map.showTileBoundaries=!0),this._map.setRenderWorldCopies(!1),this._userInteractions=null,this._initialState=null,this._map.on("idle",()=>{if(this._userInteractions===null)this.setupUserInteractions_();else if(this._initialState===null){this._map.setMinZoom(3),this._map.setMaxBounds(null),this._map.setRenderWorldCopies(!0),this._bounds=this._map.getBounds();const a=this._bounds.toArray(),s=no.MercatorCoordinate.fromLngLat(a[0]),h=no.MercatorCoordinate.fromLngLat(a[1]);this.__normalised_origin=[s.x,h.y],this.__normalised_size=[h.x-s.x,s.y-h.y],"state"in this._options&&this._userInteractions.setState(this._options.state),this._initialState=this.getState(),this._userInteractions.minimap&&this._userInteractions.minimap.initialise(),this._resolve(this)}})}async setupUserInteractions_(){await lr(this,Wf,hx).call(this,this.__taxon);for(const r of this.taxonIdentifiers)await lr(this,Wf,hx).call(this,r);for(const r of this._options.images)await this.addImage(r.id,r.url,"",r.options);await L5t(this._map);const t=await kt(this,du).loadJSON(`flatmap/${this.__uuid}/termgraph`);kt(this,Zf).load(t),this._userInteractions=new QHt(this)}get bounds(){return this._bounds}get has_flightpaths(){return"version"in this.__details&&this.__details.version>=_Ht}get mapTermGraph(){return kt(this,Zf)}featureFilterRanges(){const t={};for(const[r,n]of this.__featurePropertyValues.entries())t[r]=[...n.values()];return t}clearVisibilityFilter(){this._userInteractions!==null&&this._userInteractions.clearVisibilityFilter()}setVisibilityFilter(t=!0){this._userInteractions!==null&&this._userInteractions.setVisibilityFilter(t)}resetMap(){this._initialState!==null&&this.setState(this._initialState),this._userInteractions!==null&&this._userInteractions.reset()}zoomIn(){this._map.zoomIn()}zoomOut(){this._map.zoomOut()}pathTypes(){if(this._userInteractions!==null)return this._userInteractions.pathManager.pathTypes()}enablePath(t,r=!0){this._userInteractions!==null&&this._userInteractions.enablePathsByType(t,r)}enableSckanPath(t,r=!0){this._userInteractions!==null&&this._userInteractions.enableSckanPaths(t,r)}enableConnectivityByTaxonIds(t,r=!0){this._userInteractions!==null&&(Array.isArray(t)?this._userInteractions.enableConnectivityByTaxonIds(t,r):this._userInteractions.enableConnectivityByTaxonIds([t],r))}enableCentrelines(t=!0){this._userInteractions!==null&&this._userInteractions.enableCentrelines(t)}loadImage_(t){return new Promise((r,n)=>{this._map.loadImage(t,(i,o)=>{i?n(i):r(o)})})}loadEncodedImage_(t){return new Promise((r,n)=>{const i=new Image;i.src=t,i.onload=o=>r(o.target)})}async addImage(t,r,n,i={}){if(!this._map.hasImage(t)){const o=await(r.startsWith("data:image")?this.loadEncodedImage_(r):this.loadImage_(r.startsWith("/")?this.makeServerUrl(r):new URL(r,n)));this._map.addImage(t,o,i)}}makeServerUrl(t,r="flatmap/"){return t.startsWith("http://")||t.startsWith("https://")?t:t.startsWith("/")?`${kt(this,hu)}${r}${this.__uuid}${t}`:`${kt(this,hu)}${r}${this.__uuid}/${t}`}get taxon(){return this.__taxon}get biologicalSex(){return this.__biologicalSex}get created(){return this.__created}get id(){return this.__id}get uuid(){return this.__uuid}get url(){let t=this.makeServerUrl("");return t.endsWith("/")?t.substring(0,t.length-1):t}get details(){return this.__details}get provenance(){return this.__provenance}get uniqueId(){return`${this.__uuid}-${this._mapNumber}`}get annotations(){return this.__idToAnnotation}annotation(t){return this.__idToAnnotation.get(t.toString())}setFeatureAnnotated(t){this._userInteractions!==null&&this._userInteractions.setFeatureAnnotated(t)}__updateFeatureIdMapEntry(t,r,n){const i=mh(t),o=r.get(i);o?o.push(n):r.set(i,[n])}__updateFeatureIdMap(t,r,n,i=null){if(t in n&&n[t].length){const o=n[t];if(Array.isArray(o))for(const a of o)this.__updateFeatureIdMapEntry(a,r,n.featureId);else this.__updateFeatureIdMapEntry(o,r,n.featureId)}else i!==null&&"models"in n&&n.models.startsWith(v6t)&&this.__updateFeatureIdMapEntry(i,r,n.featureId)}__addAnnotation(t,r){r.featureId=t,this.__idToAnnotation.set(t,r),this.__updateFeatureIdMap("dataset",this.__datasetToFeatureIds,r),this.__updateFeatureIdMap("models",this.__modelToFeatureIds,r),this.__updateFeatureIdMap("source",this.__mapSourceToFeatureIds,r),this.__updateFeatureIdMap("taxons",this.__taxonToFeatureIds,r,rF);for(const[n,i]of Object.entries(r))if(!vHt.includes(n)){this.__featurePropertyValues.has(n)||this.__featurePropertyValues.set(n,new A7);const o=this.__featurePropertyValues.get(n);Array.isArray(i)?this.__featurePropertyValues.set(n,o.union(new A7(i.map(a=>`${a}`)))):o.add(`${i}`)}this.__annIdToFeatureId.set(r.id,t)}modelFeatureIds(t){return this.__modelToFeatureIds.get(mh(t))||[]}modelFeatureIdList(t){const r=new Qh;if(Array.isArray(t))for(const n of t)r.extend(this.modelFeatureIds(n));else r.extend(this.modelFeatureIds(t));return r.length==0&&(r.extend(this.__datasetToFeatureIds.get(t)),r.extend(this.__mapSourceToFeatureIds.get(t))),r.length==0&&this._userInteractions!==null&&r.extend(this._userInteractions.pathFeatureIds(t)),r}modelForFeature(t){const r=this.__idToAnnotation.get(t);return r&&"models"in r?mh(r.models):null}nodePathModels(t){if(this._userInteractions!==null)return this._userInteractions.nodePathModels(t)}pathModelNodes(t){if(this._userInteractions!==null)return[...this._userInteractions.pathModelNodes(t)]}taxonFeatureIds(t){const r=this.__taxonToFeatureIds.get(mh(t));return[...new A7(r||[])]}taxonName(t){return kt(this,Tl).has(t)?kt(this,Tl).get(t):t}get layers(){return this._layers}get map(){return this._map}get markers(){return this._markers}get anatomicalIdentifiers(){return[...this.__modelToFeatureIds.keys()]}get taxonIdentifiers(){return[...this.__taxonToFeatureIds.keys()]}get datasets(){return[...this.__datasetToFeatureIds.keys()]}get options(){return this._options}get pathways(){return this._pathways}getZoom(){return{mapUUID:this.__uuid,minZoom:this._map.getMinZoom(),zoom:this._map.getZoom(),maxZoom:this._map.getMaxZoom()}}callback(t,r,...n){if(this._callback)return r.mapUUID=this.__uuid,this._callback(t,r,...n)}setInitialPosition(){"bounds"in this._options&&this._map.fitBounds(this._options.bounds,{animate:!1}),"center"in this._options&&this._map.setCenter(this._options.center),"zoom"in this._options&&this._map.setZoom(this._options.zoom)}close(){this._map&&(this._map.remove(),this._map=null)}resize(){this._map.resize()}getIdentifier(){return{taxon:this.__taxon,biologicalSex:this.__biologicalSex,uuid:this.__uuid}}getState(){return this._userInteractions!==null?this._userInteractions.getState():{}}setState(t){this._userInteractions!==null&&this._userInteractions.setState(t)}showPopup(t,r,n){this._userInteractions!==null&&this._userInteractions.showPopup(t,r,n)}setPaint(t=null){t=l6(t,{colour:!0,outline:!0}),this._userInteractions!==null&&this._userInteractions.setPaint(t)}setColour(t=null){console.log("`setColour()` is deprecated; please use `setPaint()` instead."),this.setPaint(t)}getBackgroundColour(){return this._map.getPaintProperty("background","background-color")}getBackgroundOpacity(){return this._map.getPaintProperty("background","background-opacity")}setBackgroundColour(t){localStorage.setItem("flatmap-background-colour",t),this._map.setPaintProperty("background","background-color",t),this._userInteractions.minimap&&this._userInteractions.minimap.setBackgroundColour(t)}setBackgroundOpacity(t){this._map.setPaintProperty("background","background-opacity",t),this._userInteractions.minimap&&this._userInteractions.minimap.setBackgroundOpacity(t)}showMinimap(t){this._userInteractions.minimap&&this._userInteractions.minimap.show(t)}getLayers(){if(this._userInteractions!==null)return this._userInteractions.getLayers()}enableLayer(t,r=!0){if(this._userInteractions!==null)return this._userInteractions.enableLayer(t,r)}enableFlightPaths(t=!0){this._userInteractions!==null&&this._userInteractions.enableFlightPaths(t)}getSystems(){if(this._userInteractions!==null)return this._userInteractions.getSystems()}enableSystem(t,r=!0){if(this._userInteractions!==null)return this._userInteractions.enableSystem(t,r)}addMarker(t,r={}){return r=Object.assign({cluster:!0},r),this._userInteractions!==null?this._userInteractions.addMarker(t,r):-1}addMarkers(t,r={}){r=Object.assign({cluster:!0},r);const n=[];for(const i of t)this._userInteractions!==null?n.push(this._userInteractions.addMarker(i,r)):n.push(-1);return n}removeMarker(t){t>-1&&this._userInteractions!==null&&this._userInteractions.removeMarker(t)}clearMarkers(){this._userInteractions!==null&&this._userInteractions.clearMarkers()}addDatasetMarkers(t){this._userInteractions!==null&&this._userInteractions.addDatasetMarkers(t)}clearDatasetMarkers(){this._userInteractions!==null&&this._userInteractions.clearDatasetMarkers()}removeDatasetMarker(t){this._userInteractions!==null&&this._userInteractions.removeDatasetMarker(t)}visibleMarkerAnatomicalIds(){if(this._userInteractions!==null)return this._userInteractions.visibleMarkerAnatomicalIds()}showMarkerPopup(t,r,n={}){return this._userInteractions!==null?this._userInteractions.showMarkerPopup(t,r,n):!1}__exportedProperties(t){const r={},n=["id","featureId","connectivity","dataset","dataset-ids","kind","label","models","source","taxons","hyperlinks","completeness","missing-nodes","alert","biological-sex"];for(const i of n)if(i in t){const o=t[i];o!==void 0&&(Array.isArray(o)&&o.length||o.constructor===Object&&Object.keys(o).length?r[i]=o:i==="featureId"?r[i]=+o:i==="dataset-ids"?r[i]=JSON.parse(o):r[i]=o)}return Object.keys(r).length>0&&(r.type="feature"),r}showAnnotator(t=!0){this._userInteractions!==null&&this._userInteractions.showAnnotator(t)}annotationEvent(t,r){this.callback("annotation",{type:t,feature:r})}commitAnnotationEvent(t){this._userInteractions&&this._userInteractions.commitAnnotationEvent(t)}rollbackAnnotationEvent(t){this._userInteractions&&this._userInteractions.rollbackAnnotationEvent(t)}clearAnnotationFeature(){this._userInteractions&&this._userInteractions.clearAnnotationFeatures()}removeAnnotationFeature(){this._userInteractions&&this._userInteractions.removeAnnotationFeature()}addAnnotationFeature(t){this._userInteractions&&this._userInteractions.addAnnotationFeature(t)}refreshAnnotationFeatureGeometry(t){if(this._userInteractions)return this._userInteractions.refreshAnnotationFeatureGeometry(t)}changeAnnotationDrawMode(t){this._userInteractions&&this._userInteractions.changeAnnotationDrawMode(t)}featureEvent(t,r){const n=this.__exportedProperties(r);return Object.keys(n).length>0?(this.callback(t,n),!0):!1}featureProperties(t){const r=this.annotation(t);return r?this.__exportedProperties(r):{}}markerEvent(t,r,n){const i=Object.assign({},this.__exportedProperties(n),{type:"marker",id:r});this.callback(t,i)}controlEvent(t,r,n){this.callback(t,{type:"control",control:r,value:n})}enablePanZoomEvents(t=!0){this._userInteractions!==null&&this._userInteractions.enablePanZoomEvents(t)}panZoomEvent(t){const r=this._map.getBounds();if(this.__normalised_origin!==void 0){const n=no.MercatorCoordinate.fromLngLat(r.toArray()[0]),i=no.MercatorCoordinate.fromLngLat(r.toArray()[1]),o=[(n.x-this.__normalised_origin[0])/this.__normalised_size[0],(i.y-this.__normalised_origin[1])/this.__normalised_size[1]],a=[(i.x-n.x)/this.__normalised_size[0],(n.y-i.y)/this.__normalised_size[1]];this.callback("pan-zoom",{type:t,origin:o,size:a})}}panZoomTo(t,r){if(this.__normalised_origin!==void 0){const n=t[0]*this.__normalised_size[0]+this.__normalised_origin[0],i=t[1]*this.__normalised_size[1]+this.__normalised_origin[1],o=n+r[0]*this.__normalised_size[0],a=i+r[1]*this.__normalised_size[1],s=new no.MercatorCoordinate(n,a,0).toLngLat(),h=new no.MercatorCoordinate(o,i,0).toLngLat();this._map.fitBounds([s,h],{animate:!1})}}search(t,r=!1){return r?this.__searchIndex.auto_suggest(t):this.__searchIndex.search(t)}clearSearchResults(){this._userInteractions!==null&&this._userInteractions.clearSearchResults()}showSearchResults(t){this._userInteractions!==null&&this._userInteractions.showSearchResults(t.featureIds)}selectFeatures(t){if(this._userInteractions!==null){const r=this.modelFeatureIdList(t);this._userInteractions.selectFeatures(r)}}zoomToFeatures(t,r=null){if(r=l6(r,{select:!0,highlight:!1,padding:100}),this._userInteractions!==null){const n=this.modelFeatureIdList(t);this._userInteractions.zoomToFeatures(n,r)}}selectGeoJSONFeatures(t){this._userInteractions!==null&&this._userInteractions.selectFeatures(t)}zoomToGeoJSONFeatures(t,r=null){r=l6(r,{select:!0,highlight:!1,padding:100}),this._userInteractions!==null&&this._userInteractions.zoomToFeatures(t,r)}}hu=new WeakMap,du=new WeakMap,Zf=new WeakMap,Tl=new WeakMap,Wf=new WeakSet,hx=async function(e){if(!kt(this,Tl).has(e)){const t=await kt(this,du).loadJSON(`knowledge/label/${e}`);if("label"in t)return kt(this,Tl).set(e,t.label)}};class dx{constructor(t,r={}){this._mapServer=new f4t(t),this._options=r,this._mapList=[],this._mapNumber=0,this._initialisingMutex=new _6t,this._initialised=!1}async ensureInitialised_(){return await this._initialisingMutex.dispatch(async()=>{if(!this._initialised){this._mapList=[];const t=await this._mapServer.loadJSON("");for(const r of t)r.separateLayers="version"in r&&r.version>=yHt,this._mapList.push(r);await jO.load(this._mapServer),this._initialised=!0}})}allMaps(){return new Promise(async(t,r)=>{await this.ensureInitialised_();const n={};for(const i of this._mapList){const o="uuid"in i?i.uuid:i.id;n[o]=i}t(n)})}findMap_(t){return new Promise(async(r,n)=>{await this.ensureInitialised_(),r(this.lookupMap_(t))})}latestMap_(t){const r=t.constructor.name==="String"?t:"uuid"in t?t.uuid:"taxon"in t?t.taxon:null;if(r===null)return null;let n=null,i="";for(const o of this._mapList)if(("uuid"in o&&r===o.uuid||r===o.id||"taxon"in o&&r===o.taxon||r===o.source)&&(!("biologicalSex"in t)||"biologicalSex"in o&&t.biologicalSex===o.biologicalSex))if("created"in o)i<o.created&&(i=o.created,n=o);else{n=o;break}return n}lookupMap_(t){return typeof t=="object"?this.latestMap_(t):this.latestMap_({uuid:t})}loadMap(t,r,n,i={}){return new Promise(async(o,a)=>{try{const s=await this.findMap_(t);s===null&&a(`Unknown map: ${JSON.stringify(t)}`);const h="uuid"in s?s.uuid:s.id,d=await this._mapServer.loadJSON(`flatmap/${h}/`),f="uuid"in d?d.uuid:d.id;if(h!==f)throw new Error(`Map '${h}' has wrong ID in index`);const Q=Object.assign({},this._options,i);!("bounds"in i)&&"bounds"in d&&(Q.bounds=d.bounds),"style"in d?Q.style=d.style:Q.style="flatmap",!("image-layers"in d)&&"image_layer"in d&&(d["image-layers"]=d.image_layer);let m=[];if(!("version"in d)||d.version<=1)for(const O of d.layers)typeof O=="string"?m.push({id:O,description:O.charAt(0).toUpperCase()+O.slice(1),selectable:!0}):m.push(O);else m=await this._mapServer.loadJSON(`flatmap/${h}/layers`);const _=await this._mapServer.loadJSON(`flatmap/${h}/style`);"glyphs"in _||(_.glyphs="https://fonts.openmaptiles.org/{fontstack}/{range}.pbf");const v=await this._mapServer.loadJSON(`flatmap/${h}/pathways`),b=await this._mapServer.loadJSON(`flatmap/${h}/annotations`),M=await this._mapServer.loadJSON(`flatmap/${h}/metadata`),E=await this._mapServer.loadJSON(`flatmap/${h}/markers`);return"vector-tiles"in _.sources&&("minZoom"in Q||(Q.minZoom=_.sources["vector-tiles"].minzoom),"maxZoom"in Q||(Q.maxZoom=_.sources["vector-tiles"].maxzoom)),"layerOptions"in Q?("colour"in Q.layerOptions||(Q.layerOptions.colour=!0),"outline"in Q.layerOptions||(Q.layerOptions.outline=!0)):Q.layerOptions={colour:!0,outline:!0},Q.layerOptions.authoring="authoring"in d?d.authoring:!1,Q.separateLayers=s.separateLayers,this._mapNumber+=1,new bHt(r,this._mapServer,{id:s,uuid:h,details:d,taxon:s.taxon,biologicalSex:s.biologicalSex,style:_,options:Q,layers:m,markers:E,annotations:b,number:this._mapNumber,pathways:v,provenance:M,provenance:M,callback:n},o)}catch(s){a(s)}})}}Wm(dx,"version",gHt);/*! js-cookie v3.0.5 | MIT */function qf(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)e[n]=r[n]}return e}var LHt={read:function(e){return e[0]==='"'&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function px(e,t){function r(i,o,a){if(!(typeof document>"u")){a=qf({},t,a),typeof a.expires=="number"&&(a.expires=new Date(Date.now()+a.expires*864e5)),a.expires&&(a.expires=a.expires.toUTCString()),i=encodeURIComponent(i).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var h in a)a[h]&&(s+="; "+h,a[h]!==!0&&(s+="="+a[h].split(";")[0]));return document.cookie=i+"="+e.write(o,i)+s}}function n(i){if(!(typeof document>"u"||arguments.length&&!i)){for(var o=document.cookie?document.cookie.split("; "):[],a={},s=0;s<o.length;s++){var h=o[s].split("="),d=h.slice(1).join("=");try{var f=decodeURIComponent(h[0]);if(a[f]=e.read(d,f),i===f)break}catch{}}return i?a[i]:a}}return Object.create({set:r,get:n,remove:function(i,o){r(i,"",qf({},o,{expires:-1}))},withAttributes:function(i){return px(this.converter,qf({},this.attributes,i))},withConverter:function(i){return px(qf({},this.converter,i),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var Tx=px(LHt,{path:"/"}),Xa=function(e,t,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(e,r):i?i.value=r:t.set(e,r),r},wi=function(e,t,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(e):n?n.value:t.get(e)},l3,pu,Ka,G1,y4;const xHt=1e4;class wHt{constructor(t){l3.add(this),pu.set(this,void 0),Ka.set(this,null),G1.set(this,null),t.slice(-1)==="/"?Xa(this,pu,t.slice(0,-1),"f"):Xa(this,pu,t,"f")}get currentUser(){return wi(this,Ka,"f")}get currentError(){return wi(this,G1,"f")}async authenticate(t){Xa(this,G1,null,"f"),Xa(this,Ka,null,"f");const r=await wi(this,l3,"m",y4).call(this,t,"authenticate");return"error"in r?(Tx.remove("annotation-key"),Promise.resolve(wi(this,G1,"f"))):(Tx.set("annotation-key",r.session,{secure:!0,expires:1}),Xa(this,Ka,r.data,"f"),Promise.resolve(wi(this,Ka,"f")))}async unauthenticate(t){Xa(this,G1,null,"f"),Xa(this,Ka,null,"f");const r=await wi(this,l3,"m",y4).call(this,t,"unauthenticate");return"success"in r?Promise.resolve(r):Promise.resolve(wi(this,G1,"f"))}async annotatedItemIds(t,r,n,i){const o={resource:r};n!==void 0&&(o.user=n),i!==void 0&&(o.participated=i);const a=await wi(this,l3,"m",y4).call(this,t,"items/","GET",o);return"error"in a?Promise.resolve(wi(this,G1,"f")):Promise.resolve(a)}async drawnFeatures(t,r,n){const i={resource:r};n!==void 0&&(i.items=n);const o=await wi(this,l3,"m",y4).call(this,t,"features/","GET",i);return"error"in o?Promise.resolve(wi(this,G1,"f")):Promise.resolve(o)}async itemAnnotations(t,r,n){const i=await wi(this,l3,"m",y4).call(this,t,"annotations/","GET",{resource:r,item:n});return"error"in i?Promise.resolve(wi(this,G1,"f")):Promise.resolve(i)}async annotation(t,r){const n=await wi(this,l3,"m",y4).call(this,t,"annotation/","GET",{annotation:r});return"error"in n?Promise.resolve(wi(this,G1,"f")):Promise.resolve(n)}async addAnnotation(t,r){if(wi(this,Ka,"f")&&wi(this,Ka,"f").canUpdate){const n=Object.assign({creator:wi(this,Ka,"f"),created:new Date().toISOString()},r),i=await wi(this,l3,"m",y4).call(this,t,"annotation/","POST",{data:n});if(!("error"in i))return Promise.resolve(i);Xa(this,G1,i,"f")}else Xa(this,G1,{error:"user cannot add annotation"},"f");return Promise.resolve(wi(this,G1,"f"))}}pu=new WeakMap,Ka=new WeakMap,G1=new WeakMap,l3=new WeakSet,y4=async function(t,r,n="GET",i={}){let o=!0;const a=new AbortController;setTimeout(()=>{o&&(console.log("Annotation server timeout..."),a.abort())},xHt);const s={method:n,signal:a.signal};let h=`${wi(this,pu,"f")}/${r}`;const d=Tx.get("annotation-key")||"";if(n==="GET"){const Q=[];for(const[m,_]of Object.entries(i))Q.push(`${m}=${encodeURIComponent(JSON.stringify(_))}`);Q.push(`key=${encodeURIComponent(t)}`),Q.push(`session=${encodeURIComponent(d)}`),h+="?"+Q.join("&"),s.headers={Accept:"application/json; charset=utf-8","Cache-Control":"no-store"}}else if(n==="POST"){const Q=Object.assign({key:t,session:d},i);s.body=JSON.stringify(Q),s.headers={Accept:"application/json; charset=utf-8","Content-Type":"application/json; charset=utf-8","Cache-Control":"no-store"}}const f=await fetch(h,s);return o=!1,f.ok?Promise.resolve(await f.json()):(Xa(this,G1,{error:`${f.status} ${f.statusText}`},"f"),Promise.resolve(wi(this,G1,"f")))};var EHt=!1;function Xf(e,t,r){return Array.isArray(e)?(e.length=Math.max(e.length,t),e.splice(t,1,r),r):(e[t]=r,r)}function fx(e,t){if(Array.isArray(e)){e.splice(t,1);return}delete e[t]}/*!
1712
1712
  * pinia v2.1.7
1713
1713
  * (c) 2023 Eduardo San Martin Morote
1714
1714
  * @license MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abi-software/flatmapvuer",
3
- "version": "1.1.2-alpha-3",
3
+ "version": "1.1.2-alpha-5",
4
4
  "license": "Apache-2.0",
5
5
  "files": [
6
6
  "dist/*",
@@ -43,7 +43,7 @@
43
43
  "./src/*": "./src/*"
44
44
  },
45
45
  "dependencies": {
46
- "@abi-software/flatmap-viewer": "^2.9.1",
46
+ "@abi-software/flatmap-viewer": "^2.9.3",
47
47
  "@abi-software/sparc-annotation": "0.3.1",
48
48
  "@abi-software/svg-sprite": "1.0.0",
49
49
  "@element-plus/icons-vue": "^2.3.1",