@mapcreator/sdk 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/mapcreator-sdk.bundler.mjs +313 -283
- package/dist/mapcreator-sdk.mjs +54 -54
- package/dist/types/jobObject.d.ts +2 -2
- package/dist/utils/helpers.d.ts +0 -1
- package/dist/utils/jobObject.d.ts +2 -0
- package/package.json +1 -1
package/dist/mapcreator-sdk.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as i,MercatorCoordinate as a,Point as o,Popup as s}from"./maplibre-gl.mjs";var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:c(f(e)),h(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e));if(!Uint8Array.prototype.toBase64){let e={base64:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,base64url:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`};Uint8Array.prototype.toBase64=function(t){if(!(this instanceof Uint8Array))throw TypeError(`Receiver must be a Uint8Array`);let n=t?.alphabet??`base64`,r=t?.omitPadding??!1;if(n!==`base64`&&n!==`base64url`)throw TypeError(`alphabet must be 'base64' or 'base64url'`);if(typeof r!=`boolean`)throw TypeError(`omitPadding must be a boolean`);let i=e[n],a=this,o=a.length,s=[];for(var c=0;c+2<o;c+=3){let e=a[c]<<16|a[c+1]<<8|a[c+2];s.push(i[e>>18&63],i[e>>12&63],i[e>>6&63],i[e&63])}let l=o-c;if(l===1){let e=a[c]<<16;s.push(i[e>>18&63],i[e>>12&63]),r||s.push(`=`,`=`)}else if(l===2){let e=a[c]<<16|a[c+1]<<8;s.push(i[e>>18&63],i[e>>12&63],i[e>>6&63]),r||s.push(`=`)}return s.join(``)}}function _(e,t){for(let n of t.getStyle().layers){if(n.type!==`symbol`||n.id.startsWith(`custom-`)||n.id.startsWith(`gl-`))continue;let r=n.layout&&n.layout[`text-field`];n[`source-layer`]&&Array.isArray(r)&&r[0]===`coalesce`&&!r.find(e=>Array.isArray(e)&&e[1]===`name:abbr`)&&t.setLayoutProperty(n.id,`text-field`,v(n.source,e),{validate:!1})}}function v(e,t){return t!==`en`&&t!==`native`&&(t=x(t,y.TWO)),t===`native`?[`get`,`name`]:e.startsWith(`mc-base`)?[`coalesce`,[`get`,`name:${t}`],[`case`,[`has`,`name_is_latin`],[`get`,`name`],[`get`,`name:en`]]]:[`coalesce`,[`get`,`name:${t}`],[`get`,`name:en`],[`get`,`name`]]}var y=Object.freeze({THREE:`ISO 639-2/B`,API:`ISO 639-2/B`,TWO:`ISO 639-1`,MAPLIBRE_COMPAT:`ISO 639-1`,ENDONYM:`name`,NAME:`name`,LOCALE:`locale`,i18n:`locale`}),b=Object.freeze([{[y.TWO]:`en`,[y.THREE]:`eng`,[y.ENDONYM]:`English`,[y.LOCALE]:`en_GB`},{[y.TWO]:`da`,[y.THREE]:`dan`,[y.ENDONYM]:`Dansk`,[y.LOCALE]:`da_DK`},{[y.TWO]:`nl`,[y.THREE]:`dut`,[y.ENDONYM]:`Nederlands`,[y.LOCALE]:`nl_NL`},{[y.TWO]:`fi`,[y.THREE]:`fin`,[y.ENDONYM]:`Suomi`,[y.LOCALE]:`fi_FI`},{[y.TWO]:`fr`,[y.THREE]:`fre`,[y.ENDONYM]:`Francais`,[y.LOCALE]:`fr_FR`},{[y.TWO]:`de`,[y.THREE]:`ger`,[y.ENDONYM]:`Deutsch`,[y.LOCALE]:`de_DE`},{[y.TWO]:`it`,[y.THREE]:`ita`,[y.ENDONYM]:`Italiano`,[y.LOCALE]:`it_IT`},{[y.TWO]:`no`,[y.THREE]:`nor`,[y.ENDONYM]:`Norsk`,[y.LOCALE]:`nn_NO`},{[y.TWO]:`pl`,[y.THREE]:`pol`,[y.ENDONYM]:`Polski`,[y.LOCALE]:`pl_PL`},{[y.TWO]:`pt`,[y.THREE]:`por`,[y.ENDONYM]:`Portugues`,[y.LOCALE]:`pt_PT`},{[y.TWO]:`es`,[y.THREE]:`spa`,[y.ENDONYM]:`Espanol`,[y.LOCALE]:`es_ES`},{[y.TWO]:`sv`,[y.THREE]:`swe`,[y.ENDONYM]:`Svenska`,[y.LOCALE]:`sv_SE`},{[y.TWO]:`ja`,[y.THREE]:`jpn`,[y.ENDONYM]:`日本語`,[y.LOCALE]:`ja_JP`},{[y.TWO]:`zh`,[y.THREE]:`chi`,[y.ENDONYM]:`汉语`,[y.LOCALE]:`zh_CN`},{[y.TWO]:`ru`,[y.THREE]:`rus`,[y.ENDONYM]:`Русский`,[y.LOCALE]:`ru_RU`},{[y.TWO]:`uk`,[y.THREE]:`ukr`,[y.ENDONYM]:`Украї́нська`,[y.LOCALE]:`uk_UK`},{[y.TWO]:`lv`,[y.THREE]:`lav`,[y.ENDONYM]:`Latviešu valoda`,[y.LOCALE]:`lv-LV`},{[y.TWO]:`kk`,[y.THREE]:`kaz`,[y.ENDONYM]:`қазақша`,[y.LOCALE]:`kk-KZ`},{[y.TWO]:`ar`,[y.THREE]:`ara`,[y.ENDONYM]:`العربية`,[y.LOCALE]:`ar_SA`},{[y.TWO]:`native`,[y.THREE]:`native`,[y.ENDONYM]:`Native`,[y.LOCALE]:`native`}]);function x(e,t=y.MAPLIBRE_COMPAT){return(b.find(t=>Object.values(t).some(t=>t===e))??b[0])[t]}var S=/^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?\s*$/;function C(e){return e/180*Math.PI}function w(e){return e*180/Math.PI}function T(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-e.lng)*n);return 6371e3*Math.acos(Math.min(a,1))}function E(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}function D(e,t){return e.startsWith(`$`)?O(t[e.slice(1)]):e}function O(e){return typeof e==`string`?e:typeof e==`number`?String(e):typeof e==`boolean`?String(e).toUpperCase():typeof e==`object`&&e&&(e.t===`n`||e.t===`d`)?e.w??``:``}function k(e){return typeof e==`string`&&S.test(e)?Number(e):typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:typeof e==`object`&&e&&e.t===`n`?e.v:null}function A(e){return e=e.trim(),/^\$?[\w\-_]+$/.test(e)?e:(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)&?/.exec(e)||[])[1]}var j=72;function M(e,t,n){if(e===t)return n;let r={millimeter:1,centimeter:.1,meter:.001,kilometer:1e-6,foot:.00328084,mile:6.21371e-7,nauticalMile:5.39957e-7,inch:.0393701,pixel:.0393701*j,pica:.236222};return n/r[e]*r[t]}function N(e,t=`pixel`,n=j){return t===`pixel`?e:M(t,`pixel`,e)*(n/j)}var P;function F(){if(P===void 0){let e=document.createElement(`canvas`).getContext(`webgl`);try{P=e?e.getParameter(e.MAX_TEXTURE_SIZE):4096}catch{P=4096}finally{e?.getExtension(`WEBGL_lose_context`)?.loseContext()}}return[P,P]}function ee(e){return 2*Math.round(e/2)}function I(e,t,n){return e+(t-e)*n}function te(e,t,n){return(n-e)/(t-e)}function ne(e,t,n){return Math.max(Math.min(e,n),t)}function re(e){return Array.from(new Set(e))}function L(e){let t=e.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>(e^=t,e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)),2166136261);return t^=t<<3,t+=t>>5,t^=t<<4,t+=t>>17,t^=t<<25,t+=t>>6,`0000000${(t>>>0).toString(16)}`.substr(-8)}function R(e,t,n,r){if(t.clientWidth>0&&t.clientHeight>0){let i=e.export?.size??[600,400],a=e.export?.unit,o=[`jpg`,`png`,`tiff`].includes(r),s=N(i[0],a),c=N(i[1],a);return Math.min(t.clientWidth/(n===`video`?ee(s):o?Math.round(s):s),t.clientHeight/(n===`video`?ee(c):o?Math.round(c):c))}return 1}function z(e,t,n=1e-4){return Math.abs(e-t)<n}function ie(e,t,n){let{lng:r,lat:i}=e.getCenter(),a=e.getPitch()*Math.PI/180,o=e.getBearing()*Math.PI/180,s=ae(r,i),c=ae(t,n),l=oe(s,se(le(ce([0,0,1],s)),o),a);return l[0]*c[0]+l[1]*c[1]+l[2]*c[2]>.3}function ae(e,t){let n=t*Math.PI/180,r=e*Math.PI/180;return[Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]}function oe(e,t,n){let[r,i,a]=e,[o,s,c]=t,l=Math.cos(n),u=Math.sin(n),d=r*o+i*s+a*c;return[r*l+(s*a-c*i)*u+o*d*(1-l),i*l+(c*r-o*a)*u+s*d*(1-l),a*l+(o*i-s*r)*u+c*d*(1-l)]}function se(e,t){let[n,r,i]=e,a=Math.cos(t),o=Math.sin(t);return[n*a-r*o,n*o+r*a,i]}function ce(e,t){let[n,r,i]=e,[a,o,s]=t;return[r*s-i*o,i*a-n*s,n*o-r*a]}function le(e){let[t,n,r]=e,i=Math.hypot(t,n,r);return[t/i,n/i,r/i]}function ue(e,t){if(t===`video`)return;let n=Array.from(e.getContainer().querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),r=e.getCanvas().getBoundingClientRect(),i=n.map(e=>{let t=e.getBoundingClientRect(),n=t.x-r.x,i=t.y-r.y;return[n,i,n+t.width,i+t.height]});t===`static`&&(i.push([0,0,r.width,0]),i.push([r.width,0,r.width,r.height]),i.push([0,r.height,r.width,r.height]),i.push([0,0,0,r.height])),e.setLabelFreeAreas(i)}function de(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let{svg:i,scale:a=1}=e,o=new DOMParser().parseFromString(i,`image/svg+xml`).querySelector(`svg`);if(o){let i=new RegExp(S.toString().replace(/^\/\^|\$\/$/g,``).replace(/.*/,`^($&)[, ]($&)[, ]($&)[, ]($&)$$`)),s=o.getAttribute(`width`),c=o.getAttribute(`height`),l,u;if(s&&c&&S.test(s)&&S.test(c))l=Number(s),u=Number(c);else{let e=i.exec(o.getAttribute(`viewBox`));l=e?Number(e[3]):300,u=e?Number(e[4]):150}!o.getAttribute(`viewBox`)&&l>0&&u>0&&o.setAttribute(`viewBox`,`0 0 ${l} ${u}`);let d=()=>{o.setAttribute(`width`,String(l*a*t.getScale())),o.setAttribute(`height`,String(u*a*t.getScale()))};d(),n!==`interactive`&&t.on(`resize`,d),o.classList.add(`adornment-svg`),o.dataset.adornmentName=e.name,r.appendChild(o)}return r}var fe=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]),pe=class{vapiUrl;accessToken;cache=new Map;directFonts=new Set;registrations=new Map;fontMap;usedFontsCache=new Map;fontInjectedSvgCache=new Map;constructor(e,t,n){this.fontMap=e,this.vapiUrl=t,this.accessToken=n}resolve(e,t=`400`){let n=Array.from(this.fontMap.values()).filter(t=>t.name===e),r=n.find(t=>t.family!==e),i=r??{name:e,family:e,weight:t,style:`normal`},a=r!==void 0||n.length>0||this.directFonts.has(e)||Array.from(this.fontMap.values()).some(t=>t.family===e);return{...i,cssFamily:a?_e(i.family):ve(i.family)}}async loadFont(e){return this.cache.has(e)||this.cache.set(e,fetch(`${this.vapiUrl}/fonts/${encodeURIComponent(e)}.woff2?access_token=${this.accessToken}`).then(e=>e.ok?e.arrayBuffer():void 0).then(async t=>{if(t!==void 0)return document.fonts.add(await he(e,t)),this.directFonts.add(e),this.usedFontsCache=new Map,this.fontInjectedSvgCache=new Map,new Uint8Array(t).toBase64()}).catch(()=>void 0)),this.cache.get(e)}async loadReference(e,t=`400`){let n=this.resolve(e,t),r=be(n.cssFamily);await Promise.all(r.map(async({name:e,generic:t})=>{if(t)return;let i=Ce(this.fontMap.values(),e,n.weight,n.style),a=i?.name??(r.length===1?e:void 0);if(a===void 0)return;let o=await this.loadFont(a);if(i===void 0||o===void 0)return;let s=Te(i.family,i.weight,i.style);this.registrations.has(s)||this.registrations.set(s,(async()=>{document.fonts.add(await he(i.family,`url(data:font/woff2;base64,${o})`,{weight:i.weight,style:i.style}))})()),await this.registrations.get(s)})),await document.fonts.load(`${n.style} ${n.weight} 16px ${n.cssFamily}`).catch(()=>void 0)}getDirectFont(e){return this.directFonts.has(e)?{name:e,family:e,weight:`400`,style:`normal`}:void 0}},me=new FontFace(`mapcreator-font-probe`,`local("mapcreator-font-probe")`).family===new FontFace(`mapcreator-font-\\70 robe`,`local("mapcreator-font-probe")`).family;function he(e,t,n){return new FontFace(me?_e(e):e,t,n).load()}async function ge(e,t,n){let r=`${t}/stylesheets/ff-${e===`beta`?`b-`:``}${n}.css?access_token=${n}`,i=await fetch(r).then(e=>e.ok?e.text():void 0).catch(()=>void 0);if(i===void 0)return new Map;let a=document.createElement(`style`);a.textContent=i,document.head.insertBefore(a,document.head.firstChild);let o=a.sheet;if(o===null)return new Map;let s=new Map;for(let e of o.cssRules)if(e instanceof CSSFontFaceRule){let t=e.style,n=be(t.getPropertyValue(`font-family`))[0]?.name,r=t.getPropertyValue(`font-weight`).trim()||`400`,i=t.getPropertyValue(`font-style`).trim()||`normal`,a=t.getPropertyValue(`src`).match(/local\(\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|(?:\\.|[^)\\])*)\s*\)/i),o=a===null?void 0:be(a[1])[0]?.name;n&&o&&s.set(Te(n,r,i),{name:o,family:n,weight:r,style:i})}return s}function _e(e){return`"${Array.from(e,e=>{let t=e.charCodeAt(0);return t<=31||t===127?`\\${(t||65533).toString(16)} `:e===`"`||e===`\\`?`\\${e}`:e}).join(``)}"`}function ve(e){return be(e).map(({name:e,generic:t})=>t?e:_e(e)).join(`, `)}function ye(e){let t=e.trimStart(),n=t.startsWith(`"`)||t.startsWith(`'`),r=n?t.trimEnd().slice(1,-1):t,i=``,a=!1,o=r.matchAll(/\\(?:([0-9a-f]{1,6})(?:\r\n|[ \t\r\n\f])?|(\r\n|[\n\r\f])|([\s\S]))|([ \t\r\n\f]+)|([\s\S])/gi);for(let[,e,t,r,s,c]of o){if(s!==void 0&&!n){a=i.length>0;continue}let o=t===void 0?r??s??c:``;if(e!==void 0){let t=parseInt(e,16);o=String.fromCodePoint(!t||t>1114111||t>=55296&&t<=57343?65533:t)}o&&(i+=(a?` `:``)+o,a=!1)}return{name:i,generic:!n&&fe.has(i.toLowerCase())}}function be(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`\\`?i++:n?a===n&&(n=``):a===`"`||a===`'`?n=a:a===`,`&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.map(ye).filter(e=>e.name.length>0)}function xe(e){return e===`bold`?700:Number(e)||400}function Se(e,t){let n=xe(e.weight);return t<400?n<=t?[0,t-n]:[1,n-t]:t>500?n>=t?[0,n-t]:[1,t-n]:n>=t&&n<=500?[0,n-t]:n<t?[1,t-n]:[2,n-t]}function Ce(e,t,n,r=`normal`){let i=xe(n),a=Array.from(e).filter(e=>e.family.toLowerCase()===t.toLowerCase()),o=r===`italic`?[`italic`,`oblique`,`normal`]:r===`oblique`?[`oblique`,`italic`,`normal`]:[`normal`,`oblique`,`italic`];for(let e of o){let t=a.filter(t=>t.style===e);if(t.length>0)return t.sort((e,t)=>{let n=Se(e,i),r=Se(t,i);return n[0]-r[0]||n[1]-r[1]})[0]}}function we(e){return`font-family="${B(e.cssFamily)}" font-weight="${B(e.weight)}" font-style="${B(e.style)}"`}function Te(e,t,n){return`${e}|${t}|${n}`}function Ee(e){let t=[1/0,1/0,-1/0,-1/0];for(let n=0;n<e.length;++n)t[0]=Math.min(t[0],e[n][0]),t[1]=Math.min(t[1],e[n][1]),t[2]=Math.max(t[2],e[n][2]),t[3]=Math.max(t[3],e[n][3]);return t}function De(e,t,n){e[0]+=t,e[1]+=n,e[2]+=t,e[3]+=n}function Oe(e){e[0]=Math.round(e[0]),e[1]=Math.round(e[1]),e[2]=Math.round(e[2]),e[3]=Math.round(e[3])}
|
|
1
|
+
import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as i,MercatorCoordinate as a,Point as o,Popup as s}from"./maplibre-gl.mjs";var c=Object.create,l=Object.defineProperty,u=Object.getOwnPropertyDescriptor,d=Object.getOwnPropertyNames,f=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty,m=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),h=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=d(t),a=0,o=i.length,s;a<o;a++)s=i[a],!p.call(e,s)&&s!==n&&l(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=u(t,s))||r.enumerable});return e},g=(e,t,n)=>(n=e==null?{}:c(f(e)),h(t||!e||!e.__esModule?l(n,`default`,{value:e,enumerable:!0}):n,e));if(!Uint8Array.prototype.toBase64){let e={base64:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,base64url:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`};Uint8Array.prototype.toBase64=function(t){if(!(this instanceof Uint8Array))throw TypeError(`Receiver must be a Uint8Array`);let n=t?.alphabet??`base64`,r=t?.omitPadding??!1;if(n!==`base64`&&n!==`base64url`)throw TypeError(`alphabet must be 'base64' or 'base64url'`);if(typeof r!=`boolean`)throw TypeError(`omitPadding must be a boolean`);let i=e[n],a=this,o=a.length,s=[];for(var c=0;c+2<o;c+=3){let e=a[c]<<16|a[c+1]<<8|a[c+2];s.push(i[e>>18&63],i[e>>12&63],i[e>>6&63],i[e&63])}let l=o-c;if(l===1){let e=a[c]<<16;s.push(i[e>>18&63],i[e>>12&63]),r||s.push(`=`,`=`)}else if(l===2){let e=a[c]<<16|a[c+1]<<8;s.push(i[e>>18&63],i[e>>12&63],i[e>>6&63]),r||s.push(`=`)}return s.join(``)}}function _(e,t){for(let n of t.getStyle().layers){if(n.type!==`symbol`||n.id.startsWith(`custom-`)||n.id.startsWith(`gl-`))continue;let r=n.layout&&n.layout[`text-field`];n[`source-layer`]&&Array.isArray(r)&&r[0]===`coalesce`&&!r.find(e=>Array.isArray(e)&&e[1]===`name:abbr`)&&t.setLayoutProperty(n.id,`text-field`,v(n.source,e),{validate:!1})}}function v(e,t){return t!==`en`&&t!==`native`&&(t=x(t,y.TWO)),t===`native`?[`get`,`name`]:e.startsWith(`mc-base`)?[`coalesce`,[`get`,`name:${t}`],[`case`,[`has`,`name_is_latin`],[`get`,`name`],[`get`,`name:en`]]]:[`coalesce`,[`get`,`name:${t}`],[`get`,`name:en`],[`get`,`name`]]}var y=Object.freeze({THREE:`ISO 639-2/B`,API:`ISO 639-2/B`,TWO:`ISO 639-1`,MAPLIBRE_COMPAT:`ISO 639-1`,ENDONYM:`name`,NAME:`name`,LOCALE:`locale`,i18n:`locale`}),b=Object.freeze([{[y.TWO]:`en`,[y.THREE]:`eng`,[y.ENDONYM]:`English`,[y.LOCALE]:`en_GB`},{[y.TWO]:`da`,[y.THREE]:`dan`,[y.ENDONYM]:`Dansk`,[y.LOCALE]:`da_DK`},{[y.TWO]:`nl`,[y.THREE]:`dut`,[y.ENDONYM]:`Nederlands`,[y.LOCALE]:`nl_NL`},{[y.TWO]:`fi`,[y.THREE]:`fin`,[y.ENDONYM]:`Suomi`,[y.LOCALE]:`fi_FI`},{[y.TWO]:`fr`,[y.THREE]:`fre`,[y.ENDONYM]:`Francais`,[y.LOCALE]:`fr_FR`},{[y.TWO]:`de`,[y.THREE]:`ger`,[y.ENDONYM]:`Deutsch`,[y.LOCALE]:`de_DE`},{[y.TWO]:`it`,[y.THREE]:`ita`,[y.ENDONYM]:`Italiano`,[y.LOCALE]:`it_IT`},{[y.TWO]:`no`,[y.THREE]:`nor`,[y.ENDONYM]:`Norsk`,[y.LOCALE]:`nn_NO`},{[y.TWO]:`pl`,[y.THREE]:`pol`,[y.ENDONYM]:`Polski`,[y.LOCALE]:`pl_PL`},{[y.TWO]:`pt`,[y.THREE]:`por`,[y.ENDONYM]:`Portugues`,[y.LOCALE]:`pt_PT`},{[y.TWO]:`es`,[y.THREE]:`spa`,[y.ENDONYM]:`Espanol`,[y.LOCALE]:`es_ES`},{[y.TWO]:`sv`,[y.THREE]:`swe`,[y.ENDONYM]:`Svenska`,[y.LOCALE]:`sv_SE`},{[y.TWO]:`ja`,[y.THREE]:`jpn`,[y.ENDONYM]:`日本語`,[y.LOCALE]:`ja_JP`},{[y.TWO]:`zh`,[y.THREE]:`chi`,[y.ENDONYM]:`汉语`,[y.LOCALE]:`zh_CN`},{[y.TWO]:`ru`,[y.THREE]:`rus`,[y.ENDONYM]:`Русский`,[y.LOCALE]:`ru_RU`},{[y.TWO]:`uk`,[y.THREE]:`ukr`,[y.ENDONYM]:`Украї́нська`,[y.LOCALE]:`uk_UK`},{[y.TWO]:`lv`,[y.THREE]:`lav`,[y.ENDONYM]:`Latviešu valoda`,[y.LOCALE]:`lv-LV`},{[y.TWO]:`kk`,[y.THREE]:`kaz`,[y.ENDONYM]:`қазақша`,[y.LOCALE]:`kk-KZ`},{[y.TWO]:`ar`,[y.THREE]:`ara`,[y.ENDONYM]:`العربية`,[y.LOCALE]:`ar_SA`},{[y.TWO]:`native`,[y.THREE]:`native`,[y.ENDONYM]:`Native`,[y.LOCALE]:`native`}]);function x(e,t=y.MAPLIBRE_COMPAT){return(b.find(t=>Object.values(t).some(t=>t===e))??b[0])[t]}function S(e){return e/180*Math.PI}function C(e){return e*180/Math.PI}function w(e,t){let n=Math.PI/180,r=e.lat*n,i=t.lat*n,a=Math.sin(r)*Math.sin(i)+Math.cos(r)*Math.cos(i)*Math.cos((t.lng-e.lng)*n);return 6371e3*Math.acos(Math.min(a,1))}function T(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t&=t;return Math.abs(t)}function E(e,t){return e.startsWith(`$`)?D(t[e.slice(1)]):e}function D(e){return typeof e==`string`?e:typeof e==`number`?String(e):typeof e==`boolean`?String(e).toUpperCase():typeof e==`object`&&e&&(e.t===`n`||e.t===`d`)?e.w??``:``}function O(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`?e:typeof e==`object`&&e&&e.t===`n`?e.v:null}function k(e){return e=e.trim(),/^\$?[\w\-_]+$/.test(e)?e:(/(?:https?:\/\/)?(?:www\.)?youtu\.?be(?:\.com)?\/?.*(?:watch|embed)?(?:.*v=|v\/|\/)([\w\-_]+)&?/.exec(e)||[])[1]}var A=72;function j(e,t,n){if(e===t)return n;let r={millimeter:1,centimeter:.1,meter:.001,kilometer:1e-6,foot:.00328084,mile:6.21371e-7,nauticalMile:5.39957e-7,inch:.0393701,pixel:.0393701*A,pica:.236222};return n/r[e]*r[t]}function M(e,t=`pixel`,n=A){return t===`pixel`?e:j(t,`pixel`,e)*(n/A)}var N;function P(){if(N===void 0){let e=document.createElement(`canvas`).getContext(`webgl`);try{N=e?e.getParameter(e.MAX_TEXTURE_SIZE):4096}catch{N=4096}finally{e?.getExtension(`WEBGL_lose_context`)?.loseContext()}}return[N,N]}function F(e){return 2*Math.round(e/2)}function I(e,t,n){return e+(t-e)*n}function ee(e,t,n){return(n-e)/(t-e)}function L(e,t,n){return Math.max(Math.min(e,n),t)}function te(e){return Array.from(new Set(e))}function ne(e){let t=e.split(``).map(e=>e.charCodeAt(0)).reduce((e,t)=>(e^=t,e+(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24)),2166136261);return t^=t<<3,t+=t>>5,t^=t<<4,t+=t>>17,t^=t<<25,t+=t>>6,`0000000${(t>>>0).toString(16)}`.substr(-8)}function re(e,t,n,r){if(t.clientWidth>0&&t.clientHeight>0){let i=e.export?.size??[600,400],a=e.export?.unit,o=[`jpg`,`png`,`tiff`].includes(r),s=M(i[0],a),c=M(i[1],a);return Math.min(t.clientWidth/(n===`video`?F(s):o?Math.round(s):s),t.clientHeight/(n===`video`?F(c):o?Math.round(c):c))}return 1}function R(e,t,n=1e-4){return Math.abs(e-t)<n}function z(e,t,n){let{lng:r,lat:i}=e.getCenter(),a=e.getPitch()*Math.PI/180,o=e.getBearing()*Math.PI/180,s=ie(r,i),c=ie(t,n),l=ae(s,oe(ce(se([0,0,1],s)),o),a);return l[0]*c[0]+l[1]*c[1]+l[2]*c[2]>.3}function ie(e,t){let n=t*Math.PI/180,r=e*Math.PI/180;return[Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]}function ae(e,t,n){let[r,i,a]=e,[o,s,c]=t,l=Math.cos(n),u=Math.sin(n),d=r*o+i*s+a*c;return[r*l+(s*a-c*i)*u+o*d*(1-l),i*l+(c*r-o*a)*u+s*d*(1-l),a*l+(o*i-s*r)*u+c*d*(1-l)]}function oe(e,t){let[n,r,i]=e,a=Math.cos(t),o=Math.sin(t);return[n*a-r*o,n*o+r*a,i]}function se(e,t){let[n,r,i]=e,[a,o,s]=t;return[r*s-i*o,i*a-n*s,n*o-r*a]}function ce(e){let[t,n,r]=e,i=Math.hypot(t,n,r);return[t/i,n/i,r/i]}function le(e,t){if(t===`video`)return;let n=Array.from(e.getContainer().querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),r=e.getCanvas().getBoundingClientRect(),i=n.map(e=>{let t=e.getBoundingClientRect(),n=t.x-r.x,i=t.y-r.y;return[n,i,n+t.width,i+t.height]});t===`static`&&(i.push([0,0,r.width,0]),i.push([r.width,0,r.width,r.height]),i.push([0,r.height,r.width,r.height]),i.push([0,0,0,r.height])),e.setLabelFreeAreas(i)}var ue=/^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?\s*$/;function de(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let{svg:i,scale:a=1}=e,o=new DOMParser().parseFromString(i,`image/svg+xml`).querySelector(`svg`);if(o){let i=new RegExp(ue.toString().replace(/^\/\^|\$\/$/g,``).replace(/.*/,`^($&)[, ]($&)[, ]($&)[, ]($&)$$`)),s=o.getAttribute(`width`),c=o.getAttribute(`height`),l,u;if(s&&c&&ue.test(s)&&ue.test(c))l=Number(s),u=Number(c);else{let e=i.exec(o.getAttribute(`viewBox`));l=e?Number(e[3]):300,u=e?Number(e[4]):150}!o.getAttribute(`viewBox`)&&l>0&&u>0&&o.setAttribute(`viewBox`,`0 0 ${l} ${u}`);let d=()=>{o.setAttribute(`width`,String(l*a*t.getScale())),o.setAttribute(`height`,String(u*a*t.getScale()))};d(),n!==`interactive`&&t.on(`resize`,d),o.classList.add(`adornment-svg`),o.dataset.adornmentName=e.name,r.appendChild(o)}return r}var fe=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]),pe=class{vapiUrl;accessToken;cache=new Map;directFonts=new Set;registrations=new Map;fontMap;usedFontsCache=new Map;fontInjectedSvgCache=new Map;constructor(e,t,n){this.fontMap=e,this.vapiUrl=t,this.accessToken=n}resolve(e,t=`400`){let n=Array.from(this.fontMap.values()).filter(t=>t.name===e),r=n.find(t=>t.family!==e),i=r??{name:e,family:e,weight:t,style:`normal`},a=r!==void 0||n.length>0||this.directFonts.has(e)||Array.from(this.fontMap.values()).some(t=>t.family===e);return{...i,cssFamily:a?_e(i.family):ve(i.family)}}async loadFont(e){return this.cache.has(e)||this.cache.set(e,fetch(`${this.vapiUrl}/fonts/${encodeURIComponent(e)}.woff2?access_token=${this.accessToken}`).then(e=>e.ok?e.arrayBuffer():void 0).then(async t=>{if(t!==void 0)return document.fonts.add(await he(e,t)),this.directFonts.add(e),this.usedFontsCache=new Map,this.fontInjectedSvgCache=new Map,new Uint8Array(t).toBase64()}).catch(()=>void 0)),this.cache.get(e)}async loadReference(e,t=`400`){let n=this.resolve(e,t),r=be(n.cssFamily);await Promise.all(r.map(async({name:e,generic:t})=>{if(t)return;let i=Ce(this.fontMap.values(),e,n.weight,n.style),a=i?.name??(r.length===1?e:void 0);if(a===void 0)return;let o=await this.loadFont(a);if(i===void 0||o===void 0)return;let s=Te(i.family,i.weight,i.style);this.registrations.has(s)||this.registrations.set(s,(async()=>{document.fonts.add(await he(i.family,`url(data:font/woff2;base64,${o})`,{weight:i.weight,style:i.style}))})()),await this.registrations.get(s)})),await document.fonts.load(`${n.style} ${n.weight} 16px ${n.cssFamily}`).catch(()=>void 0)}getDirectFont(e){return this.directFonts.has(e)?{name:e,family:e,weight:`400`,style:`normal`}:void 0}},me=new FontFace(`mapcreator-font-probe`,`local("mapcreator-font-probe")`).family===new FontFace(`mapcreator-font-\\70 robe`,`local("mapcreator-font-probe")`).family;function he(e,t,n){return new FontFace(me?_e(e):e,t,n).load()}async function ge(e,t,n){let r=`${t}/stylesheets/ff-${e===`beta`?`b-`:``}${n}.css?access_token=${n}`,i=await fetch(r).then(e=>e.ok?e.text():void 0).catch(()=>void 0);if(i===void 0)return new Map;let a=document.createElement(`style`);a.textContent=i,document.head.insertBefore(a,document.head.firstChild);let o=a.sheet;if(o===null)return new Map;let s=new Map;for(let e of o.cssRules)if(e instanceof CSSFontFaceRule){let t=e.style,n=be(t.getPropertyValue(`font-family`))[0]?.name,r=t.getPropertyValue(`font-weight`).trim()||`400`,i=t.getPropertyValue(`font-style`).trim()||`normal`,a=t.getPropertyValue(`src`).match(/local\(\s*("(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|(?:\\.|[^)\\])*)\s*\)/i),o=a===null?void 0:be(a[1])[0]?.name;n&&o&&s.set(Te(n,r,i),{name:o,family:n,weight:r,style:i})}return s}function _e(e){return`"${Array.from(e,e=>{let t=e.charCodeAt(0);return t<=31||t===127?`\\${(t||65533).toString(16)} `:e===`"`||e===`\\`?`\\${e}`:e}).join(``)}"`}function ve(e){return be(e).map(({name:e,generic:t})=>t?e:_e(e)).join(`, `)}function ye(e){let t=e.trimStart(),n=t.startsWith(`"`)||t.startsWith(`'`),r=n?t.trimEnd().slice(1,-1):t,i=``,a=!1,o=r.matchAll(/\\(?:([0-9a-f]{1,6})(?:\r\n|[ \t\r\n\f])?|(\r\n|[\n\r\f])|([\s\S]))|([ \t\r\n\f]+)|([\s\S])/gi);for(let[,e,t,r,s,c]of o){if(s!==void 0&&!n){a=i.length>0;continue}let o=t===void 0?r??s??c:``;if(e!==void 0){let t=parseInt(e,16);o=String.fromCodePoint(!t||t>1114111||t>=55296&&t<=57343?65533:t)}o&&(i+=(a?` `:``)+o,a=!1)}return{name:i,generic:!n&&fe.has(i.toLowerCase())}}function be(e){let t=[],n=``,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`\\`?i++:n?a===n&&(n=``):a===`"`||a===`'`?n=a:a===`,`&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t.map(ye).filter(e=>e.name.length>0)}function xe(e){return e===`bold`?700:Number(e)||400}function Se(e,t){let n=xe(e.weight);return t<400?n<=t?[0,t-n]:[1,n-t]:t>500?n>=t?[0,n-t]:[1,t-n]:n>=t&&n<=500?[0,n-t]:n<t?[1,t-n]:[2,n-t]}function Ce(e,t,n,r=`normal`){let i=xe(n),a=Array.from(e).filter(e=>e.family.toLowerCase()===t.toLowerCase()),o=r===`italic`?[`italic`,`oblique`,`normal`]:r===`oblique`?[`oblique`,`italic`,`normal`]:[`normal`,`oblique`,`italic`];for(let e of o){let t=a.filter(t=>t.style===e);if(t.length>0)return t.sort((e,t)=>{let n=Se(e,i),r=Se(t,i);return n[0]-r[0]||n[1]-r[1]})[0]}}function we(e){return`font-family="${B(e.cssFamily)}" font-weight="${B(e.weight)}" font-style="${B(e.style)}"`}function Te(e,t,n){return`${e}|${t}|${n}`}function Ee(e){let t=[1/0,1/0,-1/0,-1/0];for(let n=0;n<e.length;++n)t[0]=Math.min(t[0],e[n][0]),t[1]=Math.min(t[1],e[n][1]),t[2]=Math.max(t[2],e[n][2]),t[3]=Math.max(t[3],e[n][3]);return t}function De(e,t,n){e[0]+=t,e[1]+=n,e[2]+=t,e[3]+=n}function Oe(e){e[0]=Math.round(e[0]),e[1]=Math.round(e[1]),e[2]=Math.round(e[2]),e[3]=Math.round(e[3])}
|
|
2
2
|
// @license
|
|
3
|
-
(function(){var e=function(e){return e.map(function(e){return{type:e.type,values:Array.prototype.slice.call(e.values)}})},t=function(e){var t=[],n=null,r=null,i=null,a=null;return e.forEach(function(e){var o=e.type;if(o===`M`){var s=e.values[0],c=e.values[1];t.push({type:`M`,values:[s,c]}),i=s,a=c,n=s,r=c}else if(o===`m`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`M`,values:[s,c]}),i=s,a=c,n=s,r=c}else if(o===`L`){var s=e.values[0],c=e.values[1];t.push({type:`L`,values:[s,c]}),n=s,r=c}else if(o===`l`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`L`,values:[s,c]}),n=s,r=c}else if(o===`C`){var l=e.values[0],u=e.values[1],d=e.values[2],f=e.values[3],s=e.values[4],c=e.values[5];t.push({type:`C`,values:[l,u,d,f,s,c]}),n=s,r=c}else if(o===`c`){var l=n+e.values[0],u=r+e.values[1],d=n+e.values[2],f=r+e.values[3],s=n+e.values[4],c=r+e.values[5];t.push({type:`C`,values:[l,u,d,f,s,c]}),n=s,r=c}else if(o===`Q`){var l=e.values[0],u=e.values[1],s=e.values[2],c=e.values[3];t.push({type:`Q`,values:[l,u,s,c]}),n=s,r=c}else if(o===`q`){var l=n+e.values[0],u=r+e.values[1],s=n+e.values[2],c=r+e.values[3];t.push({type:`Q`,values:[l,u,s,c]}),n=s,r=c}else if(o===`A`){var s=e.values[5],c=e.values[6];t.push({type:`A`,values:[e.values[0],e.values[1],e.values[2],e.values[3],e.values[4],s,c]}),n=s,r=c}else if(o===`a`){var s=n+e.values[5],c=r+e.values[6];t.push({type:`A`,values:[e.values[0],e.values[1],e.values[2],e.values[3],e.values[4],s,c]}),n=s,r=c}else if(o===`H`){var s=e.values[0];t.push({type:`H`,values:[s]}),n=s}else if(o===`h`){var s=n+e.values[0];t.push({type:`H`,values:[s]}),n=s}else if(o===`V`){var c=e.values[0];t.push({type:`V`,values:[c]}),r=c}else if(o===`v`){var c=r+e.values[0];t.push({type:`V`,values:[c]}),r=c}else if(o===`S`){var d=e.values[0],f=e.values[1],s=e.values[2],c=e.values[3];t.push({type:`S`,values:[d,f,s,c]}),n=s,r=c}else if(o===`s`){var d=n+e.values[0],f=r+e.values[1],s=n+e.values[2],c=r+e.values[3];t.push({type:`S`,values:[d,f,s,c]}),n=s,r=c}else if(o===`T`){var s=e.values[0],c=e.values[1];t.push({type:`T`,values:[s,c]}),n=s,r=c}else if(o===`t`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`T`,values:[s,c]}),n=s,r=c}else (o===`Z`||o===`z`)&&(t.push({type:`Z`,values:[]}),n=i,r=a)}),t},n=function(e){var t=[],n=null,i=null,a=null,o=null,s=null,c=null,l=null;return e.forEach(function(e){if(e.type===`M`){var u=e.values[0],d=e.values[1];t.push({type:`M`,values:[u,d]}),c=u,l=d,o=u,s=d}else if(e.type===`C`){var f=e.values[0],p=e.values[1],m=e.values[2],h=e.values[3],u=e.values[4],d=e.values[5];t.push({type:`C`,values:[f,p,m,h,u,d]}),i=m,a=h,o=u,s=d}else if(e.type===`L`){var u=e.values[0],d=e.values[1];t.push({type:`L`,values:[u,d]}),o=u,s=d}else if(e.type===`H`){var u=e.values[0];t.push({type:`L`,values:[u,s]}),o=u}else if(e.type===`V`){var d=e.values[0];t.push({type:`L`,values:[o,d]}),s=d}else if(e.type===`S`){var m=e.values[0],h=e.values[1],u=e.values[2],d=e.values[3],g,_;n===`C`||n===`S`?(g=o+(o-i),_=s+(s-a)):(g=o,_=s),t.push({type:`C`,values:[g,_,m,h,u,d]}),i=m,a=h,o=u,s=d}else if(e.type===`T`){var u=e.values[0],d=e.values[1],f,p;n===`Q`||n===`T`?(f=o+(o-i),p=s+(s-a)):(f=o,p=s);var g=o+2*(f-o)/3,_=s+2*(p-s)/3,v=u+2*(f-u)/3,y=d+2*(p-d)/3;t.push({type:`C`,values:[g,_,v,y,u,d]}),i=f,a=p,o=u,s=d}else if(e.type===`Q`){var f=e.values[0],p=e.values[1],u=e.values[2],d=e.values[3],g=o+2*(f-o)/3,_=s+2*(p-s)/3,v=u+2*(f-u)/3,y=d+2*(p-d)/3;t.push({type:`C`,values:[g,_,v,y,u,d]}),i=f,a=p,o=u,s=d}else if(e.type===`A`){var b=Math.abs(e.values[0]),x=Math.abs(e.values[1]),S=e.values[2],C=e.values[3],w=e.values[4],u=e.values[5],d=e.values[6];b===0||x===0?(t.push({type:`C`,values:[o,s,u,d,u,d]}),o=u,s=d):(o!==u||s!==d)&&(r(o,s,u,d,b,x,S,C,w).forEach(function(e){t.push({type:`C`,values:e})}),o=u,s=d)}else e.type===`Z`&&(t.push(e),o=c,s=l);n=e.type}),t},r=function(e,t,n,i,a,o,s,c,l,u){var d=function(e){return Math.PI*e/180},f=function(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}},p=d(s),m=[],h,g,_,v;if(u)h=u[0],g=u[1],_=u[2],v=u[3];else{var y=f(e,t,-p);e=y.x,t=y.y;var b=f(n,i,-p);n=b.x,i=b.y;var x=(e-n)/2,S=(t-i)/2,C=x*x/(a*a)+S*S/(o*o);C>1&&(C=Math.sqrt(C),a=C*a,o=C*o);var w=c===l?-1:1,T=a*a,E=o*o,D=T*E-T*S*S-E*x*x,O=T*S*S+E*x*x,k=w*Math.sqrt(Math.abs(D/O));_=k*a*S/o+(e+n)/2,v=k*-o*x/a+(t+i)/2,h=Math.asin(parseFloat(((t-v)/o).toFixed(9))),g=Math.asin(parseFloat(((i-v)/o).toFixed(9))),e<_&&(h=Math.PI-h),n<_&&(g=Math.PI-g),h<0&&(h=Math.PI*2+h),g<0&&(g=Math.PI*2+g),l&&h>g&&(h-=Math.PI*2),!l&&g>h&&(g-=Math.PI*2)}var A=g-h;if(Math.abs(A)>Math.PI*120/180){var j=g,M=n,N=i;g=l&&g>h?h+Math.PI*120/180*1:h+Math.PI*120/180*-1,n=_+a*Math.cos(g),i=v+o*Math.sin(g),m=r(n,i,M,N,a,o,s,0,l,[g,j,_,v])}A=g-h;var P=Math.cos(h),F=Math.sin(h),
|
|
3
|
+
(function(){var e=function(e){return e.map(function(e){return{type:e.type,values:Array.prototype.slice.call(e.values)}})},t=function(e){var t=[],n=null,r=null,i=null,a=null;return e.forEach(function(e){var o=e.type;if(o===`M`){var s=e.values[0],c=e.values[1];t.push({type:`M`,values:[s,c]}),i=s,a=c,n=s,r=c}else if(o===`m`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`M`,values:[s,c]}),i=s,a=c,n=s,r=c}else if(o===`L`){var s=e.values[0],c=e.values[1];t.push({type:`L`,values:[s,c]}),n=s,r=c}else if(o===`l`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`L`,values:[s,c]}),n=s,r=c}else if(o===`C`){var l=e.values[0],u=e.values[1],d=e.values[2],f=e.values[3],s=e.values[4],c=e.values[5];t.push({type:`C`,values:[l,u,d,f,s,c]}),n=s,r=c}else if(o===`c`){var l=n+e.values[0],u=r+e.values[1],d=n+e.values[2],f=r+e.values[3],s=n+e.values[4],c=r+e.values[5];t.push({type:`C`,values:[l,u,d,f,s,c]}),n=s,r=c}else if(o===`Q`){var l=e.values[0],u=e.values[1],s=e.values[2],c=e.values[3];t.push({type:`Q`,values:[l,u,s,c]}),n=s,r=c}else if(o===`q`){var l=n+e.values[0],u=r+e.values[1],s=n+e.values[2],c=r+e.values[3];t.push({type:`Q`,values:[l,u,s,c]}),n=s,r=c}else if(o===`A`){var s=e.values[5],c=e.values[6];t.push({type:`A`,values:[e.values[0],e.values[1],e.values[2],e.values[3],e.values[4],s,c]}),n=s,r=c}else if(o===`a`){var s=n+e.values[5],c=r+e.values[6];t.push({type:`A`,values:[e.values[0],e.values[1],e.values[2],e.values[3],e.values[4],s,c]}),n=s,r=c}else if(o===`H`){var s=e.values[0];t.push({type:`H`,values:[s]}),n=s}else if(o===`h`){var s=n+e.values[0];t.push({type:`H`,values:[s]}),n=s}else if(o===`V`){var c=e.values[0];t.push({type:`V`,values:[c]}),r=c}else if(o===`v`){var c=r+e.values[0];t.push({type:`V`,values:[c]}),r=c}else if(o===`S`){var d=e.values[0],f=e.values[1],s=e.values[2],c=e.values[3];t.push({type:`S`,values:[d,f,s,c]}),n=s,r=c}else if(o===`s`){var d=n+e.values[0],f=r+e.values[1],s=n+e.values[2],c=r+e.values[3];t.push({type:`S`,values:[d,f,s,c]}),n=s,r=c}else if(o===`T`){var s=e.values[0],c=e.values[1];t.push({type:`T`,values:[s,c]}),n=s,r=c}else if(o===`t`){var s=n+e.values[0],c=r+e.values[1];t.push({type:`T`,values:[s,c]}),n=s,r=c}else (o===`Z`||o===`z`)&&(t.push({type:`Z`,values:[]}),n=i,r=a)}),t},n=function(e){var t=[],n=null,i=null,a=null,o=null,s=null,c=null,l=null;return e.forEach(function(e){if(e.type===`M`){var u=e.values[0],d=e.values[1];t.push({type:`M`,values:[u,d]}),c=u,l=d,o=u,s=d}else if(e.type===`C`){var f=e.values[0],p=e.values[1],m=e.values[2],h=e.values[3],u=e.values[4],d=e.values[5];t.push({type:`C`,values:[f,p,m,h,u,d]}),i=m,a=h,o=u,s=d}else if(e.type===`L`){var u=e.values[0],d=e.values[1];t.push({type:`L`,values:[u,d]}),o=u,s=d}else if(e.type===`H`){var u=e.values[0];t.push({type:`L`,values:[u,s]}),o=u}else if(e.type===`V`){var d=e.values[0];t.push({type:`L`,values:[o,d]}),s=d}else if(e.type===`S`){var m=e.values[0],h=e.values[1],u=e.values[2],d=e.values[3],g,_;n===`C`||n===`S`?(g=o+(o-i),_=s+(s-a)):(g=o,_=s),t.push({type:`C`,values:[g,_,m,h,u,d]}),i=m,a=h,o=u,s=d}else if(e.type===`T`){var u=e.values[0],d=e.values[1],f,p;n===`Q`||n===`T`?(f=o+(o-i),p=s+(s-a)):(f=o,p=s);var g=o+2*(f-o)/3,_=s+2*(p-s)/3,v=u+2*(f-u)/3,y=d+2*(p-d)/3;t.push({type:`C`,values:[g,_,v,y,u,d]}),i=f,a=p,o=u,s=d}else if(e.type===`Q`){var f=e.values[0],p=e.values[1],u=e.values[2],d=e.values[3],g=o+2*(f-o)/3,_=s+2*(p-s)/3,v=u+2*(f-u)/3,y=d+2*(p-d)/3;t.push({type:`C`,values:[g,_,v,y,u,d]}),i=f,a=p,o=u,s=d}else if(e.type===`A`){var b=Math.abs(e.values[0]),x=Math.abs(e.values[1]),S=e.values[2],C=e.values[3],w=e.values[4],u=e.values[5],d=e.values[6];b===0||x===0?(t.push({type:`C`,values:[o,s,u,d,u,d]}),o=u,s=d):(o!==u||s!==d)&&(r(o,s,u,d,b,x,S,C,w).forEach(function(e){t.push({type:`C`,values:e})}),o=u,s=d)}else e.type===`Z`&&(t.push(e),o=c,s=l);n=e.type}),t},r=function(e,t,n,i,a,o,s,c,l,u){var d=function(e){return Math.PI*e/180},f=function(e,t,n){return{x:e*Math.cos(n)-t*Math.sin(n),y:e*Math.sin(n)+t*Math.cos(n)}},p=d(s),m=[],h,g,_,v;if(u)h=u[0],g=u[1],_=u[2],v=u[3];else{var y=f(e,t,-p);e=y.x,t=y.y;var b=f(n,i,-p);n=b.x,i=b.y;var x=(e-n)/2,S=(t-i)/2,C=x*x/(a*a)+S*S/(o*o);C>1&&(C=Math.sqrt(C),a=C*a,o=C*o);var w=c===l?-1:1,T=a*a,E=o*o,D=T*E-T*S*S-E*x*x,O=T*S*S+E*x*x,k=w*Math.sqrt(Math.abs(D/O));_=k*a*S/o+(e+n)/2,v=k*-o*x/a+(t+i)/2,h=Math.asin(parseFloat(((t-v)/o).toFixed(9))),g=Math.asin(parseFloat(((i-v)/o).toFixed(9))),e<_&&(h=Math.PI-h),n<_&&(g=Math.PI-g),h<0&&(h=Math.PI*2+h),g<0&&(g=Math.PI*2+g),l&&h>g&&(h-=Math.PI*2),!l&&g>h&&(g-=Math.PI*2)}var A=g-h;if(Math.abs(A)>Math.PI*120/180){var j=g,M=n,N=i;g=l&&g>h?h+Math.PI*120/180*1:h+Math.PI*120/180*-1,n=_+a*Math.cos(g),i=v+o*Math.sin(g),m=r(n,i,M,N,a,o,s,0,l,[g,j,_,v])}A=g-h;var P=Math.cos(h),F=Math.sin(h),I=Math.cos(g),ee=Math.sin(g),L=Math.tan(A/4),te=4/3*a*L,ne=4/3*o*L,re=[e,t],R=[e+te*F,t-ne*P],z=[n+te*ee,i-ne*I],ie=[n,i];if(R[0]=2*re[0]-R[0],R[1]=2*re[1]-R[1],u)return[R,z,ie].concat(m);m=[R,z,ie].concat(m);for(var ae=[],oe=0;oe<m.length;oe+=3){var a=f(m[oe][0],m[oe][1],p),o=f(m[oe+1][0],m[oe+1][1],p),se=f(m[oe+2][0],m[oe+2][1],p);ae.push([a.x,a.y,o.x,o.y,se.x,se.y])}return ae};let i=SVGPathElement.prototype.getPathData!==void 0&&SVGPathElement.prototype.setPathData!==void 0;if(i)try{document.createElementNS(`http://www.w3.org/2000/svg`,`path`).setPathData([{type:`M`,values:[0,0]}])}catch{i=!1}if(i===!1){var a={Z:`Z`,M:`M`,L:`L`,C:`C`,Q:`Q`,A:`A`,H:`H`,V:`V`,S:`S`,T:`T`,z:`Z`,m:`m`,l:`l`,c:`c`,q:`q`,a:`a`,h:`h`,v:`v`,s:`s`,t:`t`},o=function(e){this._string=e,this._currentIndex=0,this._endIndex=this._string.length,this._prevCommand=null,this._skipOptionalSpaces()},s=window.navigator.userAgent.indexOf(`MSIE `)!==-1;o.prototype={parseSegment:function(){var e=this._string[this._currentIndex],t=a[e]?a[e]:null;if(t===null){if(this._prevCommand===null||(t=(e===`+`||e===`-`||e===`.`||e>=`0`&&e<=`9`)&&this._prevCommand!==`Z`?this._prevCommand===`M`?`L`:this._prevCommand===`m`?`l`:this._prevCommand:null,t===null))return null}else this._currentIndex+=1;this._prevCommand=t;var n=null,r=t.toUpperCase();return r===`H`||r===`V`?n=[this._parseNumber()]:r===`M`||r===`L`||r===`T`?n=[this._parseNumber(),this._parseNumber()]:r===`S`||r===`Q`?n=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:r===`C`?n=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseNumber()]:r===`A`?n=[this._parseNumber(),this._parseNumber(),this._parseNumber(),this._parseArcFlag(),this._parseArcFlag(),this._parseNumber(),this._parseNumber()]:r===`Z`&&(this._skipOptionalSpaces(),n=[]),n===null||n.indexOf(null)>=0?null:{type:t,values:n}},hasMoreData:function(){return this._currentIndex<this._endIndex},peekSegmentType:function(){var e=this._string[this._currentIndex];return a[e]?a[e]:null},initialCommandIsMoveTo:function(){if(!this.hasMoreData())return!0;var e=this.peekSegmentType();return e===`M`||e===`m`},_isCurrentSpace:function(){var e=this._string[this._currentIndex];return e<=` `&&(e===` `||e===`
|
|
4
4
|
`||e===` `||e===`\r`||e===`\f`)},_skipOptionalSpaces:function(){for(;this._currentIndex<this._endIndex&&this._isCurrentSpace();)this._currentIndex+=1;return this._currentIndex<this._endIndex},_skipOptionalSpacesOrDelimiter:function(){return this._currentIndex<this._endIndex&&!this._isCurrentSpace()&&this._string[this._currentIndex]!==`,`?!1:(this._skipOptionalSpaces()&&this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`,`&&(this._currentIndex+=1,this._skipOptionalSpaces()),this._currentIndex<this._endIndex)},_parseNumber:function(){var e=0,t=0,n=1,r=0,i=1,a=1,o=this._currentIndex;if(this._skipOptionalSpaces(),this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`+`?this._currentIndex+=1:this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`-`&&(this._currentIndex+=1,i=-1),this._currentIndex===this._endIndex||(this._string[this._currentIndex]<`0`||this._string[this._currentIndex]>`9`)&&this._string[this._currentIndex]!==`.`)return null;for(var s=this._currentIndex;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>=`0`&&this._string[this._currentIndex]<=`9`;)this._currentIndex+=1;if(this._currentIndex!==s)for(var c=this._currentIndex-1,l=1;c>=s;)t+=l*(this._string[c]-`0`),--c,l*=10;if(this._currentIndex<this._endIndex&&this._string[this._currentIndex]===`.`){if(this._currentIndex+=1,this._currentIndex>=this._endIndex||this._string[this._currentIndex]<`0`||this._string[this._currentIndex]>`9`)return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>=`0`&&this._string[this._currentIndex]<=`9`;)n*=10,r+=(this._string.charAt(this._currentIndex)-`0`)/n,this._currentIndex+=1}if(this._currentIndex!==o&&this._currentIndex+1<this._endIndex&&(this._string[this._currentIndex]===`e`||this._string[this._currentIndex]===`E`)&&this._string[this._currentIndex+1]!==`x`&&this._string[this._currentIndex+1]!==`m`){if(this._currentIndex+=1,this._string[this._currentIndex]===`+`?this._currentIndex+=1:this._string[this._currentIndex]===`-`&&(this._currentIndex+=1,a=-1),this._currentIndex>=this._endIndex||this._string[this._currentIndex]<`0`||this._string[this._currentIndex]>`9`)return null;for(;this._currentIndex<this._endIndex&&this._string[this._currentIndex]>=`0`&&this._string[this._currentIndex]<=`9`;)e*=10,e+=this._string[this._currentIndex]-`0`,this._currentIndex+=1}var u=t+r;return u*=i,e&&(u*=10**(a*e)),o===this._currentIndex?null:(this._skipOptionalSpacesOrDelimiter(),u)},_parseArcFlag:function(){if(this._currentIndex>=this._endIndex)return null;var e=null,t=this._string[this._currentIndex];if(this._currentIndex+=1,t===`0`)e=0;else if(t===`1`)e=1;else return null;return this._skipOptionalSpacesOrDelimiter(),e}};var c=function(e){if(!e||e.length===0)return[];var t=new o(e),n=[];if(t.initialCommandIsMoveTo())for(;t.hasMoreData();){var r=t.parseSegment();if(r===null)break;n.push(r)}return n},l=SVGPathElement.prototype.setAttribute,u=SVGPathElement.prototype.setAttributeNS,d=SVGPathElement.prototype.removeAttribute,f=SVGPathElement.prototype.removeAttributeNS,p=window.Symbol?Symbol():`__cachedPathData`,m=window.Symbol?Symbol():`__cachedNormalizedPathData`;SVGPathElement.prototype.setAttribute=function(e,t){e===`d`&&(this[p]=null,this[m]=null),l.call(this,e,t)},SVGPathElement.prototype.setAttributeNS=function(e,t,n){if(t===`d`){var r=`http://www.w3.org/2000/svg`;if(e)for(var i of this.ownerSVGElement.attributes)i.name===`xmlns:${e}`&&(r=i.value);r===`http://www.w3.org/2000/svg`&&(this[p]=null,this[m]=null)}u.call(this,e,t,n)},SVGPathElement.prototype.removeAttribute=function(e,t){e===`d`&&(this[p]=null,this[m]=null),d.call(this,e)},SVGPathElement.prototype.removeAttributeNS=function(e,t){if(t===`d`){var n=`http://www.w3.org/2000/svg`;if(e)for(var r of this.ownerSVGElement.attributes)r.name===`xmlns:${e}`&&(n=r.value);n===`http://www.w3.org/2000/svg`&&(this[p]=null,this[m]=null)}f.call(this,e,t)},SVGPathElement.prototype.getPathData=function(r){if(r&&r.normalize){if(this[m])return e(this[m]);var i;this[p]?i=e(this[p]):(i=c(this.getAttribute(`d`)||``),this[p]=e(i));var a=n(t(i));return this[m]=e(a),a}else if(this[p])return e(this[p]);else{var i=c(this.getAttribute(`d`)||``);return this[p]=e(i),i}},SVGPathElement.prototype.setPathData=function(e){if(e.length===0)s?this.setAttribute(`d`,``):this.removeAttribute(`d`);else{for(var t=``,n=0,r=e.length;n<r;n+=1){var i=e[n];n>0&&(t+=` `),t+=i.type,i.values&&i.values.length>0&&(t+=` `+i.values.join(` `))}this.setAttribute(`d`,t)}}}SVGRectElement.prototype.getPathData||(SVGRectElement.prototype.getPathData=function(e){var t=this.x.baseVal.value,r=this.y.baseVal.value,i=this.width.baseVal.value,a=this.height.baseVal.value,o=this.hasAttribute(`rx`)?this.rx.baseVal.value:this.ry.baseVal.value,s=this.hasAttribute(`ry`)?this.ry.baseVal.value:this.rx.baseVal.value;o>i/2&&(o=i/2),s>a/2&&(s=a/2);var c=[{type:`M`,values:[t+o,r]},{type:`H`,values:[t+i-o]},{type:`A`,values:[o,s,0,0,1,t+i,r+s]},{type:`V`,values:[r+a-s]},{type:`A`,values:[o,s,0,0,1,t+i-o,r+a]},{type:`H`,values:[t+o]},{type:`A`,values:[o,s,0,0,1,t,r+a-s]},{type:`V`,values:[r+s]},{type:`A`,values:[o,s,0,0,1,t+o,r]},{type:`Z`,values:[]}];return c=c.filter(function(e){return!(e.type===`A`&&(e.values[0]===0||e.values[1]===0))}),e&&e.normalize===!0&&(c=n(c)),c}),SVGCircleElement.prototype.getPathData||(SVGCircleElement.prototype.getPathData=function(e){var t=this.cx.baseVal.value,r=this.cy.baseVal.value,i=this.r.baseVal.value,a=[{type:`M`,values:[t+i,r]},{type:`A`,values:[i,i,0,0,1,t,r+i]},{type:`A`,values:[i,i,0,0,1,t-i,r]},{type:`A`,values:[i,i,0,0,1,t,r-i]},{type:`A`,values:[i,i,0,0,1,t+i,r]},{type:`Z`,values:[]}];return e&&e.normalize===!0&&(a=n(a)),a}),SVGEllipseElement.prototype.getPathData||(SVGEllipseElement.prototype.getPathData=function(e){var t=this.cx.baseVal.value,r=this.cy.baseVal.value,i=this.rx.baseVal.value,a=this.ry.baseVal.value,o=[{type:`M`,values:[t+i,r]},{type:`A`,values:[i,a,0,0,1,t,r+a]},{type:`A`,values:[i,a,0,0,1,t-i,r]},{type:`A`,values:[i,a,0,0,1,t,r-a]},{type:`A`,values:[i,a,0,0,1,t+i,r]},{type:`Z`,values:[]}];return e&&e.normalize===!0&&(o=n(o)),o}),SVGLineElement.prototype.getPathData||(SVGLineElement.prototype.getPathData=function(){return[{type:`M`,values:[this.x1.baseVal.value,this.y1.baseVal.value]},{type:`L`,values:[this.x2.baseVal.value,this.y2.baseVal.value]}]}),SVGPolylineElement.prototype.getPathData||(SVGPolylineElement.prototype.getPathData=function(){for(var e=[],t=0;t<this.points.numberOfItems;t+=1){var n=this.points.getItem(t);e.push({type:t===0?`M`:`L`,values:[n.x,n.y]})}return e}),SVGPolygonElement.prototype.getPathData||(SVGPolygonElement.prototype.getPathData=function(){for(var e=[],t=0;t<this.points.numberOfItems;t+=1){var n=this.points.getItem(t);e.push({type:t===0?`M`:`L`,values:[n.x,n.y]})}return e.push({type:`Z`,values:[]}),e})})();function B(e){return String(e).replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function V(e,t,n=1e-4){return Math.abs(e-t)<n}async function ke(e,t,n,r){let i=Re(e,r),a=await Promise.all(i.map(e=>r.loadFont(e.name)));e=ze(e,r,i,a);let o=new Blob([e],{type:`image/svg+xml`}),s=URL.createObjectURL(o),c=new Image;c.width=t,c.height=n,c.src=s;try{await c.decode()}finally{URL.revokeObjectURL(s)}return c}function Ae(e,t=e.getBoundingClientRect()){let n=e.querySelectorAll(`.adornment-svg`);return Array.from(n).map(e=>{let n=e.outerHTML,r=e.dataset.adornmentName,i=e.getBoundingClientRect();return{name:r,svg:n,x:i.left-t.left,y:i.top-t.top,w:i.width,h:i.height}})}async function je(e,t,n,r=n.getBoundingClientRect()){let{fonts:i}=t,a=e.canvas.width/r.width,o=e.canvas.height/r.height,s=await Promise.all(Ae(n,r).map(async({svg:e,x:t,y:n,w:r,h:s})=>{let c=r*a,l=s*o;return{image:await ke(e,c,l,i),x:t*a,y:n*o,width:c,height:l}}));for(let t of s)e.drawImage(t.image,t.x,t.y,t.width,t.height)}var Me=/\$\{([^}]+)}/g,Ne=new DOMParser,Pe=new XMLSerializer,Fe=new Map;function Ie(e){let t=Fe.get(e);return t||(t=Ne.parseFromString(e,`image/svg+xml`).documentElement,Fe.set(e,t)),t}function Le(e){let t=Pe.serializeToString(e);return Fe.has(t)||Fe.set(t,e),t}function Re(e,t){if(!t.usedFontsCache.has(e)){let n=new Map,r=Ie(e);document.body.appendChild(r);try{r.querySelectorAll(`text,tspan`).forEach(e=>{let r=window.getComputedStyle(e);be(r.fontFamily).forEach(({name:e,generic:i})=>{if(i)return;let a=Ce(t.fontMap.values(),e,r.fontWeight,r.fontStyle)??t.getDirectFont(e);a!==void 0&&n.set(Te(a.family,a.weight,a.style),a)})}),t.usedFontsCache.set(e,Array.from(n.values()))}finally{document.body.removeChild(r)}}return t.usedFontsCache.get(e)??[]}function ze(e,t,n,r){if(!t.fontInjectedSvgCache.has(e)){let i=n.map((e,t)=>{let n=r[t];return n===void 0?``:`
|
|
5
5
|
@font-face {
|
|
6
6
|
font-family: ${_e(e.family)};
|
|
@@ -8,11 +8,11 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
8
8
|
font-style: ${e.style};
|
|
9
9
|
src: url(data:font/woff2;base64,${n});
|
|
10
10
|
}
|
|
11
|
-
`}).join(``);if(i.length!==0){let n=Ie(e).cloneNode(!0),r=n.querySelector(`defs`);r===null&&(r=n.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`defs`),n.prepend(r));let a=n.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`style`);a.textContent=i,r.appendChild(a),t.fontInjectedSvgCache.set(e,Pe.serializeToString(n))}else t.fontInjectedSvgCache.set(e,e)}return t.fontInjectedSvgCache.get(e)??e}var Be=new Map;function Ve(e){let t=Be.get(e);if(t)return t;let n=Ie(e),r=n.querySelectorAll(`[mol_embed]`),i=r.length?Array.from(r):[n];document.body.appendChild(n);let a;try{let e=n.getBoundingClientRect();a=Ee(i.map(e=>{let{x:t,y:n,width:r,height:i}=e.getBoundingClientRect();return[t,n,t+r,n+i]})),De(a,-e.x,-e.y),Oe(a)}finally{document.body.removeChild(n)}return Be.set(e,a),a}var He=class{_seen=[];_svg=null;_element=null;constructor(e){this._svg=e}setElement(){return this._element=Ie(this._svg).cloneNode(!0),this._svg=null,this._element}getSvgString(){return this._svg??Le(this._element)}getSvgSize(){let e=this._element??Ie(this._svg);return[e.width.baseVal.value,e.height.baseVal.value]}getSvgColors(){let e=[],t=[],n=(this._element??Ie(this._svg)).querySelectorAll(`[mol_edit_style=true]`);for(let r=0;r<n.length;++r){let i=n[r],a=i.id;if(a&&t.every(e=>e.id!==a)){let n=i.getAttribute(`fill`)?.trim();if(n){let r=new Ze(n);if(r.badValue)e.push({name:`fill#${a}`,color:n});else{let{rgba:t}=r,n=i.getAttribute(`fill-opacity`);t[3]*=n?
|
|
11
|
+
`}).join(``);if(i.length!==0){let n=Ie(e).cloneNode(!0),r=n.querySelector(`defs`);r===null&&(r=n.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`defs`),n.prepend(r));let a=n.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`style`);a.textContent=i,r.appendChild(a),t.fontInjectedSvgCache.set(e,Pe.serializeToString(n))}else t.fontInjectedSvgCache.set(e,e)}return t.fontInjectedSvgCache.get(e)??e}var Be=new Map;function Ve(e){let t=Be.get(e);if(t)return t;let n=Ie(e),r=n.querySelectorAll(`[mol_embed]`),i=r.length?Array.from(r):[n];document.body.appendChild(n);let a;try{let e=n.getBoundingClientRect();a=Ee(i.map(e=>{let{x:t,y:n,width:r,height:i}=e.getBoundingClientRect();return[t,n,t+r,n+i]})),De(a,-e.x,-e.y),Oe(a)}finally{document.body.removeChild(n)}return Be.set(e,a),a}var He=class{_seen=[];_svg=null;_element=null;constructor(e){this._svg=e}setElement(){return this._element=Ie(this._svg).cloneNode(!0),this._svg=null,this._element}getSvgString(){return this._svg??Le(this._element)}getSvgSize(){let e=this._element??Ie(this._svg);return[e.width.baseVal.value,e.height.baseVal.value]}getSvgColors(){let e=[],t=[],n=(this._element??Ie(this._svg)).querySelectorAll(`[mol_edit_style=true]`);for(let r=0;r<n.length;++r){let i=n[r],a=i.id;if(a&&t.every(e=>e.id!==a)){let n=i.getAttribute(`fill`)?.trim();if(n){let r=new Ze(n);if(r.badValue)e.push({name:`fill#${a}`,color:n});else{let{rgba:t}=r,n=i.getAttribute(`fill-opacity`);t[3]*=n?L(Number(n),0,1):1,e.push({name:`fill#${a}`,color:Ze.fromRGB(t)})}t.push(i)}let r=i.getAttribute(`stroke`)?.trim();if(r){let n=new Ze(r);if(n.badValue)e.push({name:`stroke#${a}`,color:r});else{let{rgba:t}=n,r=i.getAttribute(`stroke-opacity`);t[3]*=r?L(Number(r),0,1):1,e.push({name:`stroke#${a}`,color:Ze.fromRGB(t)})}t.push(i)}}}return e}setSvgColors(e){let t=[],n=(this._element??this.setElement()).querySelectorAll(`[mol_edit_style=true]`);for(let r=0;r<n.length;++r){let i=n[r],a=i.id;if(a&&t.every(e=>e.id!==a)&&(i.getAttribute(`fill`)?.trim()||i.getAttribute(`stroke`)?.trim())){let n=e.find(e=>e.name===`fill#${a}`);if(n?.color){let[e,t,r,a]=n.color.rgba;i.setAttribute(`fill`,`rgb(${e},${t},${r})`),i.setAttribute(`fill-opacity`,String(a))}let r=e.find(e=>e.name===`stroke#${a}`);if(r?.color){let[e,t,n,a]=r.color.rgba;i.setAttribute(`stroke`,`rgb(${e},${t},${n})`),i.setAttribute(`stroke-opacity`,String(a))}t.push(i)}}return this}getSvgTexts(){let e=[],t=(this._element??Ie(this._svg)).querySelectorAll(`[mol_edit_text=true]`);for(let n=0;n<t.length;++n){let r=t[n],i=r.id;i&&e.every(e=>e.name!==i)&&e.push({name:i,text:r.textContent||void 0,isMultiline:/^\s*true/i.test(r.getAttribute(`mol_wrap`)??`false`)})}return e}setSvgTexts(e){this._seen=[];let t=this._element??this.setElement(),n=t.querySelectorAll(`[mol_edit_text=true]`);document.body.appendChild(t);try{let r=t.width.baseVal.value/t.viewBox.baseVal.width;for(let r=0;r<n.length;++r){let i=n[r],a=i.id;if(a&&this._seen.every(e=>e.id!==a)){let n=e.find(e=>e.name===a);if(i.querySelector(`textPath`)){if(n)for(let e=0;e<i.childNodes.length;++e)i.childNodes[e].nodeName===`textPath`&&(i.childNodes[e].childNodes[0].nodeValue=n.text??``)}else this.wrapText(t,i,n&&(n.text??``));this.nodeChanged(i)}}this._seen.length&&(this.resetSize(r),this.resetAnchor())}finally{document.body.removeChild(t)}return this}nodeChanged(e){if(!e.id||this._seen.includes(e))return;let t=this._element??this.setElement(),n=this.getBBox(e),r=0,i=t.querySelectorAll(`[mol_wrap~="${e.id}"]`)??[];for(r=0;r<i.length;++r)this.wrapText(t,i[r]);for(i=t.querySelectorAll(`[mol_autoresizeid~="${e.id}"]`)??[],r=0;r<i.length;++r)this.autoResizeId(i[r],n);for(i=t.querySelectorAll(`[mol_samewidth~="${e.id}"]`)??[],r=0;r<i.length;++r)this.sameWidth(i[r],n);for(i=t.querySelectorAll(`[mol_sameheight~="${e.id}"]`)??[],r=0;r<i.length;++r)this.sameHeight(i[r],n);for(i=t.querySelectorAll(`[mol_stack~="${e.id}"]`)??[],r=0;r<i.length;++r)this.stack(i[r],n);for(i=t.querySelectorAll(`[mol_rectposition~="${e.id}"]`)??[],r=0;r<i.length;++r)this.rectPosition(i[r],n);for(i=t.querySelectorAll(`[mol_pathposition~="${e.id}"]`)??[],r=0;r<i.length;++r)this.pathPosition(i[r],e);for(i=t.querySelectorAll(`[mol_copyposition~="${e.id}"]`)??[],r=0;r<i.length;++r)this.copyPosition(i[r],e);this._seen.push(e)}autoResizeId(e,t){let n=e.attributes.mol_autoresizemargin?.value,r=[0,0,0,0];if(n){let e=n.split(` `).map(e=>parseFloat(e));r=e.length===1?[e[0],e[0],e[0],e[0]]:[e[0],e[1],e[2],e[3]]}V(e.attributes.x.value,t.x-r[0])&&V(e.attributes.y.value,t.y-r[2])&&V(e.attributes.width.value,t.width+r[0]+r[1])&&V(e.attributes.height.value,t.height+r[2]+r[3])||(e.attributes.x.value=t.x-r[0],e.attributes.y.value=t.y-r[2],e.attributes.width.value=t.width+r[0]+r[1],e.attributes.height.value=t.height+r[2]+r[3],this.nodeChanged(e))}sameWidth(e,t){let n=t.width+2*parseFloat(e.attributes.mol_samewidth.value.split(` `)[1]);V(e.attributes.width.value,n)||(e.attributes.width.value=n,this.nodeChanged(e))}sameHeight(e,t){let n=t.height+2*parseFloat(e.attributes.mol_sameheight.value.split(` `)[1]);V(e.attributes.height.value,n)||(this._seen.push(e),e.attributes.height.value=n,this.nodeChanged(e))}stack(e,t){let n=!1;switch(e.attributes.mol_stack.value.split(` `)[0]){case`top`:n=!(V(e.attributes.width.value,t.width)&&V(e.attributes.x.value,t.x)&&V(e.attributes.y.value,t.y-e.attributes.height.value)),n&&(e.attributes.width.value=t.width,e.attributes.x.value=t.x,e.attributes.y.value=t.y-e.attributes.height.value);break;case`bottom`:n=!(V(e.attributes.width.value,t.width)&&V(e.attributes.x.value,t.x)&&V(e.attributes.y.value,t.y+t.height)),n&&(e.attributes.width.value=t.width,e.attributes.x.value=t.x,e.attributes.y.value=t.y+t.height);break;case`left`:n=!(V(e.attributes.height.value,t.height)&&V(e.attributes.x.value,t.x-e.attributes.width.value)&&V(e.attributes.y.value,t.y)),n&&(e.attributes.height.value=t.height,e.attributes.x.value=t.x-e.attributes.width.value,e.attributes.y.value=t.y);break;case`right`:n=!(V(e.attributes.height.value,t.height)&&V(e.attributes.x.value,t.x+t.width)&&V(e.attributes.y.value,t.y)),n&&(e.attributes.height.value=t.height,e.attributes.x.value=t.x+t.width,e.attributes.y.value=t.y);break}n&&this.nodeChanged(e)}rectPosition(e,t){let n=e.attributes.mol_rectposition.value.split(` `)[1],r=e.attributes.mol_rectposition.value.split(` `)[2],i=parseFloat(e.attributes.mol_rectposition.value.split(` `)[3])||0,a={x:0,y:0};switch(n){case`center`:a={x:t.x+t.width/2,y:t.y+t.height/2};break;case`top`:case`bottom`:switch(a.x=t.x,r){case`start`:a.x+=i;break;case`middle`:a.x+=t.width/2+i;break;case`end`:a.x+=t.width-i;break}a.y=t.y,n===`bottom`&&(a.y+=t.height);break;case`left`:case`right`:switch(a.y=t.y,r){case`start`:a.y+=i;break;case`middle`:a.y+=t.height/2+i;break;case`end`:a.y+=t.height+i;break}a.x=t.x,n===`right`&&(a.x+=t.width);break}let o=this.getCoordinate(e,0,0);o&&!(V(o.x,a.x)&&V(o.y,a.y))&&(this.moveElement(e,a),this.nodeChanged(e))}pathPosition(e,t){let n=e.attributes.mol_pathposition.value.split(` `).map(e=>parseFloat(e)),r=this.getCoordinate(e,0,0),i=this.getCoordinate(t,n[1],n[2]);i&&r&&!(V(i.x,r.x)&&V(i.y,r.y))&&(this.moveElement(e,i),this.nodeChanged(e))}copyPosition(e,t){let n=e.attributes.mol_copyposition.value.split(` `).map(e=>parseFloat(e)),r=this.getCoordinate(e,n[0],n[1]),i=this.getCoordinate(t,n[3],n[4]);i&&r&&!(V(i.x,r.x)&&V(i.y,r.y))&&(this.setCoordinate(e,i,n[0],n[1]),this.nodeChanged(e))}resetSize(e){let t=this._element??this.setElement(),n=this.getBBox(t);n.x-=.1*n.width,n.y-=.1*n.height,n.width*=1.2,n.height*=1.2,t.setAttribute(`viewBox`,`${n.x} ${n.y} ${n.width} ${n.height}`),t.setAttribute(`width`,`${n.width*e}`),t.setAttribute(`height`,`${n.height*e}`)}resetAnchor(){let e=(this._element??Ie(this._svg)).querySelector(`[mol_edit_anchor]`);if(e){let t=e.getAttribute(`mol_edit_anchor`).split(` `).map(e=>parseFloat(e)),n=this.getCoordinate(e,t[0],t[1]),r=this._element??this.setElement(),i=r.getElementById(`scale`);if(i){let e=i.getAttribute(`transform`),t=(/scale\(([\d.]+)\)/i.exec(e)||[``,`1`]).map(Number.parseFloat)[1];n.x*=t,n.y*=t}r.setAttribute(`mol_svganchor`,`${n.x} ${n.y}`)}}getBBox(e){function t(e){if(e.nodeName!==`text`)return``;let t=e.textContent,n=0;for(;n<e.childNodes.length&&e.childNodes[n].nodeName===`tspan`&&e.childNodes[n].textContent.match(/\S+/)===null;)t=t.slice(e.childNodes[n].textContent.length),n++;for(n=e.childNodes.length-1;n>=0&&e.childNodes[n].nodeName===`tspan`&&e.childNodes[n].textContent.match(/\S+/)===null;)t=t.slice(0,t.length-e.childNodes[n].textContent.length),n--;let r=t.split(`
|
|
12
12
|
`);for(t=r[0],n=1;n<r.length;++n)r[n].length>t.length&&(t=r[n]);return t}let n=null,r=e.getBBox();if(e.nodeName===`text`){let i=t(e),a=r.width,o=r.x,s=i.match(/\S+.*\S+/);if(s&&s.length>0){let e=i.match(/^\s*/);e.length>0&&(o-=a/s[0].length*e[0].length),a+=a/s[0].length*(i.length-s[0].length)}n={width:a,height:r.height,x:o,y:r.y,descent:r.y+r.height-Number(e.getAttribute(`y`))}}else n={x:r.x,y:r.y,width:Math.max(1,r.width),height:Math.max(1,r.height)};return n}nodeToPoints(e){let t=[],n,r,i;for(r=e.points.length?e.points.length:e.points.numberOfItems,i=0;i<r;++i)n=e.points.getItem(i),t.push(n);return t}pointsToString(e){let t=``,n;for(n=0;n<e.length;++n)t=`${t} ${e[n].x.toString()}, ${e[n].y.toString()}`;return t}getCoordinate(e,t,n){let r={x:0,y:0},i=[],a=[];switch(e.nodeName){case`rect`:if(t===0)return r.x=parseFloat(e.getAttribute(`x`)),r.y=parseFloat(e.getAttribute(`y`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`x`))+parseFloat(e.getAttribute(`width`)),r.y=parseFloat(e.getAttribute(`y`))+parseFloat(e.getAttribute(`height`)),r;break;case`circle`:if(t===0)return r.x=parseFloat(e.getAttribute(`cx`)),r.y=parseFloat(e.getAttribute(`cy`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`cx`))+parseFloat(e.getAttribute(`r`)),r.y=parseFloat(e.getAttribute(`cy`)),r;break;case`ellipse`:if(t===0)return r.x=parseFloat(e.getAttribute(`cx`)),r.y=parseFloat(e.getAttribute(`cy`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`cx`))+parseFloat(e.getAttribute(`rx`)),r.y=parseFloat(e.getAttribute(`cy`)),r;if(t===2)return r.x=parseFloat(e.getAttribute(`cx`)),r.y=parseFloat(e.getAttribute(`cy`))-parseFloat(e.getAttribute(`ry`)),r;break;case`line`:if(t===0)return r.x=parseFloat(e.getAttribute(`x1`)),r.y=parseFloat(e.getAttribute(`y1`)),r;if(t===1)return r.x=parseFloat(e.getAttribute(`x2`)),r.y=parseFloat(e.getAttribute(`y2`)),r;break;case`polyline`:if(i=this.nodeToPoints(e),t<i.length)return r.x=i[t].x,r.y=i[t].y,r;break;case`polygon`:if(i=this.nodeToPoints(e),t<i.length)return r.x=i[t].x,r.y=i[t].y,r;break;case`path`:switch(a=e.getPathData({normalize:!0}),a[n].type){case`M`:switch(t){case 0:return r.x=a[n].values[0],r.y=a[n].values[1],r}break;case`L`:switch(t){case 0:return r.x=a[n].values[0],r.y=a[n].values[1],r}break}break}return null}setCoordinate(e,t,n,r){let i=``,a=[],o=[],s=0,c=0,l=0;switch(e.nodeName){case`rect`:n===0&&(e.setAttribute(`x`,t.x.toString()),e.setAttribute(`y`,t.y.toString())),n===1&&(s=t.x-Number(e.getAttribute(`x`)),s>=0?e.setAttribute(`width`,s.toString()):(c=Number(e.getAttribute(`x`))+s,e.setAttribute(`x`,c.toString()),e.setAttribute(`width`,`0`)),s=t.y-Number(e.getAttribute(`y`)),s>=0?e.setAttribute(`height`,s.toString()):(c=Number(e.getAttribute(`y`))+s,e.setAttribute(`y`,c.toString()),e.setAttribute(`height`,`0`)));break;case`circle`:n===0&&(e.setAttribute(`cx`,t.x.toString()),e.setAttribute(`cy`,t.y.toString())),n===1&&(c=parseFloat(e.getAttribute(`cx`))-t.x,l=parseFloat(e.getAttribute(`cy`))-t.y,s=Math.sqrt(c*c+l*l),e.setAttribute(`r`,s.toString()));break;case`ellipse`:n===0&&(e.setAttribute(`cx`,t.x.toString()),e.setAttribute(`cy`,t.y.toString())),n===1&&(s=Math.abs(parseFloat(e.getAttribute(`cx`))-t.x),e.setAttribute(`rx`,s.toString())),n===2&&(s=Math.abs(parseFloat(e.getAttribute(`cy`))-t.y),e.setAttribute(`ry`,s.toString()));break;case`line`:n===0&&(e.setAttribute(`x1`,t.x.toString()),e.setAttribute(`y2`,t.y.toString())),n===1&&(e.setAttribute(`x2`,t.x.toString()),e.setAttribute(`y2`,t.y.toString()));break;case`polyline`:a=this.nodeToPoints(e),n<a.length&&(a[n].x=t.x,a[n].y=t.y,i=this.pointsToString(a),e.setAttribute(`points`,i));break;case`polygon`:a=this.nodeToPoints(e),n<a.length&&(a[n].x=t.x,a[n].y=t.y,i=this.pointsToString(a),e.setAttribute(`points`,i));break;case`path`:if(!r)break;switch(o=e.getPathData({normalize:!0}),o[r].type){case`M`:o[r].values[0]=t.x,o[r].values[1]=t.y;break;case`L`:o[r].values[0]=t.x,o[r].values[1]=t.y;break}e.setPathData(o);break}}moveElement(e,t){let n={x:0,y:0},r={x:0,y:0},i=0,a=!1,o=[];switch(e.nodeName){case`rect`:case`circle`:case`ellipse`:n=this.getCoordinate(e,0,0),a=!V(n.x,t.x)||!V(n.y,t.y),a&&this.setCoordinate(e,t,0,0);break;case`polyline`:case`polygon`:if(n=this.getCoordinate(e,0,0),r.x=t.x-n.x,r.y=t.y-n.y,a=!V(r.x,0)||!V(r.y,0),a)for(this.setCoordinate(e,t,0,0),i=1,n=this.getCoordinate(e,i,0);n!==null;)n.x+=r.x,n.y+=r.y,this.setCoordinate(n,i,0,void 0),i++,n=this.getCoordinate(e,i,0);break;case`path`:if(n=this.getCoordinate(e,0,0),r.x=t.x-n.x,r.y=t.y-n.y,a=!V(r.x,0)||!V(r.y,0),a){o=e.getPathData({normalize:!0});for(let e=0;e<o.length;++e){let t=o[e];(t?.type===`M`||t?.type===`L`)&&(t.values[0]+=r.x,t.values[1]+=r.y)}e.setPathData(o)}break}return a}wrapText(e,t,n){let r=[],i=0,a,o=0,s=``,c=``,l,u,d,f=0,p=``,m,h=`http://www.w3.org/2000/svg`;for(n??=t.textContent;t.hasChildNodes();)t.removeChild(t.firstChild);let g=document.createTextNode(`gh`);t.appendChild(g);let _=t.getAttribute(`y`),v=null,y=``,b=[],x=0,S=0,C=!1;if(t.hasAttribute(`mol_wrap`)&&(b=t.getAttribute(`mol_wrap`).split(` `,4),b[0]===`true`&&(y=b[1],y===`newlineOnly`?(C=!0,y=``,x=0):x=parseFloat(b[2]),S=b.length>=4?parseFloat(b[3]):x)),y){let n=e.getElementById(y);v=this.getBBox(n||t)}else v=this.getBBox(t);let w=v.x,T=v.y,E=v.width,D=1e4;y!==``&&!C&&(D=E-2*x),v=this.getBBox(t);let O=v.height;t.hasAttribute(`font-size`)&&(O=parseFloat(t.getAttribute(`font-size`)));let k=v.y+v.height-_;if(t.removeChild(g),w+=x,T+=x+v.height,t.hasAttribute(`text-anchor`))switch(t.getAttribute(`text-anchor`)){case`end`:w=w-x+E-x;break;case`middle`:w=w-x+E/2;break}p=t.getAttribute(`id`),t.setAttribute(`x`,w.toString()),t.setAttribute(`y`,(T-k).toString()),n&&(r=n.replace(/\n/g,`
|
|
13
13
|
§`).replace(/-/g,`-§`).replace(/ /g,` §`).replace(/\t/g,` §`).split(`§`));let A=parseFloat(t.attributes.y.value);for(u=document.createElementNS(h,`tspan`),u.setAttributeNS(null,`x`,String(w)),u.setAttributeNS(null,`y`,String(A+o)),d=p+f.toString(),u.setAttribute(`id`,d),f++,s=``,i=0,l=document.createTextNode(s),u.appendChild(l),t.appendChild(u),o+=O,a=0;a<r.length;)c=s+r[a],i++,l.nodeValue=c,m=e.querySelector(`#${d}`).getComputedTextLength(),m<D?(s=c,s.length>0&&s[s.length-1]===`
|
|
14
14
|
`&&a<r.length-1&&(l.nodeValue=s,u=document.createElementNS(h,`tspan`),u.setAttributeNS(null,`x`,String(w)),u.setAttributeNS(null,`y`,String(A+o)),d=p+f.toString(),u.setAttribute(`id`,d),o+=O+S,f++,s=``,i=0,l=document.createTextNode(s),u.appendChild(l),t.appendChild(u)),a++):(i>1?l.nodeValue=s:(s=c,a++),s.length>0&&s[s.length-1]===`
|
|
15
|
-
`&&(s=s.substr(0,s.length-1),l.nodeValue=s),u=document.createElementNS(h,`tspan`),u.setAttributeNS(null,`x`,String(w)),u.setAttributeNS(null,`y`,String(A+o)),d=p+f.toString(),u.setAttribute(`id`,d),o+=O+S,f++,s=``,i=0,l=document.createTextNode(s),u.appendChild(l),t.appendChild(u));return t.childElementCount===1&&t.firstElementChild.replaceWith(t.firstElementChild.textContent),o}},Ue=class{map;keyCache=new Map;promises=[];fonts;constructor(e,t,n,r){this.map=e,this.fonts=new pe(t,n,r)}getMapLibreImageKey(e,t){let n=this.keyCache.get(t);n||(n=new Map,this.keyCache.set(t,n));let r=n.get(e);if(!r){let i=e+t,a=new He(e).getSvgSize(),o=Math.max(a[0]*t,1),s=Math.max(a[1]*t,1);r=`mc-image-${
|
|
15
|
+
`&&(s=s.substr(0,s.length-1),l.nodeValue=s),u=document.createElementNS(h,`tspan`),u.setAttributeNS(null,`x`,String(w)),u.setAttributeNS(null,`y`,String(A+o)),d=p+f.toString(),u.setAttribute(`id`,d),o+=O+S,f++,s=``,i=0,l=document.createTextNode(s),u.appendChild(l),t.appendChild(u));return t.childElementCount===1&&t.firstElementChild.replaceWith(t.firstElementChild.textContent),o}},Ue=class{map;keyCache=new Map;promises=[];fonts;constructor(e,t,n,r){this.map=e,this.fonts=new pe(t,n,r)}getMapLibreImageKey(e,t){let n=this.keyCache.get(t);n||(n=new Map,this.keyCache.set(t,n));let r=n.get(e);if(!r){let i=e+t,a=new He(e).getSvgSize(),o=Math.max(a[0]*t,1),s=Math.max(a[1]*t,1);r=`mc-image-${ne(i)}`,this.promises.push(ke(e,o,s,this.fonts).then(e=>void this.map.addImage(r,e,{pixelRatio:t})).catch(e=>console.log(e))),n.set(e,r)}return r}settledImages(){let e=this.promises;return this.promises=[],Promise.allSettled(e).then(()=>void 0,()=>void 0)}getFillPatterns(e){let t=this.keyCache.get(e);return t?Array.from(t.entries()).map(([e,t])=>({name:t,string:e})):[]}},We=0,Ge=``,Ke=document.createElement(`canvas`).getContext(`2d`);function qe(e,t,n){let r=0,i=0,a=0,o=0,s=`${t.style} ${t.weight} ${n}px ${t.cssFamily}`;if(Ke){(We!==n||Ge!==s)&&(Ke.font=s,Ge=s,We=n),{actualBoundingBoxAscent:a,actualBoundingBoxDescent:o}=Ke.measureText(`█`);for(let t=0;t<e.length;++t){let{actualBoundingBoxLeft:n,actualBoundingBoxRight:i}=Ke.measureText(e[t]);n+i>r&&(r=n+i)}i=(a+o)*e.length}return{width:r,height:i,ascent:a,descent:o}}function Je(e,t,n,r,i){let a=n??t,o=!r,s=a?.match(/\$\{([^}]+)}/)?.[1],c=s?o?D(e[s]):O(e[s]):null,l=s?o?c:typeof c!=`boolean`&&c!==null&&c!==``?r(c):i:a;return l&&!new Ze(l).badValue?l:`#000000`}function Ye(e,t,n){return(n??t)?.split(Me).map((t,n)=>n&1?D(e[t]):t).join(``)||void 0}function Xe(e,t,n){let r=t;if(t){let i=new He(t),a=i.getSvgColors(),o=i.getSvgTexts(),s=n?new Map(new He(n).getSvgColors().map(({name:e,color:t})=>[e,t])):new Map,c=n?new Map(new He(n).getSvgTexts().map(({name:e,text:t})=>[e,t])):new Map,l=a.map(({name:t,color:n})=>({name:t,color:new Ze(Je(e,n?.toString(),s.get(t)?.toString()))})).filter((e,t)=>typeof a[t].color==`string`||!e.color.sameColor(a[t].color)),u=o.map(({name:t,text:n})=>({name:t,text:Ye(e,n,c.get(t))})).filter((e,t)=>e.text!==o[t].text);l.length&&i.setSvgColors(l),u.length&&i.setSvgTexts(u),(l.length||u.length)&&(r=i.getSvgString())}return r}var Ze=class e{_error=!1;_rgba;static fromRGB(t){let n=new e(`transparent`);return n._rgba[0]=t[0],n._rgba[1]=t[1],n._rgba[2]=t[2],n._rgba[3]=t.length>3?t[3]:1,n}constructor(e){e=String(e).trim().toLowerCase();let t=this._rgba=[0,0,0,1],n=e.length,r;if(n===0)this._error=!0;else if(e===`transparent`||e===`none`)t[3]=0;else if(e[0]===`#`)n<6?(t[0]=parseInt(e[1]+e[1],16)||0,t[1]=parseInt(e[2]+e[2],16)||0,t[2]=parseInt(e[3]+e[3],16)||0,n===5&&(t[3]=parseInt(e[4]+e[4],16)/255)):(t[0]=parseInt(e[1]+e[2],16)||0,t[1]=parseInt(e[3]+e[4],16)||0,t[2]=parseInt(e[5]+e[6],16)||0,n>8&&(t[3]=parseInt(e[7]+e[8],16)/255));else if(e in it){let n=it[e];t[0]=n[0],t[1]=n[1],t[2]=n[2]}else if(r=/^(rgba?|hs[lv]a?)\s*\(([^)]*)\)/.exec(e)){let e=r[1].replace(/a$/,``),n=r[2].trim().split(/\s*[,/]\s*|\s+/).map($e,{space:e});e===`rgb`?(t[0]=n[0],t[1]=n[1],t[2]=n[2],n.length>3&&(t[3]=n[3])):e===`hsl`?tt(n,t):e===`hsv`&&nt(n,t)}else this._error=!0}get badValue(){return this._error}get a(){return this._rgba[3]}get hex(){return`#${(Math.round(this._rgba[0])<<16|Math.round(this._rgba[1])<<8|Math.round(this._rgba[2])).toString(16).padStart(6,`0`)}`}get rgba(){return this._rgba.slice()}sameColor(e){return V(this._rgba[0],e._rgba[0])&&V(this._rgba[1],e._rgba[1])&&V(this._rgba[2],e._rgba[2])&&V(this._rgba[3],e._rgba[3])}toString(){let[e,t,n,r]=this._rgba;return r===1?this.hex:`rgba(${Math.round(e)}, ${Math.round(t)}, ${Math.round(n)}, ${r})`}},Qe={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function $e(e,t){let{space:n}=this;if(e[e.length-1]===`%`){let r=parseFloat(e),i=t<3&&n===`rgb`?255:1,a=t>0&&t<3&&n[0]===`h`?1:100;return(r<0?0:r>100?100:r)/a*i}if(n[t]===`h`||t===2&&n[n.length-1]===`h`){if(e in Qe)return Qe[e];let t=parseFloat(e);switch(!0){case e.endsWith(`turn`):t*=360;break;case e.endsWith(`grad`):t=t*360/400;break;case e.endsWith(`rad`):t=t*180/Math.PI;break}return(t%360+360)%360}if(e===`none`)return 0;{let r=parseFloat(e),i=t<3&&n===`rgb`?255:1;return r<0?0:r>i?i:r}}function et(e,t,n){return n<0&&(n+=1),n>1&&--n,(n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e)*255}function tt(e,t=[0,0,0,1]){let n=e[0]/360,r=e[1]/100,i=e[2]/100;if(r===0)t[2]=t[1]=t[0]=i*255;else{let e=i<.5?i*(1+r):i+r-i*r,a=2*i-e;t[0]=et(a,e,n+1/3),t[1]=et(a,e,n),t[2]=et(a,e,n-1/3)}return e.length>3&&(t[3]=e[3]),t}function nt(e,t=[0,0,0,1]){let n=e[0]/60,r=e[1]/100,i=e[2]/100*255,a=Math.floor(n),o=n-a,s=i*(1-r),c=i*(1-o*r),l=i*(1-(1-o)*r);switch(a%6){case 0:t[0]=i,t[1]=l,t[2]=s;break;case 1:t[0]=c,t[1]=i,t[2]=s;break;case 2:t[0]=s,t[1]=i,t[2]=l;break;case 3:t[0]=s,t[1]=c,t[2]=i;break;case 4:t[0]=l,t[1]=s,t[2]=i;break;case 5:t[0]=i,t[1]=s,t[2]=c;break}return e.length>3&&(t[3]=e[3]),t}function rt(e){let t=new Ze(e).rgba;return{color:`rgb(${Math.round(t[0])}, ${Math.round(t[1])}, ${Math.round(t[2])})`,opacity:t[3]}}function H(e,t=`fill`){if(e.trim().toLowerCase()===`none`)return`${t}="none"`;if(new Ze(e).badValue)return`${t}="${B(e)}"`;let{color:n,opacity:r}=rt(e);return`${t}="${n}" ${t===`stop-color`?`stop-opacity`:`${t}-opacity`}="${r}"`}var it={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function at(e,t,n,r){let{title:i=``,titleFontColor:a=`#000000`,titleFontSize:o=24,entries:s,entryFontColor:c=`#000000`,entryFontSize:l=13,entryShape:u=`rectangle`,layout:d=`vertical`,background:f=`#ffffff`,showBackground:p=!1}=e,m=r.resolve(e.titleFont??t),h=r.resolve(e.entryFont??t),g=qe([i],m,o),_=s.map(e=>qe([e.label],h,l)),v=i.trim().length>0,y,b;d===`vertical`?(y=Math.max(g.width,..._.map(e=>e.width+15+10))+30,b=30+(v?g.height+20:0)+_.reduce((e,t)=>e+t.height,0)+Math.max(_.length-1,0)*20):(y=Math.max(g.width+30,30+_.reduce((e,t)=>e+t.width+15+10,0)+Math.max(_.length-1,0)*20),b=30+(v?g.height+20:0)+Math.max(0,..._.map(e=>e.height)));let x=[];p&&x.push(`
|
|
16
16
|
<rect
|
|
17
17
|
x="0"
|
|
18
18
|
y="0"
|
|
@@ -80,7 +80,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
80
80
|
>
|
|
81
81
|
${x.join(``)}
|
|
82
82
|
</svg>
|
|
83
|
-
`}function ot(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function st(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ct(e){let t,n,r;e.length===2?(t=e===ot||e===st?e:lt,n=e,r=e):(t=ot,n=(t,n)=>ot(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function lt(){return 0}function ut(e){return e===null?NaN:+e}var dt=ct(ot),ft=dt.right;dt.left,ct(ut).center;function pt(e,t){let n,r;if(t===void 0)for(let t of e)t!=null&&(n===void 0?t>=t&&(n=r=t):(n>t&&(n=t),r<t&&(r=t)));else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(n===void 0?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}var mt=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let i=t[r],a=e+i,o=Math.abs(e)<Math.abs(i)?e-(a-i):i-(a-e);o&&(t[n++]=o),e=a}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,i,a=0;if(t>0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}},ht=class extends Map{constructor(e,t=yt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(gt(this,e))}has(e){return super.has(gt(this,e))}set(e,t){return super.set(_t(this,e),t)}delete(e){return super.delete(vt(this,e))}};function gt({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _t({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function vt({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function yt(e){return typeof e==`object`&&e?e.valueOf():e}var bt=Math.sqrt(50),xt=Math.sqrt(10),St=Math.sqrt(2);function Ct(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=bt?10:a>=xt?5:a>=St?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?Ct(e,t,n*2):[s,c,l]}function wt(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?Ct(t,e,n):Ct(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function Tt(e,t,n){return t=+t,e=+e,n=+n,Ct(e,t,n)[2]}function Et(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Tt(t,e,n):Tt(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Dt(e,t,n=ut){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function*Ot(e){for(let t of e)yield*t}function kt(e){return Array.from(Ot(e))}function At(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function jt(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Mt(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Nt(e){return e=Mt(Math.abs(e)),e?e[1]:NaN}function Pt(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Ft(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var It=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Lt(e){if(!(t=It.exec(e)))throw Error(`invalid format: `+e);var t;return new Rt({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Lt.prototype=Rt.prototype;function Rt(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Rt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function zt(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Bt;function Vt(e,t){var n=Mt(e,t);if(!n)return Bt=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Bt=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Mt(e,Math.max(0,t+a-1))[0]}function Ht(e,t){var n=Mt(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Ut={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:jt,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ht(e*100,t),r:Ht,s:Vt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Wt(e){return e}var Gt=Array.prototype.map,Kt=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function qt(e){var t=e.grouping===void 0||e.thousands===void 0?Wt:Pt(Gt.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Wt:Ft(Gt.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Lt(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Ut[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Ut[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=zt(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Bt!==void 0?Kt[8+Bt/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Nt(t)/3)))*3,r=10**-n,i=l((e=Lt(e),e.type=`f`,e),{suffix:Kt[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Jt,Yt,Xt;Zt({thousands:`,`,grouping:[3],currency:[`$`,``]});function Zt(e){return Jt=qt(e),Yt=Jt.format,Xt=Jt.formatPrefix,Jt}function Qt(e){return Math.max(0,-Nt(Math.abs(e)))}function $t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nt(t)/3)))*3-Nt(Math.abs(e)))}function en(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Nt(t)-Nt(e))+1}function tn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function nn(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function rn(){}var an=.7,on=1/an,sn=`\\s*([+-]?\\d+)\\s*`,cn=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,ln=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,un=/^#([0-9a-f]{3,8})$/,dn=RegExp(`^rgb\\(${sn},${sn},${sn}\\)$`),fn=RegExp(`^rgb\\(${ln},${ln},${ln}\\)$`),pn=RegExp(`^rgba\\(${sn},${sn},${sn},${cn}\\)$`),mn=RegExp(`^rgba\\(${ln},${ln},${ln},${cn}\\)$`),hn=RegExp(`^hsl\\(${cn},${ln},${ln}\\)$`),gn=RegExp(`^hsla\\(${cn},${ln},${ln},${cn}\\)$`),_n={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};tn(rn,Sn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vn,formatHex:vn,formatHex8:yn,formatHsl:bn,formatRgb:xn,toString:xn});function vn(){return this.rgb().formatHex()}function yn(){return this.rgb().formatHex8()}function bn(){return Pn(this).formatHsl()}function xn(){return this.rgb().formatRgb()}function Sn(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=un.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Cn(t):n===3?new U(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?wn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?wn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dn.exec(e))?new U(t[1],t[2],t[3],1):(t=fn.exec(e))?new U(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pn.exec(e))?wn(t[1],t[2],t[3],t[4]):(t=mn.exec(e))?wn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hn.exec(e))?Nn(t[1],t[2]/100,t[3]/100,1):(t=gn.exec(e))?Nn(t[1],t[2]/100,t[3]/100,t[4]):_n.hasOwnProperty(e)?Cn(_n[e]):e===`transparent`?new U(NaN,NaN,NaN,0):null}function Cn(e){return new U(e>>16&255,e>>8&255,e&255,1)}function wn(e,t,n,r){return r<=0&&(e=t=n=NaN),new U(e,t,n,r)}function Tn(e){return e instanceof rn||(e=Sn(e)),e?(e=e.rgb(),new U(e.r,e.g,e.b,e.opacity)):new U}function En(e,t,n,r){return arguments.length===1?Tn(e):new U(e,t,n,r??1)}function U(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tn(U,En,nn(rn,{brighter(e){return e=e==null?on:on**+e,new U(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?an:an**+e,new U(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new U(jn(this.r),jn(this.g),jn(this.b),An(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dn,formatHex:Dn,formatHex8:On,formatRgb:kn,toString:kn}));function Dn(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}`}function On(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}${Mn((isNaN(this.opacity)?1:this.opacity)*255)}`}function kn(){let e=An(this.opacity);return`${e===1?`rgb(`:`rgba(`}${jn(this.r)}, ${jn(this.g)}, ${jn(this.b)}${e===1?`)`:`, ${e})`}`}function An(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mn(e){return e=jn(e),(e<16?`0`:``)+e.toString(16)}function Nn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new In(e,t,n,r)}function Pn(e){if(e instanceof In)return new In(e.h,e.s,e.l,e.opacity);if(e instanceof rn||(e=Sn(e)),!e)return new In;if(e instanceof In)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new In(o,s,c,e.opacity)}function Fn(e,t,n,r){return arguments.length===1?Pn(e):new In(e,t,n,r??1)}function In(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}tn(In,Fn,nn(rn,{brighter(e){return e=e==null?on:on**+e,new In(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?an:an**+e,new In(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new U(zn(e>=240?e-240:e+120,i,r),zn(e,i,r),zn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new In(Ln(this.h),Rn(this.s),Rn(this.l),An(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=An(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ln(this.h)}, ${Rn(this.s)*100}%, ${Rn(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ln(e){return e=(e||0)%360,e<0?e+360:e}function Rn(e){return Math.max(0,Math.min(1,e||0))}function zn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Bn=Math.PI/180,Vn=180/Math.PI,Hn=18,Un=.96422,Wn=1,Gn=.82521,Kn=4/29,qn=6/29,Jn=3*qn*qn,Yn=qn*qn*qn;function Xn(e){if(e instanceof Qn)return new Qn(e.l,e.a,e.b,e.opacity);if(e instanceof ar)return or(e);e instanceof U||(e=Tn(e));var t=nr(e.r),n=nr(e.g),r=nr(e.b),i=$n((.2225045*t+.7168786*n+.0606169*r)/Wn),a,o;return t===n&&n===r?a=o=i:(a=$n((.4360747*t+.3850649*n+.1430804*r)/Un),o=$n((.0139322*t+.0971045*n+.7141733*r)/Gn)),new Qn(116*i-16,500*(a-i),200*(i-o),e.opacity)}function Zn(e,t,n,r){return arguments.length===1?Xn(e):new Qn(e,t,n,r??1)}function Qn(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}tn(Qn,Zn,nn(rn,{brighter(e){return new Qn(this.l+Hn*(e??1),this.a,this.b,this.opacity)},darker(e){return new Qn(this.l-Hn*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=Un*er(t),e=Wn*er(e),n=Gn*er(n),new U(tr(3.1338561*t-1.6168667*e-.4906146*n),tr(-.9787684*t+1.9161415*e+.033454*n),tr(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function $n(e){return e>Yn?e**(1/3):e/Jn+Kn}function er(e){return e>qn?e*e*e:Jn*(e-Kn)}function tr(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function nr(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function rr(e){if(e instanceof ar)return new ar(e.h,e.c,e.l,e.opacity);if(e instanceof Qn||(e=Xn(e)),e.a===0&&e.b===0)return new ar(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Vn;return new ar(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function ir(e,t,n,r){return arguments.length===1?rr(e):new ar(e,t,n,r??1)}function ar(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function or(e){if(isNaN(e.h))return new Qn(e.l,0,0,e.opacity);var t=e.h*Bn;return new Qn(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}tn(ar,ir,nn(rn,{brighter(e){return new ar(this.h,this.c,this.l+Hn*(e??1),this.opacity)},darker(e){return new ar(this.h,this.c,this.l-Hn*(e??1),this.opacity)},rgb(){return or(this).rgb()}}));var sr=e=>()=>e;function cr(e,t){return function(n){return e+n*t}}function lr(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ur(e,t){var n=t-e;return n?cr(e,n>180||n<-180?n-360*Math.round(n/360):n):sr(isNaN(e)?t:e)}function dr(e){return(e=+e)==1?fr:function(t,n){return n-t?lr(t,n,e):sr(isNaN(t)?n:t)}}function fr(e,t){var n=t-e;return n?cr(e,n):sr(isNaN(e)?t:e)}var pr=(function e(t){var n=dr(t);function r(e,t){var r=n((e=En(e)).r,(t=En(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=fr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function mr(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function hr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gr(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Tr(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function _r(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function vr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function yr(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Tr(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var br=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xr=new RegExp(br.source,`g`);function Sr(e){return function(){return e}}function Cr(e){return function(t){return e(t)+``}}function wr(e,t){var n=br.lastIndex=xr.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=br.exec(e))&&(i=xr.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:vr(r,i)})),n=xr.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Cr(c[0].x):Sr(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Tr(e,t){var n=typeof t,r;return t==null||n===`boolean`?sr(t):(n===`number`?vr:n===`string`?(r=Sn(t))?(t=r,pr):wr:t instanceof Sn?pr:t instanceof Date?_r:hr(t)?mr:Array.isArray(t)?gr:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?yr:vr)(e,t)}function Er(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Dr(e){return function(t,n){var r=e((t=ir(t)).h,(n=ir(n)).h),i=fr(t.c,n.c),a=fr(t.l,n.l),o=fr(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var Or=Dr(ur);function kr(e,t){t===void 0&&(t=e,e=Tr);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}function Ar(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}function jr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var Mr=Symbol(`implicit`);function Nr(){var e=new ht,t=[],n=[],r=Mr;function i(i){let a=e.get(i);if(a===void 0){if(r!==Mr)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new ht;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Nr(t,n).unknown(r)},jr.apply(i,arguments),i}function Pr(e){return function(){return e}}function Fr(e){return+e}var Ir=[0,1];function Lr(e){return e}function Rr(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Pr(isNaN(t)?NaN:.5)}function zr(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Br(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Rr(i,r),a=n(o,a)):(r=Rr(r,i),a=n(a,o)),function(e){return a(r(e))}}function Vr(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=Rr(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=ft(e,t,1,r)-1;return a[n](i[n](t))}}function Hr(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Ur(){var e=Ir,t=Ir,n=Tr,r,i,a,o=Lr,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==Lr&&(o=zr(e[0],e[n-1])),s=n>2?Vr:Br,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),vr))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,Fr),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Er,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Lr,u()):o!==Lr},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Wr(){return Ur()(Lr,Lr)}function Gr(e,t,n,r){var i=Et(e,t,n),a;switch(r=Lt(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=$t(i,o))&&(r.precision=a),Xt(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=en(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Qt(i))&&(r.precision=a-(r.type===`%`)*2);break}return Yt(r)}function Kr(e){var t=e.domain;return e.ticks=function(e){var n=t();return wt(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Gr(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-- >0;){if(l=Tt(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function qr(){var e=Wr();return e.copy=function(){return Hr(e,qr())},jr.apply(e,arguments),Kr(e)}function Jr(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r<i;)n[r-1]=Dt(e,r/i);return a}function a(e){return e==null||isNaN(e=+e)?r:t[ft(n,e)]}return a.invertExtent=function(r){var i=t.indexOf(r);return i<0?[NaN,NaN]:[i>0?n[i-1]:e[0],i<n.length?n[i]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)n!=null&&!isNaN(n=+n)&&e.push(n);return e.sort(ot),i()},a.range=function(e){return arguments.length?(t=Array.from(e),i()):t.slice()},a.unknown=function(e){return arguments.length?(r=e,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return Jr().domain(e).range(t).unknown(r)},jr.apply(a,arguments)}function Yr(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[ft(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++i<n;)r[i]=((i+1)*t-(i-n)*e)/(n+1);return o}return o.domain=function(n){return arguments.length?([e,t]=n,e=+e,t=+t,s()):[e,t]},o.range=function(e){return arguments.length?(n=(i=Array.from(e)).length-1,s()):i.slice()},o.invertExtent=function(a){var o=i.indexOf(a);return o<0?[NaN,NaN]:o<1?[e,r[0]]:o>=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Yr().domain([e,t]).range(i).unknown(a)},jr.apply(Kr(o),arguments)}var Xr=6371008.8;Xr*100,Xr*100,360/(2*Math.PI),Xr*3.28084,Xr*39.37,Xr/1e3,Xr/1e3,Xr/1609.344,Xr*1e3,Xr*1e3,Xr/1852,Xr*1.0936;function Zr(e,t,n={}){let r={type:`Feature`};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function Qr(e,t,n={}){for(let t of e){if(t.length<4)throw Error(`Each LinearRing of a Polygon must have 4 or more Positions.`);if(t[t.length-1].length!==t[0].length)throw Error(`First and last Position are not equivalent.`);for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw Error(`First and last Position are not equivalent.`)}return Zr({type:`Polygon`,coordinates:e},t,n)}function $r(e,t,n={}){if(e.length<2)throw Error(`coordinates must be an array of two or more positions`);return Zr({type:`LineString`,coordinates:e},t,n)}function ei(e,t={}){let n={type:`FeatureCollection`};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function ti(e,t,n={}){return Zr({type:`MultiLineString`,coordinates:e},t,n)}function ni(e,t,n={}){return Zr({type:`MultiPolygon`,coordinates:e},t,n)}function ri(e,t,n){if(e!==null)for(var r,i,a,o,s,c,l,u=0,d=0,f,p=e.type,m=p===`FeatureCollection`,h=p===`Feature`,g=m?e.features.length:1,_=0;_<g;_++){l=m?e.features[_].geometry:h?e.geometry:e,f=l?l.type===`GeometryCollection`:!1,s=f?l.geometries.length:1;for(var v=0;v<s;v++){var y=0,b=0;if(o=f?l.geometries[v]:l,o!==null){c=o.coordinates;var x=o.type;switch(u=n&&(x===`Polygon`||x===`MultiPolygon`)?1:0,x){case null:break;case`Point`:if(t(c,d,_,y,b)===!1)return!1;d++,y++;break;case`LineString`:case`MultiPoint`:for(r=0;r<c.length;r++){if(t(c[r],d,_,y,b)===!1)return!1;d++,x===`MultiPoint`&&y++}x===`LineString`&&y++;break;case`Polygon`:case`MultiLineString`:for(r=0;r<c.length;r++){for(i=0;i<c[r].length-u;i++){if(t(c[r][i],d,_,y,b)===!1)return!1;d++}x===`MultiLineString`&&y++,x===`Polygon`&&b++}x===`Polygon`&&y++;break;case`MultiPolygon`:for(r=0;r<c.length;r++){for(b=0,i=0;i<c[r].length;i++){for(a=0;a<c[r][i].length-u;a++){if(t(c[r][i][a],d,_,y,b)===!1)return!1;d++}b++}y++}break;case`GeometryCollection`:for(r=0;r<o.geometries.length;r++)if(ri(o.geometries[r],t,n)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}}}}function ii(e,t){var n,r,i,a,o,s,c,l,u,d,f=0,p=e.type===`FeatureCollection`,m=e.type===`Feature`,h=p?e.features.length:1;for(n=0;n<h;n++){for(s=p?e.features[n].geometry:m?e.geometry:e,l=p?e.features[n].properties:m?e.properties:{},u=p?e.features[n].bbox:m?e.bbox:void 0,d=p?e.features[n].id:m?e.id:void 0,c=s?s.type===`GeometryCollection`:!1,o=c?s.geometries.length:1,i=0;i<o;i++){if(a=c?s.geometries[i]:s,a===null){if(t(null,f,l,u,d)===!1)return!1;continue}switch(a.type){case`Point`:case`LineString`:case`MultiPoint`:case`Polygon`:case`MultiLineString`:case`MultiPolygon`:if(t(a,f,l,u,d)===!1)return!1;break;case`GeometryCollection`:for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],f,l,u,d)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}f++}}function ai(e,t,n){var r=n;return ii(e,function(e,i,a,o,s){r=i===0&&n===void 0?e:t(r,e,i,a,o,s)}),r}function oi(e,t){t||={},t.iterations=t.iterations||1;let{iterations:n}=t,r=[];if(!e)throw Error(`inputPolys is required`);return ii(e,function(e,t,i){if(e.type===`Polygon`){let t=[[]];for(let r=0;r<n;r++){let n=[],i=e;r>0&&(i=Qr(t).geometry),si(i,n),t=n.slice(0)}r.push(Qr(t,i))}else if(e.type===`MultiPolygon`){let t=[[[]]];for(let r=0;r<n;r++){let n=[],i=e;r>0&&(i=ni(t).geometry),ci(i,n),t=n.slice(0)}r.push(ni(t,i))}else throw Error(`geometry is invalid, must be Polygon or MultiPolygon`)}),ei(r)}function si(e,t){var n,r;ri(e,function(e,i,a,o,s){if(r!==s)t.push([]);else{var c=n[0],l=n[1],u=e[0],d=e[1];t[s].push([.75*c+.25*u,.75*l+.25*d]),t[s].push([.25*c+.75*u,.25*l+.75*d])}n=e,r=s},!1),t.forEach(function(e){e.push(e[0])})}function ci(e,t){let n,r,i;ri(e,function(e,a,o,s,c){if(r!==s)t.push([[]]);else if(i!==c)t[s].push([]);else{var l=n[0],u=n[1],d=e[0],f=e[1];t[s][c].push([.75*l+.25*d,.75*u+.25*f]),t[s][c].push([.25*l+.75*d,.25*u+.75*f])}n=e,r=s,i=c},!1),t.forEach(function(e){e.forEach(function(e){e.push(e[0])})})}function li(e){return e.type===`Feature`?e.geometry:e}function ui(e,t,n){var r=e.length,i=pi(e[0],t),a=[],o,s,c;let l,u;for(n||=[],o=1;o<r;o++){for(l=e[o-1],u=e[o],s=c=pi(u,t);;)if(!(i|s)){a.push(l),s===c?o===r-1&&a.push(u):(a.push(u),o<r-1&&(n.push(a),a=[]));break}else if(i&s)break;else i?(l=fi(l,u,i,t),i=pi(l,t)):(u=fi(l,u,s,t),s=pi(u,t));i=c}return a.length&&n.push(a),n}function di(e,t){var n,r,i,a,o,s,c;for(r=1;r<=8;r*=2){for(n=[],i=e[e.length-1],a=!(pi(i,t)&r),o=0;o<e.length;o++)s=e[o],c=!(pi(s,t)&r),c!==a&&n.push(fi(i,s,r,t)),c&&n.push(s),i=s,a=c;if(e=n,!e.length)break}return n}function fi(e,t,n,r){return n&8?[e[0]+(t[0]-e[0])*(r[3]-e[1])/(t[1]-e[1]),r[3]]:n&4?[e[0]+(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1]),r[1]]:n&2?[r[2],e[1]+(t[1]-e[1])*(r[2]-e[0])/(t[0]-e[0])]:n&1?[r[0],e[1]+(t[1]-e[1])*(r[0]-e[0])/(t[0]-e[0])]:null}function pi(e,t){var n=0;return e[0]<t[0]?n|=1:e[0]>t[2]&&(n|=2),e[1]<t[1]?n|=4:e[1]>t[3]&&(n|=8),n}function mi(e,t){let n=li(e),r=n.type,i=e.type===`Feature`?e.properties:{},a=n.coordinates;switch(r){case`LineString`:case`MultiLineString`:{let e=[];return r===`LineString`&&(a=[a]),a.forEach(n=>{ui(n,t,e)}),e.length===1?$r(e[0],i):ti(e,i)}case`Polygon`:return Qr(hi(a,t),i);case`MultiPolygon`:return ni(a.map(e=>hi(e,t)),i);default:throw Error(`geometry `+r+` not supported`)}}function hi(e,t){let n=[];for(let r of e){let e=di(r,t);e.length>0&&((e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&e.push(e[0]),e.length>=4&&n.push(e))}return n}var gi=mi;function _i(e,t){let n=[],r=Math.PI*2/100;for(let i=0;i<100;i++)n.push(yi(e,t,i*r));if(bi(e,t)){let e=n[0],t=n[n.length-1],r=(t[0]+e[0]-360)/2,i=(e[1]+t[1])/2;n.push([r,i]),n.push([r,90]),n.push([r+360,90]),n.push([r+360,i])}if(xi(e,t)){let e=n[49],t=n[50],r=(t[0]+e[0]-360)/2,i=(e[1]+t[1])/2;n.splice(50,0,[r+360,i],[r+360,-90],[r,-90],[r,i])}return n.push(n[0]),n}function vi(e,t,n){let r=[],i=t/100;for(let t=0;t<=100;t++)r.push(yi(e,t*i,C(n)));return gi($r(r),[-1/0,-85.051129,1/0,85.051129]).geometry.coordinates}function yi(e,t,n){let r=t/6378.1,i=C(e.lng),a=C(e.lat),o=Math.asin(Math.sin(a)*Math.cos(r)+Math.cos(a)*Math.sin(r)*Math.cos(n));return[w(i+Math.atan2(Math.sin(n)*Math.sin(r)*Math.cos(a),Math.cos(r)-Math.sin(a)*Math.sin(o))),w(o)]}function bi(e,t){return T(e,{lng:0,lat:90})/1e3<t}function xi(e,t){return T(e,{lng:0,lat:-90})/1e3<t}function Si(e){let{polygonType:t}=e,n=typeof e.anchorPoints?.[0]?.[0]==`number`?[e.anchorPoints]:e.anchorPoints;return t===`smooth`?oi(Qr(n),{iterations:4}).features?.[0]?.geometry?.coordinates??n.slice():n.slice()}function Ci(e,t){return`${e}-${L(`${t.vectorUrl}/${t.sourceLayerId}`)}`}function wi(e){return`custom-area-${L(e.vectorUrl)}`}function Ti(e,t){return e.reduce((e,n)=>{let r=n.dataBindings?.[t];return typeof r==`object`&&r&&r.t===`n`?e.push(r.v):typeof r==`number`?e.push(r):typeof r==`string`&&r&&e.push(S.test(r)?Number(r):r),e},[])}function Ei(e,t){let n=e.length;if(n<2)return 0;let r=t.projectWithScaleCorrection(e[n-1]),i=t.projectWithScaleCorrection(e[n-2]),a=r.x-i.x,o=i.y-r.y;return(90-180/Math.PI*Math.atan2(o,a)+360)%360}var Di=[[`#EDF8E9`,`#BAE4B3`,`#74C476`,`#31A354`,`#006D2C`],[`#EFF3FF`,`#BDD7E7`,`#6BAED6`,`#3182BD`,`#08519C`],[`#F0F9E8`,`#BAE4BC`,`#7BCCC4`,`#43A2CA`,`#0868AC`],[`#EDF8FB`,`#B3CDE3`,`#8C96C6`,`#8856A7`,`#810F7C`],[`#FEF0D9`,`#FDCC8A`,`#FC8D59`,`#E34A33`,`#B30000`],[`#FEEBE2`,`#FBB4B9`,`#F768A1`,`#C51B8A`,`#7A0177`],[`#D7191C`,`#FDAE61`,`#FFFFBF`,`#ABDDA4`,`#2B83BA`],[`#7B3294`,`#C2A5CF`,`#F7F7F7`,`#A6DBA0`,`#008837`]],Oi=[],ki=[/transparent/,/#[0-9a-fA-F]{3,4}/,/#[0-9a-fA-F]{6}/,/#[0-9a-fA-F]{8}/,/rgba?\(\s*(?:(?:\d{1,3}%?|none)\s*,\s*){2}(?:\d{1,3}%?|none)(?:\s*,\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/rgba?\(\s*(?:\d{1,3}%?|none)\s+(?:\d{1,3}%?|none)\s+(?:\d{1,3}%?|none)(?:\s*\/\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/hsla?\(\s*(?:[+-]?\d*\.?\d+(?:deg|grad|rad|turn)?|none)\s*,\s*(?:\d{1,3}%|none)\s*,\s*(?:\d{1,3}%|none)(?:\s*,\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/hsla?\(\s*(?:[+-]?\d*\.?\d+(?:deg|grad|rad|turn)?|none)\s+(?:\d{1,3}%|none)\s+(?:\d{1,3}%|none)(?:\s*\/\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/].map(e=>e.toString().replace(/^\/|\/$/g,``)).join(`|`),Ai=RegExp(`^\\s*(${ki})\\s*$`);function ji(e,t){let[n,r]=pt(e),i=t.length;return At(i).map(e=>n+e*(r-n)/(i-1))}var Mi={linear:(e,t)=>qr(ji(e,t),t).interpolate(Or).nice(4),quantile:(e,t)=>Jr(e,t),quantize:(e,t)=>Yr(pt(e),t).nice(),categorical:(e,t)=>Nr(e,t)};function Ni(e){if(e.choropleth){let t=Pi(e),n=Li(e.fillColor);if(t&&n){let{choropleth:r}=e,i=r.categoricalColors[n],a=r.colorMode===`categorical`?t.map(e=>i.values[e]):Fi(r.lowerColor,r.upperColor,r.colorMode===`linear`?void 0:r.colorCount);return Mi[r.colorMode](t,a)}}}function Pi(e){if(e.choropleth){let t=e.fillColor?.match(/\$\{([^}]+)}/)?.[1];if(t){let n=Ti(Object.values(e.models),t);if(!n.length||n.some(e=>typeof e!=`string`||!Ai.test(e)))return e.choropleth.colorMode===`categorical`?Array.from(new Set(n)):n}}}function Fi(e,t,n){let r=Di.find(n=>n[0]===e&&n[n.length-1]===t)??Oi.find(n=>n[0]===e&&n[n.length-1]===t);return r?Ar(kr(Or,r),n??r.length):Ar(Or(e,t),n??2)}function Ii(e,t){let n=t?Ti(e,t):void 0;return n?.length?n.every(e=>typeof e==`number`)?`number`:n.every(e=>typeof e==`string`&&Ai.test(e))?`color`:`string`:void 0}function Li(e){return e?.match(/\$\{([^}]+)}/)?.[1]}function Ri(e){let t=Object.create(null);for(let n in e){let r=e[n];t[r]=r in t?null:n}return t}function zi(e,t){let n=t?Ii(e,t):void 0;return n!==void 0&&n!==`color`}var Bi=`ArialMT`,W=15;function Vi(e,t,n,r,i){let a=document.createElement(`div`);a.className=`adornment`,e.showBackground&&(a.style.boxShadow=`0 0 7px 0 rgba(33, 37, 41, 0.25)`,a.style.borderRadius=`10px`);let o=Array.from(new Set([e.titleFont??Bi,e.labelFont??Bi]));return{element:a,ready:Promise.all(o.map(e=>r.loadReference(e))).then(()=>{let o=()=>{a.innerHTML=Hi(e,t,n,n.getScale(),r)};o(),i!==`interactive`&&n.on(`resize`,o)})}}function Hi(e,t,n,r,i){let{target:a}=e,o=t.registry?.models?.[a.modelType]?.find(e=>e.id===a.groupId),s=o?.models??[],c=o?.choropleth,l=Li(o?.fillColor);return!c||!l||o.models.every(e=>!(e.visible??!0))||!zi(s,l)?Ui(e):c.colorMode===`categorical`?Ki(e,c,l,r,i):c.colorMode===`linear`?Wi(e,o,n,r,i):c.colorMode===`quantile`||c.colorMode===`quantize`?Gi(e,o,n,r,i):Ui(e)}function Ui(e){return`
|
|
83
|
+
`}function ot(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function st(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ct(e){let t,n,r;e.length===2?(t=e===ot||e===st?e:lt,n=e,r=e):(t=ot,n=(t,n)=>ot(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<0?i=t+1:a=t}while(i<a)}return i}function a(e,r,i=0,a=e.length){if(i<a){if(t(r,r)!==0)return a;do{let t=i+a>>>1;n(e[t],r)<=0?i=t+1:a=t}while(i<a)}return i}function o(e,t,n=0,a=e.length){let o=i(e,t,n,a-1);return o>n&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function lt(){return 0}function ut(e){return e===null?NaN:+e}var dt=ct(ot),ft=dt.right;dt.left,ct(ut).center;function pt(e,t){let n,r;if(t===void 0)for(let t of e)t!=null&&(n===void 0?t>=t&&(n=r=t):(n>t&&(n=t),r<t&&(r=t)));else{let i=-1;for(let a of e)(a=t(a,++i,e))!=null&&(n===void 0?a>=a&&(n=r=a):(n>a&&(n=a),r<a&&(r=a)))}return[n,r]}var mt=class{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){let t=this._partials,n=0;for(let r=0;r<this._n&&r<32;r++){let i=t[r],a=e+i,o=Math.abs(e)<Math.abs(i)?e-(a-i):i-(a-e);o&&(t[n++]=o),e=a}return t[n]=e,this._n=n+1,this}valueOf(){let e=this._partials,t=this._n,n,r,i,a=0;if(t>0){for(a=e[--t];t>0&&(n=a,r=e[--t],a=n+r,i=r-(a-n),!i););t>0&&(i<0&&e[t-1]<0||i>0&&e[t-1]>0)&&(r=i*2,n=a+r,r==n-a&&(a=n))}return a}},ht=class extends Map{constructor(e,t=yt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(gt(this,e))}has(e){return super.has(gt(this,e))}set(e,t){return super.set(_t(this,e),t)}delete(e){return super.delete(vt(this,e))}};function gt({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function _t({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function vt({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function yt(e){return typeof e==`object`&&e?e.valueOf():e}var bt=Math.sqrt(50),xt=Math.sqrt(10),St=Math.sqrt(2);function Ct(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=bt?10:a>=xt?5:a>=St?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/l<e&&++s,c/l>t&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*l<e&&++s,c*l>t&&--c),c<s&&.5<=n&&n<2?Ct(e,t,n*2):[s,c,l]}function wt(e,t,n){if(t=+t,e=+e,n=+n,!(n>0))return[];if(e===t)return[e];let r=t<e,[i,a,o]=r?Ct(t,e,n):Ct(e,t,n);if(!(a>=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e<s;++e)c[e]=(a-e)/-o;else for(let e=0;e<s;++e)c[e]=(a-e)*o;else if(o<0)for(let e=0;e<s;++e)c[e]=(i+e)/-o;else for(let e=0;e<s;++e)c[e]=(i+e)*o;return c}function Tt(e,t,n){return t=+t,e=+e,n=+n,Ct(e,t,n)[2]}function Et(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?Tt(t,e,n):Tt(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function Dt(e,t,n=ut){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function*Ot(e){for(let t of e)yield*t}function kt(e){return Array.from(Ot(e))}function At(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function jt(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Mt(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Nt(e){return e=Mt(Math.abs(e)),e?e[1]:NaN}function Pt(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Ft(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var It=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Lt(e){if(!(t=It.exec(e)))throw Error(`invalid format: `+e);var t;return new Rt({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Lt.prototype=Rt.prototype;function Rt(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Rt.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function zt(e){out:for(var t=e.length,n=1,r=-1,i;n<t;++n)switch(e[n]){case`.`:r=i=n;break;case`0`:r===0&&(r=n),i=n;break;default:if(!+e[n])break out;r>0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Bt;function Vt(e,t){var n=Mt(e,t);if(!n)return Bt=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Bt=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Mt(e,Math.max(0,t+a-1))[0]}function Ht(e,t){var n=Mt(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Ut={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:jt,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Ht(e*100,t),r:Ht,s:Vt,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Wt(e){return e}var Gt=Array.prototype.map,Kt=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function qt(e){var t=e.grouping===void 0||e.thousands===void 0?Wt:Pt(Gt.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Wt:Ft(Gt.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Lt(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Ut[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Ut[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=zt(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Bt!==void 0?Kt[8+Bt/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++o<l;)if(p=e.charCodeAt(o),48>p||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T<h?Array(h-T+1).join(u):``;switch(g&&m&&(e=t(E+e,E.length?h-r.length:1/0),E=``),d){case`<`:e=n+e+r+E;break;case`=`:e=n+E+e+r;break;case`^`:e=E.slice(0,T=E.length>>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Nt(t)/3)))*3,r=10**-n,i=l((e=Lt(e),e.type=`f`,e),{suffix:Kt[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Jt,Yt,Xt;Zt({thousands:`,`,grouping:[3],currency:[`$`,``]});function Zt(e){return Jt=qt(e),Yt=Jt.format,Xt=Jt.formatPrefix,Jt}function Qt(e){return Math.max(0,-Nt(Math.abs(e)))}function $t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Nt(t)/3)))*3-Nt(Math.abs(e)))}function en(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Nt(t)-Nt(e))+1}function tn(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function nn(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function rn(){}var an=.7,on=1/an,sn=`\\s*([+-]?\\d+)\\s*`,cn=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,ln=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,un=/^#([0-9a-f]{3,8})$/,dn=RegExp(`^rgb\\(${sn},${sn},${sn}\\)$`),fn=RegExp(`^rgb\\(${ln},${ln},${ln}\\)$`),pn=RegExp(`^rgba\\(${sn},${sn},${sn},${cn}\\)$`),mn=RegExp(`^rgba\\(${ln},${ln},${ln},${cn}\\)$`),hn=RegExp(`^hsl\\(${cn},${ln},${ln}\\)$`),gn=RegExp(`^hsla\\(${cn},${ln},${ln},${cn}\\)$`),_n={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};tn(rn,Sn,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:vn,formatHex:vn,formatHex8:yn,formatHsl:bn,formatRgb:xn,toString:xn});function vn(){return this.rgb().formatHex()}function yn(){return this.rgb().formatHex8()}function bn(){return Pn(this).formatHsl()}function xn(){return this.rgb().formatRgb()}function Sn(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=un.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?Cn(t):n===3?new U(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?wn(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?wn(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=dn.exec(e))?new U(t[1],t[2],t[3],1):(t=fn.exec(e))?new U(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=pn.exec(e))?wn(t[1],t[2],t[3],t[4]):(t=mn.exec(e))?wn(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=hn.exec(e))?Nn(t[1],t[2]/100,t[3]/100,1):(t=gn.exec(e))?Nn(t[1],t[2]/100,t[3]/100,t[4]):_n.hasOwnProperty(e)?Cn(_n[e]):e===`transparent`?new U(NaN,NaN,NaN,0):null}function Cn(e){return new U(e>>16&255,e>>8&255,e&255,1)}function wn(e,t,n,r){return r<=0&&(e=t=n=NaN),new U(e,t,n,r)}function Tn(e){return e instanceof rn||(e=Sn(e)),e?(e=e.rgb(),new U(e.r,e.g,e.b,e.opacity)):new U}function En(e,t,n,r){return arguments.length===1?Tn(e):new U(e,t,n,r??1)}function U(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}tn(U,En,nn(rn,{brighter(e){return e=e==null?on:on**+e,new U(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?an:an**+e,new U(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new U(jn(this.r),jn(this.g),jn(this.b),An(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Dn,formatHex:Dn,formatHex8:On,formatRgb:kn,toString:kn}));function Dn(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}`}function On(){return`#${Mn(this.r)}${Mn(this.g)}${Mn(this.b)}${Mn((isNaN(this.opacity)?1:this.opacity)*255)}`}function kn(){let e=An(this.opacity);return`${e===1?`rgb(`:`rgba(`}${jn(this.r)}, ${jn(this.g)}, ${jn(this.b)}${e===1?`)`:`, ${e})`}`}function An(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function jn(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mn(e){return e=jn(e),(e<16?`0`:``)+e.toString(16)}function Nn(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new In(e,t,n,r)}function Pn(e){if(e instanceof In)return new In(e.h,e.s,e.l,e.opacity);if(e instanceof rn||(e=Sn(e)),!e)return new In;if(e instanceof In)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n<r)*6:n===a?(r-t)/s+2:(t-n)/s+4,s/=c<.5?a+i:2-a-i,o*=60):s=c>0&&c<1?0:o,new In(o,s,c,e.opacity)}function Fn(e,t,n,r){return arguments.length===1?Pn(e):new In(e,t,n,r??1)}function In(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}tn(In,Fn,nn(rn,{brighter(e){return e=e==null?on:on**+e,new In(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?an:an**+e,new In(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new U(zn(e>=240?e-240:e+120,i,r),zn(e,i,r),zn(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new In(Ln(this.h),Rn(this.s),Rn(this.l),An(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=An(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ln(this.h)}, ${Rn(this.s)*100}%, ${Rn(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ln(e){return e=(e||0)%360,e<0?e+360:e}function Rn(e){return Math.max(0,Math.min(1,e||0))}function zn(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var Bn=Math.PI/180,Vn=180/Math.PI,Hn=18,Un=.96422,Wn=1,Gn=.82521,Kn=4/29,qn=6/29,Jn=3*qn*qn,Yn=qn*qn*qn;function Xn(e){if(e instanceof Qn)return new Qn(e.l,e.a,e.b,e.opacity);if(e instanceof ar)return or(e);e instanceof U||(e=Tn(e));var t=nr(e.r),n=nr(e.g),r=nr(e.b),i=$n((.2225045*t+.7168786*n+.0606169*r)/Wn),a,o;return t===n&&n===r?a=o=i:(a=$n((.4360747*t+.3850649*n+.1430804*r)/Un),o=$n((.0139322*t+.0971045*n+.7141733*r)/Gn)),new Qn(116*i-16,500*(a-i),200*(i-o),e.opacity)}function Zn(e,t,n,r){return arguments.length===1?Xn(e):new Qn(e,t,n,r??1)}function Qn(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}tn(Qn,Zn,nn(rn,{brighter(e){return new Qn(this.l+Hn*(e??1),this.a,this.b,this.opacity)},darker(e){return new Qn(this.l-Hn*(e??1),this.a,this.b,this.opacity)},rgb(){var e=(this.l+16)/116,t=isNaN(this.a)?e:e+this.a/500,n=isNaN(this.b)?e:e-this.b/200;return t=Un*er(t),e=Wn*er(e),n=Gn*er(n),new U(tr(3.1338561*t-1.6168667*e-.4906146*n),tr(-.9787684*t+1.9161415*e+.033454*n),tr(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function $n(e){return e>Yn?e**(1/3):e/Jn+Kn}function er(e){return e>qn?e*e*e:Jn*(e-Kn)}function tr(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function nr(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function rr(e){if(e instanceof ar)return new ar(e.h,e.c,e.l,e.opacity);if(e instanceof Qn||(e=Xn(e)),e.a===0&&e.b===0)return new ar(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Vn;return new ar(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function ir(e,t,n,r){return arguments.length===1?rr(e):new ar(e,t,n,r??1)}function ar(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function or(e){if(isNaN(e.h))return new Qn(e.l,0,0,e.opacity);var t=e.h*Bn;return new Qn(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}tn(ar,ir,nn(rn,{brighter(e){return new ar(this.h,this.c,this.l+Hn*(e??1),this.opacity)},darker(e){return new ar(this.h,this.c,this.l-Hn*(e??1),this.opacity)},rgb(){return or(this).rgb()}}));var sr=e=>()=>e;function cr(e,t){return function(n){return e+n*t}}function lr(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function ur(e,t){var n=t-e;return n?cr(e,n>180||n<-180?n-360*Math.round(n/360):n):sr(isNaN(e)?t:e)}function dr(e){return(e=+e)==1?fr:function(t,n){return n-t?lr(t,n,e):sr(isNaN(t)?n:t)}}function fr(e,t){var n=t-e;return n?cr(e,n):sr(isNaN(e)?t:e)}var pr=(function e(t){var n=dr(t);function r(e,t){var r=n((e=En(e)).r,(t=En(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=fr(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function mr(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;i<n;++i)r[i]=e[i]*(1-a)+t[i]*a;return r}}function hr(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function gr(e,t){var n=t?t.length:0,r=e?Math.min(n,e.length):0,i=Array(r),a=Array(n),o;for(o=0;o<r;++o)i[o]=Tr(e[o],t[o]);for(;o<n;++o)a[o]=t[o];return function(e){for(o=0;o<r;++o)a[o]=i[o](e);return a}}function _r(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function vr(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function yr(e,t){var n={},r={},i;for(i in(typeof e!=`object`||!e)&&(e={}),(typeof t!=`object`||!t)&&(t={}),t)i in e?n[i]=Tr(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var br=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,xr=new RegExp(br.source,`g`);function Sr(e){return function(){return e}}function Cr(e){return function(t){return e(t)+``}}function wr(e,t){var n=br.lastIndex=xr.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=br.exec(e))&&(i=xr.exec(t));)(a=i.index)>n&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:vr(r,i)})),n=xr.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?Cr(c[0].x):Sr(t):(t=c.length,function(e){for(var n=0,r;n<t;++n)s[(r=c[n]).i]=r.x(e);return s.join(``)})}function Tr(e,t){var n=typeof t,r;return t==null||n===`boolean`?sr(t):(n===`number`?vr:n===`string`?(r=Sn(t))?(t=r,pr):wr:t instanceof Sn?pr:t instanceof Date?_r:hr(t)?mr:Array.isArray(t)?gr:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?yr:vr)(e,t)}function Er(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Dr(e){return function(t,n){var r=e((t=ir(t)).h,(n=ir(n)).h),i=fr(t.c,n.c),a=fr(t.l,n.l),o=fr(t.opacity,n.opacity);return function(e){return t.h=r(e),t.c=i(e),t.l=a(e),t.opacity=o(e),t+``}}}var Or=Dr(ur);function kr(e,t){t===void 0&&(t=e,e=Tr);for(var n=0,r=t.length-1,i=t[0],a=Array(r<0?0:r);n<r;)a[n]=e(i,i=t[++n]);return function(e){var t=Math.max(0,Math.min(r-1,Math.floor(e*=r)));return a[t](e-t)}}function Ar(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}function jr(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var Mr=Symbol(`implicit`);function Nr(){var e=new ht,t=[],n=[],r=Mr;function i(i){let a=e.get(i);if(a===void 0){if(r!==Mr)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return i.domain=function(n){if(!arguments.length)return t.slice();t=[],e=new ht;for(let r of n)e.has(r)||e.set(r,t.push(r)-1);return i},i.range=function(e){return arguments.length?(n=Array.from(e),i):n.slice()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return Nr(t,n).unknown(r)},jr.apply(i,arguments),i}function Pr(e){return function(){return e}}function Fr(e){return+e}var Ir=[0,1];function Lr(e){return e}function Rr(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:Pr(isNaN(t)?NaN:.5)}function zr(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function Br(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=Rr(i,r),a=n(o,a)):(r=Rr(r,i),a=n(a,o)),function(e){return a(r(e))}}function Vr(e,t,n){var r=Math.min(e.length,t.length)-1,i=Array(r),a=Array(r),o=-1;for(e[r]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++o<r;)i[o]=Rr(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=ft(e,t,1,r)-1;return a[n](i[n](t))}}function Hr(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Ur(){var e=Ir,t=Ir,n=Tr,r,i,a,o=Lr,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==Lr&&(o=zr(e[0],e[n-1])),s=n>2?Vr:Br,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),vr))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,Fr),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=Er,u()},d.clamp=function(e){return arguments.length?(o=e?!0:Lr,u()):o!==Lr},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Wr(){return Ur()(Lr,Lr)}function Gr(e,t,n,r){var i=Et(e,t,n),a;switch(r=Lt(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=$t(i,o))&&(r.precision=a),Xt(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=en(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Qt(i))&&(r.precision=a-(r.type===`%`)*2);break}return Yt(r)}function Kr(e){var t=e.domain;return e.ticks=function(e){var n=t();return wt(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Gr(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s<o&&(l=o,o=s,s=l,l=i,i=a,a=l);u-- >0;){if(l=Tt(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function qr(){var e=Wr();return e.copy=function(){return Hr(e,qr())},jr.apply(e,arguments),Kr(e)}function Jr(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r<i;)n[r-1]=Dt(e,r/i);return a}function a(e){return e==null||isNaN(e=+e)?r:t[ft(n,e)]}return a.invertExtent=function(r){var i=t.indexOf(r);return i<0?[NaN,NaN]:[i>0?n[i-1]:e[0],i<n.length?n[i]:e[e.length-1]]},a.domain=function(t){if(!arguments.length)return e.slice();e=[];for(let n of t)n!=null&&!isNaN(n=+n)&&e.push(n);return e.sort(ot),i()},a.range=function(e){return arguments.length?(t=Array.from(e),i()):t.slice()},a.unknown=function(e){return arguments.length?(r=e,a):r},a.quantiles=function(){return n.slice()},a.copy=function(){return Jr().domain(e).range(t).unknown(r)},jr.apply(a,arguments)}function Yr(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[ft(r,e,0,n)]:a}function s(){var i=-1;for(r=Array(n);++i<n;)r[i]=((i+1)*t-(i-n)*e)/(n+1);return o}return o.domain=function(n){return arguments.length?([e,t]=n,e=+e,t=+t,s()):[e,t]},o.range=function(e){return arguments.length?(n=(i=Array.from(e)).length-1,s()):i.slice()},o.invertExtent=function(a){var o=i.indexOf(a);return o<0?[NaN,NaN]:o<1?[e,r[0]]:o>=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return Yr().domain([e,t]).range(i).unknown(a)},jr.apply(Kr(o),arguments)}var Xr=6371008.8;Xr*100,Xr*100,360/(2*Math.PI),Xr*3.28084,Xr*39.37,Xr/1e3,Xr/1e3,Xr/1609.344,Xr*1e3,Xr*1e3,Xr/1852,Xr*1.0936;function Zr(e,t,n={}){let r={type:`Feature`};return(n.id===0||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=t||{},r.geometry=e,r}function Qr(e,t,n={}){for(let t of e){if(t.length<4)throw Error(`Each LinearRing of a Polygon must have 4 or more Positions.`);if(t[t.length-1].length!==t[0].length)throw Error(`First and last Position are not equivalent.`);for(let e=0;e<t[t.length-1].length;e++)if(t[t.length-1][e]!==t[0][e])throw Error(`First and last Position are not equivalent.`)}return Zr({type:`Polygon`,coordinates:e},t,n)}function $r(e,t,n={}){if(e.length<2)throw Error(`coordinates must be an array of two or more positions`);return Zr({type:`LineString`,coordinates:e},t,n)}function ei(e,t={}){let n={type:`FeatureCollection`};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function ti(e,t,n={}){return Zr({type:`MultiLineString`,coordinates:e},t,n)}function ni(e,t,n={}){return Zr({type:`MultiPolygon`,coordinates:e},t,n)}function ri(e,t,n){if(e!==null)for(var r,i,a,o,s,c,l,u=0,d=0,f,p=e.type,m=p===`FeatureCollection`,h=p===`Feature`,g=m?e.features.length:1,_=0;_<g;_++){l=m?e.features[_].geometry:h?e.geometry:e,f=l?l.type===`GeometryCollection`:!1,s=f?l.geometries.length:1;for(var v=0;v<s;v++){var y=0,b=0;if(o=f?l.geometries[v]:l,o!==null){c=o.coordinates;var x=o.type;switch(u=n&&(x===`Polygon`||x===`MultiPolygon`)?1:0,x){case null:break;case`Point`:if(t(c,d,_,y,b)===!1)return!1;d++,y++;break;case`LineString`:case`MultiPoint`:for(r=0;r<c.length;r++){if(t(c[r],d,_,y,b)===!1)return!1;d++,x===`MultiPoint`&&y++}x===`LineString`&&y++;break;case`Polygon`:case`MultiLineString`:for(r=0;r<c.length;r++){for(i=0;i<c[r].length-u;i++){if(t(c[r][i],d,_,y,b)===!1)return!1;d++}x===`MultiLineString`&&y++,x===`Polygon`&&b++}x===`Polygon`&&y++;break;case`MultiPolygon`:for(r=0;r<c.length;r++){for(b=0,i=0;i<c[r].length;i++){for(a=0;a<c[r][i].length-u;a++){if(t(c[r][i][a],d,_,y,b)===!1)return!1;d++}b++}y++}break;case`GeometryCollection`:for(r=0;r<o.geometries.length;r++)if(ri(o.geometries[r],t,n)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}}}}function ii(e,t){var n,r,i,a,o,s,c,l,u,d,f=0,p=e.type===`FeatureCollection`,m=e.type===`Feature`,h=p?e.features.length:1;for(n=0;n<h;n++){for(s=p?e.features[n].geometry:m?e.geometry:e,l=p?e.features[n].properties:m?e.properties:{},u=p?e.features[n].bbox:m?e.bbox:void 0,d=p?e.features[n].id:m?e.id:void 0,c=s?s.type===`GeometryCollection`:!1,o=c?s.geometries.length:1,i=0;i<o;i++){if(a=c?s.geometries[i]:s,a===null){if(t(null,f,l,u,d)===!1)return!1;continue}switch(a.type){case`Point`:case`LineString`:case`MultiPoint`:case`Polygon`:case`MultiLineString`:case`MultiPolygon`:if(t(a,f,l,u,d)===!1)return!1;break;case`GeometryCollection`:for(r=0;r<a.geometries.length;r++)if(t(a.geometries[r],f,l,u,d)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}f++}}function ai(e,t,n){var r=n;return ii(e,function(e,i,a,o,s){r=i===0&&n===void 0?e:t(r,e,i,a,o,s)}),r}function oi(e,t){t||={},t.iterations=t.iterations||1;let{iterations:n}=t,r=[];if(!e)throw Error(`inputPolys is required`);return ii(e,function(e,t,i){if(e.type===`Polygon`){let t=[[]];for(let r=0;r<n;r++){let n=[],i=e;r>0&&(i=Qr(t).geometry),si(i,n),t=n.slice(0)}r.push(Qr(t,i))}else if(e.type===`MultiPolygon`){let t=[[[]]];for(let r=0;r<n;r++){let n=[],i=e;r>0&&(i=ni(t).geometry),ci(i,n),t=n.slice(0)}r.push(ni(t,i))}else throw Error(`geometry is invalid, must be Polygon or MultiPolygon`)}),ei(r)}function si(e,t){var n,r;ri(e,function(e,i,a,o,s){if(r!==s)t.push([]);else{var c=n[0],l=n[1],u=e[0],d=e[1];t[s].push([.75*c+.25*u,.75*l+.25*d]),t[s].push([.25*c+.75*u,.25*l+.75*d])}n=e,r=s},!1),t.forEach(function(e){e.push(e[0])})}function ci(e,t){let n,r,i;ri(e,function(e,a,o,s,c){if(r!==s)t.push([[]]);else if(i!==c)t[s].push([]);else{var l=n[0],u=n[1],d=e[0],f=e[1];t[s][c].push([.75*l+.25*d,.75*u+.25*f]),t[s][c].push([.25*l+.75*d,.25*u+.75*f])}n=e,r=s,i=c},!1),t.forEach(function(e){e.forEach(function(e){e.push(e[0])})})}function li(e){return e.type===`Feature`?e.geometry:e}function ui(e,t,n){var r=e.length,i=pi(e[0],t),a=[],o,s,c;let l,u;for(n||=[],o=1;o<r;o++){for(l=e[o-1],u=e[o],s=c=pi(u,t);;)if(!(i|s)){a.push(l),s===c?o===r-1&&a.push(u):(a.push(u),o<r-1&&(n.push(a),a=[]));break}else if(i&s)break;else i?(l=fi(l,u,i,t),i=pi(l,t)):(u=fi(l,u,s,t),s=pi(u,t));i=c}return a.length&&n.push(a),n}function di(e,t){var n,r,i,a,o,s,c;for(r=1;r<=8;r*=2){for(n=[],i=e[e.length-1],a=!(pi(i,t)&r),o=0;o<e.length;o++)s=e[o],c=!(pi(s,t)&r),c!==a&&n.push(fi(i,s,r,t)),c&&n.push(s),i=s,a=c;if(e=n,!e.length)break}return n}function fi(e,t,n,r){return n&8?[e[0]+(t[0]-e[0])*(r[3]-e[1])/(t[1]-e[1]),r[3]]:n&4?[e[0]+(t[0]-e[0])*(r[1]-e[1])/(t[1]-e[1]),r[1]]:n&2?[r[2],e[1]+(t[1]-e[1])*(r[2]-e[0])/(t[0]-e[0])]:n&1?[r[0],e[1]+(t[1]-e[1])*(r[0]-e[0])/(t[0]-e[0])]:null}function pi(e,t){var n=0;return e[0]<t[0]?n|=1:e[0]>t[2]&&(n|=2),e[1]<t[1]?n|=4:e[1]>t[3]&&(n|=8),n}function mi(e,t){let n=li(e),r=n.type,i=e.type===`Feature`?e.properties:{},a=n.coordinates;switch(r){case`LineString`:case`MultiLineString`:{let e=[];return r===`LineString`&&(a=[a]),a.forEach(n=>{ui(n,t,e)}),e.length===1?$r(e[0],i):ti(e,i)}case`Polygon`:return Qr(hi(a,t),i);case`MultiPolygon`:return ni(a.map(e=>hi(e,t)),i);default:throw Error(`geometry `+r+` not supported`)}}function hi(e,t){let n=[];for(let r of e){let e=di(r,t);e.length>0&&((e[0][0]!==e[e.length-1][0]||e[0][1]!==e[e.length-1][1])&&e.push(e[0]),e.length>=4&&n.push(e))}return n}var gi=mi;function _i(e,t){let n=[],r=Math.PI*2/100;for(let i=0;i<100;i++)n.push(yi(e,t,i*r));if(bi(e,t)){let e=n[0],t=n[n.length-1],r=(t[0]+e[0]-360)/2,i=(e[1]+t[1])/2;n.push([r,i]),n.push([r,90]),n.push([r+360,90]),n.push([r+360,i])}if(xi(e,t)){let e=n[49],t=n[50],r=(t[0]+e[0]-360)/2,i=(e[1]+t[1])/2;n.splice(50,0,[r+360,i],[r+360,-90],[r,-90],[r,i])}return n.push(n[0]),n}function vi(e,t,n){let r=[],i=t/100;for(let t=0;t<=100;t++)r.push(yi(e,t*i,S(n)));return gi($r(r),[-1/0,-85.051129,1/0,85.051129]).geometry.coordinates}function yi(e,t,n){let r=t/6378.1,i=S(e.lng),a=S(e.lat),o=Math.asin(Math.sin(a)*Math.cos(r)+Math.cos(a)*Math.sin(r)*Math.cos(n));return[C(i+Math.atan2(Math.sin(n)*Math.sin(r)*Math.cos(a),Math.cos(r)-Math.sin(a)*Math.sin(o))),C(o)]}function bi(e,t){return w(e,{lng:0,lat:90})/1e3<t}function xi(e,t){return w(e,{lng:0,lat:-90})/1e3<t}function Si(e){let{polygonType:t}=e,n=typeof e.anchorPoints?.[0]?.[0]==`number`?[e.anchorPoints]:e.anchorPoints;return t===`smooth`?oi(Qr(n),{iterations:4}).features?.[0]?.geometry?.coordinates??n.slice():n.slice()}function Ci(e,t){return`${e}-${ne(`${t.vectorUrl}/${t.sourceLayerId}`)}`}function wi(e){return`custom-area-${ne(e.vectorUrl)}`}function Ti(e,t){return e.reduce((e,n)=>{let r=n.dataBindings?.[t];return typeof r==`object`&&r&&r.t===`n`?e.push(r.v):(typeof r==`number`||typeof r==`string`&&r)&&e.push(r),e},[])}function Ei(e,t){let n=e.length;if(n<2)return 0;let r=t.projectWithScaleCorrection(e[n-1]),i=t.projectWithScaleCorrection(e[n-2]),a=r.x-i.x,o=i.y-r.y;return(90-180/Math.PI*Math.atan2(o,a)+360)%360}var Di=[[`#EDF8E9`,`#BAE4B3`,`#74C476`,`#31A354`,`#006D2C`],[`#EFF3FF`,`#BDD7E7`,`#6BAED6`,`#3182BD`,`#08519C`],[`#F0F9E8`,`#BAE4BC`,`#7BCCC4`,`#43A2CA`,`#0868AC`],[`#EDF8FB`,`#B3CDE3`,`#8C96C6`,`#8856A7`,`#810F7C`],[`#FEF0D9`,`#FDCC8A`,`#FC8D59`,`#E34A33`,`#B30000`],[`#FEEBE2`,`#FBB4B9`,`#F768A1`,`#C51B8A`,`#7A0177`],[`#D7191C`,`#FDAE61`,`#FFFFBF`,`#ABDDA4`,`#2B83BA`],[`#7B3294`,`#C2A5CF`,`#F7F7F7`,`#A6DBA0`,`#008837`]],Oi=[],ki=[/transparent/,/#[0-9a-fA-F]{3,4}/,/#[0-9a-fA-F]{6}/,/#[0-9a-fA-F]{8}/,/rgba?\(\s*(?:(?:\d{1,3}%?|none)\s*,\s*){2}(?:\d{1,3}%?|none)(?:\s*,\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/rgba?\(\s*(?:\d{1,3}%?|none)\s+(?:\d{1,3}%?|none)\s+(?:\d{1,3}%?|none)(?:\s*\/\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/hsla?\(\s*(?:[+-]?\d*\.?\d+(?:deg|grad|rad|turn)?|none)\s*,\s*(?:\d{1,3}%|none)\s*,\s*(?:\d{1,3}%|none)(?:\s*,\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/,/hsla?\(\s*(?:[+-]?\d*\.?\d+(?:deg|grad|rad|turn)?|none)\s+(?:\d{1,3}%|none)\s+(?:\d{1,3}%|none)(?:\s*\/\s*(?:0|1|0?\.\d+|\d+%|none))?\s*\)/].map(e=>e.toString().replace(/^\/|\/$/g,``)).join(`|`),Ai=RegExp(`^\\s*(${ki})\\s*$`);function ji(e,t){let[n,r]=pt(e),i=t.length;return At(i).map(e=>n+e*(r-n)/(i-1))}var Mi={linear:(e,t)=>qr(ji(e,t),t).interpolate(Or).nice(4),quantile:(e,t)=>Jr(e,t),quantize:(e,t)=>Yr(pt(e),t).nice(),categorical:(e,t)=>Nr(e,t)};function Ni(e){if(e.choropleth){let t=Pi(e),n=Li(e.fillColor);if(t&&n){let{choropleth:r}=e,i=r.categoricalColors[n],a=r.colorMode===`categorical`?t.map(e=>i.values[e]):Fi(r.lowerColor,r.upperColor,r.colorMode===`linear`?void 0:r.colorCount);return Mi[r.colorMode](t,a)}}}function Pi(e){if(e.choropleth){let t=e.fillColor?.match(/\$\{([^}]+)}/)?.[1];if(t){let n=Ti(Object.values(e.models),t);if(!n.length||n.some(e=>typeof e!=`string`||!Ai.test(e)))return e.choropleth.colorMode===`categorical`?Array.from(new Set(n)):n}}}function Fi(e,t,n){let r=Di.find(n=>n[0]===e&&n[n.length-1]===t)??Oi.find(n=>n[0]===e&&n[n.length-1]===t);return r?Ar(kr(Or,r),n??r.length):Ar(Or(e,t),n??2)}function Ii(e,t){let n=t?Ti(e,t):void 0;return n?.length?n.every(e=>typeof e==`number`)?`number`:n.every(e=>typeof e==`string`&&Ai.test(e))?`color`:`string`:void 0}function Li(e){return e?.match(/\$\{([^}]+)}/)?.[1]}function Ri(e){let t=Object.create(null);for(let n in e){let r=e[n];t[r]=r in t?null:n}return t}function zi(e,t){let n=t?Ii(e,t):void 0;return n!==void 0&&n!==`color`}var Bi=`ArialMT`,W=15;function Vi(e,t,n,r,i){let a=document.createElement(`div`);a.className=`adornment`,e.showBackground&&(a.style.boxShadow=`0 0 7px 0 rgba(33, 37, 41, 0.25)`,a.style.borderRadius=`10px`);let o=Array.from(new Set([e.titleFont??Bi,e.labelFont??Bi]));return{element:a,ready:Promise.all(o.map(e=>r.loadReference(e))).then(()=>{let o=()=>{a.innerHTML=Hi(e,t,n,n.getScale(),r)};o(),i!==`interactive`&&n.on(`resize`,o)})}}function Hi(e,t,n,r,i){let{target:a}=e,o=t.registry?.models?.[a.modelType]?.find(e=>e.id===a.groupId),s=o?.models??[],c=o?.choropleth,l=Li(o?.fillColor);return!c||!l||o.models.every(e=>!(e.visible??!0))||!zi(s,l)?Ui(e):c.colorMode===`categorical`?Ki(e,c,l,r,i):c.colorMode===`linear`?Wi(e,o,n,r,i):c.colorMode===`quantile`||c.colorMode===`quantize`?Gi(e,o,n,r,i):Ui(e)}function Ui(e){return`
|
|
84
84
|
<svg
|
|
85
85
|
class="adornment-svg"
|
|
86
86
|
data-adornment-name="${B(e.name)}"
|
|
@@ -96,14 +96,14 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
96
96
|
${O.join(``)}
|
|
97
97
|
</linearGradient>
|
|
98
98
|
</defs>
|
|
99
|
-
`);let A=qe([d],_,f),j=d.trim().length>0,M={width:Math.max(0,...D.map(e=>e.width)),height:Math.max(0,...D.map(e=>e.height)),ascent:Math.max(0,...D.map(e=>e.ascent))},N=j?A.height+10:0,P=j?A.width:0,F=w.length-1,
|
|
99
|
+
`);let A=qe([d],_,f),j=d.trim().length>0,M={width:Math.max(0,...D.map(e=>e.width)),height:Math.max(0,...D.map(e=>e.height)),ascent:Math.max(0,...D.map(e=>e.ascent))},N=j?A.height+10:0,P=j?A.width:0,F=w.length-1,te=L(45*F,Math.ceil(y?(M.width+10)*F:(M.height+10)*F),Math.floor(y?n.getContainer().clientWidth/r-10-W*2:n.getContainer().clientHeight/r-10-W*2-N)),ne=Math.ceil(y?W*2+Math.max(P,te):W*2+Math.max(P,25+M.width)),re=Math.ceil(y?W*2+N+20+5+M.ascent:W*2+N+te);m&&x.push(`
|
|
100
100
|
<rect
|
|
101
101
|
x="0"
|
|
102
102
|
y="0"
|
|
103
103
|
rx="10"
|
|
104
104
|
ry="10"
|
|
105
|
-
width="${
|
|
106
|
-
height="${
|
|
105
|
+
width="${ne}"
|
|
106
|
+
height="${re}"
|
|
107
107
|
${H(h)}
|
|
108
108
|
/>
|
|
109
109
|
`);let R=W,z=W;j&&(x.push(`
|
|
@@ -122,11 +122,11 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
122
122
|
y="${z}"
|
|
123
123
|
rx="${a}"
|
|
124
124
|
ry="${a}"
|
|
125
|
-
width="${y?
|
|
126
|
-
height="${y?15:
|
|
125
|
+
width="${y?te:15}"
|
|
126
|
+
height="${y?15:te}"
|
|
127
127
|
fill="url(#${v})"
|
|
128
128
|
/>
|
|
129
|
-
`);for(let e=1;e<w.length-1;e++){let t=w[e],n=E[e],r=D[e],i=I(0,ee
|
|
129
|
+
`);for(let e=1;e<w.length-1;e++){let t=w[e],n=E[e],r=D[e],i=I(0,te,ee(S,C,t));i>a&&i<te-a&&x.push(`
|
|
130
130
|
<line
|
|
131
131
|
x1="${y?Math.floor(R+i)+.5:R}"
|
|
132
132
|
y1="${y?z:Math.floor(z+i)+.5}"
|
|
@@ -150,13 +150,13 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
150
150
|
class="adornment-svg"
|
|
151
151
|
data-adornment-name="${B(e.name)}"
|
|
152
152
|
xmlns="http://www.w3.org/2000/svg"
|
|
153
|
-
width="${
|
|
154
|
-
height="${
|
|
155
|
-
viewBox="0 0 ${
|
|
153
|
+
width="${ne*r}"
|
|
154
|
+
height="${re*r}"
|
|
155
|
+
viewBox="0 0 ${ne} ${re}"
|
|
156
156
|
>
|
|
157
157
|
${x.join(``)}
|
|
158
158
|
</svg>
|
|
159
|
-
`}function Gi(e,t,n,r,i){let a=Ni(t),o=a?.range(),s=[],c=0,l=0;if(a&&o&&o.length>1){let{layout:t=`vertical`,labelFontSize:u=13,labelFontColor:d=`#000000`,labelStyle:f=`range`,numberFormat:p=`.2~s`,title:m=``,titleFontSize:h=14,titleFontColor:g=`#000000`,showBackground:_=!1,background:v=`#ffffff`}=e,y=i.resolve(e.labelFont??Bi),b=i.resolve(e.titleFont??Bi),x=t===`vertical`,S=f===`range`,C=qi(p),w=S?o.map(e=>a.invertExtent(e)).map((e,t,n)=>t===0?`< ${C(e[1])}`:t===n.length-1?`> ${C(e[0])}`:`${C(e[0])} – ${C(e[1])}`):o.map(e=>a.invertExtent(e)).reduce((e,t,n)=>(n&&e.push(C(t[0])),e),[]),T=w.map(e=>qe([e],y,u)),E=qe([m],b,h),D=m.trim().length>0,O={width:Math.max(0,...T.map(e=>e.width)),height:Math.max(0,...T.map(e=>e.height)),ascent:Math.max(0,...T.map(e=>e.ascent))},k=D?E.height+10:0,A=D?E.width:0,j=o.length,M=45,N=15/2;x?(M=
|
|
159
|
+
`}function Gi(e,t,n,r,i){let a=Ni(t),o=a?.range(),s=[],c=0,l=0;if(a&&o&&o.length>1){let{layout:t=`vertical`,labelFontSize:u=13,labelFontColor:d=`#000000`,labelStyle:f=`range`,numberFormat:p=`.2~s`,title:m=``,titleFontSize:h=14,titleFontColor:g=`#000000`,showBackground:_=!1,background:v=`#ffffff`}=e,y=i.resolve(e.labelFont??Bi),b=i.resolve(e.titleFont??Bi),x=t===`vertical`,S=f===`range`,C=qi(p),w=S?o.map(e=>a.invertExtent(e)).map((e,t,n)=>t===0?`< ${C(e[1])}`:t===n.length-1?`> ${C(e[0])}`:`${C(e[0])} – ${C(e[1])}`):o.map(e=>a.invertExtent(e)).reduce((e,t,n)=>(n&&e.push(C(t[0])),e),[]),T=w.map(e=>qe([e],y,u)),E=qe([m],b,h),D=m.trim().length>0,O={width:Math.max(0,...T.map(e=>e.width)),height:Math.max(0,...T.map(e=>e.height)),ascent:Math.max(0,...T.map(e=>e.ascent))},k=D?E.height+10:0,A=D?E.width:0,j=o.length,M=45,N=15/2;x?(M=L(M,Math.ceil(O.height)+10,Math.floor((n.getContainer().clientHeight/r-10-W*2-k)/j)),c=Math.ceil(W*2+k+j*M),l=Math.ceil(W*2+Math.max(A,25+O.width))):(M=L(M,Math.ceil(O.width)+10,Math.floor((n.getContainer().clientWidth/r-10-W*2)/j)),l=Math.ceil(W*2+Math.max(A,j*M)),c=Math.ceil(W*2+k+15+10+O.ascent)),_&&s.push(`
|
|
160
160
|
<rect
|
|
161
161
|
x="0"
|
|
162
162
|
y="0"
|
|
@@ -176,31 +176,31 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
176
176
|
>
|
|
177
177
|
${B(m)}
|
|
178
178
|
</text>
|
|
179
|
-
`),F+=k);let
|
|
179
|
+
`),F+=k);let I=x?15:M,ee=x?M:15,te=x?0:M,ne=x?M:0,re=S?15:20,R=x?`M ${P} ${F+N} v ${M-N} h 15 v ${-(M-N)} a ${N} ${N} 0 0 0 -15 0 z`:`M ${P+N} ${F} h ${M-N} v 15 h ${-(M-N)} a ${N} ${N} 0 0 1 0 -15 z`;s.push(`<path d="${R}" ${H(o[0])} />`),P+=te,F+=ne;for(let e=1;e<j-1;e++,P+=te,F+=ne)s.push(`
|
|
180
180
|
<rect
|
|
181
181
|
x="${P}"
|
|
182
182
|
y="${F}"
|
|
183
|
-
width="${
|
|
184
|
-
height="${
|
|
183
|
+
width="${I}"
|
|
184
|
+
height="${ee}"
|
|
185
185
|
${H(o[e])}
|
|
186
186
|
/>
|
|
187
187
|
`),s.push(`
|
|
188
188
|
<line
|
|
189
189
|
x1="${x?P:P+.5}"
|
|
190
190
|
y1="${x?F+.5:F}"
|
|
191
|
-
x2="${x?P+
|
|
192
|
-
y2="${x?F+.5:F+
|
|
191
|
+
x2="${x?P+re:P+.5}"
|
|
192
|
+
y2="${x?F+.5:F+re}"
|
|
193
193
|
stroke="#ffffff"
|
|
194
194
|
/>
|
|
195
195
|
`);let z=x?`M ${P} ${F} v ${M-N} a ${N} ${N} 0 0 0 15 0 v ${-(M-N)} z`:`M ${P} ${F} h ${M-N} a ${N} ${N} 0 0 1 0 15 h ${-(M-N)} z`;s.push(`<path d="${z}" ${H(o[j-1])} />`),s.push(`
|
|
196
196
|
<line
|
|
197
197
|
x1="${x?P:P+.5}"
|
|
198
198
|
y1="${x?F+.5:F}"
|
|
199
|
-
x2="${x?P+
|
|
200
|
-
y2="${x?F+.5:F+
|
|
199
|
+
x2="${x?P+re:P+.5}"
|
|
200
|
+
y2="${x?F+.5:F+re}"
|
|
201
201
|
stroke="#ffffff"
|
|
202
202
|
/>
|
|
203
|
-
`),P=W,F=W+k;for(let e=0;e<w.length;e++,P+=te,F+=
|
|
203
|
+
`),P=W,F=W+k;for(let e=0;e<w.length;e++,P+=te,F+=ne)s.push(`
|
|
204
204
|
<text
|
|
205
205
|
x="${x?P+15+10:P+(S?M/2:M)}"
|
|
206
206
|
y="${x?F+(S?M/2:M)-O.height/2+O.ascent:F+15+10+O.ascent}"
|
|
@@ -222,7 +222,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
222
222
|
>
|
|
223
223
|
${s.join(``)}
|
|
224
224
|
</svg>
|
|
225
|
-
`}function Ki(e,t,n,r,i){let a=t.categoricalColors[n];if(a===void 0)return Ui(e);let o=Ri(a.values),s=Object.entries(a.colors).map(([e,n])=>({color:e,label:n.title??o[e]??t.defaultGroupName,order:n.order,hidden:n.hidden,svg:``})).filter(e=>!e.hidden).sort((e,t)=>e.order-t.order);return at({type:`manualLegend`,id:e.id,name:e.name,position:e.position,stacking:e.stacking??`vertical`,layout:e.layout??`vertical`,title:e.title??``,titleFont:e.titleFont??Bi,titleFontColor:e.titleFontColor??`#000000`,titleFontSize:e.titleFontSize??14,entryFont:e.labelFont??Bi,entryFontColor:e.labelFontColor??`#000000`,entryFontSize:e.labelFontSize??13,entryShape:`rectangle`,entries:s,background:e.background??`#ffffff`,showBackground:e.showBackground??!1},Bi,r,i)}function qi(e){let{decimal:t,group:n}=Ji();return qt({decimal:t,thousands:n,grouping:[3],currency:[``,``]}).format(e)}function Ji(){let e=new Intl.NumberFormat(navigator.languages).formatToParts(1000.1),t=e.find(e=>e.type===`decimal`)?.value,n=e.find(e=>e.type===`group`)?.value;return t!==void 0&&n!==void 0?{decimal:t,group:n}:{decimal:`.`,group:`,`}}function Yi(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`,e.showBackground&&(i.style.boxShadow=`0 0 7px 0 rgba(33, 37, 41, 0.25)`,i.style.borderRadius=`10px`);let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.entryFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=at(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function Xi(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=(e.scale??1)*30,a=()=>{let n=i*t.getScale();r.style.cssText=`width: ${n}px; height: ${n}px`,r.innerHTML=Zi(e,t,n)};return a(),t.on(`move`,a),n!==`interactive`&&t.on(`resize`,a),r}function Zi(e,t,n){let r=t.getPitch(),i=t.getBearing(),a=Math.cos(
|
|
225
|
+
`}function Ki(e,t,n,r,i){let a=t.categoricalColors[n];if(a===void 0)return Ui(e);let o=Ri(a.values),s=Object.entries(a.colors).map(([e,n])=>({color:e,label:n.title??o[e]??t.defaultGroupName,order:n.order,hidden:n.hidden,svg:``})).filter(e=>!e.hidden).sort((e,t)=>e.order-t.order);return at({type:`manualLegend`,id:e.id,name:e.name,position:e.position,stacking:e.stacking??`vertical`,layout:e.layout??`vertical`,title:e.title??``,titleFont:e.titleFont??Bi,titleFontColor:e.titleFontColor??`#000000`,titleFontSize:e.titleFontSize??14,entryFont:e.labelFont??Bi,entryFontColor:e.labelFontColor??`#000000`,entryFontSize:e.labelFontSize??13,entryShape:`rectangle`,entries:s,background:e.background??`#ffffff`,showBackground:e.showBackground??!1},Bi,r,i)}function qi(e){let{decimal:t,group:n}=Ji();return qt({decimal:t,thousands:n,grouping:[3],currency:[``,``]}).format(e)}function Ji(){let e=new Intl.NumberFormat(navigator.languages).formatToParts(1000.1),t=e.find(e=>e.type===`decimal`)?.value,n=e.find(e=>e.type===`group`)?.value;return t!==void 0&&n!==void 0?{decimal:t,group:n}:{decimal:`.`,group:`,`}}function Yi(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`,e.showBackground&&(i.style.boxShadow=`0 0 7px 0 rgba(33, 37, 41, 0.25)`,i.style.borderRadius=`10px`);let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.entryFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=at(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function Xi(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=(e.scale??1)*30,a=()=>{let n=i*t.getScale();r.style.cssText=`width: ${n}px; height: ${n}px`,r.innerHTML=Zi(e,t,n)};return a(),t.on(`move`,a),n!==`interactive`&&t.on(`resize`,a),r}function Zi(e,t,n){let r=t.getPitch(),i=t.getBearing(),a=Math.cos(S(r));return`
|
|
226
226
|
<svg class="adornment-svg" data-adornment-name="${B(e.name)}" width="${n}" height="${n}" viewBox="-5 -5 30 30" xmlns="http://www.w3.org/2000/svg">
|
|
227
227
|
<g class="tilt" transform="matrix(1 0 0 ${a} 0 ${10*(1-a)})">
|
|
228
228
|
<g class="rotate" transform="rotate(${-i} 10 10)">
|
|
@@ -231,7 +231,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
231
231
|
</g>
|
|
232
232
|
</svg>
|
|
233
233
|
`}var Qi=`<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><mask id="a" fill="#fff"><rect x="8.582" y="1" width="6.42" height="6.42" rx="1.083"/></mask><rect x="8.582" y="1" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#a)"/><mask id="b" fill="#fff"><rect x="1" y="1" width="6.42" height="6.42" rx="1.083"/></mask><rect x="1" y="1" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#b)"/><mask id="c" fill="#fff"><rect x="8.582" y="8.582" width="6.42" height="6.42" rx="1.083"/></mask><rect x="8.582" y="8.582" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#c)"/><mask id="d" fill="#fff"><rect x="1" y="8.582" width="6.42" height="6.42" rx="1.083"/></mask><rect x="1" y="8.582" width="6.42" height="6.42" rx="1.083" stroke="currentColor" stroke-width="2.6" stroke-linejoin="round" mask="url(#d)"/></svg>
|
|
234
|
-
`;function $i(e){let t=document.createElement(`button`);return t.className=e.className,t.innerHTML=`${e.content}`,t.addEventListener(`click`,e.onClick),t}function ea(e,t){return $i({type:`button`,className:`control-button toggle-adornments-button`,content:Qi,onClick:()=>{t.querySelectorAll(`.adornment:not(.web-control)`).forEach(e=>e.classList.toggle(`hide`)),t.querySelector(`.toggle-adornments-button`)?.classList.toggle(`active`),
|
|
234
|
+
`;function $i(e){let t=document.createElement(`button`);return t.className=e.className,t.innerHTML=`${e.content}`,t.addEventListener(`click`,e.onClick),t}function ea(e,t){return $i({type:`button`,className:`control-button toggle-adornments-button`,content:Qi,onClick:()=>{t.querySelectorAll(`.adornment:not(.web-control)`).forEach(e=>e.classList.toggle(`hide`)),t.querySelector(`.toggle-adornments-button`)?.classList.toggle(`active`),le(e,`interactive`)}})}var ta=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M5.5 1h1v10h-1z"/><path d="M1 6.5v-1h10v1z"/></svg>
|
|
235
235
|
`,na=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M11 6.144H1v-1h10v1Z"/></svg>
|
|
236
236
|
`;function ra(e){return $i({type:`button`,className:`control-button zoom-in-button`,content:ta,onClick:()=>e.zoomIn()})}function ia(e){return $i({type:`button`,className:`control-button zoom-out-button`,content:na,onClick:()=>e.zoomOut()})}var aa=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.571.875V0h.858v.875a5.143 5.143 0 0 1 4.696 4.696H12v.858h-.875a5.143 5.143 0 0 1-4.696 4.696V12H5.57v-.875A5.143 5.143 0 0 1 .875 6.429H0V5.57h.875A5.143 5.143 0 0 1 5.571.875Zm0 .86a4.286 4.286 0 0 0-3.835 3.836h.835v.858h-.835a4.286 4.286 0 0 0 3.835 3.835V9.43h.858v.835a4.285 4.285 0 0 0 3.835-3.835H9.43v-.86h.835A4.285 4.285 0 0 0 6.43 1.736v.835h-.86v-.835Zm-.177 3.659a.857.857 0 1 1 1.212 1.212.857.857 0 0 1-1.212-1.212Z"/></svg>
|
|
237
237
|
`,oa=`<svg width="34" viewBox="5 5 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#a)" fill="#343A40"><path d="M15.016 22.656a5.797 5.797 0 0 1-1.016-.46c-2.858-1.65-3.846-5.338-2.196-8.196 1.65-2.858 5.338-3.846 8.196-2.196 2.858 1.65 3.846 5.338 2.196 8.196-.2.346-.434.673-.694.962l2.933 2.72A10.1 10.1 0 0 0 25.66 22c2.75-4.763 1.103-10.91-3.66-13.66S11.09 7.237 8.34 12 7.237 22.91 12 25.66a9.61 9.61 0 0 0 1.635.748l1.381-3.752Z"/><path d="m11.01 17.183-3.999.06a10.051 10.051 0 0 0 6.427 9.097l1.484-3.714a6.025 6.025 0 0 1-3.913-5.443Zm13.284 5.183 1-1.732-2.598-1.5-1 1.732 2.598 1.5Zm-3.428-10.062 1.5-2.598-1.732-1-1.5 2.598 1.732 1Zm-9.562 2.562 1-1.732-2.598-1.5-1 1.732 2.598 1.5Z"/><path d="m13.366 25.294 1.5-2.598-1.732-1-1.5 2.598 1.732 1Z"/></g><defs><clipPath id="a"><path fill="#fff" d="m33.393 12.607-12 20.784-20.785-12 12-20.784z"/></clipPath></defs></svg>
|
|
@@ -328,7 +328,7 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
328
328
|
>
|
|
329
329
|
${w.join(``)}
|
|
330
330
|
</svg>
|
|
331
|
-
`,Bl(e)}function zl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=Il*t,o=dl(),s;if(i){let{lng:e,lat:t}=r;s=Fl().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=Ml().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Bl(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Vl(n),{path:l,projection:u}=zl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;ri(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Vl(e){let{clientWidth:t,clientHeight:n}=e.getCanvas(),r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([I(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,I(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([I(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,I(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var Hl=[10,5,3,2,1];function Ul(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function Wl(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of Hl)if(n>=e)return e*t;return Gl(n)*t}function Gl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Kl={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function ql(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`Arial, sans-serif`;return{element:i,ready:n.loadReference(e.font??a,`700`).then(()=>{let o=()=>{i.innerHTML=Jl(t,e,t.getScale(),a,n)};o(),t.on(`move`,o),r!==`interactive`&&t.on(`resize`,o)})}}function Jl(e,t,n,r,i){let{maxWidth:a=100,fontSize:o=8,color:s=`#000000`,unit:c=`metric_and_imperial`}=t,l=i.resolve(t.font??r,`700`),u=e.getCenter(),d=e.project(u),f=
|
|
331
|
+
`,Bl(e)}function zl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=Il*t,o=dl(),s;if(i){let{lng:e,lat:t}=r;s=Fl().scale(a/2).translate([a/2,a/2]).rotate([-e,-t]).clipAngle(90)}else{s=Ml().scale(1).translate([0,0]);let e=s([n[0],n[3]]),t=s([n[2],n[1]]),r=Math.abs(t[0]-e[0]),i=Math.abs(t[1]-e[1]),o=(e[0]+t[0])/2,c=(e[1]+t[1])/2,l=1/Math.max(r/a,i/a);s.scale(l).translate([a/2-l*o,a/2-l*c])}return o.projection(s),{path:o,projection:s}}function Bl(e){let{id:t,map:n,container:r,scale:i}=e,a=r.querySelector(`#frame-${t}`),o=r.querySelector(`#frame-outline-${t}`),s=r.querySelector(`#dot-${t}`);if(!a||!o||!s)return;let c=Vl(n),{path:l,projection:u}=zl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;ri(c,e=>{let t=u(e);d=Math.min(d,e[0]),f=Math.max(f,e[0]),p=Math.min(p,t[0]),m=Math.max(m,t[0]),h=Math.min(h,t[1]),g=Math.max(g,t[1])});let _=10*i;if(m-p<_||g-h<_){a.style.display=`none`,o.style.display=`none`,s.style.display=`block`;let e=n.getCenter(),[t,r]=u([e.lng,e.lat]);s.setAttribute(`cx`,String(t)),s.setAttribute(`cy`,String(r))}else if(f-d<180){a.style.display=`block`,o.style.display=`block`,s.style.display=`none`;let e=l(c);a.setAttribute(`d`,e),o.setAttribute(`d`,e)}else a.style.display=`none`,o.style.display=`none`,s.style.display=`none`}function Vl(e){let{clientWidth:t,clientHeight:n}=e.getCanvas(),r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([I(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,I(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([I(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,I(n,0,t/64)]);r.push([i,a])}let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,0]);return r.push([i,a]),{type:`Feature`,properties:{},geometry:{coordinates:[r],type:`Polygon`}}}var Hl=[10,5,3,2,1];function Ul(e,t=1e-6){let n=Math.floor(e);if(e-=n,e<t)return[n,1];if(1-t<e)return[n+1,1];let r=0,i=1,a=1,o=1;for(;;){let s=r+a,c=i+o;if(c*(e+t)<s)a=s,o=c;else if(s<(e-t)*c)r=s,i=c;else return[n*c+s,c]}}function Wl(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of Hl)if(n>=e)return e*t;return Gl(n)*t}function Gl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Kl={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function ql(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`Arial, sans-serif`;return{element:i,ready:n.loadReference(e.font??a,`700`).then(()=>{let o=()=>{i.innerHTML=Jl(t,e,t.getScale(),a,n)};o(),t.on(`move`,o),r!==`interactive`&&t.on(`resize`,o)})}}function Jl(e,t,n,r,i){let{maxWidth:a=100,fontSize:o=8,color:s=`#000000`,unit:c=`metric_and_imperial`}=t,l=i.resolve(t.font??r,`700`),u=e.getCenter(),d=e.project(u),f=w(u,e.unproject([d.x+a,d.y])),p=Object.fromEntries(Object.entries(Kl).map(([e,t])=>{let n=j(`meter`,e,f),r=Wl(n)||0;return[e,{value:n,ratio:n?r/n:0,humanized:r<1?`${Ul(r).join(`/`)} ${t}`:`${r} ${t}`}]})),m=p.meter.value>1e3?p.kilometer:p.meter,h=p.foot.value>5280?p.mile:p.foot,g={imperial:h,metric:m,nautical:p.nauticalMile},_=c===`metric_and_imperial`?void 0:g[c],v={metric:Math.round(a*m.ratio),imperial:Math.round(a*h.ratio)},y=c===`metric_and_imperial`?Math.max(v.metric,v.imperial):Math.round(a*(_?.ratio??0)),b=o+7,x=o+3,S=c===`metric_and_imperial`?10+x*2:10+x;return c===`metric_and_imperial`?`
|
|
332
332
|
<svg
|
|
333
333
|
class="adornment-svg"
|
|
334
334
|
data-adornment-name="${B(t.name)}"
|
|
@@ -454,54 +454,54 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
454
454
|
${_?.humanized??``}
|
|
455
455
|
</text>
|
|
456
456
|
</svg>
|
|
457
|
-
`}function Yl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.subtitleFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=Xl(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function Xl(e,t,n,r){let{title:i,titleColor:a=`#000000`,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFontSize:u=12,subtitleJustify:d=`center`,background:f=`#ffffff`,showBackground:p=!1}=e,m=r.resolve(e.titleFont??t),h=r.resolve(e.subtitleFont??t),g=0,_=0,v=0,y=0,b=0,x=i.trim().length>0?qe([i],m,o):null,S=c.trim().length>0?qe([c],h,u):null;if(g=Math.max(x?.width??0,S?.width??0),x){let{ascent:e,descent:t}=x;_=e+t,y=8+e}if(S){let{ascent:e,descent:t}=S;v=e+t,b=x?y+x.descent+e:8+e}let C=g+16,w=_+v+16,T=s===`center`?C/2:s===`right`?C-8:8,E=d===`center`?C/2:d===`right`?C-8:8,D=``;if(D+=`<svg class="adornment-svg" data-adornment-name="${B(e.name)}" xmlns="http://www.w3.org/2000/svg" width="${C*n}" height="${w*n}" viewBox="0 0 ${C} ${w}">`,D+=`<rect x="0" y="0" width="${C}" height="${w}" ${H(f)} rx="6" style="visibility:${p?`visible`:`hidden`}" />`,x||S){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=d===`center`?`middle`:d===`right`?`end`:`start`;D+=`<text x="${T}" y="${y}" ${H(a)} ${we(m)} font-size="${o}" text-anchor="${e}">`,x&&(D+=`${B(i)}`),S&&(D+=`<tspan x="${E}" y="${b}" ${H(l)} ${we(h)} font-size="${u}" text-anchor="${t}">`,D+=`${B(c)}`,D+=`</tspan>`),D+=`</text>`}return D+=`</svg>`,D}var Zl={"sky-color":`#6babff`,"sky-horizon-blend":1,"horizon-color":[`interpolate-hcl`,[`linear`],[`zoom`],0,`#edf7fc`,9,`#edf7fc`,10,`#dcf0fa`],"horizon-fog-blend":.5,"fog-color":`#edf7fc`,"fog-ground-blend":.5,"atmosphere-blend":1},Ql={top_left:{x:5,y:5,unit:`px`},top_center:{x:0,y:5,unit:`px`},top_right:{x:5,y:5,unit:`px`},right_center:{x:5,y:0,unit:`px`},bottom_right:{x:5,y:5,unit:`px`},bottom_center:{x:0,y:5,unit:`px`},bottom_left:{x:5,y:5,unit:`px`},left_center:{x:5,y:0,unit:`px`}},$l={top_left:{x:`left`,y:`top`},top_center:{x:`center`,y:`top`},top_right:{x:`right`,y:`top`},right_center:{x:`right`,y:`center`},bottom_right:{x:`right`,y:`bottom`},bottom_center:{x:`center`,y:`bottom`},bottom_left:{x:`left`,y:`bottom`},left_center:{x:`left`,y:`center`}},eu={fill:{props:[`fill-opacity`],defaultValue:1},line:{props:[`line-opacity`],defaultValue:1},circle:{props:[`circle-opacity`,`circle-stroke-opacity`],defaultValue:1},heatmap:{props:[`heatmap-opacity`],defaultValue:1},"fill-extrusion":{props:[`fill-extrusion-opacity`],defaultValue:1},symbol:{props:[`icon-opacity`,`text-opacity`],defaultValue:1},raster:{props:[`raster-opacity`],defaultValue:1},hillshade:{props:[`hillshade-exaggeration`],defaultValue:.5},"color-relief":{props:[`color-relief-opacity`],defaultValue:1},background:{props:[`background-opacity`],defaultValue:1},custom:{props:[],defaultValue:1}},tu=[`beforeWaters`,`beforeBoundaries`,`beforeNames`,`beforeNone`],nu={beforeWaters:`mc-before-waters`,beforeBoundaries:`mc-before-boundaries`,beforeNames:`mc-before-names`,beforeNone:`mc-before-none`},ru={jpg:`static`,png:`static`,svg:`static`,pdf:`static`,tiff:`static`,eps:`static`,eps_log:`static`,mp4:`video`,mov:`video`,mkv:`video`,mxf:`video`,webm:`video`,jpg_sequence:`video`,png_sequence:`video`,web_video:`video`,web:`interactive`,web_download:`interactive`},iu=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],au=new Map,ou=e=>au.delete(e);async function su(e,t,n,r,i,a,o){let s=[...e.adornments??[]],{fonts:c}=r;cu(n),lu(n,t,o);let l=[],u=s.some(e=>![`copyright`,`webControls`].includes(e.type));Pa()&&u&&!s.some(e=>e.type===`webControls`)&&s.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),s.forEach(t=>{if(t.type===`custom`)du(n,de(t,n,o),t.position,t.stacking);else if(t.type===`northArrow`)du(n,Xi(t,n,o),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&o===`interactive`)du(n,Fa(t,n,r,i,u),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=ql(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=Ll(t,n,a,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`heading`){let{element:e,ready:r}=Yl(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`manualLegend`){let{element:e,ready:r}=Yi(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Vi(t,e,n,c,o);du(n,r,t.position,t.stacking),l.push(i)}else if(t.type===`copyright`&&o!==`interactive`){let{element:e,ready:r}=Ra(t,n,c);du(n,e,t.position,t.stacking),l.push(r)}}),n.on(`resize`,()=>lu(n,t,o)),await Promise.all(l)}function cu(e){let t=new Map,n=e.getContainer(),r=window.getComputedStyle(n);n.style.setProperty(`--adornment-text-direction`,r.direction),n.style.setProperty(`--adornment-text-writing-mode`,r.writingMode);for(let e of iu){let r=document.createElement(`div`),i=document.createElement(`div`),a=document.createElement(`div`);r.classList.add(`adornment-container`,e),i.classList.add(`inner`),a.classList.add(`inner`,`vertical`),r.append(i,a),n.appendChild(r),t.set(e,{container:r,horizontal:i,vertical:a})}au.set(e,t)}function lu(e,t,n){let r=au.get(e),i=e.getScale();if(r){e.getContainer().style.setProperty(`--adornment-spacing`,`${5*i}px`);for(let[e,{container:a}]of r)a.style.cssText=uu(e,t[e],i,n)}}function uu(e,t,n,r){let i=$l[e],a=``,o=[],{x:s,y:c,unit:l}=t;return l===`px`&&(s*=n,c*=n),i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r===`interactive`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function du(e,t,n,r){Pa()&&!t.classList.contains(`web-control`)&&t.classList.add(`hide`),r||=[`left_center`,`right_center`].includes(n)?`vertical`:`horizontal`;let i=au.get(e)?.get(n),a=n===`left_center`||n===`right_center`?`vertical`:`horizontal`;i?.[a].hasChildNodes()||(r=a),(i?.[r])?.appendChild(t)}function fu(e){for(let t of tu){let n=nu[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function pu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>mu(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function mu(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:Si(t)}}}function hu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>gu(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function gu(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:E(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?Je(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[_i(t.center,t.radius*n)]},{type:`LineString`,coordinates:vi(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var _u=`Roboto-Regular`;function vu(e,t,n,r,i,a){let o=[],s=new Set,c=new Set,l=[`match`,[`get`,`text-font`]],u=!!t.clustering;for(let n of t.models)(n.visible??!0)&&o.push(bu(e,t,n,1,r,i)),s.add(n.textFont),c.add(n.textLineHeight??1.2);if(Array.from(s).length>0){for(let e of Array.from(s))l.push(e,[`literal`,[e,_u]]);l.push([`literal`,[_u]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:o},cluster:u,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let d=!t.collisionDetection,f=t.labelCollisionDetection===void 0?d:!t.labelCollisionDetection;c.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":d,"icon-ignore-placement":d,"text-allow-overlap":f,"text-ignore-placement":f,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),u&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[_u]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),a===`interactive`&&(e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),c.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),yu(e,t)))}function yu(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function bu(e,t,n,r,i,a){let o=n.svg===void 0?void 0:Xe(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:Ve(o);return{type:`Feature`,id:E(n.id),properties:{id:n.id,"mc-image-key":s,"mc-svg-string":o,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?Ye(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?Je(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?Je(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function xu(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=re(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;Su(i,n,a)}return o}function Su(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(Cu(r,n),e)}}function Cu(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var wu=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
|
|
458
|
-
`,
|
|
459
|
-
`,
|
|
460
|
-
`,
|
|
461
|
-
`;function
|
|
457
|
+
`}function Yl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=`ArialMT`,o=Array.from(new Set([e.titleFont??a,e.subtitleFont??a]));return{element:i,ready:Promise.all(o.map(e=>n.loadReference(e))).then(()=>{let o=()=>{i.innerHTML=Xl(e,a,t.getScale(),n)};o(),r!==`interactive`&&t.on(`resize`,o)})}}function Xl(e,t,n,r){let{title:i,titleColor:a=`#000000`,titleFontSize:o=20,titleJustify:s=`center`,subtitle:c,subtitleColor:l=`#000000`,subtitleFontSize:u=12,subtitleJustify:d=`center`,background:f=`#ffffff`,showBackground:p=!1}=e,m=r.resolve(e.titleFont??t),h=r.resolve(e.subtitleFont??t),g=0,_=0,v=0,y=0,b=0,x=i.trim().length>0?qe([i],m,o):null,S=c.trim().length>0?qe([c],h,u):null;if(g=Math.max(x?.width??0,S?.width??0),x){let{ascent:e,descent:t}=x;_=e+t,y=8+e}if(S){let{ascent:e,descent:t}=S;v=e+t,b=x?y+x.descent+e:8+e}let C=g+16,w=_+v+16,T=s===`center`?C/2:s===`right`?C-8:8,E=d===`center`?C/2:d===`right`?C-8:8,D=``;if(D+=`<svg class="adornment-svg" data-adornment-name="${B(e.name)}" xmlns="http://www.w3.org/2000/svg" width="${C*n}" height="${w*n}" viewBox="0 0 ${C} ${w}">`,D+=`<rect x="0" y="0" width="${C}" height="${w}" ${H(f)} rx="6" style="visibility:${p?`visible`:`hidden`}" />`,x||S){let e=s===`center`?`middle`:s===`right`?`end`:`start`,t=d===`center`?`middle`:d===`right`?`end`:`start`;D+=`<text x="${T}" y="${y}" ${H(a)} ${we(m)} font-size="${o}" text-anchor="${e}">`,x&&(D+=`${B(i)}`),S&&(D+=`<tspan x="${E}" y="${b}" ${H(l)} ${we(h)} font-size="${u}" text-anchor="${t}">`,D+=`${B(c)}`,D+=`</tspan>`),D+=`</text>`}return D+=`</svg>`,D}var Zl={"sky-color":`#6babff`,"sky-horizon-blend":1,"horizon-color":[`interpolate-hcl`,[`linear`],[`zoom`],0,`#edf7fc`,9,`#edf7fc`,10,`#dcf0fa`],"horizon-fog-blend":.5,"fog-color":`#edf7fc`,"fog-ground-blend":.5,"atmosphere-blend":1},Ql={top_left:{x:5,y:5,unit:`px`},top_center:{x:0,y:5,unit:`px`},top_right:{x:5,y:5,unit:`px`},right_center:{x:5,y:0,unit:`px`},bottom_right:{x:5,y:5,unit:`px`},bottom_center:{x:0,y:5,unit:`px`},bottom_left:{x:5,y:5,unit:`px`},left_center:{x:5,y:0,unit:`px`}},$l={top_left:{x:`left`,y:`top`},top_center:{x:`center`,y:`top`},top_right:{x:`right`,y:`top`},right_center:{x:`right`,y:`center`},bottom_right:{x:`right`,y:`bottom`},bottom_center:{x:`center`,y:`bottom`},bottom_left:{x:`left`,y:`bottom`},left_center:{x:`left`,y:`center`}},eu={fill:{props:[`fill-opacity`],defaultValue:1},line:{props:[`line-opacity`],defaultValue:1},circle:{props:[`circle-opacity`,`circle-stroke-opacity`],defaultValue:1},heatmap:{props:[`heatmap-opacity`],defaultValue:1},"fill-extrusion":{props:[`fill-extrusion-opacity`],defaultValue:1},symbol:{props:[`icon-opacity`,`text-opacity`],defaultValue:1},raster:{props:[`raster-opacity`],defaultValue:1},hillshade:{props:[`hillshade-exaggeration`],defaultValue:.5},"color-relief":{props:[`color-relief-opacity`],defaultValue:1},background:{props:[`background-opacity`],defaultValue:1},custom:{props:[],defaultValue:1}},tu=[`beforeWaters`,`beforeBoundaries`,`beforeNames`,`beforeNone`],nu={beforeWaters:`mc-before-waters`,beforeBoundaries:`mc-before-boundaries`,beforeNames:`mc-before-names`,beforeNone:`mc-before-none`},ru={jpg:`static`,png:`static`,svg:`static`,pdf:`static`,tiff:`static`,eps:`static`,eps_log:`static`,mp4:`video`,mov:`video`,mkv:`video`,mxf:`video`,webm:`video`,jpg_sequence:`video`,png_sequence:`video`,web_video:`video`,web:`interactive`,web_download:`interactive`},iu=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],au=new Map,ou=e=>au.delete(e);async function su(e,t,n,r,i,a,o){let s=[...e.adornments??[]],{fonts:c}=r;cu(n),lu(n,t,o);let l=[],u=s.some(e=>![`copyright`,`webControls`].includes(e.type));Pa()&&u&&!s.some(e=>e.type===`webControls`)&&s.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),s.forEach(t=>{if(t.type===`custom`)du(n,de(t,n,o),t.position,t.stacking);else if(t.type===`northArrow`)du(n,Xi(t,n,o),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&o===`interactive`)du(n,Fa(t,n,r,i,u),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=ql(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=Ll(t,n,a,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`heading`){let{element:e,ready:r}=Yl(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`manualLegend`){let{element:e,ready:r}=Yi(t,n,c,o);du(n,e,t.position,t.stacking),l.push(r)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=Vi(t,e,n,c,o);du(n,r,t.position,t.stacking),l.push(i)}else if(t.type===`copyright`&&o!==`interactive`){let{element:e,ready:r}=Ra(t,n,c);du(n,e,t.position,t.stacking),l.push(r)}}),n.on(`resize`,()=>lu(n,t,o)),await Promise.all(l)}function cu(e){let t=new Map,n=e.getContainer(),r=window.getComputedStyle(n);n.style.setProperty(`--adornment-text-direction`,r.direction),n.style.setProperty(`--adornment-text-writing-mode`,r.writingMode);for(let e of iu){let r=document.createElement(`div`),i=document.createElement(`div`),a=document.createElement(`div`);r.classList.add(`adornment-container`,e),i.classList.add(`inner`),a.classList.add(`inner`,`vertical`),r.append(i,a),n.appendChild(r),t.set(e,{container:r,horizontal:i,vertical:a})}au.set(e,t)}function lu(e,t,n){let r=au.get(e),i=e.getScale();if(r){e.getContainer().style.setProperty(`--adornment-spacing`,`${5*i}px`);for(let[e,{container:a}]of r)a.style.cssText=uu(e,t[e],i,n)}}function uu(e,t,n,r){let i=$l[e],a=``,o=[],{x:s,y:c,unit:l}=t;return l===`px`&&(s*=n,c*=n),i.x===`center`?o.push(`translateX(${s}${l})`):a+=`${i.x}: ${s}${l};`,i.y===`center`?o.push(`translateY(${c}${l})`):e===`bottom_right`&&r===`interactive`?a+=`${i.y}: max(${c}${l}, 25px);`:a+=`${i.y}: ${c}${l};`,o.length&&(a+=`transform: ${o.join(` `)};`),a}function du(e,t,n,r){Pa()&&!t.classList.contains(`web-control`)&&t.classList.add(`hide`),r||=[`left_center`,`right_center`].includes(n)?`vertical`:`horizontal`;let i=au.get(e)?.get(n),a=n===`left_center`||n===`right_center`?`vertical`:`horizontal`;i?.[a].hasChildNodes()||(r=a),(i?.[r])?.appendChild(t)}function fu(e){let t=e.registry,n=t?.models;if(!n)return{...e,version:2};let r=/^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?\s*$/,i=e=>typeof e==`string`&&r.test(e)&&isFinite(e)?{t:`n`,v:Number(e),w:e,z:`custom`}:e,a=Object.fromEntries(Object.entries(n).map(([e,t])=>[e,t?.map(e=>({...e,models:e.models.map(e=>({...e,dataBindings:e.dataBindings&&Object.fromEntries(Object.entries(e.dataBindings).map(([e,t])=>[e,i(t)]))}))}))]));return{...e,registry:{...t,models:a},version:2}}var pu=[e=>e,fu],mu=e=>pu.slice(e.version||1).reduce((e,t)=>t(e),e);function hu(e){for(let t of tu){let n=nu[t];e.layers.find(e=>e.id===n)===void 0&&(e.sources.empty===void 0&&(e.sources.empty={type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.layers.push({id:n,type:`fill`,source:`empty`,layout:{visibility:`none`}}))}}function gu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>_u(t,e,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`polygon`,"mc-group-id":t.id},layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function _u(e,t,n,r){let i=t.fillPattern===void 0?void 0:r.getMapLibreImageKey(n[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:T(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:Si(t)}}}function vu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>yu(t,e,1,r,i))}}),e.addLayer({id:t.id,type:`fill`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],paint:{"fill-color":[`get`,`fill-color`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-pattern`,type:`fill`,source:t.id,filter:[`has`,`fill-pattern`],paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},metadata:{"mc-model-type":`circle`,"mc-group-id":t.id}},n),e.addLayer({id:`${t.id}-radius-line`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`get`,`radius-line-enabled`]],paint:{"line-color":[`get`,`radius-line-color`],"line-width":[`get`,`radius-line-width`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n),e.addLayer({id:`${t.id}-outline`,type:`line`,source:t.id,metadata:{"mc-model-type":`circle`,"mc-group-id":t.id},filter:[`==`,[`geometry-type`],`Polygon`],layout:{"line-cap":`round`,"line-join":`round`},paint:{"line-width":[`get`,`outline-width`],"line-color":[`get`,`outline-color`],"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function yu(e,t,n,r,i){let a=t.fillPattern===void 0?void 0:i.getMapLibreImageKey(r[t.fillPattern],2*window.devicePixelRatio);return{type:`Feature`,id:T(t.id),properties:{id:t.id,"fill-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?Je(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":a,"radius-line-enabled":t.radiusLineEnabled??!1,"radius-line-color":e.radiusLineColor||t.radiusLineColor?Je(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[_i(t.center,t.radius*n)]},{type:`LineString`,coordinates:vi(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var bu=`Roboto-Regular`;function xu(e,t,n,r,i,a){let o=[],s=new Set,c=new Set,l=[`match`,[`get`,`text-font`]],u=!!t.clustering;for(let n of t.models)(n.visible??!0)&&o.push(Cu(e,t,n,1,r,i)),s.add(n.textFont),c.add(n.textLineHeight??1.2);if(Array.from(s).length>0){for(let e of Array.from(s))l.push(e,[`literal`,[e,bu]]);l.push([`literal`,[bu]])}e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:o},cluster:u,clusterRadius:t.clusterRadius??50,clusterMaxZoom:t.clusterMaxZoom??14});let d=!t.collisionDetection,f=t.labelCollisionDetection===void 0?d:!t.labelCollisionDetection;c.forEach(r=>{e.addLayer({id:`${t.id}-${r}`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":d,"icon-ignore-placement":d,"text-allow-overlap":f,"text-ignore-placement":f,"text-optional":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":r,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],r],[`!`,[`has`,`point_count`]]]},n)}),u&&(e.addLayer({id:`${t.id}-circle-cluster`,type:`circle`,source:t.id,filter:[`has`,`point_count`],paint:{"circle-color":{property:`point_count`,type:`interval`,stops:t.clusterCircleColor??[]},"circle-radius":{property:`point_count`,type:`interval`,stops:t.clusterCircleRadius??[]}}}),e.addLayer({id:`${t.id}-text-cluster`,type:`symbol`,source:t.id,filter:[`has`,`point_count`],paint:{"text-color":{property:`point_count`,type:`interval`,stops:t.clusterTextColor??[]}},layout:{"text-font":[`literal`,[bu]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),a===`interactive`&&(e.addSource(`${t.id}-selected-element`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),c.forEach(n=>{e.addLayer({id:`${t.id}-selected-element-${n}`,type:`symbol`,source:`${t.id}-selected-element`,metadata:{"mc-model-type":`marker`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"text-allow-overlap":!0,"text-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":[`get`,`icon-anchor`],"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`],"text-field":`{text}`,"text-font":l,"text-max-width":[`get`,`text-max-width`],"text-offset":[`get`,`text-offset`],"text-rotate":[`get`,`text-rotate`],"text-size":[`get`,`text-size`],"text-anchor":[`get`,`text-anchor`],"text-letter-spacing":[`get`,`text-letter-spacing`],"text-line-height":n,"text-justify":[`get`,`text-justify`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1],"text-color":[`get`,`text-color`],"text-halo-color":[`get`,`text-halo-color`],"text-halo-width":[`get`,`text-halo-width`],"text-opacity":[`coalesce`,[`feature-state`,`opacity`],[`global-state`,`opacity-${t.id}`],1]},filter:[`all`,[`==`,[`get`,`text-line-height`],n],[`!`,[`has`,`point_count`]]]})}),Su(e,t)))}function Su(e,t){e.on(`click`,`${t.id}-circle-cluster`,async t=>{let n=e.queryRenderedFeatures(t.point).find(e=>e.properties.cluster);if(!n)return;let r=e.getSource(n.source);if(!r)return;let i=await r.getClusterExpansionZoom(Number(n.id));e.easeTo({center:n.geometry.coordinates,zoom:i})})}function Cu(e,t,n,r,i,a){let o=n.svg===void 0?void 0:Xe(n.dataBindings??{},i[n.svg],t.svg?i[t.svg]:void 0),s=o===void 0?void 0:a.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale()),c=o===void 0?void 0:Ve(o);return{type:`Feature`,id:T(n.id),properties:{id:n.id,"mc-image-key":s,"mc-svg-string":o,"icon-anchor":n.iconAnchor??`center`,"icon-rotate":n.iconRotation??0,"icon-offset":n.iconOffset??[0,0],"icon-size":(n.iconScale??1)*r,"icon-collision-box":c??[0,0,0,0],text:t.text||n.text?Ye(n.dataBindings??{},n.text,t.text):void 0,"text-anchor":n.textAnchor??`center`,"text-font":n.textFont,"text-offset":[(n.textOffset?.[0]??0)/(n.textSize??16),(n.textOffset?.[1]??0)/(n.textSize??16)],"text-rotate":n.textRotation??0,"text-max-width":n.textMaxWidth??10,"text-size":(n.textSize??16)*r,"text-color":t.textColor||n.textColor?Je(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?Je(n.dataBindings??{},n.textHaloColor,t.textHaloColor):`#000000`,"text-halo-width":n.textHaloWidth??0,"text-line-height":n.textLineHeight??1.2,"text-letter-spacing":n.textLetterSpacing??0,"text-justify":n.textJustify??`center`},geometry:{type:`Point`,coordinates:[n.lngLat.lng,n.lngLat.lat]}}}async function wu(e,t,n,r,i,a){let o=await Promise.all(t.map(e=>`${r}/styles/${e}.json?access_token=${i}`).map(e=>fetch(e).then(e=>e.json()))),s=te(o.map(e=>e.sprite).filter(e=>typeof e==`string`));await Promise.all(s.map(e=>n.loadSprite(e).then(e=>n.addImages(e)).catch(()=>{})));for(let t=0;t<e.length;t++){let r=e[t],i=o[t];for(let e of i.layers)e.metadata===void 0&&(e.metadata={}),e.metadata[`mc-original-layer-id`]=e.id,e.id=`${r} | ${e.id}`;Tu(i,n,a)}return o}function Tu(e,t,n){for(let n in e.sources)t.getSource(n)===void 0&&t.addSource(n,e.sources[n]);for(let r of e.layers){t.getLayer(r.id)!==void 0&&t.removeLayer(r.id);let e=r.metadata?.[`mc-add-before`]??`mc-before-none`;t.addLayer(Eu(r,n),e)}}function Eu(e,t){let n=t??{},r=e.metadata?.[`mc-original-layer-id`],i=r===void 0?{}:n[r]??{},a={...e,layout:{...e.layout,...i.layout},paint:{...e.paint,...i.paint},metadata:{...e.metadata,...i.metadata}};return i.minzoom!==void 0&&(a.minzoom=i.minzoom),i.maxzoom!==void 0&&(a.maxzoom=i.maxzoom),`filter`in i&&a.type!==`background`&&(a.filter=i.filter),a}var Du=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m0 4.647 4.282 4.4a.814.814 0 0 0 1.166-1.134L2.27 4.647l3.178-3.266A.814.814 0 1 0 4.282.246z"/></svg>
|
|
458
|
+
`,Ou=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="11" viewBox="0 0 10 11" fill="currentColor"><path d="M.21.71a.714.714 0 0 1 1.011 0l3.78 3.78L8.778.71a.715.715 0 0 1 1.013 1.01L6.01 5.501l3.78 3.778a.715.715 0 0 1-1.01 1.012L5 6.51l-3.779 3.78A.716.716 0 0 1 .21 9.28L3.99 5.5.21 1.721A.714.714 0 0 1 .21.71"/></svg>
|
|
459
|
+
`,ku=`<svg xmlns="http://www.w3.org/2000/svg" width="6" height="10" viewBox="0 0 6 10" fill="currentColor"><path d="m5.678 4.647-4.282 4.4A.814.814 0 1 1 .23 7.914l3.177-3.266L.23 1.381A.814.814 0 1 1 1.396.246z"/></svg>
|
|
460
|
+
`,Au=`<svg width="20" height="20" viewBox="0 0 40 40" stroke="currentColor" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M20 4.167 1.667 35.834h36.667z" stroke-width="2" stroke-linejoin="round"/><path d="M20 29.167v.834m0-14.167.007 8.333" stroke-width="2" stroke-linecap="round"/></svg>
|
|
461
|
+
`;function ju(e,t){let{allowFullscreen:n,loop:r}=e,i=E(e.src,t),a,o=i.match(/(?:youtube\.com\/(?:watch\?.*v=|embed\/|v\/)|youtu\.be\/)([-\w]{11})/)?.[1];a=o?`https://www.youtube.com/embed/${o}`:i;let s=[];if(n||s.push(`fs=0`),r&&o&&s.push(`loop=1&playlist=${o}`),a=Nu(a),a=Mu(a),s.length){let e=a.includes(`?`)?`&`:`?`;a+=`${e}${s.join(`&`)}`}return a}function Mu(e){return e.replace(/([?&])si=[^&]+(&)?/,(e,t,n)=>t===`?`&&!n?``:t===`?`&&n?`?`:n?`&`:``)}function Nu(e){let t=new URL(e),n=t.searchParams.get(`t`);if(!n)return e;let r=0,i=/^((\d+)m)?((\d+)s)?$/;if(/^\d+$/.test(n))r=parseInt(n,10);else{let e=n.match(i);if(e){let t=parseInt(e[2]||`0`,10),n=parseInt(e[4]||`0`,10);r=t*60+n}}return r>0&&(t.searchParams.delete(`t`),t.searchParams.set(`start`,String(r))),t.toString()}function Pu(e,t,n,r){let i;if(t?.type===`video`)i=r?zu(t.src,n):`
|
|
462
462
|
<div class="youtube-container">
|
|
463
463
|
<iframe
|
|
464
|
-
src="${
|
|
464
|
+
src="${ju(t,n)}"
|
|
465
465
|
width="100%" height="300" style="border: none" allowfullscreen>
|
|
466
466
|
</iframe>
|
|
467
467
|
</div>
|
|
468
|
-
`;else if(t?.type===`image`){let e=
|
|
468
|
+
`;else if(t?.type===`image`){let e=E(t.src,n),r=E(t.alt,n);i=`
|
|
469
469
|
<div class="image-container ${t.fill?`fill`:``}">
|
|
470
470
|
<img src="${e}" alt="${r}" />
|
|
471
471
|
</div>
|
|
472
|
-
`}i=i?`<div class="media-content">${i}</div>`:``;let a=e?`<div class="text-content">${
|
|
472
|
+
`}i=i?`<div class="media-content">${i}</div>`:``;let a=e?`<div class="text-content">${Lu(e,n)}</div>`:``;return`
|
|
473
473
|
<div class="popup-scroll-wrapper">
|
|
474
474
|
<div class="mc-popup">
|
|
475
475
|
${i}
|
|
476
476
|
${a}
|
|
477
477
|
</div>
|
|
478
478
|
</div>
|
|
479
|
-
`}var
|
|
479
|
+
`}var Fu=`
|
|
480
480
|
<button class="mc-popup-button close">
|
|
481
|
-
${
|
|
481
|
+
${Ou}
|
|
482
482
|
</button>
|
|
483
|
-
`,
|
|
483
|
+
`,Iu=`
|
|
484
484
|
<div class="cycle-buttons">
|
|
485
485
|
<button class="mc-popup-button prev">
|
|
486
|
-
${
|
|
486
|
+
${Du}
|
|
487
487
|
</button>
|
|
488
488
|
<button class="mc-popup-button next">
|
|
489
|
-
${
|
|
489
|
+
${ku}
|
|
490
490
|
</button>
|
|
491
491
|
</div>
|
|
492
|
-
`;function
|
|
492
|
+
`;function Lu(e,t){return e?(e=e.replace(/placeholder="[^"]+"/,``),e=e.replace(/onerror="[^"]+"/,``),e=e.replace(/youtube\.com\/embed\/\$([^"'<>\\]+)/gi,(e,n)=>{let r=D(t[n]);return r?`youtube.com/embed/${k(r)}?`:``}),e=e.replace(/(\S+?)\s*=\s*"\$([^"]+?)"/g,(e,n,r)=>{let i=D(t[r]);return[`src`,`href`].includes(n)&&!i?``:[`src`,`href`].includes(n)?/^(mailto:|tel:|ftp:|data:|http:\/\/|https:\/\/)/i.test(i)?` ${n}="${i}"`:` ${n}="${Ru(i)}"`:` ${n}="${i}"`}),e=e.replace(/>\$(.+?)</gi,(e,n)=>`>${D(t[n])}<`),e=e.replace(/<span\s+class="mention"\s+data-mention-id="[^"]*">(.*?)<\/span>/gim,(e,t)=>t),e):``}function Ru(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}function zu(e,t){return`
|
|
493
493
|
<div class="youtube-placeholder">
|
|
494
|
-
<img src="${`https://img.youtube.com/vi/${
|
|
494
|
+
<img src="${`https://img.youtube.com/vi/${k(E(e,t))}/hqdefault.jpg`}" />
|
|
495
495
|
<div class="popup-alert">
|
|
496
|
-
<div class="alert-icon">${
|
|
496
|
+
<div class="alert-icon">${Au}</div>
|
|
497
497
|
<div>${ja(`videoAlert`)}</div>
|
|
498
498
|
</div>
|
|
499
499
|
</div>
|
|
500
|
-
`}var
|
|
500
|
+
`}var Bu=[`area`,`circle`,`dot`,`line`,`marker`,`polygon`],Vu=class{models;groups;customGroupIds;constructor(e){this.models={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}},this.groups={area:{},circle:{},dot:{},line:{},marker:{},polygon:{}};for(let t of Bu)for(let n of e.registry?.models?.[t]??[]){this.models[t][n.id]={},this.groups[t][n.id]=n;for(let e of n.models){if(t===`area`){let t=e;t.featureId===void 0&&(t.featureId=Number(t.id),t.id=`${t.vectorUrl}-${t.id}`)}this.models[t][n.id][e.id]=e}}let{beforeWaters:t=[],beforeBoundaries:n=[],beforeNames:r=[],beforeNone:i=[]}=e.registry?.slots??{};this.customGroupIds=[...t,...n,...r,...i].map(e=>e.groupId)}getModel(e){let t=String(e.properties?.id),n=e.layer.metadata,r=n?.[`mc-group-id`],i=n?.[`mc-model-type`],a=n?.[`mc-model-id-prefix`];if(a&&(t=`${a}-${t}`),!(r===void 0||t===void 0||i===void 0))return this.models[i]?.[r]?.[t]}getPopupElements(){let e=[],t=[`circle`,`dot`,`line`,`marker`,`polygon`];for(let n of this.customGroupIds)for(let r of t){let t=this.models[r]?.[n];if(t)for(let[r,i]of Object.entries(t))(i.popup||i.popupMedia)&&e.push({groupId:n,modelId:r,popup:i.popup,popupMedia:i.popupMedia,lngLat:i.lngLat,center:i.center,radius:i.radius,anchorPoints:i.anchorPoints,dataBindings:i.dataBindings})}return e.reverse()}},Hu=class{map;popupElements;currentPopupElement;markerLayerIds;resizeObserver;hiddenCluster;clusterCheckId=0;constructor(e,t){this.map=e,this.popupElements=t,this.markerLayerIds=this.map.getStyle().layers.filter(e=>e.id.startsWith(`custom-marker`)).filter(e=>!e.id.endsWith(`-cluster`)).filter(e=>!e.id.includes(`-selected-element-`)).map(e=>e.id),this.map.on(`zoomend`,()=>{requestAnimationFrame(()=>{this.refreshCurrentCluster()})})}highlight(e,t=!1){if(this.currentPopupElement=e,this.clusterCheckId++,this.resetHiddenCluster(),this.deselect(),!e)return;let{groupId:n,modelId:r}=e,i=this.popupElements.filter(e=>e.groupId===n);i.length>1&&n.startsWith(`custom-marker`)&&this.highlightGroupedMarker(n,r,i),n.startsWith(`custom-marker`)&&this.fadeOtherMarkers(n),this.repositionMap(e,t),t||this.resetCluster(n)}resetCluster(e){this.resetHiddenCluster(),this.setSelectedClusterState(e)}setSelectedClusterState(e,t,n){let r=this.map.getSource(`${e}-selected-element`);r&&r.setData({type:`FeatureCollection`,features:t?[t]:[]});let i=n===void 0?[`has`,`point_count`]:[`all`,[`has`,`point_count`],[`!=`,[`get`,`cluster_id`],n]];this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,i),this.map.setFilter(`${e}-text-cluster`,i))}resetHiddenCluster(){if(!this.hiddenCluster)return;let{source:e}=this.hiddenCluster,t=this.map.getSource(`${e}-selected-element`);t&&t.setData({type:`FeatureCollection`,features:[]}),this.map.getLayer(`${e}-circle-cluster`)&&this.map.getLayer(`${e}-text-cluster`)&&(this.map.setFilter(`${e}-circle-cluster`,[`has`,`point_count`]),this.map.setFilter(`${e}-text-cluster`,[`has`,`point_count`])),this.hiddenCluster=void 0}async checkCluster(e){let{lngLat:t,groupId:n,modelId:r}=e;if(!t){this.resetHiddenCluster();return}let i=++this.clusterCheckId,a=this.map.getSource(n);if(!a||!this.map.getLayer(`${n}-circle-cluster`)){this.resetCluster(n);return}let o=this.map.project(t),s=[[o.x-100,o.y-100],[o.x+100,o.y+100]],c=this.map.queryRenderedFeatures(s,{layers:[`${n}-circle-cluster`]}),l=new Set;for(let e of c){let t=e.properties?.cluster_id;t!==void 0&&l.add(t)}if(this.hiddenCluster&&this.hiddenCluster.source===n&&l.add(this.hiddenCluster.clusterId),!l.size){this.resetCluster(n);return}for(let e of l)try{let t=await a.getClusterLeaves(e,1/0,0);if(i!==this.clusterCheckId)return;let o=t.find(e=>e.properties?.id===r);if(o){this.resetHiddenCluster(),this.hiddenCluster={clusterId:e,source:n},this.setSelectedClusterState(n,o,e);return}}catch{i===this.clusterCheckId&&this.resetCluster(n)}this.resetCluster(n)}refreshCurrentCluster(){let e=this.currentPopupElement;e?.lngLat&&e.groupId.startsWith(`custom-marker`)&&this.checkCluster(e)}deselect(){this.markerLayerIds.forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,1),this.map.setPaintProperty(e,`text-opacity`,1)}),this.resizeObserver?.disconnect()}highlightGroupedMarker(e,t,n){let r=this.markerLayerIds.find(t=>t.startsWith(e));r&&(this.map.setPaintProperty(r,`icon-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),this.map.setPaintProperty(r,`text-opacity`,[`case`,[`boolean`,[`feature-state`,`highlighted`],!1],1,.3]),n.forEach(n=>{this.map.setFeatureState({source:e,id:T(n.modelId)},{highlighted:n.modelId===t})}))}fadeOtherMarkers(e){this.markerLayerIds.filter(t=>!t.startsWith(e)).forEach(e=>{this.map.setPaintProperty(e,`icon-opacity`,.3),this.map.setPaintProperty(e,`text-opacity`,.3)})}repositionMap(e,t){let n,i=20;e.lngLat===void 0?e.anchorPoints===void 0?e.center!==void 0&&e.radius!==void 0&&(n=this.getElementBounds(_i(e.center,e.radius))):n=this.getElementBounds(this.flattenCoordinates(e.anchorPoints)):(n=new r(e.lngLat,e.lngLat),i=40);let a=document.querySelector(`.popup-container`);if(!a||!n)return;this.resizeObserver?.disconnect();let o=0;this.resizeObserver=new ResizeObserver(r=>{let a=r[0].contentRect.height;a>o&&(o=a,this.panToElement(n,i,e,t))}),this.resizeObserver.observe(a)}getElementBounds(e){let t=new r(e[0],e[0]);for(let n of e)t.extend(n);return t}flattenCoordinates(e){return Array.isArray(e[0][0])?e.flat():e}panToElement(e,t,n,r){let i=this.map;if(i.getProjection()?.type===`globe`&&[e.getSouthWest(),e.getNorthEast(),e.getNorthWest(),e.getSouthEast()].some(e=>!z(this.map,e.lng,e.lat))){i.easeTo({center:e.getCenter(),duration:500}),r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)});return}let a=i.projectWithScaleCorrection(e.getSouthWest()),o=i.projectWithScaleCorrection(e.getNorthEast()),s=i.getContainer().clientWidth,c=i.getContainer().clientHeight,l=s>600,u=document.querySelector(`.popup-container`)?.getBoundingClientRect(),d=u?.width??0,f=u?.height??0;l||(f=Math.min(f,c/2));let p=c-a.y>f+t,m=a.x>t+(l&&!p?d:0),h=o.x<s-t,g=o.y>t,_=l?a.y<c-t:p;if(m&&h&&g&&_)r&&this.checkCluster(n);else{if(o.x-a.x+2*t<s&&a.y-o.y+2*t<c){let t=e.getCenter();i.easeTo({center:t,duration:500,offset:l?[0,0]:[0,-30]})}else i.fitBounds(e,{padding:t,maxZoom:i.getZoom(),duration:500,linear:!0});r&&i.once(`moveend`,()=>{this.currentPopupElement&&this.checkCluster(n)})}}},Uu=class{map;youTubePlaceholder;language=`en`;publication;restrictMapMovement;center;popupPosition=`bottomLeft`;mapContainer;highlightManager;registry;promoteIdCache=new Map;popupElements=[];popupContainer;floatingPopup;feature;currentModelId;constructor(e,t){this.map=e,this.youTubePlaceholder=t,this.mapContainer=this.map.getContainer(),this.popupContainer=document.createElement(`div`),this.popupContainer.classList.add(`popup-container`),this.map.on(`mousemove`,e=>this.onMouseMove(e)),this.map.on(`click`,e=>this.onClick(e))}setJobObject(e){this.registry=new Vu(e)}setParams(e,t,n,r){this.popupPosition=e,this.language=t,this.restrictMapMovement=n,this.center=r}setPublication(e){this.publication=e}setpopupElements(){this.popupElements=this.registry.getPopupElements()}setHighlightManager(){this.highlightManager=new Hu(this.map,this.popupElements)}onMouseMove(e){this.feature=this.getInteractiveFeature(e),this.feature?this.map.getCanvas().style.cursor=`pointer`:this.map.getCanvas().style.cursor=``}onClick(e){this.feature=this.getInteractiveFeature(e);let t;this.feature?(t=this.registry.getModel(this.feature)?.id??(this.feature.id===void 0?void 0:String(this.feature.id)),t&&(!this.mapContainer.contains(this.popupContainer)||t!==this.currentModelId)&&(this.currentModelId=t,this.addPopup(e),this.highlightManager?.highlight(this.popupElements.find(e=>e.modelId===t)))):(this.hidePopup(),this.highlightManager?.highlight(void 0),this.currentModelId=void 0)}getInteractiveFeature(e){return this.map.queryRenderedFeatures(e.point).find(e=>{if(Object.keys(e.layer.metadata??{}).some(e=>e.startsWith(`mc-interactivity-template`)))return!0;let t=this.registry.getModel(e);return!!(t?.popup??t?.popupMedia)})}addPopup(e){if(!this.feature)return;this.floatingPopup?.remove();let t=this.getTemplate(this.feature);if(t)if(this.popupPosition===`mapElement`)if(this.feature.geometry.type===`Point`)this.addFloatingPopup(t,this.feature.geometry.coordinates);else{let{lng:n,lat:r}=this.map.unprojectWithScaleCorrection(e.point);this.addFloatingPopup(t,[n,r])}else this.popupContainer.innerHTML=t,this.popupElements.find(e=>e.modelId===this.currentModelId)&&this.addPopupControls(),this.mapContainer.appendChild(this.popupContainer)}addFloatingPopup(e,t){let n=this.restrictMapMovement?this.getAnchor(t):void 0;this.floatingPopup=new s({maxWidth:`none`,closeButton:!1,offset:20,...n!==void 0&&{anchor:n}}).setLngLat(t).setHTML(e).addTo(this.map)}getAnchor(e){let t=this.map.projectWithScaleCorrection(e),n=this.map.getContainer().clientWidth,r=this.map.getContainer().clientHeight,i,a;return i=t.y<r*.33?`top`:t.y>r*.66?`bottom`:`center`,a=t.x<n*.33?`left`:t.x>n*.66?`right`:`center`,i===`center`&&a===`center`?`bottom`:i===`center`?a:a===`center`?i:`${i}-${a}`}hidePopup(){this.popupContainer&&(this.popupContainer.remove(),this.feature=void 0,this.currentModelId=void 0),this.restrictMapMovement&&this.center&&this.map.easeTo({center:this.center})}getTemplate(e){let{layer:t}=e,n,r=this.registry.getModel(e);if(r?.popup||r?.popupMedia)n=Pu(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder);else{let r=[];this.publication&&(r.push(`:${this.publication}-${this.language}`),r.push(`:${this.publication}-:en`)),r.push(`:${this.language}`),r.push(`:en`),r.push(``);for(let i of r){let r=t.metadata?.[`mc-interactivity-template${i}`];if(r){n=this.fillDatalayerTemplate(e,r,i);break}}n&&=`
|
|
501
501
|
<div class="popup-scroll-wrapper">
|
|
502
502
|
<div class="mc-popup data-layer text-content">${n}</div>
|
|
503
503
|
</div>
|
|
504
|
-
`}return n}htmlToElement(e){let t=document.createElement(`template`);return t.innerHTML=e.trim(),t.content.firstElementChild}addPopupControls(){let e=this.htmlToElement(Mu);if(e&&(e.addEventListener(`click`,()=>{this.hidePopup(),this.highlightManager.highlight(void 0)}),this.popupContainer.appendChild(e)),this.popupElements.length>1){let e=this.htmlToElement(Nu);e&&(e.querySelector(`.prev`)?.addEventListener(`click`,()=>this.cyclePopups(!1)),e.querySelector(`.next`)?.addEventListener(`click`,()=>this.cyclePopups()),this.popupContainer.appendChild(e))}}fillDatalayerTemplate(e,t,n){let r=`data-mention-id`,i=new DOMParser().parseFromString(t,`text/html`).body;for(let t of i.querySelectorAll(`[${r}]`)){let i=this.getProperty(e,t.getAttribute(r),n);i!==void 0&&(t.innerText=i)}return i.innerHTML}getProperty(e,t,n){if(!t)return;let r=t.endsWith(`:en`)?[t.replace(`:en`,n),t]:[t];for(let t of r){let n=e.properties[t]??this.getVectorProperty(e,t);if(n!==void 0)return n}}getVectorProperty(e,t){let n=this.promoteIdCache.get(e.source);n===void 0&&(n=this.map.getSource(e.source)?.serialize().promoteId||`id`,this.promoteIdCache.set(e.source,n));try{let r=e.properties[n];return e.layer.metadata.properties[t][r]}catch{return}}cyclePopups(e=!0){let t=this.popupElements?.findIndex(e=>e.modelId===this.currentModelId);if(t!==-1){let n=0;n=e?t===this.popupElements.length-1?0:t+1:t===0?this.popupElements.length-1:t-1;let r=this.popupElements?.[n];this.currentModelId=r.modelId,this.highlightManager.highlight(r,!0);let i=ju(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder),a=this.popupContainer;this.popupContainer.remove(),a.innerHTML=i,this.mapContainer.appendChild(a),this.addPopupControls(),e?this.popupContainer.querySelector(`.mc-popup-button.next`)?.focus():this.popupContainer.querySelector(`.mc-popup-button.prev`)?.focus()}}},Vu=class{line;mercatorLine;distances;totalLength;constructor(e){this.line=e.filter((t,n)=>n===0||e[n][0]!==e[n-1][0]||e[n][1]!==e[n-1][1]),this.mercatorLine=this.line.map(e=>a.fromLngLat(e)),this.distances=Hu(this.mercatorLine),this.totalLength=this.distances[this.distances.length-1]}sample(e){let t=this.mercatorLine,n=this.distances;if(t.length<2)return t[0];e*=this.totalLength;for(let r=1;r<t.length;++r){let i=t[r-1],o=t[r],s=n[r-1],c=n[r];if(c>=e){let t=(e-s)/(c-s);return new a(I(i.x,o.x,t),I(i.y,o.y,t))}}return new a(t[t.length-1].x,t[t.length-1].y)}slice(e,t){if(this.line.length<2)return this.line;let n=this.mercatorLine.filter((n,r)=>this.distances[r]>=e*this.totalLength&&this.distances[r]<=t*this.totalLength);if(e>0){let t=this.sample(e);Uu(t,n[0])||n.unshift(t)}if(t<1){let e=this.sample(t);Uu(e,n[n.length-1])||n.push(e)}return n.map(e=>{let{lng:t,lat:n}=e.toLngLat();return[t,n]})}get length(){return this.totalLength}};function Hu(e){let t=0,n=[t];for(let r=1;r<e.length;++r){let i=e[r-1],a=e[r],o=a.x-i.x,s=a.y-i.y;t+=Math.sqrt(o*o+s*s),n.push(t)}return n}function Uu(e,t){return e.x===t.x&&e.y===t.y}var Wu={solid:[1,0],dotted:[.7,.3],dashed:[3.5,1.5]};function Gu(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(n=>Ku(e,t,n,1,r))}}),Object.entries(Wu).forEach(([r,i])=>{t.models.some(e=>(e.lineStyle??`solid`)===r)&&e.addLayer({id:`${t.id}-${r}`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`==`,[`get`,`line-style`],r]],paint:{"line-width":[`get`,`line-width`],"line-color":[`get`,`line-color`],"line-dasharray":i,"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}),i===`interactive`&&e.addLayer({id:`${t.id}-clickable`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},paint:{"line-width":[`max`,[`get`,`line-width`],15],"line-opacity":0},filter:[`==`,[`geometry-type`],`LineString`]},n),t.models.some(e=>e.svg)&&e.addLayer({id:`${t.id}-icon`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":`center`,"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`==`,[`geometry-type`],`Point`]},n)}function Ku(e,t,n,r,i){let a=new Vu(n.geometry).slice(0,r),o=n.svg!==void 0&&a.length>1?Xe(n.dataBindings??{},n.svg,void 0):void 0,s=o===void 0?void 0:i.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale());return{type:`Feature`,id:E(n.id),properties:{id:n.id,"line-width":n.lineWidth??3,"line-color":t.lineColor||n.lineColor?Je(n.dataBindings??{},n.lineColor,t.lineColor):`#000000`,"line-style":n.lineStyle??`solid`,"mc-image-key":s,"mc-svg-string":o,"icon-rotate":qu(n,a,e),"icon-offset":n.iconOffset,"icon-size":n.iconScale},geometry:{type:`GeometryCollection`,geometries:[{type:`LineString`,coordinates:a},{type:`Point`,coordinates:a[a.length-1]}]}}}function qu(e,t,n){return e.iconRotation?e.iconAlign?Ei(t,n)+e.iconRotation:e.iconRotation:0}function Ju(e,t,n,r,i,a,o){let s=Ni(t),c=new Map,l=new Map;for(let e of t.models){let n=e.featureId,a=t.id,o=[],u=wi(e),d=Ci(a,e),f=l.get(d)??{model:e,featureIds:o,modelIdToFillColor:{},modelIdToFillPattern:{},modelIdToOutlineColor:{},modelIdToOutlineWidth:{}};if(e.visible??!0){f.featureIds.push(n);let a=e.fillPattern===void 0?null:i.getMapLibreImageKey(r[e.fillPattern],2*window.devicePixelRatio);f.modelIdToFillColor[n]=t.fillColor||e.fillColor?Je(e.dataBindings??{},e.fillColor,t.fillColor,s,t.choropleth?.unmatchedColor):`#000000`,f.modelIdToFillPattern[n]=a,f.modelIdToOutlineColor[n]=t.outlineColor||e.outlineColor?Je(e.dataBindings??{},e.outlineColor,t.outlineColor):`#000000`,f.modelIdToOutlineWidth[n]=e.outlineWidth??.5}c.set(u,e),l.set(d,f)}for(let t of c.keys())e.getSource(t)||e.addSource(t,{type:`vector`,url:`${a}${c.get(t).vectorUrl}?access_token=${o}`,promoteId:`id`});for(let r of l.keys()){let{model:i}=l.get(r),{sourceLayerId:a}=i,o=wi(i);e.addLayer({id:r,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-color":`#ffffff`,"fill-outline-color":`#000000`,"fill-antialias":!1,"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n),e.addLayer({id:`${r}-pattern`,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]},layout:{visibility:`visible`}},n),e.addLayer({id:`${r}-outline`,type:`line`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"line-color":`#000000`,"line-width":.5,"line-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n)}l.forEach((t,n)=>{let{featureIds:r,modelIdToFillColor:i,modelIdToFillPattern:a,modelIdToOutlineColor:o,modelIdToOutlineWidth:s}=t;e.setFilter(n,[`in`,`id`,...r]),e.setFilter(`${n}-outline`,[`in`,`id`,...r]),e.setPaintProperty(n,`fill-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,i]]),e.setPaintProperty(`${n}-outline`,`line-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,o]]),e.setPaintProperty(`${n}-outline`,`line-width`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,s]]),e.setFilter(`${n}-pattern`,[`to-boolean`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]]]),e.setPaintProperty(`${n}-pattern`,`fill-pattern`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]])})}function Yu(e,t,n){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Xu(t,e))}}),e.addLayer({id:t.id,type:`circle`,source:t.id,metadata:{"mc-model-type":`dot`,"mc-group-id":t.id},paint:{"circle-color":[`get`,`circle-color`],"circle-radius":[`get`,`circle-radius`],"circle-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function Xu(e,t){return{type:`Feature`,id:t.id,properties:{id:t.id,"circle-radius":t.radius,"circle-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`},geometry:{type:`Point`,coordinates:[t.center.lng,t.center.lat]}}}function Zu(e){let t=new Map,n=new Map,r=new Map;function i(n){return t.get(n)??t.set(n,e.load(n)).get(n)}return async(t,a,o,s,c)=>{let l=a||400,u=o||`normal`,d=be(t),f=JSON.stringify([d,l,u]);n.has(f)||n.set(f,(async()=>{for(let t of d){if(t.generic)continue;let n=e.registered(t.name,l,u);if(n!==void 0)return n;let r=await e.search(t.name,l,u);if(r!==void 0)return{name:r,weight:l,style:u};if(await i(t.name)!==void 0)return{name:t.name,weight:400,style:`normal`}}return{name:`Roboto-Regular`,weight:400,style:`normal`}})());let p=await n.get(f);return c!==void 0&&(c.fauxBold=l>=600&&p.weight<600,c.fauxItalic=u!==`normal`&&p.style===`normal`),r.has(p.name)||r.set(p.name,i(p.name).then(e=>{if(e===void 0)throw Error(`PDF font "${p.name}" is unavailable`);s.registerFont(p.name,e)})),await r.get(p.name),p.name}}function Qu(e,t,n){let r=e.metadata?.colorconversion,i=r?new Map(r.map(e=>[$u(e.rgbin.split(` `).map(e=>Number(e))),e.cmykout.split(` `).map(e=>Number(e)*100)])):null;return{colorCallback:ed.bind(null,i),fontCallback:td(t,n),assumePt:!0}}var $u=([e,t,n])=>`R${e}G${t}B${n}`;function ed(e,t){if(!t)return;let n=t[0],r=$u(n),i=e?.get(r);if(i)return[i,t[1]];let a=(255-n[0])/255,o=(255-n[1])/255,s=(255-n[2])/255,c=Math.min(a,o,s);return[[(a-c)*100,(o-c)*100,(s-c)*100,c*100],t[1]]}function td(e,t){return Zu({registered:(t,n,r)=>{let i=Ce(e.fontMap.values(),t,n,r)??e.getDirectFont(t);return i&&{name:i.name,weight:i.weight===`bold`?700:Number(i.weight)||400,style:i.style}},search:async(e,n,r)=>(await nd(t,{family:e,weight:String(n),style:r}))[0]?.name,load:async e=>{let n=await fetch(`${t.vapiUrl}/fonts/${encodeURIComponent(e)}.ttf?access_token=${t.accessToken}`);if(!(n.status===404||n.status===410)){if(!n.ok)throw Error(`Failed to load PDF font "${e}": ${n.status}`);return n.arrayBuffer()}}})}async function nd(e,t){let n=new URLSearchParams(Object.entries(t).map(([e,t])=>[e,String(t)])),r=`${e.apiUrl??`https://api.mapcreator.io`}/v1/fonts/search?${n}`,i={Accept:`application/json`,Authorization:e.bearerToken.startsWith(`Bearer `)?e.bearerToken:`Bearer ${e.bearerToken}`},a=await fetch(r,{headers:i});if(a.ok){let e=await a.json().catch(()=>({success:!1,error:{type:`SyntaxError`,message:`Malformed JSON response`}}));if(e.success)return Array.isArray(e.data)?e.data:[e.data];throw Error(e.error.message)}else throw Error(a.statusText)}function rd(e,{width:t,height:n}){let r=[];for(let i=0;i<=2;i++)for(let s=0;s<=2;s++){let c=i/2*t,l=s/2*n,{x:u,y:d}=id(a.fromLngLat(e.unprojectWithScaleCorrection(new o(c,l))));r.push(c,l,0,u,d,0)}return{width:t,height:n,GTRasterTypeGeoKey:1,PhotometricInterpretation:2,ProjectedCSTypeGeoKey:3857,ModelTiepoint:r,ModelPixelScale:[]}}function id(e){return{x:I(-20037508.34,20037508.34,e.x),y:I(20037508.34,-20037508.34,e.y)}}var ad=class{mcMap;format;svgCache;backgroundColor;constructor(e,t,n,r){this.mcMap=e,this.format=t,this.svgCache=n,this.backgroundColor=r}async frame(e){let t=this.mcMap.map;t.triggerRepaint(),await t.once(`idle`);let n=t.getCanvas(),{width:r,height:i}=n;if(![`jpg`,`png`,`tiff`].includes(this.format))return e?new Blob:new ImageData(r,i);let a=new OffscreenCanvas(r,i),o=a.getContext(`2d`,{willReadFrequently:!0});return this.format===`jpg`&&(o.fillStyle=this.backgroundColor,o.fillRect(0,0,r,i)),o.drawImage(n,0,0),await je(o,this.svgCache,t.getContainer()),e?a.convertToBlob({type:this.format===`jpg`?`image/jpeg`:`image/png`,quality:1}):o.getImageData(0,0,r,i)}};function od(e){let t=e.length>0?[sd(e[0])]:[],n=0,r=0;for(let i=1;i<e.length;++i){let a=sd(e[i]);n+=cd(e[i-1].center[0],a.center[0]),r+=cd(e[i-1].bearing,a.bearing),a.center[0]+=n*360,a.x+=n,a.bearing+=r*360,t.push(a)}return t}function sd(e){return{...e,center:[e.center[0],e.center[1]]}}function cd(e,t){if(Math.abs(e)+Math.abs(t)>180){if(e>0&&t<0)return 1;if(e<0&&t>0)return-1}return 0}function ld(e){return 2**-e}function ud(e){return e.length>0?e[e.length-1].time:0}function dd(e){return`${String(Math.floor(e%36e5/6e4)).padStart(2,`0`)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`}function fd(e){return z(e,23.976)?24e3/1001:z(e,29.97)?3e4/1001:z(e,59.94)?6e4/1001:e}function pd(e,t){return e===void 0||t===void 0?e===t:e.center.lat===t.center.lat&&e.center.lng===t.center.lng&&e.zoom===t.zoom&&e.bearing===t.bearing&&e.pitch===t.pitch&&e.fov===t.fov&&e.elevation===t.elevation}var md=`
|
|
504
|
+
`}return n}htmlToElement(e){let t=document.createElement(`template`);return t.innerHTML=e.trim(),t.content.firstElementChild}addPopupControls(){let e=this.htmlToElement(Fu);if(e&&(e.addEventListener(`click`,()=>{this.hidePopup(),this.highlightManager.highlight(void 0)}),this.popupContainer.appendChild(e)),this.popupElements.length>1){let e=this.htmlToElement(Iu);e&&(e.querySelector(`.prev`)?.addEventListener(`click`,()=>this.cyclePopups(!1)),e.querySelector(`.next`)?.addEventListener(`click`,()=>this.cyclePopups()),this.popupContainer.appendChild(e))}}fillDatalayerTemplate(e,t,n){let r=`data-mention-id`,i=new DOMParser().parseFromString(t,`text/html`).body;for(let t of i.querySelectorAll(`[${r}]`)){let i=this.getProperty(e,t.getAttribute(r),n);i!==void 0&&(t.innerText=i)}return i.innerHTML}getProperty(e,t,n){if(!t)return;let r=t.endsWith(`:en`)?[t.replace(`:en`,n),t]:[t];for(let t of r){let n=e.properties[t]??this.getVectorProperty(e,t);if(n!==void 0)return n}}getVectorProperty(e,t){let n=this.promoteIdCache.get(e.source);n===void 0&&(n=this.map.getSource(e.source)?.serialize().promoteId||`id`,this.promoteIdCache.set(e.source,n));try{let r=e.properties[n];return e.layer.metadata.properties[t][r]}catch{return}}cyclePopups(e=!0){let t=this.popupElements?.findIndex(e=>e.modelId===this.currentModelId);if(t!==-1){let n=0;n=e?t===this.popupElements.length-1?0:t+1:t===0?this.popupElements.length-1:t-1;let r=this.popupElements?.[n];this.currentModelId=r.modelId,this.highlightManager.highlight(r,!0);let i=Pu(r.popup,r.popupMedia,r.dataBindings??{},this.youTubePlaceholder),a=this.popupContainer;this.popupContainer.remove(),a.innerHTML=i,this.mapContainer.appendChild(a),this.addPopupControls(),e?this.popupContainer.querySelector(`.mc-popup-button.next`)?.focus():this.popupContainer.querySelector(`.mc-popup-button.prev`)?.focus()}}},Wu=class{line;mercatorLine;distances;totalLength;constructor(e){this.line=e.filter((t,n)=>n===0||e[n][0]!==e[n-1][0]||e[n][1]!==e[n-1][1]),this.mercatorLine=this.line.map(e=>a.fromLngLat(e)),this.distances=Gu(this.mercatorLine),this.totalLength=this.distances[this.distances.length-1]}sample(e){let t=this.mercatorLine,n=this.distances;if(t.length<2)return t[0];e*=this.totalLength;for(let r=1;r<t.length;++r){let i=t[r-1],o=t[r],s=n[r-1],c=n[r];if(c>=e){let t=(e-s)/(c-s);return new a(I(i.x,o.x,t),I(i.y,o.y,t))}}return new a(t[t.length-1].x,t[t.length-1].y)}slice(e,t){if(this.line.length<2)return this.line;let n=this.mercatorLine.filter((n,r)=>this.distances[r]>=e*this.totalLength&&this.distances[r]<=t*this.totalLength);if(e>0){let t=this.sample(e);Ku(t,n[0])||n.unshift(t)}if(t<1){let e=this.sample(t);Ku(e,n[n.length-1])||n.push(e)}return n.map(e=>{let{lng:t,lat:n}=e.toLngLat();return[t,n]})}get length(){return this.totalLength}};function Gu(e){let t=0,n=[t];for(let r=1;r<e.length;++r){let i=e[r-1],a=e[r],o=a.x-i.x,s=a.y-i.y;t+=Math.sqrt(o*o+s*s),n.push(t)}return n}function Ku(e,t){return e.x===t.x&&e.y===t.y}var qu={solid:[1,0],dotted:[.7,.3],dashed:[3.5,1.5]};function Ju(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(n=>Yu(e,t,n,1,r))}}),Object.entries(qu).forEach(([r,i])=>{t.models.some(e=>(e.lineStyle??`solid`)===r)&&e.addLayer({id:`${t.id}-${r}`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},filter:[`all`,[`==`,[`geometry-type`],`LineString`],[`==`,[`get`,`line-style`],r]],paint:{"line-width":[`get`,`line-width`],"line-color":[`get`,`line-color`],"line-dasharray":i,"line-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}),i===`interactive`&&e.addLayer({id:`${t.id}-clickable`,type:`line`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},paint:{"line-width":[`max`,[`get`,`line-width`],15],"line-opacity":0},filter:[`==`,[`geometry-type`],`LineString`]},n),t.models.some(e=>e.svg)&&e.addLayer({id:`${t.id}-icon`,type:`symbol`,source:t.id,metadata:{"mc-model-type":`line`,"mc-group-id":t.id},layout:{"icon-allow-overlap":!0,"icon-ignore-placement":!0,"icon-image":[`get`,`mc-image-key`],"icon-anchor":`center`,"icon-size":[`get`,`icon-size`],"icon-rotate":[`get`,`icon-rotate`],"icon-offset":[`get`,`icon-offset`]},paint:{"icon-opacity":[`coalesce`,[`feature-state`,`opacity`],1]},filter:[`==`,[`geometry-type`],`Point`]},n)}function Yu(e,t,n,r,i){let a=new Wu(n.geometry).slice(0,r),o=n.svg!==void 0&&a.length>1?Xe(n.dataBindings??{},n.svg,void 0):void 0,s=o===void 0?void 0:i.getMapLibreImageKey(o,window.devicePixelRatio*(n.iconScale??1)*e.getScale());return{type:`Feature`,id:T(n.id),properties:{id:n.id,"line-width":n.lineWidth??3,"line-color":t.lineColor||n.lineColor?Je(n.dataBindings??{},n.lineColor,t.lineColor):`#000000`,"line-style":n.lineStyle??`solid`,"mc-image-key":s,"mc-svg-string":o,"icon-rotate":Xu(n,a,e),"icon-offset":n.iconOffset,"icon-size":n.iconScale},geometry:{type:`GeometryCollection`,geometries:[{type:`LineString`,coordinates:a},{type:`Point`,coordinates:a[a.length-1]}]}}}function Xu(e,t,n){return e.iconRotation?e.iconAlign?Ei(t,n)+e.iconRotation:e.iconRotation:0}function Zu(e,t,n,r,i,a,o){let s=Ni(t),c=new Map,l=new Map;for(let e of t.models){let n=e.featureId,a=t.id,o=[],u=wi(e),d=Ci(a,e),f=l.get(d)??{model:e,featureIds:o,modelIdToFillColor:{},modelIdToFillPattern:{},modelIdToOutlineColor:{},modelIdToOutlineWidth:{}};if(e.visible??!0){f.featureIds.push(n);let a=e.fillPattern===void 0?null:i.getMapLibreImageKey(r[e.fillPattern],2*window.devicePixelRatio);f.modelIdToFillColor[n]=t.fillColor||e.fillColor?Je(e.dataBindings??{},e.fillColor,t.fillColor,s,t.choropleth?.unmatchedColor):`#000000`,f.modelIdToFillPattern[n]=a,f.modelIdToOutlineColor[n]=t.outlineColor||e.outlineColor?Je(e.dataBindings??{},e.outlineColor,t.outlineColor):`#000000`,f.modelIdToOutlineWidth[n]=e.outlineWidth??.5}c.set(u,e),l.set(d,f)}for(let t of c.keys())e.getSource(t)||e.addSource(t,{type:`vector`,url:`${a}${c.get(t).vectorUrl}?access_token=${o}`,promoteId:`id`});for(let r of l.keys()){let{model:i}=l.get(r),{sourceLayerId:a}=i,o=wi(i);e.addLayer({id:r,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-color":`#ffffff`,"fill-outline-color":`#000000`,"fill-antialias":!1,"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n),e.addLayer({id:`${r}-pattern`,type:`fill`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"fill-pattern":[`get`,`fill-pattern`],"fill-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]},layout:{visibility:`visible`}},n),e.addLayer({id:`${r}-outline`,type:`line`,source:o,"source-layer":a,filter:[`literal`,!1],metadata:{"mc-model-type":`area`,"mc-model-id-prefix":i.vectorUrl,"mc-group-id":t.id},paint:{"line-color":`#000000`,"line-width":.5,"line-opacity":[`coalesce`,[`feature-state`,`opacity-${t.id}`],1]}},n)}l.forEach((t,n)=>{let{featureIds:r,modelIdToFillColor:i,modelIdToFillPattern:a,modelIdToOutlineColor:o,modelIdToOutlineWidth:s}=t;e.setFilter(n,[`in`,`id`,...r]),e.setFilter(`${n}-outline`,[`in`,`id`,...r]),e.setPaintProperty(n,`fill-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,i]]),e.setPaintProperty(`${n}-outline`,`line-color`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,o]]),e.setPaintProperty(`${n}-outline`,`line-width`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,s]]),e.setFilter(`${n}-pattern`,[`to-boolean`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]]]),e.setPaintProperty(`${n}-pattern`,`fill-pattern`,[`get`,[`case`,[`==`,[`typeof`,[`get`,`id`]],`number`],[`to-string`,[`get`,`id`]],[`get`,`id`]],[`literal`,a]])})}function Qu(e,t,n){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>$u(t,e))}}),e.addLayer({id:t.id,type:`circle`,source:t.id,metadata:{"mc-model-type":`dot`,"mc-group-id":t.id},paint:{"circle-color":[`get`,`circle-color`],"circle-radius":[`get`,`circle-radius`],"circle-opacity":[`coalesce`,[`feature-state`,`opacity`],1]}},n)}function $u(e,t){return{type:`Feature`,id:t.id,properties:{id:t.id,"circle-radius":t.radius,"circle-color":e.fillColor||t.fillColor?Je(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`},geometry:{type:`Point`,coordinates:[t.center.lng,t.center.lat]}}}function ed(e){let t=new Map,n=new Map,r=new Map;function i(n){return t.get(n)??t.set(n,e.load(n)).get(n)}return async(t,a,o,s,c)=>{let l=a||400,u=o||`normal`,d=be(t),f=JSON.stringify([d,l,u]);n.has(f)||n.set(f,(async()=>{for(let t of d){if(t.generic)continue;let n=e.registered(t.name,l,u);if(n!==void 0)return n;let r=await e.search(t.name,l,u);if(r!==void 0)return{name:r,weight:l,style:u};if(await i(t.name)!==void 0)return{name:t.name,weight:400,style:`normal`}}return{name:`Roboto-Regular`,weight:400,style:`normal`}})());let p=await n.get(f);return c!==void 0&&(c.fauxBold=l>=600&&p.weight<600,c.fauxItalic=u!==`normal`&&p.style===`normal`),r.has(p.name)||r.set(p.name,i(p.name).then(e=>{if(e===void 0)throw Error(`PDF font "${p.name}" is unavailable`);s.registerFont(p.name,e)})),await r.get(p.name),p.name}}function td(e,t,n){let r=e.metadata?.colorconversion,i=r?new Map(r.map(e=>[nd(e.rgbin.split(` `).map(e=>Number(e))),e.cmykout.split(` `).map(e=>Number(e)*100)])):null;return{colorCallback:rd.bind(null,i),fontCallback:id(t,n),assumePt:!0}}var nd=([e,t,n])=>`R${e}G${t}B${n}`;function rd(e,t){if(!t)return;let n=t[0],r=nd(n),i=e?.get(r);if(i)return[i,t[1]];let a=(255-n[0])/255,o=(255-n[1])/255,s=(255-n[2])/255,c=Math.min(a,o,s);return[[(a-c)*100,(o-c)*100,(s-c)*100,c*100],t[1]]}function id(e,t){return ed({registered:(t,n,r)=>{let i=Ce(e.fontMap.values(),t,n,r)??e.getDirectFont(t);return i&&{name:i.name,weight:i.weight===`bold`?700:Number(i.weight)||400,style:i.style}},search:async(e,n,r)=>(await ad(t,{family:e,weight:String(n),style:r}))[0]?.name,load:async e=>{let n=await fetch(`${t.vapiUrl}/fonts/${encodeURIComponent(e)}.ttf?access_token=${t.accessToken}`);if(!(n.status===404||n.status===410)){if(!n.ok)throw Error(`Failed to load PDF font "${e}": ${n.status}`);return n.arrayBuffer()}}})}async function ad(e,t){let n=new URLSearchParams(Object.entries(t).map(([e,t])=>[e,String(t)])),r=`${e.apiUrl??`https://api.mapcreator.io`}/v1/fonts/search?${n}`,i={Accept:`application/json`,Authorization:e.bearerToken.startsWith(`Bearer `)?e.bearerToken:`Bearer ${e.bearerToken}`},a=await fetch(r,{headers:i});if(a.ok){let e=await a.json().catch(()=>({success:!1,error:{type:`SyntaxError`,message:`Malformed JSON response`}}));if(e.success)return Array.isArray(e.data)?e.data:[e.data];throw Error(e.error.message)}else throw Error(a.statusText)}function od(e,{width:t,height:n}){let r=[];for(let i=0;i<=2;i++)for(let s=0;s<=2;s++){let c=i/2*t,l=s/2*n,{x:u,y:d}=sd(a.fromLngLat(e.unprojectWithScaleCorrection(new o(c,l))));r.push(c,l,0,u,d,0)}return{width:t,height:n,GTRasterTypeGeoKey:1,PhotometricInterpretation:2,ProjectedCSTypeGeoKey:3857,ModelTiepoint:r,ModelPixelScale:[]}}function sd(e){return{x:I(-20037508.34,20037508.34,e.x),y:I(20037508.34,-20037508.34,e.y)}}var cd=class{mcMap;format;svgCache;backgroundColor;constructor(e,t,n,r){this.mcMap=e,this.format=t,this.svgCache=n,this.backgroundColor=r}async frame(e){let t=this.mcMap.map;t.triggerRepaint(),await t.once(`idle`);let n=t.getCanvas(),{width:r,height:i}=n;if(![`jpg`,`png`,`tiff`].includes(this.format))return e?new Blob:new ImageData(r,i);let a=new OffscreenCanvas(r,i),o=a.getContext(`2d`,{willReadFrequently:!0});return this.format===`jpg`&&(o.fillStyle=this.backgroundColor,o.fillRect(0,0,r,i)),o.drawImage(n,0,0),await je(o,this.svgCache,t.getContainer()),e?a.convertToBlob({type:this.format===`jpg`?`image/jpeg`:`image/png`,quality:1}):o.getImageData(0,0,r,i)}};function ld(e){let t=e.length>0?[ud(e[0])]:[],n=0,r=0;for(let i=1;i<e.length;++i){let a=ud(e[i]);n+=dd(e[i-1].center[0],a.center[0]),r+=dd(e[i-1].bearing,a.bearing),a.center[0]+=n*360,a.x+=n,a.bearing+=r*360,t.push(a)}return t}function ud(e){return{...e,center:[e.center[0],e.center[1]]}}function dd(e,t){if(Math.abs(e)+Math.abs(t)>180){if(e>0&&t<0)return 1;if(e<0&&t>0)return-1}return 0}function fd(e){return 2**-e}function pd(e){return e.length>0?e[e.length-1].time:0}function md(e){return`${String(Math.floor(e%36e5/6e4)).padStart(2,`0`)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`}function hd(e){return R(e,23.976)?24e3/1001:R(e,29.97)?3e4/1001:R(e,59.94)?6e4/1001:e}function gd(e,t){return e===void 0||t===void 0?e===t:e.center.lat===t.center.lat&&e.center.lng===t.center.lng&&e.zoom===t.zoom&&e.bearing===t.bearing&&e.pitch===t.pitch&&e.fov===t.fov&&e.elevation===t.elevation}var _d=`
|
|
505
505
|
<div class="preload-bar-vertical"></div>
|
|
506
506
|
<div class="preload-bar-horizontal"></div>
|
|
507
507
|
<div class="preload-badge">
|
|
@@ -515,10 +515,10 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
515
515
|
<div class="preload-label">${ja(`loadingMap`)}</div>
|
|
516
516
|
</div>
|
|
517
517
|
</div>
|
|
518
|
-
`,
|
|
519
|
-
`,
|
|
520
|
-
`,
|
|
521
|
-
`,
|
|
518
|
+
`,vd=class{container;percentage;constructor(e){this.container=document.createElement(`div`),this.container.className=`preload-overlay`,this.container.innerHTML=_d,this.percentage=this.container.querySelector(`.preload-percentage`),e.getContainer().appendChild(this.container)}remove(){this.container.remove()}setProgress(e){this.percentage.innerText=`${Math.floor(e*100)}%`}};function yd(e){return e<0?-1:1}function bd(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(yd(a)+yd(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function xd(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Sd(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function Cd(e){this._context=e}Cd.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Sd(this,this._t0,xd(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Sd(this,xd(this,n=bd(this,e,t)),n);break;default:Sd(this,this._t0,n=bd(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function wd(e){this._context=new Td(e)}(wd.prototype=Object.create(Cd.prototype)).point=function(e,t){Cd.prototype.point.call(this,t,e)};function Td(e){this._context=e}Td.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Ed(e){return new Cd(e)}var Dd=m(((e,t)=>{var n=4,r=.001,i=1e-7,a=10,o=11,s=1/(o-1),c=typeof Float32Array==`function`;function l(e,t){return 1-3*t+3*e}function u(e,t){return 3*t-6*e}function d(e){return 3*e}function f(e,t,n){return((l(t,n)*e+u(t,n))*e+d(t))*e}function p(e,t,n){return 3*l(t,n)*e*e+2*u(t,n)*e+d(t)}function m(e,t,n,r,o){var s,c,l=0;do c=t+(n-t)/2,s=f(c,r,o)-e,s>0?n=c:t=c;while(Math.abs(s)>i&&++l<a);return c}function h(e,t,r,i){for(var a=0;a<n;++a){var o=p(t,r,i);if(o===0)return t;var s=f(t,r,i)-e;t-=s/o}return t}function g(e){return e}t.exports=function(e,t,n,i){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw Error(`bezier x values must be in [0, 1] range`);if(e===t&&n===i)return g;for(var a=c?new Float32Array(o):Array(o),l=0;l<o;++l)a[l]=f(l*s,e,n);function u(t){for(var i=0,c=1,l=o-1;c!==l&&a[c]<=t;++c)i+=s;--c;var u=(t-a[c])/(a[c+1]-a[c]),d=i+u*s,f=p(d,e,n);return f>=r?h(t,d,e,n):f===0?d:m(t,i,i+s,e,n)}return function(e){return e===0?0:e===1?1:f(u(e),t,i)}}})),Od=m(((e,t)=>{t.exports=n;function n(e,t,n,r){var i,a,o,s,c,l,u,d,f,p,m,h,g,_;for(typeof t!=`function`&&(r=n,n=t,t=null),r||={},s=r.tolerance===void 0?1e-7:r.tolerance,_=r.epsilon===void 0?2220446049250313e-31:r.epsilon,c=r.maxIterations===void 0?20:r.maxIterations,m=r.h===void 0?1e-4:r.h,g=r.verbose===void 0?!1:r.verbose,h=1/m,l=0;l++<c;){if(a=e(n),t?o=t(n):(u=e(n+m),d=e(n-m),f=e(n+2*m),p=e(n-2*m),o=(p-f+8*(u-d))*h/12),Math.abs(o)<=_*Math.abs(a))return g&&console.log(`Newton-Raphson: failed to converged due to nearly zero first derivative`),!1;if(i=n-a/o,Math.abs(i-n)<=s*Math.abs(i))return g&&console.log(`Newton-Raphson: converged to x = `+i+` after `+l+` iterations`),i;n=i}return g&&console.log(`Newton-Raphson: Maximum iterations reached (`+c+`)`),!1}})),kd=g(Dd(),1),Ad=g(Od(),1),jd=class{segments;constructor(e){this.segments=[];let t=new Md,n=Ed(t);n.lineStart();for(let t of e)n.point(t.x,t.y);n.lineEnd(),this.segments=t.segments}sample(e){if(e<=0)return this.segments[0].startY;if(e>=this.segments[this.segments.length-1].endX)return this.segments[this.segments.length-1].endY;let t=this.segments.find(t=>e>=t.startX&&e<t.endX),n=ee(t.startX,t.endX,e);return t.startY!==t.endY&&t.easing!==void 0?I(t.startY,t.endY,t.easing(n)):I(t.startY,t.endY,n)}solve(e,t){let n=(0,Ad.default)(t=>this.sample(t)-e,t);return n===!1?t:n}},Md=class{previousPoint={x:0,y:0};segments=[];bezierCurveTo(e,t,n,r,i,a){let o=this.previousPoint.x,s=this.previousPoint.y,c=i===o?void 0:(0,kd.default)((e-o)/(i-o),(t-s)/(a-s),(n-o)/(i-o),(r-s)/(a-s));this.segments.push({startX:o,endX:i,startY:s,endY:a,easing:c}),this.previousPoint={x:i,y:a}}lineTo(e,t){this.segments.push({startX:this.previousPoint.x,endX:e,startY:this.previousPoint.y,endY:t,easing:void 0}),this.previousPoint={x:e,y:t}}moveTo(e,t){this.previousPoint={x:e,y:t}}closePath(){}arc(){}rect(){}arcTo(){}quadraticCurveTo(){}};function Nd(e,t,n,r){return t+n/r*e}function Pd(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function Fd(e,t,n,r){let i=1.70158,a=0,o=n;return e===0?t:(e/=r)===1?t+n:(a||=r*.3,o<Math.abs(n)?(o=n,i=a/4):i=a/(2*Math.PI)*Math.asin(n/o),o*2**(-10*e)*Math.sin((e*r-i)*(2*Math.PI)/a)+n+t)}function Id(e,t,n,r,i){return i===void 0&&(i=1.70158),n*((e=e/r-1)*e*((i+1)*e+i)+1)+t}function Ld(e,t,n,r){return(e/=r)<1/2.75?n*(7.5625*e*e)+t:e<2/2.75?n*(7.5625*(e-=1.5/2.75)*e+.75)+t:e<2.5/2.75?n*(7.5625*(e-=2.25/2.75)*e+.9375)+t:n*(7.5625*(e-=2.625/2.75)*e+.984375)+t}var Rd=class{script;xCurve;yCurve;fovCurve;zoomCurve;pitchCurve;bearingCurve;altitudeCurve;elevationCurve;constructor(e){this.script=ld(e),this.xCurve=this.createMonotonicCurve(this.script,`x`),this.yCurve=this.createMonotonicCurve(this.script,`y`),this.fovCurve=this.createMonotonicCurve(this.script,`fov`),this.zoomCurve=this.createMonotonicCurve(this.script,`zoom`),this.pitchCurve=this.createMonotonicCurve(this.script,`pitch`),this.bearingCurve=this.createMonotonicCurve(this.script,`bearing`),this.altitudeCurve=this.createMonotonicCurve(this.script,`altitude`),this.elevationCurve=this.createMonotonicCurve(this.script,`elevation`)}sample(e){let t=this.zoomCurve.sample(e),n=this.altitudeCurve.solve(fd(t),e),r=this.xCurve.sample(n),i=this.yCurve.sample(n),o=this.elevationCurve.sample(n),s=this.bearingCurve.sample(e),c=this.pitchCurve.sample(e),l=this.fovCurve.sample(e);return{center:new a(r,i).toLngLat(),zoom:t,bearing:s,pitch:c,fov:l,elevation:o}}createMonotonicCurve(e,t){let n=[];for(let r=0;r<e.length;r++){let i=r===0,a=r===e.length-1,o=e[r],s=e[r+1],c=e[r-1],l=this.getKeyframeValue(o,t);if(i&&n.push({x:-1,y:l}),n.push({x:o.time,y:l}),!i&&!a&&c.transition===`instant`&&o.transition===`ease`&&n.push({x:o.time+.1,y:l}),!a)if(o.transition===`linear`){let e=o.time+.1,r=s.time-.1,i=ee(o.time,s.time,e),a=ee(o.time,s.time,r),c=this.getKeyframeValue(s,t);n.push({x:e,y:I(l,c,i)}),n.push({x:r,y:I(l,c,a)})}else o.transition===`instant`&&(n.push({x:o.time+.1,y:l}),n.push({x:s.time-.1,y:l}));a&&n.push({x:o.time+1,y:l})}return new jd(n)}sampleAutoHideOpacity(e){let t=this.script;if(t.length<2)return 1;let n=this.getKeyframeIndexByTime(e);if(n===-1||n===t.length-1)return 1;let r=t[n],i=t[n+1],a=n>0?t[n-1]:void 0,o;if(r.hideLabels===(a?.hideLabels??!1))o=r.hideLabels?0:1;else{let t=e-r.time,n=Math.min(400,i.time-r.time);o=L(Pd(t,r.hideLabels?1:0,r.hideLabels?-1:1,n),0,1)}let s;if(n===t.length-2&&r.hideLabels){let t=Math.max(r.time,i.time-400);s=L(Pd(e-t,0,1,i.time-t),0,1)}else s=0;return Math.max(o,s)}getKeyframeIndexByTime(e){let t=this.script;if(t.length!==0){for(let n=0;n<t.length;n++)if(e<t[n].time)return n-1;return t.length-1}}getKeyframeValue(e,t){return t===`altitude`?fd(e.zoom):e[t]}},zd=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none" stroke="currentColor"><path d="M2.83545 2.66675V6.00008H6.00078M3.38078 5.33341C3.99882 4.26305 4.96943 3.44057 6.1267 3.00656C7.28398 2.57255 8.55607 2.55396 9.72553 2.95397C10.895 3.35397 11.8892 4.14774 12.5383 5.19959C13.1873 6.25144 13.4509 7.49606 13.2839 8.72072C13.117 9.94537 12.5298 11.074 11.6229 11.9137C10.716 12.7535 9.54555 13.2521 8.31169 13.3245C7.07782 13.3968 5.85714 13.0384 4.85828 12.3104C3.85942 11.5824 3.1444 10.5302 2.83545 9.33341" stroke-width="1.25" stroke-linecap="round" stroke-linejoin="round"/></svg>
|
|
519
|
+
`,Bd=`<svg xmlns="http://www.w3.org/2000/svg" width="10" height="12" viewBox="0 0 10 12" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M0.991136 3.66807e-08C1.53861 1.64225e-08 1.98242 0.474849 1.98242 1.06061L1.98242 10.6061C1.98242 11.1918 1.53861 11.6667 0.991137 11.6667C0.443665 11.6667 -0.000148911 11.1918 -0.000148941 10.6061L-0.000149434 1.06061C-0.000149464 0.47485 0.443664 5.69389e-08 0.991136 3.66807e-08Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M8.92082 3.66807e-08C9.4683 1.64225e-08 9.91211 0.474849 9.91211 1.06061L9.91211 10.6061C9.91211 11.1918 9.4683 11.6667 8.92082 11.6667C8.37335 11.6667 7.92954 11.1918 7.92954 10.6061L7.92954 1.06061C7.92954 0.47485 8.37335 5.69389e-08 8.92082 3.66807e-08Z"/></svg>
|
|
520
|
+
`,Vd=`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="currentColor"><path d="M4.88141 14.9874C4.58039 14.9874 4.2919 14.9121 4.01596 14.774C3.38883 14.4475 3 13.8072 3 13.104V2.88322C3 2.18007 3.38883 1.5397 4.01596 1.21323C4.6431 0.886771 5.39567 0.936996 5.97263 1.35135L13.2098 6.46175C13.7115 6.81332 14 7.39091 14 8.00617C14 8.62142 13.699 9.18645 13.2098 9.55059L5.97263 14.6484C5.64652 14.8744 5.27024 15 4.89396 15L4.88141 14.9874ZM4.88141 2.2554C4.78107 2.2554 4.68073 2.28052 4.59293 2.33074C4.3797 2.44375 4.25428 2.64465 4.25428 2.88322V13.104C4.25428 13.3426 4.3797 13.556 4.59293 13.6565C4.80616 13.7695 5.04447 13.7444 5.24515 13.6063L12.4823 8.49586C12.5634 8.4368 12.6294 8.35937 12.6749 8.2699C12.7204 8.18043 12.7442 8.08145 12.7442 7.98105C12.7442 7.88065 12.7204 7.78168 12.6749 7.69221C12.6294 7.60274 12.5634 7.52531 12.4823 7.46625L5.24515 2.36841C5.1378 2.29542 5.01118 2.25608 4.88141 2.2554Z"/></svg>
|
|
521
|
+
`,Hd=e=>`
|
|
522
522
|
<div class="video-slider-container">
|
|
523
523
|
<div class="video-slider-line-wrapper">
|
|
524
524
|
<div class="video-slider-line-left"></div>
|
|
@@ -528,18 +528,18 @@ import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as
|
|
|
528
528
|
</div>
|
|
529
529
|
<div class="video-controls-row">
|
|
530
530
|
<button class="video-button play">
|
|
531
|
-
<span class="video-icon play-icon">${
|
|
532
|
-
<span class="video-icon pause-icon">${
|
|
531
|
+
<span class="video-icon play-icon">${Vd}</span>
|
|
532
|
+
<span class="video-icon pause-icon">${Bd}</span>
|
|
533
533
|
</button>
|
|
534
534
|
<button class="video-button restart">
|
|
535
|
-
${
|
|
535
|
+
${zd}
|
|
536
536
|
</button>
|
|
537
537
|
<div class="video-time">
|
|
538
|
-
<span class="video-playhead">${
|
|
539
|
-
<span class="video-duration">${
|
|
538
|
+
<span class="video-playhead">${md(0)}</span> /
|
|
539
|
+
<span class="video-duration">${md(e)}</span>
|
|
540
540
|
</div>
|
|
541
541
|
<button class="video-button fullscreen">
|
|
542
542
|
${ma}
|
|
543
543
|
</button>
|
|
544
544
|
</div>
|
|
545
|
-
`,Bd=class{callbacks;duration;container;mapContainer;playButton;restartButton;fullscreenButton;slider;sliderFill;playheadLabel;playhead=0;isPlaying=!1;constructor(e,t,n){this.duration=t,this.callbacks=n,this.mapContainer=e.getContainer(),this.container=document.createElement(`div`),this.container.className=`video-controls`,this.container.innerHTML=zd(t),this.playButton=this.container.querySelector(`.video-button.play`),this.restartButton=this.container.querySelector(`.video-button.restart`),this.fullscreenButton=this.container.querySelector(`.video-button.fullscreen`),this.slider=this.container.querySelector(`.video-slider`),this.sliderFill=this.container.querySelector(`.video-slider-line-left`),this.playheadLabel=this.container.querySelector(`.video-playhead`),this.playButton.addEventListener(`click`,()=>this.callbacks.playPause()),this.restartButton.addEventListener(`click`,()=>this.callbacks.restart()),this.fullscreenButton.addEventListener(`click`,()=>ya(this.mapContainer)),this.slider.addEventListener(`input`,()=>{this.duration>0&&this.callbacks.seek(Number(this.slider.value))}),this.mapContainer.appendChild(this.container),this.update()}setPlayhead(e){this.playhead=e,this.update()}setPlaying(e){this.isPlaying=e,this.update()}update(){let{duration:e,playhead:t}=this;this.playButton.classList.toggle(`playing`,this.isPlaying),this.restartButton.classList.toggle(`disabled`,t===0),this.slider.value=String(t),this.sliderFill.style.width=`${te(0,e,t)*100}%`,this.playheadLabel.textContent=dd(t)}},Vd=class extends t{time;constructor(e,t){super(e),this.time=t}},Hd={linear:Ad,easeOutCubic:jd,easeOutBack:Nd,easeOutBounce:Pd,easeOutElastic:Md};function Ud(e){return e.entryType===`fade`||e.exitType===`fade`||e.entryType===`instant`||e.exitType===`instant`}function Wd(e){return e.entryType===`grow`||e.exitType===`grow`}function Gd(e,t,n){let{entry:r,entryDuration:i,exit:a,exitDuration:o}=e,{entryType:s,entryEasing:c,exitType:l,exitEasing:u}=e;return n<r&&(s===t||s===`instant`&&t===`fade`)||n>a&&(l===t||l===`instant`&&t===`fade`)?0:i>0&&n<r+i&&s===t?Hd[c](n-r,0,1,i):o>0&&n>a-o&&l===t?Hd[u](n-(a-o),1,-1,o):1}function Kd(e){return e.target.type===`model`}function qd(e){return e.target.type===`layer`||e.target.type===`overlay`}var Jd=class{mcMap;cameraCurve;registryAnimations;layerAnimations;registry;svgs;svgCache;duration;frameRate;loop;mapstyle;overlays;layerInfo;backgroundColor;playhead;playbackContext;controls;preloadOverlay;constructor(e,t,n,r,i,o,s,c){this.mcMap=e,this.playhead=0,this.playbackContext=void 0;let l=(t.video?.keyframes??[]).map(e=>{let{x:t,y:n}=a.fromLngLat(e.center);return{...e,x:t,y:n,fov:e.fov??36.87,elevation:e.elevation??0}}),u=t.video?.animations??[];this.layerAnimations=u.filter(qd);let d=u.filter(Kd);this.registryAnimations=[...d.filter(e=>e.target.modelId===void 0),...d.filter(e=>e.target.modelId!==void 0)],this.duration=ud(l),this.frameRate=fd(t.export?.frameRate??60),this.cameraCurve=new Fd(l),this.registry=new Ru(t),this.svgs=n,this.svgCache=r,this.mapstyle=i,this.overlays=o,this.layerInfo=s,this.backgroundColor=c;let f=t.export?.format===`web_video`;this.loop=f&&(t.web?.loop??!1),f&&t.web?.controls&&(this.controls=new Bd(e.map,this.duration,{playPause:()=>this.playbackContext===void 0?this.play():this.pause(),restart:()=>{this.seekTo(0),this.play()},seek:e=>{this.pause(),this.seekTo(e)}}));let p=this.mcMap.map;p.setCenterClampedToGround(!1),p.setRasterAlignment(!1),p.style?.stylesheet&&(p.style.stylesheet.transition={duration:0,delay:0}),this.setFrame(0),f&&this.launch(t)}async launch(e){e.web?.preload&&await this.preload(),e.web?.autoplay&&setTimeout(()=>this.play())}play(){this.playbackContext===void 0&&this.duration>0&&(this.playhead>=this.duration&&(this.playhead=0),this.playbackContext={startTime:Date.now(),startPlayhead:this.playhead},this.mcMap.fire(new Vd(`playstart`,this.playhead)),this.controls?.setPlaying(!0),this.playFrame())}pause(){this.playbackContext!==void 0&&(this.playbackContext=void 0,this.mcMap.fire(new Vd(`playend`,this.playhead)),this.controls?.setPlaying(!1))}seekTo(e){this.duration>0&&(e=ne(e,0,this.duration),this.setFrame(e),this.playbackContext!==void 0&&(this.playbackContext={startTime:Date.now(),startPlayhead:e}))}remove(){this.playbackContext=void 0}async*frames(e){let t=this.mcMap.map,n=Math.ceil(this.duration*this.frameRate/1e3);t._fadeDuration=0;let r=t.getCanvas(),{width:i,height:a}=r,o=new OffscreenCanvas(i,a),s=o.getContext(`2d`,{willReadFrequently:!0}),c=t.getContainer(),l=c.getBoundingClientRect();for(let t=0;t<n;t++)yield this.captureFrame(t*1e3/this.frameRate,e,r,o,s,i,a,c,l);t._fadeDuration=300,this.playhead=0}async preload(){this.playbackContext!==void 0&&this.pause();let e=this.mcMap.map,t=Math.ceil(this.duration*this.frameRate/1e3),n=new Map,r=new Set;for(let t of Object.values(e.style.tileManagers)){let e=t.getSource();if(e.type===`vector`||e.type===`raster`||e.type===`raster-dem`||e.type===`geojson`){let r=t.usedForTerrain?t.tileSize:e.tileSize,i=!t.usedForTerrain&&(e.roundZoom??!1);n.set(`${r}/${i}`,{tileSize:r,roundZoom:i})}}this.preloadOverlay=new hd(this.mcMap.map),e._fadeDuration=0;try{let i,a=new Set;for(let o=0;o<t;o++){this.preloadOverlay?.setProgress(o/t);let s=this.cameraCurve.sample(o*1e3/this.frameRate);if(pd(i,s))continue;this.setCamera(s);let c=new Set([...n].flatMap(([t,n])=>e.coveringTiles(n).map(e=>`${t}/${e.key}`)));if(i!==void 0&&[...a].some(e=>!r.has(e)&&!c.has(e))){this.setCamera(i),await e.once(`idle`);for(let e of a)r.add(e)}i=s,a=c}i!==void 0&&(this.setCamera(i),await e.once(`idle`))}finally{this.setFrame(this.playhead),e._fadeDuration=300,this.preloadOverlay?.remove(),this.preloadOverlay=void 0}}async captureFrame(e,t,n,r,i,a,o,s,c){return this.setFrame(e),await this.mcMap.map.once(`idle`),i.fillStyle=this.backgroundColor,i.fillRect(0,0,a,o),i.drawImage(n,0,0),await je(i,this.svgCache,s,c),t?r.convertToBlob():i.getImageData(0,0,a,o)}playFrame(){if(this.playbackContext!==void 0){let e=this.playbackContext.startPlayhead+(Date.now()-this.playbackContext.startTime);e>this.duration?this.loop?(this.seekTo(0),requestAnimationFrame(()=>this.playFrame())):(this.setFrame(this.duration),this.playbackContext=void 0,this.mcMap.fire(new Vd(`playend`,this.playhead)),this.controls?.setPlaying(!1)):(this.setFrame(e),requestAnimationFrame(()=>this.playFrame()))}}setFrame(e){this.playhead=e;let t=this.cameraCurve.sample(e);this.setCamera(t),this.applyAnimations(e),this.mcMap.fire(new Vd(`play`,e)),this.controls?.setPlayhead(e)}setCamera(e){let t=this.mcMap.map,n=t.getCenter(),r=t.getZoom(),i=t.getBearing(),a=t.getPitch(),o=t.getCenterElevation(),s=t.getVerticalFieldOfView();e.center.lat!==n.lat||e.center.lng!==n.lng||e.zoom!==r||e.bearing!==i||e.pitch!==a||e.elevation!==o||e.fov!==s?(t.setVerticalFieldOfView(e.fov),t.jumpTo(e)):t.triggerRepaint()}applyAnimations(e){let t=this.mcMap.map,{svgs:n,svgCache:r,registryAnimations:i}=this;for(let n of i){let{target:r}=n;if(!Ud(n))continue;let{modelType:i,groupId:a,modelId:o}=r,s=Gd(n,`fade`,e);if(i===`area`){let e=this.registry.models.area[a]??{},n=o===void 0?Object.values(e):e[o]?[e[o]]:[];for(let e of n)t.setFeatureState({source:wi(e),sourceLayer:e.sourceLayerId,id:e.featureId},{[`opacity-${a}`]:s})}else if(i===`polygon`||i===`circle`||i===`line`||i===`marker`||i===`dot`){let e=this.registry.models[i][a]??{},n=o===void 0?Object.keys(e):[o];for(let e of n)t.setFeatureState({source:a,id:E(e)},{opacity:s})}}for(let i of Object.values(this.registry.groups.circle)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`circle`,i.id,`scale`),s=a===void 0?1:Gd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(t=>{let a=o.get(t.id);return gu(i,t,a===void 0?s:Gd(a,`grow`,e),n,r)})})}for(let n of Object.values(this.registry.groups.line)){let{groupAnimation:i,modelAnimations:a}=this.getGroupAnimations(`line`,n.id,`scale`),o=i===void 0?1:Gd(i,`grow`,e);(i!==void 0||a.size>0)&&t.getSource(n.id).setData({type:`FeatureCollection`,features:n.models.filter(e=>e.visible??!0).map(i=>{let s=a.get(i.id);return Ku(t,n,i,s===void 0?o:Gd(s,`grow`,e),r)})})}for(let i of Object.values(this.registry.groups.marker)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`marker`,i.id,`scale`),s=a===void 0?1:Gd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(a=>{let c=o.get(a.id);return bu(t,i,a,c===void 0?s:Gd(c,`grow`,e),n,r)})})}let a=this.cameraCurve.sampleAutoHideOpacity(e);for(let t of this.mapstyle.layers){let n=this.getLayerOpacity(t,e,void 0);n===void 0?t.type===`symbol`&&this.setLayerOpacity(t,a):this.setLayerOpacity(t,n)}for(let[t,n]of this.overlays)for(let r of n.layers){let n=this.getLayerOpacity(r,e,t);n===void 0?this.resetLayerOpacity(r):this.setLayerOpacity(r,n)}}getGroupAnimations(e,t,n){let r,i=new Map;for(let a of this.registryAnimations){let{target:o}=a;o.modelType===e&&o.groupId===t&&(n===`opacity`&&Ud(a)||n===`scale`&&Wd(a))&&(o.modelId===void 0?r=a:i.set(o.modelId,a))}return{groupAnimation:r,modelAnimations:i}}getLayerOpacity(e,t,n){let r,i,a=1/0;n!==void 0&&(r=this.layerAnimations.find(e=>e.target.type===`overlay`&&e.target.id===n));for(let t of this.layerAnimations){let{target:n}=t;n.type===`layer`&&n.ids.includes(e.id)&&n.ids.length<a&&(i=t,a=n.ids.length)}let o=this.layerInfo[e.id]?.opacity??eu[e.type].defaultValue;return i===void 0?r===void 0?void 0:Gd(r,`fade`,t)*o:Gd(i,`fade`,t)*o}setLayerOpacity(e,t){let n=this.mcMap.map,r=eu[e.type];for(let i of r.props)n.setPaintProperty(e.id,i,t)}resetLayerOpacity(e){let t=this.mcMap.map,n=eu[e.type],r=this.layerInfo[e.id]?.opacity;for(let i of n.props)t.setPaintProperty(e.id,i,r??e.paint?.[i]??n.defaultValue)}},Yd=class extends n{map;format;mapstyle;svgCache;backgroundColor;vapiUrl;accessToken;image;video;constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(),this.map=e,this.format=t,this.mapstyle=o,this.svgCache=a,this.backgroundColor=l,this.vapiUrl=u,this.accessToken=d,this.image=new ad(this,t,a,l),n===`video`&&(r.video?.keyframes??[]).length>0&&(this.video=new Jd(this,r,i,a,o,s,c,l))}play(){this.video?.play()}pause(){this.video?.pause()}seekTo(e){this.video?.seekTo(e)}async*frames(e=!1){this.video===void 0?yield this.image.frame(e):yield*this.video.frames(e)}preload(){return this.video?.preload()??Promise.resolve()}geoTiffMetadata(e){return rd(this.map,e)}svgExportOptions(e,t,n){return{map:this.map,api:e,signal:n,options:{svgElements:Ae(this.map.getContainer()),fillPatterns:this.svgCache.getFillPatterns(2*window.devicePixelRatio),backgroundColor:this.backgroundColor,detailLevel:this.map.getDetailLevel(),forPDF:this.format===`pdf`,geoRef:this.format===`svg`&&!!t}}}pdfExportOptions(e){return Qu(this.mapstyle,this.svgCache.fonts,{vapiUrl:this.vapiUrl,accessToken:this.accessToken,apiUrl:e.href,bearerToken:e.token})}remove(){let e=this.map.getContainer();ou(this.map),this.video?.remove(),this.map.remove(),e.innerHTML=``,e.style.backgroundColor=``,e.classList.remove(`mc-map`),e.classList.remove(`mc-mode-web`)}};async function Xd(t){let{accessToken:n,env:r=`production`}=t,a=r===`bleeding`?`https://vapi.bleeding.mc-cdn.io`:r===`beta`?`https://vapi.beta.mc-cdn.io`:`https://vapi.mc-cdn.io`,o=r===`bleeding`?`https://cdn.bleeding.mapcreator.io`:r===`beta`?`https://cdn.beta.mapcreator.io`:`https://cdn.mapcreator.io`,s=typeof t.job==`string`?await Zd(t.job,o,n):t.job,c=s.export?.format??`png`,l=ru[c]??`static`;await Qd();let u={container:t.container,attributionControl:!1,style:null,maxBounds:[-1/0,-90,1/0,90],maxPitch:85,maxZoom:22,locale:{"CooperativeGesturesHandler.WindowsHelpText":ja(`windowsHelpText`),"CooperativeGesturesHandler.MacHelpText":ja(`macHelpText`),"CooperativeGesturesHandler.MobileHelpText":ja(`mobileHelpText`)},maxCanvasSize:F(),canvasContextAttributes:{preserveDrawingBuffer:t.preserveDrawingBuffer??!1}};l===`video`&&(u.maxTileCacheSize=1/0,u.maxTileCacheZoomLevels=1/0,u.refreshExpiredTiles=!1);let d=new i(u),f=d.getContainer();f.classList.add(`mc-map`),l===`interactive`&&f.classList.add(`mc-mode-web`);let p=l===`interactive`?new Bu(d,t.youTubePlaceholder??!1):void 0,{map:{language:m,hideBasemap:h,detailLevel:g=0,projection:v=`mercator`,terrain:b=!1,terrainExaggeration:S=1},registry:C={},web:w,positionOffsets:T}=s,{models:E={},slots:D={},svgs:O={}}=C,k=new Ue(d,await ge(r,a,n),a,n);d.resize();let A=l===`video`?s.video?.keyframes[0]:void 0,j=A?.pitch??s.map.pitch??0,M=A?.bearing??s.map.rotation??0,N=A?.zoom??s.map.zoom,P=A?.center===void 0?s.map.center:{lng:A.center[0],lat:A.center[1]};d.setPitch(j),d.setBearing(M);let ee=R(s,f,l,c),I,te;l===`interactive`?(te=N-g+Math.log2(ee),I=1):(te=N-g,I=ee,d.on(`resize`,()=>{let e=R(s,f,l,c);e!==d.getScale()&&d.setScale(e)})),d.setScale(I),d.setZoom(te),d.setCenter(P),d.setDetailLevel(g),d.setMinZoom(g),d.addControl(new e({compact:!1})),await su(s,T??Ql,d,k,{center:P,zoom:te,pitch:j,rotation:M},o,l),p?.setJobObject(s);let ne=l!==`interactive`||(w?.restrictMapMovement??!1);ne&&(d.boxZoom.disable(),d.doubleClickZoom.disable(),d.dragPan.disable(),d.dragRotate.disable(),d.keyboard.disable(),d.scrollZoom.disable(),d.touchPitch.disable(),d.touchZoomRotate.disable(),d.getCanvasContainer().style.cursor=`default`),p?.setParams(w?.popupPosition??`bottomLeft`,x(m,y.TWO),ne,P);let re=s.meta?.mapstyleSet,L=re===void 0?{version:8,sources:{},layers:[]}:await fetch(`${a}/styles/${re}.json?access_token=${n}`).then(e=>e.json());fu(L),d.setStyle(null),d.setStyle(L),await d.once(`style.load`),ue(d,l),d.on(`moveend`,()=>ue(d,l)),d.on(`resize`,()=>ue(d,l)),d.on(`attributionchange`,()=>ue(d,l)),_(m,d);let z=s.map.overlays??[],ie=s.meta?.layers??[];z.length!==ie.length&&(z=[],ie=[]);let ae=await xu(z,ie,d,a,n,L.metadata?.styleOverride),oe=z.reduce((e,t,n)=>e.set(t,ae[n]),new Map);af(d,k,E,D,O,a,n,l),_(m,d),p?.setPublication(L.metadata?.publication),p?.setpopupElements(),p?.setHighlightManager(),d.setProjection({type:v===`globe`?`globe`:`mercator`});let se=$d(d,v);ef(d,se),b&&tf(d,a,n,S);let ce=nf(s.map.layerInfo,L,ae);rf(d,ce,!h);let le=new Yd(d,c,l,s,O,k,L,oe,ce,se,a,n);return await k.settledImages(),le}function Zd(e,t,n){return fetch(`${t}/jobs/${e}.json?access_token=${n}`).then(e=>e.json())}function Qd(){return new Promise(e=>{let t=()=>{window.innerWidth>0&&window.innerHeight>0&&(window.removeEventListener(`resize`,t),e())};window.addEventListener(`resize`,t),t()})}function $d(e,t){let n=e.getStyle().metadata??{},r=n[`mc:background-color`]??`#f8f8f8`,i=n[`mc:background-color-globe`]??`#000000`;return t===`globe`?i:r}function ef(e,t){e.getContainer().style.backgroundColor=t,e.setSky(e.getStyle().sky??Zl),e.setLight({position:[1.15,210,45]})}function tf(e,t,n,r){e.addSource(`mc-dem`,{type:`raster-dem`,tiles:[`${t}/dataset/jaxa_terrainrgb/{z}/{x}/{y}?access_token=${n}`],attribution:`<a href="https://earth.jaxa.jp/en/data/policy" target="_blank">© AW3D30 (JAXA)</a>`,minzoom:0,maxzoom:12}),e.setTerrain({source:`mc-dem`,exaggeration:r})}function nf(e,t,n){let r=e?.reduce((e,t)=>(e[t.id]={visibility:t.visibility,...t.opacity!==void 0&&{opacity:t.opacity}},e),{})??{},i={};for(let e of t.layers)i[e.id]=r[e.id]??{visibility:(e.layout?.visibility??`visible`)===`visible`};for(let e of n)for(let t of e.layers)i[t.id]=r[t.id]??{visibility:!1};return i}function rf(e,t,n){for(let r in t){let i=e.getLayer(r);if(i!==void 0){let a=t[r];if(e.setLayoutProperty(r,`visibility`,a.visibility&&n?`visible`:`none`),a.opacity!==void 0){let t=eu[i.type];for(let n of t.props)e.setPaintProperty(r,n,a.opacity)}}}}function af(e,t,n,r,i,a,o,s){let{beforeNone:c=[],beforeNames:l=[],beforeBoundaries:u=[],beforeWaters:d=[]}=r;c.forEach(r=>{of(e,t,n,r,i,`mc-before-none`,a,o,s)}),l.forEach(r=>{of(e,t,n,r,i,`mc-before-names`,a,o,s)}),u.forEach(r=>{of(e,t,n,r,i,`mc-before-boundaries`,a,o,s)}),d.forEach(r=>{of(e,t,n,r,i,`mc-before-waters`,a,o,s)})}function of(e,t,n,r,i,a,o,s,c){if(r.type===`marker`){let o=n.marker?.find(e=>e.id===r.groupId);o&&vu(e,o,a,i,t,c)}else if(r.type===`polygon`){let o=n.polygon?.find(e=>e.id===r.groupId);o&&pu(e,o,a,i,t)}else if(r.type===`circle`){let o=n.circle?.find(e=>e.id===r.groupId);o&&hu(e,o,a,i,t)}else if(r.type===`line`){let i=n.line?.find(e=>e.id===r.groupId);i&&Gu(e,i,a,t,c)}else if(r.type===`dot`){let t=n.dot?.find(e=>e.id===r.groupId);t&&Yu(e,t,a)}else if(r.type===`area`){let c=n.area?.find(e=>e.id===r.groupId);c&&Ju(e,c,a,i,t,o,s)}}export{Xd as initMap};
|
|
545
|
+
`,Ud=class{callbacks;duration;container;mapContainer;playButton;restartButton;fullscreenButton;slider;sliderFill;playheadLabel;playhead=0;isPlaying=!1;constructor(e,t,n){this.duration=t,this.callbacks=n,this.mapContainer=e.getContainer(),this.container=document.createElement(`div`),this.container.className=`video-controls`,this.container.innerHTML=Hd(t),this.playButton=this.container.querySelector(`.video-button.play`),this.restartButton=this.container.querySelector(`.video-button.restart`),this.fullscreenButton=this.container.querySelector(`.video-button.fullscreen`),this.slider=this.container.querySelector(`.video-slider`),this.sliderFill=this.container.querySelector(`.video-slider-line-left`),this.playheadLabel=this.container.querySelector(`.video-playhead`),this.playButton.addEventListener(`click`,()=>this.callbacks.playPause()),this.restartButton.addEventListener(`click`,()=>this.callbacks.restart()),this.fullscreenButton.addEventListener(`click`,()=>ya(this.mapContainer)),this.slider.addEventListener(`input`,()=>{this.duration>0&&this.callbacks.seek(Number(this.slider.value))}),this.mapContainer.appendChild(this.container),this.update()}setPlayhead(e){this.playhead=e,this.update()}setPlaying(e){this.isPlaying=e,this.update()}update(){let{duration:e,playhead:t}=this;this.playButton.classList.toggle(`playing`,this.isPlaying),this.restartButton.classList.toggle(`disabled`,t===0),this.slider.value=String(t),this.sliderFill.style.width=`${ee(0,e,t)*100}%`,this.playheadLabel.textContent=md(t)}},Wd=class extends t{time;constructor(e,t){super(e),this.time=t}},Gd={linear:Nd,easeOutCubic:Pd,easeOutBack:Id,easeOutBounce:Ld,easeOutElastic:Fd};function Kd(e){return e.entryType===`fade`||e.exitType===`fade`||e.entryType===`instant`||e.exitType===`instant`}function qd(e){return e.entryType===`grow`||e.exitType===`grow`}function Jd(e,t,n){let{entry:r,entryDuration:i,exit:a,exitDuration:o}=e,{entryType:s,entryEasing:c,exitType:l,exitEasing:u}=e;return n<r&&(s===t||s===`instant`&&t===`fade`)||n>a&&(l===t||l===`instant`&&t===`fade`)?0:i>0&&n<r+i&&s===t?Gd[c](n-r,0,1,i):o>0&&n>a-o&&l===t?Gd[u](n-(a-o),1,-1,o):1}function Yd(e){return e.target.type===`model`}function Xd(e){return e.target.type===`layer`||e.target.type===`overlay`}var Zd=class{mcMap;cameraCurve;registryAnimations;layerAnimations;registry;svgs;svgCache;duration;frameRate;loop;mapstyle;overlays;layerInfo;backgroundColor;playhead;playbackContext;controls;preloadOverlay;constructor(e,t,n,r,i,o,s,c){this.mcMap=e,this.playhead=0,this.playbackContext=void 0;let l=(t.video?.keyframes??[]).map(e=>{let{x:t,y:n}=a.fromLngLat(e.center);return{...e,x:t,y:n,fov:e.fov??36.87,elevation:e.elevation??0}}),u=t.video?.animations??[];this.layerAnimations=u.filter(Xd);let d=u.filter(Yd);this.registryAnimations=[...d.filter(e=>e.target.modelId===void 0),...d.filter(e=>e.target.modelId!==void 0)],this.duration=pd(l),this.frameRate=hd(t.export?.frameRate??60),this.cameraCurve=new Rd(l),this.registry=new Vu(t),this.svgs=n,this.svgCache=r,this.mapstyle=i,this.overlays=o,this.layerInfo=s,this.backgroundColor=c;let f=t.export?.format===`web_video`;this.loop=f&&(t.web?.loop??!1),f&&t.web?.controls&&(this.controls=new Ud(e.map,this.duration,{playPause:()=>this.playbackContext===void 0?this.play():this.pause(),restart:()=>{this.seekTo(0),this.play()},seek:e=>{this.pause(),this.seekTo(e)}}));let p=this.mcMap.map;p.setCenterClampedToGround(!1),p.setRasterAlignment(!1),p.style?.stylesheet&&(p.style.stylesheet.transition={duration:0,delay:0}),this.setFrame(0),f&&this.launch(t)}async launch(e){e.web?.preload&&await this.preload(),e.web?.autoplay&&setTimeout(()=>this.play())}play(){this.playbackContext===void 0&&this.duration>0&&(this.playhead>=this.duration&&(this.playhead=0),this.playbackContext={startTime:Date.now(),startPlayhead:this.playhead},this.mcMap.fire(new Wd(`playstart`,this.playhead)),this.controls?.setPlaying(!0),this.playFrame())}pause(){this.playbackContext!==void 0&&(this.playbackContext=void 0,this.mcMap.fire(new Wd(`playend`,this.playhead)),this.controls?.setPlaying(!1))}seekTo(e){this.duration>0&&(e=L(e,0,this.duration),this.setFrame(e),this.playbackContext!==void 0&&(this.playbackContext={startTime:Date.now(),startPlayhead:e}))}remove(){this.playbackContext=void 0}async*frames(e){let t=this.mcMap.map,n=Math.ceil(this.duration*this.frameRate/1e3);t._fadeDuration=0;let r=t.getCanvas(),{width:i,height:a}=r,o=new OffscreenCanvas(i,a),s=o.getContext(`2d`,{willReadFrequently:!0}),c=t.getContainer(),l=c.getBoundingClientRect();for(let t=0;t<n;t++)yield this.captureFrame(t*1e3/this.frameRate,e,r,o,s,i,a,c,l);t._fadeDuration=300,this.playhead=0}async preload(){this.playbackContext!==void 0&&this.pause();let e=this.mcMap.map,t=Math.ceil(this.duration*this.frameRate/1e3),n=new Map,r=new Set;for(let t of Object.values(e.style.tileManagers)){let e=t.getSource();if(e.type===`vector`||e.type===`raster`||e.type===`raster-dem`||e.type===`geojson`){let r=t.usedForTerrain?t.tileSize:e.tileSize,i=!t.usedForTerrain&&(e.roundZoom??!1);n.set(`${r}/${i}`,{tileSize:r,roundZoom:i})}}this.preloadOverlay=new vd(this.mcMap.map),e._fadeDuration=0;try{let i,a=new Set;for(let o=0;o<t;o++){this.preloadOverlay?.setProgress(o/t);let s=this.cameraCurve.sample(o*1e3/this.frameRate);if(gd(i,s))continue;this.setCamera(s);let c=new Set([...n].flatMap(([t,n])=>e.coveringTiles(n).map(e=>`${t}/${e.key}`)));if(i!==void 0&&[...a].some(e=>!r.has(e)&&!c.has(e))){this.setCamera(i),await e.once(`idle`);for(let e of a)r.add(e)}i=s,a=c}i!==void 0&&(this.setCamera(i),await e.once(`idle`))}finally{this.setFrame(this.playhead),e._fadeDuration=300,this.preloadOverlay?.remove(),this.preloadOverlay=void 0}}async captureFrame(e,t,n,r,i,a,o,s,c){return this.setFrame(e),await this.mcMap.map.once(`idle`),i.fillStyle=this.backgroundColor,i.fillRect(0,0,a,o),i.drawImage(n,0,0),await je(i,this.svgCache,s,c),t?r.convertToBlob():i.getImageData(0,0,a,o)}playFrame(){if(this.playbackContext!==void 0){let e=this.playbackContext.startPlayhead+(Date.now()-this.playbackContext.startTime);e>this.duration?this.loop?(this.seekTo(0),requestAnimationFrame(()=>this.playFrame())):(this.setFrame(this.duration),this.playbackContext=void 0,this.mcMap.fire(new Wd(`playend`,this.playhead)),this.controls?.setPlaying(!1)):(this.setFrame(e),requestAnimationFrame(()=>this.playFrame()))}}setFrame(e){this.playhead=e;let t=this.cameraCurve.sample(e);this.setCamera(t),this.applyAnimations(e),this.mcMap.fire(new Wd(`play`,e)),this.controls?.setPlayhead(e)}setCamera(e){let t=this.mcMap.map,n=t.getCenter(),r=t.getZoom(),i=t.getBearing(),a=t.getPitch(),o=t.getCenterElevation(),s=t.getVerticalFieldOfView();e.center.lat!==n.lat||e.center.lng!==n.lng||e.zoom!==r||e.bearing!==i||e.pitch!==a||e.elevation!==o||e.fov!==s?(t.setVerticalFieldOfView(e.fov),t.jumpTo(e)):t.triggerRepaint()}applyAnimations(e){let t=this.mcMap.map,{svgs:n,svgCache:r,registryAnimations:i}=this;for(let n of i){let{target:r}=n;if(!Kd(n))continue;let{modelType:i,groupId:a,modelId:o}=r,s=Jd(n,`fade`,e);if(i===`area`){let e=this.registry.models.area[a]??{},n=o===void 0?Object.values(e):e[o]?[e[o]]:[];for(let e of n)t.setFeatureState({source:wi(e),sourceLayer:e.sourceLayerId,id:e.featureId},{[`opacity-${a}`]:s})}else if(i===`polygon`||i===`circle`||i===`line`||i===`marker`||i===`dot`){let e=this.registry.models[i][a]??{},n=o===void 0?Object.keys(e):[o];for(let e of n)t.setFeatureState({source:a,id:T(e)},{opacity:s})}}for(let i of Object.values(this.registry.groups.circle)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`circle`,i.id,`scale`),s=a===void 0?1:Jd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(t=>{let a=o.get(t.id);return yu(i,t,a===void 0?s:Jd(a,`grow`,e),n,r)})})}for(let n of Object.values(this.registry.groups.line)){let{groupAnimation:i,modelAnimations:a}=this.getGroupAnimations(`line`,n.id,`scale`),o=i===void 0?1:Jd(i,`grow`,e);(i!==void 0||a.size>0)&&t.getSource(n.id).setData({type:`FeatureCollection`,features:n.models.filter(e=>e.visible??!0).map(i=>{let s=a.get(i.id);return Yu(t,n,i,s===void 0?o:Jd(s,`grow`,e),r)})})}for(let i of Object.values(this.registry.groups.marker)){let{groupAnimation:a,modelAnimations:o}=this.getGroupAnimations(`marker`,i.id,`scale`),s=a===void 0?1:Jd(a,`grow`,e);(a!==void 0||o.size>0)&&t.getSource(i.id).setData({type:`FeatureCollection`,features:i.models.filter(e=>e.visible??!0).map(a=>{let c=o.get(a.id);return Cu(t,i,a,c===void 0?s:Jd(c,`grow`,e),n,r)})})}let a=this.cameraCurve.sampleAutoHideOpacity(e);for(let t of this.mapstyle.layers){let n=this.getLayerOpacity(t,e,void 0);n===void 0?t.type===`symbol`&&this.setLayerOpacity(t,a):this.setLayerOpacity(t,n)}for(let[t,n]of this.overlays)for(let r of n.layers){let n=this.getLayerOpacity(r,e,t);n===void 0?this.resetLayerOpacity(r):this.setLayerOpacity(r,n)}}getGroupAnimations(e,t,n){let r,i=new Map;for(let a of this.registryAnimations){let{target:o}=a;o.modelType===e&&o.groupId===t&&(n===`opacity`&&Kd(a)||n===`scale`&&qd(a))&&(o.modelId===void 0?r=a:i.set(o.modelId,a))}return{groupAnimation:r,modelAnimations:i}}getLayerOpacity(e,t,n){let r,i,a=1/0;n!==void 0&&(r=this.layerAnimations.find(e=>e.target.type===`overlay`&&e.target.id===n));for(let t of this.layerAnimations){let{target:n}=t;n.type===`layer`&&n.ids.includes(e.id)&&n.ids.length<a&&(i=t,a=n.ids.length)}let o=this.layerInfo[e.id]?.opacity??eu[e.type].defaultValue;return i===void 0?r===void 0?void 0:Jd(r,`fade`,t)*o:Jd(i,`fade`,t)*o}setLayerOpacity(e,t){let n=this.mcMap.map,r=eu[e.type];for(let i of r.props)n.setPaintProperty(e.id,i,t)}resetLayerOpacity(e){let t=this.mcMap.map,n=eu[e.type],r=this.layerInfo[e.id]?.opacity;for(let i of n.props)t.setPaintProperty(e.id,i,r??e.paint?.[i]??n.defaultValue)}},Qd=class extends n{map;format;mapstyle;svgCache;backgroundColor;vapiUrl;accessToken;image;video;constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(),this.map=e,this.format=t,this.mapstyle=o,this.svgCache=a,this.backgroundColor=l,this.vapiUrl=u,this.accessToken=d,this.image=new cd(this,t,a,l),n===`video`&&(r.video?.keyframes??[]).length>0&&(this.video=new Zd(this,r,i,a,o,s,c,l))}play(){this.video?.play()}pause(){this.video?.pause()}seekTo(e){this.video?.seekTo(e)}async*frames(e=!1){this.video===void 0?yield this.image.frame(e):yield*this.video.frames(e)}preload(){return this.video?.preload()??Promise.resolve()}geoTiffMetadata(e){return od(this.map,e)}svgExportOptions(e,t,n){return{map:this.map,api:e,signal:n,options:{svgElements:Ae(this.map.getContainer()),fillPatterns:this.svgCache.getFillPatterns(2*window.devicePixelRatio),backgroundColor:this.backgroundColor,detailLevel:this.map.getDetailLevel(),forPDF:this.format===`pdf`,geoRef:this.format===`svg`&&!!t}}}pdfExportOptions(e){return td(this.mapstyle,this.svgCache.fonts,{vapiUrl:this.vapiUrl,accessToken:this.accessToken,apiUrl:e.href,bearerToken:e.token})}remove(){let e=this.map.getContainer();ou(this.map),this.video?.remove(),this.map.remove(),e.innerHTML=``,e.style.backgroundColor=``,e.classList.remove(`mc-map`),e.classList.remove(`mc-mode-web`)}};async function $d(t){let{accessToken:n,env:r=`production`}=t,a=r===`bleeding`?`https://vapi.bleeding.mc-cdn.io`:r===`beta`?`https://vapi.beta.mc-cdn.io`:`https://vapi.mc-cdn.io`,o=r===`bleeding`?`https://cdn.bleeding.mapcreator.io`:r===`beta`?`https://cdn.beta.mapcreator.io`:`https://cdn.mapcreator.io`,s=mu(typeof t.job==`string`?await ef(t.job,o,n):t.job),c=s.export?.format??`png`,l=ru[c]??`static`;await tf();let u={container:t.container,attributionControl:!1,style:null,maxBounds:[-1/0,-90,1/0,90],maxPitch:85,maxZoom:22,locale:{"CooperativeGesturesHandler.WindowsHelpText":ja(`windowsHelpText`),"CooperativeGesturesHandler.MacHelpText":ja(`macHelpText`),"CooperativeGesturesHandler.MobileHelpText":ja(`mobileHelpText`)},maxCanvasSize:P(),canvasContextAttributes:{preserveDrawingBuffer:t.preserveDrawingBuffer??!1}};l===`video`&&(u.maxTileCacheSize=1/0,u.maxTileCacheZoomLevels=1/0,u.refreshExpiredTiles=!1);let d=new i(u),f=d.getContainer();f.classList.add(`mc-map`),l===`interactive`&&f.classList.add(`mc-mode-web`);let p=l===`interactive`?new Uu(d,t.youTubePlaceholder??!1):void 0,{map:{language:m,hideBasemap:h,detailLevel:g=0,projection:v=`mercator`,terrain:b=!1,terrainExaggeration:S=1},registry:C={},web:w,positionOffsets:T}=s,{models:E={},slots:D={},svgs:O={}}=C,k=new Ue(d,await ge(r,a,n),a,n);d.resize();let A=l===`video`?s.video?.keyframes[0]:void 0,j=A?.pitch??s.map.pitch??0,M=A?.bearing??s.map.rotation??0,N=A?.zoom??s.map.zoom,F=A?.center===void 0?s.map.center:{lng:A.center[0],lat:A.center[1]};d.setPitch(j),d.setBearing(M);let I=re(s,f,l,c),ee,L;l===`interactive`?(L=N-g+Math.log2(I),ee=1):(L=N-g,ee=I,d.on(`resize`,()=>{let e=re(s,f,l,c);e!==d.getScale()&&d.setScale(e)})),d.setScale(ee),d.setZoom(L),d.setCenter(F),d.setDetailLevel(g),d.setMinZoom(g),d.addControl(new e({compact:!1})),await su(s,T??Ql,d,k,{center:F,zoom:L,pitch:j,rotation:M},o,l),p?.setJobObject(s);let te=l!==`interactive`||(w?.restrictMapMovement??!1);te&&(d.boxZoom.disable(),d.doubleClickZoom.disable(),d.dragPan.disable(),d.dragRotate.disable(),d.keyboard.disable(),d.scrollZoom.disable(),d.touchPitch.disable(),d.touchZoomRotate.disable(),d.getCanvasContainer().style.cursor=`default`),p?.setParams(w?.popupPosition??`bottomLeft`,x(m,y.TWO),te,F);let ne=s.meta?.mapstyleSet,R=ne===void 0?{version:8,sources:{},layers:[]}:await fetch(`${a}/styles/${ne}.json?access_token=${n}`).then(e=>e.json());hu(R),d.setStyle(null),d.setStyle(R),await d.once(`style.load`),le(d,l),d.on(`moveend`,()=>le(d,l)),d.on(`resize`,()=>le(d,l)),d.on(`attributionchange`,()=>le(d,l)),_(m,d);let z=s.map.overlays??[],ie=s.meta?.layers??[];z.length!==ie.length&&(z=[],ie=[]);let ae=await wu(z,ie,d,a,n,R.metadata?.styleOverride),oe=z.reduce((e,t,n)=>e.set(t,ae[n]),new Map);cf(d,k,E,D,O,a,n,l),_(m,d),p?.setPublication(R.metadata?.publication),p?.setpopupElements(),p?.setHighlightManager(),d.setProjection({type:v===`globe`?`globe`:`mercator`});let se=nf(d,v);rf(d,se),b&&af(d,a,n,S);let ce=of(s.map.layerInfo,R,ae);sf(d,ce,!h);let ue=new Qd(d,c,l,s,O,k,R,oe,ce,se,a,n);return await k.settledImages(),ue}function ef(e,t,n){return fetch(`${t}/jobs/${e}.json?access_token=${n}`).then(e=>e.json())}function tf(){return new Promise(e=>{let t=()=>{window.innerWidth>0&&window.innerHeight>0&&(window.removeEventListener(`resize`,t),e())};window.addEventListener(`resize`,t),t()})}function nf(e,t){let n=e.getStyle().metadata??{},r=n[`mc:background-color`]??`#f8f8f8`,i=n[`mc:background-color-globe`]??`#000000`;return t===`globe`?i:r}function rf(e,t){e.getContainer().style.backgroundColor=t,e.setSky(e.getStyle().sky??Zl),e.setLight({position:[1.15,210,45]})}function af(e,t,n,r){e.addSource(`mc-dem`,{type:`raster-dem`,tiles:[`${t}/dataset/jaxa_terrainrgb/{z}/{x}/{y}?access_token=${n}`],attribution:`<a href="https://earth.jaxa.jp/en/data/policy" target="_blank">© AW3D30 (JAXA)</a>`,minzoom:0,maxzoom:12}),e.setTerrain({source:`mc-dem`,exaggeration:r})}function of(e,t,n){let r=e?.reduce((e,t)=>(e[t.id]={visibility:t.visibility,...t.opacity!==void 0&&{opacity:t.opacity}},e),{})??{},i={};for(let e of t.layers)i[e.id]=r[e.id]??{visibility:(e.layout?.visibility??`visible`)===`visible`};for(let e of n)for(let t of e.layers)i[t.id]=r[t.id]??{visibility:!1};return i}function sf(e,t,n){for(let r in t){let i=e.getLayer(r);if(i!==void 0){let a=t[r];if(e.setLayoutProperty(r,`visibility`,a.visibility&&n?`visible`:`none`),a.opacity!==void 0){let t=eu[i.type];for(let n of t.props)e.setPaintProperty(r,n,a.opacity)}}}}function cf(e,t,n,r,i,a,o,s){let{beforeNone:c=[],beforeNames:l=[],beforeBoundaries:u=[],beforeWaters:d=[]}=r;c.forEach(r=>{lf(e,t,n,r,i,`mc-before-none`,a,o,s)}),l.forEach(r=>{lf(e,t,n,r,i,`mc-before-names`,a,o,s)}),u.forEach(r=>{lf(e,t,n,r,i,`mc-before-boundaries`,a,o,s)}),d.forEach(r=>{lf(e,t,n,r,i,`mc-before-waters`,a,o,s)})}function lf(e,t,n,r,i,a,o,s,c){if(r.type===`marker`){let o=n.marker?.find(e=>e.id===r.groupId);o&&xu(e,o,a,i,t,c)}else if(r.type===`polygon`){let o=n.polygon?.find(e=>e.id===r.groupId);o&&gu(e,o,a,i,t)}else if(r.type===`circle`){let o=n.circle?.find(e=>e.id===r.groupId);o&&vu(e,o,a,i,t)}else if(r.type===`line`){let i=n.line?.find(e=>e.id===r.groupId);i&&Ju(e,i,a,t,c)}else if(r.type===`dot`){let t=n.dot?.find(e=>e.id===r.groupId);t&&Qu(e,t,a)}else if(r.type===`area`){let c=n.area?.find(e=>e.id===r.groupId);c&&Zu(e,c,a,i,t,o,s)}}export{$d as initMap};
|