@mapcreator/sdk 2.0.1 → 3.0.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/README.md +26 -6
- package/dist/MCMap.d.ts +2 -14
- package/dist/constants/index.d.ts +2 -2
- package/dist/events.d.ts +12 -0
- package/dist/index.bundler.d.ts +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/mapcreator-sdk-worker.mjs +10 -0
- package/dist/mapcreator-sdk.bundler.mjs +5809 -0
- package/dist/mapcreator-sdk.css +1 -1
- package/dist/mapcreator-sdk.mjs +542 -0
- package/dist/maplibre-gl-shared.mjs +6 -0
- package/dist/maplibre-gl-worker.mjs +6 -0
- package/dist/maplibre-gl.mjs +819 -0
- package/package.json +14 -13
- package/dist/mapcreator-sdk.js +0 -41109
- package/dist/mapcreator-sdk.umd.cjs +0 -1227
- package/dist/report.html +0 -4950
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import{AttributionControl as e,Event as t,Evented as n,LngLatBounds as r,Map as i,MercatorCoordinate as a,Popup as o}from"./maplibre-gl.mjs";var s=Object.create,c=Object.defineProperty,l=Object.getOwnPropertyDescriptor,u=Object.getOwnPropertyNames,d=Object.getPrototypeOf,f=Object.prototype.hasOwnProperty,p=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),m=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=u(t),a=0,o=i.length,s;a<o;a++)s=i[a],!f.call(e,s)&&s!==n&&c(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=l(t,s))||r.enumerable});return e},h=(e,t,n)=>(n=e==null?{}:s(d(e)),m(t||!e||!e.__esModule?c(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 g(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`,_(n.source,e),{validate:!1})}}function _(e,t){return t!==`en`&&t!==`native`&&(t=b(t,v.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 v=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`}),y=Object.freeze([{[v.TWO]:`en`,[v.THREE]:`eng`,[v.ENDONYM]:`English`,[v.LOCALE]:`en_GB`},{[v.TWO]:`da`,[v.THREE]:`dan`,[v.ENDONYM]:`Dansk`,[v.LOCALE]:`da_DK`},{[v.TWO]:`nl`,[v.THREE]:`dut`,[v.ENDONYM]:`Nederlands`,[v.LOCALE]:`nl_NL`},{[v.TWO]:`fi`,[v.THREE]:`fin`,[v.ENDONYM]:`Suomi`,[v.LOCALE]:`fi_FI`},{[v.TWO]:`fr`,[v.THREE]:`fre`,[v.ENDONYM]:`Francais`,[v.LOCALE]:`fr_FR`},{[v.TWO]:`de`,[v.THREE]:`ger`,[v.ENDONYM]:`Deutsch`,[v.LOCALE]:`de_DE`},{[v.TWO]:`it`,[v.THREE]:`ita`,[v.ENDONYM]:`Italiano`,[v.LOCALE]:`it_IT`},{[v.TWO]:`no`,[v.THREE]:`nor`,[v.ENDONYM]:`Norsk`,[v.LOCALE]:`nn_NO`},{[v.TWO]:`pl`,[v.THREE]:`pol`,[v.ENDONYM]:`Polski`,[v.LOCALE]:`pl_PL`},{[v.TWO]:`pt`,[v.THREE]:`por`,[v.ENDONYM]:`Portugues`,[v.LOCALE]:`pt_PT`},{[v.TWO]:`es`,[v.THREE]:`spa`,[v.ENDONYM]:`Espanol`,[v.LOCALE]:`es_ES`},{[v.TWO]:`sv`,[v.THREE]:`swe`,[v.ENDONYM]:`Svenska`,[v.LOCALE]:`sv_SE`},{[v.TWO]:`ja`,[v.THREE]:`jpn`,[v.ENDONYM]:`日本語`,[v.LOCALE]:`ja_JP`},{[v.TWO]:`zh`,[v.THREE]:`chi`,[v.ENDONYM]:`汉语`,[v.LOCALE]:`zh_CN`},{[v.TWO]:`ru`,[v.THREE]:`rus`,[v.ENDONYM]:`Русский`,[v.LOCALE]:`ru_RU`},{[v.TWO]:`uk`,[v.THREE]:`ukr`,[v.ENDONYM]:`Украї́нська`,[v.LOCALE]:`uk_UK`},{[v.TWO]:`lv`,[v.THREE]:`lav`,[v.ENDONYM]:`Latviešu valoda`,[v.LOCALE]:`lv-LV`},{[v.TWO]:`kk`,[v.THREE]:`kaz`,[v.ENDONYM]:`қазақша`,[v.LOCALE]:`kk-KZ`},{[v.TWO]:`ar`,[v.THREE]:`ara`,[v.ENDONYM]:`العربية`,[v.LOCALE]:`ar_SA`},{[v.TWO]:`native`,[v.THREE]:`native`,[v.ENDONYM]:`Native`,[v.LOCALE]:`native`}]);function b(e,t=v.MAPLIBRE_COMPAT){return(y.find(t=>Object.values(t).some(t=>t===e))??y[0])[t]}var x=/^\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?\s*$/;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`&&x.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 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){return 2*Math.round(e/2)}function N(e,t,n){return e+(t-e)*n}function ee(e,t,n){return(n-e)/(t-e)}function te(e,t,n){return Math.max(Math.min(e,n),t)}function ne(e){return Array.from(new Set(e))}function re(e){return e.trim().replace(/^["']|["']$/g,``)}function P(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 ie(e,t,n){if(t.clientWidth>0&&t.clientHeight>0){let r=e.export?.unit??`pixel`,i=e.export?.size??[600,400],a=j(r,`pixel`,i[0]),o=j(r,`pixel`,i[1]);return Math.min(t.clientWidth/(n===`video`?M(a):a),t.clientHeight/(n===`video`?M(o):o))}return 1}function F(e,t,n=1e-4){return Math.abs(e-t)<n}function I(e,t,n){let{lng:r,lat:i}=e.getCenter(),a=e.getPitch()*Math.PI/180,o=e.getBearing()*Math.PI/180,s=L(r,i),c=L(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 L(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,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 e=new RegExp(x.toString().replace(/^\/\^|\$\/$/g,``).replace(/.*/,`^($&)[, ]($&)[, ]($&)[, ]($&)$$`)),i=o.getAttribute(`width`),s=o.getAttribute(`height`),c,l;if(i&&s&&x.test(i)&&x.test(s))c=Number(i)*a,l=Number(s)*a;else{let t=e.exec(o.getAttribute(`viewBox`));c=(t?Number(t[3]):300)*a,l=(t?Number(t[4]):150)*a}let u=()=>{o.setAttribute(`width`,String(c*t.getScale())),o.setAttribute(`height`,String(l*t.getScale()))};u(),n!==`interactive`&&t.on(`resize`,u),o.classList.add(`adornment-svg`),r.appendChild(o)}return r}function ue(e,t,n){e.prototype=t.prototype=n,n.constructor=e}function de(e,t){var n=Object.create(e.prototype);for(var r in t)n[r]=t[r];return n}function fe(){}var pe=.7,me=1/pe,he=`\\s*([+-]?\\d+)\\s*`,ge=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*`,_e=`\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*`,ve=/^#([0-9a-f]{3,8})$/,ye=RegExp(`^rgb\\(${he},${he},${he}\\)$`),be=RegExp(`^rgb\\(${_e},${_e},${_e}\\)$`),xe=RegExp(`^rgba\\(${he},${he},${he},${ge}\\)$`),Se=RegExp(`^rgba\\(${_e},${_e},${_e},${ge}\\)$`),Ce=RegExp(`^hsl\\(${ge},${_e},${_e}\\)$`),we=RegExp(`^hsla\\(${ge},${_e},${_e},${ge}\\)$`),Te={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};ue(fe,Ae,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:Ee,formatHex:Ee,formatHex8:De,formatHsl:Oe,formatRgb:ke,toString:ke});function Ee(){return this.rgb().formatHex()}function De(){return this.rgb().formatHex8()}function Oe(){return He(this).formatHsl()}function ke(){return this.rgb().formatRgb()}function Ae(e){var t,n;return e=(e+``).trim().toLowerCase(),(t=ve.exec(e))?(n=t[1].length,t=parseInt(t[1],16),n===6?je(t):n===3?new R(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?Me(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?Me(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=ye.exec(e))?new R(t[1],t[2],t[3],1):(t=be.exec(e))?new R(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xe.exec(e))?Me(t[1],t[2],t[3],t[4]):(t=Se.exec(e))?Me(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Ce.exec(e))?Ve(t[1],t[2]/100,t[3]/100,1):(t=we.exec(e))?Ve(t[1],t[2]/100,t[3]/100,t[4]):Te.hasOwnProperty(e)?je(Te[e]):e===`transparent`?new R(NaN,NaN,NaN,0):null}function je(e){return new R(e>>16&255,e>>8&255,e&255,1)}function Me(e,t,n,r){return r<=0&&(e=t=n=NaN),new R(e,t,n,r)}function Ne(e){return e instanceof fe||(e=Ae(e)),e?(e=e.rgb(),new R(e.r,e.g,e.b,e.opacity)):new R}function Pe(e,t,n,r){return arguments.length===1?Ne(e):new R(e,t,n,r??1)}function R(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}ue(R,Pe,de(fe,{brighter(e){return e=e==null?me:me**+e,new R(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pe:pe**+e,new R(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new R(ze(this.r),ze(this.g),ze(this.b),Re(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:Fe,formatHex:Fe,formatHex8:Ie,formatRgb:Le,toString:Le}));function Fe(){return`#${Be(this.r)}${Be(this.g)}${Be(this.b)}`}function Ie(){return`#${Be(this.r)}${Be(this.g)}${Be(this.b)}${Be((isNaN(this.opacity)?1:this.opacity)*255)}`}function Le(){let e=Re(this.opacity);return`${e===1?`rgb(`:`rgba(`}${ze(this.r)}, ${ze(this.g)}, ${ze(this.b)}${e===1?`)`:`, ${e})`}`}function Re(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function ze(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Be(e){return e=ze(e),(e<16?`0`:``)+e.toString(16)}function Ve(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new We(e,t,n,r)}function He(e){if(e instanceof We)return new We(e.h,e.s,e.l,e.opacity);if(e instanceof fe||(e=Ae(e)),!e)return new We;if(e instanceof We)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 We(o,s,c,e.opacity)}function Ue(e,t,n,r){return arguments.length===1?He(e):new We(e,t,n,r??1)}function We(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}ue(We,Ue,de(fe,{brighter(e){return e=e==null?me:me**+e,new We(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pe:pe**+e,new We(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 R(qe(e>=240?e-240:e+120,i,r),qe(e,i,r),qe(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new We(Ge(this.h),Ke(this.s),Ke(this.l),Re(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=Re(this.opacity);return`${e===1?`hsl(`:`hsla(`}${Ge(this.h)}, ${Ke(this.s)*100}%, ${Ke(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function Ge(e){return e=(e||0)%360,e<0?e+360:e}function Ke(e){return Math.max(0,Math.min(1,e||0))}function qe(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 Je=Math.PI/180,Ye=180/Math.PI,Xe=18,Ze=.96422,Qe=1,$e=.82521,et=4/29,tt=6/29,nt=3*tt*tt,rt=tt*tt*tt;function it(e){if(e instanceof ot)return new ot(e.l,e.a,e.b,e.opacity);if(e instanceof pt)return mt(e);e instanceof R||(e=Ne(e));var t=ut(e.r),n=ut(e.g),r=ut(e.b),i=st((.2225045*t+.7168786*n+.0606169*r)/Qe),a,o;return t===n&&n===r?a=o=i:(a=st((.4360747*t+.3850649*n+.1430804*r)/Ze),o=st((.0139322*t+.0971045*n+.7141733*r)/$e)),new ot(116*i-16,500*(a-i),200*(i-o),e.opacity)}function at(e,t,n,r){return arguments.length===1?it(e):new ot(e,t,n,r??1)}function ot(e,t,n,r){this.l=+e,this.a=+t,this.b=+n,this.opacity=+r}ue(ot,at,de(fe,{brighter(e){return new ot(this.l+Xe*(e??1),this.a,this.b,this.opacity)},darker(e){return new ot(this.l-Xe*(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=Ze*ct(t),e=Qe*ct(e),n=$e*ct(n),new R(lt(3.1338561*t-1.6168667*e-.4906146*n),lt(-.9787684*t+1.9161415*e+.033454*n),lt(.0719453*t-.2289914*e+1.4052427*n),this.opacity)}}));function st(e){return e>rt?e**(1/3):e/nt+et}function ct(e){return e>tt?e*e*e:nt*(e-et)}function lt(e){return 255*(e<=.0031308?12.92*e:1.055*e**(1/2.4)-.055)}function ut(e){return(e/=255)<=.04045?e/12.92:((e+.055)/1.055)**2.4}function dt(e){if(e instanceof pt)return new pt(e.h,e.c,e.l,e.opacity);if(e instanceof ot||(e=it(e)),e.a===0&&e.b===0)return new pt(NaN,0<e.l&&e.l<100?0:NaN,e.l,e.opacity);var t=Math.atan2(e.b,e.a)*Ye;return new pt(t<0?t+360:t,Math.sqrt(e.a*e.a+e.b*e.b),e.l,e.opacity)}function ft(e,t,n,r){return arguments.length===1?dt(e):new pt(e,t,n,r??1)}function pt(e,t,n,r){this.h=+e,this.c=+t,this.l=+n,this.opacity=+r}function mt(e){if(isNaN(e.h))return new ot(e.l,0,0,e.opacity);var t=e.h*Je;return new ot(e.l,Math.cos(t)*e.c,Math.sin(t)*e.c,e.opacity)}ue(pt,ft,de(fe,{brighter(e){return new pt(this.h,this.c,this.l+Xe*(e??1),this.opacity)},darker(e){return new pt(this.h,this.c,this.l-Xe*(e??1),this.opacity)},rgb(){return mt(this).rgb()}}));var ht=e=>()=>e;function gt(e,t){return function(n){return e+n*t}}function _t(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function vt(e,t){var n=t-e;return n?gt(e,n>180||n<-180?n-360*Math.round(n/360):n):ht(isNaN(e)?t:e)}function yt(e){return(e=+e)==1?bt:function(t,n){return n-t?_t(t,n,e):ht(isNaN(t)?n:t)}}function bt(e,t){var n=t-e;return n?gt(e,n):ht(isNaN(e)?t:e)}var xt=(function e(t){var n=yt(t);function r(e,t){var r=n((e=Pe(e)).r,(t=Pe(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=bt(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 St(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 Ct(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function wt(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]=Nt(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 Tt(e,t){var n=new Date;return e=+e,t=+t,function(r){return n.setTime(e*(1-r)+t*r),n}}function Et(e,t){return e=+e,t=+t,function(n){return e*(1-n)+t*n}}function Dt(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]=Nt(e[i],t[i]):r[i]=t[i];return function(e){for(i in n)r[i]=n[i](e);return r}}var Ot=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,kt=new RegExp(Ot.source,`g`);function At(e){return function(){return e}}function jt(e){return function(t){return e(t)+``}}function Mt(e,t){var n=Ot.lastIndex=kt.lastIndex=0,r,i,a,o=-1,s=[],c=[];for(e+=``,t+=``;(r=Ot.exec(e))&&(i=kt.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:Et(r,i)})),n=kt.lastIndex;return n<t.length&&(a=t.slice(n),s[o]?s[o]+=a:s[++o]=a),s.length<2?c[0]?jt(c[0].x):At(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 Nt(e,t){var n=typeof t,r;return t==null||n===`boolean`?ht(t):(n===`number`?Et:n===`string`?(r=Ae(t))?(t=r,xt):Mt:t instanceof Ae?xt:t instanceof Date?Tt:Ct(t)?St:Array.isArray(t)?wt:typeof t.valueOf!=`function`&&typeof t.toString!=`function`||isNaN(t)?Dt:Et)(e,t)}function Pt(e,t){return e=+e,t=+t,function(n){return Math.round(e*(1-n)+t*n)}}function Ft(e){return function(t,n){var r=e((t=ft(t)).h,(n=ft(n)).h),i=bt(t.c,n.c),a=bt(t.l,n.l),o=bt(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 It=Ft(vt);function Lt(e,t){t===void 0&&(t=e,e=Nt);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 Rt(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e(r/(t-1));return n}function zt(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Bt(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function Vt(e){let t,n,r;e.length===2?(t=e===zt||e===Bt?e:Ht,n=e,r=e):(t=zt,n=(t,n)=>zt(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 Ht(){return 0}function Ut(e){return e===null?NaN:+e}var Wt=Vt(zt),Gt=Wt.right;Wt.left,Vt(Ut).center;function Kt(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 qt=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}},Jt=class extends Map{constructor(e,t=Qt){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(Yt(this,e))}has(e){return super.has(Yt(this,e))}set(e,t){return super.set(Xt(this,e),t)}delete(e){return super.delete(Zt(this,e))}};function Yt({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function Xt({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function Zt({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function Qt(e){return typeof e==`object`&&e?e.valueOf():e}var $t=Math.sqrt(50),en=Math.sqrt(10),tn=Math.sqrt(2);function nn(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=$t?10:a>=en?5:a>=tn?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?nn(e,t,n*2):[s,c,l]}function rn(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?nn(t,e,n):nn(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 an(e,t,n){return t=+t,e=+e,n=+n,nn(e,t,n)[2]}function on(e,t,n){t=+t,e=+e,n=+n;let r=t<e,i=r?an(t,e,n):an(e,t,n);return(r?-1:1)*(i<0?1/-i:i)}function sn(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*cn(e){for(let t of e)yield*t}function ln(e){return Array.from(cn(e))}function un(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 dn(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var fn=Symbol(`implicit`);function pn(){var e=new Jt,t=[],n=[],r=fn;function i(i){let a=e.get(i);if(a===void 0){if(r!==fn)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 Jt;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 pn(t,n).unknown(r)},dn.apply(i,arguments),i}function mn(e){return function(){return e}}function hn(e){return+e}var gn=[0,1];function _n(e){return e}function vn(e,t){return(t-=e=+e)?function(n){return(n-e)/t}:mn(isNaN(t)?NaN:.5)}function yn(e,t){var n;return e>t&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function bn(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i<r?(r=vn(i,r),a=n(o,a)):(r=vn(r,i),a=n(a,o)),function(e){return a(r(e))}}function xn(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]=vn(e[o],e[o+1]),a[o]=n(t[o],t[o+1]);return function(t){var n=Gt(e,t,1,r)-1;return a[n](i[n](t))}}function Sn(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function Cn(){var e=gn,t=gn,n=Nt,r,i,a,o=_n,s,c,l;function u(){var n=Math.min(e.length,t.length);return o!==_n&&(o=yn(e[0],e[n-1])),s=n>2?xn:bn,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),Et))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,hn),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=Pt,u()},d.clamp=function(e){return arguments.length?(o=e?!0:_n,u()):o!==_n},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 wn(){return Cn()(_n,_n)}function Tn(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function En(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 Dn(e){return e=En(Math.abs(e)),e?e[1]:NaN}function On(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 kn(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var An=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function jn(e){if(!(t=An.exec(e)))throw Error(`invalid format: `+e);var t;return new Mn({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]})}jn.prototype=Mn.prototype;function Mn(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+``}Mn.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 Nn(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 Pn;function Fn(e,t){var n=En(e,t);if(!n)return Pn=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Pn=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`)+En(e,Math.max(0,t+a-1))[0]}function In(e,t){var n=En(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 Ln={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Tn,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)=>In(e*100,t),r:In,s:Fn,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Rn(e){return e}var zn=Array.prototype.map,Bn=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Vn(e){var t=e.grouping===void 0||e.thousands===void 0?Rn:On(zn.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?Rn:kn(zn.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=jn(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`):Ln[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=Ln[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=Nn(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Pn!==void 0?Bn[8+Pn/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(Dn(t)/3)))*3,r=10**-n,i=l((e=jn(e),e.type=`f`,e),{suffix:Bn[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Hn,Un,Wn;Gn({thousands:`,`,grouping:[3],currency:[`$`,``]});function Gn(e){return Hn=Vn(e),Un=Hn.format,Wn=Hn.formatPrefix,Hn}function Kn(e){return Math.max(0,-Dn(Math.abs(e)))}function qn(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Dn(t)/3)))*3-Dn(Math.abs(e)))}function Jn(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Dn(t)-Dn(e))+1}function Yn(e,t,n,r){var i=on(e,t,n),a;switch(r=jn(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=qn(i,o))&&(r.precision=a),Wn(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=Jn(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Kn(i))&&(r.precision=a-(r.type===`%`)*2);break}return Un(r)}function Xn(e){var t=e.domain;return e.ticks=function(e){var n=t();return rn(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Yn(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=an(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 Zn(){var e=wn();return e.copy=function(){return Sn(e,Zn())},dn.apply(e,arguments),Xn(e)}function Qn(){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]=sn(e,r/i);return a}function a(e){return e==null||isNaN(e=+e)?r:t[Gt(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(zt),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 Qn().domain(e).range(t).unknown(r)},dn.apply(a,arguments)}function $n(){var e=0,t=1,n=1,r=[.5],i=[0,1],a;function o(e){return e!=null&&e<=e?i[Gt(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 $n().domain([e,t]).range(i).unknown(a)},dn.apply(Xn(o),arguments)}var z=6371008.8;z*100,z*100,360/(2*Math.PI),z*3.28084,z*39.37,z/1e3,z/1e3,z/1609.344,z*1e3,z*1e3,z/1852,z*1.0936;function er(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 tr(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 er({type:`Polygon`,coordinates:e},t,n)}function nr(e,t,n={}){if(e.length<2)throw Error(`coordinates must be an array of two or more positions`);return er({type:`LineString`,coordinates:e},t,n)}function rr(e,t={}){let n={type:`FeatureCollection`};return t.id&&(n.id=t.id),t.bbox&&(n.bbox=t.bbox),n.features=e,n}function ir(e,t,n={}){return er({type:`MultiLineString`,coordinates:e},t,n)}function ar(e,t,n={}){return er({type:`MultiPolygon`,coordinates:e},t,n)}function or(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(or(o.geometries[r],t,n)===!1)return!1;break;default:throw Error(`Unknown Geometry Type`)}}}}}function sr(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 cr(e,t,n){var r=n;return sr(e,function(e,i,a,o,s){r=i===0&&n===void 0?e:t(r,e,i,a,o,s)}),r}function lr(e,t){t||={},t.iterations=t.iterations||1;let{iterations:n}=t,r=[];if(!e)throw Error(`inputPolys is required`);return sr(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=tr(t).geometry),ur(i,n),t=n.slice(0)}r.push(tr(t,i))}else if(e.type===`MultiPolygon`){let t=[[[]]];for(let r=0;r<n;r++){let n=[],i=e;r>0&&(i=ar(t).geometry),dr(i,n),t=n.slice(0)}r.push(ar(t,i))}else throw Error(`geometry is invalid, must be Polygon or MultiPolygon`)}),rr(r)}function ur(e,t){var n,r;or(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 dr(e,t){let n,r,i;or(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 fr(e){return e.type===`Feature`?e.geometry:e}function pr(e,t,n){var r=e.length,i=gr(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=gr(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=hr(l,u,i,t),i=gr(l,t)):(u=hr(l,u,s,t),s=gr(u,t));i=c}return a.length&&n.push(a),n}function mr(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=!(gr(i,t)&r),o=0;o<e.length;o++)s=e[o],c=!(gr(s,t)&r),c!==a&&n.push(hr(i,s,r,t)),c&&n.push(s),i=s,a=c;if(e=n,!e.length)break}return n}function hr(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 gr(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 _r(e,t){let n=fr(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=>{pr(n,t,e)}),e.length===1?nr(e[0],i):ir(e,i)}case`Polygon`:return tr(vr(a,t),i);case`MultiPolygon`:return ar(a.map(e=>vr(e,t)),i);default:throw Error(`geometry `+r+` not supported`)}}function vr(e,t){let n=[];for(let r of e){let e=mr(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 yr=_r;function br(e,t){let n=[],r=Math.PI*2/100;for(let i=0;i<100;i++)n.push(Sr(e,t,i*r));if(Cr(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(wr(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 xr(e,t,n){let r=[],i=t/100;for(let t=0;t<=100;t++)r.push(Sr(e,t*i,S(n)));return yr(nr(r),[-1/0,-85.051129,1/0,85.051129]).geometry.coordinates}function Sr(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 Cr(e,t){return w(e,{lng:0,lat:90})/1e3<t}function wr(e,t){return w(e,{lng:0,lat:-90})/1e3<t}function Tr(e){let{polygonType:t}=e,n=typeof e.anchorPoints?.[0]?.[0]==`number`?[e.anchorPoints]:e.anchorPoints;return t===`smooth`?lr(tr(n),{iterations:4}).features?.[0]?.geometry?.coordinates??n.slice():n.slice()}function Er(e,t){return`${e}-${P(`${t.vectorUrl}/${t.sourceLayerId}`)}`}function Dr(e){return`custom-area-${P(e.vectorUrl)}`}function Or(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(x.test(r)?Number(r):r),e},[])}function kr(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 Ar=[[`#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`]],jr=[],Mr=[/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(`|`),Nr=RegExp(`^\\s*(${Mr})\\s*$`);function Pr(e,t){let[n,r]=Kt(e),i=t.length;return un(i).map(e=>n+e*(r-n)/(i-1))}var Fr={linear:(e,t)=>Zn(Pr(e,t),t).interpolate(It).nice(4),quantile:(e,t)=>Qn(e,t),quantize:(e,t)=>$n(Kt(e),t).nice(),categorical:(e,t)=>pn(e,t)};function Ir(e){if(e.choropleth){let t=Lr(e),n=Br(e.fillColor);if(t&&n){let{choropleth:r}=e,i=r.categoricalColors[n],a=r.colorMode===`categorical`?t.map(e=>i.values[e]):Rr(r.lowerColor,r.upperColor,r.colorMode===`linear`?void 0:r.colorCount);return Fr[r.colorMode](t,a)}}}function Lr(e){if(e.choropleth){let t=e.fillColor?.match(/\$\{([^}]+)}/)?.[1];if(t){let n=Or(Object.values(e.models),t);if(!n.length||n.some(e=>typeof e!=`string`||!Nr.test(e)))return e.choropleth.colorMode===`categorical`?Array.from(new Set(n)):n}}}function Rr(e,t,n){let r=Ar.find(n=>n[0]===e&&n[n.length-1]===t)??jr.find(n=>n[0]===e&&n[n.length-1]===t);return r?Rt(Lt(It,r),n??r.length):Rt(It(e,t),n??2)}function zr(e,t){let n=t?Or(e,t):void 0;return n?.length?n.every(e=>typeof e==`number`)?`number`:n.every(e=>typeof e==`string`&&Nr.test(e))?`color`:`string`:void 0}function Br(e){return e?.match(/\$\{([^}]+)}/)?.[1]}function Vr(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 Hr(e,t){let n=t?zr(e,t):void 0;return n!==void 0&&n!==`color`}var Ur=new Map;async function Wr(e,t,n){return Ur.has(e)||Ur.set(e,fetch(`${t}/fonts/${e}.woff2?access_token=${n}`).then(e=>e.ok?e.arrayBuffer():void 0).then(t=>{if(t!==void 0)return document.fonts.add(new FontFace(e,t)),new Uint8Array(t).toBase64()}).catch(()=>void 0)),Ur.get(e)}async function Gr(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=re(t.getPropertyValue(`font-family`)),r=t.getPropertyValue(`font-weight`).trim()||`400`,i=t.getPropertyValue(`font-style`).trim()||`normal`,a=t.getPropertyValue(`src`).match(/local\(\s*["']?([^"')]+)["']?\s*\)/);n&&a?.[1]&&s.set(Kr(n,r,i),{name:a[1],family:n,weight:r,style:i})}return s}function Kr(e,t,n){return`${e}|${t}|${n}`}function qr(e){return`${e}, Arial, sans-serif`}function Jr(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 Yr(e,t,n){e[0]+=t,e[1]+=n,e[2]+=t,e[3]+=n}function Xr(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
|
+
// @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 ee=Math.cos(h),te=Math.sin(h),ne=Math.cos(g),re=Math.sin(g),P=Math.tan(A/4),ie=4/3*a*P,F=4/3*o*P,I=[e,t],L=[e+ie*te,t-F*ee],ae=[n+ie*re,i-F*ne],oe=[n,i];if(L[0]=2*I[0]-L[0],L[1]=2*I[1]-L[1],u)return[L,ae,oe].concat(m);m=[L,ae,oe].concat(m);for(var se=[],ce=0;ce<m.length;ce+=3){var a=f(m[ce][0],m[ce][1],p),o=f(m[ce+1][0],m[ce+1][1],p),le=f(m[ce+2][0],m[ce+2][1],p);se.push([a.x,a.y,o.x,o.y,le.x,le.y])}return se};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
|
+
`||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 Zr(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function B(e,t,n=1e-4){return Math.abs(e-t)<n}async function Qr(e,t,n,r,i,a){let o=oi(e,r);e=ci(e,o,await Promise.all(o.map(e=>Wr(e.name,i,a))));let s=new Blob([e],{type:`image/svg+xml`}),c=URL.createObjectURL(s),l=new Image;l.width=t,l.height=n,l.src=c;try{await l.decode()}finally{URL.revokeObjectURL(c)}return l}var $r=/\$\{([^}]+)}/g,ei=new DOMParser,ti=new XMLSerializer,ni=new Map;function ri(e){let t=ni.get(e);return t||(t=ei.parseFromString(e,`image/svg+xml`).documentElement,ni.set(e,t)),t}function ii(e){let t=ti.serializeToString(e);return ni.has(t)||ni.set(t,e),t}var ai=new Map;function oi(e,t){if(!ai.has(e)){let n=new Map,r=ri(e),i=r.querySelectorAll(`text,tspan`);document.body.appendChild(r);try{i.forEach(e=>{let r=window.getComputedStyle(e);r.fontFamily.split(`,`).map(re).forEach(e=>{let i=t.get(Kr(e,r.fontWeight,r.fontStyle));i!==void 0&&n.set(i.name,i)})}),ai.set(e,Array.from(n.values()))}finally{document.body.removeChild(r)}}return ai.get(e)??[]}var si=new Map;function ci(e,t,n){if(!si.has(e)){let r=t.map((e,t)=>{let r=n[t];return r===void 0?``:`
|
|
5
|
+
@font-face {
|
|
6
|
+
font-family: '${e.family}';
|
|
7
|
+
font-weight: ${e.weight};
|
|
8
|
+
font-style: ${e.style};
|
|
9
|
+
src: url(data:font/woff2;base64,${r});
|
|
10
|
+
}
|
|
11
|
+
`}).join(``);if(r.length!==0){let t=ri(e).cloneNode(!0),n=t.querySelector(`defs`);n===null&&(n=t.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`defs`),t.prepend(n));let i=t.ownerDocument.createElementNS(`http://www.w3.org/2000/svg`,`style`);i.textContent=r,n.appendChild(i),si.set(e,ti.serializeToString(t))}else si.set(e,e)}return si.get(e)??e}var li=new Map;function ui(e){let t=li.get(e);if(t)return t;let n=ri(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=Jr(i.map(e=>{let{x:t,y:n,width:r,height:i}=e.getBoundingClientRect();return[t,n,t+r,n+i]})),Yr(a,-e.x,-e.y),Xr(a)}finally{document.body.removeChild(n)}return li.set(e,a),a}var di=class{_seen=[];_svg=null;_element=null;constructor(e){this._svg=e}setElement(){return this._element=ri(this._svg).cloneNode(!0),this._svg=null,this._element}getSvgString(){return this._svg??ii(this._element)}getSvgSize(){let e=this._element??ri(this._svg);return[e.width.baseVal.value,e.height.baseVal.value]}getSvgColors(){let e=[],t=[],n=(this._element??ri(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 bi(n);if(r.badValue)e.push({name:`fill#${a}`,color:n});else{let{rgba:t}=r,n=i.getAttribute(`fill-opacity`);t[3]*=n?te(Number(n),0,1):1,e.push({name:`fill#${a}`,color:bi.fromRGB(t)})}t.push(i)}let r=i.getAttribute(`stroke`)?.trim();if(r){let n=new bi(r);if(n.badValue)e.push({name:`stroke#${a}`,color:r});else{let{rgba:t}=n,r=i.getAttribute(`stroke-opacity`);t[3]*=r?te(Number(r),0,1):1,e.push({name:`stroke#${a}`,color:bi.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??ri(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]]}B(e.attributes.x.value,t.x-r[0])&&B(e.attributes.y.value,t.y-r[2])&&B(e.attributes.width.value,t.width+r[0]+r[1])&&B(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]);B(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]);B(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=!(B(e.attributes.width.value,t.width)&&B(e.attributes.x.value,t.x)&&B(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=!(B(e.attributes.width.value,t.width)&&B(e.attributes.x.value,t.x)&&B(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=!(B(e.attributes.height.value,t.height)&&B(e.attributes.x.value,t.x-e.attributes.width.value)&&B(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=!(B(e.attributes.height.value,t.height)&&B(e.attributes.x.value,t.x+t.width)&&B(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&&!(B(o.x,a.x)&&B(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&&!(B(i.x,r.x)&&B(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&&!(B(i.x,r.x)&&B(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??ri(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
|
+
`);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=!B(n.x,t.x)||!B(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=!B(r.x,0)||!B(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=!B(r.x,0)||!B(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
|
+
§`).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
|
+
`&&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}},fi=class{map;keyCache=new Map;fontMap;vapiUrl;accessToken;constructor(e,t,n,r){this.map=e,this.fontMap=t,this.vapiUrl=n,this.accessToken=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 di(e).getSvgSize(),o=Math.max(a[0]*t,1),s=Math.max(a[1]*t,1);r=`mc-image-${P(i)}`,Qr(e,o,s,this.fontMap,this.vapiUrl,this.accessToken).then(e=>this.map.addImage(r,e,{pixelRatio:t})).catch(e=>console.log(e)),n.set(e,r)}return r}},pi=0,mi=``,hi=document.createElement(`canvas`).getContext(`2d`);function gi(e,t,n){let r=0,i=0,a=0,o=0;if(hi){(pi!==n||mi!==t)&&(hi.font=`${n}px ${t}`,mi=t,pi=n),{actualBoundingBoxAscent:a,actualBoundingBoxDescent:o}=hi.measureText(`█`);for(let t=0;t<e.length;++t){let{actualBoundingBoxLeft:n,actualBoundingBoxRight:i}=hi.measureText(e[t]);n+i>r&&(r=n+i)}i=(a+o)*e.length}return{width:r,height:i,ascent:a,descent:o}}function _i(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 bi(l).badValue?l:`#000000`}function vi(e,t,n){return(n??t)?.split($r).map((t,n)=>n&1?D(e[t]):t).join(``)||void 0}function yi(e,t,n){let r=t;if(t){let i=new di(t),a=i.getSvgColors(),o=i.getSvgTexts(),s=n?new Map(new di(n).getSvgColors().map(({name:e,color:t})=>[e,t])):new Map,c=n?new Map(new di(n).getSvgTexts().map(({name:e,text:t})=>[e,t])):new Map,l=a.map(({name:t,color:n})=>({name:t,color:new bi(_i(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:vi(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 bi=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 Ei){let n=Ei[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(Si,{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`?wi(n,t):e===`hsv`&&Ti(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 B(this._rgba[0],e._rgba[0])&&B(this._rgba[1],e._rgba[1])&&B(this._rgba[2],e._rgba[2])&&B(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})`}},xi={red:0,orange:60,yellow:120,green:180,blue:240,purple:300};function Si(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 xi)return xi[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 Ci(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 wi(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]=Ci(a,e,n+1/3),t[1]=Ci(a,e,n),t[2]=Ci(a,e,n-1/3)}return e.length>3&&(t[3]=e[3]),t}function Ti(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}var Ei={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 Di(e,t,n){let{title:r=``,titleFontColor:i=`#000000`,titleFontSize:a=24,entries:o,entryFontColor:s=`#000000`,entryFontSize:c=13,entryShape:l=`rectangle`,layout:u=`vertical`,background:d=`#ffffff`,showBackground:f=!1}=e,p=qr(e.titleFont??t),m=qr(e.entryFont??t),h=gi([r],p,a),g=o.map(e=>gi([e.label],m,c)),_=r.trim().length>0,v,y;u===`vertical`?(v=Math.max(h.width,...g.map(e=>e.width+15+10))+30,y=30+(_?h.height+20:0)+g.reduce((e,t)=>e+t.height,0)+Math.max(g.length-1,0)*20):(v=Math.max(h.width+30,30+g.reduce((e,t)=>e+t.width+15+10,0)+Math.max(g.length-1,0)*20),y=30+(_?h.height+20:0)+Math.max(0,...g.map(e=>e.height)));let b=[];f&&b.push(`
|
|
16
|
+
<rect
|
|
17
|
+
x="0"
|
|
18
|
+
y="0"
|
|
19
|
+
rx="10"
|
|
20
|
+
ry="10"
|
|
21
|
+
width="${v}"
|
|
22
|
+
height="${y}"
|
|
23
|
+
fill="${d}"
|
|
24
|
+
/>
|
|
25
|
+
`);let x=15,S=15;_&&(b.push(`
|
|
26
|
+
<text
|
|
27
|
+
x="${x}"
|
|
28
|
+
y="${S+h.ascent}"
|
|
29
|
+
font-family="${p}"
|
|
30
|
+
font-size="${a}"
|
|
31
|
+
fill="${i}"
|
|
32
|
+
>
|
|
33
|
+
${Zr(r)}
|
|
34
|
+
</text>
|
|
35
|
+
`),S+=h.height+20);for(let e=0;e<o.length;e++){let t=o[e],n=g[e];if(l===`rectangle`)b.push(`
|
|
36
|
+
<rect
|
|
37
|
+
x="${x}"
|
|
38
|
+
y="${S+n.height/2-15/2}"
|
|
39
|
+
rx="2"
|
|
40
|
+
ry="2"
|
|
41
|
+
width="15"
|
|
42
|
+
height="15"
|
|
43
|
+
fill="${t.color}"
|
|
44
|
+
/>
|
|
45
|
+
`);else if(l===`circle`)b.push(`
|
|
46
|
+
<circle
|
|
47
|
+
cx="${x+15/2}"
|
|
48
|
+
cy="${S+n.height/2}"
|
|
49
|
+
r="${15/2}"
|
|
50
|
+
fill="${t.color}"
|
|
51
|
+
/>
|
|
52
|
+
`);else if(l===`line`)b.push(`
|
|
53
|
+
<line
|
|
54
|
+
x1="${x}"
|
|
55
|
+
y1="${S+n.height/2}"
|
|
56
|
+
x2="${x+15}"
|
|
57
|
+
y2="${S+n.height/2}"
|
|
58
|
+
stroke="${t.color}"
|
|
59
|
+
stroke-width="2"
|
|
60
|
+
stroke-linecap="round"
|
|
61
|
+
/>
|
|
62
|
+
`);else if(l===`icon`&&t.svg.length>0){let e=new DOMParser().parseFromString(t.svg,`image/svg+xml`).querySelector(`svg`);e&&(e.setAttribute(`width`,`15`),e.setAttribute(`height`,`15`),e.setAttribute(`transform`,`translate(${x}, ${S+n.height/2-15/2})`),b.push(e.outerHTML))}b.push(`
|
|
63
|
+
<text
|
|
64
|
+
x="${x+15+10}"
|
|
65
|
+
y="${S+n.ascent}"
|
|
66
|
+
font-family="${m}"
|
|
67
|
+
font-size="${c}"
|
|
68
|
+
fill="${s}"
|
|
69
|
+
>
|
|
70
|
+
${Zr(t.label)}
|
|
71
|
+
</text>
|
|
72
|
+
`),u===`vertical`?S+=n.height+20:x+=n.width+15+10+20}return`
|
|
73
|
+
<svg
|
|
74
|
+
class="adornment-svg"
|
|
75
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
76
|
+
width="${v*n}"
|
|
77
|
+
height="${y*n}"
|
|
78
|
+
viewBox="0 0 ${v} ${y}"
|
|
79
|
+
>
|
|
80
|
+
${b.join(``)}
|
|
81
|
+
</svg>
|
|
82
|
+
`}var Oi=`ArialMT`,V=15;function ki(e,t,n,r,i,a){let o=document.createElement(`div`);o.className=`adornment`,e.showBackground&&(o.style.boxShadow=`0 0 7px 0 rgba(33, 37, 41, 0.25)`,o.style.borderRadius=`10px`);let s=[e.titleFont??Oi,e.labelFont??Oi],c=Array.from(new Set(s));return{element:o,ready:Promise.all(c.map(e=>Wr(e,r,i))).then(()=>{let r=()=>{o.innerHTML=Ai(e,t,n,n.getScale())};r(),a!==`interactive`&&n.on(`resize`,r)})}}function Ai(e,t,n,r){let{target:i}=e,a=t.registry?.models?.[i.modelType]?.find(e=>e.id===i.groupId),o=a?.models??[],s=a?.choropleth,c=Br(a?.fillColor);return!s||!c||a.models.every(e=>!(e.visible??!0))||!Hr(o,c)?ji():s.colorMode===`categorical`?Pi(e,s,c,r):s.colorMode===`linear`?Mi(e,a,n,r):s.colorMode===`quantile`||s.colorMode===`quantize`?Ni(e,a,n,r):ji()}function ji(){return`
|
|
83
|
+
<svg
|
|
84
|
+
class="adornment-svg"
|
|
85
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
86
|
+
width="0"
|
|
87
|
+
height="0"
|
|
88
|
+
viewBox="0 0 0 0"
|
|
89
|
+
>
|
|
90
|
+
</svg>
|
|
91
|
+
`}function Mi(e,t,n,r){let i=15/2,{id:a,layout:o=`vertical`,labelFontSize:s=13,labelFontColor:c=`#000000`,numberFormat:l=`.2~s`,title:u=``,titleFontSize:d=14,titleFontColor:f=`#000000`,showBackground:p=!1,background:m=`#ffffff`}=e,h=qr(e.labelFont??Oi),g=qr(e.titleFont??Oi),_=`gradient-${a}`,v=o===`horizontal`,y=Ir(t);if(y===void 0)return ji();let b=[],[x,S]=Kt(y.domain()),C=rn(x,S,4),w=Fi(l),T=C.map(e=>w(e)),E=T.map(e=>gi([e],h,s)),D=[];for(let e=0;e<32;e++){let t=e/31;D.push(`<stop offset="${t*100}%" stop-color="${y(x+t*(S-x))}" />`)}let O=v?``:`rotate(90)`;b.push(`
|
|
92
|
+
<defs>
|
|
93
|
+
<linearGradient id="${_}" gradientTransform="${O}">
|
|
94
|
+
${D.join(``)}
|
|
95
|
+
</linearGradient>
|
|
96
|
+
</defs>
|
|
97
|
+
`);let k=gi([u],g,d),A=u.trim().length>0,j={width:Math.max(0,...E.map(e=>e.width)),height:Math.max(0,...E.map(e=>e.height)),ascent:Math.max(0,...E.map(e=>e.ascent))},M=A?k.height+10:0,ne=A?k.width:0,re=C.length-1,P=te(45*re,Math.ceil(v?(j.width+10)*re:(j.height+10)*re),Math.floor(v?n.getContainer().clientWidth-10-V*2:n.getContainer().clientHeight-10-V*2-M)),ie=Math.ceil(v?V*2+Math.max(ne,P):V*2+Math.max(ne,25+j.width)),F=Math.ceil(v?V*2+M+20+5+j.ascent:V*2+M+P);p&&b.push(`
|
|
98
|
+
<rect
|
|
99
|
+
x="0"
|
|
100
|
+
y="0"
|
|
101
|
+
rx="10"
|
|
102
|
+
ry="10"
|
|
103
|
+
width="${ie}"
|
|
104
|
+
height="${F}"
|
|
105
|
+
fill="${m}"
|
|
106
|
+
/>
|
|
107
|
+
`);let I=V,L=V;A&&(b.push(`
|
|
108
|
+
<text
|
|
109
|
+
x="${I}"
|
|
110
|
+
y="${L+k.ascent}"
|
|
111
|
+
font-family="${g}"
|
|
112
|
+
font-size="${d}"
|
|
113
|
+
fill="${f}"
|
|
114
|
+
>
|
|
115
|
+
${Zr(u)}
|
|
116
|
+
</text>
|
|
117
|
+
`),L+=k.height+10),b.push(`
|
|
118
|
+
<rect
|
|
119
|
+
x="${I}"
|
|
120
|
+
y="${L}"
|
|
121
|
+
rx="${i}"
|
|
122
|
+
ry="${i}"
|
|
123
|
+
width="${v?P:15}"
|
|
124
|
+
height="${v?15:P}"
|
|
125
|
+
fill="url(#${_})"
|
|
126
|
+
/>
|
|
127
|
+
`);for(let e=1;e<C.length-1;e++){let t=C[e],n=T[e],r=E[e],a=N(0,P,ee(x,S,t));a>i&&a<P-i&&b.push(`
|
|
128
|
+
<line
|
|
129
|
+
x1="${v?Math.floor(I+a)+.5:I}"
|
|
130
|
+
y1="${v?L:Math.floor(L+a)+.5}"
|
|
131
|
+
x2="${v?Math.floor(I+a)+.5:I+20}"
|
|
132
|
+
y2="${v?L+20:Math.floor(L+a)+.5}"
|
|
133
|
+
stroke="#ffffff"
|
|
134
|
+
/>
|
|
135
|
+
`),b.push(`
|
|
136
|
+
<text
|
|
137
|
+
x="${v?I+a:I+20+5}"
|
|
138
|
+
y="${v?L+20+5+r.ascent:L+a-r.descent+r.height/2}"
|
|
139
|
+
font-family="${h}"
|
|
140
|
+
font-size="${s}"
|
|
141
|
+
fill="${c}"
|
|
142
|
+
text-anchor="${v?`middle`:`start`}"
|
|
143
|
+
>
|
|
144
|
+
${Zr(n)}
|
|
145
|
+
</text>
|
|
146
|
+
`)}return`
|
|
147
|
+
<svg
|
|
148
|
+
class="adornment-svg"
|
|
149
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
150
|
+
width="${ie*r}"
|
|
151
|
+
height="${F*r}"
|
|
152
|
+
viewBox="0 0 ${ie} ${F}"
|
|
153
|
+
>
|
|
154
|
+
${b.join(``)}
|
|
155
|
+
</svg>
|
|
156
|
+
`}function Ni(e,t,n,r){let i=Ir(t),a=i?.range(),o=[],s=0,c=0;if(i&&a&&a.length>1){let{layout:t=`vertical`,labelFontSize:r=13,labelFontColor:l=`#000000`,labelStyle:u=`range`,numberFormat:d=`.2~s`,title:f=``,titleFontSize:p=14,titleFontColor:m=`#000000`,showBackground:h=!1,background:g=`#ffffff`}=e,_=qr(e.labelFont??Oi),v=qr(e.titleFont??Oi),y=t===`vertical`,b=u===`range`,x=Fi(d),S=b?a.map(e=>i.invertExtent(e)).map((e,t,n)=>t===0?`< ${x(e[1])}`:t===n.length-1?`> ${x(e[0])}`:`${x(e[0])} – ${x(e[1])}`):a.map(e=>i.invertExtent(e)).reduce((e,t,n)=>(n&&e.push(x(t[0])),e),[]),C=S.map(e=>gi([e],_,r)),w=gi([f],v,p),T=f.trim().length>0,E={width:Math.max(0,...C.map(e=>e.width)),height:Math.max(0,...C.map(e=>e.height)),ascent:Math.max(0,...C.map(e=>e.ascent))},D=T?w.height+10:0,O=T?w.width:0,k=a.length,A=45,j=15/2;y?(A=te(A,Math.ceil(E.height)+10,Math.floor((n.getContainer().clientHeight-10-V*2-D)/k)),s=Math.ceil(V*2+D+k*A),c=Math.ceil(V*2+Math.max(O,25+E.width))):(A=te(A,Math.ceil(E.width)+10,Math.floor((n.getContainer().clientWidth-10-V*2)/k)),c=Math.ceil(V*2+Math.max(O,k*A)),s=Math.ceil(V*2+D+15+10+E.ascent)),h&&o.push(`
|
|
157
|
+
<rect
|
|
158
|
+
x="0"
|
|
159
|
+
y="0"
|
|
160
|
+
rx="10"
|
|
161
|
+
ry="10"
|
|
162
|
+
width="${c}"
|
|
163
|
+
height="${s}"
|
|
164
|
+
fill="${g}"
|
|
165
|
+
/>
|
|
166
|
+
`);let M=V,N=V;T&&(o.push(`
|
|
167
|
+
<text
|
|
168
|
+
x="${M}"
|
|
169
|
+
y="${N+w.ascent}"
|
|
170
|
+
font-family="${v}"
|
|
171
|
+
font-size="${p}"
|
|
172
|
+
fill="${m}"
|
|
173
|
+
>
|
|
174
|
+
${Zr(f)}
|
|
175
|
+
</text>
|
|
176
|
+
`),N+=D);let ee=y?15:A,ne=y?A:15,re=y?0:A,P=y?A:0,ie=b?15:20,F=y?`M ${M} ${N+j} v ${A-j} h 15 v ${-(A-j)} a ${j} ${j} 0 0 0 -15 0 z`:`M ${M+j} ${N} h ${A-j} v 15 h ${-(A-j)} a ${j} ${j} 0 0 1 0 -15 z`;o.push(`<path d="${F}" fill="${a[0]}" />`),M+=re,N+=P;for(let e=1;e<k-1;e++,M+=re,N+=P)o.push(`
|
|
177
|
+
<rect
|
|
178
|
+
x="${M}"
|
|
179
|
+
y="${N}"
|
|
180
|
+
width="${ee}"
|
|
181
|
+
height="${ne}"
|
|
182
|
+
fill="${a[e]}"
|
|
183
|
+
/>
|
|
184
|
+
`),o.push(`
|
|
185
|
+
<line
|
|
186
|
+
x1="${y?M:M+.5}"
|
|
187
|
+
y1="${y?N+.5:N}"
|
|
188
|
+
x2="${y?M+ie:M+.5}"
|
|
189
|
+
y2="${y?N+.5:N+ie}"
|
|
190
|
+
stroke="#ffffff"
|
|
191
|
+
/>
|
|
192
|
+
`);let I=y?`M ${M} ${N} v ${A-j} a ${j} ${j} 0 0 0 15 0 v ${-(A-j)} z`:`M ${M} ${N} h ${A-j} a ${j} ${j} 0 0 1 0 15 h ${-(A-j)} z`;o.push(`<path d="${I}" fill="${a[k-1]}" />`),o.push(`
|
|
193
|
+
<line
|
|
194
|
+
x1="${y?M:M+.5}"
|
|
195
|
+
y1="${y?N+.5:N}"
|
|
196
|
+
x2="${y?M+ie:M+.5}"
|
|
197
|
+
y2="${y?N+.5:N+ie}"
|
|
198
|
+
stroke="#ffffff"
|
|
199
|
+
/>
|
|
200
|
+
`),M=V,N=V+D;for(let e=0;e<S.length;e++,M+=re,N+=P)o.push(`
|
|
201
|
+
<text
|
|
202
|
+
x="${y?M+15+10:M+(b?A/2:A)}"
|
|
203
|
+
y="${y?N+(b?A/2:A)-E.height/2+E.ascent:N+15+10+E.ascent}"
|
|
204
|
+
text-anchor="${y?`start`:`middle`}"
|
|
205
|
+
font-family="${_}"
|
|
206
|
+
font-size="${r}"
|
|
207
|
+
fill="${l}"
|
|
208
|
+
>
|
|
209
|
+
${Zr(S[e])}
|
|
210
|
+
</text>
|
|
211
|
+
`)}return`
|
|
212
|
+
<svg
|
|
213
|
+
class="adornment-svg"
|
|
214
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
215
|
+
width="${c*r}"
|
|
216
|
+
height="${s*r}"
|
|
217
|
+
viewBox="0 0 ${c} ${s}"
|
|
218
|
+
>
|
|
219
|
+
${o.join(``)}
|
|
220
|
+
</svg>
|
|
221
|
+
`}function Pi(e,t,n,r){let i=t.categoricalColors[n];if(i===void 0)return ji();let a=Vr(i.values),o=Object.entries(i.colors).map(([e,n])=>({color:e,label:n.title??a[e]??t.defaultGroupName,order:n.order,hidden:n.hidden,svg:``})).filter(e=>!e.hidden).sort((e,t)=>e.order-t.order);return Di({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??Oi,titleFontColor:e.titleFontColor??`#000000`,titleFontSize:e.titleFontSize??14,entryFont:e.labelFont??Oi,entryFontColor:e.labelFontColor??`#000000`,entryFontSize:e.labelFontSize??13,entryShape:`rectangle`,entries:o,background:e.background??`#ffffff`,showBackground:e.showBackground??!1},Oi,r)}function Fi(e){let{decimal:t,group:n}=Ii();return Vn({decimal:t,thousands:n,grouping:[3],currency:[``,``]}).format(e)}function Ii(){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 Li(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=`ArialMT`,s=[e.titleFont??o,e.entryFont??o],c=Array.from(new Set(s));return{element:a,ready:Promise.all(c.map(e=>Wr(e,n,r))).then(()=>{let n=()=>{a.innerHTML=Di(e,o,t.getScale())};n(),i!==`interactive`&&t.on(`resize`,n)})}}function Ri(e,t,n){let r=document.createElement(`div`);r.className=`adornment`;let i=(e.scale??1)*30,a=()=>{let e=i*t.getScale();r.style.cssText=`width: ${e}px; height: ${e}px`,r.innerHTML=zi(t,i)};return a(),t.on(`move`,a),n!==`interactive`&&t.on(`resize`,a),r}function zi(e,t){let n=e.getScale(),r=e.getBearing(),i=e.getPitch();return`
|
|
222
|
+
<svg class="adornment-svg" width="${t*n}" height="${t*n}" viewBox="-5 -5 30 30" xmlns="http://www.w3.org/2000/svg">
|
|
223
|
+
<g class="tilt" style="transform-origin: 33% 33%; transform: rotateX(${i}deg);">
|
|
224
|
+
<g class="rotate" style="transform-origin: 33% 33%; transform: rotate(${-r}deg);">
|
|
225
|
+
<path d="M0 20L10 0L20 20L10 12.7711L0 20Z" fill="#343A40" />
|
|
226
|
+
</g>
|
|
227
|
+
</g>
|
|
228
|
+
</svg>
|
|
229
|
+
`}var Bi=`<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>
|
|
230
|
+
`;function Vi(e){let t=document.createElement(`button`);return t.className=e.className,t.innerHTML=`${e.content}`,t.addEventListener(`click`,e.onClick),t}function Hi(e,t){return Vi({type:`button`,className:`control-button toggle-adornments-button`,content:Bi,onClick:()=>{t.querySelectorAll(`.adornment:not(.web-control)`).forEach(e=>e.classList.toggle(`hide`)),t.querySelector(`.toggle-adornments-button`)?.classList.toggle(`active`),Kl(e)}})}var Ui=`<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>
|
|
231
|
+
`,Wi=`<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>
|
|
232
|
+
`;function Gi(e){return Vi({type:`button`,className:`control-button zoom-in-button`,content:Ui,onClick:()=>e.zoomIn()})}function Ki(e){return Vi({type:`button`,className:`control-button zoom-out-button`,content:Wi,onClick:()=>e.zoomOut()})}var qi=`<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>
|
|
233
|
+
`,Ji=`<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>
|
|
234
|
+
`,Yi=`<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g filter="url(#a)"><circle cx="16" cy="16" r="10" fill="#349CF2"/><circle cx="16" cy="16" r="9" stroke="#fff" stroke-width="2"/></g><defs><filter id="a" x="0" y="0" width="32" height="32" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feColorMatrix in="SourceAlpha" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/><feOffset dy="4"/><feGaussianBlur stdDeviation="2"/><feComposite in2="hardAlpha" operator="out"/><feColorMatrix values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.25 0"/><feBlend in2="BackgroundImageFix" result="effect1_dropShadow_15_3175"/><feBlend in="SourceGraphic" in2="effect1_dropShadow_15_3175" result="shape"/></filter></defs></svg>
|
|
235
|
+
`,Xi=(e,t)=>{let n=2*window.devicePixelRatio,r=t.getMapLibreImageKey(Yi,n);e.setLayoutProperty(`location-dot`,`icon-image`,r)},Zi=(e,t)=>{e.getSource(`location-circle`)||e.addSource(`location-circle`,{type:`geojson`,data:{type:`FeatureCollection`,features:[]}}),e.getSource(`location-dot`)||e.addSource(`location-dot`,{type:`geojson`,data:{type:`Feature`,geometry:{type:`Point`,coordinates:[]},properties:{}}}),e.getLayer(`location-circle`)||e.addLayer({id:`location-circle`,type:`fill`,source:`location-circle`,layout:{},paint:{"fill-color":`#349CF2`,"fill-opacity":.15,"fill-outline-color":`#005196`}},`mc-before-names`),e.getLayer(`location-dot`)||e.addLayer({id:`location-dot`,type:`symbol`,source:`location-dot`,layout:{"icon-padding":0},paint:{"icon-opacity":1},metadata:{"mc-name":`location dot`,"mc-skip-load":!0}},`mc-before-names`),Xi(e,t)},Qi=(e,t,n)=>{let r=e.getSource(`location-dot`);r&&r.setData({type:`Feature`,geometry:{type:`Point`,coordinates:[t,n]},properties:{}})},$i=(e,t,n)=>{let r=n/1e3,i=[],a=r/(111.32*Math.cos(t*Math.PI/180)),o=r/110.574;for(let n=0;n<64;n++){let r=n/64*(2*Math.PI),s=a*Math.cos(r),c=o*Math.sin(r);i.push([e+s,t+c])}return i.push(i[0]),{type:`FeatureCollection`,features:[{type:`Feature`,geometry:{type:`Polygon`,coordinates:[i]}}]}},ea=()=>{let e=document.querySelector(`.map`),t=document.createElement(`div`);t.classList.add(`location-notification`),t.textContent=`Geolocation is not available`,e?.appendChild(t),setTimeout(()=>{e?.removeChild(t)},3e3)};function ta(e,t){let n=!1,r=e=>{let t=document.querySelector(`.geolocation-button`),r=t?.querySelector(`.geolocation-icon`),i=t?.querySelector(`.locating-icon`);r&&i&&(r.classList.toggle(`active`,!e),i.classList.toggle(`active`,e)),n=e},i=t=>{let{longitude:n,latitude:i,accuracy:a}=t.coords,o=[n,i];e.easeTo?e.easeTo({center:o,zoom:19,duration:1e3}):e.setCenter&&e.setCenter(o);let s=e.getSource(`location-circle`);s&&s.setData($i(n,i,a/2)),Qi(e,n,i),e.once(`moveend`,()=>r(!1))},a=e=>{console.error(`Geolocation error:`,e),r(!1)};return Vi({type:`button`,className:`control-button geolocation-button`,content:`
|
|
236
|
+
<div class="location-icon geolocation-icon active">${qi}</div>
|
|
237
|
+
<div class="location-icon locating-icon">${Ji}</div>
|
|
238
|
+
`,onClick:()=>{if(!n){if(e.getSource(`location-circle`)||Zi(e,t),r(!0),!navigator.geolocation){ea(),r(!1);return}navigator.geolocation.getCurrentPosition(i,a,{maximumAge:6e4,timeout:5e3})}}})}var na=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M4.774 6.44a.556.556 0 0 1 .832.734l-.047.052L2.897 9.89h1.436a.555.555 0 0 1 .065 1.107L4.333 11H1.556a.556.556 0 0 1-.552-.49L1 10.443V7.667a.556.556 0 0 1 1.107-.065l.004.065v1.436l2.663-2.662ZM10.444 1a.555.555 0 0 1 .552.49l.004.066v2.777a.556.556 0 0 1-1.107.065l-.004-.065V2.897L7.226 5.559a.556.556 0 0 1-.832-.733l.047-.052L9.103 2.11H7.667a.556.556 0 0 1-.065-1.107L7.667 1h2.777Z"/></svg>
|
|
239
|
+
`;function ra(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}function ia(e){return document.fullscreenElement===e||document.webkitFullscreenElement===e||document.mozFullScreenElement===e||document.msFullscreenElement===e}function aa(e){e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():e.webkitRequestFullscreen&&e.webkitRequestFullscreen()}function oa(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen()}function sa(e){if(ra())ia(e)?oa():aa(e);else{let e=document.location.href;e+=e.includes(`?`)?`&`:`?`,e+=`close-tab`,window.open(e,`_blank`)}}function ca(e){return Vi({type:`button`,className:`control-button fullscreen-control-button`,content:na,onClick:()=>sa(e.getContainer())})}var la=`<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M6.155 1.146A.546.546 0 0 1 6.53 1c.14 0 .275.053.375.146l1.588 1.5c.1.094.155.221.155.354 0 .132-.056.26-.155.353l-1.588 1.5a.546.546 0 0 1-.373.14.545.545 0 0 1-.37-.146.487.487 0 0 1-.154-.349.486.486 0 0 1 .148-.352L6.84 3.5H6c-1.878 0-3.441 1.476-3.441 3.25S4.122 10 6 10s3.441-1.476 3.441-3.25c0-.133.056-.26.155-.354a.546.546 0 0 1 .375-.146c.14 0 .275.053.374.146.1.094.155.221.155.354C10.5 9.076 8.463 11 6 11S1.5 9.076 1.5 6.75 3.537 2.5 6 2.5h.84l-.685-.647A.486.486 0 0 1 6 1.5c0-.133.056-.26.155-.354Z"/></svg>
|
|
240
|
+
`;function ua(e,t){return Vi({type:`button`,className:`control-button refresh-button`,content:la,onClick:()=>{e.easeTo({center:t.center,zoom:t.zoom,pitch:t.pitch,bearing:t.rotation})}})}var da=`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="currentColor"><path d="M5.374.952a4.546 4.546 0 0 1 4.656 4.175 4.55 4.55 0 0 1-.958 3.184l1.824 1.81a.55.55 0 0 1 0 .765.55.55 0 0 1-.602.121.6.6 0 0 1-.179-.12l-1.807-1.81A4.544 4.544 0 0 1 .953 5.376 4.553 4.553 0 0 1 5.374.952m1.454 1.37a3.447 3.447 0 0 0-4.505 4.51 3.45 3.45 0 0 0 3.186 2.13A3.45 3.45 0 0 0 8.957 5.51a3.455 3.455 0 0 0-2.129-3.187"/></svg>
|
|
241
|
+
`,fa=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="currentColor"><path d="m7.038 5.96 3.03 3.03L13.1 5.958l1.01 1.01L11.078 10l3.031 3.032-1.01 1.01-3.031-3.031-3.03 3.028-1.01-1.01L9.059 10l-3.03-3.03z"/></svg>
|
|
242
|
+
`,pa={da_DK:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},de_DE:{search:`Suche`,videoAlert:`Das Video ist in der veröffentlichten Karte sichtbar.`,mobileHelpText:`Verwenden Sie zwei Finger um die Karte zu bewegen`,windowsHelpText:`Verwenden Sie Strg + Scroll um in der Karte zu zoomen`,macHelpText:`Verwenden Sie ⌘ + Scroll um in der Karte zu zoomen`},en_GB:{search:`Search`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use two fingers to move the map`,windowsHelpText:`Use Ctrl + scroll to zoom the map`,macHelpText:`Use ⌘ + scroll to zoom the map`},es_ES:{search:`Buscar`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Use dos dedos para mover el mapa`,windowsHelpText:`Use Ctrl + desplazamiento para hacer zoom en el mapa`,macHelpText:`Use ⌘ + desplazamiento para hacer zoom en el mapa`},fr_FR:{search:`Rechercher`,videoAlert:`Votre vidéo sera diffusée sur la carte publiée`,mobileHelpText:`Utilisez deux doigts pour déplacer la carte`,windowsHelpText:`Utilisez Ctrl + défilement pour zoomer sur la carte`,macHelpText:`Utilisez ⌘ + défilement pour zoomer sur la carte`},it_IT:{search:`Cercare`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Usa due dita per muovere la mappa`,windowsHelpText:`Usa Ctrl + Scroll per ingrandire la mappa`,macHelpText:`Usa ⌘ + Scroll per ingrandire la mappa`},nl_NL:{search:`Zoeken`,videoAlert:`The video will only work when you publish the map`,mobileHelpText:`Gebruik twee vingers om de kaart te bewegen`,windowsHelpText:`Gebruik Ctrl + Scroll om de kaart te zoomen`,macHelpText:`Gebruik ⌘ + Scroll om de kaart te zoomen`}};function ma(){let e=navigator.language.replace(`-`,`_`),t=Object.keys(pa);return t.find(t=>t===e)??t.find(t=>t.split(`_`)[0]===e.split(`_`)[0])??`en_GB`}var ha=ma();function ga(e){return pa[ha][e]??e}var _a=class{async getLocationInBounds(e,t,n=10){try{let r=await this._callGraphHopper({limit:n,q:e,point:`${t.lat},${t.lng}`});return this._mapResults(r.hits)}catch(e){return console.warn(`Geocoding failed: `,e),[]}}async _callGraphHopper(e){let t=new URLSearchParams(e);t.append(`key`,`c5c40ac9-ed73-4e20-aed6-cfe495604ca8`),t.append(`locale`,ha.slice(0,2));let n={headers:{Accept:`application/json`}},r=`https://graphhopper.com/api/1/geocode?${t}`;return await(await fetch(r,n)).json()}_mapResults(e){return e.map(e=>({id:e.osm_id.toString(),labelTitle:e.name,position:{lng:e.point.lng,lat:e.point.lat},bbox:e.extent?[{lng:e.extent[0],lat:e.extent[1]},{lng:e.extent[2],lat:e.extent[3]}]:null,subtitle:[e.osm_value,e.city,e.state,e.country].filter(Boolean).join(`, `)}))}},va=class{map;mapContainer;container;control;input;dropdown;inputWrapper;button;isOpen=!1;geocoder=new _a;suggestions=[];items=[];index=0;debounce;constructor(e){this.map=e,this.container=document.createElement(`div`),this.control=document.createElement(`div`),this.input=document.createElement(`input`),this.dropdown=document.createElement(`div`),this.inputWrapper=document.createElement(`div`),this.button=document.createElement(`button`),this.mapContainer=this.map.getContainer()}init(){this.container.className=`geocoder-container`,this.control.className=`geocoder-control`,this.input.className=`geocoder-input`,this.dropdown.className=`geocoder-dropdown`,this.inputWrapper.className=`geocoder-input-wrapper`,this.button.className=`control-button`,this.input.type=`text`,this.input.placeholder=ga(`search`),this.button.innerHTML=da;let e=document.createElement(`button`);e.className=`geocoder-clear`,e.innerHTML=fa;let t=document.createElement(`div`);return t.className=`geocoder-scrollwrapper`,t.append(this.dropdown),this.inputWrapper.append(this.input,e),this.control.append(this.button,this.inputWrapper,t),e.addEventListener(`click`,()=>this.clearAll()),this.button.addEventListener(`click`,()=>this.toggle()),this.input.addEventListener(`input`,()=>this.onInput()),this.input.addEventListener(`keydown`,e=>this.onKeyDown(e)),this.dropdown.addEventListener(`mousemove`,e=>this.onMouseMove(e)),this.mapContainer.addEventListener(`mousedown`,e=>this.clickOutside(e)),window.addEventListener(`resize`,()=>this.setMaxSizes()),this.setMaxSizes(),this.updateVisibility(),this.container.append(this.control),this.container}clickOutside(e){e.target instanceof Node&&!this.control.contains(e.target)&&this.hide()}setMaxSizes(){let{width:e,height:t}=this.mapContainer.getBoundingClientRect();this.control.style.maxWidth=`${e-40}px`,this.dropdown.style.maxHeight=`${Math.min(310,t-63)}px`}toggle(){this.isOpen=!this.isOpen,this.button.classList.toggle(`open`),this.updateVisibility(),this.isOpen&&this.input.focus()}hide(){this.isOpen&&(this.isOpen=!1,this.button.classList.remove(`open`),this.updateVisibility())}clearDropdown(){this.suggestions=[],this.items=[],this.dropdown.innerHTML=``}clearAll(){this.input.value=``,this.clearDropdown()}updateVisibility(){let e=this.isOpen;this.inputWrapper.style.display=e?`flex`:`none`,e||this.clearAll()}onInput(){let e=this.input.value.trim();if(this.debounce&&clearTimeout(this.debounce),e.length<2){this.dropdown.innerHTML=``;return}this.debounce=window.setTimeout(async()=>{this.suggestions=await this.geocoder.getLocationInBounds(e,this.map.getCenter(),20),this.items=[],this.renderSuggestions()},200)}renderSuggestions(){this.dropdown.innerHTML=``,this.items=[],this.index=0,this.suggestions.forEach(e=>{let t=document.createElement(`div`),n=document.createElement(`div`),r=document.createElement(`div`);t.className=`geocoder-suggestion`,n.className=`title`,r.className=`subtitle`,n.textContent=e.labelTitle,r.textContent=e.subtitle,t.append(n,r),t.addEventListener(`mousedown`,t=>{t.stopPropagation(),this.goToSelection(e)}),this.dropdown.appendChild(t),this.items.push({data:e,el:t})}),this.updateHighlight()}updateHighlight(){this.items.forEach((e,t)=>{e.el.classList.toggle(`highlight`,t===this.index)})}onKeyDown(e){if(e.key===`ArrowUp`)e.preventDefault(),this.index--,this.index<0&&(this.index=this.items.length-1),this.adjustScroll();else if(e.key===`ArrowDown`)e.preventDefault(),this.index++,this.index>this.items.length-1&&(this.index=0),this.adjustScroll();else if(e.key===`Enter`){e.preventDefault();let t=this.items[this.index];t&&this.goToSelection(t.data)}else e.key===`Escape`&&(e.preventDefault(),this.hide());this.updateHighlight()}onMouseMove(e){let t=e.target.closest(`.geocoder-suggestion`);this.index=this.items.findIndex(e=>e.el===t),this.updateHighlight()}goToSelection(e){e.bbox?this.map.fitBounds(e.bbox,{duration:0,animate:!1}):this.map.jumpTo({center:e.position,zoom:16}),this.input.value=e.labelTitle,this.clearDropdown()}adjustScroll(){let e=this.items[this.index].el,t=this.dropdown,n=t.getBoundingClientRect(),r=e.getBoundingClientRect();r.bottom>n.bottom?t.scrollTop+=r.bottom-n.bottom:r.top<n.top&&(t.scrollTop+=r.top-n.top)}};function ya(){return navigator.userAgent.toLowerCase().indexOf(`mobile`)>=0}function ba(e,t,n,r,i){let a=document.createElement(`div`);return a.classList.add(`web-control`,`adornment`),xa(e,i).forEach(e=>{let i;if(e===`zoomIn`)i=Gi(t);else if(e===`zoomOut`)i=Ki(t);else if(e===`fullscreen`)i=ca(t);else if(e===`geolocation`)i=ta(t,n);else if(e===`refresh`)i=ua(t,r);else if(e===`search`)i=new va(t).init();else if(e===`toggleAdornments`)i=Hi(t,t.getContainer());else return;a.appendChild(i)}),a}function xa(e,t){let n=e.buttons.flatMap(e=>e===`zoom`?[`zoomIn`,`zoomOut`]:e);if(ya()){let e=n.filter(e=>e!==`zoomIn`&&e!==`zoomOut`);if(t){let t=e[0]===`search`?1:0;e.splice(t,0,`toggleAdornments`)}return e}return n}var Sa={here:{href:`https://www.here.com/`,label:`© HERE 2025`},mapcreator:{href:`https://mapcreator.io/`,label:`© Mapcreator`},openStreetMap:{href:`https://www.openstreetmap.org/copyright/`,label:`© OpenStreetMap`}};function Ca(e,t){let n=document.createElement(`div`);n.className=`adornment`;let r=()=>{n.innerHTML=Ea(t,e,t.getScale())};return r(),t.on(`attributionchange`,r),t.on(`zoomend`,r),t.on(`resize`,r),n}function wa(e){let t=Object.values(e.style.tileManagers),n=[Sa.mapcreator],r={osm:!1,here:!1};for(let e=0;e<t.length&&!(r.osm&&r.here);++e){let n=t[e];if(n.used){let e=n.getSource();`attribution`in e&&typeof e.attribution==`string`&&(e.attribution.includes(`OpenStreetMap`)&&(r.osm=!0),e.attribution.includes(`HERE`)&&(r.here=!0))}}return r.osm&&n.push(Sa.openStreetMap),r.here&&n.push(Sa.here),n}function Ta(e,t,n){let r=document.createElement(`span`);r.style.fontFamily=t,r.style.fontSize=`${n}px`,r.style.position=`absolute`,r.style.visibility=`hidden`,r.innerText=e,document.body.appendChild(r);let i=Math.max(r.offsetWidth,1);return r.remove(),i}function Ea(e,t,n){let{color:r=`#000000`,font:i=`Arial, sans-serif`,fontSize:a=10,orientation:o=`horizontal`,position:s}=t,c=wa(e),l=Ta(c.map(({label:e})=>e).join(` `),i,a),u=a*1.2,d=o===`vertical`,f=[`top_left`,`bottom_left`].includes(s),p=d?u:l,m=d?l:u,h=d?f?-90:90:0,g=d?f?.38*a:.3*a:.38*a,_=c.map(e=>`<a href="${e.href}" target="_blank">${e.label}</a>`).join(` `);return`
|
|
243
|
+
<svg
|
|
244
|
+
class="adornment-svg"
|
|
245
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
246
|
+
viewBox="0 0 ${p} ${m}"
|
|
247
|
+
width="${p*n}"
|
|
248
|
+
height="${m*n}"
|
|
249
|
+
overflow="visible"
|
|
250
|
+
>
|
|
251
|
+
<text
|
|
252
|
+
x="${p/2}"
|
|
253
|
+
y="${m/2+g}"
|
|
254
|
+
transform="rotate(${h} ${p/2} ${m/2})"
|
|
255
|
+
font-family="${i}"
|
|
256
|
+
font-size="${a}"
|
|
257
|
+
fill="${r}"
|
|
258
|
+
text-anchor="middle"
|
|
259
|
+
pointer-events="none"
|
|
260
|
+
>${_}</text>
|
|
261
|
+
</svg>
|
|
262
|
+
`}function Da(e){return cr(e,(e,t)=>e+Oa(t),0)}function Oa(e){let t=0,n;switch(e.type){case`Polygon`:return ka(e.coordinates);case`MultiPolygon`:for(n=0;n<e.coordinates.length;n++)t+=ka(e.coordinates[n]);return t;case`Point`:case`MultiPoint`:case`LineString`:case`MultiLineString`:return 0}return 0}function ka(e){let t=0;if(e&&e.length>0){t+=Math.abs(Ma(e[0]));for(let n=1;n<e.length;n++)t-=Math.abs(Ma(e[n]))}return t}var Aa=z*z/2,ja=Math.PI/180;function Ma(e){let t=e.length-1;if(t<=2)return 0;let n=0,r=0;for(;r<t;){let i=e[r],a=e[r+1===t?0:r+1],o=e[r+2>=t?(r+2)%t:r+2],s=i[0]*ja,c=a[1]*ja,l=o[0]*ja;n+=(l-s)*Math.sin(c),r++}return n*Aa}function Na(e){return e}function Pa(e){if(e==null)return Na;var t,n,r=e.scale[0],i=e.scale[1],a=e.translate[0],o=e.translate[1];return function(e,s){s||(t=n=0);var c=2,l=e.length,u=Array(l);for(u[0]=(t+=e[0])*r+a,u[1]=(n+=e[1])*i+o;c<l;)u[c]=e[c],++c;return u}}function Fa(e,t){for(var n,r=e.length,i=r-t;i<--r;)n=e[i],e[i++]=e[r],e[r]=n}function Ia(e,t){return typeof t==`string`&&(t=e.objects[t]),t.type===`GeometryCollection`?{type:`FeatureCollection`,features:t.geometries.map(function(t){return La(e,t)})}:La(e,t)}function La(e,t){var n=t.id,r=t.bbox,i=t.properties==null?{}:t.properties,a=Ra(e,t);return n==null&&r==null?{type:`Feature`,properties:i,geometry:a}:r==null?{type:`Feature`,id:n,properties:i,geometry:a}:{type:`Feature`,id:n,bbox:r,properties:i,geometry:a}}function Ra(e,t){var n=Pa(e.transform),r=e.arcs;function i(e,t){t.length&&t.pop();for(var i=r[e<0?~e:e],a=0,o=i.length;a<o;++a)t.push(n(i[a],a));e<0&&Fa(t,o)}function a(e){return n(e)}function o(e){for(var t=[],n=0,r=e.length;n<r;++n)i(e[n],t);return t.length<2&&t.push(t[0]),t}function s(e){for(var t=o(e);t.length<4;)t.push(t[0]);return t}function c(e){return e.map(s)}function l(e){var t=e.type,n;switch(t){case`GeometryCollection`:return{type:t,geometries:e.geometries.map(l)};case`Point`:n=a(e.coordinates);break;case`MultiPoint`:n=e.coordinates.map(a);break;case`LineString`:n=o(e.arcs);break;case`MultiLineString`:n=e.arcs.map(o);break;case`Polygon`:n=c(e.arcs);break;case`MultiPolygon`:n=e.arcs.map(c);break;default:return null}return{type:t,coordinates:n}}return l(t)}var za=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ba=Math.ceil,Va=Math.floor,H=`[BigNumber Error] `,Ha=H+`Number primitive has more than 15 significant digits: `,Ua=0x5af3107a4000,U=14,Wa=9007199254740991,Ga=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],Ka=1e7,W=1e9;function qa(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!za.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(G(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(Ha+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>Wa||e!==Va(e)))throw Error(Ha+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%U,l<0&&(f+=U),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=U;f<m;)y.c.push(+h.slice(f,f+=U));f=U-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=qa,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null)if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],G(n,0,W,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],G(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(G(n[0],-W,0,t),G(n[1],0,W,t),c=n[0],l=n[1]):(G(n,-W,W,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`))if(n=e[t],n&&n.pop)G(n[0],-W,-1,t),G(n[1],1,W,t),u=n[0],d=n[1];else if(G(n,-W,W,t),n)u=-(d=n<0?-n:n);else throw Error(H+t+` cannot be zero: `+n);if(e.hasOwnProperty(t=`CRYPTO`))if(n=e[t],n===!!n)if(n)if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(H+`crypto unavailable`);else f=n;else throw Error(H+t+` not true or false: `+n);if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],G(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],G(n,0,W,t),m=n),e.hasOwnProperty(t=`FORMAT`))if(n=e[t],typeof n==`object`)h=n;else throw Error(H+t+` not an object: `+n);if(e.hasOwnProperty(t=`ALPHABET`))if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(H+t+` invalid: `+n)}else throw Error(H+`Object expected: `+e);return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-W&&i<=W&&i===Va(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%U,t<1&&(t+=U),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=Ua||n!==Va(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(H+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return Va(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:G(e,0,W),s=Ba(e/U),f)if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(H+`crypto unavailable`);if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=U,s&&e&&(c=Ga[U-e],u[l]=Va(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=U);for(l=1,c=u[0];c>=10;c/=10,l++);l<U&&(i-=U-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n($a(Ya(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?$a(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=$a(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%Ka,u=t/Ka|0;for(e=e.slice();c--;)a=e[c]%Ka,o=e[c]/Ka|0,r=u*a+o*l,i=l*a+r%Ka*Ka+s,s=(i/n|0)+(r/Ka|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=e[n]<t[n]?1:0,e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,w,T,E,D=r.s==i.s?1:-1,O=r.c,k=i.c;if(!O||!O[0]||!k||!k[0])return new v(!r.s||!i.s||(O?k&&O[0]==k[0]:!k)?NaN:O&&O[0]==0||!k?D*0:D/0);for(h=new v(D),g=h.c=[],l=r.e-i.e,D=a+l+1,s||(s=Ua,l=Ja(r.e/U)-Ja(i.e/U),D=D/U|0),u=0;k[u]==(O[u]||0);u++);if(k[u]>(O[u]||0)&&l--,D<0)g.push(1),d=!0;else{for(C=O.length,T=k.length,u=0,D+=2,f=Va(s/(k[0]+1)),f>1&&(k=e(k,f,s),O=e(O,f,s),T=k.length,C=O.length),x=T,_=O.slice(0,T),y=_.length;y<T;_[y++]=0);E=k.slice(),E=[0].concat(E),w=k[0],k[1]>=s/2&&w++;do{if(f=0,c=t(k,_,T,y),c<0){if(b=_[0],T!=y&&(b=b*s+(_[1]||0)),f=Va(b/w),f>1)for(f>=s&&(f=s-1),p=e(k,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,T<m?E:k,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=k.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(k,_,T,y)<1;)f++,n(_,T<y?E:k,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=O[x]||0:(_=[O[x]],y=1)}while((x++<C||_[0]!=null)&&D--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==Ua){for(u=1,D=g[0];D>=10;D/=10,u++);S(h,a+(h.e=u+l*U-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:G(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=Ya(e.c),d=r==1||r==2&&(o<=c||o>=l)?Qa(d,o):$a(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=Ya(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=Qa(d,a)}else if(t-=o+(r===2&&a>o),d=$a(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=Xa(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*U-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(H+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=Ga;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=U,o=t,c=p[l=0],f=Va(c/m[i-o-1]%10);else if(l=Ba((a+1)/U),l>=p.length)if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=U,o=a-U+1}else break out;else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=U,o=a-U+i,f=o<0?0:Va(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(U-t%U)%U],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[U-a],p[l]=o>0?Va(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==Ua&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=Ua)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=Ya(e.c),t=n<=c||n>=l?Qa(t,n):$a(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return Xa(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return G(e,0,W),t==null?t=s:G(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-Ja(this.e/U))*U,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(H+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-Za(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&Za(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=Ba(m/U+2));for(l?(n=new v(.5),u&&(e.s=1),d=Za(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=Va(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=Za(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:G(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return Xa(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return Xa(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=Xa(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&Ja(this.e/U)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return Xa(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=Xa(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/U,u=e.e/U,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=Ja(l),u=Ja(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=Ua-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=Ua}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=Ja(_.e/U)+Ja(e.e/U),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=Ua,g=Ka,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/U,o=e.e/U,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=Ja(a),o=Ja(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/Ua|0,s[t]=Ua===s[t]?0:s[t]%Ua;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return G(e,1,W),t==null?t=s:G(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*U+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return G(e,-Wa,Wa),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=Ya(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=Ja((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),Ya(a.c).slice(0,u)===(n=Ya(r.c)).slice(0,u))if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(G(e,0,W),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(G(e,0,W),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(H+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(H+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=Ya(y),c=n.e=g.length-_.e-1,n.c[0]=Ga[(l=c%U)<0?U+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&G(e,1,W),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?Qa(Ya(r.c),a):$a(Ya(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=$a(Ya(r.c),r.e,`0`)):(G(e,2,g.length,`Base`),t=n($a(Ya(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function Ja(e){var t=e|0;return e>0||e===t?t:t-1}function Ya(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=U-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function Xa(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function G(e,t,n,r){if(e<t||e>n||e!==Va(e))throw Error(H+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function Za(e){var t=e.c.length-1;return Ja(e.e/U)==t&&e.c[t]%2!=0}function Qa(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function $a(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var eo=qa(),to=class{key;left=null;right=null;constructor(e){this.key=e}},no=class extends to{constructor(e){super(e)}},ro=class{size=0;modificationCount=0;splayCount=0;splay(e){let t=this.root;if(t==null)return this.compare(e,e),-1;let n=null,r=null,i=null,a=null,o=t,s=this.compare,c;for(;;)if(c=s(o.key,e),c>0){let t=o.left;if(t==null||(c=s(t.key,e),c>0&&(o.left=t.right,t.right=o,o=t,t=o.left,t==null)))break;n==null?r=o:n.left=o,n=o,o=t}else if(c<0){let t=o.right;if(t==null||(c=s(t.key,e),c<0&&(o.right=t.left,t.left=o,o=t,t=o.right,t==null)))break;i==null?a=o:i.right=o,i=o,o=t}else break;return i!=null&&(i.right=o.left,o.left=a),n!=null&&(n.left=o.right,o.right=r),this.root!==o&&(this.root=o,this.splayCount++),c}splayMin(e){let t=e,n=t.left;for(;n!=null;){let e=n;t.left=e.right,e.right=t,t=e,n=t.left}return t}splayMax(e){let t=e,n=t.right;for(;n!=null;){let e=n;t.right=e.left,e.left=t,t=e,n=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let t=this.root,n=t,r=t.left;if(this.size--,r==null)this.root=t.right;else{let e=t.right;t=this.splayMax(r),t.right=e,this.root=t}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;let n=this.root;if(n==null){this.root=e;return}t<0?(e.left=n,e.right=n.right,n.right=null):(e.right=n,e.left=n.left,n.left=null),this.root=e}_first(){let e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){let e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},io=class e extends ro{root=null;compare;validKey;constructor(e,t){super(),this.compare=e??this.defaultCompare(),this.validKey=t??(e=>e!=null&&e!=null)}delete(e){return this.validKey(e)?this._delete(e)!=null:!1}deleteAll(e){for(let t of e)this.delete(t)}forEach(e){let t=this[Symbol.iterator](),n;for(;n=t.next(),!n.done;)e(n.value,n.value,this)}add(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new no(e),t),this}addAndReturn(e){let t=this.splay(e);return t!=0&&this.addNewRoot(new no(e),t),this.root.key}addAll(e){for(let t of e)this.add(t)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw`Bad state: No element`;if(this.size>1)throw`Bad state: Too many element`;return this.root.key}first(){if(this.size==0)throw`Bad state: No element`;return this._first().key}last(){if(this.size==0)throw`Bad state: No element`;return this._last().key}lastBefore(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)<0)return this.root.key;let t=this.root.left;if(t==null)return null;let n=t.right;for(;n!=null;)t=n,n=t.right;return t.key}firstAfter(e){if(e==null)throw`Invalid arguments(s)`;if(this.root==null)return null;if(this.splay(e)>0)return this.root.key;let t=this.root.right;if(t==null)return null;let n=t.left;for(;n!=null;)t=n,n=t.left;return t.key}retainAll(t){let n=new e(this.compare,this.validKey),r=this.modificationCount;for(let e of t){if(r!=this.modificationCount)throw`Concurrent modification during iteration.`;this.validKey(e)&&this.splay(e)==0&&n.add(this.root.key)}n.size!=this.size&&(this.root=n.root,this.size=n.size,this.modificationCount++)}lookup(e){return!this.validKey(e)||this.splay(e)!=0?null:this.root.key}intersection(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)&&n.add(e);return n}difference(t){let n=new e(this.compare,this.validKey);for(let e of this)t.has(e)||n.add(e);return n}union(e){let t=this.clone();return t.addAll(e),t}clone(){let t=new e(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(e){if(e==null)return null;function t(e,n){let r,i;do{if(r=e.left,i=e.right,r!=null){let e=new no(r.key);n.left=e,t(r,e)}if(i!=null){let t=new no(i.key);n.right=t,e=i,n=t}}while(i!=null)}let n=new no(e.key);return t(e,n),n}toSet(){return this.clone()}entries(){return new so(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[Symbol.iterator](){return new oo(this.wrap())}[Symbol.toStringTag]=`[object Set]`},ao=class{tree;path=[];modificationCount=null;splayCount;constructor(e){this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;let e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let e=this.tree.getRoot();for(;e!=null;)this.path.push(e),e=e.left;return this.path.length>0}throw`Concurrent modification during iteration.`}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},oo=class extends ao{getValue(e){return e.key}},so=class extends ao{getValue(e){return[e.key,e.key]}},co=e=>()=>e,lo=e=>{let t=e?(t,n)=>n.minus(t).abs().isLessThanOrEqualTo(e):co(!1);return(e,n)=>t(e,n)?0:e.comparedTo(n)};function uo(e){let t=e?(t,n,r,i,a)=>t.exponentiatedBy(2).isLessThanOrEqualTo(i.minus(n).exponentiatedBy(2).plus(a.minus(r).exponentiatedBy(2)).times(e)):co(!1);return(e,n,r)=>{let i=e.x,a=e.y,o=r.x,s=r.y,c=a.minus(s).times(n.x.minus(o)).minus(i.minus(o).times(n.y.minus(s)));return t(c,i,a,o,s)?0:c.comparedTo(0)}}var fo=e=>e,po=e=>{if(e){let t=new io(lo(e)),n=new io(lo(e)),r=(e,t)=>t.addAndReturn(e),i=e=>({x:r(e.x,t),y:r(e.y,n)});return i({x:new eo(0),y:new eo(0)}),i}return fo},mo=e=>({set:e=>{ho=mo(e)},reset:()=>mo(e),compare:lo(e),snap:po(e),orient:uo(e)}),ho=mo(),go=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),_o=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;let n=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,r=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,i=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,a=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:n,y:i},ur:{x:r,y:a}}},vo=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),yo=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),bo=e=>yo(e,e).sqrt(),xo=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return vo(i,r).div(bo(i)).div(bo(r))},So=(e,t,n)=>{let r={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:n.x.minus(e.x),y:n.y.minus(e.y)};return yo(i,r).div(bo(i)).div(bo(r))},Co=(e,t,n)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(n.minus(e.y))),y:n},wo=(e,t,n)=>t.x.isZero()?null:{x:n,y:e.y.plus(t.y.div(t.x).times(n.minus(e.x)))},To=(e,t,n,r)=>{if(t.x.isZero())return wo(n,r,e.x);if(r.x.isZero())return wo(e,t,n.x);if(t.y.isZero())return Co(n,r,e.y);if(r.y.isZero())return Co(e,t,n.y);let i=vo(t,r);if(i.isZero())return null;let a={x:n.x.minus(e.x),y:n.y.minus(e.y)},o=vo(a,t).div(i),s=vo(a,r).div(i),c=e.x.plus(s.times(t.x)),l=n.x.plus(o.times(r.x)),u=e.y.plus(s.times(t.y)),d=n.y.plus(o.times(r.y));return{x:c.plus(l).div(2),y:u.plus(d).div(2)}},Eo=class e{point;isLeft;segment;otherSE;consumedBy;static compare(t,n){let r=e.comparePoints(t.point,n.point);return r===0?(t.point!==n.point&&t.link(n),t.isLeft===n.isLeft?Po.compare(t.segment,n.segment):t.isLeft?1:-1):r}static comparePoints(e,t){return e.x.isLessThan(t.x)?-1:e.x.isGreaterThan(t.x)?1:e.y.isLessThan(t.y)?-1:e.y.isGreaterThan(t.y)?1:0}constructor(e,t){e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=t}link(e){if(e.point===this.point)throw Error(`Tried to link already linked events`);let t=e.point.events;for(let e=0,n=t.length;e<n;e++){let n=t[e];this.point.events.push(n),n.point=this.point}this.checkForConsuming()}checkForConsuming(){let e=this.point.events.length;for(let t=0;t<e;t++){let n=this.point.events[t];if(n.segment.consumedBy===void 0)for(let r=t+1;r<e;r++){let e=this.point.events[r];e.consumedBy===void 0&&n.otherSE.point.events===e.otherSE.point.events&&n.segment.consume(e.segment)}}}getAvailableLinkedEvents(){let e=[];for(let t=0,n=this.point.events.length;t<n;t++){let n=this.point.events[t];n!==this&&!n.segment.ringOut&&n.segment.isInResult()&&e.push(n)}return e}getLeftmostComparator(e){let t=new Map,n=n=>{let r=n.otherSE;t.set(n,{sine:xo(this.point,e.point,r.point),cosine:So(this.point,e.point,r.point)})};return(e,r)=>{t.has(e)||n(e),t.has(r)||n(r);let{sine:i,cosine:a}=t.get(e),{sine:o,cosine:s}=t.get(r);return i.isGreaterThanOrEqualTo(0)&&o.isGreaterThanOrEqualTo(0)?a.isLessThan(s)?1:a.isGreaterThan(s)?-1:0:i.isLessThan(0)&&o.isLessThan(0)?a.isLessThan(s)?-1:a.isGreaterThan(s)?1:0:o.isLessThan(i)?-1:o.isGreaterThan(i)?1:0}}},Do=class e{events;poly;_isExteriorRing;_enclosingRing;static factory(t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];if(!i.isInResult()||i.ringOut)continue;let a=null,o=i.leftSE,s=i.rightSE,c=[o],l=o.point,u=[];for(;a=o,o=s,c.push(o),o.point!==l;)for(;;){let t=o.getAvailableLinkedEvents();if(t.length===0){let e=c[0].point,t=c[c.length-1].point;throw Error(`Unable to complete output ring starting at [${e.x}, ${e.y}]. Last matching segment found ends at [${t.x}, ${t.y}].`)}if(t.length===1){s=t[0].otherSE;break}let r=null;for(let e=0,t=u.length;e<t;e++)if(u[e].point===o.point){r=e;break}if(r!==null){let t=u.splice(r)[0],i=c.splice(t.index);i.unshift(i[0].otherSE),n.push(new e(i.reverse()));continue}u.push({index:c.length,point:o.point});let i=o.getLeftmostComparator(a);s=t.sort(i)[0].otherSE;break}n.push(new e(c))}return n}constructor(e){this.events=e;for(let t=0,n=e.length;t<n;t++)e[t].segment.ringOut=this;this.poly=null}getGeom(){let e=this.events[0].point,t=[e];for(let n=1,r=this.events.length-1;n<r;n++){let r=this.events[n].point,i=this.events[n+1].point;ho.orient(r,e,i)!==0&&(t.push(r),e=r)}if(t.length===1)return null;let n=t[0],r=t[1];ho.orient(n,e,r)===0&&t.shift(),t.push(t[0]);let i=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:t.length-1,o=this.isExteriorRing()?t.length:-1,s=[];for(let e=a;e!=o;e+=i)s.push([t[e].x.toNumber(),t[e].y.toNumber()]);return s}isExteriorRing(){if(this._isExteriorRing===void 0){let e=this.enclosingRing();this._isExteriorRing=e?!e.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let e=this.events[0];for(let t=1,n=this.events.length;t<n;t++){let n=this.events[t];Eo.compare(e,n)>0&&(e=n)}let t=e.segment.prevInResult(),n=t?t.prevInResult():null;for(;;){if(!t)return null;if(!n)return t.ringOut;if(n.ringOut!==t.ringOut)return n.ringOut?.enclosingRing()===t.ringOut?t.ringOut?.enclosingRing():t.ringOut;t=n.prevInResult(),n=t?t.prevInResult():null}}},Oo=class{exteriorRing;interiorRings;constructor(e){this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=this.exteriorRing.getGeom();if(e===null)return null;let t=[e];for(let e=0,n=this.interiorRings.length;e<n;e++){let n=this.interiorRings[e].getGeom();n!==null&&t.push(n)}return t}},ko=class{rings;polys;constructor(e){this.rings=e,this.polys=this._composePolys(e)}getGeom(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getGeom();n!==null&&e.push(n)}return e}_composePolys(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(!r.poly)if(r.isExteriorRing())t.push(new Oo(r));else{let e=r.enclosingRing();e?.poly||t.push(new Oo(e)),e?.poly?.addInterior(r)}}return t}},Ao=class{queue;tree;segments;constructor(e,t=Po.compare){this.queue=e,this.tree=new io(t),this.segments=[]}process(e){let t=e.segment,n=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),n;e.isLeft&&this.tree.add(t);let r=t,i=t;do r=this.tree.lastBefore(r);while(r!=null&&r.consumedBy!=null);do i=this.tree.firstAfter(i);while(i!=null&&i.consumedBy!=null);if(e.isLeft){let a=null;if(r){let e=r.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(a=e),!r.isAnEndpoint(e))){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}let o=null;if(i){let e=i.getIntersection(t);if(e!==null&&(t.isAnEndpoint(e)||(o=e),!i.isAnEndpoint(e))){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}if(a!==null||o!==null){let e=null;e=a===null?o:o===null||Eo.comparePoints(a,o)<=0?a:o,this.queue.delete(t.rightSE),n.push(t.rightSE);let r=t.split(e);for(let e=0,t=r.length;e<t;e++)n.push(r[e])}n.length>0?(this.tree.delete(t),n.push(e)):(this.segments.push(t),t.prev=r)}else{if(r&&i){let e=r.getIntersection(i);if(e!==null){if(!r.isAnEndpoint(e)){let t=this._splitSafely(r,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}if(!i.isAnEndpoint(e)){let t=this._splitSafely(i,e);for(let e=0,r=t.length;e<r;e++)n.push(t[e])}}}this.tree.delete(t)}return n}_splitSafely(e,t){this.tree.delete(e);let n=e.rightSE;this.queue.delete(n);let r=e.split(t);return r.push(n),e.consumedBy===void 0&&this.tree.add(e),r}},jo=new class{type;numMultiPolys;run(e,t,n){jo.type=e;let r=[new Lo(t,!0)];for(let e=0,t=n.length;e<t;e++)r.push(new Lo(n[e],!1));if(jo.numMultiPolys=r.length,jo.type===`difference`){let e=r[0],t=1;for(;t<r.length;)_o(r[t].bbox,e.bbox)===null?r.splice(t,1):t++}if(jo.type===`intersection`)for(let e=0,t=r.length;e<t;e++){let t=r[e];for(let n=e+1,i=r.length;n<i;n++)if(_o(t.bbox,r[n].bbox)===null)return[]}let i=new io(Eo.compare);for(let e=0,t=r.length;e<t;e++){let t=r[e].getSweepEvents();for(let e=0,n=t.length;e<n;e++)i.add(t[e])}let a=new Ao(i),o=null;for(i.size!=0&&(o=i.first(),i.delete(o));o;){let e=a.process(o);for(let t=0,n=e.length;t<n;t++){let n=e[t];n.consumedBy===void 0&&i.add(n)}i.size==0?o=null:(o=i.first(),i.delete(o))}return ho.reset(),new ko(Do.factory(a.segments)).getGeom()}},Mo=jo,No=0,Po=class e{id;leftSE;rightSE;rings;windings;ringOut;consumedBy;prev;_prevInResult;_beforeState;_afterState;_isInResult;static compare(e,t){let n=e.leftSE.point.x,r=t.leftSE.point.x,i=e.rightSE.point.x,a=t.rightSE.point.x;if(a.isLessThan(n))return 1;if(i.isLessThan(r))return-1;let o=e.leftSE.point.y,s=t.leftSE.point.y,c=e.rightSE.point.y,l=t.rightSE.point.y;if(n.isLessThan(r)){if(s.isLessThan(o)&&s.isLessThan(c))return 1;if(s.isGreaterThan(o)&&s.isGreaterThan(c))return-1;let n=e.comparePoint(t.leftSE.point);if(n<0)return 1;if(n>0)return-1;let r=t.comparePoint(e.rightSE.point);return r===0?-1:r}if(n.isGreaterThan(r)){if(o.isLessThan(s)&&o.isLessThan(l))return-1;if(o.isGreaterThan(s)&&o.isGreaterThan(l))return 1;let n=t.comparePoint(e.leftSE.point);if(n!==0)return n;let r=e.comparePoint(t.rightSE.point);return r<0?1:r>0?-1:1}if(o.isLessThan(s))return-1;if(o.isGreaterThan(s))return 1;if(i.isLessThan(a)){let n=t.comparePoint(e.rightSE.point);if(n!==0)return n}if(i.isGreaterThan(a)){let n=e.comparePoint(t.rightSE.point);if(n<0)return 1;if(n>0)return-1}if(!i.eq(a)){let e=c.minus(o),t=i.minus(n),u=l.minus(s),d=a.minus(r);if(e.isGreaterThan(t)&&u.isLessThan(d))return 1;if(e.isLessThan(t)&&u.isGreaterThan(d))return-1}return i.isGreaterThan(a)?1:i.isLessThan(a)||c.isLessThan(l)?-1:c.isGreaterThan(l)?1:e.id<t.id?-1:e.id>t.id?1:0}constructor(e,t,n,r){this.id=++No,this.leftSE=e,e.segment=this,e.otherSE=t,this.rightSE=t,t.segment=this,t.otherSE=e,this.rings=n,this.windings=r}static fromRing(t,n,r){let i,a,o,s=Eo.comparePoints(t,n);if(s<0)i=t,a=n,o=1;else if(s>0)i=n,a=t,o=-1;else throw Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);return new e(new Eo(i,!0),new Eo(a,!1),[r],[o])}replaceRightSE(e){this.rightSE=e,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let e=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:e.isLessThan(t)?e:t},ur:{x:this.rightSE.point.x,y:e.isGreaterThan(t)?e:t}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(e){return e.x.eq(this.leftSE.point.x)&&e.y.eq(this.leftSE.point.y)||e.x.eq(this.rightSE.point.x)&&e.y.eq(this.rightSE.point.y)}comparePoint(e){return ho.orient(this.leftSE.point,e,this.rightSE.point)}getIntersection(e){let t=this.bbox(),n=e.bbox(),r=_o(t,n);if(r===null)return null;let i=this.leftSE.point,a=this.rightSE.point,o=e.leftSE.point,s=e.rightSE.point,c=go(t,o)&&this.comparePoint(o)===0,l=go(n,i)&&e.comparePoint(i)===0,u=go(t,s)&&this.comparePoint(s)===0,d=go(n,a)&&e.comparePoint(a)===0;if(l&&c)return d&&!u?a:!d&&u?s:null;if(l)return u&&i.x.eq(s.x)&&i.y.eq(s.y)?null:i;if(c)return d&&a.x.eq(o.x)&&a.y.eq(o.y)?null:o;if(d&&u)return null;if(d)return a;if(u)return s;let f=To(i,this.vector(),o,e.vector());return f===null||!go(r,f)?null:ho.snap(f)}split(t){let n=[],r=t.events!==void 0,i=new Eo(t,!0),a=new Eo(t,!1),o=this.rightSE;this.replaceRightSE(a),n.push(a),n.push(i);let s=new e(i,o,this.rings.slice(),this.windings.slice());return Eo.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),Eo.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),r&&(i.checkForConsuming(),a.checkForConsuming()),n}swapEvents(){let e=this.rightSE;this.rightSE=this.leftSE,this.leftSE=e,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let e=0,t=this.windings.length;e<t;e++)this.windings[e]*=-1}consume(t){let n=this,r=t;for(;n.consumedBy;)n=n.consumedBy;for(;r.consumedBy;)r=r.consumedBy;let i=e.compare(n,r);if(i!==0){if(i>0){let e=n;n=r,r=e}if(n.prev===r){let e=n;n=r,r=e}for(let e=0,t=r.rings.length;e<t;e++){let t=r.rings[e],i=r.windings[e],a=n.rings.indexOf(t);a===-1?(n.rings.push(t),n.windings.push(i)):n.windings[a]+=i}r.rings=null,r.windings=null,r.consumedBy=n,r.leftSE.consumedBy=n.leftSE,r.rightSE.consumedBy=n.rightSE}}prevInResult(){return this._prevInResult===void 0&&(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null),this._prevInResult}beforeState(){return this._beforeState===void 0&&(this.prev?this._beforeState=(this.prev.consumedBy||this.prev).afterState():this._beforeState={rings:[],windings:[],multiPolys:[]}),this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let e=this.beforeState();this._afterState={rings:e.rings.slice(0),windings:e.windings.slice(0),multiPolys:[]};let t=this._afterState.rings,n=this._afterState.windings,r=this._afterState.multiPolys;for(let e=0,r=this.rings.length;e<r;e++){let r=this.rings[e],i=this.windings[e],a=t.indexOf(r);a===-1?(t.push(r),n.push(i)):n[a]+=i}let i=[],a=[];for(let e=0,r=t.length;e<r;e++){if(n[e]===0)continue;let r=t[e],o=r.poly;if(a.indexOf(o)===-1)if(r.isExterior)i.push(o);else{a.indexOf(o)===-1&&a.push(o);let e=i.indexOf(r.poly);e!==-1&&i.splice(e,1)}}for(let e=0,t=i.length;e<t;e++){let t=i[e].multiPoly;r.indexOf(t)===-1&&r.push(t)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let e=this.beforeState().multiPolys,t=this.afterState().multiPolys;switch(Mo.type){case`union`:this._isInResult=e.length===0!=(t.length===0);break;case`intersection`:{let n,r;e.length<t.length?(n=e.length,r=t.length):(n=t.length,r=e.length),this._isInResult=r===Mo.numMultiPolys&&n<r;break}case`xor`:this._isInResult=Math.abs(e.length-t.length)%2==1;break;case`difference`:{let n=e=>e.length===1&&e[0].isSubject;this._isInResult=n(e)!==n(t);break}}return this._isInResult}},Fo=class{poly;isExterior;segments;bbox;constructor(e,t,n){if(!Array.isArray(e)||e.length===0||(this.poly=t,this.isExterior=n,this.segments=[],typeof e[0][0]!=`number`||typeof e[0][1]!=`number`))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let r=ho.snap({x:new eo(e[0][0]),y:new eo(e[0][1])});this.bbox={ll:{x:r.x,y:r.y},ur:{x:r.x,y:r.y}};let i=r;for(let t=1,n=e.length;t<n;t++){if(typeof e[t][0]!=`number`||typeof e[t][1]!=`number`)throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);let n=ho.snap({x:new eo(e[t][0]),y:new eo(e[t][1])});n.x.eq(i.x)&&n.y.eq(i.y)||(this.segments.push(Po.fromRing(i,n,this)),n.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.x),n.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.y),n.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.x),n.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.y),i=n)}(!r.x.eq(i.x)||!r.y.eq(i.y))&&this.segments.push(Po.fromRing(i,r,this))}getSweepEvents(){let e=[];for(let t=0,n=this.segments.length;t<n;t++){let n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},Io=class{multiPoly;exteriorRing;interiorRings;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);this.exteriorRing=new Fo(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let t=1,n=e.length;t<n;t++){let n=new Fo(e[t],this,!1);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.interiorRings.push(n)}this.multiPoly=t}getSweepEvents(){let e=this.exteriorRing.getSweepEvents();for(let t=0,n=this.interiorRings.length;t<n;t++){let n=this.interiorRings[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Lo=class{isSubject;polys;bbox;constructor(e,t){if(!Array.isArray(e))throw Error(`Input geometry is not a valid Polygon or MultiPolygon`);try{typeof e[0][0][0]==`number`&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new eo(1/0),y:new eo(1/0)},ur:{x:new eo(-1/0),y:new eo(-1/0)}};for(let t=0,n=e.length;t<n;t++){let n=new Io(e[t],this);n.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=n.bbox.ll.x),n.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=n.bbox.ll.y),n.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=n.bbox.ur.x),n.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=n.bbox.ur.y),this.polys.push(n)}this.isSubject=t}getSweepEvents(){let e=[];for(let t=0,n=this.polys.length;t<n;t++){let n=this.polys[t].getSweepEvents();for(let t=0,r=n.length;t<r;t++)e.push(n[t])}return e}},Ro=(e,...t)=>Mo.run(`intersection`,e,t);ho.set;function zo(e,t={}){let n=[];if(sr(e,e=>{n.push(e.coordinates)}),n.length<2)throw Error(`Must specify at least 2 geometries`);let r=Ro(n[0],...n.slice(1));return r.length===0?null:r.length===1?tr(r[0],t.properties):ar(r,t.properties)}var K=1e-6,q=Math.PI,J=q/2,Bo=q/4,Y=q*2,Vo=180/q,X=q/180,Z=Math.abs,Ho=Math.atan,Uo=Math.atan2,Q=Math.cos,Wo=Math.ceil,Go=Math.exp,Ko=Math.log,$=Math.sin,qo=Math.sign||function(e){return e>0?1:e<0?-1:0},Jo=Math.sqrt,Yo=Math.tan;function Xo(e){return e>1?0:e<-1?q:Math.acos(e)}function Zo(e){return e>1?J:e<-1?-J:Math.asin(e)}function Qo(){}function $o(e,t){e&&ts.hasOwnProperty(e.type)&&ts[e.type](e,t)}var es={Feature:function(e,t){$o(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,i=n.length;++r<i;)$o(n[r].geometry,t)}},ts={Sphere:function(e,t){t.sphere()},Point:function(e,t){e=e.coordinates,t.point(e[0],e[1],e[2])},MultiPoint:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)e=n[r],t.point(e[0],e[1],e[2])},LineString:function(e,t){ns(e.coordinates,t,0)},MultiLineString:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)ns(n[r],t,0)},Polygon:function(e,t){rs(e.coordinates,t)},MultiPolygon:function(e,t){for(var n=e.coordinates,r=-1,i=n.length;++r<i;)rs(n[r],t)},GeometryCollection:function(e,t){for(var n=e.geometries,r=-1,i=n.length;++r<i;)$o(n[r],t)}};function ns(e,t,n){var r=-1,i=e.length-n,a;for(t.lineStart();++r<i;)a=e[r],t.point(a[0],a[1],a[2]);t.lineEnd()}function rs(e,t){var n=-1,r=e.length;for(t.polygonStart();++n<r;)ns(e[n],t,1);t.polygonEnd()}function is(e,t){e&&es.hasOwnProperty(e.type)?es[e.type](e,t):$o(e,t)}function as(e){return[Uo(e[1],e[0]),Zo(e[2])]}function os(e){var t=e[0],n=e[1],r=Q(n);return[r*Q(t),r*$(t),$(n)]}function ss(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function cs(e,t){return[e[1]*t[2]-e[2]*t[1],e[2]*t[0]-e[0]*t[2],e[0]*t[1]-e[1]*t[0]]}function ls(e,t){e[0]+=t[0],e[1]+=t[1],e[2]+=t[2]}function us(e,t){return[e[0]*t,e[1]*t,e[2]*t]}function ds(e){var t=Jo(e[0]*e[0]+e[1]*e[1]+e[2]*e[2]);e[0]/=t,e[1]/=t,e[2]/=t}function fs(e,t){function n(n,r){return n=e(n,r),t(n[0],n[1])}return e.invert&&t.invert&&(n.invert=function(n,r){return n=t.invert(n,r),n&&e.invert(n[0],n[1])}),n}function ps(e,t){return Z(e)>q&&(e-=Math.round(e/Y)*Y),[e,t]}ps.invert=ps;function ms(e,t,n){return(e%=Y)?t||n?fs(gs(e),_s(t,n)):gs(e):t||n?_s(t,n):ps}function hs(e){return function(t,n){return t+=e,Z(t)>q&&(t-=Math.round(t/Y)*Y),[t,n]}}function gs(e){var t=hs(e);return t.invert=hs(-e),t}function _s(e,t){var n=Q(e),r=$(e),i=Q(t),a=$(t);function o(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*n+s*r;return[Uo(c*i-u*a,s*n-l*r),Zo(u*i+c*a)]}return o.invert=function(e,t){var o=Q(t),s=Q(e)*o,c=$(e)*o,l=$(t),u=l*i-c*a;return[Uo(c*i+l*a,s*n+u*r),Zo(u*n-s*r)]},o}function vs(e){e=ms(e[0]*X,e[1]*X,e.length>2?e[2]*X:0);function t(t){return t=e(t[0]*X,t[1]*X),t[0]*=Vo,t[1]*=Vo,t}return t.invert=function(t){return t=e.invert(t[0]*X,t[1]*X),t[0]*=Vo,t[1]*=Vo,t},t}function ys(e,t,n,r,i,a){if(n){var o=Q(t),s=$(t),c=r*n;i==null?(i=t+r*Y,a=t-c/2):(i=bs(o,i),a=bs(o,a),(r>0?i<a:i>a)&&(i+=r*Y));for(var l,u=i;r>0?u>a:u<a;u-=c)l=as([o,-s*Q(u),-s*$(u)]),e.point(l[0],l[1])}}function bs(e,t){t=os(t),t[0]-=e,ds(t);var n=Xo(-t[1]);return((-t[2]<0?-n:n)+Y-K)%Y}function xs(){var e=[],t;return{point:function(e,n,r){t.push([e,n,r])},lineStart:function(){e.push(t=[])},lineEnd:Qo,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var n=e;return e=[],t=null,n}}}function Ss(e,t){return Z(e[0]-t[0])<1e-6&&Z(e[1]-t[1])<1e-6}function Cs(e,t,n,r){this.x=e,this.z=t,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function ws(e,t,n,r,i){var a=[],o=[],s,c;if(e.forEach(function(e){if(!((t=e.length-1)<=0)){var t,n=e[0],r=e[t],c;if(Ss(n,r)){if(!n[2]&&!r[2]){for(i.lineStart(),s=0;s<t;++s)i.point((n=e[s])[0],n[1]);i.lineEnd();return}r[0]+=2*K}a.push(c=new Cs(n,e,null,!0)),o.push(c.o=new Cs(n,null,c,!1)),a.push(c=new Cs(r,e,null,!1)),o.push(c.o=new Cs(r,null,c,!0))}}),a.length){for(o.sort(t),Ts(a),Ts(o),s=0,c=o.length;s<c;++s)o[s].e=n=!n;for(var l=a[0],u,d;;){for(var f=l,p=!0;f.v;)if((f=f.n)===l)return;u=f.z,i.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,c=u.length;s<c;++s)i.point((d=u[s])[0],d[1]);else r(f.x,f.n.x,1,i);f=f.n}else{if(p)for(u=f.p.z,s=u.length-1;s>=0;--s)i.point((d=u[s])[0],d[1]);else r(f.x,f.p.x,-1,i);f=f.p}f=f.o,u=f.z,p=!p}while(!f.v);i.lineEnd()}}}function Ts(e){if(t=e.length){for(var t,n=0,r=e[0],i;++n<t;)r.n=i=e[n],i.p=r,r=i;r.n=i=e[0],i.p=r}}function Es(e){return Z(e[0])<=q?e[0]:qo(e[0])*((Z(e[0])+q)%Y-q)}function Ds(e,t){var n=Es(t),r=t[1],i=$(r),a=[$(n),-Q(n),0],o=0,s=0,c=new qt;i===1?r=J+K:i===-1&&(r=-J-K);for(var l=0,u=e.length;l<u;++l)if(f=(d=e[l]).length)for(var d,f,p=d[f-1],m=Es(p),h=p[1]/2+Bo,g=$(h),_=Q(h),v=0;v<f;++v,m=b,g=S,_=C,p=y){var y=d[v],b=Es(y),x=y[1]/2+Bo,S=$(x),C=Q(x),w=b-m,T=w>=0?1:-1,E=T*w,D=E>q,O=g*S;if(c.add(Uo(O*T*$(E),_*C+O*Q(E))),o+=D?w+T*Y:w,D^m>=n^b>=n){var k=cs(os(p),os(y));ds(k);var A=cs(a,k);ds(A);var j=(D^w>=0?-1:1)*Zo(A[2]);(r>j||r===j&&(k[0]||k[1]))&&(s+=D^w>=0?1:-1)}}return(o<-1e-6||o<1e-6&&c<-1e-12)^s&1}function Os(e,t,n,r){return function(i){var a=t(i),o=xs(),s=t(o),c=!1,l,u,d,f={point:p,lineStart:h,lineEnd:g,polygonStart:function(){f.point=_,f.lineStart=v,f.lineEnd=y,u=[],l=[]},polygonEnd:function(){f.point=p,f.lineStart=h,f.lineEnd=g,u=ln(u);var e=Ds(l,r);u.length?(c||=(i.polygonStart(),!0),ws(u,As,e,n,i)):e&&(c||=(i.polygonStart(),!0),i.lineStart(),n(null,null,1,i),i.lineEnd()),c&&=(i.polygonEnd(),!1),u=l=null},sphere:function(){i.polygonStart(),i.lineStart(),n(null,null,1,i),i.lineEnd(),i.polygonEnd()}};function p(t,n){e(t,n)&&i.point(t,n)}function m(e,t){a.point(e,t)}function h(){f.point=m,a.lineStart()}function g(){f.point=p,a.lineEnd()}function _(e,t){d.push([e,t]),s.point(e,t)}function v(){s.lineStart(),d=[]}function y(){_(d[0][0],d[0][1]),s.lineEnd();var e=s.clean(),t=o.result(),n,r=t.length,a,f,p;if(d.pop(),l.push(d),d=null,r){if(e&1){if(f=t[0],(a=f.length-1)>0){for(c||=(i.polygonStart(),!0),i.lineStart(),n=0;n<a;++n)i.point((p=f[n])[0],p[1]);i.lineEnd()}return}r>1&&e&2&&t.push(t.pop().concat(t.shift())),u.push(t.filter(ks))}}return f}}function ks(e){return e.length>1}function As(e,t){return((e=e.x)[0]<0?e[1]-J-K:J-e[1])-((t=t.x)[0]<0?t[1]-J-K:J-t[1])}var js=Os(function(){return!0},Ms,Ps,[-q,-J]);function Ms(e){var t=NaN,n=NaN,r=NaN,i;return{lineStart:function(){e.lineStart(),i=1},point:function(a,o){var s=a>0?q:-q,c=Z(a-t);Z(c-q)<1e-6?(e.point(t,n=(n+o)/2>0?J:-J),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),e.point(a,n),i=0):r!==s&&c>=q&&(Z(t-r)<1e-6&&(t-=r*K),Z(a-s)<1e-6&&(a-=s*K),n=Ns(t,n,a,o),e.point(r,n),e.lineEnd(),e.lineStart(),e.point(s,n),i=0),e.point(t=a,n=o),r=s},lineEnd:function(){e.lineEnd(),t=n=NaN},clean:function(){return 2-i}}}function Ns(e,t,n,r){var i,a,o=$(e-n);return Z(o)>1e-6?Ho(($(t)*(a=Q(r))*$(n)-$(r)*(i=Q(t))*$(e))/(i*a*o)):(t+r)/2}function Ps(e,t,n,r){var i;if(e==null)i=n*J,r.point(-q,i),r.point(0,i),r.point(q,i),r.point(q,0),r.point(q,-i),r.point(0,-i),r.point(-q,-i),r.point(-q,0),r.point(-q,i);else if(Z(e[0]-t[0])>1e-6){var a=e[0]<t[0]?q:-q;i=n*a/2,r.point(-a,i),r.point(0,i),r.point(a,i)}else r.point(t[0],t[1])}function Fs(e){var t=Q(e),n=2*X,r=t>0,i=Z(t)>K;function a(t,r,i,a){ys(a,e,n,i,t,r)}function o(e,n){return Q(e)*Q(n)>t}function s(e){var t,n,a,s,u;return{lineStart:function(){s=a=!1,u=1},point:function(d,f){var p=[d,f],m,h=o(d,f),g=r?h?0:l(d,f):h?l(d+(d<0?q:-q),f):0;if(!t&&(s=a=h)&&e.lineStart(),h!==a&&(m=c(t,p),(!m||Ss(t,m)||Ss(p,m))&&(p[2]=1)),h!==a)u=0,h?(e.lineStart(),m=c(p,t),e.point(m[0],m[1])):(m=c(t,p),e.point(m[0],m[1],2),e.lineEnd()),t=m;else if(i&&t&&r^h){var _;!(g&n)&&(_=c(p,t,!0))&&(u=0,r?(e.lineStart(),e.point(_[0][0],_[0][1]),e.point(_[1][0],_[1][1]),e.lineEnd()):(e.point(_[1][0],_[1][1]),e.lineEnd(),e.lineStart(),e.point(_[0][0],_[0][1],3)))}h&&(!t||!Ss(t,p))&&e.point(p[0],p[1]),t=p,a=h,n=g},lineEnd:function(){a&&e.lineEnd(),t=null},clean:function(){return u|(s&&a)<<1}}}function c(e,n,r){var i=os(e),a=os(n),o=[1,0,0],s=cs(i,a),c=ss(s,s),l=s[0],u=c-l*l;if(!u)return!r&&e;var d=t*c/u,f=-t*l/u,p=cs(o,s),m=us(o,d);ls(m,us(s,f));var h=p,g=ss(m,h),_=ss(h,h),v=g*g-_*(ss(m,m)-1);if(!(v<0)){var y=Jo(v),b=us(h,(-g-y)/_);if(ls(b,m),b=as(b),!r)return b;var x=e[0],S=n[0],C=e[1],w=n[1],T;S<x&&(T=x,x=S,S=T);var E=S-x,D=Z(E-q)<K,O=D||E<1e-6;if(!D&&w<C&&(T=C,C=w,w=T),O?D?C+w>0^b[1]<(Z(b[0]-x)<1e-6?C:w):C<=b[1]&&b[1]<=w:E>q^(x<=b[0]&&b[0]<=S)){var k=us(h,(-g+y)/_);return ls(k,m),[b,as(k)]}}}function l(t,n){var i=r?e:q-e,a=0;return t<-i?a|=1:t>i&&(a|=2),n<-i?a|=4:n>i&&(a|=8),a}return Os(o,s,a,r?[0,-e]:[-q,e-q])}function Is(e,t,n,r,i,a){var o=e[0],s=e[1],c=t[0],l=t[1],u=0,d=1,f=c-o,p=l-s,m=n-o;if(!(!f&&m>0)){if(m/=f,f<0){if(m<u)return;m<d&&(d=m)}else if(f>0){if(m>d)return;m>u&&(u=m)}if(m=i-o,!(!f&&m<0)){if(m/=f,f<0){if(m>d)return;m>u&&(u=m)}else if(f>0){if(m<u)return;m<d&&(d=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<u)return;m<d&&(d=m)}else if(p>0){if(m>d)return;m>u&&(u=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>d)return;m>u&&(u=m)}else if(p>0){if(m<u)return;m<d&&(d=m)}return u>0&&(e[0]=o+u*f,e[1]=s+u*p),d<1&&(t[0]=o+d*f,t[1]=s+d*p),!0}}}}}var Ls=1e9,Rs=-Ls;function zs(e,t,n,r){function i(i,a){return e<=i&&i<=n&&t<=a&&a<=r}function a(i,a,s,l){var u=0,d=0;if(i==null||(u=o(i,s))!==(d=o(a,s))||c(i,a)<0^s>0)do l.point(u===0||u===3?e:n,u>1?r:t);while((u=(u+s+4)%4)!==d);else l.point(a[0],a[1])}function o(r,i){return Z(r[0]-e)<1e-6?i>0?0:3:Z(r[0]-n)<1e-6?i>0?2:1:Z(r[1]-t)<1e-6?i>0?1:0:i>0?3:2}function s(e,t){return c(e.x,t.x)}function c(e,t){var n=o(e,1),r=o(t,1);return n===r?n===0?t[1]-e[1]:n===1?e[0]-t[0]:n===2?e[1]-t[1]:t[0]-e[0]:n-r}return function(o){var c=o,l=xs(),u,d,f,p,m,h,g,_,v,y,b,x={point:S,lineStart:E,lineEnd:D,polygonStart:w,polygonEnd:T};function S(e,t){i(e,t)&&c.point(e,t)}function C(){for(var t=0,n=0,i=d.length;n<i;++n)for(var a=d[n],o=1,s=a.length,c=a[0],l,u,f=c[0],p=c[1];o<s;++o)l=f,u=p,c=a[o],f=c[0],p=c[1],u<=r?p>r&&(f-l)*(r-u)>(p-u)*(e-l)&&++t:p<=r&&(f-l)*(r-u)<(p-u)*(e-l)&&--t;return t}function w(){c=l,u=[],d=[],b=!0}function T(){var e=C(),t=b&&e,n=(u=ln(u)).length;(t||n)&&(o.polygonStart(),t&&(o.lineStart(),a(null,null,1,o),o.lineEnd()),n&&ws(u,s,e,a,o),o.polygonEnd()),c=o,u=d=f=null}function E(){x.point=O,d&&d.push(f=[]),y=!0,v=!1,g=_=NaN}function D(){u&&(O(p,m),h&&v&&l.rejoin(),u.push(l.result())),x.point=S,v&&c.lineEnd()}function O(a,o){var s=i(a,o);if(d&&f.push([a,o]),y)p=a,m=o,h=s,y=!1,s&&(c.lineStart(),c.point(a,o));else if(s&&v)c.point(a,o);else{var l=[g=Math.max(Rs,Math.min(Ls,g)),_=Math.max(Rs,Math.min(Ls,_))],u=[a=Math.max(Rs,Math.min(Ls,a)),o=Math.max(Rs,Math.min(Ls,o))];Is(l,u,e,t,n,r)?(v||(c.lineStart(),c.point(l[0],l[1])),c.point(u[0],u[1]),s||c.lineEnd(),b=!1):s&&(c.lineStart(),c.point(a,o),b=!1)}g=a,_=o,v=s}return x}}function Bs(e,t,n){var r=un(e,t-K,n).concat(t);return function(e){return r.map(function(t){return[e,t]})}}function Vs(e,t,n){var r=un(e,t-K,n).concat(t);return function(e){return r.map(function(t){return[t,e]})}}function Hs(){var e,t,n,r,i,a,o,s,c=10,l=c,u=90,d=360,f,p,m,h,g=2.5;function _(){return{type:`MultiLineString`,coordinates:v()}}function v(){return un(Wo(r/u)*u,n,u).map(m).concat(un(Wo(s/d)*d,o,d).map(h)).concat(un(Wo(t/c)*c,e,c).filter(function(e){return Z(e%u)>K}).map(f)).concat(un(Wo(a/l)*l,i,l).filter(function(e){return Z(e%d)>K}).map(p))}return _.lines=function(){return v().map(function(e){return{type:`LineString`,coordinates:e}})},_.outline=function(){return{type:`Polygon`,coordinates:[m(r).concat(h(o).slice(1),m(n).reverse().slice(1),h(s).reverse().slice(1))]}},_.extent=function(e){return arguments.length?_.extentMajor(e).extentMinor(e):_.extentMinor()},_.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],s=+e[0][1],o=+e[1][1],r>n&&(e=r,r=n,n=e),s>o&&(e=s,s=o,o=e),_.precision(g)):[[r,s],[n,o]]},_.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],a=+n[0][1],i=+n[1][1],t>e&&(n=t,t=e,e=n),a>i&&(n=a,a=i,i=n),_.precision(g)):[[t,a],[e,i]]},_.step=function(e){return arguments.length?_.stepMajor(e).stepMinor(e):_.stepMinor()},_.stepMajor=function(e){return arguments.length?(u=+e[0],d=+e[1],_):[u,d]},_.stepMinor=function(e){return arguments.length?(c=+e[0],l=+e[1],_):[c,l]},_.precision=function(c){return arguments.length?(g=+c,f=Bs(a,i,90),p=Vs(t,e,g),m=Bs(s,o,90),h=Vs(r,n,g),_):g},_.extentMajor([[-180,-90+K],[180,90-K]]).extentMinor([[-180,-80-K],[180,80+K]])}var Us=e=>e,Ws=new qt,Gs=new qt,Ks,qs,Js,Ys,Xs={point:Qo,lineStart:Qo,lineEnd:Qo,polygonStart:function(){Xs.lineStart=Zs,Xs.lineEnd=ec},polygonEnd:function(){Xs.lineStart=Xs.lineEnd=Xs.point=Qo,Ws.add(Z(Gs)),Gs=new qt},result:function(){var e=Ws/2;return Ws=new qt,e}};function Zs(){Xs.point=Qs}function Qs(e,t){Xs.point=$s,Ks=Js=e,qs=Ys=t}function $s(e,t){Gs.add(Ys*e-Js*t),Js=e,Ys=t}function ec(){$s(Ks,qs)}var tc=1/0,nc=tc,rc=-tc,ic=rc,ac={point:oc,lineStart:Qo,lineEnd:Qo,polygonStart:Qo,polygonEnd:Qo,result:function(){var e=[[tc,nc],[rc,ic]];return rc=ic=-(nc=tc=1/0),e}};function oc(e,t){e<tc&&(tc=e),e>rc&&(rc=e),t<nc&&(nc=t),t>ic&&(ic=t)}var sc=0,cc=0,lc=0,uc=0,dc=0,fc=0,pc=0,mc=0,hc=0,gc,_c,vc,yc,bc={point:xc,lineStart:Sc,lineEnd:Tc,polygonStart:function(){bc.lineStart=Ec,bc.lineEnd=Dc},polygonEnd:function(){bc.point=xc,bc.lineStart=Sc,bc.lineEnd=Tc},result:function(){var e=hc?[pc/hc,mc/hc]:fc?[uc/fc,dc/fc]:lc?[sc/lc,cc/lc]:[NaN,NaN];return sc=cc=lc=uc=dc=fc=pc=mc=hc=0,e}};function xc(e,t){sc+=e,cc+=t,++lc}function Sc(){bc.point=Cc}function Cc(e,t){bc.point=wc,xc(vc=e,yc=t)}function wc(e,t){var n=e-vc,r=t-yc,i=Jo(n*n+r*r);uc+=i*(vc+e)/2,dc+=i*(yc+t)/2,fc+=i,xc(vc=e,yc=t)}function Tc(){bc.point=xc}function Ec(){bc.point=Oc}function Dc(){kc(gc,_c)}function Oc(e,t){bc.point=kc,xc(gc=vc=e,_c=yc=t)}function kc(e,t){var n=e-vc,r=t-yc,i=Jo(n*n+r*r);uc+=i*(vc+e)/2,dc+=i*(yc+t)/2,fc+=i,i=yc*e-vc*t,pc+=i*(vc+e),mc+=i*(yc+t),hc+=i*3,xc(vc=e,yc=t)}function Ac(e){this._context=e}Ac.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,Y);break}},result:Qo};var jc=new qt,Mc,Nc,Pc,Fc,Ic,Lc={point:Qo,lineStart:function(){Lc.point=Rc},lineEnd:function(){Mc&&zc(Nc,Pc),Lc.point=Qo},polygonStart:function(){Mc=!0},polygonEnd:function(){Mc=null},result:function(){var e=+jc;return jc=new qt,e}};function Rc(e,t){Lc.point=zc,Nc=Fc=e,Pc=Ic=t}function zc(e,t){Fc-=e,Ic-=t,jc.add(Jo(Fc*Fc+Ic*Ic)),Fc=e,Ic=t}var Bc,Vc,Hc,Uc,Wc=class{constructor(e){this._append=e==null?Gc:Kc(e),this._radius=4.5,this._=``}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+=`Z`),this._point=NaN}point(e,t){switch(this._point){case 0:this._append`M${e},${t}`,this._point=1;break;case 1:this._append`L${e},${t}`;break;default:if(this._append`M${e},${t}`,this._radius!==Hc||this._append!==Vc){let e=this._radius,t=this._;this._=``,this._append`m0,${e}a${e},${e} 0 1,1 0,${-2*e}a${e},${e} 0 1,1 0,${2*e}z`,Hc=e,Vc=this._append,Uc=this._,this._=t}this._+=Uc;break}}result(){let e=this._;return this._=``,e.length?e:null}};function Gc(e){let t=1;this._+=e[0];for(let n=e.length;t<n;++t)this._+=arguments[t]+e[t]}function Kc(e){let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);if(t>15)return Gc;if(t!==Bc){let e=10**t;Bc=t,Vc=function(t){let n=1;this._+=t[0];for(let r=t.length;n<r;++n)this._+=Math.round(arguments[n]*e)/e+t[n]}}return Vc}function qc(e,t){let n=3,r=4.5,i,a;function o(e){return e&&(typeof r==`function`&&a.pointRadius(+r.apply(this,arguments)),is(e,i(a))),a.result()}return o.area=function(e){return is(e,i(Xs)),Xs.result()},o.measure=function(e){return is(e,i(Lc)),Lc.result()},o.bounds=function(e){return is(e,i(ac)),ac.result()},o.centroid=function(e){return is(e,i(bc)),bc.result()},o.projection=function(t){return arguments.length?(i=t==null?(e=null,Us):(e=t).stream,o):e},o.context=function(e){return arguments.length?(a=e==null?(t=null,new Wc(n)):new Ac(t=e),typeof r!=`function`&&a.pointRadius(r),o):t},o.pointRadius=function(e){return arguments.length?(r=typeof e==`function`?e:(a.pointRadius(+e),+e),o):r},o.digits=function(e){if(!arguments.length)return n;if(e==null)n=null;else{let t=Math.floor(e);if(!(t>=0))throw RangeError(`invalid digits: ${e}`);n=t}return t===null&&(a=new Wc(n)),o},o.projection(e).digits(n).context(t)}function Jc(e){return function(t){var n=new Yc;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Yc(){}Yc.prototype={constructor:Yc,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function Xc(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),r!=null&&e.clipExtent(null),is(n,e.stream(ac)),t(ac.result()),r!=null&&e.clipExtent(r),e}function Zc(e,t,n){return Xc(e,function(n){var r=t[1][0]-t[0][0],i=t[1][1]-t[0][1],a=Math.min(r/(n[1][0]-n[0][0]),i/(n[1][1]-n[0][1])),o=+t[0][0]+(r-a*(n[1][0]+n[0][0]))/2,s=+t[0][1]+(i-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([o,s])},n)}function Qc(e,t,n){return Zc(e,[[0,0],t],n)}function $c(e,t,n){return Xc(e,function(n){var r=+t,i=r/(n[1][0]-n[0][0]),a=(r-i*(n[1][0]+n[0][0]))/2,o=-i*n[0][1];e.scale(150*i).translate([a,o])},n)}function el(e,t,n){return Xc(e,function(n){var r=+t,i=r/(n[1][1]-n[0][1]),a=-i*n[0][0],o=(r-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([a,o])},n)}var tl=16,nl=Q(30*X);function rl(e,t){return+t?al(e,t):il(e)}function il(e){return Jc({point:function(t,n){t=e(t,n),this.stream.point(t[0],t[1])}})}function al(e,t){function n(r,i,a,o,s,c,l,u,d,f,p,m,h,g){var _=l-r,v=u-i,y=_*_+v*v;if(y>4*t&&h--){var b=o+f,x=s+p,S=c+m,C=Jo(b*b+x*x+S*S),w=Zo(S/=C),T=Z(Z(S)-1)<1e-6||Z(a-d)<1e-6?(a+d)/2:Uo(x,b),E=e(T,w),D=E[0],O=E[1],k=D-r,A=O-i,j=v*k-_*A;(j*j/y>t||Z((_*k+v*A)/y-.5)>.3||o*f+s*p+c*m<nl)&&(n(r,i,a,o,s,c,D,O,T,b/=C,x/=C,S,h,g),g.point(D,O),n(D,O,T,b,x,S,l,u,d,f,p,m,h,g))}}return function(t){var r,i,a,o,s,c,l,u,d,f,p,m,h={point:g,lineStart:_,lineEnd:y,polygonStart:function(){t.polygonStart(),h.lineStart=b},polygonEnd:function(){t.polygonEnd(),h.lineStart=_}};function g(n,r){n=e(n,r),t.point(n[0],n[1])}function _(){u=NaN,h.point=v,t.lineStart()}function v(r,i){var a=os([r,i]),o=e(r,i);n(u,d,l,f,p,m,u=o[0],d=o[1],l=r,f=a[0],p=a[1],m=a[2],tl,t),t.point(u,d)}function y(){h.point=g,t.lineEnd()}function b(){_(),h.point=x,h.lineEnd=S}function x(e,t){v(r=e,t),i=u,a=d,o=f,s=p,c=m,h.point=v}function S(){n(u,d,l,f,p,m,i,a,r,o,s,c,tl,t),h.lineEnd=y,y()}return h}}var ol=Jc({point:function(e,t){this.stream.point(e*X,t*X)}});function sl(e){return Jc({point:function(t,n){var r=e(t,n);return this.stream.point(r[0],r[1])}})}function cl(e,t,n,r,i){function a(a,o){return a*=r,o*=i,[t+e*a,n-e*o]}return a.invert=function(a,o){return[(a-t)/e*r,(n-o)/e*i]},a}function ll(e,t,n,r,i,a){if(!a)return cl(e,t,n,r,i);var o=Q(a),s=$(a),c=o*e,l=s*e,u=o/e,d=s/e,f=(s*n-o*t)/e,p=(s*t+o*n)/e;function m(e,a){return e*=r,a*=i,[c*e-l*a+t,n-l*e-c*a]}return m.invert=function(e,t){return[r*(u*e-d*t+f),i*(p-d*e-u*t)]},m}function ul(e){return dl(function(){return e})()}function dl(e){var t,n=150,r=480,i=250,a=0,o=0,s=0,c=0,l=0,u,d=0,f=1,p=1,m=null,h=js,g=null,_,v,y,b=Us,x=.5,S,C,w,T,E;function D(e){return w(e[0]*X,e[1]*X)}function O(e){return e=w.invert(e[0],e[1]),e&&[e[0]*Vo,e[1]*Vo]}D.stream=function(e){return T&&E===e?T:T=ol(sl(u)(h(S(b(E=e)))))},D.preclip=function(e){return arguments.length?(h=e,m=void 0,A()):h},D.postclip=function(e){return arguments.length?(b=e,g=_=v=y=null,A()):b},D.clipAngle=function(e){return arguments.length?(h=+e?Fs(m=e*X):(m=null,js),A()):m*Vo},D.clipExtent=function(e){return arguments.length?(b=e==null?(g=_=v=y=null,Us):zs(g=+e[0][0],_=+e[0][1],v=+e[1][0],y=+e[1][1]),A()):g==null?null:[[g,_],[v,y]]},D.scale=function(e){return arguments.length?(n=+e,k()):n},D.translate=function(e){return arguments.length?(r=+e[0],i=+e[1],k()):[r,i]},D.center=function(e){return arguments.length?(a=e[0]%360*X,o=e[1]%360*X,k()):[a*Vo,o*Vo]},D.rotate=function(e){return arguments.length?(s=e[0]%360*X,c=e[1]%360*X,l=e.length>2?e[2]%360*X:0,k()):[s*Vo,c*Vo,l*Vo]},D.angle=function(e){return arguments.length?(d=e%360*X,k()):d*Vo},D.reflectX=function(e){return arguments.length?(f=e?-1:1,k()):f<0},D.reflectY=function(e){return arguments.length?(p=e?-1:1,k()):p<0},D.precision=function(e){return arguments.length?(S=rl(C,x=e*e),A()):Jo(x)},D.fitExtent=function(e,t){return Zc(D,e,t)},D.fitSize=function(e,t){return Qc(D,e,t)},D.fitWidth=function(e,t){return $c(D,e,t)},D.fitHeight=function(e,t){return el(D,e,t)};function k(){var e=ll(n,0,0,f,p,d).apply(null,t(a,o)),m=ll(n,r-e[0],i-e[1],f,p,d);return u=ms(s,c,l),C=fs(t,m),w=fs(u,C),S=rl(C,x),A()}function A(){return T=E=null,D}return function(){return t=e.apply(this,arguments),D.invert=t.invert&&O,k()}}function fl(e){return function(t,n){var r=Jo(t*t+n*n),i=e(r),a=$(i),o=Q(i);return[Uo(t*a,r*o),Zo(r&&n*a/r)]}}function pl(e,t){return[e,Ko(Yo((J+t)/2))]}pl.invert=function(e,t){return[e,2*Ho(Go(t))-J]};function ml(){return hl(pl).scale(961/Y)}function hl(e){var t=ul(e),n=t.center,r=t.scale,i=t.translate,a=t.clipExtent,o=null,s,c,l;t.scale=function(e){return arguments.length?(r(e),u()):r()},t.translate=function(e){return arguments.length?(i(e),u()):i()},t.center=function(e){return arguments.length?(n(e),u()):n()},t.clipExtent=function(e){return arguments.length?(e==null?o=s=c=l=null:(o=+e[0][0],s=+e[0][1],c=+e[1][0],l=+e[1][1]),u()):o==null?null:[[o,s],[c,l]]};function u(){var n=q*r(),i=t(vs(t.rotate()).invert([0,0]));return a(o==null?[[i[0]-n,i[1]-n],[i[0]+n,i[1]+n]]:e===pl?[[Math.max(i[0]-n,o),s],[Math.min(i[0]+n,c),l]]:[[o,Math.max(i[1]-n,s)],[c,Math.min(i[1]+n,l)]])}return u()}function gl(e,t){return[Q(t)*$(e),$(t)]}gl.invert=fl(Zo);function _l(){return ul(gl).scale(249.5).clipAngle(90+K)}var vl=100;function yl(e,t,n,r){let i=document.createElement(`div`);i.className=`adornment`;let a=e.scale??1;i.style.flexGrow=`0`,i.style.flexShrink=`0`;let o={id:e.id,map:t,container:i,moveEndPosition:t.getCenter(),geoJson:void 0,isGlobe:e.isGlobe,boundingBox:e.boundingBox,scale:a,backgroundColor:e.backgroundColor??`#000000`,globeBackgroundColor:e.globeBackgroundColor??`#000000`,borderColor:e.borderColor??`#000000`,primaryFillColor:e.primaryFillColor??`#000000`,primaryStrokeColor:e.primaryStrokeColor??`#000000`,secondaryFillColor:e.secondaryFillColor??`#000000`,secondaryStrokeColor:e.secondaryStrokeColor??`#000000`,graticuleColor:e.graticuleColor??`#000000`,frameColor:e.frameColor??`#000000`,frameOutlineColor:e.frameOutlineColor??`#000000`,dotColor:e.dotColor??`#000000`,dotOutlineColor:e.dotOutlineColor??`#000000`,globeFallbackActive:!1,globeGeoJson:void 0},s=[fetch(`${n}/data/insetmaps/${e.fileName}`).then(e=>e.json()).then(e=>{o.geoJson=Ia(e,Object.keys(e.objects)[0])})];if(!e.isGlobe){let e=fetch(`${n}/data/insetmaps/world-110m.json`).then(e=>e.json()).then(e=>{o.globeGeoJson=Ia(e,Object.keys(e.objects)[0])});s.push(e)}bl(o),r!==`interactive`&&t.on(`resize`,()=>bl(o));let c=Promise.all(s).then(()=>bl(o)).catch(()=>{});return t.on(`moveend`,()=>{o.moveEndPosition=t.getCenter(),(o.isGlobe||o.globeFallbackActive)&&bl(o)}),t.on(`move`,()=>{if(!o.isGlobe){let[e,n,r,i]=o.boundingBox,a=Cl(t),s=zo(rr([a,tr([[[e,n],[e,i],[r,i],[r,n],[e,n]]])])),c=Da(a),l=(s?Da(s):0)<c*.75;o.globeFallbackActive!==l&&(o.globeFallbackActive=l,o.moveEndPosition=t.getCenter(),bl(o))}Sl(o)}),{element:i,ready:c}}function bl(e){let{id:t,map:n,container:r,scale:i,backgroundColor:a,globeBackgroundColor:o,secondaryFillColor:s,secondaryStrokeColor:c,primaryFillColor:l,primaryStrokeColor:u,graticuleColor:d,borderColor:f,frameColor:p,frameOutlineColor:m,dotColor:h,dotOutlineColor:g}=e,_=vl*i,v=n.getScale();r.style.width=`${_*v}px`,r.style.height=`${_*v}px`;let y=e.globeFallbackActive&&e.globeGeoJson!==void 0,b=y?e.globeGeoJson:e.geoJson,x=y||e.isGlobe;if(b===void 0)return;let S=_/2,C=.1*i,w=[x?`<circle cx="${S}" cy="${S}" r="${S}" fill="${o}"></circle>`:`<rect x="0" y="0" width="${_}" height="${_}" fill="${a}"></rect>`],{path:T}=xl(e),E=T({...b,features:b.features.filter(e=>e.properties?.class!==`P1`)});E&&w.push(`
|
|
263
|
+
<path
|
|
264
|
+
d="${E}"
|
|
265
|
+
fill="${s}"
|
|
266
|
+
stroke="${c}"
|
|
267
|
+
stroke-width="${C}"
|
|
268
|
+
></path>
|
|
269
|
+
`);let D=T({...b,features:b.features.filter(e=>e.properties?.class===`P1`)});if(D&&w.push(`
|
|
270
|
+
<path
|
|
271
|
+
d="${D}"
|
|
272
|
+
fill="${l}"
|
|
273
|
+
stroke="${u}"
|
|
274
|
+
stroke-width="${C}"
|
|
275
|
+
></path>
|
|
276
|
+
`),x){let e=T(rr(Hs().step([10,10]).lines().map(e=>nr(e.coordinates))));w.push(`
|
|
277
|
+
<path
|
|
278
|
+
d="${e}"
|
|
279
|
+
fill="none"
|
|
280
|
+
stroke="${d}"
|
|
281
|
+
stroke-width="${C}"
|
|
282
|
+
></path>
|
|
283
|
+
`)}w.push(`
|
|
284
|
+
<path
|
|
285
|
+
id="frame-outline-${t}"
|
|
286
|
+
fill="none"
|
|
287
|
+
stroke="${m}"
|
|
288
|
+
stroke-width="${4*i}"
|
|
289
|
+
></path>
|
|
290
|
+
`),w.push(`
|
|
291
|
+
<path
|
|
292
|
+
id="frame-${t}"
|
|
293
|
+
fill="none"
|
|
294
|
+
stroke="${p}"
|
|
295
|
+
stroke-width="${2*i}"
|
|
296
|
+
></path>
|
|
297
|
+
`),w.push(`
|
|
298
|
+
<circle
|
|
299
|
+
id="dot-${t}"
|
|
300
|
+
r="${5*i}"
|
|
301
|
+
fill="${h}"
|
|
302
|
+
stroke="${g}"
|
|
303
|
+
stroke-width="${2*i}"
|
|
304
|
+
></circle>
|
|
305
|
+
`),x||w.push(`
|
|
306
|
+
<rect
|
|
307
|
+
x="${i/2}"
|
|
308
|
+
y="${i/2}"
|
|
309
|
+
width="${_-i}"
|
|
310
|
+
height="${_-i}"
|
|
311
|
+
fill="none"
|
|
312
|
+
stroke="${f}"
|
|
313
|
+
stroke-width="${i}"
|
|
314
|
+
></rect>
|
|
315
|
+
`),r.innerHTML=`
|
|
316
|
+
<svg
|
|
317
|
+
class="adornment-svg"
|
|
318
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
319
|
+
viewBox="0 0 ${_} ${_}"
|
|
320
|
+
width="${_*v}"
|
|
321
|
+
height="${_*v}"
|
|
322
|
+
>
|
|
323
|
+
${w.join(``)}
|
|
324
|
+
</svg>
|
|
325
|
+
`,Sl(e)}function xl(e){let{scale:t,boundingBox:n,moveEndPosition:r}=e,i=e.globeFallbackActive&&e.globeGeoJson!==void 0||e.isGlobe,a=vl*t,o=qc(),s;if(i){let{lng:e,lat:t}=r;s=_l().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 Sl(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=Cl(n),{path:l,projection:u}=xl(e),d=1/0,f=-1/0,p=1/0,m=-1/0,h=1/0,g=-1/0;or(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 Cl(e){let{clientWidth:t,clientHeight:n}=e.getCanvas(),r=[];for(let n=0;n<64;n++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([N(0,t,n/64),0]);r.push([i,a])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([t,N(0,n,i/64)]);r.push([a,o])}for(let i=0;i<64;i++){let{lng:a,lat:o}=e.unprojectWithScaleCorrection([N(t,0,i/64),n]);r.push([a,o])}for(let t=0;t<64;t++){let{lng:i,lat:a}=e.unprojectWithScaleCorrection([0,N(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 wl=[10,5,3,2,1];function Tl(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 El(e){let t=10**Math.floor(Math.log10(e)),n=e/t;for(let e of wl)if(n>=e)return e*t;return Dl(n)*t}function Dl(e){let t=10**Math.ceil(-Math.log(e)/Math.LN10);return Math.round(e*t)/t}var Ol={kilometer:`km`,meter:`m`,mile:`mi`,foot:`ft`,nauticalMile:`nm`};function kl(e,t,n,r,i){let a=document.createElement(`div`);a.className=`adornment`;let o=`ArialMT`;return{element:a,ready:Wr(e.font??o,n,r).then(()=>{let n=()=>{a.innerHTML=Al(t,e,t.getScale(),o)};n(),t.on(`move`,n),i!==`interactive`&&t.on(`resize`,n)})}}function Al(e,t,n,r){let{maxWidth:i=100,fontSize:a=8,color:o=`#000000`,unit:s=`metric_and_imperial`}=t,c=qr(t.font??r),l=e.getCenter(),u=e.projectWithScaleCorrection(l),d=w(l,e.unprojectWithScaleCorrection([u.x+i,u.y])),f=Object.fromEntries(Object.entries(Ol).map(([e,t])=>{let n=j(`meter`,e,d),r=El(n)||0;return[e,{value:n,ratio:n?r/n:0,humanized:r<1?`${Tl(r).join(`/`)} ${t}`:`${r} ${t}`}]})),p=f.meter.value>1e3?f.kilometer:f.meter,m=f.foot.value>5280?f.mile:f.foot,h={imperial:m,metric:p,nautical:f.nauticalMile},g=s===`metric_and_imperial`?void 0:h[s],_={metric:Math.round(i*p.ratio),imperial:Math.round(i*m.ratio)},v=s===`metric_and_imperial`?Math.max(_.metric,_.imperial):Math.round(i*(g?.ratio??0)),y=a+7;if(s===`metric_and_imperial`){let e=y+a*2;return`
|
|
326
|
+
<svg
|
|
327
|
+
class="adornment-svg"
|
|
328
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
329
|
+
width="${v*n}"
|
|
330
|
+
height="${e*n}"
|
|
331
|
+
viewBox="0 0 ${v} ${e}"
|
|
332
|
+
>
|
|
333
|
+
<line
|
|
334
|
+
x1="0"
|
|
335
|
+
y1="${y-.5}"
|
|
336
|
+
x2="${v}"
|
|
337
|
+
y2="${y-.5}"
|
|
338
|
+
stroke="${o}"
|
|
339
|
+
stroke-width="1"
|
|
340
|
+
/>
|
|
341
|
+
<line
|
|
342
|
+
x1="0.5"
|
|
343
|
+
y1="${y-5}"
|
|
344
|
+
x2="0.5"
|
|
345
|
+
y2="${y+5}"
|
|
346
|
+
stroke="${o}"
|
|
347
|
+
stroke-width="1"
|
|
348
|
+
/>
|
|
349
|
+
<line
|
|
350
|
+
x1="${_.imperial-.5}"
|
|
351
|
+
y1="${y-5}"
|
|
352
|
+
x2="${_.imperial-.5}"
|
|
353
|
+
y2="${y}"
|
|
354
|
+
stroke="${o}"
|
|
355
|
+
stroke-width="1"
|
|
356
|
+
/>
|
|
357
|
+
<line
|
|
358
|
+
x1="${_.metric-.5}"
|
|
359
|
+
y1="${y}"
|
|
360
|
+
x2="${_.metric-.5}"
|
|
361
|
+
y2="${y+5}"
|
|
362
|
+
stroke="${o}"
|
|
363
|
+
stroke-width="1"
|
|
364
|
+
/>
|
|
365
|
+
<text
|
|
366
|
+
x="0"
|
|
367
|
+
y="${y+7+a}"
|
|
368
|
+
font-size="${a}px"
|
|
369
|
+
font-family="${c}"
|
|
370
|
+
font-weight="bold"
|
|
371
|
+
fill="${o}"
|
|
372
|
+
text-anchor="start"
|
|
373
|
+
>
|
|
374
|
+
0
|
|
375
|
+
</text>
|
|
376
|
+
<text
|
|
377
|
+
x="${_.imperial}"
|
|
378
|
+
y="${y-7}"
|
|
379
|
+
font-size="${a}px"
|
|
380
|
+
font-family="${c}"
|
|
381
|
+
font-weight="bold"
|
|
382
|
+
fill="${o}"
|
|
383
|
+
text-anchor="end"
|
|
384
|
+
>
|
|
385
|
+
${m.humanized}
|
|
386
|
+
</text>
|
|
387
|
+
<text
|
|
388
|
+
x="${_.metric}"
|
|
389
|
+
y="${y+7+a}"
|
|
390
|
+
font-size="${a}px"
|
|
391
|
+
font-family="${c}"
|
|
392
|
+
font-weight="bold"
|
|
393
|
+
fill="${o}"
|
|
394
|
+
text-anchor="end"
|
|
395
|
+
>
|
|
396
|
+
${p.humanized}
|
|
397
|
+
</text>
|
|
398
|
+
</svg>
|
|
399
|
+
`}let b=y+a+5;return`
|
|
400
|
+
<svg
|
|
401
|
+
class="adornment-svg"
|
|
402
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
403
|
+
width="${v*n}"
|
|
404
|
+
height="${b*n}"
|
|
405
|
+
viewBox="0 0 ${v} ${b}"
|
|
406
|
+
>
|
|
407
|
+
<line
|
|
408
|
+
x1="0"
|
|
409
|
+
y1="4.5"
|
|
410
|
+
x2="${v}"
|
|
411
|
+
y2="4.5"
|
|
412
|
+
stroke="${o}"
|
|
413
|
+
stroke-width="1"
|
|
414
|
+
/>
|
|
415
|
+
<line
|
|
416
|
+
x1="0.5"
|
|
417
|
+
y1="0"
|
|
418
|
+
x2="0.5"
|
|
419
|
+
y2="10"
|
|
420
|
+
stroke="${o}"
|
|
421
|
+
stroke-width="1"
|
|
422
|
+
/>
|
|
423
|
+
<line
|
|
424
|
+
x1="${v-.5}"
|
|
425
|
+
y1="0"
|
|
426
|
+
x2="${v-.5}"
|
|
427
|
+
y2="10"
|
|
428
|
+
stroke="${o}"
|
|
429
|
+
stroke-width="1"
|
|
430
|
+
/>
|
|
431
|
+
<text
|
|
432
|
+
x="0"
|
|
433
|
+
y="${a+12}"
|
|
434
|
+
font-size="${a}px"
|
|
435
|
+
font-family="${c}"
|
|
436
|
+
font-weight="bold"
|
|
437
|
+
fill="${o}"
|
|
438
|
+
text-anchor="start"
|
|
439
|
+
>
|
|
440
|
+
0
|
|
441
|
+
</text>
|
|
442
|
+
<text
|
|
443
|
+
x="${v}"
|
|
444
|
+
y="${a+12}"
|
|
445
|
+
font-size="${a}px"
|
|
446
|
+
font-family="${c}"
|
|
447
|
+
font-weight="bold"
|
|
448
|
+
fill="${o}"
|
|
449
|
+
text-anchor="end"
|
|
450
|
+
>
|
|
451
|
+
${g?.humanized??``}
|
|
452
|
+
</text>
|
|
453
|
+
</svg>
|
|
454
|
+
`}function jl(e,t,n,r,i){let a=document.createElement(`div`);a.className=`adornment`;let o=`ArialMT`,s=[e.titleFont??o,e.subtitleFont??o],c=Array.from(new Set(s));return{element:a,ready:Promise.all(c.map(e=>Wr(e,n,r))).then(()=>{let n=()=>{a.innerHTML=Ml(e,o,t.getScale())};n(),i!==`interactive`&&t.on(`resize`,n)})}}function Ml(e,t,n){let{title:r,titleColor:i=`#000000`,titleFontSize:a=20,titleJustify:o=`center`,subtitle:s,subtitleColor:c=`#000000`,subtitleFontSize:l=12,subtitleJustify:u=`center`,background:d=`#ffffff`,showBackground:f=!1}=e,p=qr(e.titleFont??t),m=qr(e.subtitleFont??t),h=0,g=0,_=0,v=0,y=0,b=r.trim().length>0?gi([r],p,a):null,x=s.trim().length>0?gi([s],m,l):null;if(h=Math.max(b?.width??0,x?.width??0),b){let{ascent:e,descent:t}=b;g=e+t,v=8+e}if(x){let{ascent:e,descent:t}=x;_=e+t,y=b?v+b.descent+e+6:8+e}let S=h+16,C=g+_+16,w=o===`center`?S/2:o===`right`?S-8:8,T=u===`center`?S/2:u===`right`?S-8:8,E=``;if(E+=`<svg class="adornment-svg" xmlns="http://www.w3.org/2000/svg" width="${S*n}" height="${C*n}" viewBox="0 0 ${S} ${C}">`,E+=`<rect x="0" y="0" width="${S}" height="${C}" fill="${d}" rx="6" style="visibility:${f?`visible`:`hidden`}" />`,b||x){let e=o===`center`?`middle`:o===`right`?`end`:`start`,t=u===`center`?`middle`:u===`right`?`end`:`start`;E+=`<text x="${w}" y="${v}" fill="${i}" font-family="${p}" font-size="${a}" text-anchor="${e}">`,b&&(E+=`${Zr(r)}`),x&&(E+=`<tspan x="${T}" y="${y}" fill="${c}" font-family="${m}" font-size="${l}" text-anchor="${t}">`,E+=`${Zr(s)}`,E+=`</tspan>`),E+=`</text>`}return E+=`</svg>`,E}var Nl={"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},Pl={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`}},Fl={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`}},Il={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}},Ll=[`beforeWaters`,`beforeBoundaries`,`beforeNames`,`beforeNone`],Rl={beforeWaters:`mc-before-waters`,beforeBoundaries:`mc-before-boundaries`,beforeNames:`mc-before-names`,beforeNone:`mc-before-none`},zl={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`},Bl=[`top_left`,`top_right`,`bottom_left`,`bottom_right`,`top_center`,`left_center`,`right_center`,`bottom_center`],Vl=new Map;async function Hl(e,t,n,r,i,a,o,s,c){let l=[...e.adornments??[]];Ul(n,t,c);let u=[],d=l.some(e=>![`copyright`,`webControls`].includes(e.type));ya()&&d&&!l.some(e=>e.type===`webControls`)&&l.unshift({type:`webControls`,id:`web_controls`,name:`Web controls`,position:`top_left`,stacking:`vertical`,buttons:[]}),l.forEach(t=>{if(t.type===`custom`)Gl(le(t,n,c),t.position,t.stacking);else if(t.type===`northArrow`)Gl(Ri(t,n,c),t.position,t.stacking);else if(t.type===`webControls`&&t.buttons&&c===`interactive`)Gl(ba(t,n,r,i,d),t.position,t.stacking);else if(t.type===`scalebar`){let{element:e,ready:r}=kl(t,n,a,s,c);Gl(e,t.position,t.stacking),u.push(r)}else if(t.type===`insetMap`){let{element:e,ready:r}=yl(t,n,o,c);Gl(e,t.position,t.stacking),u.push(r)}else if(t.type===`heading`){let{element:e,ready:r}=jl(t,n,a,s,c);Gl(e,t.position,t.stacking),u.push(r)}else if(t.type===`manualLegend`){let{element:e,ready:r}=Li(t,n,a,s,c);Gl(e,t.position,t.stacking),u.push(r)}else if(t.type===`connectedLegend`){let{element:r,ready:i}=ki(t,e,n,a,s,c);Gl(r,t.position,t.stacking),u.push(i)}else t.type===`copyright`&&c!==`interactive`&&Gl(Ca(t,n),t.position,t.stacking)}),Kl(n),n.on(`moveend`,()=>Kl(n)),c!==`interactive`&&n.on(`resize`,()=>queueMicrotask(()=>Kl(n))),await Promise.all(u)}function Ul(e,t,n){let r=e.getContainer(),i=[],a=()=>{for(let{position:r,element:a}of i)a.style.cssText=Wl(r,t[r],e.getScale(),n)};for(let e of Bl){let t=document.createElement(`div`);t.classList.add(`adornment-container`,e),i.push({position:e,element:t});let n=document.createElement(`div`),a=document.createElement(`div`);n.classList.add(`inner`),a.classList.add(`inner`,`vertical`),t.append(n,a),r.appendChild(t),Vl.set(e,{horizontal:n,vertical:a})}a(),n!==`interactive`&&e.on(`resize`,a)}function Wl(e,t,n,r){let i=Fl[e],a=``,o=[],s=t.x*n,c=t.y*n,{unit:l}=t;return 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 Gl(e,t,n){ya()&&!e.classList.contains(`web-control`)&&e.classList.add(`hide`),n||=[`left_center`,`right_center`].includes(t)?`vertical`:`horizontal`;let r=Vl.get(t),i=t===`left_center`||t===`right_center`?`vertical`:`horizontal`;r?.[i].hasChildNodes()||(n=i),(r?.[n])?.appendChild(e)}function Kl(e){let t=Array.from(document.querySelectorAll(`.adornment, .maplibregl-ctrl-attrib`)),n=[];t.forEach(e=>{let t=e.getBoundingClientRect();t&&n.push([t.x,t.y,t.x+t.width,t.y+t.height])}),e.setLabelFreeAreas(n)}function ql(e){for(let t of Ll){let n=Rl[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 Jl(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Yl(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 Yl(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?_i(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?_i(t.dataBindings??{},t.outlineColor,e.outlineColor):`#000000`,"outline-width":t.outlineWidth??0,"fill-pattern":i},geometry:{type:`Polygon`,coordinates:Tr(t)}}}function Xl(e,t,n,r,i){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>Zl(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 Zl(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?_i(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`,"outline-color":e.outlineColor||t.outlineColor?_i(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?_i(t.dataBindings??{},t.radiusLineColor,e.radiusLineColor):`#000000`,"radius-line-width":t.radiusLineWidth??0},geometry:{type:`GeometryCollection`,geometries:[{type:`Polygon`,coordinates:[br(t.center,t.radius*n)]},{type:`LineString`,coordinates:xr(t.center,t.radius*n,t.radiusLineBearing??0)}]}}}var Ql=`Roboto-Regular`;function $l(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(tu(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,Ql]]);l.push([`literal`,[Ql]])}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`,[Ql]],"text-field":`{point_count_abbreviated}`,"text-size":{property:`point_count`,type:`interval`,stops:t.clusterTextSize??[]}}}),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`]]]})}),a===`interactive`&&eu(e,t))}function eu(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 tu(e,t,n,r,i,a){let o=n.svg===void 0?void 0:yi(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:ui(o);return{type:`Feature`,id:T(n.id),properties:{id:n.id,"mc-image-key":s,"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?vi(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?_i(n.dataBindings??{},n.textColor,t.textColor):`#000000`,"text-halo-color":t.textHaloColor||n.textHaloColor?_i(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 nu(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=ne(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}`;ru(i,n,a)}return o}function ru(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(iu(r,n),e)}}function iu(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 au=`<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>
|
|
455
|
+
`,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>
|
|
456
|
+
`,su=`<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>
|
|
457
|
+
`,cu=`<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>
|
|
458
|
+
`;function lu(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=du(a),a=uu(a),s.length){let e=a.includes(`?`)?`&`:`?`;a+=`${e}${s.join(`&`)}`}return a}function uu(e){return e.replace(/([?&])si=[^&]+(&)?/,(e,t,n)=>t===`?`&&!n?``:t===`?`&&n?`?`:n?`&`:``)}function du(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 fu(e,t,n,r){let i;if(t?.type===`video`)i=r?_u(t.src,n):`
|
|
459
|
+
<div class="youtube-container">
|
|
460
|
+
<iframe
|
|
461
|
+
src="${lu(t,n)}"
|
|
462
|
+
width="100%" height="300" style="border: none" allowfullscreen>
|
|
463
|
+
</iframe>
|
|
464
|
+
</div>
|
|
465
|
+
`;else if(t?.type===`image`){let e=E(t.src,n),r=E(t.alt,n);i=`
|
|
466
|
+
<div class="image-container ${t.fill?`fill`:``}">
|
|
467
|
+
<img src="${e}" alt="${r}" />
|
|
468
|
+
</div>
|
|
469
|
+
`}i=i?`<div class="media-content">${i}</div>`:``;let a=e?`<div class="text-content">${hu(e,n)}</div>`:``;return`
|
|
470
|
+
<div class="popup-scroll-wrapper">
|
|
471
|
+
<div class="mc-popup">
|
|
472
|
+
${i}
|
|
473
|
+
${a}
|
|
474
|
+
</div>
|
|
475
|
+
</div>
|
|
476
|
+
`}var pu=`
|
|
477
|
+
<button class="mc-popup-button close">
|
|
478
|
+
${ou}
|
|
479
|
+
</button>
|
|
480
|
+
`,mu=`
|
|
481
|
+
<div class="cycle-buttons">
|
|
482
|
+
<button class="mc-popup-button prev">
|
|
483
|
+
${au}
|
|
484
|
+
</button>
|
|
485
|
+
<button class="mc-popup-button next">
|
|
486
|
+
${su}
|
|
487
|
+
</button>
|
|
488
|
+
</div>
|
|
489
|
+
`;function hu(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}="${gu(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 gu(e){return/^https?:\/\//i.test(e)?e:`https://${e}`}function _u(e,t){return`
|
|
490
|
+
<div class="youtube-placeholder">
|
|
491
|
+
<img src="${`https://img.youtube.com/vi/${k(E(e,t))}/hqdefault.jpg`}" />
|
|
492
|
+
<div class="popup-alert">
|
|
493
|
+
<div class="alert-icon">${cu}</div>
|
|
494
|
+
<div>${ga(`videoAlert`)}</div>
|
|
495
|
+
</div>
|
|
496
|
+
</div>
|
|
497
|
+
`}var vu=[`area`,`circle`,`dot`,`line`,`marker`,`polygon`],yu=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 vu)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()}},bu=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(br(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=>!I(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)})}}},xu=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 yu(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 bu(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 o({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=fu(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&&=`
|
|
498
|
+
<div class="popup-scroll-wrapper">
|
|
499
|
+
<div class="mc-popup data-layer text-content">${n}</div>
|
|
500
|
+
</div>
|
|
501
|
+
`}return n}htmlToElement(e){let t=document.createElement(`template`);return t.innerHTML=e.trim(),t.content.firstElementChild}addPopupControls(){let e=this.htmlToElement(pu);if(e&&(e.addEventListener(`click`,()=>{this.hidePopup(),this.highlightManager.highlight(void 0)}),this.popupContainer.appendChild(e)),this.popupElements.length>1){let e=this.htmlToElement(mu);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=fu(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()}}},Su=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=Cu(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(N(i.x,o.x,t),N(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);wu(t,n[0])||n.unshift(t)}if(t<1){let e=this.sample(t);wu(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 Cu(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 wu(e,t){return e.x===t.x&&e.y===t.y}var Tu={solid:[1,0],dotted:[.7,.3],dashed:[3.5,1.5]};function Eu(e,t,n,r){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(n=>Du(e,t,n,1,r))}}),Object.entries(Tu).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)}),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 Du(e,t,n,r,i){let a=new Su(n.geometry).slice(0,r),o=n.svg!==void 0&&a.length>1?i.getMapLibreImageKey(yi(n.dataBindings??{},n.svg,void 0),window.devicePixelRatio*(n.iconScale??1)*e.getScale()):void 0;return{type:`Feature`,id:T(n.id),properties:{id:n.id,"line-width":n.lineWidth??3,"line-color":t.lineColor||n.lineColor?_i(n.dataBindings??{},n.lineColor,t.lineColor):`#000000`,"line-style":n.lineStyle??`solid`,"mc-image-key":o,"icon-rotate":Ou(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 Ou(e,t,n){return e.iconRotation?e.iconAlign?kr(t,n)+e.iconRotation:e.iconRotation:0}function ku(e,t,n,r,i,a,o){let s=Ir(t),c=new Map,l=new Map;for(let e of t.models){let n=e.featureId,a=t.id,o=[],u=Dr(e),d=Er(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?_i(e.dataBindings??{},e.fillColor,t.fillColor,s,t.choropleth?.unmatchedColor):`#000000`,f.modelIdToFillPattern[n]=a,f.modelIdToOutlineColor[n]=t.outlineColor||e.outlineColor?_i(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=Dr(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 Au(e,t,n){e.addSource(t.id,{type:`geojson`,data:{type:`FeatureCollection`,features:t.models.filter(e=>e.visible??!0).map(e=>ju(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 ju(e,t){return{type:`Feature`,id:t.id,properties:{id:t.id,"circle-radius":t.radius,"circle-color":e.fillColor||t.fillColor?_i(t.dataBindings??{},t.fillColor,e.fillColor):`#000000`},geometry:{type:`Point`,coordinates:[t.center.lng,t.center.lat]}}}function Mu(e){let t=e.length>0?[Nu(e[0])]:[],n=0,r=0;for(let i=1;i<e.length;++i){let a=Nu(e[i]);n+=Pu(e[i-1].center[0],a.center[0]),r+=Pu(e[i-1].bearing,a.bearing),a.center[0]+=n*360,a.x+=n,a.bearing+=r*360,t.push(a)}return t}function Nu(e){return{...e,center:[e.center[0],e.center[1]]}}function Pu(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 Fu(e){return 2**-e}function Iu(e){return e.length>0?e[e.length-1].time:0}function Lu(e){return`${String(Math.floor(e%36e5/6e4)).padStart(2,`0`)}:${String(Math.floor(e%6e4/1e3)).padStart(2,`0`)}`}function Ru(e){return F(e,23.976)?24e3/1001:F(e,29.97)?3e4/1001:F(e,59.94)?6e4/1001:e}function zu(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 Bu=`
|
|
502
|
+
<div class="preload-bar-vertical"></div>
|
|
503
|
+
<div class="preload-bar-horizontal"></div>
|
|
504
|
+
<div class="preload-badge">
|
|
505
|
+
<div class="preload-ring-outer"></div>
|
|
506
|
+
<div class="preload-ring-inner"></div>
|
|
507
|
+
<div class="preload-ring-dots"></div>
|
|
508
|
+
<div class="preload-content">
|
|
509
|
+
<div class="preload-logo"><svg xmlns="http://www.w3.org/2000/svg" width="130" height="18" viewBox="0 0 130 18" fill="currentColor"><path d="M16.49.815h-3.283V17.35h3.283zm-6.566 0h-3.32v6.567h3.32zm16.461 0h-6.567v3.32h6.567zm0 13.215h-6.567v3.319h6.567zM3.321.815H.038V17.35h3.283zM38.38 5.18l2.01 5.667 2-5.666h2.12v7.812h-1.62v-2.137l.164-3.684-2.092 5.82h-1.128l-2.11-5.82.164 3.684v2.137h-1.61V5.18zm14.488 6.176h-2.81l-.537 1.61h-1.728l2.91-7.812h1.492l2.928 7.812h-1.719zm-2.392-1.273h1.955l-.982-2.929zm9.432.154v2.729h-1.61V5.18h3.046a3.5 3.5 0 0 1 1.547.318c.426.193.784.51 1.027.91.246.405.372.872.364 1.346a2.21 2.21 0 0 1-.791 1.819 3.27 3.27 0 0 1-2.174.663zm0-1.3h1.436c.352.02.698-.09.974-.31a1.1 1.1 0 0 0 .336-.909 1.2 1.2 0 0 0-1.1-1.291h-1.646zm14.059 1.455a2.73 2.73 0 0 1-.91 1.982 3.2 3.2 0 0 1-2.21.728 2.94 2.94 0 0 1-2.364-1.01 4.16 4.16 0 0 1-.91-2.783v-.472a4.7 4.7 0 0 1 .419-2.028c.25-.535.656-.982 1.164-1.283a3.24 3.24 0 0 1 1.71-.455 3.17 3.17 0 0 1 2.182.728c.557.53.884 1.259.91 2.028h-1.592a1.62 1.62 0 0 0-.418-1.091 1.57 1.57 0 0 0-1.11-.346 1.35 1.35 0 0 0-1.2.582 3.1 3.1 0 0 0-.41 1.82v.59c-.037.63.095 1.258.383 1.82a1.32 1.32 0 0 0 1.21.581c.398.034.796-.086 1.109-.336.273-.284.426-.662.427-1.055zm6.393-.255h-1.28v2.856h-1.61V5.18h2.9a3.2 3.2 0 0 1 2.138.618 2.12 2.12 0 0 1 .755 1.737 2.17 2.17 0 0 1-1.373 2.192l1.691 3.192v.073H81.89zm-1.281-1.31h1.3c.332.018.657-.092.91-.309a1.1 1.1 0 0 0 .336-.845 1.2 1.2 0 0 0-.318-.91 1.32 1.32 0 0 0-.964-.318h-1.264zm12.55.783h-3.093v2.09h3.638v1.292h-5.247V5.18h5.23v1.3h-3.639v1.865h3.092zm8.339 1.746H97.14l-.537 1.61h-1.71l2.91-7.812h1.492l2.929 7.812h-1.71zm-2.392-1.3h1.956l-.983-2.929zm13.06-3.575h-2.374v6.512h-1.609V6.48h-2.365v-1.3h6.366zm9.631 2.783a4.7 4.7 0 0 1-.409 2.028 3 3 0 0 1-1.164 1.337 3.44 3.44 0 0 1-3.474 0 3.07 3.07 0 0 1-1.183-1.337 4.55 4.55 0 0 1-.427-1.991V8.91a4.56 4.56 0 0 1 .418-2.028 3.1 3.1 0 0 1 1.174-1.355 3.48 3.48 0 0 1 3.474 0c.516.325.925.797 1.173 1.355a4.56 4.56 0 0 1 .418 2.028zm-1.628-.354a3.2 3.2 0 0 0-.445-1.874 1.45 1.45 0 0 0-1.255-.636 1.42 1.42 0 0 0-1.246.636 3.2 3.2 0 0 0-.446 1.82v.381c-.03.636.121 1.267.437 1.819a1.53 1.53 0 0 0 1.255.65 1.54 1.54 0 0 0 1.255-.65 3.36 3.36 0 0 0 .445-1.819zm8.14 1.227h-1.237v2.856h-1.619V5.18h2.91a3.2 3.2 0 0 1 2.137.618 2.12 2.12 0 0 1 .755 1.737 2.23 2.23 0 0 1-1.455 2.192l1.692 3.192v.073h-1.692zm-1.237-1.31h1.291c.33.01.653-.1.91-.309a1.08 1.08 0 0 0 .327-.845 1.2 1.2 0 0 0-.309-.91 1.33 1.33 0 0 0-.964-.318h-1.255z"/></svg>
|
|
510
|
+
</div>
|
|
511
|
+
<div class="preload-percentage">0%</div>
|
|
512
|
+
<div class="preload-label">Preloading tiles...</div>
|
|
513
|
+
</div>
|
|
514
|
+
</div>
|
|
515
|
+
`,Vu=class{container;percentage;constructor(e){this.container=document.createElement(`div`),this.container.className=`preload-overlay`,this.container.innerHTML=Bu,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 Hu(e){return e<0?-1:1}function Uu(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(Hu(a)+Hu(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Wu(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Gu(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 Ku(e){this._context=e}Ku.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:Gu(this,this._t0,Wu(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,Gu(this,Wu(this,n=Uu(this,e,t)),n);break;default:Gu(this,this._t0,n=Uu(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function qu(e){this._context=new Ju(e)}(qu.prototype=Object.create(Ku.prototype)).point=function(e,t){Ku.prototype.point.call(this,t,e)};function Ju(e){this._context=e}Ju.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 Yu(e){return new Ku(e)}var Xu=p(((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)}}})),Zu=p(((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}})),Qu=h(Xu(),1),$u=h(Zu(),1),ed=class{segments;constructor(e){this.segments=[];let t=new td,n=Yu(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?N(t.startY,t.endY,t.easing(n)):N(t.startY,t.endY,n)}solve(e,t){let n=(0,$u.default)(t=>this.sample(t)-e,t);return n===!1?t:n}},td=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,Qu.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 rd(e,t,n,r){return n*((e=e/r-1)*e*e+1)+t}function id(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 ad(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 od(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 sd=class{script;xCurve;yCurve;fovCurve;zoomCurve;pitchCurve;bearingCurve;altitudeCurve;elevationCurve;constructor(e){this.script=Mu(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(Fu(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:N(l,c,i)}),n.push({x:r,y:N(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 ed(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=te(rd(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=te(rd(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`?Fu(e.zoom):e[t]}},cd=`<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>
|
|
516
|
+
`,ld=`<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>
|
|
517
|
+
`,ud=`<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>
|
|
518
|
+
`,dd=e=>`
|
|
519
|
+
<div class="video-slider-container">
|
|
520
|
+
<div class="video-slider-line-wrapper">
|
|
521
|
+
<div class="video-slider-line-left"></div>
|
|
522
|
+
<div class="video-slider-line"></div>
|
|
523
|
+
</div>
|
|
524
|
+
<input class="video-slider" type="range" step="any" min="0" max="${e}" value="0" />
|
|
525
|
+
</div>
|
|
526
|
+
<div class="video-controls-row">
|
|
527
|
+
<button class="video-button play">
|
|
528
|
+
<span class="video-icon play-icon">${ud}</span>
|
|
529
|
+
<span class="video-icon pause-icon">${ld}</span>
|
|
530
|
+
</button>
|
|
531
|
+
<button class="video-button restart">
|
|
532
|
+
${cd}
|
|
533
|
+
</button>
|
|
534
|
+
<div class="video-time">
|
|
535
|
+
<span class="video-playhead">${Lu(0)}</span> /
|
|
536
|
+
<span class="video-duration">${Lu(e)}</span>
|
|
537
|
+
</div>
|
|
538
|
+
<button class="video-button fullscreen">
|
|
539
|
+
${na}
|
|
540
|
+
</button>
|
|
541
|
+
</div>
|
|
542
|
+
`,fd=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=dd(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`,()=>sa(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=Lu(t)}},pd=class extends t{time;constructor(e,t){super(e),this.time=t}},md={linear:nd,easeOutCubic:rd,easeOutBack:ad,easeOutBounce:od,easeOutElastic:id};function hd(e){return e.entryType===`fade`||e.exitType===`fade`||e.entryType===`instant`||e.exitType===`instant`}function gd(e){return e.entryType===`grow`||e.exitType===`grow`}function _d(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?md[c](n-r,0,1,i):o>0&&n>a-o&&l===t?md[u](n-(a-o),1,-1,o):1}function vd(e){return e.target.type===`model`}function yd(e){return e.target.type===`layer`||e.target.type===`overlay`}var bd=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(yd);let d=u.filter(vd);this.registryAnimations=[...d.filter(e=>e.target.modelId===void 0),...d.filter(e=>e.target.modelId!==void 0)],this.duration=Iu(l),this.frameRate=Ru(t.export?.frameRate??60),this.cameraCurve=new sd(l),this.registry=new yu(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 fd(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 pd(`playstart`,this.playhead)),this.controls?.setPlaying(!0),this.playFrame())}pause(){this.playbackContext!==void 0&&(this.playbackContext=void 0,this.mcMap.fire(new pd(`playend`,this.playhead)),this.controls?.setPlaying(!1))}seekTo(e){this.duration>0&&(e=te(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(){let e=this.mcMap.map,t=Math.ceil(this.duration*this.frameRate/1e3);e._fadeDuration=0;let n=e.getCanvas(),{width:r,height:i}=n,a=new OffscreenCanvas(r,i).getContext(`2d`,{desynchronized:!0,willReadFrequently:!0}),o=e.getContainer(),s=o.getBoundingClientRect();for(let e=0;e<t;e++)yield this.captureFrame(e*1e3/this.frameRate,n,a,r,i,o,s);e._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);this.preloadOverlay=new Vu(this.mcMap.map),e._fadeDuration=0;try{let n;for(let r=0;r<t;r++){this.preloadOverlay?.setProgress(r/t);let i=this.cameraCurve.sample(r*1e3/this.frameRate);zu(n,i)||(this.setCamera(i),await this.waitForRenderOrAbort()===`render`?n=i:(n!==void 0&&this.setCamera(n),e.triggerRepaint(),await e.once(`idle`),r--))}e.areTilesLoaded()||await e.once(`idle`)}finally{this.setFrame(this.playhead),e._fadeDuration=300,this.preloadOverlay?.remove(),this.preloadOverlay=void 0}}waitForRenderOrAbort(){let e=this.mcMap.map;return new Promise(t=>{let n=()=>{e.off(`render`,r),e.off(`dataabort`,i)},r=()=>{n(),t(`render`)},i=e=>{e.tile?.state===`loading`&&(n(),t(`abort`))};e.on(`render`,r),e.on(`dataabort`,i)})}async captureFrame(e,t,n,r,i,a,o){return this.setFrame(e),await this.mcMap.map.once(`idle`),n.fillStyle=this.backgroundColor,n.fillRect(0,0,r,i),n.drawImage(t,0,0),await this.drawAdornments(n,a,o),n.getImageData(0,0,r,i)}async drawAdornments(e,t,n){let r=t.querySelectorAll(`.adornment-svg`),i=await Promise.all(Array.from(r).map(async e=>{let t=e.outerHTML,r=e.getBoundingClientRect(),i=r.left-n.left,a=r.top-n.top,o=r.width,s=r.height,{fontMap:c,vapiUrl:l,accessToken:u}=this.svgCache;return{image:await Qr(t,o,s,c,l,u),x:i,y:a}}));for(let t of i)e.drawImage(t.image,t.x,t.y)}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 pd(`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 pd(`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(!hd(n))continue;let{modelType:i,groupId:a,modelId:o}=r,s=_d(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:Dr(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:_d(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 Zl(i,t,a===void 0?s:_d(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:_d(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 Du(t,n,i,s===void 0?o:_d(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:_d(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 tu(t,i,a,c===void 0?s:_d(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`&&hd(a)||n===`scale`&&gd(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??Il[e.type].defaultValue;return i===void 0?r===void 0?void 0:_d(r,`fade`,t)*o:_d(i,`fade`,t)*o}setLayerOpacity(e,t){let n=this.mcMap.map,r=Il[e.type];for(let i of r.props)n.setPaintProperty(e.id,i,t)}resetLayerOpacity(e){let t=this.mcMap.map,n=Il[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)}},xd=class extends n{map;video;constructor(e,t,n,r,i,a,o,s,c){super(),this.map=e,t===`video`&&(n.video?.keyframes??[]).length>0&&(this.video=new bd(this,n,r,i,a,o,s,c))}play(){this.video?.play()}pause(){this.video?.pause()}seekTo(e){this.video?.seekTo(e)}async*frames(){this.video!==void 0&&(yield*this.video.frames())}preload(){return this.video?.preload()??Promise.resolve()}remove(){let e=this.map.getContainer();this.video?.remove(),this.map.remove(),e.innerHTML=``,e.style.backgroundColor=``,e.classList.remove(`mc-map`),e.classList.remove(`mc-mode-web`)}};async function Sd(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 Cd(t.job,o,n):t.job,c=zl[s.export?.format??`png`]??`static`;await wd();let l={container:t.container,attributionControl:!1,style:null,maxBounds:[-1/0,-90,1/0,90],maxPitch:85,maxZoom:22,locale:{"CooperativeGesturesHandler.WindowsHelpText":ga(`windowsHelpText`),"CooperativeGesturesHandler.MacHelpText":ga(`macHelpText`),"CooperativeGesturesHandler.MobileHelpText":ga(`mobileHelpText`)},canvasContextAttributes:{preserveDrawingBuffer:t.preserveDrawingBuffer??!1}};c===`video`&&(l.maxTileCacheSize=1/0,l.maxTileCacheZoomLevels=1/0,l.refreshExpiredTiles=!1);let u=new i(l),d=u.getContainer();d.classList.add(`mc-map`),c===`interactive`&&d.classList.add(`mc-mode-web`);let f=c===`interactive`?new xu(u,t.youTubePlaceholder??!1):void 0,{map:{language:p,hideBasemap:m,detailLevel:h=0,projection:_=`mercator`,terrain:y=!1,terrainExaggeration:x=1},registry:S={},web:C,positionOffsets:w}=s,{models:T={},slots:E={},svgs:D={}}=S,O=new fi(u,await Gr(r,a,n),a,n);u.resize();let k=c===`video`?s.video?.keyframes[0]:void 0,A=k?.pitch??s.map.pitch??0,j=k?.bearing??s.map.rotation??0,M=k?.zoom??s.map.zoom,N=k?.center===void 0?s.map.center:{lng:k.center[0],lat:k.center[1]};u.setPitch(A),u.setBearing(j);let ee=ie(s,d,c),te,ne;c===`interactive`?(ne=M-h+Math.log2(ee),te=1):(ne=M-h,te=ee,u.on(`resize`,()=>{let e=ie(s,d,c);e!==u.getScale()&&u.setScale(e)})),u.setScale(te),u.setZoom(ne),u.setCenter(N),u.setDetailLevel(h),u.setMinZoom(h),u.addControl(new e({compact:!1})),await Hl(s,w??Pl,u,O,{center:N,zoom:ne,pitch:A,rotation:j},a,o,n,c),f?.setJobObject(s);let re=c!==`interactive`||(C?.restrictMapMovement??!1);re&&(u.boxZoom.disable(),u.doubleClickZoom.disable(),u.dragPan.disable(),u.dragRotate.disable(),u.keyboard.disable(),u.scrollZoom.disable(),u.touchPitch.disable(),u.touchZoomRotate.disable(),u.getCanvasContainer().style.cursor=`default`),f?.setParams(C?.popupPosition??`bottomLeft`,b(p,v.TWO),re,N);let P=s.meta?.mapstyleSet,F=P===void 0?{version:8,sources:{},layers:[]}:await fetch(`${a}/styles/${P}.json?access_token=${n}`).then(e=>e.json());ql(F),u.setStyle(null),u.setStyle(F),await u.once(`style.load`),g(p,u);let I=s.map.overlays??[],L=s.meta?.layers??[];I.length!==L.length&&(I=[],L=[]);let ae=await nu(I,L,u,a,n,F.metadata?.styleOverride),oe=I.reduce((e,t,n)=>e.set(t,ae[n]),new Map);Ad(u,O,T,E,D,a,n,c),g(p,u),f?.setPublication(F.metadata?.publication),f?.setpopupElements(),f?.setHighlightManager(),u.setProjection({type:_===`globe`?`globe`:`mercator`});let se=Td(u,_);Ed(u,se),y&&Dd(u,a,n,x);let ce=Od(s.map.layerInfo,F,ae);return kd(u,ce,!m),new xd(u,c,s,D,O,F,oe,ce,se)}function Cd(e,t,n){return fetch(`${t}/jobs/${e}.json?access_token=${n}`).then(e=>e.json())}function wd(){return new Promise(e=>{let t=()=>{window.innerWidth>0&&window.innerHeight>0&&(window.removeEventListener(`resize`,t),e())};window.addEventListener(`resize`,t),t()})}function Td(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 Ed(e,t){e.getContainer().style.backgroundColor=t,e.setSky(e.getStyle().sky??Nl),e.setLight({position:[1.15,210,45]})}function Dd(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 Od(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 kd(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=Il[i.type];for(let n of t.props)e.setPaintProperty(r,n,a.opacity)}}}}function Ad(e,t,n,r,i,a,o,s){let{beforeNone:c=[],beforeNames:l=[],beforeBoundaries:u=[],beforeWaters:d=[]}=r;c.forEach(r=>{jd(e,t,n,r,i,`mc-before-none`,a,o,s)}),l.forEach(r=>{jd(e,t,n,r,i,`mc-before-names`,a,o,s)}),u.forEach(r=>{jd(e,t,n,r,i,`mc-before-boundaries`,a,o,s)}),d.forEach(r=>{jd(e,t,n,r,i,`mc-before-waters`,a,o,s)})}function jd(e,t,n,r,i,a,o,s,c){if(r.type===`marker`){let o=n.marker?.find(e=>e.id===r.groupId);o&&$l(e,o,a,i,t,c)}else if(r.type===`polygon`){let o=n.polygon?.find(e=>e.id===r.groupId);o&&Jl(e,o,a,i,t)}else if(r.type===`circle`){let o=n.circle?.find(e=>e.id===r.groupId);o&&Xl(e,o,a,i,t)}else if(r.type===`line`){let i=n.line?.find(e=>e.id===r.groupId);i&&Eu(e,i,a,t)}else if(r.type===`dot`){let t=n.dot?.find(e=>e.id===r.groupId);t&&Au(e,t,a)}else if(r.type===`area`){let c=n.area?.find(e=>e.id===r.groupId);c&&ku(e,c,a,i,t,o,s)}}export{Sd as initMap};
|