diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..f10092a Binary files /dev/null and b/.DS_Store differ diff --git a/_app/immutable/chunks/paths.10d75873.js b/_app/immutable/chunks/paths.10d75873.js new file mode 100644 index 0000000..6ba14e2 --- /dev/null +++ b/_app/immutable/chunks/paths.10d75873.js @@ -0,0 +1 @@ +var s;const a=((s=globalThis.__sveltekit_8uwvay)==null?void 0:s.base)??"/key-pop-explorer";var e;const t=((e=globalThis.__sveltekit_8uwvay)==null?void 0:e.assets)??a;export{t as a,a as b}; diff --git a/_app/immutable/chunks/paths.b7f7cd27.js b/_app/immutable/chunks/paths.b7f7cd27.js deleted file mode 100644 index f2363e8..0000000 --- a/_app/immutable/chunks/paths.b7f7cd27.js +++ /dev/null @@ -1 +0,0 @@ -var s;const a=((s=globalThis.__sveltekit_1go6by7)==null?void 0:s.base)??"/key-pop-explorer";var e;const o=((e=globalThis.__sveltekit_1go6by7)==null?void 0:e.assets)??a;export{o as a,a as b}; diff --git a/_app/immutable/chunks/singletons.f77dfb29.js b/_app/immutable/chunks/singletons.edac9b68.js similarity index 95% rename from _app/immutable/chunks/singletons.f77dfb29.js rename to _app/immutable/chunks/singletons.edac9b68.js index 8199f09..6f2288c 100644 --- a/_app/immutable/chunks/singletons.f77dfb29.js +++ b/_app/immutable/chunks/singletons.edac9b68.js @@ -1 +1 @@ -import{L as d,s as k}from"./index.ba35b81f.js";import{a as w}from"./paths.b7f7cd27.js";const u=[];function p(e,t=d){let n;const o=new Set;function r(s){if(k(e,s)&&(e=s,n)){const l=!u.length;for(const i of o)i[1](),u.push(i,e);if(l){for(let i=0;i{o.delete(i),o.size===0&&n&&(n(),n=null)}}return{set:r,update:c,subscribe:a}}const E="1697470606752",y="sveltekit:snapshot",I="sveltekit:scroll",T="sveltekit:index",_={tap:1,hover:2,viewport:3,eager:4,off:-1};function x(e){let t=e.baseURI;if(!t){const n=e.getElementsByTagName("base");t=n.length?n[0].href:e.URL}return t}function L(){return{x:pageXOffset,y:pageYOffset}}function f(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const b={..._,"":_.hover};function g(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function O(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=g(e)}}function U(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const o=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!o||A(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),c=(n==null?void 0:n.origin)===location.origin&&e.hasAttribute("download");return{url:n,external:r,target:o,download:c}}function N(e){let t=null,n=null,o=null,r=null,c=null,a=null,s=e;for(;s&&s!==document.documentElement;)o===null&&(o=f(s,"preload-code")),r===null&&(r=f(s,"preload-data")),t===null&&(t=f(s,"keepfocus")),n===null&&(n=f(s,"noscroll")),c===null&&(c=f(s,"reload")),a===null&&(a=f(s,"replacestate")),s=g(s);function l(i){switch(i){case"":case"true":return!0;case"off":case"false":return!1;default:return null}}return{preload_code:b[o??"off"],preload_data:b[r??"off"],keep_focus:l(t),noscroll:l(n),reload:l(c),replace_state:l(a)}}function h(e){const t=p(e);let n=!0;function o(){n=!0,t.update(a=>a)}function r(a){n=!1,t.set(a)}function c(a){let s;return t.subscribe(l=>{(s===void 0||n&&l!==s)&&a(s=l)})}return{notify:o,set:r,subscribe:c}}function v(){const{set:e,subscribe:t}=p(!1);let n;async function o(){clearTimeout(n);try{const r=await fetch(`${w}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const a=(await r.json()).version!==E;return a&&(e(!0),clearTimeout(n)),a}catch{return!1}}return{subscribe:t,check:o}}function A(e,t){return e.origin!==location.origin||!e.pathname.startsWith(t)}let m;function P(e){m=e.client}function V(e){return(...t)=>m[e](...t)}const Y={url:h({}),page:h({}),navigating:p(null),updated:v()};export{T as I,_ as P,I as S,y as a,U as b,N as c,Y as d,P as e,O as f,x as g,V as h,A as i,L as s,p as w}; +import{L as d,s as k}from"./index.ba35b81f.js";import{a as w}from"./paths.10d75873.js";const u=[];function p(e,t=d){let n;const o=new Set;function r(s){if(k(e,s)&&(e=s,n)){const l=!u.length;for(const i of o)i[1](),u.push(i,e);if(l){for(let i=0;i{o.delete(i),o.size===0&&n&&(n(),n=null)}}return{set:r,update:c,subscribe:a}}const E="1697474090796",y="sveltekit:snapshot",I="sveltekit:scroll",T="sveltekit:index",_={tap:1,hover:2,viewport:3,eager:4,off:-1};function x(e){let t=e.baseURI;if(!t){const n=e.getElementsByTagName("base");t=n.length?n[0].href:e.URL}return t}function L(){return{x:pageXOffset,y:pageYOffset}}function f(e,t){return e.getAttribute(`data-sveltekit-${t}`)}const b={..._,"":_.hover};function g(e){let t=e.assignedSlot??e.parentNode;return(t==null?void 0:t.nodeType)===11&&(t=t.host),t}function O(e,t){for(;e&&e!==t;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=g(e)}}function U(e,t){let n;try{n=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const o=e instanceof SVGAElement?e.target.baseVal:e.target,r=!n||!!o||A(n,t)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),c=(n==null?void 0:n.origin)===location.origin&&e.hasAttribute("download");return{url:n,external:r,target:o,download:c}}function N(e){let t=null,n=null,o=null,r=null,c=null,a=null,s=e;for(;s&&s!==document.documentElement;)o===null&&(o=f(s,"preload-code")),r===null&&(r=f(s,"preload-data")),t===null&&(t=f(s,"keepfocus")),n===null&&(n=f(s,"noscroll")),c===null&&(c=f(s,"reload")),a===null&&(a=f(s,"replacestate")),s=g(s);function l(i){switch(i){case"":case"true":return!0;case"off":case"false":return!1;default:return null}}return{preload_code:b[o??"off"],preload_data:b[r??"off"],keep_focus:l(t),noscroll:l(n),reload:l(c),replace_state:l(a)}}function h(e){const t=p(e);let n=!0;function o(){n=!0,t.update(a=>a)}function r(a){n=!1,t.set(a)}function c(a){let s;return t.subscribe(l=>{(s===void 0||n&&l!==s)&&a(s=l)})}return{notify:o,set:r,subscribe:c}}function v(){const{set:e,subscribe:t}=p(!1);let n;async function o(){clearTimeout(n);try{const r=await fetch(`${w}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const a=(await r.json()).version!==E;return a&&(e(!0),clearTimeout(n)),a}catch{return!1}}return{subscribe:t,check:o}}function A(e,t){return e.origin!==location.origin||!e.pathname.startsWith(t)}let m;function P(e){m=e.client}function V(e){return(...t)=>m[e](...t)}const Y={url:h({}),page:h({}),navigating:p(null),updated:v()};export{T as I,_ as P,I as S,y as a,U as b,N as c,Y as d,P as e,O as f,x as g,V as h,A as i,L as s,p as w}; diff --git a/_app/immutable/chunks/stores.a2c33b91.js b/_app/immutable/chunks/stores.c6665ed7.js similarity index 73% rename from _app/immutable/chunks/stores.a2c33b91.js rename to _app/immutable/chunks/stores.c6665ed7.js index 5c9d90b..3f03564 100644 --- a/_app/immutable/chunks/stores.a2c33b91.js +++ b/_app/immutable/chunks/stores.c6665ed7.js @@ -1 +1 @@ -import{d as e}from"./singletons.f77dfb29.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p}; +import{d as e}from"./singletons.edac9b68.js";const r=()=>{const s=e;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},b={subscribe(s){return r().page.subscribe(s)}};export{b as p}; diff --git a/_app/immutable/entry/app.06fbfdf0.js b/_app/immutable/entry/app.269c644c.js similarity index 90% rename from _app/immutable/entry/app.06fbfdf0.js rename to _app/immutable/entry/app.269c644c.js index 1d53d01..e75f244 100644 --- a/_app/immutable/entry/app.06fbfdf0.js +++ b/_app/immutable/entry/app.269c644c.js @@ -1 +1 @@ -import{S as V,i as q,s as U,a as j,e as h,c as z,b as g,d,f as R,g as p,h as w,j as W,o as F,k as G,l as H,m as J,n as L,p as m,q as K,r as M,u as Q,v as P,t as X,w as N,x as k,y as v,z as A,A as E,B as y}from"../chunks/index.ba35b81f.js";const Y="modulepreload",Z=function(a){return"/key-pop-explorer/"+a},B={},S=function(e,n,s){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(f=>{if(f=Z(f),f in B)return;B[f]=!0;const t=f.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(!!s)for(let l=i.length-1;l>=0;l--){const _=i[l];if(_.href===f&&(!t||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${r}`))return;const o=document.createElement("link");if(o.rel=t?"stylesheet":Y,t||(o.as="script",o.crossOrigin=""),o.href=f,document.head.appendChild(o),t)return new Promise((l,_)=>{o.addEventListener("load",l),o.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=f,window.dispatchEvent(t),!t.defaultPrevented)throw f})},se={};function $(a){let e,n,s;var i=a[1][0];function f(t){return{props:{data:t[3],form:t[2]}}}return i&&(e=k(i,f(a)),a[12](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&A(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),g(t,n,r),s=!0},p(t,r){const u={};if(r&8&&(u.data=t[3]),r&4&&(u.form=t[2]),r&2&&i!==(i=t[1][0])){if(e){P();const o=e;d(o.$$.fragment,1,0,()=>{y(o,1)}),R()}i?(e=k(i,f(t)),t[12](e),v(e.$$.fragment),p(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else i&&e.$set(u)},i(t){s||(e&&p(e.$$.fragment,t),s=!0)},o(t){e&&d(e.$$.fragment,t),s=!1},d(t){a[12](null),t&&w(n),e&&y(e,t)}}}function x(a){let e,n,s;var i=a[1][0];function f(t){return{props:{data:t[3],$$slots:{default:[ee]},$$scope:{ctx:t}}}}return i&&(e=k(i,f(a)),a[11](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&A(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),g(t,n,r),s=!0},p(t,r){const u={};if(r&8&&(u.data=t[3]),r&8215&&(u.$$scope={dirty:r,ctx:t}),r&2&&i!==(i=t[1][0])){if(e){P();const o=e;d(o.$$.fragment,1,0,()=>{y(o,1)}),R()}i?(e=k(i,f(t)),t[11](e),v(e.$$.fragment),p(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else i&&e.$set(u)},i(t){s||(e&&p(e.$$.fragment,t),s=!0)},o(t){e&&d(e.$$.fragment,t),s=!1},d(t){a[11](null),t&&w(n),e&&y(e,t)}}}function ee(a){let e,n,s;var i=a[1][1];function f(t){return{props:{data:t[4],form:t[2]}}}return i&&(e=k(i,f(a)),a[10](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&A(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),g(t,n,r),s=!0},p(t,r){const u={};if(r&16&&(u.data=t[4]),r&4&&(u.form=t[2]),r&2&&i!==(i=t[1][1])){if(e){P();const o=e;d(o.$$.fragment,1,0,()=>{y(o,1)}),R()}i?(e=k(i,f(t)),t[10](e),v(e.$$.fragment),p(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else i&&e.$set(u)},i(t){s||(e&&p(e.$$.fragment,t),s=!0)},o(t){e&&d(e.$$.fragment,t),s=!1},d(t){a[10](null),t&&w(n),e&&y(e,t)}}}function C(a){let e,n=a[6]&&D(a);return{c(){e=G("div"),n&&n.c(),this.h()},l(s){e=H(s,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=J(e);n&&n.l(i),i.forEach(w),this.h()},h(){L(e,"id","svelte-announcer"),L(e,"aria-live","assertive"),L(e,"aria-atomic","true"),m(e,"position","absolute"),m(e,"left","0"),m(e,"top","0"),m(e,"clip","rect(0 0 0 0)"),m(e,"clip-path","inset(50%)"),m(e,"overflow","hidden"),m(e,"white-space","nowrap"),m(e,"width","1px"),m(e,"height","1px")},m(s,i){g(s,e,i),n&&n.m(e,null)},p(s,i){s[6]?n?n.p(s,i):(n=D(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(s){s&&w(e),n&&n.d()}}}function D(a){let e;return{c(){e=K(a[7])},l(n){e=M(n,a[7])},m(n,s){g(n,e,s)},p(n,s){s&128&&Q(e,n[7])},d(n){n&&w(e)}}}function te(a){let e,n,s,i,f;const t=[x,$],r=[];function u(l,_){return l[1][1]?0:1}e=u(a),n=r[e]=t[e](a);let o=a[5]&&C(a);return{c(){n.c(),s=j(),o&&o.c(),i=h()},l(l){n.l(l),s=z(l),o&&o.l(l),i=h()},m(l,_){r[e].m(l,_),g(l,s,_),o&&o.m(l,_),g(l,i,_),f=!0},p(l,[_]){let b=e;e=u(l),e===b?r[e].p(l,_):(P(),d(r[b],1,1,()=>{r[b]=null}),R(),n=r[e],n?n.p(l,_):(n=r[e]=t[e](l),n.c()),p(n,1),n.m(s.parentNode,s)),l[5]?o?o.p(l,_):(o=C(l),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},i(l){f||(p(n),f=!0)},o(l){d(n),f=!1},d(l){r[e].d(l),l&&w(s),o&&o.d(l),l&&w(i)}}}function ne(a,e,n){let{stores:s}=e,{page:i}=e,{constructors:f}=e,{components:t=[]}=e,{form:r}=e,{data_0:u=null}=e,{data_1:o=null}=e;W(s.page.notify);let l=!1,_=!1,b=null;F(()=>{const c=s.page.subscribe(()=>{l&&(n(6,_=!0),X().then(()=>{n(7,b=document.title||"untitled page")}))});return n(5,l=!0),c});function I(c){N[c?"unshift":"push"](()=>{t[1]=c,n(0,t)})}function O(c){N[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}function T(c){N[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}return a.$$set=c=>{"stores"in c&&n(8,s=c.stores),"page"in c&&n(9,i=c.page),"constructors"in c&&n(1,f=c.constructors),"components"in c&&n(0,t=c.components),"form"in c&&n(2,r=c.form),"data_0"in c&&n(3,u=c.data_0),"data_1"in c&&n(4,o=c.data_1)},a.$$.update=()=>{a.$$.dirty&768&&s.page.set(i)},[t,f,r,u,o,l,_,b,s,i,I,O,T]}class re extends V{constructor(e){super(),q(this,e,ne,te,U,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const oe=[()=>S(()=>import("../nodes/0.322db14c.js"),["_app/immutable/nodes/0.322db14c.js","_app/immutable/chunks/index.ba35b81f.js","_app/immutable/chunks/paths.b7f7cd27.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/assets/0.30c87a73.css"]),()=>S(()=>import("../nodes/1.6c475c5d.js"),["_app/immutable/nodes/1.6c475c5d.js","_app/immutable/chunks/index.ba35b81f.js","_app/immutable/chunks/stores.a2c33b91.js","_app/immutable/chunks/singletons.f77dfb29.js","_app/immutable/chunks/paths.b7f7cd27.js"]),()=>S(()=>import("../nodes/2.2cd27a0e.js"),["_app/immutable/nodes/2.2cd27a0e.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js","_app/immutable/chunks/index.ba35b81f.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/chunks/paths.b7f7cd27.js","_app/immutable/chunks/stores.a2c33b91.js","_app/immutable/chunks/singletons.f77dfb29.js","_app/immutable/assets/2.6ba48bb2.css"])],ae=[],le={"/":[2]},fe={handleError:({error:a})=>{console.error(a)}};export{le as dictionary,fe as hooks,se as matchers,oe as nodes,re as root,ae as server_loads}; +import{S as V,i as q,s as U,a as j,e as h,c as z,b as g,d,f as R,g as p,h as w,j as W,o as F,k as G,l as H,m as J,n as L,p as m,q as K,r as M,u as Q,v as P,t as X,w as N,x as k,y as v,z as A,A as E,B as y}from"../chunks/index.ba35b81f.js";const Y="modulepreload",Z=function(a){return"/key-pop-explorer/"+a},B={},S=function(e,n,s){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(f=>{if(f=Z(f),f in B)return;B[f]=!0;const t=f.endsWith(".css"),r=t?'[rel="stylesheet"]':"";if(!!s)for(let l=i.length-1;l>=0;l--){const _=i[l];if(_.href===f&&(!t||_.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${r}`))return;const o=document.createElement("link");if(o.rel=t?"stylesheet":Y,t||(o.as="script",o.crossOrigin=""),o.href=f,document.head.appendChild(o),t)return new Promise((l,_)=>{o.addEventListener("load",l),o.addEventListener("error",()=>_(new Error(`Unable to preload CSS for ${f}`)))})})).then(()=>e()).catch(f=>{const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=f,window.dispatchEvent(t),!t.defaultPrevented)throw f})},se={};function $(a){let e,n,s;var i=a[1][0];function f(t){return{props:{data:t[3],form:t[2]}}}return i&&(e=k(i,f(a)),a[12](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&A(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),g(t,n,r),s=!0},p(t,r){const u={};if(r&8&&(u.data=t[3]),r&4&&(u.form=t[2]),r&2&&i!==(i=t[1][0])){if(e){P();const o=e;d(o.$$.fragment,1,0,()=>{y(o,1)}),R()}i?(e=k(i,f(t)),t[12](e),v(e.$$.fragment),p(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else i&&e.$set(u)},i(t){s||(e&&p(e.$$.fragment,t),s=!0)},o(t){e&&d(e.$$.fragment,t),s=!1},d(t){a[12](null),t&&w(n),e&&y(e,t)}}}function x(a){let e,n,s;var i=a[1][0];function f(t){return{props:{data:t[3],$$slots:{default:[ee]},$$scope:{ctx:t}}}}return i&&(e=k(i,f(a)),a[11](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&A(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),g(t,n,r),s=!0},p(t,r){const u={};if(r&8&&(u.data=t[3]),r&8215&&(u.$$scope={dirty:r,ctx:t}),r&2&&i!==(i=t[1][0])){if(e){P();const o=e;d(o.$$.fragment,1,0,()=>{y(o,1)}),R()}i?(e=k(i,f(t)),t[11](e),v(e.$$.fragment),p(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else i&&e.$set(u)},i(t){s||(e&&p(e.$$.fragment,t),s=!0)},o(t){e&&d(e.$$.fragment,t),s=!1},d(t){a[11](null),t&&w(n),e&&y(e,t)}}}function ee(a){let e,n,s;var i=a[1][1];function f(t){return{props:{data:t[4],form:t[2]}}}return i&&(e=k(i,f(a)),a[10](e)),{c(){e&&v(e.$$.fragment),n=h()},l(t){e&&A(e.$$.fragment,t),n=h()},m(t,r){e&&E(e,t,r),g(t,n,r),s=!0},p(t,r){const u={};if(r&16&&(u.data=t[4]),r&4&&(u.form=t[2]),r&2&&i!==(i=t[1][1])){if(e){P();const o=e;d(o.$$.fragment,1,0,()=>{y(o,1)}),R()}i?(e=k(i,f(t)),t[10](e),v(e.$$.fragment),p(e.$$.fragment,1),E(e,n.parentNode,n)):e=null}else i&&e.$set(u)},i(t){s||(e&&p(e.$$.fragment,t),s=!0)},o(t){e&&d(e.$$.fragment,t),s=!1},d(t){a[10](null),t&&w(n),e&&y(e,t)}}}function C(a){let e,n=a[6]&&D(a);return{c(){e=G("div"),n&&n.c(),this.h()},l(s){e=H(s,"DIV",{id:!0,"aria-live":!0,"aria-atomic":!0,style:!0});var i=J(e);n&&n.l(i),i.forEach(w),this.h()},h(){L(e,"id","svelte-announcer"),L(e,"aria-live","assertive"),L(e,"aria-atomic","true"),m(e,"position","absolute"),m(e,"left","0"),m(e,"top","0"),m(e,"clip","rect(0 0 0 0)"),m(e,"clip-path","inset(50%)"),m(e,"overflow","hidden"),m(e,"white-space","nowrap"),m(e,"width","1px"),m(e,"height","1px")},m(s,i){g(s,e,i),n&&n.m(e,null)},p(s,i){s[6]?n?n.p(s,i):(n=D(s),n.c(),n.m(e,null)):n&&(n.d(1),n=null)},d(s){s&&w(e),n&&n.d()}}}function D(a){let e;return{c(){e=K(a[7])},l(n){e=M(n,a[7])},m(n,s){g(n,e,s)},p(n,s){s&128&&Q(e,n[7])},d(n){n&&w(e)}}}function te(a){let e,n,s,i,f;const t=[x,$],r=[];function u(l,_){return l[1][1]?0:1}e=u(a),n=r[e]=t[e](a);let o=a[5]&&C(a);return{c(){n.c(),s=j(),o&&o.c(),i=h()},l(l){n.l(l),s=z(l),o&&o.l(l),i=h()},m(l,_){r[e].m(l,_),g(l,s,_),o&&o.m(l,_),g(l,i,_),f=!0},p(l,[_]){let b=e;e=u(l),e===b?r[e].p(l,_):(P(),d(r[b],1,1,()=>{r[b]=null}),R(),n=r[e],n?n.p(l,_):(n=r[e]=t[e](l),n.c()),p(n,1),n.m(s.parentNode,s)),l[5]?o?o.p(l,_):(o=C(l),o.c(),o.m(i.parentNode,i)):o&&(o.d(1),o=null)},i(l){f||(p(n),f=!0)},o(l){d(n),f=!1},d(l){r[e].d(l),l&&w(s),o&&o.d(l),l&&w(i)}}}function ne(a,e,n){let{stores:s}=e,{page:i}=e,{constructors:f}=e,{components:t=[]}=e,{form:r}=e,{data_0:u=null}=e,{data_1:o=null}=e;W(s.page.notify);let l=!1,_=!1,b=null;F(()=>{const c=s.page.subscribe(()=>{l&&(n(6,_=!0),X().then(()=>{n(7,b=document.title||"untitled page")}))});return n(5,l=!0),c});function I(c){N[c?"unshift":"push"](()=>{t[1]=c,n(0,t)})}function O(c){N[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}function T(c){N[c?"unshift":"push"](()=>{t[0]=c,n(0,t)})}return a.$$set=c=>{"stores"in c&&n(8,s=c.stores),"page"in c&&n(9,i=c.page),"constructors"in c&&n(1,f=c.constructors),"components"in c&&n(0,t=c.components),"form"in c&&n(2,r=c.form),"data_0"in c&&n(3,u=c.data_0),"data_1"in c&&n(4,o=c.data_1)},a.$$.update=()=>{a.$$.dirty&768&&s.page.set(i)},[t,f,r,u,o,l,_,b,s,i,I,O,T]}class re extends V{constructor(e){super(),q(this,e,ne,te,U,{stores:8,page:9,constructors:1,components:0,form:2,data_0:3,data_1:4})}}const oe=[()=>S(()=>import("../nodes/0.843dc185.js"),["_app/immutable/nodes/0.843dc185.js","_app/immutable/chunks/index.ba35b81f.js","_app/immutable/chunks/paths.10d75873.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/assets/0.30c87a73.css"]),()=>S(()=>import("../nodes/1.79fb5540.js"),["_app/immutable/nodes/1.79fb5540.js","_app/immutable/chunks/index.ba35b81f.js","_app/immutable/chunks/stores.c6665ed7.js","_app/immutable/chunks/singletons.edac9b68.js","_app/immutable/chunks/paths.10d75873.js"]),()=>S(()=>import("../nodes/2.79242b89.js"),["_app/immutable/nodes/2.79242b89.js","_app/immutable/chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js","_app/immutable/chunks/index.ba35b81f.js","_app/immutable/assets/Table.14877c48.css","_app/immutable/chunks/paths.10d75873.js","_app/immutable/chunks/stores.c6665ed7.js","_app/immutable/chunks/singletons.edac9b68.js","_app/immutable/assets/2.6ba48bb2.css"])],ae=[],le={"/":[2]},fe={handleError:({error:a})=>{console.error(a)}};export{le as dictionary,fe as hooks,se as matchers,oe as nodes,re as root,ae as server_loads}; diff --git a/_app/immutable/entry/start.97647a08.js b/_app/immutable/entry/start.0b448926.js similarity index 99% rename from _app/immutable/entry/start.97647a08.js rename to _app/immutable/entry/start.0b448926.js index 7e2e14c..fe178d3 100644 --- a/_app/immutable/entry/start.97647a08.js +++ b/_app/immutable/entry/start.0b448926.js @@ -1,3 +1,3 @@ -import{o as we,t as ye}from"../chunks/index.ba35b81f.js";import{S as Ge,a as Je,I as M,g as Ce,f as Me,b as _e,c as le,s as ee,i as ve,d as F,P as Ve,e as Xe}from"../chunks/singletons.f77dfb29.js";import{b as J}from"../chunks/paths.b7f7cd27.js";function Ze(t,r){return t==="/"||r==="ignore"?t:r==="never"?t.endsWith("/")?t.slice(0,-1):t:r==="always"&&!t.endsWith("/")?t+"/":t}function Qe(t){return t.split("%25").map(decodeURI).join("%25")}function et(t){for(const r in t)t[r]=decodeURIComponent(t[r]);return t}const tt=["href","pathname","search","searchParams","toString","toJSON"];function nt(t,r){const u=new URL(t);for(const s of tt)Object.defineProperty(u,s,{get(){return r(),t[s]},enumerable:!0,configurable:!0});return at(u),u}function at(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const rt="/__data.json";function ot(t){return t.replace(/\/$/,"")+rt}function it(...t){let r=5381;for(const u of t)if(typeof u=="string"){let s=u.length;for(;s;)r=r*33^u.charCodeAt(--s)}else if(ArrayBuffer.isView(u)){const s=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);let d=s.length;for(;d;)r=r*33^s[--d]}else throw new TypeError("value must be a string or TypedArray");return(r>>>0).toString(36)}const fe=window.fetch;window.fetch=(t,r)=>((t instanceof Request?t.method:(r==null?void 0:r.method)||"GET")!=="GET"&&ne.delete(ke(t)),fe(t,r));const ne=new Map;function st(t,r){const u=ke(t,r),s=document.querySelector(u);if(s!=null&&s.textContent){const{body:d,...f}=JSON.parse(s.textContent),E=s.getAttribute("data-ttl");return E&&ne.set(u,{body:d,init:f,ttl:1e3*Number(E)}),Promise.resolve(new Response(d,f))}return fe(t,r)}function ct(t,r,u){if(ne.size>0){const s=ke(t,u),d=ne.get(s);if(d){if(performance.now(){const d=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(s);if(d)return r.push({name:d[1],matcher:d[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const f=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(s);if(f)return r.push({name:f[1],matcher:f[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!s)return;const E=s.split(/\[(.+?)\](?!\])/);return"/"+E.map((w,p)=>{if(p%2){if(w.startsWith("x+"))return be(String.fromCharCode(parseInt(w.slice(2),16)));if(w.startsWith("u+"))return be(String.fromCharCode(...w.slice(2).split("-").map(U=>parseInt(U,16))));const g=lt.exec(w);if(!g)throw new Error(`Invalid param: ${w}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,D,x,k,N]=g;return r.push({name:k,matcher:N,optional:!!D,rest:!!x,chained:x?p===1&&E[0]==="":!1}),x?"(.*?)":D?"([^/]*)?":"([^/]+?)"}return be(w)}).join("")}).join("")}/?$`),params:r}}function ut(t){return!/^\([^)]+\)$/.test(t)}function dt(t){return t.slice(1).split("/").filter(ut)}function pt(t,r,u){const s={},d=t.slice(1);let f=0;for(let E=0;Ep).join("/"),f=0),w===void 0){l.rest&&(s[l.name]="");continue}if(!l.matcher||u[l.matcher](w)){s[l.name]=w;const p=r[E+1],g=d[E+1];p&&!p.rest&&p.optional&&g&&l.chained&&(f=0);continue}if(l.optional&&l.chained){f++;continue}return}if(!f)return s}function be(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function ht({nodes:t,server_loads:r,dictionary:u,matchers:s}){const d=new Set(r);return Object.entries(u).map(([l,[w,p,g]])=>{const{pattern:D,params:x}=ft(l),k={id:l,exec:N=>{const U=D.exec(N);if(U)return pt(U,x,s)},errors:[1,...g||[]].map(N=>t[N]),layouts:[0,...p||[]].map(E),leaf:f(w)};return k.errors.length=k.layouts.length=Math.max(k.errors.length,k.layouts.length),k});function f(l){const w=l<0;return w&&(l=~l),[w,t[l]]}function E(l){return l===void 0?l:[d.has(l),t[l]]}}function Ke(t){try{return JSON.parse(sessionStorage[t])}catch{}}function qe(t,r){const u=JSON.stringify(r);try{sessionStorage[t]=u}catch{}}const gt=-1,mt=-2,wt=-3,yt=-4,_t=-5,vt=-6;function bt(t,r){if(typeof t=="number")return d(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const u=t,s=Array(u.length);function d(f,E=!1){if(f===gt)return;if(f===wt)return NaN;if(f===yt)return 1/0;if(f===_t)return-1/0;if(f===vt)return-0;if(E)throw new Error("Invalid input");if(f in s)return s[f];const l=u[f];if(!l||typeof l!="object")s[f]=l;else if(Array.isArray(l))if(typeof l[0]=="string"){const w=l[0],p=r==null?void 0:r[w];if(p)return s[f]=p(d(l[1]));switch(w){case"Date":s[f]=new Date(l[1]);break;case"Set":const g=new Set;s[f]=g;for(let k=1;kr!=null)}const ze=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...ze];const St=new Set([...ze]);[...St];async function kt(t){var r;for(const u in t)if(typeof((r=t[u])==null?void 0:r.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([s,d])=>[s,await d])));return t}class te{constructor(r,u){this.status=r,typeof u=="string"?this.body={message:u}:u?this.body=u:this.body={message:`Error: ${r}`}}toString(){return JSON.stringify(this.body)}}class Fe{constructor(r,u){this.status=r,this.location=u}}const Rt="x-sveltekit-invalidated",At="x-sveltekit-trailing-slash",K=Ke(Ge)??{},Q=Ke(Je)??{};function Ee(t){K[t]=ee()}function It(t,r){var $e;const u=ht(t),s=t.nodes[0],d=t.nodes[1];s(),d();const f=document.documentElement,E=[],l=[];let w=null;const p={before_navigate:[],on_navigate:[],after_navigate:[]};let g={branch:[],error:null,url:null},D=!1,x=!1,k=!0,N=!1,U=!1,H=!1,B=!1,V,T=($e=history.state)==null?void 0:$e[M];T||(T=Date.now(),history.replaceState({...history.state,[M]:T},"",location.href));const ue=K[T];ue&&(history.scrollRestoration="manual",scrollTo(ue.x,ue.y));let q,ae,W;async function Re(){if(W=W||Promise.resolve(),await W,!W)return;W=null;const e=new URL(location.href),i=X(e,!0);w=null;const n=ae={},o=i&&await he(i);if(n===ae&&o){if(o.type==="redirect")return re(new URL(o.location,e).href,{},[e.pathname],n);o.props.page!==void 0&&(q=o.props.page),V.$set(o.props)}}function Ae(e){l.some(i=>i==null?void 0:i.snapshot)&&(Q[e]=l.map(i=>{var n;return(n=i==null?void 0:i.snapshot)==null?void 0:n.capture()}))}function Ie(e){var i;(i=Q[e])==null||i.forEach((n,o)=>{var a,c;(c=(a=l[o])==null?void 0:a.snapshot)==null||c.restore(n)})}function Le(){Ee(T),qe(Ge,K),Ae(T),qe(Je,Q)}async function re(e,{noScroll:i=!1,replaceState:n=!1,keepFocus:o=!1,state:a={},invalidateAll:c=!1},h,v){return typeof e=="string"&&(e=new URL(e,Ce(document))),ce({url:e,scroll:i?ee():null,keepfocus:o,redirect_chain:h,details:{state:a,replaceState:n},nav_token:v,accepted:()=>{c&&(B=!0)},blocked:()=>{},type:"goto"})}async function Pe(e){return w={id:e.id,promise:he(e).then(i=>(i.type==="loaded"&&i.state.error&&(w=null),i))},w.promise}async function oe(...e){const n=u.filter(o=>e.some(a=>o.exec(a))).map(o=>Promise.all([...o.layouts,o.leaf].map(a=>a==null?void 0:a[1]())));await Promise.all(n)}function Oe(e){var o;g=e.state;const i=document.querySelector("style[data-sveltekit]");i&&i.remove(),q=e.props.page,V=new t.root({target:r,props:{...e.props,stores:F,components:l},hydrate:!0}),Ie(T);const n={from:null,to:{params:g.params,route:{id:((o=g.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};p.after_navigate.forEach(a=>a(n)),x=!0}async function Y({url:e,params:i,branch:n,status:o,error:a,route:c,form:h}){let v="never";for(const y of n)(y==null?void 0:y.slash)!==void 0&&(v=y.slash);e.pathname=Ze(e.pathname,v),e.search=e.search;const b={type:"loaded",state:{url:e,params:i,branch:n,error:a,route:c},props:{constructors:Et(n).map(y=>y.node.component)}};h!==void 0&&(b.props.form=h);let _={},L=!q,A=0;for(let y=0;y(v.route=!0,m[O])}),params:new Proxy(o,{get:(m,O)=>(v.params.add(O),m[O])}),data:(c==null?void 0:c.data)??null,url:nt(n,()=>{v.url=!0}),async fetch(m,O){let j;m instanceof Request?(j=m.url,O={body:m.method==="GET"||m.method==="HEAD"?void 0:await m.blob(),cache:m.cache,credentials:m.credentials,headers:m.headers,integrity:m.integrity,keepalive:m.keepalive,method:m.method,mode:m.mode,redirect:m.redirect,referrer:m.referrer,referrerPolicy:m.referrerPolicy,signal:m.signal,...O}):j=m;const C=new URL(j,n);return P(C.href),C.origin===n.origin&&(j=C.href.slice(n.origin.length)),x?ct(j,C.href,O):st(j,O)},setHeaders:()=>{},depends:P,parent(){return v.parent=!0,i()}};h=await b.universal.load.call(null,y)??null,h=h?await kt(h):null}return{node:b,loader:e,server:c,universal:(L=b.universal)!=null&&L.load?{type:"data",data:h,uses:v}:null,data:h??(c==null?void 0:c.data)??null,slash:((A=b.universal)==null?void 0:A.trailingSlash)??(c==null?void 0:c.slash)}}function Ue(e,i,n,o,a){if(B)return!0;if(!o)return!1;if(o.parent&&e||o.route&&i||o.url&&n)return!0;for(const c of o.params)if(a[c]!==g.params[c])return!0;for(const c of o.dependencies)if(E.some(h=>h(new URL(c))))return!0;return!1}function pe(e,i){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?i??null:null}async function he({id:e,invalidating:i,url:n,params:o,route:a}){if((w==null?void 0:w.id)===e)return w.promise;const{errors:c,layouts:h,leaf:v}=a,b=[...h,v];c.forEach(S=>S==null?void 0:S().catch(()=>{})),b.forEach(S=>S==null?void 0:S[1]().catch(()=>{}));let _=null;const L=g.url?e!==g.url.pathname+g.url.search:!1,A=g.route?a.id!==g.route.id:!1;let P=!1;const y=b.map((S,I)=>{var G;const R=g.branch[I],$=!!(S!=null&&S[0])&&((R==null?void 0:R.loader)!==S[1]||Ue(P,A,L,(G=R.server)==null?void 0:G.uses,o));return $&&(P=!0),$});if(y.some(Boolean)){try{_=await He(n,y)}catch(S){return ie({status:S instanceof te?S.status:500,error:await Z(S,{url:n,params:o,route:{id:a.id}}),url:n,route:a})}if(_.type==="redirect")return _}const m=_==null?void 0:_.nodes;let O=!1;const j=b.map(async(S,I)=>{var ge;if(!S)return;const R=g.branch[I],$=m==null?void 0:m[I];if((!$||$.type==="skip")&&S[1]===(R==null?void 0:R.loader)&&!Ue(O,A,L,(ge=R.universal)==null?void 0:ge.uses,o))return R;if(O=!0,($==null?void 0:$.type)==="error")throw $;return de({loader:S[1],url:n,params:o,route:a,parent:async()=>{var De;const Te={};for(let me=0;me{});const C=[];for(let S=0;SPromise.resolve({}),server_data_node:pe(c)}),b={node:await d(),loader:d,universal:null,server:null,data:null};return await Y({url:n,params:a,branch:[v,b],status:e,error:i,route:null})}function X(e,i){if(ve(e,J))return;const n=se(e);for(const o of u){const a=o.exec(n);if(a)return{id:e.pathname+e.search,invalidating:i,route:o,params:et(a),url:e}}}function se(e){return Qe(e.pathname.slice(J.length)||"/")}function Ne({url:e,type:i,intent:n,delta:o}){let a=!1;const c=Be(g,n,e,i);o!==void 0&&(c.navigation.delta=o);const h={...c.navigation,cancel:()=>{a=!0,c.reject(new Error("navigation was cancelled"))}};return U||p.before_navigate.forEach(v=>v(h)),a?null:c}async function ce({url:e,scroll:i,keepfocus:n,redirect_chain:o,details:a,type:c,delta:h,nav_token:v={},accepted:b,blocked:_}){var j,C,S;const L=X(e,!1),A=Ne({url:e,type:c,delta:h,intent:L});if(!A){_();return}const P=T;b(),U=!0,x&&F.navigating.set(A.navigation),ae=v;let y=L&&await he(L);if(!y){if(ve(e,J))return await z(e);y=await je(e,{id:null},await Z(new Error(`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404)}if(e=(L==null?void 0:L.url)||e,ae!==v)return A.reject(new Error("navigation was aborted")),!1;if(y.type==="redirect")if(o.length>10||o.includes(e.pathname))y=await ie({status:500,error:await Z(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}});else return re(new URL(y.location,e).href,{},[...o,e.pathname],v),!1;else((j=y.props.page)==null?void 0:j.status)>=400&&await F.updated.check()&&await z(e);if(E.length=0,B=!1,N=!0,Ee(P),Ae(P),(C=y.props.page)!=null&&C.url&&y.props.page.url.pathname!==e.pathname&&(e.pathname=(S=y.props.page)==null?void 0:S.url.pathname),a){const I=a.replaceState?0:1;if(a.state[M]=T+=I,history[a.replaceState?"replaceState":"pushState"](a.state,"",e),!a.replaceState){let R=T+1;for(;Q[R]||K[R];)delete Q[R],delete K[R],R+=1}}if(w=null,x){g=y.state,y.props.page&&(y.props.page.url=e);const I=(await Promise.all(p.on_navigate.map(R=>R(A.navigation)))).filter(R=>typeof R=="function");if(I.length>0){let R=function(){p.after_navigate=p.after_navigate.filter($=>!I.includes($))};I.push(R),p.after_navigate.push(...I)}V.$set(y.props)}else Oe(y);const{activeElement:m}=document;if(await ye(),k){const I=e.hash&&document.getElementById(decodeURIComponent(e.hash.slice(1)));i?scrollTo(i.x,i.y):I?I.scrollIntoView():scrollTo(0,0)}const O=document.activeElement!==m&&document.activeElement!==document.body;!n&&!O&&Se(),k=!0,y.props.page&&(q=y.props.page),U=!1,c==="popstate"&&Ie(T),A.fulfil(void 0),p.after_navigate.forEach(I=>I(A.navigation)),F.navigating.set(null),N=!1}async function je(e,i,n,o){return e.origin===location.origin&&e.pathname===location.pathname&&!D?await ie({status:o,error:n,url:e,route:i}):await z(e)}function z(e){return location.href=e.href,new Promise(()=>{})}function Ye(){let e;f.addEventListener("mousemove",c=>{const h=c.target;clearTimeout(e),e=setTimeout(()=>{o(h,2)},20)});function i(c){o(c.composedPath()[0],1)}f.addEventListener("mousedown",i),f.addEventListener("touchstart",i,{passive:!0});const n=new IntersectionObserver(c=>{for(const h of c)h.isIntersecting&&(oe(se(new URL(h.target.href))),n.unobserve(h.target))},{threshold:0});function o(c,h){const v=Me(c,f);if(!v)return;const{url:b,external:_,download:L}=_e(v,J);if(_||L)return;const A=le(v);if(!A.reload)if(h<=A.preload_data){const P=X(b,!1);P&&Pe(P)}else h<=A.preload_code&&oe(se(b))}function a(){n.disconnect();for(const c of f.querySelectorAll("a")){const{url:h,external:v,download:b}=_e(c,J);if(v||b)continue;const _=le(c);_.reload||(_.preload_code===Ve.viewport&&n.observe(c),_.preload_code===Ve.eager&&oe(se(h)))}}p.after_navigate.push(a),a()}function Z(e,i){return e instanceof te?e.body:t.hooks.handleError({error:e,event:i})??{message:i.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:e=>{we(()=>(p.after_navigate.push(e),()=>{const i=p.after_navigate.indexOf(e);p.after_navigate.splice(i,1)}))},before_navigate:e=>{we(()=>(p.before_navigate.push(e),()=>{const i=p.before_navigate.indexOf(e);p.before_navigate.splice(i,1)}))},on_navigate:e=>{we(()=>(p.on_navigate.push(e),()=>{const i=p.on_navigate.indexOf(e);p.on_navigate.splice(i,1)}))},disable_scroll_handling:()=>{(N||!x)&&(k=!1)},goto:(e,i={})=>re(e,i,[]),invalidate:e=>{if(typeof e=="function")E.push(e);else{const{href:i}=new URL(e,location.href);E.push(n=>n.href===i)}return Re()},invalidate_all:()=>(B=!0,Re()),preload_data:async e=>{const i=new URL(e,Ce(document)),n=X(i,!1);if(!n)throw new Error(`Attempted to preload a URL that does not belong to this app: ${i}`);await Pe(n)},preload_code:oe,apply_action:async e=>{if(e.type==="error"){const i=new URL(location.href),{branch:n,route:o}=g;if(!o)return;const a=await xe(g.branch.length,n,o.errors);if(a){const c=await Y({url:i,params:g.params,branch:n.slice(0,a.idx).concat(a.node),status:e.status??500,error:e.error,route:o});g=c.state,V.$set(c.props),ye().then(Se)}}else e.type==="redirect"?re(e.location,{invalidateAll:!0},[]):(V.$set({form:null,page:{...q,form:e.data,status:e.status}}),await ye(),V.$set({form:e.data}),e.type==="success"&&Se())},_start_router:()=>{var i;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let o=!1;if(Le(),!U){const a=Be(g,void 0,null,"leave"),c={...a.navigation,cancel:()=>{o=!0,a.reject(new Error("navigation was cancelled"))}};p.before_navigate.forEach(h=>h(c))}o?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Le()}),(i=navigator.connection)!=null&&i.saveData||Ye(),f.addEventListener("click",n=>{var P;if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const o=Me(n.composedPath()[0],f);if(!o)return;const{url:a,external:c,target:h,download:v}=_e(o,J);if(!a)return;if(h==="_parent"||h==="_top"){if(window.parent!==window)return}else if(h&&h!=="_self")return;const b=le(o);if(!(o instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||v)return;if(c||b.reload){Ne({url:a,type:"link"})?U=!0:n.preventDefault();return}const[L,A]=a.href.split("#");if(A!==void 0&&L===location.href.split("#")[0]){if(g.url.hash===a.hash){n.preventDefault(),(P=o.ownerDocument.getElementById(A))==null||P.scrollIntoView();return}if(H=!0,Ee(T),e(a),!b.replace_state)return;H=!1,n.preventDefault()}ce({url:a,scroll:b.noscroll?ee():null,keepfocus:b.keep_focus??!1,redirect_chain:[],details:{state:{},replaceState:b.replace_state??a.href===location.href},accepted:()=>n.preventDefault(),blocked:()=>n.preventDefault(),type:"link"})}),f.addEventListener("submit",n=>{if(n.defaultPrevented)return;const o=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formMethod)||o.method)!=="get")return;const h=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||o.action);if(ve(h,J))return;const v=n.target,{keep_focus:b,noscroll:_,reload:L,replace_state:A}=le(v);if(L)return;n.preventDefault(),n.stopPropagation();const P=new FormData(v),y=a==null?void 0:a.getAttribute("name");y&&P.append(y,(a==null?void 0:a.getAttribute("value"))??""),h.search=new URLSearchParams(P).toString(),ce({url:h,scroll:_?ee():null,keepfocus:b??!1,redirect_chain:[],details:{state:{},replaceState:A??h.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async n=>{var o;if((o=n.state)!=null&&o[M]){if(n.state[M]===T)return;const a=K[n.state[M]];if(g.url.href.split("#")[0]===location.href.split("#")[0]){K[T]=ee(),T=n.state[M],scrollTo(a.x,a.y);return}const c=n.state[M]-T;await ce({url:new URL(location.href),scroll:a,keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{T=n.state[M]},blocked:()=>{history.go(-c)},type:"popstate",delta:c})}else if(!H){const a=new URL(location.href);e(a)}}),addEventListener("hashchange",()=>{H&&(H=!1,history.replaceState({...history.state,[M]:++T},"",location.href))});for(const n of document.querySelectorAll("link"))n.rel==="icon"&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&F.navigating.set(null)});function e(n){g.url=n,F.page.set({...q,url:n}),F.page.notify()}},_hydrate:async({status:e=200,error:i,node_ids:n,params:o,route:a,data:c,form:h})=>{D=!0;const v=new URL(location.href);({params:o={},route:a={id:null}}=X(v,!1)||{});let b;try{const _=n.map(async(P,y)=>{const m=c[y];return m!=null&&m.uses&&(m.uses=We(m.uses)),de({loader:t.nodes[P],url:v,params:o,route:a,parent:async()=>{const O={};for(let j=0;jP===a.id);if(A){const P=A.layouts;for(let y=0;yd?"1":"0").join(""));const s=await fe(u.href);if(!s.ok)throw new te(s.status,await s.json());return new Promise(async d=>{var g;const f=new Map,E=s.body.getReader(),l=new TextDecoder;function w(D){return bt(D,{Promise:x=>new Promise((k,N)=>{f.set(x,{fulfil:k,reject:N})})})}let p="";for(;;){const{done:D,value:x}=await E.read();if(D&&!p)break;for(p+=!x&&p?` +import{o as we,t as ye}from"../chunks/index.ba35b81f.js";import{S as Ge,a as Je,I as M,g as Ce,f as Me,b as _e,c as le,s as ee,i as ve,d as F,P as Ve,e as Xe}from"../chunks/singletons.edac9b68.js";import{b as J}from"../chunks/paths.10d75873.js";function Ze(t,r){return t==="/"||r==="ignore"?t:r==="never"?t.endsWith("/")?t.slice(0,-1):t:r==="always"&&!t.endsWith("/")?t+"/":t}function Qe(t){return t.split("%25").map(decodeURI).join("%25")}function et(t){for(const r in t)t[r]=decodeURIComponent(t[r]);return t}const tt=["href","pathname","search","searchParams","toString","toJSON"];function nt(t,r){const u=new URL(t);for(const s of tt)Object.defineProperty(u,s,{get(){return r(),t[s]},enumerable:!0,configurable:!0});return at(u),u}function at(t){Object.defineProperty(t,"hash",{get(){throw new Error("Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead")}})}const rt="/__data.json";function ot(t){return t.replace(/\/$/,"")+rt}function it(...t){let r=5381;for(const u of t)if(typeof u=="string"){let s=u.length;for(;s;)r=r*33^u.charCodeAt(--s)}else if(ArrayBuffer.isView(u)){const s=new Uint8Array(u.buffer,u.byteOffset,u.byteLength);let d=s.length;for(;d;)r=r*33^s[--d]}else throw new TypeError("value must be a string or TypedArray");return(r>>>0).toString(36)}const fe=window.fetch;window.fetch=(t,r)=>((t instanceof Request?t.method:(r==null?void 0:r.method)||"GET")!=="GET"&&ne.delete(ke(t)),fe(t,r));const ne=new Map;function st(t,r){const u=ke(t,r),s=document.querySelector(u);if(s!=null&&s.textContent){const{body:d,...f}=JSON.parse(s.textContent),E=s.getAttribute("data-ttl");return E&&ne.set(u,{body:d,init:f,ttl:1e3*Number(E)}),Promise.resolve(new Response(d,f))}return fe(t,r)}function ct(t,r,u){if(ne.size>0){const s=ke(t,u),d=ne.get(s);if(d){if(performance.now(){const d=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(s);if(d)return r.push({name:d[1],matcher:d[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const f=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(s);if(f)return r.push({name:f[1],matcher:f[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!s)return;const E=s.split(/\[(.+?)\](?!\])/);return"/"+E.map((w,p)=>{if(p%2){if(w.startsWith("x+"))return be(String.fromCharCode(parseInt(w.slice(2),16)));if(w.startsWith("u+"))return be(String.fromCharCode(...w.slice(2).split("-").map(U=>parseInt(U,16))));const g=lt.exec(w);if(!g)throw new Error(`Invalid param: ${w}. Params and matcher names can only have underscores and alphanumeric characters.`);const[,D,x,k,N]=g;return r.push({name:k,matcher:N,optional:!!D,rest:!!x,chained:x?p===1&&E[0]==="":!1}),x?"(.*?)":D?"([^/]*)?":"([^/]+?)"}return be(w)}).join("")}).join("")}/?$`),params:r}}function ut(t){return!/^\([^)]+\)$/.test(t)}function dt(t){return t.slice(1).split("/").filter(ut)}function pt(t,r,u){const s={},d=t.slice(1);let f=0;for(let E=0;Ep).join("/"),f=0),w===void 0){l.rest&&(s[l.name]="");continue}if(!l.matcher||u[l.matcher](w)){s[l.name]=w;const p=r[E+1],g=d[E+1];p&&!p.rest&&p.optional&&g&&l.chained&&(f=0);continue}if(l.optional&&l.chained){f++;continue}return}if(!f)return s}function be(t){return t.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function ht({nodes:t,server_loads:r,dictionary:u,matchers:s}){const d=new Set(r);return Object.entries(u).map(([l,[w,p,g]])=>{const{pattern:D,params:x}=ft(l),k={id:l,exec:N=>{const U=D.exec(N);if(U)return pt(U,x,s)},errors:[1,...g||[]].map(N=>t[N]),layouts:[0,...p||[]].map(E),leaf:f(w)};return k.errors.length=k.layouts.length=Math.max(k.errors.length,k.layouts.length),k});function f(l){const w=l<0;return w&&(l=~l),[w,t[l]]}function E(l){return l===void 0?l:[d.has(l),t[l]]}}function Ke(t){try{return JSON.parse(sessionStorage[t])}catch{}}function qe(t,r){const u=JSON.stringify(r);try{sessionStorage[t]=u}catch{}}const gt=-1,mt=-2,wt=-3,yt=-4,_t=-5,vt=-6;function bt(t,r){if(typeof t=="number")return d(t,!0);if(!Array.isArray(t)||t.length===0)throw new Error("Invalid input");const u=t,s=Array(u.length);function d(f,E=!1){if(f===gt)return;if(f===wt)return NaN;if(f===yt)return 1/0;if(f===_t)return-1/0;if(f===vt)return-0;if(E)throw new Error("Invalid input");if(f in s)return s[f];const l=u[f];if(!l||typeof l!="object")s[f]=l;else if(Array.isArray(l))if(typeof l[0]=="string"){const w=l[0],p=r==null?void 0:r[w];if(p)return s[f]=p(d(l[1]));switch(w){case"Date":s[f]=new Date(l[1]);break;case"Set":const g=new Set;s[f]=g;for(let k=1;kr!=null)}const ze=new Set(["load","prerender","csr","ssr","trailingSlash","config"]);[...ze];const St=new Set([...ze]);[...St];async function kt(t){var r;for(const u in t)if(typeof((r=t[u])==null?void 0:r.then)=="function")return Object.fromEntries(await Promise.all(Object.entries(t).map(async([s,d])=>[s,await d])));return t}class te{constructor(r,u){this.status=r,typeof u=="string"?this.body={message:u}:u?this.body=u:this.body={message:`Error: ${r}`}}toString(){return JSON.stringify(this.body)}}class Fe{constructor(r,u){this.status=r,this.location=u}}const Rt="x-sveltekit-invalidated",At="x-sveltekit-trailing-slash",K=Ke(Ge)??{},Q=Ke(Je)??{};function Ee(t){K[t]=ee()}function It(t,r){var $e;const u=ht(t),s=t.nodes[0],d=t.nodes[1];s(),d();const f=document.documentElement,E=[],l=[];let w=null;const p={before_navigate:[],on_navigate:[],after_navigate:[]};let g={branch:[],error:null,url:null},D=!1,x=!1,k=!0,N=!1,U=!1,H=!1,B=!1,V,T=($e=history.state)==null?void 0:$e[M];T||(T=Date.now(),history.replaceState({...history.state,[M]:T},"",location.href));const ue=K[T];ue&&(history.scrollRestoration="manual",scrollTo(ue.x,ue.y));let q,ae,W;async function Re(){if(W=W||Promise.resolve(),await W,!W)return;W=null;const e=new URL(location.href),i=X(e,!0);w=null;const n=ae={},o=i&&await he(i);if(n===ae&&o){if(o.type==="redirect")return re(new URL(o.location,e).href,{},[e.pathname],n);o.props.page!==void 0&&(q=o.props.page),V.$set(o.props)}}function Ae(e){l.some(i=>i==null?void 0:i.snapshot)&&(Q[e]=l.map(i=>{var n;return(n=i==null?void 0:i.snapshot)==null?void 0:n.capture()}))}function Ie(e){var i;(i=Q[e])==null||i.forEach((n,o)=>{var a,c;(c=(a=l[o])==null?void 0:a.snapshot)==null||c.restore(n)})}function Le(){Ee(T),qe(Ge,K),Ae(T),qe(Je,Q)}async function re(e,{noScroll:i=!1,replaceState:n=!1,keepFocus:o=!1,state:a={},invalidateAll:c=!1},h,v){return typeof e=="string"&&(e=new URL(e,Ce(document))),ce({url:e,scroll:i?ee():null,keepfocus:o,redirect_chain:h,details:{state:a,replaceState:n},nav_token:v,accepted:()=>{c&&(B=!0)},blocked:()=>{},type:"goto"})}async function Pe(e){return w={id:e.id,promise:he(e).then(i=>(i.type==="loaded"&&i.state.error&&(w=null),i))},w.promise}async function oe(...e){const n=u.filter(o=>e.some(a=>o.exec(a))).map(o=>Promise.all([...o.layouts,o.leaf].map(a=>a==null?void 0:a[1]())));await Promise.all(n)}function Oe(e){var o;g=e.state;const i=document.querySelector("style[data-sveltekit]");i&&i.remove(),q=e.props.page,V=new t.root({target:r,props:{...e.props,stores:F,components:l},hydrate:!0}),Ie(T);const n={from:null,to:{params:g.params,route:{id:((o=g.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};p.after_navigate.forEach(a=>a(n)),x=!0}async function Y({url:e,params:i,branch:n,status:o,error:a,route:c,form:h}){let v="never";for(const y of n)(y==null?void 0:y.slash)!==void 0&&(v=y.slash);e.pathname=Ze(e.pathname,v),e.search=e.search;const b={type:"loaded",state:{url:e,params:i,branch:n,error:a,route:c},props:{constructors:Et(n).map(y=>y.node.component)}};h!==void 0&&(b.props.form=h);let _={},L=!q,A=0;for(let y=0;y(v.route=!0,m[O])}),params:new Proxy(o,{get:(m,O)=>(v.params.add(O),m[O])}),data:(c==null?void 0:c.data)??null,url:nt(n,()=>{v.url=!0}),async fetch(m,O){let j;m instanceof Request?(j=m.url,O={body:m.method==="GET"||m.method==="HEAD"?void 0:await m.blob(),cache:m.cache,credentials:m.credentials,headers:m.headers,integrity:m.integrity,keepalive:m.keepalive,method:m.method,mode:m.mode,redirect:m.redirect,referrer:m.referrer,referrerPolicy:m.referrerPolicy,signal:m.signal,...O}):j=m;const C=new URL(j,n);return P(C.href),C.origin===n.origin&&(j=C.href.slice(n.origin.length)),x?ct(j,C.href,O):st(j,O)},setHeaders:()=>{},depends:P,parent(){return v.parent=!0,i()}};h=await b.universal.load.call(null,y)??null,h=h?await kt(h):null}return{node:b,loader:e,server:c,universal:(L=b.universal)!=null&&L.load?{type:"data",data:h,uses:v}:null,data:h??(c==null?void 0:c.data)??null,slash:((A=b.universal)==null?void 0:A.trailingSlash)??(c==null?void 0:c.slash)}}function Ue(e,i,n,o,a){if(B)return!0;if(!o)return!1;if(o.parent&&e||o.route&&i||o.url&&n)return!0;for(const c of o.params)if(a[c]!==g.params[c])return!0;for(const c of o.dependencies)if(E.some(h=>h(new URL(c))))return!0;return!1}function pe(e,i){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?i??null:null}async function he({id:e,invalidating:i,url:n,params:o,route:a}){if((w==null?void 0:w.id)===e)return w.promise;const{errors:c,layouts:h,leaf:v}=a,b=[...h,v];c.forEach(S=>S==null?void 0:S().catch(()=>{})),b.forEach(S=>S==null?void 0:S[1]().catch(()=>{}));let _=null;const L=g.url?e!==g.url.pathname+g.url.search:!1,A=g.route?a.id!==g.route.id:!1;let P=!1;const y=b.map((S,I)=>{var G;const R=g.branch[I],$=!!(S!=null&&S[0])&&((R==null?void 0:R.loader)!==S[1]||Ue(P,A,L,(G=R.server)==null?void 0:G.uses,o));return $&&(P=!0),$});if(y.some(Boolean)){try{_=await He(n,y)}catch(S){return ie({status:S instanceof te?S.status:500,error:await Z(S,{url:n,params:o,route:{id:a.id}}),url:n,route:a})}if(_.type==="redirect")return _}const m=_==null?void 0:_.nodes;let O=!1;const j=b.map(async(S,I)=>{var ge;if(!S)return;const R=g.branch[I],$=m==null?void 0:m[I];if((!$||$.type==="skip")&&S[1]===(R==null?void 0:R.loader)&&!Ue(O,A,L,(ge=R.universal)==null?void 0:ge.uses,o))return R;if(O=!0,($==null?void 0:$.type)==="error")throw $;return de({loader:S[1],url:n,params:o,route:a,parent:async()=>{var De;const Te={};for(let me=0;me{});const C=[];for(let S=0;SPromise.resolve({}),server_data_node:pe(c)}),b={node:await d(),loader:d,universal:null,server:null,data:null};return await Y({url:n,params:a,branch:[v,b],status:e,error:i,route:null})}function X(e,i){if(ve(e,J))return;const n=se(e);for(const o of u){const a=o.exec(n);if(a)return{id:e.pathname+e.search,invalidating:i,route:o,params:et(a),url:e}}}function se(e){return Qe(e.pathname.slice(J.length)||"/")}function Ne({url:e,type:i,intent:n,delta:o}){let a=!1;const c=Be(g,n,e,i);o!==void 0&&(c.navigation.delta=o);const h={...c.navigation,cancel:()=>{a=!0,c.reject(new Error("navigation was cancelled"))}};return U||p.before_navigate.forEach(v=>v(h)),a?null:c}async function ce({url:e,scroll:i,keepfocus:n,redirect_chain:o,details:a,type:c,delta:h,nav_token:v={},accepted:b,blocked:_}){var j,C,S;const L=X(e,!1),A=Ne({url:e,type:c,delta:h,intent:L});if(!A){_();return}const P=T;b(),U=!0,x&&F.navigating.set(A.navigation),ae=v;let y=L&&await he(L);if(!y){if(ve(e,J))return await z(e);y=await je(e,{id:null},await Z(new Error(`Not found: ${e.pathname}`),{url:e,params:{},route:{id:null}}),404)}if(e=(L==null?void 0:L.url)||e,ae!==v)return A.reject(new Error("navigation was aborted")),!1;if(y.type==="redirect")if(o.length>10||o.includes(e.pathname))y=await ie({status:500,error:await Z(new Error("Redirect loop"),{url:e,params:{},route:{id:null}}),url:e,route:{id:null}});else return re(new URL(y.location,e).href,{},[...o,e.pathname],v),!1;else((j=y.props.page)==null?void 0:j.status)>=400&&await F.updated.check()&&await z(e);if(E.length=0,B=!1,N=!0,Ee(P),Ae(P),(C=y.props.page)!=null&&C.url&&y.props.page.url.pathname!==e.pathname&&(e.pathname=(S=y.props.page)==null?void 0:S.url.pathname),a){const I=a.replaceState?0:1;if(a.state[M]=T+=I,history[a.replaceState?"replaceState":"pushState"](a.state,"",e),!a.replaceState){let R=T+1;for(;Q[R]||K[R];)delete Q[R],delete K[R],R+=1}}if(w=null,x){g=y.state,y.props.page&&(y.props.page.url=e);const I=(await Promise.all(p.on_navigate.map(R=>R(A.navigation)))).filter(R=>typeof R=="function");if(I.length>0){let R=function(){p.after_navigate=p.after_navigate.filter($=>!I.includes($))};I.push(R),p.after_navigate.push(...I)}V.$set(y.props)}else Oe(y);const{activeElement:m}=document;if(await ye(),k){const I=e.hash&&document.getElementById(decodeURIComponent(e.hash.slice(1)));i?scrollTo(i.x,i.y):I?I.scrollIntoView():scrollTo(0,0)}const O=document.activeElement!==m&&document.activeElement!==document.body;!n&&!O&&Se(),k=!0,y.props.page&&(q=y.props.page),U=!1,c==="popstate"&&Ie(T),A.fulfil(void 0),p.after_navigate.forEach(I=>I(A.navigation)),F.navigating.set(null),N=!1}async function je(e,i,n,o){return e.origin===location.origin&&e.pathname===location.pathname&&!D?await ie({status:o,error:n,url:e,route:i}):await z(e)}function z(e){return location.href=e.href,new Promise(()=>{})}function Ye(){let e;f.addEventListener("mousemove",c=>{const h=c.target;clearTimeout(e),e=setTimeout(()=>{o(h,2)},20)});function i(c){o(c.composedPath()[0],1)}f.addEventListener("mousedown",i),f.addEventListener("touchstart",i,{passive:!0});const n=new IntersectionObserver(c=>{for(const h of c)h.isIntersecting&&(oe(se(new URL(h.target.href))),n.unobserve(h.target))},{threshold:0});function o(c,h){const v=Me(c,f);if(!v)return;const{url:b,external:_,download:L}=_e(v,J);if(_||L)return;const A=le(v);if(!A.reload)if(h<=A.preload_data){const P=X(b,!1);P&&Pe(P)}else h<=A.preload_code&&oe(se(b))}function a(){n.disconnect();for(const c of f.querySelectorAll("a")){const{url:h,external:v,download:b}=_e(c,J);if(v||b)continue;const _=le(c);_.reload||(_.preload_code===Ve.viewport&&n.observe(c),_.preload_code===Ve.eager&&oe(se(h)))}}p.after_navigate.push(a),a()}function Z(e,i){return e instanceof te?e.body:t.hooks.handleError({error:e,event:i})??{message:i.route.id!=null?"Internal Error":"Not Found"}}return{after_navigate:e=>{we(()=>(p.after_navigate.push(e),()=>{const i=p.after_navigate.indexOf(e);p.after_navigate.splice(i,1)}))},before_navigate:e=>{we(()=>(p.before_navigate.push(e),()=>{const i=p.before_navigate.indexOf(e);p.before_navigate.splice(i,1)}))},on_navigate:e=>{we(()=>(p.on_navigate.push(e),()=>{const i=p.on_navigate.indexOf(e);p.on_navigate.splice(i,1)}))},disable_scroll_handling:()=>{(N||!x)&&(k=!1)},goto:(e,i={})=>re(e,i,[]),invalidate:e=>{if(typeof e=="function")E.push(e);else{const{href:i}=new URL(e,location.href);E.push(n=>n.href===i)}return Re()},invalidate_all:()=>(B=!0,Re()),preload_data:async e=>{const i=new URL(e,Ce(document)),n=X(i,!1);if(!n)throw new Error(`Attempted to preload a URL that does not belong to this app: ${i}`);await Pe(n)},preload_code:oe,apply_action:async e=>{if(e.type==="error"){const i=new URL(location.href),{branch:n,route:o}=g;if(!o)return;const a=await xe(g.branch.length,n,o.errors);if(a){const c=await Y({url:i,params:g.params,branch:n.slice(0,a.idx).concat(a.node),status:e.status??500,error:e.error,route:o});g=c.state,V.$set(c.props),ye().then(Se)}}else e.type==="redirect"?re(e.location,{invalidateAll:!0},[]):(V.$set({form:null,page:{...q,form:e.data,status:e.status}}),await ye(),V.$set({form:e.data}),e.type==="success"&&Se())},_start_router:()=>{var i;history.scrollRestoration="manual",addEventListener("beforeunload",n=>{let o=!1;if(Le(),!U){const a=Be(g,void 0,null,"leave"),c={...a.navigation,cancel:()=>{o=!0,a.reject(new Error("navigation was cancelled"))}};p.before_navigate.forEach(h=>h(c))}o?(n.preventDefault(),n.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&Le()}),(i=navigator.connection)!=null&&i.saveData||Ye(),f.addEventListener("click",n=>{var P;if(n.button||n.which!==1||n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||n.defaultPrevented)return;const o=Me(n.composedPath()[0],f);if(!o)return;const{url:a,external:c,target:h,download:v}=_e(o,J);if(!a)return;if(h==="_parent"||h==="_top"){if(window.parent!==window)return}else if(h&&h!=="_self")return;const b=le(o);if(!(o instanceof SVGAElement)&&a.protocol!==location.protocol&&!(a.protocol==="https:"||a.protocol==="http:")||v)return;if(c||b.reload){Ne({url:a,type:"link"})?U=!0:n.preventDefault();return}const[L,A]=a.href.split("#");if(A!==void 0&&L===location.href.split("#")[0]){if(g.url.hash===a.hash){n.preventDefault(),(P=o.ownerDocument.getElementById(A))==null||P.scrollIntoView();return}if(H=!0,Ee(T),e(a),!b.replace_state)return;H=!1,n.preventDefault()}ce({url:a,scroll:b.noscroll?ee():null,keepfocus:b.keep_focus??!1,redirect_chain:[],details:{state:{},replaceState:b.replace_state??a.href===location.href},accepted:()=>n.preventDefault(),blocked:()=>n.preventDefault(),type:"link"})}),f.addEventListener("submit",n=>{if(n.defaultPrevented)return;const o=HTMLFormElement.prototype.cloneNode.call(n.target),a=n.submitter;if(((a==null?void 0:a.formMethod)||o.method)!=="get")return;const h=new URL((a==null?void 0:a.hasAttribute("formaction"))&&(a==null?void 0:a.formAction)||o.action);if(ve(h,J))return;const v=n.target,{keep_focus:b,noscroll:_,reload:L,replace_state:A}=le(v);if(L)return;n.preventDefault(),n.stopPropagation();const P=new FormData(v),y=a==null?void 0:a.getAttribute("name");y&&P.append(y,(a==null?void 0:a.getAttribute("value"))??""),h.search=new URLSearchParams(P).toString(),ce({url:h,scroll:_?ee():null,keepfocus:b??!1,redirect_chain:[],details:{state:{},replaceState:A??h.href===location.href},nav_token:{},accepted:()=>{},blocked:()=>{},type:"form"})}),addEventListener("popstate",async n=>{var o;if((o=n.state)!=null&&o[M]){if(n.state[M]===T)return;const a=K[n.state[M]];if(g.url.href.split("#")[0]===location.href.split("#")[0]){K[T]=ee(),T=n.state[M],scrollTo(a.x,a.y);return}const c=n.state[M]-T;await ce({url:new URL(location.href),scroll:a,keepfocus:!1,redirect_chain:[],details:null,accepted:()=>{T=n.state[M]},blocked:()=>{history.go(-c)},type:"popstate",delta:c})}else if(!H){const a=new URL(location.href);e(a)}}),addEventListener("hashchange",()=>{H&&(H=!1,history.replaceState({...history.state,[M]:++T},"",location.href))});for(const n of document.querySelectorAll("link"))n.rel==="icon"&&(n.href=n.href);addEventListener("pageshow",n=>{n.persisted&&F.navigating.set(null)});function e(n){g.url=n,F.page.set({...q,url:n}),F.page.notify()}},_hydrate:async({status:e=200,error:i,node_ids:n,params:o,route:a,data:c,form:h})=>{D=!0;const v=new URL(location.href);({params:o={},route:a={id:null}}=X(v,!1)||{});let b;try{const _=n.map(async(P,y)=>{const m=c[y];return m!=null&&m.uses&&(m.uses=We(m.uses)),de({loader:t.nodes[P],url:v,params:o,route:a,parent:async()=>{const O={};for(let j=0;jP===a.id);if(A){const P=A.layouts;for(let y=0;yd?"1":"0").join(""));const s=await fe(u.href);if(!s.ok)throw new te(s.status,await s.json());return new Promise(async d=>{var g;const f=new Map,E=s.body.getReader(),l=new TextDecoder;function w(D){return bt(D,{Promise:x=>new Promise((k,N)=>{f.set(x,{fulfil:k,reject:N})})})}let p="";for(;;){const{done:D,value:x}=await E.read();if(D&&!p)break;for(p+=!x&&p?` `:l.decode(x);;){const k=p.indexOf(` `);if(k===-1)break;const N=JSON.parse(p.slice(0,k));if(p=p.slice(k+1),N.type==="redirect")return d(N);if(N.type==="data")(g=N.nodes)==null||g.forEach(U=>{(U==null?void 0:U.type)==="data"&&(U.uses=We(U.uses),U.data=w(U.data))}),d(N);else if(N.type==="chunk"){const{id:U,data:H,error:B}=N,V=f.get(U);f.delete(U),B?V.reject(w(B)):V.fulfil(w(H))}}}})}function We(t){return{dependencies:new Set((t==null?void 0:t.dependencies)??[]),params:new Set((t==null?void 0:t.params)??[]),parent:!!(t!=null&&t.parent),route:!!(t!=null&&t.route),url:!!(t!=null&&t.url)}}function Se(){const t=document.querySelector("[autofocus]");if(t)t.focus();else{const r=document.body,u=r.getAttribute("tabindex");r.tabIndex=-1,r.focus({preventScroll:!0,focusVisible:!1}),u!==null?r.setAttribute("tabindex",u):r.removeAttribute("tabindex");const s=getSelection();if(s&&s.type!=="None"){const d=[];for(let f=0;f{if(s.rangeCount===d.length){for(let f=0;f{d=g,f=D});return E.catch(()=>{}),{navigation:{from:{params:t.params,route:{id:((w=t.route)==null?void 0:w.id)??null},url:t.url},to:u&&{params:(r==null?void 0:r.params)??null,route:{id:((p=r==null?void 0:r.route)==null?void 0:p.id)??null},url:u},willUnload:!r,type:s,complete:E},fulfil:d,reject:f}}async function Ut(t,r,u){const s=It(t,r);Xe({client:s}),u?await s._hydrate(u):s.goto(location.href,{replaceState:!0}),s._start_router()}export{Ut as start}; diff --git a/_app/immutable/nodes/0.322db14c.js b/_app/immutable/nodes/0.843dc185.js similarity index 99% rename from _app/immutable/nodes/0.322db14c.js rename to _app/immutable/nodes/0.843dc185.js index e1deadc..f4d7db9 100644 --- a/_app/immutable/nodes/0.322db14c.js +++ b/_app/immutable/nodes/0.843dc185.js @@ -1,3 +1,3 @@ -import{S as va,i as ma,s as pa,C as Ca,k as f,l as _,m as c,h as s,n as e,p as La,b as j,D as Na,E as Da,F as Sa,g as ue,d as fe,y as Ue,z as Fe,A as Re,B as qe,G as $a,H as Hl,o as Ha,a as I,q as S,I as B,c as L,r as H,J as T,K as l,L as fa,e as _a,M as Ma,v as Pl,f as Zl,u as xe,N as Ee,O as Pa,P as bl,Q as Za,R as Bl,T as Tl,U as jl}from"../chunks/index.ba35b81f.js";import{b as Gl}from"../chunks/paths.b7f7cd27.js";import{T as Ol,A as Yl,a as Ul,t as Fl}from"../chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js";const Rl=!0,ql="always",St=Object.freeze(Object.defineProperty({__proto__:null,prerender:Rl,trailingSlash:ql},Symbol.toStringTag,{value:"Module"}));function zl(r){let a,t;const o=r[1].default,i=Ca(o,r,r[0],null);return{c(){a=f("main"),i&&i.c(),this.h()},l(n){a=_(n,"MAIN",{id:!0,tabindex:!0,style:!0});var d=c(a);i&&i.l(d),d.forEach(s),this.h()},h(){e(a,"id","main"),e(a,"tabindex","-1"),La(a,"display","block")},m(n,d){j(n,a,d),i&&i.m(a,null),t=!0},p(n,[d]){i&&i.p&&(!t||d&1)&&Na(i,o,n,n[0],t?Sa(o,n[0],d,null):Da(n[0]),null)},i(n){t||(ue(i,n),t=!0)},o(n){fe(i,n),t=!1},d(n){n&&s(a),i&&i.d(n)}}}function Wl(r,a,t){let{$$slots:o={},$$scope:i}=a;return r.$$set=n=>{"$$scope"in n&&t(0,i=n.$$scope)},[i,o]}class Kl extends va{constructor(a){super(),ma(this,a,Wl,zl,pa,{})}}const Jl=r=>({}),yl=r=>({});function Ql(r){let a,t,o,i=r[5]("Help")+"",n,d,h,u,m,E=r[5]("Accessibility")+"",b,p,v,g,w=r[5]("Cookies")+"",k,A,M,C,P=r[5]("Privacy")+"",N,U,Z,D,O=r[5]("Terms and conditions")+"",$,K,z,V,R=r[5]("About ONS")+"",W,ve,X,ne,se,me=r[5]("What we do")+"",x,ee,le,J,ie=r[5]("Careers")+"",G,de,Q,ae,ce=r[5]("Contact us")+"",Oe,he,pe,we,ze=r[5]("News")+"",Me,ke,re,_e,$e=r[5]("Freedom of Information")+"",oe,la,Ne,We,ta=r[5]("Connect with us")+"",ge,Be,q,Ve,te,ga=r[5]("Twitter")+"",ea,be,y,F,Y=r[5]("Instagram")+"",Ce,ra,Ke,De,ba=r[5]("Facebook")+"",oa,na,Se,Ae,ya=r[5]("LinkedIn")+"",ia,ca,Je,He,Ea=r[5]("Consultations")+"",Te,ha,Qe,Pe,wa=r[5]("Discussion forums")+"",ua,je,Xe,Ie,ka=r[5]("Email alerts")+"",da,sa,Le;return{c(){a=f("div"),t=f("div"),o=f("h2"),n=S(i),d=I(),h=f("ul"),u=f("li"),m=f("a"),b=S(E),p=I(),v=f("li"),g=f("a"),k=S(w),A=I(),M=f("li"),C=f("a"),N=S(P),U=I(),Z=f("li"),D=f("a"),$=S(O),K=I(),z=f("div"),V=f("h2"),W=S(R),ve=I(),X=f("ul"),ne=f("li"),se=f("a"),x=S(me),ee=I(),le=f("li"),J=f("a"),G=S(ie),de=I(),Q=f("li"),ae=f("a"),Oe=S(ce),he=I(),pe=f("li"),we=f("a"),Me=S(ze),ke=I(),re=f("li"),_e=f("a"),oe=S($e),la=I(),Ne=f("div"),We=f("h2"),ge=S(ta),Be=I(),q=f("ul"),Ve=f("li"),te=f("a"),ea=S(ga),be=I(),y=f("li"),F=f("a"),Ce=S(Y),ra=I(),Ke=f("li"),De=f("a"),oa=S(ba),na=I(),Se=f("li"),Ae=f("a"),ia=S(ya),ca=I(),Je=f("li"),He=f("a"),Te=S(Ea),ha=I(),Qe=f("li"),Pe=f("a"),ua=S(wa),je=I(),Xe=f("li"),Ie=f("a"),da=S(ka),sa=I(),Le=f("hr"),this.h()},l(Ze){a=_(Ze,"DIV",{class:!0});var Ge=c(a);t=_(Ge,"DIV",{class:!0});var Va=c(t);o=_(Va,"H2",{class:!0});var Ba=c(o);n=H(Ba,i),Ba.forEach(s),d=L(Va),h=_(Va,"UL",{class:!0});var aa=c(h);u=_(aa,"LI",{class:!0});var Ta=c(u);m=_(Ta,"A",{href:!0,class:!0});var ja=c(m);b=H(ja,E),ja.forEach(s),Ta.forEach(s),p=L(aa),v=_(aa,"LI",{class:!0});var Ga=c(v);g=_(Ga,"A",{href:!0,class:!0});var Ya=c(g);k=H(Ya,w),Ya.forEach(s),Ga.forEach(s),A=L(aa),M=_(aa,"LI",{class:!0});var Ua=c(M);C=_(Ua,"A",{href:!0,class:!0});var Fa=c(C);N=H(Fa,P),Fa.forEach(s),Ua.forEach(s),U=L(aa),Z=_(aa,"LI",{class:!0});var Ra=c(Z);D=_(Ra,"A",{href:!0,class:!0});var qa=c(D);$=H(qa,O),qa.forEach(s),Ra.forEach(s),aa.forEach(s),Va.forEach(s),K=L(Ge),z=_(Ge,"DIV",{class:!0});var Aa=c(z);V=_(Aa,"H2",{class:!0});var za=c(V);W=H(za,R),za.forEach(s),ve=L(Aa),X=_(Aa,"UL",{class:!0});var Ye=c(X);ne=_(Ye,"LI",{class:!0});var Wa=c(ne);se=_(Wa,"A",{href:!0,class:!0});var Ka=c(se);x=H(Ka,me),Ka.forEach(s),Wa.forEach(s),ee=L(Ye),le=_(Ye,"LI",{class:!0});var Ja=c(le);J=_(Ja,"A",{href:!0,class:!0});var Qa=c(J);G=H(Qa,ie),Qa.forEach(s),Ja.forEach(s),de=L(Ye),Q=_(Ye,"LI",{class:!0});var Xa=c(Q);ae=_(Xa,"A",{href:!0,class:!0});var xa=c(ae);Oe=H(xa,ce),xa.forEach(s),Xa.forEach(s),he=L(Ye),pe=_(Ye,"LI",{class:!0});var el=c(pe);we=_(el,"A",{href:!0,class:!0});var al=c(we);Me=H(al,ze),al.forEach(s),el.forEach(s),ke=L(Ye),re=_(Ye,"LI",{class:!0});var ll=c(re);_e=_(ll,"A",{href:!0,class:!0});var tl=c(_e);oe=H(tl,$e),tl.forEach(s),ll.forEach(s),Ye.forEach(s),Aa.forEach(s),la=L(Ge),Ne=_(Ge,"DIV",{class:!0});var Ia=c(Ne);We=_(Ia,"H2",{class:!0});var sl=c(We);ge=H(sl,ta),sl.forEach(s),Be=L(Ia),q=_(Ia,"UL",{class:!0});var ye=c(q);Ve=_(ye,"LI",{class:!0});var rl=c(Ve);te=_(rl,"A",{href:!0,class:!0,target:!0});var ol=c(te);ea=H(ol,ga),ol.forEach(s),rl.forEach(s),be=L(ye),y=_(ye,"LI",{class:!0});var nl=c(y);F=_(nl,"A",{href:!0,class:!0,target:!0});var il=c(F);Ce=H(il,Y),il.forEach(s),nl.forEach(s),ra=L(ye),Ke=_(ye,"LI",{class:!0});var cl=c(Ke);De=_(cl,"A",{href:!0,class:!0,target:!0});var hl=c(De);oa=H(hl,ba),hl.forEach(s),cl.forEach(s),na=L(ye),Se=_(ye,"LI",{class:!0});var ul=c(Se);Ae=_(ul,"A",{href:!0,class:!0,target:!0});var dl=c(Ae);ia=H(dl,ya),dl.forEach(s),ul.forEach(s),ca=L(ye),Je=_(ye,"LI",{class:!0});var fl=c(Je);He=_(fl,"A",{href:!0,class:!0,target:!0});var _l=c(He);Te=H(_l,Ea),_l.forEach(s),fl.forEach(s),ha=L(ye),Qe=_(ye,"LI",{class:!0});var vl=c(Qe);Pe=_(vl,"A",{href:!0,class:!0,target:!0});var ml=c(Pe);ua=H(ml,wa),ml.forEach(s),vl.forEach(s),je=L(ye),Xe=_(ye,"LI",{class:!0});var pl=c(Xe);Ie=_(pl,"A",{href:!0,class:!0,target:!0});var gl=c(Ie);da=H(gl,ka),gl.forEach(s),pl.forEach(s),ye.forEach(s),Ia.forEach(s),Ge.forEach(s),sa=L(Ze),Le=_(Ze,"HR",{class:!0}),this.h()},h(){e(o,"class","footer-nav__heading"),e(m,"href","/help/accessibility"),e(m,"class","svelte-1eaiwge"),e(u,"class","footer-nav__item"),e(g,"href","/cookies"),e(g,"class","svelte-1eaiwge"),e(v,"class","footer-nav__item"),e(C,"href","/help/privacynotice"),e(C,"class","svelte-1eaiwge"),e(M,"class","footer-nav__item"),e(D,"href","/help/termsandconditions"),e(D,"class","svelte-1eaiwge"),e(Z,"class","footer-nav__item"),e(h,"class","footer-nav__list"),e(t,"class","col col--lg-one-third col--md-one-third"),e(V,"class","footer-nav__heading"),e(se,"href","/aboutus/whatwedo"),e(se,"class","svelte-1eaiwge"),e(ne,"class","footer-nav__item"),e(J,"href","/aboutus/careers"),e(J,"class","svelte-1eaiwge"),e(le,"class","footer-nav__item"),e(ae,"href","/aboutus/contactus"),e(ae,"class","svelte-1eaiwge"),e(Q,"class","footer-nav__item"),e(we,"href","/news"),e(we,"class","svelte-1eaiwge"),e(pe,"class","footer-nav__item"),e(_e,"href","/aboutus/transparencyandgovernance/freedomofinformationfoi"),e(_e,"class","svelte-1eaiwge"),e(re,"class","footer-nav__item"),e(X,"class","footer-nav__list"),e(z,"class","col col--lg-one-third col--md-one-third"),e(We,"class","footer-nav__heading"),e(te,"href","https://twitter.com/ONS"),e(te,"class","icon--hide svelte-1eaiwge"),e(te,"target","_blank"),e(Ve,"class","footer-nav__item"),e(F,"href","https://www.instagram.com/officefornationalstatistics/"),e(F,"class","icon--hide svelte-1eaiwge"),e(F,"target","_blank"),e(y,"class","footer-nav__item"),e(De,"href","https://www.facebook.com/ONS"),e(De,"class","icon--hide svelte-1eaiwge"),e(De,"target","_blank"),e(Ke,"class","footer-nav__item"),e(Ae,"href","https://www.linkedin.com/company/office-for-national-statistics"),e(Ae,"class","icon--hide svelte-1eaiwge"),e(Ae,"target","_blank"),e(Se,"class","footer-nav__item"),e(He,"href","https://consultations.ons.gov.uk/"),e(He,"class","icon--hide svelte-1eaiwge"),e(He,"target","_blank"),e(Je,"class","footer-nav__item"),e(Pe,"href","https://www.statsusernet.org.uk/login"),e(Pe,"class","icon--hide svelte-1eaiwge"),e(Pe,"target","_blank"),e(Qe,"class","footer-nav__item"),e(Ie,"href","https://public.govdelivery.com/accounts/UKONS/subscribers/new"),e(Ie,"class","icon--hide svelte-1eaiwge"),e(Ie,"target","_blank"),e(Xe,"class","footer-nav__item"),e(q,"class","footer-nav__list"),e(Ne,"class","col col--lg-one-third col--md-one-third"),e(a,"class","footer-nav col-wrap"),e(Le,"class","ons-footer__hr")},m(Ze,Ge){j(Ze,a,Ge),l(a,t),l(t,o),l(o,n),l(t,d),l(t,h),l(h,u),l(u,m),l(m,b),l(h,p),l(h,v),l(v,g),l(g,k),l(h,A),l(h,M),l(M,C),l(C,N),l(h,U),l(h,Z),l(Z,D),l(D,$),l(a,K),l(a,z),l(z,V),l(V,W),l(z,ve),l(z,X),l(X,ne),l(ne,se),l(se,x),l(X,ee),l(X,le),l(le,J),l(J,G),l(X,de),l(X,Q),l(Q,ae),l(ae,Oe),l(X,he),l(X,pe),l(pe,we),l(we,Me),l(X,ke),l(X,re),l(re,_e),l(_e,oe),l(a,la),l(a,Ne),l(Ne,We),l(We,ge),l(Ne,Be),l(Ne,q),l(q,Ve),l(Ve,te),l(te,ea),l(q,be),l(q,y),l(y,F),l(F,Ce),l(q,ra),l(q,Ke),l(Ke,De),l(De,oa),l(q,na),l(q,Se),l(Se,Ae),l(Ae,ia),l(q,ca),l(q,Je),l(Je,He),l(He,Te),l(q,ha),l(q,Qe),l(Qe,Pe),l(Pe,ua),l(q,je),l(q,Xe),l(Xe,Ie),l(Ie,da),j(Ze,sa,Ge),j(Ze,Le,Ge)},p:fa,d(Ze){Ze&&s(a),Ze&&s(sa),Ze&&s(Le)}}}function Xl(r){let a,t,o,i=r[5]("Accessibility")+"",n,d,h,u,m=r[5]("Cookies")+"",E,b,p,v,g=r[5]("Privacy")+"",w,k,A,M,C=r[5]("Terms and conditions")+"",P;return{c(){a=f("ul"),t=f("li"),o=f("a"),n=S(i),d=I(),h=f("li"),u=f("a"),E=S(m),b=I(),p=f("li"),v=f("a"),w=S(g),k=I(),A=f("li"),M=f("a"),P=S(C),this.h()},l(N){a=_(N,"UL",{class:!0});var U=c(a);t=_(U,"LI",{class:!0});var Z=c(t);o=_(Z,"A",{href:!0,class:!0});var D=c(o);n=H(D,i),D.forEach(s),Z.forEach(s),d=L(U),h=_(U,"LI",{class:!0});var O=c(h);u=_(O,"A",{href:!0,class:!0});var $=c(u);E=H($,m),$.forEach(s),O.forEach(s),b=L(U),p=_(U,"LI",{class:!0});var K=c(p);v=_(K,"A",{href:!0,class:!0});var z=c(v);w=H(z,g),z.forEach(s),K.forEach(s),k=L(U),A=_(U,"LI",{class:!0});var V=c(A);M=_(V,"A",{href:!0,class:!0});var R=c(M);P=H(R,C),R.forEach(s),V.forEach(s),U.forEach(s),this.h()},h(){e(o,"href","/help/accessibility"),e(o,"class","ons-list__link svelte-1eaiwge"),e(t,"class","ons-list__item"),e(u,"href","/cookies"),e(u,"class","ons-list__link svelte-1eaiwge"),e(h,"class","ons-list__item"),e(v,"href","/help/privacynotice"),e(v,"class","ons-list__link svelte-1eaiwge"),e(p,"class","ons-list__item"),e(M,"href","/help/termsandconditions"),e(M,"class","ons-list__link svelte-1eaiwge"),e(A,"class","ons-list__item"),e(a,"class","ons-list ons-u-mt-m ons-footer--rows ons-list--bare ons-list--inline")},m(N,U){j(N,a,U),l(a,t),l(t,o),l(o,n),l(a,d),l(a,h),l(h,u),l(u,E),l(a,b),l(a,p),l(p,v),l(v,w),l(a,k),l(a,A),l(A,M),l(M,P)},p:fa,d(N){N&&s(a)}}}function xl(r){let a,t,o,i,n=r[5]("Footer links")+"",d,h,u,m,E,b,p,v,g,w,k,A,M=r[5]("All content is available under the")+"",C,P,N,U=r[5]("Open Government Licence v3.0")+"",Z,D,O,$,K,z,V,R=r[5]("except where otherwise stated")+"",W,ve,X,ne,se,me,x,ee;const le=r[8].before,J=Ca(le,r,r[9],yl);function ie(Q,ae){return Q[0]?Xl:Ql}let G=ie(r),de=G(r);return{c(){a=f("footer"),t=f("section"),J&&J.c(),o=I(),i=f("h2"),d=S(n),h=I(),u=f("div"),m=f("div"),E=f("nav"),de.c(),b=I(),p=f("div"),v=f("div"),g=B("svg"),w=B("path"),k=I(),A=f("p"),C=S(M),P=I(),N=f("a"),Z=S(U),D=f("span"),O=B("svg"),$=B("path"),K=B("path"),V=S(" , "),W=S(R),ve=I(),X=f("div"),ne=I(),se=f("div"),me=I(),x=f("div"),this.h()},l(Q){a=_(Q,"FOOTER",{class:!0});var ae=c(a);t=_(ae,"SECTION",{});var ce=c(t);J&&J.l(ce),o=L(ce),i=_(ce,"H2",{class:!0});var Oe=c(i);d=H(Oe,n),Oe.forEach(s),h=L(ce),u=_(ce,"DIV",{class:!0});var he=c(u);m=_(he,"DIV",{class:!0});var pe=c(m);E=_(pe,"NAV",{"aria-label":!0});var we=c(E);de.l(we),we.forEach(s),pe.forEach(s),b=L(he),p=_(he,"DIV",{class:!0});var ze=c(p);v=_(ze,"DIV",{class:!0});var Me=c(v);g=T(Me,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,focusable:!0,"aria-hidden":!0});var ke=c(g);w=T(ke,"path",{d:!0,fill:!0}),c(w).forEach(s),ke.forEach(s),k=L(Me),A=_(Me,"P",{class:!0});var re=c(A);C=H(re,M),P=L(re),N=_(re,"A",{class:!0,href:!0,target:!0});var _e=c(N);Z=H(_e,U),D=_(_e,"SPAN",{class:!0});var $e=c(D);O=T($e,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var oe=c(O);$=T(oe,"path",{d:!0,transform:!0}),c($).forEach(s),K=T(oe,"path",{d:!0,transform:!0}),c(K).forEach(s),oe.forEach(s),$e.forEach(s),_e.forEach(s),V=H(re," , "),W=H(re,R),re.forEach(s),Me.forEach(s),ze.forEach(s),he.forEach(s),ce.forEach(s),ve=L(ae),X=_(ae,"DIV",{id:!0,class:!0}),c(X).forEach(s),ne=L(ae),se=_(ae,"DIV",{id:!0,class:!0}),c(se).forEach(s),me=L(ae),x=_(ae,"DIV",{id:!0,class:!0}),c(x).forEach(s),ae.forEach(s),this.h()},h(){e(i,"class","visuallyhidden"),e(E,"aria-label","Footer links"),e(m,"class","wrapper"),e(w,"d",`M51.7,17.5V0l-6.2,4v19.8h13.8v-6.2H51.7z +import{S as va,i as ma,s as pa,C as Ca,k as f,l as _,m as c,h as s,n as e,p as La,b as j,D as Na,E as Da,F as Sa,g as ue,d as fe,y as Ue,z as Fe,A as Re,B as qe,G as $a,H as Hl,o as Ha,a as I,q as S,I as B,c as L,r as H,J as T,K as l,L as fa,e as _a,M as Ma,v as Pl,f as Zl,u as xe,N as Ee,O as Pa,P as bl,Q as Za,R as Bl,T as Tl,U as jl}from"../chunks/index.ba35b81f.js";import{b as Gl}from"../chunks/paths.10d75873.js";import{T as Ol,A as Yl,a as Ul,t as Fl}from"../chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js";const Rl=!0,ql="always",St=Object.freeze(Object.defineProperty({__proto__:null,prerender:Rl,trailingSlash:ql},Symbol.toStringTag,{value:"Module"}));function zl(r){let a,t;const o=r[1].default,i=Ca(o,r,r[0],null);return{c(){a=f("main"),i&&i.c(),this.h()},l(n){a=_(n,"MAIN",{id:!0,tabindex:!0,style:!0});var d=c(a);i&&i.l(d),d.forEach(s),this.h()},h(){e(a,"id","main"),e(a,"tabindex","-1"),La(a,"display","block")},m(n,d){j(n,a,d),i&&i.m(a,null),t=!0},p(n,[d]){i&&i.p&&(!t||d&1)&&Na(i,o,n,n[0],t?Sa(o,n[0],d,null):Da(n[0]),null)},i(n){t||(ue(i,n),t=!0)},o(n){fe(i,n),t=!1},d(n){n&&s(a),i&&i.d(n)}}}function Wl(r,a,t){let{$$slots:o={},$$scope:i}=a;return r.$$set=n=>{"$$scope"in n&&t(0,i=n.$$scope)},[i,o]}class Kl extends va{constructor(a){super(),ma(this,a,Wl,zl,pa,{})}}const Jl=r=>({}),yl=r=>({});function Ql(r){let a,t,o,i=r[5]("Help")+"",n,d,h,u,m,E=r[5]("Accessibility")+"",b,p,v,g,w=r[5]("Cookies")+"",k,A,M,C,P=r[5]("Privacy")+"",N,U,Z,D,O=r[5]("Terms and conditions")+"",$,K,z,V,R=r[5]("About ONS")+"",W,ve,X,ne,se,me=r[5]("What we do")+"",x,ee,le,J,ie=r[5]("Careers")+"",G,de,Q,ae,ce=r[5]("Contact us")+"",Oe,he,pe,we,ze=r[5]("News")+"",Me,ke,re,_e,$e=r[5]("Freedom of Information")+"",oe,la,Ne,We,ta=r[5]("Connect with us")+"",ge,Be,q,Ve,te,ga=r[5]("Twitter")+"",ea,be,y,F,Y=r[5]("Instagram")+"",Ce,ra,Ke,De,ba=r[5]("Facebook")+"",oa,na,Se,Ae,ya=r[5]("LinkedIn")+"",ia,ca,Je,He,Ea=r[5]("Consultations")+"",Te,ha,Qe,Pe,wa=r[5]("Discussion forums")+"",ua,je,Xe,Ie,ka=r[5]("Email alerts")+"",da,sa,Le;return{c(){a=f("div"),t=f("div"),o=f("h2"),n=S(i),d=I(),h=f("ul"),u=f("li"),m=f("a"),b=S(E),p=I(),v=f("li"),g=f("a"),k=S(w),A=I(),M=f("li"),C=f("a"),N=S(P),U=I(),Z=f("li"),D=f("a"),$=S(O),K=I(),z=f("div"),V=f("h2"),W=S(R),ve=I(),X=f("ul"),ne=f("li"),se=f("a"),x=S(me),ee=I(),le=f("li"),J=f("a"),G=S(ie),de=I(),Q=f("li"),ae=f("a"),Oe=S(ce),he=I(),pe=f("li"),we=f("a"),Me=S(ze),ke=I(),re=f("li"),_e=f("a"),oe=S($e),la=I(),Ne=f("div"),We=f("h2"),ge=S(ta),Be=I(),q=f("ul"),Ve=f("li"),te=f("a"),ea=S(ga),be=I(),y=f("li"),F=f("a"),Ce=S(Y),ra=I(),Ke=f("li"),De=f("a"),oa=S(ba),na=I(),Se=f("li"),Ae=f("a"),ia=S(ya),ca=I(),Je=f("li"),He=f("a"),Te=S(Ea),ha=I(),Qe=f("li"),Pe=f("a"),ua=S(wa),je=I(),Xe=f("li"),Ie=f("a"),da=S(ka),sa=I(),Le=f("hr"),this.h()},l(Ze){a=_(Ze,"DIV",{class:!0});var Ge=c(a);t=_(Ge,"DIV",{class:!0});var Va=c(t);o=_(Va,"H2",{class:!0});var Ba=c(o);n=H(Ba,i),Ba.forEach(s),d=L(Va),h=_(Va,"UL",{class:!0});var aa=c(h);u=_(aa,"LI",{class:!0});var Ta=c(u);m=_(Ta,"A",{href:!0,class:!0});var ja=c(m);b=H(ja,E),ja.forEach(s),Ta.forEach(s),p=L(aa),v=_(aa,"LI",{class:!0});var Ga=c(v);g=_(Ga,"A",{href:!0,class:!0});var Ya=c(g);k=H(Ya,w),Ya.forEach(s),Ga.forEach(s),A=L(aa),M=_(aa,"LI",{class:!0});var Ua=c(M);C=_(Ua,"A",{href:!0,class:!0});var Fa=c(C);N=H(Fa,P),Fa.forEach(s),Ua.forEach(s),U=L(aa),Z=_(aa,"LI",{class:!0});var Ra=c(Z);D=_(Ra,"A",{href:!0,class:!0});var qa=c(D);$=H(qa,O),qa.forEach(s),Ra.forEach(s),aa.forEach(s),Va.forEach(s),K=L(Ge),z=_(Ge,"DIV",{class:!0});var Aa=c(z);V=_(Aa,"H2",{class:!0});var za=c(V);W=H(za,R),za.forEach(s),ve=L(Aa),X=_(Aa,"UL",{class:!0});var Ye=c(X);ne=_(Ye,"LI",{class:!0});var Wa=c(ne);se=_(Wa,"A",{href:!0,class:!0});var Ka=c(se);x=H(Ka,me),Ka.forEach(s),Wa.forEach(s),ee=L(Ye),le=_(Ye,"LI",{class:!0});var Ja=c(le);J=_(Ja,"A",{href:!0,class:!0});var Qa=c(J);G=H(Qa,ie),Qa.forEach(s),Ja.forEach(s),de=L(Ye),Q=_(Ye,"LI",{class:!0});var Xa=c(Q);ae=_(Xa,"A",{href:!0,class:!0});var xa=c(ae);Oe=H(xa,ce),xa.forEach(s),Xa.forEach(s),he=L(Ye),pe=_(Ye,"LI",{class:!0});var el=c(pe);we=_(el,"A",{href:!0,class:!0});var al=c(we);Me=H(al,ze),al.forEach(s),el.forEach(s),ke=L(Ye),re=_(Ye,"LI",{class:!0});var ll=c(re);_e=_(ll,"A",{href:!0,class:!0});var tl=c(_e);oe=H(tl,$e),tl.forEach(s),ll.forEach(s),Ye.forEach(s),Aa.forEach(s),la=L(Ge),Ne=_(Ge,"DIV",{class:!0});var Ia=c(Ne);We=_(Ia,"H2",{class:!0});var sl=c(We);ge=H(sl,ta),sl.forEach(s),Be=L(Ia),q=_(Ia,"UL",{class:!0});var ye=c(q);Ve=_(ye,"LI",{class:!0});var rl=c(Ve);te=_(rl,"A",{href:!0,class:!0,target:!0});var ol=c(te);ea=H(ol,ga),ol.forEach(s),rl.forEach(s),be=L(ye),y=_(ye,"LI",{class:!0});var nl=c(y);F=_(nl,"A",{href:!0,class:!0,target:!0});var il=c(F);Ce=H(il,Y),il.forEach(s),nl.forEach(s),ra=L(ye),Ke=_(ye,"LI",{class:!0});var cl=c(Ke);De=_(cl,"A",{href:!0,class:!0,target:!0});var hl=c(De);oa=H(hl,ba),hl.forEach(s),cl.forEach(s),na=L(ye),Se=_(ye,"LI",{class:!0});var ul=c(Se);Ae=_(ul,"A",{href:!0,class:!0,target:!0});var dl=c(Ae);ia=H(dl,ya),dl.forEach(s),ul.forEach(s),ca=L(ye),Je=_(ye,"LI",{class:!0});var fl=c(Je);He=_(fl,"A",{href:!0,class:!0,target:!0});var _l=c(He);Te=H(_l,Ea),_l.forEach(s),fl.forEach(s),ha=L(ye),Qe=_(ye,"LI",{class:!0});var vl=c(Qe);Pe=_(vl,"A",{href:!0,class:!0,target:!0});var ml=c(Pe);ua=H(ml,wa),ml.forEach(s),vl.forEach(s),je=L(ye),Xe=_(ye,"LI",{class:!0});var pl=c(Xe);Ie=_(pl,"A",{href:!0,class:!0,target:!0});var gl=c(Ie);da=H(gl,ka),gl.forEach(s),pl.forEach(s),ye.forEach(s),Ia.forEach(s),Ge.forEach(s),sa=L(Ze),Le=_(Ze,"HR",{class:!0}),this.h()},h(){e(o,"class","footer-nav__heading"),e(m,"href","/help/accessibility"),e(m,"class","svelte-1eaiwge"),e(u,"class","footer-nav__item"),e(g,"href","/cookies"),e(g,"class","svelte-1eaiwge"),e(v,"class","footer-nav__item"),e(C,"href","/help/privacynotice"),e(C,"class","svelte-1eaiwge"),e(M,"class","footer-nav__item"),e(D,"href","/help/termsandconditions"),e(D,"class","svelte-1eaiwge"),e(Z,"class","footer-nav__item"),e(h,"class","footer-nav__list"),e(t,"class","col col--lg-one-third col--md-one-third"),e(V,"class","footer-nav__heading"),e(se,"href","/aboutus/whatwedo"),e(se,"class","svelte-1eaiwge"),e(ne,"class","footer-nav__item"),e(J,"href","/aboutus/careers"),e(J,"class","svelte-1eaiwge"),e(le,"class","footer-nav__item"),e(ae,"href","/aboutus/contactus"),e(ae,"class","svelte-1eaiwge"),e(Q,"class","footer-nav__item"),e(we,"href","/news"),e(we,"class","svelte-1eaiwge"),e(pe,"class","footer-nav__item"),e(_e,"href","/aboutus/transparencyandgovernance/freedomofinformationfoi"),e(_e,"class","svelte-1eaiwge"),e(re,"class","footer-nav__item"),e(X,"class","footer-nav__list"),e(z,"class","col col--lg-one-third col--md-one-third"),e(We,"class","footer-nav__heading"),e(te,"href","https://twitter.com/ONS"),e(te,"class","icon--hide svelte-1eaiwge"),e(te,"target","_blank"),e(Ve,"class","footer-nav__item"),e(F,"href","https://www.instagram.com/officefornationalstatistics/"),e(F,"class","icon--hide svelte-1eaiwge"),e(F,"target","_blank"),e(y,"class","footer-nav__item"),e(De,"href","https://www.facebook.com/ONS"),e(De,"class","icon--hide svelte-1eaiwge"),e(De,"target","_blank"),e(Ke,"class","footer-nav__item"),e(Ae,"href","https://www.linkedin.com/company/office-for-national-statistics"),e(Ae,"class","icon--hide svelte-1eaiwge"),e(Ae,"target","_blank"),e(Se,"class","footer-nav__item"),e(He,"href","https://consultations.ons.gov.uk/"),e(He,"class","icon--hide svelte-1eaiwge"),e(He,"target","_blank"),e(Je,"class","footer-nav__item"),e(Pe,"href","https://www.statsusernet.org.uk/login"),e(Pe,"class","icon--hide svelte-1eaiwge"),e(Pe,"target","_blank"),e(Qe,"class","footer-nav__item"),e(Ie,"href","https://public.govdelivery.com/accounts/UKONS/subscribers/new"),e(Ie,"class","icon--hide svelte-1eaiwge"),e(Ie,"target","_blank"),e(Xe,"class","footer-nav__item"),e(q,"class","footer-nav__list"),e(Ne,"class","col col--lg-one-third col--md-one-third"),e(a,"class","footer-nav col-wrap"),e(Le,"class","ons-footer__hr")},m(Ze,Ge){j(Ze,a,Ge),l(a,t),l(t,o),l(o,n),l(t,d),l(t,h),l(h,u),l(u,m),l(m,b),l(h,p),l(h,v),l(v,g),l(g,k),l(h,A),l(h,M),l(M,C),l(C,N),l(h,U),l(h,Z),l(Z,D),l(D,$),l(a,K),l(a,z),l(z,V),l(V,W),l(z,ve),l(z,X),l(X,ne),l(ne,se),l(se,x),l(X,ee),l(X,le),l(le,J),l(J,G),l(X,de),l(X,Q),l(Q,ae),l(ae,Oe),l(X,he),l(X,pe),l(pe,we),l(we,Me),l(X,ke),l(X,re),l(re,_e),l(_e,oe),l(a,la),l(a,Ne),l(Ne,We),l(We,ge),l(Ne,Be),l(Ne,q),l(q,Ve),l(Ve,te),l(te,ea),l(q,be),l(q,y),l(y,F),l(F,Ce),l(q,ra),l(q,Ke),l(Ke,De),l(De,oa),l(q,na),l(q,Se),l(Se,Ae),l(Ae,ia),l(q,ca),l(q,Je),l(Je,He),l(He,Te),l(q,ha),l(q,Qe),l(Qe,Pe),l(Pe,ua),l(q,je),l(q,Xe),l(Xe,Ie),l(Ie,da),j(Ze,sa,Ge),j(Ze,Le,Ge)},p:fa,d(Ze){Ze&&s(a),Ze&&s(sa),Ze&&s(Le)}}}function Xl(r){let a,t,o,i=r[5]("Accessibility")+"",n,d,h,u,m=r[5]("Cookies")+"",E,b,p,v,g=r[5]("Privacy")+"",w,k,A,M,C=r[5]("Terms and conditions")+"",P;return{c(){a=f("ul"),t=f("li"),o=f("a"),n=S(i),d=I(),h=f("li"),u=f("a"),E=S(m),b=I(),p=f("li"),v=f("a"),w=S(g),k=I(),A=f("li"),M=f("a"),P=S(C),this.h()},l(N){a=_(N,"UL",{class:!0});var U=c(a);t=_(U,"LI",{class:!0});var Z=c(t);o=_(Z,"A",{href:!0,class:!0});var D=c(o);n=H(D,i),D.forEach(s),Z.forEach(s),d=L(U),h=_(U,"LI",{class:!0});var O=c(h);u=_(O,"A",{href:!0,class:!0});var $=c(u);E=H($,m),$.forEach(s),O.forEach(s),b=L(U),p=_(U,"LI",{class:!0});var K=c(p);v=_(K,"A",{href:!0,class:!0});var z=c(v);w=H(z,g),z.forEach(s),K.forEach(s),k=L(U),A=_(U,"LI",{class:!0});var V=c(A);M=_(V,"A",{href:!0,class:!0});var R=c(M);P=H(R,C),R.forEach(s),V.forEach(s),U.forEach(s),this.h()},h(){e(o,"href","/help/accessibility"),e(o,"class","ons-list__link svelte-1eaiwge"),e(t,"class","ons-list__item"),e(u,"href","/cookies"),e(u,"class","ons-list__link svelte-1eaiwge"),e(h,"class","ons-list__item"),e(v,"href","/help/privacynotice"),e(v,"class","ons-list__link svelte-1eaiwge"),e(p,"class","ons-list__item"),e(M,"href","/help/termsandconditions"),e(M,"class","ons-list__link svelte-1eaiwge"),e(A,"class","ons-list__item"),e(a,"class","ons-list ons-u-mt-m ons-footer--rows ons-list--bare ons-list--inline")},m(N,U){j(N,a,U),l(a,t),l(t,o),l(o,n),l(a,d),l(a,h),l(h,u),l(u,E),l(a,b),l(a,p),l(p,v),l(v,w),l(a,k),l(a,A),l(A,M),l(M,P)},p:fa,d(N){N&&s(a)}}}function xl(r){let a,t,o,i,n=r[5]("Footer links")+"",d,h,u,m,E,b,p,v,g,w,k,A,M=r[5]("All content is available under the")+"",C,P,N,U=r[5]("Open Government Licence v3.0")+"",Z,D,O,$,K,z,V,R=r[5]("except where otherwise stated")+"",W,ve,X,ne,se,me,x,ee;const le=r[8].before,J=Ca(le,r,r[9],yl);function ie(Q,ae){return Q[0]?Xl:Ql}let G=ie(r),de=G(r);return{c(){a=f("footer"),t=f("section"),J&&J.c(),o=I(),i=f("h2"),d=S(n),h=I(),u=f("div"),m=f("div"),E=f("nav"),de.c(),b=I(),p=f("div"),v=f("div"),g=B("svg"),w=B("path"),k=I(),A=f("p"),C=S(M),P=I(),N=f("a"),Z=S(U),D=f("span"),O=B("svg"),$=B("path"),K=B("path"),V=S(" , "),W=S(R),ve=I(),X=f("div"),ne=I(),se=f("div"),me=I(),x=f("div"),this.h()},l(Q){a=_(Q,"FOOTER",{class:!0});var ae=c(a);t=_(ae,"SECTION",{});var ce=c(t);J&&J.l(ce),o=L(ce),i=_(ce,"H2",{class:!0});var Oe=c(i);d=H(Oe,n),Oe.forEach(s),h=L(ce),u=_(ce,"DIV",{class:!0});var he=c(u);m=_(he,"DIV",{class:!0});var pe=c(m);E=_(pe,"NAV",{"aria-label":!0});var we=c(E);de.l(we),we.forEach(s),pe.forEach(s),b=L(he),p=_(he,"DIV",{class:!0});var ze=c(p);v=_(ze,"DIV",{class:!0});var Me=c(v);g=T(Me,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,focusable:!0,"aria-hidden":!0});var ke=c(g);w=T(ke,"path",{d:!0,fill:!0}),c(w).forEach(s),ke.forEach(s),k=L(Me),A=_(Me,"P",{class:!0});var re=c(A);C=H(re,M),P=L(re),N=_(re,"A",{class:!0,href:!0,target:!0});var _e=c(N);Z=H(_e,U),D=_(_e,"SPAN",{class:!0});var $e=c(D);O=T($e,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var oe=c(O);$=T(oe,"path",{d:!0,transform:!0}),c($).forEach(s),K=T(oe,"path",{d:!0,transform:!0}),c(K).forEach(s),oe.forEach(s),$e.forEach(s),_e.forEach(s),V=H(re," , "),W=H(re,R),re.forEach(s),Me.forEach(s),ze.forEach(s),he.forEach(s),ce.forEach(s),ve=L(ae),X=_(ae,"DIV",{id:!0,class:!0}),c(X).forEach(s),ne=L(ae),se=_(ae,"DIV",{id:!0,class:!0}),c(se).forEach(s),me=L(ae),x=_(ae,"DIV",{id:!0,class:!0}),c(x).forEach(s),ae.forEach(s),this.h()},h(){e(i,"class","visuallyhidden"),e(E,"aria-label","Footer links"),e(m,"class","wrapper"),e(w,"d",`M51.7,17.5V0l-6.2,4v19.8h13.8v-6.2H51.7z M36.7,16.3c-1,0.9-2.4,1.4-3.8,1.4c-3.2,0-5.8-2.6-5.8-5.8s2.6-5.8,5.8-5.8c2,0,3.9,1.1,4.9,2.7L43,5.6C40.9,2.2,37.1,0,32.9,0c-4.5,0-8.4,2.5-10.4,6.1C20.4,2.5,16.5,0,12,0C5.4,0,0,5.4,0,12s5.4,12,12,12c4.5,0,8.4-2.5,10.4-6.1c2.1,3.6,6,6.1,10.4,6.1c3,0,5.8-1.1,7.9-3l2.4,2.7h0.4V13h-9.8L36.7,16.3zM12,17.8c-3.2,0-5.8-2.6-5.8-5.8S8.8,6.2,12,6.2s5.8,2.6,5.8,5.8S15.2,17.8,12,17.8`),e(w,"fill","currentColor"),e(g,"class","ons-footer__ogl-img svelte-1eaiwge"),e(g,"xmlns","http://www.w3.org/2000/svg"),e(g,"width","60px"),e(g,"height","24px"),e(g,"viewBox","0 0 60 24"),e(g,"focusable","false"),e(g,"aria-hidden","true"),e($,"d","M13.5,9H13a.5.5,0,0,0-.5.5v3h-9v-9h3A.5.5,0,0,0,7,3V2.5A.5.5,0,0,0,6.5,2h-4a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5h11a.5.5,0,0,0,.5-.5v-4A.5.5,0,0,0,13.5,9Z"),e($,"transform","translate(-2 -1.99)"),e(K,"d","M8.83,7.88a.51.51,0,0,0,.71,0l2.31-2.32,1.28,1.28A.51.51,0,0,0,14,6.49v-4a.52.52,0,0,0-.5-.5h-4A.51.51,0,0,0,9,2.52a.58.58,0,0,0,.14.33l1.28,1.28L8.12,6.46a.51.51,0,0,0,0,.71Z"),e(K,"transform","translate(-2 -1.99)"),e(O,"class","ons-svg-icon svelte-1eaiwge"),e(O,"viewBox","0 0 12 12"),e(O,"xmlns","http://www.w3.org/2000/svg"),e(O,"focusable","false"),e(O,"fill","currentColor"),e(D,"class","ons-external-link__icon"),e(N,"class","ons-external-link svelte-1eaiwge"),e(N,"href",z="http://www.nationalarchives.gov.uk/doc/open-government-licence"+(r[3]==="cy"?"-cymraeg":"")+"/version/3/"),e(N,"target","_blank"),e(A,"class","footer-license__text margin-left-sm--0"),e(v,"class","footer-license"),e(p,"class","wrapper"),e(u,"class","footer svelte-1eaiwge"),e(X,"id","viewport-sm"),e(X,"class","js-viewport-size"),e(se,"id","viewport-md"),e(se,"class","js-viewport-size"),e(x,"id","viewport-lg"),e(x,"class","js-viewport-size"),e(a,"class","print--hide padding-top--13")},m(Q,ae){j(Q,a,ae),l(a,t),J&&J.m(t,null),l(t,o),l(t,i),l(i,d),l(t,h),l(t,u),l(u,m),l(m,E),de.m(E,null),l(u,b),l(u,p),l(p,v),l(v,g),l(g,w),l(v,k),l(v,A),l(A,C),l(A,P),l(A,N),l(N,Z),l(N,D),l(D,O),l(O,$),l(O,K),l(A,V),l(A,W),l(a,ve),l(a,X),l(a,ne),l(a,se),l(a,me),l(a,x),ee=!0},p(Q,ae){J&&J.p&&(!ee||ae&512)&&Na(J,le,Q,Q[9],ee?Sa(le,Q[9],ae,Jl):Da(Q[9]),yl),G===(G=ie(Q))&&de?de.p(Q,ae):(de.d(1),de=G(Q),de&&(de.c(),de.m(E,null))),(!ee||ae&8&&z!==(z="http://www.nationalarchives.gov.uk/doc/open-government-licence"+(Q[3]==="cy"?"-cymraeg":"")+"/version/3/"))&&e(N,"href",z)},i(Q){ee||(ue(J,Q),ee=!0)},o(Q){fe(J,Q),ee=!1},d(Q){Q&&s(a),J&&J.d(Q),de.d()}}}function et(r){let a,t;return a=new Ol({props:{theme:r[1],overrides:r[2],background:"none",$$slots:{default:[xl]},$$scope:{ctx:r}}}),{c(){Ue(a.$$.fragment)},l(o){Fe(a.$$.fragment,o)},m(o,i){Re(a,o,i),t=!0},p(o,[i]){const n={};i&2&&(n.theme=o[1]),i&4&&(n.overrides=o[2]),i&521&&(n.$$scope={dirty:i,ctx:o}),a.$set(n)},i(o){t||(ue(a.$$.fragment,o),t=!0)},o(o){fe(a.$$.fragment,o),t=!1},d(o){qe(a,o)}}}function at(r,a,t){let o,{$$slots:i={},$$scope:n}=a;const d=$a("page");Hl(r,d,k=>t(7,o=k));let{compact:h=!1}=a,{theme:u=null}=a,{themeOverrides:m=null}=a,E="en",b="",p=!1;function v(k,A){if(k){const M=(A==null?void 0:A.url)||document.location;t(3,E=M.host.startsWith("cy")?"cy":"en"),`${M.host}`,b=M.pathname}}Ha(()=>t(6,p=!0));const g={"Footer links":"",Help:"Cymorth",Accessibility:"Hygyrchedd",Cookies:"Cwcis",Privacy:"Preifatrwydd","Terms and conditions":"Telerau ac amodau","About ONS":"Ynglŷn ag SYG","What we do":"Beth rydym yn ei wneud",Careers:"Gyrfaoedd","Contact us":"Cysylltu â ni",News:"Newyddion","Freedom of Information":"Rhyddid Gwybodaeth","Connect with us":"Cysylltu â ni",Consultations:"Ymgynghoriadau","Discussion forums":"Fforymau trafod","Email alerts":"Rhybuddion ebost","All content is available under the":"Mae'r holl gynnwys ar gael o dan delerau'r","Open Government Licence v3.0":"Drwydded Llywodraeth Agored v3.0","except where otherwise stated":"ac eithrio lle y nodir fel arall"},w=k=>E=="cy"&&g[k]?g[k]:k;return Ha(()=>{if(!b){const k=document.location;t(3,E=k.host.startsWith("cy")?"cy":"en"),`${k.host}`,b=k.pathname}}),r.$$set=k=>{"compact"in k&&t(0,h=k.compact),"theme"in k&&t(1,u=k.theme),"themeOverrides"in k&&t(2,m=k.themeOverrides),"$$scope"in k&&t(9,n=k.$$scope)},r.$$.update=()=>{r.$$.dirty&192&&v(p,o)},[h,u,m,E,d,w,p,o,i,n]}class lt extends va{constructor(a){super(),ma(this,a,at,et,pa,{compact:0,theme:1,themeOverrides:2})}}function tt(r){let a,t,o,i,n,d,h,u,m,E;return{c(){a=B("svg"),t=B("title"),o=S("Office for National Statistics logo"),i=B("g"),n=B("path"),d=B("g"),h=B("path"),u=B("g"),m=B("path"),this.h()},l(b){a=T(b,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,"aria-labelledby":!0});var p=c(a);t=T(p,"title",{id:!0});var v=c(t);o=H(v,"Office for National Statistics logo"),v.forEach(s),i=T(p,"g",{class:!0,fill:!0});var g=c(i);n=T(g,"path",{d:!0}),c(n).forEach(s),g.forEach(s),d=T(p,"g",{class:!0,fill:!0});var w=c(d);h=T(w,"path",{d:!0}),c(h).forEach(s),w.forEach(s),u=T(p,"g",{class:!0,fill:!0});var k=c(u);m=T(k,"path",{d:!0}),c(m).forEach(s),k.forEach(s),p.forEach(s),this.h()},h(){e(t,"id","ons-logo-stacked-en-alt"),e(n,"d","M0,70.5c1.8-3.7,3.6-7.2,5.6-10.7A127.94,127.94,0,0,1,0,42.6V70.5M10.9,0S0,0,0,13.5v7.2A128.06,128.06,0,0,0,7.9,56.2a114.75,114.75,0,0,1,22.3-26C47.8,15.1,71.5,4.7,103.7.1Z"),e(i,"class","ons-svg-logo__group ons-svg-logo__group--secondary"),e(i,"fill",$l),e(h,"d","M115.9,7.3c-36.8,3.5-62,14-80,29.4a108.15,108.15,0,0,0-23.6,29c14.1,27.4,41.1,47.6,86,50.5h4.4s13.8.5,13.8-14.9V7.2l-.6.1M21.2,85.4a92.68,92.68,0,0,1-11-16A173,173,0,0,0,0,93.4v22.7l73.6.1c-22.9-5.5-40.1-16.4-52.4-30.8"),e(d,"class","ons-svg-logo__group ons-svg-logo__group--primary"),e(d,"fill",r[4]),e(m,"d","M161,51.9c-11.3,0-16.3-9.3-16.3-20.8s5-20.8,16.3-20.8,16.3,9.5,16.3,20.8c-.1,11.5-5.1,20.8-16.3,20.8m0-38.3c-8.3,0-11.3,9.1-11.3,17.4s2.7,17.3,11.3,17.3,11.2-9.1,11.2-17.3S169.3,13.6,161,13.6m30.2,8.9V51.2h-4.5V22.6H182V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8l-6.7-.1Zm18.9,0V51.2h-4.5V22.6h-4.7V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8l-6.7-.1Zm14-8.8a2.82,2.82,0,0,1-2.9-2.8,2.9,2.9,0,0,1,5.8,0,2.76,2.76,0,0,1-2.9,2.8m-2.3,6h4.6V51.2h-4.6Zm24.3,32.2c-7.4,0-13.2-6.4-13.2-16.5,0-10.3,5.8-16.5,13.4-16.5a12.36,12.36,0,0,1,7.7,2.2l-1.2,2.8a8.92,8.92,0,0,0-5.5-1.7c-6.4,0-9.7,5.5-9.7,13,0,7.7,3.7,13.2,9.5,13.2a9.8,9.8,0,0,0,5.6-1.7l1.2,3c-1.3,1.2-4,2.2-7.8,2.2m15.3-14.6c.6,7.4,4.7,11.1,11.1,11.1a18.36,18.36,0,0,0,8.5-1.9l1.3,3.2a22.58,22.58,0,0,1-10.2,2.1c-8.8,0-15.1-5.3-15.1-16.6,0-10.8,5.8-16.4,13.7-16.4s12.9,4.9,12.9,15.4l-22.2,3.1ZM270.5,22c-5.1,0-9.4,4-9.3,12.8l17.9-2.5C279,25,275.5,22,270.5,22m42.2.5V51.2h-4.5V22.6h-4.7V19.8h4.7V15.2c0-5.7,3.4-9.9,10-9.9a8,8,0,0,1,1.1.1V8.3h-.5c-3.2,0-6,2.1-6,6.4v5.1h6.6v2.8Zm23.2,29.4c-9.3,0-13.5-7.2-13.5-16.5s4.2-16.5,13.5-16.5,13.5,7.2,13.5,16.5-4.2,16.5-13.5,16.5m0-29.8c-6.9,0-8.8,7-8.8,13.4s2.1,13.1,8.8,13.1c6.9,0,8.9-6.6,8.9-13.1s-2-13.4-8.9-13.4m33.3.6c-2.9-.8-7.1-.6-9.1.6V51.2h-4.6V21.1c3.3-1.4,6.6-2.2,12.5-2.2h2.4c0,.1-1.2,3.8-1.2,3.8ZM171.3,114.8,153.5,87.3c-1.3-2.1-2.3-4.1-2.3-4.1h-.1s.2,2.3.2,4.8v26.8h-5.8V74.7h6.6L169,100.5a46.13,46.13,0,0,1,2.4,4.1h.1s-.2-2.3-.2-4.7V74.6h5.9v40.1l-5.9.1Zm25,.8c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.8-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8l-1.6-3.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.7,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm24.5,18.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2c0,2.5,1.4,4.4,4.3,4.4a5.66,5.66,0,0,0,1.8-.3v4.1a11.47,11.47,0,0,1-3.7.6M239,77.9a3.52,3.52,0,1,1,3.9-3.5,3.71,3.71,0,0,1-3.9,3.5m-3.4,5.5h6.8v31.4h-6.8Zm26.9,32.2c-9.6,0-14.4-7.1-14.4-16.5s4.8-16.6,14.4-16.6,14.3,7.2,14.3,16.6-4.7,16.5-14.3,16.5m0-28.7c-5.8,0-7.5,6.1-7.5,12.2s1.8,11.9,7.5,11.9,7.5-5.8,7.5-11.9-1.7-12.2-7.5-12.2m39.3,27.9V92.3c0-4-3.4-5.5-7.3-5.5a16,16,0,0,0-5.4.9v27.1h-6.7v-30a32.8,32.8,0,0,1,12.5-2.3c8.2,0,13.7,2.8,13.7,9.7v22.6Zm25.7.8c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.9-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8L316,84.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.7,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm13.2,17.4V69h6.7v45.8Zm38.6.8a23.94,23.94,0,0,1-10.9-2.3l1.9-4.9a17,17,0,0,0,7.7,1.9c4.7,0,8-2.7,8-6.7,0-8.8-16.7-5.4-16.7-17.9,0-6.4,5.2-11.9,13.3-11.9a20.22,20.22,0,0,1,9.7,2.3l-1.7,4.4a14.57,14.57,0,0,0-7-1.9c-4.3,0-7.2,2.6-7.2,6.4,0,8.6,17.1,4.9,17.1,18.2-.1,7.1-6,12.4-14.2,12.4m31.1-.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2a4.07,4.07,0,0,0,4.3,4.4,5.66,5.66,0,0,0,1.8-.3v4.1a12.06,12.06,0,0,1-3.7.6m20.9.1c-9.2,0-13.6-3.7-13.6-9.7,0-8.5,8.9-10.7,19.4-11.7V92.4c0-4.3-2.9-5.6-7.2-5.6a22.34,22.34,0,0,0-8.5,1.8l-1.6-3.8a30.2,30.2,0,0,1,11.3-2.3c7,0,12.3,2.9,12.3,10.9v19.9c-2.6,1.4-6.9,2.3-12.1,2.3m5.8-18.2c-7.8.8-13,2.3-13,8.3,0,4.2,3,6.1,7.7,6.1a12.33,12.33,0,0,0,5.3-1.1Zm24.6,18.1c-6.6,0-9.1-4.3-9.1-8.5V87.5H454V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2a4.07,4.07,0,0,0,4.3,4.4,5.66,5.66,0,0,0,1.8-.3v4.1a12.69,12.69,0,0,1-3.7.6m12.3-37.6a3.52,3.52,0,1,1,3.9-3.5,3.65,3.65,0,0,1-3.9,3.5m-3.4,5.5h6.8v31.4h-6.8Zm21.4,32.2a19.46,19.46,0,0,1-9.5-2.3l1.8-4.3a13.21,13.21,0,0,0,6.9,1.9c3.4,0,6.2-2.2,6.2-4.9,0-7.5-13.8-4-13.8-14.2,0-4.7,4.2-9.2,11-9.2a16.21,16.21,0,0,1,8.8,2.3l-1.8,3.9a10.31,10.31,0,0,0-5.7-1.8c-3.5,0-5.6,2.1-5.6,4.5,0,7,14,3.9,14,14.4,0,4.9-4.7,9.7-12.3,9.7m29.4-.1c-6.6,0-9.1-4.3-9.1-8.5V87.5h-4.4V83.4h4.4v-7l6.7-1.9v8.9h6.1v4.1h-6.1v19.2c0,2.5,1.4,4.4,4.3,4.4a5.66,5.66,0,0,0,1.8-.3v4.1a12.06,12.06,0,0,1-3.7.6m12.3-37.6a3.52,3.52,0,1,1,3.9-3.5c.1,2-1.7,3.5-3.9,3.5m-3.3,5.5H543v31.4h-6.8Zm26.2,32.2c-7.7,0-13.6-6.3-13.6-16.6s6.1-16.5,13.7-16.5c3.9,0,6.6,1.1,8,2.3L569,88.6a8.61,8.61,0,0,0-4.9-1.5c-5.5,0-8.3,4.7-8.3,11.8s3.3,11.9,8.2,11.9a8.39,8.39,0,0,0,4.9-1.6l1.7,4.1c-1.5,1.2-4.2,2.3-8.2,2.3m20.6,0a19.46,19.46,0,0,1-9.5-2.3l1.8-4.3a13.21,13.21,0,0,0,6.9,1.9c3.4,0,6.2-2.2,6.2-4.9,0-7.5-13.8-4-13.8-14.2,0-4.7,4.2-9.2,11-9.2a16.85,16.85,0,0,1,8.9,2.3l-1.8,3.9A10.31,10.31,0,0,0,587,87c-3.5,0-5.6,2.1-5.6,4.5,0,7,14,3.9,14,14.4-.1,4.9-4.9,9.7-12.4,9.7"),e(u,"class","ons-svg-logo__group ons-svg-logo__group--text"),e(u,"fill",r[4]),e(a,"class",E=Ma(r[1])+" svelte-48r6qe"),e(a,"xmlns","http://www.w3.org/2000/svg"),e(a,"width",r[2]),e(a,"height",r[3]),e(a,"viewBox","0 5 595 116"),e(a,"aria-labelledby","ons-logo-stacked-en-alt")},m(b,p){j(b,a,p),l(a,t),l(t,o),l(a,i),l(i,n),l(a,d),l(d,h),l(a,u),l(u,m)},p(b,p){p&16&&e(d,"fill",b[4]),p&16&&e(u,"fill",b[4]),p&2&&E!==(E=Ma(b[1])+" svelte-48r6qe")&&e(a,"class",E),p&4&&e(a,"width",b[2]),p&8&&e(a,"height",b[3])},d(b){b&&s(a)}}}function st(r){let a,t,o,i,n,d,h,u,m,E,b,p,v,g,w,k,A,M,C,P,N,U,Z,D,O,$,K,z,V,R,W,ve,X,ne,se,me;return{c(){a=B("svg"),t=B("title"),o=S("Office for National Statistics logo"),i=B("g"),n=B("path"),d=B("g"),h=B("path"),u=B("g"),m=B("path"),E=B("path"),b=B("path"),p=B("path"),v=B("path"),g=B("path"),w=B("path"),k=B("path"),A=B("path"),M=B("path"),C=B("path"),P=B("path"),N=B("path"),U=B("path"),Z=B("path"),D=B("path"),O=B("polygon"),$=B("path"),K=B("path"),z=B("path"),V=B("path"),R=B("path"),W=B("path"),ve=B("path"),X=B("path"),ne=B("path"),se=B("path"),this.h()},l(x){a=T(x,"svg",{class:!0,xmlns:!0,width:!0,height:!0,viewBox:!0,"aria-labelledby":!0});var ee=c(a);t=T(ee,"title",{id:!0});var le=c(t);o=H(le,"Office for National Statistics logo"),le.forEach(s),i=T(ee,"g",{class:!0,fill:!0});var J=c(i);n=T(J,"path",{d:!0}),c(n).forEach(s),J.forEach(s),d=T(ee,"g",{class:!0,fill:!0});var ie=c(d);h=T(ie,"path",{d:!0}),c(h).forEach(s),ie.forEach(s),u=T(ee,"g",{class:!0,fill:!0});var G=c(u);m=T(G,"path",{d:!0}),c(m).forEach(s),E=T(G,"path",{d:!0}),c(E).forEach(s),b=T(G,"path",{d:!0}),c(b).forEach(s),p=T(G,"path",{d:!0}),c(p).forEach(s),v=T(G,"path",{d:!0}),c(v).forEach(s),g=T(G,"path",{d:!0}),c(g).forEach(s),w=T(G,"path",{d:!0}),c(w).forEach(s),k=T(G,"path",{d:!0}),c(k).forEach(s),A=T(G,"path",{d:!0}),c(A).forEach(s),M=T(G,"path",{d:!0}),c(M).forEach(s),C=T(G,"path",{d:!0}),c(C).forEach(s),P=T(G,"path",{d:!0}),c(P).forEach(s),N=T(G,"path",{d:!0}),c(N).forEach(s),U=T(G,"path",{d:!0}),c(U).forEach(s),Z=T(G,"path",{d:!0}),c(Z).forEach(s),D=T(G,"path",{d:!0}),c(D).forEach(s),O=T(G,"polygon",{points:!0}),c(O).forEach(s),$=T(G,"path",{d:!0}),c($).forEach(s),K=T(G,"path",{d:!0}),c(K).forEach(s),z=T(G,"path",{d:!0}),c(z).forEach(s),V=T(G,"path",{d:!0}),c(V).forEach(s),R=T(G,"path",{d:!0}),c(R).forEach(s),W=T(G,"path",{d:!0}),c(W).forEach(s),ve=T(G,"path",{d:!0}),c(ve).forEach(s),X=T(G,"path",{d:!0}),c(X).forEach(s),ne=T(G,"path",{d:!0}),c(ne).forEach(s),se=T(G,"path",{d:!0}),c(se).forEach(s),G.forEach(s),ee.forEach(s),this.h()},h(){e(t,"id","ons-logo-en-alt"),e(n,"d","M0,34.6c.8-1.69,1.39-3,2.32-4.6A38.28,38.28,0,0,1,0,23.4V34.6M5,3S0,3,0,9.25v1A62.12,62.12,0,0,0,4.2,27a43.77,43.77,0,0,1,9.42-10.79C21.69,9.21,31.16,5.13,45.9,3Z"),e(i,"class","ons-svg-logo__group ons-svg-logo__group--secondary"),e(i,"fill",$l),e(h,"d","M53.06,6.42C36.2,8,24.68,12.92,16.43,20.07A41.46,41.46,0,0,0,6.4,32.2C12.87,44.93,28.88,57,46.6,57H47s6.32.21,6.32-6.91V6.36a1.22,1.22,0,0,1-.26.06M9.72,42.67a44.25,44.25,0,0,1-5-7.42A80.59,80.59,0,0,0,0,46.38V56.91L31.06,57c-9.83-3-15.74-7.64-21.34-14.3"),e(d,"class","ons-svg-logo__group ons-svg-logo__group--primary"),e(d,"fill",r[4]),e(m,"d","M82,47.49c-9.07,0-13.13-7.51-13.13-16.77S72.91,14,82,14s13.1,7.61,13.1,16.77S91.1,47.54,82,47.54m0-30.91c-6.69,0-9.07,7.33-9.07,14.05s2.16,13.9,9.07,13.9,9-7.28,9-13.9-2.34-14-9-14"),e(E,"d","M106.36,23.81V46.88h-3.67V23.81H98.93V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.38,0,.86.05.86.05v2.35h-.43c-2.55,0-4.84,1.64-4.84,5.12v4.09h5.27v2.25Z"),e(b,"d","M121.53,23.81V46.88h-3.67V23.81H114.1V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.38,0,.86.05.86.05v2.35h-.43c-2.55,0-4.84,1.64-4.84,5.12v4.09h5.27v2.25Z"),e(p,"d","M132.85,16.72a2.28,2.28,0,0,1-2.33-2.23v0a2.34,2.34,0,0,1,4.67,0,2.28,2.28,0,0,1-2.3,2.26h0M131,21.56h3.71V46.88H131Z"),e(v,"d","M150.53,47.49c-6,0-10.63-5.16-10.63-13.29S144.52,21,150.66,21a9.76,9.76,0,0,1,6.17,1.74l-1,2.25a7.53,7.53,0,0,0-4.4-1.36c-5.15,0-7.78,4.46-7.78,10.48,0,6.2,3,10.62,7.65,10.62a8,8,0,0,0,4.49-1.37l1,2.45a10.21,10.21,0,0,1-6.3,1.73"),e(g,"d","M162.84,35.75c.48,6,3.76,9,8.9,9a14.66,14.66,0,0,0,6.88-1.55l1.08,2.59a18,18,0,0,1-8.22,1.73c-7.12,0-12.18-4.23-12.18-13.34,0-8.69,4.67-13.2,11-13.2s10.37,3.95,10.37,12.4Zm7.35-12.41c-4.1,0-7.56,3.2-7.52,10.29l14.39-2c0-5.87-2.81-8.32-6.87-8.32"),e(w,"d","M198.57,23.81V46.88H194.9V23.81h-3.76V21.56h3.76V17.9c0-4.61,2.72-7.95,8.08-7.95.39,0,.87.05.87.05v2.35h-.44c-2.54,0-4.84,1.64-4.84,5.12v4.09h5.28v2.25Z"),e(k,"d","M217.28,47.49c-7.47,0-10.89-5.78-10.89-13.24S209.81,21,217.28,21s10.85,5.82,10.85,13.3-3.37,13.24-10.85,13.24m0-24c-5.53,0-7.13,5.59-7.13,10.81s1.73,10.56,7.13,10.56,7.13-5.35,7.13-10.56-1.6-10.81-7.13-10.81"),e(A,"d","M244.08,23.91c-2.34-.61-5.75-.52-7.35.47v22.5H233V22.69c2.67-1.13,5.36-1.74,10.11-1.74H245Z"),e(M,"d","M277.42,47.13,263.07,25a32.2,32.2,0,0,1-1.85-3.29h-.09s.13,1.88.13,3.85V47.13h-4.71V14.8h5.31l13.61,20.82A28.76,28.76,0,0,1,277.38,39h.08s-.17-1.84-.17-3.77V14.8H282V47.13Z"),e(C,"d","M297.52,47.79c-7.43,0-10.93-3-10.93-7.81,0-6.8,7.12-8.64,15.59-9.39V29.13c0-3.47-2.37-4.51-5.83-4.51a18,18,0,0,0-6.87,1.46L288.23,23a24,24,0,0,1,9.12-1.83c5.61,0,9.93,2.3,9.93,8.78V46a22.71,22.71,0,0,1-9.76,1.83m4.66-14.67c-6.26.67-10.45,1.84-10.45,6.73,0,3.42,2.42,4.88,6.22,4.88a10.09,10.09,0,0,0,4.23-.84Z"),e(P,"d","M322,47.69c-5.31,0-7.34-3.43-7.34-6.86V25.09h-3.55V21.81h3.55V16.12l5.4-1.5v7.19H325v3.28h-5V40.55a3.26,3.26,0,0,0,3,3.52h.5a5.5,5.5,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"),e(N,"d","M331.91,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.44V47.13h-5.44Z"),e(U,"d","M350.88,47.79c-7.73,0-11.57-5.74-11.57-13.3s3.84-13.34,11.57-13.34,11.54,5.78,11.54,13.34-3.8,13.3-11.54,13.3m0-23.17c-4.66,0-6.05,4.89-6.05,9.82s1.47,9.63,6.05,9.63,6.05-4.7,6.05-9.63-1.38-9.82-6.05-9.82"),e(Z,"d","M382.52,47.13V29c0-3.24-2.77-4.47-5.88-4.47a12.3,12.3,0,0,0-4.37.76v21.8h-5.39V23a26.81,26.81,0,0,1,10.06-1.83c6.61,0,11,2.25,11,7.8V47.13Z"),e(D,"d","M403.18,47.79c-7.43,0-10.94-3-10.94-7.81,0-6.8,7.13-8.64,15.6-9.39V29.13c0-3.47-2.37-4.51-5.83-4.51a18,18,0,0,0-6.87,1.46L393.89,23A24,24,0,0,1,403,21.15c5.62,0,9.94,2.3,9.94,8.78V46a22.71,22.71,0,0,1-9.76,1.83m4.66-14.67c-6.27.67-10.46,1.84-10.46,6.73,0,3.42,2.43,4.88,6.23,4.88a10.09,10.09,0,0,0,4.23-.84Z"),e(O,"points","418.52 47.13 418.52 34.91 418.52 10.25 423.92 10.25 423.92 22.76 423.92 47.13 418.52 47.13"),e($,"d","M445.39,47.79A19.11,19.11,0,0,1,436.58,46l1.51-4a13.48,13.48,0,0,0,6.22,1.55c3.76,0,6.44-2.21,6.44-5.41,0-7.09-13.44-4.36-13.44-14.42,0-5.13,4.15-9.59,10.72-9.59A15.82,15.82,0,0,1,455.8,16l-1.38,3.52a11.93,11.93,0,0,0-5.66-1.5c-3.5,0-5.79,2.11-5.79,5.12,0,7,13.74,3.94,13.74,14.65,0,5.74-4.71,10-11.32,10"),e(K,"d","M470.41,47.69c-5.31,0-7.34-3.43-7.34-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.92v3.28h-4.92V40.55a3.27,3.27,0,0,0,3,3.52h.48a5.12,5.12,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"),e(z,"d","M487.27,47.79c-7.44,0-10.93-3-10.93-7.81,0-6.8,7.13-8.64,15.6-9.39V29.13c0-3.47-2.38-4.51-5.84-4.51a18,18,0,0,0-6.87,1.46L478,23a23.94,23.94,0,0,1,9.11-1.83c5.62,0,9.94,2.3,9.94,8.78V46a22.71,22.71,0,0,1-9.76,1.83M492,33.16c-6.27.67-10.46,1.84-10.46,6.73,0,3.42,2.42,4.88,6.22,4.88a10,10,0,0,0,4.24-.84Z"),e(V,"d","M511.73,47.69c-5.32,0-7.35-3.43-7.35-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.92v3.28h-4.92V40.55a3.26,3.26,0,0,0,3,3.52h.5a5.5,5.5,0,0,0,1.46-.23v3.33a7.69,7.69,0,0,1-3,.52"),e(R,"d","M521.66,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.45V47.13h-5.45Z"),e(W,"d","M536.19,47.79A15.9,15.9,0,0,1,528.54,46L530,42.48a10.53,10.53,0,0,0,5.52,1.5c2.77,0,5-1.78,5-3.94,0-6-11.1-3.2-11.1-11.47,0-3.76,3.37-7.42,8.86-7.42A13.56,13.56,0,0,1,545.34,23l-1.42,3.14a8.47,8.47,0,0,0-4.62-1.45c-2.81,0-4.54,1.69-4.54,3.62,0,5.64,11.32,3.14,11.32,11.6,0,4-3.85,7.9-9.89,7.9"),e(ve,"d","M559.83,47.69c-5.31,0-7.35-3.43-7.35-6.86V25.09h-3.54V21.81h3.54V16.12l5.4-1.5v7.19h4.93v3.28h-4.93V40.55a3.27,3.27,0,0,0,3,3.52h.48a5.64,5.64,0,0,0,1.47-.23v3.33a7.72,7.72,0,0,1-3,.52"),e(X,"d","M569.77,17.43a3,3,0,0,1-3.15-2.81,3.17,3.17,0,0,1,6.31,0,3,3,0,0,1-3.16,2.81m-2.72,4.38h5.44V47.13h-5.44Z"),e(ne,"d","M588.14,47.79c-6.23,0-11-5.08-11-13.35s4.88-13.29,11-13.29A10.51,10.51,0,0,1,594.66,23l-1.21,3a6.87,6.87,0,0,0-4-1.22c-4.4,0-6.69,3.81-6.69,9.49s2.63,9.59,6.61,9.59a6.74,6.74,0,0,0,4-1.28L594.7,46c-1.12.94-3.33,1.84-6.56,1.84"),e(se,"d","M605.1,47.79A15.9,15.9,0,0,1,597.45,46l1.42-3.47A10.54,10.54,0,0,0,604.4,44c2.77,0,5-1.78,5-3.94,0-6-11.1-3.2-11.1-11.47,0-3.76,3.37-7.42,8.85-7.42a13.49,13.49,0,0,1,7.1,1.83l-1.42,3.14a8.42,8.42,0,0,0-4.63-1.45c-2.8,0-4.53,1.69-4.53,3.62,0,5.64,11.32,3.14,11.32,11.6,0,4-3.85,7.9-9.89,7.9"),e(u,"class","ons-svg-logo__group ons-svg-logo__group--text"),e(u,"fill",r[4]),e(a,"class",me=Ma(r[1])+" svelte-48r6qe"),e(a,"xmlns","http://www.w3.org/2000/svg"),e(a,"width",r[2]),e(a,"height",r[3]),e(a,"viewBox","33 2 552 60"),e(a,"aria-labelledby","ons-logo-en-alt")},m(x,ee){j(x,a,ee),l(a,t),l(t,o),l(a,i),l(i,n),l(a,d),l(d,h),l(a,u),l(u,m),l(u,E),l(u,b),l(u,p),l(u,v),l(u,g),l(u,w),l(u,k),l(u,A),l(u,M),l(u,C),l(u,P),l(u,N),l(u,U),l(u,Z),l(u,D),l(u,O),l(u,$),l(u,K),l(u,z),l(u,V),l(u,R),l(u,W),l(u,ve),l(u,X),l(u,ne),l(u,se)},p(x,ee){ee&16&&e(d,"fill",x[4]),ee&16&&e(u,"fill",x[4]),ee&2&&me!==(me=Ma(x[1])+" svelte-48r6qe")&&e(a,"class",me),ee&4&&e(a,"width",x[2]),ee&8&&e(a,"height",x[3])},d(x){x&&s(a)}}}function rt(r){let a;function t(n,d){return n[0]?tt:st}let o=t(r),i=o(r);return{c(){i.c(),a=_a()},l(n){i.l(n),a=_a()},m(n,d){i.m(n,d),j(n,a,d)},p(n,[d]){o===(o=t(n))&&i?i.p(n,d):(i.d(1),i=o(n),i&&(i.c(),i.m(a.parentNode,a)))},i:fa,o:fa,d(n){i.d(n),n&&s(a)}}}const $l="#a8bd3a";function ot(r,a,t){let o;const i=$a("theme");let{compact:n=!1}=a,{className:d="ons-svg-logo"}=a,{width:h="auto"}=a,{height:u="auto"}=a;return r.$$set=m=>{"compact"in m&&t(0,n=m.compact),"className"in m&&t(1,d=m.className),"width"in m&&t(2,h=m.width),"height"in m&&t(3,u=m.height)},t(4,o=i==="dark"?"white":"#003c57"),[n,d,h,u,o]}class Oa extends va{constructor(a){super(),ma(this,a,ot,rt,pa,{compact:0,className:1,width:2,height:3})}}function El(r,a,t){const o=r.slice();return o[26]=a[t],o[28]=t,o}function wl(r,a,t){const o=r.slice();return o[29]=a[t],o}function kl(r,a,t){const o=r.slice();return o[26]=a[t],o}const nt=r=>({}),Vl=r=>({});function Al(r){let a,t,o=r[13]("Skip to main content")+"",i,n,d,h,u,m,E,b,p,v;const g=r[17].before,w=Ca(g,r,r[23],Vl),k=[ct,it],A=[];function M(P,N){return P[0]?0:1}E=M(r),b=A[E]=k[E](r);let C=r[1]&&Cl(r);return{c(){a=f("header"),t=f("a"),i=S(o),n=I(),d=f("div"),h=S(r[8]),u=I(),w&&w.c(),m=I(),b.c(),p=I(),C&&C.c(),this.h()},l(P){a=_(P,"HEADER",{class:!0,role:!0});var N=c(a);t=_(N,"A",{class:!0,href:!0,tabindex:!0});var U=c(t);i=H(U,o),U.forEach(s),n=L(N),d=_(N,"DIV",{id:!0,class:!0});var Z=c(d);h=H(Z,r[8]),Z.forEach(s),u=L(N),w&&w.l(N),m=L(N),b.l(N),p=L(N),C&&C.l(N),N.forEach(s),this.h()},h(){e(t,"class","skiplink"),e(t,"href","#main"),e(t,"tabindex","0"),e(d,"id","pagePath"),e(d,"class","hide"),e(a,"class","ons-header"),e(a,"role","banner")},m(P,N){j(P,a,N),l(a,t),l(t,i),l(a,n),l(a,d),l(d,h),l(a,u),w&&w.m(a,null),l(a,m),A[E].m(a,null),l(a,p),C&&C.m(a,null),v=!0},p(P,N){(!v||N[0]&256)&&xe(h,P[8]),w&&w.p&&(!v||N[0]&8388608)&&Na(w,g,P,P[23],v?Sa(g,P[23],N,nt):Da(P[23]),Vl);let U=E;E=M(P),E===U?A[E].p(P,N):(Pl(),fe(A[U],1,1,()=>{A[U]=null}),Zl(),b=A[E],b?b.p(P,N):(b=A[E]=k[E](P),b.c()),ue(b,1),b.m(a,p)),P[1]?C?C.p(P,N):(C=Cl(P),C.c(),C.m(a,null)):C&&(C.d(1),C=null)},i(P){v||(ue(w,P),ue(b),v=!0)},o(P){fe(w,P),fe(b),v=!1},d(P){P&&s(a),w&&w.d(P),A[E].d(),C&&C.d()}}}function it(r){let a,t,o,i,n,d,h,u,m,E,b,p,v,g,w,k,A,M,C,P=r[13]("Menu")+"",N,U,Z,D,O,$=(r[10]?r[13]("Hide search"):r[13]("Search"))+"",K,z,V,R,W,ve=r[13]("Home")+"",X,ne,se,me,x,ee,le,J,ie,G,de=r[13]("Search for a keyword(s) or time series ID")+"",Q,ae,ce,Oe,he,pe,we=r[13]("Search")+"",ze,Me,ke,re,_e,$e,oe,la,Ne;n=new Oa({props:{className:"logo",height:39,compact:!0}});function We(y,F){return y[5]=="en"?ut:ht}let ta=We(r),ge=ta(r),Be=r[11].filter(Nl),q=[];for(let y=0;y{o=null}),Zl())},i(i){t||(ue(o),t=!0)},o(i){fe(o),t=!1},d(i){o&&o.d(i),i&&s(a)}}}function pt(r){let a,t;return a=new Ol({props:{theme:r[3],overrides:r[4],$$slots:{default:[mt]},$$scope:{ctx:r}}}),{c(){Ue(a.$$.fragment)},l(o){Fe(a.$$.fragment,o)},m(o,i){Re(a,o,i),t=!0},p(o,i){const n={};i[0]&8&&(n.theme=o[3]),i[0]&16&&(n.overrides=o[4]),i[0]&8392679&&(n.$$scope={dirty:i,ctx:o}),a.$set(n)},i(o){t||(ue(a.$$.fragment,o),t=!0)},o(o){fe(a.$$.fragment,o),t=!1},d(o){qe(a,o)}}}const Nl=r=>r.secondary,Dl=r=>r.children,Sl=r=>!r.children;function gt(r,a,t){let o,{$$slots:i={},$$scope:n}=a;const d=$a("page");Hl(r,d,V=>t(16,o=V));let{compact:h=!1}=a,{title:u=""}=a,{titleHref:m=""}=a,{theme:E=null}=a,{themeOverrides:b=null}=a,p="en",v="//www.ons.gov.uk",g="//cy.ons.gov.uk",w="",k=!1;function A(V,R){if(V){const W=(R==null?void 0:R.url)||document.location;t(5,p=W.host.startsWith("cy")?"cy":"en"),t(6,v=`//${W.host}`),t(7,g=p==="en"?`//cy.${W.host.replace("www.","")}`:`//www.${W.host.replace("cy.","")}`),t(8,w=W.pathname)}}Ha(()=>t(15,k=!0));let M=!1,C=!1,P=[{label_en:"Business, industry and trade",label_cy:"Busnes, diwydiant a masnach",url:"/businessindustryandtrade",expanded:!1,children:[{label_en:"Business",label_cy:"Busnes",url:"/businessindustryandtrade/business"},{label_en:"Changes to business",label_cy:"Newidiadau i fusnesau",url:"/businessindustryandtrade/changestobusiness"},{label_en:"Construction industry",label_cy:"Diwydiant adeiladu",url:"/businessindustryandtrade/constructionindustry"},{label_en:"IT and internet industry",label_cy:"Y diwydiant TG a'r rhyngrwyd",url:"/businessindustryandtrade"},{label_en:"International trade",label_cy:"Masnach ryngwladol",url:"/businessindustryandtrade/itandinternetindustry"},{label_en:"Manufacturing and production industry",label_cy:"Y diwydiant gweithgynhyrchu a chynhyrchu",url:"/businessindustryandtrade/manufacturingandproductionindustry"},{label_en:"Retail industry",label_cy:"Y diwydiant manwerthu",url:"/businessindustryandtrade/retailindustry"},{label_en:"Tourism industry",label_cy:"Y diwydiant twristiaeth",url:"/businessindustryandtrade/tourismindustry"}]},{label_en:"Economy",label_cy:"Yr economi",url:"/economy",expanded:!1,children:[{label_en:"Economic output and productivity",label_cy:"Allgynnyrch economaidd a chynhyrchiant",url:"/economy/economicoutputandproductivity"},{label_en:"Environmental accounts",label_cy:"Cyfrifon amgylcheddol",url:"/economy/environmentalaccounts"},{label_en:"Government, public sector and taxes",label_cy:"Llywodraeth, y sector cyhoeddus a threthi",url:"/economy/governmentpublicsectorandtaxes"},{label_en:"Gross Domestic Product (GDP)",label_cy:"Cynnyrch Domestig Gros (CDG)",url:"/economy/grossdomesticproductgdp"},{label_en:"Gross Value Added (GVA)",label_cy:"Gwerth Ychwanegol Gros",url:"/economy/grossvalueaddedgva"},{label_en:"Inflation and price indices",label_cy:"Mynegeion chwyddiant a phrisiau",url:"/economy/inflationandpriceindices"},{label_en:"Investments, pensions and trusts",label_cy:"Buddsoddiadau, pensiynau ac ymddiriedolaethau",url:"/economy/investmentspensionsandtrusts"},{label_en:"National accounts",label_cy:"Cyfrifon gwladol",url:"/economy/nationalaccounts"},{label_en:"Regional accounts",label_cy:"Cyfrifon rhanbarthol",url:"/economy/regionalaccounts"}]},{label_en:"Employment and labour market",label_cy:"Cyflogaeth a'r farchnad lafur",url:"/employmentandlabourmarket",expanded:!1,children:[{label_en:"People in work",label_cy:"Pobl mewn gwaith",url:"/employmentandlabourmarket/peopleinwork"},{label_en:"People not in work",label_cy:"Pobl nad ydynt mewn gwaith",url:"/employmentandlabourmarket/peoplenotinwork"}]},{label_en:"People, population and community",label_cy:"Pobl, y boblogaeth a chymunedau",url:"/peoplepopulationandcommunity",expanded:!1,children:[{label_en:"Births, deaths and marriages",label_cy:"Genedigaethau, marwolaethau a phriodasau",url:"/peoplepopulationandcommunity/birthsdeathsandmarriages"},{label_en:"Crime and justice",label_cy:"Troseddu a chyfiawnder",url:"/peoplepopulationandcommunity/crimeandjustice"},{label_en:"Cultural identity",label_cy:"Hunaniaeth ddiwylliannol",url:"/peoplepopulationandcommunity/culturalidentity"},{label_en:"Education and childcare",label_cy:"Addysg a gofal plant",url:"/peoplepopulationandcommunity/educationandchildcare"},{label_en:"Elections",label_cy:"Etholiadau",url:"/peoplepopulationandcommunity/elections"},{label_en:"Health and social care",label_cy:"Iechyd a gofal cymdeithasol",url:"/peoplepopulationandcommunity/healthandsocialcare"},{label_en:"Household characteristics",label_cy:"Nodweddion aelwydydd",url:"/peoplepopulationandcommunity/householdcharacteristics"},{label_en:"Housing",label_cy:"Tai",url:"/peoplepopulationandcommunity/housing"},{label_en:"Leisure and tourism",label_cy:"Hamdden a thwristiaeth",url:"/peoplepopulationandcommunity/leisureandtourism"},{label_en:"Personal and household finances",label_cy:"Cyllid personol a chyllid aelwydydd",url:"/peoplepopulationandcommunity/personalandhouseholdfinances"},{label_en:"Population and migration",label_cy:"Poblogaeth ac ymfudo",url:"/peoplepopulationandcommunity/populationandmigration"},{label_en:"Well-being",label_cy:"Lles",url:"/peoplepopulationandcommunity/wellbeing"}]},{label_en:"Taking part in a survey?",label_cy:"Cymryd rhan mewn arolwg?",url:"/surveys"},{label_en:"Release calendar",label_cy:"Calendar datganiadau",url:"/releasecalendar",secondary:!0},{label_en:"Methodology",label_cy:"Methodoleg",url:"/methodology",secondary:!0},{label_en:"Media",label_cy:"Media",url:"/news",secondary:!0},{label_en:"About",label_cy:"Amdanom ni",url:"/aboutus",secondary:!0},{label_en:"Blog",label_cy:"Blog",url:"https://blog.ons.gov.uk/",secondary:!0}];const N={Home:"Hafan",Search:"Chwilio",Menu:"Dewislen","Hide search":"Cuddio","Office for National Statistics logo - Homepage":"Logo Swyddfa Ystadegau Gwladol - Hafan","Search for a keyword(s) or time series ID":"Chwilio am allweddair neu ID cyfres amser"},U=V=>p=="cy"&&N[V]?N[V]:V;function Z(V,R){window.matchMedia("(max-width:767px)").matches&&(V.preventDefault(),t(11,P[R].expanded=!P[R].expanded,P))}const D=()=>{t(9,M=!M),t(10,C=!1)},O=()=>{t(10,C=!C),t(9,M=!1)},$=(V,R)=>V["label_"+p].localeCompare(R["label_"+p]),K=(V,R)=>Z(R,V),z=(V,R)=>V["label_"+p].localeCompare(R["label_"+p]);return r.$$set=V=>{"compact"in V&&t(0,h=V.compact),"title"in V&&t(1,u=V.title),"titleHref"in V&&t(2,m=V.titleHref),"theme"in V&&t(3,E=V.theme),"themeOverrides"in V&&t(4,b=V.themeOverrides),"$$scope"in V&&t(23,n=V.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&98304&&A(k,o)},[h,u,m,E,b,p,v,g,w,M,C,P,d,U,Z,k,o,i,D,O,$,K,z,n]}class bt extends va{constructor(a){super(),ma(this,a,gt,pt,pa,{compact:0,title:1,titleHref:2,theme:3,themeOverrides:4},null,[-1,-1])}}function yt(r){let a,t,o,i;return{c(){a=S("This is a new service – your "),t=f("a"),o=S("feedback"),i=S(" will help us improve it."),this.h()},l(n){a=H(n,"This is a new service – your "),t=_(n,"A",{href:!0});var d=c(t);o=H(d,"feedback"),d.forEach(s),i=H(n," will help us improve it."),this.h()},h(){e(t,"href",r[1])},m(n,d){j(n,a,d),j(n,t,d),l(t,o),j(n,i,d)},p(n,d){d&2&&e(t,"href",n[1])},d(n){n&&s(a),n&&s(t),n&&s(i)}}}function Et(r){let a,t,o,i;return{c(){a=S("This is a prototype – your "),t=f("a"),o=S("feedback"),i=S(" will help us improve it."),this.h()},l(n){a=H(n,"This is a prototype – your "),t=_(n,"A",{href:!0});var d=c(t);o=H(d,"feedback"),d.forEach(s),i=H(n," will help us improve it."),this.h()},h(){e(t,"href",r[1])},m(n,d){j(n,a,d),j(n,t,d),l(t,o),j(n,i,d)},p(n,d){d&2&&e(t,"href",n[1])},d(n){n&&s(a),n&&s(t),n&&s(i)}}}function wt(r){let a,t,o,i,n,d,h,u,m,E;function b(g,w){return w&1&&(E=null),E==null&&(E=g[0].toLowerCase()==="prototype"),E?Et:yt}let p=b(r,-1),v=p(r);return{c(){a=f("div"),t=f("div"),o=f("div"),i=f("div"),n=f("strong"),d=S(r[0]),h=I(),u=f("div"),m=f("span"),v.c(),this.h()},l(g){a=_(g,"DIV",{class:!0});var w=c(a);t=_(w,"DIV",{class:!0});var k=c(t);o=_(k,"DIV",{class:!0});var A=c(o);i=_(A,"DIV",{class:!0});var M=c(i);n=_(M,"STRONG",{class:!0});var C=c(n);d=H(C,r[0]),C.forEach(s),M.forEach(s),h=L(A),u=_(A,"DIV",{class:!0});var P=c(u);m=_(P,"SPAN",{class:!0});var N=c(m);v.l(N),N.forEach(s),P.forEach(s),A.forEach(s),k.forEach(s),w.forEach(s),this.h()},h(){e(n,"class","ons-phase-banner__badge svelte-x2c8o"),e(i,"class","ons-grid__col ons-col-auto ons-u-flex-no-grow ons-u-flex-no-shrink"),e(m,"class","ons-u-fs-s ons-u-m-no"),e(u,"class","ons-col-auto ons-grid--flex ons-grid--no-wrap@l ons-grid--vertical-center"),e(o,"class","ons-grid ons-grid--flex ons-grid--gutterless ons-grid--no-wrap"),e(t,"class","ons-container"),e(a,"class","ons-phase-banner svelte-x2c8o")},m(g,w){j(g,a,w),l(a,t),l(t,o),l(o,i),l(i,n),l(n,d),l(o,h),l(o,u),l(u,m),v.m(m,null)},p(g,[w]){w&1&&xe(d,g[0]),p===(p=b(g,w))&&v?v.p(g,w):(v.d(1),v=p(g),v&&(v.c(),v.m(m,null)))},i:fa,o:fa,d(g){g&&s(a),v.d()}}}function kt(r,a,t){let{phase:o="Beta"}=a,{href:i="/feedback"}=a;return r.$$set=n=>{"phase"in n&&t(0,o=n.phase),"href"in n&&t(1,i=n.href)},[o,i]}class Vt extends va{constructor(a){super(),ma(this,a,kt,wt,pa,{phase:0,href:1})}}function At(r){let a;const t=r[0].default,o=Ca(t,r,r[1],null);return{c(){o&&o.c()},l(i){o&&o.l(i)},m(i,n){o&&o.m(i,n),a=!0},p(i,n){o&&o.p&&(!a||n&2)&&Na(o,t,i,i[1],a?Sa(t,i[1],n,null):Da(i[1]),null)},i(i){a||(ue(o,i),a=!0)},o(i){fe(o,i),a=!1},d(i){o&&o.d(i)}}}function It(r){let a,t,o,i,n,d,h,u,m,E,b,p;return o=new Yl({props:{analyticsProps:Ul}}),n=new Vt({props:{phase:"prototype"}}),h=new bt({}),m=new Kl({props:{$$slots:{default:[At]},$$scope:{ctx:r}}}),b=new lt({}),{c(){a=f("link"),t=I(),Ue(o.$$.fragment),i=I(),Ue(n.$$.fragment),d=I(),Ue(h.$$.fragment),u=I(),Ue(m.$$.fragment),E=I(),Ue(b.$$.fragment),this.h()},l(v){const g=Tl("svelte-fshbd7",document.head);a=_(g,"LINK",{rel:!0,href:!0}),g.forEach(s),t=L(v),Fe(o.$$.fragment,v),i=L(v),Fe(n.$$.fragment,v),d=L(v),Fe(h.$$.fragment,v),u=L(v),Fe(m.$$.fragment,v),E=L(v),Fe(b.$$.fragment,v),this.h()},h(){e(a,"rel","icon"),e(a,"href",Gl+"/favicon.png")},m(v,g){l(document.head,a),j(v,t,g),Re(o,v,g),j(v,i,g),Re(n,v,g),j(v,d,g),Re(h,v,g),j(v,u,g),Re(m,v,g),j(v,E,g),Re(b,v,g),p=!0},p(v,[g]){const w={};g&2&&(w.$$scope={dirty:g,ctx:v}),m.$set(w)},i(v){p||(ue(o.$$.fragment,v),ue(n.$$.fragment,v),ue(h.$$.fragment,v),ue(m.$$.fragment,v),ue(b.$$.fragment,v),p=!0)},o(v){fe(o.$$.fragment,v),fe(n.$$.fragment,v),fe(h.$$.fragment,v),fe(m.$$.fragment,v),fe(b.$$.fragment,v),p=!1},d(v){s(a),v&&s(t),qe(o,v),v&&s(i),qe(n,v),v&&s(d),qe(h,v),v&&s(u),qe(m,v),v&&s(E),qe(b,v)}}}let Lt="light";function Mt(r,a,t){let{$$slots:o={},$$scope:i}=a;return jl("theme",Fl[Lt]),r.$$set=n=>{"$$scope"in n&&t(1,i=n.$$scope)},[o,i]}class Ht extends va{constructor(a){super(),ma(this,a,Mt,It,pa,{})}}export{Ht as component,St as universal}; diff --git a/_app/immutable/nodes/1.6c475c5d.js b/_app/immutable/nodes/1.79fb5540.js similarity index 84% rename from _app/immutable/nodes/1.6c475c5d.js rename to _app/immutable/nodes/1.79fb5540.js index d94eaee..382d962 100644 --- a/_app/immutable/nodes/1.6c475c5d.js +++ b/_app/immutable/nodes/1.79fb5540.js @@ -1 +1 @@ -import{S as x,i as H,s as S,k as u,q as h,a as g,l as d,m as v,r as b,h as m,c as k,b as _,K as E,u as $,L as q,H as y}from"../chunks/index.ba35b81f.js";import{p as C}from"../chunks/stores.a2c33b91.js";function K(l){var f;let a,t=l[0].status+"",r,o,n,p=((f=l[0].error)==null?void 0:f.message)+"",c;return{c(){a=u("h1"),r=h(t),o=g(),n=u("p"),c=h(p)},l(e){a=d(e,"H1",{});var s=v(a);r=b(s,t),s.forEach(m),o=k(e),n=d(e,"P",{});var i=v(n);c=b(i,p),i.forEach(m)},m(e,s){_(e,a,s),E(a,r),_(e,o,s),_(e,n,s),E(n,c)},p(e,[s]){var i;s&1&&t!==(t=e[0].status+"")&&$(r,t),s&1&&p!==(p=((i=e[0].error)==null?void 0:i.message)+"")&&$(c,p)},i:q,o:q,d(e){e&&m(a),e&&m(o),e&&m(n)}}}function L(l,a,t){let r;return y(l,C,o=>t(0,r=o)),[r]}class w extends x{constructor(a){super(),H(this,a,L,K,S,{})}}export{w as component}; +import{S as x,i as H,s as S,k as u,q as h,a as g,l as d,m as v,r as b,h as m,c as k,b as _,K as E,u as $,L as q,H as y}from"../chunks/index.ba35b81f.js";import{p as C}from"../chunks/stores.c6665ed7.js";function K(l){var f;let a,t=l[0].status+"",r,o,n,p=((f=l[0].error)==null?void 0:f.message)+"",c;return{c(){a=u("h1"),r=h(t),o=g(),n=u("p"),c=h(p)},l(e){a=d(e,"H1",{});var s=v(a);r=b(s,t),s.forEach(m),o=k(e),n=d(e,"P",{});var i=v(n);c=b(i,p),i.forEach(m)},m(e,s){_(e,a,s),E(a,r),_(e,o,s),_(e,n,s),E(n,c)},p(e,[s]){var i;s&1&&t!==(t=e[0].status+"")&&$(r,t),s&1&&p!==(p=((i=e[0].error)==null?void 0:i.message)+"")&&$(c,p)},i:q,o:q,d(e){e&&m(a),e&&m(o),e&&m(n)}}}function L(l,a,t){let r;return y(l,C,o=>t(0,r=o)),[r]}class w extends x{constructor(a){super(),H(this,a,L,K,S,{})}}export{w as component}; diff --git a/_app/immutable/nodes/2.2cd27a0e.js b/_app/immutable/nodes/2.79242b89.js similarity index 70% rename from _app/immutable/nodes/2.2cd27a0e.js rename to _app/immutable/nodes/2.79242b89.js index 09acb5d..7500e15 100644 --- a/_app/immutable/nodes/2.2cd27a0e.js +++ b/_app/immutable/nodes/2.79242b89.js @@ -1,4 +1,4 @@ -import{T as c_,c as h1,b as u_,m as Bp,l as Gl,d as Do,e as Oo,p as Op,f as rc,g as f1,h as d1,t as p1,i as Yh,v as m1,j as g1}from"../chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js";import{b as Hl}from"../chunks/paths.b7f7cd27.js";import{S as Wr,i as Kr,s as jr,e as er,b as Be,v as Nr,d as nt,f as Ur,g as qe,h as te,y as ir,z as cr,A as nr,B as sr,C as Di,k as Ne,a as Et,l as Ue,m as He,c as kt,n as _e,N as Ht,K as Pe,D as Ri,E as Li,F as Bi,Q as Ui,I as la,J as ca,q as zt,r as Mt,u as kr,V as h_,W as f_,U as qa,p as It,M as Pu,G as Ga,H as Uu,X as zu,L as _r,Y as d_,Z as p_,_ as kf,O as bs,$ as m_,a0 as g_,R as _1,w as Za,a1 as No,a2 as Uo,T as __,o as Sf,a3 as Vu,a4 as y_,x as Fp}from"../chunks/index.ba35b81f.js";import{p as y1}from"../chunks/stores.a2c33b91.js";import{w as v_,h as b_}from"../chunks/singletons.f77dfb29.js";function v1(o){let r,s;return r=new c_({props:{id:o[0],cls:o[1],theme:o[6],background:o[8],overrides:o[7],$$slots:{default:[x1]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&1&&(f.id=l[0]),c&2&&(f.cls=l[1]),c&64&&(f.theme=l[6]),c&256&&(f.background=l[8]),c&128&&(f.overrides=l[7]),c&5692&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function b1(o){let r,s;return r=new c_({props:{id:o[0],cls:o[1],theme:o[6],background:o[8],overrides:o[7],$$slots:{default:[w1]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&1&&(f.id=l[0]),c&2&&(f.cls=l[1]),c&64&&(f.theme=l[6]),c&256&&(f.background=l[8]),c&128&&(f.overrides=l[7]),c&5692&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function Np(o){let r;return{c(){r=Ne("div"),this.h()},l(s){r=Ue(s,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function Up(o){let r;return{c(){r=Ne("div"),this.h()},l(s){r=Ue(s,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function x1(o){let r,s,l,c,f,d=o[4]&&Np();const n=o[11].default,m=Di(n,o,o[12],null);let b=o[5]&&Up();return{c(){r=Ne("div"),d&&d.c(),s=Et(),m&&m.c(),l=Et(),b&&b.c(),this.h()},l(w){r=Ue(w,"DIV",{id:!0,class:!0});var S=He(r);d&&d.l(S),s=kt(S),m&&m.l(S),l=kt(S),b&&b.l(S),S.forEach(te),this.h()},h(){_e(r,"id",o[10]),_e(r,"class",c="ons-page__container ons-container "+o[9]+" svelte-18rmgoy"),Ht(r,"ons-page__container--wider",o[2]==="wider"),Ht(r,"ons-page__container--full",o[2]==="full"),Ht(r,"ons-page__container--tall-height",o[3]==="tall"),Ht(r,"ons-page__container--full-height",o[3]==="full")},m(w,S){Be(w,r,S),d&&d.m(r,null),Pe(r,s),m&&m.m(r,null),Pe(r,l),b&&b.m(r,null),f=!0},p(w,S){w[4]?d||(d=Np(),d.c(),d.m(r,s)):d&&(d.d(1),d=null),m&&m.p&&(!f||S&4096)&&Ri(m,n,w,w[12],f?Bi(n,w[12],S,null):Li(w[12]),null),w[5]?b||(b=Up(),b.c(),b.m(r,null)):b&&(b.d(1),b=null),(!f||S&1024)&&_e(r,"id",w[10]),(!f||S&512&&c!==(c="ons-page__container ons-container "+w[9]+" svelte-18rmgoy"))&&_e(r,"class",c),(!f||S&516)&&Ht(r,"ons-page__container--wider",w[2]==="wider"),(!f||S&516)&&Ht(r,"ons-page__container--full",w[2]==="full"),(!f||S&520)&&Ht(r,"ons-page__container--tall-height",w[3]==="tall"),(!f||S&520)&&Ht(r,"ons-page__container--full-height",w[3]==="full")},i(w){f||(qe(m,w),f=!0)},o(w){nt(m,w),f=!1},d(w){w&&te(r),d&&d.d(),m&&m.d(w),b&&b.d()}}}function Vp(o){let r;return{c(){r=Ne("div"),this.h()},l(s){r=Ue(s,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function $p(o){let r;return{c(){r=Ne("div"),this.h()},l(s){r=Ue(s,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function w1(o){let r,s,l,c,f,d,n=o[4]&&Vp();const m=o[11].default,b=Di(m,o,o[12],null);let w=o[5]&&$p();return{c(){r=Ne("div"),n&&n.c(),s=Et(),l=Ne("div"),b&&b.c(),c=Et(),w&&w.c(),this.h()},l(S){r=Ue(S,"DIV",{id:!0,class:!0});var k=He(r);n&&n.l(k),s=kt(k),l=Ue(k,"DIV",{class:!0});var A=He(l);b&&b.l(A),A.forEach(te),c=kt(k),w&&w.l(k),k.forEach(te),this.h()},h(){_e(l,"class","svelte-18rmgoy"),Ht(l,"ons-page__container--narrow",o[2]==="narrow"),Ht(l,"ons-page__container--medium",o[2]==="medium"),_e(r,"id",o[10]),_e(r,"class",f="ons-page__container ons-container "+o[9]+" svelte-18rmgoy"),Ht(r,"ons-page__container--tall-height",o[3]==="tall"),Ht(r,"ons-page__container--full-height",o[3]==="full")},m(S,k){Be(S,r,k),n&&n.m(r,null),Pe(r,s),Pe(r,l),b&&b.m(l,null),Pe(r,c),w&&w.m(r,null),d=!0},p(S,k){S[4]?n||(n=Vp(),n.c(),n.m(r,s)):n&&(n.d(1),n=null),b&&b.p&&(!d||k&4096)&&Ri(b,m,S,S[12],d?Bi(m,S[12],k,null):Li(S[12]),null),(!d||k&4)&&Ht(l,"ons-page__container--narrow",S[2]==="narrow"),(!d||k&4)&&Ht(l,"ons-page__container--medium",S[2]==="medium"),S[5]?w||(w=$p(),w.c(),w.m(r,null)):w&&(w.d(1),w=null),(!d||k&1024)&&_e(r,"id",S[10]),(!d||k&512&&f!==(f="ons-page__container ons-container "+S[9]+" svelte-18rmgoy"))&&_e(r,"class",f),(!d||k&520)&&Ht(r,"ons-page__container--tall-height",S[3]==="tall"),(!d||k&520)&&Ht(r,"ons-page__container--full-height",S[3]==="full")},i(S){d||(qe(b,S),d=!0)},o(S){nt(b,S),d=!1},d(S){S&&te(r),n&&n.d(),b&&b.d(S),w&&w.d()}}}function E1(o){let r,s,l,c,f;const d=[b1,v1],n=[];function m(b,w){return w&4&&(r=null),r==null&&(r=!!["narrow","medium"].includes(b[2])),r?0:1}return s=m(o,-1),l=n[s]=d[s](o),{c(){l.c(),c=er()},l(b){l.l(b),c=er()},m(b,w){n[s].m(b,w),Be(b,c,w),f=!0},p(b,[w]){let S=s;s=m(b,w),s===S?n[s].p(b,w):(Nr(),nt(n[S],1,1,()=>{n[S]=null}),Ur(),l=n[s],l?l.p(b,w):(l=n[s]=d[s](b),l.c()),qe(l,1),l.m(c.parentNode,c))},i(b){f||(qe(l),f=!0)},o(b){nt(l),f=!1},d(b){n[s].d(b),b&&te(c)}}}function k1(o,r,s){let l,c,{$$slots:f={},$$scope:d}=r,{id:n=null}=r,{cls:m=null}=r,{width:b="wide"}=r,{height:w="auto"}=r,{marginTop:S=!1}=r,{marginBottom:k=!1}=r,{theme:A=null}=r,{themeOverrides:P=null}=r,{background:T=null}=r;return o.$$set=L=>{"id"in L&&s(0,n=L.id),"cls"in L&&s(1,m=L.cls),"width"in L&&s(2,b=L.width),"height"in L&&s(3,w=L.height),"marginTop"in L&&s(4,S=L.marginTop),"marginBottom"in L&&s(5,k=L.marginBottom),"theme"in L&&s(6,A=L.theme),"themeOverrides"in L&&s(7,P=L.themeOverrides),"background"in L&&s(8,T=L.background),"$$scope"in L&&s(12,d=L.$$scope)},o.$$.update=()=>{o.$$.dirty&321&&s(10,l=n&&!(A||T)?n:null),o.$$.dirty&322&&s(9,c=m&&!(A||T)?m:"")},[n,m,b,w,S,k,A,P,T,c,l,f,d]}class ic extends Wr{constructor(r){super(),Kr(this,r,k1,E1,jr,{id:0,cls:1,width:2,height:3,marginTop:4,marginBottom:5,theme:6,themeOverrides:7,background:8})}}var Ro=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function $u(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function jp(o,r,s){const l=o.slice();return l[5]=r[s],l}function S1(o){let r=o[5].label+"",s;return{c(){s=zt(r)},l(l){s=Mt(l,r)},m(l,c){Be(l,s,c)},p(l,c){c&1&&r!==(r=l[5].label+"")&&kr(s,r)},d(l){l&&te(s)}}}function T1(o){let r,s=o[5].label+"",l,c;return{c(){r=Ne("a"),l=zt(s),this.h()},l(f){r=Ue(f,"A",{class:!0,href:!0});var d=He(r);l=Mt(d,s),d.forEach(te),this.h()},h(){_e(r,"class","ons-breadcrumb__link"),_e(r,"href",c=o[5].href)},m(f,d){Be(f,r,d),Pe(r,l)},p(f,d){d&1&&s!==(s=f[5].label+"")&&kr(l,s),d&1&&c!==(c=f[5].href)&&_e(r,"href",c)},d(f){f&&te(r)}}}function qp(o){let r,s,l,c,f;function d(b,w){return b[5].href?T1:S1}let n=d(o),m=n(o);return{c(){r=Ne("li"),m.c(),s=Et(),l=la("svg"),c=la("path"),f=Et(),this.h()},l(b){r=Ue(b,"LI",{class:!0});var w=He(r);m.l(w),s=kt(w),l=ca(w,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0});var S=He(l);c=ca(S,"path",{d:!0,transform:!0}),He(c).forEach(te),S.forEach(te),f=kt(w),w.forEach(te),this.h()},h(){_e(c,"d","M5.74,14.28l-.57-.56a.5.5,0,0,1,0-.71h0l5-5-5-5a.5.5,0,0,1,0-.71h0l.57-.56a.5.5,0,0,1,.71,0h0l5.93,5.93a.5.5,0,0,1,0,.7L6.45,14.28a.5.5,0,0,1-.71,0Z"),_e(c,"transform","translate(-5.02 -1.59)"),_e(l,"class","ons-svg-icon svelte-w4p0hu"),_e(l,"viewBox","0 0 8 13"),_e(l,"xmlns","http://www.w3.org/2000/svg"),_e(l,"focusable","false"),_e(r,"class","ons-breadcrumb__item ons-u-p-no")},m(b,w){Be(b,r,w),m.m(r,null),Pe(r,s),Pe(r,l),Pe(l,c),Pe(r,f)},p(b,w){n===(n=d(b))&&m?m.p(b,w):(m.d(1),m=n(b),m&&(m.c(),m.m(r,s)))},d(b){b&&te(r),m.d()}}}function I1(o){let r,s,l=o[0],c=[];for(let f=0;f{"links"in m&&s(0,l=m.links),"width"in m&&s(1,c=m.width),"theme"in m&&s(2,f=m.theme),"themeOverrides"in m&&s(3,d=m.themeOverrides),"background"in m&&s(4,n=m.background)},[l,c,f,d,n]}class P1 extends Wr{constructor(r){super(),Kr(this,r,A1,C1,jr,{links:0,width:1,theme:2,themeOverrides:3,background:4})}}function Gp(o){let r,s;return{c(){r=Ne("h2"),s=zt(o[3]),this.h()},l(l){r=Ue(l,"H2",{class:!0});var c=He(r);s=Mt(c,o[3]),c.forEach(te),this.h()},h(){_e(r,"class","section-title"),Ht(r,"ons-u-vh",o[4])},m(l,c){Be(l,r,c),Pe(r,s)},p(l,c){c&8&&kr(s,l[3]),c&16&&Ht(r,"ons-u-vh",l[4])},d(l){l&&te(r)}}}function z1(o){let r,s,l,c=o[3]&&Gp(o);const f=o[18].default,d=Di(f,o,o[20],null);return{c(){c&&c.c(),r=Et(),s=Ne("div"),d&&d.c(),this.h()},l(n){c&&c.l(n),r=kt(n),s=Ue(n,"DIV",{class:!0});var m=He(s);d&&d.l(m),m.forEach(te),this.h()},h(){_e(s,"class","grid "+o[12]+" svelte-1og4gya"),It(s,"grid-gap",o[14]),It(s,"min-height",o[13])},m(n,m){c&&c.m(n,m),Be(n,r,m),Be(n,s,m),d&&d.m(s,null),l=!0},p(n,m){n[3]?c?c.p(n,m):(c=Gp(n),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null),d&&d.p&&(!l||m&1048576)&&Ri(d,f,n,n[20],l?Bi(f,n[20],m,null):Li(n[20]),null)},i(n){l||(qe(d,n),l=!0)},o(n){nt(d,n),l=!1},d(n){c&&c.d(n),n&&te(r),n&&te(s),d&&d.d(n)}}}function Zp(o){let r,s,l;return s=new ic({props:{cls:o[1],theme:o[5],themeOverrides:o[6],width:"narrow",marginBottom:o[8],$$slots:{default:[M1]},$$scope:{ctx:o}}}),{c(){r=Ne("figcaption"),ir(s.$$.fragment),this.h()},l(c){r=Ue(c,"FIGCAPTION",{class:!0});var f=He(r);cr(s.$$.fragment,f),f.forEach(te),this.h()},h(){_e(r,"class","svelte-1og4gya")},m(c,f){Be(c,r,f),nr(s,r,null),l=!0},p(c,f){const d={};f&2&&(d.cls=c[1]),f&32&&(d.theme=c[5]),f&64&&(d.themeOverrides=c[6]),f&256&&(d.marginBottom=c[8]),f&1049088&&(d.$$scope={dirty:f,ctx:c}),s.$set(d)},i(c){l||(qe(s.$$.fragment,c),l=!0)},o(c){nt(s.$$.fragment,c),l=!1},d(c){c&&te(r),sr(s)}}}function M1(o){let r;return{c(){r=Ne("span"),this.h()},l(s){r=Ue(s,"SPAN",{class:!0});var l=He(r);l.forEach(te),this.h()},h(){_e(r,"class","ons-figure__caption")},m(s,l){Be(s,r,l),r.innerHTML=o[9]},p(s,l){l&512&&(r.innerHTML=s[9])},d(s){s&&te(r)}}}function D1(o){let r,s,l,c,f;s=new ic({props:{id:o[0],cls:o[1],theme:o[5],themeOverrides:o[6],width:o[2],height:["tall","full"].includes(o[10])?o[10]:"auto",marginTop:o[7],marginBottom:o[9]?!1:o[8],$$slots:{default:[z1]},$$scope:{ctx:o}}});let d=o[9]&&Zp(o);return{c(){r=Ne("figure"),ir(s.$$.fragment),l=Et(),d&&d.c(),this.h()},l(n){r=Ue(n,"FIGURE",{"aria-label":!0,class:!0});var m=He(r);cr(s.$$.fragment,m),l=kt(m),d&&d.l(m),m.forEach(te),this.h()},h(){_e(r,"aria-label",o[9]),_e(r,"class","svelte-1og4gya"),h_(()=>o[19].call(r))},m(n,m){Be(n,r,m),nr(s,r,null),Pe(r,l),d&&d.m(r,null),c=f_(r,o[19].bind(r)),f=!0},p(n,[m]){const b={};m&1&&(b.id=n[0]),m&2&&(b.cls=n[1]),m&32&&(b.theme=n[5]),m&64&&(b.themeOverrides=n[6]),m&4&&(b.width=n[2]),m&1024&&(b.height=["tall","full"].includes(n[10])?n[10]:"auto"),m&128&&(b.marginTop=n[7]),m&768&&(b.marginBottom=n[9]?!1:n[8]),m&1048600&&(b.$$scope={dirty:m,ctx:n}),s.$set(b),n[9]?d?(d.p(n,m),m&512&&qe(d,1)):(d=Zp(n),d.c(),qe(d,1),d.m(r,null)):d&&(Nr(),nt(d,1,1,()=>{d=null}),Ur()),(!f||m&512)&&_e(r,"aria-label",n[9])},i(n){f||(qe(s.$$.fragment,n),qe(d),f=!0)},o(n){nt(s.$$.fragment,n),nt(d),f=!1},d(n){n&&te(r),sr(s),d&&d.d(),c()}}}function R1(o,r,s){let l,{$$slots:c={},$$scope:f}=r,{id:d=null}=r,{cls:n=null}=r,{width:m="medium"}=r,{title:b=""}=r,{hideTitle:w=!1}=r,{theme:S=null}=r,{themeOverrides:k=null}=r,{marginTop:A=!1}=r,{marginBottom:P=!0}=r,{colwidth:T="medium"}=r,{caption:L=""}=r,{height:D=200}=r,{gap:B=12}=r,$=!T||T==="full"?"":`grid-${T}`,J=D==="full"?"100vh":Number.isNaN(D)?D:D+"px",Y=Number.isNaN(B)?B:B+"px";const se={narrow:{w:180,c:4},medium:{w:280,c:3},wide:{w:400,c:2},full:{w:"100%",c:1}};let re;const ce=v_(se[T].c);qa("cols",ce);function ye(){re=this.clientWidth,s(11,re)}return o.$$set=Ae=>{"id"in Ae&&s(0,d=Ae.id),"cls"in Ae&&s(1,n=Ae.cls),"width"in Ae&&s(2,m=Ae.width),"title"in Ae&&s(3,b=Ae.title),"hideTitle"in Ae&&s(4,w=Ae.hideTitle),"theme"in Ae&&s(5,S=Ae.theme),"themeOverrides"in Ae&&s(6,k=Ae.themeOverrides),"marginTop"in Ae&&s(7,A=Ae.marginTop),"marginBottom"in Ae&&s(8,P=Ae.marginBottom),"colwidth"in Ae&&s(15,T=Ae.colwidth),"caption"in Ae&&s(9,L=Ae.caption),"height"in Ae&&s(10,D=Ae.height),"gap"in Ae&&s(16,B=Ae.gap),"$$scope"in Ae&&s(20,f=Ae.$$scope)},o.$$.update=()=>{o.$$.dirty&100352&&s(17,l=T=="full"?1:re?Math.floor((re+B)/(se[T].w+B)):se[T].c),o.$$.dirty&131072&&ce.set(l)},[d,n,m,b,w,S,k,A,P,L,D,re,$,J,Y,T,B,l,c,ye,f]}class L1 extends Wr{constructor(r){super(),Kr(this,r,R1,D1,jr,{id:0,cls:1,width:2,title:3,hideTitle:4,theme:5,themeOverrides:6,marginTop:7,marginBottom:8,colwidth:15,caption:9,height:10,gap:16})}}function B1(o){let r;const s=o[13].default,l=Di(s,o,o[14],null);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f&16384)&&Ri(l,s,c,c[14],r?Bi(s,c[14],f,null):Li(c[14]),null)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function O1(o){let r,s;return r=new L1({props:{id:o[0],cls:o[1],width:o[2],height:o[10],title:o[3],hideTitle:o[4],theme:o[5],themeOverrides:o[6],marginTop:o[7],marginBottom:o[8],colwidth:o[9],gap:o[11],$$slots:{default:[B1]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,[c]){const f={};c&1&&(f.id=l[0]),c&2&&(f.cls=l[1]),c&4&&(f.width=l[2]),c&1024&&(f.height=l[10]),c&8&&(f.title=l[3]),c&16&&(f.hideTitle=l[4]),c&32&&(f.theme=l[5]),c&64&&(f.themeOverrides=l[6]),c&128&&(f.marginTop=l[7]),c&256&&(f.marginBottom=l[8]),c&512&&(f.colwidth=l[9]),c&2048&&(f.gap=l[11]),c&16384&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function F1(o,r,s){let{$$slots:l={},$$scope:c}=r,{id:f=null}=r,{cls:d="ons-cards"}=r,{width:n="wide"}=r,{title:m=""}=r,{hideTitle:b=!1}=r,{theme:w=null}=r,{themeOverrides:S=null}=r,{marginTop:k=!1}=r,{marginBottom:A=!0}=r,{colwidth:P="medium"}=r,{height:T=200}=r,{noBackground:L=!1}=r,{gap:D=L?36:16}=r;return qa("noBackground",L),o.$$set=B=>{"id"in B&&s(0,f=B.id),"cls"in B&&s(1,d=B.cls),"width"in B&&s(2,n=B.width),"title"in B&&s(3,m=B.title),"hideTitle"in B&&s(4,b=B.hideTitle),"theme"in B&&s(5,w=B.theme),"themeOverrides"in B&&s(6,S=B.themeOverrides),"marginTop"in B&&s(7,k=B.marginTop),"marginBottom"in B&&s(8,A=B.marginBottom),"colwidth"in B&&s(9,P=B.colwidth),"height"in B&&s(10,T=B.height),"noBackground"in B&&s(12,L=B.noBackground),"gap"in B&&s(11,D=B.gap),"$$scope"in B&&s(14,c=B.$$scope)},[f,d,n,m,b,w,S,k,A,P,T,D,L,l,c]}class Tf extends Wr{constructor(r){super(),Kr(this,r,F1,O1,jr,{id:0,cls:1,width:2,title:3,hideTitle:4,theme:5,themeOverrides:6,marginTop:7,marginBottom:8,colwidth:9,height:10,noBackground:12,gap:11})}}const Hp=()=>Math.random().toString(16).slice(2,8),N1=(o,r=!1)=>typeof o=="string"?o.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").concat(r?`-${Hp()}`:""):Hp(),U1=o=>{if(!o)return!1;const r=new Date(o);return!isNaN(r)},Wp=(o,r="en-GB",s={year:"numeric",month:"long",day:"2-digit"})=>new Date(o).toLocaleDateString(r,s);function V1(o){let r,s;return{c(){r=Ne("h3"),s=zt(o[0]),this.h()},l(l){r=Ue(l,"H3",{class:!0});var c=He(r);s=Mt(c,o[0]),c.forEach(te),this.h()},h(){_e(r,"class","ons-card__title ons-u-fs-m"),Ht(r,"ons-u-vh",o[2]),It(r,"padding",o[8]?"":"8px 16px 0"),It(r,"margin-bottom","5px")},m(l,c){Be(l,r,c),Pe(r,s)},p(l,c){c&1&&kr(s,l[0]),c&4&&Ht(r,"ons-u-vh",l[2]),c&256&&It(r,"padding",l[8]?"":"8px 16px 0")},d(l){l&&te(r)}}}function $1(o){let r,s,l,c,f=o[3]&&Kp(o);return{c(){r=Ne("a"),f&&f.c(),s=Et(),l=Ne("h3"),c=zt(o[0]),this.h()},l(d){r=Ue(d,"A",{href:!0,class:!0});var n=He(r);f&&f.l(n),s=kt(n),l=Ue(n,"H3",{class:!0});var m=He(l);c=Mt(m,o[0]),m.forEach(te),n.forEach(te),this.h()},h(){_e(l,"class","ons-card__title ons-u-fs-m"),It(l,"padding",!o[8]&&!o[3]?"12px 16px 0":o[8]?"":"0 16px"),_e(r,"href",o[5]),_e(r,"class","ons-card__link ons-u-db"),Ht(r,"ons-u-vh",o[2])},m(d,n){Be(d,r,n),f&&f.m(r,null),Pe(r,s),Pe(r,l),Pe(l,c)},p(d,n){d[3]?f?f.p(d,n):(f=Kp(d),f.c(),f.m(r,s)):f&&(f.d(1),f=null),n&1&&kr(c,d[0]),n&264&&It(l,"padding",!d[8]&&!d[3]?"12px 16px 0":d[8]?"":"0 16px"),n&32&&_e(r,"href",d[5]),n&4&&Ht(r,"ons-u-vh",d[2])},d(d){d&&te(r),f&&f.d()}}}function Kp(o){let r,s;return{c(){r=Ne("img"),this.h()},l(l){r=Ue(l,"IMG",{class:!0,src:!0,alt:!0,loading:!0}),this.h()},h(){_e(r,"class","ons-card__image ons-u-mb-s svelte-1s3ctdj"),zu(r.src,s=o[3])||_e(r,"src",s),_e(r,"alt",o[4]),_e(r,"loading","lazy"),It(r,"width","100%")},m(l,c){Be(l,r,c)},p(l,c){c&8&&!zu(r.src,s=l[3])&&_e(r,"src",s),c&16&&_e(r,"alt",l[4])},d(l){l&&te(r)}}}function j1(o){let r,s,l,c,f,d,n,m=`span ${o[9]&&o[10]<3?o[10]:o[6]==1?1:o[6]>o[10]?o[10]:o[6]}`,b;function w(T,L){if(T[5]&&T[0])return $1;if(T[0])return V1}let S=w(o),k=S&&S(o);const A=o[13].default,P=Di(A,o,o[12],null);return{c(){r=Ne("div"),s=Ne("div"),k&&k.c(),l=Et(),c=Ne("div"),P&&P.c(),this.h()},l(T){r=Ue(T,"DIV",{class:!0});var L=He(r);s=Ue(L,"DIV",{id:!0,class:!0,"aria-describedby":!0});var D=He(s);k&&k.l(D),l=kt(D),c=Ue(D,"DIV",{id:!0,class:!0});var B=He(c);P&&P.l(B),B.forEach(te),D.forEach(te),L.forEach(te),this.h()},h(){_e(c,"id",f=o[1]+"_text"),_e(c,"class","svelte-1s3ctdj"),Ht(c,"tile__body",!o[8]),_e(s,"id",o[1]),_e(s,"class","ons-card"),_e(s,"aria-describedby",d=o[1]+"_text"),_e(r,"class",n=Pu(o[8]?"":"tile tile__content")+" svelte-1s3ctdj"),It(r,"grid-column",m),It(r,"grid-column-end",o[9]?o[10]+1:null),It(r,"grid-row",o[7]>1?`span ${o[7]}`:null)},m(T,L){Be(T,r,L),Pe(r,s),k&&k.m(s,null),Pe(s,l),Pe(s,c),P&&P.m(c,null),b=!0},p(T,[L]){S===(S=w(T))&&k?k.p(T,L):(k&&k.d(1),k=S&&S(T),k&&(k.c(),k.m(s,l))),P&&P.p&&(!b||L&4096)&&Ri(P,A,T,T[12],b?Bi(A,T[12],L,null):Li(T[12]),null),(!b||L&2&&f!==(f=T[1]+"_text"))&&_e(c,"id",f),(!b||L&256)&&Ht(c,"tile__body",!T[8]),(!b||L&2)&&_e(s,"id",T[1]),(!b||L&2&&d!==(d=T[1]+"_text"))&&_e(s,"aria-describedby",d),(!b||L&256&&n!==(n=Pu(T[8]?"":"tile tile__content")+" svelte-1s3ctdj"))&&_e(r,"class",n),L&1600&&m!==(m=`span ${T[9]&&T[10]<3?T[10]:T[6]==1?1:T[6]>T[10]?T[10]:T[6]}`)&&It(r,"grid-column",m),L&1536&&It(r,"grid-column-end",T[9]?T[10]+1:null),L&128&&It(r,"grid-row",T[7]>1?`span ${T[7]}`:null)},i(T){b||(qe(P,T),b=!0)},o(T){nt(P,T),b=!1},d(T){T&&te(r),k&&k.d(),P&&P.d(T)}}}function q1(o,r,s){let l,{$$slots:c={},$$scope:f}=r,{title:d=null}=r,{id:n=N1(d)}=r,{hideTitle:m=!1}=r,{image:b=null}=r,{imageAlt:w=null}=r,{href:S=null}=r,{colspan:k=1}=r,{rowspan:A=1}=r,{noBackground:P=Ga("noBackground")||!1}=r,{grow:T=!1}=r;const L=Ga("cols");return Uu(o,L,D=>s(10,l=D)),o.$$set=D=>{"title"in D&&s(0,d=D.title),"id"in D&&s(1,n=D.id),"hideTitle"in D&&s(2,m=D.hideTitle),"image"in D&&s(3,b=D.image),"imageAlt"in D&&s(4,w=D.imageAlt),"href"in D&&s(5,S=D.href),"colspan"in D&&s(6,k=D.colspan),"rowspan"in D&&s(7,A=D.rowspan),"noBackground"in D&&s(8,P=D.noBackground),"grow"in D&&s(9,T=D.grow),"$$scope"in D&&s(12,f=D.$$scope)},[d,n,m,b,w,S,k,A,P,T,l,L,f,c]}class Os extends Wr{constructor(r){super(),Kr(this,r,q1,j1,jr,{title:0,id:1,hideTitle:2,image:3,imageAlt:4,href:5,colspan:6,rowspan:7,noBackground:8,grow:9})}}function Xp(o){let r,s;return{c(){r=Ne("div"),s=zt("!"),this.h()},l(l){r=Ue(l,"DIV",{class:!0,"aria-hidden":!0});var c=He(r);s=Mt(c,"!"),c.forEach(te),this.h()},h(){_e(r,"class","ons-panel__icon"),_e(r,"aria-hidden","true")},m(l,c){Be(l,r,c),Pe(r,s)},d(l){l&&te(r)}}}function Jp(o){let r,s,l;return{c(){r=Ne("p"),s=Ne("strong"),l=zt(o[0])},l(c){r=Ue(c,"P",{});var f=He(r);s=Ue(f,"STRONG",{});var d=He(s);l=Mt(d,o[0]),d.forEach(te),f.forEach(te)},m(c,f){Be(c,r,f),Pe(r,s),Pe(s,l)},p(c,f){f&1&&kr(l,c[0])},d(c){c&&te(r)}}}function G1(o){let r,s,l,c,f=o[1]==="warning"?"Warning:":"Important information:",d,n,m,b,w,S,k,A=o[2]&&Xp(),P=o[0]&&Jp(o);const T=o[5].default,L=Di(T,o,o[4],null);return{c(){r=Ne("div"),s=Ne("div"),A&&A.c(),l=Et(),c=Ne("span"),d=zt(f),n=Et(),m=Ne("div"),b=Ne("div"),P&&P.c(),w=Et(),L&&L.c(),this.h()},l(D){r=Ue(D,"DIV",{class:!0,style:!0});var B=He(r);s=Ue(B,"DIV",{class:!0});var $=He(s);A&&A.l($),l=kt($),c=Ue($,"SPAN",{class:!0});var J=He(c);d=Mt(J,f),J.forEach(te),n=kt($),m=Ue($,"DIV",{class:!0});var Y=He(m);b=Ue(Y,"DIV",{class:!0});var se=He(b);P&&P.l(se),w=kt(se),L&&L.l(se),se.forEach(te),Y.forEach(te),$.forEach(te),B.forEach(te),this.h()},h(){_e(c,"class","ons-panel__assistive-text ons-u-vh"),_e(b,"class","default-line-height"),Ht(b,"ons-u-fs-r",o[1]!=="warning"),_e(m,"class","ons-panel__body"),_e(s,"class","ons-u-bg--tr"),Ht(s,"ons-panel--warn",o[2]&&o[1]!=="warning"),_e(r,"class",S="ons-panel "+(o[1]==="warning"?"ons-panel--warn":"ons-panel--info")+" ons-panel--no-title svelte-1l6efpg"),_e(r,"style",o[3])},m(D,B){Be(D,r,B),Pe(r,s),A&&A.m(s,null),Pe(s,l),Pe(s,c),Pe(c,d),Pe(s,n),Pe(s,m),Pe(m,b),P&&P.m(b,null),Pe(b,w),L&&L.m(b,null),k=!0},p(D,[B]){D[2]?A||(A=Xp(),A.c(),A.m(s,l)):A&&(A.d(1),A=null),(!k||B&2)&&f!==(f=D[1]==="warning"?"Warning:":"Important information:")&&kr(d,f),D[0]?P?P.p(D,B):(P=Jp(D),P.c(),P.m(b,w)):P&&(P.d(1),P=null),L&&L.p&&(!k||B&16)&&Ri(L,T,D,D[4],k?Bi(T,D[4],B,null):Li(D[4]),null),(!k||B&2)&&Ht(b,"ons-u-fs-r",D[1]!=="warning"),(!k||B&6)&&Ht(s,"ons-panel--warn",D[2]&&D[1]!=="warning"),(!k||B&2&&S!==(S="ons-panel "+(D[1]==="warning"?"ons-panel--warn":"ons-panel--info")+" ons-panel--no-title svelte-1l6efpg"))&&_e(r,"class",S),(!k||B&8)&&_e(r,"style",D[3])},i(D){k||(qe(L,D),k=!0)},o(D){nt(L,D),k=!1},d(D){D&&te(r),A&&A.d(),P&&P.d(),L&&L.d(D)}}}function Z1(o,r,s){let l,{$$slots:c={},$$scope:f}=r,{title:d=null}=r,{mode:n="info"}=r,{important:m=n==="warning"}=r;return o.$$set=b=>{"title"in b&&s(0,d=b.title),"mode"in b&&s(1,n=b.mode),"important"in b&&s(2,m=b.important),"$$scope"in b&&s(4,f=b.$$scope)},o.$$.update=()=>{o.$$.dirty&2&&s(3,l=n==="success"?"background: var(--ons-color-success-tint); border-color: var(--ons-color-success);":n==="pending"?"background: var(--ons-color-pending-tint); border-color: var(--ons-color-pending);":n==="error"?"background: var(--ons-color-errors-tint); border-color: var(--ons-color-errors);":null)},[d,n,m,l,f,c]}class x_ extends Wr{constructor(r){super(),Kr(this,r,Z1,G1,jr,{title:0,mode:1,important:2})}}function Yp(o,r,s){const l=o.slice();return l[1]=r[s],l[3]=s,l}function Qp(o){let r,s=o[0],l=[];for(let c=0;c{"meta"in c&&s(0,l=c.meta)},[l]}class J1 extends Wr{constructor(r){super(),Kr(this,r,X1,K1,jr,{meta:0})}}const Y1=o=>({}),rm=o=>({}),Q1=o=>({}),im=o=>({}),ev=o=>({}),nm=o=>({});function sm(o){let r,s,l,c,f;return{c(){r=Ne("div"),s=Ne("div"),l=Ne("a"),c=Ne("img"),this.h()},l(d){r=Ue(d,"DIV",{class:!0});var n=He(r);s=Ue(n,"DIV",{class:!0});var m=He(s);l=Ue(m,"A",{href:!0,class:!0});var b=He(l);c=Ue(b,"IMG",{src:!0,alt:!0,class:!0}),b.forEach(te),m.forEach(te),n.forEach(te),this.h()},h(){zu(c.src,f="//cdn.ons.gov.uk/assets/images/ons-logo/kitemark/uksa-kitemark.svg")||_e(c,"src",f),_e(c,"alt","UK Statistics Authority Kitemark"),_e(c,"class","national-statistics__logo"),_e(l,"href","https://uksa.statisticsauthority.gov.uk/about-the-authority/uk-statistical-system/types-of-official-statistics/"),_e(l,"class","national-statistics__link ons-u-fs-xxxl"),_e(s,"class","ons-grid--flex ons-grid--between@m ons-u-mt-s@m ons-u-mb-m@xxs ons-u-flex-jc-fe@m"),_e(r,"class","ons-grid__col ons-col-2@m svelte-lohx48")},m(d,n){Be(d,r,n),Pe(r,s),Pe(s,l),Pe(l,c)},d(d){d&&te(r)}}}function am(o){let r,s,l,c;return{c(){r=Ne("div"),s=Ne("div"),l=Ne("img"),this.h()},l(f){r=Ue(f,"DIV",{class:!0});var d=He(r);s=Ue(d,"DIV",{class:!0});var n=He(s);l=Ue(n,"IMG",{src:!0,title:!0,alt:!0,class:!0,focusable:!0,width:!0,height:!0}),n.forEach(te),d.forEach(te),this.h()},h(){zu(l.src,c="https://cdn.ons.gov.uk/assets/images/census-logo/logo-census-2021-purple-landscape.svg")||_e(l,"src",c),_e(l,"title","Census 2021"),_e(l,"alt","Census 2021"),_e(l,"class","header__svg-logo margin-right--1"),_e(l,"focusable","false"),_e(l,"width","167"),_e(l,"height","32"),_e(s,"class","ons-grid__col svelte-lohx48"),_e(r,"class","ons-grid ons-u-mb-m")},m(f,d){Be(f,r,d),Pe(r,s),Pe(s,l)},d(f){f&&te(r)}}}function tv(o){let r,s,l,c,f,d,n,m,b,w,S,k,A,P;const T=o[7].before,L=Di(T,o,o[8],nm);let D=o[1]&&sm();const B=o[7].default,$=Di(B,o,o[8],null),J=o[7].brand,Y=Di(J,o,o[8],im);let se=o[2]&&am();k=new J1({props:{meta:o[3]}});const re=o[7].after,ce=Di(re,o,o[8],rm);return{c(){r=Ne("section"),L&&L.c(),s=Et(),l=Ne("div"),c=Ne("div"),f=Ne("h1"),d=zt(o[0]),n=Et(),D&&D.c(),m=Et(),$&&$.c(),b=Et(),Y&&Y.c(),w=Et(),se&&se.c(),S=Et(),ir(k.$$.fragment),A=Et(),ce&&ce.c(),this.h()},l(ye){r=Ue(ye,"SECTION",{class:!0});var Ae=He(r);L&&L.l(Ae),s=kt(Ae),l=Ue(Ae,"DIV",{class:!0});var _t=He(l);c=Ue(_t,"DIV",{class:!0});var le=He(c);f=Ue(le,"H1",{class:!0});var We=He(f);d=Mt(We,o[0]),We.forEach(te),le.forEach(te),n=kt(_t),D&&D.l(_t),_t.forEach(te),m=kt(Ae),$&&$.l(Ae),b=kt(Ae),Y&&Y.l(Ae),w=kt(Ae),se&&se.l(Ae),S=kt(Ae),cr(k.$$.fragment,Ae),A=kt(Ae),ce&&ce.l(Ae),Ae.forEach(te),this.h()},h(){_e(f,"class","ons-u-fs-xxxl ons-u-mt-s ons-u-mb-m ons-u-pb-no ons-u-pt-no"),_e(c,"class","ons-grid__col ons-col-10@m svelte-lohx48"),_e(l,"class","ons-grid"),_e(r,"class","ons-u-mb-xl")},m(ye,Ae){Be(ye,r,Ae),L&&L.m(r,null),Pe(r,s),Pe(r,l),Pe(l,c),Pe(c,f),Pe(f,d),Pe(l,n),D&&D.m(l,null),Pe(r,m),$&&$.m(r,null),Pe(r,b),Y&&Y.m(r,null),Pe(r,w),se&&se.m(r,null),Pe(r,S),nr(k,r,null),Pe(r,A),ce&&ce.m(r,null),P=!0},p(ye,Ae){L&&L.p&&(!P||Ae&256)&&Ri(L,T,ye,ye[8],P?Bi(T,ye[8],Ae,ev):Li(ye[8]),nm),(!P||Ae&1)&&kr(d,ye[0]),ye[1]?D||(D=sm(),D.c(),D.m(l,null)):D&&(D.d(1),D=null),$&&$.p&&(!P||Ae&256)&&Ri($,B,ye,ye[8],P?Bi(B,ye[8],Ae,null):Li(ye[8]),null),Y&&Y.p&&(!P||Ae&256)&&Ri(Y,J,ye,ye[8],P?Bi(J,ye[8],Ae,Q1):Li(ye[8]),im),ye[2]?se||(se=am(),se.c(),se.m(r,S)):se&&(se.d(1),se=null);const _t={};Ae&8&&(_t.meta=ye[3]),k.$set(_t),ce&&ce.p&&(!P||Ae&256)&&Ri(ce,re,ye,ye[8],P?Bi(re,ye[8],Ae,Y1):Li(ye[8]),rm)},i(ye){P||(qe(L,ye),qe($,ye),qe(Y,ye),qe(k.$$.fragment,ye),qe(ce,ye),P=!0)},o(ye){nt(L,ye),nt($,ye),nt(Y,ye),nt(k.$$.fragment,ye),nt(ce,ye),P=!1},d(ye){ye&&te(r),L&&L.d(ye),D&&D.d(),$&&$.d(ye),Y&&Y.d(ye),se&&se.d(),sr(k),ce&&ce.d(ye)}}}function rv(o){let r,s;return r=new ic({props:{theme:o[4],themeOverrides:o[5],background:o[6],$$slots:{default:[tv]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,[c]){const f={};c&16&&(f.theme=l[4]),c&32&&(f.themeOverrides=l[5]),c&64&&(f.background=l[6]),c&271&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function iv(o,r,s){let{$$slots:l={},$$scope:c}=r,{title:f="Page title"}=r,{natStatBadge:d=!1}=r,{censusLogo:n=!1}=r,{meta:m=null}=r,{theme:b=null}=r,{themeOverrides:w=null}=r,{background:S=null}=r;return o.$$set=k=>{"title"in k&&s(0,f=k.title),"natStatBadge"in k&&s(1,d=k.natStatBadge),"censusLogo"in k&&s(2,n=k.censusLogo),"meta"in k&&s(3,m=k.meta),"theme"in k&&s(4,b=k.theme),"themeOverrides"in k&&s(5,w=k.themeOverrides),"background"in k&&s(6,S=k.background),"$$scope"in k&&s(8,c=k.$$scope)},[f,d,n,m,b,w,S,l,c]}class nv extends Wr{constructor(r){super(),Kr(this,r,iv,rv,jr,{title:0,natStatBadge:1,censusLogo:2,meta:3,theme:4,themeOverrides:5,background:6})}}function om(o){let r,s,l,c;return{c(){r=la("svg"),s=la("path"),this.h()},l(f){r=ca(f,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var d=He(r);s=ca(d,"path",{d:!0}),He(s).forEach(te),d.forEach(te),this.h()},h(){_e(s,"d",l=o[3][o[0]].d),_e(r,"class","ons-svg-icon"),_e(r,"viewBox",c=o[3][o[0]].viewBox),_e(r,"xmlns","http://www.w3.org/2000/svg"),_e(r,"focusable","false"),_e(r,"fill","currentColor"),Ht(r,"ons-u-ml-xs",o[1]),Ht(r,"ons-u-mr-xs",o[2])},m(f,d){Be(f,r,d),Pe(r,s)},p(f,d){d&1&&l!==(l=f[3][f[0]].d)&&_e(s,"d",l),d&1&&c!==(c=f[3][f[0]].viewBox)&&_e(r,"viewBox",c),d&2&&Ht(r,"ons-u-ml-xs",f[1]),d&4&&Ht(r,"ons-u-mr-xs",f[2])},d(f){f&&te(r)}}}function sv(o){let r,s=o[3][o[0]]&&om(o);return{c(){s&&s.c(),r=er()},l(l){s&&s.l(l),r=er()},m(l,c){s&&s.m(l,c),Be(l,r,c)},p(l,[c]){l[3][l[0]]?s?s.p(l,c):(s=om(l),s.c(),s.m(r.parentNode,r)):s&&(s.d(1),s=null)},i:_r,o:_r,d(l){s&&s.d(l),l&&te(r)}}}function av(o,r,s){let{type:l="arrow"}=r,{marginLeft:c=!1}=r,{marginRight:f=!1}=r;const d={arrow:{d:"m10 .2-.9.9c-.1.1-.1.4 0 .5l4 4H.6c-.2 0-.4.2-.4.4v1.2c0 .2.2.4.4.4h12.5l-3.9 3.7c-.2.2-.2.4 0 .6l.8.9c.2.2.4.2.6 0L16.8 7c.2-.2.2-.4 0-.6L10.7.3c-.3-.2-.5-.2-.7-.1z",viewBox:"0 0 17 13"},externalLink:{d:"M13.5,9H13a.5.5,0,0,0-.5.5v3h-9v-9h3A.5.5,0,0,0,7,3V2.5A.5.5,0,0,0,6.5,2h-4a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5h11a.5.5,0,0,0,.5-.5v-4A.5.5,0,0,0,13.5,9Z M8.83,7.88a.51.51,0,0,0,.71,0l2.31-2.32,1.28,1.28A.51.51,0,0,0,14,6.49v-4a.52.52,0,0,0-.5-.5h-4A.51.51,0,0,0,9,2.52a.58.58,0,0,0,.14.33l1.28,1.28L8.12,6.46a.51.51,0,0,0,0,.71Z",viewBox:"2 2 12 12"},signout:{d:"M13.85,7.65l-2.5-2.5a.5.5,0,0,0-.71,0,.48.48,0,0,0-.15.36V7h-3a.5.5,0,0,0-.5.5v1a.5.5,0,0,0,.5.5h3v1.5A.49.49,0,0,0,11,11a.48.48,0,0,0,.34-.14l2.51-2.5a.49.49,0,0,0,0-.68Z M8.5,14h-6a.5.5,0,0,1-.5-.5V2.5A.5.5,0,0,1,2.5,2h6a.5.5,0,0,1,.5.5V3a.5.5,0,0,1-.5.5h-5v9h5A.5.5,0,0,1,9,13v.5A.5.5,0,0,1,8.5,14Z",viewBox:"0 0 12 12"},print:{d:"M17 4H3C1.3 4 0 5.2 0 6.8v5.5h4V16h12v-3.7h4V6.8C20 5.2 18.7 4 17 4zm-3 10H6V9h8v5zm3-6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-1-8H4v3h12V0z",viewBox:"0 0 20 16"},download:{d:"M5.6 9a.48.48 0 0 0 .7 0l3-3.2a.48.48 0 0 0 0-.7C9.3 5 9.2 5 9 5H7.5V.5A.47.47 0 0 0 7 0H5a.47.47 0 0 0-.5.5V5H3a.47.47 0 0 0-.5.5.37.37 0 0 0 .1.3Z M11.5 9H11a.47.47 0 0 0-.5.5v1h-9v-1A.47.47 0 0 0 1 9H.5a.47.47 0 0 0-.5.5v2a.47.47 0 0 0 .5.5h11a.47.47 0 0 0 .5-.5v-2a.47.47 0 0 0-.5-.5Z",viewBox:"0 0 12 12"},tick:{d:"M14.35,3.9l-.71-.71a.5.5,0,0,0-.71,0h0L5.79,10.34,3.07,7.61a.51.51,0,0,0-.71,0l-.71.71a.51.51,0,0,0,0,.71l3.78,3.78a.5.5,0,0,0,.71,0h0L14.35,4.6A.5.5,0,0,0,14.35,3.9Z",viewBox:"1.5 3 13 10"},search:{d:"M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z",viewBox:"0 0 12 12"}};return o.$$set=n=>{"type"in n&&s(0,l=n.type),"marginLeft"in n&&s(1,c=n.marginLeft),"marginRight"in n&&s(2,f=n.marginRight)},[l,c,f,d]}let ju=class extends Wr{constructor(r){super(),Kr(this,r,av,sv,jr,{type:0,marginLeft:1,marginRight:2})}};function ov(o){let r,s,l,c,f,d,n,m,b=o[4]&&o[5]==="before"&&lm(o);const w=o[9].default,S=Di(w,o,o[8],null);let k=o[4]&&o[5]==="after"&&cm(o);return{c(){r=Ne("button"),s=Ne("span"),b&&b.c(),l=Et(),c=Ne("span"),S&&S.c(),f=Et(),k&&k.c(),this.h()},l(A){r=Ue(A,"BUTTON",{type:!0,class:!0});var P=He(r);s=Ue(P,"SPAN",{class:!0});var T=He(s);b&&b.l(T),l=kt(T),c=Ue(T,"SPAN",{class:!0});var L=He(c);S&&S.l(L),L.forEach(te),f=kt(T),k&&k.l(T),T.forEach(te),P.forEach(te),this.h()},h(){_e(c,"class","ons-btn__text"),_e(s,"class","ons-btn__inner"),_e(r,"type",o[0]),_e(r,"class","ons-btn"),r.disabled=o[6],Ht(r,"ons-btn--small",o[3]),Ht(r,"ons-btn--secondary",o[1]==="secondary"),Ht(r,"ons-btn--ghost",o[1]==="ghost"),Ht(r,"ons-btn--disabled",o[6])},m(A,P){Be(A,r,P),Pe(r,s),b&&b.m(s,null),Pe(s,l),Pe(s,c),S&&S.m(c,null),Pe(s,f),k&&k.m(s,null),d=!0,n||(m=bs(r,"click",o[11]),n=!0)},p(A,P){A[4]&&A[5]==="before"?b?(b.p(A,P),P&48&&qe(b,1)):(b=lm(A),b.c(),qe(b,1),b.m(s,l)):b&&(Nr(),nt(b,1,1,()=>{b=null}),Ur()),S&&S.p&&(!d||P&256)&&Ri(S,w,A,A[8],d?Bi(w,A[8],P,null):Li(A[8]),null),A[4]&&A[5]==="after"?k?(k.p(A,P),P&48&&qe(k,1)):(k=cm(A),k.c(),qe(k,1),k.m(s,null)):k&&(Nr(),nt(k,1,1,()=>{k=null}),Ur()),(!d||P&1)&&_e(r,"type",A[0]),(!d||P&64)&&(r.disabled=A[6]),(!d||P&8)&&Ht(r,"ons-btn--small",A[3]),(!d||P&2)&&Ht(r,"ons-btn--secondary",A[1]==="secondary"),(!d||P&2)&&Ht(r,"ons-btn--ghost",A[1]==="ghost"),(!d||P&64)&&Ht(r,"ons-btn--disabled",A[6])},i(A){d||(qe(b),qe(S,A),qe(k),d=!0)},o(A){nt(b),nt(S,A),nt(k),d=!1},d(A){A&&te(r),b&&b.d(),S&&S.d(A),k&&k.d(),n=!1,m()}}}function lv(o){let r,s,l,c,f,d,n,m,b,w=o[4]&&o[5]==="before"&&um(o);const S=o[9].default,k=Di(S,o,o[8],null);let A=o[4]&&o[5]==="after"&&hm(o);return{c(){r=Ne("a"),s=Ne("span"),w&&w.c(),l=Et(),c=Ne("span"),k&&k.c(),f=Et(),A&&A.c(),this.h()},l(P){r=Ue(P,"A",{href:!0,role:!0,class:!0,disabled:!0});var T=He(r);s=Ue(T,"SPAN",{class:!0});var L=He(s);w&&w.l(L),l=kt(L),c=Ue(L,"SPAN",{class:!0});var D=He(c);k&&k.l(D),D.forEach(te),f=kt(L),A&&A.l(L),L.forEach(te),T.forEach(te),this.h()},h(){_e(c,"class","ons-btn__text"),_e(s,"class","ons-btn__inner"),_e(r,"href",d=o[6]?null:o[2]),_e(r,"role","button"),_e(r,"class","ons-btn ons-btn--link ons-js-submit-btn"),_e(r,"disabled",o[6]),Ht(r,"ons-btn--small",o[3]),Ht(r,"ons-btn--secondary",o[1]==="secondary"),Ht(r,"ons-btn--ghost",o[1]==="ghost"),Ht(r,"ons-btn--disabled",o[6])},m(P,T){Be(P,r,T),Pe(r,s),w&&w.m(s,null),Pe(s,l),Pe(s,c),k&&k.m(c,null),Pe(s,f),A&&A.m(s,null),n=!0,m||(b=bs(r,"click",o[10]),m=!0)},p(P,T){P[4]&&P[5]==="before"?w?(w.p(P,T),T&48&&qe(w,1)):(w=um(P),w.c(),qe(w,1),w.m(s,l)):w&&(Nr(),nt(w,1,1,()=>{w=null}),Ur()),k&&k.p&&(!n||T&256)&&Ri(k,S,P,P[8],n?Bi(S,P[8],T,null):Li(P[8]),null),P[4]&&P[5]==="after"?A?(A.p(P,T),T&48&&qe(A,1)):(A=hm(P),A.c(),qe(A,1),A.m(s,null)):A&&(Nr(),nt(A,1,1,()=>{A=null}),Ur()),(!n||T&68&&d!==(d=P[6]?null:P[2]))&&_e(r,"href",d),(!n||T&64)&&_e(r,"disabled",P[6]),(!n||T&8)&&Ht(r,"ons-btn--small",P[3]),(!n||T&2)&&Ht(r,"ons-btn--secondary",P[1]==="secondary"),(!n||T&2)&&Ht(r,"ons-btn--ghost",P[1]==="ghost"),(!n||T&64)&&Ht(r,"ons-btn--disabled",P[6])},i(P){n||(qe(w),qe(k,P),qe(A),n=!0)},o(P){nt(w),nt(k,P),nt(A),n=!1},d(P){P&&te(r),w&&w.d(),k&&k.d(P),A&&A.d(),m=!1,b()}}}function lm(o){let r,s;return r=new ju({props:{type:o[4],marginRight:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function cm(o){let r,s;return r=new ju({props:{type:o[4],marginLeft:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function um(o){let r,s;return r=new ju({props:{type:o[4],marginRight:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function hm(o){let r,s;return r=new ju({props:{type:o[4],marginLeft:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function cv(o){let r,s,l,c;const f=[lv,ov],d=[];function n(m,b){return m[2]?0:1}return r=n(o),s=d[r]=f[r](o),{c(){s.c(),l=er()},l(m){s.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,[b]){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),s=d[r],s?s.p(m,b):(s=d[r]=f[r](m),s.c()),qe(s,1),s.m(l.parentNode,l))},i(m){c||(qe(s),c=!0)},o(m){nt(s),c=!1},d(m){d[r].d(m),m&&te(l)}}}function uv(o,r,s){let{$$slots:l={},$$scope:c}=r;const f=kf();let{type:d="button"}=r,{variant:n="primary"}=r,{href:m=""}=r,{small:b=!1}=r,{icon:w=""}=r,{iconPosition:S="before"}=r,{disabled:k=!1}=r;const A=T=>f("click",T),P=T=>f("click",T);return o.$$set=T=>{"type"in T&&s(0,d=T.type),"variant"in T&&s(1,n=T.variant),"href"in T&&s(2,m=T.href),"small"in T&&s(3,b=T.small),"icon"in T&&s(4,w=T.icon),"iconPosition"in T&&s(5,S=T.iconPosition),"disabled"in T&&s(6,k=T.disabled),"$$scope"in T&&s(8,c=T.$$scope)},[d,n,m,b,w,S,k,f,c,l,A,P]}class ff extends Wr{constructor(r){super(),Kr(this,r,uv,cv,jr,{type:0,variant:1,href:2,small:3,icon:4,iconPosition:5,disabled:6})}}var Qh=h1,hv=function(o){var r,s,l,c;if(r=/^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(o)){var f=r[1],d=f.replace(/a$/,""),n=d==="cmyk"?4:3;s=Qh[d],l=r[2].replace(/^\s+|\s+$/g,"").split(/\s*,\s*/).map(function(b,w){return/%$/.test(b)&&w===n?parseFloat(b)/100:(/%$/.test(b),parseFloat(b))}),f===d&&l.push(1),c=l[n]===void 0?1:l[n],l=l.slice(0,n),s[d]=function(){return l}}else if(/^#[A-Fa-f0-9]+$/.test(o)){var d=o.replace(/^#/,""),n=d.length;s=Qh.rgb,l=d.split(n===3?/(.)/:/(..)/),l=l.filter(Boolean).map(function(S){return parseInt(n===3?S+S:S,16)}),c=1,s.rgb=function(){return l},l[0]||(l[0]=0),l[1]||(l[1]=0),l[2]||(l[2]=0)}else s=Qh.keyword,s.keyword=function(){return o},l=o,c=1;var m={rgb:void 0,hsl:void 0,hsv:void 0,cmyk:void 0,keyword:void 0,hex:void 0};try{m.rgb=s.rgb(l)}catch{}try{m.hsl=s.hsl(l)}catch{}try{m.hsv=s.hsv(l)}catch{}try{m.cmyk=s.cmyk(l)}catch{}try{m.keyword=s.keyword(l)}catch{}return m.rgb&&(m.hex="#"+m.rgb.map(function(b){var w=b.toString(16);return w.length===1?"0"+w:w}).join("")),m.rgb&&(m.rgba=m.rgb.concat(c)),m.hsl&&(m.hsla=m.hsl.concat(c)),m.hsv&&(m.hsva=m.hsv.concat(c)),m.cmyk&&(m.cmyka=m.cmyk.concat(c)),m};const fv=$u(hv);function dv(o){return o}function pv(o){if(o==null)return dv;var r,s,l=o.scale[0],c=o.scale[1],f=o.translate[0],d=o.translate[1];return function(n,m){m||(r=s=0);var b=2,w=n.length,S=new Array(w);for(S[0]=(r+=n[0])*l+f,S[1]=(s+=n[1])*c+d;b +import{T as o_,c as c1,b as l_,m as Lp,l as ql,d as Mo,e as Bo,p as Bp,f as tc,g as u1,h as h1,t as f1,i as Jh,v as d1,j as p1}from"../chunks/Table.svelte_svelte_type_style_lang.bac3e88c.js";import{b as Zl}from"../chunks/paths.10d75873.js";import{S as Wr,i as Kr,s as jr,e as er,b as Be,v as Nr,d as nt,f as Ur,g as qe,h as te,y as ir,z as cr,A as nr,B as ar,C as Di,k as Ne,a as Et,l as Ue,m as He,c as kt,n as _e,N as Ht,K as Pe,D as Ri,E as Li,F as Bi,Q as Ui,I as ls,J as cs,q as zt,r as Mt,u as kr,V as c_,W as u_,U as qs,p as It,M as Au,G as Gs,H as Nu,X as Pu,L as _r,Y as h_,Z as f_,_ as Ef,O as ba,$ as d_,a0 as p_,R as m1,w as Zs,a1 as Fo,a2 as No,T as m_,o as kf,a3 as Uu,a4 as g_,x as Op}from"../chunks/index.ba35b81f.js";import{p as g1}from"../chunks/stores.c6665ed7.js";import{w as __,h as y_}from"../chunks/singletons.edac9b68.js";function _1(o){let r,a;return r=new o_({props:{id:o[0],cls:o[1],theme:o[6],background:o[8],overrides:o[7],$$slots:{default:[v1]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&1&&(f.id=l[0]),c&2&&(f.cls=l[1]),c&64&&(f.theme=l[6]),c&256&&(f.background=l[8]),c&128&&(f.overrides=l[7]),c&5692&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function y1(o){let r,a;return r=new o_({props:{id:o[0],cls:o[1],theme:o[6],background:o[8],overrides:o[7],$$slots:{default:[b1]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&1&&(f.id=l[0]),c&2&&(f.cls=l[1]),c&64&&(f.theme=l[6]),c&256&&(f.background=l[8]),c&128&&(f.overrides=l[7]),c&5692&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function Fp(o){let r;return{c(){r=Ne("div"),this.h()},l(a){r=Ue(a,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function Np(o){let r;return{c(){r=Ne("div"),this.h()},l(a){r=Ue(a,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function v1(o){let r,a,l,c,f,d=o[4]&&Fp();const n=o[11].default,m=Di(n,o,o[12],null);let b=o[5]&&Np();return{c(){r=Ne("div"),d&&d.c(),a=Et(),m&&m.c(),l=Et(),b&&b.c(),this.h()},l(w){r=Ue(w,"DIV",{id:!0,class:!0});var S=He(r);d&&d.l(S),a=kt(S),m&&m.l(S),l=kt(S),b&&b.l(S),S.forEach(te),this.h()},h(){_e(r,"id",o[10]),_e(r,"class",c="ons-page__container ons-container "+o[9]+" svelte-18rmgoy"),Ht(r,"ons-page__container--wider",o[2]==="wider"),Ht(r,"ons-page__container--full",o[2]==="full"),Ht(r,"ons-page__container--tall-height",o[3]==="tall"),Ht(r,"ons-page__container--full-height",o[3]==="full")},m(w,S){Be(w,r,S),d&&d.m(r,null),Pe(r,a),m&&m.m(r,null),Pe(r,l),b&&b.m(r,null),f=!0},p(w,S){w[4]?d||(d=Fp(),d.c(),d.m(r,a)):d&&(d.d(1),d=null),m&&m.p&&(!f||S&4096)&&Ri(m,n,w,w[12],f?Bi(n,w[12],S,null):Li(w[12]),null),w[5]?b||(b=Np(),b.c(),b.m(r,null)):b&&(b.d(1),b=null),(!f||S&1024)&&_e(r,"id",w[10]),(!f||S&512&&c!==(c="ons-page__container ons-container "+w[9]+" svelte-18rmgoy"))&&_e(r,"class",c),(!f||S&516)&&Ht(r,"ons-page__container--wider",w[2]==="wider"),(!f||S&516)&&Ht(r,"ons-page__container--full",w[2]==="full"),(!f||S&520)&&Ht(r,"ons-page__container--tall-height",w[3]==="tall"),(!f||S&520)&&Ht(r,"ons-page__container--full-height",w[3]==="full")},i(w){f||(qe(m,w),f=!0)},o(w){nt(m,w),f=!1},d(w){w&&te(r),d&&d.d(),m&&m.d(w),b&&b.d()}}}function Up(o){let r;return{c(){r=Ne("div"),this.h()},l(a){r=Ue(a,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function Vp(o){let r;return{c(){r=Ne("div"),this.h()},l(a){r=Ue(a,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","ons-spacer")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function b1(o){let r,a,l,c,f,d,n=o[4]&&Up();const m=o[11].default,b=Di(m,o,o[12],null);let w=o[5]&&Vp();return{c(){r=Ne("div"),n&&n.c(),a=Et(),l=Ne("div"),b&&b.c(),c=Et(),w&&w.c(),this.h()},l(S){r=Ue(S,"DIV",{id:!0,class:!0});var k=He(r);n&&n.l(k),a=kt(k),l=Ue(k,"DIV",{class:!0});var A=He(l);b&&b.l(A),A.forEach(te),c=kt(k),w&&w.l(k),k.forEach(te),this.h()},h(){_e(l,"class","svelte-18rmgoy"),Ht(l,"ons-page__container--narrow",o[2]==="narrow"),Ht(l,"ons-page__container--medium",o[2]==="medium"),_e(r,"id",o[10]),_e(r,"class",f="ons-page__container ons-container "+o[9]+" svelte-18rmgoy"),Ht(r,"ons-page__container--tall-height",o[3]==="tall"),Ht(r,"ons-page__container--full-height",o[3]==="full")},m(S,k){Be(S,r,k),n&&n.m(r,null),Pe(r,a),Pe(r,l),b&&b.m(l,null),Pe(r,c),w&&w.m(r,null),d=!0},p(S,k){S[4]?n||(n=Up(),n.c(),n.m(r,a)):n&&(n.d(1),n=null),b&&b.p&&(!d||k&4096)&&Ri(b,m,S,S[12],d?Bi(m,S[12],k,null):Li(S[12]),null),(!d||k&4)&&Ht(l,"ons-page__container--narrow",S[2]==="narrow"),(!d||k&4)&&Ht(l,"ons-page__container--medium",S[2]==="medium"),S[5]?w||(w=Vp(),w.c(),w.m(r,null)):w&&(w.d(1),w=null),(!d||k&1024)&&_e(r,"id",S[10]),(!d||k&512&&f!==(f="ons-page__container ons-container "+S[9]+" svelte-18rmgoy"))&&_e(r,"class",f),(!d||k&520)&&Ht(r,"ons-page__container--tall-height",S[3]==="tall"),(!d||k&520)&&Ht(r,"ons-page__container--full-height",S[3]==="full")},i(S){d||(qe(b,S),d=!0)},o(S){nt(b,S),d=!1},d(S){S&&te(r),n&&n.d(),b&&b.d(S),w&&w.d()}}}function x1(o){let r,a,l,c,f;const d=[y1,_1],n=[];function m(b,w){return w&4&&(r=null),r==null&&(r=!!["narrow","medium"].includes(b[2])),r?0:1}return a=m(o,-1),l=n[a]=d[a](o),{c(){l.c(),c=er()},l(b){l.l(b),c=er()},m(b,w){n[a].m(b,w),Be(b,c,w),f=!0},p(b,[w]){let S=a;a=m(b,w),a===S?n[a].p(b,w):(Nr(),nt(n[S],1,1,()=>{n[S]=null}),Ur(),l=n[a],l?l.p(b,w):(l=n[a]=d[a](b),l.c()),qe(l,1),l.m(c.parentNode,c))},i(b){f||(qe(l),f=!0)},o(b){nt(l),f=!1},d(b){n[a].d(b),b&&te(c)}}}function w1(o,r,a){let l,c,{$$slots:f={},$$scope:d}=r,{id:n=null}=r,{cls:m=null}=r,{width:b="wide"}=r,{height:w="auto"}=r,{marginTop:S=!1}=r,{marginBottom:k=!1}=r,{theme:A=null}=r,{themeOverrides:P=null}=r,{background:T=null}=r;return o.$$set=L=>{"id"in L&&a(0,n=L.id),"cls"in L&&a(1,m=L.cls),"width"in L&&a(2,b=L.width),"height"in L&&a(3,w=L.height),"marginTop"in L&&a(4,S=L.marginTop),"marginBottom"in L&&a(5,k=L.marginBottom),"theme"in L&&a(6,A=L.theme),"themeOverrides"in L&&a(7,P=L.themeOverrides),"background"in L&&a(8,T=L.background),"$$scope"in L&&a(12,d=L.$$scope)},o.$$.update=()=>{o.$$.dirty&321&&a(10,l=n&&!(A||T)?n:null),o.$$.dirty&322&&a(9,c=m&&!(A||T)?m:"")},[n,m,b,w,S,k,A,P,T,c,l,f,d]}class rc extends Wr{constructor(r){super(),Kr(this,r,w1,x1,jr,{id:0,cls:1,width:2,height:3,marginTop:4,marginBottom:5,theme:6,themeOverrides:7,background:8})}}var Do=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Vu(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function $p(o,r,a){const l=o.slice();return l[5]=r[a],l}function E1(o){let r=o[5].label+"",a;return{c(){a=zt(r)},l(l){a=Mt(l,r)},m(l,c){Be(l,a,c)},p(l,c){c&1&&r!==(r=l[5].label+"")&&kr(a,r)},d(l){l&&te(a)}}}function k1(o){let r,a=o[5].label+"",l,c;return{c(){r=Ne("a"),l=zt(a),this.h()},l(f){r=Ue(f,"A",{class:!0,href:!0});var d=He(r);l=Mt(d,a),d.forEach(te),this.h()},h(){_e(r,"class","ons-breadcrumb__link"),_e(r,"href",c=o[5].href)},m(f,d){Be(f,r,d),Pe(r,l)},p(f,d){d&1&&a!==(a=f[5].label+"")&&kr(l,a),d&1&&c!==(c=f[5].href)&&_e(r,"href",c)},d(f){f&&te(r)}}}function jp(o){let r,a,l,c,f;function d(b,w){return b[5].href?k1:E1}let n=d(o),m=n(o);return{c(){r=Ne("li"),m.c(),a=Et(),l=ls("svg"),c=ls("path"),f=Et(),this.h()},l(b){r=Ue(b,"LI",{class:!0});var w=He(r);m.l(w),a=kt(w),l=cs(w,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0});var S=He(l);c=cs(S,"path",{d:!0,transform:!0}),He(c).forEach(te),S.forEach(te),f=kt(w),w.forEach(te),this.h()},h(){_e(c,"d","M5.74,14.28l-.57-.56a.5.5,0,0,1,0-.71h0l5-5-5-5a.5.5,0,0,1,0-.71h0l.57-.56a.5.5,0,0,1,.71,0h0l5.93,5.93a.5.5,0,0,1,0,.7L6.45,14.28a.5.5,0,0,1-.71,0Z"),_e(c,"transform","translate(-5.02 -1.59)"),_e(l,"class","ons-svg-icon svelte-w4p0hu"),_e(l,"viewBox","0 0 8 13"),_e(l,"xmlns","http://www.w3.org/2000/svg"),_e(l,"focusable","false"),_e(r,"class","ons-breadcrumb__item ons-u-p-no")},m(b,w){Be(b,r,w),m.m(r,null),Pe(r,a),Pe(r,l),Pe(l,c),Pe(r,f)},p(b,w){n===(n=d(b))&&m?m.p(b,w):(m.d(1),m=n(b),m&&(m.c(),m.m(r,a)))},d(b){b&&te(r),m.d()}}}function S1(o){let r,a,l=o[0],c=[];for(let f=0;f{"links"in m&&a(0,l=m.links),"width"in m&&a(1,c=m.width),"theme"in m&&a(2,f=m.theme),"themeOverrides"in m&&a(3,d=m.themeOverrides),"background"in m&&a(4,n=m.background)},[l,c,f,d,n]}class C1 extends Wr{constructor(r){super(),Kr(this,r,I1,T1,jr,{links:0,width:1,theme:2,themeOverrides:3,background:4})}}function qp(o){let r,a;return{c(){r=Ne("h2"),a=zt(o[3]),this.h()},l(l){r=Ue(l,"H2",{class:!0});var c=He(r);a=Mt(c,o[3]),c.forEach(te),this.h()},h(){_e(r,"class","section-title"),Ht(r,"ons-u-vh",o[4])},m(l,c){Be(l,r,c),Pe(r,a)},p(l,c){c&8&&kr(a,l[3]),c&16&&Ht(r,"ons-u-vh",l[4])},d(l){l&&te(r)}}}function A1(o){let r,a,l,c=o[3]&&qp(o);const f=o[18].default,d=Di(f,o,o[20],null);return{c(){c&&c.c(),r=Et(),a=Ne("div"),d&&d.c(),this.h()},l(n){c&&c.l(n),r=kt(n),a=Ue(n,"DIV",{class:!0});var m=He(a);d&&d.l(m),m.forEach(te),this.h()},h(){_e(a,"class","grid "+o[12]+" svelte-1og4gya"),It(a,"grid-gap",o[14]),It(a,"min-height",o[13])},m(n,m){c&&c.m(n,m),Be(n,r,m),Be(n,a,m),d&&d.m(a,null),l=!0},p(n,m){n[3]?c?c.p(n,m):(c=qp(n),c.c(),c.m(r.parentNode,r)):c&&(c.d(1),c=null),d&&d.p&&(!l||m&1048576)&&Ri(d,f,n,n[20],l?Bi(f,n[20],m,null):Li(n[20]),null)},i(n){l||(qe(d,n),l=!0)},o(n){nt(d,n),l=!1},d(n){c&&c.d(n),n&&te(r),n&&te(a),d&&d.d(n)}}}function Gp(o){let r,a,l;return a=new rc({props:{cls:o[1],theme:o[5],themeOverrides:o[6],width:"narrow",marginBottom:o[8],$$slots:{default:[P1]},$$scope:{ctx:o}}}),{c(){r=Ne("figcaption"),ir(a.$$.fragment),this.h()},l(c){r=Ue(c,"FIGCAPTION",{class:!0});var f=He(r);cr(a.$$.fragment,f),f.forEach(te),this.h()},h(){_e(r,"class","svelte-1og4gya")},m(c,f){Be(c,r,f),nr(a,r,null),l=!0},p(c,f){const d={};f&2&&(d.cls=c[1]),f&32&&(d.theme=c[5]),f&64&&(d.themeOverrides=c[6]),f&256&&(d.marginBottom=c[8]),f&1049088&&(d.$$scope={dirty:f,ctx:c}),a.$set(d)},i(c){l||(qe(a.$$.fragment,c),l=!0)},o(c){nt(a.$$.fragment,c),l=!1},d(c){c&&te(r),ar(a)}}}function P1(o){let r;return{c(){r=Ne("span"),this.h()},l(a){r=Ue(a,"SPAN",{class:!0});var l=He(r);l.forEach(te),this.h()},h(){_e(r,"class","ons-figure__caption")},m(a,l){Be(a,r,l),r.innerHTML=o[9]},p(a,l){l&512&&(r.innerHTML=a[9])},d(a){a&&te(r)}}}function z1(o){let r,a,l,c,f;a=new rc({props:{id:o[0],cls:o[1],theme:o[5],themeOverrides:o[6],width:o[2],height:["tall","full"].includes(o[10])?o[10]:"auto",marginTop:o[7],marginBottom:o[9]?!1:o[8],$$slots:{default:[A1]},$$scope:{ctx:o}}});let d=o[9]&&Gp(o);return{c(){r=Ne("figure"),ir(a.$$.fragment),l=Et(),d&&d.c(),this.h()},l(n){r=Ue(n,"FIGURE",{"aria-label":!0,class:!0});var m=He(r);cr(a.$$.fragment,m),l=kt(m),d&&d.l(m),m.forEach(te),this.h()},h(){_e(r,"aria-label",o[9]),_e(r,"class","svelte-1og4gya"),c_(()=>o[19].call(r))},m(n,m){Be(n,r,m),nr(a,r,null),Pe(r,l),d&&d.m(r,null),c=u_(r,o[19].bind(r)),f=!0},p(n,[m]){const b={};m&1&&(b.id=n[0]),m&2&&(b.cls=n[1]),m&32&&(b.theme=n[5]),m&64&&(b.themeOverrides=n[6]),m&4&&(b.width=n[2]),m&1024&&(b.height=["tall","full"].includes(n[10])?n[10]:"auto"),m&128&&(b.marginTop=n[7]),m&768&&(b.marginBottom=n[9]?!1:n[8]),m&1048600&&(b.$$scope={dirty:m,ctx:n}),a.$set(b),n[9]?d?(d.p(n,m),m&512&&qe(d,1)):(d=Gp(n),d.c(),qe(d,1),d.m(r,null)):d&&(Nr(),nt(d,1,1,()=>{d=null}),Ur()),(!f||m&512)&&_e(r,"aria-label",n[9])},i(n){f||(qe(a.$$.fragment,n),qe(d),f=!0)},o(n){nt(a.$$.fragment,n),nt(d),f=!1},d(n){n&&te(r),ar(a),d&&d.d(),c()}}}function M1(o,r,a){let l,{$$slots:c={},$$scope:f}=r,{id:d=null}=r,{cls:n=null}=r,{width:m="medium"}=r,{title:b=""}=r,{hideTitle:w=!1}=r,{theme:S=null}=r,{themeOverrides:k=null}=r,{marginTop:A=!1}=r,{marginBottom:P=!0}=r,{colwidth:T="medium"}=r,{caption:L=""}=r,{height:D=200}=r,{gap:B=12}=r,$=!T||T==="full"?"":`grid-${T}`,J=D==="full"?"100vh":Number.isNaN(D)?D:D+"px",Y=Number.isNaN(B)?B:B+"px";const ae={narrow:{w:180,c:4},medium:{w:280,c:3},wide:{w:400,c:2},full:{w:"100%",c:1}};let re;const ce=__(ae[T].c);qs("cols",ce);function ye(){re=this.clientWidth,a(11,re)}return o.$$set=Ae=>{"id"in Ae&&a(0,d=Ae.id),"cls"in Ae&&a(1,n=Ae.cls),"width"in Ae&&a(2,m=Ae.width),"title"in Ae&&a(3,b=Ae.title),"hideTitle"in Ae&&a(4,w=Ae.hideTitle),"theme"in Ae&&a(5,S=Ae.theme),"themeOverrides"in Ae&&a(6,k=Ae.themeOverrides),"marginTop"in Ae&&a(7,A=Ae.marginTop),"marginBottom"in Ae&&a(8,P=Ae.marginBottom),"colwidth"in Ae&&a(15,T=Ae.colwidth),"caption"in Ae&&a(9,L=Ae.caption),"height"in Ae&&a(10,D=Ae.height),"gap"in Ae&&a(16,B=Ae.gap),"$$scope"in Ae&&a(20,f=Ae.$$scope)},o.$$.update=()=>{o.$$.dirty&100352&&a(17,l=T=="full"?1:re?Math.floor((re+B)/(ae[T].w+B)):ae[T].c),o.$$.dirty&131072&&ce.set(l)},[d,n,m,b,w,S,k,A,P,L,D,re,$,J,Y,T,B,l,c,ye,f]}class D1 extends Wr{constructor(r){super(),Kr(this,r,M1,z1,jr,{id:0,cls:1,width:2,title:3,hideTitle:4,theme:5,themeOverrides:6,marginTop:7,marginBottom:8,colwidth:15,caption:9,height:10,gap:16})}}function R1(o){let r;const a=o[13].default,l=Di(a,o,o[14],null);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f&16384)&&Ri(l,a,c,c[14],r?Bi(a,c[14],f,null):Li(c[14]),null)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function L1(o){let r,a;return r=new D1({props:{id:o[0],cls:o[1],width:o[2],height:o[10],title:o[3],hideTitle:o[4],theme:o[5],themeOverrides:o[6],marginTop:o[7],marginBottom:o[8],colwidth:o[9],gap:o[11],$$slots:{default:[R1]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,[c]){const f={};c&1&&(f.id=l[0]),c&2&&(f.cls=l[1]),c&4&&(f.width=l[2]),c&1024&&(f.height=l[10]),c&8&&(f.title=l[3]),c&16&&(f.hideTitle=l[4]),c&32&&(f.theme=l[5]),c&64&&(f.themeOverrides=l[6]),c&128&&(f.marginTop=l[7]),c&256&&(f.marginBottom=l[8]),c&512&&(f.colwidth=l[9]),c&2048&&(f.gap=l[11]),c&16384&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function B1(o,r,a){let{$$slots:l={},$$scope:c}=r,{id:f=null}=r,{cls:d="ons-cards"}=r,{width:n="wide"}=r,{title:m=""}=r,{hideTitle:b=!1}=r,{theme:w=null}=r,{themeOverrides:S=null}=r,{marginTop:k=!1}=r,{marginBottom:A=!0}=r,{colwidth:P="medium"}=r,{height:T=200}=r,{noBackground:L=!1}=r,{gap:D=L?36:16}=r;return qs("noBackground",L),o.$$set=B=>{"id"in B&&a(0,f=B.id),"cls"in B&&a(1,d=B.cls),"width"in B&&a(2,n=B.width),"title"in B&&a(3,m=B.title),"hideTitle"in B&&a(4,b=B.hideTitle),"theme"in B&&a(5,w=B.theme),"themeOverrides"in B&&a(6,S=B.themeOverrides),"marginTop"in B&&a(7,k=B.marginTop),"marginBottom"in B&&a(8,A=B.marginBottom),"colwidth"in B&&a(9,P=B.colwidth),"height"in B&&a(10,T=B.height),"noBackground"in B&&a(12,L=B.noBackground),"gap"in B&&a(11,D=B.gap),"$$scope"in B&&a(14,c=B.$$scope)},[f,d,n,m,b,w,S,k,A,P,T,D,L,l,c]}class Sf extends Wr{constructor(r){super(),Kr(this,r,B1,L1,jr,{id:0,cls:1,width:2,title:3,hideTitle:4,theme:5,themeOverrides:6,marginTop:7,marginBottom:8,colwidth:9,height:10,noBackground:12,gap:11})}}const Zp=()=>Math.random().toString(16).slice(2,8),O1=(o,r=!1)=>typeof o=="string"?o.toString().normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/--+/g,"-").concat(r?`-${Zp()}`:""):Zp(),F1=o=>{if(!o)return!1;const r=new Date(o);return!isNaN(r)},Hp=(o,r="en-GB",a={year:"numeric",month:"long",day:"2-digit"})=>new Date(o).toLocaleDateString(r,a);function N1(o){let r,a;return{c(){r=Ne("h3"),a=zt(o[0]),this.h()},l(l){r=Ue(l,"H3",{class:!0});var c=He(r);a=Mt(c,o[0]),c.forEach(te),this.h()},h(){_e(r,"class","ons-card__title ons-u-fs-m"),Ht(r,"ons-u-vh",o[2]),It(r,"padding",o[8]?"":"8px 16px 0"),It(r,"margin-bottom","5px")},m(l,c){Be(l,r,c),Pe(r,a)},p(l,c){c&1&&kr(a,l[0]),c&4&&Ht(r,"ons-u-vh",l[2]),c&256&&It(r,"padding",l[8]?"":"8px 16px 0")},d(l){l&&te(r)}}}function U1(o){let r,a,l,c,f=o[3]&&Wp(o);return{c(){r=Ne("a"),f&&f.c(),a=Et(),l=Ne("h3"),c=zt(o[0]),this.h()},l(d){r=Ue(d,"A",{href:!0,class:!0});var n=He(r);f&&f.l(n),a=kt(n),l=Ue(n,"H3",{class:!0});var m=He(l);c=Mt(m,o[0]),m.forEach(te),n.forEach(te),this.h()},h(){_e(l,"class","ons-card__title ons-u-fs-m"),It(l,"padding",!o[8]&&!o[3]?"12px 16px 0":o[8]?"":"0 16px"),_e(r,"href",o[5]),_e(r,"class","ons-card__link ons-u-db"),Ht(r,"ons-u-vh",o[2])},m(d,n){Be(d,r,n),f&&f.m(r,null),Pe(r,a),Pe(r,l),Pe(l,c)},p(d,n){d[3]?f?f.p(d,n):(f=Wp(d),f.c(),f.m(r,a)):f&&(f.d(1),f=null),n&1&&kr(c,d[0]),n&264&&It(l,"padding",!d[8]&&!d[3]?"12px 16px 0":d[8]?"":"0 16px"),n&32&&_e(r,"href",d[5]),n&4&&Ht(r,"ons-u-vh",d[2])},d(d){d&&te(r),f&&f.d()}}}function Wp(o){let r,a;return{c(){r=Ne("img"),this.h()},l(l){r=Ue(l,"IMG",{class:!0,src:!0,alt:!0,loading:!0}),this.h()},h(){_e(r,"class","ons-card__image ons-u-mb-s svelte-1s3ctdj"),Pu(r.src,a=o[3])||_e(r,"src",a),_e(r,"alt",o[4]),_e(r,"loading","lazy"),It(r,"width","100%")},m(l,c){Be(l,r,c)},p(l,c){c&8&&!Pu(r.src,a=l[3])&&_e(r,"src",a),c&16&&_e(r,"alt",l[4])},d(l){l&&te(r)}}}function V1(o){let r,a,l,c,f,d,n,m=`span ${o[9]&&o[10]<3?o[10]:o[6]==1?1:o[6]>o[10]?o[10]:o[6]}`,b;function w(T,L){if(T[5]&&T[0])return U1;if(T[0])return N1}let S=w(o),k=S&&S(o);const A=o[13].default,P=Di(A,o,o[12],null);return{c(){r=Ne("div"),a=Ne("div"),k&&k.c(),l=Et(),c=Ne("div"),P&&P.c(),this.h()},l(T){r=Ue(T,"DIV",{class:!0});var L=He(r);a=Ue(L,"DIV",{id:!0,class:!0,"aria-describedby":!0});var D=He(a);k&&k.l(D),l=kt(D),c=Ue(D,"DIV",{id:!0,class:!0});var B=He(c);P&&P.l(B),B.forEach(te),D.forEach(te),L.forEach(te),this.h()},h(){_e(c,"id",f=o[1]+"_text"),_e(c,"class","svelte-1s3ctdj"),Ht(c,"tile__body",!o[8]),_e(a,"id",o[1]),_e(a,"class","ons-card"),_e(a,"aria-describedby",d=o[1]+"_text"),_e(r,"class",n=Au(o[8]?"":"tile tile__content")+" svelte-1s3ctdj"),It(r,"grid-column",m),It(r,"grid-column-end",o[9]?o[10]+1:null),It(r,"grid-row",o[7]>1?`span ${o[7]}`:null)},m(T,L){Be(T,r,L),Pe(r,a),k&&k.m(a,null),Pe(a,l),Pe(a,c),P&&P.m(c,null),b=!0},p(T,[L]){S===(S=w(T))&&k?k.p(T,L):(k&&k.d(1),k=S&&S(T),k&&(k.c(),k.m(a,l))),P&&P.p&&(!b||L&4096)&&Ri(P,A,T,T[12],b?Bi(A,T[12],L,null):Li(T[12]),null),(!b||L&2&&f!==(f=T[1]+"_text"))&&_e(c,"id",f),(!b||L&256)&&Ht(c,"tile__body",!T[8]),(!b||L&2)&&_e(a,"id",T[1]),(!b||L&2&&d!==(d=T[1]+"_text"))&&_e(a,"aria-describedby",d),(!b||L&256&&n!==(n=Au(T[8]?"":"tile tile__content")+" svelte-1s3ctdj"))&&_e(r,"class",n),L&1600&&m!==(m=`span ${T[9]&&T[10]<3?T[10]:T[6]==1?1:T[6]>T[10]?T[10]:T[6]}`)&&It(r,"grid-column",m),L&1536&&It(r,"grid-column-end",T[9]?T[10]+1:null),L&128&&It(r,"grid-row",T[7]>1?`span ${T[7]}`:null)},i(T){b||(qe(P,T),b=!0)},o(T){nt(P,T),b=!1},d(T){T&&te(r),k&&k.d(),P&&P.d(T)}}}function $1(o,r,a){let l,{$$slots:c={},$$scope:f}=r,{title:d=null}=r,{id:n=O1(d)}=r,{hideTitle:m=!1}=r,{image:b=null}=r,{imageAlt:w=null}=r,{href:S=null}=r,{colspan:k=1}=r,{rowspan:A=1}=r,{noBackground:P=Gs("noBackground")||!1}=r,{grow:T=!1}=r;const L=Gs("cols");return Nu(o,L,D=>a(10,l=D)),o.$$set=D=>{"title"in D&&a(0,d=D.title),"id"in D&&a(1,n=D.id),"hideTitle"in D&&a(2,m=D.hideTitle),"image"in D&&a(3,b=D.image),"imageAlt"in D&&a(4,w=D.imageAlt),"href"in D&&a(5,S=D.href),"colspan"in D&&a(6,k=D.colspan),"rowspan"in D&&a(7,A=D.rowspan),"noBackground"in D&&a(8,P=D.noBackground),"grow"in D&&a(9,T=D.grow),"$$scope"in D&&a(12,f=D.$$scope)},[d,n,m,b,w,S,k,A,P,T,l,L,f,c]}class Oa extends Wr{constructor(r){super(),Kr(this,r,$1,V1,jr,{title:0,id:1,hideTitle:2,image:3,imageAlt:4,href:5,colspan:6,rowspan:7,noBackground:8,grow:9})}}function Kp(o){let r,a;return{c(){r=Ne("div"),a=zt("!"),this.h()},l(l){r=Ue(l,"DIV",{class:!0,"aria-hidden":!0});var c=He(r);a=Mt(c,"!"),c.forEach(te),this.h()},h(){_e(r,"class","ons-panel__icon"),_e(r,"aria-hidden","true")},m(l,c){Be(l,r,c),Pe(r,a)},d(l){l&&te(r)}}}function Xp(o){let r,a,l;return{c(){r=Ne("p"),a=Ne("strong"),l=zt(o[0])},l(c){r=Ue(c,"P",{});var f=He(r);a=Ue(f,"STRONG",{});var d=He(a);l=Mt(d,o[0]),d.forEach(te),f.forEach(te)},m(c,f){Be(c,r,f),Pe(r,a),Pe(a,l)},p(c,f){f&1&&kr(l,c[0])},d(c){c&&te(r)}}}function j1(o){let r,a,l,c,f=o[1]==="warning"?"Warning:":"Important information:",d,n,m,b,w,S,k,A=o[2]&&Kp(),P=o[0]&&Xp(o);const T=o[5].default,L=Di(T,o,o[4],null);return{c(){r=Ne("div"),a=Ne("div"),A&&A.c(),l=Et(),c=Ne("span"),d=zt(f),n=Et(),m=Ne("div"),b=Ne("div"),P&&P.c(),w=Et(),L&&L.c(),this.h()},l(D){r=Ue(D,"DIV",{class:!0,style:!0});var B=He(r);a=Ue(B,"DIV",{class:!0});var $=He(a);A&&A.l($),l=kt($),c=Ue($,"SPAN",{class:!0});var J=He(c);d=Mt(J,f),J.forEach(te),n=kt($),m=Ue($,"DIV",{class:!0});var Y=He(m);b=Ue(Y,"DIV",{class:!0});var ae=He(b);P&&P.l(ae),w=kt(ae),L&&L.l(ae),ae.forEach(te),Y.forEach(te),$.forEach(te),B.forEach(te),this.h()},h(){_e(c,"class","ons-panel__assistive-text ons-u-vh"),_e(b,"class","default-line-height"),Ht(b,"ons-u-fs-r",o[1]!=="warning"),_e(m,"class","ons-panel__body"),_e(a,"class","ons-u-bg--tr"),Ht(a,"ons-panel--warn",o[2]&&o[1]!=="warning"),_e(r,"class",S="ons-panel "+(o[1]==="warning"?"ons-panel--warn":"ons-panel--info")+" ons-panel--no-title svelte-1l6efpg"),_e(r,"style",o[3])},m(D,B){Be(D,r,B),Pe(r,a),A&&A.m(a,null),Pe(a,l),Pe(a,c),Pe(c,d),Pe(a,n),Pe(a,m),Pe(m,b),P&&P.m(b,null),Pe(b,w),L&&L.m(b,null),k=!0},p(D,[B]){D[2]?A||(A=Kp(),A.c(),A.m(a,l)):A&&(A.d(1),A=null),(!k||B&2)&&f!==(f=D[1]==="warning"?"Warning:":"Important information:")&&kr(d,f),D[0]?P?P.p(D,B):(P=Xp(D),P.c(),P.m(b,w)):P&&(P.d(1),P=null),L&&L.p&&(!k||B&16)&&Ri(L,T,D,D[4],k?Bi(T,D[4],B,null):Li(D[4]),null),(!k||B&2)&&Ht(b,"ons-u-fs-r",D[1]!=="warning"),(!k||B&6)&&Ht(a,"ons-panel--warn",D[2]&&D[1]!=="warning"),(!k||B&2&&S!==(S="ons-panel "+(D[1]==="warning"?"ons-panel--warn":"ons-panel--info")+" ons-panel--no-title svelte-1l6efpg"))&&_e(r,"class",S),(!k||B&8)&&_e(r,"style",D[3])},i(D){k||(qe(L,D),k=!0)},o(D){nt(L,D),k=!1},d(D){D&&te(r),A&&A.d(),P&&P.d(),L&&L.d(D)}}}function q1(o,r,a){let l,{$$slots:c={},$$scope:f}=r,{title:d=null}=r,{mode:n="info"}=r,{important:m=n==="warning"}=r;return o.$$set=b=>{"title"in b&&a(0,d=b.title),"mode"in b&&a(1,n=b.mode),"important"in b&&a(2,m=b.important),"$$scope"in b&&a(4,f=b.$$scope)},o.$$.update=()=>{o.$$.dirty&2&&a(3,l=n==="success"?"background: var(--ons-color-success-tint); border-color: var(--ons-color-success);":n==="pending"?"background: var(--ons-color-pending-tint); border-color: var(--ons-color-pending);":n==="error"?"background: var(--ons-color-errors-tint); border-color: var(--ons-color-errors);":null)},[d,n,m,l,f,c]}class v_ extends Wr{constructor(r){super(),Kr(this,r,q1,j1,jr,{title:0,mode:1,important:2})}}function Jp(o,r,a){const l=o.slice();return l[1]=r[a],l[3]=a,l}function Yp(o){let r,a=o[0],l=[];for(let c=0;c{"meta"in c&&a(0,l=c.meta)},[l]}class K1 extends Wr{constructor(r){super(),Kr(this,r,W1,H1,jr,{meta:0})}}const X1=o=>({}),tm=o=>({}),J1=o=>({}),rm=o=>({}),Y1=o=>({}),im=o=>({});function nm(o){let r,a,l,c,f;return{c(){r=Ne("div"),a=Ne("div"),l=Ne("a"),c=Ne("img"),this.h()},l(d){r=Ue(d,"DIV",{class:!0});var n=He(r);a=Ue(n,"DIV",{class:!0});var m=He(a);l=Ue(m,"A",{href:!0,class:!0});var b=He(l);c=Ue(b,"IMG",{src:!0,alt:!0,class:!0}),b.forEach(te),m.forEach(te),n.forEach(te),this.h()},h(){Pu(c.src,f="//cdn.ons.gov.uk/assets/images/ons-logo/kitemark/uksa-kitemark.svg")||_e(c,"src",f),_e(c,"alt","UK Statistics Authority Kitemark"),_e(c,"class","national-statistics__logo"),_e(l,"href","https://uksa.statisticsauthority.gov.uk/about-the-authority/uk-statistical-system/types-of-official-statistics/"),_e(l,"class","national-statistics__link ons-u-fs-xxxl"),_e(a,"class","ons-grid--flex ons-grid--between@m ons-u-mt-s@m ons-u-mb-m@xxs ons-u-flex-jc-fe@m"),_e(r,"class","ons-grid__col ons-col-2@m svelte-lohx48")},m(d,n){Be(d,r,n),Pe(r,a),Pe(a,l),Pe(l,c)},d(d){d&&te(r)}}}function am(o){let r,a,l,c;return{c(){r=Ne("div"),a=Ne("div"),l=Ne("img"),this.h()},l(f){r=Ue(f,"DIV",{class:!0});var d=He(r);a=Ue(d,"DIV",{class:!0});var n=He(a);l=Ue(n,"IMG",{src:!0,title:!0,alt:!0,class:!0,focusable:!0,width:!0,height:!0}),n.forEach(te),d.forEach(te),this.h()},h(){Pu(l.src,c="https://cdn.ons.gov.uk/assets/images/census-logo/logo-census-2021-purple-landscape.svg")||_e(l,"src",c),_e(l,"title","Census 2021"),_e(l,"alt","Census 2021"),_e(l,"class","header__svg-logo margin-right--1"),_e(l,"focusable","false"),_e(l,"width","167"),_e(l,"height","32"),_e(a,"class","ons-grid__col svelte-lohx48"),_e(r,"class","ons-grid ons-u-mb-m")},m(f,d){Be(f,r,d),Pe(r,a),Pe(a,l)},d(f){f&&te(r)}}}function Q1(o){let r,a,l,c,f,d,n,m,b,w,S,k,A,P;const T=o[7].before,L=Di(T,o,o[8],im);let D=o[1]&&nm();const B=o[7].default,$=Di(B,o,o[8],null),J=o[7].brand,Y=Di(J,o,o[8],rm);let ae=o[2]&&am();k=new K1({props:{meta:o[3]}});const re=o[7].after,ce=Di(re,o,o[8],tm);return{c(){r=Ne("section"),L&&L.c(),a=Et(),l=Ne("div"),c=Ne("div"),f=Ne("h1"),d=zt(o[0]),n=Et(),D&&D.c(),m=Et(),$&&$.c(),b=Et(),Y&&Y.c(),w=Et(),ae&&ae.c(),S=Et(),ir(k.$$.fragment),A=Et(),ce&&ce.c(),this.h()},l(ye){r=Ue(ye,"SECTION",{class:!0});var Ae=He(r);L&&L.l(Ae),a=kt(Ae),l=Ue(Ae,"DIV",{class:!0});var _t=He(l);c=Ue(_t,"DIV",{class:!0});var le=He(c);f=Ue(le,"H1",{class:!0});var We=He(f);d=Mt(We,o[0]),We.forEach(te),le.forEach(te),n=kt(_t),D&&D.l(_t),_t.forEach(te),m=kt(Ae),$&&$.l(Ae),b=kt(Ae),Y&&Y.l(Ae),w=kt(Ae),ae&&ae.l(Ae),S=kt(Ae),cr(k.$$.fragment,Ae),A=kt(Ae),ce&&ce.l(Ae),Ae.forEach(te),this.h()},h(){_e(f,"class","ons-u-fs-xxxl ons-u-mt-s ons-u-mb-m ons-u-pb-no ons-u-pt-no"),_e(c,"class","ons-grid__col ons-col-10@m svelte-lohx48"),_e(l,"class","ons-grid"),_e(r,"class","ons-u-mb-xl")},m(ye,Ae){Be(ye,r,Ae),L&&L.m(r,null),Pe(r,a),Pe(r,l),Pe(l,c),Pe(c,f),Pe(f,d),Pe(l,n),D&&D.m(l,null),Pe(r,m),$&&$.m(r,null),Pe(r,b),Y&&Y.m(r,null),Pe(r,w),ae&&ae.m(r,null),Pe(r,S),nr(k,r,null),Pe(r,A),ce&&ce.m(r,null),P=!0},p(ye,Ae){L&&L.p&&(!P||Ae&256)&&Ri(L,T,ye,ye[8],P?Bi(T,ye[8],Ae,Y1):Li(ye[8]),im),(!P||Ae&1)&&kr(d,ye[0]),ye[1]?D||(D=nm(),D.c(),D.m(l,null)):D&&(D.d(1),D=null),$&&$.p&&(!P||Ae&256)&&Ri($,B,ye,ye[8],P?Bi(B,ye[8],Ae,null):Li(ye[8]),null),Y&&Y.p&&(!P||Ae&256)&&Ri(Y,J,ye,ye[8],P?Bi(J,ye[8],Ae,J1):Li(ye[8]),rm),ye[2]?ae||(ae=am(),ae.c(),ae.m(r,S)):ae&&(ae.d(1),ae=null);const _t={};Ae&8&&(_t.meta=ye[3]),k.$set(_t),ce&&ce.p&&(!P||Ae&256)&&Ri(ce,re,ye,ye[8],P?Bi(re,ye[8],Ae,X1):Li(ye[8]),tm)},i(ye){P||(qe(L,ye),qe($,ye),qe(Y,ye),qe(k.$$.fragment,ye),qe(ce,ye),P=!0)},o(ye){nt(L,ye),nt($,ye),nt(Y,ye),nt(k.$$.fragment,ye),nt(ce,ye),P=!1},d(ye){ye&&te(r),L&&L.d(ye),D&&D.d(),$&&$.d(ye),Y&&Y.d(ye),ae&&ae.d(),ar(k),ce&&ce.d(ye)}}}function ev(o){let r,a;return r=new rc({props:{theme:o[4],themeOverrides:o[5],background:o[6],$$slots:{default:[Q1]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,[c]){const f={};c&16&&(f.theme=l[4]),c&32&&(f.themeOverrides=l[5]),c&64&&(f.background=l[6]),c&271&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function tv(o,r,a){let{$$slots:l={},$$scope:c}=r,{title:f="Page title"}=r,{natStatBadge:d=!1}=r,{censusLogo:n=!1}=r,{meta:m=null}=r,{theme:b=null}=r,{themeOverrides:w=null}=r,{background:S=null}=r;return o.$$set=k=>{"title"in k&&a(0,f=k.title),"natStatBadge"in k&&a(1,d=k.natStatBadge),"censusLogo"in k&&a(2,n=k.censusLogo),"meta"in k&&a(3,m=k.meta),"theme"in k&&a(4,b=k.theme),"themeOverrides"in k&&a(5,w=k.themeOverrides),"background"in k&&a(6,S=k.background),"$$scope"in k&&a(8,c=k.$$scope)},[f,d,n,m,b,w,S,l,c]}class rv extends Wr{constructor(r){super(),Kr(this,r,tv,ev,jr,{title:0,natStatBadge:1,censusLogo:2,meta:3,theme:4,themeOverrides:5,background:6})}}function sm(o){let r,a,l,c;return{c(){r=ls("svg"),a=ls("path"),this.h()},l(f){r=cs(f,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var d=He(r);a=cs(d,"path",{d:!0}),He(a).forEach(te),d.forEach(te),this.h()},h(){_e(a,"d",l=o[3][o[0]].d),_e(r,"class","ons-svg-icon"),_e(r,"viewBox",c=o[3][o[0]].viewBox),_e(r,"xmlns","http://www.w3.org/2000/svg"),_e(r,"focusable","false"),_e(r,"fill","currentColor"),Ht(r,"ons-u-ml-xs",o[1]),Ht(r,"ons-u-mr-xs",o[2])},m(f,d){Be(f,r,d),Pe(r,a)},p(f,d){d&1&&l!==(l=f[3][f[0]].d)&&_e(a,"d",l),d&1&&c!==(c=f[3][f[0]].viewBox)&&_e(r,"viewBox",c),d&2&&Ht(r,"ons-u-ml-xs",f[1]),d&4&&Ht(r,"ons-u-mr-xs",f[2])},d(f){f&&te(r)}}}function iv(o){let r,a=o[3][o[0]]&&sm(o);return{c(){a&&a.c(),r=er()},l(l){a&&a.l(l),r=er()},m(l,c){a&&a.m(l,c),Be(l,r,c)},p(l,[c]){l[3][l[0]]?a?a.p(l,c):(a=sm(l),a.c(),a.m(r.parentNode,r)):a&&(a.d(1),a=null)},i:_r,o:_r,d(l){a&&a.d(l),l&&te(r)}}}function nv(o,r,a){let{type:l="arrow"}=r,{marginLeft:c=!1}=r,{marginRight:f=!1}=r;const d={arrow:{d:"m10 .2-.9.9c-.1.1-.1.4 0 .5l4 4H.6c-.2 0-.4.2-.4.4v1.2c0 .2.2.4.4.4h12.5l-3.9 3.7c-.2.2-.2.4 0 .6l.8.9c.2.2.4.2.6 0L16.8 7c.2-.2.2-.4 0-.6L10.7.3c-.3-.2-.5-.2-.7-.1z",viewBox:"0 0 17 13"},externalLink:{d:"M13.5,9H13a.5.5,0,0,0-.5.5v3h-9v-9h3A.5.5,0,0,0,7,3V2.5A.5.5,0,0,0,6.5,2h-4a.5.5,0,0,0-.5.5v11a.5.5,0,0,0,.5.5h11a.5.5,0,0,0,.5-.5v-4A.5.5,0,0,0,13.5,9Z M8.83,7.88a.51.51,0,0,0,.71,0l2.31-2.32,1.28,1.28A.51.51,0,0,0,14,6.49v-4a.52.52,0,0,0-.5-.5h-4A.51.51,0,0,0,9,2.52a.58.58,0,0,0,.14.33l1.28,1.28L8.12,6.46a.51.51,0,0,0,0,.71Z",viewBox:"2 2 12 12"},signout:{d:"M13.85,7.65l-2.5-2.5a.5.5,0,0,0-.71,0,.48.48,0,0,0-.15.36V7h-3a.5.5,0,0,0-.5.5v1a.5.5,0,0,0,.5.5h3v1.5A.49.49,0,0,0,11,11a.48.48,0,0,0,.34-.14l2.51-2.5a.49.49,0,0,0,0-.68Z M8.5,14h-6a.5.5,0,0,1-.5-.5V2.5A.5.5,0,0,1,2.5,2h6a.5.5,0,0,1,.5.5V3a.5.5,0,0,1-.5.5h-5v9h5A.5.5,0,0,1,9,13v.5A.5.5,0,0,1,8.5,14Z",viewBox:"0 0 12 12"},print:{d:"M17 4H3C1.3 4 0 5.2 0 6.8v5.5h4V16h12v-3.7h4V6.8C20 5.2 18.7 4 17 4zm-3 10H6V9h8v5zm3-6a1 1 0 1 1 0-2 1 1 0 0 1 0 2zm-1-8H4v3h12V0z",viewBox:"0 0 20 16"},download:{d:"M5.6 9a.48.48 0 0 0 .7 0l3-3.2a.48.48 0 0 0 0-.7C9.3 5 9.2 5 9 5H7.5V.5A.47.47 0 0 0 7 0H5a.47.47 0 0 0-.5.5V5H3a.47.47 0 0 0-.5.5.37.37 0 0 0 .1.3Z M11.5 9H11a.47.47 0 0 0-.5.5v1h-9v-1A.47.47 0 0 0 1 9H.5a.47.47 0 0 0-.5.5v2a.47.47 0 0 0 .5.5h11a.47.47 0 0 0 .5-.5v-2a.47.47 0 0 0-.5-.5Z",viewBox:"0 0 12 12"},tick:{d:"M14.35,3.9l-.71-.71a.5.5,0,0,0-.71,0h0L5.79,10.34,3.07,7.61a.51.51,0,0,0-.71,0l-.71.71a.51.51,0,0,0,0,.71l3.78,3.78a.5.5,0,0,0,.71,0h0L14.35,4.6A.5.5,0,0,0,14.35,3.9Z",viewBox:"1.5 3 13 10"},search:{d:"M11.86 10.23 8.62 6.99a4.63 4.63 0 1 0-6.34 1.64 4.55 4.55 0 0 0 2.36.64 4.65 4.65 0 0 0 2.33-.65l3.24 3.23a.46.46 0 0 0 .65 0l1-1a.48.48 0 0 0 0-.62Zm-5-3.32a3.28 3.28 0 0 1-2.31.93 3.22 3.22 0 1 1 2.35-.93Z",viewBox:"0 0 12 12"}};return o.$$set=n=>{"type"in n&&a(0,l=n.type),"marginLeft"in n&&a(1,c=n.marginLeft),"marginRight"in n&&a(2,f=n.marginRight)},[l,c,f,d]}let $u=class extends Wr{constructor(r){super(),Kr(this,r,nv,iv,jr,{type:0,marginLeft:1,marginRight:2})}};function av(o){let r,a,l,c,f,d,n,m,b=o[4]&&o[5]==="before"&&om(o);const w=o[9].default,S=Di(w,o,o[8],null);let k=o[4]&&o[5]==="after"&&lm(o);return{c(){r=Ne("button"),a=Ne("span"),b&&b.c(),l=Et(),c=Ne("span"),S&&S.c(),f=Et(),k&&k.c(),this.h()},l(A){r=Ue(A,"BUTTON",{type:!0,class:!0});var P=He(r);a=Ue(P,"SPAN",{class:!0});var T=He(a);b&&b.l(T),l=kt(T),c=Ue(T,"SPAN",{class:!0});var L=He(c);S&&S.l(L),L.forEach(te),f=kt(T),k&&k.l(T),T.forEach(te),P.forEach(te),this.h()},h(){_e(c,"class","ons-btn__text"),_e(a,"class","ons-btn__inner"),_e(r,"type",o[0]),_e(r,"class","ons-btn"),r.disabled=o[6],Ht(r,"ons-btn--small",o[3]),Ht(r,"ons-btn--secondary",o[1]==="secondary"),Ht(r,"ons-btn--ghost",o[1]==="ghost"),Ht(r,"ons-btn--disabled",o[6])},m(A,P){Be(A,r,P),Pe(r,a),b&&b.m(a,null),Pe(a,l),Pe(a,c),S&&S.m(c,null),Pe(a,f),k&&k.m(a,null),d=!0,n||(m=ba(r,"click",o[11]),n=!0)},p(A,P){A[4]&&A[5]==="before"?b?(b.p(A,P),P&48&&qe(b,1)):(b=om(A),b.c(),qe(b,1),b.m(a,l)):b&&(Nr(),nt(b,1,1,()=>{b=null}),Ur()),S&&S.p&&(!d||P&256)&&Ri(S,w,A,A[8],d?Bi(w,A[8],P,null):Li(A[8]),null),A[4]&&A[5]==="after"?k?(k.p(A,P),P&48&&qe(k,1)):(k=lm(A),k.c(),qe(k,1),k.m(a,null)):k&&(Nr(),nt(k,1,1,()=>{k=null}),Ur()),(!d||P&1)&&_e(r,"type",A[0]),(!d||P&64)&&(r.disabled=A[6]),(!d||P&8)&&Ht(r,"ons-btn--small",A[3]),(!d||P&2)&&Ht(r,"ons-btn--secondary",A[1]==="secondary"),(!d||P&2)&&Ht(r,"ons-btn--ghost",A[1]==="ghost"),(!d||P&64)&&Ht(r,"ons-btn--disabled",A[6])},i(A){d||(qe(b),qe(S,A),qe(k),d=!0)},o(A){nt(b),nt(S,A),nt(k),d=!1},d(A){A&&te(r),b&&b.d(),S&&S.d(A),k&&k.d(),n=!1,m()}}}function sv(o){let r,a,l,c,f,d,n,m,b,w=o[4]&&o[5]==="before"&&cm(o);const S=o[9].default,k=Di(S,o,o[8],null);let A=o[4]&&o[5]==="after"&&um(o);return{c(){r=Ne("a"),a=Ne("span"),w&&w.c(),l=Et(),c=Ne("span"),k&&k.c(),f=Et(),A&&A.c(),this.h()},l(P){r=Ue(P,"A",{href:!0,role:!0,class:!0,disabled:!0});var T=He(r);a=Ue(T,"SPAN",{class:!0});var L=He(a);w&&w.l(L),l=kt(L),c=Ue(L,"SPAN",{class:!0});var D=He(c);k&&k.l(D),D.forEach(te),f=kt(L),A&&A.l(L),L.forEach(te),T.forEach(te),this.h()},h(){_e(c,"class","ons-btn__text"),_e(a,"class","ons-btn__inner"),_e(r,"href",d=o[6]?null:o[2]),_e(r,"role","button"),_e(r,"class","ons-btn ons-btn--link ons-js-submit-btn"),_e(r,"disabled",o[6]),Ht(r,"ons-btn--small",o[3]),Ht(r,"ons-btn--secondary",o[1]==="secondary"),Ht(r,"ons-btn--ghost",o[1]==="ghost"),Ht(r,"ons-btn--disabled",o[6])},m(P,T){Be(P,r,T),Pe(r,a),w&&w.m(a,null),Pe(a,l),Pe(a,c),k&&k.m(c,null),Pe(a,f),A&&A.m(a,null),n=!0,m||(b=ba(r,"click",o[10]),m=!0)},p(P,T){P[4]&&P[5]==="before"?w?(w.p(P,T),T&48&&qe(w,1)):(w=cm(P),w.c(),qe(w,1),w.m(a,l)):w&&(Nr(),nt(w,1,1,()=>{w=null}),Ur()),k&&k.p&&(!n||T&256)&&Ri(k,S,P,P[8],n?Bi(S,P[8],T,null):Li(P[8]),null),P[4]&&P[5]==="after"?A?(A.p(P,T),T&48&&qe(A,1)):(A=um(P),A.c(),qe(A,1),A.m(a,null)):A&&(Nr(),nt(A,1,1,()=>{A=null}),Ur()),(!n||T&68&&d!==(d=P[6]?null:P[2]))&&_e(r,"href",d),(!n||T&64)&&_e(r,"disabled",P[6]),(!n||T&8)&&Ht(r,"ons-btn--small",P[3]),(!n||T&2)&&Ht(r,"ons-btn--secondary",P[1]==="secondary"),(!n||T&2)&&Ht(r,"ons-btn--ghost",P[1]==="ghost"),(!n||T&64)&&Ht(r,"ons-btn--disabled",P[6])},i(P){n||(qe(w),qe(k,P),qe(A),n=!0)},o(P){nt(w),nt(k,P),nt(A),n=!1},d(P){P&&te(r),w&&w.d(),k&&k.d(P),A&&A.d(),m=!1,b()}}}function om(o){let r,a;return r=new $u({props:{type:o[4],marginRight:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function lm(o){let r,a;return r=new $u({props:{type:o[4],marginLeft:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function cm(o){let r,a;return r=new $u({props:{type:o[4],marginRight:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function um(o){let r,a;return r=new $u({props:{type:o[4],marginLeft:!0}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&16&&(f.type=l[4]),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function ov(o){let r,a,l,c;const f=[sv,av],d=[];function n(m,b){return m[2]?0:1}return r=n(o),a=d[r]=f[r](o),{c(){a.c(),l=er()},l(m){a.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,[b]){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),a=d[r],a?a.p(m,b):(a=d[r]=f[r](m),a.c()),qe(a,1),a.m(l.parentNode,l))},i(m){c||(qe(a),c=!0)},o(m){nt(a),c=!1},d(m){d[r].d(m),m&&te(l)}}}function lv(o,r,a){let{$$slots:l={},$$scope:c}=r;const f=Ef();let{type:d="button"}=r,{variant:n="primary"}=r,{href:m=""}=r,{small:b=!1}=r,{icon:w=""}=r,{iconPosition:S="before"}=r,{disabled:k=!1}=r;const A=T=>f("click",T),P=T=>f("click",T);return o.$$set=T=>{"type"in T&&a(0,d=T.type),"variant"in T&&a(1,n=T.variant),"href"in T&&a(2,m=T.href),"small"in T&&a(3,b=T.small),"icon"in T&&a(4,w=T.icon),"iconPosition"in T&&a(5,S=T.iconPosition),"disabled"in T&&a(6,k=T.disabled),"$$scope"in T&&a(8,c=T.$$scope)},[d,n,m,b,w,S,k,f,c,l,A,P]}class hf extends Wr{constructor(r){super(),Kr(this,r,lv,ov,jr,{type:0,variant:1,href:2,small:3,icon:4,iconPosition:5,disabled:6})}}var Yh=c1,cv=function(o){var r,a,l,c;if(r=/^((?:rgb|hs[lv]|cmyk|xyz|lab)a?)\s*\(([^\)]*)\)/.exec(o)){var f=r[1],d=f.replace(/a$/,""),n=d==="cmyk"?4:3;a=Yh[d],l=r[2].replace(/^\s+|\s+$/g,"").split(/\s*,\s*/).map(function(b,w){return/%$/.test(b)&&w===n?parseFloat(b)/100:(/%$/.test(b),parseFloat(b))}),f===d&&l.push(1),c=l[n]===void 0?1:l[n],l=l.slice(0,n),a[d]=function(){return l}}else if(/^#[A-Fa-f0-9]+$/.test(o)){var d=o.replace(/^#/,""),n=d.length;a=Yh.rgb,l=d.split(n===3?/(.)/:/(..)/),l=l.filter(Boolean).map(function(S){return parseInt(n===3?S+S:S,16)}),c=1,a.rgb=function(){return l},l[0]||(l[0]=0),l[1]||(l[1]=0),l[2]||(l[2]=0)}else a=Yh.keyword,a.keyword=function(){return o},l=o,c=1;var m={rgb:void 0,hsl:void 0,hsv:void 0,cmyk:void 0,keyword:void 0,hex:void 0};try{m.rgb=a.rgb(l)}catch{}try{m.hsl=a.hsl(l)}catch{}try{m.hsv=a.hsv(l)}catch{}try{m.cmyk=a.cmyk(l)}catch{}try{m.keyword=a.keyword(l)}catch{}return m.rgb&&(m.hex="#"+m.rgb.map(function(b){var w=b.toString(16);return w.length===1?"0"+w:w}).join("")),m.rgb&&(m.rgba=m.rgb.concat(c)),m.hsl&&(m.hsla=m.hsl.concat(c)),m.hsv&&(m.hsva=m.hsv.concat(c)),m.cmyk&&(m.cmyka=m.cmyk.concat(c)),m};const uv=Vu(cv);function hv(o){return o}function fv(o){if(o==null)return hv;var r,a,l=o.scale[0],c=o.scale[1],f=o.translate[0],d=o.translate[1];return function(n,m){m||(r=a=0);var b=2,w=n.length,S=new Array(w);for(S[0]=(r+=n[0])*l+f,S[1]=(a+=n[1])*c+d;b @@ -37,11 +37,6 @@ import{T as c_,c as h1,b as u_,m as Bp,l as Gl,d as Do,e as Oo,p as Op,f as rc,g -{{#coverSheetRowStyles}} - - - -{{/coverSheetRowStyles}} @@ -81,7 +76,7 @@ import{T as c_,c as h1,b as u_,m as Bp,l as Gl,d as Do,e as Oo,p as Op,f as rc,g - + @@ -96,28 +91,28 @@ import{T as c_,c as h1,b as u_,m as Bp,l as Gl,d as Do,e as Oo,p as Op,f as rc,g {{/isSubtitle}} -{{^isSubtitle}} - - {{#isText}} +{{#isText}} + {{text}} - {{/isText}} - {{#isHyperlink}} + +{{/isText}} +{{#isHyperlink}} + {{text}} - {{/isHyperlink}} -{{/isSubtitle}} +{{/isHyperlink}} {{/coverSheetContents}} - + - Table of contents + Contents @@ -247,10 +242,7 @@ import{T as c_,c as h1,b as u_,m as Bp,l as Gl,d as Do,e as Oo,p as Op,f as rc,g {{/sheets}} - -{{#hasNotes}} - -{{/hasNotes}} + {{#sheets}} {{/sheets}} @@ -406,29 +398,28 @@ import{T as c_,c as h1,b as u_,m as Bp,l as Gl,d as Do,e as Oo,p as Op,f as rc,g -`}];function ku(o){let r=0;for(const s of o)r+=s in ef?ef[s]:ef.AVERAGE;return r}const ef={0:8.9,1:8.9,2:8.9,3:8.9,4:8.9,5:8.9,6:8.9,7:8.9,8:8.9,9:8.9,a:8.9,b:8.9,c:8,d:8.9,e:8.9,f:4.43,g:8.9,h:8.9,i:3.57,j:3.57,k:8,l:3.57,m:13.33,n:8.9,o:8.9,p:8.9,q:8.9,r:5.33,s:8,t:4.43,u:8.9,v:8,w:11.57,x:8,y:8,z:8,A:10.67,B:10.67,C:11.57,D:11.57,E:10.67,F:9.77,G:12.43,H:11.57,I:4.43,J:8,K:10.67,L:8.9,M:13.33,N:11.57,O:12.43,P:10.67,Q:12.43,R:11.57,S:10.67,T:9.77,U:11.57,V:10.67,W:15.1,X:10.67,Y:10.67,Z:9.77," ":4.43,"!":4.43,'"':5.67,"#":8.9,$:8.9,"%":14.23,"&":10.67,"'":3.07,"(":5.33,")":5.33,"*":6.23,"+":9.33,",":4.43,"-":5.33,".":4.43,"/":4.43,":":4.43,";":4.43,"<":9.33,"=":9.33,">":9.33,"?":8.9,"@":16.23,"[":4.43,"]":4.43,"^":7.5,_:8.9,"`":5.33,"{":5.33,"|":4.17,"}":5.33,"~":9.33,AVERAGE:8.472},vv={$id:"https://github.com/jtrim-ons/accessible-spreadsheet-creator",title:"Accessible Spreadsheet Creator",description:"A description of an accessible spreadsheet",type:"object",properties:{coverSheetTitle:{type:"string",title:"Cover sheet title",description:"The title displayed in cell A1 of the workbook.",minLength:1},coverSheetContents:{type:"array",title:"Cover sheet contents",description:"The lines below the cover sheet title. Each can be a subtitle starting with '## ', a link in Markdown style, or just text.",items:{type:"string"}},notes:{type:"array",title:"Notes",description:"The notes, each with a name that can be referred to in double square brackets and text.",items:{type:"object",title:"Note",properties:{name:{type:"string",title:"Note name",description:"A note name (e.g. note1) that can be referred to in a sheet using double square brackets (e.g. [[note1]])."},text:{type:"string",title:"Note text",description:"The text that will appear on the Notes page."}}}},sheets:{type:"array",title:"Sheets",description:"The data an metadata for the worksheets other than cover, contents and notes sheets.",items:{type:"object",title:"Sheet",properties:{sheetName:{type:"string",minLength:1,title:"Sheet name",description:"The name to appear in cell A1"},tableName:{type:"string",minLength:1,title:"Table name",description:"The name to give to the data table",pattern:"^[A-Za-z0-9_]*$"},sheetIntroText:{type:"array",title:"Sheet intro text",description:"Introductory text to appear below cell A2",items:{type:"string"}},columns:{type:"array",title:"Data columns",items:{type:"object",title:"Data column",description:"A column with its heading, number/text style and data.",properties:{style:{type:"string",title:"Number/text style",description:"'text'=text column; 'number_with_commas': integers with thousand separator; 'number_1dp': numbers to 1 decimal place"},heading:{type:"string",title:"Column heading",description:"Table column heading. May contain notes in double square brackets."},values:{type:"array",title:"Column values",description:"An array of text or numeric values",anyOf:[{items:{type:"number"}},{items:{type:"string"}}]}},required:["style","heading","values"]}}},required:["sheetName","tableName","columns"]}}},required:["coverSheetTitle","coverSheetContents","sheets"]};var df={exports:{}},w_={},ns={},Vo={},nc={},Mr={},ec={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.regexpCode=o.getEsmExportName=o.getProperty=o.safeStringify=o.stringify=o.strConcat=o.addCodeArg=o.str=o._=o.nil=o._Code=o.Name=o.IDENTIFIER=o._CodeOrName=void 0;class r{}o._CodeOrName=r,o.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class s extends r{constructor(B){if(super(),!o.IDENTIFIER.test(B))throw new Error("CodeGen: name must be a valid identifier");this.str=B}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}o.Name=s;class l extends r{constructor(B){super(),this._items=typeof B=="string"?[B]:B}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const B=this._items[0];return B===""||B==='""'}get str(){var B;return(B=this._str)!==null&&B!==void 0?B:this._str=this._items.reduce(($,J)=>`${$}${J}`,"")}get names(){var B;return(B=this._names)!==null&&B!==void 0?B:this._names=this._items.reduce(($,J)=>(J instanceof s&&($[J.str]=($[J.str]||0)+1),$),{})}}o._Code=l,o.nil=new l("");function c(D,...B){const $=[D[0]];let J=0;for(;J{if(S.scopePath===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return(0,r._)`${b}${S.scopePath}`})}scopeCode(b=this._values,w,S){return this._reduceValues(b,k=>{if(k.value===void 0)throw new Error(`CodeGen: name "${k}" has no value`);return k.value.code},w,S)}_reduceValues(b,w,S={},k){let A=r.nil;for(const P in b){const T=b[P];if(!T)continue;const L=S[P]=S[P]||new Map;T.forEach(D=>{if(L.has(D))return;L.set(D,l.Started);let B=w(D);if(B){const $=this.opts.es5?o.varKinds.var:o.varKinds.const;A=(0,r._)`${A}${$} ${D} = ${B};${this.opts._n}`}else if(B=k==null?void 0:k(D))A=(0,r._)`${A}${B}${this.opts._n}`;else throw new s(D);L.set(D,l.Completed)})}return A}}o.ValueScope=n})(pf);(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.or=o.and=o.not=o.CodeGen=o.operators=o.varKinds=o.ValueScopeName=o.ValueScope=o.Scope=o.Name=o.regexpCode=o.stringify=o.getProperty=o.nil=o.strConcat=o.str=o._=void 0;const r=ec,s=pf;var l=ec;Object.defineProperty(o,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(o,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(o,"strConcat",{enumerable:!0,get:function(){return l.strConcat}}),Object.defineProperty(o,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(o,"getProperty",{enumerable:!0,get:function(){return l.getProperty}}),Object.defineProperty(o,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(o,"regexpCode",{enumerable:!0,get:function(){return l.regexpCode}}),Object.defineProperty(o,"Name",{enumerable:!0,get:function(){return l.Name}});var c=pf;Object.defineProperty(o,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(o,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(o,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(o,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),o.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};class f{optimizeNodes(){return this}optimizeNames(ee,ue){return this}}class d extends f{constructor(ee,ue,Je){super(),this.varKind=ee,this.name=ue,this.rhs=Je}render({es5:ee,_n:ue}){const Je=ee?s.varKinds.var:this.varKind,wt=this.rhs===void 0?"":` = ${this.rhs}`;return`${Je} ${this.name}${wt};`+ue}optimizeNames(ee,ue){if(ee[this.name.str])return this.rhs&&(this.rhs=Z(this.rhs,ee,ue)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}}class n extends f{constructor(ee,ue,Je){super(),this.lhs=ee,this.rhs=ue,this.sideEffects=Je}render({_n:ee}){return`${this.lhs} = ${this.rhs};`+ee}optimizeNames(ee,ue){if(!(this.lhs instanceof r.Name&&!ee[this.lhs.str]&&!this.sideEffects))return this.rhs=Z(this.rhs,ee,ue),this}get names(){const ee=this.lhs instanceof r.Name?{}:{...this.lhs.names};return We(ee,this.rhs)}}class m extends n{constructor(ee,ue,Je,wt){super(ee,Je,wt),this.op=ue}render({_n:ee}){return`${this.lhs} ${this.op}= ${this.rhs};`+ee}}class b extends f{constructor(ee){super(),this.label=ee,this.names={}}render({_n:ee}){return`${this.label}:`+ee}}class w extends f{constructor(ee){super(),this.label=ee,this.names={}}render({_n:ee}){return`break${this.label?` ${this.label}`:""};`+ee}}class S extends f{constructor(ee){super(),this.error=ee}render({_n:ee}){return`throw ${this.error};`+ee}get names(){return this.error.names}}class k extends f{constructor(ee){super(),this.code=ee}render({_n:ee}){return`${this.code};`+ee}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(ee,ue){return this.code=Z(this.code,ee,ue),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}}class A extends f{constructor(ee=[]){super(),this.nodes=ee}render(ee){return this.nodes.reduce((ue,Je)=>ue+Je.render(ee),"")}optimizeNodes(){const{nodes:ee}=this;let ue=ee.length;for(;ue--;){const Je=ee[ue].optimizeNodes();Array.isArray(Je)?ee.splice(ue,1,...Je):Je?ee[ue]=Je:ee.splice(ue,1)}return ee.length>0?this:void 0}optimizeNames(ee,ue){const{nodes:Je}=this;let wt=Je.length;for(;wt--;){const pt=Je[wt];pt.optimizeNames(ee,ue)||($e(ee,pt.names),Je.splice(wt,1))}return Je.length>0?this:void 0}get names(){return this.nodes.reduce((ee,ue)=>le(ee,ue.names),{})}}class P extends A{render(ee){return"{"+ee._n+super.render(ee)+"}"+ee._n}}class T extends A{}class L extends P{}L.kind="else";class D extends P{constructor(ee,ue){super(ue),this.condition=ee}render(ee){let ue=`if(${this.condition})`+super.render(ee);return this.else&&(ue+="else "+this.else.render(ee)),ue}optimizeNodes(){super.optimizeNodes();const ee=this.condition;if(ee===!0)return this.nodes;let ue=this.else;if(ue){const Je=ue.optimizeNodes();ue=this.else=Array.isArray(Je)?new L(Je):Je}if(ue)return ee===!1?ue instanceof D?ue:ue.nodes:this.nodes.length?this:new D(ct(ee),ue instanceof D?[ue]:ue.nodes);if(!(ee===!1||!this.nodes.length))return this}optimizeNames(ee,ue){var Je;if(this.else=(Je=this.else)===null||Je===void 0?void 0:Je.optimizeNames(ee,ue),!!(super.optimizeNames(ee,ue)||this.else))return this.condition=Z(this.condition,ee,ue),this}get names(){const ee=super.names;return We(ee,this.condition),this.else&&le(ee,this.else.names),ee}}D.kind="if";class B extends P{}B.kind="for";class $ extends B{constructor(ee){super(),this.iteration=ee}render(ee){return`for(${this.iteration})`+super.render(ee)}optimizeNames(ee,ue){if(super.optimizeNames(ee,ue))return this.iteration=Z(this.iteration,ee,ue),this}get names(){return le(super.names,this.iteration.names)}}class J extends B{constructor(ee,ue,Je,wt){super(),this.varKind=ee,this.name=ue,this.from=Je,this.to=wt}render(ee){const ue=ee.es5?s.varKinds.var:this.varKind,{name:Je,from:wt,to:pt}=this;return`for(${ue} ${Je}=${wt}; ${Je}<${pt}; ${Je}++)`+super.render(ee)}get names(){const ee=We(super.names,this.from);return We(ee,this.to)}}class Y extends B{constructor(ee,ue,Je,wt){super(),this.loop=ee,this.varKind=ue,this.name=Je,this.iterable=wt}render(ee){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(ee)}optimizeNames(ee,ue){if(super.optimizeNames(ee,ue))return this.iterable=Z(this.iterable,ee,ue),this}get names(){return le(super.names,this.iterable.names)}}class se extends P{constructor(ee,ue,Je){super(),this.name=ee,this.args=ue,this.async=Je}render(ee){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(ee)}}se.kind="func";class re extends A{render(ee){return"return "+super.render(ee)}}re.kind="return";class ce extends P{render(ee){let ue="try"+super.render(ee);return this.catch&&(ue+=this.catch.render(ee)),this.finally&&(ue+=this.finally.render(ee)),ue}optimizeNodes(){var ee,ue;return super.optimizeNodes(),(ee=this.catch)===null||ee===void 0||ee.optimizeNodes(),(ue=this.finally)===null||ue===void 0||ue.optimizeNodes(),this}optimizeNames(ee,ue){var Je,wt;return super.optimizeNames(ee,ue),(Je=this.catch)===null||Je===void 0||Je.optimizeNames(ee,ue),(wt=this.finally)===null||wt===void 0||wt.optimizeNames(ee,ue),this}get names(){const ee=super.names;return this.catch&&le(ee,this.catch.names),this.finally&&le(ee,this.finally.names),ee}}class ye extends P{constructor(ee){super(),this.error=ee}render(ee){return`catch(${this.error})`+super.render(ee)}}ye.kind="catch";class Ae extends P{render(ee){return"finally"+super.render(ee)}}Ae.kind="finally";class _t{constructor(ee,ue={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...ue,_n:ue.lines?` -`:""},this._extScope=ee,this._scope=new s.Scope({parent:ee}),this._nodes=[new T]}toString(){return this._root.render(this.opts)}name(ee){return this._scope.name(ee)}scopeName(ee){return this._extScope.name(ee)}scopeValue(ee,ue){const Je=this._extScope.value(ee,ue);return(this._values[Je.prefix]||(this._values[Je.prefix]=new Set)).add(Je),Je}getScopeValue(ee,ue){return this._extScope.getValue(ee,ue)}scopeRefs(ee){return this._extScope.scopeRefs(ee,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(ee,ue,Je,wt){const pt=this._scope.toName(ue);return Je!==void 0&&wt&&(this._constants[pt.str]=Je),this._leafNode(new d(ee,pt,Je)),pt}const(ee,ue,Je){return this._def(s.varKinds.const,ee,ue,Je)}let(ee,ue,Je){return this._def(s.varKinds.let,ee,ue,Je)}var(ee,ue,Je){return this._def(s.varKinds.var,ee,ue,Je)}assign(ee,ue,Je){return this._leafNode(new n(ee,ue,Je))}add(ee,ue){return this._leafNode(new m(ee,o.operators.ADD,ue))}code(ee){return typeof ee=="function"?ee():ee!==r.nil&&this._leafNode(new k(ee)),this}object(...ee){const ue=["{"];for(const[Je,wt]of ee)ue.length>1&&ue.push(","),ue.push(Je),(Je!==wt||this.opts.es5)&&(ue.push(":"),(0,r.addCodeArg)(ue,wt));return ue.push("}"),new r._Code(ue)}if(ee,ue,Je){if(this._blockNode(new D(ee)),ue&&Je)this.code(ue).else().code(Je).endIf();else if(ue)this.code(ue).endIf();else if(Je)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(ee){return this._elseNode(new D(ee))}else(){return this._elseNode(new L)}endIf(){return this._endBlockNode(D,L)}_for(ee,ue){return this._blockNode(ee),ue&&this.code(ue).endFor(),this}for(ee,ue){return this._for(new $(ee),ue)}forRange(ee,ue,Je,wt,pt=this.opts.es5?s.varKinds.var:s.varKinds.let){const Xe=this._scope.toName(ee);return this._for(new J(pt,Xe,ue,Je),()=>wt(Xe))}forOf(ee,ue,Je,wt=s.varKinds.const){const pt=this._scope.toName(ee);if(this.opts.es5){const Xe=ue instanceof r.Name?ue:this.var("_arr",ue);return this.forRange("_i",0,(0,r._)`${Xe}.length`,Bt=>{this.var(pt,(0,r._)`${Xe}[${Bt}]`),Je(pt)})}return this._for(new Y("of",wt,pt,ue),()=>Je(pt))}forIn(ee,ue,Je,wt=this.opts.es5?s.varKinds.var:s.varKinds.const){if(this.opts.ownProperties)return this.forOf(ee,(0,r._)`Object.keys(${ue})`,Je);const pt=this._scope.toName(ee);return this._for(new Y("in",wt,pt,ue),()=>Je(pt))}endFor(){return this._endBlockNode(B)}label(ee){return this._leafNode(new b(ee))}break(ee){return this._leafNode(new w(ee))}return(ee){const ue=new re;if(this._blockNode(ue),this.code(ee),ue.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(re)}try(ee,ue,Je){if(!ue&&!Je)throw new Error('CodeGen: "try" without "catch" and "finally"');const wt=new ce;if(this._blockNode(wt),this.code(ee),ue){const pt=this.name("e");this._currNode=wt.catch=new ye(pt),ue(pt)}return Je&&(this._currNode=wt.finally=new Ae,this.code(Je)),this._endBlockNode(ye,Ae)}throw(ee){return this._leafNode(new S(ee))}block(ee,ue){return this._blockStarts.push(this._nodes.length),ee&&this.code(ee).endBlock(ue),this}endBlock(ee){const ue=this._blockStarts.pop();if(ue===void 0)throw new Error("CodeGen: not in self-balancing block");const Je=this._nodes.length-ue;if(Je<0||ee!==void 0&&Je!==ee)throw new Error(`CodeGen: wrong number of nodes: ${Je} vs ${ee} expected`);return this._nodes.length=ue,this}func(ee,ue=r.nil,Je,wt){return this._blockNode(new se(ee,ue,Je)),wt&&this.code(wt).endFunc(),this}endFunc(){return this._endBlockNode(se)}optimize(ee=1){for(;ee-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(ee){return this._currNode.nodes.push(ee),this}_blockNode(ee){this._currNode.nodes.push(ee),this._nodes.push(ee)}_endBlockNode(ee,ue){const Je=this._currNode;if(Je instanceof ee||ue&&Je instanceof ue)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${ue?`${ee.kind}/${ue.kind}`:ee.kind}"`)}_elseNode(ee){const ue=this._currNode;if(!(ue instanceof D))throw new Error('CodeGen: "else" without "if"');return this._currNode=ue.else=ee,this}get _root(){return this._nodes[0]}get _currNode(){const ee=this._nodes;return ee[ee.length-1]}set _currNode(ee){const ue=this._nodes;ue[ue.length-1]=ee}}o.CodeGen=_t;function le(Me,ee){for(const ue in ee)Me[ue]=(Me[ue]||0)+(ee[ue]||0);return Me}function We(Me,ee){return ee instanceof r._CodeOrName?le(Me,ee.names):Me}function Z(Me,ee,ue){if(Me instanceof r.Name)return Je(Me);if(!wt(Me))return Me;return new r._Code(Me._items.reduce((pt,Xe)=>(Xe instanceof r.Name&&(Xe=Je(Xe)),Xe instanceof r._Code?pt.push(...Xe._items):pt.push(Xe),pt),[]));function Je(pt){const Xe=ue[pt.str];return Xe===void 0||ee[pt.str]!==1?pt:(delete ee[pt.str],Xe)}function wt(pt){return pt instanceof r._Code&&pt._items.some(Xe=>Xe instanceof r.Name&&ee[Xe.str]===1&&ue[Xe.str]!==void 0)}}function $e(Me,ee){for(const ue in ee)Me[ue]=(Me[ue]||0)-(ee[ue]||0)}function ct(Me){return typeof Me=="boolean"||typeof Me=="number"||Me===null?!Me:(0,r._)`!${ge(Me)}`}o.not=ct;const rt=oe(o.operators.AND);function $t(...Me){return Me.reduce(rt)}o.and=$t;const it=oe(o.operators.OR);function et(...Me){return Me.reduce(it)}o.or=et;function oe(Me){return(ee,ue)=>ee===r.nil?ue:ue===r.nil?ee:(0,r._)`${ge(ee)} ${Me} ${ge(ue)}`}function ge(Me){return Me instanceof r.Name?Me:(0,r._)`(${Me})`}})(Mr);var Zr={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.checkStrictMode=o.getErrorPath=o.Type=o.useFunc=o.setEvaluated=o.evaluatedPropsToName=o.mergeEvaluated=o.eachItem=o.unescapeJsonPointer=o.escapeJsonPointer=o.escapeFragment=o.unescapeFragment=o.schemaRefOrVal=o.schemaHasRulesButRef=o.schemaHasRules=o.checkUnknownRules=o.alwaysValidSchema=o.toHash=void 0;const r=Mr,s=ec;function l(se){const re={};for(const ce of se)re[ce]=!0;return re}o.toHash=l;function c(se,re){return typeof re=="boolean"?re:Object.keys(re).length===0?!0:(f(se,re),!d(re,se.self.RULES.all))}o.alwaysValidSchema=c;function f(se,re=se.schema){const{opts:ce,self:ye}=se;if(!ce.strictSchema||typeof re=="boolean")return;const Ae=ye.RULES.keywords;for(const _t in re)Ae[_t]||Y(se,`unknown keyword: "${_t}"`)}o.checkUnknownRules=f;function d(se,re){if(typeof se=="boolean")return!se;for(const ce in se)if(re[ce])return!0;return!1}o.schemaHasRules=d;function n(se,re){if(typeof se=="boolean")return!se;for(const ce in se)if(ce!=="$ref"&&re.all[ce])return!0;return!1}o.schemaHasRulesButRef=n;function m({topSchemaRef:se,schemaPath:re},ce,ye,Ae){if(!Ae){if(typeof ce=="number"||typeof ce=="boolean")return ce;if(typeof ce=="string")return(0,r._)`${ce}`}return(0,r._)`${se}${re}${(0,r.getProperty)(ye)}`}o.schemaRefOrVal=m;function b(se){return k(decodeURIComponent(se))}o.unescapeFragment=b;function w(se){return encodeURIComponent(S(se))}o.escapeFragment=w;function S(se){return typeof se=="number"?`${se}`:se.replace(/~/g,"~0").replace(/\//g,"~1")}o.escapeJsonPointer=S;function k(se){return se.replace(/~1/g,"/").replace(/~0/g,"~")}o.unescapeJsonPointer=k;function A(se,re){if(Array.isArray(se))for(const ce of se)re(ce);else re(se)}o.eachItem=A;function P({mergeNames:se,mergeToName:re,mergeValues:ce,resultToName:ye}){return(Ae,_t,le,We)=>{const Z=le===void 0?_t:le instanceof r.Name?(_t instanceof r.Name?se(Ae,_t,le):re(Ae,_t,le),le):_t instanceof r.Name?(re(Ae,le,_t),_t):ce(_t,le);return We===r.Name&&!(Z instanceof r.Name)?ye(Ae,Z):Z}}o.mergeEvaluated={props:P({mergeNames:(se,re,ce)=>se.if((0,r._)`${ce} !== true && ${re} !== undefined`,()=>{se.if((0,r._)`${re} === true`,()=>se.assign(ce,!0),()=>se.assign(ce,(0,r._)`${ce} || {}`).code((0,r._)`Object.assign(${ce}, ${re})`))}),mergeToName:(se,re,ce)=>se.if((0,r._)`${ce} !== true`,()=>{re===!0?se.assign(ce,!0):(se.assign(ce,(0,r._)`${ce} || {}`),L(se,ce,re))}),mergeValues:(se,re)=>se===!0?!0:{...se,...re},resultToName:T}),items:P({mergeNames:(se,re,ce)=>se.if((0,r._)`${ce} !== true && ${re} !== undefined`,()=>se.assign(ce,(0,r._)`${re} === true ? true : ${ce} > ${re} ? ${ce} : ${re}`)),mergeToName:(se,re,ce)=>se.if((0,r._)`${ce} !== true`,()=>se.assign(ce,re===!0?!0:(0,r._)`${ce} > ${re} ? ${ce} : ${re}`)),mergeValues:(se,re)=>se===!0?!0:Math.max(se,re),resultToName:(se,re)=>se.var("items",re)})};function T(se,re){if(re===!0)return se.var("props",!0);const ce=se.var("props",(0,r._)`{}`);return re!==void 0&&L(se,ce,re),ce}o.evaluatedPropsToName=T;function L(se,re,ce){Object.keys(ce).forEach(ye=>se.assign((0,r._)`${re}${(0,r.getProperty)(ye)}`,!0))}o.setEvaluated=L;const D={};function B(se,re){return se.scopeValue("func",{ref:re,code:D[re.code]||(D[re.code]=new s._Code(re.code))})}o.useFunc=B;var $;(function(se){se[se.Num=0]="Num",se[se.Str=1]="Str"})($=o.Type||(o.Type={}));function J(se,re,ce){if(se instanceof r.Name){const ye=re===$.Num;return ce?ye?(0,r._)`"[" + ${se} + "]"`:(0,r._)`"['" + ${se} + "']"`:ye?(0,r._)`"/" + ${se}`:(0,r._)`"/" + ${se}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return ce?(0,r.getProperty)(se).toString():"/"+S(se)}o.getErrorPath=J;function Y(se,re,ce=se.opts.strictSchema){if(ce){if(re=`strict mode: ${re}`,ce===!0)throw new Error(re);se.self.logger.warn(re)}}o.checkStrictMode=Y})(Zr);var xs={};Object.defineProperty(xs,"__esModule",{value:!0});const rn=Mr,bv={data:new rn.Name("data"),valCxt:new rn.Name("valCxt"),instancePath:new rn.Name("instancePath"),parentData:new rn.Name("parentData"),parentDataProperty:new rn.Name("parentDataProperty"),rootData:new rn.Name("rootData"),dynamicAnchors:new rn.Name("dynamicAnchors"),vErrors:new rn.Name("vErrors"),errors:new rn.Name("errors"),this:new rn.Name("this"),self:new rn.Name("self"),scope:new rn.Name("scope"),json:new rn.Name("json"),jsonPos:new rn.Name("jsonPos"),jsonLen:new rn.Name("jsonLen"),jsonPart:new rn.Name("jsonPart")};xs.default=bv;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.extendErrors=o.resetErrorsCount=o.reportExtraError=o.reportError=o.keyword$DataError=o.keywordError=void 0;const r=Mr,s=Zr,l=xs;o.keywordError={message:({keyword:L})=>(0,r.str)`must pass "${L}" keyword validation`},o.keyword$DataError={message:({keyword:L,schemaType:D})=>D?(0,r.str)`"${L}" keyword must be ${D} ($data)`:(0,r.str)`"${L}" keyword is invalid ($data)`};function c(L,D=o.keywordError,B,$){const{it:J}=L,{gen:Y,compositeRule:se,allErrors:re}=J,ce=S(L,D,B);$??(se||re)?m(Y,ce):b(J,(0,r._)`[${ce}]`)}o.reportError=c;function f(L,D=o.keywordError,B){const{it:$}=L,{gen:J,compositeRule:Y,allErrors:se}=$,re=S(L,D,B);m(J,re),Y||se||b($,l.default.vErrors)}o.reportExtraError=f;function d(L,D){L.assign(l.default.errors,D),L.if((0,r._)`${l.default.vErrors} !== null`,()=>L.if(D,()=>L.assign((0,r._)`${l.default.vErrors}.length`,D),()=>L.assign(l.default.vErrors,null)))}o.resetErrorsCount=d;function n({gen:L,keyword:D,schemaValue:B,data:$,errsCount:J,it:Y}){if(J===void 0)throw new Error("ajv implementation error");const se=L.name("err");L.forRange("i",J,l.default.errors,re=>{L.const(se,(0,r._)`${l.default.vErrors}[${re}]`),L.if((0,r._)`${se}.instancePath === undefined`,()=>L.assign((0,r._)`${se}.instancePath`,(0,r.strConcat)(l.default.instancePath,Y.errorPath))),L.assign((0,r._)`${se}.schemaPath`,(0,r.str)`${Y.errSchemaPath}/${D}`),Y.opts.verbose&&(L.assign((0,r._)`${se}.schema`,B),L.assign((0,r._)`${se}.data`,$))})}o.extendErrors=n;function m(L,D){const B=L.const("err",D);L.if((0,r._)`${l.default.vErrors} === null`,()=>L.assign(l.default.vErrors,(0,r._)`[${B}]`),(0,r._)`${l.default.vErrors}.push(${B})`),L.code((0,r._)`${l.default.errors}++`)}function b(L,D){const{gen:B,validateName:$,schemaEnv:J}=L;J.$async?B.throw((0,r._)`new ${L.ValidationError}(${D})`):(B.assign((0,r._)`${$}.errors`,D),B.return(!1))}const w={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function S(L,D,B){const{createErrors:$}=L.it;return $===!1?(0,r._)`{}`:k(L,D,B)}function k(L,D,B={}){const{gen:$,it:J}=L,Y=[A(J,B),P(L,B)];return T(L,D,Y),$.object(...Y)}function A({errorPath:L},{instancePath:D}){const B=D?(0,r.str)`${L}${(0,s.getErrorPath)(D,s.Type.Str)}`:L;return[l.default.instancePath,(0,r.strConcat)(l.default.instancePath,B)]}function P({keyword:L,it:{errSchemaPath:D}},{schemaPath:B,parentSchema:$}){let J=$?D:(0,r.str)`${D}/${L}`;return B&&(J=(0,r.str)`${J}${(0,s.getErrorPath)(B,s.Type.Str)}`),[w.schemaPath,J]}function T(L,{params:D,message:B},$){const{keyword:J,data:Y,schemaValue:se,it:re}=L,{opts:ce,propertyName:ye,topSchemaRef:Ae,schemaPath:_t}=re;$.push([w.keyword,J],[w.params,typeof D=="function"?D(L):D||(0,r._)`{}`]),ce.messages&&$.push([w.message,typeof B=="function"?B(L):B]),ce.verbose&&$.push([w.schema,se],[w.parentSchema,(0,r._)`${Ae}${_t}`],[l.default.data,Y]),ye&&$.push([w.propertyName,ye])}})(nc);Object.defineProperty(Vo,"__esModule",{value:!0});Vo.boolOrEmptySchema=Vo.topBoolOrEmptySchema=void 0;const xv=nc,wv=Mr,Ev=xs,kv={message:"boolean schema is false"};function Sv(o){const{gen:r,schema:s,validateName:l}=o;s===!1?E_(o,!1):typeof s=="object"&&s.$async===!0?r.return(Ev.default.data):(r.assign((0,wv._)`${l}.errors`,null),r.return(!0))}Vo.topBoolOrEmptySchema=Sv;function Tv(o,r){const{gen:s,schema:l}=o;l===!1?(s.var(r,!1),E_(o)):s.var(r,!0)}Vo.boolOrEmptySchema=Tv;function E_(o,r){const{gen:s,data:l}=o,c={gen:s,keyword:"false schema",data:l,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,xv.reportError)(c,kv,void 0,r)}var sc={},Ha={};Object.defineProperty(Ha,"__esModule",{value:!0});Ha.getRules=Ha.isJSONType=void 0;const Iv=["string","number","integer","boolean","null","object","array"],Cv=new Set(Iv);function Av(o){return typeof o=="string"&&Cv.has(o)}Ha.isJSONType=Av;function Pv(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}Ha.getRules=Pv;var Fs={};Object.defineProperty(Fs,"__esModule",{value:!0});Fs.shouldUseRule=Fs.shouldUseGroup=Fs.schemaHasRulesForType=void 0;function zv({schema:o,self:r},s){const l=r.RULES.types[s];return l&&l!==!0&&k_(o,l)}Fs.schemaHasRulesForType=zv;function k_(o,r){return r.rules.some(s=>S_(o,s))}Fs.shouldUseGroup=k_;function S_(o,r){var s;return o[r.keyword]!==void 0||((s=r.definition.implements)===null||s===void 0?void 0:s.some(l=>o[l]!==void 0))}Fs.shouldUseRule=S_;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.reportTypeError=o.checkDataTypes=o.checkDataType=o.coerceAndCheckDataType=o.getJSONTypes=o.getSchemaTypes=o.DataType=void 0;const r=Ha,s=Fs,l=nc,c=Mr,f=Zr;var d;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(d=o.DataType||(o.DataType={}));function n($){const J=m($.type);if(J.includes("null")){if($.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!J.length&&$.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');$.nullable===!0&&J.push("null")}return J}o.getSchemaTypes=n;function m($){const J=Array.isArray($)?$:$?[$]:[];if(J.every(r.isJSONType))return J;throw new Error("type must be JSONType or JSONType[]: "+J.join(","))}o.getJSONTypes=m;function b($,J){const{gen:Y,data:se,opts:re}=$,ce=S(J,re.coerceTypes),ye=J.length>0&&!(ce.length===0&&J.length===1&&(0,s.schemaHasRulesForType)($,J[0]));if(ye){const Ae=T(J,se,re.strictNumbers,d.Wrong);Y.if(Ae,()=>{ce.length?k($,J,ce):D($)})}return ye}o.coerceAndCheckDataType=b;const w=new Set(["string","number","integer","boolean","null"]);function S($,J){return J?$.filter(Y=>w.has(Y)||J==="array"&&Y==="array"):[]}function k($,J,Y){const{gen:se,data:re,opts:ce}=$,ye=se.let("dataType",(0,c._)`typeof ${re}`),Ae=se.let("coerced",(0,c._)`undefined`);ce.coerceTypes==="array"&&se.if((0,c._)`${ye} == 'object' && Array.isArray(${re}) && ${re}.length == 1`,()=>se.assign(re,(0,c._)`${re}[0]`).assign(ye,(0,c._)`typeof ${re}`).if(T(J,re,ce.strictNumbers),()=>se.assign(Ae,re))),se.if((0,c._)`${Ae} !== undefined`);for(const le of Y)(w.has(le)||le==="array"&&ce.coerceTypes==="array")&&_t(le);se.else(),D($),se.endIf(),se.if((0,c._)`${Ae} !== undefined`,()=>{se.assign(re,Ae),A($,Ae)});function _t(le){switch(le){case"string":se.elseIf((0,c._)`${ye} == "number" || ${ye} == "boolean"`).assign(Ae,(0,c._)`"" + ${re}`).elseIf((0,c._)`${re} === null`).assign(Ae,(0,c._)`""`);return;case"number":se.elseIf((0,c._)`${ye} == "boolean" || ${re} === null - || (${ye} == "string" && ${re} && ${re} == +${re})`).assign(Ae,(0,c._)`+${re}`);return;case"integer":se.elseIf((0,c._)`${ye} === "boolean" || ${re} === null - || (${ye} === "string" && ${re} && ${re} == +${re} && !(${re} % 1))`).assign(Ae,(0,c._)`+${re}`);return;case"boolean":se.elseIf((0,c._)`${re} === "false" || ${re} === 0 || ${re} === null`).assign(Ae,!1).elseIf((0,c._)`${re} === "true" || ${re} === 1`).assign(Ae,!0);return;case"null":se.elseIf((0,c._)`${re} === "" || ${re} === 0 || ${re} === false`),se.assign(Ae,null);return;case"array":se.elseIf((0,c._)`${ye} === "string" || ${ye} === "number" - || ${ye} === "boolean" || ${re} === null`).assign(Ae,(0,c._)`[${re}]`)}}}function A({gen:$,parentData:J,parentDataProperty:Y},se){$.if((0,c._)`${J} !== undefined`,()=>$.assign((0,c._)`${J}[${Y}]`,se))}function P($,J,Y,se=d.Correct){const re=se===d.Correct?c.operators.EQ:c.operators.NEQ;let ce;switch($){case"null":return(0,c._)`${J} ${re} null`;case"array":ce=(0,c._)`Array.isArray(${J})`;break;case"object":ce=(0,c._)`${J} && typeof ${J} == "object" && !Array.isArray(${J})`;break;case"integer":ce=ye((0,c._)`!(${J} % 1) && !isNaN(${J})`);break;case"number":ce=ye();break;default:return(0,c._)`typeof ${J} ${re} ${$}`}return se===d.Correct?ce:(0,c.not)(ce);function ye(Ae=c.nil){return(0,c.and)((0,c._)`typeof ${J} == "number"`,Ae,Y?(0,c._)`isFinite(${J})`:c.nil)}}o.checkDataType=P;function T($,J,Y,se){if($.length===1)return P($[0],J,Y,se);let re;const ce=(0,f.toHash)($);if(ce.array&&ce.object){const ye=(0,c._)`typeof ${J} != "object"`;re=ce.null?ye:(0,c._)`!${J} || ${ye}`,delete ce.null,delete ce.array,delete ce.object}else re=c.nil;ce.number&&delete ce.integer;for(const ye in ce)re=(0,c.and)(re,P(ye,J,Y,se));return re}o.checkDataTypes=T;const L={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:J})=>typeof $=="string"?(0,c._)`{type: ${$}}`:(0,c._)`{type: ${J}}`};function D($){const J=B($);(0,l.reportError)(J,L)}o.reportTypeError=D;function B($){const{gen:J,data:Y,schema:se}=$,re=(0,f.schemaRefOrVal)($,se,"type");return{gen:J,keyword:"type",data:Y,schema:se.type,schemaCode:re,schemaValue:re,parentSchema:se,params:{},it:$}}})(sc);var qu={};Object.defineProperty(qu,"__esModule",{value:!0});qu.assignDefaults=void 0;const Io=Mr,Mv=Zr;function Dv(o,r){const{properties:s,items:l}=o.schema;if(r==="object"&&s)for(const c in s)dm(o,c,s[c].default);else r==="array"&&Array.isArray(l)&&l.forEach((c,f)=>dm(o,f,c.default))}qu.assignDefaults=Dv;function dm(o,r,s){const{gen:l,compositeRule:c,data:f,opts:d}=o;if(s===void 0)return;const n=(0,Io._)`${f}${(0,Io.getProperty)(r)}`;if(c){(0,Mv.checkStrictMode)(o,`default is ignored for: ${n}`);return}let m=(0,Io._)`${n} === undefined`;d.useDefaults==="empty"&&(m=(0,Io._)`${m} || ${n} === null || ${n} === ""`),l.if(m,(0,Io._)`${n} = ${(0,Io.stringify)(s)}`)}var vs={},zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.validateUnion=zr.validateArray=zr.usePattern=zr.callValidateCode=zr.schemaProperties=zr.allSchemaProperties=zr.noPropertyInData=zr.propertyInData=zr.isOwnProperty=zr.hasPropFunc=zr.reportMissingProp=zr.checkMissingProp=zr.checkReportMissingProp=void 0;const hi=Mr,If=Zr,ia=xs,Rv=Zr;function Lv(o,r){const{gen:s,data:l,it:c}=o;s.if(Af(s,l,r,c.opts.ownProperties),()=>{o.setParams({missingProperty:(0,hi._)`${r}`},!0),o.error()})}zr.checkReportMissingProp=Lv;function Bv({gen:o,data:r,it:{opts:s}},l,c){return(0,hi.or)(...l.map(f=>(0,hi.and)(Af(o,r,f,s.ownProperties),(0,hi._)`${c} = ${f}`)))}zr.checkMissingProp=Bv;function Ov(o,r){o.setParams({missingProperty:r},!0),o.error()}zr.reportMissingProp=Ov;function T_(o){return o.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,hi._)`Object.prototype.hasOwnProperty`})}zr.hasPropFunc=T_;function Cf(o,r,s){return(0,hi._)`${T_(o)}.call(${r}, ${s})`}zr.isOwnProperty=Cf;function Fv(o,r,s,l){const c=(0,hi._)`${r}${(0,hi.getProperty)(s)} !== undefined`;return l?(0,hi._)`${c} && ${Cf(o,r,s)}`:c}zr.propertyInData=Fv;function Af(o,r,s,l){const c=(0,hi._)`${r}${(0,hi.getProperty)(s)} === undefined`;return l?(0,hi.or)(c,(0,hi.not)(Cf(o,r,s))):c}zr.noPropertyInData=Af;function I_(o){return o?Object.keys(o).filter(r=>r!=="__proto__"):[]}zr.allSchemaProperties=I_;function Nv(o,r){return I_(r).filter(s=>!(0,If.alwaysValidSchema)(o,r[s]))}zr.schemaProperties=Nv;function Uv({schemaCode:o,data:r,it:{gen:s,topSchemaRef:l,schemaPath:c,errorPath:f},it:d},n,m,b){const w=b?(0,hi._)`${o}, ${r}, ${l}${c}`:r,S=[[ia.default.instancePath,(0,hi.strConcat)(ia.default.instancePath,f)],[ia.default.parentData,d.parentData],[ia.default.parentDataProperty,d.parentDataProperty],[ia.default.rootData,ia.default.rootData]];d.opts.dynamicRef&&S.push([ia.default.dynamicAnchors,ia.default.dynamicAnchors]);const k=(0,hi._)`${w}, ${s.object(...S)}`;return m!==hi.nil?(0,hi._)`${n}.call(${m}, ${k})`:(0,hi._)`${n}(${k})`}zr.callValidateCode=Uv;const Vv=(0,hi._)`new RegExp`;function $v({gen:o,it:{opts:r}},s){const l=r.unicodeRegExp?"u":"",{regExp:c}=r.code,f=c(s,l);return o.scopeValue("pattern",{key:f.toString(),ref:f,code:(0,hi._)`${c.code==="new RegExp"?Vv:(0,Rv.useFunc)(o,c)}(${s}, ${l})`})}zr.usePattern=$v;function jv(o){const{gen:r,data:s,keyword:l,it:c}=o,f=r.name("valid");if(c.allErrors){const n=r.let("valid",!0);return d(()=>r.assign(n,!1)),n}return r.var(f,!0),d(()=>r.break()),f;function d(n){const m=r.const("len",(0,hi._)`${s}.length`);r.forRange("i",0,m,b=>{o.subschema({keyword:l,dataProp:b,dataPropType:If.Type.Num},f),r.if((0,hi.not)(f),n)})}}zr.validateArray=jv;function qv(o){const{gen:r,schema:s,keyword:l,it:c}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");if(s.some(m=>(0,If.alwaysValidSchema)(c,m))&&!c.opts.unevaluated)return;const d=r.let("valid",!1),n=r.name("_valid");r.block(()=>s.forEach((m,b)=>{const w=o.subschema({keyword:l,schemaProp:b,compositeRule:!0},n);r.assign(d,(0,hi._)`${d} || ${n}`),o.mergeValidEvaluated(w,n)||r.if((0,hi.not)(d))})),o.result(d,()=>o.reset(),()=>o.error(!0))}zr.validateUnion=qv;Object.defineProperty(vs,"__esModule",{value:!0});vs.validateKeywordUsage=vs.validSchemaType=vs.funcKeywordCode=vs.macroKeywordCode=void 0;const dn=Mr,Va=xs,Gv=zr,Zv=nc;function Hv(o,r){const{gen:s,keyword:l,schema:c,parentSchema:f,it:d}=o,n=r.macro.call(d.self,c,f,d),m=C_(s,l,n);d.opts.validateSchema!==!1&&d.self.validateSchema(n,!0);const b=s.name("valid");o.subschema({schema:n,schemaPath:dn.nil,errSchemaPath:`${d.errSchemaPath}/${l}`,topSchemaRef:m,compositeRule:!0},b),o.pass(b,()=>o.error(!0))}vs.macroKeywordCode=Hv;function Wv(o,r){var s;const{gen:l,keyword:c,schema:f,parentSchema:d,$data:n,it:m}=o;Xv(m,r);const b=!n&&r.compile?r.compile.call(m.self,f,d,m):r.validate,w=C_(l,c,b),S=l.let("valid");o.block$data(S,k),o.ok((s=r.valid)!==null&&s!==void 0?s:S);function k(){if(r.errors===!1)T(),r.modifying&&pm(o),L(()=>o.error());else{const D=r.async?A():P();r.modifying&&pm(o),L(()=>Kv(o,D))}}function A(){const D=l.let("ruleErrs",null);return l.try(()=>T((0,dn._)`await `),B=>l.assign(S,!1).if((0,dn._)`${B} instanceof ${m.ValidationError}`,()=>l.assign(D,(0,dn._)`${B}.errors`),()=>l.throw(B))),D}function P(){const D=(0,dn._)`${w}.errors`;return l.assign(D,null),T(dn.nil),D}function T(D=r.async?(0,dn._)`await `:dn.nil){const B=m.opts.passContext?Va.default.this:Va.default.self,$=!("compile"in r&&!n||r.schema===!1);l.assign(S,(0,dn._)`${D}${(0,Gv.callValidateCode)(o,w,B,$)}`,r.modifying)}function L(D){var B;l.if((0,dn.not)((B=r.valid)!==null&&B!==void 0?B:S),D)}}vs.funcKeywordCode=Wv;function pm(o){const{gen:r,data:s,it:l}=o;r.if(l.parentData,()=>r.assign(s,(0,dn._)`${l.parentData}[${l.parentDataProperty}]`))}function Kv(o,r){const{gen:s}=o;s.if((0,dn._)`Array.isArray(${r})`,()=>{s.assign(Va.default.vErrors,(0,dn._)`${Va.default.vErrors} === null ? ${r} : ${Va.default.vErrors}.concat(${r})`).assign(Va.default.errors,(0,dn._)`${Va.default.vErrors}.length`),(0,Zv.extendErrors)(o)},()=>o.error())}function Xv({schemaEnv:o},r){if(r.async&&!o.$async)throw new Error("async keyword in sync schema")}function C_(o,r,s){if(s===void 0)throw new Error(`keyword "${r}" failed to compile`);return o.scopeValue("keyword",typeof s=="function"?{ref:s}:{ref:s,code:(0,dn.stringify)(s)})}function Jv(o,r,s=!1){return!r.length||r.some(l=>l==="array"?Array.isArray(o):l==="object"?o&&typeof o=="object"&&!Array.isArray(o):typeof o==l||s&&typeof o>"u")}vs.validSchemaType=Jv;function Yv({schema:o,opts:r,self:s,errSchemaPath:l},c,f){if(Array.isArray(c.keyword)?!c.keyword.includes(f):c.keyword!==f)throw new Error("ajv implementation error");const d=c.dependencies;if(d!=null&&d.some(n=>!Object.prototype.hasOwnProperty.call(o,n)))throw new Error(`parent schema must have dependencies of ${f}: ${d.join(",")}`);if(c.validateSchema&&!c.validateSchema(o[f])){const m=`keyword "${f}" value is invalid at path "${l}": `+s.errorsText(c.validateSchema.errors);if(r.validateSchema==="log")s.logger.error(m);else throw new Error(m)}}vs.validateKeywordUsage=Yv;var oa={};Object.defineProperty(oa,"__esModule",{value:!0});oa.extendSubschemaMode=oa.extendSubschemaData=oa.getSubschema=void 0;const ys=Mr,A_=Zr;function Qv(o,{keyword:r,schemaProp:s,schema:l,schemaPath:c,errSchemaPath:f,topSchemaRef:d}){if(r!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(r!==void 0){const n=o.schema[r];return s===void 0?{schema:n,schemaPath:(0,ys._)`${o.schemaPath}${(0,ys.getProperty)(r)}`,errSchemaPath:`${o.errSchemaPath}/${r}`}:{schema:n[s],schemaPath:(0,ys._)`${o.schemaPath}${(0,ys.getProperty)(r)}${(0,ys.getProperty)(s)}`,errSchemaPath:`${o.errSchemaPath}/${r}/${(0,A_.escapeFragment)(s)}`}}if(l!==void 0){if(c===void 0||f===void 0||d===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:d,errSchemaPath:f}}throw new Error('either "keyword" or "schema" must be passed')}oa.getSubschema=Qv;function eb(o,r,{dataProp:s,dataPropType:l,data:c,dataTypes:f,propertyName:d}){if(c!==void 0&&s!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:n}=r;if(s!==void 0){const{errorPath:b,dataPathArr:w,opts:S}=r,k=n.let("data",(0,ys._)`${r.data}${(0,ys.getProperty)(s)}`,!0);m(k),o.errorPath=(0,ys.str)`${b}${(0,A_.getErrorPath)(s,l,S.jsPropertySyntax)}`,o.parentDataProperty=(0,ys._)`${s}`,o.dataPathArr=[...w,o.parentDataProperty]}if(c!==void 0){const b=c instanceof ys.Name?c:n.let("data",c,!0);m(b),d!==void 0&&(o.propertyName=d)}f&&(o.dataTypes=f);function m(b){o.data=b,o.dataLevel=r.dataLevel+1,o.dataTypes=[],r.definedProperties=new Set,o.parentData=r.data,o.dataNames=[...r.dataNames,b]}}oa.extendSubschemaData=eb;function tb(o,{jtdDiscriminator:r,jtdMetadata:s,compositeRule:l,createErrors:c,allErrors:f}){l!==void 0&&(o.compositeRule=l),c!==void 0&&(o.createErrors=c),f!==void 0&&(o.allErrors=f),o.jtdDiscriminator=r,o.jtdMetadata=s}oa.extendSubschemaMode=tb;var Xi={},P_=function o(r,s){if(r===s)return!0;if(r&&s&&typeof r=="object"&&typeof s=="object"){if(r.constructor!==s.constructor)return!1;var l,c,f;if(Array.isArray(r)){if(l=r.length,l!=s.length)return!1;for(c=l;c--!==0;)if(!o(r[c],s[c]))return!1;return!0}if(r.constructor===RegExp)return r.source===s.source&&r.flags===s.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===s.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===s.toString();if(f=Object.keys(r),l=f.length,l!==Object.keys(s).length)return!1;for(c=l;c--!==0;)if(!Object.prototype.hasOwnProperty.call(s,f[c]))return!1;for(c=l;c--!==0;){var d=f[c];if(!o(r[d],s[d]))return!1}return!0}return r!==r&&s!==s},z_={exports:{}},sa=z_.exports=function(o,r,s){typeof r=="function"&&(s=r,r={}),s=r.cb||s;var l=typeof s=="function"?s:s.pre||function(){},c=s.post||function(){};Su(r,l,c,o,"",o)};sa.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};sa.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};sa.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};sa.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function Su(o,r,s,l,c,f,d,n,m,b){if(l&&typeof l=="object"&&!Array.isArray(l)){r(l,c,f,d,n,m,b);for(var w in l){var S=l[w];if(Array.isArray(S)){if(w in sa.arrayKeywords)for(var k=0;kr+=M_(l)),r===1/0))return 1/0}return r}function D_(o,r="",s){s!==!1&&(r=Fo(r));const l=o.parse(r);return R_(o,l)}Xi.getFullPath=D_;function R_(o,r){return o.serialize(r).split("#")[0]+"#"}Xi._getFullPath=R_;const ub=/#\/?$/;function Fo(o){return o?o.replace(ub,""):""}Xi.normalizeId=Fo;function hb(o,r,s){return s=Fo(s),o.resolve(r,s)}Xi.resolveUrl=hb;const fb=/^[a-z_][-a-z0-9._]*$/i;function db(o,r){if(typeof o=="boolean")return{};const{schemaId:s,uriResolver:l}=this.opts,c=Fo(o[s]||r),f={"":c},d=D_(l,c,!1),n={},m=new Set;return ab(o,{allKeys:!0},(S,k,A,P)=>{if(P===void 0)return;const T=d+k;let L=f[P];typeof S[s]=="string"&&(L=D.call(this,S[s])),B.call(this,S.$anchor),B.call(this,S.$dynamicAnchor),f[k]=L;function D($){const J=this.opts.uriResolver.resolve;if($=Fo(L?J(L,$):$),m.has($))throw w($);m.add($);let Y=this.refs[$];return typeof Y=="string"&&(Y=this.refs[Y]),typeof Y=="object"?b(S,Y.schema,$):$!==Fo(T)&&($[0]==="#"?(b(S,n[$],$),n[$]=S):this.refs[$]=T),$}function B($){if(typeof $=="string"){if(!fb.test($))throw new Error(`invalid anchor "${$}"`);D.call(this,`#${$}`)}}}),n;function b(S,k,A){if(k!==void 0&&!sb(S,k))throw w(A)}function w(S){return new Error(`reference "${S}" resolves to more than one schema`)}}Xi.getSchemaRefs=db;Object.defineProperty(ns,"__esModule",{value:!0});ns.getData=ns.KeywordCxt=ns.validateFunctionCode=void 0;const L_=Vo,mm=sc,Pf=Fs,Mu=sc,pb=qu,Wl=vs,tf=oa,ur=Mr,vr=xs,mb=Xi,Ns=Zr,Vl=nc;function gb(o){if(F_(o)&&(N_(o),O_(o))){vb(o);return}B_(o,()=>(0,L_.topBoolOrEmptySchema)(o))}ns.validateFunctionCode=gb;function B_({gen:o,validateName:r,schema:s,schemaEnv:l,opts:c},f){c.code.es5?o.func(r,(0,ur._)`${vr.default.data}, ${vr.default.valCxt}`,l.$async,()=>{o.code((0,ur._)`"use strict"; ${gm(s,c)}`),yb(o,c),o.code(f)}):o.func(r,(0,ur._)`${vr.default.data}, ${_b(c)}`,l.$async,()=>o.code(gm(s,c)).code(f))}function _b(o){return(0,ur._)`{${vr.default.instancePath}="", ${vr.default.parentData}, ${vr.default.parentDataProperty}, ${vr.default.rootData}=${vr.default.data}${o.dynamicRef?(0,ur._)`, ${vr.default.dynamicAnchors}={}`:ur.nil}}={}`}function yb(o,r){o.if(vr.default.valCxt,()=>{o.var(vr.default.instancePath,(0,ur._)`${vr.default.valCxt}.${vr.default.instancePath}`),o.var(vr.default.parentData,(0,ur._)`${vr.default.valCxt}.${vr.default.parentData}`),o.var(vr.default.parentDataProperty,(0,ur._)`${vr.default.valCxt}.${vr.default.parentDataProperty}`),o.var(vr.default.rootData,(0,ur._)`${vr.default.valCxt}.${vr.default.rootData}`),r.dynamicRef&&o.var(vr.default.dynamicAnchors,(0,ur._)`${vr.default.valCxt}.${vr.default.dynamicAnchors}`)},()=>{o.var(vr.default.instancePath,(0,ur._)`""`),o.var(vr.default.parentData,(0,ur._)`undefined`),o.var(vr.default.parentDataProperty,(0,ur._)`undefined`),o.var(vr.default.rootData,vr.default.data),r.dynamicRef&&o.var(vr.default.dynamicAnchors,(0,ur._)`{}`)})}function vb(o){const{schema:r,opts:s,gen:l}=o;B_(o,()=>{s.$comment&&r.$comment&&V_(o),kb(o),l.let(vr.default.vErrors,null),l.let(vr.default.errors,0),s.unevaluated&&bb(o),U_(o),Ib(o)})}function bb(o){const{gen:r,validateName:s}=o;o.evaluated=r.const("evaluated",(0,ur._)`${s}.evaluated`),r.if((0,ur._)`${o.evaluated}.dynamicProps`,()=>r.assign((0,ur._)`${o.evaluated}.props`,(0,ur._)`undefined`)),r.if((0,ur._)`${o.evaluated}.dynamicItems`,()=>r.assign((0,ur._)`${o.evaluated}.items`,(0,ur._)`undefined`))}function gm(o,r){const s=typeof o=="object"&&o[r.schemaId];return s&&(r.code.source||r.code.process)?(0,ur._)`/*# sourceURL=${s} */`:ur.nil}function xb(o,r){if(F_(o)&&(N_(o),O_(o))){wb(o,r);return}(0,L_.boolOrEmptySchema)(o,r)}function O_({schema:o,self:r}){if(typeof o=="boolean")return!o;for(const s in o)if(r.RULES.all[s])return!0;return!1}function F_(o){return typeof o.schema!="boolean"}function wb(o,r){const{schema:s,gen:l,opts:c}=o;c.$comment&&s.$comment&&V_(o),Sb(o),Tb(o);const f=l.const("_errs",vr.default.errors);U_(o,f),l.var(r,(0,ur._)`${f} === ${vr.default.errors}`)}function N_(o){(0,Ns.checkUnknownRules)(o),Eb(o)}function U_(o,r){if(o.opts.jtd)return _m(o,[],!1,r);const s=(0,mm.getSchemaTypes)(o.schema),l=(0,mm.coerceAndCheckDataType)(o,s);_m(o,s,!l,r)}function Eb(o){const{schema:r,errSchemaPath:s,opts:l,self:c}=o;r.$ref&&l.ignoreKeywordsWithRef&&(0,Ns.schemaHasRulesButRef)(r,c.RULES)&&c.logger.warn(`$ref: keywords ignored in schema at path "${s}"`)}function kb(o){const{schema:r,opts:s}=o;r.default!==void 0&&s.useDefaults&&s.strictSchema&&(0,Ns.checkStrictMode)(o,"default is ignored in the schema root")}function Sb(o){const r=o.schema[o.opts.schemaId];r&&(o.baseId=(0,mb.resolveUrl)(o.opts.uriResolver,o.baseId,r))}function Tb(o){if(o.schema.$async&&!o.schemaEnv.$async)throw new Error("async schema in sync schema")}function V_({gen:o,schemaEnv:r,schema:s,errSchemaPath:l,opts:c}){const f=s.$comment;if(c.$comment===!0)o.code((0,ur._)`${vr.default.self}.logger.log(${f})`);else if(typeof c.$comment=="function"){const d=(0,ur.str)`${l}/$comment`,n=o.scopeValue("root",{ref:r.root});o.code((0,ur._)`${vr.default.self}.opts.$comment(${f}, ${d}, ${n}.schema)`)}}function Ib(o){const{gen:r,schemaEnv:s,validateName:l,ValidationError:c,opts:f}=o;s.$async?r.if((0,ur._)`${vr.default.errors} === 0`,()=>r.return(vr.default.data),()=>r.throw((0,ur._)`new ${c}(${vr.default.vErrors})`)):(r.assign((0,ur._)`${l}.errors`,vr.default.vErrors),f.unevaluated&&Cb(o),r.return((0,ur._)`${vr.default.errors} === 0`))}function Cb({gen:o,evaluated:r,props:s,items:l}){s instanceof ur.Name&&o.assign((0,ur._)`${r}.props`,s),l instanceof ur.Name&&o.assign((0,ur._)`${r}.items`,l)}function _m(o,r,s,l){const{gen:c,schema:f,data:d,allErrors:n,opts:m,self:b}=o,{RULES:w}=b;if(f.$ref&&(m.ignoreKeywordsWithRef||!(0,Ns.schemaHasRulesButRef)(f,w))){c.block(()=>q_(o,"$ref",w.all.$ref.definition));return}m.jtd||Ab(o,r),c.block(()=>{for(const k of w.rules)S(k);S(w.post)});function S(k){(0,Pf.shouldUseGroup)(f,k)&&(k.type?(c.if((0,Mu.checkDataType)(k.type,d,m.strictNumbers)),ym(o,k),r.length===1&&r[0]===k.type&&s&&(c.else(),(0,Mu.reportTypeError)(o)),c.endIf()):ym(o,k),n||c.if((0,ur._)`${vr.default.errors} === ${l||0}`))}}function ym(o,r){const{gen:s,schema:l,opts:{useDefaults:c}}=o;c&&(0,pb.assignDefaults)(o,r.type),s.block(()=>{for(const f of r.rules)(0,Pf.shouldUseRule)(l,f)&&q_(o,f.keyword,f.definition,r.type)})}function Ab(o,r){o.schemaEnv.meta||!o.opts.strictTypes||(Pb(o,r),o.opts.allowUnionTypes||zb(o,r),Mb(o,o.dataTypes))}function Pb(o,r){if(r.length){if(!o.dataTypes.length){o.dataTypes=r;return}r.forEach(s=>{$_(o.dataTypes,s)||zf(o,`type "${s}" not allowed by context "${o.dataTypes.join(",")}"`)}),Rb(o,r)}}function zb(o,r){r.length>1&&!(r.length===2&&r.includes("null"))&&zf(o,"use allowUnionTypes to allow union type keyword")}function Mb(o,r){const s=o.self.RULES.all;for(const l in s){const c=s[l];if(typeof c=="object"&&(0,Pf.shouldUseRule)(o.schema,c)){const{type:f}=c.definition;f.length&&!f.some(d=>Db(r,d))&&zf(o,`missing type "${f.join(",")}" for keyword "${l}"`)}}}function Db(o,r){return o.includes(r)||r==="number"&&o.includes("integer")}function $_(o,r){return o.includes(r)||r==="integer"&&o.includes("number")}function Rb(o,r){const s=[];for(const l of o.dataTypes)$_(r,l)?s.push(l):r.includes("integer")&&l==="number"&&s.push("integer");o.dataTypes=s}function zf(o,r){const s=o.schemaEnv.baseId+o.errSchemaPath;r+=` at "${s}" (strictTypes)`,(0,Ns.checkStrictMode)(o,r,o.opts.strictTypes)}class j_{constructor(r,s,l){if((0,Wl.validateKeywordUsage)(r,s,l),this.gen=r.gen,this.allErrors=r.allErrors,this.keyword=l,this.data=r.data,this.schema=r.schema[l],this.$data=s.$data&&r.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Ns.schemaRefOrVal)(r,this.schema,l,this.$data),this.schemaType=s.schemaType,this.parentSchema=r.schema,this.params={},this.it=r,this.def=s,this.$data)this.schemaCode=r.gen.const("vSchema",G_(this.$data,r));else if(this.schemaCode=this.schemaValue,!(0,Wl.validSchemaType)(this.schema,s.schemaType,s.allowUndefined))throw new Error(`${l} value must be ${JSON.stringify(s.schemaType)}`);("code"in s?s.trackErrors:s.errors!==!1)&&(this.errsCount=r.gen.const("_errs",vr.default.errors))}result(r,s,l){this.failResult((0,ur.not)(r),s,l)}failResult(r,s,l){this.gen.if(r),l?l():this.error(),s?(this.gen.else(),s(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(r,s){this.failResult((0,ur.not)(r),void 0,s)}fail(r){if(r===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(r),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(r){if(!this.$data)return this.fail(r);const{schemaCode:s}=this;this.fail((0,ur._)`${s} !== undefined && (${(0,ur.or)(this.invalid$data(),r)})`)}error(r,s,l){if(s){this.setParams(s),this._error(r,l),this.setParams({});return}this._error(r,l)}_error(r,s){(r?Vl.reportExtraError:Vl.reportError)(this,this.def.error,s)}$dataError(){(0,Vl.reportError)(this,this.def.$dataError||Vl.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Vl.resetErrorsCount)(this.gen,this.errsCount)}ok(r){this.allErrors||this.gen.if(r)}setParams(r,s){s?Object.assign(this.params,r):this.params=r}block$data(r,s,l=ur.nil){this.gen.block(()=>{this.check$data(r,l),s()})}check$data(r=ur.nil,s=ur.nil){if(!this.$data)return;const{gen:l,schemaCode:c,schemaType:f,def:d}=this;l.if((0,ur.or)((0,ur._)`${c} === undefined`,s)),r!==ur.nil&&l.assign(r,!0),(f.length||d.validateSchema)&&(l.elseIf(this.invalid$data()),this.$dataError(),r!==ur.nil&&l.assign(r,!1)),l.else()}invalid$data(){const{gen:r,schemaCode:s,schemaType:l,def:c,it:f}=this;return(0,ur.or)(d(),n());function d(){if(l.length){if(!(s instanceof ur.Name))throw new Error("ajv implementation error");const m=Array.isArray(l)?l:[l];return(0,ur._)`${(0,Mu.checkDataTypes)(m,s,f.opts.strictNumbers,Mu.DataType.Wrong)}`}return ur.nil}function n(){if(c.validateSchema){const m=r.scopeValue("validate$data",{ref:c.validateSchema});return(0,ur._)`!${m}(${s})`}return ur.nil}}subschema(r,s){const l=(0,tf.getSubschema)(this.it,r);(0,tf.extendSubschemaData)(l,this.it,r),(0,tf.extendSubschemaMode)(l,r);const c={...this.it,...l,items:void 0,props:void 0};return xb(c,s),c}mergeEvaluated(r,s){const{it:l,gen:c}=this;l.opts.unevaluated&&(l.props!==!0&&r.props!==void 0&&(l.props=Ns.mergeEvaluated.props(c,r.props,l.props,s)),l.items!==!0&&r.items!==void 0&&(l.items=Ns.mergeEvaluated.items(c,r.items,l.items,s)))}mergeValidEvaluated(r,s){const{it:l,gen:c}=this;if(l.opts.unevaluated&&(l.props!==!0||l.items!==!0))return c.if(s,()=>this.mergeEvaluated(r,ur.Name)),!0}}ns.KeywordCxt=j_;function q_(o,r,s,l){const c=new j_(o,s,r);"code"in s?s.code(c,l):c.$data&&s.validate?(0,Wl.funcKeywordCode)(c,s):"macro"in s?(0,Wl.macroKeywordCode)(c,s):(s.compile||s.validate)&&(0,Wl.funcKeywordCode)(c,s)}const Lb=/^\/(?:[^~]|~0|~1)*$/,Bb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function G_(o,{dataLevel:r,dataNames:s,dataPathArr:l}){let c,f;if(o==="")return vr.default.rootData;if(o[0]==="/"){if(!Lb.test(o))throw new Error(`Invalid JSON-pointer: ${o}`);c=o,f=vr.default.rootData}else{const b=Bb.exec(o);if(!b)throw new Error(`Invalid JSON-pointer: ${o}`);const w=+b[1];if(c=b[2],c==="#"){if(w>=r)throw new Error(m("property/index",w));return l[r-w]}if(w>r)throw new Error(m("data",w));if(f=s[r-w],!c)return f}let d=f;const n=c.split("/");for(const b of n)b&&(f=(0,ur._)`${f}${(0,ur.getProperty)((0,Ns.unescapeJsonPointer)(b))}`,d=(0,ur._)`${d} && ${f}`);return d;function m(b,w){return`Cannot access ${b} ${w} levels up, current level is ${r}`}}ns.getData=G_;var ac={};Object.defineProperty(ac,"__esModule",{value:!0});class Ob extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}ac.default=Ob;var oc={};Object.defineProperty(oc,"__esModule",{value:!0});const rf=Xi;class Fb extends Error{constructor(r,s,l,c){super(c||`can't resolve reference ${l} from id ${s}`),this.missingRef=(0,rf.resolveUrl)(r,s,l),this.missingSchema=(0,rf.normalizeId)((0,rf.getFullPath)(r,this.missingRef))}}oc.default=Fb;var wn={};Object.defineProperty(wn,"__esModule",{value:!0});wn.resolveSchema=wn.getCompilingSchema=wn.resolveRef=wn.compileSchema=wn.SchemaEnv=void 0;const Yn=Mr,Nb=ac,Ua=xs,is=Xi,vm=Zr,Ub=ns;class Gu{constructor(r){var s;this.refs={},this.dynamicAnchors={};let l;typeof r.schema=="object"&&(l=r.schema),this.schema=r.schema,this.schemaId=r.schemaId,this.root=r.root||this,this.baseId=(s=r.baseId)!==null&&s!==void 0?s:(0,is.normalizeId)(l==null?void 0:l[r.schemaId||"$id"]),this.schemaPath=r.schemaPath,this.localRefs=r.localRefs,this.meta=r.meta,this.$async=l==null?void 0:l.$async,this.refs={}}}wn.SchemaEnv=Gu;function Mf(o){const r=Z_.call(this,o);if(r)return r;const s=(0,is.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:l,lines:c}=this.opts.code,{ownProperties:f}=this.opts,d=new Yn.CodeGen(this.scope,{es5:l,lines:c,ownProperties:f});let n;o.$async&&(n=d.scopeValue("Error",{ref:Nb.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));const m=d.scopeName("validate");o.validateName=m;const b={gen:d,allErrors:this.opts.allErrors,data:Ua.default.data,parentData:Ua.default.parentData,parentDataProperty:Ua.default.parentDataProperty,dataNames:[Ua.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",this.opts.code.source===!0?{ref:o.schema,code:(0,Yn.stringify)(o.schema)}:{ref:o.schema}),validateName:m,ValidationError:n,schema:o.schema,schemaEnv:o,rootId:s,baseId:o.baseId||s,schemaPath:Yn.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this};let w;try{this._compilations.add(o),(0,Ub.validateFunctionCode)(b),d.optimize(this.opts.code.optimize);const S=d.toString();w=`${d.scopeRefs(Ua.default.scope)}return ${S}`,this.opts.code.process&&(w=this.opts.code.process(w,o));const A=new Function(`${Ua.default.self}`,`${Ua.default.scope}`,w)(this,this.scope.get());if(this.scope.value(m,{ref:A}),A.errors=null,A.schema=o.schema,A.schemaEnv=o,o.$async&&(A.$async=!0),this.opts.code.source===!0&&(A.source={validateName:m,validateCode:S,scopeValues:d._values}),this.opts.unevaluated){const{props:P,items:T}=b;A.evaluated={props:P instanceof Yn.Name?void 0:P,items:T instanceof Yn.Name?void 0:T,dynamicProps:P instanceof Yn.Name,dynamicItems:T instanceof Yn.Name},A.source&&(A.source.evaluated=(0,Yn.stringify)(A.evaluated))}return o.validate=A,o}catch(S){throw delete o.validate,delete o.validateName,w&&this.logger.error("Error compiling schema, function code:",w),S}finally{this._compilations.delete(o)}}wn.compileSchema=Mf;function Vb(o,r,s){var l;s=(0,is.resolveUrl)(this.opts.uriResolver,r,s);const c=o.refs[s];if(c)return c;let f=qb.call(this,o,s);if(f===void 0){const d=(l=o.localRefs)===null||l===void 0?void 0:l[s],{schemaId:n}=this.opts;d&&(f=new Gu({schema:d,schemaId:n,root:o,baseId:r}))}if(f!==void 0)return o.refs[s]=$b.call(this,f)}wn.resolveRef=Vb;function $b(o){return(0,is.inlineRef)(o.schema,this.opts.inlineRefs)?o.schema:o.validate?o:Mf.call(this,o)}function Z_(o){for(const r of this._compilations)if(jb(r,o))return r}wn.getCompilingSchema=Z_;function jb(o,r){return o.schema===r.schema&&o.root===r.root&&o.baseId===r.baseId}function qb(o,r){let s;for(;typeof(s=this.refs[r])=="string";)r=s;return s||this.schemas[r]||Zu.call(this,o,r)}function Zu(o,r){const s=this.opts.uriResolver.parse(r),l=(0,is._getFullPath)(this.opts.uriResolver,s);let c=(0,is.getFullPath)(this.opts.uriResolver,o.baseId,void 0);if(Object.keys(o.schema).length>0&&l===c)return nf.call(this,s,o);const f=(0,is.normalizeId)(l),d=this.refs[f]||this.schemas[f];if(typeof d=="string"){const n=Zu.call(this,o,d);return typeof(n==null?void 0:n.schema)!="object"?void 0:nf.call(this,s,n)}if(typeof(d==null?void 0:d.schema)=="object"){if(d.validate||Mf.call(this,d),f===(0,is.normalizeId)(r)){const{schema:n}=d,{schemaId:m}=this.opts,b=n[m];return b&&(c=(0,is.resolveUrl)(this.opts.uriResolver,c,b)),new Gu({schema:n,schemaId:m,root:o,baseId:c})}return nf.call(this,s,d)}}wn.resolveSchema=Zu;const Gb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function nf(o,{baseId:r,schema:s,root:l}){var c;if(((c=o.fragment)===null||c===void 0?void 0:c[0])!=="/")return;for(const n of o.fragment.slice(1).split("/")){if(typeof s=="boolean")return;const m=s[(0,vm.unescapeFragment)(n)];if(m===void 0)return;s=m;const b=typeof s=="object"&&s[this.opts.schemaId];!Gb.has(n)&&b&&(r=(0,is.resolveUrl)(this.opts.uriResolver,r,b))}let f;if(typeof s!="boolean"&&s.$ref&&!(0,vm.schemaHasRulesButRef)(s,this.RULES)){const n=(0,is.resolveUrl)(this.opts.uriResolver,r,s.$ref);f=Zu.call(this,l,n)}const{schemaId:d}=this.opts;if(f=f||new Gu({schema:s,schemaId:d,root:l,baseId:r}),f.schema!==f.root.schema)return f}const Zb="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Hb="Meta-schema for $data reference (JSON AnySchema extension proposal)",Wb="object",Kb=["$data"],Xb={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Jb=!1,Yb={$id:Zb,description:Hb,type:Wb,required:Kb,properties:Xb,additionalProperties:Jb};var Df={},gf={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(o,r){(function(s,l){l(r)})(Ro,function(s){function l(){for(var Ce=arguments.length,N=Array(Ce),z=0;z1){N[0]=N[0].slice(0,-1);for(var U=N.length-1,q=1;q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_t=T-L,le=Math.floor,We=String.fromCharCode;function Z(Ce){throw new RangeError(Ae[Ce])}function $e(Ce,N){for(var z=[],U=Ce.length;U--;)z[U]=N(Ce[U]);return z}function ct(Ce,N){var z=Ce.split("@"),U="";z.length>1&&(U=z[0]+"@",Ce=z[1]),Ce=Ce.replace(ye,".");var q=Ce.split("."),Q=$e(q,N).join(".");return U+Q}function rt(Ce){for(var N=[],z=0,U=Ce.length;z=55296&&q<=56319&&z>1,N+=le(N/z);N>_t*D>>1;q+=T)N=le(N/_t);return le(q+(_t+1)*N/(N+B))},ge=function(N){var z=[],U=N.length,q=0,Q=Y,he=J,Se=N.lastIndexOf(se);Se<0&&(Se=0);for(var Ee=0;Ee=128&&Z("not-basic"),z.push(N.charCodeAt(Ee));for(var ve=Se>0?Se+1:0;ve=U&&Z("invalid-input");var Re=it(N.charCodeAt(ve++));(Re>=T||Re>le((P-q)/Ge))&&Z("overflow"),q+=Re*Ge;var Ct=ot<=he?L:ot>=he+D?D:ot-he;if(Rele(P/Pt)&&Z("overflow"),Ge*=Pt}var bt=z.length+1;he=oe(q-Te,bt,Te==0),le(q/bt)>P-Q&&Z("overflow"),Q+=le(q/bt),q%=bt,z.splice(q++,0,Q)}return String.fromCodePoint.apply(String,z)},Me=function(N){var z=[];N=rt(N);var U=N.length,q=Y,Q=0,he=J,Se=!0,Ee=!1,ve=void 0;try{for(var Te=N[Symbol.iterator](),Ge;!(Se=(Ge=Te.next()).done);Se=!0){var ot=Ge.value;ot<128&&z.push(We(ot))}}catch(qn){Ee=!0,ve=qn}finally{try{!Se&&Te.return&&Te.return()}finally{if(Ee)throw ve}}var Re=z.length,Ct=Re;for(Re&&z.push(se);Ct=q&&frle((P-Q)/dr)&&Z("overflow"),Q+=(Pt-q)*dr,q=Pt;var Tr=!0,Qr=!1,Dr=void 0;try{for(var fi=N[Symbol.iterator](),jn;!(Tr=(jn=fi.next()).done);Tr=!0){var as=jn.value;if(asP&&Z("overflow"),as==q){for(var Br=Q,os=T;;os+=T){var ls=os<=he?L:os>=he+D?D:os-he;if(Br>6|192).toString(16).toUpperCase()+"%"+(N&63|128).toString(16).toUpperCase():z="%"+(N>>12|224).toString(16).toUpperCase()+"%"+(N>>6&63|128).toString(16).toUpperCase()+"%"+(N&63|128).toString(16).toUpperCase(),z}function Xe(Ce){for(var N="",z=0,U=Ce.length;z=194&&q<224){if(U-z>=6){var Q=parseInt(Ce.substr(z+4,2),16);N+=String.fromCharCode((q&31)<<6|Q&63)}else N+=Ce.substr(z,6);z+=6}else if(q>=224){if(U-z>=9){var he=parseInt(Ce.substr(z+4,2),16),Se=parseInt(Ce.substr(z+7,2),16);N+=String.fromCharCode((q&15)<<12|(he&63)<<6|Se&63)}else N+=Ce.substr(z,9);z+=9}else N+=Ce.substr(z,3),z+=3}return N}function Bt(Ce,N){function z(U){var q=Xe(U);return q.match(N.UNRESERVED)?q:U}return Ce.scheme&&(Ce.scheme=String(Ce.scheme).replace(N.PCT_ENCODED,z).toLowerCase().replace(N.NOT_SCHEME,"")),Ce.userinfo!==void 0&&(Ce.userinfo=String(Ce.userinfo).replace(N.PCT_ENCODED,z).replace(N.NOT_USERINFO,pt).replace(N.PCT_ENCODED,d)),Ce.host!==void 0&&(Ce.host=String(Ce.host).replace(N.PCT_ENCODED,z).toLowerCase().replace(N.NOT_HOST,pt).replace(N.PCT_ENCODED,d)),Ce.path!==void 0&&(Ce.path=String(Ce.path).replace(N.PCT_ENCODED,z).replace(Ce.scheme?N.NOT_PATH:N.NOT_PATH_NOSCHEME,pt).replace(N.PCT_ENCODED,d)),Ce.query!==void 0&&(Ce.query=String(Ce.query).replace(N.PCT_ENCODED,z).replace(N.NOT_QUERY,pt).replace(N.PCT_ENCODED,d)),Ce.fragment!==void 0&&(Ce.fragment=String(Ce.fragment).replace(N.PCT_ENCODED,z).replace(N.NOT_FRAGMENT,pt).replace(N.PCT_ENCODED,d)),Ce}function Qt(Ce){return Ce.replace(/^0*(.*)/,"$1")||"0"}function Rr(Ce,N){var z=Ce.match(N.IPV4ADDRESS)||[],U=k(z,2),q=U[1];return q?q.split(".").map(Qt).join("."):Ce}function Vr(Ce,N){var z=Ce.match(N.IPV6ADDRESS)||[],U=k(z,3),q=U[1],Q=U[2];if(q){for(var he=q.toLowerCase().split("::").reverse(),Se=k(he,2),Ee=Se[0],ve=Se[1],Te=ve?ve.split(":").map(Qt):[],Ge=Ee.split(":").map(Qt),ot=N.IPV4ADDRESS.test(Ge[Ge.length-1]),Re=ot?7:8,Ct=Ge.length-Re,Pt=Array(Re),bt=0;bt1){var or=Pt.slice(0,Yt.index),fr=Pt.slice(Yt.index+Yt.length);mr=or.join(":")+"::"+fr.join(":")}else mr=Pt.join(":");return Q&&(mr+="%"+Q),mr}else return Ce}var H=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ut="".match(/(){0}/)[1]===void 0;function tt(Ce){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z={},U=N.iri!==!1?S:w;N.reference==="suffix"&&(Ce=(N.scheme?N.scheme+":":"")+"//"+Ce);var q=Ce.match(H);if(q){ut?(z.scheme=q[1],z.userinfo=q[3],z.host=q[4],z.port=parseInt(q[5],10),z.path=q[6]||"",z.query=q[7],z.fragment=q[8],isNaN(z.port)&&(z.port=q[5])):(z.scheme=q[1]||void 0,z.userinfo=Ce.indexOf("@")!==-1?q[3]:void 0,z.host=Ce.indexOf("//")!==-1?q[4]:void 0,z.port=parseInt(q[5],10),z.path=q[6]||"",z.query=Ce.indexOf("?")!==-1?q[7]:void 0,z.fragment=Ce.indexOf("#")!==-1?q[8]:void 0,isNaN(z.port)&&(z.port=Ce.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),z.host&&(z.host=Vr(Rr(z.host,U),U)),z.scheme===void 0&&z.userinfo===void 0&&z.host===void 0&&z.port===void 0&&!z.path&&z.query===void 0?z.reference="same-document":z.scheme===void 0?z.reference="relative":z.fragment===void 0?z.reference="absolute":z.reference="uri",N.reference&&N.reference!=="suffix"&&N.reference!==z.reference&&(z.error=z.error||"URI is not a "+N.reference+" reference.");var Q=wt[(N.scheme||z.scheme||"").toLowerCase()];if(!N.unicodeSupport&&(!Q||!Q.unicodeSupport)){if(z.host&&(N.domainHost||Q&&Q.domainHost))try{z.host=Je.toASCII(z.host.replace(U.PCT_ENCODED,Xe).toLowerCase())}catch(he){z.error=z.error||"Host's domain name can not be converted to ASCII via punycode: "+he}Bt(z,w)}else Bt(z,U);Q&&Q.parse&&Q.parse(z,N)}else z.error=z.error||"URI can not be parsed.";return z}function be(Ce,N){var z=N.iri!==!1?S:w,U=[];return Ce.userinfo!==void 0&&(U.push(Ce.userinfo),U.push("@")),Ce.host!==void 0&&U.push(Vr(Rr(String(Ce.host),z),z).replace(z.IPV6ADDRESS,function(q,Q,he){return"["+Q+(he?"%25"+he:"")+"]"})),(typeof Ce.port=="number"||typeof Ce.port=="string")&&(U.push(":"),U.push(String(Ce.port))),U.length?U.join(""):void 0}var pe=/^\.\.?\//,Ie=/^\/\.(\/|$)/,dt=/^\/\.\.(\/|$)/,mt=/^\/?(?:.|\n)*?(?=\/|$)/;function je(Ce){for(var N=[];Ce.length;)if(Ce.match(pe))Ce=Ce.replace(pe,"");else if(Ce.match(Ie))Ce=Ce.replace(Ie,"/");else if(Ce.match(dt))Ce=Ce.replace(dt,"/"),N.pop();else if(Ce==="."||Ce==="..")Ce="";else{var z=Ce.match(mt);if(z){var U=z[0];Ce=Ce.slice(U.length),N.push(U)}else throw new Error("Unexpected dot segment condition")}return N.join("")}function vt(Ce){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=N.iri?S:w,U=[],q=wt[(N.scheme||Ce.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(Ce,N),Ce.host&&!z.IPV6ADDRESS.test(Ce.host)){if(N.domainHost||q&&q.domainHost)try{Ce.host=N.iri?Je.toUnicode(Ce.host):Je.toASCII(Ce.host.replace(z.PCT_ENCODED,Xe).toLowerCase())}catch(Se){Ce.error=Ce.error||"Host's domain name can not be converted to "+(N.iri?"Unicode":"ASCII")+" via punycode: "+Se}}Bt(Ce,z),N.reference!=="suffix"&&Ce.scheme&&(U.push(Ce.scheme),U.push(":"));var Q=be(Ce,N);if(Q!==void 0&&(N.reference!=="suffix"&&U.push("//"),U.push(Q),Ce.path&&Ce.path.charAt(0)!=="/"&&U.push("/")),Ce.path!==void 0){var he=Ce.path;!N.absolutePath&&(!q||!q.absolutePath)&&(he=je(he)),Q===void 0&&(he=he.replace(/^\/\//,"/%2F")),U.push(he)}return Ce.query!==void 0&&(U.push("?"),U.push(Ce.query)),Ce.fragment!==void 0&&(U.push("#"),U.push(Ce.fragment)),U.join("")}function Ot(Ce,N){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},U=arguments[3],q={};return U||(Ce=tt(vt(Ce,z),z),N=tt(vt(N,z),z)),z=z||{},!z.tolerant&&N.scheme?(q.scheme=N.scheme,q.userinfo=N.userinfo,q.host=N.host,q.port=N.port,q.path=je(N.path||""),q.query=N.query):(N.userinfo!==void 0||N.host!==void 0||N.port!==void 0?(q.userinfo=N.userinfo,q.host=N.host,q.port=N.port,q.path=je(N.path||""),q.query=N.query):(N.path?(N.path.charAt(0)==="/"?q.path=je(N.path):((Ce.userinfo!==void 0||Ce.host!==void 0||Ce.port!==void 0)&&!Ce.path?q.path="/"+N.path:Ce.path?q.path=Ce.path.slice(0,Ce.path.lastIndexOf("/")+1)+N.path:q.path=N.path,q.path=je(q.path)),q.query=N.query):(q.path=Ce.path,N.query!==void 0?q.query=N.query:q.query=Ce.query),q.userinfo=Ce.userinfo,q.host=Ce.host,q.port=Ce.port),q.scheme=Ce.scheme),q.fragment=N.fragment,q}function St(Ce,N,z){var U=m({scheme:"null"},z);return vt(Ot(tt(Ce,U),tt(N,U),U,!0),U)}function Wt(Ce,N){return typeof Ce=="string"?Ce=vt(tt(Ce,N),N):f(Ce)==="object"&&(Ce=tt(vt(Ce,N),N)),Ce}function wr(Ce,N,z){return typeof Ce=="string"?Ce=vt(tt(Ce,z),z):f(Ce)==="object"&&(Ce=vt(Ce,z)),typeof N=="string"?N=vt(tt(N,z),z):f(N)==="object"&&(N=vt(N,z)),Ce===N}function Fe(Ce,N){return Ce&&Ce.toString().replace(!N||!N.iri?w.ESCAPE:S.ESCAPE,pt)}function gt(Ce,N){return Ce&&Ce.toString().replace(!N||!N.iri?w.PCT_ENCODED:S.PCT_ENCODED,Xe)}var mi={scheme:"http",domainHost:!0,parse:function(N,z){return N.host||(N.error=N.error||"HTTP URIs must have a host."),N},serialize:function(N,z){var U=String(N.scheme).toLowerCase()==="https";return(N.port===(U?443:80)||N.port==="")&&(N.port=void 0),N.path||(N.path="/"),N}},ri={scheme:"https",domainHost:mi.domainHost,parse:mi.parse,serialize:mi.serialize};function yr(Ce){return typeof Ce.secure=="boolean"?Ce.secure:String(Ce.scheme).toLowerCase()==="wss"}var Sr={scheme:"ws",domainHost:!0,parse:function(N,z){var U=N;return U.secure=yr(U),U.resourceName=(U.path||"/")+(U.query?"?"+U.query:""),U.path=void 0,U.query=void 0,U},serialize:function(N,z){if((N.port===(yr(N)?443:80)||N.port==="")&&(N.port=void 0),typeof N.secure=="boolean"&&(N.scheme=N.secure?"wss":"ws",N.secure=void 0),N.resourceName){var U=N.resourceName.split("?"),q=k(U,2),Q=q[0],he=q[1];N.path=Q&&Q!=="/"?Q:void 0,N.query=he,N.resourceName=void 0}return N.fragment=void 0,N}},gi={scheme:"wss",domainHost:Sr.domainHost,parse:Sr.parse,serialize:Sr.serialize},Ei={},_i="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Tt="[0-9A-Fa-f]",pr=c(c("%[EFef]"+Tt+"%"+Tt+Tt+"%"+Tt+Tt)+"|"+c("%[89A-Fa-f]"+Tt+"%"+Tt+Tt)+"|"+c("%"+Tt+Tt)),hr="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",yi="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",nn=l(yi,'[\\"\\\\]'),ar="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Vi=new RegExp(_i,"g"),ii=new RegExp(pr,"g"),ss=new RegExp(l("[^]",hr,"[\\.]",'[\\"]',nn),"g"),ui=new RegExp(l("[^]",_i,ar),"g"),Oi=ui;function Lr(Ce){var N=Xe(Ce);return N.match(Vi)?N:Ce}var Un={scheme:"mailto",parse:function(N,z){var U=N,q=U.to=U.path?U.path.split(","):[];if(U.path=void 0,U.query){for(var Q=!1,he={},Se=U.query.split("&"),Ee=0,ve=Se.length;Eenew RegExp(et,oe);A.code="new RegExp";const P=["removeAdditional","useDefaults","coerceTypes"],T=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),L={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},D={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},B=200;function $(et){var oe,ge,Me,ee,ue,Je,wt,pt,Xe,Bt,Qt,Rr,Vr,H,ut,tt,be,pe,Ie,dt,mt,je,vt,Ot,St;const Wt=et.strict,wr=(oe=et.code)===null||oe===void 0?void 0:oe.optimize,Fe=wr===!0||wr===void 0?1:wr||0,gt=(Me=(ge=et.code)===null||ge===void 0?void 0:ge.regExp)!==null&&Me!==void 0?Me:A,mi=(ee=et.uriResolver)!==null&&ee!==void 0?ee:k.default;return{strictSchema:(Je=(ue=et.strictSchema)!==null&&ue!==void 0?ue:Wt)!==null&&Je!==void 0?Je:!0,strictNumbers:(pt=(wt=et.strictNumbers)!==null&&wt!==void 0?wt:Wt)!==null&&pt!==void 0?pt:!0,strictTypes:(Bt=(Xe=et.strictTypes)!==null&&Xe!==void 0?Xe:Wt)!==null&&Bt!==void 0?Bt:"log",strictTuples:(Rr=(Qt=et.strictTuples)!==null&&Qt!==void 0?Qt:Wt)!==null&&Rr!==void 0?Rr:"log",strictRequired:(H=(Vr=et.strictRequired)!==null&&Vr!==void 0?Vr:Wt)!==null&&H!==void 0?H:!1,code:et.code?{...et.code,optimize:Fe,regExp:gt}:{optimize:Fe,regExp:gt},loopRequired:(ut=et.loopRequired)!==null&&ut!==void 0?ut:B,loopEnum:(tt=et.loopEnum)!==null&&tt!==void 0?tt:B,meta:(be=et.meta)!==null&&be!==void 0?be:!0,messages:(pe=et.messages)!==null&&pe!==void 0?pe:!0,inlineRefs:(Ie=et.inlineRefs)!==null&&Ie!==void 0?Ie:!0,schemaId:(dt=et.schemaId)!==null&&dt!==void 0?dt:"$id",addUsedSchema:(mt=et.addUsedSchema)!==null&&mt!==void 0?mt:!0,validateSchema:(je=et.validateSchema)!==null&&je!==void 0?je:!0,validateFormats:(vt=et.validateFormats)!==null&&vt!==void 0?vt:!0,unicodeRegExp:(Ot=et.unicodeRegExp)!==null&&Ot!==void 0?Ot:!0,int32range:(St=et.int32range)!==null&&St!==void 0?St:!0,uriResolver:mi}}class J{constructor(oe={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,oe=this.opts={...oe,...$(oe)};const{es5:ge,lines:Me}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:T,es5:ge,lines:Me}),this.logger=le(oe.logger);const ee=oe.validateFormats;oe.validateFormats=!1,this.RULES=(0,f.getRules)(),Y.call(this,L,oe,"NOT SUPPORTED"),Y.call(this,D,oe,"DEPRECATED","warn"),this._metaOpts=Ae.call(this),oe.formats&&ce.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),oe.keywords&&ye.call(this,oe.keywords),typeof oe.meta=="object"&&this.addMetaSchema(oe.meta),re.call(this),oe.validateFormats=ee}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:oe,meta:ge,schemaId:Me}=this.opts;let ee=S;Me==="id"&&(ee={...S},ee.id=ee.$id,delete ee.$id),ge&&oe&&this.addMetaSchema(ee,ee[Me],!1)}defaultMeta(){const{meta:oe,schemaId:ge}=this.opts;return this.opts.defaultMeta=typeof oe=="object"?oe[ge]||oe:void 0}validate(oe,ge){let Me;if(typeof oe=="string"){if(Me=this.getSchema(oe),!Me)throw new Error(`no schema with key or ref "${oe}"`)}else Me=this.compile(oe);const ee=Me(ge);return"$async"in Me||(this.errors=Me.errors),ee}compile(oe,ge){const Me=this._addSchema(oe,ge);return Me.validate||this._compileSchemaEnv(Me)}compileAsync(oe,ge){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:Me}=this.opts;return ee.call(this,oe,ge);async function ee(Bt,Qt){await ue.call(this,Bt.$schema);const Rr=this._addSchema(Bt,Qt);return Rr.validate||Je.call(this,Rr)}async function ue(Bt){Bt&&!this.getSchema(Bt)&&await ee.call(this,{$ref:Bt},!0)}async function Je(Bt){try{return this._compileSchemaEnv(Bt)}catch(Qt){if(!(Qt instanceof c.default))throw Qt;return wt.call(this,Qt),await pt.call(this,Qt.missingSchema),Je.call(this,Bt)}}function wt({missingSchema:Bt,missingRef:Qt}){if(this.refs[Bt])throw new Error(`AnySchema ${Bt} is loaded but ${Qt} cannot be resolved`)}async function pt(Bt){const Qt=await Xe.call(this,Bt);this.refs[Bt]||await ue.call(this,Qt.$schema),this.refs[Bt]||this.addSchema(Qt,Bt,ge)}async function Xe(Bt){const Qt=this._loading[Bt];if(Qt)return Qt;try{return await(this._loading[Bt]=Me(Bt))}finally{delete this._loading[Bt]}}}addSchema(oe,ge,Me,ee=this.opts.validateSchema){if(Array.isArray(oe)){for(const Je of oe)this.addSchema(Je,void 0,Me,ee);return this}let ue;if(typeof oe=="object"){const{schemaId:Je}=this.opts;if(ue=oe[Je],ue!==void 0&&typeof ue!="string")throw new Error(`schema ${Je} must be string`)}return ge=(0,m.normalizeId)(ge||ue),this._checkUnique(ge),this.schemas[ge]=this._addSchema(oe,Me,ge,ee,!0),this}addMetaSchema(oe,ge,Me=this.opts.validateSchema){return this.addSchema(oe,ge,!0,Me),this}validateSchema(oe,ge){if(typeof oe=="boolean")return!0;let Me;if(Me=oe.$schema,Me!==void 0&&typeof Me!="string")throw new Error("$schema must be a string");if(Me=Me||this.opts.defaultMeta||this.defaultMeta(),!Me)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const ee=this.validate(Me,oe);if(!ee&&ge){const ue="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(ue);else throw new Error(ue)}return ee}getSchema(oe){let ge;for(;typeof(ge=se.call(this,oe))=="string";)oe=ge;if(ge===void 0){const{schemaId:Me}=this.opts,ee=new d.SchemaEnv({schema:{},schemaId:Me});if(ge=d.resolveSchema.call(this,ee,oe),!ge)return;this.refs[oe]=ge}return ge.validate||this._compileSchemaEnv(ge)}removeSchema(oe){if(oe instanceof RegExp)return this._removeAllSchemas(this.schemas,oe),this._removeAllSchemas(this.refs,oe),this;switch(typeof oe){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const ge=se.call(this,oe);return typeof ge=="object"&&this._cache.delete(ge.schema),delete this.schemas[oe],delete this.refs[oe],this}case"object":{const ge=oe;this._cache.delete(ge);let Me=oe[this.opts.schemaId];return Me&&(Me=(0,m.normalizeId)(Me),delete this.schemas[Me],delete this.refs[Me]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(oe){for(const ge of oe)this.addKeyword(ge);return this}addKeyword(oe,ge){let Me;if(typeof oe=="string")Me=oe,typeof ge=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),ge.keyword=Me);else if(typeof oe=="object"&&ge===void 0){if(ge=oe,Me=ge.keyword,Array.isArray(Me)&&!Me.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Z.call(this,Me,ge),!ge)return(0,w.eachItem)(Me,ue=>$e.call(this,ue)),this;rt.call(this,ge);const ee={...ge,type:(0,b.getJSONTypes)(ge.type),schemaType:(0,b.getJSONTypes)(ge.schemaType)};return(0,w.eachItem)(Me,ee.type.length===0?ue=>$e.call(this,ue,ee):ue=>ee.type.forEach(Je=>$e.call(this,ue,ee,Je))),this}getKeyword(oe){const ge=this.RULES.all[oe];return typeof ge=="object"?ge.definition:!!ge}removeKeyword(oe){const{RULES:ge}=this;delete ge.keywords[oe],delete ge.all[oe];for(const Me of ge.rules){const ee=Me.rules.findIndex(ue=>ue.keyword===oe);ee>=0&&Me.rules.splice(ee,1)}return this}addFormat(oe,ge){return typeof ge=="string"&&(ge=new RegExp(ge)),this.formats[oe]=ge,this}errorsText(oe=this.errors,{separator:ge=", ",dataVar:Me="data"}={}){return!oe||oe.length===0?"No errors":oe.map(ee=>`${Me}${ee.instancePath} ${ee.message}`).reduce((ee,ue)=>ee+ge+ue)}$dataMetaSchema(oe,ge){const Me=this.RULES.all;oe=JSON.parse(JSON.stringify(oe));for(const ee of ge){const ue=ee.split("/").slice(1);let Je=oe;for(const wt of ue)Je=Je[wt];for(const wt in Me){const pt=Me[wt];if(typeof pt!="object")continue;const{$data:Xe}=pt.definition,Bt=Je[wt];Xe&&Bt&&(Je[wt]=it(Bt))}}return oe}_removeAllSchemas(oe,ge){for(const Me in oe){const ee=oe[Me];(!ge||ge.test(Me))&&(typeof ee=="string"?delete oe[Me]:ee&&!ee.meta&&(this._cache.delete(ee.schema),delete oe[Me]))}}_addSchema(oe,ge,Me,ee=this.opts.validateSchema,ue=this.opts.addUsedSchema){let Je;const{schemaId:wt}=this.opts;if(typeof oe=="object")Je=oe[wt];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof oe!="boolean")throw new Error("schema must be object or boolean")}let pt=this._cache.get(oe);if(pt!==void 0)return pt;Me=(0,m.normalizeId)(Je||Me);const Xe=m.getSchemaRefs.call(this,oe,Me);return pt=new d.SchemaEnv({schema:oe,schemaId:wt,meta:ge,baseId:Me,localRefs:Xe}),this._cache.set(pt.schema,pt),ue&&!Me.startsWith("#")&&(Me&&this._checkUnique(Me),this.refs[Me]=pt),ee&&this.validateSchema(oe,!0),pt}_checkUnique(oe){if(this.schemas[oe]||this.refs[oe])throw new Error(`schema with key or id "${oe}" already exists`)}_compileSchemaEnv(oe){if(oe.meta?this._compileMetaSchema(oe):d.compileSchema.call(this,oe),!oe.validate)throw new Error("ajv implementation error");return oe.validate}_compileMetaSchema(oe){const ge=this.opts;this.opts=this._metaOpts;try{d.compileSchema.call(this,oe)}finally{this.opts=ge}}}o.default=J,J.ValidationError=l.default,J.MissingRefError=c.default;function Y(et,oe,ge,Me="error"){for(const ee in et){const ue=ee;ue in oe&&this.logger[Me](`${ge}: option ${ee}. ${et[ue]}`)}}function se(et){return et=(0,m.normalizeId)(et),this.schemas[et]||this.refs[et]}function re(){const et=this.opts.schemas;if(et)if(Array.isArray(et))this.addSchema(et);else for(const oe in et)this.addSchema(et[oe],oe)}function ce(){for(const et in this.opts.formats){const oe=this.opts.formats[et];oe&&this.addFormat(et,oe)}}function ye(et){if(Array.isArray(et)){this.addVocabulary(et);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const oe in et){const ge=et[oe];ge.keyword||(ge.keyword=oe),this.addKeyword(ge)}}function Ae(){const et={...this.opts};for(const oe of P)delete et[oe];return et}const _t={log(){},warn(){},error(){}};function le(et){if(et===!1)return _t;if(et===void 0)return console;if(et.log&&et.warn&&et.error)return et;throw new Error("logger must implement log, warn and error methods")}const We=/^[a-z_$][a-z0-9_$:-]*$/i;function Z(et,oe){const{RULES:ge}=this;if((0,w.eachItem)(et,Me=>{if(ge.keywords[Me])throw new Error(`Keyword ${Me} is already defined`);if(!We.test(Me))throw new Error(`Keyword ${Me} has invalid name`)}),!!oe&&oe.$data&&!("code"in oe||"validate"in oe))throw new Error('$data keyword must have "code" or "validate" function')}function $e(et,oe,ge){var Me;const ee=oe==null?void 0:oe.post;if(ge&&ee)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:ue}=this;let Je=ee?ue.post:ue.rules.find(({type:pt})=>pt===ge);if(Je||(Je={type:ge,rules:[]},ue.rules.push(Je)),ue.keywords[et]=!0,!oe)return;const wt={keyword:et,definition:{...oe,type:(0,b.getJSONTypes)(oe.type),schemaType:(0,b.getJSONTypes)(oe.schemaType)}};oe.before?ct.call(this,Je,wt,oe.before):Je.rules.push(wt),ue.all[et]=wt,(Me=oe.implements)===null||Me===void 0||Me.forEach(pt=>this.addKeyword(pt))}function ct(et,oe,ge){const Me=et.rules.findIndex(ee=>ee.keyword===ge);Me>=0?et.rules.splice(Me,0,oe):(et.rules.push(oe),this.logger.warn(`rule ${ge} is not defined`))}function rt(et){let{metaSchema:oe}=et;oe!==void 0&&(et.$data&&this.opts.$data&&(oe=it(oe)),et.validateSchema=this.compile(oe,!0))}const $t={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function it(et){return{anyOf:[et,$t]}}})(w_);var Rf={},Lf={},Bf={};Object.defineProperty(Bf,"__esModule",{value:!0});const ex={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Bf.default=ex;var Wa={};Object.defineProperty(Wa,"__esModule",{value:!0});Wa.callRef=Wa.getValidate=void 0;const tx=oc,bm=zr,xn=Mr,Co=xs,xm=wn,gu=Zr,rx={keyword:"$ref",schemaType:"string",code(o){const{gen:r,schema:s,it:l}=o,{baseId:c,schemaEnv:f,validateName:d,opts:n,self:m}=l,{root:b}=f;if((s==="#"||s==="#/")&&c===b.baseId)return S();const w=xm.resolveRef.call(m,b,c,s);if(w===void 0)throw new tx.default(l.opts.uriResolver,c,s);if(w instanceof xm.SchemaEnv)return k(w);return A(w);function S(){if(f===b)return Tu(o,d,f,f.$async);const P=r.scopeValue("root",{ref:b});return Tu(o,(0,xn._)`${P}.validate`,b,b.$async)}function k(P){const T=W_(o,P);Tu(o,T,P,P.$async)}function A(P){const T=r.scopeValue("schema",n.code.source===!0?{ref:P,code:(0,xn.stringify)(P)}:{ref:P}),L=r.name("valid"),D=o.subschema({schema:P,dataTypes:[],schemaPath:xn.nil,topSchemaRef:T,errSchemaPath:s},L);o.mergeEvaluated(D),o.ok(L)}}};function W_(o,r){const{gen:s}=o;return r.validate?s.scopeValue("validate",{ref:r.validate}):(0,xn._)`${s.scopeValue("wrapper",{ref:r})}.validate`}Wa.getValidate=W_;function Tu(o,r,s,l){const{gen:c,it:f}=o,{allErrors:d,schemaEnv:n,opts:m}=f,b=m.passContext?Co.default.this:xn.nil;l?w():S();function w(){if(!n.$async)throw new Error("async schema referenced by sync schema");const P=c.let("valid");c.try(()=>{c.code((0,xn._)`await ${(0,bm.callValidateCode)(o,r,b)}`),A(r),d||c.assign(P,!0)},T=>{c.if((0,xn._)`!(${T} instanceof ${f.ValidationError})`,()=>c.throw(T)),k(T),d||c.assign(P,!1)}),o.ok(P)}function S(){o.result((0,bm.callValidateCode)(o,r,b),()=>A(r),()=>k(r))}function k(P){const T=(0,xn._)`${P}.errors`;c.assign(Co.default.vErrors,(0,xn._)`${Co.default.vErrors} === null ? ${T} : ${Co.default.vErrors}.concat(${T})`),c.assign(Co.default.errors,(0,xn._)`${Co.default.vErrors}.length`)}function A(P){var T;if(!f.opts.unevaluated)return;const L=(T=s==null?void 0:s.validate)===null||T===void 0?void 0:T.evaluated;if(f.props!==!0)if(L&&!L.dynamicProps)L.props!==void 0&&(f.props=gu.mergeEvaluated.props(c,L.props,f.props));else{const D=c.var("props",(0,xn._)`${P}.evaluated.props`);f.props=gu.mergeEvaluated.props(c,D,f.props,xn.Name)}if(f.items!==!0)if(L&&!L.dynamicItems)L.items!==void 0&&(f.items=gu.mergeEvaluated.items(c,L.items,f.items));else{const D=c.var("items",(0,xn._)`${P}.evaluated.items`);f.items=gu.mergeEvaluated.items(c,D,f.items,xn.Name)}}}Wa.callRef=Tu;Wa.default=rx;Object.defineProperty(Lf,"__esModule",{value:!0});const ix=Bf,nx=Wa,sx=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",ix.default,nx.default];Lf.default=sx;var Of={},Ff={};Object.defineProperty(Ff,"__esModule",{value:!0});const Du=Mr,na=Du.operators,Ru={maximum:{okStr:"<=",ok:na.LTE,fail:na.GT},minimum:{okStr:">=",ok:na.GTE,fail:na.LT},exclusiveMaximum:{okStr:"<",ok:na.LT,fail:na.GTE},exclusiveMinimum:{okStr:">",ok:na.GT,fail:na.LTE}},ax={message:({keyword:o,schemaCode:r})=>(0,Du.str)`must be ${Ru[o].okStr} ${r}`,params:({keyword:o,schemaCode:r})=>(0,Du._)`{comparison: ${Ru[o].okStr}, limit: ${r}}`},ox={keyword:Object.keys(Ru),type:"number",schemaType:"number",$data:!0,error:ax,code(o){const{keyword:r,data:s,schemaCode:l}=o;o.fail$data((0,Du._)`${s} ${Ru[r].fail} ${l} || isNaN(${s})`)}};Ff.default=ox;var Nf={};Object.defineProperty(Nf,"__esModule",{value:!0});const Kl=Mr,lx={message:({schemaCode:o})=>(0,Kl.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,Kl._)`{multipleOf: ${o}}`},cx={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:lx,code(o){const{gen:r,data:s,schemaCode:l,it:c}=o,f=c.opts.multipleOfPrecision,d=r.let("res"),n=f?(0,Kl._)`Math.abs(Math.round(${d}) - ${d}) > 1e-${f}`:(0,Kl._)`${d} !== parseInt(${d})`;o.fail$data((0,Kl._)`(${l} === 0 || (${d} = ${s}/${l}, ${n}))`)}};Nf.default=cx;var Uf={},Vf={};Object.defineProperty(Vf,"__esModule",{value:!0});function K_(o){const r=o.length;let s=0,l=0,c;for(;l=55296&&c<=56319&&l(0,$a._)`{limit: ${o}}`},dx={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:fx,code(o){const{keyword:r,data:s,schemaCode:l,it:c}=o,f=r==="maxLength"?$a.operators.GT:$a.operators.LT,d=c.opts.unicode===!1?(0,$a._)`${s}.length`:(0,$a._)`${(0,ux.useFunc)(o.gen,hx.default)}(${s})`;o.fail$data((0,$a._)`${d} ${f} ${l}`)}};Uf.default=dx;var $f={};Object.defineProperty($f,"__esModule",{value:!0});const px=zr,Lu=Mr,mx={message:({schemaCode:o})=>(0,Lu.str)`must match pattern "${o}"`,params:({schemaCode:o})=>(0,Lu._)`{pattern: ${o}}`},gx={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:mx,code(o){const{data:r,$data:s,schema:l,schemaCode:c,it:f}=o,d=f.opts.unicodeRegExp?"u":"",n=s?(0,Lu._)`(new RegExp(${c}, ${d}))`:(0,px.usePattern)(o,l);o.fail$data((0,Lu._)`!${n}.test(${r})`)}};$f.default=gx;var jf={};Object.defineProperty(jf,"__esModule",{value:!0});const Xl=Mr,_x={message({keyword:o,schemaCode:r}){const s=o==="maxProperties"?"more":"fewer";return(0,Xl.str)`must NOT have ${s} than ${r} properties`},params:({schemaCode:o})=>(0,Xl._)`{limit: ${o}}`},yx={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:_x,code(o){const{keyword:r,data:s,schemaCode:l}=o,c=r==="maxProperties"?Xl.operators.GT:Xl.operators.LT;o.fail$data((0,Xl._)`Object.keys(${s}).length ${c} ${l}`)}};jf.default=yx;var qf={};Object.defineProperty(qf,"__esModule",{value:!0});const $l=zr,Jl=Mr,vx=Zr,bx={message:({params:{missingProperty:o}})=>(0,Jl.str)`must have required property '${o}'`,params:({params:{missingProperty:o}})=>(0,Jl._)`{missingProperty: ${o}}`},xx={keyword:"required",type:"object",schemaType:"array",$data:!0,error:bx,code(o){const{gen:r,schema:s,schemaCode:l,data:c,$data:f,it:d}=o,{opts:n}=d;if(!f&&s.length===0)return;const m=s.length>=n.loopRequired;if(d.allErrors?b():w(),n.strictRequired){const A=o.parentSchema.properties,{definedProperties:P}=o.it;for(const T of s)if((A==null?void 0:A[T])===void 0&&!P.has(T)){const L=d.schemaEnv.baseId+d.errSchemaPath,D=`required property "${T}" is not defined at "${L}" (strictRequired)`;(0,vx.checkStrictMode)(d,D,d.opts.strictRequired)}}function b(){if(m||f)o.block$data(Jl.nil,S);else for(const A of s)(0,$l.checkReportMissingProp)(o,A)}function w(){const A=r.let("missing");if(m||f){const P=r.let("valid",!0);o.block$data(P,()=>k(A,P)),o.ok(P)}else r.if((0,$l.checkMissingProp)(o,s,A)),(0,$l.reportMissingProp)(o,A),r.else()}function S(){r.forOf("prop",l,A=>{o.setParams({missingProperty:A}),r.if((0,$l.noPropertyInData)(r,c,A,n.ownProperties),()=>o.error())})}function k(A,P){o.setParams({missingProperty:A}),r.forOf(A,l,()=>{r.assign(P,(0,$l.propertyInData)(r,c,A,n.ownProperties)),r.if((0,Jl.not)(P),()=>{o.error(),r.break()})},Jl.nil)}}};qf.default=xx;var Gf={};Object.defineProperty(Gf,"__esModule",{value:!0});const Yl=Mr,wx={message({keyword:o,schemaCode:r}){const s=o==="maxItems"?"more":"fewer";return(0,Yl.str)`must NOT have ${s} than ${r} items`},params:({schemaCode:o})=>(0,Yl._)`{limit: ${o}}`},Ex={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:wx,code(o){const{keyword:r,data:s,schemaCode:l}=o,c=r==="maxItems"?Yl.operators.GT:Yl.operators.LT;o.fail$data((0,Yl._)`${s}.length ${c} ${l}`)}};Gf.default=Ex;var Zf={},lc={};Object.defineProperty(lc,"__esModule",{value:!0});const X_=P_;X_.code='require("ajv/dist/runtime/equal").default';lc.default=X_;Object.defineProperty(Zf,"__esModule",{value:!0});const sf=sc,Ki=Mr,kx=Zr,Sx=lc,Tx={message:({params:{i:o,j:r}})=>(0,Ki.str)`must NOT have duplicate items (items ## ${r} and ${o} are identical)`,params:({params:{i:o,j:r}})=>(0,Ki._)`{i: ${o}, j: ${r}}`},Ix={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Tx,code(o){const{gen:r,data:s,$data:l,schema:c,parentSchema:f,schemaCode:d,it:n}=o;if(!l&&!c)return;const m=r.let("valid"),b=f.items?(0,sf.getSchemaTypes)(f.items):[];o.block$data(m,w,(0,Ki._)`${d} === false`),o.ok(m);function w(){const P=r.let("i",(0,Ki._)`${s}.length`),T=r.let("j");o.setParams({i:P,j:T}),r.assign(m,!0),r.if((0,Ki._)`${P} > 1`,()=>(S()?k:A)(P,T))}function S(){return b.length>0&&!b.some(P=>P==="object"||P==="array")}function k(P,T){const L=r.name("item"),D=(0,sf.checkDataTypes)(b,L,n.opts.strictNumbers,sf.DataType.Wrong),B=r.const("indices",(0,Ki._)`{}`);r.for((0,Ki._)`;${P}--;`,()=>{r.let(L,(0,Ki._)`${s}[${P}]`),r.if(D,(0,Ki._)`continue`),b.length>1&&r.if((0,Ki._)`typeof ${L} == "string"`,(0,Ki._)`${L} += "_"`),r.if((0,Ki._)`typeof ${B}[${L}] == "number"`,()=>{r.assign(T,(0,Ki._)`${B}[${L}]`),o.error(),r.assign(m,!1).break()}).code((0,Ki._)`${B}[${L}] = ${P}`)})}function A(P,T){const L=(0,kx.useFunc)(r,Sx.default),D=r.name("outer");r.label(D).for((0,Ki._)`;${P}--;`,()=>r.for((0,Ki._)`${T} = ${P}; ${T}--;`,()=>r.if((0,Ki._)`${L}(${s}[${P}], ${s}[${T}])`,()=>{o.error(),r.assign(m,!1).break(D)})))}}};Zf.default=Ix;var Hf={};Object.defineProperty(Hf,"__esModule",{value:!0});const _f=Mr,Cx=Zr,Ax=lc,Px={message:"must be equal to constant",params:({schemaCode:o})=>(0,_f._)`{allowedValue: ${o}}`},zx={keyword:"const",$data:!0,error:Px,code(o){const{gen:r,data:s,$data:l,schemaCode:c,schema:f}=o;l||f&&typeof f=="object"?o.fail$data((0,_f._)`!${(0,Cx.useFunc)(r,Ax.default)}(${s}, ${c})`):o.fail((0,_f._)`${f} !== ${s}`)}};Hf.default=zx;var Wf={};Object.defineProperty(Wf,"__esModule",{value:!0});const Zl=Mr,Mx=Zr,Dx=lc,Rx={message:"must be equal to one of the allowed values",params:({schemaCode:o})=>(0,Zl._)`{allowedValues: ${o}}`},Lx={keyword:"enum",schemaType:"array",$data:!0,error:Rx,code(o){const{gen:r,data:s,$data:l,schema:c,schemaCode:f,it:d}=o;if(!l&&c.length===0)throw new Error("enum must have non-empty array");const n=c.length>=d.opts.loopEnum;let m;const b=()=>m??(m=(0,Mx.useFunc)(r,Dx.default));let w;if(n||l)w=r.let("valid"),o.block$data(w,S);else{if(!Array.isArray(c))throw new Error("ajv implementation error");const A=r.const("vSchema",f);w=(0,Zl.or)(...c.map((P,T)=>k(A,T)))}o.pass(w);function S(){r.assign(w,!1),r.forOf("v",f,A=>r.if((0,Zl._)`${b()}(${s}, ${A})`,()=>r.assign(w,!0).break()))}function k(A,P){const T=c[P];return typeof T=="object"&&T!==null?(0,Zl._)`${b()}(${s}, ${A}[${P}])`:(0,Zl._)`${s} === ${T}`}}};Wf.default=Lx;Object.defineProperty(Of,"__esModule",{value:!0});const Bx=Ff,Ox=Nf,Fx=Uf,Nx=$f,Ux=jf,Vx=qf,$x=Gf,jx=Zf,qx=Hf,Gx=Wf,Zx=[Bx.default,Ox.default,Fx.default,Nx.default,Ux.default,Vx.default,$x.default,jx.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},qx.default,Gx.default];Of.default=Zx;var Kf={},qo={};Object.defineProperty(qo,"__esModule",{value:!0});qo.validateAdditionalItems=void 0;const ja=Mr,yf=Zr,Hx={message:({params:{len:o}})=>(0,ja.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,ja._)`{limit: ${o}}`},Wx={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Hx,code(o){const{parentSchema:r,it:s}=o,{items:l}=r;if(!Array.isArray(l)){(0,yf.checkStrictMode)(s,'"additionalItems" is ignored when "items" is not an array of schemas');return}J_(o,l)}};function J_(o,r){const{gen:s,schema:l,data:c,keyword:f,it:d}=o;d.items=!0;const n=s.const("len",(0,ja._)`${c}.length`);if(l===!1)o.setParams({len:r.length}),o.pass((0,ja._)`${n} <= ${r.length}`);else if(typeof l=="object"&&!(0,yf.alwaysValidSchema)(d,l)){const b=s.var("valid",(0,ja._)`${n} <= ${r.length}`);s.if((0,ja.not)(b),()=>m(b)),o.ok(b)}function m(b){s.forRange("i",r.length,n,w=>{o.subschema({keyword:f,dataProp:w,dataPropType:yf.Type.Num},b),d.allErrors||s.if((0,ja.not)(b),()=>s.break())})}}qo.validateAdditionalItems=J_;qo.default=Wx;var Xf={},Go={};Object.defineProperty(Go,"__esModule",{value:!0});Go.validateTuple=void 0;const wm=Mr,Iu=Zr,Kx=zr,Xx={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(o){const{schema:r,it:s}=o;if(Array.isArray(r))return Y_(o,"additionalItems",r);s.items=!0,!(0,Iu.alwaysValidSchema)(s,r)&&o.ok((0,Kx.validateArray)(o))}};function Y_(o,r,s=o.schema){const{gen:l,parentSchema:c,data:f,keyword:d,it:n}=o;w(c),n.opts.unevaluated&&s.length&&n.items!==!0&&(n.items=Iu.mergeEvaluated.items(l,s.length,n.items));const m=l.name("valid"),b=l.const("len",(0,wm._)`${f}.length`);s.forEach((S,k)=>{(0,Iu.alwaysValidSchema)(n,S)||(l.if((0,wm._)`${b} > ${k}`,()=>o.subschema({keyword:d,schemaProp:k,dataProp:k},m)),o.ok(m))});function w(S){const{opts:k,errSchemaPath:A}=n,P=s.length,T=P===S.minItems&&(P===S.maxItems||S[r]===!1);if(k.strictTuples&&!T){const L=`"${d}" is ${P}-tuple, but minItems or maxItems/${r} are not specified or different at path "${A}"`;(0,Iu.checkStrictMode)(n,L,k.strictTuples)}}}Go.validateTuple=Y_;Go.default=Xx;Object.defineProperty(Xf,"__esModule",{value:!0});const Jx=Go,Yx={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,Jx.validateTuple)(o,"items")};Xf.default=Yx;var Jf={};Object.defineProperty(Jf,"__esModule",{value:!0});const Em=Mr,Qx=Zr,ew=zr,tw=qo,rw={message:({params:{len:o}})=>(0,Em.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,Em._)`{limit: ${o}}`},iw={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:rw,code(o){const{schema:r,parentSchema:s,it:l}=o,{prefixItems:c}=s;l.items=!0,!(0,Qx.alwaysValidSchema)(l,r)&&(c?(0,tw.validateAdditionalItems)(o,c):o.ok((0,ew.validateArray)(o)))}};Jf.default=iw;var Yf={};Object.defineProperty(Yf,"__esModule",{value:!0});const Fn=Mr,_u=Zr,nw={message:({params:{min:o,max:r}})=>r===void 0?(0,Fn.str)`must contain at least ${o} valid item(s)`:(0,Fn.str)`must contain at least ${o} and no more than ${r} valid item(s)`,params:({params:{min:o,max:r}})=>r===void 0?(0,Fn._)`{minContains: ${o}}`:(0,Fn._)`{minContains: ${o}, maxContains: ${r}}`},sw={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:nw,code(o){const{gen:r,schema:s,parentSchema:l,data:c,it:f}=o;let d,n;const{minContains:m,maxContains:b}=l;f.opts.next?(d=m===void 0?1:m,n=b):d=1;const w=r.const("len",(0,Fn._)`${c}.length`);if(o.setParams({min:d,max:n}),n===void 0&&d===0){(0,_u.checkStrictMode)(f,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(n!==void 0&&d>n){(0,_u.checkStrictMode)(f,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,_u.alwaysValidSchema)(f,s)){let T=(0,Fn._)`${w} >= ${d}`;n!==void 0&&(T=(0,Fn._)`${T} && ${w} <= ${n}`),o.pass(T);return}f.items=!0;const S=r.name("valid");n===void 0&&d===1?A(S,()=>r.if(S,()=>r.break())):d===0?(r.let(S,!0),n!==void 0&&r.if((0,Fn._)`${c}.length > 0`,k)):(r.let(S,!1),k()),o.result(S,()=>o.reset());function k(){const T=r.name("_valid"),L=r.let("count",0);A(T,()=>r.if(T,()=>P(L)))}function A(T,L){r.forRange("i",0,w,D=>{o.subschema({keyword:"contains",dataProp:D,dataPropType:_u.Type.Num,compositeRule:!0},T),L()})}function P(T){r.code((0,Fn._)`${T}++`),n===void 0?r.if((0,Fn._)`${T} >= ${d}`,()=>r.assign(S,!0).break()):(r.if((0,Fn._)`${T} > ${n}`,()=>r.assign(S,!1).break()),d===1?r.assign(S,!0):r.if((0,Fn._)`${T} >= ${d}`,()=>r.assign(S,!0)))}}};Yf.default=sw;var Q_={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.validateSchemaDeps=o.validatePropertyDeps=o.error=void 0;const r=Mr,s=Zr,l=zr;o.error={message:({params:{property:m,depsCount:b,deps:w}})=>{const S=b===1?"property":"properties";return(0,r.str)`must have ${S} ${w} when property ${m} is present`},params:({params:{property:m,depsCount:b,deps:w,missingProperty:S}})=>(0,r._)`{property: ${m}, +`}];function _v(o){let r=0;for(const a of o)r+=a in Qh?Qh[a]:Qh.AVERAGE;return r}const Qh={0:8.9,1:8.9,2:8.9,3:8.9,4:8.9,5:8.9,6:8.9,7:8.9,8:8.9,9:8.9,a:8.9,b:8.9,c:8,d:8.9,e:8.9,f:4.43,g:8.9,h:8.9,i:3.57,j:3.57,k:8,l:3.57,m:13.33,n:8.9,o:8.9,p:8.9,q:8.9,r:5.33,s:8,t:4.43,u:8.9,v:8,w:11.57,x:8,y:8,z:8,A:10.67,B:10.67,C:11.57,D:11.57,E:10.67,F:9.77,G:12.43,H:11.57,I:4.43,J:8,K:10.67,L:8.9,M:13.33,N:11.57,O:12.43,P:10.67,Q:12.43,R:11.57,S:10.67,T:9.77,U:11.57,V:10.67,W:15.1,X:10.67,Y:10.67,Z:9.77," ":4.43,"!":4.43,'"':5.67,"#":8.9,$:8.9,"%":14.23,"&":10.67,"'":3.07,"(":5.33,")":5.33,"*":6.23,"+":9.33,",":4.43,"-":5.33,".":4.43,"/":4.43,":":4.43,";":4.43,"<":9.33,"=":9.33,">":9.33,"?":8.9,"@":16.23,"[":4.43,"]":4.43,"^":7.5,_:8.9,"`":5.33,"{":5.33,"|":4.17,"}":5.33,"~":9.33,AVERAGE:8.472},yv={$id:"https://github.com/jtrim-ons/accessible-spreadsheet-creator",title:"Accessible Spreadsheet Creator",description:"A description of an accessible spreadsheet",type:"object",properties:{coverSheetTitle:{type:"string",title:"Cover sheet title",description:"The title displayed in cell A1 of the workbook.",minLength:1},coverSheetContents:{type:"array",title:"Cover sheet contents",description:"The lines below the cover sheet title. Each can be a subtitle starting with '## ', a link in Markdown style, or just text.",items:{type:"string"}},notes:{type:"array",title:"Notes",description:"The notes, each with a name that can be referred to in double square brackets and text.",items:{type:"object",title:"Note",properties:{name:{type:"string",title:"Note name",description:"A note name (e.g. note1) that can be referred to in a sheet using double square brackets (e.g. [[note1]])."},text:{type:"string",title:"Note text",description:"The text that will appear on the Notes page."}}}},sheets:{type:"array",title:"Sheets",description:"The data an metadata for the worksheets other than cover, contents and notes sheets.",items:{type:"object",title:"Sheet",properties:{sheetName:{type:"string",minLength:1,title:"Sheet name",description:"The name to appear in cell A1"},tableName:{type:"string",minLength:1,title:"Table name",description:"The name to give to the data table",pattern:"^[A-Za-z0-9_]*$"},sheetIntroText:{type:"array",title:"Sheet intro text",description:"Introductory text to appear below cell A2",items:{type:"string"}},columns:{type:"array",title:"Data columns",items:{type:"object",title:"Data column",description:"A column with its heading, number/text style and data.",properties:{style:{type:"string",title:"Number/text style",description:"'text'=text column; 'number_with_commas': integers with thousand separator; 'number_1dp': numbers to 1 decimal place"},heading:{type:"string",title:"Column heading",description:"Table column heading. May contain notes in double square brackets."},values:{type:"array",title:"Column values",description:"An array of text or numeric values",anyOf:[{items:{type:"number"}},{items:{type:"string"}}]}},required:["style","heading","values"]}}},required:["sheetName","tableName","columns"]}}},required:["coverSheetTitle","coverSheetContents","sheets"]};var ff={exports:{}},b_={},na={},Uo={},ic={},Mr={},Ql={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.regexpCode=o.getEsmExportName=o.getProperty=o.safeStringify=o.stringify=o.strConcat=o.addCodeArg=o.str=o._=o.nil=o._Code=o.Name=o.IDENTIFIER=o._CodeOrName=void 0;class r{}o._CodeOrName=r,o.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class a extends r{constructor(B){if(super(),!o.IDENTIFIER.test(B))throw new Error("CodeGen: name must be a valid identifier");this.str=B}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}o.Name=a;class l extends r{constructor(B){super(),this._items=typeof B=="string"?[B]:B}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const B=this._items[0];return B===""||B==='""'}get str(){var B;return(B=this._str)!==null&&B!==void 0?B:this._str=this._items.reduce(($,J)=>`${$}${J}`,"")}get names(){var B;return(B=this._names)!==null&&B!==void 0?B:this._names=this._items.reduce(($,J)=>(J instanceof a&&($[J.str]=($[J.str]||0)+1),$),{})}}o._Code=l,o.nil=new l("");function c(D,...B){const $=[D[0]];let J=0;for(;J{if(S.scopePath===void 0)throw new Error(`CodeGen: name "${S}" has no value`);return(0,r._)`${b}${S.scopePath}`})}scopeCode(b=this._values,w,S){return this._reduceValues(b,k=>{if(k.value===void 0)throw new Error(`CodeGen: name "${k}" has no value`);return k.value.code},w,S)}_reduceValues(b,w,S={},k){let A=r.nil;for(const P in b){const T=b[P];if(!T)continue;const L=S[P]=S[P]||new Map;T.forEach(D=>{if(L.has(D))return;L.set(D,l.Started);let B=w(D);if(B){const $=this.opts.es5?o.varKinds.var:o.varKinds.const;A=(0,r._)`${A}${$} ${D} = ${B};${this.opts._n}`}else if(B=k==null?void 0:k(D))A=(0,r._)`${A}${B}${this.opts._n}`;else throw new a(D);L.set(D,l.Completed)})}return A}}o.ValueScope=n})(df);(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.or=o.and=o.not=o.CodeGen=o.operators=o.varKinds=o.ValueScopeName=o.ValueScope=o.Scope=o.Name=o.regexpCode=o.stringify=o.getProperty=o.nil=o.strConcat=o.str=o._=void 0;const r=Ql,a=df;var l=Ql;Object.defineProperty(o,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(o,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(o,"strConcat",{enumerable:!0,get:function(){return l.strConcat}}),Object.defineProperty(o,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(o,"getProperty",{enumerable:!0,get:function(){return l.getProperty}}),Object.defineProperty(o,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(o,"regexpCode",{enumerable:!0,get:function(){return l.regexpCode}}),Object.defineProperty(o,"Name",{enumerable:!0,get:function(){return l.Name}});var c=df;Object.defineProperty(o,"Scope",{enumerable:!0,get:function(){return c.Scope}}),Object.defineProperty(o,"ValueScope",{enumerable:!0,get:function(){return c.ValueScope}}),Object.defineProperty(o,"ValueScopeName",{enumerable:!0,get:function(){return c.ValueScopeName}}),Object.defineProperty(o,"varKinds",{enumerable:!0,get:function(){return c.varKinds}}),o.operators={GT:new r._Code(">"),GTE:new r._Code(">="),LT:new r._Code("<"),LTE:new r._Code("<="),EQ:new r._Code("==="),NEQ:new r._Code("!=="),NOT:new r._Code("!"),OR:new r._Code("||"),AND:new r._Code("&&"),ADD:new r._Code("+")};class f{optimizeNodes(){return this}optimizeNames(ee,ue){return this}}class d extends f{constructor(ee,ue,Je){super(),this.varKind=ee,this.name=ue,this.rhs=Je}render({es5:ee,_n:ue}){const Je=ee?a.varKinds.var:this.varKind,wt=this.rhs===void 0?"":` = ${this.rhs}`;return`${Je} ${this.name}${wt};`+ue}optimizeNames(ee,ue){if(ee[this.name.str])return this.rhs&&(this.rhs=Z(this.rhs,ee,ue)),this}get names(){return this.rhs instanceof r._CodeOrName?this.rhs.names:{}}}class n extends f{constructor(ee,ue,Je){super(),this.lhs=ee,this.rhs=ue,this.sideEffects=Je}render({_n:ee}){return`${this.lhs} = ${this.rhs};`+ee}optimizeNames(ee,ue){if(!(this.lhs instanceof r.Name&&!ee[this.lhs.str]&&!this.sideEffects))return this.rhs=Z(this.rhs,ee,ue),this}get names(){const ee=this.lhs instanceof r.Name?{}:{...this.lhs.names};return We(ee,this.rhs)}}class m extends n{constructor(ee,ue,Je,wt){super(ee,Je,wt),this.op=ue}render({_n:ee}){return`${this.lhs} ${this.op}= ${this.rhs};`+ee}}class b extends f{constructor(ee){super(),this.label=ee,this.names={}}render({_n:ee}){return`${this.label}:`+ee}}class w extends f{constructor(ee){super(),this.label=ee,this.names={}}render({_n:ee}){return`break${this.label?` ${this.label}`:""};`+ee}}class S extends f{constructor(ee){super(),this.error=ee}render({_n:ee}){return`throw ${this.error};`+ee}get names(){return this.error.names}}class k extends f{constructor(ee){super(),this.code=ee}render({_n:ee}){return`${this.code};`+ee}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(ee,ue){return this.code=Z(this.code,ee,ue),this}get names(){return this.code instanceof r._CodeOrName?this.code.names:{}}}class A extends f{constructor(ee=[]){super(),this.nodes=ee}render(ee){return this.nodes.reduce((ue,Je)=>ue+Je.render(ee),"")}optimizeNodes(){const{nodes:ee}=this;let ue=ee.length;for(;ue--;){const Je=ee[ue].optimizeNodes();Array.isArray(Je)?ee.splice(ue,1,...Je):Je?ee[ue]=Je:ee.splice(ue,1)}return ee.length>0?this:void 0}optimizeNames(ee,ue){const{nodes:Je}=this;let wt=Je.length;for(;wt--;){const pt=Je[wt];pt.optimizeNames(ee,ue)||($e(ee,pt.names),Je.splice(wt,1))}return Je.length>0?this:void 0}get names(){return this.nodes.reduce((ee,ue)=>le(ee,ue.names),{})}}class P extends A{render(ee){return"{"+ee._n+super.render(ee)+"}"+ee._n}}class T extends A{}class L extends P{}L.kind="else";class D extends P{constructor(ee,ue){super(ue),this.condition=ee}render(ee){let ue=`if(${this.condition})`+super.render(ee);return this.else&&(ue+="else "+this.else.render(ee)),ue}optimizeNodes(){super.optimizeNodes();const ee=this.condition;if(ee===!0)return this.nodes;let ue=this.else;if(ue){const Je=ue.optimizeNodes();ue=this.else=Array.isArray(Je)?new L(Je):Je}if(ue)return ee===!1?ue instanceof D?ue:ue.nodes:this.nodes.length?this:new D(ct(ee),ue instanceof D?[ue]:ue.nodes);if(!(ee===!1||!this.nodes.length))return this}optimizeNames(ee,ue){var Je;if(this.else=(Je=this.else)===null||Je===void 0?void 0:Je.optimizeNames(ee,ue),!!(super.optimizeNames(ee,ue)||this.else))return this.condition=Z(this.condition,ee,ue),this}get names(){const ee=super.names;return We(ee,this.condition),this.else&&le(ee,this.else.names),ee}}D.kind="if";class B extends P{}B.kind="for";class $ extends B{constructor(ee){super(),this.iteration=ee}render(ee){return`for(${this.iteration})`+super.render(ee)}optimizeNames(ee,ue){if(super.optimizeNames(ee,ue))return this.iteration=Z(this.iteration,ee,ue),this}get names(){return le(super.names,this.iteration.names)}}class J extends B{constructor(ee,ue,Je,wt){super(),this.varKind=ee,this.name=ue,this.from=Je,this.to=wt}render(ee){const ue=ee.es5?a.varKinds.var:this.varKind,{name:Je,from:wt,to:pt}=this;return`for(${ue} ${Je}=${wt}; ${Je}<${pt}; ${Je}++)`+super.render(ee)}get names(){const ee=We(super.names,this.from);return We(ee,this.to)}}class Y extends B{constructor(ee,ue,Je,wt){super(),this.loop=ee,this.varKind=ue,this.name=Je,this.iterable=wt}render(ee){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(ee)}optimizeNames(ee,ue){if(super.optimizeNames(ee,ue))return this.iterable=Z(this.iterable,ee,ue),this}get names(){return le(super.names,this.iterable.names)}}class ae extends P{constructor(ee,ue,Je){super(),this.name=ee,this.args=ue,this.async=Je}render(ee){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(ee)}}ae.kind="func";class re extends A{render(ee){return"return "+super.render(ee)}}re.kind="return";class ce extends P{render(ee){let ue="try"+super.render(ee);return this.catch&&(ue+=this.catch.render(ee)),this.finally&&(ue+=this.finally.render(ee)),ue}optimizeNodes(){var ee,ue;return super.optimizeNodes(),(ee=this.catch)===null||ee===void 0||ee.optimizeNodes(),(ue=this.finally)===null||ue===void 0||ue.optimizeNodes(),this}optimizeNames(ee,ue){var Je,wt;return super.optimizeNames(ee,ue),(Je=this.catch)===null||Je===void 0||Je.optimizeNames(ee,ue),(wt=this.finally)===null||wt===void 0||wt.optimizeNames(ee,ue),this}get names(){const ee=super.names;return this.catch&&le(ee,this.catch.names),this.finally&&le(ee,this.finally.names),ee}}class ye extends P{constructor(ee){super(),this.error=ee}render(ee){return`catch(${this.error})`+super.render(ee)}}ye.kind="catch";class Ae extends P{render(ee){return"finally"+super.render(ee)}}Ae.kind="finally";class _t{constructor(ee,ue={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...ue,_n:ue.lines?` +`:""},this._extScope=ee,this._scope=new a.Scope({parent:ee}),this._nodes=[new T]}toString(){return this._root.render(this.opts)}name(ee){return this._scope.name(ee)}scopeName(ee){return this._extScope.name(ee)}scopeValue(ee,ue){const Je=this._extScope.value(ee,ue);return(this._values[Je.prefix]||(this._values[Je.prefix]=new Set)).add(Je),Je}getScopeValue(ee,ue){return this._extScope.getValue(ee,ue)}scopeRefs(ee){return this._extScope.scopeRefs(ee,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(ee,ue,Je,wt){const pt=this._scope.toName(ue);return Je!==void 0&&wt&&(this._constants[pt.str]=Je),this._leafNode(new d(ee,pt,Je)),pt}const(ee,ue,Je){return this._def(a.varKinds.const,ee,ue,Je)}let(ee,ue,Je){return this._def(a.varKinds.let,ee,ue,Je)}var(ee,ue,Je){return this._def(a.varKinds.var,ee,ue,Je)}assign(ee,ue,Je){return this._leafNode(new n(ee,ue,Je))}add(ee,ue){return this._leafNode(new m(ee,o.operators.ADD,ue))}code(ee){return typeof ee=="function"?ee():ee!==r.nil&&this._leafNode(new k(ee)),this}object(...ee){const ue=["{"];for(const[Je,wt]of ee)ue.length>1&&ue.push(","),ue.push(Je),(Je!==wt||this.opts.es5)&&(ue.push(":"),(0,r.addCodeArg)(ue,wt));return ue.push("}"),new r._Code(ue)}if(ee,ue,Je){if(this._blockNode(new D(ee)),ue&&Je)this.code(ue).else().code(Je).endIf();else if(ue)this.code(ue).endIf();else if(Je)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(ee){return this._elseNode(new D(ee))}else(){return this._elseNode(new L)}endIf(){return this._endBlockNode(D,L)}_for(ee,ue){return this._blockNode(ee),ue&&this.code(ue).endFor(),this}for(ee,ue){return this._for(new $(ee),ue)}forRange(ee,ue,Je,wt,pt=this.opts.es5?a.varKinds.var:a.varKinds.let){const Xe=this._scope.toName(ee);return this._for(new J(pt,Xe,ue,Je),()=>wt(Xe))}forOf(ee,ue,Je,wt=a.varKinds.const){const pt=this._scope.toName(ee);if(this.opts.es5){const Xe=ue instanceof r.Name?ue:this.var("_arr",ue);return this.forRange("_i",0,(0,r._)`${Xe}.length`,Bt=>{this.var(pt,(0,r._)`${Xe}[${Bt}]`),Je(pt)})}return this._for(new Y("of",wt,pt,ue),()=>Je(pt))}forIn(ee,ue,Je,wt=this.opts.es5?a.varKinds.var:a.varKinds.const){if(this.opts.ownProperties)return this.forOf(ee,(0,r._)`Object.keys(${ue})`,Je);const pt=this._scope.toName(ee);return this._for(new Y("in",wt,pt,ue),()=>Je(pt))}endFor(){return this._endBlockNode(B)}label(ee){return this._leafNode(new b(ee))}break(ee){return this._leafNode(new w(ee))}return(ee){const ue=new re;if(this._blockNode(ue),this.code(ee),ue.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(re)}try(ee,ue,Je){if(!ue&&!Je)throw new Error('CodeGen: "try" without "catch" and "finally"');const wt=new ce;if(this._blockNode(wt),this.code(ee),ue){const pt=this.name("e");this._currNode=wt.catch=new ye(pt),ue(pt)}return Je&&(this._currNode=wt.finally=new Ae,this.code(Je)),this._endBlockNode(ye,Ae)}throw(ee){return this._leafNode(new S(ee))}block(ee,ue){return this._blockStarts.push(this._nodes.length),ee&&this.code(ee).endBlock(ue),this}endBlock(ee){const ue=this._blockStarts.pop();if(ue===void 0)throw new Error("CodeGen: not in self-balancing block");const Je=this._nodes.length-ue;if(Je<0||ee!==void 0&&Je!==ee)throw new Error(`CodeGen: wrong number of nodes: ${Je} vs ${ee} expected`);return this._nodes.length=ue,this}func(ee,ue=r.nil,Je,wt){return this._blockNode(new ae(ee,ue,Je)),wt&&this.code(wt).endFunc(),this}endFunc(){return this._endBlockNode(ae)}optimize(ee=1){for(;ee-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(ee){return this._currNode.nodes.push(ee),this}_blockNode(ee){this._currNode.nodes.push(ee),this._nodes.push(ee)}_endBlockNode(ee,ue){const Je=this._currNode;if(Je instanceof ee||ue&&Je instanceof ue)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${ue?`${ee.kind}/${ue.kind}`:ee.kind}"`)}_elseNode(ee){const ue=this._currNode;if(!(ue instanceof D))throw new Error('CodeGen: "else" without "if"');return this._currNode=ue.else=ee,this}get _root(){return this._nodes[0]}get _currNode(){const ee=this._nodes;return ee[ee.length-1]}set _currNode(ee){const ue=this._nodes;ue[ue.length-1]=ee}}o.CodeGen=_t;function le(Me,ee){for(const ue in ee)Me[ue]=(Me[ue]||0)+(ee[ue]||0);return Me}function We(Me,ee){return ee instanceof r._CodeOrName?le(Me,ee.names):Me}function Z(Me,ee,ue){if(Me instanceof r.Name)return Je(Me);if(!wt(Me))return Me;return new r._Code(Me._items.reduce((pt,Xe)=>(Xe instanceof r.Name&&(Xe=Je(Xe)),Xe instanceof r._Code?pt.push(...Xe._items):pt.push(Xe),pt),[]));function Je(pt){const Xe=ue[pt.str];return Xe===void 0||ee[pt.str]!==1?pt:(delete ee[pt.str],Xe)}function wt(pt){return pt instanceof r._Code&&pt._items.some(Xe=>Xe instanceof r.Name&&ee[Xe.str]===1&&ue[Xe.str]!==void 0)}}function $e(Me,ee){for(const ue in ee)Me[ue]=(Me[ue]||0)-(ee[ue]||0)}function ct(Me){return typeof Me=="boolean"||typeof Me=="number"||Me===null?!Me:(0,r._)`!${ge(Me)}`}o.not=ct;const rt=oe(o.operators.AND);function $t(...Me){return Me.reduce(rt)}o.and=$t;const it=oe(o.operators.OR);function et(...Me){return Me.reduce(it)}o.or=et;function oe(Me){return(ee,ue)=>ee===r.nil?ue:ue===r.nil?ee:(0,r._)`${ge(ee)} ${Me} ${ge(ue)}`}function ge(Me){return Me instanceof r.Name?Me:(0,r._)`(${Me})`}})(Mr);var Zr={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.checkStrictMode=o.getErrorPath=o.Type=o.useFunc=o.setEvaluated=o.evaluatedPropsToName=o.mergeEvaluated=o.eachItem=o.unescapeJsonPointer=o.escapeJsonPointer=o.escapeFragment=o.unescapeFragment=o.schemaRefOrVal=o.schemaHasRulesButRef=o.schemaHasRules=o.checkUnknownRules=o.alwaysValidSchema=o.toHash=void 0;const r=Mr,a=Ql;function l(ae){const re={};for(const ce of ae)re[ce]=!0;return re}o.toHash=l;function c(ae,re){return typeof re=="boolean"?re:Object.keys(re).length===0?!0:(f(ae,re),!d(re,ae.self.RULES.all))}o.alwaysValidSchema=c;function f(ae,re=ae.schema){const{opts:ce,self:ye}=ae;if(!ce.strictSchema||typeof re=="boolean")return;const Ae=ye.RULES.keywords;for(const _t in re)Ae[_t]||Y(ae,`unknown keyword: "${_t}"`)}o.checkUnknownRules=f;function d(ae,re){if(typeof ae=="boolean")return!ae;for(const ce in ae)if(re[ce])return!0;return!1}o.schemaHasRules=d;function n(ae,re){if(typeof ae=="boolean")return!ae;for(const ce in ae)if(ce!=="$ref"&&re.all[ce])return!0;return!1}o.schemaHasRulesButRef=n;function m({topSchemaRef:ae,schemaPath:re},ce,ye,Ae){if(!Ae){if(typeof ce=="number"||typeof ce=="boolean")return ce;if(typeof ce=="string")return(0,r._)`${ce}`}return(0,r._)`${ae}${re}${(0,r.getProperty)(ye)}`}o.schemaRefOrVal=m;function b(ae){return k(decodeURIComponent(ae))}o.unescapeFragment=b;function w(ae){return encodeURIComponent(S(ae))}o.escapeFragment=w;function S(ae){return typeof ae=="number"?`${ae}`:ae.replace(/~/g,"~0").replace(/\//g,"~1")}o.escapeJsonPointer=S;function k(ae){return ae.replace(/~1/g,"/").replace(/~0/g,"~")}o.unescapeJsonPointer=k;function A(ae,re){if(Array.isArray(ae))for(const ce of ae)re(ce);else re(ae)}o.eachItem=A;function P({mergeNames:ae,mergeToName:re,mergeValues:ce,resultToName:ye}){return(Ae,_t,le,We)=>{const Z=le===void 0?_t:le instanceof r.Name?(_t instanceof r.Name?ae(Ae,_t,le):re(Ae,_t,le),le):_t instanceof r.Name?(re(Ae,le,_t),_t):ce(_t,le);return We===r.Name&&!(Z instanceof r.Name)?ye(Ae,Z):Z}}o.mergeEvaluated={props:P({mergeNames:(ae,re,ce)=>ae.if((0,r._)`${ce} !== true && ${re} !== undefined`,()=>{ae.if((0,r._)`${re} === true`,()=>ae.assign(ce,!0),()=>ae.assign(ce,(0,r._)`${ce} || {}`).code((0,r._)`Object.assign(${ce}, ${re})`))}),mergeToName:(ae,re,ce)=>ae.if((0,r._)`${ce} !== true`,()=>{re===!0?ae.assign(ce,!0):(ae.assign(ce,(0,r._)`${ce} || {}`),L(ae,ce,re))}),mergeValues:(ae,re)=>ae===!0?!0:{...ae,...re},resultToName:T}),items:P({mergeNames:(ae,re,ce)=>ae.if((0,r._)`${ce} !== true && ${re} !== undefined`,()=>ae.assign(ce,(0,r._)`${re} === true ? true : ${ce} > ${re} ? ${ce} : ${re}`)),mergeToName:(ae,re,ce)=>ae.if((0,r._)`${ce} !== true`,()=>ae.assign(ce,re===!0?!0:(0,r._)`${ce} > ${re} ? ${ce} : ${re}`)),mergeValues:(ae,re)=>ae===!0?!0:Math.max(ae,re),resultToName:(ae,re)=>ae.var("items",re)})};function T(ae,re){if(re===!0)return ae.var("props",!0);const ce=ae.var("props",(0,r._)`{}`);return re!==void 0&&L(ae,ce,re),ce}o.evaluatedPropsToName=T;function L(ae,re,ce){Object.keys(ce).forEach(ye=>ae.assign((0,r._)`${re}${(0,r.getProperty)(ye)}`,!0))}o.setEvaluated=L;const D={};function B(ae,re){return ae.scopeValue("func",{ref:re,code:D[re.code]||(D[re.code]=new a._Code(re.code))})}o.useFunc=B;var $;(function(ae){ae[ae.Num=0]="Num",ae[ae.Str=1]="Str"})($=o.Type||(o.Type={}));function J(ae,re,ce){if(ae instanceof r.Name){const ye=re===$.Num;return ce?ye?(0,r._)`"[" + ${ae} + "]"`:(0,r._)`"['" + ${ae} + "']"`:ye?(0,r._)`"/" + ${ae}`:(0,r._)`"/" + ${ae}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return ce?(0,r.getProperty)(ae).toString():"/"+S(ae)}o.getErrorPath=J;function Y(ae,re,ce=ae.opts.strictSchema){if(ce){if(re=`strict mode: ${re}`,ce===!0)throw new Error(re);ae.self.logger.warn(re)}}o.checkStrictMode=Y})(Zr);var xa={};Object.defineProperty(xa,"__esModule",{value:!0});const rn=Mr,vv={data:new rn.Name("data"),valCxt:new rn.Name("valCxt"),instancePath:new rn.Name("instancePath"),parentData:new rn.Name("parentData"),parentDataProperty:new rn.Name("parentDataProperty"),rootData:new rn.Name("rootData"),dynamicAnchors:new rn.Name("dynamicAnchors"),vErrors:new rn.Name("vErrors"),errors:new rn.Name("errors"),this:new rn.Name("this"),self:new rn.Name("self"),scope:new rn.Name("scope"),json:new rn.Name("json"),jsonPos:new rn.Name("jsonPos"),jsonLen:new rn.Name("jsonLen"),jsonPart:new rn.Name("jsonPart")};xa.default=vv;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.extendErrors=o.resetErrorsCount=o.reportExtraError=o.reportError=o.keyword$DataError=o.keywordError=void 0;const r=Mr,a=Zr,l=xa;o.keywordError={message:({keyword:L})=>(0,r.str)`must pass "${L}" keyword validation`},o.keyword$DataError={message:({keyword:L,schemaType:D})=>D?(0,r.str)`"${L}" keyword must be ${D} ($data)`:(0,r.str)`"${L}" keyword is invalid ($data)`};function c(L,D=o.keywordError,B,$){const{it:J}=L,{gen:Y,compositeRule:ae,allErrors:re}=J,ce=S(L,D,B);$??(ae||re)?m(Y,ce):b(J,(0,r._)`[${ce}]`)}o.reportError=c;function f(L,D=o.keywordError,B){const{it:$}=L,{gen:J,compositeRule:Y,allErrors:ae}=$,re=S(L,D,B);m(J,re),Y||ae||b($,l.default.vErrors)}o.reportExtraError=f;function d(L,D){L.assign(l.default.errors,D),L.if((0,r._)`${l.default.vErrors} !== null`,()=>L.if(D,()=>L.assign((0,r._)`${l.default.vErrors}.length`,D),()=>L.assign(l.default.vErrors,null)))}o.resetErrorsCount=d;function n({gen:L,keyword:D,schemaValue:B,data:$,errsCount:J,it:Y}){if(J===void 0)throw new Error("ajv implementation error");const ae=L.name("err");L.forRange("i",J,l.default.errors,re=>{L.const(ae,(0,r._)`${l.default.vErrors}[${re}]`),L.if((0,r._)`${ae}.instancePath === undefined`,()=>L.assign((0,r._)`${ae}.instancePath`,(0,r.strConcat)(l.default.instancePath,Y.errorPath))),L.assign((0,r._)`${ae}.schemaPath`,(0,r.str)`${Y.errSchemaPath}/${D}`),Y.opts.verbose&&(L.assign((0,r._)`${ae}.schema`,B),L.assign((0,r._)`${ae}.data`,$))})}o.extendErrors=n;function m(L,D){const B=L.const("err",D);L.if((0,r._)`${l.default.vErrors} === null`,()=>L.assign(l.default.vErrors,(0,r._)`[${B}]`),(0,r._)`${l.default.vErrors}.push(${B})`),L.code((0,r._)`${l.default.errors}++`)}function b(L,D){const{gen:B,validateName:$,schemaEnv:J}=L;J.$async?B.throw((0,r._)`new ${L.ValidationError}(${D})`):(B.assign((0,r._)`${$}.errors`,D),B.return(!1))}const w={keyword:new r.Name("keyword"),schemaPath:new r.Name("schemaPath"),params:new r.Name("params"),propertyName:new r.Name("propertyName"),message:new r.Name("message"),schema:new r.Name("schema"),parentSchema:new r.Name("parentSchema")};function S(L,D,B){const{createErrors:$}=L.it;return $===!1?(0,r._)`{}`:k(L,D,B)}function k(L,D,B={}){const{gen:$,it:J}=L,Y=[A(J,B),P(L,B)];return T(L,D,Y),$.object(...Y)}function A({errorPath:L},{instancePath:D}){const B=D?(0,r.str)`${L}${(0,a.getErrorPath)(D,a.Type.Str)}`:L;return[l.default.instancePath,(0,r.strConcat)(l.default.instancePath,B)]}function P({keyword:L,it:{errSchemaPath:D}},{schemaPath:B,parentSchema:$}){let J=$?D:(0,r.str)`${D}/${L}`;return B&&(J=(0,r.str)`${J}${(0,a.getErrorPath)(B,a.Type.Str)}`),[w.schemaPath,J]}function T(L,{params:D,message:B},$){const{keyword:J,data:Y,schemaValue:ae,it:re}=L,{opts:ce,propertyName:ye,topSchemaRef:Ae,schemaPath:_t}=re;$.push([w.keyword,J],[w.params,typeof D=="function"?D(L):D||(0,r._)`{}`]),ce.messages&&$.push([w.message,typeof B=="function"?B(L):B]),ce.verbose&&$.push([w.schema,ae],[w.parentSchema,(0,r._)`${Ae}${_t}`],[l.default.data,Y]),ye&&$.push([w.propertyName,ye])}})(ic);Object.defineProperty(Uo,"__esModule",{value:!0});Uo.boolOrEmptySchema=Uo.topBoolOrEmptySchema=void 0;const bv=ic,xv=Mr,wv=xa,Ev={message:"boolean schema is false"};function kv(o){const{gen:r,schema:a,validateName:l}=o;a===!1?x_(o,!1):typeof a=="object"&&a.$async===!0?r.return(wv.default.data):(r.assign((0,xv._)`${l}.errors`,null),r.return(!0))}Uo.topBoolOrEmptySchema=kv;function Sv(o,r){const{gen:a,schema:l}=o;l===!1?(a.var(r,!1),x_(o)):a.var(r,!0)}Uo.boolOrEmptySchema=Sv;function x_(o,r){const{gen:a,data:l}=o,c={gen:a,keyword:"false schema",data:l,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:o};(0,bv.reportError)(c,Ev,void 0,r)}var nc={},Hs={};Object.defineProperty(Hs,"__esModule",{value:!0});Hs.getRules=Hs.isJSONType=void 0;const Tv=["string","number","integer","boolean","null","object","array"],Iv=new Set(Tv);function Cv(o){return typeof o=="string"&&Iv.has(o)}Hs.isJSONType=Cv;function Av(){const o={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...o,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},o.number,o.string,o.array,o.object],post:{rules:[]},all:{},keywords:{}}}Hs.getRules=Av;var Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});Fa.shouldUseRule=Fa.shouldUseGroup=Fa.schemaHasRulesForType=void 0;function Pv({schema:o,self:r},a){const l=r.RULES.types[a];return l&&l!==!0&&w_(o,l)}Fa.schemaHasRulesForType=Pv;function w_(o,r){return r.rules.some(a=>E_(o,a))}Fa.shouldUseGroup=w_;function E_(o,r){var a;return o[r.keyword]!==void 0||((a=r.definition.implements)===null||a===void 0?void 0:a.some(l=>o[l]!==void 0))}Fa.shouldUseRule=E_;(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.reportTypeError=o.checkDataTypes=o.checkDataType=o.coerceAndCheckDataType=o.getJSONTypes=o.getSchemaTypes=o.DataType=void 0;const r=Hs,a=Fa,l=ic,c=Mr,f=Zr;var d;(function($){$[$.Correct=0]="Correct",$[$.Wrong=1]="Wrong"})(d=o.DataType||(o.DataType={}));function n($){const J=m($.type);if(J.includes("null")){if($.nullable===!1)throw new Error("type: null contradicts nullable: false")}else{if(!J.length&&$.nullable!==void 0)throw new Error('"nullable" cannot be used without "type"');$.nullable===!0&&J.push("null")}return J}o.getSchemaTypes=n;function m($){const J=Array.isArray($)?$:$?[$]:[];if(J.every(r.isJSONType))return J;throw new Error("type must be JSONType or JSONType[]: "+J.join(","))}o.getJSONTypes=m;function b($,J){const{gen:Y,data:ae,opts:re}=$,ce=S(J,re.coerceTypes),ye=J.length>0&&!(ce.length===0&&J.length===1&&(0,a.schemaHasRulesForType)($,J[0]));if(ye){const Ae=T(J,ae,re.strictNumbers,d.Wrong);Y.if(Ae,()=>{ce.length?k($,J,ce):D($)})}return ye}o.coerceAndCheckDataType=b;const w=new Set(["string","number","integer","boolean","null"]);function S($,J){return J?$.filter(Y=>w.has(Y)||J==="array"&&Y==="array"):[]}function k($,J,Y){const{gen:ae,data:re,opts:ce}=$,ye=ae.let("dataType",(0,c._)`typeof ${re}`),Ae=ae.let("coerced",(0,c._)`undefined`);ce.coerceTypes==="array"&&ae.if((0,c._)`${ye} == 'object' && Array.isArray(${re}) && ${re}.length == 1`,()=>ae.assign(re,(0,c._)`${re}[0]`).assign(ye,(0,c._)`typeof ${re}`).if(T(J,re,ce.strictNumbers),()=>ae.assign(Ae,re))),ae.if((0,c._)`${Ae} !== undefined`);for(const le of Y)(w.has(le)||le==="array"&&ce.coerceTypes==="array")&&_t(le);ae.else(),D($),ae.endIf(),ae.if((0,c._)`${Ae} !== undefined`,()=>{ae.assign(re,Ae),A($,Ae)});function _t(le){switch(le){case"string":ae.elseIf((0,c._)`${ye} == "number" || ${ye} == "boolean"`).assign(Ae,(0,c._)`"" + ${re}`).elseIf((0,c._)`${re} === null`).assign(Ae,(0,c._)`""`);return;case"number":ae.elseIf((0,c._)`${ye} == "boolean" || ${re} === null + || (${ye} == "string" && ${re} && ${re} == +${re})`).assign(Ae,(0,c._)`+${re}`);return;case"integer":ae.elseIf((0,c._)`${ye} === "boolean" || ${re} === null + || (${ye} === "string" && ${re} && ${re} == +${re} && !(${re} % 1))`).assign(Ae,(0,c._)`+${re}`);return;case"boolean":ae.elseIf((0,c._)`${re} === "false" || ${re} === 0 || ${re} === null`).assign(Ae,!1).elseIf((0,c._)`${re} === "true" || ${re} === 1`).assign(Ae,!0);return;case"null":ae.elseIf((0,c._)`${re} === "" || ${re} === 0 || ${re} === false`),ae.assign(Ae,null);return;case"array":ae.elseIf((0,c._)`${ye} === "string" || ${ye} === "number" + || ${ye} === "boolean" || ${re} === null`).assign(Ae,(0,c._)`[${re}]`)}}}function A({gen:$,parentData:J,parentDataProperty:Y},ae){$.if((0,c._)`${J} !== undefined`,()=>$.assign((0,c._)`${J}[${Y}]`,ae))}function P($,J,Y,ae=d.Correct){const re=ae===d.Correct?c.operators.EQ:c.operators.NEQ;let ce;switch($){case"null":return(0,c._)`${J} ${re} null`;case"array":ce=(0,c._)`Array.isArray(${J})`;break;case"object":ce=(0,c._)`${J} && typeof ${J} == "object" && !Array.isArray(${J})`;break;case"integer":ce=ye((0,c._)`!(${J} % 1) && !isNaN(${J})`);break;case"number":ce=ye();break;default:return(0,c._)`typeof ${J} ${re} ${$}`}return ae===d.Correct?ce:(0,c.not)(ce);function ye(Ae=c.nil){return(0,c.and)((0,c._)`typeof ${J} == "number"`,Ae,Y?(0,c._)`isFinite(${J})`:c.nil)}}o.checkDataType=P;function T($,J,Y,ae){if($.length===1)return P($[0],J,Y,ae);let re;const ce=(0,f.toHash)($);if(ce.array&&ce.object){const ye=(0,c._)`typeof ${J} != "object"`;re=ce.null?ye:(0,c._)`!${J} || ${ye}`,delete ce.null,delete ce.array,delete ce.object}else re=c.nil;ce.number&&delete ce.integer;for(const ye in ce)re=(0,c.and)(re,P(ye,J,Y,ae));return re}o.checkDataTypes=T;const L={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:J})=>typeof $=="string"?(0,c._)`{type: ${$}}`:(0,c._)`{type: ${J}}`};function D($){const J=B($);(0,l.reportError)(J,L)}o.reportTypeError=D;function B($){const{gen:J,data:Y,schema:ae}=$,re=(0,f.schemaRefOrVal)($,ae,"type");return{gen:J,keyword:"type",data:Y,schema:ae.type,schemaCode:re,schemaValue:re,parentSchema:ae,params:{},it:$}}})(nc);var ju={};Object.defineProperty(ju,"__esModule",{value:!0});ju.assignDefaults=void 0;const Io=Mr,zv=Zr;function Mv(o,r){const{properties:a,items:l}=o.schema;if(r==="object"&&a)for(const c in a)fm(o,c,a[c].default);else r==="array"&&Array.isArray(l)&&l.forEach((c,f)=>fm(o,f,c.default))}ju.assignDefaults=Mv;function fm(o,r,a){const{gen:l,compositeRule:c,data:f,opts:d}=o;if(a===void 0)return;const n=(0,Io._)`${f}${(0,Io.getProperty)(r)}`;if(c){(0,zv.checkStrictMode)(o,`default is ignored for: ${n}`);return}let m=(0,Io._)`${n} === undefined`;d.useDefaults==="empty"&&(m=(0,Io._)`${m} || ${n} === null || ${n} === ""`),l.if(m,(0,Io._)`${n} = ${(0,Io.stringify)(a)}`)}var va={},zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.validateUnion=zr.validateArray=zr.usePattern=zr.callValidateCode=zr.schemaProperties=zr.allSchemaProperties=zr.noPropertyInData=zr.propertyInData=zr.isOwnProperty=zr.hasPropFunc=zr.reportMissingProp=zr.checkMissingProp=zr.checkReportMissingProp=void 0;const hi=Mr,Tf=Zr,is=xa,Dv=Zr;function Rv(o,r){const{gen:a,data:l,it:c}=o;a.if(Cf(a,l,r,c.opts.ownProperties),()=>{o.setParams({missingProperty:(0,hi._)`${r}`},!0),o.error()})}zr.checkReportMissingProp=Rv;function Lv({gen:o,data:r,it:{opts:a}},l,c){return(0,hi.or)(...l.map(f=>(0,hi.and)(Cf(o,r,f,a.ownProperties),(0,hi._)`${c} = ${f}`)))}zr.checkMissingProp=Lv;function Bv(o,r){o.setParams({missingProperty:r},!0),o.error()}zr.reportMissingProp=Bv;function k_(o){return o.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,hi._)`Object.prototype.hasOwnProperty`})}zr.hasPropFunc=k_;function If(o,r,a){return(0,hi._)`${k_(o)}.call(${r}, ${a})`}zr.isOwnProperty=If;function Ov(o,r,a,l){const c=(0,hi._)`${r}${(0,hi.getProperty)(a)} !== undefined`;return l?(0,hi._)`${c} && ${If(o,r,a)}`:c}zr.propertyInData=Ov;function Cf(o,r,a,l){const c=(0,hi._)`${r}${(0,hi.getProperty)(a)} === undefined`;return l?(0,hi.or)(c,(0,hi.not)(If(o,r,a))):c}zr.noPropertyInData=Cf;function S_(o){return o?Object.keys(o).filter(r=>r!=="__proto__"):[]}zr.allSchemaProperties=S_;function Fv(o,r){return S_(r).filter(a=>!(0,Tf.alwaysValidSchema)(o,r[a]))}zr.schemaProperties=Fv;function Nv({schemaCode:o,data:r,it:{gen:a,topSchemaRef:l,schemaPath:c,errorPath:f},it:d},n,m,b){const w=b?(0,hi._)`${o}, ${r}, ${l}${c}`:r,S=[[is.default.instancePath,(0,hi.strConcat)(is.default.instancePath,f)],[is.default.parentData,d.parentData],[is.default.parentDataProperty,d.parentDataProperty],[is.default.rootData,is.default.rootData]];d.opts.dynamicRef&&S.push([is.default.dynamicAnchors,is.default.dynamicAnchors]);const k=(0,hi._)`${w}, ${a.object(...S)}`;return m!==hi.nil?(0,hi._)`${n}.call(${m}, ${k})`:(0,hi._)`${n}(${k})`}zr.callValidateCode=Nv;const Uv=(0,hi._)`new RegExp`;function Vv({gen:o,it:{opts:r}},a){const l=r.unicodeRegExp?"u":"",{regExp:c}=r.code,f=c(a,l);return o.scopeValue("pattern",{key:f.toString(),ref:f,code:(0,hi._)`${c.code==="new RegExp"?Uv:(0,Dv.useFunc)(o,c)}(${a}, ${l})`})}zr.usePattern=Vv;function $v(o){const{gen:r,data:a,keyword:l,it:c}=o,f=r.name("valid");if(c.allErrors){const n=r.let("valid",!0);return d(()=>r.assign(n,!1)),n}return r.var(f,!0),d(()=>r.break()),f;function d(n){const m=r.const("len",(0,hi._)`${a}.length`);r.forRange("i",0,m,b=>{o.subschema({keyword:l,dataProp:b,dataPropType:Tf.Type.Num},f),r.if((0,hi.not)(f),n)})}}zr.validateArray=$v;function jv(o){const{gen:r,schema:a,keyword:l,it:c}=o;if(!Array.isArray(a))throw new Error("ajv implementation error");if(a.some(m=>(0,Tf.alwaysValidSchema)(c,m))&&!c.opts.unevaluated)return;const d=r.let("valid",!1),n=r.name("_valid");r.block(()=>a.forEach((m,b)=>{const w=o.subschema({keyword:l,schemaProp:b,compositeRule:!0},n);r.assign(d,(0,hi._)`${d} || ${n}`),o.mergeValidEvaluated(w,n)||r.if((0,hi.not)(d))})),o.result(d,()=>o.reset(),()=>o.error(!0))}zr.validateUnion=jv;Object.defineProperty(va,"__esModule",{value:!0});va.validateKeywordUsage=va.validSchemaType=va.funcKeywordCode=va.macroKeywordCode=void 0;const dn=Mr,Vs=xa,qv=zr,Gv=ic;function Zv(o,r){const{gen:a,keyword:l,schema:c,parentSchema:f,it:d}=o,n=r.macro.call(d.self,c,f,d),m=T_(a,l,n);d.opts.validateSchema!==!1&&d.self.validateSchema(n,!0);const b=a.name("valid");o.subschema({schema:n,schemaPath:dn.nil,errSchemaPath:`${d.errSchemaPath}/${l}`,topSchemaRef:m,compositeRule:!0},b),o.pass(b,()=>o.error(!0))}va.macroKeywordCode=Zv;function Hv(o,r){var a;const{gen:l,keyword:c,schema:f,parentSchema:d,$data:n,it:m}=o;Kv(m,r);const b=!n&&r.compile?r.compile.call(m.self,f,d,m):r.validate,w=T_(l,c,b),S=l.let("valid");o.block$data(S,k),o.ok((a=r.valid)!==null&&a!==void 0?a:S);function k(){if(r.errors===!1)T(),r.modifying&&dm(o),L(()=>o.error());else{const D=r.async?A():P();r.modifying&&dm(o),L(()=>Wv(o,D))}}function A(){const D=l.let("ruleErrs",null);return l.try(()=>T((0,dn._)`await `),B=>l.assign(S,!1).if((0,dn._)`${B} instanceof ${m.ValidationError}`,()=>l.assign(D,(0,dn._)`${B}.errors`),()=>l.throw(B))),D}function P(){const D=(0,dn._)`${w}.errors`;return l.assign(D,null),T(dn.nil),D}function T(D=r.async?(0,dn._)`await `:dn.nil){const B=m.opts.passContext?Vs.default.this:Vs.default.self,$=!("compile"in r&&!n||r.schema===!1);l.assign(S,(0,dn._)`${D}${(0,qv.callValidateCode)(o,w,B,$)}`,r.modifying)}function L(D){var B;l.if((0,dn.not)((B=r.valid)!==null&&B!==void 0?B:S),D)}}va.funcKeywordCode=Hv;function dm(o){const{gen:r,data:a,it:l}=o;r.if(l.parentData,()=>r.assign(a,(0,dn._)`${l.parentData}[${l.parentDataProperty}]`))}function Wv(o,r){const{gen:a}=o;a.if((0,dn._)`Array.isArray(${r})`,()=>{a.assign(Vs.default.vErrors,(0,dn._)`${Vs.default.vErrors} === null ? ${r} : ${Vs.default.vErrors}.concat(${r})`).assign(Vs.default.errors,(0,dn._)`${Vs.default.vErrors}.length`),(0,Gv.extendErrors)(o)},()=>o.error())}function Kv({schemaEnv:o},r){if(r.async&&!o.$async)throw new Error("async keyword in sync schema")}function T_(o,r,a){if(a===void 0)throw new Error(`keyword "${r}" failed to compile`);return o.scopeValue("keyword",typeof a=="function"?{ref:a}:{ref:a,code:(0,dn.stringify)(a)})}function Xv(o,r,a=!1){return!r.length||r.some(l=>l==="array"?Array.isArray(o):l==="object"?o&&typeof o=="object"&&!Array.isArray(o):typeof o==l||a&&typeof o>"u")}va.validSchemaType=Xv;function Jv({schema:o,opts:r,self:a,errSchemaPath:l},c,f){if(Array.isArray(c.keyword)?!c.keyword.includes(f):c.keyword!==f)throw new Error("ajv implementation error");const d=c.dependencies;if(d!=null&&d.some(n=>!Object.prototype.hasOwnProperty.call(o,n)))throw new Error(`parent schema must have dependencies of ${f}: ${d.join(",")}`);if(c.validateSchema&&!c.validateSchema(o[f])){const m=`keyword "${f}" value is invalid at path "${l}": `+a.errorsText(c.validateSchema.errors);if(r.validateSchema==="log")a.logger.error(m);else throw new Error(m)}}va.validateKeywordUsage=Jv;var os={};Object.defineProperty(os,"__esModule",{value:!0});os.extendSubschemaMode=os.extendSubschemaData=os.getSubschema=void 0;const ya=Mr,I_=Zr;function Yv(o,{keyword:r,schemaProp:a,schema:l,schemaPath:c,errSchemaPath:f,topSchemaRef:d}){if(r!==void 0&&l!==void 0)throw new Error('both "keyword" and "schema" passed, only one allowed');if(r!==void 0){const n=o.schema[r];return a===void 0?{schema:n,schemaPath:(0,ya._)`${o.schemaPath}${(0,ya.getProperty)(r)}`,errSchemaPath:`${o.errSchemaPath}/${r}`}:{schema:n[a],schemaPath:(0,ya._)`${o.schemaPath}${(0,ya.getProperty)(r)}${(0,ya.getProperty)(a)}`,errSchemaPath:`${o.errSchemaPath}/${r}/${(0,I_.escapeFragment)(a)}`}}if(l!==void 0){if(c===void 0||f===void 0||d===void 0)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:l,schemaPath:c,topSchemaRef:d,errSchemaPath:f}}throw new Error('either "keyword" or "schema" must be passed')}os.getSubschema=Yv;function Qv(o,r,{dataProp:a,dataPropType:l,data:c,dataTypes:f,propertyName:d}){if(c!==void 0&&a!==void 0)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:n}=r;if(a!==void 0){const{errorPath:b,dataPathArr:w,opts:S}=r,k=n.let("data",(0,ya._)`${r.data}${(0,ya.getProperty)(a)}`,!0);m(k),o.errorPath=(0,ya.str)`${b}${(0,I_.getErrorPath)(a,l,S.jsPropertySyntax)}`,o.parentDataProperty=(0,ya._)`${a}`,o.dataPathArr=[...w,o.parentDataProperty]}if(c!==void 0){const b=c instanceof ya.Name?c:n.let("data",c,!0);m(b),d!==void 0&&(o.propertyName=d)}f&&(o.dataTypes=f);function m(b){o.data=b,o.dataLevel=r.dataLevel+1,o.dataTypes=[],r.definedProperties=new Set,o.parentData=r.data,o.dataNames=[...r.dataNames,b]}}os.extendSubschemaData=Qv;function eb(o,{jtdDiscriminator:r,jtdMetadata:a,compositeRule:l,createErrors:c,allErrors:f}){l!==void 0&&(o.compositeRule=l),c!==void 0&&(o.createErrors=c),f!==void 0&&(o.allErrors=f),o.jtdDiscriminator=r,o.jtdMetadata=a}os.extendSubschemaMode=eb;var Xi={},C_=function o(r,a){if(r===a)return!0;if(r&&a&&typeof r=="object"&&typeof a=="object"){if(r.constructor!==a.constructor)return!1;var l,c,f;if(Array.isArray(r)){if(l=r.length,l!=a.length)return!1;for(c=l;c--!==0;)if(!o(r[c],a[c]))return!1;return!0}if(r.constructor===RegExp)return r.source===a.source&&r.flags===a.flags;if(r.valueOf!==Object.prototype.valueOf)return r.valueOf()===a.valueOf();if(r.toString!==Object.prototype.toString)return r.toString()===a.toString();if(f=Object.keys(r),l=f.length,l!==Object.keys(a).length)return!1;for(c=l;c--!==0;)if(!Object.prototype.hasOwnProperty.call(a,f[c]))return!1;for(c=l;c--!==0;){var d=f[c];if(!o(r[d],a[d]))return!1}return!0}return r!==r&&a!==a},A_={exports:{}},as=A_.exports=function(o,r,a){typeof r=="function"&&(a=r,r={}),a=r.cb||a;var l=typeof a=="function"?a:a.pre||function(){},c=a.post||function(){};ku(r,l,c,o,"",o)};as.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0};as.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0};as.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0};as.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0};function ku(o,r,a,l,c,f,d,n,m,b){if(l&&typeof l=="object"&&!Array.isArray(l)){r(l,c,f,d,n,m,b);for(var w in l){var S=l[w];if(Array.isArray(S)){if(w in as.arrayKeywords)for(var k=0;kr+=P_(l)),r===1/0))return 1/0}return r}function z_(o,r="",a){a!==!1&&(r=Oo(r));const l=o.parse(r);return M_(o,l)}Xi.getFullPath=z_;function M_(o,r){return o.serialize(r).split("#")[0]+"#"}Xi._getFullPath=M_;const cb=/#\/?$/;function Oo(o){return o?o.replace(cb,""):""}Xi.normalizeId=Oo;function ub(o,r,a){return a=Oo(a),o.resolve(r,a)}Xi.resolveUrl=ub;const hb=/^[a-z_][-a-z0-9._]*$/i;function fb(o,r){if(typeof o=="boolean")return{};const{schemaId:a,uriResolver:l}=this.opts,c=Oo(o[a]||r),f={"":c},d=z_(l,c,!1),n={},m=new Set;return ab(o,{allKeys:!0},(S,k,A,P)=>{if(P===void 0)return;const T=d+k;let L=f[P];typeof S[a]=="string"&&(L=D.call(this,S[a])),B.call(this,S.$anchor),B.call(this,S.$dynamicAnchor),f[k]=L;function D($){const J=this.opts.uriResolver.resolve;if($=Oo(L?J(L,$):$),m.has($))throw w($);m.add($);let Y=this.refs[$];return typeof Y=="string"&&(Y=this.refs[Y]),typeof Y=="object"?b(S,Y.schema,$):$!==Oo(T)&&($[0]==="#"?(b(S,n[$],$),n[$]=S):this.refs[$]=T),$}function B($){if(typeof $=="string"){if(!hb.test($))throw new Error(`invalid anchor "${$}"`);D.call(this,`#${$}`)}}}),n;function b(S,k,A){if(k!==void 0&&!nb(S,k))throw w(A)}function w(S){return new Error(`reference "${S}" resolves to more than one schema`)}}Xi.getSchemaRefs=fb;Object.defineProperty(na,"__esModule",{value:!0});na.getData=na.KeywordCxt=na.validateFunctionCode=void 0;const D_=Uo,pm=nc,Af=Fa,zu=nc,db=ju,Hl=va,ef=os,ur=Mr,vr=xa,pb=Xi,Na=Zr,Ul=ic;function mb(o){if(B_(o)&&(O_(o),L_(o))){yb(o);return}R_(o,()=>(0,D_.topBoolOrEmptySchema)(o))}na.validateFunctionCode=mb;function R_({gen:o,validateName:r,schema:a,schemaEnv:l,opts:c},f){c.code.es5?o.func(r,(0,ur._)`${vr.default.data}, ${vr.default.valCxt}`,l.$async,()=>{o.code((0,ur._)`"use strict"; ${mm(a,c)}`),_b(o,c),o.code(f)}):o.func(r,(0,ur._)`${vr.default.data}, ${gb(c)}`,l.$async,()=>o.code(mm(a,c)).code(f))}function gb(o){return(0,ur._)`{${vr.default.instancePath}="", ${vr.default.parentData}, ${vr.default.parentDataProperty}, ${vr.default.rootData}=${vr.default.data}${o.dynamicRef?(0,ur._)`, ${vr.default.dynamicAnchors}={}`:ur.nil}}={}`}function _b(o,r){o.if(vr.default.valCxt,()=>{o.var(vr.default.instancePath,(0,ur._)`${vr.default.valCxt}.${vr.default.instancePath}`),o.var(vr.default.parentData,(0,ur._)`${vr.default.valCxt}.${vr.default.parentData}`),o.var(vr.default.parentDataProperty,(0,ur._)`${vr.default.valCxt}.${vr.default.parentDataProperty}`),o.var(vr.default.rootData,(0,ur._)`${vr.default.valCxt}.${vr.default.rootData}`),r.dynamicRef&&o.var(vr.default.dynamicAnchors,(0,ur._)`${vr.default.valCxt}.${vr.default.dynamicAnchors}`)},()=>{o.var(vr.default.instancePath,(0,ur._)`""`),o.var(vr.default.parentData,(0,ur._)`undefined`),o.var(vr.default.parentDataProperty,(0,ur._)`undefined`),o.var(vr.default.rootData,vr.default.data),r.dynamicRef&&o.var(vr.default.dynamicAnchors,(0,ur._)`{}`)})}function yb(o){const{schema:r,opts:a,gen:l}=o;R_(o,()=>{a.$comment&&r.$comment&&N_(o),Eb(o),l.let(vr.default.vErrors,null),l.let(vr.default.errors,0),a.unevaluated&&vb(o),F_(o),Tb(o)})}function vb(o){const{gen:r,validateName:a}=o;o.evaluated=r.const("evaluated",(0,ur._)`${a}.evaluated`),r.if((0,ur._)`${o.evaluated}.dynamicProps`,()=>r.assign((0,ur._)`${o.evaluated}.props`,(0,ur._)`undefined`)),r.if((0,ur._)`${o.evaluated}.dynamicItems`,()=>r.assign((0,ur._)`${o.evaluated}.items`,(0,ur._)`undefined`))}function mm(o,r){const a=typeof o=="object"&&o[r.schemaId];return a&&(r.code.source||r.code.process)?(0,ur._)`/*# sourceURL=${a} */`:ur.nil}function bb(o,r){if(B_(o)&&(O_(o),L_(o))){xb(o,r);return}(0,D_.boolOrEmptySchema)(o,r)}function L_({schema:o,self:r}){if(typeof o=="boolean")return!o;for(const a in o)if(r.RULES.all[a])return!0;return!1}function B_(o){return typeof o.schema!="boolean"}function xb(o,r){const{schema:a,gen:l,opts:c}=o;c.$comment&&a.$comment&&N_(o),kb(o),Sb(o);const f=l.const("_errs",vr.default.errors);F_(o,f),l.var(r,(0,ur._)`${f} === ${vr.default.errors}`)}function O_(o){(0,Na.checkUnknownRules)(o),wb(o)}function F_(o,r){if(o.opts.jtd)return gm(o,[],!1,r);const a=(0,pm.getSchemaTypes)(o.schema),l=(0,pm.coerceAndCheckDataType)(o,a);gm(o,a,!l,r)}function wb(o){const{schema:r,errSchemaPath:a,opts:l,self:c}=o;r.$ref&&l.ignoreKeywordsWithRef&&(0,Na.schemaHasRulesButRef)(r,c.RULES)&&c.logger.warn(`$ref: keywords ignored in schema at path "${a}"`)}function Eb(o){const{schema:r,opts:a}=o;r.default!==void 0&&a.useDefaults&&a.strictSchema&&(0,Na.checkStrictMode)(o,"default is ignored in the schema root")}function kb(o){const r=o.schema[o.opts.schemaId];r&&(o.baseId=(0,pb.resolveUrl)(o.opts.uriResolver,o.baseId,r))}function Sb(o){if(o.schema.$async&&!o.schemaEnv.$async)throw new Error("async schema in sync schema")}function N_({gen:o,schemaEnv:r,schema:a,errSchemaPath:l,opts:c}){const f=a.$comment;if(c.$comment===!0)o.code((0,ur._)`${vr.default.self}.logger.log(${f})`);else if(typeof c.$comment=="function"){const d=(0,ur.str)`${l}/$comment`,n=o.scopeValue("root",{ref:r.root});o.code((0,ur._)`${vr.default.self}.opts.$comment(${f}, ${d}, ${n}.schema)`)}}function Tb(o){const{gen:r,schemaEnv:a,validateName:l,ValidationError:c,opts:f}=o;a.$async?r.if((0,ur._)`${vr.default.errors} === 0`,()=>r.return(vr.default.data),()=>r.throw((0,ur._)`new ${c}(${vr.default.vErrors})`)):(r.assign((0,ur._)`${l}.errors`,vr.default.vErrors),f.unevaluated&&Ib(o),r.return((0,ur._)`${vr.default.errors} === 0`))}function Ib({gen:o,evaluated:r,props:a,items:l}){a instanceof ur.Name&&o.assign((0,ur._)`${r}.props`,a),l instanceof ur.Name&&o.assign((0,ur._)`${r}.items`,l)}function gm(o,r,a,l){const{gen:c,schema:f,data:d,allErrors:n,opts:m,self:b}=o,{RULES:w}=b;if(f.$ref&&(m.ignoreKeywordsWithRef||!(0,Na.schemaHasRulesButRef)(f,w))){c.block(()=>$_(o,"$ref",w.all.$ref.definition));return}m.jtd||Cb(o,r),c.block(()=>{for(const k of w.rules)S(k);S(w.post)});function S(k){(0,Af.shouldUseGroup)(f,k)&&(k.type?(c.if((0,zu.checkDataType)(k.type,d,m.strictNumbers)),_m(o,k),r.length===1&&r[0]===k.type&&a&&(c.else(),(0,zu.reportTypeError)(o)),c.endIf()):_m(o,k),n||c.if((0,ur._)`${vr.default.errors} === ${l||0}`))}}function _m(o,r){const{gen:a,schema:l,opts:{useDefaults:c}}=o;c&&(0,db.assignDefaults)(o,r.type),a.block(()=>{for(const f of r.rules)(0,Af.shouldUseRule)(l,f)&&$_(o,f.keyword,f.definition,r.type)})}function Cb(o,r){o.schemaEnv.meta||!o.opts.strictTypes||(Ab(o,r),o.opts.allowUnionTypes||Pb(o,r),zb(o,o.dataTypes))}function Ab(o,r){if(r.length){if(!o.dataTypes.length){o.dataTypes=r;return}r.forEach(a=>{U_(o.dataTypes,a)||Pf(o,`type "${a}" not allowed by context "${o.dataTypes.join(",")}"`)}),Db(o,r)}}function Pb(o,r){r.length>1&&!(r.length===2&&r.includes("null"))&&Pf(o,"use allowUnionTypes to allow union type keyword")}function zb(o,r){const a=o.self.RULES.all;for(const l in a){const c=a[l];if(typeof c=="object"&&(0,Af.shouldUseRule)(o.schema,c)){const{type:f}=c.definition;f.length&&!f.some(d=>Mb(r,d))&&Pf(o,`missing type "${f.join(",")}" for keyword "${l}"`)}}}function Mb(o,r){return o.includes(r)||r==="number"&&o.includes("integer")}function U_(o,r){return o.includes(r)||r==="integer"&&o.includes("number")}function Db(o,r){const a=[];for(const l of o.dataTypes)U_(r,l)?a.push(l):r.includes("integer")&&l==="number"&&a.push("integer");o.dataTypes=a}function Pf(o,r){const a=o.schemaEnv.baseId+o.errSchemaPath;r+=` at "${a}" (strictTypes)`,(0,Na.checkStrictMode)(o,r,o.opts.strictTypes)}class V_{constructor(r,a,l){if((0,Hl.validateKeywordUsage)(r,a,l),this.gen=r.gen,this.allErrors=r.allErrors,this.keyword=l,this.data=r.data,this.schema=r.schema[l],this.$data=a.$data&&r.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,Na.schemaRefOrVal)(r,this.schema,l,this.$data),this.schemaType=a.schemaType,this.parentSchema=r.schema,this.params={},this.it=r,this.def=a,this.$data)this.schemaCode=r.gen.const("vSchema",j_(this.$data,r));else if(this.schemaCode=this.schemaValue,!(0,Hl.validSchemaType)(this.schema,a.schemaType,a.allowUndefined))throw new Error(`${l} value must be ${JSON.stringify(a.schemaType)}`);("code"in a?a.trackErrors:a.errors!==!1)&&(this.errsCount=r.gen.const("_errs",vr.default.errors))}result(r,a,l){this.failResult((0,ur.not)(r),a,l)}failResult(r,a,l){this.gen.if(r),l?l():this.error(),a?(this.gen.else(),a(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(r,a){this.failResult((0,ur.not)(r),void 0,a)}fail(r){if(r===void 0){this.error(),this.allErrors||this.gen.if(!1);return}this.gen.if(r),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(r){if(!this.$data)return this.fail(r);const{schemaCode:a}=this;this.fail((0,ur._)`${a} !== undefined && (${(0,ur.or)(this.invalid$data(),r)})`)}error(r,a,l){if(a){this.setParams(a),this._error(r,l),this.setParams({});return}this._error(r,l)}_error(r,a){(r?Ul.reportExtraError:Ul.reportError)(this,this.def.error,a)}$dataError(){(0,Ul.reportError)(this,this.def.$dataError||Ul.keyword$DataError)}reset(){if(this.errsCount===void 0)throw new Error('add "trackErrors" to keyword definition');(0,Ul.resetErrorsCount)(this.gen,this.errsCount)}ok(r){this.allErrors||this.gen.if(r)}setParams(r,a){a?Object.assign(this.params,r):this.params=r}block$data(r,a,l=ur.nil){this.gen.block(()=>{this.check$data(r,l),a()})}check$data(r=ur.nil,a=ur.nil){if(!this.$data)return;const{gen:l,schemaCode:c,schemaType:f,def:d}=this;l.if((0,ur.or)((0,ur._)`${c} === undefined`,a)),r!==ur.nil&&l.assign(r,!0),(f.length||d.validateSchema)&&(l.elseIf(this.invalid$data()),this.$dataError(),r!==ur.nil&&l.assign(r,!1)),l.else()}invalid$data(){const{gen:r,schemaCode:a,schemaType:l,def:c,it:f}=this;return(0,ur.or)(d(),n());function d(){if(l.length){if(!(a instanceof ur.Name))throw new Error("ajv implementation error");const m=Array.isArray(l)?l:[l];return(0,ur._)`${(0,zu.checkDataTypes)(m,a,f.opts.strictNumbers,zu.DataType.Wrong)}`}return ur.nil}function n(){if(c.validateSchema){const m=r.scopeValue("validate$data",{ref:c.validateSchema});return(0,ur._)`!${m}(${a})`}return ur.nil}}subschema(r,a){const l=(0,ef.getSubschema)(this.it,r);(0,ef.extendSubschemaData)(l,this.it,r),(0,ef.extendSubschemaMode)(l,r);const c={...this.it,...l,items:void 0,props:void 0};return bb(c,a),c}mergeEvaluated(r,a){const{it:l,gen:c}=this;l.opts.unevaluated&&(l.props!==!0&&r.props!==void 0&&(l.props=Na.mergeEvaluated.props(c,r.props,l.props,a)),l.items!==!0&&r.items!==void 0&&(l.items=Na.mergeEvaluated.items(c,r.items,l.items,a)))}mergeValidEvaluated(r,a){const{it:l,gen:c}=this;if(l.opts.unevaluated&&(l.props!==!0||l.items!==!0))return c.if(a,()=>this.mergeEvaluated(r,ur.Name)),!0}}na.KeywordCxt=V_;function $_(o,r,a,l){const c=new V_(o,a,r);"code"in a?a.code(c,l):c.$data&&a.validate?(0,Hl.funcKeywordCode)(c,a):"macro"in a?(0,Hl.macroKeywordCode)(c,a):(a.compile||a.validate)&&(0,Hl.funcKeywordCode)(c,a)}const Rb=/^\/(?:[^~]|~0|~1)*$/,Lb=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function j_(o,{dataLevel:r,dataNames:a,dataPathArr:l}){let c,f;if(o==="")return vr.default.rootData;if(o[0]==="/"){if(!Rb.test(o))throw new Error(`Invalid JSON-pointer: ${o}`);c=o,f=vr.default.rootData}else{const b=Lb.exec(o);if(!b)throw new Error(`Invalid JSON-pointer: ${o}`);const w=+b[1];if(c=b[2],c==="#"){if(w>=r)throw new Error(m("property/index",w));return l[r-w]}if(w>r)throw new Error(m("data",w));if(f=a[r-w],!c)return f}let d=f;const n=c.split("/");for(const b of n)b&&(f=(0,ur._)`${f}${(0,ur.getProperty)((0,Na.unescapeJsonPointer)(b))}`,d=(0,ur._)`${d} && ${f}`);return d;function m(b,w){return`Cannot access ${b} ${w} levels up, current level is ${r}`}}na.getData=j_;var ac={};Object.defineProperty(ac,"__esModule",{value:!0});class Bb extends Error{constructor(r){super("validation failed"),this.errors=r,this.ajv=this.validation=!0}}ac.default=Bb;var sc={};Object.defineProperty(sc,"__esModule",{value:!0});const tf=Xi;class Ob extends Error{constructor(r,a,l,c){super(c||`can't resolve reference ${l} from id ${a}`),this.missingRef=(0,tf.resolveUrl)(r,a,l),this.missingSchema=(0,tf.normalizeId)((0,tf.getFullPath)(r,this.missingRef))}}sc.default=Ob;var wn={};Object.defineProperty(wn,"__esModule",{value:!0});wn.resolveSchema=wn.getCompilingSchema=wn.resolveRef=wn.compileSchema=wn.SchemaEnv=void 0;const Yn=Mr,Fb=ac,Us=xa,ia=Xi,ym=Zr,Nb=na;class qu{constructor(r){var a;this.refs={},this.dynamicAnchors={};let l;typeof r.schema=="object"&&(l=r.schema),this.schema=r.schema,this.schemaId=r.schemaId,this.root=r.root||this,this.baseId=(a=r.baseId)!==null&&a!==void 0?a:(0,ia.normalizeId)(l==null?void 0:l[r.schemaId||"$id"]),this.schemaPath=r.schemaPath,this.localRefs=r.localRefs,this.meta=r.meta,this.$async=l==null?void 0:l.$async,this.refs={}}}wn.SchemaEnv=qu;function zf(o){const r=q_.call(this,o);if(r)return r;const a=(0,ia.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:l,lines:c}=this.opts.code,{ownProperties:f}=this.opts,d=new Yn.CodeGen(this.scope,{es5:l,lines:c,ownProperties:f});let n;o.$async&&(n=d.scopeValue("Error",{ref:Fb.default,code:(0,Yn._)`require("ajv/dist/runtime/validation_error").default`}));const m=d.scopeName("validate");o.validateName=m;const b={gen:d,allErrors:this.opts.allErrors,data:Us.default.data,parentData:Us.default.parentData,parentDataProperty:Us.default.parentDataProperty,dataNames:[Us.default.data],dataPathArr:[Yn.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:d.scopeValue("schema",this.opts.code.source===!0?{ref:o.schema,code:(0,Yn.stringify)(o.schema)}:{ref:o.schema}),validateName:m,ValidationError:n,schema:o.schema,schemaEnv:o,rootId:a,baseId:o.baseId||a,schemaPath:Yn.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:(0,Yn._)`""`,opts:this.opts,self:this};let w;try{this._compilations.add(o),(0,Nb.validateFunctionCode)(b),d.optimize(this.opts.code.optimize);const S=d.toString();w=`${d.scopeRefs(Us.default.scope)}return ${S}`,this.opts.code.process&&(w=this.opts.code.process(w,o));const A=new Function(`${Us.default.self}`,`${Us.default.scope}`,w)(this,this.scope.get());if(this.scope.value(m,{ref:A}),A.errors=null,A.schema=o.schema,A.schemaEnv=o,o.$async&&(A.$async=!0),this.opts.code.source===!0&&(A.source={validateName:m,validateCode:S,scopeValues:d._values}),this.opts.unevaluated){const{props:P,items:T}=b;A.evaluated={props:P instanceof Yn.Name?void 0:P,items:T instanceof Yn.Name?void 0:T,dynamicProps:P instanceof Yn.Name,dynamicItems:T instanceof Yn.Name},A.source&&(A.source.evaluated=(0,Yn.stringify)(A.evaluated))}return o.validate=A,o}catch(S){throw delete o.validate,delete o.validateName,w&&this.logger.error("Error compiling schema, function code:",w),S}finally{this._compilations.delete(o)}}wn.compileSchema=zf;function Ub(o,r,a){var l;a=(0,ia.resolveUrl)(this.opts.uriResolver,r,a);const c=o.refs[a];if(c)return c;let f=jb.call(this,o,a);if(f===void 0){const d=(l=o.localRefs)===null||l===void 0?void 0:l[a],{schemaId:n}=this.opts;d&&(f=new qu({schema:d,schemaId:n,root:o,baseId:r}))}if(f!==void 0)return o.refs[a]=Vb.call(this,f)}wn.resolveRef=Ub;function Vb(o){return(0,ia.inlineRef)(o.schema,this.opts.inlineRefs)?o.schema:o.validate?o:zf.call(this,o)}function q_(o){for(const r of this._compilations)if($b(r,o))return r}wn.getCompilingSchema=q_;function $b(o,r){return o.schema===r.schema&&o.root===r.root&&o.baseId===r.baseId}function jb(o,r){let a;for(;typeof(a=this.refs[r])=="string";)r=a;return a||this.schemas[r]||Gu.call(this,o,r)}function Gu(o,r){const a=this.opts.uriResolver.parse(r),l=(0,ia._getFullPath)(this.opts.uriResolver,a);let c=(0,ia.getFullPath)(this.opts.uriResolver,o.baseId,void 0);if(Object.keys(o.schema).length>0&&l===c)return rf.call(this,a,o);const f=(0,ia.normalizeId)(l),d=this.refs[f]||this.schemas[f];if(typeof d=="string"){const n=Gu.call(this,o,d);return typeof(n==null?void 0:n.schema)!="object"?void 0:rf.call(this,a,n)}if(typeof(d==null?void 0:d.schema)=="object"){if(d.validate||zf.call(this,d),f===(0,ia.normalizeId)(r)){const{schema:n}=d,{schemaId:m}=this.opts,b=n[m];return b&&(c=(0,ia.resolveUrl)(this.opts.uriResolver,c,b)),new qu({schema:n,schemaId:m,root:o,baseId:c})}return rf.call(this,a,d)}}wn.resolveSchema=Gu;const qb=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function rf(o,{baseId:r,schema:a,root:l}){var c;if(((c=o.fragment)===null||c===void 0?void 0:c[0])!=="/")return;for(const n of o.fragment.slice(1).split("/")){if(typeof a=="boolean")return;const m=a[(0,ym.unescapeFragment)(n)];if(m===void 0)return;a=m;const b=typeof a=="object"&&a[this.opts.schemaId];!qb.has(n)&&b&&(r=(0,ia.resolveUrl)(this.opts.uriResolver,r,b))}let f;if(typeof a!="boolean"&&a.$ref&&!(0,ym.schemaHasRulesButRef)(a,this.RULES)){const n=(0,ia.resolveUrl)(this.opts.uriResolver,r,a.$ref);f=Gu.call(this,l,n)}const{schemaId:d}=this.opts;if(f=f||new qu({schema:a,schemaId:d,root:l,baseId:r}),f.schema!==f.root.schema)return f}const Gb="https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",Zb="Meta-schema for $data reference (JSON AnySchema extension proposal)",Hb="object",Wb=["$data"],Kb={$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},Xb=!1,Jb={$id:Gb,description:Zb,type:Hb,required:Wb,properties:Kb,additionalProperties:Xb};var Mf={},mf={exports:{}};/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */(function(o,r){(function(a,l){l(r)})(Do,function(a){function l(){for(var Ce=arguments.length,N=Array(Ce),z=0;z1){N[0]=N[0].slice(0,-1);for(var U=N.length-1,q=1;q= 0x80 (not a basic code point)","invalid-input":"Invalid input"},_t=T-L,le=Math.floor,We=String.fromCharCode;function Z(Ce){throw new RangeError(Ae[Ce])}function $e(Ce,N){for(var z=[],U=Ce.length;U--;)z[U]=N(Ce[U]);return z}function ct(Ce,N){var z=Ce.split("@"),U="";z.length>1&&(U=z[0]+"@",Ce=z[1]),Ce=Ce.replace(ye,".");var q=Ce.split("."),Q=$e(q,N).join(".");return U+Q}function rt(Ce){for(var N=[],z=0,U=Ce.length;z=55296&&q<=56319&&z>1,N+=le(N/z);N>_t*D>>1;q+=T)N=le(N/_t);return le(q+(_t+1)*N/(N+B))},ge=function(N){var z=[],U=N.length,q=0,Q=Y,he=J,Se=N.lastIndexOf(ae);Se<0&&(Se=0);for(var Ee=0;Ee=128&&Z("not-basic"),z.push(N.charCodeAt(Ee));for(var ve=Se>0?Se+1:0;ve=U&&Z("invalid-input");var Re=it(N.charCodeAt(ve++));(Re>=T||Re>le((P-q)/Ge))&&Z("overflow"),q+=Re*Ge;var Ct=ot<=he?L:ot>=he+D?D:ot-he;if(Rele(P/Pt)&&Z("overflow"),Ge*=Pt}var bt=z.length+1;he=oe(q-Te,bt,Te==0),le(q/bt)>P-Q&&Z("overflow"),Q+=le(q/bt),q%=bt,z.splice(q++,0,Q)}return String.fromCodePoint.apply(String,z)},Me=function(N){var z=[];N=rt(N);var U=N.length,q=Y,Q=0,he=J,Se=!0,Ee=!1,ve=void 0;try{for(var Te=N[Symbol.iterator](),Ge;!(Se=(Ge=Te.next()).done);Se=!0){var ot=Ge.value;ot<128&&z.push(We(ot))}}catch(qn){Ee=!0,ve=qn}finally{try{!Se&&Te.return&&Te.return()}finally{if(Ee)throw ve}}var Re=z.length,Ct=Re;for(Re&&z.push(ae);Ct=q&&frle((P-Q)/dr)&&Z("overflow"),Q+=(Pt-q)*dr,q=Pt;var Tr=!0,Qr=!1,Dr=void 0;try{for(var fi=N[Symbol.iterator](),jn;!(Tr=(jn=fi.next()).done);Tr=!0){var sa=jn.value;if(saP&&Z("overflow"),sa==q){for(var Br=Q,oa=T;;oa+=T){var la=oa<=he?L:oa>=he+D?D:oa-he;if(Br>6|192).toString(16).toUpperCase()+"%"+(N&63|128).toString(16).toUpperCase():z="%"+(N>>12|224).toString(16).toUpperCase()+"%"+(N>>6&63|128).toString(16).toUpperCase()+"%"+(N&63|128).toString(16).toUpperCase(),z}function Xe(Ce){for(var N="",z=0,U=Ce.length;z=194&&q<224){if(U-z>=6){var Q=parseInt(Ce.substr(z+4,2),16);N+=String.fromCharCode((q&31)<<6|Q&63)}else N+=Ce.substr(z,6);z+=6}else if(q>=224){if(U-z>=9){var he=parseInt(Ce.substr(z+4,2),16),Se=parseInt(Ce.substr(z+7,2),16);N+=String.fromCharCode((q&15)<<12|(he&63)<<6|Se&63)}else N+=Ce.substr(z,9);z+=9}else N+=Ce.substr(z,3),z+=3}return N}function Bt(Ce,N){function z(U){var q=Xe(U);return q.match(N.UNRESERVED)?q:U}return Ce.scheme&&(Ce.scheme=String(Ce.scheme).replace(N.PCT_ENCODED,z).toLowerCase().replace(N.NOT_SCHEME,"")),Ce.userinfo!==void 0&&(Ce.userinfo=String(Ce.userinfo).replace(N.PCT_ENCODED,z).replace(N.NOT_USERINFO,pt).replace(N.PCT_ENCODED,d)),Ce.host!==void 0&&(Ce.host=String(Ce.host).replace(N.PCT_ENCODED,z).toLowerCase().replace(N.NOT_HOST,pt).replace(N.PCT_ENCODED,d)),Ce.path!==void 0&&(Ce.path=String(Ce.path).replace(N.PCT_ENCODED,z).replace(Ce.scheme?N.NOT_PATH:N.NOT_PATH_NOSCHEME,pt).replace(N.PCT_ENCODED,d)),Ce.query!==void 0&&(Ce.query=String(Ce.query).replace(N.PCT_ENCODED,z).replace(N.NOT_QUERY,pt).replace(N.PCT_ENCODED,d)),Ce.fragment!==void 0&&(Ce.fragment=String(Ce.fragment).replace(N.PCT_ENCODED,z).replace(N.NOT_FRAGMENT,pt).replace(N.PCT_ENCODED,d)),Ce}function Qt(Ce){return Ce.replace(/^0*(.*)/,"$1")||"0"}function Rr(Ce,N){var z=Ce.match(N.IPV4ADDRESS)||[],U=k(z,2),q=U[1];return q?q.split(".").map(Qt).join("."):Ce}function Vr(Ce,N){var z=Ce.match(N.IPV6ADDRESS)||[],U=k(z,3),q=U[1],Q=U[2];if(q){for(var he=q.toLowerCase().split("::").reverse(),Se=k(he,2),Ee=Se[0],ve=Se[1],Te=ve?ve.split(":").map(Qt):[],Ge=Ee.split(":").map(Qt),ot=N.IPV4ADDRESS.test(Ge[Ge.length-1]),Re=ot?7:8,Ct=Ge.length-Re,Pt=Array(Re),bt=0;bt1){var or=Pt.slice(0,Yt.index),fr=Pt.slice(Yt.index+Yt.length);mr=or.join(":")+"::"+fr.join(":")}else mr=Pt.join(":");return Q&&(mr+="%"+Q),mr}else return Ce}var H=/^(?:([^:\/?#]+):)?(?:\/\/((?:([^\/?#@]*)@)?(\[[^\/?#\]]+\]|[^\/?#:]*)(?:\:(\d*))?))?([^?#]*)(?:\?([^#]*))?(?:#((?:.|\n|\r)*))?/i,ut="".match(/(){0}/)[1]===void 0;function tt(Ce){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z={},U=N.iri!==!1?S:w;N.reference==="suffix"&&(Ce=(N.scheme?N.scheme+":":"")+"//"+Ce);var q=Ce.match(H);if(q){ut?(z.scheme=q[1],z.userinfo=q[3],z.host=q[4],z.port=parseInt(q[5],10),z.path=q[6]||"",z.query=q[7],z.fragment=q[8],isNaN(z.port)&&(z.port=q[5])):(z.scheme=q[1]||void 0,z.userinfo=Ce.indexOf("@")!==-1?q[3]:void 0,z.host=Ce.indexOf("//")!==-1?q[4]:void 0,z.port=parseInt(q[5],10),z.path=q[6]||"",z.query=Ce.indexOf("?")!==-1?q[7]:void 0,z.fragment=Ce.indexOf("#")!==-1?q[8]:void 0,isNaN(z.port)&&(z.port=Ce.match(/\/\/(?:.|\n)*\:(?:\/|\?|\#|$)/)?q[4]:void 0)),z.host&&(z.host=Vr(Rr(z.host,U),U)),z.scheme===void 0&&z.userinfo===void 0&&z.host===void 0&&z.port===void 0&&!z.path&&z.query===void 0?z.reference="same-document":z.scheme===void 0?z.reference="relative":z.fragment===void 0?z.reference="absolute":z.reference="uri",N.reference&&N.reference!=="suffix"&&N.reference!==z.reference&&(z.error=z.error||"URI is not a "+N.reference+" reference.");var Q=wt[(N.scheme||z.scheme||"").toLowerCase()];if(!N.unicodeSupport&&(!Q||!Q.unicodeSupport)){if(z.host&&(N.domainHost||Q&&Q.domainHost))try{z.host=Je.toASCII(z.host.replace(U.PCT_ENCODED,Xe).toLowerCase())}catch(he){z.error=z.error||"Host's domain name can not be converted to ASCII via punycode: "+he}Bt(z,w)}else Bt(z,U);Q&&Q.parse&&Q.parse(z,N)}else z.error=z.error||"URI can not be parsed.";return z}function be(Ce,N){var z=N.iri!==!1?S:w,U=[];return Ce.userinfo!==void 0&&(U.push(Ce.userinfo),U.push("@")),Ce.host!==void 0&&U.push(Vr(Rr(String(Ce.host),z),z).replace(z.IPV6ADDRESS,function(q,Q,he){return"["+Q+(he?"%25"+he:"")+"]"})),(typeof Ce.port=="number"||typeof Ce.port=="string")&&(U.push(":"),U.push(String(Ce.port))),U.length?U.join(""):void 0}var pe=/^\.\.?\//,Ie=/^\/\.(\/|$)/,dt=/^\/\.\.(\/|$)/,mt=/^\/?(?:.|\n)*?(?=\/|$)/;function je(Ce){for(var N=[];Ce.length;)if(Ce.match(pe))Ce=Ce.replace(pe,"");else if(Ce.match(Ie))Ce=Ce.replace(Ie,"/");else if(Ce.match(dt))Ce=Ce.replace(dt,"/"),N.pop();else if(Ce==="."||Ce==="..")Ce="";else{var z=Ce.match(mt);if(z){var U=z[0];Ce=Ce.slice(U.length),N.push(U)}else throw new Error("Unexpected dot segment condition")}return N.join("")}function vt(Ce){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},z=N.iri?S:w,U=[],q=wt[(N.scheme||Ce.scheme||"").toLowerCase()];if(q&&q.serialize&&q.serialize(Ce,N),Ce.host&&!z.IPV6ADDRESS.test(Ce.host)){if(N.domainHost||q&&q.domainHost)try{Ce.host=N.iri?Je.toUnicode(Ce.host):Je.toASCII(Ce.host.replace(z.PCT_ENCODED,Xe).toLowerCase())}catch(Se){Ce.error=Ce.error||"Host's domain name can not be converted to "+(N.iri?"Unicode":"ASCII")+" via punycode: "+Se}}Bt(Ce,z),N.reference!=="suffix"&&Ce.scheme&&(U.push(Ce.scheme),U.push(":"));var Q=be(Ce,N);if(Q!==void 0&&(N.reference!=="suffix"&&U.push("//"),U.push(Q),Ce.path&&Ce.path.charAt(0)!=="/"&&U.push("/")),Ce.path!==void 0){var he=Ce.path;!N.absolutePath&&(!q||!q.absolutePath)&&(he=je(he)),Q===void 0&&(he=he.replace(/^\/\//,"/%2F")),U.push(he)}return Ce.query!==void 0&&(U.push("?"),U.push(Ce.query)),Ce.fragment!==void 0&&(U.push("#"),U.push(Ce.fragment)),U.join("")}function Ot(Ce,N){var z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},U=arguments[3],q={};return U||(Ce=tt(vt(Ce,z),z),N=tt(vt(N,z),z)),z=z||{},!z.tolerant&&N.scheme?(q.scheme=N.scheme,q.userinfo=N.userinfo,q.host=N.host,q.port=N.port,q.path=je(N.path||""),q.query=N.query):(N.userinfo!==void 0||N.host!==void 0||N.port!==void 0?(q.userinfo=N.userinfo,q.host=N.host,q.port=N.port,q.path=je(N.path||""),q.query=N.query):(N.path?(N.path.charAt(0)==="/"?q.path=je(N.path):((Ce.userinfo!==void 0||Ce.host!==void 0||Ce.port!==void 0)&&!Ce.path?q.path="/"+N.path:Ce.path?q.path=Ce.path.slice(0,Ce.path.lastIndexOf("/")+1)+N.path:q.path=N.path,q.path=je(q.path)),q.query=N.query):(q.path=Ce.path,N.query!==void 0?q.query=N.query:q.query=Ce.query),q.userinfo=Ce.userinfo,q.host=Ce.host,q.port=Ce.port),q.scheme=Ce.scheme),q.fragment=N.fragment,q}function St(Ce,N,z){var U=m({scheme:"null"},z);return vt(Ot(tt(Ce,U),tt(N,U),U,!0),U)}function Wt(Ce,N){return typeof Ce=="string"?Ce=vt(tt(Ce,N),N):f(Ce)==="object"&&(Ce=tt(vt(Ce,N),N)),Ce}function wr(Ce,N,z){return typeof Ce=="string"?Ce=vt(tt(Ce,z),z):f(Ce)==="object"&&(Ce=vt(Ce,z)),typeof N=="string"?N=vt(tt(N,z),z):f(N)==="object"&&(N=vt(N,z)),Ce===N}function Fe(Ce,N){return Ce&&Ce.toString().replace(!N||!N.iri?w.ESCAPE:S.ESCAPE,pt)}function gt(Ce,N){return Ce&&Ce.toString().replace(!N||!N.iri?w.PCT_ENCODED:S.PCT_ENCODED,Xe)}var mi={scheme:"http",domainHost:!0,parse:function(N,z){return N.host||(N.error=N.error||"HTTP URIs must have a host."),N},serialize:function(N,z){var U=String(N.scheme).toLowerCase()==="https";return(N.port===(U?443:80)||N.port==="")&&(N.port=void 0),N.path||(N.path="/"),N}},ri={scheme:"https",domainHost:mi.domainHost,parse:mi.parse,serialize:mi.serialize};function yr(Ce){return typeof Ce.secure=="boolean"?Ce.secure:String(Ce.scheme).toLowerCase()==="wss"}var Sr={scheme:"ws",domainHost:!0,parse:function(N,z){var U=N;return U.secure=yr(U),U.resourceName=(U.path||"/")+(U.query?"?"+U.query:""),U.path=void 0,U.query=void 0,U},serialize:function(N,z){if((N.port===(yr(N)?443:80)||N.port==="")&&(N.port=void 0),typeof N.secure=="boolean"&&(N.scheme=N.secure?"wss":"ws",N.secure=void 0),N.resourceName){var U=N.resourceName.split("?"),q=k(U,2),Q=q[0],he=q[1];N.path=Q&&Q!=="/"?Q:void 0,N.query=he,N.resourceName=void 0}return N.fragment=void 0,N}},gi={scheme:"wss",domainHost:Sr.domainHost,parse:Sr.parse,serialize:Sr.serialize},Ei={},_i="[A-Za-z0-9\\-\\.\\_\\~\\xA0-\\u200D\\u2010-\\u2029\\u202F-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFEF]",Tt="[0-9A-Fa-f]",pr=c(c("%[EFef]"+Tt+"%"+Tt+Tt+"%"+Tt+Tt)+"|"+c("%[89A-Fa-f]"+Tt+"%"+Tt+Tt)+"|"+c("%"+Tt+Tt)),hr="[A-Za-z0-9\\!\\$\\%\\'\\*\\+\\-\\^\\_\\`\\{\\|\\}\\~]",yi="[\\!\\$\\%\\'\\(\\)\\*\\+\\,\\-\\.0-9\\<\\>A-Z\\x5E-\\x7E]",nn=l(yi,'[\\"\\\\]'),sr="[\\!\\$\\'\\(\\)\\*\\+\\,\\;\\:\\@]",Vi=new RegExp(_i,"g"),ii=new RegExp(pr,"g"),aa=new RegExp(l("[^]",hr,"[\\.]",'[\\"]',nn),"g"),ui=new RegExp(l("[^]",_i,sr),"g"),Oi=ui;function Lr(Ce){var N=Xe(Ce);return N.match(Vi)?N:Ce}var Un={scheme:"mailto",parse:function(N,z){var U=N,q=U.to=U.path?U.path.split(","):[];if(U.path=void 0,U.query){for(var Q=!1,he={},Se=U.query.split("&"),Ee=0,ve=Se.length;Eenew RegExp(et,oe);A.code="new RegExp";const P=["removeAdditional","useDefaults","coerceTypes"],T=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),L={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},D={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'},B=200;function $(et){var oe,ge,Me,ee,ue,Je,wt,pt,Xe,Bt,Qt,Rr,Vr,H,ut,tt,be,pe,Ie,dt,mt,je,vt,Ot,St;const Wt=et.strict,wr=(oe=et.code)===null||oe===void 0?void 0:oe.optimize,Fe=wr===!0||wr===void 0?1:wr||0,gt=(Me=(ge=et.code)===null||ge===void 0?void 0:ge.regExp)!==null&&Me!==void 0?Me:A,mi=(ee=et.uriResolver)!==null&&ee!==void 0?ee:k.default;return{strictSchema:(Je=(ue=et.strictSchema)!==null&&ue!==void 0?ue:Wt)!==null&&Je!==void 0?Je:!0,strictNumbers:(pt=(wt=et.strictNumbers)!==null&&wt!==void 0?wt:Wt)!==null&&pt!==void 0?pt:!0,strictTypes:(Bt=(Xe=et.strictTypes)!==null&&Xe!==void 0?Xe:Wt)!==null&&Bt!==void 0?Bt:"log",strictTuples:(Rr=(Qt=et.strictTuples)!==null&&Qt!==void 0?Qt:Wt)!==null&&Rr!==void 0?Rr:"log",strictRequired:(H=(Vr=et.strictRequired)!==null&&Vr!==void 0?Vr:Wt)!==null&&H!==void 0?H:!1,code:et.code?{...et.code,optimize:Fe,regExp:gt}:{optimize:Fe,regExp:gt},loopRequired:(ut=et.loopRequired)!==null&&ut!==void 0?ut:B,loopEnum:(tt=et.loopEnum)!==null&&tt!==void 0?tt:B,meta:(be=et.meta)!==null&&be!==void 0?be:!0,messages:(pe=et.messages)!==null&&pe!==void 0?pe:!0,inlineRefs:(Ie=et.inlineRefs)!==null&&Ie!==void 0?Ie:!0,schemaId:(dt=et.schemaId)!==null&&dt!==void 0?dt:"$id",addUsedSchema:(mt=et.addUsedSchema)!==null&&mt!==void 0?mt:!0,validateSchema:(je=et.validateSchema)!==null&&je!==void 0?je:!0,validateFormats:(vt=et.validateFormats)!==null&&vt!==void 0?vt:!0,unicodeRegExp:(Ot=et.unicodeRegExp)!==null&&Ot!==void 0?Ot:!0,int32range:(St=et.int32range)!==null&&St!==void 0?St:!0,uriResolver:mi}}class J{constructor(oe={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,oe=this.opts={...oe,...$(oe)};const{es5:ge,lines:Me}=this.opts.code;this.scope=new n.ValueScope({scope:{},prefixes:T,es5:ge,lines:Me}),this.logger=le(oe.logger);const ee=oe.validateFormats;oe.validateFormats=!1,this.RULES=(0,f.getRules)(),Y.call(this,L,oe,"NOT SUPPORTED"),Y.call(this,D,oe,"DEPRECATED","warn"),this._metaOpts=Ae.call(this),oe.formats&&ce.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),oe.keywords&&ye.call(this,oe.keywords),typeof oe.meta=="object"&&this.addMetaSchema(oe.meta),re.call(this),oe.validateFormats=ee}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:oe,meta:ge,schemaId:Me}=this.opts;let ee=S;Me==="id"&&(ee={...S},ee.id=ee.$id,delete ee.$id),ge&&oe&&this.addMetaSchema(ee,ee[Me],!1)}defaultMeta(){const{meta:oe,schemaId:ge}=this.opts;return this.opts.defaultMeta=typeof oe=="object"?oe[ge]||oe:void 0}validate(oe,ge){let Me;if(typeof oe=="string"){if(Me=this.getSchema(oe),!Me)throw new Error(`no schema with key or ref "${oe}"`)}else Me=this.compile(oe);const ee=Me(ge);return"$async"in Me||(this.errors=Me.errors),ee}compile(oe,ge){const Me=this._addSchema(oe,ge);return Me.validate||this._compileSchemaEnv(Me)}compileAsync(oe,ge){if(typeof this.opts.loadSchema!="function")throw new Error("options.loadSchema should be a function");const{loadSchema:Me}=this.opts;return ee.call(this,oe,ge);async function ee(Bt,Qt){await ue.call(this,Bt.$schema);const Rr=this._addSchema(Bt,Qt);return Rr.validate||Je.call(this,Rr)}async function ue(Bt){Bt&&!this.getSchema(Bt)&&await ee.call(this,{$ref:Bt},!0)}async function Je(Bt){try{return this._compileSchemaEnv(Bt)}catch(Qt){if(!(Qt instanceof c.default))throw Qt;return wt.call(this,Qt),await pt.call(this,Qt.missingSchema),Je.call(this,Bt)}}function wt({missingSchema:Bt,missingRef:Qt}){if(this.refs[Bt])throw new Error(`AnySchema ${Bt} is loaded but ${Qt} cannot be resolved`)}async function pt(Bt){const Qt=await Xe.call(this,Bt);this.refs[Bt]||await ue.call(this,Qt.$schema),this.refs[Bt]||this.addSchema(Qt,Bt,ge)}async function Xe(Bt){const Qt=this._loading[Bt];if(Qt)return Qt;try{return await(this._loading[Bt]=Me(Bt))}finally{delete this._loading[Bt]}}}addSchema(oe,ge,Me,ee=this.opts.validateSchema){if(Array.isArray(oe)){for(const Je of oe)this.addSchema(Je,void 0,Me,ee);return this}let ue;if(typeof oe=="object"){const{schemaId:Je}=this.opts;if(ue=oe[Je],ue!==void 0&&typeof ue!="string")throw new Error(`schema ${Je} must be string`)}return ge=(0,m.normalizeId)(ge||ue),this._checkUnique(ge),this.schemas[ge]=this._addSchema(oe,Me,ge,ee,!0),this}addMetaSchema(oe,ge,Me=this.opts.validateSchema){return this.addSchema(oe,ge,!0,Me),this}validateSchema(oe,ge){if(typeof oe=="boolean")return!0;let Me;if(Me=oe.$schema,Me!==void 0&&typeof Me!="string")throw new Error("$schema must be a string");if(Me=Me||this.opts.defaultMeta||this.defaultMeta(),!Me)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const ee=this.validate(Me,oe);if(!ee&&ge){const ue="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(ue);else throw new Error(ue)}return ee}getSchema(oe){let ge;for(;typeof(ge=ae.call(this,oe))=="string";)oe=ge;if(ge===void 0){const{schemaId:Me}=this.opts,ee=new d.SchemaEnv({schema:{},schemaId:Me});if(ge=d.resolveSchema.call(this,ee,oe),!ge)return;this.refs[oe]=ge}return ge.validate||this._compileSchemaEnv(ge)}removeSchema(oe){if(oe instanceof RegExp)return this._removeAllSchemas(this.schemas,oe),this._removeAllSchemas(this.refs,oe),this;switch(typeof oe){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const ge=ae.call(this,oe);return typeof ge=="object"&&this._cache.delete(ge.schema),delete this.schemas[oe],delete this.refs[oe],this}case"object":{const ge=oe;this._cache.delete(ge);let Me=oe[this.opts.schemaId];return Me&&(Me=(0,m.normalizeId)(Me),delete this.schemas[Me],delete this.refs[Me]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(oe){for(const ge of oe)this.addKeyword(ge);return this}addKeyword(oe,ge){let Me;if(typeof oe=="string")Me=oe,typeof ge=="object"&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),ge.keyword=Me);else if(typeof oe=="object"&&ge===void 0){if(ge=oe,Me=ge.keyword,Array.isArray(Me)&&!Me.length)throw new Error("addKeywords: keyword must be string or non-empty array")}else throw new Error("invalid addKeywords parameters");if(Z.call(this,Me,ge),!ge)return(0,w.eachItem)(Me,ue=>$e.call(this,ue)),this;rt.call(this,ge);const ee={...ge,type:(0,b.getJSONTypes)(ge.type),schemaType:(0,b.getJSONTypes)(ge.schemaType)};return(0,w.eachItem)(Me,ee.type.length===0?ue=>$e.call(this,ue,ee):ue=>ee.type.forEach(Je=>$e.call(this,ue,ee,Je))),this}getKeyword(oe){const ge=this.RULES.all[oe];return typeof ge=="object"?ge.definition:!!ge}removeKeyword(oe){const{RULES:ge}=this;delete ge.keywords[oe],delete ge.all[oe];for(const Me of ge.rules){const ee=Me.rules.findIndex(ue=>ue.keyword===oe);ee>=0&&Me.rules.splice(ee,1)}return this}addFormat(oe,ge){return typeof ge=="string"&&(ge=new RegExp(ge)),this.formats[oe]=ge,this}errorsText(oe=this.errors,{separator:ge=", ",dataVar:Me="data"}={}){return!oe||oe.length===0?"No errors":oe.map(ee=>`${Me}${ee.instancePath} ${ee.message}`).reduce((ee,ue)=>ee+ge+ue)}$dataMetaSchema(oe,ge){const Me=this.RULES.all;oe=JSON.parse(JSON.stringify(oe));for(const ee of ge){const ue=ee.split("/").slice(1);let Je=oe;for(const wt of ue)Je=Je[wt];for(const wt in Me){const pt=Me[wt];if(typeof pt!="object")continue;const{$data:Xe}=pt.definition,Bt=Je[wt];Xe&&Bt&&(Je[wt]=it(Bt))}}return oe}_removeAllSchemas(oe,ge){for(const Me in oe){const ee=oe[Me];(!ge||ge.test(Me))&&(typeof ee=="string"?delete oe[Me]:ee&&!ee.meta&&(this._cache.delete(ee.schema),delete oe[Me]))}}_addSchema(oe,ge,Me,ee=this.opts.validateSchema,ue=this.opts.addUsedSchema){let Je;const{schemaId:wt}=this.opts;if(typeof oe=="object")Je=oe[wt];else{if(this.opts.jtd)throw new Error("schema must be object");if(typeof oe!="boolean")throw new Error("schema must be object or boolean")}let pt=this._cache.get(oe);if(pt!==void 0)return pt;Me=(0,m.normalizeId)(Je||Me);const Xe=m.getSchemaRefs.call(this,oe,Me);return pt=new d.SchemaEnv({schema:oe,schemaId:wt,meta:ge,baseId:Me,localRefs:Xe}),this._cache.set(pt.schema,pt),ue&&!Me.startsWith("#")&&(Me&&this._checkUnique(Me),this.refs[Me]=pt),ee&&this.validateSchema(oe,!0),pt}_checkUnique(oe){if(this.schemas[oe]||this.refs[oe])throw new Error(`schema with key or id "${oe}" already exists`)}_compileSchemaEnv(oe){if(oe.meta?this._compileMetaSchema(oe):d.compileSchema.call(this,oe),!oe.validate)throw new Error("ajv implementation error");return oe.validate}_compileMetaSchema(oe){const ge=this.opts;this.opts=this._metaOpts;try{d.compileSchema.call(this,oe)}finally{this.opts=ge}}}o.default=J,J.ValidationError=l.default,J.MissingRefError=c.default;function Y(et,oe,ge,Me="error"){for(const ee in et){const ue=ee;ue in oe&&this.logger[Me](`${ge}: option ${ee}. ${et[ue]}`)}}function ae(et){return et=(0,m.normalizeId)(et),this.schemas[et]||this.refs[et]}function re(){const et=this.opts.schemas;if(et)if(Array.isArray(et))this.addSchema(et);else for(const oe in et)this.addSchema(et[oe],oe)}function ce(){for(const et in this.opts.formats){const oe=this.opts.formats[et];oe&&this.addFormat(et,oe)}}function ye(et){if(Array.isArray(et)){this.addVocabulary(et);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const oe in et){const ge=et[oe];ge.keyword||(ge.keyword=oe),this.addKeyword(ge)}}function Ae(){const et={...this.opts};for(const oe of P)delete et[oe];return et}const _t={log(){},warn(){},error(){}};function le(et){if(et===!1)return _t;if(et===void 0)return console;if(et.log&&et.warn&&et.error)return et;throw new Error("logger must implement log, warn and error methods")}const We=/^[a-z_$][a-z0-9_$:-]*$/i;function Z(et,oe){const{RULES:ge}=this;if((0,w.eachItem)(et,Me=>{if(ge.keywords[Me])throw new Error(`Keyword ${Me} is already defined`);if(!We.test(Me))throw new Error(`Keyword ${Me} has invalid name`)}),!!oe&&oe.$data&&!("code"in oe||"validate"in oe))throw new Error('$data keyword must have "code" or "validate" function')}function $e(et,oe,ge){var Me;const ee=oe==null?void 0:oe.post;if(ge&&ee)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:ue}=this;let Je=ee?ue.post:ue.rules.find(({type:pt})=>pt===ge);if(Je||(Je={type:ge,rules:[]},ue.rules.push(Je)),ue.keywords[et]=!0,!oe)return;const wt={keyword:et,definition:{...oe,type:(0,b.getJSONTypes)(oe.type),schemaType:(0,b.getJSONTypes)(oe.schemaType)}};oe.before?ct.call(this,Je,wt,oe.before):Je.rules.push(wt),ue.all[et]=wt,(Me=oe.implements)===null||Me===void 0||Me.forEach(pt=>this.addKeyword(pt))}function ct(et,oe,ge){const Me=et.rules.findIndex(ee=>ee.keyword===ge);Me>=0?et.rules.splice(Me,0,oe):(et.rules.push(oe),this.logger.warn(`rule ${ge} is not defined`))}function rt(et){let{metaSchema:oe}=et;oe!==void 0&&(et.$data&&this.opts.$data&&(oe=it(oe)),et.validateSchema=this.compile(oe,!0))}const $t={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function it(et){return{anyOf:[et,$t]}}})(b_);var Df={},Rf={},Lf={};Object.defineProperty(Lf,"__esModule",{value:!0});const Qb={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};Lf.default=Qb;var Ws={};Object.defineProperty(Ws,"__esModule",{value:!0});Ws.callRef=Ws.getValidate=void 0;const ex=sc,vm=zr,xn=Mr,Co=xa,bm=wn,mu=Zr,tx={keyword:"$ref",schemaType:"string",code(o){const{gen:r,schema:a,it:l}=o,{baseId:c,schemaEnv:f,validateName:d,opts:n,self:m}=l,{root:b}=f;if((a==="#"||a==="#/")&&c===b.baseId)return S();const w=bm.resolveRef.call(m,b,c,a);if(w===void 0)throw new ex.default(l.opts.uriResolver,c,a);if(w instanceof bm.SchemaEnv)return k(w);return A(w);function S(){if(f===b)return Su(o,d,f,f.$async);const P=r.scopeValue("root",{ref:b});return Su(o,(0,xn._)`${P}.validate`,b,b.$async)}function k(P){const T=Z_(o,P);Su(o,T,P,P.$async)}function A(P){const T=r.scopeValue("schema",n.code.source===!0?{ref:P,code:(0,xn.stringify)(P)}:{ref:P}),L=r.name("valid"),D=o.subschema({schema:P,dataTypes:[],schemaPath:xn.nil,topSchemaRef:T,errSchemaPath:a},L);o.mergeEvaluated(D),o.ok(L)}}};function Z_(o,r){const{gen:a}=o;return r.validate?a.scopeValue("validate",{ref:r.validate}):(0,xn._)`${a.scopeValue("wrapper",{ref:r})}.validate`}Ws.getValidate=Z_;function Su(o,r,a,l){const{gen:c,it:f}=o,{allErrors:d,schemaEnv:n,opts:m}=f,b=m.passContext?Co.default.this:xn.nil;l?w():S();function w(){if(!n.$async)throw new Error("async schema referenced by sync schema");const P=c.let("valid");c.try(()=>{c.code((0,xn._)`await ${(0,vm.callValidateCode)(o,r,b)}`),A(r),d||c.assign(P,!0)},T=>{c.if((0,xn._)`!(${T} instanceof ${f.ValidationError})`,()=>c.throw(T)),k(T),d||c.assign(P,!1)}),o.ok(P)}function S(){o.result((0,vm.callValidateCode)(o,r,b),()=>A(r),()=>k(r))}function k(P){const T=(0,xn._)`${P}.errors`;c.assign(Co.default.vErrors,(0,xn._)`${Co.default.vErrors} === null ? ${T} : ${Co.default.vErrors}.concat(${T})`),c.assign(Co.default.errors,(0,xn._)`${Co.default.vErrors}.length`)}function A(P){var T;if(!f.opts.unevaluated)return;const L=(T=a==null?void 0:a.validate)===null||T===void 0?void 0:T.evaluated;if(f.props!==!0)if(L&&!L.dynamicProps)L.props!==void 0&&(f.props=mu.mergeEvaluated.props(c,L.props,f.props));else{const D=c.var("props",(0,xn._)`${P}.evaluated.props`);f.props=mu.mergeEvaluated.props(c,D,f.props,xn.Name)}if(f.items!==!0)if(L&&!L.dynamicItems)L.items!==void 0&&(f.items=mu.mergeEvaluated.items(c,L.items,f.items));else{const D=c.var("items",(0,xn._)`${P}.evaluated.items`);f.items=mu.mergeEvaluated.items(c,D,f.items,xn.Name)}}}Ws.callRef=Su;Ws.default=tx;Object.defineProperty(Rf,"__esModule",{value:!0});const rx=Lf,ix=Ws,nx=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",rx.default,ix.default];Rf.default=nx;var Bf={},Of={};Object.defineProperty(Of,"__esModule",{value:!0});const Mu=Mr,ns=Mu.operators,Du={maximum:{okStr:"<=",ok:ns.LTE,fail:ns.GT},minimum:{okStr:">=",ok:ns.GTE,fail:ns.LT},exclusiveMaximum:{okStr:"<",ok:ns.LT,fail:ns.GTE},exclusiveMinimum:{okStr:">",ok:ns.GT,fail:ns.LTE}},ax={message:({keyword:o,schemaCode:r})=>(0,Mu.str)`must be ${Du[o].okStr} ${r}`,params:({keyword:o,schemaCode:r})=>(0,Mu._)`{comparison: ${Du[o].okStr}, limit: ${r}}`},sx={keyword:Object.keys(Du),type:"number",schemaType:"number",$data:!0,error:ax,code(o){const{keyword:r,data:a,schemaCode:l}=o;o.fail$data((0,Mu._)`${a} ${Du[r].fail} ${l} || isNaN(${a})`)}};Of.default=sx;var Ff={};Object.defineProperty(Ff,"__esModule",{value:!0});const Wl=Mr,ox={message:({schemaCode:o})=>(0,Wl.str)`must be multiple of ${o}`,params:({schemaCode:o})=>(0,Wl._)`{multipleOf: ${o}}`},lx={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:ox,code(o){const{gen:r,data:a,schemaCode:l,it:c}=o,f=c.opts.multipleOfPrecision,d=r.let("res"),n=f?(0,Wl._)`Math.abs(Math.round(${d}) - ${d}) > 1e-${f}`:(0,Wl._)`${d} !== parseInt(${d})`;o.fail$data((0,Wl._)`(${l} === 0 || (${d} = ${a}/${l}, ${n}))`)}};Ff.default=lx;var Nf={},Uf={};Object.defineProperty(Uf,"__esModule",{value:!0});function H_(o){const r=o.length;let a=0,l=0,c;for(;l=55296&&c<=56319&&l(0,$s._)`{limit: ${o}}`},fx={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:hx,code(o){const{keyword:r,data:a,schemaCode:l,it:c}=o,f=r==="maxLength"?$s.operators.GT:$s.operators.LT,d=c.opts.unicode===!1?(0,$s._)`${a}.length`:(0,$s._)`${(0,cx.useFunc)(o.gen,ux.default)}(${a})`;o.fail$data((0,$s._)`${d} ${f} ${l}`)}};Nf.default=fx;var Vf={};Object.defineProperty(Vf,"__esModule",{value:!0});const dx=zr,Ru=Mr,px={message:({schemaCode:o})=>(0,Ru.str)`must match pattern "${o}"`,params:({schemaCode:o})=>(0,Ru._)`{pattern: ${o}}`},mx={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:px,code(o){const{data:r,$data:a,schema:l,schemaCode:c,it:f}=o,d=f.opts.unicodeRegExp?"u":"",n=a?(0,Ru._)`(new RegExp(${c}, ${d}))`:(0,dx.usePattern)(o,l);o.fail$data((0,Ru._)`!${n}.test(${r})`)}};Vf.default=mx;var $f={};Object.defineProperty($f,"__esModule",{value:!0});const Kl=Mr,gx={message({keyword:o,schemaCode:r}){const a=o==="maxProperties"?"more":"fewer";return(0,Kl.str)`must NOT have ${a} than ${r} properties`},params:({schemaCode:o})=>(0,Kl._)`{limit: ${o}}`},_x={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:gx,code(o){const{keyword:r,data:a,schemaCode:l}=o,c=r==="maxProperties"?Kl.operators.GT:Kl.operators.LT;o.fail$data((0,Kl._)`Object.keys(${a}).length ${c} ${l}`)}};$f.default=_x;var jf={};Object.defineProperty(jf,"__esModule",{value:!0});const Vl=zr,Xl=Mr,yx=Zr,vx={message:({params:{missingProperty:o}})=>(0,Xl.str)`must have required property '${o}'`,params:({params:{missingProperty:o}})=>(0,Xl._)`{missingProperty: ${o}}`},bx={keyword:"required",type:"object",schemaType:"array",$data:!0,error:vx,code(o){const{gen:r,schema:a,schemaCode:l,data:c,$data:f,it:d}=o,{opts:n}=d;if(!f&&a.length===0)return;const m=a.length>=n.loopRequired;if(d.allErrors?b():w(),n.strictRequired){const A=o.parentSchema.properties,{definedProperties:P}=o.it;for(const T of a)if((A==null?void 0:A[T])===void 0&&!P.has(T)){const L=d.schemaEnv.baseId+d.errSchemaPath,D=`required property "${T}" is not defined at "${L}" (strictRequired)`;(0,yx.checkStrictMode)(d,D,d.opts.strictRequired)}}function b(){if(m||f)o.block$data(Xl.nil,S);else for(const A of a)(0,Vl.checkReportMissingProp)(o,A)}function w(){const A=r.let("missing");if(m||f){const P=r.let("valid",!0);o.block$data(P,()=>k(A,P)),o.ok(P)}else r.if((0,Vl.checkMissingProp)(o,a,A)),(0,Vl.reportMissingProp)(o,A),r.else()}function S(){r.forOf("prop",l,A=>{o.setParams({missingProperty:A}),r.if((0,Vl.noPropertyInData)(r,c,A,n.ownProperties),()=>o.error())})}function k(A,P){o.setParams({missingProperty:A}),r.forOf(A,l,()=>{r.assign(P,(0,Vl.propertyInData)(r,c,A,n.ownProperties)),r.if((0,Xl.not)(P),()=>{o.error(),r.break()})},Xl.nil)}}};jf.default=bx;var qf={};Object.defineProperty(qf,"__esModule",{value:!0});const Jl=Mr,xx={message({keyword:o,schemaCode:r}){const a=o==="maxItems"?"more":"fewer";return(0,Jl.str)`must NOT have ${a} than ${r} items`},params:({schemaCode:o})=>(0,Jl._)`{limit: ${o}}`},wx={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:xx,code(o){const{keyword:r,data:a,schemaCode:l}=o,c=r==="maxItems"?Jl.operators.GT:Jl.operators.LT;o.fail$data((0,Jl._)`${a}.length ${c} ${l}`)}};qf.default=wx;var Gf={},oc={};Object.defineProperty(oc,"__esModule",{value:!0});const W_=C_;W_.code='require("ajv/dist/runtime/equal").default';oc.default=W_;Object.defineProperty(Gf,"__esModule",{value:!0});const nf=nc,Ki=Mr,Ex=Zr,kx=oc,Sx={message:({params:{i:o,j:r}})=>(0,Ki.str)`must NOT have duplicate items (items ## ${r} and ${o} are identical)`,params:({params:{i:o,j:r}})=>(0,Ki._)`{i: ${o}, j: ${r}}`},Tx={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:Sx,code(o){const{gen:r,data:a,$data:l,schema:c,parentSchema:f,schemaCode:d,it:n}=o;if(!l&&!c)return;const m=r.let("valid"),b=f.items?(0,nf.getSchemaTypes)(f.items):[];o.block$data(m,w,(0,Ki._)`${d} === false`),o.ok(m);function w(){const P=r.let("i",(0,Ki._)`${a}.length`),T=r.let("j");o.setParams({i:P,j:T}),r.assign(m,!0),r.if((0,Ki._)`${P} > 1`,()=>(S()?k:A)(P,T))}function S(){return b.length>0&&!b.some(P=>P==="object"||P==="array")}function k(P,T){const L=r.name("item"),D=(0,nf.checkDataTypes)(b,L,n.opts.strictNumbers,nf.DataType.Wrong),B=r.const("indices",(0,Ki._)`{}`);r.for((0,Ki._)`;${P}--;`,()=>{r.let(L,(0,Ki._)`${a}[${P}]`),r.if(D,(0,Ki._)`continue`),b.length>1&&r.if((0,Ki._)`typeof ${L} == "string"`,(0,Ki._)`${L} += "_"`),r.if((0,Ki._)`typeof ${B}[${L}] == "number"`,()=>{r.assign(T,(0,Ki._)`${B}[${L}]`),o.error(),r.assign(m,!1).break()}).code((0,Ki._)`${B}[${L}] = ${P}`)})}function A(P,T){const L=(0,Ex.useFunc)(r,kx.default),D=r.name("outer");r.label(D).for((0,Ki._)`;${P}--;`,()=>r.for((0,Ki._)`${T} = ${P}; ${T}--;`,()=>r.if((0,Ki._)`${L}(${a}[${P}], ${a}[${T}])`,()=>{o.error(),r.assign(m,!1).break(D)})))}}};Gf.default=Tx;var Zf={};Object.defineProperty(Zf,"__esModule",{value:!0});const gf=Mr,Ix=Zr,Cx=oc,Ax={message:"must be equal to constant",params:({schemaCode:o})=>(0,gf._)`{allowedValue: ${o}}`},Px={keyword:"const",$data:!0,error:Ax,code(o){const{gen:r,data:a,$data:l,schemaCode:c,schema:f}=o;l||f&&typeof f=="object"?o.fail$data((0,gf._)`!${(0,Ix.useFunc)(r,Cx.default)}(${a}, ${c})`):o.fail((0,gf._)`${f} !== ${a}`)}};Zf.default=Px;var Hf={};Object.defineProperty(Hf,"__esModule",{value:!0});const Gl=Mr,zx=Zr,Mx=oc,Dx={message:"must be equal to one of the allowed values",params:({schemaCode:o})=>(0,Gl._)`{allowedValues: ${o}}`},Rx={keyword:"enum",schemaType:"array",$data:!0,error:Dx,code(o){const{gen:r,data:a,$data:l,schema:c,schemaCode:f,it:d}=o;if(!l&&c.length===0)throw new Error("enum must have non-empty array");const n=c.length>=d.opts.loopEnum;let m;const b=()=>m??(m=(0,zx.useFunc)(r,Mx.default));let w;if(n||l)w=r.let("valid"),o.block$data(w,S);else{if(!Array.isArray(c))throw new Error("ajv implementation error");const A=r.const("vSchema",f);w=(0,Gl.or)(...c.map((P,T)=>k(A,T)))}o.pass(w);function S(){r.assign(w,!1),r.forOf("v",f,A=>r.if((0,Gl._)`${b()}(${a}, ${A})`,()=>r.assign(w,!0).break()))}function k(A,P){const T=c[P];return typeof T=="object"&&T!==null?(0,Gl._)`${b()}(${a}, ${A}[${P}])`:(0,Gl._)`${a} === ${T}`}}};Hf.default=Rx;Object.defineProperty(Bf,"__esModule",{value:!0});const Lx=Of,Bx=Ff,Ox=Nf,Fx=Vf,Nx=$f,Ux=jf,Vx=qf,$x=Gf,jx=Zf,qx=Hf,Gx=[Lx.default,Bx.default,Ox.default,Fx.default,Nx.default,Ux.default,Vx.default,$x.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},jx.default,qx.default];Bf.default=Gx;var Wf={},jo={};Object.defineProperty(jo,"__esModule",{value:!0});jo.validateAdditionalItems=void 0;const js=Mr,_f=Zr,Zx={message:({params:{len:o}})=>(0,js.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,js._)`{limit: ${o}}`},Hx={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:Zx,code(o){const{parentSchema:r,it:a}=o,{items:l}=r;if(!Array.isArray(l)){(0,_f.checkStrictMode)(a,'"additionalItems" is ignored when "items" is not an array of schemas');return}K_(o,l)}};function K_(o,r){const{gen:a,schema:l,data:c,keyword:f,it:d}=o;d.items=!0;const n=a.const("len",(0,js._)`${c}.length`);if(l===!1)o.setParams({len:r.length}),o.pass((0,js._)`${n} <= ${r.length}`);else if(typeof l=="object"&&!(0,_f.alwaysValidSchema)(d,l)){const b=a.var("valid",(0,js._)`${n} <= ${r.length}`);a.if((0,js.not)(b),()=>m(b)),o.ok(b)}function m(b){a.forRange("i",r.length,n,w=>{o.subschema({keyword:f,dataProp:w,dataPropType:_f.Type.Num},b),d.allErrors||a.if((0,js.not)(b),()=>a.break())})}}jo.validateAdditionalItems=K_;jo.default=Hx;var Kf={},qo={};Object.defineProperty(qo,"__esModule",{value:!0});qo.validateTuple=void 0;const xm=Mr,Tu=Zr,Wx=zr,Kx={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(o){const{schema:r,it:a}=o;if(Array.isArray(r))return X_(o,"additionalItems",r);a.items=!0,!(0,Tu.alwaysValidSchema)(a,r)&&o.ok((0,Wx.validateArray)(o))}};function X_(o,r,a=o.schema){const{gen:l,parentSchema:c,data:f,keyword:d,it:n}=o;w(c),n.opts.unevaluated&&a.length&&n.items!==!0&&(n.items=Tu.mergeEvaluated.items(l,a.length,n.items));const m=l.name("valid"),b=l.const("len",(0,xm._)`${f}.length`);a.forEach((S,k)=>{(0,Tu.alwaysValidSchema)(n,S)||(l.if((0,xm._)`${b} > ${k}`,()=>o.subschema({keyword:d,schemaProp:k,dataProp:k},m)),o.ok(m))});function w(S){const{opts:k,errSchemaPath:A}=n,P=a.length,T=P===S.minItems&&(P===S.maxItems||S[r]===!1);if(k.strictTuples&&!T){const L=`"${d}" is ${P}-tuple, but minItems or maxItems/${r} are not specified or different at path "${A}"`;(0,Tu.checkStrictMode)(n,L,k.strictTuples)}}}qo.validateTuple=X_;qo.default=Kx;Object.defineProperty(Kf,"__esModule",{value:!0});const Xx=qo,Jx={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:o=>(0,Xx.validateTuple)(o,"items")};Kf.default=Jx;var Xf={};Object.defineProperty(Xf,"__esModule",{value:!0});const wm=Mr,Yx=Zr,Qx=zr,ew=jo,tw={message:({params:{len:o}})=>(0,wm.str)`must NOT have more than ${o} items`,params:({params:{len:o}})=>(0,wm._)`{limit: ${o}}`},rw={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:tw,code(o){const{schema:r,parentSchema:a,it:l}=o,{prefixItems:c}=a;l.items=!0,!(0,Yx.alwaysValidSchema)(l,r)&&(c?(0,ew.validateAdditionalItems)(o,c):o.ok((0,Qx.validateArray)(o)))}};Xf.default=rw;var Jf={};Object.defineProperty(Jf,"__esModule",{value:!0});const Fn=Mr,gu=Zr,iw={message:({params:{min:o,max:r}})=>r===void 0?(0,Fn.str)`must contain at least ${o} valid item(s)`:(0,Fn.str)`must contain at least ${o} and no more than ${r} valid item(s)`,params:({params:{min:o,max:r}})=>r===void 0?(0,Fn._)`{minContains: ${o}}`:(0,Fn._)`{minContains: ${o}, maxContains: ${r}}`},nw={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:iw,code(o){const{gen:r,schema:a,parentSchema:l,data:c,it:f}=o;let d,n;const{minContains:m,maxContains:b}=l;f.opts.next?(d=m===void 0?1:m,n=b):d=1;const w=r.const("len",(0,Fn._)`${c}.length`);if(o.setParams({min:d,max:n}),n===void 0&&d===0){(0,gu.checkStrictMode)(f,'"minContains" == 0 without "maxContains": "contains" keyword ignored');return}if(n!==void 0&&d>n){(0,gu.checkStrictMode)(f,'"minContains" > "maxContains" is always invalid'),o.fail();return}if((0,gu.alwaysValidSchema)(f,a)){let T=(0,Fn._)`${w} >= ${d}`;n!==void 0&&(T=(0,Fn._)`${T} && ${w} <= ${n}`),o.pass(T);return}f.items=!0;const S=r.name("valid");n===void 0&&d===1?A(S,()=>r.if(S,()=>r.break())):d===0?(r.let(S,!0),n!==void 0&&r.if((0,Fn._)`${c}.length > 0`,k)):(r.let(S,!1),k()),o.result(S,()=>o.reset());function k(){const T=r.name("_valid"),L=r.let("count",0);A(T,()=>r.if(T,()=>P(L)))}function A(T,L){r.forRange("i",0,w,D=>{o.subschema({keyword:"contains",dataProp:D,dataPropType:gu.Type.Num,compositeRule:!0},T),L()})}function P(T){r.code((0,Fn._)`${T}++`),n===void 0?r.if((0,Fn._)`${T} >= ${d}`,()=>r.assign(S,!0).break()):(r.if((0,Fn._)`${T} > ${n}`,()=>r.assign(S,!1).break()),d===1?r.assign(S,!0):r.if((0,Fn._)`${T} >= ${d}`,()=>r.assign(S,!0)))}}};Jf.default=nw;var J_={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.validateSchemaDeps=o.validatePropertyDeps=o.error=void 0;const r=Mr,a=Zr,l=zr;o.error={message:({params:{property:m,depsCount:b,deps:w}})=>{const S=b===1?"property":"properties";return(0,r.str)`must have ${S} ${w} when property ${m} is present`},params:({params:{property:m,depsCount:b,deps:w,missingProperty:S}})=>(0,r._)`{property: ${m}, missingProperty: ${S}, depsCount: ${b}, - deps: ${w}}`};const c={keyword:"dependencies",type:"object",schemaType:"object",error:o.error,code(m){const[b,w]=f(m);d(m,b),n(m,w)}};function f({schema:m}){const b={},w={};for(const S in m){if(S==="__proto__")continue;const k=Array.isArray(m[S])?b:w;k[S]=m[S]}return[b,w]}function d(m,b=m.schema){const{gen:w,data:S,it:k}=m;if(Object.keys(b).length===0)return;const A=w.let("missing");for(const P in b){const T=b[P];if(T.length===0)continue;const L=(0,l.propertyInData)(w,S,P,k.opts.ownProperties);m.setParams({property:P,depsCount:T.length,deps:T.join(", ")}),k.allErrors?w.if(L,()=>{for(const D of T)(0,l.checkReportMissingProp)(m,D)}):(w.if((0,r._)`${L} && (${(0,l.checkMissingProp)(m,T,A)})`),(0,l.reportMissingProp)(m,A),w.else())}}o.validatePropertyDeps=d;function n(m,b=m.schema){const{gen:w,data:S,keyword:k,it:A}=m,P=w.name("valid");for(const T in b)(0,s.alwaysValidSchema)(A,b[T])||(w.if((0,l.propertyInData)(w,S,T,A.opts.ownProperties),()=>{const L=m.subschema({keyword:k,schemaProp:T},P);m.mergeValidEvaluated(L,P)},()=>w.var(P,!0)),m.ok(P))}o.validateSchemaDeps=n,o.default=c})(Q_);var Qf={};Object.defineProperty(Qf,"__esModule",{value:!0});const ey=Mr,aw=Zr,ow={message:"property name must be valid",params:({params:o})=>(0,ey._)`{propertyName: ${o.propertyName}}`},lw={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:ow,code(o){const{gen:r,schema:s,data:l,it:c}=o;if((0,aw.alwaysValidSchema)(c,s))return;const f=r.name("valid");r.forIn("key",l,d=>{o.setParams({propertyName:d}),o.subschema({keyword:"propertyNames",data:d,dataTypes:["string"],propertyName:d,compositeRule:!0},f),r.if((0,ey.not)(f),()=>{o.error(!0),c.allErrors||r.break()})}),o.ok(f)}};Qf.default=lw;var Hu={};Object.defineProperty(Hu,"__esModule",{value:!0});const yu=zr,rs=Mr,cw=xs,vu=Zr,uw={message:"must NOT have additional properties",params:({params:o})=>(0,rs._)`{additionalProperty: ${o.additionalProperty}}`},hw={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:uw,code(o){const{gen:r,schema:s,parentSchema:l,data:c,errsCount:f,it:d}=o;if(!f)throw new Error("ajv implementation error");const{allErrors:n,opts:m}=d;if(d.props=!0,m.removeAdditional!=="all"&&(0,vu.alwaysValidSchema)(d,s))return;const b=(0,yu.allSchemaProperties)(l.properties),w=(0,yu.allSchemaProperties)(l.patternProperties);S(),o.ok((0,rs._)`${f} === ${cw.default.errors}`);function S(){r.forIn("key",c,L=>{!b.length&&!w.length?P(L):r.if(k(L),()=>P(L))})}function k(L){let D;if(b.length>8){const B=(0,vu.schemaRefOrVal)(d,l.properties,"properties");D=(0,yu.isOwnProperty)(r,B,L)}else b.length?D=(0,rs.or)(...b.map(B=>(0,rs._)`${L} === ${B}`)):D=rs.nil;return w.length&&(D=(0,rs.or)(D,...w.map(B=>(0,rs._)`${(0,yu.usePattern)(o,B)}.test(${L})`))),(0,rs.not)(D)}function A(L){r.code((0,rs._)`delete ${c}[${L}]`)}function P(L){if(m.removeAdditional==="all"||m.removeAdditional&&s===!1){A(L);return}if(s===!1){o.setParams({additionalProperty:L}),o.error(),n||r.break();return}if(typeof s=="object"&&!(0,vu.alwaysValidSchema)(d,s)){const D=r.name("valid");m.removeAdditional==="failing"?(T(L,D,!1),r.if((0,rs.not)(D),()=>{o.reset(),A(L)})):(T(L,D),n||r.if((0,rs.not)(D),()=>r.break()))}}function T(L,D,B){const $={keyword:"additionalProperties",dataProp:L,dataPropType:vu.Type.Str};B===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),o.subschema($,D)}}};Hu.default=hw;var ed={};Object.defineProperty(ed,"__esModule",{value:!0});const fw=ns,km=zr,af=Zr,Sm=Hu,dw={keyword:"properties",type:"object",schemaType:"object",code(o){const{gen:r,schema:s,parentSchema:l,data:c,it:f}=o;f.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&Sm.default.code(new fw.KeywordCxt(f,Sm.default,"additionalProperties"));const d=(0,km.allSchemaProperties)(s);for(const S of d)f.definedProperties.add(S);f.opts.unevaluated&&d.length&&f.props!==!0&&(f.props=af.mergeEvaluated.props(r,(0,af.toHash)(d),f.props));const n=d.filter(S=>!(0,af.alwaysValidSchema)(f,s[S]));if(n.length===0)return;const m=r.name("valid");for(const S of n)b(S)?w(S):(r.if((0,km.propertyInData)(r,c,S,f.opts.ownProperties)),w(S),f.allErrors||r.else().var(m,!0),r.endIf()),o.it.definedProperties.add(S),o.ok(m);function b(S){return f.opts.useDefaults&&!f.compositeRule&&s[S].default!==void 0}function w(S){o.subschema({keyword:"properties",schemaProp:S,dataProp:S},m)}}};ed.default=dw;var td={};Object.defineProperty(td,"__esModule",{value:!0});const Tm=zr,bu=Mr,Im=Zr,Cm=Zr,pw={keyword:"patternProperties",type:"object",schemaType:"object",code(o){const{gen:r,schema:s,data:l,parentSchema:c,it:f}=o,{opts:d}=f,n=(0,Tm.allSchemaProperties)(s),m=n.filter(T=>(0,Im.alwaysValidSchema)(f,s[T]));if(n.length===0||m.length===n.length&&(!f.opts.unevaluated||f.props===!0))return;const b=d.strictSchema&&!d.allowMatchingProperties&&c.properties,w=r.name("valid");f.props!==!0&&!(f.props instanceof bu.Name)&&(f.props=(0,Cm.evaluatedPropsToName)(r,f.props));const{props:S}=f;k();function k(){for(const T of n)b&&A(T),f.allErrors?P(T):(r.var(w,!0),P(T),r.if(w))}function A(T){for(const L in b)new RegExp(T).test(L)&&(0,Im.checkStrictMode)(f,`property ${L} matches pattern ${T} (use allowMatchingProperties)`)}function P(T){r.forIn("key",l,L=>{r.if((0,bu._)`${(0,Tm.usePattern)(o,T)}.test(${L})`,()=>{const D=m.includes(T);D||o.subschema({keyword:"patternProperties",schemaProp:T,dataProp:L,dataPropType:Cm.Type.Str},w),f.opts.unevaluated&&S!==!0?r.assign((0,bu._)`${S}[${L}]`,!0):!D&&!f.allErrors&&r.if((0,bu.not)(w),()=>r.break())})})}}};td.default=pw;var rd={};Object.defineProperty(rd,"__esModule",{value:!0});const mw=Zr,gw={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){const{gen:r,schema:s,it:l}=o;if((0,mw.alwaysValidSchema)(l,s)){o.fail();return}const c=r.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),o.failResult(c,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};rd.default=gw;var id={};Object.defineProperty(id,"__esModule",{value:!0});const _w=zr,yw={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:_w.validateUnion,error:{message:"must match a schema in anyOf"}};id.default=yw;var nd={};Object.defineProperty(nd,"__esModule",{value:!0});const Cu=Mr,vw=Zr,bw={message:"must match exactly one schema in oneOf",params:({params:o})=>(0,Cu._)`{passingSchemas: ${o.passing}}`},xw={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:bw,code(o){const{gen:r,schema:s,parentSchema:l,it:c}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");if(c.opts.discriminator&&l.discriminator)return;const f=s,d=r.let("valid",!1),n=r.let("passing",null),m=r.name("_valid");o.setParams({passing:n}),r.block(b),o.result(d,()=>o.reset(),()=>o.error(!0));function b(){f.forEach((w,S)=>{let k;(0,vw.alwaysValidSchema)(c,w)?r.var(m,!0):k=o.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},m),S>0&&r.if((0,Cu._)`${m} && ${d}`).assign(d,!1).assign(n,(0,Cu._)`[${n}, ${S}]`).else(),r.if(m,()=>{r.assign(d,!0),r.assign(n,S),k&&o.mergeEvaluated(k,Cu.Name)})})}}};nd.default=xw;var sd={};Object.defineProperty(sd,"__esModule",{value:!0});const ww=Zr,Ew={keyword:"allOf",schemaType:"array",code(o){const{gen:r,schema:s,it:l}=o;if(!Array.isArray(s))throw new Error("ajv implementation error");const c=r.name("valid");s.forEach((f,d)=>{if((0,ww.alwaysValidSchema)(l,f))return;const n=o.subschema({keyword:"allOf",schemaProp:d},c);o.ok(c),o.mergeEvaluated(n)})}};sd.default=Ew;var ad={};Object.defineProperty(ad,"__esModule",{value:!0});const Bu=Mr,ty=Zr,kw={message:({params:o})=>(0,Bu.str)`must match "${o.ifClause}" schema`,params:({params:o})=>(0,Bu._)`{failingKeyword: ${o.ifClause}}`},Sw={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:kw,code(o){const{gen:r,parentSchema:s,it:l}=o;s.then===void 0&&s.else===void 0&&(0,ty.checkStrictMode)(l,'"if" without "then" and "else" is ignored');const c=Am(l,"then"),f=Am(l,"else");if(!c&&!f)return;const d=r.let("valid",!0),n=r.name("_valid");if(m(),o.reset(),c&&f){const w=r.let("ifClause");o.setParams({ifClause:w}),r.if(n,b("then",w),b("else",w))}else c?r.if(n,b("then")):r.if((0,Bu.not)(n),b("else"));o.pass(d,()=>o.error(!0));function m(){const w=o.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},n);o.mergeEvaluated(w)}function b(w,S){return()=>{const k=o.subschema({keyword:w},n);r.assign(d,n),o.mergeValidEvaluated(k,d),S?r.assign(S,(0,Bu._)`${w}`):o.setParams({ifClause:w})}}}};function Am(o,r){const s=o.schema[r];return s!==void 0&&!(0,ty.alwaysValidSchema)(o,s)}ad.default=Sw;var od={};Object.defineProperty(od,"__esModule",{value:!0});const Tw=Zr,Iw={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:r,it:s}){r.if===void 0&&(0,Tw.checkStrictMode)(s,`"${o}" without "if" is ignored`)}};od.default=Iw;Object.defineProperty(Kf,"__esModule",{value:!0});const Cw=qo,Aw=Xf,Pw=Go,zw=Jf,Mw=Yf,Dw=Q_,Rw=Qf,Lw=Hu,Bw=ed,Ow=td,Fw=rd,Nw=id,Uw=nd,Vw=sd,$w=ad,jw=od;function qw(o=!1){const r=[Fw.default,Nw.default,Uw.default,Vw.default,$w.default,jw.default,Rw.default,Lw.default,Dw.default,Bw.default,Ow.default];return o?r.push(Aw.default,zw.default):r.push(Cw.default,Pw.default),r.push(Mw.default),r}Kf.default=qw;var ld={},cd={};Object.defineProperty(cd,"__esModule",{value:!0});const Ii=Mr,Gw={message:({schemaCode:o})=>(0,Ii.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,Ii._)`{format: ${o}}`},Zw={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:Gw,code(o,r){const{gen:s,data:l,$data:c,schema:f,schemaCode:d,it:n}=o,{opts:m,errSchemaPath:b,schemaEnv:w,self:S}=n;if(!m.validateFormats)return;c?k():A();function k(){const P=s.scopeValue("formats",{ref:S.formats,code:m.code.formats}),T=s.const("fDef",(0,Ii._)`${P}[${d}]`),L=s.let("fType"),D=s.let("format");s.if((0,Ii._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>s.assign(L,(0,Ii._)`${T}.type || "string"`).assign(D,(0,Ii._)`${T}.validate`),()=>s.assign(L,(0,Ii._)`"string"`).assign(D,T)),o.fail$data((0,Ii.or)(B(),$()));function B(){return m.strictSchema===!1?Ii.nil:(0,Ii._)`${d} && !${D}`}function $(){const J=w.$async?(0,Ii._)`(${T}.async ? await ${D}(${l}) : ${D}(${l}))`:(0,Ii._)`${D}(${l})`,Y=(0,Ii._)`(typeof ${D} == "function" ? ${J} : ${D}.test(${l}))`;return(0,Ii._)`${D} && ${D} !== true && ${L} === ${r} && !${Y}`}}function A(){const P=S.formats[f];if(!P){B();return}if(P===!0)return;const[T,L,D]=$(P);T===r&&o.pass(J());function B(){if(m.strictSchema===!1){S.logger.warn(Y());return}throw new Error(Y());function Y(){return`unknown format "${f}" ignored in schema at path "${b}"`}}function $(Y){const se=Y instanceof RegExp?(0,Ii.regexpCode)(Y):m.code.formats?(0,Ii._)`${m.code.formats}${(0,Ii.getProperty)(f)}`:void 0,re=s.scopeValue("formats",{key:f,ref:Y,code:se});return typeof Y=="object"&&!(Y instanceof RegExp)?[Y.type||"string",Y.validate,(0,Ii._)`${re}.validate`]:["string",Y,re]}function J(){if(typeof P=="object"&&!(P instanceof RegExp)&&P.async){if(!w.$async)throw new Error("async format in sync schema");return(0,Ii._)`await ${D}(${l})`}return typeof L=="function"?(0,Ii._)`${D}(${l})`:(0,Ii._)`${D}.test(${l})`}}}};cd.default=Zw;Object.defineProperty(ld,"__esModule",{value:!0});const Hw=cd,Ww=[Hw.default];ld.default=Ww;var $o={};Object.defineProperty($o,"__esModule",{value:!0});$o.contentVocabulary=$o.metadataVocabulary=void 0;$o.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];$o.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Rf,"__esModule",{value:!0});const Kw=Lf,Xw=Of,Jw=Kf,Yw=ld,Pm=$o,Qw=[Kw.default,Xw.default,(0,Jw.default)(),Yw.default,Pm.metadataVocabulary,Pm.contentVocabulary];Rf.default=Qw;var ud={},ry={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.DiscrError=void 0,function(r){r.Tag="tag",r.Mapping="mapping"}(o.DiscrError||(o.DiscrError={}))})(ry);Object.defineProperty(ud,"__esModule",{value:!0});const zo=Mr,vf=ry,zm=wn,e2=Zr,t2={message:({params:{discrError:o,tagName:r}})=>o===vf.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:o,tag:r,tagName:s}})=>(0,zo._)`{error: ${o}, tag: ${s}, tagValue: ${r}}`},r2={keyword:"discriminator",type:"object",schemaType:"object",error:t2,code(o){const{gen:r,data:s,schema:l,parentSchema:c,it:f}=o,{oneOf:d}=c;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");const n=l.propertyName;if(typeof n!="string")throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const m=r.let("valid",!1),b=r.const("tag",(0,zo._)`${s}${(0,zo.getProperty)(n)}`);r.if((0,zo._)`typeof ${b} == "string"`,()=>w(),()=>o.error(!1,{discrError:vf.DiscrError.Tag,tag:b,tagName:n})),o.ok(m);function w(){const A=k();r.if(!1);for(const P in A)r.elseIf((0,zo._)`${b} === ${P}`),r.assign(m,S(A[P]));r.else(),o.error(!1,{discrError:vf.DiscrError.Mapping,tag:b,tagName:n}),r.endIf()}function S(A){const P=r.name("valid"),T=o.subschema({keyword:"oneOf",schemaProp:A},P);return o.mergeEvaluated(T,zo.Name),P}function k(){var A;const P={},T=D(c);let L=!0;for(let J=0;Jthis.addVocabulary(P)),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const P=this.opts.$data?this.$dataMetaSchema(f,d):f;this.addMetaSchema(P,n,!1),this.refs["http://json-schema.org/schema"]=n}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}}o.exports=r=m,Object.defineProperty(r,"__esModule",{value:!0}),r.default=m;var b=ns;Object.defineProperty(r,"KeywordCxt",{enumerable:!0,get:function(){return b.KeywordCxt}});var w=Mr;Object.defineProperty(r,"_",{enumerable:!0,get:function(){return w._}}),Object.defineProperty(r,"str",{enumerable:!0,get:function(){return w.str}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return w.stringify}}),Object.defineProperty(r,"nil",{enumerable:!0,get:function(){return w.nil}}),Object.defineProperty(r,"Name",{enumerable:!0,get:function(){return w.Name}}),Object.defineProperty(r,"CodeGen",{enumerable:!0,get:function(){return w.CodeGen}});var S=ac;Object.defineProperty(r,"ValidationError",{enumerable:!0,get:function(){return S.default}});var k=oc;Object.defineProperty(r,"MissingRefError",{enumerable:!0,get:function(){return k.default}})})(df,df.exports);var u2=df.exports;const h2=$u(u2);/*! + deps: ${w}}`};const c={keyword:"dependencies",type:"object",schemaType:"object",error:o.error,code(m){const[b,w]=f(m);d(m,b),n(m,w)}};function f({schema:m}){const b={},w={};for(const S in m){if(S==="__proto__")continue;const k=Array.isArray(m[S])?b:w;k[S]=m[S]}return[b,w]}function d(m,b=m.schema){const{gen:w,data:S,it:k}=m;if(Object.keys(b).length===0)return;const A=w.let("missing");for(const P in b){const T=b[P];if(T.length===0)continue;const L=(0,l.propertyInData)(w,S,P,k.opts.ownProperties);m.setParams({property:P,depsCount:T.length,deps:T.join(", ")}),k.allErrors?w.if(L,()=>{for(const D of T)(0,l.checkReportMissingProp)(m,D)}):(w.if((0,r._)`${L} && (${(0,l.checkMissingProp)(m,T,A)})`),(0,l.reportMissingProp)(m,A),w.else())}}o.validatePropertyDeps=d;function n(m,b=m.schema){const{gen:w,data:S,keyword:k,it:A}=m,P=w.name("valid");for(const T in b)(0,a.alwaysValidSchema)(A,b[T])||(w.if((0,l.propertyInData)(w,S,T,A.opts.ownProperties),()=>{const L=m.subschema({keyword:k,schemaProp:T},P);m.mergeValidEvaluated(L,P)},()=>w.var(P,!0)),m.ok(P))}o.validateSchemaDeps=n,o.default=c})(J_);var Yf={};Object.defineProperty(Yf,"__esModule",{value:!0});const Y_=Mr,aw=Zr,sw={message:"property name must be valid",params:({params:o})=>(0,Y_._)`{propertyName: ${o.propertyName}}`},ow={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:sw,code(o){const{gen:r,schema:a,data:l,it:c}=o;if((0,aw.alwaysValidSchema)(c,a))return;const f=r.name("valid");r.forIn("key",l,d=>{o.setParams({propertyName:d}),o.subschema({keyword:"propertyNames",data:d,dataTypes:["string"],propertyName:d,compositeRule:!0},f),r.if((0,Y_.not)(f),()=>{o.error(!0),c.allErrors||r.break()})}),o.ok(f)}};Yf.default=ow;var Zu={};Object.defineProperty(Zu,"__esModule",{value:!0});const _u=zr,ra=Mr,lw=xa,yu=Zr,cw={message:"must NOT have additional properties",params:({params:o})=>(0,ra._)`{additionalProperty: ${o.additionalProperty}}`},uw={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:cw,code(o){const{gen:r,schema:a,parentSchema:l,data:c,errsCount:f,it:d}=o;if(!f)throw new Error("ajv implementation error");const{allErrors:n,opts:m}=d;if(d.props=!0,m.removeAdditional!=="all"&&(0,yu.alwaysValidSchema)(d,a))return;const b=(0,_u.allSchemaProperties)(l.properties),w=(0,_u.allSchemaProperties)(l.patternProperties);S(),o.ok((0,ra._)`${f} === ${lw.default.errors}`);function S(){r.forIn("key",c,L=>{!b.length&&!w.length?P(L):r.if(k(L),()=>P(L))})}function k(L){let D;if(b.length>8){const B=(0,yu.schemaRefOrVal)(d,l.properties,"properties");D=(0,_u.isOwnProperty)(r,B,L)}else b.length?D=(0,ra.or)(...b.map(B=>(0,ra._)`${L} === ${B}`)):D=ra.nil;return w.length&&(D=(0,ra.or)(D,...w.map(B=>(0,ra._)`${(0,_u.usePattern)(o,B)}.test(${L})`))),(0,ra.not)(D)}function A(L){r.code((0,ra._)`delete ${c}[${L}]`)}function P(L){if(m.removeAdditional==="all"||m.removeAdditional&&a===!1){A(L);return}if(a===!1){o.setParams({additionalProperty:L}),o.error(),n||r.break();return}if(typeof a=="object"&&!(0,yu.alwaysValidSchema)(d,a)){const D=r.name("valid");m.removeAdditional==="failing"?(T(L,D,!1),r.if((0,ra.not)(D),()=>{o.reset(),A(L)})):(T(L,D),n||r.if((0,ra.not)(D),()=>r.break()))}}function T(L,D,B){const $={keyword:"additionalProperties",dataProp:L,dataPropType:yu.Type.Str};B===!1&&Object.assign($,{compositeRule:!0,createErrors:!1,allErrors:!1}),o.subschema($,D)}}};Zu.default=uw;var Qf={};Object.defineProperty(Qf,"__esModule",{value:!0});const hw=na,Em=zr,af=Zr,km=Zu,fw={keyword:"properties",type:"object",schemaType:"object",code(o){const{gen:r,schema:a,parentSchema:l,data:c,it:f}=o;f.opts.removeAdditional==="all"&&l.additionalProperties===void 0&&km.default.code(new hw.KeywordCxt(f,km.default,"additionalProperties"));const d=(0,Em.allSchemaProperties)(a);for(const S of d)f.definedProperties.add(S);f.opts.unevaluated&&d.length&&f.props!==!0&&(f.props=af.mergeEvaluated.props(r,(0,af.toHash)(d),f.props));const n=d.filter(S=>!(0,af.alwaysValidSchema)(f,a[S]));if(n.length===0)return;const m=r.name("valid");for(const S of n)b(S)?w(S):(r.if((0,Em.propertyInData)(r,c,S,f.opts.ownProperties)),w(S),f.allErrors||r.else().var(m,!0),r.endIf()),o.it.definedProperties.add(S),o.ok(m);function b(S){return f.opts.useDefaults&&!f.compositeRule&&a[S].default!==void 0}function w(S){o.subschema({keyword:"properties",schemaProp:S,dataProp:S},m)}}};Qf.default=fw;var ed={};Object.defineProperty(ed,"__esModule",{value:!0});const Sm=zr,vu=Mr,Tm=Zr,Im=Zr,dw={keyword:"patternProperties",type:"object",schemaType:"object",code(o){const{gen:r,schema:a,data:l,parentSchema:c,it:f}=o,{opts:d}=f,n=(0,Sm.allSchemaProperties)(a),m=n.filter(T=>(0,Tm.alwaysValidSchema)(f,a[T]));if(n.length===0||m.length===n.length&&(!f.opts.unevaluated||f.props===!0))return;const b=d.strictSchema&&!d.allowMatchingProperties&&c.properties,w=r.name("valid");f.props!==!0&&!(f.props instanceof vu.Name)&&(f.props=(0,Im.evaluatedPropsToName)(r,f.props));const{props:S}=f;k();function k(){for(const T of n)b&&A(T),f.allErrors?P(T):(r.var(w,!0),P(T),r.if(w))}function A(T){for(const L in b)new RegExp(T).test(L)&&(0,Tm.checkStrictMode)(f,`property ${L} matches pattern ${T} (use allowMatchingProperties)`)}function P(T){r.forIn("key",l,L=>{r.if((0,vu._)`${(0,Sm.usePattern)(o,T)}.test(${L})`,()=>{const D=m.includes(T);D||o.subschema({keyword:"patternProperties",schemaProp:T,dataProp:L,dataPropType:Im.Type.Str},w),f.opts.unevaluated&&S!==!0?r.assign((0,vu._)`${S}[${L}]`,!0):!D&&!f.allErrors&&r.if((0,vu.not)(w),()=>r.break())})})}}};ed.default=dw;var td={};Object.defineProperty(td,"__esModule",{value:!0});const pw=Zr,mw={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(o){const{gen:r,schema:a,it:l}=o;if((0,pw.alwaysValidSchema)(l,a)){o.fail();return}const c=r.name("valid");o.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},c),o.failResult(c,()=>o.reset(),()=>o.error())},error:{message:"must NOT be valid"}};td.default=mw;var rd={};Object.defineProperty(rd,"__esModule",{value:!0});const gw=zr,_w={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:gw.validateUnion,error:{message:"must match a schema in anyOf"}};rd.default=_w;var id={};Object.defineProperty(id,"__esModule",{value:!0});const Iu=Mr,yw=Zr,vw={message:"must match exactly one schema in oneOf",params:({params:o})=>(0,Iu._)`{passingSchemas: ${o.passing}}`},bw={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:vw,code(o){const{gen:r,schema:a,parentSchema:l,it:c}=o;if(!Array.isArray(a))throw new Error("ajv implementation error");if(c.opts.discriminator&&l.discriminator)return;const f=a,d=r.let("valid",!1),n=r.let("passing",null),m=r.name("_valid");o.setParams({passing:n}),r.block(b),o.result(d,()=>o.reset(),()=>o.error(!0));function b(){f.forEach((w,S)=>{let k;(0,yw.alwaysValidSchema)(c,w)?r.var(m,!0):k=o.subschema({keyword:"oneOf",schemaProp:S,compositeRule:!0},m),S>0&&r.if((0,Iu._)`${m} && ${d}`).assign(d,!1).assign(n,(0,Iu._)`[${n}, ${S}]`).else(),r.if(m,()=>{r.assign(d,!0),r.assign(n,S),k&&o.mergeEvaluated(k,Iu.Name)})})}}};id.default=bw;var nd={};Object.defineProperty(nd,"__esModule",{value:!0});const xw=Zr,ww={keyword:"allOf",schemaType:"array",code(o){const{gen:r,schema:a,it:l}=o;if(!Array.isArray(a))throw new Error("ajv implementation error");const c=r.name("valid");a.forEach((f,d)=>{if((0,xw.alwaysValidSchema)(l,f))return;const n=o.subschema({keyword:"allOf",schemaProp:d},c);o.ok(c),o.mergeEvaluated(n)})}};nd.default=ww;var ad={};Object.defineProperty(ad,"__esModule",{value:!0});const Lu=Mr,Q_=Zr,Ew={message:({params:o})=>(0,Lu.str)`must match "${o.ifClause}" schema`,params:({params:o})=>(0,Lu._)`{failingKeyword: ${o.ifClause}}`},kw={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:Ew,code(o){const{gen:r,parentSchema:a,it:l}=o;a.then===void 0&&a.else===void 0&&(0,Q_.checkStrictMode)(l,'"if" without "then" and "else" is ignored');const c=Cm(l,"then"),f=Cm(l,"else");if(!c&&!f)return;const d=r.let("valid",!0),n=r.name("_valid");if(m(),o.reset(),c&&f){const w=r.let("ifClause");o.setParams({ifClause:w}),r.if(n,b("then",w),b("else",w))}else c?r.if(n,b("then")):r.if((0,Lu.not)(n),b("else"));o.pass(d,()=>o.error(!0));function m(){const w=o.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},n);o.mergeEvaluated(w)}function b(w,S){return()=>{const k=o.subschema({keyword:w},n);r.assign(d,n),o.mergeValidEvaluated(k,d),S?r.assign(S,(0,Lu._)`${w}`):o.setParams({ifClause:w})}}}};function Cm(o,r){const a=o.schema[r];return a!==void 0&&!(0,Q_.alwaysValidSchema)(o,a)}ad.default=kw;var sd={};Object.defineProperty(sd,"__esModule",{value:!0});const Sw=Zr,Tw={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:o,parentSchema:r,it:a}){r.if===void 0&&(0,Sw.checkStrictMode)(a,`"${o}" without "if" is ignored`)}};sd.default=Tw;Object.defineProperty(Wf,"__esModule",{value:!0});const Iw=jo,Cw=Kf,Aw=qo,Pw=Xf,zw=Jf,Mw=J_,Dw=Yf,Rw=Zu,Lw=Qf,Bw=ed,Ow=td,Fw=rd,Nw=id,Uw=nd,Vw=ad,$w=sd;function jw(o=!1){const r=[Ow.default,Fw.default,Nw.default,Uw.default,Vw.default,$w.default,Dw.default,Rw.default,Mw.default,Lw.default,Bw.default];return o?r.push(Cw.default,Pw.default):r.push(Iw.default,Aw.default),r.push(zw.default),r}Wf.default=jw;var od={},ld={};Object.defineProperty(ld,"__esModule",{value:!0});const Ii=Mr,qw={message:({schemaCode:o})=>(0,Ii.str)`must match format "${o}"`,params:({schemaCode:o})=>(0,Ii._)`{format: ${o}}`},Gw={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:qw,code(o,r){const{gen:a,data:l,$data:c,schema:f,schemaCode:d,it:n}=o,{opts:m,errSchemaPath:b,schemaEnv:w,self:S}=n;if(!m.validateFormats)return;c?k():A();function k(){const P=a.scopeValue("formats",{ref:S.formats,code:m.code.formats}),T=a.const("fDef",(0,Ii._)`${P}[${d}]`),L=a.let("fType"),D=a.let("format");a.if((0,Ii._)`typeof ${T} == "object" && !(${T} instanceof RegExp)`,()=>a.assign(L,(0,Ii._)`${T}.type || "string"`).assign(D,(0,Ii._)`${T}.validate`),()=>a.assign(L,(0,Ii._)`"string"`).assign(D,T)),o.fail$data((0,Ii.or)(B(),$()));function B(){return m.strictSchema===!1?Ii.nil:(0,Ii._)`${d} && !${D}`}function $(){const J=w.$async?(0,Ii._)`(${T}.async ? await ${D}(${l}) : ${D}(${l}))`:(0,Ii._)`${D}(${l})`,Y=(0,Ii._)`(typeof ${D} == "function" ? ${J} : ${D}.test(${l}))`;return(0,Ii._)`${D} && ${D} !== true && ${L} === ${r} && !${Y}`}}function A(){const P=S.formats[f];if(!P){B();return}if(P===!0)return;const[T,L,D]=$(P);T===r&&o.pass(J());function B(){if(m.strictSchema===!1){S.logger.warn(Y());return}throw new Error(Y());function Y(){return`unknown format "${f}" ignored in schema at path "${b}"`}}function $(Y){const ae=Y instanceof RegExp?(0,Ii.regexpCode)(Y):m.code.formats?(0,Ii._)`${m.code.formats}${(0,Ii.getProperty)(f)}`:void 0,re=a.scopeValue("formats",{key:f,ref:Y,code:ae});return typeof Y=="object"&&!(Y instanceof RegExp)?[Y.type||"string",Y.validate,(0,Ii._)`${re}.validate`]:["string",Y,re]}function J(){if(typeof P=="object"&&!(P instanceof RegExp)&&P.async){if(!w.$async)throw new Error("async format in sync schema");return(0,Ii._)`await ${D}(${l})`}return typeof L=="function"?(0,Ii._)`${D}(${l})`:(0,Ii._)`${D}.test(${l})`}}}};ld.default=Gw;Object.defineProperty(od,"__esModule",{value:!0});const Zw=ld,Hw=[Zw.default];od.default=Hw;var Vo={};Object.defineProperty(Vo,"__esModule",{value:!0});Vo.contentVocabulary=Vo.metadataVocabulary=void 0;Vo.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];Vo.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"];Object.defineProperty(Df,"__esModule",{value:!0});const Ww=Rf,Kw=Bf,Xw=Wf,Jw=od,Am=Vo,Yw=[Ww.default,Kw.default,(0,Xw.default)(),Jw.default,Am.metadataVocabulary,Am.contentVocabulary];Df.default=Yw;var cd={},ey={};(function(o){Object.defineProperty(o,"__esModule",{value:!0}),o.DiscrError=void 0,function(r){r.Tag="tag",r.Mapping="mapping"}(o.DiscrError||(o.DiscrError={}))})(ey);Object.defineProperty(cd,"__esModule",{value:!0});const Po=Mr,yf=ey,Pm=wn,Qw=Zr,e2={message:({params:{discrError:o,tagName:r}})=>o===yf.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:o,tag:r,tagName:a}})=>(0,Po._)`{error: ${o}, tag: ${a}, tagValue: ${r}}`},t2={keyword:"discriminator",type:"object",schemaType:"object",error:e2,code(o){const{gen:r,data:a,schema:l,parentSchema:c,it:f}=o,{oneOf:d}=c;if(!f.opts.discriminator)throw new Error("discriminator: requires discriminator option");const n=l.propertyName;if(typeof n!="string")throw new Error("discriminator: requires propertyName");if(l.mapping)throw new Error("discriminator: mapping is not supported");if(!d)throw new Error("discriminator: requires oneOf keyword");const m=r.let("valid",!1),b=r.const("tag",(0,Po._)`${a}${(0,Po.getProperty)(n)}`);r.if((0,Po._)`typeof ${b} == "string"`,()=>w(),()=>o.error(!1,{discrError:yf.DiscrError.Tag,tag:b,tagName:n})),o.ok(m);function w(){const A=k();r.if(!1);for(const P in A)r.elseIf((0,Po._)`${b} === ${P}`),r.assign(m,S(A[P]));r.else(),o.error(!1,{discrError:yf.DiscrError.Mapping,tag:b,tagName:n}),r.endIf()}function S(A){const P=r.name("valid"),T=o.subschema({keyword:"oneOf",schemaProp:A},P);return o.mergeEvaluated(T,Po.Name),P}function k(){var A;const P={},T=D(c);let L=!0;for(let J=0;Jthis.addVocabulary(P)),this.opts.discriminator&&this.addKeyword(c.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;const P=this.opts.$data?this.$dataMetaSchema(f,d):f;this.addMetaSchema(P,n,!1),this.refs["http://json-schema.org/schema"]=n}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(n)?n:void 0)}}o.exports=r=m,Object.defineProperty(r,"__esModule",{value:!0}),r.default=m;var b=na;Object.defineProperty(r,"KeywordCxt",{enumerable:!0,get:function(){return b.KeywordCxt}});var w=Mr;Object.defineProperty(r,"_",{enumerable:!0,get:function(){return w._}}),Object.defineProperty(r,"str",{enumerable:!0,get:function(){return w.str}}),Object.defineProperty(r,"stringify",{enumerable:!0,get:function(){return w.stringify}}),Object.defineProperty(r,"nil",{enumerable:!0,get:function(){return w.nil}}),Object.defineProperty(r,"Name",{enumerable:!0,get:function(){return w.Name}}),Object.defineProperty(r,"CodeGen",{enumerable:!0,get:function(){return w.CodeGen}});var S=ac;Object.defineProperty(r,"ValidationError",{enumerable:!0,get:function(){return S.default}});var k=sc;Object.defineProperty(r,"MissingRefError",{enumerable:!0,get:function(){return k.default}})})(ff,ff.exports);var c2=ff.exports;const u2=Vu(c2);/*! * mustache.js - Logic-less {{mustache}} templates with JavaScript * http://github.com/janl/mustache.js - */var f2=Object.prototype.toString,Zo=Array.isArray||function(r){return f2.call(r)==="[object Array]"};function hd(o){return typeof o=="function"}function d2(o){return Zo(o)?"array":typeof o}function of(o){return o.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}function Mm(o,r){return o!=null&&typeof o=="object"&&r in o}function p2(o,r){return o!=null&&typeof o!="object"&&o.hasOwnProperty&&o.hasOwnProperty(r)}var m2=RegExp.prototype.test;function g2(o,r){return m2.call(o,r)}var _2=/\S/;function y2(o){return!g2(_2,o)}var v2={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function b2(o){return String(o).replace(/[&<>"'`=\/]/g,function(s){return v2[s]})}var x2=/\s*/,w2=/\s+/,Dm=/\s*=/,E2=/\s*\}/,k2=/#|\^|\/|>|\{|&|=|!/;function S2(o,r){if(!o)return[];var s=!1,l=[],c=[],f=[],d=!1,n=!1,m="",b=0;function w(){if(d&&!n)for(;f.length;)delete c[f.pop()];else f=[];d=!1,n=!1}var S,k,A;function P(ce){if(typeof ce=="string"&&(ce=ce.split(w2,2)),!Zo(ce)||ce.length!==2)throw new Error("Invalid tags: "+ce);S=new RegExp(of(ce[0])+"\\s*"),k=new RegExp("\\s*"+of(ce[1])),A=new RegExp("\\s*"+of("}"+ce[1]))}P(r||Nn.tags);for(var T=new cc(o),L,D,B,$,J,Y;!T.eos();){if(L=T.pos,B=T.scanUntil(S),B)for(var se=0,re=B.length;se"?J=[D,B,L,T.pos,m,b,s]:J=[D,B,L,T.pos],b++,c.push(J),D==="#"||D==="^")l.push(J);else if(D==="/"){if(Y=l.pop(),!Y)throw new Error('Unopened section "'+B+'" at '+L);if(Y[1]!==B)throw new Error('Unclosed section "'+Y[1]+'" at '+L)}else D==="name"||D==="{"||D==="&"?n=!0:D==="="&&P(B)}if(w(),Y=l.pop(),Y)throw new Error('Unclosed section "'+Y[1]+'" at '+T.pos);return I2(T2(c))}function T2(o){for(var r=[],s,l,c=0,f=o.length;c0?l[l.length-1][4]:r;break;default:s.push(c)}return r}function cc(o){this.string=o,this.tail=o,this.pos=0}cc.prototype.eos=function(){return this.tail===""};cc.prototype.scan=function(r){var s=this.tail.match(r);if(!s||s.index!==0)return"";var l=s[0];return this.tail=this.tail.substring(l.length),this.pos+=l.length,l};cc.prototype.scanUntil=function(r){var s=this.tail.search(r),l;switch(s){case-1:l=this.tail,this.tail="";break;case 0:l="";break;default:l=this.tail.substring(0,s),this.tail=this.tail.substring(s)}return this.pos+=l.length,l};function jo(o,r){this.view=o,this.cache={".":this.view},this.parent=r}jo.prototype.push=function(r){return new jo(r,this)};jo.prototype.lookup=function(r){var s=this.cache,l;if(s.hasOwnProperty(r))l=s[r];else{for(var c=this,f,d,n,m=!1;c;){if(r.indexOf(".")>0)for(f=c.view,d=r.split("."),n=0;f!=null&&n"?b=this.renderPartial(n,s,l,f):m==="&"?b=this.unescapedValue(n,s):m==="name"?b=this.escapedValue(n,s,f):m==="text"&&(b=this.rawValue(n)),b!==void 0&&(d+=b);return d};mn.prototype.renderSection=function(r,s,l,c,f){var d=this,n="",m=s.lookup(r[1]);function b(k){return d.render(k,s,l,f)}if(m){if(Zo(m))for(var w=0,S=m.length;w":">",'"':""","'":"'","/":"/","`":"`","=":"="};function v2(o){return String(o).replace(/[&<>"'`=\/]/g,function(a){return y2[a]})}var b2=/\s*/,x2=/\s+/,Mm=/\s*=/,w2=/\s*\}/,E2=/#|\^|\/|>|\{|&|=|!/;function k2(o,r){if(!o)return[];var a=!1,l=[],c=[],f=[],d=!1,n=!1,m="",b=0;function w(){if(d&&!n)for(;f.length;)delete c[f.pop()];else f=[];d=!1,n=!1}var S,k,A;function P(ce){if(typeof ce=="string"&&(ce=ce.split(x2,2)),!Go(ce)||ce.length!==2)throw new Error("Invalid tags: "+ce);S=new RegExp(sf(ce[0])+"\\s*"),k=new RegExp("\\s*"+sf(ce[1])),A=new RegExp("\\s*"+sf("}"+ce[1]))}P(r||Nn.tags);for(var T=new lc(o),L,D,B,$,J,Y;!T.eos();){if(L=T.pos,B=T.scanUntil(S),B)for(var ae=0,re=B.length;ae"?J=[D,B,L,T.pos,m,b,a]:J=[D,B,L,T.pos],b++,c.push(J),D==="#"||D==="^")l.push(J);else if(D==="/"){if(Y=l.pop(),!Y)throw new Error('Unopened section "'+B+'" at '+L);if(Y[1]!==B)throw new Error('Unclosed section "'+Y[1]+'" at '+L)}else D==="name"||D==="{"||D==="&"?n=!0:D==="="&&P(B)}if(w(),Y=l.pop(),Y)throw new Error('Unclosed section "'+Y[1]+'" at '+T.pos);return T2(S2(c))}function S2(o){for(var r=[],a,l,c=0,f=o.length;c0?l[l.length-1][4]:r;break;default:a.push(c)}return r}function lc(o){this.string=o,this.tail=o,this.pos=0}lc.prototype.eos=function(){return this.tail===""};lc.prototype.scan=function(r){var a=this.tail.match(r);if(!a||a.index!==0)return"";var l=a[0];return this.tail=this.tail.substring(l.length),this.pos+=l.length,l};lc.prototype.scanUntil=function(r){var a=this.tail.search(r),l;switch(a){case-1:l=this.tail,this.tail="";break;case 0:l="";break;default:l=this.tail.substring(0,a),this.tail=this.tail.substring(a)}return this.pos+=l.length,l};function $o(o,r){this.view=o,this.cache={".":this.view},this.parent=r}$o.prototype.push=function(r){return new $o(r,this)};$o.prototype.lookup=function(r){var a=this.cache,l;if(a.hasOwnProperty(r))l=a[r];else{for(var c=this,f,d,n,m=!1;c;){if(r.indexOf(".")>0)for(f=c.view,d=r.split("."),n=0;f!=null&&n"?b=this.renderPartial(n,a,l,f):m==="&"?b=this.unescapedValue(n,a):m==="name"?b=this.escapedValue(n,a,f):m==="text"&&(b=this.rawValue(n)),b!==void 0&&(d+=b);return d};mn.prototype.renderSection=function(r,a,l,c,f){var d=this,n="",m=a.lookup(r[1]);function b(k){return d.render(k,a,l,f)}if(m){if(Go(m))for(var w=0,S=m.length;w0||!l)&&(f[d]=c+f[d]);return f.join(` -`)};mn.prototype.renderPartial=function(r,s,l,c){if(l){var f=this.getConfigTags(c),d=hd(l)?l(r[1]):l[r[1]];if(d!=null){var n=r[6],m=r[5],b=r[4],w=d;m==0&&b&&(w=this.indentPartial(d,b,n));var S=this.parse(w,f);return this.renderTokens(S,s,l,w,c)}}};mn.prototype.unescapedValue=function(r,s){var l=s.lookup(r[1]);if(l!=null)return l};mn.prototype.escapedValue=function(r,s,l){var c=this.getConfigEscape(l)||Nn.escape,f=s.lookup(r[1]);if(f!=null)return typeof f=="number"&&c===Nn.escape?String(f):c(f)};mn.prototype.rawValue=function(r){return r[1]};mn.prototype.getConfigTags=function(r){return Zo(r)?r:r&&typeof r=="object"?r.tags:void 0};mn.prototype.getConfigEscape=function(r){if(r&&typeof r=="object"&&!Zo(r))return r.escape};var Nn={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(o){tc.templateCache=o},get templateCache(){return tc.templateCache}},tc=new mn;Nn.clearCache=function(){return tc.clearCache()};Nn.parse=function(r,s){return tc.parse(r,s)};Nn.render=function(r,s,l,c){if(typeof r!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+d2(r)+'" was given as the first argument for mustache#render(template, view, partials)');return tc.render(r,s,l,c)};Nn.escape=b2;Nn.Scanner=cc;Nn.Context=jo;Nn.Writer=mn;let xu=null;function Ao(o,r){return String.fromCodePoint("A".codePointAt(0)-1+o)+r}function C2(o,r){if(r==="text")return o.map(s=>({isText:!0,displayValue:s}));if(r==="number_with_commas")return o.map(s=>({isNumeric:!0,rawValue:s,displayValue:s.toLocaleString("en-GB"),style:r}));if(r==="number_1dp")return o.map(s=>({isNumeric:!0,rawValue:s,displayValue:s.toFixed(1),style:r}));throw new Error("Unrecognised column style: "+r)}function Rm(o,r){r(o.sheetName,s=>{o.sheetName=s});for(let s=0;s{o.sheetIntroText[s]=l});for(const s of o.columns)if(r(s.heading,l=>{s.heading=l}),s.style==="text")for(let l=0;l{s.values[l]=c})}function A2(o,r){if(!o)return[];const s=/\[\[[^\]]+\]\]/g;let l=o.map(({name:f,text:d})=>({name:f,text:d,used:!1}));const c=new Map(l.map(f=>[`[[${f.name}]]`,f]));for(const f of r)f.sheetIntroText||(f.sheetIntroText=[]),f.hasNotes=!1,Rm(f,d=>{for(const n of d.match(s)||[])c.get(n).used=!0,f.hasNotes=!0});l=l.filter(f=>f.used),l.forEach((f,d)=>f.name=`[note ${d+1}]`);for(const f of r)if(f.hasNotes){const d=n=>c.get(n).name;Rm(f,(n,m)=>{m(n.replace(s,d))})}return l}function P2(o){return(Math.max(...o.map(s=>ku(s)))/37.8+.5).toFixed(2)}function Lm(o){const r=o.split(" "),s=15.45*37.8,l=ku(" ");let c=1,f=ku(r[0]);for(const d of r.slice(1)){const n=ku(d);f+=l+n,f>s&&(++c,f=n)}return c}function z2(o){return o.flatMap(r=>r.split(` -`)).map((r,s)=>{if(r.startsWith("## "))return{isSubtitle:!0,text:r.slice(3)};if(/^\[.*\]\(.*\)$/.test(r)){const l=r.slice(1,-1).split("](");return{isHyperlink:!0,text:l[0],href:l[1],rowCount:Lm(".")}}return{isText:!0,text:r,rowCount:Lm(r)}})}function M2(o){let r="This worksheet contains one table.";return o?r+" Some cells refer to notes, which can be found on the notes worksheet.":r}function D2(o){if(xu||(xu=new h2().compile(vv)),!xu(o))throw console.log(xu.errors),new Error("Input did not match the schema");const s={coverSheetTitle:o.coverSheetTitle,firstTocCell:Ao(1,3),lastTocCell:Ao(2,3+o.sheets.length),coverSheetContents:z2(o.coverSheetContents),sheets:JSON.parse(JSON.stringify(o.sheets))};s.coverSheetRowStyles=[...new Set(s.coverSheetContents.map(l=>l.rowCount).filter(Boolean))].map(l=>({styleName:"coverSheetRowStyle_"+l,rowHeightCm:l*.53+.4})),s.notes=A2(o.notes,s.sheets),s.notes.length>0&&(s.hasNotes=!0,s.firstNotesTableCell=Ao(1,3),s.lastNotesTableCell=Ao(2,3+s.notes.length)),s.tableCount=s.sheets.length+2+s.hasNotes;for(let l=0;l({text:f,isLastIntroRow:d===c.sheetIntroText.length-1})),c.firstTableCell=Ao(1,2+c.sheetIntroText.length),c.lastTableCell=Ao(c.columns.length,2+c.columns[0].values.length+c.sheetIntroText.length);for(const f of c.columns)f.valuesFormatted=C2(f.values,f.style),f.isNumeric=f.style!=="text",f.headingLines=f.heading.split(` -`);c.rows=[];for(let f=0;fd.valuesFormatted[f])});c.columnStyles=c.columns.map((f,d)=>{const n=Math.max(2.4,P2(f.valuesFormatted.map(m=>m.displayValue)));return{name:"colStyle"+l+"_"+d,widthCm:n}})}return yv.map(l=>({filename:l.filename,contents:Nn.render(l.contents,s)}))}const Bm="https://ons-dp-prod-cdn.s3.eu-west-2.amazonaws.com/maptiles/pgp-data/";function R2(o){let r=[...o].sort((l,c)=>l.key.localeCompare(c.key));return{selString:o.length==0?"data":r.map((l,c)=>c0?r[r.length-1].code:null}}async function iy(o,r=[],s=window.fetch){if(r.length>0&&!r[0].newFormat)throw new Error("OLD FORMAT!");let{selString:l,lastCode:c}=R2(r),f={data:{}},d;if(r.length===0){let n=`${Bm}${r.length}var_percent/${l}.json`;d=await(await s(n)).json(),f.total_pop={count:d.sex.count[0]+d.sex.count[1],percent:100}}else{let n=`${Bm}${r.length}var-combined_percent/${l}.json`,b=await(await s(n)).json();d=b.bar_chart_data[c],f.mapData=b.map_data[c],f.total_pop=d.total_pop}for(let n of o){f.data[n.key]={};for(let m of n.tables)f.data[n.key][m.code]={values:d[m.code]}}return f}function L2(o,r,s){for(let l=1;l{let m=d.label,b=l.percent[n],w=c.percent[n];s.selected.total_pop!=s.all.total_pop&&f.push({group:"This group",category:m,value:w}),f.push({group:"Whole population",category:m,value:b})}),f}function Nm(o){if(o===100)return"100";const r=o.toFixed(1);return r!=="0.0"?r:"Less than 0.05"}function Ka(o){return o.split(": ").slice(-1)[0]}function Au(o,r){const s=r.selected.residents[o].values;return s!=="blocked"&&s!==void 0}function O2(o){let r=["## Source","Census 2021 from the Office for National Statistics",`[View this profile on the ONS website](${document.location.href})`,"## Selected population group"];r.push("This profile is for people with the following characteristic"+(o.length>1?"s.":"."));for(const s of o)r.push(` - ${s.topic}: ${Ka(s.label)}`);return r}function F2(o,r,s){console.log({data:o,datasets:r,selected:s});const l={coverSheetTitle:"Data Downloaded from 'Create a Population Group Profile'",coverSheetContents:O2(s),tableHeadings:["Category","Selected group %","England and Wales %","Selected group count","England and Wales count"],sheets:[]};l.sheets.push({sheetName:"Total population",tableName:"total_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Group",style:"text",values:["Selected group"]},{heading:"Count",style:"number_with_commas",values:[o.selected.total_pop.count]},{heading:"% of England and Wales population",style:"number_1dp",values:[o.selected.total_pop.percent]}]});let c=o.geoPerc.filter(f=>f.value!=null);c.length>0&&l.sheets.push({sheetName:"Percentage of Population, by Local Authority",tableName:"percentage_of_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Local Authority",style:"text",values:c.map(f=>f.name)},{heading:"% of Local Authority Population",style:"number_1dp",values:c.map(f=>f.value)},{heading:"Count",style:"number_with_commas",values:c.map(f=>f.count)}]});for(let f of r[0].tables){if(f.code==="resident_age_23a"||!Au(f.code,o)||o.selected.residents[f.code].values==null)continue;let d={sheetName:f.key,tableName:f.code,sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Category",style:"text",values:u_[f.code].map(n=>n.label)},{heading:`Selected group +`)};mn.prototype.renderPartial=function(r,a,l,c){if(l){var f=this.getConfigTags(c),d=ud(l)?l(r[1]):l[r[1]];if(d!=null){var n=r[6],m=r[5],b=r[4],w=d;m==0&&b&&(w=this.indentPartial(d,b,n));var S=this.parse(w,f);return this.renderTokens(S,a,l,w,c)}}};mn.prototype.unescapedValue=function(r,a){var l=a.lookup(r[1]);if(l!=null)return l};mn.prototype.escapedValue=function(r,a,l){var c=this.getConfigEscape(l)||Nn.escape,f=a.lookup(r[1]);if(f!=null)return typeof f=="number"&&c===Nn.escape?String(f):c(f)};mn.prototype.rawValue=function(r){return r[1]};mn.prototype.getConfigTags=function(r){return Go(r)?r:r&&typeof r=="object"?r.tags:void 0};mn.prototype.getConfigEscape=function(r){if(r&&typeof r=="object"&&!Go(r))return r.escape};var Nn={name:"mustache.js",version:"4.2.0",tags:["{{","}}"],clearCache:void 0,escape:void 0,parse:void 0,render:void 0,Scanner:void 0,Context:void 0,Writer:void 0,set templateCache(o){ec.templateCache=o},get templateCache(){return ec.templateCache}},ec=new mn;Nn.clearCache=function(){return ec.clearCache()};Nn.parse=function(r,a){return ec.parse(r,a)};Nn.render=function(r,a,l,c){if(typeof r!="string")throw new TypeError('Invalid template! Template should be a "string" but "'+f2(r)+'" was given as the first argument for mustache#render(template, view, partials)');return ec.render(r,a,l,c)};Nn.escape=v2;Nn.Scanner=lc;Nn.Context=$o;Nn.Writer=mn;let bu=null;function xu(o,r){return String.fromCodePoint("A".codePointAt(0)-1+o)+r}function I2(o,r){if(r==="text")return o.map(a=>({isText:!0,displayValue:a}));if(r==="number_with_commas")return o.map(a=>({isNumeric:!0,rawValue:a,displayValue:a.toLocaleString("en-GB"),style:r}));if(r==="number_1dp")return o.map(a=>({isNumeric:!0,rawValue:a,displayValue:a.toFixed(1),style:r}));throw new Error("Unrecognised column style: "+r)}function Dm(o,r){r(o.sheetName,a=>{o.sheetName=a});for(let a=0;a{o.sheetIntroText[a]=l});for(const a of o.columns)if(r(a.heading,l=>{a.heading=l}),a.style==="text")for(let l=0;l{a.values[l]=c})}function C2(o,r){if(!o)return[];const a=/\[\[[^\]]+\]\]/g;let l=o.map(({name:f,text:d})=>({name:f,text:d,used:!1}));const c=new Map(l.map(f=>[`[[${f.name}]]`,f]));for(const f of r)f.sheetIntroText||(f.sheetIntroText=[]),f.hasNotes=!1,Dm(f,d=>{for(const n of d.match(a)||[])c.get(n).used=!0,f.hasNotes=!0});l=l.filter(f=>f.used),l.forEach((f,d)=>f.name=`[note ${d+1}]`);for(const f of r)if(f.hasNotes){const d=n=>c.get(n).name;Dm(f,(n,m)=>{m(n.replace(a,d))})}return l}function A2(o){return(Math.max(...o.map(a=>_v(a)))/37.8+.5).toFixed(2)}function P2(o){return o.map(r=>{if(r.startsWith("## "))return{isSubtitle:!0,text:r.slice(3)};if(/^\[.*\]\(.*\)$/.test(r)){const a=r.slice(1,-1).split("](");return{isHyperlink:!0,text:a[0],href:a[1]}}return{isText:!0,text:r}})}function z2(o){let r="This worksheet contains one table.";return o?r+" Some cells refer to notes, which can be found on the notes worksheet.":r}function M2(o){if(bu||(bu=new u2().compile(yv)),!bu(o))throw console.log(bu.errors),new Error("Input did not match the schema");const a={coverSheetTitle:o.coverSheetTitle,firstTocCell:xu(1,3),lastTocCell:xu(2,3+o.sheets.length),coverSheetContents:P2(o.coverSheetContents),sheets:JSON.parse(JSON.stringify(o.sheets))};a.notes=C2(o.notes,a.sheets),a.hasNotes=a.notes.length>0,a.tableCount=a.sheets.length+2+a.hasNotes;for(let l=0;l({text:f,isLastIntroRow:d===c.sheetIntroText.length-1})),c.firstTableCell=xu(1,2+c.sheetIntroText.length),c.lastTableCell=xu(c.columns.length,2+c.columns[0].values.length+c.sheetIntroText.length);for(const f of c.columns)f.valuesFormatted=I2(f.values,f.style),f.isNumeric=f.style!=="text",f.headingLines=f.heading.split(` +`);c.rows=[];for(let f=0;fd.valuesFormatted[f])});c.columnStyles=c.columns.map((f,d)=>{const n=Math.max(2.4,A2(f.valuesFormatted.map(m=>m.displayValue)));return{name:"colStyle"+l+"_"+d,widthCm:n}})}return gv.map(l=>({filename:l.filename,contents:Nn.render(l.contents,a)}))}const Rm="https://ons-dp-prod-cdn.s3.eu-west-2.amazonaws.com/maptiles/pgp-data/";function D2(o){let r=[...o].sort((l,c)=>l.key.localeCompare(c.key));return{selString:o.length==0?"data":r.map((l,c)=>c0?r[r.length-1].code:null}}async function ty(o,r=[],a=window.fetch){if(r.length>0&&!r[0].newFormat)throw new Error("OLD FORMAT!");let{selString:l,lastCode:c}=D2(r),f={data:{}},d;if(r.length===0){let n=`${Rm}${r.length}var_percent/${l}.json`;d=await(await a(n)).json(),f.total_pop={count:d.sex.count[0]+d.sex.count[1],percent:100}}else{let n=`${Rm}${r.length}var-combined_percent/${l}.json`,b=await(await a(n)).json();d=b.bar_chart_data[c],f.mapData=b.map_data[c],f.total_pop=d.total_pop}for(let n of o){f.data[n.key]={};for(let m of n.tables)f.data[n.key][m.code]={values:d[m.code]}}return f}function R2(o,r,a){for(let l=1;l{let m=d.label,b=l.percent[n],w=c.percent[n];a.selected.total_pop!=a.all.total_pop&&f.push({group:"This group",category:m,value:w}),f.push({group:"Whole population",category:m,value:b})}),f}function Om(o){if(o===100)return"100";const r=o.toFixed(1);return r!=="0.0"?r:"Less than 0.05"}function Ks(o){return o.split(": ").slice(-1)[0]}function Cu(o,r){const a=r.selected.residents[o].values;return a!=="blocked"&&a!==void 0}function B2(o){let r=["## Source","Census 2021 from the Office for National Statistics",`[View this profile on the ONS website](${document.location.href})`,"## Selected population group"];r.push("This profile is for people with the following characteristic"+(o.length>1?"s.":"."));for(const a of o)r.push(` - ${a.topic}: ${Ks(a.label)}`);return r}function O2(o,r,a){console.log({data:o,datasets:r,selected:a});const l={coverSheetTitle:"Data Downloaded from 'Create a Population Group Profile'",coverSheetContents:B2(a),tableHeadings:["Category","Selected group %","England and Wales %","Selected group count","England and Wales count"],sheets:[]};l.sheets.push({sheetName:"Total population",tableName:"total_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Group",style:"text",values:["Selected group"]},{heading:"Count",style:"number_with_commas",values:[o.selected.total_pop.count]},{heading:"% of England and Wales population",style:"number_1dp",values:[o.selected.total_pop.percent]}]});let c=o.geoPerc.filter(f=>f.value!=null);c.length>0&&l.sheets.push({sheetName:"Percentage of Population, by Local Authority",tableName:"percentage_of_population",sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Local Authority",style:"text",values:c.map(f=>f.name)},{heading:"% of Local Authority Population",style:"number_1dp",values:c.map(f=>f.value)},{heading:"Count",style:"number_with_commas",values:c.map(f=>f.count)}]});for(let f of r[0].tables){if(f.code==="resident_age_23a"||!Cu(f.code,o)||o.selected.residents[f.code].values==null)continue;let d={sheetName:f.key,tableName:f.code,sheetIntroText:["Source: Census 2021 from the Office for National Statistics"],columns:[{heading:"Category",style:"text",values:l_[f.code].map(n=>n.label)},{heading:`Selected group (%)`,style:"number_1dp",values:o.selected.residents[f.code].values.percent},{heading:`England and Wales (%)`,style:"number_1dp",values:o.all.residents[f.code].values.percent},{heading:`Selected group (count)`,style:"number_with_commas",values:o.selected.residents[f.code].values.count},{heading:`England and Wales -(count)`,style:"number_with_commas",values:o.all.residents[f.code].values.count}]};l.sheets.push(d)}return D2(l)}async function N2({fetch:o}){let r=await B2(Hl+Gl.url,Gl.layer,o),s=(await iy(Oo,[],o)).data,l=[],c={},f=[];return r.features.forEach(d=>{const n=d.properties[Gl.code],m=d.properties[Gl.name],b={code:n,name:m};l.push(b),c[n]=b,f.push({...b,value:100,color:Do.seq[4]})}),{geojson:r,geoCodesAndNames:l,geoCodesLookup:c,geoPerc:f,all:s,selected:null}}const iT=Object.freeze(Object.defineProperty({__proto__:null,load:N2},Symbol.toStringTag,{value:"Module"})),U2=b_("goto"),V2=b_("after_navigate");function $2(o){return o.slice().sort(function(r,s){return r-s})}function Um(o,r){for(var s=[],l=0;l0){var f=(s[r]-s[o-1])/(r-o+1);c=l[r]-l[o-1]-(r-o+1)*f*f}else c=l[r]-s[r]*s[r]/(r+1);return c<0?0:c}function xf(o,r,s,l,c,f,d){if(!(o>r)){var n=Math.floor((o+r)/2);l[s][n]=l[s-1][n-1],c[s][n]=n;var m=s;o>s&&(m=Math.max(m,c[s][o-1]||0)),m=Math.max(m,c[s-1][n]||0);var b=n-1;r=m&&(w=bf(P,n,f,d),!(w+l[s-1][m-1]>=l[s][n]));--P)S=bf(m,n,f,d),k=S+l[s-1][m-1],ko.length)throw new Error("cannot generate more classes than there are data values");var s=$2(o),l=j2(s);if(l===1)return[s];var c=Um(r,s.length),f=Um(r,s.length);q2(s,c,f);for(var d=[],n=f[0].length-1,m=f.length-1;m>=0;m--){var b=f[m][n];d[m]=s.slice(b,n+1),m>0&&(n=b-1)}return d}function Vm(o,r,s){const l=o.slice();return l[15]=r[s],l}function $m(o,r,s){const l=o.slice();return l[18]=r[s],l[20]=s,l}function jm(o,r,s){const l=o.slice();return l[18]=r[s],l[20]=s,l}function qm(o,r,s){const l=o.slice();return l[15]=r[s],l[20]=s,l}function Gm(o){let r,s=o[9],l=[];for(let c=0;cB.toFixed(1)}=r,{suffix:k="%"}=r,{base:A=null}=r,{barHeight:P=25}=r,{markerWidth:T=3}=r,{showLegend:L=!0}=r;function D(B,$){let J={},Y=[];for(const re of B)J[re[$]]||(J[re[$]]={label:re[$],values:[]},Y.push(re[$])),J[re[$]].values.push(re);let se=[];return Y.forEach(re=>{se.push(J[re])}),se}return o.$$set=B=>{"data"in B&&s(10,n=B.data),"xKey"in B&&s(0,m=B.xKey),"yKey"in B&&s(11,b=B.yKey),"zKey"in B&&s(12,w=B.zKey),"formatTick"in B&&s(1,S=B.formatTick),"suffix"in B&&s(2,k=B.suffix),"base"in B&&s(3,A=B.base),"barHeight"in B&&s(4,P=B.barHeight),"markerWidth"in B&&s(5,T=B.markerWidth),"showLegend"in B&&s(6,L=B.showLegend)},o.$$.update=()=>{o.$$.dirty&1025&&s(13,l=Math.max(...n.map(B=>B[m]))),o.$$.dirty&5120&&s(9,c=n.map(B=>B[w]).filter((B,$,J)=>J.indexOf(B)===$)),o.$$.dirty&8192&&s(8,f=B=>B/l*100),o.$$.dirty&3072&&s(7,d=D(n,b))},[m,S,k,A,P,T,L,d,f,c,n,b,w,l]}class X2 extends Wr{constructor(r){super(),Kr(this,r,K2,W2,jr,{data:10,xKey:0,yKey:11,zKey:12,formatTick:1,suffix:2,base:3,barHeight:4,markerWidth:5,showLegend:6})}}function J2(o){let r,s,l;return{c(){r=la("svg"),s=la("path"),this.h()},l(c){r=ca(c,"svg",{class:!0,viewBox:!0,"fill-rule":!0,"clip-rule":!0,"aria-hidden":!0,focusable:!0,style:!0});var f=He(r);s=ca(f,"path",{d:!0}),He(s).forEach(te),f.forEach(te),this.h()},h(){_e(s,"d",l=o[4][o[0]]),_e(r,"class","ico svelte-175xtay"),_e(r,"viewBox","0 0 24 24"),_e(r,"fill-rule","evenodd"),_e(r,"clip-rule","evenodd"),_e(r,"aria-hidden","true"),_e(r,"focusable","false"),_e(r,"style",o[3]),Ht(r,"margin",o[2]),Ht(r,"noclick",!o[1])},m(c,f){Be(c,r,f),Pe(r,s)},p(c,[f]){f&1&&l!==(l=c[4][c[0]])&&_e(s,"d",l),f&8&&_e(r,"style",c[3]),f&4&&Ht(r,"margin",c[2]),f&2&&Ht(r,"noclick",!c[1])},i:_r,o:_r,d(c){c&&te(r)}}}function Y2(o,r,s){let l,{type:c="compass"}=r,{rotation:f=0}=r,{position:d="inline"}=r,{clickable:n=!1}=r,{margin:m=!1}=r;const b={compass:"M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12s4.48 10 10 10 10-4.48 10-10zm-10 1H8v-2h4V8l4 4-4 4v-3z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1-8h-2V7h2v2z",chart:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM8 17c-.55 0-1-.45-1-1v-5c0-.55.45-1 1-1s1 .45 1 1v5c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",chevron:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",full:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",full_exit:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z",shuffle:"M10.59 9.17 5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z",replay:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",save:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z",tick:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",cross:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",arrow:"M5,13h11.2l-2.9,2.9c-0.4,0.4-0.4,1,0,1.4s1,0.4,1.4,0l4.6-4.6c0.4-0.4,0.4-1,0-1.4l-4.6-4.6c-0.4-0.4-1-0.4-1.4,0c0,0,0,0,0,0c-0.4,0.4-0.4,1,0,1.4l2.9,2.9H5c-0.6,0-1,0.4-1,1S4.4,13,5,13z",plus:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z",minus:"M18 13H6c-.55 0-1-.45-1-1s.45-1 1-1h12c.55 0 1 .45 1 1s-.45 1-1 1z",subdir:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z",touch:"M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74zm9.84 4.63-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74c-3.6-.76-3.54-.75-3.67-.75-.31 0-.59.13-.79.33l-.79.8 4.94 4.94c.27.27.65.44 1.06.44h6.79c.75 0 1.33-.55 1.44-1.28l.75-5.27c.01-.07.02-.14.02-.2 0-.62-.38-1.16-.91-1.38z",launch:"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1zM14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V3h-6c-.55 0-1 .45-1 1z",close:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",error:"M 12 2 C 6.48 2 2 6.48 2 12 s 4.48 10 10 10 s 10 -4.48 10 -10 S 17.52 2 12 2 z m 1 15 h -2 v -2 h 2 v 2 z m 0 -4 h -2 V 7 h 2 v 6 z"};return o.$$set=w=>{"type"in w&&s(0,c=w.type),"rotation"in w&&s(5,f=w.rotation),"position"in w&&s(6,d=w.position),"clickable"in w&&s(1,n=w.clickable),"margin"in w&&s(2,m=w.margin)},o.$$.update=()=>{o.$$.dirty&96&&s(3,l=`transform: translate(0, 15%) scale(1.5) rotate(${-f}deg);${["left","right"].includes(d)?` position: absolute; ${d}: 10px;`:""}`)},[c,n,m,l,b,f,d]}class fd extends Wr{constructor(r){super(),Kr(this,r,Y2,J2,jr,{type:0,rotation:5,position:6,clickable:1,margin:2})}}function Jm(o,r,s){const l=o.slice();return l[11]=r[s],l}function Ym(o){let r,s,l,c;return{c(){r=Ne("button"),s=zt("Back"),this.h()},l(f){r=Ue(f,"BUTTON",{class:!0});var d=He(r);s=Mt(d,"Back"),d.forEach(te),this.h()},h(){_e(r,"class","hidden-on-desktop svelte-1iovvug")},m(f,d){Be(f,r,d),Pe(r,s),l||(c=bs(r,"click",function(){m_(o[3])&&o[3].apply(this,arguments)}),l=!0)},p(f,d){o=f},d(f){f&&te(r),l=!1,c()}}}function Qm(o){let r,s,l,c,f=Ka(Fu(o[11],o[4]))+"",d;return{c(){r=Ne("br"),s=Et(),l=Ne("div"),c=zt("Selected: "),d=zt(f),this.h()},l(n){r=Ue(n,"BR",{}),s=kt(n),l=Ue(n,"DIV",{class:!0});var m=He(l);c=Mt(m,"Selected: "),d=Mt(m,f),m.forEach(te),this.h()},h(){_e(l,"class","selected-item-label svelte-1iovvug")},m(n,m){Be(n,r,m),Be(n,s,m),Be(n,l,m),Pe(l,c),Pe(l,d)},p(n,m){m&18&&f!==(f=Ka(Fu(n[11],n[4]))+"")&&kr(d,f)},d(n){n&&te(r),n&&te(s),n&&te(l)}}}function eg(o){let r,s=o[6](o[11])+"",l,c,f,d,n,m=Fu(o[11],o[4]),b,w,S;d=new fd({props:{type:"chevron"}});let k=m&&Qm(o);function A(){return o[10](o[11])}return{c(){r=Ne("button"),l=zt(s),c=Et(),f=Ne("span"),ir(d.$$.fragment),n=Et(),k&&k.c(),this.h()},l(P){r=Ue(P,"BUTTON",{class:!0});var T=He(r);l=Mt(T,s),c=kt(T),f=Ue(T,"SPAN",{class:!0});var L=He(f);cr(d.$$.fragment,L),L.forEach(te),n=kt(T),k&&k.l(T),T.forEach(te),this.h()},h(){_e(f,"class","right-chevron svelte-1iovvug"),_e(r,"class","svelte-1iovvug"),Ht(r,"plain-button",!0),Ht(r,"selected",o[11]===o[0])},m(P,T){Be(P,r,T),Pe(r,l),Pe(r,c),Pe(r,f),nr(d,f,null),Pe(r,n),k&&k.m(r,null),b=!0,w||(S=bs(r,"click",A),w=!0)},p(P,T){o=P,(!b||T&66)&&s!==(s=o[6](o[11])+"")&&kr(l,s),T&18&&(m=Fu(o[11],o[4])),m?k?k.p(o,T):(k=Qm(o),k.c(),k.m(r,null)):k&&(k.d(1),k=null),(!b||T&3)&&Ht(r,"selected",o[11]===o[0])},i(P){b||(qe(d.$$.fragment,P),b=!0)},o(P){nt(d.$$.fragment,P),b=!1},d(P){P&&te(r),sr(d),k&&k.d(),w=!1,S()}}}function Q2(o){let r,s,l,c,f,d,n,m=o[3]!=null&&Ym(o),b=o[1],w=[];for(let P=0;Pnt(w[P],1,1,()=>{w[P]=null}),k=o[9].default,A=Di(k,o,o[8],null);return{c(){r=Ne("div"),m&&m.c(),s=Et(),l=Ne("h5"),c=zt(o[5]),f=Et();for(let P=0;PP.label}=r,{selected:S=null}=r,{hiddenOnMobile:k=!1}=r;const A=P=>{s(0,S=P),d(P)};return o.$$set=P=>{"options"in P&&s(1,f=P.options),"clickCallback"in P&&s(2,d=P.clickCallback),"backButtonCallback"in P&&s(3,n=P.backButtonCallback),"globalSelectedCategories"in P&&s(4,m=P.globalSelectedCategories),"columnTitle"in P&&s(5,b=P.columnTitle),"labeller"in P&&s(6,w=P.labeller),"selected"in P&&s(0,S=P.selected),"hiddenOnMobile"in P&&s(7,k=P.hiddenOnMobile),"$$scope"in P&&s(8,c=P.$$scope)},[S,f,d,n,m,b,w,k,c,l,A]}class rE extends Wr{constructor(r){super(),Kr(this,r,tE,Q2,jr,{options:1,clickCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,selected:0,hiddenOnMobile:7})}}function tg(o,r,s){const l=o.slice();return l[14]=r[s],l[16]=s,l}function rg(o){let r,s,l,c,f,d,n,m,b;return{c(){r=Ne("ol"),s=Ne("li"),l=Ne("button"),c=zt("Back"),f=Et(),d=la("svg"),n=la("path"),this.h()},l(w){r=Ue(w,"OL",{class:!0});var S=He(r);s=Ue(S,"LI",{class:!0,id:!0});var k=He(s);l=Ue(k,"BUTTON",{class:!0});var A=He(l);c=Mt(A,"Back"),A.forEach(te),f=kt(k),d=ca(k,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var P=He(d);n=ca(P,"path",{d:!0,transform:!0}),He(n).forEach(te),P.forEach(te),k.forEach(te),S.forEach(te),this.h()},h(){_e(l,"class","btn-link ons-breadcrumb__link"),_e(n,"d","M5.74,14.28l-.57-.56a.5.5,0,0,1,0-.71h0l5-5-5-5a.5.5,0,0,1,0-.71h0l.57-.56a.5.5,0,0,1,.71,0h0l5.93,5.93a.5.5,0,0,1,0,.7L6.45,14.28a.5.5,0,0,1-.71,0Z"),_e(n,"transform","translate(-5.02 -1.59)"),_e(d,"class","ons-svg-icon svelte-w4p0hu"),_e(d,"viewBox","0 0 8 13"),_e(d,"xmlns","http://www.w3.org/2000/svg"),_e(d,"focusable","false"),_e(d,"fill","currentColor"),_e(s,"class","ons-breadcrumb__item"),_e(s,"id","breadcrumb-1"),_e(r,"class","ons-breadcrumb__items ons-u-fs-s")},m(w,S){Be(w,r,S),Pe(r,s),Pe(s,l),Pe(l,c),Pe(s,f),Pe(s,d),Pe(d,n),m||(b=bs(l,"click",function(){m_(o[3])&&o[3].apply(this,arguments)}),m=!0)},p(w,S){o=w},d(w){w&&te(r),m=!1,b()}}}function ig(o){let r,s;return r=new ff({props:{variant:"secondary",small:!0,disabled:o[7],$$slots:{default:[iE]},$$scope:{ctx:o}}}),r.$on("click",o[11]),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&128&&(f.disabled=l[7]),c&8192&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function iE(o){let r;return{c(){r=zt("Remove selection")},l(s){r=Mt(s,"Remove selection")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function nE(o){let r,s=o[0],l,c,f=sg(o);const d=o[10].default,n=Di(d,o,o[13],null);return{c(){r=Ne("div"),f.c(),l=Et(),n&&n.c(),this.h()},l(m){r=Ue(m,"DIV",{class:!0});var b=He(r);f.l(b),b.forEach(te),l=kt(m),n&&n.l(m),this.h()},h(){_e(r,"class","ons-radios__items")},m(m,b){Be(m,r,b),f.m(r,null),Be(m,l,b),n&&n.m(m,b),c=!0},p(m,b){b&1&&jr(s,s=m[0])?(f.d(1),f=sg(m),f.c(),f.m(r,null)):f.p(m,b),n&&n.p&&(!c||b&8192)&&Ri(n,d,m,m[13],c?Bi(d,m[13],b,null):Li(m[13]),null)},i(m){c||(qe(n,m),c=!0)},o(m){nt(n,m),c=!1},d(m){m&&te(r),f.d(m),m&&te(l),n&&n.d(m)}}}function sE(o){let r;return{c(){r=zt(`At most three characteristics can be selected. To add another - characteristic, please remove one of the three selected ones.`)},l(s){r=Mt(s,`At most three characteristics can be selected. To add another - characteristic, please remove one of the three selected ones.`)},m(s,l){Be(s,r,l)},p:_r,i:_r,o:_r,d(s){s&&te(r)}}}function ng(o){let r,s,l,c,f,d=o[6](o[14])+"",n,m,b,w;function S(){return o[12](o[14])}return{c(){r=Ne("button"),s=Ne("span"),l=Ne("span"),c=Et(),f=Ne("span"),n=zt(d),m=Et(),this.h()},l(k){r=Ue(k,"BUTTON",{class:!0});var A=He(r);s=Ue(A,"SPAN",{class:!0});var P=He(s);l=Ue(P,"SPAN",{class:!0}),He(l).forEach(te),c=kt(P),f=Ue(P,"SPAN",{class:!0});var T=He(f);n=Mt(T,d),T.forEach(te),P.forEach(te),m=kt(A),A.forEach(te),this.h()},h(){_e(l,"class","ons-radio__input ons-js-radio svelte-1cwdic4"),_e(f,"class","ons-radio__label svelte-1cwdic4"),_e(s,"class","ons-radio ons-radio--no-border"),_e(r,"class","ons-radios__item ons-radios__item--no-border svelte-1cwdic4"),r.disabled=o[7],Ht(r,"ons-radio__checked",og(o[14],o[4]))},m(k,A){Be(k,r,A),Pe(r,s),Pe(s,l),Pe(s,c),Pe(s,f),Pe(f,n),Pe(r,m),b||(w=[g_(oE.call(null,r,o[16]===0)),bs(r,"click",S)],b=!0)},p(k,A){o=k,A&65&&d!==(d=o[6](o[14])+"")&&kr(n,d),A&128&&(r.disabled=o[7]),A&17&&Ht(r,"ons-radio__checked",og(o[14],o[4]))},d(k){k&&te(r),b=!1,_1(w)}}}function sg(o){let r,s=o[0],l=[];for(let c=0;c{T=null}),Ur());let Y=S;S=B($,J),S===Y?D[S].p($,J):(Nr(),nt(D[Y],1,1,()=>{D[Y]=null}),Ur(),k=D[S],k?k.p($,J):(k=D[S]=L[S]($),k.c()),qe(k,1),k.m(r,null)),(!A||J&256)&&Ht(r,"hidden-first-column",$[8])},i($){A||(qe(T),qe(k),A=!0)},o($){nt(T),nt(k),A=!1},d($){$&&te(r),P&&P.d(),T&&T.d(),D[S].d()}}}function ag(o){console.log("clicked",o)}function lf(o,r){for(let s of r)if(s.topic===o.label)return s.label;return!1}function og(o,r){for(const s of r)if(s.var===o.var&&s.code===o.code)return!0;return!1}function oE(o,r){r&&o.focus()}function lE(o,r,s){let{$$slots:l={},$$scope:c}=r,{options:f=[]}=r,{clickCallback:d=ag}=r,{removeCatCallback:n=ag}=r,{backButtonCallback:m=null}=r,{globalSelectedCategories:b=[]}=r,{columnTitle:w="column title"}=r,{labeller:S=D=>D.label}=r,{disabled:k=!1}=r,{hiddenOnMobile:A=!1}=r,{currentVar:P=null}=r;const T=()=>n(P),L=D=>d(D);return o.$$set=D=>{"options"in D&&s(0,f=D.options),"clickCallback"in D&&s(1,d=D.clickCallback),"removeCatCallback"in D&&s(2,n=D.removeCatCallback),"backButtonCallback"in D&&s(3,m=D.backButtonCallback),"globalSelectedCategories"in D&&s(4,b=D.globalSelectedCategories),"columnTitle"in D&&s(5,w=D.columnTitle),"labeller"in D&&s(6,S=D.labeller),"disabled"in D&&s(7,k=D.disabled),"hiddenOnMobile"in D&&s(8,A=D.hiddenOnMobile),"currentVar"in D&&s(9,P=D.currentVar),"$$scope"in D&&s(13,c=D.$$scope)},[f,d,n,m,b,w,S,k,A,P,l,T,L,c]}class cE extends Wr{constructor(r){super(),Kr(this,r,lE,aE,jr,{options:0,clickCallback:1,removeCatCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,disabled:7,hiddenOnMobile:8,currentVar:9})}}function lg(o,r,s){const l=o.slice();return l[15]=r[s],l}function cg(o){let r,s,l=[o[0].vars[o[7][o[0].label]]],c=[];for(let d=0;d<1;d+=1)c[d]=fg(lg(o,l,d));const f=d=>nt(c[d],1,1,()=>{c[d]=null});return{c(){for(let d=0;d<1;d+=1)c[d].c();r=er()},l(d){for(let n=0;n<1;n+=1)c[n].l(d);r=er()},m(d,n){for(let m=0;m<1;m+=1)c[m]&&c[m].m(d,n);Be(d,r,n),s=!0},p(d,n){if(n&1019){l=[d[0].vars[d[7][d[0].label]]];let m;for(m=0;m<1;m+=1){const b=lg(d,l,m);c[m]?(c[m].p(b,n),qe(c[m],1)):(c[m]=fg(b),c[m].c(),qe(c[m],1),c[m].m(r.parentNode,r))}for(Nr(),m=1;m<1;m+=1)f(m);Ur()}},i(d){if(!s){for(let n=0;n<1;n+=1)qe(c[n]);s=!0}},o(d){c=c.filter(Boolean);for(let n=0;n<1;n+=1)nt(c[n]);s=!1},d(d){Ui(c,d),d&&te(r)}}}function ug(o){let r,s,l,c,f,d;return s=new fd({props:{type:"chevron",rotation:90}}),{c(){r=Ne("button"),ir(s.$$.fragment),l=zt(" Show fewer"),this.h()},l(n){r=Ue(n,"BUTTON",{class:!0});var m=He(r);cr(s.$$.fragment,m),l=Mt(m," Show fewer"),m.forEach(te),this.h()},h(){_e(r,"class","btn-link")},m(n,m){Be(n,r,m),nr(s,r,null),Pe(r,l),c=!0,f||(d=bs(r,"click",o[9]),f=!0)},p:_r,i(n){c||(qe(s.$$.fragment,n),c=!0)},o(n){nt(s.$$.fragment,n),c=!1},d(n){n&&te(r),sr(s),f=!1,d()}}}function hg(o){let r,s,l,c,f,d;return s=new fd({props:{type:"chevron",rotation:-90}}),{c(){r=Ne("button"),ir(s.$$.fragment),l=zt(" Show more"),this.h()},l(n){r=Ue(n,"BUTTON",{class:!0});var m=He(r);cr(s.$$.fragment,m),l=Mt(m," Show more"),m.forEach(te),this.h()},h(){_e(r,"class","btn-link")},m(n,m){Be(n,r,m),nr(s,r,null),Pe(r,l),c=!0,f||(d=bs(r,"click",o[8]),f=!0)},p:_r,i(n){c||(qe(s.$$.fragment,n),c=!0)},o(n){nt(s.$$.fragment,n),c=!1},d(n){n&&te(r),sr(s),f=!1,d()}}}function uE(o){let r,s,l,c=o[7][o[0].label]>0&&ug(o),f=o[7][o[0].label]0?c?(c.p(d,n),n&129&&qe(c,1)):(c=ug(d),c.c(),qe(c,1),c.m(r.parentNode,r)):c&&(Nr(),nt(c,1,1,()=>{c=null}),Ur()),d[7][d[0].label]{f=null}),Ur())},i(d){l||(qe(c),qe(f),l=!0)},o(d){nt(c),nt(f),l=!1},d(d){c&&c.d(d),d&&te(r),f&&f.d(d),d&&te(s)}}}function fg(o){let r,s,l;function c(...m){return o[11](o[15],...m)}function f(...m){return o[12](o[15],...m)}function d(m){o[14](m)}let n={columnTitle:o[0].label,options:o[15].cats,clickCallback:c,removeCatCallback:f,backButtonCallback:o[13],globalSelectedCategories:o[5],currentVar:o[0],disabled:o[6],$$slots:{default:[uE]},$$scope:{ctx:o}};return o[1]!==void 0&&(n.selected=o[1]),r=new cE({props:n}),Za.push(()=>No(r,"selected",d)),{c(){ir(r.$$.fragment)},l(m){cr(r.$$.fragment,m)},m(m,b){nr(r,m,b),l=!0},p(m,b){o=m;const w={};b&1&&(w.columnTitle=o[0].label),b&129&&(w.options=o[15].cats),b&137&&(w.clickCallback=c),b&145&&(w.removeCatCallback=f),b&1&&(w.backButtonCallback=o[13]),b&32&&(w.globalSelectedCategories=o[5]),b&1&&(w.currentVar=o[0]),b&64&&(w.disabled=o[6]),b&262273&&(w.$$scope={dirty:b,ctx:o}),!s&&b&2&&(s=!0,w.selected=o[1],Uo(()=>s=!1)),r.$set(w)},i(m){l||(qe(r.$$.fragment,m),l=!0)},o(m){nt(r.$$.fragment,m),l=!1},d(m){sr(r,m)}}}function dg(o){let r,s,l=o[0]!=null&&cg(o);return{c(){l&&l.c(),r=er()},l(c){l&&l.l(c),r=er()},m(c,f){l&&l.m(c,f),Be(c,r,f),s=!0},p(c,f){c[0]!=null?l?(l.p(c,f),f&1&&qe(l,1)):(l=cg(c),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(c){s||(qe(l),s=!0)},o(c){nt(l),s=!1},d(c){l&&l.d(c),c&&te(r)}}}function hE(o){let r,s,l,c,f=o[0],d;function n(w){o[10](w)}let m={columnTitle:"Select a variable",clickCallback:pE,options:o[2],globalSelectedCategories:o[5],hiddenOnMobile:o[0]!=null};o[0]!==void 0&&(m.selected=o[0]),s=new rE({props:m}),Za.push(()=>No(s,"selected",n));let b=dg(o);return{c(){r=Ne("div"),ir(s.$$.fragment),c=Et(),b.c(),this.h()},l(w){r=Ue(w,"DIV",{class:!0});var S=He(r);cr(s.$$.fragment,S),c=kt(S),b.l(S),S.forEach(te),this.h()},h(){_e(r,"class","container svelte-9mqv54")},m(w,S){Be(w,r,S),nr(s,r,null),Pe(r,c),b.m(r,null),d=!0},p(w,[S]){const k={};S&4&&(k.options=w[2]),S&32&&(k.globalSelectedCategories=w[5]),S&1&&(k.hiddenOnMobile=w[0]!=null),!l&&S&1&&(l=!0,k.selected=w[0],Uo(()=>l=!1)),s.$set(k),S&1&&jr(f,f=w[0])?(Nr(),nt(b,1,1,_r),Ur(),b=dg(w),b.c(),qe(b,1),b.m(r,null)):b.p(w,S)},i(w){d||(qe(s.$$.fragment,w),qe(b),d=!0)},o(w){nt(s.$$.fragment,w),nt(b),d=!1},d(w){w&&te(r),sr(s),b.d(w)}}}function fE(o,r){console.log(o,r)}function dE(o,r){console.log(o,r)}const pE=()=>{};function mE(o,r,s){let l,{options:c=[]}=r,{clickCallback:f=fE}=r,{removeCatCallback:d=dE}=r,{globalSelectedCategories:n=[]}=r,{disabled:m=!1}=r,{activeColumn:b=null}=r,{activeCategory:w=null}=r;function S(){s(7,++l[b.label],l)}function k(){s(7,--l[b.label],l)}function A(B){b=B,s(0,b)}const P=(B,$)=>f(B,$),T=(B,$)=>d(B,$),L=()=>s(0,b=null);function D(B){w=B,s(1,w)}return o.$$set=B=>{"options"in B&&s(2,c=B.options),"clickCallback"in B&&s(3,f=B.clickCallback),"removeCatCallback"in B&&s(4,d=B.removeCatCallback),"globalSelectedCategories"in B&&s(5,n=B.globalSelectedCategories),"disabled"in B&&s(6,m=B.disabled),"activeColumn"in B&&s(0,b=B.activeColumn),"activeCategory"in B&&s(1,w=B.activeCategory)},o.$$.update=()=>{o.$$.dirty&4&&s(7,l=function(){let B={};return c.forEach($=>B[$.label]=0),B}())},[b,w,c,f,d,n,m,l,S,k,A,P,T,L,D]}class gE extends Wr{constructor(r){super(),Kr(this,r,mE,hE,jr,{options:2,clickCallback:3,removeCatCallback:4,globalSelectedCategories:5,disabled:6,activeColumn:0,activeCategory:1})}}var ny={exports:{}};(function(o,r){(function(s,l){o.exports=l()})(Ro,function(){var s,l,c;function f(n,m){if(!s)s=m;else if(!l)l=m;else{var b="var sharedChunk = {}; ("+s+")(sharedChunk); ("+l+")(sharedChunk);",w={};s(w),c=m(w),typeof window<"u"&&(c.workerUrl=window.URL.createObjectURL(new Blob([b],{type:"text/javascript"})))}}f(["exports"],function(n){var m=b;function b(i,e,a,h){this.cx=3*i,this.bx=3*(a-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=a,this.p2y=h}function w(i,e,a,h){const _=new m(i,e,a,h);return function(v){return _.solve(v)}}b.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var a=i,h=0;h<8;h++){var _=this.sampleCurveX(a)-i;if(Math.abs(_)_?E=a:C=a,a=.5*(C-E)+E;return a},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const S=w(.25,.1,.25,1);function k(i,e,a){return Math.min(a,Math.max(e,i))}function A(i,e,a){const h=a-e,_=((i-e)%h+h)%h+e;return _===e?a:_}function P(i,...e){for(const a of e)for(const h in a)i[h]=a[h];return i}let T=1;function L(i,e){i.forEach(a=>{e[a]&&(e[a]=e[a].bind(e))})}function D(i,e,a){const h={};for(const _ in i)h[_]=e.call(a||this,i[_],_,i);return h}function B(i,e,a){const h={};for(const _ in i)e.call(a||this,i[_],_,i)&&(h[_]=i[_]);return h}function $(i){return Array.isArray(i)?i.map($):typeof i=="object"&&i?D(i,$):i}const J={};function Y(i){J[i]||(typeof console<"u"&&console.warn(i),J[i]=!0)}function se(i,e,a){return(a.y-i.y)*(e.x-i.x)>(e.y-i.y)*(a.x-i.x)}function re(i){let e=0;for(let a,h,_=0,v=i.length,E=v-1;_@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,h,_,v)=>{const E=_||v;return e[h]=!E||E.toLowerCase(),""}),e["max-age"]){const a=parseInt(e["max-age"],10);isNaN(a)?delete e["max-age"]:e["max-age"]=a}return e}let Ae,_t,le=null;function We(i){if(le==null){const e=i.navigator?i.navigator.userAgent:null;le=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return le}function Z(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const $e={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const a=window.document.createElement("canvas"),h=a.getContext("2d");if(!h)throw new Error("failed to create canvas 2d context");return a.width=i.width,a.height=i.height,h.drawImage(i,0,0,i.width,i.height),h.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Ae||(Ae=document.createElement("a")),Ae.href=i,Ae.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(_t==null&&(_t=matchMedia("(prefers-reduced-motion: reduce)")),_t.matches)}};var ct=rt;function rt(i,e){this.x=i,this.y=e}rt.prototype={clone:function(){return new rt(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,a=i.y-this.y;return e*e+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),a=Math.sin(i),h=a*this.x+e*this.y;return this.x=e*this.x-a*this.y,this.y=h,this},_rotateAround:function(i,e){var a=Math.cos(i),h=Math.sin(i),_=e.y+h*(this.x-e.x)+a*(this.y-e.y);return this.x=e.x+a*(this.x-e.x)-h*(this.y-e.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},rt.convert=function(i){return i instanceof rt?i:Array.isArray(i)?new rt(i[0],i[1]):i};const $t={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},it="mapbox-tiles";let et,oe,ge=500,Me=50;function ee(){typeof caches>"u"||et||(et=caches.open(it))}let ue=1/0;const Je={supported:!1,testSupport:function(i){!Xe&&pt&&(Bt?Qt(i):wt=i)}};let wt,pt,Xe=!1,Bt=!1;function Qt(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,pt),i.isContextLost())return;Je.supported=!0}catch{}i.deleteTexture(e),Xe=!0}typeof document<"u"&&(pt=document.createElement("img"),pt.onload=function(){wt&&Qt(wt),wt=null,Bt=!0},pt.onerror=function(){Xe=!0,wt=null},pt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Rr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Rr);class Vr extends Error{constructor(e,a,h,_){super(`AJAXError: ${a} (${e}): ${h}`),this.status=e,this.statusText=a,this.url=h,this.body=_}}const H=ce()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function ut(i,e){const a=new AbortController,h=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:H(),signal:a.signal});let _=!1,v=!1;return i.type==="json"&&h.headers.set("Accept","application/json"),((E,C,M)=>{if(v)return;const F=Date.now();fetch(h).then(j=>j.ok?((W,X,ne)=>{(i.type==="arrayBuffer"?W.arrayBuffer():i.type==="json"?W.json():W.text()).then(ae=>{v||(X&&ne&&function(ke,we,Oe){if(ee(),!et)return;const Qe={status:we.status,statusText:we.statusText,headers:new Headers};we.headers.forEach((Ke,ft)=>Qe.headers.set(ft,Ke));const Le=ye(we.headers.get("Cache-Control")||"");Le["no-store"]||(Le["max-age"]&&Qe.headers.set("Expires",new Date(Oe+1e3*Le["max-age"]).toUTCString()),new Date(Qe.headers.get("Expires")).getTime()-Oe<42e4||function(Ke,ft){if(oe===void 0)try{new Response(new ReadableStream),oe=!0}catch{oe=!1}oe?ft(Ke.body):Ke.blob().then(ft)}(we,Ke=>{const ft=new Response(Ke,Qe);ee(),et&&et.then(ht=>ht.put(function(qt){const Zt=qt.indexOf("?");return Zt<0?qt:qt.slice(0,Zt)}(ke.url),ft)).catch(ht=>Y(ht.message))}))}(h,X,ne),_=!0,e(null,ae,W.headers.get("Cache-Control"),W.headers.get("Expires")))}).catch(ae=>{v||e(new Error(ae.message))})})(j,null,F):j.blob().then(W=>e(new Vr(j.status,j.statusText,i.url,W)))).catch(j=>{j.code!==20&&e(new Error(j.message))})})(),{cancel:()=>{v=!0,_||a.abort()}}}const tt=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(ce()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!ce()){const h=i.url.substring(0,i.url.indexOf("://"));return($t.REGISTERED_PROTOCOLS[h]||ut)(i,e)}}if(!(/^file:/.test(a=i.url)||/^file:/.test(H())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return ut(i,e);if(ce()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var a;return function(h,_){const v=new XMLHttpRequest;v.open(h.method||"GET",h.url,!0),h.type==="arrayBuffer"&&(v.responseType="arraybuffer");for(const E in h.headers)v.setRequestHeader(E,h.headers[E]);return h.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=h.credentials==="include",v.onerror=()=>{_(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let E=v.response;if(h.type==="json")try{E=JSON.parse(v.response)}catch(C){return _(C)}_(null,E,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else{const E=new Blob([v.response],{type:v.getResponseHeader("Content-Type")});_(new Vr(v.status,v.statusText,h.url,E))}},v.send(h.body),{cancel:()=>v.abort()}}(i,e)},be=function(i,e){return tt(P(i,{type:"arrayBuffer"}),e)};function pe(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const Ie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let dt,mt;dt=[],mt=0;const je=function(i,e){if(Je.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),mt>=$t.MAX_PARALLEL_IMAGE_REQUESTS){const v={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return dt.push(v),v}mt++;let a=!1;const h=()=>{if(!a)for(a=!0,mt--;dt.length&&mt<$t.MAX_PARALLEL_IMAGE_REQUESTS;){const v=dt.shift(),{requestParameters:E,callback:C,cancelled:M}=v;M||(v.cancel=je(E,C).cancel)}},_=be(i,(v,E,C,M)=>{h(),v?e(v):E&&function(F,j){typeof createImageBitmap=="function"?function(W,X){const ne=new Blob([new Uint8Array(W)],{type:"image/png"});createImageBitmap(ne).then(ae=>{X(null,ae)}).catch(ae=>{X(new Error(`Could not load image because of ${ae.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(F,j):function(W,X){const ne=new Image;ne.onload=()=>{X(null,ne),URL.revokeObjectURL(ne.src),ne.onload=null,window.requestAnimationFrame(()=>{ne.src=Ie})},ne.onerror=()=>X(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const ae=new Blob([new Uint8Array(W)],{type:"image/png"});ne.src=W.byteLength?URL.createObjectURL(ae):Ie}(F,j)}(E,(F,j)=>{F!=null?e(F):j!=null&&e(null,j,{cacheControl:C,expires:M})})});return{cancel:()=>{_.cancel(),h()}}};function vt(i,e,a){a[i]&&a[i].indexOf(e)!==-1||(a[i]=a[i]||[],a[i].push(e))}function Ot(i,e,a){if(a&&a[i]){const h=a[i].indexOf(e);h!==-1&&a[i].splice(h,1)}}class St{constructor(e,a={}){P(this,a),this.type=e}}class Wt extends St{constructor(e,a={}){super("error",P({error:e},a))}}class wr{on(e,a){return this._listeners=this._listeners||{},vt(e,a,this._listeners),this}off(e,a){return Ot(e,a,this._listeners),Ot(e,a,this._oneTimeListeners),this}once(e,a){return this._oneTimeListeners=this._oneTimeListeners||{},vt(e,a,this._oneTimeListeners),this}fire(e,a){typeof e=="string"&&(e=new St(e,a||{}));const h=e.type;if(this.listens(h)){e.target=this;const _=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const C of _)C.call(this,e);const v=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const C of v)Ot(h,C,this._oneTimeListeners),C.call(this,e);const E=this._eventedParent;E&&(P(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),E.fire(e))}else e instanceof Wt&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,a){return this._eventedParent=e,this._eventedParentData=a,this}}var Fe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class gt{constructor(e,a,h,_){this.message=(e?`${e}: `:"")+h,_&&(this.identifier=_),a!=null&&a.__line__&&(this.line=a.__line__)}}function mi(i){const e=i.value;return e?[new gt(i.key,e,"constants have been deprecated as of v8")]:[]}function ri(i,...e){for(const a of e)for(const h in a)i[h]=a[h];return i}function yr(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Sr(i){if(Array.isArray(i))return i.map(Sr);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const a in i)e[a]=Sr(i[a]);return e}return yr(i)}class gi extends Error{constructor(e,a){super(a),this.message=a,this.key=e}}class Ei{constructor(e,a=[]){this.parent=e,this.bindings={};for(const[h,_]of a)this.bindings[h]=_}concat(e){return new Ei(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const _i={kind:"null"},Tt={kind:"number"},pr={kind:"string"},hr={kind:"boolean"},yi={kind:"color"},nn={kind:"object"},ar={kind:"value"},Vi={kind:"collator"},ii={kind:"formatted"},ss={kind:"padding"},ui={kind:"resolvedImage"};function Oi(i,e){return{kind:"array",itemType:i,N:e}}function Lr(i){if(i.kind==="array"){const e=Lr(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Un=[_i,Tt,pr,hr,yi,ii,nn,Oi(ar),ss,ui];function gn(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!gn(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const a of Un)if(!gn(a,e))return null}}return`Expected ${Lr(i)} but found ${Lr(e)} instead.`}function zn(i,e){return e.some(a=>a.kind===i.kind)}function Vn(i,e){return e.some(a=>a==="null"?i===null:a==="array"?Array.isArray(i):a==="object"?i&&!Array.isArray(i)&&typeof i=="object":a===typeof i)}var $n,Ce={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function N(i){return(i=Math.round(i))<0?0:i>255?255:i}function z(i){return N(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function U(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function q(i,e,a){return a<0?a+=1:a>1&&(a-=1),6*a<1?i+(e-i)*a*6:2*a<1?e:3*a<2?i+(e-i)*(2/3-a)*6:i}try{$n={}.parseCSSColor=function(i){var e,a=i.replace(/ /g,"").toLowerCase();if(a in Ce)return Ce[a].slice();if(a[0]==="#")return a.length===4?(e=parseInt(a.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:a.length===7&&(e=parseInt(a.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var h=a.indexOf("("),_=a.indexOf(")");if(h!==-1&&_+1===a.length){var v=a.substr(0,h),E=a.substr(h+1,_-(h+1)).split(","),C=1;switch(v){case"rgba":if(E.length!==4)return null;C=U(E.pop());case"rgb":return E.length!==3?null:[z(E[0]),z(E[1]),z(E[2]),C];case"hsla":if(E.length!==4)return null;C=U(E.pop());case"hsl":if(E.length!==3)return null;var M=(parseFloat(E[0])%360+360)%360/360,F=U(E[1]),j=U(E[2]),W=j<=.5?j*(F+1):j+F-j*F,X=2*j-W;return[N(255*q(X,W,M+1/3)),N(255*q(X,W,M)),N(255*q(X,W,M-1/3)),C];default:return null}}return null}}catch{}class Q{constructor(e,a,h,_=1){this.r=e,this.g=a,this.b=h,this.a=_}static parse(e){if(!e)return;if(e instanceof Q)return e;if(typeof e!="string")return;const a=$n(e);return a?new Q(a[0]/255*a[3],a[1]/255*a[3],a[2]/255*a[3],a[3]):void 0}toString(){const[e,a,h,_]=this.toArray();return`rgba(${Math.round(e)},${Math.round(a)},${Math.round(h)},${_})`}toArray(){const{r:e,g:a,b:h,a:_}=this;return _===0?[0,0,0,0]:[255*e/_,255*a/_,255*h/_,_]}}Q.black=new Q(0,0,0,1),Q.white=new Q(1,1,1,1),Q.transparent=new Q(0,0,0,0),Q.red=new Q(1,0,0,1);class he{constructor(e,a,h){this.sensitivity=e?a?"variant":"case":a?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,a){return this.collator.compare(e,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Se{constructor(e,a,h,_,v){this.text=e,this.image=a,this.scale=h,this.fontStack=_,this.textColor=v}}class Ee{constructor(e){this.sections=e}static fromString(e){return new Ee([new Se(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ee?e:Ee.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ve{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ve)return e;if(typeof e=="number")return new ve([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const a of e)if(typeof a!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new ve(e)}}toString(){return JSON.stringify(this.values)}}class Te{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Te({name:e,available:!1}):null}}function Ge(i,e,a,h){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof a=="number"&&a>=0&&a<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[i,e,a,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[i,e,a,h]:[i,e,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ot(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Q||i instanceof he||i instanceof Ee||i instanceof ve||i instanceof Te)return!0;if(Array.isArray(i)){for(const e of i)if(!ot(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ot(i[e]))return!1;return!0}return!1}function Re(i){if(i===null)return _i;if(typeof i=="string")return pr;if(typeof i=="boolean")return hr;if(typeof i=="number")return Tt;if(i instanceof Q)return yi;if(i instanceof he)return Vi;if(i instanceof Ee)return ii;if(i instanceof ve)return ss;if(i instanceof Te)return ui;if(Array.isArray(i)){const e=i.length;let a;for(const h of i){const _=Re(h);if(a){if(a===_)continue;a=ar;break}a=_}return Oi(a||ar,e)}return nn}function Ct(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Q||i instanceof Ee||i instanceof ve||i instanceof Te?i.toString():JSON.stringify(i)}class Pt{constructor(e,a){this.type=e,this.value=a}static parse(e,a){if(e.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ot(e[1]))return a.error("invalid value");const h=e[1];let _=Re(h);const v=a.expectedType;return _.kind!=="array"||_.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(_=v),new Pt(_,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class bt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Xt={string:pr,number:Tt,boolean:hr,object:nn};class Yt{constructor(e,a){this.type=e,this.args=a}static parse(e,a){if(e.length<2)return a.error("Expected at least one argument.");let h,_=1;const v=e[0];if(v==="array"){let C,M;if(e.length>2){const F=e[1];if(typeof F!="string"||!(F in Xt)||F==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);C=Xt[F],_++}else C=ar;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return a.error('The length argument to "array" must be a positive integer literal',2);M=e[2],_++}h=Oi(C,M)}else{if(!Xt[v])throw new Error(`Types doesn't contain name = ${v}`);h=Xt[v]}const E=[];for(;_e.outputDefined())}}const mr={"to-boolean":hr,"to-color":yi,"to-number":Tt,"to-string":pr};class or{constructor(e,a){this.type=e,this.args=a}static parse(e,a){if(e.length<2)return a.error("Expected at least one argument.");const h=e[0];if(!mr[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&e.length!==2)return a.error("Expected one argument.");const _=mr[h],v=[];for(let E=1;E4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Ge(a[0],a[1],a[2],a[3]),!h))return new Q(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new bt(h||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}if(this.type.kind==="padding"){let a;for(const h of this.args){a=h.evaluate(e);const _=ve.parse(a);if(_)return _}throw new bt(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}if(this.type.kind==="number"){let a=null;for(const h of this.args){if(a=h.evaluate(e),a===null)return 0;const _=Number(a);if(!isNaN(_))return _}throw new bt(`Could not convert ${JSON.stringify(a)} to number.`)}return this.type.kind==="formatted"?Ee.fromString(Ct(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Te.fromString(Ct(this.args[0].evaluate(e))):Ct(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const fr=["Unknown","Point","LineString","Polygon"];class dr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?fr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let a=this._parseColorCache[e];return a||(a=this._parseColorCache[e]=Q.parse(e)),a}}class Tr{constructor(e,a,h,_){this.name=e,this.type=a,this._evaluate=h,this.args=_}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,a){const h=e[0],_=Tr.definitions[h];if(!_)return a.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(_)?_[0]:_.type,E=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,C=E.filter(([F])=>!Array.isArray(F)||F.length===e.length-1);let M=null;for(const[F,j]of C){M=new Vs(a.registry,a.path,null,a.scope);const W=[];let X=!1;for(let ne=1;ne{return X=W,Array.isArray(X)?`(${X.map(Lr).join(", ")})`:`(${Lr(X.type)}...)`;var X}).join(" | "),j=[];for(let W=1;W=e[2]||i[1]<=e[1]||i[3]>=e[3])}function as(i,e){const a=(180+i[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,_=Math.pow(2,e.z);return[Math.round(a*_*Dr),Math.round(h*_*Dr)]}function Br(i,e,a){const h=i[0]-e[0],_=i[1]-e[1],v=i[0]-a[0],E=i[1]-a[1];return h*E-v*_==0&&h*v<=0&&_*E<=0}function os(i,e){let a=!1;for(let E=0,C=e.length;E(h=i)[1]!=(v=M[F+1])[1]>h[1]&&h[0]<(v[0]-_[0])*(h[1]-_[1])/(v[1]-_[1])+_[0]&&(a=!a)}}var h,_,v;return a}function ls(i,e){for(let a=0;a0&&C<0||E<0&&C>0}function ha(i,e,a){for(const F of a)for(let j=0;ja[2]){const _=.5*h;let v=i[0]-a[0]>_?-h:a[0]-i[0]>_?h:0;v===0&&(v=i[0]-a[2]>_?-h:a[2]-i[0]>_?h:0),i[0]+=v}fi(e,i)}function fc(i,e,a,h){const _=Math.pow(2,h.z)*Dr,v=[h.x*Dr,h.y*Dr],E=[];for(const C of i)for(const M of C){const F=[M.x+v[0],M.y+v[1]];hc(F,e,a,_),E.push(F)}return E}function dc(i,e,a,h){const _=Math.pow(2,h.z)*Dr,v=[h.x*Dr,h.y*Dr],E=[];for(const M of i){const F=[];for(const j of M){const W=[j.x+v[0],j.y+v[1]];fi(e,W),F.push(W)}E.push(F)}if(e[2]-e[0]<=_/2){(C=e)[0]=C[1]=1/0,C[2]=C[3]=-1/0;for(const M of E)for(const F of M)hc(F,e,a,_)}var C;return E}class ws{constructor(e,a){this.type=hr,this.geojson=e,this.geometries=a}static parse(e,a){if(e.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ot(e[1])){const h=e[1];if(h.type==="FeatureCollection")for(let _=0;_{e&&!fa(a)&&(e=!1)}),e}function Us(i){if(i instanceof Tr&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(a=>{e&&!Us(a)&&(e=!1)}),e}function Ja(i,e){if(i instanceof Tr&&e.indexOf(i.name)>=0)return!1;let a=!0;return i.eachChild(h=>{a&&!Ja(h,e)&&(a=!1)}),a}class Ya{constructor(e,a){this.type=a.type,this.name=e,this.boundExpression=a}static parse(e,a){if(e.length!==2||typeof e[1]!="string")return a.error("'var' expression requires exactly one string literal argument.");const h=e[1];return a.scope.has(h)?new Ya(h,a.scope.get(h)):a.error(`Unknown variable "${h}". Make sure "${h}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Vs{constructor(e,a=[],h,_=new Ei,v=[]){this.registry=e,this.path=a,this.key=a.map(E=>`[${E}]`).join(""),this.scope=_,this.errors=v,this.expectedType=h}parse(e,a,h,_,v={}){return a?this.concat(a,h,_)._parse(e,v):this._parse(e,v)}_parse(e,a){function h(_,v,E){return E==="assert"?new Yt(v,[_]):E==="coerce"?new or(v,[_]):_}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const _=e[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[_];if(v){let E=v.parse(e,this);if(!E)return null;if(this.expectedType){const C=this.expectedType,M=E.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||M.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||M.kind!=="value"&&M.kind!=="string")if(C.kind!=="padding"||M.kind!=="value"&&M.kind!=="number"&&M.kind!=="array"){if(this.checkSubtype(C,M))return null}else E=h(E,C,a.typeAnnotation||"coerce");else E=h(E,C,a.typeAnnotation||"coerce");else E=h(E,C,a.typeAnnotation||"assert")}if(!(E instanceof Pt)&&E.type.kind!=="resolvedImage"&&Wo(E)){const C=new dr;try{E=new Pt(E.type,E.evaluate(C))}catch(M){return this.error(M.message),null}}return E}return this.error(`Unknown expression "${_}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,a,h){const _=typeof e=="number"?this.path.concat(e):this.path,v=h?this.scope.concat(h):this.scope;return new Vs(this.registry,_,a||null,v,this.errors)}error(e,...a){const h=`${this.key}${a.map(_=>`[${_}]`).join("")}`;this.errors.push(new gi(h,e))}checkSubtype(e,a){const h=gn(e,a);return h&&this.error(h),h}}function Wo(i){if(i instanceof Ya)return Wo(i.boundExpression);if(i instanceof Tr&&i.name==="error"||i instanceof Qr||i instanceof ws)return!1;const e=i instanceof or||i instanceof Yt;let a=!0;return i.eachChild(h=>{a=e?a&&Wo(h):a&&h instanceof Pt}),!!a&&fa(i)&&Ja(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Qa(i,e){const a=i.length-1;let h,_,v=0,E=a,C=0;for(;v<=E;)if(C=Math.floor((v+E)/2),h=i[C],_=i[C+1],h<=e){if(C===a||e<_)return C;v=C+1}else{if(!(h>e))throw new bt("Input is not a number.");E=C-1}return 0}class da{constructor(e,a,h){this.type=e,this.input=a,this.labels=[],this.outputs=[];for(const[_,v]of h)this.labels.push(_),this.outputs.push(v)}static parse(e,a){if(e.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return a.error("Expected an even number of arguments.");const h=a.parse(e[1],1,Tt);if(!h)return null;const _=[];let v=null;a.expectedType&&a.expectedType.kind!=="value"&&(v=a.expectedType);for(let E=1;E=C)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',F);const W=a.parse(M,j,v);if(!W)return null;v=v||W.type,_.push([C,W])}return new da(v,h,_)}evaluate(e){const a=this.labels,h=this.outputs;if(a.length===1)return h[0].evaluate(e);const _=this.input.evaluate(e);if(_<=a[0])return h[0].evaluate(e);const v=a.length;return _>=a[v-1]?h[v-1].evaluate(e):h[Qa(a,_)].evaluate(e)}eachChild(e){e(this.input);for(const a of this.outputs)e(a)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ni(i,e,a){return i*(1-a)+e*a}var pa=Object.freeze({__proto__:null,number:ni,color:function(i,e,a){return new Q(ni(i.r,e.r,a),ni(i.g,e.g,a),ni(i.b,e.b,a),ni(i.a,e.a,a))},array:function(i,e,a){return i.map((h,_)=>ni(h,e[_],a))},padding:function(i,e,a){const h=i.values,_=e.values;return new ve([ni(h[0],_[0],a),ni(h[1],_[1],a),ni(h[2],_[2],a),ni(h[3],_[3],a)])}});const pc=.95047,mc=1.08883,Ko=4/29,eo=6/29,gc=3*eo*eo,Ku=Math.PI/180,Xu=180/Math.PI;function Xo(i){return i>.008856451679035631?Math.pow(i,1/3):i/gc+Ko}function Jo(i){return i>eo?i*i*i:gc*(i-Ko)}function Yo(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Qo(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Or(i){const e=Qo(i.r),a=Qo(i.g),h=Qo(i.b),_=Xo((.4124564*e+.3575761*a+.1804375*h)/pc),v=Xo((.2126729*e+.7151522*a+.072175*h)/1);return{l:116*v-16,a:500*(_-v),b:200*(v-Xo((.0193339*e+.119192*a+.9503041*h)/mc)),alpha:i.a}}function _c(i){let e=(i.l+16)/116,a=isNaN(i.a)?e:e+i.a/500,h=isNaN(i.b)?e:e-i.b/200;return e=1*Jo(e),a=pc*Jo(a),h=mc*Jo(h),new Q(Yo(3.2404542*a-1.5371385*e-.4985314*h),Yo(-.969266*a+1.8760108*e+.041556*h),Yo(.0556434*a-.2040259*e+1.0572252*h),i.alpha)}function Ju(i,e,a){const h=e-i;return i+a*(h>180||h<-180?h-360*Math.round(h/360):h)}const ma={forward:Or,reverse:_c,interpolate:function(i,e,a){return{l:ni(i.l,e.l,a),a:ni(i.a,e.a,a),b:ni(i.b,e.b,a),alpha:ni(i.alpha,e.alpha,a)}}},ga={forward:function(i){const{l:e,a,b:h}=Or(i),_=Math.atan2(h,a)*Xu;return{h:_<0?_+360:_,c:Math.sqrt(a*a+h*h),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Ku,a=i.c;return _c({l:i.l,a:Math.cos(e)*a,b:Math.sin(e)*a,alpha:i.alpha})},interpolate:function(i,e,a){return{h:Ju(i.h,e.h,a),c:ni(i.c,e.c,a),l:ni(i.l,e.l,a),alpha:ni(i.alpha,e.alpha,a)}}};var yc=Object.freeze({__proto__:null,lab:ma,hcl:ga});class sn{constructor(e,a,h,_,v){this.type=e,this.operator=a,this.interpolation=h,this.input=_,this.labels=[],this.outputs=[];for(const[E,C]of v)this.labels.push(E),this.outputs.push(C)}static interpolationFactor(e,a,h,_){let v=0;if(e.name==="exponential")v=el(a,e.base,h,_);else if(e.name==="linear")v=el(a,1,h,_);else if(e.name==="cubic-bezier"){const E=e.controlPoints;v=new m(E[0],E[1],E[2],E[3]).solve(el(a,1,h,_))}return v}static parse(e,a){let[h,_,v,...E]=e;if(!Array.isArray(_)||_.length===0)return a.error("Expected an interpolation type expression.",1);if(_[0]==="linear")_={name:"linear"};else if(_[0]==="exponential"){const F=_[1];if(typeof F!="number")return a.error("Exponential interpolation requires a numeric base.",1,1);_={name:"exponential",base:F}}else{if(_[0]!=="cubic-bezier")return a.error(`Unknown interpolation type ${String(_[0])}`,1,0);{const F=_.slice(1);if(F.length!==4||F.some(j=>typeof j!="number"||j<0||j>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:F}}}if(e.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(v=a.parse(v,2,Tt),!v)return null;const C=[];let M=null;h==="interpolate-hcl"||h==="interpolate-lab"?M=yi:a.expectedType&&a.expectedType.kind!=="value"&&(M=a.expectedType);for(let F=0;F=j)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const ae=a.parse(W,ne,M);if(!ae)return null;M=M||ae.type,C.push([j,ae])}return M.kind==="number"||M.kind==="color"||M.kind==="padding"||M.kind==="array"&&M.itemType.kind==="number"&&typeof M.N=="number"?new sn(M,h,_,v,C):a.error(`Type ${Lr(M)} is not interpolatable.`)}evaluate(e){const a=this.labels,h=this.outputs;if(a.length===1)return h[0].evaluate(e);const _=this.input.evaluate(e);if(_<=a[0])return h[0].evaluate(e);const v=a.length;if(_>=a[v-1])return h[v-1].evaluate(e);const E=Qa(a,_),C=sn.interpolationFactor(this.interpolation,_,a[E],a[E+1]),M=h[E].evaluate(e),F=h[E+1].evaluate(e);return this.operator==="interpolate"?pa[this.type.kind.toLowerCase()](M,F,C):this.operator==="interpolate-hcl"?ga.reverse(ga.interpolate(ga.forward(M),ga.forward(F),C)):ma.reverse(ma.interpolate(ma.forward(M),ma.forward(F),C))}eachChild(e){e(this.input);for(const a of this.outputs)e(a)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function el(i,e,a,h){const _=h-a,v=i-a;return _===0?0:e===1?v/_:(Math.pow(e,v)-1)/(Math.pow(e,_)-1)}class to{constructor(e,a){this.type=e,this.args=a}static parse(e,a){if(e.length<2)return a.error("Expectected at least one argument.");let h=null;const _=a.expectedType;_&&_.kind!=="value"&&(h=_);const v=[];for(const C of e.slice(1)){const M=a.parse(C,1+v.length,h,void 0,{typeAnnotation:"omit"});if(!M)return null;h=h||M.type,v.push(M)}if(!h)throw new Error("No output type");const E=_&&v.some(C=>gn(_,C.type));return new to(E?ar:h,v)}evaluate(e){let a,h=null,_=0;for(const v of this.args)if(_++,h=v.evaluate(e),h&&h instanceof Te&&!h.available&&(a||(a=h.name),h=null,_===this.args.length&&(h=a)),h!==null)break;return h}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ro{constructor(e,a){this.type=a.type,this.bindings=[].concat(e),this.result=a}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const a of this.bindings)e(a[1]);e(this.result)}static parse(e,a){if(e.length<4)return a.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const h=[];for(let v=1;v=h.length)throw new bt(`Array index out of bounds: ${a} > ${h.length-1}.`);if(a!==Math.floor(a))throw new bt(`Array index must be an integer, but found ${a} instead.`);return h[a]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class rl{constructor(e,a){this.type=hr,this.needle=e,this.haystack=a}static parse(e,a){if(e.length!==3)return a.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const h=a.parse(e[1],1,ar),_=a.parse(e[2],2,ar);return h&&_?zn(h.type,[hr,pr,Tt,_i,ar])?new rl(h,_):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(h.type)} instead`):null}evaluate(e){const a=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!h)return!1;if(!Vn(a,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(Re(a))} instead.`);if(!Vn(h,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${Lr(Re(h))} instead.`);return h.indexOf(a)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class io{constructor(e,a,h){this.type=Tt,this.needle=e,this.haystack=a,this.fromIndex=h}static parse(e,a){if(e.length<=2||e.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=a.parse(e[1],1,ar),_=a.parse(e[2],2,ar);if(!h||!_)return null;if(!zn(h.type,[hr,pr,Tt,_i,ar]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(h.type)} instead`);if(e.length===4){const v=a.parse(e[3],3,Tt);return v?new io(h,_,v):null}return new io(h,_)}evaluate(e){const a=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!Vn(a,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(Re(a))} instead.`);if(!Vn(h,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${Lr(Re(h))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(e);return h.indexOf(a,_)}return h.indexOf(a)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class il{constructor(e,a,h,_,v,E){this.inputType=e,this.type=a,this.input=h,this.cases=_,this.outputs=v,this.otherwise=E}static parse(e,a){if(e.length<5)return a.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return a.error("Expected an even number of arguments.");let h,_;a.expectedType&&a.expectedType.kind!=="value"&&(_=a.expectedType);const v={},E=[];for(let F=2;FNumber.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ae=="number"&&Math.floor(ae)!==ae)return X.error("Numeric branch labels must be integer values.");if(h){if(X.checkSubtype(h,Re(ae)))return null}else h=Re(ae);if(v[String(ae)]!==void 0)return X.error("Branch labels must be unique.");v[String(ae)]=E.length}const ne=a.parse(W,F,_);if(!ne)return null;_=_||ne.type,E.push(ne)}const C=a.parse(e[1],1,ar);if(!C)return null;const M=a.parse(e[e.length-1],e.length-1,_);return M?C.type.kind!=="value"&&a.concat(1).checkSubtype(h,C.type)?null:new il(h,_,C,v,E,M):null}evaluate(e){const a=this.input.evaluate(e);return(Re(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class nl{constructor(e,a,h){this.type=e,this.branches=a,this.otherwise=h}static parse(e,a){if(e.length<4)return a.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return a.error("Expected an odd number of arguments.");let h;a.expectedType&&a.expectedType.kind!=="value"&&(h=a.expectedType);const _=[];for(let E=1;Ea.outputDefined())&&this.otherwise.outputDefined()}}class no{constructor(e,a,h,_){this.type=e,this.input=a,this.beginIndex=h,this.endIndex=_}static parse(e,a){if(e.length<=2||e.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=a.parse(e[1],1,ar),_=a.parse(e[2],2,Tt);if(!h||!_)return null;if(!zn(h.type,[Oi(ar),pr,ar]))return a.error(`Expected first argument to be of type array or string, but found ${Lr(h.type)} instead`);if(e.length===4){const v=a.parse(e[3],3,Tt);return v?new no(h.type,h,_,v):null}return new no(h.type,h,_)}evaluate(e){const a=this.input.evaluate(e),h=this.beginIndex.evaluate(e);if(!Vn(a,["string","array"]))throw new bt(`Expected first argument to be of type array or string, but found ${Lr(Re(a))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(e);return a.slice(h,_)}return a.slice(h)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function vc(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function bc(i,e,a,h){return h.compare(e,a)===0}function $s(i,e,a){const h=i!=="=="&&i!=="!=";return class sy{constructor(v,E,C){this.type=hr,this.lhs=v,this.rhs=E,this.collator=C,this.hasUntypedArgument=v.type.kind==="value"||E.type.kind==="value"}static parse(v,E){if(v.length!==3&&v.length!==4)return E.error("Expected two or three arguments.");const C=v[0];let M=E.parse(v[1],1,ar);if(!M)return null;if(!vc(C,M.type))return E.concat(1).error(`"${C}" comparisons are not supported for type '${Lr(M.type)}'.`);let F=E.parse(v[2],2,ar);if(!F)return null;if(!vc(C,F.type))return E.concat(2).error(`"${C}" comparisons are not supported for type '${Lr(F.type)}'.`);if(M.type.kind!==F.type.kind&&M.type.kind!=="value"&&F.type.kind!=="value")return E.error(`Cannot compare types '${Lr(M.type)}' and '${Lr(F.type)}'.`);h&&(M.type.kind==="value"&&F.type.kind!=="value"?M=new Yt(F.type,[M]):M.type.kind!=="value"&&F.type.kind==="value"&&(F=new Yt(M.type,[F])));let j=null;if(v.length===4){if(M.type.kind!=="string"&&F.type.kind!=="string"&&M.type.kind!=="value"&&F.type.kind!=="value")return E.error("Cannot use collator to compare non-string types.");if(j=E.parse(v[3],3,Vi),!j)return null}return new sy(M,F,j)}evaluate(v){const E=this.lhs.evaluate(v),C=this.rhs.evaluate(v);if(h&&this.hasUntypedArgument){const M=Re(E),F=Re(C);if(M.kind!==F.kind||M.kind!=="string"&&M.kind!=="number")throw new bt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${M.kind}, ${F.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const M=Re(E),F=Re(C);if(M.kind!=="string"||F.kind!=="string")return e(v,E,C)}return this.collator?a(v,E,C,this.collator.evaluate(v)):e(v,E,C)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const Yu=$s("==",function(i,e,a){return e===a},bc),Qu=$s("!=",function(i,e,a){return e!==a},function(i,e,a,h){return!bc(0,e,a,h)}),eh=$s("<",function(i,e,a){return e",function(i,e,a){return e>a},function(i,e,a,h){return h.compare(e,a)>0}),rh=$s("<=",function(i,e,a){return e<=a},function(i,e,a,h){return h.compare(e,a)<=0}),ih=$s(">=",function(i,e,a){return e>=a},function(i,e,a,h){return h.compare(e,a)>=0});class sl{constructor(e,a,h,_,v){this.type=pr,this.number=e,this.locale=a,this.currency=h,this.minFractionDigits=_,this.maxFractionDigits=v}static parse(e,a){if(e.length!==3)return a.error("Expected two arguments.");const h=a.parse(e[1],1,Tt);if(!h)return null;const _=e[2];if(typeof _!="object"||Array.isArray(_))return a.error("NumberFormat options argument must be an object.");let v=null;if(_.locale&&(v=a.parse(_.locale,1,pr),!v))return null;let E=null;if(_.currency&&(E=a.parse(_.currency,1,pr),!E))return null;let C=null;if(_["min-fraction-digits"]&&(C=a.parse(_["min-fraction-digits"],1,Tt),!C))return null;let M=null;return _["max-fraction-digits"]&&(M=a.parse(_["max-fraction-digits"],1,Tt),!M)?null:new sl(h,v,E,C,M)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class so{constructor(e){this.type=ii,this.sections=e}static parse(e,a){if(e.length<2)return a.error("Expected at least one argument.");const h=e[1];if(!Array.isArray(h)&&typeof h=="object")return a.error("First argument must be an image or text section.");const _=[];let v=!1;for(let E=1;E<=e.length-1;++E){const C=e[E];if(v&&typeof C=="object"&&!Array.isArray(C)){v=!1;let M=null;if(C["font-scale"]&&(M=a.parse(C["font-scale"],1,Tt),!M))return null;let F=null;if(C["text-font"]&&(F=a.parse(C["text-font"],1,Oi(pr)),!F))return null;let j=null;if(C["text-color"]&&(j=a.parse(C["text-color"],1,yi),!j))return null;const W=_[_.length-1];W.scale=M,W.font=F,W.textColor=j}else{const M=a.parse(e[E],1,ar);if(!M)return null;const F=M.type.kind;if(F!=="string"&&F!=="value"&&F!=="null"&&F!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,_.push({content:M,scale:null,font:null,textColor:null})}}return new so(_)}evaluate(e){return new Ee(this.sections.map(a=>{const h=a.content.evaluate(e);return Re(h)===ui?new Se("",h,null,null,null):new Se(Ct(h),null,a.scale?a.scale.evaluate(e):null,a.font?a.font.evaluate(e).join(","):null,a.textColor?a.textColor.evaluate(e):null)}))}eachChild(e){for(const a of this.sections)e(a.content),a.scale&&e(a.scale),a.font&&e(a.font),a.textColor&&e(a.textColor)}outputDefined(){return!1}}class al{constructor(e){this.type=ui,this.input=e}static parse(e,a){if(e.length!==2)return a.error("Expected two arguments.");const h=a.parse(e[1],1,pr);return h?new al(h):a.error("No image name provided.")}evaluate(e){const a=this.input.evaluate(e),h=Te.fromString(a);return h&&e.availableImages&&(h.available=e.availableImages.indexOf(a)>-1),h}eachChild(e){e(this.input)}outputDefined(){return!1}}class ol{constructor(e){this.type=Tt,this.input=e}static parse(e,a){if(e.length!==2)return a.error(`Expected 1 argument, but found ${e.length-1} instead.`);const h=a.parse(e[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${Lr(h.type)} instead.`):new ol(h):null}evaluate(e){const a=this.input.evaluate(e);if(typeof a=="string"||Array.isArray(a))return a.length;throw new bt(`Expected value to be of type string or array, but found ${Lr(Re(a))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const js={"==":Yu,"!=":Qu,">":th,"<":eh,">=":ih,"<=":rh,array:Yt,at:tl,boolean:Yt,case:nl,coalesce:to,collator:Qr,format:so,image:al,in:rl,"index-of":io,interpolate:sn,"interpolate-hcl":sn,"interpolate-lab":sn,length:ol,let:ro,literal:Pt,match:il,number:Yt,"number-format":sl,object:Yt,slice:no,step:da,string:Yt,"to-boolean":or,"to-color":or,"to-number":or,"to-string":or,var:Ya,within:ws};function xc(i,[e,a,h,_]){e=e.evaluate(i),a=a.evaluate(i),h=h.evaluate(i);const v=_?_.evaluate(i):1,E=Ge(e,a,h,v);if(E)throw new bt(E);return new Q(e/255*v,a/255*v,h/255*v,v)}function wc(i,e){return i in e}function ao(i,e){const a=e[i];return a===void 0?null:a}function Es(i){return{type:i}}function Ec(i){return{result:"success",value:i}}function qs(i){return{result:"error",value:i}}function ei(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function kc(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Cr(i){return!!i.expression&&i.expression.interpolated}function Fr(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Yr(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function si(i){return i}function _a(i,e){const a=e.type==="color",h=i.stops&&typeof i.stops[0][0]=="object",_=h||!(h||i.property!==void 0),v=i.type||(Cr(e)?"exponential":"interval");if(a||e.type==="padding"){const F=a?Q.parse:ve.parse;(i=ri({},i)).stops&&(i.stops=i.stops.map(j=>[j[0],F(j[1])])),i.default=F(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!yc[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let E,C,M;if(v==="exponential")E=Sc;else if(v==="interval")E=sh;else if(v==="categorical"){E=nh,C=Object.create(null);for(const F of i.stops)C[F[0]]=F[1];M=typeof i.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=ah}if(h){const F={},j=[];for(let ne=0;nene[0]),evaluate:({zoom:ne},ae)=>Sc({stops:W,base:i.base},e,ne).evaluate(ne,ae)}}if(_){const F=v==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:F,interpolationFactor:sn.interpolationFactor.bind(void 0,F),zoomStops:i.stops.map(j=>j[0]),evaluate:({zoom:j})=>E(i,e,j,C,M)}}return{kind:"source",evaluate(F,j){const W=j&&j.properties?j.properties[i.property]:void 0;return W===void 0?Gs(i.default,e.default):E(i,e,W,C,M)}}}function Gs(i,e,a){return i!==void 0?i:e!==void 0?e:a!==void 0?a:void 0}function nh(i,e,a,h,_){return Gs(typeof a===_?h[a]:void 0,i.default,e.default)}function sh(i,e,a){if(Fr(a)!=="number")return Gs(i.default,e.default);const h=i.stops.length;if(h===1||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[h-1][0])return i.stops[h-1][1];const _=Qa(i.stops.map(v=>v[0]),a);return i.stops[_][1]}function Sc(i,e,a){const h=i.base!==void 0?i.base:1;if(Fr(a)!=="number")return Gs(i.default,e.default);const _=i.stops.length;if(_===1||a<=i.stops[0][0])return i.stops[0][1];if(a>=i.stops[_-1][0])return i.stops[_-1][1];const v=Qa(i.stops.map(j=>j[0]),a),E=function(j,W,X,ne){const ae=ne-X,ke=j-X;return ae===0?0:W===1?ke/ae:(Math.pow(W,ke)-1)/(Math.pow(W,ae)-1)}(a,h,i.stops[v][0],i.stops[v+1][0]),C=i.stops[v][1],M=i.stops[v+1][1];let F=pa[e.type]||si;if(i.colorSpace&&i.colorSpace!=="rgb"){const j=yc[i.colorSpace];F=(W,X)=>j.reverse(j.interpolate(j.forward(W),j.forward(X),E))}return typeof C.evaluate=="function"?{evaluate(...j){const W=C.evaluate.apply(void 0,j),X=M.evaluate.apply(void 0,j);if(W!==void 0&&X!==void 0)return F(W,X,E)}}:F(C,M,E)}function ah(i,e,a){switch(e.type){case"color":a=Q.parse(a);break;case"formatted":a=Ee.fromString(a.toString());break;case"resolvedImage":a=Te.fromString(a.toString());break;case"padding":a=ve.parse(a);break;default:Fr(a)===e.type||e.type==="enum"&&e.values[a]||(a=void 0)}return Gs(a,i.default,e.default)}Tr.register(js,{error:[{kind:"error"},[pr],(i,[e])=>{throw new bt(e.evaluate(i))}],typeof:[pr,[ar],(i,[e])=>Lr(Re(e.evaluate(i)))],"to-rgba":[Oi(Tt,4),[yi],(i,[e])=>e.evaluate(i).toArray()],rgb:[yi,[Tt,Tt,Tt],xc],rgba:[yi,[Tt,Tt,Tt,Tt],xc],has:{type:hr,overloads:[[[pr],(i,[e])=>wc(e.evaluate(i),i.properties())],[[pr,nn],(i,[e,a])=>wc(e.evaluate(i),a.evaluate(i))]]},get:{type:ar,overloads:[[[pr],(i,[e])=>ao(e.evaluate(i),i.properties())],[[pr,nn],(i,[e,a])=>ao(e.evaluate(i),a.evaluate(i))]]},"feature-state":[ar,[pr],(i,[e])=>ao(e.evaluate(i),i.featureState||{})],properties:[nn,[],i=>i.properties()],"geometry-type":[pr,[],i=>i.geometryType()],id:[ar,[],i=>i.id()],zoom:[Tt,[],i=>i.globals.zoom],"heatmap-density":[Tt,[],i=>i.globals.heatmapDensity||0],"line-progress":[Tt,[],i=>i.globals.lineProgress||0],accumulated:[ar,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Tt,Es(Tt),(i,e)=>{let a=0;for(const h of e)a+=h.evaluate(i);return a}],"*":[Tt,Es(Tt),(i,e)=>{let a=1;for(const h of e)a*=h.evaluate(i);return a}],"-":{type:Tt,overloads:[[[Tt,Tt],(i,[e,a])=>e.evaluate(i)-a.evaluate(i)],[[Tt],(i,[e])=>-e.evaluate(i)]]},"/":[Tt,[Tt,Tt],(i,[e,a])=>e.evaluate(i)/a.evaluate(i)],"%":[Tt,[Tt,Tt],(i,[e,a])=>e.evaluate(i)%a.evaluate(i)],ln2:[Tt,[],()=>Math.LN2],pi:[Tt,[],()=>Math.PI],e:[Tt,[],()=>Math.E],"^":[Tt,[Tt,Tt],(i,[e,a])=>Math.pow(e.evaluate(i),a.evaluate(i))],sqrt:[Tt,[Tt],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Tt,[Tt],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Tt,[Tt],(i,[e])=>Math.log(e.evaluate(i))],log2:[Tt,[Tt],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Tt,[Tt],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Tt,[Tt],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Tt,[Tt],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Tt,[Tt],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Tt,[Tt],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Tt,[Tt],(i,[e])=>Math.atan(e.evaluate(i))],min:[Tt,Es(Tt),(i,e)=>Math.min(...e.map(a=>a.evaluate(i)))],max:[Tt,Es(Tt),(i,e)=>Math.max(...e.map(a=>a.evaluate(i)))],abs:[Tt,[Tt],(i,[e])=>Math.abs(e.evaluate(i))],round:[Tt,[Tt],(i,[e])=>{const a=e.evaluate(i);return a<0?-Math.round(-a):Math.round(a)}],floor:[Tt,[Tt],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Tt,[Tt],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[hr,[pr,ar],(i,[e,a])=>i.properties()[e.value]===a.value],"filter-id-==":[hr,[ar],(i,[e])=>i.id()===e.value],"filter-type-==":[hr,[pr],(i,[e])=>i.geometryType()===e.value],"filter-<":[hr,[pr,ar],(i,[e,a])=>{const h=i.properties()[e.value],_=a.value;return typeof h==typeof _&&h<_}],"filter-id-<":[hr,[ar],(i,[e])=>{const a=i.id(),h=e.value;return typeof a==typeof h&&a":[hr,[pr,ar],(i,[e,a])=>{const h=i.properties()[e.value],_=a.value;return typeof h==typeof _&&h>_}],"filter-id->":[hr,[ar],(i,[e])=>{const a=i.id(),h=e.value;return typeof a==typeof h&&a>h}],"filter-<=":[hr,[pr,ar],(i,[e,a])=>{const h=i.properties()[e.value],_=a.value;return typeof h==typeof _&&h<=_}],"filter-id-<=":[hr,[ar],(i,[e])=>{const a=i.id(),h=e.value;return typeof a==typeof h&&a<=h}],"filter->=":[hr,[pr,ar],(i,[e,a])=>{const h=i.properties()[e.value],_=a.value;return typeof h==typeof _&&h>=_}],"filter-id->=":[hr,[ar],(i,[e])=>{const a=i.id(),h=e.value;return typeof a==typeof h&&a>=h}],"filter-has":[hr,[ar],(i,[e])=>e.value in i.properties()],"filter-has-id":[hr,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[hr,[Oi(pr)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[hr,[Oi(ar)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[hr,[pr,Oi(ar)],(i,[e,a])=>a.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[hr,[pr,Oi(ar)],(i,[e,a])=>function(h,_,v,E){for(;v<=E;){const C=v+E>>1;if(_[C]===h)return!0;_[C]>h?E=C-1:v=C+1}return!1}(i.properties()[e.value],a.value,0,a.value.length-1)],all:{type:hr,overloads:[[[hr,hr],(i,[e,a])=>e.evaluate(i)&&a.evaluate(i)],[Es(hr),(i,e)=>{for(const a of e)if(!a.evaluate(i))return!1;return!0}]]},any:{type:hr,overloads:[[[hr,hr],(i,[e,a])=>e.evaluate(i)||a.evaluate(i)],[Es(hr),(i,e)=>{for(const a of e)if(a.evaluate(i))return!0;return!1}]]},"!":[hr,[hr],(i,[e])=>!e.evaluate(i)],"is-supported-script":[hr,[pr],(i,[e])=>{const a=i.globals&&i.globals.isSupportedScript;return!a||a(e.evaluate(i))}],upcase:[pr,[pr],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[pr,[pr],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[pr,Es(ar),(i,e)=>e.map(a=>Ct(a.evaluate(i))).join("")],"resolved-locale":[pr,[Vi],(i,[e])=>e.evaluate(i).resolvedLocale()]});class oo{constructor(e,a){this.expression=e,this._warningHistory={},this._evaluator=new dr,this._defaultValue=a?function(h){return h.type==="color"&&Yr(h.default)?new Q(0,0,0,0):h.type==="color"?Q.parse(h.default)||null:h.type==="padding"?ve.parse(h.default)||null:h.default===void 0?null:h.default}(a):null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(e,a,h,_,v,E){return this._evaluator.globals=e,this._evaluator.feature=a,this._evaluator.featureState=h,this._evaluator.canonical=_,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E,this.expression.evaluate(this._evaluator)}evaluate(e,a,h,_,v,E){this._evaluator.globals=e,this._evaluator.feature=a||null,this._evaluator.featureState=h||null,this._evaluator.canonical=_,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E||null;try{const C=this.expression.evaluate(this._evaluator);if(C==null||typeof C=="number"&&C!=C)return this._defaultValue;if(this._enumValues&&!(C in this._enumValues))throw new bt(`Expected value to be one of ${Object.keys(this._enumValues).map(M=>JSON.stringify(M)).join(", ")}, but found ${JSON.stringify(C)} instead.`);return C}catch(C){return this._warningHistory[C.message]||(this._warningHistory[C.message]=!0,typeof console<"u"&&console.warn(C.message)),this._defaultValue}}}function ya(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in js}function va(i,e){const a=new Vs(js,[],e?function(_){const v={color:yi,string:pr,number:Tt,enum:pr,boolean:hr,formatted:ii,padding:ss,resolvedImage:ui};return _.type==="array"?Oi(v[_.value]||ar,_.length):v[_.type]}(e):void 0),h=a.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?Ec(new oo(h,e)):qs(a.errors)}class ba{constructor(e,a){this.kind=e,this._styleExpression=a,this.isStateDependent=e!=="constant"&&!Us(a.expression)}evaluateWithoutErrorHandling(e,a,h,_,v,E){return this._styleExpression.evaluateWithoutErrorHandling(e,a,h,_,v,E)}evaluate(e,a,h,_,v,E){return this._styleExpression.evaluate(e,a,h,_,v,E)}}class ll{constructor(e,a,h,_){this.kind=e,this.zoomStops=h,this._styleExpression=a,this.isStateDependent=e!=="camera"&&!Us(a.expression),this.interpolationType=_}evaluateWithoutErrorHandling(e,a,h,_,v,E){return this._styleExpression.evaluateWithoutErrorHandling(e,a,h,_,v,E)}evaluate(e,a,h,_,v,E){return this._styleExpression.evaluate(e,a,h,_,v,E)}interpolationFactor(e,a,h){return this.interpolationType?sn.interpolationFactor(this.interpolationType,e,a,h):0}}function Tc(i,e){const a=va(i,e);if(a.result==="error")return a;const h=a.value.expression,_=fa(h);if(!_&&!ei(e))return qs([new gi("","data expressions not supported")]);const v=Ja(h,["zoom"]);if(!v&&!kc(e))return qs([new gi("","zoom expressions not supported")]);const E=co(h);return E||v?E instanceof gi?qs([E]):E instanceof sn&&!Cr(e)?qs([new gi("",'"interpolate" expressions cannot be used with this property')]):Ec(E?new ll(_?"camera":"composite",a.value,E.labels,E instanceof sn?E.interpolation:void 0):new ba(_?"constant":"source",a.value)):qs([new gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class lo{constructor(e,a){this._parameters=e,this._specification=a,ri(this,_a(this._parameters,this._specification))}static deserialize(e){return new lo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function co(i){let e=null;if(i instanceof ro)e=co(i.result);else if(i instanceof to){for(const a of i.args)if(e=co(a),e)break}else(i instanceof da||i instanceof sn)&&i.input instanceof Tr&&i.input.name==="zoom"&&(e=i);return e instanceof gi||i.eachChild(a=>{const h=co(a);h instanceof gi?e=h:!e&&h?e=new gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&h&&e!==h&&(e=new gi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function En(i){const e=i.key,a=i.value,h=i.valueSpec||{},_=i.objectElementValidators||{},v=i.style,E=i.styleSpec;let C=[];const M=Fr(a);if(M!=="object")return[new gt(e,a,`object expected, ${M} found`)];for(const F in a){const j=F.split(".")[0],W=h[j]||h["*"];let X;if(_[j])X=_[j];else if(h[j])X=on;else if(_["*"])X=_["*"];else{if(!h["*"]){C.push(new gt(e,a[F],`unknown property "${F}"`));continue}X=on}C=C.concat(X({key:(e&&`${e}.`)+F,value:a[F],valueSpec:W,style:v,styleSpec:E,object:a,objectKey:F},a))}for(const F in h)_[F]||h[F].required&&h[F].default===void 0&&a[F]===void 0&&C.push(new gt(e,a,`missing required property "${F}"`));return C}function Ic(i){const e=i.value,a=i.valueSpec,h=i.style,_=i.styleSpec,v=i.key,E=i.arrayElementValidator||on;if(Fr(e)!=="array")return[new gt(v,e,`array expected, ${Fr(e)} found`)];if(a.length&&e.length!==a.length)return[new gt(v,e,`array length ${a.length} expected, length ${e.length} found`)];if(a["min-length"]&&e.lengthh.maximum?[new gt(e,a,`${a} is greater than the maximum value ${h.maximum}`)]:[]}function Cc(i){const e=i.valueSpec,a=yr(i.value.type);let h,_,v,E={};const C=a!=="categorical"&&i.value.property===void 0,M=!C,F=Fr(i.value.stops)==="array"&&Fr(i.value.stops[0])==="array"&&Fr(i.value.stops[0][0])==="object",j=En({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(ne){if(a==="identity")return[new gt(ne.key,ne.value,'identity function may not have a "stops" property')];let ae=[];const ke=ne.value;return ae=ae.concat(Ic({key:ne.key,value:ke,valueSpec:ne.valueSpec,style:ne.style,styleSpec:ne.styleSpec,arrayElementValidator:W})),Fr(ke)==="array"&&ke.length===0&&ae.push(new gt(ne.key,ke,"array must have at least one stop")),ae},default:function(ne){return on({key:ne.key,value:ne.value,valueSpec:e,style:ne.style,styleSpec:ne.styleSpec})}}});return a==="identity"&&C&&j.push(new gt(i.key,i.value,'missing required property "property"')),a==="identity"||i.value.stops||j.push(new gt(i.key,i.value,'missing required property "stops"')),a==="exponential"&&i.valueSpec.expression&&!Cr(i.valueSpec)&&j.push(new gt(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(M&&!ei(i.valueSpec)?j.push(new gt(i.key,i.value,"property functions not supported")):C&&!kc(i.valueSpec)&&j.push(new gt(i.key,i.value,"zoom functions not supported"))),a!=="categorical"&&!F||i.value.property!==void 0||j.push(new gt(i.key,i.value,'"property" property is required')),j;function W(ne){let ae=[];const ke=ne.value,we=ne.key;if(Fr(ke)!=="array")return[new gt(we,ke,`array expected, ${Fr(ke)} found`)];if(ke.length!==2)return[new gt(we,ke,`array length 2 expected, length ${ke.length} found`)];if(F){if(Fr(ke[0])!=="object")return[new gt(we,ke,`object expected, ${Fr(ke[0])} found`)];if(ke[0].zoom===void 0)return[new gt(we,ke,"object stop key must have zoom")];if(ke[0].value===void 0)return[new gt(we,ke,"object stop key must have value")];if(v&&v>yr(ke[0].zoom))return[new gt(we,ke[0].zoom,"stop zoom values must appear in ascending order")];yr(ke[0].zoom)!==v&&(v=yr(ke[0].zoom),_=void 0,E={}),ae=ae.concat(En({key:`${we}[0]`,value:ke[0],valueSpec:{zoom:{}},style:ne.style,styleSpec:ne.styleSpec,objectElementValidators:{zoom:cl,value:X}}))}else ae=ae.concat(X({key:`${we}[0]`,value:ke[0],valueSpec:{},style:ne.style,styleSpec:ne.styleSpec},ke));return ya(Sr(ke[1]))?ae.concat([new gt(`${we}[1]`,ke[1],"expressions are not allowed in function stops.")]):ae.concat(on({key:`${we}[1]`,value:ke[1],valueSpec:e,style:ne.style,styleSpec:ne.styleSpec}))}function X(ne,ae){const ke=Fr(ne.value),we=yr(ne.value),Oe=ne.value!==null?ne.value:ae;if(h){if(ke!==h)return[new gt(ne.key,Oe,`${ke} stop domain type must match previous stop domain type ${h}`)]}else h=ke;if(ke!=="number"&&ke!=="string"&&ke!=="boolean")return[new gt(ne.key,Oe,"stop domain value must be a number, string, or boolean")];if(ke!=="number"&&a!=="categorical"){let Qe=`number expected, ${ke} found`;return ei(e)&&a===void 0&&(Qe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new gt(ne.key,Oe,Qe)]}return a!=="categorical"||ke!=="number"||isFinite(we)&&Math.floor(we)===we?a!=="categorical"&&ke==="number"&&_!==void 0&&we<_?[new gt(ne.key,Oe,"stop domain values must appear in ascending order")]:(_=we,a==="categorical"&&we in E?[new gt(ne.key,Oe,"stop domain values must be unique")]:(E[we]=!0,[])):[new gt(ne.key,Oe,`integer expected, found ${we}`)]}}function ks(i){const e=(i.expressionContext==="property"?Tc:va)(Sr(i.value),i.valueSpec);if(e.result==="error")return e.value.map(h=>new gt(`${i.key}${h.key}`,i.value,h.message));const a=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!a.outputDefined())return[new gt(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Us(a))return[new gt(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Us(a))return[new gt(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Ja(a,["zoom","feature-state"]))return[new gt(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!fa(a))return[new gt(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function xa(i){const e=i.key,a=i.value,h=i.valueSpec,_=[];return Array.isArray(h.values)?h.values.indexOf(yr(a))===-1&&_.push(new gt(e,a,`expected one of [${h.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(h.values).indexOf(yr(a))===-1&&_.push(new gt(e,a,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(a)} found`)),_}function Zs(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Zs(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const oh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function uo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Zs(i)||(i=wa(i));const e=va(i,oh);if(e.result==="error")throw new Error(e.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,h,_)=>e.value.evaluate(a,h,{},_),needGeometry:Pc(i)}}function Ac(i,e){return ie?1:0}function Pc(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?ul(i[1],i[2],e):e==="any"?(a=i.slice(1),["any"].concat(a.map(wa))):e==="all"?["all"].concat(i.slice(1).map(wa)):e==="none"?["all"].concat(i.slice(1).map(wa).map(Hs)):e==="in"?ho(i[1],i.slice(2)):e==="!in"?Hs(ho(i[1],i.slice(2))):e==="has"?Ea(i[1]):e==="!has"?Hs(Ea(i[1])):e!=="within"||i;var a}function ul(i,e,a){switch(i){case"$type":return[`filter-type-${a}`,e];case"$id":return[`filter-id-${a}`,e];default:return[`filter-${a}`,i,e]}}function ho(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(a=>typeof a!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Ac)]]:["filter-in-small",i,["literal",e]]}}function Ea(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Hs(i){return["!",i]}function ka(i){return Zs(Sr(i.value))?ks(ri({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):zc(i)}function zc(i){const e=i.value,a=i.key;if(Fr(e)!=="array")return[new gt(a,e,`array expected, ${Fr(e)} found`)];const h=i.styleSpec;let _,v=[];if(e.length<1)return[new gt(a,e,"filter array must have at least 1 element")];switch(v=v.concat(xa({key:`${a}[0]`,value:e[0],valueSpec:h.filter_operator,style:i.style,styleSpec:i.styleSpec})),yr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&yr(e[1])==="$type"&&v.push(new gt(a,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&v.push(new gt(a,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(_=Fr(e[1]),_!=="string"&&v.push(new gt(`${a}[1]`,e[1],`string expected, ${_} found`)));for(let E=2;E{F in a&&e.push(new gt(h,a[F],`"${F}" is prohibited for ref layers`))}),_.layers.forEach(F=>{yr(F.id)===C&&(M=F)}),M?M.ref?e.push(new gt(h,a.ref,"ref cannot reference another ref layer")):E=yr(M.type):e.push(new gt(h,a.ref,`ref layer "${C}" not found`))}else if(E!=="background")if(a.source){const M=_.sources&&_.sources[a.source],F=M&&yr(M.type);M?F==="vector"&&E==="raster"?e.push(new gt(h,a.source,`layer "${a.id}" requires a raster source`)):F==="raster"&&E!=="raster"?e.push(new gt(h,a.source,`layer "${a.id}" requires a vector source`)):F!=="vector"||a["source-layer"]?F==="raster-dem"&&E!=="hillshade"?e.push(new gt(h,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):E!=="line"||!a.paint||!a.paint["line-gradient"]||F==="geojson"&&M.lineMetrics||e.push(new gt(h,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new gt(h,a,`layer "${a.id}" must specify a "source-layer"`)):e.push(new gt(h,a.source,`source "${a.source}" not found`))}else e.push(new gt(h,a,'missing required property "source"'));return e=e.concat(En({key:h,value:a,valueSpec:v.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>on({key:`${h}.type`,value:a.type,valueSpec:v.layer.type,style:i.style,styleSpec:i.styleSpec,object:a,objectKey:"type"}),filter:ka,layout:M=>En({layer:a,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{"*":F=>Dc(ri({layerType:E},F))}}),paint:M=>En({layer:a,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{"*":F=>Mc(ri({layerType:E},F))}})}})),e}function Ws(i){const e=i.value,a=i.key,h=Fr(e);return h!=="string"?[new gt(a,e,`string expected, ${h} found`)]:[]}const Lc={promoteId:function({key:i,value:e}){if(Fr(e)==="string")return Ws({key:i,value:e});{const a=[];for(const h in e)a.push(...Ws({key:`${i}.${h}`,value:e[h]}));return a}}};function Ta(i){const e=i.value,a=i.key,h=i.styleSpec,_=i.style;if(!e.type)return[new gt(a,e,'"type" is required')];const v=yr(e.type);let E;switch(v){case"vector":case"raster":case"raster-dem":return E=En({key:a,value:e,valueSpec:h[`source_${v.replace("-","_")}`],style:i.style,styleSpec:h,objectElementValidators:Lc}),E;case"geojson":if(E=En({key:a,value:e,valueSpec:h.source_geojson,style:_,styleSpec:h,objectElementValidators:Lc}),e.cluster)for(const C in e.clusterProperties){const[M,F]=e.clusterProperties[C],j=typeof M=="string"?[M,["accumulated"],["get",C]]:M;E.push(...ks({key:`${a}.${C}.map`,value:F,expressionContext:"cluster-map"})),E.push(...ks({key:`${a}.${C}.reduce`,value:j,expressionContext:"cluster-reduce"}))}return E;case"video":return En({key:a,value:e,valueSpec:h.source_video,style:_,styleSpec:h});case"image":return En({key:a,value:e,valueSpec:h.source_image,style:_,styleSpec:h});case"canvas":return[new gt(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xa({key:`${a}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,styleSpec:h})}}function Ia(i){const e=i.value,a=i.styleSpec,h=a.light,_=i.style;let v=[];const E=Fr(e);if(e===void 0)return v;if(E!=="object")return v=v.concat([new gt("light",e,`object expected, ${E} found`)]),v;for(const C in e){const M=C.match(/^(.*)-transition$/);v=v.concat(M&&h[M[1]]&&h[M[1]].transition?on({key:C,value:e[C],valueSpec:a.transition,style:_,styleSpec:a}):h[C]?on({key:C,value:e[C],valueSpec:h[C],style:_,styleSpec:a}):[new gt(C,e[C],`unknown property "${C}"`)])}return v}function an(i){const e=i.value,a=i.styleSpec,h=a.terrain,_=i.style;let v=[];const E=Fr(e);if(e===void 0)return v;if(E!=="object")return v=v.concat([new gt("terrain",e,`object expected, ${E} found`)]),v;for(const C in e)v=v.concat(h[C]?on({key:C,value:e[C],valueSpec:h[C],style:_,styleSpec:a}):[new gt(C,e[C],`unknown property "${C}"`)]);return v}const Ca={"*":()=>[],array:Ic,boolean:function(i){const e=i.value,a=i.key,h=Fr(e);return h!=="boolean"?[new gt(a,e,`boolean expected, ${h} found`)]:[]},number:cl,color:function(i){const e=i.key,a=i.value,h=Fr(a);return h!=="string"?[new gt(e,a,`color expected, ${h} found`)]:$n(a)===null?[new gt(e,a,`color expected, "${a}" found`)]:[]},constants:mi,enum:xa,filter:ka,function:Cc,layer:Rc,object:En,source:Ta,light:Ia,terrain:an,string:Ws,formatted:function(i){return Ws(i).length===0?[]:ks(i)},resolvedImage:function(i){return Ws(i).length===0?[]:ks(i)},padding:function(i){const e=i.key,a=i.value;if(Fr(a)==="array"){if(a.length<1||a.length>4)return[new gt(e,a,`padding requires 1 to 4 values; ${a.length} values found`)];const h={type:"number"};let _=[];for(let v=0;v[]}})),i.constants&&(a=a.concat(mi({key:"constants",value:i.constants,style:i,styleSpec:e}))),Bc(a)}function Bc(i){return[].concat(i).sort((e,a)=>e.line-a.line)}function Gn(i){return function(...e){return Bc(i.apply(this,e))}}cs.source=Gn(Ta),cs.light=Gn(Ia),cs.terrain=Gn(an),cs.layer=Gn(Rc),cs.filter=Gn(ka),cs.paintProperty=Gn(Mc),cs.layoutProperty=Gn(Dc);const Aa=cs,hl=Aa.light,ch=Aa.paintProperty,uh=Aa.layoutProperty;function fo(i,e){let a=!1;if(e&&e.length)for(const h of e)i.fire(new Wt(new Error(h.message))),a=!0;return a}class Pa{constructor(e,a,h){const _=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const E=new Int32Array(this.arrayBuffer);e=E[0],this.d=(a=E[1])+2*(h=E[2]);for(let M=0;M=W[ae+0]&&_>=W[ae+1])?(C[ne]=!0,E.push(j[ne])):C[ne]=!1}}}}_forEachCell(e,a,h,_,v,E,C,M){const F=this._convertToCellCoord(e),j=this._convertToCellCoord(a),W=this._convertToCellCoord(h),X=this._convertToCellCoord(_);for(let ne=F;ne<=W;ne++)for(let ae=j;ae<=X;ae++){const ke=this.d*ae+ne;if((!M||M(this._convertFromCellCoord(ne),this._convertFromCellCoord(ae),this._convertFromCellCoord(ne+1),this._convertFromCellCoord(ae+1)))&&v.call(this,e,a,h,_,ke,E,C,M))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,a=3+this.cells.length+1+1;let h=0;for(let E=0;E=0)continue;const E=i[v];_[v]=Zn[h].shallow.indexOf(v)>=0?E:Ss(E,e)}i instanceof Error&&(_.message=i.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(_.$name=h),_}throw new Error("can't serialize object of type "+typeof i)}function us(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Oc(i)||Z(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(us);if(typeof i=="object"){const e=i.$name||"Object";if(!Zn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:a}=Zn[e];if(!a)throw new Error(`can't deserialize unregistered class ${e}`);if(a.deserialize)return a.deserialize(i);const h=Object.create(a.prototype);for(const _ of Object.keys(i)){if(_==="$name")continue;const v=i[_];h[_]=Zn[e].shallow.indexOf(_)>=0?v:us(v)}return h}throw new Error("can't deserialize object of type "+typeof i)}class fl{constructor(){this.first=!0}update(e,a){const h=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=a):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function po(i){for(const e of i)if(pl(e.charCodeAt(0)))return!0;return!1}function hh(i){for(const e of i)if(!dl(e.charCodeAt(0)))return!1;return!0}function dl(i){return!(Ft.Arabic(i)||Ft["Arabic Supplement"](i)||Ft["Arabic Extended-A"](i)||Ft["Arabic Presentation Forms-A"](i)||Ft["Arabic Presentation Forms-B"](i))}function pl(i){return!(i!==746&&i!==747&&(i<4352||!(Ft["Bopomofo Extended"](i)||Ft.Bopomofo(i)||Ft["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ft["CJK Compatibility Ideographs"](i)||Ft["CJK Compatibility"](i)||Ft["CJK Radicals Supplement"](i)||Ft["CJK Strokes"](i)||!(!Ft["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ft["CJK Unified Ideographs Extension A"](i)||Ft["CJK Unified Ideographs"](i)||Ft["Enclosed CJK Letters and Months"](i)||Ft["Hangul Compatibility Jamo"](i)||Ft["Hangul Jamo Extended-A"](i)||Ft["Hangul Jamo Extended-B"](i)||Ft["Hangul Jamo"](i)||Ft["Hangul Syllables"](i)||Ft.Hiragana(i)||Ft["Ideographic Description Characters"](i)||Ft.Kanbun(i)||Ft["Kangxi Radicals"](i)||Ft["Katakana Phonetic Extensions"](i)||Ft.Katakana(i)&&i!==12540||!(!Ft["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Ft["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ft["Unified Canadian Aboriginal Syllabics"](i)||Ft["Unified Canadian Aboriginal Syllabics Extended"](i)||Ft["Vertical Forms"](i)||Ft["Yijing Hexagram Symbols"](i)||Ft["Yi Syllables"](i)||Ft["Yi Radicals"](i))))}function Fc(i){return!(pl(i)||function(e){return!!(Ft["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ft["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ft["Letterlike Symbols"](e)||Ft["Number Forms"](e)||Ft["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ft["Control Pictures"](e)&&e!==9251||Ft["Optical Character Recognition"](e)||Ft["Enclosed Alphanumerics"](e)||Ft["Geometric Shapes"](e)||Ft["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ft["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ft["CJK Symbols and Punctuation"](e)||Ft.Katakana(e)||Ft["Private Use Area"](e)||Ft["CJK Compatibility Forms"](e)||Ft["Small Form Variants"](e)||Ft["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Nc(i){return i>=1424&&i<=2303||Ft["Arabic Presentation Forms-A"](i)||Ft["Arabic Presentation Forms-B"](i)}function fh(i,e){return!(!e&&Nc(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ft.Khmer(i))}function Uc(i){for(const e of i)if(Nc(e.charCodeAt(0)))return!0;return!1}const ml="deferred",gl="loading",_l="loaded";let yl=null,Ji="unavailable",hs=null;const Vc=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ji="error"),yl&&yl(i)};function Ks(){vl.fire(new St("pluginStateChange",{pluginStatus:Ji,pluginURL:hs}))}const vl=new wr,za=function(){return Ji},$c=function(){if(Ji!==ml||!hs)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ji=gl,Ks(),hs&&be({url:hs},i=>{i?Vc(i):(Ji=_l,Ks())})},_n={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ji===_l||_n.applyArabicShaping!=null,isLoading:()=>Ji===gl,setState(i){if(!ce())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ji=i.pluginStatus,hs=i.pluginURL},isParsed(){if(!ce())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return _n.applyArabicShaping!=null&&_n.processBidirectionalText!=null&&_n.processStyledBidirectionalText!=null},getPluginURL(){if(!ce())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return hs}};class ai{constructor(e,a){this.zoom=e,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new fl,this.transition={})}isSupportedScript(e){return function(a,h){for(const _ of a)if(!fh(_.charCodeAt(0),h))return!1;return!0}(e,_n.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,a=e-Math.floor(e),h=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*a}}}class Ma{constructor(e,a){this.property=e,this.value=a,this.expression=function(h,_){if(Yr(h))return new lo(h,_);if(ya(h)){const v=Tc(h,_);if(v.result==="error")throw new Error(v.value.map(E=>`${E.key}: ${E.message}`).join(", "));return v.value}{let v=h;return _.type==="color"&&typeof h=="string"?v=Q.parse(h):_.type!=="padding"||typeof h!="number"&&!Array.isArray(h)||(v=ve.parse(h)),{kind:"constant",evaluate:()=>v}}}(a===void 0?e.specification.default:a,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,a,h){return this.property.possiblyEvaluate(this,e,a,h)}}class mo{constructor(e){this.property=e,this.value=new Ma(e,void 0)}transitioned(e,a){return new qc(this.property,this.value,a,P({},e.transition,this.transition),e.now)}untransitioned(){return new qc(this.property,this.value,null,{},0)}}class jc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return $(this._values[e].value.value)}setValue(e,a){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new mo(this._values[e].property)),this._values[e].value=new Ma(this._values[e].property,a===null?void 0:$(a))}getTransition(e){return $(this._values[e].transition)}setTransition(e,a){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new mo(this._values[e].property)),this._values[e].transition=$(a)||void 0}serialize(){const e={};for(const a of Object.keys(this._values)){const h=this.getValue(a);h!==void 0&&(e[a]=h);const _=this.getTransition(a);_!==void 0&&(e[`${a}-transition`]=_)}return e}transitioned(e,a){const h=new Gc(this._properties);for(const _ of Object.keys(this._values))h._values[_]=this._values[_].transitioned(e,a._values[_]);return h}untransitioned(){const e=new Gc(this._properties);for(const a of Object.keys(this._values))e._values[a]=this._values[a].untransitioned();return e}}class qc{constructor(e,a,h,_,v){this.property=e,this.value=a,this.begin=v+_.delay||0,this.end=this.begin+_.duration||0,e.specification.transition&&(_.delay||_.duration)&&(this.prior=h)}possiblyEvaluate(e,a,h){const _=e.now||0,v=this.value.possiblyEvaluate(e,a,h),E=this.prior;if(E){if(_>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(_=1)return 1;const F=M*M,j=F*M;return 4*(M<.5?j:3*(M-F)+j-.75)}(C))}}return v}}class Gc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,a,h){const _=new Da(this._properties);for(const v of Object.keys(this._values))_._values[v]=this._values[v].possiblyEvaluate(e,a,h);return _}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class dh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return $(this._values[e].value)}setValue(e,a){this._values[e]=new Ma(this._values[e].property,a===null?void 0:$(a))}serialize(){const e={};for(const a of Object.keys(this._values)){const h=this.getValue(a);h!==void 0&&(e[a]=h)}return e}possiblyEvaluate(e,a,h){const _=new Da(this._properties);for(const v of Object.keys(this._values))_._values[v]=this._values[v].possiblyEvaluate(e,a,h);return _}}class Mn{constructor(e,a,h){this.property=e,this.value=a,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,a,h,_){return this.property.evaluate(this.value,this.parameters,e,a,h,_)}}class Da{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Kt{constructor(e){this.specification=e}possiblyEvaluate(e,a){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(a)}interpolate(e,a,h){const _=pa[this.specification.type];return _?_(e,a,h):e}}class lr{constructor(e,a){this.specification=e,this.overrides=a}possiblyEvaluate(e,a,h,_){return new Mn(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(a,null,{},h,_)}:e.expression,a)}interpolate(e,a,h){if(e.value.kind!=="constant"||a.value.kind!=="constant")return e;if(e.value.value===void 0||a.value.value===void 0)return new Mn(this,{kind:"constant",value:void 0},e.parameters);const _=pa[this.specification.type];return _?new Mn(this,{kind:"constant",value:_(e.value.value,a.value.value,h)},e.parameters):e}evaluate(e,a,h,_,v,E){return e.kind==="constant"?e.value:e.evaluate(a,h,_,v,E)}}class Xs extends lr{possiblyEvaluate(e,a,h,_){if(e.value===void 0)return new Mn(this,{kind:"constant",value:void 0},a);if(e.expression.kind==="constant"){const v=e.expression.evaluate(a,null,{},h,_),E=e.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,C=this._calculate(E,E,E,a);return new Mn(this,{kind:"constant",value:C},a)}if(e.expression.kind==="camera"){const v=this._calculate(e.expression.evaluate({zoom:a.zoom-1}),e.expression.evaluate({zoom:a.zoom}),e.expression.evaluate({zoom:a.zoom+1}),a);return new Mn(this,{kind:"constant",value:v},a)}return new Mn(this,e.expression,a)}evaluate(e,a,h,_,v,E){if(e.kind==="source"){const C=e.evaluate(a,h,_,v,E);return this._calculate(C,C,C,a)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(a.zoom)-1},h,_),e.evaluate({zoom:Math.floor(a.zoom)},h,_),e.evaluate({zoom:Math.floor(a.zoom)+1},h,_),a):e.value}_calculate(e,a,h,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:e,to:a}:{from:h,to:a}}interpolate(e){return e}}class bl{constructor(e){this.specification=e}possiblyEvaluate(e,a,h,_){if(e.value!==void 0){if(e.expression.kind==="constant"){const v=e.expression.evaluate(a,null,{},h,_);return this._calculate(v,v,v,a)}return this._calculate(e.expression.evaluate(new ai(Math.floor(a.zoom-1),a)),e.expression.evaluate(new ai(Math.floor(a.zoom),a)),e.expression.evaluate(new ai(Math.floor(a.zoom+1),a)),a)}}_calculate(e,a,h,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:e,to:a}:{from:h,to:a}}interpolate(e){return e}}class fs{constructor(e){this.specification=e}possiblyEvaluate(e,a,h,_){return!!e.expression.evaluate(a,null,{},h,_)}interpolate(){return!1}}class Fi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in e){const h=e[a];h.specification.overridable&&this.overridableProperties.push(a);const _=this.defaultPropertyValues[a]=new Ma(h,void 0),v=this.defaultTransitionablePropertyValues[a]=new mo(h);this.defaultTransitioningPropertyValues[a]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=_.possiblyEvaluate({})}}}Gt("DataDrivenProperty",lr),Gt("DataConstantProperty",Kt),Gt("CrossFadedDataDrivenProperty",Xs),Gt("CrossFadedProperty",bl),Gt("ColorRampProperty",fs);const ds="-transition";class Dn extends wr{constructor(e,a){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),a.layout&&(this._unevaluatedLayout=new dh(a.layout)),a.paint)){this._transitionablePaint=new jc(a.paint);for(const h in e.paint)this.setPaintProperty(h,e.paint[h],{validate:!1});for(const h in e.layout)this.setLayoutProperty(h,e.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Da(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,a,h={}){a!=null&&this._validate(uh,`layers.${this.id}.layout.${e}`,e,a,h)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,a):this.visibility=a)}getPaintProperty(e){return e.endsWith(ds)?this._transitionablePaint.getTransition(e.slice(0,-ds.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,a,h={}){if(a!=null&&this._validate(ch,`layers.${this.id}.paint.${e}`,e,a,h))return!1;if(e.endsWith(ds))return this._transitionablePaint.setTransition(e.slice(0,-ds.length),a||void 0),!1;{const _=this._transitionablePaint._values[e],v=_.property.specification["property-type"]==="cross-faded-data-driven",E=_.value.isDataDriven(),C=_.value;this._transitionablePaint.setValue(e,a),this._handleSpecialPaintPropertyUpdate(e);const M=this._transitionablePaint._values[e].value;return M.isDataDriven()||E||v||this._handleOverridablePaintPropertyUpdate(e,C,M)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,a,h){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,a){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,a)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),B(e,(a,h)=>!(a===void 0||h==="layout"&&!Object.keys(a).length||h==="paint"&&!Object.keys(a).length))}_validate(e,a,h,_,v={}){return(!v||v.validate!==!1)&&fo(this,e.call(Aa,{key:a,layerType:this.type,objectKey:h,value:_,styleSpec:Fe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const a=this.paint.get(e);if(a instanceof Mn&&ei(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const Zc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ps{constructor(e,a){this._structArray=e,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class di{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,a){return e._trim(),a&&(e.isTransferred=!0,a.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const a=Object.create(this.prototype);return a.arrayBuffer=e.arrayBuffer,a.length=e.length,a.capacity=e.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function bi(i,e=1){let a=0,h=0;return{members:i.map(_=>{const v=Zc[_.type].BYTES_PER_ELEMENT,E=a=xl(a,Math.max(e,v)),C=_.components||1;return h=Math.max(h,v),a+=v*C,{name:_.name,type:_.type,components:C,offset:E}}),size:xl(a,Math.max(h,e)),alignment:e}}function xl(i,e){return Math.ceil(i/e)*e}class Ts extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,a)}emplace(e,a,h){const _=2*e;return this.int16[_+0]=a,this.int16[_+1]=h,e}}Ts.prototype.bytesPerElement=4,Gt("StructArrayLayout2i4",Ts);class g extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,a,h,_){const v=this.length;return this.resize(v+1),this.emplace(v,e,a,h,_)}emplace(e,a,h,_,v){const E=4*e;return this.int16[E+0]=a,this.int16[E+1]=h,this.int16[E+2]=_,this.int16[E+3]=v,e}}g.prototype.bytesPerElement=8,Gt("StructArrayLayout4i8",g);class t extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E){const C=this.length;return this.resize(C+1),this.emplace(C,e,a,h,_,v,E)}emplace(e,a,h,_,v,E,C){const M=6*e;return this.int16[M+0]=a,this.int16[M+1]=h,this.int16[M+2]=_,this.int16[M+3]=v,this.int16[M+4]=E,this.int16[M+5]=C,e}}t.prototype.bytesPerElement=12,Gt("StructArrayLayout2i4i12",t);class u extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E){const C=this.length;return this.resize(C+1),this.emplace(C,e,a,h,_,v,E)}emplace(e,a,h,_,v,E,C){const M=4*e,F=8*e;return this.int16[M+0]=a,this.int16[M+1]=h,this.uint8[F+4]=_,this.uint8[F+5]=v,this.uint8[F+6]=E,this.uint8[F+7]=C,e}}u.prototype.bytesPerElement=8,Gt("StructArrayLayout2i4ub8",u);class p extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,a)}emplace(e,a,h){const _=2*e;return this.float32[_+0]=a,this.float32[_+1]=h,e}}p.prototype.bytesPerElement=8,Gt("StructArrayLayout2f8",p);class y extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E,C,M,F,j){const W=this.length;return this.resize(W+1),this.emplace(W,e,a,h,_,v,E,C,M,F,j)}emplace(e,a,h,_,v,E,C,M,F,j,W){const X=10*e;return this.uint16[X+0]=a,this.uint16[X+1]=h,this.uint16[X+2]=_,this.uint16[X+3]=v,this.uint16[X+4]=E,this.uint16[X+5]=C,this.uint16[X+6]=M,this.uint16[X+7]=F,this.uint16[X+8]=j,this.uint16[X+9]=W,e}}y.prototype.bytesPerElement=20,Gt("StructArrayLayout10ui20",y);class x extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E,C,M,F,j,W,X){const ne=this.length;return this.resize(ne+1),this.emplace(ne,e,a,h,_,v,E,C,M,F,j,W,X)}emplace(e,a,h,_,v,E,C,M,F,j,W,X,ne){const ae=12*e;return this.int16[ae+0]=a,this.int16[ae+1]=h,this.int16[ae+2]=_,this.int16[ae+3]=v,this.uint16[ae+4]=E,this.uint16[ae+5]=C,this.uint16[ae+6]=M,this.uint16[ae+7]=F,this.int16[ae+8]=j,this.int16[ae+9]=W,this.int16[ae+10]=X,this.int16[ae+11]=ne,e}}x.prototype.bytesPerElement=24,Gt("StructArrayLayout4i4ui4i24",x);class I extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,a,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,a,h)}emplace(e,a,h,_){const v=3*e;return this.float32[v+0]=a,this.float32[v+1]=h,this.float32[v+2]=_,e}}I.prototype.bytesPerElement=12,Gt("StructArrayLayout3f12",I);class R extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const a=this.length;return this.resize(a+1),this.emplace(a,e)}emplace(e,a){return this.uint32[1*e+0]=a,e}}R.prototype.bytesPerElement=4,Gt("StructArrayLayout1ul4",R);class O extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E,C,M,F){const j=this.length;return this.resize(j+1),this.emplace(j,e,a,h,_,v,E,C,M,F)}emplace(e,a,h,_,v,E,C,M,F,j){const W=10*e,X=5*e;return this.int16[W+0]=a,this.int16[W+1]=h,this.int16[W+2]=_,this.int16[W+3]=v,this.int16[W+4]=E,this.int16[W+5]=C,this.uint32[X+3]=M,this.uint16[W+8]=F,this.uint16[W+9]=j,e}}O.prototype.bytesPerElement=20,Gt("StructArrayLayout6i1ul2ui20",O);class V extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E){const C=this.length;return this.resize(C+1),this.emplace(C,e,a,h,_,v,E)}emplace(e,a,h,_,v,E,C){const M=6*e;return this.int16[M+0]=a,this.int16[M+1]=h,this.int16[M+2]=_,this.int16[M+3]=v,this.int16[M+4]=E,this.int16[M+5]=C,e}}V.prototype.bytesPerElement=12,Gt("StructArrayLayout2i2i2i12",V);class G extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v){const E=this.length;return this.resize(E+1),this.emplace(E,e,a,h,_,v)}emplace(e,a,h,_,v,E){const C=4*e,M=8*e;return this.float32[C+0]=a,this.float32[C+1]=h,this.float32[C+2]=_,this.int16[M+6]=v,this.int16[M+7]=E,e}}G.prototype.bytesPerElement=16,Gt("StructArrayLayout2f1f2i16",G);class K extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,a,h,_){const v=this.length;return this.resize(v+1),this.emplace(v,e,a,h,_)}emplace(e,a,h,_,v){const E=12*e,C=3*e;return this.uint8[E+0]=a,this.uint8[E+1]=h,this.float32[C+1]=_,this.float32[C+2]=v,e}}K.prototype.bytesPerElement=12,Gt("StructArrayLayout2ub2f12",K);class ie extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,a,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,a,h)}emplace(e,a,h,_){const v=3*e;return this.uint16[v+0]=a,this.uint16[v+1]=h,this.uint16[v+2]=_,e}}ie.prototype.bytesPerElement=6,Gt("StructArrayLayout3ui6",ie);class me extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E,C,M,F,j,W,X,ne,ae,ke,we,Oe){const Qe=this.length;return this.resize(Qe+1),this.emplace(Qe,e,a,h,_,v,E,C,M,F,j,W,X,ne,ae,ke,we,Oe)}emplace(e,a,h,_,v,E,C,M,F,j,W,X,ne,ae,ke,we,Oe,Qe){const Le=24*e,Ke=12*e,ft=48*e;return this.int16[Le+0]=a,this.int16[Le+1]=h,this.uint16[Le+2]=_,this.uint16[Le+3]=v,this.uint32[Ke+2]=E,this.uint32[Ke+3]=C,this.uint32[Ke+4]=M,this.uint16[Le+10]=F,this.uint16[Le+11]=j,this.uint16[Le+12]=W,this.float32[Ke+7]=X,this.float32[Ke+8]=ne,this.uint8[ft+36]=ae,this.uint8[ft+37]=ke,this.uint8[ft+38]=we,this.uint32[Ke+10]=Oe,this.int16[Le+22]=Qe,e}}me.prototype.bytesPerElement=48,Gt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",me);class fe extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,a,h,_,v,E,C,M,F,j,W,X,ne,ae,ke,we,Oe,Qe,Le,Ke,ft,ht,qt,Zt,Nt,Rt,At,Ut){const Lt=this.length;return this.resize(Lt+1),this.emplace(Lt,e,a,h,_,v,E,C,M,F,j,W,X,ne,ae,ke,we,Oe,Qe,Le,Ke,ft,ht,qt,Zt,Nt,Rt,At,Ut)}emplace(e,a,h,_,v,E,C,M,F,j,W,X,ne,ae,ke,we,Oe,Qe,Le,Ke,ft,ht,qt,Zt,Nt,Rt,At,Ut,Lt){const xt=34*e,rr=17*e;return this.int16[xt+0]=a,this.int16[xt+1]=h,this.int16[xt+2]=_,this.int16[xt+3]=v,this.int16[xt+4]=E,this.int16[xt+5]=C,this.int16[xt+6]=M,this.int16[xt+7]=F,this.uint16[xt+8]=j,this.uint16[xt+9]=W,this.uint16[xt+10]=X,this.uint16[xt+11]=ne,this.uint16[xt+12]=ae,this.uint16[xt+13]=ke,this.uint16[xt+14]=we,this.uint16[xt+15]=Oe,this.uint16[xt+16]=Qe,this.uint16[xt+17]=Le,this.uint16[xt+18]=Ke,this.uint16[xt+19]=ft,this.uint16[xt+20]=ht,this.uint16[xt+21]=qt,this.uint16[xt+22]=Zt,this.uint32[rr+12]=Nt,this.float32[rr+13]=Rt,this.float32[rr+14]=At,this.float32[rr+15]=Ut,this.float32[rr+16]=Lt,e}}fe.prototype.bytesPerElement=68,Gt("StructArrayLayout8i15ui1ul4f68",fe);class de extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const a=this.length;return this.resize(a+1),this.emplace(a,e)}emplace(e,a){return this.float32[1*e+0]=a,e}}de.prototype.bytesPerElement=4,Gt("StructArrayLayout1f4",de);class ze extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,a,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,a,h)}emplace(e,a,h,_){const v=3*e;return this.int16[v+0]=a,this.int16[v+1]=h,this.int16[v+2]=_,e}}ze.prototype.bytesPerElement=6,Gt("StructArrayLayout3i6",ze);class De extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,a,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,a,h)}emplace(e,a,h,_){const v=4*e;return this.uint32[2*e+0]=a,this.uint16[v+2]=h,this.uint16[v+3]=_,e}}De.prototype.bytesPerElement=8,Gt("StructArrayLayout1ul2ui8",De);class Ve extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,a){const h=this.length;return this.resize(h+1),this.emplace(h,e,a)}emplace(e,a,h){const _=2*e;return this.uint16[_+0]=a,this.uint16[_+1]=h,e}}Ve.prototype.bytesPerElement=4,Gt("StructArrayLayout2ui4",Ve);class xe extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const a=this.length;return this.resize(a+1),this.emplace(a,e)}emplace(e,a){return this.uint16[1*e+0]=a,e}}xe.prototype.bytesPerElement=2,Gt("StructArrayLayout1ui2",xe);class Ye extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,a,h,_){const v=this.length;return this.resize(v+1),this.emplace(v,e,a,h,_)}emplace(e,a,h,_,v){const E=4*e;return this.float32[E+0]=a,this.float32[E+1]=h,this.float32[E+2]=_,this.float32[E+3]=v,e}}Ye.prototype.bytesPerElement=16,Gt("StructArrayLayout4f16",Ye);class Ze extends ps{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new ct(this.anchorPointX,this.anchorPointY)}}Ze.prototype.size=20;class at extends O{get(e){return new Ze(this,e)}}Gt("CollisionBoxArray",at);class lt extends ps{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}lt.prototype.size=48;class yt extends me{get(e){return new lt(this,e)}}Gt("PlacedSymbolArray",yt);class st extends ps{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}st.prototype.size=68;class Vt extends fe{get(e){return new st(this,e)}}Gt("SymbolInstanceArray",Vt);class Dt extends de{getoffsetX(e){return this.float32[1*e+0]}}Gt("GlyphOffsetArray",Dt);class jt extends ze{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Gt("SymbolLineVertexArray",jt);class gr extends ps{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}gr.prototype.size=8;class br extends De{get(e){return new gr(this,e)}}Gt("FeatureIndexArray",br);class tr extends Ts{}class qr extends Ts{}class Gr extends Ts{}class Ar extends t{}class Pr extends u{}class Hr extends p{}class Ci extends y{}class Rn extends x{}class kn extends I{}class Ln extends R{}class ms extends V{}class yn extends K{}class Yi extends ie{}class Hn extends Ve{}const go=bi([{name:"a_pos",components:2,type:"Int16"}],4),{members:ki}=go;class Er{constructor(e=[]){this.segments=e}prepareSegment(e,a,h,_){let v=this.segments[this.segments.length-1];return e>Er.MAX_VERTEX_ARRAY_LENGTH&&Y(`Max vertices per segment is ${Er.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!v||v.vertexLength+e>Er.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==_)&&(v={vertexOffset:a.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},_!==void 0&&(v.sortKey=_),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const e of this.segments)for(const a in e.vaos)e.vaos[a].destroy()}static simpleSegment(e,a,h,_){return new Er([{vertexOffset:e,primitiveOffset:a,vertexLength:h,primitiveLength:_,vaos:{},sortKey:0}])}}function $r(i,e){return 256*(i=k(Math.floor(i),0,255))+k(Math.floor(e),0,255)}Er.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Gt("SegmentVector",Er);const Ai=bi([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Pi={exports:{}},oi={exports:{}};oi.exports=function(i,e){var a,h,_,v,E,C,M,F;for(h=i.length-(a=3&i.length),_=e,E=3432918353,C=461845907,F=0;F>>16)*E&65535)<<16)&4294967295)<<15|M>>>17))*C+(((M>>>16)*C&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(M=0,a){case 3:M^=(255&i.charCodeAt(F+2))<<16;case 2:M^=(255&i.charCodeAt(F+1))<<8;case 1:_^=M=(65535&(M=(M=(65535&(M^=255&i.charCodeAt(F)))*E+(((M>>>16)*E&65535)<<16)&4294967295)<<15|M>>>17))*C+(((M>>>16)*C&65535)<<16)&4294967295}return _^=i.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var vn={exports:{}};vn.exports=function(i,e){for(var a,h=i.length,_=e^h,v=0;h>=4;)a=1540483477*(65535&(a=255&i.charCodeAt(v)|(255&i.charCodeAt(++v))<<8|(255&i.charCodeAt(++v))<<16|(255&i.charCodeAt(++v))<<24))+((1540483477*(a>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),h-=4,++v;switch(h){case 3:_^=(255&i.charCodeAt(v+2))<<16;case 2:_^=(255&i.charCodeAt(v+1))<<8;case 1:_=1540483477*(65535&(_^=255&i.charCodeAt(v)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var Is=oi.exports,wl=vn.exports;Pi.exports=Is,Pi.exports.murmur3=Is,Pi.exports.murmur2=wl;class Js{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,a,h,_){this.ids.push(Hc(e)),this.positions.push(a,h,_)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=Hc(e);let h=0,_=this.ids.length-1;for(;h<_;){const E=h+_>>1;this.ids[E]>=a?_=E:h=E+1}const v=[];for(;this.ids[h]===a;)v.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return v}static serialize(e,a){const h=new Float64Array(e.ids),_=new Uint32Array(e.positions);return El(h,_,0,h.length-1),a&&a.push(h.buffer,_.buffer),{ids:h,positions:_}}static deserialize(e){const a=new Js;return a.ids=e.ids,a.positions=e.positions,a.indexed=!0,a}}function Hc(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Pi.exports(String(i))}function El(i,e,a,h){for(;a>1];let v=a-1,E=h+1;for(;;){do v++;while(i[v]<_);do E--;while(i[E]>_);if(v>=E)break;gs(i,v,E),gs(e,3*v,3*E),gs(e,3*v+1,3*E+1),gs(e,3*v+2,3*E+2)}E-a`u_${_}`),this.type=h}setUniform(e,a,h){e.set(h.constantOr(this.value))}getBinding(e,a,h){return this.type==="color"?new pd(e,a):new As(e,a)}}class yo{constructor(e,a){this.uniformNames=a.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=e.tlbr}setUniform(e,a,h,_){const v=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&e.set(v)}getBinding(e,a,h){return h.substr(0,9)==="u_pattern"?new _o(e,a):new As(e,a)}}class Ps{constructor(e,a,h,_){this.expression=e,this.type=h,this.maxValue=0,this.paintVertexAttributes=a.map(v=>({name:`a_${v}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(e,a,h,_,v){const E=this.paintVertexArray.length,C=this.expression.evaluate(new ai(0),a,{},_,[],v);this.paintVertexArray.resize(e),this._setPaintValue(E,e,C)}updatePaintArray(e,a,h,_){const v=this.expression.evaluate({zoom:0},h,_);this._setPaintValue(e,a,v)}_setPaintValue(e,a,h){if(this.type==="color"){const _=ph(h);for(let v=e;v`u_${C}_t`),this.type=h,this.useIntegerZoom=_,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=a.map(C=>({name:`a_${C}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new E}populatePaintArray(e,a,h,_,v){const E=this.expression.evaluate(new ai(this.zoom),a,{},_,[],v),C=this.expression.evaluate(new ai(this.zoom+1),a,{},_,[],v),M=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(M,e,E,C)}updatePaintArray(e,a,h,_){const v=this.expression.evaluate({zoom:this.zoom},h,_),E=this.expression.evaluate({zoom:this.zoom+1},h,_);this._setPaintValue(e,a,v,E)}_setPaintValue(e,a,h,_){if(this.type==="color"){const v=ph(h),E=ph(_);for(let C=e;C`#define HAS_UNIFORM_${_}`))}return e}getBinderAttributes(){const e=[];for(const a in this.binders){const h=this.binders[a];if(h instanceof Ps||h instanceof Wn)for(let _=0;_!0){this.programConfigurations={};for(const _ of e)this.programConfigurations[_.id]=new md(_,a,h);this.needsUpload=!1,this._featureMap=new Js,this._bufferOffset=0}populatePaintArrays(e,a,h,_,v,E){for(const C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(e,a,_,v,E);a.id!==void 0&&this._featureMap.add(a.id,h,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,a,h,_){for(const v of h)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(e,this._featureMap,a,v,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function ky(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function gd(i,e,a){const h={color:{source:p,composite:Ye},number:{source:de,composite:p}},_=function(v){return{"line-pattern":{source:Ci,composite:Ci},"fill-pattern":{source:Ci,composite:Ci},"fill-extrusion-pattern":{source:Ci,composite:Ci}}[v]}(i);return _&&_[a]||h[e][a]}Gt("ConstantBinder",kl),Gt("CrossFadedConstantBinder",yo),Gt("SourceExpressionBinder",Ps),Gt("CrossFadedCompositeBinder",Ys),Gt("CompositeExpressionBinder",Wn),Gt("ProgramConfiguration",md,{omit:["_buffers"]}),Gt("ProgramConfigurationSet",Ra);var Si=8192;const mh=Math.pow(2,14)-1,_d=-mh-1;function La(i){const e=Si/i.extent,a=i.loadGeometry();for(let h=0;hE.x+1||ME.y+1)&&Y("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function Ba(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?La(i):[]}}function Wc(i,e,a,h,_){i.emplaceBack(2*e+(h+1)/2,2*a+(_+1)/2)}class gh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(a=>a.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new qr,this.indexArray=new Yi,this.segments=new Er,this.programConfigurations=new Ra(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(e,a,h){const _=this.layers[0],v=[];let E=null,C=!1;_.type==="circle"&&(E=_.layout.get("circle-sort-key"),C=!E.isConstant());for(const{feature:M,id:F,index:j,sourceLayerIndex:W}of e){const X=this.layers[0]._featureFilter.needGeometry,ne=Ba(M,X);if(!this.layers[0]._featureFilter.filter(new ai(this.zoom),ne,h))continue;const ae=C?E.evaluate(ne,{},h):void 0,ke={id:F,properties:M.properties,type:M.type,sourceLayerIndex:W,index:j,geometry:X?ne.geometry:La(M),patterns:{},sortKey:ae};v.push(ke)}C&&v.sort((M,F)=>M.sortKey-F.sortKey);for(const M of v){const{geometry:F,index:j,sourceLayerIndex:W}=M,X=e[j].feature;this.addFeature(M,F,j,h),a.featureIndex.insert(X,F,j,W,this.index)}}update(e,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,a,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ki),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,a,h,_){for(const v of a)for(const E of v){const C=E.x,M=E.y;if(C<0||C>=Si||M<0||M>=Si)continue;const F=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),j=F.vertexLength;Wc(this.layoutVertexArray,C,M,-1,-1),Wc(this.layoutVertexArray,C,M,1,-1),Wc(this.layoutVertexArray,C,M,1,1),Wc(this.layoutVertexArray,C,M,-1,1),this.indexArray.emplaceBack(j,j+1,j+2),this.indexArray.emplaceBack(j,j+3,j+2),F.vertexLength+=4,F.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},_)}}function yd(i,e){for(let a=0;a1){if(_h(i,e))return!0;for(let h=0;h1?a:a.sub(e)._mult(_)._add(e))}function xd(i,e){let a,h,_,v=!1;for(let E=0;Ee.y!=_.y>e.y&&e.x<(_.x-h.x)*(e.y-h.y)/(_.y-h.y)+h.x&&(v=!v)}return v}function vo(i,e){let a=!1;for(let h=0,_=i.length-1;he.y!=E.y>e.y&&e.x<(E.x-v.x)*(e.y-v.y)/(E.y-v.y)+v.x&&(a=!a)}return a}function Cy(i,e,a){const h=a[0],_=a[2];if(i.x_.x&&e.x>_.x||i.y_.y&&e.y>_.y)return!1;const v=se(i,e,a[0]);return v!==se(i,e,a[1])||v!==se(i,e,a[2])||v!==se(i,e,a[3])}function Sl(i,e,a){const h=e.paint.get(i).value;return h.kind==="constant"?h.value:a.programConfigurations.get(e.id).getMaxValue(i)}function Kc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Xc(i,e,a,h,_){if(!e[0]&&!e[1])return i;const v=ct.convert(e)._mult(_);a==="viewport"&&v._rotate(-h);const E=[];for(let C=0;Ci.width||_.height>i.height||a.x>i.width-_.width||a.y>i.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>e.width||_.height>e.height||h.x>e.width-_.width||h.y>e.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const E=i.data,C=e.data;if(E===C)throw new Error("srcData equals dstData, so image is already copied");for(let M=0;M<_.height;M++){const F=((a.y+M)*i.width+a.x)*v,j=((h.y+M)*e.width+h.x)*v;for(let W=0;W<_.width*v;W++)C[j+W]=E[F+W]}return e}class Il{constructor(e,a){bh(this,e,1,a)}resize(e){Ad(this,e,1)}clone(){return new Il({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,a,h,_,v){xh(e,a,h,_,v,1)}}class Sn{constructor(e,a){bh(this,e,4,a)}resize(e){Ad(this,e,4)}replace(e,a){a?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Sn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,a,h,_,v){xh(e,a,h,_,v,4)}}function Pd(i){const e={},a=i.resolution||256,h=i.clips?i.clips.length:1,_=i.image||new Sn({width:a,height:h});if(Math.log(a)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${a}`);const v=(E,C,M)=>{e[i.evaluationKey]=M;const F=i.expression.evaluate(e);_.data[E+C+0]=Math.floor(255*F.r/F.a),_.data[E+C+1]=Math.floor(255*F.g/F.a),_.data[E+C+2]=Math.floor(255*F.b/F.a),_.data[E+C+3]=Math.floor(255*F.a)};if(i.clips)for(let E=0,C=0;E80*a){h=v=i[0],_=E=i[1];for(var ae=a;aev&&(v=C),M>E&&(E=M);F=(F=Math.max(v-h,E-_))!==0?32767/F:0}return Cl(X,ne,a,h,_,F,0),ne}function zd(i,e,a,h,_){var v,E;if(_===kh(i,e,a,h)>0)for(v=e;v=e;v-=h)E=Rd(v,i[v],i[v+1],E);return E&&eu(E,E.next)&&(Pl(E),E=E.next),E}function Oa(i,e){if(!i)return i;e||(e=i);var a,h=i;do if(a=!1,h.steiner||!eu(h,h.next)&&vi(h.prev,h,h.next)!==0)h=h.next;else{if(Pl(h),(h=e=h.prev)===h.next)break;a=!0}while(a||h!==e);return e}function Cl(i,e,a,h,_,v,E){if(i){!E&&v&&function(j,W,X,ne){var ae=j;do ae.z===0&&(ae.z=wh(ae.x,ae.y,W,X,ne)),ae.prevZ=ae.prev,ae.nextZ=ae.next,ae=ae.next;while(ae!==j);ae.prevZ.nextZ=null,ae.prevZ=null,function(ke){var we,Oe,Qe,Le,Ke,ft,ht,qt,Zt=1;do{for(Oe=ke,ke=null,Ke=null,ft=0;Oe;){for(ft++,Qe=Oe,ht=0,we=0;we0||qt>0&&Qe;)ht!==0&&(qt===0||!Qe||Oe.z<=Qe.z)?(Le=Oe,Oe=Oe.nextZ,ht--):(Le=Qe,Qe=Qe.nextZ,qt--),Ke?Ke.nextZ=Le:ke=Le,Le.prevZ=Ke,Ke=Le;Oe=Qe}Ke.nextZ=null,Zt*=2}while(ft>1)}(ae)}(i,h,_,v);for(var C,M,F=i;i.prev!==i.next;)if(C=i.prev,M=i.next,v?Oy(i,h,_,v):By(i))e.push(C.i/a|0),e.push(i.i/a|0),e.push(M.i/a|0),Pl(i),i=M.next,F=M.next;else if((i=M)===F){E?E===1?Cl(i=Fy(Oa(i),e,a),e,a,h,_,v,2):E===2&&Ny(i,e,a,h,_,v):Cl(Oa(i),e,a,h,_,v,1);break}}}function By(i){var e=i.prev,a=i,h=i.next;if(vi(e,a,h)>=0)return!1;for(var _=e.x,v=a.x,E=h.x,C=e.y,M=a.y,F=h.y,j=_v?_>E?_:E:v>E?v:E,ne=C>M?C>F?C:F:M>F?M:F,ae=h.next;ae!==e;){if(ae.x>=j&&ae.x<=X&&ae.y>=W&&ae.y<=ne&&bo(_,C,v,M,E,F,ae.x,ae.y)&&vi(ae.prev,ae,ae.next)>=0)return!1;ae=ae.next}return!0}function Oy(i,e,a,h){var _=i.prev,v=i,E=i.next;if(vi(_,v,E)>=0)return!1;for(var C=_.x,M=v.x,F=E.x,j=_.y,W=v.y,X=E.y,ne=CM?C>F?C:F:M>F?M:F,we=j>W?j>X?j:X:W>X?W:X,Oe=wh(ne,ae,e,a,h),Qe=wh(ke,we,e,a,h),Le=i.prevZ,Ke=i.nextZ;Le&&Le.z>=Oe&&Ke&&Ke.z<=Qe;){if(Le.x>=ne&&Le.x<=ke&&Le.y>=ae&&Le.y<=we&&Le!==_&&Le!==E&&bo(C,j,M,W,F,X,Le.x,Le.y)&&vi(Le.prev,Le,Le.next)>=0||(Le=Le.prevZ,Ke.x>=ne&&Ke.x<=ke&&Ke.y>=ae&&Ke.y<=we&&Ke!==_&&Ke!==E&&bo(C,j,M,W,F,X,Ke.x,Ke.y)&&vi(Ke.prev,Ke,Ke.next)>=0))return!1;Ke=Ke.nextZ}for(;Le&&Le.z>=Oe;){if(Le.x>=ne&&Le.x<=ke&&Le.y>=ae&&Le.y<=we&&Le!==_&&Le!==E&&bo(C,j,M,W,F,X,Le.x,Le.y)&&vi(Le.prev,Le,Le.next)>=0)return!1;Le=Le.prevZ}for(;Ke&&Ke.z<=Qe;){if(Ke.x>=ne&&Ke.x<=ke&&Ke.y>=ae&&Ke.y<=we&&Ke!==_&&Ke!==E&&bo(C,j,M,W,F,X,Ke.x,Ke.y)&&vi(Ke.prev,Ke,Ke.next)>=0)return!1;Ke=Ke.nextZ}return!0}function Fy(i,e,a){var h=i;do{var _=h.prev,v=h.next.next;!eu(_,v)&&Md(_,h,h.next,v)&&Al(_,v)&&Al(v,_)&&(e.push(_.i/a|0),e.push(h.i/a|0),e.push(v.i/a|0),Pl(h),Pl(h.next),h=i=v),h=h.next}while(h!==i);return Oa(h)}function Ny(i,e,a,h,_,v){var E=i;do{for(var C=E.next.next;C!==E.prev;){if(E.i!==C.i&&qy(E,C)){var M=Dd(E,C);return E=Oa(E,E.next),M=Oa(M,M.next),Cl(E,e,a,h,_,v,0),void Cl(M,e,a,h,_,v,0)}C=C.next}E=E.next}while(E!==i)}function Uy(i,e){return i.x-e.x}function Vy(i,e){var a=function(_,v){var E,C=v,M=_.x,F=_.y,j=-1/0;do{if(F<=C.y&&F>=C.next.y&&C.next.y!==C.y){var W=C.x+(F-C.y)*(C.next.x-C.x)/(C.next.y-C.y);if(W<=M&&W>j&&(j=W,E=C.x=C.x&&C.x>=ae&&M!==C.x&&bo(FE.x||C.x===E.x&&$y(E,C)))&&(E=C,we=X)),C=C.next;while(C!==ne);return E}(i,e);if(!a)return e;var h=Dd(a,i);return Oa(h,h.next),Oa(a,a.next)}function $y(i,e){return vi(i.prev,i,e.prev)<0&&vi(e.next,i,i.next)<0}function wh(i,e,a,h,_){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-a)*_|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-h)*_|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function jy(i){var e=i,a=i;do(e.x=(i-E)*(v-C)&&(i-E)*(h-C)>=(a-E)*(e-C)&&(a-E)*(v-C)>=(_-E)*(h-C)}function qy(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(a,h){var _=a;do{if(_.i!==a.i&&_.next.i!==a.i&&_.i!==h.i&&_.next.i!==h.i&&Md(_,_.next,a,h))return!0;_=_.next}while(_!==a);return!1}(i,e)&&(Al(i,e)&&Al(e,i)&&function(a,h){var _=a,v=!1,E=(a.x+h.x)/2,C=(a.y+h.y)/2;do _.y>C!=_.next.y>C&&_.next.y!==_.y&&E<(_.next.x-_.x)*(C-_.y)/(_.next.y-_.y)+_.x&&(v=!v),_=_.next;while(_!==a);return v}(i,e)&&(vi(i.prev,i,e.prev)||vi(i,e.prev,e))||eu(i,e)&&vi(i.prev,i,i.next)>0&&vi(e.prev,e,e.next)>0)}function vi(i,e,a){return(e.y-i.y)*(a.x-e.x)-(e.x-i.x)*(a.y-e.y)}function eu(i,e){return i.x===e.x&&i.y===e.y}function Md(i,e,a,h){var _=ru(vi(i,e,a)),v=ru(vi(i,e,h)),E=ru(vi(a,h,i)),C=ru(vi(a,h,e));return _!==v&&E!==C||!(_!==0||!tu(i,a,e))||!(v!==0||!tu(i,h,e))||!(E!==0||!tu(a,i,h))||!(C!==0||!tu(a,e,h))}function tu(i,e,a){return e.x<=Math.max(i.x,a.x)&&e.x>=Math.min(i.x,a.x)&&e.y<=Math.max(i.y,a.y)&&e.y>=Math.min(i.y,a.y)}function ru(i){return i>0?1:i<0?-1:0}function Al(i,e){return vi(i.prev,i,i.next)<0?vi(i,e,i.next)>=0&&vi(i,i.prev,e)>=0:vi(i,e,i.prev)<0||vi(i,i.next,e)<0}function Dd(i,e){var a=new Eh(i.i,i.x,i.y),h=new Eh(e.i,e.x,e.y),_=i.next,v=e.prev;return i.next=e,e.prev=i,a.next=_,_.prev=a,h.next=a,a.prev=h,v.next=h,h.prev=v,h}function Rd(i,e,a,h){var _=new Eh(i,e,a);return h?(_.next=h.next,_.prev=h,h.next.prev=_,h.next=_):(_.prev=_,_.next=_),_}function Pl(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function Eh(i,e,a){this.i=i,this.x=e,this.y=a,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function kh(i,e,a,h){for(var _=0,v=e,E=a-h;va;){if(h-a>600){var v=h-a+1,E=e-a+1,C=Math.log(v),M=.5*Math.exp(2*C/3),F=.5*Math.sqrt(C*M*(v-M)/v)*(E-v/2<0?-1:1);Ld(i,e,Math.max(a,Math.floor(e-E*M/v+F)),Math.min(h,Math.floor(e+(v-E)*M/v+F)),_)}var j=i[e],W=a,X=h;for(zl(i,a,e),_(i[h],j)>0&&zl(i,a,h);W0;)X--}_(i[a],j)===0?zl(i,a,X):zl(i,++X,h),X<=e&&(a=X+1),e<=X&&(h=X-1)}}function zl(i,e,a){var h=i[e];i[e]=i[a],i[a]=h}function Zy(i,e){return ie?1:0}function Sh(i,e){const a=i.length;if(a<=1)return[i];const h=[];let _,v;for(let E=0;E1)for(let E=0;E0&&a.holes.push(h+=i[_-1].length)}return a};class Ch{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(a=>a.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Gr,this.indexArray=new Yi,this.indexArray2=new Hn,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new Er,this.segments2=new Er,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(e,a,h){this.hasPattern=Th("fill",this.layers,a);const _=this.layers[0].layout.get("fill-sort-key"),v=!_.isConstant(),E=[];for(const{feature:C,id:M,index:F,sourceLayerIndex:j}of e){const W=this.layers[0]._featureFilter.needGeometry,X=Ba(C,W);if(!this.layers[0]._featureFilter.filter(new ai(this.zoom),X,h))continue;const ne=v?_.evaluate(X,{},h,a.availableImages):void 0,ae={id:M,properties:C.properties,type:C.type,sourceLayerIndex:j,index:F,geometry:W?X.geometry:La(C),patterns:{},sortKey:ne};E.push(ae)}v&&E.sort((C,M)=>C.sortKey-M.sortKey);for(const C of E){const{geometry:M,index:F,sourceLayerIndex:j}=C;if(this.hasPattern){const W=Ih("fill",this.layers,C,this.zoom,a);this.patternFeatures.push(W)}else this.addFeature(C,M,F,h,{});a.featureIndex.insert(e[F].feature,M,F,j,this.index)}}update(e,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,a,this.stateDependentLayers,h)}addFeatures(e,a,h){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ly),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,a,h,_,v){for(const E of Sh(a,500)){let C=0;for(const ne of E)C+=ne.length;const M=this.segments.prepareSegment(C,this.layoutVertexArray,this.indexArray),F=M.vertexLength,j=[],W=[];for(const ne of E){if(ne.length===0)continue;ne!==E[0]&&W.push(j.length/2);const ae=this.segments2.prepareSegment(ne.length,this.layoutVertexArray,this.indexArray2),ke=ae.vertexLength;this.layoutVertexArray.emplaceBack(ne[0].x,ne[0].y),this.indexArray2.emplaceBack(ke+ne.length-1,ke),j.push(ne[0].x),j.push(ne[0].y);for(let we=1;we>3}if(_--,h===1||h===2)v+=i.readSVarint(),E+=i.readSVarint(),h===1&&(e&&C.push(e),e=[]),e.push(new Qy(v,E));else{if(h!==7)throw new Error("unknown command "+h);e&&e.push(e[0].clone())}}return e&&C.push(e),C},xo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,a=1,h=0,_=0,v=0,E=1/0,C=-1/0,M=1/0,F=-1/0;i.pos>3}if(h--,a===1||a===2)(_+=i.readSVarint())C&&(C=_),(v+=i.readSVarint())F&&(F=v);else if(a!==7)throw new Error("unknown command "+a)}return[E,M,C,F]},xo.prototype.toGeoJSON=function(i,e,a){var h,_,v=this.extent*Math.pow(2,a),E=this.extent*i,C=this.extent*e,M=this.loadGeometry(),F=xo.types[this.type];function j(ne){for(var ae=0;ae>3;_=E===1?h.readString():E===2?h.readFloat():E===3?h.readDouble():E===4?h.readVarint64():E===5?h.readVarint():E===6?h.readSVarint():E===7?h.readBoolean():null}return _}(a))}Fd.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new r0(this._pbf,e,this.extent,this._keys,this._values)};var n0=Od;function s0(i,e,a){if(i===3){var h=new n0(a,a.readVarint()+a.pos);h.length&&(e[h.name]=h)}}Qs.VectorTile=function(i,e){this.layers=i.readFields(s0,{},e)},Qs.VectorTileFeature=Bd,Qs.VectorTileLayer=Od;const a0=Qs.VectorTileFeature.types,Ah=Math.pow(2,13);function Ml(i,e,a,h,_,v,E,C){i.emplaceBack(e,a,2*Math.floor(h*Ah)+E,_*Ah*2,v*Ah*2,Math.round(C))}class Ph{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(a=>a.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ar,this.centroidVertexArray=new tr,this.indexArray=new Yi,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new Er,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(e,a,h){this.features=[],this.hasPattern=Th("fill-extrusion",this.layers,a);for(const{feature:_,id:v,index:E,sourceLayerIndex:C}of e){const M=this.layers[0]._featureFilter.needGeometry,F=Ba(_,M);if(!this.layers[0]._featureFilter.filter(new ai(this.zoom),F,h))continue;const j={id:v,sourceLayerIndex:C,index:E,geometry:M?F.geometry:La(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(Ih("fill-extrusion",this.layers,j,this.zoom,a)):this.addFeature(j,j.geometry,E,h,{}),a.featureIndex.insert(_,j.geometry,E,C,this.index,!0)}}addFeatures(e,a,h){for(const _ of this.features){const{geometry:v}=_;this.addFeature(_,v,_.index,a,h)}}update(e,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,a,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Yy),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Jy.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,a,h,_,v){const E={x:0,y:0,vertexCount:0};for(const C of Sh(a,500)){let M=0;for(const ae of C)M+=ae.length;let F=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const ae of C){if(ae.length===0||l0(ae))continue;let ke=0;for(let we=0;we=1){const Qe=ae[we-1];if(!o0(Oe,Qe)){F.vertexLength+4>Er.MAX_VERTEX_ARRAY_LENGTH&&(F=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Le=Oe.sub(Qe)._perp()._unit(),Ke=Qe.dist(Oe);ke+Ke>32768&&(ke=0),Ml(this.layoutVertexArray,Oe.x,Oe.y,Le.x,Le.y,0,0,ke),Ml(this.layoutVertexArray,Oe.x,Oe.y,Le.x,Le.y,0,1,ke),E.x+=2*Oe.x,E.y+=2*Oe.y,E.vertexCount+=2,ke+=Ke,Ml(this.layoutVertexArray,Qe.x,Qe.y,Le.x,Le.y,0,0,ke),Ml(this.layoutVertexArray,Qe.x,Qe.y,Le.x,Le.y,0,1,ke),E.x+=2*Qe.x,E.y+=2*Qe.y,E.vertexCount+=2;const ft=F.vertexLength;this.indexArray.emplaceBack(ft,ft+2,ft+1),this.indexArray.emplaceBack(ft+1,ft+2,ft+3),F.vertexLength+=4,F.primitiveLength+=2}}}}if(F.vertexLength+M>Er.MAX_VERTEX_ARRAY_LENGTH&&(F=this.segments.prepareSegment(M,this.layoutVertexArray,this.indexArray)),a0[e.type]!=="Polygon")continue;const j=[],W=[],X=F.vertexLength;for(const ae of C)if(ae.length!==0){ae!==C[0]&&W.push(j.length/2);for(let ke=0;keSi)||i.y===e.y&&(i.y<0||i.y>Si)}function l0(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Si)||i.every(e=>e.y<0)||i.every(e=>e.y>Si)}Gt("FillExtrusionBucket",Ph,{omit:["layers","features"]});var c0={paint:new Fi({"fill-extrusion-opacity":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new lr(Fe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Xs(Fe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new lr(Fe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new lr(Fe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Dl(i,e){return i.x*e.x+i.y*e.y}function Nd(i,e){if(i.length===1){let a=0;const h=e[a++];let _;for(;!_||h.equals(_);)if(_=e[a++],!_)return 1/0;for(;aa.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new Pr,this.layoutVertexArray2=new Hr,this.indexArray=new Yi,this.programConfigurations=new Ra(e.layers,e.zoom),this.segments=new Er,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(e,a,h){this.hasPattern=Th("line",this.layers,a);const _=this.layers[0].layout.get("line-sort-key"),v=!_.isConstant(),E=[];for(const{feature:C,id:M,index:F,sourceLayerIndex:j}of e){const W=this.layers[0]._featureFilter.needGeometry,X=Ba(C,W);if(!this.layers[0]._featureFilter.filter(new ai(this.zoom),X,h))continue;const ne=v?_.evaluate(X,{},h):void 0,ae={id:M,properties:C.properties,type:C.type,sourceLayerIndex:j,index:F,geometry:W?X.geometry:La(C),patterns:{},sortKey:ne};E.push(ae)}v&&E.sort((C,M)=>C.sortKey-M.sortKey);for(const C of E){const{geometry:M,index:F,sourceLayerIndex:j}=C;if(this.hasPattern){const W=Ih("line",this.layers,C,this.zoom,a);this.patternFeatures.push(W)}else this.addFeature(C,M,F,h,{});a.featureIndex.insert(e[F].feature,M,F,j,this.index)}}update(e,a,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,a,this.stateDependentLayers,h)}addFeatures(e,a,h){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,a,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,d0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,h0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,a,h,_,v){const E=this.layers[0].layout,C=E.get("line-join").evaluate(e,{}),M=E.get("line-cap"),F=E.get("line-miter-limit"),j=E.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const W of a)this.addLine(W,e,C,M,F,j);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,v,_)}addLine(e,a,h,_,v,E){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Oe=0;Oe=2&&e[M-1].equals(e[M-2]);)M--;let F=0;for(;F0;if(qt&&Oe>F){const At=X.dist(ne);if(At>2*j){const Ut=X.sub(X.sub(ne)._mult(j/At)._round());this.updateDistance(ne,Ut),this.addCurrentVertex(Ut,ke,0,0,W),ne=Ut}}const Nt=ne&&ae;let Rt=Nt?h:C?"butt":_;if(Nt&&Rt==="round"&&(ftv&&(Rt="bevel"),Rt==="bevel"&&(ft>2&&(Rt="flipbevel"),ft100)Qe=we.mult(-1);else{const At=ft*ke.add(we).mag()/ke.sub(we).mag();Qe._perp()._mult(At*(Zt?-1:1))}this.addCurrentVertex(X,Qe,0,0,W),this.addCurrentVertex(X,Qe.mult(-1),0,0,W)}else if(Rt==="bevel"||Rt==="fakeround"){const At=-Math.sqrt(ft*ft-1),Ut=Zt?At:0,Lt=Zt?0:At;if(ne&&this.addCurrentVertex(X,ke,Ut,Lt,W),Rt==="fakeround"){const xt=Math.round(180*ht/Math.PI/20);for(let rr=1;rr2*j){const Ut=X.add(ae.sub(X)._mult(j/At)._round());this.updateDistance(X,Ut),this.addCurrentVertex(Ut,we,0,0,W),X=Ut}}}}addCurrentVertex(e,a,h,_,v,E=!1){const C=a.y*_-a.x,M=-a.y-a.x*_;this.addHalfVertex(e,a.x+a.y*h,a.y-a.x*h,E,!1,h,v),this.addHalfVertex(e,C,M,E,!0,-_,v),this.distance>Ud/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,a,h,_,v,E))}addHalfVertex({x:e,y:a},h,_,v,E,C,M){const F=.5*(this.lineClips?this.scaledDistance*(Ud-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(v?1:0),(a<<1)+(E?1:0),Math.round(63*h)+128,Math.round(63*_)+128,1+(C===0?0:C<0?-1:1)|(63&F)<<2,F>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const j=M.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,j),M.primitiveLength++),E?this.e2=j:this.e1=j}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,a){this.distance+=e.dist(a),this.updateScaledDistance()}}Gt("LineBucket",zh,{omit:["layers","patternFeatures"]});const g0=new Fi({"line-cap":new Kt(Fe.layout_line["line-cap"]),"line-join":new lr(Fe.layout_line["line-join"]),"line-miter-limit":new Kt(Fe.layout_line["line-miter-limit"]),"line-round-limit":new Kt(Fe.layout_line["line-round-limit"]),"line-sort-key":new lr(Fe.layout_line["line-sort-key"])});var Vd={paint:new Fi({"line-opacity":new lr(Fe.paint_line["line-opacity"]),"line-color":new lr(Fe.paint_line["line-color"]),"line-translate":new Kt(Fe.paint_line["line-translate"]),"line-translate-anchor":new Kt(Fe.paint_line["line-translate-anchor"]),"line-width":new lr(Fe.paint_line["line-width"]),"line-gap-width":new lr(Fe.paint_line["line-gap-width"]),"line-offset":new lr(Fe.paint_line["line-offset"]),"line-blur":new lr(Fe.paint_line["line-blur"]),"line-dasharray":new bl(Fe.paint_line["line-dasharray"]),"line-pattern":new Xs(Fe.paint_line["line-pattern"]),"line-gradient":new fs(Fe.paint_line["line-gradient"])}),layout:g0};const $d=new class extends lr{possiblyEvaluate(i,e){return e=new ai(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,a,h){return e=P({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,a,h)}}(Vd.paint.properties["line-width"].specification);function jd(i,e){return e>0?e+2*i:i}$d.useIntegerZoom=!0;const _0=bi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),y0=bi([{name:"a_projected_pos",components:3,type:"Float32"}],4);bi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const v0=bi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);bi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const qd=bi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),b0=bi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function x0(i,e,a){return i.sections.forEach(h=>{h.text=function(_,v,E){const C=v.layout.get("text-transform").evaluate(E,{});return C==="uppercase"?_=_.toLocaleUpperCase():C==="lowercase"&&(_=_.toLocaleLowerCase()),_n.applyArabicShaping&&(_=_n.applyArabicShaping(_)),_}(h.text,e,a)}),i}bi([{name:"triangle",components:3,type:"Uint16"}]),bi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),bi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),bi([{type:"Float32",name:"offsetX"}]),bi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Rl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ni=24,Mh=Xr,Gd=function(i,e,a,h,_){var v,E,C=8*_-h-1,M=(1<>1,j=-7,W=a?_-1:0,X=a?-1:1,ne=i[e+W];for(W+=X,v=ne&(1<<-j)-1,ne>>=-j,j+=C;j>0;v=256*v+i[e+W],W+=X,j-=8);for(E=v&(1<<-j)-1,v>>=-j,j+=h;j>0;E=256*E+i[e+W],W+=X,j-=8);if(v===0)v=1-F;else{if(v===M)return E?NaN:1/0*(ne?-1:1);E+=Math.pow(2,h),v-=F}return(ne?-1:1)*E*Math.pow(2,v-h)},Zd=function(i,e,a,h,_,v){var E,C,M,F=8*v-_-1,j=(1<>1,X=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,ne=h?0:v-1,ae=h?1:-1,ke=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(C=isNaN(e)?1:0,E=j):(E=Math.floor(Math.log(e)/Math.LN2),e*(M=Math.pow(2,-E))<1&&(E--,M*=2),(e+=E+W>=1?X/M:X*Math.pow(2,1-W))*M>=2&&(E++,M/=2),E+W>=j?(C=0,E=j):E+W>=1?(C=(e*M-1)*Math.pow(2,_),E+=W):(C=e*Math.pow(2,W-1)*Math.pow(2,_),E=0));_>=8;i[a+ne]=255&C,ne+=ae,C/=256,_-=8);for(E=E<<_|C,F+=_;F>0;i[a+ne]=255&E,ne+=ae,E/=256,F-=8);i[a+ne-ae]|=128*ke};function Xr(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Xr.Varint=0,Xr.Fixed64=1,Xr.Bytes=2,Xr.Fixed32=5;var ea,Dh=4294967296,Hd=1/Dh,Wd=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function zs(i){return i.type===Xr.Bytes?i.readVarint()+i.pos:i.pos+1}function wo(i,e,a){return a?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Kd(i,e,a){var h=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));a.realloc(h);for(var _=a.pos-1;_>=i;_--)a.buf[_+h]=a.buf[_]}function w0(i,e){for(var a=0;a>>8,i[a+2]=e>>>16,i[a+3]=e>>>24}function Xd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function z0(i,e,a){i===1&&a.readMessage(M0,e)}function M0(i,e,a){if(i===3){const{id:h,bitmap:_,width:v,height:E,left:C,top:M,advance:F}=a.readMessage(D0,{});e.push({id:h,bitmap:new Il({width:v+6,height:E+6},_),metrics:{width:v,height:E,left:C,top:M,advance:F}})}}function D0(i,e,a){i===1?e.id=a.readVarint():i===2?e.bitmap=a.readBytes():i===3?e.width=a.readVarint():i===4?e.height=a.readVarint():i===5?e.left=a.readSVarint():i===6?e.top=a.readSVarint():i===7&&(e.advance=a.readVarint())}function Jd(i){let e=0,a=0;for(const E of i)e+=E.w*E.h,a=Math.max(a,E.w);i.sort((E,C)=>C.h-E.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),a),h:1/0}];let _=0,v=0;for(const E of i)for(let C=h.length-1;C>=0;C--){const M=h[C];if(!(E.w>M.w||E.h>M.h)){if(E.x=M.x,E.y=M.y,v=Math.max(v,E.y+E.h),_=Math.max(_,E.x+E.w),E.w===M.w&&E.h===M.h){const F=h.pop();C>3,v=this.pos;this.type=7&h,i(_,e,this),this.pos===v&&this.skip(h)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=iu(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Xd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=iu(this.buf,this.pos)+iu(this.buf,this.pos+4)*Dh;return this.pos+=8,i},readSFixed64:function(){var i=iu(this.buf,this.pos)+Xd(this.buf,this.pos+4)*Dh;return this.pos+=8,i},readFloat:function(){var i=Gd(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=Gd(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,a,h=this.buf;return e=127&(a=h[this.pos++]),a<128?e:(e|=(127&(a=h[this.pos++]))<<7,a<128?e:(e|=(127&(a=h[this.pos++]))<<14,a<128?e:(e|=(127&(a=h[this.pos++]))<<21,a<128?e:function(_,v,E){var C,M,F=E.buf;if(C=(112&(M=F[E.pos++]))>>4,M<128||(C|=(127&(M=F[E.pos++]))<<3,M<128)||(C|=(127&(M=F[E.pos++]))<<10,M<128)||(C|=(127&(M=F[E.pos++]))<<17,M<128)||(C|=(127&(M=F[E.pos++]))<<24,M<128)||(C|=(1&(M=F[E.pos++]))<<31,M<128))return wo(_,C,v);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(a=h[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Wd?function(a,h,_){return Wd.decode(a.subarray(h,_))}(this.buf,e,i):function(a,h,_){for(var v="",E=h;E<_;){var C,M,F,j=a[E],W=null,X=j>239?4:j>223?3:j>191?2:1;if(E+X>_)break;X===1?j<128&&(W=j):X===2?(192&(C=a[E+1]))==128&&(W=(31&j)<<6|63&C)<=127&&(W=null):X===3?(M=a[E+2],(192&(C=a[E+1]))==128&&(192&M)==128&&((W=(15&j)<<12|(63&C)<<6|63&M)<=2047||W>=55296&&W<=57343)&&(W=null)):X===4&&(M=a[E+2],F=a[E+3],(192&(C=a[E+1]))==128&&(192&M)==128&&(192&F)==128&&((W=(15&j)<<18|(63&C)<<12|(63&M)<<6|63&F)<=65535||W>=1114112)&&(W=null)),W===null?(W=65533,X=1):W>65535&&(W-=65536,v+=String.fromCharCode(W>>>10&1023|55296),W=56320|1023&W),v+=String.fromCharCode(W),E+=X}return v}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Xr.Bytes)return i.push(this.readVarint(e));var a=zs(this);for(i=i||[];this.pos127;);else if(e===Xr.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Xr.Fixed32)this.pos+=4;else{if(e!==Xr.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,a){var h,_;if(e>=0?(h=e%4294967296|0,_=e/4294967296|0):(_=~(-e/4294967296),4294967295^(h=~(-e%4294967296))?h=h+1|0:(h=0,_=_+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(v,E,C){C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,C.buf[C.pos]=127&(v>>>=7)}(h,0,a),function(v,E){var C=(7&v)<<4;E.buf[E.pos++]|=C|((v>>>=3)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v)))))}(_,a)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(h,_,v){for(var E,C,M=0;M<_.length;M++){if((E=_.charCodeAt(M))>55295&&E<57344){if(!C){E>56319||M+1===_.length?(h[v++]=239,h[v++]=191,h[v++]=189):C=E;continue}if(E<56320){h[v++]=239,h[v++]=191,h[v++]=189,C=E;continue}E=C-55296<<10|E-56320|65536,C=null}else C&&(h[v++]=239,h[v++]=191,h[v++]=189,C=null);E<128?h[v++]=E:(E<2048?h[v++]=E>>6|192:(E<65536?h[v++]=E>>12|224:(h[v++]=E>>18|240,h[v++]=E>>12&63|128),h[v++]=E>>6&63|128),h[v++]=63&E|128)}return v}(this.buf,i,this.pos);var a=this.pos-e;a>=128&&Kd(e,a,this),this.pos=e-1,this.writeVarint(a),this.pos+=a},writeFloat:function(i){this.realloc(4),Zd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Zd(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var a=0;a=128&&Kd(a,h,this),this.pos=a-1,this.writeVarint(h),this.pos+=h},writeMessage:function(i,e,a){this.writeTag(i,Xr.Bytes),this.writeRawMessage(e,a)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,w0,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,E0,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,T0,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,k0,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,S0,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,I0,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,C0,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,A0,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,P0,e)},writeBytesField:function(i,e){this.writeTag(i,Xr.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Xr.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Xr.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Xr.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Xr.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Xr.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Xr.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Xr.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Xr.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Xr.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};class Rh{constructor(e,{pixelRatio:a,version:h,stretchX:_,stretchY:v,content:E}){this.paddedRect=e,this.pixelRatio=a,this.stretchX=_,this.stretchY=v,this.content=E,this.version=h}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Yd{constructor(e,a){const h={},_={};this.haveRenderCallbacks=[];const v=[];this.addImages(e,h,v),this.addImages(a,_,v);const{w:E,h:C}=Jd(v),M=new Sn({width:E||1,height:C||1});for(const F in e){const j=e[F],W=h[F].paddedRect;Sn.copy(j.data,M,{x:0,y:0},{x:W.x+1,y:W.y+1},j.data)}for(const F in a){const j=a[F],W=_[F].paddedRect,X=W.x+1,ne=W.y+1,ae=j.data.width,ke=j.data.height;Sn.copy(j.data,M,{x:0,y:0},{x:X,y:ne},j.data),Sn.copy(j.data,M,{x:0,y:ke-1},{x:X,y:ne-1},{width:ae,height:1}),Sn.copy(j.data,M,{x:0,y:0},{x:X,y:ne+ke},{width:ae,height:1}),Sn.copy(j.data,M,{x:ae-1,y:0},{x:X-1,y:ne},{width:1,height:ke}),Sn.copy(j.data,M,{x:0,y:0},{x:X+ae,y:ne},{width:1,height:ke})}this.image=M,this.iconPositions=h,this.patternPositions=_}addImages(e,a,h){for(const _ in e){const v=e[_],E={x:0,y:0,w:v.data.width+2,h:v.data.height+2};h.push(E),a[_]=new Rh(E,v),v.hasRenderCallback&&this.haveRenderCallbacks.push(_)}}patchUpdatedImages(e,a){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const h in e.updatedImages)this.patchUpdatedImage(this.iconPositions[h],e.getImage(h),a),this.patchUpdatedImage(this.patternPositions[h],e.getImage(h),a)}patchUpdatedImage(e,a,h){if(!e||!a||e.version===a.version)return;e.version=a.version;const[_,v]=e.tl;h.update(a.data,void 0,{x:_,y:v})}}Gt("ImagePosition",Rh),Gt("ImageAtlas",Yd),n.WritingMode=void 0,(ea=n.WritingMode||(n.WritingMode={}))[ea.none=0]="none",ea[ea.horizontal=1]="horizontal",ea[ea.vertical=2]="vertical",ea[ea.horizontalOnly=3]="horizontalOnly";const nu=-17;class Ll{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,a){const h=new Ll;return h.scale=e||1,h.fontStack=a,h}static forImage(e){const a=new Ll;return a.imageName=e,a}}class ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,a){const h=new ko;for(let _=0;_=0&&h>=e&&au[this.text.charCodeAt(h)];h--)a--;this.text=this.text.substring(e,a),this.sectionIndex=this.sectionIndex.slice(e,a)}substring(e,a){const h=new ko;return h.text=this.text.substring(e,a),h.sectionIndex=this.sectionIndex.slice(e,a),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,a)=>Math.max(e,this.sections[a].scale),0)}addTextSection(e,a){this.text+=e.text,this.sections.push(Ll.forText(e.scale,e.fontStack||a));const h=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function su(i,e,a,h,_,v,E,C,M,F,j,W,X,ne,ae,ke){const we=ko.fromFeature(i,_);let Oe;W===n.WritingMode.vertical&&we.verticalizePunctuation();const{processBidirectionalText:Qe,processStyledBidirectionalText:Le}=_n;if(Qe&&we.sections.length===1){Oe=[];const ht=Qe(we.toString(),Lh(we,F,v,e,h,ne,ae));for(const qt of ht){const Zt=new ko;Zt.text=qt,Zt.sections=we.sections;for(let Nt=0;Nt0&&Rs>un&&(un=Rs)}else{const Cn=Zt[Ir.fontStack],hn=Cn&&Cn[Gi];if(hn&&hn.rect)Kn=hn.rect,Bn=hn.metrics;else{const Rs=qt[Ir.fontStack],Fl=Rs&&Rs[Gi];if(!Fl)continue;Bn=Fl.metrics}Wi=(qi-Ir.scale)*Ni}On?(ht.verticalizable=!0,cn.push({glyph:Gi,imageName:Xn,x:ti,y:li+Wi,vertical:On,scale:Ir.scale,fontStack:Ir.fontStack,sectionIndex:bn,metrics:Bn,rect:Kn}),ti+=Ds*Ir.scale+rr):(cn.push({glyph:Gi,imageName:Xn,x:ti,y:li+Wi,vertical:On,scale:Ir.scale,fontStack:Ir.fontStack,sectionIndex:bn,metrics:Bn,rect:Kn}),ti+=Bn.advance*Ir.scale+rr)}cn.length!==0&&(Ti=Math.max(ti-rr,Ti),B0(cn,0,cn.length-1,$i,un)),ti=0;const ci=At*qi+un;tn.lineOffset=Math.max(un,Hi),li+=ci,In=Math.max(ci,In),++xi}var zi;const ji=li-nu,{horizontalAlign:Zi,verticalAlign:ln}=Bh(Ut);(function(wi,qi,Hi,tn,cn,un,ci,Mi,Ir){const bn=(qi-Hi)*cn;let Gi=0;Gi=un!==ci?-Mi*tn-nu:(-tn*Ir+.5)*ci;for(const Wi of wi)for(const Bn of Wi.positionedGlyphs)Bn.x+=bn,Bn.y+=Gi})(ht.positionedLines,$i,Zi,ln,Ti,In,At,ji,Rt.length),ht.top+=-ln*ji,ht.bottom=ht.top+ji,ht.left+=-Zi*Ti,ht.right=ht.left+Ti}(ft,e,a,h,Oe,E,C,M,W,F,X,ke),!function(ht){for(const qt of ht)if(qt.positionedGlyphs.length!==0)return!1;return!0}(Ke)&&ft}const au={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},R0={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Qd(i,e,a,h,_,v){if(e.imageName){const E=h[e.imageName];return E?E.displaySize[0]*e.scale*Ni/v+_:0}{const E=a[e.fontStack],C=E&&E[i];return C?C.metrics.advance*e.scale+_:0}}function ep(i,e,a,h){const _=Math.pow(i-e,2);return h?i=0;let j=0;for(let X=0;X-a/2;){if(E--,E<0)return!1;C-=i[E].dist(v),v=i[E]}C+=i[E].dist(i[E+1]),E++;const M=[];let F=0;for(;Ch;)F-=M.shift().angleDelta;if(F>_)return!1;E++,C+=j.dist(W)}return!0}function ap(i){let e=0;for(let a=0;aF){const ae=(F-M)/ne,ke=ni(W.x,X.x,ae),we=ni(W.y,X.y,ae),Oe=new ta(ke,we,X.angleTo(W),j);return Oe._round(),!E||sp(i,Oe,C,E,e)?Oe:void 0}M+=ne}}function N0(i,e,a,h,_,v,E,C,M){const F=op(h,v,E),j=lp(h,_),W=j*E,X=i[0].x===0||i[0].x===M||i[0].y===0||i[0].y===M;return e-W=0&&Ke=0&&ft=0&&X+F<=j){const ht=new ta(Ke,ft,Qe,ae);ht._round(),h&&!sp(i,ht,v,h,_)||ne.push(ht)}}W+=Oe}return C||ne.length||E||(ne=cp(i,W/2,a,h,_,v,E,!0,M)),ne}function up(i,e,a,h,_){const v=[];for(let E=0;E=h&&W.x>=h||(j.x>=h?j=new ct(h,j.y+(h-j.x)/(W.x-j.x)*(W.y-j.y))._round():W.x>=h&&(W=new ct(h,j.y+(h-j.x)/(W.x-j.x)*(W.y-j.y))._round()),j.y>=_&&W.y>=_||(j.y>=_?j=new ct(j.x+(_-j.y)/(W.y-j.y)*(W.x-j.x),_)._round():W.y>=_&&(W=new ct(j.x+(_-j.y)/(W.y-j.y)*(W.x-j.x),_)._round()),M&&j.equals(M[M.length-1])||(M=[j],v.push(M)),M.push(W)))))}}return v}function hp(i,e,a,h){const _=[],v=i.image,E=v.pixelRatio,C=v.paddedRect.w-2,M=v.paddedRect.h-2,F=i.right-i.left,j=i.bottom-i.top,W=v.stretchX||[[0,C]],X=v.stretchY||[[0,M]],ne=(At,Ut)=>At+Ut[1]-Ut[0],ae=W.reduce(ne,0),ke=X.reduce(ne,0),we=C-ae,Oe=M-ke;let Qe=0,Le=ae,Ke=0,ft=ke,ht=0,qt=we,Zt=0,Nt=Oe;if(v.content&&h){const At=v.content;Qe=ou(W,0,At[0]),Ke=ou(X,0,At[1]),Le=ou(W,At[0],At[2]),ft=ou(X,At[1],At[3]),ht=At[0]-Qe,Zt=At[1]-Ke,qt=At[2]-At[0]-Le,Nt=At[3]-At[1]-ft}const Rt=(At,Ut,Lt,xt)=>{const rr=lu(At.stretch-Qe,Le,F,i.left),Jt=cu(At.fixed-ht,qt,At.stretch,ae),xr=lu(Ut.stretch-Ke,ft,j,i.top),ti=cu(Ut.fixed-Zt,Nt,Ut.stretch,ke),li=lu(Lt.stretch-Qe,Le,F,i.left),Ti=cu(Lt.fixed-ht,qt,Lt.stretch,ae),In=lu(xt.stretch-Ke,ft,j,i.top),$i=cu(xt.fixed-Zt,Nt,xt.stretch,ke),xi=new ct(rr,xr),zi=new ct(li,xr),ji=new ct(li,In),Zi=new ct(rr,In),ln=new ct(Jt/E,ti/E),wi=new ct(Ti/E,$i/E),qi=e*Math.PI/180;if(qi){const cn=Math.sin(qi),un=Math.cos(qi),ci=[un,-cn,cn,un];xi._matMult(ci),zi._matMult(ci),Zi._matMult(ci),ji._matMult(ci)}const Hi=At.stretch+At.fixed,tn=Ut.stretch+Ut.fixed;return{tl:xi,tr:zi,bl:Zi,br:ji,tex:{x:v.paddedRect.x+1+Hi,y:v.paddedRect.y+1+tn,w:Lt.stretch+Lt.fixed-Hi,h:xt.stretch+xt.fixed-tn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ln,pixelOffsetBR:wi,minFontScaleX:qt/E/F,minFontScaleY:Nt/E/j,isSDF:a}};if(h&&(v.stretchX||v.stretchY)){const At=fp(W,we,ae),Ut=fp(X,Oe,ke);for(let Lt=0;Lt0&&(ae=Math.max(10,ae),this.circleDiameter=ae)}else{let W=E.top*C-M[0],X=E.bottom*C+M[2],ne=E.left*C-M[3],ae=E.right*C+M[1];const ke=E.collisionPadding;if(ke&&(ne-=ke[0]*C,W-=ke[1]*C,ae+=ke[2]*C,X+=ke[3]*C),j){const we=new ct(ne,W),Oe=new ct(ae,W),Qe=new ct(ne,X),Le=new ct(ae,X),Ke=j*Math.PI/180;we._rotate(Ke),Oe._rotate(Ke),Qe._rotate(Ke),Le._rotate(Ke),ne=Math.min(we.x,Oe.x,Qe.x,Le.x),ae=Math.max(we.x,Oe.x,Qe.x,Le.x),W=Math.min(we.y,Oe.y,Qe.y,Le.y),X=Math.max(we.y,Oe.y,Qe.y,Le.y)}e.emplaceBack(a.x,a.y,ne,W,ae,X,h,_,v)}this.boxEndIndex=e.length}}class U0{constructor(e=[],a=V0){if(this.data=e,this.length=this.data.length,this.compare=a,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:a,compare:h}=this,_=a[e];for(;e>0;){const v=e-1>>1,E=a[v];if(h(_,E)>=0)break;a[e]=E,e=v}a[e]=_}_down(e){const{data:a,compare:h}=this,_=this.length>>1,v=a[e];for(;e<_;){let E=1+(e<<1),C=a[E];const M=E+1;if(M=0)break;a[e]=C,e=E}a[e]=v}}function V0(i,e){return ie?1:0}function $0(i,e=1,a=!1){let h=1/0,_=1/0,v=-1/0,E=-1/0;const C=i[0];for(let ne=0;nev)&&(v=ae.x),(!ne||ae.y>E)&&(E=ae.y)}const M=Math.min(v-h,E-_);let F=M/2;const j=new U0([],j0);if(M===0)return new ct(h,_);for(let ne=h;neW.d||!W.d)&&(W=ne,a&&console.log("found best %d after %d probes",Math.round(1e4*ne.d)/1e4,X)),ne.max-W.d<=e||(F=ne.h/2,j.push(new So(ne.p.x-F,ne.p.y-F,F,i)),j.push(new So(ne.p.x+F,ne.p.y-F,F,i)),j.push(new So(ne.p.x-F,ne.p.y+F,F,i)),j.push(new So(ne.p.x+F,ne.p.y+F,F,i)),X+=4)}return a&&(console.log(`num probes: ${X}`),console.log(`best distance: ${W.d}`)),W.p}function j0(i,e){return e.max-i.max}function So(i,e,a,h){this.p=new ct(i,e),this.h=a,this.d=function(_,v){let E=!1,C=1/0;for(let M=0;M_.y!=ae.y>_.y&&_.x<(ae.x-ne.x)*(_.y-ne.y)/(ae.y-ne.y)+ne.x&&(E=!E),C=Math.min(C,bd(_,ne,ae))}}return(E?1:-1)*Math.sqrt(C)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}const Oh=Number.POSITIVE_INFINITY;function dp(i,e){return e[1]!==Oh?function(a,h,_){let v=0,E=0;switch(h=Math.abs(h),_=Math.abs(_),a){case"top-right":case"top-left":case"top":E=_-7;break;case"bottom-right":case"bottom-left":case"bottom":E=7-_}switch(a){case"top-right":case"bottom-right":case"right":v=-h;break;case"top-left":case"bottom-left":case"left":v=h}return[v,E]}(i,e[0],e[1]):function(a,h){let _=0,v=0;h<0&&(h=0);const E=h/Math.sqrt(2);switch(a){case"top-right":case"top-left":v=E-7;break;case"bottom-right":case"bottom-left":v=7-E;break;case"bottom":v=7-h;break;case"top":v=h-7}switch(a){case"top-right":case"bottom-right":_=-E;break;case"top-left":case"bottom-left":_=E;break;case"left":_=h;break;case"right":_=-h}return[_,v]}(i,e[0])}function Fh(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function q0(i,e,a,h,_,v,E,C,M,F,j){let W=v.textMaxSize.evaluate(e,{});W===void 0&&(W=E);const X=i.layers[0].layout,ne=X.get("icon-offset").evaluate(e,{},j),ae=mp(a.horizontal),ke=E/24,we=i.tilePixelRatio*ke,Oe=i.tilePixelRatio*W/24,Qe=i.tilePixelRatio*C,Le=i.tilePixelRatio*X.get("symbol-spacing"),Ke=X.get("text-padding")*i.tilePixelRatio,ft=function(xt,rr,Jt,xr=1){const ti=xt.get("icon-padding").evaluate(rr,{},Jt),li=ti&&ti.values;return[li[0]*xr,li[1]*xr,li[2]*xr,li[3]*xr]}(X,e,j,i.tilePixelRatio),ht=X.get("text-max-angle")/180*Math.PI,qt=X.get("text-rotation-alignment")!=="viewport"&&X.get("symbol-placement")!=="point",Zt=X.get("icon-rotation-alignment")==="map"&&X.get("symbol-placement")!=="point",Nt=X.get("symbol-placement"),Rt=Le/2,At=X.get("icon-text-fit");let Ut;h&&At!=="none"&&(i.allowVerticalPlacement&&a.vertical&&(Ut=ip(h,a.vertical,At,X.get("icon-text-fit-padding"),ne,ke)),ae&&(h=ip(h,ae,At,X.get("icon-text-fit-padding"),ne,ke)));const Lt=(xt,rr)=>{rr.x<0||rr.x>=Si||rr.y<0||rr.y>=Si||function(Jt,xr,ti,li,Ti,In,$i,xi,zi,ji,Zi,ln,wi,qi,Hi,tn,cn,un,ci,Mi,Ir,bn,Gi,Wi,Bn){const Kn=Jt.addToLineVertexArray(xr,ti);let Xn,Ds,On,Cn,hn=0,Rs=0,Fl=0,zp=0,Wh=-1,Kh=-1;const Ls={};let Mp=Pi.exports(""),Xh=0,Jh=0;if(xi._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Xh,Jh]=xi.layout.get("text-offset").evaluate(Ir,{},Wi).map(fn=>fn*Ni):(Xh=xi.layout.get("text-radial-offset").evaluate(Ir,{},Wi)*Ni,Jh=Oh),Jt.allowVerticalPlacement&&li.vertical){const fn=xi.layout.get("text-rotate").evaluate(Ir,{},Wi)+90;On=new uu(zi,xr,ji,Zi,ln,li.vertical,wi,qi,Hi,fn),$i&&(Cn=new uu(zi,xr,ji,Zi,ln,$i,cn,un,Hi,fn))}if(Ti){const fn=xi.layout.get("icon-rotate").evaluate(Ir,{}),_s=xi.layout.get("icon-text-fit")!=="none",Nl=hp(Ti,fn,Gi,_s),Ul=$i?hp($i,fn,Gi,_s):void 0;Ds=new uu(zi,xr,ji,Zi,ln,Ti,cn,un,!1,fn),hn=4*Nl.length;const Lp=Jt.iconSizeData;let Na=null;Lp.kind==="source"?(Na=[Ms*xi.layout.get("icon-size").evaluate(Ir,{})],Na[0]>ra&&Y(`${Jt.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Lp.kind==="composite"&&(Na=[Ms*bn.compositeIconSizes[0].evaluate(Ir,{},Wi),Ms*bn.compositeIconSizes[1].evaluate(Ir,{},Wi)],(Na[0]>ra||Na[1]>ra)&&Y(`${Jt.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Jt.addSymbols(Jt.icon,Nl,Na,Mi,ci,Ir,n.WritingMode.none,xr,Kn.lineStartIndex,Kn.lineLength,-1,Wi),Wh=Jt.icon.placedSymbolArray.length-1,Ul&&(Rs=4*Ul.length,Jt.addSymbols(Jt.icon,Ul,Na,Mi,ci,Ir,n.WritingMode.vertical,xr,Kn.lineStartIndex,Kn.lineLength,-1,Wi),Kh=Jt.icon.placedSymbolArray.length-1)}const Dp=Object.keys(li.horizontal);for(const fn of Dp){const _s=li.horizontal[fn];if(!Xn){Mp=Pi.exports(_s.text);const Ul=xi.layout.get("text-rotate").evaluate(Ir,{},Wi);Xn=new uu(zi,xr,ji,Zi,ln,_s,wi,qi,Hi,Ul)}const Nl=_s.positionedLines.length===1;if(Fl+=pp(Jt,xr,_s,In,xi,Hi,Ir,tn,Kn,li.vertical?n.WritingMode.horizontal:n.WritingMode.horizontalOnly,Nl?Dp:[fn],Ls,Wh,bn,Wi),Nl)break}li.vertical&&(zp+=pp(Jt,xr,li.vertical,In,xi,Hi,Ir,tn,Kn,n.WritingMode.vertical,["vertical"],Ls,Kh,bn,Wi));const i1=Xn?Xn.boxStartIndex:Jt.collisionBoxArray.length,n1=Xn?Xn.boxEndIndex:Jt.collisionBoxArray.length,s1=On?On.boxStartIndex:Jt.collisionBoxArray.length,a1=On?On.boxEndIndex:Jt.collisionBoxArray.length,o1=Ds?Ds.boxStartIndex:Jt.collisionBoxArray.length,l1=Ds?Ds.boxEndIndex:Jt.collisionBoxArray.length,c1=Cn?Cn.boxStartIndex:Jt.collisionBoxArray.length,u1=Cn?Cn.boxEndIndex:Jt.collisionBoxArray.length;let Jn=-1;const mu=(fn,_s)=>fn&&fn.circleDiameter?Math.max(fn.circleDiameter,_s):_s;Jn=mu(Xn,Jn),Jn=mu(On,Jn),Jn=mu(Ds,Jn),Jn=mu(Cn,Jn);const Rp=Jn>-1?1:0;Rp&&(Jn*=Bn/Ni),Jt.glyphOffsetArray.length>=To.MAX_GLYPHS&&Y("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ir.sortKey!==void 0&&Jt.addToSortKeyRanges(Jt.symbolInstances.length,Ir.sortKey),Jt.symbolInstances.emplaceBack(xr.x,xr.y,Ls.right>=0?Ls.right:-1,Ls.center>=0?Ls.center:-1,Ls.left>=0?Ls.left:-1,Ls.vertical||-1,Wh,Kh,Mp,i1,n1,s1,a1,o1,l1,c1,u1,ji,Fl,zp,hn,Rs,Rp,0,wi,Xh,Jh,Jn)}(i,rr,xt,a,h,_,Ut,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,we,[Ke,Ke,Ke,Ke],qt,M,Qe,ft,Zt,ne,e,v,F,j,E)};if(Nt==="line")for(const xt of up(e.geometry,0,0,Si,Si)){const rr=N0(xt,Le,ht,a.vertical||ae,h,24,Oe,i.overscaling,Si);for(const Jt of rr){const xr=ae;xr&&G0(i,xr.text,Rt,Jt)||Lt(xt,Jt)}}else if(Nt==="line-center"){for(const xt of e.geometry)if(xt.length>1){const rr=F0(xt,ht,a.vertical||ae,h,24,Oe);rr&&Lt(xt,rr)}}else if(e.type==="Polygon")for(const xt of Sh(e.geometry,0)){const rr=$0(xt,16);Lt(xt[0],new ta(rr.x,rr.y,0))}else if(e.type==="LineString")for(const xt of e.geometry)Lt(xt,new ta(xt[0].x,xt[0].y,0));else if(e.type==="Point")for(const xt of e.geometry)for(const rr of xt)Lt([rr],new ta(rr.x,rr.y,0))}const ra=32640;function pp(i,e,a,h,_,v,E,C,M,F,j,W,X,ne,ae){const ke=function(Qe,Le,Ke,ft,ht,qt,Zt,Nt){const Rt=ft.layout.get("text-rotate").evaluate(qt,{})*Math.PI/180,At=[];for(const Ut of Le.positionedLines)for(const Lt of Ut.positionedGlyphs){if(!Lt.rect)continue;const xt=Lt.rect||{};let rr=4,Jt=!0,xr=1,ti=0;const li=(ht||Nt)&&Lt.vertical,Ti=Lt.metrics.advance*Lt.scale/2;if(Nt&&Le.verticalizable){const ci=(Lt.scale-1)*Ni,Mi=(Ni-Lt.metrics.width*Lt.scale)/2;ti=Ut.lineOffset/2-(Lt.imageName?-Mi:ci)}if(Lt.imageName){const ci=Zt[Lt.imageName];Jt=ci.sdf,xr=ci.pixelRatio,rr=1/xr}const In=ht?[Lt.x+Ti,Lt.y]:[0,0];let $i=ht?[0,0]:[Lt.x+Ti+Ke[0],Lt.y+Ke[1]-ti],xi=[0,0];li&&(xi=$i,$i=[0,0]);const zi=(Lt.metrics.left-rr)*Lt.scale-Ti+$i[0],ji=(-Lt.metrics.top-rr)*Lt.scale+$i[1],Zi=zi+xt.w*Lt.scale/xr,ln=ji+xt.h*Lt.scale/xr,wi=new ct(zi,ji),qi=new ct(Zi,ji),Hi=new ct(zi,ln),tn=new ct(Zi,ln);if(li){const ci=new ct(-Ti,Ti-nu),Mi=-Math.PI/2,Ir=12-Ti,bn=new ct(22-Ir,-(Lt.imageName?Ir:0)),Gi=new ct(...xi);wi._rotateAround(Mi,ci)._add(bn)._add(Gi),qi._rotateAround(Mi,ci)._add(bn)._add(Gi),Hi._rotateAround(Mi,ci)._add(bn)._add(Gi),tn._rotateAround(Mi,ci)._add(bn)._add(Gi)}if(Rt){const ci=Math.sin(Rt),Mi=Math.cos(Rt),Ir=[Mi,-ci,ci,Mi];wi._matMult(Ir),qi._matMult(Ir),Hi._matMult(Ir),tn._matMult(Ir)}const cn=new ct(0,0),un=new ct(0,0);At.push({tl:wi,tr:qi,bl:Hi,br:tn,tex:xt,writingMode:Le.writingMode,glyphOffset:In,sectionIndex:Lt.sectionIndex,isSDF:Jt,pixelOffsetTL:cn,pixelOffsetBR:un,minFontScaleX:0,minFontScaleY:0})}return At}(0,a,C,_,v,E,h,i.allowVerticalPlacement),we=i.textSizeData;let Oe=null;we.kind==="source"?(Oe=[Ms*_.layout.get("text-size").evaluate(E,{})],Oe[0]>ra&&Y(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):we.kind==="composite"&&(Oe=[Ms*ne.compositeTextSizes[0].evaluate(E,{},ae),Ms*ne.compositeTextSizes[1].evaluate(E,{},ae)],(Oe[0]>ra||Oe[1]>ra)&&Y(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,ke,Oe,C,v,E,F,e,M.lineStartIndex,M.lineLength,X,ae);for(const Qe of j)W[Qe]=i.text.placedSymbolArray.length-1;return 4*ke.length}function mp(i){for(const e in i)return i[e];return null}function G0(i,e,a,h){const _=i.compareText;if(e in _){const v=_[e];for(let E=v.length-1;E>=0;E--)if(h.dist(v[E])E.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=vh([]),this.placementViewportMatrix=vh([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=np(this.zoom,a["text-size"]),this.iconSizeData=np(this.zoom,a["icon-size"]);const h=this.layers[0].layout,_=h.get("symbol-sort-key"),v=h.get("symbol-z-order");this.canOverlap=jh(h,"text-overlap","text-allow-overlap")!=="never"||jh(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(E=>n.WritingMode[E])),this.stateDependentLayerIds=this.layers.filter(E=>E.isStateDependent()).map(E=>E.id),this.sourceID=e.sourceID}createArrays(){this.text=new Uh(new Ra(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Uh(new Ra(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Dt,this.lineVertexArray=new jt,this.symbolInstances=new Vt}calculateGlyphDependencies(e,a,h,_,v){for(let E=0;E0)&&(E.value.kind!=="constant"||E.value.value.length>0),j=M.value.kind!=="constant"||!!M.value.value||Object.keys(M.parameters).length>0,W=v.get("symbol-sort-key");if(this.features=[],!F&&!j)return;const X=a.iconDependencies,ne=a.glyphDependencies,ae=a.availableImages,ke=new ai(this.zoom);for(const{feature:we,id:Oe,index:Qe,sourceLayerIndex:Le}of e){const Ke=_._featureFilter.needGeometry,ft=Ba(we,Ke);if(!_._featureFilter.filter(ke,ft,h))continue;let ht,qt;if(Ke||(ft.geometry=La(we)),F){const Nt=_.getValueAndResolveTokens("text-field",ft,h,ae),Rt=Ee.factory(Nt);W0(Rt)&&(this.hasRTLText=!0),(!this.hasRTLText||za()==="unavailable"||this.hasRTLText&&_n.isParsed())&&(ht=x0(Rt,_,ft))}if(j){const Nt=_.getValueAndResolveTokens("icon-image",ft,h,ae);qt=Nt instanceof Te?Nt:Te.fromString(Nt)}if(!ht&&!qt)continue;const Zt=this.sortFeaturesByKey?W.evaluate(ft,{},h):void 0;if(this.features.push({id:Oe,text:ht,icon:qt,index:Qe,sourceLayerIndex:Le,geometry:ft.geometry,properties:we.properties,type:Z0[we.type],sortKey:Zt}),qt&&(X[qt.name]=!0),ht){const Nt=E.evaluate(ft,{},h).join(","),Rt=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(n.WritingMode.vertical)>=0;for(const At of ht.sections)if(At.image)X[At.image.name]=!0;else{const Ut=po(ht.toString()),Lt=At.fontStack||Nt,xt=ne[Lt]=ne[Lt]||{};this.calculateGlyphDependencies(At.text,xt,Rt,this.allowVerticalPlacement,Ut)}}}v.get("symbol-placement")==="line"&&(this.features=function(we){const Oe={},Qe={},Le=[];let Ke=0;function ft(Nt){Le.push(we[Nt]),Ke++}function ht(Nt,Rt,At){const Ut=Qe[Nt];return delete Qe[Nt],Qe[Rt]=Ut,Le[Ut].geometry[0].pop(),Le[Ut].geometry[0]=Le[Ut].geometry[0].concat(At[0]),Ut}function qt(Nt,Rt,At){const Ut=Oe[Rt];return delete Oe[Rt],Oe[Nt]=Ut,Le[Ut].geometry[0].shift(),Le[Ut].geometry[0]=At[0].concat(Le[Ut].geometry[0]),Ut}function Zt(Nt,Rt,At){const Ut=At?Rt[0][Rt[0].length-1]:Rt[0][0];return`${Nt}:${Ut.x}:${Ut.y}`}for(let Nt=0;NtNt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((we,Oe)=>we.sortKey-Oe.sortKey)}update(e,a,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,a,this.layers,h),this.icon.programConfigurations.updatePaintArrays(e,a,this.layers,h))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,a){const h=this.lineVertexArray.length;if(e.segment!==void 0){let _=e.dist(a[e.segment+1]),v=e.dist(a[e.segment]);const E={};for(let C=e.segment+1;C=0;C--)E[C]={x:a[C].x,y:a[C].y,tileUnitDistanceFromAnchor:v},C>0&&(v+=a[C-1].dist(a[C]));for(let C=0;C0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,a){const h=e.placedSymbolArray.get(a),_=h.vertexStartIndex+4*h.numGlyphs;for(let v=h.vertexStartIndex;v<_;v+=4)e.indexArray.emplaceBack(v,v+1,v+2),e.indexArray.emplaceBack(v+1,v+2,v+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const a=Math.sin(e),h=Math.cos(e),_=[],v=[],E=[];for(let C=0;C_[C]-_[M]||v[M]-v[C]),E}addToSortKeyRanges(e,a){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===a?h.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const h=this.symbolInstances.get(a);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((_,v,E)=>{_>=0&&E.indexOf(_)===v&&this.addIndicesForPlacedSymbol(this.text,_)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Gt("SymbolBucket",To,{omit:["layers","collisionBoxArray","features","compareText"]}),To.MAX_GLYPHS=65535,To.addDynamicAttributes=Nh;const K0=new Fi({"symbol-placement":new Kt(Fe.layout_symbol["symbol-placement"]),"symbol-spacing":new Kt(Fe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Kt(Fe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new lr(Fe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Kt(Fe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Kt(Fe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Kt(Fe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Kt(Fe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Kt(Fe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Kt(Fe.layout_symbol["icon-rotation-alignment"]),"icon-size":new lr(Fe.layout_symbol["icon-size"]),"icon-text-fit":new Kt(Fe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Kt(Fe.layout_symbol["icon-text-fit-padding"]),"icon-image":new lr(Fe.layout_symbol["icon-image"]),"icon-rotate":new lr(Fe.layout_symbol["icon-rotate"]),"icon-padding":new lr(Fe.layout_symbol["icon-padding"]),"icon-keep-upright":new Kt(Fe.layout_symbol["icon-keep-upright"]),"icon-offset":new lr(Fe.layout_symbol["icon-offset"]),"icon-anchor":new lr(Fe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Kt(Fe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Kt(Fe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Kt(Fe.layout_symbol["text-rotation-alignment"]),"text-field":new lr(Fe.layout_symbol["text-field"]),"text-font":new lr(Fe.layout_symbol["text-font"]),"text-size":new lr(Fe.layout_symbol["text-size"]),"text-max-width":new lr(Fe.layout_symbol["text-max-width"]),"text-line-height":new Kt(Fe.layout_symbol["text-line-height"]),"text-letter-spacing":new lr(Fe.layout_symbol["text-letter-spacing"]),"text-justify":new lr(Fe.layout_symbol["text-justify"]),"text-radial-offset":new lr(Fe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Kt(Fe.layout_symbol["text-variable-anchor"]),"text-anchor":new lr(Fe.layout_symbol["text-anchor"]),"text-max-angle":new Kt(Fe.layout_symbol["text-max-angle"]),"text-writing-mode":new Kt(Fe.layout_symbol["text-writing-mode"]),"text-rotate":new lr(Fe.layout_symbol["text-rotate"]),"text-padding":new Kt(Fe.layout_symbol["text-padding"]),"text-keep-upright":new Kt(Fe.layout_symbol["text-keep-upright"]),"text-transform":new lr(Fe.layout_symbol["text-transform"]),"text-offset":new lr(Fe.layout_symbol["text-offset"]),"text-allow-overlap":new Kt(Fe.layout_symbol["text-allow-overlap"]),"text-overlap":new Kt(Fe.layout_symbol["text-overlap"]),"text-ignore-placement":new Kt(Fe.layout_symbol["text-ignore-placement"]),"text-optional":new Kt(Fe.layout_symbol["text-optional"])});var $h={paint:new Fi({"icon-opacity":new lr(Fe.paint_symbol["icon-opacity"]),"icon-color":new lr(Fe.paint_symbol["icon-color"]),"icon-halo-color":new lr(Fe.paint_symbol["icon-halo-color"]),"icon-halo-width":new lr(Fe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new lr(Fe.paint_symbol["icon-halo-blur"]),"icon-translate":new Kt(Fe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Kt(Fe.paint_symbol["icon-translate-anchor"]),"text-opacity":new lr(Fe.paint_symbol["text-opacity"]),"text-color":new lr(Fe.paint_symbol["text-color"],{runtimeType:yi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new lr(Fe.paint_symbol["text-halo-color"]),"text-halo-width":new lr(Fe.paint_symbol["text-halo-width"]),"text-halo-blur":new lr(Fe.paint_symbol["text-halo-blur"]),"text-translate":new Kt(Fe.paint_symbol["text-translate"]),"text-translate-anchor":new Kt(Fe.paint_symbol["text-translate-anchor"])}),layout:K0};class gp{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:_i,this.defaultValue=e}evaluate(e){if(e.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(e.formattedSection))return a.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Gt("FormatSectionOverride",gp,{omit:["defaultValue"]});class fu extends Dn{constructor(e){super(e,$h)}recalculate(e,a){if(super.recalculate(e,a),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const h=this.layout.get("text-writing-mode");if(h){const _=[];for(const v of h)_.indexOf(v)<0&&_.push(v);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,a,h,_){const v=this.layout.get(e).evaluate(a,{},h,_),E=this._unevaluatedLayout._values[e];return E.isDataDriven()||ya(E.value)||!v?v:function(C,M){return M.replace(/{([^{}]+)}/g,(F,j)=>j in C?String(C[j]):"")}(a.properties,v)}createBucket(e){return new To(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of $h.paint.overridableProperties){if(!fu.hasPaintOverride(this.layout,e))continue;const a=this.paint.get(e),h=new gp(a),_=new oo(h,a.property.specification);let v=null;v=a.value.kind==="constant"||a.value.kind==="source"?new ba("source",_):new ll("composite",_,a.value.zoomStops),this.paint._values[e]=new Mn(a.property,v,a.parameters)}}_handleOverridablePaintPropertyUpdate(e,a,h){return!(!this.layout||a.isDataDriven()||h.isDataDriven())&&fu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,a){const h=e.get("text-field"),_=$h.paint.properties[a];let v=!1;const E=C=>{for(const M of C)if(_.overrides&&_.overrides.hasOverride(M))return void(v=!0)};if(h.value.kind==="constant"&&h.value.value instanceof Ee)E(h.value.value.sections);else if(h.value.kind==="source"){const C=F=>{v||(F instanceof Pt&&Re(F.value)===ii?E(F.value.sections):F instanceof so?E(F.sections):F.eachChild(C))},M=h.value;M._styleExpression&&C(M._styleExpression.expression)}return v}}function jh(i,e,a){let h="never";const _=i.get(e);return _?h=_:i.get(a)&&(h="always"),h}var X0={paint:new Fi({"background-color":new Kt(Fe.paint_background["background-color"]),"background-pattern":new bl(Fe.paint_background["background-pattern"]),"background-opacity":new Kt(Fe.paint_background["background-opacity"])})},J0={paint:new Fi({"raster-opacity":new Kt(Fe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Kt(Fe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Kt(Fe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Kt(Fe.paint_raster["raster-brightness-max"]),"raster-saturation":new Kt(Fe.paint_raster["raster-saturation"]),"raster-contrast":new Kt(Fe.paint_raster["raster-contrast"]),"raster-resampling":new Kt(Fe.paint_raster["raster-resampling"]),"raster-fade-duration":new Kt(Fe.paint_raster["raster-fade-duration"])})};class Y0 extends Dn{constructor(e){super(e,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const Q0={circle:class extends Dn{constructor(i){super(i,Py)}createBucket(i){return new gh(i)}queryRadius(i){const e=i;return Sl("circle-radius",this,e)+Sl("circle-stroke-width",this,e)+Kc(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,a,h,_,v,E,C){const M=Xc(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),v.angle,E),F=this.paint.get("circle-radius").evaluate(e,a)+this.paint.get("circle-stroke-width").evaluate(e,a),j=this.paint.get("circle-pitch-alignment")==="map",W=j?M:function(ne,ae){return ne.map(ke=>Id(ke,ae))}(M,C),X=j?F*E:F;for(const ne of h)for(const ae of ne){const ke=j?ae:Id(ae,C);let we=X;const Oe=Jc([],[ae.x,ae.y,0,1],C);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?we*=Oe[3]/v.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(we*=v.cameraToCenterDistance/Oe[3]),Sy(W,ke,we))return!0}return!1}},heatmap:class extends Dn{constructor(i){super(i,My),this._updateColorRamp()}createBucket(i){return new Cd(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Pd({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends Dn{constructor(i){super(i,Dy)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends Dn{constructor(i){super(i,Ky)}recalculate(i,e){super.recalculate(i,e);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Ch(i)}queryRadius(){return Kc(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,a,h,_,v,E){return vd(Xc(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),v.angle,E),h)}isTileClipped(){return!0}},"fill-extrusion":class extends Dn{constructor(i){super(i,c0)}createBucket(i){return new Ph(i)}queryRadius(){return Kc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,a,h,_,v,E,C){const M=Xc(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),v.angle,E),F=this.paint.get("fill-extrusion-height").evaluate(e,a),j=this.paint.get("fill-extrusion-base").evaluate(e,a),W=function(ne,ae,ke,we){const Oe=[];for(const Qe of ne){const Le=[Qe.x,Qe.y,0,1];Jc(Le,Le,ae),Oe.push(new ct(Le[0]/Le[3],Le[1]/Le[3]))}return Oe}(M,C),X=function(ne,ae,ke,we){const Oe=[],Qe=[],Le=we[8]*ae,Ke=we[9]*ae,ft=we[10]*ae,ht=we[11]*ae,qt=we[8]*ke,Zt=we[9]*ke,Nt=we[10]*ke,Rt=we[11]*ke;for(const At of ne){const Ut=[],Lt=[];for(const xt of At){const rr=xt.x,Jt=xt.y,xr=we[0]*rr+we[4]*Jt+we[12],ti=we[1]*rr+we[5]*Jt+we[13],li=we[2]*rr+we[6]*Jt+we[14],Ti=we[3]*rr+we[7]*Jt+we[15],In=li+ft,$i=Ti+ht,xi=xr+qt,zi=ti+Zt,ji=li+Nt,Zi=Ti+Rt,ln=new ct((xr+Le)/$i,(ti+Ke)/$i);ln.z=In/$i,Ut.push(ln);const wi=new ct(xi/Zi,zi/Zi);wi.z=ji/Zi,Lt.push(wi)}Oe.push(Ut),Qe.push(Lt)}return[Oe,Qe]}(h,j,F,C);return function(ne,ae,ke){let we=1/0;vd(ke,ae)&&(we=Nd(ke,ae[0]));for(let Oe=0;Oe=3){for(let ke=0;ke{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const _p=63710088e-1;class pi{constructor(e,a){if(isNaN(e)||isNaN(a))throw new Error(`Invalid LngLat object: (${e}, ${a})`);if(this.lng=+e,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pi(A(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const a=Math.PI/180,h=this.lat*a,_=e.lat*a,v=Math.sin(h)*Math.sin(_)+Math.cos(h)*Math.cos(_)*Math.cos((e.lng-this.lng)*a);return _p*Math.acos(Math.min(v,1))}toBounds(e=0){const a=360*e/40075017,h=a/Math.cos(Math.PI/180*this.lat);return new Fa(new pi(this.lng-h,this.lat-a),new pi(this.lng+h,this.lat+a))}static convert(e){if(e instanceof pi)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new pi(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new pi(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class Fa{constructor(e,a){e&&(a?this.setSouthWest(e).setNorthEast(a):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof pi?new pi(e.lng,e.lat):pi.convert(e),this}setSouthWest(e){return this._sw=e instanceof pi?new pi(e.lng,e.lat):pi.convert(e),this}extend(e){const a=this._sw,h=this._ne;let _,v;if(e instanceof pi)_=e,v=e;else{if(!(e instanceof Fa))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Fa.convert(e)):this.extend(pi.convert(e)):this;if(_=e._sw,v=e._ne,!_||!v)return this}return a||h?(a.lng=Math.min(_.lng,a.lng),a.lat=Math.min(_.lat,a.lat),h.lng=Math.max(v.lng,h.lng),h.lat=Math.max(v.lat,h.lat)):(this._sw=new pi(_.lng,_.lat),this._ne=new pi(v.lng,v.lat)),this}getCenter(){return new pi((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new pi(this.getWest(),this.getNorth())}getSouthEast(){return new pi(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:a,lat:h}=pi.convert(e);let _=this._sw.lng<=a&&a<=this._ne.lng;return this._sw.lng>this._ne.lng&&(_=this._sw.lng>=a&&a>=this._ne.lng),this._sw.lat<=h&&h<=this._ne.lat&&_}static convert(e){return e instanceof Fa?e:e&&new Fa(e)}}const yp=2*Math.PI*_p;function vp(i){return yp*Math.cos(i*Math.PI/180)}function bp(i){return(180+i)/360}function xp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function wp(i,e){return i/vp(e)}function qh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class du{constructor(e,a,h=0){this.x=+e,this.y=+a,this.z=+h}static fromLngLat(e,a=0){const h=pi.convert(e);return new du(bp(h.lng),xp(h.lat),wp(a,h.lat))}toLngLat(){return new pi(360*this.x-180,qh(this.y))}toAltitude(){return this.z*vp(qh(this.y))}meterInMercatorCoordinateUnits(){return 1/yp*(e=qh(this.y),1/Math.cos(e*Math.PI/180));var e}}function Ep(i,e,a){var h=2*Math.PI*6378137/256/Math.pow(2,a);return[i*h-2*Math.PI*6378137/2,e*h-2*Math.PI*6378137/2]}class Gh{constructor(e,a,h){if(e<0||e>25||h<0||h>=Math.pow(2,e)||a<0||a>=Math.pow(2,e))throw new Error(`x=${a}, y=${h}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=a,this.y=h,this.key=Bl(0,e,e,a,h)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,a,h){const _=(E=this.y,C=this.z,M=Ep(256*(v=this.x),256*(E=Math.pow(2,C)-E-1),C),F=Ep(256*(v+1),256*(E+1),C),M[0]+","+M[1]+","+F[0]+","+F[1]);var v,E,C,M,F;const j=function(W,X,ne){let ae,ke="";for(let we=W;we>0;we--)ae=1<1?"@2x":"").replace(/{quadkey}/g,j).replace(/{bbox-epsg-3857}/g,_)}isChildOf(e){const a=this.z-e.z;return a>0&&e.x===this.x>>a&&e.y===this.y>>a}getTilePoint(e){const a=Math.pow(2,this.z);return new ct((e.x*a-this.x)*Si,(e.y*a-this.y)*Si)}toString(){return`${this.z}/${this.x}/${this.y}`}}class kp{constructor(e,a){this.wrap=e,this.canonical=a,this.key=Bl(e,a.z,a.z,a.x,a.y)}}class Tn{constructor(e,a,h,_,v){if(e= z; overscaledZ = ${e}; z = ${h}`);this.overscaledZ=e,this.wrap=a,this.canonical=new Gh(h,+_,+v),this.key=Bl(a,e,h,_,v)}clone(){return new Tn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-e;return e>this.canonical.z?new Tn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Tn(e,this.wrap,e,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(e,a){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-e;return e>this.canonical.z?Bl(this.wrap*+a,e,this.canonical.z,this.canonical.x,this.canonical.y):Bl(this.wrap*+a,e,e,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const a=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>a&&e.canonical.y===this.canonical.y>>a}children(e){if(this.overscaledZ>=e)return[new Tn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,h=2*this.canonical.x,_=2*this.canonical.y;return[new Tn(a,this.wrap,a,h,_),new Tn(a,this.wrap,a,h+1,_),new Tn(a,this.wrap,a,h,_+1),new Tn(a,this.wrap,a,h+1,_+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=C),C=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(e+1)}_unpackMapbox(e,a,h){return(256*e*256+256*a+h)/10-1e4}_unpackTerrarium(e,a,h){return 256*e+a+h/256-32768}getPixels(){return new Sn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,a,h){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let _=a*this.dim,v=a*this.dim+this.dim,E=h*this.dim,C=h*this.dim+this.dim;switch(a){case-1:_=v-1;break;case 1:v=_+1}switch(h){case-1:E=C-1;break;case 1:C=E+1}const M=-a*this.dim,F=-h*this.dim;for(let j=E;j=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Ip{constructor(e,a,h,_,v){this.type="Feature",this._vectorTileFeature=e,e._z=a,e._x=h,e._y=_,this.properties=e.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(e[a]=this[a]);return e}}class Cp{constructor(e,a){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Pa(Si,16,0),this.grid3D=new Pa(Si,16,0),this.featureIndexArray=new br,this.promoteId=a}insert(e,a,h,_,v,E){const C=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,_,v);const M=E?this.grid3D:this.grid;for(let F=0;F=0&&W[3]>=0&&M.insert(C,W[0],W[1],W[2],W[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Qs.VectorTile(new Mh(this.rawTileData)).layers,this.sourceLayerCoder=new Tp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,a,h,_){this.loadVTLayers();const v=e.params||{},E=Si/e.tileSize/e.scale,C=uo(v.filter),M=e.queryGeometry,F=e.queryPadding*E,j=Pp(M),W=this.grid.query(j.minX-F,j.minY-F,j.maxX+F,j.maxY+F),X=Pp(e.cameraQueryGeometry),ne=this.grid3D.query(X.minX-F,X.minY-F,X.maxX+F,X.maxY+F,(we,Oe,Qe,Le)=>function(Ke,ft,ht,qt,Zt){for(const Rt of Ke)if(ft<=Rt.x&&ht<=Rt.y&&qt>=Rt.x&&Zt>=Rt.y)return!0;const Nt=[new ct(ft,ht),new ct(ft,Zt),new ct(qt,Zt),new ct(qt,ht)];if(Ke.length>2){for(const Rt of Nt)if(vo(Ke,Rt))return!0}for(let Rt=0;Rt(Le||(Le=La(Ke)),ft.queryIntersectsFeature(M,Ke,ht,Le,this.z,e.transform,E,e.pixelPosMatrix)))}return ae}loadMatchingFeature(e,a,h,_,v,E,C,M,F,j,W){const X=this.bucketLayerIDs[a];if(E&&!function(we,Oe){for(let Qe=0;Qe=0)return!0;return!1}(E,X))return;const ne=this.sourceLayerCoder.decode(h),ae=this.vtLayers[ne].feature(_);if(v.needGeometry){const we=Ba(ae,!0);if(!v.filter(new ai(this.tileID.overscaledZ),we,this.tileID.canonical))return}else if(!v.filter(new ai(this.tileID.overscaledZ),ae))return;const ke=this.getId(ae,ne);for(let we=0;we{const C=e instanceof Da?e.get(E):null;return C&&C.evaluate?C.evaluate(a,h,_):C})}function Pp(i){let e=1/0,a=1/0,h=-1/0,_=-1/0;for(const v of i)e=Math.min(e,v.x),a=Math.min(a,v.y),h=Math.max(h,v.x),_=Math.max(_,v.y);return{minX:e,minY:a,maxX:h,maxY:_}}function t1(i,e){return e-i}var Zh;Gt("FeatureIndex",Cp,{omit:["rawTileData","sourceLayerCoder"]}),n.PerformanceMarkers=void 0,(Zh=n.PerformanceMarkers||(n.PerformanceMarkers={})).create="create",Zh.load="load",Zh.fullLoad="fullLoad";let pu=null,Ol=[];const Hh=1e3/30,r1={mark(i){performance.mark(i)},frame(i){const e=i;pu!=null&&Ol.push(e-pu),pu=e},clearMetrics(){pu=null,Ol=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in n.PerformanceMarkers)performance.clearMarks(n.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",n.PerformanceMarkers.create,n.PerformanceMarkers.load),performance.measure("fullLoadTime",n.PerformanceMarkers.create,n.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,a=Ol.length,h=1/(Ol.reduce((v,E)=>v+E,0)/a/1e3),_=Ol.filter(v=>v>Hh).reduce((v,E)=>v+(E-Hh)/Hh,0);return{loadTime:i,fullLoadTime:e,fps:h,percentDroppedFrames:_/(a+_)*100}}};n.AJAXError=Vr,n.ARRAY_TYPE=en,n.Actor=class{constructor(i,e,a){this.target=i,this.parent=e,this.mapId=a,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},L(["receive","process"],this),this.invoker=new e1(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=ce()?i:window}send(i,e,a,h,_=!1){const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);a&&(this.callbacks[v]=a);const E=We(this.globalScope)?void 0:[];return this.target.postMessage({id:v,type:i,hasCallback:!!a,targetMapId:h,mustQueue:_,sourceMapId:this.mapId,data:Ss(e,E)},E),{cancel:()=>{a&&delete this.callbacks[v],this.target.postMessage({id:v,type:"",targetMapId:h,sourceMapId:this.mapId})}}}receive(i){const e=i.data,a=e.id;if(a&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type===""){delete this.tasks[a];const h=this.cancelCallbacks[a];delete this.cancelCallbacks[a],h&&h()}else ce()||e.mustQueue?(this.tasks[a]=e,this.taskQueue.push(a),this.invoker.trigger()):this.processTask(a,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type===""){const a=this.callbacks[i];delete this.callbacks[i],a&&(e.error?a(us(e.error)):a(null,us(e.data)))}else{let a=!1;const h=We(this.globalScope)?void 0:[],_=e.hasCallback?(C,M)=>{a=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:C?Ss(C):null,data:Ss(M,h)},h)}:C=>{a=!0};let v=null;const E=us(e.data);if(this.parent[e.type])v=this.parent[e.type](e.sourceMapId,E,_);else if(this.parent.getWorkerSource){const C=e.type.split(".");v=this.parent.getWorkerSource(e.sourceMapId,C[0],E.source)[C[1]](E,_)}else _(new Error(`Could not find function ${e.type}`));!a&&v&&v.cancel&&(this.cancelCallbacks[i]=v.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},n.AlphaImage=Il,n.CanonicalTileID=Gh,n.CollisionBoxArray=at,n.CollisionCircleLayoutArray=class extends G{},n.Color=Q,n.DEMData=Sp,n.DataConstantProperty=Kt,n.DictionaryCoder=Tp,n.EXTENT=Si,n.ErrorEvent=Wt,n.EvaluationParameters=ai,n.Event=St,n.Evented=wr,n.FeatureIndex=Cp,n.FillBucket=Ch,n.FillExtrusionBucket=Ph,n.GeoJSONFeature=Ip,n.ImageAtlas=Yd,n.ImagePosition=Rh,n.LineBucket=zh,n.LineStripIndexArray=class extends xe{},n.LngLat=pi,n.LngLatBounds=Fa,n.MercatorCoordinate=du,n.ONE_EM=Ni,n.OverscaledTileID=Tn,n.PerformanceUtils=r1,n.PosArray=tr,n.Properties=Fi,n.QuadTriangleArray=class extends ie{},n.RGBAImage=Sn,n.RasterBoundsArray=class extends g{},n.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},n.ResourceType=Rr,n.SegmentVector=Er,n.SymbolBucket=To,n.Transitionable=jc,n.TriangleIndexArray=Yi,n.Uniform1f=As,n.Uniform1i=class extends Cs{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},n.Uniform2f=class extends Cs{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},n.Uniform3f=class extends Cs{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},n.Uniform4f=_o,n.UniformColor=pd,n.UniformMatrix4f=class extends Cs{constructor(i,e){super(i,e),this.current=Ey}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},n.UnwrappedTileID=kp,n.ValidationError=gt,n.ZoomHistory=fl,n.add=function(i,e,a){return i[0]=e[0]+a[0],i[1]=e[1]+a[1],i[2]=e[2]+a[2],i},n.addDynamicAttributes=Nh,n.asyncAll=function(i,e,a){if(!i.length)return a(null,[]);let h=i.length;const _=new Array(i.length);let v=null;i.forEach((E,C)=>{e(E,(M,F)=>{M&&(v=M),_[C]=F,--h==0&&a(v,_)})})},n.bezier=w,n.bindAll=L,n.cacheEntryPossiblyAdded=function(i){ue++,ue>Me&&(i.getActor().send("enforceCacheSizeLimit",ge),ue=0)},n.clamp=k,n.clearTileCache=function(i){const e=caches.delete(it);i&&e.catch(i).then(()=>i())},n.clipLine=up,n.clone=function(i){var e=new en(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},n.clone$1=$,n.clone$2=function(i){var e=new en(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},n.collisionCircleLayout=b0,n.config=$t,n.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},n.create=function(){var i=new en(16);return en!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},n.create$1=wd,n.createExpression=va,n.createFilter=uo,n.createLayout=bi,n.createStyleLayer=function(i){return i.type==="custom"?new Y0(i):new Q0[i.type](i)},n.cross=function(i,e,a){var h=e[0],_=e[1],v=e[2],E=a[0],C=a[1],M=a[2];return i[0]=_*M-v*C,i[1]=v*E-h*M,i[2]=h*C-_*E,i},n.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},n.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},n.ease=S,n.emitValidationErrors=fo,n.enforceCacheSizeLimit=function(i){ee(),et&&et.then(e=>{e.keys().then(a=>{for(let h=0;h{}}},n.identity=vh,n.invert=function(i,e){var a=e[0],h=e[1],_=e[2],v=e[3],E=e[4],C=e[5],M=e[6],F=e[7],j=e[8],W=e[9],X=e[10],ne=e[11],ae=e[12],ke=e[13],we=e[14],Oe=e[15],Qe=a*C-h*E,Le=a*M-_*E,Ke=a*F-v*E,ft=h*M-_*C,ht=h*F-v*C,qt=_*F-v*M,Zt=j*ke-W*ae,Nt=j*we-X*ae,Rt=j*Oe-ne*ae,At=W*we-X*ke,Ut=W*Oe-ne*ke,Lt=X*Oe-ne*we,xt=Qe*Lt-Le*Ut+Ke*At+ft*Rt-ht*Nt+qt*Zt;return xt?(i[0]=(C*Lt-M*Ut+F*At)*(xt=1/xt),i[1]=(_*Ut-h*Lt-v*At)*xt,i[2]=(ke*qt-we*ht+Oe*ft)*xt,i[3]=(X*ht-W*qt-ne*ft)*xt,i[4]=(M*Rt-E*Lt-F*Nt)*xt,i[5]=(a*Lt-_*Rt+v*Nt)*xt,i[6]=(we*Ke-ae*qt-Oe*Le)*xt,i[7]=(j*qt-X*Ke+ne*Le)*xt,i[8]=(E*Ut-C*Rt+F*Zt)*xt,i[9]=(h*Rt-a*Ut-v*Zt)*xt,i[10]=(ae*ht-ke*Ke+Oe*Qe)*xt,i[11]=(W*Ke-j*ht-ne*Qe)*xt,i[12]=(C*Nt-E*At-M*Zt)*xt,i[13]=(a*At-h*Nt+_*Zt)*xt,i[14]=(ke*Le-ae*ft-we*Qe)*xt,i[15]=(j*ft-W*Le+X*Qe)*xt,i):null},n.isImageBitmap=Z,n.isSafari=We,n.isWorker=ce,n.keysDifference=function(i,e){const a=[];for(const h in i)h in e||a.push(h);return a},n.lazyLoadRTLTextPlugin=function(){_n.isLoading()||_n.isLoaded()||za()!=="deferred"||$c()},n.makeRequest=tt,n.mapObject=D,n.mercatorXfromLng=bp,n.mercatorYfromLat=xp,n.mercatorZfromAltitude=wp,n.mul=zy,n.mul$1=function(i,e,a){return i[0]=e[0]*a[0],i[1]=e[1]*a[1],i[2]=e[2]*a[2],i[3]=e[3]*a[3],i},n.multiply=Ed,n.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},n.normalize=function(i,e){var a=e[0],h=e[1],_=e[2],v=a*a+h*h+_*_;return v>0&&(v=1/Math.sqrt(v)),i[0]=e[0]*v,i[1]=e[1]*v,i[2]=e[2]*v,i},n.number=ni,n.ortho=function(i,e,a,h,_,v,E){var C=1/(e-a),M=1/(h-_),F=1/(v-E);return i[0]=-2*C,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*M,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*F,i[11]=0,i[12]=(e+a)*C,i[13]=(_+h)*M,i[14]=(E+v)*F,i[15]=1,i},n.parseCacheControl=ye,n.parseGlyphPbf=function(i){return new Mh(i).readFields(z0,[])},n.pbf=Mh,n.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Si/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,a=i.bucket.layers[0]._unevaluatedLayout._values,h={layoutIconSize:a["icon-size"].possiblyEvaluate(new ai(i.bucket.zoom+1),i.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new ai(i.bucket.zoom+1),i.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new ai(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:M,maxZoom:F}=i.bucket.textSizeData;h.compositeTextSizes=[a["text-size"].possiblyEvaluate(new ai(M),i.canonical),a["text-size"].possiblyEvaluate(new ai(F),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:M,maxZoom:F}=i.bucket.iconSizeData;h.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new ai(M),i.canonical),a["icon-size"].possiblyEvaluate(new ai(F),i.canonical)]}const _=e.get("text-line-height")*Ni,v=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",E=e.get("text-keep-upright"),C=e.get("text-size");for(const M of i.bucket.features){const F=e.get("text-font").evaluate(M,{},i.canonical).join(","),j=C.evaluate(M,{},i.canonical),W=h.layoutTextSize.evaluate(M,{},i.canonical),X=h.layoutIconSize.evaluate(M,{},i.canonical),ne={horizontal:{},vertical:void 0},ae=M.text;let ke,we=[0,0];if(ae){const Le=ae.toString(),Ke=e.get("text-letter-spacing").evaluate(M,{},i.canonical)*Ni,ft=hh(Le)?Ke:0,ht=e.get("text-anchor").evaluate(M,{},i.canonical),qt=e.get("text-variable-anchor");if(!qt){const Ut=e.get("text-radial-offset").evaluate(M,{},i.canonical);we=Ut?dp(ht,[Ut*Ni,Oh]):e.get("text-offset").evaluate(M,{},i.canonical).map(Lt=>Lt*Ni)}let Zt=v?"center":e.get("text-justify").evaluate(M,{},i.canonical);const Nt=e.get("symbol-placement"),Rt=Nt==="point"?e.get("text-max-width").evaluate(M,{},i.canonical)*Ni:0,At=()=>{i.bucket.allowVerticalPlacement&&po(Le)&&(ne.vertical=su(ae,i.glyphMap,i.glyphPositions,i.imagePositions,F,Rt,_,ht,"left",ft,we,n.WritingMode.vertical,!0,Nt,W,j))};if(!v&&qt){const Ut=Zt==="auto"?qt.map(xt=>Fh(xt)):[Zt];let Lt=!1;for(let xt=0;xtthis._layers[ot.id]),Se=he[0];if(Se.visibility==="none")continue;const Ee=Se.source||"";let ve=this.familiesBySource[Ee];ve||(ve=this.familiesBySource[Ee]={});const Te=Se.sourceLayer||"_geojsonTileLayer";let Ge=ve[Te];Ge||(Ge=ve[Te]=[]),Ge.push(he)}}}class S{constructor(z){const U={},q=[];for(const Ee in z){const ve=z[Ee],Te=U[Ee]={};for(const Ge in ve){const ot=ve[+Ge];if(!ot||ot.bitmap.width===0||ot.bitmap.height===0)continue;const Re={x:0,y:0,w:ot.bitmap.width+2,h:ot.bitmap.height+2};q.push(Re),Te[Ge]={rect:Re,metrics:ot.metrics}}}const{w:Q,h:he}=n.potpack(q),Se=new n.AlphaImage({width:Q||1,height:he||1});for(const Ee in z){const ve=z[Ee];for(const Te in ve){const Ge=ve[+Te];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const ot=U[Ee][Te].rect;n.AlphaImage.copy(Ge.bitmap,Se,{x:0,y:0},{x:ot.x+1,y:ot.y+1},Ge.bitmap)}}this.image=Se,this.positions=U}}n.register("GlyphAtlas",S);class k{constructor(z){this.tileID=new n.OverscaledTileID(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId}parse(z,U,q,Q,he){this.status="parsing",this.data=z,this.collisionBoxArray=new n.CollisionBoxArray;const Se=new n.DictionaryCoder(Object.keys(z.layers).sort()),Ee=new n.FeatureIndex(this.tileID,this.promoteId);Ee.bucketLayerIDs=[];const ve={},Te={featureIndex:Ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:q},Ge=U.familiesBySource[this.source];for(const or in Ge){const fr=z.layers[or];if(!fr)continue;fr.version===1&&n.warnOnce(`Vector tile source "${this.source}" layer "${or}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const dr=Se.encode(or),Tr=[];for(let Qr=0;Qr=Dr.maxzoom||Dr.visibility!=="none"&&(A(Qr,this.zoom,q),(ve[Dr.id]=Dr.createBucket({index:Ee.bucketLayerIDs.length,layers:Qr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:dr,sourceID:this.source})).populate(Tr,Te,this.tileID.canonical),Ee.bucketLayerIDs.push(Qr.map(fi=>fi.id)))}}let ot,Re,Ct,Pt;const bt=n.mapObject(Te.glyphDependencies,or=>Object.keys(or).map(Number));Object.keys(bt).length?Q.send("getGlyphs",{uid:this.uid,stacks:bt},(or,fr)=>{ot||(ot=or,Re=fr,mr.call(this))}):Re={};const Xt=Object.keys(Te.iconDependencies);Xt.length?Q.send("getImages",{icons:Xt,source:this.source,tileID:this.tileID,type:"icons"},(or,fr)=>{ot||(ot=or,Ct=fr,mr.call(this))}):Ct={};const Yt=Object.keys(Te.patternDependencies);function mr(){if(ot)return he(ot);if(Re&&Ct&&Pt){const or=new S(Re),fr=new n.ImageAtlas(Ct,Pt);for(const dr in ve){const Tr=ve[dr];Tr instanceof n.SymbolBucket?(A(Tr.layers,this.zoom,q),n.performSymbolLayout({bucket:Tr,glyphMap:Re,glyphPositions:or.positions,imageMap:Ct,imagePositions:fr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Tr.hasPattern&&(Tr instanceof n.LineBucket||Tr instanceof n.FillBucket||Tr instanceof n.FillExtrusionBucket)&&(A(Tr.layers,this.zoom,q),Tr.addFeatures(Te,this.tileID.canonical,fr.patternPositions))}this.status="done",he(null,{buckets:Object.values(ve).filter(dr=>!dr.isEmpty()),featureIndex:Ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:or.image,imageAtlas:fr,glyphMap:this.returnDependencies?Re:null,iconMap:this.returnDependencies?Ct:null,glyphPositions:this.returnDependencies?or.positions:null})}}Yt.length?Q.send("getImages",{icons:Yt,source:this.source,tileID:this.tileID,type:"patterns"},(or,fr)=>{ot||(ot=or,Pt=fr,mr.call(this))}):Pt={},mr.call(this)}}function A(N,z,U){const q=new n.EvaluationParameters(z);for(const Q of N)Q.recalculate(q,U)}function P(N,z){const U=n.getArrayBuffer(N.request,(q,Q,he,Se)=>{q?z(q):Q&&z(null,{vectorTile:new n.vectorTile.VectorTile(new n.pbf(Q)),rawData:Q,cacheControl:he,expires:Se})});return()=>{U.cancel(),z()}}class T{constructor(z,U,q,Q){this.actor=z,this.layerIndex=U,this.availableImages=q,this.loadVectorData=Q||P,this.loading={},this.loaded={}}loadTile(z,U){const q=z.uid;this.loading||(this.loading={});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new n.RequestPerformance(z.request),he=this.loading[q]=new k(z);he.abort=this.loadVectorData(z,(Se,Ee)=>{if(delete this.loading[q],Se||!Ee)return he.status="done",this.loaded[q]=he,U(Se);const ve=Ee.rawData,Te={};Ee.expires&&(Te.expires=Ee.expires),Ee.cacheControl&&(Te.cacheControl=Ee.cacheControl);const Ge={};if(Q){const ot=Q.finish();ot&&(Ge.resourceTiming=JSON.parse(JSON.stringify(ot)))}he.vectorTile=Ee.vectorTile,he.parse(Ee.vectorTile,this.layerIndex,this.availableImages,this.actor,(ot,Re)=>{if(ot||!Re)return U(ot);U(null,n.extend({rawTileData:ve.slice(0)},Re,Te,Ge))}),this.loaded=this.loaded||{},this.loaded[q]=he})}reloadTile(z,U){const q=this.loaded,Q=z.uid,he=this;if(q&&q[Q]){const Se=q[Q];Se.showCollisionBoxes=z.showCollisionBoxes;const Ee=(ve,Te)=>{const Ge=Se.reloadCallback;Ge&&(delete Se.reloadCallback,Se.parse(Se.vectorTile,he.layerIndex,this.availableImages,he.actor,Ge)),U(ve,Te)};Se.status==="parsing"?Se.reloadCallback=Ee:Se.status==="done"&&(Se.vectorTile?Se.parse(Se.vectorTile,this.layerIndex,this.availableImages,this.actor,Ee):Ee())}}abortTile(z,U){const q=this.loading,Q=z.uid;q&&q[Q]&&q[Q].abort&&(q[Q].abort(),delete q[Q]),U()}removeTile(z,U){const q=this.loaded,Q=z.uid;q&&q[Q]&&delete q[Q],U()}}class L{constructor(){this.loaded={}}loadTile(z,U){const{uid:q,encoding:Q,rawImageData:he}=z,Se=n.isImageBitmap(he)?this.getImageData(he):he,Ee=new n.DEMData(q,Se,Q);this.loaded=this.loaded||{},this.loaded[q]=Ee,U(null,Ee)}getImageData(z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(z.width,z.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=z.width,this.offscreenCanvas.height=z.height,this.offscreenCanvasContext.drawImage(z,0,0,z.width,z.height);const U=this.offscreenCanvasContext.getImageData(-1,-1,z.width+2,z.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new n.RGBAImage({width:U.width,height:U.height},U.data)}removeTile(z){const U=this.loaded,q=z.uid;U&&U[q]&&delete U[q]}}var D=function N(z,U){var q,Q=z&&z.type;if(Q==="FeatureCollection")for(q=0;q=Math.abs(Ee)?U-ve+Ee:Ee-ve+U,U=ve}U+q>=0!=!!z&&N.reverse()}const J=n.vectorTile.VectorTileFeature.prototype.toGeoJSON;class Y{constructor(z){this._feature=z,this.extent=n.EXTENT,this.type=z.type,this.properties=z.tags,"id"in z&&!isNaN(z.id)&&(this.id=parseInt(z.id,10))}loadGeometry(){if(this._feature.type===1){const z=[];for(const U of this._feature.geometry)z.push([new n.pointGeometry(U[0],U[1])]);return z}{const z=[];for(const U of this._feature.geometry){const q=[];for(const Q of U)q.push(new n.pointGeometry(Q[0],Q[1]));z.push(q)}return z}}toGeoJSON(z,U,q){return J.call(this,z,U,q)}}class se{constructor(z){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=n.EXTENT,this.length=z.length,this._features=z}feature(z){return new Y(this._features[z])}}var re={exports:{}},ce=n.pointGeometry,ye=n.vectorTile.VectorTileFeature,Ae=_t;function _t(N,z){this.options=z||{},this.features=N,this.length=N.length}function le(N,z){this.id=typeof N.id=="number"?N.id:void 0,this.type=N.type,this.rawGeometry=N.type===1?[N.geometry]:N.geometry,this.properties=N.tags,this.extent=z||4096}_t.prototype.feature=function(N){return new le(this.features[N],this.options.extent)},le.prototype.loadGeometry=function(){var N=this.rawGeometry;this.geometry=[];for(var z=0;z>31}function oe(N,z){for(var U=N.loadGeometry(),q=N.type,Q=0,he=0,Se=U.length,Ee=0;Ee>1;ee(N,z,Se,q,Q,he%2),Me(N,z,U,q,Se-1,he+1),Me(N,z,U,Se+1,Q,he+1)}function ee(N,z,U,q,Q,he){for(;Q>q;){if(Q-q>600){const Te=Q-q+1,Ge=U-q+1,ot=Math.log(Te),Re=.5*Math.exp(2*ot/3),Ct=.5*Math.sqrt(ot*Re*(Te-Re)/Te)*(Ge-Te/2<0?-1:1);ee(N,z,U,Math.max(q,Math.floor(U-Ge*Re/Te+Ct)),Math.min(Q,Math.floor(U+(Te-Ge)*Re/Te+Ct)),he)}const Se=z[2*U+he];let Ee=q,ve=Q;for(ue(N,z,q,U),z[2*Q+he]>Se&&ue(N,z,q,Q);EeSe;)ve--}z[2*q+he]===Se?ue(N,z,q,ve):(ve++,ue(N,z,ve,Q)),ve<=U&&(q=ve+1),U<=ve&&(Q=ve-1)}}function ue(N,z,U,q){Je(N,U,q),Je(z,2*U,2*q),Je(z,2*U+1,2*q+1)}function Je(N,z,U){const q=N[z];N[z]=N[U],N[U]=q}function wt(N,z,U,q){const Q=N-U,he=z-q;return Q*Q+he*he}re.exports=$e,re.exports.fromVectorTileJs=$e,re.exports.fromGeojsonVt=function(N,z){z=z||{};var U={};for(var q in N)U[q]=new Z(N[q].features,z),U[q].name=q,U[q].version=z.version,U[q].extent=z.extent;return $e({layers:U})},re.exports.GeoJSONWrapper=Z;const pt=N=>N[0],Xe=N=>N[1];class Bt{constructor(z,U=pt,q=Xe,Q=64,he=Float64Array){this.nodeSize=Q,this.points=z;const Se=z.length<65536?Uint16Array:Uint32Array,Ee=this.ids=new Se(z.length),ve=this.coords=new he(2*z.length);for(let Te=0;Te=Ee&&Pt<=Te&&bt>=ve&&bt<=Ge&&Ct.push(he[dr]);continue}const or=Math.floor((mr+Yt)/2);Pt=Se[2*or],bt=Se[2*or+1],Pt>=Ee&&Pt<=Te&&bt>=ve&&bt<=Ge&&Ct.push(he[or]);const fr=(Xt+1)%2;(Xt===0?Ee<=Pt:ve<=bt)&&(Re.push(mr),Re.push(or-1),Re.push(fr)),(Xt===0?Te>=Pt:Ge>=bt)&&(Re.push(or+1),Re.push(Yt),Re.push(fr))}return Ct}(this.ids,this.coords,z,U,q,Q,this.nodeSize)}within(z,U,q){return function(Q,he,Se,Ee,ve,Te){const Ge=[0,Q.length-1,0],ot=[],Re=ve*ve;for(;Ge.length;){const Ct=Ge.pop(),Pt=Ge.pop(),bt=Ge.pop();if(Pt-bt<=Te){for(let fr=bt;fr<=Pt;fr++)wt(he[2*fr],he[2*fr+1],Se,Ee)<=Re&&ot.push(Q[fr]);continue}const Xt=Math.floor((bt+Pt)/2),Yt=he[2*Xt],mr=he[2*Xt+1];wt(Yt,mr,Se,Ee)<=Re&&ot.push(Q[Xt]);const or=(Ct+1)%2;(Ct===0?Se-ve<=Yt:Ee-ve<=mr)&&(Ge.push(bt),Ge.push(Xt-1),Ge.push(or)),(Ct===0?Se+ve>=Yt:Ee+ve>=mr)&&(Ge.push(Xt+1),Ge.push(Pt),Ge.push(or))}return ot}(this.ids,this.coords,z,U,q,this.nodeSize)}}const Qt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:N=>N},Rr=Math.fround||(Vr=new Float32Array(1),N=>(Vr[0]=+N,Vr[0]));var Vr;class H{constructor(z){this.options=je(Object.create(Qt),z),this.trees=new Array(this.options.maxZoom+1)}load(z){const{log:U,minZoom:q,maxZoom:Q,nodeSize:he}=this.options;U&&console.time("total time");const Se=`prepare ${z.length} points`;U&&console.time(Se),this.points=z;let Ee=[];for(let ve=0;ve=q;ve--){const Te=+Date.now();Ee=this._cluster(Ee,ve),this.trees[ve]=new Bt(Ee,vt,Ot,he,Float32Array),U&&console.log("z%d: %d clusters in %dms",ve,Ee.length,+Date.now()-Te)}return U&&console.timeEnd("total time"),this}getClusters(z,U){let q=((z[0]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,z[1]));let he=z[2]===180?180:((z[2]+180)%360+360)%360-180;const Se=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)q=-180,he=180;else if(q>he){const Ge=this.getClusters([q,Q,180,Se],U),ot=this.getClusters([-180,Q,he,Se],U);return Ge.concat(ot)}const Ee=this.trees[this._limitZoom(U)],ve=Ee.range(Ie(q),dt(Se),Ie(he),dt(Q)),Te=[];for(const Ge of ve){const ot=Ee.points[Ge];Te.push(ot.numPoints?be(ot):this.points[ot.index])}return Te}getChildren(z){const U=this._getOriginId(z),q=this._getOriginZoom(z),Q="No cluster with the specified id.",he=this.trees[q];if(!he)throw new Error(Q);const Se=he.points[U];if(!Se)throw new Error(Q);const Ee=this.options.radius/(this.options.extent*Math.pow(2,q-1)),ve=he.within(Se.x,Se.y,Ee),Te=[];for(const Ge of ve){const ot=he.points[Ge];ot.parentId===z&&Te.push(ot.numPoints?be(ot):this.points[ot.index])}if(Te.length===0)throw new Error(Q);return Te}getLeaves(z,U,q){const Q=[];return this._appendLeaves(Q,z,U=U||10,q=q||0,0),Q}getTile(z,U,q){const Q=this.trees[this._limitZoom(z)],he=Math.pow(2,z),{extent:Se,radius:Ee}=this.options,ve=Ee/Se,Te=(q-ve)/he,Ge=(q+1+ve)/he,ot={features:[]};return this._addTileFeatures(Q.range((U-ve)/he,Te,(U+1+ve)/he,Ge),Q.points,U,q,he,ot),U===0&&this._addTileFeatures(Q.range(1-ve/he,Te,1,Ge),Q.points,he,q,he,ot),U===he-1&&this._addTileFeatures(Q.range(0,Te,ve/he,Ge),Q.points,-1,q,he,ot),ot.features.length?ot:null}getClusterExpansionZoom(z){let U=this._getOriginZoom(z)-1;for(;U<=this.options.maxZoom;){const q=this.getChildren(z);if(U++,q.length!==1)break;z=q[0].properties.cluster_id}return U}_appendLeaves(z,U,q,Q,he){const Se=this.getChildren(U);for(const Ee of Se){const ve=Ee.properties;if(ve&&ve.cluster?he+ve.point_count<=Q?he+=ve.point_count:he=this._appendLeaves(z,ve.cluster_id,q,Q,he):heU&&(Pt+=Xt.numPoints||1)}if(Pt>Ct&&Pt>=Ee){let bt=Ge.x*Ct,Xt=Ge.y*Ct,Yt=Se&&Ct>1?this._map(Ge,!0):null;const mr=(Te<<5)+(U+1)+this.points.length;for(const or of Re){const fr=ot.points[or];if(fr.zoom<=U)continue;fr.zoom=U;const dr=fr.numPoints||1;bt+=fr.x*dr,Xt+=fr.y*dr,fr.parentId=mr,Se&&(Yt||(Yt=this._map(Ge,!0)),Se(Yt,this._map(fr)))}Ge.parentId=mr,q.push(ut(bt/Pt,Xt/Pt,mr,Pt,Yt))}else if(q.push(Ge),Pt>1)for(const bt of Re){const Xt=ot.points[bt];Xt.zoom<=U||(Xt.zoom=U,q.push(Xt))}}return q}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,U){if(z.numPoints)return U?je({},z.properties):z.properties;const q=this.points[z.index].properties,Q=this.options.map(q);return U&&Q===q?je({},Q):Q}}function ut(N,z,U,q,Q){return{x:Rr(N),y:Rr(z),zoom:1/0,id:U,parentId:-1,numPoints:q,properties:Q}}function tt(N,z){const[U,q]=N.geometry.coordinates;return{x:Rr(Ie(U)),y:Rr(dt(q)),zoom:1/0,index:z,parentId:-1}}function be(N){return{type:"Feature",id:N.id,properties:pe(N),geometry:{type:"Point",coordinates:[(z=N.x,360*(z-.5)),mt(N.y)]}};var z}function pe(N){const z=N.numPoints,U=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z;return je(je({},N.properties),{cluster:!0,cluster_id:N.id,point_count:z,point_count_abbreviated:U})}function Ie(N){return N/360+.5}function dt(N){const z=Math.sin(N*Math.PI/180),U=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return U<0?0:U>1?1:U}function mt(N){const z=(180-360*N)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function je(N,z){for(const U in z)N[U]=z[U];return N}function vt(N){return N.x}function Ot(N){return N.y}function St(N,z,U,q){for(var Q,he=q,Se=U-z>>1,Ee=U-z,ve=N[z],Te=N[z+1],Ge=N[U],ot=N[U+1],Re=z+3;Rehe)Q=Re,he=Ct;else if(Ct===he){var Pt=Math.abs(Re-Se);Ptq&&(Q-z>3&&St(N,z,Q,q),N[Q+2]=he,U-Q>3&&St(N,Q,U,q))}function Wt(N,z,U,q,Q,he){var Se=Q-U,Ee=he-q;if(Se!==0||Ee!==0){var ve=((N-U)*Se+(z-q)*Ee)/(Se*Se+Ee*Ee);ve>1?(U=Q,q=he):ve>0&&(U+=Se*ve,q+=Ee*ve)}return(Se=N-U)*Se+(Ee=z-q)*Ee}function wr(N,z,U,q){var Q={id:N===void 0?null:N,type:z,geometry:U,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(he){var Se=he.geometry,Ee=he.type;if(Ee==="Point"||Ee==="MultiPoint"||Ee==="LineString")Fe(he,Se);else if(Ee==="Polygon"||Ee==="MultiLineString")for(var ve=0;ve0&&(Se+=q?(Q*Te-ve*he)/2:Math.sqrt(Math.pow(ve-Q,2)+Math.pow(Te-he,2))),Q=ve,he=Te}var Ge=z.length-3;z[2]=1,St(z,0,Ge,U),z[Ge+2]=1,z.size=Math.abs(Se),z.start=0,z.end=z.size}function yr(N,z,U,q){for(var Q=0;Q1?1:U}function Ei(N,z,U,q,Q,he,Se,Ee){if(q/=z,he>=(U/=z)&&Se=q)return null;for(var ve=[],Te=0;Te=U&&Pt=q)){var bt=[];if(Re==="Point"||Re==="MultiPoint")_i(ot,bt,U,q,Q);else if(Re==="LineString")Tt(ot,bt,U,q,Q,!1,Ee.lineMetrics);else if(Re==="MultiLineString")hr(ot,bt,U,q,Q,!1);else if(Re==="Polygon")hr(ot,bt,U,q,Q,!0);else if(Re==="MultiPolygon")for(var Xt=0;Xt=U&&Se<=q&&(z.push(N[he]),z.push(N[he+1]),z.push(N[he+2]))}}function Tt(N,z,U,q,Q,he,Se){for(var Ee,ve,Te=pr(N),Ge=Q===0?nn:ar,ot=N.start,Re=0;ReU&&(ve=Ge(Te,Ct,Pt,Xt,Yt,U),Se&&(Te.start=ot+Ee*ve)):mr>q?or=U&&(ve=Ge(Te,Ct,Pt,Xt,Yt,U),fr=!0),or>q&&mr<=q&&(ve=Ge(Te,Ct,Pt,Xt,Yt,q),fr=!0),!he&&fr&&(Se&&(Te.end=ot+Ee*ve),z.push(Te),Te=pr(N)),Se&&(ot+=Ee)}var dr=N.length-3;Ct=N[dr],Pt=N[dr+1],bt=N[dr+2],(mr=Q===0?Ct:Pt)>=U&&mr<=q&&yi(Te,Ct,Pt,bt),dr=Te.length-3,he&&dr>=3&&(Te[dr]!==Te[0]||Te[dr+1]!==Te[1])&&yi(Te,Te[0],Te[1],Te[2]),Te.length&&z.push(Te)}function pr(N){var z=[];return z.size=N.size,z.start=N.start,z.end=N.end,z}function hr(N,z,U,q,Q,he){for(var Se=0;SeSe.maxX&&(Se.maxX=Ge),ot>Se.maxY&&(Se.maxY=ot)}return Se}function Lr(N,z,U,q){var Q=z.geometry,he=z.type,Se=[];if(he==="Point"||he==="MultiPoint")for(var Ee=0;Ee0&&z.size<(Q?Se:q))U.numPoints+=z.length/3;else{for(var Ee=[],ve=0;veSe)&&(U.numSimplified++,Ee.push(z[ve]),Ee.push(z[ve+1])),U.numPoints++;Q&&function(Te,Ge){for(var ot=0,Re=0,Ct=Te.length,Pt=Ct-2;Re0===Ge)for(Re=0,Ct=Te.length;Re24)throw new Error("maxZoom should be in the 0-24 range");if(z.promoteId&&z.generateId)throw new Error("promoteId and generateId cannot be used together.");var q=function(Q,he){var Se=[];if(Q.type==="FeatureCollection")for(var Ee=0;Ee1&&console.time("creation"),Re=this.tiles[ot]=Oi(N,z,U,q,ve),this.tileCoords.push({z,x:U,y:q}),Te)){Te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",z,U,q,Re.numFeatures,Re.numPoints,Re.numSimplified),console.timeEnd("creation"));var Ct="z"+z;this.stats[Ct]=(this.stats[Ct]||0)+1,this.total++}if(Re.source=N,Q){if(z===ve.maxZoom||z===Q)continue;var Pt=1<1&&console.time("clipping");var bt,Xt,Yt,mr,or,fr,dr=.5*ve.buffer/ve.extent,Tr=.5-dr,Qr=.5+dr,Dr=1+dr;bt=Xt=Yt=mr=null,or=Ei(N,Ge,U-dr,U+Qr,0,Re.minX,Re.maxX,ve),fr=Ei(N,Ge,U+Tr,U+Dr,0,Re.minX,Re.maxX,ve),N=null,or&&(bt=Ei(or,Ge,q-dr,q+Qr,1,Re.minY,Re.maxY,ve),Xt=Ei(or,Ge,q+Tr,q+Dr,1,Re.minY,Re.maxY,ve),or=null),fr&&(Yt=Ei(fr,Ge,q-dr,q+Qr,1,Re.minY,Re.maxY,ve),mr=Ei(fr,Ge,q+Tr,q+Dr,1,Re.minY,Re.maxY,ve),fr=null),Te>1&&console.timeEnd("clipping"),Ee.push(bt||[],z+1,2*U,2*q),Ee.push(Xt||[],z+1,2*U,2*q+1),Ee.push(Yt||[],z+1,2*U+1,2*q),Ee.push(mr||[],z+1,2*U+1,2*q+1)}}},gn.prototype.getTile=function(N,z,U){var q=this.options,Q=q.extent,he=q.debug;if(N<0||N>24)return null;var Se=1<1&&console.log("drilling down to z%d-%d-%d",N,z,U);for(var ve,Te=N,Ge=z,ot=U;!ve&&Te>0;)Te--,Ge=Math.floor(Ge/2),ot=Math.floor(ot/2),ve=this.tiles[zn(Te,Ge,ot)];return ve&&ve.source?(he>1&&console.log("found parent tile z%d-%d-%d",Te,Ge,ot),he>1&&console.time("drilling down"),this.splitTile(ve.source,Te,Ge,ot,N,z,U),he>1&&console.timeEnd("drilling down"),this.tiles[Ee]?ss(this.tiles[Ee],Q):null):null};class $n extends T{constructor(z,U,q,Q){super(z,U,q,Vn),Q&&(this.loadGeoJSON=Q)}loadData(z,U){var q;(q=this._pendingRequest)===null||q===void 0||q.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new n.RequestPerformance(z.request);this._pendingCallback=U,this._pendingRequest=this.loadGeoJSON(z,(he,Se)=>{if(delete this._pendingCallback,delete this._pendingRequest,he||!Se)return U(he);if(typeof Se!="object")return U(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`));{D(Se,!0);try{if(z.filter){const ve=n.createExpression(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ve.result==="error")throw new Error(ve.value.map(Ge=>`${Ge.key}: ${Ge.message}`).join(", "));Se={type:"FeatureCollection",features:Se.features.filter(Ge=>ve.value.evaluate({zoom:0},Ge))}}this._geoJSONIndex=z.cluster?new H(function({superclusterOptions:ve,clusterProperties:Te}){if(!Te||!ve)return ve;const Ge={},ot={},Re={accumulated:null,zoom:0},Ct={properties:null},Pt=Object.keys(Te);for(const bt of Pt){const[Xt,Yt]=Te[bt],mr=n.createExpression(Yt),or=n.createExpression(typeof Xt=="string"?[Xt,["accumulated"],["get",bt]]:Xt);Ge[bt]=mr.value,ot[bt]=or.value}return ve.map=bt=>{Ct.properties=bt;const Xt={};for(const Yt of Pt)Xt[Yt]=Ge[Yt].evaluate(Re,Ct);return Xt},ve.reduce=(bt,Xt)=>{Ct.properties=Xt;for(const Yt of Pt)Re.accumulated=bt[Yt],bt[Yt]=ot[Yt].evaluate(Re,Ct)},ve}(z)).load(Se.features):function(ve,Te){return new gn(ve,Te)}(Se,z.geojsonVtOptions)}catch(ve){return U(ve)}this.loaded={};const Ee={};if(Q){const ve=Q.finish();ve&&(Ee.resourceTiming={},Ee.resourceTiming[z.source]=JSON.parse(JSON.stringify(ve)))}U(null,Ee)}})}reloadTile(z,U){const q=this.loaded;return q&&q[z.uid]?super.reloadTile(z,U):this.loadTile(z,U)}loadGeoJSON(z,U){if(z.request)return n.getJSON(z.request,U);if(typeof z.data=="string")try{U(null,JSON.parse(z.data))}catch{U(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`))}else U(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(z,U){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),U()}getClusterExpansionZoom(z,U){try{U(null,this._geoJSONIndex.getClusterExpansionZoom(z.clusterId))}catch(q){U(q)}}getClusterChildren(z,U){try{U(null,this._geoJSONIndex.getChildren(z.clusterId))}catch(q){U(q)}}getClusterLeaves(z,U){try{U(null,this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset))}catch(q){U(q)}}}class Ce{constructor(z){this.self=z,this.actor=new n.Actor(z,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:T,geojson:$n},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(U,q)=>{if(this.workerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.workerSourceTypes[U]=q},this.self.registerRTLTextPlugin=U=>{if(n.plugin.isParsed())throw new Error("RTL text plugin already registered.");n.plugin.applyArabicShaping=U.applyArabicShaping,n.plugin.processBidirectionalText=U.processBidirectionalText,n.plugin.processStyledBidirectionalText=U.processStyledBidirectionalText}}setReferrer(z,U){this.referrer=U}setImages(z,U,q){this.availableImages[z]=U;for(const Q in this.workerSources[z]){const he=this.workerSources[z][Q];for(const Se in he)he[Se].availableImages=U}q()}setLayers(z,U,q){this.getLayerIndex(z).replace(U),q()}updateLayers(z,U,q){this.getLayerIndex(z).update(U.layers,U.removedIds),q()}loadTile(z,U,q){this.getWorkerSource(z,U.type,U.source).loadTile(U,q)}loadDEMTile(z,U,q){this.getDEMWorkerSource(z,U.source).loadTile(U,q)}reloadTile(z,U,q){this.getWorkerSource(z,U.type,U.source).reloadTile(U,q)}abortTile(z,U,q){this.getWorkerSource(z,U.type,U.source).abortTile(U,q)}removeTile(z,U,q){this.getWorkerSource(z,U.type,U.source).removeTile(U,q)}removeDEMTile(z,U){this.getDEMWorkerSource(z,U.source).removeTile(U)}removeSource(z,U,q){if(!this.workerSources[z]||!this.workerSources[z][U.type]||!this.workerSources[z][U.type][U.source])return;const Q=this.workerSources[z][U.type][U.source];delete this.workerSources[z][U.type][U.source],Q.removeSource!==void 0?Q.removeSource(U,q):q()}loadWorkerSource(z,U,q){try{this.self.importScripts(U.url),q()}catch(Q){q(Q.toString())}}syncRTLPluginState(z,U,q){try{n.plugin.setState(U);const Q=n.plugin.getPluginURL();if(n.plugin.isLoaded()&&!n.plugin.isParsed()&&Q!=null){this.self.importScripts(Q);const he=n.plugin.isParsed();q(he?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Q}`),he)}}catch(Q){q(Q.toString())}}getAvailableImages(z){let U=this.availableImages[z];return U||(U=[]),U}getLayerIndex(z){let U=this.layerIndexes[z];return U||(U=this.layerIndexes[z]=new w),U}getWorkerSource(z,U,q){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][U]||(this.workerSources[z][U]={}),!this.workerSources[z][U][q]){const Q={send:(he,Se,Ee)=>{this.actor.send(he,Se,Ee,z)}};this.workerSources[z][U][q]=new this.workerSourceTypes[U](Q,this.getLayerIndex(z),this.getAvailableImages(z))}return this.workerSources[z][U][q]}getDEMWorkerSource(z,U){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][U]||(this.demWorkerSources[z][U]=new L),this.demWorkerSources[z][U]}enforceCacheSizeLimit(z,U){n.enforceCacheSizeLimit(U)}}return n.isWorker()&&(self.worker=new Ce(self)),Ce}),f(["./shared"],function(n){var m=b;function b(g){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,y,x=new Blob([""],{type:"text/javascript"}),I=URL.createObjectURL(x);try{y=new Worker(I),p=!0}catch{p=!1}return y&&y.terminate(),URL.revokeObjectURL(I),p}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var p=document.createElement("canvas");p.width=p.height=1;var y=p.getContext("2d");if(!y)return!1;var x=y.getImageData(0,0,1,1);return x&&x.width===p.width}()?(w[u=t&&t.failIfMajorPerformanceCaveat]===void 0&&(w[u]=function(p){var y,x=function(I){var R=document.createElement("canvas"),O=Object.create(b.webGLContextAttributes);return O.failIfMajorPerformanceCaveat=I,R.getContext("webgl",O)||R.getContext("experimental-webgl",O)}(p);if(!x)return!1;try{y=x.createShader(x.VERTEX_SHADER)}catch{return!1}return!(!y||x.isContextLost())&&(x.shaderSource(y,"void main() {}"),x.compileShader(y),x.getShaderParameter(y,x.COMPILE_STATUS)===!0)}(u)),w[u]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var u}(g)}var w={};function S(g,t){if(Array.isArray(g)){if(!Array.isArray(t)||g.length!==t.length)return!1;for(let u=0;u{window.removeEventListener("click",k.suppressClickInternal,!0)},0)}static mousePos(t,u){const p=t.getBoundingClientRect();return new n.pointGeometry(u.clientX-p.left-t.clientLeft,u.clientY-p.top-t.clientTop)}static touchPos(t,u){const p=t.getBoundingClientRect(),y=[];for(let x=0;x-1);O++,x[O]=R,I[O]=V,I[O+1]=B}for(let R=0,O=0;R{let R=this.entries[y];R||(R=this.entries[y]={glyphs:{},requests:{},ranges:{}});let O=R.glyphs[x];if(O!==void 0)return void I(null,{stack:y,id:x,glyph:O});if(O=this._tinySDF(R,y,x),O)return R.glyphs[x]=O,void I(null,{stack:y,id:x,glyph:O});const V=Math.floor(x/256);if(256*V>65535)return void I(new Error("glyphs > 65535 not supported"));if(R.ranges[V])return void I(null,{stack:y,id:x,glyph:O});let G=R.requests[V];G||(G=R.requests[V]=[],Y.loadGlyphRange(y,V,this.url,this.requestManager,(K,ie)=>{if(ie){for(const me in ie)this._doesCharSupportLocalGlyph(+me)||(R.glyphs[+me]=ie[+me]);R.ranges[V]=!0}for(const me of G)me(K,ie);delete R.requests[V]})),G.push((K,ie)=>{K?I(K):ie&&I(null,{stack:y,id:x,glyph:ie[x]||null})})},(y,x)=>{if(y)u(y);else if(x){const I={};for(const{stack:R,id:O,glyph:V}of x)(I[R]||(I[R]={}))[O]=V&&{id:V.id,bitmap:V.bitmap.clone(),metrics:V.metrics};u(null,I)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(n.unicodeBlockLookup["CJK Unified Ideographs"](t)||n.unicodeBlockLookup["Hangul Syllables"](t)||n.unicodeBlockLookup.Hiragana(t)||n.unicodeBlockLookup.Katakana(t))}_tinySDF(t,u,p){const y=this.localIdeographFontFamily;if(!y||!this._doesCharSupportLocalGlyph(p))return;let x=t.tinySDF;if(!x){let R="400";/bold/i.test(u)?R="900":/medium/i.test(u)?R="500":/light/i.test(u)&&(R="200"),x=t.tinySDF=new Y.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:y,fontWeight:R})}const I=x.draw(String.fromCharCode(p));return{id:p,bitmap:new n.AlphaImage({width:I.width||30,height:I.height||30},I.data),metrics:{width:I.glyphWidth||24,height:I.glyphHeight||24,left:I.glyphLeft||0,top:I.glyphTop-27||-8,advance:I.glyphAdvance||24}}}}Y.loadGlyphRange=function(g,t,u,p,y){const x=256*t,I=x+255,R=p.transformRequest(u.replace("{fontstack}",g).replace("{range}",`${x}-${I}`),n.ResourceType.Glyphs);n.getArrayBuffer(R,(O,V)=>{if(O)y(O);else if(V){const G={};for(const K of n.parseGlyphPbf(V))G[K.id]=K;y(null,G)}})},Y.TinySDF=class{constructor({fontSize:g=24,buffer:t=3,radius:u=8,cutoff:p=.25,fontFamily:y="sans-serif",fontWeight:x="normal",fontStyle:I="normal"}={}){this.buffer=t,this.cutoff=p,this.radius=u;const R=this.size=g+4*t,O=this._createCanvas(R),V=this.ctx=O.getContext("2d",{willReadFrequently:!0});V.font=`${I} ${x} ${g}px ${y}`,V.textBaseline="alphabetic",V.textAlign="left",V.fillStyle="black",this.gridOuter=new Float64Array(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Uint16Array(R)}_createCanvas(g){const t=document.createElement("canvas");return t.width=t.height=g,t}draw(g){const{width:t,actualBoundingBoxAscent:u,actualBoundingBoxDescent:p,actualBoundingBoxLeft:y,actualBoundingBoxRight:x}=this.ctx.measureText(g),I=Math.ceil(u),R=Math.min(this.size-this.buffer,Math.ceil(x-y)),O=Math.min(this.size-this.buffer,I+Math.ceil(p)),V=R+2*this.buffer,G=O+2*this.buffer,K=Math.max(V*G,0),ie=new Uint8ClampedArray(K),me={data:ie,width:V,height:G,glyphWidth:R,glyphHeight:O,glyphTop:I,glyphLeft:0,glyphAdvance:t};if(R===0||O===0)return me;const{ctx:fe,buffer:de,gridInner:ze,gridOuter:De}=this;fe.clearRect(de,de,R,O),fe.fillText(g,de,de+I);const Ve=fe.getImageData(de,de,R,O);De.fill(B,0,K),ze.fill(0,0,K);for(let xe=0;xe0?lt*lt:0,ze[at]=lt<0?lt*lt:0}}$(De,0,0,V,G,V,this.f,this.v,this.z),$(ze,de,de,R,O,V,this.f,this.v,this.z);for(let xe=0;xe1&&(O=t[++R]);const G=Math.abs(V-O.left),K=Math.abs(V-O.right),ie=Math.min(G,K);let me;const fe=x/p*(y+1);if(O.isDash){const de=y-Math.abs(fe);me=Math.sqrt(ie*ie+de*de)}else me=y-Math.sqrt(ie*ie+fe*fe);this.data[I+V]=Math.max(0,Math.min(255,me+128))}}}addRegularDash(t){for(let R=t.length-1;R>=0;--R){const O=t[R],V=t[R+1];O.zeroLength?t.splice(R,1):V&&V.isDash===O.isDash&&(V.left=O.left,t.splice(R,1))}const u=t[0],p=t[t.length-1];u.isDash===p.isDash&&(u.left=p.left-this.width,p.right=u.right+this.width);const y=this.width*this.nextRow;let x=0,I=t[x];for(let R=0;R1&&(I=t[++x]);const O=Math.abs(R-I.left),V=Math.abs(R-I.right),G=Math.min(O,V);this.data[y+R]=Math.max(0,Math.min(255,(I.isDash?G:-G)+128))}}addDash(t,u){const p=u?7:0,y=2*p+1;if(this.nextRow+y>this.height)return n.warnOnce("LineAtlas out of space"),null;let x=0;for(let R=0;R{y.send(t,u,x)},p=p||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function _t(g,t,u){const p=function(y,x){if(y)return u(y);if(x){const I=n.pick(n.extend(x,g),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);x.vector_layers&&(I.vectorLayers=x.vector_layers,I.vectorLayerIds=I.vectorLayers.map(R=>R.id)),u(null,I)}};return g.url?n.getJSON(t.transformRequest(g.url,n.ResourceType.Source),p):n.exported.frame(()=>p(null,g))}Ae.Actor=n.Actor;class le{constructor(t,u,p){this.bounds=n.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=u||0,this.maxzoom=p||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const u=Math.pow(2,t.z),p=Math.floor(n.mercatorXfromLng(this.bounds.getWest())*u),y=Math.floor(n.mercatorYfromLat(this.bounds.getNorth())*u),x=Math.ceil(n.mercatorXfromLng(this.bounds.getEast())*u),I=Math.ceil(n.mercatorYfromLat(this.bounds.getSouth())*u);return t.x>=p&&t.x=y&&t.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new n.ErrorEvent(t)):u&&(n.extend(this,u),u.bounds&&(this.tileBounds=new le(u.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return n.extend({},this._options)}loadTile(t,u){const p=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),y={request:this.map._requestManager.transformRequest(p,n.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function x(I,R){return delete t.request,t.aborted?u(null):I&&I.status!==404?u(I):(R&&R.resourceTiming&&(t.resourceTiming=R.resourceTiming),this.map._refreshExpiredTiles&&R&&t.setExpiryData(R),t.loadVectorData(R,this.map.painter),n.cacheEntryPossiblyAdded(this.dispatcher),u(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}y.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=u:t.request=t.actor.send("reloadTile",y,x.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",y,x.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Z extends n.Evented{constructor(t,u,p,y){super(),this.id=t,this.dispatcher=p,this.setEventedParent(y),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=n.extend({type:"raster"},u),n.extend(this,n.pick(u,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=_t(this._options,this.map._requestManager,(t,u)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new n.ErrorEvent(t)):u&&(n.extend(this,u),u.bounds&&(this.tileBounds=new le(u.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return n.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,u){const p=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=n.getImage(this.map._requestManager.transformRequest(p,n.ResourceType.Tile),(y,x,I)=>{if(delete t.request,t.aborted)t.state="unloaded",u(null);else if(y)t.state="errored",u(y);else if(x){this.map._refreshExpiredTiles&&t.setExpiryData(I);const R=this.map.painter.context,O=R.gl;t.texture=this.map.painter.getTileTexture(x.width),t.texture?t.texture.update(x,{useMipmap:!0}):(t.texture=new T(R,x,O.RGBA,{useMipmap:!0}),t.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),R.extTextureFilterAnisotropic&&O.texParameterf(O.TEXTURE_2D,R.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,R.extTextureFilterAnisotropicMax)),t.state="loaded",n.cacheEntryPossiblyAdded(this.dispatcher),u(null)}})}abortTile(t,u){t.request&&(t.request.cancel(),delete t.request),u()}unloadTile(t,u){t.texture&&this.map.painter.saveTileTexture(t.texture),u()}hasTransition(){return!1}}let $e;class ct extends Z{constructor(t,u,p,y){super(t,u,p,y),this.type="raster-dem",this.maxzoom=22,this._options=n.extend({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,u){const p=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function y(x,I){x&&(t.state="errored",u(x)),I&&(t.dem=I,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",u(null))}t.request=n.getImage(this.map._requestManager.transformRequest(p,n.ResourceType.Tile),(function(x,I){if(delete t.request,t.aborted)t.state="unloaded",u(null);else if(x)t.state="errored",u(x);else if(I){this.map._refreshExpiredTiles&&t.setExpiryData(I),delete I.cacheControl,delete I.expires;const R=n.isImageBitmap(I)&&($e==null&&($e=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),$e)?I:n.exported.getImageData(I,1),O={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:R,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",O,y.bind(this)))}}).bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const u=t.canonical,p=Math.pow(2,u.z),y=(u.x-1+p)%p,x=u.x===0?t.wrap-1:t.wrap,I=(u.x+1+p)%p,R=u.x+1===p?t.wrap+1:t.wrap,O={};return O[new n.OverscaledTileID(t.overscaledZ,x,u.z,y,u.y).key]={backfilled:!1},O[new n.OverscaledTileID(t.overscaledZ,R,u.z,I,u.y).key]={backfilled:!1},u.y>0&&(O[new n.OverscaledTileID(t.overscaledZ,x,u.z,y,u.y-1).key]={backfilled:!1},O[new n.OverscaledTileID(t.overscaledZ,t.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},O[new n.OverscaledTileID(t.overscaledZ,R,u.z,I,u.y-1).key]={backfilled:!1}),u.y+1{if(this._pendingLoads--,this._removed||x&&x.abandoned)return void this.fire(new n.Event("dataabort",{dataType:"source",sourceDataType:t}));let I=null;if(x&&x.resourceTiming&&x.resourceTiming[this.id]&&(I=x.resourceTiming[this.id].slice(0)),y)return void this.fire(new n.ErrorEvent(y));const R={dataType:"source",sourceDataType:t};this._collectResourceTiming&&I&&I.length>0&&n.extend(R,{resourceTiming:I}),this.fire(new n.Event("data",R))})}loaded(){return this._pendingLoads===0}loadTile(t,u){const p=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const y={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(p,y,(x,I)=>(delete t.request,t.unloadVectorData(),t.aborted?u(null):x?u(x):(t.loadVectorData(I,this.map.painter,p==="reloadTile"),u(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return n.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var $t=n.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class it extends n.Evented{constructor(t,u,p,y){super(),this.id=t,this.dispatcher=p,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(y),this.options=u}load(t,u){this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this.url=this.options.url,n.getImage(this.map._requestManager.transformRequest(this.url,n.ResourceType.Image),(p,y)=>{this._loaded=!0,p?this.fire(new n.ErrorEvent(p)):y&&(this.image=y,t&&(this.coordinates=t),u&&u(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const u=t.map(n.MercatorCoordinate.fromLngLat);this.tileID=function(y){let x=1/0,I=1/0,R=-1/0,O=-1/0;for(const ie of y)x=Math.min(x,ie.x),I=Math.min(I,ie.y),R=Math.max(R,ie.x),O=Math.max(O,ie.y);const V=Math.max(R-x,O-I),G=Math.max(0,Math.floor(-Math.log(V)/Math.LN2)),K=Math.pow(2,G);return new n.CanonicalTileID(G,Math.floor((x+R)/2*K),Math.floor((I+O)/2*K))}(u),this.minzoom=this.maxzoom=this.tileID.z;const p=u.map(y=>this.tileID.getTilePoint(y)._round());return this._boundsArray=new n.RasterBoundsArray,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,n.EXTENT,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,n.EXTENT),this._boundsArray.emplaceBack(p[2].x,p[2].y,n.EXTENT,n.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,u=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,$t.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new T(t,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));for(const p in this.tiles){const y=this.tiles[p];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture)}}loadTile(t,u){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},u(null)):(t.state="errored",u(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class et extends it{constructor(t,u,p,y){super(t,u,p,y),this.roundZoom=!0,this.type="video",this.options=u}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const u of t.urls)this.urls.push(this.map._requestManager.transformRequest(u,n.ResourceType.Source).url);n.getVideo(this.urls,(u,p)=>{this._loaded=!0,u?this.fire(new n.ErrorEvent(u)):p&&(this.video=p,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const u=this.video.seekable;tu.end(0)?this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,u=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,$t.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new T(t,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));for(const p in this.tiles){const y=this.tiles[p];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class oe extends it{constructor(t,u,p,y){super(t,u,p,y),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(x=>!Array.isArray(x)||x.length!==2||x.some(I=>typeof I!="number"))||this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new n.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,p=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,$t.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new T(u,this.canvas,p.RGBA,{premultiply:!0});for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const ge={vector:We,raster:Z,"raster-dem":ct,geojson:rt,video:et,image:it,canvas:oe};function Me(g,t){const u=n.create();return n.translate(u,u,[1,1,0]),n.scale(u,u,[.5*g.width,.5*g.height,1]),n.multiply(u,u,g.calculatePosMatrix(t.toUnwrapped()))}function ee(g,t,u,p,y,x){const I=function(K,ie,me){if(K)for(const fe of K){const de=ie[fe];if(de&&de.source===me&&de.type==="fill-extrusion")return!0}else for(const fe in ie){const de=ie[fe];if(de.source===me&&de.type==="fill-extrusion")return!0}return!1}(y&&y.layers,t,g.id),R=x.maxPitchScaleFactor(),O=g.tilesIn(p,R,I);O.sort(ue);const V=[];for(const K of O)V.push({wrappedTileID:K.tileID.wrapped().key,queryResults:K.tile.queryRenderedFeatures(t,u,g._state,K.queryGeometry,K.cameraQueryGeometry,K.scale,y,x,R,Me(g.transform,K.tileID))});const G=function(K){const ie={},me={};for(const fe of K){const de=fe.queryResults,ze=fe.wrappedTileID,De=me[ze]=me[ze]||{};for(const Ve in de){const xe=de[Ve],Ye=De[Ve]=De[Ve]||{},Ze=ie[Ve]=ie[Ve]||[];for(const at of xe)Ye[at.featureIndex]||(Ye[at.featureIndex]=!0,Ze.push(at))}}return ie}(V);for(const K in G)G[K].forEach(ie=>{const me=ie.feature,fe=g.getFeatureState(me.layer["source-layer"],me.id);me.source=me.layer.source,me.layer["source-layer"]&&(me.sourceLayer=me.layer["source-layer"]),me.state=fe});return G}function ue(g,t){const u=g.tileID,p=t.tileID;return u.overscaledZ-p.overscaledZ||u.canonical.y-p.canonical.y||u.wrap-p.wrap||u.canonical.x-p.canonical.x}class Je{constructor(t,u){this.tileID=t,this.uid=n.uniqueId(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const u=t+this.timeAdded;ut.saveTileTexture(u)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,u,p){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(y,x){const I={};if(!x)return I;for(const R of y){const O=R.layerIds.map(V=>x.getLayer(V)).filter(Boolean);if(O.length!==0){R.layers=O,R.stateDependentLayerIds&&(R.stateDependentLayers=R.stateDependentLayerIds.map(V=>O.filter(G=>G.id===V)[0]));for(const V of O)I[V.id]=R}}return I}(t.buckets,u.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof n.SymbolBucket){if(this.hasSymbolBuckets=!0,!p)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof n.SymbolBucket&&x.hasRTLText){this.hasRTLText=!0,n.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(y).queryRadius(x))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new n.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const p in this.buckets){const y=this.buckets[p];y.uploadPending()&&y.upload(t)}const u=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new T(t,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new T(t,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,u,p,y,x,I,R,O,V,G){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:y,cameraQueryGeometry:x,scale:I,tileSize:this.tileSize,pixelPosMatrix:G,transform:O,params:R,queryPadding:this.queryPadding*V},t,u,p):{}}querySourceFeatures(t,u){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const y=p.loadVTLayers(),x=u?u.sourceLayer:"",I=y._geojsonTileLayer||y[x];if(!I)return;const R=n.createFilter(u&&u.filter),{z:O,x:V,y:G}=this.tileID.canonical,K={z:O,x:V,y:G};for(let ie=0;iep)y=!1;else if(u)if(this.expirationTime{this.remove(t,x)},p)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const u=this.data[t].shift();return u.timeout&&clearTimeout(u.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),u.value}getByKey(t){const u=this.data[t];return u?u[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,u){if(!this.has(t))return this;const p=t.wrapped().key,y=u===void 0?0:this.data[p].indexOf(u),x=this.data[p][y];return this.data[p].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(x.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(t){const u=[];for(const p in this.data)for(const y of this.data[p])t(y.value)||u.push(y);for(const p of u)this.remove(p.value.tileID,p)}}class pt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,u,p){const y=String(u);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][y]=this.stateChanges[t][y]||{},n.extend(this.stateChanges[t][y],p),this.deletedStates[t]===null){this.deletedStates[t]={};for(const x in this.state[t])x!==y&&(this.deletedStates[t][x]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][y]===null){this.deletedStates[t][y]={};for(const x in this.state[t][y])p[x]||(this.deletedStates[t][y][x]=null)}else for(const x in p)this.deletedStates[t]&&this.deletedStates[t][y]&&this.deletedStates[t][y][x]===null&&delete this.deletedStates[t][y][x]}removeFeatureState(t,u,p){if(this.deletedStates[t]===null)return;const y=String(u);if(this.deletedStates[t]=this.deletedStates[t]||{},p&&u!==void 0)this.deletedStates[t][y]!==null&&(this.deletedStates[t][y]=this.deletedStates[t][y]||{},this.deletedStates[t][y][p]=null);else if(u!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][y])for(p in this.deletedStates[t][y]={},this.stateChanges[t][y])this.deletedStates[t][y][p]=null;else this.deletedStates[t][y]=null;else this.deletedStates[t]=null}getState(t,u){const p=String(u),y=n.extend({},(this.state[t]||{})[p],(this.stateChanges[t]||{})[p]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const x=this.deletedStates[t][u];if(x===null)return{};for(const I in x)delete y[I]}return y}initializeTileState(t,u){t.setFeatureState(this.state,u)}coalesceChanges(t,u){const p={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const I in this.stateChanges[y])this.state[y][I]||(this.state[y][I]={}),n.extend(this.state[y][I],this.stateChanges[y][I]),x[I]=this.state[y][I];p[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const I in this.state[y])x[I]={},this.state[y][I]={};else for(const I in this.deletedStates[y]){if(this.deletedStates[y][I]===null)this.state[y][I]={};else for(const R of Object.keys(this.deletedStates[y][I]))delete this.state[y][I][R];x[I]=this.state[y][I]}p[y]=p[y]||{},n.extend(p[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const y in t)t[y].setFeatureState(p,u)}}class Xe extends n.Evented{constructor(t,u,p){super(),this.id=t,this.dispatcher=p,this.on("data",y=>{y.dataType==="source"&&y.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&y.dataType==="source"&&y.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(y,x,I,R){const O=new ge[x.type](y,x,I,R);if(O.id!==y)throw new Error(`Expected Source id to be ${y} instead of ${O.id}`);return n.bindAll(["load","abort","unload","serialize","prepare"],O),O}(t,u,p,this),this._tiles={},this._cache=new wt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new pt}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const u=this._tiles[t];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,u){return this._source.loadTile(t,u)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new n.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const p=this._tiles[u];p.upload(t),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Bt).map(t=>t.key)}getRenderableIds(t){const u=[];for(const p in this._tiles)this._isIdRenderable(p,t)&&u.push(this._tiles[p]);return t?u.sort((p,y)=>{const x=p.tileID,I=y.tileID,R=new n.pointGeometry(x.canonical.x,x.canonical.y)._rotate(this.transform.angle),O=new n.pointGeometry(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return x.overscaledZ-I.overscaledZ||O.y-R.y||O.x-R.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Bt).map(p=>p.key)}hasRenderableParent(t){const u=this.findLoadedParent(t,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(t,u){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(u||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,u){const p=this._tiles[t];p&&(p.state!=="loading"&&(p.state=u),this._loadTile(p,this._tileLoaded.bind(this,p,t,u)))}_tileLoaded(t,u,p,y){if(y)return t.state="errored",void(y.status!==404?this._source.fire(new n.ErrorEvent(y,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=n.exported.now(),p==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(u,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new n.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const u=this.getRenderableIds();for(let y=0;y1||(Math.abs(I)>1&&(Math.abs(I+O)===1?I+=O:Math.abs(I-O)===1&&(I-=O)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,I,R),y.neighboringTiles&&y.neighboringTiles[V]&&(y.neighboringTiles[V].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,u,p,y){for(const x in this._tiles){let I=this._tiles[x];if(y[x]||!I.hasData()||I.tileID.overscaledZ<=u||I.tileID.overscaledZ>p)continue;let R=I.tileID;for(;I&&I.tileID.overscaledZ>u+1;){const V=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[V.key],I&&I.hasData()&&(R=V)}let O=R;for(;O.overscaledZ>u;)if(O=O.scaledTo(O.overscaledZ-1),t[O.key]){y[R.key]=R;break}}}findLoadedParent(t,u){if(t.key in this._loadedParentTiles){const p=this._loadedParentTiles[t.key];return p&&p.tileID.overscaledZ>=u?p:null}for(let p=t.overscaledZ-1;p>=u;p--){const y=t.scaledTo(p),x=this._getLoadedTile(y);if(x)return x}}_getLoadedTile(t){const u=this._tiles[t.key];return u&&u.hasData()?u:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const u=Math.ceil(t.width/this._source.tileSize)+1,p=Math.ceil(t.height/this._source.tileSize)+1,y=Math.floor(u*p*5),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(t){const u=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,u){const p={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+u),p[x.tileID.key]=x}this._tiles=p;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(y,this._tiles[y])}}update(t,u){if(this.transform=t,this.terrain=u,!this._sourceLoaded||this._paused)return;let p;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new n.OverscaledTileID(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(p=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:u}),this._source.hasTile&&(p=p.filter(V=>this._source.hasTile(V)))):p=[];const y=t.coveringZoomLevel(this._source),x=Math.max(y-Xe.maxOverzooming,this._source.minzoom),I=Math.max(y+Xe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const G of p)if(G.canonical.z>this._source.minzoom){const K=G.scaledTo(G.canonical.z-1);V[K.key]=K;const ie=G.scaledTo(Math.max(this._source.minzoom,Math.min(G.canonical.z,5)));V[ie.key]=ie}p=p.concat(Object.values(V))}const R=this._updateRetainedTiles(p,y);if(Qt(this._source.type)){const V={},G={},K=Object.keys(R);for(const ie of K){const me=R[ie],fe=this._tiles[ie];if(!fe||fe.fadeEndTime&&fe.fadeEndTime<=n.exported.now())continue;const de=this.findLoadedParent(me,x);de&&(this._addTile(de.tileID),V[de.tileID.key]=de.tileID),G[ie]=me}this._retainLoadedChildren(G,y,I,R);for(const ie in V)R[ie]||(this._coveredTiles[ie]=!0,R[ie]=V[ie]);if(u){const ie={},me={};for(const fe of p)this._tiles[fe.key].hasData()?ie[fe.key]=fe:me[fe.key]=fe;for(const fe in me){const de=me[fe].children(this._source.maxzoom);this._tiles[de[0].key]&&this._tiles[de[1].key]&&this._tiles[de[2].key]&&this._tiles[de[3].key]&&(ie[de[0].key]=R[de[0].key]=de[0],ie[de[1].key]=R[de[1].key]=de[1],ie[de[2].key]=R[de[2].key]=de[2],ie[de[3].key]=R[de[3].key]=de[3],delete me[fe])}for(const fe in me){const de=this.findLoadedParent(me[fe],this._source.minzoom);if(de){ie[de.tileID.key]=R[de.tileID.key]=de.tileID;for(const ze in ie)ie[ze].isChildOf(de.tileID)&&delete ie[ze]}}for(const fe in this._tiles)ie[fe]||(this._coveredTiles[fe]=!0)}}for(const V in R)this._tiles[V].clearFadeHold();const O=n.keysDifference(this._tiles,R);for(const V of O){const G=this._tiles[V];G.hasSymbolBuckets&&!G.holdingForFade()?G.setHoldDuration(this.map._fadeDuration):G.hasSymbolBuckets&&!G.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,u){const p={},y={},x=Math.max(u-Xe.maxOverzooming,this._source.minzoom),I=Math.max(u+Xe.maxUnderzooming,this._source.minzoom),R={};for(const O of t){const V=this._addTile(O);p[O.key]=O,V.hasData()||uthis._source.maxzoom){const K=O.children(this._source.maxzoom)[0],ie=this.getTile(K);if(ie&&ie.hasData()){p[K.key]=K;continue}}else{const K=O.children(this._source.maxzoom);if(p[K[0].key]&&p[K[1].key]&&p[K[2].key]&&p[K[3].key])continue}let G=V.wasRequested();for(let K=O.overscaledZ-1;K>=x;--K){const ie=O.scaledTo(K);if(y[ie.key]||(y[ie.key]=!0,V=this.getTile(ie),!V&&G&&(V=this._addTile(ie)),V&&(p[ie.key]=ie,G=V.wasRequested(),V.hasData())))break}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const u=[];let p,y=this._tiles[t].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){p=this._loadedParentTiles[y.key];break}u.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(p=this._getLoadedTile(x),p)break;y=x}for(const x of u)this._loadedParentTiles[x]=p}}_addTile(t){let u=this._tiles[t.key];if(u)return u;u=this._cache.getAndRemove(t),u&&(this._setTileReloadTimer(t.key,u),u.tileID=t,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,u)));const p=u;return u||(u=new Je(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(u,this._tileLoaded.bind(this,u,t.key,u.state))),u.uses++,this._tiles[t.key]=u,p||this._source.fire(new n.Event("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(t,u){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const p=u.getExpiryTimeout();p&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},p))}_removeTile(t){const u=this._tiles[t];u&&(u.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,u,p){const y=[],x=this.transform;if(!x)return y;const I=p?x.getCameraQueryGeometry(t):t,R=t.map(fe=>x.pointCoordinate(fe,this.terrain)),O=I.map(fe=>x.pointCoordinate(fe,this.terrain)),V=this.getIds();let G=1/0,K=1/0,ie=-1/0,me=-1/0;for(const fe of O)G=Math.min(G,fe.x),K=Math.min(K,fe.y),ie=Math.max(ie,fe.x),me=Math.max(me,fe.y);for(let fe=0;fe=0&&xe[1].y+Ve>=0){const Ye=R.map(at=>ze.getTilePoint(at)),Ze=O.map(at=>ze.getTilePoint(at));y.push({tile:de,tileID:ze,queryGeometry:Ye,cameraQueryGeometry:Ze,scale:De})}}return y}getVisibleCoordinates(t){const u=this.getRenderableIds(t).map(p=>this._tiles[p].tileID);for(const p of u)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(Qt(this._source.type))for(const t in this._tiles){const u=this._tiles[t];if(u.fadeEndTime!==void 0&&u.fadeEndTime>=n.exported.now())return!0}return!1}setFeatureState(t,u,p){this._state.updateState(t=t||"_geojsonTileLayer",u,p)}removeFeatureState(t,u,p){this._state.removeFeatureState(t=t||"_geojsonTileLayer",u,p)}getFeatureState(t,u){return this._state.getState(t=t||"_geojsonTileLayer",u)}setDependencies(t,u,p){const y=this._tiles[t];y&&y.setDependencies(u,p)}reloadTilesForDependencies(t,u){for(const p in this._tiles)this._tiles[p].hasDependency(t,u)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(t,u))}}function Bt(g,t){const u=Math.abs(2*g.wrap)-+(g.wrap<0),p=Math.abs(2*t.wrap)-+(t.wrap<0);return g.overscaledZ-t.overscaledZ||p-u||t.canonical.y-g.canonical.y||t.canonical.x-g.canonical.x}function Qt(g){return g==="raster"||g==="image"||g==="video"}Xe.maxOverzooming=10,Xe.maxUnderzooming=3;const Rr="mapboxgl_preloaded_worker_pool";class Vr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Rr]}numActive(){return Object.keys(this.active).length}}const H=Math.floor(n.exported.hardwareConcurrency/2);let ut;function tt(){return ut||(ut=new Vr),ut}function be(g,t){const u={};for(const p in g)p!=="ref"&&(u[p]=g[p]);return n.refProperties.forEach(p=>{p in t&&(u[p]=t[p])}),u}function pe(g){g=g.slice();const t=Object.create(null);for(let u=0;u0?(y-I)/R:0;return this.points[x].mult(1-O).add(this.points[u].mult(O))}}function Fe(g,t){let u=!0;return g==="always"||g!=="never"&&t!=="never"||(u=!1),u}class gt{constructor(t,u,p){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(t/p),this.yCellCount=Math.ceil(u/p);for(let I=0;Ithis.width||y<0||u>this.height)return[];const O=[];if(t<=0&&u<=0&&this.width<=p&&this.height<=y){if(x)return[{key:null,x1:t,y1:u,x2:p,y2:y}];for(let V=0;V0}hitTestCircle(t,u,p,y,x){const I=t-p,R=t+p,O=u-p,V=u+p;if(R<0||I>this.width||V<0||O>this.height)return!1;const G=[];return this._forEachCell(I,O,R,V,this._queryCellCircle,G,{hitTest:!0,overlapMode:y,circle:{x:t,y:u,radius:p},seenUids:{box:{},circle:{}}},x),G.length>0}_queryCell(t,u,p,y,x,I,R,O){const{seenUids:V,hitTest:G,overlapMode:K}=R,ie=this.boxCells[x];if(ie!==null){const fe=this.bboxes;for(const de of ie)if(!V.box[de]){V.box[de]=!0;const ze=4*de,De=this.boxKeys[de];if(t<=fe[ze+2]&&u<=fe[ze+3]&&p>=fe[ze+0]&&y>=fe[ze+1]&&(!O||O(De))&&(!G||!Fe(K,De.overlapMode))&&(I.push({key:De,x1:fe[ze],y1:fe[ze+1],x2:fe[ze+2],y2:fe[ze+3]}),G))return!0}}const me=this.circleCells[x];if(me!==null){const fe=this.circles;for(const de of me)if(!V.circle[de]){V.circle[de]=!0;const ze=3*de,De=this.circleKeys[de];if(this._circleAndRectCollide(fe[ze],fe[ze+1],fe[ze+2],t,u,p,y)&&(!O||O(De))&&(!G||!Fe(K,De.overlapMode))){const Ve=fe[ze],xe=fe[ze+1],Ye=fe[ze+2];if(I.push({key:De,x1:Ve-Ye,y1:xe-Ye,x2:Ve+Ye,y2:xe+Ye}),G)return!0}}}return!1}_queryCellCircle(t,u,p,y,x,I,R,O){const{circle:V,seenUids:G,overlapMode:K}=R,ie=this.boxCells[x];if(ie!==null){const fe=this.bboxes;for(const de of ie)if(!G.box[de]){G.box[de]=!0;const ze=4*de,De=this.boxKeys[de];if(this._circleAndRectCollide(V.x,V.y,V.radius,fe[ze+0],fe[ze+1],fe[ze+2],fe[ze+3])&&(!O||O(De))&&!Fe(K,De.overlapMode))return I.push(!0),!0}}const me=this.circleCells[x];if(me!==null){const fe=this.circles;for(const de of me)if(!G.circle[de]){G.circle[de]=!0;const ze=3*de,De=this.circleKeys[de];if(this._circlesCollide(fe[ze],fe[ze+1],fe[ze+2],V.x,V.y,V.radius)&&(!O||O(De))&&!Fe(K,De.overlapMode))return I.push(!0),!0}}}_forEachCell(t,u,p,y,x,I,R,O){const V=this._convertToXCellCoord(t),G=this._convertToYCellCoord(u),K=this._convertToXCellCoord(p),ie=this._convertToYCellCoord(y);for(let me=V;me<=K;me++)for(let fe=G;fe<=ie;fe++)if(x.call(this,t,u,p,y,this.xCellCount*fe+me,I,R,O))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,u,p,y,x,I){const R=y-t,O=x-u,V=p+I;return V*V>R*R+O*O}_circleAndRectCollide(t,u,p,y,x,I,R){const O=(I-y)/2,V=Math.abs(t-(y+O));if(V>O+p)return!1;const G=(R-x)/2,K=Math.abs(u-(x+G));if(K>G+p)return!1;if(V<=O||K<=G)return!0;const ie=V-O,me=K-G;return ie*ie+me*me<=p*p}}function mi(g,t,u,p,y){const x=n.create();return t?(n.scale(x,x,[1/y,1/y,1]),u||n.rotateZ(x,x,p.angle)):n.multiply(x,p.labelPlaneMatrix,g),x}function ri(g,t,u,p,y){if(t){const x=n.clone(g);return n.scale(x,x,[y,y,1]),u||n.rotateZ(x,x,-p.angle),x}return p.glCoordMatrix}function yr(g,t,u){let p;u?(p=[g.x,g.y,u(g.x,g.y),1],n.transformMat4(p,p,t)):(p=[g.x,g.y,0,1],Vi(p,p,t));const y=p[3];return{point:new n.pointGeometry(p[0]/y,p[1]/y),signedDistanceFromCamera:y}}function Sr(g,t){return .5+g/t*.5}function gi(g,t){const u=g[0]/g[3],p=g[1]/g[3];return u>=-t[0]&&u<=t[0]&&p>=-t[1]&&p<=t[1]}function Ei(g,t,u,p,y,x,I,R,O,V){const G=p?g.textSizeData:g.iconSizeData,K=n.evaluateSizeForZoom(G,u.transform.zoom),ie=[256/u.width*2+1,256/u.height*2+1],me=p?g.text.dynamicLayoutVertexArray:g.icon.dynamicLayoutVertexArray;me.clear();const fe=g.lineVertexArray,de=p?g.text.placedSymbolArray:g.icon.placedSymbolArray,ze=u.transform.width/u.transform.height;let De=!1;for(let Ve=0;VeMath.abs(u.x-t.x)*p?{useVertical:!0}:(g===n.WritingMode.vertical?t.yu.x)?{needsFlipping:!0}:null}function pr(g,t,u,p,y,x,I,R,O,V,G,K,ie,me,fe,de){const ze=t/24,De=g.lineOffsetX*ze,Ve=g.lineOffsetY*ze;let xe;if(g.numGlyphs>1){const Ye=g.glyphStartIndex+g.numGlyphs,Ze=g.lineStartIndex,at=g.lineStartIndex+g.lineLength,lt=_i(ze,R,De,Ve,u,G,K,g,O,x,ie,fe,de);if(!lt)return{notEnoughRoom:!0};const yt=yr(lt.first.point,I,de).point,st=yr(lt.last.point,I,de).point;if(p&&!u){const Vt=Tt(g.writingMode,yt,st,me);if(Vt)return Vt}xe=[lt.first];for(let Vt=g.glyphStartIndex+1;Vt0?yt.point:hr(K,lt,Ze,1,y,de),Vt=Tt(g.writingMode,Ze,st,me);if(Vt)return Vt}const Ye=yi(ze*R.getoffsetX(g.glyphStartIndex),De,Ve,u,G,K,g.segment,g.lineStartIndex,g.lineStartIndex+g.lineLength,O,x,ie,fe,de);if(!Ye)return{notEnoughRoom:!0};xe=[Ye]}for(const Ye of xe)n.addDynamicAttributes(V,Ye.point,Ye.angle);return{}}function hr(g,t,u,p,y,x){const I=yr(g.add(g.sub(t)._unit()),y,x).point,R=u.sub(I);return u.add(R._mult(p/R.mag()))}function yi(g,t,u,p,y,x,I,R,O,V,G,K,ie,me){const fe=p?g-t:g+t;let de=fe>0?1:-1,ze=0;p&&(de*=-1,ze=Math.PI),de<0&&(ze+=Math.PI);let De=de>0?R+I:R+I+1,Ve=y,xe=y,Ye=0,Ze=0;const at=Math.abs(fe),lt=[];for(;Ye+Ze<=at;){if(De+=de,De=O)return null;if(xe=Ve,lt.push(Ve),Ve=K[De],Ve===void 0){const jt=new n.pointGeometry(V.getx(De),V.gety(De)),gr=yr(jt,G,me);if(gr.signedDistanceFromCamera>0)Ve=K[De]=gr.point;else{const br=De-de;Ve=hr(Ye===0?x:new n.pointGeometry(V.getx(br),V.gety(br)),jt,xe,at-Ye+1,G,me)}}Ye+=Ze,Ze=xe.dist(Ve)}const yt=(at-Ye)/Ze,st=Ve.sub(xe),Vt=st.mult(yt)._add(xe);Vt._add(st._unit()._perp()._mult(u*de));const Dt=ze+Math.atan2(Ve.y-xe.y,Ve.x-xe.x);return lt.push(Vt),{point:Vt,angle:ie?Dt:0,path:lt}}const nn=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function ar(g,t){for(let u=0;u=1;Ar--)tr.push(gr.path[Ar]);for(let Ar=1;Aryr(Pr,O,fe));tr=Ar.some(Pr=>Pr.signedDistanceFromCamera<=0)?[]:Ar.map(Pr=>Pr.point)}let Gr=[];if(tr.length>0){const Ar=tr[0].clone(),Pr=tr[0].clone();for(let Hr=1;Hr=Vt.x&&Pr.x<=Dt.x&&Ar.y>=Vt.y&&Pr.y<=Dt.y?[tr]:Pr.xDt.x||Pr.yDt.y?[]:n.clipLine([tr],Vt.x,Vt.y,Dt.x,Dt.y)}for(const Ar of Gr){jt.reset(Ar,.25*st);let Pr=0;Pr=jt.length<=.5*st?1:Math.ceil(jt.paddedLength/qr)+1;for(let Hr=0;Hr=this.screenRightBoundary||ythis.screenBottomBoundary}isInsideGrid(t,u,p,y){return p>=0&&t=0&&up.collisionGroupID===u}}return this.collisionGroups[t]}}function $n(g,t,u,p,y){const{horizontalAlign:x,verticalAlign:I}=n.getAnchorAlignment(g),R=-(x-.5)*t,O=-(I-.5)*u,V=n.evaluateVariableOffset(g,p);return new n.pointGeometry(R+V[0]*y,O+V[1]*y)}function Ce(g,t,u,p,y,x){const{x1:I,x2:R,y1:O,y2:V,anchorPointX:G,anchorPointY:K}=g,ie=new n.pointGeometry(t,u);return p&&ie._rotate(y?x:-x),{x1:I+ie.x,y1:O+ie.y,x2:R+ie.x,y2:V+ie.y,anchorPointX:G,anchorPointY:K}}class N{constructor(t,u,p,y,x){this.transform=t.clone(),this.terrain=u,this.collisionIndex=new ss(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=p,this.retainedQueryData={},this.collisionGroups=new Vn(y),this.collisionCircleArrays={},this.prevPlacement=x,x&&(x.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,u,p,y){const x=p.getBucket(u),I=p.latestFeatureIndex;if(!x||!I||u.id!==x.layerIds[0])return;const R=p.collisionBoxArray,O=x.layers[0].layout,V=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),G=p.tileSize/n.EXTENT,K=this.transform.calculatePosMatrix(p.tileID.toUnwrapped()),ie=O.get("text-pitch-alignment")==="map",me=O.get("text-rotation-alignment")==="map",fe=ui(p,1,this.transform.zoom),de=mi(K,ie,me,this.transform,fe);let ze=null;if(ie){const Ve=ri(K,ie,me,this.transform,fe);ze=n.multiply([],this.transform.labelPlaneMatrix,Ve)}this.retainedQueryData[x.bucketInstanceId]=new zn(x.bucketInstanceId,I,x.sourceLayerIndex,x.index,p.tileID);const De={bucket:x,layout:O,posMatrix:K,textLabelPlaneMatrix:de,labelToScreenMatrix:ze,scale:V,textPixelRatio:G,holdingForFade:p.holdingForFade(),collisionBoxArray:R,partiallyEvaluatedTextSize:n.evaluateSizeForZoom(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(y)for(const Ve of x.sortKeyRanges){const{sortKey:xe,symbolInstanceStart:Ye,symbolInstanceEnd:Ze}=Ve;t.push({sortKey:xe,symbolInstanceStart:Ye,symbolInstanceEnd:Ze,parameters:De})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:De})}attemptAnchorPlacement(t,u,p,y,x,I,R,O,V,G,K,ie,me,fe,de,ze){const De=[ie.textOffset0,ie.textOffset1],Ve=$n(t,p,y,De,x),xe=this.collisionIndex.placeCollisionBox(Ce(u,Ve.x,Ve.y,I,R,this.transform.angle),K,O,V,G.predicate,ze);if((!de||this.collisionIndex.placeCollisionBox(Ce(de,Ve.x,Ve.y,I,R,this.transform.angle),K,O,V,G.predicate,ze).box.length!==0)&&xe.box.length>0){let Ye;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ie.crossTileID]&&this.prevPlacement.placements[ie.crossTileID]&&this.prevPlacement.placements[ie.crossTileID].text&&(Ye=this.prevPlacement.variableOffsets[ie.crossTileID].anchor),ie.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[ie.crossTileID]={textOffset:De,width:p,height:y,anchor:t,textBoxScale:x,prevAnchor:Ye},this.markUsedJustification(me,t,ie,fe),me.allowVerticalPlacement&&(this.markUsedOrientation(me,fe,ie),this.placedOrientations[ie.crossTileID]=fe),{shift:Ve,placedGlyphBoxes:xe}}}placeLayerBucketPart(t,u,p){const{bucket:y,layout:x,posMatrix:I,textLabelPlaneMatrix:R,labelToScreenMatrix:O,textPixelRatio:V,holdingForFade:G,collisionBoxArray:K,partiallyEvaluatedTextSize:ie,collisionGroup:me}=t.parameters,fe=x.get("text-optional"),de=x.get("icon-optional"),ze=n.getOverlapMode(x,"text-overlap","text-allow-overlap"),De=ze==="always",Ve=n.getOverlapMode(x,"icon-overlap","icon-allow-overlap"),xe=Ve==="always",Ye=x.get("text-rotation-alignment")==="map",Ze=x.get("text-pitch-alignment")==="map",at=x.get("icon-text-fit")!=="none",lt=x.get("symbol-z-order")==="viewport-y",yt=De&&(xe||!y.hasIconData()||de),st=xe&&(De||!y.hasTextData()||fe);!y.collisionArrays&&K&&y.deserializeCollisionBoxes(K);const Vt=(Dt,jt)=>{if(u[Dt.crossTileID])return;if(G)return void(this.placements[Dt.crossTileID]=new Un(!1,!1,!1));let gr=!1,br=!1,tr=!0,qr=null,Gr={box:null,offscreen:null},Ar={box:null,offscreen:null},Pr=null,Hr=null,Ci=null,Rn=0,kn=0,Ln=0;jt.textFeatureIndex?Rn=jt.textFeatureIndex:Dt.useRuntimeCollisionCircles&&(Rn=Dt.featureIndex),jt.verticalTextFeatureIndex&&(kn=jt.verticalTextFeatureIndex);const ms=this.retainedQueryData[y.bucketInstanceId].tileID,yn=this.terrain?(ki,Er)=>this.terrain.getElevation(ms,ki,Er):null;for(const ki of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const Er=jt[ki];Er&&(Er.elevation=yn?yn(Er.anchorPointX,Er.anchorPointY):0)}const Yi=jt.textBox;if(Yi){const ki=$r=>{let Ai=n.WritingMode.horizontal;if(y.allowVerticalPlacement&&!$r&&this.prevPlacement){const Pi=this.prevPlacement.placedOrientations[Dt.crossTileID];Pi&&(this.placedOrientations[Dt.crossTileID]=Pi,Ai=Pi,this.markUsedOrientation(y,Ai,Dt))}return Ai},Er=($r,Ai)=>{if(y.allowVerticalPlacement&&Dt.numVerticalGlyphVertices>0&&jt.verticalTextBox){for(const Pi of y.writingModes)if(Pi===n.WritingMode.vertical?(Gr=Ai(),Ar=Gr):Gr=$r(),Gr&&Gr.box&&Gr.box.length)break}else Gr=$r()};if(x.get("text-variable-anchor")){let $r=x.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Dt.crossTileID]){const oi=this.prevPlacement.variableOffsets[Dt.crossTileID];$r.indexOf(oi.anchor)>0&&($r=$r.filter(vn=>vn!==oi.anchor),$r.unshift(oi.anchor))}const Ai=(oi,vn,Is)=>{const wl=oi.x2-oi.x1,Js=oi.y2-oi.y1,Hc=Dt.textBoxScale,El=at&&Ve==="never"?vn:null;let gs={box:[],offscreen:!1};const Cs=ze!=="never"?2*$r.length:$r.length;for(let As=0;As=$r.length?ze:"never",Dt,y,Is,El,yn);if(_o&&(gs=_o.placedGlyphBoxes,gs&&gs.box&&gs.box.length)){gr=!0,qr=_o.shift;break}}return gs};Er(()=>Ai(Yi,jt.iconBox,n.WritingMode.horizontal),()=>{const oi=jt.verticalTextBox;return y.allowVerticalPlacement&&!(Gr&&Gr.box&&Gr.box.length)&&Dt.numVerticalGlyphVertices>0&&oi?Ai(oi,jt.verticalIconBox,n.WritingMode.vertical):{box:null,offscreen:null}}),Gr&&(gr=Gr.box,tr=Gr.offscreen);const Pi=ki(Gr&&Gr.box);if(!gr&&this.prevPlacement){const oi=this.prevPlacement.variableOffsets[Dt.crossTileID];oi&&(this.variableOffsets[Dt.crossTileID]=oi,this.markUsedJustification(y,oi.anchor,Dt,Pi))}}else{const $r=(Ai,Pi)=>{const oi=this.collisionIndex.placeCollisionBox(Ai,ze,V,I,me.predicate,yn);return oi&&oi.box&&oi.box.length&&(this.markUsedOrientation(y,Pi,Dt),this.placedOrientations[Dt.crossTileID]=Pi),oi};Er(()=>$r(Yi,n.WritingMode.horizontal),()=>{const Ai=jt.verticalTextBox;return y.allowVerticalPlacement&&Dt.numVerticalGlyphVertices>0&&Ai?$r(Ai,n.WritingMode.vertical):{box:null,offscreen:null}}),ki(Gr&&Gr.box&&Gr.box.length)}}if(Pr=Gr,gr=Pr&&Pr.box&&Pr.box.length>0,tr=Pr&&Pr.offscreen,Dt.useRuntimeCollisionCircles){const ki=y.text.placedSymbolArray.get(Dt.centerJustifiedTextSymbolIndex),Er=n.evaluateSizeForFeature(y.textSizeData,ie,ki),$r=x.get("text-padding");Hr=this.collisionIndex.placeCollisionCircles(ze,ki,y.lineVertexArray,y.glyphOffsetArray,Er,I,R,O,p,Ze,me.predicate,Dt.collisionCircleDiameter,$r,yn),Hr.circles.length&&Hr.collisionDetected&&!p&&n.warnOnce("Collisions detected, but collision boxes are not shown"),gr=De||Hr.circles.length>0&&!Hr.collisionDetected,tr=tr&&Hr.offscreen}if(jt.iconFeatureIndex&&(Ln=jt.iconFeatureIndex),jt.iconBox){const ki=Er=>{const $r=at&&qr?Ce(Er,qr.x,qr.y,Ye,Ze,this.transform.angle):Er;return this.collisionIndex.placeCollisionBox($r,Ve,V,I,me.predicate,yn)};Ar&&Ar.box&&Ar.box.length&&jt.verticalIconBox?(Ci=ki(jt.verticalIconBox),br=Ci.box.length>0):(Ci=ki(jt.iconBox),br=Ci.box.length>0),tr=tr&&Ci.offscreen}const Hn=fe||Dt.numHorizontalGlyphVertices===0&&Dt.numVerticalGlyphVertices===0,go=de||Dt.numIconVertices===0;if(Hn||go?go?Hn||(br=br&&gr):gr=br&&gr:br=gr=br&&gr,gr&&Pr&&Pr.box&&this.collisionIndex.insertCollisionBox(Pr.box,ze,x.get("text-ignore-placement"),y.bucketInstanceId,Ar&&Ar.box&&kn?kn:Rn,me.ID),br&&Ci&&this.collisionIndex.insertCollisionBox(Ci.box,Ve,x.get("icon-ignore-placement"),y.bucketInstanceId,Ln,me.ID),Hr&&(gr&&this.collisionIndex.insertCollisionCircles(Hr.circles,ze,x.get("text-ignore-placement"),y.bucketInstanceId,Rn,me.ID),p)){const ki=y.bucketInstanceId;let Er=this.collisionCircleArrays[ki];Er===void 0&&(Er=this.collisionCircleArrays[ki]=new gn);for(let $r=0;$r=0;--jt){const gr=Dt[jt];Vt(y.symbolInstances.get(gr),y.collisionArrays[gr])}}else for(let Dt=t.symbolInstanceStart;Dt=0&&(t.text.placedSymbolArray.get(R).crossTileID=x>=0&&R!==x?0:p.crossTileID)}markUsedOrientation(t,u,p){const y=u===n.WritingMode.horizontal||u===n.WritingMode.horizontalOnly?u:0,x=u===n.WritingMode.vertical?u:0,I=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const R of I)t.text.placedSymbolArray.get(R).placedOrientation=y;p.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let p=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const y=u?u.symbolFadeChange(t):1,x=u?u.opacities:{},I=u?u.variableOffsets:{},R=u?u.placedOrientations:{};for(const O in this.placements){const V=this.placements[O],G=x[O];G?(this.opacities[O]=new Lr(G,y,V.text,V.icon),p=p||V.text!==G.text.placed||V.icon!==G.icon.placed):(this.opacities[O]=new Lr(null,y,V.text,V.icon,V.skipFade),p=p||V.text||V.icon)}for(const O in x){const V=x[O];if(!this.opacities[O]){const G=new Lr(V,y,!1,!1);G.isHidden()||(this.opacities[O]=G,p=p||V.text.placed||V.icon.placed)}}for(const O in I)this.variableOffsets[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.variableOffsets[O]=I[O]);for(const O in R)this.placedOrientations[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.placedOrientations[O]=R[O]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:t)}updateLayerOpacities(t,u){const p={};for(const y of u){const x=y.getBucket(t);x&&y.latestFeatureIndex&&t.id===x.layerIds[0]&&this.updateBucketOpacities(x,p,y.collisionBoxArray)}}updateBucketOpacities(t,u,p){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const y=t.layers[0].layout,x=new Lr(null,0,!1,!1,!0),I=y.get("text-allow-overlap"),R=y.get("icon-allow-overlap"),O=y.get("text-variable-anchor"),V=y.get("text-rotation-alignment")==="map",G=y.get("text-pitch-alignment")==="map",K=y.get("icon-text-fit")!=="none",ie=new Lr(null,0,I&&(R||!t.hasIconData()||y.get("icon-optional")),R&&(I||!t.hasTextData()||y.get("text-optional")),!0);!t.collisionArrays&&p&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(p);const me=(fe,de,ze)=>{for(let De=0;De0,Ze=this.placedOrientations[de.crossTileID],at=Ze===n.WritingMode.vertical,lt=Ze===n.WritingMode.horizontal||Ze===n.WritingMode.horizontalOnly;if(ze>0||De>0){const yt=Te(xe.text);me(t.text,ze,at?Ge:yt),me(t.text,De,lt?Ge:yt);const st=xe.text.isHidden();[de.rightJustifiedTextSymbolIndex,de.centerJustifiedTextSymbolIndex,de.leftJustifiedTextSymbolIndex].forEach(jt=>{jt>=0&&(t.text.placedSymbolArray.get(jt).hidden=st||at?1:0)}),de.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(de.verticalPlacedTextSymbolIndex).hidden=st||lt?1:0);const Vt=this.variableOffsets[de.crossTileID];Vt&&this.markUsedJustification(t,Vt.anchor,de,Ze);const Dt=this.placedOrientations[de.crossTileID];Dt&&(this.markUsedJustification(t,"left",de,Dt),this.markUsedOrientation(t,Dt,de))}if(Ye){const yt=Te(xe.icon),st=!(K&&de.verticalPlacedIconSymbolIndex&&at);de.placedIconSymbolIndex>=0&&(me(t.icon,de.numIconVertices,st?yt:Ge),t.icon.placedSymbolArray.get(de.placedIconSymbolIndex).hidden=xe.icon.isHidden()),de.verticalPlacedIconSymbolIndex>=0&&(me(t.icon,de.numVerticalIconVertices,st?Ge:yt),t.icon.placedSymbolArray.get(de.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const yt=t.collisionArrays[fe];if(yt){let st=new n.pointGeometry(0,0);if(yt.textBox||yt.verticalTextBox){let Dt=!0;if(O){const jt=this.variableOffsets[Ve];jt?(st=$n(jt.anchor,jt.width,jt.height,jt.textOffset,jt.textBoxScale),V&&st._rotate(G?this.transform.angle:-this.transform.angle)):Dt=!1}yt.textBox&&z(t.textCollisionBox.collisionVertexArray,xe.text.placed,!Dt||at,st.x,st.y),yt.verticalTextBox&&z(t.textCollisionBox.collisionVertexArray,xe.text.placed,!Dt||lt,st.x,st.y)}const Vt=!!(!lt&&yt.verticalIconBox);yt.iconBox&&z(t.iconCollisionBox.collisionVertexArray,xe.icon.placed,Vt,K?st.x:0,K?st.y:0),yt.verticalIconBox&&z(t.iconCollisionBox.collisionVertexArray,xe.icon.placed,!Vt,K?st.x:0,K?st.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const fe=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=fe.invProjMatrix,t.placementViewportMatrix=fe.viewportMatrix,t.collisionCircleArray=fe.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function z(g,t,u,p,y){g.emplaceBack(t?1:0,u?1:0,p||0,y||0),g.emplaceBack(t?1:0,u?1:0,p||0,y||0),g.emplaceBack(t?1:0,u?1:0,p||0,y||0),g.emplaceBack(t?1:0,u?1:0,p||0,y||0)}const U=Math.pow(2,25),q=Math.pow(2,24),Q=Math.pow(2,17),he=Math.pow(2,16),Se=Math.pow(2,9),Ee=Math.pow(2,8),ve=Math.pow(2,1);function Te(g){if(g.opacity===0&&!g.placed)return 0;if(g.opacity===1&&g.placed)return 4294967295;const t=g.placed?1:0,u=Math.floor(127*g.opacity);return u*U+t*q+u*Q+t*he+u*Se+t*Ee+u*ve+t}const Ge=0;class ot{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,u,p,y,x){const I=this._bucketParts;for(;this._currentTileIndexR.sortKey-O.sortKey));this._currentPartIndex{const I=n.exported.now()-y;return!this._forceFullPlacement&&I>2};for(;this._currentPlacementIndex>=0;){const I=u[t[this._currentPlacementIndex]],R=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=R)&&(!I.maxzoom||I.maxzoom>R)){if(this._inProgressLayer||(this._inProgressLayer=new ot(I)),this._inProgressLayer.continuePlacement(p[I.source],this.placement,this._showCollisionBoxes,I,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ct=512/n.EXTENT/2;class Pt{constructor(t,u,p){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=p;for(let y=0;yt.overscaledZ)for(const R in I){const O=I[R];O.tileID.isChildOf(t)&&O.findMatches(u.symbolInstances,t,y)}else{const R=I[t.scaledTo(Number(x)).key];R&&R.findMatches(u.symbolInstances,t,y)}}for(let x=0;x{u[p]=!0});for(const p in this.layerIndexes)u[p]||delete this.layerIndexes[p]}}var mr=n.createLayout([{name:"a_pos",type:"Int16",components:2}]);class or extends n.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const u=this._tiles[t];u.textures.forEach(p=>p.destroy()),u.textures=[]}}update(t,u){this.sourceCache.update(t,u),this._renderableTilesKeys=[];for(const p of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.posMatrix=new Float64Array(16),n.ortho(p.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),this._tiles[p.key]=new Je(p,this.tileSize))}removeOutdated(t){const u={};this.renderHistory=this.renderHistory.filter((p,y)=>this.renderHistory.indexOf(p)===y).slice(0,this.renderHistorySize);for(const p of this._renderableTilesKeys)u[p]=!0;for(const p of this.renderHistory)u[p]=!0;for(const p in this._tiles)u[p]||(this._tiles[p].clearTextures(t),delete this._tiles[p])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const u={};for(const p of this._renderableTilesKeys){const y=this._tiles[p].tileID;if(y.canonical.equals(t.canonical)){const x=t.clone();x.posMatrix=new Float64Array(16),n.ortho(x.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),u[p]=x}else if(y.canonical.isChildOf(t.canonical)){const x=t.clone();x.posMatrix=new Float64Array(16);const I=y.canonical.z-t.canonical.z,R=y.canonical.x-(y.canonical.x>>I<>I<>I;n.ortho(x.posMatrix,0,V,0,V,0,1),n.translate(x.posMatrix,x.posMatrix,[-R*V,-O*V,0]),u[p]=x}else if(t.canonical.isChildOf(y.canonical)){const x=t.clone();x.posMatrix=new Float64Array(16);const I=t.canonical.z-y.canonical.z,R=t.canonical.x-(t.canonical.x>>I<>I<>I;n.ortho(x.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),n.translate(x.posMatrix,x.posMatrix,[R*V,O*V,0]),n.scale(x.posMatrix,x.posMatrix,[1/2**I,1/2**I,0]),u[p]=x}}return u}getSourceTile(t,u){const p=this.sourceCache._source;let y=t.overscaledZ-this.deltaZoom;if(y>p.maxzoom&&(y=p.maxzoom),y=p.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(t.scaledTo(y--).key);return x}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(u=>u.timeLoaded>=t)}}class fr{constructor(t,u,p){this.style=t,this.sourceCache=new or(u),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.elevationOffset=typeof p.elevationOffset=="number"?p.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,u,p,y=n.EXTENT){if(!(u>=0&&u=0&&pt.canonical.z&&(t.canonical.z>=y?x=t.canonical.z-y:n.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=t.canonical.x-(t.canonical.x>>x<>x<>8<<4|x>>8,u[I+3]=0;const p=new n.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),y=new T(t,p,t.gl.RGBA,{premultiply:!1});return y.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(t){const u=new Uint8Array(4),p=this.style.map.painter,y=p.context,x=y.gl;y.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),x.readPixels(t.x,p.height/devicePixelRatio-t.y-1,1,1,x.RGBA,x.UNSIGNED_BYTE,u),y.bindFramebuffer.set(null);const I=u[0]+(u[2]>>4<<8),R=u[1]+((15&u[2])<<8),O=this.coordsIndex[255-u[3]],V=O&&this.sourceCache.getTileByID(O);if(!V)return null;const G=this._coordsTextureSize,K=(1<n.emitValidationErrors(g,t&&t.filter(u=>u.identifier!=="source.canvas")),Tr=n.pick(Ie,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qr=n.pick(Ie,["setCenter","setZoom","setBearing","setPitch"]),Dr=function(){const g={},t=n.spec.$version;for(const u in n.spec.$root){const p=n.spec.$root[u];if(p.required){let y=null;y=u==="version"?t:p.type==="array"?[]:{},y!=null&&(g[u]=y)}}return g}();class fi extends n.Evented{constructor(t,u={}){super(),this.map=t,this.dispatcher=new Ae(tt(),this),this.imageManager=new D,this.imageManager.setEventedParent(this),this.glyphManager=new Y(t._requestManager,u.localIdeographFontFamily),this.lineAtlas=new ye(256,512),this.crossTileSymbolIndex=new Yt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new n.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",n.getReferrer());const p=this;this._rtlTextPluginCallback=fi.registerForPluginStateChange(y=>{p.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:y.pluginStatus,pluginURL:y.pluginURL},(x,I)=>{if(n.triggerPluginCompletionEvent(x),I&&I.every(R=>R))for(const R in p.sourceCaches)p.sourceCaches[R].reload()})}),this.on("data",y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const x=this.sourceCaches[y.sourceId];if(!x)return;const I=x.getSource();if(I&&I.vectorLayerIds)for(const R in this._layers){const O=this._layers[R];O.source===I.id&&this._validateLayer(O)}})}loadURL(t,u={}){this.fire(new n.Event("dataloading",{dataType:"style"}));const p=typeof u.validate!="boolean"||u.validate,y=this.map._requestManager.transformRequest(t,n.ResourceType.Style);this._request=n.getJSON(y,(x,I)=>{this._request=null,x?this.fire(new n.ErrorEvent(x)):I&&this._load(I,p)})}loadJSON(t,u={}){this.fire(new n.Event("dataloading",{dataType:"style"})),this._request=n.exported.frame(()=>{this._request=null,this._load(t,u.validate!==!1)})}loadEmpty(){this.fire(new n.Event("dataloading",{dataType:"style"})),this._load(Dr,!1)}_load(t,u){if(u&&dr(this,n.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const y in t.sources)this.addSource(y,t.sources[y],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const p=pe(this.stylesheet.layers);this._order=p.map(y=>y.id),this._layers={},this._serializedLayers={};for(let y of p)y=n.createStyleLayer(y),y.setEventedParent(this,{layer:{id:y.id}}),this._layers[y.id]=y,this._serializedLayers[y.id]=y.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new ce(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new n.Event("data",{dataType:"style"})),this.fire(new n.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(u,p,y,x){let I,R,O;const V=y>1?"@2x":"";let G=n.getJSON(p.transformRequest(p.normalizeSpriteURL(u,V,".json"),n.ResourceType.SpriteJSON),(me,fe)=>{G=null,O||(O=me,I=fe,ie())}),K=n.getImage(p.transformRequest(p.normalizeSpriteURL(u,V,".png"),n.ResourceType.SpriteImage),(me,fe)=>{K=null,O||(O=me,R=fe,ie())});function ie(){if(O)x(O);else if(I&&R){const me=n.exported.getImageData(R),fe={};for(const de in I){const{width:ze,height:De,x:Ve,y:xe,sdf:Ye,pixelRatio:Ze,stretchX:at,stretchY:lt,content:yt}=I[de],st=new n.RGBAImage({width:ze,height:De});n.RGBAImage.copy(me,st,{x:Ve,y:xe},{x:0,y:0},{width:ze,height:De}),fe[de]={data:st,pixelRatio:Ze,sdf:Ye,stretchX:at,stretchY:lt,content:yt}}x(null,fe)}}return{cancel(){G&&(G.cancel(),G=null),K&&(K.cancel(),K=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(u,p)=>{if(this._spriteRequest=null,u)this.fire(new n.ErrorEvent(u));else if(p)for(const y in p)this.imageManager.addImage(y,p[y]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"}))})}_validateLayer(t){const u=this.sourceCaches[t.source];if(!u)return;const p=t.sourceLayer;if(!p)return;const y=u.getSource();(y.type==="geojson"||y.vectorLayerIds&&y.vectorLayerIds.indexOf(p)===-1)&&this.fire(new n.ErrorEvent(new Error(`Source layer "${p}" does not exist on source "${y.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const u=[];for(const p of t){const y=this._layers[p];y.type!=="custom"&&u.push(y.serialize())}return u}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const u=this._changed;if(this._changed){const y=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(y.length||x.length)&&this._updateWorkerLayers(y,x);for(const I in this._updatedSources){const R=this._updatedSources[I];if(R==="reload")this._reloadSource(I);else{if(R!=="clear")throw new Error(`Invalid action ${R}`);this._clearSource(I)}}this._updateTilesForChangedImages();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const p={};for(const y in this.sourceCaches){const x=this.sourceCaches[y];p[y]=x.used,x.used=!1}for(const y of this._order){const x=this._layers[y];x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)&&x.source&&(this.sourceCaches[x.source].used=!0)}for(const y in p){const x=this.sourceCaches[y];p[y]!==x.used&&x.fire(new n.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:y}))}this.light.recalculate(t),this.z=t.zoom,u&&this.fire(new n.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,u){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const u=this.sourceCaches[t.source];if(!u)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new fr(this,u,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=p=>{p.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=p=>{p.tile&&(p.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(p.sourceId,p.tile.tileID)):p.source.type==="geojson"&&this.terrain.rememberForRerender(p.sourceId,p.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new n.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),dr(this,n.validateStyle(t)))return!1;(t=n.clone$1(t)).layers=pe(t.layers);const u=function(y,x){if(!y)return[{command:Ie.setStyle,args:[x]}];let I=[];try{if(!S(y.version,x.version))return[{command:Ie.setStyle,args:[x]}];S(y.center,x.center)||I.push({command:Ie.setCenter,args:[x.center]}),S(y.zoom,x.zoom)||I.push({command:Ie.setZoom,args:[x.zoom]}),S(y.bearing,x.bearing)||I.push({command:Ie.setBearing,args:[x.bearing]}),S(y.pitch,x.pitch)||I.push({command:Ie.setPitch,args:[x.pitch]}),S(y.sprite,x.sprite)||I.push({command:Ie.setSprite,args:[x.sprite]}),S(y.glyphs,x.glyphs)||I.push({command:Ie.setGlyphs,args:[x.glyphs]}),S(y.transition,x.transition)||I.push({command:Ie.setTransition,args:[x.transition]}),S(y.light,x.light)||I.push({command:Ie.setLight,args:[x.light]});const R={},O=[];(function(G,K,ie,me){let fe;for(fe in K=K||{},G=G||{})Object.prototype.hasOwnProperty.call(G,fe)&&(Object.prototype.hasOwnProperty.call(K,fe)||mt(fe,ie,me));for(fe in K)Object.prototype.hasOwnProperty.call(K,fe)&&(Object.prototype.hasOwnProperty.call(G,fe)?S(G[fe],K[fe])||(G[fe].type==="geojson"&&K[fe].type==="geojson"&&vt(G,K,fe)?ie.push({command:Ie.setGeoJSONSourceData,args:[fe,K[fe].data]}):je(fe,K,ie,me)):dt(fe,K,ie))})(y.sources,x.sources,O,R);const V=[];y.layers&&y.layers.forEach(G=>{R[G.source]?I.push({command:Ie.removeLayer,args:[G.id]}):V.push(G)}),I=I.concat(O),function(G,K,ie){K=K||[];const me=(G=G||[]).map(St),fe=K.map(St),de=G.reduce(Wt,{}),ze=K.reduce(Wt,{}),De=me.slice(),Ve=Object.create(null);let xe,Ye,Ze,at,lt,yt,st;for(xe=0,Ye=0;xe!(y.command in Qr));if(u.length===0)return!1;const p=u.filter(y=>!(y.command in Tr));if(p.length>0)throw new Error(`Unimplemented: ${p.map(y=>y.command).join(", ")}.`);return u.forEach(y=>{y.command!=="setTransition"&&this[y.command].apply(this,y.args)}),this.stylesheet=t,!0}addImage(t,u){if(this.getImage(t))return this.fire(new n.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,u),this._afterImageUpdated(t)}updateImage(t,u){this.imageManager.updateImage(t,u)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new n.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,u,p={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(n.validateStyle.source,`sources.${t}`,u,null,p))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const y=this.sourceCaches[t]=new Xe(t,u,this.dispatcher);y.style=this,y.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:y.serialize(),sourceId:t})),y.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===t)return this.fire(new n.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${p}" is using it.`)));const u=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],u.fire(new n.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,u){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const p=this.sourceCaches[t].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(u),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,u,p={}){this._checkLoaded();const y=t.id;if(this.getLayer(y))return void this.fire(new n.ErrorEvent(new Error(`Layer "${y}" already exists on this map.`)));let x;if(t.type==="custom"){if(dr(this,n.validateCustomStyleLayer(t)))return;x=n.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(y,t.source),t=n.clone$1(t),t=n.extend(t,{source:y})),this._validate(n.validateStyle.layer,`layers.${y}`,t,{arrayIndex:-1},p))return;x=n.createStyleLayer(t),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}}),this._serializedLayers[x.id]=x.serialize()}const I=u?this._order.indexOf(u):this._order.length;if(u&&I===-1)this.fire(new n.ErrorEvent(new Error(`Cannot add layer "${y}" before non-existing layer "${u}".`)));else{if(this._order.splice(I,0,y),this._layerOrderChanged=!0,this._layers[y]=x,this._removedLayers[y]&&x.source&&x.type!=="custom"){const R=this._removedLayers[y];delete this._removedLayers[y],R.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(t,u){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new n.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===u)return;const p=this._order.indexOf(t);this._order.splice(p,1);const y=u?this._order.indexOf(u):this._order.length;u&&y===-1?this.fire(new n.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${u}".`))):(this._order.splice(y,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const u=this._layers[t];if(!u)return void this.fire(new n.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));u.setEventedParent(null);const p=this._order.indexOf(t);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=u,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],u.onRemove&&u.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,u,p){this._checkLoaded();const y=this.getLayer(t);y?y.minzoom===u&&y.maxzoom===p||(u!=null&&(y.minzoom=u),p!=null&&(y.maxzoom=p),this._updateLayer(y)):this.fire(new n.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,u,p={}){this._checkLoaded();const y=this.getLayer(t);if(y){if(!S(y.filter,u))return u==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(n.validateStyle.filter,`layers.${y.id}.filter`,u,null,p)||(y.filter=n.clone$1(u),this._updateLayer(y)))}else this.fire(new n.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return n.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,u,p,y={}){this._checkLoaded();const x=this.getLayer(t);x?S(x.getLayoutProperty(u),p)||(x.setLayoutProperty(u,p,y),this._updateLayer(x)):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,u){const p=this.getLayer(t);if(p)return p.getLayoutProperty(u);this.fire(new n.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,u,p,y={}){this._checkLoaded();const x=this.getLayer(t);x?S(x.getPaintProperty(u),p)||(x.setPaintProperty(u,p,y)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,u){return this.getLayer(t).getPaintProperty(u)}setFeatureState(t,u){this._checkLoaded();const p=t.source,y=t.sourceLayer,x=this.sourceCaches[p];if(x===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${p}' does not exist in the map's style.`)));const I=x.getSource().type;I==="geojson"&&y?this.fire(new n.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||y?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),x.setFeatureState(y,t.id,u)):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,u){this._checkLoaded();const p=t.source,y=this.sourceCaches[p];if(y===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${p}' does not exist in the map's style.`)));const x=y.getSource().type,I=x==="vector"?t.sourceLayer:void 0;x!=="vector"||I?u&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new n.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):y.removeFeatureState(I,t.id,u):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const u=t.source,p=t.sourceLayer,y=this.sourceCaches[u];if(y!==void 0)return y.getSource().type!=="vector"||p?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),y.getFeatureState(p,t.id)):void this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new n.ErrorEvent(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return n.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return n.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:n.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const u=I=>this._layers[I].type==="fill-extrusion",p={},y=[];for(let I=this._order.length-1;I>=0;I--){const R=this._order[I];if(u(R)){p[R]=I;for(const O of t){const V=O[R];if(V)for(const G of V)y.push(G)}}}y.sort((I,R)=>R.intersectionZ-I.intersectionZ);const x=[];for(let I=this._order.length-1;I>=0;I--){const R=this._order[I];if(u(R))for(let O=y.length-1;O>=0;O--){const V=y[O].feature;if(p[V.layer.id]{const lt=ze.featureSortOrder;if(lt){const yt=lt.indexOf(Ze.featureIndex);return lt.indexOf(at.featureIndex)-yt}return at.featureIndex-Ze.featureIndex});for(const Ze of Ye)xe.push(Ze)}}for(const ze in me)me[ze].forEach(De=>{const Ve=De.feature,xe=O[I[ze].source].getFeatureState(Ve.layer["source-layer"],Ve.id);Ve.source=Ve.layer.source,Ve.layer["source-layer"]&&(Ve.sourceLayer=Ve.layer["source-layer"]),Ve.state=xe});return me}(this._layers,this._serializedLayers,this.sourceCaches,t,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(t,u){u&&u.filter&&this._validate(n.validateStyle.filter,"querySourceFeatures.filter",u.filter,null,u);const p=this.sourceCaches[t];return p?function(y,x){const I=y.getRenderableIds().map(V=>y.getTileByID(V)),R=[],O={};for(let V=0;Vie.getTileByID(me)).sort((me,fe)=>fe.tileID.overscaledZ-me.tileID.overscaledZ||(me.tileID.isLessThan(fe.tileID)?-1:1))}const K=this.crossTileSymbolIndex.addLayer(G,O[G.source],t.center.lng);I=I||K}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.exported.now(),t.zoom))&&(this.pauseablePlacement=new Re(t,this.terrain,this._order,x,u,p,y,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,O),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.exported.now()),R=!0),I&&this.pauseablePlacement.placement.setStale()),R||I)for(const V of this._order){const G=this._layers[V];G.type==="symbol"&&this.placement.updateLayerOpacities(G,O[G.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,u,p){this.imageManager.getImages(u.icons,p),this._updateTilesForChangedImages();const y=this.sourceCaches[u.source];y&&y.setDependencies(u.tileID.key,u.type,u.icons)}getGlyphs(t,u,p){this.glyphManager.getGlyphs(u.stacks,p)}getResource(t,u,p){return n.makeRequest(u,p)}}fi.getSourceType=function(g){return ge[g]},fi.setSourceType=function(g,t){ge[g]=t},fi.registerForPluginStateChange=n.registerForPluginStateChange;var jn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const as={prelude:Br(`#ifdef GL_ES +(count)`,style:"number_with_commas",values:o.all.residents[f.code].values.count}]};l.sheets.push(d)}return M2(l)}async function F2({fetch:o}){let r=await L2(Zl+ql.url,ql.layer,o),a=(await ty(Bo,[],o)).data,l=[],c={},f=[];return r.features.forEach(d=>{const n=d.properties[ql.code],m=d.properties[ql.name],b={code:n,name:m};l.push(b),c[n]=b,f.push({...b,value:100,color:Mo.seq[4]})}),{geojson:r,geoCodesAndNames:l,geoCodesLookup:c,geoPerc:f,all:a,selected:null}}const rT=Object.freeze(Object.defineProperty({__proto__:null,load:F2},Symbol.toStringTag,{value:"Module"})),N2=y_("goto"),U2=y_("after_navigate");function V2(o){return o.slice().sort(function(r,a){return r-a})}function Fm(o,r){for(var a=[],l=0;l0){var f=(a[r]-a[o-1])/(r-o+1);c=l[r]-l[o-1]-(r-o+1)*f*f}else c=l[r]-a[r]*a[r]/(r+1);return c<0?0:c}function bf(o,r,a,l,c,f,d){if(!(o>r)){var n=Math.floor((o+r)/2);l[a][n]=l[a-1][n-1],c[a][n]=n;var m=a;o>a&&(m=Math.max(m,c[a][o-1]||0)),m=Math.max(m,c[a-1][n]||0);var b=n-1;r=m&&(w=vf(P,n,f,d),!(w+l[a-1][m-1]>=l[a][n]));--P)S=vf(m,n,f,d),k=S+l[a-1][m-1],ko.length)throw new Error("cannot generate more classes than there are data values");var a=V2(o),l=$2(a);if(l===1)return[a];var c=Fm(r,a.length),f=Fm(r,a.length);j2(a,c,f);for(var d=[],n=f[0].length-1,m=f.length-1;m>=0;m--){var b=f[m][n];d[m]=a.slice(b,n+1),m>0&&(n=b-1)}return d}function Nm(o,r,a){const l=o.slice();return l[15]=r[a],l}function Um(o,r,a){const l=o.slice();return l[18]=r[a],l[20]=a,l}function Vm(o,r,a){const l=o.slice();return l[18]=r[a],l[20]=a,l}function $m(o,r,a){const l=o.slice();return l[15]=r[a],l[20]=a,l}function jm(o){let r,a=o[9],l=[];for(let c=0;cB.toFixed(1)}=r,{suffix:k="%"}=r,{base:A=null}=r,{barHeight:P=25}=r,{markerWidth:T=3}=r,{showLegend:L=!0}=r;function D(B,$){let J={},Y=[];for(const re of B)J[re[$]]||(J[re[$]]={label:re[$],values:[]},Y.push(re[$])),J[re[$]].values.push(re);let ae=[];return Y.forEach(re=>{ae.push(J[re])}),ae}return o.$$set=B=>{"data"in B&&a(10,n=B.data),"xKey"in B&&a(0,m=B.xKey),"yKey"in B&&a(11,b=B.yKey),"zKey"in B&&a(12,w=B.zKey),"formatTick"in B&&a(1,S=B.formatTick),"suffix"in B&&a(2,k=B.suffix),"base"in B&&a(3,A=B.base),"barHeight"in B&&a(4,P=B.barHeight),"markerWidth"in B&&a(5,T=B.markerWidth),"showLegend"in B&&a(6,L=B.showLegend)},o.$$.update=()=>{o.$$.dirty&1025&&a(13,l=Math.max(...n.map(B=>B[m]))),o.$$.dirty&5120&&a(9,c=n.map(B=>B[w]).filter((B,$,J)=>J.indexOf(B)===$)),o.$$.dirty&8192&&a(8,f=B=>B/l*100),o.$$.dirty&3072&&a(7,d=D(n,b))},[m,S,k,A,P,T,L,d,f,c,n,b,w,l]}class K2 extends Wr{constructor(r){super(),Kr(this,r,W2,H2,jr,{data:10,xKey:0,yKey:11,zKey:12,formatTick:1,suffix:2,base:3,barHeight:4,markerWidth:5,showLegend:6})}}function X2(o){let r,a,l;return{c(){r=ls("svg"),a=ls("path"),this.h()},l(c){r=cs(c,"svg",{class:!0,viewBox:!0,"fill-rule":!0,"clip-rule":!0,"aria-hidden":!0,focusable:!0,style:!0});var f=He(r);a=cs(f,"path",{d:!0}),He(a).forEach(te),f.forEach(te),this.h()},h(){_e(a,"d",l=o[4][o[0]]),_e(r,"class","ico svelte-175xtay"),_e(r,"viewBox","0 0 24 24"),_e(r,"fill-rule","evenodd"),_e(r,"clip-rule","evenodd"),_e(r,"aria-hidden","true"),_e(r,"focusable","false"),_e(r,"style",o[3]),Ht(r,"margin",o[2]),Ht(r,"noclick",!o[1])},m(c,f){Be(c,r,f),Pe(r,a)},p(c,[f]){f&1&&l!==(l=c[4][c[0]])&&_e(a,"d",l),f&8&&_e(r,"style",c[3]),f&4&&Ht(r,"margin",c[2]),f&2&&Ht(r,"noclick",!c[1])},i:_r,o:_r,d(c){c&&te(r)}}}function J2(o,r,a){let l,{type:c="compass"}=r,{rotation:f=0}=r,{position:d="inline"}=r,{clickable:n=!1}=r,{margin:m=!1}=r;const b={compass:"M22 12c0-5.52-4.48-10-10-10S2 6.48 2 12s4.48 10 10 10 10-4.48 10-10zm-10 1H8v-2h4V8l4 4-4 4v-3z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 15c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1zm1-8h-2V7h2v2z",chart:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM8 17c-.55 0-1-.45-1-1v-5c0-.55.45-1 1-1s1 .45 1 1v5c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v8c0 .55-.45 1-1 1zm4 0c-.55 0-1-.45-1-1v-2c0-.55.45-1 1-1s1 .45 1 1v2c0 .55-.45 1-1 1z",share:"M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z",chevron:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z",full:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z",full_exit:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z",shuffle:"M10.59 9.17 5.41 4 4 5.41l5.17 5.17 1.42-1.41zM14.5 4l2.04 2.04L4 18.59 5.41 20 17.96 7.46 20 9.5V4h-5.5zm.33 9.41-1.41 1.41 3.13 3.13L14.5 20H20v-5.5l-2.04 2.04-3.13-3.13z",replay:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8z",save:"M19 12v7H5v-7H3v7c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-7h-2zm-6 .67 2.59-2.58L17 11.5l-5 5-5-5 1.41-1.41L11 12.67V3h2z",tick:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",cross:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",arrow:"M5,13h11.2l-2.9,2.9c-0.4,0.4-0.4,1,0,1.4s1,0.4,1.4,0l4.6-4.6c0.4-0.4,0.4-1,0-1.4l-4.6-4.6c-0.4-0.4-1-0.4-1.4,0c0,0,0,0,0,0c-0.4,0.4-0.4,1,0,1.4l2.9,2.9H5c-0.6,0-1,0.4-1,1S4.4,13,5,13z",plus:"M18 13h-5v5c0 .55-.45 1-1 1s-1-.45-1-1v-5H6c-.55 0-1-.45-1-1s.45-1 1-1h5V6c0-.55.45-1 1-1s1 .45 1 1v5h5c.55 0 1 .45 1 1s-.45 1-1 1z",minus:"M18 13H6c-.55 0-1-.45-1-1s.45-1 1-1h12c.55 0 1 .45 1 1s-.45 1-1 1z",subdir:"m19 15-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z",touch:"M9 11.24V7.5C9 6.12 10.12 5 11.5 5S14 6.12 14 7.5v3.74c1.21-.81 2-2.18 2-3.74C16 5.01 13.99 3 11.5 3S7 5.01 7 7.5c0 1.56.79 2.93 2 3.74zm9.84 4.63-4.54-2.26c-.17-.07-.35-.11-.54-.11H13v-6c0-.83-.67-1.5-1.5-1.5S10 6.67 10 7.5v10.74c-3.6-.76-3.54-.75-3.67-.75-.31 0-.59.13-.79.33l-.79.8 4.94 4.94c.27.27.65.44 1.06.44h6.79c.75 0 1.33-.55 1.44-1.28l.75-5.27c.01-.07.02-.14.02-.2 0-.62-.38-1.16-.91-1.38z",launch:"M18 19H6c-.55 0-1-.45-1-1V6c0-.55.45-1 1-1h5c.55 0 1-.45 1-1s-.45-1-1-1H5c-1.11 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-6c0-.55-.45-1-1-1s-1 .45-1 1v5c0 .55-.45 1-1 1zM14 4c0 .55.45 1 1 1h2.59l-9.13 9.13c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L19 6.41V9c0 .55.45 1 1 1s1-.45 1-1V3h-6c-.55 0-1 .45-1 1z",close:"M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z",error:"M 12 2 C 6.48 2 2 6.48 2 12 s 4.48 10 10 10 s 10 -4.48 10 -10 S 17.52 2 12 2 z m 1 15 h -2 v -2 h 2 v 2 z m 0 -4 h -2 V 7 h 2 v 6 z"};return o.$$set=w=>{"type"in w&&a(0,c=w.type),"rotation"in w&&a(5,f=w.rotation),"position"in w&&a(6,d=w.position),"clickable"in w&&a(1,n=w.clickable),"margin"in w&&a(2,m=w.margin)},o.$$.update=()=>{o.$$.dirty&96&&a(3,l=`transform: translate(0, 15%) scale(1.5) rotate(${-f}deg);${["left","right"].includes(d)?` position: absolute; ${d}: 10px;`:""}`)},[c,n,m,l,b,f,d]}class hd extends Wr{constructor(r){super(),Kr(this,r,J2,X2,jr,{type:0,rotation:5,position:6,clickable:1,margin:2})}}function Km(o,r,a){const l=o.slice();return l[11]=r[a],l}function Xm(o){let r,a,l,c;return{c(){r=Ne("button"),a=zt("Back"),this.h()},l(f){r=Ue(f,"BUTTON",{class:!0});var d=He(r);a=Mt(d,"Back"),d.forEach(te),this.h()},h(){_e(r,"class","hidden-on-desktop svelte-1iovvug")},m(f,d){Be(f,r,d),Pe(r,a),l||(c=ba(r,"click",function(){d_(o[3])&&o[3].apply(this,arguments)}),l=!0)},p(f,d){o=f},d(f){f&&te(r),l=!1,c()}}}function Jm(o){let r,a,l,c,f=Ks(Ou(o[11],o[4]))+"",d;return{c(){r=Ne("br"),a=Et(),l=Ne("div"),c=zt("Selected: "),d=zt(f),this.h()},l(n){r=Ue(n,"BR",{}),a=kt(n),l=Ue(n,"DIV",{class:!0});var m=He(l);c=Mt(m,"Selected: "),d=Mt(m,f),m.forEach(te),this.h()},h(){_e(l,"class","selected-item-label svelte-1iovvug")},m(n,m){Be(n,r,m),Be(n,a,m),Be(n,l,m),Pe(l,c),Pe(l,d)},p(n,m){m&18&&f!==(f=Ks(Ou(n[11],n[4]))+"")&&kr(d,f)},d(n){n&&te(r),n&&te(a),n&&te(l)}}}function Ym(o){let r,a=o[6](o[11])+"",l,c,f,d,n,m=Ou(o[11],o[4]),b,w,S;d=new hd({props:{type:"chevron"}});let k=m&&Jm(o);function A(){return o[10](o[11])}return{c(){r=Ne("button"),l=zt(a),c=Et(),f=Ne("span"),ir(d.$$.fragment),n=Et(),k&&k.c(),this.h()},l(P){r=Ue(P,"BUTTON",{class:!0});var T=He(r);l=Mt(T,a),c=kt(T),f=Ue(T,"SPAN",{class:!0});var L=He(f);cr(d.$$.fragment,L),L.forEach(te),n=kt(T),k&&k.l(T),T.forEach(te),this.h()},h(){_e(f,"class","right-chevron svelte-1iovvug"),_e(r,"class","svelte-1iovvug"),Ht(r,"plain-button",!0),Ht(r,"selected",o[11]===o[0])},m(P,T){Be(P,r,T),Pe(r,l),Pe(r,c),Pe(r,f),nr(d,f,null),Pe(r,n),k&&k.m(r,null),b=!0,w||(S=ba(r,"click",A),w=!0)},p(P,T){o=P,(!b||T&66)&&a!==(a=o[6](o[11])+"")&&kr(l,a),T&18&&(m=Ou(o[11],o[4])),m?k?k.p(o,T):(k=Jm(o),k.c(),k.m(r,null)):k&&(k.d(1),k=null),(!b||T&3)&&Ht(r,"selected",o[11]===o[0])},i(P){b||(qe(d.$$.fragment,P),b=!0)},o(P){nt(d.$$.fragment,P),b=!1},d(P){P&&te(r),ar(d),k&&k.d(),w=!1,S()}}}function Y2(o){let r,a,l,c,f,d,n,m=o[3]!=null&&Xm(o),b=o[1],w=[];for(let P=0;Pnt(w[P],1,1,()=>{w[P]=null}),k=o[9].default,A=Di(k,o,o[8],null);return{c(){r=Ne("div"),m&&m.c(),a=Et(),l=Ne("h5"),c=zt(o[5]),f=Et();for(let P=0;PP.label}=r,{selected:S=null}=r,{hiddenOnMobile:k=!1}=r;const A=P=>{a(0,S=P),d(P)};return o.$$set=P=>{"options"in P&&a(1,f=P.options),"clickCallback"in P&&a(2,d=P.clickCallback),"backButtonCallback"in P&&a(3,n=P.backButtonCallback),"globalSelectedCategories"in P&&a(4,m=P.globalSelectedCategories),"columnTitle"in P&&a(5,b=P.columnTitle),"labeller"in P&&a(6,w=P.labeller),"selected"in P&&a(0,S=P.selected),"hiddenOnMobile"in P&&a(7,k=P.hiddenOnMobile),"$$scope"in P&&a(8,c=P.$$scope)},[S,f,d,n,m,b,w,k,c,l,A]}class tE extends Wr{constructor(r){super(),Kr(this,r,eE,Y2,jr,{options:1,clickCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,selected:0,hiddenOnMobile:7})}}function Qm(o,r,a){const l=o.slice();return l[14]=r[a],l[16]=a,l}function eg(o){let r,a,l,c,f,d,n,m,b;return{c(){r=Ne("ol"),a=Ne("li"),l=Ne("button"),c=zt("Back"),f=Et(),d=ls("svg"),n=ls("path"),this.h()},l(w){r=Ue(w,"OL",{class:!0});var S=He(r);a=Ue(S,"LI",{class:!0,id:!0});var k=He(a);l=Ue(k,"BUTTON",{class:!0});var A=He(l);c=Mt(A,"Back"),A.forEach(te),f=kt(k),d=cs(k,"svg",{class:!0,viewBox:!0,xmlns:!0,focusable:!0,fill:!0});var P=He(d);n=cs(P,"path",{d:!0,transform:!0}),He(n).forEach(te),P.forEach(te),k.forEach(te),S.forEach(te),this.h()},h(){_e(l,"class","btn-link ons-breadcrumb__link"),_e(n,"d","M5.74,14.28l-.57-.56a.5.5,0,0,1,0-.71h0l5-5-5-5a.5.5,0,0,1,0-.71h0l.57-.56a.5.5,0,0,1,.71,0h0l5.93,5.93a.5.5,0,0,1,0,.7L6.45,14.28a.5.5,0,0,1-.71,0Z"),_e(n,"transform","translate(-5.02 -1.59)"),_e(d,"class","ons-svg-icon svelte-w4p0hu"),_e(d,"viewBox","0 0 8 13"),_e(d,"xmlns","http://www.w3.org/2000/svg"),_e(d,"focusable","false"),_e(d,"fill","currentColor"),_e(a,"class","ons-breadcrumb__item"),_e(a,"id","breadcrumb-1"),_e(r,"class","ons-breadcrumb__items ons-u-fs-s")},m(w,S){Be(w,r,S),Pe(r,a),Pe(a,l),Pe(l,c),Pe(a,f),Pe(a,d),Pe(d,n),m||(b=ba(l,"click",function(){d_(o[3])&&o[3].apply(this,arguments)}),m=!0)},p(w,S){o=w},d(w){w&&te(r),m=!1,b()}}}function tg(o){let r,a;return r=new hf({props:{variant:"secondary",small:!0,disabled:o[7],$$slots:{default:[rE]},$$scope:{ctx:o}}}),r.$on("click",o[11]),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&128&&(f.disabled=l[7]),c&8192&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function rE(o){let r;return{c(){r=zt("Remove selection")},l(a){r=Mt(a,"Remove selection")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function iE(o){let r,a=o[0],l,c,f=ig(o);const d=o[10].default,n=Di(d,o,o[13],null);return{c(){r=Ne("div"),f.c(),l=Et(),n&&n.c(),this.h()},l(m){r=Ue(m,"DIV",{class:!0});var b=He(r);f.l(b),b.forEach(te),l=kt(m),n&&n.l(m),this.h()},h(){_e(r,"class","ons-radios__items")},m(m,b){Be(m,r,b),f.m(r,null),Be(m,l,b),n&&n.m(m,b),c=!0},p(m,b){b&1&&jr(a,a=m[0])?(f.d(1),f=ig(m),f.c(),f.m(r,null)):f.p(m,b),n&&n.p&&(!c||b&8192)&&Ri(n,d,m,m[13],c?Bi(d,m[13],b,null):Li(m[13]),null)},i(m){c||(qe(n,m),c=!0)},o(m){nt(n,m),c=!1},d(m){m&&te(r),f.d(m),m&&te(l),n&&n.d(m)}}}function nE(o){let r;return{c(){r=zt(`At most three characteristics can be selected. To add another + characteristic, please remove one of the three selected ones.`)},l(a){r=Mt(a,`At most three characteristics can be selected. To add another + characteristic, please remove one of the three selected ones.`)},m(a,l){Be(a,r,l)},p:_r,i:_r,o:_r,d(a){a&&te(r)}}}function rg(o){let r,a,l,c,f,d=o[6](o[14])+"",n,m,b,w;function S(){return o[12](o[14])}return{c(){r=Ne("button"),a=Ne("span"),l=Ne("span"),c=Et(),f=Ne("span"),n=zt(d),m=Et(),this.h()},l(k){r=Ue(k,"BUTTON",{class:!0});var A=He(r);a=Ue(A,"SPAN",{class:!0});var P=He(a);l=Ue(P,"SPAN",{class:!0}),He(l).forEach(te),c=kt(P),f=Ue(P,"SPAN",{class:!0});var T=He(f);n=Mt(T,d),T.forEach(te),P.forEach(te),m=kt(A),A.forEach(te),this.h()},h(){_e(l,"class","ons-radio__input ons-js-radio svelte-1cwdic4"),_e(f,"class","ons-radio__label svelte-1cwdic4"),_e(a,"class","ons-radio ons-radio--no-border"),_e(r,"class","ons-radios__item ons-radios__item--no-border svelte-1cwdic4"),r.disabled=o[7],Ht(r,"ons-radio__checked",ag(o[14],o[4]))},m(k,A){Be(k,r,A),Pe(r,a),Pe(a,l),Pe(a,c),Pe(a,f),Pe(f,n),Pe(r,m),b||(w=[p_(sE.call(null,r,o[16]===0)),ba(r,"click",S)],b=!0)},p(k,A){o=k,A&65&&d!==(d=o[6](o[14])+"")&&kr(n,d),A&128&&(r.disabled=o[7]),A&17&&Ht(r,"ons-radio__checked",ag(o[14],o[4]))},d(k){k&&te(r),b=!1,m1(w)}}}function ig(o){let r,a=o[0],l=[];for(let c=0;c{T=null}),Ur());let Y=S;S=B($,J),S===Y?D[S].p($,J):(Nr(),nt(D[Y],1,1,()=>{D[Y]=null}),Ur(),k=D[S],k?k.p($,J):(k=D[S]=L[S]($),k.c()),qe(k,1),k.m(r,null)),(!A||J&256)&&Ht(r,"hidden-first-column",$[8])},i($){A||(qe(T),qe(k),A=!0)},o($){nt(T),nt(k),A=!1},d($){$&&te(r),P&&P.d(),T&&T.d(),D[S].d()}}}function ng(o){console.log("clicked",o)}function of(o,r){for(let a of r)if(a.topic===o.label)return a.label;return!1}function ag(o,r){for(const a of r)if(a.var===o.var&&a.code===o.code)return!0;return!1}function sE(o,r){r&&o.focus()}function oE(o,r,a){let{$$slots:l={},$$scope:c}=r,{options:f=[]}=r,{clickCallback:d=ng}=r,{removeCatCallback:n=ng}=r,{backButtonCallback:m=null}=r,{globalSelectedCategories:b=[]}=r,{columnTitle:w="column title"}=r,{labeller:S=D=>D.label}=r,{disabled:k=!1}=r,{hiddenOnMobile:A=!1}=r,{currentVar:P=null}=r;const T=()=>n(P),L=D=>d(D);return o.$$set=D=>{"options"in D&&a(0,f=D.options),"clickCallback"in D&&a(1,d=D.clickCallback),"removeCatCallback"in D&&a(2,n=D.removeCatCallback),"backButtonCallback"in D&&a(3,m=D.backButtonCallback),"globalSelectedCategories"in D&&a(4,b=D.globalSelectedCategories),"columnTitle"in D&&a(5,w=D.columnTitle),"labeller"in D&&a(6,S=D.labeller),"disabled"in D&&a(7,k=D.disabled),"hiddenOnMobile"in D&&a(8,A=D.hiddenOnMobile),"currentVar"in D&&a(9,P=D.currentVar),"$$scope"in D&&a(13,c=D.$$scope)},[f,d,n,m,b,w,S,k,A,P,l,T,L,c]}class lE extends Wr{constructor(r){super(),Kr(this,r,oE,aE,jr,{options:0,clickCallback:1,removeCatCallback:2,backButtonCallback:3,globalSelectedCategories:4,columnTitle:5,labeller:6,disabled:7,hiddenOnMobile:8,currentVar:9})}}function sg(o,r,a){const l=o.slice();return l[15]=r[a],l}function og(o){let r,a,l=[o[0].vars[o[7][o[0].label]]],c=[];for(let d=0;d<1;d+=1)c[d]=ug(sg(o,l,d));const f=d=>nt(c[d],1,1,()=>{c[d]=null});return{c(){for(let d=0;d<1;d+=1)c[d].c();r=er()},l(d){for(let n=0;n<1;n+=1)c[n].l(d);r=er()},m(d,n){for(let m=0;m<1;m+=1)c[m]&&c[m].m(d,n);Be(d,r,n),a=!0},p(d,n){if(n&1019){l=[d[0].vars[d[7][d[0].label]]];let m;for(m=0;m<1;m+=1){const b=sg(d,l,m);c[m]?(c[m].p(b,n),qe(c[m],1)):(c[m]=ug(b),c[m].c(),qe(c[m],1),c[m].m(r.parentNode,r))}for(Nr(),m=1;m<1;m+=1)f(m);Ur()}},i(d){if(!a){for(let n=0;n<1;n+=1)qe(c[n]);a=!0}},o(d){c=c.filter(Boolean);for(let n=0;n<1;n+=1)nt(c[n]);a=!1},d(d){Ui(c,d),d&&te(r)}}}function lg(o){let r,a,l,c,f,d;return a=new hd({props:{type:"chevron",rotation:90}}),{c(){r=Ne("button"),ir(a.$$.fragment),l=zt(" Show fewer"),this.h()},l(n){r=Ue(n,"BUTTON",{class:!0});var m=He(r);cr(a.$$.fragment,m),l=Mt(m," Show fewer"),m.forEach(te),this.h()},h(){_e(r,"class","btn-link")},m(n,m){Be(n,r,m),nr(a,r,null),Pe(r,l),c=!0,f||(d=ba(r,"click",o[9]),f=!0)},p:_r,i(n){c||(qe(a.$$.fragment,n),c=!0)},o(n){nt(a.$$.fragment,n),c=!1},d(n){n&&te(r),ar(a),f=!1,d()}}}function cg(o){let r,a,l,c,f,d;return a=new hd({props:{type:"chevron",rotation:-90}}),{c(){r=Ne("button"),ir(a.$$.fragment),l=zt(" Show more"),this.h()},l(n){r=Ue(n,"BUTTON",{class:!0});var m=He(r);cr(a.$$.fragment,m),l=Mt(m," Show more"),m.forEach(te),this.h()},h(){_e(r,"class","btn-link")},m(n,m){Be(n,r,m),nr(a,r,null),Pe(r,l),c=!0,f||(d=ba(r,"click",o[8]),f=!0)},p:_r,i(n){c||(qe(a.$$.fragment,n),c=!0)},o(n){nt(a.$$.fragment,n),c=!1},d(n){n&&te(r),ar(a),f=!1,d()}}}function cE(o){let r,a,l,c=o[7][o[0].label]>0&&lg(o),f=o[7][o[0].label]0?c?(c.p(d,n),n&129&&qe(c,1)):(c=lg(d),c.c(),qe(c,1),c.m(r.parentNode,r)):c&&(Nr(),nt(c,1,1,()=>{c=null}),Ur()),d[7][d[0].label]{f=null}),Ur())},i(d){l||(qe(c),qe(f),l=!0)},o(d){nt(c),nt(f),l=!1},d(d){c&&c.d(d),d&&te(r),f&&f.d(d),d&&te(a)}}}function ug(o){let r,a,l;function c(...m){return o[11](o[15],...m)}function f(...m){return o[12](o[15],...m)}function d(m){o[14](m)}let n={columnTitle:o[0].label,options:o[15].cats,clickCallback:c,removeCatCallback:f,backButtonCallback:o[13],globalSelectedCategories:o[5],currentVar:o[0],disabled:o[6],$$slots:{default:[cE]},$$scope:{ctx:o}};return o[1]!==void 0&&(n.selected=o[1]),r=new lE({props:n}),Zs.push(()=>Fo(r,"selected",d)),{c(){ir(r.$$.fragment)},l(m){cr(r.$$.fragment,m)},m(m,b){nr(r,m,b),l=!0},p(m,b){o=m;const w={};b&1&&(w.columnTitle=o[0].label),b&129&&(w.options=o[15].cats),b&137&&(w.clickCallback=c),b&145&&(w.removeCatCallback=f),b&1&&(w.backButtonCallback=o[13]),b&32&&(w.globalSelectedCategories=o[5]),b&1&&(w.currentVar=o[0]),b&64&&(w.disabled=o[6]),b&262273&&(w.$$scope={dirty:b,ctx:o}),!a&&b&2&&(a=!0,w.selected=o[1],No(()=>a=!1)),r.$set(w)},i(m){l||(qe(r.$$.fragment,m),l=!0)},o(m){nt(r.$$.fragment,m),l=!1},d(m){ar(r,m)}}}function hg(o){let r,a,l=o[0]!=null&&og(o);return{c(){l&&l.c(),r=er()},l(c){l&&l.l(c),r=er()},m(c,f){l&&l.m(c,f),Be(c,r,f),a=!0},p(c,f){c[0]!=null?l?(l.p(c,f),f&1&&qe(l,1)):(l=og(c),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(c){a||(qe(l),a=!0)},o(c){nt(l),a=!1},d(c){l&&l.d(c),c&&te(r)}}}function uE(o){let r,a,l,c,f=o[0],d;function n(w){o[10](w)}let m={columnTitle:"Select a variable",clickCallback:dE,options:o[2],globalSelectedCategories:o[5],hiddenOnMobile:o[0]!=null};o[0]!==void 0&&(m.selected=o[0]),a=new tE({props:m}),Zs.push(()=>Fo(a,"selected",n));let b=hg(o);return{c(){r=Ne("div"),ir(a.$$.fragment),c=Et(),b.c(),this.h()},l(w){r=Ue(w,"DIV",{class:!0});var S=He(r);cr(a.$$.fragment,S),c=kt(S),b.l(S),S.forEach(te),this.h()},h(){_e(r,"class","container svelte-9mqv54")},m(w,S){Be(w,r,S),nr(a,r,null),Pe(r,c),b.m(r,null),d=!0},p(w,[S]){const k={};S&4&&(k.options=w[2]),S&32&&(k.globalSelectedCategories=w[5]),S&1&&(k.hiddenOnMobile=w[0]!=null),!l&&S&1&&(l=!0,k.selected=w[0],No(()=>l=!1)),a.$set(k),S&1&&jr(f,f=w[0])?(Nr(),nt(b,1,1,_r),Ur(),b=hg(w),b.c(),qe(b,1),b.m(r,null)):b.p(w,S)},i(w){d||(qe(a.$$.fragment,w),qe(b),d=!0)},o(w){nt(a.$$.fragment,w),nt(b),d=!1},d(w){w&&te(r),ar(a),b.d(w)}}}function hE(o,r){console.log(o,r)}function fE(o,r){console.log(o,r)}const dE=()=>{};function pE(o,r,a){let l,{options:c=[]}=r,{clickCallback:f=hE}=r,{removeCatCallback:d=fE}=r,{globalSelectedCategories:n=[]}=r,{disabled:m=!1}=r,{activeColumn:b=null}=r,{activeCategory:w=null}=r;function S(){a(7,++l[b.label],l)}function k(){a(7,--l[b.label],l)}function A(B){b=B,a(0,b)}const P=(B,$)=>f(B,$),T=(B,$)=>d(B,$),L=()=>a(0,b=null);function D(B){w=B,a(1,w)}return o.$$set=B=>{"options"in B&&a(2,c=B.options),"clickCallback"in B&&a(3,f=B.clickCallback),"removeCatCallback"in B&&a(4,d=B.removeCatCallback),"globalSelectedCategories"in B&&a(5,n=B.globalSelectedCategories),"disabled"in B&&a(6,m=B.disabled),"activeColumn"in B&&a(0,b=B.activeColumn),"activeCategory"in B&&a(1,w=B.activeCategory)},o.$$.update=()=>{o.$$.dirty&4&&a(7,l=function(){let B={};return c.forEach($=>B[$.label]=0),B}())},[b,w,c,f,d,n,m,l,S,k,A,P,T,L,D]}class mE extends Wr{constructor(r){super(),Kr(this,r,pE,uE,jr,{options:2,clickCallback:3,removeCatCallback:4,globalSelectedCategories:5,disabled:6,activeColumn:0,activeCategory:1})}}var ry={exports:{}};(function(o,r){(function(a,l){o.exports=l()})(Do,function(){var a,l,c;function f(n,m){if(!a)a=m;else if(!l)l=m;else{var b="var sharedChunk = {}; ("+a+")(sharedChunk); ("+l+")(sharedChunk);",w={};a(w),c=m(w),typeof window<"u"&&(c.workerUrl=window.URL.createObjectURL(new Blob([b],{type:"text/javascript"})))}}f(["exports"],function(n){var m=b;function b(i,e,s,h){this.cx=3*i,this.bx=3*(s-i)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*e,this.by=3*(h-e)-this.cy,this.ay=1-this.cy-this.by,this.p1x=i,this.p1y=e,this.p2x=s,this.p2y=h}function w(i,e,s,h){const _=new m(i,e,s,h);return function(v){return _.solve(v)}}b.prototype={sampleCurveX:function(i){return((this.ax*i+this.bx)*i+this.cx)*i},sampleCurveY:function(i){return((this.ay*i+this.by)*i+this.cy)*i},sampleCurveDerivativeX:function(i){return(3*this.ax*i+2*this.bx)*i+this.cx},solveCurveX:function(i,e){if(e===void 0&&(e=1e-6),i<0)return 0;if(i>1)return 1;for(var s=i,h=0;h<8;h++){var _=this.sampleCurveX(s)-i;if(Math.abs(_)_?E=s:C=s,s=.5*(C-E)+E;return s},solve:function(i,e){return this.sampleCurveY(this.solveCurveX(i,e))}};const S=w(.25,.1,.25,1);function k(i,e,s){return Math.min(s,Math.max(e,i))}function A(i,e,s){const h=s-e,_=((i-e)%h+h)%h+e;return _===e?s:_}function P(i,...e){for(const s of e)for(const h in s)i[h]=s[h];return i}let T=1;function L(i,e){i.forEach(s=>{e[s]&&(e[s]=e[s].bind(e))})}function D(i,e,s){const h={};for(const _ in i)h[_]=e.call(s||this,i[_],_,i);return h}function B(i,e,s){const h={};for(const _ in i)e.call(s||this,i[_],_,i)&&(h[_]=i[_]);return h}function $(i){return Array.isArray(i)?i.map($):typeof i=="object"&&i?D(i,$):i}const J={};function Y(i){J[i]||(typeof console<"u"&&console.warn(i),J[i]=!0)}function ae(i,e,s){return(s.y-i.y)*(e.x-i.x)>(e.y-i.y)*(s.x-i.x)}function re(i){let e=0;for(let s,h,_=0,v=i.length,E=v-1;_@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(s,h,_,v)=>{const E=_||v;return e[h]=!E||E.toLowerCase(),""}),e["max-age"]){const s=parseInt(e["max-age"],10);isNaN(s)?delete e["max-age"]:e["max-age"]=s}return e}let Ae,_t,le=null;function We(i){if(le==null){const e=i.navigator?i.navigator.userAgent:null;le=!!i.safari||!(!e||!(/\b(iPad|iPhone|iPod)\b/.test(e)||e.match("Safari")&&!e.match("Chrome")))}return le}function Z(i){return typeof ImageBitmap<"u"&&i instanceof ImageBitmap}const $e={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(i){const e=requestAnimationFrame(i);return{cancel:()=>cancelAnimationFrame(e)}},getImageData(i,e=0){const s=window.document.createElement("canvas"),h=s.getContext("2d");if(!h)throw new Error("failed to create canvas 2d context");return s.width=i.width,s.height=i.height,h.drawImage(i,0,0,i.width,i.height),h.getImageData(-e,-e,i.width+2*e,i.height+2*e)},resolveURL:i=>(Ae||(Ae=document.createElement("a")),Ae.href=i,Ae.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(_t==null&&(_t=matchMedia("(prefers-reduced-motion: reduce)")),_t.matches)}};var ct=rt;function rt(i,e){this.x=i,this.y=e}rt.prototype={clone:function(){return new rt(this.x,this.y)},add:function(i){return this.clone()._add(i)},sub:function(i){return this.clone()._sub(i)},multByPoint:function(i){return this.clone()._multByPoint(i)},divByPoint:function(i){return this.clone()._divByPoint(i)},mult:function(i){return this.clone()._mult(i)},div:function(i){return this.clone()._div(i)},rotate:function(i){return this.clone()._rotate(i)},rotateAround:function(i,e){return this.clone()._rotateAround(i,e)},matMult:function(i){return this.clone()._matMult(i)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(i){return this.x===i.x&&this.y===i.y},dist:function(i){return Math.sqrt(this.distSqr(i))},distSqr:function(i){var e=i.x-this.x,s=i.y-this.y;return e*e+s*s},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(i){return Math.atan2(this.y-i.y,this.x-i.x)},angleWith:function(i){return this.angleWithSep(i.x,i.y)},angleWithSep:function(i,e){return Math.atan2(this.x*e-this.y*i,this.x*i+this.y*e)},_matMult:function(i){var e=i[2]*this.x+i[3]*this.y;return this.x=i[0]*this.x+i[1]*this.y,this.y=e,this},_add:function(i){return this.x+=i.x,this.y+=i.y,this},_sub:function(i){return this.x-=i.x,this.y-=i.y,this},_mult:function(i){return this.x*=i,this.y*=i,this},_div:function(i){return this.x/=i,this.y/=i,this},_multByPoint:function(i){return this.x*=i.x,this.y*=i.y,this},_divByPoint:function(i){return this.x/=i.x,this.y/=i.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var i=this.y;return this.y=this.x,this.x=-i,this},_rotate:function(i){var e=Math.cos(i),s=Math.sin(i),h=s*this.x+e*this.y;return this.x=e*this.x-s*this.y,this.y=h,this},_rotateAround:function(i,e){var s=Math.cos(i),h=Math.sin(i),_=e.y+h*(this.x-e.x)+s*(this.y-e.y);return this.x=e.x+s*(this.x-e.x)-h*(this.y-e.y),this.y=_,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},rt.convert=function(i){return i instanceof rt?i:Array.isArray(i)?new rt(i[0],i[1]):i};const $t={MAX_PARALLEL_IMAGE_REQUESTS:16,REGISTERED_PROTOCOLS:{}},it="mapbox-tiles";let et,oe,ge=500,Me=50;function ee(){typeof caches>"u"||et||(et=caches.open(it))}let ue=1/0;const Je={supported:!1,testSupport:function(i){!Xe&&pt&&(Bt?Qt(i):wt=i)}};let wt,pt,Xe=!1,Bt=!1;function Qt(i){const e=i.createTexture();i.bindTexture(i.TEXTURE_2D,e);try{if(i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,pt),i.isContextLost())return;Je.supported=!0}catch{}i.deleteTexture(e),Xe=!0}typeof document<"u"&&(pt=document.createElement("img"),pt.onload=function(){wt&&Qt(wt),wt=null,Bt=!0},pt.onerror=function(){Xe=!0,wt=null},pt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Rr={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Image:"Image"};typeof Object.freeze=="function"&&Object.freeze(Rr);class Vr extends Error{constructor(e,s,h,_){super(`AJAXError: ${s} (${e}): ${h}`),this.status=e,this.statusText=s,this.url=h,this.body=_}}const H=ce()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href;function ut(i,e){const s=new AbortController,h=new Request(i.url,{method:i.method||"GET",body:i.body,credentials:i.credentials,headers:i.headers,referrer:H(),signal:s.signal});let _=!1,v=!1;return i.type==="json"&&h.headers.set("Accept","application/json"),((E,C,M)=>{if(v)return;const F=Date.now();fetch(h).then(j=>j.ok?((W,X,ne)=>{(i.type==="arrayBuffer"?W.arrayBuffer():i.type==="json"?W.json():W.text()).then(se=>{v||(X&&ne&&function(ke,we,Oe){if(ee(),!et)return;const Qe={status:we.status,statusText:we.statusText,headers:new Headers};we.headers.forEach((Ke,ft)=>Qe.headers.set(ft,Ke));const Le=ye(we.headers.get("Cache-Control")||"");Le["no-store"]||(Le["max-age"]&&Qe.headers.set("Expires",new Date(Oe+1e3*Le["max-age"]).toUTCString()),new Date(Qe.headers.get("Expires")).getTime()-Oe<42e4||function(Ke,ft){if(oe===void 0)try{new Response(new ReadableStream),oe=!0}catch{oe=!1}oe?ft(Ke.body):Ke.blob().then(ft)}(we,Ke=>{const ft=new Response(Ke,Qe);ee(),et&&et.then(ht=>ht.put(function(qt){const Zt=qt.indexOf("?");return Zt<0?qt:qt.slice(0,Zt)}(ke.url),ft)).catch(ht=>Y(ht.message))}))}(h,X,ne),_=!0,e(null,se,W.headers.get("Cache-Control"),W.headers.get("Expires")))}).catch(se=>{v||e(new Error(se.message))})})(j,null,F):j.blob().then(W=>e(new Vr(j.status,j.statusText,i.url,W)))).catch(j=>{j.code!==20&&e(new Error(j.message))})})(),{cancel:()=>{v=!0,_||s.abort()}}}const tt=function(i,e){if(/:\/\//.test(i.url)&&!/^https?:|^file:/.test(i.url)){if(ce()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e);if(!ce()){const h=i.url.substring(0,i.url.indexOf("://"));return($t.REGISTERED_PROTOCOLS[h]||ut)(i,e)}}if(!(/^file:/.test(s=i.url)||/^file:/.test(H())&&!/^\w+:/.test(s))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return ut(i,e);if(ce()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",i,e,void 0,!0)}var s;return function(h,_){const v=new XMLHttpRequest;v.open(h.method||"GET",h.url,!0),h.type==="arrayBuffer"&&(v.responseType="arraybuffer");for(const E in h.headers)v.setRequestHeader(E,h.headers[E]);return h.type==="json"&&(v.responseType="text",v.setRequestHeader("Accept","application/json")),v.withCredentials=h.credentials==="include",v.onerror=()=>{_(new Error(v.statusText))},v.onload=()=>{if((v.status>=200&&v.status<300||v.status===0)&&v.response!==null){let E=v.response;if(h.type==="json")try{E=JSON.parse(v.response)}catch(C){return _(C)}_(null,E,v.getResponseHeader("Cache-Control"),v.getResponseHeader("Expires"))}else{const E=new Blob([v.response],{type:v.getResponseHeader("Content-Type")});_(new Vr(v.status,v.statusText,h.url,E))}},v.send(h.body),{cancel:()=>v.abort()}}(i,e)},be=function(i,e){return tt(P(i,{type:"arrayBuffer"}),e)};function pe(i){const e=window.document.createElement("a");return e.href=i,e.protocol===window.document.location.protocol&&e.host===window.document.location.host}const Ie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let dt,mt;dt=[],mt=0;const je=function(i,e){if(Je.supported&&(i.headers||(i.headers={}),i.headers.accept="image/webp,*/*"),mt>=$t.MAX_PARALLEL_IMAGE_REQUESTS){const v={requestParameters:i,callback:e,cancelled:!1,cancel(){this.cancelled=!0}};return dt.push(v),v}mt++;let s=!1;const h=()=>{if(!s)for(s=!0,mt--;dt.length&&mt<$t.MAX_PARALLEL_IMAGE_REQUESTS;){const v=dt.shift(),{requestParameters:E,callback:C,cancelled:M}=v;M||(v.cancel=je(E,C).cancel)}},_=be(i,(v,E,C,M)=>{h(),v?e(v):E&&function(F,j){typeof createImageBitmap=="function"?function(W,X){const ne=new Blob([new Uint8Array(W)],{type:"image/png"});createImageBitmap(ne).then(se=>{X(null,se)}).catch(se=>{X(new Error(`Could not load image because of ${se.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(F,j):function(W,X){const ne=new Image;ne.onload=()=>{X(null,ne),URL.revokeObjectURL(ne.src),ne.onload=null,window.requestAnimationFrame(()=>{ne.src=Ie})},ne.onerror=()=>X(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const se=new Blob([new Uint8Array(W)],{type:"image/png"});ne.src=W.byteLength?URL.createObjectURL(se):Ie}(F,j)}(E,(F,j)=>{F!=null?e(F):j!=null&&e(null,j,{cacheControl:C,expires:M})})});return{cancel:()=>{_.cancel(),h()}}};function vt(i,e,s){s[i]&&s[i].indexOf(e)!==-1||(s[i]=s[i]||[],s[i].push(e))}function Ot(i,e,s){if(s&&s[i]){const h=s[i].indexOf(e);h!==-1&&s[i].splice(h,1)}}class St{constructor(e,s={}){P(this,s),this.type=e}}class Wt extends St{constructor(e,s={}){super("error",P({error:e},s))}}class wr{on(e,s){return this._listeners=this._listeners||{},vt(e,s,this._listeners),this}off(e,s){return Ot(e,s,this._listeners),Ot(e,s,this._oneTimeListeners),this}once(e,s){return this._oneTimeListeners=this._oneTimeListeners||{},vt(e,s,this._oneTimeListeners),this}fire(e,s){typeof e=="string"&&(e=new St(e,s||{}));const h=e.type;if(this.listens(h)){e.target=this;const _=this._listeners&&this._listeners[h]?this._listeners[h].slice():[];for(const C of _)C.call(this,e);const v=this._oneTimeListeners&&this._oneTimeListeners[h]?this._oneTimeListeners[h].slice():[];for(const C of v)Ot(h,C,this._oneTimeListeners),C.call(this,e);const E=this._eventedParent;E&&(P(e,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),E.fire(e))}else e instanceof Wt&&console.error(e.error);return this}listens(e){return this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e)}setEventedParent(e,s){return this._eventedParent=e,this._eventedParentData=s,this}}var Fe={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"string"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{}},default:"mapbox"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1},elevationOffset:{type:"number",default:450}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};class gt{constructor(e,s,h,_){this.message=(e?`${e}: `:"")+h,_&&(this.identifier=_),s!=null&&s.__line__&&(this.line=s.__line__)}}function mi(i){const e=i.value;return e?[new gt(i.key,e,"constants have been deprecated as of v8")]:[]}function ri(i,...e){for(const s of e)for(const h in s)i[h]=s[h];return i}function yr(i){return i instanceof Number||i instanceof String||i instanceof Boolean?i.valueOf():i}function Sr(i){if(Array.isArray(i))return i.map(Sr);if(i instanceof Object&&!(i instanceof Number||i instanceof String||i instanceof Boolean)){const e={};for(const s in i)e[s]=Sr(i[s]);return e}return yr(i)}class gi extends Error{constructor(e,s){super(s),this.message=s,this.key=e}}class Ei{constructor(e,s=[]){this.parent=e,this.bindings={};for(const[h,_]of s)this.bindings[h]=_}concat(e){return new Ei(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const _i={kind:"null"},Tt={kind:"number"},pr={kind:"string"},hr={kind:"boolean"},yi={kind:"color"},nn={kind:"object"},sr={kind:"value"},Vi={kind:"collator"},ii={kind:"formatted"},aa={kind:"padding"},ui={kind:"resolvedImage"};function Oi(i,e){return{kind:"array",itemType:i,N:e}}function Lr(i){if(i.kind==="array"){const e=Lr(i.itemType);return typeof i.N=="number"?`array<${e}, ${i.N}>`:i.itemType.kind==="value"?"array":`array<${e}>`}return i.kind}const Un=[_i,Tt,pr,hr,yi,ii,nn,Oi(sr),aa,ui];function gn(i,e){if(e.kind==="error")return null;if(i.kind==="array"){if(e.kind==="array"&&(e.N===0&&e.itemType.kind==="value"||!gn(i.itemType,e.itemType))&&(typeof i.N!="number"||i.N===e.N))return null}else{if(i.kind===e.kind)return null;if(i.kind==="value"){for(const s of Un)if(!gn(s,e))return null}}return`Expected ${Lr(i)} but found ${Lr(e)} instead.`}function zn(i,e){return e.some(s=>s.kind===i.kind)}function Vn(i,e){return e.some(s=>s==="null"?i===null:s==="array"?Array.isArray(i):s==="object"?i&&!Array.isArray(i)&&typeof i=="object":s===typeof i)}var $n,Ce={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function N(i){return(i=Math.round(i))<0?0:i>255?255:i}function z(i){return N(i[i.length-1]==="%"?parseFloat(i)/100*255:parseInt(i))}function U(i){return(e=i[i.length-1]==="%"?parseFloat(i)/100:parseFloat(i))<0?0:e>1?1:e;var e}function q(i,e,s){return s<0?s+=1:s>1&&(s-=1),6*s<1?i+(e-i)*s*6:2*s<1?e:3*s<2?i+(e-i)*(2/3-s)*6:i}try{$n={}.parseCSSColor=function(i){var e,s=i.replace(/ /g,"").toLowerCase();if(s in Ce)return Ce[s].slice();if(s[0]==="#")return s.length===4?(e=parseInt(s.substr(1),16))>=0&&e<=4095?[(3840&e)>>4|(3840&e)>>8,240&e|(240&e)>>4,15&e|(15&e)<<4,1]:null:s.length===7&&(e=parseInt(s.substr(1),16))>=0&&e<=16777215?[(16711680&e)>>16,(65280&e)>>8,255&e,1]:null;var h=s.indexOf("("),_=s.indexOf(")");if(h!==-1&&_+1===s.length){var v=s.substr(0,h),E=s.substr(h+1,_-(h+1)).split(","),C=1;switch(v){case"rgba":if(E.length!==4)return null;C=U(E.pop());case"rgb":return E.length!==3?null:[z(E[0]),z(E[1]),z(E[2]),C];case"hsla":if(E.length!==4)return null;C=U(E.pop());case"hsl":if(E.length!==3)return null;var M=(parseFloat(E[0])%360+360)%360/360,F=U(E[1]),j=U(E[2]),W=j<=.5?j*(F+1):j+F-j*F,X=2*j-W;return[N(255*q(X,W,M+1/3)),N(255*q(X,W,M)),N(255*q(X,W,M-1/3)),C];default:return null}}return null}}catch{}class Q{constructor(e,s,h,_=1){this.r=e,this.g=s,this.b=h,this.a=_}static parse(e){if(!e)return;if(e instanceof Q)return e;if(typeof e!="string")return;const s=$n(e);return s?new Q(s[0]/255*s[3],s[1]/255*s[3],s[2]/255*s[3],s[3]):void 0}toString(){const[e,s,h,_]=this.toArray();return`rgba(${Math.round(e)},${Math.round(s)},${Math.round(h)},${_})`}toArray(){const{r:e,g:s,b:h,a:_}=this;return _===0?[0,0,0,0]:[255*e/_,255*s/_,255*h/_,_]}}Q.black=new Q(0,0,0,1),Q.white=new Q(1,1,1,1),Q.transparent=new Q(0,0,0,0),Q.red=new Q(1,0,0,1);class he{constructor(e,s,h){this.sensitivity=e?s?"variant":"case":s?"accent":"base",this.locale=h,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,s){return this.collator.compare(e,s)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Se{constructor(e,s,h,_,v){this.text=e,this.image=s,this.scale=h,this.fontStack=_,this.textColor=v}}class Ee{constructor(e){this.sections=e}static fromString(e){return new Ee([new Se(e,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(e=>e.text.length!==0||e.image&&e.image.name.length!==0)}static factory(e){return e instanceof Ee?e:Ee.fromString(e)}toString(){return this.sections.length===0?"":this.sections.map(e=>e.text).join("")}}class ve{constructor(e){this.values=e.slice()}static parse(e){if(e instanceof ve)return e;if(typeof e=="number")return new ve([e,e,e,e]);if(Array.isArray(e)&&!(e.length<1||e.length>4)){for(const s of e)if(typeof s!="number")return;switch(e.length){case 1:e=[e[0],e[0],e[0],e[0]];break;case 2:e=[e[0],e[1],e[0],e[1]];break;case 3:e=[e[0],e[1],e[2],e[1]]}return new ve(e)}}toString(){return JSON.stringify(this.values)}}class Te{constructor(e){this.name=e.name,this.available=e.available}toString(){return this.name}static fromString(e){return e?new Te({name:e,available:!1}):null}}function Ge(i,e,s,h){return typeof i=="number"&&i>=0&&i<=255&&typeof e=="number"&&e>=0&&e<=255&&typeof s=="number"&&s>=0&&s<=255?h===void 0||typeof h=="number"&&h>=0&&h<=1?null:`Invalid rgba value [${[i,e,s,h].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof h=="number"?[i,e,s,h]:[i,e,s]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ot(i){if(i===null||typeof i=="string"||typeof i=="boolean"||typeof i=="number"||i instanceof Q||i instanceof he||i instanceof Ee||i instanceof ve||i instanceof Te)return!0;if(Array.isArray(i)){for(const e of i)if(!ot(e))return!1;return!0}if(typeof i=="object"){for(const e in i)if(!ot(i[e]))return!1;return!0}return!1}function Re(i){if(i===null)return _i;if(typeof i=="string")return pr;if(typeof i=="boolean")return hr;if(typeof i=="number")return Tt;if(i instanceof Q)return yi;if(i instanceof he)return Vi;if(i instanceof Ee)return ii;if(i instanceof ve)return aa;if(i instanceof Te)return ui;if(Array.isArray(i)){const e=i.length;let s;for(const h of i){const _=Re(h);if(s){if(s===_)continue;s=sr;break}s=_}return Oi(s||sr,e)}return nn}function Ct(i){const e=typeof i;return i===null?"":e==="string"||e==="number"||e==="boolean"?String(i):i instanceof Q||i instanceof Ee||i instanceof ve||i instanceof Te?i.toString():JSON.stringify(i)}class Pt{constructor(e,s){this.type=e,this.value=s}static parse(e,s){if(e.length!==2)return s.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ot(e[1]))return s.error("invalid value");const h=e[1];let _=Re(h);const v=s.expectedType;return _.kind!=="array"||_.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(_=v),new Pt(_,h)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class bt{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const Xt={string:pr,number:Tt,boolean:hr,object:nn};class Yt{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");let h,_=1;const v=e[0];if(v==="array"){let C,M;if(e.length>2){const F=e[1];if(typeof F!="string"||!(F in Xt)||F==="object")return s.error('The item type argument of "array" must be one of string, number, boolean',1);C=Xt[F],_++}else C=sr;if(e.length>3){if(e[2]!==null&&(typeof e[2]!="number"||e[2]<0||e[2]!==Math.floor(e[2])))return s.error('The length argument to "array" must be a positive integer literal',2);M=e[2],_++}h=Oi(C,M)}else{if(!Xt[v])throw new Error(`Types doesn't contain name = ${v}`);h=Xt[v]}const E=[];for(;_e.outputDefined())}}const mr={"to-boolean":hr,"to-color":yi,"to-number":Tt,"to-string":pr};class or{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const h=e[0];if(!mr[h])throw new Error(`Can't parse ${h} as it is not part of the known types`);if((h==="to-boolean"||h==="to-string")&&e.length!==2)return s.error("Expected one argument.");const _=mr[h],v=[];for(let E=1;E4?`Invalid rbga value ${JSON.stringify(s)}: expected an array containing either three or four numeric values.`:Ge(s[0],s[1],s[2],s[3]),!h))return new Q(s[0]/255,s[1]/255,s[2]/255,s[3])}throw new bt(h||`Could not parse color from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}if(this.type.kind==="padding"){let s;for(const h of this.args){s=h.evaluate(e);const _=ve.parse(s);if(_)return _}throw new bt(`Could not parse padding from value '${typeof s=="string"?s:JSON.stringify(s)}'`)}if(this.type.kind==="number"){let s=null;for(const h of this.args){if(s=h.evaluate(e),s===null)return 0;const _=Number(s);if(!isNaN(_))return _}throw new bt(`Could not convert ${JSON.stringify(s)} to number.`)}return this.type.kind==="formatted"?Ee.fromString(Ct(this.args[0].evaluate(e))):this.type.kind==="resolvedImage"?Te.fromString(Ct(this.args[0].evaluate(e))):Ct(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}const fr=["Unknown","Point","LineString","Polygon"];class dr{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?fr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(e){let s=this._parseColorCache[e];return s||(s=this._parseColorCache[e]=Q.parse(e)),s}}class Tr{constructor(e,s,h,_){this.name=e,this.type=s,this._evaluate=h,this.args=_}evaluate(e){return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}static parse(e,s){const h=e[0],_=Tr.definitions[h];if(!_)return s.error(`Unknown expression "${h}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(_)?_[0]:_.type,E=Array.isArray(_)?[[_[1],_[2]]]:_.overloads,C=E.filter(([F])=>!Array.isArray(F)||F.length===e.length-1);let M=null;for(const[F,j]of C){M=new Va(s.registry,s.path,null,s.scope);const W=[];let X=!1;for(let ne=1;ne{return X=W,Array.isArray(X)?`(${X.map(Lr).join(", ")})`:`(${Lr(X.type)}...)`;var X}).join(" | "),j=[];for(let W=1;W=e[2]||i[1]<=e[1]||i[3]>=e[3])}function sa(i,e){const s=(180+i[0])/360,h=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i[1]*Math.PI/360)))/360,_=Math.pow(2,e.z);return[Math.round(s*_*Dr),Math.round(h*_*Dr)]}function Br(i,e,s){const h=i[0]-e[0],_=i[1]-e[1],v=i[0]-s[0],E=i[1]-s[1];return h*E-v*_==0&&h*v<=0&&_*E<=0}function oa(i,e){let s=!1;for(let E=0,C=e.length;E(h=i)[1]!=(v=M[F+1])[1]>h[1]&&h[0]<(v[0]-_[0])*(h[1]-_[1])/(v[1]-_[1])+_[0]&&(s=!s)}}var h,_,v;return s}function la(i,e){for(let s=0;s0&&C<0||E<0&&C>0}function hs(i,e,s){for(const F of s)for(let j=0;js[2]){const _=.5*h;let v=i[0]-s[0]>_?-h:s[0]-i[0]>_?h:0;v===0&&(v=i[0]-s[2]>_?-h:s[2]-i[0]>_?h:0),i[0]+=v}fi(e,i)}function hc(i,e,s,h){const _=Math.pow(2,h.z)*Dr,v=[h.x*Dr,h.y*Dr],E=[];for(const C of i)for(const M of C){const F=[M.x+v[0],M.y+v[1]];uc(F,e,s,_),E.push(F)}return E}function fc(i,e,s,h){const _=Math.pow(2,h.z)*Dr,v=[h.x*Dr,h.y*Dr],E=[];for(const M of i){const F=[];for(const j of M){const W=[j.x+v[0],j.y+v[1]];fi(e,W),F.push(W)}E.push(F)}if(e[2]-e[0]<=_/2){(C=e)[0]=C[1]=1/0,C[2]=C[3]=-1/0;for(const M of E)for(const F of M)uc(F,e,s,_)}var C;return E}class wa{constructor(e,s){this.type=hr,this.geojson=e,this.geometries=s}static parse(e,s){if(e.length!==2)return s.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ot(e[1])){const h=e[1];if(h.type==="FeatureCollection")for(let _=0;_{e&&!fs(s)&&(e=!1)}),e}function Ua(i){if(i instanceof Tr&&i.name==="feature-state")return!1;let e=!0;return i.eachChild(s=>{e&&!Ua(s)&&(e=!1)}),e}function Js(i,e){if(i instanceof Tr&&e.indexOf(i.name)>=0)return!1;let s=!0;return i.eachChild(h=>{s&&!Js(h,e)&&(s=!1)}),s}class Ys{constructor(e,s){this.type=s.type,this.name=e,this.boundExpression=s}static parse(e,s){if(e.length!==2||typeof e[1]!="string")return s.error("'var' expression requires exactly one string literal argument.");const h=e[1];return s.scope.has(h)?new Ys(h,s.scope.get(h)):s.error(`Unknown variable "${h}". Make sure "${h}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}}class Va{constructor(e,s=[],h,_=new Ei,v=[]){this.registry=e,this.path=s,this.key=s.map(E=>`[${E}]`).join(""),this.scope=_,this.errors=v,this.expectedType=h}parse(e,s,h,_,v={}){return s?this.concat(s,h,_)._parse(e,v):this._parse(e,v)}_parse(e,s){function h(_,v,E){return E==="assert"?new Yt(v,[_]):E==="coerce"?new or(v,[_]):_}if(e!==null&&typeof e!="string"&&typeof e!="boolean"&&typeof e!="number"||(e=["literal",e]),Array.isArray(e)){if(e.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const _=e[0];if(typeof _!="string")return this.error(`Expression name must be a string, but found ${typeof _} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[_];if(v){let E=v.parse(e,this);if(!E)return null;if(this.expectedType){const C=this.expectedType,M=E.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||M.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||M.kind!=="value"&&M.kind!=="string")if(C.kind!=="padding"||M.kind!=="value"&&M.kind!=="number"&&M.kind!=="array"){if(this.checkSubtype(C,M))return null}else E=h(E,C,s.typeAnnotation||"coerce");else E=h(E,C,s.typeAnnotation||"coerce");else E=h(E,C,s.typeAnnotation||"assert")}if(!(E instanceof Pt)&&E.type.kind!=="resolvedImage"&&Ho(E)){const C=new dr;try{E=new Pt(E.type,E.evaluate(C))}catch(M){return this.error(M.message),null}}return E}return this.error(`Unknown expression "${_}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(e===void 0?"'undefined' value invalid. Use null instead.":typeof e=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,s,h){const _=typeof e=="number"?this.path.concat(e):this.path,v=h?this.scope.concat(h):this.scope;return new Va(this.registry,_,s||null,v,this.errors)}error(e,...s){const h=`${this.key}${s.map(_=>`[${_}]`).join("")}`;this.errors.push(new gi(h,e))}checkSubtype(e,s){const h=gn(e,s);return h&&this.error(h),h}}function Ho(i){if(i instanceof Ys)return Ho(i.boundExpression);if(i instanceof Tr&&i.name==="error"||i instanceof Qr||i instanceof wa)return!1;const e=i instanceof or||i instanceof Yt;let s=!0;return i.eachChild(h=>{s=e?s&&Ho(h):s&&h instanceof Pt}),!!s&&fs(i)&&Js(i,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Qs(i,e){const s=i.length-1;let h,_,v=0,E=s,C=0;for(;v<=E;)if(C=Math.floor((v+E)/2),h=i[C],_=i[C+1],h<=e){if(C===s||e<_)return C;v=C+1}else{if(!(h>e))throw new bt("Input is not a number.");E=C-1}return 0}class ds{constructor(e,s,h){this.type=e,this.input=s,this.labels=[],this.outputs=[];for(const[_,v]of h)this.labels.push(_),this.outputs.push(v)}static parse(e,s){if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");const h=s.parse(e[1],1,Tt);if(!h)return null;const _=[];let v=null;s.expectedType&&s.expectedType.kind!=="value"&&(v=s.expectedType);for(let E=1;E=C)return s.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',F);const W=s.parse(M,j,v);if(!W)return null;v=v||W.type,_.push([C,W])}return new ds(v,h,_)}evaluate(e){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(e);const _=this.input.evaluate(e);if(_<=s[0])return h[0].evaluate(e);const v=s.length;return _>=s[v-1]?h[v-1].evaluate(e):h[Qs(s,_)].evaluate(e)}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function ni(i,e,s){return i*(1-s)+e*s}var ps=Object.freeze({__proto__:null,number:ni,color:function(i,e,s){return new Q(ni(i.r,e.r,s),ni(i.g,e.g,s),ni(i.b,e.b,s),ni(i.a,e.a,s))},array:function(i,e,s){return i.map((h,_)=>ni(h,e[_],s))},padding:function(i,e,s){const h=i.values,_=e.values;return new ve([ni(h[0],_[0],s),ni(h[1],_[1],s),ni(h[2],_[2],s),ni(h[3],_[3],s)])}});const dc=.95047,pc=1.08883,Wo=4/29,eo=6/29,mc=3*eo*eo,Wu=Math.PI/180,Ku=180/Math.PI;function Ko(i){return i>.008856451679035631?Math.pow(i,1/3):i/mc+Wo}function Xo(i){return i>eo?i*i*i:mc*(i-Wo)}function Jo(i){return 255*(i<=.0031308?12.92*i:1.055*Math.pow(i,1/2.4)-.055)}function Yo(i){return(i/=255)<=.04045?i/12.92:Math.pow((i+.055)/1.055,2.4)}function Or(i){const e=Yo(i.r),s=Yo(i.g),h=Yo(i.b),_=Ko((.4124564*e+.3575761*s+.1804375*h)/dc),v=Ko((.2126729*e+.7151522*s+.072175*h)/1);return{l:116*v-16,a:500*(_-v),b:200*(v-Ko((.0193339*e+.119192*s+.9503041*h)/pc)),alpha:i.a}}function gc(i){let e=(i.l+16)/116,s=isNaN(i.a)?e:e+i.a/500,h=isNaN(i.b)?e:e-i.b/200;return e=1*Xo(e),s=dc*Xo(s),h=pc*Xo(h),new Q(Jo(3.2404542*s-1.5371385*e-.4985314*h),Jo(-.969266*s+1.8760108*e+.041556*h),Jo(.0556434*s-.2040259*e+1.0572252*h),i.alpha)}function Xu(i,e,s){const h=e-i;return i+s*(h>180||h<-180?h-360*Math.round(h/360):h)}const ms={forward:Or,reverse:gc,interpolate:function(i,e,s){return{l:ni(i.l,e.l,s),a:ni(i.a,e.a,s),b:ni(i.b,e.b,s),alpha:ni(i.alpha,e.alpha,s)}}},gs={forward:function(i){const{l:e,a:s,b:h}=Or(i),_=Math.atan2(h,s)*Ku;return{h:_<0?_+360:_,c:Math.sqrt(s*s+h*h),l:e,alpha:i.a}},reverse:function(i){const e=i.h*Wu,s=i.c;return gc({l:i.l,a:Math.cos(e)*s,b:Math.sin(e)*s,alpha:i.alpha})},interpolate:function(i,e,s){return{h:Xu(i.h,e.h,s),c:ni(i.c,e.c,s),l:ni(i.l,e.l,s),alpha:ni(i.alpha,e.alpha,s)}}};var _c=Object.freeze({__proto__:null,lab:ms,hcl:gs});class an{constructor(e,s,h,_,v){this.type=e,this.operator=s,this.interpolation=h,this.input=_,this.labels=[],this.outputs=[];for(const[E,C]of v)this.labels.push(E),this.outputs.push(C)}static interpolationFactor(e,s,h,_){let v=0;if(e.name==="exponential")v=Qo(s,e.base,h,_);else if(e.name==="linear")v=Qo(s,1,h,_);else if(e.name==="cubic-bezier"){const E=e.controlPoints;v=new m(E[0],E[1],E[2],E[3]).solve(Qo(s,1,h,_))}return v}static parse(e,s){let[h,_,v,...E]=e;if(!Array.isArray(_)||_.length===0)return s.error("Expected an interpolation type expression.",1);if(_[0]==="linear")_={name:"linear"};else if(_[0]==="exponential"){const F=_[1];if(typeof F!="number")return s.error("Exponential interpolation requires a numeric base.",1,1);_={name:"exponential",base:F}}else{if(_[0]!=="cubic-bezier")return s.error(`Unknown interpolation type ${String(_[0])}`,1,0);{const F=_.slice(1);if(F.length!==4||F.some(j=>typeof j!="number"||j<0||j>1))return s.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);_={name:"cubic-bezier",controlPoints:F}}}if(e.length-1<4)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return s.error("Expected an even number of arguments.");if(v=s.parse(v,2,Tt),!v)return null;const C=[];let M=null;h==="interpolate-hcl"||h==="interpolate-lab"?M=yi:s.expectedType&&s.expectedType.kind!=="value"&&(M=s.expectedType);for(let F=0;F=j)return s.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const se=s.parse(W,ne,M);if(!se)return null;M=M||se.type,C.push([j,se])}return M.kind==="number"||M.kind==="color"||M.kind==="padding"||M.kind==="array"&&M.itemType.kind==="number"&&typeof M.N=="number"?new an(M,h,_,v,C):s.error(`Type ${Lr(M)} is not interpolatable.`)}evaluate(e){const s=this.labels,h=this.outputs;if(s.length===1)return h[0].evaluate(e);const _=this.input.evaluate(e);if(_<=s[0])return h[0].evaluate(e);const v=s.length;if(_>=s[v-1])return h[v-1].evaluate(e);const E=Qs(s,_),C=an.interpolationFactor(this.interpolation,_,s[E],s[E+1]),M=h[E].evaluate(e),F=h[E+1].evaluate(e);return this.operator==="interpolate"?ps[this.type.kind.toLowerCase()](M,F,C):this.operator==="interpolate-hcl"?gs.reverse(gs.interpolate(gs.forward(M),gs.forward(F),C)):ms.reverse(ms.interpolate(ms.forward(M),ms.forward(F),C))}eachChild(e){e(this.input);for(const s of this.outputs)e(s)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}}function Qo(i,e,s,h){const _=h-s,v=i-s;return _===0?0:e===1?v/_:(Math.pow(e,v)-1)/(Math.pow(e,_)-1)}class to{constructor(e,s){this.type=e,this.args=s}static parse(e,s){if(e.length<2)return s.error("Expectected at least one argument.");let h=null;const _=s.expectedType;_&&_.kind!=="value"&&(h=_);const v=[];for(const C of e.slice(1)){const M=s.parse(C,1+v.length,h,void 0,{typeAnnotation:"omit"});if(!M)return null;h=h||M.type,v.push(M)}if(!h)throw new Error("No output type");const E=_&&v.some(C=>gn(_,C.type));return new to(E?sr:h,v)}evaluate(e){let s,h=null,_=0;for(const v of this.args)if(_++,h=v.evaluate(e),h&&h instanceof Te&&!h.available&&(s||(s=h.name),h=null,_===this.args.length&&(h=s)),h!==null)break;return h}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}}class ro{constructor(e,s){this.type=s.type,this.bindings=[].concat(e),this.result=s}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const s of this.bindings)e(s[1]);e(this.result)}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const h=[];for(let v=1;v=h.length)throw new bt(`Array index out of bounds: ${s} > ${h.length-1}.`);if(s!==Math.floor(s))throw new bt(`Array index must be an integer, but found ${s} instead.`);return h[s]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}}class tl{constructor(e,s){this.type=hr,this.needle=e,this.haystack=s}static parse(e,s){if(e.length!==3)return s.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,sr),_=s.parse(e[2],2,sr);return h&&_?zn(h.type,[hr,pr,Tt,_i,sr])?new tl(h,_):s.error(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(h.type)} instead`):null}evaluate(e){const s=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!h)return!1;if(!Vn(s,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(Re(s))} instead.`);if(!Vn(h,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${Lr(Re(h))} instead.`);return h.indexOf(s)>=0}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}}class io{constructor(e,s,h){this.type=Tt,this.needle=e,this.haystack=s,this.fromIndex=h}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,sr),_=s.parse(e[2],2,sr);if(!h||!_)return null;if(!zn(h.type,[hr,pr,Tt,_i,sr]))return s.error(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(h.type)} instead`);if(e.length===4){const v=s.parse(e[3],3,Tt);return v?new io(h,_,v):null}return new io(h,_)}evaluate(e){const s=this.needle.evaluate(e),h=this.haystack.evaluate(e);if(!Vn(s,["boolean","string","number","null"]))throw new bt(`Expected first argument to be of type boolean, string, number or null, but found ${Lr(Re(s))} instead.`);if(!Vn(h,["string","array"]))throw new bt(`Expected second argument to be of type array or string, but found ${Lr(Re(h))} instead.`);if(this.fromIndex){const _=this.fromIndex.evaluate(e);return h.indexOf(s,_)}return h.indexOf(s)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}}class rl{constructor(e,s,h,_,v,E){this.inputType=e,this.type=s,this.input=h,this.cases=_,this.outputs=v,this.otherwise=E}static parse(e,s){if(e.length<5)return s.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return s.error("Expected an even number of arguments.");let h,_;s.expectedType&&s.expectedType.kind!=="value"&&(_=s.expectedType);const v={},E=[];for(let F=2;FNumber.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof se=="number"&&Math.floor(se)!==se)return X.error("Numeric branch labels must be integer values.");if(h){if(X.checkSubtype(h,Re(se)))return null}else h=Re(se);if(v[String(se)]!==void 0)return X.error("Branch labels must be unique.");v[String(se)]=E.length}const ne=s.parse(W,F,_);if(!ne)return null;_=_||ne.type,E.push(ne)}const C=s.parse(e[1],1,sr);if(!C)return null;const M=s.parse(e[e.length-1],e.length-1,_);return M?C.type.kind!=="value"&&s.concat(1).checkSubtype(h,C.type)?null:new rl(h,_,C,v,E,M):null}evaluate(e){const s=this.input.evaluate(e);return(Re(s)===this.inputType&&this.outputs[this.cases[s]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}}class il{constructor(e,s,h){this.type=e,this.branches=s,this.otherwise=h}static parse(e,s){if(e.length<4)return s.error(`Expected at least 3 arguments, but found only ${e.length-1}.`);if(e.length%2!=0)return s.error("Expected an odd number of arguments.");let h;s.expectedType&&s.expectedType.kind!=="value"&&(h=s.expectedType);const _=[];for(let E=1;Es.outputDefined())&&this.otherwise.outputDefined()}}class no{constructor(e,s,h,_){this.type=e,this.input=s,this.beginIndex=h,this.endIndex=_}static parse(e,s){if(e.length<=2||e.length>=5)return s.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`);const h=s.parse(e[1],1,sr),_=s.parse(e[2],2,Tt);if(!h||!_)return null;if(!zn(h.type,[Oi(sr),pr,sr]))return s.error(`Expected first argument to be of type array or string, but found ${Lr(h.type)} instead`);if(e.length===4){const v=s.parse(e[3],3,Tt);return v?new no(h.type,h,_,v):null}return new no(h.type,h,_)}evaluate(e){const s=this.input.evaluate(e),h=this.beginIndex.evaluate(e);if(!Vn(s,["string","array"]))throw new bt(`Expected first argument to be of type array or string, but found ${Lr(Re(s))} instead.`);if(this.endIndex){const _=this.endIndex.evaluate(e);return s.slice(h,_)}return s.slice(h)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}}function yc(i,e){return i==="=="||i==="!="?e.kind==="boolean"||e.kind==="string"||e.kind==="number"||e.kind==="null"||e.kind==="value":e.kind==="string"||e.kind==="number"||e.kind==="value"}function vc(i,e,s,h){return h.compare(e,s)===0}function $a(i,e,s){const h=i!=="=="&&i!=="!=";return class iy{constructor(v,E,C){this.type=hr,this.lhs=v,this.rhs=E,this.collator=C,this.hasUntypedArgument=v.type.kind==="value"||E.type.kind==="value"}static parse(v,E){if(v.length!==3&&v.length!==4)return E.error("Expected two or three arguments.");const C=v[0];let M=E.parse(v[1],1,sr);if(!M)return null;if(!yc(C,M.type))return E.concat(1).error(`"${C}" comparisons are not supported for type '${Lr(M.type)}'.`);let F=E.parse(v[2],2,sr);if(!F)return null;if(!yc(C,F.type))return E.concat(2).error(`"${C}" comparisons are not supported for type '${Lr(F.type)}'.`);if(M.type.kind!==F.type.kind&&M.type.kind!=="value"&&F.type.kind!=="value")return E.error(`Cannot compare types '${Lr(M.type)}' and '${Lr(F.type)}'.`);h&&(M.type.kind==="value"&&F.type.kind!=="value"?M=new Yt(F.type,[M]):M.type.kind!=="value"&&F.type.kind==="value"&&(F=new Yt(M.type,[F])));let j=null;if(v.length===4){if(M.type.kind!=="string"&&F.type.kind!=="string"&&M.type.kind!=="value"&&F.type.kind!=="value")return E.error("Cannot use collator to compare non-string types.");if(j=E.parse(v[3],3,Vi),!j)return null}return new iy(M,F,j)}evaluate(v){const E=this.lhs.evaluate(v),C=this.rhs.evaluate(v);if(h&&this.hasUntypedArgument){const M=Re(E),F=Re(C);if(M.kind!==F.kind||M.kind!=="string"&&M.kind!=="number")throw new bt(`Expected arguments for "${i}" to be (string, string) or (number, number), but found (${M.kind}, ${F.kind}) instead.`)}if(this.collator&&!h&&this.hasUntypedArgument){const M=Re(E),F=Re(C);if(M.kind!=="string"||F.kind!=="string")return e(v,E,C)}return this.collator?s(v,E,C,this.collator.evaluate(v)):e(v,E,C)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const Ju=$a("==",function(i,e,s){return e===s},vc),Yu=$a("!=",function(i,e,s){return e!==s},function(i,e,s,h){return!vc(0,e,s,h)}),Qu=$a("<",function(i,e,s){return e",function(i,e,s){return e>s},function(i,e,s,h){return h.compare(e,s)>0}),th=$a("<=",function(i,e,s){return e<=s},function(i,e,s,h){return h.compare(e,s)<=0}),rh=$a(">=",function(i,e,s){return e>=s},function(i,e,s,h){return h.compare(e,s)>=0});class nl{constructor(e,s,h,_,v){this.type=pr,this.number=e,this.locale=s,this.currency=h,this.minFractionDigits=_,this.maxFractionDigits=v}static parse(e,s){if(e.length!==3)return s.error("Expected two arguments.");const h=s.parse(e[1],1,Tt);if(!h)return null;const _=e[2];if(typeof _!="object"||Array.isArray(_))return s.error("NumberFormat options argument must be an object.");let v=null;if(_.locale&&(v=s.parse(_.locale,1,pr),!v))return null;let E=null;if(_.currency&&(E=s.parse(_.currency,1,pr),!E))return null;let C=null;if(_["min-fraction-digits"]&&(C=s.parse(_["min-fraction-digits"],1,Tt),!C))return null;let M=null;return _["max-fraction-digits"]&&(M=s.parse(_["max-fraction-digits"],1,Tt),!M)?null:new nl(h,v,E,C,M)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}}class ao{constructor(e){this.type=ii,this.sections=e}static parse(e,s){if(e.length<2)return s.error("Expected at least one argument.");const h=e[1];if(!Array.isArray(h)&&typeof h=="object")return s.error("First argument must be an image or text section.");const _=[];let v=!1;for(let E=1;E<=e.length-1;++E){const C=e[E];if(v&&typeof C=="object"&&!Array.isArray(C)){v=!1;let M=null;if(C["font-scale"]&&(M=s.parse(C["font-scale"],1,Tt),!M))return null;let F=null;if(C["text-font"]&&(F=s.parse(C["text-font"],1,Oi(pr)),!F))return null;let j=null;if(C["text-color"]&&(j=s.parse(C["text-color"],1,yi),!j))return null;const W=_[_.length-1];W.scale=M,W.font=F,W.textColor=j}else{const M=s.parse(e[E],1,sr);if(!M)return null;const F=M.type.kind;if(F!=="string"&&F!=="value"&&F!=="null"&&F!=="resolvedImage")return s.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,_.push({content:M,scale:null,font:null,textColor:null})}}return new ao(_)}evaluate(e){return new Ee(this.sections.map(s=>{const h=s.content.evaluate(e);return Re(h)===ui?new Se("",h,null,null,null):new Se(Ct(h),null,s.scale?s.scale.evaluate(e):null,s.font?s.font.evaluate(e).join(","):null,s.textColor?s.textColor.evaluate(e):null)}))}eachChild(e){for(const s of this.sections)e(s.content),s.scale&&e(s.scale),s.font&&e(s.font),s.textColor&&e(s.textColor)}outputDefined(){return!1}}class al{constructor(e){this.type=ui,this.input=e}static parse(e,s){if(e.length!==2)return s.error("Expected two arguments.");const h=s.parse(e[1],1,pr);return h?new al(h):s.error("No image name provided.")}evaluate(e){const s=this.input.evaluate(e),h=Te.fromString(s);return h&&e.availableImages&&(h.available=e.availableImages.indexOf(s)>-1),h}eachChild(e){e(this.input)}outputDefined(){return!1}}class sl{constructor(e){this.type=Tt,this.input=e}static parse(e,s){if(e.length!==2)return s.error(`Expected 1 argument, but found ${e.length-1} instead.`);const h=s.parse(e[1],1);return h?h.type.kind!=="array"&&h.type.kind!=="string"&&h.type.kind!=="value"?s.error(`Expected argument of type string or array, but found ${Lr(h.type)} instead.`):new sl(h):null}evaluate(e){const s=this.input.evaluate(e);if(typeof s=="string"||Array.isArray(s))return s.length;throw new bt(`Expected value to be of type string or array, but found ${Lr(Re(s))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}}const ja={"==":Ju,"!=":Yu,">":eh,"<":Qu,">=":rh,"<=":th,array:Yt,at:el,boolean:Yt,case:il,coalesce:to,collator:Qr,format:ao,image:al,in:tl,"index-of":io,interpolate:an,"interpolate-hcl":an,"interpolate-lab":an,length:sl,let:ro,literal:Pt,match:rl,number:Yt,"number-format":nl,object:Yt,slice:no,step:ds,string:Yt,"to-boolean":or,"to-color":or,"to-number":or,"to-string":or,var:Ys,within:wa};function bc(i,[e,s,h,_]){e=e.evaluate(i),s=s.evaluate(i),h=h.evaluate(i);const v=_?_.evaluate(i):1,E=Ge(e,s,h,v);if(E)throw new bt(E);return new Q(e/255*v,s/255*v,h/255*v,v)}function xc(i,e){return i in e}function so(i,e){const s=e[i];return s===void 0?null:s}function Ea(i){return{type:i}}function wc(i){return{result:"success",value:i}}function qa(i){return{result:"error",value:i}}function ei(i){return i["property-type"]==="data-driven"||i["property-type"]==="cross-faded-data-driven"}function Ec(i){return!!i.expression&&i.expression.parameters.indexOf("zoom")>-1}function Cr(i){return!!i.expression&&i.expression.interpolated}function Fr(i){return i instanceof Number?"number":i instanceof String?"string":i instanceof Boolean?"boolean":Array.isArray(i)?"array":i===null?"null":typeof i}function Yr(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)}function ai(i){return i}function _s(i,e){const s=e.type==="color",h=i.stops&&typeof i.stops[0][0]=="object",_=h||!(h||i.property!==void 0),v=i.type||(Cr(e)?"exponential":"interval");if(s||e.type==="padding"){const F=s?Q.parse:ve.parse;(i=ri({},i)).stops&&(i.stops=i.stops.map(j=>[j[0],F(j[1])])),i.default=F(i.default?i.default:e.default)}if(i.colorSpace&&i.colorSpace!=="rgb"&&!_c[i.colorSpace])throw new Error(`Unknown color space: ${i.colorSpace}`);let E,C,M;if(v==="exponential")E=kc;else if(v==="interval")E=nh;else if(v==="categorical"){E=ih,C=Object.create(null);for(const F of i.stops)C[F[0]]=F[1];M=typeof i.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);E=ah}if(h){const F={},j=[];for(let ne=0;nene[0]),evaluate:({zoom:ne},se)=>kc({stops:W,base:i.base},e,ne).evaluate(ne,se)}}if(_){const F=v==="exponential"?{name:"exponential",base:i.base!==void 0?i.base:1}:null;return{kind:"camera",interpolationType:F,interpolationFactor:an.interpolationFactor.bind(void 0,F),zoomStops:i.stops.map(j=>j[0]),evaluate:({zoom:j})=>E(i,e,j,C,M)}}return{kind:"source",evaluate(F,j){const W=j&&j.properties?j.properties[i.property]:void 0;return W===void 0?Ga(i.default,e.default):E(i,e,W,C,M)}}}function Ga(i,e,s){return i!==void 0?i:e!==void 0?e:s!==void 0?s:void 0}function ih(i,e,s,h,_){return Ga(typeof s===_?h[s]:void 0,i.default,e.default)}function nh(i,e,s){if(Fr(s)!=="number")return Ga(i.default,e.default);const h=i.stops.length;if(h===1||s<=i.stops[0][0])return i.stops[0][1];if(s>=i.stops[h-1][0])return i.stops[h-1][1];const _=Qs(i.stops.map(v=>v[0]),s);return i.stops[_][1]}function kc(i,e,s){const h=i.base!==void 0?i.base:1;if(Fr(s)!=="number")return Ga(i.default,e.default);const _=i.stops.length;if(_===1||s<=i.stops[0][0])return i.stops[0][1];if(s>=i.stops[_-1][0])return i.stops[_-1][1];const v=Qs(i.stops.map(j=>j[0]),s),E=function(j,W,X,ne){const se=ne-X,ke=j-X;return se===0?0:W===1?ke/se:(Math.pow(W,ke)-1)/(Math.pow(W,se)-1)}(s,h,i.stops[v][0],i.stops[v+1][0]),C=i.stops[v][1],M=i.stops[v+1][1];let F=ps[e.type]||ai;if(i.colorSpace&&i.colorSpace!=="rgb"){const j=_c[i.colorSpace];F=(W,X)=>j.reverse(j.interpolate(j.forward(W),j.forward(X),E))}return typeof C.evaluate=="function"?{evaluate(...j){const W=C.evaluate.apply(void 0,j),X=M.evaluate.apply(void 0,j);if(W!==void 0&&X!==void 0)return F(W,X,E)}}:F(C,M,E)}function ah(i,e,s){switch(e.type){case"color":s=Q.parse(s);break;case"formatted":s=Ee.fromString(s.toString());break;case"resolvedImage":s=Te.fromString(s.toString());break;case"padding":s=ve.parse(s);break;default:Fr(s)===e.type||e.type==="enum"&&e.values[s]||(s=void 0)}return Ga(s,i.default,e.default)}Tr.register(ja,{error:[{kind:"error"},[pr],(i,[e])=>{throw new bt(e.evaluate(i))}],typeof:[pr,[sr],(i,[e])=>Lr(Re(e.evaluate(i)))],"to-rgba":[Oi(Tt,4),[yi],(i,[e])=>e.evaluate(i).toArray()],rgb:[yi,[Tt,Tt,Tt],bc],rgba:[yi,[Tt,Tt,Tt,Tt],bc],has:{type:hr,overloads:[[[pr],(i,[e])=>xc(e.evaluate(i),i.properties())],[[pr,nn],(i,[e,s])=>xc(e.evaluate(i),s.evaluate(i))]]},get:{type:sr,overloads:[[[pr],(i,[e])=>so(e.evaluate(i),i.properties())],[[pr,nn],(i,[e,s])=>so(e.evaluate(i),s.evaluate(i))]]},"feature-state":[sr,[pr],(i,[e])=>so(e.evaluate(i),i.featureState||{})],properties:[nn,[],i=>i.properties()],"geometry-type":[pr,[],i=>i.geometryType()],id:[sr,[],i=>i.id()],zoom:[Tt,[],i=>i.globals.zoom],"heatmap-density":[Tt,[],i=>i.globals.heatmapDensity||0],"line-progress":[Tt,[],i=>i.globals.lineProgress||0],accumulated:[sr,[],i=>i.globals.accumulated===void 0?null:i.globals.accumulated],"+":[Tt,Ea(Tt),(i,e)=>{let s=0;for(const h of e)s+=h.evaluate(i);return s}],"*":[Tt,Ea(Tt),(i,e)=>{let s=1;for(const h of e)s*=h.evaluate(i);return s}],"-":{type:Tt,overloads:[[[Tt,Tt],(i,[e,s])=>e.evaluate(i)-s.evaluate(i)],[[Tt],(i,[e])=>-e.evaluate(i)]]},"/":[Tt,[Tt,Tt],(i,[e,s])=>e.evaluate(i)/s.evaluate(i)],"%":[Tt,[Tt,Tt],(i,[e,s])=>e.evaluate(i)%s.evaluate(i)],ln2:[Tt,[],()=>Math.LN2],pi:[Tt,[],()=>Math.PI],e:[Tt,[],()=>Math.E],"^":[Tt,[Tt,Tt],(i,[e,s])=>Math.pow(e.evaluate(i),s.evaluate(i))],sqrt:[Tt,[Tt],(i,[e])=>Math.sqrt(e.evaluate(i))],log10:[Tt,[Tt],(i,[e])=>Math.log(e.evaluate(i))/Math.LN10],ln:[Tt,[Tt],(i,[e])=>Math.log(e.evaluate(i))],log2:[Tt,[Tt],(i,[e])=>Math.log(e.evaluate(i))/Math.LN2],sin:[Tt,[Tt],(i,[e])=>Math.sin(e.evaluate(i))],cos:[Tt,[Tt],(i,[e])=>Math.cos(e.evaluate(i))],tan:[Tt,[Tt],(i,[e])=>Math.tan(e.evaluate(i))],asin:[Tt,[Tt],(i,[e])=>Math.asin(e.evaluate(i))],acos:[Tt,[Tt],(i,[e])=>Math.acos(e.evaluate(i))],atan:[Tt,[Tt],(i,[e])=>Math.atan(e.evaluate(i))],min:[Tt,Ea(Tt),(i,e)=>Math.min(...e.map(s=>s.evaluate(i)))],max:[Tt,Ea(Tt),(i,e)=>Math.max(...e.map(s=>s.evaluate(i)))],abs:[Tt,[Tt],(i,[e])=>Math.abs(e.evaluate(i))],round:[Tt,[Tt],(i,[e])=>{const s=e.evaluate(i);return s<0?-Math.round(-s):Math.round(s)}],floor:[Tt,[Tt],(i,[e])=>Math.floor(e.evaluate(i))],ceil:[Tt,[Tt],(i,[e])=>Math.ceil(e.evaluate(i))],"filter-==":[hr,[pr,sr],(i,[e,s])=>i.properties()[e.value]===s.value],"filter-id-==":[hr,[sr],(i,[e])=>i.id()===e.value],"filter-type-==":[hr,[pr],(i,[e])=>i.geometryType()===e.value],"filter-<":[hr,[pr,sr],(i,[e,s])=>{const h=i.properties()[e.value],_=s.value;return typeof h==typeof _&&h<_}],"filter-id-<":[hr,[sr],(i,[e])=>{const s=i.id(),h=e.value;return typeof s==typeof h&&s":[hr,[pr,sr],(i,[e,s])=>{const h=i.properties()[e.value],_=s.value;return typeof h==typeof _&&h>_}],"filter-id->":[hr,[sr],(i,[e])=>{const s=i.id(),h=e.value;return typeof s==typeof h&&s>h}],"filter-<=":[hr,[pr,sr],(i,[e,s])=>{const h=i.properties()[e.value],_=s.value;return typeof h==typeof _&&h<=_}],"filter-id-<=":[hr,[sr],(i,[e])=>{const s=i.id(),h=e.value;return typeof s==typeof h&&s<=h}],"filter->=":[hr,[pr,sr],(i,[e,s])=>{const h=i.properties()[e.value],_=s.value;return typeof h==typeof _&&h>=_}],"filter-id->=":[hr,[sr],(i,[e])=>{const s=i.id(),h=e.value;return typeof s==typeof h&&s>=h}],"filter-has":[hr,[sr],(i,[e])=>e.value in i.properties()],"filter-has-id":[hr,[],i=>i.id()!==null&&i.id()!==void 0],"filter-type-in":[hr,[Oi(pr)],(i,[e])=>e.value.indexOf(i.geometryType())>=0],"filter-id-in":[hr,[Oi(sr)],(i,[e])=>e.value.indexOf(i.id())>=0],"filter-in-small":[hr,[pr,Oi(sr)],(i,[e,s])=>s.value.indexOf(i.properties()[e.value])>=0],"filter-in-large":[hr,[pr,Oi(sr)],(i,[e,s])=>function(h,_,v,E){for(;v<=E;){const C=v+E>>1;if(_[C]===h)return!0;_[C]>h?E=C-1:v=C+1}return!1}(i.properties()[e.value],s.value,0,s.value.length-1)],all:{type:hr,overloads:[[[hr,hr],(i,[e,s])=>e.evaluate(i)&&s.evaluate(i)],[Ea(hr),(i,e)=>{for(const s of e)if(!s.evaluate(i))return!1;return!0}]]},any:{type:hr,overloads:[[[hr,hr],(i,[e,s])=>e.evaluate(i)||s.evaluate(i)],[Ea(hr),(i,e)=>{for(const s of e)if(s.evaluate(i))return!0;return!1}]]},"!":[hr,[hr],(i,[e])=>!e.evaluate(i)],"is-supported-script":[hr,[pr],(i,[e])=>{const s=i.globals&&i.globals.isSupportedScript;return!s||s(e.evaluate(i))}],upcase:[pr,[pr],(i,[e])=>e.evaluate(i).toUpperCase()],downcase:[pr,[pr],(i,[e])=>e.evaluate(i).toLowerCase()],concat:[pr,Ea(sr),(i,e)=>e.map(s=>Ct(s.evaluate(i))).join("")],"resolved-locale":[pr,[Vi],(i,[e])=>e.evaluate(i).resolvedLocale()]});class oo{constructor(e,s){this.expression=e,this._warningHistory={},this._evaluator=new dr,this._defaultValue=s?function(h){return h.type==="color"&&Yr(h.default)?new Q(0,0,0,0):h.type==="color"?Q.parse(h.default)||null:h.type==="padding"?ve.parse(h.default)||null:h.default===void 0?null:h.default}(s):null,this._enumValues=s&&s.type==="enum"?s.values:null}evaluateWithoutErrorHandling(e,s,h,_,v,E){return this._evaluator.globals=e,this._evaluator.feature=s,this._evaluator.featureState=h,this._evaluator.canonical=_,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E,this.expression.evaluate(this._evaluator)}evaluate(e,s,h,_,v,E){this._evaluator.globals=e,this._evaluator.feature=s||null,this._evaluator.featureState=h||null,this._evaluator.canonical=_,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=E||null;try{const C=this.expression.evaluate(this._evaluator);if(C==null||typeof C=="number"&&C!=C)return this._defaultValue;if(this._enumValues&&!(C in this._enumValues))throw new bt(`Expected value to be one of ${Object.keys(this._enumValues).map(M=>JSON.stringify(M)).join(", ")}, but found ${JSON.stringify(C)} instead.`);return C}catch(C){return this._warningHistory[C.message]||(this._warningHistory[C.message]=!0,typeof console<"u"&&console.warn(C.message)),this._defaultValue}}}function ys(i){return Array.isArray(i)&&i.length>0&&typeof i[0]=="string"&&i[0]in ja}function vs(i,e){const s=new Va(ja,[],e?function(_){const v={color:yi,string:pr,number:Tt,enum:pr,boolean:hr,formatted:ii,padding:aa,resolvedImage:ui};return _.type==="array"?Oi(v[_.value]||sr,_.length):v[_.type]}(e):void 0),h=s.parse(i,void 0,void 0,void 0,e&&e.type==="string"?{typeAnnotation:"coerce"}:void 0);return h?wc(new oo(h,e)):qa(s.errors)}class bs{constructor(e,s){this.kind=e,this._styleExpression=s,this.isStateDependent=e!=="constant"&&!Ua(s.expression)}evaluateWithoutErrorHandling(e,s,h,_,v,E){return this._styleExpression.evaluateWithoutErrorHandling(e,s,h,_,v,E)}evaluate(e,s,h,_,v,E){return this._styleExpression.evaluate(e,s,h,_,v,E)}}class ol{constructor(e,s,h,_){this.kind=e,this.zoomStops=h,this._styleExpression=s,this.isStateDependent=e!=="camera"&&!Ua(s.expression),this.interpolationType=_}evaluateWithoutErrorHandling(e,s,h,_,v,E){return this._styleExpression.evaluateWithoutErrorHandling(e,s,h,_,v,E)}evaluate(e,s,h,_,v,E){return this._styleExpression.evaluate(e,s,h,_,v,E)}interpolationFactor(e,s,h){return this.interpolationType?an.interpolationFactor(this.interpolationType,e,s,h):0}}function Sc(i,e){const s=vs(i,e);if(s.result==="error")return s;const h=s.value.expression,_=fs(h);if(!_&&!ei(e))return qa([new gi("","data expressions not supported")]);const v=Js(h,["zoom"]);if(!v&&!Ec(e))return qa([new gi("","zoom expressions not supported")]);const E=co(h);return E||v?E instanceof gi?qa([E]):E instanceof an&&!Cr(e)?qa([new gi("",'"interpolate" expressions cannot be used with this property')]):wc(E?new ol(_?"camera":"composite",s.value,E.labels,E instanceof an?E.interpolation:void 0):new bs(_?"constant":"source",s.value)):qa([new gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class lo{constructor(e,s){this._parameters=e,this._specification=s,ri(this,_s(this._parameters,this._specification))}static deserialize(e){return new lo(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function co(i){let e=null;if(i instanceof ro)e=co(i.result);else if(i instanceof to){for(const s of i.args)if(e=co(s),e)break}else(i instanceof ds||i instanceof an)&&i.input instanceof Tr&&i.input.name==="zoom"&&(e=i);return e instanceof gi||i.eachChild(s=>{const h=co(s);h instanceof gi?e=h:!e&&h?e=new gi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):e&&h&&e!==h&&(e=new gi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),e}function En(i){const e=i.key,s=i.value,h=i.valueSpec||{},_=i.objectElementValidators||{},v=i.style,E=i.styleSpec;let C=[];const M=Fr(s);if(M!=="object")return[new gt(e,s,`object expected, ${M} found`)];for(const F in s){const j=F.split(".")[0],W=h[j]||h["*"];let X;if(_[j])X=_[j];else if(h[j])X=on;else if(_["*"])X=_["*"];else{if(!h["*"]){C.push(new gt(e,s[F],`unknown property "${F}"`));continue}X=on}C=C.concat(X({key:(e&&`${e}.`)+F,value:s[F],valueSpec:W,style:v,styleSpec:E,object:s,objectKey:F},s))}for(const F in h)_[F]||h[F].required&&h[F].default===void 0&&s[F]===void 0&&C.push(new gt(e,s,`missing required property "${F}"`));return C}function Tc(i){const e=i.value,s=i.valueSpec,h=i.style,_=i.styleSpec,v=i.key,E=i.arrayElementValidator||on;if(Fr(e)!=="array")return[new gt(v,e,`array expected, ${Fr(e)} found`)];if(s.length&&e.length!==s.length)return[new gt(v,e,`array length ${s.length} expected, length ${e.length} found`)];if(s["min-length"]&&e.lengthh.maximum?[new gt(e,s,`${s} is greater than the maximum value ${h.maximum}`)]:[]}function Ic(i){const e=i.valueSpec,s=yr(i.value.type);let h,_,v,E={};const C=s!=="categorical"&&i.value.property===void 0,M=!C,F=Fr(i.value.stops)==="array"&&Fr(i.value.stops[0])==="array"&&Fr(i.value.stops[0][0])==="object",j=En({key:i.key,value:i.value,valueSpec:i.styleSpec.function,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{stops:function(ne){if(s==="identity")return[new gt(ne.key,ne.value,'identity function may not have a "stops" property')];let se=[];const ke=ne.value;return se=se.concat(Tc({key:ne.key,value:ke,valueSpec:ne.valueSpec,style:ne.style,styleSpec:ne.styleSpec,arrayElementValidator:W})),Fr(ke)==="array"&&ke.length===0&&se.push(new gt(ne.key,ke,"array must have at least one stop")),se},default:function(ne){return on({key:ne.key,value:ne.value,valueSpec:e,style:ne.style,styleSpec:ne.styleSpec})}}});return s==="identity"&&C&&j.push(new gt(i.key,i.value,'missing required property "property"')),s==="identity"||i.value.stops||j.push(new gt(i.key,i.value,'missing required property "stops"')),s==="exponential"&&i.valueSpec.expression&&!Cr(i.valueSpec)&&j.push(new gt(i.key,i.value,"exponential functions not supported")),i.styleSpec.$version>=8&&(M&&!ei(i.valueSpec)?j.push(new gt(i.key,i.value,"property functions not supported")):C&&!Ec(i.valueSpec)&&j.push(new gt(i.key,i.value,"zoom functions not supported"))),s!=="categorical"&&!F||i.value.property!==void 0||j.push(new gt(i.key,i.value,'"property" property is required')),j;function W(ne){let se=[];const ke=ne.value,we=ne.key;if(Fr(ke)!=="array")return[new gt(we,ke,`array expected, ${Fr(ke)} found`)];if(ke.length!==2)return[new gt(we,ke,`array length 2 expected, length ${ke.length} found`)];if(F){if(Fr(ke[0])!=="object")return[new gt(we,ke,`object expected, ${Fr(ke[0])} found`)];if(ke[0].zoom===void 0)return[new gt(we,ke,"object stop key must have zoom")];if(ke[0].value===void 0)return[new gt(we,ke,"object stop key must have value")];if(v&&v>yr(ke[0].zoom))return[new gt(we,ke[0].zoom,"stop zoom values must appear in ascending order")];yr(ke[0].zoom)!==v&&(v=yr(ke[0].zoom),_=void 0,E={}),se=se.concat(En({key:`${we}[0]`,value:ke[0],valueSpec:{zoom:{}},style:ne.style,styleSpec:ne.styleSpec,objectElementValidators:{zoom:ll,value:X}}))}else se=se.concat(X({key:`${we}[0]`,value:ke[0],valueSpec:{},style:ne.style,styleSpec:ne.styleSpec},ke));return ys(Sr(ke[1]))?se.concat([new gt(`${we}[1]`,ke[1],"expressions are not allowed in function stops.")]):se.concat(on({key:`${we}[1]`,value:ke[1],valueSpec:e,style:ne.style,styleSpec:ne.styleSpec}))}function X(ne,se){const ke=Fr(ne.value),we=yr(ne.value),Oe=ne.value!==null?ne.value:se;if(h){if(ke!==h)return[new gt(ne.key,Oe,`${ke} stop domain type must match previous stop domain type ${h}`)]}else h=ke;if(ke!=="number"&&ke!=="string"&&ke!=="boolean")return[new gt(ne.key,Oe,"stop domain value must be a number, string, or boolean")];if(ke!=="number"&&s!=="categorical"){let Qe=`number expected, ${ke} found`;return ei(e)&&s===void 0&&(Qe+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new gt(ne.key,Oe,Qe)]}return s!=="categorical"||ke!=="number"||isFinite(we)&&Math.floor(we)===we?s!=="categorical"&&ke==="number"&&_!==void 0&&we<_?[new gt(ne.key,Oe,"stop domain values must appear in ascending order")]:(_=we,s==="categorical"&&we in E?[new gt(ne.key,Oe,"stop domain values must be unique")]:(E[we]=!0,[])):[new gt(ne.key,Oe,`integer expected, found ${we}`)]}}function ka(i){const e=(i.expressionContext==="property"?Sc:vs)(Sr(i.value),i.valueSpec);if(e.result==="error")return e.value.map(h=>new gt(`${i.key}${h.key}`,i.value,h.message));const s=e.value.expression||e.value._styleExpression.expression;if(i.expressionContext==="property"&&i.propertyKey==="text-font"&&!s.outputDefined())return[new gt(i.key,i.value,`Invalid data expression for "${i.propertyKey}". Output values must be contained as literals within the expression.`)];if(i.expressionContext==="property"&&i.propertyType==="layout"&&!Ua(s))return[new gt(i.key,i.value,'"feature-state" data expressions are not supported with layout properties.')];if(i.expressionContext==="filter"&&!Ua(s))return[new gt(i.key,i.value,'"feature-state" data expressions are not supported with filters.')];if(i.expressionContext&&i.expressionContext.indexOf("cluster")===0){if(!Js(s,["zoom","feature-state"]))return[new gt(i.key,i.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(i.expressionContext==="cluster-initial"&&!fs(s))return[new gt(i.key,i.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function xs(i){const e=i.key,s=i.value,h=i.valueSpec,_=[];return Array.isArray(h.values)?h.values.indexOf(yr(s))===-1&&_.push(new gt(e,s,`expected one of [${h.values.join(", ")}], ${JSON.stringify(s)} found`)):Object.keys(h.values).indexOf(yr(s))===-1&&_.push(new gt(e,s,`expected one of [${Object.keys(h.values).join(", ")}], ${JSON.stringify(s)} found`)),_}function Za(i){if(i===!0||i===!1)return!0;if(!Array.isArray(i)||i.length===0)return!1;switch(i[0]){case"has":return i.length>=2&&i[1]!=="$id"&&i[1]!=="$type";case"in":return i.length>=3&&(typeof i[1]!="string"||Array.isArray(i[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return i.length!==3||Array.isArray(i[1])||Array.isArray(i[2]);case"any":case"all":for(const e of i.slice(1))if(!Za(e)&&typeof e!="boolean")return!1;return!0;default:return!0}}const sh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function uo(i){if(i==null)return{filter:()=>!0,needGeometry:!1};Za(i)||(i=ws(i));const e=vs(i,sh);if(e.result==="error")throw new Error(e.value.map(s=>`${s.key}: ${s.message}`).join(", "));return{filter:(s,h,_)=>e.value.evaluate(s,h,{},_),needGeometry:Ac(i)}}function Cc(i,e){return ie?1:0}function Ac(i){if(!Array.isArray(i))return!1;if(i[0]==="within")return!0;for(let e=1;e"||e==="<="||e===">="?cl(i[1],i[2],e):e==="any"?(s=i.slice(1),["any"].concat(s.map(ws))):e==="all"?["all"].concat(i.slice(1).map(ws)):e==="none"?["all"].concat(i.slice(1).map(ws).map(Ha)):e==="in"?ho(i[1],i.slice(2)):e==="!in"?Ha(ho(i[1],i.slice(2))):e==="has"?Es(i[1]):e==="!has"?Ha(Es(i[1])):e!=="within"||i;var s}function cl(i,e,s){switch(i){case"$type":return[`filter-type-${s}`,e];case"$id":return[`filter-id-${s}`,e];default:return[`filter-${s}`,i,e]}}function ho(i,e){if(e.length===0)return!1;switch(i){case"$type":return["filter-type-in",["literal",e]];case"$id":return["filter-id-in",["literal",e]];default:return e.length>200&&!e.some(s=>typeof s!=typeof e[0])?["filter-in-large",i,["literal",e.sort(Cc)]]:["filter-in-small",i,["literal",e]]}}function Es(i){switch(i){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",i]}}function Ha(i){return["!",i]}function ks(i){return Za(Sr(i.value))?ka(ri({},i,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Pc(i)}function Pc(i){const e=i.value,s=i.key;if(Fr(e)!=="array")return[new gt(s,e,`array expected, ${Fr(e)} found`)];const h=i.styleSpec;let _,v=[];if(e.length<1)return[new gt(s,e,"filter array must have at least 1 element")];switch(v=v.concat(xs({key:`${s}[0]`,value:e[0],valueSpec:h.filter_operator,style:i.style,styleSpec:i.styleSpec})),yr(e[0])){case"<":case"<=":case">":case">=":e.length>=2&&yr(e[1])==="$type"&&v.push(new gt(s,e,`"$type" cannot be use with operator "${e[0]}"`));case"==":case"!=":e.length!==3&&v.push(new gt(s,e,`filter array for operator "${e[0]}" must have 3 elements`));case"in":case"!in":e.length>=2&&(_=Fr(e[1]),_!=="string"&&v.push(new gt(`${s}[1]`,e[1],`string expected, ${_} found`)));for(let E=2;E{F in s&&e.push(new gt(h,s[F],`"${F}" is prohibited for ref layers`))}),_.layers.forEach(F=>{yr(F.id)===C&&(M=F)}),M?M.ref?e.push(new gt(h,s.ref,"ref cannot reference another ref layer")):E=yr(M.type):e.push(new gt(h,s.ref,`ref layer "${C}" not found`))}else if(E!=="background")if(s.source){const M=_.sources&&_.sources[s.source],F=M&&yr(M.type);M?F==="vector"&&E==="raster"?e.push(new gt(h,s.source,`layer "${s.id}" requires a raster source`)):F==="raster"&&E!=="raster"?e.push(new gt(h,s.source,`layer "${s.id}" requires a vector source`)):F!=="vector"||s["source-layer"]?F==="raster-dem"&&E!=="hillshade"?e.push(new gt(h,s.source,"raster-dem source can only be used with layer type 'hillshade'.")):E!=="line"||!s.paint||!s.paint["line-gradient"]||F==="geojson"&&M.lineMetrics||e.push(new gt(h,s,`layer "${s.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):e.push(new gt(h,s,`layer "${s.id}" must specify a "source-layer"`)):e.push(new gt(h,s.source,`source "${s.source}" not found`))}else e.push(new gt(h,s,'missing required property "source"'));return e=e.concat(En({key:h,value:s,valueSpec:v.layer,style:i.style,styleSpec:i.styleSpec,objectElementValidators:{"*":()=>[],type:()=>on({key:`${h}.type`,value:s.type,valueSpec:v.layer.type,style:i.style,styleSpec:i.styleSpec,object:s,objectKey:"type"}),filter:ks,layout:M=>En({layer:s,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{"*":F=>Mc(ri({layerType:E},F))}}),paint:M=>En({layer:s,key:M.key,value:M.value,style:M.style,styleSpec:M.styleSpec,objectElementValidators:{"*":F=>zc(ri({layerType:E},F))}})}})),e}function Wa(i){const e=i.value,s=i.key,h=Fr(e);return h!=="string"?[new gt(s,e,`string expected, ${h} found`)]:[]}const Rc={promoteId:function({key:i,value:e}){if(Fr(e)==="string")return Wa({key:i,value:e});{const s=[];for(const h in e)s.push(...Wa({key:`${i}.${h}`,value:e[h]}));return s}}};function Ts(i){const e=i.value,s=i.key,h=i.styleSpec,_=i.style;if(!e.type)return[new gt(s,e,'"type" is required')];const v=yr(e.type);let E;switch(v){case"vector":case"raster":case"raster-dem":return E=En({key:s,value:e,valueSpec:h[`source_${v.replace("-","_")}`],style:i.style,styleSpec:h,objectElementValidators:Rc}),E;case"geojson":if(E=En({key:s,value:e,valueSpec:h.source_geojson,style:_,styleSpec:h,objectElementValidators:Rc}),e.cluster)for(const C in e.clusterProperties){const[M,F]=e.clusterProperties[C],j=typeof M=="string"?[M,["accumulated"],["get",C]]:M;E.push(...ka({key:`${s}.${C}.map`,value:F,expressionContext:"cluster-map"})),E.push(...ka({key:`${s}.${C}.reduce`,value:j,expressionContext:"cluster-reduce"}))}return E;case"video":return En({key:s,value:e,valueSpec:h.source_video,style:_,styleSpec:h});case"image":return En({key:s,value:e,valueSpec:h.source_image,style:_,styleSpec:h});case"canvas":return[new gt(s,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return xs({key:`${s}.type`,value:e.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:_,styleSpec:h})}}function Is(i){const e=i.value,s=i.styleSpec,h=s.light,_=i.style;let v=[];const E=Fr(e);if(e===void 0)return v;if(E!=="object")return v=v.concat([new gt("light",e,`object expected, ${E} found`)]),v;for(const C in e){const M=C.match(/^(.*)-transition$/);v=v.concat(M&&h[M[1]]&&h[M[1]].transition?on({key:C,value:e[C],valueSpec:s.transition,style:_,styleSpec:s}):h[C]?on({key:C,value:e[C],valueSpec:h[C],style:_,styleSpec:s}):[new gt(C,e[C],`unknown property "${C}"`)])}return v}function sn(i){const e=i.value,s=i.styleSpec,h=s.terrain,_=i.style;let v=[];const E=Fr(e);if(e===void 0)return v;if(E!=="object")return v=v.concat([new gt("terrain",e,`object expected, ${E} found`)]),v;for(const C in e)v=v.concat(h[C]?on({key:C,value:e[C],valueSpec:h[C],style:_,styleSpec:s}):[new gt(C,e[C],`unknown property "${C}"`)]);return v}const Cs={"*":()=>[],array:Tc,boolean:function(i){const e=i.value,s=i.key,h=Fr(e);return h!=="boolean"?[new gt(s,e,`boolean expected, ${h} found`)]:[]},number:ll,color:function(i){const e=i.key,s=i.value,h=Fr(s);return h!=="string"?[new gt(e,s,`color expected, ${h} found`)]:$n(s)===null?[new gt(e,s,`color expected, "${s}" found`)]:[]},constants:mi,enum:xs,filter:ks,function:Ic,layer:Dc,object:En,source:Ts,light:Is,terrain:sn,string:Wa,formatted:function(i){return Wa(i).length===0?[]:ka(i)},resolvedImage:function(i){return Wa(i).length===0?[]:ka(i)},padding:function(i){const e=i.key,s=i.value;if(Fr(s)==="array"){if(s.length<1||s.length>4)return[new gt(e,s,`padding requires 1 to 4 values; ${s.length} values found`)];const h={type:"number"};let _=[];for(let v=0;v[]}})),i.constants&&(s=s.concat(mi({key:"constants",value:i.constants,style:i,styleSpec:e}))),Lc(s)}function Lc(i){return[].concat(i).sort((e,s)=>e.line-s.line)}function Gn(i){return function(...e){return Lc(i.apply(this,e))}}ca.source=Gn(Ts),ca.light=Gn(Is),ca.terrain=Gn(sn),ca.layer=Gn(Dc),ca.filter=Gn(ks),ca.paintProperty=Gn(zc),ca.layoutProperty=Gn(Mc);const As=ca,ul=As.light,lh=As.paintProperty,ch=As.layoutProperty;function fo(i,e){let s=!1;if(e&&e.length)for(const h of e)i.fire(new Wt(new Error(h.message))),s=!0;return s}class Ps{constructor(e,s,h){const _=this.cells=[];if(e instanceof ArrayBuffer){this.arrayBuffer=e;const E=new Int32Array(this.arrayBuffer);e=E[0],this.d=(s=E[1])+2*(h=E[2]);for(let M=0;M=W[se+0]&&_>=W[se+1])?(C[ne]=!0,E.push(j[ne])):C[ne]=!1}}}}_forEachCell(e,s,h,_,v,E,C,M){const F=this._convertToCellCoord(e),j=this._convertToCellCoord(s),W=this._convertToCellCoord(h),X=this._convertToCellCoord(_);for(let ne=F;ne<=W;ne++)for(let se=j;se<=X;se++){const ke=this.d*se+ne;if((!M||M(this._convertFromCellCoord(ne),this._convertFromCellCoord(se),this._convertFromCellCoord(ne+1),this._convertFromCellCoord(se+1)))&&v.call(this,e,s,h,_,ke,E,C,M))return}}_convertFromCellCoord(e){return(e-this.padding)/this.scale}_convertToCellCoord(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const e=this.cells,s=3+this.cells.length+1+1;let h=0;for(let E=0;E=0)continue;const E=i[v];_[v]=Zn[h].shallow.indexOf(v)>=0?E:Sa(E,e)}i instanceof Error&&(_.message=i.message)}if(_.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(_.$name=h),_}throw new Error("can't serialize object of type "+typeof i)}function ua(i){if(i==null||typeof i=="boolean"||typeof i=="number"||typeof i=="string"||i instanceof Boolean||i instanceof Number||i instanceof String||i instanceof Date||i instanceof RegExp||i instanceof Blob||Bc(i)||Z(i)||ArrayBuffer.isView(i)||i instanceof ImageData)return i;if(Array.isArray(i))return i.map(ua);if(typeof i=="object"){const e=i.$name||"Object";if(!Zn[e])throw new Error(`can't deserialize unregistered class ${e}`);const{klass:s}=Zn[e];if(!s)throw new Error(`can't deserialize unregistered class ${e}`);if(s.deserialize)return s.deserialize(i);const h=Object.create(s.prototype);for(const _ of Object.keys(i)){if(_==="$name")continue;const v=i[_];h[_]=Zn[e].shallow.indexOf(_)>=0?v:ua(v)}return h}throw new Error("can't deserialize object of type "+typeof i)}class hl{constructor(){this.first=!0}update(e,s){const h=Math.floor(e);return this.first?(this.first=!1,this.lastIntegerZoom=h,this.lastIntegerZoomTime=0,this.lastZoom=e,this.lastFloorZoom=h,!0):(this.lastFloorZoom>h?(this.lastIntegerZoom=h+1,this.lastIntegerZoomTime=s):this.lastFloorZoomi>=128&&i<=255,Arabic:i=>i>=1536&&i<=1791,"Arabic Supplement":i=>i>=1872&&i<=1919,"Arabic Extended-A":i=>i>=2208&&i<=2303,"Hangul Jamo":i=>i>=4352&&i<=4607,"Unified Canadian Aboriginal Syllabics":i=>i>=5120&&i<=5759,Khmer:i=>i>=6016&&i<=6143,"Unified Canadian Aboriginal Syllabics Extended":i=>i>=6320&&i<=6399,"General Punctuation":i=>i>=8192&&i<=8303,"Letterlike Symbols":i=>i>=8448&&i<=8527,"Number Forms":i=>i>=8528&&i<=8591,"Miscellaneous Technical":i=>i>=8960&&i<=9215,"Control Pictures":i=>i>=9216&&i<=9279,"Optical Character Recognition":i=>i>=9280&&i<=9311,"Enclosed Alphanumerics":i=>i>=9312&&i<=9471,"Geometric Shapes":i=>i>=9632&&i<=9727,"Miscellaneous Symbols":i=>i>=9728&&i<=9983,"Miscellaneous Symbols and Arrows":i=>i>=11008&&i<=11263,"CJK Radicals Supplement":i=>i>=11904&&i<=12031,"Kangxi Radicals":i=>i>=12032&&i<=12255,"Ideographic Description Characters":i=>i>=12272&&i<=12287,"CJK Symbols and Punctuation":i=>i>=12288&&i<=12351,Hiragana:i=>i>=12352&&i<=12447,Katakana:i=>i>=12448&&i<=12543,Bopomofo:i=>i>=12544&&i<=12591,"Hangul Compatibility Jamo":i=>i>=12592&&i<=12687,Kanbun:i=>i>=12688&&i<=12703,"Bopomofo Extended":i=>i>=12704&&i<=12735,"CJK Strokes":i=>i>=12736&&i<=12783,"Katakana Phonetic Extensions":i=>i>=12784&&i<=12799,"Enclosed CJK Letters and Months":i=>i>=12800&&i<=13055,"CJK Compatibility":i=>i>=13056&&i<=13311,"CJK Unified Ideographs Extension A":i=>i>=13312&&i<=19903,"Yijing Hexagram Symbols":i=>i>=19904&&i<=19967,"CJK Unified Ideographs":i=>i>=19968&&i<=40959,"Yi Syllables":i=>i>=40960&&i<=42127,"Yi Radicals":i=>i>=42128&&i<=42191,"Hangul Jamo Extended-A":i=>i>=43360&&i<=43391,"Hangul Syllables":i=>i>=44032&&i<=55215,"Hangul Jamo Extended-B":i=>i>=55216&&i<=55295,"Private Use Area":i=>i>=57344&&i<=63743,"CJK Compatibility Ideographs":i=>i>=63744&&i<=64255,"Arabic Presentation Forms-A":i=>i>=64336&&i<=65023,"Vertical Forms":i=>i>=65040&&i<=65055,"CJK Compatibility Forms":i=>i>=65072&&i<=65103,"Small Form Variants":i=>i>=65104&&i<=65135,"Arabic Presentation Forms-B":i=>i>=65136&&i<=65279,"Halfwidth and Fullwidth Forms":i=>i>=65280&&i<=65519};function po(i){for(const e of i)if(dl(e.charCodeAt(0)))return!0;return!1}function uh(i){for(const e of i)if(!fl(e.charCodeAt(0)))return!1;return!0}function fl(i){return!(Ft.Arabic(i)||Ft["Arabic Supplement"](i)||Ft["Arabic Extended-A"](i)||Ft["Arabic Presentation Forms-A"](i)||Ft["Arabic Presentation Forms-B"](i))}function dl(i){return!(i!==746&&i!==747&&(i<4352||!(Ft["Bopomofo Extended"](i)||Ft.Bopomofo(i)||Ft["CJK Compatibility Forms"](i)&&!(i>=65097&&i<=65103)||Ft["CJK Compatibility Ideographs"](i)||Ft["CJK Compatibility"](i)||Ft["CJK Radicals Supplement"](i)||Ft["CJK Strokes"](i)||!(!Ft["CJK Symbols and Punctuation"](i)||i>=12296&&i<=12305||i>=12308&&i<=12319||i===12336)||Ft["CJK Unified Ideographs Extension A"](i)||Ft["CJK Unified Ideographs"](i)||Ft["Enclosed CJK Letters and Months"](i)||Ft["Hangul Compatibility Jamo"](i)||Ft["Hangul Jamo Extended-A"](i)||Ft["Hangul Jamo Extended-B"](i)||Ft["Hangul Jamo"](i)||Ft["Hangul Syllables"](i)||Ft.Hiragana(i)||Ft["Ideographic Description Characters"](i)||Ft.Kanbun(i)||Ft["Kangxi Radicals"](i)||Ft["Katakana Phonetic Extensions"](i)||Ft.Katakana(i)&&i!==12540||!(!Ft["Halfwidth and Fullwidth Forms"](i)||i===65288||i===65289||i===65293||i>=65306&&i<=65310||i===65339||i===65341||i===65343||i>=65371&&i<=65503||i===65507||i>=65512&&i<=65519)||!(!Ft["Small Form Variants"](i)||i>=65112&&i<=65118||i>=65123&&i<=65126)||Ft["Unified Canadian Aboriginal Syllabics"](i)||Ft["Unified Canadian Aboriginal Syllabics Extended"](i)||Ft["Vertical Forms"](i)||Ft["Yijing Hexagram Symbols"](i)||Ft["Yi Syllables"](i)||Ft["Yi Radicals"](i))))}function Oc(i){return!(dl(i)||function(e){return!!(Ft["Latin-1 Supplement"](e)&&(e===167||e===169||e===174||e===177||e===188||e===189||e===190||e===215||e===247)||Ft["General Punctuation"](e)&&(e===8214||e===8224||e===8225||e===8240||e===8241||e===8251||e===8252||e===8258||e===8263||e===8264||e===8265||e===8273)||Ft["Letterlike Symbols"](e)||Ft["Number Forms"](e)||Ft["Miscellaneous Technical"](e)&&(e>=8960&&e<=8967||e>=8972&&e<=8991||e>=8996&&e<=9e3||e===9003||e>=9085&&e<=9114||e>=9150&&e<=9165||e===9167||e>=9169&&e<=9179||e>=9186&&e<=9215)||Ft["Control Pictures"](e)&&e!==9251||Ft["Optical Character Recognition"](e)||Ft["Enclosed Alphanumerics"](e)||Ft["Geometric Shapes"](e)||Ft["Miscellaneous Symbols"](e)&&!(e>=9754&&e<=9759)||Ft["Miscellaneous Symbols and Arrows"](e)&&(e>=11026&&e<=11055||e>=11088&&e<=11097||e>=11192&&e<=11243)||Ft["CJK Symbols and Punctuation"](e)||Ft.Katakana(e)||Ft["Private Use Area"](e)||Ft["CJK Compatibility Forms"](e)||Ft["Small Form Variants"](e)||Ft["Halfwidth and Fullwidth Forms"](e)||e===8734||e===8756||e===8757||e>=9984&&e<=10087||e>=10102&&e<=10131||e===65532||e===65533)}(i))}function Fc(i){return i>=1424&&i<=2303||Ft["Arabic Presentation Forms-A"](i)||Ft["Arabic Presentation Forms-B"](i)}function hh(i,e){return!(!e&&Fc(i)||i>=2304&&i<=3583||i>=3840&&i<=4255||Ft.Khmer(i))}function Nc(i){for(const e of i)if(Fc(e.charCodeAt(0)))return!0;return!1}const pl="deferred",ml="loading",gl="loaded";let _l=null,Ji="unavailable",ha=null;const Uc=function(i){i&&typeof i=="string"&&i.indexOf("NetworkError")>-1&&(Ji="error"),_l&&_l(i)};function Ka(){yl.fire(new St("pluginStateChange",{pluginStatus:Ji,pluginURL:ha}))}const yl=new wr,zs=function(){return Ji},Vc=function(){if(Ji!==pl||!ha)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Ji=ml,Ka(),ha&&be({url:ha},i=>{i?Uc(i):(Ji=gl,Ka())})},_n={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Ji===gl||_n.applyArabicShaping!=null,isLoading:()=>Ji===ml,setState(i){if(!ce())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Ji=i.pluginStatus,ha=i.pluginURL},isParsed(){if(!ce())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return _n.applyArabicShaping!=null&&_n.processBidirectionalText!=null&&_n.processStyledBidirectionalText!=null},getPluginURL(){if(!ce())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return ha}};class si{constructor(e,s){this.zoom=e,s?(this.now=s.now,this.fadeDuration=s.fadeDuration,this.zoomHistory=s.zoomHistory,this.transition=s.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new hl,this.transition={})}isSupportedScript(e){return function(s,h){for(const _ of s)if(!hh(_.charCodeAt(0),h))return!1;return!0}(e,_n.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const e=this.zoom,s=e-Math.floor(e),h=this.crossFadingFactor();return e>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:s+(1-s)*h}:{fromScale:.5,toScale:1,t:1-(1-h)*s}}}class Ms{constructor(e,s){this.property=e,this.value=s,this.expression=function(h,_){if(Yr(h))return new lo(h,_);if(ys(h)){const v=Sc(h,_);if(v.result==="error")throw new Error(v.value.map(E=>`${E.key}: ${E.message}`).join(", "));return v.value}{let v=h;return _.type==="color"&&typeof h=="string"?v=Q.parse(h):_.type!=="padding"||typeof h!="number"&&!Array.isArray(h)||(v=ve.parse(h)),{kind:"constant",evaluate:()=>v}}}(s===void 0?e.specification.default:s,e.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(e,s,h){return this.property.possiblyEvaluate(this,e,s,h)}}class mo{constructor(e){this.property=e,this.value=new Ms(e,void 0)}transitioned(e,s){return new jc(this.property,this.value,s,P({},e.transition,this.transition),e.now)}untransitioned(){return new jc(this.property,this.value,null,{},0)}}class $c{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues)}getValue(e){return $(this._values[e].value.value)}setValue(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new mo(this._values[e].property)),this._values[e].value=new Ms(this._values[e].property,s===null?void 0:$(s))}getTransition(e){return $(this._values[e].transition)}setTransition(e,s){Object.prototype.hasOwnProperty.call(this._values,e)||(this._values[e]=new mo(this._values[e].property)),this._values[e].transition=$(s)||void 0}serialize(){const e={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(e[s]=h);const _=this.getTransition(s);_!==void 0&&(e[`${s}-transition`]=_)}return e}transitioned(e,s){const h=new qc(this._properties);for(const _ of Object.keys(this._values))h._values[_]=this._values[_].transitioned(e,s._values[_]);return h}untransitioned(){const e=new qc(this._properties);for(const s of Object.keys(this._values))e._values[s]=this._values[s].untransitioned();return e}}class jc{constructor(e,s,h,_,v){this.property=e,this.value=s,this.begin=v+_.delay||0,this.end=this.begin+_.duration||0,e.specification.transition&&(_.delay||_.duration)&&(this.prior=h)}possiblyEvaluate(e,s,h){const _=e.now||0,v=this.value.possiblyEvaluate(e,s,h),E=this.prior;if(E){if(_>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(_=1)return 1;const F=M*M,j=F*M;return 4*(M<.5?j:3*(M-F)+j-.75)}(C))}}return v}}class qc{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,s,h){const _=new Ds(this._properties);for(const v of Object.keys(this._values))_._values[v]=this._values[v].possiblyEvaluate(e,s,h);return _}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class fh{constructor(e){this._properties=e,this._values=Object.create(e.defaultPropertyValues)}getValue(e){return $(this._values[e].value)}setValue(e,s){this._values[e]=new Ms(this._values[e].property,s===null?void 0:$(s))}serialize(){const e={};for(const s of Object.keys(this._values)){const h=this.getValue(s);h!==void 0&&(e[s]=h)}return e}possiblyEvaluate(e,s,h){const _=new Ds(this._properties);for(const v of Object.keys(this._values))_._values[v]=this._values[v].possiblyEvaluate(e,s,h);return _}}class Mn{constructor(e,s,h){this.property=e,this.value=s,this.parameters=h}isConstant(){return this.value.kind==="constant"}constantOr(e){return this.value.kind==="constant"?this.value.value:e}evaluate(e,s,h,_){return this.property.evaluate(this.value,this.parameters,e,s,h,_)}}class Ds{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class Kt{constructor(e){this.specification=e}possiblyEvaluate(e,s){if(e.isDataDriven())throw new Error("Value should not be data driven");return e.expression.evaluate(s)}interpolate(e,s,h){const _=ps[this.specification.type];return _?_(e,s,h):e}}class lr{constructor(e,s){this.specification=e,this.overrides=s}possiblyEvaluate(e,s,h,_){return new Mn(this,e.expression.kind==="constant"||e.expression.kind==="camera"?{kind:"constant",value:e.expression.evaluate(s,null,{},h,_)}:e.expression,s)}interpolate(e,s,h){if(e.value.kind!=="constant"||s.value.kind!=="constant")return e;if(e.value.value===void 0||s.value.value===void 0)return new Mn(this,{kind:"constant",value:void 0},e.parameters);const _=ps[this.specification.type];return _?new Mn(this,{kind:"constant",value:_(e.value.value,s.value.value,h)},e.parameters):e}evaluate(e,s,h,_,v,E){return e.kind==="constant"?e.value:e.evaluate(s,h,_,v,E)}}class Xa extends lr{possiblyEvaluate(e,s,h,_){if(e.value===void 0)return new Mn(this,{kind:"constant",value:void 0},s);if(e.expression.kind==="constant"){const v=e.expression.evaluate(s,null,{},h,_),E=e.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,C=this._calculate(E,E,E,s);return new Mn(this,{kind:"constant",value:C},s)}if(e.expression.kind==="camera"){const v=this._calculate(e.expression.evaluate({zoom:s.zoom-1}),e.expression.evaluate({zoom:s.zoom}),e.expression.evaluate({zoom:s.zoom+1}),s);return new Mn(this,{kind:"constant",value:v},s)}return new Mn(this,e.expression,s)}evaluate(e,s,h,_,v,E){if(e.kind==="source"){const C=e.evaluate(s,h,_,v,E);return this._calculate(C,C,C,s)}return e.kind==="composite"?this._calculate(e.evaluate({zoom:Math.floor(s.zoom)-1},h,_),e.evaluate({zoom:Math.floor(s.zoom)},h,_),e.evaluate({zoom:Math.floor(s.zoom)+1},h,_),s):e.value}_calculate(e,s,h,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:h,to:s}}interpolate(e){return e}}class vl{constructor(e){this.specification=e}possiblyEvaluate(e,s,h,_){if(e.value!==void 0){if(e.expression.kind==="constant"){const v=e.expression.evaluate(s,null,{},h,_);return this._calculate(v,v,v,s)}return this._calculate(e.expression.evaluate(new si(Math.floor(s.zoom-1),s)),e.expression.evaluate(new si(Math.floor(s.zoom),s)),e.expression.evaluate(new si(Math.floor(s.zoom+1),s)),s)}}_calculate(e,s,h,_){return _.zoom>_.zoomHistory.lastIntegerZoom?{from:e,to:s}:{from:h,to:s}}interpolate(e){return e}}class fa{constructor(e){this.specification=e}possiblyEvaluate(e,s,h,_){return!!e.expression.evaluate(s,null,{},h,_)}interpolate(){return!1}}class Fi{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const s in e){const h=e[s];h.specification.overridable&&this.overridableProperties.push(s);const _=this.defaultPropertyValues[s]=new Ms(h,void 0),v=this.defaultTransitionablePropertyValues[s]=new mo(h);this.defaultTransitioningPropertyValues[s]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[s]=_.possiblyEvaluate({})}}}Gt("DataDrivenProperty",lr),Gt("DataConstantProperty",Kt),Gt("CrossFadedDataDrivenProperty",Xa),Gt("CrossFadedProperty",vl),Gt("ColorRampProperty",fa);const da="-transition";class Dn extends wr{constructor(e,s){if(super(),this.id=e.id,this.type=e.type,this._featureFilter={filter:()=>!0,needGeometry:!1},e.type!=="custom"&&(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type!=="background"&&(this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter),s.layout&&(this._unevaluatedLayout=new fh(s.layout)),s.paint)){this._transitionablePaint=new $c(s.paint);for(const h in e.paint)this.setPaintProperty(h,e.paint[h],{validate:!1});for(const h in e.layout)this.setLayoutProperty(h,e.layout[h],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ds(s.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(e){return e==="visibility"?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,s,h={}){s!=null&&this._validate(ch,`layers.${this.id}.layout.${e}`,e,s,h)||(e!=="visibility"?this._unevaluatedLayout.setValue(e,s):this.visibility=s)}getPaintProperty(e){return e.endsWith(da)?this._transitionablePaint.getTransition(e.slice(0,-da.length)):this._transitionablePaint.getValue(e)}setPaintProperty(e,s,h={}){if(s!=null&&this._validate(lh,`layers.${this.id}.paint.${e}`,e,s,h))return!1;if(e.endsWith(da))return this._transitionablePaint.setTransition(e.slice(0,-da.length),s||void 0),!1;{const _=this._transitionablePaint._values[e],v=_.property.specification["property-type"]==="cross-faded-data-driven",E=_.value.isDataDriven(),C=_.value;this._transitionablePaint.setValue(e,s),this._handleSpecialPaintPropertyUpdate(e);const M=this._transitionablePaint._values[e].value;return M.isDataDriven()||E||v||this._handleOverridablePaintPropertyUpdate(e,C,M)}}_handleSpecialPaintPropertyUpdate(e){}_handleOverridablePaintPropertyUpdate(e,s,h){return!1}isHidden(e){return!!(this.minzoom&&e=this.maxzoom)||this.visibility==="none"}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,s){e.getCrossfadeParameters&&(this._crossfadeParameters=e.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,s)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,s)}serialize(){const e={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(e.layout=e.layout||{},e.layout.visibility=this.visibility),B(e,(s,h)=>!(s===void 0||h==="layout"&&!Object.keys(s).length||h==="paint"&&!Object.keys(s).length))}_validate(e,s,h,_,v={}){return(!v||v.validate!==!1)&&fo(this,e.call(As,{key:s,layerType:this.type,objectKey:h,value:_,styleSpec:Fe,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const e in this.paint._values){const s=this.paint.get(e);if(s instanceof Mn&&ei(s.property.specification)&&(s.value.kind==="source"||s.value.kind==="composite")&&s.value.isStateDependent)return!0}return!1}}const Gc={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class pa{constructor(e,s){this._structArray=e,this._pos1=s*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class di{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(e,s){return e._trim(),s&&(e.isTransferred=!0,s.push(e.arrayBuffer)),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const s=Object.create(this.prototype);return s.arrayBuffer=e.arrayBuffer,s.length=e.length,s.capacity=e.arrayBuffer.byteLength/s.bytesPerElement,s._refreshViews(),s}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const s=this.uint8;this._refreshViews(),s&&this.uint8.set(s)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function bi(i,e=1){let s=0,h=0;return{members:i.map(_=>{const v=Gc[_.type].BYTES_PER_ELEMENT,E=s=bl(s,Math.max(e,v)),C=_.components||1;return h=Math.max(h,v),s+=v*C,{name:_.name,type:_.type,components:C,offset:E}}),size:bl(s,Math.max(h,e)),alignment:e}}function bl(i,e){return Math.ceil(i/e)*e}class Ta extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const _=2*e;return this.int16[_+0]=s,this.int16[_+1]=h,e}}Ta.prototype.bytesPerElement=4,Gt("StructArrayLayout2i4",Ta);class g extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,_){const v=this.length;return this.resize(v+1),this.emplace(v,e,s,h,_)}emplace(e,s,h,_,v){const E=4*e;return this.int16[E+0]=s,this.int16[E+1]=h,this.int16[E+2]=_,this.int16[E+3]=v,e}}g.prototype.bytesPerElement=8,Gt("StructArrayLayout4i8",g);class t extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E){const C=this.length;return this.resize(C+1),this.emplace(C,e,s,h,_,v,E)}emplace(e,s,h,_,v,E,C){const M=6*e;return this.int16[M+0]=s,this.int16[M+1]=h,this.int16[M+2]=_,this.int16[M+3]=v,this.int16[M+4]=E,this.int16[M+5]=C,e}}t.prototype.bytesPerElement=12,Gt("StructArrayLayout2i4i12",t);class u extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E){const C=this.length;return this.resize(C+1),this.emplace(C,e,s,h,_,v,E)}emplace(e,s,h,_,v,E,C){const M=4*e,F=8*e;return this.int16[M+0]=s,this.int16[M+1]=h,this.uint8[F+4]=_,this.uint8[F+5]=v,this.uint8[F+6]=E,this.uint8[F+7]=C,e}}u.prototype.bytesPerElement=8,Gt("StructArrayLayout2i4ub8",u);class p extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const _=2*e;return this.float32[_+0]=s,this.float32[_+1]=h,e}}p.prototype.bytesPerElement=8,Gt("StructArrayLayout2f8",p);class y extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E,C,M,F,j){const W=this.length;return this.resize(W+1),this.emplace(W,e,s,h,_,v,E,C,M,F,j)}emplace(e,s,h,_,v,E,C,M,F,j,W){const X=10*e;return this.uint16[X+0]=s,this.uint16[X+1]=h,this.uint16[X+2]=_,this.uint16[X+3]=v,this.uint16[X+4]=E,this.uint16[X+5]=C,this.uint16[X+6]=M,this.uint16[X+7]=F,this.uint16[X+8]=j,this.uint16[X+9]=W,e}}y.prototype.bytesPerElement=20,Gt("StructArrayLayout10ui20",y);class x extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E,C,M,F,j,W,X){const ne=this.length;return this.resize(ne+1),this.emplace(ne,e,s,h,_,v,E,C,M,F,j,W,X)}emplace(e,s,h,_,v,E,C,M,F,j,W,X,ne){const se=12*e;return this.int16[se+0]=s,this.int16[se+1]=h,this.int16[se+2]=_,this.int16[se+3]=v,this.uint16[se+4]=E,this.uint16[se+5]=C,this.uint16[se+6]=M,this.uint16[se+7]=F,this.int16[se+8]=j,this.int16[se+9]=W,this.int16[se+10]=X,this.int16[se+11]=ne,e}}x.prototype.bytesPerElement=24,Gt("StructArrayLayout4i4ui4i24",x);class I extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,s,h)}emplace(e,s,h,_){const v=3*e;return this.float32[v+0]=s,this.float32[v+1]=h,this.float32[v+2]=_,e}}I.prototype.bytesPerElement=12,Gt("StructArrayLayout3f12",I);class R extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint32[1*e+0]=s,e}}R.prototype.bytesPerElement=4,Gt("StructArrayLayout1ul4",R);class O extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E,C,M,F){const j=this.length;return this.resize(j+1),this.emplace(j,e,s,h,_,v,E,C,M,F)}emplace(e,s,h,_,v,E,C,M,F,j){const W=10*e,X=5*e;return this.int16[W+0]=s,this.int16[W+1]=h,this.int16[W+2]=_,this.int16[W+3]=v,this.int16[W+4]=E,this.int16[W+5]=C,this.uint32[X+3]=M,this.uint16[W+8]=F,this.uint16[W+9]=j,e}}O.prototype.bytesPerElement=20,Gt("StructArrayLayout6i1ul2ui20",O);class V extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E){const C=this.length;return this.resize(C+1),this.emplace(C,e,s,h,_,v,E)}emplace(e,s,h,_,v,E,C){const M=6*e;return this.int16[M+0]=s,this.int16[M+1]=h,this.int16[M+2]=_,this.int16[M+3]=v,this.int16[M+4]=E,this.int16[M+5]=C,e}}V.prototype.bytesPerElement=12,Gt("StructArrayLayout2i2i2i12",V);class G extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v){const E=this.length;return this.resize(E+1),this.emplace(E,e,s,h,_,v)}emplace(e,s,h,_,v,E){const C=4*e,M=8*e;return this.float32[C+0]=s,this.float32[C+1]=h,this.float32[C+2]=_,this.int16[M+6]=v,this.int16[M+7]=E,e}}G.prototype.bytesPerElement=16,Gt("StructArrayLayout2f1f2i16",G);class K extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,_){const v=this.length;return this.resize(v+1),this.emplace(v,e,s,h,_)}emplace(e,s,h,_,v){const E=12*e,C=3*e;return this.uint8[E+0]=s,this.uint8[E+1]=h,this.float32[C+1]=_,this.float32[C+2]=v,e}}K.prototype.bytesPerElement=12,Gt("StructArrayLayout2ub2f12",K);class ie extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,s,h)}emplace(e,s,h,_){const v=3*e;return this.uint16[v+0]=s,this.uint16[v+1]=h,this.uint16[v+2]=_,e}}ie.prototype.bytesPerElement=6,Gt("StructArrayLayout3ui6",ie);class me extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E,C,M,F,j,W,X,ne,se,ke,we,Oe){const Qe=this.length;return this.resize(Qe+1),this.emplace(Qe,e,s,h,_,v,E,C,M,F,j,W,X,ne,se,ke,we,Oe)}emplace(e,s,h,_,v,E,C,M,F,j,W,X,ne,se,ke,we,Oe,Qe){const Le=24*e,Ke=12*e,ft=48*e;return this.int16[Le+0]=s,this.int16[Le+1]=h,this.uint16[Le+2]=_,this.uint16[Le+3]=v,this.uint32[Ke+2]=E,this.uint32[Ke+3]=C,this.uint32[Ke+4]=M,this.uint16[Le+10]=F,this.uint16[Le+11]=j,this.uint16[Le+12]=W,this.float32[Ke+7]=X,this.float32[Ke+8]=ne,this.uint8[ft+36]=se,this.uint8[ft+37]=ke,this.uint8[ft+38]=we,this.uint32[Ke+10]=Oe,this.int16[Le+22]=Qe,e}}me.prototype.bytesPerElement=48,Gt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",me);class fe extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,_,v,E,C,M,F,j,W,X,ne,se,ke,we,Oe,Qe,Le,Ke,ft,ht,qt,Zt,Nt,Rt,At,Ut){const Lt=this.length;return this.resize(Lt+1),this.emplace(Lt,e,s,h,_,v,E,C,M,F,j,W,X,ne,se,ke,we,Oe,Qe,Le,Ke,ft,ht,qt,Zt,Nt,Rt,At,Ut)}emplace(e,s,h,_,v,E,C,M,F,j,W,X,ne,se,ke,we,Oe,Qe,Le,Ke,ft,ht,qt,Zt,Nt,Rt,At,Ut,Lt){const xt=34*e,rr=17*e;return this.int16[xt+0]=s,this.int16[xt+1]=h,this.int16[xt+2]=_,this.int16[xt+3]=v,this.int16[xt+4]=E,this.int16[xt+5]=C,this.int16[xt+6]=M,this.int16[xt+7]=F,this.uint16[xt+8]=j,this.uint16[xt+9]=W,this.uint16[xt+10]=X,this.uint16[xt+11]=ne,this.uint16[xt+12]=se,this.uint16[xt+13]=ke,this.uint16[xt+14]=we,this.uint16[xt+15]=Oe,this.uint16[xt+16]=Qe,this.uint16[xt+17]=Le,this.uint16[xt+18]=Ke,this.uint16[xt+19]=ft,this.uint16[xt+20]=ht,this.uint16[xt+21]=qt,this.uint16[xt+22]=Zt,this.uint32[rr+12]=Nt,this.float32[rr+13]=Rt,this.float32[rr+14]=At,this.float32[rr+15]=Ut,this.float32[rr+16]=Lt,e}}fe.prototype.bytesPerElement=68,Gt("StructArrayLayout8i15ui1ul4f68",fe);class de extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.float32[1*e+0]=s,e}}de.prototype.bytesPerElement=4,Gt("StructArrayLayout1f4",de);class ze extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,s,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,s,h)}emplace(e,s,h,_){const v=3*e;return this.int16[v+0]=s,this.int16[v+1]=h,this.int16[v+2]=_,e}}ze.prototype.bytesPerElement=6,Gt("StructArrayLayout3i6",ze);class De extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s,h){const _=this.length;return this.resize(_+1),this.emplace(_,e,s,h)}emplace(e,s,h,_){const v=4*e;return this.uint32[2*e+0]=s,this.uint16[v+2]=h,this.uint16[v+3]=_,e}}De.prototype.bytesPerElement=8,Gt("StructArrayLayout1ul2ui8",De);class Ve extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,s){const h=this.length;return this.resize(h+1),this.emplace(h,e,s)}emplace(e,s,h){const _=2*e;return this.uint16[_+0]=s,this.uint16[_+1]=h,e}}Ve.prototype.bytesPerElement=4,Gt("StructArrayLayout2ui4",Ve);class xe extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const s=this.length;return this.resize(s+1),this.emplace(s,e)}emplace(e,s){return this.uint16[1*e+0]=s,e}}xe.prototype.bytesPerElement=2,Gt("StructArrayLayout1ui2",xe);class Ye extends di{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,s,h,_){const v=this.length;return this.resize(v+1),this.emplace(v,e,s,h,_)}emplace(e,s,h,_,v){const E=4*e;return this.float32[E+0]=s,this.float32[E+1]=h,this.float32[E+2]=_,this.float32[E+3]=v,e}}Ye.prototype.bytesPerElement=16,Gt("StructArrayLayout4f16",Ye);class Ze extends pa{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new ct(this.anchorPointX,this.anchorPointY)}}Ze.prototype.size=20;class st extends O{get(e){return new Ze(this,e)}}Gt("CollisionBoxArray",st);class lt extends pa{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(e){this._structArray.uint8[this._pos1+37]=e}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(e){this._structArray.uint8[this._pos1+38]=e}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(e){this._structArray.uint32[this._pos4+10]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}lt.prototype.size=48;class yt extends me{get(e){return new lt(this,e)}}Gt("PlacedSymbolArray",yt);class at extends pa{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(e){this._structArray.uint32[this._pos4+12]=e}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get textOffset0(){return this._structArray.float32[this._pos4+14]}get textOffset1(){return this._structArray.float32[this._pos4+15]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+16]}}at.prototype.size=68;class Vt extends fe{get(e){return new at(this,e)}}Gt("SymbolInstanceArray",Vt);class Dt extends de{getoffsetX(e){return this.float32[1*e+0]}}Gt("GlyphOffsetArray",Dt);class jt extends ze{getx(e){return this.int16[3*e+0]}gety(e){return this.int16[3*e+1]}gettileUnitDistanceFromAnchor(e){return this.int16[3*e+2]}}Gt("SymbolLineVertexArray",jt);class gr extends pa{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}gr.prototype.size=8;class br extends De{get(e){return new gr(this,e)}}Gt("FeatureIndexArray",br);class tr extends Ta{}class qr extends Ta{}class Gr extends Ta{}class Ar extends t{}class Pr extends u{}class Hr extends p{}class Ci extends y{}class Rn extends x{}class kn extends I{}class Ln extends R{}class ma extends V{}class yn extends K{}class Yi extends ie{}class Hn extends Ve{}const go=bi([{name:"a_pos",components:2,type:"Int16"}],4),{members:ki}=go;class Er{constructor(e=[]){this.segments=e}prepareSegment(e,s,h,_){let v=this.segments[this.segments.length-1];return e>Er.MAX_VERTEX_ARRAY_LENGTH&&Y(`Max vertices per segment is ${Er.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!v||v.vertexLength+e>Er.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==_)&&(v={vertexOffset:s.length,primitiveOffset:h.length,vertexLength:0,primitiveLength:0},_!==void 0&&(v.sortKey=_),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const e of this.segments)for(const s in e.vaos)e.vaos[s].destroy()}static simpleSegment(e,s,h,_){return new Er([{vertexOffset:e,primitiveOffset:s,vertexLength:h,primitiveLength:_,vaos:{},sortKey:0}])}}function $r(i,e){return 256*(i=k(Math.floor(i),0,255))+k(Math.floor(e),0,255)}Er.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Gt("SegmentVector",Er);const Ai=bi([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Pi={exports:{}},oi={exports:{}};oi.exports=function(i,e){var s,h,_,v,E,C,M,F;for(h=i.length-(s=3&i.length),_=e,E=3432918353,C=461845907,F=0;F>>16)*E&65535)<<16)&4294967295)<<15|M>>>17))*C+(((M>>>16)*C&65535)<<16)&4294967295)<<13|_>>>19))+((5*(_>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(M=0,s){case 3:M^=(255&i.charCodeAt(F+2))<<16;case 2:M^=(255&i.charCodeAt(F+1))<<8;case 1:_^=M=(65535&(M=(M=(65535&(M^=255&i.charCodeAt(F)))*E+(((M>>>16)*E&65535)<<16)&4294967295)<<15|M>>>17))*C+(((M>>>16)*C&65535)<<16)&4294967295}return _^=i.length,_=2246822507*(65535&(_^=_>>>16))+((2246822507*(_>>>16)&65535)<<16)&4294967295,_=3266489909*(65535&(_^=_>>>13))+((3266489909*(_>>>16)&65535)<<16)&4294967295,(_^=_>>>16)>>>0};var vn={exports:{}};vn.exports=function(i,e){for(var s,h=i.length,_=e^h,v=0;h>=4;)s=1540483477*(65535&(s=255&i.charCodeAt(v)|(255&i.charCodeAt(++v))<<8|(255&i.charCodeAt(++v))<<16|(255&i.charCodeAt(++v))<<24))+((1540483477*(s>>>16)&65535)<<16),_=1540483477*(65535&_)+((1540483477*(_>>>16)&65535)<<16)^(s=1540483477*(65535&(s^=s>>>24))+((1540483477*(s>>>16)&65535)<<16)),h-=4,++v;switch(h){case 3:_^=(255&i.charCodeAt(v+2))<<16;case 2:_^=(255&i.charCodeAt(v+1))<<8;case 1:_=1540483477*(65535&(_^=255&i.charCodeAt(v)))+((1540483477*(_>>>16)&65535)<<16)}return _=1540483477*(65535&(_^=_>>>13))+((1540483477*(_>>>16)&65535)<<16),(_^=_>>>15)>>>0};var Ia=oi.exports,xl=vn.exports;Pi.exports=Ia,Pi.exports.murmur3=Ia,Pi.exports.murmur2=xl;class Ja{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(e,s,h,_){this.ids.push(Zc(e)),this.positions.push(s,h,_)}getPositions(e){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const s=Zc(e);let h=0,_=this.ids.length-1;for(;h<_;){const E=h+_>>1;this.ids[E]>=s?_=E:h=E+1}const v=[];for(;this.ids[h]===s;)v.push({index:this.positions[3*h],start:this.positions[3*h+1],end:this.positions[3*h+2]}),h++;return v}static serialize(e,s){const h=new Float64Array(e.ids),_=new Uint32Array(e.positions);return wl(h,_,0,h.length-1),s&&s.push(h.buffer,_.buffer),{ids:h,positions:_}}static deserialize(e){const s=new Ja;return s.ids=e.ids,s.positions=e.positions,s.indexed=!0,s}}function Zc(i){const e=+i;return!isNaN(e)&&e<=Number.MAX_SAFE_INTEGER?e:Pi.exports(String(i))}function wl(i,e,s,h){for(;s>1];let v=s-1,E=h+1;for(;;){do v++;while(i[v]<_);do E--;while(i[E]>_);if(v>=E)break;ga(i,v,E),ga(e,3*v,3*E),ga(e,3*v+1,3*E+1),ga(e,3*v+2,3*E+2)}E-s`u_${_}`),this.type=h}setUniform(e,s,h){e.set(h.constantOr(this.value))}getBinding(e,s,h){return this.type==="color"?new dd(e,s):new Aa(e,s)}}class yo{constructor(e,s){this.uniformNames=s.map(h=>`u_${h}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(e,s){this.pixelRatioFrom=s.pixelRatio,this.pixelRatioTo=e.pixelRatio,this.patternFrom=s.tlbr,this.patternTo=e.tlbr}setUniform(e,s,h,_){const v=_==="u_pattern_to"?this.patternTo:_==="u_pattern_from"?this.patternFrom:_==="u_pixel_ratio_to"?this.pixelRatioTo:_==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&e.set(v)}getBinding(e,s,h){return h.substr(0,9)==="u_pattern"?new _o(e,s):new Aa(e,s)}}class Pa{constructor(e,s,h,_){this.expression=e,this.type=h,this.maxValue=0,this.paintVertexAttributes=s.map(v=>({name:`a_${v}`,type:"Float32",components:h==="color"?2:1,offset:0})),this.paintVertexArray=new _}populatePaintArray(e,s,h,_,v){const E=this.paintVertexArray.length,C=this.expression.evaluate(new si(0),s,{},_,[],v);this.paintVertexArray.resize(e),this._setPaintValue(E,e,C)}updatePaintArray(e,s,h,_){const v=this.expression.evaluate({zoom:0},h,_);this._setPaintValue(e,s,v)}_setPaintValue(e,s,h){if(this.type==="color"){const _=dh(h);for(let v=e;v`u_${C}_t`),this.type=h,this.useIntegerZoom=_,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=s.map(C=>({name:`a_${C}`,type:"Float32",components:h==="color"?4:2,offset:0})),this.paintVertexArray=new E}populatePaintArray(e,s,h,_,v){const E=this.expression.evaluate(new si(this.zoom),s,{},_,[],v),C=this.expression.evaluate(new si(this.zoom+1),s,{},_,[],v),M=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(M,e,E,C)}updatePaintArray(e,s,h,_){const v=this.expression.evaluate({zoom:this.zoom},h,_),E=this.expression.evaluate({zoom:this.zoom+1},h,_);this._setPaintValue(e,s,v,E)}_setPaintValue(e,s,h,_){if(this.type==="color"){const v=dh(h),E=dh(_);for(let C=e;C`#define HAS_UNIFORM_${_}`))}return e}getBinderAttributes(){const e=[];for(const s in this.binders){const h=this.binders[s];if(h instanceof Pa||h instanceof Wn)for(let _=0;_!0){this.programConfigurations={};for(const _ of e)this.programConfigurations[_.id]=new pd(_,s,h);this.needsUpload=!1,this._featureMap=new Ja,this._bufferOffset=0}populatePaintArrays(e,s,h,_,v,E){for(const C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(e,s,_,v,E);s.id!==void 0&&this._featureMap.add(s.id,h,this._bufferOffset,e),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,s,h,_){for(const v of h)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(e,this._featureMap,s,v,_)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const s in this.programConfigurations)this.programConfigurations[s].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}}function wy(i,e){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[i]||[i.replace(`${e}-`,"").replace(/-/g,"_")]}function md(i,e,s){const h={color:{source:p,composite:Ye},number:{source:de,composite:p}},_=function(v){return{"line-pattern":{source:Ci,composite:Ci},"fill-pattern":{source:Ci,composite:Ci},"fill-extrusion-pattern":{source:Ci,composite:Ci}}[v]}(i);return _&&_[s]||h[e][s]}Gt("ConstantBinder",El),Gt("CrossFadedConstantBinder",yo),Gt("SourceExpressionBinder",Pa),Gt("CrossFadedCompositeBinder",Ya),Gt("CompositeExpressionBinder",Wn),Gt("ProgramConfiguration",pd,{omit:["_buffers"]}),Gt("ProgramConfigurationSet",Rs);var Si=8192;const ph=Math.pow(2,14)-1,gd=-ph-1;function Ls(i){const e=Si/i.extent,s=i.loadGeometry();for(let h=0;hE.x+1||ME.y+1)&&Y("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return s}function Bs(i,e){return{type:i.type,id:i.id,properties:i.properties,geometry:e?Ls(i):[]}}function Hc(i,e,s,h,_){i.emplaceBack(2*e+(h+1)/2,2*s+(_+1)/2)}class mh{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new qr,this.indexArray=new Yi,this.segments=new Er,this.programConfigurations=new Rs(e.layers,e.zoom),this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){const _=this.layers[0],v=[];let E=null,C=!1;_.type==="circle"&&(E=_.layout.get("circle-sort-key"),C=!E.isConstant());for(const{feature:M,id:F,index:j,sourceLayerIndex:W}of e){const X=this.layers[0]._featureFilter.needGeometry,ne=Bs(M,X);if(!this.layers[0]._featureFilter.filter(new si(this.zoom),ne,h))continue;const se=C?E.evaluate(ne,{},h):void 0,ke={id:F,properties:M.properties,type:M.type,sourceLayerIndex:W,index:j,geometry:X?ne.geometry:Ls(M),patterns:{},sortKey:se};v.push(ke)}C&&v.sort((M,F)=>M.sortKey-F.sortKey);for(const M of v){const{geometry:F,index:j,sourceLayerIndex:W}=M,X=e[j].feature;this.addFeature(M,F,j,h),s.featureIndex.insert(X,F,j,W,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,ki),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,s,h,_){for(const v of s)for(const E of v){const C=E.x,M=E.y;if(C<0||C>=Si||M<0||M>=Si)continue;const F=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),j=F.vertexLength;Hc(this.layoutVertexArray,C,M,-1,-1),Hc(this.layoutVertexArray,C,M,1,-1),Hc(this.layoutVertexArray,C,M,1,1),Hc(this.layoutVertexArray,C,M,-1,1),this.indexArray.emplaceBack(j,j+1,j+2),this.indexArray.emplaceBack(j,j+3,j+2),F.vertexLength+=4,F.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,{},_)}}function _d(i,e){for(let s=0;s1){if(gh(i,e))return!0;for(let h=0;h1?s:s.sub(e)._mult(_)._add(e))}function bd(i,e){let s,h,_,v=!1;for(let E=0;Ee.y!=_.y>e.y&&e.x<(_.x-h.x)*(e.y-h.y)/(_.y-h.y)+h.x&&(v=!v)}return v}function vo(i,e){let s=!1;for(let h=0,_=i.length-1;he.y!=E.y>e.y&&e.x<(E.x-v.x)*(e.y-v.y)/(E.y-v.y)+v.x&&(s=!s)}return s}function Ty(i,e,s){const h=s[0],_=s[2];if(i.x_.x&&e.x>_.x||i.y_.y&&e.y>_.y)return!1;const v=ae(i,e,s[0]);return v!==ae(i,e,s[1])||v!==ae(i,e,s[2])||v!==ae(i,e,s[3])}function kl(i,e,s){const h=e.paint.get(i).value;return h.kind==="constant"?h.value:s.programConfigurations.get(e.id).getMaxValue(i)}function Wc(i){return Math.sqrt(i[0]*i[0]+i[1]*i[1])}function Kc(i,e,s,h,_){if(!e[0]&&!e[1])return i;const v=ct.convert(e)._mult(_);s==="viewport"&&v._rotate(-h);const E=[];for(let C=0;Ci.width||_.height>i.height||s.x>i.width-_.width||s.y>i.height-_.height)throw new RangeError("out of range source coordinates for image copy");if(_.width>e.width||_.height>e.height||h.x>e.width-_.width||h.y>e.height-_.height)throw new RangeError("out of range destination coordinates for image copy");const E=i.data,C=e.data;if(E===C)throw new Error("srcData equals dstData, so image is already copied");for(let M=0;M<_.height;M++){const F=((s.y+M)*i.width+s.x)*v,j=((h.y+M)*e.width+h.x)*v;for(let W=0;W<_.width*v;W++)C[j+W]=E[F+W]}return e}class Tl{constructor(e,s){vh(this,e,1,s)}resize(e){Cd(this,e,1)}clone(){return new Tl({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,s,h,_,v){bh(e,s,h,_,v,1)}}class Sn{constructor(e,s){vh(this,e,4,s)}resize(e){Cd(this,e,4)}replace(e,s){s?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Sn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,s,h,_,v){bh(e,s,h,_,v,4)}}function Ad(i){const e={},s=i.resolution||256,h=i.clips?i.clips.length:1,_=i.image||new Sn({width:s,height:h});if(Math.log(s)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${s}`);const v=(E,C,M)=>{e[i.evaluationKey]=M;const F=i.expression.evaluate(e);_.data[E+C+0]=Math.floor(255*F.r/F.a),_.data[E+C+1]=Math.floor(255*F.g/F.a),_.data[E+C+2]=Math.floor(255*F.b/F.a),_.data[E+C+3]=Math.floor(255*F.a)};if(i.clips)for(let E=0,C=0;E80*s){h=v=i[0],_=E=i[1];for(var se=s;sev&&(v=C),M>E&&(E=M);F=(F=Math.max(v-h,E-_))!==0?32767/F:0}return Il(X,ne,s,h,_,F,0),ne}function Pd(i,e,s,h,_){var v,E;if(_===Eh(i,e,s,h)>0)for(v=e;v=e;v-=h)E=Dd(v,i[v],i[v+1],E);return E&&Qc(E,E.next)&&(Al(E),E=E.next),E}function Os(i,e){if(!i)return i;e||(e=i);var s,h=i;do if(s=!1,h.steiner||!Qc(h,h.next)&&vi(h.prev,h,h.next)!==0)h=h.next;else{if(Al(h),(h=e=h.prev)===h.next)break;s=!0}while(s||h!==e);return e}function Il(i,e,s,h,_,v,E){if(i){!E&&v&&function(j,W,X,ne){var se=j;do se.z===0&&(se.z=xh(se.x,se.y,W,X,ne)),se.prevZ=se.prev,se.nextZ=se.next,se=se.next;while(se!==j);se.prevZ.nextZ=null,se.prevZ=null,function(ke){var we,Oe,Qe,Le,Ke,ft,ht,qt,Zt=1;do{for(Oe=ke,ke=null,Ke=null,ft=0;Oe;){for(ft++,Qe=Oe,ht=0,we=0;we0||qt>0&&Qe;)ht!==0&&(qt===0||!Qe||Oe.z<=Qe.z)?(Le=Oe,Oe=Oe.nextZ,ht--):(Le=Qe,Qe=Qe.nextZ,qt--),Ke?Ke.nextZ=Le:ke=Le,Le.prevZ=Ke,Ke=Le;Oe=Qe}Ke.nextZ=null,Zt*=2}while(ft>1)}(se)}(i,h,_,v);for(var C,M,F=i;i.prev!==i.next;)if(C=i.prev,M=i.next,v?Ly(i,h,_,v):Ry(i))e.push(C.i/s|0),e.push(i.i/s|0),e.push(M.i/s|0),Al(i),i=M.next,F=M.next;else if((i=M)===F){E?E===1?Il(i=By(Os(i),e,s),e,s,h,_,v,2):E===2&&Oy(i,e,s,h,_,v):Il(Os(i),e,s,h,_,v,1);break}}}function Ry(i){var e=i.prev,s=i,h=i.next;if(vi(e,s,h)>=0)return!1;for(var _=e.x,v=s.x,E=h.x,C=e.y,M=s.y,F=h.y,j=_v?_>E?_:E:v>E?v:E,ne=C>M?C>F?C:F:M>F?M:F,se=h.next;se!==e;){if(se.x>=j&&se.x<=X&&se.y>=W&&se.y<=ne&&bo(_,C,v,M,E,F,se.x,se.y)&&vi(se.prev,se,se.next)>=0)return!1;se=se.next}return!0}function Ly(i,e,s,h){var _=i.prev,v=i,E=i.next;if(vi(_,v,E)>=0)return!1;for(var C=_.x,M=v.x,F=E.x,j=_.y,W=v.y,X=E.y,ne=CM?C>F?C:F:M>F?M:F,we=j>W?j>X?j:X:W>X?W:X,Oe=xh(ne,se,e,s,h),Qe=xh(ke,we,e,s,h),Le=i.prevZ,Ke=i.nextZ;Le&&Le.z>=Oe&&Ke&&Ke.z<=Qe;){if(Le.x>=ne&&Le.x<=ke&&Le.y>=se&&Le.y<=we&&Le!==_&&Le!==E&&bo(C,j,M,W,F,X,Le.x,Le.y)&&vi(Le.prev,Le,Le.next)>=0||(Le=Le.prevZ,Ke.x>=ne&&Ke.x<=ke&&Ke.y>=se&&Ke.y<=we&&Ke!==_&&Ke!==E&&bo(C,j,M,W,F,X,Ke.x,Ke.y)&&vi(Ke.prev,Ke,Ke.next)>=0))return!1;Ke=Ke.nextZ}for(;Le&&Le.z>=Oe;){if(Le.x>=ne&&Le.x<=ke&&Le.y>=se&&Le.y<=we&&Le!==_&&Le!==E&&bo(C,j,M,W,F,X,Le.x,Le.y)&&vi(Le.prev,Le,Le.next)>=0)return!1;Le=Le.prevZ}for(;Ke&&Ke.z<=Qe;){if(Ke.x>=ne&&Ke.x<=ke&&Ke.y>=se&&Ke.y<=we&&Ke!==_&&Ke!==E&&bo(C,j,M,W,F,X,Ke.x,Ke.y)&&vi(Ke.prev,Ke,Ke.next)>=0)return!1;Ke=Ke.nextZ}return!0}function By(i,e,s){var h=i;do{var _=h.prev,v=h.next.next;!Qc(_,v)&&zd(_,h,h.next,v)&&Cl(_,v)&&Cl(v,_)&&(e.push(_.i/s|0),e.push(h.i/s|0),e.push(v.i/s|0),Al(h),Al(h.next),h=i=v),h=h.next}while(h!==i);return Os(h)}function Oy(i,e,s,h,_,v){var E=i;do{for(var C=E.next.next;C!==E.prev;){if(E.i!==C.i&&$y(E,C)){var M=Md(E,C);return E=Os(E,E.next),M=Os(M,M.next),Il(E,e,s,h,_,v,0),void Il(M,e,s,h,_,v,0)}C=C.next}E=E.next}while(E!==i)}function Fy(i,e){return i.x-e.x}function Ny(i,e){var s=function(_,v){var E,C=v,M=_.x,F=_.y,j=-1/0;do{if(F<=C.y&&F>=C.next.y&&C.next.y!==C.y){var W=C.x+(F-C.y)*(C.next.x-C.x)/(C.next.y-C.y);if(W<=M&&W>j&&(j=W,E=C.x=C.x&&C.x>=se&&M!==C.x&&bo(FE.x||C.x===E.x&&Uy(E,C)))&&(E=C,we=X)),C=C.next;while(C!==ne);return E}(i,e);if(!s)return e;var h=Md(s,i);return Os(h,h.next),Os(s,s.next)}function Uy(i,e){return vi(i.prev,i,e.prev)<0&&vi(e.next,i,i.next)<0}function xh(i,e,s,h,_){return(i=1431655765&((i=858993459&((i=252645135&((i=16711935&((i=(i-s)*_|0)|i<<8))|i<<4))|i<<2))|i<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-h)*_|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Vy(i){var e=i,s=i;do(e.x=(i-E)*(v-C)&&(i-E)*(h-C)>=(s-E)*(e-C)&&(s-E)*(v-C)>=(_-E)*(h-C)}function $y(i,e){return i.next.i!==e.i&&i.prev.i!==e.i&&!function(s,h){var _=s;do{if(_.i!==s.i&&_.next.i!==s.i&&_.i!==h.i&&_.next.i!==h.i&&zd(_,_.next,s,h))return!0;_=_.next}while(_!==s);return!1}(i,e)&&(Cl(i,e)&&Cl(e,i)&&function(s,h){var _=s,v=!1,E=(s.x+h.x)/2,C=(s.y+h.y)/2;do _.y>C!=_.next.y>C&&_.next.y!==_.y&&E<(_.next.x-_.x)*(C-_.y)/(_.next.y-_.y)+_.x&&(v=!v),_=_.next;while(_!==s);return v}(i,e)&&(vi(i.prev,i,e.prev)||vi(i,e.prev,e))||Qc(i,e)&&vi(i.prev,i,i.next)>0&&vi(e.prev,e,e.next)>0)}function vi(i,e,s){return(e.y-i.y)*(s.x-e.x)-(e.x-i.x)*(s.y-e.y)}function Qc(i,e){return i.x===e.x&&i.y===e.y}function zd(i,e,s,h){var _=tu(vi(i,e,s)),v=tu(vi(i,e,h)),E=tu(vi(s,h,i)),C=tu(vi(s,h,e));return _!==v&&E!==C||!(_!==0||!eu(i,s,e))||!(v!==0||!eu(i,h,e))||!(E!==0||!eu(s,i,h))||!(C!==0||!eu(s,e,h))}function eu(i,e,s){return e.x<=Math.max(i.x,s.x)&&e.x>=Math.min(i.x,s.x)&&e.y<=Math.max(i.y,s.y)&&e.y>=Math.min(i.y,s.y)}function tu(i){return i>0?1:i<0?-1:0}function Cl(i,e){return vi(i.prev,i,i.next)<0?vi(i,e,i.next)>=0&&vi(i,i.prev,e)>=0:vi(i,e,i.prev)<0||vi(i,i.next,e)<0}function Md(i,e){var s=new wh(i.i,i.x,i.y),h=new wh(e.i,e.x,e.y),_=i.next,v=e.prev;return i.next=e,e.prev=i,s.next=_,_.prev=s,h.next=s,s.prev=h,v.next=h,h.prev=v,h}function Dd(i,e,s,h){var _=new wh(i,e,s);return h?(_.next=h.next,_.prev=h,h.next.prev=_,h.next=_):(_.prev=_,_.next=_),_}function Al(i){i.next.prev=i.prev,i.prev.next=i.next,i.prevZ&&(i.prevZ.nextZ=i.nextZ),i.nextZ&&(i.nextZ.prevZ=i.prevZ)}function wh(i,e,s){this.i=i,this.x=e,this.y=s,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Eh(i,e,s,h){for(var _=0,v=e,E=s-h;vs;){if(h-s>600){var v=h-s+1,E=e-s+1,C=Math.log(v),M=.5*Math.exp(2*C/3),F=.5*Math.sqrt(C*M*(v-M)/v)*(E-v/2<0?-1:1);Rd(i,e,Math.max(s,Math.floor(e-E*M/v+F)),Math.min(h,Math.floor(e+(v-E)*M/v+F)),_)}var j=i[e],W=s,X=h;for(Pl(i,s,e),_(i[h],j)>0&&Pl(i,s,h);W0;)X--}_(i[s],j)===0?Pl(i,s,X):Pl(i,++X,h),X<=e&&(s=X+1),e<=X&&(h=X-1)}}function Pl(i,e,s){var h=i[e];i[e]=i[s],i[s]=h}function qy(i,e){return ie?1:0}function kh(i,e){const s=i.length;if(s<=1)return[i];const h=[];let _,v;for(let E=0;E1)for(let E=0;E0&&s.holes.push(h+=i[_-1].length)}return s};class Ih{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Gr,this.indexArray=new Yi,this.indexArray2=new Hn,this.programConfigurations=new Rs(e.layers,e.zoom),this.segments=new Er,this.segments2=new Er,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.hasPattern=Sh("fill",this.layers,s);const _=this.layers[0].layout.get("fill-sort-key"),v=!_.isConstant(),E=[];for(const{feature:C,id:M,index:F,sourceLayerIndex:j}of e){const W=this.layers[0]._featureFilter.needGeometry,X=Bs(C,W);if(!this.layers[0]._featureFilter.filter(new si(this.zoom),X,h))continue;const ne=v?_.evaluate(X,{},h,s.availableImages):void 0,se={id:M,properties:C.properties,type:C.type,sourceLayerIndex:j,index:F,geometry:W?X.geometry:Ls(C),patterns:{},sortKey:ne};E.push(se)}v&&E.sort((C,M)=>C.sortKey-M.sortKey);for(const C of E){const{geometry:M,index:F,sourceLayerIndex:j}=C;if(this.hasPattern){const W=Th("fill",this.layers,C,this.zoom,s);this.patternFeatures.push(W)}else this.addFeature(C,M,F,h,{});s.featureIndex.insert(e[F].feature,M,F,j,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}addFeatures(e,s,h){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Dy),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.indexBuffer2=e.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(e,s,h,_,v){for(const E of kh(s,500)){let C=0;for(const ne of E)C+=ne.length;const M=this.segments.prepareSegment(C,this.layoutVertexArray,this.indexArray),F=M.vertexLength,j=[],W=[];for(const ne of E){if(ne.length===0)continue;ne!==E[0]&&W.push(j.length/2);const se=this.segments2.prepareSegment(ne.length,this.layoutVertexArray,this.indexArray2),ke=se.vertexLength;this.layoutVertexArray.emplaceBack(ne[0].x,ne[0].y),this.indexArray2.emplaceBack(ke+ne.length-1,ke),j.push(ne[0].x),j.push(ne[0].y);for(let we=1;we>3}if(_--,h===1||h===2)v+=i.readSVarint(),E+=i.readSVarint(),h===1&&(e&&C.push(e),e=[]),e.push(new Jy(v,E));else{if(h!==7)throw new Error("unknown command "+h);e&&e.push(e[0].clone())}}return e&&C.push(e),C},xo.prototype.bbox=function(){var i=this._pbf;i.pos=this._geometry;for(var e=i.readVarint()+i.pos,s=1,h=0,_=0,v=0,E=1/0,C=-1/0,M=1/0,F=-1/0;i.pos>3}if(h--,s===1||s===2)(_+=i.readSVarint())C&&(C=_),(v+=i.readSVarint())F&&(F=v);else if(s!==7)throw new Error("unknown command "+s)}return[E,M,C,F]},xo.prototype.toGeoJSON=function(i,e,s){var h,_,v=this.extent*Math.pow(2,s),E=this.extent*i,C=this.extent*e,M=this.loadGeometry(),F=xo.types[this.type];function j(ne){for(var se=0;se>3;_=E===1?h.readString():E===2?h.readFloat():E===3?h.readDouble():E===4?h.readVarint64():E===5?h.readVarint():E===6?h.readSVarint():E===7?h.readBoolean():null}return _}(s))}Od.prototype.feature=function(i){if(i<0||i>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[i];var e=this._pbf.readVarint()+this._pbf.pos;return new e0(this._pbf,e,this.extent,this._keys,this._values)};var r0=Bd;function i0(i,e,s){if(i===3){var h=new r0(s,s.readVarint()+s.pos);h.length&&(e[h.name]=h)}}Qa.VectorTile=function(i,e){this.layers=i.readFields(i0,{},e)},Qa.VectorTileFeature=Ld,Qa.VectorTileLayer=Bd;const n0=Qa.VectorTileFeature.types,Ch=Math.pow(2,13);function zl(i,e,s,h,_,v,E,C){i.emplaceBack(e,s,2*Math.floor(h*Ch)+E,_*Ch*2,v*Ch*2,Math.round(C))}class Ah{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(s=>s.id),this.index=e.index,this.hasPattern=!1,this.layoutVertexArray=new Ar,this.centroidVertexArray=new tr,this.indexArray=new Yi,this.programConfigurations=new Rs(e.layers,e.zoom),this.segments=new Er,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.features=[],this.hasPattern=Sh("fill-extrusion",this.layers,s);for(const{feature:_,id:v,index:E,sourceLayerIndex:C}of e){const M=this.layers[0]._featureFilter.needGeometry,F=Bs(_,M);if(!this.layers[0]._featureFilter.filter(new si(this.zoom),F,h))continue;const j={id:v,sourceLayerIndex:C,index:E,geometry:M?F.geometry:Ls(_),properties:_.properties,type:_.type,patterns:{}};this.hasPattern?this.features.push(Th("fill-extrusion",this.layers,j,this.zoom,s)):this.addFeature(j,j.geometry,E,h,{}),s.featureIndex.insert(_,j.geometry,E,C,this.index,!0)}}addFeatures(e,s,h){for(const _ of this.features){const{geometry:v}=_;this.addFeature(_,v,_.index,s,h)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Xy),this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,Ky.members,!0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(e,s,h,_,v){const E={x:0,y:0,vertexCount:0};for(const C of kh(s,500)){let M=0;for(const se of C)M+=se.length;let F=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const se of C){if(se.length===0||s0(se))continue;let ke=0;for(let we=0;we=1){const Qe=se[we-1];if(!a0(Oe,Qe)){F.vertexLength+4>Er.MAX_VERTEX_ARRAY_LENGTH&&(F=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const Le=Oe.sub(Qe)._perp()._unit(),Ke=Qe.dist(Oe);ke+Ke>32768&&(ke=0),zl(this.layoutVertexArray,Oe.x,Oe.y,Le.x,Le.y,0,0,ke),zl(this.layoutVertexArray,Oe.x,Oe.y,Le.x,Le.y,0,1,ke),E.x+=2*Oe.x,E.y+=2*Oe.y,E.vertexCount+=2,ke+=Ke,zl(this.layoutVertexArray,Qe.x,Qe.y,Le.x,Le.y,0,0,ke),zl(this.layoutVertexArray,Qe.x,Qe.y,Le.x,Le.y,0,1,ke),E.x+=2*Qe.x,E.y+=2*Qe.y,E.vertexCount+=2;const ft=F.vertexLength;this.indexArray.emplaceBack(ft,ft+2,ft+1),this.indexArray.emplaceBack(ft+1,ft+2,ft+3),F.vertexLength+=4,F.primitiveLength+=2}}}}if(F.vertexLength+M>Er.MAX_VERTEX_ARRAY_LENGTH&&(F=this.segments.prepareSegment(M,this.layoutVertexArray,this.indexArray)),n0[e.type]!=="Polygon")continue;const j=[],W=[],X=F.vertexLength;for(const se of C)if(se.length!==0){se!==C[0]&&W.push(j.length/2);for(let ke=0;keSi)||i.y===e.y&&(i.y<0||i.y>Si)}function s0(i){return i.every(e=>e.x<0)||i.every(e=>e.x>Si)||i.every(e=>e.y<0)||i.every(e=>e.y>Si)}Gt("FillExtrusionBucket",Ah,{omit:["layers","features"]});var o0={paint:new Fi({"fill-extrusion-opacity":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new lr(Fe["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Xa(Fe["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new lr(Fe["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new lr(Fe["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Kt(Fe["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})};function Ml(i,e){return i.x*e.x+i.y*e.y}function Fd(i,e){if(i.length===1){let s=0;const h=e[s++];let _;for(;!_||h.equals(_);)if(_=e[s++],!_)return 1/0;for(;ss.id),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(s=>{this.gradients[s.id]={}}),this.layoutVertexArray=new Pr,this.layoutVertexArray2=new Hr,this.indexArray=new Yi,this.programConfigurations=new Rs(e.layers,e.zoom),this.segments=new Er,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(s=>s.isStateDependent()).map(s=>s.id)}populate(e,s,h){this.hasPattern=Sh("line",this.layers,s);const _=this.layers[0].layout.get("line-sort-key"),v=!_.isConstant(),E=[];for(const{feature:C,id:M,index:F,sourceLayerIndex:j}of e){const W=this.layers[0]._featureFilter.needGeometry,X=Bs(C,W);if(!this.layers[0]._featureFilter.filter(new si(this.zoom),X,h))continue;const ne=v?_.evaluate(X,{},h):void 0,se={id:M,properties:C.properties,type:C.type,sourceLayerIndex:j,index:F,geometry:W?X.geometry:Ls(C),patterns:{},sortKey:ne};E.push(se)}v&&E.sort((C,M)=>C.sortKey-M.sortKey);for(const C of E){const{geometry:M,index:F,sourceLayerIndex:j}=C;if(this.hasPattern){const W=Th("line",this.layers,C,this.zoom,s);this.patternFeatures.push(W)}else this.addFeature(C,M,F,h,{});s.featureIndex.insert(e[F].feature,M,F,j,this.index)}}update(e,s,h){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(e,s,this.stateDependentLayers,h)}addFeatures(e,s,h){for(const _ of this.patternFeatures)this.addFeature(_,_.geometry,_.index,s,h)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,h0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,c0),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e){if(e.properties&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(e.properties,"mapbox_clip_end"))return{start:+e.properties.mapbox_clip_start,end:+e.properties.mapbox_clip_end}}addFeature(e,s,h,_,v){const E=this.layers[0].layout,C=E.get("line-join").evaluate(e,{}),M=E.get("line-cap"),F=E.get("line-miter-limit"),j=E.get("line-round-limit");this.lineClips=this.lineFeatureClips(e);for(const W of s)this.addLine(W,e,C,M,F,j);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,h,v,_)}addLine(e,s,h,_,v,E){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Oe=0;Oe=2&&e[M-1].equals(e[M-2]);)M--;let F=0;for(;F0;if(qt&&Oe>F){const At=X.dist(ne);if(At>2*j){const Ut=X.sub(X.sub(ne)._mult(j/At)._round());this.updateDistance(ne,Ut),this.addCurrentVertex(Ut,ke,0,0,W),ne=Ut}}const Nt=ne&&se;let Rt=Nt?h:C?"butt":_;if(Nt&&Rt==="round"&&(ftv&&(Rt="bevel"),Rt==="bevel"&&(ft>2&&(Rt="flipbevel"),ft100)Qe=we.mult(-1);else{const At=ft*ke.add(we).mag()/ke.sub(we).mag();Qe._perp()._mult(At*(Zt?-1:1))}this.addCurrentVertex(X,Qe,0,0,W),this.addCurrentVertex(X,Qe.mult(-1),0,0,W)}else if(Rt==="bevel"||Rt==="fakeround"){const At=-Math.sqrt(ft*ft-1),Ut=Zt?At:0,Lt=Zt?0:At;if(ne&&this.addCurrentVertex(X,ke,Ut,Lt,W),Rt==="fakeround"){const xt=Math.round(180*ht/Math.PI/20);for(let rr=1;rr2*j){const Ut=X.add(se.sub(X)._mult(j/At)._round());this.updateDistance(X,Ut),this.addCurrentVertex(Ut,we,0,0,W),X=Ut}}}}addCurrentVertex(e,s,h,_,v,E=!1){const C=s.y*_-s.x,M=-s.y-s.x*_;this.addHalfVertex(e,s.x+s.y*h,s.y-s.x*h,E,!1,h,v),this.addHalfVertex(e,C,M,E,!0,-_,v),this.distance>Nd/2&&this.totalDistance===0&&(this.distance=0,this.addCurrentVertex(e,s,h,_,v,E))}addHalfVertex({x:e,y:s},h,_,v,E,C,M){const F=.5*(this.lineClips?this.scaledDistance*(Nd-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((e<<1)+(v?1:0),(s<<1)+(E?1:0),Math.round(63*h)+128,Math.round(63*_)+128,1+(C===0?0:C<0?-1:1)|(63&F)<<2,F>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const j=M.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,j),M.primitiveLength++),E?this.e2=j:this.e1=j}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(e,s){this.distance+=e.dist(s),this.updateScaledDistance()}}Gt("LineBucket",Ph,{omit:["layers","patternFeatures"]});const p0=new Fi({"line-cap":new Kt(Fe.layout_line["line-cap"]),"line-join":new lr(Fe.layout_line["line-join"]),"line-miter-limit":new Kt(Fe.layout_line["line-miter-limit"]),"line-round-limit":new Kt(Fe.layout_line["line-round-limit"]),"line-sort-key":new lr(Fe.layout_line["line-sort-key"])});var Ud={paint:new Fi({"line-opacity":new lr(Fe.paint_line["line-opacity"]),"line-color":new lr(Fe.paint_line["line-color"]),"line-translate":new Kt(Fe.paint_line["line-translate"]),"line-translate-anchor":new Kt(Fe.paint_line["line-translate-anchor"]),"line-width":new lr(Fe.paint_line["line-width"]),"line-gap-width":new lr(Fe.paint_line["line-gap-width"]),"line-offset":new lr(Fe.paint_line["line-offset"]),"line-blur":new lr(Fe.paint_line["line-blur"]),"line-dasharray":new vl(Fe.paint_line["line-dasharray"]),"line-pattern":new Xa(Fe.paint_line["line-pattern"]),"line-gradient":new fa(Fe.paint_line["line-gradient"])}),layout:p0};const Vd=new class extends lr{possiblyEvaluate(i,e){return e=new si(Math.floor(e.zoom),{now:e.now,fadeDuration:e.fadeDuration,zoomHistory:e.zoomHistory,transition:e.transition}),super.possiblyEvaluate(i,e)}evaluate(i,e,s,h){return e=P({},e,{zoom:Math.floor(e.zoom)}),super.evaluate(i,e,s,h)}}(Ud.paint.properties["line-width"].specification);function $d(i,e){return e>0?e+2*i:i}Vd.useIntegerZoom=!0;const m0=bi([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),g0=bi([{name:"a_projected_pos",components:3,type:"Float32"}],4);bi([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const _0=bi([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);bi([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const jd=bi([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),y0=bi([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function v0(i,e,s){return i.sections.forEach(h=>{h.text=function(_,v,E){const C=v.layout.get("text-transform").evaluate(E,{});return C==="uppercase"?_=_.toLocaleUpperCase():C==="lowercase"&&(_=_.toLocaleLowerCase()),_n.applyArabicShaping&&(_=_n.applyArabicShaping(_)),_}(h.text,e,s)}),i}bi([{name:"triangle",components:3,type:"Uint16"}]),bi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),bi([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"}]),bi([{type:"Float32",name:"offsetX"}]),bi([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]);const Dl={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Ni=24,zh=Xr,qd=function(i,e,s,h,_){var v,E,C=8*_-h-1,M=(1<>1,j=-7,W=s?_-1:0,X=s?-1:1,ne=i[e+W];for(W+=X,v=ne&(1<<-j)-1,ne>>=-j,j+=C;j>0;v=256*v+i[e+W],W+=X,j-=8);for(E=v&(1<<-j)-1,v>>=-j,j+=h;j>0;E=256*E+i[e+W],W+=X,j-=8);if(v===0)v=1-F;else{if(v===M)return E?NaN:1/0*(ne?-1:1);E+=Math.pow(2,h),v-=F}return(ne?-1:1)*E*Math.pow(2,v-h)},Gd=function(i,e,s,h,_,v){var E,C,M,F=8*v-_-1,j=(1<>1,X=_===23?Math.pow(2,-24)-Math.pow(2,-77):0,ne=h?0:v-1,se=h?1:-1,ke=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(C=isNaN(e)?1:0,E=j):(E=Math.floor(Math.log(e)/Math.LN2),e*(M=Math.pow(2,-E))<1&&(E--,M*=2),(e+=E+W>=1?X/M:X*Math.pow(2,1-W))*M>=2&&(E++,M/=2),E+W>=j?(C=0,E=j):E+W>=1?(C=(e*M-1)*Math.pow(2,_),E+=W):(C=e*Math.pow(2,W-1)*Math.pow(2,_),E=0));_>=8;i[s+ne]=255&C,ne+=se,C/=256,_-=8);for(E=E<<_|C,F+=_;F>0;i[s+ne]=255&E,ne+=se,E/=256,F-=8);i[s+ne-se]|=128*ke};function Xr(i){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(i)?i:new Uint8Array(i||0),this.pos=0,this.type=0,this.length=this.buf.length}Xr.Varint=0,Xr.Fixed64=1,Xr.Bytes=2,Xr.Fixed32=5;var es,Mh=4294967296,Zd=1/Mh,Hd=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function za(i){return i.type===Xr.Bytes?i.readVarint()+i.pos:i.pos+1}function wo(i,e,s){return s?4294967296*e+(i>>>0):4294967296*(e>>>0)+(i>>>0)}function Wd(i,e,s){var h=e<=16383?1:e<=2097151?2:e<=268435455?3:Math.floor(Math.log(e)/(7*Math.LN2));s.realloc(h);for(var _=s.pos-1;_>=i;_--)s.buf[_+h]=s.buf[_]}function b0(i,e){for(var s=0;s>>8,i[s+2]=e>>>16,i[s+3]=e>>>24}function Kd(i,e){return(i[e]|i[e+1]<<8|i[e+2]<<16)+(i[e+3]<<24)}function A0(i,e,s){i===1&&s.readMessage(P0,e)}function P0(i,e,s){if(i===3){const{id:h,bitmap:_,width:v,height:E,left:C,top:M,advance:F}=s.readMessage(z0,{});e.push({id:h,bitmap:new Tl({width:v+6,height:E+6},_),metrics:{width:v,height:E,left:C,top:M,advance:F}})}}function z0(i,e,s){i===1?e.id=s.readVarint():i===2?e.bitmap=s.readBytes():i===3?e.width=s.readVarint():i===4?e.height=s.readVarint():i===5?e.left=s.readSVarint():i===6?e.top=s.readSVarint():i===7&&(e.advance=s.readVarint())}function Xd(i){let e=0,s=0;for(const E of i)e+=E.w*E.h,s=Math.max(s,E.w);i.sort((E,C)=>C.h-E.h);const h=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(e/.95)),s),h:1/0}];let _=0,v=0;for(const E of i)for(let C=h.length-1;C>=0;C--){const M=h[C];if(!(E.w>M.w||E.h>M.h)){if(E.x=M.x,E.y=M.y,v=Math.max(v,E.y+E.h),_=Math.max(_,E.x+E.w),E.w===M.w&&E.h===M.h){const F=h.pop();C>3,v=this.pos;this.type=7&h,i(_,e,this),this.pos===v&&this.skip(h)}return e},readMessage:function(i,e){return this.readFields(i,e,this.readVarint()+this.pos)},readFixed32:function(){var i=ru(this.buf,this.pos);return this.pos+=4,i},readSFixed32:function(){var i=Kd(this.buf,this.pos);return this.pos+=4,i},readFixed64:function(){var i=ru(this.buf,this.pos)+ru(this.buf,this.pos+4)*Mh;return this.pos+=8,i},readSFixed64:function(){var i=ru(this.buf,this.pos)+Kd(this.buf,this.pos+4)*Mh;return this.pos+=8,i},readFloat:function(){var i=qd(this.buf,this.pos,!0,23,4);return this.pos+=4,i},readDouble:function(){var i=qd(this.buf,this.pos,!0,52,8);return this.pos+=8,i},readVarint:function(i){var e,s,h=this.buf;return e=127&(s=h[this.pos++]),s<128?e:(e|=(127&(s=h[this.pos++]))<<7,s<128?e:(e|=(127&(s=h[this.pos++]))<<14,s<128?e:(e|=(127&(s=h[this.pos++]))<<21,s<128?e:function(_,v,E){var C,M,F=E.buf;if(C=(112&(M=F[E.pos++]))>>4,M<128||(C|=(127&(M=F[E.pos++]))<<3,M<128)||(C|=(127&(M=F[E.pos++]))<<10,M<128)||(C|=(127&(M=F[E.pos++]))<<17,M<128)||(C|=(127&(M=F[E.pos++]))<<24,M<128)||(C|=(1&(M=F[E.pos++]))<<31,M<128))return wo(_,C,v);throw new Error("Expected varint not more than 10 bytes")}(e|=(15&(s=h[this.pos]))<<28,i,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var i=this.readVarint();return i%2==1?(i+1)/-2:i/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var i=this.readVarint()+this.pos,e=this.pos;return this.pos=i,i-e>=12&&Hd?function(s,h,_){return Hd.decode(s.subarray(h,_))}(this.buf,e,i):function(s,h,_){for(var v="",E=h;E<_;){var C,M,F,j=s[E],W=null,X=j>239?4:j>223?3:j>191?2:1;if(E+X>_)break;X===1?j<128&&(W=j):X===2?(192&(C=s[E+1]))==128&&(W=(31&j)<<6|63&C)<=127&&(W=null):X===3?(M=s[E+2],(192&(C=s[E+1]))==128&&(192&M)==128&&((W=(15&j)<<12|(63&C)<<6|63&M)<=2047||W>=55296&&W<=57343)&&(W=null)):X===4&&(M=s[E+2],F=s[E+3],(192&(C=s[E+1]))==128&&(192&M)==128&&(192&F)==128&&((W=(15&j)<<18|(63&C)<<12|(63&M)<<6|63&F)<=65535||W>=1114112)&&(W=null)),W===null?(W=65533,X=1):W>65535&&(W-=65536,v+=String.fromCharCode(W>>>10&1023|55296),W=56320|1023&W),v+=String.fromCharCode(W),E+=X}return v}(this.buf,e,i)},readBytes:function(){var i=this.readVarint()+this.pos,e=this.buf.subarray(this.pos,i);return this.pos=i,e},readPackedVarint:function(i,e){if(this.type!==Xr.Bytes)return i.push(this.readVarint(e));var s=za(this);for(i=i||[];this.pos127;);else if(e===Xr.Bytes)this.pos=this.readVarint()+this.pos;else if(e===Xr.Fixed32)this.pos+=4;else{if(e!==Xr.Fixed64)throw new Error("Unimplemented type: "+e);this.pos+=8}},writeTag:function(i,e){this.writeVarint(i<<3|e)},realloc:function(i){for(var e=this.length||16;e268435455||i<0?function(e,s){var h,_;if(e>=0?(h=e%4294967296|0,_=e/4294967296|0):(_=~(-e/4294967296),4294967295^(h=~(-e%4294967296))?h=h+1|0:(h=0,_=_+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");s.realloc(10),function(v,E,C){C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,C.buf[C.pos]=127&(v>>>=7)}(h,0,s),function(v,E){var C=(7&v)<<4;E.buf[E.pos++]|=C|((v>>>=3)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v|((v>>>=7)?128:0),v&&(E.buf[E.pos++]=127&v)))))}(_,s)}(i,this):(this.realloc(4),this.buf[this.pos++]=127&i|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=127&(i>>>=7)|(i>127?128:0),i<=127||(this.buf[this.pos++]=i>>>7&127))))},writeSVarint:function(i){this.writeVarint(i<0?2*-i-1:2*i)},writeBoolean:function(i){this.writeVarint(!!i)},writeString:function(i){i=String(i),this.realloc(4*i.length),this.pos++;var e=this.pos;this.pos=function(h,_,v){for(var E,C,M=0;M<_.length;M++){if((E=_.charCodeAt(M))>55295&&E<57344){if(!C){E>56319||M+1===_.length?(h[v++]=239,h[v++]=191,h[v++]=189):C=E;continue}if(E<56320){h[v++]=239,h[v++]=191,h[v++]=189,C=E;continue}E=C-55296<<10|E-56320|65536,C=null}else C&&(h[v++]=239,h[v++]=191,h[v++]=189,C=null);E<128?h[v++]=E:(E<2048?h[v++]=E>>6|192:(E<65536?h[v++]=E>>12|224:(h[v++]=E>>18|240,h[v++]=E>>12&63|128),h[v++]=E>>6&63|128),h[v++]=63&E|128)}return v}(this.buf,i,this.pos);var s=this.pos-e;s>=128&&Wd(e,s,this),this.pos=e-1,this.writeVarint(s),this.pos+=s},writeFloat:function(i){this.realloc(4),Gd(this.buf,i,this.pos,!0,23,4),this.pos+=4},writeDouble:function(i){this.realloc(8),Gd(this.buf,i,this.pos,!0,52,8),this.pos+=8},writeBytes:function(i){var e=i.length;this.writeVarint(e),this.realloc(e);for(var s=0;s=128&&Wd(s,h,this),this.pos=s-1,this.writeVarint(h),this.pos+=h},writeMessage:function(i,e,s){this.writeTag(i,Xr.Bytes),this.writeRawMessage(e,s)},writePackedVarint:function(i,e){e.length&&this.writeMessage(i,b0,e)},writePackedSVarint:function(i,e){e.length&&this.writeMessage(i,x0,e)},writePackedBoolean:function(i,e){e.length&&this.writeMessage(i,k0,e)},writePackedFloat:function(i,e){e.length&&this.writeMessage(i,w0,e)},writePackedDouble:function(i,e){e.length&&this.writeMessage(i,E0,e)},writePackedFixed32:function(i,e){e.length&&this.writeMessage(i,S0,e)},writePackedSFixed32:function(i,e){e.length&&this.writeMessage(i,T0,e)},writePackedFixed64:function(i,e){e.length&&this.writeMessage(i,I0,e)},writePackedSFixed64:function(i,e){e.length&&this.writeMessage(i,C0,e)},writeBytesField:function(i,e){this.writeTag(i,Xr.Bytes),this.writeBytes(e)},writeFixed32Field:function(i,e){this.writeTag(i,Xr.Fixed32),this.writeFixed32(e)},writeSFixed32Field:function(i,e){this.writeTag(i,Xr.Fixed32),this.writeSFixed32(e)},writeFixed64Field:function(i,e){this.writeTag(i,Xr.Fixed64),this.writeFixed64(e)},writeSFixed64Field:function(i,e){this.writeTag(i,Xr.Fixed64),this.writeSFixed64(e)},writeVarintField:function(i,e){this.writeTag(i,Xr.Varint),this.writeVarint(e)},writeSVarintField:function(i,e){this.writeTag(i,Xr.Varint),this.writeSVarint(e)},writeStringField:function(i,e){this.writeTag(i,Xr.Bytes),this.writeString(e)},writeFloatField:function(i,e){this.writeTag(i,Xr.Fixed32),this.writeFloat(e)},writeDoubleField:function(i,e){this.writeTag(i,Xr.Fixed64),this.writeDouble(e)},writeBooleanField:function(i,e){this.writeVarintField(i,!!e)}};class Dh{constructor(e,{pixelRatio:s,version:h,stretchX:_,stretchY:v,content:E}){this.paddedRect=e,this.pixelRatio=s,this.stretchX=_,this.stretchY=v,this.content=E,this.version=h}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Jd{constructor(e,s){const h={},_={};this.haveRenderCallbacks=[];const v=[];this.addImages(e,h,v),this.addImages(s,_,v);const{w:E,h:C}=Xd(v),M=new Sn({width:E||1,height:C||1});for(const F in e){const j=e[F],W=h[F].paddedRect;Sn.copy(j.data,M,{x:0,y:0},{x:W.x+1,y:W.y+1},j.data)}for(const F in s){const j=s[F],W=_[F].paddedRect,X=W.x+1,ne=W.y+1,se=j.data.width,ke=j.data.height;Sn.copy(j.data,M,{x:0,y:0},{x:X,y:ne},j.data),Sn.copy(j.data,M,{x:0,y:ke-1},{x:X,y:ne-1},{width:se,height:1}),Sn.copy(j.data,M,{x:0,y:0},{x:X,y:ne+ke},{width:se,height:1}),Sn.copy(j.data,M,{x:se-1,y:0},{x:X-1,y:ne},{width:1,height:ke}),Sn.copy(j.data,M,{x:0,y:0},{x:X+se,y:ne},{width:1,height:ke})}this.image=M,this.iconPositions=h,this.patternPositions=_}addImages(e,s,h){for(const _ in e){const v=e[_],E={x:0,y:0,w:v.data.width+2,h:v.data.height+2};h.push(E),s[_]=new Dh(E,v),v.hasRenderCallback&&this.haveRenderCallbacks.push(_)}}patchUpdatedImages(e,s){e.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const h in e.updatedImages)this.patchUpdatedImage(this.iconPositions[h],e.getImage(h),s),this.patchUpdatedImage(this.patternPositions[h],e.getImage(h),s)}patchUpdatedImage(e,s,h){if(!e||!s||e.version===s.version)return;e.version=s.version;const[_,v]=e.tl;h.update(s.data,void 0,{x:_,y:v})}}Gt("ImagePosition",Dh),Gt("ImageAtlas",Jd),n.WritingMode=void 0,(es=n.WritingMode||(n.WritingMode={}))[es.none=0]="none",es[es.horizontal=1]="horizontal",es[es.vertical=2]="vertical",es[es.horizontalOnly=3]="horizontalOnly";const iu=-17;class Rl{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(e,s){const h=new Rl;return h.scale=e||1,h.fontStack=s,h}static forImage(e){const s=new Rl;return s.imageName=e,s}}class ko{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,s){const h=new ko;for(let _=0;_=0&&h>=e&&au[this.text.charCodeAt(h)];h--)s--;this.text=this.text.substring(e,s),this.sectionIndex=this.sectionIndex.slice(e,s)}substring(e,s){const h=new ko;return h.text=this.text.substring(e,s),h.sectionIndex=this.sectionIndex.slice(e,s),h.sections=this.sections,h}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,s)=>Math.max(e,this.sections[s].scale),0)}addTextSection(e,s){this.text+=e.text,this.sections.push(Rl.forText(e.scale,e.fontStack||s));const h=this.sections.length-1;for(let _=0;_=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function nu(i,e,s,h,_,v,E,C,M,F,j,W,X,ne,se,ke){const we=ko.fromFeature(i,_);let Oe;W===n.WritingMode.vertical&&we.verticalizePunctuation();const{processBidirectionalText:Qe,processStyledBidirectionalText:Le}=_n;if(Qe&&we.sections.length===1){Oe=[];const ht=Qe(we.toString(),Rh(we,F,v,e,h,ne,se));for(const qt of ht){const Zt=new ko;Zt.text=qt,Zt.sections=we.sections;for(let Nt=0;Nt0&&Ra>un&&(un=Ra)}else{const Cn=Zt[Ir.fontStack],hn=Cn&&Cn[Gi];if(hn&&hn.rect)Kn=hn.rect,Bn=hn.metrics;else{const Ra=qt[Ir.fontStack],Ol=Ra&&Ra[Gi];if(!Ol)continue;Bn=Ol.metrics}Wi=(qi-Ir.scale)*Ni}On?(ht.verticalizable=!0,cn.push({glyph:Gi,imageName:Xn,x:ti,y:li+Wi,vertical:On,scale:Ir.scale,fontStack:Ir.fontStack,sectionIndex:bn,metrics:Bn,rect:Kn}),ti+=Da*Ir.scale+rr):(cn.push({glyph:Gi,imageName:Xn,x:ti,y:li+Wi,vertical:On,scale:Ir.scale,fontStack:Ir.fontStack,sectionIndex:bn,metrics:Bn,rect:Kn}),ti+=Bn.advance*Ir.scale+rr)}cn.length!==0&&(Ti=Math.max(ti-rr,Ti),R0(cn,0,cn.length-1,$i,un)),ti=0;const ci=At*qi+un;tn.lineOffset=Math.max(un,Hi),li+=ci,In=Math.max(ci,In),++xi}var zi;const ji=li-iu,{horizontalAlign:Zi,verticalAlign:ln}=Lh(Ut);(function(wi,qi,Hi,tn,cn,un,ci,Mi,Ir){const bn=(qi-Hi)*cn;let Gi=0;Gi=un!==ci?-Mi*tn-iu:(-tn*Ir+.5)*ci;for(const Wi of wi)for(const Bn of Wi.positionedGlyphs)Bn.x+=bn,Bn.y+=Gi})(ht.positionedLines,$i,Zi,ln,Ti,In,At,ji,Rt.length),ht.top+=-ln*ji,ht.bottom=ht.top+ji,ht.left+=-Zi*Ti,ht.right=ht.left+Ti}(ft,e,s,h,Oe,E,C,M,W,F,X,ke),!function(ht){for(const qt of ht)if(qt.positionedGlyphs.length!==0)return!1;return!0}(Ke)&&ft}const au={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},M0={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Yd(i,e,s,h,_,v){if(e.imageName){const E=h[e.imageName];return E?E.displaySize[0]*e.scale*Ni/v+_:0}{const E=s[e.fontStack],C=E&&E[i];return C?C.metrics.advance*e.scale+_:0}}function Qd(i,e,s,h){const _=Math.pow(i-e,2);return h?i=0;let j=0;for(let X=0;X-s/2;){if(E--,E<0)return!1;C-=i[E].dist(v),v=i[E]}C+=i[E].dist(i[E+1]),E++;const M=[];let F=0;for(;Ch;)F-=M.shift().angleDelta;if(F>_)return!1;E++,C+=j.dist(W)}return!0}function ap(i){let e=0;for(let s=0;sF){const se=(F-M)/ne,ke=ni(W.x,X.x,se),we=ni(W.y,X.y,se),Oe=new ts(ke,we,X.angleTo(W),j);return Oe._round(),!E||np(i,Oe,C,E,e)?Oe:void 0}M+=ne}}function O0(i,e,s,h,_,v,E,C,M){const F=sp(h,v,E),j=op(h,_),W=j*E,X=i[0].x===0||i[0].x===M||i[0].y===0||i[0].y===M;return e-W=0&&Ke=0&&ft=0&&X+F<=j){const ht=new ts(Ke,ft,Qe,se);ht._round(),h&&!np(i,ht,v,h,_)||ne.push(ht)}}W+=Oe}return C||ne.length||E||(ne=lp(i,W/2,s,h,_,v,E,!0,M)),ne}function cp(i,e,s,h,_){const v=[];for(let E=0;E=h&&W.x>=h||(j.x>=h?j=new ct(h,j.y+(h-j.x)/(W.x-j.x)*(W.y-j.y))._round():W.x>=h&&(W=new ct(h,j.y+(h-j.x)/(W.x-j.x)*(W.y-j.y))._round()),j.y>=_&&W.y>=_||(j.y>=_?j=new ct(j.x+(_-j.y)/(W.y-j.y)*(W.x-j.x),_)._round():W.y>=_&&(W=new ct(j.x+(_-j.y)/(W.y-j.y)*(W.x-j.x),_)._round()),M&&j.equals(M[M.length-1])||(M=[j],v.push(M)),M.push(W)))))}}return v}function up(i,e,s,h){const _=[],v=i.image,E=v.pixelRatio,C=v.paddedRect.w-2,M=v.paddedRect.h-2,F=i.right-i.left,j=i.bottom-i.top,W=v.stretchX||[[0,C]],X=v.stretchY||[[0,M]],ne=(At,Ut)=>At+Ut[1]-Ut[0],se=W.reduce(ne,0),ke=X.reduce(ne,0),we=C-se,Oe=M-ke;let Qe=0,Le=se,Ke=0,ft=ke,ht=0,qt=we,Zt=0,Nt=Oe;if(v.content&&h){const At=v.content;Qe=su(W,0,At[0]),Ke=su(X,0,At[1]),Le=su(W,At[0],At[2]),ft=su(X,At[1],At[3]),ht=At[0]-Qe,Zt=At[1]-Ke,qt=At[2]-At[0]-Le,Nt=At[3]-At[1]-ft}const Rt=(At,Ut,Lt,xt)=>{const rr=ou(At.stretch-Qe,Le,F,i.left),Jt=lu(At.fixed-ht,qt,At.stretch,se),xr=ou(Ut.stretch-Ke,ft,j,i.top),ti=lu(Ut.fixed-Zt,Nt,Ut.stretch,ke),li=ou(Lt.stretch-Qe,Le,F,i.left),Ti=lu(Lt.fixed-ht,qt,Lt.stretch,se),In=ou(xt.stretch-Ke,ft,j,i.top),$i=lu(xt.fixed-Zt,Nt,xt.stretch,ke),xi=new ct(rr,xr),zi=new ct(li,xr),ji=new ct(li,In),Zi=new ct(rr,In),ln=new ct(Jt/E,ti/E),wi=new ct(Ti/E,$i/E),qi=e*Math.PI/180;if(qi){const cn=Math.sin(qi),un=Math.cos(qi),ci=[un,-cn,cn,un];xi._matMult(ci),zi._matMult(ci),Zi._matMult(ci),ji._matMult(ci)}const Hi=At.stretch+At.fixed,tn=Ut.stretch+Ut.fixed;return{tl:xi,tr:zi,bl:Zi,br:ji,tex:{x:v.paddedRect.x+1+Hi,y:v.paddedRect.y+1+tn,w:Lt.stretch+Lt.fixed-Hi,h:xt.stretch+xt.fixed-tn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:ln,pixelOffsetBR:wi,minFontScaleX:qt/E/F,minFontScaleY:Nt/E/j,isSDF:s}};if(h&&(v.stretchX||v.stretchY)){const At=hp(W,we,se),Ut=hp(X,Oe,ke);for(let Lt=0;Lt0&&(se=Math.max(10,se),this.circleDiameter=se)}else{let W=E.top*C-M[0],X=E.bottom*C+M[2],ne=E.left*C-M[3],se=E.right*C+M[1];const ke=E.collisionPadding;if(ke&&(ne-=ke[0]*C,W-=ke[1]*C,se+=ke[2]*C,X+=ke[3]*C),j){const we=new ct(ne,W),Oe=new ct(se,W),Qe=new ct(ne,X),Le=new ct(se,X),Ke=j*Math.PI/180;we._rotate(Ke),Oe._rotate(Ke),Qe._rotate(Ke),Le._rotate(Ke),ne=Math.min(we.x,Oe.x,Qe.x,Le.x),se=Math.max(we.x,Oe.x,Qe.x,Le.x),W=Math.min(we.y,Oe.y,Qe.y,Le.y),X=Math.max(we.y,Oe.y,Qe.y,Le.y)}e.emplaceBack(s.x,s.y,ne,W,se,X,h,_,v)}this.boxEndIndex=e.length}}class F0{constructor(e=[],s=N0){if(this.data=e,this.length=this.data.length,this.compare=s,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],s=this.data.pop();return this.length--,this.length>0&&(this.data[0]=s,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:s,compare:h}=this,_=s[e];for(;e>0;){const v=e-1>>1,E=s[v];if(h(_,E)>=0)break;s[e]=E,e=v}s[e]=_}_down(e){const{data:s,compare:h}=this,_=this.length>>1,v=s[e];for(;e<_;){let E=1+(e<<1),C=s[E];const M=E+1;if(M=0)break;s[e]=C,e=E}s[e]=v}}function N0(i,e){return ie?1:0}function U0(i,e=1,s=!1){let h=1/0,_=1/0,v=-1/0,E=-1/0;const C=i[0];for(let ne=0;nev)&&(v=se.x),(!ne||se.y>E)&&(E=se.y)}const M=Math.min(v-h,E-_);let F=M/2;const j=new F0([],V0);if(M===0)return new ct(h,_);for(let ne=h;neW.d||!W.d)&&(W=ne,s&&console.log("found best %d after %d probes",Math.round(1e4*ne.d)/1e4,X)),ne.max-W.d<=e||(F=ne.h/2,j.push(new So(ne.p.x-F,ne.p.y-F,F,i)),j.push(new So(ne.p.x+F,ne.p.y-F,F,i)),j.push(new So(ne.p.x-F,ne.p.y+F,F,i)),j.push(new So(ne.p.x+F,ne.p.y+F,F,i)),X+=4)}return s&&(console.log(`num probes: ${X}`),console.log(`best distance: ${W.d}`)),W.p}function V0(i,e){return e.max-i.max}function So(i,e,s,h){this.p=new ct(i,e),this.h=s,this.d=function(_,v){let E=!1,C=1/0;for(let M=0;M_.y!=se.y>_.y&&_.x<(se.x-ne.x)*(_.y-ne.y)/(se.y-ne.y)+ne.x&&(E=!E),C=Math.min(C,vd(_,ne,se))}}return(E?1:-1)*Math.sqrt(C)}(this.p,h),this.max=this.d+this.h*Math.SQRT2}const Bh=Number.POSITIVE_INFINITY;function fp(i,e){return e[1]!==Bh?function(s,h,_){let v=0,E=0;switch(h=Math.abs(h),_=Math.abs(_),s){case"top-right":case"top-left":case"top":E=_-7;break;case"bottom-right":case"bottom-left":case"bottom":E=7-_}switch(s){case"top-right":case"bottom-right":case"right":v=-h;break;case"top-left":case"bottom-left":case"left":v=h}return[v,E]}(i,e[0],e[1]):function(s,h){let _=0,v=0;h<0&&(h=0);const E=h/Math.sqrt(2);switch(s){case"top-right":case"top-left":v=E-7;break;case"bottom-right":case"bottom-left":v=7-E;break;case"bottom":v=7-h;break;case"top":v=h-7}switch(s){case"top-right":case"bottom-right":_=-E;break;case"top-left":case"bottom-left":_=E;break;case"left":_=h;break;case"right":_=-h}return[_,v]}(i,e[0])}function Oh(i){switch(i){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function $0(i,e,s,h,_,v,E,C,M,F,j){let W=v.textMaxSize.evaluate(e,{});W===void 0&&(W=E);const X=i.layers[0].layout,ne=X.get("icon-offset").evaluate(e,{},j),se=pp(s.horizontal),ke=E/24,we=i.tilePixelRatio*ke,Oe=i.tilePixelRatio*W/24,Qe=i.tilePixelRatio*C,Le=i.tilePixelRatio*X.get("symbol-spacing"),Ke=X.get("text-padding")*i.tilePixelRatio,ft=function(xt,rr,Jt,xr=1){const ti=xt.get("icon-padding").evaluate(rr,{},Jt),li=ti&&ti.values;return[li[0]*xr,li[1]*xr,li[2]*xr,li[3]*xr]}(X,e,j,i.tilePixelRatio),ht=X.get("text-max-angle")/180*Math.PI,qt=X.get("text-rotation-alignment")!=="viewport"&&X.get("symbol-placement")!=="point",Zt=X.get("icon-rotation-alignment")==="map"&&X.get("symbol-placement")!=="point",Nt=X.get("symbol-placement"),Rt=Le/2,At=X.get("icon-text-fit");let Ut;h&&At!=="none"&&(i.allowVerticalPlacement&&s.vertical&&(Ut=rp(h,s.vertical,At,X.get("icon-text-fit-padding"),ne,ke)),se&&(h=rp(h,se,At,X.get("icon-text-fit-padding"),ne,ke)));const Lt=(xt,rr)=>{rr.x<0||rr.x>=Si||rr.y<0||rr.y>=Si||function(Jt,xr,ti,li,Ti,In,$i,xi,zi,ji,Zi,ln,wi,qi,Hi,tn,cn,un,ci,Mi,Ir,bn,Gi,Wi,Bn){const Kn=Jt.addToLineVertexArray(xr,ti);let Xn,Da,On,Cn,hn=0,Ra=0,Ol=0,Pp=0,Hh=-1,Wh=-1;const La={};let zp=Pi.exports(""),Kh=0,Xh=0;if(xi._unevaluatedLayout.getValue("text-radial-offset")===void 0?[Kh,Xh]=xi.layout.get("text-offset").evaluate(Ir,{},Wi).map(fn=>fn*Ni):(Kh=xi.layout.get("text-radial-offset").evaluate(Ir,{},Wi)*Ni,Xh=Bh),Jt.allowVerticalPlacement&&li.vertical){const fn=xi.layout.get("text-rotate").evaluate(Ir,{},Wi)+90;On=new cu(zi,xr,ji,Zi,ln,li.vertical,wi,qi,Hi,fn),$i&&(Cn=new cu(zi,xr,ji,Zi,ln,$i,cn,un,Hi,fn))}if(Ti){const fn=xi.layout.get("icon-rotate").evaluate(Ir,{}),_a=xi.layout.get("icon-text-fit")!=="none",Fl=up(Ti,fn,Gi,_a),Nl=$i?up($i,fn,Gi,_a):void 0;Da=new cu(zi,xr,ji,Zi,ln,Ti,cn,un,!1,fn),hn=4*Fl.length;const Rp=Jt.iconSizeData;let Ns=null;Rp.kind==="source"?(Ns=[Ma*xi.layout.get("icon-size").evaluate(Ir,{})],Ns[0]>rs&&Y(`${Jt.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):Rp.kind==="composite"&&(Ns=[Ma*bn.compositeIconSizes[0].evaluate(Ir,{},Wi),Ma*bn.compositeIconSizes[1].evaluate(Ir,{},Wi)],(Ns[0]>rs||Ns[1]>rs)&&Y(`${Jt.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),Jt.addSymbols(Jt.icon,Fl,Ns,Mi,ci,Ir,n.WritingMode.none,xr,Kn.lineStartIndex,Kn.lineLength,-1,Wi),Hh=Jt.icon.placedSymbolArray.length-1,Nl&&(Ra=4*Nl.length,Jt.addSymbols(Jt.icon,Nl,Ns,Mi,ci,Ir,n.WritingMode.vertical,xr,Kn.lineStartIndex,Kn.lineLength,-1,Wi),Wh=Jt.icon.placedSymbolArray.length-1)}const Mp=Object.keys(li.horizontal);for(const fn of Mp){const _a=li.horizontal[fn];if(!Xn){zp=Pi.exports(_a.text);const Nl=xi.layout.get("text-rotate").evaluate(Ir,{},Wi);Xn=new cu(zi,xr,ji,Zi,ln,_a,wi,qi,Hi,Nl)}const Fl=_a.positionedLines.length===1;if(Ol+=dp(Jt,xr,_a,In,xi,Hi,Ir,tn,Kn,li.vertical?n.WritingMode.horizontal:n.WritingMode.horizontalOnly,Fl?Mp:[fn],La,Hh,bn,Wi),Fl)break}li.vertical&&(Pp+=dp(Jt,xr,li.vertical,In,xi,Hi,Ir,tn,Kn,n.WritingMode.vertical,["vertical"],La,Wh,bn,Wi));const t1=Xn?Xn.boxStartIndex:Jt.collisionBoxArray.length,r1=Xn?Xn.boxEndIndex:Jt.collisionBoxArray.length,i1=On?On.boxStartIndex:Jt.collisionBoxArray.length,n1=On?On.boxEndIndex:Jt.collisionBoxArray.length,a1=Da?Da.boxStartIndex:Jt.collisionBoxArray.length,s1=Da?Da.boxEndIndex:Jt.collisionBoxArray.length,o1=Cn?Cn.boxStartIndex:Jt.collisionBoxArray.length,l1=Cn?Cn.boxEndIndex:Jt.collisionBoxArray.length;let Jn=-1;const pu=(fn,_a)=>fn&&fn.circleDiameter?Math.max(fn.circleDiameter,_a):_a;Jn=pu(Xn,Jn),Jn=pu(On,Jn),Jn=pu(Da,Jn),Jn=pu(Cn,Jn);const Dp=Jn>-1?1:0;Dp&&(Jn*=Bn/Ni),Jt.glyphOffsetArray.length>=To.MAX_GLYPHS&&Y("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ir.sortKey!==void 0&&Jt.addToSortKeyRanges(Jt.symbolInstances.length,Ir.sortKey),Jt.symbolInstances.emplaceBack(xr.x,xr.y,La.right>=0?La.right:-1,La.center>=0?La.center:-1,La.left>=0?La.left:-1,La.vertical||-1,Hh,Wh,zp,t1,r1,i1,n1,a1,s1,o1,l1,ji,Ol,Pp,hn,Ra,Dp,0,wi,Kh,Xh,Jn)}(i,rr,xt,s,h,_,Ut,i.layers[0],i.collisionBoxArray,e.index,e.sourceLayerIndex,i.index,we,[Ke,Ke,Ke,Ke],qt,M,Qe,ft,Zt,ne,e,v,F,j,E)};if(Nt==="line")for(const xt of cp(e.geometry,0,0,Si,Si)){const rr=O0(xt,Le,ht,s.vertical||se,h,24,Oe,i.overscaling,Si);for(const Jt of rr){const xr=se;xr&&j0(i,xr.text,Rt,Jt)||Lt(xt,Jt)}}else if(Nt==="line-center"){for(const xt of e.geometry)if(xt.length>1){const rr=B0(xt,ht,s.vertical||se,h,24,Oe);rr&&Lt(xt,rr)}}else if(e.type==="Polygon")for(const xt of kh(e.geometry,0)){const rr=U0(xt,16);Lt(xt[0],new ts(rr.x,rr.y,0))}else if(e.type==="LineString")for(const xt of e.geometry)Lt(xt,new ts(xt[0].x,xt[0].y,0));else if(e.type==="Point")for(const xt of e.geometry)for(const rr of xt)Lt([rr],new ts(rr.x,rr.y,0))}const rs=32640;function dp(i,e,s,h,_,v,E,C,M,F,j,W,X,ne,se){const ke=function(Qe,Le,Ke,ft,ht,qt,Zt,Nt){const Rt=ft.layout.get("text-rotate").evaluate(qt,{})*Math.PI/180,At=[];for(const Ut of Le.positionedLines)for(const Lt of Ut.positionedGlyphs){if(!Lt.rect)continue;const xt=Lt.rect||{};let rr=4,Jt=!0,xr=1,ti=0;const li=(ht||Nt)&&Lt.vertical,Ti=Lt.metrics.advance*Lt.scale/2;if(Nt&&Le.verticalizable){const ci=(Lt.scale-1)*Ni,Mi=(Ni-Lt.metrics.width*Lt.scale)/2;ti=Ut.lineOffset/2-(Lt.imageName?-Mi:ci)}if(Lt.imageName){const ci=Zt[Lt.imageName];Jt=ci.sdf,xr=ci.pixelRatio,rr=1/xr}const In=ht?[Lt.x+Ti,Lt.y]:[0,0];let $i=ht?[0,0]:[Lt.x+Ti+Ke[0],Lt.y+Ke[1]-ti],xi=[0,0];li&&(xi=$i,$i=[0,0]);const zi=(Lt.metrics.left-rr)*Lt.scale-Ti+$i[0],ji=(-Lt.metrics.top-rr)*Lt.scale+$i[1],Zi=zi+xt.w*Lt.scale/xr,ln=ji+xt.h*Lt.scale/xr,wi=new ct(zi,ji),qi=new ct(Zi,ji),Hi=new ct(zi,ln),tn=new ct(Zi,ln);if(li){const ci=new ct(-Ti,Ti-iu),Mi=-Math.PI/2,Ir=12-Ti,bn=new ct(22-Ir,-(Lt.imageName?Ir:0)),Gi=new ct(...xi);wi._rotateAround(Mi,ci)._add(bn)._add(Gi),qi._rotateAround(Mi,ci)._add(bn)._add(Gi),Hi._rotateAround(Mi,ci)._add(bn)._add(Gi),tn._rotateAround(Mi,ci)._add(bn)._add(Gi)}if(Rt){const ci=Math.sin(Rt),Mi=Math.cos(Rt),Ir=[Mi,-ci,ci,Mi];wi._matMult(Ir),qi._matMult(Ir),Hi._matMult(Ir),tn._matMult(Ir)}const cn=new ct(0,0),un=new ct(0,0);At.push({tl:wi,tr:qi,bl:Hi,br:tn,tex:xt,writingMode:Le.writingMode,glyphOffset:In,sectionIndex:Lt.sectionIndex,isSDF:Jt,pixelOffsetTL:cn,pixelOffsetBR:un,minFontScaleX:0,minFontScaleY:0})}return At}(0,s,C,_,v,E,h,i.allowVerticalPlacement),we=i.textSizeData;let Oe=null;we.kind==="source"?(Oe=[Ma*_.layout.get("text-size").evaluate(E,{})],Oe[0]>rs&&Y(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):we.kind==="composite"&&(Oe=[Ma*ne.compositeTextSizes[0].evaluate(E,{},se),Ma*ne.compositeTextSizes[1].evaluate(E,{},se)],(Oe[0]>rs||Oe[1]>rs)&&Y(`${i.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),i.addSymbols(i.text,ke,Oe,C,v,E,F,e,M.lineStartIndex,M.lineLength,X,se);for(const Qe of j)W[Qe]=i.text.placedSymbolArray.length-1;return 4*ke.length}function pp(i){for(const e in i)return i[e];return null}function j0(i,e,s,h){const _=i.compareText;if(e in _){const v=_[e];for(let E=v.length-1;E>=0;E--)if(h.dist(v[E])E.id),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=yh([]),this.placementViewportMatrix=yh([]);const s=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ip(this.zoom,s["text-size"]),this.iconSizeData=ip(this.zoom,s["icon-size"]);const h=this.layers[0].layout,_=h.get("symbol-sort-key"),v=h.get("symbol-z-order");this.canOverlap=$h(h,"text-overlap","text-allow-overlap")!=="never"||$h(h,"icon-overlap","icon-allow-overlap")!=="never"||h.get("text-ignore-placement")||h.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!_.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,h.get("symbol-placement")==="point"&&(this.writingModes=h.get("text-writing-mode").map(E=>n.WritingMode[E])),this.stateDependentLayerIds=this.layers.filter(E=>E.isStateDependent()).map(E=>E.id),this.sourceID=e.sourceID}createArrays(){this.text=new Nh(new Rs(this.layers,this.zoom,e=>/^text/.test(e))),this.icon=new Nh(new Rs(this.layers,this.zoom,e=>/^icon/.test(e))),this.glyphOffsetArray=new Dt,this.lineVertexArray=new jt,this.symbolInstances=new Vt}calculateGlyphDependencies(e,s,h,_,v){for(let E=0;E0)&&(E.value.kind!=="constant"||E.value.value.length>0),j=M.value.kind!=="constant"||!!M.value.value||Object.keys(M.parameters).length>0,W=v.get("symbol-sort-key");if(this.features=[],!F&&!j)return;const X=s.iconDependencies,ne=s.glyphDependencies,se=s.availableImages,ke=new si(this.zoom);for(const{feature:we,id:Oe,index:Qe,sourceLayerIndex:Le}of e){const Ke=_._featureFilter.needGeometry,ft=Bs(we,Ke);if(!_._featureFilter.filter(ke,ft,h))continue;let ht,qt;if(Ke||(ft.geometry=Ls(we)),F){const Nt=_.getValueAndResolveTokens("text-field",ft,h,se),Rt=Ee.factory(Nt);Z0(Rt)&&(this.hasRTLText=!0),(!this.hasRTLText||zs()==="unavailable"||this.hasRTLText&&_n.isParsed())&&(ht=v0(Rt,_,ft))}if(j){const Nt=_.getValueAndResolveTokens("icon-image",ft,h,se);qt=Nt instanceof Te?Nt:Te.fromString(Nt)}if(!ht&&!qt)continue;const Zt=this.sortFeaturesByKey?W.evaluate(ft,{},h):void 0;if(this.features.push({id:Oe,text:ht,icon:qt,index:Qe,sourceLayerIndex:Le,geometry:ft.geometry,properties:we.properties,type:q0[we.type],sortKey:Zt}),qt&&(X[qt.name]=!0),ht){const Nt=E.evaluate(ft,{},h).join(","),Rt=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(n.WritingMode.vertical)>=0;for(const At of ht.sections)if(At.image)X[At.image.name]=!0;else{const Ut=po(ht.toString()),Lt=At.fontStack||Nt,xt=ne[Lt]=ne[Lt]||{};this.calculateGlyphDependencies(At.text,xt,Rt,this.allowVerticalPlacement,Ut)}}}v.get("symbol-placement")==="line"&&(this.features=function(we){const Oe={},Qe={},Le=[];let Ke=0;function ft(Nt){Le.push(we[Nt]),Ke++}function ht(Nt,Rt,At){const Ut=Qe[Nt];return delete Qe[Nt],Qe[Rt]=Ut,Le[Ut].geometry[0].pop(),Le[Ut].geometry[0]=Le[Ut].geometry[0].concat(At[0]),Ut}function qt(Nt,Rt,At){const Ut=Oe[Rt];return delete Oe[Rt],Oe[Nt]=Ut,Le[Ut].geometry[0].shift(),Le[Ut].geometry[0]=At[0].concat(Le[Ut].geometry[0]),Ut}function Zt(Nt,Rt,At){const Ut=At?Rt[0][Rt[0].length-1]:Rt[0][0];return`${Nt}:${Ut.x}:${Ut.y}`}for(let Nt=0;NtNt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((we,Oe)=>we.sortKey-Oe.sortKey)}update(e,s,h){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(e,s,this.layers,h),this.icon.programConfigurations.updatePaintArrays(e,s,this.layers,h))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,s){const h=this.lineVertexArray.length;if(e.segment!==void 0){let _=e.dist(s[e.segment+1]),v=e.dist(s[e.segment]);const E={};for(let C=e.segment+1;C=0;C--)E[C]={x:s[C].x,y:s[C].y,tileUnitDistanceFromAnchor:v},C>0&&(v+=s[C-1].dist(s[C]));for(let C=0;C0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(e,s){const h=e.placedSymbolArray.get(s),_=h.vertexStartIndex+4*h.numGlyphs;for(let v=h.vertexStartIndex;v<_;v+=4)e.indexArray.emplaceBack(v,v+1,v+2),e.indexArray.emplaceBack(v+1,v+2,v+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const s=Math.sin(e),h=Math.cos(e),_=[],v=[],E=[];for(let C=0;C_[C]-_[M]||v[M]-v[C]),E}addToSortKeyRanges(e,s){const h=this.sortKeyRanges[this.sortKeyRanges.length-1];h&&h.sortKey===s?h.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:s,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const s of this.symbolInstanceIndexes){const h=this.symbolInstances.get(s);this.featureSortOrder.push(h.featureIndex),[h.rightJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.leftJustifiedTextSymbolIndex].forEach((_,v,E)=>{_>=0&&E.indexOf(_)===v&&this.addIndicesForPlacedSymbol(this.text,_)}),h.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,h.verticalPlacedTextSymbolIndex),h.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.placedIconSymbolIndex),h.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,h.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}Gt("SymbolBucket",To,{omit:["layers","collisionBoxArray","features","compareText"]}),To.MAX_GLYPHS=65535,To.addDynamicAttributes=Fh;const H0=new Fi({"symbol-placement":new Kt(Fe.layout_symbol["symbol-placement"]),"symbol-spacing":new Kt(Fe.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Kt(Fe.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new lr(Fe.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Kt(Fe.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Kt(Fe.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Kt(Fe.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Kt(Fe.layout_symbol["icon-ignore-placement"]),"icon-optional":new Kt(Fe.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Kt(Fe.layout_symbol["icon-rotation-alignment"]),"icon-size":new lr(Fe.layout_symbol["icon-size"]),"icon-text-fit":new Kt(Fe.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Kt(Fe.layout_symbol["icon-text-fit-padding"]),"icon-image":new lr(Fe.layout_symbol["icon-image"]),"icon-rotate":new lr(Fe.layout_symbol["icon-rotate"]),"icon-padding":new lr(Fe.layout_symbol["icon-padding"]),"icon-keep-upright":new Kt(Fe.layout_symbol["icon-keep-upright"]),"icon-offset":new lr(Fe.layout_symbol["icon-offset"]),"icon-anchor":new lr(Fe.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Kt(Fe.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Kt(Fe.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Kt(Fe.layout_symbol["text-rotation-alignment"]),"text-field":new lr(Fe.layout_symbol["text-field"]),"text-font":new lr(Fe.layout_symbol["text-font"]),"text-size":new lr(Fe.layout_symbol["text-size"]),"text-max-width":new lr(Fe.layout_symbol["text-max-width"]),"text-line-height":new Kt(Fe.layout_symbol["text-line-height"]),"text-letter-spacing":new lr(Fe.layout_symbol["text-letter-spacing"]),"text-justify":new lr(Fe.layout_symbol["text-justify"]),"text-radial-offset":new lr(Fe.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Kt(Fe.layout_symbol["text-variable-anchor"]),"text-anchor":new lr(Fe.layout_symbol["text-anchor"]),"text-max-angle":new Kt(Fe.layout_symbol["text-max-angle"]),"text-writing-mode":new Kt(Fe.layout_symbol["text-writing-mode"]),"text-rotate":new lr(Fe.layout_symbol["text-rotate"]),"text-padding":new Kt(Fe.layout_symbol["text-padding"]),"text-keep-upright":new Kt(Fe.layout_symbol["text-keep-upright"]),"text-transform":new lr(Fe.layout_symbol["text-transform"]),"text-offset":new lr(Fe.layout_symbol["text-offset"]),"text-allow-overlap":new Kt(Fe.layout_symbol["text-allow-overlap"]),"text-overlap":new Kt(Fe.layout_symbol["text-overlap"]),"text-ignore-placement":new Kt(Fe.layout_symbol["text-ignore-placement"]),"text-optional":new Kt(Fe.layout_symbol["text-optional"])});var Vh={paint:new Fi({"icon-opacity":new lr(Fe.paint_symbol["icon-opacity"]),"icon-color":new lr(Fe.paint_symbol["icon-color"]),"icon-halo-color":new lr(Fe.paint_symbol["icon-halo-color"]),"icon-halo-width":new lr(Fe.paint_symbol["icon-halo-width"]),"icon-halo-blur":new lr(Fe.paint_symbol["icon-halo-blur"]),"icon-translate":new Kt(Fe.paint_symbol["icon-translate"]),"icon-translate-anchor":new Kt(Fe.paint_symbol["icon-translate-anchor"]),"text-opacity":new lr(Fe.paint_symbol["text-opacity"]),"text-color":new lr(Fe.paint_symbol["text-color"],{runtimeType:yi,getOverride:i=>i.textColor,hasOverride:i=>!!i.textColor}),"text-halo-color":new lr(Fe.paint_symbol["text-halo-color"]),"text-halo-width":new lr(Fe.paint_symbol["text-halo-width"]),"text-halo-blur":new lr(Fe.paint_symbol["text-halo-blur"]),"text-translate":new Kt(Fe.paint_symbol["text-translate"]),"text-translate-anchor":new Kt(Fe.paint_symbol["text-translate-anchor"])}),layout:H0};class mp{constructor(e){if(e.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=e.property.overrides?e.property.overrides.runtimeType:_i,this.defaultValue=e}evaluate(e){if(e.formattedSection){const s=this.defaultValue.property.overrides;if(s&&s.hasOverride(e.formattedSection))return s.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Gt("FormatSectionOverride",mp,{omit:["defaultValue"]});class hu extends Dn{constructor(e){super(e,Vh)}recalculate(e,s){if(super.recalculate(e,s),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const h=this.layout.get("text-writing-mode");if(h){const _=[];for(const v of h)_.indexOf(v)<0&&_.push(v);this.layout._values["text-writing-mode"]=_}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(e,s,h,_){const v=this.layout.get(e).evaluate(s,{},h,_),E=this._unevaluatedLayout._values[e];return E.isDataDriven()||ys(E.value)||!v?v:function(C,M){return M.replace(/{([^{}]+)}/g,(F,j)=>j in C?String(C[j]):"")}(s.properties,v)}createBucket(e){return new To(e)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const e of Vh.paint.overridableProperties){if(!hu.hasPaintOverride(this.layout,e))continue;const s=this.paint.get(e),h=new mp(s),_=new oo(h,s.property.specification);let v=null;v=s.value.kind==="constant"||s.value.kind==="source"?new bs("source",_):new ol("composite",_,s.value.zoomStops),this.paint._values[e]=new Mn(s.property,v,s.parameters)}}_handleOverridablePaintPropertyUpdate(e,s,h){return!(!this.layout||s.isDataDriven()||h.isDataDriven())&&hu.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,s){const h=e.get("text-field"),_=Vh.paint.properties[s];let v=!1;const E=C=>{for(const M of C)if(_.overrides&&_.overrides.hasOverride(M))return void(v=!0)};if(h.value.kind==="constant"&&h.value.value instanceof Ee)E(h.value.value.sections);else if(h.value.kind==="source"){const C=F=>{v||(F instanceof Pt&&Re(F.value)===ii?E(F.value.sections):F instanceof ao?E(F.sections):F.eachChild(C))},M=h.value;M._styleExpression&&C(M._styleExpression.expression)}return v}}function $h(i,e,s){let h="never";const _=i.get(e);return _?h=_:i.get(s)&&(h="always"),h}var W0={paint:new Fi({"background-color":new Kt(Fe.paint_background["background-color"]),"background-pattern":new vl(Fe.paint_background["background-pattern"]),"background-opacity":new Kt(Fe.paint_background["background-opacity"])})},K0={paint:new Fi({"raster-opacity":new Kt(Fe.paint_raster["raster-opacity"]),"raster-hue-rotate":new Kt(Fe.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Kt(Fe.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Kt(Fe.paint_raster["raster-brightness-max"]),"raster-saturation":new Kt(Fe.paint_raster["raster-saturation"]),"raster-contrast":new Kt(Fe.paint_raster["raster-contrast"]),"raster-resampling":new Kt(Fe.paint_raster["raster-resampling"]),"raster-fade-duration":new Kt(Fe.paint_raster["raster-fade-duration"])})};class X0 extends Dn{constructor(e){super(e,{}),this.onAdd=s=>{this.implementation.onAdd&&this.implementation.onAdd(s,s.painter.context.gl)},this.onRemove=s=>{this.implementation.onRemove&&this.implementation.onRemove(s,s.painter.context.gl)},this.implementation=e}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}const J0={circle:class extends Dn{constructor(i){super(i,Cy)}createBucket(i){return new mh(i)}queryRadius(i){const e=i;return kl("circle-radius",this,e)+kl("circle-stroke-width",this,e)+Wc(this.paint.get("circle-translate"))}queryIntersectsFeature(i,e,s,h,_,v,E,C){const M=Kc(i,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),v.angle,E),F=this.paint.get("circle-radius").evaluate(e,s)+this.paint.get("circle-stroke-width").evaluate(e,s),j=this.paint.get("circle-pitch-alignment")==="map",W=j?M:function(ne,se){return ne.map(ke=>Td(ke,se))}(M,C),X=j?F*E:F;for(const ne of h)for(const se of ne){const ke=j?se:Td(se,C);let we=X;const Oe=Xc([],[se.x,se.y,0,1],C);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?we*=Oe[3]/v.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(we*=v.cameraToCenterDistance/Oe[3]),Ey(W,ke,we))return!0}return!1}},heatmap:class extends Dn{constructor(i){super(i,Py),this._updateColorRamp()}createBucket(i){return new Id(i)}_handleSpecialPaintPropertyUpdate(i){i==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Ad({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}},hillshade:class extends Dn{constructor(i){super(i,zy)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}},fill:class extends Dn{constructor(i){super(i,Hy)}recalculate(i,e){super.recalculate(i,e);const s=this.paint._values["fill-outline-color"];s.value.kind==="constant"&&s.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(i){return new Ih(i)}queryRadius(){return Wc(this.paint.get("fill-translate"))}queryIntersectsFeature(i,e,s,h,_,v,E){return yd(Kc(i,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),v.angle,E),h)}isTileClipped(){return!0}},"fill-extrusion":class extends Dn{constructor(i){super(i,o0)}createBucket(i){return new Ah(i)}queryRadius(){return Wc(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(i,e,s,h,_,v,E,C){const M=Kc(i,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),v.angle,E),F=this.paint.get("fill-extrusion-height").evaluate(e,s),j=this.paint.get("fill-extrusion-base").evaluate(e,s),W=function(ne,se,ke,we){const Oe=[];for(const Qe of ne){const Le=[Qe.x,Qe.y,0,1];Xc(Le,Le,se),Oe.push(new ct(Le[0]/Le[3],Le[1]/Le[3]))}return Oe}(M,C),X=function(ne,se,ke,we){const Oe=[],Qe=[],Le=we[8]*se,Ke=we[9]*se,ft=we[10]*se,ht=we[11]*se,qt=we[8]*ke,Zt=we[9]*ke,Nt=we[10]*ke,Rt=we[11]*ke;for(const At of ne){const Ut=[],Lt=[];for(const xt of At){const rr=xt.x,Jt=xt.y,xr=we[0]*rr+we[4]*Jt+we[12],ti=we[1]*rr+we[5]*Jt+we[13],li=we[2]*rr+we[6]*Jt+we[14],Ti=we[3]*rr+we[7]*Jt+we[15],In=li+ft,$i=Ti+ht,xi=xr+qt,zi=ti+Zt,ji=li+Nt,Zi=Ti+Rt,ln=new ct((xr+Le)/$i,(ti+Ke)/$i);ln.z=In/$i,Ut.push(ln);const wi=new ct(xi/Zi,zi/Zi);wi.z=ji/Zi,Lt.push(wi)}Oe.push(Ut),Qe.push(Lt)}return[Oe,Qe]}(h,j,F,C);return function(ne,se,ke){let we=1/0;yd(ke,se)&&(we=Fd(ke,se[0]));for(let Oe=0;Oe=3){for(let ke=0;ke{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const gp=63710088e-1;class pi{constructor(e,s){if(isNaN(e)||isNaN(s))throw new Error(`Invalid LngLat object: (${e}, ${s})`);if(this.lng=+e,this.lat=+s,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new pi(A(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const s=Math.PI/180,h=this.lat*s,_=e.lat*s,v=Math.sin(h)*Math.sin(_)+Math.cos(h)*Math.cos(_)*Math.cos((e.lng-this.lng)*s);return gp*Math.acos(Math.min(v,1))}toBounds(e=0){const s=360*e/40075017,h=s/Math.cos(Math.PI/180*this.lat);return new Fs(new pi(this.lng-h,this.lat-s),new pi(this.lng+h,this.lat+s))}static convert(e){if(e instanceof pi)return e;if(Array.isArray(e)&&(e.length===2||e.length===3))return new pi(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&typeof e=="object"&&e!==null)return new pi(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class Fs{constructor(e,s){e&&(s?this.setSouthWest(e).setNorthEast(s):e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof pi?new pi(e.lng,e.lat):pi.convert(e),this}setSouthWest(e){return this._sw=e instanceof pi?new pi(e.lng,e.lat):pi.convert(e),this}extend(e){const s=this._sw,h=this._ne;let _,v;if(e instanceof pi)_=e,v=e;else{if(!(e instanceof Fs))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Fs.convert(e)):this.extend(pi.convert(e)):this;if(_=e._sw,v=e._ne,!_||!v)return this}return s||h?(s.lng=Math.min(_.lng,s.lng),s.lat=Math.min(_.lat,s.lat),h.lng=Math.max(v.lng,h.lng),h.lat=Math.max(v.lat,h.lat)):(this._sw=new pi(_.lng,_.lat),this._ne=new pi(v.lng,v.lat)),this}getCenter(){return new pi((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new pi(this.getWest(),this.getNorth())}getSouthEast(){return new pi(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:s,lat:h}=pi.convert(e);let _=this._sw.lng<=s&&s<=this._ne.lng;return this._sw.lng>this._ne.lng&&(_=this._sw.lng>=s&&s>=this._ne.lng),this._sw.lat<=h&&h<=this._ne.lat&&_}static convert(e){return e instanceof Fs?e:e&&new Fs(e)}}const _p=2*Math.PI*gp;function yp(i){return _p*Math.cos(i*Math.PI/180)}function vp(i){return(180+i)/360}function bp(i){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+i*Math.PI/360)))/360}function xp(i,e){return i/yp(e)}function jh(i){return 360/Math.PI*Math.atan(Math.exp((180-360*i)*Math.PI/180))-90}class fu{constructor(e,s,h=0){this.x=+e,this.y=+s,this.z=+h}static fromLngLat(e,s=0){const h=pi.convert(e);return new fu(vp(h.lng),bp(h.lat),xp(s,h.lat))}toLngLat(){return new pi(360*this.x-180,jh(this.y))}toAltitude(){return this.z*yp(jh(this.y))}meterInMercatorCoordinateUnits(){return 1/_p*(e=jh(this.y),1/Math.cos(e*Math.PI/180));var e}}function wp(i,e,s){var h=2*Math.PI*6378137/256/Math.pow(2,s);return[i*h-2*Math.PI*6378137/2,e*h-2*Math.PI*6378137/2]}class qh{constructor(e,s,h){if(e<0||e>25||h<0||h>=Math.pow(2,e)||s<0||s>=Math.pow(2,e))throw new Error(`x=${s}, y=${h}, z=${e} outside of bounds. 0<=x<${Math.pow(2,e)}, 0<=y<${Math.pow(2,e)} 0<=z<=25 `);this.z=e,this.x=s,this.y=h,this.key=Ll(0,e,e,s,h)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}url(e,s,h){const _=(E=this.y,C=this.z,M=wp(256*(v=this.x),256*(E=Math.pow(2,C)-E-1),C),F=wp(256*(v+1),256*(E+1),C),M[0]+","+M[1]+","+F[0]+","+F[1]);var v,E,C,M,F;const j=function(W,X,ne){let se,ke="";for(let we=W;we>0;we--)se=1<1?"@2x":"").replace(/{quadkey}/g,j).replace(/{bbox-epsg-3857}/g,_)}isChildOf(e){const s=this.z-e.z;return s>0&&e.x===this.x>>s&&e.y===this.y>>s}getTilePoint(e){const s=Math.pow(2,this.z);return new ct((e.x*s-this.x)*Si,(e.y*s-this.y)*Si)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Ep{constructor(e,s){this.wrap=e,this.canonical=s,this.key=Ll(e,s.z,s.z,s.x,s.y)}}class Tn{constructor(e,s,h,_,v){if(e= z; overscaledZ = ${e}; z = ${h}`);this.overscaledZ=e,this.wrap=s,this.canonical=new qh(h,+_,+v),this.key=Ll(s,e,h,_,v)}clone(){return new Tn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const s=this.canonical.z-e;return e>this.canonical.z?new Tn(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Tn(e,this.wrap,e,this.canonical.x>>s,this.canonical.y>>s)}calculateScaledKey(e,s){if(e>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${e}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-e;return e>this.canonical.z?Ll(this.wrap*+s,e,this.canonical.z,this.canonical.x,this.canonical.y):Ll(this.wrap*+s,e,e,this.canonical.x>>h,this.canonical.y>>h)}isChildOf(e){if(e.wrap!==this.wrap)return!1;const s=this.canonical.z-e.canonical.z;return e.overscaledZ===0||e.overscaledZ>s&&e.canonical.y===this.canonical.y>>s}children(e){if(this.overscaledZ>=e)return[new Tn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const s=this.canonical.z+1,h=2*this.canonical.x,_=2*this.canonical.y;return[new Tn(s,this.wrap,s,h,_),new Tn(s,this.wrap,s,h+1,_),new Tn(s,this.wrap,s,h,_+1),new Tn(s,this.wrap,s,h+1,_+1)]}isLessThan(e){return this.wrape.wrap)&&(this.overscaledZe.overscaledZ)&&(this.canonical.xe.canonical.x)&&this.canonical.ythis.max&&(this.max=C),C=this.dim+1||s<-1||s>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(s+1)*this.stride+(e+1)}_unpackMapbox(e,s,h){return(256*e*256+256*s+h)/10-1e4}_unpackTerrarium(e,s,h){return 256*e+s+h/256-32768}getPixels(){return new Sn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(e,s,h){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let _=s*this.dim,v=s*this.dim+this.dim,E=h*this.dim,C=h*this.dim+this.dim;switch(s){case-1:_=v-1;break;case 1:v=_+1}switch(h){case-1:E=C-1;break;case 1:C=E+1}const M=-s*this.dim,F=-h*this.dim;for(let j=E;j=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${e} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[e]}}class Tp{constructor(e,s,h,_,v){this.type="Feature",this._vectorTileFeature=e,e._z=s,e._x=h,e._y=_,this.properties=e.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={geometry:this.geometry};for(const s in this)s!=="_geometry"&&s!=="_vectorTileFeature"&&(e[s]=this[s]);return e}}class Ip{constructor(e,s){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new Ps(Si,16,0),this.grid3D=new Ps(Si,16,0),this.featureIndexArray=new br,this.promoteId=s}insert(e,s,h,_,v,E){const C=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(h,_,v);const M=E?this.grid3D:this.grid;for(let F=0;F=0&&W[3]>=0&&M.insert(C,W[0],W[1],W[2],W[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Qa.VectorTile(new zh(this.rawTileData)).layers,this.sourceLayerCoder=new Sp(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(e,s,h,_){this.loadVTLayers();const v=e.params||{},E=Si/e.tileSize/e.scale,C=uo(v.filter),M=e.queryGeometry,F=e.queryPadding*E,j=Ap(M),W=this.grid.query(j.minX-F,j.minY-F,j.maxX+F,j.maxY+F),X=Ap(e.cameraQueryGeometry),ne=this.grid3D.query(X.minX-F,X.minY-F,X.maxX+F,X.maxY+F,(we,Oe,Qe,Le)=>function(Ke,ft,ht,qt,Zt){for(const Rt of Ke)if(ft<=Rt.x&&ht<=Rt.y&&qt>=Rt.x&&Zt>=Rt.y)return!0;const Nt=[new ct(ft,ht),new ct(ft,Zt),new ct(qt,Zt),new ct(qt,ht)];if(Ke.length>2){for(const Rt of Nt)if(vo(Ke,Rt))return!0}for(let Rt=0;Rt(Le||(Le=Ls(Ke)),ft.queryIntersectsFeature(M,Ke,ht,Le,this.z,e.transform,E,e.pixelPosMatrix)))}return se}loadMatchingFeature(e,s,h,_,v,E,C,M,F,j,W){const X=this.bucketLayerIDs[s];if(E&&!function(we,Oe){for(let Qe=0;Qe=0)return!0;return!1}(E,X))return;const ne=this.sourceLayerCoder.decode(h),se=this.vtLayers[ne].feature(_);if(v.needGeometry){const we=Bs(se,!0);if(!v.filter(new si(this.tileID.overscaledZ),we,this.tileID.canonical))return}else if(!v.filter(new si(this.tileID.overscaledZ),se))return;const ke=this.getId(se,ne);for(let we=0;we{const C=e instanceof Ds?e.get(E):null;return C&&C.evaluate?C.evaluate(s,h,_):C})}function Ap(i){let e=1/0,s=1/0,h=-1/0,_=-1/0;for(const v of i)e=Math.min(e,v.x),s=Math.min(s,v.y),h=Math.max(h,v.x),_=Math.max(_,v.y);return{minX:e,minY:s,maxX:h,maxY:_}}function Q0(i,e){return e-i}var Gh;Gt("FeatureIndex",Ip,{omit:["rawTileData","sourceLayerCoder"]}),n.PerformanceMarkers=void 0,(Gh=n.PerformanceMarkers||(n.PerformanceMarkers={})).create="create",Gh.load="load",Gh.fullLoad="fullLoad";let du=null,Bl=[];const Zh=1e3/30,e1={mark(i){performance.mark(i)},frame(i){const e=i;du!=null&&Bl.push(e-du),du=e},clearMetrics(){du=null,Bl=[],performance.clearMeasures("loadTime"),performance.clearMeasures("fullLoadTime");for(const i in n.PerformanceMarkers)performance.clearMarks(n.PerformanceMarkers[i])},getPerformanceMetrics(){performance.measure("loadTime",n.PerformanceMarkers.create,n.PerformanceMarkers.load),performance.measure("fullLoadTime",n.PerformanceMarkers.create,n.PerformanceMarkers.fullLoad);const i=performance.getEntriesByName("loadTime")[0].duration,e=performance.getEntriesByName("fullLoadTime")[0].duration,s=Bl.length,h=1/(Bl.reduce((v,E)=>v+E,0)/s/1e3),_=Bl.filter(v=>v>Zh).reduce((v,E)=>v+(E-Zh)/Zh,0);return{loadTime:i,fullLoadTime:e,fps:h,percentDroppedFrames:_/(s+_)*100}}};n.AJAXError=Vr,n.ARRAY_TYPE=en,n.Actor=class{constructor(i,e,s){this.target=i,this.parent=e,this.mapId=s,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},L(["receive","process"],this),this.invoker=new Y0(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=ce()?i:window}send(i,e,s,h,_=!1){const v=Math.round(1e18*Math.random()).toString(36).substring(0,10);s&&(this.callbacks[v]=s);const E=We(this.globalScope)?void 0:[];return this.target.postMessage({id:v,type:i,hasCallback:!!s,targetMapId:h,mustQueue:_,sourceMapId:this.mapId,data:Sa(e,E)},E),{cancel:()=>{s&&delete this.callbacks[v],this.target.postMessage({id:v,type:"",targetMapId:h,sourceMapId:this.mapId})}}}receive(i){const e=i.data,s=e.id;if(s&&(!e.targetMapId||this.mapId===e.targetMapId))if(e.type===""){delete this.tasks[s];const h=this.cancelCallbacks[s];delete this.cancelCallbacks[s],h&&h()}else ce()||e.mustQueue?(this.tasks[s]=e,this.taskQueue.push(s),this.invoker.trigger()):this.processTask(s,e)}process(){if(!this.taskQueue.length)return;const i=this.taskQueue.shift(),e=this.tasks[i];delete this.tasks[i],this.taskQueue.length&&this.invoker.trigger(),e&&this.processTask(i,e)}processTask(i,e){if(e.type===""){const s=this.callbacks[i];delete this.callbacks[i],s&&(e.error?s(ua(e.error)):s(null,ua(e.data)))}else{let s=!1;const h=We(this.globalScope)?void 0:[],_=e.hasCallback?(C,M)=>{s=!0,delete this.cancelCallbacks[i],this.target.postMessage({id:i,type:"",sourceMapId:this.mapId,error:C?Sa(C):null,data:Sa(M,h)},h)}:C=>{s=!0};let v=null;const E=ua(e.data);if(this.parent[e.type])v=this.parent[e.type](e.sourceMapId,E,_);else if(this.parent.getWorkerSource){const C=e.type.split(".");v=this.parent.getWorkerSource(e.sourceMapId,C[0],E.source)[C[1]](E,_)}else _(new Error(`Could not find function ${e.type}`));!s&&v&&v.cancel&&(this.cancelCallbacks[i]=v.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},n.AlphaImage=Tl,n.CanonicalTileID=qh,n.CollisionBoxArray=st,n.CollisionCircleLayoutArray=class extends G{},n.Color=Q,n.DEMData=kp,n.DataConstantProperty=Kt,n.DictionaryCoder=Sp,n.EXTENT=Si,n.ErrorEvent=Wt,n.EvaluationParameters=si,n.Event=St,n.Evented=wr,n.FeatureIndex=Ip,n.FillBucket=Ih,n.FillExtrusionBucket=Ah,n.GeoJSONFeature=Tp,n.ImageAtlas=Jd,n.ImagePosition=Dh,n.LineBucket=Ph,n.LineStripIndexArray=class extends xe{},n.LngLat=pi,n.LngLatBounds=Fs,n.MercatorCoordinate=fu,n.ONE_EM=Ni,n.OverscaledTileID=Tn,n.PerformanceUtils=e1,n.PosArray=tr,n.Properties=Fi,n.QuadTriangleArray=class extends ie{},n.RGBAImage=Sn,n.RasterBoundsArray=class extends g{},n.RequestPerformance=class{constructor(i){this._marks={start:[i.url,"start"].join("#"),end:[i.url,"end"].join("#"),measure:i.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let i=performance.getEntriesByName(this._marks.measure);return i.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),i=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),i}},n.ResourceType=Rr,n.SegmentVector=Er,n.SymbolBucket=To,n.Transitionable=$c,n.TriangleIndexArray=Yi,n.Uniform1f=Aa,n.Uniform1i=class extends Ca{constructor(i,e){super(i,e),this.current=0}set(i){this.current!==i&&(this.current=i,this.gl.uniform1i(this.location,i))}},n.Uniform2f=class extends Ca{constructor(i,e){super(i,e),this.current=[0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]||(this.current=i,this.gl.uniform2f(this.location,i[0],i[1]))}},n.Uniform3f=class extends Ca{constructor(i,e){super(i,e),this.current=[0,0,0]}set(i){i[0]===this.current[0]&&i[1]===this.current[1]&&i[2]===this.current[2]||(this.current=i,this.gl.uniform3f(this.location,i[0],i[1],i[2]))}},n.Uniform4f=_o,n.UniformColor=dd,n.UniformMatrix4f=class extends Ca{constructor(i,e){super(i,e),this.current=xy}set(i){if(i[12]!==this.current[12]||i[0]!==this.current[0])return this.current=i,void this.gl.uniformMatrix4fv(this.location,!1,i);for(let e=1;e<16;e++)if(i[e]!==this.current[e]){this.current=i,this.gl.uniformMatrix4fv(this.location,!1,i);break}}},n.UnwrappedTileID=Ep,n.ValidationError=gt,n.ZoomHistory=hl,n.add=function(i,e,s){return i[0]=e[0]+s[0],i[1]=e[1]+s[1],i[2]=e[2]+s[2],i},n.addDynamicAttributes=Fh,n.asyncAll=function(i,e,s){if(!i.length)return s(null,[]);let h=i.length;const _=new Array(i.length);let v=null;i.forEach((E,C)=>{e(E,(M,F)=>{M&&(v=M),_[C]=F,--h==0&&s(v,_)})})},n.bezier=w,n.bindAll=L,n.cacheEntryPossiblyAdded=function(i){ue++,ue>Me&&(i.getActor().send("enforceCacheSizeLimit",ge),ue=0)},n.clamp=k,n.clearTileCache=function(i){const e=caches.delete(it);i&&e.catch(i).then(()=>i())},n.clipLine=cp,n.clone=function(i){var e=new en(16);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e},n.clone$1=$,n.clone$2=function(i){var e=new en(3);return e[0]=i[0],e[1]=i[1],e[2]=i[2],e},n.collisionCircleLayout=y0,n.config=$t,n.copy=function(i,e){return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15],i},n.create=function(){var i=new en(16);return en!=Float32Array&&(i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0),i[0]=1,i[5]=1,i[10]=1,i[15]=1,i},n.create$1=xd,n.createExpression=vs,n.createFilter=uo,n.createLayout=bi,n.createStyleLayer=function(i){return i.type==="custom"?new X0(i):new J0[i.type](i)},n.cross=function(i,e,s){var h=e[0],_=e[1],v=e[2],E=s[0],C=s[1],M=s[2];return i[0]=_*M-v*C,i[1]=v*E-h*M,i[2]=h*C-_*E,i},n.dot=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]},n.dot$1=function(i,e){return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]*e[3]},n.ease=S,n.emitValidationErrors=fo,n.enforceCacheSizeLimit=function(i){ee(),et&&et.then(e=>{e.keys().then(s=>{for(let h=0;h{}}},n.identity=yh,n.invert=function(i,e){var s=e[0],h=e[1],_=e[2],v=e[3],E=e[4],C=e[5],M=e[6],F=e[7],j=e[8],W=e[9],X=e[10],ne=e[11],se=e[12],ke=e[13],we=e[14],Oe=e[15],Qe=s*C-h*E,Le=s*M-_*E,Ke=s*F-v*E,ft=h*M-_*C,ht=h*F-v*C,qt=_*F-v*M,Zt=j*ke-W*se,Nt=j*we-X*se,Rt=j*Oe-ne*se,At=W*we-X*ke,Ut=W*Oe-ne*ke,Lt=X*Oe-ne*we,xt=Qe*Lt-Le*Ut+Ke*At+ft*Rt-ht*Nt+qt*Zt;return xt?(i[0]=(C*Lt-M*Ut+F*At)*(xt=1/xt),i[1]=(_*Ut-h*Lt-v*At)*xt,i[2]=(ke*qt-we*ht+Oe*ft)*xt,i[3]=(X*ht-W*qt-ne*ft)*xt,i[4]=(M*Rt-E*Lt-F*Nt)*xt,i[5]=(s*Lt-_*Rt+v*Nt)*xt,i[6]=(we*Ke-se*qt-Oe*Le)*xt,i[7]=(j*qt-X*Ke+ne*Le)*xt,i[8]=(E*Ut-C*Rt+F*Zt)*xt,i[9]=(h*Rt-s*Ut-v*Zt)*xt,i[10]=(se*ht-ke*Ke+Oe*Qe)*xt,i[11]=(W*Ke-j*ht-ne*Qe)*xt,i[12]=(C*Nt-E*At-M*Zt)*xt,i[13]=(s*At-h*Nt+_*Zt)*xt,i[14]=(ke*Le-se*ft-we*Qe)*xt,i[15]=(j*ft-W*Le+X*Qe)*xt,i):null},n.isImageBitmap=Z,n.isSafari=We,n.isWorker=ce,n.keysDifference=function(i,e){const s=[];for(const h in i)h in e||s.push(h);return s},n.lazyLoadRTLTextPlugin=function(){_n.isLoading()||_n.isLoaded()||zs()!=="deferred"||Vc()},n.makeRequest=tt,n.mapObject=D,n.mercatorXfromLng=vp,n.mercatorYfromLat=bp,n.mercatorZfromAltitude=xp,n.mul=Ay,n.mul$1=function(i,e,s){return i[0]=e[0]*s[0],i[1]=e[1]*s[1],i[2]=e[2]*s[2],i[3]=e[3]*s[3],i},n.multiply=wd,n.nextPowerOfTwo=function(i){return i<=1?1:Math.pow(2,Math.ceil(Math.log(i)/Math.LN2))},n.normalize=function(i,e){var s=e[0],h=e[1],_=e[2],v=s*s+h*h+_*_;return v>0&&(v=1/Math.sqrt(v)),i[0]=e[0]*v,i[1]=e[1]*v,i[2]=e[2]*v,i},n.number=ni,n.ortho=function(i,e,s,h,_,v,E){var C=1/(e-s),M=1/(h-_),F=1/(v-E);return i[0]=-2*C,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=-2*M,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=2*F,i[11]=0,i[12]=(e+s)*C,i[13]=(_+h)*M,i[14]=(E+v)*F,i[15]=1,i},n.parseCacheControl=ye,n.parseGlyphPbf=function(i){return new zh(i).readFields(A0,[])},n.pbf=zh,n.performSymbolLayout=function(i){i.bucket.createArrays(),i.bucket.tilePixelRatio=Si/(512*i.bucket.overscaling),i.bucket.compareText={},i.bucket.iconsNeedLinear=!1;const e=i.bucket.layers[0].layout,s=i.bucket.layers[0]._unevaluatedLayout._values,h={layoutIconSize:s["icon-size"].possiblyEvaluate(new si(i.bucket.zoom+1),i.canonical),layoutTextSize:s["text-size"].possiblyEvaluate(new si(i.bucket.zoom+1),i.canonical),textMaxSize:s["text-size"].possiblyEvaluate(new si(18))};if(i.bucket.textSizeData.kind==="composite"){const{minZoom:M,maxZoom:F}=i.bucket.textSizeData;h.compositeTextSizes=[s["text-size"].possiblyEvaluate(new si(M),i.canonical),s["text-size"].possiblyEvaluate(new si(F),i.canonical)]}if(i.bucket.iconSizeData.kind==="composite"){const{minZoom:M,maxZoom:F}=i.bucket.iconSizeData;h.compositeIconSizes=[s["icon-size"].possiblyEvaluate(new si(M),i.canonical),s["icon-size"].possiblyEvaluate(new si(F),i.canonical)]}const _=e.get("text-line-height")*Ni,v=e.get("text-rotation-alignment")!=="viewport"&&e.get("symbol-placement")!=="point",E=e.get("text-keep-upright"),C=e.get("text-size");for(const M of i.bucket.features){const F=e.get("text-font").evaluate(M,{},i.canonical).join(","),j=C.evaluate(M,{},i.canonical),W=h.layoutTextSize.evaluate(M,{},i.canonical),X=h.layoutIconSize.evaluate(M,{},i.canonical),ne={horizontal:{},vertical:void 0},se=M.text;let ke,we=[0,0];if(se){const Le=se.toString(),Ke=e.get("text-letter-spacing").evaluate(M,{},i.canonical)*Ni,ft=uh(Le)?Ke:0,ht=e.get("text-anchor").evaluate(M,{},i.canonical),qt=e.get("text-variable-anchor");if(!qt){const Ut=e.get("text-radial-offset").evaluate(M,{},i.canonical);we=Ut?fp(ht,[Ut*Ni,Bh]):e.get("text-offset").evaluate(M,{},i.canonical).map(Lt=>Lt*Ni)}let Zt=v?"center":e.get("text-justify").evaluate(M,{},i.canonical);const Nt=e.get("symbol-placement"),Rt=Nt==="point"?e.get("text-max-width").evaluate(M,{},i.canonical)*Ni:0,At=()=>{i.bucket.allowVerticalPlacement&&po(Le)&&(ne.vertical=nu(se,i.glyphMap,i.glyphPositions,i.imagePositions,F,Rt,_,ht,"left",ft,we,n.WritingMode.vertical,!0,Nt,W,j))};if(!v&&qt){const Ut=Zt==="auto"?qt.map(xt=>Oh(xt)):[Zt];let Lt=!1;for(let xt=0;xtthis._layers[ot.id]),Se=he[0];if(Se.visibility==="none")continue;const Ee=Se.source||"";let ve=this.familiesBySource[Ee];ve||(ve=this.familiesBySource[Ee]={});const Te=Se.sourceLayer||"_geojsonTileLayer";let Ge=ve[Te];Ge||(Ge=ve[Te]=[]),Ge.push(he)}}}class S{constructor(z){const U={},q=[];for(const Ee in z){const ve=z[Ee],Te=U[Ee]={};for(const Ge in ve){const ot=ve[+Ge];if(!ot||ot.bitmap.width===0||ot.bitmap.height===0)continue;const Re={x:0,y:0,w:ot.bitmap.width+2,h:ot.bitmap.height+2};q.push(Re),Te[Ge]={rect:Re,metrics:ot.metrics}}}const{w:Q,h:he}=n.potpack(q),Se=new n.AlphaImage({width:Q||1,height:he||1});for(const Ee in z){const ve=z[Ee];for(const Te in ve){const Ge=ve[+Te];if(!Ge||Ge.bitmap.width===0||Ge.bitmap.height===0)continue;const ot=U[Ee][Te].rect;n.AlphaImage.copy(Ge.bitmap,Se,{x:0,y:0},{x:ot.x+1,y:ot.y+1},Ge.bitmap)}}this.image=Se,this.positions=U}}n.register("GlyphAtlas",S);class k{constructor(z){this.tileID=new n.OverscaledTileID(z.tileID.overscaledZ,z.tileID.wrap,z.tileID.canonical.z,z.tileID.canonical.x,z.tileID.canonical.y),this.uid=z.uid,this.zoom=z.zoom,this.pixelRatio=z.pixelRatio,this.tileSize=z.tileSize,this.source=z.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=z.showCollisionBoxes,this.collectResourceTiming=!!z.collectResourceTiming,this.returnDependencies=!!z.returnDependencies,this.promoteId=z.promoteId}parse(z,U,q,Q,he){this.status="parsing",this.data=z,this.collisionBoxArray=new n.CollisionBoxArray;const Se=new n.DictionaryCoder(Object.keys(z.layers).sort()),Ee=new n.FeatureIndex(this.tileID,this.promoteId);Ee.bucketLayerIDs=[];const ve={},Te={featureIndex:Ee,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:q},Ge=U.familiesBySource[this.source];for(const or in Ge){const fr=z.layers[or];if(!fr)continue;fr.version===1&&n.warnOnce(`Vector tile source "${this.source}" layer "${or}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const dr=Se.encode(or),Tr=[];for(let Qr=0;Qr=Dr.maxzoom||Dr.visibility!=="none"&&(A(Qr,this.zoom,q),(ve[Dr.id]=Dr.createBucket({index:Ee.bucketLayerIDs.length,layers:Qr,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:dr,sourceID:this.source})).populate(Tr,Te,this.tileID.canonical),Ee.bucketLayerIDs.push(Qr.map(fi=>fi.id)))}}let ot,Re,Ct,Pt;const bt=n.mapObject(Te.glyphDependencies,or=>Object.keys(or).map(Number));Object.keys(bt).length?Q.send("getGlyphs",{uid:this.uid,stacks:bt},(or,fr)=>{ot||(ot=or,Re=fr,mr.call(this))}):Re={};const Xt=Object.keys(Te.iconDependencies);Xt.length?Q.send("getImages",{icons:Xt,source:this.source,tileID:this.tileID,type:"icons"},(or,fr)=>{ot||(ot=or,Ct=fr,mr.call(this))}):Ct={};const Yt=Object.keys(Te.patternDependencies);function mr(){if(ot)return he(ot);if(Re&&Ct&&Pt){const or=new S(Re),fr=new n.ImageAtlas(Ct,Pt);for(const dr in ve){const Tr=ve[dr];Tr instanceof n.SymbolBucket?(A(Tr.layers,this.zoom,q),n.performSymbolLayout({bucket:Tr,glyphMap:Re,glyphPositions:or.positions,imageMap:Ct,imagePositions:fr.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):Tr.hasPattern&&(Tr instanceof n.LineBucket||Tr instanceof n.FillBucket||Tr instanceof n.FillExtrusionBucket)&&(A(Tr.layers,this.zoom,q),Tr.addFeatures(Te,this.tileID.canonical,fr.patternPositions))}this.status="done",he(null,{buckets:Object.values(ve).filter(dr=>!dr.isEmpty()),featureIndex:Ee,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:or.image,imageAtlas:fr,glyphMap:this.returnDependencies?Re:null,iconMap:this.returnDependencies?Ct:null,glyphPositions:this.returnDependencies?or.positions:null})}}Yt.length?Q.send("getImages",{icons:Yt,source:this.source,tileID:this.tileID,type:"patterns"},(or,fr)=>{ot||(ot=or,Pt=fr,mr.call(this))}):Pt={},mr.call(this)}}function A(N,z,U){const q=new n.EvaluationParameters(z);for(const Q of N)Q.recalculate(q,U)}function P(N,z){const U=n.getArrayBuffer(N.request,(q,Q,he,Se)=>{q?z(q):Q&&z(null,{vectorTile:new n.vectorTile.VectorTile(new n.pbf(Q)),rawData:Q,cacheControl:he,expires:Se})});return()=>{U.cancel(),z()}}class T{constructor(z,U,q,Q){this.actor=z,this.layerIndex=U,this.availableImages=q,this.loadVectorData=Q||P,this.loading={},this.loaded={}}loadTile(z,U){const q=z.uid;this.loading||(this.loading={});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new n.RequestPerformance(z.request),he=this.loading[q]=new k(z);he.abort=this.loadVectorData(z,(Se,Ee)=>{if(delete this.loading[q],Se||!Ee)return he.status="done",this.loaded[q]=he,U(Se);const ve=Ee.rawData,Te={};Ee.expires&&(Te.expires=Ee.expires),Ee.cacheControl&&(Te.cacheControl=Ee.cacheControl);const Ge={};if(Q){const ot=Q.finish();ot&&(Ge.resourceTiming=JSON.parse(JSON.stringify(ot)))}he.vectorTile=Ee.vectorTile,he.parse(Ee.vectorTile,this.layerIndex,this.availableImages,this.actor,(ot,Re)=>{if(ot||!Re)return U(ot);U(null,n.extend({rawTileData:ve.slice(0)},Re,Te,Ge))}),this.loaded=this.loaded||{},this.loaded[q]=he})}reloadTile(z,U){const q=this.loaded,Q=z.uid,he=this;if(q&&q[Q]){const Se=q[Q];Se.showCollisionBoxes=z.showCollisionBoxes;const Ee=(ve,Te)=>{const Ge=Se.reloadCallback;Ge&&(delete Se.reloadCallback,Se.parse(Se.vectorTile,he.layerIndex,this.availableImages,he.actor,Ge)),U(ve,Te)};Se.status==="parsing"?Se.reloadCallback=Ee:Se.status==="done"&&(Se.vectorTile?Se.parse(Se.vectorTile,this.layerIndex,this.availableImages,this.actor,Ee):Ee())}}abortTile(z,U){const q=this.loading,Q=z.uid;q&&q[Q]&&q[Q].abort&&(q[Q].abort(),delete q[Q]),U()}removeTile(z,U){const q=this.loaded,Q=z.uid;q&&q[Q]&&delete q[Q],U()}}class L{constructor(){this.loaded={}}loadTile(z,U){const{uid:q,encoding:Q,rawImageData:he}=z,Se=n.isImageBitmap(he)?this.getImageData(he):he,Ee=new n.DEMData(q,Se,Q);this.loaded=this.loaded||{},this.loaded[q]=Ee,U(null,Ee)}getImageData(z){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(z.width,z.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d")),this.offscreenCanvas.width=z.width,this.offscreenCanvas.height=z.height,this.offscreenCanvasContext.drawImage(z,0,0,z.width,z.height);const U=this.offscreenCanvasContext.getImageData(-1,-1,z.width+2,z.height+2);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),new n.RGBAImage({width:U.width,height:U.height},U.data)}removeTile(z){const U=this.loaded,q=z.uid;U&&U[q]&&delete U[q]}}var D=function N(z,U){var q,Q=z&&z.type;if(Q==="FeatureCollection")for(q=0;q=Math.abs(Ee)?U-ve+Ee:Ee-ve+U,U=ve}U+q>=0!=!!z&&N.reverse()}const J=n.vectorTile.VectorTileFeature.prototype.toGeoJSON;class Y{constructor(z){this._feature=z,this.extent=n.EXTENT,this.type=z.type,this.properties=z.tags,"id"in z&&!isNaN(z.id)&&(this.id=parseInt(z.id,10))}loadGeometry(){if(this._feature.type===1){const z=[];for(const U of this._feature.geometry)z.push([new n.pointGeometry(U[0],U[1])]);return z}{const z=[];for(const U of this._feature.geometry){const q=[];for(const Q of U)q.push(new n.pointGeometry(Q[0],Q[1]));z.push(q)}return z}}toGeoJSON(z,U,q){return J.call(this,z,U,q)}}class ae{constructor(z){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=n.EXTENT,this.length=z.length,this._features=z}feature(z){return new Y(this._features[z])}}var re={exports:{}},ce=n.pointGeometry,ye=n.vectorTile.VectorTileFeature,Ae=_t;function _t(N,z){this.options=z||{},this.features=N,this.length=N.length}function le(N,z){this.id=typeof N.id=="number"?N.id:void 0,this.type=N.type,this.rawGeometry=N.type===1?[N.geometry]:N.geometry,this.properties=N.tags,this.extent=z||4096}_t.prototype.feature=function(N){return new le(this.features[N],this.options.extent)},le.prototype.loadGeometry=function(){var N=this.rawGeometry;this.geometry=[];for(var z=0;z>31}function oe(N,z){for(var U=N.loadGeometry(),q=N.type,Q=0,he=0,Se=U.length,Ee=0;Ee>1;ee(N,z,Se,q,Q,he%2),Me(N,z,U,q,Se-1,he+1),Me(N,z,U,Se+1,Q,he+1)}function ee(N,z,U,q,Q,he){for(;Q>q;){if(Q-q>600){const Te=Q-q+1,Ge=U-q+1,ot=Math.log(Te),Re=.5*Math.exp(2*ot/3),Ct=.5*Math.sqrt(ot*Re*(Te-Re)/Te)*(Ge-Te/2<0?-1:1);ee(N,z,U,Math.max(q,Math.floor(U-Ge*Re/Te+Ct)),Math.min(Q,Math.floor(U+(Te-Ge)*Re/Te+Ct)),he)}const Se=z[2*U+he];let Ee=q,ve=Q;for(ue(N,z,q,U),z[2*Q+he]>Se&&ue(N,z,q,Q);EeSe;)ve--}z[2*q+he]===Se?ue(N,z,q,ve):(ve++,ue(N,z,ve,Q)),ve<=U&&(q=ve+1),U<=ve&&(Q=ve-1)}}function ue(N,z,U,q){Je(N,U,q),Je(z,2*U,2*q),Je(z,2*U+1,2*q+1)}function Je(N,z,U){const q=N[z];N[z]=N[U],N[U]=q}function wt(N,z,U,q){const Q=N-U,he=z-q;return Q*Q+he*he}re.exports=$e,re.exports.fromVectorTileJs=$e,re.exports.fromGeojsonVt=function(N,z){z=z||{};var U={};for(var q in N)U[q]=new Z(N[q].features,z),U[q].name=q,U[q].version=z.version,U[q].extent=z.extent;return $e({layers:U})},re.exports.GeoJSONWrapper=Z;const pt=N=>N[0],Xe=N=>N[1];class Bt{constructor(z,U=pt,q=Xe,Q=64,he=Float64Array){this.nodeSize=Q,this.points=z;const Se=z.length<65536?Uint16Array:Uint32Array,Ee=this.ids=new Se(z.length),ve=this.coords=new he(2*z.length);for(let Te=0;Te=Ee&&Pt<=Te&&bt>=ve&&bt<=Ge&&Ct.push(he[dr]);continue}const or=Math.floor((mr+Yt)/2);Pt=Se[2*or],bt=Se[2*or+1],Pt>=Ee&&Pt<=Te&&bt>=ve&&bt<=Ge&&Ct.push(he[or]);const fr=(Xt+1)%2;(Xt===0?Ee<=Pt:ve<=bt)&&(Re.push(mr),Re.push(or-1),Re.push(fr)),(Xt===0?Te>=Pt:Ge>=bt)&&(Re.push(or+1),Re.push(Yt),Re.push(fr))}return Ct}(this.ids,this.coords,z,U,q,Q,this.nodeSize)}within(z,U,q){return function(Q,he,Se,Ee,ve,Te){const Ge=[0,Q.length-1,0],ot=[],Re=ve*ve;for(;Ge.length;){const Ct=Ge.pop(),Pt=Ge.pop(),bt=Ge.pop();if(Pt-bt<=Te){for(let fr=bt;fr<=Pt;fr++)wt(he[2*fr],he[2*fr+1],Se,Ee)<=Re&&ot.push(Q[fr]);continue}const Xt=Math.floor((bt+Pt)/2),Yt=he[2*Xt],mr=he[2*Xt+1];wt(Yt,mr,Se,Ee)<=Re&&ot.push(Q[Xt]);const or=(Ct+1)%2;(Ct===0?Se-ve<=Yt:Ee-ve<=mr)&&(Ge.push(bt),Ge.push(Xt-1),Ge.push(or)),(Ct===0?Se+ve>=Yt:Ee+ve>=mr)&&(Ge.push(Xt+1),Ge.push(Pt),Ge.push(or))}return ot}(this.ids,this.coords,z,U,q,this.nodeSize)}}const Qt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:N=>N},Rr=Math.fround||(Vr=new Float32Array(1),N=>(Vr[0]=+N,Vr[0]));var Vr;class H{constructor(z){this.options=je(Object.create(Qt),z),this.trees=new Array(this.options.maxZoom+1)}load(z){const{log:U,minZoom:q,maxZoom:Q,nodeSize:he}=this.options;U&&console.time("total time");const Se=`prepare ${z.length} points`;U&&console.time(Se),this.points=z;let Ee=[];for(let ve=0;ve=q;ve--){const Te=+Date.now();Ee=this._cluster(Ee,ve),this.trees[ve]=new Bt(Ee,vt,Ot,he,Float32Array),U&&console.log("z%d: %d clusters in %dms",ve,Ee.length,+Date.now()-Te)}return U&&console.timeEnd("total time"),this}getClusters(z,U){let q=((z[0]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,z[1]));let he=z[2]===180?180:((z[2]+180)%360+360)%360-180;const Se=Math.max(-90,Math.min(90,z[3]));if(z[2]-z[0]>=360)q=-180,he=180;else if(q>he){const Ge=this.getClusters([q,Q,180,Se],U),ot=this.getClusters([-180,Q,he,Se],U);return Ge.concat(ot)}const Ee=this.trees[this._limitZoom(U)],ve=Ee.range(Ie(q),dt(Se),Ie(he),dt(Q)),Te=[];for(const Ge of ve){const ot=Ee.points[Ge];Te.push(ot.numPoints?be(ot):this.points[ot.index])}return Te}getChildren(z){const U=this._getOriginId(z),q=this._getOriginZoom(z),Q="No cluster with the specified id.",he=this.trees[q];if(!he)throw new Error(Q);const Se=he.points[U];if(!Se)throw new Error(Q);const Ee=this.options.radius/(this.options.extent*Math.pow(2,q-1)),ve=he.within(Se.x,Se.y,Ee),Te=[];for(const Ge of ve){const ot=he.points[Ge];ot.parentId===z&&Te.push(ot.numPoints?be(ot):this.points[ot.index])}if(Te.length===0)throw new Error(Q);return Te}getLeaves(z,U,q){const Q=[];return this._appendLeaves(Q,z,U=U||10,q=q||0,0),Q}getTile(z,U,q){const Q=this.trees[this._limitZoom(z)],he=Math.pow(2,z),{extent:Se,radius:Ee}=this.options,ve=Ee/Se,Te=(q-ve)/he,Ge=(q+1+ve)/he,ot={features:[]};return this._addTileFeatures(Q.range((U-ve)/he,Te,(U+1+ve)/he,Ge),Q.points,U,q,he,ot),U===0&&this._addTileFeatures(Q.range(1-ve/he,Te,1,Ge),Q.points,he,q,he,ot),U===he-1&&this._addTileFeatures(Q.range(0,Te,ve/he,Ge),Q.points,-1,q,he,ot),ot.features.length?ot:null}getClusterExpansionZoom(z){let U=this._getOriginZoom(z)-1;for(;U<=this.options.maxZoom;){const q=this.getChildren(z);if(U++,q.length!==1)break;z=q[0].properties.cluster_id}return U}_appendLeaves(z,U,q,Q,he){const Se=this.getChildren(U);for(const Ee of Se){const ve=Ee.properties;if(ve&&ve.cluster?he+ve.point_count<=Q?he+=ve.point_count:he=this._appendLeaves(z,ve.cluster_id,q,Q,he):heU&&(Pt+=Xt.numPoints||1)}if(Pt>Ct&&Pt>=Ee){let bt=Ge.x*Ct,Xt=Ge.y*Ct,Yt=Se&&Ct>1?this._map(Ge,!0):null;const mr=(Te<<5)+(U+1)+this.points.length;for(const or of Re){const fr=ot.points[or];if(fr.zoom<=U)continue;fr.zoom=U;const dr=fr.numPoints||1;bt+=fr.x*dr,Xt+=fr.y*dr,fr.parentId=mr,Se&&(Yt||(Yt=this._map(Ge,!0)),Se(Yt,this._map(fr)))}Ge.parentId=mr,q.push(ut(bt/Pt,Xt/Pt,mr,Pt,Yt))}else if(q.push(Ge),Pt>1)for(const bt of Re){const Xt=ot.points[bt];Xt.zoom<=U||(Xt.zoom=U,q.push(Xt))}}return q}_getOriginId(z){return z-this.points.length>>5}_getOriginZoom(z){return(z-this.points.length)%32}_map(z,U){if(z.numPoints)return U?je({},z.properties):z.properties;const q=this.points[z.index].properties,Q=this.options.map(q);return U&&Q===q?je({},Q):Q}}function ut(N,z,U,q,Q){return{x:Rr(N),y:Rr(z),zoom:1/0,id:U,parentId:-1,numPoints:q,properties:Q}}function tt(N,z){const[U,q]=N.geometry.coordinates;return{x:Rr(Ie(U)),y:Rr(dt(q)),zoom:1/0,index:z,parentId:-1}}function be(N){return{type:"Feature",id:N.id,properties:pe(N),geometry:{type:"Point",coordinates:[(z=N.x,360*(z-.5)),mt(N.y)]}};var z}function pe(N){const z=N.numPoints,U=z>=1e4?`${Math.round(z/1e3)}k`:z>=1e3?Math.round(z/100)/10+"k":z;return je(je({},N.properties),{cluster:!0,cluster_id:N.id,point_count:z,point_count_abbreviated:U})}function Ie(N){return N/360+.5}function dt(N){const z=Math.sin(N*Math.PI/180),U=.5-.25*Math.log((1+z)/(1-z))/Math.PI;return U<0?0:U>1?1:U}function mt(N){const z=(180-360*N)*Math.PI/180;return 360*Math.atan(Math.exp(z))/Math.PI-90}function je(N,z){for(const U in z)N[U]=z[U];return N}function vt(N){return N.x}function Ot(N){return N.y}function St(N,z,U,q){for(var Q,he=q,Se=U-z>>1,Ee=U-z,ve=N[z],Te=N[z+1],Ge=N[U],ot=N[U+1],Re=z+3;Rehe)Q=Re,he=Ct;else if(Ct===he){var Pt=Math.abs(Re-Se);Ptq&&(Q-z>3&&St(N,z,Q,q),N[Q+2]=he,U-Q>3&&St(N,Q,U,q))}function Wt(N,z,U,q,Q,he){var Se=Q-U,Ee=he-q;if(Se!==0||Ee!==0){var ve=((N-U)*Se+(z-q)*Ee)/(Se*Se+Ee*Ee);ve>1?(U=Q,q=he):ve>0&&(U+=Se*ve,q+=Ee*ve)}return(Se=N-U)*Se+(Ee=z-q)*Ee}function wr(N,z,U,q){var Q={id:N===void 0?null:N,type:z,geometry:U,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(he){var Se=he.geometry,Ee=he.type;if(Ee==="Point"||Ee==="MultiPoint"||Ee==="LineString")Fe(he,Se);else if(Ee==="Polygon"||Ee==="MultiLineString")for(var ve=0;ve0&&(Se+=q?(Q*Te-ve*he)/2:Math.sqrt(Math.pow(ve-Q,2)+Math.pow(Te-he,2))),Q=ve,he=Te}var Ge=z.length-3;z[2]=1,St(z,0,Ge,U),z[Ge+2]=1,z.size=Math.abs(Se),z.start=0,z.end=z.size}function yr(N,z,U,q){for(var Q=0;Q1?1:U}function Ei(N,z,U,q,Q,he,Se,Ee){if(q/=z,he>=(U/=z)&&Se=q)return null;for(var ve=[],Te=0;Te=U&&Pt=q)){var bt=[];if(Re==="Point"||Re==="MultiPoint")_i(ot,bt,U,q,Q);else if(Re==="LineString")Tt(ot,bt,U,q,Q,!1,Ee.lineMetrics);else if(Re==="MultiLineString")hr(ot,bt,U,q,Q,!1);else if(Re==="Polygon")hr(ot,bt,U,q,Q,!0);else if(Re==="MultiPolygon")for(var Xt=0;Xt=U&&Se<=q&&(z.push(N[he]),z.push(N[he+1]),z.push(N[he+2]))}}function Tt(N,z,U,q,Q,he,Se){for(var Ee,ve,Te=pr(N),Ge=Q===0?nn:sr,ot=N.start,Re=0;ReU&&(ve=Ge(Te,Ct,Pt,Xt,Yt,U),Se&&(Te.start=ot+Ee*ve)):mr>q?or=U&&(ve=Ge(Te,Ct,Pt,Xt,Yt,U),fr=!0),or>q&&mr<=q&&(ve=Ge(Te,Ct,Pt,Xt,Yt,q),fr=!0),!he&&fr&&(Se&&(Te.end=ot+Ee*ve),z.push(Te),Te=pr(N)),Se&&(ot+=Ee)}var dr=N.length-3;Ct=N[dr],Pt=N[dr+1],bt=N[dr+2],(mr=Q===0?Ct:Pt)>=U&&mr<=q&&yi(Te,Ct,Pt,bt),dr=Te.length-3,he&&dr>=3&&(Te[dr]!==Te[0]||Te[dr+1]!==Te[1])&&yi(Te,Te[0],Te[1],Te[2]),Te.length&&z.push(Te)}function pr(N){var z=[];return z.size=N.size,z.start=N.start,z.end=N.end,z}function hr(N,z,U,q,Q,he){for(var Se=0;SeSe.maxX&&(Se.maxX=Ge),ot>Se.maxY&&(Se.maxY=ot)}return Se}function Lr(N,z,U,q){var Q=z.geometry,he=z.type,Se=[];if(he==="Point"||he==="MultiPoint")for(var Ee=0;Ee0&&z.size<(Q?Se:q))U.numPoints+=z.length/3;else{for(var Ee=[],ve=0;veSe)&&(U.numSimplified++,Ee.push(z[ve]),Ee.push(z[ve+1])),U.numPoints++;Q&&function(Te,Ge){for(var ot=0,Re=0,Ct=Te.length,Pt=Ct-2;Re0===Ge)for(Re=0,Ct=Te.length;Re24)throw new Error("maxZoom should be in the 0-24 range");if(z.promoteId&&z.generateId)throw new Error("promoteId and generateId cannot be used together.");var q=function(Q,he){var Se=[];if(Q.type==="FeatureCollection")for(var Ee=0;Ee1&&console.time("creation"),Re=this.tiles[ot]=Oi(N,z,U,q,ve),this.tileCoords.push({z,x:U,y:q}),Te)){Te>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",z,U,q,Re.numFeatures,Re.numPoints,Re.numSimplified),console.timeEnd("creation"));var Ct="z"+z;this.stats[Ct]=(this.stats[Ct]||0)+1,this.total++}if(Re.source=N,Q){if(z===ve.maxZoom||z===Q)continue;var Pt=1<1&&console.time("clipping");var bt,Xt,Yt,mr,or,fr,dr=.5*ve.buffer/ve.extent,Tr=.5-dr,Qr=.5+dr,Dr=1+dr;bt=Xt=Yt=mr=null,or=Ei(N,Ge,U-dr,U+Qr,0,Re.minX,Re.maxX,ve),fr=Ei(N,Ge,U+Tr,U+Dr,0,Re.minX,Re.maxX,ve),N=null,or&&(bt=Ei(or,Ge,q-dr,q+Qr,1,Re.minY,Re.maxY,ve),Xt=Ei(or,Ge,q+Tr,q+Dr,1,Re.minY,Re.maxY,ve),or=null),fr&&(Yt=Ei(fr,Ge,q-dr,q+Qr,1,Re.minY,Re.maxY,ve),mr=Ei(fr,Ge,q+Tr,q+Dr,1,Re.minY,Re.maxY,ve),fr=null),Te>1&&console.timeEnd("clipping"),Ee.push(bt||[],z+1,2*U,2*q),Ee.push(Xt||[],z+1,2*U,2*q+1),Ee.push(Yt||[],z+1,2*U+1,2*q),Ee.push(mr||[],z+1,2*U+1,2*q+1)}}},gn.prototype.getTile=function(N,z,U){var q=this.options,Q=q.extent,he=q.debug;if(N<0||N>24)return null;var Se=1<1&&console.log("drilling down to z%d-%d-%d",N,z,U);for(var ve,Te=N,Ge=z,ot=U;!ve&&Te>0;)Te--,Ge=Math.floor(Ge/2),ot=Math.floor(ot/2),ve=this.tiles[zn(Te,Ge,ot)];return ve&&ve.source?(he>1&&console.log("found parent tile z%d-%d-%d",Te,Ge,ot),he>1&&console.time("drilling down"),this.splitTile(ve.source,Te,Ge,ot,N,z,U),he>1&&console.timeEnd("drilling down"),this.tiles[Ee]?aa(this.tiles[Ee],Q):null):null};class $n extends T{constructor(z,U,q,Q){super(z,U,q,Vn),Q&&(this.loadGeoJSON=Q)}loadData(z,U){var q;(q=this._pendingRequest)===null||q===void 0||q.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const Q=!!(z&&z.request&&z.request.collectResourceTiming)&&new n.RequestPerformance(z.request);this._pendingCallback=U,this._pendingRequest=this.loadGeoJSON(z,(he,Se)=>{if(delete this._pendingCallback,delete this._pendingRequest,he||!Se)return U(he);if(typeof Se!="object")return U(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`));{D(Se,!0);try{if(z.filter){const ve=n.createExpression(z.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ve.result==="error")throw new Error(ve.value.map(Ge=>`${Ge.key}: ${Ge.message}`).join(", "));Se={type:"FeatureCollection",features:Se.features.filter(Ge=>ve.value.evaluate({zoom:0},Ge))}}this._geoJSONIndex=z.cluster?new H(function({superclusterOptions:ve,clusterProperties:Te}){if(!Te||!ve)return ve;const Ge={},ot={},Re={accumulated:null,zoom:0},Ct={properties:null},Pt=Object.keys(Te);for(const bt of Pt){const[Xt,Yt]=Te[bt],mr=n.createExpression(Yt),or=n.createExpression(typeof Xt=="string"?[Xt,["accumulated"],["get",bt]]:Xt);Ge[bt]=mr.value,ot[bt]=or.value}return ve.map=bt=>{Ct.properties=bt;const Xt={};for(const Yt of Pt)Xt[Yt]=Ge[Yt].evaluate(Re,Ct);return Xt},ve.reduce=(bt,Xt)=>{Ct.properties=Xt;for(const Yt of Pt)Re.accumulated=bt[Yt],bt[Yt]=ot[Yt].evaluate(Re,Ct)},ve}(z)).load(Se.features):function(ve,Te){return new gn(ve,Te)}(Se,z.geojsonVtOptions)}catch(ve){return U(ve)}this.loaded={};const Ee={};if(Q){const ve=Q.finish();ve&&(Ee.resourceTiming={},Ee.resourceTiming[z.source]=JSON.parse(JSON.stringify(ve)))}U(null,Ee)}})}reloadTile(z,U){const q=this.loaded;return q&&q[z.uid]?super.reloadTile(z,U):this.loadTile(z,U)}loadGeoJSON(z,U){if(z.request)return n.getJSON(z.request,U);if(typeof z.data=="string")try{U(null,JSON.parse(z.data))}catch{U(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`))}else U(new Error(`Input data given to '${z.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}}removeSource(z,U){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),U()}getClusterExpansionZoom(z,U){try{U(null,this._geoJSONIndex.getClusterExpansionZoom(z.clusterId))}catch(q){U(q)}}getClusterChildren(z,U){try{U(null,this._geoJSONIndex.getChildren(z.clusterId))}catch(q){U(q)}}getClusterLeaves(z,U){try{U(null,this._geoJSONIndex.getLeaves(z.clusterId,z.limit,z.offset))}catch(q){U(q)}}}class Ce{constructor(z){this.self=z,this.actor=new n.Actor(z,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:T,geojson:$n},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(U,q)=>{if(this.workerSourceTypes[U])throw new Error(`Worker source with name "${U}" already registered.`);this.workerSourceTypes[U]=q},this.self.registerRTLTextPlugin=U=>{if(n.plugin.isParsed())throw new Error("RTL text plugin already registered.");n.plugin.applyArabicShaping=U.applyArabicShaping,n.plugin.processBidirectionalText=U.processBidirectionalText,n.plugin.processStyledBidirectionalText=U.processStyledBidirectionalText}}setReferrer(z,U){this.referrer=U}setImages(z,U,q){this.availableImages[z]=U;for(const Q in this.workerSources[z]){const he=this.workerSources[z][Q];for(const Se in he)he[Se].availableImages=U}q()}setLayers(z,U,q){this.getLayerIndex(z).replace(U),q()}updateLayers(z,U,q){this.getLayerIndex(z).update(U.layers,U.removedIds),q()}loadTile(z,U,q){this.getWorkerSource(z,U.type,U.source).loadTile(U,q)}loadDEMTile(z,U,q){this.getDEMWorkerSource(z,U.source).loadTile(U,q)}reloadTile(z,U,q){this.getWorkerSource(z,U.type,U.source).reloadTile(U,q)}abortTile(z,U,q){this.getWorkerSource(z,U.type,U.source).abortTile(U,q)}removeTile(z,U,q){this.getWorkerSource(z,U.type,U.source).removeTile(U,q)}removeDEMTile(z,U){this.getDEMWorkerSource(z,U.source).removeTile(U)}removeSource(z,U,q){if(!this.workerSources[z]||!this.workerSources[z][U.type]||!this.workerSources[z][U.type][U.source])return;const Q=this.workerSources[z][U.type][U.source];delete this.workerSources[z][U.type][U.source],Q.removeSource!==void 0?Q.removeSource(U,q):q()}loadWorkerSource(z,U,q){try{this.self.importScripts(U.url),q()}catch(Q){q(Q.toString())}}syncRTLPluginState(z,U,q){try{n.plugin.setState(U);const Q=n.plugin.getPluginURL();if(n.plugin.isLoaded()&&!n.plugin.isParsed()&&Q!=null){this.self.importScripts(Q);const he=n.plugin.isParsed();q(he?void 0:new Error(`RTL Text Plugin failed to import scripts from ${Q}`),he)}}catch(Q){q(Q.toString())}}getAvailableImages(z){let U=this.availableImages[z];return U||(U=[]),U}getLayerIndex(z){let U=this.layerIndexes[z];return U||(U=this.layerIndexes[z]=new w),U}getWorkerSource(z,U,q){if(this.workerSources[z]||(this.workerSources[z]={}),this.workerSources[z][U]||(this.workerSources[z][U]={}),!this.workerSources[z][U][q]){const Q={send:(he,Se,Ee)=>{this.actor.send(he,Se,Ee,z)}};this.workerSources[z][U][q]=new this.workerSourceTypes[U](Q,this.getLayerIndex(z),this.getAvailableImages(z))}return this.workerSources[z][U][q]}getDEMWorkerSource(z,U){return this.demWorkerSources[z]||(this.demWorkerSources[z]={}),this.demWorkerSources[z][U]||(this.demWorkerSources[z][U]=new L),this.demWorkerSources[z][U]}enforceCacheSizeLimit(z,U){n.enforceCacheSizeLimit(U)}}return n.isWorker()&&(self.worker=new Ce(self)),Ce}),f(["./shared"],function(n){var m=b;function b(g){return!function(t){return typeof window>"u"||typeof document>"u"?"not a browser":Array.prototype&&Array.prototype.every&&Array.prototype.filter&&Array.prototype.forEach&&Array.prototype.indexOf&&Array.prototype.lastIndexOf&&Array.prototype.map&&Array.prototype.some&&Array.prototype.reduce&&Array.prototype.reduceRight&&Array.isArray?Function.prototype&&Function.prototype.bind?Object.keys&&Object.create&&Object.getPrototypeOf&&Object.getOwnPropertyNames&&Object.isSealed&&Object.isFrozen&&Object.isExtensible&&Object.getOwnPropertyDescriptor&&Object.defineProperty&&Object.defineProperties&&Object.seal&&Object.freeze&&Object.preventExtensions?"JSON"in window&&"parse"in JSON&&"stringify"in JSON?function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var p,y,x=new Blob([""],{type:"text/javascript"}),I=URL.createObjectURL(x);try{y=new Worker(I),p=!0}catch{p=!1}return y&&y.terminate(),URL.revokeObjectURL(I),p}()?"Uint8ClampedArray"in window?ArrayBuffer.isView?function(){var p=document.createElement("canvas");p.width=p.height=1;var y=p.getContext("2d");if(!y)return!1;var x=y.getImageData(0,0,1,1);return x&&x.width===p.width}()?(w[u=t&&t.failIfMajorPerformanceCaveat]===void 0&&(w[u]=function(p){var y,x=function(I){var R=document.createElement("canvas"),O=Object.create(b.webGLContextAttributes);return O.failIfMajorPerformanceCaveat=I,R.getContext("webgl",O)||R.getContext("experimental-webgl",O)}(p);if(!x)return!1;try{y=x.createShader(x.VERTEX_SHADER)}catch{return!1}return!(!y||x.isContextLost())&&(x.shaderSource(y,"void main() {}"),x.compileShader(y),x.getShaderParameter(y,x.COMPILE_STATUS)===!0)}(u)),w[u]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL support"):"insufficient Canvas/getImageData support":"insufficient ArrayBuffer support":"insufficient Uint8ClampedArray support":"insufficient worker support":"insufficient JSON support":"insufficient Object support":"insufficient Function support":"insufficent Array support";var u}(g)}var w={};function S(g,t){if(Array.isArray(g)){if(!Array.isArray(t)||g.length!==t.length)return!1;for(let u=0;u{window.removeEventListener("click",k.suppressClickInternal,!0)},0)}static mousePos(t,u){const p=t.getBoundingClientRect();return new n.pointGeometry(u.clientX-p.left-t.clientLeft,u.clientY-p.top-t.clientTop)}static touchPos(t,u){const p=t.getBoundingClientRect(),y=[];for(let x=0;x-1);O++,x[O]=R,I[O]=V,I[O+1]=B}for(let R=0,O=0;R{let R=this.entries[y];R||(R=this.entries[y]={glyphs:{},requests:{},ranges:{}});let O=R.glyphs[x];if(O!==void 0)return void I(null,{stack:y,id:x,glyph:O});if(O=this._tinySDF(R,y,x),O)return R.glyphs[x]=O,void I(null,{stack:y,id:x,glyph:O});const V=Math.floor(x/256);if(256*V>65535)return void I(new Error("glyphs > 65535 not supported"));if(R.ranges[V])return void I(null,{stack:y,id:x,glyph:O});let G=R.requests[V];G||(G=R.requests[V]=[],Y.loadGlyphRange(y,V,this.url,this.requestManager,(K,ie)=>{if(ie){for(const me in ie)this._doesCharSupportLocalGlyph(+me)||(R.glyphs[+me]=ie[+me]);R.ranges[V]=!0}for(const me of G)me(K,ie);delete R.requests[V]})),G.push((K,ie)=>{K?I(K):ie&&I(null,{stack:y,id:x,glyph:ie[x]||null})})},(y,x)=>{if(y)u(y);else if(x){const I={};for(const{stack:R,id:O,glyph:V}of x)(I[R]||(I[R]={}))[O]=V&&{id:V.id,bitmap:V.bitmap.clone(),metrics:V.metrics};u(null,I)}})}_doesCharSupportLocalGlyph(t){return!!this.localIdeographFontFamily&&(n.unicodeBlockLookup["CJK Unified Ideographs"](t)||n.unicodeBlockLookup["Hangul Syllables"](t)||n.unicodeBlockLookup.Hiragana(t)||n.unicodeBlockLookup.Katakana(t))}_tinySDF(t,u,p){const y=this.localIdeographFontFamily;if(!y||!this._doesCharSupportLocalGlyph(p))return;let x=t.tinySDF;if(!x){let R="400";/bold/i.test(u)?R="900":/medium/i.test(u)?R="500":/light/i.test(u)&&(R="200"),x=t.tinySDF=new Y.TinySDF({fontSize:24,buffer:3,radius:8,cutoff:.25,fontFamily:y,fontWeight:R})}const I=x.draw(String.fromCharCode(p));return{id:p,bitmap:new n.AlphaImage({width:I.width||30,height:I.height||30},I.data),metrics:{width:I.glyphWidth||24,height:I.glyphHeight||24,left:I.glyphLeft||0,top:I.glyphTop-27||-8,advance:I.glyphAdvance||24}}}}Y.loadGlyphRange=function(g,t,u,p,y){const x=256*t,I=x+255,R=p.transformRequest(u.replace("{fontstack}",g).replace("{range}",`${x}-${I}`),n.ResourceType.Glyphs);n.getArrayBuffer(R,(O,V)=>{if(O)y(O);else if(V){const G={};for(const K of n.parseGlyphPbf(V))G[K.id]=K;y(null,G)}})},Y.TinySDF=class{constructor({fontSize:g=24,buffer:t=3,radius:u=8,cutoff:p=.25,fontFamily:y="sans-serif",fontWeight:x="normal",fontStyle:I="normal"}={}){this.buffer=t,this.cutoff=p,this.radius=u;const R=this.size=g+4*t,O=this._createCanvas(R),V=this.ctx=O.getContext("2d",{willReadFrequently:!0});V.font=`${I} ${x} ${g}px ${y}`,V.textBaseline="alphabetic",V.textAlign="left",V.fillStyle="black",this.gridOuter=new Float64Array(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Uint16Array(R)}_createCanvas(g){const t=document.createElement("canvas");return t.width=t.height=g,t}draw(g){const{width:t,actualBoundingBoxAscent:u,actualBoundingBoxDescent:p,actualBoundingBoxLeft:y,actualBoundingBoxRight:x}=this.ctx.measureText(g),I=Math.ceil(u),R=Math.min(this.size-this.buffer,Math.ceil(x-y)),O=Math.min(this.size-this.buffer,I+Math.ceil(p)),V=R+2*this.buffer,G=O+2*this.buffer,K=Math.max(V*G,0),ie=new Uint8ClampedArray(K),me={data:ie,width:V,height:G,glyphWidth:R,glyphHeight:O,glyphTop:I,glyphLeft:0,glyphAdvance:t};if(R===0||O===0)return me;const{ctx:fe,buffer:de,gridInner:ze,gridOuter:De}=this;fe.clearRect(de,de,R,O),fe.fillText(g,de,de+I);const Ve=fe.getImageData(de,de,R,O);De.fill(B,0,K),ze.fill(0,0,K);for(let xe=0;xe0?lt*lt:0,ze[st]=lt<0?lt*lt:0}}$(De,0,0,V,G,V,this.f,this.v,this.z),$(ze,de,de,R,O,V,this.f,this.v,this.z);for(let xe=0;xe1&&(O=t[++R]);const G=Math.abs(V-O.left),K=Math.abs(V-O.right),ie=Math.min(G,K);let me;const fe=x/p*(y+1);if(O.isDash){const de=y-Math.abs(fe);me=Math.sqrt(ie*ie+de*de)}else me=y-Math.sqrt(ie*ie+fe*fe);this.data[I+V]=Math.max(0,Math.min(255,me+128))}}}addRegularDash(t){for(let R=t.length-1;R>=0;--R){const O=t[R],V=t[R+1];O.zeroLength?t.splice(R,1):V&&V.isDash===O.isDash&&(V.left=O.left,t.splice(R,1))}const u=t[0],p=t[t.length-1];u.isDash===p.isDash&&(u.left=p.left-this.width,p.right=u.right+this.width);const y=this.width*this.nextRow;let x=0,I=t[x];for(let R=0;R1&&(I=t[++x]);const O=Math.abs(R-I.left),V=Math.abs(R-I.right),G=Math.min(O,V);this.data[y+R]=Math.max(0,Math.min(255,(I.isDash?G:-G)+128))}}addDash(t,u){const p=u?7:0,y=2*p+1;if(this.nextRow+y>this.height)return n.warnOnce("LineAtlas out of space"),null;let x=0;for(let R=0;R{y.send(t,u,x)},p=p||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(t=>{t.remove()}),this.actors=[],this.workerPool.release(this.id)}}function _t(g,t,u){const p=function(y,x){if(y)return u(y);if(x){const I=n.pick(n.extend(x,g),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);x.vector_layers&&(I.vectorLayers=x.vector_layers,I.vectorLayerIds=I.vectorLayers.map(R=>R.id)),u(null,I)}};return g.url?n.getJSON(t.transformRequest(g.url,n.ResourceType.Source),p):n.exported.frame(()=>p(null,g))}Ae.Actor=n.Actor;class le{constructor(t,u,p){this.bounds=n.LngLatBounds.convert(this.validateBounds(t)),this.minzoom=u||0,this.maxzoom=p||24}validateBounds(t){return Array.isArray(t)&&t.length===4?[Math.max(-180,t[0]),Math.max(-90,t[1]),Math.min(180,t[2]),Math.min(90,t[3])]:[-180,-90,180,90]}contains(t){const u=Math.pow(2,t.z),p=Math.floor(n.mercatorXfromLng(this.bounds.getWest())*u),y=Math.floor(n.mercatorYfromLat(this.bounds.getNorth())*u),x=Math.ceil(n.mercatorXfromLng(this.bounds.getEast())*u),I=Math.ceil(n.mercatorYfromLat(this.bounds.getSouth())*u);return t.x>=p&&t.x=y&&t.y{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),t?this.fire(new n.ErrorEvent(t)):u&&(n.extend(this,u),u.bounds&&(this.tileBounds=new le(u.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}onAdd(t){this.map=t,this.load()}setSourceProperty(t){this._tileJSONRequest&&this._tileJSONRequest.cancel(),t(),this.load()}setTiles(t){return this.setSourceProperty(()=>{this._options.tiles=t}),this}setUrl(t){return this.setSourceProperty(()=>{this.url=t,this._options.url=t}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return n.extend({},this._options)}loadTile(t,u){const p=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),y={request:this.map._requestManager.transformRequest(p,n.ResourceType.Tile),uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,tileSize:this.tileSize*t.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function x(I,R){return delete t.request,t.aborted?u(null):I&&I.status!==404?u(I):(R&&R.resourceTiming&&(t.resourceTiming=R.resourceTiming),this.map._refreshExpiredTiles&&R&&t.setExpiryData(R),t.loadVectorData(R,this.map.painter),n.cacheEntryPossiblyAdded(this.dispatcher),u(null),void(t.reloadCallback&&(this.loadTile(t,t.reloadCallback),t.reloadCallback=null)))}y.request.collectResourceTiming=this._collectResourceTiming,t.actor&&t.state!=="expired"?t.state==="loading"?t.reloadCallback=u:t.request=t.actor.send("reloadTile",y,x.bind(this)):(t.actor=this.dispatcher.getActor(),t.request=t.actor.send("loadTile",y,x.bind(this)))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.actor&&t.actor.send("abortTile",{uid:t.uid,type:this.type,source:this.id},void 0)}unloadTile(t){t.unloadVectorData(),t.actor&&t.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class Z extends n.Evented{constructor(t,u,p,y){super(),this.id=t,this.dispatcher=p,this.setEventedParent(y),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=n.extend({type:"raster"},u),n.extend(this,n.pick(u,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this._tileJSONRequest=_t(this._options,this.map._requestManager,(t,u)=>{this._tileJSONRequest=null,this._loaded=!0,t?this.fire(new n.ErrorEvent(t)):u&&(n.extend(this,u),u.bounds&&(this.tileBounds=new le(u.bounds,this.minzoom,this.maxzoom)),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(t){this.map=t,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}serialize(){return n.extend({},this._options)}hasTile(t){return!this.tileBounds||this.tileBounds.contains(t.canonical)}loadTile(t,u){const p=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);t.request=n.getImage(this.map._requestManager.transformRequest(p,n.ResourceType.Tile),(y,x,I)=>{if(delete t.request,t.aborted)t.state="unloaded",u(null);else if(y)t.state="errored",u(y);else if(x){this.map._refreshExpiredTiles&&t.setExpiryData(I);const R=this.map.painter.context,O=R.gl;t.texture=this.map.painter.getTileTexture(x.width),t.texture?t.texture.update(x,{useMipmap:!0}):(t.texture=new T(R,x,O.RGBA,{useMipmap:!0}),t.texture.bind(O.LINEAR,O.CLAMP_TO_EDGE,O.LINEAR_MIPMAP_NEAREST),R.extTextureFilterAnisotropic&&O.texParameterf(O.TEXTURE_2D,R.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,R.extTextureFilterAnisotropicMax)),t.state="loaded",n.cacheEntryPossiblyAdded(this.dispatcher),u(null)}})}abortTile(t,u){t.request&&(t.request.cancel(),delete t.request),u()}unloadTile(t,u){t.texture&&this.map.painter.saveTileTexture(t.texture),u()}hasTransition(){return!1}}let $e;class ct extends Z{constructor(t,u,p,y){super(t,u,p,y),this.type="raster-dem",this.maxzoom=22,this._options=n.extend({type:"raster-dem"},u),this.encoding=u.encoding||"mapbox"}serialize(){return{type:"raster-dem",url:this.url,tileSize:this.tileSize,tiles:this.tiles,bounds:this.bounds,encoding:this.encoding}}loadTile(t,u){const p=t.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);function y(x,I){x&&(t.state="errored",u(x)),I&&(t.dem=I,t.needsHillshadePrepare=!0,t.needsTerrainPrepare=!0,t.state="loaded",u(null))}t.request=n.getImage(this.map._requestManager.transformRequest(p,n.ResourceType.Tile),(function(x,I){if(delete t.request,t.aborted)t.state="unloaded",u(null);else if(x)t.state="errored",u(x);else if(I){this.map._refreshExpiredTiles&&t.setExpiryData(I),delete I.cacheControl,delete I.expires;const R=n.isImageBitmap(I)&&($e==null&&($e=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),$e)?I:n.exported.getImageData(I,1),O={uid:t.uid,coord:t.tileID,source:this.id,rawImageData:R,encoding:this.encoding};t.actor&&t.state!=="expired"||(t.actor=this.dispatcher.getActor(),t.actor.send("loadDEMTile",O,y.bind(this)))}}).bind(this)),t.neighboringTiles=this._getNeighboringTiles(t.tileID)}_getNeighboringTiles(t){const u=t.canonical,p=Math.pow(2,u.z),y=(u.x-1+p)%p,x=u.x===0?t.wrap-1:t.wrap,I=(u.x+1+p)%p,R=u.x+1===p?t.wrap+1:t.wrap,O={};return O[new n.OverscaledTileID(t.overscaledZ,x,u.z,y,u.y).key]={backfilled:!1},O[new n.OverscaledTileID(t.overscaledZ,R,u.z,I,u.y).key]={backfilled:!1},u.y>0&&(O[new n.OverscaledTileID(t.overscaledZ,x,u.z,y,u.y-1).key]={backfilled:!1},O[new n.OverscaledTileID(t.overscaledZ,t.wrap,u.z,u.x,u.y-1).key]={backfilled:!1},O[new n.OverscaledTileID(t.overscaledZ,R,u.z,I,u.y-1).key]={backfilled:!1}),u.y+1{if(this._pendingLoads--,this._removed||x&&x.abandoned)return void this.fire(new n.Event("dataabort",{dataType:"source",sourceDataType:t}));let I=null;if(x&&x.resourceTiming&&x.resourceTiming[this.id]&&(I=x.resourceTiming[this.id].slice(0)),y)return void this.fire(new n.ErrorEvent(y));const R={dataType:"source",sourceDataType:t};this._collectResourceTiming&&I&&I.length>0&&n.extend(R,{resourceTiming:I}),this.fire(new n.Event("data",R))})}loaded(){return this._pendingLoads===0}loadTile(t,u){const p=t.actor?"reloadTile":"loadTile";t.actor=this.actor;const y={type:this.type,uid:t.uid,tileID:t.tileID,zoom:t.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};t.request=this.actor.send(p,y,(x,I)=>(delete t.request,t.unloadVectorData(),t.aborted?u(null):x?u(x):(t.loadVectorData(I,this.map.painter,p==="reloadTile"),u(null))))}abortTile(t){t.request&&(t.request.cancel(),delete t.request),t.aborted=!0}unloadTile(t){t.unloadVectorData(),this.actor.send("removeTile",{uid:t.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}serialize(){return n.extend({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var $t=n.createLayout([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class it extends n.Evented{constructor(t,u,p,y){super(),this.id=t,this.dispatcher=p,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(y),this.options=u}load(t,u){this._loaded=!1,this.fire(new n.Event("dataloading",{dataType:"source"})),this.url=this.options.url,n.getImage(this.map._requestManager.transformRequest(this.url,n.ResourceType.Image),(p,y)=>{this._loaded=!0,p?this.fire(new n.ErrorEvent(p)):y&&(this.image=y,t&&(this.coordinates=t),u&&u(),this._finishLoading())})}loaded(){return this._loaded}updateImage(t){return this.image&&t.url?(this.options.url=t.url,this.load(t.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(t){this.map=t,this.load()}setCoordinates(t){this.coordinates=t;const u=t.map(n.MercatorCoordinate.fromLngLat);this.tileID=function(y){let x=1/0,I=1/0,R=-1/0,O=-1/0;for(const ie of y)x=Math.min(x,ie.x),I=Math.min(I,ie.y),R=Math.max(R,ie.x),O=Math.max(O,ie.y);const V=Math.max(R-x,O-I),G=Math.max(0,Math.floor(-Math.log(V)/Math.LN2)),K=Math.pow(2,G);return new n.CanonicalTileID(G,Math.floor((x+R)/2*K),Math.floor((I+O)/2*K))}(u),this.minzoom=this.maxzoom=this.tileID.z;const p=u.map(y=>this.tileID.getTilePoint(y)._round());return this._boundsArray=new n.RasterBoundsArray,this._boundsArray.emplaceBack(p[0].x,p[0].y,0,0),this._boundsArray.emplaceBack(p[1].x,p[1].y,n.EXTENT,0),this._boundsArray.emplaceBack(p[3].x,p[3].y,0,n.EXTENT),this._boundsArray.emplaceBack(p[2].x,p[2].y,n.EXTENT,n.EXTENT),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new n.Event("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const t=this.map.painter.context,u=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,$t.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture||(this.texture=new T(t,this.image,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));for(const p in this.tiles){const y=this.tiles[p];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture)}}loadTile(t,u){this.tileID&&this.tileID.equals(t.tileID.canonical)?(this.tiles[String(t.tileID.wrap)]=t,t.buckets={},u(null)):(t.state="errored",u(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class et extends it{constructor(t,u,p,y){super(t,u,p,y),this.roundZoom=!0,this.type="video",this.options=u}load(){this._loaded=!1;const t=this.options;this.urls=[];for(const u of t.urls)this.urls.push(this.map._requestManager.transformRequest(u,n.ResourceType.Source).url);n.getVideo(this.urls,(u,p)=>{this._loaded=!0,u?this.fire(new n.ErrorEvent(u)):p&&(this.video=p,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(t){if(this.video){const u=this.video.seekable;tu.end(0)?this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${this.id}`,null,`Playback for this video can be set only between the ${u.start(0)} and ${u.end(0)}-second mark.`))):this.video.currentTime=t}}getVideo(){return this.video}onAdd(t){this.map||(this.map=t,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const t=this.map.painter.context,u=t.gl;this.boundsBuffer||(this.boundsBuffer=t.createVertexBuffer(this._boundsArray,$t.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE),u.texSubImage2D(u.TEXTURE_2D,0,0,0,u.RGBA,u.UNSIGNED_BYTE,this.video)):(this.texture=new T(t,this.video,u.RGBA),this.texture.bind(u.LINEAR,u.CLAMP_TO_EDGE));for(const p in this.tiles){const y=this.tiles[p];y.state!=="loaded"&&(y.state="loaded",y.texture=this.texture)}}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class oe extends it{constructor(t,u,p,y){super(t,u,p,y),u.coordinates?Array.isArray(u.coordinates)&&u.coordinates.length===4&&!u.coordinates.some(x=>!Array.isArray(x)||x.length!==2||x.some(I=>typeof I!="number"))||this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "coordinates"'))),u.animate&&typeof u.animate!="boolean"&&this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'optional "animate" property must be a boolean value'))),u.canvas?typeof u.canvas=="string"||u.canvas instanceof HTMLCanvasElement||this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new n.ErrorEvent(new n.ValidationError(`sources.${t}`,null,'missing required property "canvas"'))),this.options=u,this.animate=u.animate===void 0||u.animate}load(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new n.ErrorEvent(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())}getCanvas(){return this.canvas}onAdd(t){this.map=t,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let t=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,t=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,t=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const u=this.map.painter.context,p=u.gl;this.boundsBuffer||(this.boundsBuffer=u.createVertexBuffer(this._boundsArray,$t.members)),this.boundsSegments||(this.boundsSegments=n.SegmentVector.simpleSegment(0,0,4,2)),this.texture?(t||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new T(u,this.canvas,p.RGBA,{premultiply:!0});for(const y in this.tiles){const x=this.tiles[y];x.state!=="loaded"&&(x.state="loaded",x.texture=this.texture)}}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const t of[this.canvas.width,this.canvas.height])if(isNaN(t)||t<=0)return!0;return!1}}const ge={vector:We,raster:Z,"raster-dem":ct,geojson:rt,video:et,image:it,canvas:oe};function Me(g,t){const u=n.create();return n.translate(u,u,[1,1,0]),n.scale(u,u,[.5*g.width,.5*g.height,1]),n.multiply(u,u,g.calculatePosMatrix(t.toUnwrapped()))}function ee(g,t,u,p,y,x){const I=function(K,ie,me){if(K)for(const fe of K){const de=ie[fe];if(de&&de.source===me&&de.type==="fill-extrusion")return!0}else for(const fe in ie){const de=ie[fe];if(de.source===me&&de.type==="fill-extrusion")return!0}return!1}(y&&y.layers,t,g.id),R=x.maxPitchScaleFactor(),O=g.tilesIn(p,R,I);O.sort(ue);const V=[];for(const K of O)V.push({wrappedTileID:K.tileID.wrapped().key,queryResults:K.tile.queryRenderedFeatures(t,u,g._state,K.queryGeometry,K.cameraQueryGeometry,K.scale,y,x,R,Me(g.transform,K.tileID))});const G=function(K){const ie={},me={};for(const fe of K){const de=fe.queryResults,ze=fe.wrappedTileID,De=me[ze]=me[ze]||{};for(const Ve in de){const xe=de[Ve],Ye=De[Ve]=De[Ve]||{},Ze=ie[Ve]=ie[Ve]||[];for(const st of xe)Ye[st.featureIndex]||(Ye[st.featureIndex]=!0,Ze.push(st))}}return ie}(V);for(const K in G)G[K].forEach(ie=>{const me=ie.feature,fe=g.getFeatureState(me.layer["source-layer"],me.id);me.source=me.layer.source,me.layer["source-layer"]&&(me.sourceLayer=me.layer["source-layer"]),me.state=fe});return G}function ue(g,t){const u=g.tileID,p=t.tileID;return u.overscaledZ-p.overscaledZ||u.canonical.y-p.canonical.y||u.wrap-p.wrap||u.canonical.x-p.canonical.x}class Je{constructor(t,u){this.tileID=t,this.uid=n.uniqueId(),this.uses=0,this.tileSize=u,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.textures=[],this.textureCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(t){const u=t+this.timeAdded;ut.saveTileTexture(u)),this.demTexture=null,this.textures=[],this.textureCoords={}}loadVectorData(t,u,p){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",t){t.featureIndex&&(this.latestFeatureIndex=t.featureIndex,t.rawTileData?(this.latestRawTileData=t.rawTileData,this.latestFeatureIndex.rawTileData=t.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=t.collisionBoxArray,this.buckets=function(y,x){const I={};if(!x)return I;for(const R of y){const O=R.layerIds.map(V=>x.getLayer(V)).filter(Boolean);if(O.length!==0){R.layers=O,R.stateDependentLayerIds&&(R.stateDependentLayers=R.stateDependentLayerIds.map(V=>O.filter(G=>G.id===V)[0]));for(const V of O)I[V.id]=R}}return I}(t.buckets,u.style),this.hasSymbolBuckets=!1;for(const y in this.buckets){const x=this.buckets[y];if(x instanceof n.SymbolBucket){if(this.hasSymbolBuckets=!0,!p)break;x.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const y in this.buckets){const x=this.buckets[y];if(x instanceof n.SymbolBucket&&x.hasRTLText){this.hasRTLText=!0,n.lazyLoadRTLTextPlugin();break}}this.queryPadding=0;for(const y in this.buckets){const x=this.buckets[y];this.queryPadding=Math.max(this.queryPadding,u.style.getLayer(y).queryRadius(x))}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage)}else this.collisionBoxArray=new n.CollisionBoxArray}unloadVectorData(){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(t){return this.buckets[t.id]}upload(t){for(const p in this.buckets){const y=this.buckets[p];y.uploadPending()&&y.upload(t)}const u=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new T(t,this.imageAtlas.image,u.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new T(t,this.glyphAtlasImage,u.ALPHA),this.glyphAtlasImage=null)}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture)}queryRenderedFeatures(t,u,p,y,x,I,R,O,V,G){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:y,cameraQueryGeometry:x,scale:I,tileSize:this.tileSize,pixelPosMatrix:G,transform:O,params:R,queryPadding:this.queryPadding*V},t,u,p):{}}querySourceFeatures(t,u){const p=this.latestFeatureIndex;if(!p||!p.rawTileData)return;const y=p.loadVTLayers(),x=u?u.sourceLayer:"",I=y._geojsonTileLayer||y[x];if(!I)return;const R=n.createFilter(u&&u.filter),{z:O,x:V,y:G}=this.tileID.canonical,K={z:O,x:V,y:G};for(let ie=0;iep)y=!1;else if(u)if(this.expirationTime{this.remove(t,x)},p)),this.data[y].push(x),this.order.push(y),this.order.length>this.max){const I=this._getAndRemoveByKey(this.order[0]);I&&this.onRemove(I)}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const u=this.data[t].shift();return u.timeout&&clearTimeout(u.timeout),this.data[t].length===0&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),u.value}getByKey(t){const u=this.data[t];return u?u[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,u){if(!this.has(t))return this;const p=t.wrapped().key,y=u===void 0?0:this.data[p].indexOf(u),x=this.data[p][y];return this.data[p].splice(y,1),x.timeout&&clearTimeout(x.timeout),this.data[p].length===0&&delete this.data[p],this.onRemove(x.value),this.order.splice(this.order.indexOf(p),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const u=this._getAndRemoveByKey(this.order[0]);u&&this.onRemove(u)}return this}filter(t){const u=[];for(const p in this.data)for(const y of this.data[p])t(y.value)||u.push(y);for(const p of u)this.remove(p.value.tileID,p)}}class pt{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(t,u,p){const y=String(u);if(this.stateChanges[t]=this.stateChanges[t]||{},this.stateChanges[t][y]=this.stateChanges[t][y]||{},n.extend(this.stateChanges[t][y],p),this.deletedStates[t]===null){this.deletedStates[t]={};for(const x in this.state[t])x!==y&&(this.deletedStates[t][x]=null)}else if(this.deletedStates[t]&&this.deletedStates[t][y]===null){this.deletedStates[t][y]={};for(const x in this.state[t][y])p[x]||(this.deletedStates[t][y][x]=null)}else for(const x in p)this.deletedStates[t]&&this.deletedStates[t][y]&&this.deletedStates[t][y][x]===null&&delete this.deletedStates[t][y][x]}removeFeatureState(t,u,p){if(this.deletedStates[t]===null)return;const y=String(u);if(this.deletedStates[t]=this.deletedStates[t]||{},p&&u!==void 0)this.deletedStates[t][y]!==null&&(this.deletedStates[t][y]=this.deletedStates[t][y]||{},this.deletedStates[t][y][p]=null);else if(u!==void 0)if(this.stateChanges[t]&&this.stateChanges[t][y])for(p in this.deletedStates[t][y]={},this.stateChanges[t][y])this.deletedStates[t][y][p]=null;else this.deletedStates[t][y]=null;else this.deletedStates[t]=null}getState(t,u){const p=String(u),y=n.extend({},(this.state[t]||{})[p],(this.stateChanges[t]||{})[p]);if(this.deletedStates[t]===null)return{};if(this.deletedStates[t]){const x=this.deletedStates[t][u];if(x===null)return{};for(const I in x)delete y[I]}return y}initializeTileState(t,u){t.setFeatureState(this.state,u)}coalesceChanges(t,u){const p={};for(const y in this.stateChanges){this.state[y]=this.state[y]||{};const x={};for(const I in this.stateChanges[y])this.state[y][I]||(this.state[y][I]={}),n.extend(this.state[y][I],this.stateChanges[y][I]),x[I]=this.state[y][I];p[y]=x}for(const y in this.deletedStates){this.state[y]=this.state[y]||{};const x={};if(this.deletedStates[y]===null)for(const I in this.state[y])x[I]={},this.state[y][I]={};else for(const I in this.deletedStates[y]){if(this.deletedStates[y][I]===null)this.state[y][I]={};else for(const R of Object.keys(this.deletedStates[y][I]))delete this.state[y][I][R];x[I]=this.state[y][I]}p[y]=p[y]||{},n.extend(p[y],x)}if(this.stateChanges={},this.deletedStates={},Object.keys(p).length!==0)for(const y in t)t[y].setFeatureState(p,u)}}class Xe extends n.Evented{constructor(t,u,p){super(),this.id=t,this.dispatcher=p,this.on("data",y=>{y.dataType==="source"&&y.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&y.dataType==="source"&&y.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain))}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=function(y,x,I,R){const O=new ge[x.type](y,x,I,R);if(O.id!==y)throw new Error(`Expected Source id to be ${y} instead of ${O.id}`);return n.bindAll(["load","abort","unload","serialize","prepare"],O),O}(t,u,p,this),this._tiles={},this._cache=new wt(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new pt}onAdd(t){this.map=t,this._maxTileCacheSize=t?t._maxTileCacheSize:null,this._source&&this._source.onAdd&&this._source.onAdd(t)}onRemove(t){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(t)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const t in this._tiles){const u=this._tiles[t];if(u.state!=="loaded"&&u.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(t,u){return this._source.loadTile(t,u)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,()=>{})}_abortTile(t){this._source.abortTile&&this._source.abortTile(t,()=>{}),this._source.fire(new n.Event("dataabort",{tile:t,coord:t.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const u in this._tiles){const p=this._tiles[u];p.upload(t),p.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(t=>t.tileID).sort(Bt).map(t=>t.key)}getRenderableIds(t){const u=[];for(const p in this._tiles)this._isIdRenderable(p,t)&&u.push(this._tiles[p]);return t?u.sort((p,y)=>{const x=p.tileID,I=y.tileID,R=new n.pointGeometry(x.canonical.x,x.canonical.y)._rotate(this.transform.angle),O=new n.pointGeometry(I.canonical.x,I.canonical.y)._rotate(this.transform.angle);return x.overscaledZ-I.overscaledZ||O.y-R.y||O.x-R.x}).map(p=>p.tileID.key):u.map(p=>p.tileID).sort(Bt).map(p=>p.key)}hasRenderableParent(t){const u=this.findLoadedParent(t,0);return!!u&&this._isIdRenderable(u.tileID.key)}_isIdRenderable(t,u){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(u||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const t in this._tiles)this._tiles[t].state!=="errored"&&this._reloadTile(t,"reloading")}}_reloadTile(t,u){const p=this._tiles[t];p&&(p.state!=="loading"&&(p.state=u),this._loadTile(p,this._tileLoaded.bind(this,p,t,u)))}_tileLoaded(t,u,p,y){if(y)return t.state="errored",void(y.status!==404?this._source.fire(new n.ErrorEvent(y,{tile:t})):this.update(this.transform,this.terrain));t.timeAdded=n.exported.now(),p==="expired"&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(u,t),this.getSource().type==="raster-dem"&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),t.aborted||this._source.fire(new n.Event("data",{dataType:"source",tile:t,coord:t.tileID}))}_backfillDEM(t){const u=this.getRenderableIds();for(let y=0;y1||(Math.abs(I)>1&&(Math.abs(I+O)===1?I+=O:Math.abs(I-O)===1&&(I-=O)),x.dem&&y.dem&&(y.dem.backfillBorder(x.dem,I,R),y.neighboringTiles&&y.neighboringTiles[V]&&(y.neighboringTiles[V].backfilled=!0)))}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,u,p,y){for(const x in this._tiles){let I=this._tiles[x];if(y[x]||!I.hasData()||I.tileID.overscaledZ<=u||I.tileID.overscaledZ>p)continue;let R=I.tileID;for(;I&&I.tileID.overscaledZ>u+1;){const V=I.tileID.scaledTo(I.tileID.overscaledZ-1);I=this._tiles[V.key],I&&I.hasData()&&(R=V)}let O=R;for(;O.overscaledZ>u;)if(O=O.scaledTo(O.overscaledZ-1),t[O.key]){y[R.key]=R;break}}}findLoadedParent(t,u){if(t.key in this._loadedParentTiles){const p=this._loadedParentTiles[t.key];return p&&p.tileID.overscaledZ>=u?p:null}for(let p=t.overscaledZ-1;p>=u;p--){const y=t.scaledTo(p),x=this._getLoadedTile(y);if(x)return x}}_getLoadedTile(t){const u=this._tiles[t.key];return u&&u.hasData()?u:this._cache.getByKey(t.wrapped().key)}updateCacheSize(t){const u=Math.ceil(t.width/this._source.tileSize)+1,p=Math.ceil(t.height/this._source.tileSize)+1,y=Math.floor(u*p*5),x=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,y):y;this._cache.setMaxSize(x)}handleWrapJump(t){const u=Math.round((t-(this._prevLng===void 0?t:this._prevLng))/360);if(this._prevLng=t,u){const p={};for(const y in this._tiles){const x=this._tiles[y];x.tileID=x.tileID.unwrapTo(x.tileID.wrap+u),p[x.tileID.key]=x}this._tiles=p;for(const y in this._timers)clearTimeout(this._timers[y]),delete this._timers[y];for(const y in this._tiles)this._setTileReloadTimer(y,this._tiles[y])}}update(t,u){if(this.transform=t,this.terrain=u,!this._sourceLoaded||this._paused)return;let p;this.updateCacheSize(t),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?p=t.getVisibleUnwrappedCoordinates(this._source.tileID).map(V=>new n.OverscaledTileID(V.canonical.z,V.wrap,V.canonical.z,V.canonical.x,V.canonical.y)):(p=t.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:u}),this._source.hasTile&&(p=p.filter(V=>this._source.hasTile(V)))):p=[];const y=t.coveringZoomLevel(this._source),x=Math.max(y-Xe.maxOverzooming,this._source.minzoom),I=Math.max(y+Xe.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const V={};for(const G of p)if(G.canonical.z>this._source.minzoom){const K=G.scaledTo(G.canonical.z-1);V[K.key]=K;const ie=G.scaledTo(Math.max(this._source.minzoom,Math.min(G.canonical.z,5)));V[ie.key]=ie}p=p.concat(Object.values(V))}const R=this._updateRetainedTiles(p,y);if(Qt(this._source.type)){const V={},G={},K=Object.keys(R);for(const ie of K){const me=R[ie],fe=this._tiles[ie];if(!fe||fe.fadeEndTime&&fe.fadeEndTime<=n.exported.now())continue;const de=this.findLoadedParent(me,x);de&&(this._addTile(de.tileID),V[de.tileID.key]=de.tileID),G[ie]=me}this._retainLoadedChildren(G,y,I,R);for(const ie in V)R[ie]||(this._coveredTiles[ie]=!0,R[ie]=V[ie]);if(u){const ie={},me={};for(const fe of p)this._tiles[fe.key].hasData()?ie[fe.key]=fe:me[fe.key]=fe;for(const fe in me){const de=me[fe].children(this._source.maxzoom);this._tiles[de[0].key]&&this._tiles[de[1].key]&&this._tiles[de[2].key]&&this._tiles[de[3].key]&&(ie[de[0].key]=R[de[0].key]=de[0],ie[de[1].key]=R[de[1].key]=de[1],ie[de[2].key]=R[de[2].key]=de[2],ie[de[3].key]=R[de[3].key]=de[3],delete me[fe])}for(const fe in me){const de=this.findLoadedParent(me[fe],this._source.minzoom);if(de){ie[de.tileID.key]=R[de.tileID.key]=de.tileID;for(const ze in ie)ie[ze].isChildOf(de.tileID)&&delete ie[ze]}}for(const fe in this._tiles)ie[fe]||(this._coveredTiles[fe]=!0)}}for(const V in R)this._tiles[V].clearFadeHold();const O=n.keysDifference(this._tiles,R);for(const V of O){const G=this._tiles[V];G.hasSymbolBuckets&&!G.holdingForFade()?G.setHoldDuration(this.map._fadeDuration):G.hasSymbolBuckets&&!G.symbolFadeFinished()||this._removeTile(V)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(t)}_updateRetainedTiles(t,u){const p={},y={},x=Math.max(u-Xe.maxOverzooming,this._source.minzoom),I=Math.max(u+Xe.maxUnderzooming,this._source.minzoom),R={};for(const O of t){const V=this._addTile(O);p[O.key]=O,V.hasData()||uthis._source.maxzoom){const K=O.children(this._source.maxzoom)[0],ie=this.getTile(K);if(ie&&ie.hasData()){p[K.key]=K;continue}}else{const K=O.children(this._source.maxzoom);if(p[K[0].key]&&p[K[1].key]&&p[K[2].key]&&p[K[3].key])continue}let G=V.wasRequested();for(let K=O.overscaledZ-1;K>=x;--K){const ie=O.scaledTo(K);if(y[ie.key]||(y[ie.key]=!0,V=this.getTile(ie),!V&&G&&(V=this._addTile(ie)),V&&(p[ie.key]=ie,G=V.wasRequested(),V.hasData())))break}}return p}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const u=[];let p,y=this._tiles[t].tileID;for(;y.overscaledZ>0;){if(y.key in this._loadedParentTiles){p=this._loadedParentTiles[y.key];break}u.push(y.key);const x=y.scaledTo(y.overscaledZ-1);if(p=this._getLoadedTile(x),p)break;y=x}for(const x of u)this._loadedParentTiles[x]=p}}_addTile(t){let u=this._tiles[t.key];if(u)return u;u=this._cache.getAndRemove(t),u&&(this._setTileReloadTimer(t.key,u),u.tileID=t,this._state.initializeTileState(u,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,u)));const p=u;return u||(u=new Je(t,this._source.tileSize*t.overscaleFactor()),this._loadTile(u,this._tileLoaded.bind(this,u,t.key,u.state))),u.uses++,this._tiles[t.key]=u,p||this._source.fire(new n.Event("dataloading",{tile:u,coord:u.tileID,dataType:"source"})),u}_setTileReloadTimer(t,u){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const p=u.getExpiryTimeout();p&&(this._timers[t]=setTimeout(()=>{this._reloadTile(t,"expired"),delete this._timers[t]},p))}_removeTile(t){const u=this._tiles[t];u&&(u.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),u.uses>0||(u.hasData()&&u.state!=="reloading"?this._cache.add(u.tileID,u,u.getExpiryTimeout()):(u.aborted=!0,this._abortTile(u),this._unloadTile(u))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(t);this._cache.reset()}tilesIn(t,u,p){const y=[],x=this.transform;if(!x)return y;const I=p?x.getCameraQueryGeometry(t):t,R=t.map(fe=>x.pointCoordinate(fe,this.terrain)),O=I.map(fe=>x.pointCoordinate(fe,this.terrain)),V=this.getIds();let G=1/0,K=1/0,ie=-1/0,me=-1/0;for(const fe of O)G=Math.min(G,fe.x),K=Math.min(K,fe.y),ie=Math.max(ie,fe.x),me=Math.max(me,fe.y);for(let fe=0;fe=0&&xe[1].y+Ve>=0){const Ye=R.map(st=>ze.getTilePoint(st)),Ze=O.map(st=>ze.getTilePoint(st));y.push({tile:de,tileID:ze,queryGeometry:Ye,cameraQueryGeometry:Ze,scale:De})}}return y}getVisibleCoordinates(t){const u=this.getRenderableIds(t).map(p=>this._tiles[p].tileID);for(const p of u)p.posMatrix=this.transform.calculatePosMatrix(p.toUnwrapped());return u}hasTransition(){if(this._source.hasTransition())return!0;if(Qt(this._source.type))for(const t in this._tiles){const u=this._tiles[t];if(u.fadeEndTime!==void 0&&u.fadeEndTime>=n.exported.now())return!0}return!1}setFeatureState(t,u,p){this._state.updateState(t=t||"_geojsonTileLayer",u,p)}removeFeatureState(t,u,p){this._state.removeFeatureState(t=t||"_geojsonTileLayer",u,p)}getFeatureState(t,u){return this._state.getState(t=t||"_geojsonTileLayer",u)}setDependencies(t,u,p){const y=this._tiles[t];y&&y.setDependencies(u,p)}reloadTilesForDependencies(t,u){for(const p in this._tiles)this._tiles[p].hasDependency(t,u)&&this._reloadTile(p,"reloading");this._cache.filter(p=>!p.hasDependency(t,u))}}function Bt(g,t){const u=Math.abs(2*g.wrap)-+(g.wrap<0),p=Math.abs(2*t.wrap)-+(t.wrap<0);return g.overscaledZ-t.overscaledZ||p-u||t.canonical.y-g.canonical.y||t.canonical.x-g.canonical.x}function Qt(g){return g==="raster"||g==="image"||g==="video"}Xe.maxOverzooming=10,Xe.maxUnderzooming=3;const Rr="mapboxgl_preloaded_worker_pool";class Vr{constructor(){this.active={}}acquire(t){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Rr]}numActive(){return Object.keys(this.active).length}}const H=Math.floor(n.exported.hardwareConcurrency/2);let ut;function tt(){return ut||(ut=new Vr),ut}function be(g,t){const u={};for(const p in g)p!=="ref"&&(u[p]=g[p]);return n.refProperties.forEach(p=>{p in t&&(u[p]=t[p])}),u}function pe(g){g=g.slice();const t=Object.create(null);for(let u=0;u0?(y-I)/R:0;return this.points[x].mult(1-O).add(this.points[u].mult(O))}}function Fe(g,t){let u=!0;return g==="always"||g!=="never"&&t!=="never"||(u=!1),u}class gt{constructor(t,u,p){const y=this.boxCells=[],x=this.circleCells=[];this.xCellCount=Math.ceil(t/p),this.yCellCount=Math.ceil(u/p);for(let I=0;Ithis.width||y<0||u>this.height)return[];const O=[];if(t<=0&&u<=0&&this.width<=p&&this.height<=y){if(x)return[{key:null,x1:t,y1:u,x2:p,y2:y}];for(let V=0;V0}hitTestCircle(t,u,p,y,x){const I=t-p,R=t+p,O=u-p,V=u+p;if(R<0||I>this.width||V<0||O>this.height)return!1;const G=[];return this._forEachCell(I,O,R,V,this._queryCellCircle,G,{hitTest:!0,overlapMode:y,circle:{x:t,y:u,radius:p},seenUids:{box:{},circle:{}}},x),G.length>0}_queryCell(t,u,p,y,x,I,R,O){const{seenUids:V,hitTest:G,overlapMode:K}=R,ie=this.boxCells[x];if(ie!==null){const fe=this.bboxes;for(const de of ie)if(!V.box[de]){V.box[de]=!0;const ze=4*de,De=this.boxKeys[de];if(t<=fe[ze+2]&&u<=fe[ze+3]&&p>=fe[ze+0]&&y>=fe[ze+1]&&(!O||O(De))&&(!G||!Fe(K,De.overlapMode))&&(I.push({key:De,x1:fe[ze],y1:fe[ze+1],x2:fe[ze+2],y2:fe[ze+3]}),G))return!0}}const me=this.circleCells[x];if(me!==null){const fe=this.circles;for(const de of me)if(!V.circle[de]){V.circle[de]=!0;const ze=3*de,De=this.circleKeys[de];if(this._circleAndRectCollide(fe[ze],fe[ze+1],fe[ze+2],t,u,p,y)&&(!O||O(De))&&(!G||!Fe(K,De.overlapMode))){const Ve=fe[ze],xe=fe[ze+1],Ye=fe[ze+2];if(I.push({key:De,x1:Ve-Ye,y1:xe-Ye,x2:Ve+Ye,y2:xe+Ye}),G)return!0}}}return!1}_queryCellCircle(t,u,p,y,x,I,R,O){const{circle:V,seenUids:G,overlapMode:K}=R,ie=this.boxCells[x];if(ie!==null){const fe=this.bboxes;for(const de of ie)if(!G.box[de]){G.box[de]=!0;const ze=4*de,De=this.boxKeys[de];if(this._circleAndRectCollide(V.x,V.y,V.radius,fe[ze+0],fe[ze+1],fe[ze+2],fe[ze+3])&&(!O||O(De))&&!Fe(K,De.overlapMode))return I.push(!0),!0}}const me=this.circleCells[x];if(me!==null){const fe=this.circles;for(const de of me)if(!G.circle[de]){G.circle[de]=!0;const ze=3*de,De=this.circleKeys[de];if(this._circlesCollide(fe[ze],fe[ze+1],fe[ze+2],V.x,V.y,V.radius)&&(!O||O(De))&&!Fe(K,De.overlapMode))return I.push(!0),!0}}}_forEachCell(t,u,p,y,x,I,R,O){const V=this._convertToXCellCoord(t),G=this._convertToYCellCoord(u),K=this._convertToXCellCoord(p),ie=this._convertToYCellCoord(y);for(let me=V;me<=K;me++)for(let fe=G;fe<=ie;fe++)if(x.call(this,t,u,p,y,this.xCellCount*fe+me,I,R,O))return}_convertToXCellCoord(t){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(t*this.xScale)))}_convertToYCellCoord(t){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(t*this.yScale)))}_circlesCollide(t,u,p,y,x,I){const R=y-t,O=x-u,V=p+I;return V*V>R*R+O*O}_circleAndRectCollide(t,u,p,y,x,I,R){const O=(I-y)/2,V=Math.abs(t-(y+O));if(V>O+p)return!1;const G=(R-x)/2,K=Math.abs(u-(x+G));if(K>G+p)return!1;if(V<=O||K<=G)return!0;const ie=V-O,me=K-G;return ie*ie+me*me<=p*p}}function mi(g,t,u,p,y){const x=n.create();return t?(n.scale(x,x,[1/y,1/y,1]),u||n.rotateZ(x,x,p.angle)):n.multiply(x,p.labelPlaneMatrix,g),x}function ri(g,t,u,p,y){if(t){const x=n.clone(g);return n.scale(x,x,[y,y,1]),u||n.rotateZ(x,x,-p.angle),x}return p.glCoordMatrix}function yr(g,t,u){let p;u?(p=[g.x,g.y,u(g.x,g.y),1],n.transformMat4(p,p,t)):(p=[g.x,g.y,0,1],Vi(p,p,t));const y=p[3];return{point:new n.pointGeometry(p[0]/y,p[1]/y),signedDistanceFromCamera:y}}function Sr(g,t){return .5+g/t*.5}function gi(g,t){const u=g[0]/g[3],p=g[1]/g[3];return u>=-t[0]&&u<=t[0]&&p>=-t[1]&&p<=t[1]}function Ei(g,t,u,p,y,x,I,R,O,V){const G=p?g.textSizeData:g.iconSizeData,K=n.evaluateSizeForZoom(G,u.transform.zoom),ie=[256/u.width*2+1,256/u.height*2+1],me=p?g.text.dynamicLayoutVertexArray:g.icon.dynamicLayoutVertexArray;me.clear();const fe=g.lineVertexArray,de=p?g.text.placedSymbolArray:g.icon.placedSymbolArray,ze=u.transform.width/u.transform.height;let De=!1;for(let Ve=0;VeMath.abs(u.x-t.x)*p?{useVertical:!0}:(g===n.WritingMode.vertical?t.yu.x)?{needsFlipping:!0}:null}function pr(g,t,u,p,y,x,I,R,O,V,G,K,ie,me,fe,de){const ze=t/24,De=g.lineOffsetX*ze,Ve=g.lineOffsetY*ze;let xe;if(g.numGlyphs>1){const Ye=g.glyphStartIndex+g.numGlyphs,Ze=g.lineStartIndex,st=g.lineStartIndex+g.lineLength,lt=_i(ze,R,De,Ve,u,G,K,g,O,x,ie,fe,de);if(!lt)return{notEnoughRoom:!0};const yt=yr(lt.first.point,I,de).point,at=yr(lt.last.point,I,de).point;if(p&&!u){const Vt=Tt(g.writingMode,yt,at,me);if(Vt)return Vt}xe=[lt.first];for(let Vt=g.glyphStartIndex+1;Vt0?yt.point:hr(K,lt,Ze,1,y,de),Vt=Tt(g.writingMode,Ze,at,me);if(Vt)return Vt}const Ye=yi(ze*R.getoffsetX(g.glyphStartIndex),De,Ve,u,G,K,g.segment,g.lineStartIndex,g.lineStartIndex+g.lineLength,O,x,ie,fe,de);if(!Ye)return{notEnoughRoom:!0};xe=[Ye]}for(const Ye of xe)n.addDynamicAttributes(V,Ye.point,Ye.angle);return{}}function hr(g,t,u,p,y,x){const I=yr(g.add(g.sub(t)._unit()),y,x).point,R=u.sub(I);return u.add(R._mult(p/R.mag()))}function yi(g,t,u,p,y,x,I,R,O,V,G,K,ie,me){const fe=p?g-t:g+t;let de=fe>0?1:-1,ze=0;p&&(de*=-1,ze=Math.PI),de<0&&(ze+=Math.PI);let De=de>0?R+I:R+I+1,Ve=y,xe=y,Ye=0,Ze=0;const st=Math.abs(fe),lt=[];for(;Ye+Ze<=st;){if(De+=de,De=O)return null;if(xe=Ve,lt.push(Ve),Ve=K[De],Ve===void 0){const jt=new n.pointGeometry(V.getx(De),V.gety(De)),gr=yr(jt,G,me);if(gr.signedDistanceFromCamera>0)Ve=K[De]=gr.point;else{const br=De-de;Ve=hr(Ye===0?x:new n.pointGeometry(V.getx(br),V.gety(br)),jt,xe,st-Ye+1,G,me)}}Ye+=Ze,Ze=xe.dist(Ve)}const yt=(st-Ye)/Ze,at=Ve.sub(xe),Vt=at.mult(yt)._add(xe);Vt._add(at._unit()._perp()._mult(u*de));const Dt=ze+Math.atan2(Ve.y-xe.y,Ve.x-xe.x);return lt.push(Vt),{point:Vt,angle:ie?Dt:0,path:lt}}const nn=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function sr(g,t){for(let u=0;u=1;Ar--)tr.push(gr.path[Ar]);for(let Ar=1;Aryr(Pr,O,fe));tr=Ar.some(Pr=>Pr.signedDistanceFromCamera<=0)?[]:Ar.map(Pr=>Pr.point)}let Gr=[];if(tr.length>0){const Ar=tr[0].clone(),Pr=tr[0].clone();for(let Hr=1;Hr=Vt.x&&Pr.x<=Dt.x&&Ar.y>=Vt.y&&Pr.y<=Dt.y?[tr]:Pr.xDt.x||Pr.yDt.y?[]:n.clipLine([tr],Vt.x,Vt.y,Dt.x,Dt.y)}for(const Ar of Gr){jt.reset(Ar,.25*at);let Pr=0;Pr=jt.length<=.5*at?1:Math.ceil(jt.paddedLength/qr)+1;for(let Hr=0;Hr=this.screenRightBoundary||ythis.screenBottomBoundary}isInsideGrid(t,u,p,y){return p>=0&&t=0&&up.collisionGroupID===u}}return this.collisionGroups[t]}}function $n(g,t,u,p,y){const{horizontalAlign:x,verticalAlign:I}=n.getAnchorAlignment(g),R=-(x-.5)*t,O=-(I-.5)*u,V=n.evaluateVariableOffset(g,p);return new n.pointGeometry(R+V[0]*y,O+V[1]*y)}function Ce(g,t,u,p,y,x){const{x1:I,x2:R,y1:O,y2:V,anchorPointX:G,anchorPointY:K}=g,ie=new n.pointGeometry(t,u);return p&&ie._rotate(y?x:-x),{x1:I+ie.x,y1:O+ie.y,x2:R+ie.x,y2:V+ie.y,anchorPointX:G,anchorPointY:K}}class N{constructor(t,u,p,y,x){this.transform=t.clone(),this.terrain=u,this.collisionIndex=new aa(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=p,this.retainedQueryData={},this.collisionGroups=new Vn(y),this.collisionCircleArrays={},this.prevPlacement=x,x&&(x.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(t,u,p,y){const x=p.getBucket(u),I=p.latestFeatureIndex;if(!x||!I||u.id!==x.layerIds[0])return;const R=p.collisionBoxArray,O=x.layers[0].layout,V=Math.pow(2,this.transform.zoom-p.tileID.overscaledZ),G=p.tileSize/n.EXTENT,K=this.transform.calculatePosMatrix(p.tileID.toUnwrapped()),ie=O.get("text-pitch-alignment")==="map",me=O.get("text-rotation-alignment")==="map",fe=ui(p,1,this.transform.zoom),de=mi(K,ie,me,this.transform,fe);let ze=null;if(ie){const Ve=ri(K,ie,me,this.transform,fe);ze=n.multiply([],this.transform.labelPlaneMatrix,Ve)}this.retainedQueryData[x.bucketInstanceId]=new zn(x.bucketInstanceId,I,x.sourceLayerIndex,x.index,p.tileID);const De={bucket:x,layout:O,posMatrix:K,textLabelPlaneMatrix:de,labelToScreenMatrix:ze,scale:V,textPixelRatio:G,holdingForFade:p.holdingForFade(),collisionBoxArray:R,partiallyEvaluatedTextSize:n.evaluateSizeForZoom(x.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(x.sourceID)};if(y)for(const Ve of x.sortKeyRanges){const{sortKey:xe,symbolInstanceStart:Ye,symbolInstanceEnd:Ze}=Ve;t.push({sortKey:xe,symbolInstanceStart:Ye,symbolInstanceEnd:Ze,parameters:De})}else t.push({symbolInstanceStart:0,symbolInstanceEnd:x.symbolInstances.length,parameters:De})}attemptAnchorPlacement(t,u,p,y,x,I,R,O,V,G,K,ie,me,fe,de,ze){const De=[ie.textOffset0,ie.textOffset1],Ve=$n(t,p,y,De,x),xe=this.collisionIndex.placeCollisionBox(Ce(u,Ve.x,Ve.y,I,R,this.transform.angle),K,O,V,G.predicate,ze);if((!de||this.collisionIndex.placeCollisionBox(Ce(de,Ve.x,Ve.y,I,R,this.transform.angle),K,O,V,G.predicate,ze).box.length!==0)&&xe.box.length>0){let Ye;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ie.crossTileID]&&this.prevPlacement.placements[ie.crossTileID]&&this.prevPlacement.placements[ie.crossTileID].text&&(Ye=this.prevPlacement.variableOffsets[ie.crossTileID].anchor),ie.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[ie.crossTileID]={textOffset:De,width:p,height:y,anchor:t,textBoxScale:x,prevAnchor:Ye},this.markUsedJustification(me,t,ie,fe),me.allowVerticalPlacement&&(this.markUsedOrientation(me,fe,ie),this.placedOrientations[ie.crossTileID]=fe),{shift:Ve,placedGlyphBoxes:xe}}}placeLayerBucketPart(t,u,p){const{bucket:y,layout:x,posMatrix:I,textLabelPlaneMatrix:R,labelToScreenMatrix:O,textPixelRatio:V,holdingForFade:G,collisionBoxArray:K,partiallyEvaluatedTextSize:ie,collisionGroup:me}=t.parameters,fe=x.get("text-optional"),de=x.get("icon-optional"),ze=n.getOverlapMode(x,"text-overlap","text-allow-overlap"),De=ze==="always",Ve=n.getOverlapMode(x,"icon-overlap","icon-allow-overlap"),xe=Ve==="always",Ye=x.get("text-rotation-alignment")==="map",Ze=x.get("text-pitch-alignment")==="map",st=x.get("icon-text-fit")!=="none",lt=x.get("symbol-z-order")==="viewport-y",yt=De&&(xe||!y.hasIconData()||de),at=xe&&(De||!y.hasTextData()||fe);!y.collisionArrays&&K&&y.deserializeCollisionBoxes(K);const Vt=(Dt,jt)=>{if(u[Dt.crossTileID])return;if(G)return void(this.placements[Dt.crossTileID]=new Un(!1,!1,!1));let gr=!1,br=!1,tr=!0,qr=null,Gr={box:null,offscreen:null},Ar={box:null,offscreen:null},Pr=null,Hr=null,Ci=null,Rn=0,kn=0,Ln=0;jt.textFeatureIndex?Rn=jt.textFeatureIndex:Dt.useRuntimeCollisionCircles&&(Rn=Dt.featureIndex),jt.verticalTextFeatureIndex&&(kn=jt.verticalTextFeatureIndex);const ma=this.retainedQueryData[y.bucketInstanceId].tileID,yn=this.terrain?(ki,Er)=>this.terrain.getElevation(ma,ki,Er):null;for(const ki of["textBox","verticalTextBox","iconBox","verticalIconBox"]){const Er=jt[ki];Er&&(Er.elevation=yn?yn(Er.anchorPointX,Er.anchorPointY):0)}const Yi=jt.textBox;if(Yi){const ki=$r=>{let Ai=n.WritingMode.horizontal;if(y.allowVerticalPlacement&&!$r&&this.prevPlacement){const Pi=this.prevPlacement.placedOrientations[Dt.crossTileID];Pi&&(this.placedOrientations[Dt.crossTileID]=Pi,Ai=Pi,this.markUsedOrientation(y,Ai,Dt))}return Ai},Er=($r,Ai)=>{if(y.allowVerticalPlacement&&Dt.numVerticalGlyphVertices>0&&jt.verticalTextBox){for(const Pi of y.writingModes)if(Pi===n.WritingMode.vertical?(Gr=Ai(),Ar=Gr):Gr=$r(),Gr&&Gr.box&&Gr.box.length)break}else Gr=$r()};if(x.get("text-variable-anchor")){let $r=x.get("text-variable-anchor");if(this.prevPlacement&&this.prevPlacement.variableOffsets[Dt.crossTileID]){const oi=this.prevPlacement.variableOffsets[Dt.crossTileID];$r.indexOf(oi.anchor)>0&&($r=$r.filter(vn=>vn!==oi.anchor),$r.unshift(oi.anchor))}const Ai=(oi,vn,Ia)=>{const xl=oi.x2-oi.x1,Ja=oi.y2-oi.y1,Zc=Dt.textBoxScale,wl=st&&Ve==="never"?vn:null;let ga={box:[],offscreen:!1};const Ca=ze!=="never"?2*$r.length:$r.length;for(let Aa=0;Aa=$r.length?ze:"never",Dt,y,Ia,wl,yn);if(_o&&(ga=_o.placedGlyphBoxes,ga&&ga.box&&ga.box.length)){gr=!0,qr=_o.shift;break}}return ga};Er(()=>Ai(Yi,jt.iconBox,n.WritingMode.horizontal),()=>{const oi=jt.verticalTextBox;return y.allowVerticalPlacement&&!(Gr&&Gr.box&&Gr.box.length)&&Dt.numVerticalGlyphVertices>0&&oi?Ai(oi,jt.verticalIconBox,n.WritingMode.vertical):{box:null,offscreen:null}}),Gr&&(gr=Gr.box,tr=Gr.offscreen);const Pi=ki(Gr&&Gr.box);if(!gr&&this.prevPlacement){const oi=this.prevPlacement.variableOffsets[Dt.crossTileID];oi&&(this.variableOffsets[Dt.crossTileID]=oi,this.markUsedJustification(y,oi.anchor,Dt,Pi))}}else{const $r=(Ai,Pi)=>{const oi=this.collisionIndex.placeCollisionBox(Ai,ze,V,I,me.predicate,yn);return oi&&oi.box&&oi.box.length&&(this.markUsedOrientation(y,Pi,Dt),this.placedOrientations[Dt.crossTileID]=Pi),oi};Er(()=>$r(Yi,n.WritingMode.horizontal),()=>{const Ai=jt.verticalTextBox;return y.allowVerticalPlacement&&Dt.numVerticalGlyphVertices>0&&Ai?$r(Ai,n.WritingMode.vertical):{box:null,offscreen:null}}),ki(Gr&&Gr.box&&Gr.box.length)}}if(Pr=Gr,gr=Pr&&Pr.box&&Pr.box.length>0,tr=Pr&&Pr.offscreen,Dt.useRuntimeCollisionCircles){const ki=y.text.placedSymbolArray.get(Dt.centerJustifiedTextSymbolIndex),Er=n.evaluateSizeForFeature(y.textSizeData,ie,ki),$r=x.get("text-padding");Hr=this.collisionIndex.placeCollisionCircles(ze,ki,y.lineVertexArray,y.glyphOffsetArray,Er,I,R,O,p,Ze,me.predicate,Dt.collisionCircleDiameter,$r,yn),Hr.circles.length&&Hr.collisionDetected&&!p&&n.warnOnce("Collisions detected, but collision boxes are not shown"),gr=De||Hr.circles.length>0&&!Hr.collisionDetected,tr=tr&&Hr.offscreen}if(jt.iconFeatureIndex&&(Ln=jt.iconFeatureIndex),jt.iconBox){const ki=Er=>{const $r=st&&qr?Ce(Er,qr.x,qr.y,Ye,Ze,this.transform.angle):Er;return this.collisionIndex.placeCollisionBox($r,Ve,V,I,me.predicate,yn)};Ar&&Ar.box&&Ar.box.length&&jt.verticalIconBox?(Ci=ki(jt.verticalIconBox),br=Ci.box.length>0):(Ci=ki(jt.iconBox),br=Ci.box.length>0),tr=tr&&Ci.offscreen}const Hn=fe||Dt.numHorizontalGlyphVertices===0&&Dt.numVerticalGlyphVertices===0,go=de||Dt.numIconVertices===0;if(Hn||go?go?Hn||(br=br&&gr):gr=br&&gr:br=gr=br&&gr,gr&&Pr&&Pr.box&&this.collisionIndex.insertCollisionBox(Pr.box,ze,x.get("text-ignore-placement"),y.bucketInstanceId,Ar&&Ar.box&&kn?kn:Rn,me.ID),br&&Ci&&this.collisionIndex.insertCollisionBox(Ci.box,Ve,x.get("icon-ignore-placement"),y.bucketInstanceId,Ln,me.ID),Hr&&(gr&&this.collisionIndex.insertCollisionCircles(Hr.circles,ze,x.get("text-ignore-placement"),y.bucketInstanceId,Rn,me.ID),p)){const ki=y.bucketInstanceId;let Er=this.collisionCircleArrays[ki];Er===void 0&&(Er=this.collisionCircleArrays[ki]=new gn);for(let $r=0;$r=0;--jt){const gr=Dt[jt];Vt(y.symbolInstances.get(gr),y.collisionArrays[gr])}}else for(let Dt=t.symbolInstanceStart;Dt=0&&(t.text.placedSymbolArray.get(R).crossTileID=x>=0&&R!==x?0:p.crossTileID)}markUsedOrientation(t,u,p){const y=u===n.WritingMode.horizontal||u===n.WritingMode.horizontalOnly?u:0,x=u===n.WritingMode.vertical?u:0,I=[p.leftJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.rightJustifiedTextSymbolIndex];for(const R of I)t.text.placedSymbolArray.get(R).placedOrientation=y;p.verticalPlacedTextSymbolIndex&&(t.text.placedSymbolArray.get(p.verticalPlacedTextSymbolIndex).placedOrientation=x)}commit(t){this.commitTime=t,this.zoomAtLastRecencyCheck=this.transform.zoom;const u=this.prevPlacement;let p=!1;this.prevZoomAdjustment=u?u.zoomAdjustment(this.transform.zoom):0;const y=u?u.symbolFadeChange(t):1,x=u?u.opacities:{},I=u?u.variableOffsets:{},R=u?u.placedOrientations:{};for(const O in this.placements){const V=this.placements[O],G=x[O];G?(this.opacities[O]=new Lr(G,y,V.text,V.icon),p=p||V.text!==G.text.placed||V.icon!==G.icon.placed):(this.opacities[O]=new Lr(null,y,V.text,V.icon,V.skipFade),p=p||V.text||V.icon)}for(const O in x){const V=x[O];if(!this.opacities[O]){const G=new Lr(V,y,!1,!1);G.isHidden()||(this.opacities[O]=G,p=p||V.text.placed||V.icon.placed)}}for(const O in I)this.variableOffsets[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.variableOffsets[O]=I[O]);for(const O in R)this.placedOrientations[O]||!this.opacities[O]||this.opacities[O].isHidden()||(this.placedOrientations[O]=R[O]);if(u&&u.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");p?this.lastPlacementChangeTime=t:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=u?u.lastPlacementChangeTime:t)}updateLayerOpacities(t,u){const p={};for(const y of u){const x=y.getBucket(t);x&&y.latestFeatureIndex&&t.id===x.layerIds[0]&&this.updateBucketOpacities(x,p,y.collisionBoxArray)}}updateBucketOpacities(t,u,p){t.hasTextData()&&t.text.opacityVertexArray.clear(),t.hasIconData()&&t.icon.opacityVertexArray.clear(),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexArray.clear(),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexArray.clear();const y=t.layers[0].layout,x=new Lr(null,0,!1,!1,!0),I=y.get("text-allow-overlap"),R=y.get("icon-allow-overlap"),O=y.get("text-variable-anchor"),V=y.get("text-rotation-alignment")==="map",G=y.get("text-pitch-alignment")==="map",K=y.get("icon-text-fit")!=="none",ie=new Lr(null,0,I&&(R||!t.hasIconData()||y.get("icon-optional")),R&&(I||!t.hasTextData()||y.get("text-optional")),!0);!t.collisionArrays&&p&&(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData())&&t.deserializeCollisionBoxes(p);const me=(fe,de,ze)=>{for(let De=0;De0,Ze=this.placedOrientations[de.crossTileID],st=Ze===n.WritingMode.vertical,lt=Ze===n.WritingMode.horizontal||Ze===n.WritingMode.horizontalOnly;if(ze>0||De>0){const yt=Te(xe.text);me(t.text,ze,st?Ge:yt),me(t.text,De,lt?Ge:yt);const at=xe.text.isHidden();[de.rightJustifiedTextSymbolIndex,de.centerJustifiedTextSymbolIndex,de.leftJustifiedTextSymbolIndex].forEach(jt=>{jt>=0&&(t.text.placedSymbolArray.get(jt).hidden=at||st?1:0)}),de.verticalPlacedTextSymbolIndex>=0&&(t.text.placedSymbolArray.get(de.verticalPlacedTextSymbolIndex).hidden=at||lt?1:0);const Vt=this.variableOffsets[de.crossTileID];Vt&&this.markUsedJustification(t,Vt.anchor,de,Ze);const Dt=this.placedOrientations[de.crossTileID];Dt&&(this.markUsedJustification(t,"left",de,Dt),this.markUsedOrientation(t,Dt,de))}if(Ye){const yt=Te(xe.icon),at=!(K&&de.verticalPlacedIconSymbolIndex&&st);de.placedIconSymbolIndex>=0&&(me(t.icon,de.numIconVertices,at?yt:Ge),t.icon.placedSymbolArray.get(de.placedIconSymbolIndex).hidden=xe.icon.isHidden()),de.verticalPlacedIconSymbolIndex>=0&&(me(t.icon,de.numVerticalIconVertices,at?Ge:yt),t.icon.placedSymbolArray.get(de.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}if(t.hasIconCollisionBoxData()||t.hasTextCollisionBoxData()){const yt=t.collisionArrays[fe];if(yt){let at=new n.pointGeometry(0,0);if(yt.textBox||yt.verticalTextBox){let Dt=!0;if(O){const jt=this.variableOffsets[Ve];jt?(at=$n(jt.anchor,jt.width,jt.height,jt.textOffset,jt.textBoxScale),V&&at._rotate(G?this.transform.angle:-this.transform.angle)):Dt=!1}yt.textBox&&z(t.textCollisionBox.collisionVertexArray,xe.text.placed,!Dt||st,at.x,at.y),yt.verticalTextBox&&z(t.textCollisionBox.collisionVertexArray,xe.text.placed,!Dt||lt,at.x,at.y)}const Vt=!!(!lt&&yt.verticalIconBox);yt.iconBox&&z(t.iconCollisionBox.collisionVertexArray,xe.icon.placed,Vt,K?at.x:0,K?at.y:0),yt.verticalIconBox&&z(t.iconCollisionBox.collisionVertexArray,xe.icon.placed,!Vt,K?at.x:0,K?at.y:0)}}}if(t.sortFeatures(this.transform.angle),this.retainedQueryData[t.bucketInstanceId]&&(this.retainedQueryData[t.bucketInstanceId].featureSortOrder=t.featureSortOrder),t.hasTextData()&&t.text.opacityVertexBuffer&&t.text.opacityVertexBuffer.updateData(t.text.opacityVertexArray),t.hasIconData()&&t.icon.opacityVertexBuffer&&t.icon.opacityVertexBuffer.updateData(t.icon.opacityVertexArray),t.hasIconCollisionBoxData()&&t.iconCollisionBox.collisionVertexBuffer&&t.iconCollisionBox.collisionVertexBuffer.updateData(t.iconCollisionBox.collisionVertexArray),t.hasTextCollisionBoxData()&&t.textCollisionBox.collisionVertexBuffer&&t.textCollisionBox.collisionVertexBuffer.updateData(t.textCollisionBox.collisionVertexArray),t.text.opacityVertexArray.length!==t.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${t.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${t.text.layoutVertexArray.length}) / 4`);if(t.icon.opacityVertexArray.length!==t.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${t.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${t.icon.layoutVertexArray.length}) / 4`);if(t.bucketInstanceId in this.collisionCircleArrays){const fe=this.collisionCircleArrays[t.bucketInstanceId];t.placementInvProjMatrix=fe.invProjMatrix,t.placementViewportMatrix=fe.viewportMatrix,t.collisionCircleArray=fe.circles,delete this.collisionCircleArrays[t.bucketInstanceId]}}symbolFadeChange(t){return this.fadeDuration===0?1:(t-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(t){return Math.max(0,(this.transform.zoom-t)/1.5)}hasTransitions(t){return this.stale||t-this.lastPlacementChangeTimet}setStale(){this.stale=!0}}function z(g,t,u,p,y){g.emplaceBack(t?1:0,u?1:0,p||0,y||0),g.emplaceBack(t?1:0,u?1:0,p||0,y||0),g.emplaceBack(t?1:0,u?1:0,p||0,y||0),g.emplaceBack(t?1:0,u?1:0,p||0,y||0)}const U=Math.pow(2,25),q=Math.pow(2,24),Q=Math.pow(2,17),he=Math.pow(2,16),Se=Math.pow(2,9),Ee=Math.pow(2,8),ve=Math.pow(2,1);function Te(g){if(g.opacity===0&&!g.placed)return 0;if(g.opacity===1&&g.placed)return 4294967295;const t=g.placed?1:0,u=Math.floor(127*g.opacity);return u*U+t*q+u*Q+t*he+u*Se+t*Ee+u*ve+t}const Ge=0;class ot{constructor(t){this._sortAcrossTiles=t.layout.get("symbol-z-order")!=="viewport-y"&&!t.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(t,u,p,y,x){const I=this._bucketParts;for(;this._currentTileIndexR.sortKey-O.sortKey));this._currentPartIndex{const I=n.exported.now()-y;return!this._forceFullPlacement&&I>2};for(;this._currentPlacementIndex>=0;){const I=u[t[this._currentPlacementIndex]],R=this.placement.collisionIndex.transform.zoom;if(I.type==="symbol"&&(!I.minzoom||I.minzoom<=R)&&(!I.maxzoom||I.maxzoom>R)){if(this._inProgressLayer||(this._inProgressLayer=new ot(I)),this._inProgressLayer.continuePlacement(p[I.source],this.placement,this._showCollisionBoxes,I,x))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(t){return this.placement.commit(t),this.placement}}const Ct=512/n.EXTENT/2;class Pt{constructor(t,u,p){this.tileID=t,this.indexedSymbolInstances={},this.bucketInstanceId=p;for(let y=0;yt.overscaledZ)for(const R in I){const O=I[R];O.tileID.isChildOf(t)&&O.findMatches(u.symbolInstances,t,y)}else{const R=I[t.scaledTo(Number(x)).key];R&&R.findMatches(u.symbolInstances,t,y)}}for(let x=0;x{u[p]=!0});for(const p in this.layerIndexes)u[p]||delete this.layerIndexes[p]}}var mr=n.createLayout([{name:"a_pos",type:"Int16",components:2}]);class or extends n.Evented{constructor(t){super(),this.sourceCache=t,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.renderHistory=[],this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,this.renderHistorySize=t._cache.max,t.usedForTerrain=!0,t.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null;for(const t in this._tiles){const u=this._tiles[t];u.textures.forEach(p=>p.destroy()),u.textures=[]}}update(t,u){this.sourceCache.update(t,u),this._renderableTilesKeys=[];for(const p of t.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:u}))this._renderableTilesKeys.push(p.key),this._tiles[p.key]||(p.posMatrix=new Float64Array(16),n.ortho(p.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),this._tiles[p.key]=new Je(p,this.tileSize))}removeOutdated(t){const u={};this.renderHistory=this.renderHistory.filter((p,y)=>this.renderHistory.indexOf(p)===y).slice(0,this.renderHistorySize);for(const p of this._renderableTilesKeys)u[p]=!0;for(const p of this.renderHistory)u[p]=!0;for(const p in this._tiles)u[p]||(this._tiles[p].clearTextures(t),delete this._tiles[p])}getRenderableTiles(){return this._renderableTilesKeys.map(t=>this.getTileByID(t))}getTileByID(t){return this._tiles[t]}getTerrainCoords(t){const u={};for(const p of this._renderableTilesKeys){const y=this._tiles[p].tileID;if(y.canonical.equals(t.canonical)){const x=t.clone();x.posMatrix=new Float64Array(16),n.ortho(x.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),u[p]=x}else if(y.canonical.isChildOf(t.canonical)){const x=t.clone();x.posMatrix=new Float64Array(16);const I=y.canonical.z-t.canonical.z,R=y.canonical.x-(y.canonical.x>>I<>I<>I;n.ortho(x.posMatrix,0,V,0,V,0,1),n.translate(x.posMatrix,x.posMatrix,[-R*V,-O*V,0]),u[p]=x}else if(t.canonical.isChildOf(y.canonical)){const x=t.clone();x.posMatrix=new Float64Array(16);const I=t.canonical.z-y.canonical.z,R=t.canonical.x-(t.canonical.x>>I<>I<>I;n.ortho(x.posMatrix,0,n.EXTENT,0,n.EXTENT,0,1),n.translate(x.posMatrix,x.posMatrix,[R*V,O*V,0]),n.scale(x.posMatrix,x.posMatrix,[1/2**I,1/2**I,0]),u[p]=x}}return u}getSourceTile(t,u){const p=this.sourceCache._source;let y=t.overscaledZ-this.deltaZoom;if(y>p.maxzoom&&(y=p.maxzoom),y=p.minzoom&&(!x||!x.dem);)x=this.sourceCache.getTileByID(t.scaledTo(y--).key);return x}tilesAfterTime(t=Date.now()){return Object.values(this._tiles).filter(u=>u.timeLoaded>=t)}}class fr{constructor(t,u,p){this.style=t,this.sourceCache=new or(u),this.options=p,this.exaggeration=typeof p.exaggeration=="number"?p.exaggeration:1,this.elevationOffset=typeof p.elevationOffset=="number"?p.elevationOffset:450,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024,this.clearRerenderCache()}getDEMElevation(t,u,p,y=n.EXTENT){if(!(u>=0&&u=0&&pt.canonical.z&&(t.canonical.z>=y?x=t.canonical.z-y:n.warnOnce("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const I=t.canonical.x-(t.canonical.x>>x<>x<>8<<4|x>>8,u[I+3]=0;const p=new n.RGBAImage({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(u.buffer)),y=new T(t,p,t.gl.RGBA,{premultiply:!1});return y.bind(t.gl.NEAREST,t.gl.CLAMP_TO_EDGE),this._coordsTexture=y,y}pointCoordinate(t){const u=new Uint8Array(4),p=this.style.map.painter,y=p.context,x=y.gl;y.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),x.readPixels(t.x,p.height/devicePixelRatio-t.y-1,1,1,x.RGBA,x.UNSIGNED_BYTE,u),y.bindFramebuffer.set(null);const I=u[0]+(u[2]>>4<<8),R=u[1]+((15&u[2])<<8),O=this.coordsIndex[255-u[3]],V=O&&this.sourceCache.getTileByID(O);if(!V)return null;const G=this._coordsTextureSize,K=(1<n.emitValidationErrors(g,t&&t.filter(u=>u.identifier!=="source.canvas")),Tr=n.pick(Ie,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData"]),Qr=n.pick(Ie,["setCenter","setZoom","setBearing","setPitch"]),Dr=function(){const g={},t=n.spec.$version;for(const u in n.spec.$root){const p=n.spec.$root[u];if(p.required){let y=null;y=u==="version"?t:p.type==="array"?[]:{},y!=null&&(g[u]=y)}}return g}();class fi extends n.Evented{constructor(t,u={}){super(),this.map=t,this.dispatcher=new Ae(tt(),this),this.imageManager=new D,this.imageManager.setEventedParent(this),this.glyphManager=new Y(t._requestManager,u.localIdeographFontFamily),this.lineAtlas=new ye(256,512),this.crossTileSymbolIndex=new Yt,this._layers={},this._serializedLayers={},this._order=[],this.sourceCaches={},this.zoomHistory=new n.ZoomHistory,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",n.getReferrer());const p=this;this._rtlTextPluginCallback=fi.registerForPluginStateChange(y=>{p.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:y.pluginStatus,pluginURL:y.pluginURL},(x,I)=>{if(n.triggerPluginCompletionEvent(x),I&&I.every(R=>R))for(const R in p.sourceCaches)p.sourceCaches[R].reload()})}),this.on("data",y=>{if(y.dataType!=="source"||y.sourceDataType!=="metadata")return;const x=this.sourceCaches[y.sourceId];if(!x)return;const I=x.getSource();if(I&&I.vectorLayerIds)for(const R in this._layers){const O=this._layers[R];O.source===I.id&&this._validateLayer(O)}})}loadURL(t,u={}){this.fire(new n.Event("dataloading",{dataType:"style"}));const p=typeof u.validate!="boolean"||u.validate,y=this.map._requestManager.transformRequest(t,n.ResourceType.Style);this._request=n.getJSON(y,(x,I)=>{this._request=null,x?this.fire(new n.ErrorEvent(x)):I&&this._load(I,p)})}loadJSON(t,u={}){this.fire(new n.Event("dataloading",{dataType:"style"})),this._request=n.exported.frame(()=>{this._request=null,this._load(t,u.validate!==!1)})}loadEmpty(){this.fire(new n.Event("dataloading",{dataType:"style"})),this._load(Dr,!1)}_load(t,u){if(u&&dr(this,n.validateStyle(t)))return;this._loaded=!0,this.stylesheet=t;for(const y in t.sources)this.addSource(y,t.sources[y],{validate:!1});t.sprite?this._loadSprite(t.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(t.glyphs);const p=pe(this.stylesheet.layers);this._order=p.map(y=>y.id),this._layers={},this._serializedLayers={};for(let y of p)y=n.createStyleLayer(y),y.setEventedParent(this,{layer:{id:y.id}}),this._layers[y.id]=y,this._serializedLayers[y.id]=y.serialize();this.dispatcher.broadcast("setLayers",this._serializeLayers(this._order)),this.light=new ce(this.stylesheet.light),this.setTerrain(this.stylesheet.terrain),this.fire(new n.Event("data",{dataType:"style"})),this.fire(new n.Event("style.load"))}_loadSprite(t){this._spriteRequest=function(u,p,y,x){let I,R,O;const V=y>1?"@2x":"";let G=n.getJSON(p.transformRequest(p.normalizeSpriteURL(u,V,".json"),n.ResourceType.SpriteJSON),(me,fe)=>{G=null,O||(O=me,I=fe,ie())}),K=n.getImage(p.transformRequest(p.normalizeSpriteURL(u,V,".png"),n.ResourceType.SpriteImage),(me,fe)=>{K=null,O||(O=me,R=fe,ie())});function ie(){if(O)x(O);else if(I&&R){const me=n.exported.getImageData(R),fe={};for(const de in I){const{width:ze,height:De,x:Ve,y:xe,sdf:Ye,pixelRatio:Ze,stretchX:st,stretchY:lt,content:yt}=I[de],at=new n.RGBAImage({width:ze,height:De});n.RGBAImage.copy(me,at,{x:Ve,y:xe},{x:0,y:0},{width:ze,height:De}),fe[de]={data:at,pixelRatio:Ze,sdf:Ye,stretchX:st,stretchY:lt,content:yt}}x(null,fe)}}return{cancel(){G&&(G.cancel(),G=null),K&&(K.cancel(),K=null)}}}(t,this.map._requestManager,this.map.getPixelRatio(),(u,p)=>{if(this._spriteRequest=null,u)this.fire(new n.ErrorEvent(u));else if(p)for(const y in p)this.imageManager.addImage(y,p[y]);this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"}))})}_validateLayer(t){const u=this.sourceCaches[t.source];if(!u)return;const p=t.sourceLayer;if(!p)return;const y=u.getSource();(y.type==="geojson"||y.vectorLayerIds&&y.vectorLayerIds.indexOf(p)===-1)&&this.fire(new n.ErrorEvent(new Error(`Source layer "${p}" does not exist on source "${y.id}" as specified by style layer "${t.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const t in this.sourceCaches)if(!this.sourceCaches[t].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeLayers(t){const u=[];for(const p of t){const y=this._layers[p];y.type!=="custom"&&u.push(y.serialize())}return u}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const t in this.sourceCaches)if(this.sourceCaches[t].hasTransition())return!0;for(const t in this._layers)if(this._layers[t].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(t){if(!this._loaded)return;const u=this._changed;if(this._changed){const y=Object.keys(this._updatedLayers),x=Object.keys(this._removedLayers);(y.length||x.length)&&this._updateWorkerLayers(y,x);for(const I in this._updatedSources){const R=this._updatedSources[I];if(R==="reload")this._reloadSource(I);else{if(R!=="clear")throw new Error(`Invalid action ${R}`);this._clearSource(I)}}this._updateTilesForChangedImages();for(const I in this._updatedPaintProps)this._layers[I].updateTransitions(t);this.light.updateTransitions(t),this._resetUpdates()}const p={};for(const y in this.sourceCaches){const x=this.sourceCaches[y];p[y]=x.used,x.used=!1}for(const y of this._order){const x=this._layers[y];x.recalculate(t,this._availableImages),!x.isHidden(t.zoom)&&x.source&&(this.sourceCaches[x.source].used=!0)}for(const y in p){const x=this.sourceCaches[y];p[y]!==x.used&&x.fire(new n.Event("data",{sourceDataType:"visibility",dataType:"source",sourceId:y}))}this.light.recalculate(t),this.z=t.zoom,u&&this.fire(new n.Event("data",{dataType:"style"}))}_updateTilesForChangedImages(){const t=Object.keys(this._changedImages);if(t.length){for(const u in this.sourceCaches)this.sourceCaches[u].reloadTilesForDependencies(["icons","patterns"],t);this._changedImages={}}}_updateWorkerLayers(t,u){this.dispatcher.broadcast("updateLayers",{layers:this._serializeLayers(t),removedIds:u})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={}}setTerrain(t){if(this._checkLoaded(),this._terrainDataCallback&&this.off("data",this._terrainDataCallback),this._terrainfreezeElevationCallback&&this.map.off("freezeElevation",this._terrainfreezeElevationCallback),t){const u=this.sourceCaches[t.source];if(!u)throw new Error(`cannot load terrain, because there exists no source with ID: ${t.source}`);this.terrain=new fr(this,u,t),this.map.transform.updateElevation(this.terrain),this._terrainfreezeElevationCallback=p=>{p.freeze?this.map.transform.freezeElevation=!0:(this.map.transform.freezeElevation=!1,this.map.transform.recalculateZoom(this.terrain))},this._terrainDataCallback=p=>{p.tile&&(p.sourceId===t.source?(this.map.transform.updateElevation(this.terrain),this.terrain.rememberForRerender(p.sourceId,p.tile.tileID)):p.source.type==="geojson"&&this.terrain.rememberForRerender(p.sourceId,p.tile.tileID))},this.on("data",this._terrainDataCallback),this.map.on("freezeElevation",this._terrainfreezeElevationCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.map.transform.updateElevation(this.terrain);this.map.fire(new n.Event("terrain",{terrain:t}))}setState(t){if(this._checkLoaded(),dr(this,n.validateStyle(t)))return!1;(t=n.clone$1(t)).layers=pe(t.layers);const u=function(y,x){if(!y)return[{command:Ie.setStyle,args:[x]}];let I=[];try{if(!S(y.version,x.version))return[{command:Ie.setStyle,args:[x]}];S(y.center,x.center)||I.push({command:Ie.setCenter,args:[x.center]}),S(y.zoom,x.zoom)||I.push({command:Ie.setZoom,args:[x.zoom]}),S(y.bearing,x.bearing)||I.push({command:Ie.setBearing,args:[x.bearing]}),S(y.pitch,x.pitch)||I.push({command:Ie.setPitch,args:[x.pitch]}),S(y.sprite,x.sprite)||I.push({command:Ie.setSprite,args:[x.sprite]}),S(y.glyphs,x.glyphs)||I.push({command:Ie.setGlyphs,args:[x.glyphs]}),S(y.transition,x.transition)||I.push({command:Ie.setTransition,args:[x.transition]}),S(y.light,x.light)||I.push({command:Ie.setLight,args:[x.light]});const R={},O=[];(function(G,K,ie,me){let fe;for(fe in K=K||{},G=G||{})Object.prototype.hasOwnProperty.call(G,fe)&&(Object.prototype.hasOwnProperty.call(K,fe)||mt(fe,ie,me));for(fe in K)Object.prototype.hasOwnProperty.call(K,fe)&&(Object.prototype.hasOwnProperty.call(G,fe)?S(G[fe],K[fe])||(G[fe].type==="geojson"&&K[fe].type==="geojson"&&vt(G,K,fe)?ie.push({command:Ie.setGeoJSONSourceData,args:[fe,K[fe].data]}):je(fe,K,ie,me)):dt(fe,K,ie))})(y.sources,x.sources,O,R);const V=[];y.layers&&y.layers.forEach(G=>{R[G.source]?I.push({command:Ie.removeLayer,args:[G.id]}):V.push(G)}),I=I.concat(O),function(G,K,ie){K=K||[];const me=(G=G||[]).map(St),fe=K.map(St),de=G.reduce(Wt,{}),ze=K.reduce(Wt,{}),De=me.slice(),Ve=Object.create(null);let xe,Ye,Ze,st,lt,yt,at;for(xe=0,Ye=0;xe!(y.command in Qr));if(u.length===0)return!1;const p=u.filter(y=>!(y.command in Tr));if(p.length>0)throw new Error(`Unimplemented: ${p.map(y=>y.command).join(", ")}.`);return u.forEach(y=>{y.command!=="setTransition"&&this[y.command].apply(this,y.args)}),this.stylesheet=t,!0}addImage(t,u){if(this.getImage(t))return this.fire(new n.ErrorEvent(new Error(`An image named "${t}" already exists.`)));this.imageManager.addImage(t,u),this._afterImageUpdated(t)}updateImage(t,u){this.imageManager.updateImage(t,u)}getImage(t){return this.imageManager.getImage(t)}removeImage(t){if(!this.getImage(t))return this.fire(new n.ErrorEvent(new Error(`An image named "${t}" does not exist.`)));this.imageManager.removeImage(t),this._afterImageUpdated(t)}_afterImageUpdated(t){this._availableImages=this.imageManager.listImages(),this._changedImages[t]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new n.Event("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(t,u,p={}){if(this._checkLoaded(),this.sourceCaches[t]!==void 0)throw new Error(`Source "${t}" already exists.`);if(!u.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(u).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(u.type)>=0&&this._validate(n.validateStyle.source,`sources.${t}`,u,null,p))return;this.map&&this.map._collectResourceTiming&&(u.collectResourceTiming=!0);const y=this.sourceCaches[t]=new Xe(t,u,this.dispatcher);y.style=this,y.setEventedParent(this,()=>({isSourceLoaded:this.loaded(),source:y.serialize(),sourceId:t})),y.onAdd(this.map),this._changed=!0}removeSource(t){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error("There is no source with this ID");for(const p in this._layers)if(this._layers[p].source===t)return this.fire(new n.ErrorEvent(new Error(`Source "${t}" cannot be removed while layer "${p}" is using it.`)));const u=this.sourceCaches[t];delete this.sourceCaches[t],delete this._updatedSources[t],u.fire(new n.Event("data",{sourceDataType:"metadata",dataType:"source",sourceId:t})),u.setEventedParent(null),u.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(t,u){if(this._checkLoaded(),this.sourceCaches[t]===void 0)throw new Error(`There is no source with this ID=${t}`);const p=this.sourceCaches[t].getSource();if(p.type!=="geojson")throw new Error(`geojsonSource.type is ${p.type}, which is !== 'geojson`);p.setData(u),this._changed=!0}getSource(t){return this.sourceCaches[t]&&this.sourceCaches[t].getSource()}addLayer(t,u,p={}){this._checkLoaded();const y=t.id;if(this.getLayer(y))return void this.fire(new n.ErrorEvent(new Error(`Layer "${y}" already exists on this map.`)));let x;if(t.type==="custom"){if(dr(this,n.validateCustomStyleLayer(t)))return;x=n.createStyleLayer(t)}else{if(typeof t.source=="object"&&(this.addSource(y,t.source),t=n.clone$1(t),t=n.extend(t,{source:y})),this._validate(n.validateStyle.layer,`layers.${y}`,t,{arrayIndex:-1},p))return;x=n.createStyleLayer(t),this._validateLayer(x),x.setEventedParent(this,{layer:{id:y}}),this._serializedLayers[x.id]=x.serialize()}const I=u?this._order.indexOf(u):this._order.length;if(u&&I===-1)this.fire(new n.ErrorEvent(new Error(`Cannot add layer "${y}" before non-existing layer "${u}".`)));else{if(this._order.splice(I,0,y),this._layerOrderChanged=!0,this._layers[y]=x,this._removedLayers[y]&&x.source&&x.type!=="custom"){const R=this._removedLayers[y];delete this._removedLayers[y],R.type!==x.type?this._updatedSources[x.source]="clear":(this._updatedSources[x.source]="reload",this.sourceCaches[x.source].pause())}this._updateLayer(x),x.onAdd&&x.onAdd(this.map)}}moveLayer(t,u){if(this._checkLoaded(),this._changed=!0,!this._layers[t])return void this.fire(new n.ErrorEvent(new Error(`The layer '${t}' does not exist in the map's style and cannot be moved.`)));if(t===u)return;const p=this._order.indexOf(t);this._order.splice(p,1);const y=u?this._order.indexOf(u):this._order.length;u&&y===-1?this.fire(new n.ErrorEvent(new Error(`Cannot move layer "${t}" before non-existing layer "${u}".`))):(this._order.splice(y,0,t),this._layerOrderChanged=!0)}removeLayer(t){this._checkLoaded();const u=this._layers[t];if(!u)return void this.fire(new n.ErrorEvent(new Error(`Cannot remove non-existing layer "${t}".`)));u.setEventedParent(null);const p=this._order.indexOf(t);this._order.splice(p,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[t]=u,delete this._layers[t],delete this._serializedLayers[t],delete this._updatedLayers[t],delete this._updatedPaintProps[t],u.onRemove&&u.onRemove(this.map)}getLayer(t){return this._layers[t]}hasLayer(t){return t in this._layers}setLayerZoomRange(t,u,p){this._checkLoaded();const y=this.getLayer(t);y?y.minzoom===u&&y.maxzoom===p||(u!=null&&(y.minzoom=u),p!=null&&(y.maxzoom=p),this._updateLayer(y)):this.fire(new n.ErrorEvent(new Error(`Cannot set the zoom range of non-existing layer "${t}".`)))}setFilter(t,u,p={}){this._checkLoaded();const y=this.getLayer(t);if(y){if(!S(y.filter,u))return u==null?(y.filter=void 0,void this._updateLayer(y)):void(this._validate(n.validateStyle.filter,`layers.${y.id}.filter`,u,null,p)||(y.filter=n.clone$1(u),this._updateLayer(y)))}else this.fire(new n.ErrorEvent(new Error(`Cannot filter non-existing layer "${t}".`)))}getFilter(t){return n.clone$1(this.getLayer(t).filter)}setLayoutProperty(t,u,p,y={}){this._checkLoaded();const x=this.getLayer(t);x?S(x.getLayoutProperty(u),p)||(x.setLayoutProperty(u,p,y),this._updateLayer(x)):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getLayoutProperty(t,u){const p=this.getLayer(t);if(p)return p.getLayoutProperty(u);this.fire(new n.ErrorEvent(new Error(`Cannot get style of non-existing layer "${t}".`)))}setPaintProperty(t,u,p,y={}){this._checkLoaded();const x=this.getLayer(t);x?S(x.getPaintProperty(u),p)||(x.setPaintProperty(u,p,y)&&this._updateLayer(x),this._changed=!0,this._updatedPaintProps[t]=!0):this.fire(new n.ErrorEvent(new Error(`Cannot style non-existing layer "${t}".`)))}getPaintProperty(t,u){return this.getLayer(t).getPaintProperty(u)}setFeatureState(t,u){this._checkLoaded();const p=t.source,y=t.sourceLayer,x=this.sourceCaches[p];if(x===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${p}' does not exist in the map's style.`)));const I=x.getSource().type;I==="geojson"&&y?this.fire(new n.ErrorEvent(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):I!=="vector"||y?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),x.setFeatureState(y,t.id,u)):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(t,u){this._checkLoaded();const p=t.source,y=this.sourceCaches[p];if(y===void 0)return void this.fire(new n.ErrorEvent(new Error(`The source '${p}' does not exist in the map's style.`)));const x=y.getSource().type,I=x==="vector"?t.sourceLayer:void 0;x!=="vector"||I?u&&typeof t.id!="string"&&typeof t.id!="number"?this.fire(new n.ErrorEvent(new Error("A feature id is required to remove its specific state property."))):y.removeFeatureState(I,t.id,u):this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(t){this._checkLoaded();const u=t.source,p=t.sourceLayer,y=this.sourceCaches[u];if(y!==void 0)return y.getSource().type!=="vector"||p?(t.id===void 0&&this.fire(new n.ErrorEvent(new Error("The feature id parameter must be provided."))),y.getFeatureState(p,t.id)):void this.fire(new n.ErrorEvent(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new n.ErrorEvent(new Error(`The source '${u}' does not exist in the map's style.`)))}getTransition(){return n.extend({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){return n.filterObject({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,light:this.stylesheet.light,center:this.stylesheet.center,zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,sources:n.mapObject(this.sourceCaches,t=>t.serialize()),layers:this._serializeLayers(this._order)},t=>t!==void 0)}_updateLayer(t){this._updatedLayers[t.id]=!0,t.source&&!this._updatedSources[t.source]&&this.sourceCaches[t.source].getSource().type!=="raster"&&(this._updatedSources[t.source]="reload",this.sourceCaches[t.source].pause()),this._changed=!0}_flattenAndSortRenderedFeatures(t){const u=I=>this._layers[I].type==="fill-extrusion",p={},y=[];for(let I=this._order.length-1;I>=0;I--){const R=this._order[I];if(u(R)){p[R]=I;for(const O of t){const V=O[R];if(V)for(const G of V)y.push(G)}}}y.sort((I,R)=>R.intersectionZ-I.intersectionZ);const x=[];for(let I=this._order.length-1;I>=0;I--){const R=this._order[I];if(u(R))for(let O=y.length-1;O>=0;O--){const V=y[O].feature;if(p[V.layer.id]{const lt=ze.featureSortOrder;if(lt){const yt=lt.indexOf(Ze.featureIndex);return lt.indexOf(st.featureIndex)-yt}return st.featureIndex-Ze.featureIndex});for(const Ze of Ye)xe.push(Ze)}}for(const ze in me)me[ze].forEach(De=>{const Ve=De.feature,xe=O[I[ze].source].getFeatureState(Ve.layer["source-layer"],Ve.id);Ve.source=Ve.layer.source,Ve.layer["source-layer"]&&(Ve.sourceLayer=Ve.layer["source-layer"]),Ve.state=xe});return me}(this._layers,this._serializedLayers,this.sourceCaches,t,u,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(x)}querySourceFeatures(t,u){u&&u.filter&&this._validate(n.validateStyle.filter,"querySourceFeatures.filter",u.filter,null,u);const p=this.sourceCaches[t];return p?function(y,x){const I=y.getRenderableIds().map(V=>y.getTileByID(V)),R=[],O={};for(let V=0;Vie.getTileByID(me)).sort((me,fe)=>fe.tileID.overscaledZ-me.tileID.overscaledZ||(me.tileID.isLessThan(fe.tileID)?-1:1))}const K=this.crossTileSymbolIndex.addLayer(G,O[G.source],t.center.lng);I=I||K}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((x=x||this._layerOrderChanged||p===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(n.exported.now(),t.zoom))&&(this.pauseablePlacement=new Re(t,this.terrain,this._order,x,u,p,y,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,O),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(n.exported.now()),R=!0),I&&this.pauseablePlacement.placement.setStale()),R||I)for(const V of this._order){const G=this._layers[V];G.type==="symbol"&&this.placement.updateLayerOpacities(G,O[G.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(n.exported.now())}_releaseSymbolFadeTiles(){for(const t in this.sourceCaches)this.sourceCaches[t].releaseSymbolFadeTiles()}getImages(t,u,p){this.imageManager.getImages(u.icons,p),this._updateTilesForChangedImages();const y=this.sourceCaches[u.source];y&&y.setDependencies(u.tileID.key,u.type,u.icons)}getGlyphs(t,u,p){this.glyphManager.getGlyphs(u.stacks,p)}getResource(t,u,p){return n.makeRequest(u,p)}}fi.getSourceType=function(g){return ge[g]},fi.setSourceType=function(g,t){ge[g]=t},fi.registerForPluginStateChange=n.registerForPluginStateChange;var jn="attribute vec2 a_pos;uniform mat4 u_matrix;varying vec2 v_texture_pos;varying float v_depth;void main() {v_texture_pos=a_pos/8192.0;gl_Position=u_matrix*vec4(a_pos,get_elevation(a_pos),1.0);v_depth=gl_Position.z/gl_Position.w;}";const sa={prelude:Br(`#ifdef GL_ES precision mediump float; #else #if !defined(lowp) @@ -1000,14 +991,14 @@ uniform ${G} ${K} u_${ie}; #else ${G} ${K} ${ie} = u_${ie}; #endif -`}),staticAttributes:p,staticUniforms:I}}class os{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,u,p,y,x,I,R,O,V){this.context=t;let G=this.boundPaintVertexBuffers.length!==y.length;for(let K=0;!G&&K({u_depth:new n.Uniform1i(lt,yt.u_depth),u_terrain:new n.Uniform1i(lt,yt.u_terrain),u_terrain_dim:new n.Uniform1f(lt,yt.u_terrain_dim),u_terrain_matrix:new n.UniformMatrix4f(lt,yt.u_terrain_matrix),u_terrain_unpack:new n.Uniform4f(lt,yt.u_terrain_unpack),u_terrain_offset:new n.Uniform1f(lt,yt.u_terrain_offset),u_terrain_exaggeration:new n.Uniform1f(lt,yt.u_terrain_exaggeration)}))(t,at),this.binderUniforms=y?y.getUniforms(t,at):[]}draw(t,u,p,y,x,I,R,O,V,G,K,ie,me,fe,de,ze,De,Ve){const xe=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(p),t.setStencilMode(y),t.setColorMode(x),t.setCullFace(I),O){t.activeTexture.set(xe.TEXTURE2),xe.bindTexture(xe.TEXTURE_2D,O.depthTexture),t.activeTexture.set(xe.TEXTURE3),xe.bindTexture(xe.TEXTURE_2D,O.texture);for(const Ze in this.terrainUniforms)this.terrainUniforms[Ze].set(O[Ze])}for(const Ze in this.fixedUniforms)this.fixedUniforms[Ze].set(R[Ze]);de&&de.setUniforms(t,this.binderUniforms,me,{zoom:fe});let Ye=0;switch(u){case xe.LINES:Ye=2;break;case xe.TRIANGLES:Ye=3;break;case xe.LINE_STRIP:Ye=1}for(const Ze of ie.get()){const at=Ze.vaos||(Ze.vaos={});(at[V]||(at[V]=new os)).bind(t,this,G,de?de.getPaintVertexBuffers():[],K,Ze.vertexOffset,ze,De,Ve),xe.drawElements(u,Ze.primitiveLength*Ye,xe.UNSIGNED_SHORT,Ze.primitiveOffset*Ye*2)}}}function ha(g,t,u){const p=1/ui(u,1,t.transform.tileZoom),y=Math.pow(2,u.tileID.overscaledZ),x=u.tileSize*Math.pow(2,t.transform.tileZoom)/y,I=x*(u.tileID.canonical.x+u.tileID.wrap*y),R=x*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[p,g.fromScale,g.toScale],u_fade:g.t,u_pixel_coord_upper:[I>>16,R>>16],u_pixel_coord_lower:[65535&I,65535&R]}}const qn=(g,t,u,p)=>{const y=t.style.light,x=y.properties.get("position"),I=[x.x,x.y,x.z],R=n.create$1();y.properties.get("anchor")==="viewport"&&n.fromRotation(R,-t.transform.angle),n.transformMat3(I,I,R);const O=y.properties.get("color");return{u_matrix:g,u_lightpos:I,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[O.r,O.g,O.b],u_vertical_gradient:+u,u_opacity:p}},Wu=(g,t,u,p,y,x,I)=>n.extend(qn(g,t,u,p),ha(x,t,I),{u_height_factor:-Math.pow(2,y.overscaledZ)/I.tileSize/8}),Xa=g=>({u_matrix:g}),Ho=(g,t,u,p)=>n.extend(Xa(g),ha(u,t,p)),hc=(g,t)=>({u_matrix:g,u_world:t}),fc=(g,t,u,p,y)=>n.extend(Ho(g,t,u,p),{u_world:y}),dc=(g,t,u,p)=>{const y=g.transform;let x,I;if(p.paint.get("circle-pitch-alignment")==="map"){const R=ui(u,1,y.zoom);x=!0,I=[R,R]}else x=!1,I=y.pixelsToGLUnits;return{u_camera_to_center_distance:y.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:g.translatePosMatrix(t.posMatrix,u,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:g.pixelRatio,u_extrude_scale:I}},ws=(g,t,u)=>{const p=ui(u,1,t.zoom),y=Math.pow(2,t.zoom-u.tileID.overscaledZ),x=u.tileID.overscaleFactor();return{u_matrix:g,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:p,u_extrude_scale:[t.pixelsToGLUnits[0]/(p*y),t.pixelsToGLUnits[1]/(p*y)],u_overscale_factor:x}},fa=(g,t,u=1)=>({u_matrix:g,u_color:t,u_overlay:0,u_overlay_scale:u}),Us=g=>({u_matrix:g}),Ja=(g,t,u,p)=>({u_matrix:g,u_extrude_scale:ui(t,1,u),u_intensity:p});function Ya(g,t){const u=Math.pow(2,t.canonical.z),p=t.canonical.y;return[new n.MercatorCoordinate(0,p/u).toLngLat().lat,new n.MercatorCoordinate(0,(p+1)/u).toLngLat().lat]}const Vs=(g,t,u,p)=>{const y=g.transform;return{u_matrix:pa(g,t,u,p),u_ratio:1/ui(t,1,y.zoom),u_device_pixel_ratio:g.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Wo=(g,t,u,p,y)=>n.extend(Vs(g,t,u,y),{u_image:0,u_image_height:p}),Qa=(g,t,u,p,y)=>{const x=g.transform,I=ni(t,x);return{u_matrix:pa(g,t,u,y),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ui(t,1,x.zoom),u_device_pixel_ratio:g.pixelRatio,u_image:0,u_scale:[I,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},da=(g,t,u,p,y,x)=>{const I=g.lineAtlas,R=ni(t,g.transform),O=u.layout.get("line-cap")==="round",V=I.getDash(p.from,O),G=I.getDash(p.to,O),K=V.width*y.fromScale,ie=G.width*y.toScale;return n.extend(Vs(g,t,u,x),{u_patternscale_a:[R/K,-V.height/2],u_patternscale_b:[R/ie,-G.height/2],u_sdfgamma:I.width/(256*Math.min(K,ie)*g.pixelRatio)/2,u_image:0,u_tex_y_a:V.y,u_tex_y_b:G.y,u_mix:y.t})};function ni(g,t){return 1/ui(g,1,t.tileZoom)}function pa(g,t,u,p){return g.translatePosMatrix(p?p.posMatrix:t.tileID.posMatrix,t,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const pc=(g,t,u,p,y)=>{return{u_matrix:g,u_tl_parent:t,u_scale_parent:u,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(I=y.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(x=y.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:mc(y.paint.get("raster-hue-rotate"))};var x,I};function mc(g){g*=Math.PI/180;const t=Math.sin(g),u=Math.cos(g);return[(2*u+1)/3,(-Math.sqrt(3)*t-u+1)/3,(Math.sqrt(3)*t-u+1)/3]}const Ko=(g,t,u,p,y,x,I,R,O,V)=>{const G=y.transform;return{u_is_size_zoom_constant:+(g==="constant"||g==="source"),u_is_size_feature_constant:+(g==="constant"||g==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_pitch:G.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:G.width/G.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_matrix:x,u_label_plane_matrix:I,u_coord_matrix:R,u_is_text:+O,u_pitch_with_map:+p,u_texsize:V,u_texture:0}},eo=(g,t,u,p,y,x,I,R,O,V,G)=>{const K=y.transform;return n.extend(Ko(g,t,u,p,y,x,I,R,O,V),{u_gamma_scale:p?Math.cos(K._pitch)*K.cameraToCenterDistance:1,u_device_pixel_ratio:y.pixelRatio,u_is_halo:+G})},gc=(g,t,u,p,y,x,I,R,O,V)=>n.extend(eo(g,t,u,p,y,x,I,R,!0,O,!0),{u_texsize_icon:V,u_texture_icon:1}),Ku=(g,t,u)=>({u_matrix:g,u_opacity:t,u_color:u}),Xu=(g,t,u,p,y,x)=>n.extend(function(I,R,O,V){const G=O.imageManager.getPattern(I.from.toString()),K=O.imageManager.getPattern(I.to.toString()),{width:ie,height:me}=O.imageManager.getPixelSize(),fe=Math.pow(2,V.tileID.overscaledZ),de=V.tileSize*Math.pow(2,O.transform.tileZoom)/fe,ze=de*(V.tileID.canonical.x+V.tileID.wrap*fe),De=de*V.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:G.tl,u_pattern_br_a:G.br,u_pattern_tl_b:K.tl,u_pattern_br_b:K.br,u_texsize:[ie,me],u_mix:R.t,u_pattern_size_a:G.displaySize,u_pattern_size_b:K.displaySize,u_scale_a:R.fromScale,u_scale_b:R.toScale,u_tile_units_to_pixels:1/ui(V,1,O.transform.tileZoom),u_pixel_coord_upper:[ze>>16,De>>16],u_pixel_coord_lower:[65535&ze,65535&De]}}(p,x,u,y),{u_matrix:g,u_opacity:t}),Xo={fillExtrusion:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_lightpos:new n.Uniform3f(g,t.u_lightpos),u_lightintensity:new n.Uniform1f(g,t.u_lightintensity),u_lightcolor:new n.Uniform3f(g,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(g,t.u_vertical_gradient),u_opacity:new n.Uniform1f(g,t.u_opacity)}),fillExtrusionPattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_lightpos:new n.Uniform3f(g,t.u_lightpos),u_lightintensity:new n.Uniform1f(g,t.u_lightintensity),u_lightcolor:new n.Uniform3f(g,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(g,t.u_vertical_gradient),u_height_factor:new n.Uniform1f(g,t.u_height_factor),u_image:new n.Uniform1i(g,t.u_image),u_texsize:new n.Uniform2f(g,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade),u_opacity:new n.Uniform1f(g,t.u_opacity)}),fill:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),fillPattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_image:new n.Uniform1i(g,t.u_image),u_texsize:new n.Uniform2f(g,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade)}),fillOutline:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_world:new n.Uniform2f(g,t.u_world)}),fillOutlinePattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_world:new n.Uniform2f(g,t.u_world),u_image:new n.Uniform1i(g,t.u_image),u_texsize:new n.Uniform2f(g,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade)}),circle:(g,t)=>({u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_scale_with_map:new n.Uniform1i(g,t.u_scale_with_map),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_extrude_scale:new n.Uniform2f(g,t.u_extrude_scale),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),collisionBox:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pixels_to_tile_units:new n.Uniform1f(g,t.u_pixels_to_tile_units),u_extrude_scale:new n.Uniform2f(g,t.u_extrude_scale),u_overscale_factor:new n.Uniform1f(g,t.u_overscale_factor)}),collisionCircle:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_inv_matrix:new n.UniformMatrix4f(g,t.u_inv_matrix),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_viewport_size:new n.Uniform2f(g,t.u_viewport_size)}),debug:(g,t)=>({u_color:new n.UniformColor(g,t.u_color),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_overlay:new n.Uniform1i(g,t.u_overlay),u_overlay_scale:new n.Uniform1f(g,t.u_overlay_scale)}),clippingMask:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),heatmap:(g,t)=>({u_extrude_scale:new n.Uniform1f(g,t.u_extrude_scale),u_intensity:new n.Uniform1f(g,t.u_intensity),u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),heatmapTexture:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_world:new n.Uniform2f(g,t.u_world),u_image:new n.Uniform1i(g,t.u_image),u_color_ramp:new n.Uniform1i(g,t.u_color_ramp),u_opacity:new n.Uniform1f(g,t.u_opacity)}),hillshade:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_image:new n.Uniform1i(g,t.u_image),u_latrange:new n.Uniform2f(g,t.u_latrange),u_light:new n.Uniform2f(g,t.u_light),u_shadow:new n.UniformColor(g,t.u_shadow),u_highlight:new n.UniformColor(g,t.u_highlight),u_accent:new n.UniformColor(g,t.u_accent)}),hillshadePrepare:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_image:new n.Uniform1i(g,t.u_image),u_dimension:new n.Uniform2f(g,t.u_dimension),u_zoom:new n.Uniform1f(g,t.u_zoom),u_unpack:new n.Uniform4f(g,t.u_unpack)}),line:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels)}),lineGradient:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels),u_image:new n.Uniform1i(g,t.u_image),u_image_height:new n.Uniform1f(g,t.u_image_height)}),linePattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_texsize:new n.Uniform2f(g,t.u_texsize),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_image:new n.Uniform1i(g,t.u_image),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade)}),lineSDF:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels),u_patternscale_a:new n.Uniform2f(g,t.u_patternscale_a),u_patternscale_b:new n.Uniform2f(g,t.u_patternscale_b),u_sdfgamma:new n.Uniform1f(g,t.u_sdfgamma),u_image:new n.Uniform1i(g,t.u_image),u_tex_y_a:new n.Uniform1f(g,t.u_tex_y_a),u_tex_y_b:new n.Uniform1f(g,t.u_tex_y_b),u_mix:new n.Uniform1f(g,t.u_mix)}),raster:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_tl_parent:new n.Uniform2f(g,t.u_tl_parent),u_scale_parent:new n.Uniform1f(g,t.u_scale_parent),u_buffer_scale:new n.Uniform1f(g,t.u_buffer_scale),u_fade_t:new n.Uniform1f(g,t.u_fade_t),u_opacity:new n.Uniform1f(g,t.u_opacity),u_image0:new n.Uniform1i(g,t.u_image0),u_image1:new n.Uniform1i(g,t.u_image1),u_brightness_low:new n.Uniform1f(g,t.u_brightness_low),u_brightness_high:new n.Uniform1f(g,t.u_brightness_high),u_saturation_factor:new n.Uniform1f(g,t.u_saturation_factor),u_contrast_factor:new n.Uniform1f(g,t.u_contrast_factor),u_spin_weights:new n.Uniform3f(g,t.u_spin_weights)}),symbolIcon:(g,t)=>({u_is_size_zoom_constant:new n.Uniform1i(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(g,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(g,t.u_size_t),u_size:new n.Uniform1f(g,t.u_size),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(g,t.u_pitch),u_rotate_symbol:new n.Uniform1i(g,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(g,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(g,t.u_fade_change),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(g,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(g,t.u_coord_matrix),u_is_text:new n.Uniform1i(g,t.u_is_text),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_texsize:new n.Uniform2f(g,t.u_texsize),u_texture:new n.Uniform1i(g,t.u_texture)}),symbolSDF:(g,t)=>({u_is_size_zoom_constant:new n.Uniform1i(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(g,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(g,t.u_size_t),u_size:new n.Uniform1f(g,t.u_size),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(g,t.u_pitch),u_rotate_symbol:new n.Uniform1i(g,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(g,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(g,t.u_fade_change),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(g,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(g,t.u_coord_matrix),u_is_text:new n.Uniform1i(g,t.u_is_text),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_texsize:new n.Uniform2f(g,t.u_texsize),u_texture:new n.Uniform1i(g,t.u_texture),u_gamma_scale:new n.Uniform1f(g,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(g,t.u_is_halo)}),symbolTextAndIcon:(g,t)=>({u_is_size_zoom_constant:new n.Uniform1i(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(g,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(g,t.u_size_t),u_size:new n.Uniform1f(g,t.u_size),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(g,t.u_pitch),u_rotate_symbol:new n.Uniform1i(g,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(g,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(g,t.u_fade_change),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(g,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(g,t.u_coord_matrix),u_is_text:new n.Uniform1i(g,t.u_is_text),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_texsize:new n.Uniform2f(g,t.u_texsize),u_texsize_icon:new n.Uniform2f(g,t.u_texsize_icon),u_texture:new n.Uniform1i(g,t.u_texture),u_texture_icon:new n.Uniform1i(g,t.u_texture_icon),u_gamma_scale:new n.Uniform1f(g,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(g,t.u_is_halo)}),background:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_opacity:new n.Uniform1f(g,t.u_opacity),u_color:new n.UniformColor(g,t.u_color)}),backgroundPattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_opacity:new n.Uniform1f(g,t.u_opacity),u_image:new n.Uniform1i(g,t.u_image),u_pattern_tl_a:new n.Uniform2f(g,t.u_pattern_tl_a),u_pattern_br_a:new n.Uniform2f(g,t.u_pattern_br_a),u_pattern_tl_b:new n.Uniform2f(g,t.u_pattern_tl_b),u_pattern_br_b:new n.Uniform2f(g,t.u_pattern_br_b),u_texsize:new n.Uniform2f(g,t.u_texsize),u_mix:new n.Uniform1f(g,t.u_mix),u_pattern_size_a:new n.Uniform2f(g,t.u_pattern_size_a),u_pattern_size_b:new n.Uniform2f(g,t.u_pattern_size_b),u_scale_a:new n.Uniform1f(g,t.u_scale_a),u_scale_b:new n.Uniform1f(g,t.u_scale_b),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_tile_units_to_pixels:new n.Uniform1f(g,t.u_tile_units_to_pixels)}),terrain:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_texture:new n.Uniform1i(g,t.u_texture)}),terrainDepth:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),terrainCoords:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_texture:new n.Uniform1i(g,t.u_texture),u_terrain_coords_id:new n.Uniform1f(g,t.u_terrain_coords_id)})};class Jo{constructor(t,u,p){this.context=t;const y=t.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),y.bufferData(y.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Yo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Qo{constructor(t,u,p,y){this.length=u.length,this.attributes=p,this.itemSize=u.bytesPerElement,this.dynamicDraw=y,this.context=t;const x=t.gl;this.buffer=x.createBuffer(),t.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,u){for(let p=0;p0){const Vt=n.create(),Dt=lt;n.mul(Vt,at.placementInvProjMatrix,g.transform.glCoordMatrix),n.mul(Vt,Vt,at.placementViewportMatrix),G.push({circleArray:st,circleOffset:ie,transform:Dt,invTransform:Vt,coord:Ye}),K+=st.length/4,ie=K}yt&&V.draw(R,O.LINES,Cr.disabled,Yr.disabled,g.colorModeForRenderPass(),si.disabled,ws(lt,g.transform,Ze),g.style.terrain&&g.style.terrain.getTerrainData(Ye),u.id,yt.layoutVertexBuffer,yt.indexBuffer,yt.segments,null,g.transform.zoom,null,null,yt.collisionVertexBuffer)}if(!I||!G.length)return;const me=g.useProgram("collisionCircle"),fe=new n.CollisionCircleLayoutArray;fe.resize(4*K),fe._trim();let de=0;for(const xe of G)for(let Ye=0;Ye=0&&(fe[ze.associatedIconIndex]={shiftedAnchor:gr,angle:br})}else ar(ze.numGlyphs,ie)}if(V){me.clear();const de=g.icon.placedSymbolArray;for(let ze=0;zeg.style.terrain.getElevation(yt,wl,Js):null,Is=u.layout.get("text-rotation-alignment")==="map";Ei(Vt,yt.posMatrix,g,y,yn,Yi,ze,V,Is,vn)}const ki=g.translatePosMatrix(yt.posMatrix,st,x,I),Er=De||y&&at||go?nh:yn,$r=g.translatePosMatrix(Yi,st,x,I,!0),Ai=gr&&u.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Pi;Pi=gr?Vt.iconsInText?gc(br.kind,Gr,Ve,ze,g,ki,Er,$r,Pr,kn):eo(br.kind,Gr,Ve,ze,g,ki,Er,$r,y,Pr,!0):Ko(br.kind,Gr,Ve,ze,g,ki,Er,$r,y,Pr);const oi={program:qr,buffers:Dt,uniformValues:Pi,atlasTexture:Hr,atlasTextureIcon:Ln,atlasInterpolation:Ci,atlasInterpolationIcon:Rn,isSDF:gr,hasHalo:Ai};if(xe&&Vt.canOverlap){Ye=!0;const vn=Dt.segments.get();for(const Is of vn)lt.push({segments:new n.SegmentVector([Is]),sortKey:Is.sortKey,state:oi,terrainData:Ar})}else lt.push({segments:Dt.segments,sortKey:0,state:oi,terrainData:Ar})}Ye&<.sort((yt,st)=>yt.sortKey-st.sortKey);for(const yt of lt){const st=yt.state;if(ie.activeTexture.set(me.TEXTURE0),st.atlasTexture.bind(st.atlasInterpolation,me.CLAMP_TO_EDGE),st.atlasTextureIcon&&(ie.activeTexture.set(me.TEXTURE1),st.atlasTextureIcon&&st.atlasTextureIcon.bind(st.atlasInterpolationIcon,me.CLAMP_TO_EDGE)),st.isSDF){const Vt=st.uniformValues;st.hasHalo&&(Vt.u_is_halo=1,ya(st.buffers,yt.segments,u,g,st.program,Ze,G,K,Vt,yt.terrainData)),Vt.u_is_halo=0}ya(st.buffers,yt.segments,u,g,st.program,Ze,G,K,st.uniformValues,yt.terrainData)}}function ya(g,t,u,p,y,x,I,R,O,V){const G=p.context;y.draw(G,G.gl.TRIANGLES,x,I,R,si.disabled,O,V,u.id,g.layoutVertexBuffer,g.indexBuffer,t,u.paint,p.transform.zoom,g.programConfigurations.get(u.id),g.dynamicLayoutVertexBuffer,g.opacityVertexBuffer)}function va(g,t,u,p,y,x,I){const R=g.context.gl,O=u.paint.get("fill-pattern"),V=O&&O.constantOr(1),G=u.getCrossfadeParameters();let K,ie,me,fe,de;I?(ie=V&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",K=R.LINES):(ie=V?"fillPattern":"fill",K=R.TRIANGLES);for(const ze of p){const De=t.getTile(ze);if(V&&!De.patternsLoaded())continue;const Ve=De.getBucket(u);if(!Ve)continue;const xe=Ve.programConfigurations.get(u.id),Ye=g.useProgram(ie,xe),Ze=g.style.terrain&&g.style.terrain.getTerrainData(ze);V&&(g.context.activeTexture.set(R.TEXTURE0),De.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),xe.updatePaintBuffers(G));const at=O.constantOr(null);if(at&&De.imageAtlas){const st=De.imageAtlas,Vt=st.patternPositions[at.to.toString()],Dt=st.patternPositions[at.from.toString()];Vt&&Dt&&xe.setConstantPatternPositions(Vt,Dt)}const lt=Ze?ze:null,yt=g.translatePosMatrix(lt?lt.posMatrix:ze.posMatrix,De,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(I){fe=Ve.indexBuffer2,de=Ve.segments2;const st=[R.drawingBufferWidth,R.drawingBufferHeight];me=ie==="fillOutlinePattern"&&V?fc(yt,g,G,De,st):hc(yt,st)}else fe=Ve.indexBuffer,de=Ve.segments,me=V?Ho(yt,g,G,De):Xa(yt);Ye.draw(g.context,K,y,g.stencilModeForClipping(ze),x,si.disabled,me,Ze,u.id,Ve.layoutVertexBuffer,fe,de,u.paint,g.transform.zoom,xe)}}function ba(g,t,u,p,y,x,I){const R=g.context,O=R.gl,V=u.paint.get("fill-extrusion-pattern"),G=V.constantOr(1),K=u.getCrossfadeParameters(),ie=u.paint.get("fill-extrusion-opacity");for(const me of p){const fe=t.getTile(me),de=fe.getBucket(u);if(!de)continue;const ze=g.style.terrain&&g.style.terrain.getTerrainData(me),De=de.programConfigurations.get(u.id),Ve=g.useProgram(G?"fillExtrusionPattern":"fillExtrusion",De);G&&(g.context.activeTexture.set(O.TEXTURE0),fe.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),De.updatePaintBuffers(K));const xe=V.constantOr(null);if(xe&&fe.imageAtlas){const lt=fe.imageAtlas,yt=lt.patternPositions[xe.to.toString()],st=lt.patternPositions[xe.from.toString()];yt&&st&&De.setConstantPatternPositions(yt,st)}const Ye=g.translatePosMatrix(me.posMatrix,fe,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),Ze=u.paint.get("fill-extrusion-vertical-gradient"),at=G?Wu(Ye,g,Ze,ie,me,K,fe):qn(Ye,g,Ze,ie);Ve.draw(R,R.gl.TRIANGLES,y,x,I,si.backCCW,at,ze,u.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,u.paint,g.transform.zoom,De,g.style.terrain&&de.centroidVertexBuffer)}}function ll(g,t,u,p,y,x,I){const R=g.context,O=R.gl,V=u.fbo;if(!V)return;const G=g.useProgram("hillshade"),K=g.style.terrain&&g.style.terrain.getTerrainData(t);R.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,V.colorAttachment.get()),G.draw(R,O.TRIANGLES,y,x,I,si.disabled,((ie,me,fe,de)=>{const ze=fe.paint.get("hillshade-shadow-color"),De=fe.paint.get("hillshade-highlight-color"),Ve=fe.paint.get("hillshade-accent-color");let xe=fe.paint.get("hillshade-illumination-direction")*(Math.PI/180);fe.paint.get("hillshade-illumination-anchor")==="viewport"&&(xe-=ie.transform.angle);const Ye=!ie.options.moving;return{u_matrix:de?de.posMatrix:ie.transform.calculatePosMatrix(me.tileID.toUnwrapped(),Ye),u_image:0,u_latrange:Ya(0,me.tileID),u_light:[fe.paint.get("hillshade-exaggeration"),xe],u_shadow:ze,u_highlight:De,u_accent:Ve}})(g,u,p,K?t:null),K,p.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments)}function Tc(g,t,u,p,y,x){const I=g.context,R=I.gl,O=t.dem;if(O&&O.data){const V=O.dim,G=O.stride,K=O.getPixels();if(I.activeTexture.set(R.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||g.getTileTexture(G),t.demTexture){const me=t.demTexture;me.update(K,{premultiply:!1}),me.bind(R.NEAREST,R.CLAMP_TO_EDGE)}else t.demTexture=new T(I,K,R.RGBA,{premultiply:!1}),t.demTexture.bind(R.NEAREST,R.CLAMP_TO_EDGE);I.activeTexture.set(R.TEXTURE0);let ie=t.fbo;if(!ie){const me=new T(I,{width:V,height:V,data:null},R.RGBA);me.bind(R.LINEAR,R.CLAMP_TO_EDGE),ie=t.fbo=I.createFramebuffer(V,V,!0),ie.colorAttachment.set(me.texture)}I.bindFramebuffer.set(ie.framebuffer),I.viewport.set([0,0,V,V]),g.useProgram("hillshadePrepare").draw(I,R.TRIANGLES,p,y,x,si.disabled,((me,fe)=>{const de=fe.stride,ze=n.create();return n.ortho(ze,0,n.EXTENT,-n.EXTENT,0,0,1),n.translate(ze,ze,[0,-n.EXTENT,0]),{u_matrix:ze,u_image:1,u_dimension:[de,de],u_zoom:me.overscaledZ,u_unpack:fe.getUnpackVector()}})(t.tileID,O),null,u.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function lo(g,t,u,p,y,x){const I=p.paint.get("raster-fade-duration");if(!x&&I>0){const R=n.exported.now(),O=(R-g.timeAdded)/I,V=t?(R-t.timeAdded)/I:-1,G=u.getSource(),K=y.coveringZoomLevel({tileSize:G.tileSize,roundZoom:G.roundZoom}),ie=!t||Math.abs(t.tileID.overscaledZ-K)>Math.abs(g.tileID.overscaledZ-K),me=ie&&g.refreshedUponExpiration?1:n.clamp(ie?O:1-V,0,1);return g.refreshedUponExpiration&&O>=1&&(g.refreshedUponExpiration=!1),t?{opacity:1,mix:1-me}:{opacity:me,mix:0}}return{opacity:1,mix:0}}const co=new n.Color(1,0,0,1),En=new n.Color(0,1,0,1),Ic=new n.Color(0,0,1,1),cl=new n.Color(1,0,1,1),Cc=new n.Color(0,1,1,1);function ks(g,t,u,p){Zs(g,0,t+u/2,g.transform.width,u,p)}function xa(g,t,u,p){Zs(g,t-u/2,0,u,g.transform.height,p)}function Zs(g,t,u,p,y,x){const I=g.context,R=I.gl;R.enable(R.SCISSOR_TEST),R.scissor(t*g.pixelRatio,u*g.pixelRatio,p*g.pixelRatio,y*g.pixelRatio),I.clear({color:x}),R.disable(R.SCISSOR_TEST)}function oh(g,t,u){const p=g.context,y=p.gl,x=u.posMatrix,I=g.useProgram("debug"),R=Cr.disabled,O=Yr.disabled,V=g.colorModeForRenderPass(),G="$debug",K=g.style.terrain&&g.style.terrain.getTerrainData(u);p.activeTexture.set(y.TEXTURE0),g.emptyTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE);const ie=t.getTileByID(u.key).latestRawTileData,me=Math.floor((ie&&ie.byteLength||0)/1024),fe=t.getTile(u).tileSize,de=512/Math.min(fe,512)*(u.overscaledZ/g.transform.zoom)*.5;let ze=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(ze+=` => ${u.overscaledZ}`),function(De,Ve){De.initDebugOverlayCanvas();const xe=De.debugOverlayCanvas,Ye=De.context.gl,Ze=De.debugOverlayCanvas.getContext("2d");Ze.clearRect(0,0,xe.width,xe.height),Ze.shadowColor="white",Ze.shadowBlur=2,Ze.lineWidth=1.5,Ze.strokeStyle="white",Ze.textBaseline="top",Ze.font="bold 36px Open Sans, sans-serif",Ze.fillText(Ve,5,5),Ze.strokeText(Ve,5,5),De.debugOverlayTexture.update(xe),De.debugOverlayTexture.bind(Ye.LINEAR,Ye.CLAMP_TO_EDGE)}(g,`${ze} ${me}kB`),I.draw(p,y.TRIANGLES,R,O,ei.alphaBlended,si.disabled,fa(x,n.Color.transparent,de),null,G,g.debugBuffer,g.quadTriangleIndexBuffer,g.debugSegments),I.draw(p,y.LINE_STRIP,R,O,V,si.disabled,fa(x,n.Color.red),K,G,g.debugBuffer,g.tileBorderIndexBuffer,g.debugSegments)}function uo(g,t,u){const p=g.context,y=p.gl,x=g.colorModeForRenderPass(),I=new Cr(y.LEQUAL,Cr.ReadWrite,g.depthRangeFor3D),R=g.useProgram("terrain"),O=t.getTerrainMesh(),V=t.getTerrainData(u.tileID);p.bindFramebuffer.set(null),p.viewport.set([0,0,g.width,g.height]),p.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const G=g.transform.calculatePosMatrix(u.tileID.toUnwrapped());R.draw(p,y.TRIANGLES,I,Yr.disabled,x,si.backCCW,{u_matrix:G,u_texture:0},V,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}function Ac(g,t,u,p){const y=g.context,x=u.tileSize*t.qualityFactor;u.textures[p]||(u.textures[p]=g.getTileTexture(x)||new T(y,{width:x,height:x,data:null},y.gl.RGBA),u.textures[p].bind(y.gl.LINEAR,y.gl.CLAMP_TO_EDGE),p===0&&t.sourceCache.renderHistory.unshift(u.tileID.key));const I=t.getRTTFramebuffer();I.colorAttachment.set(u.textures[p].texture),y.bindFramebuffer.set(I.framebuffer),y.viewport.set([0,0,x,x])}class Pc{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,u=t.terrain;for(const p in t.sourceCaches){this._coordsDescendingInv[p]={};const y=t.sourceCaches[p].getVisibleCoordinates();for(const x of y){const I=u.sourceCache.getTerrainCoords(x);for(const R in I)this._coordsDescendingInv[p][R]||(this._coordsDescendingInv[p][R]=[]),this._coordsDescendingInv[p][R].push(I[R])}}for(const p of t._order){const y=t._layers[p],x=y.source;if(this._renderToTexture[y.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(const I in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][I]=this._coordsDescendingInv[x][I].map(R=>R.key).sort().join()}}return this._renderableTiles.forEach(p=>{for(const y in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[y][p.tileID.key];x&&x!==p.textureCoords[y]&&p.clearTextures(this.painter),u.needsRerender(y,p.tileID)&&p.clearTextures(this.painter)}this._rerender[p.tileID.key]=!p.textures.length}),u.clearRerenderCache(),u.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const u=t.type,p=this.painter,y=p.style._order,x=p.currentLayer,I=x+1===y.length;if(this._renderToTexture[u]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(y[x]),!I))return!0;if(this._renderToTexture[this._prevType]||u==="hillshade"||this._renderToTexture[u]&&I){this._prevType=u;const R=this._stacks.length-1,O=this._stacks[R]||[];for(const V of this._renderableTiles){if(Ac(p,p.style.terrain,V,R),this._rerender[V.tileID.key]){p.context.clear({color:n.Color.transparent});for(let G=0;GO.style.terrain.getElevation(De,st,Vt):null)}}}(p,g,u,t,u.layout.get("text-rotation-alignment"),u.layout.get("text-pitch-alignment"),y),u.paint.get("icon-opacity").constantOr(1)!==0&&oo(g,t,u,p,!1,u.paint.get("icon-translate"),u.paint.get("icon-translate-anchor"),u.layout.get("icon-rotation-alignment"),u.layout.get("icon-pitch-alignment"),u.layout.get("icon-keep-upright"),x,I),u.paint.get("text-opacity").constantOr(1)!==0&&oo(g,t,u,p,!0,u.paint.get("text-translate"),u.paint.get("text-translate-anchor"),u.layout.get("text-rotation-alignment"),u.layout.get("text-pitch-alignment"),u.layout.get("text-keep-upright"),x,I),t.map.showCollisionBoxes&&(Gs(g,t,u,p,u.paint.get("text-translate"),u.paint.get("text-translate-anchor"),!0),Gs(g,t,u,p,u.paint.get("icon-translate"),u.paint.get("icon-translate-anchor"),!1))},circle:function(g,t,u,p){if(g.renderPass!=="translucent")return;const y=u.paint.get("circle-opacity"),x=u.paint.get("circle-stroke-width"),I=u.paint.get("circle-stroke-opacity"),R=!u.layout.get("circle-sort-key").isConstant();if(y.constantOr(1)===0&&(x.constantOr(1)===0||I.constantOr(1)===0))return;const O=g.context,V=O.gl,G=g.depthModeForSublayer(0,Cr.ReadOnly),K=Yr.disabled,ie=g.colorModeForRenderPass(),me=[];for(let fe=0;fefe.sortKey-de.sortKey);for(const fe of me){const{programConfiguration:de,program:ze,layoutVertexBuffer:De,indexBuffer:Ve,uniformValues:xe,terrainData:Ye}=fe.state;ze.draw(O,V.TRIANGLES,G,K,ie,si.disabled,xe,Ye,u.id,De,Ve,fe.segments,u.paint,g.transform.zoom,de)}},heatmap:function(g,t,u,p){if(u.paint.get("heatmap-opacity")!==0)if(g.renderPass==="offscreen"){const y=g.context,x=y.gl,I=Yr.disabled,R=new ei([x.ONE,x.ONE],n.Color.transparent,[!0,!0,!0,!0]);(function(O,V,G){const K=O.gl;O.activeTexture.set(K.TEXTURE1),O.viewport.set([0,0,V.width/4,V.height/4]);let ie=G.heatmapFbo;if(ie)K.bindTexture(K.TEXTURE_2D,ie.colorAttachment.get()),O.bindFramebuffer.set(ie.framebuffer);else{const me=K.createTexture();K.bindTexture(K.TEXTURE_2D,me),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_S,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_T,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MIN_FILTER,K.LINEAR),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MAG_FILTER,K.LINEAR),ie=G.heatmapFbo=O.createFramebuffer(V.width/4,V.height/4,!1),function(fe,de,ze,De){const Ve=fe.gl;Ve.texImage2D(Ve.TEXTURE_2D,0,Ve.RGBA,de.width/4,de.height/4,0,Ve.RGBA,fe.extRenderToTextureHalfFloat?fe.extTextureHalfFloat.HALF_FLOAT_OES:Ve.UNSIGNED_BYTE,null),De.colorAttachment.set(ze)}(O,V,me,ie)}})(y,g,u),y.clear({color:n.Color.transparent});for(let O=0;O{const fe=n.create();n.ortho(fe,0,G.width,G.height,0,0,1);const de=G.context.gl;return{u_matrix:fe,u_world:[de.drawingBufferWidth,de.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:K.paint.get("heatmap-opacity")}})(y,x),null,x.id,y.viewportBuffer,y.quadTriangleIndexBuffer,y.viewportSegments,x.paint,y.transform.zoom)}(g,u))},line:function(g,t,u,p){if(g.renderPass!=="translucent")return;const y=u.paint.get("line-opacity"),x=u.paint.get("line-width");if(y.constantOr(1)===0||x.constantOr(1)===0)return;const I=g.depthModeForSublayer(0,Cr.ReadOnly),R=g.colorModeForRenderPass(),O=u.paint.get("line-dasharray"),V=u.paint.get("line-pattern"),G=V.constantOr(1),K=u.paint.get("line-gradient"),ie=u.getCrossfadeParameters(),me=G?"linePattern":O?"lineSDF":K?"lineGradient":"line",fe=g.context,de=fe.gl;let ze=!0;for(const De of p){const Ve=t.getTile(De);if(G&&!Ve.patternsLoaded())continue;const xe=Ve.getBucket(u);if(!xe)continue;const Ye=xe.programConfigurations.get(u.id),Ze=g.context.program.get(),at=g.useProgram(me,Ye),lt=ze||at.program!==Ze,yt=g.style.terrain&&g.style.terrain.getTerrainData(De),st=V.constantOr(null);if(st&&Ve.imageAtlas){const jt=Ve.imageAtlas,gr=jt.patternPositions[st.to.toString()],br=jt.patternPositions[st.from.toString()];gr&&br&&Ye.setConstantPatternPositions(gr,br)}const Vt=yt?De:null,Dt=G?Qa(g,Ve,u,ie,Vt):O?da(g,Ve,u,O,ie,Vt):K?Wo(g,Ve,u,xe.lineClipsArray.length,Vt):Vs(g,Ve,u,Vt);if(G)fe.activeTexture.set(de.TEXTURE0),Ve.imageAtlasTexture.bind(de.LINEAR,de.CLAMP_TO_EDGE),Ye.updatePaintBuffers(ie);else if(O&&(lt||g.lineAtlas.dirty))fe.activeTexture.set(de.TEXTURE0),g.lineAtlas.bind(fe);else if(K){const jt=xe.gradients[u.id];let gr=jt.texture;if(u.gradientVersion!==jt.version){let br=256;if(u.stepInterpolant){const tr=t.getSource().maxzoom,qr=De.canonical.z===tr?Math.ceil(1<256&&this.clearStencil(),p.setColorMode(ei.disabled),p.setDepthMode(Cr.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of u){const R=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,O=this.style.terrain&&this.style.terrain.getTerrainData(I);x.draw(p,y.TRIANGLES,Cr.disabled,new Yr({func:y.ALWAYS,mask:0},R,255,y.KEEP,y.KEEP,y.REPLACE),ei.disabled,si.disabled,Us(I.posMatrix),O,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,u=this.context.gl;return new Yr({func:u.NOTEQUAL,mask:255},t,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(t){const u=this.context.gl;return new Yr({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(t){const u=this.context.gl,p=t.sort((I,R)=>R.overscaledZ-I.overscaledZ),y=p[p.length-1].overscaledZ,x=p[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const I={};for(let R=0;R=0;this.currentLayer--){const V=this.style._layers[p[this.currentLayer]],G=y[V.source],K=I[V.source];this._renderTileClippingMasks(V,K),this.renderLayer(this,G,V,K)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer{K.source&&!K.isHidden(this.transform.zoom)&&(K.source!==(G&&G.id)&&(G=this.style.sourceCaches[K.source]),(!V||V.getSource().maxzoom0?u.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const u=this.imageManager.getPattern(t.from.toString()),p=this.imageManager.getPattern(t.to.toString());return!u||!p}useProgram(t,u){this.cache=this.cache||{};const p=t+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new ua(this.context,t,as[t],u,Xo[t],this._showOverdrawInspector,this.style.terrain)),this.cache[p]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class ho{constructor(t,u){this.points=t,this.planes=u}static fromInvProjectionMatrix(t,u,p){const y=Math.pow(2,p),x=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(R=>{const O=1/(R=n.transformMat4([],R,t))[3]/u*y;return n.mul$1(R,R,[O,O,1/R[3],O])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(R=>{const O=n.sub([],x[R[0]],x[R[1]]),V=n.sub([],x[R[2]],x[R[1]]),G=n.normalize([],n.cross([],O,V)),K=-n.dot(G,x[R[1]]);return G.concat(K)});return new ho(x,I)}}class Ea{constructor(t,u){this.min=t,this.max=u,this.center=n.scale$1([],n.add([],this.min,this.max),.5)}quadrant(t){const u=[t%2==0,t<2],p=n.clone$2(this.min),y=n.clone$2(this.max);for(let x=0;x=0&&I++;if(I===0)return 0;I!==u.length&&(p=!1)}if(p)return 2;for(let y=0;y<3;y++){let x=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let R=0;Rthis.max[y]-this.min[y])return 0}return 1}}class Hs{constructor(t=0,u=0,p=0,y=0){if(isNaN(t)||t<0||isNaN(u)||u<0||isNaN(p)||p<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=u,this.left=p,this.right=y}interpolate(t,u,p){return u.top!=null&&t.top!=null&&(this.top=n.number(t.top,u.top,p)),u.bottom!=null&&t.bottom!=null&&(this.bottom=n.number(t.bottom,u.bottom,p)),u.left!=null&&t.left!=null&&(this.left=n.number(t.left,u.left,p)),u.right!=null&&t.right!=null&&(this.right=n.number(t.right,u.right,p)),this}getCenter(t,u){const p=n.clamp((this.left+t-this.right)/2,0,t),y=n.clamp((this.top+u-this.bottom)/2,0,u);return new n.pointGeometry(p,y)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Hs(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ka{constructor(t,u,p,y,x){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=x===void 0||!!x,this._minZoom=t||0,this._maxZoom=u||22,this._minPitch=p??0,this._maxPitch=y??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new n.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Hs,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new ka(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new n.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const u=-n.wrap(t,-180,180)*Math.PI/180;var p;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=(p=new n.ARRAY_TYPE(4),n.ARRAY_TYPE!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p),function(y,x,I){var R=x[0],O=x[1],V=x[2],G=x[3],K=Math.sin(I),ie=Math.cos(I);y[0]=R*ie+V*K,y[1]=O*ie+G*K,y[2]=R*-K+V*ie,y[3]=O*-K+G*ie}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const u=n.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const u=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.scale=this.zoomScale(u),this.tileZoom=Math.floor(u),this.zoomFraction=u-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,u,p){this._unmodified=!1,this._edgeInsets.interpolate(t,u,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const u=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(t){const u=[new n.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const p=this.pointCoordinate(new n.pointGeometry(0,0)),y=this.pointCoordinate(new n.pointGeometry(this.width,0)),x=this.pointCoordinate(new n.pointGeometry(this.width,this.height)),I=this.pointCoordinate(new n.pointGeometry(0,this.height)),R=Math.floor(Math.min(p.x,y.x,x.x,I.x)),O=Math.floor(Math.max(p.x,y.x,x.x,I.x)),V=1;for(let G=R-V;G<=O+V;G++)G!==0&&u.push(new n.UnwrappedTileID(G,t))}return u}coveringTiles(t){var u,p;let y=this.coveringZoomLevel(t);const x=y;if(t.minzoom!==void 0&&yt.maxzoom&&(y=t.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),R=n.MercatorCoordinate.fromLngLat(this.center),O=Math.pow(2,y),V=[O*I.x,O*I.y,0],G=[O*R.x,O*R.y,0],K=ho.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,y);let ie=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(ie=y);const me=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,fe=xe=>({aabb:new Ea([xe*O,0,0],[(xe+1)*O,O,0]),zoom:0,x:0,y:0,wrap:xe,fullyVisible:!1}),de=[],ze=[],De=y,Ve=t.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let xe=1;xe<=3;xe++)de.push(fe(-xe)),de.push(fe(xe));for(de.push(fe(0));de.length>0;){const xe=de.pop(),Ye=xe.x,Ze=xe.y;let at=xe.fullyVisible;if(!at){const jt=xe.aabb.intersects(K);if(jt===0)continue;at=jt===2}const lt=t.terrain?V:G,yt=xe.aabb.distanceX(lt),st=xe.aabb.distanceY(lt),Vt=Math.max(Math.abs(yt),Math.abs(st)),Dt=me+(1<Dt&&xe.zoom>=ie){const jt=De-xe.zoom,gr=V[0]-.5-(Ye<>1),tr=xe.zoom+1;let qr=xe.aabb.quadrant(jt);if(t.terrain){const Gr=new n.OverscaledTileID(tr,xe.wrap,tr,gr,br),Ar=t.terrain.getMinMaxElevation(Gr),Pr=(u=Ar.minElevation)!==null&&u!==void 0?u:this.elevation,Hr=(p=Ar.maxElevation)!==null&&p!==void 0?p:this.elevation;qr=new Ea([qr.min[0],qr.min[1],Pr],[qr.max[0],qr.max[1],Hr])}de.push({aabb:qr,zoom:tr,x:gr,y:br,wrap:xe.wrap,fullyVisible:at})}}return ze.sort((xe,Ye)=>xe.distanceSq-Ye.distanceSq).map(xe=>xe.tileID)}resize(t,u){this.width=t,this.height=u,this.pixelsToGLUnits=[2/t,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const u=n.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n.pointGeometry(n.mercatorXfromLng(t.lng)*this.worldSize,n.mercatorYfromLat(u)*this.worldSize)}unproject(t){return new n.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,u){const p=n.MercatorCoordinate.fromLngLat(t),y=(1<I&&(y=I-fe)}if(this.lngRange){const me=(R+O)/2,fe=n.wrap(K.x,me-this.worldSize/2,me+this.worldSize/2),de=V.x/2;fe-deO&&(p=O-de)}p===void 0&&y===void 0||(this.center=this.unproject(new n.pointGeometry(p!==void 0?p:K.x,y!==void 0?y:K.y)).wrap()),this._unmodified=G,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,u=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=n.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let y=n.identity(new Float64Array(16));n.scale(y,y,[this.width/2,-this.height/2,1]),n.translate(y,y,[1,-1,0]),this.labelPlaneMatrix=y,y=n.identity(new Float64Array(16)),n.scale(y,y,[1,-1,1]),n.translate(y,y,[-1,-1,0]),n.scale(y,y,[2/this.width,2/this.height,1]),this.glCoordMatrix=y,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const x=Math.PI/2+this._pitch,I=this._fov*(.5+t.y/this.height),R=Math.sin(I)*this.cameraToSeaLevelDistance/Math.sin(n.clamp(Math.PI-x-I,.01,Math.PI-.01)),O=this.getHorizon(),V=2*Math.atan(O/this.cameraToCenterDistance)*(.5+t.y/(2*O)),G=Math.sin(V)*this.cameraToSeaLevelDistance/Math.sin(n.clamp(Math.PI-x-V,.01,Math.PI-.01)),K=Math.cos(Math.PI/2-this._pitch)*R+this.cameraToSeaLevelDistance,ie=Math.cos(Math.PI/2-this._pitch)*G+this.cameraToSeaLevelDistance,me=1.01*Math.min(K,ie),fe=this.height/50;y=new Float64Array(16),n.perspective(y,this._fov,this.width/this.height,fe,me),y[8]=2*-t.x/this.width,y[9]=2*t.y/this.height,n.scale(y,y,[1,-1,1]),n.translate(y,y,[0,0,-this.cameraToCenterDistance]),n.rotateX(y,y,this._pitch),n.rotateZ(y,y,this.angle),n.translate(y,y,[-u,-p,0]),this.mercatorMatrix=n.scale([],y,[this.worldSize,this.worldSize,this.worldSize]),n.scale(y,y,[1,1,this._pixelPerMeter]),this.pixelMatrix=n.multiply(new Float64Array(16),this.labelPlaneMatrix,y),n.translate(y,y,[0,0,-this.elevation]),this.projMatrix=y,this.invProjMatrix=n.invert([],y),this.pixelMatrix3D=n.multiply(new Float64Array(16),this.labelPlaneMatrix,y);const de=this.width%2/2,ze=this.height%2/2,De=Math.cos(this.angle),Ve=Math.sin(this.angle),xe=u-Math.round(u)+De*de+Ve*ze,Ye=p-Math.round(p)+De*ze+Ve*de,Ze=new Float64Array(y);if(n.translate(Ze,Ze,[xe>.5?xe-1:xe,Ye>.5?Ye-1:Ye,0]),this.alignedProjMatrix=Ze,y=n.invert(new Float64Array(16),this.pixelMatrix),!y)throw new Error("failed to invert matrix");this.pixelMatrixInverse=y,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new n.pointGeometry(0,0)),u=[t.x*this.worldSize,t.y*this.worldSize,0,1];return n.transformMat4(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n.pointGeometry(0,t))}getCameraQueryGeometry(t){const u=this.getCameraPoint();if(t.length===1)return[t[0],u];{let p=u.x,y=u.y,x=u.x,I=u.y;for(const R of t)p=Math.min(p,R.x),y=Math.min(y,R.y),x=Math.max(x,R.x),I=Math.max(I,R.y);return[new n.pointGeometry(p,y),new n.pointGeometry(x,y),new n.pointGeometry(x,I),new n.pointGeometry(p,I),new n.pointGeometry(p,y)]}}}class zc{constructor(t){this._hashName=t&&encodeURIComponent(t),n.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(u,p){let y=!1,x=null;const I=()=>{x=null,y&&(u(),x=setTimeout(I,300),y=!1)};return()=>(y=!0,x||I(),x)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const u=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,y=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),I=Math.round(u.lng*x)/x,R=Math.round(u.lat*x)/x,O=this._map.getBearing(),V=this._map.getPitch();let G="";if(G+=t?`/${I}/${R}/${p}`:`${p}/${R}/${I}`,(O||V)&&(G+="/"+Math.round(10*O)/10),V&&(G+=`/${Math.round(V)}`),this._hashName){const K=this._hashName;let ie=!1;const me=window.location.hash.slice(1).split("&").map(fe=>{const de=fe.split("=")[0];return de===K?(ie=!0,`${de}=${G}`):fe}).filter(fe=>fe);return ie||me.push(`${K}=${G}`),`#${me.join("&")}`}return`#${G}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let u;return t.split("&").map(p=>p.split("=")).forEach(p=>{p[0]===this._hashName&&(u=p)}),(u&&u[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(u=>isNaN(u))){const u=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:u,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const Sa={linearity:.3,easing:n.bezier(0,0,.3,1)},Mc=n.extend({deceleration:2500,maxSpeed:1400},Sa),Dc=n.extend({deceleration:20,maxSpeed:1400},Sa),Rc=n.extend({deceleration:1e3,maxSpeed:360},Sa),Ws=n.extend({deceleration:1e3,maxSpeed:90},Sa);class Lc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,u=n.exported.now();for(;t.length>0&&u-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new n.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)u.zoom+=x.zoomDelta||0,u.bearing+=x.bearingDelta||0,u.pitch+=x.pitchDelta||0,x.panDelta&&u.pan._add(x.panDelta),x.around&&(u.around=x.around),x.pinchAround&&(u.pinchAround=x.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(u.pan.mag()){const x=Ia(u.pan.mag(),p,n.extend({},Mc,t||{}));y.offset=u.pan.mult(x.amount/u.pan.mag()),y.center=this._map.transform.center,Ta(y,x)}if(u.zoom){const x=Ia(u.zoom,p,Dc);y.zoom=this._map.transform.zoom+x.amount,Ta(y,x)}if(u.bearing){const x=Ia(u.bearing,p,Rc);y.bearing=this._map.transform.bearing+n.clamp(x.amount,-179,179),Ta(y,x)}if(u.pitch){const x=Ia(u.pitch,p,Ws);y.pitch=this._map.transform.pitch+x.amount,Ta(y,x)}if(y.zoom||y.bearing){const x=u.pinchAround===void 0?u.around:u.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),n.extend(y,{noMoveStart:!0})}}function Ta(g,t){(!g.duration||g.durationu.unproject(O)),R=x.reduce((O,V,G,K)=>O.add(V.div(K.length)),new n.pointGeometry(0,0));super(t,{points:x,point:R,lngLats:I,lngLat:u.unproject(R),originalEvent:p}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class on extends n.Event{constructor(t,u,p){super(t,{originalEvent:p}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class lh{constructor(t,u){this._map=t,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new on(t.type,this._map,t))}mousedown(t,u){return this._mousedownPos=u,this._firePreventable(new an(t.type,this._map,t))}mouseup(t){this._map.fire(new an(t.type,this._map,t))}click(t,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new an(t.type,this._map,t))}dblclick(t){return this._firePreventable(new an(t.type,this._map,t))}mouseover(t){this._map.fire(new an(t.type,this._map,t))}mouseout(t){this._map.fire(new an(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Ca(t.type,this._map,t))}touchmove(t){this._map.fire(new Ca(t.type,this._map,t))}touchend(t){this._map.fire(new Ca(t.type,this._map,t))}touchcancel(t){this._map.fire(new Ca(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class cs{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new an(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new an("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new an(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Bc{constructor(t,u){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,u){this.isEnabled()&&t.shiftKey&&t.button===0&&(k.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(t,u){if(!this._active)return;const p=u;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)x.fitScreenCoordinates(p,y,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(k.remove(this._box),this._box=null),k.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,u){return this._map.fire(new n.Event(t,{originalEvent:u}))}}function Gn(g,t){if(g.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${g.length}, points ${t.length}`);const u={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),p.length===this.numTouches&&(this.centroid=function(y){const x=new n.pointGeometry(0,0);for(const I of y)x._add(I);return x.div(y.length)}(u),this.touches=Gn(p,u)))}touchmove(t,u,p){if(this.aborted||!this.centroid)return;const y=Gn(p,u);for(const x in this.touches){const I=this.touches[x],R=y[x];(!R||R.dist(I)>30)&&(this.aborted=!0)}}touchend(t,u,p){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class hl{constructor(t){this.singleTap=new Aa(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,u,p){this.singleTap.touchstart(t,u,p)}touchmove(t,u,p){this.singleTap.touchmove(t,u,p)}touchend(t,u,p){const y=this.singleTap.touchend(t,u,p);if(y){const x=t.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(y)<30;if(x&&I||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class ch{constructor(){this._zoomIn=new hl({numTouches:1,numTaps:2}),this._zoomOut=new hl({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,u,p){this._zoomIn.touchstart(t,u,p),this._zoomOut.touchstart(t,u,p)}touchmove(t,u,p){this._zoomIn.touchmove(t,u,p),this._zoomOut.touchmove(t,u,p)}touchend(t,u,p){const y=this._zoomIn.touchend(t,u,p),x=this._zoomOut.touchend(t,u,p);return y?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:I.getZoom()+1,around:I.unproject(y)},{originalEvent:t})}):x?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:I.getZoom()-1,around:I.unproject(x)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const uh={0:1,2:2};class fo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,u){return!1}_move(t,u){return{}}mousedown(t,u){if(this._lastPoint)return;const p=k.mouseButton(t);this._correctButton(t,p)&&(this._lastPoint=u,this._eventButton=p)}mousemoveWindow(t,u){const p=this._lastPoint;if(p){if(t.preventDefault(),function(y,x){const I=uh[x];return y.buttons===void 0||(y.buttons&I)!==I}(t,this._eventButton))this.reset();else if(this._moved||!(u.dist(p){this._cancelCooperativeMessage=!1},200)}touchstart(t,u,p){return this._calculateTransform(t,u,p)}touchmove(t,u,p){if(this._map._cooperativeGestures&&(this._minTouches===2&&p.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,p.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(p.length0&&(this._active=!0);const y=Gn(p,u),x=new n.pointGeometry(0,0),I=new n.pointGeometry(0,0);let R=0;for(const V in y){const G=y[V],K=this._touches[V];K&&(x._add(G),I._add(G.sub(K)),R++,y[V]=G)}if(this._touches=y,RMath.abs(g.x)}class pl extends Ss{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,u,p){super.touchstart(t,u,p),this._currentTouchCount=p.length}_start(t){this._lastPoints=t,dl(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,u,p){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const y=t[0].sub(this._lastPoints[0]),x=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,p.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(t,u,p){if(this._valid!==void 0)return this._valid;const y=t.mag()>=2,x=u.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const I=t.y>0==u.y>0;return dl(t)&&dl(u)&&I}}const Fc={panStep:100,bearingStep:15,pitchStep:10};class Nc{constructor(){const t=Fc;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let u=0,p=0,y=0,x=0,I=0;switch(t.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:t.shiftKey?p=-1:(t.preventDefault(),x=-1);break;case 39:t.shiftKey?p=1:(t.preventDefault(),x=1);break;case 38:t.shiftKey?y=1:(t.preventDefault(),I=-1);break;case 40:t.shiftKey?y=-1:(t.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(p=0,y=0),{cameraAnimation:R=>{const O=R.getZoom();R.easeTo({duration:300,easeId:"keyboardHandler",easing:fh,zoom:u?Math.round(O)+u*(t.shiftKey?2:1):O,bearing:R.getBearing()+p*this._bearingStep,pitch:R.getPitch()+y*this._pitchStep,offset:[-x*this._panStep,-I*this._panStep],center:R.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function fh(g){return g*(2-g)}const Uc=4.000244140625;class ml{constructor(t,u){this._map=t,this._el=t.getCanvasContainer(),this._handler=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,n.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let u=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const p=n.exported.now(),y=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,u!==0&&u%Uc==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(y*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),t.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=t,this._delta-=u,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=k.mousePos(this._el,t);this._around=n.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(u)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const R=this._type==="wheel"&&Math.abs(this._delta)>Uc?this._wheelZoomRate:this._defaultZoomRate;let O=2/(1+Math.exp(-Math.abs(this._delta*R)));this._delta<0&&O!==0&&(O=1/O);const V=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(V*O))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,p=this._startZoom,y=this._easing;let x,I=!1;if(this._type==="wheel"&&p&&y){const R=Math.min((n.exported.now()-this._lastWheelEventTime)/200,1),O=y(R);x=n.number(p,u,O),R<1?this._frameId||(this._frameId=!0):I=!0}else x=u,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:x-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let u=n.ease;if(this._prevEase){const p=this._prevEase,y=(n.exported.now()-p.start)/p.duration,x=p.easing(y+.01)-p.easing(y),I=.27/Math.sqrt(x*x+1e-4)*.01,R=Math.sqrt(.0729-I*I);u=n.bezier(I,R,.25,1)}return this._prevEase={start:n.exported.now(),duration:t,easing:u},u}reset(){this._active=!1}}class gl{constructor(t,u){this._clickZoom=t,this._tapZoom=u}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class _l{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,u){return t.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:p.getZoom()+(t.shiftKey?-1:1),around:p.unproject(u)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class yl{constructor(){this._tap=new hl({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,u,p){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?p.length>0&&(this._swipePoint=u[0],this._swipeTouch=p[0].identifier):this._tap.touchstart(t,u,p))}touchmove(t,u,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const y=u[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,t.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(t,u,p)}touchend(t,u,p){this._tapTime?this._swipePoint&&p.length===0&&this.reset():this._tap.touchend(t,u,p)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ji{constructor(t,u,p){this._el=t,this._mousePan=u,this._touchPan=p}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class hs{constructor(t,u,p){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=u,this._mousePitch=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Vc{constructor(t,u,p,y){this._el=t,this._touchZoom=u,this._touchRotate=p,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ks=g=>g.zoom||g.drag||g.pitch||g.rotate;class vl extends n.Event{}function za(g){return g.panDelta&&g.panDelta.mag()||g.zoomDelta||g.bearingDelta||g.pitchDelta}class $c{constructor(t,u){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Lc(t),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u),n.bindAll(["handleEvent","handleWindowEvent"],this);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,I]of this._listeners)k.addEventListener(y,x,y===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[t,u,p]of this._listeners)k.removeEventListener(t,u,t===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(t){const u=this._map,p=u.getCanvasContainer();this._add("mapEvent",new lh(u,t));const y=u.boxZoom=new Bc(u,t);this._add("boxZoom",y);const x=new ch,I=new _l;u.doubleClickZoom=new gl(I,x),this._add("tapZoom",x),this._add("clickZoom",I);const R=new yl;this._add("tapDragZoom",R);const O=u.touchPitch=new pl(u);this._add("touchPitch",O);const V=new Zn(t),G=new Gt(t);u.dragRotate=new hs(t,V,G),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",G,["mouseRotate"]);const K=new Pa(t),ie=new Oc(t,u);u.dragPan=new Ji(p,K,ie),this._add("mousePan",K),this._add("touchPan",ie,["touchZoom","touchRotate"]);const me=new hh,fe=new Ft;u.touchZoomRotate=new Vc(p,fe,me,R),this._add("touchRotate",me,["touchPan","touchZoom"]),this._add("touchZoom",fe,["touchPan","touchRotate"]);const de=u.scrollZoom=new ml(u,this);this._add("scrollZoom",de,["mousePan"]);const ze=u.keyboard=new Nc;this._add("keyboard",ze),this._add("blockableMapEvent",new cs(u));for(const De of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[De]&&u[De].enable(t[De])}_add(t,u,p){this._handlers.push({handlerName:t,handler:u,allowed:p}),this._handlersById[t]=u}stop(t){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ks(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,u,p){for(const y in t)if(y!==p&&(!u||u.indexOf(y)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const u=[];for(const p of t)this._el.contains(p.target)&&u.push(p);return u}handleEvent(t,u){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const p=t.type==="renderFrame"?void 0:t,y={needsRenderFrame:!1},x={},I={},R=t.touches,O=R?this._getMapTouches(R):void 0,V=O?k.touchPos(this._el,O):k.mousePos(this._el,t);for(const{handlerName:ie,handler:me,allowed:fe}of this._handlers){if(!me.isEnabled())continue;let de;this._blockedByActive(I,fe,ie)?me.reset():me[u||t.type]&&(de=me[u||t.type](t,V,O),this.mergeHandlerResult(y,x,de,ie,p),de&&de.needsRenderFrame&&this._triggerRenderFrame()),(de||me.isActive())&&(I[ie]=me)}const G={};for(const ie in this._previousActiveHandlers)I[ie]||(G[ie]=p);this._previousActiveHandlers=I,(Object.keys(G).length||za(y))&&(this._changes.push([y,x,G]),this._triggerRenderFrame()),(Object.keys(I).length||za(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:K}=y;K&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],K(this._map))}mergeHandlerResult(t,u,p,y,x){if(!p)return;n.extend(t,p);const I={handlerName:y,originalEvent:p.originalEvent||x};p.zoomDelta!==void 0&&(u.zoom=I),p.panDelta!==void 0&&(u.drag=I),p.pitchDelta!==void 0&&(u.pitch=I),p.bearingDelta!==void 0&&(u.rotate=I)}_applyChanges(){const t={},u={},p={};for(const[y,x,I]of this._changes)y.panDelta&&(t.panDelta=(t.panDelta||new n.pointGeometry(0,0))._add(y.panDelta)),y.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(t.around=y.around),y.pinchAround!==void 0&&(t.pinchAround=y.pinchAround),y.noInertia&&(t.noInertia=y.noInertia),n.extend(u,x),n.extend(p,I);this._updateMapTransform(t,u,p),this._changes=[]}_updateMapTransform(t,u,p){const y=this._map,x=y.transform,I=y.style&&y.style.terrain;if(!(za(t)||I&&this._drag))return this._fireEvents(u,p,!0);let{panDelta:R,zoomDelta:O,bearingDelta:V,pitchDelta:G,around:K,pinchAround:ie}=t;ie!==void 0&&(K=ie),y._stop(!0),K=K||y.transform.centerPoint;const me=x.pointLocation(R?K.sub(R):K);V&&(x.bearing+=V),G&&(x.pitch+=G),O&&(x.zoom+=O),I?u.drag&&!this._drag?(this._drag={center:x.centerPoint,lngLat:x.pointLocation(K),point:K,handlerName:u.drag.handlerName},y.fire(new n.Event("freezeElevation",{freeze:!0}))):this._drag&&p[this._drag.handlerName]?(y.fire(new n.Event("freezeElevation",{freeze:!1})),this._drag=null):u.drag&&this._drag&&(x.center=x.pointLocation(x.centerPoint.sub(R))):x.setLocationAtPoint(me,K),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(u,p,!0)}_fireEvents(t,u,p){const y=Ks(this._eventsInProgress),x=Ks(t),I={};for(const G in t){const{originalEvent:K}=t[G];this._eventsInProgress[G]||(I[`${G}start`]=K),this._eventsInProgress[G]=t[G]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const G in I)this._fireEvent(G,I[G]);x&&this._fireEvent("move",x.originalEvent);for(const G in t){const{originalEvent:K}=t[G];this._fireEvent(G,K)}const R={};let O;for(const G in this._eventsInProgress){const{handlerName:K,originalEvent:ie}=this._eventsInProgress[G];this._handlersById[K].isActive()||(delete this._eventsInProgress[G],O=u[K]||ie,R[`${G}end`]=O)}for(const G in R)this._fireEvent(G,R[G]);const V=Ks(this._eventsInProgress);if(p&&(y||x)&&!V){this._updatingCamera=!0;const G=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),K=ie=>ie!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new vl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const _n={extend:(g,...t)=>n.extend(g,...t),run(g){g()},logToElement(g,t=!1,u="log"){const p=window.document.getElementById(u);p&&(t&&(p.innerHTML=""),p.innerHTML+=`
${g}`)}};class ai extends n.Evented{constructor(t,u){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=u.bearingSnap,n.bindAll(["_renderFrameCallback"],this)}getCenter(){return new n.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,u){return this.jumpTo({center:t},u)}panBy(t,u,p){return t=n.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,n.extend({offset:t},u),p)}panTo(t,u,p){return this.easeTo(n.extend({center:t},u),p)}getZoom(){return this.transform.zoom}setZoom(t,u){return this.jumpTo({zoom:t},u),this}zoomTo(t,u,p){return this.easeTo(n.extend({zoom:t},u),p)}zoomIn(t,u){return this.zoomTo(this.getZoom()+1,t,u),this}zoomOut(t,u){return this.zoomTo(this.getZoom()-1,t,u),this}getBearing(){return this.transform.bearing}setBearing(t,u){return this.jumpTo({bearing:t},u),this}getPadding(){return this.transform.padding}setPadding(t,u){return this.jumpTo({padding:t},u),this}rotateTo(t,u,p){return this.easeTo(n.extend({bearing:t},u),p)}resetNorth(t,u){return this.rotateTo(0,n.extend({duration:1e3},t),u),this}resetNorthPitch(t,u){return this.easeTo(n.extend({bearing:0,pitch:0,duration:1e3},t),u),this}snapToNorth(t,u){return Math.abs(this.getBearing()){if(this._zooming&&(p.zoom=n.number(y,O,at)),this._rotating&&(p.bearing=n.number(x,V,at)),this._pitching&&(p.pitch=n.number(I,G,at)),this._padding&&(p.interpolatePadding(R,K,at),me=p.centerPoint.add(ie)),xe)p.setLocationAtPoint(xe,Ye);else{const lt=p.zoomScale(p.zoom-y),yt=O>y?Math.min(2,Ve):Math.max(.5,Ve),st=Math.pow(yt,1-at),Vt=p.unproject(ze.add(De.mult(at*st)).mult(lt));p.setLocationAtPoint(p.renderWorldCopies?Vt.wrap():Vt,me)}this._fireMoveEvents(u)},at=>{this._afterEase(u,at)},t),this}_prepareEase(t,u,p={}){this._moving=!0,this.fire(new n.Event("freezeElevation",{freeze:!0})),u||p.moving||this.fire(new n.Event("movestart",t)),this._zooming&&!p.zooming&&this.fire(new n.Event("zoomstart",t)),this._rotating&&!p.rotating&&this.fire(new n.Event("rotatestart",t)),this._pitching&&!p.pitching&&this.fire(new n.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new n.Event("move",t)),this._zooming&&this.fire(new n.Event("zoom",t)),this._rotating&&this.fire(new n.Event("rotate",t)),this._pitching&&this.fire(new n.Event("pitch",t))}_afterEase(t,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId,this.fire(new n.Event("freezeElevation",{freeze:!1}));const p=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new n.Event("zoomend",t)),y&&this.fire(new n.Event("rotateend",t)),x&&this.fire(new n.Event("pitchend",t)),this.fire(new n.Event("moveend",t))}flyTo(t,u){if(!t.essential&&n.exported.prefersReducedMotion){const tr=n.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(tr,u)}this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},t);const p=this.transform,y=this.getZoom(),x=this.getBearing(),I=this.getPitch(),R=this.getPadding(),O="zoom"in t?n.clamp(+t.zoom,p.minZoom,p.maxZoom):y,V="bearing"in t?this._normalizeBearing(t.bearing,x):x,G="pitch"in t?+t.pitch:I,K="padding"in t?t.padding:p.padding,ie=p.zoomScale(O-y),me=n.pointGeometry.convert(t.offset);let fe=p.centerPoint.add(me);const de=p.pointLocation(fe),ze=n.LngLat.convert(t.center||de);this._normalizeCenter(ze);const De=p.project(de),Ve=p.project(ze).sub(De);let xe=t.curve;const Ye=Math.max(p.width,p.height),Ze=Ye/ie,at=Ve.mag();if("minZoom"in t){const tr=n.clamp(Math.min(t.minZoom,y,O),p.minZoom,p.maxZoom),qr=Ye/p.zoomScale(tr-y);xe=Math.sqrt(qr/at*2)}const lt=xe*xe;function yt(tr){const qr=(Ze*Ze-Ye*Ye+(tr?-1:1)*lt*lt*at*at)/(2*(tr?Ze:Ye)*lt*at);return Math.log(Math.sqrt(qr*qr+1)-qr)}function st(tr){return(Math.exp(tr)-Math.exp(-tr))/2}function Vt(tr){return(Math.exp(tr)+Math.exp(-tr))/2}const Dt=yt(0);let jt=function(tr){return Vt(Dt)/Vt(Dt+xe*tr)},gr=function(tr){return Ye*((Vt(Dt)*(st(qr=Dt+xe*tr)/Vt(qr))-st(Dt))/lt)/at;var qr},br=(yt(1)-Dt)/xe;if(Math.abs(at)<1e-6||!isFinite(br)){if(Math.abs(Ye-Ze)<1e-6)return this.easeTo(t,u);const tr=Zet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=x!==V,this._pitching=G!==I,this._padding=!p.isPaddingEqual(K),this._prepareEase(u,!1),this._ease(tr=>{const qr=tr*br,Gr=1/jt(qr);p.zoom=tr===1?O:y+p.scaleZoom(Gr),this._rotating&&(p.bearing=n.number(x,V,tr)),this._pitching&&(p.pitch=n.number(I,G,tr)),this._padding&&(p.interpolatePadding(R,K,tr),fe=p.centerPoint.add(me));const Ar=tr===1?ze:p.unproject(De.add(Ve.mult(gr(qr))).mult(Gr));p.setLocationAtPoint(p.renderWorldCopies?Ar.wrap():Ar,fe),this._fireMoveEvents(u)},()=>this._afterEase(u),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,u){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,u)}if(!t){const p=this.handlers;p&&p.stop(!1)}return this}_ease(t,u,p){p.animate===!1||p.duration===0?(t(1),u()):(this._easeStart=n.exported.now(),this._easeOptions=p,this._onEaseFrame=t,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((n.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,u){t=n.wrap(t,-180,180);const p=Math.abs(t-u);return Math.abs(t-360-u)180?-360:p<-180?360:0}}class Ma{constructor(t={}){this.options=t,n.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=k.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=k.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=k.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){k.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,u){const p=this._map._getUIString(`AttributionControl.${u}`);t.title=p,t.setAttribute("aria-label",p)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const u=this._map.style.sourceCaches;for(const y in u){const x=u[y];if(x.used||x.usedForTerrain){const I=x.getSource();I.attribution&&t.indexOf(I.attribution)<0&&t.push(I.attribution)}}t=t.filter(y=>String(y).trim()),t.sort((y,x)=>y.length-x.length),t=t.filter((y,x)=>{for(let I=x+1;I=0)return!1;return!0});const p=t.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,t.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class mo{constructor(t={}){this.options=t,n.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=k.create("div","maplibregl-ctrl mapboxgl-ctrl");const u=k.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){k.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const u=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&u.classList.add("maplibregl-compact","mapboxgl-compact"):u.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class jc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const u=++this._id;return this._queue.push({callback:t,id:u,cancelled:!1}),u}remove(t){const u=this._currentlyRunning,p=u?this._queue.concat(u):this._queue;for(const y of p)if(y.id===t)return void(y.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const p of u)if(!p.cancelled&&(p.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const qc={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},Gc={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},dh={showCompass:!0,showZoom:!0,visualizePitch:!1};class Mn{constructor(t,u,p=!1){this._clickTolerance=10,this.element=u,this.mouseRotate=new Zn({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,p&&(this.mousePitch=new Gt({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),n.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),k.addEventListener(u,"mousedown",this.mousedown),k.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),k.addEventListener(u,"touchmove",this.touchmove),k.addEventListener(u,"touchend",this.touchend),k.addEventListener(u,"touchcancel",this.reset)}down(t,u){this.mouseRotate.mousedown(t,u),this.mousePitch&&this.mousePitch.mousedown(t,u),k.disableDrag()}move(t,u){const p=this.map,y=this.mouseRotate.mousemoveWindow(t,u);if(y&&y.bearingDelta&&p.setBearing(p.getBearing()+y.bearingDelta),this.mousePitch){const x=this.mousePitch.mousemoveWindow(t,u);x&&x.pitchDelta&&p.setPitch(p.getPitch()+x.pitchDelta)}}off(){const t=this.element;k.removeEventListener(t,"mousedown",this.mousedown),k.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),k.removeEventListener(t,"touchmove",this.touchmove),k.removeEventListener(t,"touchend",this.touchend),k.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){k.enableDrag(),k.removeEventListener(window,"mousemove",this.mousemove),k.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(n.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),k.mousePos(this.element,t)),k.addEventListener(window,"mousemove",this.mousemove),k.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,k.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=k.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=k.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){const p=u.locationPoint(g);if(p.x>=0&&p.y>=0&&p.x<=u.width&&p.y<=u.height)break;g.lng>u.center.lng?g.lng-=360:g.lng+=360}return g}const Kt={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function lr(g,t,u){const p=g.classList;for(const y in Kt)p.remove(`maplibregl-${u}-anchor-${y}`,`mapboxgl-${u}-anchor-${y}`);p.add(`maplibregl-${u}-anchor-${t}`,`mapboxgl-${u}-anchor-${t}`)}class Xs extends n.Evented{constructor(t,u){if(super(),(t instanceof HTMLElement||u)&&(t=n.extend({element:t},u)),n.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=n.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=k.create("div"),this._element.setAttribute("aria-label","Map marker");const p=k.createNS("http://www.w3.org/2000/svg","svg"),y=41,x=27;p.setAttributeNS(null,"display","block"),p.setAttributeNS(null,"height",`${y}px`),p.setAttributeNS(null,"width",`${x}px`),p.setAttributeNS(null,"viewBox",`0 0 ${x} ${y}`);const I=k.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"stroke","none"),I.setAttributeNS(null,"stroke-width","1"),I.setAttributeNS(null,"fill","none"),I.setAttributeNS(null,"fill-rule","evenodd");const R=k.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill-rule","nonzero");const O=k.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(3.0, 29.0)"),O.setAttributeNS(null,"fill","#000000");const V=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Ve of V){const xe=k.createNS("http://www.w3.org/2000/svg","ellipse");xe.setAttributeNS(null,"opacity","0.04"),xe.setAttributeNS(null,"cx","10.5"),xe.setAttributeNS(null,"cy","5.80029008"),xe.setAttributeNS(null,"rx",Ve.rx),xe.setAttributeNS(null,"ry",Ve.ry),O.appendChild(xe)}const G=k.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"fill",this._color);const K=k.createNS("http://www.w3.org/2000/svg","path");K.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),G.appendChild(K);const ie=k.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"opacity","0.25"),ie.setAttributeNS(null,"fill","#000000");const me=k.createNS("http://www.w3.org/2000/svg","path");me.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),ie.appendChild(me);const fe=k.createNS("http://www.w3.org/2000/svg","g");fe.setAttributeNS(null,"transform","translate(6.0, 7.0)"),fe.setAttributeNS(null,"fill","#FFFFFF");const de=k.createNS("http://www.w3.org/2000/svg","g");de.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ze=k.createNS("http://www.w3.org/2000/svg","circle");ze.setAttributeNS(null,"fill","#000000"),ze.setAttributeNS(null,"opacity","0.25"),ze.setAttributeNS(null,"cx","5.5"),ze.setAttributeNS(null,"cy","5.5"),ze.setAttributeNS(null,"r","5.4999962");const De=k.createNS("http://www.w3.org/2000/svg","circle");De.setAttributeNS(null,"fill","#FFFFFF"),De.setAttributeNS(null,"cx","5.5"),De.setAttributeNS(null,"cy","5.5"),De.setAttributeNS(null,"r","5.4999962"),de.appendChild(ze),de.appendChild(De),R.appendChild(O),R.appendChild(G),R.appendChild(ie),R.appendChild(fe),R.appendChild(de),p.appendChild(R),p.setAttributeNS(null,"height",y*this._scale+"px"),p.setAttributeNS(null,"width",x*this._scale+"px"),this._element.appendChild(p),this._offset=n.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",p=>{p.preventDefault()}),this._element.addEventListener("mousedown",p=>{p.preventDefault()}),lr(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),k.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=n.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const y=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const u=t.code,p=t.charCode||t.keyCode;u!=="Space"&&u!=="Enter"&&p!==32&&p!==13||this.togglePopup()}_onMapClick(t){const u=t.originalEvent.target,p=this._element;this._popup&&(u===p||p.contains(u))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Da(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let p="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?p="rotateX(0deg)":this._pitchAlignment==="map"&&(p=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),k.setTransform(this._element,`${Kt[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${u}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const y=this._map.unproject(this._pos),x=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=y.distanceTo(this._lngLat)>20*x?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=n.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const u=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=u}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new n.Event("dragstart"))),this.fire(new n.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new n.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const bl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let fs,Fi=0,ds=!1;const Dn={maxWidth:100,unit:"metric"};function Zc(g,t,u){const p=u&&u.maxWidth||100,y=g._container.clientHeight/2,x=g.unproject([0,y]),I=g.unproject([p,y]),R=x.distanceTo(I);if(u&&u.unit==="imperial"){const O=3.2808*R;O>5280?ps(t,p,O/5280,g._getUIString("ScaleControl.Miles")):ps(t,p,O,g._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?ps(t,p,R/1852,g._getUIString("ScaleControl.NauticalMiles")):R>=1e3?ps(t,p,R/1e3,g._getUIString("ScaleControl.Kilometers")):ps(t,p,R,g._getUIString("ScaleControl.Meters"))}function ps(g,t,u,p){const y=function(x){const I=Math.pow(10,`${Math.floor(x)}`.length-1);let R=x/I;return R=R>=10?10:R>=5?5:R>=3?3:R>=2?2:R>=1?1:function(O){const V=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*V)/V}(R),I*R}(u);g.style.width=t*(y/u)+"px",g.innerHTML=`${y} ${p}`}const di={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},bi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function xl(g){if(g){if(typeof g=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(g,2)));return{center:new n.pointGeometry(0,0),top:new n.pointGeometry(0,g),"top-left":new n.pointGeometry(t,t),"top-right":new n.pointGeometry(-t,t),bottom:new n.pointGeometry(0,-g),"bottom-left":new n.pointGeometry(t,-t),"bottom-right":new n.pointGeometry(-t,-t),left:new n.pointGeometry(g,0),right:new n.pointGeometry(-g,0)}}if(g instanceof n.pointGeometry||Array.isArray(g)){const t=n.pointGeometry.convert(g);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:n.pointGeometry.convert(g.center||[0,0]),top:n.pointGeometry.convert(g.top||[0,0]),"top-left":n.pointGeometry.convert(g["top-left"]||[0,0]),"top-right":n.pointGeometry.convert(g["top-right"]||[0,0]),bottom:n.pointGeometry.convert(g.bottom||[0,0]),"bottom-left":n.pointGeometry.convert(g["bottom-left"]||[0,0]),"bottom-right":n.pointGeometry.convert(g["bottom-right"]||[0,0]),left:n.pointGeometry.convert(g.left||[0,0]),right:n.pointGeometry.convert(g.right||[0,0])}}return xl(new n.pointGeometry(0,0))}const Ts={supported:m,setRTLTextPlugin:n.setRTLTextPlugin,getRTLTextPluginStatus:n.getRTLTextPluginStatus,Map:class extends ai{constructor(g){var t;if(n.PerformanceUtils.mark(n.PerformanceMarkers.create),(g=n.extend({},Gc,g)).minZoom!=null&&g.maxZoom!=null&&g.minZoom>g.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(g.minPitch!=null&&g.maxPitch!=null&&g.minPitch>g.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(g.minPitch!=null&&g.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(g.maxPitch!=null&&g.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ka(g.minZoom,g.maxZoom,g.minPitch,g.maxPitch,g.renderWorldCopies),{bearingSnap:g.bearingSnap}),this._interactive=g.interactive,this._cooperativeGestures=g.cooperativeGestures,this._maxTileCacheSize=g.maxTileCacheSize,this._failIfMajorPerformanceCaveat=g.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=g.preserveDrawingBuffer,this._antialias=g.antialias,this._trackResize=g.trackResize,this._bearingSnap=g.bearingSnap,this._refreshExpiredTiles=g.refreshExpiredTiles,this._fadeDuration=g.fadeDuration,this._crossSourceCollisions=g.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=g.collectResourceTiming,this._renderTaskQueue=new jc,this._controls=[],this._mapId=n.uniqueId(),this._locale=n.extend({},qc,g.locale),this._clickTolerance=g.clickTolerance,this._pixelRatio=(t=g.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new A(g.transformRequest),typeof g.container=="string"){if(this._container=document.getElementById(g.container),!this._container)throw new Error(`Container '${g.container}' not found.`)}else{if(!(g.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=g.container}if(g.maxBounds&&this.setMaxBounds(g.maxBounds),n.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new $c(this,g),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=g.hash&&new zc(typeof g.hash=="string"&&g.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch}),g.bounds&&(this.resize(),this.fitBounds(g.bounds,n.extend({},g.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=g.localIdeographFontFamily,g.style&&this.setStyle(g.style,{localIdeographFontFamily:g.localIdeographFontFamily}),g.attributionControl&&this.addControl(new Ma({customAttribution:g.customAttribution})),g.maplibreLogo&&this.addControl(new mo,g.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new n.Event(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new n.Event(`${u.dataType}dataloading`,u))}),this.on("dataabort",u=>{this.fire(new n.Event("sourcedataabort",u))})}_getMapId(){return this._mapId}addControl(g,t){if(t===void 0&&(t=g.getDefaultPosition?g.getDefaultPosition():"top-right"),!g||!g.onAdd)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=g.onAdd(this);this._controls.push(g);const p=this._controlPositions[t];return t.indexOf("bottom")!==-1?p.insertBefore(u,p.firstChild):p.appendChild(u),this}removeControl(g){if(!g||!g.onRemove)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(g);return t>-1&&this._controls.splice(t,1),g.onRemove(this),this}hasControl(g){return this._controls.indexOf(g)>-1}calculateCameraOptionsFromTo(g,t,u,p){return p==null&&this.style.terrain&&(p=this.transform.getElevation(u,this.style.terrain)),super.calculateCameraOptionsFromTo(g,t,u,p)}resize(g){const t=this._containerDimensions(),u=t[0],p=t[1];this._resizeCanvas(u,p,this.getPixelRatio()),this.transform.resize(u,p),this.painter.resize(u,p,this.getPixelRatio());const y=!this._moving;return y&&(this.stop(),this.fire(new n.Event("movestart",g)).fire(new n.Event("move",g))),this.fire(new n.Event("resize",g)),y&&this.fire(new n.Event("moveend",g)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(g){const[t,u]=this._containerDimensions();this._pixelRatio=g,this._resizeCanvas(t,u,g),this.painter.resize(t,u,g)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(g){return this.transform.setMaxBounds(n.LngLatBounds.convert(g)),this._update()}setMinZoom(g){if((g=g??-2)>=-2&&g<=this.transform.maxZoom)return this.transform.minZoom=g,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=g,this._update(),this.getZoom()>g&&this.setZoom(g),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(g){if((g=g??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(g>=0&&g<=this.transform.maxPitch)return this.transform.minPitch=g,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(g>=this.transform.minPitch)return this.transform.maxPitch=g,this._update(),this.getPitch()>g&&this.setPitch(g),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(g){return this.transform.renderWorldCopies=g,this._update()}project(g){return this.transform.locationPoint(n.LngLat.convert(g),this.style&&this.style.terrain)}unproject(g){return this.transform.pointLocation(n.pointGeometry.convert(g),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(g,t,u){if(g==="mouseenter"||g==="mouseover"){let p=!1;return{layer:t,listener:u,delegates:{mousemove:x=>{const I=this.getLayer(t)?this.queryRenderedFeatures(x.point,{layers:[t]}):[];I.length?p||(p=!0,u.call(this,new an(g,this,x.originalEvent,{features:I}))):p=!1},mouseout:()=>{p=!1}}}}if(g==="mouseleave"||g==="mouseout"){let p=!1;return{layer:t,listener:u,delegates:{mousemove:I=>{(this.getLayer(t)?this.queryRenderedFeatures(I.point,{layers:[t]}):[]).length?p=!0:p&&(p=!1,u.call(this,new an(g,this,I.originalEvent)))},mouseout:I=>{p&&(p=!1,u.call(this,new an(g,this,I.originalEvent)))}}}}{const p=y=>{const x=this.getLayer(t)?this.queryRenderedFeatures(y.point,{layers:[t]}):[];x.length&&(y.features=x,u.call(this,y),delete y.features)};return{layer:t,listener:u,delegates:{[g]:p}}}}on(g,t,u){if(u===void 0)return super.on(g,t);const p=this._createDelegatedListener(g,t,u);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[g]=this._delegatedListeners[g]||[],this._delegatedListeners[g].push(p);for(const y in p.delegates)this.on(y,p.delegates[y]);return this}once(g,t,u){if(u===void 0)return super.once(g,t);const p=this._createDelegatedListener(g,t,u);for(const y in p.delegates)this.once(y,p.delegates[y]);return this}off(g,t,u){return u===void 0?super.off(g,t):(this._delegatedListeners&&this._delegatedListeners[g]&&(p=>{const y=this._delegatedListeners[g];for(let x=0;x{p?this.fire(new n.ErrorEvent(p)):y&&this._updateDiff(y,t)})}else typeof g=="object"&&this._updateDiff(g,t)}_updateDiff(g,t){try{this.style.setState(g)&&this._update(!0)}catch(u){n.warnOnce(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(g,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.warnOnce("There is no style added to the map.")}addSource(g,t){return this._lazyInitEmptyStyle(),this.style.addSource(g,t),this._update(!0)}isSourceLoaded(g){const t=this.style&&this.style.sourceCaches[g];if(t!==void 0)return t.loaded();this.fire(new n.ErrorEvent(new Error(`There is no source with ID '${g}'`)))}setTerrain(g){return this.style.setTerrain(g),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const g=this.style&&this.style.sourceCaches;for(const t in g){const u=g[t]._tiles;for(const p in u){const y=u[p];if(y.state!=="loaded"&&y.state!=="errored")return!1}}return!0}addSourceType(g,t,u){return this._lazyInitEmptyStyle(),this.style.addSourceType(g,t,u)}removeSource(g){return this.style.removeSource(g),this._update(!0)}getSource(g){return this.style.getSource(g)}addImage(g,t,{pixelRatio:u=1,sdf:p=!1,stretchX:y,stretchY:x,content:I}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||n.isImageBitmap(t)){const{width:R,height:O,data:V}=n.exported.getImageData(t);this.style.addImage(g,{data:new n.RGBAImage({width:R,height:O},V),pixelRatio:u,stretchX:y,stretchY:x,content:I,sdf:p,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new n.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:R,height:O,data:V}=t,G=t;this.style.addImage(g,{data:new n.RGBAImage({width:R,height:O},new Uint8Array(V)),pixelRatio:u,stretchX:y,stretchY:x,content:I,sdf:p,version:0,userImage:G}),G.onAdd&&G.onAdd(this,g)}}}updateImage(g,t){const u=this.style.getImage(g);if(!u)return this.fire(new n.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=t instanceof HTMLImageElement||n.isImageBitmap(t)?n.exported.getImageData(t):t,{width:y,height:x,data:I}=p;if(y===void 0||x===void 0)return this.fire(new n.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(y!==u.data.width||x!==u.data.height)return this.fire(new n.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const R=!(t instanceof HTMLImageElement||n.isImageBitmap(t));u.data.replace(I,R),this.style.updateImage(g,u)}hasImage(g){return g?!!this.style.getImage(g):(this.fire(new n.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(g){this.style.removeImage(g)}loadImage(g,t){n.getImage(this._requestManager.transformRequest(g,n.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(g,t){return this._lazyInitEmptyStyle(),this.style.addLayer(g,t),this._update(!0)}moveLayer(g,t){return this.style.moveLayer(g,t),this._update(!0)}removeLayer(g){return this.style.removeLayer(g),this._update(!0)}getLayer(g){return this.style.getLayer(g)}setLayerZoomRange(g,t,u){return this.style.setLayerZoomRange(g,t,u),this._update(!0)}setFilter(g,t,u={}){return this.style.setFilter(g,t,u),this._update(!0)}getFilter(g){return this.style.getFilter(g)}setPaintProperty(g,t,u,p={}){return this.style.setPaintProperty(g,t,u,p),this._update(!0)}getPaintProperty(g,t){return this.style.getPaintProperty(g,t)}setLayoutProperty(g,t,u,p={}){return this.style.setLayoutProperty(g,t,u,p),this._update(!0)}getLayoutProperty(g,t){return this.style.getLayoutProperty(g,t)}setLight(g,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(g,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(g,t){return this.style.setFeatureState(g,t),this._update()}removeFeatureState(g,t){return this.style.removeFeatureState(g,t),this._update()}getFeatureState(g){return this.style.getFeatureState(g)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let g=0,t=0;return this._container&&(g=this._container.clientWidth||400,t=this._container.clientHeight||300),[g,t]}_setupContainer(){const g=this._container;g.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=k.create("div","maplibregl-canvas-container mapboxgl-canvas-container",g);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=k.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const u=this._containerDimensions();this._resizeCanvas(u[0],u[1],this.getPixelRatio());const p=this._controlContainer=k.create("div","maplibregl-control-container mapboxgl-control-container",g),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(x=>{y[x]=k.create("div",`maplibregl-ctrl-${x} mapboxgl-ctrl-${x}`,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const g=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=k.create("div","maplibregl-cooperative-gesture-screen",g);let t="Control",u=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(u=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=` +`}),staticAttributes:p,staticUniforms:I}}class oa{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(t,u,p,y,x,I,R,O,V){this.context=t;let G=this.boundPaintVertexBuffers.length!==y.length;for(let K=0;!G&&K({u_depth:new n.Uniform1i(lt,yt.u_depth),u_terrain:new n.Uniform1i(lt,yt.u_terrain),u_terrain_dim:new n.Uniform1f(lt,yt.u_terrain_dim),u_terrain_matrix:new n.UniformMatrix4f(lt,yt.u_terrain_matrix),u_terrain_unpack:new n.Uniform4f(lt,yt.u_terrain_unpack),u_terrain_offset:new n.Uniform1f(lt,yt.u_terrain_offset),u_terrain_exaggeration:new n.Uniform1f(lt,yt.u_terrain_exaggeration)}))(t,st),this.binderUniforms=y?y.getUniforms(t,st):[]}draw(t,u,p,y,x,I,R,O,V,G,K,ie,me,fe,de,ze,De,Ve){const xe=t.gl;if(this.failedToCreate)return;if(t.program.set(this.program),t.setDepthMode(p),t.setStencilMode(y),t.setColorMode(x),t.setCullFace(I),O){t.activeTexture.set(xe.TEXTURE2),xe.bindTexture(xe.TEXTURE_2D,O.depthTexture),t.activeTexture.set(xe.TEXTURE3),xe.bindTexture(xe.TEXTURE_2D,O.texture);for(const Ze in this.terrainUniforms)this.terrainUniforms[Ze].set(O[Ze])}for(const Ze in this.fixedUniforms)this.fixedUniforms[Ze].set(R[Ze]);de&&de.setUniforms(t,this.binderUniforms,me,{zoom:fe});let Ye=0;switch(u){case xe.LINES:Ye=2;break;case xe.TRIANGLES:Ye=3;break;case xe.LINE_STRIP:Ye=1}for(const Ze of ie.get()){const st=Ze.vaos||(Ze.vaos={});(st[V]||(st[V]=new oa)).bind(t,this,G,de?de.getPaintVertexBuffers():[],K,Ze.vertexOffset,ze,De,Ve),xe.drawElements(u,Ze.primitiveLength*Ye,xe.UNSIGNED_SHORT,Ze.primitiveOffset*Ye*2)}}}function hs(g,t,u){const p=1/ui(u,1,t.transform.tileZoom),y=Math.pow(2,u.tileID.overscaledZ),x=u.tileSize*Math.pow(2,t.transform.tileZoom)/y,I=x*(u.tileID.canonical.x+u.tileID.wrap*y),R=x*u.tileID.canonical.y;return{u_image:0,u_texsize:u.imageAtlasTexture.size,u_scale:[p,g.fromScale,g.toScale],u_fade:g.t,u_pixel_coord_upper:[I>>16,R>>16],u_pixel_coord_lower:[65535&I,65535&R]}}const qn=(g,t,u,p)=>{const y=t.style.light,x=y.properties.get("position"),I=[x.x,x.y,x.z],R=n.create$1();y.properties.get("anchor")==="viewport"&&n.fromRotation(R,-t.transform.angle),n.transformMat3(I,I,R);const O=y.properties.get("color");return{u_matrix:g,u_lightpos:I,u_lightintensity:y.properties.get("intensity"),u_lightcolor:[O.r,O.g,O.b],u_vertical_gradient:+u,u_opacity:p}},Hu=(g,t,u,p,y,x,I)=>n.extend(qn(g,t,u,p),hs(x,t,I),{u_height_factor:-Math.pow(2,y.overscaledZ)/I.tileSize/8}),Xs=g=>({u_matrix:g}),Zo=(g,t,u,p)=>n.extend(Xs(g),hs(u,t,p)),uc=(g,t)=>({u_matrix:g,u_world:t}),hc=(g,t,u,p,y)=>n.extend(Zo(g,t,u,p),{u_world:y}),fc=(g,t,u,p)=>{const y=g.transform;let x,I;if(p.paint.get("circle-pitch-alignment")==="map"){const R=ui(u,1,y.zoom);x=!0,I=[R,R]}else x=!1,I=y.pixelsToGLUnits;return{u_camera_to_center_distance:y.cameraToCenterDistance,u_scale_with_map:+(p.paint.get("circle-pitch-scale")==="map"),u_matrix:g.translatePosMatrix(t.posMatrix,u,p.paint.get("circle-translate"),p.paint.get("circle-translate-anchor")),u_pitch_with_map:+x,u_device_pixel_ratio:g.pixelRatio,u_extrude_scale:I}},wa=(g,t,u)=>{const p=ui(u,1,t.zoom),y=Math.pow(2,t.zoom-u.tileID.overscaledZ),x=u.tileID.overscaleFactor();return{u_matrix:g,u_camera_to_center_distance:t.cameraToCenterDistance,u_pixels_to_tile_units:p,u_extrude_scale:[t.pixelsToGLUnits[0]/(p*y),t.pixelsToGLUnits[1]/(p*y)],u_overscale_factor:x}},fs=(g,t,u=1)=>({u_matrix:g,u_color:t,u_overlay:0,u_overlay_scale:u}),Ua=g=>({u_matrix:g}),Js=(g,t,u,p)=>({u_matrix:g,u_extrude_scale:ui(t,1,u),u_intensity:p});function Ys(g,t){const u=Math.pow(2,t.canonical.z),p=t.canonical.y;return[new n.MercatorCoordinate(0,p/u).toLngLat().lat,new n.MercatorCoordinate(0,(p+1)/u).toLngLat().lat]}const Va=(g,t,u,p)=>{const y=g.transform;return{u_matrix:ps(g,t,u,p),u_ratio:1/ui(t,1,y.zoom),u_device_pixel_ratio:g.pixelRatio,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},Ho=(g,t,u,p,y)=>n.extend(Va(g,t,u,y),{u_image:0,u_image_height:p}),Qs=(g,t,u,p,y)=>{const x=g.transform,I=ni(t,x);return{u_matrix:ps(g,t,u,y),u_texsize:t.imageAtlasTexture.size,u_ratio:1/ui(t,1,x.zoom),u_device_pixel_ratio:g.pixelRatio,u_image:0,u_scale:[I,p.fromScale,p.toScale],u_fade:p.t,u_units_to_pixels:[1/x.pixelsToGLUnits[0],1/x.pixelsToGLUnits[1]]}},ds=(g,t,u,p,y,x)=>{const I=g.lineAtlas,R=ni(t,g.transform),O=u.layout.get("line-cap")==="round",V=I.getDash(p.from,O),G=I.getDash(p.to,O),K=V.width*y.fromScale,ie=G.width*y.toScale;return n.extend(Va(g,t,u,x),{u_patternscale_a:[R/K,-V.height/2],u_patternscale_b:[R/ie,-G.height/2],u_sdfgamma:I.width/(256*Math.min(K,ie)*g.pixelRatio)/2,u_image:0,u_tex_y_a:V.y,u_tex_y_b:G.y,u_mix:y.t})};function ni(g,t){return 1/ui(g,1,t.tileZoom)}function ps(g,t,u,p){return g.translatePosMatrix(p?p.posMatrix:t.tileID.posMatrix,t,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const dc=(g,t,u,p,y)=>{return{u_matrix:g,u_tl_parent:t,u_scale_parent:u,u_buffer_scale:1,u_fade_t:p.mix,u_opacity:p.opacity*y.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:y.paint.get("raster-brightness-min"),u_brightness_high:y.paint.get("raster-brightness-max"),u_saturation_factor:(I=y.paint.get("raster-saturation"),I>0?1-1/(1.001-I):-I),u_contrast_factor:(x=y.paint.get("raster-contrast"),x>0?1/(1-x):1+x),u_spin_weights:pc(y.paint.get("raster-hue-rotate"))};var x,I};function pc(g){g*=Math.PI/180;const t=Math.sin(g),u=Math.cos(g);return[(2*u+1)/3,(-Math.sqrt(3)*t-u+1)/3,(Math.sqrt(3)*t-u+1)/3]}const Wo=(g,t,u,p,y,x,I,R,O,V)=>{const G=y.transform;return{u_is_size_zoom_constant:+(g==="constant"||g==="source"),u_is_size_feature_constant:+(g==="constant"||g==="camera"),u_size_t:t?t.uSizeT:0,u_size:t?t.uSize:0,u_camera_to_center_distance:G.cameraToCenterDistance,u_pitch:G.pitch/360*2*Math.PI,u_rotate_symbol:+u,u_aspect_ratio:G.width/G.height,u_fade_change:y.options.fadeDuration?y.symbolFadeChange:1,u_matrix:x,u_label_plane_matrix:I,u_coord_matrix:R,u_is_text:+O,u_pitch_with_map:+p,u_texsize:V,u_texture:0}},eo=(g,t,u,p,y,x,I,R,O,V,G)=>{const K=y.transform;return n.extend(Wo(g,t,u,p,y,x,I,R,O,V),{u_gamma_scale:p?Math.cos(K._pitch)*K.cameraToCenterDistance:1,u_device_pixel_ratio:y.pixelRatio,u_is_halo:+G})},mc=(g,t,u,p,y,x,I,R,O,V)=>n.extend(eo(g,t,u,p,y,x,I,R,!0,O,!0),{u_texsize_icon:V,u_texture_icon:1}),Wu=(g,t,u)=>({u_matrix:g,u_opacity:t,u_color:u}),Ku=(g,t,u,p,y,x)=>n.extend(function(I,R,O,V){const G=O.imageManager.getPattern(I.from.toString()),K=O.imageManager.getPattern(I.to.toString()),{width:ie,height:me}=O.imageManager.getPixelSize(),fe=Math.pow(2,V.tileID.overscaledZ),de=V.tileSize*Math.pow(2,O.transform.tileZoom)/fe,ze=de*(V.tileID.canonical.x+V.tileID.wrap*fe),De=de*V.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:G.tl,u_pattern_br_a:G.br,u_pattern_tl_b:K.tl,u_pattern_br_b:K.br,u_texsize:[ie,me],u_mix:R.t,u_pattern_size_a:G.displaySize,u_pattern_size_b:K.displaySize,u_scale_a:R.fromScale,u_scale_b:R.toScale,u_tile_units_to_pixels:1/ui(V,1,O.transform.tileZoom),u_pixel_coord_upper:[ze>>16,De>>16],u_pixel_coord_lower:[65535&ze,65535&De]}}(p,x,u,y),{u_matrix:g,u_opacity:t}),Ko={fillExtrusion:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_lightpos:new n.Uniform3f(g,t.u_lightpos),u_lightintensity:new n.Uniform1f(g,t.u_lightintensity),u_lightcolor:new n.Uniform3f(g,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(g,t.u_vertical_gradient),u_opacity:new n.Uniform1f(g,t.u_opacity)}),fillExtrusionPattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_lightpos:new n.Uniform3f(g,t.u_lightpos),u_lightintensity:new n.Uniform1f(g,t.u_lightintensity),u_lightcolor:new n.Uniform3f(g,t.u_lightcolor),u_vertical_gradient:new n.Uniform1f(g,t.u_vertical_gradient),u_height_factor:new n.Uniform1f(g,t.u_height_factor),u_image:new n.Uniform1i(g,t.u_image),u_texsize:new n.Uniform2f(g,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade),u_opacity:new n.Uniform1f(g,t.u_opacity)}),fill:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),fillPattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_image:new n.Uniform1i(g,t.u_image),u_texsize:new n.Uniform2f(g,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade)}),fillOutline:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_world:new n.Uniform2f(g,t.u_world)}),fillOutlinePattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_world:new n.Uniform2f(g,t.u_world),u_image:new n.Uniform1i(g,t.u_image),u_texsize:new n.Uniform2f(g,t.u_texsize),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade)}),circle:(g,t)=>({u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_scale_with_map:new n.Uniform1i(g,t.u_scale_with_map),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_extrude_scale:new n.Uniform2f(g,t.u_extrude_scale),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),collisionBox:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pixels_to_tile_units:new n.Uniform1f(g,t.u_pixels_to_tile_units),u_extrude_scale:new n.Uniform2f(g,t.u_extrude_scale),u_overscale_factor:new n.Uniform1f(g,t.u_overscale_factor)}),collisionCircle:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_inv_matrix:new n.UniformMatrix4f(g,t.u_inv_matrix),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_viewport_size:new n.Uniform2f(g,t.u_viewport_size)}),debug:(g,t)=>({u_color:new n.UniformColor(g,t.u_color),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_overlay:new n.Uniform1i(g,t.u_overlay),u_overlay_scale:new n.Uniform1f(g,t.u_overlay_scale)}),clippingMask:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),heatmap:(g,t)=>({u_extrude_scale:new n.Uniform1f(g,t.u_extrude_scale),u_intensity:new n.Uniform1f(g,t.u_intensity),u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),heatmapTexture:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_world:new n.Uniform2f(g,t.u_world),u_image:new n.Uniform1i(g,t.u_image),u_color_ramp:new n.Uniform1i(g,t.u_color_ramp),u_opacity:new n.Uniform1f(g,t.u_opacity)}),hillshade:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_image:new n.Uniform1i(g,t.u_image),u_latrange:new n.Uniform2f(g,t.u_latrange),u_light:new n.Uniform2f(g,t.u_light),u_shadow:new n.UniformColor(g,t.u_shadow),u_highlight:new n.UniformColor(g,t.u_highlight),u_accent:new n.UniformColor(g,t.u_accent)}),hillshadePrepare:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_image:new n.Uniform1i(g,t.u_image),u_dimension:new n.Uniform2f(g,t.u_dimension),u_zoom:new n.Uniform1f(g,t.u_zoom),u_unpack:new n.Uniform4f(g,t.u_unpack)}),line:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels)}),lineGradient:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels),u_image:new n.Uniform1i(g,t.u_image),u_image_height:new n.Uniform1f(g,t.u_image_height)}),linePattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_texsize:new n.Uniform2f(g,t.u_texsize),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_image:new n.Uniform1i(g,t.u_image),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels),u_scale:new n.Uniform3f(g,t.u_scale),u_fade:new n.Uniform1f(g,t.u_fade)}),lineSDF:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_ratio:new n.Uniform1f(g,t.u_ratio),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_units_to_pixels:new n.Uniform2f(g,t.u_units_to_pixels),u_patternscale_a:new n.Uniform2f(g,t.u_patternscale_a),u_patternscale_b:new n.Uniform2f(g,t.u_patternscale_b),u_sdfgamma:new n.Uniform1f(g,t.u_sdfgamma),u_image:new n.Uniform1i(g,t.u_image),u_tex_y_a:new n.Uniform1f(g,t.u_tex_y_a),u_tex_y_b:new n.Uniform1f(g,t.u_tex_y_b),u_mix:new n.Uniform1f(g,t.u_mix)}),raster:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_tl_parent:new n.Uniform2f(g,t.u_tl_parent),u_scale_parent:new n.Uniform1f(g,t.u_scale_parent),u_buffer_scale:new n.Uniform1f(g,t.u_buffer_scale),u_fade_t:new n.Uniform1f(g,t.u_fade_t),u_opacity:new n.Uniform1f(g,t.u_opacity),u_image0:new n.Uniform1i(g,t.u_image0),u_image1:new n.Uniform1i(g,t.u_image1),u_brightness_low:new n.Uniform1f(g,t.u_brightness_low),u_brightness_high:new n.Uniform1f(g,t.u_brightness_high),u_saturation_factor:new n.Uniform1f(g,t.u_saturation_factor),u_contrast_factor:new n.Uniform1f(g,t.u_contrast_factor),u_spin_weights:new n.Uniform3f(g,t.u_spin_weights)}),symbolIcon:(g,t)=>({u_is_size_zoom_constant:new n.Uniform1i(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(g,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(g,t.u_size_t),u_size:new n.Uniform1f(g,t.u_size),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(g,t.u_pitch),u_rotate_symbol:new n.Uniform1i(g,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(g,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(g,t.u_fade_change),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(g,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(g,t.u_coord_matrix),u_is_text:new n.Uniform1i(g,t.u_is_text),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_texsize:new n.Uniform2f(g,t.u_texsize),u_texture:new n.Uniform1i(g,t.u_texture)}),symbolSDF:(g,t)=>({u_is_size_zoom_constant:new n.Uniform1i(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(g,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(g,t.u_size_t),u_size:new n.Uniform1f(g,t.u_size),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(g,t.u_pitch),u_rotate_symbol:new n.Uniform1i(g,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(g,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(g,t.u_fade_change),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(g,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(g,t.u_coord_matrix),u_is_text:new n.Uniform1i(g,t.u_is_text),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_texsize:new n.Uniform2f(g,t.u_texsize),u_texture:new n.Uniform1i(g,t.u_texture),u_gamma_scale:new n.Uniform1f(g,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(g,t.u_is_halo)}),symbolTextAndIcon:(g,t)=>({u_is_size_zoom_constant:new n.Uniform1i(g,t.u_is_size_zoom_constant),u_is_size_feature_constant:new n.Uniform1i(g,t.u_is_size_feature_constant),u_size_t:new n.Uniform1f(g,t.u_size_t),u_size:new n.Uniform1f(g,t.u_size),u_camera_to_center_distance:new n.Uniform1f(g,t.u_camera_to_center_distance),u_pitch:new n.Uniform1f(g,t.u_pitch),u_rotate_symbol:new n.Uniform1i(g,t.u_rotate_symbol),u_aspect_ratio:new n.Uniform1f(g,t.u_aspect_ratio),u_fade_change:new n.Uniform1f(g,t.u_fade_change),u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_label_plane_matrix:new n.UniformMatrix4f(g,t.u_label_plane_matrix),u_coord_matrix:new n.UniformMatrix4f(g,t.u_coord_matrix),u_is_text:new n.Uniform1i(g,t.u_is_text),u_pitch_with_map:new n.Uniform1i(g,t.u_pitch_with_map),u_texsize:new n.Uniform2f(g,t.u_texsize),u_texsize_icon:new n.Uniform2f(g,t.u_texsize_icon),u_texture:new n.Uniform1i(g,t.u_texture),u_texture_icon:new n.Uniform1i(g,t.u_texture_icon),u_gamma_scale:new n.Uniform1f(g,t.u_gamma_scale),u_device_pixel_ratio:new n.Uniform1f(g,t.u_device_pixel_ratio),u_is_halo:new n.Uniform1i(g,t.u_is_halo)}),background:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_opacity:new n.Uniform1f(g,t.u_opacity),u_color:new n.UniformColor(g,t.u_color)}),backgroundPattern:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_opacity:new n.Uniform1f(g,t.u_opacity),u_image:new n.Uniform1i(g,t.u_image),u_pattern_tl_a:new n.Uniform2f(g,t.u_pattern_tl_a),u_pattern_br_a:new n.Uniform2f(g,t.u_pattern_br_a),u_pattern_tl_b:new n.Uniform2f(g,t.u_pattern_tl_b),u_pattern_br_b:new n.Uniform2f(g,t.u_pattern_br_b),u_texsize:new n.Uniform2f(g,t.u_texsize),u_mix:new n.Uniform1f(g,t.u_mix),u_pattern_size_a:new n.Uniform2f(g,t.u_pattern_size_a),u_pattern_size_b:new n.Uniform2f(g,t.u_pattern_size_b),u_scale_a:new n.Uniform1f(g,t.u_scale_a),u_scale_b:new n.Uniform1f(g,t.u_scale_b),u_pixel_coord_upper:new n.Uniform2f(g,t.u_pixel_coord_upper),u_pixel_coord_lower:new n.Uniform2f(g,t.u_pixel_coord_lower),u_tile_units_to_pixels:new n.Uniform1f(g,t.u_tile_units_to_pixels)}),terrain:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_texture:new n.Uniform1i(g,t.u_texture)}),terrainDepth:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix)}),terrainCoords:(g,t)=>({u_matrix:new n.UniformMatrix4f(g,t.u_matrix),u_texture:new n.Uniform1i(g,t.u_texture),u_terrain_coords_id:new n.Uniform1f(g,t.u_terrain_coords_id)})};class Xo{constructor(t,u,p){this.context=t;const y=t.gl;this.buffer=y.createBuffer(),this.dynamicDraw=!!p,this.context.unbindVAO(),t.bindElementBuffer.set(this.buffer),y.bufferData(y.ELEMENT_ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(t){const u=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),u.bufferSubData(u.ELEMENT_ARRAY_BUFFER,0,t.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Jo={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Yo{constructor(t,u,p,y){this.length=u.length,this.attributes=p,this.itemSize=u.bytesPerElement,this.dynamicDraw=y,this.context=t;const x=t.gl;this.buffer=x.createBuffer(),t.bindVertexBuffer.set(this.buffer),x.bufferData(x.ARRAY_BUFFER,u.arrayBuffer,this.dynamicDraw?x.DYNAMIC_DRAW:x.STATIC_DRAW),this.dynamicDraw||delete u.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(t){if(t.length!==this.length)throw new Error(`Length of new data is ${t.length}, which doesn't match current length of ${this.length}`);const u=this.context.gl;this.bind(),u.bufferSubData(u.ARRAY_BUFFER,0,t.arrayBuffer)}enableAttributes(t,u){for(let p=0;p0){const Vt=n.create(),Dt=lt;n.mul(Vt,st.placementInvProjMatrix,g.transform.glCoordMatrix),n.mul(Vt,Vt,st.placementViewportMatrix),G.push({circleArray:at,circleOffset:ie,transform:Dt,invTransform:Vt,coord:Ye}),K+=at.length/4,ie=K}yt&&V.draw(R,O.LINES,Cr.disabled,Yr.disabled,g.colorModeForRenderPass(),ai.disabled,wa(lt,g.transform,Ze),g.style.terrain&&g.style.terrain.getTerrainData(Ye),u.id,yt.layoutVertexBuffer,yt.indexBuffer,yt.segments,null,g.transform.zoom,null,null,yt.collisionVertexBuffer)}if(!I||!G.length)return;const me=g.useProgram("collisionCircle"),fe=new n.CollisionCircleLayoutArray;fe.resize(4*K),fe._trim();let de=0;for(const xe of G)for(let Ye=0;Ye=0&&(fe[ze.associatedIconIndex]={shiftedAnchor:gr,angle:br})}else sr(ze.numGlyphs,ie)}if(V){me.clear();const de=g.icon.placedSymbolArray;for(let ze=0;zeg.style.terrain.getElevation(yt,xl,Ja):null,Ia=u.layout.get("text-rotation-alignment")==="map";Ei(Vt,yt.posMatrix,g,y,yn,Yi,ze,V,Ia,vn)}const ki=g.translatePosMatrix(yt.posMatrix,at,x,I),Er=De||y&&st||go?ih:yn,$r=g.translatePosMatrix(Yi,at,x,I,!0),Ai=gr&&u.paint.get(y?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Pi;Pi=gr?Vt.iconsInText?mc(br.kind,Gr,Ve,ze,g,ki,Er,$r,Pr,kn):eo(br.kind,Gr,Ve,ze,g,ki,Er,$r,y,Pr,!0):Wo(br.kind,Gr,Ve,ze,g,ki,Er,$r,y,Pr);const oi={program:qr,buffers:Dt,uniformValues:Pi,atlasTexture:Hr,atlasTextureIcon:Ln,atlasInterpolation:Ci,atlasInterpolationIcon:Rn,isSDF:gr,hasHalo:Ai};if(xe&&Vt.canOverlap){Ye=!0;const vn=Dt.segments.get();for(const Ia of vn)lt.push({segments:new n.SegmentVector([Ia]),sortKey:Ia.sortKey,state:oi,terrainData:Ar})}else lt.push({segments:Dt.segments,sortKey:0,state:oi,terrainData:Ar})}Ye&<.sort((yt,at)=>yt.sortKey-at.sortKey);for(const yt of lt){const at=yt.state;if(ie.activeTexture.set(me.TEXTURE0),at.atlasTexture.bind(at.atlasInterpolation,me.CLAMP_TO_EDGE),at.atlasTextureIcon&&(ie.activeTexture.set(me.TEXTURE1),at.atlasTextureIcon&&at.atlasTextureIcon.bind(at.atlasInterpolationIcon,me.CLAMP_TO_EDGE)),at.isSDF){const Vt=at.uniformValues;at.hasHalo&&(Vt.u_is_halo=1,ys(at.buffers,yt.segments,u,g,at.program,Ze,G,K,Vt,yt.terrainData)),Vt.u_is_halo=0}ys(at.buffers,yt.segments,u,g,at.program,Ze,G,K,at.uniformValues,yt.terrainData)}}function ys(g,t,u,p,y,x,I,R,O,V){const G=p.context;y.draw(G,G.gl.TRIANGLES,x,I,R,ai.disabled,O,V,u.id,g.layoutVertexBuffer,g.indexBuffer,t,u.paint,p.transform.zoom,g.programConfigurations.get(u.id),g.dynamicLayoutVertexBuffer,g.opacityVertexBuffer)}function vs(g,t,u,p,y,x,I){const R=g.context.gl,O=u.paint.get("fill-pattern"),V=O&&O.constantOr(1),G=u.getCrossfadeParameters();let K,ie,me,fe,de;I?(ie=V&&!u.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",K=R.LINES):(ie=V?"fillPattern":"fill",K=R.TRIANGLES);for(const ze of p){const De=t.getTile(ze);if(V&&!De.patternsLoaded())continue;const Ve=De.getBucket(u);if(!Ve)continue;const xe=Ve.programConfigurations.get(u.id),Ye=g.useProgram(ie,xe),Ze=g.style.terrain&&g.style.terrain.getTerrainData(ze);V&&(g.context.activeTexture.set(R.TEXTURE0),De.imageAtlasTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE),xe.updatePaintBuffers(G));const st=O.constantOr(null);if(st&&De.imageAtlas){const at=De.imageAtlas,Vt=at.patternPositions[st.to.toString()],Dt=at.patternPositions[st.from.toString()];Vt&&Dt&&xe.setConstantPatternPositions(Vt,Dt)}const lt=Ze?ze:null,yt=g.translatePosMatrix(lt?lt.posMatrix:ze.posMatrix,De,u.paint.get("fill-translate"),u.paint.get("fill-translate-anchor"));if(I){fe=Ve.indexBuffer2,de=Ve.segments2;const at=[R.drawingBufferWidth,R.drawingBufferHeight];me=ie==="fillOutlinePattern"&&V?hc(yt,g,G,De,at):uc(yt,at)}else fe=Ve.indexBuffer,de=Ve.segments,me=V?Zo(yt,g,G,De):Xs(yt);Ye.draw(g.context,K,y,g.stencilModeForClipping(ze),x,ai.disabled,me,Ze,u.id,Ve.layoutVertexBuffer,fe,de,u.paint,g.transform.zoom,xe)}}function bs(g,t,u,p,y,x,I){const R=g.context,O=R.gl,V=u.paint.get("fill-extrusion-pattern"),G=V.constantOr(1),K=u.getCrossfadeParameters(),ie=u.paint.get("fill-extrusion-opacity");for(const me of p){const fe=t.getTile(me),de=fe.getBucket(u);if(!de)continue;const ze=g.style.terrain&&g.style.terrain.getTerrainData(me),De=de.programConfigurations.get(u.id),Ve=g.useProgram(G?"fillExtrusionPattern":"fillExtrusion",De);G&&(g.context.activeTexture.set(O.TEXTURE0),fe.imageAtlasTexture.bind(O.LINEAR,O.CLAMP_TO_EDGE),De.updatePaintBuffers(K));const xe=V.constantOr(null);if(xe&&fe.imageAtlas){const lt=fe.imageAtlas,yt=lt.patternPositions[xe.to.toString()],at=lt.patternPositions[xe.from.toString()];yt&&at&&De.setConstantPatternPositions(yt,at)}const Ye=g.translatePosMatrix(me.posMatrix,fe,u.paint.get("fill-extrusion-translate"),u.paint.get("fill-extrusion-translate-anchor")),Ze=u.paint.get("fill-extrusion-vertical-gradient"),st=G?Hu(Ye,g,Ze,ie,me,K,fe):qn(Ye,g,Ze,ie);Ve.draw(R,R.gl.TRIANGLES,y,x,I,ai.backCCW,st,ze,u.id,de.layoutVertexBuffer,de.indexBuffer,de.segments,u.paint,g.transform.zoom,De,g.style.terrain&&de.centroidVertexBuffer)}}function ol(g,t,u,p,y,x,I){const R=g.context,O=R.gl,V=u.fbo;if(!V)return;const G=g.useProgram("hillshade"),K=g.style.terrain&&g.style.terrain.getTerrainData(t);R.activeTexture.set(O.TEXTURE0),O.bindTexture(O.TEXTURE_2D,V.colorAttachment.get()),G.draw(R,O.TRIANGLES,y,x,I,ai.disabled,((ie,me,fe,de)=>{const ze=fe.paint.get("hillshade-shadow-color"),De=fe.paint.get("hillshade-highlight-color"),Ve=fe.paint.get("hillshade-accent-color");let xe=fe.paint.get("hillshade-illumination-direction")*(Math.PI/180);fe.paint.get("hillshade-illumination-anchor")==="viewport"&&(xe-=ie.transform.angle);const Ye=!ie.options.moving;return{u_matrix:de?de.posMatrix:ie.transform.calculatePosMatrix(me.tileID.toUnwrapped(),Ye),u_image:0,u_latrange:Ys(0,me.tileID),u_light:[fe.paint.get("hillshade-exaggeration"),xe],u_shadow:ze,u_highlight:De,u_accent:Ve}})(g,u,p,K?t:null),K,p.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments)}function Sc(g,t,u,p,y,x){const I=g.context,R=I.gl,O=t.dem;if(O&&O.data){const V=O.dim,G=O.stride,K=O.getPixels();if(I.activeTexture.set(R.TEXTURE1),I.pixelStoreUnpackPremultiplyAlpha.set(!1),t.demTexture=t.demTexture||g.getTileTexture(G),t.demTexture){const me=t.demTexture;me.update(K,{premultiply:!1}),me.bind(R.NEAREST,R.CLAMP_TO_EDGE)}else t.demTexture=new T(I,K,R.RGBA,{premultiply:!1}),t.demTexture.bind(R.NEAREST,R.CLAMP_TO_EDGE);I.activeTexture.set(R.TEXTURE0);let ie=t.fbo;if(!ie){const me=new T(I,{width:V,height:V,data:null},R.RGBA);me.bind(R.LINEAR,R.CLAMP_TO_EDGE),ie=t.fbo=I.createFramebuffer(V,V,!0),ie.colorAttachment.set(me.texture)}I.bindFramebuffer.set(ie.framebuffer),I.viewport.set([0,0,V,V]),g.useProgram("hillshadePrepare").draw(I,R.TRIANGLES,p,y,x,ai.disabled,((me,fe)=>{const de=fe.stride,ze=n.create();return n.ortho(ze,0,n.EXTENT,-n.EXTENT,0,0,1),n.translate(ze,ze,[0,-n.EXTENT,0]),{u_matrix:ze,u_image:1,u_dimension:[de,de],u_zoom:me.overscaledZ,u_unpack:fe.getUnpackVector()}})(t.tileID,O),null,u.id,g.rasterBoundsBuffer,g.quadTriangleIndexBuffer,g.rasterBoundsSegments),t.needsHillshadePrepare=!1}}function lo(g,t,u,p,y,x){const I=p.paint.get("raster-fade-duration");if(!x&&I>0){const R=n.exported.now(),O=(R-g.timeAdded)/I,V=t?(R-t.timeAdded)/I:-1,G=u.getSource(),K=y.coveringZoomLevel({tileSize:G.tileSize,roundZoom:G.roundZoom}),ie=!t||Math.abs(t.tileID.overscaledZ-K)>Math.abs(g.tileID.overscaledZ-K),me=ie&&g.refreshedUponExpiration?1:n.clamp(ie?O:1-V,0,1);return g.refreshedUponExpiration&&O>=1&&(g.refreshedUponExpiration=!1),t?{opacity:1,mix:1-me}:{opacity:me,mix:0}}return{opacity:1,mix:0}}const co=new n.Color(1,0,0,1),En=new n.Color(0,1,0,1),Tc=new n.Color(0,0,1,1),ll=new n.Color(1,0,1,1),Ic=new n.Color(0,1,1,1);function ka(g,t,u,p){Za(g,0,t+u/2,g.transform.width,u,p)}function xs(g,t,u,p){Za(g,t-u/2,0,u,g.transform.height,p)}function Za(g,t,u,p,y,x){const I=g.context,R=I.gl;R.enable(R.SCISSOR_TEST),R.scissor(t*g.pixelRatio,u*g.pixelRatio,p*g.pixelRatio,y*g.pixelRatio),I.clear({color:x}),R.disable(R.SCISSOR_TEST)}function sh(g,t,u){const p=g.context,y=p.gl,x=u.posMatrix,I=g.useProgram("debug"),R=Cr.disabled,O=Yr.disabled,V=g.colorModeForRenderPass(),G="$debug",K=g.style.terrain&&g.style.terrain.getTerrainData(u);p.activeTexture.set(y.TEXTURE0),g.emptyTexture.bind(y.LINEAR,y.CLAMP_TO_EDGE);const ie=t.getTileByID(u.key).latestRawTileData,me=Math.floor((ie&&ie.byteLength||0)/1024),fe=t.getTile(u).tileSize,de=512/Math.min(fe,512)*(u.overscaledZ/g.transform.zoom)*.5;let ze=u.canonical.toString();u.overscaledZ!==u.canonical.z&&(ze+=` => ${u.overscaledZ}`),function(De,Ve){De.initDebugOverlayCanvas();const xe=De.debugOverlayCanvas,Ye=De.context.gl,Ze=De.debugOverlayCanvas.getContext("2d");Ze.clearRect(0,0,xe.width,xe.height),Ze.shadowColor="white",Ze.shadowBlur=2,Ze.lineWidth=1.5,Ze.strokeStyle="white",Ze.textBaseline="top",Ze.font="bold 36px Open Sans, sans-serif",Ze.fillText(Ve,5,5),Ze.strokeText(Ve,5,5),De.debugOverlayTexture.update(xe),De.debugOverlayTexture.bind(Ye.LINEAR,Ye.CLAMP_TO_EDGE)}(g,`${ze} ${me}kB`),I.draw(p,y.TRIANGLES,R,O,ei.alphaBlended,ai.disabled,fs(x,n.Color.transparent,de),null,G,g.debugBuffer,g.quadTriangleIndexBuffer,g.debugSegments),I.draw(p,y.LINE_STRIP,R,O,V,ai.disabled,fs(x,n.Color.red),K,G,g.debugBuffer,g.tileBorderIndexBuffer,g.debugSegments)}function uo(g,t,u){const p=g.context,y=p.gl,x=g.colorModeForRenderPass(),I=new Cr(y.LEQUAL,Cr.ReadWrite,g.depthRangeFor3D),R=g.useProgram("terrain"),O=t.getTerrainMesh(),V=t.getTerrainData(u.tileID);p.bindFramebuffer.set(null),p.viewport.set([0,0,g.width,g.height]),p.activeTexture.set(y.TEXTURE0),y.bindTexture(y.TEXTURE_2D,t.getRTTFramebuffer().colorAttachment.get());const G=g.transform.calculatePosMatrix(u.tileID.toUnwrapped());R.draw(p,y.TRIANGLES,I,Yr.disabled,x,ai.backCCW,{u_matrix:G,u_texture:0},V,"terrain",O.vertexBuffer,O.indexBuffer,O.segments)}function Cc(g,t,u,p){const y=g.context,x=u.tileSize*t.qualityFactor;u.textures[p]||(u.textures[p]=g.getTileTexture(x)||new T(y,{width:x,height:x,data:null},y.gl.RGBA),u.textures[p].bind(y.gl.LINEAR,y.gl.CLAMP_TO_EDGE),p===0&&t.sourceCache.renderHistory.unshift(u.tileID.key));const I=t.getRTTFramebuffer();I.colorAttachment.set(u.textures[p].texture),y.bindFramebuffer.set(I.framebuffer),y.viewport.set([0,0,x,x])}class Ac{constructor(t){this._coordsDescendingInv={},this._coordsDescendingInvStr={},this.painter=t,this._renderToTexture={background:!0,fill:!0,line:!0,raster:!0},this._coordsDescendingInv={},this._coordsDescendingInvStr={},this._stacks=[],this._prevType=null,this._rerender={},this._renderableTiles=t.style.terrain.sourceCache.getRenderableTiles(),this._init()}_init(){const t=this.painter.style,u=t.terrain;for(const p in t.sourceCaches){this._coordsDescendingInv[p]={};const y=t.sourceCaches[p].getVisibleCoordinates();for(const x of y){const I=u.sourceCache.getTerrainCoords(x);for(const R in I)this._coordsDescendingInv[p][R]||(this._coordsDescendingInv[p][R]=[]),this._coordsDescendingInv[p][R].push(I[R])}}for(const p of t._order){const y=t._layers[p],x=y.source;if(this._renderToTexture[y.type]&&!this._coordsDescendingInvStr[x]){this._coordsDescendingInvStr[x]={};for(const I in this._coordsDescendingInv[x])this._coordsDescendingInvStr[x][I]=this._coordsDescendingInv[x][I].map(R=>R.key).sort().join()}}return this._renderableTiles.forEach(p=>{for(const y in this._coordsDescendingInvStr){const x=this._coordsDescendingInvStr[y][p.tileID.key];x&&x!==p.textureCoords[y]&&p.clearTextures(this.painter),u.needsRerender(y,p.tileID)&&p.clearTextures(this.painter)}this._rerender[p.tileID.key]=!p.textures.length}),u.clearRerenderCache(),u.sourceCache.removeOutdated(this.painter),this}renderLayer(t){const u=t.type,p=this.painter,y=p.style._order,x=p.currentLayer,I=x+1===y.length;if(this._renderToTexture[u]&&(this._prevType&&this._renderToTexture[this._prevType]||this._stacks.push([]),this._prevType=u,this._stacks[this._stacks.length-1].push(y[x]),!I))return!0;if(this._renderToTexture[this._prevType]||u==="hillshade"||this._renderToTexture[u]&&I){this._prevType=u;const R=this._stacks.length-1,O=this._stacks[R]||[];for(const V of this._renderableTiles){if(Cc(p,p.style.terrain,V,R),this._rerender[V.tileID.key]){p.context.clear({color:n.Color.transparent});for(let G=0;GO.style.terrain.getElevation(De,at,Vt):null)}}}(p,g,u,t,u.layout.get("text-rotation-alignment"),u.layout.get("text-pitch-alignment"),y),u.paint.get("icon-opacity").constantOr(1)!==0&&oo(g,t,u,p,!1,u.paint.get("icon-translate"),u.paint.get("icon-translate-anchor"),u.layout.get("icon-rotation-alignment"),u.layout.get("icon-pitch-alignment"),u.layout.get("icon-keep-upright"),x,I),u.paint.get("text-opacity").constantOr(1)!==0&&oo(g,t,u,p,!0,u.paint.get("text-translate"),u.paint.get("text-translate-anchor"),u.layout.get("text-rotation-alignment"),u.layout.get("text-pitch-alignment"),u.layout.get("text-keep-upright"),x,I),t.map.showCollisionBoxes&&(Ga(g,t,u,p,u.paint.get("text-translate"),u.paint.get("text-translate-anchor"),!0),Ga(g,t,u,p,u.paint.get("icon-translate"),u.paint.get("icon-translate-anchor"),!1))},circle:function(g,t,u,p){if(g.renderPass!=="translucent")return;const y=u.paint.get("circle-opacity"),x=u.paint.get("circle-stroke-width"),I=u.paint.get("circle-stroke-opacity"),R=!u.layout.get("circle-sort-key").isConstant();if(y.constantOr(1)===0&&(x.constantOr(1)===0||I.constantOr(1)===0))return;const O=g.context,V=O.gl,G=g.depthModeForSublayer(0,Cr.ReadOnly),K=Yr.disabled,ie=g.colorModeForRenderPass(),me=[];for(let fe=0;fefe.sortKey-de.sortKey);for(const fe of me){const{programConfiguration:de,program:ze,layoutVertexBuffer:De,indexBuffer:Ve,uniformValues:xe,terrainData:Ye}=fe.state;ze.draw(O,V.TRIANGLES,G,K,ie,ai.disabled,xe,Ye,u.id,De,Ve,fe.segments,u.paint,g.transform.zoom,de)}},heatmap:function(g,t,u,p){if(u.paint.get("heatmap-opacity")!==0)if(g.renderPass==="offscreen"){const y=g.context,x=y.gl,I=Yr.disabled,R=new ei([x.ONE,x.ONE],n.Color.transparent,[!0,!0,!0,!0]);(function(O,V,G){const K=O.gl;O.activeTexture.set(K.TEXTURE1),O.viewport.set([0,0,V.width/4,V.height/4]);let ie=G.heatmapFbo;if(ie)K.bindTexture(K.TEXTURE_2D,ie.colorAttachment.get()),O.bindFramebuffer.set(ie.framebuffer);else{const me=K.createTexture();K.bindTexture(K.TEXTURE_2D,me),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_S,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_WRAP_T,K.CLAMP_TO_EDGE),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MIN_FILTER,K.LINEAR),K.texParameteri(K.TEXTURE_2D,K.TEXTURE_MAG_FILTER,K.LINEAR),ie=G.heatmapFbo=O.createFramebuffer(V.width/4,V.height/4,!1),function(fe,de,ze,De){const Ve=fe.gl;Ve.texImage2D(Ve.TEXTURE_2D,0,Ve.RGBA,de.width/4,de.height/4,0,Ve.RGBA,fe.extRenderToTextureHalfFloat?fe.extTextureHalfFloat.HALF_FLOAT_OES:Ve.UNSIGNED_BYTE,null),De.colorAttachment.set(ze)}(O,V,me,ie)}})(y,g,u),y.clear({color:n.Color.transparent});for(let O=0;O{const fe=n.create();n.ortho(fe,0,G.width,G.height,0,0,1);const de=G.context.gl;return{u_matrix:fe,u_world:[de.drawingBufferWidth,de.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:K.paint.get("heatmap-opacity")}})(y,x),null,x.id,y.viewportBuffer,y.quadTriangleIndexBuffer,y.viewportSegments,x.paint,y.transform.zoom)}(g,u))},line:function(g,t,u,p){if(g.renderPass!=="translucent")return;const y=u.paint.get("line-opacity"),x=u.paint.get("line-width");if(y.constantOr(1)===0||x.constantOr(1)===0)return;const I=g.depthModeForSublayer(0,Cr.ReadOnly),R=g.colorModeForRenderPass(),O=u.paint.get("line-dasharray"),V=u.paint.get("line-pattern"),G=V.constantOr(1),K=u.paint.get("line-gradient"),ie=u.getCrossfadeParameters(),me=G?"linePattern":O?"lineSDF":K?"lineGradient":"line",fe=g.context,de=fe.gl;let ze=!0;for(const De of p){const Ve=t.getTile(De);if(G&&!Ve.patternsLoaded())continue;const xe=Ve.getBucket(u);if(!xe)continue;const Ye=xe.programConfigurations.get(u.id),Ze=g.context.program.get(),st=g.useProgram(me,Ye),lt=ze||st.program!==Ze,yt=g.style.terrain&&g.style.terrain.getTerrainData(De),at=V.constantOr(null);if(at&&Ve.imageAtlas){const jt=Ve.imageAtlas,gr=jt.patternPositions[at.to.toString()],br=jt.patternPositions[at.from.toString()];gr&&br&&Ye.setConstantPatternPositions(gr,br)}const Vt=yt?De:null,Dt=G?Qs(g,Ve,u,ie,Vt):O?ds(g,Ve,u,O,ie,Vt):K?Ho(g,Ve,u,xe.lineClipsArray.length,Vt):Va(g,Ve,u,Vt);if(G)fe.activeTexture.set(de.TEXTURE0),Ve.imageAtlasTexture.bind(de.LINEAR,de.CLAMP_TO_EDGE),Ye.updatePaintBuffers(ie);else if(O&&(lt||g.lineAtlas.dirty))fe.activeTexture.set(de.TEXTURE0),g.lineAtlas.bind(fe);else if(K){const jt=xe.gradients[u.id];let gr=jt.texture;if(u.gradientVersion!==jt.version){let br=256;if(u.stepInterpolant){const tr=t.getSource().maxzoom,qr=De.canonical.z===tr?Math.ceil(1<256&&this.clearStencil(),p.setColorMode(ei.disabled),p.setDepthMode(Cr.disabled);const x=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const I of u){const R=this._tileClippingMaskIDs[I.key]=this.nextStencilID++,O=this.style.terrain&&this.style.terrain.getTerrainData(I);x.draw(p,y.TRIANGLES,Cr.disabled,new Yr({func:y.ALWAYS,mask:0},R,255,y.KEEP,y.KEEP,y.REPLACE),ei.disabled,ai.disabled,Ua(I.posMatrix),O,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const t=this.nextStencilID++,u=this.context.gl;return new Yr({func:u.NOTEQUAL,mask:255},t,255,u.KEEP,u.KEEP,u.REPLACE)}stencilModeForClipping(t){const u=this.context.gl;return new Yr({func:u.EQUAL,mask:255},this._tileClippingMaskIDs[t.key],0,u.KEEP,u.KEEP,u.REPLACE)}stencilConfigForOverlap(t){const u=this.context.gl,p=t.sort((I,R)=>R.overscaledZ-I.overscaledZ),y=p[p.length-1].overscaledZ,x=p[0].overscaledZ-y+1;if(x>1){this.currentStencilSource=void 0,this.nextStencilID+x>256&&this.clearStencil();const I={};for(let R=0;R=0;this.currentLayer--){const V=this.style._layers[p[this.currentLayer]],G=y[V.source],K=I[V.source];this._renderTileClippingMasks(V,K),this.renderLayer(this,G,V,K)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayer{K.source&&!K.isHidden(this.transform.zoom)&&(K.source!==(G&&G.id)&&(G=this.style.sourceCaches[K.source]),(!V||V.getSource().maxzoom0?u.pop():null}isPatternMissing(t){if(!t)return!1;if(!t.from||!t.to)return!0;const u=this.imageManager.getPattern(t.from.toString()),p=this.imageManager.getPattern(t.to.toString());return!u||!p}useProgram(t,u){this.cache=this.cache||{};const p=t+(u?u.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.terrain?"/terrain":"");return this.cache[p]||(this.cache[p]=new us(this.context,t,sa[t],u,Ko[t],this._showOverdrawInspector,this.style.terrain)),this.cache[p]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const t=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(t.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}}class ho{constructor(t,u){this.points=t,this.planes=u}static fromInvProjectionMatrix(t,u,p){const y=Math.pow(2,p),x=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(R=>{const O=1/(R=n.transformMat4([],R,t))[3]/u*y;return n.mul$1(R,R,[O,O,1/R[3],O])}),I=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(R=>{const O=n.sub([],x[R[0]],x[R[1]]),V=n.sub([],x[R[2]],x[R[1]]),G=n.normalize([],n.cross([],O,V)),K=-n.dot(G,x[R[1]]);return G.concat(K)});return new ho(x,I)}}class Es{constructor(t,u){this.min=t,this.max=u,this.center=n.scale$1([],n.add([],this.min,this.max),.5)}quadrant(t){const u=[t%2==0,t<2],p=n.clone$2(this.min),y=n.clone$2(this.max);for(let x=0;x=0&&I++;if(I===0)return 0;I!==u.length&&(p=!1)}if(p)return 2;for(let y=0;y<3;y++){let x=Number.MAX_VALUE,I=-Number.MAX_VALUE;for(let R=0;Rthis.max[y]-this.min[y])return 0}return 1}}class Ha{constructor(t=0,u=0,p=0,y=0){if(isNaN(t)||t<0||isNaN(u)||u<0||isNaN(p)||p<0||isNaN(y)||y<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=t,this.bottom=u,this.left=p,this.right=y}interpolate(t,u,p){return u.top!=null&&t.top!=null&&(this.top=n.number(t.top,u.top,p)),u.bottom!=null&&t.bottom!=null&&(this.bottom=n.number(t.bottom,u.bottom,p)),u.left!=null&&t.left!=null&&(this.left=n.number(t.left,u.left,p)),u.right!=null&&t.right!=null&&(this.right=n.number(t.right,u.right,p)),this}getCenter(t,u){const p=n.clamp((this.left+t-this.right)/2,0,t),y=n.clamp((this.top+u-this.bottom)/2,0,u);return new n.pointGeometry(p,y)}equals(t){return this.top===t.top&&this.bottom===t.bottom&&this.left===t.left&&this.right===t.right}clone(){return new Ha(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class ks{constructor(t,u,p,y,x){this.tileSize=512,this.maxValidLatitude=85.051129,this.freezeElevation=!1,this._renderWorldCopies=x===void 0||!!x,this._minZoom=t||0,this._maxZoom=u||22,this._minPitch=p??0,this._maxPitch=y??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new n.LngLat(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new Ha,this._posMatrixCache={},this._alignedPosMatrixCache={}}clone(){const t=new ks(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return t.tileSize=this.tileSize,t.latRange=this.latRange,t.width=this.width,t.height=this.height,t._center=this._center,t._elevation=this._elevation,t.zoom=this.zoom,t.angle=this.angle,t._fov=this._fov,t._pitch=this._pitch,t._unmodified=this._unmodified,t._edgeInsets=this._edgeInsets.clone(),t._calcMatrices(),t}get minZoom(){return this._minZoom}set minZoom(t){this._minZoom!==t&&(this._minZoom=t,this.zoom=Math.max(this.zoom,t))}get maxZoom(){return this._maxZoom}set maxZoom(t){this._maxZoom!==t&&(this._maxZoom=t,this.zoom=Math.min(this.zoom,t))}get minPitch(){return this._minPitch}set minPitch(t){this._minPitch!==t&&(this._minPitch=t,this.pitch=Math.max(this.pitch,t))}get maxPitch(){return this._maxPitch}set maxPitch(t){this._maxPitch!==t&&(this._maxPitch=t,this.pitch=Math.min(this.pitch,t))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(t){t===void 0?t=!0:t===null&&(t=!1),this._renderWorldCopies=t}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new n.pointGeometry(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(t){const u=-n.wrap(t,-180,180)*Math.PI/180;var p;this.angle!==u&&(this._unmodified=!1,this.angle=u,this._calcMatrices(),this.rotationMatrix=(p=new n.ARRAY_TYPE(4),n.ARRAY_TYPE!=Float32Array&&(p[1]=0,p[2]=0),p[0]=1,p[3]=1,p),function(y,x,I){var R=x[0],O=x[1],V=x[2],G=x[3],K=Math.sin(I),ie=Math.cos(I);y[0]=R*ie+V*K,y[1]=O*ie+G*K,y[2]=R*-K+V*ie,y[3]=O*-K+G*ie}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(t){const u=n.clamp(t,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==u&&(this._unmodified=!1,this._pitch=u,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(t){t=Math.max(.01,Math.min(60,t)),this._fov!==t&&(this._unmodified=!1,this._fov=t/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(t){const u=Math.min(Math.max(t,this.minZoom),this.maxZoom);this._zoom!==u&&(this._unmodified=!1,this._zoom=u,this.scale=this.zoomScale(u),this.tileZoom=Math.floor(u),this.zoomFraction=u-this.tileZoom,this._constrain(),this._calcMatrices())}get center(){return this._center}set center(t){t.lat===this._center.lat&&t.lng===this._center.lng||(this._unmodified=!1,this._center=t,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(t){t!==this._elevation&&(this._elevation=t,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(t){this._edgeInsets.equals(t)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,t,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(t){return this._edgeInsets.equals(t)}interpolatePadding(t,u,p){this._unmodified=!1,this._edgeInsets.interpolate(t,u,p),this._constrain(),this._calcMatrices()}coveringZoomLevel(t){const u=(t.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/t.tileSize));return Math.max(0,u)}getVisibleUnwrappedCoordinates(t){const u=[new n.UnwrappedTileID(0,t)];if(this._renderWorldCopies){const p=this.pointCoordinate(new n.pointGeometry(0,0)),y=this.pointCoordinate(new n.pointGeometry(this.width,0)),x=this.pointCoordinate(new n.pointGeometry(this.width,this.height)),I=this.pointCoordinate(new n.pointGeometry(0,this.height)),R=Math.floor(Math.min(p.x,y.x,x.x,I.x)),O=Math.floor(Math.max(p.x,y.x,x.x,I.x)),V=1;for(let G=R-V;G<=O+V;G++)G!==0&&u.push(new n.UnwrappedTileID(G,t))}return u}coveringTiles(t){var u,p;let y=this.coveringZoomLevel(t);const x=y;if(t.minzoom!==void 0&&yt.maxzoom&&(y=t.maxzoom);const I=this.pointCoordinate(this.getCameraPoint()),R=n.MercatorCoordinate.fromLngLat(this.center),O=Math.pow(2,y),V=[O*I.x,O*I.y,0],G=[O*R.x,O*R.y,0],K=ho.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,y);let ie=t.minzoom||0;!t.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(ie=y);const me=t.terrain?2/Math.min(this.tileSize,t.tileSize)*this.tileSize:3,fe=xe=>({aabb:new Es([xe*O,0,0],[(xe+1)*O,O,0]),zoom:0,x:0,y:0,wrap:xe,fullyVisible:!1}),de=[],ze=[],De=y,Ve=t.reparseOverscaled?x:y;if(this._renderWorldCopies)for(let xe=1;xe<=3;xe++)de.push(fe(-xe)),de.push(fe(xe));for(de.push(fe(0));de.length>0;){const xe=de.pop(),Ye=xe.x,Ze=xe.y;let st=xe.fullyVisible;if(!st){const jt=xe.aabb.intersects(K);if(jt===0)continue;st=jt===2}const lt=t.terrain?V:G,yt=xe.aabb.distanceX(lt),at=xe.aabb.distanceY(lt),Vt=Math.max(Math.abs(yt),Math.abs(at)),Dt=me+(1<Dt&&xe.zoom>=ie){const jt=De-xe.zoom,gr=V[0]-.5-(Ye<>1),tr=xe.zoom+1;let qr=xe.aabb.quadrant(jt);if(t.terrain){const Gr=new n.OverscaledTileID(tr,xe.wrap,tr,gr,br),Ar=t.terrain.getMinMaxElevation(Gr),Pr=(u=Ar.minElevation)!==null&&u!==void 0?u:this.elevation,Hr=(p=Ar.maxElevation)!==null&&p!==void 0?p:this.elevation;qr=new Es([qr.min[0],qr.min[1],Pr],[qr.max[0],qr.max[1],Hr])}de.push({aabb:qr,zoom:tr,x:gr,y:br,wrap:xe.wrap,fullyVisible:st})}}return ze.sort((xe,Ye)=>xe.distanceSq-Ye.distanceSq).map(xe=>xe.tileID)}resize(t,u){this.width=t,this.height=u,this.pixelsToGLUnits=[2/t,-2/u],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(t){return Math.pow(2,t)}scaleZoom(t){return Math.log(t)/Math.LN2}project(t){const u=n.clamp(t.lat,-this.maxValidLatitude,this.maxValidLatitude);return new n.pointGeometry(n.mercatorXfromLng(t.lng)*this.worldSize,n.mercatorYfromLat(u)*this.worldSize)}unproject(t){return new n.MercatorCoordinate(t.x/this.worldSize,t.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}updateElevation(t){this.freezeElevation||(this.elevation=t?this.getElevation(this._center,t):0)}getElevation(t,u){const p=n.MercatorCoordinate.fromLngLat(t),y=(1<I&&(y=I-fe)}if(this.lngRange){const me=(R+O)/2,fe=n.wrap(K.x,me-this.worldSize/2,me+this.worldSize/2),de=V.x/2;fe-deO&&(p=O-de)}p===void 0&&y===void 0||(this.center=this.unproject(new n.pointGeometry(p!==void 0?p:K.x,y!==void 0?y:K.y)).wrap()),this._unmodified=G,this._constraining=!1}_calcMatrices(){if(!this.height)return;const t=this.centerOffset,u=this.point.x,p=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=n.mercatorZfromAltitude(1,this.center.lat)*this.worldSize;let y=n.identity(new Float64Array(16));n.scale(y,y,[this.width/2,-this.height/2,1]),n.translate(y,y,[1,-1,0]),this.labelPlaneMatrix=y,y=n.identity(new Float64Array(16)),n.scale(y,y,[1,-1,1]),n.translate(y,y,[-1,-1,0]),n.scale(y,y,[2/this.width,2/this.height,1]),this.glCoordMatrix=y,this.cameraToSeaLevelDistance=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch);const x=Math.PI/2+this._pitch,I=this._fov*(.5+t.y/this.height),R=Math.sin(I)*this.cameraToSeaLevelDistance/Math.sin(n.clamp(Math.PI-x-I,.01,Math.PI-.01)),O=this.getHorizon(),V=2*Math.atan(O/this.cameraToCenterDistance)*(.5+t.y/(2*O)),G=Math.sin(V)*this.cameraToSeaLevelDistance/Math.sin(n.clamp(Math.PI-x-V,.01,Math.PI-.01)),K=Math.cos(Math.PI/2-this._pitch)*R+this.cameraToSeaLevelDistance,ie=Math.cos(Math.PI/2-this._pitch)*G+this.cameraToSeaLevelDistance,me=1.01*Math.min(K,ie),fe=this.height/50;y=new Float64Array(16),n.perspective(y,this._fov,this.width/this.height,fe,me),y[8]=2*-t.x/this.width,y[9]=2*t.y/this.height,n.scale(y,y,[1,-1,1]),n.translate(y,y,[0,0,-this.cameraToCenterDistance]),n.rotateX(y,y,this._pitch),n.rotateZ(y,y,this.angle),n.translate(y,y,[-u,-p,0]),this.mercatorMatrix=n.scale([],y,[this.worldSize,this.worldSize,this.worldSize]),n.scale(y,y,[1,1,this._pixelPerMeter]),this.pixelMatrix=n.multiply(new Float64Array(16),this.labelPlaneMatrix,y),n.translate(y,y,[0,0,-this.elevation]),this.projMatrix=y,this.invProjMatrix=n.invert([],y),this.pixelMatrix3D=n.multiply(new Float64Array(16),this.labelPlaneMatrix,y);const de=this.width%2/2,ze=this.height%2/2,De=Math.cos(this.angle),Ve=Math.sin(this.angle),xe=u-Math.round(u)+De*de+Ve*ze,Ye=p-Math.round(p)+De*ze+Ve*de,Ze=new Float64Array(y);if(n.translate(Ze,Ze,[xe>.5?xe-1:xe,Ye>.5?Ye-1:Ye,0]),this.alignedProjMatrix=Ze,y=n.invert(new Float64Array(16),this.pixelMatrix),!y)throw new Error("failed to invert matrix");this.pixelMatrixInverse=y,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const t=this.pointCoordinate(new n.pointGeometry(0,0)),u=[t.x*this.worldSize,t.y*this.worldSize,0,1];return n.transformMat4(u,u,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const t=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new n.pointGeometry(0,t))}getCameraQueryGeometry(t){const u=this.getCameraPoint();if(t.length===1)return[t[0],u];{let p=u.x,y=u.y,x=u.x,I=u.y;for(const R of t)p=Math.min(p,R.x),y=Math.min(y,R.y),x=Math.max(x,R.x),I=Math.max(I,R.y);return[new n.pointGeometry(p,y),new n.pointGeometry(x,y),new n.pointGeometry(x,I),new n.pointGeometry(p,I),new n.pointGeometry(p,y)]}}}class Pc{constructor(t){this._hashName=t&&encodeURIComponent(t),n.bindAll(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=function(u,p){let y=!1,x=null;const I=()=>{x=null,y&&(u(),x=setTimeout(I,300),y=!1)};return()=>(y=!0,x||I(),x)}(this._updateHashUnthrottled.bind(this))}addTo(t){return this._map=t,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(t){const u=this._map.getCenter(),p=Math.round(100*this._map.getZoom())/100,y=Math.ceil((p*Math.LN2+Math.log(512/360/.5))/Math.LN10),x=Math.pow(10,y),I=Math.round(u.lng*x)/x,R=Math.round(u.lat*x)/x,O=this._map.getBearing(),V=this._map.getPitch();let G="";if(G+=t?`/${I}/${R}/${p}`:`${p}/${R}/${I}`,(O||V)&&(G+="/"+Math.round(10*O)/10),V&&(G+=`/${Math.round(V)}`),this._hashName){const K=this._hashName;let ie=!1;const me=window.location.hash.slice(1).split("&").map(fe=>{const de=fe.split("=")[0];return de===K?(ie=!0,`${de}=${G}`):fe}).filter(fe=>fe);return ie||me.push(`${K}=${G}`),`#${me.join("&")}`}return`#${G}`}_getCurrentHash(){const t=window.location.hash.replace("#","");if(this._hashName){let u;return t.split("&").map(p=>p.split("=")).forEach(p=>{p[0]===this._hashName&&(u=p)}),(u&&u[1]||"").split("/")}return t.split("/")}_onHashChange(){const t=this._getCurrentHash();if(t.length>=3&&!t.some(u=>isNaN(u))){const u=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(t[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+t[2],+t[1]],zoom:+t[0],bearing:u,pitch:+(t[4]||0)}),!0}return!1}_updateHashUnthrottled(){const t=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,t)}catch{}}}const Ss={linearity:.3,easing:n.bezier(0,0,.3,1)},zc=n.extend({deceleration:2500,maxSpeed:1400},Ss),Mc=n.extend({deceleration:20,maxSpeed:1400},Ss),Dc=n.extend({deceleration:1e3,maxSpeed:360},Ss),Wa=n.extend({deceleration:1e3,maxSpeed:90},Ss);class Rc{constructor(t){this._map=t,this.clear()}clear(){this._inertiaBuffer=[]}record(t){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:n.exported.now(),settings:t})}_drainInertiaBuffer(){const t=this._inertiaBuffer,u=n.exported.now();for(;t.length>0&&u-t[0].time>160;)t.shift()}_onMoveEnd(t){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const u={zoom:0,bearing:0,pitch:0,pan:new n.pointGeometry(0,0),pinchAround:void 0,around:void 0};for(const{settings:x}of this._inertiaBuffer)u.zoom+=x.zoomDelta||0,u.bearing+=x.bearingDelta||0,u.pitch+=x.pitchDelta||0,x.panDelta&&u.pan._add(x.panDelta),x.around&&(u.around=x.around),x.pinchAround&&(u.pinchAround=x.pinchAround);const p=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,y={};if(u.pan.mag()){const x=Is(u.pan.mag(),p,n.extend({},zc,t||{}));y.offset=u.pan.mult(x.amount/u.pan.mag()),y.center=this._map.transform.center,Ts(y,x)}if(u.zoom){const x=Is(u.zoom,p,Mc);y.zoom=this._map.transform.zoom+x.amount,Ts(y,x)}if(u.bearing){const x=Is(u.bearing,p,Dc);y.bearing=this._map.transform.bearing+n.clamp(x.amount,-179,179),Ts(y,x)}if(u.pitch){const x=Is(u.pitch,p,Wa);y.pitch=this._map.transform.pitch+x.amount,Ts(y,x)}if(y.zoom||y.bearing){const x=u.pinchAround===void 0?u.around:u.pinchAround;y.around=x?this._map.unproject(x):this._map.getCenter()}return this.clear(),n.extend(y,{noMoveStart:!0})}}function Ts(g,t){(!g.duration||g.durationu.unproject(O)),R=x.reduce((O,V,G,K)=>O.add(V.div(K.length)),new n.pointGeometry(0,0));super(t,{points:x,point:R,lngLats:I,lngLat:u.unproject(R),originalEvent:p}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class on extends n.Event{constructor(t,u,p){super(t,{originalEvent:p}),this._defaultPrevented=!1}preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}}class oh{constructor(t,u){this._map=t,this._clickTolerance=u.clickTolerance}reset(){delete this._mousedownPos}wheel(t){return this._firePreventable(new on(t.type,this._map,t))}mousedown(t,u){return this._mousedownPos=u,this._firePreventable(new sn(t.type,this._map,t))}mouseup(t){this._map.fire(new sn(t.type,this._map,t))}click(t,u){this._mousedownPos&&this._mousedownPos.dist(u)>=this._clickTolerance||this._map.fire(new sn(t.type,this._map,t))}dblclick(t){return this._firePreventable(new sn(t.type,this._map,t))}mouseover(t){this._map.fire(new sn(t.type,this._map,t))}mouseout(t){this._map.fire(new sn(t.type,this._map,t))}touchstart(t){return this._firePreventable(new Cs(t.type,this._map,t))}touchmove(t){this._map.fire(new Cs(t.type,this._map,t))}touchend(t){this._map.fire(new Cs(t.type,this._map,t))}touchcancel(t){this._map.fire(new Cs(t.type,this._map,t))}_firePreventable(t){if(this._map.fire(t),t.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ca{constructor(t){this._map=t}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(t){this._map.fire(new sn(t.type,this._map,t))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new sn("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(t){this._delayContextMenu?this._contextMenuEvent=t:this._ignoreContextMenu||this._map.fire(new sn(t.type,this._map,t)),this._map.listens("contextmenu")&&t.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Lc{constructor(t,u){this._map=t,this._el=t.getCanvasContainer(),this._container=t.getContainer(),this._clickTolerance=u.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(t,u){this.isEnabled()&&t.shiftKey&&t.button===0&&(k.disableDrag(),this._startPos=this._lastPos=u,this._active=!0)}mousemoveWindow(t,u){if(!this._active)return;const p=u;if(this._lastPos.equals(p)||!this._box&&p.dist(this._startPos)x.fitScreenCoordinates(p,y,this._map.getBearing(),{linear:!0})};this._fireEvent("boxzoomcancel",t)}keydown(t){this._active&&t.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",t))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair","mapboxgl-crosshair"),this._box&&(k.remove(this._box),this._box=null),k.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(t,u){return this._map.fire(new n.Event(t,{originalEvent:u}))}}function Gn(g,t){if(g.length!==t.length)throw new Error(`The number of touches and points are not equal - touches ${g.length}, points ${t.length}`);const u={};for(let p=0;pthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=t.timeStamp),p.length===this.numTouches&&(this.centroid=function(y){const x=new n.pointGeometry(0,0);for(const I of y)x._add(I);return x.div(y.length)}(u),this.touches=Gn(p,u)))}touchmove(t,u,p){if(this.aborted||!this.centroid)return;const y=Gn(p,u);for(const x in this.touches){const I=this.touches[x],R=y[x];(!R||R.dist(I)>30)&&(this.aborted=!0)}}touchend(t,u,p){if((!this.centroid||t.timeStamp-this.startTime>500)&&(this.aborted=!0),p.length===0){const y=!this.aborted&&this.centroid;if(this.reset(),y)return y}}}class ul{constructor(t){this.singleTap=new As(t),this.numTaps=t.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(t,u,p){this.singleTap.touchstart(t,u,p)}touchmove(t,u,p){this.singleTap.touchmove(t,u,p)}touchend(t,u,p){const y=this.singleTap.touchend(t,u,p);if(y){const x=t.timeStamp-this.lastTime<500,I=!this.lastTap||this.lastTap.dist(y)<30;if(x&&I||this.reset(),this.count++,this.lastTime=t.timeStamp,this.lastTap=y,this.count===this.numTaps)return this.reset(),y}}}class lh{constructor(){this._zoomIn=new ul({numTouches:1,numTaps:2}),this._zoomOut=new ul({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(t,u,p){this._zoomIn.touchstart(t,u,p),this._zoomOut.touchstart(t,u,p)}touchmove(t,u,p){this._zoomIn.touchmove(t,u,p),this._zoomOut.touchmove(t,u,p)}touchend(t,u,p){const y=this._zoomIn.touchend(t,u,p),x=this._zoomOut.touchend(t,u,p);return y?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:I.getZoom()+1,around:I.unproject(y)},{originalEvent:t})}):x?(this._active=!0,t.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:I=>I.easeTo({duration:300,zoom:I.getZoom()-1,around:I.unproject(x)},{originalEvent:t})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const ch={0:1,2:2};class fo{constructor(t){this.reset(),this._clickTolerance=t.clickTolerance||1}reset(){this._active=!1,this._moved=!1,delete this._lastPoint,delete this._eventButton}_correctButton(t,u){return!1}_move(t,u){return{}}mousedown(t,u){if(this._lastPoint)return;const p=k.mouseButton(t);this._correctButton(t,p)&&(this._lastPoint=u,this._eventButton=p)}mousemoveWindow(t,u){const p=this._lastPoint;if(p){if(t.preventDefault(),function(y,x){const I=ch[x];return y.buttons===void 0||(y.buttons&I)!==I}(t,this._eventButton))this.reset();else if(this._moved||!(u.dist(p){this._cancelCooperativeMessage=!1},200)}touchstart(t,u,p){return this._calculateTransform(t,u,p)}touchmove(t,u,p){if(this._map._cooperativeGestures&&(this._minTouches===2&&p.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(t,!1,p.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(p.length0&&(this._active=!0);const y=Gn(p,u),x=new n.pointGeometry(0,0),I=new n.pointGeometry(0,0);let R=0;for(const V in y){const G=y[V],K=this._touches[V];K&&(x._add(G),I._add(G.sub(K)),R++,y[V]=G)}if(this._touches=y,RMath.abs(g.x)}class dl extends Sa{constructor(t){super(),this._map=t}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(t,u,p){super.touchstart(t,u,p),this._currentTouchCount=p.length}_start(t){this._lastPoints=t,fl(t[0].sub(t[1]))&&(this._valid=!1)}_move(t,u,p){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const y=t[0].sub(this._lastPoints[0]),x=t[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(y,x,p.timeStamp),this._valid?(this._lastPoints=t,this._active=!0,{pitchDelta:(y.y+x.y)/2*-.5}):void 0}gestureBeginsVertically(t,u,p){if(this._valid!==void 0)return this._valid;const y=t.mag()>=2,x=u.mag()>=2;if(!y&&!x)return;if(!y||!x)return this._firstMove===void 0&&(this._firstMove=p),p-this._firstMove<100&&void 0;const I=t.y>0==u.y>0;return fl(t)&&fl(u)&&I}}const Oc={panStep:100,bearingStep:15,pitchStep:10};class Fc{constructor(){const t=Oc;this._panStep=t.panStep,this._bearingStep=t.bearingStep,this._pitchStep=t.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(t){if(t.altKey||t.ctrlKey||t.metaKey)return;let u=0,p=0,y=0,x=0,I=0;switch(t.keyCode){case 61:case 107:case 171:case 187:u=1;break;case 189:case 109:case 173:u=-1;break;case 37:t.shiftKey?p=-1:(t.preventDefault(),x=-1);break;case 39:t.shiftKey?p=1:(t.preventDefault(),x=1);break;case 38:t.shiftKey?y=1:(t.preventDefault(),I=-1);break;case 40:t.shiftKey?y=-1:(t.preventDefault(),I=1);break;default:return}return this._rotationDisabled&&(p=0,y=0),{cameraAnimation:R=>{const O=R.getZoom();R.easeTo({duration:300,easeId:"keyboardHandler",easing:hh,zoom:u?Math.round(O)+u*(t.shiftKey?2:1):O,bearing:R.getBearing()+p*this._bearingStep,pitch:R.getPitch()+y*this._pitchStep,offset:[-x*this._panStep,-I*this._panStep],center:R.getCenter()},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function hh(g){return g*(2-g)}const Nc=4.000244140625;class pl{constructor(t,u){this._map=t,this._el=t.getCanvasContainer(),this._handler=u,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222,n.bindAll(["_onTimeout"],this)}setZoomRate(t){this._defaultZoomRate=t}setWheelZoomRate(t){this._wheelZoomRate=t}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(t){this.isEnabled()||(this._enabled=!0,this._aroundCenter=t&&t.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(t){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!this._map._metaPress)return;t.preventDefault()}let u=t.deltaMode===WheelEvent.DOM_DELTA_LINE?40*t.deltaY:t.deltaY;const p=n.exported.now(),y=p-(this._lastWheelEventTime||0);this._lastWheelEventTime=p,u!==0&&u%Nc==0?this._type="wheel":u!==0&&Math.abs(u)<4?this._type="trackpad":y>400?(this._type=null,this._lastValue=u,this._timeout=setTimeout(this._onTimeout,40,t)):this._type||(this._type=Math.abs(y*u)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,u+=this._lastValue)),t.shiftKey&&u&&(u/=4),this._type&&(this._lastWheelEvent=t,this._delta-=u,this._active||this._start(t)),t.preventDefault()}_onTimeout(t){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(t)}_start(t){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const u=k.mousePos(this._el,t);this._around=n.LngLat.convert(this._aroundCenter?this._map.getCenter():this._map.unproject(u)),this._aroundPoint=this._map.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._handler._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const t=this._map.transform;if(this._delta!==0){const R=this._type==="wheel"&&Math.abs(this._delta)>Nc?this._wheelZoomRate:this._defaultZoomRate;let O=2/(1+Math.exp(-Math.abs(this._delta*R)));this._delta<0&&O!==0&&(O=1/O);const V=typeof this._targetZoom=="number"?t.zoomScale(this._targetZoom):t.scale;this._targetZoom=Math.min(t.maxZoom,Math.max(t.minZoom,t.scaleZoom(V*O))),this._type==="wheel"&&(this._startZoom=t.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const u=typeof this._targetZoom=="number"?this._targetZoom:t.zoom,p=this._startZoom,y=this._easing;let x,I=!1;if(this._type==="wheel"&&p&&y){const R=Math.min((n.exported.now()-this._lastWheelEventTime)/200,1),O=y(R);x=n.number(p,u,O),R<1?this._frameId||(this._frameId=!0):I=!0}else x=u,I=!0;return this._active=!0,I&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!I,zoomDelta:x-t.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(t){let u=n.ease;if(this._prevEase){const p=this._prevEase,y=(n.exported.now()-p.start)/p.duration,x=p.easing(y+.01)-p.easing(y),I=.27/Math.sqrt(x*x+1e-4)*.01,R=Math.sqrt(.0729-I*I);u=n.bezier(I,R,.25,1)}return this._prevEase={start:n.exported.now(),duration:t,easing:u},u}reset(){this._active=!1}}class ml{constructor(t,u){this._clickZoom=t,this._tapZoom=u}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class gl{constructor(){this.reset()}reset(){this._active=!1}dblclick(t,u){return t.preventDefault(),{cameraAnimation:p=>{p.easeTo({duration:300,zoom:p.getZoom()+(t.shiftKey?-1:1),around:p.unproject(u)},{originalEvent:t})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class _l{constructor(){this._tap=new ul({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,this._tap.reset()}touchstart(t,u,p){this._swipePoint||(this._tapTime&&t.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?p.length>0&&(this._swipePoint=u[0],this._swipeTouch=p[0].identifier):this._tap.touchstart(t,u,p))}touchmove(t,u,p){if(this._tapTime){if(this._swipePoint){if(p[0].identifier!==this._swipeTouch)return;const y=u[0],x=y.y-this._swipePoint.y;return this._swipePoint=y,t.preventDefault(),this._active=!0,{zoomDelta:x/128}}}else this._tap.touchmove(t,u,p)}touchend(t,u,p){this._tapTime?this._swipePoint&&p.length===0&&this.reset():this._tap.touchend(t,u,p)&&(this._tapTime=t.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ji{constructor(t,u,p){this._el=t,this._mousePan=u,this._touchPan=p}enable(t){this._inertiaOptions=t||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan","mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ha{constructor(t,u,p){this._pitchWithRotate=t.pitchWithRotate,this._mouseRotate=u,this._mousePitch=p}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Uc{constructor(t,u,p,y){this._el=t,this._touchZoom=u,this._touchRotate=p,this._tapDragZoom=y,this._rotationDisabled=!1,this._enabled=!0}enable(t){this._touchZoom.enable(t),this._rotationDisabled||this._touchRotate.enable(t),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate","mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Ka=g=>g.zoom||g.drag||g.pitch||g.rotate;class yl extends n.Event{}function zs(g){return g.panDelta&&g.panDelta.mag()||g.zoomDelta||g.bearingDelta||g.pitchDelta}class Vc{constructor(t,u){this._map=t,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Rc(t),this._bearingSnap=u.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(u),n.bindAll(["handleEvent","handleWindowEvent"],this);const p=this._el;this._listeners=[[p,"touchstart",{passive:!0}],[p,"touchmove",{passive:!1}],[p,"touchend",void 0],[p,"touchcancel",void 0],[p,"mousedown",void 0],[p,"mousemove",void 0],[p,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[p,"mouseover",void 0],[p,"mouseout",void 0],[p,"dblclick",void 0],[p,"click",void 0],[p,"keydown",{capture:!1}],[p,"keyup",void 0],[p,"wheel",{passive:!1}],[p,"contextmenu",void 0],[window,"blur",void 0]];for(const[y,x,I]of this._listeners)k.addEventListener(y,x,y===document?this.handleWindowEvent:this.handleEvent,I)}destroy(){for(const[t,u,p]of this._listeners)k.removeEventListener(t,u,t===document?this.handleWindowEvent:this.handleEvent,p)}_addDefaultHandlers(t){const u=this._map,p=u.getCanvasContainer();this._add("mapEvent",new oh(u,t));const y=u.boxZoom=new Lc(u,t);this._add("boxZoom",y);const x=new lh,I=new gl;u.doubleClickZoom=new ml(I,x),this._add("tapZoom",x),this._add("clickZoom",I);const R=new _l;this._add("tapDragZoom",R);const O=u.touchPitch=new dl(u);this._add("touchPitch",O);const V=new Zn(t),G=new Gt(t);u.dragRotate=new ha(t,V,G),this._add("mouseRotate",V,["mousePitch"]),this._add("mousePitch",G,["mouseRotate"]);const K=new Ps(t),ie=new Bc(t,u);u.dragPan=new Ji(p,K,ie),this._add("mousePan",K),this._add("touchPan",ie,["touchZoom","touchRotate"]);const me=new uh,fe=new Ft;u.touchZoomRotate=new Uc(p,fe,me,R),this._add("touchRotate",me,["touchPan","touchZoom"]),this._add("touchZoom",fe,["touchPan","touchRotate"]);const de=u.scrollZoom=new pl(u,this);this._add("scrollZoom",de,["mousePan"]);const ze=u.keyboard=new Fc;this._add("keyboard",ze),this._add("blockableMapEvent",new ca(u));for(const De of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])t.interactive&&t[De]&&u[De].enable(t[De])}_add(t,u,p){this._handlers.push({handlerName:t,handler:u,allowed:p}),this._handlersById[t]=u}stop(t){if(!this._updatingCamera){for(const{handler:u}of this._handlers)u.reset();this._inertia.clear(),this._fireEvents({},{},t),this._changes=[]}}isActive(){for(const{handler:t}of this._handlers)if(t.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Ka(this._eventsInProgress)||this.isZooming()}_blockedByActive(t,u,p){for(const y in t)if(y!==p&&(!u||u.indexOf(y)<0))return!0;return!1}handleWindowEvent(t){this.handleEvent(t,`${t.type}Window`)}_getMapTouches(t){const u=[];for(const p of t)this._el.contains(p.target)&&u.push(p);return u}handleEvent(t,u){if(t.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const p=t.type==="renderFrame"?void 0:t,y={needsRenderFrame:!1},x={},I={},R=t.touches,O=R?this._getMapTouches(R):void 0,V=O?k.touchPos(this._el,O):k.mousePos(this._el,t);for(const{handlerName:ie,handler:me,allowed:fe}of this._handlers){if(!me.isEnabled())continue;let de;this._blockedByActive(I,fe,ie)?me.reset():me[u||t.type]&&(de=me[u||t.type](t,V,O),this.mergeHandlerResult(y,x,de,ie,p),de&&de.needsRenderFrame&&this._triggerRenderFrame()),(de||me.isActive())&&(I[ie]=me)}const G={};for(const ie in this._previousActiveHandlers)I[ie]||(G[ie]=p);this._previousActiveHandlers=I,(Object.keys(G).length||zs(y))&&(this._changes.push([y,x,G]),this._triggerRenderFrame()),(Object.keys(I).length||zs(y))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:K}=y;K&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],K(this._map))}mergeHandlerResult(t,u,p,y,x){if(!p)return;n.extend(t,p);const I={handlerName:y,originalEvent:p.originalEvent||x};p.zoomDelta!==void 0&&(u.zoom=I),p.panDelta!==void 0&&(u.drag=I),p.pitchDelta!==void 0&&(u.pitch=I),p.bearingDelta!==void 0&&(u.rotate=I)}_applyChanges(){const t={},u={},p={};for(const[y,x,I]of this._changes)y.panDelta&&(t.panDelta=(t.panDelta||new n.pointGeometry(0,0))._add(y.panDelta)),y.zoomDelta&&(t.zoomDelta=(t.zoomDelta||0)+y.zoomDelta),y.bearingDelta&&(t.bearingDelta=(t.bearingDelta||0)+y.bearingDelta),y.pitchDelta&&(t.pitchDelta=(t.pitchDelta||0)+y.pitchDelta),y.around!==void 0&&(t.around=y.around),y.pinchAround!==void 0&&(t.pinchAround=y.pinchAround),y.noInertia&&(t.noInertia=y.noInertia),n.extend(u,x),n.extend(p,I);this._updateMapTransform(t,u,p),this._changes=[]}_updateMapTransform(t,u,p){const y=this._map,x=y.transform,I=y.style&&y.style.terrain;if(!(zs(t)||I&&this._drag))return this._fireEvents(u,p,!0);let{panDelta:R,zoomDelta:O,bearingDelta:V,pitchDelta:G,around:K,pinchAround:ie}=t;ie!==void 0&&(K=ie),y._stop(!0),K=K||y.transform.centerPoint;const me=x.pointLocation(R?K.sub(R):K);V&&(x.bearing+=V),G&&(x.pitch+=G),O&&(x.zoom+=O),I?u.drag&&!this._drag?(this._drag={center:x.centerPoint,lngLat:x.pointLocation(K),point:K,handlerName:u.drag.handlerName},y.fire(new n.Event("freezeElevation",{freeze:!0}))):this._drag&&p[this._drag.handlerName]?(y.fire(new n.Event("freezeElevation",{freeze:!1})),this._drag=null):u.drag&&this._drag&&(x.center=x.pointLocation(x.centerPoint.sub(R))):x.setLocationAtPoint(me,K),this._map._update(),t.noInertia||this._inertia.record(t),this._fireEvents(u,p,!0)}_fireEvents(t,u,p){const y=Ka(this._eventsInProgress),x=Ka(t),I={};for(const G in t){const{originalEvent:K}=t[G];this._eventsInProgress[G]||(I[`${G}start`]=K),this._eventsInProgress[G]=t[G]}!y&&x&&this._fireEvent("movestart",x.originalEvent);for(const G in I)this._fireEvent(G,I[G]);x&&this._fireEvent("move",x.originalEvent);for(const G in t){const{originalEvent:K}=t[G];this._fireEvent(G,K)}const R={};let O;for(const G in this._eventsInProgress){const{handlerName:K,originalEvent:ie}=this._eventsInProgress[G];this._handlersById[K].isActive()||(delete this._eventsInProgress[G],O=u[K]||ie,R[`${G}end`]=O)}for(const G in R)this._fireEvent(G,R[G]);const V=Ka(this._eventsInProgress);if(p&&(y||x)&&!V){this._updatingCamera=!0;const G=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),K=ie=>ie!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new yl("renderFrame",{timeStamp:t})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const _n={extend:(g,...t)=>n.extend(g,...t),run(g){g()},logToElement(g,t=!1,u="log"){const p=window.document.getElementById(u);p&&(t&&(p.innerHTML=""),p.innerHTML+=`
${g}`)}};class si extends n.Evented{constructor(t,u){super(),this._moving=!1,this._zooming=!1,this.transform=t,this._bearingSnap=u.bearingSnap,n.bindAll(["_renderFrameCallback"],this)}getCenter(){return new n.LngLat(this.transform.center.lng,this.transform.center.lat)}setCenter(t,u){return this.jumpTo({center:t},u)}panBy(t,u,p){return t=n.pointGeometry.convert(t).mult(-1),this.panTo(this.transform.center,n.extend({offset:t},u),p)}panTo(t,u,p){return this.easeTo(n.extend({center:t},u),p)}getZoom(){return this.transform.zoom}setZoom(t,u){return this.jumpTo({zoom:t},u),this}zoomTo(t,u,p){return this.easeTo(n.extend({zoom:t},u),p)}zoomIn(t,u){return this.zoomTo(this.getZoom()+1,t,u),this}zoomOut(t,u){return this.zoomTo(this.getZoom()-1,t,u),this}getBearing(){return this.transform.bearing}setBearing(t,u){return this.jumpTo({bearing:t},u),this}getPadding(){return this.transform.padding}setPadding(t,u){return this.jumpTo({padding:t},u),this}rotateTo(t,u,p){return this.easeTo(n.extend({bearing:t},u),p)}resetNorth(t,u){return this.rotateTo(0,n.extend({duration:1e3},t),u),this}resetNorthPitch(t,u){return this.easeTo(n.extend({bearing:0,pitch:0,duration:1e3},t),u),this}snapToNorth(t,u){return Math.abs(this.getBearing()){if(this._zooming&&(p.zoom=n.number(y,O,st)),this._rotating&&(p.bearing=n.number(x,V,st)),this._pitching&&(p.pitch=n.number(I,G,st)),this._padding&&(p.interpolatePadding(R,K,st),me=p.centerPoint.add(ie)),xe)p.setLocationAtPoint(xe,Ye);else{const lt=p.zoomScale(p.zoom-y),yt=O>y?Math.min(2,Ve):Math.max(.5,Ve),at=Math.pow(yt,1-st),Vt=p.unproject(ze.add(De.mult(st*at)).mult(lt));p.setLocationAtPoint(p.renderWorldCopies?Vt.wrap():Vt,me)}this._fireMoveEvents(u)},st=>{this._afterEase(u,st)},t),this}_prepareEase(t,u,p={}){this._moving=!0,this.fire(new n.Event("freezeElevation",{freeze:!0})),u||p.moving||this.fire(new n.Event("movestart",t)),this._zooming&&!p.zooming&&this.fire(new n.Event("zoomstart",t)),this._rotating&&!p.rotating&&this.fire(new n.Event("rotatestart",t)),this._pitching&&!p.pitching&&this.fire(new n.Event("pitchstart",t))}_fireMoveEvents(t){this.fire(new n.Event("move",t)),this._zooming&&this.fire(new n.Event("zoom",t)),this._rotating&&this.fire(new n.Event("rotate",t)),this._pitching&&this.fire(new n.Event("pitch",t))}_afterEase(t,u){if(this._easeId&&u&&this._easeId===u)return;delete this._easeId,this.fire(new n.Event("freezeElevation",{freeze:!1}));const p=this._zooming,y=this._rotating,x=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,p&&this.fire(new n.Event("zoomend",t)),y&&this.fire(new n.Event("rotateend",t)),x&&this.fire(new n.Event("pitchend",t)),this.fire(new n.Event("moveend",t))}flyTo(t,u){if(!t.essential&&n.exported.prefersReducedMotion){const tr=n.pick(t,["center","zoom","bearing","pitch","around"]);return this.jumpTo(tr,u)}this.stop(),t=n.extend({offset:[0,0],speed:1.2,curve:1.42,easing:n.ease},t);const p=this.transform,y=this.getZoom(),x=this.getBearing(),I=this.getPitch(),R=this.getPadding(),O="zoom"in t?n.clamp(+t.zoom,p.minZoom,p.maxZoom):y,V="bearing"in t?this._normalizeBearing(t.bearing,x):x,G="pitch"in t?+t.pitch:I,K="padding"in t?t.padding:p.padding,ie=p.zoomScale(O-y),me=n.pointGeometry.convert(t.offset);let fe=p.centerPoint.add(me);const de=p.pointLocation(fe),ze=n.LngLat.convert(t.center||de);this._normalizeCenter(ze);const De=p.project(de),Ve=p.project(ze).sub(De);let xe=t.curve;const Ye=Math.max(p.width,p.height),Ze=Ye/ie,st=Ve.mag();if("minZoom"in t){const tr=n.clamp(Math.min(t.minZoom,y,O),p.minZoom,p.maxZoom),qr=Ye/p.zoomScale(tr-y);xe=Math.sqrt(qr/st*2)}const lt=xe*xe;function yt(tr){const qr=(Ze*Ze-Ye*Ye+(tr?-1:1)*lt*lt*st*st)/(2*(tr?Ze:Ye)*lt*st);return Math.log(Math.sqrt(qr*qr+1)-qr)}function at(tr){return(Math.exp(tr)-Math.exp(-tr))/2}function Vt(tr){return(Math.exp(tr)+Math.exp(-tr))/2}const Dt=yt(0);let jt=function(tr){return Vt(Dt)/Vt(Dt+xe*tr)},gr=function(tr){return Ye*((Vt(Dt)*(at(qr=Dt+xe*tr)/Vt(qr))-at(Dt))/lt)/st;var qr},br=(yt(1)-Dt)/xe;if(Math.abs(st)<1e-6||!isFinite(br)){if(Math.abs(Ye-Ze)<1e-6)return this.easeTo(t,u);const tr=Zet.maxDuration&&(t.duration=0),this._zooming=!0,this._rotating=x!==V,this._pitching=G!==I,this._padding=!p.isPaddingEqual(K),this._prepareEase(u,!1),this._ease(tr=>{const qr=tr*br,Gr=1/jt(qr);p.zoom=tr===1?O:y+p.scaleZoom(Gr),this._rotating&&(p.bearing=n.number(x,V,tr)),this._pitching&&(p.pitch=n.number(I,G,tr)),this._padding&&(p.interpolatePadding(R,K,tr),fe=p.centerPoint.add(me));const Ar=tr===1?ze:p.unproject(De.add(Ve.mult(gr(qr))).mult(Gr));p.setLocationAtPoint(p.renderWorldCopies?Ar.wrap():Ar,fe),this._fireMoveEvents(u)},()=>this._afterEase(u),t),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(t,u){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const p=this._onEaseEnd;delete this._onEaseEnd,p.call(this,u)}if(!t){const p=this.handlers;p&&p.stop(!1)}return this}_ease(t,u,p){p.animate===!1||p.duration===0?(t(1),u()):(this._easeStart=n.exported.now(),this._easeOptions=p,this._onEaseFrame=t,this._onEaseEnd=u,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const t=Math.min((n.exported.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(t)),t<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(t,u){t=n.wrap(t,-180,180);const p=Math.abs(t-u);return Math.abs(t-360-u)180?-360:p<-180?360:0}}class Ms{constructor(t={}){this.options=t,n.bindAll(["_toggleAttribution","_updateData","_updateCompact","_updateCompactMinimize"],this)}getDefaultPosition(){return"bottom-right"}onAdd(t){return this._map=t,this._compact=this.options&&this.options.compact,this._container=k.create("details","maplibregl-ctrl maplibregl-ctrl-attrib mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=k.create("summary","maplibregl-ctrl-attrib-button mapboxgl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=k.create("div","maplibregl-ctrl-attrib-inner mapboxgl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){k.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(t,u){const p=this._map._getUIString(`AttributionControl.${u}`);t.title=p,t.setAttribute("aria-label",p)}_toggleAttribution(){this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")):(this._container.classList.add("maplibregl-compact-show","mapboxgl-compact-show"),this._container.removeAttribute("open")))}_updateData(t){!t||t.sourceDataType!=="metadata"&&t.sourceDataType!=="visibility"&&t.dataType!=="style"&&t.type!=="terrain"||this._updateAttributions()}_updateAttributions(){if(!this._map.style)return;let t=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?t=t.concat(this.options.customAttribution.map(y=>typeof y!="string"?"":y)):typeof this.options.customAttribution=="string"&&t.push(this.options.customAttribution)),this._map.style.stylesheet){const y=this._map.style.stylesheet;this.styleOwner=y.owner,this.styleId=y.id}const u=this._map.style.sourceCaches;for(const y in u){const x=u[y];if(x.used||x.usedForTerrain){const I=x.getSource();I.attribution&&t.indexOf(I.attribution)<0&&t.push(I.attribution)}}t=t.filter(y=>String(y).trim()),t.sort((y,x)=>y.length-x.length),t=t.filter((y,x)=>{for(let I=x+1;I=0)return!1;return!0});const p=t.join(" | ");p!==this._attribHTML&&(this._attribHTML=p,t.length?(this._innerContainer.innerHTML=p,this._container.classList.remove("maplibregl-attrib-empty","mapboxgl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty","mapboxgl-attrib-empty"),this._updateCompact(),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","mapboxgl-compact","maplibregl-compact-show","mapboxgl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show","mapboxgl-compact","mapboxgl-compact-show"))}_updateCompactMinimize(){this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show","mapboxgl-compact-show")}}class mo{constructor(t={}){this.options=t,n.bindAll(["_updateCompact"],this)}getDefaultPosition(){return"bottom-left"}onAdd(t){this._map=t,this._compact=this.options&&this.options.compact,this._container=k.create("div","maplibregl-ctrl mapboxgl-ctrl");const u=k.create("a","maplibregl-ctrl-logo mapboxgl-ctrl-logo");return u.target="_blank",u.rel="noopener nofollow",u.href="https://maplibre.org/",u.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),u.setAttribute("rel","noopener nofollow"),this._container.appendChild(u),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){k.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}_updateCompact(){const t=this._container.children;if(t.length){const u=t[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&u.classList.add("maplibregl-compact","mapboxgl-compact"):u.classList.remove("maplibregl-compact","mapboxgl-compact")}}}class $c{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(t){const u=++this._id;return this._queue.push({callback:t,id:u,cancelled:!1}),u}remove(t){const u=this._currentlyRunning,p=u?this._queue.concat(u):this._queue;for(const y of p)if(y.id===t)return void(y.cancelled=!0)}run(t=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const u=this._currentlyRunning=this._queue;this._queue=[];for(const p of u)if(!p.cancelled&&(p.callback(t),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const jc={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"},qc={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:void 0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,maplibreLogo:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",transformRequest:null,fadeDuration:300,crossSourceCollisions:!0},fh={showCompass:!0,showZoom:!0,visualizePitch:!1};class Mn{constructor(t,u,p=!1){this._clickTolerance=10,this.element=u,this.mouseRotate=new Zn({clickTolerance:t.dragRotate._mouseRotate._clickTolerance}),this.map=t,p&&(this.mousePitch=new Gt({clickTolerance:t.dragRotate._mousePitch._clickTolerance})),n.bindAll(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),k.addEventListener(u,"mousedown",this.mousedown),k.addEventListener(u,"touchstart",this.touchstart,{passive:!1}),k.addEventListener(u,"touchmove",this.touchmove),k.addEventListener(u,"touchend",this.touchend),k.addEventListener(u,"touchcancel",this.reset)}down(t,u){this.mouseRotate.mousedown(t,u),this.mousePitch&&this.mousePitch.mousedown(t,u),k.disableDrag()}move(t,u){const p=this.map,y=this.mouseRotate.mousemoveWindow(t,u);if(y&&y.bearingDelta&&p.setBearing(p.getBearing()+y.bearingDelta),this.mousePitch){const x=this.mousePitch.mousemoveWindow(t,u);x&&x.pitchDelta&&p.setPitch(p.getPitch()+x.pitchDelta)}}off(){const t=this.element;k.removeEventListener(t,"mousedown",this.mousedown),k.removeEventListener(t,"touchstart",this.touchstart,{passive:!1}),k.removeEventListener(t,"touchmove",this.touchmove),k.removeEventListener(t,"touchend",this.touchend),k.removeEventListener(t,"touchcancel",this.reset),this.offTemp()}offTemp(){k.enableDrag(),k.removeEventListener(window,"mousemove",this.mousemove),k.removeEventListener(window,"mouseup",this.mouseup)}mousedown(t){this.down(n.extend({},t,{ctrlKey:!0,preventDefault:()=>t.preventDefault()}),k.mousePos(this.element,t)),k.addEventListener(window,"mousemove",this.mousemove),k.addEventListener(window,"mouseup",this.mouseup)}mousemove(t){this.move(t,k.mousePos(this.element,t))}mouseup(t){this.mouseRotate.mouseupWindow(t),this.mousePitch&&this.mousePitch.mouseupWindow(t),this.offTemp()}touchstart(t){t.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=k.touchPos(this.element,t.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>t.preventDefault()},this._startPos))}touchmove(t){t.targetTouches.length!==1?this.reset():(this._lastPos=k.touchPos(this.element,t.targetTouches)[0],this.move({preventDefault:()=>t.preventDefault()},this._lastPos))}touchend(t){t.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)180;){const p=u.locationPoint(g);if(p.x>=0&&p.y>=0&&p.x<=u.width&&p.y<=u.height)break;g.lng>u.center.lng?g.lng-=360:g.lng+=360}return g}const Kt={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function lr(g,t,u){const p=g.classList;for(const y in Kt)p.remove(`maplibregl-${u}-anchor-${y}`,`mapboxgl-${u}-anchor-${y}`);p.add(`maplibregl-${u}-anchor-${t}`,`mapboxgl-${u}-anchor-${t}`)}class Xa extends n.Evented{constructor(t,u){if(super(),(t instanceof HTMLElement||u)&&(t=n.extend({element:t},u)),n.bindAll(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress"],this),this._anchor=t&&t.anchor||"center",this._color=t&&t.color||"#3FB1CE",this._scale=t&&t.scale||1,this._draggable=t&&t.draggable||!1,this._clickTolerance=t&&t.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=t&&t.rotation||0,this._rotationAlignment=t&&t.rotationAlignment||"auto",this._pitchAlignment=t&&t.pitchAlignment&&t.pitchAlignment!=="auto"?t.pitchAlignment:this._rotationAlignment,t&&t.element)this._element=t.element,this._offset=n.pointGeometry.convert(t&&t.offset||[0,0]);else{this._defaultMarker=!0,this._element=k.create("div"),this._element.setAttribute("aria-label","Map marker");const p=k.createNS("http://www.w3.org/2000/svg","svg"),y=41,x=27;p.setAttributeNS(null,"display","block"),p.setAttributeNS(null,"height",`${y}px`),p.setAttributeNS(null,"width",`${x}px`),p.setAttributeNS(null,"viewBox",`0 0 ${x} ${y}`);const I=k.createNS("http://www.w3.org/2000/svg","g");I.setAttributeNS(null,"stroke","none"),I.setAttributeNS(null,"stroke-width","1"),I.setAttributeNS(null,"fill","none"),I.setAttributeNS(null,"fill-rule","evenodd");const R=k.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"fill-rule","nonzero");const O=k.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(3.0, 29.0)"),O.setAttributeNS(null,"fill","#000000");const V=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const Ve of V){const xe=k.createNS("http://www.w3.org/2000/svg","ellipse");xe.setAttributeNS(null,"opacity","0.04"),xe.setAttributeNS(null,"cx","10.5"),xe.setAttributeNS(null,"cy","5.80029008"),xe.setAttributeNS(null,"rx",Ve.rx),xe.setAttributeNS(null,"ry",Ve.ry),O.appendChild(xe)}const G=k.createNS("http://www.w3.org/2000/svg","g");G.setAttributeNS(null,"fill",this._color);const K=k.createNS("http://www.w3.org/2000/svg","path");K.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),G.appendChild(K);const ie=k.createNS("http://www.w3.org/2000/svg","g");ie.setAttributeNS(null,"opacity","0.25"),ie.setAttributeNS(null,"fill","#000000");const me=k.createNS("http://www.w3.org/2000/svg","path");me.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),ie.appendChild(me);const fe=k.createNS("http://www.w3.org/2000/svg","g");fe.setAttributeNS(null,"transform","translate(6.0, 7.0)"),fe.setAttributeNS(null,"fill","#FFFFFF");const de=k.createNS("http://www.w3.org/2000/svg","g");de.setAttributeNS(null,"transform","translate(8.0, 8.0)");const ze=k.createNS("http://www.w3.org/2000/svg","circle");ze.setAttributeNS(null,"fill","#000000"),ze.setAttributeNS(null,"opacity","0.25"),ze.setAttributeNS(null,"cx","5.5"),ze.setAttributeNS(null,"cy","5.5"),ze.setAttributeNS(null,"r","5.4999962");const De=k.createNS("http://www.w3.org/2000/svg","circle");De.setAttributeNS(null,"fill","#FFFFFF"),De.setAttributeNS(null,"cx","5.5"),De.setAttributeNS(null,"cy","5.5"),De.setAttributeNS(null,"r","5.4999962"),de.appendChild(ze),de.appendChild(De),R.appendChild(O),R.appendChild(G),R.appendChild(ie),R.appendChild(fe),R.appendChild(de),p.appendChild(R),p.setAttributeNS(null,"height",y*this._scale+"px"),p.setAttributeNS(null,"width",x*this._scale+"px"),this._element.appendChild(p),this._offset=n.pointGeometry.convert(t&&t.offset||[0,-14])}this._element.classList.add("maplibregl-marker","mapboxgl-marker"),this._element.addEventListener("dragstart",p=>{p.preventDefault()}),this._element.addEventListener("mousedown",p=>{p.preventDefault()}),lr(this._element,this._anchor,"marker"),this._popup=null}addTo(t){return this.remove(),this._map=t,t.getCanvasContainer().appendChild(this._element),t.on("move",this._update),t.on("moveend",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),k.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(t){return this._lngLat=n.LngLat.convert(t),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(t){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),t){if(!("offset"in t.options)){const y=Math.sqrt(Math.pow(13.5,2)/2);t.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[y,-1*(38.1-13.5+y)],"bottom-right":[-y,-1*(38.1-13.5+y)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=t,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}_onKeyPress(t){const u=t.code,p=t.charCode||t.keyCode;u!=="Space"&&u!=="Enter"&&p!==32&&p!==13||this.togglePopup()}_onMapClick(t){const u=t.originalEvent.target,p=this._element;this._popup&&(u===p||p.contains(u))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const t=this._popup;return t?(t.isOpen()?t.remove():t.addTo(this._map),this):this}_update(t){if(!this._map)return;this._map.transform.renderWorldCopies&&(this._lngLat=Ds(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let u="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?u=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(u=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let p="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?p="rotateX(0deg)":this._pitchAlignment==="map"&&(p=`rotateX(${this._map.getPitch()}deg)`),t&&t.type!=="moveend"||(this._pos=this._pos.round()),k.setTransform(this._element,`${Kt[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${p} ${u}`),this._map.style&&this._map.style.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const y=this._map.unproject(this._pos),x=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=y.distanceTo(this._lngLat)>20*x?"0.2":"1.0",this._opacityTimeout=null},100))}getOffset(){return this._offset}setOffset(t){return this._offset=n.pointGeometry.convert(t),this._update(),this}_onMove(t){if(!this._isDragging){const u=this._clickTolerance||this._map._clickTolerance;this._isDragging=t.point.dist(this._pointerdownPos)>=u}this._isDragging&&(this._pos=t.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new n.Event("dragstart"))),this.fire(new n.Event("drag")))}_onUp(){this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new n.Event("dragend")),this._state="inactive"}_addDragHandler(t){this._element.contains(t.originalEvent.target)&&(t.preventDefault(),this._positionDelta=t.point.sub(this._pos).add(this._offset),this._pointerdownPos=t.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))}setDraggable(t){return this._draggable=!!t,this._map&&(t?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(t){return this._rotation=t||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(t){return this._rotationAlignment=t||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(t){return this._pitchAlignment=t&&t!=="auto"?t:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const vl={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let fa,Fi=0,da=!1;const Dn={maxWidth:100,unit:"metric"};function Gc(g,t,u){const p=u&&u.maxWidth||100,y=g._container.clientHeight/2,x=g.unproject([0,y]),I=g.unproject([p,y]),R=x.distanceTo(I);if(u&&u.unit==="imperial"){const O=3.2808*R;O>5280?pa(t,p,O/5280,g._getUIString("ScaleControl.Miles")):pa(t,p,O,g._getUIString("ScaleControl.Feet"))}else u&&u.unit==="nautical"?pa(t,p,R/1852,g._getUIString("ScaleControl.NauticalMiles")):R>=1e3?pa(t,p,R/1e3,g._getUIString("ScaleControl.Kilometers")):pa(t,p,R,g._getUIString("ScaleControl.Meters"))}function pa(g,t,u,p){const y=function(x){const I=Math.pow(10,`${Math.floor(x)}`.length-1);let R=x/I;return R=R>=10?10:R>=5?5:R>=3?3:R>=2?2:R>=1?1:function(O){const V=Math.pow(10,Math.ceil(-Math.log(O)/Math.LN10));return Math.round(O*V)/V}(R),I*R}(u);g.style.width=t*(y/u)+"px",g.innerHTML=`${y} ${p}`}const di={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},bi=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function bl(g){if(g){if(typeof g=="number"){const t=Math.round(Math.sqrt(.5*Math.pow(g,2)));return{center:new n.pointGeometry(0,0),top:new n.pointGeometry(0,g),"top-left":new n.pointGeometry(t,t),"top-right":new n.pointGeometry(-t,t),bottom:new n.pointGeometry(0,-g),"bottom-left":new n.pointGeometry(t,-t),"bottom-right":new n.pointGeometry(-t,-t),left:new n.pointGeometry(g,0),right:new n.pointGeometry(-g,0)}}if(g instanceof n.pointGeometry||Array.isArray(g)){const t=n.pointGeometry.convert(g);return{center:t,top:t,"top-left":t,"top-right":t,bottom:t,"bottom-left":t,"bottom-right":t,left:t,right:t}}return{center:n.pointGeometry.convert(g.center||[0,0]),top:n.pointGeometry.convert(g.top||[0,0]),"top-left":n.pointGeometry.convert(g["top-left"]||[0,0]),"top-right":n.pointGeometry.convert(g["top-right"]||[0,0]),bottom:n.pointGeometry.convert(g.bottom||[0,0]),"bottom-left":n.pointGeometry.convert(g["bottom-left"]||[0,0]),"bottom-right":n.pointGeometry.convert(g["bottom-right"]||[0,0]),left:n.pointGeometry.convert(g.left||[0,0]),right:n.pointGeometry.convert(g.right||[0,0])}}return bl(new n.pointGeometry(0,0))}const Ta={supported:m,setRTLTextPlugin:n.setRTLTextPlugin,getRTLTextPluginStatus:n.getRTLTextPluginStatus,Map:class extends si{constructor(g){var t;if(n.PerformanceUtils.mark(n.PerformanceMarkers.create),(g=n.extend({},qc,g)).minZoom!=null&&g.maxZoom!=null&&g.minZoom>g.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(g.minPitch!=null&&g.maxPitch!=null&&g.minPitch>g.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(g.minPitch!=null&&g.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(g.maxPitch!=null&&g.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new ks(g.minZoom,g.maxZoom,g.minPitch,g.maxPitch,g.renderWorldCopies),{bearingSnap:g.bearingSnap}),this._interactive=g.interactive,this._cooperativeGestures=g.cooperativeGestures,this._maxTileCacheSize=g.maxTileCacheSize,this._failIfMajorPerformanceCaveat=g.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=g.preserveDrawingBuffer,this._antialias=g.antialias,this._trackResize=g.trackResize,this._bearingSnap=g.bearingSnap,this._refreshExpiredTiles=g.refreshExpiredTiles,this._fadeDuration=g.fadeDuration,this._crossSourceCollisions=g.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=g.collectResourceTiming,this._renderTaskQueue=new $c,this._controls=[],this._mapId=n.uniqueId(),this._locale=n.extend({},jc,g.locale),this._clickTolerance=g.clickTolerance,this._pixelRatio=(t=g.pixelRatio)!==null&&t!==void 0?t:devicePixelRatio,this._requestManager=new A(g.transformRequest),typeof g.container=="string"){if(this._container=document.getElementById(g.container),!this._container)throw new Error(`Container '${g.container}' not found.`)}else{if(!(g.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=g.container}if(g.maxBounds&&this.setMaxBounds(g.maxBounds),n.bindAll(["_onWindowOnline","_onWindowResize","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),typeof window<"u"&&(addEventListener("online",this._onWindowOnline,!1),addEventListener("resize",this._onWindowResize,!1),addEventListener("orientationchange",this._onWindowResize,!1)),this.handlers=new Vc(this,g),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=g.hash&&new Pc(typeof g.hash=="string"&&g.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:g.center,zoom:g.zoom,bearing:g.bearing,pitch:g.pitch}),g.bounds&&(this.resize(),this.fitBounds(g.bounds,n.extend({},g.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=g.localIdeographFontFamily,g.style&&this.setStyle(g.style,{localIdeographFontFamily:g.localIdeographFontFamily}),g.attributionControl&&this.addControl(new Ms({customAttribution:g.customAttribution})),g.maplibreLogo&&this.addControl(new mo,g.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",u=>{this._update(u.dataType==="style"),this.fire(new n.Event(`${u.dataType}data`,u))}),this.on("dataloading",u=>{this.fire(new n.Event(`${u.dataType}dataloading`,u))}),this.on("dataabort",u=>{this.fire(new n.Event("sourcedataabort",u))})}_getMapId(){return this._mapId}addControl(g,t){if(t===void 0&&(t=g.getDefaultPosition?g.getDefaultPosition():"top-right"),!g||!g.onAdd)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const u=g.onAdd(this);this._controls.push(g);const p=this._controlPositions[t];return t.indexOf("bottom")!==-1?p.insertBefore(u,p.firstChild):p.appendChild(u),this}removeControl(g){if(!g||!g.onRemove)return this.fire(new n.ErrorEvent(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const t=this._controls.indexOf(g);return t>-1&&this._controls.splice(t,1),g.onRemove(this),this}hasControl(g){return this._controls.indexOf(g)>-1}calculateCameraOptionsFromTo(g,t,u,p){return p==null&&this.style.terrain&&(p=this.transform.getElevation(u,this.style.terrain)),super.calculateCameraOptionsFromTo(g,t,u,p)}resize(g){const t=this._containerDimensions(),u=t[0],p=t[1];this._resizeCanvas(u,p,this.getPixelRatio()),this.transform.resize(u,p),this.painter.resize(u,p,this.getPixelRatio());const y=!this._moving;return y&&(this.stop(),this.fire(new n.Event("movestart",g)).fire(new n.Event("move",g))),this.fire(new n.Event("resize",g)),y&&this.fire(new n.Event("moveend",g)),this}getPixelRatio(){return this._pixelRatio}setPixelRatio(g){const[t,u]=this._containerDimensions();this._pixelRatio=g,this._resizeCanvas(t,u,g),this.painter.resize(t,u,g)}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(g){return this.transform.setMaxBounds(n.LngLatBounds.convert(g)),this._update()}setMinZoom(g){if((g=g??-2)>=-2&&g<=this.transform.maxZoom)return this.transform.minZoom=g,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=g,this._update(),this.getZoom()>g&&this.setZoom(g),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(g){if((g=g??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(g>=0&&g<=this.transform.maxPitch)return this.transform.minPitch=g,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(g>=this.transform.minPitch)return this.transform.maxPitch=g,this._update(),this.getPitch()>g&&this.setPitch(g),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(g){return this.transform.renderWorldCopies=g,this._update()}project(g){return this.transform.locationPoint(n.LngLat.convert(g),this.style&&this.style.terrain)}unproject(g){return this.transform.pointLocation(n.pointGeometry.convert(g),this.style&&this.style.terrain)}isMoving(){return this._moving||this.handlers.isMoving()}isZooming(){return this._zooming||this.handlers.isZooming()}isRotating(){return this._rotating||this.handlers.isRotating()}_createDelegatedListener(g,t,u){if(g==="mouseenter"||g==="mouseover"){let p=!1;return{layer:t,listener:u,delegates:{mousemove:x=>{const I=this.getLayer(t)?this.queryRenderedFeatures(x.point,{layers:[t]}):[];I.length?p||(p=!0,u.call(this,new sn(g,this,x.originalEvent,{features:I}))):p=!1},mouseout:()=>{p=!1}}}}if(g==="mouseleave"||g==="mouseout"){let p=!1;return{layer:t,listener:u,delegates:{mousemove:I=>{(this.getLayer(t)?this.queryRenderedFeatures(I.point,{layers:[t]}):[]).length?p=!0:p&&(p=!1,u.call(this,new sn(g,this,I.originalEvent)))},mouseout:I=>{p&&(p=!1,u.call(this,new sn(g,this,I.originalEvent)))}}}}{const p=y=>{const x=this.getLayer(t)?this.queryRenderedFeatures(y.point,{layers:[t]}):[];x.length&&(y.features=x,u.call(this,y),delete y.features)};return{layer:t,listener:u,delegates:{[g]:p}}}}on(g,t,u){if(u===void 0)return super.on(g,t);const p=this._createDelegatedListener(g,t,u);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[g]=this._delegatedListeners[g]||[],this._delegatedListeners[g].push(p);for(const y in p.delegates)this.on(y,p.delegates[y]);return this}once(g,t,u){if(u===void 0)return super.once(g,t);const p=this._createDelegatedListener(g,t,u);for(const y in p.delegates)this.once(y,p.delegates[y]);return this}off(g,t,u){return u===void 0?super.off(g,t):(this._delegatedListeners&&this._delegatedListeners[g]&&(p=>{const y=this._delegatedListeners[g];for(let x=0;x{p?this.fire(new n.ErrorEvent(p)):y&&this._updateDiff(y,t)})}else typeof g=="object"&&this._updateDiff(g,t)}_updateDiff(g,t){try{this.style.setState(g)&&this._update(!0)}catch(u){n.warnOnce(`Unable to perform style diff: ${u.message||u.error||u}. Rebuilding the style from scratch.`),this._updateStyle(g,t)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():n.warnOnce("There is no style added to the map.")}addSource(g,t){return this._lazyInitEmptyStyle(),this.style.addSource(g,t),this._update(!0)}isSourceLoaded(g){const t=this.style&&this.style.sourceCaches[g];if(t!==void 0)return t.loaded();this.fire(new n.ErrorEvent(new Error(`There is no source with ID '${g}'`)))}setTerrain(g){return this.style.setTerrain(g),this}getTerrain(){return this.style.terrain&&this.style.terrain.options}areTilesLoaded(){const g=this.style&&this.style.sourceCaches;for(const t in g){const u=g[t]._tiles;for(const p in u){const y=u[p];if(y.state!=="loaded"&&y.state!=="errored")return!1}}return!0}addSourceType(g,t,u){return this._lazyInitEmptyStyle(),this.style.addSourceType(g,t,u)}removeSource(g){return this.style.removeSource(g),this._update(!0)}getSource(g){return this.style.getSource(g)}addImage(g,t,{pixelRatio:u=1,sdf:p=!1,stretchX:y,stretchY:x,content:I}={}){if(this._lazyInitEmptyStyle(),t instanceof HTMLImageElement||n.isImageBitmap(t)){const{width:R,height:O,data:V}=n.exported.getImageData(t);this.style.addImage(g,{data:new n.RGBAImage({width:R,height:O},V),pixelRatio:u,stretchX:y,stretchY:x,content:I,sdf:p,version:0})}else{if(t.width===void 0||t.height===void 0)return this.fire(new n.ErrorEvent(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:R,height:O,data:V}=t,G=t;this.style.addImage(g,{data:new n.RGBAImage({width:R,height:O},new Uint8Array(V)),pixelRatio:u,stretchX:y,stretchY:x,content:I,sdf:p,version:0,userImage:G}),G.onAdd&&G.onAdd(this,g)}}}updateImage(g,t){const u=this.style.getImage(g);if(!u)return this.fire(new n.ErrorEvent(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const p=t instanceof HTMLImageElement||n.isImageBitmap(t)?n.exported.getImageData(t):t,{width:y,height:x,data:I}=p;if(y===void 0||x===void 0)return this.fire(new n.ErrorEvent(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(y!==u.data.width||x!==u.data.height)return this.fire(new n.ErrorEvent(new Error("The width and height of the updated image must be that same as the previous version of the image")));const R=!(t instanceof HTMLImageElement||n.isImageBitmap(t));u.data.replace(I,R),this.style.updateImage(g,u)}hasImage(g){return g?!!this.style.getImage(g):(this.fire(new n.ErrorEvent(new Error("Missing required image id"))),!1)}removeImage(g){this.style.removeImage(g)}loadImage(g,t){n.getImage(this._requestManager.transformRequest(g,n.ResourceType.Image),t)}listImages(){return this.style.listImages()}addLayer(g,t){return this._lazyInitEmptyStyle(),this.style.addLayer(g,t),this._update(!0)}moveLayer(g,t){return this.style.moveLayer(g,t),this._update(!0)}removeLayer(g){return this.style.removeLayer(g),this._update(!0)}getLayer(g){return this.style.getLayer(g)}setLayerZoomRange(g,t,u){return this.style.setLayerZoomRange(g,t,u),this._update(!0)}setFilter(g,t,u={}){return this.style.setFilter(g,t,u),this._update(!0)}getFilter(g){return this.style.getFilter(g)}setPaintProperty(g,t,u,p={}){return this.style.setPaintProperty(g,t,u,p),this._update(!0)}getPaintProperty(g,t){return this.style.getPaintProperty(g,t)}setLayoutProperty(g,t,u,p={}){return this.style.setLayoutProperty(g,t,u,p),this._update(!0)}getLayoutProperty(g,t){return this.style.getLayoutProperty(g,t)}setLight(g,t={}){return this._lazyInitEmptyStyle(),this.style.setLight(g,t),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(g,t){return this.style.setFeatureState(g,t),this._update()}removeFeatureState(g,t){return this.style.removeFeatureState(g,t),this._update()}getFeatureState(g){return this.style.getFeatureState(g)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let g=0,t=0;return this._container&&(g=this._container.clientWidth||400,t=this._container.clientHeight||300),[g,t]}_setupContainer(){const g=this._container;g.classList.add("maplibregl-map","mapboxgl-map");const t=this._canvasContainer=k.create("div","maplibregl-canvas-container mapboxgl-canvas-container",g);this._interactive&&t.classList.add("maplibregl-interactive","mapboxgl-interactive"),this._canvas=k.create("canvas","maplibregl-canvas mapboxgl-canvas",t),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const u=this._containerDimensions();this._resizeCanvas(u[0],u[1],this.getPixelRatio());const p=this._controlContainer=k.create("div","maplibregl-control-container mapboxgl-control-container",g),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(x=>{y[x]=k.create("div",`maplibregl-ctrl-${x} mapboxgl-ctrl-${x}`,p)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){const g=this._container;this._metaPress=!1,this._cooperativeGesturesScreen=k.create("div","maplibregl-cooperative-gesture-screen",g);let t="Control",u=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(u=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map",t="Meta"),this._cooperativeGesturesScreen.innerHTML=`
${u}
${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
- `,document.addEventListener("keydown",p=>{p.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",p=>{p.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",p=>{this._onCooperativeGesture(p,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(g,t,u){this._canvas.width=u*g,this._canvas.height=u*t,this._canvas.style.width=`${g}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const g=n.extend({},m.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",g)||this._canvas.getContext("experimental-webgl",g);t?(this.painter=new ul(t,this.transform),n.exported$1.testSupport(t)):this.fire(new n.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(g){g.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new n.Event("webglcontextlost",{originalEvent:g}))}_contextRestored(g){this._setupPainter(),this.resize(),this._update(),this.fire(new n.Event("webglcontextrestored",{originalEvent:g}))}_onMapScroll(g){if(g.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(g,t,u){return!t&&u<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(g){return this.style?(this._styleDirty=this._styleDirty||g,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(g){return this._update(),this._renderTaskQueue.add(g)}_cancelRenderFrame(g){this._renderTaskQueue.remove(g)}_render(g){let t,u=0;const p=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=p.createQueryEXT(),p.beginQueryEXT(p.TIME_ELAPSED_EXT,t),u=n.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(g),this._removed)return;let y=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const I=this.transform.zoom,R=n.exported.now();this.style.zoomHistory.update(I,R);const O=new n.EvaluationParameters(I,{now:R,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),V=O.crossFadingFactor();V===1&&V===this._crossFadingFactor||(y=!0,this._crossFadingFactor=V),this.style.update(O)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new n.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.load),this.fire(new n.Event("load"))),this.style&&(this.style.hasTransitions()||y)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const I=n.exported.now()-u;p.endQueryEXT(p.TIME_ELAPSED_EXT,t),setTimeout(()=>{const R=p.getQueryObjectEXT(t,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(t),this.fire(new n.Event("gpu-timing-frame",{cpuTime:I,gpuTime:R}))},50)}if(this.listens("gpu-timing-layer")){const I=this.painter.collectGpuTimers();setTimeout(()=>{const R=this.painter.queryGpuTimers(I);this.fire(new n.Event("gpu-timing-layer",{layerTimes:R}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty;return x||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.Event("idle")),!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const g=this.painter.context.gl.getExtension("WEBGL_lose_context");g&&g.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),k.remove(this._canvasContainer),k.remove(this._controlContainer),this._cooperativeGestures&&k.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),n.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new n.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=n.exported.frame(g=>{n.PerformanceUtils.frame(g),this._frame=null,this._render(g)}))}_onWindowOnline(){this._update()}_onWindowResize(g){this._trackResize&&this.resize({originalEvent:g})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(g){this._showTileBoundaries!==g&&(this._showTileBoundaries=g,this._update())}get showPadding(){return!!this._showPadding}set showPadding(g){this._showPadding!==g&&(this._showPadding=g,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(g){this._showCollisionBoxes!==g&&(this._showCollisionBoxes=g,g?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(g){this._showOverdrawInspector!==g&&(this._showOverdrawInspector=g,this._update())}get repaint(){return!!this._repaint}set repaint(g){this._repaint!==g&&(this._repaint=g,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(g){this._vertices=g,this._update()}_setCacheLimits(g,t){n.setCacheLimits(g,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(g){this.options=n.extend({},dh,g),this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(n.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(n.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const g=this._map.getZoom(),t=g===this._map.getMaxZoom(),u=g===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const g=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=g}onAdd(g){return this._map=g,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Mn(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){k.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(g,t){const u=k.create("button",g,this._container);return u.type="button",u.addEventListener("click",t),u}_setButtonTitle(g,t){const u=this._map._getUIString(`NavigationControl.${t}`);g.title=u,g.setAttribute("aria-label",u)}},GeolocateControl:class extends n.Evented{constructor(g){super(),this.options=n.extend({},bl,g),n.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(g){var t;return this._map=g,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,fs!==void 0?t(fs):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(u=>{fs=u.state!=="denied",t(fs)}):(fs=!!window.navigator.geolocation,t(fs)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),k.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fi=0,ds=!1}_isOutOfMapMaxBounds(g){const t=this._map.getMaxBounds(),u=g.coords;return t&&(u.longitudet.getEast()||u.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(g){if(this._map){if(this._isOutOfMapMaxBounds(g))return this._setErrorState(),this.fire(new n.Event("outofmaxbounds",g)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=g,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(g),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(g),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new n.Event("geolocate",g)),this._finish()}}_updateCamera(g){const t=new n.LngLat(g.coords.longitude,g.coords.latitude),u=g.coords.accuracy,p=this._map.getBearing(),y=n.extend({bearing:p},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(u),y,{geolocateSource:!0})}_updateMarker(g){if(g){const t=new n.LngLat(g.coords.longitude,g.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=g.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const g=this._map._container.clientHeight/2,t=this._map.unproject([0,g]),u=this._map.unproject([1,g]),p=t.distanceTo(u),y=Math.ceil(2*this._accuracy/p);this._circleElement.style.width=`${y}px`,this._circleElement.style.height=`${y}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(g){if(this._map){if(this.options.trackUserLocation)if(g.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(g.code===3&&ds)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new n.Event("error",g)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(g){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=k.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",g===!1){n.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=k.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Xs(this._dotElement),this._circleElement=k.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Xs({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new n.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return n.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new n.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fi--,ds=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new n.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new n.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let g;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Fi++,Fi>1?(g={maximumAge:6e5,timeout:0},ds=!0):(g=this.options.positionOptions,ds=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,g)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ma,LogoControl:mo,ScaleControl:class{constructor(g){this.options=n.extend({},Dn,g),n.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Zc(this._map,this._container,this.options)}onAdd(g){return this._map=g,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",g.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){k.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(g){this.options.unit=g,Zc(this._map,this._container,this.options)}},FullscreenControl:class{constructor(g){this._fullscreen=!1,g&&g.container&&(g.container instanceof HTMLElement?this._container=g.container:n.warnOnce("Full screen control 'container' must be a DOM element.")),n.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(g){return this._map=g,this._container||(this._container=this._map.getContainer()),this._controlContainer=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",n.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){k.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const g=this._fullscreenButton=k.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",g).setAttribute("aria-hidden","true"),g.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const g=this._getTitle();this._fullscreenButton.setAttribute("aria-label",g),this._fullscreenButton.title=g}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(g){this.options=g,n.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(g){return this._map=g,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=k.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){k.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends n.Evented{constructor(g){super(),this.options=n.extend(Object.create(di),g),n.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(g){return this._map&&this.remove(),this._map=g,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new n.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&k.remove(this._content),this._container&&(k.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new n.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(g){return this._lngLat=n.LngLat.convert(g),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(g){return this.setDOMContent(document.createTextNode(g))}setHTML(g){const t=document.createDocumentFragment(),u=document.createElement("body");let p;for(u.innerHTML=g;p=u.firstChild,p;)t.appendChild(p);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(g){return this.options.maxWidth=g,this._update(),this}setDOMContent(g){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=k.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(g),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(g){this._container&&this._container.classList.add(g)}removeClassName(g){this._container&&this._container.classList.remove(g)}setOffset(g){return this.options.offset=g,this._update(),this}toggleClassName(g){if(this._container)return this._container.classList.toggle(g)}_createCloseButton(){this.options.closeButton&&(this._closeButton=k.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(g){this._update(g.point)}_onMouseMove(g){this._update(g.point)}_onDrag(g){this._update(g.point)}_update(g){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=k.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=k.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(x=>this._container.classList.add(x)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Da(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!g))return;const t=this._pos=this._trackPointer&&g?g:this._map.project(this._lngLat);let u=this.options.anchor;const p=xl(this.options.offset);if(!u){const x=this._container.offsetWidth,I=this._container.offsetHeight;let R;R=t.y+p.bottom.ythis._map.transform.height-I?["bottom"]:[],t.xthis._map.transform.width-x/2&&R.push("right"),u=R.length===0?"bottom":R.join("-")}const y=t.add(p[u]).round();k.setTransform(this._container,`${Kt[u]} translate(${y.x}px,${y.y}px)`),lr(this._container,u,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const g=this._container.querySelector(bi);g&&g.focus()}_onClose(){this.remove()}},Marker:Xs,Style:fi,LngLat:n.LngLat,LngLatBounds:n.LngLatBounds,Point:n.pointGeometry,MercatorCoordinate:n.MercatorCoordinate,Evented:n.Evented,AJAXError:n.AJAXError,config:n.config,CanvasSource:oe,GeoJSONSource:rt,ImageSource:it,RasterDEMTileSource:ct,RasterTileSource:Z,VectorTileSource:We,VideoSource:et,prewarm:function(){tt().acquire(Rr)},clearPrewarmedResources:function(){const g=ut;g&&(g.isPreloaded()&&g.numActive()===1?(g.release(Rr),ut=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Vr.workerCount},set workerCount(g){Vr.workerCount=g},get maxParallelImageRequests(){return n.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(g){n.config.MAX_PARALLEL_IMAGE_REQUESTS=g},clearStorage(g){n.clearTileCache(g)},workerUrl:"",addProtocol(g,t){n.config.REGISTERED_PROTOCOLS[g]=t},removeProtocol(g){delete n.config.REGISTERED_PROTOCOLS[g]}};return _n.extend(Ts,{isSafari:n.isSafari,getPerformanceMetrics:n.PerformanceUtils.getPerformanceMetrics}),Ts});var d=c;return d})})(ny);var _E=ny.exports;const Mo=$u(_E);var pn=(o,r,s)=>new Promise((l,c)=>{var f=m=>{try{n(s.next(m))}catch(b){c(b)}},d=m=>{try{n(s.throw(m))}catch(b){c(b)}},n=m=>m.done?l(m.value):Promise.resolve(m.value).then(f,d);n((s=s.apply(o,r)).next())}),Pn=Uint8Array,Lo=Uint16Array,yE=Int32Array,ay=new Pn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),oy=new Pn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),vE=new Pn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ly=function(o,r){for(var s=new Lo(31),l=0;l<31;++l)s[l]=r+=1<>1|(Jr&21845)<<1,Bs=(Bs&52428)>>2|(Bs&13107)<<2,Bs=(Bs&61680)>>4|(Bs&3855)<<4,wf[Jr]=((Bs&65280)>>8|(Bs&255)<<8)>>1;var Bs,Jr,Ql=function(o,r,s){for(var l=o.length,c=0,f=new Lo(r);c>m]=b}else for(n=new Lo(l),c=0;c>15-o[c]);return n},uc=new Pn(288);for(Jr=0;Jr<144;++Jr)uc[Jr]=8;var Jr;for(Jr=144;Jr<256;++Jr)uc[Jr]=9;var Jr;for(Jr=256;Jr<280;++Jr)uc[Jr]=7;var Jr;for(Jr=280;Jr<288;++Jr)uc[Jr]=8;var Jr,hy=new Pn(32);for(Jr=0;Jr<32;++Jr)hy[Jr]=5;var Jr,EE=Ql(uc,9,1),kE=Ql(hy,5,1),cf=function(o){for(var r=o[0],s=1;sr&&(r=o[s]);return r},Qn=function(o,r,s){var l=r/8|0;return(o[l]|o[l+1]<<8)>>(r&7)&s},uf=function(o,r){var s=r/8|0;return(o[s]|o[s+1]<<8|o[s+2]<<16)>>(r&7)},SE=function(o){return(o+7)/8|0},TE=function(o,r,s){(r==null||r<0)&&(r=0),(s==null||s>o.length)&&(s=o.length);var l=new Pn(s-r);return l.set(o.subarray(r,s)),l},IE=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],An=function(o,r,s){var l=new Error(r||IE[o]);if(l.code=o,Error.captureStackTrace&&Error.captureStackTrace(l,An),!s)throw l;return l},dd=function(o,r,s,l){var c=o.length,f=l?l.length:0;if(!c||r.f&&!r.l)return s||new Pn(0);var d=!s||r.i!=2,n=r.i;s||(s=new Pn(c*3));var m=function(Bt){var Qt=s.length;if(Bt>Qt){var Rr=new Pn(Math.max(Qt*2,Bt));Rr.set(s),s=Rr}},b=r.f||0,w=r.p||0,S=r.b||0,k=r.l,A=r.d,P=r.m,T=r.n,L=c*8;do{if(!k){b=Qn(o,w,1);var D=Qn(o,w+1,3);if(w+=3,D)if(D==1)k=EE,A=kE,P=9,T=5;else if(D==2){var Y=Qn(o,w,31)+257,se=Qn(o,w+10,15)+4,re=Y+Qn(o,w+5,31)+1;w+=14;for(var ce=new Pn(re),ye=new Pn(19),Ae=0;Ae>4;if(B<16)ce[Ae++]=B;else{var $e=0,ct=0;for(B==16?(ct=3+Qn(o,w,3),w+=2,$e=ce[Ae-1]):B==17?(ct=3+Qn(o,w,7),w+=3):B==18&&(ct=11+Qn(o,w,127),w+=7);ct--;)ce[Ae++]=$e}}var rt=ce.subarray(0,Y),$t=ce.subarray(Y);P=cf(rt),T=cf($t),k=Ql(rt,P,1),A=Ql($t,T,1)}else An(1);else{var B=SE(w)+4,$=o[B-4]|o[B-3]<<8,J=B+$;if(J>c){n&&An(0);break}d&&m(S+$),s.set(o.subarray(B,J),S),r.b=S+=$,r.p=w=J*8,r.f=b;continue}if(w>L){n&&An(0);break}}d&&m(S+131072);for(var it=(1<>4;if(w+=$e&15,w>L){n&&An(0);break}if($e||An(2),ge<256)s[S++]=ge;else if(ge==256){oe=w,k=null;break}else{var Me=ge-254;if(ge>264){var Ae=ge-257,ee=ay[Ae];Me=Qn(o,w,(1<>4;ue||An(3),w+=ue&15;var $t=wE[Je];if(Je>3){var ee=oy[Je];$t+=uf(o,w)&(1<L){n&&An(0);break}d&&m(S+131072);var wt=S+Me;if(S<$t){var pt=f-$t,Xe=Math.min($t,wt);for(pt+S<0&&An(3);S>3&1)+(r>>4&1);l>0;l-=!o[s++]);return s+(r&2)},PE=function(o){var r=o.length;return(o[r-4]|o[r-3]<<8|o[r-2]<<16|o[r-1]<<24)>>>0},zE=function(o,r){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&An(6,"invalid zlib data"),(o[1]>>5&1)==+!r&&An(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function ME(o,r){return dd(o,{i:2},r&&r.out,r&&r.dictionary)}function DE(o,r){var s=AE(o);return s+8>o.length&&An(6,"invalid gzip data"),dd(o.subarray(s,-8),{i:2},r&&r.out||new Pn(PE(o)),r&&r.dictionary)}function RE(o,r){return dd(o.subarray(zE(o,r&&r.dictionary),-4),{i:2},r&&r.out,r&&r.dictionary)}function Ef(o,r){return o[0]==31&&o[1]==139&&o[2]==8?DE(o,r):(o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31?ME(o,r):RE(o,r)}var LE=typeof TextDecoder<"u"&&new TextDecoder,BE=0;try{LE.decode(CE,{stream:!0}),BE=1}catch{}var fy=(o,r)=>o*Math.pow(2,r),jl=(o,r)=>Math.floor(o/Math.pow(2,r)),Nu=(o,r)=>fy(o.getUint16(r+1,!0),8)+o.getUint8(r),dy=(o,r)=>fy(o.getUint32(r+2,!0),16)+o.getUint16(r,!0),OE=(o,r,s,l,c)=>{if(o!=l.getUint8(c))return o-l.getUint8(c);const f=Nu(l,c+1);if(r!=f)return r-f;const d=Nu(l,c+4);return s!=d?s-d:0},FE=(o,r,s,l)=>{const c=py(o,r|128,s,l);return c?{z:r,x:s,y:l,offset:c[0],length:c[1],is_dir:!0}:null},pg=(o,r,s,l)=>{const c=py(o,r,s,l);return c?{z:r,x:s,y:l,offset:c[0],length:c[1],is_dir:!1}:null},py=(o,r,s,l)=>{let c=0,f=o.byteLength/17-1;for(;c<=f;){const d=f+c>>1,n=OE(r,s,l,o,d*17);if(n>0)c=d+1;else if(n<0)f=d-1;else return[dy(o,d*17+7),o.getUint32(d*17+13,!0)]}return null},NE=(o,r)=>o.is_dir&&!r.is_dir?1:!o.is_dir&&r.is_dir?-1:o.z!==r.z?o.z-r.z:o.x!==r.x?o.x-r.x:o.y-r.y,my=(o,r)=>{const s=o.getUint8(r*17);return{z:s&127,x:Nu(o,r*17+1),y:Nu(o,r*17+4),offset:dy(o,r*17+7),length:o.getUint32(r*17+13,!0),is_dir:s>>7===1}},mg=o=>{const r=[],s=new DataView(o);for(let l=0;l{o.sort(NE);const r=new ArrayBuffer(17*o.length),s=new Uint8Array(r);for(let l=0;l>8&255,s[l*17+3]=c.x>>16&255,s[l*17+4]=c.y&255,s[l*17+5]=c.y>>8&255,s[l*17+6]=c.y>>16&255,s[l*17+7]=c.offset&255,s[l*17+8]=jl(c.offset,8)&255,s[l*17+9]=jl(c.offset,16)&255,s[l*17+10]=jl(c.offset,24)&255,s[l*17+11]=jl(c.offset,32)&255,s[l*17+12]=jl(c.offset,48)&255,s[l*17+13]=c.length&255,s[l*17+14]=c.length>>8&255,s[l*17+15]=c.length>>16&255,s[l*17+16]=c.length>>24&255}return r},VE=(o,r)=>{if(o.byteLength<17)return null;const s=o.byteLength/17,l=my(o,s-1);if(l.is_dir){const c=l.z,f=r.z-c,d=Math.trunc(r.x/(1<{if(o.type=="json"){const s=o.url.substr(10);let l=this.tiles.get(s);return l||(l=new gg(s),this.tiles.set(s,l)),l.getHeader().then(c=>{const f={tiles:[o.url+"/{z}/{x}/{y}"],minzoom:c.minZoom,maxzoom:c.maxZoom,bounds:[c.minLon,c.minLat,c.maxLon,c.maxLat]};r(null,f,null,null)}).catch(c=>{r(c,null,null,null)}),{cancel:()=>{}}}else{const s=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=o.url.match(s);if(!l)throw new Error("Invalid PMTiles protocol URL");const c=l[1];let f=this.tiles.get(c);f||(f=new gg(c),this.tiles.set(c,f));const d=l[2],n=l[3],m=l[4],b=new AbortController,w=b.signal;let S=()=>{b.abort()};return f.getHeader().then(k=>{f.getZxy(+d,+n,+m,w).then(A=>{A?r(null,new Uint8Array(A.data),A.cacheControl,A.expires):k.tileType==1?r(null,new Uint8Array,null,null):r(null,null,null,null)}).catch(A=>{A.name!=="AbortError"&&r(A,null,null,null)})}),{cancel:S}}},this.tiles=new Map}add(o){this.tiles.set(o.source.getKey(),o)}get(o){return this.tiles.get(o)}};function Po(o,r){return(r>>>0)*4294967296+(o>>>0)}function GE(o,r){const s=r.buf;let l,c;if(c=s[r.pos++],l=(c&112)>>4,c<128||(c=s[r.pos++],l|=(c&127)<<3,c<128)||(c=s[r.pos++],l|=(c&127)<<10,c<128)||(c=s[r.pos++],l|=(c&127)<<17,c<128)||(c=s[r.pos++],l|=(c&127)<<24,c<128)||(c=s[r.pos++],l|=(c&1)<<31,c<128))return Po(o,l);throw new Error("Expected varint not more than 10 bytes")}function ql(o){const r=o.buf;let s,l;return l=r[o.pos++],s=l&127,l<128||(l=r[o.pos++],s|=(l&127)<<7,l<128)||(l=r[o.pos++],s|=(l&127)<<14,l<128)||(l=r[o.pos++],s|=(l&127)<<21,l<128)?s:(l=r[o.pos],s|=(l&15)<<28,GE(s,o))}function ZE(o,r,s,l){if(l==0){s==1&&(r[0]=o-1-r[0],r[1]=o-1-r[1]);const c=r[0];r[0]=r[1],r[1]=c}}var HE=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function WE(o,r,s){if(o>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(r>Math.pow(2,o)-1||s>Math.pow(2,o)-1)throw Error("tile x/y outside zoom level bounds");const l=HE[o],c=Math.pow(2,o);let f=0,d=0,n=0;const m=[r,s];let b=c/2;for(;b>0;)f=(m[0]&b)>0?1:0,d=(m[1]&b)>0?1:0,n+=b*b*(3*f^d),ZE(b,m,f,d),b=b/2;return l+n}function _y(o,r){return pn(this,null,function*(){if(r===1||r===0)return o;if(r===2){if(typeof globalThis.DecompressionStream>"u")return Ef(new Uint8Array(o));{let l=new Response(o).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(l).arrayBuffer()}}else throw Error("Compression method not supported")})}var KE=127;function XE(o,r){let s=0,l=o.length-1;for(;s<=l;){const c=l+s>>1,f=r-o[c].tileId;if(f>0)s=c+1;else if(f<0)l=c-1;else return o[c]}return l>=0&&(o[l].runLength===0||r-o[l].tileId=300)throw Error("Bad response code: "+c.status);const f=c.headers.get("Content-Length");if(c.status===200&&(!f||+f>r))throw l&&l.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield c.arrayBuffer(),etag:c.headers.get("ETag")||void 0,cacheControl:c.headers.get("Cache-Control")||void 0,expires:c.headers.get("Expires")||void 0}})}};function es(o,r){const s=o.getUint32(r+4,!0),l=o.getUint32(r+0,!0);return s*Math.pow(2,32)+l}function YE(o,r){const s=new DataView(o),l=s.getUint8(7);if(l>3)throw Error(`Archive is spec version ${l} but this library supports up to spec version 3`);return{specVersion:l,rootDirectoryOffset:es(s,8),rootDirectoryLength:es(s,16),jsonMetadataOffset:es(s,24),jsonMetadataLength:es(s,32),leafDirectoryOffset:es(s,40),leafDirectoryLength:es(s,48),tileDataOffset:es(s,56),tileDataLength:es(s,64),numAddressedTiles:es(s,72),numTileEntries:es(s,80),numTileContents:es(s,88),clustered:s.getUint8(96)===1,internalCompression:s.getUint8(97),tileCompression:s.getUint8(98),tileType:s.getUint8(99),minZoom:s.getUint8(100),maxZoom:s.getUint8(101),minLon:s.getInt32(102,!0)/1e7,minLat:s.getInt32(106,!0)/1e7,maxLon:s.getInt32(110,!0)/1e7,maxLat:s.getInt32(114,!0)/1e7,centerZoom:s.getUint8(118),centerLon:s.getInt32(119,!0)/1e7,centerLat:s.getInt32(123,!0)/1e7,etag:r}}function yy(o){const r={buf:new Uint8Array(o),pos:0},s=ql(r),l=[];let c=0;for(let f=0;f0?l[f].offset=l[f-1].offset+l[f-1].length:l[f].offset=d-1}return l}function QE(o){const r=new DataView(o);return r.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):r.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Bo=class extends Error{};function ek(o,r,s,l){return pn(this,null,function*(){const c=yield o.getBytes(0,16384);if(new DataView(c.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(QE(c.data)<3)return[yield gy.getHeader(o)];const d=c.data.slice(0,KE);let n=c.etag;l&&c.etag!=l&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+o.getKey()),n=void 0);const m=YE(d,n);if(s){const b=c.data.slice(m.rootDirectoryOffset,m.rootDirectoryOffset+m.rootDirectoryLength),w=o.getKey()+"|"+(m.etag||"")+"|"+m.rootDirectoryOffset+"|"+m.rootDirectoryLength,S=yy(yield r(b,m.internalCompression));return[m,[w,S.length,S]]}return[m,void 0]})}function tk(o,r,s,l,c){return pn(this,null,function*(){const f=yield o.getBytes(s,l);if(c.etag&&c.etag!==f.etag)throw new Bo(f.etag);const d=yield r(f.data,c.internalCompression),n=yy(d);if(n.length===0)throw new Error("Empty directory is invalid");return n})}var rk=class{constructor(o=100,r=!0,s=_y){this.cache=new Map,this.maxCacheEntries=o,this.counter=1,this.prefetch=r,this.decompress=s}getHeader(o,r){return pn(this,null,function*(){const s=o.getKey();if(this.cache.has(s))return this.cache.get(s).lastUsed=this.counter++,yield this.cache.get(s).data;const l=new Promise((c,f)=>{ek(o,this.decompress,this.prefetch,r).then(d=>{d[1]&&this.cache.set(d[1][0],{lastUsed:this.counter++,data:Promise.resolve(d[1][2])}),c(d[0]),this.prune()}).catch(d=>{f(d)})});return this.cache.set(s,{lastUsed:this.counter++,data:l}),l})}getDirectory(o,r,s,l){return pn(this,null,function*(){const c=o.getKey()+"|"+(l.etag||"")+"|"+r+"|"+s;if(this.cache.has(c))return this.cache.get(c).lastUsed=this.counter++,yield this.cache.get(c).data;const f=new Promise((d,n)=>{tk(o,this.decompress,r,s,l).then(m=>{d(m),this.prune()}).catch(m=>{n(m)})});return this.cache.set(c,{lastUsed:this.counter++,data:f}),f})}getArrayBuffer(o,r,s,l){return pn(this,null,function*(){const c=o.getKey()+"|"+(l.etag||"")+"|"+r+"|"+s;if(this.cache.has(c))return this.cache.get(c).lastUsed=this.counter++,yield this.cache.get(c).data;const f=new Promise((d,n)=>{o.getBytes(r,s).then(m=>{if(l.etag&&l.etag!==m.etag)throw new Bo(m.etag);d(m.data),this.cache.has(c),this.prune()}).catch(m=>{n(m)})});return this.cache.set(c,{lastUsed:this.counter++,data:f}),f})}prune(){if(this.cache.size>=this.maxCacheEntries){let o=1/0,r;this.cache.forEach((s,l)=>{s.lastUsedf.maxZoom)return;let d=f.rootDirectoryOffset,n=f.rootDirectoryLength;for(let m=0;m<=3;m++){const b=yield this.cache.getDirectory(this.source,d,n,f),w=XE(b,c);if(w)if(w.runLength>0){const S=yield this.source.getBytes(f.tileDataOffset+w.offset,w.length,l);if(f.etag&&f.etag!==S.etag)throw new Bo(S.etag);return{data:yield this.decompress(S.data,f.tileCompression),cacheControl:S.cacheControl,expires:S.expires}}else d=f.leafDirectoryOffset+w.offset,n=w.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(o,r,s,l){return pn(this,null,function*(){try{return yield this.getZxyAttempt(o,r,s,l)}catch(c){if(c instanceof Bo)return this.cache.invalidate(this.source,c.message),yield this.getZxyAttempt(o,r,s,l);throw c}})}getMetadataAttempt(){return pn(this,null,function*(){const o=yield this.cache.getHeader(this.source),r=yield this.source.getBytes(o.jsonMetadataOffset,o.jsonMetadataLength);if(o.etag&&o.etag!==r.etag)throw new Bo(r.etag);const s=yield this.decompress(r.data,o.internalCompression),l=new TextDecoder("utf-8");return JSON.parse(l.decode(s))})}getMetadata(){return pn(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(o){if(o instanceof Bo)return this.cache.invalidate(this.source,o.message),yield this.getMetadataAttempt();throw o}})}};const{document:_g}=y_;function yg(o){let r;const s=o[20].default,l=Di(s,o,o[19],null);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f&524288)&&Ri(l,s,c,c[19],r?Bi(s,c[19],f,null):Li(c[19]),null)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function ik(o){let r,s,l,c,f,d=o[3]&&yg(o);return{c(){r=Ne("link"),l=Et(),c=Ne("div"),d&&d.c(),this.h()},l(n){const m=__("svelte-19mu9pj",_g.head);r=Ue(m,"LINK",{rel:!0,href:!0}),m.forEach(te),l=kt(n),c=Ue(n,"DIV",{id:!0,class:!0});var b=He(c);d&&d.l(b),b.forEach(te),this.h()},h(){_e(r,"rel","stylesheet"),_e(r,"href",s=o[1]?o[1]:"https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css"),_e(c,"id",o[0]),_e(c,"class","map svelte-1tna482")},m(n,m){Pe(_g.head,r),Be(n,l,m),Be(n,c,m),d&&d.m(c,null),o[21](c),f=!0},p(n,[m]){(!f||m&2&&s!==(s=n[1]?n[1]:"https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css"))&&_e(r,"href",s),n[3]?d?(d.p(n,m),m&8&&qe(d,1)):(d=yg(n),d.c(),qe(d,1),d.m(c,null)):d&&(Nr(),nt(d,1,1,()=>{d=null}),Ur()),(!f||m&1)&&_e(c,"id",n[0])},i(n){f||(qe(d),f=!0)},o(n){nt(d),f=!1},d(n){te(r),n&&te(l),n&&te(c),d&&d.d(),o[21](null)}}}function nk(o=1e3){return new Promise(r=>setTimeout(r,o))}function sk(o,r,s){let{$$slots:l={},$$scope:c}=r;const f=kf();let{map:d}=r,{id:n="map"}=r,{location:m={lng:15,lat:45,zoom:1}}=r,{style:b={version:8,sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"lightgrey"}}]}}=r,{css:w=null}=r,{pmtiles:S=!1}=r,{options:k={}}=r,{minzoom:A=0}=r,{maxzoom:P=14}=r,{controls:T=!1}=r,{tabbable:L=!1}=r,{zoom:D=null}=r,{center:B=null}=r,{pitch:$=null}=r,{bearing:J=null}=r,{interactive:Y=!0}=r,{attribution:se=!0}=r,re,ce={},ye=!1;qa("map",{getMap:()=>d}),m.bounds?ce.bounds=m.bounds:m.lng&&m.lat&&(ce.center=[+m.lng,+m.lat],m.zoom&&(ce.zoom=+m.zoom),m.pitch&&(ce.pitch=+m.pitch),m.bearing&&(ce.bearing=+m.bearing)),se||(ce.attributionControl=!1),ce={...ce,...k},Sf(()=>{if(S){let le=new qE;Mo.addProtocol("pmtiles",le.tile)}s(4,d=new Mo.Map({container:re,style:b,minZoom:A,maxZoom:P,interactive:Y,...ce})),T&&!Array.isArray(T)?d.addControl(new Mo.NavigationControl({showCompass:!1})):Array.isArray(T)&&T!=["locate"]&&d.addControl(new Mo.NavigationControl({showCompass:T.includes("compass"),visualizePitch:T.includes("pitch")})),Array.isArray(T)&&T.includes("locate")&&d.addControl(new Mo.GeolocateControl),d.on("load",le=>{s(5,D=d.getZoom()),s(6,B=d.getCenter()),s(7,$=d.getPitch()),s(8,J=d.getBearing()),s(3,ye=!0),!L&&document.querySelector(`#${n} canvas`)&&(document.querySelector(`#${n} canvas`).tabIndex="-1"),f("load",{event:le})}),d.on("moveend",()=>{s(5,D=d.getZoom()),s(6,B=d.getCenter()),s(7,$=d.getPitch()),s(8,J=d.getBearing())})}),Vu(async()=>{await nk(250),d&&d.remove(),s(4,d=null)});function Ae(le){d&&d.setStyle(le),f("style",{style:le})}function _t(le){Za[le?"unshift":"push"](()=>{re=le,s(2,re)})}return o.$$set=le=>{"map"in le&&s(4,d=le.map),"id"in le&&s(0,n=le.id),"location"in le&&s(9,m=le.location),"style"in le&&s(10,b=le.style),"css"in le&&s(1,w=le.css),"pmtiles"in le&&s(11,S=le.pmtiles),"options"in le&&s(12,k=le.options),"minzoom"in le&&s(13,A=le.minzoom),"maxzoom"in le&&s(14,P=le.maxzoom),"controls"in le&&s(15,T=le.controls),"tabbable"in le&&s(16,L=le.tabbable),"zoom"in le&&s(5,D=le.zoom),"center"in le&&s(6,B=le.center),"pitch"in le&&s(7,$=le.pitch),"bearing"in le&&s(8,J=le.bearing),"interactive"in le&&s(17,Y=le.interactive),"attribution"in le&&s(18,se=le.attribution),"$$scope"in le&&s(19,c=le.$$scope)},o.$$.update=()=>{o.$$.dirty&1024&&Ae(b)},[n,w,re,ye,d,D,B,$,J,m,b,S,k,A,P,T,L,Y,se,c,l,_t]}let ak=class extends Wr{constructor(r){super(),Kr(this,r,sk,ik,jr,{map:4,id:0,location:9,style:10,css:1,pmtiles:11,options:12,minzoom:13,maxzoom:14,controls:15,tabbable:16,zoom:5,center:6,pitch:7,bearing:8,interactive:17,attribution:18})}};function vg(o){let r;const s=o[12].default,l=Di(s,o,o[11],null);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f&2048)&&Ri(l,s,c,c[11],r?Bi(s,c[11],f,null):Li(c[11]),null)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function ok(o){let r,s,l=o[0]&&vg(o);return{c(){l&&l.c(),r=er()},l(c){l&&l.l(c),r=er()},m(c,f){l&&l.m(c,f),Be(c,r,f),s=!0},p(c,[f]){c[0]?l?(l.p(c,f),f&1&&qe(l,1)):(l=vg(c),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(c){s||(qe(l),s=!0)},o(c){nt(l),s=!1},d(c){l&&l.d(c),c&&te(r)}}}function lk(o=1e3){return new Promise(r=>setTimeout(r,o))}function ck(o,r,s){let{$$slots:l={},$$scope:c}=r,{id:f}=r,{type:d}=r,{url:n=null}=r,{props:m={}}=r,{data:b=null}=r,{layer:w=null}=r,{promoteId:S=null}=r,{minzoom:k=null}=r,{maxzoom:A=null}=r,{tilesize:P=256}=r,T=!1,L=n;const{getMap:D}=Ga("map"),B=D();qa("source",{source:f,layer:w,promoteId:S}),B.getSource(f)&&B.removeSource(f);async function $(){await lk(100),B.isSourceLoaded(f)?(s(0,T=!0),console.log(f+" map source loaded!")):(console.log("..."),$())}k&&(m.minzoom=k),A&&(m.maxzoom=A),w&&S?(m.promoteId={},m.promoteId[w]=S):S&&(m.promoteId=S);function J(){console.log(f+" map source loading...");let ce;d=="geojson"?b?ce={type:d,data:b,...m}:n&&(ce={type:d,data:n,...m}):d=="vector"?(ce={type:d,...m},n.slice(0,7)==="pmtiles"?ce.url=n:ce.tiles=[n]):d=="raster"?ce={type:d,tiles:[n],tileSize:P,...m}:d=="raster-dem"&&(ce={type:d,tiles:[n],tileSize:P,...m}),ce&&(console.log(ce),B.addSource(f,ce),$())}function Y(ce){let ye=B.getSource(f);ye&&ye.setData(ce)}function se(ce){if(ce!==L){let ye=B.getSource(f);ye&&(ce.slice(0,7)==="pmtiles"?ye.setUrl(ce):ye.setTiles([ce])),L=ce}}function re(ce){ce!==L&&(B.getSource(f).tiles=[ce],B.style.sourceCaches[f].clearTiles(),B.style.sourceCaches[f].update(B.transform),B.triggerRepaint(),L=ce)}return Sf(J),Vu(async()=>{B&&B.getSource(f)&&(B.getStyle().layers.filter(ye=>ye.source==f).forEach(ye=>{B.removeLayer(ye.id)}),B.removeSource(f))}),o.$$set=ce=>{"id"in ce&&s(2,f=ce.id),"type"in ce&&s(3,d=ce.type),"url"in ce&&s(4,n=ce.url),"props"in ce&&s(1,m=ce.props),"data"in ce&&s(5,b=ce.data),"layer"in ce&&s(6,w=ce.layer),"promoteId"in ce&&s(7,S=ce.promoteId),"minzoom"in ce&&s(8,k=ce.minzoom),"maxzoom"in ce&&s(9,A=ce.maxzoom),"tilesize"in ce&&s(10,P=ce.tilesize),"$$scope"in ce&&s(11,c=ce.$$scope)},o.$$.update=()=>{o.$$.dirty&41&&d=="geojson"&&T&&Y(b),o.$$.dirty&25&&d=="vector"&&T&&se(n),o.$$.dirty&25&&d=="raster"&&T&&re(n)},[T,m,f,d,n,b,w,S,k,A,P,c,l]}class uk extends Wr{constructor(r){super(),Kr(this,r,ck,ok,jr,{id:2,type:3,url:4,props:1,data:5,layer:6,promoteId:7,minzoom:8,maxzoom:9,tilesize:10})}}const hk=o=>({hovered:o[0]&1}),bg=o=>({hovered:o[0]});function fk(o){let r;const s=o[30].default,l=Di(s,o,o[29],bg);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f[0]&536870913)&&Ri(l,s,c,c[29],r?Bi(s,c[29],f,hk):Li(c[29]),bg)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function dk(o,r,s){let l,{$$slots:c={},$$scope:f}=r;const d=kf();let{id:n}=r,{type:m}=r,{filter:b=null}=r,{layout:w={}}=r,{paint:S={}}=r,{data:k=null}=r,{colorKey:A="color"}=r,{nameKey:P=null}=r,{valueKey:T=null}=r,{idKey:L=null}=r,{select:D=!1}=r,{clickIgnore:B=!1}=r,{clickCenter:$=!1}=r,{selected:J=null}=r,{hover:Y=!1}=r,{hovered:se=null}=r,{highlight:re=!1}=r,{highlightKey:ce="highlighted"}=r,{highlighted:ye=[]}=r,{order:Ae=null}=r,{maxzoom:_t=null}=r,{minzoom:le=null}=r,{sourceLayer:We=null}=r,{visible:Z=!0}=r;const{source:$e,layer:ct,promoteId:rt}=Ga("source"),{getMap:$t}=Ga("map"),it=$t();qa("layer",{layer:n});const et=v_({id:null,feature:null,event:null});Uu(o,et,Xe=>s(32,l=Xe)),qa("hover",et),L=L||rt,We=We||ct;let oe=null,ge=null,Me=[];w.visibility=Z?"visible":"none";let ee={id:n,type:m,source:$e,paint:S,layout:w};b&&(ee.filter=b),We&&(ee["source-layer"]=We),_t&&(ee.maxzoom=_t),le&&(ee.minzoom=le),Sf(()=>{it.getLayer(n)&&it.removeLayer(n),it.addLayer(ee,Ae)});function ue(Xe,Bt=A){if(console.log("updating colors..."),P||T)for(const Qt of Xe)it.setFeatureState({source:$e,sourceLayer:We,id:Qt[L]},{color:Bt?Qt[Bt]:null,name:P?Qt[P]:null,value:T?Qt[T]:null});else for(const Qt of Xe)it.setFeatureState({source:$e,sourceLayer:We,id:Qt[L]},{color:Qt[Bt]})}function Je(Xe){it.getLayer(n)&&it.setFilter(n,Xe)}function wt(Xe){if(it.getLayer(n))for(const Bt in Xe)it.setPaintProperty(n,Bt,Xe[Bt])}function pt(Xe){it.getLayer(n)&&it.setLayoutProperty(n,"visibility",Xe?"visible":"none")}return D&&it.on("click",n,Xe=>{if(Xe.features.length>0&&!B){let Bt=Xe.features[0];if(s(2,J=Bt.id),d("select",{id:J,feature:Bt,event:Xe}),oe&&it.setFeatureState({source:$e,sourceLayer:We,id:oe},{selected:!1}),it.setFeatureState({source:$e,sourceLayer:We,id:J},{selected:!0}),$){let Qt=centroid(Xe.features[0].toJSON().geometry);it.flyTo({center:Qt.geometry.coordinates})}s(26,oe=J)}}),Y&&(it.on("mousemove",n,Xe=>{if(Xe.features.length>0){se&&it.setFeatureState({source:$e,sourceLayer:We,id:se},{hovered:!1});let Bt=Xe.features[0];s(0,se=s(27,ge=Bt.id)),et.set({id:se,feature:Bt,event:Xe}),d("hover",l),it.setFeatureState({source:$e,sourceLayer:We,id:se},{hovered:!0}),it.getCanvas().style.cursor="pointer"}}),it.on("mouseleave",n,Xe=>{se&&it.setFeatureState({source:$e,sourceLayer:We,id:se},{hovered:!1}),s(0,se=s(27,ge=null)),et.set({id:null,feature:null,event:Xe}),d("hover",l),it.getCanvas().style.cursor=""})),Vu(async()=>{it&&it.getLayer(n)&&it.removeLayer(n)}),o.$$set=Xe=>{"id"in Xe&&s(6,n=Xe.id),"type"in Xe&&s(7,m=Xe.type),"filter"in Xe&&s(8,b=Xe.filter),"layout"in Xe&&s(4,w=Xe.layout),"paint"in Xe&&s(9,S=Xe.paint),"data"in Xe&&s(10,k=Xe.data),"colorKey"in Xe&&s(11,A=Xe.colorKey),"nameKey"in Xe&&s(12,P=Xe.nameKey),"valueKey"in Xe&&s(13,T=Xe.valueKey),"idKey"in Xe&&s(5,L=Xe.idKey),"select"in Xe&&s(14,D=Xe.select),"clickIgnore"in Xe&&s(15,B=Xe.clickIgnore),"clickCenter"in Xe&&s(16,$=Xe.clickCenter),"selected"in Xe&&s(2,J=Xe.selected),"hover"in Xe&&s(17,Y=Xe.hover),"hovered"in Xe&&s(0,se=Xe.hovered),"highlight"in Xe&&s(18,re=Xe.highlight),"highlightKey"in Xe&&s(19,ce=Xe.highlightKey),"highlighted"in Xe&&s(20,ye=Xe.highlighted),"order"in Xe&&s(21,Ae=Xe.order),"maxzoom"in Xe&&s(22,_t=Xe.maxzoom),"minzoom"in Xe&&s(23,le=Xe.minzoom),"sourceLayer"in Xe&&s(3,We=Xe.sourceLayer),"visible"in Xe&&s(24,Z=Xe.visible),"$$scope"in Xe&&s(29,f=Xe.$$scope)},o.$$.update=()=>{if(o.$$.dirty[0]&3072&&k&&ue(k,A),o.$$.dirty[0]&256&&Je(b),o.$$.dirty[0]&512&&wt(S),o.$$.dirty[0]&16777216&&pt(Z),o.$$.dirty[0]&270270472&&re&&ye!=Me){if(Me[0])for(const Xe of Me){let Bt={};Bt[ce]=!1,it.setFeatureState({source:$e,sourceLayer:We,id:Xe},Bt)}if(s(28,Me=ye),ye[0])for(const Xe of ye){let Bt={};Bt[ce]=!0,it.setFeatureState({source:$e,sourceLayer:We,id:Xe},Bt)}}o.$$.dirty[0]&67125260&&D&&J!=oe&&(oe&&it.setFeatureState({source:$e,sourceLayer:We,id:oe},{selected:!1}),J&&it.setFeatureState({source:$e,sourceLayer:We,id:J},{selected:!0}),s(26,oe=J)),o.$$.dirty[0]&134348809&&Y&&se!=ge&&(ge&&it.setFeatureState({source:$e,sourceLayer:We,id:ge},{hovered:!1}),se&&it.setFeatureState({source:$e,sourceLayer:We,id:se},{hovered:!0}),s(27,ge=se))},[se,et,J,We,w,L,n,m,b,S,k,A,P,T,D,B,$,Y,re,ce,ye,Ae,_t,le,Z,ue,oe,ge,Me,f,c]}class hf extends Wr{constructor(r){super(),Kr(this,r,dk,fk,jr,{id:6,type:7,filter:8,layout:4,paint:9,data:10,colorKey:11,nameKey:12,valueKey:13,idKey:5,select:14,clickIgnore:15,clickCenter:16,selected:2,hover:17,hovered:0,highlight:18,highlightKey:19,highlighted:20,order:21,maxzoom:22,minzoom:23,sourceLayer:3,visible:24,updateColors:25},null,[-1,-1])}get updateColors(){return this.$$.ctx[25]}}function pk(o,r,s){let l,{content:c}=r;const f=new Mo.Popup({closeButton:!1,closeOnClick:!1}),{getMap:d}=Ga("map"),n=d(),m=Ga("hover");Uu(o,m,w=>s(2,l=w));function b(w,S){w.id?f.setLngLat(w.event.lngLat).setHTML(S||w.code).addTo(n):f.remove()}return Vu(()=>f.remove()),o.$$set=w=>{"content"in w&&s(1,c=w.content)},o.$$.update=()=>{o.$$.dirty&6&&b(l,c)},[m,c,l]}class mk extends Wr{constructor(r){super(),Kr(this,r,pk,null,jr,{content:1})}}function xg(o,r,s){const l=o.slice();return l[9]=r[s],l[11]=s,l}function wg(o){let r,s,l,c,f,d=o[4](o[2][o[11]])+"",n;return{c(){r=Ne("div"),s=Et(),l=Ne("div"),c=Et(),f=Ne("div"),n=zt(d),this.h()},l(m){r=Ue(m,"DIV",{class:!0,style:!0}),He(r).forEach(te),s=kt(m),l=Ue(m,"DIV",{class:!0,style:!0}),He(l).forEach(te),c=kt(m),f=Ue(m,"DIV",{class:!0,style:!0});var b=He(f);n=Mt(b,d),b.forEach(te),this.h()},h(){_e(r,"class","block svelte-4k2wr9"),It(r,"width",100/(o[2].length-1)+"%"),It(r,"left",o[11]*(100/(o[2].length-1))+"%"),It(r,"background-color",o[3][o[11]]),_e(l,"class","line svelte-4k2wr9"),It(l,"left",o[11]*(100/(o[2].length-1))+"%"),_e(f,"class","tick svelte-4k2wr9"),It(f,"left",o[11]*(100/(o[2].length-1))+"%"),Ht(f,"tick-start",o[11]==0)},m(m,b){Be(m,r,b),Be(m,s,b),Be(m,l,b),Be(m,c,b),Be(m,f,b),Pe(f,n)},p(m,b){b&4&&It(r,"width",100/(m[2].length-1)+"%"),b&4&&It(r,"left",m[11]*(100/(m[2].length-1))+"%"),b&8&&It(r,"background-color",m[3][m[11]]),b&4&&It(l,"left",m[11]*(100/(m[2].length-1))+"%"),b&20&&d!==(d=m[4](m[2][m[11]])+"")&&kr(n,d),b&4&&It(f,"left",m[11]*(100/(m[2].length-1))+"%")},d(m){m&&te(r),m&&te(s),m&&te(l),m&&te(c),m&&te(f)}}}function Eg(o){let r,s=`${o[7](o[0],o[2])}%`,l,c,f=o[5](o[0])+"",d,n;return{c(){r=Ne("div"),l=Et(),c=Ne("div"),d=zt(f),n=zt(o[6]),this.h()},l(m){r=Ue(m,"DIV",{class:!0}),He(r).forEach(te),l=kt(m),c=Ue(m,"DIV",{class:!0,style:!0});var b=He(c);d=Mt(b,f),n=Mt(b,o[6]),b.forEach(te),this.h()},h(){_e(r,"class","marker svelte-4k2wr9"),It(r,"left",s),_e(c,"class","value svelte-4k2wr9"),It(c,"left",o[7](o[0],o[2])+"%")},m(m,b){Be(m,r,b),Be(m,l,b),Be(m,c,b),Pe(c,d),Pe(c,n)},p(m,b){b&5&&s!==(s=`${m[7](m[0],m[2])}%`)&&It(r,"left",s),b&33&&f!==(f=m[5](m[0])+"")&&kr(d,f),b&64&&kr(n,m[6]),b&5&&It(c,"left",m[7](m[0],m[2])+"%")},d(m){m&&te(r),m&&te(l),m&&te(c)}}}function gk(o){let r,s,l,c,f,d=o[4](o[2][o[2].length-1])+"",n,m,b,w=o[2].slice(1),S=[];for(let A=0;Ak.toFixed(1)}=r,{formatVal:b=k=>k.toFixed(1)}=r,{suffix:w="%"}=r;const S=(k,A)=>{let P=0;for(;k>A[P+1];)P+=1;let T=100/(A.length-1),L=(k-A[P])/(A[P+1]-A[P]);return(P+L)*T};return o.$$set=k=>{"hovered"in k&&s(0,l=k.hovered),"lineWidth"in k&&s(8,c=k.lineWidth),"height"in k&&s(1,f=k.height),"breaks"in k&&s(2,d=k.breaks),"colors"in k&&s(3,n=k.colors),"formatTick"in k&&s(4,m=k.formatTick),"formatVal"in k&&s(5,b=k.formatVal),"suffix"in k&&s(6,w=k.suffix)},[l,f,d,n,m,b,w,S,c]}class yk extends Wr{constructor(r){super(),Kr(this,r,_k,gk,jr,{hovered:0,lineWidth:8,height:1,breaks:2,colors:3,formatTick:4,formatVal:5,suffix:6})}}function kg(o,r,s){const l=o.slice();return l[2]=r[s],l[4]=s,l}function Sg(o){let r,s,l,c=o[2].name+"",f,d,n,m=o[2].value.toFixed(1)+"",b,w,S;return{c(){r=Ne("tr"),s=Ne("td"),l=Ne("strong"),f=zt(c),d=Et(),n=Ne("td"),b=zt(m),w=zt("%"),S=Et(),this.h()},l(k){r=Ue(k,"TR",{});var A=He(r);s=Ue(A,"TD",{class:!0});var P=He(s);l=Ue(P,"STRONG",{});var T=He(l);f=Mt(T,c),T.forEach(te),P.forEach(te),d=kt(A),n=Ue(A,"TD",{class:!0});var L=He(n);b=Mt(L,m),w=Mt(L,"%"),L.forEach(te),S=kt(A),A.forEach(te),this.h()},h(){_e(s,"class","svelte-1i52e02"),_e(n,"class","text-right svelte-1i52e02")},m(k,A){Be(k,r,A),Pe(r,s),Pe(s,l),Pe(l,f),Pe(r,d),Pe(r,n),Pe(n,b),Pe(n,w),Pe(r,S)},p(k,A){A&1&&c!==(c=k[2].name+"")&&kr(f,c),A&1&&m!==(m=k[2].value.toFixed(1)+"")&&kr(b,m)},d(k){k&&te(r)}}}function vk(o){let r,s,l=o[0],c=[];for(let f=0;f{"data"in f&&s(0,l=f.data),"offset"in f&&s(1,c=f.offset)},[l,c]}class vy extends Wr{constructor(r){super(),Kr(this,r,bk,vk,jr,{data:0,offset:1})}}function xk(o){let r,s,l,c,f;return{c(){r=Ne("div"),s=Ne("div"),l=Et(),c=Ne("div"),f=zt("No data"),this.h()},l(d){r=Ue(d,"DIV",{class:!0,style:!0});var n=He(r);s=Ue(n,"DIV",{class:!0,style:!0}),He(s).forEach(te),l=kt(n),c=Ue(n,"DIV",{class:!0});var m=He(c);f=Mt(m,"No data"),m.forEach(te),n.forEach(te),this.h()},h(){_e(s,"class","block svelte-b1cp2z"),It(s,"width","100%"),It(s,"background-color",o[1]),_e(c,"class","tick svelte-b1cp2z"),_e(r,"class","container svelte-b1cp2z"),It(r,"height",o[0]+"px")},m(d,n){Be(d,r,n),Pe(r,s),Pe(r,l),Pe(r,c),Pe(c,f)},p(d,[n]){n&2&&It(s,"background-color",d[1]),n&1&&It(r,"height",d[0]+"px")},i:_r,o:_r,d(d){d&&te(r)}}}function wk(o,r,s){let{height:l=15}=r,{color:c="lightgrey"}=r;return o.$$set=f=>{"height"in f&&s(0,l=f.height),"color"in f&&s(1,c=f.color)},[l,c]}class Ek extends Wr{constructor(r){super(),Kr(this,r,wk,xk,jr,{height:0,color:1})}}function kk(o){let r,s;return{c(){r=Ne("p"),s=zt(`People with the selected characteristics as a proportion of whole - population in each area.`),this.h()},l(l){r=Ue(l,"P",{class:!0});var c=He(r);s=Mt(c,`People with the selected characteristics as a proportion of whole - population in each area.`),c.forEach(te),this.h()},h(){_e(r,"class","subtitle svelte-xikkwp")},m(l,c){Be(l,r,c),Pe(r,s)},p:_r,d(l){l&&te(r)}}}function Tg(o){let r,s;return r=new uk({props:{id:"lad",type:"geojson",data:o[0].geojson,promoteId:o[2].code,$$slots:{default:[Tk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&1&&(f.data=l[0].geojson),c&4&&(f.promoteId=l[2].code),c&4161&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function Sk(o){let r,s;return r=new mk({props:{content:o[7](o[6])}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&64&&(f.content=l[7](l[6])),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function Tk(o){let r,s,l,c,f,d,n;function m(w){o[8](w)}let b={id:"lad-fill",data:o[0].geoPerc,idKey:"code",nameKey:"name",valueKey:"value",hover:!0,tooltip:!0,type:"fill",paint:{"fill-color":["case",["!=",["feature-state","color"],null],["feature-state","color"],"rgba(255, 255, 255, 0)"],"fill-opacity":.8},order:"place_other",$$slots:{default:[Sk]},$$scope:{ctx:o}};return o[6]!==void 0&&(b.hovered=o[6]),r=new hf({props:b}),Za.push(()=>No(r,"hovered",m)),c=new hf({props:{id:"lad-line",type:"line",paint:{"line-color":"white","line-width":.3},order:"place_other"}}),d=new hf({props:{id:"lad-hover",type:"line",paint:{"line-color":"black","line-width":2,"line-opacity":["case",["==",["feature-state","hovered"],!0],1,0]},order:"place_other"}}),{c(){ir(r.$$.fragment),l=Et(),ir(c.$$.fragment),f=Et(),ir(d.$$.fragment)},l(w){cr(r.$$.fragment,w),l=kt(w),cr(c.$$.fragment,w),f=kt(w),cr(d.$$.fragment,w)},m(w,S){nr(r,w,S),Be(w,l,S),nr(c,w,S),Be(w,f,S),nr(d,w,S),n=!0},p(w,S){const k={};S&1&&(k.data=w[0].geoPerc),S&4160&&(k.$$scope={dirty:S,ctx:w}),!s&&S&64&&(s=!0,k.hovered=w[6],Uo(()=>s=!1)),r.$set(k)},i(w){n||(qe(r.$$.fragment,w),qe(c.$$.fragment,w),qe(d.$$.fragment,w),n=!0)},o(w){nt(r.$$.fragment,w),nt(c.$$.fragment,w),nt(d.$$.fragment,w),n=!1},d(w){sr(r,w),w&&te(l),sr(c,w),w&&te(f),sr(d,w)}}}function Ik(o){let r,s,l=o[0].geojson&&o[0].geoPerc&&Tg(o);return{c(){l&&l.c(),r=er()},l(c){l&&l.l(c),r=er()},m(c,f){l&&l.m(c,f),Be(c,r,f),s=!0},p(c,f){c[0].geojson&&c[0].geoPerc?l?(l.p(c,f),f&1&&qe(l,1)):(l=Tg(c),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(c){s||(qe(l),s=!0)},o(c){nt(l),s=!1},d(c){l&&l.d(c),c&&te(r)}}}function Ig(o){let r,s,l,c,f=o[0].geoPerc.some(Ag),d;l=new yk({props:{breaks:o[0].geoBreaks,hovered:o[6]&&o[0].geoPerc.find(o[9])?o[0].geoPerc.find(o[10]).value:null,colors:o[0].geoBreaks[1]==100?[o[5].seq[4]]:o[5].seq}});let n=f&&Cg();return{c(){r=Ne("div"),s=Ne("div"),ir(l.$$.fragment),c=Et(),n&&n.c(),this.h()},l(m){r=Ue(m,"DIV",{class:!0});var b=He(r);s=Ue(b,"DIV",{class:!0});var w=He(s);cr(l.$$.fragment,w),w.forEach(te),c=kt(b),n&&n.l(b),b.forEach(te),this.h()},h(){_e(s,"class","map-legend-breaks svelte-xikkwp"),_e(r,"class","map-legend svelte-xikkwp")},m(m,b){Be(m,r,b),Pe(r,s),nr(l,s,null),Pe(r,c),n&&n.m(r,null),d=!0},p(m,b){const w={};b&1&&(w.breaks=m[0].geoBreaks),b&65&&(w.hovered=m[6]&&m[0].geoPerc.find(m[9])?m[0].geoPerc.find(m[10]).value:null),b&33&&(w.colors=m[0].geoBreaks[1]==100?[m[5].seq[4]]:m[5].seq),l.$set(w),b&1&&(f=m[0].geoPerc.some(Ag)),f?n?b&1&&qe(n,1):(n=Cg(),n.c(),qe(n,1),n.m(r,null)):n&&(Nr(),nt(n,1,1,()=>{n=null}),Ur())},i(m){d||(qe(l.$$.fragment,m),qe(n),d=!0)},o(m){nt(l.$$.fragment,m),nt(n),d=!1},d(m){m&&te(r),sr(l),n&&n.d()}}}function Cg(o){let r,s,l;return s=new Ek({}),{c(){r=Ne("div"),ir(s.$$.fragment),this.h()},l(c){r=Ue(c,"DIV",{class:!0});var f=He(r);cr(s.$$.fragment,f),f.forEach(te),this.h()},h(){_e(r,"class","map-legend-nodata svelte-xikkwp")},m(c,f){Be(c,r,f),nr(s,r,null),l=!0},i(c){l||(qe(s.$$.fragment,c),l=!0)},o(c){nt(s.$$.fragment,c),l=!1},d(c){c&&te(r),sr(s)}}}function Ck(o){let r,s,l,c,f;s=new ak({props:{style:o[1],location:{bounds:o[3]},options:{preserveDrawingBuffer:!0},$$slots:{default:[Ik]},$$scope:{ctx:o}}});let d=o[0].geoBreaks&&o[0].geoPerc&&Ig(o);return{c(){r=Ne("div"),ir(s.$$.fragment),l=Et(),d&&d.c(),c=er(),this.h()},l(n){r=Ue(n,"DIV",{});var m=He(r);cr(s.$$.fragment,m),m.forEach(te),l=kt(n),d&&d.l(n),c=er(),this.h()},h(){It(r,"height","450px")},m(n,m){Be(n,r,m),nr(s,r,null),Be(n,l,m),d&&d.m(n,m),Be(n,c,m),f=!0},p(n,m){const b={};m&2&&(b.style=n[1]),m&8&&(b.location={bounds:n[3]}),m&4165&&(b.$$scope={dirty:m,ctx:n}),s.$set(b),n[0].geoBreaks&&n[0].geoPerc?d?(d.p(n,m),m&1&&qe(d,1)):(d=Ig(n),d.c(),qe(d,1),d.m(c.parentNode,c)):d&&(Nr(),nt(d,1,1,()=>{d=null}),Ur())},i(n){f||(qe(s.$$.fragment,n),qe(d),f=!0)},o(n){nt(s.$$.fragment,n),nt(d),f=!1},d(n){n&&te(r),sr(s),n&&te(l),d&&d.d(n),n&&te(c)}}}function Ak(o){let r,s;return{c(){r=Ne("span"),s=zt("Make a selection to see rankings."),this.h()},l(l){r=Ue(l,"SPAN",{class:!0});var c=He(r);s=Mt(c,"Make a selection to see rankings."),c.forEach(te),this.h()},h(){_e(r,"class","muted svelte-xikkwp")},m(l,c){Be(l,r,c),Pe(r,s)},p:_r,i:_r,o:_r,d(l){l&&te(r)}}}function Pk(o){let r,s;return r=new vy({props:{data:[...o[0].geoPerc].filter(Pg).sort(zg).slice(0,5)}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&1&&(f.data=[...l[0].geoPerc].filter(Pg).sort(zg).slice(0,5)),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function zk(o){let r,s,l,c;const f=[Pk,Ak],d=[];function n(m,b){return m[0].geoPerc&&m[4][0]?0:1}return r=n(o),s=d[r]=f[r](o),{c(){s.c(),l=er()},l(m){s.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),s=d[r],s?s.p(m,b):(s=d[r]=f[r](m),s.c()),qe(s,1),s.m(l.parentNode,l))},i(m){c||(qe(s),c=!0)},o(m){nt(s),c=!1},d(m){d[r].d(m),m&&te(l)}}}function Mk(o){let r,s;return{c(){r=Ne("span"),s=zt("Make a selection to see rankings."),this.h()},l(l){r=Ue(l,"SPAN",{class:!0});var c=He(r);s=Mt(c,"Make a selection to see rankings."),c.forEach(te),this.h()},h(){_e(r,"class","muted svelte-xikkwp")},m(l,c){Be(l,r,c),Pe(r,s)},p:_r,i:_r,o:_r,d(l){l&&te(r)}}}function Dk(o){let r,s;return r=new vy({props:{data:o[0].geoPerc.filter(Mg).sort(Dg).slice(-5),offset:o[0].geoPerc.filter(Rg).length-4}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&1&&(f.data=l[0].geoPerc.filter(Mg).sort(Dg).slice(-5)),c&1&&(f.offset=l[0].geoPerc.filter(Rg).length-4),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function Rk(o){let r,s,l,c;const f=[Dk,Mk],d=[];function n(m,b){return m[0].geoPerc&&m[4][0]?0:1}return r=n(o),s=d[r]=f[r](o),{c(){s.c(),l=er()},l(m){s.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),s=d[r],s?s.p(m,b):(s=d[r]=f[r](m),s.c()),qe(s,1),s.m(l.parentNode,l))},i(m){c||(qe(s),c=!0)},o(m){nt(s),c=!1},d(m){d[r].d(m),m&&te(l)}}}function Lk(o){let r,s,l,c,f,d,n,m;return r=new Os({props:{colspan:3,rowspan:1,noBackground:!0,$$slots:{default:[kk]},$$scope:{ctx:o}}}),l=new Os({props:{colspan:2,rowspan:2,noBackground:!0,$$slots:{default:[Ck]},$$scope:{ctx:o}}}),f=new Os({props:{title:"Areas with high %",$$slots:{default:[zk]},$$scope:{ctx:o}}}),n=new Os({props:{title:"Areas with low %",$$slots:{default:[Rk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment),s=Et(),ir(l.$$.fragment),c=Et(),ir(f.$$.fragment),d=Et(),ir(n.$$.fragment)},l(b){cr(r.$$.fragment,b),s=kt(b),cr(l.$$.fragment,b),c=kt(b),cr(f.$$.fragment,b),d=kt(b),cr(n.$$.fragment,b)},m(b,w){nr(r,b,w),Be(b,s,w),nr(l,b,w),Be(b,c,w),nr(f,b,w),Be(b,d,w),nr(n,b,w),m=!0},p(b,w){const S={};w&4096&&(S.$$scope={dirty:w,ctx:b}),r.$set(S);const k={};w&4207&&(k.$$scope={dirty:w,ctx:b}),l.$set(k);const A={};w&4113&&(A.$$scope={dirty:w,ctx:b}),f.$set(A);const P={};w&4113&&(P.$$scope={dirty:w,ctx:b}),n.$set(P)},i(b){m||(qe(r.$$.fragment,b),qe(l.$$.fragment,b),qe(f.$$.fragment,b),qe(n.$$.fragment,b),m=!0)},o(b){nt(r.$$.fragment,b),nt(l.$$.fragment,b),nt(f.$$.fragment,b),nt(n.$$.fragment,b),m=!1},d(b){sr(r,b),b&&te(s),sr(l,b),b&&te(c),sr(f,b),b&&te(d),sr(n,b)}}}function Bk(o){let r,s;return r=new Tf({props:{title:"Population by area",height:"auto",cls:"ons-cards pgp-map-tiles",$$slots:{default:[Lk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,[c]){const f={};c&4223&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}const Ag=o=>o.value===null,Pg=o=>o.value!=null,zg=(o,r)=>r.value-o.value,Mg=o=>o.value!=null,Dg=(o,r)=>r.value-o.value,Rg=o=>o.value!=null;function Ok(o,r,s){let l,{data:c}=r,{mapStyle:f}=r,{ladBounds:d}=r,{mapBounds:n}=r,{selected:m}=r,{colors:b}=r,w;const S=T=>{var D;let L="";if(T){L=`${c.geoCodesLookup[w].name}
`;const B=(D=l==null?void 0:l[T])==null?void 0:D.value;L+=B!=null?`${B}%`:"No data"}return L};function k(T){w=T,s(6,w)}const A=T=>T.code==w,P=T=>T.code==w;return o.$$set=T=>{"data"in T&&s(0,c=T.data),"mapStyle"in T&&s(1,f=T.mapStyle),"ladBounds"in T&&s(2,d=T.ladBounds),"mapBounds"in T&&s(3,n=T.mapBounds),"selected"in T&&s(4,m=T.selected),"colors"in T&&s(5,b=T.colors)},o.$$.update=()=>{o.$$.dirty&1&&(l=(T=>{const L={};return console.log("data",T),Array.isArray(T)&&T.forEach(D=>L[D.code]=D),L})(c.geoPerc))},[c,f,d,n,m,b,w,S,k,A,P]}class Fk extends Wr{constructor(r){super(),Kr(this,r,Ok,Bk,jr,{data:0,mapStyle:1,ladBounds:2,mapBounds:3,selected:4,colors:5})}}function Lg(o){let r,s;return r=new Os({props:{title:o[0],$$slots:{default:[$k]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&1&&(f.title=l[0]),c&30&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function Nk(o){let r,s,l;var c=o[3];function f(d){return{props:{data:d[2].selected&&Ou("residents",d[1].code,d[2]),showLegend:!1}}}return c&&(r=Fp(c,f(o))),{c(){r&&ir(r.$$.fragment),s=er()},l(d){r&&cr(r.$$.fragment,d),s=er()},m(d,n){r&&nr(r,d,n),Be(d,s,n),l=!0},p(d,n){const m={};if(n&6&&(m.data=d[2].selected&&Ou("residents",d[1].code,d[2])),n&8&&c!==(c=d[3])){if(r){Nr();const b=r;nt(b.$$.fragment,1,0,()=>{sr(b,1)}),Ur()}c?(r=Fp(c,f(d)),ir(r.$$.fragment),qe(r.$$.fragment,1),nr(r,s.parentNode,s)):r=null}else c&&r.$set(m)},i(d){l||(r&&qe(r.$$.fragment,d),l=!0)},o(d){r&&nt(r.$$.fragment,d),l=!1},d(d){d&&te(s),r&&sr(r,d)}}}function Uk(o){let r,s=rc.nodata+"",l;return{c(){r=Ne("span"),l=zt(s),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,s),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-1yn8adz")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function Vk(o){let r,s=rc.blocked+"",l;return{c(){r=Ne("span"),l=zt(s),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,s),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-1yn8adz")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function $k(o){let r,s,l,c,f,d=Op[o[1].code]+"",n,m;const b=[Vk,Uk,Nk],w=[];function S(k,A){return k[2].selected.residents[k[1].code].values==="blocked"?0:k[2].selected.residents[k[1].code].values.percent[0]==null?1:2}return r=S(o),s=w[r]=b[r](o),{c(){s.c(),l=Et(),c=Ne("span"),f=zt("% of "),n=zt(d),this.h()},l(k){s.l(k),l=kt(k),c=Ue(k,"SPAN",{class:!0});var A=He(c);f=Mt(A,"% of "),n=Mt(A,d),A.forEach(te),this.h()},h(){_e(c,"class","num-desc svelte-1yn8adz")},m(k,A){w[r].m(k,A),Be(k,l,A),Be(k,c,A),Pe(c,f),Pe(c,n),m=!0},p(k,A){let P=r;r=S(k),r===P?w[r].p(k,A):(Nr(),nt(w[P],1,1,()=>{w[P]=null}),Ur(),s=w[r],s?s.p(k,A):(s=w[r]=b[r](k),s.c()),qe(s,1),s.m(l.parentNode,l)),(!m||A&2)&&d!==(d=Op[k[1].code]+"")&&kr(n,d)},i(k){m||(qe(s),m=!0)},o(k){nt(s),m=!1},d(k){w[r].d(k),k&&te(l),k&&te(c)}}}function jk(o){var c,f;let r,s,l=((f=(c=o[2].selected.residents)==null?void 0:c[o[1].code])==null?void 0:f.values)&&Lg(o);return{c(){l&&l.c(),r=er()},l(d){l&&l.l(d),r=er()},m(d,n){l&&l.m(d,n),Be(d,r,n),s=!0},p(d,[n]){var m,b;(b=(m=d[2].selected.residents)==null?void 0:m[d[1].code])!=null&&b.values?l?(l.p(d,n),n&6&&qe(l,1)):(l=Lg(d),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(d){s||(qe(l),s=!0)},o(d){nt(l),s=!1},d(d){l&&l.d(d),d&&te(r)}}}function qk(o,r,s){let{title:l}=r,{table:c}=r,{data:f}=r,{chart_type:d}=r;return o.$$set=n=>{"title"in n&&s(0,l=n.title),"table"in n&&s(1,c=n.table),"data"in n&&s(2,f=n.data),"chart_type"in n&&s(3,d=n.chart_type)},[l,c,f,d]}class by extends Wr{constructor(r){super(),Kr(this,r,qk,jk,jr,{title:0,table:1,data:2,chart_type:3})}}function Gk(o){let r,s;const l=o[5].default,c=Di(l,o,o[4],null);return{c(){r=Ne("mark"),c&&c.c(),this.h()},l(f){r=Ue(f,"MARK",{class:!0,style:!0,role:!0});var d=He(r);c&&c.l(d),d.forEach(te),this.h()},h(){_e(r,"class","em svelte-1602h77"),It(r,"background-color",o[0]),It(r,"color",o[2]),_e(r,"role","presentation"),Ht(r,"nowrap",o[1])},m(f,d){Be(f,r,d),c&&c.m(r,null),s=!0},p(f,[d]){c&&c.p&&(!s||d&16)&&Ri(c,l,f,f[4],s?Bi(l,f[4],d,null):Li(f[4]),null),(!s||d&1)&&It(r,"background-color",f[0]),(!s||d&4)&&It(r,"color",f[2]),(!s||d&2)&&Ht(r,"nowrap",f[1])},i(f){s||(qe(c,f),s=!0)},o(f){nt(c,f),s=!1},d(f){f&&te(r),c&&c.d(f)}}}function Zk(o,r,s){let l,{$$slots:c={},$$scope:f}=r,{color:d="lightgrey"}=r,{nowrap:n=!0}=r;function m(w){return(w[0]*299+w[1]*587+w[2]*114)/1e3>125?"black":"white"}let b="black";return o.$$set=w=>{"color"in w&&s(0,d=w.color),"nowrap"in w&&s(1,n=w.nowrap),"$$scope"in w&&s(4,f=w.$$scope)},o.$$.update=()=>{o.$$.dirty&1&&s(3,l=fv(d).rgb),o.$$.dirty&8&&l&&s(2,b=m(l))},[d,n,b,l,f,c]}class Hk extends Wr{constructor(r){super(),Kr(this,r,Zk,Gk,jr,{color:0,nowrap:1})}}function Wk(o){let r,s=o[0].selected.total_pop.count.toLocaleString()+"",l,c,f,d,n,m,b,w,S;return b=new Hk({props:{color:"lightgrey",$$slots:{default:[Xk]},$$scope:{ctx:o}}}),{c(){r=Ne("div"),l=zt(s),c=Et(),f=Ne("div"),d=zt("people"),n=Et(),m=Ne("div"),ir(b.$$.fragment),w=zt(" of the total population of England and Wales"),this.h()},l(k){r=Ue(k,"DIV",{class:!0});var A=He(r);l=Mt(A,s),A.forEach(te),c=kt(k),f=Ue(k,"DIV",{class:!0});var P=He(f);d=Mt(P,"people"),P.forEach(te),n=kt(k),m=Ue(k,"DIV",{class:!0});var T=He(m);cr(b.$$.fragment,T),w=Mt(T," of the total population of England and Wales"),T.forEach(te),this.h()},h(){_e(r,"class","num-big svelte-c46qp4"),_e(f,"class","num-suffix svelte-c46qp4"),_e(m,"class","num-desc svelte-c46qp4")},m(k,A){Be(k,r,A),Pe(r,l),Be(k,c,A),Be(k,f,A),Pe(f,d),Be(k,n,A),Be(k,m,A),nr(b,m,null),Pe(m,w),S=!0},p(k,A){(!S||A&1)&&s!==(s=k[0].selected.total_pop.count.toLocaleString()+"")&&kr(l,s);const P={};A&3&&(P.$$scope={dirty:A,ctx:k}),b.$set(P)},i(k){S||(qe(b.$$.fragment,k),S=!0)},o(k){nt(b.$$.fragment,k),S=!1},d(k){k&&te(r),k&&te(c),k&&te(f),k&&te(n),k&&te(m),sr(b)}}}function Kk(o){let r,s=rc.nodata+"",l;return{c(){r=Ne("div"),l=zt(s),this.h()},l(c){r=Ue(c,"DIV",{class:!0});var f=He(r);l=Mt(f,s),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-c46qp4")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function Xk(o){let r=Nm(o[0].selected.total_pop.percent)+"",s,l;return{c(){s=zt(r),l=zt("%")},l(c){s=Mt(c,r),l=Mt(c,"%")},m(c,f){Be(c,s,f),Be(c,l,f)},p(c,f){f&1&&r!==(r=Nm(c[0].selected.total_pop.percent)+"")&&kr(s,r)},d(c){c&&te(s),c&&te(l)}}}function Jk(o){let r,s,l,c;const f=[Kk,Wk],d=[];function n(m,b){return m[0].selected.total_pop.count==null?0:1}return r=n(o),s=d[r]=f[r](o),{c(){s.c(),l=er()},l(m){s.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),s=d[r],s?s.p(m,b):(s=d[r]=f[r](m),s.c()),qe(s,1),s.m(l.parentNode,l))},i(m){c||(qe(s),c=!0)},o(m){nt(s),c=!1},d(m){d[r].d(m),m&&te(l)}}}function Yk(o){let r,s;return r=new Os({props:{title:"Population",$$slots:{default:[Jk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,[c]){const f={};c&3&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function Qk(o,r,s){let{data:l}=r;return o.$$set=c=>{"data"in c&&s(0,l=c.data)},[l]}class eS extends Wr{constructor(r){super(),Kr(this,r,Qk,Yk,jr,{data:0})}}function tS(o){let r,s,l,c,f=`translateX(${o[3]/o[1]+(o[1]-o[4])}px)`,d,n=`${o[2]}px`,m=`${o[4]}px`;return{c(){r=Ne("div"),s=zt(o[0]),l=Et(),c=Ne("div"),this.h()},l(b){r=Ue(b,"DIV",{class:!0});var w=He(r);s=Mt(w,o[0]),l=kt(w),c=Ue(w,"DIV",{class:!0}),He(c).forEach(te),w.forEach(te),this.h()},h(){_e(c,"class","caret svelte-1491tb3"),It(c,"transform",f),_e(r,"class","tooltip svelte-1491tb3"),h_(()=>o[6].call(r)),It(r,"top",n),It(r,"left",m)},m(b,w){Be(b,r,w),Pe(r,s),Pe(r,l),Pe(r,c),d=f_(r,o[6].bind(r))},p(b,[w]){w&1&&kr(s,b[0]),w&26&&f!==(f=`translateX(${b[3]/b[1]+(b[1]-b[4])}px)`)&&It(c,"transform",f),w&4&&n!==(n=`${b[2]}px`)&&It(r,"top",n),w&16&&m!==(m=`${b[4]}px`)&&It(r,"left",m)},i:_r,o:_r,d(b){b&&te(r),d()}}}const wu=4;function rS(o,r,s){let l,{title:c}=r,{x:f}=r,{y:d}=r,{width:n}=r,m;function b(){m=this.clientWidth,s(3,m)}return o.$$set=w=>{"title"in w&&s(0,c=w.title),"x"in w&&s(1,f=w.x),"y"in w&&s(2,d=w.y),"width"in w&&s(5,n=w.width)},o.$$.update=()=>{o.$$.dirty&42&&s(4,l=m&&f+m/2>n-wu?n-m/2-wu:m&&f-m/2<0+wu?m/2+wu:f)},[c,f,d,m,l,n,b]}class iS extends Wr{constructor(r){super(),Kr(this,r,rS,tS,jr,{title:0,x:1,y:2,width:5})}}function nS(o){let r,s;function l(f){r=o.getAttribute("title"),o.removeAttribute("title");let d=document.body.getBoundingClientRect(),n=o.getBoundingClientRect(),m=n.bottom,b=(n.left+n.right)/2;s=new iS({props:{title:r,x:b,y:m-d.y,width:d.width},target:document.body})}function c(){s.$destroy(),o.setAttribute("title",r)}return o.addEventListener("mouseover",l),o.addEventListener("mouseout",c),{destroy(){s&&s.$destroy(),o.removeEventListener("mouseover",l),o.removeEventListener("mouseout",c)}}}function Bg(o,r,s){const l=o.slice();return l[20]=r[s],l[22]=s,l}function Og(o,r,s){const l=o.slice();return l[23]=r[s],l[25]=s,l}function Fg(o,r,s){const l=o.slice();return l[23]=r[s],l[25]=s,l}function Ng(o,r,s){const l=o.slice();return l[27]=r[s],l[22]=s,l}function Ug(o){let r,s=o[12],l=[];for(let c=0;c1?` (${o[2](o[10][o[22]+1].values[o[25]][o[1]])}%)`:"")),_e(r,"class","bar svelte-clbyb4"),It(r,"bottom","0"),It(r,"height",l),It(r,"left",c),It(r,"width",f)},m(m,b){Be(m,r,b),d||(n=g_(nS.call(null,r)),d=!0)},p(m,b){b&1031&&s!==(s=`${m[23][m[0]]}: ${m[2](m[23][m[1]])}%`+(m[10].length>1?` (${m[2](m[10][m[22]+1].values[m[25]][m[1]])}%)`:""))&&_e(r,"title",s),b&3074&&l!==(l=`${m[11](m[23][m[1]])}%`)&&It(r,"height",l),b&8192&&c!==(c=`calc(${m[25]/m[13].length*100}%)`)&&It(r,"left",c),b&8192&&f!==(f=`calc(${1/m[13].length*100}% - 2px)`)&&It(r,"width",f)},d(m){m&&te(r),d=!1,n()}}}function qg(o){let r;function s(f,d){return f[22]==0?aS:sS}let c=s(o)(o);return{c(){c.c(),r=er()},l(f){c.l(f),r=er()},m(f,d){c.m(f,d),Be(f,r,d)},p(f,d){c.p(f,d)},d(f){c.d(f),f&&te(r)}}}function Gg(o){let r,s,l=o[6][0]!=0&&Zg(o),c=o[6][1]!=18&&Hg(o);return{c(){l&&l.c(),r=Et(),c&&c.c(),s=er()},l(f){l&&l.l(f),r=kt(f),c&&c.l(f),s=er()},m(f,d){l&&l.m(f,d),Be(f,r,d),c&&c.m(f,d),Be(f,s,d)},p(f,d){f[6][0]!=0?l?l.p(f,d):(l=Zg(f),l.c(),l.m(r.parentNode,r)):l&&(l.d(1),l=null),f[6][1]!=18?c?c.p(f,d):(c=Hg(f),c.c(),c.m(s.parentNode,s)):c&&(c.d(1),c=null)},d(f){l&&l.d(f),f&&te(r),c&&c.d(f),f&&te(s)}}}function Zg(o){let r,s=`${o[15](o[10])}%`;return{c(){r=Ne("div"),this.h()},l(l){r=Ue(l,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","mask svelte-clbyb4"),It(r,"bottom","0"),It(r,"height",s),It(r,"left","0"),It(r,"width",o[14](o[6][0]))},m(l,c){Be(l,r,c)},p(l,c){c&1024&&s!==(s=`${l[15](l[10])}%`)&&It(r,"height",s),c&64&&It(r,"width",l[14](l[6][0]))},d(l){l&&te(r)}}}function Hg(o){let r,s=`${o[15](o[10])}%`;return{c(){r=Ne("div"),this.h()},l(l){r=Ue(l,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","mask svelte-clbyb4"),It(r,"bottom","0"),It(r,"height",s),It(r,"left",o[14](o[6][1])),It(r,"right","2px")},m(l,c){Be(l,r,c)},p(l,c){c&1024&&s!==(s=`${l[15](l[10])}%`)&&It(r,"height",s),c&64&&It(r,"left",l[14](l[6][1]))},d(l){l&&te(r)}}}function Wg(o){let r,s,l;return{c(){r=Ne("small"),s=zt(o[7]),l=zt(o[8]),this.h()},l(c){r=Ue(c,"SMALL",{class:!0});var f=He(r);s=Mt(f,o[7]),l=Mt(f,o[8]),f.forEach(te),this.h()},h(){_e(r,"class","svelte-clbyb4")},m(c,f){Be(c,r,f),Pe(r,s),Pe(r,l)},p(c,f){f&128&&kr(s,c[7]),f&256&&kr(l,c[8])},d(c){c&&te(r)}}}function oS(o){let r,s,l,c=`${o[3]}px`,f,d,n,m=o[5][0]+"",b,w,S,k=o[5][1]+"",A,P,T,L=o[9]&&o[12][1]&&Ug(o),D=o[10],B=[];for(let Y=0;Yre.toFixed(1)}=r,{height:A=100}=r,{markerWidth:P=2.5}=r,{minmax:T=["0 years","85+"]}=r,{maskRange:L=null}=r,{base:D=null}=r,{base_ext:B=", 5 year age bands"}=r,{showLegend:$=!0}=r;function J(re,ce){let ye={};for(const _t of re)ye[_t[ce]]||(ye[_t[ce]]={label:_t[ce],values:[]}),ye[_t[ce]].values.push(_t);let Ae=[];for(const _t in ye)Ae.push(ye[_t]);return Ae}function Y(re){return re%1===0?`calc(${re/l.length*100}% - 1px)`:`calc(${Math.floor(re)/l.length*100}% +(${1/l.length*100}% - 2px) * ${re%1})`}function se(re){return Math.max(...re.map(ce=>Math.max(...ce.values.map(ye=>d(ye[w])))))}return o.$$set=re=>{"data"in re&&s(16,m=re.data),"xKey"in re&&s(0,b=re.xKey),"yKey"in re&&s(1,w=re.yKey),"zKey"in re&&s(17,S=re.zKey),"formatTick"in re&&s(2,k=re.formatTick),"height"in re&&s(3,A=re.height),"markerWidth"in re&&s(4,P=re.markerWidth),"minmax"in re&&s(5,T=re.minmax),"maskRange"in re&&s(6,L=re.maskRange),"base"in re&&s(7,D=re.base),"base_ext"in re&&s(8,B=re.base_ext),"showLegend"in re&&s(9,$=re.showLegend)},o.$$.update=()=>{o.$$.dirty&65537&&s(13,l=m.map(re=>re[b]).filter((re,ce,ye)=>ye.indexOf(re)===ce)),o.$$.dirty&65538&&s(18,c=[0,Math.max(...m.map(re=>re[w]))]),o.$$.dirty&196608&&s(12,f=m.map(re=>re[S]).filter((re,ce,ye)=>ye.indexOf(re)===ce)),o.$$.dirty&262144&&s(11,d=re=>Math.abs(re/c[1])*100),o.$$.dirty&196608&&s(10,n=J(m,S))},[b,w,k,A,P,T,L,D,B,$,n,d,f,l,Y,se,m,S,c]}class cS extends Wr{constructor(r){super(),Kr(this,r,lS,oS,jr,{data:16,xKey:0,yKey:1,zKey:17,formatTick:2,height:3,markerWidth:4,minmax:5,maskRange:6,base:7,base_ext:8,showLegend:9})}}function uS(o){let r,s;return r=new cS({props:{data:o[0].selected&&Ou("residents","resident_age_18b",o[0]),zKey:"group",maskRange:Fm(o[1]),base:"% of all people",showLegend:!1}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c&1&&(f.data=l[0].selected&&Ou("residents","resident_age_18b",l[0])),c&2&&(f.maskRange=Fm(l[1])),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function hS(o){let r,s=rc.nodata+"",l;return{c(){r=Ne("span"),l=zt(s),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,s),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-uj0r62")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function fS(o){let r,s=rc.nodata+"",l;return{c(){r=Ne("span"),l=zt(s),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,s),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-uj0r62")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function dS(o){let r,s,l,c;const f=[fS,hS,uS],d=[];function n(m,b){return m[0].selected.residents.resident_age_18b.values==="blocked"?0:m[0].selected.residents.resident_age_18b.values.percent[0]==null?1:2}return r=n(o),s=d[r]=f[r](o),{c(){s.c(),l=er()},l(m){s.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),s=d[r],s?s.p(m,b):(s=d[r]=f[r](m),s.c()),qe(s,1),s.m(l.parentNode,l))},i(m){c||(qe(s),c=!0)},o(m){nt(s),c=!1},d(m){d[r].d(m),m&&te(l)}}}function pS(o){let r,s;return r=new Os({props:{title:"Age profile",$$slots:{default:[dS]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,[c]){const f={};c&7&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function mS(o,r,s){let{data:l}=r,{selected:c}=r;return o.$$set=f=>{"data"in f&&s(0,l=f.data),"selected"in f&&s(1,c=f.selected)},[l,c]}class gS extends Wr{constructor(r){super(),Kr(this,r,mS,pS,jr,{data:0,selected:1})}}function _S(o,r,s){const l=o.slice();return l[2]=r[s],l[4]=s,l}function yS(o){let r,s,l,c,f,d;return{c(){r=Ne("li"),s=Ne("div"),l=Et(),c=Ne("span"),f=zt(o[2]),d=Et(),this.h()},l(n){r=Ue(n,"LI",{class:!0});var m=He(r);s=Ue(m,"DIV",{class:!0}),He(s).forEach(te),l=kt(m),c=Ue(m,"SPAN",{class:!0});var b=He(c);f=Mt(b,o[2]),b.forEach(te),d=kt(m),m.forEach(te),this.h()},h(){_e(s,"class","legend-vis "+(o[4]==0?"bar":"marker")+" svelte-npejzx"),_e(c,"class",o[4]==0?"bold":"brackets"),_e(r,"class","svelte-npejzx"),Ht(r,"ew",o[4]!=0)},m(n,m){Be(n,r,m),Pe(r,s),Pe(r,l),Pe(r,c),Pe(c,f),Pe(r,d)},p:_r,d(n){n&&te(r)}}}function vS(o){let r,s,l,c;const f=o[1].default,d=Di(f,o,o[0],null);let n=["People with the selected characteristics","All people in England and Wales"],m=[];for(let b=0;b<2;b+=1)m[b]=yS(_S(o,n,b));return{c(){r=Ne("p"),d&&d.c(),s=Et(),l=Ne("ul");for(let b=0;b<2;b+=1)m[b].c();this.h()},l(b){r=Ue(b,"P",{class:!0});var w=He(r);d&&d.l(w),w.forEach(te),s=kt(b),l=Ue(b,"UL",{class:!0});var S=He(l);for(let k=0;k<2;k+=1)m[k].l(S);S.forEach(te),this.h()},h(){_e(r,"class","legend-text svelte-npejzx"),_e(l,"class","legend-block svelte-npejzx")},m(b,w){Be(b,r,w),d&&d.m(r,null),Be(b,s,w),Be(b,l,w);for(let S=0;S<2;S+=1)m[S]&&m[S].m(l,null);c=!0},p(b,[w]){d&&d.p&&(!c||w&1)&&Ri(d,f,b,b[0],c?Bi(f,b[0],w,null):Li(b[0]),null)},i(b){c||(qe(d,b),c=!0)},o(b){nt(d,b),c=!1},d(b){b&&te(r),d&&d.d(b),b&&te(s),b&&te(l),Ui(m,b)}}}function bS(o,r,s){let{$$slots:l={},$$scope:c}=r;return o.$$set=f=>{"$$scope"in f&&s(0,c=f.$$scope)},[c,l]}class xy extends Wr{constructor(r){super(),Kr(this,r,bS,vS,jr,{})}}function xS(o){let r,s,l,c,f=(o[0]?"Close panel":o[1])+"",d,n,m,b,w,S,k;const A=o[3].default,P=Di(A,o,o[2],null);return{c(){r=Ne("details"),s=Ne("summary"),l=Ne("h3"),c=Ne("span"),d=zt(f),m=Et(),b=Ne("div"),P&&P.c(),this.h()},l(T){r=Ue(T,"DETAILS",{class:!0});var L=He(r);s=Ue(L,"SUMMARY",{class:!0,"data-ga-action":!0});var D=He(s);l=Ue(D,"H3",{class:!0});var B=He(l);c=Ue(B,"SPAN",{class:!0});var $=He(c);d=Mt($,f),$.forEach(te),B.forEach(te),D.forEach(te),m=kt(L),b=Ue(L,"DIV",{class:!0});var J=He(b);P&&P.l(J),J.forEach(te),L.forEach(te),this.h()},h(){_e(c,"class","ons-btn__inner"),_e(l,"class","ons-btn"),Ht(l,"ons-btn--secondary",o[0]),_e(s,"class","ons-collapsible__heading ons-js-collapsible-heading svelte-1x2xth5"),_e(s,"data-ga-action",n=o[0]?"Close panel":"Open panel"),_e(b,"class","ons-collapsible__content ons-js-collapsible-content svelte-1x2xth5"),_e(r,"class","ons-collapsible ons-js-collapsible svelte-1x2xth5")},m(T,L){Be(T,r,L),Pe(r,s),Pe(s,l),Pe(l,c),Pe(c,d),Pe(r,m),Pe(r,b),P&&P.m(b,null),r.open=o[0],w=!0,S||(k=bs(r,"toggle",o[4]),S=!0)},p(T,[L]){(!w||L&3)&&f!==(f=(T[0]?"Close panel":T[1])+"")&&kr(d,f),(!w||L&1)&&Ht(l,"ons-btn--secondary",T[0]),(!w||L&1&&n!==(n=T[0]?"Close panel":"Open panel"))&&_e(s,"data-ga-action",n),P&&P.p&&(!w||L&4)&&Ri(P,A,T,T[2],w?Bi(A,T[2],L,null):Li(T[2]),null),L&1&&(r.open=T[0])},i(T){w||(qe(P,T),w=!0)},o(T){nt(P,T),w=!1},d(T){T&&te(r),P&&P.d(T),S=!1,k()}}}function wS(o,r,s){let{$$slots:l={},$$scope:c}=r,{title:f="Title"}=r,{open:d=!1}=r;function n(){d=this.open,s(0,d)}return o.$$set=m=>{"title"in m&&s(1,f=m.title),"open"in m&&s(0,d=m.open),"$$scope"in m&&s(2,c=m.$$scope)},[d,f,c,l,n]}class ES extends Wr{constructor(r){super(),Kr(this,r,wS,xS,jr,{title:1,open:0})}}function Eu(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var wy={exports:{}};/*! + `,document.addEventListener("keydown",p=>{p.key===t&&(this._metaPress=!0)}),document.addEventListener("keyup",p=>{p.key===t&&(this._metaPress=!1)}),this._canvasContainer.addEventListener("wheel",p=>{this._onCooperativeGesture(p,this._metaPress,1)},!1),this._canvasContainer.classList.remove("mapboxgl-touch-drag-pan","maplibregl-touch-drag-pan")}_resizeCanvas(g,t,u){this._canvas.width=u*g,this._canvas.height=u*t,this._canvas.style.width=`${g}px`,this._canvas.style.height=`${t}px`}_setupPainter(){const g=n.extend({},m.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),t=this._canvas.getContext("webgl",g)||this._canvas.getContext("experimental-webgl",g);t?(this.painter=new cl(t,this.transform),n.exported$1.testSupport(t)):this.fire(new n.ErrorEvent(new Error("Failed to initialize WebGL")))}_contextLost(g){g.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new n.Event("webglcontextlost",{originalEvent:g}))}_contextRestored(g){this._setupPainter(),this.resize(),this._update(),this.fire(new n.Event("webglcontextrestored",{originalEvent:g}))}_onMapScroll(g){if(g.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}_onCooperativeGesture(g,t,u){return!t&&u<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(g){return this.style?(this._styleDirty=this._styleDirty||g,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(g){return this._update(),this._renderTaskQueue.add(g)}_cancelRenderFrame(g){this._renderTaskQueue.remove(g)}_render(g){let t,u=0;const p=this.painter.context.extTimerQuery;if(this.listens("gpu-timing-frame")&&(t=p.createQueryEXT(),p.beginQueryEXT(p.TIME_ELAPSED_EXT,t),u=n.exported.now()),this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(g),this._removed)return;let y=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const I=this.transform.zoom,R=n.exported.now();this.style.zoomHistory.update(I,R);const O=new n.EvaluationParameters(I,{now:R,fadeDuration:this._fadeDuration,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),V=O.crossFadingFactor();V===1&&V===this._crossFadingFactor||(y=!0,this._crossFadingFactor=V),this.style.update(O)}if(this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.style.terrain&&this.style.terrain.sourceCache.update(this.transform,this.style.terrain),this.transform.updateElevation(this.style.terrain),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,this._fadeDuration,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:this._fadeDuration,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer")}),this.fire(new n.Event("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.load),this.fire(new n.Event("load"))),this.style&&(this.style.hasTransitions()||y)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),this.listens("gpu-timing-frame")){const I=n.exported.now()-u;p.endQueryEXT(p.TIME_ELAPSED_EXT,t),setTimeout(()=>{const R=p.getQueryObjectEXT(t,p.QUERY_RESULT_EXT)/1e6;p.deleteQueryEXT(t),this.fire(new n.Event("gpu-timing-frame",{cpuTime:I,gpuTime:R}))},50)}if(this.listens("gpu-timing-layer")){const I=this.painter.collectGpuTimers();setTimeout(()=>{const R=this.painter.queryGpuTimers(I);this.fire(new n.Event("gpu-timing-layer",{layerTimes:R}))},50)}const x=this._sourcesDirty||this._styleDirty||this._placementDirty;return x||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new n.Event("idle")),!this._loaded||this._fullyLoaded||x||(this._fullyLoaded=!0,n.PerformanceUtils.mark(n.PerformanceMarkers.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){this._hash&&this._hash.remove();for(const t of this._controls)t.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&(removeEventListener("resize",this._onWindowResize,!1),removeEventListener("orientationchange",this._onWindowResize,!1),removeEventListener("online",this._onWindowOnline,!1));const g=this.painter.context.gl.getExtension("WEBGL_lose_context");g&&g.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),k.remove(this._canvasContainer),k.remove(this._controlContainer),this._cooperativeGestures&&k.remove(this._cooperativeGesturesScreen),this._container.classList.remove("maplibregl-map","mapboxgl-map"),n.PerformanceUtils.clearMetrics(),this._removed=!0,this.fire(new n.Event("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=n.exported.frame(g=>{n.PerformanceUtils.frame(g),this._frame=null,this._render(g)}))}_onWindowOnline(){this._update()}_onWindowResize(g){this._trackResize&&this.resize({originalEvent:g})._update()}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(g){this._showTileBoundaries!==g&&(this._showTileBoundaries=g,this._update())}get showPadding(){return!!this._showPadding}set showPadding(g){this._showPadding!==g&&(this._showPadding=g,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(g){this._showCollisionBoxes!==g&&(this._showCollisionBoxes=g,g?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(g){this._showOverdrawInspector!==g&&(this._showOverdrawInspector=g,this._update())}get repaint(){return!!this._repaint}set repaint(g){this._repaint!==g&&(this._repaint=g,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(g){this._vertices=g,this._update()}_setCacheLimits(g,t){n.setCacheLimits(g,t)}get version(){return"2.4.0"}},NavigationControl:class{constructor(g){this.options=n.extend({},fh,g),this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._container.addEventListener("contextmenu",t=>t.preventDefault()),this.options.showZoom&&(n.bindAll(["_setButtonTitle","_updateZoomButtons"],this),this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in mapboxgl-ctrl-zoom-in",t=>this._map.zoomIn({},{originalEvent:t})),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out mapboxgl-ctrl-zoom-out",t=>this._map.zoomOut({},{originalEvent:t})),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(n.bindAll(["_rotateCompassArrow"],this),this._compass=this._createButton("maplibregl-ctrl-compass mapboxgl-ctrl-compass",t=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:t}):this._map.resetNorth({},{originalEvent:t})}),this._compassIcon=k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const g=this._map.getZoom(),t=g===this._map.getMaxZoom(),u=g===this._map.getMinZoom();this._zoomInButton.disabled=t,this._zoomOutButton.disabled=u,this._zoomInButton.setAttribute("aria-disabled",t.toString()),this._zoomOutButton.setAttribute("aria-disabled",u.toString())}_rotateCompassArrow(){const g=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=g}onAdd(g){return this._map=g,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Mn(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){k.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(g,t){const u=k.create("button",g,this._container);return u.type="button",u.addEventListener("click",t),u}_setButtonTitle(g,t){const u=this._map._getUIString(`NavigationControl.${t}`);g.title=u,g.setAttribute("aria-label",u)}},GeolocateControl:class extends n.Evented{constructor(g){super(),this.options=n.extend({},vl,g),n.bindAll(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker"],this)}onAdd(g){var t;return this._map=g,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),t=this._setupUI,fa!==void 0?t(fa):window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(u=>{fa=u.state!=="denied",t(fa)}):(fa=!!window.navigator.geolocation,t(fa)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),k.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Fi=0,da=!1}_isOutOfMapMaxBounds(g){const t=this._map.getMaxBounds(),u=g.coords;return t&&(u.longitudet.getEast()||u.latitudet.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_onSuccess(g){if(this._map){if(this._isOutOfMapMaxBounds(g))return this._setErrorState(),this.fire(new n.Event("outofmaxbounds",g)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=g,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(g),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(g),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new n.Event("geolocate",g)),this._finish()}}_updateCamera(g){const t=new n.LngLat(g.coords.longitude,g.coords.latitude),u=g.coords.accuracy,p=this._map.getBearing(),y=n.extend({bearing:p},this.options.fitBoundsOptions);this._map.fitBounds(t.toBounds(u),y,{geolocateSource:!0})}_updateMarker(g){if(g){const t=new n.LngLat(g.coords.longitude,g.coords.latitude);this._accuracyCircleMarker.setLngLat(t).addTo(this._map),this._userLocationDotMarker.setLngLat(t).addTo(this._map),this._accuracy=g.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const g=this._map._container.clientHeight/2,t=this._map.unproject([0,g]),u=this._map.unproject([1,g]),p=t.distanceTo(u),y=Math.ceil(2*this._accuracy/p);this._circleElement.style.width=`${y}px`,this._circleElement.style.height=`${y}px`}_onZoom(){this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}_onError(g){if(this._map){if(this.options.trackUserLocation)if(g.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(g.code===3&&da)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale","mapboxgl-user-location-dot-stale"),this.fire(new n.Event("error",g)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(g){if(this._container.addEventListener("contextmenu",t=>t.preventDefault()),this._geolocateButton=k.create("button","maplibregl-ctrl-geolocate mapboxgl-ctrl-geolocate",this._container),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",g===!1){n.warnOnce("Geolocation support is not available so the GeolocateControl will be disabled.");const t=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}else{const t=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=t,this._geolocateButton.setAttribute("aria-label",t)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=k.create("div","maplibregl-user-location-dot mapboxgl-user-location-dot"),this._userLocationDotMarker=new Xa(this._dotElement),this._circleElement=k.create("div","maplibregl-user-location-accuracy-circle mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Xa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",t=>{t.geolocateSource||this._watchState!=="ACTIVE_LOCK"||t.originalEvent&&t.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this.fire(new n.Event("trackuserlocationend")))})}trigger(){if(!this._setup)return n.warnOnce("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new n.Event("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Fi--,da=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error","mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error","mapboxgl-ctrl-geolocate-background-error"),this.fire(new n.Event("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background","mapboxgl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new n.Event("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active","mapboxgl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let g;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Fi++,Fi>1?(g={maximumAge:6e5,timeout:0},da=!0):(g=this.options.positionOptions,da=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,g)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting","mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Ms,LogoControl:mo,ScaleControl:class{constructor(g){this.options=n.extend({},Dn,g),n.bindAll(["_onMove","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_onMove(){Gc(this._map,this._container,this.options)}onAdd(g){return this._map=g,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-scale mapboxgl-ctrl mapboxgl-ctrl-scale",g.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){k.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}setUnit(g){this.options.unit=g,Gc(this._map,this._container,this.options)}},FullscreenControl:class{constructor(g){this._fullscreen=!1,g&&g.container&&(g.container instanceof HTMLElement?this._container=g.container:n.warnOnce("Full screen control 'container' must be a DOM element.")),n.bindAll(["_onClickFullscreen","_changeIcon"],this),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(g){return this._map=g,this._container||(this._container=this._map.getContainer()),this._controlContainer=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._checkFullscreenSupport()?this._setupUI():(this._controlContainer.style.display="none",n.warnOnce("This device does not support fullscreen mode.")),this._controlContainer}onRemove(){k.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._changeIcon)}_checkFullscreenSupport(){return!!(document.fullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled||document.webkitFullscreenEnabled)}_setupUI(){const g=this._fullscreenButton=k.create("button","maplibregl-ctrl-fullscreen mapboxgl-ctrl-fullscreen",this._controlContainer);k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",g).setAttribute("aria-hidden","true"),g.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const g=this._getTitle();this._fullscreenButton.setAttribute("aria-label",g),this._fullscreenButton.title=g}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen&&window.document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},TerrainControl:class{constructor(g){this.options=g,n.bindAll(["_toggleTerrain","_updateTerrainIcon"],this)}onAdd(g){return this._map=g,this._container=k.create("div","maplibregl-ctrl maplibregl-ctrl-group mapboxgl-ctrl mapboxgl-ctrl-group"),this._terrainButton=k.create("button","maplibregl-ctrl-terrain mapboxgl-ctrl-terrain",this._container),k.create("span","maplibregl-ctrl-icon mapboxgl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){k.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}_toggleTerrain(){this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()}_updateTerrainIcon(){this._terrainButton.classList.remove("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._map.style.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled","mapboxgl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain","mapboxgl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))}},Popup:class extends n.Evented{constructor(g){super(),this.options=n.extend(Object.create(di),g),n.bindAll(["_update","_onClose","remove","_onMouseMove","_onMouseUp","_onDrag"],this)}addTo(g){return this._map&&this.remove(),this._map=g,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")):this._map.on("move",this._update),this.fire(new n.Event("open")),this}isOpen(){return!!this._map}remove(){return this._content&&k.remove(this._content),this._container&&(k.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new n.Event("close")),this}getLngLat(){return this._lngLat}setLngLat(g){return this._lngLat=n.LngLat.convert(g),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer","mapboxgl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer","mapboxgl-track-pointer")),this}getElement(){return this._container}setText(g){return this.setDOMContent(document.createTextNode(g))}setHTML(g){const t=document.createDocumentFragment(),u=document.createElement("body");let p;for(u.innerHTML=g;p=u.firstChild,p;)t.appendChild(p);return this.setDOMContent(t)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(g){return this.options.maxWidth=g,this._update(),this}setDOMContent(g){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=k.create("div","maplibregl-popup-content mapboxgl-popup-content",this._container);return this._content.appendChild(g),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(g){this._container&&this._container.classList.add(g)}removeClassName(g){this._container&&this._container.classList.remove(g)}setOffset(g){return this.options.offset=g,this._update(),this}toggleClassName(g){if(this._container)return this._container.classList.toggle(g)}_createCloseButton(){this.options.closeButton&&(this._closeButton=k.create("button","maplibregl-popup-close-button mapboxgl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_onMouseUp(g){this._update(g.point)}_onMouseMove(g){this._update(g.point)}_onDrag(g){this._update(g.point)}_update(g){if(!this._map||!this._lngLat&&!this._trackPointer||!this._content||(this._container||(this._container=k.create("div","maplibregl-popup mapboxgl-popup",this._map.getContainer()),this._tip=k.create("div","maplibregl-popup-tip mapboxgl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className&&this.options.className.split(" ").forEach(x=>this._container.classList.add(x)),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer","mapboxgl-popup-track-pointer")),this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Ds(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!g))return;const t=this._pos=this._trackPointer&&g?g:this._map.project(this._lngLat);let u=this.options.anchor;const p=bl(this.options.offset);if(!u){const x=this._container.offsetWidth,I=this._container.offsetHeight;let R;R=t.y+p.bottom.ythis._map.transform.height-I?["bottom"]:[],t.xthis._map.transform.width-x/2&&R.push("right"),u=R.length===0?"bottom":R.join("-")}const y=t.add(p[u]).round();k.setTransform(this._container,`${Kt[u]} translate(${y.x}px,${y.y}px)`),lr(this._container,u,"popup")}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const g=this._container.querySelector(bi);g&&g.focus()}_onClose(){this.remove()}},Marker:Xa,Style:fi,LngLat:n.LngLat,LngLatBounds:n.LngLatBounds,Point:n.pointGeometry,MercatorCoordinate:n.MercatorCoordinate,Evented:n.Evented,AJAXError:n.AJAXError,config:n.config,CanvasSource:oe,GeoJSONSource:rt,ImageSource:it,RasterDEMTileSource:ct,RasterTileSource:Z,VectorTileSource:We,VideoSource:et,prewarm:function(){tt().acquire(Rr)},clearPrewarmedResources:function(){const g=ut;g&&(g.isPreloaded()&&g.numActive()===1?(g.release(Rr),ut=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},get version(){return"2.4.0"},get workerCount(){return Vr.workerCount},set workerCount(g){Vr.workerCount=g},get maxParallelImageRequests(){return n.config.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(g){n.config.MAX_PARALLEL_IMAGE_REQUESTS=g},clearStorage(g){n.clearTileCache(g)},workerUrl:"",addProtocol(g,t){n.config.REGISTERED_PROTOCOLS[g]=t},removeProtocol(g){delete n.config.REGISTERED_PROTOCOLS[g]}};return _n.extend(Ta,{isSafari:n.isSafari,getPerformanceMetrics:n.PerformanceUtils.getPerformanceMetrics}),Ta});var d=c;return d})})(ry);var gE=ry.exports;const zo=Vu(gE);var pn=(o,r,a)=>new Promise((l,c)=>{var f=m=>{try{n(a.next(m))}catch(b){c(b)}},d=m=>{try{n(a.throw(m))}catch(b){c(b)}},n=m=>m.done?l(m.value):Promise.resolve(m.value).then(f,d);n((a=a.apply(o,r)).next())}),Pn=Uint8Array,Ro=Uint16Array,_E=Int32Array,ny=new Pn([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),ay=new Pn([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),yE=new Pn([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),sy=function(o,r){for(var a=new Ro(31),l=0;l<31;++l)a[l]=r+=1<>1|(Jr&21845)<<1,Ba=(Ba&52428)>>2|(Ba&13107)<<2,Ba=(Ba&61680)>>4|(Ba&3855)<<4,xf[Jr]=((Ba&65280)>>8|(Ba&255)<<8)>>1;var Ba,Jr,Yl=function(o,r,a){for(var l=o.length,c=0,f=new Ro(r);c>m]=b}else for(n=new Ro(l),c=0;c>15-o[c]);return n},cc=new Pn(288);for(Jr=0;Jr<144;++Jr)cc[Jr]=8;var Jr;for(Jr=144;Jr<256;++Jr)cc[Jr]=9;var Jr;for(Jr=256;Jr<280;++Jr)cc[Jr]=7;var Jr;for(Jr=280;Jr<288;++Jr)cc[Jr]=8;var Jr,cy=new Pn(32);for(Jr=0;Jr<32;++Jr)cy[Jr]=5;var Jr,wE=Yl(cc,9,1),EE=Yl(cy,5,1),lf=function(o){for(var r=o[0],a=1;ar&&(r=o[a]);return r},Qn=function(o,r,a){var l=r/8|0;return(o[l]|o[l+1]<<8)>>(r&7)&a},cf=function(o,r){var a=r/8|0;return(o[a]|o[a+1]<<8|o[a+2]<<16)>>(r&7)},kE=function(o){return(o+7)/8|0},SE=function(o,r,a){(r==null||r<0)&&(r=0),(a==null||a>o.length)&&(a=o.length);var l=new Pn(a-r);return l.set(o.subarray(r,a)),l},TE=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],An=function(o,r,a){var l=new Error(r||TE[o]);if(l.code=o,Error.captureStackTrace&&Error.captureStackTrace(l,An),!a)throw l;return l},fd=function(o,r,a,l){var c=o.length,f=l?l.length:0;if(!c||r.f&&!r.l)return a||new Pn(0);var d=!a||r.i!=2,n=r.i;a||(a=new Pn(c*3));var m=function(Bt){var Qt=a.length;if(Bt>Qt){var Rr=new Pn(Math.max(Qt*2,Bt));Rr.set(a),a=Rr}},b=r.f||0,w=r.p||0,S=r.b||0,k=r.l,A=r.d,P=r.m,T=r.n,L=c*8;do{if(!k){b=Qn(o,w,1);var D=Qn(o,w+1,3);if(w+=3,D)if(D==1)k=wE,A=EE,P=9,T=5;else if(D==2){var Y=Qn(o,w,31)+257,ae=Qn(o,w+10,15)+4,re=Y+Qn(o,w+5,31)+1;w+=14;for(var ce=new Pn(re),ye=new Pn(19),Ae=0;Ae>4;if(B<16)ce[Ae++]=B;else{var $e=0,ct=0;for(B==16?(ct=3+Qn(o,w,3),w+=2,$e=ce[Ae-1]):B==17?(ct=3+Qn(o,w,7),w+=3):B==18&&(ct=11+Qn(o,w,127),w+=7);ct--;)ce[Ae++]=$e}}var rt=ce.subarray(0,Y),$t=ce.subarray(Y);P=lf(rt),T=lf($t),k=Yl(rt,P,1),A=Yl($t,T,1)}else An(1);else{var B=kE(w)+4,$=o[B-4]|o[B-3]<<8,J=B+$;if(J>c){n&&An(0);break}d&&m(S+$),a.set(o.subarray(B,J),S),r.b=S+=$,r.p=w=J*8,r.f=b;continue}if(w>L){n&&An(0);break}}d&&m(S+131072);for(var it=(1<>4;if(w+=$e&15,w>L){n&&An(0);break}if($e||An(2),ge<256)a[S++]=ge;else if(ge==256){oe=w,k=null;break}else{var Me=ge-254;if(ge>264){var Ae=ge-257,ee=ny[Ae];Me=Qn(o,w,(1<>4;ue||An(3),w+=ue&15;var $t=xE[Je];if(Je>3){var ee=ay[Je];$t+=cf(o,w)&(1<L){n&&An(0);break}d&&m(S+131072);var wt=S+Me;if(S<$t){var pt=f-$t,Xe=Math.min($t,wt);for(pt+S<0&&An(3);S>3&1)+(r>>4&1);l>0;l-=!o[a++]);return a+(r&2)},AE=function(o){var r=o.length;return(o[r-4]|o[r-3]<<8|o[r-2]<<16|o[r-1]<<24)>>>0},PE=function(o,r){return((o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31)&&An(6,"invalid zlib data"),(o[1]>>5&1)==+!r&&An(6,"invalid zlib data: "+(o[1]&32?"need":"unexpected")+" dictionary"),(o[1]>>3&4)+2};function zE(o,r){return fd(o,{i:2},r&&r.out,r&&r.dictionary)}function ME(o,r){var a=CE(o);return a+8>o.length&&An(6,"invalid gzip data"),fd(o.subarray(a,-8),{i:2},r&&r.out||new Pn(AE(o)),r&&r.dictionary)}function DE(o,r){return fd(o.subarray(PE(o,r&&r.dictionary),-4),{i:2},r&&r.out,r&&r.dictionary)}function wf(o,r){return o[0]==31&&o[1]==139&&o[2]==8?ME(o,r):(o[0]&15)!=8||o[0]>>4>7||(o[0]<<8|o[1])%31?zE(o,r):DE(o,r)}var RE=typeof TextDecoder<"u"&&new TextDecoder,LE=0;try{RE.decode(IE,{stream:!0}),LE=1}catch{}var uy=(o,r)=>o*Math.pow(2,r),$l=(o,r)=>Math.floor(o/Math.pow(2,r)),Fu=(o,r)=>uy(o.getUint16(r+1,!0),8)+o.getUint8(r),hy=(o,r)=>uy(o.getUint32(r+2,!0),16)+o.getUint16(r,!0),BE=(o,r,a,l,c)=>{if(o!=l.getUint8(c))return o-l.getUint8(c);const f=Fu(l,c+1);if(r!=f)return r-f;const d=Fu(l,c+4);return a!=d?a-d:0},OE=(o,r,a,l)=>{const c=fy(o,r|128,a,l);return c?{z:r,x:a,y:l,offset:c[0],length:c[1],is_dir:!0}:null},fg=(o,r,a,l)=>{const c=fy(o,r,a,l);return c?{z:r,x:a,y:l,offset:c[0],length:c[1],is_dir:!1}:null},fy=(o,r,a,l)=>{let c=0,f=o.byteLength/17-1;for(;c<=f;){const d=f+c>>1,n=BE(r,a,l,o,d*17);if(n>0)c=d+1;else if(n<0)f=d-1;else return[hy(o,d*17+7),o.getUint32(d*17+13,!0)]}return null},FE=(o,r)=>o.is_dir&&!r.is_dir?1:!o.is_dir&&r.is_dir?-1:o.z!==r.z?o.z-r.z:o.x!==r.x?o.x-r.x:o.y-r.y,dy=(o,r)=>{const a=o.getUint8(r*17);return{z:a&127,x:Fu(o,r*17+1),y:Fu(o,r*17+4),offset:hy(o,r*17+7),length:o.getUint32(r*17+13,!0),is_dir:a>>7===1}},dg=o=>{const r=[],a=new DataView(o);for(let l=0;l{o.sort(FE);const r=new ArrayBuffer(17*o.length),a=new Uint8Array(r);for(let l=0;l>8&255,a[l*17+3]=c.x>>16&255,a[l*17+4]=c.y&255,a[l*17+5]=c.y>>8&255,a[l*17+6]=c.y>>16&255,a[l*17+7]=c.offset&255,a[l*17+8]=$l(c.offset,8)&255,a[l*17+9]=$l(c.offset,16)&255,a[l*17+10]=$l(c.offset,24)&255,a[l*17+11]=$l(c.offset,32)&255,a[l*17+12]=$l(c.offset,48)&255,a[l*17+13]=c.length&255,a[l*17+14]=c.length>>8&255,a[l*17+15]=c.length>>16&255,a[l*17+16]=c.length>>24&255}return r},UE=(o,r)=>{if(o.byteLength<17)return null;const a=o.byteLength/17,l=dy(o,a-1);if(l.is_dir){const c=l.z,f=r.z-c,d=Math.trunc(r.x/(1<{if(o.type=="json"){const a=o.url.substr(10);let l=this.tiles.get(a);return l||(l=new pg(a),this.tiles.set(a,l)),l.getHeader().then(c=>{const f={tiles:[o.url+"/{z}/{x}/{y}"],minzoom:c.minZoom,maxzoom:c.maxZoom,bounds:[c.minLon,c.minLat,c.maxLon,c.maxLat]};r(null,f,null,null)}).catch(c=>{r(c,null,null,null)}),{cancel:()=>{}}}else{const a=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=o.url.match(a);if(!l)throw new Error("Invalid PMTiles protocol URL");const c=l[1];let f=this.tiles.get(c);f||(f=new pg(c),this.tiles.set(c,f));const d=l[2],n=l[3],m=l[4],b=new AbortController,w=b.signal;let S=()=>{b.abort()};return f.getHeader().then(k=>{f.getZxy(+d,+n,+m,w).then(A=>{A?r(null,new Uint8Array(A.data),A.cacheControl,A.expires):k.tileType==1?r(null,new Uint8Array,null,null):r(null,null,null,null)}).catch(A=>{A.name!=="AbortError"&&r(A,null,null,null)})}),{cancel:S}}},this.tiles=new Map}add(o){this.tiles.set(o.source.getKey(),o)}get(o){return this.tiles.get(o)}};function Ao(o,r){return(r>>>0)*4294967296+(o>>>0)}function qE(o,r){const a=r.buf;let l,c;if(c=a[r.pos++],l=(c&112)>>4,c<128||(c=a[r.pos++],l|=(c&127)<<3,c<128)||(c=a[r.pos++],l|=(c&127)<<10,c<128)||(c=a[r.pos++],l|=(c&127)<<17,c<128)||(c=a[r.pos++],l|=(c&127)<<24,c<128)||(c=a[r.pos++],l|=(c&1)<<31,c<128))return Ao(o,l);throw new Error("Expected varint not more than 10 bytes")}function jl(o){const r=o.buf;let a,l;return l=r[o.pos++],a=l&127,l<128||(l=r[o.pos++],a|=(l&127)<<7,l<128)||(l=r[o.pos++],a|=(l&127)<<14,l<128)||(l=r[o.pos++],a|=(l&127)<<21,l<128)?a:(l=r[o.pos],a|=(l&15)<<28,qE(a,o))}function GE(o,r,a,l){if(l==0){a==1&&(r[0]=o-1-r[0],r[1]=o-1-r[1]);const c=r[0];r[0]=r[1],r[1]=c}}var ZE=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function HE(o,r,a){if(o>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(r>Math.pow(2,o)-1||a>Math.pow(2,o)-1)throw Error("tile x/y outside zoom level bounds");const l=ZE[o],c=Math.pow(2,o);let f=0,d=0,n=0;const m=[r,a];let b=c/2;for(;b>0;)f=(m[0]&b)>0?1:0,d=(m[1]&b)>0?1:0,n+=b*b*(3*f^d),GE(b,m,f,d),b=b/2;return l+n}function my(o,r){return pn(this,null,function*(){if(r===1||r===0)return o;if(r===2){if(typeof globalThis.DecompressionStream>"u")return wf(new Uint8Array(o));{let l=new Response(o).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(l).arrayBuffer()}}else throw Error("Compression method not supported")})}var WE=127;function KE(o,r){let a=0,l=o.length-1;for(;a<=l;){const c=l+a>>1,f=r-o[c].tileId;if(f>0)a=c+1;else if(f<0)l=c-1;else return o[c]}return l>=0&&(o[l].runLength===0||r-o[l].tileId=300)throw Error("Bad response code: "+c.status);const f=c.headers.get("Content-Length");if(c.status===200&&(!f||+f>r))throw l&&l.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield c.arrayBuffer(),etag:c.headers.get("ETag")||void 0,cacheControl:c.headers.get("Cache-Control")||void 0,expires:c.headers.get("Expires")||void 0}})}};function ea(o,r){const a=o.getUint32(r+4,!0),l=o.getUint32(r+0,!0);return a*Math.pow(2,32)+l}function JE(o,r){const a=new DataView(o),l=a.getUint8(7);if(l>3)throw Error(`Archive is spec version ${l} but this library supports up to spec version 3`);return{specVersion:l,rootDirectoryOffset:ea(a,8),rootDirectoryLength:ea(a,16),jsonMetadataOffset:ea(a,24),jsonMetadataLength:ea(a,32),leafDirectoryOffset:ea(a,40),leafDirectoryLength:ea(a,48),tileDataOffset:ea(a,56),tileDataLength:ea(a,64),numAddressedTiles:ea(a,72),numTileEntries:ea(a,80),numTileContents:ea(a,88),clustered:a.getUint8(96)===1,internalCompression:a.getUint8(97),tileCompression:a.getUint8(98),tileType:a.getUint8(99),minZoom:a.getUint8(100),maxZoom:a.getUint8(101),minLon:a.getInt32(102,!0)/1e7,minLat:a.getInt32(106,!0)/1e7,maxLon:a.getInt32(110,!0)/1e7,maxLat:a.getInt32(114,!0)/1e7,centerZoom:a.getUint8(118),centerLon:a.getInt32(119,!0)/1e7,centerLat:a.getInt32(123,!0)/1e7,etag:r}}function gy(o){const r={buf:new Uint8Array(o),pos:0},a=jl(r),l=[];let c=0;for(let f=0;f0?l[f].offset=l[f-1].offset+l[f-1].length:l[f].offset=d-1}return l}function YE(o){const r=new DataView(o);return r.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):r.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var Lo=class extends Error{};function QE(o,r,a,l){return pn(this,null,function*(){const c=yield o.getBytes(0,16384);if(new DataView(c.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(YE(c.data)<3)return[yield py.getHeader(o)];const d=c.data.slice(0,WE);let n=c.etag;l&&c.etag!=l&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+o.getKey()),n=void 0);const m=JE(d,n);if(a){const b=c.data.slice(m.rootDirectoryOffset,m.rootDirectoryOffset+m.rootDirectoryLength),w=o.getKey()+"|"+(m.etag||"")+"|"+m.rootDirectoryOffset+"|"+m.rootDirectoryLength,S=gy(yield r(b,m.internalCompression));return[m,[w,S.length,S]]}return[m,void 0]})}function ek(o,r,a,l,c){return pn(this,null,function*(){const f=yield o.getBytes(a,l);if(c.etag&&c.etag!==f.etag)throw new Lo(f.etag);const d=yield r(f.data,c.internalCompression),n=gy(d);if(n.length===0)throw new Error("Empty directory is invalid");return n})}var tk=class{constructor(o=100,r=!0,a=my){this.cache=new Map,this.maxCacheEntries=o,this.counter=1,this.prefetch=r,this.decompress=a}getHeader(o,r){return pn(this,null,function*(){const a=o.getKey();if(this.cache.has(a))return this.cache.get(a).lastUsed=this.counter++,yield this.cache.get(a).data;const l=new Promise((c,f)=>{QE(o,this.decompress,this.prefetch,r).then(d=>{d[1]&&this.cache.set(d[1][0],{lastUsed:this.counter++,data:Promise.resolve(d[1][2])}),c(d[0]),this.prune()}).catch(d=>{f(d)})});return this.cache.set(a,{lastUsed:this.counter++,data:l}),l})}getDirectory(o,r,a,l){return pn(this,null,function*(){const c=o.getKey()+"|"+(l.etag||"")+"|"+r+"|"+a;if(this.cache.has(c))return this.cache.get(c).lastUsed=this.counter++,yield this.cache.get(c).data;const f=new Promise((d,n)=>{ek(o,this.decompress,r,a,l).then(m=>{d(m),this.prune()}).catch(m=>{n(m)})});return this.cache.set(c,{lastUsed:this.counter++,data:f}),f})}getArrayBuffer(o,r,a,l){return pn(this,null,function*(){const c=o.getKey()+"|"+(l.etag||"")+"|"+r+"|"+a;if(this.cache.has(c))return this.cache.get(c).lastUsed=this.counter++,yield this.cache.get(c).data;const f=new Promise((d,n)=>{o.getBytes(r,a).then(m=>{if(l.etag&&l.etag!==m.etag)throw new Lo(m.etag);d(m.data),this.cache.has(c),this.prune()}).catch(m=>{n(m)})});return this.cache.set(c,{lastUsed:this.counter++,data:f}),f})}prune(){if(this.cache.size>=this.maxCacheEntries){let o=1/0,r;this.cache.forEach((a,l)=>{a.lastUsedf.maxZoom)return;let d=f.rootDirectoryOffset,n=f.rootDirectoryLength;for(let m=0;m<=3;m++){const b=yield this.cache.getDirectory(this.source,d,n,f),w=KE(b,c);if(w)if(w.runLength>0){const S=yield this.source.getBytes(f.tileDataOffset+w.offset,w.length,l);if(f.etag&&f.etag!==S.etag)throw new Lo(S.etag);return{data:yield this.decompress(S.data,f.tileCompression),cacheControl:S.cacheControl,expires:S.expires}}else d=f.leafDirectoryOffset+w.offset,n=w.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(o,r,a,l){return pn(this,null,function*(){try{return yield this.getZxyAttempt(o,r,a,l)}catch(c){if(c instanceof Lo)return this.cache.invalidate(this.source,c.message),yield this.getZxyAttempt(o,r,a,l);throw c}})}getMetadataAttempt(){return pn(this,null,function*(){const o=yield this.cache.getHeader(this.source),r=yield this.source.getBytes(o.jsonMetadataOffset,o.jsonMetadataLength);if(o.etag&&o.etag!==r.etag)throw new Lo(r.etag);const a=yield this.decompress(r.data,o.internalCompression),l=new TextDecoder("utf-8");return JSON.parse(l.decode(a))})}getMetadata(){return pn(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(o){if(o instanceof Lo)return this.cache.invalidate(this.source,o.message),yield this.getMetadataAttempt();throw o}})}};const{document:mg}=g_;function gg(o){let r;const a=o[20].default,l=Di(a,o,o[19],null);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f&524288)&&Ri(l,a,c,c[19],r?Bi(a,c[19],f,null):Li(c[19]),null)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function rk(o){let r,a,l,c,f,d=o[3]&&gg(o);return{c(){r=Ne("link"),l=Et(),c=Ne("div"),d&&d.c(),this.h()},l(n){const m=m_("svelte-19mu9pj",mg.head);r=Ue(m,"LINK",{rel:!0,href:!0}),m.forEach(te),l=kt(n),c=Ue(n,"DIV",{id:!0,class:!0});var b=He(c);d&&d.l(b),b.forEach(te),this.h()},h(){_e(r,"rel","stylesheet"),_e(r,"href",a=o[1]?o[1]:"https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css"),_e(c,"id",o[0]),_e(c,"class","map svelte-1tna482")},m(n,m){Pe(mg.head,r),Be(n,l,m),Be(n,c,m),d&&d.m(c,null),o[21](c),f=!0},p(n,[m]){(!f||m&2&&a!==(a=n[1]?n[1]:"https://unpkg.com/maplibre-gl@2.4.0/dist/maplibre-gl.css"))&&_e(r,"href",a),n[3]?d?(d.p(n,m),m&8&&qe(d,1)):(d=gg(n),d.c(),qe(d,1),d.m(c,null)):d&&(Nr(),nt(d,1,1,()=>{d=null}),Ur()),(!f||m&1)&&_e(c,"id",n[0])},i(n){f||(qe(d),f=!0)},o(n){nt(d),f=!1},d(n){te(r),n&&te(l),n&&te(c),d&&d.d(),o[21](null)}}}function ik(o=1e3){return new Promise(r=>setTimeout(r,o))}function nk(o,r,a){let{$$slots:l={},$$scope:c}=r;const f=Ef();let{map:d}=r,{id:n="map"}=r,{location:m={lng:15,lat:45,zoom:1}}=r,{style:b={version:8,sources:{},layers:[{id:"background",type:"background",paint:{"background-color":"lightgrey"}}]}}=r,{css:w=null}=r,{pmtiles:S=!1}=r,{options:k={}}=r,{minzoom:A=0}=r,{maxzoom:P=14}=r,{controls:T=!1}=r,{tabbable:L=!1}=r,{zoom:D=null}=r,{center:B=null}=r,{pitch:$=null}=r,{bearing:J=null}=r,{interactive:Y=!0}=r,{attribution:ae=!0}=r,re,ce={},ye=!1;qs("map",{getMap:()=>d}),m.bounds?ce.bounds=m.bounds:m.lng&&m.lat&&(ce.center=[+m.lng,+m.lat],m.zoom&&(ce.zoom=+m.zoom),m.pitch&&(ce.pitch=+m.pitch),m.bearing&&(ce.bearing=+m.bearing)),ae||(ce.attributionControl=!1),ce={...ce,...k},kf(()=>{if(S){let le=new jE;zo.addProtocol("pmtiles",le.tile)}a(4,d=new zo.Map({container:re,style:b,minZoom:A,maxZoom:P,interactive:Y,...ce})),T&&!Array.isArray(T)?d.addControl(new zo.NavigationControl({showCompass:!1})):Array.isArray(T)&&T!=["locate"]&&d.addControl(new zo.NavigationControl({showCompass:T.includes("compass"),visualizePitch:T.includes("pitch")})),Array.isArray(T)&&T.includes("locate")&&d.addControl(new zo.GeolocateControl),d.on("load",le=>{a(5,D=d.getZoom()),a(6,B=d.getCenter()),a(7,$=d.getPitch()),a(8,J=d.getBearing()),a(3,ye=!0),!L&&document.querySelector(`#${n} canvas`)&&(document.querySelector(`#${n} canvas`).tabIndex="-1"),f("load",{event:le})}),d.on("moveend",()=>{a(5,D=d.getZoom()),a(6,B=d.getCenter()),a(7,$=d.getPitch()),a(8,J=d.getBearing())})}),Uu(async()=>{await ik(250),d&&d.remove(),a(4,d=null)});function Ae(le){d&&d.setStyle(le),f("style",{style:le})}function _t(le){Zs[le?"unshift":"push"](()=>{re=le,a(2,re)})}return o.$$set=le=>{"map"in le&&a(4,d=le.map),"id"in le&&a(0,n=le.id),"location"in le&&a(9,m=le.location),"style"in le&&a(10,b=le.style),"css"in le&&a(1,w=le.css),"pmtiles"in le&&a(11,S=le.pmtiles),"options"in le&&a(12,k=le.options),"minzoom"in le&&a(13,A=le.minzoom),"maxzoom"in le&&a(14,P=le.maxzoom),"controls"in le&&a(15,T=le.controls),"tabbable"in le&&a(16,L=le.tabbable),"zoom"in le&&a(5,D=le.zoom),"center"in le&&a(6,B=le.center),"pitch"in le&&a(7,$=le.pitch),"bearing"in le&&a(8,J=le.bearing),"interactive"in le&&a(17,Y=le.interactive),"attribution"in le&&a(18,ae=le.attribution),"$$scope"in le&&a(19,c=le.$$scope)},o.$$.update=()=>{o.$$.dirty&1024&&Ae(b)},[n,w,re,ye,d,D,B,$,J,m,b,S,k,A,P,T,L,Y,ae,c,l,_t]}let ak=class extends Wr{constructor(r){super(),Kr(this,r,nk,rk,jr,{map:4,id:0,location:9,style:10,css:1,pmtiles:11,options:12,minzoom:13,maxzoom:14,controls:15,tabbable:16,zoom:5,center:6,pitch:7,bearing:8,interactive:17,attribution:18})}};function _g(o){let r;const a=o[12].default,l=Di(a,o,o[11],null);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f&2048)&&Ri(l,a,c,c[11],r?Bi(a,c[11],f,null):Li(c[11]),null)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function sk(o){let r,a,l=o[0]&&_g(o);return{c(){l&&l.c(),r=er()},l(c){l&&l.l(c),r=er()},m(c,f){l&&l.m(c,f),Be(c,r,f),a=!0},p(c,[f]){c[0]?l?(l.p(c,f),f&1&&qe(l,1)):(l=_g(c),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(c){a||(qe(l),a=!0)},o(c){nt(l),a=!1},d(c){l&&l.d(c),c&&te(r)}}}function ok(o=1e3){return new Promise(r=>setTimeout(r,o))}function lk(o,r,a){let{$$slots:l={},$$scope:c}=r,{id:f}=r,{type:d}=r,{url:n=null}=r,{props:m={}}=r,{data:b=null}=r,{layer:w=null}=r,{promoteId:S=null}=r,{minzoom:k=null}=r,{maxzoom:A=null}=r,{tilesize:P=256}=r,T=!1,L=n;const{getMap:D}=Gs("map"),B=D();qs("source",{source:f,layer:w,promoteId:S}),B.getSource(f)&&B.removeSource(f);async function $(){await ok(100),B.isSourceLoaded(f)?(a(0,T=!0),console.log(f+" map source loaded!")):(console.log("..."),$())}k&&(m.minzoom=k),A&&(m.maxzoom=A),w&&S?(m.promoteId={},m.promoteId[w]=S):S&&(m.promoteId=S);function J(){console.log(f+" map source loading...");let ce;d=="geojson"?b?ce={type:d,data:b,...m}:n&&(ce={type:d,data:n,...m}):d=="vector"?(ce={type:d,...m},n.slice(0,7)==="pmtiles"?ce.url=n:ce.tiles=[n]):d=="raster"?ce={type:d,tiles:[n],tileSize:P,...m}:d=="raster-dem"&&(ce={type:d,tiles:[n],tileSize:P,...m}),ce&&(console.log(ce),B.addSource(f,ce),$())}function Y(ce){let ye=B.getSource(f);ye&&ye.setData(ce)}function ae(ce){if(ce!==L){let ye=B.getSource(f);ye&&(ce.slice(0,7)==="pmtiles"?ye.setUrl(ce):ye.setTiles([ce])),L=ce}}function re(ce){ce!==L&&(B.getSource(f).tiles=[ce],B.style.sourceCaches[f].clearTiles(),B.style.sourceCaches[f].update(B.transform),B.triggerRepaint(),L=ce)}return kf(J),Uu(async()=>{B&&B.getSource(f)&&(B.getStyle().layers.filter(ye=>ye.source==f).forEach(ye=>{B.removeLayer(ye.id)}),B.removeSource(f))}),o.$$set=ce=>{"id"in ce&&a(2,f=ce.id),"type"in ce&&a(3,d=ce.type),"url"in ce&&a(4,n=ce.url),"props"in ce&&a(1,m=ce.props),"data"in ce&&a(5,b=ce.data),"layer"in ce&&a(6,w=ce.layer),"promoteId"in ce&&a(7,S=ce.promoteId),"minzoom"in ce&&a(8,k=ce.minzoom),"maxzoom"in ce&&a(9,A=ce.maxzoom),"tilesize"in ce&&a(10,P=ce.tilesize),"$$scope"in ce&&a(11,c=ce.$$scope)},o.$$.update=()=>{o.$$.dirty&41&&d=="geojson"&&T&&Y(b),o.$$.dirty&25&&d=="vector"&&T&&ae(n),o.$$.dirty&25&&d=="raster"&&T&&re(n)},[T,m,f,d,n,b,w,S,k,A,P,c,l]}class ck extends Wr{constructor(r){super(),Kr(this,r,lk,sk,jr,{id:2,type:3,url:4,props:1,data:5,layer:6,promoteId:7,minzoom:8,maxzoom:9,tilesize:10})}}const uk=o=>({hovered:o[0]&1}),yg=o=>({hovered:o[0]});function hk(o){let r;const a=o[30].default,l=Di(a,o,o[29],yg);return{c(){l&&l.c()},l(c){l&&l.l(c)},m(c,f){l&&l.m(c,f),r=!0},p(c,f){l&&l.p&&(!r||f[0]&536870913)&&Ri(l,a,c,c[29],r?Bi(a,c[29],f,uk):Li(c[29]),yg)},i(c){r||(qe(l,c),r=!0)},o(c){nt(l,c),r=!1},d(c){l&&l.d(c)}}}function fk(o,r,a){let l,{$$slots:c={},$$scope:f}=r;const d=Ef();let{id:n}=r,{type:m}=r,{filter:b=null}=r,{layout:w={}}=r,{paint:S={}}=r,{data:k=null}=r,{colorKey:A="color"}=r,{nameKey:P=null}=r,{valueKey:T=null}=r,{idKey:L=null}=r,{select:D=!1}=r,{clickIgnore:B=!1}=r,{clickCenter:$=!1}=r,{selected:J=null}=r,{hover:Y=!1}=r,{hovered:ae=null}=r,{highlight:re=!1}=r,{highlightKey:ce="highlighted"}=r,{highlighted:ye=[]}=r,{order:Ae=null}=r,{maxzoom:_t=null}=r,{minzoom:le=null}=r,{sourceLayer:We=null}=r,{visible:Z=!0}=r;const{source:$e,layer:ct,promoteId:rt}=Gs("source"),{getMap:$t}=Gs("map"),it=$t();qs("layer",{layer:n});const et=__({id:null,feature:null,event:null});Nu(o,et,Xe=>a(32,l=Xe)),qs("hover",et),L=L||rt,We=We||ct;let oe=null,ge=null,Me=[];w.visibility=Z?"visible":"none";let ee={id:n,type:m,source:$e,paint:S,layout:w};b&&(ee.filter=b),We&&(ee["source-layer"]=We),_t&&(ee.maxzoom=_t),le&&(ee.minzoom=le),kf(()=>{it.getLayer(n)&&it.removeLayer(n),it.addLayer(ee,Ae)});function ue(Xe,Bt=A){if(console.log("updating colors..."),P||T)for(const Qt of Xe)it.setFeatureState({source:$e,sourceLayer:We,id:Qt[L]},{color:Bt?Qt[Bt]:null,name:P?Qt[P]:null,value:T?Qt[T]:null});else for(const Qt of Xe)it.setFeatureState({source:$e,sourceLayer:We,id:Qt[L]},{color:Qt[Bt]})}function Je(Xe){it.getLayer(n)&&it.setFilter(n,Xe)}function wt(Xe){if(it.getLayer(n))for(const Bt in Xe)it.setPaintProperty(n,Bt,Xe[Bt])}function pt(Xe){it.getLayer(n)&&it.setLayoutProperty(n,"visibility",Xe?"visible":"none")}return D&&it.on("click",n,Xe=>{if(Xe.features.length>0&&!B){let Bt=Xe.features[0];if(a(2,J=Bt.id),d("select",{id:J,feature:Bt,event:Xe}),oe&&it.setFeatureState({source:$e,sourceLayer:We,id:oe},{selected:!1}),it.setFeatureState({source:$e,sourceLayer:We,id:J},{selected:!0}),$){let Qt=centroid(Xe.features[0].toJSON().geometry);it.flyTo({center:Qt.geometry.coordinates})}a(26,oe=J)}}),Y&&(it.on("mousemove",n,Xe=>{if(Xe.features.length>0){ae&&it.setFeatureState({source:$e,sourceLayer:We,id:ae},{hovered:!1});let Bt=Xe.features[0];a(0,ae=a(27,ge=Bt.id)),et.set({id:ae,feature:Bt,event:Xe}),d("hover",l),it.setFeatureState({source:$e,sourceLayer:We,id:ae},{hovered:!0}),it.getCanvas().style.cursor="pointer"}}),it.on("mouseleave",n,Xe=>{ae&&it.setFeatureState({source:$e,sourceLayer:We,id:ae},{hovered:!1}),a(0,ae=a(27,ge=null)),et.set({id:null,feature:null,event:Xe}),d("hover",l),it.getCanvas().style.cursor=""})),Uu(async()=>{it&&it.getLayer(n)&&it.removeLayer(n)}),o.$$set=Xe=>{"id"in Xe&&a(6,n=Xe.id),"type"in Xe&&a(7,m=Xe.type),"filter"in Xe&&a(8,b=Xe.filter),"layout"in Xe&&a(4,w=Xe.layout),"paint"in Xe&&a(9,S=Xe.paint),"data"in Xe&&a(10,k=Xe.data),"colorKey"in Xe&&a(11,A=Xe.colorKey),"nameKey"in Xe&&a(12,P=Xe.nameKey),"valueKey"in Xe&&a(13,T=Xe.valueKey),"idKey"in Xe&&a(5,L=Xe.idKey),"select"in Xe&&a(14,D=Xe.select),"clickIgnore"in Xe&&a(15,B=Xe.clickIgnore),"clickCenter"in Xe&&a(16,$=Xe.clickCenter),"selected"in Xe&&a(2,J=Xe.selected),"hover"in Xe&&a(17,Y=Xe.hover),"hovered"in Xe&&a(0,ae=Xe.hovered),"highlight"in Xe&&a(18,re=Xe.highlight),"highlightKey"in Xe&&a(19,ce=Xe.highlightKey),"highlighted"in Xe&&a(20,ye=Xe.highlighted),"order"in Xe&&a(21,Ae=Xe.order),"maxzoom"in Xe&&a(22,_t=Xe.maxzoom),"minzoom"in Xe&&a(23,le=Xe.minzoom),"sourceLayer"in Xe&&a(3,We=Xe.sourceLayer),"visible"in Xe&&a(24,Z=Xe.visible),"$$scope"in Xe&&a(29,f=Xe.$$scope)},o.$$.update=()=>{if(o.$$.dirty[0]&3072&&k&&ue(k,A),o.$$.dirty[0]&256&&Je(b),o.$$.dirty[0]&512&&wt(S),o.$$.dirty[0]&16777216&&pt(Z),o.$$.dirty[0]&270270472&&re&&ye!=Me){if(Me[0])for(const Xe of Me){let Bt={};Bt[ce]=!1,it.setFeatureState({source:$e,sourceLayer:We,id:Xe},Bt)}if(a(28,Me=ye),ye[0])for(const Xe of ye){let Bt={};Bt[ce]=!0,it.setFeatureState({source:$e,sourceLayer:We,id:Xe},Bt)}}o.$$.dirty[0]&67125260&&D&&J!=oe&&(oe&&it.setFeatureState({source:$e,sourceLayer:We,id:oe},{selected:!1}),J&&it.setFeatureState({source:$e,sourceLayer:We,id:J},{selected:!0}),a(26,oe=J)),o.$$.dirty[0]&134348809&&Y&&ae!=ge&&(ge&&it.setFeatureState({source:$e,sourceLayer:We,id:ge},{hovered:!1}),ae&&it.setFeatureState({source:$e,sourceLayer:We,id:ae},{hovered:!0}),a(27,ge=ae))},[ae,et,J,We,w,L,n,m,b,S,k,A,P,T,D,B,$,Y,re,ce,ye,Ae,_t,le,Z,ue,oe,ge,Me,f,c]}class uf extends Wr{constructor(r){super(),Kr(this,r,fk,hk,jr,{id:6,type:7,filter:8,layout:4,paint:9,data:10,colorKey:11,nameKey:12,valueKey:13,idKey:5,select:14,clickIgnore:15,clickCenter:16,selected:2,hover:17,hovered:0,highlight:18,highlightKey:19,highlighted:20,order:21,maxzoom:22,minzoom:23,sourceLayer:3,visible:24,updateColors:25},null,[-1,-1])}get updateColors(){return this.$$.ctx[25]}}function dk(o,r,a){let l,{content:c}=r;const f=new zo.Popup({closeButton:!1,closeOnClick:!1}),{getMap:d}=Gs("map"),n=d(),m=Gs("hover");Nu(o,m,w=>a(2,l=w));function b(w,S){w.id?f.setLngLat(w.event.lngLat).setHTML(S||w.code).addTo(n):f.remove()}return Uu(()=>f.remove()),o.$$set=w=>{"content"in w&&a(1,c=w.content)},o.$$.update=()=>{o.$$.dirty&6&&b(l,c)},[m,c,l]}class pk extends Wr{constructor(r){super(),Kr(this,r,dk,null,jr,{content:1})}}function vg(o,r,a){const l=o.slice();return l[9]=r[a],l[11]=a,l}function bg(o){let r,a,l,c,f,d=o[4](o[2][o[11]])+"",n;return{c(){r=Ne("div"),a=Et(),l=Ne("div"),c=Et(),f=Ne("div"),n=zt(d),this.h()},l(m){r=Ue(m,"DIV",{class:!0,style:!0}),He(r).forEach(te),a=kt(m),l=Ue(m,"DIV",{class:!0,style:!0}),He(l).forEach(te),c=kt(m),f=Ue(m,"DIV",{class:!0,style:!0});var b=He(f);n=Mt(b,d),b.forEach(te),this.h()},h(){_e(r,"class","block svelte-4k2wr9"),It(r,"width",100/(o[2].length-1)+"%"),It(r,"left",o[11]*(100/(o[2].length-1))+"%"),It(r,"background-color",o[3][o[11]]),_e(l,"class","line svelte-4k2wr9"),It(l,"left",o[11]*(100/(o[2].length-1))+"%"),_e(f,"class","tick svelte-4k2wr9"),It(f,"left",o[11]*(100/(o[2].length-1))+"%"),Ht(f,"tick-start",o[11]==0)},m(m,b){Be(m,r,b),Be(m,a,b),Be(m,l,b),Be(m,c,b),Be(m,f,b),Pe(f,n)},p(m,b){b&4&&It(r,"width",100/(m[2].length-1)+"%"),b&4&&It(r,"left",m[11]*(100/(m[2].length-1))+"%"),b&8&&It(r,"background-color",m[3][m[11]]),b&4&&It(l,"left",m[11]*(100/(m[2].length-1))+"%"),b&20&&d!==(d=m[4](m[2][m[11]])+"")&&kr(n,d),b&4&&It(f,"left",m[11]*(100/(m[2].length-1))+"%")},d(m){m&&te(r),m&&te(a),m&&te(l),m&&te(c),m&&te(f)}}}function xg(o){let r,a=`${o[7](o[0],o[2])}%`,l,c,f=o[5](o[0])+"",d,n;return{c(){r=Ne("div"),l=Et(),c=Ne("div"),d=zt(f),n=zt(o[6]),this.h()},l(m){r=Ue(m,"DIV",{class:!0}),He(r).forEach(te),l=kt(m),c=Ue(m,"DIV",{class:!0,style:!0});var b=He(c);d=Mt(b,f),n=Mt(b,o[6]),b.forEach(te),this.h()},h(){_e(r,"class","marker svelte-4k2wr9"),It(r,"left",a),_e(c,"class","value svelte-4k2wr9"),It(c,"left",o[7](o[0],o[2])+"%")},m(m,b){Be(m,r,b),Be(m,l,b),Be(m,c,b),Pe(c,d),Pe(c,n)},p(m,b){b&5&&a!==(a=`${m[7](m[0],m[2])}%`)&&It(r,"left",a),b&33&&f!==(f=m[5](m[0])+"")&&kr(d,f),b&64&&kr(n,m[6]),b&5&&It(c,"left",m[7](m[0],m[2])+"%")},d(m){m&&te(r),m&&te(l),m&&te(c)}}}function mk(o){let r,a,l,c,f,d=o[4](o[2][o[2].length-1])+"",n,m,b,w=o[2].slice(1),S=[];for(let A=0;Ak.toFixed(1)}=r,{formatVal:b=k=>k.toFixed(1)}=r,{suffix:w="%"}=r;const S=(k,A)=>{let P=0;for(;k>A[P+1];)P+=1;let T=100/(A.length-1),L=(k-A[P])/(A[P+1]-A[P]);return(P+L)*T};return o.$$set=k=>{"hovered"in k&&a(0,l=k.hovered),"lineWidth"in k&&a(8,c=k.lineWidth),"height"in k&&a(1,f=k.height),"breaks"in k&&a(2,d=k.breaks),"colors"in k&&a(3,n=k.colors),"formatTick"in k&&a(4,m=k.formatTick),"formatVal"in k&&a(5,b=k.formatVal),"suffix"in k&&a(6,w=k.suffix)},[l,f,d,n,m,b,w,S,c]}class _k extends Wr{constructor(r){super(),Kr(this,r,gk,mk,jr,{hovered:0,lineWidth:8,height:1,breaks:2,colors:3,formatTick:4,formatVal:5,suffix:6})}}function wg(o,r,a){const l=o.slice();return l[2]=r[a],l[4]=a,l}function Eg(o){let r,a,l,c=o[2].name+"",f,d,n,m=o[2].value.toFixed(1)+"",b,w,S;return{c(){r=Ne("tr"),a=Ne("td"),l=Ne("strong"),f=zt(c),d=Et(),n=Ne("td"),b=zt(m),w=zt("%"),S=Et(),this.h()},l(k){r=Ue(k,"TR",{});var A=He(r);a=Ue(A,"TD",{class:!0});var P=He(a);l=Ue(P,"STRONG",{});var T=He(l);f=Mt(T,c),T.forEach(te),P.forEach(te),d=kt(A),n=Ue(A,"TD",{class:!0});var L=He(n);b=Mt(L,m),w=Mt(L,"%"),L.forEach(te),S=kt(A),A.forEach(te),this.h()},h(){_e(a,"class","svelte-1i52e02"),_e(n,"class","text-right svelte-1i52e02")},m(k,A){Be(k,r,A),Pe(r,a),Pe(a,l),Pe(l,f),Pe(r,d),Pe(r,n),Pe(n,b),Pe(n,w),Pe(r,S)},p(k,A){A&1&&c!==(c=k[2].name+"")&&kr(f,c),A&1&&m!==(m=k[2].value.toFixed(1)+"")&&kr(b,m)},d(k){k&&te(r)}}}function yk(o){let r,a,l=o[0],c=[];for(let f=0;f{"data"in f&&a(0,l=f.data),"offset"in f&&a(1,c=f.offset)},[l,c]}class _y extends Wr{constructor(r){super(),Kr(this,r,vk,yk,jr,{data:0,offset:1})}}function bk(o){let r,a,l,c,f;return{c(){r=Ne("div"),a=Ne("div"),l=Et(),c=Ne("div"),f=zt("No data"),this.h()},l(d){r=Ue(d,"DIV",{class:!0,style:!0});var n=He(r);a=Ue(n,"DIV",{class:!0,style:!0}),He(a).forEach(te),l=kt(n),c=Ue(n,"DIV",{class:!0});var m=He(c);f=Mt(m,"No data"),m.forEach(te),n.forEach(te),this.h()},h(){_e(a,"class","block svelte-b1cp2z"),It(a,"width","100%"),It(a,"background-color",o[1]),_e(c,"class","tick svelte-b1cp2z"),_e(r,"class","container svelte-b1cp2z"),It(r,"height",o[0]+"px")},m(d,n){Be(d,r,n),Pe(r,a),Pe(r,l),Pe(r,c),Pe(c,f)},p(d,[n]){n&2&&It(a,"background-color",d[1]),n&1&&It(r,"height",d[0]+"px")},i:_r,o:_r,d(d){d&&te(r)}}}function xk(o,r,a){let{height:l=15}=r,{color:c="lightgrey"}=r;return o.$$set=f=>{"height"in f&&a(0,l=f.height),"color"in f&&a(1,c=f.color)},[l,c]}class wk extends Wr{constructor(r){super(),Kr(this,r,xk,bk,jr,{height:0,color:1})}}function Ek(o){let r,a;return{c(){r=Ne("p"),a=zt(`People with the selected characteristics as a proportion of whole + population in each area.`),this.h()},l(l){r=Ue(l,"P",{class:!0});var c=He(r);a=Mt(c,`People with the selected characteristics as a proportion of whole + population in each area.`),c.forEach(te),this.h()},h(){_e(r,"class","subtitle svelte-xikkwp")},m(l,c){Be(l,r,c),Pe(r,a)},p:_r,d(l){l&&te(r)}}}function kg(o){let r,a;return r=new ck({props:{id:"lad",type:"geojson",data:o[0].geojson,promoteId:o[2].code,$$slots:{default:[Sk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&1&&(f.data=l[0].geojson),c&4&&(f.promoteId=l[2].code),c&4161&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function kk(o){let r,a;return r=new pk({props:{content:o[7](o[6])}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&64&&(f.content=l[7](l[6])),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function Sk(o){let r,a,l,c,f,d,n;function m(w){o[8](w)}let b={id:"lad-fill",data:o[0].geoPerc,idKey:"code",nameKey:"name",valueKey:"value",hover:!0,tooltip:!0,type:"fill",paint:{"fill-color":["case",["!=",["feature-state","color"],null],["feature-state","color"],"rgba(255, 255, 255, 0)"],"fill-opacity":.8},order:"place_other",$$slots:{default:[kk]},$$scope:{ctx:o}};return o[6]!==void 0&&(b.hovered=o[6]),r=new uf({props:b}),Zs.push(()=>Fo(r,"hovered",m)),c=new uf({props:{id:"lad-line",type:"line",paint:{"line-color":"white","line-width":.3},order:"place_other"}}),d=new uf({props:{id:"lad-hover",type:"line",paint:{"line-color":"black","line-width":2,"line-opacity":["case",["==",["feature-state","hovered"],!0],1,0]},order:"place_other"}}),{c(){ir(r.$$.fragment),l=Et(),ir(c.$$.fragment),f=Et(),ir(d.$$.fragment)},l(w){cr(r.$$.fragment,w),l=kt(w),cr(c.$$.fragment,w),f=kt(w),cr(d.$$.fragment,w)},m(w,S){nr(r,w,S),Be(w,l,S),nr(c,w,S),Be(w,f,S),nr(d,w,S),n=!0},p(w,S){const k={};S&1&&(k.data=w[0].geoPerc),S&4160&&(k.$$scope={dirty:S,ctx:w}),!a&&S&64&&(a=!0,k.hovered=w[6],No(()=>a=!1)),r.$set(k)},i(w){n||(qe(r.$$.fragment,w),qe(c.$$.fragment,w),qe(d.$$.fragment,w),n=!0)},o(w){nt(r.$$.fragment,w),nt(c.$$.fragment,w),nt(d.$$.fragment,w),n=!1},d(w){ar(r,w),w&&te(l),ar(c,w),w&&te(f),ar(d,w)}}}function Tk(o){let r,a,l=o[0].geojson&&o[0].geoPerc&&kg(o);return{c(){l&&l.c(),r=er()},l(c){l&&l.l(c),r=er()},m(c,f){l&&l.m(c,f),Be(c,r,f),a=!0},p(c,f){c[0].geojson&&c[0].geoPerc?l?(l.p(c,f),f&1&&qe(l,1)):(l=kg(c),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(c){a||(qe(l),a=!0)},o(c){nt(l),a=!1},d(c){l&&l.d(c),c&&te(r)}}}function Sg(o){let r,a,l,c,f=o[0].geoPerc.some(Ig),d;l=new _k({props:{breaks:o[0].geoBreaks,hovered:o[6]&&o[0].geoPerc.find(o[9])?o[0].geoPerc.find(o[10]).value:null,colors:o[0].geoBreaks[1]==100?[o[5].seq[4]]:o[5].seq}});let n=f&&Tg();return{c(){r=Ne("div"),a=Ne("div"),ir(l.$$.fragment),c=Et(),n&&n.c(),this.h()},l(m){r=Ue(m,"DIV",{class:!0});var b=He(r);a=Ue(b,"DIV",{class:!0});var w=He(a);cr(l.$$.fragment,w),w.forEach(te),c=kt(b),n&&n.l(b),b.forEach(te),this.h()},h(){_e(a,"class","map-legend-breaks svelte-xikkwp"),_e(r,"class","map-legend svelte-xikkwp")},m(m,b){Be(m,r,b),Pe(r,a),nr(l,a,null),Pe(r,c),n&&n.m(r,null),d=!0},p(m,b){const w={};b&1&&(w.breaks=m[0].geoBreaks),b&65&&(w.hovered=m[6]&&m[0].geoPerc.find(m[9])?m[0].geoPerc.find(m[10]).value:null),b&33&&(w.colors=m[0].geoBreaks[1]==100?[m[5].seq[4]]:m[5].seq),l.$set(w),b&1&&(f=m[0].geoPerc.some(Ig)),f?n?b&1&&qe(n,1):(n=Tg(),n.c(),qe(n,1),n.m(r,null)):n&&(Nr(),nt(n,1,1,()=>{n=null}),Ur())},i(m){d||(qe(l.$$.fragment,m),qe(n),d=!0)},o(m){nt(l.$$.fragment,m),nt(n),d=!1},d(m){m&&te(r),ar(l),n&&n.d()}}}function Tg(o){let r,a,l;return a=new wk({}),{c(){r=Ne("div"),ir(a.$$.fragment),this.h()},l(c){r=Ue(c,"DIV",{class:!0});var f=He(r);cr(a.$$.fragment,f),f.forEach(te),this.h()},h(){_e(r,"class","map-legend-nodata svelte-xikkwp")},m(c,f){Be(c,r,f),nr(a,r,null),l=!0},i(c){l||(qe(a.$$.fragment,c),l=!0)},o(c){nt(a.$$.fragment,c),l=!1},d(c){c&&te(r),ar(a)}}}function Ik(o){let r,a,l,c,f;a=new ak({props:{style:o[1],location:{bounds:o[3]},options:{preserveDrawingBuffer:!0},$$slots:{default:[Tk]},$$scope:{ctx:o}}});let d=o[0].geoBreaks&&o[0].geoPerc&&Sg(o);return{c(){r=Ne("div"),ir(a.$$.fragment),l=Et(),d&&d.c(),c=er(),this.h()},l(n){r=Ue(n,"DIV",{});var m=He(r);cr(a.$$.fragment,m),m.forEach(te),l=kt(n),d&&d.l(n),c=er(),this.h()},h(){It(r,"height","450px")},m(n,m){Be(n,r,m),nr(a,r,null),Be(n,l,m),d&&d.m(n,m),Be(n,c,m),f=!0},p(n,m){const b={};m&2&&(b.style=n[1]),m&8&&(b.location={bounds:n[3]}),m&4165&&(b.$$scope={dirty:m,ctx:n}),a.$set(b),n[0].geoBreaks&&n[0].geoPerc?d?(d.p(n,m),m&1&&qe(d,1)):(d=Sg(n),d.c(),qe(d,1),d.m(c.parentNode,c)):d&&(Nr(),nt(d,1,1,()=>{d=null}),Ur())},i(n){f||(qe(a.$$.fragment,n),qe(d),f=!0)},o(n){nt(a.$$.fragment,n),nt(d),f=!1},d(n){n&&te(r),ar(a),n&&te(l),d&&d.d(n),n&&te(c)}}}function Ck(o){let r,a;return{c(){r=Ne("span"),a=zt("Make a selection to see rankings."),this.h()},l(l){r=Ue(l,"SPAN",{class:!0});var c=He(r);a=Mt(c,"Make a selection to see rankings."),c.forEach(te),this.h()},h(){_e(r,"class","muted svelte-xikkwp")},m(l,c){Be(l,r,c),Pe(r,a)},p:_r,i:_r,o:_r,d(l){l&&te(r)}}}function Ak(o){let r,a;return r=new _y({props:{data:[...o[0].geoPerc].filter(Cg).sort(Ag).slice(0,5)}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&1&&(f.data=[...l[0].geoPerc].filter(Cg).sort(Ag).slice(0,5)),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function Pk(o){let r,a,l,c;const f=[Ak,Ck],d=[];function n(m,b){return m[0].geoPerc&&m[4][0]?0:1}return r=n(o),a=d[r]=f[r](o),{c(){a.c(),l=er()},l(m){a.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),a=d[r],a?a.p(m,b):(a=d[r]=f[r](m),a.c()),qe(a,1),a.m(l.parentNode,l))},i(m){c||(qe(a),c=!0)},o(m){nt(a),c=!1},d(m){d[r].d(m),m&&te(l)}}}function zk(o){let r,a;return{c(){r=Ne("span"),a=zt("Make a selection to see rankings."),this.h()},l(l){r=Ue(l,"SPAN",{class:!0});var c=He(r);a=Mt(c,"Make a selection to see rankings."),c.forEach(te),this.h()},h(){_e(r,"class","muted svelte-xikkwp")},m(l,c){Be(l,r,c),Pe(r,a)},p:_r,i:_r,o:_r,d(l){l&&te(r)}}}function Mk(o){let r,a;return r=new _y({props:{data:o[0].geoPerc.filter(Pg).sort(zg).slice(-5),offset:o[0].geoPerc.filter(Mg).length-4}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&1&&(f.data=l[0].geoPerc.filter(Pg).sort(zg).slice(-5)),c&1&&(f.offset=l[0].geoPerc.filter(Mg).length-4),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function Dk(o){let r,a,l,c;const f=[Mk,zk],d=[];function n(m,b){return m[0].geoPerc&&m[4][0]?0:1}return r=n(o),a=d[r]=f[r](o),{c(){a.c(),l=er()},l(m){a.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),a=d[r],a?a.p(m,b):(a=d[r]=f[r](m),a.c()),qe(a,1),a.m(l.parentNode,l))},i(m){c||(qe(a),c=!0)},o(m){nt(a),c=!1},d(m){d[r].d(m),m&&te(l)}}}function Rk(o){let r,a,l,c,f,d,n,m;return r=new Oa({props:{colspan:3,rowspan:1,noBackground:!0,$$slots:{default:[Ek]},$$scope:{ctx:o}}}),l=new Oa({props:{colspan:2,rowspan:2,noBackground:!0,$$slots:{default:[Ik]},$$scope:{ctx:o}}}),f=new Oa({props:{title:"Areas with high %",$$slots:{default:[Pk]},$$scope:{ctx:o}}}),n=new Oa({props:{title:"Areas with low %",$$slots:{default:[Dk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment),a=Et(),ir(l.$$.fragment),c=Et(),ir(f.$$.fragment),d=Et(),ir(n.$$.fragment)},l(b){cr(r.$$.fragment,b),a=kt(b),cr(l.$$.fragment,b),c=kt(b),cr(f.$$.fragment,b),d=kt(b),cr(n.$$.fragment,b)},m(b,w){nr(r,b,w),Be(b,a,w),nr(l,b,w),Be(b,c,w),nr(f,b,w),Be(b,d,w),nr(n,b,w),m=!0},p(b,w){const S={};w&4096&&(S.$$scope={dirty:w,ctx:b}),r.$set(S);const k={};w&4207&&(k.$$scope={dirty:w,ctx:b}),l.$set(k);const A={};w&4113&&(A.$$scope={dirty:w,ctx:b}),f.$set(A);const P={};w&4113&&(P.$$scope={dirty:w,ctx:b}),n.$set(P)},i(b){m||(qe(r.$$.fragment,b),qe(l.$$.fragment,b),qe(f.$$.fragment,b),qe(n.$$.fragment,b),m=!0)},o(b){nt(r.$$.fragment,b),nt(l.$$.fragment,b),nt(f.$$.fragment,b),nt(n.$$.fragment,b),m=!1},d(b){ar(r,b),b&&te(a),ar(l,b),b&&te(c),ar(f,b),b&&te(d),ar(n,b)}}}function Lk(o){let r,a;return r=new Sf({props:{title:"Population by area",height:"auto",cls:"ons-cards pgp-map-tiles",$$slots:{default:[Rk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,[c]){const f={};c&4223&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}const Ig=o=>o.value===null,Cg=o=>o.value!=null,Ag=(o,r)=>r.value-o.value,Pg=o=>o.value!=null,zg=(o,r)=>r.value-o.value,Mg=o=>o.value!=null;function Bk(o,r,a){let l,{data:c}=r,{mapStyle:f}=r,{ladBounds:d}=r,{mapBounds:n}=r,{selected:m}=r,{colors:b}=r,w;const S=T=>{var D;let L="";if(T){L=`${c.geoCodesLookup[w].name}
`;const B=(D=l==null?void 0:l[T])==null?void 0:D.value;L+=B!=null?`${B}%`:"No data"}return L};function k(T){w=T,a(6,w)}const A=T=>T.code==w,P=T=>T.code==w;return o.$$set=T=>{"data"in T&&a(0,c=T.data),"mapStyle"in T&&a(1,f=T.mapStyle),"ladBounds"in T&&a(2,d=T.ladBounds),"mapBounds"in T&&a(3,n=T.mapBounds),"selected"in T&&a(4,m=T.selected),"colors"in T&&a(5,b=T.colors)},o.$$.update=()=>{o.$$.dirty&1&&(l=(T=>{const L={};return console.log("data",T),Array.isArray(T)&&T.forEach(D=>L[D.code]=D),L})(c.geoPerc))},[c,f,d,n,m,b,w,S,k,A,P]}class Ok extends Wr{constructor(r){super(),Kr(this,r,Bk,Lk,jr,{data:0,mapStyle:1,ladBounds:2,mapBounds:3,selected:4,colors:5})}}function Dg(o){let r,a;return r=new Oa({props:{title:o[0],$$slots:{default:[Vk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&1&&(f.title=l[0]),c&30&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function Fk(o){let r,a,l;var c=o[3];function f(d){return{props:{data:d[2].selected&&Bu("residents",d[1].code,d[2]),showLegend:!1}}}return c&&(r=Op(c,f(o))),{c(){r&&ir(r.$$.fragment),a=er()},l(d){r&&cr(r.$$.fragment,d),a=er()},m(d,n){r&&nr(r,d,n),Be(d,a,n),l=!0},p(d,n){const m={};if(n&6&&(m.data=d[2].selected&&Bu("residents",d[1].code,d[2])),n&8&&c!==(c=d[3])){if(r){Nr();const b=r;nt(b.$$.fragment,1,0,()=>{ar(b,1)}),Ur()}c?(r=Op(c,f(d)),ir(r.$$.fragment),qe(r.$$.fragment,1),nr(r,a.parentNode,a)):r=null}else c&&r.$set(m)},i(d){l||(r&&qe(r.$$.fragment,d),l=!0)},o(d){r&&nt(r.$$.fragment,d),l=!1},d(d){d&&te(a),r&&ar(r,d)}}}function Nk(o){let r,a=tc.nodata+"",l;return{c(){r=Ne("span"),l=zt(a),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,a),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-1yn8adz")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function Uk(o){let r,a=tc.blocked+"",l;return{c(){r=Ne("span"),l=zt(a),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,a),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-1yn8adz")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function Vk(o){let r,a,l,c,f,d=Bp[o[1].code]+"",n,m;const b=[Uk,Nk,Fk],w=[];function S(k,A){return k[2].selected.residents[k[1].code].values==="blocked"?0:k[2].selected.residents[k[1].code].values.percent[0]==null?1:2}return r=S(o),a=w[r]=b[r](o),{c(){a.c(),l=Et(),c=Ne("span"),f=zt("% of "),n=zt(d),this.h()},l(k){a.l(k),l=kt(k),c=Ue(k,"SPAN",{class:!0});var A=He(c);f=Mt(A,"% of "),n=Mt(A,d),A.forEach(te),this.h()},h(){_e(c,"class","num-desc svelte-1yn8adz")},m(k,A){w[r].m(k,A),Be(k,l,A),Be(k,c,A),Pe(c,f),Pe(c,n),m=!0},p(k,A){let P=r;r=S(k),r===P?w[r].p(k,A):(Nr(),nt(w[P],1,1,()=>{w[P]=null}),Ur(),a=w[r],a?a.p(k,A):(a=w[r]=b[r](k),a.c()),qe(a,1),a.m(l.parentNode,l)),(!m||A&2)&&d!==(d=Bp[k[1].code]+"")&&kr(n,d)},i(k){m||(qe(a),m=!0)},o(k){nt(a),m=!1},d(k){w[r].d(k),k&&te(l),k&&te(c)}}}function $k(o){var c,f;let r,a,l=((f=(c=o[2].selected.residents)==null?void 0:c[o[1].code])==null?void 0:f.values)&&Dg(o);return{c(){l&&l.c(),r=er()},l(d){l&&l.l(d),r=er()},m(d,n){l&&l.m(d,n),Be(d,r,n),a=!0},p(d,[n]){var m,b;(b=(m=d[2].selected.residents)==null?void 0:m[d[1].code])!=null&&b.values?l?(l.p(d,n),n&6&&qe(l,1)):(l=Dg(d),l.c(),qe(l,1),l.m(r.parentNode,r)):l&&(Nr(),nt(l,1,1,()=>{l=null}),Ur())},i(d){a||(qe(l),a=!0)},o(d){nt(l),a=!1},d(d){l&&l.d(d),d&&te(r)}}}function jk(o,r,a){let{title:l}=r,{table:c}=r,{data:f}=r,{chart_type:d}=r;return o.$$set=n=>{"title"in n&&a(0,l=n.title),"table"in n&&a(1,c=n.table),"data"in n&&a(2,f=n.data),"chart_type"in n&&a(3,d=n.chart_type)},[l,c,f,d]}class yy extends Wr{constructor(r){super(),Kr(this,r,jk,$k,jr,{title:0,table:1,data:2,chart_type:3})}}function qk(o){let r,a;const l=o[5].default,c=Di(l,o,o[4],null);return{c(){r=Ne("mark"),c&&c.c(),this.h()},l(f){r=Ue(f,"MARK",{class:!0,style:!0,role:!0});var d=He(r);c&&c.l(d),d.forEach(te),this.h()},h(){_e(r,"class","em svelte-1602h77"),It(r,"background-color",o[0]),It(r,"color",o[2]),_e(r,"role","presentation"),Ht(r,"nowrap",o[1])},m(f,d){Be(f,r,d),c&&c.m(r,null),a=!0},p(f,[d]){c&&c.p&&(!a||d&16)&&Ri(c,l,f,f[4],a?Bi(l,f[4],d,null):Li(f[4]),null),(!a||d&1)&&It(r,"background-color",f[0]),(!a||d&4)&&It(r,"color",f[2]),(!a||d&2)&&Ht(r,"nowrap",f[1])},i(f){a||(qe(c,f),a=!0)},o(f){nt(c,f),a=!1},d(f){f&&te(r),c&&c.d(f)}}}function Gk(o,r,a){let l,{$$slots:c={},$$scope:f}=r,{color:d="lightgrey"}=r,{nowrap:n=!0}=r;function m(w){return(w[0]*299+w[1]*587+w[2]*114)/1e3>125?"black":"white"}let b="black";return o.$$set=w=>{"color"in w&&a(0,d=w.color),"nowrap"in w&&a(1,n=w.nowrap),"$$scope"in w&&a(4,f=w.$$scope)},o.$$.update=()=>{o.$$.dirty&1&&a(3,l=uv(d).rgb),o.$$.dirty&8&&l&&a(2,b=m(l))},[d,n,b,l,f,c]}class Zk extends Wr{constructor(r){super(),Kr(this,r,Gk,qk,jr,{color:0,nowrap:1})}}function Hk(o){let r,a=o[0].selected.total_pop.count.toLocaleString()+"",l,c,f,d,n,m,b,w,S;return b=new Zk({props:{color:"lightgrey",$$slots:{default:[Kk]},$$scope:{ctx:o}}}),{c(){r=Ne("div"),l=zt(a),c=Et(),f=Ne("div"),d=zt("people"),n=Et(),m=Ne("div"),ir(b.$$.fragment),w=zt(" of the total population of England and Wales"),this.h()},l(k){r=Ue(k,"DIV",{class:!0});var A=He(r);l=Mt(A,a),A.forEach(te),c=kt(k),f=Ue(k,"DIV",{class:!0});var P=He(f);d=Mt(P,"people"),P.forEach(te),n=kt(k),m=Ue(k,"DIV",{class:!0});var T=He(m);cr(b.$$.fragment,T),w=Mt(T," of the total population of England and Wales"),T.forEach(te),this.h()},h(){_e(r,"class","num-big svelte-c46qp4"),_e(f,"class","num-suffix svelte-c46qp4"),_e(m,"class","num-desc svelte-c46qp4")},m(k,A){Be(k,r,A),Pe(r,l),Be(k,c,A),Be(k,f,A),Pe(f,d),Be(k,n,A),Be(k,m,A),nr(b,m,null),Pe(m,w),S=!0},p(k,A){(!S||A&1)&&a!==(a=k[0].selected.total_pop.count.toLocaleString()+"")&&kr(l,a);const P={};A&3&&(P.$$scope={dirty:A,ctx:k}),b.$set(P)},i(k){S||(qe(b.$$.fragment,k),S=!0)},o(k){nt(b.$$.fragment,k),S=!1},d(k){k&&te(r),k&&te(c),k&&te(f),k&&te(n),k&&te(m),ar(b)}}}function Wk(o){let r,a=tc.nodata+"",l;return{c(){r=Ne("div"),l=zt(a),this.h()},l(c){r=Ue(c,"DIV",{class:!0});var f=He(r);l=Mt(f,a),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-c46qp4")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function Kk(o){let r=Om(o[0].selected.total_pop.percent)+"",a,l;return{c(){a=zt(r),l=zt("%")},l(c){a=Mt(c,r),l=Mt(c,"%")},m(c,f){Be(c,a,f),Be(c,l,f)},p(c,f){f&1&&r!==(r=Om(c[0].selected.total_pop.percent)+"")&&kr(a,r)},d(c){c&&te(a),c&&te(l)}}}function Xk(o){let r,a,l,c;const f=[Wk,Hk],d=[];function n(m,b){return m[0].selected.total_pop.count==null?0:1}return r=n(o),a=d[r]=f[r](o),{c(){a.c(),l=er()},l(m){a.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),a=d[r],a?a.p(m,b):(a=d[r]=f[r](m),a.c()),qe(a,1),a.m(l.parentNode,l))},i(m){c||(qe(a),c=!0)},o(m){nt(a),c=!1},d(m){d[r].d(m),m&&te(l)}}}function Jk(o){let r,a;return r=new Oa({props:{title:"Population",$$slots:{default:[Xk]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,[c]){const f={};c&3&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function Yk(o,r,a){let{data:l}=r;return o.$$set=c=>{"data"in c&&a(0,l=c.data)},[l]}class Qk extends Wr{constructor(r){super(),Kr(this,r,Yk,Jk,jr,{data:0})}}function eS(o){let r,a,l,c,f=`translateX(${o[3]/o[1]+(o[1]-o[4])}px)`,d,n=`${o[2]}px`,m=`${o[4]}px`;return{c(){r=Ne("div"),a=zt(o[0]),l=Et(),c=Ne("div"),this.h()},l(b){r=Ue(b,"DIV",{class:!0});var w=He(r);a=Mt(w,o[0]),l=kt(w),c=Ue(w,"DIV",{class:!0}),He(c).forEach(te),w.forEach(te),this.h()},h(){_e(c,"class","caret svelte-1491tb3"),It(c,"transform",f),_e(r,"class","tooltip svelte-1491tb3"),c_(()=>o[6].call(r)),It(r,"top",n),It(r,"left",m)},m(b,w){Be(b,r,w),Pe(r,a),Pe(r,l),Pe(r,c),d=u_(r,o[6].bind(r))},p(b,[w]){w&1&&kr(a,b[0]),w&26&&f!==(f=`translateX(${b[3]/b[1]+(b[1]-b[4])}px)`)&&It(c,"transform",f),w&4&&n!==(n=`${b[2]}px`)&&It(r,"top",n),w&16&&m!==(m=`${b[4]}px`)&&It(r,"left",m)},i:_r,o:_r,d(b){b&&te(r),d()}}}const wu=4;function tS(o,r,a){let l,{title:c}=r,{x:f}=r,{y:d}=r,{width:n}=r,m;function b(){m=this.clientWidth,a(3,m)}return o.$$set=w=>{"title"in w&&a(0,c=w.title),"x"in w&&a(1,f=w.x),"y"in w&&a(2,d=w.y),"width"in w&&a(5,n=w.width)},o.$$.update=()=>{o.$$.dirty&42&&a(4,l=m&&f+m/2>n-wu?n-m/2-wu:m&&f-m/2<0+wu?m/2+wu:f)},[c,f,d,m,l,n,b]}class rS extends Wr{constructor(r){super(),Kr(this,r,tS,eS,jr,{title:0,x:1,y:2,width:5})}}function iS(o){let r,a;function l(f){r=o.getAttribute("title"),o.removeAttribute("title");let d=document.body.getBoundingClientRect(),n=o.getBoundingClientRect(),m=n.bottom,b=(n.left+n.right)/2;a=new rS({props:{title:r,x:b,y:m-d.y,width:d.width},target:document.body})}function c(){a.$destroy(),o.setAttribute("title",r)}return o.addEventListener("mouseover",l),o.addEventListener("mouseout",c),{destroy(){a&&a.$destroy(),o.removeEventListener("mouseover",l),o.removeEventListener("mouseout",c)}}}function Rg(o,r,a){const l=o.slice();return l[20]=r[a],l[22]=a,l}function Lg(o,r,a){const l=o.slice();return l[23]=r[a],l[25]=a,l}function Bg(o,r,a){const l=o.slice();return l[23]=r[a],l[25]=a,l}function Og(o,r,a){const l=o.slice();return l[27]=r[a],l[22]=a,l}function Fg(o){let r,a=o[12],l=[];for(let c=0;c1?` (${o[2](o[10][o[22]+1].values[o[25]][o[1]])}%)`:"")),_e(r,"class","bar svelte-clbyb4"),It(r,"bottom","0"),It(r,"height",l),It(r,"left",c),It(r,"width",f)},m(m,b){Be(m,r,b),d||(n=p_(iS.call(null,r)),d=!0)},p(m,b){b&1031&&a!==(a=`${m[23][m[0]]}: ${m[2](m[23][m[1]])}%`+(m[10].length>1?` (${m[2](m[10][m[22]+1].values[m[25]][m[1]])}%)`:""))&&_e(r,"title",a),b&3074&&l!==(l=`${m[11](m[23][m[1]])}%`)&&It(r,"height",l),b&8192&&c!==(c=`calc(${m[25]/m[13].length*100}%)`)&&It(r,"left",c),b&8192&&f!==(f=`calc(${1/m[13].length*100}% - 2px)`)&&It(r,"width",f)},d(m){m&&te(r),d=!1,n()}}}function $g(o){let r;function a(f,d){return f[22]==0?aS:nS}let c=a(o)(o);return{c(){c.c(),r=er()},l(f){c.l(f),r=er()},m(f,d){c.m(f,d),Be(f,r,d)},p(f,d){c.p(f,d)},d(f){c.d(f),f&&te(r)}}}function jg(o){let r,a,l=o[6][0]!=0&&qg(o),c=o[6][1]!=18&&Gg(o);return{c(){l&&l.c(),r=Et(),c&&c.c(),a=er()},l(f){l&&l.l(f),r=kt(f),c&&c.l(f),a=er()},m(f,d){l&&l.m(f,d),Be(f,r,d),c&&c.m(f,d),Be(f,a,d)},p(f,d){f[6][0]!=0?l?l.p(f,d):(l=qg(f),l.c(),l.m(r.parentNode,r)):l&&(l.d(1),l=null),f[6][1]!=18?c?c.p(f,d):(c=Gg(f),c.c(),c.m(a.parentNode,a)):c&&(c.d(1),c=null)},d(f){l&&l.d(f),f&&te(r),c&&c.d(f),f&&te(a)}}}function qg(o){let r,a=`${o[15](o[10])}%`;return{c(){r=Ne("div"),this.h()},l(l){r=Ue(l,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","mask svelte-clbyb4"),It(r,"bottom","0"),It(r,"height",a),It(r,"left","0"),It(r,"width",o[14](o[6][0]))},m(l,c){Be(l,r,c)},p(l,c){c&1024&&a!==(a=`${l[15](l[10])}%`)&&It(r,"height",a),c&64&&It(r,"width",l[14](l[6][0]))},d(l){l&&te(r)}}}function Gg(o){let r,a=`${o[15](o[10])}%`;return{c(){r=Ne("div"),this.h()},l(l){r=Ue(l,"DIV",{class:!0}),He(r).forEach(te),this.h()},h(){_e(r,"class","mask svelte-clbyb4"),It(r,"bottom","0"),It(r,"height",a),It(r,"left",o[14](o[6][1])),It(r,"right","2px")},m(l,c){Be(l,r,c)},p(l,c){c&1024&&a!==(a=`${l[15](l[10])}%`)&&It(r,"height",a),c&64&&It(r,"left",l[14](l[6][1]))},d(l){l&&te(r)}}}function Zg(o){let r,a,l;return{c(){r=Ne("small"),a=zt(o[7]),l=zt(o[8]),this.h()},l(c){r=Ue(c,"SMALL",{class:!0});var f=He(r);a=Mt(f,o[7]),l=Mt(f,o[8]),f.forEach(te),this.h()},h(){_e(r,"class","svelte-clbyb4")},m(c,f){Be(c,r,f),Pe(r,a),Pe(r,l)},p(c,f){f&128&&kr(a,c[7]),f&256&&kr(l,c[8])},d(c){c&&te(r)}}}function sS(o){let r,a,l,c=`${o[3]}px`,f,d,n,m=o[5][0]+"",b,w,S,k=o[5][1]+"",A,P,T,L=o[9]&&o[12][1]&&Fg(o),D=o[10],B=[];for(let Y=0;Yre.toFixed(1)}=r,{height:A=100}=r,{markerWidth:P=2.5}=r,{minmax:T=["0 years","85+"]}=r,{maskRange:L=null}=r,{base:D=null}=r,{base_ext:B=", 5 year age bands"}=r,{showLegend:$=!0}=r;function J(re,ce){let ye={};for(const _t of re)ye[_t[ce]]||(ye[_t[ce]]={label:_t[ce],values:[]}),ye[_t[ce]].values.push(_t);let Ae=[];for(const _t in ye)Ae.push(ye[_t]);return Ae}function Y(re){return re%1===0?`calc(${re/l.length*100}% - 1px)`:`calc(${Math.floor(re)/l.length*100}% +(${1/l.length*100}% - 2px) * ${re%1})`}function ae(re){return Math.max(...re.map(ce=>Math.max(...ce.values.map(ye=>d(ye[w])))))}return o.$$set=re=>{"data"in re&&a(16,m=re.data),"xKey"in re&&a(0,b=re.xKey),"yKey"in re&&a(1,w=re.yKey),"zKey"in re&&a(17,S=re.zKey),"formatTick"in re&&a(2,k=re.formatTick),"height"in re&&a(3,A=re.height),"markerWidth"in re&&a(4,P=re.markerWidth),"minmax"in re&&a(5,T=re.minmax),"maskRange"in re&&a(6,L=re.maskRange),"base"in re&&a(7,D=re.base),"base_ext"in re&&a(8,B=re.base_ext),"showLegend"in re&&a(9,$=re.showLegend)},o.$$.update=()=>{o.$$.dirty&65537&&a(13,l=m.map(re=>re[b]).filter((re,ce,ye)=>ye.indexOf(re)===ce)),o.$$.dirty&65538&&a(18,c=[0,Math.max(...m.map(re=>re[w]))]),o.$$.dirty&196608&&a(12,f=m.map(re=>re[S]).filter((re,ce,ye)=>ye.indexOf(re)===ce)),o.$$.dirty&262144&&a(11,d=re=>Math.abs(re/c[1])*100),o.$$.dirty&196608&&a(10,n=J(m,S))},[b,w,k,A,P,T,L,D,B,$,n,d,f,l,Y,ae,m,S,c]}class lS extends Wr{constructor(r){super(),Kr(this,r,oS,sS,jr,{data:16,xKey:0,yKey:1,zKey:17,formatTick:2,height:3,markerWidth:4,minmax:5,maskRange:6,base:7,base_ext:8,showLegend:9})}}function cS(o){let r,a;return r=new lS({props:{data:o[0].selected&&Bu("residents","resident_age_18b",o[0]),zKey:"group",maskRange:Bm(o[1]),base:"% of all people",showLegend:!1}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c&1&&(f.data=l[0].selected&&Bu("residents","resident_age_18b",l[0])),c&2&&(f.maskRange=Bm(l[1])),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function uS(o){let r,a=tc.nodata+"",l;return{c(){r=Ne("span"),l=zt(a),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,a),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-uj0r62")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function hS(o){let r,a=tc.nodata+"",l;return{c(){r=Ne("span"),l=zt(a),this.h()},l(c){r=Ue(c,"SPAN",{class:!0});var f=He(r);l=Mt(f,a),f.forEach(te),this.h()},h(){_e(r,"class","num-desc svelte-uj0r62")},m(c,f){Be(c,r,f),Pe(r,l)},p:_r,i:_r,o:_r,d(c){c&&te(r)}}}function fS(o){let r,a,l,c;const f=[hS,uS,cS],d=[];function n(m,b){return m[0].selected.residents.resident_age_18b.values==="blocked"?0:m[0].selected.residents.resident_age_18b.values.percent[0]==null?1:2}return r=n(o),a=d[r]=f[r](o),{c(){a.c(),l=er()},l(m){a.l(m),l=er()},m(m,b){d[r].m(m,b),Be(m,l,b),c=!0},p(m,b){let w=r;r=n(m),r===w?d[r].p(m,b):(Nr(),nt(d[w],1,1,()=>{d[w]=null}),Ur(),a=d[r],a?a.p(m,b):(a=d[r]=f[r](m),a.c()),qe(a,1),a.m(l.parentNode,l))},i(m){c||(qe(a),c=!0)},o(m){nt(a),c=!1},d(m){d[r].d(m),m&&te(l)}}}function dS(o){let r,a;return r=new Oa({props:{title:"Age profile",$$slots:{default:[fS]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,[c]){const f={};c&7&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function pS(o,r,a){let{data:l}=r,{selected:c}=r;return o.$$set=f=>{"data"in f&&a(0,l=f.data),"selected"in f&&a(1,c=f.selected)},[l,c]}class mS extends Wr{constructor(r){super(),Kr(this,r,pS,dS,jr,{data:0,selected:1})}}function gS(o,r,a){const l=o.slice();return l[2]=r[a],l[4]=a,l}function _S(o){let r,a,l,c,f,d;return{c(){r=Ne("li"),a=Ne("div"),l=Et(),c=Ne("span"),f=zt(o[2]),d=Et(),this.h()},l(n){r=Ue(n,"LI",{class:!0});var m=He(r);a=Ue(m,"DIV",{class:!0}),He(a).forEach(te),l=kt(m),c=Ue(m,"SPAN",{class:!0});var b=He(c);f=Mt(b,o[2]),b.forEach(te),d=kt(m),m.forEach(te),this.h()},h(){_e(a,"class","legend-vis "+(o[4]==0?"bar":"marker")+" svelte-npejzx"),_e(c,"class",o[4]==0?"bold":"brackets"),_e(r,"class","svelte-npejzx"),Ht(r,"ew",o[4]!=0)},m(n,m){Be(n,r,m),Pe(r,a),Pe(r,l),Pe(r,c),Pe(c,f),Pe(r,d)},p:_r,d(n){n&&te(r)}}}function yS(o){let r,a,l,c;const f=o[1].default,d=Di(f,o,o[0],null);let n=["People with the selected characteristics","All people in England and Wales"],m=[];for(let b=0;b<2;b+=1)m[b]=_S(gS(o,n,b));return{c(){r=Ne("p"),d&&d.c(),a=Et(),l=Ne("ul");for(let b=0;b<2;b+=1)m[b].c();this.h()},l(b){r=Ue(b,"P",{class:!0});var w=He(r);d&&d.l(w),w.forEach(te),a=kt(b),l=Ue(b,"UL",{class:!0});var S=He(l);for(let k=0;k<2;k+=1)m[k].l(S);S.forEach(te),this.h()},h(){_e(r,"class","legend-text svelte-npejzx"),_e(l,"class","legend-block svelte-npejzx")},m(b,w){Be(b,r,w),d&&d.m(r,null),Be(b,a,w),Be(b,l,w);for(let S=0;S<2;S+=1)m[S]&&m[S].m(l,null);c=!0},p(b,[w]){d&&d.p&&(!c||w&1)&&Ri(d,f,b,b[0],c?Bi(f,b[0],w,null):Li(b[0]),null)},i(b){c||(qe(d,b),c=!0)},o(b){nt(d,b),c=!1},d(b){b&&te(r),d&&d.d(b),b&&te(a),b&&te(l),Ui(m,b)}}}function vS(o,r,a){let{$$slots:l={},$$scope:c}=r;return o.$$set=f=>{"$$scope"in f&&a(0,c=f.$$scope)},[c,l]}class vy extends Wr{constructor(r){super(),Kr(this,r,vS,yS,jr,{})}}function bS(o){let r,a,l,c,f=(o[0]?"Close panel":o[1])+"",d,n,m,b,w,S,k;const A=o[3].default,P=Di(A,o,o[2],null);return{c(){r=Ne("details"),a=Ne("summary"),l=Ne("h3"),c=Ne("span"),d=zt(f),m=Et(),b=Ne("div"),P&&P.c(),this.h()},l(T){r=Ue(T,"DETAILS",{class:!0});var L=He(r);a=Ue(L,"SUMMARY",{class:!0,"data-ga-action":!0});var D=He(a);l=Ue(D,"H3",{class:!0});var B=He(l);c=Ue(B,"SPAN",{class:!0});var $=He(c);d=Mt($,f),$.forEach(te),B.forEach(te),D.forEach(te),m=kt(L),b=Ue(L,"DIV",{class:!0});var J=He(b);P&&P.l(J),J.forEach(te),L.forEach(te),this.h()},h(){_e(c,"class","ons-btn__inner"),_e(l,"class","ons-btn"),Ht(l,"ons-btn--secondary",o[0]),_e(a,"class","ons-collapsible__heading ons-js-collapsible-heading svelte-1x2xth5"),_e(a,"data-ga-action",n=o[0]?"Close panel":"Open panel"),_e(b,"class","ons-collapsible__content ons-js-collapsible-content svelte-1x2xth5"),_e(r,"class","ons-collapsible ons-js-collapsible svelte-1x2xth5")},m(T,L){Be(T,r,L),Pe(r,a),Pe(a,l),Pe(l,c),Pe(c,d),Pe(r,m),Pe(r,b),P&&P.m(b,null),r.open=o[0],w=!0,S||(k=ba(r,"toggle",o[4]),S=!0)},p(T,[L]){(!w||L&3)&&f!==(f=(T[0]?"Close panel":T[1])+"")&&kr(d,f),(!w||L&1)&&Ht(l,"ons-btn--secondary",T[0]),(!w||L&1&&n!==(n=T[0]?"Close panel":"Open panel"))&&_e(a,"data-ga-action",n),P&&P.p&&(!w||L&4)&&Ri(P,A,T,T[2],w?Bi(A,T[2],L,null):Li(T[2]),null),L&1&&(r.open=T[0])},i(T){w||(qe(P,T),w=!0)},o(T){nt(P,T),w=!1},d(T){T&&te(r),P&&P.d(T),S=!1,k()}}}function xS(o,r,a){let{$$slots:l={},$$scope:c}=r,{title:f="Title"}=r,{open:d=!1}=r;function n(){d=this.open,a(0,d)}return o.$$set=m=>{"title"in m&&a(1,f=m.title),"open"in m&&a(0,d=m.open),"$$scope"in m&&a(2,c=m.$$scope)},[d,f,c,l,n]}class wS extends Wr{constructor(r){super(),Kr(this,r,xS,bS,jr,{title:1,open:0})}}function Eu(o){throw new Error('Could not dynamically require "'+o+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var by={exports:{}};/*! JSZip v3.10.1 - A JavaScript class for generating and reading zip files @@ -1017,29 +1008,29 @@ Dual licenced under the MIT license or GPLv3. See https://raw.github.com/Stuk/js JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE -*/(function(o,r){(function(s){o.exports=s()})(function(){return function s(l,c,f){function d(b,w){if(!c[b]){if(!l[b]){var S=typeof Eu=="function"&&Eu;if(!w&&S)return S(b,!0);if(n)return n(b,!0);var k=new Error("Cannot find module '"+b+"'");throw k.code="MODULE_NOT_FOUND",k}var A=c[b]={exports:{}};l[b][0].call(A.exports,function(P){var T=l[b][1][P];return d(T||P)},A,A.exports,s,l,c,f)}return c[b].exports}for(var n=typeof Eu=="function"&&Eu,m=0;m>2,A=(3&b)<<4|w>>4,P=1<$?(15&w)<<2|S>>6:64,T=2<$?63&S:64,L.push(n.charAt(k)+n.charAt(A)+n.charAt(P)+n.charAt(T));return L.join("")},c.decode=function(m){var b,w,S,k,A,P,T=0,L=0,D="data:";if(m.substr(0,D.length)===D)throw new Error("Invalid base64 input, it looks like a data url.");var B,$=3*(m=m.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(m.charAt(m.length-1)===n.charAt(64)&&$--,m.charAt(m.length-2)===n.charAt(64)&&$--,$%1!=0)throw new Error("Invalid base64 input, bad content length.");for(B=d.uint8array?new Uint8Array(0|$):new Array(0|$);T>4,w=(15&k)<<4|(A=n.indexOf(m.charAt(T++)))>>2,S=(3&A)<<6|(P=n.indexOf(m.charAt(T++))),B[L++]=b,A!==64&&(B[L++]=w),P!==64&&(B[L++]=S);return B}},{"./support":30,"./utils":32}],2:[function(s,l,c){var f=s("./external"),d=s("./stream/DataWorker"),n=s("./stream/Crc32Probe"),m=s("./stream/DataLengthProbe");function b(w,S,k,A,P){this.compressedSize=w,this.uncompressedSize=S,this.crc32=k,this.compression=A,this.compressedContent=P}b.prototype={getContentWorker:function(){var w=new d(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new m("data_length")),S=this;return w.on("end",function(){if(this.streamInfo.data_length!==S.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),w},getCompressedWorker:function(){return new d(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},b.createWorkerFrom=function(w,S,k){return w.pipe(new n).pipe(new m("uncompressedSize")).pipe(S.compressWorker(k)).pipe(new m("compressedSize")).withStreamInfo("compression",S)},l.exports=b},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(s,l,c){var f=s("./stream/GenericWorker");c.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},c.DEFLATE=s("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(s,l,c){var f=s("./utils"),d=function(){for(var n,m=[],b=0;b<256;b++){n=b;for(var w=0;w<8;w++)n=1&n?3988292384^n>>>1:n>>>1;m[b]=n}return m}();l.exports=function(n,m){return n!==void 0&&n.length?f.getTypeOf(n)!=="string"?function(b,w,S,k){var A=d,P=k+S;b^=-1;for(var T=k;T>>8^A[255&(b^w[T])];return-1^b}(0|m,n,n.length,0):function(b,w,S,k){var A=d,P=k+S;b^=-1;for(var T=k;T>>8^A[255&(b^w.charCodeAt(T))];return-1^b}(0|m,n,n.length,0):0}},{"./utils":32}],5:[function(s,l,c){c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!0,c.date=null,c.compression=null,c.compressionOptions=null,c.comment=null,c.unixPermissions=null,c.dosPermissions=null},{}],6:[function(s,l,c){var f=null;f=typeof Promise<"u"?Promise:s("lie"),l.exports={Promise:f}},{lie:37}],7:[function(s,l,c){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",d=s("pako"),n=s("./utils"),m=s("./stream/GenericWorker"),b=f?"uint8array":"array";function w(S,k){m.call(this,"FlateWorker/"+S),this._pako=null,this._pakoAction=S,this._pakoOptions=k,this.meta={}}c.magic="\b\0",n.inherits(w,m),w.prototype.processChunk=function(S){this.meta=S.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(b,S.data),!1)},w.prototype.flush=function(){m.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},w.prototype.cleanUp=function(){m.prototype.cleanUp.call(this),this._pako=null},w.prototype._createPako=function(){this._pako=new d[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var S=this;this._pako.onData=function(k){S.push({data:k,meta:S.meta})}},c.compressWorker=function(S){return new w("Deflate",S)},c.uncompressWorker=function(){return new w("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(s,l,c){function f(A,P){var T,L="";for(T=0;T>>=8;return L}function d(A,P,T,L,D,B){var $,J,Y=A.file,se=A.compression,re=B!==b.utf8encode,ce=n.transformTo("string",B(Y.name)),ye=n.transformTo("string",b.utf8encode(Y.name)),Ae=Y.comment,_t=n.transformTo("string",B(Ae)),le=n.transformTo("string",b.utf8encode(Ae)),We=ye.length!==Y.name.length,Z=le.length!==Ae.length,$e="",ct="",rt="",$t=Y.dir,it=Y.date,et={crc32:0,compressedSize:0,uncompressedSize:0};P&&!T||(et.crc32=A.crc32,et.compressedSize=A.compressedSize,et.uncompressedSize=A.uncompressedSize);var oe=0;P&&(oe|=8),re||!We&&!Z||(oe|=2048);var ge=0,Me=0;$t&&(ge|=16),D==="UNIX"?(Me=798,ge|=function(ue,Je){var wt=ue;return ue||(wt=Je?16893:33204),(65535&wt)<<16}(Y.unixPermissions,$t)):(Me=20,ge|=function(ue){return 63&(ue||0)}(Y.dosPermissions)),$=it.getUTCHours(),$<<=6,$|=it.getUTCMinutes(),$<<=5,$|=it.getUTCSeconds()/2,J=it.getUTCFullYear()-1980,J<<=4,J|=it.getUTCMonth()+1,J<<=5,J|=it.getUTCDate(),We&&(ct=f(1,1)+f(w(ce),4)+ye,$e+="up"+f(ct.length,2)+ct),Z&&(rt=f(1,1)+f(w(_t),4)+le,$e+="uc"+f(rt.length,2)+rt);var ee="";return ee+=` -\0`,ee+=f(oe,2),ee+=se.magic,ee+=f($,2),ee+=f(J,2),ee+=f(et.crc32,4),ee+=f(et.compressedSize,4),ee+=f(et.uncompressedSize,4),ee+=f(ce.length,2),ee+=f($e.length,2),{fileRecord:S.LOCAL_FILE_HEADER+ee+ce+$e,dirRecord:S.CENTRAL_FILE_HEADER+f(Me,2)+ee+f(_t.length,2)+"\0\0\0\0"+f(ge,4)+f(L,4)+ce+$e+_t}}var n=s("../utils"),m=s("../stream/GenericWorker"),b=s("../utf8"),w=s("../crc32"),S=s("../signature");function k(A,P,T,L){m.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=T,this.encodeFileName=L,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(k,m),k.prototype.push=function(A){var P=A.meta.percent||0,T=this.entriesCount,L=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,m.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:T?(P+100*(T-L-1))/T:100}}))},k.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var T=d(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:T.fileRecord,meta:{percent:0}})}else this.accumulate=!0},k.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,T=d(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(T.dirRecord),P)this.push({data:function(L){return S.DATA_DESCRIPTOR+f(L.crc32,4)+f(L.compressedSize,4)+f(L.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:T.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},k.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;m--)b=(b<<8)+this.byteAt(m);return this.index+=n,b},readString:function(n){return f.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},l.exports=d},{"../utils":32}],19:[function(s,l,c){var f=s("./Uint8ArrayReader");function d(n){f.call(this,n)}s("../utils").inherits(d,f),d.prototype.readData=function(n){this.checkOffset(n);var m=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,m},l.exports=d},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(s,l,c){var f=s("./DataReader");function d(n){f.call(this,n)}s("../utils").inherits(d,f),d.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},d.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},d.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},d.prototype.readData=function(n){this.checkOffset(n);var m=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,m},l.exports=d},{"../utils":32,"./DataReader":18}],21:[function(s,l,c){var f=s("./ArrayReader");function d(n){f.call(this,n)}s("../utils").inherits(d,f),d.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var m=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,m},l.exports=d},{"../utils":32,"./ArrayReader":17}],22:[function(s,l,c){var f=s("../utils"),d=s("../support"),n=s("./ArrayReader"),m=s("./StringReader"),b=s("./NodeBufferReader"),w=s("./Uint8ArrayReader");l.exports=function(S){var k=f.getTypeOf(S);return f.checkSupport(k),k!=="string"||d.uint8array?k==="nodebuffer"?new b(S):d.uint8array?new w(f.transformTo("uint8array",S)):new n(f.transformTo("array",S)):new m(S)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(s,l,c){c.LOCAL_FILE_HEADER="PK",c.CENTRAL_FILE_HEADER="PK",c.CENTRAL_DIRECTORY_END="PK",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",c.ZIP64_CENTRAL_DIRECTORY_END="PK",c.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(s,l,c){var f=s("./GenericWorker"),d=s("../utils");function n(m){f.call(this,"ConvertWorker to "+m),this.destType=m}d.inherits(n,f),n.prototype.processChunk=function(m){this.push({data:d.transformTo(this.destType,m.data),meta:m.meta})},l.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(s,l,c){var f=s("./GenericWorker"),d=s("../crc32");function n(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}s("../utils").inherits(n,f),n.prototype.processChunk=function(m){this.streamInfo.crc32=d(m.data,this.streamInfo.crc32||0),this.push(m)},l.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(s,l,c){var f=s("../utils"),d=s("./GenericWorker");function n(m){d.call(this,"DataLengthProbe for "+m),this.propName=m,this.withStreamInfo(m,0)}f.inherits(n,d),n.prototype.processChunk=function(m){if(m){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+m.data.length}d.prototype.processChunk.call(this,m)},l.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(s,l,c){var f=s("../utils"),d=s("./GenericWorker");function n(m){d.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,m.then(function(w){b.dataIsReady=!0,b.data=w,b.max=w&&w.length||0,b.type=f.getTypeOf(w),b.isPaused||b._tickAndRepeat()},function(w){b.error(w)})}f.inherits(n,d),n.prototype.cleanUp=function(){d.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!d.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var m=null,b=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":m=this.data.substring(this.index,b);break;case"uint8array":m=this.data.subarray(this.index,b);break;case"array":case"nodebuffer":m=this.data.slice(this.index,b)}return this.index=b,this.push({data:m,meta:{percent:this.max?this.index/this.max*100:0}})},l.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(s,l,c){function f(d){this.name=d||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(d){this.emit("data",d)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(d){this.emit("error",d)}return!0},error:function(d){return!this.isFinished&&(this.isPaused?this.generatedError=d:(this.isFinished=!0,this.emit("error",d),this.previous&&this.previous.error(d),this.cleanUp()),!0)},on:function(d,n){return this._listeners[d].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(d,n){if(this._listeners[d])for(var m=0;m "+d:d}},l.exports=f},{}],29:[function(s,l,c){var f=s("../utils"),d=s("./ConvertWorker"),n=s("./GenericWorker"),m=s("../base64"),b=s("../support"),w=s("../external"),S=null;if(b.nodestream)try{S=s("../nodejs/NodejsStreamOutputAdapter")}catch{}function k(P,T){return new w.Promise(function(L,D){var B=[],$=P._internalType,J=P._outputType,Y=P._mimeType;P.on("data",function(se,re){B.push(se),T&&T(re)}).on("error",function(se){B=[],D(se)}).on("end",function(){try{var se=function(re,ce,ye){switch(re){case"blob":return f.newBlob(f.transformTo("arraybuffer",ce),ye);case"base64":return m.encode(ce);default:return f.transformTo(re,ce)}}(J,function(re,ce){var ye,Ae=0,_t=null,le=0;for(ye=0;ye"u")c.blob=!1;else{var f=new ArrayBuffer(0);try{c.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var d=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);d.append(f),c.blob=d.getBlob("application/zip").size===0}catch{c.blob=!1}}}try{c.nodestream=!!s("readable-stream").Readable}catch{c.nodestream=!1}},{"readable-stream":16}],31:[function(s,l,c){for(var f=s("./utils"),d=s("./support"),n=s("./nodejsUtils"),m=s("./stream/GenericWorker"),b=new Array(256),w=0;w<256;w++)b[w]=252<=w?6:248<=w?5:240<=w?4:224<=w?3:192<=w?2:1;b[254]=b[254]=1;function S(){m.call(this,"utf-8 decode"),this.leftOver=null}function k(){m.call(this,"utf-8 encode")}c.utf8encode=function(A){return d.nodebuffer?n.newBufferFrom(A,"utf-8"):function(P){var T,L,D,B,$,J=P.length,Y=0;for(B=0;B>>6:(L<65536?T[$++]=224|L>>>12:(T[$++]=240|L>>>18,T[$++]=128|L>>>12&63),T[$++]=128|L>>>6&63),T[$++]=128|63&L);return T}(A)},c.utf8decode=function(A){return d.nodebuffer?f.transformTo("nodebuffer",A).toString("utf-8"):function(P){var T,L,D,B,$=P.length,J=new Array(2*$);for(T=L=0;T<$;)if((D=P[T++])<128)J[L++]=D;else if(4<(B=b[D]))J[L++]=65533,T+=B-1;else{for(D&=B===2?31:B===3?15:7;1>10&1023,J[L++]=56320|1023&D)}return J.length!==L&&(J.subarray?J=J.subarray(0,L):J.length=L),f.applyFromCharCode(J)}(A=f.transformTo(d.uint8array?"uint8array":"array",A))},f.inherits(S,m),S.prototype.processChunk=function(A){var P=f.transformTo(d.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(d.uint8array){var T=P;(P=new Uint8Array(T.length+this.leftOver.length)).set(this.leftOver,0),P.set(T,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var L=function(B,$){var J;for(($=$||B.length)>B.length&&($=B.length),J=$-1;0<=J&&(192&B[J])==128;)J--;return J<0||J===0?$:J+b[B[J]]>$?J:$}(P),D=P;L!==P.length&&(d.uint8array?(D=P.subarray(0,L),this.leftOver=P.subarray(L,P.length)):(D=P.slice(0,L),this.leftOver=P.slice(L,P.length))),this.push({data:c.utf8decode(D),meta:A.meta})},S.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:c.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},c.Utf8DecodeWorker=S,f.inherits(k,m),k.prototype.processChunk=function(A){this.push({data:c.utf8encode(A.data),meta:A.meta})},c.Utf8EncodeWorker=k},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(s,l,c){var f=s("./support"),d=s("./base64"),n=s("./nodejsUtils"),m=s("./external");function b(T){return T}function w(T,L){for(var D=0;D>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=f(this.extraFields[1].value);this.uncompressedSize===d.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===d.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===d.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===d.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,T,L,D=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?k[L++]=224|A>>>12:(k[L++]=240|A>>>18,k[L++]=128|A>>>12&63),k[L++]=128|A>>>6&63),k[L++]=128|63&A);return k},c.buf2binstring=function(S){return w(S,S.length)},c.binstring2buf=function(S){for(var k=new f.Buf8(S.length),A=0,P=k.length;A>10&1023,B[P++]=56320|1023&T)}return w(B,P)},c.utf8border=function(S,k){var A;for((k=k||S.length)>S.length&&(k=S.length),A=k-1;0<=A&&(192&S[A])==128;)A--;return A<0||A===0?k:A+m[S[A]]>k?A:k}},{"./common":41}],43:[function(s,l,c){l.exports=function(f,d,n,m){for(var b=65535&f|0,w=f>>>16&65535|0,S=0;n!==0;){for(n-=S=2e3>>1:d>>>1;n[m]=d}return n}();l.exports=function(d,n,m,b){var w=f,S=b+m;d^=-1;for(var k=b;k>>8^w[255&(d^n[k])];return-1^d}},{}],46:[function(s,l,c){var f,d=s("../utils/common"),n=s("./trees"),m=s("./adler32"),b=s("./crc32"),w=s("./messages"),S=0,k=4,A=0,P=-2,T=-1,L=4,D=2,B=8,$=9,J=286,Y=30,se=19,re=2*J+1,ce=15,ye=3,Ae=258,_t=Ae+ye+1,le=42,We=113,Z=1,$e=2,ct=3,rt=4;function $t(H,ut){return H.msg=w[ut],ut}function it(H){return(H<<1)-(4H.avail_out&&(tt=H.avail_out),tt!==0&&(d.arraySet(H.output,ut.pending_buf,ut.pending_out,tt,H.next_out),H.next_out+=tt,ut.pending_out+=tt,H.total_out+=tt,H.avail_out-=tt,ut.pending-=tt,ut.pending===0&&(ut.pending_out=0))}function ge(H,ut){n._tr_flush_block(H,0<=H.block_start?H.block_start:-1,H.strstart-H.block_start,ut),H.block_start=H.strstart,oe(H.strm)}function Me(H,ut){H.pending_buf[H.pending++]=ut}function ee(H,ut){H.pending_buf[H.pending++]=ut>>>8&255,H.pending_buf[H.pending++]=255&ut}function ue(H,ut){var tt,be,pe=H.max_chain_length,Ie=H.strstart,dt=H.prev_length,mt=H.nice_match,je=H.strstart>H.w_size-_t?H.strstart-(H.w_size-_t):0,vt=H.window,Ot=H.w_mask,St=H.prev,Wt=H.strstart+Ae,wr=vt[Ie+dt-1],Fe=vt[Ie+dt];H.prev_length>=H.good_match&&(pe>>=2),mt>H.lookahead&&(mt=H.lookahead);do if(vt[(tt=ut)+dt]===Fe&&vt[tt+dt-1]===wr&&vt[tt]===vt[Ie]&&vt[++tt]===vt[Ie+1]){Ie+=2,tt++;do;while(vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&Ieje&&--pe!=0);return dt<=H.lookahead?dt:H.lookahead}function Je(H){var ut,tt,be,pe,Ie,dt,mt,je,vt,Ot,St=H.w_size;do{if(pe=H.window_size-H.lookahead-H.strstart,H.strstart>=St+(St-_t)){for(d.arraySet(H.window,H.window,St,St,0),H.match_start-=St,H.strstart-=St,H.block_start-=St,ut=tt=H.hash_size;be=H.head[--ut],H.head[ut]=St<=be?be-St:0,--tt;);for(ut=tt=St;be=H.prev[--ut],H.prev[ut]=St<=be?be-St:0,--tt;);pe+=St}if(H.strm.avail_in===0)break;if(dt=H.strm,mt=H.window,je=H.strstart+H.lookahead,vt=pe,Ot=void 0,Ot=dt.avail_in,vt=ye)for(Ie=H.strstart-H.insert,H.ins_h=H.window[Ie],H.ins_h=(H.ins_h<=ye&&(H.ins_h=(H.ins_h<=ye)if(be=n._tr_tally(H,H.strstart-H.match_start,H.match_length-ye),H.lookahead-=H.match_length,H.match_length<=H.max_lazy_match&&H.lookahead>=ye){for(H.match_length--;H.strstart++,H.ins_h=(H.ins_h<=ye&&(H.ins_h=(H.ins_h<=ye&&H.match_length<=H.prev_length){for(pe=H.strstart+H.lookahead-ye,be=n._tr_tally(H,H.strstart-1-H.prev_match,H.prev_length-ye),H.lookahead-=H.prev_length-1,H.prev_length-=2;++H.strstart<=pe&&(H.ins_h=(H.ins_h<H.pending_buf_size-5&&(tt=H.pending_buf_size-5);;){if(H.lookahead<=1){if(Je(H),H.lookahead===0&&ut===S)return Z;if(H.lookahead===0)break}H.strstart+=H.lookahead,H.lookahead=0;var be=H.block_start+tt;if((H.strstart===0||H.strstart>=be)&&(H.lookahead=H.strstart-be,H.strstart=be,ge(H,!1),H.strm.avail_out===0)||H.strstart-H.block_start>=H.w_size-_t&&(ge(H,!1),H.strm.avail_out===0))return Z}return H.insert=0,ut===k?(ge(H,!0),H.strm.avail_out===0?ct:rt):(H.strstart>H.block_start&&(ge(H,!1),H.strm.avail_out),Z)}),new Xe(4,4,8,4,wt),new Xe(4,5,16,8,wt),new Xe(4,6,32,32,wt),new Xe(4,4,16,16,pt),new Xe(8,16,32,32,pt),new Xe(8,16,128,128,pt),new Xe(8,32,128,256,pt),new Xe(32,128,258,1024,pt),new Xe(32,258,258,4096,pt)],c.deflateInit=function(H,ut){return Vr(H,ut,B,15,8,0)},c.deflateInit2=Vr,c.deflateReset=Rr,c.deflateResetKeep=Qt,c.deflateSetHeader=function(H,ut){return H&&H.state?H.state.wrap!==2?P:(H.state.gzhead=ut,A):P},c.deflate=function(H,ut){var tt,be,pe,Ie;if(!H||!H.state||5>8&255),Me(be,be.gzhead.time>>16&255),Me(be,be.gzhead.time>>24&255),Me(be,be.level===9?2:2<=be.strategy||be.level<2?4:0),Me(be,255&be.gzhead.os),be.gzhead.extra&&be.gzhead.extra.length&&(Me(be,255&be.gzhead.extra.length),Me(be,be.gzhead.extra.length>>8&255)),be.gzhead.hcrc&&(H.adler=b(H.adler,be.pending_buf,be.pending,0)),be.gzindex=0,be.status=69):(Me(be,0),Me(be,0),Me(be,0),Me(be,0),Me(be,0),Me(be,be.level===9?2:2<=be.strategy||be.level<2?4:0),Me(be,3),be.status=We);else{var dt=B+(be.w_bits-8<<4)<<8;dt|=(2<=be.strategy||be.level<2?0:be.level<6?1:be.level===6?2:3)<<6,be.strstart!==0&&(dt|=32),dt+=31-dt%31,be.status=We,ee(be,dt),be.strstart!==0&&(ee(be,H.adler>>>16),ee(be,65535&H.adler)),H.adler=1}if(be.status===69)if(be.gzhead.extra){for(pe=be.pending;be.gzindex<(65535&be.gzhead.extra.length)&&(be.pending!==be.pending_buf_size||(be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),oe(H),pe=be.pending,be.pending!==be.pending_buf_size));)Me(be,255&be.gzhead.extra[be.gzindex]),be.gzindex++;be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),be.gzindex===be.gzhead.extra.length&&(be.gzindex=0,be.status=73)}else be.status=73;if(be.status===73)if(be.gzhead.name){pe=be.pending;do{if(be.pending===be.pending_buf_size&&(be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),oe(H),pe=be.pending,be.pending===be.pending_buf_size)){Ie=1;break}Ie=be.gzindexpe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),Ie===0&&(be.gzindex=0,be.status=91)}else be.status=91;if(be.status===91)if(be.gzhead.comment){pe=be.pending;do{if(be.pending===be.pending_buf_size&&(be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),oe(H),pe=be.pending,be.pending===be.pending_buf_size)){Ie=1;break}Ie=be.gzindexpe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),Ie===0&&(be.status=103)}else be.status=103;if(be.status===103&&(be.gzhead.hcrc?(be.pending+2>be.pending_buf_size&&oe(H),be.pending+2<=be.pending_buf_size&&(Me(be,255&H.adler),Me(be,H.adler>>8&255),H.adler=0,be.status=We)):be.status=We),be.pending!==0){if(oe(H),H.avail_out===0)return be.last_flush=-1,A}else if(H.avail_in===0&&it(ut)<=it(tt)&&ut!==k)return $t(H,-5);if(be.status===666&&H.avail_in!==0)return $t(H,-5);if(H.avail_in!==0||be.lookahead!==0||ut!==S&&be.status!==666){var mt=be.strategy===2?function(je,vt){for(var Ot;;){if(je.lookahead===0&&(Je(je),je.lookahead===0)){if(vt===S)return Z;break}if(je.match_length=0,Ot=n._tr_tally(je,0,je.window[je.strstart]),je.lookahead--,je.strstart++,Ot&&(ge(je,!1),je.strm.avail_out===0))return Z}return je.insert=0,vt===k?(ge(je,!0),je.strm.avail_out===0?ct:rt):je.last_lit&&(ge(je,!1),je.strm.avail_out===0)?Z:$e}(be,ut):be.strategy===3?function(je,vt){for(var Ot,St,Wt,wr,Fe=je.window;;){if(je.lookahead<=Ae){if(Je(je),je.lookahead<=Ae&&vt===S)return Z;if(je.lookahead===0)break}if(je.match_length=0,je.lookahead>=ye&&0je.lookahead&&(je.match_length=je.lookahead)}if(je.match_length>=ye?(Ot=n._tr_tally(je,1,je.match_length-ye),je.lookahead-=je.match_length,je.strstart+=je.match_length,je.match_length=0):(Ot=n._tr_tally(je,0,je.window[je.strstart]),je.lookahead--,je.strstart++),Ot&&(ge(je,!1),je.strm.avail_out===0))return Z}return je.insert=0,vt===k?(ge(je,!0),je.strm.avail_out===0?ct:rt):je.last_lit&&(ge(je,!1),je.strm.avail_out===0)?Z:$e}(be,ut):f[be.level].func(be,ut);if(mt!==ct&&mt!==rt||(be.status=666),mt===Z||mt===ct)return H.avail_out===0&&(be.last_flush=-1),A;if(mt===$e&&(ut===1?n._tr_align(be):ut!==5&&(n._tr_stored_block(be,0,0,!1),ut===3&&(et(be.head),be.lookahead===0&&(be.strstart=0,be.block_start=0,be.insert=0))),oe(H),H.avail_out===0))return be.last_flush=-1,A}return ut!==k?A:be.wrap<=0?1:(be.wrap===2?(Me(be,255&H.adler),Me(be,H.adler>>8&255),Me(be,H.adler>>16&255),Me(be,H.adler>>24&255),Me(be,255&H.total_in),Me(be,H.total_in>>8&255),Me(be,H.total_in>>16&255),Me(be,H.total_in>>24&255)):(ee(be,H.adler>>>16),ee(be,65535&H.adler)),oe(H),0=tt.w_size&&(Ie===0&&(et(tt.head),tt.strstart=0,tt.block_start=0,tt.insert=0),vt=new d.Buf8(tt.w_size),d.arraySet(vt,ut,Ot-tt.w_size,tt.w_size,0),ut=vt,Ot=tt.w_size),dt=H.avail_in,mt=H.next_in,je=H.input,H.avail_in=Ot,H.next_in=0,H.input=ut,Je(tt);tt.lookahead>=ye;){for(be=tt.strstart,pe=tt.lookahead-(ye-1);tt.ins_h=(tt.ins_h<>>=ye=ce>>>24,$-=ye,(ye=ce>>>16&255)===0)$e[w++]=65535&ce;else{if(!(16&ye)){if(!(64&ye)){ce=J[(65535&ce)+(B&(1<>>=ye,$-=ye),$<15&&(B+=Z[m++]<<$,$+=8,B+=Z[m++]<<$,$+=8),ce=Y[B&re];r:for(;;){if(B>>>=ye=ce>>>24,$-=ye,!(16&(ye=ce>>>16&255))){if(!(64&ye)){ce=Y[(65535&ce)+(B&(1<>>=ye,$-=ye,(ye=w-S)<_t){if(T<(ye=_t-ye)&&n.sane){f.msg="invalid distance too far back",n.mode=30;break e}if(We=D,(le=0)===L){if(le+=P-ye,ye>3,B&=(1<<($-=Ae<<3))-1,f.next_in=m,f.next_out=w,f.avail_in=m>>24&255)+(le>>>8&65280)+((65280&le)<<8)+((255&le)<<24)}function B(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function $(le){var We;return le&&le.state?(We=le.state,le.total_in=le.total_out=We.total=0,le.msg="",We.wrap&&(le.adler=1&We.wrap),We.mode=P,We.last=0,We.havedict=0,We.dmax=32768,We.head=null,We.hold=0,We.bits=0,We.lencode=We.lendyn=new f.Buf32(T),We.distcode=We.distdyn=new f.Buf32(L),We.sane=1,We.back=-1,k):A}function J(le){var We;return le&&le.state?((We=le.state).wsize=0,We.whave=0,We.wnext=0,$(le)):A}function Y(le,We){var Z,$e;return le&&le.state?($e=le.state,We<0?(Z=0,We=-We):(Z=1+(We>>4),We<48&&(We&=15)),We&&(We<8||15=rt.wsize?(f.arraySet(rt.window,We,Z-rt.wsize,rt.wsize,0),rt.wnext=0,rt.whave=rt.wsize):($e<(ct=rt.wsize-rt.wnext)&&(ct=$e),f.arraySet(rt.window,We,Z-$e,ct,rt.wnext),($e-=ct)?(f.arraySet(rt.window,We,Z-$e,$e,0),rt.wnext=$e,rt.whave=rt.wsize):(rt.wnext+=ct,rt.wnext===rt.wsize&&(rt.wnext=0),rt.whave>>8&255,Z.check=n(Z.check,Ie,2,0),ge=oe=0,Z.mode=2;break}if(Z.flags=0,Z.head&&(Z.head.done=!1),!(1&Z.wrap)||(((255&oe)<<8)+(oe>>8))%31){le.msg="incorrect header check",Z.mode=30;break}if((15&oe)!=8){le.msg="unknown compression method",Z.mode=30;break}if(ge-=4,H=8+(15&(oe>>>=4)),Z.wbits===0)Z.wbits=H;else if(H>Z.wbits){le.msg="invalid window size",Z.mode=30;break}Z.dmax=1<>8&1),512&Z.flags&&(Ie[0]=255&oe,Ie[1]=oe>>>8&255,Z.check=n(Z.check,Ie,2,0)),ge=oe=0,Z.mode=3;case 3:for(;ge<32;){if(it===0)break e;it--,oe+=$e[rt++]<>>8&255,Ie[2]=oe>>>16&255,Ie[3]=oe>>>24&255,Z.check=n(Z.check,Ie,4,0)),ge=oe=0,Z.mode=4;case 4:for(;ge<16;){if(it===0)break e;it--,oe+=$e[rt++]<>8),512&Z.flags&&(Ie[0]=255&oe,Ie[1]=oe>>>8&255,Z.check=n(Z.check,Ie,2,0)),ge=oe=0,Z.mode=5;case 5:if(1024&Z.flags){for(;ge<16;){if(it===0)break e;it--,oe+=$e[rt++]<>>8&255,Z.check=n(Z.check,Ie,2,0)),ge=oe=0}else Z.head&&(Z.head.extra=null);Z.mode=6;case 6:if(1024&Z.flags&&(it<(ue=Z.length)&&(ue=it),ue&&(Z.head&&(H=Z.head.extra_len-Z.length,Z.head.extra||(Z.head.extra=new Array(Z.head.extra_len)),f.arraySet(Z.head.extra,$e,rt,ue,H)),512&Z.flags&&(Z.check=n(Z.check,$e,ue,rt)),it-=ue,rt+=ue,Z.length-=ue),Z.length))break e;Z.length=0,Z.mode=7;case 7:if(2048&Z.flags){if(it===0)break e;for(ue=0;H=$e[rt+ue++],Z.head&&H&&Z.length<65536&&(Z.head.name+=String.fromCharCode(H)),H&&ue>9&1,Z.head.done=!0),le.adler=Z.check=0,Z.mode=12;break;case 10:for(;ge<32;){if(it===0)break e;it--,oe+=$e[rt++]<>>=7&ge,ge-=7&ge,Z.mode=27;break}for(;ge<3;){if(it===0)break e;it--,oe+=$e[rt++]<>>=1)){case 0:Z.mode=14;break;case 1:if(Ae(Z),Z.mode=20,We!==6)break;oe>>>=2,ge-=2;break e;case 2:Z.mode=17;break;case 3:le.msg="invalid block type",Z.mode=30}oe>>>=2,ge-=2;break;case 14:for(oe>>>=7&ge,ge-=7≥ge<32;){if(it===0)break e;it--,oe+=$e[rt++]<>>16^65535)){le.msg="invalid stored block lengths",Z.mode=30;break}if(Z.length=65535&oe,ge=oe=0,Z.mode=15,We===6)break e;case 15:Z.mode=16;case 16:if(ue=Z.length){if(it>>=5,ge-=5,Z.ndist=1+(31&oe),oe>>>=5,ge-=5,Z.ncode=4+(15&oe),oe>>>=4,ge-=4,286>>=3,ge-=3}for(;Z.have<19;)Z.lens[dt[Z.have++]]=0;if(Z.lencode=Z.lendyn,Z.lenbits=7,tt={bits:Z.lenbits},ut=b(0,Z.lens,0,19,Z.lencode,0,Z.work,tt),Z.lenbits=tt.bits,ut){le.msg="invalid code lengths set",Z.mode=30;break}Z.have=0,Z.mode=19;case 19:for(;Z.have>>16&255,Bt=65535&pe,!((pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>>=pt,ge-=pt,Z.lens[Z.have++]=Bt;else{if(Bt===16){for(be=pt+2;ge>>=pt,ge-=pt,Z.have===0){le.msg="invalid bit length repeat",Z.mode=30;break}H=Z.lens[Z.have-1],ue=3+(3&oe),oe>>>=2,ge-=2}else if(Bt===17){for(be=pt+3;ge>>=pt)),oe>>>=3,ge-=3}else{for(be=pt+7;ge>>=pt)),oe>>>=7,ge-=7}if(Z.have+ue>Z.nlen+Z.ndist){le.msg="invalid bit length repeat",Z.mode=30;break}for(;ue--;)Z.lens[Z.have++]=H}}if(Z.mode===30)break;if(Z.lens[256]===0){le.msg="invalid code -- missing end-of-block",Z.mode=30;break}if(Z.lenbits=9,tt={bits:Z.lenbits},ut=b(w,Z.lens,0,Z.nlen,Z.lencode,0,Z.work,tt),Z.lenbits=tt.bits,ut){le.msg="invalid literal/lengths set",Z.mode=30;break}if(Z.distbits=6,Z.distcode=Z.distdyn,tt={bits:Z.distbits},ut=b(S,Z.lens,Z.nlen,Z.ndist,Z.distcode,0,Z.work,tt),Z.distbits=tt.bits,ut){le.msg="invalid distances set",Z.mode=30;break}if(Z.mode=20,We===6)break e;case 20:Z.mode=21;case 21:if(6<=it&&258<=et){le.next_out=$t,le.avail_out=et,le.next_in=rt,le.avail_in=it,Z.hold=oe,Z.bits=ge,m(le,ee),$t=le.next_out,ct=le.output,et=le.avail_out,rt=le.next_in,$e=le.input,it=le.avail_in,oe=Z.hold,ge=Z.bits,Z.mode===12&&(Z.back=-1);break}for(Z.back=0;Xe=(pe=Z.lencode[oe&(1<>>16&255,Bt=65535&pe,!((pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>Qt)])>>>16&255,Bt=65535&pe,!(Qt+(pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>>=Qt,ge-=Qt,Z.back+=Qt}if(oe>>>=pt,ge-=pt,Z.back+=pt,Z.length=Bt,Xe===0){Z.mode=26;break}if(32&Xe){Z.back=-1,Z.mode=12;break}if(64&Xe){le.msg="invalid literal/length code",Z.mode=30;break}Z.extra=15&Xe,Z.mode=22;case 22:if(Z.extra){for(be=Z.extra;ge>>=Z.extra,ge-=Z.extra,Z.back+=Z.extra}Z.was=Z.length,Z.mode=23;case 23:for(;Xe=(pe=Z.distcode[oe&(1<>>16&255,Bt=65535&pe,!((pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>Qt)])>>>16&255,Bt=65535&pe,!(Qt+(pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>>=Qt,ge-=Qt,Z.back+=Qt}if(oe>>>=pt,ge-=pt,Z.back+=pt,64&Xe){le.msg="invalid distance code",Z.mode=30;break}Z.offset=Bt,Z.extra=15&Xe,Z.mode=24;case 24:if(Z.extra){for(be=Z.extra;ge>>=Z.extra,ge-=Z.extra,Z.back+=Z.extra}if(Z.offset>Z.dmax){le.msg="invalid distance too far back",Z.mode=30;break}Z.mode=25;case 25:if(et===0)break e;if(ue=ee-et,Z.offset>ue){if((ue=Z.offset-ue)>Z.whave&&Z.sane){le.msg="invalid distance too far back",Z.mode=30;break}Je=ue>Z.wnext?(ue-=Z.wnext,Z.wsize-ue):Z.wnext-ue,ue>Z.length&&(ue=Z.length),wt=Z.window}else wt=ct,Je=$t-Z.offset,ue=Z.length;for(etre?(ye=Je[wt+L[We]],ge[Me+L[We]]):(ye=96,0),B=1<>$t)+($-=B)]=ce<<24|ye<<16|Ae|0,$!==0;);for(B=1<>=1;if(B!==0?(oe&=B-1,oe+=B):oe=0,We++,--ee[le]==0){if(le===$e)break;le=S[k+L[We]]}if(ct>>7)]}function Me(pe,Ie){pe.pending_buf[pe.pending++]=255&Ie,pe.pending_buf[pe.pending++]=Ie>>>8&255}function ee(pe,Ie,dt){pe.bi_valid>D-dt?(pe.bi_buf|=Ie<>D-pe.bi_valid,pe.bi_valid+=dt-D):(pe.bi_buf|=Ie<>>=1,dt<<=1,0<--Ie;);return dt>>>1}function wt(pe,Ie,dt){var mt,je,vt=new Array(L+1),Ot=0;for(mt=1;mt<=L;mt++)vt[mt]=Ot=Ot+dt[mt-1]<<1;for(je=0;je<=Ie;je++){var St=pe[2*je+1];St!==0&&(pe[2*je]=Je(vt[St]++,St))}}function pt(pe){var Ie;for(Ie=0;Ie>1;1<=dt;dt--)Qt(pe,vt,dt);for(je=Wt;dt=pe.heap[1],pe.heap[1]=pe.heap[pe.heap_len--],Qt(pe,vt,1),mt=pe.heap[1],pe.heap[--pe.heap_max]=dt,pe.heap[--pe.heap_max]=mt,vt[2*je]=vt[2*dt]+vt[2*mt],pe.depth[je]=(pe.depth[dt]>=pe.depth[mt]?pe.depth[dt]:pe.depth[mt])+1,vt[2*dt+1]=vt[2*mt+1]=je,pe.heap[1]=je++,Qt(pe,vt,1),2<=pe.heap_len;);pe.heap[--pe.heap_max]=pe.heap[1],function(Fe,gt){var mi,ri,yr,Sr,gi,Ei,_i=gt.dyn_tree,Tt=gt.max_code,pr=gt.stat_desc.static_tree,hr=gt.stat_desc.has_stree,yi=gt.stat_desc.extra_bits,nn=gt.stat_desc.extra_base,ar=gt.stat_desc.max_length,Vi=0;for(Sr=0;Sr<=L;Sr++)Fe.bl_count[Sr]=0;for(_i[2*Fe.heap[Fe.heap_max]+1]=0,mi=Fe.heap_max+1;mi>=7;je>>=1)if(1&wr&&St.dyn_ltree[2*Wt]!==0)return d;if(St.dyn_ltree[18]!==0||St.dyn_ltree[20]!==0||St.dyn_ltree[26]!==0)return n;for(Wt=32;Wt>>3,(vt=pe.static_len+3+7>>>3)<=je&&(je=vt)):je=vt=dt+5,dt+4<=je&&Ie!==-1?be(pe,Ie,dt,mt):pe.strategy===4||vt===je?(ee(pe,2+(mt?1:0),3),Rr(pe,_t,le)):(ee(pe,4+(mt?1:0),3),function(St,Wt,wr,Fe){var gt;for(ee(St,Wt-257,5),ee(St,wr-1,5),ee(St,Fe-4,4),gt=0;gt>>8&255,pe.pending_buf[pe.d_buf+2*pe.last_lit+1]=255&Ie,pe.pending_buf[pe.l_buf+pe.last_lit]=255&dt,pe.last_lit++,Ie===0?pe.dyn_ltree[2*dt]++:(pe.matches++,Ie--,pe.dyn_ltree[2*(Z[dt]+S+1)]++,pe.dyn_dtree[2*ge(Ie)]++),pe.last_lit===pe.lit_bufsize-1},c._tr_align=function(pe){ee(pe,2,3),ue(pe,$,_t),function(Ie){Ie.bi_valid===16?(Me(Ie,Ie.bi_buf),Ie.bi_buf=0,Ie.bi_valid=0):8<=Ie.bi_valid&&(Ie.pending_buf[Ie.pending++]=255&Ie.bi_buf,Ie.bi_buf>>=8,Ie.bi_valid-=8)}(pe)}},{"../utils/common":41}],53:[function(s,l,c){l.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(s,l,c){(function(f){(function(d,n){if(!d.setImmediate){var m,b,w,S,k=1,A={},P=!1,T=d.document,L=Object.getPrototypeOf&&Object.getPrototypeOf(d);L=L&&L.setTimeout?L:d,m={}.toString.call(d.process)==="[object process]"?function(J){process.nextTick(function(){B(J)})}:function(){if(d.postMessage&&!d.importScripts){var J=!0,Y=d.onmessage;return d.onmessage=function(){J=!1},d.postMessage("","*"),d.onmessage=Y,J}}()?(S="setImmediate$"+Math.random()+"$",d.addEventListener?d.addEventListener("message",$,!1):d.attachEvent("onmessage",$),function(J){d.postMessage(S+J,"*")}):d.MessageChannel?((w=new MessageChannel).port1.onmessage=function(J){B(J.data)},function(J){w.port2.postMessage(J)}):T&&"onreadystatechange"in T.createElement("script")?(b=T.documentElement,function(J){var Y=T.createElement("script");Y.onreadystatechange=function(){B(J),Y.onreadystatechange=null,b.removeChild(Y),Y=null},b.appendChild(Y)}):function(J){setTimeout(B,0,J)},L.setImmediate=function(J){typeof J!="function"&&(J=new Function(""+J));for(var Y=new Array(arguments.length-1),se=0;se"u"?f===void 0?this:f:self)}).call(this,typeof Ro<"u"?Ro:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(wy);var kS=wy.exports;const SS=$u(kS);const{document:ts}=y_;function Kg(o,r,s){const l=o.slice();return l[30]=r[s],l}function Xg(o,r,s){const l=o.slice();return l[33]=r[s],l}function Jg(o,r,s){const l=o.slice();return l[36]=r[s],l}function Yg(o){let r,s,l=o[0].selected!=null&&o[11](o[0]).missing>0&&o[0].selected.total_pop.count!=null&&o[0].selected.total_pop.count>=100,c,f,d;r=new x_({props:{mode:o[3]=="failed"?"error":"info",$$slots:{default:[RS]},$$scope:{ctx:o}}});let n=l&&t_(o);return{c(){ir(r.$$.fragment),s=Et(),n&&n.c(),c=Et(),f=Ne("div"),this.h()},l(m){cr(r.$$.fragment,m),s=kt(m),n&&n.l(m),c=kt(m),f=Ue(m,"DIV",{}),He(f).forEach(te),this.h()},h(){It(f,"height","24px")},m(m,b){nr(r,m,b),Be(m,s,b),n&&n.m(m,b),Be(m,c,b),Be(m,f,b),d=!0},p(m,b){const w={};b[0]&8&&(w.mode=m[3]=="failed"?"error":"info"),b[0]&26|b[1]&256&&(w.$$scope={dirty:b,ctx:m}),r.$set(w),b[0]&1&&(l=m[0].selected!=null&&m[11](m[0]).missing>0&&m[0].selected.total_pop.count!=null&&m[0].selected.total_pop.count>=100),l?n?(n.p(m,b),b[0]&1&&qe(n,1)):(n=t_(m),n.c(),qe(n,1),n.m(c.parentNode,c)):n&&(Nr(),nt(n,1,1,()=>{n=null}),Ur())},i(m){d||(qe(r.$$.fragment,m),qe(n),d=!0)},o(m){nt(r.$$.fragment,m),nt(n),d=!1},d(m){sr(r,m),m&&te(s),n&&n.d(m),m&&te(c),m&&te(f)}}}function Qg(o){let r;function s(f,d){return f[1].length===1?IS:TS}let l=s(o),c=l(o);return{c(){r=Ne("p"),c.c()},l(f){r=Ue(f,"P",{});var d=He(r);c.l(d),d.forEach(te)},m(f,d){Be(f,r,d),c.m(r,null)},p(f,d){l===(l=s(f))&&c?c.p(f,d):(c.d(1),c=l(f),c&&(c.c(),c.m(r,null)))},d(f){f&&te(r),c.d()}}}function TS(o){let r,s;function l(d,n){return d[1].length===2?AS:CS}let c=l(o),f=c(o);return{c(){r=zt("The profile below is for people with "),f.c(),s=zt(` - of the following characteristics:`)},l(d){r=Mt(d,"The profile below is for people with "),f.l(d),s=Mt(d,` - of the following characteristics:`)},m(d,n){Be(d,r,n),f.m(d,n),Be(d,s,n)},p(d,n){c!==(c=l(d))&&(f.d(1),f=c(d),f&&(f.c(),f.m(s.parentNode,s)))},d(d){d&&te(r),f.d(d),d&&te(s)}}}function IS(o){let r;return{c(){r=zt(`The profile below is for people with the following - characteristic:`)},l(s){r=Mt(s,`The profile below is for people with the following - characteristic:`)},m(s,l){Be(s,r,l)},p:_r,d(s){s&&te(r)}}}function CS(o){let r;return{c(){r=zt("all")},l(s){r=Mt(s,"all")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function AS(o){let r;return{c(){r=zt("both")},l(s){r=Mt(s,"both")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function PS(o){let r,s,l=aa(o[36].topic)+"",c,f,d=aa(Ka(o[36].label))+"",n,m,b,w,S;function k(){return o[15](o[36])}return{c(){r=Ne("button"),s=Ne("span"),c=zt(l),f=zt(": "),n=zt(d),m=Et(),b=Ne("span"),this.h()},l(A){r=Ue(A,"BUTTON",{class:!0});var P=He(r);s=Ue(P,"SPAN",{class:!0});var T=He(s);c=Mt(T,l),f=Mt(T,": "),n=Mt(T,d),T.forEach(te),m=kt(P),b=Ue(P,"SPAN",{class:!0}),He(b).forEach(te),P.forEach(te),this.h()},h(){_e(s,"class","chip-text svelte-hd3bon"),_e(b,"class","chip-ready svelte-hd3bon"),_e(r,"class","chip svelte-hd3bon")},m(A,P){Be(A,r,P),Pe(r,s),Pe(s,c),Pe(s,f),Pe(s,n),Pe(r,m),Pe(r,b),w||(S=bs(r,"click",k),w=!0)},p(A,P){o=A,P[0]&2&&l!==(l=aa(o[36].topic)+"")&&kr(c,l),P[0]&2&&d!==(d=aa(Ka(o[36].label))+"")&&kr(n,d)},d(A){A&&te(r),w=!1,S()}}}function zS(o){let r,s,l=aa(o[36].topic)+"",c,f,d=aa(Ka(o[36].label))+"",n,m,b;return{c(){r=Ne("div"),s=Ne("span"),c=zt(l),f=zt(": "),n=zt(d),m=Et(),b=Ne("div"),this.h()},l(w){r=Ue(w,"DIV",{class:!0});var S=He(r);s=Ue(S,"SPAN",{class:!0});var k=He(s);c=Mt(k,l),f=Mt(k,": "),n=Mt(k,d),k.forEach(te),m=kt(S),b=Ue(S,"DIV",{class:!0}),He(b).forEach(te),S.forEach(te),this.h()},h(){_e(s,"class","chip-text svelte-hd3bon"),_e(b,"class","chip-loader svelte-hd3bon"),_e(r,"class","chip chip-pending svelte-hd3bon")},m(w,S){Be(w,r,S),Pe(r,s),Pe(s,c),Pe(s,f),Pe(s,n),Pe(r,m),Pe(r,b)},p(w,S){S[0]&2&&l!==(l=aa(w[36].topic)+"")&&kr(c,l),S[0]&2&&d!==(d=aa(Ka(w[36].label))+"")&&kr(n,d)},d(w){w&&te(r)}}}function e_(o){let r;function s(f,d){return f[3]=="loading"?zS:PS}let l=s(o),c=l(o);return{c(){c.c(),r=er()},l(f){c.l(f),r=er()},m(f,d){c.m(f,d),Be(f,r,d)},p(f,d){l===(l=s(f))&&c?c.p(f,d):(c.d(1),c=l(f),c&&(c.c(),c.m(r.parentNode,r)))},d(f){c.d(f),f&&te(r)}}}function MS(o){let r,s;return{c(){r=Ne("p"),s=zt(`Economic indicators (employment, social status etc) are not - available for ages 0 to 15.`),this.h()},l(l){r=Ue(l,"P",{});var c=He(r);s=Mt(c,`Economic indicators (employment, social status etc) are not - available for ages 0 to 15.`),c.forEach(te),this.h()},h(){It(r,"margin","1rem 0 0")},m(l,c){Be(l,r,c),Pe(r,s)},d(l){l&&te(r)}}}function DS(o){let r,s;return{c(){r=Ne("p"),s=zt(`No data is available for the selected variables. Try removing a - variable to see more datasets.`),this.h()},l(l){r=Ue(l,"P",{});var c=He(r);s=Mt(c,`No data is available for the selected variables. Try removing a - variable to see more datasets.`),c.forEach(te),this.h()},h(){It(r,"margin","1rem 0 0")},m(l,c){Be(l,r,c),Pe(r,s)},d(l){l&&te(r)}}}function RS(o){let r,s,l,c=o[3]!="failed"&&Qg(o),f=o[1],d=[];for(let w=0;w>2,A=(3&b)<<4|w>>4,P=1<$?(15&w)<<2|S>>6:64,T=2<$?63&S:64,L.push(n.charAt(k)+n.charAt(A)+n.charAt(P)+n.charAt(T));return L.join("")},c.decode=function(m){var b,w,S,k,A,P,T=0,L=0,D="data:";if(m.substr(0,D.length)===D)throw new Error("Invalid base64 input, it looks like a data url.");var B,$=3*(m=m.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(m.charAt(m.length-1)===n.charAt(64)&&$--,m.charAt(m.length-2)===n.charAt(64)&&$--,$%1!=0)throw new Error("Invalid base64 input, bad content length.");for(B=d.uint8array?new Uint8Array(0|$):new Array(0|$);T>4,w=(15&k)<<4|(A=n.indexOf(m.charAt(T++)))>>2,S=(3&A)<<6|(P=n.indexOf(m.charAt(T++))),B[L++]=b,A!==64&&(B[L++]=w),P!==64&&(B[L++]=S);return B}},{"./support":30,"./utils":32}],2:[function(a,l,c){var f=a("./external"),d=a("./stream/DataWorker"),n=a("./stream/Crc32Probe"),m=a("./stream/DataLengthProbe");function b(w,S,k,A,P){this.compressedSize=w,this.uncompressedSize=S,this.crc32=k,this.compression=A,this.compressedContent=P}b.prototype={getContentWorker:function(){var w=new d(f.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new m("data_length")),S=this;return w.on("end",function(){if(this.streamInfo.data_length!==S.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),w},getCompressedWorker:function(){return new d(f.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},b.createWorkerFrom=function(w,S,k){return w.pipe(new n).pipe(new m("uncompressedSize")).pipe(S.compressWorker(k)).pipe(new m("compressedSize")).withStreamInfo("compression",S)},l.exports=b},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(a,l,c){var f=a("./stream/GenericWorker");c.STORE={magic:"\0\0",compressWorker:function(){return new f("STORE compression")},uncompressWorker:function(){return new f("STORE decompression")}},c.DEFLATE=a("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(a,l,c){var f=a("./utils"),d=function(){for(var n,m=[],b=0;b<256;b++){n=b;for(var w=0;w<8;w++)n=1&n?3988292384^n>>>1:n>>>1;m[b]=n}return m}();l.exports=function(n,m){return n!==void 0&&n.length?f.getTypeOf(n)!=="string"?function(b,w,S,k){var A=d,P=k+S;b^=-1;for(var T=k;T>>8^A[255&(b^w[T])];return-1^b}(0|m,n,n.length,0):function(b,w,S,k){var A=d,P=k+S;b^=-1;for(var T=k;T>>8^A[255&(b^w.charCodeAt(T))];return-1^b}(0|m,n,n.length,0):0}},{"./utils":32}],5:[function(a,l,c){c.base64=!1,c.binary=!1,c.dir=!1,c.createFolders=!0,c.date=null,c.compression=null,c.compressionOptions=null,c.comment=null,c.unixPermissions=null,c.dosPermissions=null},{}],6:[function(a,l,c){var f=null;f=typeof Promise<"u"?Promise:a("lie"),l.exports={Promise:f}},{lie:37}],7:[function(a,l,c){var f=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",d=a("pako"),n=a("./utils"),m=a("./stream/GenericWorker"),b=f?"uint8array":"array";function w(S,k){m.call(this,"FlateWorker/"+S),this._pako=null,this._pakoAction=S,this._pakoOptions=k,this.meta={}}c.magic="\b\0",n.inherits(w,m),w.prototype.processChunk=function(S){this.meta=S.meta,this._pako===null&&this._createPako(),this._pako.push(n.transformTo(b,S.data),!1)},w.prototype.flush=function(){m.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},w.prototype.cleanUp=function(){m.prototype.cleanUp.call(this),this._pako=null},w.prototype._createPako=function(){this._pako=new d[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var S=this;this._pako.onData=function(k){S.push({data:k,meta:S.meta})}},c.compressWorker=function(S){return new w("Deflate",S)},c.uncompressWorker=function(){return new w("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(a,l,c){function f(A,P){var T,L="";for(T=0;T>>=8;return L}function d(A,P,T,L,D,B){var $,J,Y=A.file,ae=A.compression,re=B!==b.utf8encode,ce=n.transformTo("string",B(Y.name)),ye=n.transformTo("string",b.utf8encode(Y.name)),Ae=Y.comment,_t=n.transformTo("string",B(Ae)),le=n.transformTo("string",b.utf8encode(Ae)),We=ye.length!==Y.name.length,Z=le.length!==Ae.length,$e="",ct="",rt="",$t=Y.dir,it=Y.date,et={crc32:0,compressedSize:0,uncompressedSize:0};P&&!T||(et.crc32=A.crc32,et.compressedSize=A.compressedSize,et.uncompressedSize=A.uncompressedSize);var oe=0;P&&(oe|=8),re||!We&&!Z||(oe|=2048);var ge=0,Me=0;$t&&(ge|=16),D==="UNIX"?(Me=798,ge|=function(ue,Je){var wt=ue;return ue||(wt=Je?16893:33204),(65535&wt)<<16}(Y.unixPermissions,$t)):(Me=20,ge|=function(ue){return 63&(ue||0)}(Y.dosPermissions)),$=it.getUTCHours(),$<<=6,$|=it.getUTCMinutes(),$<<=5,$|=it.getUTCSeconds()/2,J=it.getUTCFullYear()-1980,J<<=4,J|=it.getUTCMonth()+1,J<<=5,J|=it.getUTCDate(),We&&(ct=f(1,1)+f(w(ce),4)+ye,$e+="up"+f(ct.length,2)+ct),Z&&(rt=f(1,1)+f(w(_t),4)+le,$e+="uc"+f(rt.length,2)+rt);var ee="";return ee+=` +\0`,ee+=f(oe,2),ee+=ae.magic,ee+=f($,2),ee+=f(J,2),ee+=f(et.crc32,4),ee+=f(et.compressedSize,4),ee+=f(et.uncompressedSize,4),ee+=f(ce.length,2),ee+=f($e.length,2),{fileRecord:S.LOCAL_FILE_HEADER+ee+ce+$e,dirRecord:S.CENTRAL_FILE_HEADER+f(Me,2)+ee+f(_t.length,2)+"\0\0\0\0"+f(ge,4)+f(L,4)+ce+$e+_t}}var n=a("../utils"),m=a("../stream/GenericWorker"),b=a("../utf8"),w=a("../crc32"),S=a("../signature");function k(A,P,T,L){m.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=P,this.zipPlatform=T,this.encodeFileName=L,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}n.inherits(k,m),k.prototype.push=function(A){var P=A.meta.percent||0,T=this.entriesCount,L=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,m.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:T?(P+100*(T-L-1))/T:100}}))},k.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var P=this.streamFiles&&!A.file.dir;if(P){var T=d(A,P,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:T.fileRecord,meta:{percent:0}})}else this.accumulate=!0},k.prototype.closedSource=function(A){this.accumulate=!1;var P=this.streamFiles&&!A.file.dir,T=d(A,P,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(T.dirRecord),P)this.push({data:function(L){return S.DATA_DESCRIPTOR+f(L.crc32,4)+f(L.compressedSize,4)+f(L.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:T.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},k.prototype.flush=function(){for(var A=this.bytesWritten,P=0;P=this.index;m--)b=(b<<8)+this.byteAt(m);return this.index+=n,b},readString:function(n){return f.transformTo("string",this.readData(n))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var n=this.readInt(4);return new Date(Date.UTC(1980+(n>>25&127),(n>>21&15)-1,n>>16&31,n>>11&31,n>>5&63,(31&n)<<1))}},l.exports=d},{"../utils":32}],19:[function(a,l,c){var f=a("./Uint8ArrayReader");function d(n){f.call(this,n)}a("../utils").inherits(d,f),d.prototype.readData=function(n){this.checkOffset(n);var m=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,m},l.exports=d},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(a,l,c){var f=a("./DataReader");function d(n){f.call(this,n)}a("../utils").inherits(d,f),d.prototype.byteAt=function(n){return this.data.charCodeAt(this.zero+n)},d.prototype.lastIndexOfSignature=function(n){return this.data.lastIndexOf(n)-this.zero},d.prototype.readAndCheckSignature=function(n){return n===this.readData(4)},d.prototype.readData=function(n){this.checkOffset(n);var m=this.data.slice(this.zero+this.index,this.zero+this.index+n);return this.index+=n,m},l.exports=d},{"../utils":32,"./DataReader":18}],21:[function(a,l,c){var f=a("./ArrayReader");function d(n){f.call(this,n)}a("../utils").inherits(d,f),d.prototype.readData=function(n){if(this.checkOffset(n),n===0)return new Uint8Array(0);var m=this.data.subarray(this.zero+this.index,this.zero+this.index+n);return this.index+=n,m},l.exports=d},{"../utils":32,"./ArrayReader":17}],22:[function(a,l,c){var f=a("../utils"),d=a("../support"),n=a("./ArrayReader"),m=a("./StringReader"),b=a("./NodeBufferReader"),w=a("./Uint8ArrayReader");l.exports=function(S){var k=f.getTypeOf(S);return f.checkSupport(k),k!=="string"||d.uint8array?k==="nodebuffer"?new b(S):d.uint8array?new w(f.transformTo("uint8array",S)):new n(f.transformTo("array",S)):new m(S)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(a,l,c){c.LOCAL_FILE_HEADER="PK",c.CENTRAL_FILE_HEADER="PK",c.CENTRAL_DIRECTORY_END="PK",c.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",c.ZIP64_CENTRAL_DIRECTORY_END="PK",c.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(a,l,c){var f=a("./GenericWorker"),d=a("../utils");function n(m){f.call(this,"ConvertWorker to "+m),this.destType=m}d.inherits(n,f),n.prototype.processChunk=function(m){this.push({data:d.transformTo(this.destType,m.data),meta:m.meta})},l.exports=n},{"../utils":32,"./GenericWorker":28}],25:[function(a,l,c){var f=a("./GenericWorker"),d=a("../crc32");function n(){f.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}a("../utils").inherits(n,f),n.prototype.processChunk=function(m){this.streamInfo.crc32=d(m.data,this.streamInfo.crc32||0),this.push(m)},l.exports=n},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(a,l,c){var f=a("../utils"),d=a("./GenericWorker");function n(m){d.call(this,"DataLengthProbe for "+m),this.propName=m,this.withStreamInfo(m,0)}f.inherits(n,d),n.prototype.processChunk=function(m){if(m){var b=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=b+m.data.length}d.prototype.processChunk.call(this,m)},l.exports=n},{"../utils":32,"./GenericWorker":28}],27:[function(a,l,c){var f=a("../utils"),d=a("./GenericWorker");function n(m){d.call(this,"DataWorker");var b=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,m.then(function(w){b.dataIsReady=!0,b.data=w,b.max=w&&w.length||0,b.type=f.getTypeOf(w),b.isPaused||b._tickAndRepeat()},function(w){b.error(w)})}f.inherits(n,d),n.prototype.cleanUp=function(){d.prototype.cleanUp.call(this),this.data=null},n.prototype.resume=function(){return!!d.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,f.delay(this._tickAndRepeat,[],this)),!0)},n.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(f.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},n.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var m=null,b=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":m=this.data.substring(this.index,b);break;case"uint8array":m=this.data.subarray(this.index,b);break;case"array":case"nodebuffer":m=this.data.slice(this.index,b)}return this.index=b,this.push({data:m,meta:{percent:this.max?this.index/this.max*100:0}})},l.exports=n},{"../utils":32,"./GenericWorker":28}],28:[function(a,l,c){function f(d){this.name=d||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}f.prototype={push:function(d){this.emit("data",d)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(d){this.emit("error",d)}return!0},error:function(d){return!this.isFinished&&(this.isPaused?this.generatedError=d:(this.isFinished=!0,this.emit("error",d),this.previous&&this.previous.error(d),this.cleanUp()),!0)},on:function(d,n){return this._listeners[d].push(n),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(d,n){if(this._listeners[d])for(var m=0;m "+d:d}},l.exports=f},{}],29:[function(a,l,c){var f=a("../utils"),d=a("./ConvertWorker"),n=a("./GenericWorker"),m=a("../base64"),b=a("../support"),w=a("../external"),S=null;if(b.nodestream)try{S=a("../nodejs/NodejsStreamOutputAdapter")}catch{}function k(P,T){return new w.Promise(function(L,D){var B=[],$=P._internalType,J=P._outputType,Y=P._mimeType;P.on("data",function(ae,re){B.push(ae),T&&T(re)}).on("error",function(ae){B=[],D(ae)}).on("end",function(){try{var ae=function(re,ce,ye){switch(re){case"blob":return f.newBlob(f.transformTo("arraybuffer",ce),ye);case"base64":return m.encode(ce);default:return f.transformTo(re,ce)}}(J,function(re,ce){var ye,Ae=0,_t=null,le=0;for(ye=0;ye"u")c.blob=!1;else{var f=new ArrayBuffer(0);try{c.blob=new Blob([f],{type:"application/zip"}).size===0}catch{try{var d=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);d.append(f),c.blob=d.getBlob("application/zip").size===0}catch{c.blob=!1}}}try{c.nodestream=!!a("readable-stream").Readable}catch{c.nodestream=!1}},{"readable-stream":16}],31:[function(a,l,c){for(var f=a("./utils"),d=a("./support"),n=a("./nodejsUtils"),m=a("./stream/GenericWorker"),b=new Array(256),w=0;w<256;w++)b[w]=252<=w?6:248<=w?5:240<=w?4:224<=w?3:192<=w?2:1;b[254]=b[254]=1;function S(){m.call(this,"utf-8 decode"),this.leftOver=null}function k(){m.call(this,"utf-8 encode")}c.utf8encode=function(A){return d.nodebuffer?n.newBufferFrom(A,"utf-8"):function(P){var T,L,D,B,$,J=P.length,Y=0;for(B=0;B>>6:(L<65536?T[$++]=224|L>>>12:(T[$++]=240|L>>>18,T[$++]=128|L>>>12&63),T[$++]=128|L>>>6&63),T[$++]=128|63&L);return T}(A)},c.utf8decode=function(A){return d.nodebuffer?f.transformTo("nodebuffer",A).toString("utf-8"):function(P){var T,L,D,B,$=P.length,J=new Array(2*$);for(T=L=0;T<$;)if((D=P[T++])<128)J[L++]=D;else if(4<(B=b[D]))J[L++]=65533,T+=B-1;else{for(D&=B===2?31:B===3?15:7;1>10&1023,J[L++]=56320|1023&D)}return J.length!==L&&(J.subarray?J=J.subarray(0,L):J.length=L),f.applyFromCharCode(J)}(A=f.transformTo(d.uint8array?"uint8array":"array",A))},f.inherits(S,m),S.prototype.processChunk=function(A){var P=f.transformTo(d.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(d.uint8array){var T=P;(P=new Uint8Array(T.length+this.leftOver.length)).set(this.leftOver,0),P.set(T,this.leftOver.length)}else P=this.leftOver.concat(P);this.leftOver=null}var L=function(B,$){var J;for(($=$||B.length)>B.length&&($=B.length),J=$-1;0<=J&&(192&B[J])==128;)J--;return J<0||J===0?$:J+b[B[J]]>$?J:$}(P),D=P;L!==P.length&&(d.uint8array?(D=P.subarray(0,L),this.leftOver=P.subarray(L,P.length)):(D=P.slice(0,L),this.leftOver=P.slice(L,P.length))),this.push({data:c.utf8decode(D),meta:A.meta})},S.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:c.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},c.Utf8DecodeWorker=S,f.inherits(k,m),k.prototype.processChunk=function(A){this.push({data:c.utf8encode(A.data),meta:A.meta})},c.Utf8EncodeWorker=k},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(a,l,c){var f=a("./support"),d=a("./base64"),n=a("./nodejsUtils"),m=a("./external");function b(T){return T}function w(T,L){for(var D=0;D>8;this.dir=!!(16&this.externalFileAttributes),A==0&&(this.dosPermissions=63&this.externalFileAttributes),A==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var A=f(this.extraFields[1].value);this.uncompressedSize===d.MAX_VALUE_32BITS&&(this.uncompressedSize=A.readInt(8)),this.compressedSize===d.MAX_VALUE_32BITS&&(this.compressedSize=A.readInt(8)),this.localHeaderOffset===d.MAX_VALUE_32BITS&&(this.localHeaderOffset=A.readInt(8)),this.diskNumberStart===d.MAX_VALUE_32BITS&&(this.diskNumberStart=A.readInt(4))}},readExtraFields:function(A){var P,T,L,D=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(A<65536?k[L++]=224|A>>>12:(k[L++]=240|A>>>18,k[L++]=128|A>>>12&63),k[L++]=128|A>>>6&63),k[L++]=128|63&A);return k},c.buf2binstring=function(S){return w(S,S.length)},c.binstring2buf=function(S){for(var k=new f.Buf8(S.length),A=0,P=k.length;A>10&1023,B[P++]=56320|1023&T)}return w(B,P)},c.utf8border=function(S,k){var A;for((k=k||S.length)>S.length&&(k=S.length),A=k-1;0<=A&&(192&S[A])==128;)A--;return A<0||A===0?k:A+m[S[A]]>k?A:k}},{"./common":41}],43:[function(a,l,c){l.exports=function(f,d,n,m){for(var b=65535&f|0,w=f>>>16&65535|0,S=0;n!==0;){for(n-=S=2e3>>1:d>>>1;n[m]=d}return n}();l.exports=function(d,n,m,b){var w=f,S=b+m;d^=-1;for(var k=b;k>>8^w[255&(d^n[k])];return-1^d}},{}],46:[function(a,l,c){var f,d=a("../utils/common"),n=a("./trees"),m=a("./adler32"),b=a("./crc32"),w=a("./messages"),S=0,k=4,A=0,P=-2,T=-1,L=4,D=2,B=8,$=9,J=286,Y=30,ae=19,re=2*J+1,ce=15,ye=3,Ae=258,_t=Ae+ye+1,le=42,We=113,Z=1,$e=2,ct=3,rt=4;function $t(H,ut){return H.msg=w[ut],ut}function it(H){return(H<<1)-(4H.avail_out&&(tt=H.avail_out),tt!==0&&(d.arraySet(H.output,ut.pending_buf,ut.pending_out,tt,H.next_out),H.next_out+=tt,ut.pending_out+=tt,H.total_out+=tt,H.avail_out-=tt,ut.pending-=tt,ut.pending===0&&(ut.pending_out=0))}function ge(H,ut){n._tr_flush_block(H,0<=H.block_start?H.block_start:-1,H.strstart-H.block_start,ut),H.block_start=H.strstart,oe(H.strm)}function Me(H,ut){H.pending_buf[H.pending++]=ut}function ee(H,ut){H.pending_buf[H.pending++]=ut>>>8&255,H.pending_buf[H.pending++]=255&ut}function ue(H,ut){var tt,be,pe=H.max_chain_length,Ie=H.strstart,dt=H.prev_length,mt=H.nice_match,je=H.strstart>H.w_size-_t?H.strstart-(H.w_size-_t):0,vt=H.window,Ot=H.w_mask,St=H.prev,Wt=H.strstart+Ae,wr=vt[Ie+dt-1],Fe=vt[Ie+dt];H.prev_length>=H.good_match&&(pe>>=2),mt>H.lookahead&&(mt=H.lookahead);do if(vt[(tt=ut)+dt]===Fe&&vt[tt+dt-1]===wr&&vt[tt]===vt[Ie]&&vt[++tt]===vt[Ie+1]){Ie+=2,tt++;do;while(vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&vt[++Ie]===vt[++tt]&&Ieje&&--pe!=0);return dt<=H.lookahead?dt:H.lookahead}function Je(H){var ut,tt,be,pe,Ie,dt,mt,je,vt,Ot,St=H.w_size;do{if(pe=H.window_size-H.lookahead-H.strstart,H.strstart>=St+(St-_t)){for(d.arraySet(H.window,H.window,St,St,0),H.match_start-=St,H.strstart-=St,H.block_start-=St,ut=tt=H.hash_size;be=H.head[--ut],H.head[ut]=St<=be?be-St:0,--tt;);for(ut=tt=St;be=H.prev[--ut],H.prev[ut]=St<=be?be-St:0,--tt;);pe+=St}if(H.strm.avail_in===0)break;if(dt=H.strm,mt=H.window,je=H.strstart+H.lookahead,vt=pe,Ot=void 0,Ot=dt.avail_in,vt=ye)for(Ie=H.strstart-H.insert,H.ins_h=H.window[Ie],H.ins_h=(H.ins_h<=ye&&(H.ins_h=(H.ins_h<=ye)if(be=n._tr_tally(H,H.strstart-H.match_start,H.match_length-ye),H.lookahead-=H.match_length,H.match_length<=H.max_lazy_match&&H.lookahead>=ye){for(H.match_length--;H.strstart++,H.ins_h=(H.ins_h<=ye&&(H.ins_h=(H.ins_h<=ye&&H.match_length<=H.prev_length){for(pe=H.strstart+H.lookahead-ye,be=n._tr_tally(H,H.strstart-1-H.prev_match,H.prev_length-ye),H.lookahead-=H.prev_length-1,H.prev_length-=2;++H.strstart<=pe&&(H.ins_h=(H.ins_h<H.pending_buf_size-5&&(tt=H.pending_buf_size-5);;){if(H.lookahead<=1){if(Je(H),H.lookahead===0&&ut===S)return Z;if(H.lookahead===0)break}H.strstart+=H.lookahead,H.lookahead=0;var be=H.block_start+tt;if((H.strstart===0||H.strstart>=be)&&(H.lookahead=H.strstart-be,H.strstart=be,ge(H,!1),H.strm.avail_out===0)||H.strstart-H.block_start>=H.w_size-_t&&(ge(H,!1),H.strm.avail_out===0))return Z}return H.insert=0,ut===k?(ge(H,!0),H.strm.avail_out===0?ct:rt):(H.strstart>H.block_start&&(ge(H,!1),H.strm.avail_out),Z)}),new Xe(4,4,8,4,wt),new Xe(4,5,16,8,wt),new Xe(4,6,32,32,wt),new Xe(4,4,16,16,pt),new Xe(8,16,32,32,pt),new Xe(8,16,128,128,pt),new Xe(8,32,128,256,pt),new Xe(32,128,258,1024,pt),new Xe(32,258,258,4096,pt)],c.deflateInit=function(H,ut){return Vr(H,ut,B,15,8,0)},c.deflateInit2=Vr,c.deflateReset=Rr,c.deflateResetKeep=Qt,c.deflateSetHeader=function(H,ut){return H&&H.state?H.state.wrap!==2?P:(H.state.gzhead=ut,A):P},c.deflate=function(H,ut){var tt,be,pe,Ie;if(!H||!H.state||5>8&255),Me(be,be.gzhead.time>>16&255),Me(be,be.gzhead.time>>24&255),Me(be,be.level===9?2:2<=be.strategy||be.level<2?4:0),Me(be,255&be.gzhead.os),be.gzhead.extra&&be.gzhead.extra.length&&(Me(be,255&be.gzhead.extra.length),Me(be,be.gzhead.extra.length>>8&255)),be.gzhead.hcrc&&(H.adler=b(H.adler,be.pending_buf,be.pending,0)),be.gzindex=0,be.status=69):(Me(be,0),Me(be,0),Me(be,0),Me(be,0),Me(be,0),Me(be,be.level===9?2:2<=be.strategy||be.level<2?4:0),Me(be,3),be.status=We);else{var dt=B+(be.w_bits-8<<4)<<8;dt|=(2<=be.strategy||be.level<2?0:be.level<6?1:be.level===6?2:3)<<6,be.strstart!==0&&(dt|=32),dt+=31-dt%31,be.status=We,ee(be,dt),be.strstart!==0&&(ee(be,H.adler>>>16),ee(be,65535&H.adler)),H.adler=1}if(be.status===69)if(be.gzhead.extra){for(pe=be.pending;be.gzindex<(65535&be.gzhead.extra.length)&&(be.pending!==be.pending_buf_size||(be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),oe(H),pe=be.pending,be.pending!==be.pending_buf_size));)Me(be,255&be.gzhead.extra[be.gzindex]),be.gzindex++;be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),be.gzindex===be.gzhead.extra.length&&(be.gzindex=0,be.status=73)}else be.status=73;if(be.status===73)if(be.gzhead.name){pe=be.pending;do{if(be.pending===be.pending_buf_size&&(be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),oe(H),pe=be.pending,be.pending===be.pending_buf_size)){Ie=1;break}Ie=be.gzindexpe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),Ie===0&&(be.gzindex=0,be.status=91)}else be.status=91;if(be.status===91)if(be.gzhead.comment){pe=be.pending;do{if(be.pending===be.pending_buf_size&&(be.gzhead.hcrc&&be.pending>pe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),oe(H),pe=be.pending,be.pending===be.pending_buf_size)){Ie=1;break}Ie=be.gzindexpe&&(H.adler=b(H.adler,be.pending_buf,be.pending-pe,pe)),Ie===0&&(be.status=103)}else be.status=103;if(be.status===103&&(be.gzhead.hcrc?(be.pending+2>be.pending_buf_size&&oe(H),be.pending+2<=be.pending_buf_size&&(Me(be,255&H.adler),Me(be,H.adler>>8&255),H.adler=0,be.status=We)):be.status=We),be.pending!==0){if(oe(H),H.avail_out===0)return be.last_flush=-1,A}else if(H.avail_in===0&&it(ut)<=it(tt)&&ut!==k)return $t(H,-5);if(be.status===666&&H.avail_in!==0)return $t(H,-5);if(H.avail_in!==0||be.lookahead!==0||ut!==S&&be.status!==666){var mt=be.strategy===2?function(je,vt){for(var Ot;;){if(je.lookahead===0&&(Je(je),je.lookahead===0)){if(vt===S)return Z;break}if(je.match_length=0,Ot=n._tr_tally(je,0,je.window[je.strstart]),je.lookahead--,je.strstart++,Ot&&(ge(je,!1),je.strm.avail_out===0))return Z}return je.insert=0,vt===k?(ge(je,!0),je.strm.avail_out===0?ct:rt):je.last_lit&&(ge(je,!1),je.strm.avail_out===0)?Z:$e}(be,ut):be.strategy===3?function(je,vt){for(var Ot,St,Wt,wr,Fe=je.window;;){if(je.lookahead<=Ae){if(Je(je),je.lookahead<=Ae&&vt===S)return Z;if(je.lookahead===0)break}if(je.match_length=0,je.lookahead>=ye&&0je.lookahead&&(je.match_length=je.lookahead)}if(je.match_length>=ye?(Ot=n._tr_tally(je,1,je.match_length-ye),je.lookahead-=je.match_length,je.strstart+=je.match_length,je.match_length=0):(Ot=n._tr_tally(je,0,je.window[je.strstart]),je.lookahead--,je.strstart++),Ot&&(ge(je,!1),je.strm.avail_out===0))return Z}return je.insert=0,vt===k?(ge(je,!0),je.strm.avail_out===0?ct:rt):je.last_lit&&(ge(je,!1),je.strm.avail_out===0)?Z:$e}(be,ut):f[be.level].func(be,ut);if(mt!==ct&&mt!==rt||(be.status=666),mt===Z||mt===ct)return H.avail_out===0&&(be.last_flush=-1),A;if(mt===$e&&(ut===1?n._tr_align(be):ut!==5&&(n._tr_stored_block(be,0,0,!1),ut===3&&(et(be.head),be.lookahead===0&&(be.strstart=0,be.block_start=0,be.insert=0))),oe(H),H.avail_out===0))return be.last_flush=-1,A}return ut!==k?A:be.wrap<=0?1:(be.wrap===2?(Me(be,255&H.adler),Me(be,H.adler>>8&255),Me(be,H.adler>>16&255),Me(be,H.adler>>24&255),Me(be,255&H.total_in),Me(be,H.total_in>>8&255),Me(be,H.total_in>>16&255),Me(be,H.total_in>>24&255)):(ee(be,H.adler>>>16),ee(be,65535&H.adler)),oe(H),0=tt.w_size&&(Ie===0&&(et(tt.head),tt.strstart=0,tt.block_start=0,tt.insert=0),vt=new d.Buf8(tt.w_size),d.arraySet(vt,ut,Ot-tt.w_size,tt.w_size,0),ut=vt,Ot=tt.w_size),dt=H.avail_in,mt=H.next_in,je=H.input,H.avail_in=Ot,H.next_in=0,H.input=ut,Je(tt);tt.lookahead>=ye;){for(be=tt.strstart,pe=tt.lookahead-(ye-1);tt.ins_h=(tt.ins_h<>>=ye=ce>>>24,$-=ye,(ye=ce>>>16&255)===0)$e[w++]=65535&ce;else{if(!(16&ye)){if(!(64&ye)){ce=J[(65535&ce)+(B&(1<>>=ye,$-=ye),$<15&&(B+=Z[m++]<<$,$+=8,B+=Z[m++]<<$,$+=8),ce=Y[B&re];r:for(;;){if(B>>>=ye=ce>>>24,$-=ye,!(16&(ye=ce>>>16&255))){if(!(64&ye)){ce=Y[(65535&ce)+(B&(1<>>=ye,$-=ye,(ye=w-S)<_t){if(T<(ye=_t-ye)&&n.sane){f.msg="invalid distance too far back",n.mode=30;break e}if(We=D,(le=0)===L){if(le+=P-ye,ye>3,B&=(1<<($-=Ae<<3))-1,f.next_in=m,f.next_out=w,f.avail_in=m>>24&255)+(le>>>8&65280)+((65280&le)<<8)+((255&le)<<24)}function B(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new f.Buf16(320),this.work=new f.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function $(le){var We;return le&&le.state?(We=le.state,le.total_in=le.total_out=We.total=0,le.msg="",We.wrap&&(le.adler=1&We.wrap),We.mode=P,We.last=0,We.havedict=0,We.dmax=32768,We.head=null,We.hold=0,We.bits=0,We.lencode=We.lendyn=new f.Buf32(T),We.distcode=We.distdyn=new f.Buf32(L),We.sane=1,We.back=-1,k):A}function J(le){var We;return le&&le.state?((We=le.state).wsize=0,We.whave=0,We.wnext=0,$(le)):A}function Y(le,We){var Z,$e;return le&&le.state?($e=le.state,We<0?(Z=0,We=-We):(Z=1+(We>>4),We<48&&(We&=15)),We&&(We<8||15=rt.wsize?(f.arraySet(rt.window,We,Z-rt.wsize,rt.wsize,0),rt.wnext=0,rt.whave=rt.wsize):($e<(ct=rt.wsize-rt.wnext)&&(ct=$e),f.arraySet(rt.window,We,Z-$e,ct,rt.wnext),($e-=ct)?(f.arraySet(rt.window,We,Z-$e,$e,0),rt.wnext=$e,rt.whave=rt.wsize):(rt.wnext+=ct,rt.wnext===rt.wsize&&(rt.wnext=0),rt.whave>>8&255,Z.check=n(Z.check,Ie,2,0),ge=oe=0,Z.mode=2;break}if(Z.flags=0,Z.head&&(Z.head.done=!1),!(1&Z.wrap)||(((255&oe)<<8)+(oe>>8))%31){le.msg="incorrect header check",Z.mode=30;break}if((15&oe)!=8){le.msg="unknown compression method",Z.mode=30;break}if(ge-=4,H=8+(15&(oe>>>=4)),Z.wbits===0)Z.wbits=H;else if(H>Z.wbits){le.msg="invalid window size",Z.mode=30;break}Z.dmax=1<>8&1),512&Z.flags&&(Ie[0]=255&oe,Ie[1]=oe>>>8&255,Z.check=n(Z.check,Ie,2,0)),ge=oe=0,Z.mode=3;case 3:for(;ge<32;){if(it===0)break e;it--,oe+=$e[rt++]<>>8&255,Ie[2]=oe>>>16&255,Ie[3]=oe>>>24&255,Z.check=n(Z.check,Ie,4,0)),ge=oe=0,Z.mode=4;case 4:for(;ge<16;){if(it===0)break e;it--,oe+=$e[rt++]<>8),512&Z.flags&&(Ie[0]=255&oe,Ie[1]=oe>>>8&255,Z.check=n(Z.check,Ie,2,0)),ge=oe=0,Z.mode=5;case 5:if(1024&Z.flags){for(;ge<16;){if(it===0)break e;it--,oe+=$e[rt++]<>>8&255,Z.check=n(Z.check,Ie,2,0)),ge=oe=0}else Z.head&&(Z.head.extra=null);Z.mode=6;case 6:if(1024&Z.flags&&(it<(ue=Z.length)&&(ue=it),ue&&(Z.head&&(H=Z.head.extra_len-Z.length,Z.head.extra||(Z.head.extra=new Array(Z.head.extra_len)),f.arraySet(Z.head.extra,$e,rt,ue,H)),512&Z.flags&&(Z.check=n(Z.check,$e,ue,rt)),it-=ue,rt+=ue,Z.length-=ue),Z.length))break e;Z.length=0,Z.mode=7;case 7:if(2048&Z.flags){if(it===0)break e;for(ue=0;H=$e[rt+ue++],Z.head&&H&&Z.length<65536&&(Z.head.name+=String.fromCharCode(H)),H&&ue>9&1,Z.head.done=!0),le.adler=Z.check=0,Z.mode=12;break;case 10:for(;ge<32;){if(it===0)break e;it--,oe+=$e[rt++]<>>=7&ge,ge-=7&ge,Z.mode=27;break}for(;ge<3;){if(it===0)break e;it--,oe+=$e[rt++]<>>=1)){case 0:Z.mode=14;break;case 1:if(Ae(Z),Z.mode=20,We!==6)break;oe>>>=2,ge-=2;break e;case 2:Z.mode=17;break;case 3:le.msg="invalid block type",Z.mode=30}oe>>>=2,ge-=2;break;case 14:for(oe>>>=7&ge,ge-=7≥ge<32;){if(it===0)break e;it--,oe+=$e[rt++]<>>16^65535)){le.msg="invalid stored block lengths",Z.mode=30;break}if(Z.length=65535&oe,ge=oe=0,Z.mode=15,We===6)break e;case 15:Z.mode=16;case 16:if(ue=Z.length){if(it>>=5,ge-=5,Z.ndist=1+(31&oe),oe>>>=5,ge-=5,Z.ncode=4+(15&oe),oe>>>=4,ge-=4,286>>=3,ge-=3}for(;Z.have<19;)Z.lens[dt[Z.have++]]=0;if(Z.lencode=Z.lendyn,Z.lenbits=7,tt={bits:Z.lenbits},ut=b(0,Z.lens,0,19,Z.lencode,0,Z.work,tt),Z.lenbits=tt.bits,ut){le.msg="invalid code lengths set",Z.mode=30;break}Z.have=0,Z.mode=19;case 19:for(;Z.have>>16&255,Bt=65535&pe,!((pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>>=pt,ge-=pt,Z.lens[Z.have++]=Bt;else{if(Bt===16){for(be=pt+2;ge>>=pt,ge-=pt,Z.have===0){le.msg="invalid bit length repeat",Z.mode=30;break}H=Z.lens[Z.have-1],ue=3+(3&oe),oe>>>=2,ge-=2}else if(Bt===17){for(be=pt+3;ge>>=pt)),oe>>>=3,ge-=3}else{for(be=pt+7;ge>>=pt)),oe>>>=7,ge-=7}if(Z.have+ue>Z.nlen+Z.ndist){le.msg="invalid bit length repeat",Z.mode=30;break}for(;ue--;)Z.lens[Z.have++]=H}}if(Z.mode===30)break;if(Z.lens[256]===0){le.msg="invalid code -- missing end-of-block",Z.mode=30;break}if(Z.lenbits=9,tt={bits:Z.lenbits},ut=b(w,Z.lens,0,Z.nlen,Z.lencode,0,Z.work,tt),Z.lenbits=tt.bits,ut){le.msg="invalid literal/lengths set",Z.mode=30;break}if(Z.distbits=6,Z.distcode=Z.distdyn,tt={bits:Z.distbits},ut=b(S,Z.lens,Z.nlen,Z.ndist,Z.distcode,0,Z.work,tt),Z.distbits=tt.bits,ut){le.msg="invalid distances set",Z.mode=30;break}if(Z.mode=20,We===6)break e;case 20:Z.mode=21;case 21:if(6<=it&&258<=et){le.next_out=$t,le.avail_out=et,le.next_in=rt,le.avail_in=it,Z.hold=oe,Z.bits=ge,m(le,ee),$t=le.next_out,ct=le.output,et=le.avail_out,rt=le.next_in,$e=le.input,it=le.avail_in,oe=Z.hold,ge=Z.bits,Z.mode===12&&(Z.back=-1);break}for(Z.back=0;Xe=(pe=Z.lencode[oe&(1<>>16&255,Bt=65535&pe,!((pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>Qt)])>>>16&255,Bt=65535&pe,!(Qt+(pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>>=Qt,ge-=Qt,Z.back+=Qt}if(oe>>>=pt,ge-=pt,Z.back+=pt,Z.length=Bt,Xe===0){Z.mode=26;break}if(32&Xe){Z.back=-1,Z.mode=12;break}if(64&Xe){le.msg="invalid literal/length code",Z.mode=30;break}Z.extra=15&Xe,Z.mode=22;case 22:if(Z.extra){for(be=Z.extra;ge>>=Z.extra,ge-=Z.extra,Z.back+=Z.extra}Z.was=Z.length,Z.mode=23;case 23:for(;Xe=(pe=Z.distcode[oe&(1<>>16&255,Bt=65535&pe,!((pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>Qt)])>>>16&255,Bt=65535&pe,!(Qt+(pt=pe>>>24)<=ge);){if(it===0)break e;it--,oe+=$e[rt++]<>>=Qt,ge-=Qt,Z.back+=Qt}if(oe>>>=pt,ge-=pt,Z.back+=pt,64&Xe){le.msg="invalid distance code",Z.mode=30;break}Z.offset=Bt,Z.extra=15&Xe,Z.mode=24;case 24:if(Z.extra){for(be=Z.extra;ge>>=Z.extra,ge-=Z.extra,Z.back+=Z.extra}if(Z.offset>Z.dmax){le.msg="invalid distance too far back",Z.mode=30;break}Z.mode=25;case 25:if(et===0)break e;if(ue=ee-et,Z.offset>ue){if((ue=Z.offset-ue)>Z.whave&&Z.sane){le.msg="invalid distance too far back",Z.mode=30;break}Je=ue>Z.wnext?(ue-=Z.wnext,Z.wsize-ue):Z.wnext-ue,ue>Z.length&&(ue=Z.length),wt=Z.window}else wt=ct,Je=$t-Z.offset,ue=Z.length;for(etre?(ye=Je[wt+L[We]],ge[Me+L[We]]):(ye=96,0),B=1<>$t)+($-=B)]=ce<<24|ye<<16|Ae|0,$!==0;);for(B=1<>=1;if(B!==0?(oe&=B-1,oe+=B):oe=0,We++,--ee[le]==0){if(le===$e)break;le=S[k+L[We]]}if(ct>>7)]}function Me(pe,Ie){pe.pending_buf[pe.pending++]=255&Ie,pe.pending_buf[pe.pending++]=Ie>>>8&255}function ee(pe,Ie,dt){pe.bi_valid>D-dt?(pe.bi_buf|=Ie<>D-pe.bi_valid,pe.bi_valid+=dt-D):(pe.bi_buf|=Ie<>>=1,dt<<=1,0<--Ie;);return dt>>>1}function wt(pe,Ie,dt){var mt,je,vt=new Array(L+1),Ot=0;for(mt=1;mt<=L;mt++)vt[mt]=Ot=Ot+dt[mt-1]<<1;for(je=0;je<=Ie;je++){var St=pe[2*je+1];St!==0&&(pe[2*je]=Je(vt[St]++,St))}}function pt(pe){var Ie;for(Ie=0;Ie>1;1<=dt;dt--)Qt(pe,vt,dt);for(je=Wt;dt=pe.heap[1],pe.heap[1]=pe.heap[pe.heap_len--],Qt(pe,vt,1),mt=pe.heap[1],pe.heap[--pe.heap_max]=dt,pe.heap[--pe.heap_max]=mt,vt[2*je]=vt[2*dt]+vt[2*mt],pe.depth[je]=(pe.depth[dt]>=pe.depth[mt]?pe.depth[dt]:pe.depth[mt])+1,vt[2*dt+1]=vt[2*mt+1]=je,pe.heap[1]=je++,Qt(pe,vt,1),2<=pe.heap_len;);pe.heap[--pe.heap_max]=pe.heap[1],function(Fe,gt){var mi,ri,yr,Sr,gi,Ei,_i=gt.dyn_tree,Tt=gt.max_code,pr=gt.stat_desc.static_tree,hr=gt.stat_desc.has_stree,yi=gt.stat_desc.extra_bits,nn=gt.stat_desc.extra_base,sr=gt.stat_desc.max_length,Vi=0;for(Sr=0;Sr<=L;Sr++)Fe.bl_count[Sr]=0;for(_i[2*Fe.heap[Fe.heap_max]+1]=0,mi=Fe.heap_max+1;mi>=7;je>>=1)if(1&wr&&St.dyn_ltree[2*Wt]!==0)return d;if(St.dyn_ltree[18]!==0||St.dyn_ltree[20]!==0||St.dyn_ltree[26]!==0)return n;for(Wt=32;Wt>>3,(vt=pe.static_len+3+7>>>3)<=je&&(je=vt)):je=vt=dt+5,dt+4<=je&&Ie!==-1?be(pe,Ie,dt,mt):pe.strategy===4||vt===je?(ee(pe,2+(mt?1:0),3),Rr(pe,_t,le)):(ee(pe,4+(mt?1:0),3),function(St,Wt,wr,Fe){var gt;for(ee(St,Wt-257,5),ee(St,wr-1,5),ee(St,Fe-4,4),gt=0;gt>>8&255,pe.pending_buf[pe.d_buf+2*pe.last_lit+1]=255&Ie,pe.pending_buf[pe.l_buf+pe.last_lit]=255&dt,pe.last_lit++,Ie===0?pe.dyn_ltree[2*dt]++:(pe.matches++,Ie--,pe.dyn_ltree[2*(Z[dt]+S+1)]++,pe.dyn_dtree[2*ge(Ie)]++),pe.last_lit===pe.lit_bufsize-1},c._tr_align=function(pe){ee(pe,2,3),ue(pe,$,_t),function(Ie){Ie.bi_valid===16?(Me(Ie,Ie.bi_buf),Ie.bi_buf=0,Ie.bi_valid=0):8<=Ie.bi_valid&&(Ie.pending_buf[Ie.pending++]=255&Ie.bi_buf,Ie.bi_buf>>=8,Ie.bi_valid-=8)}(pe)}},{"../utils/common":41}],53:[function(a,l,c){l.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(a,l,c){(function(f){(function(d,n){if(!d.setImmediate){var m,b,w,S,k=1,A={},P=!1,T=d.document,L=Object.getPrototypeOf&&Object.getPrototypeOf(d);L=L&&L.setTimeout?L:d,m={}.toString.call(d.process)==="[object process]"?function(J){process.nextTick(function(){B(J)})}:function(){if(d.postMessage&&!d.importScripts){var J=!0,Y=d.onmessage;return d.onmessage=function(){J=!1},d.postMessage("","*"),d.onmessage=Y,J}}()?(S="setImmediate$"+Math.random()+"$",d.addEventListener?d.addEventListener("message",$,!1):d.attachEvent("onmessage",$),function(J){d.postMessage(S+J,"*")}):d.MessageChannel?((w=new MessageChannel).port1.onmessage=function(J){B(J.data)},function(J){w.port2.postMessage(J)}):T&&"onreadystatechange"in T.createElement("script")?(b=T.documentElement,function(J){var Y=T.createElement("script");Y.onreadystatechange=function(){B(J),Y.onreadystatechange=null,b.removeChild(Y),Y=null},b.appendChild(Y)}):function(J){setTimeout(B,0,J)},L.setImmediate=function(J){typeof J!="function"&&(J=new Function(""+J));for(var Y=new Array(arguments.length-1),ae=0;ae"u"?f===void 0?this:f:self)}).call(this,typeof Do<"u"?Do:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(by);var ES=by.exports;const kS=Vu(ES);const{document:ta}=g_;function Hg(o,r,a){const l=o.slice();return l[30]=r[a],l}function Wg(o,r,a){const l=o.slice();return l[33]=r[a],l}function Kg(o,r,a){const l=o.slice();return l[36]=r[a],l}function Xg(o){let r,a,l=o[0].selected!=null&&o[11](o[0]).missing>0&&o[0].selected.total_pop.count!=null&&o[0].selected.total_pop.count>=100,c,f,d;r=new v_({props:{mode:o[3]=="failed"?"error":"info",$$slots:{default:[DS]},$$scope:{ctx:o}}});let n=l&&Qg(o);return{c(){ir(r.$$.fragment),a=Et(),n&&n.c(),c=Et(),f=Ne("div"),this.h()},l(m){cr(r.$$.fragment,m),a=kt(m),n&&n.l(m),c=kt(m),f=Ue(m,"DIV",{}),He(f).forEach(te),this.h()},h(){It(f,"height","24px")},m(m,b){nr(r,m,b),Be(m,a,b),n&&n.m(m,b),Be(m,c,b),Be(m,f,b),d=!0},p(m,b){const w={};b[0]&8&&(w.mode=m[3]=="failed"?"error":"info"),b[0]&26|b[1]&256&&(w.$$scope={dirty:b,ctx:m}),r.$set(w),b[0]&1&&(l=m[0].selected!=null&&m[11](m[0]).missing>0&&m[0].selected.total_pop.count!=null&&m[0].selected.total_pop.count>=100),l?n?(n.p(m,b),b[0]&1&&qe(n,1)):(n=Qg(m),n.c(),qe(n,1),n.m(c.parentNode,c)):n&&(Nr(),nt(n,1,1,()=>{n=null}),Ur())},i(m){d||(qe(r.$$.fragment,m),qe(n),d=!0)},o(m){nt(r.$$.fragment,m),nt(n),d=!1},d(m){ar(r,m),m&&te(a),n&&n.d(m),m&&te(c),m&&te(f)}}}function Jg(o){let r;function a(f,d){return f[1].length===1?TS:SS}let l=a(o),c=l(o);return{c(){r=Ne("p"),c.c()},l(f){r=Ue(f,"P",{});var d=He(r);c.l(d),d.forEach(te)},m(f,d){Be(f,r,d),c.m(r,null)},p(f,d){l===(l=a(f))&&c?c.p(f,d):(c.d(1),c=l(f),c&&(c.c(),c.m(r,null)))},d(f){f&&te(r),c.d()}}}function SS(o){let r,a;function l(d,n){return d[1].length===2?CS:IS}let c=l(o),f=c(o);return{c(){r=zt("The profile below is for people with "),f.c(),a=zt(` + of the following characteristics:`)},l(d){r=Mt(d,"The profile below is for people with "),f.l(d),a=Mt(d,` + of the following characteristics:`)},m(d,n){Be(d,r,n),f.m(d,n),Be(d,a,n)},p(d,n){c!==(c=l(d))&&(f.d(1),f=c(d),f&&(f.c(),f.m(a.parentNode,a)))},d(d){d&&te(r),f.d(d),d&&te(a)}}}function TS(o){let r;return{c(){r=zt(`The profile below is for people with the following + characteristic:`)},l(a){r=Mt(a,`The profile below is for people with the following + characteristic:`)},m(a,l){Be(a,r,l)},p:_r,d(a){a&&te(r)}}}function IS(o){let r;return{c(){r=zt("all")},l(a){r=Mt(a,"all")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function CS(o){let r;return{c(){r=zt("both")},l(a){r=Mt(a,"both")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function AS(o){let r,a,l=ss(o[36].topic)+"",c,f,d=ss(Ks(o[36].label))+"",n,m,b,w,S;function k(){return o[15](o[36])}return{c(){r=Ne("button"),a=Ne("span"),c=zt(l),f=zt(": "),n=zt(d),m=Et(),b=Ne("span"),this.h()},l(A){r=Ue(A,"BUTTON",{class:!0});var P=He(r);a=Ue(P,"SPAN",{class:!0});var T=He(a);c=Mt(T,l),f=Mt(T,": "),n=Mt(T,d),T.forEach(te),m=kt(P),b=Ue(P,"SPAN",{class:!0}),He(b).forEach(te),P.forEach(te),this.h()},h(){_e(a,"class","chip-text svelte-hd3bon"),_e(b,"class","chip-ready svelte-hd3bon"),_e(r,"class","chip svelte-hd3bon")},m(A,P){Be(A,r,P),Pe(r,a),Pe(a,c),Pe(a,f),Pe(a,n),Pe(r,m),Pe(r,b),w||(S=ba(r,"click",k),w=!0)},p(A,P){o=A,P[0]&2&&l!==(l=ss(o[36].topic)+"")&&kr(c,l),P[0]&2&&d!==(d=ss(Ks(o[36].label))+"")&&kr(n,d)},d(A){A&&te(r),w=!1,S()}}}function PS(o){let r,a,l=ss(o[36].topic)+"",c,f,d=ss(Ks(o[36].label))+"",n,m,b;return{c(){r=Ne("div"),a=Ne("span"),c=zt(l),f=zt(": "),n=zt(d),m=Et(),b=Ne("div"),this.h()},l(w){r=Ue(w,"DIV",{class:!0});var S=He(r);a=Ue(S,"SPAN",{class:!0});var k=He(a);c=Mt(k,l),f=Mt(k,": "),n=Mt(k,d),k.forEach(te),m=kt(S),b=Ue(S,"DIV",{class:!0}),He(b).forEach(te),S.forEach(te),this.h()},h(){_e(a,"class","chip-text svelte-hd3bon"),_e(b,"class","chip-loader svelte-hd3bon"),_e(r,"class","chip chip-pending svelte-hd3bon")},m(w,S){Be(w,r,S),Pe(r,a),Pe(a,c),Pe(a,f),Pe(a,n),Pe(r,m),Pe(r,b)},p(w,S){S[0]&2&&l!==(l=ss(w[36].topic)+"")&&kr(c,l),S[0]&2&&d!==(d=ss(Ks(w[36].label))+"")&&kr(n,d)},d(w){w&&te(r)}}}function Yg(o){let r;function a(f,d){return f[3]=="loading"?PS:AS}let l=a(o),c=l(o);return{c(){c.c(),r=er()},l(f){c.l(f),r=er()},m(f,d){c.m(f,d),Be(f,r,d)},p(f,d){l===(l=a(f))&&c?c.p(f,d):(c.d(1),c=l(f),c&&(c.c(),c.m(r.parentNode,r)))},d(f){c.d(f),f&&te(r)}}}function zS(o){let r,a;return{c(){r=Ne("p"),a=zt(`Economic indicators (employment, social status etc) are not + available for ages 0 to 15.`),this.h()},l(l){r=Ue(l,"P",{});var c=He(r);a=Mt(c,`Economic indicators (employment, social status etc) are not + available for ages 0 to 15.`),c.forEach(te),this.h()},h(){It(r,"margin","1rem 0 0")},m(l,c){Be(l,r,c),Pe(r,a)},d(l){l&&te(r)}}}function MS(o){let r,a;return{c(){r=Ne("p"),a=zt(`No data is available for the selected variables. Try removing a + variable to see more datasets.`),this.h()},l(l){r=Ue(l,"P",{});var c=He(r);a=Mt(c,`No data is available for the selected variables. Try removing a + variable to see more datasets.`),c.forEach(te),this.h()},h(){It(r,"margin","1rem 0 0")},m(l,c){Be(l,r,c),Pe(r,a)},d(l){l&&te(r)}}}function DS(o){let r,a,l,c=o[3]!="failed"&&Jg(o),f=o[1],d=[];for(let w=0;wNo(r,"activeColumn",f)),Za.push(()=>No(r,"activeCategory",d)),{c(){ir(r.$$.fragment)},l(m){cr(r.$$.fragment,m)},m(m,b){nr(r,m,b),c=!0},p(m,b){const w={};b[0]&2&&(w.globalSelectedCategories=m[1]),b[0]&8&&(w.disabled=m[3]==="loading"),!s&&b[0]&32&&(s=!0,w.activeColumn=m[5],Uo(()=>s=!1)),!l&&b[0]&64&&(l=!0,w.activeCategory=m[6],Uo(()=>l=!1)),r.$set(w)},i(m){c||(qe(r.$$.fragment,m),c=!0)},o(m){nt(r.$$.fragment,m),c=!1},d(m){sr(r,m)}}}function OS(o){let r,s,l,c,f,d,n,m,b,w,S,k,A,P,T=o[1][0]&&Yg(o);function L(B){o[18](B)}let D={title:o[1][0]?o[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile",$$slots:{default:[BS]},$$scope:{ctx:o}};return o[2]!==void 0&&(D.open=o[2]),k=new ES({props:D}),Za.push(()=>No(k,"open",L)),{c(){r=Ne("div"),s=Ne("p"),l=zt(`Select one or more identity characteristics to define a population group, - for example - `),c=Ne("a"),f=zt("people born in the UK who are disabled"),d=zt(` - or - `),n=Ne("a"),m=zt("people aged 65 and over who hold a non-UK passort"),b=zt(`. Once selected, you will see how this group compares to the whole - population of England and Wales, based on Census 2021 data.`),w=Et(),T&&T.c(),S=Et(),ir(k.$$.fragment),this.h()},l(B){r=Ue(B,"DIV",{slot:!0});var $=He(r);s=Ue($,"P",{class:!0});var J=He(s);l=Mt(J,`Select one or more identity characteristics to define a population group, - for example - `),c=Ue(J,"A",{href:!0,class:!0});var Y=He(c);f=Mt(Y,"people born in the UK who are disabled"),Y.forEach(te),d=Mt(J,` - or - `),n=Ue(J,"A",{href:!0,class:!0});var se=He(n);m=Mt(se,"people aged 65 and over who hold a non-UK passort"),se.forEach(te),b=Mt(J,`. Once selected, you will see how this group compares to the whole - population of England and Wales, based on Census 2021 data.`),J.forEach(te),w=kt($),T&&T.l($),S=kt($),cr(k.$$.fragment,$),$.forEach(te),this.h()},h(){_e(c,"href","?disability_3a=1&country_of_birth_3a=1"),_e(c,"class","svelte-hd3bon"),_e(n,"href","?resident_age_3a=3&passports_all_4a=2"),_e(n,"class","svelte-hd3bon"),_e(s,"class","subtitle svelte-hd3bon"),_e(r,"slot","after")},m(B,$){Be(B,r,$),Pe(r,s),Pe(s,l),Pe(s,c),Pe(c,f),Pe(s,d),Pe(s,n),Pe(n,m),Pe(s,b),Pe(r,w),T&&T.m(r,null),Pe(r,S),nr(k,r,null),P=!0},p(B,$){B[1][0]?T?(T.p(B,$),$[0]&2&&qe(T,1)):(T=Yg(B),T.c(),qe(T,1),T.m(r,S)):T&&(Nr(),nt(T,1,1,()=>{T=null}),Ur());const J={};$[0]&2&&(J.title=B[1][0]?B[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile"),$[0]&106|$[1]&256&&(J.$$scope={dirty:$,ctx:B}),!A&&$[0]&4&&(A=!0,J.open=B[2],Uo(()=>A=!1)),k.$set(J)},i(B){P||(qe(T),qe(k.$$.fragment,B),P=!0)},o(B){nt(T),nt(k.$$.fragment,B),P=!1},d(B){B&&te(r),T&&T.d(),sr(k)}}}function r_(o){let r,s,l,c,f,d;r=new ic({props:{cls:"show-overflow",width:"wide",$$slots:{default:[US]},$$scope:{ctx:o}}}),l=new Tf({props:{title:"Demographics",height:"auto",$$slots:{default:[jS]},$$scope:{ctx:o}}});let n=o[0].selected.total_pop.count!=null&&o[0].selected.total_pop.count>=100&&n_(o);return{c(){ir(r.$$.fragment),s=Et(),ir(l.$$.fragment),c=Et(),n&&n.c(),f=er()},l(m){cr(r.$$.fragment,m),s=kt(m),cr(l.$$.fragment,m),c=kt(m),n&&n.l(m),f=er()},m(m,b){nr(r,m,b),Be(m,s,b),nr(l,m,b),Be(m,c,b),n&&n.m(m,b),Be(m,f,b),d=!0},p(m,b){const w={};b[0]&1|b[1]&256&&(w.$$scope={dirty:b,ctx:m}),r.$set(w);const S={};b[0]&3|b[1]&256&&(S.$$scope={dirty:b,ctx:m}),l.$set(S),m[0].selected.total_pop.count!=null&&m[0].selected.total_pop.count>=100?n?(n.p(m,b),b[0]&1&&qe(n,1)):(n=n_(m),n.c(),qe(n,1),n.m(f.parentNode,f)):n&&(Nr(),nt(n,1,1,()=>{n=null}),Ur())},i(m){d||(qe(r.$$.fragment,m),qe(l.$$.fragment,m),qe(n),d=!0)},o(m){nt(r.$$.fragment,m),nt(l.$$.fragment,m),nt(n),d=!1},d(m){sr(r,m),m&&te(s),sr(l,m),m&&te(c),n&&n.d(m),m&&te(f)}}}function FS(o){let r;return{c(){r=zt("Print profile")},l(s){r=Mt(s,"Print profile")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function NS(o){let r;return{c(){r=zt("Download data")},l(s){r=Mt(s,"Download data")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function US(o){let r,s,l,c,f;return s=new ff({props:{variant:"secondary",icon:"print",small:!0,$$slots:{default:[FS]},$$scope:{ctx:o}}}),s.$on("click",o[13]),c=new ff({props:{variant:"secondary",icon:"download",small:!0,$$slots:{default:[NS]},$$scope:{ctx:o}}}),c.$on("click",o[19]),{c(){r=Ne("div"),ir(s.$$.fragment),l=Et(),ir(c.$$.fragment),this.h()},l(d){r=Ue(d,"DIV",{class:!0});var n=He(r);cr(s.$$.fragment,n),l=kt(n),cr(c.$$.fragment,n),n.forEach(te),this.h()},h(){_e(r,"class","action-buttons svelte-hd3bon")},m(d,n){Be(d,r,n),nr(s,r,null),Pe(r,l),nr(c,r,null),f=!0},p(d,n){const m={};n[1]&256&&(m.$$scope={dirty:n,ctx:d}),s.$set(m);const b={};n[1]&256&&(b.$$scope={dirty:n,ctx:d}),c.$set(b)},i(d){f||(qe(s.$$.fragment,d),qe(c.$$.fragment,d),f=!0)},o(d){nt(s.$$.fragment,d),nt(c.$$.fragment,d),f=!1},d(d){d&&te(r),sr(s),sr(c)}}}function VS(o){let r;return{c(){r=zt("Number of people, age and sex compared to the population as a whole.")},l(s){r=Mt(s,"Number of people, age and sex compared to the population as a whole.")},m(s,l){Be(s,r,l)},d(s){s&&te(r)}}}function $S(o){let r,s;return r=new xy({props:{$$slots:{default:[VS]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c[1]&256&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function i_(o){let r,s;return r=new by({props:{title:"Sex",table:{code:"sex",key:"Sex"},data:o[0],chart_type:o[7]}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),s=!0},p(l,c){const f={};c[0]&1&&(f.data=l[0]),r.$set(f)},i(l){s||(qe(r.$$.fragment,l),s=!0)},o(l){nt(r.$$.fragment,l),s=!1},d(l){sr(r,l)}}}function jS(o){let r,s,l,c,f,d,n=!o[1].map(l_).includes("sex")&&o[0].selected.residents.sex.values!=="blocked",m,b;r=new Os({props:{colspan:3,noBackground:!0,$$slots:{default:[$S]},$$scope:{ctx:o}}}),l=new eS({props:{data:o[0]}}),f=new gS({props:{data:o[0],selected:o[1]}});let w=n&&i_(o);return{c(){ir(r.$$.fragment),s=Et(),ir(l.$$.fragment),c=Et(),ir(f.$$.fragment),d=Et(),w&&w.c(),m=er()},l(S){cr(r.$$.fragment,S),s=kt(S),cr(l.$$.fragment,S),c=kt(S),cr(f.$$.fragment,S),d=kt(S),w&&w.l(S),m=er()},m(S,k){nr(r,S,k),Be(S,s,k),nr(l,S,k),Be(S,c,k),nr(f,S,k),Be(S,d,k),w&&w.m(S,k),Be(S,m,k),b=!0},p(S,k){const A={};k[1]&256&&(A.$$scope={dirty:k,ctx:S}),r.$set(A);const P={};k[0]&1&&(P.data=S[0]),l.$set(P);const T={};k[0]&1&&(T.data=S[0]),k[0]&2&&(T.selected=S[1]),f.$set(T),k[0]&3&&(n=!S[1].map(l_).includes("sex")&&S[0].selected.residents.sex.values!=="blocked"),n?w?(w.p(S,k),k[0]&3&&qe(w,1)):(w=i_(S),w.c(),qe(w,1),w.m(m.parentNode,m)):w&&(Nr(),nt(w,1,1,()=>{w=null}),Ur())},i(S){b||(qe(r.$$.fragment,S),qe(l.$$.fragment,S),qe(f.$$.fragment,S),qe(w),b=!0)},o(S){nt(r.$$.fragment,S),nt(l.$$.fragment,S),nt(f.$$.fragment,S),nt(w),b=!1},d(S){sr(r,S),S&&te(s),sr(l,S),S&&te(c),sr(f,S),S&&te(d),w&&w.d(S),S&&te(m)}}}function n_(o){let r,s,l,c;r=new Fk({props:{data:o[0],mapStyle:f1,mapBounds:d1,ladBounds:Gl,selected:o[1],colors:Do}});let f=Oo[0].tablesCategorised,d=[];for(let m=0;mnt(d[m],1,1,()=>{d[m]=null});return{c(){ir(r.$$.fragment),s=Et();for(let m=0;mnt(d[m],1,1,()=>{d[m]=null});return{c(){ir(r.$$.fragment),s=Et();for(let m=0;m{c=null}),Ur())},i(f){l||(qe(c),l=!0)},o(f){nt(c),l=!1},d(f){c&&c.d(f),f&&te(s)}}}function HS(o){let r,s,l,c,f,d,n,m,b,w,S,k,A,P,T,L;S=new P1({props:{links:[{label:"Census",href:"/census"},{label:"Create a population group profile"}]}}),A=new nv({props:{title:"Create a population group profile",$$slots:{after:[OS]},$$scope:{ctx:o}}});let D=o[3]=="success"&&o[1].length>0&&r_(o);return{c(){r=Ne("meta"),s=Ne("meta"),l=Ne("meta"),c=Ne("meta"),f=Ne("meta"),d=Ne("meta"),n=Ne("meta"),m=Ne("meta"),b=Ne("link"),w=Et(),ir(S.$$.fragment),k=Et(),ir(A.$$.fragment),P=Et(),D&&D.c(),T=er(),this.h()},l(B){const $=__("svelte-zk6idd",ts.head);r=Ue($,"META",{property:!0,content:!0}),s=Ue($,"META",{property:!0,content:!0}),l=Ue($,"META",{property:!0,content:!0}),c=Ue($,"META",{property:!0,content:!0}),f=Ue($,"META",{name:!0,content:!0}),d=Ue($,"META",{property:!0,content:!0}),n=Ue($,"META",{name:!0,content:!0}),m=Ue($,"META",{property:!0,content:!0}),b=Ue($,"LINK",{rel:!0,href:!0}),$.forEach(te),w=kt(B),cr(S.$$.fragment,B),k=kt(B),cr(A.$$.fragment,B),P=kt(B),D&&D.l(B),T=er(),this.h()},h(){ts.title="Create a population group profile - Census 2021 - ONS",_e(r,"property","og:title"),_e(r,"content","Create a population group profile - Census 2021"),_e(s,"property","og:type"),_e(s,"content","website"),_e(l,"property","og:image"),_e(l,"content","https://www.ons.gov.uk"+Hl+"/img/og.png"),_e(c,"property","og:image:type"),_e(c,"content","image/png"),_e(f,"name","twitter:card"),_e(f,"content","summary_large_image"),_e(d,"property","og:description"),_e(d,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),_e(n,"name","description"),_e(n,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),_e(m,"property","og:url"),_e(m,"content","https://www.ons.gov.uk"+Hl),_e(b,"rel","canonical"),_e(b,"href","https://www.ons.gov.uk"+Hl)},m(B,$){Pe(ts.head,r),Pe(ts.head,s),Pe(ts.head,l),Pe(ts.head,c),Pe(ts.head,f),Pe(ts.head,d),Pe(ts.head,n),Pe(ts.head,m),Pe(ts.head,b),Be(B,w,$),nr(S,B,$),Be(B,k,$),nr(A,B,$),Be(B,P,$),D&&D.m(B,$),Be(B,T,$),L=!0},p(B,$){const J={};$[0]&127|$[1]&256&&(J.$$scope={dirty:$,ctx:B}),A.$set(J),B[3]=="success"&&B[1].length>0?D?(D.p(B,$),$[0]&10&&qe(D,1)):(D=r_(B),D.c(),qe(D,1),D.m(T.parentNode,T)):D&&(Nr(),nt(D,1,1,()=>{D=null}),Ur())},i(B){L||(qe(S.$$.fragment,B),qe(A.$$.fragment,B),qe(D),L=!0)},o(B){nt(S.$$.fragment,B),nt(A.$$.fragment,B),nt(D),L=!1},d(B){te(r),te(s),te(l),te(c),te(f),te(d),te(n),te(m),te(b),B&&te(w),sr(S,B),B&&te(k),sr(A,B),B&&te(P),D&&D.d(B),B&&te(T)}}}let WS="light";function KS(o){let r=[];o.forEach(l=>r.push(l[0]));const s=o.flat().pop();return(o.length===1||s!=r[r.length-1])&&r.push(s),r}const l_=o=>o.key;function XS(o,r,s){let l;Uu(o,y1,Z=>s(22,l=Z));let{data:c}=r;qa("theme",p1[WS]);let f=[],d=!1,n="success",m=!1,b=X2,w=null,S=null;function k(){U2(`${Hl}?${f.map(Z=>`${Z.key}=${Z.code}`).join("&")}`,{noScroll:!0,keepFocus:!0})}function A(Z,$e){s(1,f=[...f.filter(ct=>ct.topic!==Z.shortLabel),{topic:Z.shortLabel,key:Z.key,...$e}]),Yh({event:"variableSelect",variable:Z.shortLabel,category:$e.label,count:f.length}),s(2,d=!1),s(5,w=null),s(6,S=null),k()}function P(Z){s(1,f=f.filter($e=>$e.topic!==Z.shortLabel)),k()}function T(Z){s(1,f=f.filter($e=>$e.topic!=Z)),k()}function L(Z,$e,ct){for(const rt of $e)Au(rt,Z)?++ct.available:Z.selected.residents[rt].values!==void 0&&++ct.missing}function D(Z){let $e={available:0,missing:0};for(const ct of Oo[0].tablesCategorised)L(Z,ct.tables.map(rt=>rt.code),$e);return L(Z,["sex","resident_age_18b"],$e),$e}function B(Z){let $e=F2(Z,Oo,f);const ct=new SS;for(let{filename:rt,contents:$t}of $e)ct.file(rt,$t,{compression:rt==="mimetype"?"STORE":"DEFLATE"});ct.generateAsync({type:"blob"}).then(rt=>{let $t=new Blob([rt],{type:"application/vnd.oasis.opendocument.spreadsheet"}),it=URL.createObjectURL($t);var et=document.createElement("a");et.setAttribute("href",it),et.setAttribute("download","data-download.ods"),et.style.display="none",document.body.appendChild(et),et.click(),document.body.removeChild(et),URL.revokeObjectURL(it)}),Yh({event:"fileDownload",fileExtension:"ods",selection:f.map(rt=>`${rt.topic}: ${rt.label}`)})}function $(){Yh({event:"pagePrint",selection:f.map(Z=>`${Z.topic}: ${Z.label}`)}),print()}function J(Z){s(0,c.selected=Z.data,c),s(0,c.selected.total_pop=Z.total_pop,c),s(0,c.geoPerc=[],c);let $e;c.geoCodesAndNames.forEach(({code:rt,name:$t})=>{let it=f.length===0?100:Z.mapData[rt]!=null?Z.mapData[rt][1]:null,et=f.length===0?-1:Z.mapData[rt]!=null?Z.mapData[rt][0]:null;c.geoPerc.push({code:rt,name:$t,value:it,count:et})});let ct=c.geoPerc.map(rt=>rt.value).filter(rt=>rt!=null);if($e=ct.length===0?null:G2(ct,Math.min(5,ct.length)),!$e)c.geoPerc.forEach(rt=>rt.color=Do.nodata),s(0,c.geoBreaks=[0,100],c);else if(f.length===0)c.geoPerc.forEach(rt=>rt.color=Do.seq[4]),s(0,c.geoBreaks=[100,100],c);else{let rt=KS($e);c.geoPerc.forEach($t=>$t.color=$t.value!=null?L2($t.value,rt,Do.seq):Do.nodata),s(0,c.geoBreaks=rt,c)}f.length,s(3,n=c.selected.total_pop.count==null?"failed":"success")}function Y(){s(3,n="loading"),s(4,m=f&&f.some(Z=>["Aged 4 years and under","Aged 5 to 9 years","Aged 10 to 14 years","Aged 15 years and under"].includes(Z.label))),iy(Oo,f).then(J)}function se(){s(1,f=[]);for(let Z of l.url.searchParams.entries()){let $e=m1.find(rt=>rt.key==Z[0]);if(!$e)continue;let ct=$e.cats.find(rt=>rt.code==Z[1]);ct&&f.push({topic:$e.shortLabel,key:$e.key,...ct})}Y()}V2(se);const re=Z=>Au(Z.code,c),ce=Z=>T(Z.topic);function ye(Z){w=Z,s(5,w)}function Ae(Z){S=Z,s(6,S)}function _t(Z){d=Z,s(2,d)}const le=()=>B(c),We=Z=>Au(Z.code,c);return o.$$set=Z=>{"data"in Z&&s(0,c=Z.data)},o.$$.update=()=>{o.$$.dirty[0]&2&&console.log("selected",f)},[c,f,d,n,m,w,S,b,A,P,T,D,B,$,re,ce,ye,Ae,_t,le,We]}class sT extends Wr{constructor(r){super(),Kr(this,r,XS,HS,jr,{data:0},null,[-1,-1])}}export{sT as component,iT as universal}; + prevents some datasets from being included.`),this.h()},h(){_e(w,"href","https://www.ons.gov.uk/peoplepopulationandcommunity/populationandmigration/populationestimates/methodologies/protectingpersonaldataincensus2021results"),_e(w,"class","svelte-hd3bon")},m(A,P){Be(A,r,P),Pe(r,l),Pe(r,c),Pe(r,d),Pe(r,n),Be(A,m,P),Be(A,b,P),Be(A,w,P),Pe(w,S),Be(A,k,P)},p(A,P){P[0]&1&&a!==(a=A[11](A[0]).available+"")&&kr(l,a),P[0]&1&&f!==(f=A[11](A[0]).missing+A[11](A[0]).available+"")&&kr(d,f)},d(A){A&&te(r),A&&te(m),A&&te(b),A&&te(w),A&&te(k)}}}function LS(o){let r,a,l,c;function f(m){o[16](m)}function d(m){o[17](m)}let n={options:p1,clickCallback:o[8],removeCatCallback:o[9],globalSelectedCategories:o[1],disabled:o[3]==="loading"};return o[5]!==void 0&&(n.activeColumn=o[5]),o[6]!==void 0&&(n.activeCategory=o[6]),r=new mE({props:n}),Zs.push(()=>Fo(r,"activeColumn",f)),Zs.push(()=>Fo(r,"activeCategory",d)),{c(){ir(r.$$.fragment)},l(m){cr(r.$$.fragment,m)},m(m,b){nr(r,m,b),c=!0},p(m,b){const w={};b[0]&2&&(w.globalSelectedCategories=m[1]),b[0]&8&&(w.disabled=m[3]==="loading"),!a&&b[0]&32&&(a=!0,w.activeColumn=m[5],No(()=>a=!1)),!l&&b[0]&64&&(l=!0,w.activeCategory=m[6],No(()=>l=!1)),r.$set(w)},i(m){c||(qe(r.$$.fragment,m),c=!0)},o(m){nt(r.$$.fragment,m),c=!1},d(m){ar(r,m)}}}function BS(o){let r,a,l,c,f,d,n,m,b,w,S,k,A,P,T=o[1][0]&&Xg(o);function L(B){o[18](B)}let D={title:o[1][0]?o[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile",$$slots:{default:[LS]},$$scope:{ctx:o}};return o[2]!==void 0&&(D.open=o[2]),k=new wS({props:D}),Zs.push(()=>Fo(k,"open",L)),{c(){r=Ne("div"),a=Ne("p"),l=zt(`Select one or more identity characteristics to define a population group, + for example people whose + `),c=Ne("a"),f=zt("main language is Spanish"),d=zt(` + or people + `),n=Ne("a"),m=zt("born in the UK who are disabled under the Equality Act"),b=zt(`. Once selected, you will see how your selected group compares to the whole + population of England and Wales, based on Census 2021 data.`),w=Et(),T&&T.c(),S=Et(),ir(k.$$.fragment),this.h()},l(B){r=Ue(B,"DIV",{slot:!0});var $=He(r);a=Ue($,"P",{class:!0});var J=He(a);l=Mt(J,`Select one or more identity characteristics to define a population group, + for example people whose + `),c=Ue(J,"A",{href:!0,"data-sveltekit-noscroll":!0,class:!0});var Y=He(c);f=Mt(Y,"main language is Spanish"),Y.forEach(te),d=Mt(J,` + or people + `),n=Ue(J,"A",{href:!0,"data-sveltekit-noscroll":!0,class:!0});var ae=He(n);m=Mt(ae,"born in the UK who are disabled under the Equality Act"),ae.forEach(te),b=Mt(J,`. Once selected, you will see how your selected group compares to the whole + population of England and Wales, based on Census 2021 data.`),J.forEach(te),w=kt($),T&&T.l($),S=kt($),cr(k.$$.fragment,$),$.forEach(te),this.h()},h(){_e(c,"href","?main_language_23a=6"),_e(c,"data-sveltekit-noscroll",""),_e(c,"class","svelte-hd3bon"),_e(n,"href","?disability_3a=1&country_of_birth_3a=1"),_e(n,"data-sveltekit-noscroll",""),_e(n,"class","svelte-hd3bon"),_e(a,"class","subtitle svelte-hd3bon"),_e(r,"slot","after")},m(B,$){Be(B,r,$),Pe(r,a),Pe(a,l),Pe(a,c),Pe(c,f),Pe(a,d),Pe(a,n),Pe(n,m),Pe(a,b),Pe(r,w),T&&T.m(r,null),Pe(r,S),nr(k,r,null),P=!0},p(B,$){B[1][0]?T?(T.p(B,$),$[0]&2&&qe(T,1)):(T=Xg(B),T.c(),qe(T,1),T.m(r,S)):T&&(Nr(),nt(T,1,1,()=>{T=null}),Ur());const J={};$[0]&2&&(J.title=B[1][0]?B[1][2]?"Change selected characteristics":"Add another characteristic":"Start creating profile"),$[0]&106|$[1]&256&&(J.$$scope={dirty:$,ctx:B}),!A&&$[0]&4&&(A=!0,J.open=B[2],No(()=>A=!1)),k.$set(J)},i(B){P||(qe(T),qe(k.$$.fragment,B),P=!0)},o(B){nt(T),nt(k.$$.fragment,B),P=!1},d(B){B&&te(r),T&&T.d(),ar(k)}}}function e_(o){let r,a,l,c,f,d;r=new rc({props:{cls:"show-overflow",width:"wide",$$slots:{default:[NS]},$$scope:{ctx:o}}}),l=new Sf({props:{title:"Demographics",height:"auto",$$slots:{default:[$S]},$$scope:{ctx:o}}});let n=o[0].selected.total_pop.count!=null&&o[0].selected.total_pop.count>=100&&r_(o);return{c(){ir(r.$$.fragment),a=Et(),ir(l.$$.fragment),c=Et(),n&&n.c(),f=er()},l(m){cr(r.$$.fragment,m),a=kt(m),cr(l.$$.fragment,m),c=kt(m),n&&n.l(m),f=er()},m(m,b){nr(r,m,b),Be(m,a,b),nr(l,m,b),Be(m,c,b),n&&n.m(m,b),Be(m,f,b),d=!0},p(m,b){const w={};b[0]&1|b[1]&256&&(w.$$scope={dirty:b,ctx:m}),r.$set(w);const S={};b[0]&3|b[1]&256&&(S.$$scope={dirty:b,ctx:m}),l.$set(S),m[0].selected.total_pop.count!=null&&m[0].selected.total_pop.count>=100?n?(n.p(m,b),b[0]&1&&qe(n,1)):(n=r_(m),n.c(),qe(n,1),n.m(f.parentNode,f)):n&&(Nr(),nt(n,1,1,()=>{n=null}),Ur())},i(m){d||(qe(r.$$.fragment,m),qe(l.$$.fragment,m),qe(n),d=!0)},o(m){nt(r.$$.fragment,m),nt(l.$$.fragment,m),nt(n),d=!1},d(m){ar(r,m),m&&te(a),ar(l,m),m&&te(c),n&&n.d(m),m&&te(f)}}}function OS(o){let r;return{c(){r=zt("Print profile")},l(a){r=Mt(a,"Print profile")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function FS(o){let r;return{c(){r=zt("Download data")},l(a){r=Mt(a,"Download data")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function NS(o){let r,a,l,c,f;return a=new hf({props:{variant:"secondary",icon:"print",small:!0,$$slots:{default:[OS]},$$scope:{ctx:o}}}),a.$on("click",o[13]),c=new hf({props:{variant:"secondary",icon:"download",small:!0,$$slots:{default:[FS]},$$scope:{ctx:o}}}),c.$on("click",o[19]),{c(){r=Ne("div"),ir(a.$$.fragment),l=Et(),ir(c.$$.fragment),this.h()},l(d){r=Ue(d,"DIV",{class:!0});var n=He(r);cr(a.$$.fragment,n),l=kt(n),cr(c.$$.fragment,n),n.forEach(te),this.h()},h(){_e(r,"class","action-buttons svelte-hd3bon")},m(d,n){Be(d,r,n),nr(a,r,null),Pe(r,l),nr(c,r,null),f=!0},p(d,n){const m={};n[1]&256&&(m.$$scope={dirty:n,ctx:d}),a.$set(m);const b={};n[1]&256&&(b.$$scope={dirty:n,ctx:d}),c.$set(b)},i(d){f||(qe(a.$$.fragment,d),qe(c.$$.fragment,d),f=!0)},o(d){nt(a.$$.fragment,d),nt(c.$$.fragment,d),f=!1},d(d){d&&te(r),ar(a),ar(c)}}}function US(o){let r;return{c(){r=zt("Number of people, age and sex compared to the population as a whole.")},l(a){r=Mt(a,"Number of people, age and sex compared to the population as a whole.")},m(a,l){Be(a,r,l)},d(a){a&&te(r)}}}function VS(o){let r,a;return r=new vy({props:{$$slots:{default:[US]},$$scope:{ctx:o}}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c[1]&256&&(f.$$scope={dirty:c,ctx:l}),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function t_(o){let r,a;return r=new yy({props:{title:"Sex",table:{code:"sex",key:"Sex"},data:o[0],chart_type:o[7]}}),{c(){ir(r.$$.fragment)},l(l){cr(r.$$.fragment,l)},m(l,c){nr(r,l,c),a=!0},p(l,c){const f={};c[0]&1&&(f.data=l[0]),r.$set(f)},i(l){a||(qe(r.$$.fragment,l),a=!0)},o(l){nt(r.$$.fragment,l),a=!1},d(l){ar(r,l)}}}function $S(o){let r,a,l,c,f,d,n=!o[1].map(s_).includes("sex")&&o[0].selected.residents.sex.values!=="blocked",m,b;r=new Oa({props:{colspan:3,noBackground:!0,$$slots:{default:[VS]},$$scope:{ctx:o}}}),l=new Qk({props:{data:o[0]}}),f=new mS({props:{data:o[0],selected:o[1]}});let w=n&&t_(o);return{c(){ir(r.$$.fragment),a=Et(),ir(l.$$.fragment),c=Et(),ir(f.$$.fragment),d=Et(),w&&w.c(),m=er()},l(S){cr(r.$$.fragment,S),a=kt(S),cr(l.$$.fragment,S),c=kt(S),cr(f.$$.fragment,S),d=kt(S),w&&w.l(S),m=er()},m(S,k){nr(r,S,k),Be(S,a,k),nr(l,S,k),Be(S,c,k),nr(f,S,k),Be(S,d,k),w&&w.m(S,k),Be(S,m,k),b=!0},p(S,k){const A={};k[1]&256&&(A.$$scope={dirty:k,ctx:S}),r.$set(A);const P={};k[0]&1&&(P.data=S[0]),l.$set(P);const T={};k[0]&1&&(T.data=S[0]),k[0]&2&&(T.selected=S[1]),f.$set(T),k[0]&3&&(n=!S[1].map(s_).includes("sex")&&S[0].selected.residents.sex.values!=="blocked"),n?w?(w.p(S,k),k[0]&3&&qe(w,1)):(w=t_(S),w.c(),qe(w,1),w.m(m.parentNode,m)):w&&(Nr(),nt(w,1,1,()=>{w=null}),Ur())},i(S){b||(qe(r.$$.fragment,S),qe(l.$$.fragment,S),qe(f.$$.fragment,S),qe(w),b=!0)},o(S){nt(r.$$.fragment,S),nt(l.$$.fragment,S),nt(f.$$.fragment,S),nt(w),b=!1},d(S){ar(r,S),S&&te(a),ar(l,S),S&&te(c),ar(f,S),S&&te(d),w&&w.d(S),S&&te(m)}}}function r_(o){let r,a,l,c;r=new Ok({props:{data:o[0],mapStyle:u1,mapBounds:h1,ladBounds:ql,selected:o[1],colors:Mo}});let f=Bo[0].tablesCategorised,d=[];for(let m=0;mnt(d[m],1,1,()=>{d[m]=null});return{c(){ir(r.$$.fragment),a=Et();for(let m=0;mnt(d[m],1,1,()=>{d[m]=null});return{c(){ir(r.$$.fragment),a=Et();for(let m=0;m{c=null}),Ur())},i(f){l||(qe(c),l=!0)},o(f){nt(c),l=!1},d(f){c&&c.d(f),f&&te(a)}}}function ZS(o){let r,a,l,c,f,d,n,m,b,w,S,k,A,P,T,L;S=new C1({props:{links:[{label:"Census",href:"/census"},{label:"Create a population group profile"}]}}),A=new rv({props:{title:"Create a population group profile",$$slots:{after:[BS]},$$scope:{ctx:o}}});let D=o[3]=="success"&&o[1].length>0&&e_(o);return{c(){r=Ne("meta"),a=Ne("meta"),l=Ne("meta"),c=Ne("meta"),f=Ne("meta"),d=Ne("meta"),n=Ne("meta"),m=Ne("meta"),b=Ne("link"),w=Et(),ir(S.$$.fragment),k=Et(),ir(A.$$.fragment),P=Et(),D&&D.c(),T=er(),this.h()},l(B){const $=m_("svelte-zk6idd",ta.head);r=Ue($,"META",{property:!0,content:!0}),a=Ue($,"META",{property:!0,content:!0}),l=Ue($,"META",{property:!0,content:!0}),c=Ue($,"META",{property:!0,content:!0}),f=Ue($,"META",{name:!0,content:!0}),d=Ue($,"META",{property:!0,content:!0}),n=Ue($,"META",{name:!0,content:!0}),m=Ue($,"META",{property:!0,content:!0}),b=Ue($,"LINK",{rel:!0,href:!0}),$.forEach(te),w=kt(B),cr(S.$$.fragment,B),k=kt(B),cr(A.$$.fragment,B),P=kt(B),D&&D.l(B),T=er(),this.h()},h(){ta.title="Create a population group profile - Census 2021 - ONS",_e(r,"property","og:title"),_e(r,"content","Create a population group profile - Census 2021"),_e(a,"property","og:type"),_e(a,"content","website"),_e(l,"property","og:image"),_e(l,"content","https://www.ons.gov.uk"+Zl+"/img/og.png"),_e(c,"property","og:image:type"),_e(c,"content","image/png"),_e(f,"name","twitter:card"),_e(f,"content","summary_large_image"),_e(d,"property","og:description"),_e(d,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),_e(n,"name","description"),_e(n,"content","Select multiple datasets to define a population group based on Census 2021 England and Wales data."),_e(m,"property","og:url"),_e(m,"content","https://www.ons.gov.uk"+Zl),_e(b,"rel","canonical"),_e(b,"href","https://www.ons.gov.uk"+Zl)},m(B,$){Pe(ta.head,r),Pe(ta.head,a),Pe(ta.head,l),Pe(ta.head,c),Pe(ta.head,f),Pe(ta.head,d),Pe(ta.head,n),Pe(ta.head,m),Pe(ta.head,b),Be(B,w,$),nr(S,B,$),Be(B,k,$),nr(A,B,$),Be(B,P,$),D&&D.m(B,$),Be(B,T,$),L=!0},p(B,$){const J={};$[0]&127|$[1]&256&&(J.$$scope={dirty:$,ctx:B}),A.$set(J),B[3]=="success"&&B[1].length>0?D?(D.p(B,$),$[0]&10&&qe(D,1)):(D=e_(B),D.c(),qe(D,1),D.m(T.parentNode,T)):D&&(Nr(),nt(D,1,1,()=>{D=null}),Ur())},i(B){L||(qe(S.$$.fragment,B),qe(A.$$.fragment,B),qe(D),L=!0)},o(B){nt(S.$$.fragment,B),nt(A.$$.fragment,B),nt(D),L=!1},d(B){te(r),te(a),te(l),te(c),te(f),te(d),te(n),te(m),te(b),B&&te(w),ar(S,B),B&&te(k),ar(A,B),B&&te(P),D&&D.d(B),B&&te(T)}}}let HS="light";function WS(o){let r=[];o.forEach(l=>r.push(l[0]));const a=o.flat().pop();return(o.length===1||a!=r[r.length-1])&&r.push(a),r}const s_=o=>o.key;function KS(o,r,a){let l;Nu(o,g1,Z=>a(22,l=Z));let{data:c}=r;qs("theme",f1[HS]);let f=[],d=!1,n="success",m=!1,b=K2,w=null,S=null;function k(){N2(`${Zl}?${f.map(Z=>`${Z.key}=${Z.code}`).join("&")}`,{noScroll:!0,keepFocus:!0})}function A(Z,$e){a(1,f=[...f.filter(ct=>ct.topic!==Z.shortLabel),{topic:Z.shortLabel,key:Z.key,...$e}]),Jh({event:"variableSelect",variable:Z.shortLabel,category:$e.label,count:f.length}),k()}function P(Z){a(1,f=f.filter($e=>$e.topic!==Z.shortLabel)),k()}function T(Z){a(1,f=f.filter($e=>$e.topic!=Z)),k()}function L(Z,$e,ct){for(const rt of $e)Cu(rt,Z)?++ct.available:Z.selected.residents[rt].values!==void 0&&++ct.missing}function D(Z){let $e={available:0,missing:0};for(const ct of Bo[0].tablesCategorised)L(Z,ct.tables.map(rt=>rt.code),$e);return L(Z,["sex","resident_age_18b"],$e),$e}function B(Z){let $e=O2(Z,Bo,f);const ct=new kS;for(let{filename:rt,contents:$t}of $e)ct.file(rt,$t,{compression:rt==="mimetype"?"STORE":"DEFLATE"});ct.generateAsync({type:"blob"}).then(rt=>{let $t=new Blob([rt],{type:"application/vnd.oasis.opendocument.spreadsheet"}),it=URL.createObjectURL($t);var et=document.createElement("a");et.setAttribute("href",it),et.setAttribute("download","data-download.ods"),et.style.display="none",document.body.appendChild(et),et.click(),document.body.removeChild(et),URL.revokeObjectURL(it)}),Jh({event:"fileDownload",fileExtension:"ods",selection:f.map(rt=>`${rt.topic}: ${rt.label}`)})}function $(){Jh({event:"pagePrint",selection:f.map(Z=>`${Z.topic}: ${Z.label}`)}),print()}function J(Z){a(0,c.selected=Z.data,c),a(0,c.selected.total_pop=Z.total_pop,c),a(0,c.geoPerc=[],c);let $e;c.geoCodesAndNames.forEach(({code:rt,name:$t})=>{let it=f.length===0?100:Z.mapData[rt]!=null?Z.mapData[rt][1]:null,et=f.length===0?-1:Z.mapData[rt]!=null?Z.mapData[rt][0]:null;c.geoPerc.push({code:rt,name:$t,value:it,count:et})});let ct=c.geoPerc.map(rt=>rt.value).filter(rt=>rt!=null);if($e=ct.length===0?null:q2(ct,Math.min(5,ct.length)),!$e)c.geoPerc.forEach(rt=>rt.color=Mo.nodata),a(0,c.geoBreaks=[0,100],c);else if(f.length===0)c.geoPerc.forEach(rt=>rt.color=Mo.seq[4]),a(0,c.geoBreaks=[100,100],c);else{let rt=WS($e);c.geoPerc.forEach($t=>$t.color=$t.value!=null?R2($t.value,rt,Mo.seq):Mo.nodata),a(0,c.geoBreaks=rt,c)}f.length,a(3,n=c.selected.total_pop.count==null?"failed":"success")}function Y(){a(3,n="loading"),a(4,m=f&&f.some(Z=>["Aged 4 years and under","Aged 5 to 9 years","Aged 10 to 14 years","Aged 15 years and under"].includes(Z.label))),ty(Bo,f).then(J)}function ae(){a(1,f=[]);for(let Z of l.url.searchParams.entries()){let $e=d1.find(rt=>rt.key==Z[0]);if(!$e)continue;let ct=$e.cats.find(rt=>rt.code==Z[1]);ct&&f.push({topic:$e.shortLabel,key:$e.key,...ct})}Y()}U2(()=>{ae(),a(2,d=!1),a(5,w=null),a(6,S=null)});const re=Z=>Cu(Z.code,c),ce=Z=>T(Z.topic);function ye(Z){w=Z,a(5,w)}function Ae(Z){S=Z,a(6,S)}function _t(Z){d=Z,a(2,d)}const le=()=>B(c),We=Z=>Cu(Z.code,c);return o.$$set=Z=>{"data"in Z&&a(0,c=Z.data)},o.$$.update=()=>{o.$$.dirty[0]&2&&console.log("selected",f)},[c,f,d,n,m,w,S,b,A,P,T,D,B,$,re,ce,ye,Ae,_t,le,We]}class nT extends Wr{constructor(r){super(),Kr(this,r,KS,ZS,jr,{data:0},null,[-1,-1])}}export{nT as component,rT as universal}; diff --git a/_app/version.json b/_app/version.json index 93ef9c2..f91386a 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1697470606752"} \ No newline at end of file +{"version":"1697474090796"} \ No newline at end of file diff --git a/index.html b/index.html index 0c07877..89c8672 100644 --- a/index.html +++ b/index.html @@ -7,15 +7,15 @@ - + - - - - + + + + - - Create a population group profile - Census 2021 - ONS + + Create a population group profile - Census 2021 - ONS
@@ -132,10 +132,10 @@

Select one or more identity characteristics to define a population group, - for example - people born in the UK who are disabled - or - people aged 65 and over who hold a non-UK passort. Once selected, you will see how this group compares to the whole + for example people whose + main language is Spanish + or people + born in the UK who are disabled under the Equality Act. Once selected, you will see how your selected group compares to the whole population of England and Wales, based on Census 2021 data.

@@ -227,7 +227,7 @@

Footer links