@projektemacher/storymapjs 0.10.2 → 0.10.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -0
- package/dist/assets/{demo-rv3vz65J.js → demo-BbkXJcS5.js} +1 -1
- package/dist/assets/{harness-BnQbtq1l.js → harness-C4SHmAI-.js} +1 -1
- package/dist/assets/{main-mUk_qlWN.js → main-DEPPWqNX.js} +2 -2
- package/dist/css/storymap.css +1 -1
- package/dist/demo.html +2 -2
- package/dist/docs/migration.html +4 -1
- package/dist/docs/readme.html +20 -0
- package/dist/harness.html +2 -2
- package/dist/js/storymap.d.ts +11 -4
- package/dist/js/storymap.js +24 -3
- package/dist/js/storymap.js.map +1 -1
- package/package.json +1 -1
- package/schema/storymap.schema.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));function l(e,...t){t=t.filter(Boolean);for(let n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(let t in i)Object.hasOwn(i,t)&&(e[t]=i[t])}return e}function u(e){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})[T\s](\d{2}):(\d{2}):(\d{2})/)?.slice(1);if(!t)return e;let n=[];for(let e=0;e<t.length;e++){let r=parseInt(t[e]);e===1&&--r,n.push(r)}let r=new Date(n[0],n[1],n[2],n[3],n[4],n[5]),i=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],a=r.getFullYear(),o=i[r.getMonth()],s=r.getDate();return o+`, `+s+` `+a}function d(e,t){e.data=l({},e.data,t);let n=e.data;n.uniqueid===``&&(n.uniqueid=v(6))}function f(e,t){let n=e,r=t,i;for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return e}function p(e,t){let n=e,r=t,i;for(i in e)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return e}var m=0,h=`_vco_id`;function g(e){let t=e;return t[h]=t[h]||++m,t[h]}function _(e,t,n){let r=0;for(let i=0;i<t.length;i++)t[i].data[n]===e&&(r=i);return r}function v(e,t){function n(e){return Math.floor(Math.random()*e)}function r(){return`abcdefghijklmnopqurstuvwxyz`.charAt(n(27))}function i(e){let t=``;for(let n=0;n<e;n++)t+=r();return t}return t?t+`-`+i(e):`vco-`+i(e)}function y(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,n,r){return t+t+n+n+r+r});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function b(e){return e.match(/<p>[\s\S]*?<\/p>/)?e:`<p>`+e+`</p>`}function x(e){let t,n,r=[];t=e.toString(),t.match(`&`)?t=t.replace(`&`,`&`):t.match(`&`)?t=t.replace(`&`,`&`):t.match(`&`)&&(t=t.replace(`&`,`&`));let i=t.slice(t.indexOf(`?`)+1).split(`&`);for(let e=0;e<i.length;e++)n=i[e].split(`=`),r.push(n[0]),r[n[0]]=n[1];return r}var S={r16_9:function(e){return e.w!==null&&e.w!==``?Math.round(e.w/16*9):e.h!==null&&e.h!==``?Math.round(e.h/9*16):0}};function C(e,t){e.length&&e.at(-1)===`/`&&(e=e.substring(0,e.length-1)),t.length&&t[0]===`/`&&(t=t.substring(1));let n=e.split(`/`),r=t.split(`/`),i=[];for(let e=0,t=n.length;e<t;e++)if(n[e]===`..`)i.pop();else if(n[e]===`.`)continue;else i.push(n[e]);for(let e=0,t=r.length;e<t;e++)if(r[e]===`..`)i.pop();else if(r[e]===`.`)continue;else i.push(r[e]);return i.join(`/`)}function w(e,t){if(e!==void 0){let n=0;for(let r in e){if(t===n)return e[r];n++}return``}return``}function T(e,t,n){return new Promise((r,i)=>{if(n?.signal?.aborted){i(new DOMException(`Load aborted`,`AbortError`));return}let a=document.createElement(e);for(let e in t)Object.hasOwn(t,e)&&a.setAttribute(e,t[e]);e===`script`&&(a.async=!1);let o=()=>{a.onload=null,a.onerror=null,n?.signal?.removeEventListener(`abort`,s)},s=()=>{o(),a.remove(),i(new DOMException(`Load aborted`,`AbortError`))};a.onload=()=>{o(),r()},a.onerror=()=>{o(),i(Error(`Failed to load ${t.src??t.href}`))},n?.signal?.addEventListener(`abort`,s,{once:!0}),document.head.appendChild(a)})}function E(e,t){return T(`script`,{src:e},t)}function D(e,t){return T(`link`,{href:e,rel:`stylesheet`},t)}function O(e,t,n){return new Promise((r,i)=>{if(n?.signal?.aborted){i(new DOMException(`Load aborted`,`AbortError`));return}let a=window,o=document.createElement(`script`),s=!1,c=()=>{s=!0,clearTimeout(d),o.remove(),a[t]===u&&delete a[t],n?.signal?.removeEventListener(`abort`,l)},l=()=>{s||(c(),i(new DOMException(`Load aborted`,`AbortError`)))},u=e=>{s||(c(),r(e))},d=setTimeout(()=>{s||(c(),i(Error(`JSONP request timed out: ${e}`)))},n?.timeout??15e3);a[t]=u,o.onerror=()=>{s||(c(),i(Error(`Failed to load ${e}`)))},n?.signal?.addEventListener(`abort`,l,{once:!0}),o.src=e,document.body.appendChild(o)})}var k={$schema:`http://json-schema.org/draft-07/schema#`,$id:`storymap.schema.json`,title:`StoryMapJS`,description:`StoryMapJS data format`,type:`object`,required:[`storymap`],properties:{storymap:{type:`object`,required:[`slides`],properties:{language:{type:`string`},map_type:{type:`string`,description:`Basemap type: osm:<style>, osm (classic raster), mapbox://styles/<user>/<style>, stadia:<style>, stamen:<style> (deprecated, remapped), https://... (tile url template or style JSON), iiif, ch-watercolor, zoomify (legacy image pyramid, needs the zoomify options).`},zoomify:{anyOf:[{type:`object`,properties:{path:{type:`string`},width:{type:`number`},height:{type:`number`},tolerance:{type:`number`},attribution:{type:`string`}}},{type:`boolean`}]},map_as_image:{type:`boolean`},map_mini:{type:`boolean`},map_subdomains:{type:`string`},map_access_token:{type:`string`},map_background_color:{type:`string`},map_options:{type:`object`,description:`OpenLayers passthrough options (view, controls, interactions); element replaces the map container`},map_bbox:{anyOf:[{type:`array`,items:{type:`number`},minItems:4,maxItems:4},{type:`null`}]},consent_required:{type:`boolean`},map_center_offset:{type:`object`,properties:{left:{type:`number`},top:{type:`number`}}},map_popup:{type:`boolean`},use_custom_markers:{type:`boolean`},zoom_distance:{type:`number`},calculate_zoom:{type:`boolean`},less_bounce:{type:`boolean`},line_follows_path:{type:`boolean`},show_lines:{type:`boolean`},show_history_line:{type:`boolean`},line_color:{type:`string`},line_color_inactive:{type:`string`},line_weight:{type:`number`},line_opacity:{type:`number`,minimum:0,maximum:1},line_dash:{type:`string`},line_join:{type:`string`},iiif:{type:`object`,required:[`url`],properties:{url:{type:`string`,description:`URL of the IIIF Image API info.json document`},attribution:{type:`string`}}},font_css:{type:`string`},call_to_action:{type:`boolean`},call_to_action_text:{type:`string`},fullscreen:{type:`boolean`},show_overview:{type:`boolean`},show_back_to_start:{type:`boolean`},show_progress:{type:`boolean`},show_distance:{type:`boolean`},marker_labels:{type:`boolean`},text_align:{type:`string`},text_color:{type:`string`},text_background_color:{type:`string`},nocache:{type:`boolean`},autoplay:{type:`number`,description:`Seconds per slide; 0 disables autoplay`},trackResize:{type:`boolean`},dragging:{type:`boolean`},duration:{type:`number`},map_overview_center:{anyOf:[{type:`object`,properties:{lat:{type:`number`},lon:{type:`number`}}},{type:`null`}]},api_key_flickr:{type:`string`},attribution:{type:`string`},start_at_slide:{type:`integer`,minimum:0},slides:{type:`array`,items:{$ref:`#/$defs/slide`}}}}},$defs:{slide:{type:`object`,properties:{type:{type:`string`,description:`'overview' marks the map overview slide`},date:{type:[`string`,`object`,`null`]},group:{type:`string`},location:{type:`object`,properties:{lat:{type:`number`,description:`Latitude, or vertical position in image pixels for image maps`},lon:{type:`number`,description:`Longitude, or horizontal position in image pixels for image maps`},zoom:{type:`number`},line:{type:`boolean`},name:{type:`string`},icon:{type:`string`,format:`uri`},iconSize:{type:`array`,items:{type:`number`},minItems:1,maxItems:2},image:{type:`string`,format:`uri`},use_custom_marker:{type:`boolean`}}},media:{type:`object`,properties:{url:{type:[`string`,`null`]},caption:{type:[`string`,`null`]},credit:{type:[`string`,`null`]},thumb:{type:`string`},mediatype:{type:[`object`,`null`]}}},text:{type:`object`,properties:{headline:{type:`string`},text:{type:`string`},date:{type:[`string`,`object`,`null`]}}},background:{type:[`object`,`string`],properties:{url:{type:[`string`,`null`],format:`uri`},color:{type:[`string`,`null`]}}},uniqueid:{type:`string`}}}}};function ee(e,t){return(Array.isArray(t)?t:[t]).some(t=>{switch(t){case`object`:return typeof e==`object`&&!!e&&!Array.isArray(e);case`array`:return Array.isArray(e);case`string`:return typeof e==`string`;case`number`:return typeof e==`number`&&!isNaN(e);case`integer`:return typeof e==`number`&&Number.isInteger(e);case`boolean`:return typeof e==`boolean`;case`null`:return e===null;case`uri`:return typeof e==`string`;default:return!0}})}function te(e,t,n,r){if(t&&typeof t==`object`){if(t.$ref){let i=t.$ref.replace(/^#\//,``).replaceAll(`~1`,`/`).replaceAll(`~0`,`~`),a=k;for(let e of i.split(`/`))a=a[e];te(e,a,n,r);return}if(t.type&&!ee(e,t.type)){let i=Array.isArray(t.type)?t.type.join(` or `):t.type;r.push({path:n,message:`expected ${i}, got ${e===null?`null`:typeof e}`});return}if(t.enum&&!t.enum.some(t=>t===e)&&r.push({path:n,message:`must be one of ${t.enum.map(e=>JSON.stringify(e)).join(`, `)}`}),typeof e==`number`&&(t.minimum!==void 0&&e<t.minimum&&r.push({path:n,message:`must be >= ${t.minimum}`}),t.maximum!==void 0&&e>t.maximum&&r.push({path:n,message:`must be <= ${t.maximum}`})),typeof e==`string`&&(t.minLength!==void 0&&e.length<t.minLength&&r.push({path:n,message:`must be at least ${t.minLength} characters`}),t.pattern!==void 0&&!new RegExp(t.pattern).test(e)&&r.push({path:n,message:`must match ${t.pattern}`})),Array.isArray(e)&&(t.minItems!==void 0&&e.length<t.minItems&&r.push({path:n,message:`must have at least ${t.minItems} items`}),t.maxItems!==void 0&&e.length>t.maxItems&&r.push({path:n,message:`must have at most ${t.maxItems} items`}),t.items&&e.forEach((e,i)=>te(e,t.items,`${n}[${i}]`,r))),typeof e==`object`&&e&&!Array.isArray(e)){let i=e;if(t.required)for(let e of t.required)e in i||r.push({path:n,message:`missing required property "${e}"`});if(t.properties)for(let[e,a]of Object.entries(t.properties))e in i&&te(i[e],a,`${n}.${e}`,r)}}}function ne(e){let t=[];return typeof e!=`object`||!e||Array.isArray(e)?[{path:``,message:`storymap data must be a JSON object`}]:`storymap`in e?(te(e,k,``,t),t):[{path:``,message:`missing required property "storymap"`}]}function re(e,t){let n=ne(e);if(n.length===0)return!0;console.error(`StoryMapJS: invalid storymap data${t?` (${t})`:``} - ${n.length} error${n.length>1?`s`:``} found:`);for(let e of n)console.error(` ${e.path||`(root)`}: ${e.message}`);return!1}var ie=`iiif.io/api/presentation/3/context.json`,ae=`mapconfig`,oe=`storymap:`,se=[`name`,`zoom`,`line`,`icon`,`iconSize`,`image`,`use_custom_marker`];function ce(e){return typeof e!=`object`||!e||Array.isArray(e)?null:e}function le(e){return typeof e==`string`&&e!==``?e:null}function ue(e){return typeof e==`number`&&!isNaN(e)?e:null}function de(e){return typeof e==`boolean`?e:null}function fe(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function pe(e){if(typeof e==`string`)return e;let t=ce(e);if(!t)return``;let n=t.value;if(typeof n==`string`)return n;if(Array.isArray(n))return fe(n).join(` `).trim();let r=`none`in t?[`none`]:Object.keys(t),i=[];for(let e of r)i.push(...fe(t[e]));return i.join(` `).trim()}function A(e,t){let n=e[oe+t];return n===void 0?t===`type`?void 0:e[t]:n}function me(e){let t=ce(e);if(!t)return!1;if(t.type===`Manifest`)return!0;let n=t[`@context`];return(Array.isArray(n)?n:[n]).some(e=>typeof e==`string`&&e.includes(ie))}function he(e){let t=Array.isArray(e.service)?e.service:[e.service];for(let e of t){let t=ce(e);if(!t)continue;let n=le(t.profile);if(n!==null&&n.includes(ae))return t}return null}function ge(e){let t=Array.isArray(e.items)?e.items:[];for(let e of t){let t=ce(e);if(!t)continue;let n=Array.isArray(t.items)?t.items:[];for(let e of n){let t=ce(e);if(!t)continue;let n=le(t.motivation);if(n!==null&&n!==`painting`)continue;let r=_e(t.body);if(r!==null)return r}}return null}function _e(e){if(Array.isArray(e)){for(let t of e){let e=_e(t);if(e!==null)return e}return null}let t=ce(e);if(!t)return null;let n=le(t.id);if(n!==null)return n;let r=le(t.value);return r===null?null:r}function ve(e){let t=ce(e);if(!t)return null;let n=Array.isArray(t.features)?t.features:[];for(let e of n){let t=ye(e);if(t!==null)return t}return null}function ye(e){let t=ce(e);if(!t)return null;let n=ce(t.geometry);if(!n||le(n.type)!==`Point`)return null;let r=Array.isArray(n.coordinates)?n.coordinates:[],i=ue(r[0]),a=ue(r[1]);if(i===null||a===null)return null;let o={lat:a,lon:i},s=ce(t.properties);if(s){let e=o;for(let t of se){let n=s[t];n!=null&&n!==``&&(e[t]=n)}}return o}function be(e){let t=ce(e);if(t){let e={},n=le(t.url),r=le(t.color);return n!==null&&(e.url=n),r!==null&&(e.color=r),Object.keys(e).length>0?e:null}return typeof e==`string`&&e!==``?e:null}function xe(e,t){let n=ce(e);if(!n)return null;let r={},i=pe(n.label),a=pe(n.summary);(i!==``||a!==``)&&(r.text={},i!==``&&(r.text.headline=i),a!==``&&(r.text.text=a));let o=ge(n),s=le(A(n,`mediaCaption`)),c=le(A(n,`mediaCredit`));if(o!==null||s!==null||c!==null){let e={};o!==null&&(e.url=o),s!==null&&(e.caption=s),c!==null&&(e.credit=c),r.media=e}let l=ve(n.navPlace)??ye(t);l!==null&&(r.location=l);let u=le(n[`storymap:type`]);u!==null&&(r.type=u);let d=A(n,`date`),f=le(d),p=ce(d);f===null?p!==null&&(r.date=p):r.date=f;let m=be(A(n,`background`));return m!==null&&(r.background=m),r}function Se(e){let t={slides:[]},n=ce(e);if(!n)return t;let r=pe(n.label);r!==``&&(t.title=r);let i=he(n);i&&Ce(t,i);let a=ce(n.requiredStatement),o=a?pe(a.value):``;if(o!==``){let e=t.iiif??{};e.attribution=o,e.url===void 0&&(e.url=``),t.iiif=e}let s=Array.isArray(n.items)?n.items:[],c=ce(n.navPlace),l=c&&Array.isArray(c.features)?c.features:[];for(let e=0;e<s.length;e++){let n=xe(s[e],l[e]);n!==null&&t.slides.push(n)}return t}function Ce(e,t){let n=le(A(t,`mapType`));n!==null&&n!==``&&(e.map_type=n);let r=de(A(t,`mapAsImage`));r!==null&&(e.map_as_image=r);let i=le(A(t,`mapAccessToken`));i!==null&&(e.map_access_token=i);let a=le(A(t,`mapBackgroundColor`));a!==null&&(e.map_background_color=a);let o=ce(A(t,`mapCenterOffset`));if(o){let t=ue(o.left),n=ue(o.top);t!==null&&n!==null&&(e.map_center_offset={left:t,top:n})}let s=le(A(t,`mapSubdomains`));s!==null&&(e.map_subdomains=s);let c=le(A(t,`iiifUrl`));c!==null&&(e.iiif={url:c,attribution:``});let l=le(A(t,`fontCss`));l!==null&&(e.font_css=l);let u=de(A(t,`callToAction`));u!==null&&(e.call_to_action=u);let d=le(A(t,`callToActionText`));d!==null&&(e.call_to_action_text=d);let f=ue(A(t,`startAtSlide`));f!==null&&(e.start_at_slide=f);let p=le(A(t,`language`));p!==null&&(e.language=p);let m=de(A(t,`calculateZoom`));m!==null&&(e.calculate_zoom=m);let h=de(A(t,`lessBounce`));h!==null&&(e.less_bounce=h);let g=de(A(t,`lineFollowsPath`));g!==null&&(e.line_follows_path=g);let _=de(A(t,`showLines`));_!==null&&(e.show_lines=_);let v=de(A(t,`showHistoryLine`));v!==null&&(e.show_history_line=v);let y=le(A(t,`lineColor`));y!==null&&(e.line_color=y);let b=le(A(t,`lineColorInactive`));b!==null&&(e.line_color_inactive=b);let x=ue(A(t,`lineWeight`));x!==null&&(e.line_weight=x);let S=ue(A(t,`lineOpacity`));S!==null&&(e.line_opacity=S);let C=le(A(t,`lineDash`));C!==null&&(e.line_dash=C);let w=le(A(t,`lineJoin`));w!==null&&(e.line_join=w);let T=de(A(t,`useCustomMarkers`));T!==null&&(e.use_custom_markers=T)}function we(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)r!==`__proto__`&&(e[r]=n[r])}return e}var Te={read:function(e){return e[0]===`"`&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Ee(e,t){function n(n,r,i){if(typeof document<`u`){i=we({},t,i),typeof i.expires==`number`&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a=``;for(var o in i)i[o]&&(a+=`; `+o,i[o]!==!0&&(a+=`=`+i[o].split(`;`)[0]));return document.cookie=n+`=`+e.write(r,n)+a}}function r(t){if(!(typeof document>`u`||arguments.length&&!t)){for(var n=document.cookie?document.cookie.split(`; `):[],r={},i=0;i<n.length;i++){var a=n[i].split(`=`),o=a.slice(1).join(`=`);try{var s=decodeURIComponent(a[0]);if(s in r||(r[s]=e.read(o,s)),t===s)break}catch{}}return t?r[t]:r}}return Object.create({set:n,get:r,remove:function(e,t){n(e,``,we({},t,{expires:-1}))},withAttributes:function(e){return Ee(this.converter,we({},this.attributes,e))},withConverter:function(e){return Ee(we({},this.converter,e),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var De=Ee(Te,{path:`/`}),Oe={"./locale/be.json":{default:{name:`Беларуская`,lang:`be`,messages:{loading:`Загрузка`,wikipedia:`Вікіпедыя`,start:`Start Exploring`},buttons:{map_overview:`Прагляд мапы`,overview:`Прагляд`,backtostart:`Вярнуцца ў пачатак`,collapse_toggle:`Схаваць мапу`,uncollapse_toggle:`Паказаць мапу`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/bg.json":{default:{name:`Български`,lang:`bg`,messages:{loading:`Зареждане`,wikipedia:`От Уикипедия, свободната енциклопедия`,start:`Започнете да разглеждате`},buttons:{map_overview:`Преглед на картата`,overview:`Преглед`,backtostart:`Към началото`,collapse_toggle:`Скриване на картата`,uncollapse_toggle:`Показване на картата`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/cs.json":{default:{name:`Čeština`,lang:`cs`,messages:{loading:`Nahrávání`,wikipedia:`Z Wikipedie, svobodné encyklopedie`,start:`Prozkoumat`},buttons:{map_overview:`Přehledová mapa`,overview:`Přehled`,backtostart:`Zpět na začátek`,collapse_toggle:`Skrýt mapu`,uncollapse_toggle:`Zobrazit mapu`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/de.json":{default:{name:`Deutsch`,lang:`de`,messages:{loading:`Daten werden geladen`,wikipedia:`von Wikipedia, der freien Enzyklopädie`,start:`Explore`},buttons:{map_overview:`Kartenübersicht`,overview:`Kartenübersicht`,backtostart:`Zurück zum Anfang`,collapse_toggle:`Karte ausblenden`,uncollapse_toggle:`Karte anzeigen`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/el.json":{default:{name:`Ελληνικά`,lang:`el`,messages:{loading:`Φόρτωση`,wikipedia:`Από την Wikipedia, την ελεύθερη εγκυκλοπαίδεια`,start:`Έναρξη περιήγησης`},buttons:{map_overview:`Επισκόπηση χάρτη`,overview:`Επισκόπηση`,backtostart:`Επιστροφή στην αρχή`,collapse_toggle:`Απόκρυψη χάρτη`,uncollapse_toggle:`Εμφάνιση χάρτη`,swipe_to_navigate:`Κτυπήστε ελαφρά για περιήγηση<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/en.json":{default:{name:`English`,lang:`en`,messages:{error:`Error loading`,loading:`Loading`,wikipedia:`From Wikipedia, the free encyclopedia`,start:`Start Exploring`,consent_title:`External content`,consent_message:`Load content from {service}?`,consent_allow:`Allow`,consent_deny:`Deny`,consent_blocked:`Content from {service} is blocked.`,consent_service_tiles:`map tiles`,consent_service_fonts:`web fonts`},buttons:{map_overview:`Map Overview`,overview:`Overview`,backtostart:`Back To Beginning`,collapse_toggle:`Hide Map`,uncollapse_toggle:`Show Map`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`,fullscreen:`Full Screen`,exit_fullscreen:`Exit Full Screen`},direction:`ltr`}},"./locale/es.json":{default:{name:`Español`,lang:`es`,messages:{loading:`cargando`,wikipedia:`de Wikipedia, la enciclopedia libre`,start:`Explore`},buttons:{map_overview:`vista general del mapa`,overview:`vista general`,backtostart:`volver al comienzo`,collapse_toggle:`ocultar mapa`,uncollapse_toggle:`mostrar mapa`,swipe_to_navigate:`Deslizar para navegar<br><span class='vco-button'>Entendido</span>`},direction:`ltr`}},"./locale/et.json":{default:{name:`eesti`,lang:`et`,messages:{loading:`Laadib`,wikipedia:`Vikipeedia, vaba entsüklopeedia`,start:`Uuri`},buttons:{map_overview:`Kaardi ülevaade`,overview:`Ülevaade`,backtostart:`Tagasi algusesse`,collapse_toggle:`Peida kaart`,uncollapse_toggle:`Näita kaarti`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/fr.json":{default:{name:`Français`,lang:`fr`,messages:{loading:`Chargement`,wikipedia:`Extrait de Wikipédia, l'encyclopédie libre`,start:`Explore`},buttons:{map_overview:`Vue d'ensemble de la carte`,overview:`Vue d'ensemble`,backtostart:`Retourner au point de départ`,collapse_toggle:`Masquer la carte`,uncollapse_toggle:`Afficher la carte`,swipe_to_navigate:`Faites glisser pour naviguer<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/he.json":{default:{name:`עברית`,lang:`he`,direction:`rtl`,messages:{loading:`טוען`,wikipedia:`מתוך ויקיפדיה, האנציקלופדיה החופשית`,start:`התחל במסע`},buttons:{map_overview:`המפה במלואה`,overview:`תצוגה מקדימה`,backtostart:`חזור להתחלה`,collapse_toggle:`הסתר מפה`,uncollapse_toggle:`הצג מפה`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`}}},"./locale/hu.json":{default:{name:`Magyar`,lang:`hu`,messages:{loading:`töltés`,wikipedia:`Wikipedia`,start:`Indítsd`},buttons:{map_overview:`teljes térkép`,overview:`teljes sztori`,backtostart:`vissza az elejére`,collapse_toggle:`összecsuk`,uncollapse_toggle:`kinyit`,swipe_to_navigate:`Húzd el a navigációhoz<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/is.json":{default:{name:`Icelandic`,lang:`is`,messages:{loading:`Hleðsla`,wikipedia:`Frá Wikipedia`,start:`Hefja`},buttons:{map_overview:`Kortayfirlit`,overview:`Yfirlit`,backtostart:`Hefja aftur`,collapse_toggle:`Fela kortið`,uncollapse_toggle:`Sýna kortið`,swipe_to_navigate:`Strjúktu fyrir valmynd<br><span class='vco-button'>Allt í lagi</span>`},direction:`ltr`}},"./locale/it.json":{default:{name:`Italiano`,lang:`it`,messages:{loading:`caricare`,wikipedia:`da Wikipedia, la enciclopedia libera`,start:`Explore`},buttons:{map_overview:`vista generale della mappa`,overview:`vista generale`,backtostart:`tornare all' inizio`,collapse_toggle:`nascondere mappa`,uncollapse_toggle:`mostrare mappa`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/jp.json":{default:{name:`日本語`,lang:`jp`,messages:{loading:`ローディング`,wikipedia:`フリー百科事典ウィキペディア(Wikipedia)から`,start:`Explore`},buttons:{map_overview:`概観地図`,overview:`概観`,backtostart:`初めに戻る`,collapse_toggle:`地図を隠す`,uncollapse_toggle:`地図を表示`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/ko.json":{default:{name:`한국어`,lang:`ko`,messages:{loading:`불러오는중`,wikipedia:`위키피디아`,start:`시작하기`},buttons:{map_overview:`지도 전체보기`,overview:`전체보기`,backtostart:`되돌아가기`,collapse_toggle:`숨기기`,uncollapse_toggle:`보이기`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/nl.json":{default:{name:`Nederlands`,lang:`nl`,messages:{loading:`Laden`,wikipedia:`Van Wikipedia, de gratis encyclopedie`,start:`Start Exploring`},buttons:{map_overview:`Kaart overzicht`,overview:`Overzicht`,backtostart:`Terug naar begin`,collapse_toggle:`Verberg kaart`,uncollapse_toggle:`Toon kaart`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/nn.json":{default:{name:`Norsk nynorsk`,lang:`nn`,messages:{loading:`Lastar inn`,wikipedia:`Frå Wikipedia, det frie oppslagsverket`,start:`Utforsk`},buttons:{map_overview:`Sjå oversiktskart`,overview:`Oversikt`,backtostart:`Til starten`,collapse_toggle:`Gøym kartet`,uncollapse_toggle:`Vis kartet`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/no.json":{default:{name:`Norsk`,lang:`no`,messages:{loading:`Laster inn`,wikipedia:`fra Wikipedia, den frie encyklopedi`,start:`Explore`},buttons:{map_overview:`Se oversiktskart`,overview:`Se oversiktskart`,backtostart:`Til begynnelsen`,collapse_toggle:`Skjul kartet`,uncollapse_toggle:`Vis kartet`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/pl.json":{default:{name:`Polski`,lang:`pl`,messages:{loading:`Wczytuję`,wikipedia:`z Wikipedii, wolnej encyklopedii`,start:`Explore`},buttons:{map_overview:`Przeglądaj mapę`,overview:`Przeglądaj`,backtostart:`Powrót`,collapse_toggle:`Ukryj mapę`,uncollapse_toggle:`Pokaż mapę`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/pt.json":{default:{name:`Português`,lang:`pt`,messages:{loading:`carregando`,wikipedia:`de Wikipedia, a enciclopédia livre`,start:`início`},buttons:{map_overview:`vista geral do mapa`,overview:`vista geral`,backtostart:`voltar ao início`,collapse_toggle:`ocultar mapa`,uncollapse_toggle:`mostrar mapa`,swipe_to_navigate:`Deslize para navegar<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/ru.json":{default:{name:`Русский`,lang:`ru`,messages:{loading:`Загрузка`,wikipedia:`Из Википедии, свободной энциклопедии`,start:`Начать просмотр`},buttons:{map_overview:`Просмотр карты`,overview:`Обзор`,backtostart:`К началу`,collapse_toggle:`Скрыть карту`,uncollapse_toggle:`Показать карту`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/sk.json":{default:{name:`Slovenčina`,lang:`sk`,messages:{loading:`Nahrávanie`,wikipedia:`Z Wikipédie, slobodnej encyklopédie`,start:`Preskúmať`},buttons:{map_overview:`Prehľadová mapa`,overview:`Prehľad`,backtostart:`Späť na začiatok`,collapse_toggle:`Skryť mapu`,uncollapse_toggle:`Zobraziť mapu`,swipe_to_navigate:`Navigujte potiahnutím prsta<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/sr.json":{default:{name:`Srpski`,lang:`sr`,messages:{loading:`Učitavanje`,wikipedia:`Wikipedia`,start:`Explore`},buttons:{map_overview:`Pregled mapę`,backtostart:`Nazad na početak`,collapse_toggle:`Sakrij mapu`,uncollapse_toggle:`Prikaži mapu`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/sv.json":{default:{name:`Svenska`,lang:`sv`,messages:{loading:`Laddar`,wikipedia:`Från Wikipedia, den fria encyklopedin`,start:`Explore`},buttons:{map_overview:`Översiktskarta`,overview:`Översikt`,backtostart:`Tillbaka till början`,collapse_toggle:`Göm kartan`,uncollapse_toggle:`Visa kartan`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/tr.json":{default:{name:`Türkçe`,lang:`tr`,messages:{loading:`Yükleniyor`,wikipedia:`Vikipedi, Özgür Ansiklopedi`,start:`Keşfet`},buttons:{map_overview:`Genel harita`,overview:`Genel harita`,backtostart:`Başlangıç menüsüne dön`,collapse_toggle:`Menüyü gizle`,uncollapse_toggle:`Menüyü göster`,swipe_to_navigate:`Dokun ve kaydır<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/uk.json":{default:{name:`Українська`,lang:`uk`,messages:{loading:`Завантаження`,wikipedia:`З Вікіпедії, вільної енциклопедії`,start:`Почати перегляд`},buttons:{map_overview:`Перегляд карти`,overview:`Огляд`,backtostart:`Повернутися до початку`,collapse_toggle:`Приховати карту`,uncollapse_toggle:`Показати карту`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/ur.json":{default:{name:`Urdu`,lang:`ur`,direction:`rtl`,messages:{loading:`لوڈ ہو رہا ہے`,wikipedia:`ویکیپیڈیا, مفت دستیاب انسائیکلوپیڈیا سے `,start:`دریافت شروع کی جایے `},buttons:{map_overview:`نقشے کا جائزہ`,overview:`جائزہ`,backtostart:`واپس شروع سے`,collapse_toggle:`نقشہ غائب`,uncollapse_toggle:`نقشہ حاضر`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`}}},"./locale/zh-cn.json":{default:{name:`中文`,lang:`zh-cn`,messages:{loading:`加载中`,wikipedia:`来自维基百科,自由的百科全书`,start:`Explore`},buttons:{map_overview:`地图总览`,overview:`总览`,backtostart:`回到首页`,collapse_toggle:`隐藏地图`,uncollapse_toggle:`显示地图`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/zh-tw.json":{default:{name:`正體中文`,lang:`zh-tw`,messages:{loading:`載入中`,wikipedia:`來自維基百科,自由的百科全書`,start:`探索`},buttons:{map_overview:`地圖總覽`,overview:`總覽`,backtostart:`回到首頁`,collapse_toggle:`隱藏地圖`,uncollapse_toggle:`顯示地圖`,swipe_to_navigate:`左右滑動以瀏覽<br><span class='vco-button'>我知道了</span>`},direction:`ltr`}}},ke=Oe[`./locale/en.json`]?.default||{},j={};function Ae(e){let t=structuredClone(Oe[`./locale/${e}.json`]?.default||{});for(let e in ke)t[e]?typeof ke[e]==`object`&&(t[e]=Object.assign(ke[e],t[e])):t[e]=ke[e];return t}function je(e){return j=Ae(e),j}var Me=`storymapjs-consent`,Ne=90,Pe=class{granted=new Set;denied=new Set;pending=new Map;constructor(){this.restore()}restore(){try{let e=De.get(Me);if(!e)return;let t=JSON.parse(e);for(let e in t)Object.hasOwn(t,e)&&(t[e]?this.granted.add(e):this.denied.add(e))}catch{}}persist(){let e={};for(let t of this.granted)e[t]=!0;for(let t of this.denied)e[t]=!1;try{De.set(Me,JSON.stringify(e),{expires:Ne,sameSite:`Lax`})}catch{}}isGranted(e){return this.granted.has(e)}isDenied(e){return this.denied.has(e)}request(e,t,n){return this.granted.has(e)?Promise.resolve(!0):this.denied.has(e)?Promise.resolve(!1):new Promise(r=>{let i=j.messages??{},a=document.createElement(`div`);a.className=`vco-consent`;let o=document.createElement(`p`);o.className=`vco-consent-title`,o.textContent=i.consent_title??`External content`;let s=document.createElement(`p`);s.className=`vco-consent-message`,s.textContent=(i.consent_message??`Load content from {service}?`).replace(`{service}`,e)+(t?` (${t})`:``);let c=document.createElement(`div`);c.className=`vco-consent-buttons`;let l=document.createElement(`button`);l.className=`vco-consent-allow`,l.textContent=i.consent_allow??`Allow`;let u=document.createElement(`button`);u.className=`vco-consent-deny`,u.textContent=i.consent_deny??`Deny`;let d=this.pending.get(e)??[];d.push({el:a,resolve:r}),this.pending.set(e,d);let f=t=>{t?this.granted.add(e):this.denied.add(e);for(let n of this.pending.get(e)??[])n.el.remove(),n.resolve(t);this.pending.delete(e),this.persist()};l.addEventListener(`click`,()=>f(!0)),u.addEventListener(`click`,()=>f(!1)),c.append(l,u),a.append(o,s,c),n.append(a)})}};function Fe(e){return e?.consent_manager}function Ie(e,t){return(j.messages??{})[e]??t}var M=class{static get(e){return typeof e==`string`?document.getElementById(e):e}static create(e,t,n){let r=document.createElement(e);return r.className=t,n&&n.appendChild(r),r}static getPosition(e){let t={x:0,y:0};for(;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t.x+=e.offsetLeft,t.y+=e.offsetTop,e=e.offsetParent;return t}},Le=3;(function e(t){t=+t;function n(e){return e**+t}return n.exponent=e,n})(Le),(function e(t){t=+t;function n(e){return 1-(1-e)**t}return n.exponent=e,n})(Le);var Re=(function e(t){t=+t;function n(e){return((e*=2)<=1?e**+t:2-(2-e)**t)/2}return n.exponent=e,n})(Le);function ze(e){return(2**(-10*e)-.0009765625)*1.0009775171065494}function Be(e){return 1-ze(e)}function Ve(e){return e}var{cbrt:He,sqrt:Ue,PI:We}=Math,Ge=(e,t,n,r,i)=>{let a=t+n*e,o=a**2+r;if(o>0){let e=Ue(o);return He(a+e)+He(a-e)-i}let s=He(Ue(-r)),c=a?Math.atan(Ue(-o)/a):-We/2,l;return l=n<0?(a>0?2*We:We)-c:i<0?(a>0?2*We:-3*We)+c:(a>0?0:We)+c,2*s*Math.cos(l/3)-i},Ke=(e,t,n,r)=>((t*e+3*n)*e+r)*e;function qe(e,t,n,r){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw Error(`bezier x values must be in [0, 1] range`);if(e===t&&n===r)return Ve;let i=6*(3*e-3*n+1),a=6*(n-2*e),o=3*e,s=i*i,c=a*a,l=a/i,u=3*a*o/s-c*a/(s*i),d=2*o/i-c/s,f=d*d*d,p=3/i,m=3*t-3*r+1,h=r-2*t,g=3*t,_=i?Ge:Ve;return function(e){return e===0||e===1?e:Ke(_(e,u,p,f,l),m,h,g)}}var Je=Re.exponent(5),Ye=Be,Xe=qe(.42,0,1,1);function Ze(e){return class extends e{on(e,t,n){let r=this._vco_events=this._vco_events||{};return r[e]=r[e]||[],r[e].push({action:t,context:n||this}),this}hasEventListeners(e){return!!this._vco_events?.[e]?.length}off(e,t,n){if(!this.hasEventListeners(e))return this;let r=this._vco_events;for(let i=0,a=r[e].length;i<a;i++)if(r[e][i].action===t&&(!n||r[e][i].context===n))return r[e].splice(i,1),this;return this}fire(e,t,n){if(!this.hasEventListeners(e))return this;let r={type:e,target:n||this,...t},i=this._vco_events[e].slice();for(let e of i)e.action.call(e.context||this,r);return this}constructor(...e){super(...e)}}}function Qe(e){return class extends e{show(e){e||(this._el.container.style.display=`block`)}hide(){this._el.container.style.display=`none`}addTo(e){return e.appendChild(this._el.container),this.onAdd(),this}removeFrom(e){return e.removeChild(this._el.container),this.onRemove(),this}setPosition(e,t){let n=t||this._el.container;for(let t of Object.keys(e))n.style[t]=e[t]+`px`;return this}onLoaded(){this.fire(`loaded`,this.data)}onAdd(){this.fire(`added`,this.data)}onRemove(){this.fire(`removed`,this.data)}constructor(...e){super(...e)}}}var $e={ADD:`add`,REMOVE:`remove`},et={PROPERTYCHANGE:`propertychange`};function tt(e){for(let t in e)delete e[t]}function nt(e){let t;for(t in e)return!1;return!t}function N(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function rt(e,t,n,r){return N(e,t,n,r,!0)}function it(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),tt(e))}var P={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},at=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function ot(e,t,n){let r,i;n||=st;let a=0,o=e.length,s=!1;for(;a<o;)r=a+(o-a>>1),i=+n(e[r],t),i<0?a=r+1:(o=r,s=!i);return s?a:~a}function st(e,t){return e>t?1:e<t?-1:0}function ct(e,t){return e<t?1:e>t?-1:0}function lt(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i<r;++i){let r=e[i];if(r===t)return i;if(r<t)return n(t,e[i-1],r)>0?i-1:i}return r-1}if(n>0){for(let n=1;n<r;++n)if(e[n]<t)return n-1;return r-1}if(n<0){for(let n=1;n<r;++n)if(e[n]<=t)return n;return r-1}for(let n=1;n<r;++n){if(e[n]==t)return n;if(e[n]<t)return e[n-1]-t<t-e[n]?n-1:n}return r-1}function ut(e,t,n){for(;t<n;){let r=e[t];e[t]=e[n],e[n]=r,++t,--n}}function dt(e,t){let n=Array.isArray(t)?t:[t],r=n.length;for(let t=0;t<r;t++)e[e.length]=n[t]}function ft(e,t){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function pt(e,t,n){let r=t||st;return e.every(function(t,i){if(i===0)return!0;let a=r(e[i-1],t);return!(a>0||n&&a===0)})}function mt(){return!0}function ht(){return!1}function gt(){}function _t(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!ft(i,n))&&(r=this,n=i,t=e.apply(this,arguments)),t}}function vt(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}return t()}var yt=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},bt=class extends at{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new yt(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e<t;++e)if(s=`handleEvent`in r[e]?r[e].handleEvent(i):r[e].call(this,i),s===!1||i.propagationStopped){s=!1;break}if(--a[n]===0){let e=o[n];for(delete o[n];e--;)this.removeEventListener(n,gt);delete a[n]}return s}disposeInternal(){this.listeners_&&tt(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=gt,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},xt=class extends bt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(P.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=N(this,e[i],t);return r}return N(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=Array(r);for(let i=0;i<r;++i)n[i]=rt(this,e[i],t)}else n=rt(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)St(n);else if(Array.isArray(e))for(let n=0,r=e.length;n<r;++n)this.removeEventListener(e[n],t);else this.removeEventListener(e,t)}};xt.prototype.on,xt.prototype.once,xt.prototype.un;function St(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)it(e[t]);else it(e)}function F(){throw Error(`Unimplemented abstract method.`)}var Ct=0;function I(e){return e.ol_uid||=String(++Ct)}var wt=class extends yt{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},Tt=class extends xt{constructor(e){super(),this.on,this.once,this.un,I(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new wt(n,e,t)),n=et.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new wt(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||={};if(n)r[e]=t;else{let n=r[e];r[e]=t,n!==t&&this.notify(e,n)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||={},e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],nt(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},Et={LENGTH:`length`},Dt=class extends yt{constructor(e,t,n){super(e),this.element=t,this.index=n}},Ot=class extends Tt{constructor(e,t){if(super(),this.on,this.once,this.un,t||={},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let e=1,t=this.array_.length;e<t;++e)this.assertUnique_(this.array_[e],e);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(Et.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Dt($e.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Dt($e.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength()){this.insertAt(e,t);return}if(e<0)throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t,e);let n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Dt($e.REMOVE,n,e)),this.dispatchEvent(new Dt($e.ADD,t,e))}updateLength_(){this.set(Et.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;r<i;++r)if(n[r]===e&&r!==t)throw Error(`Duplicate item added to a unique collection`)}},kt=class extends yt{constructor(e,t,n){super(e),this.map=t,this.frameState=n===void 0?null:n}},At=class extends kt{constructor(e,t,n,r,i,a){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0&&r,this.activePointers=a}get pixel(){return this.pixel_||=this.map.getEventPixel(this.originalEvent),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||=this.map.getCoordinateFromPixel(this.pixel),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),`preventDefault`in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),`stopPropagation`in this.originalEvent&&this.originalEvent.stopPropagation()}},jt={SINGLECLICK:`singleclick`,CLICK:P.CLICK,DBLCLICK:P.DBLCLICK,POINTERDRAG:`pointerdrag`,POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},Mt=typeof navigator<`u`&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():``;Mt.includes(`safari`)&&!Mt.includes(`chrom`)&&(Mt.includes(`version/15.4`)||/cpu (os|iphone os) 15_4 like mac os x/.test(Mt));var Nt=Mt.includes(`webkit`)&&!Mt.includes(`edge`),Pt=Mt.includes(`macintosh`),Ft=typeof devicePixelRatio<`u`?devicePixelRatio:1,It=typeof WorkerGlobalScope<`u`&&typeof OffscreenCanvas<`u`&&self instanceof WorkerGlobalScope,Lt=typeof Image<`u`&&Image.prototype.decode,Rt=(function(){let e=!1;try{let t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener(`_`,null,t),window.removeEventListener(`_`,null,t)}catch{}return e})(),zt={POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},Bt=class extends bt{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=N(n,zt.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=N(n,zt.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_,Rt?{passive:!1}:!1)}emulateClick_(e){let t=new At(jt.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_===void 0?this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let t=new At(jt.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new At(jt.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==jt.POINTERUP||t.type==jt.POINTERCANCEL){delete this.trackedTouches_[n];for(let e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else(t.type==jt.POINTERDOWN||t.type==jt.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new At(jt.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new At(jt.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let e=this.map_.getOwnerDocument();this.dragListenerKeys_.push(N(e,jt.POINTERMOVE,this.handlePointerMove_,this),N(e,jt.POINTERUP,this.handlePointerUp_,this),N(this.element_,jt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==e&&this.dragListenerKeys_.push(N(this.element_.getRootNode(),jt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new At(jt.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new At(jt.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!=`boolean`||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&=(it(this.relayedListenerKey_),null),this.element_.removeEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(it(this.pointerdownListenerKey_),null),this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Vt={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},Ht={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},L={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function R(e,t){if(!e)throw Error(t)}var Ut=1/0,Wt=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,tt(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){R(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=1/0&&(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,i=t[e],a=n[e],o=e;for(;e<r>>1;){let i=this.getLeftChildIndex_(e),a=this.getRightChildIndex_(e),o=a<r&&n[a]<n[i]?a:i;t[e]=t[o],n[e]=n[o],e=o}t[e]=i,n[e]=a,this.siftDown_(o,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,i=n[t],a=r[t];for(;t>e;){let e=this.getParentIndex_(t);if(r[e]>a)n[t]=n[e],r[t]=r[e],t=e;else break}n[t]=i,r[t]=a}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,i=t.length,a,o,s;for(o=0;o<i;++o)a=t[o],s=e(a),s==1/0?delete this.queuedElements_[this.keyFunction_(a)]:(n[r]=s,t[r++]=a);t.length=r,n.length=r,this.heapify_()}},Gt=class extends Wt{constructor(e,t){super(t=>e.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(P.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===L.LOADED||n===L.ERROR||n===L.EMPTY){n!==L.ERROR&&t.removeEventListener(P.CHANGE,this.boundHandleTileChange_);let e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let e=this.dequeue()[0],t=e.getKey();e.getState()===L.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function Kt(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return Ut;let a=e.viewState.center,o=r[0]-a[0],s=r[1]-a[1];return 65536*Math.log(i)+Math.sqrt(o*o+s*s)/i}var qt={ANIMATING:0,INTERACTING:1},Jt={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function Yt(e,t,n){return Math.min(Math.max(e,t),n)}function Xt(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return Zt(e,t,n,r)}function Zt(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function Qt(e){let t=e.length;for(let n=0;n<t;n++){let r=n,i=Math.abs(e[n][n]);for(let a=n+1;a<t;a++){let t=Math.abs(e[a][n]);t>i&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r<t;r++){let i=-e[r][n]/e[n][n];for(let a=n;a<t+1;a++)n==a?e[r][a]=0:e[r][a]+=i*e[n][a]}}let n=Array(t);for(let r=t-1;r>=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function $t(e){return e*180/Math.PI}function en(e){return e*Math.PI/180}function tn(e,t){let n=e%t;return n*t<0?n+t:n}function nn(e,t,n){return e+n*(t-e)}function rn(e,t){let n=10**t;return Math.round(e*n)/n}function an(e,t){return Math.floor(rn(e,t))}function on(e,t){return Math.ceil(rn(e,t))}function sn(e,t,n){if(e>=t&&e<n)return e;let r=n-t;return((e-t)%r+r)%r+t}function cn(e,t,n){return(function(r,i,a,o,s){if(!r)return;if(!i&&!t)return r;let c=t?0:a[0]*i,l=t?0:a[1]*i,u=s?s[0]:0,d=s?s[1]:0,f=e[0]+c/2+u,p=e[2]-c/2+u,m=e[1]+l/2+d,h=e[3]-l/2+d;f>p&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=Yt(r[0],f,p),_=Yt(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function ln(e){return e}var un={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function dn(e){let t=bn();for(let n=0,r=e.length;n<r;++n)Dn(t,e[n]);return t}function fn(e,t,n){return xn(Math.min.apply(null,e),Math.min.apply(null,t),Math.max.apply(null,e),Math.max.apply(null,t),n)}function pn(e,t,n){return n?(n[0]=e[0]-t,n[1]=e[1]-t,n[2]=e[2]+t,n[3]=e[3]+t,n):[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function mn(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function hn(e,t,n){let r,i;return r=t<e[0]?e[0]-t:e[2]<t?t-e[2]:0,i=n<e[1]?e[1]-n:e[3]<n?n-e[3]:0,r*r+i*i}function gn(e,t){return vn(e,t[0],t[1])}function _n(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function vn(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function yn(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=t[0],s=t[1],c=un.UNKNOWN;return o<n?c|=un.LEFT:o>i&&(c|=un.RIGHT),s<r?c|=un.BELOW:s>a&&(c|=un.ABOVE),c===un.UNKNOWN&&(c=un.INTERSECTING),c}function bn(){return[1/0,1/0,-1/0,-1/0]}function xn(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function Sn(e){return xn(1/0,1/0,-1/0,-1/0,e)}function Cn(e,t){let n=e[0],r=e[1];return xn(n,r,n,r,t)}function wn(e,t,n,r,i){return On(Sn(i),e,t,n,r)}function Tn(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function En(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function Dn(e,t){t[0]<e[0]&&(e[0]=t[0]),t[0]>e[2]&&(e[2]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[1]>e[3]&&(e[3]=t[1])}function On(e,t,n,r,i){for(;n<r;n+=i)kn(e,t[n],t[n+1]);return e}function kn(e,t,n){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],n),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],n)}function An(e,t){let n;return n=t(Mn(e)),n||(n=t(Nn(e)),n)||(n=t(Hn(e)),n)||(n=t(Vn(e)),n)?n:!1}function jn(e){let t=0;return Wn(e)||(t=z(e)*Rn(e)),t}function Mn(e){return[e[0],e[1]]}function Nn(e){return[e[2],e[1]]}function Pn(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function Fn(e,t){let n;if(t===`bottom-left`)n=Mn(e);else if(t===`bottom-right`)n=Nn(e);else if(t===`top-left`)n=Vn(e);else if(t===`top-right`)n=Hn(e);else throw Error(`Invalid corner`);return n}function In(e,t,n,r,i){let[a,o,s,c,l,u,d,f]=Ln(e,t,n,r);return xn(Math.min(a,s,l,d),Math.min(o,c,u,f),Math.max(a,s,l,d),Math.max(o,c,u,f),i)}function Ln(e,t,n,r){let i=t*r[0]/2,a=t*r[1]/2,o=Math.cos(n),s=Math.sin(n),c=i*o,l=i*s,u=a*o,d=a*s,f=e[0],p=e[1];return[f-c+d,p-l-u,f-c-d,p-l+u,f+c-d,p+l+u,f+c+d,p+l-u,f-c+d,p-l-u]}function Rn(e){return e[3]-e[1]}function zn(e,t,n){let r=n||bn();return Un(e,t)?(r[0]=e[0]>t[0]?e[0]:t[0],r[1]=e[1]>t[1]?e[1]:t[1],r[2]=e[2]<t[2]?e[2]:t[2],r[3]=e[3]<t[3]?e[3]:t[3]):Sn(r),r}function Bn(e,t){if(!Un(e,t))return[e.slice()];if(_n(t,e))return[];let[n,r,i,a]=e,o=Math.max(n,t[0]),s=Math.max(r,t[1]),c=Math.min(i,t[2]),l=Math.min(a,t[3]),u=[];return o>n&&u.push([n,r,o,a]),c<i&&u.push([c,r,i,a]),s>r&&u.push([o,r,c,s]),l<a&&u.push([o,l,c,a]),u}function Vn(e){return[e[0],e[3]]}function Hn(e){return[e[2],e[3]]}function z(e){return e[2]-e[0]}function Un(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Wn(e){return e[2]<e[0]||e[3]<e[1]}function Gn(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function Kn(e,t){let n=(e[2]-e[0])/2*(t-1),r=(e[3]-e[1])/2*(t-1);e[0]-=n,e[2]+=n,e[1]-=r,e[3]+=r}function qn(e,t,n){let r=!1,i=yn(e,t),a=yn(e,n);if(i===un.INTERSECTING||a===un.INTERSECTING)r=!0;else{let o=e[0],s=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=n[0],p=n[1],m=(p-d)/(f-u),h,g;a&un.ABOVE&&!(i&un.ABOVE)&&(h=f-(p-l)/m,r=h>=o&&h<=c),!r&&a&un.RIGHT&&!(i&un.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&un.BELOW&&!(i&un.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&un.LEFT&&!(i&un.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Jn(e,t,n,r){if(Wn(e))return Sn(n);let i=[];if(r>1){let t=e[2]-e[0],n=e[3]-e[1];for(let a=0;a<r;++a)i.push(e[0]+t*a/r,e[1],e[2],e[1]+n*a/r,e[2]-t*a/r,e[3],e[0],e[3]-n*a/r)}else i=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]];t(i,i,2);let a=[],o=[];for(let e=0,t=i.length;e<t;e+=2)a.push(i[e]),o.push(i[e+1]);return fn(a,o,n)}function Yn(e,t){let n=t.getExtent(),r=Pn(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){let t=z(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function Xn(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];Yn(e,t);let i=z(r);if(z(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]<r[0])return[[e[0]+i,e[1],r[2],e[3]],[r[0],e[1],e[2],e[3]]];if(e[2]>r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function Zn(e,t){let n=[e];for(let e=0,r=t.length;e<r&&n.length>0;++e){let r=[];for(let i=0,a=n.length;i<a;++i)r.push(...Bn(n[i],t[e]));n=r}return n}function Qn(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function $n(e,t){let n=!0;for(let r=e.length-1;r>=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function er(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}function tr(e,t){return e[0]*=t,e[1]*=t,e}function nr(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function rr(e,t){return Math.sqrt(nr(e,t))}function ir(e,t){if(t.canWrapX()){let n=z(t.getExtent()),r=ar(e,t,n);r&&(e[0]-=r*n)}return e}function ar(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]<r[0]||e[0]>r[2])&&(n||=z(r),i=Math.floor((e[0]-r[0])/n)),i}function or(e,t,n){let r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/r,(t[1]-e[1])/r],a=[-i[1],i[0]],o=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/o,(n[1]-e[1])/o],c=r===0||o===0?0:Math.acos(Yt(s[0]*i[0]+s[1]*i[1],-1,1));return c=Math.max(c,1e-5),s[0]*a[0]+s[1]*a[1]>0?c:Math.PI*2-c}function sr(e){return e**3}function cr(e){return 1-sr(1-e)}function lr(e){return 3*e*e-2*e*e*e}function ur(e){return e}function dr(e,t,n){n||=6371008.8;let r=en(e[1]),i=en(t[1]),a=(i-r)/2,o=en(t[0]-e[0])/2,s=Math.sin(a)*Math.sin(a)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))}var fr={info:1,warn:2,error:3,none:4},pr=fr.info;function mr(...e){pr>fr.warn||console.warn(...e)}var hr={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},gr=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global!==void 0&&e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||hr[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},_r=6378137,vr=Math.PI*_r,yr=[-vr,-vr,vr,vr],br=[-180,-85,180,85],xr=_r*Math.log(Math.tan(Math.PI/2)),Sr=class extends gr{constructor(e){super({code:e,units:`m`,extent:yr,global:!0,worldExtent:br,getPointResolution:function(e,t){return e/Math.cosh(t[1]/_r)}})}},Cr=[new Sr(`EPSG:3857`),new Sr(`EPSG:102100`),new Sr(`EPSG:102113`),new Sr(`EPSG:900913`),new Sr(`http://www.opengis.net/def/crs/EPSG/0/3857`),new Sr(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function wr(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r){t[n]=vr*e[n]/180;let r=_r*Math.log(Math.tan(Math.PI*(+e[n+1]+90)/360));r>xr?r=xr:r<-xr&&(r=-xr),t[n+1]=r}return t}function Tr(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r)t[n]=180*e[n]/vr,t[n+1]=360*Math.atan(Math.exp(e[n+1]/_r))/Math.PI-90;return t}var Er=6378137,Dr=[-180,-90,180,90],Or=Math.PI*Er/180,kr=class extends gr{constructor(e,t){super({code:e,units:`degrees`,extent:Dr,axisOrientation:t,global:!0,metersPerUnit:Or,worldExtent:Dr})}},Ar=[new kr(`CRS:84`),new kr(`EPSG:4326`,`neu`),new kr(`urn:ogc:def:crs:OGC:1.3:CRS84`),new kr(`urn:ogc:def:crs:OGC:2:84`),new kr(`http://www.opengis.net/def/crs/OGC/1.3/CRS84`),new kr(`http://www.opengis.net/gml/srs/epsg.xml#4326`,`neu`),new kr(`http://www.opengis.net/def/crs/EPSG/0/4326`,`neu`)],jr={};function Mr(e){return jr[e]||jr[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,`EPSG:$3`)]||null}function Nr(e,t){jr[e]=t}var Pr={};function Fr(e,t,n){let r=e.getCode(),i=t.getCode();r in Pr||(Pr[r]={}),Pr[r][i]=n}function Ir(e,t){return e in Pr&&t in Pr[e]?Pr[e][t]:null}var Lr=.9996,Rr=.00669438,zr=Rr*Rr,Br=zr*Rr,Vr=Rr/.99330562,Hr=Math.sqrt(.99330562),Ur=(1-Hr)/(1+Hr),Wr=Ur*Ur,Gr=Wr*Ur,Kr=Gr*Ur,qr=Kr*Ur,Jr=1-Rr/4-3*zr/64-5*Br/256,Yr=.002514607064228144,Xr=26390466021299826e-22,Zr=35*Br/3072,Qr=3/2*Ur-27/32*Gr+269/512*qr,$r=21/16*Wr-55/32*Kr,ei=151/96*Gr-417/128*qr,ti=1097/512*Kr,ni=6378137;function ri(e,t,n){let r=e-5e5,i=(n.north?t:t-1e7)/Lr/(ni*Jr),a=i+Qr*Math.sin(2*i)+$r*Math.sin(4*i)+ei*Math.sin(6*i)+ti*Math.sin(8*i),o=Math.sin(a),s=o*o,c=Math.cos(a),l=o/c,u=l*l,d=u*u,f=1-Rr*s,p=ni/Math.sqrt(1-Rr*s),m=.99330562/f,h=Vr*c**2,g=h*h,_=r/(p*Lr),v=_*_,y=v*_,b=y*_,x=b*_,S=x*_,C=a-l/m*(v/2-b/24*(5+3*u+10*h-4*g-9*Vr))+S/720*(61+90*u+298*h+45*d-252*Vr-3*g),w=(_-y/6*(1+2*u+h)+x/120*(5-2*h+28*u-3*g+8*Vr+24*d))/c;return w=sn(w+en(li(n.number)),-Math.PI,Math.PI),[$t(w),$t(C)]}var ii=-80,ai=84,oi=-180,si=180;function ci(e,t,n){e=sn(e,oi,si),t<ii?t=ii:t>ai&&(t=ai);let r=en(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=en(e),u=en(li(n.number)),d=ni/Math.sqrt(1-Rr*i**2),f=Vr*a**2,p=a*sn(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=ni*(Jr*r-Yr*Math.sin(2*r)+Xr*Math.sin(4*r)-Zr*Math.sin(6*r)),b=Lr*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*Vr))+5e5,x=Lr*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*Vr)));return n.north||(x+=1e7),[b,x]}function li(e){return(e-1)*6-180+3}var ui=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function di(e){let t=0;for(let n of ui){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function fi(e,t){return function(n,r,i,a){let o=n.length;i=i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i<o;i+=a){let a=n[i],o=n[i+1],s=e(a,o,t);r[i]=s[0],r[i+1]=s[1]}return r}}function pi(e){return di(e)?new gr({code:e,units:`m`}):null}function mi(e){let t=di(e.getCode());return t?{forward:fi(ci,t),inverse:fi(ri,t)}:null}var hi=[mi],gi=[pi],_i=!0;function vi(e){_i=!(e===void 0||e)}function yi(e,t){if(t!==void 0){for(let n=0,r=e.length;n<r;++n)t[n]=e[n];t=t}else t=e.slice();return t}function bi(e){Nr(e.getCode(),e),Fr(e,e,yi)}function xi(e){e.forEach(bi)}function B(e){if(typeof e!=`string`)return e;let t=Mr(e);if(t)return t;for(let t of gi){let n=t(e);if(n)return n}return null}function Si(e,t,n,r){e=B(e);let i,a=e.getPointResolutionFunc();if(a){if(i=a(t,n),r&&r!==e.getUnits()){let t=e.getMetersPerUnit();t&&(i=i*t/hr[r])}}else{let a=e.getUnits();if(a==`degrees`&&!r||r==`degrees`)i=t;else{let o=Ai(e,B(`EPSG:4326`));if(!o&&a!==`degrees`)i=t*e.getMetersPerUnit();else{let e=[n[0]-t/2,n[1],n[0]+t/2,n[1],n[0],n[1]-t/2,n[0],n[1]+t/2];e=o(e,e,2),i=(dr(e.slice(0,2),e.slice(2,4))+dr(e.slice(4,6),e.slice(6,8)))/2}let s=r?hr[r]:e.getMetersPerUnit();s!==void 0&&(i/=s)}}return i}function Ci(e){xi(e),e.forEach(function(t){e.forEach(function(e){t!==e&&Fr(t,e,yi)})})}function wi(e,t,n,r){e.forEach(function(e){t.forEach(function(t){Fr(e,t,n),Fr(t,e,r)})})}function Ti(e,t){return e?typeof e==`string`?B(e):e:B(t)}function Ei(e){return(function(t,n,r,i){let a=t.length;r=r===void 0?2:r,i??=r,n=n===void 0?Array(a):n;for(let o=0;o<a;o+=i){let a=e(t.slice(o,o+r)),s=a.length;for(let e=0,r=i;e<r;++e)n[o+e]=e>=s?t[o+e]:a[e]}return n})}function Di(e,t){return vi(),Ni(e,`EPSG:4326`,t===void 0?`EPSG:3857`:t)}function Oi(e,t){let n=Ni(e,t===void 0?`EPSG:3857`:t,`EPSG:4326`),r=n[0];return(r<-180||r>180)&&(n[0]=tn(r+180,360)-180),n}function ki(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||Ai(e,t)===yi)&&n}function Ai(e,t){let n=e.getCode(),r=t.getCode(),i=Ir(n,r);if(i)return i;let a=null,o=null;for(let n of hi)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o){let e=Ir(s,r);e&&(i=ji(a.inverse,e))}else if(a)i=ji(a.inverse,o.forward);else{let e=Ir(n,s);e&&(i=ji(e,o.forward))}return i&&(bi(e),bi(t),Fr(e,t,i)),i}function ji(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function Mi(e,t){return Ai(B(e),B(t))}function Ni(e,t,n){let r=Mi(t,n);if(!r){let e=B(t).getCode(),r=B(n).getCode();throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function Pi(e,t,n,r){return Jn(e,Mi(t,n),void 0,r)}var Fi=null;function Ii(){return Fi}function Li(e,t){return e}function Ri(e,t){return _i&&!$n(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(_i=!1,mr(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e}function zi(e,t){return e}function Bi(e,t){return e}function Vi(e,t){return e}function Hi(){Ci(Cr),Ci(Ar),wi(Ar,Cr,wr,Tr)}Hi();var Ui=[1,0,0,1,0,0],Wi=[,,,,,,];function Gi(){return Ui.slice(0)}function Ki(e){return Ji(e,1,0,0,1,0,0)}function qi(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=t[0],l=t[1],u=t[2],d=t[3],f=t[4],p=t[5];return e[0]=n*c+i*l,e[1]=r*c+a*l,e[2]=n*u+i*d,e[3]=r*u+a*d,e[4]=n*f+i*p+o,e[5]=r*f+a*p+s,e}function Ji(e,t,n,r,i,a,o){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=a,e[5]=o,e}function Yi(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Xi(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function Zi(e,t,n){return qi(e,Ji(Wi,t,0,0,n,0,0))}function Qi(e,t,n){return qi(e,Ji(Wi,1,0,0,1,t,n))}function $i(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function ea(e,t){let n=ta(t);R(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function ta(e){return e[0]*e[3]-e[1]*e[2]}var na=[1e5,1e5,1e5,1e5,2,2];function ra(e){return`matrix(`+e.join(`, `)+`)`}function ia(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function aa(e,t){let n=ia(e),r=ia(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*na[e])!==0)return!1;return!0}function oa(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c<n;c+=r){let t=e[c],n=e[c+1];a[s++]=i[0]*t+i[2]*n+i[4],a[s++]=i[1]*t+i[3]*n+i[5];for(let t=2;t<o;t++)a[s++]=e[c+t]}return a&&a.length!=s&&(a.length=s),a}function sa(e,t,n,r,i,a,o){o||=[];let s=Math.cos(i),c=Math.sin(i),l=a[0],u=a[1],d=0;for(let i=t;i<n;i+=r){let t=e[i]-l,n=e[i+1]-u;o[d++]=l+t*s-n*c,o[d++]=u+t*c+n*s;for(let t=i+2;t<i+r;++t)o[d++]=e[t]}return o&&o.length!=d&&(o.length=d),o}function ca(e,t,n,r,i,a,o,s){s||=[];let c=o[0],l=o[1],u=0;for(let o=t;o<n;o+=r){let t=e[o]-c,n=e[o+1]-l;s[u++]=c+i*t,s[u++]=l+a*n;for(let t=o+2;t<o+r;++t)s[u++]=e[t]}return s&&s.length!=u&&(s.length=u),s}function la(e,t,n,r,i,a,o){o||=[];let s=0;for(let c=t;c<n;c+=r){o[s++]=e[c]+i,o[s++]=e[c+1]+a;for(let t=c+2;t<c+r;++t)o[s++]=e[t]}return o&&o.length!=s&&(o.length=s),o}var ua=Gi(),da=[NaN,NaN],fa=class extends Tt{constructor(){super(),this.extent_=bn(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=_t((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return F()}closestPointXY(e,t,n,r){return F()}containsXY(e,t){return this.closestPointXY(e,t,da,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return F()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Sn(e),this.extentRevision_=this.getRevision()}return Gn(this.extent_,e)}rotate(e,t){F()}scale(e,t,n){F()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return F()}getType(){return F()}applyTransform(e){F()}intersectsExtent(e){return F()}translate(e,t){F()}transform(e,t){let n=B(e),r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=Rn(o)/Rn(a);$i(ua,o[0],o[3],s,-s,0,0,0);let c=oa(e,0,e.length,i,ua,r),l=Mi(n,t);return l?l(c,c,i):c}:Mi(n,t);return this.applyTransform(r),this}},pa=class extends fa{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return F()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=ha(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){F()}setLayout(e,t,n){let r;if(e)r=ha(e);else{for(let e=0;e<n;++e){if(t.length===0){this.layout=`XY`,this.stride=2;return}t=t[0]}r=t.length,e=ma(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith(`XYZ`)?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();sa(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||=Pn(this.getExtent());let r=this.getFlatCoordinates();if(r){let i=this.getStride();ca(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();la(n,0,n.length,r,e,t,n),this.changed()}}};function ma(e){let t;return e==2?t=`XY`:e==3?t=`XYZ`:e==4&&(t=`XYZM`),t}function ha(e){let t;return e==`XY`?t=2:e==`XYZ`||e==`XYM`?t=3:e==`XYZM`&&(t=4),t}function ga(e,t,n){let r=e.getFlatCoordinates();if(!r)return null;let i=e.getStride();return oa(r,0,r.length,i,t,n)}function _a(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1],s=0,c=0;for(;t<n;t+=r){let n=e[t]-a,r=e[t+1]-o;i+=c*n-s*r,s=n,c=r}return i/2}function va(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=_a(e,t,o,r),t=o}return i}function ya(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=va(e,t,o,r),t=o[o.length-1]}return i}function ba(e,t,n,r,i,a,o){let s=e[t],c=e[t+1],l=e[n]-s,u=e[n+1]-c,d;if(l===0&&u===0)d=t;else{let f=((i-s)*l+(a-c)*u)/(l*l+u*u);if(f>1)d=n;else if(f>0){for(let i=0;i<r;++i)o[i]=nn(e[t+i],e[n+i],f);o.length=r;return}else d=t}for(let t=0;t<r;++t)o[t]=e[d+t];o.length=r}function xa(e,t,n,r,i){let a=e[t],o=e[t+1];for(t+=r;t<n;t+=r){let n=e[t],r=e[t+1],s=Zt(a,o,n,r);s>i&&(i=s),a=n,o=r}return i}function Sa(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=xa(e,t,o,r,i),t=o}return i}function Ca(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=Sa(e,t,o,r,i),t=o[o.length-1]}return i}function wa(e,t,n,r,i,a,o,s,c,l,u){if(t==n)return l;let d,f;if(i===0){if(f=Zt(o,s,e[t],e[t+1]),f<l){for(d=0;d<r;++d)c[d]=e[t+d];return c.length=r,f}return l}u||=[NaN,NaN];let p=t+r;for(;p<n;)if(ba(e,p-r,p,r,o,s,u),f=Zt(o,s,u[0],u[1]),f<l){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r,p+=r}else p+=r*Math.max((Math.sqrt(f)-Math.sqrt(l))/i|0,1);if(a&&(ba(e,n-r,t,r,o,s,u),f=Zt(o,s,u[0],u[1]),f<l)){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r}return l}function Ta(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=wa(e,t,f,r,i,a,o,s,c,l,u),t=f}return l}function Ea(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=Ta(e,t,f,r,i,a,o,s,c,l,u),t=f[f.length-1]}return l}function Da(e,t,n,r){for(let r=0,i=n.length;r<i;++r)e[t++]=n[r];return t}function Oa(e,t,n,r){for(let i=0,a=n.length;i<a;++i){let a=n[i];for(let n=0;n<r;++n)e[t++]=a[n]}return t}function ka(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=Oa(e,t,n[o],r);i[a++]=s,t=s}return i.length=a,i}function Aa(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=ka(e,t,n[o],r,i[a]);s.length===0&&(s[0]=t),i[a++]=s,t=s[s.length-1]}return i.length=a,i}function ja(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=t;o<n;o+=r)i[a++]=e.slice(o,o+r);return i.length=a,i}function Ma(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=ja(e,t,s,r,i[a]),t=s}return i.length=a,i}function Na(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=s.length===1&&s[0]===t?[]:Ma(e,t,s,r,i[a]),t=s[s.length-1]}return i.length=a,i}function Pa(e,t,n,r,i){return!An(i,function(i){return!Fa(e,t,n,r,i[0],i[1])})}function Fa(e,t,n,r,i,a){let o=0,s=e[n-r],c=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];c<=a?r>a&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function Ia(e,t,n,r,i,a){if(n.length===0||!Fa(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t<o;++t)if(Fa(e,n[t-1],n[t],r,i,a))return!1;return!0}function La(e,t,n,r,i,a){if(n.length===0)return!1;for(let o=0,s=n.length;o<s;++o){let s=n[o];if(Ia(e,t,s,r,i,a))return!0;t=s[s.length-1]}return!1}function Ra(e,t,n,r,i){let a;for(t+=r;t<n;t+=r)if(a=i(e.slice(t-r,t),e.slice(t,t+r)),a)return a;return!1}function za(e,t,n,r,i,a){return a??=On(bn(),e,t,n,r),Un(i,a)?a[0]>=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]||Ra(e,t,n,r,function(e,t){return qn(i,e,t)}):!1}function Ba(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){if(za(e,t,n[a],r,i))return!0;t=n[a]}return!1}function Va(e,t,n,r,i){return!!(za(e,t,n,r,i)||Fa(e,t,n,r,i[0],i[1])||Fa(e,t,n,r,i[0],i[3])||Fa(e,t,n,r,i[2],i[1])||Fa(e,t,n,r,i[2],i[3]))}function Ha(e,t,n,r,i){if(!Va(e,t,n[0],r,i))return!1;if(n.length===1)return!0;for(let t=1,a=n.length;t<a;++t)if(Pa(e,n[t-1],n[t],r,i)&&!za(e,n[t-1],n[t],r,i))return!1;return!0}function Ua(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(Ha(e,t,o,r,i))return!0;t=o[o.length-1]}return!1}function Wa(e,t,n,r,i,a,o){let s=(n-t)/r;if(s<3){for(;t<n;t+=r)a[o++]=e[t],a[o++]=e[t+1];return o}let c=Array(s);c[0]=1,c[s-1]=1;let l=[t,n-r],u=0;for(;l.length>0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;t<n;t+=r){let n=e[t],r=e[t+1],i=Xt(n,r,s,d,f,p);i>o&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r<u&&l.push(a,u),u+r<n&&l.push(u,n))}for(let n=0;n<s;++n)c[n]&&(a[o++]=e[t+n*r],a[o++]=e[t+n*r+1]);return o}function Ga(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=Wa(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Ka(e,t){return t*Math.round(e/t)}function qa(e,t,n,r,i,a,o){if(t==n)return o;let s=Ka(e[t],i),c=Ka(e[t+1],i);t+=r,a[o++]=s,a[o++]=c;let l,u;do if(l=Ka(e[t],i),u=Ka(e[t+1],i),t+=r,t==n)return a[o++]=l,a[o++]=u,o;while(l==s&&u==c);for(;t<n;){let n=Ka(e[t],i),d=Ka(e[t+1],i);if(t+=r,n==l&&d==u)continue;let f=l-s,p=u-c,m=n-s,h=d-c;if(f*h==p*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(p<0&&h<p||p==h||p>0&&h>p)){l=n,u=d;continue}a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d}return a[o++]=l,a[o++]=u,o}function Ja(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=qa(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Ya(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c],u=[];o=Ja(e,t,l,r,i,a,o,u),s.push(u),t=l[l.length-1]}return o}var Xa=class e extends pa{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new e(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<hn(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(xa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),wa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return _a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ja(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let n=[];return n.length=Wa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LinearRing`}intersectsExtent(e){return za(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Oa(this.flatCoordinates,0,e,this.stride),this.changed()}},Za=class e extends pa{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){let i=this.flatCoordinates,a=Zt(e,t,i[0],i[1]);if(a<r){let e=this.stride;for(let t=0;t<e;++t)n[t]=i[t];return n.length=e,a}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Cn(this.flatCoordinates,e)}getType(){return`Point`}intersectsExtent(e){return vn(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||=[],this.flatCoordinates.length=Da(this.flatCoordinates,0,e,this.stride),this.changed()}};function Qa(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m=i[a+1],h=[];for(let i=0,a=n.length;i<a;++i){let a=n[i];for(u=e[a-r],f=e[a-r+1],s=t;s<a;s+=r)d=e[s],p=e[s+1],(m<=f&&p<=m||f<=m&&m<=p)&&(l=(m-f)/(p-f)*(d-u)+u,h.push(l)),u=d,f=p}let g=NaN,_=-1/0;for(h.sort(st),u=h[0],s=1,c=h.length;s<c;++s){d=h[s];let i=Math.abs(d-u);i>_&&(l=(u+d)/2,Ia(e,t,n,r,l,m)&&(g=l,_=i)),u=d}return isNaN(g)&&(g=i[a]),o?(o.push(g,m,_),o):[g,m,_]}function $a(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o<s;++o){let s=n[o];a=Qa(e,t,s,r,i,2*o,a),t=s[s.length-1]}return a}function eo(e,t,n,r){for(;t<n-r;){for(let i=0;i<r;++i){let a=e[t+i];e[t+i]=e[n-r+i],e[n-r+i]=a}t+=r,n-=r}}function to(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];i+=(n-a)*(r+o),a=n,o=r}return i===0?void 0:i>0}function no(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=to(e,t,o,r);if(a===0){if(i&&s||!i&&!s)return!1}else if(i&&!s||!i&&s)return!1;t=o}return!0}function ro(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(!no(e,t,o,r,i))return!1;o.length&&(t=o[o.length-1])}return!0}function io(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=to(e,t,o,r);(a===0?i&&s||!i&&!s:i&&!s||!i&&s)&&eo(e,t,o,r),t=o}return t}function ao(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=io(e,t,n[a],r,i);return t}function oo(e,t){let n=[],r=0,i=0,a;for(let o=0,s=t.length;o<s;++o){let s=t[o],c=to(e,r,s,2);if(a===void 0&&(a=c),c===a)n.push(t.slice(i,o+1));else{if(n.length===0)continue;n[n.length-1].push(t[i])}i=o+1,r=s}return n}var so=class e extends pa{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?dt(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<hn(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sa(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ta(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Ia(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return va(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),io(t,0,this.ends_,this.stride,e)),Ma(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Pn(this.getExtent());this.flatInteriorPoint_=Qa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Za(this.getFlatInteriorPoint(),`XYM`)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Xa(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=new Xa(t.slice(i,o),e);r.push(s),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;no(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=io(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Ja(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getType(){return`Polygon`}intersectsExtent(e){return Ha(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=ka(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}};function co(e){if(Wn(e))throw Error(`Cannot create polygon from empty extent`);let t=e[0],n=e[1],r=e[2],i=e[3],a=[t,n,t,i,r,i,r,n,t,n];return new so(a,`XY`,[a.length])}function lo(e,t,n,r){let i=z(t)/n[0],a=Rn(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function uo(e,t,n){let r=Math.min(e,t);return r*=Math.log(1+50*Math.max(0,e/t-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/e-1))/50+1),Yt(r,n/2,t*2)}function fo(e,t,n,r){return t=t===void 0||t,(function(i,a,o,s){if(i!==void 0){let c=e[0],l=e[e.length-1],u=n?lo(c,n,o,r):c;if(s)return t?uo(i,u,l):Yt(i,l,u);let d=Math.floor(lt(e,Math.min(u,i),a));return e[d]>u&&d<e.length-1?e[d+1]:e[d]}})}function po(e,t,n,r,i,a){return r=r===void 0||r,n=n===void 0?0:n,(function(o,s,c,l){if(o!==void 0){let u=i?lo(t,i,c,a):t;if(l)return r?uo(o,u,n):Yt(o,n,u);let d=Math.ceil(Math.log(t/u)/Math.log(e)-1e-9),f=-s*.499999999+.5,p=Math.floor(Math.log(t/Math.min(u,o))/Math.log(e)+f);return Yt(t/e**+Math.max(d,p),n,u)}})}function mo(e,t,n,r,i){return n=n===void 0||n,(function(a,o,s,c){if(a!==void 0){let o=r?lo(e,r,s,i):e;return!n||!c?Yt(a,t,o):uo(a,o,t)}})}function ho(e){if(e!==void 0)return 0}function go(e){if(e!==void 0)return e}function _o(e){let t=2*Math.PI/e;return(function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function vo(e){let t=e===void 0?en(5):e;return(function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e})}var yo=0,bo=class extends Tt{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ti(e.projection,`EPSG:3857`),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&vi(),e.center&&(e.center=Ri(e.center,this.projection_)),e.extent&&(e.extent=Bi(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let e in Jt)delete t[e];this.setProperties(t,!0);let n=Co(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=So(e),i=n.constraint,a=wo(e);this.constraints_={center:r,resolution:i,rotation:a},this.setRotation(e.rotation===void 0?0:e.rotation),this.setCenterInternal(e.center===void 0?null:e.center),e.resolution===void 0?e.zoom!==void 0&&this.setZoom(e.zoom):this.setResolution(e.resolution)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t||=[0,0,0,0];let i=this.getResolution(),a=i/2*(r[3]-t[3]+t[1]-r[1]),o=i/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+a,n[1]-o])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution===void 0?t.zoom=this.getZoom():t.resolution=this.getResolution(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=Array(arguments.length);for(let e=0;e<t.length;++e){let n=arguments[e];n.center&&(n=Object.assign({},n),n.center=Ri(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=Ri(n.anchor,this.getProjection())),t[e]=n}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let e=arguments[r];e.center&&this.setCenterInternal(e.center),e.zoom===void 0?e.resolution&&this.setResolution(e.resolution):this.setZoom(e.zoom),e.rotation!==void 0&&this.setRotation(e.rotation)}if(r===t){n&&xo(n,!0);return}let i=Date.now(),a=this.targetCenter_.slice(),o=this.targetResolution_,s=this.targetRotation_,c=[];for(;r<t;++r){let e=arguments[r],t={start:i,complete:!1,anchor:e.anchor,duration:e.duration===void 0?1e3:e.duration,easing:e.easing||lr,callback:n};if(e.center&&(t.sourceCenter=a,t.targetCenter=e.center.slice(),a=t.targetCenter),e.zoom===void 0?e.resolution&&(t.sourceResolution=o,t.targetResolution=e.resolution,o=t.targetResolution):(t.sourceResolution=o,t.targetResolution=this.getResolutionForZoom(e.zoom),o=t.targetResolution),e.rotation!==void 0){t.sourceRotation=s;let n=tn(e.rotation-s+Math.PI,2*Math.PI)-Math.PI;t.targetRotation=s+n,s=t.targetRotation}To(t)?t.complete=!0:i+=t.duration,c.push(t)}this.animations_.push(c),this.setHint(qt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[qt.ANIMATING]>0}getInteracting(){return this.hints_[qt.INTERACTING]>0}cancelAnimations(){this.setHint(qt.ANIMATING,-this.hints_[qt.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let n=this.animations_[t];if(n[0].callback&&xo(n[0].callback,!1),!e)for(let t=0,r=n.length;t<r;++t){let r=n[t];if(!r.complete){e=r.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n<a;++n){let a=r[n];if(a.complete)continue;let o=e-a.start,s=a.duration>0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter;let i=e+c*(n-e),o=t+c*(r-t);this.targetCenter_=[i,o]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?tn(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(qt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&xo(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],er(n,e-this.getRotation()),Qn(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Li(e,this.getProjection())}getCenterInternal(){return this.get(Jt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return zi(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();R(t,`The view center is not defined`);let n=this.getResolution();R(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return R(r!==void 0,`The view rotation is not defined`),In(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Jt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Bi(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=z(e)/t[0],r=Rn(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(Jt.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=Eo(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=lt(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Yt(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+Yt(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(R(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))R(!Wn(e),"Cannot fit empty extent provided as `geometry`"),n=co(Bi(e,this.getProjection()));else if(e.getType()===`Circle`){let t=Bi(e.getExtent(),this.getProjection());n=co(t),n.rotate(this.getRotation(),Pn(t))}else{let t=Ii();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;e<t;e+=a){let t=i[e]*n-i[e+1]*r,a=i[e]*r+i[e+1]*n;o=Math.min(o,t),s=Math.min(s,a),c=Math.max(c,t),l=Math.max(l,a)}return[o,s,c,l]}fitInternal(e,t){t||={};let n=t.size;n||=this.getViewportSizeMinusPadding_();let r=t.padding===void 0?[0,0,0,0]:t.padding,i=t.nearest!==void 0&&t.nearest,a;a=t.minResolution===void 0?t.maxZoom===void 0?0:this.getResolutionForZoom(t.maxZoom):t.minResolution;let o=this.rotatedExtentForGeometry(e),s=this.getResolutionForExtentInternal(o,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);s=isNaN(s)?a:Math.max(s,a),s=this.getConstrainedResolution(s,+!i);let c=this.getRotation(),l=Math.sin(c),u=Math.cos(c),d=Pn(o);d[0]+=(r[1]-r[3])/2*s,d[1]+=(r[0]-r[2])/2*s;let f=d[0]*u-d[1]*l,p=d[1]*u+d[0]*l,m=this.getConstrainedCenter([f,p],s),h=t.callback?t.callback:gt;t.duration===void 0?(this.targetResolution_=s,this.targetCenter_=m,this.applyTargetState_(!1,!0),xo(h,!0)):this.animateInternal({resolution:s,center:m,duration:t.duration,easing:t.easing},h)}centerOn(e,t,n){this.centerOnInternal(Ri(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(Eo(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let i,a=this.padding_;if(a&&e){let o=this.getViewportSizeMinusPadding_(-n),s=Eo(e,r,[o[0]/2+a[3],o[1]/2+a[0]],t,n);i=[e[0]-s[0],e[1]-s[1]]}return i}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Li(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t&&=Ri(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(i,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(this.zoomFactor_**+-e,t)}adjustRotation(e,t){t&&=Ri(t,this.getProjection()),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Ri(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),i=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,0,i,n),o=this.constraints_.center(this.targetCenter_,a,i,n,this.calculateCenterShift(this.targetCenter_,a,r,i));this.get(Jt.ROTATION)!==r&&this.set(Jt.ROTATION,r),this.get(Jt.RESOLUTION)!==a&&(this.set(Jt.RESOLUTION,a),this.set(`zoom`,this.getZoom(),!0)),(!o||!this.get(Jt.CENTER)||!$n(this.get(Jt.CENTER),o))&&this.set(Jt.CENTER,o),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e===void 0?200:e;let r=t||0,i=this.constraints_.rotation(this.targetRotation_),a=this.getViewportSize_(i),o=this.constraints_.resolution(this.targetResolution_,r,a),s=this.constraints_.center(this.targetCenter_,o,a,!1,this.calculateCenterShift(this.targetCenter_,o,i,a));if(e===0&&!this.cancelAnchor_){this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=s,this.applyTargetState_();return}n||=e===0?this.cancelAnchor_:void 0,this.cancelAnchor_=void 0,(this.getResolution()!==o||this.getRotation()!==i||!this.getCenterInternal()||!$n(this.getCenterInternal(),s))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:s,resolution:o,duration:e,easing:cr,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(qt.INTERACTING,1)}endInteraction(e,t,n){n&&=Ri(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(qt.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t||=0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function xo(e,t){setTimeout(function(){e(t)},0)}function So(e){if(e.extent!==void 0){let t=e.smoothExtentConstraint===void 0||e.smoothExtentConstraint;return cn(e.extent,e.constrainOnlyCenter,t)}let t=Ti(e.projection,`EPSG:3857`);if(e.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,cn(e,!1,!1)}return ln}function Co(e){let t,n,r,i=e.minZoom===void 0?yo:e.minZoom,a=e.maxZoom===void 0?28:e.maxZoom,o=e.zoomFactor===void 0?2:e.zoomFactor,s=e.multiWorld!==void 0&&e.multiWorld,c=e.smoothResolutionConstraint===void 0||e.smoothResolutionConstraint,l=e.showFullExtent!==void 0&&e.showFullExtent,u=Ti(e.projection,`EPSG:3857`),d=u.getExtent(),f=e.constrainOnlyCenter,p=e.extent;if(!s&&!p&&u.isGlobal()&&(f=!1,p=d),e.resolutions!==void 0){let o=e.resolutions;n=o[i],r=o[a]===void 0?o[o.length-1]:o[a],t=e.constrainResolution?fo(o,c,!f&&p,l):mo(n,r,c,!f&&p,l)}else{let s=(d?Math.max(z(d),Rn(d)):360*hr.degrees/u.getMetersPerUnit())/256/2**yo,m=s/2**28;n=e.maxResolution,n===void 0?n=s/o**+i:i=0,r=e.minResolution,r===void 0&&(r=e.maxZoom===void 0?m:e.maxResolution===void 0?s/o**+a:n/o**+a),a=i+Math.floor(Math.log(n/r)/Math.log(o)),r=n/o**+(a-i),t=e.constrainResolution?po(o,n,r,c,!f&&p,l):mo(n,r,c,!f&&p,l)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}function wo(e){if(e.enableRotation===void 0||e.enableRotation){let t=e.constrainRotation;return t===void 0||t===!0?vo():t===!1?go:typeof t==`number`?_o(t):go}return ho}function To(e){return!(e.sourceCenter&&e.targetCenter&&!$n(e.sourceCenter,e.targetCenter)||e.sourceResolution!==e.targetResolution||e.sourceRotation!==e.targetRotation)}function Eo(e,t,n,r,i){let a=Math.cos(-i),o=Math.sin(-i),s=e[0]*a-e[1]*o,c=e[1]*a+e[0]*o;return s+=(t[0]/2-n[0])*r,c+=(n[1]-t[1]/2)*r,o=-o,[s*a-c*o,c*a+s*o]}var Do=`ol-hidden`,Oo=`ol-selectable`,ko=`ol-unselectable`,Ao=`ol-control`,jo=`ol-collapsed`,Mo=new RegExp([`^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)`,`(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?`,`(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))`,`(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))`,`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(``),`i`),No=[`style`,`variant`,`weight`,`size`,`lineHeight`,`family`],Po={normal:400,bold:700},Fo=function(e){let t=e.match(Mo);if(!t)return null;let n={lineHeight:`normal`,size:`1.2em`,style:`normal`,weight:`400`,variant:`normal`};for(let e=0,r=No.length;e<r;++e){let r=t[e+1];r!==void 0&&(n[No[e]]=typeof r==`string`?r.trim():r)}return isNaN(Number(n.weight))&&n.weight in Po&&(n.weight=Po[n.weight]),n.families=n.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,``)),n};function Io(e,t,n,r){let i;return i=n&&n.length?n.shift():It?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}var Lo;function Ro(){return Lo||=Io(1,1),Lo}function zo(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Bo(e){let t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft,10)+parseInt(n.marginRight,10),t}function Vo(e){let t=e.offsetHeight,n=getComputedStyle(e);return t+=parseInt(n.marginTop,10)+parseInt(n.marginBottom,10),t}function Ho(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function Uo(e){for(;e.lastChild;)e.lastChild.remove()}function Wo(e,t){let n=e.childNodes;for(let r=0;;++r){let i=n[r],a=t[r];if(!i&&!a)break;if(i!==a){if(!i){e.appendChild(a);continue}if(!a){e.removeChild(i),--r;continue}e.insertBefore(a,i)}}}function Go(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw Error(`Node to remove was not found`);return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw Error(`Reference node not found`);return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t===`firstElementChild`?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Ko(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var qo=class extends Tt{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;e<t;++e)it(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==gt&&this.listenerKeys.push(N(e,Vt.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e==`string`?document.getElementById(e):e}},Jo=class extends qo{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target}),this.ulElement_=document.createElement(`ul`),this.collapsed_=e.collapsed===void 0||e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible===void 0||e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className===void 0?`ol-attribution`:e.className,n=e.tipLabel===void 0?`Attributions`:e.tipLabel,r=e.expandClassName===void 0?t+`-expand`:e.expandClassName,i=e.collapseLabel===void 0?`›`:e.collapseLabel,a=e.collapseClassName===void 0?t+`-collapse`:e.collapseClassName;typeof i==`string`?(this.collapseLabel_=document.createElement(`span`),this.collapseLabel_.textContent=i,this.collapseLabel_.className=a):this.collapseLabel_=i;let o=e.label===void 0?`i`:e.label;typeof o==`string`?(this.label_=document.createElement(`span`),this.label_.textContent=o,this.label_.className=r):this.label_=o;let s=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement(`button`),this.toggleButton_.setAttribute(`type`,`button`),this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(s),this.toggleButton_.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let c=t+` `+ko+` `+Ao+(this.collapsed_&&this.collapsible_?` `+jo:``)+(this.collapsible_?``:` ol-uncollapsible`),l=this.element;l.className=c,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(t=>t.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>n.add(e)):n.add(this.attributions_)),!this.overrideCollapsible_){let e=!t.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&=(this.element.style.display=`none`,!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(e=>vt(()=>e))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?``:`none`,this.renderedVisible_=n),!ft(t,this.renderedAttributions_)){Uo(this.ulElement_);for(let e=0,n=t.length;e<n;++e){let n=document.createElement(`li`);n.innerHTML=t[e],this.ulElement_.appendChild(n)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(jo),this.collapsed_?Ho(this.collapseLabel_,this.label_):Ho(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle(`ol-uncollapsible`),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,this.collapsible_&&this.collapsed_!==e&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},Yo=class extends qo{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target});let t=e.className===void 0?`ol-rotate`:e.className,n=e.label===void 0?`⇧`:e.label,r=e.compassClassName===void 0?`ol-compass`:e.compassClassName;this.label_=null,typeof n==`string`?(this.label_=document.createElement(`span`),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let i=e.tipLabel?e.tipLabel:`Reset rotation`,a=document.createElement(`button`);a.className=t+`-reset`,a.setAttribute(`type`,`button`),a.title=i,a.appendChild(this.label_),a.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let o=t+` `+ko+` `+Ao,s=this.element;s.className=o,s.appendChild(a),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration===void 0?250:e.duration,this.autoHide_=e.autoHide===void 0||e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Do)}handleClick_(e){e.preventDefault(),this.callResetNorth_===void 0?this.resetNorth_():this.callResetNorth_()}resetNorth_(){let e=this.getMap().getView();if(!e)return;let t=e.getRotation();t!==void 0&&(this.duration_>0&&t%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:cr}):e.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`;if(this.autoHide_){let e=this.element.classList.contains(Do);!e&&n===0?this.element.classList.add(Do):e&&n!==0&&this.element.classList.remove(Do)}this.label_.style.transform=e}this.rotation_=n}},Xo=class extends qo{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,n=e.delta===void 0?1:e.delta,r=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,i=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,a=e.zoomInLabel===void 0?`+`:e.zoomInLabel,o=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,s=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,c=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,l=document.createElement(`button`);l.className=r,l.setAttribute(`type`,`button`),l.title=s,l.appendChild(typeof a==`string`?document.createTextNode(a):a),l.addEventListener(P.CLICK,this.handleClick_.bind(this,n),!1);let u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(P.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+` `+ko+` `+Ao,f=this.element;f.className=d,f.appendChild(l),f.appendChild(u),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap().getView();if(!t)return;let n=t.getZoom();if(n!==void 0){let r=t.getConstrainedZoom(n+e);this.duration_>0?(t.getAnimating()&&t.cancelAnimations(),t.animate({zoom:r,duration:this.duration_,easing:cr})):t.setZoom(r)}}};function Zo(e){e||={};let t=new Ot;return(e.zoom===void 0||e.zoom)&&t.push(new Xo(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new Yo(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new Jo(e.attributionOptions)),t}var Qo=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let i=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,i),this.initialVelocity_=Math.sqrt(i*i+a*a)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},$o={ACTIVE:`active`},es=class extends Tt{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get($o.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set($o.ACTIVE,e)}setMap(e){this.map_=e}};function ts(e,t,n){let r=e.getCenterInternal();if(r){let i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:n===void 0?250:n,easing:ur,center:e.getConstrainedCenter(i)})}}function ns(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t),o=e.getResolutionForZoom(a);e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:cr})}var rs=class extends es{constructor(e){super(),e||={},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?250:e.duration}handleEvent(e){let t=!1;if(e.type==jt.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;ns(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function is(e){let t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r<i&&(n&&=t[r](e),n);++r);return n}}var as=function(e){let t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},os=function(e){let t=e.map.getTargetElement(),n=t.getRootNode(),r=e.map.getOwnerDocument().activeElement;return n instanceof ShadowRoot?n.host.contains(r):t.contains(r)},ss=function(e){let t=e.map.getTargetElement(),n=t.getRootNode();return!(n instanceof ShadowRoot?n.host:t).hasAttribute(`tabindex`)||os(e)},cs=mt,ls=function(e){let t=e.originalEvent;return`pointerId`in t&&t.button==0&&!(Nt&&Pt&&t.ctrlKey)},us=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},ds=function(e){let t=e.originalEvent;return Pt?t.metaKey:t.ctrlKey},fs=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},ps=function(e){let t=e.originalEvent,n=t.target.tagName;return n!==`INPUT`&&n!==`SELECT`&&n!==`TEXTAREA`&&!t.target.isContentEditable},ms=function(e){let t=e.originalEvent;return`pointerId`in t&&t.pointerType==`mouse`},hs=function(e){let t=e.originalEvent;return`pointerId`in t&&t.isPrimary&&t.button===0},gs=class extends es{constructor(e){e||={},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==jt.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==jt.POINTERUP){let t=this.handleUpEvent(e);this.handlingDownUpSequence=t&&this.targetPointers.length>0}}else if(e.type==jt.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==jt.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function _s(e){let t=e.length,n=0,r=0;for(let i=0;i<t;i++)n+=e[i].clientX,r+=e[i].clientY;return{clientX:n/t,clientY:r/t}}var vs=class extends gs{constructor(e){super({stopDown:ht}),e||={},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:is(us,hs);this.condition_=e.onFocusOnly?is(ss,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(_s(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let t=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],n=e.map.getView();tr(t,n.getResolution()),er(t,n.getRotation()),n.adjustCenterInternal(t)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let e=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),i=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(i),o=t.getCoordinateFromPixelInternal([a[0]-e*Math.cos(r),a[1]-e*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(o),duration:500,easing:cr})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},ys=class extends gs{constructor(e){e||={},super({stopDown:ht}),this.condition_=e.condition?e.condition:as,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!ms(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===ho)return;let r=t.getSize(),i=e.pixel,a=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(this.lastAngle_!==void 0){let e=a-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=a}handleUpEvent(e){return!ms(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return ms(e)&&ls(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},bs=class extends at{constructor(e){super(),this.geometry_=null,this.element_=document.createElement(`div`),this.element_.style.position=`absolute`,this.element_.style.pointerEvents=`auto`,this.element_.className=`ol-box `+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n=this.element_.style;n.left=Math.min(e[0],t[0])+`px`,n.top=Math.min(e[1],t[1])+`px`,n.width=Math.abs(t[0]-e[0])+`px`,n.height=Math.abs(t[1]-e[1])+`px`}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left=`inherit`,e.top=`inherit`,e.width=`inherit`,e.height=`inherit`}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,n=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new so([n])}getGeometry(){return this.geometry_}},xs={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},Ss=class extends yt{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Cs=class extends gs{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new bs(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??ls,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Ss(xs.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Ss(t?xs.BOXEND:xs.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ss(xs.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Ss(xs.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Ss(xs.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},ws=class extends Cs{constructor(e){e||={};let t=e.condition?e.condition:fs;super({condition:t,className:e.className||`ol-dragzoom`,minArea:e.minArea}),this.duration_=e.duration===void 0?200:e.duration,this.out_=e.out!==void 0&&e.out}onBoxEnd(e){let t=this.getMap().getView(),n=this.getGeometry();if(this.out_){let e=t.rotatedExtentForGeometry(n),r=t.getResolutionForExtentInternal(e),i=t.getResolution()/r;n=n.clone(),n.scale(i*i)}t.fitInternal(n,{duration:this.duration_,easing:cr})}},Ts={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},Es=class extends es{constructor(e){super(),e||={},this.defaultCondition_=function(e){return us(e)&&ps(e)},this.condition_=e.condition===void 0?this.defaultCondition_:e.condition,this.duration_=e.duration===void 0?100:e.duration,this.pixelDelta_=e.pixelDelta===void 0?128:e.pixelDelta}handleEvent(e){let t=!1;if(e.type==P.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Ts.DOWN||r==Ts.LEFT||r==Ts.RIGHT||r==Ts.UP)){let i=e.map.getView(),a=i.getResolution()*this.pixelDelta_,o=0,s=0;r==Ts.DOWN?s=-a:r==Ts.LEFT?o=-a:r==Ts.RIGHT?o=a:s=a;let c=[o,s];er(c,i.getRotation()),ts(i,c,this.duration_),n.preventDefault(),t=!0}}return!t}},Ds=class extends es{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!ds(e)&&ps(e)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?100:e.duration}handleEvent(e){let t=!1;if(e.type==P.KEYDOWN||e.type==P.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;ns(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Os=40,ks=300,As=3,js=class extends es{constructor(e){e||={},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta===void 0?1:e.maxDelta,this.duration_=e.duration===void 0?250:e.duration,this.timeout_=e.timeout===void 0?80:e.timeout,this.useAnchor_=e.useAnchor===void 0||e.useAnchor,this.constrainResolution_=e.constrainResolution!==void 0&&e.constrainResolution;let t=e.condition?e.condition:cs;this.condition_=e.onFocusOnly?is(ss,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(it),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(N(t,`keydown`,e=>{e.key===`Control`&&(this.ctrlKeyPressed_=!0)}),N(t,`keyup`,e=>{e.key===`Control`&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==P.WHEEL)return!0;let t=e.map,n=e.originalEvent;n.preventDefault();let r=n.ctrlKey&&!this.ctrlKeyPressed_;n.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=Os;break;case WheelEvent.DOM_DELTA_PAGE:i*=ks}if(i===0)return!1;this.lastDelta_=i;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?`trackpad`:`wheel`);let o=t.getView();if(this.mode_===`trackpad`)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r&&(i*=As),o.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=i;let s=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),s),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Yt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),ns(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},Ms=class extends gs{constructor(e){e||={};let t=e;t.stopDown||=ht,super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold===void 0?.3:e.threshold,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;let a=e.map,o=a.getView();o.getConstraints().rotation!==ho&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(_s(this.targetPointers))),this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},Ns=class extends gs{constructor(e){e||={};let t=e;t.stopDown||=ht,super(t),this.anchor_=null,this.duration_=e.duration===void 0?400:e.duration,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,a=n.clientY-r.clientY,o=Math.sqrt(i*i+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;let s=e.map,c=s.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(_s(this.targetPointers))),s.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function Ps(e){e||={};let t=new Ot,n=new Qo(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new ys),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new rs({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new vs({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new Ms),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new Ns({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new Es),t.push(new Ds({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new js({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new ws({duration:e.zoomDuration})),t}var V={OPACITY:`opacity`,VISIBLE:`visible`,EXTENT:`extent`,Z_INDEX:`zIndex`,MAX_RESOLUTION:`maxResolution`,MIN_RESOLUTION:`minResolution`,MAX_ZOOM:`maxZoom`,MIN_ZOOM:`minZoom`,SOURCE:`source`,MAP:`map`},Fs=class extends Tt{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties==`object`&&(delete t.properties,Object.assign(t,e.properties)),t[V.OPACITY]=e.opacity===void 0?1:e.opacity,R(typeof t[V.OPACITY]==`number`,`Layer opacity must be a number`),t[V.VISIBLE]=e.visible===void 0||e.visible,t[V.Z_INDEX]=e.zIndex,t[V.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[V.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[V.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[V.MAX_ZOOM]=e.maxZoom===void 0?1/0:e.maxZoom,this.className_=t.className===void 0?`ol-layer`:t.className,delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0||e},n=this.getZIndex();return t.opacity=Yt(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return F()}getLayerStatesArray(e){return F()}getExtent(){return this.get(V.EXTENT)}getMaxResolution(){return this.get(V.MAX_RESOLUTION)}getMinResolution(){return this.get(V.MIN_RESOLUTION)}getMinZoom(){return this.get(V.MIN_ZOOM)}getMaxZoom(){return this.get(V.MAX_ZOOM)}getOpacity(){return this.get(V.OPACITY)}getSourceState(){return F()}getVisible(){return this.get(V.VISIBLE)}getZIndex(){return this.get(V.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(V.EXTENT,e)}setMaxResolution(e){this.set(V.MAX_RESOLUTION,e)}setMinResolution(e){this.set(V.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(V.MAX_ZOOM,e)}setMinZoom(e){this.set(V.MIN_ZOOM,e)}setOpacity(e){R(typeof e==`number`,`Layer opacity must be a number`),this.set(V.OPACITY,e)}setVisible(e){this.set(V.VISIBLE,e)}setZIndex(e){this.set(V.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},Is={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},Ls=class extends yt{constructor(e,t){super(e),this.layer=t}},Rs={LAYERS:`layers`},zs=class e extends Fs{constructor(e){e||={};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Rs.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Ot(n.slice(),{unique:!0}):R(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new Ot(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(it),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(N(e,$e.ADD,this.handleLayersAdd_,this),N(e,$e.REMOVE,this.handleLayersRemove_,this));for(let e in this.listenerKeys_)this.listenerKeys_[e].forEach(it);tt(this.listenerKeys_);let t=e.getArray();for(let e=0,n=t.length;e<n;e++){let n=t[e];this.registerLayerListeners_(n),this.dispatchEvent(new Ls(Is.ADDLAYER,n))}this.changed()}registerLayerListeners_(t){let n=[N(t,et.PROPERTYCHANGE,this.handleLayerChange_,this),N(t,P.CHANGE,this.handleLayerChange_,this)];t instanceof e&&n.push(N(t,Is.ADDLAYER,this.handleLayerGroupAdd_,this),N(t,Is.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[I(t)]=n}handleLayerGroupAdd_(e){this.dispatchEvent(new Ls(Is.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Ls(Is.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Ls(Is.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=I(t);this.listenerKeys_[n].forEach(it),delete this.listenerKeys_[n],this.dispatchEvent(new Ls(Is.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(Rs.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let e=t.getArray();for(let t=0,n=e.length;t<n;++t)this.dispatchEvent(new Ls(Is.REMOVELAYER,e[t]))}this.set(Rs.LAYERS,e)}getLayersArray(e){return e=e===void 0?[]:e,this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e===void 0?[]:e,n=t.length;this.getLayers().forEach(function(e){e.getLayerStatesArray(t)});let r=this.getLayerState(),i=r.zIndex;!e&&r.zIndex===void 0&&(i=0);for(let e=n,a=t.length;e<a;e++){let n=t[e];n.opacity*=r.opacity,n.visible=n.visible&&r.visible,n.maxResolution=Math.min(n.maxResolution,r.maxResolution),n.minResolution=Math.max(n.minResolution,r.minResolution),n.minZoom=Math.max(n.minZoom,r.minZoom),n.maxZoom=Math.min(n.maxZoom,r.maxZoom),r.extent!==void 0&&(n.extent=n.extent===void 0?r.extent:zn(n.extent,r.extent)),n.zIndex===void 0&&(n.zIndex=i)}return t}getSourceState(){return`ready`}},Bs={PRERENDER:`prerender`,POSTRENDER:`postrender`,PRECOMPOSE:`precompose`,POSTCOMPOSE:`postcompose`,RENDERCOMPLETE:`rendercomplete`},Vs=class extends Fs{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(V.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e||=[],e.push(this),e}getLayerStatesArray(e){return e||=[],e.push(this.getLayerState()),e}getSource(){return this.get(V.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():`undefined`}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!==`ready`)&&(this.sourceReady_=!0,this.dispatchEvent(`sourceready`))}handleSourcePropertyChange_(){this.sourceChangeKey_&&=(it(this.sourceChangeKey_),null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=N(e,P.CHANGE,this.handleSourceChange_,this),e.getState()===`ready`&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof bo?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(e=>e.layer===this),!r)return!1}else r=this.getLayerState();let i=this.getExtent();return Hs(r,t.viewState)&&(!i||Un(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof bo?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(V.MAP,e)}getMapInternal(){return this.get(V.MAP)}setMap(e){this.mapPrecomposeKey_&&=(it(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(it(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=N(e,Bs.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=N(this,P.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);R(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(V.SOURCE,e)}getRenderer(){return this.renderer_||=this.createRenderer(),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Hs(e,t){if(!e.visible)return!1;let n=t.resolution;if(n<e.minResolution||n>=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}function Us(e,t,n=0,r=e.length-1,i=Gs){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);Us(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(Ws(e,n,t),i(e[r],a)>0&&Ws(e,n,r);o<s;){for(Ws(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?Ws(e,n,s):(s++,Ws(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function Ws(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Gs(e,t){return e<t?-1:+(e>t)}var Ks=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!ic(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],s=t.leaf?r(o):o;ic(e,s)&&(t.leaf?n.push(o):rc(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!ic(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let i=t.children[r],a=t.leaf?this.toBBox(i):i;if(ic(e,a)){if(t.leaf||rc(e,a))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=ac([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),i=[],a=[],o,s,c;for(;n||i.length;){if(n||(n=i.pop(),s=i[i.length-1],o=a.pop(),c=!0),n.leaf){let r=qs(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&rc(n,r)?(i.push(n),a.push(o),o=0,s=n,n=n.children[0]):s?(o++,n=s.children[o],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let i=n-t+1,a=this._maxEntries,o;if(i<=a)return o=ac(e.slice(t,n+1)),Js(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=ac([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));oc(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);oc(e,i,t,s,this.compareMinY);for(let n=i;n<=t;n+=s){let i=Math.min(n+s-1,t);o.children.push(this._build(e,n,i,r-1))}}return Js(o,this.toBBox),o}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let n=1/0,r=1/0,i;for(let a=0;a<t.children.length;a++){let o=t.children[a],s=$s(o),c=tc(e,o)-s;c<r?(r=c,n=s<n?s:n,i=o):c===r&&s<n&&(n=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),Xs(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=ac(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,Js(n,this.toBBox),Js(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=ac([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Js(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=Ys(e,0,o,this.toBBox),s=Ys(e,o,n,this.toBBox),c=nc(t,s),l=$s(t)+$s(s);c<i?(i=c,r=o,a=l<a?l:a):c===i&&l<a&&(a=l,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:Zs,i=e.leaf?this.compareMinY:Qs;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=Ys(e,0,t,i),o=Ys(e,n-t,n,i),s=ec(a)+ec(o);for(let r=t;r<n-t;r++){let t=e.children[r];Xs(a,e.leaf?i(t):t),s+=ec(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];Xs(o,e.leaf?i(t):t),s+=ec(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Xs(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Js(e[t],this.toBBox)}};function qs(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function Js(e,t){Ys(e,0,e.children.length,t,e)}function Ys(e,t,n,r,i){i||=ac(null),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a<n;a++){let t=e.children[a];Xs(i,e.leaf?r(t):t)}return i}function Xs(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Zs(e,t){return e.minX-t.minX}function Qs(e,t){return e.minY-t.minY}function $s(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ec(e){return e.maxX-e.minX+(e.maxY-e.minY)}function tc(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function nc(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function rc(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function ic(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function ac(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function oc(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;Us(e,o,t,n,i),a.push(t,o,o,n)}}var sc=[NaN,NaN,NaN,0],cc;function lc(){return cc||=Io(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),cc}var uc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,dc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,fc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,pc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function mc(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function hc(e){throw Error(`failed to parse "`+e+`" as color`)}function gc(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(dc)||e.match(uc)||e.match(fc);if(t){let e=t[4],n=100/255;return[Yt(mc(t[1],n)+.5|0,0,255),Yt(mc(t[2],n)+.5|0,0,255),Yt(mc(t[3],n)+.5|0,0,255),e===void 0?1:Yt(mc(e,100),0,1)]}hc(e)}if(e.startsWith(`#`)){if(pc.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e<i;e+=n){let i=parseInt(t.substring(e,e+n),16);n===1&&(i+=i<<4),r[e/n]=i}return r[3]/=255,r}hc(e)}let t=lc();t.fillStyle=`#abcdef`;let n=t.fillStyle;t.fillStyle=e,t.fillStyle===n&&(t.fillStyle=`#fedcba`,n=t.fillStyle,t.fillStyle=e,t.fillStyle===n&&hc(e));let r=t.fillStyle;if(r.startsWith(`#`)||r.startsWith(`rgba`))return gc(r);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let i=Array.from(t.getImageData(0,0,1,1).data);return i[3]=rn(i[3]/255,3),i}function _c(e){return typeof e==`string`?e:Ac(e)}var vc=1024,yc={},bc=0;function xc(e){if(e.length===4)return e;let t=e.slice();return t[3]=1,t}function Sc(e){return e>.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function Cc(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function wc(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function Tc(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function Ec(e){let t=wc(e[0]),n=wc(e[1]),r=wc(e[2]),i=Tc(t*.222488403+n*.716873169+r*.06060791),a=500*(Tc(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-Tc(t*.016863605+n*.117638439+r*.865350722)),s=180/Math.PI*Math.atan2(o,a);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function Dc(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=Cc(t),a=Cc(t+n/500*Math.cos(r)),o=Cc(t-n/200*Math.sin(r)),s=Sc(a*3.021973625-i*1.617392459-o*.404875592),c=Sc(a*-.943766287+i*1.916279586+o*.027607165),l=Sc(a*.069407491-i*.22898585+o*1.159737864);return[Yt(s+.5|0,0,255),Yt(c+.5|0,0,255),Yt(l+.5|0,0,255),e[3]]}function Oc(e){if(e===`none`)return sc;if(yc.hasOwnProperty(e))return yc[e];if(bc>=vc){let e=0;for(let t in yc)e++&3||(delete yc[t],--bc)}let t=gc(e);t.length!==4&&hc(e);for(let n of t)isNaN(n)&&hc(e);return yc[e]=t,++bc,t}function kc(e){return Array.isArray(e)?e:Oc(e)}function Ac(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function jc(e){return e[0]>0&&e[1]>0}function Mc(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function Nc(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var Pc=0,Fc=1<<Pc++,H=1<<Pc++,Ic=1<<Pc++,Lc=1<<Pc++,Rc=1<<Pc++,zc=1<<Pc++,Bc=2**Pc-1,Vc={[Fc]:`boolean`,[H]:`number`,[Ic]:`string`,[Lc]:`color`,[Rc]:`number[]`,[zc]:`size`},Hc=Object.keys(Vc).map(Number).sort(st);function Uc(e){return e in Vc}function Wc(e){let t=[];for(let n of Hc)Gc(e,n)&&t.push(Vc[n]);return t.length===0?`untyped`:t.length<3?t.join(` or `):t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}function Gc(e,t){return(e&t)===t}function Kc(e,t){return!!(e&t)}function qc(e,t){return e===t}var Jc=class{constructor(e,t){if(!Uc(e))throw Error(`literal expressions must have a specific type, got ${Wc(e)}`);this.type=e,this.value=t}},Yc=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function Xc(e){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:e}}function Zc(e,t,n){switch(typeof e){case`boolean`:if(qc(t,Ic))return new Jc(Ic,e?`true`:`false`);if(!Gc(t,Fc))throw Error(`got a boolean, but expected ${Wc(t)}`);return new Jc(Fc,e);case`number`:if(qc(t,zc))return new Jc(zc,Nc(e));if(qc(t,Fc))return new Jc(Fc,!!e);if(qc(t,Ic))return new Jc(Ic,e.toString());if(!Gc(t,H))throw Error(`got a number, but expected ${Wc(t)}`);return new Jc(H,e);case`string`:if(qc(t,Lc))return new Jc(Lc,Oc(e));if(qc(t,Fc))return new Jc(Fc,!!e);if(!Gc(t,Ic))throw Error(`got a string, but expected ${Wc(t)}`);return new Jc(Ic,e)}if(!Array.isArray(e))throw Error(`expression must be an array or a primitive value`);if(e.length===0)throw Error(`empty expression`);if(typeof e[0]==`string`)return hl(e,t,n);for(let t of e)if(typeof t!=`number`)throw Error(`expected an array of numbers`);if(qc(t,zc)){if(e.length!==2)throw Error(`expected an array of two values for a size, got ${e.length}`);return new Jc(zc,e)}if(qc(t,Lc)){if(e.length===3)return new Jc(Lc,[...e,1]);if(e.length===4)return new Jc(Lc,e);throw Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!Gc(t,Rc))throw Error(`got an array of numbers, but expected ${Wc(t)}`);return new Jc(Rc,e)}var U={Get:`get`,Var:`var`,Concat:`concat`,GeometryType:`geometry-type`,LineMetric:`line-metric`,Any:`any`,All:`all`,Not:`!`,Resolution:`resolution`,Zoom:`zoom`,Time:`time`,Equal:`==`,NotEqual:`!=`,GreaterThan:`>`,GreaterThanOrEqualTo:`>=`,LessThan:`<`,LessThanOrEqualTo:`<=`,Multiply:`*`,Divide:`/`,Add:`+`,Subtract:`-`,Clamp:`clamp`,Mod:`%`,Pow:`^`,Abs:`abs`,Floor:`floor`,Ceil:`ceil`,Round:`round`,Sin:`sin`,Cos:`cos`,Atan:`atan`,Sqrt:`sqrt`,Match:`match`,Between:`between`,Interpolate:`interpolate`,Coalesce:`coalesce`,Case:`case`,In:`in`,Number:`number`,String:`string`,Array:`array`,Color:`color`,Id:`id`,Band:`band`,Palette:`palette`,ToString:`to-string`,Has:`has`},Qc={[U.Get]:K(W(1,1/0),$c),[U.Var]:el(),[U.Has]:K(W(1,1/0),$c),[U.Id]:K(tl,al),[U.Concat]:K(W(2,1/0),G(Ic)),[U.GeometryType]:K(nl,al),[U.LineMetric]:K(rl,al),[U.Resolution]:K(il,al),[U.Zoom]:K(il,al),[U.Time]:K(il,al),[U.Any]:K(W(2,1/0),G(Fc)),[U.All]:K(W(2,1/0),G(Fc)),[U.Not]:K(W(1,1),G(Fc)),[U.Equal]:K(W(2,2),sl()),[U.NotEqual]:K(W(2,2),sl()),[U.GreaterThan]:K(W(2,2),G(H)),[U.GreaterThanOrEqualTo]:K(W(2,2),G(H)),[U.LessThan]:K(W(2,2),G(H)),[U.LessThanOrEqualTo]:K(W(2,2),G(H)),[U.Multiply]:K(W(2,1/0),ol),[U.Coalesce]:K(W(2,1/0),ol),[U.Divide]:K(W(2,2),G(H)),[U.Add]:K(W(2,1/0),G(H)),[U.Subtract]:K(W(2,2),G(H)),[U.Clamp]:K(W(3,3),G(H)),[U.Mod]:K(W(2,2),G(H)),[U.Pow]:K(W(2,2),G(H)),[U.Abs]:K(W(1,1),G(H)),[U.Floor]:K(W(1,1),G(H)),[U.Ceil]:K(W(1,1),G(H)),[U.Round]:K(W(1,1),G(H)),[U.Sin]:K(W(1,1),G(H)),[U.Cos]:K(W(1,1),G(H)),[U.Atan]:K(W(1,2),G(H)),[U.Sqrt]:K(W(1,1),G(H)),[U.Match]:K(W(4,1/0),ll,ul),[U.Between]:K(W(3,3),G(H)),[U.Interpolate]:K(W(6,1/0),ll,dl),[U.Case]:K(W(3,1/0),cl,fl),[U.In]:K(W(2,2),pl),[U.Number]:K(W(1,1/0),G(Bc)),[U.String]:K(W(1,1/0),G(Bc)),[U.Array]:K(W(1,1/0),G(H)),[U.Color]:K(W(1,4),G(H)),[U.Band]:K(W(1,3),G(H)),[U.Palette]:K(W(2,2),ml),[U.ToString]:K(W(1,1),G(Fc|H|Ic|Lc))};function $c(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=e[a+1];switch(typeof r){case`number`:i[a]=new Jc(H,r);break;case`string`:i[a]=new Jc(Ic,r);break;default:throw Error(`expected a string key or numeric array index for a get operation, got ${r}`)}a===0&&n.properties.set(String(r),t)}return i}function el(){return function(e,t,n){let r=e[1];if(typeof r!=`string`)throw Error(`expected a string argument for var operation`);let i=t,a=n.inputVariables?.[r];if(a!==void 0){let e=Zc(a,Bc,n);if(!(e instanceof Jc))throw Error(`style variables should only be literal values (no expressions!), variable name: ${r}`);let o=e.type;if(typeof a==`string`&&Kc(i,Lc)&&!Kc(i,Ic)?o=Lc:Array.isArray(a)&&a.length===2&&Kc(i,zc)&&!Kc(i,Rc)&&(o=zc),i&=o,i===0)throw Error(`the type expected from the var operator (${Wc(t)}) did not have any overlap with the type of the corresponding style variables (${Wc(o)}), variable name: ${r}`)}if(n.variables.has(r)){let e=n.variables.get(r);if(i&=e,i===0)throw Error(`a new type expected from the var operator (${Wc(t)}) did not have any overlap with the previous type expected for it (${Wc(e)}), variable name: ${r}`)}return n.variables.set(r,i),new Yc(i,`var`,new Jc(Ic,r))}}function tl(e,t,n){n.featureId=!0}function nl(e,t,n){n.geometryType=!0}function rl(e,t,n){n.mCoordinate=!0}function il(e,t,n){n.mapState=!0}function al(e,t,n){let r=e[0];if(e.length!==1)throw Error(`expected no arguments for ${r} operation`);return[]}function W(e,t){return function(n,r,i){let a=n[0],o=n.length-1;if(e===t){if(o!==e)throw Error(`expected ${e} argument${e===1?``:`s`} for ${a}, got ${o}`)}else if(o<e||o>t){let n=t===1/0?`${e} or more`:`${e} to ${t}`;throw Error(`expected ${n} arguments for ${a}, got ${o}`)}}}function ol(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=Zc(e[a+1],t,n);i[a]=r}return i}function G(e){return function(t,n,r){let i=t.length-1,a=Array(i);for(let n=0;n<i;++n){let i=Zc(t[n+1],e,r);a[n]=i}return a}}function sl(){return function(e,t,n){let r=e[0],i=e.length-1,a=Array(i),o=Bc;for(let t=0;t<i;++t){let r=Zc(e[t+1],o,n);o&=r.type}if(o===0)throw Error(`no common type was found among the arguments of ${r}`);for(let t=0;t<i;++t){let r=Zc(e[t+1],o,n);a[t]=r}return a}}function cl(e,t,n){let r=e[0],i=e.length-1;if(i%2==0)throw Error(`expected an odd number of arguments for ${r}, got ${i} instead`)}function ll(e,t,n){let r=e[0],i=e.length-1;if(i%2==1)throw Error(`expected an even number of arguments for operation ${r}, got ${i} instead`)}function ul(e,t,n){let r=e.length-1,i=Zc(e[e.length-1],t,n),a=Ic|H|Fc,o=Array(r-2);for(let t=0;t<r-2;t+=2){try{let r=Zc(e[t+2],a,n);a&=r.type}catch(e){throw Error(`failed to parse argument ${t+1} of match expression: ${e.message}`)}if(a===0)throw Error(`no common type was found among the arguments of match expression`)}for(let t=0;t<r-2;t+=2){try{let r=Zc(e[t+2],a,n);o[t]=r}catch(e){throw Error(`failed to parse argument ${t+1} of match expression: ${e.message}`)}try{let r=Zc(e[t+3],i.type,n);o[t+1]=r}catch(e){throw Error(`failed to parse argument ${t+2} of match expression: ${e.message}`)}}return[Zc(e[1],a,n),...o,i]}function dl(e,t,n){let r=e[1],i;switch(r[0]){case`linear`:i=1;break;case`exponential`:let e=r[1];if(typeof e!=`number`||e<=0)throw Error(`expected a number base for exponential interpolation, got ${JSON.stringify(e)} instead`);i=e;break;default:throw Error(`invalid interpolation type: ${JSON.stringify(r)}`)}let a=new Jc(H,i),o;try{o=Zc(e[2],H,n)}catch(e){throw Error(`failed to parse argument 1 in interpolate expression: ${e.message}`)}let s=Array(e.length-3);for(let r=0;r<s.length;r+=2){try{let t=Zc(e[r+3],H,n);s[r]=t}catch(e){throw Error(`failed to parse argument ${r+2} for interpolate expression: ${e.message}`)}try{let i=Zc(e[r+4],t,n);s[r+1]=i}catch(e){throw Error(`failed to parse argument ${r+3} for interpolate expression: ${e.message}`)}}return[a,o,...s]}function fl(e,t,n){let r=Zc(e[e.length-1],t,n),i=Array(e.length-1);for(let t=0;t<i.length-1;t+=2){try{let r=Zc(e[t+1],Fc,n);i[t]=r}catch(e){throw Error(`failed to parse argument ${t} of case expression: ${e.message}`)}try{let a=Zc(e[t+2],r.type,n);i[t+1]=a}catch(e){throw Error(`failed to parse argument ${t+1} of case expression: ${e.message}`)}}return i[i.length-1]=r,i}function pl(e,t,n){let r=e[2];if(!Array.isArray(r))throw Error(`the second argument for the "in" operator must be an array`);let i;if(r[0]===`literal`){if(r=r[1],!Array.isArray(r))throw Error(`failed to parse "in" expression: the literal operator must be followed by an array`)}else if(typeof r[0]==`string`)throw Error(`for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions`);i=typeof r[0]==`string`?Ic:H;let a=Array(r.length);for(let e=0;e<a.length;e++)try{let t=Zc(r[e],i,n);a[e]=t}catch(t){throw Error(`failed to parse haystack item ${e} for "in" expression: ${t.message}`)}return[Zc(e[1],i,n),...a]}function ml(e,t,n){let r;try{r=Zc(e[1],H,n)}catch(e){throw Error(`failed to parse first argument in palette expression: ${e.message}`)}let i=e[2];if(!Array.isArray(i))throw Error(`the second argument of palette must be an array`);let a=Array(i.length);for(let e=0;e<a.length;e++){let t;try{t=Zc(i[e],Lc,n)}catch(t){throw Error(`failed to parse color at index ${e} in palette expression: ${t.message}`)}if(!(t instanceof Jc))throw Error(`the palette color at index ${e} must be a literal value`);a[e]=t}return[r,...a]}function K(...e){return function(t,n,r){let i=t[0],a;for(let i=0;i<e.length;i++){let o=e[i](t,n,r);if(i==e.length-1){if(!o)throw Error(`expected last argument validator to return the parsed args`);a=o}}return new Yc(n,i,...a)}}function hl(e,t,n){let r=e[0],i=Qc[r];if(!i)throw Error(`unknown operator: ${r}`);return i(e,t,n)}function gl(e){if(!e)return``;let t=e.getType();switch(t){case`Point`:case`LineString`:case`Polygon`:return t;case`MultiPoint`:case`MultiLineString`:case`MultiPolygon`:return t.substring(5);case`Circle`:return`Polygon`;case`GeometryCollection`:return gl(e.getGeometries()[0]);default:return``}}function _l(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:``}}function vl(e,t,n){return yl(Zc(e,t,n),n)}function yl(e,t){if(e instanceof Jc){if(e.type===Lc&&typeof e.value==`string`){let t=Oc(e.value);return function(){return t}}return function(){return e.value}}let n=e.operator;switch(n){case U.Number:case U.String:case U.Coalesce:return bl(e,t);case U.Get:case U.Var:case U.Has:return xl(e,t);case U.Id:return e=>e.featureId;case U.GeometryType:return e=>e.geometryType;case U.Concat:{let n=e.args.map(e=>yl(e,t));return e=>``.concat(...n.map(t=>t(e).toString()))}case U.Resolution:return e=>e.resolution;case U.Any:case U.All:case U.Between:case U.In:case U.Not:return Cl(e,t);case U.Equal:case U.NotEqual:case U.LessThan:case U.LessThanOrEqualTo:case U.GreaterThan:case U.GreaterThanOrEqualTo:return Sl(e,t);case U.Multiply:case U.Divide:case U.Add:case U.Subtract:case U.Clamp:case U.Mod:case U.Pow:case U.Abs:case U.Floor:case U.Ceil:case U.Round:case U.Sin:case U.Cos:case U.Atan:case U.Sqrt:return wl(e,t);case U.Case:return Tl(e,t);case U.Match:return El(e,t);case U.Interpolate:return Dl(e,t);case U.ToString:return Ol(e,t);default:throw Error(`Unsupported operator ${n}`)}}function bl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.Coalesce:return e=>{for(let t=0;t<r;++t){let n=i[t](e);if(n!=null)return n}throw Error(`Expected one of the values to be non-null`)};case U.Number:case U.String:return e=>{for(let t=0;t<r;++t){let r=i[t](e);if(typeof r===n)return r}throw Error(`Expected one of the values to be a ${n}`)};default:throw Error(`Unsupported assertion operator ${n}`)}}function xl(e,t){let n=e.args[0].value;switch(e.operator){case U.Get:return t=>{let r=e.args,i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;i=i[t]}return i};case U.Var:return e=>e.variables[n];case U.Has:return t=>{let r=e.args;if(!(n in t.properties))return!1;let i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;if(!i||!Object.hasOwn(i,t))return!1;i=i[t]}return!0};default:throw Error(`Unsupported accessor operator ${e.operator}`)}}function Sl(e,t){let n=e.operator,r=yl(e.args[0],t),i=yl(e.args[1],t);switch(n){case U.Equal:return e=>r(e)===i(e);case U.NotEqual:return e=>r(e)!==i(e);case U.LessThan:return e=>r(e)<i(e);case U.LessThanOrEqualTo:return e=>r(e)<=i(e);case U.GreaterThan:return e=>r(e)>i(e);case U.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function Cl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.Any:return e=>{for(let t=0;t<r;++t)if(i[t](e))return!0;return!1};case U.All:return e=>{for(let t=0;t<r;++t)if(!i[t](e))return!1;return!0};case U.Between:return e=>{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case U.In:return e=>{let t=i[0](e);for(let n=1;n<r;++n)if(t===i[n](e))return!0;return!1};case U.Not:return e=>!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function wl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.Multiply:return e=>{let t=1;for(let n=0;n<r;++n)t*=i[n](e);return t};case U.Divide:return e=>i[0](e)/i[1](e);case U.Add:return e=>{let t=0;for(let n=0;n<r;++n)t+=i[n](e);return t};case U.Subtract:return e=>i[0](e)-i[1](e);case U.Clamp:return e=>{let t=i[0](e),n=i[1](e);if(t<n)return n;let r=i[2](e);return t>r?r:t};case U.Mod:return e=>i[0](e)%i[1](e);case U.Pow:return e=>i[0](e)**+i[1](e);case U.Abs:return e=>Math.abs(i[0](e));case U.Floor:return e=>Math.floor(i[0](e));case U.Ceil:return e=>Math.ceil(i[0](e));case U.Round:return e=>Math.round(i[0](e));case U.Sin:return e=>Math.sin(i[0](e));case U.Cos:return e=>Math.cos(i[0](e));case U.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case U.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function Tl(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=yl(e.args[i],t);return e=>{for(let t=0;t<n-1;t+=2)if(r[t](e))return r[t+1](e);return r[n-1](e)}}function El(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=yl(e.args[i],t);return e=>{let t=r[0](e);for(let i=1;i<n-1;i+=2)if(t===r[i](e))return r[i+1](e);return r[n-1](e)}}function Dl(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=yl(e.args[i],t);return e=>{let t=r[0](e),i=r[1](e),a,o;for(let s=2;s<n;s+=2){let n=r[s](e),c=r[s+1](e),l=Array.isArray(c);if(l&&(c=xc(c)),n>=i)return s===2?c:l?Al(t,i,a,o,n,c):kl(t,i,a,o,n,c);a=n,o=c}return o}}function Ol(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.ToString:return t=>{let n=i[0](t);return e.args[0].type===Lc?Ac(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function kl(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n;return r+(e===1?s/o:(e**+s-1)/(e**+o-1))*(a-r)}function Al(e,t,n,r,i,a){if(i-n===0)return r;let o=Ec(r),s=Ec(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),Dc([kl(e,t,n,o[0],i,s[0]),kl(e,t,n,o[1],i,s[1]),o[2]+kl(e,t,n,0,i,c),kl(e,t,n,r[3],i,a[3])])}var q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function jl(e,t,n){let r=e,i=!0,a=!1,o=!1,s=[rt(r,P.LOAD,function(){o=!0,a||t()})];return r.src&&Lt?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):s.push(rt(r,P.ERROR,n)),function(){i=!1,s.forEach(it)}}function Ml(e,t){return new Promise((n,r)=>{function i(){o(),n(e)}function a(){o(),r(Error(`Image load error`))}function o(){e.removeEventListener(`load`,i),e.removeEventListener(`error`,a)}e.addEventListener(`load`,i),e.addEventListener(`error`,a),t&&(e.src=t)})}function Nl(e,t){return t&&(e.src=t),e.src&&Lt?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):Ml(e)}var Pl=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];!(e++&3)&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=Fl(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=Fl(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let i=Fl(e,t),a=i in this.cache_;this.cache_[i]=n,r&&(n.getImageState()===q.IDLE&&n.load(),n.getImageState()===q.LOADING?n.ready().then(()=>{this.patternCache_[i]=Ro().createPattern(n.getImage(1),`repeat`)}):this.patternCache_[i]=Ro().createPattern(n.getImage(1),`repeat`)),a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function Fl(e,t){let n=t?kc(t):`null`;return e+`:`+n}var Il=new Pl,Ll=null,Rl=class extends bt{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=r===void 0?q.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===q.LOADED){Ll||=Io(1,1,void 0,{willReadFrequently:!0}),Ll.drawImage(this.image_,0,0);try{Ll.getImageData(0,0,1,1),this.tainted_=!1}catch{Ll=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(P.CHANGE)}handleImageError_(){this.imageState_=q.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=q.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_){if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Io(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_}return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===q.IDLE){this.image_||this.initializeImage_(),this.imageState_=q.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Nl(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==q.LOADED)return;let t=this.image_,n=Io(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation=`multiply`,n.fillStyle=_c(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation=`destination-in`,n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||=new Promise(e=>{if(this.imageState_===q.LOADED||this.imageState_===q.ERROR)e();else{let t=()=>{(this.imageState_===q.LOADED||this.imageState_===q.ERROR)&&(this.removeEventListener(P.CHANGE,t),e())};this.addEventListener(P.CHANGE,t)}}),this.ready_}};function zl(e,t,n,r,i,a){let o=t===void 0?void 0:Il.get(t,i);return o||(o=new Rl(e,e&&`src`in e?e.src||void 0:t,n,r,i),Il.set(t,i,o,a)),a&&o&&!Il.getPattern(t,i)&&Il.set(t,i,o,a),o}function Bl(e){return e?Array.isArray(e)?Ac(e):typeof e==`object`&&`src`in e?Vl(e):e:null}function Vl(e){if(!e.offset||!e.size)return Il.getPattern(e.src,e.color);let t=e.src+`:`+e.offset,n=Il.getPattern(t,e.color);if(n)return n;let r=Il.get(e.src,null);if(r.getImageState()!==q.LOADED)return null;let i=Io(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),zl(i.canvas,t,void 0,q.LOADED,e.color,!0),Il.getPattern(t,e.color)}var Hl=`10px sans-serif`,Ul=`#000`,Wl=`round`,Gl=[],Kl=`round`,ql=`#000`,Jl=`center`,Yl=`middle`,Xl=[0,0,0,0],Zl=new Tt,Ql=null,$l,eu={},tu=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function nu(e,t,n){return`${e} ${t} 16px "${n}"`}var ru=(function(){let e,t;async function n(e){await t.ready;let n=Fo(e),r=n.families[0].toLowerCase(),i=n.weight,a=[];return t.forEach(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),o=Po[e.weight]||e.weight;t===r&&e.style===n.style&&o==i&&a.push(e)}),a.length!==0&&(await Promise.all(a.map(e=>e.load().then(()=>!0,()=>!1)))).some(e=>e)}async function r(){await t.ready;let i=!0,a=Zl.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(tt(eu),Zl.set(t,100)):(r+=10,Zl.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=It?self.fonts:document.fonts;let i=Fo(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(tu.has(e))continue;let t=nu(i.style,i.weight,e);Zl.get(t)===void 0&&(Zl.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),iu=(function(){let e;return function(t){let n=eu[t];if(n==null){if(It){let e=Fo(t),r=au(t,`Žg`);n=(isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement(`div`),e.innerHTML=`M`,e.style.minHeight=`0`,e.style.maxHeight=`none`,e.style.height=`auto`,e.style.padding=`0`,e.style.border=`none`,e.style.position=`absolute`,e.style.display=`block`,e.style.left=`-99999px`),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);eu[t]=n}return n}})();function au(e,t){return Ql||=Io(1,1),e!=$l&&(Ql.font=e,$l=Ql.font),Ql.measureText(t)}function ou(e,t){return au(e,t).width}function su(e,t,n){if(t in n)return n[t];let r=t.split(`
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));function l(e,...t){t=t.filter(Boolean);for(let n=0,r=t.length,i;n<r;n++){i=t[n]||{};for(let t in i)Object.hasOwn(i,t)&&(e[t]=i[t])}return e}function u(e){let t=e.match(/^(\d{4})-(\d{2})-(\d{2})[T\s](\d{2}):(\d{2}):(\d{2})/)?.slice(1);if(!t)return e;let n=[];for(let e=0;e<t.length;e++){let r=parseInt(t[e]);e===1&&--r,n.push(r)}let r=new Date(n[0],n[1],n[2],n[3],n[4],n[5]),i=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],a=r.getFullYear(),o=i[r.getMonth()],s=r.getDate();return o+`, `+s+` `+a}function d(e,t){e.data=l({},e.data,t);let n=e.data;n.uniqueid===``&&(n.uniqueid=v(6))}function f(e,t){let n=e,r=t,i;for(i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return e}function p(e,t){let n=e,r=t,i;for(i in e)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return e}var m=0,h=`_vco_id`;function g(e){let t=e;return t[h]=t[h]||++m,t[h]}function _(e,t,n){let r=0;for(let i=0;i<t.length;i++)t[i].data[n]===e&&(r=i);return r}function v(e,t){function n(e){return Math.floor(Math.random()*e)}function r(){return`abcdefghijklmnopqurstuvwxyz`.charAt(n(27))}function i(e){let t=``;for(let n=0;n<e;n++)t+=r();return t}return t?t+`-`+i(e):`vco-`+i(e)}function y(e){e=e.replace(/^#?([a-f\d])([a-f\d])([a-f\d])$/i,function(e,t,n,r){return t+t+n+n+r+r});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function b(e){return e.match(/<p>[\s\S]*?<\/p>/)?e:`<p>`+e+`</p>`}function x(e){let t,n,r=[];t=e.toString(),t.match(`&`)?t=t.replace(`&`,`&`):t.match(`&`)?t=t.replace(`&`,`&`):t.match(`&`)&&(t=t.replace(`&`,`&`));let i=t.slice(t.indexOf(`?`)+1).split(`&`);for(let e=0;e<i.length;e++)n=i[e].split(`=`),r.push(n[0]),r[n[0]]=n[1];return r}var S={r16_9:function(e){return e.w!==null&&e.w!==``?Math.round(e.w/16*9):e.h!==null&&e.h!==``?Math.round(e.h/9*16):0}};function C(e,t){e.length&&e.at(-1)===`/`&&(e=e.substring(0,e.length-1)),t.length&&t[0]===`/`&&(t=t.substring(1));let n=e.split(`/`),r=t.split(`/`),i=[];for(let e=0,t=n.length;e<t;e++)if(n[e]===`..`)i.pop();else if(n[e]===`.`)continue;else i.push(n[e]);for(let e=0,t=r.length;e<t;e++)if(r[e]===`..`)i.pop();else if(r[e]===`.`)continue;else i.push(r[e]);return i.join(`/`)}function w(e,t){if(e!==void 0){let n=0;for(let r in e){if(t===n)return e[r];n++}return``}return``}function T(e,t,n){return new Promise((r,i)=>{if(n?.signal?.aborted){i(new DOMException(`Load aborted`,`AbortError`));return}let a=document.createElement(e);for(let e in t)Object.hasOwn(t,e)&&a.setAttribute(e,t[e]);e===`script`&&(a.async=!1);let o=()=>{a.onload=null,a.onerror=null,n?.signal?.removeEventListener(`abort`,s)},s=()=>{o(),a.remove(),i(new DOMException(`Load aborted`,`AbortError`))};a.onload=()=>{o(),r()},a.onerror=()=>{o(),i(Error(`Failed to load ${t.src??t.href}`))},n?.signal?.addEventListener(`abort`,s,{once:!0}),document.head.appendChild(a)})}function E(e,t){return T(`script`,{src:e},t)}function D(e,t){return T(`link`,{href:e,rel:`stylesheet`},t)}function O(e,t,n){return new Promise((r,i)=>{if(n?.signal?.aborted){i(new DOMException(`Load aborted`,`AbortError`));return}let a=window,o=document.createElement(`script`),s=!1,c=()=>{s=!0,clearTimeout(d),o.remove(),a[t]===u&&delete a[t],n?.signal?.removeEventListener(`abort`,l)},l=()=>{s||(c(),i(new DOMException(`Load aborted`,`AbortError`)))},u=e=>{s||(c(),r(e))},d=setTimeout(()=>{s||(c(),i(Error(`JSONP request timed out: ${e}`)))},n?.timeout??15e3);a[t]=u,o.onerror=()=>{s||(c(),i(Error(`Failed to load ${e}`)))},n?.signal?.addEventListener(`abort`,l,{once:!0}),o.src=e,document.body.appendChild(o)})}var k={$schema:`http://json-schema.org/draft-07/schema#`,$id:`storymap.schema.json`,title:`StoryMapJS`,description:`StoryMapJS data format`,type:`object`,required:[`storymap`],properties:{storymap:{type:`object`,required:[`slides`],properties:{language:{type:`string`},map_type:{type:`string`,description:`Basemap type: osm:<style>, osm (classic raster), mapbox://styles/<user>/<style>, stadia:<style>, stamen:<style> (deprecated, remapped), tile URL template or style JSON URL (absolute https://... or relative ./tiles/{z}/{x}/{y}.png, /tiles/{z}/...), iiif, ch-watercolor, zoomify (legacy image pyramid, needs the zoomify options).`},zoomify:{anyOf:[{type:`object`,properties:{path:{type:`string`},width:{type:`number`},height:{type:`number`},tolerance:{type:`number`},attribution:{type:`string`}}},{type:`boolean`}]},map_as_image:{type:`boolean`},map_mini:{type:`boolean`},map_subdomains:{type:`string`},map_access_token:{type:`string`},map_background_color:{type:`string`},map_options:{type:`object`,description:`OpenLayers passthrough options (view, controls, interactions); element replaces the map container`},map_bbox:{anyOf:[{type:`array`,items:{type:`number`},minItems:4,maxItems:4},{type:`null`}]},consent_required:{type:`boolean`},map_center_offset:{type:`object`,properties:{left:{type:`number`},top:{type:`number`}}},map_popup:{type:`boolean`},use_custom_markers:{type:`boolean`},zoom_distance:{type:`number`},calculate_zoom:{type:`boolean`},less_bounce:{type:`boolean`},line_follows_path:{type:`boolean`},show_lines:{type:`boolean`},show_history_line:{type:`boolean`},line_color:{type:`string`},line_color_inactive:{type:`string`},line_weight:{type:`number`},line_opacity:{type:`number`,minimum:0,maximum:1},line_dash:{type:`string`},line_join:{type:`string`},iiif:{type:`object`,required:[`url`],properties:{url:{type:`string`,description:`URL of the IIIF Image API info.json document`},attribution:{type:`string`}}},font_css:{type:`string`},call_to_action:{type:`boolean`},call_to_action_text:{type:`string`},fullscreen:{type:`boolean`},show_overview:{type:`boolean`},show_back_to_start:{type:`boolean`},show_progress:{type:`boolean`},show_distance:{type:`boolean`},marker_labels:{type:`boolean`},text_align:{type:`string`},text_color:{type:`string`},text_background_color:{type:`string`},nocache:{type:`boolean`},autoplay:{type:`number`,description:`Seconds per slide; 0 disables autoplay`},trackResize:{type:`boolean`},dragging:{type:`boolean`},duration:{type:`number`},map_overview_center:{anyOf:[{type:`object`,properties:{lat:{type:`number`},lon:{type:`number`}}},{type:`null`}]},api_key_flickr:{type:`string`},attribution:{type:`string`},start_at_slide:{type:`integer`,minimum:0},slides:{type:`array`,items:{$ref:`#/$defs/slide`}}}}},$defs:{slide:{type:`object`,properties:{type:{type:`string`,description:`'overview' marks the map overview slide`},date:{type:[`string`,`object`,`null`]},group:{type:`string`},location:{type:`object`,properties:{lat:{type:`number`,description:`Latitude, or vertical position in image pixels for image maps`},lon:{type:`number`,description:`Longitude, or horizontal position in image pixels for image maps`},zoom:{type:`number`},line:{type:`boolean`},name:{type:`string`},icon:{type:`string`,format:`uri`},iconSize:{type:`array`,items:{type:`number`},minItems:1,maxItems:2},image:{type:`string`,format:`uri`},use_custom_marker:{type:`boolean`}}},media:{type:`object`,properties:{url:{type:[`string`,`null`]},caption:{type:[`string`,`null`]},credit:{type:[`string`,`null`]},thumb:{type:`string`},mediatype:{type:[`object`,`null`]}}},text:{type:`object`,properties:{headline:{type:`string`},text:{type:`string`},date:{type:[`string`,`object`,`null`]}}},background:{type:[`object`,`string`],properties:{url:{type:[`string`,`null`],format:`uri`},color:{type:[`string`,`null`]}}},uniqueid:{type:`string`}}}}};function ee(e,t){return(Array.isArray(t)?t:[t]).some(t=>{switch(t){case`object`:return typeof e==`object`&&!!e&&!Array.isArray(e);case`array`:return Array.isArray(e);case`string`:return typeof e==`string`;case`number`:return typeof e==`number`&&!isNaN(e);case`integer`:return typeof e==`number`&&Number.isInteger(e);case`boolean`:return typeof e==`boolean`;case`null`:return e===null;case`uri`:return typeof e==`string`;default:return!0}})}function te(e,t,n,r){if(t&&typeof t==`object`){if(t.$ref){let i=t.$ref.replace(/^#\//,``).replaceAll(`~1`,`/`).replaceAll(`~0`,`~`),a=k;for(let e of i.split(`/`))a=a[e];te(e,a,n,r);return}if(t.type&&!ee(e,t.type)){let i=Array.isArray(t.type)?t.type.join(` or `):t.type;r.push({path:n,message:`expected ${i}, got ${e===null?`null`:typeof e}`});return}if(t.enum&&!t.enum.some(t=>t===e)&&r.push({path:n,message:`must be one of ${t.enum.map(e=>JSON.stringify(e)).join(`, `)}`}),typeof e==`number`&&(t.minimum!==void 0&&e<t.minimum&&r.push({path:n,message:`must be >= ${t.minimum}`}),t.maximum!==void 0&&e>t.maximum&&r.push({path:n,message:`must be <= ${t.maximum}`})),typeof e==`string`&&(t.minLength!==void 0&&e.length<t.minLength&&r.push({path:n,message:`must be at least ${t.minLength} characters`}),t.pattern!==void 0&&!new RegExp(t.pattern).test(e)&&r.push({path:n,message:`must match ${t.pattern}`})),Array.isArray(e)&&(t.minItems!==void 0&&e.length<t.minItems&&r.push({path:n,message:`must have at least ${t.minItems} items`}),t.maxItems!==void 0&&e.length>t.maxItems&&r.push({path:n,message:`must have at most ${t.maxItems} items`}),t.items&&e.forEach((e,i)=>te(e,t.items,`${n}[${i}]`,r))),typeof e==`object`&&e&&!Array.isArray(e)){let i=e;if(t.required)for(let e of t.required)e in i||r.push({path:n,message:`missing required property "${e}"`});if(t.properties)for(let[e,a]of Object.entries(t.properties))e in i&&te(i[e],a,`${n}.${e}`,r)}}}function ne(e){let t=[];return typeof e!=`object`||!e||Array.isArray(e)?[{path:``,message:`storymap data must be a JSON object`}]:`storymap`in e?(te(e,k,``,t),t):[{path:``,message:`missing required property "storymap"`}]}function re(e,t){let n=ne(e);if(n.length===0)return!0;console.error(`StoryMapJS: invalid storymap data${t?` (${t})`:``} - ${n.length} error${n.length>1?`s`:``} found:`);for(let e of n)console.error(` ${e.path||`(root)`}: ${e.message}`);return!1}var ie=`iiif.io/api/presentation/3/context.json`,ae=`mapconfig`,oe=`storymap:`,se=[`name`,`zoom`,`line`,`icon`,`iconSize`,`image`,`use_custom_marker`];function ce(e){return typeof e!=`object`||!e||Array.isArray(e)?null:e}function le(e){return typeof e==`string`&&e!==``?e:null}function ue(e){return typeof e==`number`&&!isNaN(e)?e:null}function de(e){return typeof e==`boolean`?e:null}function fe(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function pe(e){if(typeof e==`string`)return e;let t=ce(e);if(!t)return``;let n=t.value;if(typeof n==`string`)return n;if(Array.isArray(n))return fe(n).join(` `).trim();let r=`none`in t?[`none`]:Object.keys(t),i=[];for(let e of r)i.push(...fe(t[e]));return i.join(` `).trim()}function A(e,t){let n=e[oe+t];return n===void 0?t===`type`?void 0:e[t]:n}function me(e){let t=ce(e);if(!t)return!1;if(t.type===`Manifest`)return!0;let n=t[`@context`];return(Array.isArray(n)?n:[n]).some(e=>typeof e==`string`&&e.includes(ie))}function he(e){let t=Array.isArray(e.service)?e.service:[e.service];for(let e of t){let t=ce(e);if(!t)continue;let n=le(t.profile);if(n!==null&&n.includes(ae))return t}return null}function ge(e){let t=Array.isArray(e.items)?e.items:[];for(let e of t){let t=ce(e);if(!t)continue;let n=Array.isArray(t.items)?t.items:[];for(let e of n){let t=ce(e);if(!t)continue;let n=le(t.motivation);if(n!==null&&n!==`painting`)continue;let r=_e(t.body);if(r!==null)return r}}return null}function _e(e){if(Array.isArray(e)){for(let t of e){let e=_e(t);if(e!==null)return e}return null}let t=ce(e);if(!t)return null;let n=le(t.id);if(n!==null)return n;let r=le(t.value);return r===null?null:r}function ve(e){let t=ce(e);if(!t)return null;let n=Array.isArray(t.features)?t.features:[];for(let e of n){let t=ye(e);if(t!==null)return t}return null}function ye(e){let t=ce(e);if(!t)return null;let n=ce(t.geometry);if(!n||le(n.type)!==`Point`)return null;let r=Array.isArray(n.coordinates)?n.coordinates:[],i=ue(r[0]),a=ue(r[1]);if(i===null||a===null)return null;let o={lat:a,lon:i},s=ce(t.properties);if(s){let e=o;for(let t of se){let n=s[t];n!=null&&n!==``&&(e[t]=n)}}return o}function be(e){let t=ce(e);if(t){let e={},n=le(t.url),r=le(t.color);return n!==null&&(e.url=n),r!==null&&(e.color=r),Object.keys(e).length>0?e:null}return typeof e==`string`&&e!==``?e:null}function xe(e,t){let n=ce(e);if(!n)return null;let r={},i=pe(n.label),a=pe(n.summary);(i!==``||a!==``)&&(r.text={},i!==``&&(r.text.headline=i),a!==``&&(r.text.text=a));let o=ge(n),s=le(A(n,`mediaCaption`)),c=le(A(n,`mediaCredit`));if(o!==null||s!==null||c!==null){let e={};o!==null&&(e.url=o),s!==null&&(e.caption=s),c!==null&&(e.credit=c),r.media=e}let l=ve(n.navPlace)??ye(t);l!==null&&(r.location=l);let u=le(n[`storymap:type`]);u!==null&&(r.type=u);let d=A(n,`date`),f=le(d),p=ce(d);f===null?p!==null&&(r.date=p):r.date=f;let m=be(A(n,`background`));return m!==null&&(r.background=m),r}function Se(e){let t={slides:[]},n=ce(e);if(!n)return t;let r=pe(n.label);r!==``&&(t.title=r);let i=he(n);i&&Ce(t,i);let a=ce(n.requiredStatement),o=a?pe(a.value):``;if(o!==``){let e=t.iiif??{};e.attribution=o,e.url===void 0&&(e.url=``),t.iiif=e}let s=Array.isArray(n.items)?n.items:[],c=ce(n.navPlace),l=c&&Array.isArray(c.features)?c.features:[];for(let e=0;e<s.length;e++){let n=xe(s[e],l[e]);n!==null&&t.slides.push(n)}return t}function Ce(e,t){let n=le(A(t,`mapType`));n!==null&&n!==``&&(e.map_type=n);let r=de(A(t,`mapAsImage`));r!==null&&(e.map_as_image=r);let i=le(A(t,`mapAccessToken`));i!==null&&(e.map_access_token=i);let a=le(A(t,`mapBackgroundColor`));a!==null&&(e.map_background_color=a);let o=ce(A(t,`mapCenterOffset`));if(o){let t=ue(o.left),n=ue(o.top);t!==null&&n!==null&&(e.map_center_offset={left:t,top:n})}let s=le(A(t,`mapSubdomains`));s!==null&&(e.map_subdomains=s);let c=le(A(t,`iiifUrl`));c!==null&&(e.iiif={url:c,attribution:``});let l=le(A(t,`fontCss`));l!==null&&(e.font_css=l);let u=de(A(t,`callToAction`));u!==null&&(e.call_to_action=u);let d=le(A(t,`callToActionText`));d!==null&&(e.call_to_action_text=d);let f=ue(A(t,`startAtSlide`));f!==null&&(e.start_at_slide=f);let p=le(A(t,`language`));p!==null&&(e.language=p);let m=de(A(t,`calculateZoom`));m!==null&&(e.calculate_zoom=m);let h=de(A(t,`lessBounce`));h!==null&&(e.less_bounce=h);let g=de(A(t,`lineFollowsPath`));g!==null&&(e.line_follows_path=g);let _=de(A(t,`showLines`));_!==null&&(e.show_lines=_);let v=de(A(t,`showHistoryLine`));v!==null&&(e.show_history_line=v);let y=le(A(t,`lineColor`));y!==null&&(e.line_color=y);let b=le(A(t,`lineColorInactive`));b!==null&&(e.line_color_inactive=b);let x=ue(A(t,`lineWeight`));x!==null&&(e.line_weight=x);let S=ue(A(t,`lineOpacity`));S!==null&&(e.line_opacity=S);let C=le(A(t,`lineDash`));C!==null&&(e.line_dash=C);let w=le(A(t,`lineJoin`));w!==null&&(e.line_join=w);let T=de(A(t,`useCustomMarkers`));T!==null&&(e.use_custom_markers=T)}function we(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)r!==`__proto__`&&(e[r]=n[r])}return e}var Te={read:function(e){return e[0]===`"`&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decodeURIComponent)}};function Ee(e,t){function n(n,r,i){if(typeof document<`u`){i=we({},t,i),typeof i.expires==`number`&&(i.expires=new Date(Date.now()+i.expires*864e5)),i.expires&&(i.expires=i.expires.toUTCString()),n=encodeURIComponent(n).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var a=``;for(var o in i)i[o]&&(a+=`; `+o,i[o]!==!0&&(a+=`=`+i[o].split(`;`)[0]));return document.cookie=n+`=`+e.write(r,n)+a}}function r(t){if(!(typeof document>`u`||arguments.length&&!t)){for(var n=document.cookie?document.cookie.split(`; `):[],r={},i=0;i<n.length;i++){var a=n[i].split(`=`),o=a.slice(1).join(`=`);try{var s=decodeURIComponent(a[0]);if(s in r||(r[s]=e.read(o,s)),t===s)break}catch{}}return t?r[t]:r}}return Object.create({set:n,get:r,remove:function(e,t){n(e,``,we({},t,{expires:-1}))},withAttributes:function(e){return Ee(this.converter,we({},this.attributes,e))},withConverter:function(e){return Ee(we({},this.converter,e),this.attributes)}},{attributes:{value:Object.freeze(t)},converter:{value:Object.freeze(e)}})}var De=Ee(Te,{path:`/`}),Oe={"./locale/be.json":{default:{name:`Беларуская`,lang:`be`,messages:{loading:`Загрузка`,wikipedia:`Вікіпедыя`,start:`Start Exploring`},buttons:{map_overview:`Прагляд мапы`,overview:`Прагляд`,backtostart:`Вярнуцца ў пачатак`,collapse_toggle:`Схаваць мапу`,uncollapse_toggle:`Паказаць мапу`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/bg.json":{default:{name:`Български`,lang:`bg`,messages:{loading:`Зареждане`,wikipedia:`От Уикипедия, свободната енциклопедия`,start:`Започнете да разглеждате`},buttons:{map_overview:`Преглед на картата`,overview:`Преглед`,backtostart:`Към началото`,collapse_toggle:`Скриване на картата`,uncollapse_toggle:`Показване на картата`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/cs.json":{default:{name:`Čeština`,lang:`cs`,messages:{loading:`Nahrávání`,wikipedia:`Z Wikipedie, svobodné encyklopedie`,start:`Prozkoumat`},buttons:{map_overview:`Přehledová mapa`,overview:`Přehled`,backtostart:`Zpět na začátek`,collapse_toggle:`Skrýt mapu`,uncollapse_toggle:`Zobrazit mapu`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/de.json":{default:{name:`Deutsch`,lang:`de`,messages:{loading:`Daten werden geladen`,wikipedia:`von Wikipedia, der freien Enzyklopädie`,start:`Explore`},buttons:{map_overview:`Kartenübersicht`,overview:`Kartenübersicht`,backtostart:`Zurück zum Anfang`,collapse_toggle:`Karte ausblenden`,uncollapse_toggle:`Karte anzeigen`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/el.json":{default:{name:`Ελληνικά`,lang:`el`,messages:{loading:`Φόρτωση`,wikipedia:`Από την Wikipedia, την ελεύθερη εγκυκλοπαίδεια`,start:`Έναρξη περιήγησης`},buttons:{map_overview:`Επισκόπηση χάρτη`,overview:`Επισκόπηση`,backtostart:`Επιστροφή στην αρχή`,collapse_toggle:`Απόκρυψη χάρτη`,uncollapse_toggle:`Εμφάνιση χάρτη`,swipe_to_navigate:`Κτυπήστε ελαφρά για περιήγηση<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/en.json":{default:{name:`English`,lang:`en`,messages:{error:`Error loading`,loading:`Loading`,wikipedia:`From Wikipedia, the free encyclopedia`,start:`Start Exploring`,consent_title:`External content`,consent_message:`Load content from {service}?`,consent_allow:`Allow`,consent_deny:`Deny`,consent_blocked:`Content from {service} is blocked.`,consent_service_tiles:`map tiles`,consent_service_fonts:`web fonts`},buttons:{map_overview:`Map Overview`,overview:`Overview`,backtostart:`Back To Beginning`,collapse_toggle:`Hide Map`,uncollapse_toggle:`Show Map`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`,fullscreen:`Full Screen`,exit_fullscreen:`Exit Full Screen`},direction:`ltr`}},"./locale/es.json":{default:{name:`Español`,lang:`es`,messages:{loading:`cargando`,wikipedia:`de Wikipedia, la enciclopedia libre`,start:`Explore`},buttons:{map_overview:`vista general del mapa`,overview:`vista general`,backtostart:`volver al comienzo`,collapse_toggle:`ocultar mapa`,uncollapse_toggle:`mostrar mapa`,swipe_to_navigate:`Deslizar para navegar<br><span class='vco-button'>Entendido</span>`},direction:`ltr`}},"./locale/et.json":{default:{name:`eesti`,lang:`et`,messages:{loading:`Laadib`,wikipedia:`Vikipeedia, vaba entsüklopeedia`,start:`Uuri`},buttons:{map_overview:`Kaardi ülevaade`,overview:`Ülevaade`,backtostart:`Tagasi algusesse`,collapse_toggle:`Peida kaart`,uncollapse_toggle:`Näita kaarti`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/fr.json":{default:{name:`Français`,lang:`fr`,messages:{loading:`Chargement`,wikipedia:`Extrait de Wikipédia, l'encyclopédie libre`,start:`Explore`},buttons:{map_overview:`Vue d'ensemble de la carte`,overview:`Vue d'ensemble`,backtostart:`Retourner au point de départ`,collapse_toggle:`Masquer la carte`,uncollapse_toggle:`Afficher la carte`,swipe_to_navigate:`Faites glisser pour naviguer<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/he.json":{default:{name:`עברית`,lang:`he`,direction:`rtl`,messages:{loading:`טוען`,wikipedia:`מתוך ויקיפדיה, האנציקלופדיה החופשית`,start:`התחל במסע`},buttons:{map_overview:`המפה במלואה`,overview:`תצוגה מקדימה`,backtostart:`חזור להתחלה`,collapse_toggle:`הסתר מפה`,uncollapse_toggle:`הצג מפה`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`}}},"./locale/hu.json":{default:{name:`Magyar`,lang:`hu`,messages:{loading:`töltés`,wikipedia:`Wikipedia`,start:`Indítsd`},buttons:{map_overview:`teljes térkép`,overview:`teljes sztori`,backtostart:`vissza az elejére`,collapse_toggle:`összecsuk`,uncollapse_toggle:`kinyit`,swipe_to_navigate:`Húzd el a navigációhoz<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/is.json":{default:{name:`Icelandic`,lang:`is`,messages:{loading:`Hleðsla`,wikipedia:`Frá Wikipedia`,start:`Hefja`},buttons:{map_overview:`Kortayfirlit`,overview:`Yfirlit`,backtostart:`Hefja aftur`,collapse_toggle:`Fela kortið`,uncollapse_toggle:`Sýna kortið`,swipe_to_navigate:`Strjúktu fyrir valmynd<br><span class='vco-button'>Allt í lagi</span>`},direction:`ltr`}},"./locale/it.json":{default:{name:`Italiano`,lang:`it`,messages:{loading:`caricare`,wikipedia:`da Wikipedia, la enciclopedia libera`,start:`Explore`},buttons:{map_overview:`vista generale della mappa`,overview:`vista generale`,backtostart:`tornare all' inizio`,collapse_toggle:`nascondere mappa`,uncollapse_toggle:`mostrare mappa`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/jp.json":{default:{name:`日本語`,lang:`jp`,messages:{loading:`ローディング`,wikipedia:`フリー百科事典ウィキペディア(Wikipedia)から`,start:`Explore`},buttons:{map_overview:`概観地図`,overview:`概観`,backtostart:`初めに戻る`,collapse_toggle:`地図を隠す`,uncollapse_toggle:`地図を表示`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/ko.json":{default:{name:`한국어`,lang:`ko`,messages:{loading:`불러오는중`,wikipedia:`위키피디아`,start:`시작하기`},buttons:{map_overview:`지도 전체보기`,overview:`전체보기`,backtostart:`되돌아가기`,collapse_toggle:`숨기기`,uncollapse_toggle:`보이기`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/nl.json":{default:{name:`Nederlands`,lang:`nl`,messages:{loading:`Laden`,wikipedia:`Van Wikipedia, de gratis encyclopedie`,start:`Start Exploring`},buttons:{map_overview:`Kaart overzicht`,overview:`Overzicht`,backtostart:`Terug naar begin`,collapse_toggle:`Verberg kaart`,uncollapse_toggle:`Toon kaart`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/nn.json":{default:{name:`Norsk nynorsk`,lang:`nn`,messages:{loading:`Lastar inn`,wikipedia:`Frå Wikipedia, det frie oppslagsverket`,start:`Utforsk`},buttons:{map_overview:`Sjå oversiktskart`,overview:`Oversikt`,backtostart:`Til starten`,collapse_toggle:`Gøym kartet`,uncollapse_toggle:`Vis kartet`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/no.json":{default:{name:`Norsk`,lang:`no`,messages:{loading:`Laster inn`,wikipedia:`fra Wikipedia, den frie encyklopedi`,start:`Explore`},buttons:{map_overview:`Se oversiktskart`,overview:`Se oversiktskart`,backtostart:`Til begynnelsen`,collapse_toggle:`Skjul kartet`,uncollapse_toggle:`Vis kartet`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/pl.json":{default:{name:`Polski`,lang:`pl`,messages:{loading:`Wczytuję`,wikipedia:`z Wikipedii, wolnej encyklopedii`,start:`Explore`},buttons:{map_overview:`Przeglądaj mapę`,overview:`Przeglądaj`,backtostart:`Powrót`,collapse_toggle:`Ukryj mapę`,uncollapse_toggle:`Pokaż mapę`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/pt.json":{default:{name:`Português`,lang:`pt`,messages:{loading:`carregando`,wikipedia:`de Wikipedia, a enciclopédia livre`,start:`início`},buttons:{map_overview:`vista geral do mapa`,overview:`vista geral`,backtostart:`voltar ao início`,collapse_toggle:`ocultar mapa`,uncollapse_toggle:`mostrar mapa`,swipe_to_navigate:`Deslize para navegar<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/ru.json":{default:{name:`Русский`,lang:`ru`,messages:{loading:`Загрузка`,wikipedia:`Из Википедии, свободной энциклопедии`,start:`Начать просмотр`},buttons:{map_overview:`Просмотр карты`,overview:`Обзор`,backtostart:`К началу`,collapse_toggle:`Скрыть карту`,uncollapse_toggle:`Показать карту`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/sk.json":{default:{name:`Slovenčina`,lang:`sk`,messages:{loading:`Nahrávanie`,wikipedia:`Z Wikipédie, slobodnej encyklopédie`,start:`Preskúmať`},buttons:{map_overview:`Prehľadová mapa`,overview:`Prehľad`,backtostart:`Späť na začiatok`,collapse_toggle:`Skryť mapu`,uncollapse_toggle:`Zobraziť mapu`,swipe_to_navigate:`Navigujte potiahnutím prsta<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/sr.json":{default:{name:`Srpski`,lang:`sr`,messages:{loading:`Učitavanje`,wikipedia:`Wikipedia`,start:`Explore`},buttons:{map_overview:`Pregled mapę`,backtostart:`Nazad na početak`,collapse_toggle:`Sakrij mapu`,uncollapse_toggle:`Prikaži mapu`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/sv.json":{default:{name:`Svenska`,lang:`sv`,messages:{loading:`Laddar`,wikipedia:`Från Wikipedia, den fria encyklopedin`,start:`Explore`},buttons:{map_overview:`Översiktskarta`,overview:`Översikt`,backtostart:`Tillbaka till början`,collapse_toggle:`Göm kartan`,uncollapse_toggle:`Visa kartan`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/tr.json":{default:{name:`Türkçe`,lang:`tr`,messages:{loading:`Yükleniyor`,wikipedia:`Vikipedi, Özgür Ansiklopedi`,start:`Keşfet`},buttons:{map_overview:`Genel harita`,overview:`Genel harita`,backtostart:`Başlangıç menüsüne dön`,collapse_toggle:`Menüyü gizle`,uncollapse_toggle:`Menüyü göster`,swipe_to_navigate:`Dokun ve kaydır<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/uk.json":{default:{name:`Українська`,lang:`uk`,messages:{loading:`Завантаження`,wikipedia:`З Вікіпедії, вільної енциклопедії`,start:`Почати перегляд`},buttons:{map_overview:`Перегляд карти`,overview:`Огляд`,backtostart:`Повернутися до початку`,collapse_toggle:`Приховати карту`,uncollapse_toggle:`Показати карту`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/ur.json":{default:{name:`Urdu`,lang:`ur`,direction:`rtl`,messages:{loading:`لوڈ ہو رہا ہے`,wikipedia:`ویکیپیڈیا, مفت دستیاب انسائیکلوپیڈیا سے `,start:`دریافت شروع کی جایے `},buttons:{map_overview:`نقشے کا جائزہ`,overview:`جائزہ`,backtostart:`واپس شروع سے`,collapse_toggle:`نقشہ غائب`,uncollapse_toggle:`نقشہ حاضر`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`}}},"./locale/zh-cn.json":{default:{name:`中文`,lang:`zh-cn`,messages:{loading:`加载中`,wikipedia:`来自维基百科,自由的百科全书`,start:`Explore`},buttons:{map_overview:`地图总览`,overview:`总览`,backtostart:`回到首页`,collapse_toggle:`隐藏地图`,uncollapse_toggle:`显示地图`,swipe_to_navigate:`Swipe to Navigate<br><span class='vco-button'>OK</span>`},direction:`ltr`}},"./locale/zh-tw.json":{default:{name:`正體中文`,lang:`zh-tw`,messages:{loading:`載入中`,wikipedia:`來自維基百科,自由的百科全書`,start:`探索`},buttons:{map_overview:`地圖總覽`,overview:`總覽`,backtostart:`回到首頁`,collapse_toggle:`隱藏地圖`,uncollapse_toggle:`顯示地圖`,swipe_to_navigate:`左右滑動以瀏覽<br><span class='vco-button'>我知道了</span>`},direction:`ltr`}}},ke=Oe[`./locale/en.json`]?.default||{},j={};function Ae(e){let t=structuredClone(Oe[`./locale/${e}.json`]?.default||{});for(let e in ke)t[e]?typeof ke[e]==`object`&&(t[e]=Object.assign(ke[e],t[e])):t[e]=ke[e];return t}function je(e){return j=Ae(e),j}var Me=`storymapjs-consent`,Ne=90,Pe=class{granted=new Set;denied=new Set;pending=new Map;constructor(){this.restore()}restore(){try{let e=De.get(Me);if(!e)return;let t=JSON.parse(e);for(let e in t)Object.hasOwn(t,e)&&(t[e]?this.granted.add(e):this.denied.add(e))}catch{}}persist(){let e={};for(let t of this.granted)e[t]=!0;for(let t of this.denied)e[t]=!1;try{De.set(Me,JSON.stringify(e),{expires:Ne,sameSite:`Lax`})}catch{}}isGranted(e){return this.granted.has(e)}isDenied(e){return this.denied.has(e)}request(e,t,n){return this.granted.has(e)?Promise.resolve(!0):this.denied.has(e)?Promise.resolve(!1):new Promise(r=>{let i=j.messages??{},a=document.createElement(`div`);a.className=`vco-consent`;let o=document.createElement(`p`);o.className=`vco-consent-title`,o.textContent=i.consent_title??`External content`;let s=document.createElement(`p`);s.className=`vco-consent-message`,s.textContent=(i.consent_message??`Load content from {service}?`).replace(`{service}`,e)+(t?` (${t})`:``);let c=document.createElement(`div`);c.className=`vco-consent-buttons`;let l=document.createElement(`button`);l.className=`vco-consent-allow`,l.textContent=i.consent_allow??`Allow`;let u=document.createElement(`button`);u.className=`vco-consent-deny`,u.textContent=i.consent_deny??`Deny`;let d=this.pending.get(e)??[];d.push({el:a,resolve:r}),this.pending.set(e,d);let f=t=>{t?this.granted.add(e):this.denied.add(e);for(let n of this.pending.get(e)??[])n.el.remove(),n.resolve(t);this.pending.delete(e),this.persist()};l.addEventListener(`click`,()=>f(!0)),u.addEventListener(`click`,()=>f(!1)),c.append(l,u),a.append(o,s,c),n.append(a)})}};function Fe(e){return e?.consent_manager}function Ie(e,t){return(j.messages??{})[e]??t}var M=class{static get(e){return typeof e==`string`?document.getElementById(e):e}static create(e,t,n){let r=document.createElement(e);return r.className=t,n&&n.appendChild(r),r}static getPosition(e){let t={x:0,y:0};for(;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t.x+=e.offsetLeft,t.y+=e.offsetTop,e=e.offsetParent;return t}},Le=3;(function e(t){t=+t;function n(e){return e**+t}return n.exponent=e,n})(Le),(function e(t){t=+t;function n(e){return 1-(1-e)**t}return n.exponent=e,n})(Le);var Re=(function e(t){t=+t;function n(e){return((e*=2)<=1?e**+t:2-(2-e)**t)/2}return n.exponent=e,n})(Le);function ze(e){return(2**(-10*e)-.0009765625)*1.0009775171065494}function Be(e){return 1-ze(e)}function Ve(e){return e}var{cbrt:He,sqrt:Ue,PI:We}=Math,Ge=(e,t,n,r,i)=>{let a=t+n*e,o=a**2+r;if(o>0){let e=Ue(o);return He(a+e)+He(a-e)-i}let s=He(Ue(-r)),c=a?Math.atan(Ue(-o)/a):-We/2,l;return l=n<0?(a>0?2*We:We)-c:i<0?(a>0?2*We:-3*We)+c:(a>0?0:We)+c,2*s*Math.cos(l/3)-i},Ke=(e,t,n,r)=>((t*e+3*n)*e+r)*e;function qe(e,t,n,r){if(!(0<=e&&e<=1&&0<=n&&n<=1))throw Error(`bezier x values must be in [0, 1] range`);if(e===t&&n===r)return Ve;let i=6*(3*e-3*n+1),a=6*(n-2*e),o=3*e,s=i*i,c=a*a,l=a/i,u=3*a*o/s-c*a/(s*i),d=2*o/i-c/s,f=d*d*d,p=3/i,m=3*t-3*r+1,h=r-2*t,g=3*t,_=i?Ge:Ve;return function(e){return e===0||e===1?e:Ke(_(e,u,p,f,l),m,h,g)}}var Je=Re.exponent(5),Ye=Be,Xe=qe(.42,0,1,1);function Ze(e){return class extends e{on(e,t,n){let r=this._vco_events=this._vco_events||{};return r[e]=r[e]||[],r[e].push({action:t,context:n||this}),this}hasEventListeners(e){return!!this._vco_events?.[e]?.length}off(e,t,n){if(!this.hasEventListeners(e))return this;let r=this._vco_events;for(let i=0,a=r[e].length;i<a;i++)if(r[e][i].action===t&&(!n||r[e][i].context===n))return r[e].splice(i,1),this;return this}fire(e,t,n){if(!this.hasEventListeners(e))return this;let r={type:e,target:n||this,...t},i=this._vco_events[e].slice();for(let e of i)e.action.call(e.context||this,r);return this}constructor(...e){super(...e)}}}function Qe(e){return class extends e{show(e){e||(this._el.container.style.display=`block`)}hide(){this._el.container.style.display=`none`}addTo(e){return e.appendChild(this._el.container),this.onAdd(),this}removeFrom(e){return e.removeChild(this._el.container),this.onRemove(),this}setPosition(e,t){let n=t||this._el.container;for(let t of Object.keys(e))n.style[t]=e[t]+`px`;return this}onLoaded(){this.fire(`loaded`,this.data)}onAdd(){this.fire(`added`,this.data)}onRemove(){this.fire(`removed`,this.data)}constructor(...e){super(...e)}}}var $e={ADD:`add`,REMOVE:`remove`},et={PROPERTYCHANGE:`propertychange`};function tt(e){for(let t in e)delete e[t]}function nt(e){let t;for(t in e)return!1;return!t}function N(e,t,n,r,i){if(i){let i=n;n=function(a){return e.removeEventListener(t,n),i.call(r??this,a)}}else r&&r!==e&&(n=n.bind(r));let a={target:e,type:t,listener:n};return e.addEventListener(t,n),a}function rt(e,t,n,r){return N(e,t,n,r,!0)}function it(e){e&&e.target&&(e.target.removeEventListener(e.type,e.listener),tt(e))}var P={CHANGE:`change`,ERROR:`error`,BLUR:`blur`,CLEAR:`clear`,CONTEXTMENU:`contextmenu`,CLICK:`click`,DBLCLICK:`dblclick`,DRAGENTER:`dragenter`,DRAGOVER:`dragover`,DROP:`drop`,FOCUS:`focus`,KEYDOWN:`keydown`,KEYPRESS:`keypress`,LOAD:`load`,RESIZE:`resize`,TOUCHMOVE:`touchmove`,WHEEL:`wheel`},at=class{constructor(){this.disposed=!1}dispose(){this.disposed||(this.disposed=!0,this.disposeInternal())}disposeInternal(){}};function ot(e,t,n){let r,i;n||=st;let a=0,o=e.length,s=!1;for(;a<o;)r=a+(o-a>>1),i=+n(e[r],t),i<0?a=r+1:(o=r,s=!i);return s?a:~a}function st(e,t){return e>t?1:e<t?-1:0}function ct(e,t){return e<t?1:e>t?-1:0}function lt(e,t,n){if(e[0]<=t)return 0;let r=e.length;if(t<=e[r-1])return r-1;if(typeof n==`function`){for(let i=1;i<r;++i){let r=e[i];if(r===t)return i;if(r<t)return n(t,e[i-1],r)>0?i-1:i}return r-1}if(n>0){for(let n=1;n<r;++n)if(e[n]<t)return n-1;return r-1}if(n<0){for(let n=1;n<r;++n)if(e[n]<=t)return n;return r-1}for(let n=1;n<r;++n){if(e[n]==t)return n;if(e[n]<t)return e[n-1]-t<t-e[n]?n-1:n}return r-1}function ut(e,t,n){for(;t<n;){let r=e[t];e[t]=e[n],e[n]=r,++t,--n}}function dt(e,t){let n=Array.isArray(t)?t:[t],r=n.length;for(let t=0;t<r;t++)e[e.length]=n[t]}function ft(e,t){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}function pt(e,t,n){let r=t||st;return e.every(function(t,i){if(i===0)return!0;let a=r(e[i-1],t);return!(a>0||n&&a===0)})}function mt(){return!0}function ht(){return!1}function gt(){}function _t(e){let t,n,r;return function(){let i=Array.prototype.slice.call(arguments);return(!n||this!==r||!ft(i,n))&&(r=this,n=i,t=e.apply(this,arguments)),t}}function vt(e){function t(){let t;try{t=e()}catch(e){return Promise.reject(e)}return t instanceof Promise?t:Promise.resolve(t)}return t()}var yt=class{constructor(e){this.propagationStopped,this.defaultPrevented,this.type=e,this.target=null}preventDefault(){this.defaultPrevented=!0}stopPropagation(){this.propagationStopped=!0}},bt=class extends at{constructor(e){super(),this.eventTarget_=e,this.pendingRemovals_=null,this.dispatching_=null,this.listeners_=null}addEventListener(e,t){if(!e||!t)return;let n=this.listeners_||={},r=n[e]||(n[e]=[]);r.includes(t)||r.push(t)}dispatchEvent(e){let t=typeof e==`string`,n=t?e:e.type,r=this.listeners_&&this.listeners_[n];if(!r)return;let i=t?new yt(e):e;i.target||=this.eventTarget_||this;let a=this.dispatching_||={},o=this.pendingRemovals_||={};n in a||(a[n]=0,o[n]=0),++a[n];let s;for(let e=0,t=r.length;e<t;++e)if(s=`handleEvent`in r[e]?r[e].handleEvent(i):r[e].call(this,i),s===!1||i.propagationStopped){s=!1;break}if(--a[n]===0){let e=o[n];for(delete o[n];e--;)this.removeEventListener(n,gt);delete a[n]}return s}disposeInternal(){this.listeners_&&tt(this.listeners_)}getListeners(e){return this.listeners_&&this.listeners_[e]||void 0}hasListener(e){return this.listeners_?e?e in this.listeners_:Object.keys(this.listeners_).length>0:!1}removeEventListener(e,t){if(!this.listeners_)return;let n=this.listeners_[e];if(!n)return;let r=n.indexOf(t);r!==-1&&(this.pendingRemovals_&&e in this.pendingRemovals_?(n[r]=gt,++this.pendingRemovals_[e]):(n.splice(r,1),n.length===0&&delete this.listeners_[e]))}},xt=class extends bt{constructor(){super(),this.on=this.onInternal,this.once=this.onceInternal,this.un=this.unInternal,this.revision_=0}changed(){++this.revision_,this.dispatchEvent(P.CHANGE)}getRevision(){return this.revision_}onInternal(e,t){if(Array.isArray(e)){let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=N(this,e[i],t);return r}return N(this,e,t)}onceInternal(e,t){let n;if(Array.isArray(e)){let r=e.length;n=Array(r);for(let i=0;i<r;++i)n[i]=rt(this,e[i],t)}else n=rt(this,e,t);return t.ol_key=n,n}unInternal(e,t){let n=t.ol_key;if(n)St(n);else if(Array.isArray(e))for(let n=0,r=e.length;n<r;++n)this.removeEventListener(e[n],t);else this.removeEventListener(e,t)}};xt.prototype.on,xt.prototype.once,xt.prototype.un;function St(e){if(Array.isArray(e))for(let t=0,n=e.length;t<n;++t)it(e[t]);else it(e)}function F(){throw Error(`Unimplemented abstract method.`)}var Ct=0;function I(e){return e.ol_uid||=String(++Ct)}var wt=class extends yt{constructor(e,t,n){super(e),this.key=t,this.oldValue=n}},Tt=class extends xt{constructor(e){super(),this.on,this.once,this.un,I(this),this.values_=null,e!==void 0&&this.setProperties(e)}get(e){let t;return this.values_&&this.values_.hasOwnProperty(e)&&(t=this.values_[e]),t}getKeys(){return this.values_&&Object.keys(this.values_)||[]}getProperties(){return this.values_&&Object.assign({},this.values_)||{}}getPropertiesInternal(){return this.values_}hasProperties(){return!!this.values_}notify(e,t){let n;n=`change:${e}`,this.hasListener(n)&&this.dispatchEvent(new wt(n,e,t)),n=et.PROPERTYCHANGE,this.hasListener(n)&&this.dispatchEvent(new wt(n,e,t))}addChangeListener(e,t){this.addEventListener(`change:${e}`,t)}removeChangeListener(e,t){this.removeEventListener(`change:${e}`,t)}set(e,t,n){let r=this.values_||={};if(n)r[e]=t;else{let n=r[e];r[e]=t,n!==t&&this.notify(e,n)}}setProperties(e,t){for(let n in e)this.set(n,e[n],t)}applyProperties(e){e.values_&&Object.assign(this.values_||={},e.values_)}unset(e,t){if(this.values_&&e in this.values_){let n=this.values_[e];delete this.values_[e],nt(this.values_)&&(this.values_=null),t||this.notify(e,n)}}},Et={LENGTH:`length`},Dt=class extends yt{constructor(e,t,n){super(e),this.element=t,this.index=n}},Ot=class extends Tt{constructor(e,t){if(super(),this.on,this.once,this.un,t||={},this.unique_=!!t.unique,this.array_=e??[],this.unique_)for(let e=1,t=this.array_.length;e<t;++e)this.assertUnique_(this.array_[e],e);this.updateLength_()}clear(){for(;this.getLength()>0;)this.pop()}extend(e){for(let t=0,n=e.length;t<n;++t)this.push(e[t]);return this}forEach(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)e(t[n],n,t)}getArray(){return this.array_}item(e){return this.array_[e]}getLength(){return this.get(Et.LENGTH)}insertAt(e,t){if(e<0||e>this.getLength())throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t),this.array_.splice(e,0,t),this.updateLength_(),this.dispatchEvent(new Dt($e.ADD,t,e))}pop(){return this.removeAt(this.getLength()-1)}push(e){let t=this.getLength();return this.insertAt(t,e),this.getLength()}remove(e){let t=this.array_;for(let n=0,r=t.length;n<r;++n)if(t[n]===e)return this.removeAt(n)}removeAt(e){if(e<0||e>=this.getLength())return;let t=this.array_[e];return this.array_.splice(e,1),this.updateLength_(),this.dispatchEvent(new Dt($e.REMOVE,t,e)),t}setAt(e,t){if(e>=this.getLength()){this.insertAt(e,t);return}if(e<0)throw Error(`Index out of bounds: `+e);this.unique_&&this.assertUnique_(t,e);let n=this.array_[e];this.array_[e]=t,this.dispatchEvent(new Dt($e.REMOVE,n,e)),this.dispatchEvent(new Dt($e.ADD,t,e))}updateLength_(){this.set(Et.LENGTH,this.array_.length)}assertUnique_(e,t){let n=this.array_;for(let r=0,i=n.length;r<i;++r)if(n[r]===e&&r!==t)throw Error(`Duplicate item added to a unique collection`)}},kt=class extends yt{constructor(e,t,n){super(e),this.map=t,this.frameState=n===void 0?null:n}},At=class extends kt{constructor(e,t,n,r,i,a){super(e,t,i),this.originalEvent=n,this.pixel_=null,this.coordinate_=null,this.dragging=r!==void 0&&r,this.activePointers=a}get pixel(){return this.pixel_||=this.map.getEventPixel(this.originalEvent),this.pixel_}set pixel(e){this.pixel_=e}get coordinate(){return this.coordinate_||=this.map.getCoordinateFromPixel(this.pixel),this.coordinate_}set coordinate(e){this.coordinate_=e}preventDefault(){super.preventDefault(),`preventDefault`in this.originalEvent&&this.originalEvent.preventDefault()}stopPropagation(){super.stopPropagation(),`stopPropagation`in this.originalEvent&&this.originalEvent.stopPropagation()}},jt={SINGLECLICK:`singleclick`,CLICK:P.CLICK,DBLCLICK:P.DBLCLICK,POINTERDRAG:`pointerdrag`,POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},Mt=typeof navigator<`u`&&navigator.userAgent!==void 0?navigator.userAgent.toLowerCase():``;Mt.includes(`safari`)&&!Mt.includes(`chrom`)&&(Mt.includes(`version/15.4`)||/cpu (os|iphone os) 15_4 like mac os x/.test(Mt));var Nt=Mt.includes(`webkit`)&&!Mt.includes(`edge`),Pt=Mt.includes(`macintosh`),Ft=typeof devicePixelRatio<`u`?devicePixelRatio:1,It=typeof WorkerGlobalScope<`u`&&typeof OffscreenCanvas<`u`&&self instanceof WorkerGlobalScope,Lt=typeof Image<`u`&&Image.prototype.decode,Rt=(function(){let e=!1;try{let t=Object.defineProperty({},"passive",{get:function(){e=!0}});window.addEventListener(`_`,null,t),window.removeEventListener(`_`,null,t)}catch{}return e})(),zt={POINTERMOVE:`pointermove`,POINTERDOWN:`pointerdown`,POINTERUP:`pointerup`,POINTEROVER:`pointerover`,POINTEROUT:`pointerout`,POINTERENTER:`pointerenter`,POINTERLEAVE:`pointerleave`,POINTERCANCEL:`pointercancel`},Bt=class extends bt{constructor(e,t){super(e),this.map_=e,this.clickTimeoutId_,this.emulateClicks_=!1,this.dragging_=!1,this.dragListenerKeys_=[],this.moveTolerance_=t===void 0?1:t,this.down_=null;let n=this.map_.getViewport();this.activePointers_=[],this.trackedTouches_={},this.element_=n,this.pointerdownListenerKey_=N(n,zt.POINTERDOWN,this.handlePointerDown_,this),this.originalPointerMoveEvent_,this.relayedListenerKey_=N(n,zt.POINTERMOVE,this.relayMoveEvent_,this),this.boundHandleTouchMove_=this.handleTouchMove_.bind(this),this.element_.addEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_,Rt?{passive:!1}:!1)}emulateClick_(e){let t=new At(jt.CLICK,this.map_,e);this.dispatchEvent(t),this.clickTimeoutId_===void 0?this.clickTimeoutId_=setTimeout(()=>{this.clickTimeoutId_=void 0;let t=new At(jt.SINGLECLICK,this.map_,e);this.dispatchEvent(t)},250):(clearTimeout(this.clickTimeoutId_),this.clickTimeoutId_=void 0,t=new At(jt.DBLCLICK,this.map_,e),this.dispatchEvent(t))}updateActivePointers_(e){let t=e,n=t.pointerId;if(t.type==jt.POINTERUP||t.type==jt.POINTERCANCEL){delete this.trackedTouches_[n];for(let e in this.trackedTouches_)if(this.trackedTouches_[e].target!==t.target){delete this.trackedTouches_[e];break}}else(t.type==jt.POINTERDOWN||t.type==jt.POINTERMOVE)&&(this.trackedTouches_[n]=t);this.activePointers_=Object.values(this.trackedTouches_)}handlePointerUp_(e){this.updateActivePointers_(e);let t=new At(jt.POINTERUP,this.map_,e,void 0,void 0,this.activePointers_);this.dispatchEvent(t),this.emulateClicks_&&!t.defaultPrevented&&!this.dragging_&&this.isMouseActionButton_(e)&&this.emulateClick_(this.down_),this.activePointers_.length===0&&(this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.dragging_=!1,this.down_=null)}isMouseActionButton_(e){return e.button===0}handlePointerDown_(e){this.emulateClicks_=this.activePointers_.length===0,this.updateActivePointers_(e);let t=new At(jt.POINTERDOWN,this.map_,e,void 0,void 0,this.activePointers_);if(this.dispatchEvent(t),this.down_=new PointerEvent(e.type,e),Object.defineProperty(this.down_,"target",{writable:!1,value:e.target}),this.dragListenerKeys_.length===0){let e=this.map_.getOwnerDocument();this.dragListenerKeys_.push(N(e,jt.POINTERMOVE,this.handlePointerMove_,this),N(e,jt.POINTERUP,this.handlePointerUp_,this),N(this.element_,jt.POINTERCANCEL,this.handlePointerUp_,this)),this.element_.getRootNode&&this.element_.getRootNode()!==e&&this.dragListenerKeys_.push(N(this.element_.getRootNode(),jt.POINTERUP,this.handlePointerUp_,this))}}handlePointerMove_(e){if(this.isMoving_(e)){this.updateActivePointers_(e),this.dragging_=!0;let t=new At(jt.POINTERDRAG,this.map_,e,this.dragging_,void 0,this.activePointers_);this.dispatchEvent(t)}}relayMoveEvent_(e){this.originalPointerMoveEvent_=e;let t=!!(this.down_&&this.isMoving_(e));this.dispatchEvent(new At(jt.POINTERMOVE,this.map_,e,t))}handleTouchMove_(e){let t=this.originalPointerMoveEvent_;(!t||t.defaultPrevented)&&(typeof e.cancelable!=`boolean`||e.cancelable===!0)&&e.preventDefault()}isMoving_(e){return this.dragging_||Math.abs(e.clientX-this.down_.clientX)>this.moveTolerance_||Math.abs(e.clientY-this.down_.clientY)>this.moveTolerance_}disposeInternal(){this.relayedListenerKey_&&=(it(this.relayedListenerKey_),null),this.element_.removeEventListener(P.TOUCHMOVE,this.boundHandleTouchMove_),this.pointerdownListenerKey_&&=(it(this.pointerdownListenerKey_),null),this.dragListenerKeys_.forEach(it),this.dragListenerKeys_.length=0,this.element_=null,super.disposeInternal()}},Vt={POSTRENDER:`postrender`,MOVESTART:`movestart`,MOVEEND:`moveend`,LOADSTART:`loadstart`,LOADEND:`loadend`},Ht={LAYERGROUP:`layergroup`,SIZE:`size`,TARGET:`target`,VIEW:`view`},L={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function R(e,t){if(!e)throw Error(t)}var Ut=1/0,Wt=class{constructor(e,t){this.priorityFunction_=e,this.keyFunction_=t,this.elements_=[],this.priorities_=[],this.queuedElements_={}}clear(){this.elements_.length=0,this.priorities_.length=0,tt(this.queuedElements_)}dequeue(){let e=this.elements_,t=this.priorities_,n=e[0];e.length==1?(e.length=0,t.length=0):(e[0]=e.pop(),t[0]=t.pop(),this.siftUp_(0));let r=this.keyFunction_(n);return delete this.queuedElements_[r],n}enqueue(e){R(!(this.keyFunction_(e)in this.queuedElements_),"Tried to enqueue an `element` that was already added to the queue");let t=this.priorityFunction_(e);return t!=1/0&&(this.elements_.push(e),this.priorities_.push(t),this.queuedElements_[this.keyFunction_(e)]=!0,this.siftDown_(0,this.elements_.length-1),!0)}getCount(){return this.elements_.length}getLeftChildIndex_(e){return e*2+1}getRightChildIndex_(e){return e*2+2}getParentIndex_(e){return e-1>>1}heapify_(){let e;for(e=(this.elements_.length>>1)-1;e>=0;e--)this.siftUp_(e)}isEmpty(){return this.elements_.length===0}isKeyQueued(e){return e in this.queuedElements_}isQueued(e){return this.isKeyQueued(this.keyFunction_(e))}siftUp_(e){let t=this.elements_,n=this.priorities_,r=t.length,i=t[e],a=n[e],o=e;for(;e<r>>1;){let i=this.getLeftChildIndex_(e),a=this.getRightChildIndex_(e),o=a<r&&n[a]<n[i]?a:i;t[e]=t[o],n[e]=n[o],e=o}t[e]=i,n[e]=a,this.siftDown_(o,e)}siftDown_(e,t){let n=this.elements_,r=this.priorities_,i=n[t],a=r[t];for(;t>e;){let e=this.getParentIndex_(t);if(r[e]>a)n[t]=n[e],r[t]=r[e],t=e;else break}n[t]=i,r[t]=a}reprioritize(){let e=this.priorityFunction_,t=this.elements_,n=this.priorities_,r=0,i=t.length,a,o,s;for(o=0;o<i;++o)a=t[o],s=e(a),s==1/0?delete this.queuedElements_[this.keyFunction_(a)]:(n[r]=s,t[r++]=a);t.length=r,n.length=r,this.heapify_()}},Gt=class extends Wt{constructor(e,t){super(t=>e.apply(null,t),e=>e[0].getKey()),this.boundHandleTileChange_=this.handleTileChange.bind(this),this.tileChangeCallback_=t,this.tilesLoading_=0,this.tilesLoadingKeys_={}}enqueue(e){let t=super.enqueue(e);return t&&e[0].addEventListener(P.CHANGE,this.boundHandleTileChange_),t}getTilesLoading(){return this.tilesLoading_}handleTileChange(e){let t=e.target,n=t.getState();if(n===L.LOADED||n===L.ERROR||n===L.EMPTY){n!==L.ERROR&&t.removeEventListener(P.CHANGE,this.boundHandleTileChange_);let e=t.getKey();e in this.tilesLoadingKeys_&&(delete this.tilesLoadingKeys_[e],--this.tilesLoading_),this.tileChangeCallback_()}}loadMoreTiles(e,t){let n=0;for(;this.tilesLoading_<e&&n<t&&this.getCount()>0;){let e=this.dequeue()[0],t=e.getKey();e.getState()===L.IDLE&&!(t in this.tilesLoadingKeys_)&&(this.tilesLoadingKeys_[t]=!0,++this.tilesLoading_,++n,e.load())}}};function Kt(e,t,n,r,i){if(!e||!(n in e.wantedTiles)||!e.wantedTiles[n][t.getKey()])return Ut;let a=e.viewState.center,o=r[0]-a[0],s=r[1]-a[1];return 65536*Math.log(i)+Math.sqrt(o*o+s*s)/i}var qt={ANIMATING:0,INTERACTING:1},Jt={CENTER:`center`,RESOLUTION:`resolution`,ROTATION:`rotation`};function Yt(e,t,n){return Math.min(Math.max(e,t),n)}function Xt(e,t,n,r,i,a){let o=i-n,s=a-r;if(o!==0||s!==0){let c=((e-n)*o+(t-r)*s)/(o*o+s*s);c>1?(n=i,r=a):c>0&&(n+=o*c,r+=s*c)}return Zt(e,t,n,r)}function Zt(e,t,n,r){let i=n-e,a=r-t;return i*i+a*a}function Qt(e){let t=e.length;for(let n=0;n<t;n++){let r=n,i=Math.abs(e[n][n]);for(let a=n+1;a<t;a++){let t=Math.abs(e[a][n]);t>i&&(i=t,r=a)}if(i===0)return null;let a=e[r];e[r]=e[n],e[n]=a;for(let r=n+1;r<t;r++){let i=-e[r][n]/e[n][n];for(let a=n;a<t+1;a++)n==a?e[r][a]=0:e[r][a]+=i*e[n][a]}}let n=Array(t);for(let r=t-1;r>=0;r--){n[r]=e[r][t]/e[r][r];for(let i=r-1;i>=0;i--)e[i][t]-=e[i][r]*n[r]}return n}function $t(e){return e*180/Math.PI}function en(e){return e*Math.PI/180}function tn(e,t){let n=e%t;return n*t<0?n+t:n}function nn(e,t,n){return e+n*(t-e)}function rn(e,t){let n=10**t;return Math.round(e*n)/n}function an(e,t){return Math.floor(rn(e,t))}function on(e,t){return Math.ceil(rn(e,t))}function sn(e,t,n){if(e>=t&&e<n)return e;let r=n-t;return((e-t)%r+r)%r+t}function cn(e,t,n){return(function(r,i,a,o,s){if(!r)return;if(!i&&!t)return r;let c=t?0:a[0]*i,l=t?0:a[1]*i,u=s?s[0]:0,d=s?s[1]:0,f=e[0]+c/2+u,p=e[2]-c/2+u,m=e[1]+l/2+d,h=e[3]-l/2+d;f>p&&(f=(p+f)/2,p=f),m>h&&(m=(h+m)/2,h=m);let g=Yt(r[0],f,p),_=Yt(r[1],m,h);if(o&&n&&i){let e=30*i;g+=-e*Math.log(1+Math.max(0,f-r[0])/e)+e*Math.log(1+Math.max(0,r[0]-p)/e),_+=-e*Math.log(1+Math.max(0,m-r[1])/e)+e*Math.log(1+Math.max(0,r[1]-h)/e)}return[g,_]})}function ln(e){return e}var un={UNKNOWN:0,INTERSECTING:1,ABOVE:2,RIGHT:4,BELOW:8,LEFT:16};function dn(e){let t=bn();for(let n=0,r=e.length;n<r;++n)Dn(t,e[n]);return t}function fn(e,t,n){return xn(Math.min.apply(null,e),Math.min.apply(null,t),Math.max.apply(null,e),Math.max.apply(null,t),n)}function pn(e,t,n){return n?(n[0]=e[0]-t,n[1]=e[1]-t,n[2]=e[2]+t,n[3]=e[3]+t,n):[e[0]-t,e[1]-t,e[2]+t,e[3]+t]}function mn(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e.slice()}function hn(e,t,n){let r,i;return r=t<e[0]?e[0]-t:e[2]<t?t-e[2]:0,i=n<e[1]?e[1]-n:e[3]<n?n-e[3]:0,r*r+i*i}function gn(e,t){return vn(e,t[0],t[1])}function _n(e,t){return e[0]<=t[0]&&t[2]<=e[2]&&e[1]<=t[1]&&t[3]<=e[3]}function vn(e,t,n){return e[0]<=t&&t<=e[2]&&e[1]<=n&&n<=e[3]}function yn(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=t[0],s=t[1],c=un.UNKNOWN;return o<n?c|=un.LEFT:o>i&&(c|=un.RIGHT),s<r?c|=un.BELOW:s>a&&(c|=un.ABOVE),c===un.UNKNOWN&&(c=un.INTERSECTING),c}function bn(){return[1/0,1/0,-1/0,-1/0]}function xn(e,t,n,r,i){return i?(i[0]=e,i[1]=t,i[2]=n,i[3]=r,i):[e,t,n,r]}function Sn(e){return xn(1/0,1/0,-1/0,-1/0,e)}function Cn(e,t){let n=e[0],r=e[1];return xn(n,r,n,r,t)}function wn(e,t,n,r,i){return On(Sn(i),e,t,n,r)}function Tn(e,t){return e[0]==t[0]&&e[2]==t[2]&&e[1]==t[1]&&e[3]==t[3]}function En(e,t){return t[0]<e[0]&&(e[0]=t[0]),t[2]>e[2]&&(e[2]=t[2]),t[1]<e[1]&&(e[1]=t[1]),t[3]>e[3]&&(e[3]=t[3]),e}function Dn(e,t){t[0]<e[0]&&(e[0]=t[0]),t[0]>e[2]&&(e[2]=t[0]),t[1]<e[1]&&(e[1]=t[1]),t[1]>e[3]&&(e[3]=t[1])}function On(e,t,n,r,i){for(;n<r;n+=i)kn(e,t[n],t[n+1]);return e}function kn(e,t,n){e[0]=Math.min(e[0],t),e[1]=Math.min(e[1],n),e[2]=Math.max(e[2],t),e[3]=Math.max(e[3],n)}function An(e,t){let n;return n=t(Mn(e)),n||(n=t(Nn(e)),n)||(n=t(Hn(e)),n)||(n=t(Vn(e)),n)?n:!1}function jn(e){let t=0;return Wn(e)||(t=z(e)*Rn(e)),t}function Mn(e){return[e[0],e[1]]}function Nn(e){return[e[2],e[1]]}function Pn(e){return[(e[0]+e[2])/2,(e[1]+e[3])/2]}function Fn(e,t){let n;if(t===`bottom-left`)n=Mn(e);else if(t===`bottom-right`)n=Nn(e);else if(t===`top-left`)n=Vn(e);else if(t===`top-right`)n=Hn(e);else throw Error(`Invalid corner`);return n}function In(e,t,n,r,i){let[a,o,s,c,l,u,d,f]=Ln(e,t,n,r);return xn(Math.min(a,s,l,d),Math.min(o,c,u,f),Math.max(a,s,l,d),Math.max(o,c,u,f),i)}function Ln(e,t,n,r){let i=t*r[0]/2,a=t*r[1]/2,o=Math.cos(n),s=Math.sin(n),c=i*o,l=i*s,u=a*o,d=a*s,f=e[0],p=e[1];return[f-c+d,p-l-u,f-c-d,p-l+u,f+c-d,p+l+u,f+c+d,p+l-u,f-c+d,p-l-u]}function Rn(e){return e[3]-e[1]}function zn(e,t,n){let r=n||bn();return Un(e,t)?(r[0]=e[0]>t[0]?e[0]:t[0],r[1]=e[1]>t[1]?e[1]:t[1],r[2]=e[2]<t[2]?e[2]:t[2],r[3]=e[3]<t[3]?e[3]:t[3]):Sn(r),r}function Bn(e,t){if(!Un(e,t))return[e.slice()];if(_n(t,e))return[];let[n,r,i,a]=e,o=Math.max(n,t[0]),s=Math.max(r,t[1]),c=Math.min(i,t[2]),l=Math.min(a,t[3]),u=[];return o>n&&u.push([n,r,o,a]),c<i&&u.push([c,r,i,a]),s>r&&u.push([o,r,c,s]),l<a&&u.push([o,l,c,a]),u}function Vn(e){return[e[0],e[3]]}function Hn(e){return[e[2],e[3]]}function z(e){return e[2]-e[0]}function Un(e,t){return e[0]<=t[2]&&e[2]>=t[0]&&e[1]<=t[3]&&e[3]>=t[1]}function Wn(e){return e[2]<e[0]||e[3]<e[1]}function Gn(e,t){return t?(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t):e}function Kn(e,t){let n=(e[2]-e[0])/2*(t-1),r=(e[3]-e[1])/2*(t-1);e[0]-=n,e[2]+=n,e[1]-=r,e[3]+=r}function qn(e,t,n){let r=!1,i=yn(e,t),a=yn(e,n);if(i===un.INTERSECTING||a===un.INTERSECTING)r=!0;else{let o=e[0],s=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=n[0],p=n[1],m=(p-d)/(f-u),h,g;a&un.ABOVE&&!(i&un.ABOVE)&&(h=f-(p-l)/m,r=h>=o&&h<=c),!r&&a&un.RIGHT&&!(i&un.RIGHT)&&(g=p-(f-c)*m,r=g>=s&&g<=l),!r&&a&un.BELOW&&!(i&un.BELOW)&&(h=f-(p-s)/m,r=h>=o&&h<=c),!r&&a&un.LEFT&&!(i&un.LEFT)&&(g=p-(f-o)*m,r=g>=s&&g<=l)}return r}function Jn(e,t,n,r){if(Wn(e))return Sn(n);let i=[];if(r>1){let t=e[2]-e[0],n=e[3]-e[1];for(let a=0;a<r;++a)i.push(e[0]+t*a/r,e[1],e[2],e[1]+n*a/r,e[2]-t*a/r,e[3],e[0],e[3]-n*a/r)}else i=[e[0],e[1],e[2],e[1],e[2],e[3],e[0],e[3]];t(i,i,2);let a=[],o=[];for(let e=0,t=i.length;e<t;e+=2)a.push(i[e]),o.push(i[e+1]);return fn(a,o,n)}function Yn(e,t){let n=t.getExtent(),r=Pn(e);if(t.canWrapX()&&(r[0]<n[0]||r[0]>=n[2])){let t=z(n),i=Math.floor((r[0]-n[0])/t)*t;e[0]-=i,e[2]-=i}return e}function Xn(e,t,n){if(t.canWrapX()){let r=t.getExtent();if(!isFinite(e[0])||!isFinite(e[2]))return[[r[0],e[1],r[2],e[3]]];Yn(e,t);let i=z(r);if(z(e)>i&&!n)return[[r[0],e[1],r[2],e[3]]];if(e[0]<r[0])return[[e[0]+i,e[1],r[2],e[3]],[r[0],e[1],e[2],e[3]]];if(e[2]>r[2])return[[e[0],e[1],r[2],e[3]],[r[0],e[1],e[2]-i,e[3]]]}return[e]}function Zn(e,t){let n=[e];for(let e=0,r=t.length;e<r&&n.length>0;++e){let r=[];for(let i=0,a=n.length;i<a;++i)r.push(...Bn(n[i],t[e]));n=r}return n}function Qn(e,t){return e[0]+=+t[0],e[1]+=+t[1],e}function $n(e,t){let n=!0;for(let r=e.length-1;r>=0;--r)if(e[r]!=t[r]){n=!1;break}return n}function er(e,t){let n=Math.cos(t),r=Math.sin(t),i=e[0]*n-e[1]*r,a=e[1]*n+e[0]*r;return e[0]=i,e[1]=a,e}function tr(e,t){return e[0]*=t,e[1]*=t,e}function nr(e,t){let n=e[0]-t[0],r=e[1]-t[1];return n*n+r*r}function rr(e,t){return Math.sqrt(nr(e,t))}function ir(e,t){if(t.canWrapX()){let n=z(t.getExtent()),r=ar(e,t,n);r&&(e[0]-=r*n)}return e}function ar(e,t,n){let r=t.getExtent(),i=0;return t.canWrapX()&&(e[0]<r[0]||e[0]>r[2])&&(n||=z(r),i=Math.floor((e[0]-r[0])/n)),i}function or(e,t,n){let r=Math.sqrt((t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])),i=[(t[0]-e[0])/r,(t[1]-e[1])/r],a=[-i[1],i[0]],o=Math.sqrt((n[0]-e[0])*(n[0]-e[0])+(n[1]-e[1])*(n[1]-e[1])),s=[(n[0]-e[0])/o,(n[1]-e[1])/o],c=r===0||o===0?0:Math.acos(Yt(s[0]*i[0]+s[1]*i[1],-1,1));return c=Math.max(c,1e-5),s[0]*a[0]+s[1]*a[1]>0?c:Math.PI*2-c}function sr(e){return e**3}function cr(e){return 1-sr(1-e)}function lr(e){return 3*e*e-2*e*e*e}function ur(e){return e}function dr(e,t,n){n||=6371008.8;let r=en(e[1]),i=en(t[1]),a=(i-r)/2,o=en(t[0]-e[0])/2,s=Math.sin(a)*Math.sin(a)+Math.sin(o)*Math.sin(o)*Math.cos(r)*Math.cos(i);return 2*n*Math.atan2(Math.sqrt(s),Math.sqrt(1-s))}var fr={info:1,warn:2,error:3,none:4},pr=fr.info;function mr(...e){pr>fr.warn||console.warn(...e)}var hr={radians:6370997/(2*Math.PI),degrees:2*Math.PI*6370997/360,ft:.3048,m:1,"us-ft":1200/3937},gr=class{constructor(e){this.code_=e.code,this.units_=e.units,this.extent_=e.extent===void 0?null:e.extent,this.worldExtent_=e.worldExtent===void 0?null:e.worldExtent,this.axisOrientation_=e.axisOrientation===void 0?`enu`:e.axisOrientation,this.global_=e.global!==void 0&&e.global,this.canWrapX_=!!(this.global_&&this.extent_),this.getPointResolutionFunc_=e.getPointResolution,this.defaultTileGrid_=null,this.metersPerUnit_=e.metersPerUnit}canWrapX(){return this.canWrapX_}getCode(){return this.code_}getExtent(){return this.extent_}getUnits(){return this.units_}getMetersPerUnit(){return this.metersPerUnit_||hr[this.units_]}getWorldExtent(){return this.worldExtent_}getAxisOrientation(){return this.axisOrientation_}isGlobal(){return this.global_}setGlobal(e){this.global_=e,this.canWrapX_=!!(e&&this.extent_)}getDefaultTileGrid(){return this.defaultTileGrid_}setDefaultTileGrid(e){this.defaultTileGrid_=e}setExtent(e){this.extent_=e,this.canWrapX_=!!(this.global_&&e)}setWorldExtent(e){this.worldExtent_=e}setGetPointResolution(e){this.getPointResolutionFunc_=e}getPointResolutionFunc(){return this.getPointResolutionFunc_}},_r=6378137,vr=Math.PI*_r,yr=[-vr,-vr,vr,vr],br=[-180,-85,180,85],xr=_r*Math.log(Math.tan(Math.PI/2)),Sr=class extends gr{constructor(e){super({code:e,units:`m`,extent:yr,global:!0,worldExtent:br,getPointResolution:function(e,t){return e/Math.cosh(t[1]/_r)}})}},Cr=[new Sr(`EPSG:3857`),new Sr(`EPSG:102100`),new Sr(`EPSG:102113`),new Sr(`EPSG:900913`),new Sr(`http://www.opengis.net/def/crs/EPSG/0/3857`),new Sr(`http://www.opengis.net/gml/srs/epsg.xml#3857`)];function wr(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r){t[n]=vr*e[n]/180;let r=_r*Math.log(Math.tan(Math.PI*(+e[n+1]+90)/360));r>xr?r=xr:r<-xr&&(r=-xr),t[n+1]=r}return t}function Tr(e,t,n,r){let i=e.length;n=n>1?n:2,r??=n,t===void 0&&(t=n>2?e.slice():Array(i));for(let n=0;n<i;n+=r)t[n]=180*e[n]/vr,t[n+1]=360*Math.atan(Math.exp(e[n+1]/_r))/Math.PI-90;return t}var Er=6378137,Dr=[-180,-90,180,90],Or=Math.PI*Er/180,kr=class extends gr{constructor(e,t){super({code:e,units:`degrees`,extent:Dr,axisOrientation:t,global:!0,metersPerUnit:Or,worldExtent:Dr})}},Ar=[new kr(`CRS:84`),new kr(`EPSG:4326`,`neu`),new kr(`urn:ogc:def:crs:OGC:1.3:CRS84`),new kr(`urn:ogc:def:crs:OGC:2:84`),new kr(`http://www.opengis.net/def/crs/OGC/1.3/CRS84`),new kr(`http://www.opengis.net/gml/srs/epsg.xml#4326`,`neu`),new kr(`http://www.opengis.net/def/crs/EPSG/0/4326`,`neu`)],jr={};function Mr(e){return jr[e]||jr[e.replace(/urn:(x-)?ogc:def:crs:EPSG:(.*:)?(\w+)$/,`EPSG:$3`)]||null}function Nr(e,t){jr[e]=t}var Pr={};function Fr(e,t,n){let r=e.getCode(),i=t.getCode();r in Pr||(Pr[r]={}),Pr[r][i]=n}function Ir(e,t){return e in Pr&&t in Pr[e]?Pr[e][t]:null}var Lr=.9996,Rr=.00669438,zr=Rr*Rr,Br=zr*Rr,Vr=Rr/.99330562,Hr=Math.sqrt(.99330562),Ur=(1-Hr)/(1+Hr),Wr=Ur*Ur,Gr=Wr*Ur,Kr=Gr*Ur,qr=Kr*Ur,Jr=1-Rr/4-3*zr/64-5*Br/256,Yr=.002514607064228144,Xr=26390466021299826e-22,Zr=35*Br/3072,Qr=3/2*Ur-27/32*Gr+269/512*qr,$r=21/16*Wr-55/32*Kr,ei=151/96*Gr-417/128*qr,ti=1097/512*Kr,ni=6378137;function ri(e,t,n){let r=e-5e5,i=(n.north?t:t-1e7)/Lr/(ni*Jr),a=i+Qr*Math.sin(2*i)+$r*Math.sin(4*i)+ei*Math.sin(6*i)+ti*Math.sin(8*i),o=Math.sin(a),s=o*o,c=Math.cos(a),l=o/c,u=l*l,d=u*u,f=1-Rr*s,p=ni/Math.sqrt(1-Rr*s),m=.99330562/f,h=Vr*c**2,g=h*h,_=r/(p*Lr),v=_*_,y=v*_,b=y*_,x=b*_,S=x*_,C=a-l/m*(v/2-b/24*(5+3*u+10*h-4*g-9*Vr))+S/720*(61+90*u+298*h+45*d-252*Vr-3*g),w=(_-y/6*(1+2*u+h)+x/120*(5-2*h+28*u-3*g+8*Vr+24*d))/c;return w=sn(w+en(li(n.number)),-Math.PI,Math.PI),[$t(w),$t(C)]}var ii=-80,ai=84,oi=-180,si=180;function ci(e,t,n){e=sn(e,oi,si),t<ii?t=ii:t>ai&&(t=ai);let r=en(t),i=Math.sin(r),a=Math.cos(r),o=i/a,s=o*o,c=s*s,l=en(e),u=en(li(n.number)),d=ni/Math.sqrt(1-Rr*i**2),f=Vr*a**2,p=a*sn(l-u,-Math.PI,Math.PI),m=p*p,h=m*p,g=h*p,_=g*p,v=_*p,y=ni*(Jr*r-Yr*Math.sin(2*r)+Xr*Math.sin(4*r)-Zr*Math.sin(6*r)),b=Lr*d*(p+h/6*(1-s+f)+_/120*(5-18*s+c+72*f-58*Vr))+5e5,x=Lr*(y+d*o*(m/2+g/24*(5-s+9*f+4*f**2)+v/720*(61-58*s+c+600*f-330*Vr)));return n.north||(x+=1e7),[b,x]}function li(e){return(e-1)*6-180+3}var ui=[/^EPSG:(\d+)$/,/^urn:ogc:def:crs:EPSG::(\d+)$/,/^http:\/\/www\.opengis\.net\/def\/crs\/EPSG\/0\/(\d+)$/];function di(e){let t=0;for(let n of ui){let r=e.match(n);if(r){t=parseInt(r[1]);break}}if(!t)return null;let n=0,r=!1;return t>32700&&t<32761?n=t-32700:t>32600&&t<32661&&(r=!0,n=t-32600),n?{number:n,north:r}:null}function fi(e,t){return function(n,r,i,a){let o=n.length;i=i>1?i:2,a??=i,r||=i>2?n.slice():Array(o);for(let i=0;i<o;i+=a){let a=n[i],o=n[i+1],s=e(a,o,t);r[i]=s[0],r[i+1]=s[1]}return r}}function pi(e){return di(e)?new gr({code:e,units:`m`}):null}function mi(e){let t=di(e.getCode());return t?{forward:fi(ci,t),inverse:fi(ri,t)}:null}var hi=[mi],gi=[pi],_i=!0;function vi(e){_i=!(e===void 0||e)}function yi(e,t){if(t!==void 0){for(let n=0,r=e.length;n<r;++n)t[n]=e[n];t=t}else t=e.slice();return t}function bi(e){Nr(e.getCode(),e),Fr(e,e,yi)}function xi(e){e.forEach(bi)}function B(e){if(typeof e!=`string`)return e;let t=Mr(e);if(t)return t;for(let t of gi){let n=t(e);if(n)return n}return null}function Si(e,t,n,r){e=B(e);let i,a=e.getPointResolutionFunc();if(a){if(i=a(t,n),r&&r!==e.getUnits()){let t=e.getMetersPerUnit();t&&(i=i*t/hr[r])}}else{let a=e.getUnits();if(a==`degrees`&&!r||r==`degrees`)i=t;else{let o=Ai(e,B(`EPSG:4326`));if(!o&&a!==`degrees`)i=t*e.getMetersPerUnit();else{let e=[n[0]-t/2,n[1],n[0]+t/2,n[1],n[0],n[1]-t/2,n[0],n[1]+t/2];e=o(e,e,2),i=(dr(e.slice(0,2),e.slice(2,4))+dr(e.slice(4,6),e.slice(6,8)))/2}let s=r?hr[r]:e.getMetersPerUnit();s!==void 0&&(i/=s)}}return i}function Ci(e){xi(e),e.forEach(function(t){e.forEach(function(e){t!==e&&Fr(t,e,yi)})})}function wi(e,t,n,r){e.forEach(function(e){t.forEach(function(t){Fr(e,t,n),Fr(t,e,r)})})}function Ti(e,t){return e?typeof e==`string`?B(e):e:B(t)}function Ei(e){return(function(t,n,r,i){let a=t.length;r=r===void 0?2:r,i??=r,n=n===void 0?Array(a):n;for(let o=0;o<a;o+=i){let a=e(t.slice(o,o+r)),s=a.length;for(let e=0,r=i;e<r;++e)n[o+e]=e>=s?t[o+e]:a[e]}return n})}function Di(e,t){return vi(),Ni(e,`EPSG:4326`,t===void 0?`EPSG:3857`:t)}function Oi(e,t){let n=Ni(e,t===void 0?`EPSG:3857`:t,`EPSG:4326`),r=n[0];return(r<-180||r>180)&&(n[0]=tn(r+180,360)-180),n}function ki(e,t){if(e===t)return!0;let n=e.getUnits()===t.getUnits();return(e.getCode()===t.getCode()||Ai(e,t)===yi)&&n}function Ai(e,t){let n=e.getCode(),r=t.getCode(),i=Ir(n,r);if(i)return i;let a=null,o=null;for(let n of hi)a||=n(e),o||=n(t);if(!a&&!o)return null;let s=`EPSG:4326`;if(!o){let e=Ir(s,r);e&&(i=ji(a.inverse,e))}else if(a)i=ji(a.inverse,o.forward);else{let e=Ir(n,s);e&&(i=ji(e,o.forward))}return i&&(bi(e),bi(t),Fr(e,t,i)),i}function ji(e,t){return function(n,r,i,a){return r=e(n,r,i,a),t(r,r,i,a)}}function Mi(e,t){return Ai(B(e),B(t))}function Ni(e,t,n){let r=Mi(t,n);if(!r){let e=B(t).getCode(),r=B(n).getCode();throw Error(`No transform available between ${e} and ${r}`)}return r(e,void 0,e.length)}function Pi(e,t,n,r){return Jn(e,Mi(t,n),void 0,r)}var Fi=null;function Ii(){return Fi}function Li(e,t){return e}function Ri(e,t){return _i&&!$n(e,[0,0])&&e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90&&(_i=!1,mr(`Call useGeographic() from ol/proj once to work with [longitude, latitude] coordinates.`)),e}function zi(e,t){return e}function Bi(e,t){return e}function Vi(e,t){return e}function Hi(){Ci(Cr),Ci(Ar),wi(Ar,Cr,wr,Tr)}Hi();var Ui=[1,0,0,1,0,0],Wi=[,,,,,,];function Gi(){return Ui.slice(0)}function Ki(e){return Ji(e,1,0,0,1,0,0)}function qi(e,t){let n=e[0],r=e[1],i=e[2],a=e[3],o=e[4],s=e[5],c=t[0],l=t[1],u=t[2],d=t[3],f=t[4],p=t[5];return e[0]=n*c+i*l,e[1]=r*c+a*l,e[2]=n*u+i*d,e[3]=r*u+a*d,e[4]=n*f+i*p+o,e[5]=r*f+a*p+s,e}function Ji(e,t,n,r,i,a,o){return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e[4]=a,e[5]=o,e}function Yi(e,t){return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e}function Xi(e,t){let n=t[0],r=t[1];return t[0]=e[0]*n+e[2]*r+e[4],t[1]=e[1]*n+e[3]*r+e[5],t}function Zi(e,t,n){return qi(e,Ji(Wi,t,0,0,n,0,0))}function Qi(e,t,n){return qi(e,Ji(Wi,1,0,0,1,t,n))}function $i(e,t,n,r,i,a,o,s){let c=Math.sin(a),l=Math.cos(a);return e[0]=r*l,e[1]=i*c,e[2]=-r*c,e[3]=i*l,e[4]=o*r*l-s*r*c+t,e[5]=o*i*c+s*i*l+n,e}function ea(e,t){let n=ta(t);R(n!==0,`Transformation matrix cannot be inverted`);let r=t[0],i=t[1],a=t[2],o=t[3],s=t[4],c=t[5];return e[0]=o/n,e[1]=-i/n,e[2]=-a/n,e[3]=r/n,e[4]=(a*c-o*s)/n,e[5]=-(r*c-i*s)/n,e}function ta(e){return e[0]*e[3]-e[1]*e[2]}var na=[1e5,1e5,1e5,1e5,2,2];function ra(e){return`matrix(`+e.join(`, `)+`)`}function ia(e){return e.substring(7,e.length-1).split(`,`).map(parseFloat)}function aa(e,t){let n=ia(e),r=ia(t);for(let e=0;e<6;++e)if(Math.round((n[e]-r[e])*na[e])!==0)return!1;return!0}function oa(e,t,n,r,i,a,o){a||=[],o||=2;let s=0;for(let c=t;c<n;c+=r){let t=e[c],n=e[c+1];a[s++]=i[0]*t+i[2]*n+i[4],a[s++]=i[1]*t+i[3]*n+i[5];for(let t=2;t<o;t++)a[s++]=e[c+t]}return a&&a.length!=s&&(a.length=s),a}function sa(e,t,n,r,i,a,o){o||=[];let s=Math.cos(i),c=Math.sin(i),l=a[0],u=a[1],d=0;for(let i=t;i<n;i+=r){let t=e[i]-l,n=e[i+1]-u;o[d++]=l+t*s-n*c,o[d++]=u+t*c+n*s;for(let t=i+2;t<i+r;++t)o[d++]=e[t]}return o&&o.length!=d&&(o.length=d),o}function ca(e,t,n,r,i,a,o,s){s||=[];let c=o[0],l=o[1],u=0;for(let o=t;o<n;o+=r){let t=e[o]-c,n=e[o+1]-l;s[u++]=c+i*t,s[u++]=l+a*n;for(let t=o+2;t<o+r;++t)s[u++]=e[t]}return s&&s.length!=u&&(s.length=u),s}function la(e,t,n,r,i,a,o){o||=[];let s=0;for(let c=t;c<n;c+=r){o[s++]=e[c]+i,o[s++]=e[c+1]+a;for(let t=c+2;t<c+r;++t)o[s++]=e[t]}return o&&o.length!=s&&(o.length=s),o}var ua=Gi(),da=[NaN,NaN],fa=class extends Tt{constructor(){super(),this.extent_=bn(),this.extentRevision_=-1,this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=0,this.simplifyTransformedInternal=_t((e,t,n)=>{if(!n)return this.getSimplifiedGeometry(t);let r=this.clone();return r.applyTransform(n),r.getSimplifiedGeometry(t)})}simplifyTransformed(e,t){return this.simplifyTransformedInternal(this.getRevision(),e,t)}clone(){return F()}closestPointXY(e,t,n,r){return F()}containsXY(e,t){return this.closestPointXY(e,t,da,Number.MIN_VALUE)===0}getClosestPoint(e,t){return t||=[NaN,NaN],this.closestPointXY(e[0],e[1],t,1/0),t}intersectsCoordinate(e){return this.containsXY(e[0],e[1])}computeExtent(e){return F()}getExtent(e){if(this.extentRevision_!=this.getRevision()){let e=this.computeExtent(this.extent_);(isNaN(e[0])||isNaN(e[1]))&&Sn(e),this.extentRevision_=this.getRevision()}return Gn(this.extent_,e)}rotate(e,t){F()}scale(e,t,n){F()}simplify(e){return this.getSimplifiedGeometry(e*e)}getSimplifiedGeometry(e){return F()}getType(){return F()}applyTransform(e){F()}intersectsExtent(e){return F()}translate(e,t){F()}transform(e,t){let n=B(e),r=n.getUnits()==`tile-pixels`?function(e,r,i){let a=n.getExtent(),o=n.getWorldExtent(),s=Rn(o)/Rn(a);$i(ua,o[0],o[3],s,-s,0,0,0);let c=oa(e,0,e.length,i,ua,r),l=Mi(n,t);return l?l(c,c,i):c}:Mi(n,t);return this.applyTransform(r),this}},pa=class extends fa{constructor(){super(),this.layout=`XY`,this.stride=2,this.flatCoordinates}computeExtent(e){return wn(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinates(){return F()}getFirstCoordinate(){return this.flatCoordinates.slice(0,this.stride)}getFlatCoordinates(){return this.flatCoordinates}getLastCoordinate(){return this.flatCoordinates.slice(this.flatCoordinates.length-this.stride)}getLayout(){return this.layout}getSimplifiedGeometry(e){if(this.simplifiedGeometryRevision!==this.getRevision()&&(this.simplifiedGeometryMaxMinSquaredTolerance=0,this.simplifiedGeometryRevision=this.getRevision()),e<0||this.simplifiedGeometryMaxMinSquaredTolerance!==0&&e<=this.simplifiedGeometryMaxMinSquaredTolerance)return this;let t=this.getSimplifiedGeometryInternal(e);return t.getFlatCoordinates().length<this.flatCoordinates.length?t:(this.simplifiedGeometryMaxMinSquaredTolerance=e,this)}getSimplifiedGeometryInternal(e){return this}getStride(){return this.stride}setFlatCoordinates(e,t){this.stride=ha(e),this.layout=e,this.flatCoordinates=t}setCoordinates(e,t){F()}setLayout(e,t,n){let r;if(e)r=ha(e);else{for(let e=0;e<n;++e){if(t.length===0){this.layout=`XY`,this.stride=2;return}t=t[0]}r=t.length,e=ma(r)}this.layout=e,this.stride=r}applyTransform(e){this.flatCoordinates&&(e(this.flatCoordinates,this.flatCoordinates,this.layout.startsWith(`XYZ`)?3:2,this.stride),this.changed())}rotate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();sa(n,0,n.length,r,e,t,n),this.changed()}}scale(e,t,n){t===void 0&&(t=e),n||=Pn(this.getExtent());let r=this.getFlatCoordinates();if(r){let i=this.getStride();ca(r,0,r.length,i,e,t,n,r),this.changed()}}translate(e,t){let n=this.getFlatCoordinates();if(n){let r=this.getStride();la(n,0,n.length,r,e,t,n),this.changed()}}};function ma(e){let t;return e==2?t=`XY`:e==3?t=`XYZ`:e==4&&(t=`XYZM`),t}function ha(e){let t;return e==`XY`?t=2:e==`XYZ`||e==`XYM`?t=3:e==`XYZM`&&(t=4),t}function ga(e,t,n){let r=e.getFlatCoordinates();if(!r)return null;let i=e.getStride();return oa(r,0,r.length,i,t,n)}function _a(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1],s=0,c=0;for(;t<n;t+=r){let n=e[t]-a,r=e[t+1]-o;i+=c*n-s*r,s=n,c=r}return i/2}function va(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=_a(e,t,o,r),t=o}return i}function ya(e,t,n,r){let i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a];i+=va(e,t,o,r),t=o[o.length-1]}return i}function ba(e,t,n,r,i,a,o){let s=e[t],c=e[t+1],l=e[n]-s,u=e[n+1]-c,d;if(l===0&&u===0)d=t;else{let f=((i-s)*l+(a-c)*u)/(l*l+u*u);if(f>1)d=n;else if(f>0){for(let i=0;i<r;++i)o[i]=nn(e[t+i],e[n+i],f);o.length=r;return}else d=t}for(let t=0;t<r;++t)o[t]=e[d+t];o.length=r}function xa(e,t,n,r,i){let a=e[t],o=e[t+1];for(t+=r;t<n;t+=r){let n=e[t],r=e[t+1],s=Zt(a,o,n,r);s>i&&(i=s),a=n,o=r}return i}function Sa(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=xa(e,t,o,r,i),t=o}return i}function Ca(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];i=Sa(e,t,o,r,i),t=o[o.length-1]}return i}function wa(e,t,n,r,i,a,o,s,c,l,u){if(t==n)return l;let d,f;if(i===0){if(f=Zt(o,s,e[t],e[t+1]),f<l){for(d=0;d<r;++d)c[d]=e[t+d];return c.length=r,f}return l}u||=[NaN,NaN];let p=t+r;for(;p<n;)if(ba(e,p-r,p,r,o,s,u),f=Zt(o,s,u[0],u[1]),f<l){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r,p+=r}else p+=r*Math.max((Math.sqrt(f)-Math.sqrt(l))/i|0,1);if(a&&(ba(e,n-r,t,r,o,s,u),f=Zt(o,s,u[0],u[1]),f<l)){for(l=f,d=0;d<r;++d)c[d]=u[d];c.length=r}return l}function Ta(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=wa(e,t,f,r,i,a,o,s,c,l,u),t=f}return l}function Ea(e,t,n,r,i,a,o,s,c,l,u){u||=[NaN,NaN];for(let d=0,f=n.length;d<f;++d){let f=n[d];l=Ta(e,t,f,r,i,a,o,s,c,l,u),t=f[f.length-1]}return l}function Da(e,t,n,r){for(let r=0,i=n.length;r<i;++r)e[t++]=n[r];return t}function Oa(e,t,n,r){for(let i=0,a=n.length;i<a;++i){let a=n[i];for(let n=0;n<r;++n)e[t++]=a[n]}return t}function ka(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=Oa(e,t,n[o],r);i[a++]=s,t=s}return i.length=a,i}function Aa(e,t,n,r,i){i||=[];let a=0;for(let o=0,s=n.length;o<s;++o){let s=ka(e,t,n[o],r,i[a]);s.length===0&&(s[0]=t),i[a++]=s,t=s[s.length-1]}return i.length=a,i}function ja(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=t;o<n;o+=r)i[a++]=e.slice(o,o+r);return i.length=a,i}function Ma(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=ja(e,t,s,r,i[a]),t=s}return i.length=a,i}function Na(e,t,n,r,i){i=i===void 0?[]:i;let a=0;for(let o=0,s=n.length;o<s;++o){let s=n[o];i[a++]=s.length===1&&s[0]===t?[]:Ma(e,t,s,r,i[a]),t=s[s.length-1]}return i.length=a,i}function Pa(e,t,n,r,i){return!An(i,function(i){return!Fa(e,t,n,r,i[0],i[1])})}function Fa(e,t,n,r,i,a){let o=0,s=e[n-r],c=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];c<=a?r>a&&(n-s)*(a-c)-(i-s)*(r-c)>0&&o++:r<=a&&(n-s)*(a-c)-(i-s)*(r-c)<0&&o--,s=n,c=r}return o!==0}function Ia(e,t,n,r,i,a){if(n.length===0||!Fa(e,t,n[0],r,i,a))return!1;for(let t=1,o=n.length;t<o;++t)if(Fa(e,n[t-1],n[t],r,i,a))return!1;return!0}function La(e,t,n,r,i,a){if(n.length===0)return!1;for(let o=0,s=n.length;o<s;++o){let s=n[o];if(Ia(e,t,s,r,i,a))return!0;t=s[s.length-1]}return!1}function Ra(e,t,n,r,i){let a;for(t+=r;t<n;t+=r)if(a=i(e.slice(t-r,t),e.slice(t,t+r)),a)return a;return!1}function za(e,t,n,r,i,a){return a??=On(bn(),e,t,n,r),Un(i,a)?a[0]>=i[0]&&a[2]<=i[2]||a[1]>=i[1]&&a[3]<=i[3]||Ra(e,t,n,r,function(e,t){return qn(i,e,t)}):!1}function Ba(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){if(za(e,t,n[a],r,i))return!0;t=n[a]}return!1}function Va(e,t,n,r,i){return!!(za(e,t,n,r,i)||Fa(e,t,n,r,i[0],i[1])||Fa(e,t,n,r,i[0],i[3])||Fa(e,t,n,r,i[2],i[1])||Fa(e,t,n,r,i[2],i[3]))}function Ha(e,t,n,r,i){if(!Va(e,t,n[0],r,i))return!1;if(n.length===1)return!0;for(let t=1,a=n.length;t<a;++t)if(Pa(e,n[t-1],n[t],r,i)&&!za(e,n[t-1],n[t],r,i))return!1;return!0}function Ua(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(Ha(e,t,o,r,i))return!0;t=o[o.length-1]}return!1}function Wa(e,t,n,r,i,a,o){let s=(n-t)/r;if(s<3){for(;t<n;t+=r)a[o++]=e[t],a[o++]=e[t+1];return o}let c=Array(s);c[0]=1,c[s-1]=1;let l=[t,n-r],u=0;for(;l.length>0;){let n=l.pop(),a=l.pop(),o=0,s=e[a],d=e[a+1],f=e[n],p=e[n+1];for(let t=a+r;t<n;t+=r){let n=e[t],r=e[t+1],i=Xt(n,r,s,d,f,p);i>o&&(u=t,o=i)}o>i&&(c[(u-t)/r]=1,a+r<u&&l.push(a,u),u+r<n&&l.push(u,n))}for(let n=0;n<s;++n)c[n]&&(a[o++]=e[t+n*r],a[o++]=e[t+n*r+1]);return o}function Ga(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=Wa(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Ka(e,t){return t*Math.round(e/t)}function qa(e,t,n,r,i,a,o){if(t==n)return o;let s=Ka(e[t],i),c=Ka(e[t+1],i);t+=r,a[o++]=s,a[o++]=c;let l,u;do if(l=Ka(e[t],i),u=Ka(e[t+1],i),t+=r,t==n)return a[o++]=l,a[o++]=u,o;while(l==s&&u==c);for(;t<n;){let n=Ka(e[t],i),d=Ka(e[t+1],i);if(t+=r,n==l&&d==u)continue;let f=l-s,p=u-c,m=n-s,h=d-c;if(f*h==p*m&&(f<0&&m<f||f==m||f>0&&m>f)&&(p<0&&h<p||p==h||p>0&&h>p)){l=n,u=d;continue}a[o++]=l,a[o++]=u,s=l,c=u,l=n,u=d}return a[o++]=l,a[o++]=u,o}function Ja(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c];o=qa(e,t,l,r,i,a,o),s.push(o),t=l}return o}function Ya(e,t,n,r,i,a,o,s){for(let c=0,l=n.length;c<l;++c){let l=n[c],u=[];o=Ja(e,t,l,r,i,a,o,u),s.push(u),t=l[l.length-1]}return o}var Xa=class e extends pa{constructor(e,t){super(),this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}clone(){return new e(this.flatCoordinates.slice(),this.layout)}closestPointXY(e,t,n,r){return r<hn(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(xa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),wa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!0,e,t,n,r))}getArea(){return _a(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinates(){return ja(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getSimplifiedGeometryInternal(t){let n=[];return n.length=Wa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LinearRing`}intersectsExtent(e){return za(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Oa(this.flatCoordinates,0,e,this.stride),this.changed()}},Za=class e extends pa{constructor(e,t){super(),this.setCoordinates(e,t)}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){let i=this.flatCoordinates,a=Zt(e,t,i[0],i[1]);if(a<r){let e=this.stride;for(let t=0;t<e;++t)n[t]=i[t];return n.length=e,a}return r}getCoordinates(){return this.flatCoordinates.slice()}computeExtent(e){return Cn(this.flatCoordinates,e)}getType(){return`Point`}intersectsExtent(e){return vn(e,this.flatCoordinates[0],this.flatCoordinates[1])}setCoordinates(e,t){this.setLayout(t,e,0),this.flatCoordinates||=[],this.flatCoordinates.length=Da(this.flatCoordinates,0,e,this.stride),this.changed()}};function Qa(e,t,n,r,i,a,o){let s,c,l,u,d,f,p,m=i[a+1],h=[];for(let i=0,a=n.length;i<a;++i){let a=n[i];for(u=e[a-r],f=e[a-r+1],s=t;s<a;s+=r)d=e[s],p=e[s+1],(m<=f&&p<=m||f<=m&&m<=p)&&(l=(m-f)/(p-f)*(d-u)+u,h.push(l)),u=d,f=p}let g=NaN,_=-1/0;for(h.sort(st),u=h[0],s=1,c=h.length;s<c;++s){d=h[s];let i=Math.abs(d-u);i>_&&(l=(u+d)/2,Ia(e,t,n,r,l,m)&&(g=l,_=i)),u=d}return isNaN(g)&&(g=i[a]),o?(o.push(g,m,_),o):[g,m,_]}function $a(e,t,n,r,i){let a=[];for(let o=0,s=n.length;o<s;++o){let s=n[o];a=Qa(e,t,s,r,i,2*o,a),t=s[s.length-1]}return a}function eo(e,t,n,r){for(;t<n-r;){for(let i=0;i<r;++i){let a=e[t+i];e[t+i]=e[n-r+i],e[n-r+i]=a}t+=r,n-=r}}function to(e,t,n,r){let i=0,a=e[n-r],o=e[n-r+1];for(;t<n;t+=r){let n=e[t],r=e[t+1];i+=(n-a)*(r+o),a=n,o=r}return i===0?void 0:i>0}function no(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=to(e,t,o,r);if(a===0){if(i&&s||!i&&!s)return!1}else if(i&&!s||!i&&s)return!1;t=o}return!0}function ro(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a];if(!no(e,t,o,r,i))return!1;o.length&&(t=o[o.length-1])}return!0}function io(e,t,n,r,i){i=i!==void 0&&i;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=to(e,t,o,r);(a===0?i&&s||!i&&!s:i&&!s||!i&&s)&&eo(e,t,o,r),t=o}return t}function ao(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=io(e,t,n[a],r,i);return t}function oo(e,t){let n=[],r=0,i=0,a;for(let o=0,s=t.length;o<s;++o){let s=t[o],c=to(e,r,s,2);if(a===void 0&&(a=c),c===a)n.push(t.slice(i,o+1));else{if(n.length===0)continue;n[n.length-1].push(t[i])}i=o+1,r=s}return n}var so=class e extends pa{constructor(e,t,n){super(),this.ends_=[],this.flatInteriorPointRevision_=-1,this.flatInteriorPoint_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,t!==void 0&&n?(this.setFlatCoordinates(t,e),this.ends_=n):this.setCoordinates(e,t)}appendLinearRing(e){this.flatCoordinates?dt(this.flatCoordinates,e.getFlatCoordinates()):this.flatCoordinates=e.getFlatCoordinates().slice(),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<hn(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sa(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ta(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return Ia(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,t)}getArea(){return va(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),io(t,0,this.ends_,this.stride,e)),Ma(t,0,this.ends_,this.stride)}getEnds(){return this.ends_}getFlatInteriorPoint(){if(this.flatInteriorPointRevision_!=this.getRevision()){let e=Pn(this.getExtent());this.flatInteriorPoint_=Qa(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e,0),this.flatInteriorPointRevision_=this.getRevision()}return this.flatInteriorPoint_}getInteriorPoint(){return new Za(this.getFlatInteriorPoint(),`XYM`)}getLinearRingCount(){return this.ends_.length}getLinearRing(e){return e<0||this.ends_.length<=e?null:new Xa(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLinearRings(){let e=this.layout,t=this.flatCoordinates,n=this.ends_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a],s=new Xa(t.slice(i,o),e);r.push(s),i=o}return r}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;no(e,0,this.ends_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=io(this.orientedFlatCoordinates_,0,this.ends_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Ja(this.flatCoordinates,0,this.ends_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getType(){return`Polygon`}intersectsExtent(e){return Ha(this.getOrientedFlatCoordinates(),0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=ka(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}};function co(e){if(Wn(e))throw Error(`Cannot create polygon from empty extent`);let t=e[0],n=e[1],r=e[2],i=e[3],a=[t,n,t,i,r,i,r,n,t,n];return new so(a,`XY`,[a.length])}function lo(e,t,n,r){let i=z(t)/n[0],a=Rn(t)/n[1];return r?Math.min(e,Math.max(i,a)):Math.min(e,Math.min(i,a))}function uo(e,t,n){let r=Math.min(e,t);return r*=Math.log(1+50*Math.max(0,e/t-1))/50+1,n&&(r=Math.max(r,n),r/=Math.log(1+50*Math.max(0,n/e-1))/50+1),Yt(r,n/2,t*2)}function fo(e,t,n,r){return t=t===void 0||t,(function(i,a,o,s){if(i!==void 0){let c=e[0],l=e[e.length-1],u=n?lo(c,n,o,r):c;if(s)return t?uo(i,u,l):Yt(i,l,u);let d=Math.floor(lt(e,Math.min(u,i),a));return e[d]>u&&d<e.length-1?e[d+1]:e[d]}})}function po(e,t,n,r,i,a){return r=r===void 0||r,n=n===void 0?0:n,(function(o,s,c,l){if(o!==void 0){let u=i?lo(t,i,c,a):t;if(l)return r?uo(o,u,n):Yt(o,n,u);let d=Math.ceil(Math.log(t/u)/Math.log(e)-1e-9),f=-s*.499999999+.5,p=Math.floor(Math.log(t/Math.min(u,o))/Math.log(e)+f);return Yt(t/e**+Math.max(d,p),n,u)}})}function mo(e,t,n,r,i){return n=n===void 0||n,(function(a,o,s,c){if(a!==void 0){let o=r?lo(e,r,s,i):e;return!n||!c?Yt(a,t,o):uo(a,o,t)}})}function ho(e){if(e!==void 0)return 0}function go(e){if(e!==void 0)return e}function _o(e){let t=2*Math.PI/e;return(function(e,n){if(n)return e;if(e!==void 0)return e=Math.floor(e/t+.5)*t,e})}function vo(e){let t=e===void 0?en(5):e;return(function(e,n){return n||e===void 0?e:Math.abs(e)<=t?0:e})}var yo=0,bo=class extends Tt{constructor(e){super(),this.on,this.once,this.un,e=Object.assign({},e),this.hints_=[0,0],this.animations_=[],this.updateAnimationKey_,this.projection_=Ti(e.projection,`EPSG:3857`),this.viewportSize_=[100,100],this.targetCenter_=null,this.targetResolution_,this.targetRotation_,this.nextCenter_=null,this.nextResolution_,this.nextRotation_,this.cancelAnchor_=void 0,e.projection&&vi(),e.center&&(e.center=Ri(e.center,this.projection_)),e.extent&&(e.extent=Bi(e.extent,this.projection_)),this.applyOptions_(e)}applyOptions_(e){let t=Object.assign({},e);for(let e in Jt)delete t[e];this.setProperties(t,!0);let n=Co(e);this.maxResolution_=n.maxResolution,this.minResolution_=n.minResolution,this.zoomFactor_=n.zoomFactor,this.resolutions_=e.resolutions,this.padding_=e.padding,this.minZoom_=n.minZoom;let r=So(e),i=n.constraint,a=wo(e);this.constraints_={center:r,resolution:i,rotation:a},this.setRotation(e.rotation===void 0?0:e.rotation),this.setCenterInternal(e.center===void 0?null:e.center),e.resolution===void 0?e.zoom!==void 0&&this.setZoom(e.zoom):this.setResolution(e.resolution)}get padding(){return this.padding_}set padding(e){let t=this.padding_;this.padding_=e;let n=this.getCenterInternal();if(n){let r=e||[0,0,0,0];t||=[0,0,0,0];let i=this.getResolution(),a=i/2*(r[3]-t[3]+t[1]-r[1]),o=i/2*(r[0]-t[0]+t[2]-r[2]);this.setCenterInternal([n[0]+a,n[1]-o])}}getUpdatedOptions_(e){let t=this.getProperties();return t.resolution===void 0?t.zoom=this.getZoom():t.resolution=this.getResolution(),t.center=this.getCenterInternal(),t.rotation=this.getRotation(),Object.assign({},t,e)}animate(e){this.isDef()&&!this.getAnimating()&&this.resolveConstraints(0);let t=Array(arguments.length);for(let e=0;e<t.length;++e){let n=arguments[e];n.center&&(n=Object.assign({},n),n.center=Ri(n.center,this.getProjection())),n.anchor&&(n=Object.assign({},n),n.anchor=Ri(n.anchor,this.getProjection())),t[e]=n}this.animateInternal.apply(this,t)}animateInternal(e){let t=arguments.length,n;t>1&&typeof arguments[t-1]==`function`&&(n=arguments[t-1],--t);let r=0;for(;r<t&&!this.isDef();++r){let e=arguments[r];e.center&&this.setCenterInternal(e.center),e.zoom===void 0?e.resolution&&this.setResolution(e.resolution):this.setZoom(e.zoom),e.rotation!==void 0&&this.setRotation(e.rotation)}if(r===t){n&&xo(n,!0);return}let i=Date.now(),a=this.targetCenter_.slice(),o=this.targetResolution_,s=this.targetRotation_,c=[];for(;r<t;++r){let e=arguments[r],t={start:i,complete:!1,anchor:e.anchor,duration:e.duration===void 0?1e3:e.duration,easing:e.easing||lr,callback:n};if(e.center&&(t.sourceCenter=a,t.targetCenter=e.center.slice(),a=t.targetCenter),e.zoom===void 0?e.resolution&&(t.sourceResolution=o,t.targetResolution=e.resolution,o=t.targetResolution):(t.sourceResolution=o,t.targetResolution=this.getResolutionForZoom(e.zoom),o=t.targetResolution),e.rotation!==void 0){t.sourceRotation=s;let n=tn(e.rotation-s+Math.PI,2*Math.PI)-Math.PI;t.targetRotation=s+n,s=t.targetRotation}To(t)?t.complete=!0:i+=t.duration,c.push(t)}this.animations_.push(c),this.setHint(qt.ANIMATING,1),this.updateAnimations_()}getAnimating(){return this.hints_[qt.ANIMATING]>0}getInteracting(){return this.hints_[qt.INTERACTING]>0}cancelAnimations(){this.setHint(qt.ANIMATING,-this.hints_[qt.ANIMATING]);let e;for(let t=0,n=this.animations_.length;t<n;++t){let n=this.animations_[t];if(n[0].callback&&xo(n[0].callback,!1),!e)for(let t=0,r=n.length;t<r;++t){let r=n[t];if(!r.complete){e=r.anchor;break}}}this.animations_.length=0,this.cancelAnchor_=e,this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN}updateAnimations_(){if(this.updateAnimationKey_!==void 0&&(cancelAnimationFrame(this.updateAnimationKey_),this.updateAnimationKey_=void 0),!this.getAnimating())return;let e=Date.now(),t=!1;for(let n=this.animations_.length-1;n>=0;--n){let r=this.animations_[n],i=!0;for(let n=0,a=r.length;n<a;++n){let a=r[n];if(a.complete)continue;let o=e-a.start,s=a.duration>0?o/a.duration:1;s>=1?(a.complete=!0,s=1):i=!1;let c=a.easing(s);if(a.sourceCenter){let e=a.sourceCenter[0],t=a.sourceCenter[1],n=a.targetCenter[0],r=a.targetCenter[1];this.nextCenter_=a.targetCenter;let i=e+c*(n-e),o=t+c*(r-t);this.targetCenter_=[i,o]}if(a.sourceResolution&&a.targetResolution){let e=c===1?a.targetResolution:a.sourceResolution+c*(a.targetResolution-a.sourceResolution);if(a.anchor){let t=this.getViewportSize_(this.getRotation()),n=this.constraints_.resolution(e,0,t,!0);this.targetCenter_=this.calculateCenterZoom(n,a.anchor)}this.nextResolution_=a.targetResolution,this.targetResolution_=e,this.applyTargetState_(!0)}if(a.sourceRotation!==void 0&&a.targetRotation!==void 0){let e=c===1?tn(a.targetRotation+Math.PI,2*Math.PI)-Math.PI:a.sourceRotation+c*(a.targetRotation-a.sourceRotation);if(a.anchor){let t=this.constraints_.rotation(e,!0);this.targetCenter_=this.calculateCenterRotate(t,a.anchor)}this.nextRotation_=a.targetRotation,this.targetRotation_=e}if(this.applyTargetState_(!0),t=!0,!a.complete)break}if(i){this.animations_[n]=null,this.setHint(qt.ANIMATING,-1),this.nextCenter_=null,this.nextResolution_=NaN,this.nextRotation_=NaN;let e=r[0].callback;e&&xo(e,!0)}}this.animations_=this.animations_.filter(Boolean),t&&this.updateAnimationKey_===void 0&&(this.updateAnimationKey_=requestAnimationFrame(this.updateAnimations_.bind(this)))}calculateCenterRotate(e,t){let n,r=this.getCenterInternal();return r!==void 0&&(n=[r[0]-t[0],r[1]-t[1]],er(n,e-this.getRotation()),Qn(n,t)),n}calculateCenterZoom(e,t){let n,r=this.getCenterInternal(),i=this.getResolution();return r!==void 0&&i!==void 0&&(n=[t[0]-e*(t[0]-r[0])/i,t[1]-e*(t[1]-r[1])/i]),n}getViewportSize_(e){let t=this.viewportSize_;if(e){let n=t[0],r=t[1];return[Math.abs(n*Math.cos(e))+Math.abs(r*Math.sin(e)),Math.abs(n*Math.sin(e))+Math.abs(r*Math.cos(e))]}return t}setViewportSize(e){this.viewportSize_=Array.isArray(e)?e.slice():[100,100],this.getAnimating()||this.resolveConstraints(0)}getCenter(){let e=this.getCenterInternal();return e&&Li(e,this.getProjection())}getCenterInternal(){return this.get(Jt.CENTER)}getConstraints(){return this.constraints_}getConstrainResolution(){return this.get(`constrainResolution`)}getHints(e){return e===void 0?this.hints_.slice():(e[0]=this.hints_[0],e[1]=this.hints_[1],e)}calculateExtent(e){return zi(this.calculateExtentInternal(e),this.getProjection())}calculateExtentInternal(e){e||=this.getViewportSizeMinusPadding_();let t=this.getCenterInternal();R(t,`The view center is not defined`);let n=this.getResolution();R(n!==void 0,`The view resolution is not defined`);let r=this.getRotation();return R(r!==void 0,`The view rotation is not defined`),In(t,n,r,e)}getMaxResolution(){return this.maxResolution_}getMinResolution(){return this.minResolution_}getMaxZoom(){return this.getZoomForResolution(this.minResolution_)}setMaxZoom(e){this.applyOptions_(this.getUpdatedOptions_({maxZoom:e}))}getMinZoom(){return this.getZoomForResolution(this.maxResolution_)}setMinZoom(e){this.applyOptions_(this.getUpdatedOptions_({minZoom:e}))}setConstrainResolution(e){this.applyOptions_(this.getUpdatedOptions_({constrainResolution:e}))}getProjection(){return this.projection_}getResolution(){return this.get(Jt.RESOLUTION)}getResolutions(){return this.resolutions_}getResolutionForExtent(e,t){return this.getResolutionForExtentInternal(Bi(e,this.getProjection()),t)}getResolutionForExtentInternal(e,t){t||=this.getViewportSizeMinusPadding_();let n=z(e)/t[0],r=Rn(e)/t[1];return Math.max(n,r)}getResolutionForValueFunction(e){e||=2;let t=this.getConstrainedResolution(this.maxResolution_),n=this.minResolution_,r=Math.log(t/n)/Math.log(e);return(function(n){return t/e**+(n*r)})}getRotation(){return this.get(Jt.ROTATION)}getValueForResolutionFunction(e){let t=Math.log(e||2),n=this.getConstrainedResolution(this.maxResolution_),r=this.minResolution_,i=Math.log(n/r)/t;return(function(e){return Math.log(n/e)/t/i})}getViewportSizeMinusPadding_(e){let t=this.getViewportSize_(e),n=this.padding_;return n&&(t=[t[0]-n[1]-n[3],t[1]-n[0]-n[2]]),t}getState(){let e=this.getProjection(),t=this.getResolution(),n=this.getRotation(),r=this.getCenterInternal(),i=this.padding_;if(i){let e=this.getViewportSizeMinusPadding_();r=Eo(r,this.getViewportSize_(),[e[0]/2+i[3],e[1]/2+i[0]],t,n)}return{center:r.slice(0),projection:e===void 0?null:e,resolution:t,nextCenter:this.nextCenter_,nextResolution:this.nextResolution_,nextRotation:this.nextRotation_,rotation:n,zoom:this.getZoom()}}getViewStateAndExtent(){return{viewState:this.getState(),extent:this.calculateExtent()}}getZoom(){let e,t=this.getResolution();return t!==void 0&&(e=this.getZoomForResolution(t)),e}getZoomForResolution(e){let t=this.minZoom_||0,n,r;if(this.resolutions_){let i=lt(this.resolutions_,e,1);t=i,n=this.resolutions_[i],r=i==this.resolutions_.length-1?2:n/this.resolutions_[i+1]}else n=this.maxResolution_,r=this.zoomFactor_;return t+Math.log(n/e)/Math.log(r)}getResolutionForZoom(e){if(this.resolutions_?.length){if(this.resolutions_.length===1)return this.resolutions_[0];let t=Yt(Math.floor(e),0,this.resolutions_.length-2),n=this.resolutions_[t]/this.resolutions_[t+1];return this.resolutions_[t]/n**+Yt(e-t,0,1)}return this.maxResolution_/this.zoomFactor_**+(e-this.minZoom_)}fit(e,t){let n;if(R(Array.isArray(e)||typeof e.getSimplifiedGeometry==`function`,"Invalid extent or geometry provided as `geometry`"),Array.isArray(e))R(!Wn(e),"Cannot fit empty extent provided as `geometry`"),n=co(Bi(e,this.getProjection()));else if(e.getType()===`Circle`){let t=Bi(e.getExtent(),this.getProjection());n=co(t),n.rotate(this.getRotation(),Pn(t))}else{let t=Ii();n=t?e.clone().transform(t,this.getProjection()):e}this.fitInternal(n,t)}rotatedExtentForGeometry(e){let t=this.getRotation(),n=Math.cos(t),r=Math.sin(-t),i=e.getFlatCoordinates(),a=e.getStride(),o=1/0,s=1/0,c=-1/0,l=-1/0;for(let e=0,t=i.length;e<t;e+=a){let t=i[e]*n-i[e+1]*r,a=i[e]*r+i[e+1]*n;o=Math.min(o,t),s=Math.min(s,a),c=Math.max(c,t),l=Math.max(l,a)}return[o,s,c,l]}fitInternal(e,t){t||={};let n=t.size;n||=this.getViewportSizeMinusPadding_();let r=t.padding===void 0?[0,0,0,0]:t.padding,i=t.nearest!==void 0&&t.nearest,a;a=t.minResolution===void 0?t.maxZoom===void 0?0:this.getResolutionForZoom(t.maxZoom):t.minResolution;let o=this.rotatedExtentForGeometry(e),s=this.getResolutionForExtentInternal(o,[n[0]-r[1]-r[3],n[1]-r[0]-r[2]]);s=isNaN(s)?a:Math.max(s,a),s=this.getConstrainedResolution(s,+!i);let c=this.getRotation(),l=Math.sin(c),u=Math.cos(c),d=Pn(o);d[0]+=(r[1]-r[3])/2*s,d[1]+=(r[0]-r[2])/2*s;let f=d[0]*u-d[1]*l,p=d[1]*u+d[0]*l,m=this.getConstrainedCenter([f,p],s),h=t.callback?t.callback:gt;t.duration===void 0?(this.targetResolution_=s,this.targetCenter_=m,this.applyTargetState_(!1,!0),xo(h,!0)):this.animateInternal({resolution:s,center:m,duration:t.duration,easing:t.easing},h)}centerOn(e,t,n){this.centerOnInternal(Ri(e,this.getProjection()),t,n)}centerOnInternal(e,t,n){this.setCenterInternal(Eo(e,t,n,this.getResolution(),this.getRotation()))}calculateCenterShift(e,t,n,r){let i,a=this.padding_;if(a&&e){let o=this.getViewportSizeMinusPadding_(-n),s=Eo(e,r,[o[0]/2+a[3],o[1]/2+a[0]],t,n);i=[e[0]-s[0],e[1]-s[1]]}return i}isDef(){return!!this.getCenterInternal()&&this.getResolution()!==void 0}adjustCenter(e){let t=Li(this.targetCenter_,this.getProjection());this.setCenter([t[0]+e[0],t[1]+e[1]])}adjustCenterInternal(e){let t=this.targetCenter_;this.setCenterInternal([t[0]+e[0],t[1]+e[1]])}adjustResolution(e,t){t&&=Ri(t,this.getProjection()),this.adjustResolutionInternal(e,t)}adjustResolutionInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.getViewportSize_(this.getRotation()),i=this.constraints_.resolution(this.targetResolution_*e,0,r,n);t&&(this.targetCenter_=this.calculateCenterZoom(i,t)),this.targetResolution_*=e,this.applyTargetState_()}adjustZoom(e,t){this.adjustResolution(this.zoomFactor_**+-e,t)}adjustRotation(e,t){t&&=Ri(t,this.getProjection()),this.adjustRotationInternal(e,t)}adjustRotationInternal(e,t){let n=this.getAnimating()||this.getInteracting(),r=this.constraints_.rotation(this.targetRotation_+e,n);t&&(this.targetCenter_=this.calculateCenterRotate(r,t)),this.targetRotation_+=e,this.applyTargetState_()}setCenter(e){this.setCenterInternal(e&&Ri(e,this.getProjection()))}setCenterInternal(e){this.targetCenter_=e,this.applyTargetState_()}setHint(e,t){return this.hints_[e]+=t,this.changed(),this.hints_[e]}setResolution(e){this.targetResolution_=e,this.applyTargetState_()}setRotation(e){this.targetRotation_=e,this.applyTargetState_()}setZoom(e){this.setResolution(this.getResolutionForZoom(e))}applyTargetState_(e,t){let n=this.getAnimating()||this.getInteracting()||t,r=this.constraints_.rotation(this.targetRotation_,n),i=this.getViewportSize_(r),a=this.constraints_.resolution(this.targetResolution_,0,i,n),o=this.constraints_.center(this.targetCenter_,a,i,n,this.calculateCenterShift(this.targetCenter_,a,r,i));this.get(Jt.ROTATION)!==r&&this.set(Jt.ROTATION,r),this.get(Jt.RESOLUTION)!==a&&(this.set(Jt.RESOLUTION,a),this.set(`zoom`,this.getZoom(),!0)),(!o||!this.get(Jt.CENTER)||!$n(this.get(Jt.CENTER),o))&&this.set(Jt.CENTER,o),this.getAnimating()&&!e&&this.cancelAnimations(),this.cancelAnchor_=void 0}resolveConstraints(e,t,n){e=e===void 0?200:e;let r=t||0,i=this.constraints_.rotation(this.targetRotation_),a=this.getViewportSize_(i),o=this.constraints_.resolution(this.targetResolution_,r,a),s=this.constraints_.center(this.targetCenter_,o,a,!1,this.calculateCenterShift(this.targetCenter_,o,i,a));if(e===0&&!this.cancelAnchor_){this.targetResolution_=o,this.targetRotation_=i,this.targetCenter_=s,this.applyTargetState_();return}n||=e===0?this.cancelAnchor_:void 0,this.cancelAnchor_=void 0,(this.getResolution()!==o||this.getRotation()!==i||!this.getCenterInternal()||!$n(this.getCenterInternal(),s))&&(this.getAnimating()&&this.cancelAnimations(),this.animateInternal({rotation:i,center:s,resolution:o,duration:e,easing:cr,anchor:n}))}beginInteraction(){this.resolveConstraints(0),this.setHint(qt.INTERACTING,1)}endInteraction(e,t,n){n&&=Ri(n,this.getProjection()),this.endInteractionInternal(e,t,n)}endInteractionInternal(e,t,n){this.getInteracting()&&(this.setHint(qt.INTERACTING,-1),this.resolveConstraints(e,t,n))}getConstrainedCenter(e,t){let n=this.getViewportSize_(this.getRotation());return this.constraints_.center(e,t||this.getResolution(),n)}getConstrainedZoom(e,t){let n=this.getResolutionForZoom(e);return this.getZoomForResolution(this.getConstrainedResolution(n,t))}getConstrainedResolution(e,t){t||=0;let n=this.getViewportSize_(this.getRotation());return this.constraints_.resolution(e,t,n)}};function xo(e,t){setTimeout(function(){e(t)},0)}function So(e){if(e.extent!==void 0){let t=e.smoothExtentConstraint===void 0||e.smoothExtentConstraint;return cn(e.extent,e.constrainOnlyCenter,t)}let t=Ti(e.projection,`EPSG:3857`);if(e.multiWorld!==!0&&t.isGlobal()){let e=t.getExtent().slice();return e[0]=-1/0,e[2]=1/0,cn(e,!1,!1)}return ln}function Co(e){let t,n,r,i=e.minZoom===void 0?yo:e.minZoom,a=e.maxZoom===void 0?28:e.maxZoom,o=e.zoomFactor===void 0?2:e.zoomFactor,s=e.multiWorld!==void 0&&e.multiWorld,c=e.smoothResolutionConstraint===void 0||e.smoothResolutionConstraint,l=e.showFullExtent!==void 0&&e.showFullExtent,u=Ti(e.projection,`EPSG:3857`),d=u.getExtent(),f=e.constrainOnlyCenter,p=e.extent;if(!s&&!p&&u.isGlobal()&&(f=!1,p=d),e.resolutions!==void 0){let o=e.resolutions;n=o[i],r=o[a]===void 0?o[o.length-1]:o[a],t=e.constrainResolution?fo(o,c,!f&&p,l):mo(n,r,c,!f&&p,l)}else{let s=(d?Math.max(z(d),Rn(d)):360*hr.degrees/u.getMetersPerUnit())/256/2**yo,m=s/2**28;n=e.maxResolution,n===void 0?n=s/o**+i:i=0,r=e.minResolution,r===void 0&&(r=e.maxZoom===void 0?m:e.maxResolution===void 0?s/o**+a:n/o**+a),a=i+Math.floor(Math.log(n/r)/Math.log(o)),r=n/o**+(a-i),t=e.constrainResolution?po(o,n,r,c,!f&&p,l):mo(n,r,c,!f&&p,l)}return{constraint:t,maxResolution:n,minResolution:r,minZoom:i,zoomFactor:o}}function wo(e){if(e.enableRotation===void 0||e.enableRotation){let t=e.constrainRotation;return t===void 0||t===!0?vo():t===!1?go:typeof t==`number`?_o(t):go}return ho}function To(e){return!(e.sourceCenter&&e.targetCenter&&!$n(e.sourceCenter,e.targetCenter)||e.sourceResolution!==e.targetResolution||e.sourceRotation!==e.targetRotation)}function Eo(e,t,n,r,i){let a=Math.cos(-i),o=Math.sin(-i),s=e[0]*a-e[1]*o,c=e[1]*a+e[0]*o;return s+=(t[0]/2-n[0])*r,c+=(n[1]-t[1]/2)*r,o=-o,[s*a-c*o,c*a+s*o]}var Do=`ol-hidden`,Oo=`ol-selectable`,ko=`ol-unselectable`,Ao=`ol-control`,jo=`ol-collapsed`,Mo=new RegExp([`^\\s*(?=(?:(?:[-a-z]+\\s*){0,2}(italic|oblique))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(small-caps))?)`,`(?=(?:(?:[-a-z]+\\s*){0,2}(bold(?:er)?|lighter|[1-9]00 ))?)`,`(?:(?:normal|\\1|\\2|\\3)\\s*){0,3}((?:xx?-)?`,`(?:small|large)|medium|smaller|larger|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx]))`,`(?:\\s*\\/\\s*(normal|[\\.\\d]+(?:\\%|in|[cem]m|ex|p[ctx])?))`,`?\\s*([-,\\"\\'\\sa-z0-9]+?)\\s*$`].join(``),`i`),No=[`style`,`variant`,`weight`,`size`,`lineHeight`,`family`],Po={normal:400,bold:700},Fo=function(e){let t=e.match(Mo);if(!t)return null;let n={lineHeight:`normal`,size:`1.2em`,style:`normal`,weight:`400`,variant:`normal`};for(let e=0,r=No.length;e<r;++e){let r=t[e+1];r!==void 0&&(n[No[e]]=typeof r==`string`?r.trim():r)}return isNaN(Number(n.weight))&&n.weight in Po&&(n.weight=Po[n.weight]),n.families=n.family.split(/,\s?/).map(e=>e.trim().replace(/^['"]|['"]$/g,``)),n};function Io(e,t,n,r){let i;return i=n&&n.length?n.shift():It?new class extends OffscreenCanvas{style={}}(e??300,t??150):document.createElement(`canvas`),e&&(i.width=e),t&&(i.height=t),i.getContext(`2d`,r)}var Lo;function Ro(){return Lo||=Io(1,1),Lo}function zo(e){let t=e.canvas;t.width=1,t.height=1,e.clearRect(0,0,1,1)}function Bo(e){let t=e.offsetWidth,n=getComputedStyle(e);return t+=parseInt(n.marginLeft,10)+parseInt(n.marginRight,10),t}function Vo(e){let t=e.offsetHeight,n=getComputedStyle(e);return t+=parseInt(n.marginTop,10)+parseInt(n.marginBottom,10),t}function Ho(e,t){let n=t.parentNode;n&&n.replaceChild(e,t)}function Uo(e){for(;e.lastChild;)e.lastChild.remove()}function Wo(e,t){let n=e.childNodes;for(let r=0;;++r){let i=n[r],a=t[r];if(!i&&!a)break;if(i!==a){if(!i){e.appendChild(a);continue}if(!a){e.removeChild(i),--r;continue}e.insertBefore(a,i)}}}function Go(){return new Proxy({childNodes:[],appendChild:function(e){return this.childNodes.push(e),e},remove:function(){},removeChild:function(e){let t=this.childNodes.indexOf(e);if(t===-1)throw Error(`Node to remove was not found`);return this.childNodes.splice(t,1),e},insertBefore:function(e,t){let n=this.childNodes.indexOf(t);if(n===-1)throw Error(`Reference node not found`);return this.childNodes.splice(n,0,e),e},style:{}},{get(e,t,n){return t===`firstElementChild`?e.childNodes.length>0?e.childNodes[0]:null:Reflect.get(e,t,n)}})}function Ko(e){return typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof OffscreenCanvas<`u`&&e instanceof OffscreenCanvas}var qo=class extends Tt{constructor(e){super();let t=e.element;t&&!e.target&&!t.style.pointerEvents&&(t.style.pointerEvents=`auto`),this.element=t||null,this.target_=null,this.map_=null,this.listenerKeys=[],e.render&&(this.render=e.render),e.target&&this.setTarget(e.target)}disposeInternal(){this.element?.remove(),super.disposeInternal()}getMap(){return this.map_}setMap(e){this.map_&&this.element?.remove();for(let e=0,t=this.listenerKeys.length;e<t;++e)it(this.listenerKeys[e]);if(this.listenerKeys.length=0,this.map_=e,e){let t=this.target_??e.getOverlayContainerStopEvent();this.element&&t.appendChild(this.element),this.render!==gt&&this.listenerKeys.push(N(e,Vt.POSTRENDER,this.render,this)),e.render()}}render(e){}setTarget(e){this.target_=typeof e==`string`?document.getElementById(e):e}},Jo=class extends qo{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target}),this.ulElement_=document.createElement(`ul`),this.collapsed_=e.collapsed===void 0||e.collapsed,this.userCollapsed_=this.collapsed_,this.overrideCollapsible_=e.collapsible!==void 0,this.collapsible_=e.collapsible===void 0||e.collapsible,this.collapsible_||(this.collapsed_=!1),this.attributions_=e.attributions;let t=e.className===void 0?`ol-attribution`:e.className,n=e.tipLabel===void 0?`Attributions`:e.tipLabel,r=e.expandClassName===void 0?t+`-expand`:e.expandClassName,i=e.collapseLabel===void 0?`›`:e.collapseLabel,a=e.collapseClassName===void 0?t+`-collapse`:e.collapseClassName;typeof i==`string`?(this.collapseLabel_=document.createElement(`span`),this.collapseLabel_.textContent=i,this.collapseLabel_.className=a):this.collapseLabel_=i;let o=e.label===void 0?`i`:e.label;typeof o==`string`?(this.label_=document.createElement(`span`),this.label_.textContent=o,this.label_.className=r):this.label_=o;let s=this.collapsible_&&!this.collapsed_?this.collapseLabel_:this.label_;this.toggleButton_=document.createElement(`button`),this.toggleButton_.setAttribute(`type`,`button`),this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_)),this.toggleButton_.title=n,this.toggleButton_.appendChild(s),this.toggleButton_.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let c=t+` `+ko+` `+Ao+(this.collapsed_&&this.collapsible_?` `+jo:``)+(this.collapsible_?``:` ol-uncollapsible`),l=this.element;l.className=c,l.appendChild(this.toggleButton_),l.appendChild(this.ulElement_),this.renderedAttributions_=[],this.renderedVisible_=!0}collectSourceAttributions_(e){let t=this.getMap().getAllLayers(),n=new Set(t.flatMap(t=>t.getAttributions(e)));if(this.attributions_!==void 0&&(Array.isArray(this.attributions_)?this.attributions_.forEach(e=>n.add(e)):n.add(this.attributions_)),!this.overrideCollapsible_){let e=!t.some(e=>e.getSource()?.getAttributionsCollapsible()===!1);this.setCollapsible(e)}return Array.from(n)}async updateElement_(e){if(!e){this.renderedVisible_&&=(this.element.style.display=`none`,!1);return}let t=await Promise.all(this.collectSourceAttributions_(e).map(e=>vt(()=>e))),n=t.length>0;if(this.renderedVisible_!=n&&(this.element.style.display=n?``:`none`,this.renderedVisible_=n),!ft(t,this.renderedAttributions_)){Uo(this.ulElement_);for(let e=0,n=t.length;e<n;++e){let n=document.createElement(`li`);n.innerHTML=t[e],this.ulElement_.appendChild(n)}this.renderedAttributions_=t}}handleClick_(e){e.preventDefault(),this.handleToggle_(),this.userCollapsed_=this.collapsed_}handleToggle_(){this.element.classList.toggle(jo),this.collapsed_?Ho(this.collapseLabel_,this.label_):Ho(this.label_,this.collapseLabel_),this.collapsed_=!this.collapsed_,this.toggleButton_.setAttribute(`aria-expanded`,String(!this.collapsed_))}getCollapsible(){return this.collapsible_}setCollapsible(e){this.collapsible_!==e&&(this.collapsible_=e,this.element.classList.toggle(`ol-uncollapsible`),this.userCollapsed_&&this.handleToggle_())}setCollapsed(e){this.userCollapsed_=e,this.collapsible_&&this.collapsed_!==e&&this.handleToggle_()}getCollapsed(){return this.collapsed_}render(e){this.updateElement_(e.frameState)}},Yo=class extends qo{constructor(e){e||={},super({element:document.createElement(`div`),render:e.render,target:e.target});let t=e.className===void 0?`ol-rotate`:e.className,n=e.label===void 0?`⇧`:e.label,r=e.compassClassName===void 0?`ol-compass`:e.compassClassName;this.label_=null,typeof n==`string`?(this.label_=document.createElement(`span`),this.label_.className=r,this.label_.textContent=n):(this.label_=n,this.label_.classList.add(r));let i=e.tipLabel?e.tipLabel:`Reset rotation`,a=document.createElement(`button`);a.className=t+`-reset`,a.setAttribute(`type`,`button`),a.title=i,a.appendChild(this.label_),a.addEventListener(P.CLICK,this.handleClick_.bind(this),!1);let o=t+` `+ko+` `+Ao,s=this.element;s.className=o,s.appendChild(a),this.callResetNorth_=e.resetNorth?e.resetNorth:void 0,this.duration_=e.duration===void 0?250:e.duration,this.autoHide_=e.autoHide===void 0||e.autoHide,this.rotation_=void 0,this.autoHide_&&this.element.classList.add(Do)}handleClick_(e){e.preventDefault(),this.callResetNorth_===void 0?this.resetNorth_():this.callResetNorth_()}resetNorth_(){let e=this.getMap().getView();if(!e)return;let t=e.getRotation();t!==void 0&&(this.duration_>0&&t%(2*Math.PI)!=0?e.animate({rotation:0,duration:this.duration_,easing:cr}):e.setRotation(0))}render(e){let t=e.frameState;if(!t)return;let n=t.viewState.rotation;if(n!=this.rotation_){let e=`rotate(`+n+`rad)`;if(this.autoHide_){let e=this.element.classList.contains(Do);!e&&n===0?this.element.classList.add(Do):e&&n!==0&&this.element.classList.remove(Do)}this.label_.style.transform=e}this.rotation_=n}},Xo=class extends qo{constructor(e){e||={},super({element:document.createElement(`div`),target:e.target});let t=e.className===void 0?`ol-zoom`:e.className,n=e.delta===void 0?1:e.delta,r=e.zoomInClassName===void 0?t+`-in`:e.zoomInClassName,i=e.zoomOutClassName===void 0?t+`-out`:e.zoomOutClassName,a=e.zoomInLabel===void 0?`+`:e.zoomInLabel,o=e.zoomOutLabel===void 0?`–`:e.zoomOutLabel,s=e.zoomInTipLabel===void 0?`Zoom in`:e.zoomInTipLabel,c=e.zoomOutTipLabel===void 0?`Zoom out`:e.zoomOutTipLabel,l=document.createElement(`button`);l.className=r,l.setAttribute(`type`,`button`),l.title=s,l.appendChild(typeof a==`string`?document.createTextNode(a):a),l.addEventListener(P.CLICK,this.handleClick_.bind(this,n),!1);let u=document.createElement(`button`);u.className=i,u.setAttribute(`type`,`button`),u.title=c,u.appendChild(typeof o==`string`?document.createTextNode(o):o),u.addEventListener(P.CLICK,this.handleClick_.bind(this,-n),!1);let d=t+` `+ko+` `+Ao,f=this.element;f.className=d,f.appendChild(l),f.appendChild(u),this.duration_=e.duration===void 0?250:e.duration}handleClick_(e,t){t.preventDefault(),this.zoomByDelta_(e)}zoomByDelta_(e){let t=this.getMap().getView();if(!t)return;let n=t.getZoom();if(n!==void 0){let r=t.getConstrainedZoom(n+e);this.duration_>0?(t.getAnimating()&&t.cancelAnimations(),t.animate({zoom:r,duration:this.duration_,easing:cr})):t.setZoom(r)}}};function Zo(e){e||={};let t=new Ot;return(e.zoom===void 0||e.zoom)&&t.push(new Xo(e.zoomOptions)),(e.rotate===void 0||e.rotate)&&t.push(new Yo(e.rotateOptions)),(e.attribution===void 0||e.attribution)&&t.push(new Jo(e.attributionOptions)),t}var Qo=class{constructor(e,t,n){this.decay_=e,this.minVelocity_=t,this.delay_=n,this.points_=[],this.angle_=0,this.initialVelocity_=0}begin(){this.points_.length=0,this.angle_=0,this.initialVelocity_=0}update(e,t){this.points_.push(e,t,Date.now())}end(){if(this.points_.length<6)return!1;let e=Date.now()-this.delay_,t=this.points_.length-3;if(this.points_[t+2]<e)return!1;let n=t-3;for(;n>0&&this.points_[n+2]>e;)n-=3;let r=this.points_[t+2]-this.points_[n+2];if(r<1e3/60)return!1;let i=this.points_[t]-this.points_[n],a=this.points_[t+1]-this.points_[n+1];return this.angle_=Math.atan2(a,i),this.initialVelocity_=Math.sqrt(i*i+a*a)/r,this.initialVelocity_>this.minVelocity_}getDistance(){return(this.minVelocity_-this.initialVelocity_)/this.decay_}getAngle(){return this.angle_}},$o={ACTIVE:`active`},es=class extends Tt{constructor(e){super(),this.on,this.once,this.un,e&&e.handleEvent&&(this.handleEvent=e.handleEvent),this.map_=null,this.setActive(!0)}getActive(){return this.get($o.ACTIVE)}getMap(){return this.map_}handleEvent(e){return!0}setActive(e){this.set($o.ACTIVE,e)}setMap(e){this.map_=e}};function ts(e,t,n){let r=e.getCenterInternal();if(r){let i=[r[0]+t[0],r[1]+t[1]];e.animateInternal({duration:n===void 0?250:n,easing:ur,center:e.getConstrainedCenter(i)})}}function ns(e,t,n,r){let i=e.getZoom();if(i===void 0)return;let a=e.getConstrainedZoom(i+t),o=e.getResolutionForZoom(a);e.getAnimating()&&e.cancelAnimations(),e.animate({resolution:o,anchor:n,duration:r===void 0?250:r,easing:cr})}var rs=class extends es{constructor(e){super(),e||={},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?250:e.duration}handleEvent(e){let t=!1;if(e.type==jt.DBLCLICK){let n=e.originalEvent,r=e.map,i=e.coordinate,a=n.shiftKey?-this.delta_:this.delta_;ns(r.getView(),a,i,this.duration_),n.preventDefault(),t=!0}return!t}};function is(e){let t=arguments;return function(e){let n=!0;for(let r=0,i=t.length;r<i&&(n&&=t[r](e),n);++r);return n}}var as=function(e){let t=e.originalEvent;return t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},os=function(e){let t=e.map.getTargetElement(),n=t.getRootNode(),r=e.map.getOwnerDocument().activeElement;return n instanceof ShadowRoot?n.host.contains(r):t.contains(r)},ss=function(e){let t=e.map.getTargetElement(),n=t.getRootNode();return!(n instanceof ShadowRoot?n.host:t).hasAttribute(`tabindex`)||os(e)},cs=mt,ls=function(e){let t=e.originalEvent;return`pointerId`in t&&t.button==0&&!(Nt&&Pt&&t.ctrlKey)},us=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&!t.shiftKey},ds=function(e){let t=e.originalEvent;return Pt?t.metaKey:t.ctrlKey},fs=function(e){let t=e.originalEvent;return!t.altKey&&!(t.metaKey||t.ctrlKey)&&t.shiftKey},ps=function(e){let t=e.originalEvent,n=t.target.tagName;return n!==`INPUT`&&n!==`SELECT`&&n!==`TEXTAREA`&&!t.target.isContentEditable},ms=function(e){let t=e.originalEvent;return`pointerId`in t&&t.pointerType==`mouse`},hs=function(e){let t=e.originalEvent;return`pointerId`in t&&t.isPrimary&&t.button===0},gs=class extends es{constructor(e){e||={},super(e),e.handleDownEvent&&(this.handleDownEvent=e.handleDownEvent),e.handleDragEvent&&(this.handleDragEvent=e.handleDragEvent),e.handleMoveEvent&&(this.handleMoveEvent=e.handleMoveEvent),e.handleUpEvent&&(this.handleUpEvent=e.handleUpEvent),e.stopDown&&(this.stopDown=e.stopDown),this.handlingDownUpSequence=!1,this.targetPointers=[]}getPointerCount(){return this.targetPointers.length}handleDownEvent(e){return!1}handleDragEvent(e){}handleEvent(e){if(!e.originalEvent)return!0;let t=!1;if(this.updateTrackedPointers_(e),this.handlingDownUpSequence){if(e.type==jt.POINTERDRAG)this.handleDragEvent(e),e.originalEvent.preventDefault();else if(e.type==jt.POINTERUP){let t=this.handleUpEvent(e);this.handlingDownUpSequence=t&&this.targetPointers.length>0}}else if(e.type==jt.POINTERDOWN){let n=this.handleDownEvent(e);this.handlingDownUpSequence=n,t=this.stopDown(n)}else e.type==jt.POINTERMOVE&&this.handleMoveEvent(e);return!t}handleMoveEvent(e){}handleUpEvent(e){return!1}stopDown(e){return e}updateTrackedPointers_(e){e.activePointers&&(this.targetPointers=e.activePointers)}};function _s(e){let t=e.length,n=0,r=0;for(let i=0;i<t;i++)n+=e[i].clientX,r+=e[i].clientY;return{clientX:n/t,clientY:r/t}}var vs=class extends gs{constructor(e){super({stopDown:ht}),e||={},this.kinetic_=e.kinetic,this.lastCentroid=null,this.lastPointersCount_,this.panning_=!1;let t=e.condition?e.condition:is(us,hs);this.condition_=e.onFocusOnly?is(ss,t):t,this.noKinetic_=!1}handleDragEvent(e){let t=e.map;this.panning_||(this.panning_=!0,t.getView().beginInteraction());let n=this.targetPointers,r=t.getEventPixel(_s(n));if(n.length==this.lastPointersCount_){if(this.kinetic_&&this.kinetic_.update(r[0],r[1]),this.lastCentroid){let t=[this.lastCentroid[0]-r[0],r[1]-this.lastCentroid[1]],n=e.map.getView();tr(t,n.getResolution()),er(t,n.getRotation()),n.adjustCenterInternal(t)}}else this.kinetic_&&this.kinetic_.begin();this.lastCentroid=r,this.lastPointersCount_=n.length,e.originalEvent.preventDefault()}handleUpEvent(e){let t=e.map,n=t.getView();if(this.targetPointers.length===0){if(!this.noKinetic_&&this.kinetic_&&this.kinetic_.end()){let e=this.kinetic_.getDistance(),r=this.kinetic_.getAngle(),i=n.getCenterInternal(),a=t.getPixelFromCoordinateInternal(i),o=t.getCoordinateFromPixelInternal([a[0]-e*Math.cos(r),a[1]-e*Math.sin(r)]);n.animateInternal({center:n.getConstrainedCenter(o),duration:500,easing:cr})}return this.panning_&&(this.panning_=!1,n.endInteraction()),!1}return this.kinetic_&&this.kinetic_.begin(),this.lastCentroid=null,!0}handleDownEvent(e){if(this.targetPointers.length>0&&this.condition_(e)){let t=e.map.getView();return this.lastCentroid=null,t.getAnimating()&&t.cancelAnimations(),this.kinetic_&&this.kinetic_.begin(),this.noKinetic_=this.targetPointers.length>1,!0}return!1}},ys=class extends gs{constructor(e){e||={},super({stopDown:ht}),this.condition_=e.condition?e.condition:as,this.lastAngle_=void 0,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){if(!ms(e))return;let t=e.map,n=t.getView();if(n.getConstraints().rotation===ho)return;let r=t.getSize(),i=e.pixel,a=Math.atan2(r[1]/2-i[1],i[0]-r[0]/2);if(this.lastAngle_!==void 0){let e=a-this.lastAngle_;n.adjustRotationInternal(-e)}this.lastAngle_=a}handleUpEvent(e){return!ms(e)||(e.map.getView().endInteraction(this.duration_),!1)}handleDownEvent(e){return ms(e)&&ls(e)&&this.condition_(e)?(e.map.getView().beginInteraction(),this.lastAngle_=void 0,!0):!1}},bs=class extends at{constructor(e){super(),this.geometry_=null,this.element_=document.createElement(`div`),this.element_.style.position=`absolute`,this.element_.style.pointerEvents=`auto`,this.element_.className=`ol-box `+e,this.map_=null,this.startPixel_=null,this.endPixel_=null}disposeInternal(){this.setMap(null)}render_(){let e=this.startPixel_,t=this.endPixel_,n=this.element_.style;n.left=Math.min(e[0],t[0])+`px`,n.top=Math.min(e[1],t[1])+`px`,n.width=Math.abs(t[0]-e[0])+`px`,n.height=Math.abs(t[1]-e[1])+`px`}setMap(e){if(this.map_){this.map_.getOverlayContainer().removeChild(this.element_);let e=this.element_.style;e.left=`inherit`,e.top=`inherit`,e.width=`inherit`,e.height=`inherit`}this.map_=e,this.map_&&this.map_.getOverlayContainer().appendChild(this.element_)}setPixels(e,t){this.startPixel_=e,this.endPixel_=t,this.createOrUpdateGeometry(),this.render_()}createOrUpdateGeometry(){if(!this.map_)return;let e=this.startPixel_,t=this.endPixel_,n=[e,[e[0],t[1]],t,[t[0],e[1]]].map(this.map_.getCoordinateFromPixelInternal,this.map_);n[4]=n[0].slice(),this.geometry_?this.geometry_.setCoordinates([n]):this.geometry_=new so([n])}getGeometry(){return this.geometry_}},xs={BOXSTART:`boxstart`,BOXDRAG:`boxdrag`,BOXEND:`boxend`,BOXCANCEL:`boxcancel`},Ss=class extends yt{constructor(e,t,n){super(e),this.coordinate=t,this.mapBrowserEvent=n}},Cs=class extends gs{constructor(e){super(),this.on,this.once,this.un,e??={},this.box_=new bs(e.className||`ol-dragbox`),this.minArea_=e.minArea??64,e.onBoxEnd&&(this.onBoxEnd=e.onBoxEnd),this.startPixel_=null,this.condition_=e.condition??ls,this.boxEndCondition_=e.boxEndCondition??this.defaultBoxEndCondition}defaultBoxEndCondition(e,t,n){let r=n[0]-t[0],i=n[1]-t[1];return r*r+i*i>=this.minArea_}getGeometry(){return this.box_.getGeometry()}handleDragEvent(e){this.startPixel_&&(this.box_.setPixels(this.startPixel_,e.pixel),this.dispatchEvent(new Ss(xs.BOXDRAG,e.coordinate,e)))}handleUpEvent(e){if(!this.startPixel_)return!1;let t=this.boxEndCondition_(e,this.startPixel_,e.pixel);return t&&this.onBoxEnd(e),this.dispatchEvent(new Ss(t?xs.BOXEND:xs.BOXCANCEL,e.coordinate,e)),this.box_.setMap(null),this.startPixel_=null,!1}handleDownEvent(e){return this.condition_(e)?(this.startPixel_=e.pixel,this.box_.setMap(e.map),this.box_.setPixels(this.startPixel_,this.startPixel_),this.dispatchEvent(new Ss(xs.BOXSTART,e.coordinate,e)),!0):!1}onBoxEnd(e){}setActive(e){e||(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Ss(xs.BOXCANCEL,this.startPixel_,null)),null)),super.setActive(e)}setMap(e){this.getMap()&&(this.box_.setMap(null),this.startPixel_&&=(this.dispatchEvent(new Ss(xs.BOXCANCEL,this.startPixel_,null)),null)),super.setMap(e)}},ws=class extends Cs{constructor(e){e||={};let t=e.condition?e.condition:fs;super({condition:t,className:e.className||`ol-dragzoom`,minArea:e.minArea}),this.duration_=e.duration===void 0?200:e.duration,this.out_=e.out!==void 0&&e.out}onBoxEnd(e){let t=this.getMap().getView(),n=this.getGeometry();if(this.out_){let e=t.rotatedExtentForGeometry(n),r=t.getResolutionForExtentInternal(e),i=t.getResolution()/r;n=n.clone(),n.scale(i*i)}t.fitInternal(n,{duration:this.duration_,easing:cr})}},Ts={LEFT:`ArrowLeft`,UP:`ArrowUp`,RIGHT:`ArrowRight`,DOWN:`ArrowDown`},Es=class extends es{constructor(e){super(),e||={},this.defaultCondition_=function(e){return us(e)&&ps(e)},this.condition_=e.condition===void 0?this.defaultCondition_:e.condition,this.duration_=e.duration===void 0?100:e.duration,this.pixelDelta_=e.pixelDelta===void 0?128:e.pixelDelta}handleEvent(e){let t=!1;if(e.type==P.KEYDOWN){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r==Ts.DOWN||r==Ts.LEFT||r==Ts.RIGHT||r==Ts.UP)){let i=e.map.getView(),a=i.getResolution()*this.pixelDelta_,o=0,s=0;r==Ts.DOWN?s=-a:r==Ts.LEFT?o=-a:r==Ts.RIGHT?o=a:s=a;let c=[o,s];er(c,i.getRotation()),ts(i,c,this.duration_),n.preventDefault(),t=!0}}return!t}},Ds=class extends es{constructor(e){super(),e||={},this.condition_=e.condition?e.condition:function(e){return!ds(e)&&ps(e)},this.delta_=e.delta?e.delta:1,this.duration_=e.duration===void 0?100:e.duration}handleEvent(e){let t=!1;if(e.type==P.KEYDOWN||e.type==P.KEYPRESS){let n=e.originalEvent,r=n.key;if(this.condition_(e)&&(r===`+`||r===`-`)){let i=e.map,a=r===`+`?this.delta_:-this.delta_;ns(i.getView(),a,void 0,this.duration_),n.preventDefault(),t=!0}}return!t}},Os=40,ks=300,As=3,js=class extends es{constructor(e){e||={},super(e),this.totalDelta_=0,this.lastDelta_=0,this.maxDelta_=e.maxDelta===void 0?1:e.maxDelta,this.duration_=e.duration===void 0?250:e.duration,this.timeout_=e.timeout===void 0?80:e.timeout,this.useAnchor_=e.useAnchor===void 0||e.useAnchor,this.constrainResolution_=e.constrainResolution!==void 0&&e.constrainResolution;let t=e.condition?e.condition:cs;this.condition_=e.onFocusOnly?is(ss,t):t,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_,this.mode_=void 0,this.trackpadEventGap_=400,this.trackpadTimeoutId_,this.deltaPerZoom_=300,this.ctrlKeyPressed_=!1,this.ctrlKeyListenerKeys_=[]}setMap(e){if(this.ctrlKeyListenerKeys_.forEach(it),this.ctrlKeyListenerKeys_.length=0,this.ctrlKeyPressed_=!1,super.setMap(e),e){let t=e.getOwnerDocument();this.ctrlKeyListenerKeys_.push(N(t,`keydown`,e=>{e.key===`Control`&&(this.ctrlKeyPressed_=!0)}),N(t,`keyup`,e=>{e.key===`Control`&&(this.ctrlKeyPressed_=!1)}))}}endInteraction_(){this.trackpadTimeoutId_=void 0;let e=this.getMap();if(!e)return;let t=e.getView(),n=this.lastDelta_?this.lastDelta_>0?1:-1:0;t.endInteraction(this.constrainResolution_||t.getConstrainResolution()?100:void 0,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null)}handleEvent(e){if(!this.condition_(e)||e.type!==P.WHEEL)return!0;let t=e.map,n=e.originalEvent;n.preventDefault();let r=n.ctrlKey&&!this.ctrlKeyPressed_;n.ctrlKey||(this.ctrlKeyPressed_=!1),this.useAnchor_&&(this.lastAnchor_=e.pixel);let i=n.deltaY;switch(n.deltaMode){case WheelEvent.DOM_DELTA_LINE:i*=Os;break;case WheelEvent.DOM_DELTA_PAGE:i*=ks}if(i===0)return!1;this.lastDelta_=i;let a=Date.now();this.startTime_===void 0&&(this.startTime_=a),(!this.mode_||a-this.startTime_>this.trackpadEventGap_)&&(this.mode_=Math.abs(i)<4?`trackpad`:`wheel`);let o=t.getView();if(this.mode_===`trackpad`)return this.trackpadTimeoutId_?clearTimeout(this.trackpadTimeoutId_):(o.getAnimating()&&o.cancelAnimations(),o.beginInteraction()),this.trackpadTimeoutId_=setTimeout(this.endInteraction_.bind(this),this.timeout_),r&&(i*=As),o.adjustZoom(-i/this.deltaPerZoom_,this.lastAnchor_?t.getCoordinateFromPixel(this.lastAnchor_):null),this.startTime_=a,!1;this.totalDelta_+=i;let s=Math.max(this.timeout_-(a-this.startTime_),0);return clearTimeout(this.timeoutId_),this.timeoutId_=setTimeout(this.handleWheelZoom_.bind(this,t),s),!1}handleWheelZoom_(e){let t=e.getView();t.getAnimating()&&t.cancelAnimations();let n=-Yt(this.totalDelta_,-this.maxDelta_*this.deltaPerZoom_,this.maxDelta_*this.deltaPerZoom_)/this.deltaPerZoom_;(t.getConstrainResolution()||this.constrainResolution_)&&(n=n?n>0?1:-1:0),ns(t,n,this.lastAnchor_?e.getCoordinateFromPixel(this.lastAnchor_):null,this.duration_),this.mode_=void 0,this.totalDelta_=0,this.lastAnchor_=null,this.startTime_=void 0,this.timeoutId_=void 0}setMouseAnchor(e){this.useAnchor_=e,e||(this.lastAnchor_=null)}},Ms=class extends gs{constructor(e){e||={};let t=e;t.stopDown||=ht,super(t),this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.threshold_=e.threshold===void 0?.3:e.threshold,this.duration_=e.duration===void 0?250:e.duration}handleDragEvent(e){let t=0,n=this.targetPointers[0],r=this.targetPointers[1],i=Math.atan2(r.clientY-n.clientY,r.clientX-n.clientX);if(this.lastAngle_!==void 0){let e=i-this.lastAngle_;this.rotationDelta_+=e,!this.rotating_&&Math.abs(this.rotationDelta_)>this.threshold_&&(this.rotating_=!0),t=e}this.lastAngle_=i;let a=e.map,o=a.getView();o.getConstraints().rotation!==ho&&(this.anchor_=a.getCoordinateFromPixelInternal(a.getEventPixel(_s(this.targetPointers))),this.rotating_&&(a.render(),o.adjustRotationInternal(t,this.anchor_)))}handleUpEvent(e){return this.targetPointers.length<2?(e.map.getView().endInteraction(this.duration_),!1):!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastAngle_=void 0,this.rotating_=!1,this.rotationDelta_=0,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}},Ns=class extends gs{constructor(e){e||={};let t=e;t.stopDown||=ht,super(t),this.anchor_=null,this.duration_=e.duration===void 0?400:e.duration,this.lastDistance_=void 0,this.lastScaleDelta_=1}handleDragEvent(e){let t=1,n=this.targetPointers[0],r=this.targetPointers[1],i=n.clientX-r.clientX,a=n.clientY-r.clientY,o=Math.sqrt(i*i+a*a);this.lastDistance_!==void 0&&(t=this.lastDistance_/o),this.lastDistance_=o;let s=e.map,c=s.getView();t!=1&&(this.lastScaleDelta_=t),this.anchor_=s.getCoordinateFromPixelInternal(s.getEventPixel(_s(this.targetPointers))),s.render(),c.adjustResolutionInternal(t,this.anchor_)}handleUpEvent(e){if(this.targetPointers.length<2){let t=e.map.getView(),n=this.lastScaleDelta_>1?1:-1;return t.endInteraction(this.duration_,n),!1}return!0}handleDownEvent(e){if(this.targetPointers.length>=2){let t=e.map;return this.anchor_=null,this.lastDistance_=void 0,this.lastScaleDelta_=1,this.handlingDownUpSequence||t.getView().beginInteraction(),!0}return!1}};function Ps(e){e||={};let t=new Ot,n=new Qo(-.005,.05,100);return(e.altShiftDragRotate===void 0||e.altShiftDragRotate)&&t.push(new ys),(e.doubleClickZoom===void 0||e.doubleClickZoom)&&t.push(new rs({delta:e.zoomDelta,duration:e.zoomDuration})),(e.dragPan===void 0||e.dragPan)&&t.push(new vs({onFocusOnly:e.onFocusOnly,kinetic:n})),(e.pinchRotate===void 0||e.pinchRotate)&&t.push(new Ms),(e.pinchZoom===void 0||e.pinchZoom)&&t.push(new Ns({duration:e.zoomDuration})),(e.keyboard===void 0||e.keyboard)&&(t.push(new Es),t.push(new Ds({delta:e.zoomDelta,duration:e.zoomDuration}))),(e.mouseWheelZoom===void 0||e.mouseWheelZoom)&&t.push(new js({onFocusOnly:e.onFocusOnly,duration:e.zoomDuration})),(e.shiftDragZoom===void 0||e.shiftDragZoom)&&t.push(new ws({duration:e.zoomDuration})),t}var V={OPACITY:`opacity`,VISIBLE:`visible`,EXTENT:`extent`,Z_INDEX:`zIndex`,MAX_RESOLUTION:`maxResolution`,MIN_RESOLUTION:`minResolution`,MAX_ZOOM:`maxZoom`,MIN_ZOOM:`minZoom`,SOURCE:`source`,MAP:`map`},Fs=class extends Tt{constructor(e){super(),this.on,this.once,this.un,this.background_=e.background;let t=Object.assign({},e);typeof e.properties==`object`&&(delete t.properties,Object.assign(t,e.properties)),t[V.OPACITY]=e.opacity===void 0?1:e.opacity,R(typeof t[V.OPACITY]==`number`,`Layer opacity must be a number`),t[V.VISIBLE]=e.visible===void 0||e.visible,t[V.Z_INDEX]=e.zIndex,t[V.MAX_RESOLUTION]=e.maxResolution===void 0?1/0:e.maxResolution,t[V.MIN_RESOLUTION]=e.minResolution===void 0?0:e.minResolution,t[V.MIN_ZOOM]=e.minZoom===void 0?-1/0:e.minZoom,t[V.MAX_ZOOM]=e.maxZoom===void 0?1/0:e.maxZoom,this.className_=t.className===void 0?`ol-layer`:t.className,delete t.className,this.setProperties(t),this.state_=null}getBackground(){return this.background_}getClassName(){return this.className_}getLayerState(e){let t=this.state_||{layer:this,managed:e===void 0||e},n=this.getZIndex();return t.opacity=Yt(Math.round(this.getOpacity()*100)/100,0,1),t.visible=this.getVisible(),t.extent=this.getExtent(),t.zIndex=n===void 0&&!t.managed?1/0:n,t.maxResolution=this.getMaxResolution(),t.minResolution=Math.max(this.getMinResolution(),0),t.minZoom=this.getMinZoom(),t.maxZoom=this.getMaxZoom(),this.state_=t,t}getLayersArray(e){return F()}getLayerStatesArray(e){return F()}getExtent(){return this.get(V.EXTENT)}getMaxResolution(){return this.get(V.MAX_RESOLUTION)}getMinResolution(){return this.get(V.MIN_RESOLUTION)}getMinZoom(){return this.get(V.MIN_ZOOM)}getMaxZoom(){return this.get(V.MAX_ZOOM)}getOpacity(){return this.get(V.OPACITY)}getSourceState(){return F()}getVisible(){return this.get(V.VISIBLE)}getZIndex(){return this.get(V.Z_INDEX)}setBackground(e){this.background_=e,this.changed()}setExtent(e){this.set(V.EXTENT,e)}setMaxResolution(e){this.set(V.MAX_RESOLUTION,e)}setMinResolution(e){this.set(V.MIN_RESOLUTION,e)}setMaxZoom(e){this.set(V.MAX_ZOOM,e)}setMinZoom(e){this.set(V.MIN_ZOOM,e)}setOpacity(e){R(typeof e==`number`,`Layer opacity must be a number`),this.set(V.OPACITY,e)}setVisible(e){this.set(V.VISIBLE,e)}setZIndex(e){this.set(V.Z_INDEX,e)}disposeInternal(){this.state_&&=(this.state_.layer=null,null),super.disposeInternal()}},Is={ADDLAYER:`addlayer`,REMOVELAYER:`removelayer`},Ls=class extends yt{constructor(e,t){super(e),this.layer=t}},Rs={LAYERS:`layers`},zs=class e extends Fs{constructor(e){e||={};let t=Object.assign({},e);delete t.layers;let n=e.layers;super(t),this.on,this.once,this.un,this.layersListenerKeys_=[],this.listenerKeys_={},this.addChangeListener(Rs.LAYERS,this.handleLayersChanged_),n?Array.isArray(n)?n=new Ot(n.slice(),{unique:!0}):R(typeof n.getArray==`function`,"Expected `layers` to be an array or a `Collection`"):n=new Ot(void 0,{unique:!0}),this.setLayers(n)}handleLayerChange_(){this.changed()}handleLayersChanged_(){this.layersListenerKeys_.forEach(it),this.layersListenerKeys_.length=0;let e=this.getLayers();this.layersListenerKeys_.push(N(e,$e.ADD,this.handleLayersAdd_,this),N(e,$e.REMOVE,this.handleLayersRemove_,this));for(let e in this.listenerKeys_)this.listenerKeys_[e].forEach(it);tt(this.listenerKeys_);let t=e.getArray();for(let e=0,n=t.length;e<n;e++){let n=t[e];this.registerLayerListeners_(n),this.dispatchEvent(new Ls(Is.ADDLAYER,n))}this.changed()}registerLayerListeners_(t){let n=[N(t,et.PROPERTYCHANGE,this.handleLayerChange_,this),N(t,P.CHANGE,this.handleLayerChange_,this)];t instanceof e&&n.push(N(t,Is.ADDLAYER,this.handleLayerGroupAdd_,this),N(t,Is.REMOVELAYER,this.handleLayerGroupRemove_,this)),this.listenerKeys_[I(t)]=n}handleLayerGroupAdd_(e){this.dispatchEvent(new Ls(Is.ADDLAYER,e.layer))}handleLayerGroupRemove_(e){this.dispatchEvent(new Ls(Is.REMOVELAYER,e.layer))}handleLayersAdd_(e){let t=e.element;this.registerLayerListeners_(t),this.dispatchEvent(new Ls(Is.ADDLAYER,t)),this.changed()}handleLayersRemove_(e){let t=e.element,n=I(t);this.listenerKeys_[n].forEach(it),delete this.listenerKeys_[n],this.dispatchEvent(new Ls(Is.REMOVELAYER,t)),this.changed()}getLayers(){return this.get(Rs.LAYERS)}setLayers(e){let t=this.getLayers();if(t){let e=t.getArray();for(let t=0,n=e.length;t<n;++t)this.dispatchEvent(new Ls(Is.REMOVELAYER,e[t]))}this.set(Rs.LAYERS,e)}getLayersArray(e){return e=e===void 0?[]:e,this.getLayers().forEach(function(t){t.getLayersArray(e)}),e}getLayerStatesArray(e){let t=e===void 0?[]:e,n=t.length;this.getLayers().forEach(function(e){e.getLayerStatesArray(t)});let r=this.getLayerState(),i=r.zIndex;!e&&r.zIndex===void 0&&(i=0);for(let e=n,a=t.length;e<a;e++){let n=t[e];n.opacity*=r.opacity,n.visible=n.visible&&r.visible,n.maxResolution=Math.min(n.maxResolution,r.maxResolution),n.minResolution=Math.max(n.minResolution,r.minResolution),n.minZoom=Math.max(n.minZoom,r.minZoom),n.maxZoom=Math.min(n.maxZoom,r.maxZoom),r.extent!==void 0&&(n.extent=n.extent===void 0?r.extent:zn(n.extent,r.extent)),n.zIndex===void 0&&(n.zIndex=i)}return t}getSourceState(){return`ready`}},Bs={PRERENDER:`prerender`,POSTRENDER:`postrender`,PRECOMPOSE:`precompose`,POSTCOMPOSE:`postcompose`,RENDERCOMPLETE:`rendercomplete`},Vs=class extends Fs{constructor(e){let t=Object.assign({},e);delete t.source,super(t),this.on,this.once,this.un,this.mapPrecomposeKey_=null,this.mapRenderKey_=null,this.sourceChangeKey_=null,this.renderer_=null,this.sourceReady_=!1,this.rendered=!1,e.render&&(this.render=e.render),e.map&&this.setMap(e.map),this.addChangeListener(V.SOURCE,this.handleSourcePropertyChange_);let n=e.source?e.source:null;this.setSource(n)}getLayersArray(e){return e||=[],e.push(this),e}getLayerStatesArray(e){return e||=[],e.push(this.getLayerState()),e}getSource(){return this.get(V.SOURCE)||null}getRenderSource(){return this.getSource()}getSourceState(){let e=this.getSource();return e?e.getState():`undefined`}handleSourceChange_(){this.changed(),!(this.sourceReady_||this.getSource().getState()!==`ready`)&&(this.sourceReady_=!0,this.dispatchEvent(`sourceready`))}handleSourcePropertyChange_(){this.sourceChangeKey_&&=(it(this.sourceChangeKey_),null),this.sourceReady_=!1;let e=this.getSource();e&&(this.sourceChangeKey_=N(e,P.CHANGE,this.handleSourceChange_,this),e.getState()===`ready`&&(this.sourceReady_=!0,setTimeout(()=>{this.dispatchEvent(`sourceready`)},0))),this.changed()}getFeatures(e){return this.renderer_?this.renderer_.getFeatures(e):Promise.resolve([])}getData(e){return!this.renderer_||!this.rendered?null:this.renderer_.getData(e)}isVisible(e){let t,n=this.getMapInternal();!e&&n&&(e=n.getView()),t=e instanceof bo?{viewState:e.getState(),extent:e.calculateExtent()}:e,!t.layerStatesArray&&n&&(t.layerStatesArray=n.getLayerGroup().getLayerStatesArray());let r;if(t.layerStatesArray){if(r=t.layerStatesArray.find(e=>e.layer===this),!r)return!1}else r=this.getLayerState();let i=this.getExtent();return Hs(r,t.viewState)&&(!i||Un(i,t.extent))}getAttributions(e){if(!this.isVisible(e))return[];let t=this.getSource()?.getAttributions();if(!t)return[];let n=t(e instanceof bo?e.getViewStateAndExtent():e);return Array.isArray(n)||(n=[n]),n}render(e,t){let n=this.getRenderer();return n.prepareFrame(e)?(this.rendered=!0,n.renderFrame(e,t)):null}unrender(){this.rendered=!1}getDeclutter(){}renderDeclutter(e,t){}renderDeferred(e){let t=this.getRenderer();t&&t.renderDeferred(e)}setMapInternal(e){e||this.unrender(),this.set(V.MAP,e)}getMapInternal(){return this.get(V.MAP)}setMap(e){this.mapPrecomposeKey_&&=(it(this.mapPrecomposeKey_),null),e||this.changed(),this.mapRenderKey_&&=(it(this.mapRenderKey_),null),e&&(this.mapPrecomposeKey_=N(e,Bs.PRECOMPOSE,this.handlePrecompose_,this),this.mapRenderKey_=N(this,P.CHANGE,e.render,e),this.changed())}handlePrecompose_(e){let t=e.frameState.layerStatesArray,n=this.getLayerState(!1);R(!t.some(e=>e.layer===n.layer),"A layer can only be added to the map once. Use either `layer.setMap()` or `map.addLayer()`, not both."),t.push(n)}setSource(e){this.set(V.SOURCE,e)}getRenderer(){return this.renderer_||=this.createRenderer(),this.renderer_}hasRenderer(){return!!this.renderer_}createRenderer(){return null}clearRenderer(){this.renderer_&&(this.renderer_.dispose(),delete this.renderer_)}disposeInternal(){this.clearRenderer(),this.setSource(null),super.disposeInternal()}};function Hs(e,t){if(!e.visible)return!1;let n=t.resolution;if(n<e.minResolution||n>=e.maxResolution)return!1;let r=t.zoom;return r>e.minZoom&&r<=e.maxZoom}function Us(e,t,n=0,r=e.length-1,i=Gs){for(;r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1);Us(e,t,Math.max(n,Math.floor(t-o*c/a+l)),Math.min(r,Math.floor(t+(a-o)*c/a+l)),i)}let a=e[t],o=n,s=r;for(Ws(e,n,t),i(e[r],a)>0&&Ws(e,n,r);o<s;){for(Ws(e,o,s),o++,s--;i(e[o],a)<0;)o++;for(;i(e[s],a)>0;)s--}i(e[n],a)===0?Ws(e,n,s):(s++,Ws(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}}function Ws(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function Gs(e,t){return e<t?-1:+(e>t)}var Ks=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,n=[];if(!ic(e,t))return n;let r=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let o=t.children[a],s=t.leaf?r(o):o;ic(e,s)&&(t.leaf?n.push(o):rc(e,s)?this._all(o,n):i.push(o))}t=i.pop()}return n}collides(e){let t=this.data;if(!ic(e,t))return!1;let n=[];for(;t;){for(let r=0;r<t.children.length;r++){let i=t.children[r],a=t.leaf?this.toBBox(i):i;if(ic(e,a)){if(t.leaf||rc(e,a))return!0;n.push(i)}}t=n.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let t=0;t<e.length;t++)this.insert(e[t]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let e=this.data;this.data=t,t=e}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=ac([]),this}remove(e,t){if(!e)return this;let n=this.data,r=this.toBBox(e),i=[],a=[],o,s,c;for(;n||i.length;){if(n||(n=i.pop(),s=i[i.length-1],o=a.pop(),c=!0),n.leaf){let r=qs(e,n.children,t);if(r!==-1)return n.children.splice(r,1),i.push(n),this._condense(i),this}!c&&!n.leaf&&rc(n,r)?(i.push(n),a.push(o),o=0,s=n,n=n.children[0]):s?(o++,n=s.children[o],c=!1):n=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let n=[];for(;e;)e.leaf?t.push(...e.children):n.push(...e.children),e=n.pop();return t}_build(e,t,n,r){let i=n-t+1,a=this._maxEntries,o;if(i<=a)return o=ac(e.slice(t,n+1)),Js(o,this.toBBox),o;r||(r=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/a**(r-1))),o=ac([]),o.leaf=!1,o.height=r;let s=Math.ceil(i/a),c=s*Math.ceil(Math.sqrt(a));oc(e,t,n,c,this.compareMinX);for(let i=t;i<=n;i+=c){let t=Math.min(i+c-1,n);oc(e,i,t,s,this.compareMinY);for(let n=i;n<=t;n+=s){let i=Math.min(n+s-1,t);o.children.push(this._build(e,n,i,r-1))}}return Js(o,this.toBBox),o}_chooseSubtree(e,t,n,r){for(;r.push(t),!(t.leaf||r.length-1===n);){let n=1/0,r=1/0,i;for(let a=0;a<t.children.length;a++){let o=t.children[a],s=$s(o),c=tc(e,o)-s;c<r?(r=c,n=s<n?s:n,i=o):c===r&&s<n&&(n=s,i=o)}t=i||t.children[0]}return t}_insert(e,t,n){let r=n?e:this.toBBox(e),i=[],a=this._chooseSubtree(r,this.data,t,i);for(a.children.push(e),Xs(a,r);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(r,i,t)}_split(e,t){let n=e[t],r=n.children.length,i=this._minEntries;this._chooseSplitAxis(n,i,r);let a=this._chooseSplitIndex(n,i,r),o=ac(n.children.splice(a,n.children.length-a));o.height=n.height,o.leaf=n.leaf,Js(n,this.toBBox),Js(o,this.toBBox),t?e[t-1].children.push(o):this._splitRoot(n,o)}_splitRoot(e,t){this.data=ac([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Js(this.data,this.toBBox)}_chooseSplitIndex(e,t,n){let r,i=1/0,a=1/0;for(let o=t;o<=n-t;o++){let t=Ys(e,0,o,this.toBBox),s=Ys(e,o,n,this.toBBox),c=nc(t,s),l=$s(t)+$s(s);c<i?(i=c,r=o,a=l<a?l:a):c===i&&l<a&&(a=l,r=o)}return r||n-t}_chooseSplitAxis(e,t,n){let r=e.leaf?this.compareMinX:Zs,i=e.leaf?this.compareMinY:Qs;this._allDistMargin(e,t,n,r)<this._allDistMargin(e,t,n,i)&&e.children.sort(r)}_allDistMargin(e,t,n,r){e.children.sort(r);let i=this.toBBox,a=Ys(e,0,t,i),o=Ys(e,n-t,n,i),s=ec(a)+ec(o);for(let r=t;r<n-t;r++){let t=e.children[r];Xs(a,e.leaf?i(t):t),s+=ec(a)}for(let r=n-t-1;r>=t;r--){let t=e.children[r];Xs(o,e.leaf?i(t):t),s+=ec(o)}return s}_adjustParentBBoxes(e,t,n){for(let r=n;r>=0;r--)Xs(t[r],e)}_condense(e){for(let t=e.length-1,n;t>=0;t--)e[t].children.length===0?t>0?(n=e[t-1].children,n.splice(n.indexOf(e[t]),1)):this.clear():Js(e[t],this.toBBox)}};function qs(e,t,n){if(!n)return t.indexOf(e);for(let r=0;r<t.length;r++)if(n(e,t[r]))return r;return-1}function Js(e,t){Ys(e,0,e.children.length,t,e)}function Ys(e,t,n,r,i){i||=ac(null),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(let a=t;a<n;a++){let t=e.children[a];Xs(i,e.leaf?r(t):t)}return i}function Xs(e,t){return e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),e}function Zs(e,t){return e.minX-t.minX}function Qs(e,t){return e.minY-t.minY}function $s(e){return(e.maxX-e.minX)*(e.maxY-e.minY)}function ec(e){return e.maxX-e.minX+(e.maxY-e.minY)}function tc(e,t){return(Math.max(t.maxX,e.maxX)-Math.min(t.minX,e.minX))*(Math.max(t.maxY,e.maxY)-Math.min(t.minY,e.minY))}function nc(e,t){let n=Math.max(e.minX,t.minX),r=Math.max(e.minY,t.minY),i=Math.min(e.maxX,t.maxX),a=Math.min(e.maxY,t.maxY);return Math.max(0,i-n)*Math.max(0,a-r)}function rc(e,t){return e.minX<=t.minX&&e.minY<=t.minY&&t.maxX<=e.maxX&&t.maxY<=e.maxY}function ic(e,t){return t.minX<=e.maxX&&t.minY<=e.maxY&&t.maxX>=e.minX&&t.maxY>=e.minY}function ac(e){return{children:e,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function oc(e,t,n,r,i){let a=[t,n];for(;a.length;){if(n=a.pop(),t=a.pop(),n-t<=r)continue;let o=t+Math.ceil((n-t)/r/2)*r;Us(e,o,t,n,i),a.push(t,o,o,n)}}var sc=[NaN,NaN,NaN,0],cc;function lc(){return cc||=Io(1,1,void 0,{willReadFrequently:!0,desynchronized:!0}),cc}var uc=/^rgba?\(\s*(\d+%?)\s+(\d+%?)\s+(\d+%?)(?:\s*\/\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,dc=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,fc=/^rgba?\(\s*(\d+%)\s*,\s*(\d+%)\s*,\s*(\d+%)(?:\s*,\s*(\d+%|\d*\.\d+|[01]))?\s*\)$/i,pc=/^#([\da-f]{3,4}|[\da-f]{6}|[\da-f]{8})$/i;function mc(e,t){return e.endsWith(`%`)?Number(e.substring(0,e.length-1))/t:Number(e)}function hc(e){throw Error(`failed to parse "`+e+`" as color`)}function gc(e){if(e.toLowerCase().startsWith(`rgb`)){let t=e.match(dc)||e.match(uc)||e.match(fc);if(t){let e=t[4],n=100/255;return[Yt(mc(t[1],n)+.5|0,0,255),Yt(mc(t[2],n)+.5|0,0,255),Yt(mc(t[3],n)+.5|0,0,255),e===void 0?1:Yt(mc(e,100),0,1)]}hc(e)}if(e.startsWith(`#`)){if(pc.test(e)){let t=e.substring(1),n=t.length<=4?1:2,r=[0,0,0,255];for(let e=0,i=t.length;e<i;e+=n){let i=parseInt(t.substring(e,e+n),16);n===1&&(i+=i<<4),r[e/n]=i}return r[3]/=255,r}hc(e)}let t=lc();t.fillStyle=`#abcdef`;let n=t.fillStyle;t.fillStyle=e,t.fillStyle===n&&(t.fillStyle=`#fedcba`,n=t.fillStyle,t.fillStyle=e,t.fillStyle===n&&hc(e));let r=t.fillStyle;if(r.startsWith(`#`)||r.startsWith(`rgba`))return gc(r);t.clearRect(0,0,1,1),t.fillRect(0,0,1,1);let i=Array.from(t.getImageData(0,0,1,1).data);return i[3]=rn(i[3]/255,3),i}function _c(e){return typeof e==`string`?e:Ac(e)}var vc=1024,yc={},bc=0;function xc(e){if(e.length===4)return e;let t=e.slice();return t[3]=1,t}function Sc(e){return e>.0031308?e**(1/2.4)*269.025-14.025:e*3294.6}function Cc(e){return e>.2068965?e**3:(e-4/29)*(108/841)}function wc(e){return e>10.314724?((e+14.025)/269.025)**2.4:e/3294.6}function Tc(e){return e>.0088564?e**(1/3):e/(108/841)+4/29}function Ec(e){let t=wc(e[0]),n=wc(e[1]),r=wc(e[2]),i=Tc(t*.222488403+n*.716873169+r*.06060791),a=500*(Tc(t*.452247074+n*.399439023+r*.148375274)-i),o=200*(i-Tc(t*.016863605+n*.117638439+r*.865350722)),s=180/Math.PI*Math.atan2(o,a);return[116*i-16,Math.sqrt(a*a+o*o),s<0?s+360:s,e[3]]}function Dc(e){let t=(e[0]+16)/116,n=e[1],r=e[2]*Math.PI/180,i=Cc(t),a=Cc(t+n/500*Math.cos(r)),o=Cc(t-n/200*Math.sin(r)),s=Sc(a*3.021973625-i*1.617392459-o*.404875592),c=Sc(a*-.943766287+i*1.916279586+o*.027607165),l=Sc(a*.069407491-i*.22898585+o*1.159737864);return[Yt(s+.5|0,0,255),Yt(c+.5|0,0,255),Yt(l+.5|0,0,255),e[3]]}function Oc(e){if(e===`none`)return sc;if(yc.hasOwnProperty(e))return yc[e];if(bc>=vc){let e=0;for(let t in yc)e++&3||(delete yc[t],--bc)}let t=gc(e);t.length!==4&&hc(e);for(let n of t)isNaN(n)&&hc(e);return yc[e]=t,++bc,t}function kc(e){return Array.isArray(e)?e:Oc(e)}function Ac(e){let t=e[0];t!=(t|0)&&(t=t+.5|0);let n=e[1];n!=(n|0)&&(n=n+.5|0);let r=e[2];r!=(r|0)&&(r=r+.5|0);let i=e[3]===void 0?1:Math.round(e[3]*1e3)/1e3;return`rgba(`+t+`,`+n+`,`+r+`,`+i+`)`}function jc(e){return e[0]>0&&e[1]>0}function Mc(e,t,n){return n===void 0&&(n=[0,0]),n[0]=e[0]*t+.5|0,n[1]=e[1]*t+.5|0,n}function Nc(e,t){return Array.isArray(e)?e:(t===void 0?t=[e,e]:(t[0]=e,t[1]=e),t)}var Pc=0,Fc=1<<Pc++,H=1<<Pc++,Ic=1<<Pc++,Lc=1<<Pc++,Rc=1<<Pc++,zc=1<<Pc++,Bc=2**Pc-1,Vc={[Fc]:`boolean`,[H]:`number`,[Ic]:`string`,[Lc]:`color`,[Rc]:`number[]`,[zc]:`size`},Hc=Object.keys(Vc).map(Number).sort(st);function Uc(e){return e in Vc}function Wc(e){let t=[];for(let n of Hc)Gc(e,n)&&t.push(Vc[n]);return t.length===0?`untyped`:t.length<3?t.join(` or `):t.slice(0,-1).join(`, `)+`, or `+t[t.length-1]}function Gc(e,t){return(e&t)===t}function Kc(e,t){return!!(e&t)}function qc(e,t){return e===t}var Jc=class{constructor(e,t){if(!Uc(e))throw Error(`literal expressions must have a specific type, got ${Wc(e)}`);this.type=e,this.value=t}},Yc=class{constructor(e,t,...n){this.type=e,this.operator=t,this.args=n}};function Xc(e){return{variables:new Map,properties:new Map,featureId:!1,geometryType:!1,mCoordinate:!1,mapState:!1,inputVariables:e}}function Zc(e,t,n){switch(typeof e){case`boolean`:if(qc(t,Ic))return new Jc(Ic,e?`true`:`false`);if(!Gc(t,Fc))throw Error(`got a boolean, but expected ${Wc(t)}`);return new Jc(Fc,e);case`number`:if(qc(t,zc))return new Jc(zc,Nc(e));if(qc(t,Fc))return new Jc(Fc,!!e);if(qc(t,Ic))return new Jc(Ic,e.toString());if(!Gc(t,H))throw Error(`got a number, but expected ${Wc(t)}`);return new Jc(H,e);case`string`:if(qc(t,Lc))return new Jc(Lc,Oc(e));if(qc(t,Fc))return new Jc(Fc,!!e);if(!Gc(t,Ic))throw Error(`got a string, but expected ${Wc(t)}`);return new Jc(Ic,e)}if(!Array.isArray(e))throw Error(`expression must be an array or a primitive value`);if(e.length===0)throw Error(`empty expression`);if(typeof e[0]==`string`)return hl(e,t,n);for(let t of e)if(typeof t!=`number`)throw Error(`expected an array of numbers`);if(qc(t,zc)){if(e.length!==2)throw Error(`expected an array of two values for a size, got ${e.length}`);return new Jc(zc,e)}if(qc(t,Lc)){if(e.length===3)return new Jc(Lc,[...e,1]);if(e.length===4)return new Jc(Lc,e);throw Error(`expected an array of 3 or 4 values for a color, got ${e.length}`)}if(!Gc(t,Rc))throw Error(`got an array of numbers, but expected ${Wc(t)}`);return new Jc(Rc,e)}var U={Get:`get`,Var:`var`,Concat:`concat`,GeometryType:`geometry-type`,LineMetric:`line-metric`,Any:`any`,All:`all`,Not:`!`,Resolution:`resolution`,Zoom:`zoom`,Time:`time`,Equal:`==`,NotEqual:`!=`,GreaterThan:`>`,GreaterThanOrEqualTo:`>=`,LessThan:`<`,LessThanOrEqualTo:`<=`,Multiply:`*`,Divide:`/`,Add:`+`,Subtract:`-`,Clamp:`clamp`,Mod:`%`,Pow:`^`,Abs:`abs`,Floor:`floor`,Ceil:`ceil`,Round:`round`,Sin:`sin`,Cos:`cos`,Atan:`atan`,Sqrt:`sqrt`,Match:`match`,Between:`between`,Interpolate:`interpolate`,Coalesce:`coalesce`,Case:`case`,In:`in`,Number:`number`,String:`string`,Array:`array`,Color:`color`,Id:`id`,Band:`band`,Palette:`palette`,ToString:`to-string`,Has:`has`},Qc={[U.Get]:K(W(1,1/0),$c),[U.Var]:el(),[U.Has]:K(W(1,1/0),$c),[U.Id]:K(tl,al),[U.Concat]:K(W(2,1/0),G(Ic)),[U.GeometryType]:K(nl,al),[U.LineMetric]:K(rl,al),[U.Resolution]:K(il,al),[U.Zoom]:K(il,al),[U.Time]:K(il,al),[U.Any]:K(W(2,1/0),G(Fc)),[U.All]:K(W(2,1/0),G(Fc)),[U.Not]:K(W(1,1),G(Fc)),[U.Equal]:K(W(2,2),sl()),[U.NotEqual]:K(W(2,2),sl()),[U.GreaterThan]:K(W(2,2),G(H)),[U.GreaterThanOrEqualTo]:K(W(2,2),G(H)),[U.LessThan]:K(W(2,2),G(H)),[U.LessThanOrEqualTo]:K(W(2,2),G(H)),[U.Multiply]:K(W(2,1/0),ol),[U.Coalesce]:K(W(2,1/0),ol),[U.Divide]:K(W(2,2),G(H)),[U.Add]:K(W(2,1/0),G(H)),[U.Subtract]:K(W(2,2),G(H)),[U.Clamp]:K(W(3,3),G(H)),[U.Mod]:K(W(2,2),G(H)),[U.Pow]:K(W(2,2),G(H)),[U.Abs]:K(W(1,1),G(H)),[U.Floor]:K(W(1,1),G(H)),[U.Ceil]:K(W(1,1),G(H)),[U.Round]:K(W(1,1),G(H)),[U.Sin]:K(W(1,1),G(H)),[U.Cos]:K(W(1,1),G(H)),[U.Atan]:K(W(1,2),G(H)),[U.Sqrt]:K(W(1,1),G(H)),[U.Match]:K(W(4,1/0),ll,ul),[U.Between]:K(W(3,3),G(H)),[U.Interpolate]:K(W(6,1/0),ll,dl),[U.Case]:K(W(3,1/0),cl,fl),[U.In]:K(W(2,2),pl),[U.Number]:K(W(1,1/0),G(Bc)),[U.String]:K(W(1,1/0),G(Bc)),[U.Array]:K(W(1,1/0),G(H)),[U.Color]:K(W(1,4),G(H)),[U.Band]:K(W(1,3),G(H)),[U.Palette]:K(W(2,2),ml),[U.ToString]:K(W(1,1),G(Fc|H|Ic|Lc))};function $c(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=e[a+1];switch(typeof r){case`number`:i[a]=new Jc(H,r);break;case`string`:i[a]=new Jc(Ic,r);break;default:throw Error(`expected a string key or numeric array index for a get operation, got ${r}`)}a===0&&n.properties.set(String(r),t)}return i}function el(){return function(e,t,n){let r=e[1];if(typeof r!=`string`)throw Error(`expected a string argument for var operation`);let i=t,a=n.inputVariables?.[r];if(a!==void 0){let e=Zc(a,Bc,n);if(!(e instanceof Jc))throw Error(`style variables should only be literal values (no expressions!), variable name: ${r}`);let o=e.type;if(typeof a==`string`&&Kc(i,Lc)&&!Kc(i,Ic)?o=Lc:Array.isArray(a)&&a.length===2&&Kc(i,zc)&&!Kc(i,Rc)&&(o=zc),i&=o,i===0)throw Error(`the type expected from the var operator (${Wc(t)}) did not have any overlap with the type of the corresponding style variables (${Wc(o)}), variable name: ${r}`)}if(n.variables.has(r)){let e=n.variables.get(r);if(i&=e,i===0)throw Error(`a new type expected from the var operator (${Wc(t)}) did not have any overlap with the previous type expected for it (${Wc(e)}), variable name: ${r}`)}return n.variables.set(r,i),new Yc(i,`var`,new Jc(Ic,r))}}function tl(e,t,n){n.featureId=!0}function nl(e,t,n){n.geometryType=!0}function rl(e,t,n){n.mCoordinate=!0}function il(e,t,n){n.mapState=!0}function al(e,t,n){let r=e[0];if(e.length!==1)throw Error(`expected no arguments for ${r} operation`);return[]}function W(e,t){return function(n,r,i){let a=n[0],o=n.length-1;if(e===t){if(o!==e)throw Error(`expected ${e} argument${e===1?``:`s`} for ${a}, got ${o}`)}else if(o<e||o>t){let n=t===1/0?`${e} or more`:`${e} to ${t}`;throw Error(`expected ${n} arguments for ${a}, got ${o}`)}}}function ol(e,t,n){let r=e.length-1,i=Array(r);for(let a=0;a<r;++a){let r=Zc(e[a+1],t,n);i[a]=r}return i}function G(e){return function(t,n,r){let i=t.length-1,a=Array(i);for(let n=0;n<i;++n){let i=Zc(t[n+1],e,r);a[n]=i}return a}}function sl(){return function(e,t,n){let r=e[0],i=e.length-1,a=Array(i),o=Bc;for(let t=0;t<i;++t){let r=Zc(e[t+1],o,n);o&=r.type}if(o===0)throw Error(`no common type was found among the arguments of ${r}`);for(let t=0;t<i;++t){let r=Zc(e[t+1],o,n);a[t]=r}return a}}function cl(e,t,n){let r=e[0],i=e.length-1;if(i%2==0)throw Error(`expected an odd number of arguments for ${r}, got ${i} instead`)}function ll(e,t,n){let r=e[0],i=e.length-1;if(i%2==1)throw Error(`expected an even number of arguments for operation ${r}, got ${i} instead`)}function ul(e,t,n){let r=e.length-1,i=Zc(e[e.length-1],t,n),a=Ic|H|Fc,o=Array(r-2);for(let t=0;t<r-2;t+=2){try{let r=Zc(e[t+2],a,n);a&=r.type}catch(e){throw Error(`failed to parse argument ${t+1} of match expression: ${e.message}`)}if(a===0)throw Error(`no common type was found among the arguments of match expression`)}for(let t=0;t<r-2;t+=2){try{let r=Zc(e[t+2],a,n);o[t]=r}catch(e){throw Error(`failed to parse argument ${t+1} of match expression: ${e.message}`)}try{let r=Zc(e[t+3],i.type,n);o[t+1]=r}catch(e){throw Error(`failed to parse argument ${t+2} of match expression: ${e.message}`)}}return[Zc(e[1],a,n),...o,i]}function dl(e,t,n){let r=e[1],i;switch(r[0]){case`linear`:i=1;break;case`exponential`:let e=r[1];if(typeof e!=`number`||e<=0)throw Error(`expected a number base for exponential interpolation, got ${JSON.stringify(e)} instead`);i=e;break;default:throw Error(`invalid interpolation type: ${JSON.stringify(r)}`)}let a=new Jc(H,i),o;try{o=Zc(e[2],H,n)}catch(e){throw Error(`failed to parse argument 1 in interpolate expression: ${e.message}`)}let s=Array(e.length-3);for(let r=0;r<s.length;r+=2){try{let t=Zc(e[r+3],H,n);s[r]=t}catch(e){throw Error(`failed to parse argument ${r+2} for interpolate expression: ${e.message}`)}try{let i=Zc(e[r+4],t,n);s[r+1]=i}catch(e){throw Error(`failed to parse argument ${r+3} for interpolate expression: ${e.message}`)}}return[a,o,...s]}function fl(e,t,n){let r=Zc(e[e.length-1],t,n),i=Array(e.length-1);for(let t=0;t<i.length-1;t+=2){try{let r=Zc(e[t+1],Fc,n);i[t]=r}catch(e){throw Error(`failed to parse argument ${t} of case expression: ${e.message}`)}try{let a=Zc(e[t+2],r.type,n);i[t+1]=a}catch(e){throw Error(`failed to parse argument ${t+1} of case expression: ${e.message}`)}}return i[i.length-1]=r,i}function pl(e,t,n){let r=e[2];if(!Array.isArray(r))throw Error(`the second argument for the "in" operator must be an array`);let i;if(r[0]===`literal`){if(r=r[1],!Array.isArray(r))throw Error(`failed to parse "in" expression: the literal operator must be followed by an array`)}else if(typeof r[0]==`string`)throw Error(`for the "in" operator, a string array should be wrapped in a "literal" operator to disambiguate from expressions`);i=typeof r[0]==`string`?Ic:H;let a=Array(r.length);for(let e=0;e<a.length;e++)try{let t=Zc(r[e],i,n);a[e]=t}catch(t){throw Error(`failed to parse haystack item ${e} for "in" expression: ${t.message}`)}return[Zc(e[1],i,n),...a]}function ml(e,t,n){let r;try{r=Zc(e[1],H,n)}catch(e){throw Error(`failed to parse first argument in palette expression: ${e.message}`)}let i=e[2];if(!Array.isArray(i))throw Error(`the second argument of palette must be an array`);let a=Array(i.length);for(let e=0;e<a.length;e++){let t;try{t=Zc(i[e],Lc,n)}catch(t){throw Error(`failed to parse color at index ${e} in palette expression: ${t.message}`)}if(!(t instanceof Jc))throw Error(`the palette color at index ${e} must be a literal value`);a[e]=t}return[r,...a]}function K(...e){return function(t,n,r){let i=t[0],a;for(let i=0;i<e.length;i++){let o=e[i](t,n,r);if(i==e.length-1){if(!o)throw Error(`expected last argument validator to return the parsed args`);a=o}}return new Yc(n,i,...a)}}function hl(e,t,n){let r=e[0],i=Qc[r];if(!i)throw Error(`unknown operator: ${r}`);return i(e,t,n)}function gl(e){if(!e)return``;let t=e.getType();switch(t){case`Point`:case`LineString`:case`Polygon`:return t;case`MultiPoint`:case`MultiLineString`:case`MultiPolygon`:return t.substring(5);case`Circle`:return`Polygon`;case`GeometryCollection`:return gl(e.getGeometries()[0]);default:return``}}function _l(){return{variables:{},properties:{},resolution:NaN,featureId:null,geometryType:``}}function vl(e,t,n){return yl(Zc(e,t,n),n)}function yl(e,t){if(e instanceof Jc){if(e.type===Lc&&typeof e.value==`string`){let t=Oc(e.value);return function(){return t}}return function(){return e.value}}let n=e.operator;switch(n){case U.Number:case U.String:case U.Coalesce:return bl(e,t);case U.Get:case U.Var:case U.Has:return xl(e,t);case U.Id:return e=>e.featureId;case U.GeometryType:return e=>e.geometryType;case U.Concat:{let n=e.args.map(e=>yl(e,t));return e=>``.concat(...n.map(t=>t(e).toString()))}case U.Resolution:return e=>e.resolution;case U.Any:case U.All:case U.Between:case U.In:case U.Not:return Cl(e,t);case U.Equal:case U.NotEqual:case U.LessThan:case U.LessThanOrEqualTo:case U.GreaterThan:case U.GreaterThanOrEqualTo:return Sl(e,t);case U.Multiply:case U.Divide:case U.Add:case U.Subtract:case U.Clamp:case U.Mod:case U.Pow:case U.Abs:case U.Floor:case U.Ceil:case U.Round:case U.Sin:case U.Cos:case U.Atan:case U.Sqrt:return wl(e,t);case U.Case:return Tl(e,t);case U.Match:return El(e,t);case U.Interpolate:return Dl(e,t);case U.ToString:return Ol(e,t);default:throw Error(`Unsupported operator ${n}`)}}function bl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.Coalesce:return e=>{for(let t=0;t<r;++t){let n=i[t](e);if(n!=null)return n}throw Error(`Expected one of the values to be non-null`)};case U.Number:case U.String:return e=>{for(let t=0;t<r;++t){let r=i[t](e);if(typeof r===n)return r}throw Error(`Expected one of the values to be a ${n}`)};default:throw Error(`Unsupported assertion operator ${n}`)}}function xl(e,t){let n=e.args[0].value;switch(e.operator){case U.Get:return t=>{let r=e.args,i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;i=i[t]}return i};case U.Var:return e=>e.variables[n];case U.Has:return t=>{let r=e.args;if(!(n in t.properties))return!1;let i=t.properties[n];for(let e=1,t=r.length;e<t;++e){let t=r[e].value;if(!i||!Object.hasOwn(i,t))return!1;i=i[t]}return!0};default:throw Error(`Unsupported accessor operator ${e.operator}`)}}function Sl(e,t){let n=e.operator,r=yl(e.args[0],t),i=yl(e.args[1],t);switch(n){case U.Equal:return e=>r(e)===i(e);case U.NotEqual:return e=>r(e)!==i(e);case U.LessThan:return e=>r(e)<i(e);case U.LessThanOrEqualTo:return e=>r(e)<=i(e);case U.GreaterThan:return e=>r(e)>i(e);case U.GreaterThanOrEqualTo:return e=>r(e)>=i(e);default:throw Error(`Unsupported comparison operator ${n}`)}}function Cl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.Any:return e=>{for(let t=0;t<r;++t)if(i[t](e))return!0;return!1};case U.All:return e=>{for(let t=0;t<r;++t)if(!i[t](e))return!1;return!0};case U.Between:return e=>{let t=i[0](e),n=i[1](e),r=i[2](e);return t>=n&&t<=r};case U.In:return e=>{let t=i[0](e);for(let n=1;n<r;++n)if(t===i[n](e))return!0;return!1};case U.Not:return e=>!i[0](e);default:throw Error(`Unsupported logical operator ${n}`)}}function wl(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.Multiply:return e=>{let t=1;for(let n=0;n<r;++n)t*=i[n](e);return t};case U.Divide:return e=>i[0](e)/i[1](e);case U.Add:return e=>{let t=0;for(let n=0;n<r;++n)t+=i[n](e);return t};case U.Subtract:return e=>i[0](e)-i[1](e);case U.Clamp:return e=>{let t=i[0](e),n=i[1](e);if(t<n)return n;let r=i[2](e);return t>r?r:t};case U.Mod:return e=>i[0](e)%i[1](e);case U.Pow:return e=>i[0](e)**+i[1](e);case U.Abs:return e=>Math.abs(i[0](e));case U.Floor:return e=>Math.floor(i[0](e));case U.Ceil:return e=>Math.ceil(i[0](e));case U.Round:return e=>Math.round(i[0](e));case U.Sin:return e=>Math.sin(i[0](e));case U.Cos:return e=>Math.cos(i[0](e));case U.Atan:return r===2?e=>Math.atan2(i[0](e),i[1](e)):e=>Math.atan(i[0](e));case U.Sqrt:return e=>Math.sqrt(i[0](e));default:throw Error(`Unsupported numeric operator ${n}`)}}function Tl(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=yl(e.args[i],t);return e=>{for(let t=0;t<n-1;t+=2)if(r[t](e))return r[t+1](e);return r[n-1](e)}}function El(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=yl(e.args[i],t);return e=>{let t=r[0](e);for(let i=1;i<n-1;i+=2)if(t===r[i](e))return r[i+1](e);return r[n-1](e)}}function Dl(e,t){let n=e.args.length,r=Array(n);for(let i=0;i<n;++i)r[i]=yl(e.args[i],t);return e=>{let t=r[0](e),i=r[1](e),a,o;for(let s=2;s<n;s+=2){let n=r[s](e),c=r[s+1](e),l=Array.isArray(c);if(l&&(c=xc(c)),n>=i)return s===2?c:l?Al(t,i,a,o,n,c):kl(t,i,a,o,n,c);a=n,o=c}return o}}function Ol(e,t){let n=e.operator,r=e.args.length,i=Array(r);for(let n=0;n<r;++n)i[n]=yl(e.args[n],t);switch(n){case U.ToString:return t=>{let n=i[0](t);return e.args[0].type===Lc?Ac(n):n.toString()};default:throw Error(`Unsupported convert operator ${n}`)}}function kl(e,t,n,r,i,a){let o=i-n;if(o===0)return r;let s=t-n;return r+(e===1?s/o:(e**+s-1)/(e**+o-1))*(a-r)}function Al(e,t,n,r,i,a){if(i-n===0)return r;let o=Ec(r),s=Ec(a),c=s[2]-o[2];return c>180?c-=360:c<-180&&(c+=360),Dc([kl(e,t,n,o[0],i,s[0]),kl(e,t,n,o[1],i,s[1]),o[2]+kl(e,t,n,0,i,c),kl(e,t,n,r[3],i,a[3])])}var q={IDLE:0,LOADING:1,LOADED:2,ERROR:3,EMPTY:4};function jl(e,t,n){let r=e,i=!0,a=!1,o=!1,s=[rt(r,P.LOAD,function(){o=!0,a||t()})];return r.src&&Lt?(a=!0,r.decode().then(function(){i&&t()}).catch(function(e){i&&(o?t():n())})):s.push(rt(r,P.ERROR,n)),function(){i=!1,s.forEach(it)}}function Ml(e,t){return new Promise((n,r)=>{function i(){o(),n(e)}function a(){o(),r(Error(`Image load error`))}function o(){e.removeEventListener(`load`,i),e.removeEventListener(`error`,a)}e.addEventListener(`load`,i),e.addEventListener(`error`,a),t&&(e.src=t)})}function Nl(e,t){return t&&(e.src=t),e.src&&Lt?new Promise((t,n)=>e.decode().then(()=>t(e)).catch(r=>e.complete&&e.width?t(e):n(r))):Ml(e)}var Pl=class{constructor(){this.cache_={},this.patternCache_={},this.cacheSize_=0,this.maxCacheSize_=1024}clear(){this.cache_={},this.patternCache_={},this.cacheSize_=0}canExpireCache(){return this.cacheSize_>this.maxCacheSize_}expire(){if(this.canExpireCache()){let e=0;for(let t in this.cache_){let n=this.cache_[t];!(e++&3)&&!n.hasListener()&&(delete this.cache_[t],delete this.patternCache_[t],--this.cacheSize_)}}}get(e,t){let n=Fl(e,t);return n in this.cache_?this.cache_[n]:null}getPattern(e,t){let n=Fl(e,t);return n in this.patternCache_?this.patternCache_[n]:null}set(e,t,n,r){let i=Fl(e,t),a=i in this.cache_;this.cache_[i]=n,r&&(n.getImageState()===q.IDLE&&n.load(),n.getImageState()===q.LOADING?n.ready().then(()=>{this.patternCache_[i]=Ro().createPattern(n.getImage(1),`repeat`)}):this.patternCache_[i]=Ro().createPattern(n.getImage(1),`repeat`)),a||++this.cacheSize_}setSize(e){this.maxCacheSize_=e,this.expire()}};function Fl(e,t){let n=t?kc(t):`null`;return e+`:`+n}var Il=new Pl,Ll=null,Rl=class extends bt{constructor(e,t,n,r,i){super(),this.hitDetectionImage_=null,this.image_=e,this.crossOrigin_=n?.crossOrigin,this.referrerPolicy_=n?.referrerPolicy,this.canvas_={},this.color_=i,this.imageState_=r===void 0?q.IDLE:r,this.size_=e&&e.width&&e.height?[e.width,e.height]:null,this.src_=t,this.tainted_,this.ready_=null}initializeImage_(){this.image_=new Image,this.crossOrigin_!==null&&(this.image_.crossOrigin=this.crossOrigin_),this.referrerPolicy_!==void 0&&(this.image_.referrerPolicy=this.referrerPolicy_)}isTainted_(){if(this.tainted_===void 0&&this.imageState_===q.LOADED){Ll||=Io(1,1,void 0,{willReadFrequently:!0}),Ll.drawImage(this.image_,0,0);try{Ll.getImageData(0,0,1,1),this.tainted_=!1}catch{Ll=null,this.tainted_=!0}}return this.tainted_===!0}dispatchChangeEvent_(){this.dispatchEvent(P.CHANGE)}handleImageError_(){this.imageState_=q.ERROR,this.dispatchChangeEvent_()}handleImageLoad_(){this.imageState_=q.LOADED,this.size_=[this.image_.width,this.image_.height],this.dispatchChangeEvent_()}getImage(e){return this.image_||this.initializeImage_(),this.replaceColor_(e),this.canvas_[e]?this.canvas_[e]:this.image_}setImage(e){this.image_=e}getPixelRatio(e){return this.replaceColor_(e),this.canvas_[e]?e:1}getImageState(){return this.imageState_}getHitDetectionImage(){if(this.image_||this.initializeImage_(),!this.hitDetectionImage_){if(this.isTainted_()){let e=this.size_[0],t=this.size_[1],n=Io(e,t);n.fillRect(0,0,e,t),this.hitDetectionImage_=n.canvas}else this.hitDetectionImage_=this.image_}return this.hitDetectionImage_}getSize(){return this.size_}getSrc(){return this.src_}load(){if(this.imageState_===q.IDLE){this.image_||this.initializeImage_(),this.imageState_=q.LOADING;try{this.src_!==void 0&&(this.image_.src=this.src_)}catch{this.handleImageError_()}this.image_ instanceof HTMLImageElement&&Nl(this.image_,this.src_).then(e=>{this.image_=e,this.handleImageLoad_()}).catch(this.handleImageError_.bind(this))}}replaceColor_(e){if(!this.color_||this.canvas_[e]||this.imageState_!==q.LOADED)return;let t=this.image_,n=Io(Math.ceil(t.width*e),Math.ceil(t.height*e)),r=n.canvas;n.scale(e,e),n.drawImage(t,0,0),n.globalCompositeOperation=`multiply`,n.fillStyle=_c(this.color_),n.fillRect(0,0,r.width/e,r.height/e),n.globalCompositeOperation=`destination-in`,n.drawImage(t,0,0),this.canvas_[e]=r}ready(){return this.ready_||=new Promise(e=>{if(this.imageState_===q.LOADED||this.imageState_===q.ERROR)e();else{let t=()=>{(this.imageState_===q.LOADED||this.imageState_===q.ERROR)&&(this.removeEventListener(P.CHANGE,t),e())};this.addEventListener(P.CHANGE,t)}}),this.ready_}};function zl(e,t,n,r,i,a){let o=t===void 0?void 0:Il.get(t,i);return o||(o=new Rl(e,e&&`src`in e?e.src||void 0:t,n,r,i),Il.set(t,i,o,a)),a&&o&&!Il.getPattern(t,i)&&Il.set(t,i,o,a),o}function Bl(e){return e?Array.isArray(e)?Ac(e):typeof e==`object`&&`src`in e?Vl(e):e:null}function Vl(e){if(!e.offset||!e.size)return Il.getPattern(e.src,e.color);let t=e.src+`:`+e.offset,n=Il.getPattern(t,e.color);if(n)return n;let r=Il.get(e.src,null);if(r.getImageState()!==q.LOADED)return null;let i=Io(e.size[0],e.size[1]);return i.drawImage(r.getImage(1),e.offset[0],e.offset[1],e.size[0],e.size[1],0,0,e.size[0],e.size[1]),zl(i.canvas,t,void 0,q.LOADED,e.color,!0),Il.getPattern(t,e.color)}var Hl=`10px sans-serif`,Ul=`#000`,Wl=`round`,Gl=[],Kl=`round`,ql=`#000`,Jl=`center`,Yl=`middle`,Xl=[0,0,0,0],Zl=new Tt,Ql=null,$l,eu={},tu=new Set([`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`,`ui-serif`,`ui-sans-serif`,`ui-monospace`,`ui-rounded`,`emoji`,`math`,`fangsong`]);function nu(e,t,n){return`${e} ${t} 16px "${n}"`}var ru=(function(){let e,t;async function n(e){await t.ready;let n=Fo(e),r=n.families[0].toLowerCase(),i=n.weight,a=[];return t.forEach(e=>{let t=e.family.replace(/^['"]|['"]$/g,``).toLowerCase(),o=Po[e.weight]||e.weight;t===r&&e.style===n.style&&o==i&&a.push(e)}),a.length!==0&&(await Promise.all(a.map(e=>e.load().then(()=>!0,()=>!1)))).some(e=>e)}async function r(){await t.ready;let i=!0,a=Zl.getProperties(),o=Object.keys(a).filter(e=>a[e]<100);for(let e=o.length-1;e>=0;--e){let t=o[e],r=a[t];r<100&&(await n(t)?(tt(eu),Zl.set(t,100)):(r+=10,Zl.set(t,r,!0),r<100&&(i=!1)))}e=void 0,i||(e=setTimeout(r,100))}return async function(n){t||=It?self.fonts:document.fonts;let i=Fo(n);if(!i)return;let a=i.families,o=!1;for(let e of a){if(tu.has(e))continue;let t=nu(i.style,i.weight,e);Zl.get(t)===void 0&&(Zl.set(t,0,!0),o=!0)}o&&(clearTimeout(e),e=setTimeout(r,100))}})(),iu=(function(){let e;return function(t){let n=eu[t];if(n==null){if(It){let e=Fo(t),r=au(t,`Žg`);n=(isNaN(Number(e.lineHeight))?1.2:Number(e.lineHeight))*(r.actualBoundingBoxAscent+r.actualBoundingBoxDescent)}else e||(e=document.createElement(`div`),e.innerHTML=`M`,e.style.minHeight=`0`,e.style.maxHeight=`none`,e.style.height=`auto`,e.style.padding=`0`,e.style.border=`none`,e.style.position=`absolute`,e.style.display=`block`,e.style.left=`-99999px`),e.style.font=t,document.body.appendChild(e),n=e.offsetHeight,document.body.removeChild(e);eu[t]=n}return n}})();function au(e,t){return Ql||=Io(1,1),e!=$l&&(Ql.font=e,$l=Ql.font),Ql.measureText(t)}function ou(e,t){return au(e,t).width}function su(e,t,n){if(t in n)return n[t];let r=t.split(`
|
|
2
2
|
`).reduce((t,n)=>Math.max(t,ou(e,n)),0);return n[t]=r,r}function cu(e,t){let n=[],r=[],i=[],a=0,o=0,s=0,c=0;for(let l=0,u=t.length;l<=u;l+=2){let d=t[l];if(d===`
|
|
3
3
|
`||l===u){a=Math.max(a,o),i.push(o),o=0,s+=c,c=0;continue}let f=t[l+1]||e.font,p=ou(f,d);n.push(p),o+=p;let m=iu(f);r.push(m),c=Math.max(c,m)}return{width:a,height:s,widths:n,heights:r,lineWidths:i}}function lu(e,t,n,r,i,a,o,s,c,l,u){e.save(),n!==1&&(e.globalAlpha===void 0?e.globalAlpha=e=>e.globalAlpha*=n:e.globalAlpha*=n),t&&e.transform.apply(e,t),r.contextInstructions?(e.translate(c,l),e.scale(u[0],u[1]),uu(r,e)):u[0]<0||u[1]<0?(e.translate(c,l),e.scale(u[0],u[1]),e.drawImage(r,i,a,o,s,0,0,o,s)):e.drawImage(r,i,a,o,s,c,l,o*u[0],s*u[1]),e.restore()}function uu(e,t){let n=e.contextInstructions;for(let e=0,r=n.length;e<r;e+=2)Array.isArray(n[e+1])?t[n[e]].apply(t,n[e+1]):t[n[e]]=n[e+1]}var du=class e{constructor(e){this.opacity_=e.opacity,this.rotateWithView_=e.rotateWithView,this.rotation_=e.rotation,this.scale_=e.scale,this.scaleArray_=Nc(e.scale),this.displacement_=e.displacement,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({opacity:this.getOpacity(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getOpacity(){return this.opacity_}getRotateWithView(){return this.rotateWithView_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getDisplacement(){return this.displacement_}getDeclutterMode(){return this.declutterMode_}getAnchor(){return F()}getImage(e){return F()}getHitDetectionImage(){return F()}getPixelRatio(e){return 1}getImageState(){return F()}getImageSize(){return F()}getOrigin(){return F()}getSize(){return F()}setDisplacement(e){this.displacement_=e}setOpacity(e){this.opacity_=e}setRotateWithView(e){this.rotateWithView_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Nc(e)}listenImageChange(e){F()}load(){F()}unlistenImageChange(e){F()}ready(){return Promise.resolve()}},fu=class e extends du{constructor(e){super({opacity:1,rotateWithView:e.rotateWithView!==void 0&&e.rotateWithView,rotation:e.rotation===void 0?0:e.rotation,scale:e.scale===void 0?1:e.scale,displacement:e.displacement===void 0?[0,0]:e.displacement,declutterMode:e.declutterMode}),this.hitDetectionCanvas_=null,this.fill_=e.fill===void 0?null:e.fill,this.origin_=[0,0],this.points_=e.points,this.radius=e.radius,this.radius2_=e.radius2,this.angle_=e.angle===void 0?0:e.angle,this.stroke_=e.stroke===void 0?null:e.stroke,this.size_,this.renderOptions_,this.imageState_=this.fill_&&this.fill_.loading()?q.LOADING:q.LOADED,this.imageState_===q.LOADING&&this.ready().then(()=>this.imageState_=q.LOADED),this.render()}clone(){let t=this.getScale(),n=new e({fill:this.getFill()?this.getFill().clone():void 0,points:this.getPoints(),radius:this.getRadius(),radius2:this.getRadius2(),angle:this.getAngle(),stroke:this.getStroke()?this.getStroke().clone():void 0,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),scale:Array.isArray(t)?t.slice():t,displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}getAnchor(){let e=this.size_,t=this.getDisplacement(),n=this.getScaleArray();return[e[0]/2-t[0]/n[0],e[1]/2+t[1]/n[1]]}getAngle(){return this.angle_}getFill(){return this.fill_}setFill(e){this.fill_=e,this.render()}getHitDetectionImage(){return this.hitDetectionCanvas_||=this.createHitDetectionCanvas_(this.renderOptions_),this.hitDetectionCanvas_}getImage(e){let t=this.fill_?.getKey(),n=`${e},${this.angle_},${this.radius},${this.radius2_},${this.points_},${t}`+Object.values(this.renderOptions_).join(`,`),r=Il.get(n,null)?.getImage(1);if(!r){let t=this.renderOptions_,i=Math.ceil(t.size*e),a=Io(i,i);this.draw_(t,a,e),r=a.canvas;let o=new Rl(r,void 0,null,q.LOADED,null);Il.set(n,null,o),createImageBitmap(r).then(e=>{o.setImage(e)})}return r}getPixelRatio(e){return e}getImageSize(){return this.size_}getImageState(){return this.imageState_}getOrigin(){return this.origin_}getPoints(){return this.points_}getRadius(){return this.radius}setRadius(e){this.radius!==e&&(this.radius=e,this.render())}getRadius2(){return this.radius2_}setRadius2(e){this.radius2_!==e&&(this.radius2_=e,this.render())}getSize(){return this.size_}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e,this.render()}listenImageChange(e){}load(){}unlistenImageChange(e){}calculateLineJoinSize_(e,t,n){if(t===0||this.points_===1/0||e!==`bevel`&&e!==`miter`)return t;let r=this.radius,i=this.radius2_===void 0?r:this.radius2_;if(r<i){let e=r;r=i,i=e}let a=this.radius2_===void 0?this.points_:this.points_*2,o=2*Math.PI/a,s=i*Math.sin(o),c=Math.sqrt(i*i-s*s),l=r-c,u=Math.sqrt(s*s+l*l),d=u/s;if(e===`miter`&&d<=n)return d*t;let f=t/2/d,p=t/2*(l/u),m=Math.sqrt((r+f)*(r+f)+p*p)-r;if(this.radius2_===void 0||e===`bevel`)return m*2;let h=r*Math.sin(o),g=Math.sqrt(r*r-h*h),_=i-g,v=Math.sqrt(h*h+_*_)/h;if(v<=n){let e=v*t/2-i-r;return 2*Math.max(m,e)}return m*2}createRenderOptions(){let e=Wl,t=Kl,n=0,r=null,i=0,a,o=0;this.stroke_&&(a=Bl(this.stroke_.getColor()??`#000`),o=this.stroke_.getWidth()??1,r=this.stroke_.getLineDash(),i=this.stroke_.getLineDashOffset()??0,t=this.stroke_.getLineJoin()??`round`,e=this.stroke_.getLineCap()??`round`,n=this.stroke_.getMiterLimit()??10);let s=this.calculateLineJoinSize_(t,o,n),c=Math.max(this.radius,this.radius2_||0),l=Math.ceil(2*c+s);return{strokeStyle:a,strokeWidth:o,size:l,lineCap:e,lineDash:r,lineDashOffset:i,lineJoin:t,miterLimit:n}}render(){this.renderOptions_=this.createRenderOptions();let e=this.renderOptions_.size;this.hitDetectionCanvas_=null,this.size_=[e,e]}draw_(e,t,n){if(t.scale(n,n),t.translate(e.size/2,e.size/2),this.createPath_(t),this.fill_){let e=this.fill_.getColor();e===null&&(e=Ul),t.fillStyle=Bl(e),t.fill()}e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineCap=e.lineCap,t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}createHitDetectionCanvas_(e){let t;if(this.fill_){let n=this.fill_.getColor(),r=0;typeof n==`string`&&(n=kc(n)),n===null?r=1:Array.isArray(n)&&(r=n.length===4?n[3]:1),r===0&&(t=Io(e.size,e.size),this.drawHitDetectionCanvas_(e,t))}return t?t.canvas:this.getImage(1)}createPath_(e){let t=this.points_,n=this.radius;if(t===1/0)e.arc(0,0,n,0,2*Math.PI);else{let r=this.radius2_===void 0?n:this.radius2_;this.radius2_!==void 0&&(t*=2);let i=this.angle_-Math.PI/2,a=2*Math.PI/t;for(let o=0;o<t;o++){let t=i+o*a,s=o%2==0?n:r;e.lineTo(s*Math.cos(t),s*Math.sin(t))}e.closePath()}}drawHitDetectionCanvas_(e,t){t.translate(e.size/2,e.size/2),this.createPath_(t),t.fillStyle=Ul,t.fill(),e.strokeStyle&&(t.strokeStyle=e.strokeStyle,t.lineWidth=e.strokeWidth,e.lineDash&&(t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset),t.lineJoin=e.lineJoin,t.miterLimit=e.miterLimit,t.stroke())}ready(){return this.fill_?this.fill_.ready():Promise.resolve()}},pu=class e extends fu{constructor(e){e||={radius:5},super({points:1/0,fill:e.fill,radius:e.radius,stroke:e.stroke,scale:e.scale===void 0?1:e.scale,rotation:e.rotation===void 0?0:e.rotation,rotateWithView:e.rotateWithView!==void 0&&e.rotateWithView,displacement:e.displacement===void 0?[0,0]:e.displacement,declutterMode:e.declutterMode})}clone(){let t=this.getScale(),n=new e({fill:this.getFill()?this.getFill().clone():void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,radius:this.getRadius(),scale:Array.isArray(t)?t.slice():t,rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()});return n.setOpacity(this.getOpacity()),n}},mu=class e{constructor(e){e||={},this.patternImage_=null,this.color_=null,e.color!==void 0&&this.setColor(e.color)}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0})}getColor(){return this.color_}setColor(e){if(typeof e==`object`&&e&&`src`in e){let t=zl(null,e.src,{crossOrigin:`anonymous`},void 0,e.offset?null:e.color?e.color:null,!(e.offset&&e.size));t.ready().then(()=>{this.patternImage_=null}),t.getImageState()===q.IDLE&&t.load(),t.getImageState()===q.LOADING&&(this.patternImage_=t)}this.color_=e}getKey(){let e=this.getColor();return e?e instanceof CanvasPattern||e instanceof CanvasGradient?I(e):typeof e==`object`&&`src`in e?e.src+`:`+e.offset:kc(e).toString():``}loading(){return!!this.patternImage_}ready(){return this.patternImage_?this.patternImage_.ready():Promise.resolve()}};function hu(e,t,n,r){return n!==void 0&&r!==void 0?[n/e,r/t]:n===void 0?r===void 0?1:r/t:n/e}var gu=class e extends du{constructor(e){e||={};let t=e.opacity===void 0?1:e.opacity,n=e.rotation===void 0?0:e.rotation,r=e.scale===void 0?1:e.scale,i=e.rotateWithView!==void 0&&e.rotateWithView;super({opacity:t,rotation:n,scale:r,displacement:e.displacement===void 0?[0,0]:e.displacement,rotateWithView:i,declutterMode:e.declutterMode}),this.anchor_=e.anchor===void 0?[.5,.5]:e.anchor,this.normalizedAnchor_=null,this.anchorOrigin_=e.anchorOrigin===void 0?`top-left`:e.anchorOrigin,this.anchorXUnits_=e.anchorXUnits===void 0?`fraction`:e.anchorXUnits,this.anchorYUnits_=e.anchorYUnits===void 0?`fraction`:e.anchorYUnits,this.crossOrigin_=e.crossOrigin===void 0?null:e.crossOrigin,this.referrerPolicy_=e.referrerPolicy;let a=e.img===void 0?null:e.img,o=e.src;R(!(o!==void 0&&a),"`image` and `src` cannot be provided at the same time"),(o===void 0||o.length===0)&&a&&(o=a.src||I(a)),R(o!==void 0&&o.length>0,"A defined and non-empty `src` or `image` must be provided"),R(e.width===void 0&&e.height===void 0||e.scale===void 0,"`width` or `height` cannot be provided together with `scale`");let s;if(e.src===void 0?a!==void 0&&(s=`complete`in a?a.complete?a.src?q.LOADED:q.IDLE:q.LOADING:q.LOADED):s=q.IDLE,this.color_=e.color===void 0?null:kc(e.color),this.iconImage_=zl(a,o,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},s,this.color_),this.offset_=e.offset===void 0?[0,0]:e.offset,this.offsetOrigin_=e.offsetOrigin===void 0?`top-left`:e.offsetOrigin,this.origin_=null,this.size_=e.size===void 0?null:e.size,this.initialOptions_,e.width!==void 0||e.height!==void 0){let t,n;if(e.size)[t,n]=e.size;else{let r=this.getImage(1);if(r.width&&r.height)t=r.width,n=r.height;else if(r instanceof HTMLImageElement){this.initialOptions_=e;let t=()=>{if(this.unlistenImageChange(t),!this.initialOptions_)return;let n=this.iconImage_.getSize();this.setScale(hu(n[0],n[1],e.width,e.height))};this.listenImageChange(t);return}}t!==void 0&&this.setScale(hu(t,n,e.width,e.height))}}clone(){let t,n,r;return this.initialOptions_?(n=this.initialOptions_.width,r=this.initialOptions_.height):(t=this.getScale(),t=Array.isArray(t)?t.slice():t),new e({anchor:this.anchor_.slice(),anchorOrigin:this.anchorOrigin_,anchorXUnits:this.anchorXUnits_,anchorYUnits:this.anchorYUnits_,color:this.color_&&this.color_.slice?this.color_.slice():this.color_||void 0,crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_,offset:this.offset_.slice(),offsetOrigin:this.offsetOrigin_,opacity:this.getOpacity(),rotateWithView:this.getRotateWithView(),rotation:this.getRotation(),scale:t,width:n,height:r,size:this.size_===null?void 0:this.size_.slice(),src:this.getSrc(),displacement:this.getDisplacement().slice(),declutterMode:this.getDeclutterMode()})}getAnchor(){let e=this.normalizedAnchor_;if(!e){e=this.anchor_;let t=this.getSize();if(this.anchorXUnits_==`fraction`||this.anchorYUnits_==`fraction`){if(!t)return null;e=this.anchor_.slice(),this.anchorXUnits_==`fraction`&&(e[0]*=t[0]),this.anchorYUnits_==`fraction`&&(e[1]*=t[1])}if(this.anchorOrigin_!=`top-left`){if(!t)return null;e===this.anchor_&&(e=this.anchor_.slice()),(this.anchorOrigin_==`top-right`||this.anchorOrigin_==`bottom-right`)&&(e[0]=-e[0]+t[0]),(this.anchorOrigin_==`bottom-left`||this.anchorOrigin_==`bottom-right`)&&(e[1]=-e[1]+t[1])}this.normalizedAnchor_=e}let t=this.getDisplacement(),n=this.getScaleArray();return[e[0]-t[0]/n[0],e[1]+t[1]/n[1]]}setAnchor(e){this.anchor_=e,this.normalizedAnchor_=null}getColor(){return this.color_}setColor(e){let t=e?kc(e):null;if(this.color_===t||this.color_&&t&&this.color_.length===t.length&&this.color_.every((e,n)=>e===t[n]))return;this.color_=t;let n=this.getSrc(),r=n===void 0?this.getHitDetectionImage():null,i=n===void 0?this.iconImage_.getImageState():q.IDLE;this.iconImage_=zl(r,n,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},i,this.color_)}getImage(e){return this.iconImage_.getImage(e)}getPixelRatio(e){return this.iconImage_.getPixelRatio(e)}getImageSize(){return this.iconImage_.getSize()}getImageState(){return this.iconImage_.getImageState()}getHitDetectionImage(){return this.iconImage_.getHitDetectionImage()}getOrigin(){if(this.origin_)return this.origin_;let e=this.offset_;if(this.offsetOrigin_!=`top-left`){let t=this.getSize(),n=this.iconImage_.getSize();if(!t||!n)return null;e=e.slice(),(this.offsetOrigin_==`top-right`||this.offsetOrigin_==`bottom-right`)&&(e[0]=n[0]-t[0]-e[0]),(this.offsetOrigin_==`bottom-left`||this.offsetOrigin_==`bottom-right`)&&(e[1]=n[1]-t[1]-e[1])}return this.origin_=e,this.origin_}getSrc(){return this.iconImage_.getSrc()}setSrc(e){this.iconImage_=zl(null,e,{crossOrigin:this.crossOrigin_,referrerPolicy:this.referrerPolicy_},q.IDLE,this.color_)}getSize(){return this.size_?this.size_:this.iconImage_.getSize()}getWidth(){let e=this.getScaleArray();if(this.size_)return this.size_[0]*e[0];if(this.iconImage_.getImageState()==q.LOADED)return this.iconImage_.getSize()[0]*e[0]}getHeight(){let e=this.getScaleArray();if(this.size_)return this.size_[1]*e[1];if(this.iconImage_.getImageState()==q.LOADED)return this.iconImage_.getSize()[1]*e[1]}setScale(e){delete this.initialOptions_,super.setScale(e)}listenImageChange(e){this.iconImage_.addEventListener(P.CHANGE,e)}load(){this.iconImage_.load()}unlistenImageChange(e){this.iconImage_.removeEventListener(P.CHANGE,e)}ready(){return this.iconImage_.ready()}},_u=class e{constructor(e){e||={},this.color_=e.color===void 0?null:e.color,this.lineCap_=e.lineCap,this.lineDash_=e.lineDash===void 0?null:e.lineDash,this.lineDashOffset_=e.lineDashOffset,this.lineJoin_=e.lineJoin,this.miterLimit_=e.miterLimit,this.offset_=e.offset,this.width_=e.width}clone(){let t=this.getColor();return new e({color:Array.isArray(t)?t.slice():t||void 0,lineCap:this.getLineCap(),lineDash:this.getLineDash()?this.getLineDash().slice():void 0,lineDashOffset:this.getLineDashOffset(),lineJoin:this.getLineJoin(),miterLimit:this.getMiterLimit(),offset:this.getOffset(),width:this.getWidth()})}getColor(){return this.color_}getLineCap(){return this.lineCap_}getLineDash(){return this.lineDash_}getLineDashOffset(){return this.lineDashOffset_}getLineJoin(){return this.lineJoin_}getMiterLimit(){return this.miterLimit_}getOffset(){return this.offset_}getWidth(){return this.width_}setColor(e){this.color_=e}setLineCap(e){this.lineCap_=e}setLineDash(e){this.lineDash_=e}setLineDashOffset(e){this.lineDashOffset_=e}setLineJoin(e){this.lineJoin_=e}setMiterLimit(e){this.miterLimit_=e}setOffset(e){this.offset_=e}setWidth(e){this.width_=e}},vu=class e{constructor(e){e||={},this.geometry_=null,this.geometryFunction_=Su,e.geometry!==void 0&&this.setGeometry(e.geometry),this.fill_=e.fill===void 0?null:e.fill,this.image_=e.image===void 0?null:e.image,this.renderer_=e.renderer===void 0?null:e.renderer,this.hitDetectionRenderer_=e.hitDetectionRenderer===void 0?null:e.hitDetectionRenderer,this.stroke_=e.stroke===void 0?null:e.stroke,this.text_=e.text===void 0?null:e.text,this.zIndex_=e.zIndex}clone(){let t=this.getGeometry();return t&&typeof t==`object`&&(t=t.clone()),new e({geometry:t??void 0,fill:this.getFill()?this.getFill().clone():void 0,image:this.getImage()?this.getImage().clone():void 0,renderer:this.getRenderer()??void 0,stroke:this.getStroke()?this.getStroke().clone():void 0,text:this.getText()?this.getText().clone():void 0,zIndex:this.getZIndex()})}getRenderer(){return this.renderer_}setRenderer(e){this.renderer_=e}setHitDetectionRenderer(e){this.hitDetectionRenderer_=e}getHitDetectionRenderer(){return this.hitDetectionRenderer_}getGeometry(){return this.geometry_}getGeometryFunction(){return this.geometryFunction_}getFill(){return this.fill_}setFill(e){this.fill_=e}getImage(){return this.image_}setImage(e){this.image_=e}getStroke(){return this.stroke_}setStroke(e){this.stroke_=e}getText(){return this.text_}setText(e){this.text_=e}getZIndex(){return this.zIndex_}setGeometry(e){typeof e==`function`?this.geometryFunction_=e:typeof e==`string`?this.geometryFunction_=function(t){return t.get(e)}:e?e!==void 0&&(this.geometryFunction_=function(){return e}):this.geometryFunction_=Su,this.geometry_=e}setZIndex(e){this.zIndex_=e}};function yu(e){let t;if(typeof e==`function`)t=e;else{let n;Array.isArray(e)?n=e:(R(typeof e.getZIndex==`function`,"Expected an `Style` or an array of `Style`"),n=[e]),t=function(){return n}}return t}var bu=null;function xu(e,t){if(!bu){let e=new mu({color:`rgba(255,255,255,0.4)`}),t=new _u({color:`#3399CC`,width:1.25});bu=[new vu({image:new pu({fill:e,stroke:t,radius:5}),fill:e,stroke:t})]}return bu}function Su(e){return e.getGeometry()}var Cu=`#333`,wu=class e{constructor(e){e||={},this.font_=e.font,this.rotation_=e.rotation,this.rotateWithView_=e.rotateWithView,this.keepUpright_=e.keepUpright,this.scale_=e.scale,this.scaleArray_=Nc(e.scale===void 0?1:e.scale),this.text_=e.text,this.textAlign_=e.textAlign,this.justify_=e.justify,this.repeat_=e.repeat,this.textBaseline_=e.textBaseline,this.fill_=e.fill===void 0?new mu({color:Cu}):e.fill,this.maxAngle_=e.maxAngle===void 0?Math.PI/4:e.maxAngle,this.placement_=e.placement===void 0?`point`:e.placement,this.overflow_=!!e.overflow,this.stroke_=e.stroke===void 0?null:e.stroke,this.offsetX_=e.offsetX===void 0?0:e.offsetX,this.offsetY_=e.offsetY===void 0?0:e.offsetY,this.backgroundFill_=e.backgroundFill?e.backgroundFill:null,this.backgroundStroke_=e.backgroundStroke?e.backgroundStroke:null,this.padding_=e.padding===void 0?null:e.padding,this.declutterMode_=e.declutterMode}clone(){let t=this.getScale();return new e({font:this.getFont(),placement:this.getPlacement(),repeat:this.getRepeat(),maxAngle:this.getMaxAngle(),overflow:this.getOverflow(),rotation:this.getRotation(),rotateWithView:this.getRotateWithView(),keepUpright:this.getKeepUpright(),scale:Array.isArray(t)?t.slice():t,text:this.getText(),textAlign:this.getTextAlign(),justify:this.getJustify(),textBaseline:this.getTextBaseline(),fill:this.getFill()instanceof mu?this.getFill().clone():this.getFill(),stroke:this.getStroke()?this.getStroke().clone():void 0,offsetX:this.getOffsetX(),offsetY:this.getOffsetY(),backgroundFill:this.getBackgroundFill()?this.getBackgroundFill().clone():void 0,backgroundStroke:this.getBackgroundStroke()?this.getBackgroundStroke().clone():void 0,padding:this.getPadding()||void 0,declutterMode:this.getDeclutterMode()})}getOverflow(){return this.overflow_}getFont(){return this.font_}getMaxAngle(){return this.maxAngle_}getPlacement(){return this.placement_}getRepeat(){return this.repeat_}getOffsetX(){return this.offsetX_}getOffsetY(){return this.offsetY_}getFill(){return this.fill_}getRotateWithView(){return this.rotateWithView_}getKeepUpright(){return this.keepUpright_}getRotation(){return this.rotation_}getScale(){return this.scale_}getScaleArray(){return this.scaleArray_}getStroke(){return this.stroke_}getText(){return this.text_}getTextAlign(){return this.textAlign_}getJustify(){return this.justify_}getTextBaseline(){return this.textBaseline_}getBackgroundFill(){return this.backgroundFill_}getBackgroundStroke(){return this.backgroundStroke_}getPadding(){return this.padding_}getDeclutterMode(){return this.declutterMode_}setOverflow(e){this.overflow_=e}setFont(e){this.font_=e}setMaxAngle(e){this.maxAngle_=e}setOffsetX(e){this.offsetX_=e}setOffsetY(e){this.offsetY_=e}setPlacement(e){this.placement_=e}setRepeat(e){this.repeat_=e}setRotateWithView(e){this.rotateWithView_=e}setKeepUpright(e){this.keepUpright_=e}setFill(e){this.fill_=e}setRotation(e){this.rotation_=e}setScale(e){this.scale_=e,this.scaleArray_=Nc(e===void 0?1:e)}setStroke(e){this.stroke_=e}setText(e){this.text_=e}setTextAlign(e){this.textAlign_=e}setJustify(e){this.justify_=e}setTextBaseline(e){this.textBaseline_=e}setBackgroundFill(e){this.backgroundFill_=e}setBackgroundStroke(e){this.backgroundStroke_=e}setPadding(e){this.padding_=e}};function Tu(e){return!0}function Eu(e,t){t??=Xc();let n=ku(e,t),r=_l();return function(e,i){if(r.properties=e.getPropertiesInternal(),r.resolution=i,t.featureId){let t=e.getId();t===void 0?r.featureId=null:r.featureId=t}return t.geometryType&&(r.geometryType=gl(e.getGeometry())),n(r)}}function Du(e,t){t??=Xc();let n=e.length,r=Array(n);for(let i=0;i<n;++i)r[i]=Au(e[i],t);let i=_l(),a=Array(n);return function(e,o){if(i.properties=e.getPropertiesInternal(),i.resolution=o,t.featureId){let t=e.getId();t===void 0?i.featureId=null:i.featureId=t}t.geometryType&&(i.geometryType=gl(e.getGeometry()));let s=0;for(let e=0;e<n;++e){let t=r[e](i);t&&(a[s]=t,s+=1)}return a.length=s,a}}function Ou(e,t){if(t??=Xc(),!Array.isArray(e))return Du([e],t);let n=e.length;if(`style`in e[0]){let r=Array(n);for(let t=0;t<n;++t){let n=e[t];if(!(`style`in n))throw Error(`Expected a list of rules with a style property`);r[t]=n}return Eu(r,t)}return Du(e,t)}function ku(e,t){let n=e.length,r=Array(n);for(let i=0;i<n;++i){let n=e[i],a=`filter`in n?vl(n.filter,Fc,t):Tu,o;if(Array.isArray(n.style)){let e=n.style.length;o=Array(e);for(let r=0;r<e;++r)o[r]=Au(n.style[r],t)}else o=[Au(n.style,t)];r[i]={filter:a,styles:o}}return function(t){let i=[],a=!1;for(let o=0;o<n;++o){let n=r[o].filter;if(n(t)&&!(e[o].else&&a)){a=!0;for(let e of r[o].styles){let n=e(t);n&&i.push(n)}}}return i}}function Au(e,t){let n=ju(e,``,t),r=Mu(e,``,t),i=Nu(e,t),a=Pu(e,t),o=zu(e,`z-index`,t);if(!n&&!r&&!i&&!a&&!nt(e))throw Error(`No fill, stroke, point, or text symbolizer properties in style: `+JSON.stringify(e));let s=new vu;return function(e){let t=!0;if(n){let r=n(e);r&&(t=!1),s.setFill(r)}if(r){let n=r(e);n&&(t=!1),s.setStroke(n)}if(i){let n=i(e);n&&(t=!1),s.setText(n)}if(a){let n=a(e);n&&(t=!1),s.setImage(n)}return o&&s.setZIndex(o(e)),t?null:s}}function ju(e,t,n){let r;if(t+`fill-pattern-src`in e)r=Vu(e,t+`fill-`,n);else{if(e[t+`fill-color`]===`none`)return e=>null;r=Uu(e,t+`fill-color`,n)}if(!r)return null;let i=new mu;return function(e){let t=r(e);return t===sc?null:(i.setColor(t),i)}}function Mu(e,t,n){let r=zu(e,t+`stroke-width`,n),i=Uu(e,t+`stroke-color`,n);if(!r&&!i)return null;let a=Bu(e,t+`stroke-line-cap`,n),o=Bu(e,t+`stroke-line-join`,n),s=Wu(e,t+`stroke-line-dash`,n),c=zu(e,t+`stroke-line-dash-offset`,n),l=zu(e,t+`stroke-miter-limit`,n),u=zu(e,t+`stroke-offset`,n),d=new _u;return function(e){if(i){let t=i(e);if(t===sc)return null;d.setColor(t)}if(r&&d.setWidth(r(e)),a){let t=a(e);if(t!==`butt`&&t!==`round`&&t!==`square`)throw Error(`Expected butt, round, or square line cap`);d.setLineCap(t)}if(o){let t=o(e);if(t!==`bevel`&&t!==`round`&&t!==`miter`)throw Error(`Expected bevel, round, or miter line join`);d.setLineJoin(t)}return s&&d.setLineDash(s(e)),c&&d.setLineDashOffset(c(e)),l&&d.setMiterLimit(l(e)),u&&d.setOffset(u(e)),d}}function Nu(e,t){let n=`text-`,r=Bu(e,`text-value`,t);if(!r)return null;let i=ju(e,n,t),a=ju(e,`text-background-`,t),o=Mu(e,n,t),s=Mu(e,`text-background-`,t),c=Bu(e,`text-font`,t),l=zu(e,`text-max-angle`,t),u=zu(e,`text-offset-x`,t),d=zu(e,`text-offset-y`,t),f=Hu(e,`text-overflow`,t),p=Bu(e,`text-placement`,t),m=zu(e,`text-repeat`,t),h=qu(e,`text-scale`,t),g=Hu(e,`text-rotate-with-view`,t),_=zu(e,`text-rotation`,t),v=Bu(e,`text-align`,t),y=Bu(e,`text-justify`,t),b=Bu(e,`text-baseline`,t),x=Hu(e,`text-keep-upright`,t),S=Wu(e,`text-padding`,t),C=new wu({declutterMode:ed(e,`text-declutter-mode`)});return function(e){if(C.setText(r(e)),i&&C.setFill(i(e)),a&&C.setBackgroundFill(a(e)),o&&C.setStroke(o(e)),s&&C.setBackgroundStroke(s(e)),c&&C.setFont(c(e)),l&&C.setMaxAngle(l(e)),u&&C.setOffsetX(u(e)),d&&C.setOffsetY(d(e)),f&&C.setOverflow(f(e)),p){let t=p(e);if(t!==`point`&&t!==`line`)throw Error(`Expected point or line for text-placement`);C.setPlacement(t)}if(m&&C.setRepeat(m(e)),h&&C.setScale(h(e)),g&&C.setRotateWithView(g(e)),_&&C.setRotation(_(e)),v){let t=v(e);if(t!==`left`&&t!==`center`&&t!==`right`&&t!==`end`&&t!==`start`)throw Error(`Expected left, right, center, start, or end for text-align`);C.setTextAlign(t)}if(y){let t=y(e);if(t!==`left`&&t!==`right`&&t!==`center`)throw Error(`Expected left, right, or center for text-justify`);C.setJustify(t)}if(b){let t=b(e);if(t!==`bottom`&&t!==`top`&&t!==`middle`&&t!==`alphabetic`&&t!==`hanging`)throw Error(`Expected bottom, top, middle, alphabetic, or hanging for text-baseline`);C.setTextBaseline(t)}return S&&C.setPadding(S(e)),x&&C.setKeepUpright(x(e)),C}}function Pu(e,t){return`icon-src`in e?Fu(e,t):`shape-points`in e?Iu(e,t):`circle-radius`in e?Lu(e,t):null}function Fu(e,t){let n=`icon-src`,r=nd(e[n],n),i=Gu(e,`icon-anchor`,t),a=qu(e,`icon-scale`,t),o=zu(e,`icon-opacity`,t),s=Gu(e,`icon-displacement`,t),c=zu(e,`icon-rotation`,t),l=Hu(e,`icon-rotate-with-view`,t),u=Zu(e,`icon-anchor-origin`),d=Qu(e,`icon-anchor-x-units`),f=Qu(e,`icon-anchor-y-units`),p=Ru(e,`icon-color`),m,h=null;p!==void 0&&(Array.isArray(p)&&p.length>0&&typeof p[0]==`string`?h=Uu(e,`icon-color`,t):m=id(p,`icon-color`));let g=Xu(e,`icon-cross-origin`),_=$u(e,`icon-offset`),v=Zu(e,`icon-offset-origin`),y=Ju(e,`icon-width`),b={src:r,anchorOrigin:u,anchorXUnits:d,anchorYUnits:f,crossOrigin:g,offset:_,offsetOrigin:v,height:Ju(e,`icon-height`),width:y,size:Yu(e,`icon-size`),declutterMode:ed(e,`icon-declutter-mode`)},x=null;return function(e){if(x)h&&x.setColor(h(e));else{let t=h?h(e):m;x=new gu(t===void 0?Object.assign({},b):Object.assign({},b,{color:t}))}return o&&x.setOpacity(o(e)),s&&x.setDisplacement(s(e)),c&&x.setRotation(c(e)),l&&x.setRotateWithView(l(e)),a&&x.setScale(a(e)),i&&x.setAnchor(i(e)),x}}function Iu(e,t){let n=`shape-`,r=`shape-points`,i=`shape-radius`,a=rd(e[r],r);if(!(i in e))throw Error(`Expected a number for ${i}`);let o=zu(e,i,t),s=typeof e[i]==`number`?e[i]:5,c=`shape-radius2`,l=zu(e,c,t),u=typeof e[c]==`number`?e[c]:void 0,d=ju(e,n,t),f=Mu(e,n,t),p=qu(e,`shape-scale`,t),m=Gu(e,`shape-displacement`,t),h=zu(e,`shape-rotation`,t),g=Hu(e,`shape-rotate-with-view`,t),_=new fu({points:a,radius:s,radius2:u,angle:Ju(e,`shape-angle`),declutterMode:ed(e,`shape-declutter-mode`)});return function(e){return o&&_.setRadius(o(e)),l&&_.setRadius2(l(e)),d&&_.setFill(d(e)),f&&_.setStroke(f(e)),m&&_.setDisplacement(m(e)),h&&_.setRotation(h(e)),g&&_.setRotateWithView(g(e)),p&&_.setScale(p(e)),_}}function Lu(e,t){let n=`circle-`,r=ju(e,n,t),i=Mu(e,n,t),a=zu(e,`circle-radius`,t),o=qu(e,`circle-scale`,t),s=Gu(e,`circle-displacement`,t),c=zu(e,`circle-rotation`,t),l=Hu(e,`circle-rotate-with-view`,t),u=new pu({radius:5,declutterMode:ed(e,`circle-declutter-mode`)});return function(e){return a&&u.setRadius(a(e)),r&&u.setFill(r(e)),i&&u.setStroke(i(e)),s&&u.setDisplacement(s(e)),c&&u.setRotation(c(e)),l&&u.setRotateWithView(l(e)),o&&u.setScale(o(e)),u}}function Ru(e,t){if(!(t in e))return;let n=e[t];return n===void 0?void 0:n}function zu(e,t,n){let r=Ru(e,t);if(r===void 0)return;let i=vl(r,H,n);return function(e){return rd(i(e),t)}}function Bu(e,t,n){let r=Ru(e,t);if(r===void 0)return null;let i=vl(r,Ic,n);return function(e){return nd(i(e),t)}}function Vu(e,t,n){let r=Bu(e,t+`pattern-src`,n),i=Ku(e,t+`pattern-offset`,n),a=Ku(e,t+`pattern-size`,n),o=Uu(e,t+`color`,n);return function(e){return{src:r(e),offset:i&&i(e),size:a&&a(e),color:o&&o(e)}}}function Hu(e,t,n){let r=Ru(e,t);if(r===void 0)return null;let i=vl(r,Fc,n);return function(e){let n=i(e);if(typeof n!=`boolean`)throw Error(`Expected a boolean for ${t}`);return n}}function Uu(e,t,n){let r=Ru(e,t);if(r===void 0)return null;let i=vl(r,Lc,n);return function(e){return id(i(e),t)}}function Wu(e,t,n){let r=Ru(e,t);if(r===void 0)return null;if(Array.isArray(r)&&(r.length===0||typeof r[0]!=`string`)){let e=r.map((e,r)=>{if(typeof e==`number`)return()=>e;let i=vl(e,H,n);return function(e){return rd(i(e),`${t}[${r}]`)}});return function(t){let n=Array(e.length);for(let r=0;r<e.length;++r)n[r]=e[r](t);return n}}let i=vl(r,Rc,n);return function(e){return td(i(e),t)}}function Gu(e,t,n){let r=Ru(e,t);if(r===void 0)return null;let i=vl(r,Rc,n);return function(e){let n=td(i(e),t);if(n.length!==2)throw Error(`Expected two numbers for ${t}`);return n}}function Ku(e,t,n){let r=Ru(e,t);if(r===void 0)return null;let i=vl(r,Rc,n);return function(e){return ad(i(e),t)}}function qu(e,t,n){let r=Ru(e,t);if(r===void 0)return null;let i=vl(r,Rc|H,n);return function(e){return od(i(e),t)}}function Ju(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`number`)throw Error(`Expected a number for ${t}`);return n}}function Yu(e,t){let n=e[t];if(n!==void 0){if(typeof n==`number`)return Nc(n);if(!Array.isArray(n)||n.length!==2||typeof n[0]!=`number`||typeof n[1]!=`number`)throw Error(`Expected a number or size array for ${t}`);return n}}function Xu(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);return n}}function Zu(e,t){let n=e[t];if(n!==void 0){if(n!==`bottom-left`&&n!==`bottom-right`&&n!==`top-left`&&n!==`top-right`)throw Error(`Expected bottom-left, bottom-right, top-left, or top-right for ${t}`);return n}}function Qu(e,t){let n=e[t];if(n!==void 0){if(n!==`pixels`&&n!==`fraction`)throw Error(`Expected pixels or fraction for ${t}`);return n}}function $u(e,t){let n=e[t];if(n!==void 0)return td(n,t)}function ed(e,t){let n=e[t];if(n!==void 0){if(typeof n!=`string`)throw Error(`Expected a string for ${t}`);if(n!==`declutter`&&n!==`obstacle`&&n!==`none`)throw Error(`Expected declutter, obstacle, or none for ${t}`);return n}}function td(e,t){if(!Array.isArray(e))throw Error(`Expected an array for ${t}`);let n=e.length;for(let r=0;r<n;++r)if(typeof e[r]!=`number`)throw Error(`Expected an array of numbers for ${t}`);return e}function nd(e,t){if(typeof e!=`string`)throw Error(`Expected a string for ${t}`);return e}function rd(e,t){if(typeof e!=`number`)throw Error(`Expected a number for ${t}`);return e}function id(e,t){if(typeof e==`string`)return e;let n=td(e,t),r=n.length;if(r<3||r>4)throw Error(`Expected a color with 3 or 4 values for ${t}`);return n}function ad(e,t){let n=td(e,t);if(n.length!==2)throw Error(`Expected an array of two numbers for ${t}`);return n}function od(e,t){return typeof e==`number`?e:ad(e,t)}var sd={RENDER_ORDER:`renderOrder`},cd=class extends Vs{constructor(e){e||={};let t=Object.assign({},e);delete t.style,delete t.renderBuffer,delete t.updateWhileAnimating,delete t.updateWhileInteracting,super(t),this.declutter_=e.declutter?String(e.declutter):void 0,this.renderBuffer_=e.renderBuffer===void 0?100:e.renderBuffer,this.style_=null,this.styleFunction_=void 0,this.setStyle(e.style),this.updateWhileAnimating_=e.updateWhileAnimating!==void 0&&e.updateWhileAnimating,this.updateWhileInteracting_=e.updateWhileInteracting!==void 0&&e.updateWhileInteracting}getDeclutter(){return this.declutter_}getFeatures(e){return super.getFeatures(e)}getRenderBuffer(){return this.renderBuffer_}getRenderOrder(){return this.get(sd.RENDER_ORDER)}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}getUpdateWhileAnimating(){return this.updateWhileAnimating_}getUpdateWhileInteracting(){return this.updateWhileInteracting_}renderDeclutter(e,t){let n=this.getDeclutter();n in e.declutter||(e.declutter[n]=new Ks(9)),this.getRenderer().renderDeclutter(e,t)}setRenderOrder(e){this.set(sd.RENDER_ORDER,e)}setStyle(e){this.style_=e===void 0?xu:e;let t=ld(e);this.styleFunction_=e===null?void 0:yu(t),this.changed()}setDeclutter(e){this.declutter_=e?String(e):void 0,this.changed()}};function ld(e){if(e===void 0)return xu;if(!e)return null;if(typeof e==`function`||e instanceof vu)return e;if(Array.isArray(e)&&e.length===0)return[];if(Array.isArray(e)&&e[0]instanceof vu){let t=e.length,n=Array(t);for(let r=0;r<t;++r){let t=e[r];if(!(t instanceof vu))throw Error(`Expected a list of style instances`);n[r]=t}return n}return Ou(e)}var ud=class extends yt{constructor(e,t,n,r){super(e),this.inversePixelTransform=t,this.frameState=n,this.context=r}},dd=class extends at{constructor(e){super(),this.map_=e}dispatchRenderEvent(e,t){F()}calculateMatrices2D(e){let t=e.viewState,n=e.coordinateToPixelTransform,r=e.pixelToCoordinateTransform;$i(n,e.size[0]/2,e.size[1]/2,1/t.resolution,-1/t.resolution,-t.rotation,-t.center[0],-t.center[1]),ea(r,n)}forEachFeatureAtCoordinate(e,t,n,r,i,a,o,s){let c,l=t.viewState;function u(e,t,n,r){return i.call(a,t,e?n:null,r)}let d=l.projection,f=ir(e.slice(),d),p=[[0,0]];if(d.canWrapX()&&r){let e=z(d.getExtent());p.push([-e,0],[e,0])}let m=t.layerStatesArray,h=m.length,g=[],_=[];for(let r=0;r<p.length;r++)for(let i=h-1;i>=0;--i){let a=m[i],d=a.layer;if(d.hasRenderer()&&Hs(a,l)&&o.call(s,d)){let i=d.getRenderer(),o=d.getSource();if(i&&o){let s=o.getWrapX()?f:e,l=u.bind(null,a.managed);_[0]=s[0]+p[r][0],_[1]=s[1]+p[r][1],c=i.forEachFeatureAtCoordinate(_,t,n,l,g)}if(c)return c}}if(g.length===0)return;let v=1/g.length;return g.forEach((e,t)=>e.distanceSq+=t*v),g.sort((e,t)=>e.distanceSq-t.distanceSq),g.some(e=>c=e.callback(e.feature,e.layer,e.geometry)),c}hasFeatureAtCoordinate(e,t,n,r,i,a){return this.forEachFeatureAtCoordinate(e,t,n,r,mt,this,i,a)!==void 0}getMap(){return this.map_}renderFrame(e){F()}scheduleExpireIconCache(e){Il.canExpireCache()&&e.postRenderFunctions.push(fd)}};function fd(e,t){Il.expire()}var pd=class extends dd{constructor(e){super(e),this.fontChangeListenerKey_=N(Zl,et.PROPERTYCHANGE,e.redrawText,e),this.element_=It?Go():document.createElement(`div`);let t=this.element_.style;t.position=`absolute`,t.width=`100%`,t.height=`100%`,t.zIndex=`0`,this.element_.className=ko+` ol-layers`;let n=e.getViewport();n&&n.insertBefore(this.element_,n.firstChild||null),this.children_=[],this.renderedVisible_=!0}dispatchRenderEvent(e,t){let n=this.getMap();if(n.hasListener(e)){let r=new ud(e,void 0,t);n.dispatchEvent(r)}}disposeInternal(){it(this.fontChangeListenerKey_),this.element_.remove(),super.disposeInternal()}renderFrame(e){if(!e){this.renderedVisible_&&=(this.element_.style.display=`none`,!1);return}this.calculateMatrices2D(e),this.dispatchRenderEvent(Bs.PRECOMPOSE,e);let t=e.layerStatesArray.sort((e,t)=>e.zIndex-t.zIndex);t.some(e=>e.layer instanceof cd&&e.layer.getDeclutter())&&(e.declutter={});let n=e.viewState;this.children_.length=0;let r=this.getMap().getTargetElement(),i;Ko(r)&&(i=r.getContext(`2d`),i.setTransform(1,0,0,1,0,0),i.clearRect(0,0,r.width,r.height));let a=[],o=i?r:null;for(let r=0,i=t.length;r<i;++r){let i=t[r];e.layerIndex=r;let s=i.layer,c=s.getSourceState();if(!Hs(i,n)||c!=`ready`&&c!=`undefined`){s.unrender();continue}let l=s.render(e,o);l&&(l!==o&&(this.children_.push(l),o=l),a.push(i))}this.declutter(e,a),Wo(this.element_,this.children_);for(let e of i?this.children_:[]){let t=e.firstElementChild||e,n=e.style.backgroundColor;if(n&&(!Ko(t)||t.width>0)&&(i.fillStyle=n,i.fillRect(0,0,i.canvas.width,i.canvas.height)),!Ko(t)||t.width===0)continue;i.save();let r=e.style.opacity||t.style.opacity;i.globalAlpha=r===``?1:Number(r);let a=t.style.transform;if(a)i.transform(...ia(a));else{let e=parseFloat(t.style.width)/t.width,n=parseFloat(t.style.height)/t.height;i.transform(e,0,0,n,0,0)}i.drawImage(t,0,0),i.restore()}this.dispatchRenderEvent(Bs.POSTCOMPOSE,e),this.renderedVisible_||=(this.element_.style.display=``,!0),this.scheduleExpireIconCache(e)}declutter(e,t){if(e.declutter){for(let n=t.length-1;n>=0;--n){let r=t[n],i=r.layer;i.getDeclutter()&&i.renderDeclutter(e,r)}t.forEach(t=>t.layer.renderDeferred(e))}}};function md(e){if(e instanceof Vs){e.setMapInternal(null);return}e instanceof zs&&e.getLayers().forEach(md)}function hd(e,t){if(e instanceof Vs){e.setMapInternal(t);return}if(e instanceof zs){let n=e.getLayers().getArray();for(let e=0,r=n.length;e<r;++e)hd(n[e],t)}}var gd=class extends Tt{constructor(e){super(),e||={},this.on,this.once,this.un;let t=_d(e);this.renderComplete_=!1,this.loaded_=!0,this.boundHandleBrowserEvent_=this.handleBrowserEvent.bind(this),this.maxTilesLoading_=e.maxTilesLoading===void 0?16:e.maxTilesLoading,this.pixelRatio_=e.pixelRatio===void 0?Ft:e.pixelRatio,this.postRenderTimeoutHandle_,this.animationDelayKey_,this.animationDelay_=this.animationDelay_.bind(this),this.coordinateToPixelTransform_=Gi(),this.pixelToCoordinateTransform_=Gi(),this.frameIndex_=0,this.frameState_=null,this.previousExtent_=null,this.viewPropertyListenerKey_=null,this.viewChangeListenerKey_=null,this.layerGroupPropertyListenerKeys_=null,It||(this.viewport_=document.createElement(`div`),this.viewport_.className=`ol-viewport`+(`ontouchstart`in window?` ol-touch`:``),this.viewport_.style.position=`relative`,this.viewport_.style.overflow=`hidden`,this.viewport_.style.width=`100%`,this.viewport_.style.height=`100%`,this.overlayContainer_=document.createElement(`div`),this.overlayContainer_.style.position=`absolute`,this.overlayContainer_.style.zIndex=`0`,this.overlayContainer_.style.width=`100%`,this.overlayContainer_.style.height=`100%`,this.overlayContainer_.style.pointerEvents=`none`,this.overlayContainer_.className=`ol-overlaycontainer`,this.viewport_.appendChild(this.overlayContainer_),this.overlayContainerStopEvent_=document.createElement(`div`),this.overlayContainerStopEvent_.style.position=`absolute`,this.overlayContainerStopEvent_.style.zIndex=`0`,this.overlayContainerStopEvent_.style.width=`100%`,this.overlayContainerStopEvent_.style.height=`100%`,this.overlayContainerStopEvent_.style.pointerEvents=`none`,this.overlayContainerStopEvent_.className=`ol-overlaycontainer-stopevent`,this.viewport_.appendChild(this.overlayContainerStopEvent_)),this.mapBrowserEventHandler_=null,this.moveTolerance_=e.moveTolerance,this.keyboardEventTarget_=t.keyboardEventTarget,this.targetChangeHandlerKeys_=null,this.targetElement_=null,It||(this.resizeObserver_=new ResizeObserver(()=>this.updateSize())),this.controls=t.controls||(It?new Ot:Zo()),this.interactions=t.interactions||(It?new Ot:Ps({onFocusOnly:!0})),this.overlays_=t.overlays,this.overlayIdIndex_={},this.renderer_=null,this.postRenderFunctions_=[],this.tileQueue_=new Gt(this.getTilePriority.bind(this),this.handleTileChange_.bind(this)),this.addChangeListener(Ht.LAYERGROUP,this.handleLayerGroupChanged_),this.addChangeListener(Ht.VIEW,this.handleViewChanged_),this.addChangeListener(Ht.SIZE,this.handleSizeChanged_),this.addChangeListener(Ht.TARGET,this.handleTargetChanged_),this.setProperties(t.values);let n=this;e.view&&!(e.view instanceof bo)&&e.view.then(function(e){n.setView(new bo(e))}),this.controls.addEventListener($e.ADD,e=>{e.element.setMap(this)}),this.controls.addEventListener($e.REMOVE,e=>{e.element.setMap(null)}),this.interactions.addEventListener($e.ADD,e=>{e.element.setMap(this)}),this.interactions.addEventListener($e.REMOVE,e=>{e.element.setMap(null)}),this.overlays_.addEventListener($e.ADD,e=>{this.addOverlayInternal_(e.element)}),this.overlays_.addEventListener($e.REMOVE,e=>{let t=e.element.getId();t!==void 0&&delete this.overlayIdIndex_[t.toString()],e.element.setMap(null)}),this.controls.forEach(e=>{e.setMap(this)}),this.interactions.forEach(e=>{e.setMap(this)}),this.overlays_.forEach(this.addOverlayInternal_.bind(this))}addControl(e){this.getControls().push(e)}addInteraction(e){this.getInteractions().push(e)}addLayer(e){this.getLayerGroup().getLayers().push(e)}handleLayerAdd_(e){hd(e.layer,this)}addOverlay(e){this.getOverlays().push(e)}addOverlayInternal_(e){let t=e.getId();t!==void 0&&(this.overlayIdIndex_[t.toString()]=e),e.setMap(this)}disposeInternal(){this.controls.clear(),this.interactions.clear(),this.overlays_.clear(),this.resizeObserver_?.disconnect(),this.setTarget(null),super.disposeInternal()}forEachFeatureAtPixel(e,t,n){if(!this.frameState_||!this.renderer_)return;let r=this.getCoordinateFromPixelInternal(e);n=n===void 0?{}:n;let i=n.hitTolerance===void 0?0:n.hitTolerance,a=n.layerFilter===void 0?mt:n.layerFilter,o=n.checkWrapped!==!1;return this.renderer_.forEachFeatureAtCoordinate(r,this.frameState_,i,o,t,null,a,null)}getFeaturesAtPixel(e,t){let n=[];return this.forEachFeatureAtPixel(e,function(e){n.push(e)},t),n}getAllLayers(){let e=[];function t(n){n.forEach(function(n){n instanceof zs?t(n.getLayers()):e.push(n)})}return t(this.getLayers()),e}hasFeatureAtPixel(e,t){if(!this.frameState_||!this.renderer_)return!1;let n=this.getCoordinateFromPixelInternal(e);t=t===void 0?{}:t;let r=t.layerFilter===void 0?mt:t.layerFilter,i=t.hitTolerance===void 0?0:t.hitTolerance,a=t.checkWrapped!==!1;return this.renderer_.hasFeatureAtCoordinate(n,this.frameState_,i,a,r,null)}getEventCoordinate(e){return this.getCoordinateFromPixel(this.getEventPixel(e))}getEventCoordinateInternal(e){return this.getCoordinateFromPixelInternal(this.getEventPixel(e))}getEventPixel(e){let t=this.viewport_.getBoundingClientRect(),n=this.getSize(),r=t.width/n[0],i=t.height/n[1],a=`changedTouches`in e?e.changedTouches[0]:e;return[(a.clientX-t.left)/r,(a.clientY-t.top)/i]}getTarget(){return this.get(Ht.TARGET)}getTargetElement(){return this.targetElement_}getCoordinateFromPixel(e){return Li(this.getCoordinateFromPixelInternal(e),this.getView().getProjection())}getCoordinateFromPixelInternal(e){let t=this.frameState_;return t?Xi(t.pixelToCoordinateTransform,e.slice()):null}getControls(){return this.controls}getOverlays(){return this.overlays_}getOverlayById(e){let t=this.overlayIdIndex_[e.toString()];return t===void 0?null:t}getInteractions(){return this.interactions}getLayerGroup(){return this.get(Ht.LAYERGROUP)}setLayers(e){let t=this.getLayerGroup();if(e instanceof Ot){t.setLayers(e);return}let n=t.getLayers();n.clear(),n.extend(e)}getLayers(){return this.getLayerGroup().getLayers()}getLoadingOrNotReady(){let e=this.getLayerGroup().getLayerStatesArray();for(let t=0,n=e.length;t<n;++t){let n=e[t];if(!n.visible)continue;let r=n.layer.getRenderer();if(r&&!r.ready)return!0;let i=n.layer.getSource();if(i&&i.loading)return!0}return!1}getPixelFromCoordinate(e){let t=Ri(e,this.getView().getProjection());return this.getPixelFromCoordinateInternal(t)}getPixelFromCoordinateInternal(e){let t=this.frameState_;return t?Xi(t.coordinateToPixelTransform,e.slice(0,2)):null}getPixelRatio(){return this.pixelRatio_}setPixelRatio(e){this.pixelRatio_!==e&&(this.pixelRatio_=e,this.render())}getRenderer(){return this.renderer_}getSize(){return this.get(Ht.SIZE)}getView(){return this.get(Ht.VIEW)}getViewport(){return this.viewport_}getOverlayContainer(){return this.overlayContainer_}getOverlayContainerStopEvent(){return this.overlayContainerStopEvent_}getOwnerDocument(){let e=this.getTargetElement();return e?e.ownerDocument:document}getTilePriority(e,t,n,r){return Kt(this.frameState_,e,t,n,r)}handleBrowserEvent(e,t){t||=e.type;let n=new At(t,this,e);this.handleMapBrowserEvent(n)}handleMapBrowserEvent(e){if(!this.frameState_)return;let t=e.originalEvent,n=t.type;if(n===zt.POINTERDOWN||n===P.WHEEL||n===P.KEYDOWN){let e=this.getOwnerDocument(),n=this.viewport_.getRootNode?this.viewport_.getRootNode():e,r=t.target,i=n instanceof ShadowRoot?n.host===r?n.host.ownerDocument:n:n===e?e.documentElement:n;if(this.overlayContainerStopEvent_.contains(r)||!i.contains(r))return}if(e.frameState=this.frameState_,this.dispatchEvent(e)!==!1){let t=this.getInteractions().getArray().slice();for(let n=t.length-1;n>=0;n--){let r=t[n];if(r.getMap()===this&&r.getActive()&&this.getTargetElement()&&(!r.handleEvent(e)||e.propagationStopped))break}}}handlePostRender(){let e=this.frameState_,t=this.tileQueue_;if(!t.isEmpty()){let n=this.maxTilesLoading_,r=n,i=e?e.viewHints:void 0,a=i?i[qt.ANIMATING]||i[qt.INTERACTING]:!1;if(a){let t=Date.now()-e.time>8;n=t?0:8,r=t?0:2}t.getTilesLoading()<n&&(a&&t.reprioritize(),t.loadMoreTiles(n,r))}e&&this.renderer_&&!e.animate&&(this.renderComplete_?(this.hasListener(Bs.RENDERCOMPLETE)&&this.renderer_.dispatchRenderEvent(Bs.RENDERCOMPLETE,e),this.loaded_===!1&&(this.loaded_=!0,this.dispatchEvent(new kt(Vt.LOADEND,this,e)))):this.loaded_===!0&&(this.loaded_=!1,this.dispatchEvent(new kt(Vt.LOADSTART,this,e))));let n=this.postRenderFunctions_;if(e)for(let t=0,r=n.length;t<r;++t)n[t](this,e);n.length=0}handleSizeChanged_(){this.getView()&&!this.getView().getAnimating()&&this.getView().resolveConstraints(0),this.render()}handleTargetChanged_(){if(this.mapBrowserEventHandler_){for(let e=0,t=this.targetChangeHandlerKeys_.length;e<t;++e)it(this.targetChangeHandlerKeys_[e]);this.targetChangeHandlerKeys_=null,this.viewport_.removeEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_),this.viewport_.removeEventListener(P.WHEEL,this.boundHandleBrowserEvent_),this.mapBrowserEventHandler_.dispose(),this.mapBrowserEventHandler_=null,this.viewport_.remove()}if(this.targetElement_&&!Ko(this.targetElement_)){this.resizeObserver_?.unobserve(this.targetElement_);let e=this.targetElement_.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.unobserve(e.host),this.setSize(void 0)}let e=this.getTarget(),t=typeof e==`string`?document.getElementById(e):e;if(this.targetElement_=t,!t)this.renderer_&&=(clearTimeout(this.postRenderTimeoutHandle_),this.postRenderTimeoutHandle_=void 0,this.postRenderFunctions_.length=0,this.renderer_.dispose(),null),this.animationDelayKey_&&=(cancelAnimationFrame(this.animationDelayKey_),void 0);else{if(Ko(t)||t.appendChild(this.viewport_),this.renderer_||=new pd(this),!Ko(t)){this.mapBrowserEventHandler_=new Bt(this,this.moveTolerance_);for(let e in jt)this.mapBrowserEventHandler_.addEventListener(jt[e],this.handleMapBrowserEvent.bind(this));this.viewport_.addEventListener(P.CONTEXTMENU,this.boundHandleBrowserEvent_,!1),this.viewport_.addEventListener(P.WHEEL,this.boundHandleBrowserEvent_,Rt?{passive:!1}:!1);let e;if(this.keyboardEventTarget_)e=this.keyboardEventTarget_;else{let n=t.getRootNode();e=n instanceof ShadowRoot?n.host:t}if(this.targetChangeHandlerKeys_=[N(e,P.KEYDOWN,this.handleBrowserEvent,this),N(e,P.KEYPRESS,this.handleBrowserEvent,this)],!Ko(t)){let e=t.getRootNode();e instanceof ShadowRoot&&this.resizeObserver_.observe(e.host),this.resizeObserver_?.observe(t)}}this.updateSize()}}handleTileChange_(){this.render()}handleViewPropertyChanged_(){this.render()}handleViewChanged_(){this.viewPropertyListenerKey_&&=(it(this.viewPropertyListenerKey_),null),this.viewChangeListenerKey_&&=(it(this.viewChangeListenerKey_),null);let e=this.getView();e&&(this.updateViewportSize_(this.getSize()),this.viewPropertyListenerKey_=N(e,et.PROPERTYCHANGE,this.handleViewPropertyChanged_,this),this.viewChangeListenerKey_=N(e,P.CHANGE,this.handleViewPropertyChanged_,this),e.resolveConstraints(0)),this.render()}handleLayerGroupChanged_(){this.layerGroupPropertyListenerKeys_&&=(this.layerGroupPropertyListenerKeys_.forEach(it),null);let e=this.getLayerGroup();e&&(this.handleLayerAdd_(new Ls(`addlayer`,e)),this.layerGroupPropertyListenerKeys_=[N(e,et.PROPERTYCHANGE,this.render,this),N(e,P.CHANGE,this.render,this),N(e,`addlayer`,this.handleLayerAdd_,this),N(e,`removelayer`,this.handleLayerRemove_,this)]),this.render()}isRendered(){return!!this.frameState_}animationDelay_(){this.animationDelayKey_=void 0,this.renderFrame_(Date.now())}renderSync(){this.animationDelayKey_&&cancelAnimationFrame(this.animationDelayKey_),this.animationDelay_()}redrawText(){if(!this.frameState_)return;let e=this.frameState_.layerStatesArray;for(let t=0,n=e.length;t<n;++t){let n=e[t].layer;n.hasRenderer()&&n.getRenderer().handleFontsChanged()}}render(){this.renderer_&&this.animationDelayKey_===void 0&&(this.animationDelayKey_=requestAnimationFrame(this.animationDelay_))}removeControl(e){return this.getControls().remove(e)}removeInteraction(e){return this.getInteractions().remove(e)}removeLayer(e){return this.getLayerGroup().getLayers().remove(e)}handleLayerRemove_(e){md(e.layer)}removeOverlay(e){return this.getOverlays().remove(e)}renderFrame_(e){let t=this.getSize(),n=this.getView(),r=this.frameState_,i=null;if(t!==void 0&&jc(t)&&n&&n.isDef()){let r=n.getHints(this.frameState_?this.frameState_.viewHints:void 0),a=n.getState();if(i={animate:!1,coordinateToPixelTransform:this.coordinateToPixelTransform_,declutter:null,extent:In(a.center,a.resolution,a.rotation,t),index:this.frameIndex_++,layerIndex:0,layerStatesArray:this.getLayerGroup().getLayerStatesArray(),pixelRatio:this.pixelRatio_,pixelToCoordinateTransform:this.pixelToCoordinateTransform_,postRenderFunctions:[],size:t,tileQueue:this.tileQueue_,time:e,usedTiles:{},viewState:a,viewHints:r,wantedTiles:{},mapId:I(this),renderTargets:{}},a.nextCenter&&a.nextResolution){let e=isNaN(a.nextRotation)?a.rotation:a.nextRotation;i.nextExtent=In(a.nextCenter,a.nextResolution,e,t)}}this.frameState_=i,this.renderer_.renderFrame(i),i&&(i.animate&&this.render(),Array.prototype.push.apply(this.postRenderFunctions_,i.postRenderFunctions),r&&(!this.previousExtent_||!Wn(this.previousExtent_)&&!Tn(i.extent,this.previousExtent_))&&(this.dispatchEvent(new kt(Vt.MOVESTART,this,r)),this.previousExtent_=Sn(this.previousExtent_)),this.previousExtent_&&!i.viewHints[qt.ANIMATING]&&!i.viewHints[qt.INTERACTING]&&!Tn(i.extent,this.previousExtent_)&&(this.dispatchEvent(new kt(Vt.MOVEEND,this,i)),mn(i.extent,this.previousExtent_))),this.dispatchEvent(new kt(Vt.POSTRENDER,this,i)),this.renderComplete_=(this.hasListener(Vt.LOADSTART)||this.hasListener(Vt.LOADEND)||this.hasListener(Bs.RENDERCOMPLETE))&&!this.tileQueue_.getTilesLoading()&&!this.tileQueue_.getCount()&&!this.getLoadingOrNotReady(),this.postRenderTimeoutHandle_||=setTimeout(()=>{this.postRenderTimeoutHandle_=void 0,this.handlePostRender()},0)}setLayerGroup(e){let t=this.getLayerGroup();t&&this.handleLayerRemove_(new Ls(`removelayer`,t)),this.set(Ht.LAYERGROUP,e)}setSize(e){this.set(Ht.SIZE,e)}setTarget(e){this.set(Ht.TARGET,e)}setView(e){if(!e||e instanceof bo){this.set(Ht.VIEW,e);return}this.set(Ht.VIEW,new bo);let t=this;e.then(function(e){t.setView(new bo(e))})}updateSize(){let e=this.getTargetElement(),t;if(e){let n,r;if(Ko(e)){let t=e.getContext(`2d`).getTransform();n=e.width/t.a,r=e.height/t.d}else{let t=getComputedStyle(e);n=e.offsetWidth-parseFloat(t.borderLeftWidth)-parseFloat(t.paddingLeft)-parseFloat(t.paddingRight)-parseFloat(t.borderRightWidth),r=e.offsetHeight-parseFloat(t.borderTopWidth)-parseFloat(t.paddingTop)-parseFloat(t.paddingBottom)-parseFloat(t.borderBottomWidth)}!isNaN(n)&&!isNaN(r)&&(t=[Math.max(0,n),Math.max(0,r)],!jc(t)&&(e.offsetWidth||e.offsetHeight||e.getClientRects().length)&&mr(`No map visible because the map container's width or height are 0.`))}let n=this.getSize();t&&(!n||!ft(t,n))&&(this.updateViewportSize_(t),this.setSize(t))}updateViewportSize_(e){let t=this.getView();t&&t.setViewportSize(e)}};function _d(e){let t=null;e.keyboardEventTarget!==void 0&&(t=typeof e.keyboardEventTarget==`string`?document.getElementById(e.keyboardEventTarget):e.keyboardEventTarget);let n={},r=e.layers&&typeof e.layers.getLayers==`function`?e.layers:new zs({layers:e.layers});n[Ht.LAYERGROUP]=r,n[Ht.TARGET]=e.target,n[Ht.VIEW]=e.view instanceof bo?e.view:new bo;let i;e.controls!==void 0&&(Array.isArray(e.controls)?i=new Ot(e.controls.slice()):(R(typeof e.controls.getArray==`function`,"Expected `controls` to be an array or an `ol/Collection.js`"),i=e.controls));let a;e.interactions!==void 0&&(Array.isArray(e.interactions)?a=new Ot(e.interactions.slice()):(R(typeof e.interactions.getArray==`function`,"Expected `interactions` to be an array or an `ol/Collection.js`"),a=e.interactions));let o;return e.overlays===void 0?o=new Ot:Array.isArray(e.overlays)?o=new Ot(e.overlays.slice()):(R(typeof e.overlays.getArray==`function`,"Expected `overlays` to be an array or an `ol/Collection.js`"),o=e.overlays),{controls:i,interactions:a,keyboardEventTarget:t,overlays:o,values:n}}var vd=class e extends Tt{constructor(e){if(super(),this.on,this.once,this.un,this.id_=void 0,this.geometryName_=`geometry`,this.style_=null,this.styleFunction_=void 0,this.geometryChangeKey_=null,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),e){if(typeof e.getSimplifiedGeometry==`function`){let t=e;this.setGeometry(t)}else{let t=e;this.setProperties(t)}}}clone(){let t=new e,n=this.geometryName_;t.setGeometryName(n);let r=this.getPropertiesInternal();if(r){let e=this.getGeometry();for(let i in r)i===n&&e?t.set(i,e.clone()):t.set(i,r[i],!0)}let i=this.getStyle();return i&&t.setStyle(i),t}getGeometry(){return this.get(this.geometryName_)}getId(){return this.id_}getGeometryName(){return this.geometryName_}getStyle(){return this.style_}getStyleFunction(){return this.styleFunction_}handleGeometryChange_(){this.changed()}handleGeometryChanged_(){this.geometryChangeKey_&&=(it(this.geometryChangeKey_),null);let e=this.getGeometry();e&&(this.geometryChangeKey_=N(e,P.CHANGE,this.handleGeometryChange_,this)),this.changed()}setGeometry(e){this.set(this.geometryName_,e)}setStyle(e){this.style_=e,this.styleFunction_=e?yd(e):void 0,this.changed()}setId(e){this.id_=e,this.changed()}setGeometryName(e){e!==this.geometryName_&&(this.removeChangeListener(this.geometryName_,this.handleGeometryChanged_),this.geometryName_=e,this.addChangeListener(this.geometryName_,this.handleGeometryChanged_),this.handleGeometryChanged_())}};function yd(e){if(typeof e==`function`)return e;let t;return Array.isArray(e)?t=e:(R(typeof e.getZIndex==`function`,"Expected an `ol/style/Style` or an array of `ol/style/Style.js`"),t=[e]),function(){return t}}function bd(e,t,n,r,i,a,o){let s,c,l=(n-t)/r;if(l===1)s=t;else if(l===2)s=t,c=i;else if(l!==0){let a=e[t],o=e[t+1],l=0,u=[0];for(let i=t+r;i<n;i+=r){let t=e[i],n=e[i+1];l+=Math.sqrt((t-a)*(t-a)+(n-o)*(n-o)),u.push(l),a=t,o=n}let d=i*l,f=ot(u,d);f<0?(c=(d-u[-f-2])/(u[-f-1]-u[-f-2]),s=t+(-f-2)*r):s=t+f*r}o=o>1?o:2,a||=Array(o);for(let t=0;t<o;++t)a[t]=s===void 0?NaN:c===void 0?e[s+t]:nn(e[s+t],e[s+r+t],c);return a}function xd(e,t,n,r,i,a){if(n==t)return null;let o;if(i<e[t+r-1])return a?(o=e.slice(t,t+r),o[r-1]=i,o):null;if(e[n-1]<i)return a?(o=e.slice(n-r,n),o[r-1]=i,o):null;if(i==e[t+r-1])return e.slice(t,t+r);let s=t/r,c=n/r;for(;s<c;){let t=s+c>>1;i<e[(t+1)*r-1]?c=t:s=t+1}let l=e[s*r-1];if(i==l)return e.slice((s-1)*r,(s-1)*r+r);let u=e[(s+1)*r-1],d=(i-l)/(u-l);o=[];for(let t=0;t<r-1;++t)o.push(nn(e[(s-1)*r+t],e[s*r+t],d));return o.push(i),o}function Sd(e,t,n,r,i,a,o){if(o)return xd(e,t,n[n.length-1],r,i,a);let s;if(i<e[r-1])return a?(s=e.slice(0,r),s[r-1]=i,s):null;if(e[e.length-1]<i)return a?(s=e.slice(e.length-r),s[r-1]=i,s):null;for(let a=0,o=n.length;a<o;++a){let o=n[a];if(t!=o){if(i<e[t+r-1])return null;if(i<=e[o-1])return xd(e,t,o,r,i,!1);t=o}}return null}function Cd(e,t,n,r){let i=e[t],a=e[t+1],o=0;for(let s=t+r;s<n;s+=r){let t=e[s],n=e[s+1];o+=Math.sqrt((t-i)*(t-i)+(n-a)*(n-a)),i=t,a=n}return o}var wd=class e extends pa{constructor(e,t){super(),this.flatMidpoint_=null,this.flatMidpointRevision_=-1,this.maxDelta_=-1,this.maxDeltaRevision_=-1,t!==void 0&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendCoordinate(e){dt(this.flatCoordinates,e),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<hn(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(xa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),wa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,this.maxDelta_,!1,e,t,n,r))}forEachSegment(e){return Ra(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e)}getCoordinateAtM(e,t){return this.layout!=`XYM`&&this.layout!=`XYZM`?null:(t=t!==void 0&&t,xd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t))}getCoordinates(){return ja(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getCoordinateAt(e,t){return bd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,t,this.stride)}getLength(){return Cd(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getFlatMidpoint(){return this.flatMidpointRevision_!=this.getRevision()&&(this.flatMidpoint_=this.getCoordinateAt(.5,this.flatMidpoint_??void 0),this.flatMidpointRevision_=this.getRevision()),this.flatMidpoint_}getSimplifiedGeometryInternal(t){let n=[];return n.length=Wa(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,t,n,0),new e(n,`XY`)}getType(){return`LineString`}intersectsExtent(e){return za(this.flatCoordinates,0,this.flatCoordinates.length,this.stride,e,this.getExtent())}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Oa(this.flatCoordinates,0,e,this.stride),this.changed()}};function Td(e,t,n,r,i,a,o,s){o??=[],s??=r;let c=e[t+r],l=e[t+r+1],u=e[n-2*r],d=e[n-2*r+1],f,p,m,h,g,_,v,y,b=0;for(let x=t;x<n;x+=r){m=f,h=p,g=void 0,_=void 0,x+r<n&&(g=e[x+r],_=e[x+r+1]),a&&x===t&&(m=u,h=d),a&&x===n-r&&(g=c,_=l),f=e[x],p=e[x+1],[v,y]=Ed(f,p,m,h,g,_,i),o[b++]=v,o[b++]=y;for(let t=2;t<s;t++)o[b++]=e[x+t]}return o.length!=b&&(o.length=b),o}function Ed(e,t,n,r,i,a,o){let s,c;n!==void 0&&r!==void 0?(s=e-n,c=t-r):i!==void 0&&a!==void 0?(s=i-e,c=a-t):(s=1,c=0);let l=Math.hypot(s,c),u=s/l,d=c/l;if(s=-d,c=u,n===void 0||r===void 0||i===void 0||a===void 0)return[e+s*o,t+c*o];let f=or([e,t],[n,r],[i,a]);if(Math.cos(f)>.998)return[e+u*o,t+d*o];let p=Math.cos(f/2),m=Math.sin(f/2),h=m*s+p*c,g=-p*s+m*c,_=1/m*h,v=1/m*g;return[e+_*o,t+v*o]}function Dd(e,t,n=!1){for(let r=0,i=e.length-2;r<i;r+=t){let i=n&&r===0?e.length-3*t:e.length-2*t;for(let n=i;n>r+t;n-=t){let i=e[r],a=e[r+1],o=e[r+t],s=e[r+t+1],c=e[n],l=e[n+1],u=e[n+t],d=e[n+t+1],f=(d-l)*(o-i)-(u-c)*(s-a);if(f===0)continue;let p=((u-c)*(a-l)-(d-l)*(i-c))/f,m=((o-i)*(a-l)-(s-a)*(i-c))/f;if(p>0&&p<1&&m>0&&m<1){let c=i+p*(o-i),l=a+p*(s-a);e[r+t]=c,e[r+t+1]=l,e.splice(r+2*t,n-r-t);break}}}return e}var Od=class{drawCustom(e,t,n,r,i){}drawGeometry(e){}setStyle(e){}drawCircle(e,t,n){}drawFeature(e,t,n){}drawGeometryCollection(e,t,n){}drawLineString(e,t,n){}drawMultiLineString(e,t,n){}drawMultiPoint(e,t,n){}drawMultiPolygon(e,t,n){}drawPoint(e,t,n){}drawPolygon(e,t,n){}drawText(e,t,n){}setFillStrokeStyle(e,t){}setImageStyle(e,t){}setTextStyle(e,t){}},kd=class extends Od{constructor(e,t,n,r,i,a,o){super(),this.context_=e,this.pixelRatio_=t,this.extent_=n,this.transform_=r,this.transformRotation_=r?rn(Math.atan2(r[1],r[0]),10):0,this.viewRotation_=i,this.squaredTolerance_=a,this.userTransform_=o,this.contextFillState_=null,this.contextStrokeState_=null,this.contextTextState_=null,this.fillState_=null,this.strokeState_=null,this.image_=null,this.imageAnchorX_=0,this.imageAnchorY_=0,this.imageHeight_=0,this.imageOpacity_=0,this.imageOriginX_=0,this.imageOriginY_=0,this.imageRotateWithView_=!1,this.imageRotation_=0,this.imageScale_=[0,0],this.imageWidth_=0,this.text_=``,this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=!1,this.textRotation_=0,this.textScale_=[0,0],this.textFillState_=null,this.textStrokeState_=null,this.textState_=null,this.pixelCoordinates_=[],this.tmpLocalTransform_=Gi()}drawImages_(e,t,n,r){if(!this.image_)return;let i=oa(e,t,n,r,this.transform_,this.pixelCoordinates_),a=this.context_,o=this.tmpLocalTransform_,s=a.globalAlpha;this.imageOpacity_!=1&&(a.globalAlpha=s*this.imageOpacity_);let c=this.imageRotation_;this.transformRotation_===0&&(c-=this.viewRotation_),this.imageRotateWithView_&&(c+=this.viewRotation_);for(let e=0,t=i.length;e<t;e+=2){let t=i[e]-this.imageAnchorX_,n=i[e+1]-this.imageAnchorY_;if(c!==0||this.imageScale_[0]!=1||this.imageScale_[1]!=1){let e=t+this.imageAnchorX_,r=n+this.imageAnchorY_;$i(o,e,r,1,1,c,-e,-r),a.save(),a.transform.apply(a,o),a.translate(e,r),a.scale(this.imageScale_[0],this.imageScale_[1]),a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,-this.imageAnchorX_,-this.imageAnchorY_,this.imageWidth_,this.imageHeight_),a.restore()}else a.drawImage(this.image_,this.imageOriginX_,this.imageOriginY_,this.imageWidth_,this.imageHeight_,t,n,this.imageWidth_,this.imageHeight_)}this.imageOpacity_!=1&&(a.globalAlpha=s)}drawText_(e,t,n,r){if(!this.textState_||this.text_===``)return;this.textFillState_&&this.setContextFillState_(this.textFillState_),this.textStrokeState_&&this.setContextStrokeState_(this.textStrokeState_),this.setContextTextState_(this.textState_);let i=oa(e,t,n,r,this.transform_,this.pixelCoordinates_),a=this.context_,o=this.textRotation_;for(this.transformRotation_===0&&(o-=this.viewRotation_),this.textRotateWithView_&&(o+=this.viewRotation_);t<n;t+=r){let e=i[t]+this.textOffsetX_,n=i[t+1]+this.textOffsetY_;o!==0||this.textScale_[0]!=1||this.textScale_[1]!=1?(a.save(),a.translate(e-this.textOffsetX_,n-this.textOffsetY_),a.rotate(o),a.translate(this.textOffsetX_,this.textOffsetY_),a.scale(this.textScale_[0],this.textScale_[1]),this.textStrokeState_&&a.strokeText(this.text_,0,0),this.textFillState_&&a.fillText(this.text_,0,0),a.restore()):(this.textStrokeState_&&a.strokeText(this.text_,e,n),this.textFillState_&&a.fillText(this.text_,e,n))}}moveToLineTo_(e,t,n,r,i,a){let o=this.context_,s=oa(e,t,n,r,this.transform_,this.pixelCoordinates_);if(Math.abs(a)>0){let e=s.length,t=i||Math.abs(s[0]-s[e-2])<1e-6&&Math.abs(s[1]-s[e-1])<1e-6;s=Td(s,0,e,2,a,t,s),Dd(s,2,t)}o.moveTo(s[0],s[1]);let c=s.length;i&&(c-=2);for(let e=2;e<c;e+=2)o.lineTo(s[e],s[e+1]);return i&&o.closePath(),n}drawRings_(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a)t=this.moveToLineTo_(e,t,n[a],r,!0,i);return t}drawCircle(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Un(this.extent_,e.getExtent())){if(this.fillState_||this.strokeState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=ga(e,this.transform_,this.pixelCoordinates_),n=t[2]-t[0],r=t[3]-t[1],i=Math.sqrt(n*n+r*r),a=this.context_;a.beginPath(),a.arc(t[0],t[1],i,0,2*Math.PI),this.fillState_&&a.fill(),this.strokeState_&&a.stroke()}this.text_!==``&&this.drawText_(e.getCenter(),0,2,2)}}setStyle(e){this.setFillStrokeStyle(e.getFill(),e.getStroke()),this.setImageStyle(e.getImage()),this.setTextStyle(e.getText())}setTransform(e){this.transform_=e}drawGeometry(e){switch(e.getType()){case`Point`:this.drawPoint(e);break;case`LineString`:this.drawLineString(e);break;case`Polygon`:this.drawPolygon(e);break;case`MultiPoint`:this.drawMultiPoint(e);break;case`MultiLineString`:this.drawMultiLineString(e);break;case`MultiPolygon`:this.drawMultiPolygon(e);break;case`GeometryCollection`:this.drawGeometryCollection(e);break;case`Circle`:this.drawCircle(e)}}drawFeature(e,t){let n=t.getGeometryFunction()(e);n&&(this.setStyle(t),this.drawGeometry(n))}drawGeometryCollection(e){let t=e.getGeometriesArray();for(let e=0,n=t.length;e<n;++e)this.drawGeometry(t[e])}drawPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==``&&this.drawText_(t,0,t.length,n)}drawMultiPoint(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getFlatCoordinates(),n=e.getStride();this.image_&&this.drawImages_(t,0,t.length,n),this.text_!==``&&this.drawText_(t,0,t.length,n)}drawLineString(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Un(this.extent_,e.getExtent())){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates();t.beginPath(),this.moveToLineTo_(n,0,n.length,e.getStride(),!1,this.strokeState_.strokeOffset),t.stroke()}if(this.text_!==``){let t=e.getFlatMidpoint();this.drawText_(t,0,2,2)}}}drawMultiLineString(e){this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_));let t=e.getExtent();if(Un(this.extent_,t)){if(this.strokeState_){this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getFlatCoordinates(),r=0,i=e.getEnds(),a=e.getStride();t.beginPath();for(let e=0,t=i.length;e<t;++e)r=this.moveToLineTo_(n,r,i[e],a,!1,this.strokeState_.strokeOffset);t.stroke()}if(this.text_!==``){let t=e.getFlatMidpoints();this.drawText_(t,0,t.length,2)}}}drawPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Un(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_;t.beginPath(),this.drawRings_(e.getOrientedFlatCoordinates(),0,e.getEnds(),e.getStride(),this.strokeState_?.strokeOffset),this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==``){let t=e.getFlatInteriorPoint();this.drawText_(t,0,2,2)}}}drawMultiPolygon(e){if(this.squaredTolerance_&&(e=e.simplifyTransformed(this.squaredTolerance_,this.userTransform_)),Un(this.extent_,e.getExtent())){if(this.strokeState_||this.fillState_){this.fillState_&&this.setContextFillState_(this.fillState_),this.strokeState_&&this.setContextStrokeState_(this.strokeState_);let t=this.context_,n=e.getOrientedFlatCoordinates(),r=0,i=e.getEndss(),a=e.getStride();t.beginPath();for(let e=0,t=i.length;e<t;++e){let t=i[e];r=this.drawRings_(n,r,t,a,this.strokeState_?.strokeOffset)}this.fillState_&&t.fill(),this.strokeState_&&t.stroke()}if(this.text_!==``){let t=e.getFlatInteriorPoints();this.drawText_(t,0,t.length,2)}}}setContextFillState_(e){let t=this.context_,n=this.contextFillState_;n?n.fillStyle!=e.fillStyle&&(n.fillStyle=e.fillStyle,t.fillStyle=e.fillStyle):(t.fillStyle=e.fillStyle,this.contextFillState_={fillStyle:e.fillStyle})}setContextStrokeState_(e){let t=this.context_,n=this.contextStrokeState_;n?(n.lineCap!=e.lineCap&&(n.lineCap=e.lineCap,t.lineCap=e.lineCap),ft(n.lineDash,e.lineDash)||t.setLineDash(n.lineDash=e.lineDash),n.lineDashOffset!=e.lineDashOffset&&(n.lineDashOffset=e.lineDashOffset,t.lineDashOffset=e.lineDashOffset),n.lineJoin!=e.lineJoin&&(n.lineJoin=e.lineJoin,t.lineJoin=e.lineJoin),n.lineWidth!=e.lineWidth&&(n.lineWidth=e.lineWidth,t.lineWidth=e.lineWidth),n.miterLimit!=e.miterLimit&&(n.miterLimit=e.miterLimit,t.miterLimit=e.miterLimit),n.strokeStyle!=e.strokeStyle&&(n.strokeStyle=e.strokeStyle,t.strokeStyle=e.strokeStyle)):(t.lineCap=e.lineCap,t.setLineDash(e.lineDash),t.lineDashOffset=e.lineDashOffset,t.lineJoin=e.lineJoin,t.lineWidth=e.lineWidth,t.miterLimit=e.miterLimit,t.strokeStyle=e.strokeStyle,this.contextStrokeState_={lineCap:e.lineCap,lineDash:e.lineDash,lineDashOffset:e.lineDashOffset,lineJoin:e.lineJoin,lineWidth:e.lineWidth,miterLimit:e.miterLimit,strokeStyle:e.strokeStyle})}setContextTextState_(e){let t=this.context_,n=this.contextTextState_,r=e.textAlign?e.textAlign:Jl;n?(n.font!=e.font&&(n.font=e.font,t.font=e.font),n.textAlign!=r&&(n.textAlign=r,t.textAlign=r),n.textBaseline!=e.textBaseline&&(n.textBaseline=e.textBaseline,t.textBaseline=e.textBaseline)):(t.font=e.font,t.textAlign=r,t.textBaseline=e.textBaseline,this.contextTextState_={font:e.font,textAlign:r,textBaseline:e.textBaseline})}setFillStrokeStyle(e,t){if(!e)this.fillState_=null;else{let t=e.getColor();this.fillState_={fillStyle:Bl(t||Ul)}}if(!t)this.strokeState_=null;else{let e=t.getColor(),n=t.getLineCap(),r=t.getLineDash(),i=t.getLineDashOffset(),a=t.getLineJoin(),o=t.getWidth(),s=t.getMiterLimit(),c=r||Gl,l=t.getOffset();this.strokeState_={lineCap:n===void 0?Wl:n,lineDash:this.pixelRatio_===1?c:c.map(e=>e*this.pixelRatio_),lineDashOffset:(i||0)*this.pixelRatio_,lineJoin:a===void 0?Kl:a,lineWidth:(o===void 0?1:o)*this.pixelRatio_,miterLimit:s===void 0?10:s,strokeStyle:Bl(e||ql),strokeOffset:(l??0)*this.pixelRatio_}}}setImageStyle(e){let t;if(!e||!(t=e.getSize())){this.image_=null;return}let n=e.getPixelRatio(this.pixelRatio_),r=e.getAnchor(),i=e.getOrigin();this.image_=e.getImage(this.pixelRatio_),this.imageAnchorX_=r[0]*n,this.imageAnchorY_=r[1]*n,this.imageHeight_=t[1]*n,this.imageOpacity_=e.getOpacity(),this.imageOriginX_=i[0],this.imageOriginY_=i[1],this.imageRotateWithView_=e.getRotateWithView(),this.imageRotation_=e.getRotation();let a=e.getScaleArray();this.imageScale_=[a[0]*this.pixelRatio_/n,a[1]*this.pixelRatio_/n],this.imageWidth_=t[0]*n}setTextStyle(e){if(!e)this.text_=``;else{let t=e.getFill();if(!t)this.textFillState_=null;else{let e=t.getColor();this.textFillState_={fillStyle:Bl(e||Ul)}}let n=e.getStroke();if(!n)this.textStrokeState_=null;else{let e=n.getColor(),t=n.getLineCap(),r=n.getLineDash(),i=n.getLineDashOffset(),a=n.getLineJoin(),o=n.getWidth(),s=n.getMiterLimit();this.textStrokeState_={lineCap:t===void 0?Wl:t,lineDash:r||Gl,lineDashOffset:i||0,lineJoin:a===void 0?Kl:a,lineWidth:o===void 0?1:o,miterLimit:s===void 0?10:s,strokeStyle:Bl(e||ql)}}let r=e.getFont(),i=e.getOffsetX(),a=e.getOffsetY(),o=e.getRotateWithView(),s=e.getRotation(),c=e.getScaleArray(),l=e.getText(),u=e.getTextAlign(),d=e.getTextBaseline();this.textState_={font:r===void 0?Hl:r,textAlign:u===void 0?Jl:u,textBaseline:d===void 0?Yl:d},this.text_=l===void 0?``:Array.isArray(l)?l.reduce((e,t,n)=>e+=n%2?` `:t,``):l,this.textOffsetX_=i===void 0?0:this.pixelRatio_*i,this.textOffsetY_=a===void 0?0:this.pixelRatio_*a,this.textRotateWithView_=o!==void 0&&o,this.textRotation_=s===void 0?0:s,this.textScale_=[this.pixelRatio_*c[0],this.pixelRatio_*c[1]]}}},Ad=.5,jd={Point:Ud,LineString:Bd,Polygon:Gd,MultiPoint:Wd,MultiLineString:Vd,MultiPolygon:Hd,GeometryCollection:zd,Circle:Fd};function Md(e,t){return parseInt(I(e),10)-parseInt(I(t),10)}function Nd(e,t){let n=Pd(e,t);return n*n}function Pd(e,t){return Ad*e/t}function Fd(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(a||o){let s=e.getBuilder(n.getZIndex(),`Circle`);s.setFillStrokeStyle(a,o),s.drawCircle(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}function Id(e,t,n,r,i,a,o,s){let c=[],l=n.getImage();if(l){let e=!0,t=l.getImageState();t==q.LOADED||t==q.ERROR?e=!1:t==q.IDLE&&l.load(),e&&c.push(l.ready())}let u=n.getFill();u&&u.loading()&&c.push(u.ready());let d=c.length>0;return d&&Promise.all(c).then(()=>i(null)),Ld(e,t,n,r,a,o,s),d}function Ld(e,t,n,r,i,a,o){let s=n.getGeometryFunction()(t);if(!s)return;let c=s.simplifyTransformed(r,i);if(n.getRenderer())Rd(e,c,n,t,o);else{let r=jd[c.getType()];r(e,c,n,t,o,a)}}function Rd(e,t,n,r,i){if(t.getType()==`GeometryCollection`){let a=t.getGeometries();for(let t=0,o=a.length;t<o;++t)Rd(e,a[t],n,r,i);return}e.getBuilder(n.getZIndex(),`Default`).drawCustom(t,r,n.getRenderer(),n.getHitDetectionRenderer(),i)}function zd(e,t,n,r,i,a){let o=t.getGeometriesArray(),s,c;for(s=0,c=o.length;s<c;++s){let t=jd[o[s].getType()];t(e,o[s],n,r,i,a)}}function Bd(e,t,n,r,i){let a=n.getStroke();if(a){let o=e.getBuilder(n.getZIndex(),`LineString`);o.setFillStrokeStyle(null,a),o.drawLineString(t,r,i)}let o=n.getText();if(o&&o.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(o),a.drawText(t,r,i)}}function Vd(e,t,n,r,i){let a=n.getStroke();if(a){let o=e.getBuilder(n.getZIndex(),`LineString`);o.setFillStrokeStyle(null,a),o.drawMultiLineString(t,r,i)}let o=n.getText();if(o&&o.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(o),a.drawText(t,r,i)}}function Hd(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(o||a){let s=e.getBuilder(n.getZIndex(),`Polygon`);s.setFillStrokeStyle(a,o),s.drawMultiPolygon(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}function Ud(e,t,n,r,i,a){let o=n.getImage(),s=n.getText(),c=s&&s.getText(),l=a&&o&&c?{}:void 0;if(o){if(o.getImageState()!=q.LOADED)return;let a=e.getBuilder(n.getZIndex(),`Image`);a.setImageStyle(o,l),a.drawPoint(t,r,i)}if(c){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s,l),a.drawText(t,r,i)}}function Wd(e,t,n,r,i,a){let o=n.getImage(),s=o&&o.getOpacity()!==0,c=n.getText(),l=c&&c.getText(),u=a&&s&&l?{}:void 0;if(s){if(o.getImageState()!=q.LOADED)return;let a=e.getBuilder(n.getZIndex(),`Image`);a.setImageStyle(o,u),a.drawMultiPoint(t,r,i)}if(l){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(c,u),a.drawText(t,r,i)}}function Gd(e,t,n,r,i){let a=n.getFill(),o=n.getStroke();if(a||o){let s=e.getBuilder(n.getZIndex(),`Polygon`);s.setFillStrokeStyle(a,o),s.drawPolygon(t,r,i)}let s=n.getText();if(s&&s.getText()){let a=e.getBuilder(n.getZIndex(),`Text`);a.setTextStyle(s),a.drawText(t,r,i)}}var Kd=!1;function qd(e,t,n,r,i,a,o){let s=new XMLHttpRequest;s.open(`GET`,typeof e==`function`?e(n,r,i):e,!0),t.getType()==`arraybuffer`&&(s.responseType=`arraybuffer`),s.withCredentials=Kd,s.onload=function(e){if(!s.status||s.status>=200&&s.status<300){let e=t.getType();try{let r;e==`text`||e==`json`?r=s.responseText:e==`xml`?r=s.responseXML||s.responseText:e==`arraybuffer`&&(r=s.response),r?a(t.readFeatures(r,{extent:n,featureProjection:i}),t.readProjection(r)):o()}catch{o()}}else o()},s.onerror=o,s.send()}function Jd(e,t){return function(n,r,i,a,o){qd(e,t,n,r,i,(e,t)=>{this.addFeatures(e),a!==void 0&&a(e)},()=>{this.changed(),o!==void 0&&o()})}}function Yd(e,t){return[[-1/0,-1/0,1/0,1/0]]}function Xd(e,t){return[e]}var Zd=class e extends pa{constructor(e,t,n){if(super(),this.ends_=[],this.maxDelta_=-1,this.maxDeltaRevision_=-1,Array.isArray(e[0]))this.setCoordinates(e,t);else if(t!==void 0&&n)this.setFlatCoordinates(t,e),this.ends_=n;else{let t=e,n=[],r=[];for(let e=0,i=t.length;e<i;++e){let i=t[e];dt(n,i.getFlatCoordinates()),r.push(n.length)}let i=t.length===0?this.getLayout():t[0].getLayout();this.setFlatCoordinates(i,n),this.ends_=r}}appendLineString(e){dt(this.flatCoordinates,e.getFlatCoordinates().slice()),this.ends_.push(this.flatCoordinates.length),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout,this.ends_.slice());return t.applyProperties(this),t}closestPointXY(e,t,n,r){return r<hn(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Sa(this.flatCoordinates,0,this.ends_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ta(this.flatCoordinates,0,this.ends_,this.stride,this.maxDelta_,!1,e,t,n,r))}getCoordinateAtM(e,t,n){return this.layout!=`XYM`&&this.layout!=`XYZM`||this.flatCoordinates.length===0?null:(t=t!==void 0&&t,n=n!==void 0&&n,Sd(this.flatCoordinates,0,this.ends_,this.stride,e,t,n))}getCoordinates(){return Ma(this.flatCoordinates,0,this.ends_,this.stride)}getEnds(){return this.ends_}getLineString(e){return e<0||this.ends_.length<=e?null:new wd(this.flatCoordinates.slice(e===0?0:this.ends_[e-1],this.ends_[e]),this.layout)}getLineStrings(){let e=this.flatCoordinates,t=this.ends_,n=this.layout,r=[],i=0;for(let a=0,o=t.length;a<o;++a){let o=t[a],s=new wd(e.slice(i,o),n);r.push(s),i=o}return r}getLength(){let e=this.ends_,t=0,n=0;for(let r=0,i=e.length;r<i;++r)n+=Cd(this.flatCoordinates,t,e[r],this.stride),t=e[r];return n}getFlatMidpoints(){let e=[],t=this.flatCoordinates,n=0,r=this.ends_,i=this.stride;for(let a=0,o=r.length;a<o;++a){let o=r[a];dt(e,bd(t,n,o,i,.5)),n=o}return e}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Ga(this.flatCoordinates,0,this.ends_,this.stride,t,n,0,r),new e(n,`XY`,r)}getType(){return`MultiLineString`}intersectsExtent(e){return Ba(this.flatCoordinates,0,this.ends_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,2),this.flatCoordinates||=[];let n=ka(this.flatCoordinates,0,e,this.stride,this.ends_);this.flatCoordinates.length=n.length===0?0:n[n.length-1],this.changed()}},Qd=class e extends pa{constructor(e,t){super(),t&&!Array.isArray(e[0])?this.setFlatCoordinates(t,e):this.setCoordinates(e,t)}appendPoint(e){dt(this.flatCoordinates,e.getFlatCoordinates()),this.changed()}clone(){let t=new e(this.flatCoordinates.slice(),this.layout);return t.applyProperties(this),t}closestPointXY(e,t,n,r){if(r<hn(this.getExtent(),e,t))return r;let i=this.flatCoordinates,a=this.stride;for(let o=0,s=i.length;o<s;o+=a){let s=Zt(e,t,i[o],i[o+1]);if(s<r){r=s;for(let e=0;e<a;++e)n[e]=i[o+e];n.length=a}}return r}getCoordinates(){return ja(this.flatCoordinates,0,this.flatCoordinates.length,this.stride)}getPoint(e){let t=this.flatCoordinates.length/this.stride;return e<0||t<=e?null:new Za(this.flatCoordinates.slice(e*this.stride,(e+1)*this.stride),this.layout)}getPoints(){let e=this.flatCoordinates,t=this.layout,n=this.stride,r=[];for(let i=0,a=e.length;i<a;i+=n){let a=new Za(e.slice(i,i+n),t);r.push(a)}return r}getType(){return`MultiPoint`}intersectsExtent(e){let t=this.flatCoordinates,n=this.stride;for(let r=0,i=t.length;r<i;r+=n){let n=t[r],i=t[r+1];if(vn(e,n,i))return!0}return!1}setCoordinates(e,t){this.setLayout(t,e,1),this.flatCoordinates||=[],this.flatCoordinates.length=Oa(this.flatCoordinates,0,e,this.stride),this.changed()}};function $d(e,t,n,r){let i=[],a=bn();for(let o=0,s=n.length;o<s;++o){let s=n[o];a=wn(e,t,s[0],r),i.push((a[0]+a[2])/2,(a[1]+a[3])/2),t=s[s.length-1]}return i}var ef=class e extends pa{constructor(e,t,n){if(super(),this.endss_=[],this.flatInteriorPointsRevision_=-1,this.flatInteriorPoints_=null,this.maxDelta_=-1,this.maxDeltaRevision_=-1,this.orientedRevision_=-1,this.orientedFlatCoordinates_=null,!n&&!Array.isArray(e[0])){let r=e,i=[],a=[];for(let e=0,t=r.length;e<t;++e){let t=r[e],n=i.length,o=t.getEnds();for(let e=0,t=o.length;e<t;++e)o[e]+=n;dt(i,t.getFlatCoordinates()),a.push(o)}t=r.length===0?this.getLayout():r[0].getLayout(),e=i,n=a}t!==void 0&&n?(this.setFlatCoordinates(t,e),this.endss_=n):this.setCoordinates(e,t)}appendPolygon(e){let t;if(!this.flatCoordinates)this.flatCoordinates=e.getFlatCoordinates().slice(),t=e.getEnds().slice(),this.endss_.push();else{let n=this.flatCoordinates.length;dt(this.flatCoordinates,e.getFlatCoordinates()),t=e.getEnds().slice();for(let e=0,r=t.length;e<r;++e)t[e]+=n}this.endss_.push(t),this.changed()}clone(){let t=this.endss_.length,n=Array(t);for(let e=0;e<t;++e)n[e]=this.endss_[e].slice();let r=new e(this.flatCoordinates.slice(),this.layout,n);return r.applyProperties(this),r}closestPointXY(e,t,n,r){return r<hn(this.getExtent(),e,t)?r:(this.maxDeltaRevision_!=this.getRevision()&&(this.maxDelta_=Math.sqrt(Ca(this.flatCoordinates,0,this.endss_,this.stride,0)),this.maxDeltaRevision_=this.getRevision()),Ea(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,this.maxDelta_,!0,e,t,n,r))}containsXY(e,t){return La(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e,t)}getArea(){return ya(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride)}getCoordinates(e){let t;return e===void 0?t=this.flatCoordinates:(t=this.getOrientedFlatCoordinates().slice(),ao(t,0,this.endss_,this.stride,e)),Na(t,0,this.endss_,this.stride)}getEndss(){return this.endss_}getFlatInteriorPoints(){if(this.flatInteriorPointsRevision_!=this.getRevision()){let e=$d(this.flatCoordinates,0,this.endss_,this.stride);this.flatInteriorPoints_=$a(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e),this.flatInteriorPointsRevision_=this.getRevision()}return this.flatInteriorPoints_}getInteriorPoints(){return new Qd(this.getFlatInteriorPoints().slice(),`XYM`)}getOrientedFlatCoordinates(){if(this.orientedRevision_!=this.getRevision()){let e=this.flatCoordinates;ro(e,0,this.endss_,this.stride)?this.orientedFlatCoordinates_=e:(this.orientedFlatCoordinates_=e.slice(),this.orientedFlatCoordinates_.length=ao(this.orientedFlatCoordinates_,0,this.endss_,this.stride)),this.orientedRevision_=this.getRevision()}return this.orientedFlatCoordinates_}getSimplifiedGeometryInternal(t){let n=[],r=[];return n.length=Ya(this.flatCoordinates,0,this.endss_,this.stride,Math.sqrt(t),n,0,r),new e(n,`XY`,r)}getPolygon(e){if(e<0||this.endss_.length<=e)return null;let t;if(e===0)t=0;else{let n=this.endss_[e-1];t=n[n.length-1]}let n=this.endss_[e].slice(),r=n[n.length-1];if(t!==0)for(let e=0,r=n.length;e<r;++e)n[e]-=t;return new so(this.flatCoordinates.slice(t,r),this.layout,n)}getPolygons(){let e=this.layout,t=this.flatCoordinates,n=this.endss_,r=[],i=0;for(let a=0,o=n.length;a<o;++a){let o=n[a].slice(),s=o[o.length-1];if(i!==0)for(let e=0,t=o.length;e<t;++e)o[e]-=i;let c=new so(t.slice(i,s),e,o);r.push(c),i=s}return r}getType(){return`MultiPolygon`}intersectsExtent(e){return Ua(this.getOrientedFlatCoordinates(),0,this.endss_,this.stride,e)}setCoordinates(e,t){this.setLayout(t,e,3),this.flatCoordinates||=[];let n=Aa(this.flatCoordinates,0,e,this.stride,this.endss_);if(n.length===0)this.flatCoordinates.length=0;else{let e=n[n.length-1];this.flatCoordinates.length=e.length===0?0:e[e.length-1]}this.changed()}},tf=Gi(),nf=class e{constructor(e,t,n,r,i,a){this.styleFunction,this.extent_,this.id_=a,this.type_=e,this.flatCoordinates_=t,this.flatInteriorPoints_=null,this.flatMidpoints_=null,this.ends_=n||null,this.properties_=i,this.squaredTolerance_,this.stride_=r,this.simplifiedGeometry_}get(e){return this.properties_[e]}getExtent(){return this.extent_||=this.type_===`Point`?Cn(this.flatCoordinates_):wn(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_),this.extent_}getFlatInteriorPoint(){if(!this.flatInteriorPoints_){let e=Pn(this.getExtent());this.flatInteriorPoints_=Qa(this.flatCoordinates_,0,this.ends_,this.stride_,e,0)}return this.flatInteriorPoints_}getFlatInteriorPoints(){if(!this.flatInteriorPoints_){let e=oo(this.flatCoordinates_,this.ends_),t=$d(this.flatCoordinates_,0,e,this.stride_);this.flatInteriorPoints_=$a(this.flatCoordinates_,0,e,this.stride_,t)}return this.flatInteriorPoints_}getFlatMidpoint(){return this.flatMidpoints_||=bd(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,.5),this.flatMidpoints_}getFlatMidpoints(){if(!this.flatMidpoints_){this.flatMidpoints_=[];let e=this.flatCoordinates_,t=0,n=this.ends_;for(let r=0,i=n.length;r<i;++r){let i=n[r],a=bd(e,t,i,this.stride_,.5);dt(this.flatMidpoints_,a),t=i}}return this.flatMidpoints_}getId(){return this.id_}getOrientedFlatCoordinates(){return this.flatCoordinates_}getGeometry(){return this}getSimplifiedGeometry(e){return this}simplifyTransformed(e,t){return this}getProperties(){return this.properties_}getPropertiesInternal(){return this.properties_}getStride(){return this.stride_}getStyleFunction(){return this.styleFunction}getType(){return this.type_}transform(e){e=B(e);let t=e.getExtent(),n=e.getWorldExtent();if(t&&n){let e=Rn(n)/Rn(t);$i(tf,n[0],n[3],e,-e,0,0,0),oa(this.flatCoordinates_,0,this.flatCoordinates_.length,this.stride_,tf,this.flatCoordinates_)}}applyTransform(e){e(this.flatCoordinates_,this.flatCoordinates_,this.stride_)}clone(){return new e(this.type_,this.flatCoordinates_.slice(),this.ends_?.slice(),this.stride_,Object.assign({},this.properties_),this.id_)}getEnds(){return this.ends_}enableSimplifyTransformed(){return this.simplifyTransformed=_t((t,n)=>{if(t===this.squaredTolerance_)return this.simplifiedGeometry_;this.simplifiedGeometry_=this.clone(),n&&this.simplifiedGeometry_.applyTransform(n);let r=this.simplifiedGeometry_.getFlatCoordinates(),i;switch(this.type_){case`LineString`:r.length=Wa(r,0,this.simplifiedGeometry_.flatCoordinates_.length,this.simplifiedGeometry_.stride_,t,r,0),i=[r.length];break;case`MultiLineString`:i=[],r.length=Ga(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,t,r,0,i);break;case`Polygon`:i=[],r.length=Ja(r,0,this.simplifiedGeometry_.ends_,this.simplifiedGeometry_.stride_,Math.sqrt(t),r,0,i)}return i&&(this.simplifiedGeometry_=new e(this.type_,r,i,this.stride_,this.properties_,this.id_)),this.squaredTolerance_=t,this.simplifiedGeometry_}),this}};nf.prototype.getFlatCoordinates=nf.prototype.getOrientedFlatCoordinates;var rf=class{constructor(e){this.rbush_=new Ks(e),this.items_={}}insert(e,t){let n={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3],value:t};this.rbush_.insert(n),this.items_[I(t)]=n}load(e,t){let n=Array(t.length);for(let r=0,i=t.length;r<i;r++){let i=e[r],a=t[r],o={minX:i[0],minY:i[1],maxX:i[2],maxY:i[3],value:a};n[r]=o,this.items_[I(a)]=o}this.rbush_.load(n)}remove(e){let t=I(e),n=this.items_[t];return delete this.items_[t],this.rbush_.remove(n)!==null}update(e,t){let n=this.items_[I(t)];Tn([n.minX,n.minY,n.maxX,n.maxY],e)||(this.remove(t),this.insert(e,t))}getAll(){return this.rbush_.all().map(function(e){return e.value})}getInExtent(e){let t={minX:e[0],minY:e[1],maxX:e[2],maxY:e[3]};return this.rbush_.search(t).map(function(e){return e.value})}forEach(e){return this.forEach_(this.getAll(),e)}forEachInExtent(e,t){return this.forEach_(this.getInExtent(e),t)}forEach_(e,t){let n;for(let r=0,i=e.length;r<i;r++)if(n=t(e[r]),n)return n;return n}isEmpty(){return nt(this.items_)}clear(){this.rbush_.clear(),this.items_={}}getExtent(e){let t=this.rbush_.toJSON();return xn(t.minX,t.minY,t.maxX,t.maxY,e)}concat(e){this.rbush_.load(e.rbush_.all());for(let t in e.items_)this.items_[t]=e.items_[t]}},af=class extends Tt{constructor(e){super(),this.projection=B(e.projection),this.attributions_=of(e.attributions),this.attributionsCollapsible_=e.attributionsCollapsible??!0,this.loading=!1,this.state_=e.state===void 0?`ready`:e.state,this.wrapX_=e.wrapX!==void 0&&e.wrapX,this.interpolate_=!!e.interpolate,this.viewResolver=null,this.viewRejector=null;let t=this;this.viewPromise_=new Promise(function(e,n){t.viewResolver=e,t.viewRejector=n})}getAttributions(){return this.attributions_}getAttributionsCollapsible(){return this.attributionsCollapsible_}getProjection(){return this.projection}getResolutions(e){return null}getView(){return this.viewPromise_}ready(){let e=this.getState();return e===`ready`?Promise.resolve():e===`error`?Promise.reject(Error(`Source failed to load`)):new Promise((e,t)=>{let n=()=>{let r=this.getState();r===`ready`?(this.un(`change`,n),e()):r===`error`&&(this.un(`change`,n),t(Error(`Source failed to load`)))};this.on(`change`,n)})}getState(){return this.state_}getWrapX(){return this.wrapX_}getInterpolate(){return this.interpolate_}refresh(){this.changed()}setAttributions(e){this.attributions_=of(e),this.changed()}setState(e){this.state_=e,this.changed()}};function of(e){return e?typeof e==`function`?e:(Array.isArray(e)||(e=[e]),t=>e):null}var sf={ADDFEATURE:`addfeature`,CHANGEFEATURE:`changefeature`,CLEAR:`clear`,REMOVEFEATURE:`removefeature`,FEATURESLOADSTART:`featuresloadstart`,FEATURESLOADEND:`featuresloadend`,FEATURESLOADERROR:`featuresloaderror`},cf=class extends yt{constructor(e,t,n){super(e),this.feature=t,this.features=n}},lf=class extends af{constructor(e){e||={},super({attributions:e.attributions,interpolate:!0,projection:void 0,state:`ready`,wrapX:e.wrapX===void 0||e.wrapX}),this.on,this.once,this.un,this.loader_=gt,this.format_=e.format||null,this.overlaps_=e.overlaps===void 0||e.overlaps,this.url_=e.url,e.loader===void 0?this.url_!==void 0&&(R(this.format_,"`format` must be set when `url` is set"),this.loader_=Jd(this.url_,this.format_)):this.loader_=e.loader,this.strategy_=e.strategy===void 0?Yd:e.strategy;let t=e.useSpatialIndex===void 0||e.useSpatialIndex;this.featuresRtree_=t?new rf:null,this.loadedExtentsRtree_=new rf,this.nullGeometryFeatures_={},this.idIndex_={},this.uidIndex_={},this.featureChangeKeys_={},this.featuresCollection_=null;let n,r;Array.isArray(e.features)?r=e.features:e.features&&(n=e.features,r=n.getArray()),!t&&n===void 0&&(n=new Ot(r)),r!==void 0&&this.addFeaturesInternal(r),n!==void 0&&this.bindFeaturesCollection_(n)}addFeature(e){this.addFeatureInternal(e),this.changed()}addFeatureInternal(e){let t=I(e);if(!this.addToIndex_(t,e)){this.featuresCollection_&&this.featuresCollection_.remove(e);return}this.setupChangeEvents_(t,e);let n=e.getGeometry();if(n){let t=n.getExtent();this.featuresRtree_&&this.featuresRtree_.insert(t,e)}else this.nullGeometryFeatures_[t]=e;this.dispatchEvent(new cf(sf.ADDFEATURE,e))}setupChangeEvents_(e,t){t instanceof nf||(this.featureChangeKeys_[e]=[N(t,P.CHANGE,this.handleFeatureChange_,this),N(t,et.PROPERTYCHANGE,this.handleFeatureChange_,this)])}addToIndex_(e,t){let n=!0;if(t.getId()!==void 0){let e=String(t.getId());if(!(e in this.idIndex_))this.idIndex_[e]=t;else if(t instanceof nf){let r=this.idIndex_[e];r instanceof nf?Array.isArray(r)?r.push(t):this.idIndex_[e]=[r,t]:n=!1}else n=!1}return n&&(R(!(e in this.uidIndex_),"The passed `feature` was already added to the source"),this.uidIndex_[e]=t),n}addFeatures(e){this.addFeaturesInternal(e),this.changed()}addFeaturesInternal(e){let t=[],n=[],r=[];for(let t=0,r=e.length;t<r;t++){let r=e[t],i=I(r);this.addToIndex_(i,r)&&n.push(r)}for(let e=0,i=n.length;e<i;e++){let i=n[e],a=I(i);this.setupChangeEvents_(a,i);let o=i.getGeometry();if(o){let e=o.getExtent();t.push(e),r.push(i)}else this.nullGeometryFeatures_[a]=i}if(this.featuresRtree_&&this.featuresRtree_.load(t,r),this.hasListener(sf.ADDFEATURE))for(let e=0,t=n.length;e<t;e++)this.dispatchEvent(new cf(sf.ADDFEATURE,n[e]))}bindFeaturesCollection_(e){let t=!1;this.addEventListener(sf.ADDFEATURE,function(n){t||=(t=!0,e.push(n.feature),!1)}),this.addEventListener(sf.REMOVEFEATURE,function(n){t||=(t=!0,e.remove(n.feature),!1)}),e.addEventListener($e.ADD,e=>{t||=(t=!0,this.addFeature(e.element),!1)}),e.addEventListener($e.REMOVE,e=>{t||=(t=!0,this.removeFeature(e.element),!1)}),this.featuresCollection_=e}clear(e){if(e){for(let e in this.featureChangeKeys_)this.featureChangeKeys_[e].forEach(it);this.featuresCollection_||(this.featureChangeKeys_={},this.idIndex_={},this.uidIndex_={})}else if(this.featuresRtree_){this.featuresRtree_.forEach(e=>{this.removeFeatureInternal(e)});for(let e in this.nullGeometryFeatures_)this.removeFeatureInternal(this.nullGeometryFeatures_[e])}this.featuresCollection_&&this.featuresCollection_.clear(),this.featuresRtree_&&this.featuresRtree_.clear(),this.nullGeometryFeatures_={};let t=new cf(sf.CLEAR);this.dispatchEvent(t),this.changed()}forEachFeature(e){if(this.featuresRtree_)return this.featuresRtree_.forEach(e);this.featuresCollection_&&this.featuresCollection_.forEach(e)}forEachFeatureAtCoordinateDirect(e,t){let n=[e[0],e[1],e[0],e[1]];return this.forEachFeatureInExtent(n,function(n){let r=n.getGeometry();if(r instanceof nf||r.intersectsCoordinate(e))return t(n)})}forEachFeatureInExtent(e,t){if(this.featuresRtree_)return this.featuresRtree_.forEachInExtent(e,t);this.featuresCollection_&&this.featuresCollection_.forEach(t)}forEachFeatureIntersectingExtent(e,t){return this.forEachFeatureInExtent(e,function(n){let r=n.getGeometry();if(r instanceof nf||r.intersectsExtent(e)){let e=t(n);if(e)return e}})}getFeaturesCollection(){return this.featuresCollection_}getFeatures(){let e;return this.featuresCollection_?e=this.featuresCollection_.getArray().slice(0):this.featuresRtree_&&(e=this.featuresRtree_.getAll(),nt(this.nullGeometryFeatures_)||dt(e,Object.values(this.nullGeometryFeatures_))),e}getFeaturesAtCoordinate(e){let t=[];return this.forEachFeatureAtCoordinateDirect(e,function(e){t.push(e)}),t}getFeaturesInExtent(e,t){if(this.featuresRtree_){if(!(t&&t.canWrapX()&&this.getWrapX()))return this.featuresRtree_.getInExtent(e);let n=Xn(e,t);return[].concat(...n.map(e=>this.featuresRtree_.getInExtent(e)))}return this.featuresCollection_?this.featuresCollection_.getArray().slice(0):[]}getClosestFeatureToCoordinate(e,t){let n=e[0],r=e[1],i=null,a=[NaN,NaN],o=1/0,s=[-1/0,-1/0,1/0,1/0];return t||=mt,this.featuresRtree_.forEachInExtent(s,function(e){if(t(e)){let t=e.getGeometry(),c=o;if(o=t instanceof nf?0:t.closestPointXY(n,r,a,o),o<c){i=e;let t=Math.sqrt(o);s[0]=n-t,s[1]=r-t,s[2]=n+t,s[3]=r+t}}}),i}getExtent(e){return this.featuresRtree_?.getExtent(e)??null}getFeatureById(e){let t=this.idIndex_[e.toString()];return t===void 0?null:t}getFeatureByUid(e){let t=this.uidIndex_[e];return t===void 0?null:t}getFormat(){return this.format_}getOverlaps(){return this.overlaps_}getUrl(){return this.url_}handleFeatureChange_(e){let t=e.target,n=I(t),r=t.getGeometry();if(!r)n in this.nullGeometryFeatures_||(this.featuresRtree_&&this.featuresRtree_.remove(t),this.nullGeometryFeatures_[n]=t);else{let e=r.getExtent();n in this.nullGeometryFeatures_?(delete this.nullGeometryFeatures_[n],this.featuresRtree_&&this.featuresRtree_.insert(e,t)):this.featuresRtree_&&this.featuresRtree_.update(e,t)}let i=t.getId();if(i!==void 0){let e=i.toString();this.idIndex_[e]!==t&&(this.removeFromIdIndex_(t),this.idIndex_[e]=t)}else this.removeFromIdIndex_(t),this.uidIndex_[n]=t;this.changed(),this.dispatchEvent(new cf(sf.CHANGEFEATURE,t))}hasFeature(e){let t=e.getId();if(t!==void 0){let n=this.idIndex_[String(t)];return Array.isArray(n)?n.includes(e):n===e}return I(e)in this.uidIndex_}isEmpty(){return this.featuresRtree_?this.featuresRtree_.isEmpty()&&nt(this.nullGeometryFeatures_):!this.featuresCollection_||this.featuresCollection_.getLength()===0}loadFeatures(e,t,n){let r=this.loadedExtentsRtree_,i=this.strategy_(e,t,n);for(let e=0,a=i.length;e<a;++e){let a=i[e];if(!r.forEachInExtent(a,function(e){return _n(e.extent,a)})){this.loading=Number(this.loading)+1,this.dispatchEvent(new cf(sf.FEATURESLOADSTART));let e=e=>{this.loading=Number(this.loading)-1,this.dispatchEvent(new cf(sf.FEATURESLOADEND,void 0,e))},i=()=>{this.changed(),this.loading=Number(this.loading)-1,this.dispatchEvent(new cf(sf.FEATURESLOADERROR))},o=!1,s=this.loader_.call(this,a,t,n,t=>o||e(t),()=>o||i());s instanceof Promise?(o=!0,s.then(t=>{this.addFeatures(t),e(t)}).catch(i)):this.loader_.length<4&&(this.loading=!1),r.insert(a,{extent:a.slice()})}}}refresh(){this.clear(!0),this.loadedExtentsRtree_.clear(),super.refresh()}removeLoadedExtent(e){let t=this.loadedExtentsRtree_,n=[];t.forEachInExtent(e,function(e){n.push(e)}),n.forEach(n=>{t.remove(n);let r=Bn(n.extent,e);for(let e of r)t.insert(e,{extent:e})})}removeFeatures(e){let t=!1;for(let n=0,r=e.length;n<r;++n)t=this.removeFeatureInternal(e[n])||t;t&&this.changed()}removeFeature(e){e&&this.removeFeatureInternal(e)&&this.changed()}removeFeatureInternal(e){let t=I(e);if(!(t in this.uidIndex_))return!1;t in this.nullGeometryFeatures_?delete this.nullGeometryFeatures_[t]:this.featuresRtree_&&this.featuresRtree_.remove(e),this.featureChangeKeys_[t]?.forEach(it),delete this.featureChangeKeys_[t];let n=e.getId();if(n!==void 0){let t=n.toString(),r=this.idIndex_[t];r===e?delete this.idIndex_[t]:Array.isArray(r)&&(r.splice(r.indexOf(e),1),r.length===1&&(this.idIndex_[t]=r[0]))}return delete this.uidIndex_[t],this.hasListener(sf.REMOVEFEATURE)&&this.dispatchEvent(new cf(sf.REMOVEFEATURE,e)),!0}removeFromIdIndex_(e){for(let t in this.idIndex_)if(this.idIndex_[t]===e){delete this.idIndex_[t];break}}setLoader(e){this.loader_=e}setUrl(e){R(this.format_,"`format` must be set when `url` is set"),this.url_=e,this.setLoader(Jd(e,this.format_))}setOverlaps(e){this.overlaps_=e,this.changed()}},J={BEGIN_GEOMETRY:0,BEGIN_PATH:1,CIRCLE:2,CLOSE_PATH:3,CUSTOM:4,DRAW_CHARS:5,DRAW_IMAGE:6,END_GEOMETRY:7,FILL:8,MOVE_TO_LINE_TO:9,SET_FILL_STYLE:10,SET_STROKE_STYLE:11,STROKE:12},uf=[J.FILL],df=[J.STROKE],ff=[J.BEGIN_PATH],pf=[J.CLOSE_PATH],mf=class extends Od{constructor(e,t,n,r){super(),this.tolerance=e,this.maxExtent=t,this.pixelRatio=r,this.maxLineWidth=0,this.resolution=n,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_=null,this.bufferedMaxExtent_=null,this.instructions=[],this.coordinates=[],this.tmpCoordinate_=[],this.hitDetectionInstructions=[],this.state={}}applyPixelRatio(e){let t=this.pixelRatio;return t==1?e:e.map(function(e){return e*t})}appendFlatPointCoordinates(e,t){let n=this.getBufferedMaxExtent(),r=this.tmpCoordinate_,i=this.coordinates,a=i.length;for(let o=0,s=e.length;o<s;o+=t)r[0]=e[o],r[1]=e[o+1],gn(n,r)&&(i[a++]=r[0],i[a++]=r[1]);return a}appendFlatLineCoordinates(e,t,n,r,i,a){let o=this.coordinates,s=o.length,c=this.getBufferedMaxExtent();a&&(t+=r);let l=e[t],u=e[t+1],d=this.tmpCoordinate_,f=!0,p,m,h;for(p=t+r;p<n;p+=r)d[0]=e[p],d[1]=e[p+1],h=yn(c,d),h===m?h===un.INTERSECTING?(o[s++]=d[0],o[s++]=d[1],f=!1):f=!0:(f&&=(o[s++]=l,o[s++]=u,!1),o[s++]=d[0],o[s++]=d[1]),l=d[0],u=d[1],m=h;return(i&&f||p===t+r)&&(o[s++]=l,o[s++]=u),s}drawCustomCoordinates_(e,t,n,r,i){for(let a=0,o=n.length;a<o;++a){let o=n[a],s=this.appendFlatLineCoordinates(e,t,o,r,!1,!1);i.push(s),t=o}return t}drawCustom(e,t,n,r,i){this.beginGeometry(e,t,i);let a=e.getType(),o=e.getStride(),s=this.coordinates.length,c,l,u,d,f;switch(a){case`MultiPolygon`:c=e.getOrientedFlatCoordinates(),d=[];let t=e.getEndss();f=0;for(let e=0,n=t.length;e<n;++e){let n=[];f=this.drawCustomCoordinates_(c,f,t[e],o,n),d.push(n)}this.instructions.push([J.CUSTOM,s,d,e,n,Na,i]),this.hitDetectionInstructions.push([J.CUSTOM,s,d,e,r||n,Na,i]);break;case`Polygon`:case`MultiLineString`:u=[],c=a==`Polygon`?e.getOrientedFlatCoordinates():e.getFlatCoordinates(),f=this.drawCustomCoordinates_(c,0,e.getEnds(),o,u),this.instructions.push([J.CUSTOM,s,u,e,n,Ma,i]),this.hitDetectionInstructions.push([J.CUSTOM,s,u,e,r||n,Ma,i]);break;case`LineString`:case`Circle`:c=e.getFlatCoordinates(),l=this.appendFlatLineCoordinates(c,0,c.length,o,!1,!1),this.instructions.push([J.CUSTOM,s,l,e,n,ja,i]),this.hitDetectionInstructions.push([J.CUSTOM,s,l,e,r||n,ja,i]);break;case`MultiPoint`:c=e.getFlatCoordinates(),l=this.appendFlatPointCoordinates(c,o),l>s&&(this.instructions.push([J.CUSTOM,s,l,e,n,ja,i]),this.hitDetectionInstructions.push([J.CUSTOM,s,l,e,r||n,ja,i]));break;case`Point`:c=e.getFlatCoordinates(),this.coordinates.push(c[0],c[1]),l=this.coordinates.length,this.instructions.push([J.CUSTOM,s,l,e,n,void 0,i]),this.hitDetectionInstructions.push([J.CUSTOM,s,l,e,r||n,void 0,i])}this.endGeometry(t)}beginGeometry(e,t,n){this.beginGeometryInstruction1_=[J.BEGIN_GEOMETRY,t,0,e,n],this.instructions.push(this.beginGeometryInstruction1_),this.beginGeometryInstruction2_=[J.BEGIN_GEOMETRY,t,0,e,n],this.hitDetectionInstructions.push(this.beginGeometryInstruction2_)}finish(){return{instructions:this.instructions,hitDetectionInstructions:this.hitDetectionInstructions,coordinates:this.coordinates}}reverseHitDetectionInstructions(){let e=this.hitDetectionInstructions;e.reverse();let t,n=e.length,r,i,a=-1;for(t=0;t<n;++t)r=e[t],i=r[0],i==J.END_GEOMETRY?a=t:i==J.BEGIN_GEOMETRY&&(r[2]=t,ut(this.hitDetectionInstructions,a,t),a=-1)}fillStyleToState(e,t={}){if(e){let n=e.getColor();t.fillPatternScale=n&&typeof n==`object`&&`src`in n?this.pixelRatio:1,t.fillStyle=Bl(n||`#000`)??void 0}else t.fillStyle=void 0;return t}strokeStyleToState(e,t={}){if(e){t.strokeStyle=Bl(e.getColor()||ql);let n=e.getLineCap();t.lineCap=n===void 0?Wl:n;let r=e.getLineDash();t.lineDash=r?r.slice():Gl,t.lineDashOffset=e.getLineDashOffset()||0;let i=e.getLineJoin();t.lineJoin=i===void 0?Kl:i;let a=e.getWidth();t.lineWidth=a===void 0?1:a;let o=e.getMiterLimit();t.miterLimit=o===void 0?10:o,t.strokeOffset=e.getOffset()??0,t.lineWidth>this.maxLineWidth&&(this.maxLineWidth=t.lineWidth,this.bufferedMaxExtent_=null)}else t.strokeStyle=void 0,t.lineCap=void 0,t.lineDash=null,t.lineDashOffset=void 0,t.lineJoin=void 0,t.lineWidth=void 0,t.miterLimit=void 0,t.strokeOffset=void 0;return t}setFillStrokeStyle(e,t){let n=this.state;this.fillStyleToState(e,n),this.strokeStyleToState(t,n)}createFill(e){let t=e.fillStyle,n=[J.SET_FILL_STYLE,t];return typeof t!=`string`&&n.push(e.fillPatternScale),n}applyStroke(e){this.instructions.push(this.createStroke(e))}createStroke(e){return[J.SET_STROKE_STYLE,e.strokeStyle,e.lineWidth*this.pixelRatio,e.lineCap,e.lineJoin,e.miterLimit,e.lineDash?this.applyPixelRatio(e.lineDash):null,e.lineDashOffset*this.pixelRatio]}updateFillStyle(e,t){let n=e.fillStyle;(n!==void 0&&typeof n!=`string`||e.currentFillStyle!=n)&&(this.instructions.push(t.call(this,e)),e.currentFillStyle=n)}updateStrokeStyle(e,t){let n=e.strokeStyle,r=e.lineCap,i=e.lineDash,a=e.lineDashOffset,o=e.lineJoin,s=e.lineWidth,c=e.miterLimit,l=e.strokeOffset;(e.currentStrokeStyle!=n||e.currentLineCap!=r||i!=e.currentLineDash&&!ft(e.currentLineDash,i)||e.currentLineDashOffset!=a||e.currentLineJoin!=o||e.currentLineWidth!=s||e.currentMiterLimit!=c||e.currentStrokeOffset!=l)&&(t.call(this,e),e.currentStrokeStyle=n,e.currentLineCap=r,e.currentLineDash=i,e.currentLineDashOffset=a,e.currentLineJoin=o,e.currentLineWidth=s,e.currentMiterLimit=c,e.currentStrokeOffset=l)}endGeometry(e){this.beginGeometryInstruction1_[2]=this.instructions.length,this.beginGeometryInstruction1_=null,this.beginGeometryInstruction2_[2]=this.hitDetectionInstructions.length,this.beginGeometryInstruction2_=null;let t=[J.END_GEOMETRY,e];this.instructions.push(t),this.hitDetectionInstructions.push(t)}getBufferedMaxExtent(){if(!this.bufferedMaxExtent_&&(this.bufferedMaxExtent_=mn(this.maxExtent),this.maxLineWidth>0)){let e=this.resolution*(this.maxLineWidth+1)/2;pn(this.bufferedMaxExtent_,e,this.bufferedMaxExtent_)}return this.bufferedMaxExtent_}},hf=class extends mf{constructor(e,t,n,r){super(e,t,n,r),this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.anchorX_=void 0,this.anchorY_=void 0,this.height_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.scale_=void 0,this.width_=void 0,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}drawPoint(e,t,n){if(!this.image_||this.maxExtent&&!gn(this.maxExtent,e.getFlatCoordinates()))return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),i=e.getStride(),a=this.coordinates.length,o=this.appendFlatPointCoordinates(r,i);this.instructions.push([J.DRAW_IMAGE,a,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([J.DRAW_IMAGE,a,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}drawMultiPoint(e,t,n){if(!this.image_)return;this.beginGeometry(e,t,n);let r=e.getFlatCoordinates(),i=[];for(let t=0,n=r.length;t<n;t+=e.getStride())(!this.maxExtent||gn(this.maxExtent,r.slice(t,t+2)))&&i.push(r[t],r[t+1]);let a=this.coordinates.length,o=this.appendFlatPointCoordinates(i,2);this.instructions.push([J.DRAW_IMAGE,a,o,this.image_,this.anchorX_*this.imagePixelRatio_,this.anchorY_*this.imagePixelRatio_,Math.ceil(this.height_*this.imagePixelRatio_),this.opacity_,this.originX_*this.imagePixelRatio_,this.originY_*this.imagePixelRatio_,this.rotateWithView_,this.rotation_,[this.scale_[0]*this.pixelRatio/this.imagePixelRatio_,this.scale_[1]*this.pixelRatio/this.imagePixelRatio_],Math.ceil(this.width_*this.imagePixelRatio_),this.declutterMode_,this.declutterImageWithText_]),this.hitDetectionInstructions.push([J.DRAW_IMAGE,a,o,this.hitDetectionImage_,this.anchorX_,this.anchorY_,this.height_,1,this.originX_,this.originY_,this.rotateWithView_,this.rotation_,this.scale_,this.width_,this.declutterMode_,this.declutterImageWithText_]),this.endGeometry(t)}finish(){return this.reverseHitDetectionInstructions(),this.anchorX_=void 0,this.anchorY_=void 0,this.hitDetectionImage_=null,this.image_=null,this.imagePixelRatio_=void 0,this.height_=void 0,this.scale_=void 0,this.opacity_=void 0,this.originX_=void 0,this.originY_=void 0,this.rotateWithView_=void 0,this.rotation_=void 0,this.width_=void 0,super.finish()}setImageStyle(e,t){let n=e.getAnchor(),r=e.getSize(),i=e.getOrigin();this.imagePixelRatio_=e.getPixelRatio(this.pixelRatio),this.anchorX_=n[0],this.anchorY_=n[1],this.hitDetectionImage_=e.getHitDetectionImage(),this.image_=e.getImage(this.pixelRatio),this.height_=r[1],this.opacity_=e.getOpacity(),this.originX_=i[0],this.originY_=i[1],this.rotateWithView_=e.getRotateWithView(),this.rotation_=e.getRotation(),this.scale_=e.getScaleArray(),this.width_=r[0],this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}},gf=class extends mf{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinates_(e,t,n,r,i){let a=this.coordinates.length,o=this.appendFlatLineCoordinates(e,t,n,r,!1,!1);return this.instructions.push([J.MOVE_TO_LINE_TO,a,o,i*this.pixelRatio]),this.hitDetectionInstructions.push([J.MOVE_TO_LINE_TO,a,o,i]),n}drawLineString(e,t,n){let r=this.state,i=r.strokeStyle,a=r.lineWidth,o=r.strokeOffset;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([J.SET_STROKE_STYLE,ql,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gl,0],ff);let s=e.getFlatCoordinates(),c=e.getStride();this.drawFlatCoordinates_(s,0,s.length,c,o),this.hitDetectionInstructions.push(df),this.endGeometry(t)}drawMultiLineString(e,t,n){let r=this.state,i=r.strokeStyle,a=r.lineWidth,o=r.strokeOffset;if(i===void 0||a===void 0)return;this.updateStrokeStyle(r,this.applyStroke),this.beginGeometry(e,t,n),this.hitDetectionInstructions.push([J.SET_STROKE_STYLE,ql,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gl,0],ff);let s=e.getEnds(),c=e.getFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e<t;++e)u=this.drawFlatCoordinates_(c,u,s[e],l,o);this.hitDetectionInstructions.push(df),this.endGeometry(t)}finish(){let e=this.state;return e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&this.instructions.push(df),this.reverseHitDetectionInstructions(),this.state=null,super.finish()}applyStroke(e){e.lastStroke!=null&&e.lastStroke!=this.coordinates.length&&(this.instructions.push(df),e.lastStroke=this.coordinates.length),e.lastStroke=0,super.applyStroke(e),this.instructions.push(ff)}},_f=class extends mf{constructor(e,t,n,r){super(e,t,n,r)}drawFlatCoordinatess_(e,t,n,r,i){let a=this.state,o=a.fillStyle!==void 0,s=a.strokeStyle!==void 0,c=n.length;this.instructions.push(ff),this.hitDetectionInstructions.push(ff);for(let a=0;a<c;++a){let o=n[a],c=this.coordinates.length,l=this.appendFlatLineCoordinates(e,t,o,r,!0,!s);this.instructions.push([J.MOVE_TO_LINE_TO,c,l,i*this.pixelRatio,!0]),this.hitDetectionInstructions.push([J.MOVE_TO_LINE_TO,c,l,i,!0]),s&&(this.instructions.push(pf),this.hitDetectionInstructions.push(pf)),t=o}return o&&(this.instructions.push(uf),this.hitDetectionInstructions.push(uf)),s&&(this.instructions.push(df),this.hitDetectionInstructions.push(df)),t}drawCircle(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawCircle(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([J.SET_FILL_STYLE,Ul]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([J.SET_STROKE_STYLE,ql,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gl,0]);let s=e.getFlatCoordinates(),c=e.getStride(),l=this.coordinates.length;this.appendFlatLineCoordinates(s,0,s.length,c,!1,!1);let u=[J.CIRCLE,l,o];this.instructions.push(ff,u),this.hitDetectionInstructions.push(ff,u),r.fillStyle!==void 0&&(this.instructions.push(uf),this.hitDetectionInstructions.push(uf)),r.strokeStyle!==void 0&&(this.instructions.push(df),this.hitDetectionInstructions.push(df)),this.endGeometry(t)}drawPolygon(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([J.SET_FILL_STYLE,Ul]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([J.SET_STROKE_STYLE,ql,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gl,0]);let s=e.getEnds(),c=e.getOrientedFlatCoordinates(),l=e.getStride();this.drawFlatCoordinatess_(c,0,s,l,o),this.endGeometry(t)}drawMultiPolygon(e,t,n){let r=this.state,i=r.fillStyle,a=r.strokeStyle,o=r.strokeOffset;if(i===void 0&&a===void 0||this.handleStrokeOffset_(()=>this.drawMultiPolygon(e,t,n)))return;this.setFillStrokeStyles_(),this.beginGeometry(e,t,n),r.fillStyle!==void 0&&this.hitDetectionInstructions.push([J.SET_FILL_STYLE,Ul]),r.strokeStyle!==void 0&&this.hitDetectionInstructions.push([J.SET_STROKE_STYLE,ql,r.lineWidth,r.lineCap,r.lineJoin,r.miterLimit,Gl,0]);let s=e.getEndss(),c=e.getOrientedFlatCoordinates(),l=e.getStride(),u=0;for(let e=0,t=s.length;e<t;++e)u=this.drawFlatCoordinatess_(c,u,s[e],l,o);this.endGeometry(t)}finish(){this.reverseHitDetectionInstructions(),this.state=null;let e=this.tolerance;if(e!==0){let t=this.coordinates;for(let n=0,r=t.length;n<r;++n)t[n]=Ka(t[n],e)}return super.finish()}setFillStrokeStyles_(){let e=this.state;this.updateFillStyle(e,this.createFill),this.updateStrokeStyle(e,this.applyStroke)}handleStrokeOffset_(e){let t=this.state,n=t.fillStyle,r=t.strokeStyle,i=t.strokeOffset;return Math.abs(i)>0&&n!==void 0&&r!==void 0&&(t.strokeStyle=void 0,t.strokeOffset=0,e(),t.fillStyle=void 0,t.strokeStyle=r,t.strokeOffset=i,e(),t.fillStyle=n,!0)}},vf=0,yf=1;function bf(e,t,n,r,i,a,o,s){let c=o-i,l=s-a,u=0,d=1;if(c===0){if(i<e||i>n)return!1}else{let t=(e-i)/c,r=(n-i)/c;if(t>r){let e=t;t=r,r=e}if(t>u&&(u=t),r<d&&(d=r),u>d)return!1}if(l===0){if(a<t||a>r)return!1}else{let e=(t-a)/l,n=(r-a)/l;if(e>n){let t=e;e=n,n=t}if(e>u&&(u=e),n<d&&(d=n),u>d)return!1}return vf=u,yf=d,!0}function xf(e,t,n,r){let i=r[0],a=r[1],o=r[2],s=r[3],c=[],l=[],u=!1,d,f,p=0;for(let r=0,m=t.length;r<m;++r){let m=t[r],h=e[p],g=e[p+1],_=!1;for(let t=p+n;t<m;t+=n){let n=e[t],r=e[t+1];if(bf(i,a,o,s,h,g,n,r)){let e=n-h,t=r-g,i=h+vf*e,a=g+vf*t,o=h+yf*e,s=g+yf*t;u&&_&&i===d&&a===f?c.push(o,s):(u&&l.push(c.length),c.push(i,a,o,s),u=!0),d=o,f=s,_=!0}h=n,g=r}p=m}return u&&l.push(c.length),{flatCoordinates:c,ends:l}}function Sf(e,t,n,r,i){let a=[],o=n,s=0,c=t.slice(n,2);for(;s<e&&o+i<r;){let[n,r]=c.slice(-2),l=t[o+i],u=t[o+i+1],d=Math.sqrt((l-n)*(l-n)+(u-r)*(u-r));if(s+=d,s>=e){let t=(e-s+d)/d,f=nn(n,l,t),p=nn(r,u,t);c.push(f,p),a.push(c),c=[f,p],s==e&&(o+=i),s=0}else if(s<e)c.push(t[o+i],t[o+i+1]),o+=i;else{let e=d-s,t=nn(n,l,e/d),f=nn(r,u,e/d);c.push(t,f),a.push(c),c=[t,f],s=0,o+=i}}return s>0&&a.push(c),a}function Cf(e,t,n,r,i){let a=n,o=n,s=0,c=0,l=n,u,d,f,p,m,h,g,_,v,y;for(d=n;d<r;d+=i){let n=t[d],r=t[d+1];m!==void 0&&(v=n-m,y=r-h,p=Math.sqrt(v*v+y*y),g!==void 0&&(c+=f,u=Math.acos((g*v+_*y)/(f*p)),u>e&&(c>s&&(s=c,a=l,o=d),c=0,l=d-i)),f=p,g=v,_=y),m=n,h=r}return c+=p,c>s?[l,d]:[a,o]}var wf={left:0,center:.5,right:1,top:0,middle:.5,hanging:.2,alphabetic:.8,ideographic:.8,bottom:1},Tf={Circle:_f,Default:mf,Image:hf,LineString:gf,Polygon:_f,Text:class extends mf{constructor(e,t,n,r){super(e,t,n,r),this.labels_=null,this.text_=``,this.textOffsetX_=0,this.textOffsetY_=0,this.textRotateWithView_=void 0,this.textKeepUpright_=void 0,this.textRotation_=0,this.textFillState_=null,this.fillStates={},this.fillStates[Ul]={fillStyle:Ul},this.textStrokeState_=null,this.strokeStates={},this.textState_={},this.textStates={},this.textKey_=``,this.fillKey_=``,this.strokeKey_=``,this.declutterMode_=void 0,this.declutterImageWithText_=void 0}finish(){let e=super.finish();return e.textStates=this.textStates,e.fillStates=this.fillStates,e.strokeStates=this.strokeStates,e}drawText(e,t,n){let r=this.textFillState_,i=this.textStrokeState_,a=this.textState_;if(this.text_===``||!a||!r&&!i)return;let o=this.coordinates,s=o.length,c=e.getType(),l=null,u=e.getStride();if(a.placement===`line`&&(c==`LineString`||c==`MultiLineString`||c==`Polygon`||c==`MultiPolygon`)){let r=e.getExtent();if(!Un(this.maxExtent,r))return;let i;if(l=e.getFlatCoordinates(),c==`LineString`)i=[l.length];else if(c==`MultiLineString`)i=e.getEnds();else if(c==`Polygon`)i=e.getEnds().slice(0,1);else if(c==`MultiPolygon`){let t=e.getEndss();i=[];for(let e=0,n=t.length;e<n;++e)i.push(t[e][0])}if((c==`LineString`||c==`MultiLineString`)&&!_n(this.getBufferedMaxExtent(),r)){let e=xf(l,i,u,this.getBufferedMaxExtent());if(l=e.flatCoordinates,i=e.ends,u=2,i.length===0)return}this.beginGeometry(e,t,n);let d=a.repeat,f=d?void 0:a.textAlign,p=0;for(let e=0,t=i.length;e<t;++e){let t;t=d?Sf(d*this.resolution,l,p,i[e],u):[l.slice(p,i[e])];for(let n=0,r=t.length;n<r;++n){let r=t[n],c=0,l=r.length;if(f==null){let e=Cf(a.maxAngle,r,0,r.length,2);c=e[0],l=e[1]}for(let e=c;e<l;e+=u)o.push(r[e],r[e+1]);let d=o.length;p=i[e],this.drawChars_(s,d),s=d}}this.endGeometry(t)}else{let r=a.overflow?null:[];switch(c){case`Point`:case`MultiPoint`:l=e.getFlatCoordinates();break;case`LineString`:l=e.getFlatMidpoint();break;case`Circle`:l=e.getCenter();break;case`MultiLineString`:l=e.getFlatMidpoints(),u=2;break;case`Polygon`:l=e.getFlatInteriorPoint(),a.overflow||r.push(l[2]/this.resolution),u=3;break;case`MultiPolygon`:let t=e.getFlatInteriorPoints();l=[];for(let e=0,n=t.length;e<n;e+=3)a.overflow||r.push(t[e+2]/this.resolution),l.push(t[e],t[e+1]);if(l.length===0)return;u=2}let i=this.appendFlatPointCoordinates(l,u);if(i===s)return;if(r&&(i-s)/2!==l.length/u){let e=s/2;r=r.filter((t,n)=>{let r=o[(e+n)*2]===l[n*u]&&o[(e+n)*2+1]===l[n*u+1];return r||--e,r})}this.saveTextStates_();let d=a.backgroundFill?this.createFill(this.fillStyleToState(a.backgroundFill)):null,f=a.backgroundStroke?this.createStroke(this.strokeStyleToState(a.backgroundStroke)):null;this.beginGeometry(e,t,n);let p=a.padding;if(p!=Xl&&(a.scale[0]<0||a.scale[1]<0)){let e=a.padding[0],t=a.padding[1],n=a.padding[2],r=a.padding[3];a.scale[0]<0&&(t=-t,r=-r),a.scale[1]<0&&(e=-e,n=-n),p=[e,t,n,r]}let m=this.pixelRatio;this.instructions.push([J.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[1,1],NaN,this.declutterMode_,this.declutterImageWithText_,p==Xl?Xl:p.map(function(e){return e*m}),d,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]);let h=1/m,g=d?d.slice(0):null;g&&(g[1]=Ul),this.hitDetectionInstructions.push([J.DRAW_IMAGE,s,i,null,NaN,NaN,NaN,1,0,0,this.textRotateWithView_,this.textRotation_,[h,h],NaN,this.declutterMode_,this.declutterImageWithText_,p,g,f,this.text_,this.textKey_,this.strokeKey_,this.fillKey_?Ul:this.fillKey_,this.textOffsetX_,this.textOffsetY_,r]),this.endGeometry(t)}}saveTextStates_(){let e=this.textStrokeState_,t=this.textState_,n=this.textFillState_,r=this.strokeKey_;e&&(r in this.strokeStates||(this.strokeStates[r]={strokeStyle:e.strokeStyle,lineCap:e.lineCap,lineDashOffset:e.lineDashOffset,lineWidth:e.lineWidth,lineJoin:e.lineJoin,miterLimit:e.miterLimit,lineDash:e.lineDash}));let i=this.textKey_;i in this.textStates||(this.textStates[i]={font:t.font,textAlign:t.textAlign||`center`,justify:t.justify,textBaseline:t.textBaseline||`middle`,scale:t.scale});let a=this.fillKey_;n&&(a in this.fillStates||(this.fillStates[a]={fillStyle:n.fillStyle}))}drawChars_(e,t){let n=this.textStrokeState_,r=this.textState_,i=this.strokeKey_,a=this.textKey_,o=this.fillKey_;this.saveTextStates_();let s=this.pixelRatio,c=wf[r.textBaseline],l=this.textOffsetX_*s,u=this.textOffsetY_*s,d=this.text_,f=n?n.lineWidth*Math.abs(r.scale[0])/2:0;this.instructions.push([J.DRAW_CHARS,e,t,c,r.overflow,o,r.maxAngle,s,u,i,f*s,d,a,1,this.declutterMode_,this.textKeepUpright_,l]),this.hitDetectionInstructions.push([J.DRAW_CHARS,e,t,c,r.overflow,o&&Ul,r.maxAngle,s,u,i,f*s,d,a,1/s,this.declutterMode_,this.textKeepUpright_,l])}setTextStyle(e,t){let n,r,i;if(!e)this.text_=``;else{let t=e.getFill();t?(r=this.textFillState_,r||(r={},this.textFillState_=r),r.fillStyle=Bl(t.getColor()||`#000`)):(r=null,this.textFillState_=r);let a=e.getStroke();if(!a)i=null,this.textStrokeState_=i;else{i=this.textStrokeState_,i||(i={},this.textStrokeState_=i);let e=a.getLineDash(),t=a.getLineDashOffset(),n=a.getWidth(),r=a.getMiterLimit();i.lineCap=a.getLineCap()||`round`,i.lineDash=e?e.slice():Gl,i.lineDashOffset=t===void 0?0:t,i.lineJoin=a.getLineJoin()||`round`,i.lineWidth=n===void 0?1:n,i.miterLimit=r===void 0?10:r,i.strokeStyle=Bl(a.getColor()||`#000`)}n=this.textState_;let o=e.getFont()||`10px sans-serif`;ru(o);let s=e.getScaleArray();n.overflow=e.getOverflow(),n.font=o,n.maxAngle=e.getMaxAngle(),n.placement=e.getPlacement(),n.textAlign=e.getTextAlign(),n.repeat=e.getRepeat(),n.justify=e.getJustify(),n.textBaseline=e.getTextBaseline()||`middle`,n.backgroundFill=e.getBackgroundFill(),n.backgroundStroke=e.getBackgroundStroke(),n.padding=e.getPadding()||Xl,n.scale=s===void 0?[1,1]:s;let c=e.getOffsetX(),l=e.getOffsetY(),u=e.getRotateWithView(),d=e.getKeepUpright(),f=e.getRotation();this.text_=e.getText()||``,this.textOffsetX_=c===void 0?0:c,this.textOffsetY_=l===void 0?0:l,this.textRotateWithView_=u!==void 0&&u,this.textKeepUpright_=d===void 0||d,this.textRotation_=f===void 0?0:f,this.strokeKey_=i?(typeof i.strokeStyle==`string`?i.strokeStyle:I(i.strokeStyle))+i.lineCap+i.lineDashOffset+`|`+i.lineWidth+i.lineJoin+i.miterLimit+`[`+i.lineDash.join()+`]`:``,this.textKey_=n.font+n.scale+(n.textAlign||`?`)+(n.repeat||`?`)+(n.justify||`?`)+(n.textBaseline||`?`),this.fillKey_=r&&r.fillStyle?typeof r.fillStyle==`string`?r.fillStyle:`|`+I(r.fillStyle):``}this.declutterMode_=e.getDeclutterMode(),this.declutterImageWithText_=t}}},Ef=class{constructor(e,t,n,r){this.tolerance_=e,this.maxExtent_=t,this.pixelRatio_=r,this.resolution_=n,this.buildersByZIndex_={}}finish(){let e={};for(let t in this.buildersByZIndex_){e[t]=e[t]||{};let n=this.buildersByZIndex_[t];for(let r in n){let i=n[r].finish();e[t][r]=i}}return e}getBuilder(e,t){let n=e===void 0?`0`:e.toString(),r=this.buildersByZIndex_[n];r===void 0&&(r={},this.buildersByZIndex_[n]=r);let i=r[t];if(i===void 0){let e=Tf[t];i=new e(this.tolerance_,this.maxExtent_,this.resolution_,this.pixelRatio_),r[t]=i}return i}},Df;function Of(){return Df||=new Intl.Segmenter(void 0,{granularity:`grapheme`}),Df}function kf(e,t,n,r,i,a,o,s,c,l,u,d,f=!0){let p=e[t],m=e[t+1],h=0,g=0,_=0,v=0;function y(){h=p,g=m,t+=r,p=e[t],m=e[t+1],v+=_,_=Math.sqrt((p-h)*(p-h)+(m-g)*(m-g))}do y();while(t<n-r&&v+_<a);let b=_===0?0:(a-v)/_,x=nn(h,p,b),S=nn(g,m,b),C=t-r,w=v,T=a+s*c(l,i,u);for(;t<n-r&&v+_<T;)y();b=_===0?0:(T-v)/_;let E=nn(h,p,b),D=nn(g,m,b),O=!1;if(f){if(d){let e=[x,S,E,D];sa(e,0,4,2,d,e,e),O=e[0]>e[2]}else O=x>E}let k=Math.PI,ee=[],te=C+r===t;t=C,_=0,v=w,p=e[t],m=e[t+1];let ne;if(te)return y(),ne=Math.atan2(m-g,p-h),O&&(ne+=ne>0?-k:k),ee[0]=[(E+x)/2,(D+S)/2,(T-a)/2,ne,i],ee;i=i.replace(/\n/g,` `);let re=Array.from(Of().segment(i),e=>e.segment);for(let e=0,i=re.length;e<i;){y();let d=Math.atan2(m-g,p-h);if(O&&(d+=d>0?-k:k),ne!==void 0){let e=d-ne;if(e+=e>k?-2*k:e<-k?2*k:0,Math.abs(e)>o)return null}ne=d;let f=e,x=0;for(;e<i;++e){let o=s*c(l,re[O?i-e-1:e],u);if(t+r<n&&v+_<a+x+o/2)break;x+=o}if(e===f)continue;let S=(O?re.slice(i-e,i-f):re.slice(f,e)).join(``);b=_===0?0:(a+x/2-v)/_;let C=nn(h,p,b),w=nn(g,m,b);ee.push([C,w,x/2,d,S]),a+=x}return ee}var Af=class{constructor(){this.instructions_=[],this.zIndex=0,this.offset_=0,this.pendingMethod_,this.context_=new Proxy(Ro(),{get:(e,t)=>{if(typeof e[t]==`function`)return this.pendingMethod_=t,this.pushMethodArgs_},set:(e,t,n)=>(this.push_(t,n),!0)})}push_(...e){let t=this.instructions_,n=this.zIndex+this.offset_;t[n]||(t[n]=[]),t[n].push(...e)}pushMethodArgs_=(...e)=>{this.push_(this.pendingMethod_,e)};pushFunction(e){this.push_(e)}getContext(){return this.context_}draw(e){this.instructions_.forEach(t=>{for(let n=0,r=t.length;n<r;++n){let r=t[n];if(typeof r==`function`){r(e);continue}let i=t[++n];typeof e[r]==`function`?e[r](...i):e[r]=typeof i==`function`?i(e):i}})}clear(){this.instructions_.length=0,this.zIndex=0,this.offset_=0}offset(){this.offset_=this.instructions_.length,this.zIndex=0}},jf=bn(),Mf=[],Nf=[],Pf=[],Ff=[];function If(e){return e[3].declutterBox}var Lf=RegExp(`[֑-ࣿיִ-﷿ﹰ-ﻼࠀ--]`);function Rf(e,t){return t===`start`?t=Lf.test(e)?`right`:`left`:t===`end`&&(t=Lf.test(e)?`left`:`right`),wf[t]}function zf(e,t,n){return n>0&&e.push(`
|
|
4
4
|
`,``),e.push(t,``),e}function Bf(e,t,n){return n%2==0&&(e+=t),e}var Vf=class{constructor(e,t,n,r,i){this.overlaps=n,this.pixelRatio=t,this.resolution=e,this.alignAndScaleFill_,this.instructions=r.instructions,this.coordinates=r.coordinates,this.coordinateCache_={},this.renderedTransform_=Gi(),this.hitDetectionInstructions=r.hitDetectionInstructions,this.pixelCoordinates_=null,this.viewRotation_=0,this.fillStates=r.fillStates||{},this.strokeStates=r.strokeStates||{},this.textStates=r.textStates||{},this.widths_={},this.labels_={},this.zIndexContext_=i?new Af:null}getZIndexContext(){return this.zIndexContext_}createLabel(e,t,n,r){let i=e+t+n+r;if(this.labels_[i])return this.labels_[i];let a=r?this.strokeStates[r]:null,o=n?this.fillStates[n]:null,s=this.textStates[t],c=this.pixelRatio,l=[s.scale[0]*c,s.scale[1]*c],u=s.justify?wf[s.justify]:Rf(Array.isArray(e)?e[0]:e,s.textAlign||`center`),d=r&&a.lineWidth?a.lineWidth:0,f=Array.isArray(e)?e:String(e).split(`
|
|
@@ -14,4 +14,4 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
|
|
|
14
14
|
`)return t.push(`
|
|
15
15
|
`,``),t;if(x==2)return t.push(rx(s,ce),a),t;s=lx(s,a,le,ce).split(`
|
|
16
16
|
`);for(let e=0,n=s.length;e<n;++e)e>0&&t.push(`
|
|
17
|
-
`,``),t.push(s[e],a);return t},[]):Sx(n,g).trim(),l=$(d,`paint`,`text-opacity`,C,m,w)}if(ie&&l&&!re){O||(++T,b=_[T],(!b||!b.getText()||b.getFill()||b.getStroke())&&(b=new vu,_[T]=b),b.setImage(void 0),b.setGeometry(void 0));let e=vx(d,C,`text`,m);b.getText()||b.setText(k),k=b.getText(),(!k||`getDeclutterMode`in k&&k.getDeclutterMode()!==e)&&(k=new wu({padding:[2,2,2,2],declutterMode:e}),b.setText(k));let t=$(d,`layout`,`text-transform`,C,m,w);t==`uppercase`?ie=Array.isArray(ie)?ie.map((e,t)=>t%2?e:e.toUpperCase()):ie.toUpperCase():t==`lowercase`&&(ie=Array.isArray(ie)?ie.map((e,t)=>t%2?e:e.toLowerCase()):ie.toLowerCase());let n=Array.isArray(ie)?ie:x==2?rx(ie,ce):lx(ie,ae,le,ce);if(k.setText(n),k.setFont(ae),k.setRotation(Ub($(d,`layout`,`text-rotate`,C,m,w))),typeof k.setKeepUpright==`function`){let e=$(d,`layout`,`text-keep-upright`,C,m,w);k.setKeepUpright(e)}let r=$(d,`layout`,`text-anchor`,C,m,w),i=O||x==1?`point`:$(d,`layout`,`symbol-placement`,C,m,w),a;if(i===`line-center`?(k.setPlacement(`line`),a=`center`):k.setPlacement(i),i===`line`&&typeof k.setRepeat==`function`){let e=$(d,`layout`,`symbol-spacing`,C,m,w);k.setRepeat(e*2)}k.setOverflow(i===`point`);let o=$(d,`paint`,`text-halo-width`,C,m,w),s=$(d,`layout`,`text-offset`,C,m,w),c=$(d,`paint`,`text-translate`,C,m,w),u=0,f=0;if(i==`point`){a=`center`,r.indexOf(`left`)===-1?r.indexOf(`right`)!==-1&&(a=`right`,f=-o):(a=`left`,f=o);let e=$(d,`layout`,`text-rotation-alignment`,C,m,w);k.setRotateWithView(e==`map`)}else k.setMaxAngle(Ub($(d,`layout`,`text-max-angle`,C,m,w))*ie.length/n.length),k.setRotateWithView(!1);k.setTextAlign(a);let p=`middle`;r.indexOf(`bottom`)==0?(p=`bottom`,u=-o-.5*(oe-1)*se):r.indexOf(`top`)==0&&(p=`top`,u=o+.5*(oe-1)*se),k.setTextBaseline(p);let h=$(d,`layout`,`text-justify`,C,m,w);k.setJustify(h===`auto`?void 0:h),k.setOffsetX(s[0]*se+f+c[0]),k.setOffsetY(s[1]*se+u+c[1]);let g=k.getFill()||new mu;g.setColor(bx($(d,`paint`,`text-color`,C,m,w),l)),k.setFill(g);let v=bx($(d,`paint`,`text-halo-color`,C,m,w),l);if(v&&o>0){let e=k.getStroke()||new _u;e.setColor(v),o*=2;let t=.5*se;e.setWidth(o<=t?o:t),k.setStroke(e)}else k.setStroke(void 0);let y=$(d,`layout`,`text-padding`,C,m,w),S=k.getPadding();y!==S[0]&&(S[0]=y,S[1]=y,S[2]=y,S[3]=y),b.setZIndex(D)}}}if(T>-1)return _.length=T+1,_};return e.setStyle(v),e.set(`mapbox-layers`,d),e.set(`mapbox-source`,g),e.set(`mapbox-featurestate`,e.get(`mapbox-featurestate`)||{}),v}qh.parse(`#000000`),qh.parse(`#FFFFFF`),qh.parse(`#000000`);function Ex(e,t=512){return e.getExtent()?om({extent:e.getExtent(),tileSize:t,maxZoom:22}).getResolutions():Wb}function Dx(e,t){return t.accessToken||(t=Object.assign({},t),new URL(e).searchParams.forEach((e,n)=>{t.accessToken=e,t.accessTokenParam=n})),t}function Ox(e,t,n=``,r={},i=void 0){let a,o,s,c,l=!0;return typeof n!=`string`&&!Array.isArray(n)?(s=n,c=s.source||s.layers,r=s):c=n,typeof r==`string`?(a=r,s={}):(a=r.styleUrl,s=r),s.updateSource===!1&&(l=!1),i||=s.resolutions,!a&&typeof t==`string`&&!t.trim().startsWith(`{`)&&(a=t),a&&(a=a.startsWith(`data:`)?location.href:Eb(a,s.accessToken),s=Dx(a,s)),new Promise(function(n,r){Xb(t,s).then(function(t){if(t.version!=8)return r(Error(`glStyle version 8 required.`));if(!(e instanceof sp||e instanceof qp))return r(Error(`Can only apply to VectorLayer or VectorTileLayer`));let u=e instanceof qp?`vector`:`geojson`;if(c?o=Array.isArray(c)?t.layers.find(function(e){return e.id===c[0]}).source:c:(o=t.layers.find(function(e){return e.source&&t.sources[e.source].type===u}).source,c=o),!o)return r(Error(`No ${u} source found in the glStyle.`));function d(){if(!l)return Promise.resolve();if(e instanceof qp)return jx(t.sources[o],a,s).then(function(t){let n=e.getSource();n?t!==n&&(n.setTileUrlFunction(t.getTileUrlFunction()),typeof n.setUrls==`function`&&typeof t.getUrls==`function`&&n.setUrls(t.getUrls()),n.format_||=t.format_,n.getAttributions()||n.setAttributions(t.getAttributions()),n.getTileLoadFunction()===Rm&&n.setTileLoadFunction(t.getTileLoadFunction()),ki(n.getProjection(),t.getProjection())&&(n.tileGrid=t.getTileGrid())):e.setSource(t);let r=e.getSource().getTileGrid();!isFinite(e.getMaxResolution())&&!isFinite(e.getMinZoom())&&r.getMinZoom()>0&&e.setMaxResolution(qb(Math.max(0,r.getMinZoom()-1e-12),r.getResolutions()))});let n=t.sources[o],r=e.getSource();(!r||r.get(`mapbox-source`)!==n)&&(r=Nx(n,a,s));let i=e.getSource();return i?r!==i&&(i.getAttributions()||i.setAttributions(r.getAttributions()),i.format_||=r.getFormat(),i.url_=r.getUrl()):e.setSource(r),Promise.resolve()}let f,p,m={},h={};function g(){if(!p&&(!t.sprite||m)){if(s.projection&&!i){let e=B(s.projection).getUnits();e!==`m`&&(i=Wb.map(t=>t/hr[e]))}let a,l=e.getSource();l instanceof Lm&&l.format_ instanceof db&&(a=l.format_.layerName_),p=Tx(e,t,c,i,m,h,(e,t=s.webfonts)=>fx(e,t),s.getImage,a),e.getStyle()?d().then(n).catch(r):r(Error(`Nothing to show for source [${o}]`))}else p?(e.setStyle(p),d().then(n).catch(r)):r(Error(`Something went wrong trying to apply style.`))}if(t.sprite){let e=wb(t.sprite,s.accessToken,a||location.href);f=It?1:window.devicePixelRatio>=1.5?.5:1;let n=f==.5?`@2x`:``;Promise.all(e.map(function(e){let t=new URL(e.url),i=t.origin+t.pathname+n+`.json`+t.search;return new Promise(function(e,n){Yb(`Sprite`,i,s).then(e).catch(function(r){i=t.origin+t.pathname+`.json`+t.search,Yb(`Sprite`,i,s).then(e).catch(n)})}).then(function(i){i===void 0&&r(Error(`No sprites found.`));let a;if(a=t.origin+t.pathname+n+`.png`+t.search,s.transformRequest){let e=s.transformRequest(a,`SpriteImage`)||a;(e instanceof Request||e instanceof Promise)&&(a=e)}h[e.id]=a;for(let t in i){let n=e.id=="default"?t:`${e.id}:${t}`;m[n]=i[t]}}).catch(function(e){r(Error(`Sprites cannot be loaded: ${i}: ${e.message}`))})})).then(g).catch(r)}else g()}).catch(r)})}function kx(e,t){let n=e.bounds;if(n){let e=Di([n[0],n[1]],t),r=Di([n[2],n[3]],t);return[e[0],e[1],r[0],r[1]]}return B(t).getExtent()}function Ax(e,t,n){let r=new Vm({tileJSON:t,tileSize:e.tileSize||t.tileSize||512}),i=r.getTileJSON(),a=r.getTileGrid(),o=B(n.projection||`EPSG:3857`),s=kx(i,o),c=o.getExtent(),l=i.minzoom||0,u=i.maxzoom||22,d={attributions:r.getAttributions(),projection:o,tileGrid:new nm({origin:c?Vn(c):a.getOrigin(0),extent:s||a.getExtent(),minZoom:l,resolutions:Ex(o,t.tileSize).slice(0,u+1),tileSize:a.getTileSize(0)})};return Array.isArray(i.tiles)?d.urls=i.tiles:d.url=i.tiles,d}function jx(e,t,n){return new Promise(function(r,i){Qb(e,t,n).then(function({tileJson:t,tileLoadFunction:i}){let a=Ax(e,t,n);a.tileLoadFunction=i,a.format=new db({layerName:`mvt:layer`});let o=new Lm(a);o.set(`mapbox-source`,e),r(o)}).catch(i)})}function Mx(e){return`{bbox-${(e?e.getCode():`EPSG:3857`).toLowerCase().replace(/[^a-z0-9]/g,`-`)}}`}function Nx(e,t,n){let r=n.projection?new Iy({dataProjection:n.projection}):new Iy,i=e.data,a={};if(typeof i==`string`){let[a]=Ob(i,n.accessToken,n.accessTokenParam||`access_token`,t||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){let t=(e,t,n)=>{let r=Mx(n);return a.replace(r,`${e.join(`,`)}`)},i=new lf({attributions:e.attribution,format:r,loader:(e,r,a,o,s)=>{Yb(`GeoJSON`,typeof t==`function`?t(e,r,a):t,n).then(e=>{let t=i.getFormat().readFeatures(e,{featureProjection:a});i.addFeatures(t),o(t)}).catch(t=>{i.removeLoadedExtent(e),s()})},strategy:Xd});return i.set(`mapbox-source`,e),i}let o=new lf({attributions:e.attribution,format:r,url:a,loader:(e,t,r,i,s)=>{Yb(`GeoJSON`,a,n).then(e=>{let t=o.getFormat().readFeatures(e,{featureProjection:r});o.addFeatures(t),i(t)}).catch(t=>{o.removeLoadedExtent(e),s()})}});return o}a.features=r.readFeatures(i,{featureProjection:Ii()||`EPSG:3857`});let o=new lf(Object.assign({attributions:e.attribution,format:r},a));return o.set(`mapbox-source`,e),o}var Px={touch:`ontouchstart`in window||navigator.maxTouchPoints>0,mobile:window.matchMedia?.(`(pointer: coarse)`).matches??!1,orientation:function(){return window.innerWidth>window.innerHeight?`landscape`:`portrait`}},Fx=class{constructor(e,t,n){this._el={container:{},map:{},map_mask:{}},typeof e==`object`?this._el.container=e:this._el.container=M.get(e),this._loaded={data:!1,map:!1},this._map=null,this._mini_map=null,this._markers=[],this.zoom_min_max={min:null,max:null},this._line=null,this._line_active=null,this.current_marker=0,this.bounds_array=null,this._tile_layer=null,this._tile_layer_mini=null,this._image_layer=null,this.data={uniqueid:``,slides:[{test:`yes`},{test:`yes`},{test:`yes`}]},this.options={map_type:`osm:standard`,map_as_image:!1,map_mini:!1,map_background_color:`#d9d9d9`,map_subdomains:``,map_access_token:``,iiif:{url:``,attribution:``},skinny_size:650,less_bounce:!0,path_gfx:`gfx`,start_at_slide:0,map_popup:!1,zoom_distance:100,calculate_zoom:!0,line_follows_path:!0,line_color:`#333`,line_color_inactive:`#000`,line_weight:5,line_opacity:.2,line_dash:`5,5`,line_join:`miter`,show_lines:!0,show_history_line:!0,map_center_offset:null},this.animator=null,this._transition_duration=this.options.duration,this.timer=null,this.touch_scale=1,this.scroll={start_time:null},f(this.options,n),f(this.data,t),this._initLayout(),this._initEvents(),this._createMap(),this._initData()}updateDisplay(e,t,n,r,i){this._updateDisplay(e,t,n,r,i)}goTo(e,t){if(e<this._markers.length&&e>=0){let n,r=this.current_marker;this.current_marker=e;let i=Math.abs(e-r);this._transition_duration=Math.max(600,Math.min(1e3+i*120,2e3));let a=this._markers[this.current_marker];if(this.animator&&this.animator.stop(),this._resetMarkersActive(),a.data.type&&a.data.type===`overview`)this._markerOverview(),t||this._onMarkerChange();else if(a.active(!0),t)a.data.location&&this._viewTo(a.data.location,{duration:this._transition_duration});else{if(this._hasLocation(a.data)){if(n=this._calculateZoomChange(this._getMapCenter(!0),a.location()),this._viewTo(a.data.location,{calculate_zoom:this.options.calculate_zoom,zoom:n,duration:this._transition_duration}),this.options.line_follows_path){if(this.options.show_history_line&&a.data.real_marker&&this._markers[r].data.real_marker){let e=[],t=0,n,i=null,o=null;if(r<this.current_marker){for(;t<this.current_marker;)this._hasLocation(this._markers[t].data)&&(n={lat:this._markers[t].data.location.lat,lon:this._markers[t].data.location.lon},e.push(n)),t++;let i=[];for(let e=0;e<=r;e++)this._hasLocation(this._markers[e].data)&&i.push({lat:this._markers[e].data.location.lat,lon:this._markers[e].data.location.lon});o=i}else if(r>this.current_marker){let t=[];for(let e=0;e<=this.current_marker;e++)this._hasLocation(this._markers[e].data)&&t.push({lat:this._markers[e].data.location.lat,lon:this._markers[e].data.location.lon});let n=[];for(let e=0;e<=r;e++)this._hasLocation(this._markers[e].data)&&n.push({lat:this._markers[e].data.location.lat,lon:this._markers[e].data.location.lon});e=t,i=n}i||e.push({lat:a.data.location.lat,lon:a.data.location.lon}),this._replaceLines(this._line_active,e,{duration:this._transition_duration,retractFrom:i,growFrom:o})}}else this.options.show_history_line&&a.data.real_marker&&this._markers[r].data.real_marker&&this._replaceLines(this._line_active,[{lat:a.data.location.lat,lon:a.data.location.lon},{lat:this._markers[r].data.location.lat,lon:this._markers[r].data.location.lon}],{duration:this._transition_duration})}else this._markerOverview(),t||this._onMarkerChange();this._onMarkerChange()}}}panTo(e,t){this._panTo(e,t)}zoomTo(e,t){this._zoomTo(e,t)}viewTo(e,t){this._viewTo(e,t)}getBoundsZoom(e,t,n,r){this._getBoundsZoom(e,t,n,r)}markerOverview(){this._markerOverview()}calculateMarkerZooms(){this._calculateMarkerZooms()}createMiniMap(){this._createMiniMap()}setMapOffset(e,t){this.options.map_center_offset?(this.options.map_center_offset.left=e,this.options.map_center_offset.top=t):this.options.map_center_offset={left:e,top:t}}calculateMinMaxZoom(){for(let e=0;e<this._markers.length;e++)this._markers[e].data.location&&this._markers[e].data.location.zoom&&this.updateMinMaxZoom(this._markers[e].data.location.zoom)}updateMinMaxZoom(e){this.zoom_min_max.max||(this.zoom_min_max.max=e),this.zoom_min_max.min||(this.zoom_min_max.min=e),this.zoom_min_max.max<e&&(this.zoom_min_max.max=e),this.zoom_min_max.min>e&&(this.zoom_min_max.min=e)}initialMapLocation(){this._loaded.data&&this._loaded.map&&this.current_marker===0&&this.goTo(this.options.start_at_slide,!0)}show(){}hide(){}createMarkers(e){this._createMarkers(e)}createMarker(e){this._createMarker(e)}_destroyMarker(e){this._removeMarker(e);for(let t=0;t<this._markers.length;t++)this._markers[t]===e&&this._markers.splice(t,1);this.fire(`markerRemoved`,e)}_createMarkers(e){for(let t=0;t<e.length;t++)this._createMarker(e[t]),this._hasLocation(e[t])&&this.options.show_lines&&this._addToLine(this._line,e[t])}_hasLocation(e){return!!e.location&&typeof e.location.lat==`number`&&typeof e.location.lon==`number`}_createMap(){}_createMiniMap(){}_createMarker(e){let t={};t.on(`markerclick`,this._onMarkerClick),this._addMarker(t),this._markers.push(t),t.marker_number=this._markers.length-1,this.fire(`markerAdded`,t)}_addMarker(e){}_removeMarker(e){}_resetMarkersActive(){for(let e=0;e<this._markers.length;e++)this._markers[e].active(!1)}_calculateMarkerZooms(){}_createLine(e){return{data:e}}_addToLine(e,t){}_replaceLines(e,t,n){}_addLineToMap(e){}_panTo(e,t){}_zoomTo(e,t){}_viewTo(e,t){}_updateMapDisplay(e,t){}_refreshMap(){}_getMapZoom(){return 1}_getMapCenter(e){return{lat:0,lng:0}}_getBoundsZoom(e,t,n,r){}_markerOverview(e){}getRouteDistance(){}_onMarkerChange(e){this.fire(`change`,{current_marker:this.current_marker})}_onMarkerClick(e){this.current_marker!==e.marker_number&&this.goTo(e.marker_number,!1)}_onMapLoaded(e){this._loaded.map||(this._loaded.map=!0,this.options.calculate_zoom&&this.calculateMarkerZooms(),this.calculateMinMaxZoom(),this.options.map_mini&&!Px.touch&&this.createMiniMap(),this.initialMapLocation(),this.fire(`loaded`,this.data))}_onWheel(e){if(e.ctrlKey){let t=Math.exp(-e.deltaY/100);this.touch_scale*=t,e.preventDefault(),e.stopPropagation()}this.scroll.start_time||(this.scroll.start_time=+new Date);let t=Math.max(40-(+new Date-this.scroll.start_time),0);clearTimeout(this.scroll.timer),this.scroll.timer=setTimeout(()=>{this._scollZoom()},t)}_scollZoom(e){let t=this._getMapZoom();this.scroll.start_time=null,clearTimeout(this.scroll.timer),clearTimeout(this.scroll.timer_done),this.scroll.timer_done=setTimeout(()=>{this._scollZoomDone()},1e3),this.zoomTo(Math.round(t*this.touch_scale))}_scollZoomDone(e){this.touch_scale=1}_calculateZoomChange(e,t,n){return this._getBoundsZoom(e,t,n)}_updateDisplay(e,t,n,r,i){this._updateMapDisplay(n,r)}applyOptions(e){}_initLayout(){this._el.map_mask=M.create(`div`,`vco-map-mask`,this._el.container),this.options.map_as_image?this._el.map=M.create(`div`,`vco-map-display vco-mapimage-display`,this._el.map_mask):this._el.map=M.create(`div`,`vco-map-display`,this._el.map_mask)}_initData(){this.data.slides&&(this._createMarkers(this.data.slides),this._afterCreateMarkers(),this._resetMarkersActive(),this._markers.length>0&&this._markers[this.current_marker].active(!0),this._loaded.data=!0)}_afterCreateMarkers(){}_initEvents(){this._el.map.addEventListener(`wheel`,e=>{this._onWheel(e)})}},Ix=class extends Qe(Ze(Fx)){constructor(...e){super(...e)}},Lx=class{constructor(e,t){this._el={container:{},content_container:{},content:{}},this._marker={},this._icon={},this._custom_icon=!1,this._custom_icon_url=``,this._custom_image_icon=!1,this.marker_number=0,this.media_icon_class=``,this.timer={},this.data={},this.options={duration:1e3,ease:Xe,width:600,height:600,map_popup:!1},this.animator=null,f(this.options,t),f(this.data,e),this._initLayout()}show(){}hide(){}addTo(e){this._addTo(e)}removeFrom(e){this._removeFrom(e)}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}createMarker(e,t){this._createMarker(e,t)}active(e){this._active(e)}location(){return this._location()}_createMarker(e,t){}_addTo(e){}_removeFrom(e){}_active(e){}_location(){return{lat:0,lng:0}}_onMarkerClick(e){this.fire(`markerclick`,{marker_number:this.marker_number})}_initLayout(){this._createMarker(this.data,this.options)}_updateDisplay(e,t,n){}},Rx=class extends Ze(Lx){constructor(...e){super(...e)}},zx=class extends Rx{_createMarker(e,t){if(e.location&&typeof e.location.lat==`number`&&typeof e.location.lon==`number`){this.data.real_marker=!0;let n=t.use_custom_markers||e.location.use_custom_marker;n&&e.location.icon?this._custom_icon={url:e.location.icon,size:e.location.iconSize||[48,48],anchor:this._customIconAnchor(e.location.iconSize)}:n&&e.location.image&&(this._custom_image_icon=e.location.image),this._marker=this._createMarkerElement(e,t),this._marker.addEventListener(`click`,e=>{e.stopPropagation(),this._onMarkerClick(e)})}}_createMarkerElement(e,t){let n=document.createElement(`div`);if(n.title=e.text&&e.text.headline?e.text.headline:``,this._custom_icon){n.className=`vco-mapmarker-custom`;let e=document.createElement(`img`);e.src=this._custom_icon.url,e.style.width=this._custom_icon.size[0]+`px`,e.style.height=`auto`,n.appendChild(e),n.style.marginLeft=-this._custom_icon.anchor[0]+`px`,n.style.marginTop=-this._custom_icon.anchor[1]+`px`}else if(this._custom_image_icon){n.className=`vco-mapmarker-image-icon`;let e=document.createElement(`img`);e.src=this._custom_image_icon,e.style.width=`48px`,e.style.height=`auto`,n.appendChild(e),n.style.marginLeft=`-24px`,n.style.marginTop=`-48px`}else n.className=`vco-mapmarker `+this.media_icon_class;return n}_addTo(e){if(this.data.real_marker){let t=this.data,n=e.getView().getProjection().getCode()===`EPSG:4326`?[t.location.lon,t.location.lat]:Di([t.location.lon,t.location.lat]),r=!this._custom_icon&&!this._custom_image_icon;this._overlay=new Um({element:this._marker,position:n,stopEvent:!1,...r?{positioning:`bottom-center`,offset:[0,1]}:{}}),e.addOverlay(this._overlay)}}_removeFrom(e){this.data.real_marker&&this._overlay&&e.removeOverlay(this._overlay)}_active(e){if(this.media_icon_class=this.data.media&&this.data.media.mediatype?`vco-mapmarker-icon vco-icon-`+this.data.media.mediatype.type:`vco-mapmarker-icon vco-icon-plaintext`,this.data.real_marker){this._custom_icon?(e||clearTimeout(this.timer),this._marker.style.zIndex=e?`1000`:``):this._custom_image_icon?e?(this._marker.classList.remove(`vco-mapmarker-image-icon`),this._marker.classList.add(`vco-mapmarker-image-icon-active`),this._marker.style.zIndex=`1000`):(clearTimeout(this.timer),this._marker.classList.remove(`vco-mapmarker-image-icon-active`),this._marker.classList.add(`vco-mapmarker-image-icon`),this._marker.style.zIndex=``):e?(this._marker.classList.remove(`vco-mapmarker`),this._marker.classList.add(`vco-mapmarker-active`),this._marker.style.zIndex=`1000`):(clearTimeout(this.timer),this._marker.classList.remove(`vco-mapmarker-active`),this._marker.classList.add(`vco-mapmarker`),this._marker.style.zIndex=``);let t=this._marker.querySelector(`.vco-marker-label`);if(t&&t.remove(),e&&this.options.marker_labels&&this.data.text?.headline){let e=document.createElement(`div`);e.className=`vco-marker-label`,e.textContent=this.data.text.headline,this._marker.appendChild(e)}let n=this._marker.querySelector(`.vco-mapmarker-icon`);n?n.className=this.media_icon_class:!this._custom_icon&&!this._custom_image_icon&&(this._marker.className=(e?`vco-mapmarker-active `:`vco-mapmarker `)+this.media_icon_class)}}_customIconAnchor(e){return e?[e[0]*.5,e[1]]:[24,48]}_location(){return this.data.real_marker?{lat:this.data.location.lat,lon:this.data.location.lon}:{}}},Bx=19,Vx=Array.from({length:25},(e,t)=>2**(16-t)),Hx=class extends Ix{_createMap(){let e=this.options.map_type===`iiif`&&this.options.map_as_image,t=this.options.map_options??{},{element:n,view:r,...i}=t,a=r??{},o=this._bboxExtent();this._map=new gd({...i,target:this._el.map,controls:t.controls??[],interactions:t.interactions??[],view:new bo({projection:e?`EPSG:4326`:`EPSG:3857`,center:[0,0],zoom:0,minZoom:0,maxZoom:e?Vx.length-1:Bx,...e?{multiWorld:!0,resolutions:Vx}:{},...this.options.map_type===`zoomify`?{multiWorld:!0}:{},...o?{extent:o}:{},...a})}),this._map.on(`loadend`,()=>{this._onMapLoaded(void 0)});let s=this._el.map.querySelector(`.ol-overlaycontainer`);s&&(s.style.zIndex=`1`);let c=Fe(this.options),l=Ie(`consent_service_tiles`,`map tiles`);this.options.consent_required&&c?c.isGranted(l)?this._addTileLayer():c.isDenied(l)||this._requestTileConsent(c,l):this._addTileLayer(),this._line=this._createLine(),this._line.setStyle(this._lineStyle(this.options.line_color_inactive)),this._addLineToMap(this._line),this._line.setOpacity(this.options.line_opacity),this._line_active=this._createLine(),this._line_active.setStyle(this._lineStyle(this.options.line_color)),this._addLineToMap(this._line_active),this._line_active.setOpacity(1),this.options.map_as_image&&(this._line_active.setVisible(!1),this._line.setVisible(!1)),Ps({mouseWheelZoom:!1}).forEach(e=>this._map.addInteraction(e));let u=this._getAttribution(this.options.map_type);u&&this._el.map.insertAdjacentHTML(`beforeend`,`<div class="vco-map-attribution">${u}</div>`)}_getAttribution(e){let t=[`<a href='https://storymap.knightlab.com/' target='_blank' class='vco-knightlab-brand'><span>■</span> StoryMapJS</a>`];return(e===`osm`||e===``||e.startsWith(`osm`))&&t.push(`© <a target='_blank' href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors`),t.join(` | `)}_addTileLayer(){this._tile_layer=this._createTileLayer(this.options.map_type),this._map.addLayer(this._tile_layer)}async _requestTileConsent(e,t){await e.request(t,``,this._el.map)&&this._onTilesAllowed()}_onTilesAllowed(){if(this._addTileLayer(),this._tile_layer_mini||=this._createTileLayer(this.options.map_type),this._mini_map&&this._tile_layer_mini){let e=this._mini_map.getOverviewMap();e.getLayers().getLength()||e.addLayer(this._tile_layer_mini)}if(this._markers.length>0&&this.current_marker<this._markers.length){let e=this._markers[this.current_marker];e.data.type===`overview`?this._markerOverview():this._hasLocation(e.data)&&this._fitView(this._map,[[e.data.location.lon,e.data.location.lat]],0)}}_zoomifyPyramid(){let e=this.options.zoomify;if(!e||typeof e!=`object`||!e.path)return null;let t=e.width??600,n=e.height??600,r=[],i=t,a=n;for(;i>256||a>256;)r.push([i,a]),i=Math.floor(i/2),a=Math.floor(a/2);r.push([i,a]),r.reverse();let o=r.length-1,s=256*2**o,c=[-20037508.342789244,20037508.342789244-n/s*40075016.68557849,-20037508.342789244+t/s*40075016.68557849,20037508.342789244];return{sizes:r,maxZoom:o,extent:c,tileGrid:new nm({extent:c,origin:[c[0],c[3]],resolutions:Array.from({length:o+2},(e,t)=>40075016.68557849/(256*2**(t-1))),tileSize:256})}}_zoomifyOverview(e){let t=this._zoomifyPyramid();if(!t)return null;let n=this.options.zoomify?.tolerance??.9,r=t.maxZoom;for(;r>0;){let i=t.sizes[r];if(i[0]*n<(e[0]||1)&&i[1]*n<(e[1]||1))break;r--}let i=[(t.extent[0]+t.extent[2])/2,(t.extent[1]+t.extent[3])/2];return{zoom:r,center:i}}_createTileLayer(e){let t=e.split(`:`);switch(t[0]){case`mapbox`:return t.length>2?new Up({source:new ym({url:`https://api.mapbox.com/styles/v1/`+t[2].slice(9)+`/tiles/256/{z}/{x}/{y}@2x?access_token=`+this.options.map_access_token,attributions:[],crossOrigin:`anonymous`})}):(console.error(`StoryMapJS: legacy 'mapbox:<style>' map types are no longer supported (the Mapbox v4 tile API was retired); use 'mapbox://styles/<user>/<style>' with map_access_token instead.`),new Up({source:new Bm({attributions:[]})}));case`stadia`:{let e=`osm:standard`;return t.length>1&&(e=t.slice(1).join(`:`),this.options.map_access_token&&(e=`${e}?api_key=${this.options.map_access_token}`)),new Up({source:new ym({url:`https://tiles.stadiamaps.com/tiles/${e}/{z}/{x}/{y}.png`,attributions:[]})})}case`stamen`:return this._map.getViewport().style.backgroundColor=`#FFFFFF`,new Up({source:new ym({url:`https://tiles.stadiamaps.com/tiles/stamen_toner_lite/{z}/{x}/{y}.png`,attributions:[]})});case`iiif`:{let e=new Up;return fetch(this.options.iiif.url).then(e=>e.json()).then(t=>{let n=new km(t).getTileSourceOptions(),r=t;if(typeof r.width!=`number`||typeof r.height!=`number`){console.error(`IIIF info.json is missing width/height:`,this.options.iiif.url);return}let i=new Mm({...n??{},projection:`EPSG:4326`,size:[r.width,r.height],crossOrigin:`anonymous`,attributions:this.options.iiif.attribution||[]});e.setSource(i),i.getState()===`ready`?this._markerOverview():i.once(`change`,()=>{i.getState()===`ready`&&this._markerOverview()})}).catch(e=>console.error(`IIIF info.json could not be loaded:`,this.options.iiif.url,e?.stack||e)),e}case`http`:case`https`:return e.includes(`{z}`)?new Up({source:new ym({url:e,attributions:[],crossOrigin:`anonymous`})}):this._createVectorStyleLayer(e);case`ch-watercolor`:return new Up({source:new ym({url:`https://watercolormaps.collection.cooperhewitt.org/tile/watercolor/{z}/{x}/{y}.jpg`,attributions:[],maxZoom:16})});case`zoomify`:{let e=this._zoomifyPyramid();if(!e)return console.error(`StoryMapJS: map_type 'zoomify' needs a zoomify image pyramid (path, width, height) in the storymap data.`),new Up({source:new Bm({attributions:[]})});let t=this.options.zoomify.path??``,{sizes:n,maxZoom:r}=e,i=e=>Math.ceil(n[e][0]/256),a=e=>Math.ceil(n[e][1]/256);return new Up({source:new ym({tileGrid:e.tileGrid,crossOrigin:`anonymous`,attributions:[],tileUrlFunction:e=>{let[n,o,s]=e,c=Math.max(0,n-1);if(c>r||o<0||o>=i(c)||s<0||s>=a(c))return;let l=0;for(let e=0;e<c;e++)l+=i(e)*a(e);return l+=s*i(c)+o,`${t}TileGroup${Math.floor(l/256)}/${c}-${o}-${s}.jpg`}})})}case`osm`:{let e=t.length>1?t[1]:``;return e?this._createVectorStyleLayer(`https://tiles.openfreemap.org/styles/${e}`):new Up({source:new Bm({attributions:[]})})}default:return new Up({source:new Bm({attributions:[]})})}}_createVectorStyleLayer(e){let t=new qp({declutter:!0,updateWhileAnimating:!0});return Ox(t,e).catch(t=>console.error(`Vector map style could not be loaded:`,e,t)),t}_createMiniMap(){this.options.map_as_image&&(this.zoom_min_max.min=0),this.bounds_array||=this._getAllMarkersBounds(this._markers);let e=Fe(this.options),t=Ie(`consent_service_tiles`,`map tiles`),n=!(this.options.consent_required&&e&&!e.isGranted(t));this._tile_layer_mini=n?this._createTileLayer(this.options.map_type):null;let r=this.options.map_type===`iiif`&&this.options.map_as_image,i=this.options.map_type===`zoomify`,a=i?this._zoomifyPyramid():null;if(this._mini_map=new Km({...r||a?{view:new bo({projection:this._map.getView().getProjection(),center:this._map.getView().getCenter(),zoom:this.zoom_min_max.min||0,...r?{multiWorld:!0,resolutions:Vx,minZoom:0,maxZoom:Vx.length-1}:{},...a?{constrainOnlyCenter:!0,extent:a.extent,minZoom:0,maxZoom:0,zoom:0,center:[(a.extent[0]+a.extent[2])/2,(a.extent[1]+a.extent[3])/2]}:{}})}:{},layers:this._tile_layer_mini?[this._tile_layer_mini]:[],collapseLabel:`«`,label:`»`,collapsed:!0}),this._map.addControl(this._mini_map),a){let e=this._mini_map.getOverviewMap(),t=e.getSize(),n=t&&t[0]>=50&&t[1]>=50?t:[150,150];e.getView().fit(a.extent,{size:n})}else!i&&this.bounds_array&&this.bounds_array.length&&this._fitView(this._mini_map.getOverviewMap(),this.bounds_array);this.options.map_type===`iiif`&&this.options.map_as_image&&this._fitMiniMapToImage()}_fitMiniMapToImage(){if(!this._tile_layer_mini)return;let e=()=>{try{let e=(this._tile_layer_mini?.getSource())?.getTileGrid?.();if(e){let t=this._mini_map.getOverviewMap(),n=t.getSize(),r=n&&n[0]>=50&&n[1]>=50?n:[150,150];t.getView().fit(e.getExtent(),{size:r})}}catch(e){console.warn(`IIIF minimap fit failed:`,e)}},t=this._tile_layer_mini.getSource();t?t.getState()===`ready`?e():t.once(`change`,()=>{t.getState()===`ready`&&e()}):this._tile_layer_mini.once(`change:source`,()=>{let t=this._tile_layer_mini?.getSource();t&&(t.getState()===`ready`?e():t.once(`change`,()=>{t.getState()===`ready`&&e()}))})}_createMarker(e){let t=new zx(e,this.options);t.on(`markerclick`,this._onMarkerClick,this),this._addMarker(t),this._markers.push(t),t.marker_number=this._markers.length-1,this.fire(`markerAdded`,t)}_addMarker(e){e.addTo(this._map)}_afterCreateMarkers(){if(this._map.getView().getProjection().getCode()===`EPSG:4326`)return;let e=this._markers.filter(e=>e.data.real_marker&&e.data.location?.lon!==void 0),t=this._unwrapLongitudes(e.map(e=>e.data.location.lon));e.forEach((e,n)=>{e._overlay?.setPosition(Di([t[n],e.data.location.lat]))})}_removeMarker(e){e&&e.data.real_marker&&e._removeFrom(this._map)}_getAllMarkersBounds(e){let t=[];for(let n=0;n<e.length;n++)e[n].data.real_marker&&t.push([e[n].data.location.lon,e[n].data.location.lat]);let n=this._unwrapLongitudes(t.map(e=>e[0]));return t.map((e,t)=>[n[t],e[1]])}_unwrapLongitudes(e){if(e.length===0)return[];let t=[e[0]];for(let n=1;n<e.length;n++){let r=e[n];for(;r-t[n-1]>180;)r-=360;for(;r-t[n-1]<-180;)r+=360;t.push(r)}return t}_markerCoordsToViewCoords(e){return this._map.getView().getProjection().getCode()===`EPSG:4326`?e.map(e=>[e[0],e[1]]):e.map(e=>Di(e))}_bboxExtent(){let e=this.options.map_bbox;if(!e||e.length!==4)return null;if(this.options.map_type===`iiif`&&this.options.map_as_image)return e;let t=Di([e[0],e[1]]),n=Di([e[2],e[3]]);return[t[0],t[1],n[0],n[1]]}_opaquePanelPadding(){let e=[15,15,15,15];if(typeof document>`u`)return e;let t=document.querySelector(`.vco-storyslider .vco-slide.vco-active .vco-text`);if(!t)return e;let n=getComputedStyle(t).backgroundColor,r=/rgba?\(([^)]+)\)/.exec(n);if(!r)return e;let i=r[1].split(/[,\s/]+/).filter(e=>e!==``).map(Number);if((i.length>=4?i[3]:1)<.9)return e;let a=this._el.map.getBoundingClientRect(),o=t.getBoundingClientRect();return!a.width||!o.width||(this.options.layout===`portrait`?e[2]+=Math.max(0,a.bottom-o.top):e[1]+=Math.max(0,o.right-a.left)),e}_fitView(e,t,n=0){if(!t||!t.length)return;let r=dn(this._markerCoordsToViewCoords(t));e.getView().fit(r,{size:e.getSize(),padding:this._opaquePanelPadding(),maxZoom:12,duration:n,easing:this.options.ease})}_calculateMarkerZooms(){for(let e=0;e<this._markers.length;e++)if(this._markers[e].data.location){let t=this._markers[e],n,r;n=t.data.type&&t.data.type===`overview`?this._getMapCenter(!0):t.location();let i=e>0?this._markers[e-1].location():this._getMapCenter(!0),a=e<this._markers.length-1?this._markers[e+1].location():this._getMapCenter(!0),o=this._calculateZoomChange(i,n),s=this._calculateZoomChange(a,n);r=o&&o<s?o:s||o,this.options.map_center_offset&&(this.options.map_center_offset.left!==0||this.options.map_center_offset.top!==0)&&--r,t.data.location.zoom=r}}_lineStyle(e){return new vu({stroke:new _u({color:e,width:this.options.line_weight,lineDash:String(this.options.line_dash).split(`,`).map(e=>Number(e)),lineJoin:this.options.line_join})})}_createLine(e){return new sp({source:new lf({features:[]}),updateWhileAnimating:!0,style:this._lineStyle(this.options.line_color)})}_addLineToMap(e){e.setVisible(this.options.show_lines),this._map.addLayer(e)}_addToLine(e,t){let n=e.getSource(),r=n.getFeatures()[0];r||(r=new vd({geometry:new wd([])}),n.addFeature(r));let i=r.getGeometry().getCoordinates(),a=t.location.lon;if(i.length>0&&a!==void 0){let e=i[i.length-1][0]/111319.49079327358;for(;a-e>180;)a-=360;for(;a-e<-180;)a+=360}i.push(this._toViewCoords({lat:t.location.lat,lon:a})),r.getGeometry().setCoordinates(i)}_replaceLines(e,t,n){let r=e=>{let t=e.location?e.location.lat:e.lat;return[e.location?e.location.lon:e.lon,t]},i=t.map(r),a=this._unwrapLongitudes(i.map(e=>e[0])),o=i.map((e,t)=>[a[t],e[1]]),s=this._markerCoordsToViewCoords(o),c=e.getSource(),l=e=>{c.clear(),c.addFeature(new vd({geometry:new wd(e)}))};this._cancelLineAnimation();let u=n?.duration??0;if(u<=0||s.length<2){l(s);return}let d=e=>{let t=e.map(r);if(t.length<1||t.length>=o.length)return 0;let n=this._unwrapLongitudes(t.map(e=>e[0]));for(let e=0;e<t.length;e++)if(n[e]!==o[e][0]||t[e][1]!==o[e][1])return 0;return t.length},f=(n?.retractFrom??[]).map(r),p=null;if(f.length>0){let e=this._unwrapLongitudes(f.map(e=>e[0])),t=f.map((t,n)=>[e[n],t[1]]),n=o.length>=2&&o.length<t.length;for(let e=0;n&&e<o.length;e++)(t[e][0]!==o[e][0]||t[e][1]!==o[e][1])&&(n=!1);n&&(p=this._markerCoordsToViewCoords(t).slice(o.length-1))}let m=p?this._pathLength(p):0,h=d(n?.growFrom??[]),g=h>=1?s.slice(0,h):null,_=h>=1?s.slice(h-1):null,v=_?this._pathLength(_):0,y=this.options.ease,b=performance.now();g&&l(g);let x=e=>{let t=Math.min(1,Math.max(0,(e-b)/u)),n=y?y(t):t;if(p&&m>0){let e=m-n*m,r=this._truncatePath(p,e);l([...s,...r.slice(1)]),t>=1&&l(s)}else if(g&&_&&v>0){let e=this._truncatePath(_,n*v);l([...g,...e.slice(1)]),t>=1&&l(s)}else{let e=this._pathLength(s);l(this._truncatePath(s,n*e))}this._line_animation=t<1?requestAnimationFrame(x):null};this._line_animation=requestAnimationFrame(x)}_cancelLineAnimation(){this._line_animation!==null&&(cancelAnimationFrame(this._line_animation),this._line_animation=null)}_pathLength(e){let t=0;for(let n=1;n<e.length;n++)t+=Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]);return t}_truncatePath(e,t){if(t<=0||e.length<2)return[];let n=[e[0]],r=0;for(let i=1;i<e.length;i++){let a=Math.hypot(e[i][0]-e[i-1][0],e[i][1]-e[i-1][1]);if(r+a>=t){let o=(t-r)/a;return n.push([e[i-1][0]+o*(e[i][0]-e[i-1][0]),e[i-1][1]+o*(e[i][1]-e[i-1][1])]),n}r+=a,n.push(e[i])}return n}_panTo(e,t){this._map.getView().animate({center:this._toViewCoords(e),duration:this.options.duration,easing:this.options.ease})}_zoomTo(e,t){this._map.getView().animate({zoom:e,duration:this.options.duration,easing:this.options.ease})}_viewTo(e,t){let n=!0,r=this.options.duration,i=this._getMapZoom(),a={lat:e.lat,lon:e.lon};this.options.map_as_image||this._line_active.setVisible(!0),e.zoom!==void 0&&e.zoom!==null&&(i=e.zoom),t&&(t.duration!==void 0&&(t.duration===0?n=!1:r=t.duration),t.zoom&&this.options.calculate_zoom&&(i=t.zoom)),this.options.map_center_offset&&(a=this._getMapCenterOffset(a,i)),this._map.getView().animate({center:this._toViewCoords(a),zoom:i,duration:n?r:0,easing:this.options.ease}),this._mini_map&&this.options.width>this.options.skinny_size&&(i-1<=this.zoom_min_max.min?this._mini_map.setCollapsed(!0):this._mini_map.setCollapsed(!1))}_toViewCoords(e){return this._map.getView().getProjection().getCode()===`EPSG:4326`?[e.lon,e.lat]:Di([e.lon,e.lat])}_getMapZoom(){return this._map.getView().getZoom()||0}_getMapCenter(e){let t=Oi(this._map.getView().getCenter(),this._map.getView().getProjection());return{lat:t[1],lon:t[0]}}_getMapCenterOffset(e,t){let n=this._map.getView(),r=n.getProjection(),i=this._toViewCoords(e),a=n.getResolutionForZoom(t);return this._fromViewCoords([i[0]-this.options.map_center_offset.left*a,i[1]+this.options.map_center_offset.top*a],r)}_fromViewCoords(e,t){return t.getCode()===`EPSG:4326`?{lat:e[1],lon:e[0]}:{lat:Oi(e,t)[1],lon:e[0]/6378137*(180/Math.PI)}}_getBoundsZoom(e,t,n){let r=[[e.lon===void 0?e.lng:e.lon,e.lat],[t.lon,t.lat]],i=dn(this._markerCoordsToViewCoords(r)),a=this._map.getSize();if(!a||!a[0]||!a[1])return 0;let o=(i[2]-i[0])/a[0],s=(i[3]-i[1])/a[1],c=Math.max(o,s)*3;if(!isFinite(c)||c<=0)return 0;let l=this._map.getView().getZoomForResolution(c);return l===void 0||!isFinite(l)?0:Math.max(0,Math.round(l))}_initialMapLocation(){}getRouteDistance(){let e=this._markers.map(e=>e.location()).filter(e=>!!e&&isFinite(e.lat)&&isFinite(e.lon));if(e.length<2)return;let t=0;for(let n=1;n<e.length;n++){let r=(e[n].lat-e[n-1].lat)*Math.PI/180,i=(e[n].lon-e[n-1].lon)*Math.PI/180,a=Math.sin(r/2)**2+Math.cos(e[n-1].lat*Math.PI/180)*Math.cos(e[n].lat*Math.PI/180)*Math.sin(i/2)**2;t+=12742*Math.asin(Math.sqrt(a))}return t}_markerOverview(e){if(this._cancelLineAnimation(),this._line_active.setVisible(!1),e&&this._map.getView().getAnimating()&&(e=0),this.options.map_type===`zoomify`){let t=this._map.getSize(),n=this._zoomifyOverview([t?.[0]||1280,t?.[1]||450]);if(n){let t=this.options.map_center_offset&&(this.options.map_center_offset.left!==0||this.options.map_center_offset.top!==0)?n.zoom-1:n.zoom,r=this._map.getView().getResolutionForZoom(t),i=[n.center[0]-(this.options.map_center_offset?.left??0)*r,n.center[1]+(this.options.map_center_offset?.top??0)*r];this._map.getView().animate({center:i,zoom:t,duration:e??this._transition_duration,easing:this.options.ease})}}else if(this.options.map_type===`iiif`&&this.options.map_as_image){let t=this._tile_layer?.getSource();if(!t)return;let n=()=>{try{let n=t.getTileGrid();if(n){let t=n.getExtent(),r=this._map.getSize(),i=(t[2]-t[0])/(r[0]||1),a=(t[3]-t[1])/(r[1]||1),o=Math.max(i,a),s=this._map.getView(),c=s.getZoomForResolution(o),l=this.options.map_overview_center,u=l?this._toViewCoords({lat:l.lat,lon:l.lon}):[(t[0]+t[2])/2,(t[1]+t[3])/2],d=s.getProjection(),f=this._fromViewCoords(u,d),p=this._getMapCenterOffset(f,c);s.animate({center:this._toViewCoords(p),zoom:c,duration:e??this._transition_duration,easing:this.options.ease})}}catch(e){console.warn(`IIIF overview fit failed:`,e)}};t.getState()===`ready`?n():t.once(`change`,()=>{t.getState()===`ready`&&n()})}else{this.bounds_array=this._getAllMarkersBounds(this._markers);let t=this.options.map_overview_center;if(t&&this.bounds_array&&this.bounds_array.length){let n=dn(this._markerCoordsToViewCoords(this.bounds_array)),r=this._map.getSize(),i=Math.max((n[2]-n[0])/(r[0]||1),(n[3]-n[1])/(r[1]||1)),a=Math.max(0,Math.round(this._map.getView().getZoomForResolution(i))-1),o=this._getMapCenterOffset({lat:t.lat,lon:t.lon},a);this._map.getView().animate({center:this._toViewCoords(o),zoom:a,duration:e??this._transition_duration,easing:this.options.ease})}else if(this.options.map_center_offset&&(this.options.map_center_offset.left!==0||this.options.map_center_offset.top!==0)){if(this.bounds_array&&this.bounds_array.length){let t=dn(this._markerCoordsToViewCoords(this.bounds_array)),n=this._map.getSize(),r=(t[2]-t[0])/(n[0]||1),i=(t[3]-t[1])/(n[1]||1),a=Math.max(r,i),o=Math.max(0,Math.round(this._map.getView().getZoomForResolution(a))-1),s=[(t[0]+t[2])/2,(t[1]+t[3])/2],c=this._map.getView().getProjection(),l=this._fromViewCoords(s,c),u=this._getMapCenterOffset(l,o);this._map.getView().animate({center:this._toViewCoords(u),zoom:o,duration:e??this._transition_duration,easing:this.options.ease})}}else{this._fitView(this._map,this.bounds_array,0);let t=this._map.getView(),n=t.getZoom();if(n!==void 0){let r=this._fromViewCoords(t.getCenter(),t.getProjection()),i=this._getMapCenterOffset(r,n);t.animate({center:this._toViewCoords(i),zoom:n,duration:e??this._transition_duration,easing:this.options.ease})}}}this._mini_map&&this._mini_map.setCollapsed(!0)}applyOptions(e){for(let t of e)switch(t){case`map_type`:{this._tile_layer&&this._map.removeLayer(this._tile_layer);let e=Fe(this.options),t=Ie(`consent_service_tiles`,`map tiles`);this.options.consent_required&&e&&!e.isGranted(t)||(this._tile_layer=this._createTileLayer(this.options.map_type),this._map.addLayer(this._tile_layer)),this._el.map.style.backgroundColor=this.options.map_background_color;break}case`show_lines`:case`line_color`:case`line_color_inactive`:case`line_weight`:case`line_opacity`:case`line_dash`:case`line_join`:{let e=e=>this._lineStyle(e);this._line.setStyle(e(this.options.line_color_inactive)),this._line.setOpacity(this.options.line_opacity),this._line.setVisible(this.options.show_lines),this._line_active.setStyle(e(this.options.line_color)),this._line_active.setVisible(this.options.show_lines);break}case`map_background_color`:this._el.map.style.backgroundColor=this.options.map_background_color;break;case`map_bbox`:{let e=this._map.getView(),t=e.getCenter(),n=e.getZoom(),r=this._bboxExtent();this._map.setView(new bo({projection:e.getProjection(),center:t,zoom:n,minZoom:e.getMinZoom(),maxZoom:e.getMaxZoom(),...r?{extent:r}:{}}));break}}if(this._markers.length>0&&this.current_marker<this._markers.length){let e=this._markers[this.current_marker];e.data.type===`overview`?this._markerOverview():e.data.location&&this._viewTo(e.data.location,{duration:0})}}_updateMapDisplay(e,t,n){if(e){let e=t||this.options.duration;this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this._refreshMap(!1)},e)}else this.timer||this._refreshMap(n!==!1);this._mini_map&&this._mini_map.setCollapsed(this._el.container.offsetWidth<this.options.skinny_size)}_refreshMap(e=!1){if(this._map){this.timer&&=(clearTimeout(this.timer),null),this._map.updateSize();let t=this._markers[this.current_marker];t&&t.data.type&&t.data.type===`overview`?(this._markerOverview(e?0:void 0),e&&this._map.renderSync()):t&&t.data.location&&(e?this._setViewInstant(t.data.location,this._getMapZoom()):this._viewTo(t.data.location,{zoom:this._getMapZoom()}))}}_setViewInstant(e,t){let n={lat:e.lat,lon:e.lon};this.options.map_center_offset&&(n=this._getMapCenterOffset(n,t));let r=this._map.getView();r.setZoom(t),r.setCenter(this._toViewCoords(n)),this._map.renderSync()}},Ux={addListener:function(e,t,n,r){let i=function(t){return n.call(r||e,t)};e.addEventListener(t,i,!1),e[`_vco_`+t+g(n)]=i},removeListener:function(e,t,n,r){let i=`_vco_`+t+g(n),a=e[i];a&&(e.removeEventListener(t,a,!1),e[i]=null)},preventDefault:function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}},Wx=class{constructor(e,t,n){this._el={parent:{},container:{},button_overview:{},button_backtostart:{},button_fullscreen:{},progress:{},progress_fill:{},distance:{},button_collapse_toggle:{},arrow:{},line:{},coverbar:{},grip:{}},this.collapsed=!1,typeof e==`object`?this._el.container=e:this._el.container=M.get(e),t&&(this._el.parent=t),this.options={width:600,height:600,duration:1e3,ease:Je,menubar_default_y:0},this.animator={},f(this.options,n),this._initLayout()}show(e){}hide(e){}setSticky(e){this.options.menubar_default_y=e}setColor(e){e?this._el.container.className=`vco-menubar vco-menubar-inverted`:this._el.container.className=`vco-menubar`}setFullscreenState(e){let t=e?`vco-icon-resize-small`:`vco-icon-resize-full`;if(Px.mobile)this._el.button_fullscreen.innerHTML=`<span class='${t}'></span>`;else{let n=e?j.buttons.exit_fullscreen:j.buttons.fullscreen;this._el.button_fullscreen.innerHTML=`${n} <span class='${t}'></span>`}}setProgress(e,t){if(!this.options.show_progress||!this._el.progress_fill)return;let n=t>1?Math.round(e/(t-1)*100):100;this._el.progress_fill.style.width=n+`%`,this._el.progress.setAttribute(`role`,`progressbar`),this._el.progress.setAttribute(`aria-valuenow`,String(e+1)),this._el.progress.setAttribute(`aria-valuemin`,`1`),this._el.progress.setAttribute(`aria-valuemax`,String(t)),this._el.progress.setAttribute(`aria-label`,`${e+1} / ${t}`)}setDistance(e){if(!this.options.show_distance||!this._el.distance)return;if(e==null||!isFinite(e)){this._el.distance.style.display=`none`;return}this._el.distance.style.display=``;let t=e*.621371,n=typeof j.lang==`string`&&j.lang?j.lang:`en`;this._el.distance.textContent=e>=10?`${Math.round(e).toLocaleString(n)} km · ${Math.round(t).toLocaleString(`en-US`)} mi`:`${e.toFixed(1)} km · ${t.toFixed(1)} mi`}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}_onButtonOverview(e){this.fire(`overview`,e)}_onButtonBackToStart(e){this.fire(`back_to_start`,e)}_onButtonFullscreen(e){this.fire(`fullscreen`,e)}_onButtonCollapseMap(e){this.collapsed?(this.collapsed=!1,this.show(),this._el.button_overview.style.display=`inline`,this.fire(`collapse`,{y:this.options.menubar_default_y}),Px.mobile?this._el.button_collapse_toggle.innerHTML=`<span class='vco-icon-arrow-up'></span>`:this._el.button_collapse_toggle.innerHTML=j.buttons.collapse_toggle+`<span class='vco-icon-arrow-up'></span>`):(this.collapsed=!0,this.hide(25),this._el.button_overview.style.display=`none`,this.fire(`collapse`,{y:1}),Px.mobile?this._el.button_collapse_toggle.innerHTML=`<span class='vco-icon-arrow-down'></span>`:this._el.button_collapse_toggle.innerHTML=j.buttons.uncollapse_toggle+`<span class='vco-icon-arrow-down'></span>`)}_initLayout(){this._el.button_overview=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_overview,`click`,this._onButtonOverview,this),this.options.show_overview===!1&&(this._el.button_overview.style.display=`none`),this._el.button_backtostart=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_backtostart,`click`,this._onButtonBackToStart,this),this.options.show_back_to_start===!1&&(this._el.button_backtostart.style.display=`none`),this._el.button_fullscreen=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_fullscreen,`click`,this._onButtonFullscreen,this),this.options.fullscreen===!1&&(this._el.button_fullscreen.style.display=`none`),this._el.button_collapse_toggle=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_collapse_toggle,`click`,this._onButtonCollapseMap,this),this.options.map_as_image?this._el.button_overview.innerHTML=j.buttons.overview:this._el.button_overview.innerHTML=j.buttons.map_overview,this.options.show_progress&&(this._el.progress=M.create(`span`,`vco-menubar-progress`,this._el.container),this._el.progress_fill=M.create(`span`,`vco-menubar-progress-fill`,this._el.progress)),this.options.show_distance&&(this._el.distance=M.create(`span`,`vco-menubar-distance`,this._el.container)),Px.mobile?(this._el.button_backtostart.innerHTML=`<span class='vco-icon-goback'></span>`,this._el.button_collapse_toggle.innerHTML=`<span class='vco-icon-arrow-up'></span>`,this._el.button_fullscreen.innerHTML=`<span class='vco-icon-resize-full'></span>`,this._el.container.setAttribute(`ontouchstart`,` `)):(this._el.button_backtostart.innerHTML=j.buttons.backtostart+` <span class='vco-icon-goback'></span>`,this._el.button_collapse_toggle.innerHTML=j.buttons.collapse_toggle+`<span class='vco-icon-arrow-up'></span>`,this._el.button_fullscreen.innerHTML=j.buttons.fullscreen+` <span class='vco-icon-resize-full'></span>`),this.options.layout===`landscape`&&(this._el.button_collapse_toggle.style.display=`none`)}_updateDisplay(e,t,n){e&&(this.options.width=e),t&&(this.options.height=t)}},Gx=class extends Qe(Ze(Wx)){constructor(...e){super(...e)}},Kx=c(o(((e,t)=>{(function(e,n){typeof define==`function`?define(n):t===void 0?this[e]=n():t.exports=n()})(`morpheus`,function(){var e=document,t=window,n=t.performance,r=n&&(n.now||n.webkitNow||n.msNow||n.mozNow),i=r?function(){return r.call(n)}:function(){return+new Date},a=!1,o=e.documentElement,s=1e3,c=/^rgb\(|#/,l=/^([+\-])=([\d\.]+)/,u=/^(?:[\+\-]=?)?\d+(?:\.\d+)?(%|in|cm|mm|em|ex|pt|pc|px)$/,d=/rotate\(((?:[+\-]=)?([\-\d\.]+))deg\)/,f=/scale\(((?:[+\-]=)?([\d\.]+))\)/,p=/skew\(((?:[+\-]=)?([\-\d\.]+))deg, ?((?:[+\-]=)?([\-\d\.]+))deg\)/,m=/translate\(((?:[+\-]=)?([\-\d\.]+))px, ?((?:[+\-]=)?([\-\d\.]+))px\)/,h={lineHeight:1,zoom:1,zIndex:1,opacity:1,transform:1},g=function(){for(var t=e.createElement(`a`).style,n=[`webkitTransform`,`MozTransform`,`OTransform`,`msTransform`,`Transform`],r=0;r<n.length;r++)if(n[r]in t)return n[r]}(),_=function(){return e.createElement(`a`).style.opacity!==void 0}(),v=e.defaultView&&e.defaultView.getComputedStyle?function(t,n){n=n==`transform`?g:n,n=k(n);var r=null,i=e.defaultView.getComputedStyle(t,``);return i&&(r=i[n]),t.style[n]||r}:o.currentStyle?function(e,t){if(t=k(t),t==`opacity`){var n=100;try{n=e.filters[`DXImageTransform.Microsoft.Alpha`].opacity}catch{try{n=e.filters(`alpha`).opacity}catch{}}return n/100}var r=e.currentStyle?e.currentStyle[t]:null;return e.style[t]||r}:function(e,t){return e.style[k(t)]},y=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||t.oRequestAnimationFrame||function(e){t.setTimeout(function(){e(+new Date)},17)}}();y(function(e){a=e>0xe8d4a51000!=i()>0xe8d4a51000});var b=[];function x(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t);for(n=0;n<e.length;++n)if(e[n]===t)return n}function S(e){var t,n=b.length;for(a&&(e=i()),t=n;t--;)b[t](e);b.length&&y(S)}function C(e){b.push(e)===1&&y(S)}function w(e){var t,n=x(b,e);n>=0&&(t=b.slice(n+1),b.length=n,b=b.concat(t))}function T(e,t){var n={},r;return(r=e.match(d))&&(n.rotate=oe(r[1],t?t.rotate:null)),(r=e.match(f))&&(n.scale=oe(r[1],t?t.scale:null)),(r=e.match(p))&&(n.skewx=oe(r[1],t?t.skewx:null),n.skewy=oe(r[3],t?t.skewy:null)),(r=e.match(m))&&(n.translatex=oe(r[1],t?t.translatex:null),n.translatey=oe(r[3],t?t.translatey:null)),n}function E(e){var t=``;return`rotate`in e&&(t+=`rotate(`+e.rotate+`deg) `),`scale`in e&&(t+=`scale(`+e.scale+`) `),`translatex`in e&&(t+=`translate(`+e.translatex+`px,`+e.translatey+`px) `),`skewx`in e&&(t+=`skew(`+e.skewx+`deg,`+e.skewy+`deg)`),t}function D(e,t,n){return`#`+(1<<24|e<<16|t<<8|n).toString(16).slice(1)}function O(e){var t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return(t?D(t[1],t[2],t[3]):e).replace(/#(\w)(\w)(\w)$/,`#$1$1$2$2$3$3`)}function k(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}function ee(e){return typeof e==`function`}function te(e){return Math.sin(e*Math.PI/2)}function ne(e,t,n,r,a,o){r=ee(r)?r:se.easings[r]||te;var c=e||s,l=this,u=o-a,d=i(),f=0,p=0;function m(e){var i=e-d;if(i>c||f)return o=isFinite(o)?o:1,f?p&&t(o):t(o),w(m),n&&n.apply(l);t(isFinite(o)?u*r(i/c)+a:r(i/c))}return C(m),{stop:function(e){f=1,p=e,e||(n=null)}}}function re(e,t){for(var n=e.length,r=[],i=0,a;i<n;++i)r[i]=[e[i][0],e[i][1]];for(a=1;a<n;++a)for(i=0;i<n-a;++i)r[i][0]=(1-t)*r[i][0]+t*r[parseInt(i+1,10)][0],r[i][1]=(1-t)*r[i][1]+t*r[parseInt(i+1,10)][1];return[r[0][0],r[0][1]]}function ie(e,t,n){for(var r=[],i=0,a,o,s;i<6;i++)o=Math.min(15,parseInt(t.charAt(i),16)),s=Math.min(15,parseInt(n.charAt(i),16)),a=Math.floor((s-o)*e+o),a=a>15?15:a<0?0:a,r[i]=a.toString(16);return`#`+r.join(``)}function ae(e,t,n,r,i,a,o){if(i==`transform`){for(var c in o={},n[a][i])o[c]=c in r[a][i]?Math.round(((r[a][i][c]-n[a][i][c])*e+n[a][i][c])*s)/s:n[a][i][c];return o}return typeof n[a][i]==`string`?ie(e,n[a][i],r[a][i]):(o=Math.round(((r[a][i]-n[a][i])*e+n[a][i])*s)/s,i in h||(o+=t[a][i]||`px`),o)}function oe(e,t,n,r,i){return(n=l.exec(e))?(i=parseFloat(n[2]))&&t+(n[1]==`+`?1:-1)*i:parseFloat(e)}function se(e,t){var n=e?n=isFinite(e.length)?e:[e]:[],r,i=t.complete,a=t.duration,o=t.easing,s=t.bezier,l=[],d=[],f=[],p=[],m,h;for(s&&(m=t.left,h=t.top,delete t.right,delete t.bottom,delete t.left,delete t.top),r=n.length;r--;){if(l[r]={},d[r]={},f[r]={},s){var y=v(n[r],`left`),b=v(n[r],`top`),x=[oe(ee(m)?m(n[r]):m||0,parseFloat(y)),oe(ee(h)?h(n[r]):h||0,parseFloat(b))];p[r]=ee(s)?s(n[r],x):s,p[r].push(x),p[r].unshift([parseInt(y,10),parseInt(b,10)])}for(var S in t){switch(S){case`complete`:case`duration`:case`easing`:case`bezier`:continue}var C=v(n[r],S),w,D=ee(t[S])?t[S](n[r]):t[S];if(typeof D==`string`&&c.test(D)&&!c.test(C)){delete t[S];continue}l[r][S]=S==`transform`?T(C):typeof D==`string`&&c.test(D)?O(C).slice(1):parseFloat(C),d[r][S]=S==`transform`?T(D,l[r][S]):typeof D==`string`&&D.charAt(0)==`#`?O(D).slice(1):oe(D,parseFloat(C)),typeof D==`string`&&(w=D.match(u))&&(f[r][S]=w[1])}}return ne.apply(n,[a,function(e,i,a){for(r=n.length;r--;)for(var o in s&&(a=re(p[r],e),n[r].style.left=a[0]+`px`,n[r].style.top=a[1]+`px`),t)i=ae(e,f,l,d,o,r),o==`transform`?n[r].style[g]=E(i):o==`opacity`&&!_?n[r].style.filter=`alpha(opacity=`+i*100+`)`:n[r].style[k(o)]=i},i,o])}return se.tween=ne,se.getStyle=v,se.bezier=re,se.transform=g,se.parseTransform=T,se.formatTransform=E,se.animationFrame=y,se.easings={},se})}))(),1),qx=class{constructor(e,t,n){this._el={container:{},content_container:{},icon:{},title:{},description:{}},this.mediatype={},this.data={title:`Navigation`,description:`Description`},this.options={direction:`previous`},this.animator=null,this.animator_position=null,f(this.options,t),f(this.data,e),this._el.container=M.create(`div`,`vco-slidenav-`+this.options.direction),Px.mobile&&this._el.container.setAttribute(`ontouchstart`,` `),this._initLayout(),this._initEvents(),n&&n.appendChild(this._el.container)}update(e){this._update(e)}setColor(e){e?this._el.content_container.className=`vco-slidenav-content-container vco-slidenav-inverted`:this._el.content_container.className=`vco-slidenav-content-container`}updatePosition(e,t,n,r,i,a){let o={duration:n,easing:r,complete:()=>{this._onUpdatePositionComplete(a)}},s=i;for(let n in e)Object.hasOwn(e,n)&&(o[n]=t?e[n]+`%`:e[n]+`px`);this.animator_position&&this.animator_position.stop();let c;c=o.right?`right`:`left`,t?this._el.container.style[c]=s+`%`:this._el.container.style[c]=s+`px`,this.animator_position=(0,Kx.default)(this._el.container,o)}_onUpdatePositionComplete(e){e&&(this._el.container.style.left=``,this._el.container.style.right=``)}_onMouseClick(){this.fire(`clicked`,this.options)}_update(e){this.data=f(this.data,e),this.data.title!==``&&(this._el.title.innerHTML=this.data.title),this.data.date!==``&&(this._el.description.innerHTML=this.data.description)}_initLayout(){this._el.content_container=M.create(`div`,`vco-slidenav-content-container`,this._el.container),this._el.icon=M.create(`div`,`vco-slidenav-icon`,this._el.content_container),this._el.title=M.create(`div`,`vco-slidenav-title`,this._el.content_container),this._el.description=M.create(`div`,`vco-slidenav-description`,this._el.content_container),this._el.icon.innerHTML=` `,this._update()}_initEvents(){Ux.addListener(this._el.container,`click`,this._onMouseClick,this)}},Jx=class extends Qe(Ze(qx)){constructor(...e){super(...e)}},Yx=class{data;constructor(e,t,n){this._el={parent:{},container:{},message_container:{},loading_icon:{},message:{}},this.options={width:600,height:600,message_class:`vco-message`,message_icon_class:`vco-loading-icon`},this.data={},f(this.data,e),f(this.options,t),this._el.container=M.create(`div`,this.options.message_class),n&&(n.appendChild(this._el.container),this._el.parent=n),this.animator={},this._initLayout(),this._initEvents()}updateMessage(e){this._updateMessage(e)}_updateMessage(e){e?this._el.message.innerHTML=e:j?this._el.message.innerHTML=j.messages.loading:this._el.message.innerHTML=`Loading`}_onMouseClick(){this.fire(`clicked`,this.options)}_initLayout(){this._el.message_container=M.create(`div`,`vco-message-container`,this._el.container),this._el.loading_icon=M.create(`div`,this.options.message_icon_class,this._el.message_container),this._el.message=M.create(`div`,`vco-message-content`,this._el.message_container),this._updateMessage()}_initEvents(){Ux.addListener(this._el.container,`click`,this._onMouseClick,this)}},Xx=class extends Qe(Ze(Yx)){constructor(...e){super(...e)}},Zx=class{constructor(e,t,n){this._el={container:{},content_container:{},content:{},content_item:{},content_link:{},caption:null,credit:null,parent:{},link:null},this.player=null,this.timer=null,this.load_timer=null,this.load_controller=null,this.message=null,this.media_id=null,this._state={loaded:!1,show_meta:!1,media_loaded:!1},this.data={uniqueid:null,url:null,credit:null,caption:null,link:null,link_target:null},this.options={api_key_flickr:``,credit_height:0,caption_height:0},this.animator={},f(this.options,t),f(this.data,e),this._el.container=M.create(`div`,`vco-media`),this.data.uniqueid&&(this._el.container.id=this.data.uniqueid),this._initLayout(),n&&(n.appendChild(this._el.container),this._el.parent=n)}async loadMedia(){if(!this._state.loaded){let e=Fe(this.options);if(this.options.consent_required&&e&&this.options.media_type){let t=this.options.media_type,n=``;try{n=new URL(this.data?.url??``).host}catch{}let r=this._el.content_container??this._el.container;await e.request(t,n,r)?this._beginLoad():this._showBlocked();return}this._beginLoad()}}_beginLoad(){this.load_timer=setTimeout(()=>{try{this._loadMedia(),this._state.loaded=!0,this._updateDisplay()}catch(e){console.log(`Error loading media for `,this._media),console.log(e),this.loadErrorDisplay(`Error loading media.`)}},1200)}_showBlocked(){let e=this._el.content_container??this._el.container,t=document.createElement(`div`);t.className=`vco-consent-blocked`,t.textContent=Ie(`consent_blocked`,`Content from {service} is blocked.`).replace(`{service}`,this.options.media_type??``),e.append(t),this.onLoaded(!0)}loadingMessage(){this.message.updateMessage(this._(`loading`)+` `+this.options.media_name)}updateMediaDisplay(e){this._state.loaded&&(this._updateMediaDisplay(e),!Px.mobile&&e!==`portrait`&&(this._el.content_item.style.maxHeight=this.options.height/2+`px`),this._state.media_loaded&&(this._el.credit&&(this._el.credit.style.width=`auto`),this._el.caption&&(this._el.caption.style.width=`auto`)),e===`portrait`&&(this._el.content_item.style.maxHeight=`none`),this._state.media_loaded&&(this._el.credit&&(this._el.credit.style.width=this._el.content_item.offsetWidth+`px`),this._el.caption&&(this._el.caption.style.width=this._el.content_item.offsetWidth+`px`)))}_loadMedia(){}_updateMediaDisplay(e){}show(){}hide(){}addTo(e){e.appendChild(this._el.container),this.onAdd()}removeFrom(e){e.removeChild(this._el.container),this.onRemove()}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}stopMedia(){!this._state.loaded&&this.load_timer&&(clearTimeout(this.load_timer),this.load_timer=null),this.load_controller&&=(this.load_controller.abort(),null),this._stopMedia()}async loadScript(e){this.load_controller?.abort();let t=new AbortController;this.load_controller=t;try{await E(e,{signal:t.signal})}finally{this.load_controller===t&&(this.load_controller=null)}}loadErrorDisplay(e){this._el.content_item&&this._el.content_item.parentNode===this._el.content&&this._el.content.removeChild(this._el.content_item),this._el.content_item=M.create(`div`,`vco-media-item vco-media-loaderror`,this._el.content),this._el.content_item.innerHTML=`<div class='vco-icon-`+this.options.media_type+`'></div><p>`+e+`</p>`,this.onLoaded(!0)}onLoaded(e){this._state.loaded=!0,this.fire(`loaded`,this.data),this.message&&this.message.hide(),e||this.showMeta(),this.updateDisplay()}onMediaLoaded(e){this._state.media_loaded=!0,this.fire(`media_loaded`,this.data),this._el.credit&&(this._el.credit.style.width=this._el.content_item.offsetWidth+`px`),this._el.caption&&(this._el.caption.style.width=this._el.content_item.offsetWidth+`px`)}showMeta(e,t){this._state.show_meta=!0,this.data.credit&&this.data.credit!==``&&!this._el.credit&&(this._el.credit=M.create(`div`,`vco-credit`,this._el.content_container),this._el.credit.innerHTML=this.data.credit,this.options.credit_height=this._el.credit.offsetHeight),this.data.caption&&this.data.caption!==``&&!this._el.caption&&(this._el.caption=M.create(`div`,`vco-caption`,this._el.content_container),this._el.caption.innerHTML=this.data.caption,this.options.caption_height=this._el.caption.offsetHeight)}onAdd(){this.fire(`added`,this.data)}onRemove(){this.fire(`removed`,this.data)}_initLayout(){if(this.message=new Xx({},this.options),this.message.addTo(this._el.container),this._el.content_container=M.create(`div`,`vco-media-content-container`,this._el.container),this.data.link&&this.data.link!==``){this._el.link=M.create(`a`,`vco-media-link`,this._el.content_container);let e=this._el.link;e.href=this.data.link,e.target=this.data.link_target&&this.data.link_target!==``?this.data.link_target:`_blank`,this._el.content=M.create(`div`,`vco-media-content`,this._el.link)}else this._el.content=M.create(`div`,`vco-media-content`,this._el.content_container)}_updateDisplay(e,t,n){e&&(this.options.width=e),t&&(this.options.height=t),n&&(this.options.layout=n),this._el.credit&&(this.options.credit_height=this._el.credit.offsetHeight),this._el.caption&&(this.options.caption_height=this._el.caption.offsetHeight+5),this.updateMediaDisplay(this.options.layout)}_stopMedia(){}},Qx=class extends Ze(Zx){constructor(...e){super(...e)}},$x=class extends Qx{_loadMedia(){if(this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this.data.link){this._el.content_link=M.create(`a`,``,this._el.content);let e=this._el.content_link;e.href=this.data.link,e.target=`_blank`,this._el.content_item=M.create(`img`,`vco-media-item vco-media-image vco-media-shadow`,this._el.content_link)}else this._el.content_item=M.create(`img`,`vco-media-item vco-media-image vco-media-shadow`,this._el.content);this._el.content_item.addEventListener(`load`,e=>{this.onMediaLoaded()}),this._el.content_item.src=this.data.url,this.onLoaded()}_updateMediaDisplay(e){}},eS=class extends Qx{async _loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this.youtube_loaded=!1,this._el.content_item=M.create(`div`,`vco-media-item vco-media-youtube vco-media-shadow`,this._el.content),this._el.content_item.id=v(7);let e=x(this.data.url);this.media_id={},this.data.url.match(`v=`)?this.media_id.id=e.v:this.data.url.match(`/embed/`)?this.media_id.id=this.data.url.split(`embed/`)[1].split(/[?&]/)[0]:this.data.url.match(/v\/|v=|youtu\.be\/|shorts\//)?this.media_id.id=this.data.url.split(/v\/|v=|youtu\.be\/|shorts\//)[1].split(/[?&]/)[0]:console.log(`YouTube in URL but not a valid video`),this.media_id.start=e.t,this.media_id.hd=e.hd;try{await this.loadScript(`https://www.youtube.com/iframe_api`)}catch{return}this.createMedia()}_updateMediaDisplay(){this._el.content_item.style.height=S.r16_9({w:this._el.content_item.offsetWidth})+`px`}_stopMedia(){if(clearTimeout(this.timer),this.timer=null,this.youtube_loaded)try{let e=YT;this.player.getPlayerState()===e.PlayerState.PLAYING&&this.player.pauseVideo()}catch(e){console.log(e)}}createMedia(){if(this.media_id.start!==void 0){let e=this.media_id.start.toString(),t=/(\d+)h/.exec(e),n=/(\d+)m/.exec(e),r=/(\d+)s/.exec(e);if(t||n||r)this.media_id.start=(t?parseInt(t[1],10)*3600:0)+(n?parseInt(n[1],10)*60:0)+(r?parseInt(r[1],10):0);else{let t=parseInt(e,10);this.media_id.start=Number.isNaN(t)?0:t}}else this.media_id.start=0;this.media_id.hd===void 0?this.media_id.hd=!1:this.media_id.hd=!0,this.createPlayer()}createPlayer(){if(clearTimeout(this.timer),typeof YT<`u`&&YT.Player!==void 0){let e=YT;this.player=new e.Player(this._el.content_item.id,{playerVars:{enablejsapi:1,color:`white`,autohide:1,showinfo:0,theme:`light`,start:this.media_id.start,fs:0,rel:0},videoId:this.media_id.id,events:{onReady:()=>{this.onPlayerReady()},onStateChange:this.onStateChange}})}else this.timer=setTimeout(()=>{this.createPlayer()},1e3);this.onLoaded()}onPlayerReady(e){this.youtube_loaded=!0;let t=document.getElementById(this._el.content_item.id);t&&(this._el.content_item=t),this.onMediaLoaded(),this.onLoaded()}onStateChange(e){let t=YT;e.data===t.PlayerState.ENDED&&(e.target.seekTo(0),e.target.pauseVideo())}},tS=[`width`,`height`,`frameborder`,`allowfullscreen`,`allow`,`scrolling`,`title`],nS=[`BLOCKQUOTE`,`P`,`CITE`,`EM`,`STRONG`,`B`,`I`,`U`,`Q`,`A`,`BR`,`SPAN`,`SMALL`,`SUP`,`SUB`,`FOOTER`,`UL`,`OL`,`LI`],rS=[`SCRIPT`,`STYLE`,`TEMPLATE`,`IFRAME`,`FRAME`,`OBJECT`,`EMBED`,`APPLET`,`LINK`,`META`,`BASE`,`SVG`,`MATH`,`FORM`,`INPUT`,`BUTTON`,`TEXTAREA`,`SELECT`];function iS(e){return new DOMParser().parseFromString(e,`text/html`)}function aS(e){if(!e)return null;let t=document.createElement(`a`);return t.href=e,t.protocol===`http:`||t.protocol===`https:`?t.href:null}function oS(e){let t=iS(e).querySelector(`iframe`),n=null;if(t?n=aS(t.getAttribute(`src`)):/^https?:\/\/\S+$/i.test(e.trim())&&(n=aS(e.trim())),!n)return null;let r=document.createElement(`iframe`);if(r.setAttribute(`src`,n),t)for(let e=0;e<tS.length;e++)t.hasAttribute(tS[e])&&r.setAttribute(tS[e],t.getAttribute(tS[e]));else r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`),r.setAttribute(`frameborder`,`0`),r.setAttribute(`allowfullscreen`,``);return r}function sS(e){let t=document.createDocumentFragment();return cS(iS(e).body,t),t}function cS(e,t){for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===3)t.appendChild(document.createTextNode(r.nodeValue));else if(r.nodeType===1){let e=r.nodeName.toUpperCase();if(rS.includes(e))continue;if(nS.includes(e)){let n=document.createElement(e);if(e===`A`){let e=aS(r.getAttribute(`href`));e&&(n.setAttribute(`href`,e),n.setAttribute(`target`,`_blank`))}cS(r,n),t.appendChild(n)}else cS(r,t)}}}var lS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-blockquote`,this._el.content),this.media_id=this.data.url,this._el.content_item.appendChild(sS(this.media_id)),this.onLoaded()}updateMediaDisplay(){}_updateMediaDisplay(){}},uS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-wikipedia`,this._el.content),this.media_id=this.data.url.split(`wiki/`)[1].split(`#`)[0].replace(`_`,` `),this.media_id=this.media_id.replace(` `,`%20`);let e=this.data.url.split(`//`)[1].split(`.wikipedia`)[0],t=`wikipediaCallback_`+this.media_id.replace(/[^0-9a-z]/gi,``).slice(0,494),n=`https://${e}.wikipedia.org/w/api.php?action=query&prop=extracts&redirects=&titles=${this.media_id}&exintro=1&format=json&callback=${t}`;this._fetchExtract(n,t)}async _fetchExtract(e,t){try{this.createMedia(await O(e,t))}catch{this.loadErrorDisplay(`Unable to load this article.`)}}createMedia(e){let t=e;if(t.query){let e,n={entry:{},title:``,text:``,extract:``,paragraphs:1,text_array:[]},r=t.query;n.entry=w(r.pages,0),n.extract=n.entry.extract,n.title=n.entry.title,n.extract.match(`<p>`)?n.text_array=n.extract.split(`<p>`):n.text_array.push(n.extract);for(let e=0;e<n.text_array.length;e++)e+1<=n.paragraphs&&e+1<n.text_array.length&&(n.text+=`<p>`+n.text_array[e+1]);e=`<h4><a href='`+this.data.url+`' target='_blank'>`+n.title+`</a></h4>`,e+=`<span class='wiki-source'>`+j.messages.wikipedia+`</span>`,e+=n.text,n.extract.match(`REDIRECT`)||(this._el.content_item.innerHTML=e,this.onLoaded())}}updateMediaDisplay(){}_updateMediaDisplay(){}},dS=class extends Qx{async _loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-soundcloud vco-media-shadow`,this._el.content),this.media_id=this.data.url;let e=`https://soundcloud.com/oembed?url=`+this.media_id+`&format=json`;try{let t=await(await fetch(e)).json();await this.loadScript(`https://w.soundcloud.com/player/api.js`),this.createMedia(t)}catch(e){e?.name!==`AbortError`&&this.loadErrorDisplay(`Unable to load this track.`)}}createMedia(e){let t=e;if(!t?.html){this.loadErrorDisplay(`Unable to load this track.`);return}this._el.content_item.innerHTML=t.html,this.soundCloudCreated=!0;let n=SC;this.widget=n.Widget(this._el.content_item.querySelector(`iframe`)),this.onLoaded()}_stopMedia(){this.soundCloudCreated&&this.widget?.pause()}},fS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-vimeo vco-media-shadow`,this._el.content);let e=this.data.url.split(/video\/|\/\/vimeo\.com\//);if(!e[1])throw Error(`Invalid Vimeo URL`);this.media_id=e[1].split(/[?&]/)[0];let t=`https://player.vimeo.com/video/`+this.media_id+`?api=1&title=0&byline=0&portrait=0&color=ffffff`;this.player=M.create(`iframe`,``,this._el.content_item),this.player.width=`100%`,this.player.height=`100%`,this.player.frameBorder=`0`,this.player.src=t,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=S.r16_9({w:this._el.content_item.offsetWidth})+`px`}_stopMedia(){try{this.player?.contentWindow?.postMessage(JSON.stringify({method:`pause`}),`https://player.vimeo.com`)}catch(e){console.log(e)}}},pS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`video`,`vco-media-item vco-media-video vco-media-shadow`,this._el.content);let e=this._el.content_item;e.controls=!0,this._el.source_item=M.create(`source`,``,this._el.content_item);let t=this._el.source_item;e.addEventListener(`canplay`,()=>{this.onLoaded()}),t.addEventListener(`error`,()=>{this.loadErrorDisplay(j.messages.error+` `+this.options.media_name)}),t.src=this.data.url;let n=this._getType(this.data.url,this.data.mediatype.match_str);n&&(t.type=n),e.appendChild(document.createTextNode(`Your browser doesn't support HTML5 video with `+t.type)),this.player_element=e}_updateMediaDisplay(){}_stopMedia(){this.player_element&&this.player_element.pause()}_getType(e,t){let n=e.match(t),r=`video/`;if(!n)return r;switch(n[1]){case`mp4`:r+=`mp4`;break;case`webm`:r+=`webm`;break;default:r=``}return r}},mS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`audio`,`vco-media-item vco-media-audio vco-media-shadow`,this._el.content);let e=this._el.content_item;e.controls=!0,this._el.source_item=M.create(`source`,``,this._el.content_item);let t=this._el.source_item;e.addEventListener(`canplay`,()=>{this.onLoaded()}),t.addEventListener(`error`,()=>{this.loadErrorDisplay(j.messages.error+` `+this.options.media_name)}),t.src=this.data.url;let n=this._getType(this.data.url,this.data.mediatype.match_str);n&&(t.type=n),e.appendChild(document.createTextNode(`Your browser doesn't support HTML5 audio with `+t.type)),this.player_element=e}_updateMediaDisplay(){}_stopMedia(){this.player_element&&this.player_element.pause()}_getType(e,t){let n=e.match(t),r=`audio/`;if(!n)return r;switch(n[1]){case`mp3`:r+=`mpeg`;break;case`wav`:r+=`wav`;break;case`m4a`:r+=`mp4`;break;default:r=``}return r}},hS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-dailymotion`,this._el.content);let e=this.data.url.match(`video`)?this.data.url.split(`video/`)[1]:this.data.url.split(`embed/`)[1];if(!e)throw Error(`Invalid DailyMotion URL`);this.media_id=e.split(/[?&]/)[0];let t=`https://www.dailymotion.com/embed/video/`+this.media_id+`?api=postMessage`;this._el.content_item.innerHTML=`<iframe autostart='false' frameborder='0' width='100%' height='100%' src='`+t+`'></iframe>`,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=S.r16_9({w:this._el.content_item.offsetWidth})+`px`}_stopMedia(){(this._el.content_item?.querySelector(`iframe`))?.contentWindow?.postMessage(`{"command":"pause","parameters":[]}`,`*`)}},gS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-twitter`,this._el.content);let e=/(?:twitter\.com|x\.com)\/(.+?)\/status\/(\d+)/.exec(this.data.url);e&&(this.user_id=e[1],this.media_id=e[2]);let t=`twitterCallback_${this.media_id}`,n=`https://api.twitter.com/1/statuses/oembed.json?id=${this.media_id}&include_entities=true&callback=${t}`;this._fetchEmbed(n,t)}async _fetchEmbed(e,t){try{this.createMedia(await O(e,t))}catch{this.loadErrorDisplay(`Unable to load this tweet.`)}}createMedia(e){let t=e,n=``,r;r=t.html.split(`</p>—`)[0]+`</p></blockquote>`;let i=t.author_url.split(/twitter\.com|x\.com\//)[1],a=t.html.split(`</p>—`)[1].split(`<a href="`)[1],o=a.split(`">`)[0],s=a.split(`">`)[1].split(`</a>`)[0];r=r.replace(/<a href/gi,`<a target="_blank" href`),n+=r,n+=`<div class='vcard'>`,n+=`<a href='`+o+`' class='twitter-date' target='_blank'>`+s+`</a>`,n+=`<div class='author'>`,n+=`<a class='screen-name url' href='`+t.author_url+`' target='_blank'>`,n+=`<span class='avatar'></span>`,n+=`<span class='fn'>`+t.author_name+` <span class='vco-icon-twitter'></span></span>`,n+=`<span class='nickname'>@`+i+`<span class='thumbnail-inline'></span></span>`,n+=`</a>`,n+=`</div>`,n+=`</div>`,this._el.content_item.innerHTML=n,this.onLoaded()}updateMediaDisplay(){}_updateMediaDisplay(){}},_S=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`img`,`vco-media-item vco-media-image vco-media-flickr vco-media-shadow`,this._el.content),this._el.content_item.addEventListener(`load`,e=>{this.onMediaLoaded()}),this.establishMediaID();let e=`https://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=`+this.options.api_key_flickr+`&photo_id=`+this.media_id+`&format=json&nojsoncallback=1`;this._fetchSizes(e)}async _fetchSizes(e){try{let t=await(await fetch(e)).json();t.stat===`ok`?this.createMedia(t):this.loadErrorDisplay(`Photo not found or private.`)}catch{this.loadErrorDisplay(`Photo not found or private.`)}}establishMediaID(){let e=this.data.url.indexOf(`flickr.com/photos/`);if(e===-1)throw`Invalid Flickr URL`;let t=e+18;this.media_id=this.data.url.slice(t).split(`/`)[1]}createMedia(e){let t=e,n=this.sizes(this.options.height),r=t?.sizes?.size;if(!r||!r.length){this.loadErrorDisplay(`Photo not found or private.`);return}let i=r[Math.max(0,r.length-2)].source;for(let e=0;e<r.length;e++)r[e].label===n&&(i=r[e].source);this._el.content_item.src=i,this.onLoaded()}sizes(e){let t;return t=e<=75?e<=0?`Large`:`Thumbnail`:e<=180?`Small`:e<=240?`Small 320`:e<=375?`Medium`:e<=480?`Medium 640`:`Large`,t}},vS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe`,this._el.content),this.media_id=this.data.url;let e=aS(this.media_id);if(!e){this.loadErrorDisplay(`Invalid URL.`);return}let t=document.createElement(`iframe`);t.className=`doc`,t.setAttribute(`frameborder`,`0`),t.setAttribute(`width`,`100%`),t.setAttribute(`height`,`100%`),this.media_id.match(/docs.google.com/i)?t.setAttribute(`src`,e+`&embedded=true`):t.setAttribute(`src`,`http://docs.google.com/viewer?url=`+encodeURIComponent(e)+`&embedded=true`),this._el.content_item.appendChild(t),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},yS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe`,this._el.content),this.media_id=this.data.url;let e=oS(this.media_id);if(!e){this.loadErrorDisplay(`Invalid embed code. Paste an iframe embed code with an http(s) source URL.`);return}this._el.content_item.appendChild(e),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},bS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe`,this._el.content),this.media_id=this.data.url;let e=aS(this.media_id);if(!e){this.loadErrorDisplay(`Invalid URL.`);return}let t=document.createElement(`iframe`);t.setAttribute(`src`,e),this._el.content_item.appendChild(t),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},xS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-facebook`,this._el.content);let e=this.data.url,t=encodeURIComponent(e),n=/\/videos?\//.test(e)||/\/watch/.test(e)||/\/reel\//.test(e)?`https://www.facebook.com/plugins/video.php?href=${t}&show_text=true`:`https://www.facebook.com/plugins/post.php?href=${t}&show_text=true`;this._el.content_item.innerHTML=`<iframe src="${n}" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>`,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},SS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-documentcloud`,this._el.content);let e=aS(this.data.url);if(!e){this.loadErrorDisplay(`Invalid URL.`);return}let t=document.createElement(`iframe`);t.setAttribute(`src`,e),this._el.content_item.appendChild(t),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},CS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-juxtapose`,this._el.content),this._el.content_item.innerHTML=`<iframe src="${this.data.url}" />`,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}};function wS(e){let t=[{type:`youtube`,name:`YouTube`,match_str:`(www.)?youtube|youtu.be`,cls:eS},{type:`vimeo`,name:`Vimeo`,match_str:`(player.)?vimeo.com`,cls:fS},{type:`dailymotion`,name:`DailyMotion`,match_str:`(www.)?dailymotion.com`,cls:hS},{type:`soundcloud`,name:`SoundCloud`,match_str:`(player.)?soundcloud.com`,cls:dS},{type:`twitter`,name:`Twitter`,match_str:`^(https?:)?/+(www.)?(twitter|x).com`,cls:gS},{type:`flickr`,name:`Flickr`,match_str:`flickr.com/photos`,cls:_S},{type:`image`,name:`Image`,match_str:/jpg|jpeg|png|gif|webp/i,cls:$x},{type:`video`,name:`Video`,match_str:/(mp4|webm)(\?.*)?$/i,cls:pS},{type:`audio`,name:`Audio`,match_str:/(mp3|wav|m4a)(\?.*)?$/i,cls:mS},{type:`googledocs`,name:`Google Doc`,match_str:`^(https?:)?/*[^.]*.google.com/[^/]*/d/[^/]*/[^/]*?usp=sharing|^(https?:)?/*drive.google.com/open?id=[^&]*&authuser=0|^(https?:)?//*drive.google.com/open\\?id=[^&]*|^(https?:)?/*[^.]*.googledrive.com/host/[^/]*/`,cls:vS},{type:`wikipedia`,name:`Wikipedia`,match_str:`(www.)?wikipedia.org`,cls:uS},{type:`iframe`,name:`iFrame`,match_str:`iframe`,cls:yS},{type:`facebook`,name:`Facebook`,match_str:`(www.)?facebook.com`,cls:xS},{type:`documentcloud`,name:`DocumentCloud`,match_str:`documentcloud.org/documents/`,cls:SS},{type:`juxtapose`,name:`Juxtapose`,match_str:`juxtapose`,cls:CS},{type:`blockquote`,name:`Quote`,match_str:`blockquote`,cls:lS},{type:`website`,name:`Website`,match_str:`https?://`,cls:bS},{type:``,name:``,match_str:``,cls:Qx}];for(let n of t)if(typeof e.url==`string`&&e.url.match(n.match_str))return n;return!1}var TS=class{constructor(e,t,n){this._el={container:{},content_container:{},content:{},headline:{},date:{},start_btn:{}},this.data={uniqueid:``,headline:`headline`,text:`text`},this.options={title:!1},d(this,e),f(this.options,t),this._el.container=M.create(`div`,`vco-text`),this._el.container.id=this.data.uniqueid,this._initLayout(),n&&n.appendChild(this._el.container)}show(){}hide(){}addTo(e){e.appendChild(this._el.container)}removeFrom(e){e.removeChild(this._el.container)}headlineHeight(){return this._el.headline.offsetHeight+40}addDateText(e){this._el.date&&(this._el.date.innerHTML=e)}onLoaded(){this.fire(`loaded`,this.data)}onAdd(){this.fire(`added`,this.data)}onRemove(){this.fire(`removed`,this.data)}_initLayout(){this._el.content_container=M.create(`div`,`vco-text-content-container`,this._el.container);let e=this.data.text_align??this.options.text_align??`left`;if((e===`center`||e===`right`)&&this._el.content_container.classList.add(`vco-text-align-`+e),this.data.date&&this.data.date.created_time&&this.data.date.created_time!==``&&(this._el.date=M.create(`h3`,`vco-headline-date`,this._el.content_container),this.addDateText(u(this.data.date.created_time))),this.data.headline!==``){let e=`vco-headline`;this.options.title&&(e=`vco-headline vco-headline-title`),this._el.headline=M.create(`h2`,e,this._el.content_container),this._el.headline.innerHTML=this.data.headline}if(this.data.text!==``){let e=``;e+=b(this.data.text),this.data.date&&this.data.date.created_time&&this.data.date.created_time!==``&&this.data.date.created_time.length>10&&(e+=`<div class='vco-text-date'>`+u(this.data.date.created_time)+`</div>`),this._el.content=M.create(`div`,`vco-text-content`,this._el.content_container),this._el.content.innerHTML=e}this.onLoaded()}},ES=class extends Ze(TS){constructor(...e){super(...e)}},DS=class{constructor(e,t,n){this._el={container:{},scroll_container:{},background:{},content_container:{},content:{},call_to_action:null},this._media=null,this._mediaclass={},this._text={},this._state={loaded:!1},this.has={headline:!1,text:!1,media:!1,title:!1,background:{image:!1,color:!1,color_value:``}},this.has.title=n,this.title=``,this.data={uniqueid:null,background:null,date:null,location:null,text:null,media:null},this.options={duration:1e3,slide_padding_lr:40,ease:Xe,width:600,height:600,skinny_size:650,media_name:``},this.active=!1,this.animator={},f(this.options,t),f(this.data,e),this._initLayout()}show(){}hide(){}setActive(e){this.active=e,this.active?(this.data.background&&this.fire(`background_change`,this.has.background),this.loadMedia()):this.stopMedia()}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}loadMedia(){this._media&&!this._state.loaded&&(this._media.loadMedia(),this._state.loaded=!0)}stopMedia(){if(this._media&&this._state.loaded){try{this._media.stopMedia()}catch(e){if(e.message===`this._el.content_item.querySelector is not a function`)console.log(`Ignoring error in editor context: `+e.message);else throw e}this._media._state?.loaded||(this._state.loaded=!1)}}getBackground(){return this.has.background}scrollToTop(){this._el.container.scrollTop=0}addCallToAction(e){this._el.call_to_action=M.create(`div`,`vco-slide-calltoaction`,this._el.content_container),this._el.call_to_action.innerHTML=`<span class='vco-slide-calltoaction-button-text'>`+e+`</span>`,Ux.addListener(this._el.call_to_action,`click`,this._onCallToAction,this)}_onCallToAction(e){this.fire(`call_to_action`,e)}_initLayout(){if(this._el.container=M.create(`div`,`vco-slide`),this.data.uniqueid&&(this._el.container.id=this.data.uniqueid),this._el.scroll_container=M.create(`div`,`vco-slide-scrollable-container`,this._el.container),this._el.content_container=M.create(`div`,`vco-slide-content-container`,this._el.scroll_container),this._el.content=M.create(`div`,`vco-slide-content`,this._el.content_container),this._el.background=M.create(`div`,`vco-slide-background`,this._el.container),this.data.background){let e=this.data.background;e.url&&(this.has.background.image=!0,this._el.container.className+=` vco-full-image-background`,this.has.background.color_value=`#000`,this._el.background.style.backgroundImage=`url('`+e.url+`')`,this._el.background.style.display=`block`),e.color&&(this.has.background.color=!0,this._el.container.className+=` vco-full-color-background`,this.has.background.color_value=e.color),e.text_background&&(this._el.container.className+=` vco-text-background`)}this.data.media&&this.data.media.url&&this.data.media.url!==``&&(this.has.media=!0),this.data.text&&this.data.text.text&&(this.has.text=!0),this.data.text&&this.data.text.headline&&(this.has.headline=!0,this.title=this.data.text.headline),this.has.media&&(this.data.media.mediatype=wS(this.data.media),this.options.media_name=this.data.media.mediatype.name,this.options.media_type=this.data.media.mediatype.type,this._media=new this.data.media.mediatype.cls(this.data.media,this.options)),(this.has.text||this.has.headline)&&(this._text=new ES(this.data.text,{title:this.has.title,text_align:this.options.text_align})),!this.has.text&&!this.has.headline&&this.has.media?(this._el.container.className+=` vco-slide-media-only`,this._media.addTo(this._el.content)):this.has.headline&&this.has.media&&!this.has.text?(this._el.container.className+=` vco-slide-media-only`,this._text.addTo(this._el.content),this._media.addTo(this._el.content)):this.has.text&&this.has.media?(this._media.addTo(this._el.content),this._text.addTo(this._el.content)):(this.has.text||this.has.headline)&&(this._el.container.className+=` vco-slide-text-only`,this._text.addTo(this._el.content)),this.onLoaded()}_updateDisplay(e,t,n){let r,i,a;e?this.options.width=e:this.options.width=this._el.container.offsetWidth,Px.mobile&&this.options.width<=this.options.skinny_size?(r=`0px`,i=`0px`,a=this.options.width-0+`px`):n===`landscape`?(r=`40px`,i=`75px`,a=this.options.width-115+`px`):(this.options.width,this.options.skinny_size,r=this.options.slide_padding_lr+`px`,i=this.options.slide_padding_lr+`px`,a=this.options.width-this.options.slide_padding_lr*2+`px`),this._el.content.style.paddingLeft=r,this._el.content.style.paddingRight=i,this._el.content.style.width=a,this._el.call_to_action&&(this._el.call_to_action.style.paddingLeft=r,this._el.call_to_action.style.paddingRight=i,this._el.call_to_action.style.width=a),t?this.options.height=t:this.options.height=this._el.container.offsetHeight,this._media&&(!this.has.text&&this.has.headline?this._media.updateDisplay(this.options.width,this.options.height-this._text.headlineHeight(),n):this._media.updateDisplay(this.options.width,this.options.height,n))}},OS=class extends Qe(Ze(DS)){constructor(...e){super(...e)}},kS=class{constructor(e,t,n){this.mousedrag={down:`mousedown`,up:`mouseup`,leave:`mouseleave`,move:`mousemove`},this.touchdrag={down:`touchstart`,up:`touchend`,leave:`mouseleave`,move:`touchmove`},this._el={drag:e,move:e},t&&(this._el.move=t),this.options={snap:!1,enable:{x:!0,y:!0},constraint:{top:!1,bottom:!1,left:0,right:!1},momentum_multiplier:2e3,duration:1e3,ease:Je},this.animator=null,this.dragevent=this.mousedrag,Px.touch&&(this.dragevent=this.touchdrag),this.data={sliding:!1,direction:`none`,pagex:{start:0,end:0},pagey:{start:0,end:0},pos:{start:{x:0,y:0},end:{x:0,y:0}},new_pos:{x:0,y:0},new_pos_parent:{x:0,y:0},time:{start:0,end:0},touch:!1},f(this.options,n)}enable(e){Ux.addListener(this._el.drag,this.dragevent.down,this._onDragStart,this),Ux.addListener(this._el.drag,this.dragevent.up,this._onDragEnd,this),this.data.pos.start=0,this._el.move.style.left=this.data.pos.start.x+`px`,this._el.move.style.top=this.data.pos.start.y+`px`,this._el.move.style.position=`absolute`}disable(){Ux.removeListener(this._el.drag,this.dragevent.down,this._onDragStart,this),Ux.removeListener(this._el.drag,this.dragevent.up,this._onDragEnd,this)}stopMomentum(){this.animator&&this.animator.stop()}updateConstraint(e){this.options.constraint=e}_onDragStart(e){this.animator&&this.animator.stop(),Px.touch?e.originalEvent?(this.data.pagex.start=e.originalEvent.touches[0].screenX,this.data.pagey.start=e.originalEvent.touches[0].screenY):(this.data.pagex.start=e.targetTouches[0].screenX,this.data.pagey.start=e.targetTouches[0].screenY):(this.data.pagex.start=e.pageX,this.data.pagey.start=e.pageY),this.options.enable.x,this.options.enable.y,this.data.pos.start={x:this._el.move.offsetLeft,y:this._el.move.offsetTop},this.data.time.start=Date.now(),this.fire(`dragstart`,this.data),Ux.addListener(this._el.drag,this.dragevent.move,this._onDragMove,this),Ux.addListener(this._el.drag,this.dragevent.leave,this._onDragEnd,this)}_onDragEnd(e){this.data.sliding=!1,Ux.removeListener(this._el.drag,this.dragevent.move,this._onDragMove,this),Ux.removeListener(this._el.drag,this.dragevent.leave,this._onDragEnd,this),this.fire(`dragend`,this.data),this._momentum()}_onDragMove(e){let t={x:0,y:0};this.data.sliding=!0,Px.touch?e.originalEvent?(this.data.pagex.end=e.originalEvent.touches[0].screenX,this.data.pagey.end=e.originalEvent.touches[0].screenY):(this.data.pagex.end=e.targetTouches[0].screenX,this.data.pagey.end=e.targetTouches[0].screenY):(this.data.pagex.end=e.pageX,this.data.pagey.end=e.pageY),t.x=this.data.pagex.start-this.data.pagex.end,t.y=this.data.pagey.start-this.data.pagey.end,this.data.pos.end={x:this._el.drag.offsetLeft,y:this._el.drag.offsetTop},this.data.new_pos.x=-(t.x-this.data.pos.start.x),this.data.new_pos.y=-(t.y-this.data.pos.start.y),this.options.enable.x&&Math.abs(t.x)>Math.abs(t.y)&&(e.preventDefault(),this._el.move.style.left=this.data.new_pos.x+`px`),this.options.enable.y&&Math.abs(t.y)>Math.abs(t.x)&&(e.preventDefault(),this._el.move.style.top=this.data.new_pos.y+`px`),this.fire(`dragmove`,this.data)}_momentum(){let e={x:0,y:0,time:0},t={x:0,y:0,time:0},n={x:!1,y:!1},r=!1;this.data.direction=null,e.time=(Date.now()-this.data.time.start)*10,t.time=(Date.now()-this.data.time.start)*10,t.x=this.options.momentum_multiplier*(Math.abs(this.data.pagex.end)-Math.abs(this.data.pagex.start)),t.y=this.options.momentum_multiplier*(Math.abs(this.data.pagey.end)-Math.abs(this.data.pagey.start)),e.x=Math.round(t.x/t.time),e.y=Math.round(t.y/t.time),this.data.new_pos.x=this.data.pos.end.x+e.x,this.data.new_pos.y=this.data.pos.end.y+e.y,this.options.enable.x?this.data.new_pos.x>0&&(this.data.new_pos.x=0):this.data.new_pos.x=this.data.pos.start.x,this.options.enable.y?this.data.new_pos.y<0&&(this.data.new_pos.y=0):this.data.new_pos.y=this.data.pos.start.y,t.time<2e3&&(r=!0),this.options.enable.x&&this.options.enable.y?Math.abs(t.x)>Math.abs(t.y)?n.x=!0:n.y=!0:this.options.enable.x?Math.abs(t.x)>Math.abs(t.y)&&(n.x=!0):Math.abs(t.y)>Math.abs(t.x)&&(n.y=!0),n.x&&(Math.abs(t.x)>this._el.drag.offsetWidth/2&&(r=!0),Math.abs(t.x)>1e4&&(this.data.direction=`left`,t.x>0&&(this.data.direction=`right`))),n.y&&(Math.abs(t.y)>this._el.drag.offsetHeight/2&&(r=!0),Math.abs(t.y)>1e4&&(this.data.direction=`up`,t.y>0&&(this.data.direction=`down`))),this._animateMomentum(),r&&this.data.direction?this.fire(`swipe_`+this.data.direction,this.data):this.data.direction?this.fire(`swipe_nodirection`,this.data):this.options.snap&&(this.animator.stop(),this.animator=(0,Kx.default)(this._el.move,{top:this.data.pos.start.y,left:this.data.pos.start.x,duration:this.options.duration,easing:Ye}))}_animateMomentum(){let e={x:this.data.new_pos.x,y:this.data.new_pos.y},t={duration:this.options.duration,easing:Ye};this.options.enable.y&&((this.options.constraint.top||this.options.constraint.bottom)&&(e.y>this.options.constraint.bottom?e.y=this.options.constraint.bottom:e.y<this.options.constraint.top&&(e.y=this.options.constraint.top)),t.top=Math.floor(e.y)+`px`),this.options.enable.x&&((this.options.constraint.left||this.options.constraint.right)&&(e.x>=this.options.constraint.left?e.x=this.options.constraint.left:e.x<this.options.constraint.right&&(e.x=this.options.constraint.right)),t.left=Math.floor(e.x)+`px`),this.animator=(0,Kx.default)(this._el.move,t),this.fire(`momentum`,this.data)}},AS=class extends Ze(kS){constructor(...e){super(...e)}},jS=class{constructor(e,t,n,r){this._el={container:{},background:{},slider_container_mask:{},slider_container:{},slider_item_container:{}},this._nav={previous:{},next:{}},this.slide_spacing=0,this._slides=[],this.current_slide=0,this.current_bg_color=null,this.data={},this.options={id:``,layout:`portrait`,width:600,height:600,default_bg_color:{r:256,g:256,b:256},slide_padding_lr:40,start_at_slide:1,slide_default_fade:`0%`,duration:1e3,ease:Je,dragging:!0,trackResize:!0},typeof e==`object`?(this._el.container=e,this.options.id=v(6,`vco`)):(this.options.id=e,this._el.container=M.get(e)),this._el.container.id||(this._el.container.id=this.options.id),this.animator=null,this.animator_background=null,f(this.options,n),f(this.data,t),r&&this.init()}init(){this._initLayout(),this._initEvents(),this._initData(),this._updateDisplay(),this.goTo(this.options.start_at_slide),this._onLoaded(),this._introInterface()}updateDisplay(e,t,n,r){this._updateDisplay(e,t,n,r)}createSlide(e){this._createSlide(e)}createSlides(e){this._createSlides(e)}_createSlides(e){for(let t=0;t<e.length;t++)e[t].uniqueid===``&&(e[t].uniqueid=v(6,`vco-slide`)),t===0?this._createSlide(e[t],!0):this._createSlide(e[t],!1)}_createSlide(e,t){let n=new OS(e,this.options,t);this._addSlide(n),this._slides.push(n)}_addSlide(e){e.addTo(this._el.slider_item_container),e.on(`added`,this._onSlideAdded,this),e.on(`background_change`,this._onBackgroundChange,this)}goToId(e,t,n){let r;r=typeof e==`string`||e instanceof String?_(String(e),this._slides,`uniqueid`):e,this.goTo(r,t,n)}goTo(e,t,n){this.changeBackground({color_value:``,image:!1}),this.preloadTimer&&(clearTimeout(this.preloadTimer),window.cancelIdleCallback?.(this.preloadTimer));for(let e=0;e<this._slides.length;e++)this._slides[e].setActive(!1);if(e<this._slides.length&&e>=0){let r=this.current_slide;this.current_slide=e;let i=Math.abs(e-r),a=Math.max(600,Math.min(1e3+i*120,2e3));this.animator&&this.animator.stop(),this._swipable&&this._swipable.stopMomentum(),t?(this._el.slider_container.style.left=-(this.slide_spacing*e)+`px`,this._onSlideChange(n)):(this._onSlideChange(n),this.animator=(0,Kx.default)(this._el.slider_container,{left:-(this.slide_spacing*e)+`px`,duration:a,easing:this.options.ease})),this._slides.length>0&&this._slides[this.current_slide].setActive(!0),this._slides[this.current_slide+1]&&(this._slides[this.current_slide+1].loadMedia(),this._slides[this.current_slide+1].scrollToTop()),this._slides[this.current_slide+1]?(this.showNav(this._nav.next,!0),this._nav.next.update(this.getNavInfo(this._slides[this.current_slide+1]))):this.showNav(this._nav.next,!1),this._slides[this.current_slide-1]?(this.showNav(this._nav.previous,!0),this._nav.previous.update(this.getNavInfo(this._slides[this.current_slide-1]))):this.showNav(this._nav.previous,!1);let o=window;this.preloadTimer=o.requestIdleCallback?o.requestIdleCallback(()=>this.preloadSlides(),{timeout:this.options.duration}):setTimeout(()=>{this.preloadSlides()},this.options.duration)}}preloadSlides(){this._slides[this.current_slide+1]&&(this._slides[this.current_slide+1].loadMedia(),this._slides[this.current_slide+1].scrollToTop()),this._slides[this.current_slide+2]&&(this._slides[this.current_slide+2].loadMedia(),this._slides[this.current_slide+2].scrollToTop()),this._slides[this.current_slide-1]&&(this._slides[this.current_slide-1].loadMedia(),this._slides[this.current_slide-1].scrollToTop()),this._slides[this.current_slide-2]&&(this._slides[this.current_slide-2].loadMedia(),this._slides[this.current_slide-2].scrollToTop())}getNavInfo(e){let t={title:``,description:``};return e.data.text&&e.data.text.headline&&(t.title=e.data.text.headline),t}next(){this.current_slide+1<this._slides.length?this.goTo(this.current_slide+1):this.goTo(this.current_slide)}previous(){this.current_slide-1>=0?this.goTo(this.current_slide-1):this.goTo(this.current_slide)}showNav(e,t){this.options.width<=500&&Px.mobile||(t?e.show():e.hide())}changeBackground(e){let t=!1,n,r=this.options.slide_default_fade,i=``;this._el.background.getAttribute(`style`),n=e.color_value?y(e.color_value):this.options.default_bg_color,this.animator_background&&this.animator_background.stop();let a=n.r+`,`+n.g+`,`+n.b;(!this.current_bg_color||this.current_bg_color!==a)&&(this.current_bg_color=a,t=!0),t&&(this.options.layout===`landscape`?(this._nav.next.setColor(!1),this._nav.previous.setColor(!1),n.r<255&&n.g<255&&n.b<255&&(r=`15%`),e.image&&(r=`0%`),i+=`opacity:0;`,i+=`background-image: linear-gradient(to right, rgba(`+a+`,0.0001 ) `+r+`, rgba(`+a+`,0.87) 15%);`,i+=`background-repeat: repeat-x;`,i+=`filter: e(%('progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)',argb(`+a+`, 0.0001),argb(`+a+`,0.80)));`):(e.color_value?i+=`background-color:`+e.color_value+`;`:i+=`background-color:#FFF;`,n.r<255&&n.g<255&&n.b<255||e.image?(this._nav.next.setColor(!0),this._nav.previous.setColor(!0)):(this._nav.next.setColor(!1),this._nav.previous.setColor(!1))),this.animator_background=(0,Kx.default)(this._el.background,{opacity:0,duration:this.options.duration/2,easing:this.options.ease,complete:()=>{this.fadeInBackground(i)}}))}fadeInBackground(e){this.animator_background&&this.animator_background.stop(),e&&this._el.background.setAttribute(`style`,e),this.animator_background=(0,Kx.default)(this._el.background,{opacity:1,duration:this.options.duration/2,easing:this.options.ease})}_updateDisplay(e,t,n,r){let i;i=r===void 0?this.options.layout:r,this.options.layout=i,this.slide_spacing=this.options.width*2,e?this.options.width=e:this.options.width=this._el.container.offsetWidth,t?this.options.height=t:this.options.height=this._el.container.offsetHeight;let a=this.options.height/2;this._nav.next.setPosition({top:a}),this._nav.previous.setPosition({top:a});for(let e=0;e<this._slides.length;e++)this._slides[e].updateDisplay(this.options.width,this.options.height,i),this._slides[e].setPosition({left:this.slide_spacing*e,top:0});this.goTo(this.current_slide,!0,!0)}_introInterface(){if(this.options.call_to_action){let e=j.messages.start;this.options.call_to_action_text!==``&&(e=this.options.call_to_action_text),this._slides[0].addCallToAction(e),this._slides[0].on(`call_to_action`,this.next,this)}this.options.width<=this.options.skinny_size||(this._nav.next.updatePosition({right:`130`},!1,this.options.duration*3,this.options.ease,-100,!0),this._nav.previous.updatePosition({left:`-100`},!0,this.options.duration*3,this.options.ease,-200,!0))}_initLayout(){this._el.container.className+=` vco-storyslider`,this._el.slider_container_mask=M.create(`div`,`vco-slider-container-mask`,this._el.container),this._el.background=M.create(`div`,`vco-slider-background`,this._el.container),this._el.slider_container=M.create(`div`,`vco-slider-container`,this._el.slider_container_mask),this._el.slider_item_container=M.create(`div`,`vco-slider-item-container`,this._el.slider_container),this.options.width=this._el.container.offsetWidth,this.options.height=this._el.container.offsetHeight,this._nav.previous=new Jx({title:`Previous`,description:`description`},{direction:`previous`}),this._nav.next=new Jx({title:`Next`,description:`description`},{direction:`next`}),this._nav.next.addTo(this._el.container),this._nav.previous.addTo(this._el.container),this._el.slider_container.style.left=`0px`,Px.touch&&(this._swipable=new AS(this._el.slider_container_mask,this._el.slider_container,{enable:{x:!0,y:!1},snap:!0}),this._swipable.enable(),this._message=new Xx({},{message_class:`vco-message-full`,message_icon_class:`vco-icon-swipe-left`}),this._message.updateMessage(j.buttons.swipe_to_navigate),this._message.addTo(this._el.container))}_initEvents(){this._nav.next.on(`clicked`,this._onNavigation,this),this._nav.previous.on(`clicked`,this._onNavigation,this),this._message&&this._message.on(`clicked`,this._onMessageClick,this),this._swipable&&(this._swipable.on(`swipe_left`,this._onNavigation,this),this._swipable.on(`swipe_right`,this._onNavigation,this),this._swipable.on(`swipe_nodirection`,this._onSwipeNoDirection,this)),this._el.container.setAttribute(`tabindex`,`0`),Ux.addListener(this._el.container,`keydown`,this._onKeyDown,this)}_onKeyDown(e){let t=e.key,n=e.target,r=n?.tagName?.toLowerCase();r===`input`||r===`textarea`||r===`select`||n?.isContentEditable||(t===`ArrowRight`||t===`ArrowDown`?(Ux.preventDefault(e),this.next()):(t===`ArrowLeft`||t===`ArrowUp`)&&(Ux.preventDefault(e),this.previous()))}_initData(){this._createSlides(this.data.slides)}_onBackgroundChange(e){let t=this._slides[this.current_slide].getBackground();this.changeBackground(e),this.fire(`colorchange`,t)}_onMessageClick(e){this._message.hide()}_onSwipeNoDirection(e){this.goTo(this.current_slide)}_onNavigation(e){e.direction===`next`||e.direction===`left`?this.next():(e.direction===`previous`||e.direction===`right`)&&this.previous(),this.fire(`nav_`+e.direction,this.data)}_onSlideAdded(e){this.fire(`slideAdded`,this.data)}_onSlideChange(e){e||this.fire(`change`,{current_slide:this.current_slide,uniqueid:this._slides[this.current_slide].data.uniqueid})}_onLoaded(){this.fire(`loaded`,this.data),this._slides.length>0&&this.fire(`title`,{title:this._slides[0].title})}},MS=class extends Ze(jS){constructor(...e){super(...e)}},NS=class{constructor(e,t,n,r){for(let e in r){let t=r[e];if(typeof t==`function`)this.on(e,t);else for(let n in t)typeof t[n]==`function`?this.on(e,t[n]):console.log(`WARNING: Ignoring invalid callback '`+t[n]+`' defined for listener '`+e+`' in StoryMap constructor`)}return this.version=`0.1.16`,this.ready=!1,this._el={container:{},storyslider:{},map:{},menubar:{}},typeof e==`object`?this._el.container=e:this._el.container=M.get(e),this._storyslider={},this._map={},this.map={},this._menubar={},this._loaded={storyslider:!1,map:!1},this.data={},this.options={script_path:PS.SCRIPT_PATH,height:this._el.container.offsetHeight,width:this._el.container.offsetWidth,layout:`landscape`,base_class:``,default_bg_color:{r:255,g:255,b:255},map_size_sticky:2.5,map_center_offset:null,less_bounce:!1,start_at_slide:0,call_to_action:!1,call_to_action_text:``,menubar_height:0,fullscreen:!0,show_overview:!0,show_back_to_start:!0,skinny_size:650,duration:1e3,ease:Je,dragging:!0,trackResize:!0,nocache:!1,autoplay:0,show_progress:!1,marker_labels:!1,text_align:`left`,map_overview_center:null,map_type:``,attribution:``,map_mini:!0,map_subdomains:``,map_as_image:!1,map_access_token:``,map_background_color:`#d9d9d9`,map_bbox:null,consent_required:!1,zoomify:void 0,text_color:``,text_background_color:``,show_distance:!1,use_custom_markers:!1,iiif:{url:``,attribution:``},map_height:300,storyslider_height:600,slide_padding_lr:45,slide_default_fade:`0%`,menubar_default_y:0,path_gfx:`gfx`,map_popup:!1,zoom_distance:100,calculate_zoom:!0,line_follows_path:!0,line_color:`#c34528`,line_color_inactive:`#CCC`,line_join:`miter`,line_weight:3,line_opacity:.8,line_dash:`5,5`,show_lines:!0,show_history_line:!0,api_key_flickr:``,font_css:`stock:default`,language:`en`},this.animator_map=null,this.animator_storyslider=null,this._resize_observer=null,this._resize_timer=null,this._autoplay_timer=null,this._autoplay_stopped=!1,this._hash_initialized=!1,f(this.options,n),this.current_slide=this.options.start_at_slide,this._initData(t),this}_initData(e){if(this._data_from_manifest=!1,typeof e==`string`){let t=this.options.nocache===!0?e+(e.includes(`?`)?`&`:`?`)+`_=`+Date.now():e;this._loadDataFromUrl(t,e)}else if(typeof e==`object`){if(me(e))this._data_from_manifest=!0,this.data=Se(e);else{let t=e;re(t),t.storymap?this.data=t.storymap:console.error(`StoryMapJS: data must have a storymap property`)}this._initOptions()}else console.error(`StoryMapJS: data has unknown type`),this._initOptions()}async _loadDataFromUrl(e,t){try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP `+n.status+` `+n.statusText);let r=await n.json();if(me(r))this._data_from_manifest=!0,this.data=Se(r);else{re(r,t);let e=r;if(!e.storymap)throw Error(`StoryMapJS: data must have a storymap property`);this.data=e.storymap}this._initOptions()}catch(e){console.error(`StoryMapJS: could not load storymap data from `+t,e),this.fire(`error`,{message:String(e),source:t})}}_initOptions(){if(p(this.options,this.data),this._data_from_manifest&&delete this.options.zoomify,this.options.layout===`landscape`&&(this.options.map_center_offset={left:-200,top:0}),this.options.map_type===`iiif`&&this.options.map_as_image&&(this.options.map_size_sticky=2),this.options.map_type===`zoomify`&&(this.options.map_size_sticky=2),this.options.map_as_image&&(this.options.calculate_zoom=!1),this.options.map_type===`zoomify`){console.warn(`StoryMapJS: map_type 'zoomify' is a legacy image-pyramid basemap; consider map_type 'iiif' with options.iiif.url instead.`);let e=this.options.zoomify;(typeof e!=`object`||!e.path)&&console.error(`StoryMapJS: map_type 'zoomify' needs a zoomify image pyramid (path, width, height) in the storymap data.`)}if(this.options.map_type.startsWith(`stamen`)){let e=this.options.map_type;e===`stamen:watercolor`?this.options.map_type=`ch-watercolor`:this.options.map_type=`osm:standard`,console.log(`Deprecated map_type ${e}; using ${this.options.map_type}`)}this._loadLanguage()}_loadLanguage(){je(this.options.language),this.options.language=j,this._onDataLoaded()}async _loadFontCss(){let e=this.options.font_css||`stock:default`,t=e;if(t.startsWith(`stock:`)){let e=t.split(`:`)[1]||`default`;t=new URL(`../css/fonts/font.`+e+`.css`,import.meta.url).href}else/^(http|https|\/\/)/.test(t)||(t=C(this.options.script_path,t));let n=Fe(this.options);if(/^(http|https|\/\/)/.test(e)&&this.options.consent_required&&n){let e=new URL(t.startsWith(`//`)?`https:`+t:t).host,r=this._el.map??this._el.container;if(!await n.request(Ie(`consent_service_fonts`,`web fonts`),e,r))return}if(t)try{await D(t)}catch{}finally{this._onFontLoaded(t)}}_onFontLoaded(e){this.fire(`fontLoaded`,{font:e})}goTo(e){e>=0&&e<(this.data?.slides?.length??0)&&e!==this.current_slide&&(this.current_slide=e,this._storyslider.goTo(this.current_slide),this._map.goTo(this.current_slide),this._syncHash(),this._scheduleAutoplay(),this._updateProgress())}updateDisplay(){this.ready&&this._updateDisplay()}setMapOption(e,t){this.setMapOptions({[e]:t})}setMapOptions(e){if(f(this.options,e),this._map&&this._map.options)f(this._map.options,e),this._map.applyOptions(Object.keys(e));else for(let t of Object.keys(e))this.options[t]=e[t];this.ready&&(this.options.text_color&&this._el.container.style.setProperty(`--vco-color-text`,this.options.text_color),this.options.text_background_color&&this._el.container.style.setProperty(`--vco-color-text-background`,this.options.text_background_color),this.updateDisplay())}_initLayout(){this._el.container.className+=` vco-storymap`,this.options.base_class=this._el.container.className,this.options.text_color&&this._el.container.style.setProperty(`--vco-color-text`,this.options.text_color),this.options.text_background_color&&this._el.container.style.setProperty(`--vco-color-text-background`,this.options.text_background_color),this._el.menubar=M.create(`div`,`vco-menubar`,this._el.container),this._el.map=this._resolveMapElement(),this._el.map||(this._el.map=M.create(`div`,`vco-map`,this._el.container)),this._el.storyslider=M.create(`div`,`vco-storyslider`,this._el.container),this.options.width=this._el.container.offsetWidth,this.options.height=this._el.container.offsetHeight,this._el.map.style.height=`1px`,this._el.storyslider.style.top=`1px`,this._map=new Hx(this._el.map,this.data,this.options),this.map=this._map._map,this._map.on(`loaded`,this._onMapLoaded,this),this._el.map.style.backgroundColor=this.options.map_background_color,this._menubar=new Gx(this._el.menubar,this._el.container,this.options),this._storyslider=new MS(this._el.storyslider,this.data,this.options),this._storyslider.on(`loaded`,this._onStorySliderLoaded,this),this._storyslider.on(`title`,this._onTitle,this),this._storyslider.init(),this.options.layout===`portrait`?(this.options.map_height=this.options.height/this.options.map_size_sticky,this.options.storyslider_height=this.options.height-this._el.menubar.offsetHeight-this.options.map_height-1,this._menubar.setSticky(0)):(this.options.menubar_height=this._el.menubar.offsetHeight,this.options.map_height=this.options.height,this.options.storyslider_height=this.options.height-this._el.menubar.offsetHeight-1,this._menubar.setSticky(this.options.menubar_height)),this._updateDisplay(this.options.map_height,!0,2e3),this._menubar.show(2e3)}_initEvents(){this._menubar.on(`collapse`,this._onMenuBarCollapse,this),this._menubar.on(`back_to_start`,this._onBackToStart,this),this._menubar.on(`overview`,this._onOverview,this),this._menubar.on(`fullscreen`,this._onFullscreenToggle,this),this._storyslider.on(`change`,this._onSlideChange,this),this._storyslider.on(`colorchange`,this._onColorChange,this),this._map.on(`change`,this._onMapChange,this),document.addEventListener(`fullscreenchange`,this._onFullscreenChange.bind(this))}_updateDisplay(e,t,n){let r=this.options.duration,i=this.options.base_class;n&&(r=n),this.options.width=this._el.container.offsetWidth,this.options.height=this._el.container.offsetHeight,this.options.width<=this.options.skinny_size?this.options.layout=`portrait`:this.options.layout=`landscape`,e&&(this.options.map_height=e),Px.touch&&(this.options.layout=Px.orientation(),i+=` vco-mobile`),this.options.layout===`portrait`?(i+=` vco-skinny`,this._map.setMapOffset(0,0),this.options.map_height=this.options.height/this.options.map_size_sticky,this.options.storyslider_height=this.options.height-this.options.map_height-1,this._menubar.setSticky(0),i+=` vco-layout-portrait`,t?(this.animator_map&&this.animator_map.stop(),this.animator_map=(0,Kx.default)(this._el.map,{height:this.options.map_height+`px`,duration:r,easing:Ye,complete:()=>{this._map.updateDisplay(this.options.width,this.options.map_height,t,n,this.options.menubar_height)}}),this.animator_storyslider&&this.animator_storyslider.stop(),this.animator_storyslider=(0,Kx.default)(this._el.storyslider,{height:this.options.storyslider_height+`px`,duration:r,easing:Ye})):(this._el.map.style.height=Math.ceil(this.options.map_height)+`px`,this._el.storyslider.style.height=this.options.storyslider_height+`px`),this._menubar.updateDisplay(this.options.width,this.options.height,t),this._map.updateDisplay(this.options.width,this.options.height,!1),this._storyslider.updateDisplay(this.options.width,this.options.storyslider_height,t,this.options.layout)):(i+=` vco-layout-landscape`,this.options.menubar_height=this._el.menubar.offsetHeight,this.options.map_height=this.options.height,this.options.storyslider_height=this.options.height,this._menubar.setSticky(this.options.menubar_height),this._menubar.setSticky(this.options.menubar_height),this._el.map.style.height=this.options.height+`px`,this._map.setMapOffset(-(this.options.width/4),0),this._el.storyslider.style.top=`0`,this._el.storyslider.style.height=this.options.storyslider_height+`px`,this._menubar.updateDisplay(this.options.width,this.options.height,t),this._map.updateDisplay(this.options.width,this.options.height,t,n),this._storyslider.updateDisplay(this.options.width/2,this.options.storyslider_height,t,this.options.layout)),this.options.language.direction===`rtl`&&(i+=` vco-rtl`),this._el.container.className=i}_onDataLoaded(e){this.options.consent_manager=new Pe,this.fire(`dataloaded`),this._initLayout(),this._loadFontCss().catch(e=>{console.warn(`StoryMapJS: font theme could not be loaded`,e)}),this._initEvents(),this._initResizeHandling(),this.ready=!0,this._startAutoplay()}_startAutoplay(){if(this._stopAutoplay(),this._autoplay_stopped=!1,this.options.autoplay>0){let e=()=>{this._autoplay_stopped=!0,this._stopAutoplay()};this._el.container.addEventListener(`pointerdown`,e,{once:!0}),this._el.container.addEventListener(`keydown`,e,{once:!0}),this._el.container.addEventListener(`touchstart`,e,{once:!0}),this._scheduleAutoplay()}}_scheduleAutoplay(){this._stopAutoplay(),this.options.autoplay>0&&!this._autoplay_stopped&&(this._autoplay_timer=setTimeout(()=>{this._autoplay_timer=null,this.current_slide+1<this.data.slides.length&&(this.goTo(this.current_slide+1),this._scheduleAutoplay())},this.options.autoplay))}_stopAutoplay(){this._autoplay_timer&&=(clearTimeout(this._autoplay_timer),null)}_syncHash(){try{history.replaceState(null,``,window.location.pathname+window.location.search+`#slide-`+this.current_slide)}catch{}}_applyHashSlide(){let e=/^#slide-(\d+)$/.exec(window.location.hash);if(!e)return!1;let t=parseInt(e[1],10);return t>=0&&t<this.data.slides.length&&t!==this.current_slide&&(this.goTo(t),!0)}_initResizeHandling(){if(!this.options.trackResize)return;let e=()=>{this._resize_timer?clearTimeout(this._resize_timer):this.updateDisplay(),this._resize_timer=setTimeout(()=>{this._resize_timer=null,this.updateDisplay()},200)};typeof ResizeObserver<`u`&&(this._resize_observer=new ResizeObserver(e),this._resize_observer.observe(this._el.container)),window.addEventListener(`resize`,e)}_resolveMapElement(){let e=this.options.map_options?.element;if(!e)return null;let t=typeof e==`string`?M.get(e):e;return t?(t.classList.add(`vco-map`),this._el.menubar.after(t),t):(console.error(`StoryMapJS: map_options.element not found: `+String(e)),null)}_onTitle(e){this.fire(`title`,e)}_onColorChange(e){e.color||e.image?this._menubar.setColor(!0):this._menubar.setColor(!1)}_onSlideChange(e){this.current_slide!==e.current_slide&&(this.current_slide=e.current_slide,this._map.goTo(this.current_slide),this.fire(`change`,{current_slide:this.current_slide},this),this._syncHash(),this._scheduleAutoplay(),this._updateProgress())}_onMapChange(e){this.current_slide!==e.current_marker&&(this.current_slide=e.current_marker,this._storyslider.goTo(this.current_slide),this.fire(`change`,{current_slide:this.current_slide},this),this._syncHash(),this._scheduleAutoplay(),this._updateProgress())}_updateProgress(){this.options.show_progress&&this._menubar&&this._menubar.setProgress(this.current_slide,this.data.slides.length)}_onOverview(e){this._map.markerOverview()}_onFullscreenToggle(e){document.fullscreenElement===this._el.container?document.exitFullscreen().catch(e=>{console.error(`StoryMapJS: could not exit fullscreen`,e)}):this._el.container.requestFullscreen().catch(e=>{console.error(`StoryMapJS: could not enter fullscreen`,e)})}_onFullscreenChange(){let e=document.fullscreenElement===this._el.container;this._menubar.setFullscreenState(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.updateDisplay()})})}_onBackToStart(e){this.current_slide=0,this._map.goTo(this.current_slide),this._storyslider.goTo(this.current_slide),this.fire(`change`,{current_slide:this.current_slide},this),this._syncHash(),this._scheduleAutoplay(),this._updateProgress()}_onMenuBarCollapse(e){this._updateDisplay(e.y,!0)}_onMapLoaded(){this._loaded.map=!0,this._onLoaded()}_onStorySliderLoaded(){this._loaded.storyslider=!0,this._onLoaded()}_updateDistance(){if(!this.options.show_distance)return;let e=this._map.getRouteDistance();this._menubar.setDistance(e)}_onLoaded(){this._loaded.storyslider&&this._loaded.map&&(this.fire(`loaded`,this.data),this._hash_initialized||(this._hash_initialized=!0,this._applyHashSlide(),window.addEventListener(`hashchange`,()=>this._applyHashSlide()),this._syncHash()),this._updateProgress(),this._updateDistance())}},PS=class extends Ze(NS){static SCRIPT_PATH=new URL(`../`,``+import.meta.url).href;constructor(...e){super(...e)}};export{PS as t};
|
|
17
|
+
`,``),t.push(s[e],a);return t},[]):Sx(n,g).trim(),l=$(d,`paint`,`text-opacity`,C,m,w)}if(ie&&l&&!re){O||(++T,b=_[T],(!b||!b.getText()||b.getFill()||b.getStroke())&&(b=new vu,_[T]=b),b.setImage(void 0),b.setGeometry(void 0));let e=vx(d,C,`text`,m);b.getText()||b.setText(k),k=b.getText(),(!k||`getDeclutterMode`in k&&k.getDeclutterMode()!==e)&&(k=new wu({padding:[2,2,2,2],declutterMode:e}),b.setText(k));let t=$(d,`layout`,`text-transform`,C,m,w);t==`uppercase`?ie=Array.isArray(ie)?ie.map((e,t)=>t%2?e:e.toUpperCase()):ie.toUpperCase():t==`lowercase`&&(ie=Array.isArray(ie)?ie.map((e,t)=>t%2?e:e.toLowerCase()):ie.toLowerCase());let n=Array.isArray(ie)?ie:x==2?rx(ie,ce):lx(ie,ae,le,ce);if(k.setText(n),k.setFont(ae),k.setRotation(Ub($(d,`layout`,`text-rotate`,C,m,w))),typeof k.setKeepUpright==`function`){let e=$(d,`layout`,`text-keep-upright`,C,m,w);k.setKeepUpright(e)}let r=$(d,`layout`,`text-anchor`,C,m,w),i=O||x==1?`point`:$(d,`layout`,`symbol-placement`,C,m,w),a;if(i===`line-center`?(k.setPlacement(`line`),a=`center`):k.setPlacement(i),i===`line`&&typeof k.setRepeat==`function`){let e=$(d,`layout`,`symbol-spacing`,C,m,w);k.setRepeat(e*2)}k.setOverflow(i===`point`);let o=$(d,`paint`,`text-halo-width`,C,m,w),s=$(d,`layout`,`text-offset`,C,m,w),c=$(d,`paint`,`text-translate`,C,m,w),u=0,f=0;if(i==`point`){a=`center`,r.indexOf(`left`)===-1?r.indexOf(`right`)!==-1&&(a=`right`,f=-o):(a=`left`,f=o);let e=$(d,`layout`,`text-rotation-alignment`,C,m,w);k.setRotateWithView(e==`map`)}else k.setMaxAngle(Ub($(d,`layout`,`text-max-angle`,C,m,w))*ie.length/n.length),k.setRotateWithView(!1);k.setTextAlign(a);let p=`middle`;r.indexOf(`bottom`)==0?(p=`bottom`,u=-o-.5*(oe-1)*se):r.indexOf(`top`)==0&&(p=`top`,u=o+.5*(oe-1)*se),k.setTextBaseline(p);let h=$(d,`layout`,`text-justify`,C,m,w);k.setJustify(h===`auto`?void 0:h),k.setOffsetX(s[0]*se+f+c[0]),k.setOffsetY(s[1]*se+u+c[1]);let g=k.getFill()||new mu;g.setColor(bx($(d,`paint`,`text-color`,C,m,w),l)),k.setFill(g);let v=bx($(d,`paint`,`text-halo-color`,C,m,w),l);if(v&&o>0){let e=k.getStroke()||new _u;e.setColor(v),o*=2;let t=.5*se;e.setWidth(o<=t?o:t),k.setStroke(e)}else k.setStroke(void 0);let y=$(d,`layout`,`text-padding`,C,m,w),S=k.getPadding();y!==S[0]&&(S[0]=y,S[1]=y,S[2]=y,S[3]=y),b.setZIndex(D)}}}if(T>-1)return _.length=T+1,_};return e.setStyle(v),e.set(`mapbox-layers`,d),e.set(`mapbox-source`,g),e.set(`mapbox-featurestate`,e.get(`mapbox-featurestate`)||{}),v}qh.parse(`#000000`),qh.parse(`#FFFFFF`),qh.parse(`#000000`);function Ex(e,t=512){return e.getExtent()?om({extent:e.getExtent(),tileSize:t,maxZoom:22}).getResolutions():Wb}function Dx(e,t){return t.accessToken||(t=Object.assign({},t),new URL(e).searchParams.forEach((e,n)=>{t.accessToken=e,t.accessTokenParam=n})),t}function Ox(e,t,n=``,r={},i=void 0){let a,o,s,c,l=!0;return typeof n!=`string`&&!Array.isArray(n)?(s=n,c=s.source||s.layers,r=s):c=n,typeof r==`string`?(a=r,s={}):(a=r.styleUrl,s=r),s.updateSource===!1&&(l=!1),i||=s.resolutions,!a&&typeof t==`string`&&!t.trim().startsWith(`{`)&&(a=t),a&&(a=a.startsWith(`data:`)?location.href:Eb(a,s.accessToken),s=Dx(a,s)),new Promise(function(n,r){Xb(t,s).then(function(t){if(t.version!=8)return r(Error(`glStyle version 8 required.`));if(!(e instanceof sp||e instanceof qp))return r(Error(`Can only apply to VectorLayer or VectorTileLayer`));let u=e instanceof qp?`vector`:`geojson`;if(c?o=Array.isArray(c)?t.layers.find(function(e){return e.id===c[0]}).source:c:(o=t.layers.find(function(e){return e.source&&t.sources[e.source].type===u}).source,c=o),!o)return r(Error(`No ${u} source found in the glStyle.`));function d(){if(!l)return Promise.resolve();if(e instanceof qp)return jx(t.sources[o],a,s).then(function(t){let n=e.getSource();n?t!==n&&(n.setTileUrlFunction(t.getTileUrlFunction()),typeof n.setUrls==`function`&&typeof t.getUrls==`function`&&n.setUrls(t.getUrls()),n.format_||=t.format_,n.getAttributions()||n.setAttributions(t.getAttributions()),n.getTileLoadFunction()===Rm&&n.setTileLoadFunction(t.getTileLoadFunction()),ki(n.getProjection(),t.getProjection())&&(n.tileGrid=t.getTileGrid())):e.setSource(t);let r=e.getSource().getTileGrid();!isFinite(e.getMaxResolution())&&!isFinite(e.getMinZoom())&&r.getMinZoom()>0&&e.setMaxResolution(qb(Math.max(0,r.getMinZoom()-1e-12),r.getResolutions()))});let n=t.sources[o],r=e.getSource();(!r||r.get(`mapbox-source`)!==n)&&(r=Nx(n,a,s));let i=e.getSource();return i?r!==i&&(i.getAttributions()||i.setAttributions(r.getAttributions()),i.format_||=r.getFormat(),i.url_=r.getUrl()):e.setSource(r),Promise.resolve()}let f,p,m={},h={};function g(){if(!p&&(!t.sprite||m)){if(s.projection&&!i){let e=B(s.projection).getUnits();e!==`m`&&(i=Wb.map(t=>t/hr[e]))}let a,l=e.getSource();l instanceof Lm&&l.format_ instanceof db&&(a=l.format_.layerName_),p=Tx(e,t,c,i,m,h,(e,t=s.webfonts)=>fx(e,t),s.getImage,a),e.getStyle()?d().then(n).catch(r):r(Error(`Nothing to show for source [${o}]`))}else p?(e.setStyle(p),d().then(n).catch(r)):r(Error(`Something went wrong trying to apply style.`))}if(t.sprite){let e=wb(t.sprite,s.accessToken,a||location.href);f=It?1:window.devicePixelRatio>=1.5?.5:1;let n=f==.5?`@2x`:``;Promise.all(e.map(function(e){let t=new URL(e.url),i=t.origin+t.pathname+n+`.json`+t.search;return new Promise(function(e,n){Yb(`Sprite`,i,s).then(e).catch(function(r){i=t.origin+t.pathname+`.json`+t.search,Yb(`Sprite`,i,s).then(e).catch(n)})}).then(function(i){i===void 0&&r(Error(`No sprites found.`));let a;if(a=t.origin+t.pathname+n+`.png`+t.search,s.transformRequest){let e=s.transformRequest(a,`SpriteImage`)||a;(e instanceof Request||e instanceof Promise)&&(a=e)}h[e.id]=a;for(let t in i){let n=e.id=="default"?t:`${e.id}:${t}`;m[n]=i[t]}}).catch(function(e){r(Error(`Sprites cannot be loaded: ${i}: ${e.message}`))})})).then(g).catch(r)}else g()}).catch(r)})}function kx(e,t){let n=e.bounds;if(n){let e=Di([n[0],n[1]],t),r=Di([n[2],n[3]],t);return[e[0],e[1],r[0],r[1]]}return B(t).getExtent()}function Ax(e,t,n){let r=new Vm({tileJSON:t,tileSize:e.tileSize||t.tileSize||512}),i=r.getTileJSON(),a=r.getTileGrid(),o=B(n.projection||`EPSG:3857`),s=kx(i,o),c=o.getExtent(),l=i.minzoom||0,u=i.maxzoom||22,d={attributions:r.getAttributions(),projection:o,tileGrid:new nm({origin:c?Vn(c):a.getOrigin(0),extent:s||a.getExtent(),minZoom:l,resolutions:Ex(o,t.tileSize).slice(0,u+1),tileSize:a.getTileSize(0)})};return Array.isArray(i.tiles)?d.urls=i.tiles:d.url=i.tiles,d}function jx(e,t,n){return new Promise(function(r,i){Qb(e,t,n).then(function({tileJson:t,tileLoadFunction:i}){let a=Ax(e,t,n);a.tileLoadFunction=i,a.format=new db({layerName:`mvt:layer`});let o=new Lm(a);o.set(`mapbox-source`,e),r(o)}).catch(i)})}function Mx(e){return`{bbox-${(e?e.getCode():`EPSG:3857`).toLowerCase().replace(/[^a-z0-9]/g,`-`)}}`}function Nx(e,t,n){let r=n.projection?new Iy({dataProjection:n.projection}):new Iy,i=e.data,a={};if(typeof i==`string`){let[a]=Ob(i,n.accessToken,n.accessTokenParam||`access_token`,t||location.href);if(/\{bbox-[0-9a-z-]+\}/.test(a)){let t=(e,t,n)=>{let r=Mx(n);return a.replace(r,`${e.join(`,`)}`)},i=new lf({attributions:e.attribution,format:r,loader:(e,r,a,o,s)=>{Yb(`GeoJSON`,typeof t==`function`?t(e,r,a):t,n).then(e=>{let t=i.getFormat().readFeatures(e,{featureProjection:a});i.addFeatures(t),o(t)}).catch(t=>{i.removeLoadedExtent(e),s()})},strategy:Xd});return i.set(`mapbox-source`,e),i}let o=new lf({attributions:e.attribution,format:r,url:a,loader:(e,t,r,i,s)=>{Yb(`GeoJSON`,a,n).then(e=>{let t=o.getFormat().readFeatures(e,{featureProjection:r});o.addFeatures(t),i(t)}).catch(t=>{o.removeLoadedExtent(e),s()})}});return o}a.features=r.readFeatures(i,{featureProjection:Ii()||`EPSG:3857`});let o=new lf(Object.assign({attributions:e.attribution,format:r},a));return o.set(`mapbox-source`,e),o}var Px={touch:`ontouchstart`in window||navigator.maxTouchPoints>0,mobile:window.matchMedia?.(`(pointer: coarse)`).matches??!1,orientation:function(){return window.innerWidth>window.innerHeight?`landscape`:`portrait`}},Fx=class{constructor(e,t,n){this._el={container:{},map:{},map_mask:{}},typeof e==`object`?this._el.container=e:this._el.container=M.get(e),this._loaded={data:!1,map:!1},this._map=null,this._mini_map=null,this._markers=[],this.zoom_min_max={min:null,max:null},this._line=null,this._line_active=null,this.current_marker=0,this.bounds_array=null,this._tile_layer=null,this._tile_layer_mini=null,this._image_layer=null,this.data={uniqueid:``,slides:[{test:`yes`},{test:`yes`},{test:`yes`}]},this.options={map_type:`osm:standard`,map_as_image:!1,map_mini:!1,map_background_color:`#d9d9d9`,map_subdomains:``,map_access_token:``,iiif:{url:``,attribution:``},skinny_size:650,less_bounce:!0,path_gfx:`gfx`,start_at_slide:0,map_popup:!1,zoom_distance:100,calculate_zoom:!0,line_follows_path:!0,line_color:`#333`,line_color_inactive:`#000`,line_weight:5,line_opacity:.2,line_dash:`5,5`,line_join:`miter`,show_lines:!0,show_history_line:!0,map_center_offset:null},this.animator=null,this._transition_duration=this.options.duration,this.timer=null,this.touch_scale=1,this.scroll={start_time:null},f(this.options,n),f(this.data,t),this._initLayout(),this._initEvents(),this._createMap(),this._initData()}updateDisplay(e,t,n,r,i){this._updateDisplay(e,t,n,r,i)}goTo(e,t){if(e<this._markers.length&&e>=0){let n,r=this.current_marker;this.current_marker=e;let i=Math.abs(e-r);this._transition_duration=Math.max(600,Math.min(1e3+i*120,2e3));let a=this._markers[this.current_marker];if(this.animator&&this.animator.stop(),this._resetMarkersActive(),a.data.type&&a.data.type===`overview`)this._markerOverview(),t||this._onMarkerChange();else if(a.active(!0),t)a.data.location&&this._viewTo(a.data.location,{duration:this._transition_duration});else{if(this._hasLocation(a.data)){if(n=this._calculateZoomChange(this._getMapCenter(!0),a.location()),this._viewTo(a.data.location,{calculate_zoom:this.options.calculate_zoom,zoom:n,duration:this._transition_duration}),this.options.line_follows_path){if(this.options.show_history_line&&a.data.real_marker&&this._markers[r].data.real_marker){let e=[],t=0,n,i=null,o=null;if(r<this.current_marker){for(;t<this.current_marker;)this._hasLocation(this._markers[t].data)&&(n={lat:this._markers[t].data.location.lat,lon:this._markers[t].data.location.lon},e.push(n)),t++;let i=[];for(let e=0;e<=r;e++)this._hasLocation(this._markers[e].data)&&i.push({lat:this._markers[e].data.location.lat,lon:this._markers[e].data.location.lon});o=i}else if(r>this.current_marker){let t=[];for(let e=0;e<=this.current_marker;e++)this._hasLocation(this._markers[e].data)&&t.push({lat:this._markers[e].data.location.lat,lon:this._markers[e].data.location.lon});let n=[];for(let e=0;e<=r;e++)this._hasLocation(this._markers[e].data)&&n.push({lat:this._markers[e].data.location.lat,lon:this._markers[e].data.location.lon});e=t,i=n}i||e.push({lat:a.data.location.lat,lon:a.data.location.lon}),this._replaceLines(this._line_active,e,{duration:this._transition_duration,retractFrom:i,growFrom:o})}}else this.options.show_history_line&&a.data.real_marker&&this._markers[r].data.real_marker&&this._replaceLines(this._line_active,[{lat:a.data.location.lat,lon:a.data.location.lon},{lat:this._markers[r].data.location.lat,lon:this._markers[r].data.location.lon}],{duration:this._transition_duration})}else this._markerOverview(),t||this._onMarkerChange();this._onMarkerChange()}}}panTo(e,t){this._panTo(e,t)}zoomTo(e,t){this._zoomTo(e,t)}viewTo(e,t){this._viewTo(e,t)}getBoundsZoom(e,t,n,r){this._getBoundsZoom(e,t,n,r)}markerOverview(){this._markerOverview()}calculateMarkerZooms(){this._calculateMarkerZooms()}createMiniMap(){this._createMiniMap()}setMapOffset(e,t){this.options.map_center_offset?(this.options.map_center_offset.left=e,this.options.map_center_offset.top=t):this.options.map_center_offset={left:e,top:t}}calculateMinMaxZoom(){for(let e=0;e<this._markers.length;e++)this._markers[e].data.location&&this._markers[e].data.location.zoom&&this.updateMinMaxZoom(this._markers[e].data.location.zoom)}updateMinMaxZoom(e){this.zoom_min_max.max||(this.zoom_min_max.max=e),this.zoom_min_max.min||(this.zoom_min_max.min=e),this.zoom_min_max.max<e&&(this.zoom_min_max.max=e),this.zoom_min_max.min>e&&(this.zoom_min_max.min=e)}initialMapLocation(){this._loaded.data&&this._loaded.map&&this.current_marker===0&&this.goTo(this.options.start_at_slide,!0)}show(){}hide(){}createMarkers(e){this._createMarkers(e)}createMarker(e){this._createMarker(e)}_destroyMarker(e){this._removeMarker(e);for(let t=0;t<this._markers.length;t++)this._markers[t]===e&&this._markers.splice(t,1);this.fire(`markerRemoved`,e)}_createMarkers(e){for(let t=0;t<e.length;t++)this._createMarker(e[t]),this._hasLocation(e[t])&&this.options.show_lines&&this._addToLine(this._line,e[t])}_hasLocation(e){return!!e.location&&typeof e.location.lat==`number`&&typeof e.location.lon==`number`}_createMap(){}_createMiniMap(){}_createMarker(e){let t={};t.on(`markerclick`,this._onMarkerClick),this._addMarker(t),this._markers.push(t),t.marker_number=this._markers.length-1,this.fire(`markerAdded`,t)}_addMarker(e){}_removeMarker(e){}_resetMarkersActive(){for(let e=0;e<this._markers.length;e++)this._markers[e].active(!1)}_calculateMarkerZooms(){}_createLine(e){return{data:e}}_addToLine(e,t){}_replaceLines(e,t,n){}_addLineToMap(e){}_panTo(e,t){}_zoomTo(e,t){}_viewTo(e,t){}_updateMapDisplay(e,t){}_refreshMap(){}_getMapZoom(){return 1}_getMapCenter(e){return{lat:0,lng:0}}_getBoundsZoom(e,t,n,r){}_markerOverview(e){}getRouteDistance(){}_onMarkerChange(e){this.fire(`change`,{current_marker:this.current_marker})}_onMarkerClick(e){this.current_marker!==e.marker_number&&this.goTo(e.marker_number,!1)}_onMapLoaded(e){this._loaded.map||(this._loaded.map=!0,this.options.calculate_zoom&&this.calculateMarkerZooms(),this.calculateMinMaxZoom(),this.options.map_mini&&!Px.touch&&this.createMiniMap(),this.initialMapLocation(),this.fire(`loaded`,this.data))}_onWheel(e){if(e.ctrlKey){let t=Math.exp(-e.deltaY/100);this.touch_scale*=t,e.preventDefault(),e.stopPropagation()}this.scroll.start_time||(this.scroll.start_time=+new Date);let t=Math.max(40-(+new Date-this.scroll.start_time),0);clearTimeout(this.scroll.timer),this.scroll.timer=setTimeout(()=>{this._scollZoom()},t)}_scollZoom(e){let t=this._getMapZoom();this.scroll.start_time=null,clearTimeout(this.scroll.timer),clearTimeout(this.scroll.timer_done),this.scroll.timer_done=setTimeout(()=>{this._scollZoomDone()},1e3),this.zoomTo(Math.round(t*this.touch_scale))}_scollZoomDone(e){this.touch_scale=1}_calculateZoomChange(e,t,n){return this._getBoundsZoom(e,t,n)}_updateDisplay(e,t,n,r,i){this._updateMapDisplay(n,r)}applyOptions(e){}_initLayout(){this._el.map_mask=M.create(`div`,`vco-map-mask`,this._el.container),this.options.map_as_image?this._el.map=M.create(`div`,`vco-map-display vco-mapimage-display`,this._el.map_mask):this._el.map=M.create(`div`,`vco-map-display`,this._el.map_mask)}_initData(){this.data.slides&&(this._createMarkers(this.data.slides),this._afterCreateMarkers(),this._resetMarkersActive(),this._markers.length>0&&this._markers[this.current_marker].active(!0),this._loaded.data=!0)}_afterCreateMarkers(){}_initEvents(){this._el.map.addEventListener(`wheel`,e=>{this._onWheel(e)})}},Ix=class extends Qe(Ze(Fx)){constructor(...e){super(...e)}},Lx=class{constructor(e,t){this._el={container:{},content_container:{},content:{}},this._marker={},this._icon={},this._custom_icon=!1,this._custom_icon_url=``,this._custom_image_icon=!1,this.marker_number=0,this.media_icon_class=``,this.timer={},this.data={},this.options={duration:1e3,ease:Xe,width:600,height:600,map_popup:!1},this.animator=null,f(this.options,t),f(this.data,e),this._initLayout()}show(){}hide(){}addTo(e){this._addTo(e)}removeFrom(e){this._removeFrom(e)}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}createMarker(e,t){this._createMarker(e,t)}active(e){this._active(e)}location(){return this._location()}_createMarker(e,t){}_addTo(e){}_removeFrom(e){}_active(e){}_location(){return{lat:0,lng:0}}_onMarkerClick(e){this.fire(`markerclick`,{marker_number:this.marker_number})}_initLayout(){this._createMarker(this.data,this.options)}_updateDisplay(e,t,n){}},Rx=class extends Ze(Lx){constructor(...e){super(...e)}},zx=class extends Rx{_createMarker(e,t){if(e.location&&typeof e.location.lat==`number`&&typeof e.location.lon==`number`){this.data.real_marker=!0;let n=t.use_custom_markers||e.location.use_custom_marker;n&&e.location.icon?this._custom_icon={url:e.location.icon,size:e.location.iconSize||[48,48],anchor:this._customIconAnchor(e.location.iconSize)}:n&&e.location.image&&(this._custom_image_icon=e.location.image),this._marker=this._createMarkerElement(e,t),this._marker.addEventListener(`click`,e=>{e.stopPropagation(),this._onMarkerClick(e)})}}_createMarkerElement(e,t){let n=document.createElement(`div`);if(n.title=e.text&&e.text.headline?e.text.headline:``,this._custom_icon){n.className=`vco-mapmarker-custom`;let e=document.createElement(`img`);e.src=this._custom_icon.url,e.style.width=this._custom_icon.size[0]+`px`,e.style.height=`auto`,n.appendChild(e),n.style.marginLeft=-this._custom_icon.anchor[0]+`px`,n.style.marginTop=-this._custom_icon.anchor[1]+`px`}else if(this._custom_image_icon){n.className=`vco-mapmarker-image-icon`;let e=document.createElement(`img`);e.src=this._custom_image_icon,e.style.width=`48px`,e.style.height=`auto`,n.appendChild(e),n.style.marginLeft=`-24px`,n.style.marginTop=`-48px`}else n.className=`vco-mapmarker `+this.media_icon_class;return n}_addTo(e){if(this.data.real_marker){let t=this.data,n=e.getView().getProjection().getCode()===`EPSG:4326`?[t.location.lon,t.location.lat]:Di([t.location.lon,t.location.lat]),r=!this._custom_icon&&!this._custom_image_icon;this._overlay=new Um({element:this._marker,position:n,stopEvent:!1,...r?{positioning:`bottom-center`,offset:[0,1]}:{}}),e.addOverlay(this._overlay)}}_removeFrom(e){this.data.real_marker&&this._overlay&&e.removeOverlay(this._overlay)}_active(e){if(this.media_icon_class=this.data.media&&this.data.media.mediatype?`vco-mapmarker-icon vco-icon-`+this.data.media.mediatype.type:`vco-mapmarker-icon vco-icon-plaintext`,this.data.real_marker){this._custom_icon?(e||clearTimeout(this.timer),this._marker.style.zIndex=e?`1000`:``):this._custom_image_icon?e?(this._marker.classList.remove(`vco-mapmarker-image-icon`),this._marker.classList.add(`vco-mapmarker-image-icon-active`),this._marker.style.zIndex=`1000`):(clearTimeout(this.timer),this._marker.classList.remove(`vco-mapmarker-image-icon-active`),this._marker.classList.add(`vco-mapmarker-image-icon`),this._marker.style.zIndex=``):e?(this._marker.classList.remove(`vco-mapmarker`),this._marker.classList.add(`vco-mapmarker-active`),this._marker.style.zIndex=`1000`):(clearTimeout(this.timer),this._marker.classList.remove(`vco-mapmarker-active`),this._marker.classList.add(`vco-mapmarker`),this._marker.style.zIndex=``);let t=this._marker.querySelector(`.vco-marker-label`);if(t&&t.remove(),e&&this.options.marker_labels&&this.data.text?.headline){let e=document.createElement(`div`);e.className=`vco-marker-label`,e.textContent=this.data.text.headline,this._marker.appendChild(e)}let n=this._marker.querySelector(`.vco-mapmarker-icon`);n?n.className=this.media_icon_class:!this._custom_icon&&!this._custom_image_icon&&(this._marker.className=(e?`vco-mapmarker-active `:`vco-mapmarker `)+this.media_icon_class)}}_customIconAnchor(e){return e?[e[0]*.5,e[1]]:[24,48]}_location(){return this.data.real_marker?{lat:this.data.location.lat,lon:this.data.location.lon}:{}}},Bx=19,Vx=Array.from({length:25},(e,t)=>2**(16-t)),Hx=class extends Ix{_createMap(){let e=this.options.map_type===`iiif`&&this.options.map_as_image,t=this.options.map_options??{},{element:n,view:r,...i}=t,a=r??{},o=this._bboxExtent();this._map=new gd({...i,target:this._el.map,controls:t.controls??[],interactions:t.interactions??[],view:new bo({projection:e?`EPSG:4326`:`EPSG:3857`,center:[0,0],zoom:0,minZoom:0,maxZoom:e?Vx.length-1:Bx,...e?{multiWorld:!0,resolutions:Vx}:{},...this.options.map_type===`zoomify`?{multiWorld:!0}:{},...o?{extent:o}:{},...a})}),this._map.on(`loadend`,()=>{this._onMapLoaded(void 0)});let s=this._el.map.querySelector(`.ol-overlaycontainer`);s&&(s.style.zIndex=`1`);let c=Fe(this.options),l=Ie(`consent_service_tiles`,`map tiles`);this.options.consent_required&&c?c.isGranted(l)?this._addTileLayer():c.isDenied(l)||this._requestTileConsent(c,l):this._addTileLayer(),this._line=this._createLine(),this._line.setStyle(this._lineStyle(this.options.line_color_inactive)),this._addLineToMap(this._line),this._line.setOpacity(this.options.line_opacity),this._line_active=this._createLine(),this._line_active.setStyle(this._lineStyle(this.options.line_color)),this._addLineToMap(this._line_active),this._line_active.setOpacity(1),this.options.map_as_image&&(this._line_active.setVisible(!1),this._line.setVisible(!1)),Ps({mouseWheelZoom:!1}).forEach(e=>this._map.addInteraction(e));let u=this._getAttribution(this.options.map_type);u&&this._el.map.insertAdjacentHTML(`beforeend`,`<div class="vco-map-attribution">${u}</div>`)}_getAttribution(e){let t=[`<a href='https://storymap.knightlab.com/' target='_blank' class='vco-knightlab-brand'><span>■</span> StoryMapJS</a>`];return(e===`osm`||e===``||e.startsWith(`osm`))&&t.push(`© <a target='_blank' href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors`),t.join(` | `)}_addTileLayer(){this._tile_layer=this._createTileLayer(this.options.map_type),this._map.addLayer(this._tile_layer)}async _requestTileConsent(e,t){await e.request(t,``,this._el.map)&&this._onTilesAllowed()}_onTilesAllowed(){if(this._addTileLayer(),this._tile_layer_mini||=this._createTileLayer(this.options.map_type),this._mini_map&&this._tile_layer_mini){let e=this._mini_map.getOverviewMap();e.getLayers().getLength()||e.addLayer(this._tile_layer_mini)}if(this._markers.length>0&&this.current_marker<this._markers.length){let e=this._markers[this.current_marker];e.data.type===`overview`?this._markerOverview():this._hasLocation(e.data)&&this._fitView(this._map,[[e.data.location.lon,e.data.location.lat]],0)}}_zoomifyPyramid(){let e=this.options.zoomify;if(!e||typeof e!=`object`||!e.path)return null;let t=e.width??600,n=e.height??600,r=[],i=t,a=n;for(;i>256||a>256;)r.push([i,a]),i=Math.floor(i/2),a=Math.floor(a/2);r.push([i,a]),r.reverse();let o=r.length-1,s=256*2**o,c=[-20037508.342789244,20037508.342789244-n/s*40075016.68557849,-20037508.342789244+t/s*40075016.68557849,20037508.342789244];return{sizes:r,maxZoom:o,extent:c,tileGrid:new nm({extent:c,origin:[c[0],c[3]],resolutions:Array.from({length:o+2},(e,t)=>40075016.68557849/(256*2**(t-1))),tileSize:256})}}_zoomifyOverview(e){let t=this._zoomifyPyramid();if(!t)return null;let n=this.options.zoomify?.tolerance??.9,r=t.maxZoom;for(;r>0;){let i=t.sizes[r];if(i[0]*n<(e[0]||1)&&i[1]*n<(e[1]||1))break;r--}let i=[(t.extent[0]+t.extent[2])/2,(t.extent[1]+t.extent[3])/2];return{zoom:r,center:i}}_createTileLayer(e){let t=e.split(`:`);switch(t[0]){case`mapbox`:return t.length>2?new Up({source:new ym({url:`https://api.mapbox.com/styles/v1/`+t[2].slice(9)+`/tiles/256/{z}/{x}/{y}@2x?access_token=`+this.options.map_access_token,attributions:[],crossOrigin:`anonymous`})}):(console.error(`StoryMapJS: legacy 'mapbox:<style>' map types are no longer supported (the Mapbox v4 tile API was retired); use 'mapbox://styles/<user>/<style>' with map_access_token instead.`),new Up({source:new Bm({attributions:[]})}));case`stadia`:{let e=`osm:standard`;return t.length>1&&(e=t.slice(1).join(`:`),this.options.map_access_token&&(e=`${e}?api_key=${this.options.map_access_token}`)),new Up({source:new ym({url:`https://tiles.stadiamaps.com/tiles/${e}/{z}/{x}/{y}.png`,attributions:[]})})}case`stamen`:return this._map.getViewport().style.backgroundColor=`#FFFFFF`,new Up({source:new ym({url:`https://tiles.stadiamaps.com/tiles/stamen_toner_lite/{z}/{x}/{y}.png`,attributions:[]})});case`iiif`:{let e=new Up;return fetch(this.options.iiif.url).then(e=>e.json()).then(t=>{let n=new km(t).getTileSourceOptions(),r=t;if(typeof r.width!=`number`||typeof r.height!=`number`){console.error(`IIIF info.json is missing width/height:`,this.options.iiif.url);return}let i=new Mm({...n??{},projection:`EPSG:4326`,size:[r.width,r.height],crossOrigin:`anonymous`,attributions:this.options.iiif.attribution||[]});e.setSource(i),i.getState()===`ready`?this._markerOverview():i.once(`change`,()=>{i.getState()===`ready`&&this._markerOverview()})}).catch(e=>console.error(`IIIF info.json could not be loaded:`,this.options.iiif.url,e?.stack||e)),e}case`http`:case`https`:return e.includes(`{z}`)?new Up({source:new ym({url:e,attributions:[],crossOrigin:`anonymous`})}):this._createVectorStyleLayer(e);case`ch-watercolor`:return new Up({source:new ym({url:`https://watercolormaps.collection.cooperhewitt.org/tile/watercolor/{z}/{x}/{y}.jpg`,attributions:[],maxZoom:16})});case`zoomify`:{let e=this._zoomifyPyramid();if(!e)return console.error(`StoryMapJS: map_type 'zoomify' needs a zoomify image pyramid (path, width, height) in the storymap data.`),new Up({source:new Bm({attributions:[]})});let t=this.options.zoomify.path??``,{sizes:n,maxZoom:r}=e,i=e=>Math.ceil(n[e][0]/256),a=e=>Math.ceil(n[e][1]/256);return new Up({source:new ym({tileGrid:e.tileGrid,crossOrigin:`anonymous`,attributions:[],tileUrlFunction:e=>{let[n,o,s]=e,c=Math.max(0,n-1);if(c>r||o<0||o>=i(c)||s<0||s>=a(c))return;let l=0;for(let e=0;e<c;e++)l+=i(e)*a(e);return l+=s*i(c)+o,`${t}TileGroup${Math.floor(l/256)}/${c}-${o}-${s}.jpg`}})})}case`osm`:{let e=t.length>1?t[1]:``;return e?this._createVectorStyleLayer(`https://tiles.openfreemap.org/styles/${e}`):new Up({source:new Bm({attributions:[]})})}default:return e.includes(`{z}`)?new Up({source:new ym({url:e,attributions:[],crossOrigin:`anonymous`})}):e.includes(`/`)||e.endsWith(`.json`)?this._createVectorStyleLayer(e):new Up({source:new Bm({attributions:[]})})}}_createVectorStyleLayer(e){let t=new qp({declutter:!0,updateWhileAnimating:!0});return Ox(t,e).catch(t=>console.error(`Vector map style could not be loaded:`,e,t)),t}_createMiniMap(){this.options.map_as_image&&(this.zoom_min_max.min=0),this.bounds_array||=this._getAllMarkersBounds(this._markers);let e=Fe(this.options),t=Ie(`consent_service_tiles`,`map tiles`),n=!(this.options.consent_required&&e&&!e.isGranted(t));this._tile_layer_mini=n?this._createTileLayer(this.options.map_type):null;let r=this.options.map_type===`iiif`&&this.options.map_as_image,i=this.options.map_type===`zoomify`,a=i?this._zoomifyPyramid():null;if(this._mini_map=new Km({...r||a?{view:new bo({projection:this._map.getView().getProjection(),center:this._map.getView().getCenter(),zoom:this.zoom_min_max.min||0,...r?{multiWorld:!0,resolutions:Vx,minZoom:0,maxZoom:Vx.length-1}:{},...a?{constrainOnlyCenter:!0,extent:a.extent,minZoom:0,maxZoom:0,zoom:0,center:[(a.extent[0]+a.extent[2])/2,(a.extent[1]+a.extent[3])/2]}:{}})}:{},layers:this._tile_layer_mini?[this._tile_layer_mini]:[],collapseLabel:`«`,label:`»`,collapsed:!0}),this._map.addControl(this._mini_map),a){let e=this._mini_map.getOverviewMap(),t=e.getSize(),n=t&&t[0]>=50&&t[1]>=50?t:[150,150];e.getView().fit(a.extent,{size:n})}else!i&&this.bounds_array&&this.bounds_array.length&&this._fitView(this._mini_map.getOverviewMap(),this.bounds_array);this.options.map_type===`iiif`&&this.options.map_as_image&&this._fitMiniMapToImage()}_fitMiniMapToImage(){if(!this._tile_layer_mini)return;let e=()=>{try{let e=(this._tile_layer_mini?.getSource())?.getTileGrid?.();if(e){let t=this._mini_map.getOverviewMap(),n=t.getSize(),r=n&&n[0]>=50&&n[1]>=50?n:[150,150];t.getView().fit(e.getExtent(),{size:r})}}catch(e){console.warn(`IIIF minimap fit failed:`,e)}},t=this._tile_layer_mini.getSource();t?t.getState()===`ready`?e():t.once(`change`,()=>{t.getState()===`ready`&&e()}):this._tile_layer_mini.once(`change:source`,()=>{let t=this._tile_layer_mini?.getSource();t&&(t.getState()===`ready`?e():t.once(`change`,()=>{t.getState()===`ready`&&e()}))})}_createMarker(e){let t=new zx(e,this.options);t.on(`markerclick`,this._onMarkerClick,this),this._addMarker(t),this._markers.push(t),t.marker_number=this._markers.length-1,this.fire(`markerAdded`,t)}_addMarker(e){e.addTo(this._map)}_afterCreateMarkers(){if(this._map.getView().getProjection().getCode()===`EPSG:4326`)return;let e=this._markers.filter(e=>e.data.real_marker&&e.data.location?.lon!==void 0),t=this._unwrapLongitudes(e.map(e=>e.data.location.lon));e.forEach((e,n)=>{e._overlay?.setPosition(Di([t[n],e.data.location.lat]))})}_removeMarker(e){e&&e.data.real_marker&&e._removeFrom(this._map)}_getAllMarkersBounds(e){let t=[];for(let n=0;n<e.length;n++)e[n].data.real_marker&&t.push([e[n].data.location.lon,e[n].data.location.lat]);let n=this._unwrapLongitudes(t.map(e=>e[0]));return t.map((e,t)=>[n[t],e[1]])}_unwrapLongitudes(e){if(e.length===0)return[];let t=[e[0]];for(let n=1;n<e.length;n++){let r=e[n];for(;r-t[n-1]>180;)r-=360;for(;r-t[n-1]<-180;)r+=360;t.push(r)}return t}_markerCoordsToViewCoords(e){return this._map.getView().getProjection().getCode()===`EPSG:4326`?e.map(e=>[e[0],e[1]]):e.map(e=>Di(e))}_bboxExtent(){let e=this.options.map_bbox;if(!e||e.length!==4)return null;if(this.options.map_type===`iiif`&&this.options.map_as_image)return e;let t=Di([e[0],e[1]]),n=Di([e[2],e[3]]);return[t[0],t[1],n[0],n[1]]}_opaquePanelPadding(){let e=[15,15,15,15];if(typeof document>`u`)return e;let t=document.querySelector(`.vco-storyslider .vco-slide.vco-active .vco-text`);if(!t)return e;let n=getComputedStyle(t).backgroundColor,r=/rgba?\(([^)]+)\)/.exec(n);if(!r)return e;let i=r[1].split(/[,\s/]+/).filter(e=>e!==``).map(Number);if((i.length>=4?i[3]:1)<.9)return e;let a=this._el.map.getBoundingClientRect(),o=t.getBoundingClientRect();return!a.width||!o.width||(this.options.layout===`portrait`?e[2]+=Math.max(0,a.bottom-o.top):e[1]+=Math.max(0,o.right-a.left)),e}_fitView(e,t,n=0){if(!t||!t.length)return;let r=dn(this._markerCoordsToViewCoords(t));e.getView().fit(r,{size:e.getSize(),padding:this._opaquePanelPadding(),maxZoom:12,duration:n,easing:this.options.ease})}_calculateMarkerZooms(){for(let e=0;e<this._markers.length;e++)if(this._markers[e].data.location){let t=this._markers[e],n,r;n=t.data.type&&t.data.type===`overview`?this._getMapCenter(!0):t.location();let i=e>0?this._markers[e-1].location():this._getMapCenter(!0),a=e<this._markers.length-1?this._markers[e+1].location():this._getMapCenter(!0),o=this._calculateZoomChange(i,n),s=this._calculateZoomChange(a,n);r=o&&o<s?o:s||o,this.options.map_center_offset&&(this.options.map_center_offset.left!==0||this.options.map_center_offset.top!==0)&&--r,t.data.location.zoom=r}}_lineStyle(e){return new vu({stroke:new _u({color:e,width:this.options.line_weight,lineDash:String(this.options.line_dash).split(`,`).map(e=>Number(e)),lineJoin:this.options.line_join})})}_createLine(e){return new sp({source:new lf({features:[]}),updateWhileAnimating:!0,style:this._lineStyle(this.options.line_color)})}_addLineToMap(e){e.setVisible(this.options.show_lines),this._map.addLayer(e)}_addToLine(e,t){let n=e.getSource(),r=n.getFeatures()[0];r||(r=new vd({geometry:new wd([])}),n.addFeature(r));let i=r.getGeometry().getCoordinates(),a=t.location.lon;if(i.length>0&&a!==void 0){let e=i[i.length-1][0]/111319.49079327358;for(;a-e>180;)a-=360;for(;a-e<-180;)a+=360}i.push(this._toViewCoords({lat:t.location.lat,lon:a})),r.getGeometry().setCoordinates(i)}_replaceLines(e,t,n){let r=e=>{let t=e.location?e.location.lat:e.lat;return[e.location?e.location.lon:e.lon,t]},i=t.map(r),a=this._unwrapLongitudes(i.map(e=>e[0])),o=i.map((e,t)=>[a[t],e[1]]),s=this._markerCoordsToViewCoords(o),c=e.getSource(),l=e=>{c.clear(),c.addFeature(new vd({geometry:new wd(e)}))};this._cancelLineAnimation();let u=n?.duration??0;if(u<=0||s.length<2){l(s);return}let d=e=>{let t=e.map(r);if(t.length<1||t.length>=o.length)return 0;let n=this._unwrapLongitudes(t.map(e=>e[0]));for(let e=0;e<t.length;e++)if(n[e]!==o[e][0]||t[e][1]!==o[e][1])return 0;return t.length},f=(n?.retractFrom??[]).map(r),p=null;if(f.length>0){let e=this._unwrapLongitudes(f.map(e=>e[0])),t=f.map((t,n)=>[e[n],t[1]]),n=o.length>=2&&o.length<t.length;for(let e=0;n&&e<o.length;e++)(t[e][0]!==o[e][0]||t[e][1]!==o[e][1])&&(n=!1);n&&(p=this._markerCoordsToViewCoords(t).slice(o.length-1))}let m=p?this._pathLength(p):0,h=d(n?.growFrom??[]),g=h>=1?s.slice(0,h):null,_=h>=1?s.slice(h-1):null,v=_?this._pathLength(_):0,y=this.options.ease,b=performance.now();g&&l(g);let x=e=>{let t=Math.min(1,Math.max(0,(e-b)/u)),n=y?y(t):t;if(p&&m>0){let e=m-n*m,r=this._truncatePath(p,e);l([...s,...r.slice(1)]),t>=1&&l(s)}else if(g&&_&&v>0){let e=this._truncatePath(_,n*v);l([...g,...e.slice(1)]),t>=1&&l(s)}else{let e=this._pathLength(s);l(this._truncatePath(s,n*e))}this._line_animation=t<1?requestAnimationFrame(x):null};this._line_animation=requestAnimationFrame(x)}_cancelLineAnimation(){this._line_animation!==null&&(cancelAnimationFrame(this._line_animation),this._line_animation=null)}_pathLength(e){let t=0;for(let n=1;n<e.length;n++)t+=Math.hypot(e[n][0]-e[n-1][0],e[n][1]-e[n-1][1]);return t}_truncatePath(e,t){if(t<=0||e.length<2)return[];let n=[e[0]],r=0;for(let i=1;i<e.length;i++){let a=Math.hypot(e[i][0]-e[i-1][0],e[i][1]-e[i-1][1]);if(r+a>=t){let o=(t-r)/a;return n.push([e[i-1][0]+o*(e[i][0]-e[i-1][0]),e[i-1][1]+o*(e[i][1]-e[i-1][1])]),n}r+=a,n.push(e[i])}return n}_panTo(e,t){this._map.getView().animate({center:this._toViewCoords(e),duration:this.options.duration,easing:this.options.ease})}_zoomTo(e,t){this._map.getView().animate({zoom:e,duration:this.options.duration,easing:this.options.ease})}_viewTo(e,t){let n=!0,r=this.options.duration,i=this._getMapZoom(),a={lat:e.lat,lon:e.lon};this.options.map_as_image||this._line_active.setVisible(!0),e.zoom!==void 0&&e.zoom!==null&&(i=e.zoom),t&&(t.duration!==void 0&&(t.duration===0?n=!1:r=t.duration),t.zoom&&this.options.calculate_zoom&&(i=t.zoom)),this.options.map_center_offset&&(a=this._getMapCenterOffset(a,i)),this._map.getView().animate({center:this._toViewCoords(a),zoom:i,duration:n?r:0,easing:this.options.ease}),this._mini_map&&this.options.width>this.options.skinny_size&&(i-1<=this.zoom_min_max.min?this._mini_map.setCollapsed(!0):this._mini_map.setCollapsed(!1))}_toViewCoords(e){return this._map.getView().getProjection().getCode()===`EPSG:4326`?[e.lon,e.lat]:Di([e.lon,e.lat])}_getMapZoom(){return this._map.getView().getZoom()||0}_getMapCenter(e){let t=Oi(this._map.getView().getCenter(),this._map.getView().getProjection());return{lat:t[1],lon:t[0]}}_getMapCenterOffset(e,t){let n=this._map.getView(),r=n.getProjection(),i=this._toViewCoords(e),a=n.getResolutionForZoom(t);return this._fromViewCoords([i[0]-this.options.map_center_offset.left*a,i[1]+this.options.map_center_offset.top*a],r)}_fromViewCoords(e,t){return t.getCode()===`EPSG:4326`?{lat:e[1],lon:e[0]}:{lat:Oi(e,t)[1],lon:e[0]/6378137*(180/Math.PI)}}_getBoundsZoom(e,t,n){let r=[[e.lon===void 0?e.lng:e.lon,e.lat],[t.lon,t.lat]],i=dn(this._markerCoordsToViewCoords(r)),a=this._map.getSize();if(!a||!a[0]||!a[1])return 0;let o=(i[2]-i[0])/a[0],s=(i[3]-i[1])/a[1],c=Math.max(o,s)*3;if(!isFinite(c)||c<=0)return 0;let l=this._map.getView().getZoomForResolution(c);return l===void 0||!isFinite(l)?0:Math.max(0,Math.round(l))}_initialMapLocation(){}getRouteDistance(){let e=this._markers.map(e=>e.location()).filter(e=>!!e&&isFinite(e.lat)&&isFinite(e.lon));if(e.length<2)return;let t=0;for(let n=1;n<e.length;n++){let r=(e[n].lat-e[n-1].lat)*Math.PI/180,i=(e[n].lon-e[n-1].lon)*Math.PI/180,a=Math.sin(r/2)**2+Math.cos(e[n-1].lat*Math.PI/180)*Math.cos(e[n].lat*Math.PI/180)*Math.sin(i/2)**2;t+=12742*Math.asin(Math.sqrt(a))}return t}_markerOverview(e){if(this._cancelLineAnimation(),this._line_active.setVisible(!1),e&&this._map.getView().getAnimating()&&(e=0),this.options.map_type===`zoomify`){let t=this._map.getSize(),n=this._zoomifyOverview([t?.[0]||1280,t?.[1]||450]);if(n){let t=this.options.map_center_offset&&(this.options.map_center_offset.left!==0||this.options.map_center_offset.top!==0)?n.zoom-1:n.zoom,r=this._map.getView().getResolutionForZoom(t),i=[n.center[0]-(this.options.map_center_offset?.left??0)*r,n.center[1]+(this.options.map_center_offset?.top??0)*r];this._map.getView().animate({center:i,zoom:t,duration:e??this._transition_duration,easing:this.options.ease})}}else if(this.options.map_type===`iiif`&&this.options.map_as_image){let t=this._tile_layer?.getSource();if(!t)return;let n=()=>{try{let n=t.getTileGrid();if(n){let t=n.getExtent(),r=this._map.getSize(),i=(t[2]-t[0])/(r[0]||1),a=(t[3]-t[1])/(r[1]||1),o=Math.max(i,a),s=this._map.getView(),c=s.getZoomForResolution(o),l=this.options.map_overview_center,u=l?this._toViewCoords({lat:l.lat,lon:l.lon}):[(t[0]+t[2])/2,(t[1]+t[3])/2],d=s.getProjection(),f=this._fromViewCoords(u,d),p=this._getMapCenterOffset(f,c);s.animate({center:this._toViewCoords(p),zoom:c,duration:e??this._transition_duration,easing:this.options.ease})}}catch(e){console.warn(`IIIF overview fit failed:`,e)}};t.getState()===`ready`?n():t.once(`change`,()=>{t.getState()===`ready`&&n()})}else{this.bounds_array=this._getAllMarkersBounds(this._markers);let t=this.options.map_overview_center;if(t&&this.bounds_array&&this.bounds_array.length){let n=dn(this._markerCoordsToViewCoords(this.bounds_array)),r=this._map.getSize(),i=Math.max((n[2]-n[0])/(r[0]||1),(n[3]-n[1])/(r[1]||1)),a=Math.max(0,Math.round(this._map.getView().getZoomForResolution(i))-1),o=this._getMapCenterOffset({lat:t.lat,lon:t.lon},a);this._map.getView().animate({center:this._toViewCoords(o),zoom:a,duration:e??this._transition_duration,easing:this.options.ease})}else if(this.options.map_center_offset&&(this.options.map_center_offset.left!==0||this.options.map_center_offset.top!==0)){if(this.bounds_array&&this.bounds_array.length){let t=dn(this._markerCoordsToViewCoords(this.bounds_array)),n=this._map.getSize(),r=(t[2]-t[0])/(n[0]||1),i=(t[3]-t[1])/(n[1]||1),a=Math.max(r,i),o=Math.max(0,Math.round(this._map.getView().getZoomForResolution(a))-1),s=[(t[0]+t[2])/2,(t[1]+t[3])/2],c=this._map.getView().getProjection(),l=this._fromViewCoords(s,c),u=this._getMapCenterOffset(l,o);this._map.getView().animate({center:this._toViewCoords(u),zoom:o,duration:e??this._transition_duration,easing:this.options.ease})}}else{this._fitView(this._map,this.bounds_array,0);let t=this._map.getView(),n=t.getZoom();if(n!==void 0){let r=this._fromViewCoords(t.getCenter(),t.getProjection()),i=this._getMapCenterOffset(r,n);t.animate({center:this._toViewCoords(i),zoom:n,duration:e??this._transition_duration,easing:this.options.ease})}}}this._mini_map&&this._mini_map.setCollapsed(!0)}_refreshMiniMapLayer(){if(!this._mini_map)return;let e=this._mini_map.getOverviewMap();e.getLayers().clear();let t=Fe(this.options),n=Ie(`consent_service_tiles`,`map tiles`);if(this.options.consent_required&&t&&!t.isGranted(n)){this._tile_layer_mini=null;return}this._tile_layer_mini=this._createTileLayer(this.options.map_type),e.addLayer(this._tile_layer_mini);let r=this.options.map_type===`zoomify`?this._zoomifyPyramid():null;if(r){let t=e.getSize(),n=t&&t[0]>=50&&t[1]>=50?t:[150,150];e.getView().fit(r.extent,{size:n})}else this.bounds_array&&this.bounds_array.length&&this._fitView(e,this.bounds_array);this.options.map_type===`iiif`&&this.options.map_as_image&&this._fitMiniMapToImage()}applyOptions(e){for(let t of e)switch(t){case`map_type`:{this._tile_layer&&this._map.removeLayer(this._tile_layer);let e=Fe(this.options),t=Ie(`consent_service_tiles`,`map tiles`);this.options.consent_required&&e&&!e.isGranted(t)||(this._tile_layer=this._createTileLayer(this.options.map_type),this._map.addLayer(this._tile_layer)),this._refreshMiniMapLayer(),this._el.map.style.backgroundColor=this.options.map_background_color;break}case`show_lines`:case`line_color`:case`line_color_inactive`:case`line_weight`:case`line_opacity`:case`line_dash`:case`line_join`:{let e=e=>this._lineStyle(e);this._line.setStyle(e(this.options.line_color_inactive)),this._line.setOpacity(this.options.line_opacity),this._line.setVisible(this.options.show_lines),this._line_active.setStyle(e(this.options.line_color)),this._line_active.setVisible(this.options.show_lines);break}case`map_background_color`:this._el.map.style.backgroundColor=this.options.map_background_color;break;case`map_bbox`:{let e=this._map.getView(),t=e.getCenter(),n=e.getZoom(),r=this._bboxExtent();this._map.setView(new bo({projection:e.getProjection(),center:t,zoom:n,minZoom:e.getMinZoom(),maxZoom:e.getMaxZoom(),...r?{extent:r}:{}}));break}}if(this._markers.length>0&&this.current_marker<this._markers.length){let e=this._markers[this.current_marker];e.data.type===`overview`?this._markerOverview():e.data.location&&this._viewTo(e.data.location,{duration:0})}}_updateMapDisplay(e,t,n){if(e){let e=t||this.options.duration;this.timer&&clearTimeout(this.timer),this.timer=setTimeout(()=>{this._refreshMap(!1)},e)}else this.timer||this._refreshMap(n!==!1);this._mini_map&&this._mini_map.setCollapsed(this._el.container.offsetWidth<this.options.skinny_size)}_refreshMap(e=!1){if(this._map){this.timer&&=(clearTimeout(this.timer),null),this._map.updateSize();let t=this._markers[this.current_marker];t&&t.data.type&&t.data.type===`overview`?(this._markerOverview(e?0:void 0),e&&this._map.renderSync()):t&&t.data.location&&(e?this._setViewInstant(t.data.location,this._getMapZoom()):this._viewTo(t.data.location,{zoom:this._getMapZoom()}))}}_setViewInstant(e,t){let n={lat:e.lat,lon:e.lon};this.options.map_center_offset&&(n=this._getMapCenterOffset(n,t));let r=this._map.getView();r.setZoom(t),r.setCenter(this._toViewCoords(n)),this._map.renderSync()}},Ux={addListener:function(e,t,n,r){let i=function(t){return n.call(r||e,t)};e.addEventListener(t,i,!1),e[`_vco_`+t+g(n)]=i},removeListener:function(e,t,n,r){let i=`_vco_`+t+g(n),a=e[i];a&&(e.removeEventListener(t,a,!1),e[i]=null)},preventDefault:function(e){e.preventDefault?e.preventDefault():e.returnValue=!1}},Wx=class{constructor(e,t,n){this._el={parent:{},container:{},button_overview:{},button_backtostart:{},button_fullscreen:{},progress:{},progress_fill:{},distance:{},button_collapse_toggle:{},arrow:{},line:{},coverbar:{},grip:{}},this.collapsed=!1,typeof e==`object`?this._el.container=e:this._el.container=M.get(e),t&&(this._el.parent=t),this.options={width:600,height:600,duration:1e3,ease:Je,menubar_default_y:0},this.animator={},f(this.options,n),this._initLayout()}show(e){}hide(e){}setSticky(e){this.options.menubar_default_y=e}setColor(e){e?this._el.container.className=`vco-menubar vco-menubar-inverted`:this._el.container.className=`vco-menubar`}setFullscreenState(e){let t=e?`vco-icon-resize-small`:`vco-icon-resize-full`;if(Px.mobile)this._el.button_fullscreen.innerHTML=`<span class='${t}'></span>`;else{let n=e?j.buttons.exit_fullscreen:j.buttons.fullscreen;this._el.button_fullscreen.innerHTML=`${n} <span class='${t}'></span>`}}setProgress(e,t){if(!this.options.show_progress||!this._el.progress_fill)return;let n=t>1?Math.round(e/(t-1)*100):100;this._el.progress_fill.style.width=n+`%`,this._el.progress.setAttribute(`role`,`progressbar`),this._el.progress.setAttribute(`aria-valuenow`,String(e+1)),this._el.progress.setAttribute(`aria-valuemin`,`1`),this._el.progress.setAttribute(`aria-valuemax`,String(t)),this._el.progress.setAttribute(`aria-label`,`${e+1} / ${t}`)}setDistance(e){if(!this.options.show_distance||!this._el.distance)return;if(e==null||!isFinite(e)){this._el.distance.style.display=`none`;return}this._el.distance.style.display=``;let t=e*.621371,n=typeof j.lang==`string`&&j.lang?j.lang:`en`;this._el.distance.textContent=e>=10?`${Math.round(e).toLocaleString(n)} km · ${Math.round(t).toLocaleString(`en-US`)} mi`:`${e.toFixed(1)} km · ${t.toFixed(1)} mi`}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}_onButtonOverview(e){this.fire(`overview`,e)}_onButtonBackToStart(e){this.fire(`back_to_start`,e)}_onButtonFullscreen(e){this.fire(`fullscreen`,e)}_onButtonCollapseMap(e){this.collapsed?(this.collapsed=!1,this.show(),this._el.button_overview.style.display=`inline`,this.fire(`collapse`,{y:this.options.menubar_default_y}),Px.mobile?this._el.button_collapse_toggle.innerHTML=`<span class='vco-icon-arrow-up'></span>`:this._el.button_collapse_toggle.innerHTML=j.buttons.collapse_toggle+`<span class='vco-icon-arrow-up'></span>`):(this.collapsed=!0,this.hide(25),this._el.button_overview.style.display=`none`,this.fire(`collapse`,{y:1}),Px.mobile?this._el.button_collapse_toggle.innerHTML=`<span class='vco-icon-arrow-down'></span>`:this._el.button_collapse_toggle.innerHTML=j.buttons.uncollapse_toggle+`<span class='vco-icon-arrow-down'></span>`)}_initLayout(){this._el.button_overview=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_overview,`click`,this._onButtonOverview,this),this.options.show_overview===!1&&(this._el.button_overview.style.display=`none`),this._el.button_backtostart=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_backtostart,`click`,this._onButtonBackToStart,this),this.options.show_back_to_start===!1&&(this._el.button_backtostart.style.display=`none`),this._el.button_fullscreen=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_fullscreen,`click`,this._onButtonFullscreen,this),this.options.fullscreen===!1&&(this._el.button_fullscreen.style.display=`none`),this._el.button_collapse_toggle=M.create(`span`,`vco-menubar-button`,this._el.container),Ux.addListener(this._el.button_collapse_toggle,`click`,this._onButtonCollapseMap,this),this.options.map_as_image?this._el.button_overview.innerHTML=j.buttons.overview:this._el.button_overview.innerHTML=j.buttons.map_overview,this.options.show_progress&&(this._el.progress=M.create(`span`,`vco-menubar-progress`,this._el.container),this._el.progress_fill=M.create(`span`,`vco-menubar-progress-fill`,this._el.progress)),this.options.show_distance&&(this._el.distance=M.create(`span`,`vco-menubar-distance`,this._el.container)),Px.mobile?(this._el.button_backtostart.innerHTML=`<span class='vco-icon-goback'></span>`,this._el.button_collapse_toggle.innerHTML=`<span class='vco-icon-arrow-up'></span>`,this._el.button_fullscreen.innerHTML=`<span class='vco-icon-resize-full'></span>`,this._el.container.setAttribute(`ontouchstart`,` `)):(this._el.button_backtostart.innerHTML=j.buttons.backtostart+` <span class='vco-icon-goback'></span>`,this._el.button_collapse_toggle.innerHTML=j.buttons.collapse_toggle+`<span class='vco-icon-arrow-up'></span>`,this._el.button_fullscreen.innerHTML=j.buttons.fullscreen+` <span class='vco-icon-resize-full'></span>`),this.options.layout===`landscape`&&(this._el.button_collapse_toggle.style.display=`none`)}_updateDisplay(e,t,n){e&&(this.options.width=e),t&&(this.options.height=t)}},Gx=class extends Qe(Ze(Wx)){constructor(...e){super(...e)}},Kx=c(o(((e,t)=>{(function(e,n){typeof define==`function`?define(n):t===void 0?this[e]=n():t.exports=n()})(`morpheus`,function(){var e=document,t=window,n=t.performance,r=n&&(n.now||n.webkitNow||n.msNow||n.mozNow),i=r?function(){return r.call(n)}:function(){return+new Date},a=!1,o=e.documentElement,s=1e3,c=/^rgb\(|#/,l=/^([+\-])=([\d\.]+)/,u=/^(?:[\+\-]=?)?\d+(?:\.\d+)?(%|in|cm|mm|em|ex|pt|pc|px)$/,d=/rotate\(((?:[+\-]=)?([\-\d\.]+))deg\)/,f=/scale\(((?:[+\-]=)?([\d\.]+))\)/,p=/skew\(((?:[+\-]=)?([\-\d\.]+))deg, ?((?:[+\-]=)?([\-\d\.]+))deg\)/,m=/translate\(((?:[+\-]=)?([\-\d\.]+))px, ?((?:[+\-]=)?([\-\d\.]+))px\)/,h={lineHeight:1,zoom:1,zIndex:1,opacity:1,transform:1},g=function(){for(var t=e.createElement(`a`).style,n=[`webkitTransform`,`MozTransform`,`OTransform`,`msTransform`,`Transform`],r=0;r<n.length;r++)if(n[r]in t)return n[r]}(),_=function(){return e.createElement(`a`).style.opacity!==void 0}(),v=e.defaultView&&e.defaultView.getComputedStyle?function(t,n){n=n==`transform`?g:n,n=k(n);var r=null,i=e.defaultView.getComputedStyle(t,``);return i&&(r=i[n]),t.style[n]||r}:o.currentStyle?function(e,t){if(t=k(t),t==`opacity`){var n=100;try{n=e.filters[`DXImageTransform.Microsoft.Alpha`].opacity}catch{try{n=e.filters(`alpha`).opacity}catch{}}return n/100}var r=e.currentStyle?e.currentStyle[t]:null;return e.style[t]||r}:function(e,t){return e.style[k(t)]},y=function(){return t.requestAnimationFrame||t.webkitRequestAnimationFrame||t.mozRequestAnimationFrame||t.msRequestAnimationFrame||t.oRequestAnimationFrame||function(e){t.setTimeout(function(){e(+new Date)},17)}}();y(function(e){a=e>0xe8d4a51000!=i()>0xe8d4a51000});var b=[];function x(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t);for(n=0;n<e.length;++n)if(e[n]===t)return n}function S(e){var t,n=b.length;for(a&&(e=i()),t=n;t--;)b[t](e);b.length&&y(S)}function C(e){b.push(e)===1&&y(S)}function w(e){var t,n=x(b,e);n>=0&&(t=b.slice(n+1),b.length=n,b=b.concat(t))}function T(e,t){var n={},r;return(r=e.match(d))&&(n.rotate=oe(r[1],t?t.rotate:null)),(r=e.match(f))&&(n.scale=oe(r[1],t?t.scale:null)),(r=e.match(p))&&(n.skewx=oe(r[1],t?t.skewx:null),n.skewy=oe(r[3],t?t.skewy:null)),(r=e.match(m))&&(n.translatex=oe(r[1],t?t.translatex:null),n.translatey=oe(r[3],t?t.translatey:null)),n}function E(e){var t=``;return`rotate`in e&&(t+=`rotate(`+e.rotate+`deg) `),`scale`in e&&(t+=`scale(`+e.scale+`) `),`translatex`in e&&(t+=`translate(`+e.translatex+`px,`+e.translatey+`px) `),`skewx`in e&&(t+=`skew(`+e.skewx+`deg,`+e.skewy+`deg)`),t}function D(e,t,n){return`#`+(1<<24|e<<16|t<<8|n).toString(16).slice(1)}function O(e){var t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return(t?D(t[1],t[2],t[3]):e).replace(/#(\w)(\w)(\w)$/,`#$1$1$2$2$3$3`)}function k(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}function ee(e){return typeof e==`function`}function te(e){return Math.sin(e*Math.PI/2)}function ne(e,t,n,r,a,o){r=ee(r)?r:se.easings[r]||te;var c=e||s,l=this,u=o-a,d=i(),f=0,p=0;function m(e){var i=e-d;if(i>c||f)return o=isFinite(o)?o:1,f?p&&t(o):t(o),w(m),n&&n.apply(l);t(isFinite(o)?u*r(i/c)+a:r(i/c))}return C(m),{stop:function(e){f=1,p=e,e||(n=null)}}}function re(e,t){for(var n=e.length,r=[],i=0,a;i<n;++i)r[i]=[e[i][0],e[i][1]];for(a=1;a<n;++a)for(i=0;i<n-a;++i)r[i][0]=(1-t)*r[i][0]+t*r[parseInt(i+1,10)][0],r[i][1]=(1-t)*r[i][1]+t*r[parseInt(i+1,10)][1];return[r[0][0],r[0][1]]}function ie(e,t,n){for(var r=[],i=0,a,o,s;i<6;i++)o=Math.min(15,parseInt(t.charAt(i),16)),s=Math.min(15,parseInt(n.charAt(i),16)),a=Math.floor((s-o)*e+o),a=a>15?15:a<0?0:a,r[i]=a.toString(16);return`#`+r.join(``)}function ae(e,t,n,r,i,a,o){if(i==`transform`){for(var c in o={},n[a][i])o[c]=c in r[a][i]?Math.round(((r[a][i][c]-n[a][i][c])*e+n[a][i][c])*s)/s:n[a][i][c];return o}return typeof n[a][i]==`string`?ie(e,n[a][i],r[a][i]):(o=Math.round(((r[a][i]-n[a][i])*e+n[a][i])*s)/s,i in h||(o+=t[a][i]||`px`),o)}function oe(e,t,n,r,i){return(n=l.exec(e))?(i=parseFloat(n[2]))&&t+(n[1]==`+`?1:-1)*i:parseFloat(e)}function se(e,t){var n=e?n=isFinite(e.length)?e:[e]:[],r,i=t.complete,a=t.duration,o=t.easing,s=t.bezier,l=[],d=[],f=[],p=[],m,h;for(s&&(m=t.left,h=t.top,delete t.right,delete t.bottom,delete t.left,delete t.top),r=n.length;r--;){if(l[r]={},d[r]={},f[r]={},s){var y=v(n[r],`left`),b=v(n[r],`top`),x=[oe(ee(m)?m(n[r]):m||0,parseFloat(y)),oe(ee(h)?h(n[r]):h||0,parseFloat(b))];p[r]=ee(s)?s(n[r],x):s,p[r].push(x),p[r].unshift([parseInt(y,10),parseInt(b,10)])}for(var S in t){switch(S){case`complete`:case`duration`:case`easing`:case`bezier`:continue}var C=v(n[r],S),w,D=ee(t[S])?t[S](n[r]):t[S];if(typeof D==`string`&&c.test(D)&&!c.test(C)){delete t[S];continue}l[r][S]=S==`transform`?T(C):typeof D==`string`&&c.test(D)?O(C).slice(1):parseFloat(C),d[r][S]=S==`transform`?T(D,l[r][S]):typeof D==`string`&&D.charAt(0)==`#`?O(D).slice(1):oe(D,parseFloat(C)),typeof D==`string`&&(w=D.match(u))&&(f[r][S]=w[1])}}return ne.apply(n,[a,function(e,i,a){for(r=n.length;r--;)for(var o in s&&(a=re(p[r],e),n[r].style.left=a[0]+`px`,n[r].style.top=a[1]+`px`),t)i=ae(e,f,l,d,o,r),o==`transform`?n[r].style[g]=E(i):o==`opacity`&&!_?n[r].style.filter=`alpha(opacity=`+i*100+`)`:n[r].style[k(o)]=i},i,o])}return se.tween=ne,se.getStyle=v,se.bezier=re,se.transform=g,se.parseTransform=T,se.formatTransform=E,se.animationFrame=y,se.easings={},se})}))(),1),qx=class{constructor(e,t,n){this._el={container:{},content_container:{},icon:{},title:{},description:{}},this.mediatype={},this.data={title:`Navigation`,description:`Description`},this.options={direction:`previous`},this.animator=null,this.animator_position=null,f(this.options,t),f(this.data,e),this._el.container=M.create(`div`,`vco-slidenav-`+this.options.direction),Px.mobile&&this._el.container.setAttribute(`ontouchstart`,` `),this._initLayout(),this._initEvents(),n&&n.appendChild(this._el.container)}update(e){this._update(e)}setColor(e){e?this._el.content_container.className=`vco-slidenav-content-container vco-slidenav-inverted`:this._el.content_container.className=`vco-slidenav-content-container`}updatePosition(e,t,n,r,i,a){let o={duration:n,easing:r,complete:()=>{this._onUpdatePositionComplete(a)}},s=i;for(let n in e)Object.hasOwn(e,n)&&(o[n]=t?e[n]+`%`:e[n]+`px`);this.animator_position&&this.animator_position.stop();let c;c=o.right?`right`:`left`,t?this._el.container.style[c]=s+`%`:this._el.container.style[c]=s+`px`,this.animator_position=(0,Kx.default)(this._el.container,o)}_onUpdatePositionComplete(e){e&&(this._el.container.style.left=``,this._el.container.style.right=``)}_onMouseClick(){this.fire(`clicked`,this.options)}_update(e){this.data=f(this.data,e),this.data.title!==``&&(this._el.title.innerHTML=this.data.title),this.data.date!==``&&(this._el.description.innerHTML=this.data.description)}_initLayout(){this._el.content_container=M.create(`div`,`vco-slidenav-content-container`,this._el.container),this._el.icon=M.create(`div`,`vco-slidenav-icon`,this._el.content_container),this._el.title=M.create(`div`,`vco-slidenav-title`,this._el.content_container),this._el.description=M.create(`div`,`vco-slidenav-description`,this._el.content_container),this._el.icon.innerHTML=` `,this._update()}_initEvents(){Ux.addListener(this._el.container,`click`,this._onMouseClick,this)}},Jx=class extends Qe(Ze(qx)){constructor(...e){super(...e)}},Yx=class{data;constructor(e,t,n){this._el={parent:{},container:{},message_container:{},loading_icon:{},message:{}},this.options={width:600,height:600,message_class:`vco-message`,message_icon_class:`vco-loading-icon`},this.data={},f(this.data,e),f(this.options,t),this._el.container=M.create(`div`,this.options.message_class),n&&(n.appendChild(this._el.container),this._el.parent=n),this.animator={},this._initLayout(),this._initEvents()}updateMessage(e){this._updateMessage(e)}_updateMessage(e){e?this._el.message.innerHTML=e:j?this._el.message.innerHTML=j.messages.loading:this._el.message.innerHTML=`Loading`}_onMouseClick(){this.fire(`clicked`,this.options)}_initLayout(){this._el.message_container=M.create(`div`,`vco-message-container`,this._el.container),this._el.loading_icon=M.create(`div`,this.options.message_icon_class,this._el.message_container),this._el.message=M.create(`div`,`vco-message-content`,this._el.message_container),this._updateMessage()}_initEvents(){Ux.addListener(this._el.container,`click`,this._onMouseClick,this)}},Xx=class extends Qe(Ze(Yx)){constructor(...e){super(...e)}},Zx=class{constructor(e,t,n){this._el={container:{},content_container:{},content:{},content_item:{},content_link:{},caption:null,credit:null,parent:{},link:null},this.player=null,this.timer=null,this.load_timer=null,this.load_controller=null,this.message=null,this.media_id=null,this._state={loaded:!1,show_meta:!1,media_loaded:!1},this.data={uniqueid:null,url:null,credit:null,caption:null,link:null,link_target:null},this.options={api_key_flickr:``,credit_height:0,caption_height:0},this.animator={},f(this.options,t),f(this.data,e),this._el.container=M.create(`div`,`vco-media`),this.data.uniqueid&&(this._el.container.id=this.data.uniqueid),this._initLayout(),n&&(n.appendChild(this._el.container),this._el.parent=n)}async loadMedia(){if(!this._state.loaded){let e=Fe(this.options);if(this.options.consent_required&&e&&this.options.media_type){let t=this.options.media_type,n=``;try{n=new URL(this.data?.url??``).host}catch{}let r=this._el.content_container??this._el.container;await e.request(t,n,r)?this._beginLoad():this._showBlocked();return}this._beginLoad()}}_beginLoad(){this.load_timer=setTimeout(()=>{try{this._loadMedia(),this._state.loaded=!0,this._updateDisplay()}catch(e){console.log(`Error loading media for `,this._media),console.log(e),this.loadErrorDisplay(`Error loading media.`)}},1200)}_showBlocked(){let e=this._el.content_container??this._el.container,t=document.createElement(`div`);t.className=`vco-consent-blocked`,t.textContent=Ie(`consent_blocked`,`Content from {service} is blocked.`).replace(`{service}`,this.options.media_type??``),e.append(t),this.onLoaded(!0)}loadingMessage(){this.message.updateMessage(this._(`loading`)+` `+this.options.media_name)}updateMediaDisplay(e){this._state.loaded&&(this._updateMediaDisplay(e),!Px.mobile&&e!==`portrait`&&(this._el.content_item.style.maxHeight=this.options.height/2+`px`),this._state.media_loaded&&(this._el.credit&&(this._el.credit.style.width=`auto`),this._el.caption&&(this._el.caption.style.width=`auto`)),e===`portrait`&&(this._el.content_item.style.maxHeight=`none`),this._state.media_loaded&&(this._el.credit&&(this._el.credit.style.width=this._el.content_item.offsetWidth+`px`),this._el.caption&&(this._el.caption.style.width=this._el.content_item.offsetWidth+`px`)))}_loadMedia(){}_updateMediaDisplay(e){}show(){}hide(){}addTo(e){e.appendChild(this._el.container),this.onAdd()}removeFrom(e){e.removeChild(this._el.container),this.onRemove()}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}stopMedia(){!this._state.loaded&&this.load_timer&&(clearTimeout(this.load_timer),this.load_timer=null),this.load_controller&&=(this.load_controller.abort(),null),this._stopMedia()}async loadScript(e){this.load_controller?.abort();let t=new AbortController;this.load_controller=t;try{await E(e,{signal:t.signal})}finally{this.load_controller===t&&(this.load_controller=null)}}loadErrorDisplay(e){this._el.content_item&&this._el.content_item.parentNode===this._el.content&&this._el.content.removeChild(this._el.content_item),this._el.content_item=M.create(`div`,`vco-media-item vco-media-loaderror`,this._el.content),this._el.content_item.innerHTML=`<div class='vco-icon-`+this.options.media_type+`'></div><p>`+e+`</p>`,this.onLoaded(!0)}onLoaded(e){this._state.loaded=!0,this.fire(`loaded`,this.data),this.message&&this.message.hide(),e||this.showMeta(),this.updateDisplay()}onMediaLoaded(e){this._state.media_loaded=!0,this.fire(`media_loaded`,this.data),this._el.credit&&(this._el.credit.style.width=this._el.content_item.offsetWidth+`px`),this._el.caption&&(this._el.caption.style.width=this._el.content_item.offsetWidth+`px`)}showMeta(e,t){this._state.show_meta=!0,this.data.credit&&this.data.credit!==``&&!this._el.credit&&(this._el.credit=M.create(`div`,`vco-credit`,this._el.content_container),this._el.credit.innerHTML=this.data.credit,this.options.credit_height=this._el.credit.offsetHeight),this.data.caption&&this.data.caption!==``&&!this._el.caption&&(this._el.caption=M.create(`div`,`vco-caption`,this._el.content_container),this._el.caption.innerHTML=this.data.caption,this.options.caption_height=this._el.caption.offsetHeight)}onAdd(){this.fire(`added`,this.data)}onRemove(){this.fire(`removed`,this.data)}_initLayout(){if(this.message=new Xx({},this.options),this.message.addTo(this._el.container),this._el.content_container=M.create(`div`,`vco-media-content-container`,this._el.container),this.data.link&&this.data.link!==``){this._el.link=M.create(`a`,`vco-media-link`,this._el.content_container);let e=this._el.link;e.href=this.data.link,e.target=this.data.link_target&&this.data.link_target!==``?this.data.link_target:`_blank`,this._el.content=M.create(`div`,`vco-media-content`,this._el.link)}else this._el.content=M.create(`div`,`vco-media-content`,this._el.content_container)}_updateDisplay(e,t,n){e&&(this.options.width=e),t&&(this.options.height=t),n&&(this.options.layout=n),this._el.credit&&(this.options.credit_height=this._el.credit.offsetHeight),this._el.caption&&(this.options.caption_height=this._el.caption.offsetHeight+5),this.updateMediaDisplay(this.options.layout)}_stopMedia(){}},Qx=class extends Ze(Zx){constructor(...e){super(...e)}},$x=class extends Qx{_loadMedia(){if(this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this.data.link){this._el.content_link=M.create(`a`,``,this._el.content);let e=this._el.content_link;e.href=this.data.link,e.target=`_blank`,this._el.content_item=M.create(`img`,`vco-media-item vco-media-image vco-media-shadow`,this._el.content_link)}else this._el.content_item=M.create(`img`,`vco-media-item vco-media-image vco-media-shadow`,this._el.content);this._el.content_item.addEventListener(`load`,e=>{this.onMediaLoaded()}),this._el.content_item.src=this.data.url,this.onLoaded()}_updateMediaDisplay(e){}},eS=class extends Qx{async _loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this.youtube_loaded=!1,this._el.content_item=M.create(`div`,`vco-media-item vco-media-youtube vco-media-shadow`,this._el.content),this._el.content_item.id=v(7);let e=x(this.data.url);this.media_id={},this.data.url.match(`v=`)?this.media_id.id=e.v:this.data.url.match(`/embed/`)?this.media_id.id=this.data.url.split(`embed/`)[1].split(/[?&]/)[0]:this.data.url.match(/v\/|v=|youtu\.be\/|shorts\//)?this.media_id.id=this.data.url.split(/v\/|v=|youtu\.be\/|shorts\//)[1].split(/[?&]/)[0]:console.log(`YouTube in URL but not a valid video`),this.media_id.start=e.t,this.media_id.hd=e.hd;try{await this.loadScript(`https://www.youtube.com/iframe_api`)}catch{return}this.createMedia()}_updateMediaDisplay(){this._el.content_item.style.height=S.r16_9({w:this._el.content_item.offsetWidth})+`px`}_stopMedia(){if(clearTimeout(this.timer),this.timer=null,this.youtube_loaded)try{let e=YT;this.player.getPlayerState()===e.PlayerState.PLAYING&&this.player.pauseVideo()}catch(e){console.log(e)}}createMedia(){if(this.media_id.start!==void 0){let e=this.media_id.start.toString(),t=/(\d+)h/.exec(e),n=/(\d+)m/.exec(e),r=/(\d+)s/.exec(e);if(t||n||r)this.media_id.start=(t?parseInt(t[1],10)*3600:0)+(n?parseInt(n[1],10)*60:0)+(r?parseInt(r[1],10):0);else{let t=parseInt(e,10);this.media_id.start=Number.isNaN(t)?0:t}}else this.media_id.start=0;this.media_id.hd===void 0?this.media_id.hd=!1:this.media_id.hd=!0,this.createPlayer()}createPlayer(){if(clearTimeout(this.timer),typeof YT<`u`&&YT.Player!==void 0){let e=YT;this.player=new e.Player(this._el.content_item.id,{playerVars:{enablejsapi:1,color:`white`,autohide:1,showinfo:0,theme:`light`,start:this.media_id.start,fs:0,rel:0},videoId:this.media_id.id,events:{onReady:()=>{this.onPlayerReady()},onStateChange:this.onStateChange}})}else this.timer=setTimeout(()=>{this.createPlayer()},1e3);this.onLoaded()}onPlayerReady(e){this.youtube_loaded=!0;let t=document.getElementById(this._el.content_item.id);t&&(this._el.content_item=t),this.onMediaLoaded(),this.onLoaded()}onStateChange(e){let t=YT;e.data===t.PlayerState.ENDED&&(e.target.seekTo(0),e.target.pauseVideo())}},tS=[`width`,`height`,`frameborder`,`allowfullscreen`,`allow`,`scrolling`,`title`],nS=[`BLOCKQUOTE`,`P`,`CITE`,`EM`,`STRONG`,`B`,`I`,`U`,`Q`,`A`,`BR`,`SPAN`,`SMALL`,`SUP`,`SUB`,`FOOTER`,`UL`,`OL`,`LI`],rS=[`SCRIPT`,`STYLE`,`TEMPLATE`,`IFRAME`,`FRAME`,`OBJECT`,`EMBED`,`APPLET`,`LINK`,`META`,`BASE`,`SVG`,`MATH`,`FORM`,`INPUT`,`BUTTON`,`TEXTAREA`,`SELECT`];function iS(e){return new DOMParser().parseFromString(e,`text/html`)}function aS(e){if(!e)return null;let t=document.createElement(`a`);return t.href=e,t.protocol===`http:`||t.protocol===`https:`?t.href:null}function oS(e){let t=iS(e).querySelector(`iframe`),n=null;if(t?n=aS(t.getAttribute(`src`)):/^https?:\/\/\S+$/i.test(e.trim())&&(n=aS(e.trim())),!n)return null;let r=document.createElement(`iframe`);if(r.setAttribute(`src`,n),t)for(let e=0;e<tS.length;e++)t.hasAttribute(tS[e])&&r.setAttribute(tS[e],t.getAttribute(tS[e]));else r.setAttribute(`width`,`100%`),r.setAttribute(`height`,`100%`),r.setAttribute(`frameborder`,`0`),r.setAttribute(`allowfullscreen`,``);return r}function sS(e){let t=document.createDocumentFragment();return cS(iS(e).body,t),t}function cS(e,t){for(let n=0;n<e.childNodes.length;n++){let r=e.childNodes[n];if(r.nodeType===3)t.appendChild(document.createTextNode(r.nodeValue));else if(r.nodeType===1){let e=r.nodeName.toUpperCase();if(rS.includes(e))continue;if(nS.includes(e)){let n=document.createElement(e);if(e===`A`){let e=aS(r.getAttribute(`href`));e&&(n.setAttribute(`href`,e),n.setAttribute(`target`,`_blank`))}cS(r,n),t.appendChild(n)}else cS(r,t)}}}var lS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-blockquote`,this._el.content),this.media_id=this.data.url,this._el.content_item.appendChild(sS(this.media_id)),this.onLoaded()}updateMediaDisplay(){}_updateMediaDisplay(){}},uS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-wikipedia`,this._el.content),this.media_id=this.data.url.split(`wiki/`)[1].split(`#`)[0].replace(`_`,` `),this.media_id=this.media_id.replace(` `,`%20`);let e=this.data.url.split(`//`)[1].split(`.wikipedia`)[0],t=`wikipediaCallback_`+this.media_id.replace(/[^0-9a-z]/gi,``).slice(0,494),n=`https://${e}.wikipedia.org/w/api.php?action=query&prop=extracts&redirects=&titles=${this.media_id}&exintro=1&format=json&callback=${t}`;this._fetchExtract(n,t)}async _fetchExtract(e,t){try{this.createMedia(await O(e,t))}catch{this.loadErrorDisplay(`Unable to load this article.`)}}createMedia(e){let t=e;if(t.query){let e,n={entry:{},title:``,text:``,extract:``,paragraphs:1,text_array:[]},r=t.query;n.entry=w(r.pages,0),n.extract=n.entry.extract,n.title=n.entry.title,n.extract.match(`<p>`)?n.text_array=n.extract.split(`<p>`):n.text_array.push(n.extract);for(let e=0;e<n.text_array.length;e++)e+1<=n.paragraphs&&e+1<n.text_array.length&&(n.text+=`<p>`+n.text_array[e+1]);e=`<h4><a href='`+this.data.url+`' target='_blank'>`+n.title+`</a></h4>`,e+=`<span class='wiki-source'>`+j.messages.wikipedia+`</span>`,e+=n.text,n.extract.match(`REDIRECT`)||(this._el.content_item.innerHTML=e,this.onLoaded())}}updateMediaDisplay(){}_updateMediaDisplay(){}},dS=class extends Qx{async _loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-soundcloud vco-media-shadow`,this._el.content),this.media_id=this.data.url;let e=`https://soundcloud.com/oembed?url=`+this.media_id+`&format=json`;try{let t=await(await fetch(e)).json();await this.loadScript(`https://w.soundcloud.com/player/api.js`),this.createMedia(t)}catch(e){e?.name!==`AbortError`&&this.loadErrorDisplay(`Unable to load this track.`)}}createMedia(e){let t=e;if(!t?.html){this.loadErrorDisplay(`Unable to load this track.`);return}this._el.content_item.innerHTML=t.html,this.soundCloudCreated=!0;let n=SC;this.widget=n.Widget(this._el.content_item.querySelector(`iframe`)),this.onLoaded()}_stopMedia(){this.soundCloudCreated&&this.widget?.pause()}},fS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-vimeo vco-media-shadow`,this._el.content);let e=this.data.url.split(/video\/|\/\/vimeo\.com\//);if(!e[1])throw Error(`Invalid Vimeo URL`);this.media_id=e[1].split(/[?&]/)[0];let t=`https://player.vimeo.com/video/`+this.media_id+`?api=1&title=0&byline=0&portrait=0&color=ffffff`;this.player=M.create(`iframe`,``,this._el.content_item),this.player.width=`100%`,this.player.height=`100%`,this.player.frameBorder=`0`,this.player.src=t,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=S.r16_9({w:this._el.content_item.offsetWidth})+`px`}_stopMedia(){try{this.player?.contentWindow?.postMessage(JSON.stringify({method:`pause`}),`https://player.vimeo.com`)}catch(e){console.log(e)}}},pS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`video`,`vco-media-item vco-media-video vco-media-shadow`,this._el.content);let e=this._el.content_item;e.controls=!0,this._el.source_item=M.create(`source`,``,this._el.content_item);let t=this._el.source_item;e.addEventListener(`canplay`,()=>{this.onLoaded()}),t.addEventListener(`error`,()=>{this.loadErrorDisplay(j.messages.error+` `+this.options.media_name)}),t.src=this.data.url;let n=this._getType(this.data.url,this.data.mediatype.match_str);n&&(t.type=n),e.appendChild(document.createTextNode(`Your browser doesn't support HTML5 video with `+t.type)),this.player_element=e}_updateMediaDisplay(){}_stopMedia(){this.player_element&&this.player_element.pause()}_getType(e,t){let n=e.match(t),r=`video/`;if(!n)return r;switch(n[1]){case`mp4`:r+=`mp4`;break;case`webm`:r+=`webm`;break;default:r=``}return r}},mS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`audio`,`vco-media-item vco-media-audio vco-media-shadow`,this._el.content);let e=this._el.content_item;e.controls=!0,this._el.source_item=M.create(`source`,``,this._el.content_item);let t=this._el.source_item;e.addEventListener(`canplay`,()=>{this.onLoaded()}),t.addEventListener(`error`,()=>{this.loadErrorDisplay(j.messages.error+` `+this.options.media_name)}),t.src=this.data.url;let n=this._getType(this.data.url,this.data.mediatype.match_str);n&&(t.type=n),e.appendChild(document.createTextNode(`Your browser doesn't support HTML5 audio with `+t.type)),this.player_element=e}_updateMediaDisplay(){}_stopMedia(){this.player_element&&this.player_element.pause()}_getType(e,t){let n=e.match(t),r=`audio/`;if(!n)return r;switch(n[1]){case`mp3`:r+=`mpeg`;break;case`wav`:r+=`wav`;break;case`m4a`:r+=`mp4`;break;default:r=``}return r}},hS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-dailymotion`,this._el.content);let e=this.data.url.match(`video`)?this.data.url.split(`video/`)[1]:this.data.url.split(`embed/`)[1];if(!e)throw Error(`Invalid DailyMotion URL`);this.media_id=e.split(/[?&]/)[0];let t=`https://www.dailymotion.com/embed/video/`+this.media_id+`?api=postMessage`;this._el.content_item.innerHTML=`<iframe autostart='false' frameborder='0' width='100%' height='100%' src='`+t+`'></iframe>`,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=S.r16_9({w:this._el.content_item.offsetWidth})+`px`}_stopMedia(){(this._el.content_item?.querySelector(`iframe`))?.contentWindow?.postMessage(`{"command":"pause","parameters":[]}`,`*`)}},gS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-twitter`,this._el.content);let e=/(?:twitter\.com|x\.com)\/(.+?)\/status\/(\d+)/.exec(this.data.url);e&&(this.user_id=e[1],this.media_id=e[2]);let t=`twitterCallback_${this.media_id}`,n=`https://api.twitter.com/1/statuses/oembed.json?id=${this.media_id}&include_entities=true&callback=${t}`;this._fetchEmbed(n,t)}async _fetchEmbed(e,t){try{this.createMedia(await O(e,t))}catch{this.loadErrorDisplay(`Unable to load this tweet.`)}}createMedia(e){let t=e,n=``,r;r=t.html.split(`</p>—`)[0]+`</p></blockquote>`;let i=t.author_url.split(/twitter\.com|x\.com\//)[1],a=t.html.split(`</p>—`)[1].split(`<a href="`)[1],o=a.split(`">`)[0],s=a.split(`">`)[1].split(`</a>`)[0];r=r.replace(/<a href/gi,`<a target="_blank" href`),n+=r,n+=`<div class='vcard'>`,n+=`<a href='`+o+`' class='twitter-date' target='_blank'>`+s+`</a>`,n+=`<div class='author'>`,n+=`<a class='screen-name url' href='`+t.author_url+`' target='_blank'>`,n+=`<span class='avatar'></span>`,n+=`<span class='fn'>`+t.author_name+` <span class='vco-icon-twitter'></span></span>`,n+=`<span class='nickname'>@`+i+`<span class='thumbnail-inline'></span></span>`,n+=`</a>`,n+=`</div>`,n+=`</div>`,this._el.content_item.innerHTML=n,this.onLoaded()}updateMediaDisplay(){}_updateMediaDisplay(){}},_S=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`img`,`vco-media-item vco-media-image vco-media-flickr vco-media-shadow`,this._el.content),this._el.content_item.addEventListener(`load`,e=>{this.onMediaLoaded()}),this.establishMediaID();let e=`https://api.flickr.com/services/rest/?method=flickr.photos.getSizes&api_key=`+this.options.api_key_flickr+`&photo_id=`+this.media_id+`&format=json&nojsoncallback=1`;this._fetchSizes(e)}async _fetchSizes(e){try{let t=await(await fetch(e)).json();t.stat===`ok`?this.createMedia(t):this.loadErrorDisplay(`Photo not found or private.`)}catch{this.loadErrorDisplay(`Photo not found or private.`)}}establishMediaID(){let e=this.data.url.indexOf(`flickr.com/photos/`);if(e===-1)throw`Invalid Flickr URL`;let t=e+18;this.media_id=this.data.url.slice(t).split(`/`)[1]}createMedia(e){let t=e,n=this.sizes(this.options.height),r=t?.sizes?.size;if(!r||!r.length){this.loadErrorDisplay(`Photo not found or private.`);return}let i=r[Math.max(0,r.length-2)].source;for(let e=0;e<r.length;e++)r[e].label===n&&(i=r[e].source);this._el.content_item.src=i,this.onLoaded()}sizes(e){let t;return t=e<=75?e<=0?`Large`:`Thumbnail`:e<=180?`Small`:e<=240?`Small 320`:e<=375?`Medium`:e<=480?`Medium 640`:`Large`,t}},vS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe`,this._el.content),this.media_id=this.data.url;let e=aS(this.media_id);if(!e){this.loadErrorDisplay(`Invalid URL.`);return}let t=document.createElement(`iframe`);t.className=`doc`,t.setAttribute(`frameborder`,`0`),t.setAttribute(`width`,`100%`),t.setAttribute(`height`,`100%`),this.media_id.match(/docs.google.com/i)?t.setAttribute(`src`,e+`&embedded=true`):t.setAttribute(`src`,`http://docs.google.com/viewer?url=`+encodeURIComponent(e)+`&embedded=true`),this._el.content_item.appendChild(t),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},yS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe`,this._el.content),this.media_id=this.data.url;let e=oS(this.media_id);if(!e){this.loadErrorDisplay(`Invalid embed code. Paste an iframe embed code with an http(s) source URL.`);return}this._el.content_item.appendChild(e),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},bS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe`,this._el.content),this.media_id=this.data.url;let e=aS(this.media_id);if(!e){this.loadErrorDisplay(`Invalid URL.`);return}let t=document.createElement(`iframe`);t.setAttribute(`src`,e),this._el.content_item.appendChild(t),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},xS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-facebook`,this._el.content);let e=this.data.url,t=encodeURIComponent(e),n=/\/videos?\//.test(e)||/\/watch/.test(e)||/\/reel\//.test(e)?`https://www.facebook.com/plugins/video.php?href=${t}&show_text=true`:`https://www.facebook.com/plugins/post.php?href=${t}&show_text=true`;this._el.content_item.innerHTML=`<iframe src="${n}" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>`,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},SS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-documentcloud`,this._el.content);let e=aS(this.data.url);if(!e){this.loadErrorDisplay(`Invalid URL.`);return}let t=document.createElement(`iframe`);t.setAttribute(`src`,e),this._el.content_item.appendChild(t),this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}},CS=class extends Qx{_loadMedia(){this.message.updateMessage(j.messages.loading+` `+this.options.media_name),this._el.content_item=M.create(`div`,`vco-media-item vco-media-iframe vco-media-juxtapose`,this._el.content),this._el.content_item.innerHTML=`<iframe src="${this.data.url}" />`,this.onLoaded()}_updateMediaDisplay(){this._el.content_item.style.height=this.options.height+`px`}};function wS(e){let t=[{type:`youtube`,name:`YouTube`,match_str:`(www.)?youtube|youtu.be`,cls:eS},{type:`vimeo`,name:`Vimeo`,match_str:`(player.)?vimeo.com`,cls:fS},{type:`dailymotion`,name:`DailyMotion`,match_str:`(www.)?dailymotion.com`,cls:hS},{type:`soundcloud`,name:`SoundCloud`,match_str:`(player.)?soundcloud.com`,cls:dS},{type:`twitter`,name:`Twitter`,match_str:`^(https?:)?/+(www.)?(twitter|x).com`,cls:gS},{type:`flickr`,name:`Flickr`,match_str:`flickr.com/photos`,cls:_S},{type:`image`,name:`Image`,match_str:/jpg|jpeg|png|gif|webp/i,cls:$x},{type:`video`,name:`Video`,match_str:/(mp4|webm)(\?.*)?$/i,cls:pS},{type:`audio`,name:`Audio`,match_str:/(mp3|wav|m4a)(\?.*)?$/i,cls:mS},{type:`googledocs`,name:`Google Doc`,match_str:`^(https?:)?/*[^.]*.google.com/[^/]*/d/[^/]*/[^/]*?usp=sharing|^(https?:)?/*drive.google.com/open?id=[^&]*&authuser=0|^(https?:)?//*drive.google.com/open\\?id=[^&]*|^(https?:)?/*[^.]*.googledrive.com/host/[^/]*/`,cls:vS},{type:`wikipedia`,name:`Wikipedia`,match_str:`(www.)?wikipedia.org`,cls:uS},{type:`iframe`,name:`iFrame`,match_str:`iframe`,cls:yS},{type:`facebook`,name:`Facebook`,match_str:`(www.)?facebook.com`,cls:xS},{type:`documentcloud`,name:`DocumentCloud`,match_str:`documentcloud.org/documents/`,cls:SS},{type:`juxtapose`,name:`Juxtapose`,match_str:`juxtapose`,cls:CS},{type:`blockquote`,name:`Quote`,match_str:`blockquote`,cls:lS},{type:`website`,name:`Website`,match_str:`https?://`,cls:bS},{type:``,name:``,match_str:``,cls:Qx}];for(let n of t)if(typeof e.url==`string`&&e.url.match(n.match_str))return n;return!1}var TS=class{constructor(e,t,n){this._el={container:{},content_container:{},content:{},headline:{},date:{},start_btn:{}},this.data={uniqueid:``,headline:`headline`,text:`text`},this.options={title:!1},d(this,e),f(this.options,t),this._el.container=M.create(`div`,`vco-text`),this._el.container.id=this.data.uniqueid,this._initLayout(),n&&n.appendChild(this._el.container)}show(){}hide(){}addTo(e){e.appendChild(this._el.container)}removeFrom(e){e.removeChild(this._el.container)}headlineHeight(){return this._el.headline.offsetHeight+40}addDateText(e){this._el.date&&(this._el.date.innerHTML=e)}onLoaded(){this.fire(`loaded`,this.data)}onAdd(){this.fire(`added`,this.data)}onRemove(){this.fire(`removed`,this.data)}_initLayout(){this._el.content_container=M.create(`div`,`vco-text-content-container`,this._el.container);let e=this.data.text_align??this.options.text_align??`left`;if((e===`center`||e===`right`)&&this._el.content_container.classList.add(`vco-text-align-`+e),this.data.date&&this.data.date.created_time&&this.data.date.created_time!==``&&(this._el.date=M.create(`h3`,`vco-headline-date`,this._el.content_container),this.addDateText(u(this.data.date.created_time))),this.data.headline!==``){let e=`vco-headline`;this.options.title&&(e=`vco-headline vco-headline-title`),this._el.headline=M.create(`h2`,e,this._el.content_container),this._el.headline.innerHTML=this.data.headline}if(this.data.text!==``){let e=``;e+=b(this.data.text),this.data.date&&this.data.date.created_time&&this.data.date.created_time!==``&&this.data.date.created_time.length>10&&(e+=`<div class='vco-text-date'>`+u(this.data.date.created_time)+`</div>`),this._el.content=M.create(`div`,`vco-text-content`,this._el.content_container),this._el.content.innerHTML=e}this.onLoaded()}},ES=class extends Ze(TS){constructor(...e){super(...e)}},DS=class{constructor(e,t,n){this._el={container:{},scroll_container:{},background:{},content_container:{},content:{},call_to_action:null},this._media=null,this._mediaclass={},this._text={},this._state={loaded:!1},this.has={headline:!1,text:!1,media:!1,title:!1,background:{image:!1,color:!1,color_value:``}},this.has.title=n,this.title=``,this.data={uniqueid:null,background:null,date:null,location:null,text:null,media:null},this.options={duration:1e3,slide_padding_lr:40,ease:Xe,width:600,height:600,skinny_size:650,media_name:``},this.active=!1,this.animator={},f(this.options,t),f(this.data,e),this._initLayout()}show(){}hide(){}setActive(e){this.active=e,this.active?(this.data.background&&this.fire(`background_change`,this.has.background),this.loadMedia()):this.stopMedia()}updateDisplay(e,t,n){this._updateDisplay(e,t,n)}loadMedia(){this._media&&!this._state.loaded&&(this._media.loadMedia(),this._state.loaded=!0)}stopMedia(){if(this._media&&this._state.loaded){try{this._media.stopMedia()}catch(e){if(e.message===`this._el.content_item.querySelector is not a function`)console.log(`Ignoring error in editor context: `+e.message);else throw e}this._media._state?.loaded||(this._state.loaded=!1)}}getBackground(){return this.has.background}scrollToTop(){this._el.container.scrollTop=0}addCallToAction(e){this._el.call_to_action=M.create(`div`,`vco-slide-calltoaction`,this._el.content_container),this._el.call_to_action.innerHTML=`<span class='vco-slide-calltoaction-button-text'>`+e+`</span>`,Ux.addListener(this._el.call_to_action,`click`,this._onCallToAction,this)}_onCallToAction(e){this.fire(`call_to_action`,e)}_initLayout(){if(this._el.container=M.create(`div`,`vco-slide`),this.data.uniqueid&&(this._el.container.id=this.data.uniqueid),this._el.scroll_container=M.create(`div`,`vco-slide-scrollable-container`,this._el.container),this._el.content_container=M.create(`div`,`vco-slide-content-container`,this._el.scroll_container),this._el.content=M.create(`div`,`vco-slide-content`,this._el.content_container),this._el.background=M.create(`div`,`vco-slide-background`,this._el.container),this.data.background){let e=this.data.background;e.url&&(this.has.background.image=!0,this._el.container.className+=` vco-full-image-background`,this.has.background.color_value=`#000`,this._el.background.style.backgroundImage=`url('`+e.url+`')`,this._el.background.style.display=`block`),e.color&&(this.has.background.color=!0,this._el.container.className+=` vco-full-color-background`,this.has.background.color_value=e.color),e.text_background&&(this._el.container.className+=` vco-text-background`)}this.data.media&&this.data.media.url&&this.data.media.url!==``&&(this.has.media=!0),this.data.text&&this.data.text.text&&(this.has.text=!0),this.data.text&&this.data.text.headline&&(this.has.headline=!0,this.title=this.data.text.headline),this.has.media&&(this.data.media.mediatype=wS(this.data.media),this.options.media_name=this.data.media.mediatype.name,this.options.media_type=this.data.media.mediatype.type,this._media=new this.data.media.mediatype.cls(this.data.media,this.options)),(this.has.text||this.has.headline)&&(this._text=new ES(this.data.text,{title:this.has.title,text_align:this.options.text_align})),!this.has.text&&!this.has.headline&&this.has.media?(this._el.container.className+=` vco-slide-media-only`,this._media.addTo(this._el.content)):this.has.headline&&this.has.media&&!this.has.text?(this._el.container.className+=` vco-slide-media-only`,this._text.addTo(this._el.content),this._media.addTo(this._el.content)):this.has.text&&this.has.media?(this._media.addTo(this._el.content),this._text.addTo(this._el.content)):(this.has.text||this.has.headline)&&(this._el.container.className+=` vco-slide-text-only`,this._text.addTo(this._el.content)),this.onLoaded()}_updateDisplay(e,t,n){let r,i,a;e?this.options.width=e:this.options.width=this._el.container.offsetWidth,Px.mobile&&this.options.width<=this.options.skinny_size?(r=`0px`,i=`0px`,a=this.options.width-0+`px`):n===`landscape`?(r=`40px`,i=`75px`,a=this.options.width-115+`px`):(this.options.width,this.options.skinny_size,r=this.options.slide_padding_lr+`px`,i=this.options.slide_padding_lr+`px`,a=this.options.width-this.options.slide_padding_lr*2+`px`),this._el.content.style.paddingLeft=r,this._el.content.style.paddingRight=i,this._el.content.style.width=a,this._el.call_to_action&&(this._el.call_to_action.style.paddingLeft=r,this._el.call_to_action.style.paddingRight=i,this._el.call_to_action.style.width=a),t?this.options.height=t:this.options.height=this._el.container.offsetHeight,this._media&&(!this.has.text&&this.has.headline?this._media.updateDisplay(this.options.width,this.options.height-this._text.headlineHeight(),n):this._media.updateDisplay(this.options.width,this.options.height,n))}},OS=class extends Qe(Ze(DS)){constructor(...e){super(...e)}},kS=class{constructor(e,t,n){this.mousedrag={down:`mousedown`,up:`mouseup`,leave:`mouseleave`,move:`mousemove`},this.touchdrag={down:`touchstart`,up:`touchend`,leave:`mouseleave`,move:`touchmove`},this._el={drag:e,move:e},t&&(this._el.move=t),this.options={snap:!1,enable:{x:!0,y:!0},constraint:{top:!1,bottom:!1,left:0,right:!1},momentum_multiplier:2e3,duration:1e3,ease:Je},this.animator=null,this.dragevent=this.mousedrag,Px.touch&&(this.dragevent=this.touchdrag),this.data={sliding:!1,direction:`none`,pagex:{start:0,end:0},pagey:{start:0,end:0},pos:{start:{x:0,y:0},end:{x:0,y:0}},new_pos:{x:0,y:0},new_pos_parent:{x:0,y:0},time:{start:0,end:0},touch:!1},f(this.options,n)}enable(e){Ux.addListener(this._el.drag,this.dragevent.down,this._onDragStart,this),Ux.addListener(this._el.drag,this.dragevent.up,this._onDragEnd,this),this.data.pos.start=0,this._el.move.style.left=this.data.pos.start.x+`px`,this._el.move.style.top=this.data.pos.start.y+`px`,this._el.move.style.position=`absolute`}disable(){Ux.removeListener(this._el.drag,this.dragevent.down,this._onDragStart,this),Ux.removeListener(this._el.drag,this.dragevent.up,this._onDragEnd,this)}stopMomentum(){this.animator&&this.animator.stop()}updateConstraint(e){this.options.constraint=e}_onDragStart(e){this.animator&&this.animator.stop(),Px.touch?e.originalEvent?(this.data.pagex.start=e.originalEvent.touches[0].screenX,this.data.pagey.start=e.originalEvent.touches[0].screenY):(this.data.pagex.start=e.targetTouches[0].screenX,this.data.pagey.start=e.targetTouches[0].screenY):(this.data.pagex.start=e.pageX,this.data.pagey.start=e.pageY),this.options.enable.x,this.options.enable.y,this.data.pos.start={x:this._el.move.offsetLeft,y:this._el.move.offsetTop},this.data.time.start=Date.now(),this.fire(`dragstart`,this.data),Ux.addListener(this._el.drag,this.dragevent.move,this._onDragMove,this),Ux.addListener(this._el.drag,this.dragevent.leave,this._onDragEnd,this)}_onDragEnd(e){this.data.sliding=!1,Ux.removeListener(this._el.drag,this.dragevent.move,this._onDragMove,this),Ux.removeListener(this._el.drag,this.dragevent.leave,this._onDragEnd,this),this.fire(`dragend`,this.data),this._momentum()}_onDragMove(e){let t={x:0,y:0};this.data.sliding=!0,Px.touch?e.originalEvent?(this.data.pagex.end=e.originalEvent.touches[0].screenX,this.data.pagey.end=e.originalEvent.touches[0].screenY):(this.data.pagex.end=e.targetTouches[0].screenX,this.data.pagey.end=e.targetTouches[0].screenY):(this.data.pagex.end=e.pageX,this.data.pagey.end=e.pageY),t.x=this.data.pagex.start-this.data.pagex.end,t.y=this.data.pagey.start-this.data.pagey.end,this.data.pos.end={x:this._el.drag.offsetLeft,y:this._el.drag.offsetTop},this.data.new_pos.x=-(t.x-this.data.pos.start.x),this.data.new_pos.y=-(t.y-this.data.pos.start.y),this.options.enable.x&&Math.abs(t.x)>Math.abs(t.y)&&(e.preventDefault(),this._el.move.style.left=this.data.new_pos.x+`px`),this.options.enable.y&&Math.abs(t.y)>Math.abs(t.x)&&(e.preventDefault(),this._el.move.style.top=this.data.new_pos.y+`px`),this.fire(`dragmove`,this.data)}_momentum(){let e={x:0,y:0,time:0},t={x:0,y:0,time:0},n={x:!1,y:!1},r=!1;this.data.direction=null,e.time=(Date.now()-this.data.time.start)*10,t.time=(Date.now()-this.data.time.start)*10,t.x=this.options.momentum_multiplier*(Math.abs(this.data.pagex.end)-Math.abs(this.data.pagex.start)),t.y=this.options.momentum_multiplier*(Math.abs(this.data.pagey.end)-Math.abs(this.data.pagey.start)),e.x=Math.round(t.x/t.time),e.y=Math.round(t.y/t.time),this.data.new_pos.x=this.data.pos.end.x+e.x,this.data.new_pos.y=this.data.pos.end.y+e.y,this.options.enable.x?this.data.new_pos.x>0&&(this.data.new_pos.x=0):this.data.new_pos.x=this.data.pos.start.x,this.options.enable.y?this.data.new_pos.y<0&&(this.data.new_pos.y=0):this.data.new_pos.y=this.data.pos.start.y,t.time<2e3&&(r=!0),this.options.enable.x&&this.options.enable.y?Math.abs(t.x)>Math.abs(t.y)?n.x=!0:n.y=!0:this.options.enable.x?Math.abs(t.x)>Math.abs(t.y)&&(n.x=!0):Math.abs(t.y)>Math.abs(t.x)&&(n.y=!0),n.x&&(Math.abs(t.x)>this._el.drag.offsetWidth/2&&(r=!0),Math.abs(t.x)>1e4&&(this.data.direction=`left`,t.x>0&&(this.data.direction=`right`))),n.y&&(Math.abs(t.y)>this._el.drag.offsetHeight/2&&(r=!0),Math.abs(t.y)>1e4&&(this.data.direction=`up`,t.y>0&&(this.data.direction=`down`))),this._animateMomentum(),r&&this.data.direction?this.fire(`swipe_`+this.data.direction,this.data):this.data.direction?this.fire(`swipe_nodirection`,this.data):this.options.snap&&(this.animator.stop(),this.animator=(0,Kx.default)(this._el.move,{top:this.data.pos.start.y,left:this.data.pos.start.x,duration:this.options.duration,easing:Ye}))}_animateMomentum(){let e={x:this.data.new_pos.x,y:this.data.new_pos.y},t={duration:this.options.duration,easing:Ye};this.options.enable.y&&((this.options.constraint.top||this.options.constraint.bottom)&&(e.y>this.options.constraint.bottom?e.y=this.options.constraint.bottom:e.y<this.options.constraint.top&&(e.y=this.options.constraint.top)),t.top=Math.floor(e.y)+`px`),this.options.enable.x&&((this.options.constraint.left||this.options.constraint.right)&&(e.x>=this.options.constraint.left?e.x=this.options.constraint.left:e.x<this.options.constraint.right&&(e.x=this.options.constraint.right)),t.left=Math.floor(e.x)+`px`),this.animator=(0,Kx.default)(this._el.move,t),this.fire(`momentum`,this.data)}},AS=class extends Ze(kS){constructor(...e){super(...e)}},jS=class{constructor(e,t,n,r){this._el={container:{},background:{},slider_container_mask:{},slider_container:{},slider_item_container:{}},this._nav={previous:{},next:{}},this.slide_spacing=0,this._slides=[],this.current_slide=0,this.current_bg_color=null,this.data={},this.options={id:``,layout:`portrait`,width:600,height:600,default_bg_color:{r:256,g:256,b:256},slide_padding_lr:40,start_at_slide:1,slide_default_fade:`0%`,duration:1e3,ease:Je,dragging:!0,trackResize:!0},typeof e==`object`?(this._el.container=e,this.options.id=v(6,`vco`)):(this.options.id=e,this._el.container=M.get(e)),this._el.container.id||(this._el.container.id=this.options.id),this.animator=null,this.animator_background=null,f(this.options,n),f(this.data,t),r&&this.init()}init(){this._initLayout(),this._initEvents(),this._initData(),this._updateDisplay(),this.goTo(this.options.start_at_slide),this._onLoaded(),this._introInterface()}updateDisplay(e,t,n,r){this._updateDisplay(e,t,n,r)}createSlide(e){this._createSlide(e)}createSlides(e){this._createSlides(e)}_createSlides(e){for(let t=0;t<e.length;t++)e[t].uniqueid===``&&(e[t].uniqueid=v(6,`vco-slide`)),t===0?this._createSlide(e[t],!0):this._createSlide(e[t],!1)}_createSlide(e,t){let n=new OS(e,this.options,t);this._addSlide(n),this._slides.push(n)}_addSlide(e){e.addTo(this._el.slider_item_container),e.on(`added`,this._onSlideAdded,this),e.on(`background_change`,this._onBackgroundChange,this)}goToId(e,t,n){let r;r=typeof e==`string`||e instanceof String?_(String(e),this._slides,`uniqueid`):e,this.goTo(r,t,n)}goTo(e,t,n){this.changeBackground({color_value:``,image:!1}),this.preloadTimer&&(clearTimeout(this.preloadTimer),window.cancelIdleCallback?.(this.preloadTimer));for(let e=0;e<this._slides.length;e++)this._slides[e].setActive(!1);if(e<this._slides.length&&e>=0){let r=this.current_slide;this.current_slide=e;let i=Math.abs(e-r),a=Math.max(600,Math.min(1e3+i*120,2e3));this.animator&&this.animator.stop(),this._swipable&&this._swipable.stopMomentum(),t?(this._el.slider_container.style.left=-(this.slide_spacing*e)+`px`,this._onSlideChange(n)):(this._onSlideChange(n),this.animator=(0,Kx.default)(this._el.slider_container,{left:-(this.slide_spacing*e)+`px`,duration:a,easing:this.options.ease})),this._slides.length>0&&this._slides[this.current_slide].setActive(!0),this._slides[this.current_slide+1]&&(this._slides[this.current_slide+1].loadMedia(),this._slides[this.current_slide+1].scrollToTop()),this._slides[this.current_slide+1]?(this.showNav(this._nav.next,!0),this._nav.next.update(this.getNavInfo(this._slides[this.current_slide+1]))):this.showNav(this._nav.next,!1),this._slides[this.current_slide-1]?(this.showNav(this._nav.previous,!0),this._nav.previous.update(this.getNavInfo(this._slides[this.current_slide-1]))):this.showNav(this._nav.previous,!1);let o=window;this.preloadTimer=o.requestIdleCallback?o.requestIdleCallback(()=>this.preloadSlides(),{timeout:this.options.duration}):setTimeout(()=>{this.preloadSlides()},this.options.duration)}}preloadSlides(){this._slides[this.current_slide+1]&&(this._slides[this.current_slide+1].loadMedia(),this._slides[this.current_slide+1].scrollToTop()),this._slides[this.current_slide+2]&&(this._slides[this.current_slide+2].loadMedia(),this._slides[this.current_slide+2].scrollToTop()),this._slides[this.current_slide-1]&&(this._slides[this.current_slide-1].loadMedia(),this._slides[this.current_slide-1].scrollToTop()),this._slides[this.current_slide-2]&&(this._slides[this.current_slide-2].loadMedia(),this._slides[this.current_slide-2].scrollToTop())}getNavInfo(e){let t={title:``,description:``};return e.data.text&&e.data.text.headline&&(t.title=e.data.text.headline),t}next(){this.current_slide+1<this._slides.length?this.goTo(this.current_slide+1):this.goTo(this.current_slide)}previous(){this.current_slide-1>=0?this.goTo(this.current_slide-1):this.goTo(this.current_slide)}showNav(e,t){this.options.width<=500&&Px.mobile||(t?e.show():e.hide())}changeBackground(e){let t=!1,n,r=this.options.slide_default_fade,i=``;this._el.background.getAttribute(`style`),n=e.color_value?y(e.color_value):this.options.default_bg_color,this.animator_background&&this.animator_background.stop();let a=n.r+`,`+n.g+`,`+n.b;(!this.current_bg_color||this.current_bg_color!==a)&&(this.current_bg_color=a,t=!0),t&&(this.options.layout===`landscape`?(this._nav.next.setColor(!1),this._nav.previous.setColor(!1),n.r<255&&n.g<255&&n.b<255&&(r=`15%`),e.image&&(r=`0%`),i+=`opacity:0;`,i+=`background-image: linear-gradient(to right, rgba(`+a+`,0.0001 ) `+r+`, rgba(`+a+`,0.87) 15%);`,i+=`background-repeat: repeat-x;`,i+=`filter: e(%('progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)',argb(`+a+`, 0.0001),argb(`+a+`,0.80)));`):(e.color_value?i+=`background-color:`+e.color_value+`;`:i+=`background-color:#FFF;`,n.r<255&&n.g<255&&n.b<255||e.image?(this._nav.next.setColor(!0),this._nav.previous.setColor(!0)):(this._nav.next.setColor(!1),this._nav.previous.setColor(!1))),this.animator_background=(0,Kx.default)(this._el.background,{opacity:0,duration:this.options.duration/2,easing:this.options.ease,complete:()=>{this.fadeInBackground(i)}}))}fadeInBackground(e){this.animator_background&&this.animator_background.stop(),e&&this._el.background.setAttribute(`style`,e),this.animator_background=(0,Kx.default)(this._el.background,{opacity:1,duration:this.options.duration/2,easing:this.options.ease})}_updateDisplay(e,t,n,r){let i;i=r===void 0?this.options.layout:r,this.options.layout=i,this.slide_spacing=this.options.width*2,e?this.options.width=e:this.options.width=this._el.container.offsetWidth,t?this.options.height=t:this.options.height=this._el.container.offsetHeight;let a=this.options.height/2;this._nav.next.setPosition({top:a}),this._nav.previous.setPosition({top:a});for(let e=0;e<this._slides.length;e++)this._slides[e].updateDisplay(this.options.width,this.options.height,i),this._slides[e].setPosition({left:this.slide_spacing*e,top:0});this.goTo(this.current_slide,!0,!0)}_introInterface(){if(this.options.call_to_action){let e=j.messages.start;this.options.call_to_action_text!==``&&(e=this.options.call_to_action_text),this._slides[0].addCallToAction(e),this._slides[0].on(`call_to_action`,this.next,this)}this.options.width<=this.options.skinny_size||(this._nav.next.updatePosition({right:`130`},!1,this.options.duration*3,this.options.ease,-100,!0),this._nav.previous.updatePosition({left:`-100`},!0,this.options.duration*3,this.options.ease,-200,!0))}_initLayout(){this._el.container.className+=` vco-storyslider`,this._el.slider_container_mask=M.create(`div`,`vco-slider-container-mask`,this._el.container),this._el.background=M.create(`div`,`vco-slider-background`,this._el.container),this._el.slider_container=M.create(`div`,`vco-slider-container`,this._el.slider_container_mask),this._el.slider_item_container=M.create(`div`,`vco-slider-item-container`,this._el.slider_container),this.options.width=this._el.container.offsetWidth,this.options.height=this._el.container.offsetHeight,this._nav.previous=new Jx({title:`Previous`,description:`description`},{direction:`previous`}),this._nav.next=new Jx({title:`Next`,description:`description`},{direction:`next`}),this._nav.next.addTo(this._el.container),this._nav.previous.addTo(this._el.container),this._el.slider_container.style.left=`0px`,Px.touch&&(this._swipable=new AS(this._el.slider_container_mask,this._el.slider_container,{enable:{x:!0,y:!1},snap:!0}),this._swipable.enable(),this._message=new Xx({},{message_class:`vco-message-full`,message_icon_class:`vco-icon-swipe-left`}),this._message.updateMessage(j.buttons.swipe_to_navigate),this._message.addTo(this._el.container))}_initEvents(){this._nav.next.on(`clicked`,this._onNavigation,this),this._nav.previous.on(`clicked`,this._onNavigation,this),this._message&&this._message.on(`clicked`,this._onMessageClick,this),this._swipable&&(this._swipable.on(`swipe_left`,this._onNavigation,this),this._swipable.on(`swipe_right`,this._onNavigation,this),this._swipable.on(`swipe_nodirection`,this._onSwipeNoDirection,this)),this._el.container.setAttribute(`tabindex`,`0`),Ux.addListener(this._el.container,`keydown`,this._onKeyDown,this)}_onKeyDown(e){let t=e.key,n=e.target,r=n?.tagName?.toLowerCase();r===`input`||r===`textarea`||r===`select`||n?.isContentEditable||(t===`ArrowRight`||t===`ArrowDown`?(Ux.preventDefault(e),this.next()):(t===`ArrowLeft`||t===`ArrowUp`)&&(Ux.preventDefault(e),this.previous()))}_initData(){this._createSlides(this.data.slides)}_onBackgroundChange(e){let t=this._slides[this.current_slide].getBackground();this.changeBackground(e),this.fire(`colorchange`,t)}_onMessageClick(e){this._message.hide()}_onSwipeNoDirection(e){this.goTo(this.current_slide)}_onNavigation(e){e.direction===`next`||e.direction===`left`?this.next():(e.direction===`previous`||e.direction===`right`)&&this.previous(),this.fire(`nav_`+e.direction,this.data)}_onSlideAdded(e){this.fire(`slideAdded`,this.data)}_onSlideChange(e){e||this.fire(`change`,{current_slide:this.current_slide,uniqueid:this._slides[this.current_slide].data.uniqueid})}_onLoaded(){this.fire(`loaded`,this.data),this._slides.length>0&&this.fire(`title`,{title:this._slides[0].title})}},MS=class extends Ze(jS){constructor(...e){super(...e)}},NS=class{constructor(e,t,n,r){for(let e in r){let t=r[e];if(typeof t==`function`)this.on(e,t);else for(let n in t)typeof t[n]==`function`?this.on(e,t[n]):console.log(`WARNING: Ignoring invalid callback '`+t[n]+`' defined for listener '`+e+`' in StoryMap constructor`)}return this.version=`0.1.16`,this.ready=!1,this._el={container:{},storyslider:{},map:{},menubar:{}},typeof e==`object`?this._el.container=e:this._el.container=M.get(e),this._storyslider={},this._map={},this.map={},this._menubar={},this._loaded={storyslider:!1,map:!1},this.data={},this.options={script_path:PS.SCRIPT_PATH,height:this._el.container.offsetHeight,width:this._el.container.offsetWidth,layout:`landscape`,base_class:``,default_bg_color:{r:255,g:255,b:255},map_size_sticky:2.5,map_center_offset:null,less_bounce:!1,start_at_slide:0,call_to_action:!1,call_to_action_text:``,menubar_height:0,fullscreen:!0,show_overview:!0,show_back_to_start:!0,skinny_size:650,duration:1e3,ease:Je,dragging:!0,trackResize:!0,nocache:!1,autoplay:0,show_progress:!1,marker_labels:!1,text_align:`left`,map_overview_center:null,map_type:``,attribution:``,map_mini:!0,map_subdomains:``,map_as_image:!1,map_access_token:``,map_background_color:`#d9d9d9`,map_bbox:null,consent_required:!1,zoomify:void 0,text_color:``,text_background_color:``,show_distance:!1,use_custom_markers:!1,iiif:{url:``,attribution:``},map_height:300,storyslider_height:600,slide_padding_lr:45,slide_default_fade:`0%`,menubar_default_y:0,path_gfx:`gfx`,map_popup:!1,zoom_distance:100,calculate_zoom:!0,line_follows_path:!0,line_color:`#c34528`,line_color_inactive:`#CCC`,line_join:`miter`,line_weight:3,line_opacity:.8,line_dash:`5,5`,show_lines:!0,show_history_line:!0,api_key_flickr:``,font_css:`stock:default`,language:`en`},this.animator_map=null,this.animator_storyslider=null,this._resize_observer=null,this._resize_timer=null,this._autoplay_timer=null,this._autoplay_stopped=!1,this._hash_initialized=!1,f(this.options,n),this.current_slide=this.options.start_at_slide,this._initData(t),this}_initData(e){if(this._data_from_manifest=!1,typeof e==`string`){let t=this.options.nocache===!0?e+(e.includes(`?`)?`&`:`?`)+`_=`+Date.now():e;this._loadDataFromUrl(t,e)}else if(typeof e==`object`){if(me(e))this._data_from_manifest=!0,this.data=Se(e);else{let t=e;re(t),t.storymap?this.data=t.storymap:console.error(`StoryMapJS: data must have a storymap property`)}this._initOptions()}else console.error(`StoryMapJS: data has unknown type`),this._initOptions()}async _loadDataFromUrl(e,t){try{let n=await fetch(e);if(!n.ok)throw Error(`HTTP `+n.status+` `+n.statusText);let r=await n.json();if(me(r))this._data_from_manifest=!0,this.data=Se(r);else{re(r,t);let e=r;if(!e.storymap)throw Error(`StoryMapJS: data must have a storymap property`);this.data=e.storymap}this._initOptions()}catch(e){console.error(`StoryMapJS: could not load storymap data from `+t,e),this.fire(`error`,{message:String(e),source:t})}}_initOptions(){if(p(this.options,this.data),this._data_from_manifest&&delete this.options.zoomify,this.options.layout===`landscape`&&(this.options.map_center_offset={left:-200,top:0}),this.options.map_type===`iiif`&&this.options.map_as_image&&(this.options.map_size_sticky=2),this.options.map_type===`zoomify`&&(this.options.map_size_sticky=2),this.options.map_as_image&&(this.options.calculate_zoom=!1),this.options.map_type===`zoomify`){console.warn(`StoryMapJS: map_type 'zoomify' is a legacy image-pyramid basemap; consider map_type 'iiif' with options.iiif.url instead.`);let e=this.options.zoomify;(typeof e!=`object`||!e.path)&&console.error(`StoryMapJS: map_type 'zoomify' needs a zoomify image pyramid (path, width, height) in the storymap data.`)}if(this.options.map_type.startsWith(`stamen`)){let e=this.options.map_type;e===`stamen:watercolor`?this.options.map_type=`ch-watercolor`:this.options.map_type=`osm:standard`,console.log(`Deprecated map_type ${e}; using ${this.options.map_type}`)}this._loadLanguage()}_loadLanguage(){je(this.options.language),this.options.language=j,this._onDataLoaded()}async _loadFontCss(){let e=this.options.font_css||`stock:default`,t=e;if(t.startsWith(`stock:`)){let e=t.split(`:`)[1]||`default`;t=new URL(`../css/fonts/font.`+e+`.css`,import.meta.url).href}else/^(http|https|\/\/)/.test(t)||(t=C(this.options.script_path,t));let n=Fe(this.options);if(/^(http|https|\/\/)/.test(e)&&this.options.consent_required&&n){let e=new URL(t.startsWith(`//`)?`https:`+t:t).host,r=this._el.map??this._el.container;if(!await n.request(Ie(`consent_service_fonts`,`web fonts`),e,r))return}if(t)try{await D(t)}catch{}finally{this._onFontLoaded(t)}}_onFontLoaded(e){this.fire(`fontLoaded`,{font:e})}goTo(e){e>=0&&e<(this.data?.slides?.length??0)&&e!==this.current_slide&&(this.current_slide=e,this._storyslider.goTo(this.current_slide),this._map.goTo(this.current_slide),this._syncHash(),this._scheduleAutoplay(),this._updateProgress())}updateDisplay(){this.ready&&this._updateDisplay()}setMapOption(e,t){this.setMapOptions({[e]:t})}setMapOptions(e){if(f(this.options,e),this._map&&this._map.options)f(this._map.options,e),this._map.applyOptions(Object.keys(e));else for(let t of Object.keys(e))this.options[t]=e[t];this.ready&&(this.options.text_color&&this._el.container.style.setProperty(`--vco-color-text`,this.options.text_color),this.options.text_background_color&&this._el.container.style.setProperty(`--vco-color-text-background`,this.options.text_background_color),this.updateDisplay())}_initLayout(){this._el.container.className+=` vco-storymap`,this.options.base_class=this._el.container.className,this.options.text_color&&this._el.container.style.setProperty(`--vco-color-text`,this.options.text_color),this.options.text_background_color&&this._el.container.style.setProperty(`--vco-color-text-background`,this.options.text_background_color),this._el.menubar=M.create(`div`,`vco-menubar`,this._el.container),this._el.map=this._resolveMapElement(),this._el.map||(this._el.map=M.create(`div`,`vco-map`,this._el.container)),this._el.storyslider=M.create(`div`,`vco-storyslider`,this._el.container),this.options.width=this._el.container.offsetWidth,this.options.height=this._el.container.offsetHeight,this._el.map.style.height=`1px`,this._el.storyslider.style.top=`1px`,this._map=new Hx(this._el.map,this.data,this.options),this.map=this._map._map,this._map.on(`loaded`,this._onMapLoaded,this),this._el.map.style.backgroundColor=this.options.map_background_color,this._menubar=new Gx(this._el.menubar,this._el.container,this.options),this._storyslider=new MS(this._el.storyslider,this.data,this.options),this._storyslider.on(`loaded`,this._onStorySliderLoaded,this),this._storyslider.on(`title`,this._onTitle,this),this._storyslider.init(),this.options.layout===`portrait`?(this.options.map_height=this.options.height/this.options.map_size_sticky,this.options.storyslider_height=this.options.height-this._el.menubar.offsetHeight-this.options.map_height-1,this._menubar.setSticky(0)):(this.options.menubar_height=this._el.menubar.offsetHeight,this.options.map_height=this.options.height,this.options.storyslider_height=this.options.height-this._el.menubar.offsetHeight-1,this._menubar.setSticky(this.options.menubar_height)),this._updateDisplay(this.options.map_height,!0,2e3),this._menubar.show(2e3)}_initEvents(){this._menubar.on(`collapse`,this._onMenuBarCollapse,this),this._menubar.on(`back_to_start`,this._onBackToStart,this),this._menubar.on(`overview`,this._onOverview,this),this._menubar.on(`fullscreen`,this._onFullscreenToggle,this),this._storyslider.on(`change`,this._onSlideChange,this),this._storyslider.on(`colorchange`,this._onColorChange,this),this._map.on(`change`,this._onMapChange,this),document.addEventListener(`fullscreenchange`,this._onFullscreenChange.bind(this))}_updateDisplay(e,t,n){let r=this.options.duration,i=this.options.base_class;n&&(r=n),this.options.width=this._el.container.offsetWidth,this.options.height=this._el.container.offsetHeight,this.options.width<=this.options.skinny_size?this.options.layout=`portrait`:this.options.layout=`landscape`,e&&(this.options.map_height=e),Px.touch&&(this.options.layout=Px.orientation(),i+=` vco-mobile`),this.options.layout===`portrait`?(i+=` vco-skinny`,this._map.setMapOffset(0,0),this.options.map_height=this.options.height/this.options.map_size_sticky,this.options.storyslider_height=this.options.height-this.options.map_height-1,this._menubar.setSticky(0),i+=` vco-layout-portrait`,t?(this.animator_map&&this.animator_map.stop(),this.animator_map=(0,Kx.default)(this._el.map,{height:this.options.map_height+`px`,duration:r,easing:Ye,complete:()=>{this._map.updateDisplay(this.options.width,this.options.map_height,t,n,this.options.menubar_height)}}),this.animator_storyslider&&this.animator_storyslider.stop(),this.animator_storyslider=(0,Kx.default)(this._el.storyslider,{height:this.options.storyslider_height+`px`,duration:r,easing:Ye})):(this._el.map.style.height=Math.ceil(this.options.map_height)+`px`,this._el.storyslider.style.height=this.options.storyslider_height+`px`),this._menubar.updateDisplay(this.options.width,this.options.height,t),this._map.updateDisplay(this.options.width,this.options.height,!1),this._storyslider.updateDisplay(this.options.width,this.options.storyslider_height,t,this.options.layout)):(i+=` vco-layout-landscape`,this.options.menubar_height=this._el.menubar.offsetHeight,this.options.map_height=this.options.height,this.options.storyslider_height=this.options.height,this._menubar.setSticky(this.options.menubar_height),this._menubar.setSticky(this.options.menubar_height),this._el.map.style.height=this.options.height+`px`,this._map.setMapOffset(-(this.options.width/4),0),this._el.storyslider.style.top=`0`,this._el.storyslider.style.height=this.options.storyslider_height+`px`,this._menubar.updateDisplay(this.options.width,this.options.height,t),this._map.updateDisplay(this.options.width,this.options.height,t,n),this._storyslider.updateDisplay(this.options.width/2,this.options.storyslider_height,t,this.options.layout)),this.options.language.direction===`rtl`&&(i+=` vco-rtl`),this._el.container.className=i}_onDataLoaded(e){this.options.consent_manager=new Pe,this.fire(`dataloaded`),this._initLayout(),this._loadFontCss().catch(e=>{console.warn(`StoryMapJS: font theme could not be loaded`,e)}),this._initEvents(),this._initResizeHandling(),this.ready=!0,this._startAutoplay()}_startAutoplay(){if(this._stopAutoplay(),this._autoplay_stopped=!1,this.options.autoplay>0){let e=()=>{this._autoplay_stopped=!0,this._stopAutoplay()};this._el.container.addEventListener(`pointerdown`,e,{once:!0}),this._el.container.addEventListener(`keydown`,e,{once:!0}),this._el.container.addEventListener(`touchstart`,e,{once:!0}),this._scheduleAutoplay()}}_scheduleAutoplay(){this._stopAutoplay(),this.options.autoplay>0&&!this._autoplay_stopped&&(this._autoplay_timer=setTimeout(()=>{this._autoplay_timer=null,this.current_slide+1<this.data.slides.length&&(this.goTo(this.current_slide+1),this._scheduleAutoplay())},this.options.autoplay))}_stopAutoplay(){this._autoplay_timer&&=(clearTimeout(this._autoplay_timer),null)}_syncHash(){try{history.replaceState(null,``,window.location.pathname+window.location.search+`#slide-`+this.current_slide)}catch{}}_applyHashSlide(){let e=/^#slide-(\d+)$/.exec(window.location.hash);if(!e)return!1;let t=parseInt(e[1],10);return t>=0&&t<this.data.slides.length&&t!==this.current_slide&&(this.goTo(t),!0)}_initResizeHandling(){if(!this.options.trackResize)return;let e=()=>{this._resize_timer?clearTimeout(this._resize_timer):this.updateDisplay(),this._resize_timer=setTimeout(()=>{this._resize_timer=null,this.updateDisplay()},200)};typeof ResizeObserver<`u`&&(this._resize_observer=new ResizeObserver(e),this._resize_observer.observe(this._el.container)),window.addEventListener(`resize`,e)}_resolveMapElement(){let e=this.options.map_options?.element;if(!e)return null;let t=typeof e==`string`?M.get(e):e;return t?(t.classList.add(`vco-map`),this._el.menubar.after(t),t):(console.error(`StoryMapJS: map_options.element not found: `+String(e)),null)}_onTitle(e){this.fire(`title`,e)}_onColorChange(e){e.color||e.image?this._menubar.setColor(!0):this._menubar.setColor(!1)}_onSlideChange(e){this.current_slide!==e.current_slide&&(this.current_slide=e.current_slide,this._map.goTo(this.current_slide),this.fire(`change`,{current_slide:this.current_slide},this),this._syncHash(),this._scheduleAutoplay(),this._updateProgress())}_onMapChange(e){this.current_slide!==e.current_marker&&(this.current_slide=e.current_marker,this._storyslider.goTo(this.current_slide),this.fire(`change`,{current_slide:this.current_slide},this),this._syncHash(),this._scheduleAutoplay(),this._updateProgress())}_updateProgress(){this.options.show_progress&&this._menubar&&this._menubar.setProgress(this.current_slide,this.data.slides.length)}_onOverview(e){this._map.markerOverview()}_onFullscreenToggle(e){document.fullscreenElement===this._el.container?document.exitFullscreen().catch(e=>{console.error(`StoryMapJS: could not exit fullscreen`,e)}):this._el.container.requestFullscreen().catch(e=>{console.error(`StoryMapJS: could not enter fullscreen`,e)})}_onFullscreenChange(){let e=document.fullscreenElement===this._el.container;this._menubar.setFullscreenState(e),requestAnimationFrame(()=>{requestAnimationFrame(()=>{this.updateDisplay()})})}_onBackToStart(e){this.current_slide=0,this._map.goTo(this.current_slide),this._storyslider.goTo(this.current_slide),this.fire(`change`,{current_slide:this.current_slide},this),this._syncHash(),this._scheduleAutoplay(),this._updateProgress()}_onMenuBarCollapse(e){this._updateDisplay(e.y,!0)}_onMapLoaded(){this._loaded.map=!0,this._onLoaded()}_onStorySliderLoaded(){this._loaded.storyslider=!0,this._onLoaded()}_updateDistance(){if(!this.options.show_distance)return;let e=this._map.getRouteDistance();this._menubar.setDistance(e)}_onLoaded(){this._loaded.storyslider&&this._loaded.map&&(this.fire(`loaded`,this.data),this._hash_initialized||(this._hash_initialized=!0,this._applyHashSlide(),window.addEventListener(`hashchange`,()=>this._applyHashSlide()),this._syncHash()),this._updateProgress(),this._updateDistance())}},PS=class extends Ze(NS){static SCRIPT_PATH=new URL(`../`,``+import.meta.url).href;constructor(...e){super(...e)}};export{PS as t};
|