@deck.gl/carto 9.4.0-beta.4 → 9.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist.min.js CHANGED
@@ -4,7 +4,7 @@
4
4
  else if (typeof define === 'function' && define.amd) define([], factory);
5
5
  else if (typeof exports === 'object') exports['deck'] = factory();
6
6
  else root['deck'] = factory();})(globalThis, function () {
7
- "use strict";var __exports__=(()=>{var sg=Object.create;var Mi=Object.defineProperty;var fg=Object.getOwnPropertyDescriptor;var lg=Object.getOwnPropertyNames;var cg=Object.getPrototypeOf,ug=Object.prototype.hasOwnProperty;var K=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ra=(e,t)=>{for(var r in t)Mi(e,r,{get:t[r],enumerable:!0})},ki=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lg(t))!ug.call(e,i)&&i!==r&&Mi(e,i,{get:()=>t[i],enumerable:!(n=fg(t,i))||n.enumerable});return e},Xe=(e,t,r)=>(ki(e,t,"default"),r&&ki(r,t,"default")),q=(e,t,r)=>(r=e!=null?sg(cg(e)):{},ki(t||!e||!e.__esModule?Mi(r,"default",{value:e,enumerable:!0}):r,e)),dg=e=>ki(Mi({},"__esModule",{value:!0}),e);var kt=K((C_,gl)=>{gl.exports=globalThis.deck});var dt=K((A_,ml)=>{ml.exports=globalThis.deck});var ln=K((P_,bl)=>{bl.exports=globalThis.loaders});var Ee=K((R_,wl)=>{wl.exports=globalThis.deck});var Yt=K((C3,Vl)=>{Vl.exports=globalThis.h3||{}});var pt=K(he=>{"use strict";var lm=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function cm(e,t){return Object.prototype.hasOwnProperty.call(e,t)}he.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var n in r)cm(r,n)&&(e[n]=r[n])}}return e};he.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var um={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},dm={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};he.setTyped=function(e){e?(he.Buf8=Uint8Array,he.Buf16=Uint16Array,he.Buf32=Int32Array,he.assign(he,um)):(he.Buf8=Array,he.Buf16=Array,he.Buf32=Array,he.assign(he,dm))};he.setTyped(lm)});var Mc=K(Mr=>{"use strict";var hm=pt(),pm=4,lc=0,cc=1,gm=2;function kr(e){for(var t=e.length;--t>=0;)e[t]=0}var mm=0,mc=1,bm=2,ym=3,xm=258,Ka=29,xn=256,gn=xn+1+Ka,Fr=30,Xa=19,bc=2*gn+1,Kt=15,$a=16,vm=7,Qa=256,yc=16,xc=17,vc=18,Wa=[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],qi=[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],wm=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],wc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_m=512,gt=new Array((gn+2)*2);kr(gt);var pn=new Array(Fr*2);kr(pn);var mn=new Array(_m);kr(mn);var bn=new Array(xm-ym+1);kr(bn);var Ja=new Array(Ka);kr(Ja);var Gi=new Array(Fr);kr(Gi);function Ha(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var _c,Ec,Sc;function ja(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Tc(e){return e<256?mn[e]:mn[256+(e>>>7)]}function yn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function me(e,t,r){e.bi_valid>$a-r?(e.bi_buf|=t<<e.bi_valid&65535,yn(e,e.bi_buf),e.bi_buf=t>>$a-e.bi_valid,e.bi_valid+=r-$a):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function et(e,t,r){me(e,r[t*2],r[t*2+1])}function Cc(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Em(e){e.bi_valid===16?(yn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Sm(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,l=t.stat_desc.max_length,f,c,u,d,h,g,x=0;for(d=0;d<=Kt;d++)e.bl_count[d]=0;for(r[e.heap[e.heap_max]*2+1]=0,f=e.heap_max+1;f<bc;f++)c=e.heap[f],d=r[r[c*2+1]*2+1]+1,d>l&&(d=l,x++),r[c*2+1]=d,!(c>n)&&(e.bl_count[d]++,h=0,c>=s&&(h=a[c-s]),g=r[c*2],e.opt_len+=g*(d+h),o&&(e.static_len+=g*(i[c*2+1]+h)));if(x!==0){do{for(d=l-1;e.bl_count[d]===0;)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[l]--,x-=2}while(x>0);for(d=l;d!==0;d--)for(c=e.bl_count[d];c!==0;)u=e.heap[--f],!(u>n)&&(r[u*2+1]!==d&&(e.opt_len+=(d-r[u*2+1])*r[u*2],r[u*2+1]=d),c--)}}function Ac(e,t,r){var n=new Array(Kt+1),i=0,o,a;for(o=1;o<=Kt;o++)n[o]=i=i+r[o-1]<<1;for(a=0;a<=t;a++){var s=e[a*2+1];s!==0&&(e[a*2]=Cc(n[s]++,s))}}function Tm(){var e,t,r,n,i,o=new Array(Kt+1);for(r=0,n=0;n<Ka-1;n++)for(Ja[n]=r,e=0;e<1<<Wa[n];e++)bn[r++]=n;for(bn[r-1]=n,i=0,n=0;n<16;n++)for(Gi[n]=i,e=0;e<1<<qi[n];e++)mn[i++]=n;for(i>>=7;n<Fr;n++)for(Gi[n]=i<<7,e=0;e<1<<qi[n]-7;e++)mn[256+i++]=n;for(t=0;t<=Kt;t++)o[t]=0;for(e=0;e<=143;)gt[e*2+1]=8,e++,o[8]++;for(;e<=255;)gt[e*2+1]=9,e++,o[9]++;for(;e<=279;)gt[e*2+1]=7,e++,o[7]++;for(;e<=287;)gt[e*2+1]=8,e++,o[8]++;for(Ac(gt,gn+1,o),e=0;e<Fr;e++)pn[e*2+1]=5,pn[e*2]=Cc(e,5);_c=new Ha(gt,Wa,xn+1,gn,Kt),Ec=new Ha(pn,qi,0,Fr,Kt),Sc=new Ha(new Array(0),wm,0,Xa,vm)}function Pc(e){var t;for(t=0;t<gn;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Fr;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Xa;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Qa*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Fc(e){e.bi_valid>8?yn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Cm(e,t,r,n){Fc(e),n&&(yn(e,r),yn(e,~r)),hm.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function uc(e,t,r,n){var i=t*2,o=r*2;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function Za(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&uc(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!uc(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function dc(e,t,r){var n,i,o=0,a,s;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+o*2]<<8|e.pending_buf[e.d_buf+o*2+1],i=e.pending_buf[e.l_buf+o],o++,n===0?et(e,i,t):(a=bn[i],et(e,a+xn+1,t),s=Wa[a],s!==0&&(i-=Ja[a],me(e,i,s)),n--,a=Tc(n),et(e,a,r),s=qi[a],s!==0&&(n-=Gi[a],me(e,n,s)));while(o<e.last_lit);et(e,Qa,t)}function Ya(e,t){var r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems,a,s,l=-1,f;for(e.heap_len=0,e.heap_max=bc,a=0;a<o;a++)r[a*2]!==0?(e.heap[++e.heap_len]=l=a,e.depth[a]=0):r[a*2+1]=0;for(;e.heap_len<2;)f=e.heap[++e.heap_len]=l<2?++l:0,r[f*2]=1,e.depth[f]=0,e.opt_len--,i&&(e.static_len-=n[f*2+1]);for(t.max_code=l,a=e.heap_len>>1;a>=1;a--)Za(e,r,a);f=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Za(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[f*2]=r[a*2]+r[s*2],e.depth[f]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[a*2+1]=r[s*2+1]=f,e.heap[1]=f++,Za(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Sm(e,t),Ac(r,l,e.bl_count)}function hc(e,t,r){var n,i=-1,o,a=t[1],s=0,l=7,f=4;for(a===0&&(l=138,f=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)o=a,a=t[(n+1)*2+1],!(++s<l&&o===a)&&(s<f?e.bl_tree[o*2]+=s:o!==0?(o!==i&&e.bl_tree[o*2]++,e.bl_tree[yc*2]++):s<=10?e.bl_tree[xc*2]++:e.bl_tree[vc*2]++,s=0,i=o,a===0?(l=138,f=3):o===a?(l=6,f=3):(l=7,f=4))}function pc(e,t,r){var n,i=-1,o,a=t[1],s=0,l=7,f=4;for(a===0&&(l=138,f=3),n=0;n<=r;n++)if(o=a,a=t[(n+1)*2+1],!(++s<l&&o===a)){if(s<f)do et(e,o,e.bl_tree);while(--s!==0);else o!==0?(o!==i&&(et(e,o,e.bl_tree),s--),et(e,yc,e.bl_tree),me(e,s-3,2)):s<=10?(et(e,xc,e.bl_tree),me(e,s-3,3)):(et(e,vc,e.bl_tree),me(e,s-11,7));s=0,i=o,a===0?(l=138,f=3):o===a?(l=6,f=3):(l=7,f=4)}}function Am(e){var t;for(hc(e,e.dyn_ltree,e.l_desc.max_code),hc(e,e.dyn_dtree,e.d_desc.max_code),Ya(e,e.bl_desc),t=Xa-1;t>=3&&e.bl_tree[wc[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Pm(e,t,r,n){var i;for(me(e,t-257,5),me(e,r-1,5),me(e,n-4,4),i=0;i<n;i++)me(e,e.bl_tree[wc[i]*2+1],3);pc(e,e.dyn_ltree,t-1),pc(e,e.dyn_dtree,r-1)}function Fm(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return lc;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return cc;for(r=32;r<xn;r++)if(e.dyn_ltree[r*2]!==0)return cc;return lc}var gc=!1;function km(e){gc||(Tm(),gc=!0),e.l_desc=new ja(e.dyn_ltree,_c),e.d_desc=new ja(e.dyn_dtree,Ec),e.bl_desc=new ja(e.bl_tree,Sc),e.bi_buf=0,e.bi_valid=0,Pc(e)}function kc(e,t,r,n){me(e,(mm<<1)+(n?1:0),3),Cm(e,t,r,!0)}function Mm(e){me(e,mc<<1,3),et(e,Qa,gt),Em(e)}function Lm(e,t,r,n){var i,o,a=0;e.level>0?(e.strm.data_type===gm&&(e.strm.data_type=Fm(e)),Ya(e,e.l_desc),Ya(e,e.d_desc),a=Am(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&t!==-1?kc(e,t,r,n):e.strategy===pm||o===i?(me(e,(mc<<1)+(n?1:0),3),dc(e,gt,pn)):(me(e,(bm<<1)+(n?1:0),3),Pm(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),dc(e,e.dyn_ltree,e.dyn_dtree)),Pc(e),n&&Fc(e)}function Im(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(bn[r]+xn+1)*2]++,e.dyn_dtree[Tc(t)*2]++),e.last_lit===e.lit_bufsize-1}Mr._tr_init=km;Mr._tr_stored_block=kc;Mr._tr_flush_block=Lm;Mr._tr_tally=Im;Mr._tr_align=Mm});var es=K((l5,Lc)=>{"use strict";function Rm(e,t,r,n){for(var i=e&65535|0,o=e>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do i=i+t[n++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0}Lc.exports=Rm});var ts=K((c5,Ic)=>{"use strict";function Om(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var Bm=Om();function Dm(e,t,r,n){var i=Bm,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[(e^t[a])&255];return e^-1}Ic.exports=Dm});var Vi=K((u5,Rc)=>{"use strict";Rc.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Vc=K(nt=>{"use strict";var pe=pt(),ke=Mc(),Nc=es(),Rt=ts(),Nm=Vi(),er=0,zm=1,Um=3,zt=4,Oc=5,rt=0,Bc=1,Me=-2,qm=-3,rs=-5,Gm=-1,Vm=1,$i=2,$m=3,Hm=4,jm=0,Zm=2,Wi=8,Wm=9,Ym=15,Km=8,Xm=29,Qm=256,is=Qm+1+Xm,Jm=30,e1=19,t1=2*is+1,r1=15,V=3,Dt=258,qe=Dt+V+1,n1=32,Yi=42,os=69,Hi=73,ji=91,Zi=103,Xt=113,wn=666,ae=1,_n=2,Qt=3,Rr=4,i1=3;function Nt(e,t){return e.msg=Nm[t],t}function Dc(e){return(e<<1)-(e>4?9:0)}function Bt(e){for(var t=e.length;--t>=0;)e[t]=0}function Ot(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(pe.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function fe(e,t){ke._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Ot(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function vn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function o1(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,pe.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=Nc(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Rt(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function zc(e,t){var r=e.max_chain_length,n=e.strstart,i,o,a=e.prev_length,s=e.nice_match,l=e.strstart>e.w_size-qe?e.strstart-(e.w_size-qe):0,f=e.window,c=e.w_mask,u=e.prev,d=e.strstart+Dt,h=f[n+a-1],g=f[n+a];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(f[i+a]!==g||f[i+a-1]!==h||f[i]!==f[n]||f[++i]!==f[n+1])){n+=2,i++;do;while(f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&f[++n]===f[++i]&&n<d);if(o=Dt-(d-n),n=d-Dt,o>a){if(e.match_start=t,a=o,o>=s)break;h=f[n+a-1],g=f[n+a]}}while((t=u[t&c])>l&&--r!==0);return a<=e.lookahead?a:e.lookahead}function Jt(e){var t=e.w_size,r,n,i,o,a;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-qe)){pe.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);o+=t}if(e.strm.avail_in===0)break;if(n=o1(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=n,e.lookahead+e.insert>=V)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+V-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<V)););}while(e.lookahead<qe&&e.strm.avail_in!==0)}function a1(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Jt(e),e.lookahead===0&&t===er)return ae;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,fe(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-qe&&(fe(e,!1),e.strm.avail_out===0))return ae}return e.insert=0,t===zt?(fe(e,!0),e.strm.avail_out===0?Qt:Rr):(e.strstart>e.block_start&&(fe(e,!1),e.strm.avail_out===0),ae)}function ns(e,t){for(var r,n;;){if(e.lookahead<qe){if(Jt(e),e.lookahead<qe&&t===er)return ae;if(e.lookahead===0)break}if(r=0,e.lookahead>=V&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-qe&&(e.match_length=zc(e,r)),e.match_length>=V)if(n=ke._tr_tally(e,e.strstart-e.match_start,e.match_length-V),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=V){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=ke._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(fe(e,!1),e.strm.avail_out===0))return ae}return e.insert=e.strstart<V-1?e.strstart:V-1,t===zt?(fe(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(fe(e,!1),e.strm.avail_out===0)?ae:_n}function Lr(e,t){for(var r,n,i;;){if(e.lookahead<qe){if(Jt(e),e.lookahead<qe&&t===er)return ae;if(e.lookahead===0)break}if(r=0,e.lookahead>=V&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=V-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-qe&&(e.match_length=zc(e,r),e.match_length<=5&&(e.strategy===Vm||e.match_length===V&&e.strstart-e.match_start>4096)&&(e.match_length=V-1)),e.prev_length>=V&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-V,n=ke._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-V),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=V-1,e.strstart++,n&&(fe(e,!1),e.strm.avail_out===0))return ae}else if(e.match_available){if(n=ke._tr_tally(e,0,e.window[e.strstart-1]),n&&fe(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ae}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=ke._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<V-1?e.strstart:V-1,t===zt?(fe(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(fe(e,!1),e.strm.avail_out===0)?ae:_n}function s1(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=Dt){if(Jt(e),e.lookahead<=Dt&&t===er)return ae;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=V&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+Dt;do;while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=Dt-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=V?(r=ke._tr_tally(e,1,e.match_length-V),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=ke._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(fe(e,!1),e.strm.avail_out===0))return ae}return e.insert=0,t===zt?(fe(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(fe(e,!1),e.strm.avail_out===0)?ae:_n}function f1(e,t){for(var r;;){if(e.lookahead===0&&(Jt(e),e.lookahead===0)){if(t===er)return ae;break}if(e.match_length=0,r=ke._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(fe(e,!1),e.strm.avail_out===0))return ae}return e.insert=0,t===zt?(fe(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(fe(e,!1),e.strm.avail_out===0)?ae:_n}function tt(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var Ir;Ir=[new tt(0,0,0,0,a1),new tt(4,4,8,4,ns),new tt(4,5,16,8,ns),new tt(4,6,32,32,ns),new tt(4,4,16,16,Lr),new tt(8,16,32,32,Lr),new tt(8,16,128,128,Lr),new tt(8,32,128,256,Lr),new tt(32,128,258,1024,Lr),new tt(32,258,258,4096,Lr)];function l1(e){e.window_size=2*e.w_size,Bt(e.head),e.max_lazy_match=Ir[e.level].max_lazy,e.good_match=Ir[e.level].good_length,e.nice_match=Ir[e.level].nice_length,e.max_chain_length=Ir[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=V-1,e.match_available=0,e.ins_h=0}function c1(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Wi,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new pe.Buf16(t1*2),this.dyn_dtree=new pe.Buf16((2*Jm+1)*2),this.bl_tree=new pe.Buf16((2*e1+1)*2),Bt(this.dyn_ltree),Bt(this.dyn_dtree),Bt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new pe.Buf16(r1+1),this.heap=new pe.Buf16(2*is+1),Bt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new pe.Buf16(2*is+1),Bt(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Uc(e){var t;return!e||!e.state?Nt(e,Me):(e.total_in=e.total_out=0,e.data_type=Zm,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Yi:Xt,e.adler=t.wrap===2?0:1,t.last_flush=er,ke._tr_init(t),rt)}function qc(e){var t=Uc(e);return t===rt&&l1(e.state),t}function u1(e,t){return!e||!e.state||e.state.wrap!==2?Me:(e.state.gzhead=t,rt)}function Gc(e,t,r,n,i,o){if(!e)return Me;var a=1;if(t===Gm&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>Wm||r!==Wi||n<8||n>15||t<0||t>9||o<0||o>Hm)return Nt(e,Me);n===8&&(n=9);var s=new c1;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+V-1)/V),s.window=new pe.Buf8(s.w_size*2),s.head=new pe.Buf16(s.hash_size),s.prev=new pe.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new pe.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,qc(e)}function d1(e,t){return Gc(e,t,Wi,Ym,Km,jm)}function h1(e,t){var r,n,i,o;if(!e||!e.state||t>Oc||t<0)return e?Nt(e,Me):Me;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===wn&&t!==zt)return Nt(e,e.avail_out===0?rs:Me);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Yi)if(n.wrap===2)e.adler=0,j(n,31),j(n,139),j(n,8),n.gzhead?(j(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),j(n,n.gzhead.time&255),j(n,n.gzhead.time>>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,n.level===9?2:n.strategy>=$i||n.level<2?4:0),j(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,n.gzhead.extra.length&255),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Rt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=os):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,n.level===9?2:n.strategy>=$i||n.level<2?4:0),j(n,i1),n.status=Xt);else{var a=Wi+(n.w_bits-8<<4)<<8,s=-1;n.strategy>=$i||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,a|=s<<6,n.strstart!==0&&(a|=n1),a+=31-a%31,n.status=Xt,vn(n,a),n.strstart!==0&&(vn(n,e.adler>>>16),vn(n,e.adler&65535)),e.adler=1}if(n.status===os)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),Ot(e),i=n.pending,n.pending===n.pending_buf_size));)j(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Hi)}else n.status=Hi;if(n.status===Hi)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),Ot(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}n.gzindex<n.gzhead.name.length?o=n.gzhead.name.charCodeAt(n.gzindex++)&255:o=0,j(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),o===0&&(n.gzindex=0,n.status=ji)}else n.status=ji;if(n.status===ji)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),Ot(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}n.gzindex<n.gzhead.comment.length?o=n.gzhead.comment.charCodeAt(n.gzindex++)&255:o=0,j(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),o===0&&(n.status=Zi)}else n.status=Zi;if(n.status===Zi&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&Ot(e),n.pending+2<=n.pending_buf_size&&(j(n,e.adler&255),j(n,e.adler>>8&255),e.adler=0,n.status=Xt)):n.status=Xt),n.pending!==0){if(Ot(e),e.avail_out===0)return n.last_flush=-1,rt}else if(e.avail_in===0&&Dc(t)<=Dc(r)&&t!==zt)return Nt(e,rs);if(n.status===wn&&e.avail_in!==0)return Nt(e,rs);if(e.avail_in!==0||n.lookahead!==0||t!==er&&n.status!==wn){var l=n.strategy===$i?f1(n,t):n.strategy===$m?s1(n,t):Ir[n.level].func(n,t);if((l===Qt||l===Rr)&&(n.status=wn),l===ae||l===Qt)return e.avail_out===0&&(n.last_flush=-1),rt;if(l===_n&&(t===zm?ke._tr_align(n):t!==Oc&&(ke._tr_stored_block(n,0,0,!1),t===Um&&(Bt(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Ot(e),e.avail_out===0))return n.last_flush=-1,rt}return t!==zt?rt:n.wrap<=0?Bc:(n.wrap===2?(j(n,e.adler&255),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,e.total_in&255),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(vn(n,e.adler>>>16),vn(n,e.adler&65535)),Ot(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?rt:Bc)}function p1(e){var t;return!e||!e.state?Me:(t=e.state.status,t!==Yi&&t!==os&&t!==Hi&&t!==ji&&t!==Zi&&t!==Xt&&t!==wn?Nt(e,Me):(e.state=null,t===Xt?Nt(e,qm):rt))}function g1(e,t){var r=t.length,n,i,o,a,s,l,f,c;if(!e||!e.state||(n=e.state,a=n.wrap,a===2||a===1&&n.status!==Yi||n.lookahead))return Me;for(a===1&&(e.adler=Nc(e.adler,t,r,0)),n.wrap=0,r>=n.w_size&&(a===0&&(Bt(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new pe.Buf8(n.w_size),pe.arraySet(c,t,r-n.w_size,n.w_size,0),t=c,r=n.w_size),s=e.avail_in,l=e.next_in,f=e.input,e.avail_in=r,e.next_in=0,e.input=t,Jt(n);n.lookahead>=V;){i=n.strstart,o=n.lookahead-(V-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+V-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--o);n.strstart=i,n.lookahead=V-1,Jt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=V-1,n.match_available=0,e.next_in=l,e.input=f,e.avail_in=s,n.wrap=a,rt}nt.deflateInit=d1;nt.deflateInit2=Gc;nt.deflateReset=qc;nt.deflateResetKeep=Uc;nt.deflateSetHeader=u1;nt.deflate=h1;nt.deflateEnd=p1;nt.deflateSetDictionary=g1;nt.deflateInfo="pako deflate (from Nodeca project)"});var as=K(Or=>{"use strict";var Ki=pt(),$c=!0,Hc=!0;try{String.fromCharCode.apply(null,[0])}catch{$c=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Hc=!1}var En=new Ki.Buf8(256);for(mt=0;mt<256;mt++)En[mt]=mt>=252?6:mt>=248?5:mt>=240?4:mt>=224?3:mt>=192?2:1;var mt;En[254]=En[254]=1;Or.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<a&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Ki.Buf8(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<a&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|r&63):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|r&63):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|r&63);return t};function jc(e,t){if(t<65534&&(e.subarray&&Hc||!e.subarray&&$c))return String.fromCharCode.apply(null,Ki.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}Or.buf2binstring=function(e){return jc(e,e.length)};Or.binstring2buf=function(e){for(var t=new Ki.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t};Or.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(a*2);for(n=0,r=0;r<a;){if(i=e[r++],i<128){s[n++]=i;continue}if(o=En[i],o>4){s[n++]=65533,r+=o-1;continue}for(i&=o===2?31:o===3?15:7;o>1&&r<a;)i=i<<6|e[r++]&63,o--;if(o>1){s[n++]=65533;continue}i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|i&1023)}return jc(s,n)};Or.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+En[e[r]]>t?r:t}});var ss=K((p5,Zc)=>{"use strict";function m1(){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}Zc.exports=m1});var Xc=K(Cn=>{"use strict";var Sn=Vc(),Tn=pt(),ls=as(),cs=Vi(),b1=ss(),Kc=Object.prototype.toString,y1=0,fs=4,Br=0,Wc=1,Yc=2,x1=-1,v1=0,w1=8;function tr(e){if(!(this instanceof tr))return new tr(e);this.options=Tn.assign({level:x1,method:w1,chunkSize:16384,windowBits:15,memLevel:8,strategy:v1,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b1,this.strm.avail_out=0;var r=Sn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Br)throw new Error(cs[r]);if(t.header&&Sn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=ls.string2buf(t.dictionary):Kc.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Sn.deflateSetDictionary(this.strm,n),r!==Br)throw new Error(cs[r]);this._dict_set=!0}}tr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i,o;if(this.ended)return!1;o=t===~~t?t:t===!0?fs:y1,typeof e=="string"?r.input=ls.string2buf(e):Kc.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Tn.Buf8(n),r.next_out=0,r.avail_out=n),i=Sn.deflate(r,o),i!==Wc&&i!==Br)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(o===fs||o===Yc))&&(this.options.to==="string"?this.onData(ls.buf2binstring(Tn.shrinkBuf(r.output,r.next_out))):this.onData(Tn.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==Wc);return o===fs?(i=Sn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Br):(o===Yc&&(this.onEnd(Br),r.avail_out=0),!0)};tr.prototype.onData=function(e){this.chunks.push(e)};tr.prototype.onEnd=function(e){e===Br&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Tn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function us(e,t){var r=new tr(t);if(r.push(e,!0),r.err)throw r.msg||cs[r.err];return r.result}function _1(e,t){return t=t||{},t.raw=!0,us(e,t)}function E1(e,t){return t=t||{},t.gzip=!0,us(e,t)}Cn.Deflate=tr;Cn.deflate=us;Cn.deflateRaw=_1;Cn.gzip=E1});var Jc=K((m5,Qc)=>{"use strict";var Xi=30,S1=12;Qc.exports=function(t,r){var n,i,o,a,s,l,f,c,u,d,h,g,x,S,T,w,k,L,M,O,D,p,m,b,y;n=t.state,i=t.next_in,b=t.input,o=i+(t.avail_in-5),a=t.next_out,y=t.output,s=a-(r-t.avail_out),l=a+(t.avail_out-257),f=n.dmax,c=n.wsize,u=n.whave,d=n.wnext,h=n.window,g=n.hold,x=n.bits,S=n.lencode,T=n.distcode,w=(1<<n.lenbits)-1,k=(1<<n.distbits)-1;e:do{x<15&&(g+=b[i++]<<x,x+=8,g+=b[i++]<<x,x+=8),L=S[g&w];t:for(;;){if(M=L>>>24,g>>>=M,x-=M,M=L>>>16&255,M===0)y[a++]=L&65535;else if(M&16){O=L&65535,M&=15,M&&(x<M&&(g+=b[i++]<<x,x+=8),O+=g&(1<<M)-1,g>>>=M,x-=M),x<15&&(g+=b[i++]<<x,x+=8,g+=b[i++]<<x,x+=8),L=T[g&k];r:for(;;){if(M=L>>>24,g>>>=M,x-=M,M=L>>>16&255,M&16){if(D=L&65535,M&=15,x<M&&(g+=b[i++]<<x,x+=8,x<M&&(g+=b[i++]<<x,x+=8)),D+=g&(1<<M)-1,D>f){t.msg="invalid distance too far back",n.mode=Xi;break e}if(g>>>=M,x-=M,M=a-s,D>M){if(M=D-M,M>u&&n.sane){t.msg="invalid distance too far back",n.mode=Xi;break e}if(p=0,m=h,d===0){if(p+=c-M,M<O){O-=M;do y[a++]=h[p++];while(--M);p=a-D,m=y}}else if(d<M){if(p+=c+d-M,M-=d,M<O){O-=M;do y[a++]=h[p++];while(--M);if(p=0,d<O){M=d,O-=M;do y[a++]=h[p++];while(--M);p=a-D,m=y}}}else if(p+=d-M,M<O){O-=M;do y[a++]=h[p++];while(--M);p=a-D,m=y}for(;O>2;)y[a++]=m[p++],y[a++]=m[p++],y[a++]=m[p++],O-=3;O&&(y[a++]=m[p++],O>1&&(y[a++]=m[p++]))}else{p=a-D;do y[a++]=y[p++],y[a++]=y[p++],y[a++]=y[p++],O-=3;while(O>2);O&&(y[a++]=y[p++],O>1&&(y[a++]=y[p++]))}}else if((M&64)===0){L=T[(L&65535)+(g&(1<<M)-1)];continue r}else{t.msg="invalid distance code",n.mode=Xi;break e}break}}else if((M&64)===0){L=S[(L&65535)+(g&(1<<M)-1)];continue t}else if(M&32){n.mode=S1;break e}else{t.msg="invalid literal/length code",n.mode=Xi;break e}break}}while(i<o&&a<l);O=x>>3,i-=O,x-=O<<3,g&=(1<<x)-1,t.next_in=i,t.next_out=a,t.avail_in=i<o?5+(o-i):5-(i-o),t.avail_out=a<l?257+(l-a):257-(a-l),n.hold=g,n.bits=x}});var au=K((b5,ou)=>{"use strict";var eu=pt(),Dr=15,tu=852,ru=592,nu=0,ds=1,iu=2,T1=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],C1=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],A1=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],P1=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ou.exports=function(t,r,n,i,o,a,s,l){var f=l.bits,c=0,u=0,d=0,h=0,g=0,x=0,S=0,T=0,w=0,k=0,L,M,O,D,p,m=null,b=0,y,v=new eu.Buf16(Dr+1),E=new eu.Buf16(Dr+1),F=null,_=0,C,P,A;for(c=0;c<=Dr;c++)v[c]=0;for(u=0;u<i;u++)v[r[n+u]]++;for(g=f,h=Dr;h>=1&&v[h]===0;h--);if(g>h&&(g=h),h===0)return o[a++]=1<<24|64<<16|0,o[a++]=1<<24|64<<16|0,l.bits=1,0;for(d=1;d<h&&v[d]===0;d++);for(g<d&&(g=d),T=1,c=1;c<=Dr;c++)if(T<<=1,T-=v[c],T<0)return-1;if(T>0&&(t===nu||h!==1))return-1;for(E[1]=0,c=1;c<Dr;c++)E[c+1]=E[c]+v[c];for(u=0;u<i;u++)r[n+u]!==0&&(s[E[r[n+u]]++]=u);if(t===nu?(m=F=s,y=19):t===ds?(m=T1,b-=257,F=C1,_-=257,y=256):(m=A1,F=P1,y=-1),k=0,u=0,c=d,p=a,x=g,S=0,O=-1,w=1<<g,D=w-1,t===ds&&w>tu||t===iu&&w>ru)return 1;for(;;){C=c-S,s[u]<y?(P=0,A=s[u]):s[u]>y?(P=F[_+s[u]],A=m[b+s[u]]):(P=96,A=0),L=1<<c-S,M=1<<x,d=M;do M-=L,o[p+(k>>S)+M]=C<<24|P<<16|A|0;while(M!==0);for(L=1<<c-1;k&L;)L>>=1;if(L!==0?(k&=L-1,k+=L):k=0,u++,--v[c]===0){if(c===h)break;c=r[n+s[u]]}if(c>g&&(k&D)!==O){for(S===0&&(S=g),p+=d,x=c-S,T=1<<x;x+S<h&&(T-=v[x+S],!(T<=0));)x++,T<<=1;if(w+=1<<x,t===ds&&w>tu||t===iu&&w>ru)return 1;O=k&D,o[O]=g<<24|x<<16|p-a|0}}return k!==0&&(o[p+k]=c-S<<24|64<<16|0),l.bits=g,0}});var qu=K(Ge=>{"use strict";var Se=pt(),ys=es(),it=ts(),F1=Jc(),An=au(),k1=0,Lu=1,Iu=2,su=4,M1=5,Qi=6,rr=0,L1=1,I1=2,Le=-2,Ru=-3,xs=-4,R1=-5,fu=8,Ou=1,lu=2,cu=3,uu=4,du=5,hu=6,pu=7,gu=8,mu=9,bu=10,to=11,bt=12,hs=13,yu=14,ps=15,xu=16,vu=17,wu=18,_u=19,Ji=20,eo=21,Eu=22,Su=23,Tu=24,Cu=25,Au=26,gs=27,Pu=28,Fu=29,X=30,vs=31,O1=32,B1=852,D1=592,N1=15,z1=N1;function ku(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function U1(){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 Se.Buf16(320),this.work=new Se.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Bu(e){var t;return!e||!e.state?Le:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Ou,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Se.Buf32(B1),t.distcode=t.distdyn=new Se.Buf32(D1),t.sane=1,t.back=-1,rr)}function Du(e){var t;return!e||!e.state?Le:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Bu(e))}function Nu(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Le:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Du(e))}function zu(e,t){var r,n;return e?(n=new U1,e.state=n,n.window=null,r=Nu(e,t),r!==rr&&(e.state=null),r):Le}function q1(e){return zu(e,z1)}var Mu=!0,ms,bs;function G1(e){if(Mu){var t;for(ms=new Se.Buf32(512),bs=new Se.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(An(Lu,e.lens,0,288,ms,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;An(Iu,e.lens,0,32,bs,0,e.work,{bits:5}),Mu=!1}e.lencode=ms,e.lenbits=9,e.distcode=bs,e.distbits=5}function Uu(e,t,r,n){var i,o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Se.Buf8(o.wsize)),n>=o.wsize?(Se.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),Se.arraySet(o.window,t,r-n,i,o.wnext),n-=i,n?(Se.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}function V1(e,t){var r,n,i,o,a,s,l,f,c,u,d,h,g,x,S=0,T,w,k,L,M,O,D,p,m=new Se.Buf8(4),b,y,v=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Le;r=e.state,r.mode===bt&&(r.mode=hs),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,f=r.hold,c=r.bits,u=s,d=l,p=rr;e:for(;;)switch(r.mode){case Ou:if(r.wrap===0){r.mode=hs;break}for(;c<16;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(r.wrap&2&&f===35615){r.check=0,m[0]=f&255,m[1]=f>>>8&255,r.check=it(r.check,m,2,0),f=0,c=0,r.mode=lu;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((f&255)<<8)+(f>>8))%31){e.msg="incorrect header check",r.mode=X;break}if((f&15)!==fu){e.msg="unknown compression method",r.mode=X;break}if(f>>>=4,c-=4,D=(f&15)+8,r.wbits===0)r.wbits=D;else if(D>r.wbits){e.msg="invalid window size",r.mode=X;break}r.dmax=1<<D,e.adler=r.check=1,r.mode=f&512?bu:bt,f=0,c=0;break;case lu:for(;c<16;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(r.flags=f,(r.flags&255)!==fu){e.msg="unknown compression method",r.mode=X;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=X;break}r.head&&(r.head.text=f>>8&1),r.flags&512&&(m[0]=f&255,m[1]=f>>>8&255,r.check=it(r.check,m,2,0)),f=0,c=0,r.mode=cu;case cu:for(;c<32;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}r.head&&(r.head.time=f),r.flags&512&&(m[0]=f&255,m[1]=f>>>8&255,m[2]=f>>>16&255,m[3]=f>>>24&255,r.check=it(r.check,m,4,0)),f=0,c=0,r.mode=uu;case uu:for(;c<16;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}r.head&&(r.head.xflags=f&255,r.head.os=f>>8),r.flags&512&&(m[0]=f&255,m[1]=f>>>8&255,r.check=it(r.check,m,2,0)),f=0,c=0,r.mode=du;case du:if(r.flags&1024){for(;c<16;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}r.length=f,r.head&&(r.head.extra_len=f),r.flags&512&&(m[0]=f&255,m[1]=f>>>8&255,r.check=it(r.check,m,2,0)),f=0,c=0}else r.head&&(r.head.extra=null);r.mode=hu;case hu:if(r.flags&1024&&(h=r.length,h>s&&(h=s),h&&(r.head&&(D=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Se.arraySet(r.head.extra,n,o,h,D)),r.flags&512&&(r.check=it(r.check,n,h,o)),s-=h,o+=h,r.length-=h),r.length))break e;r.length=0,r.mode=pu;case pu:if(r.flags&2048){if(s===0)break e;h=0;do D=n[o+h++],r.head&&D&&r.length<65536&&(r.head.name+=String.fromCharCode(D));while(D&&h<s);if(r.flags&512&&(r.check=it(r.check,n,h,o)),s-=h,o+=h,D)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=gu;case gu:if(r.flags&4096){if(s===0)break e;h=0;do D=n[o+h++],r.head&&D&&r.length<65536&&(r.head.comment+=String.fromCharCode(D));while(D&&h<s);if(r.flags&512&&(r.check=it(r.check,n,h,o)),s-=h,o+=h,D)break e}else r.head&&(r.head.comment=null);r.mode=mu;case mu:if(r.flags&512){for(;c<16;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(f!==(r.check&65535)){e.msg="header crc mismatch",r.mode=X;break}f=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=bt;break;case bu:for(;c<32;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}e.adler=r.check=ku(f),f=0,c=0,r.mode=to;case to:if(r.havedict===0)return e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,r.hold=f,r.bits=c,I1;e.adler=r.check=1,r.mode=bt;case bt:if(t===M1||t===Qi)break e;case hs:if(r.last){f>>>=c&7,c-=c&7,r.mode=gs;break}for(;c<3;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}switch(r.last=f&1,f>>>=1,c-=1,f&3){case 0:r.mode=yu;break;case 1:if(G1(r),r.mode=Ji,t===Qi){f>>>=2,c-=2;break e}break;case 2:r.mode=vu;break;case 3:e.msg="invalid block type",r.mode=X}f>>>=2,c-=2;break;case yu:for(f>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if((f&65535)!==(f>>>16^65535)){e.msg="invalid stored block lengths",r.mode=X;break}if(r.length=f&65535,f=0,c=0,r.mode=ps,t===Qi)break e;case ps:r.mode=xu;case xu:if(h=r.length,h){if(h>s&&(h=s),h>l&&(h=l),h===0)break e;Se.arraySet(i,n,o,h,a),s-=h,o+=h,l-=h,a+=h,r.length-=h;break}r.mode=bt;break;case vu:for(;c<14;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(r.nlen=(f&31)+257,f>>>=5,c-=5,r.ndist=(f&31)+1,f>>>=5,c-=5,r.ncode=(f&15)+4,f>>>=4,c-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=X;break}r.have=0,r.mode=wu;case wu:for(;r.have<r.ncode;){for(;c<3;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}r.lens[v[r.have++]]=f&7,f>>>=3,c-=3}for(;r.have<19;)r.lens[v[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,b={bits:r.lenbits},p=An(k1,r.lens,0,19,r.lencode,0,r.work,b),r.lenbits=b.bits,p){e.msg="invalid code lengths set",r.mode=X;break}r.have=0,r.mode=_u;case _u:for(;r.have<r.nlen+r.ndist;){for(;S=r.lencode[f&(1<<r.lenbits)-1],T=S>>>24,w=S>>>16&255,k=S&65535,!(T<=c);){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(k<16)f>>>=T,c-=T,r.lens[r.have++]=k;else{if(k===16){for(y=T+2;c<y;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(f>>>=T,c-=T,r.have===0){e.msg="invalid bit length repeat",r.mode=X;break}D=r.lens[r.have-1],h=3+(f&3),f>>>=2,c-=2}else if(k===17){for(y=T+3;c<y;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}f>>>=T,c-=T,D=0,h=3+(f&7),f>>>=3,c-=3}else{for(y=T+7;c<y;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}f>>>=T,c-=T,D=0,h=11+(f&127),f>>>=7,c-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=X;break}for(;h--;)r.lens[r.have++]=D}}if(r.mode===X)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=X;break}if(r.lenbits=9,b={bits:r.lenbits},p=An(Lu,r.lens,0,r.nlen,r.lencode,0,r.work,b),r.lenbits=b.bits,p){e.msg="invalid literal/lengths set",r.mode=X;break}if(r.distbits=6,r.distcode=r.distdyn,b={bits:r.distbits},p=An(Iu,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,b),r.distbits=b.bits,p){e.msg="invalid distances set",r.mode=X;break}if(r.mode=Ji,t===Qi)break e;case Ji:r.mode=eo;case eo:if(s>=6&&l>=258){e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,r.hold=f,r.bits=c,F1(e,d),a=e.next_out,i=e.output,l=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,f=r.hold,c=r.bits,r.mode===bt&&(r.back=-1);break}for(r.back=0;S=r.lencode[f&(1<<r.lenbits)-1],T=S>>>24,w=S>>>16&255,k=S&65535,!(T<=c);){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(w&&(w&240)===0){for(L=T,M=w,O=k;S=r.lencode[O+((f&(1<<L+M)-1)>>L)],T=S>>>24,w=S>>>16&255,k=S&65535,!(L+T<=c);){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}f>>>=L,c-=L,r.back+=L}if(f>>>=T,c-=T,r.back+=T,r.length=k,w===0){r.mode=Au;break}if(w&32){r.back=-1,r.mode=bt;break}if(w&64){e.msg="invalid literal/length code",r.mode=X;break}r.extra=w&15,r.mode=Eu;case Eu:if(r.extra){for(y=r.extra;c<y;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}r.length+=f&(1<<r.extra)-1,f>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Su;case Su:for(;S=r.distcode[f&(1<<r.distbits)-1],T=S>>>24,w=S>>>16&255,k=S&65535,!(T<=c);){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if((w&240)===0){for(L=T,M=w,O=k;S=r.distcode[O+((f&(1<<L+M)-1)>>L)],T=S>>>24,w=S>>>16&255,k=S&65535,!(L+T<=c);){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}f>>>=L,c-=L,r.back+=L}if(f>>>=T,c-=T,r.back+=T,w&64){e.msg="invalid distance code",r.mode=X;break}r.offset=k,r.extra=w&15,r.mode=Tu;case Tu:if(r.extra){for(y=r.extra;c<y;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}r.offset+=f&(1<<r.extra)-1,f>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=X;break}r.mode=Cu;case Cu:if(l===0)break e;if(h=d-l,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=X;break}h>r.wnext?(h-=r.wnext,g=r.wsize-h):g=r.wnext-h,h>r.length&&(h=r.length),x=r.window}else x=i,g=a-r.offset,h=r.length;h>l&&(h=l),l-=h,r.length-=h;do i[a++]=x[g++];while(--h);r.length===0&&(r.mode=eo);break;case Au:if(l===0)break e;i[a++]=r.length,l--,r.mode=eo;break;case gs:if(r.wrap){for(;c<32;){if(s===0)break e;s--,f|=n[o++]<<c,c+=8}if(d-=l,e.total_out+=d,r.total+=d,d&&(e.adler=r.check=r.flags?it(r.check,i,d,a-d):ys(r.check,i,d,a-d)),d=l,(r.flags?f:ku(f))!==r.check){e.msg="incorrect data check",r.mode=X;break}f=0,c=0}r.mode=Pu;case Pu:if(r.wrap&&r.flags){for(;c<32;){if(s===0)break e;s--,f+=n[o++]<<c,c+=8}if(f!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=X;break}f=0,c=0}r.mode=Fu;case Fu:p=L1;break e;case X:p=Ru;break e;case vs:return xs;case O1:default:return Le}return e.next_out=a,e.avail_out=l,e.next_in=o,e.avail_in=s,r.hold=f,r.bits=c,(r.wsize||d!==e.avail_out&&r.mode<X&&(r.mode<gs||t!==su))&&Uu(e,e.output,e.next_out,d-e.avail_out)?(r.mode=vs,xs):(u-=e.avail_in,d-=e.avail_out,e.total_in+=u,e.total_out+=d,r.total+=d,r.wrap&&d&&(e.adler=r.check=r.flags?it(r.check,i,d,e.next_out-d):ys(r.check,i,d,e.next_out-d)),e.data_type=r.bits+(r.last?64:0)+(r.mode===bt?128:0)+(r.mode===Ji||r.mode===ps?256:0),(u===0&&d===0||t===su)&&p===rr&&(p=R1),p)}function $1(e){if(!e||!e.state)return Le;var t=e.state;return t.window&&(t.window=null),e.state=null,rr}function H1(e,t){var r;return!e||!e.state||(r=e.state,(r.wrap&2)===0)?Le:(r.head=t,t.done=!1,rr)}function j1(e,t){var r=t.length,n,i,o;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==to)?Le:n.mode===to&&(i=1,i=ys(i,t,r,0),i!==n.check)?Ru:(o=Uu(e,t,r,r),o?(n.mode=vs,xs):(n.havedict=1,rr))}Ge.inflateReset=Du;Ge.inflateReset2=Nu;Ge.inflateResetKeep=Bu;Ge.inflateInit=q1;Ge.inflateInit2=zu;Ge.inflate=V1;Ge.inflateEnd=$1;Ge.inflateGetHeader=H1;Ge.inflateSetDictionary=j1;Ge.inflateInfo="pako inflate (from Nodeca project)"});var ws=K((x5,Gu)=>{"use strict";Gu.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var $u=K((v5,Vu)=>{"use strict";function Z1(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Vu.exports=Z1});var ju=K(Fn=>{"use strict";var Nr=qu(),Pn=pt(),ro=as(),ie=ws(),_s=Vi(),W1=ss(),Y1=$u(),Hu=Object.prototype.toString;function nr(e){if(!(this instanceof nr))return new nr(e);this.options=Pn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new W1,this.strm.avail_out=0;var r=Nr.inflateInit2(this.strm,t.windowBits);if(r!==ie.Z_OK)throw new Error(_s[r]);if(this.header=new Y1,Nr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ro.string2buf(t.dictionary):Hu.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Nr.inflateSetDictionary(this.strm,t.dictionary),r!==ie.Z_OK)))throw new Error(_s[r])}nr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,o,a,s,l,f,c=!1;if(this.ended)return!1;a=t===~~t?t:t===!0?ie.Z_FINISH:ie.Z_NO_FLUSH,typeof e=="string"?r.input=ro.binstring2buf(e):Hu.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Pn.Buf8(n),r.next_out=0,r.avail_out=n),o=Nr.inflate(r,ie.Z_NO_FLUSH),o===ie.Z_NEED_DICT&&i&&(o=Nr.inflateSetDictionary(this.strm,i)),o===ie.Z_BUF_ERROR&&c===!0&&(o=ie.Z_OK,c=!1),o!==ie.Z_STREAM_END&&o!==ie.Z_OK)return this.onEnd(o),this.ended=!0,!1;r.next_out&&(r.avail_out===0||o===ie.Z_STREAM_END||r.avail_in===0&&(a===ie.Z_FINISH||a===ie.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=ro.utf8border(r.output,r.next_out),l=r.next_out-s,f=ro.buf2string(r.output,s),r.next_out=l,r.avail_out=n-l,l&&Pn.arraySet(r.output,r.output,s,l,0),this.onData(f)):this.onData(Pn.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(c=!0)}while((r.avail_in>0||r.avail_out===0)&&o!==ie.Z_STREAM_END);return o===ie.Z_STREAM_END&&(a=ie.Z_FINISH),a===ie.Z_FINISH?(o=Nr.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===ie.Z_OK):(a===ie.Z_SYNC_FLUSH&&(this.onEnd(ie.Z_OK),r.avail_out=0),!0)};nr.prototype.onData=function(e){this.chunks.push(e)};nr.prototype.onEnd=function(e){e===ie.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Pn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Es(e,t){var r=new nr(t);if(r.push(e,!0),r.err)throw r.msg||_s[r.err];return r.result}function K1(e,t){return t=t||{},t.raw=!0,Es(e,t)}Fn.Inflate=nr;Fn.inflate=Es;Fn.inflateRaw=K1;Fn.ungzip=Es});var Yu=K((_5,Wu)=>{"use strict";var X1=pt().assign,Q1=Xc(),J1=ju(),eb=ws(),Zu={};X1(Zu,Q1,J1,eb);Wu.exports=Zu});var Ku=K(()=>{});var Xu=K(Ms=>{Ms.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,l=(1<<s)-1,f=l>>1,c=-7,u=r?i-1:0,d=r?-1:1,h=e[t+u];for(u+=d,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=o*256+e[t+u],u+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+e[t+u],u+=d,c-=8);if(o===0)o=1-f;else{if(o===l)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-f}return(h?-1:1)*a*Math.pow(2,o-n)};Ms.write=function(e,t,r,n,i,o){var a,s,l,f=o*8-i-1,c=(1<<f)-1,u=c>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,g=n?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+u>=1?t+=d/l:t+=d*Math.pow(2,1-u),t*l>=2&&(a++,l/=2),a+u>=c?(s=0,a=c):a+u>=1?(s=(t*l-1)*Math.pow(2,i),a=a+u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=s&255,h+=g,s/=256,i-=8);for(a=a<<i|s,f+=i;f>0;e[r+h]=a&255,h+=g,a/=256,f-=8);e[r+h-g]|=x*128}});var nd=K((U5,rd)=>{"use strict";rd.exports=Z;var ao=Xu();function Z(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Z.Varint=0;Z.Fixed64=1;Z.Bytes=2;Z.Fixed32=5;var Ls=65536*65536,Qu=1/Ls,tb=12,td=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Z.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=so(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=ed(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=so(this.buf,this.pos)+so(this.buf,this.pos+4)*Ls;return this.pos+=8,e},readSFixed64:function(){var e=so(this.buf,this.pos)+ed(this.buf,this.pos+4)*Ls;return this.pos+=8,e},readFloat:function(){var e=ao.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ao.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,rb(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=tb&&td?mb(this.buf,t,e):gb(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Z.Bytes)return e.push(this.readVarint(t));var r=wt(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==Z.Bytes)return e.push(this.readSVarint());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==Z.Bytes)return e.push(this.readBoolean());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==Z.Bytes)return e.push(this.readFloat());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==Z.Bytes)return e.push(this.readDouble());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==Z.Bytes)return e.push(this.readFixed32());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==Z.Bytes)return e.push(this.readSFixed32());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==Z.Bytes)return e.push(this.readFixed64());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==Z.Bytes)return e.push(this.readSFixed64());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===Z.Varint)for(;this.buf[this.pos++]>127;);else if(t===Z.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Z.Fixed32)this.pos+=4;else if(t===Z.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Ur(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Ur(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Ur(this.buf,e&-1,this.pos),Ur(this.buf,Math.floor(e*Qu),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Ur(this.buf,e&-1,this.pos),Ur(this.buf,Math.floor(e*Qu),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){nb(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=bb(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Ju(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),ao.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ao.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Ju(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,Z.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ab,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,sb,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,cb,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,fb,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,lb,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ub,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,db,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,hb,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,pb,t)},writeBytesField:function(e,t){this.writeTag(e,Z.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Z.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Z.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Z.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Z.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Z.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Z.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Z.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Z.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Z.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};function rb(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return zr(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function wt(e){return e.type===Z.Bytes?e.readVarint()+e.pos:e.pos+1}function zr(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function nb(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),ib(r,n,t),ob(n,t)}function ib(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function ob(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Ju(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function ab(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function sb(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function fb(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function lb(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function cb(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function ub(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function db(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function hb(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function pb(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function so(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Ur(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function ed(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function gb(e,t,r){for(var n="",i=t;i<r;){var o=e[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var l,f,c;s===1?o<128&&(a=o):s===2?(l=e[i+1],(l&192)===128&&(a=(o&31)<<6|l&63,a<=127&&(a=null))):s===3?(l=e[i+1],f=e[i+2],(l&192)===128&&(f&192)===128&&(a=(o&15)<<12|(l&63)<<6|f&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(l=e[i+1],f=e[i+2],c=e[i+3],(l&192)===128&&(f&192)===128&&(c&192)===128&&(a=(o&15)<<18|(l&63)<<12|(f&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function mb(e,t,r){return td.decode(e.subarray(t,r))}function bb(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var Zd=K((e4,qs)=>{"use strict";qs.exports=Ao;qs.exports.default=Ao;function Ao(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=$d(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,l,f,c,u,d,h;if(n&&(o=Qb(e,t,o,r)),e.length>80*r){s=f=e[0],l=c=e[1];for(var g=r;g<i;g+=r)u=e[g],d=e[g+1],u<s&&(s=u),d<l&&(l=d),u>f&&(f=u),d>c&&(c=d);h=Math.max(f-s,c-l),h=h!==0?32767/h:0}return Xn(o,a,r,s,l,h,0),a}function $d(e,t,r,n,i){var o,a;if(i===Us(e,t,r,n)>0)for(o=t;o<r;o+=n)a=Vd(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=Vd(o,e[o],e[o+1],a);return a&&Po(a,a.next)&&(Jn(a),a=a.next),a}function fr(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(Po(r,r.next)||J(r.prev,r,r.next)===0)){if(Jn(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Xn(e,t,r,n,i,o,a){if(e){!a&&o&&ny(e,n,i,o);for(var s=e,l,f;e.prev!==e.next;){if(l=e.prev,f=e.next,o?Yb(e,n,i,o):Wb(e)){t.push(l.i/r|0),t.push(e.i/r|0),t.push(f.i/r|0),Jn(e),e=f.next,s=f.next;continue}if(e=f,e===s){a?a===1?(e=Kb(fr(e),t,r),Xn(e,t,r,n,i,o,2)):a===2&&Xb(e,t,r,n,i,o):Xn(fr(e),t,r,n,i,o,1);break}}}}function Wb(e){var t=e.prev,r=e,n=e.next;if(J(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,l=r.y,f=n.y,c=i<o?i<a?i:a:o<a?o:a,u=s<l?s<f?s:f:l<f?l:f,d=i>o?i>a?i:a:o>a?o:a,h=s>l?s>f?s:f:l>f?l:f,g=n.next;g!==t;){if(g.x>=c&&g.x<=d&&g.y>=u&&g.y<=h&&Vr(i,s,o,l,a,f,g.x,g.y)&&J(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Yb(e,t,r,n){var i=e.prev,o=e,a=e.next;if(J(i,o,a)>=0)return!1;for(var s=i.x,l=o.x,f=a.x,c=i.y,u=o.y,d=a.y,h=s<l?s<f?s:f:l<f?l:f,g=c<u?c<d?c:d:u<d?u:d,x=s>l?s>f?s:f:l>f?l:f,S=c>u?c>d?c:d:u>d?u:d,T=Ns(h,g,t,r,n),w=Ns(x,S,t,r,n),k=e.prevZ,L=e.nextZ;k&&k.z>=T&&L&&L.z<=w;){if(k.x>=h&&k.x<=x&&k.y>=g&&k.y<=S&&k!==i&&k!==a&&Vr(s,c,l,u,f,d,k.x,k.y)&&J(k.prev,k,k.next)>=0||(k=k.prevZ,L.x>=h&&L.x<=x&&L.y>=g&&L.y<=S&&L!==i&&L!==a&&Vr(s,c,l,u,f,d,L.x,L.y)&&J(L.prev,L,L.next)>=0))return!1;L=L.nextZ}for(;k&&k.z>=T;){if(k.x>=h&&k.x<=x&&k.y>=g&&k.y<=S&&k!==i&&k!==a&&Vr(s,c,l,u,f,d,k.x,k.y)&&J(k.prev,k,k.next)>=0)return!1;k=k.prevZ}for(;L&&L.z<=w;){if(L.x>=h&&L.x<=x&&L.y>=g&&L.y<=S&&L!==i&&L!==a&&Vr(s,c,l,u,f,d,L.x,L.y)&&J(L.prev,L,L.next)>=0)return!1;L=L.nextZ}return!0}function Kb(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!Po(i,o)&&Hd(i,n,n.next,o)&&Qn(i,o)&&Qn(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),Jn(n),Jn(n.next),n=e=o),n=n.next}while(n!==e);return fr(n)}function Xb(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&ay(a,s)){var l=jd(a,s);a=fr(a,a.next),l=fr(l,l.next),Xn(a,t,r,n,i,o,0),Xn(l,t,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==e)}function Qb(e,t,r,n){var i=[],o,a,s,l,f;for(o=0,a=t.length;o<a;o++)s=t[o]*n,l=o<a-1?t[o+1]*n:e.length,f=$d(e,s,l,n,!1),f===f.next&&(f.steiner=!0),i.push(oy(f));for(i.sort(Jb),o=0;o<i.length;o++)r=ey(i[o],r);return r}function Jb(e,t){return e.x-t.x}function ey(e,t){var r=ty(e,t);if(!r)return t;var n=jd(r,e);return fr(n,n.next),fr(r,r.next)}function ty(e,t){var r=t,n=e.x,i=e.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==t);if(!a)return null;var l=a,f=a.x,c=a.y,u=1/0,d;r=a;do n>=r.x&&r.x>=f&&n!==r.x&&Vr(i<c?n:o,i,f,c,i<c?o:n,i,r.x,r.y)&&(d=Math.abs(i-r.y)/(n-r.x),Qn(r,e)&&(d<u||d===u&&(r.x>a.x||r.x===a.x&&ry(a,r)))&&(a=r,u=d)),r=r.next;while(r!==l);return a}function ry(e,t){return J(e.prev,e,t.prev)<0&&J(t.next,e,e.next)<0}function ny(e,t,r,n){var i=e;do i.z===0&&(i.z=Ns(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,iy(i)}function iy(e){var t,r,n,i,o,a,s,l,f=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t<f&&(s++,n=n.nextZ,!!n);t++);for(l=f;s>0||l>0&&n;)s!==0&&(l===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,l--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,f*=2}while(a>1);return e}function Ns(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function oy(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Vr(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function ay(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!sy(e,t)&&(Qn(e,t)&&Qn(t,e)&&fy(e,t)&&(J(e.prev,e,t.prev)||J(e,t.prev,t))||Po(e,t)&&J(e.prev,e,e.next)>0&&J(t.prev,t,t.next)>0)}function J(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Po(e,t){return e.x===t.x&&e.y===t.y}function Hd(e,t,r,n){var i=Co(J(e,t,r)),o=Co(J(e,t,n)),a=Co(J(r,n,e)),s=Co(J(r,n,t));return!!(i!==o&&a!==s||i===0&&To(e,r,t)||o===0&&To(e,n,t)||a===0&&To(r,e,n)||s===0&&To(r,t,n))}function To(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Co(e){return e>0?1:e<0?-1:0}function sy(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Hd(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function Qn(e,t){return J(e.prev,e,e.next)<0?J(e,t,e.next)>=0&&J(e,e.prev,t)>=0:J(e,t,e.prev)<0||J(e,e.next,t)<0}function fy(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function jd(e,t){var r=new zs(e.i,e.x,e.y),n=new zs(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Vd(e,t,r,n){var i=new zs(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Jn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function zs(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ao.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(Us(e,0,o,r));if(i)for(var s=0,l=t.length;s<l;s++){var f=t[s]*r,c=s<l-1?t[s+1]*r:e.length;a-=Math.abs(Us(e,f,c,r))}var u=0;for(s=0;s<n.length;s+=3){var d=n[s]*r,h=n[s+1]*r,g=n[s+2]*r;u+=Math.abs((e[d]-e[g])*(e[h+1]-e[d+1])-(e[d]-e[h])*(e[g+1]-e[d+1]))}return a===0&&u===0?0:Math.abs((u-a)/a)};function Us(e,t,r,n){for(var i=0,o=t,a=r-n;o<r;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}Ao.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)r.vertices.push(e[i][o][a]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r}});var eh=K((o4,Jd)=>{Jd.exports=globalThis.deck});var Tr={};Ra(Tr,{carto:()=>S_});var Ma={};Ra(Ma,{BASEMAP:()=>eg,CARTO_LAYERS:()=>E_,CARTO_SOURCES:()=>Ip,CartoAPIError:()=>Er,ClusterTileLayer:()=>Dn,H3TileLayer:()=>ar,HeatmapTileLayer:()=>$n,LayerFactory:()=>hl,PointLabelLayer:()=>Zn,QuadbinTileLayer:()=>sr,RasterTileLayer:()=>Kn,SOURCE_DEFAULTS:()=>Ei,VectorTileLayer:()=>Hr,_GOOGLE_BASEMAPS:()=>Pa,_QuadbinLayer:()=>po,_RasterLayer:()=>_o,_STYLE_LAYER_GROUPS:()=>fl,_SpatialIndexTileLayer:()=>qr,_applyLayerGroupFilters:()=>Fa,_fetchStyle:()=>ka,_getStyleUrl:()=>Ye,boundaryQuerySource:()=>Xf,boundaryTableSource:()=>Qf,colorBins:()=>cl,colorCategories:()=>ul,colorContinuous:()=>dl,fetchBasemapProps:()=>og,fetchMap:()=>ng,h3QuerySource:()=>ma,h3TableSource:()=>ba,h3TilesetSource:()=>tl,quadbinQuerySource:()=>xa,quadbinTableSource:()=>va,quadbinTilesetSource:()=>rl,query:()=>Rp,rasterSource:()=>wa,vectorQuerySource:()=>_a,vectorTableSource:()=>Ea,vectorTilesetSource:()=>Sa});var hd=q(kt(),1),pd=q(dt(),1),gd=q(ln(),1);function yl(e,t,r){switch(e.type){case"Point":return pg(e,t,r);case"LineString":return hg(e,t,r);case"Polygon":return xl(e,t,r);default:let n=e;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function xl(e,t=-1/0,r=1/0){let{positions:n}=e,i=e.polygonIndices.value.filter(l=>l>=t&&l<=r),o=e.primitivePolygonIndices.value.filter(l=>l>=t&&l<=r);if(!(i.length>2)){let l=[];for(let f=0;f<o.length-1;f++){let c=o[f],u=o[f+1],d=Li(n,c,u);l.push(d)}return{type:"Polygon",coordinates:l}}let s=[];for(let l=0;l<i.length-1;l++){let f=i[l],c=i[l+1],u=xl(e,f,c).coordinates;s.push(u)}return{type:"MultiPolygon",coordinates:s}}function hg(e,t=-1/0,r=1/0){let{positions:n}=e,i=e.pathIndices.value.filter(s=>s>=t&&s<=r);if(!(i.length>2))return{type:"LineString",coordinates:Li(n,i[0],i[1])};let a=[];for(let s=0;s<i.length-1;s++){let l=Li(n,i[s],i[s+1]);a.push(l)}return{type:"MultiLineString",coordinates:a}}function pg(e,t,r){let{positions:n}=e,i=Li(n,t,r);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Li(e,t,r){t=t||0,r=r||e.value.length/e.size;let n=[];for(let i=t;i<r;i++){let o=Array();for(let a=i*e.size;a<(i+1)*e.size;a++)o.push(Number(e.value[a]));n.push(o)}return n}function Ri(e,t){let r=t?.globalFeatureId;return r!==void 0?gg(e,r):mg(e,t?.type)}function gg(e,t){let r=vl(e);for(let n of r){let i=0,o=n.featureIds.value[0];for(let a=0;a<n.featureIds.value.length;a++){let s=n.featureIds.value[a];if(s!==o){if(t===n.globalFeatureIds.value[i])return Ii(n,i,a);i=a,o=s}}if(t===n.globalFeatureIds.value[i])return Ii(n,i,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function mg(e,t){let r=vl(e,t);return bg(r)}function vl(e,t){let r=[];return e.points&&(e.points.type="Point",r.push(e.points)),e.lines&&(e.lines.type="LineString",r.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",r.push(e.polygons)),r}function bg(e){let t=[];for(let r of e){if(r.featureIds.value.length===0)continue;let n=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];a!==i&&(t.push(Ii(r,n,o)),n=o,i=a)}t.push(Ii(r,n,r.featureIds.value.length))}return t}function Ii(e,t,r){let n=yl(e,t,r),i=xg(e,t,r),o=yg(e,t,r);return{type:"Feature",geometry:n,properties:i,...o}}function yg(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function xg(e,t=0,r){let n=Object.assign({},e.properties[e.featureIds.value[t]]);for(let i in e.numericProps)n[i]=e.numericProps[i].value[t];return n}var In=q(Ee(),1);var Zt=Math.PI,Sg=Zt/4,z_=Zt/180,_l=180/Zt,El=512;function Pe(e){let[t,r]=e,n=t/El*(2*Zt)-Zt,i=2*(Math.atan(Math.exp(r/El*(2*Zt)-Zt))-Sg);return[n*_l,i*_l]}var Z_=Math.PI/180;var Dg=Math.PI/180,Ng=180/Math.PI;function Ml(e){var t=Cl(e[0]+1,e[2]),r=Cl(e[0],e[2]),n=Al(e[1]+1,e[2]),i=Al(e[1],e[2]);return[r,n,t,i]}function zg(e){var t=Ml(e),r={type:"Polygon",coordinates:[[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]],[t[0],t[1]]]]};return r}function Cl(e,t){return e/Math.pow(2,t)*360-180}function Al(e,t){var r=Math.PI-2*Math.PI*e/Math.pow(2,t);return Ng*Math.atan(.5*(Math.exp(r)-Math.exp(-r)))}function Ba(e,t,r){var n=Dl(e,t,r);return n[0]=Math.floor(n[0]),n[1]=Math.floor(n[1]),n}function Ll(e){return[[e[0]*2,e[1]*2,e[2]+1],[e[0]*2+1,e[1]*2,e[2]+1],[e[0]*2+1,e[1]*2+1,e[2]+1],[e[0]*2,e[1]*2+1,e[2]+1]]}function Il(e){return e[0]%2===0&&e[1]%2===0?[e[0]/2,e[1]/2,e[2]-1]:e[0]%2===0&&!e[1]%2===0?[e[0]/2,(e[1]-1)/2,e[2]-1]:!e[0]%2===0&&e[1]%2===0?[(e[0]-1)/2,e[1]/2,e[2]-1]:[(e[0]-1)/2,(e[1]-1)/2,e[2]-1]}function Rl(e){return Ll(Il(e))}function Ug(e,t){for(var r=Rl(e),n=0;n<r.length;n++)if(!Ol(t,r[n]))return!1;return!0}function Ol(e,t){for(var r=0;r<e.length;r++)if(Bl(e[r],t))return!0;return!1}function Bl(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function qg(e){for(var t="",r=e[2];r>0;r--){var n=0,i=1<<r-1;(e[0]&i)!==0&&n++,(e[1]&i)!==0&&(n+=2),t+=n.toString()}return t}function Gg(e){for(var t=0,r=0,n=e.length,i=n;i>0;i--){var o=1<<i-1;switch(e[n-i]){case"0":break;case"1":t|=o;break;case"2":r|=o;break;case"3":t|=o,r|=o;break}}return[t,r,n]}function Vg(e){var t=Ba(e[0],e[1],32),r=Ba(e[2],e[3],32),n=[t[0],t[1],r[0],r[1]],i=$g(n);if(i===0)return[0,0,0];var o=n[0]>>>32-i,a=n[1]>>>32-i;return[o,a,i]}function $g(e){for(var t=28,r=0;r<t;r++){var n=1<<32-(r+1);if((e[0]&n)!=(e[2]&n)||(e[1]&n)!=(e[3]&n))return r}return t}function Dl(e,t,r){var n=Math.sin(t*Dg),i=Math.pow(2,r),o=i*(e/360+.5),a=i*(.5-.25*Math.log((1+n)/(1-n))/Math.PI);return[o,a,r]}var Oi={tileToGeoJSON:zg,tileToBBOX:Ml,getChildren:Ll,getParent:Il,getSiblings:Rl,hasTile:Ol,hasSiblings:Ug,tilesEqual:Bl,tileToQuadkey:qg,quadkeyToTile:Gg,pointToTile:Ba,bboxToTile:Vg,pointToTileFraction:Dl},Hg=jg;function jg(e,t){var r,n,i=e.coordinates,o=t.max_zoom,a={},s=[];if(e.type==="Point")return[Oi.pointToTile(i[0],i[1],o)];if(e.type==="MultiPoint")for(r=0;r<i.length;r++)n=Oi.pointToTile(i[r][0],i[r][1],o),a[Ue(n[0],n[1],n[2])]=!0;else if(e.type==="LineString")Da(a,i,o);else if(e.type==="MultiLineString")for(r=0;r<i.length;r++)Da(a,i[r],o);else if(e.type==="Polygon")Pl(a,s,i,o);else if(e.type==="MultiPolygon")for(r=0;r<i.length;r++)Pl(a,s,i[r],o);else throw new Error("Geometry type not implemented");if(t.min_zoom!==o){var l=s.length;for(Fl(a,s),r=0;r<l;r++){var f=s[r];a[Ue(f[0],f[1],f[2])]=!0}return Zg(a,s,t)}return Fl(a,s),s}function Zg(e,t,r){for(var n=[],i=r.max_zoom;i>r.min_zoom;i--){for(var o={},a=[],s=0;s<t.length;s++){var l=t[s];if(l[0]%2===0&&l[1]%2===0){var f=Ue(l[0]+1,l[1],i),c=Ue(l[0],l[1]+1,i),u=Ue(l[0]+1,l[1]+1,i);if(e[f]&&e[c]&&e[u]){e[Ue(l[0],l[1],l[2])]=!1,e[f]=!1,e[c]=!1,e[u]=!1;var d=[l[0]/2,l[1]/2,i-1];i-1===r.min_zoom?n.push(d):(o[Ue(l[0]/2,l[1]/2,i-1)]=!0,a.push(d))}}}for(s=0;s<t.length;s++)l=t[s],e[Ue(l[0],l[1],l[2])]&&n.push(l);e=o,t=a}return n}function Pl(e,t,r,n){for(var i=[],o=0;o<r.length;o++){var a=[];Da(e,r[o],n,a);for(var s=0,l=a.length,f=l-1;s<l;f=s++){var c=(s+1)%l,u=a[s][1];(u>a[f][1]||u>a[c][1])&&(u<a[f][1]||u<a[c][1])&&u!==a[c][1]&&i.push(a[s])}}for(i.sort(Wg),o=0;o<i.length;o+=2){u=i[o][1];for(var d=i[o][0]+1;d<i[o+1][0];d++){var h=Ue(d,u,n);e[h]||t.push([d,u,n])}}}function Wg(e,t){return e[1]-t[1]||e[0]-t[0]}function Da(e,t,r,n){for(var i,o,a=0;a<t.length-1;a++){var s=Oi.pointToTileFraction(t[a][0],t[a][1],r),l=Oi.pointToTileFraction(t[a+1][0],t[a+1][1],r),f=s[0],c=s[1],u=l[0],d=l[1],h=u-f,g=d-c;if(!(g===0&&h===0)){var x=h>0?1:-1,S=g>0?1:-1,T=Math.floor(f),w=Math.floor(c),k=h===0?1/0:Math.abs(((h>0?1:0)+T-f)/h),L=g===0?1/0:Math.abs(((g>0?1:0)+w-c)/g),M=Math.abs(x/h),O=Math.abs(S/g);for((T!==i||w!==o)&&(e[Ue(T,w,r)]=!0,n&&w!==o&&n.push([T,w]),i=T,o=w);k<1||L<1;)k<L?(k+=M,T+=x):(L+=O,w+=S),e[Ue(T,w,r)]=!0,n&&w!==o&&n.push([T,w]),i=T,o=w}}n&&w===n[0][1]&&n.pop()}function Fl(e,t){for(var r=Object.keys(e),n=0;n<r.length;n++)t.push(Yg(+r[n]))}function Ue(e,t,r){var n=2*(1<<r);return(n*t+e)*32+r}function Yg(e){var t=e%32,r=2*(1<<t),n=(e-t)/32,i=n%r,o=(n-i)/r%r;return[i,o,t]}var Nl=[0x5555555555555555n,0x3333333333333333n,0x0f0f0f0f0f0f0f0fn,0x00ff00ff00ff00ffn,0x0000ffff0000ffffn,0x00000000ffffffffn],zl=[0n,1n,2n,4n,8n,16n],kl=512;function Kg(e){let{x:t,y:r,z:n}=Wt(e),i=kl/(1<<n);return[t*i,kl-r*i,i]}function Xg(e,t){let[r,n,i]=Kg(e);return[[r,n],[r+t*i,n-t*i]]}function Qg(e,t=1){let[r,n]=Xg(e,t),[i,o]=Pe(r),[a,s]=Pe(n);return[a,o,a,s,i,s,i,o,a,o]}function Ul(e){return BigInt(`0x${e}`)}function cn(e){return e.toString(16)}function un(e){if(e.z<0||e.z>26)throw new Error("Wrong zoom");let t=BigInt(e.z),r=BigInt(e.x)<<32n-t,n=BigInt(e.y)<<32n-t;for(let o=0;o<5;o++){let a=zl[5-o],s=Nl[4-o];r=(r|r<<a)&s,n=(n|n<<a)&s}return 0x4000000000000000n|1n<<59n|t<<52n|(r|n<<1n)>>12n|0xfffffffffffffn>>t*2n}function Wt(e){let t=e>>59n&7n,r=e>>57n&3n,n=e>>52n&0x1fn,i=(e&0xfffffffffffffn)<<12n;if(t!==1n&&r!==0n)throw new Error("Wrong mode");let o=i,a=i>>1n;for(let s=0;s<6;s++){let l=zl[s],f=Nl[s];o=(o|o>>l)&f,a=(a|a>>l)&f}return o=o>>32n-n,a=a>>32n-n,{z:Number(n),x:Number(o),y:Number(a)}}function ht(e){return e>>52n&0x1fn}function Bi(e){let t=ht(e)-1n;return e&~(0x1fn<<52n)|t<<52n|0xfffffffffffffn>>t*2n}function ql(e,t){let r=Number(t);return Hg(e,{min_zoom:r,max_zoom:r}).map(([n,i,o])=>un({x:n,y:i,z:o}))}function Gl(e){let t=Qg(e);return{type:"Polygon",coordinates:[[[t[0],t[1]],[t[2],t[3]],[t[4],t[5]],[t[6],t[7]],[t[0],t[1]]]]}}var Ni=q(Yt(),1),jl=q(Ee(),1);var $l=q(Ee(),1);function Fe(e,t){$l.log.assert(e,t)}function Hl(e,t){let{properties:r,numericProps:n}=e;return new Proxy(r[t]||{},{get(i,o){return o in n?n[o].value[t]:i[o]},has(i,o){return o in n||o in i},ownKeys(i){return[...Object.keys(n),...Reflect.ownKeys(i)]},getOwnPropertyDescriptor(i,o){return{enumerable:!0,configurable:!0}}})}function Mt(e,t){return`https://unpkg.com/@deck.gl/carto@${t}/dist/${e}-worker.js`}var dn=new Uint16Array,Na={positions:{value:new Float32Array,size:2},properties:[],numericProps:{},featureIds:{value:dn,size:1},globalFeatureIds:{value:dn,size:1}};function Di(){return{shape:"binary-feature-collection",points:{type:"Point",...Na},lines:{type:"LineString",pathIndices:{value:dn,size:1},...Na},polygons:{type:"Polygon",polygonIndices:{value:dn,size:1},primitivePolygonIndices:{value:dn,size:1},...Na}}}function hn(e,t,r,n,i,o=2){return{type:"Point",positions:{value:new Float32Array(e),size:o},featureIds:{value:new Uint16Array(t),size:1},globalFeatureIds:{value:new Uint32Array(r),size:1},numericProps:n,properties:i}}function za(e,t){let r={};return t&&Object.keys(t).forEach(n=>{r[n]={value:new Float32Array(e),size:1}}),r}function Ua(e,t,r,n){Object.keys(e).forEach(i=>{t[i].value[n]=e[i].value[r]})}function Zl(e,t,r,n=[],i,o,a="quadbin"){if(!e.content)return!1;e.userData||(e.userData={});let s=t.get(r)?.[0];if(s){if(n.every(f=>f.name in s))return!1;t.clear()}let l={};for(let f of e.content){let c=f.id,u=typeof i=="function"?i(f,{}):i;for(let S=0;S<r-1;S++)if(a==="h3"){let T=(0,Ni.getResolution)(c);c=(0,Ni.cellToParent)(c,Math.max(0,T-1))}else c=Bi(c);let d=String(c);if(!(d in l)){l[d]={id:c,count:0,position:[0,0]};for(let{name:S,aggregation:T}of n)T==="any"?l[d][S]=f.properties[S]:l[d][S]=0}let h=l[d].count;l[d].count+=typeof o=="function"?o(f,{}):o;let g=l[d].count,x=g-h;l[d].position[0]=(h*l[d].position[0]+x*u[0])/g,l[d].position[1]=(h*l[d].position[1]+x*u[1])/g;for(let{name:S,aggregation:T}of n){let w=l[d][S],k=f.properties[S];T==="average"?l[d][S]=(h*w+x*k)/g:T==="count"||T==="sum"?l[d][S]=w+k:T==="max"?l[d][S]=Math.max(w,k):T==="min"&&(l[d][S]=Math.min(w,k))}}return t.set(r,Object.values(l)),!0}function Wl(e){let t=[],r=["any","average","count","min","max","sum"];for(let n of Object.keys(e.content[0].properties)){let i=n.split("_").pop().toLowerCase();r.includes(i)||(jl.log.warn(`No valid aggregation present in ${n} property`)(),i="any"),t.push({name:n,aggregation:i})}return t}function Yl(e,t){let r={};for(let{name:n,aggregation:i}of t)if(r[n]={min:1/0,max:-1/0},i!=="any")for(let o of e)r[n].min=Math.min(r[n].min,o[n]),r[n].max=Math.max(r[n].max,o[n]);return r}function Kl(e){let t=new Float32Array(e.length*2),r=new Uint16Array(e.length);for(let n=0;n<e.length;n++)t.set(e[n].position,2*n),r[n]=n;return{...Di(),points:hn(t,r,r,{},e)}}var Xl=q(dt(),1);var Qe=class extends Xl._Tileset2D{getTileIndices(t){return super.getTileIndices(t).map(un).map(r=>({q:r,i:cn(r)}))}getTileId({q:t,i:r}){return r||cn(t)}getTileMetadata({q:t}){return super.getTileMetadata(Wt(t))}getTileZoom({q:t}){return Number(ht(t))}getParentIndex({q:t}){return{q:Bi(t)}}};var Jl=q(dt(),1),ne=q(Yt(),1),Ql=85.051128;function ec({west:e,north:t,east:r,south:n},i,o=1){let l=[[t,r],[n,r],[n,e],[t,e]].map(u=>(0,ne.latLngToCell)(u[0],u[1],i)).map(u=>Math.max(...(0,ne.originToDirectedEdges)(u).map(d=>(0,ne.edgeLength)(d,ne.UNITS.rads)))*180/Math.PI),f=Math.max(...l)*o,c=Math.min(180,f/Math.cos((t+n)/2*Math.PI/180));return{north:Math.min(t+f,Ql),east:r+c,south:Math.max(n-f,-Ql),west:e-c}}function tc({west:e,north:t,east:r,south:n},i){let o=Math.abs(r-e);if(o>180){let s=Math.ceil(o/180),l=[];for(let f=0;f<s;f++){let c=e+f*180,u=Math.min(c+179.9999999,r);l=l.concat(tc({west:c,north:t,east:u,south:n},i))}return[...new Set(l)]}return(0,ne.polygonToCells)([[t,r],[n,r],[n,e],[t,e],[t,r]],i)}function Jg(e){let t=(0,ne.cellToBoundary)(e),r=t.map(f=>f[0]),n=t.map(f=>f[1]),i=Math.min(...n),o=Math.min(...r),a=Math.max(...n),s=Math.max(...r);return ec({west:i,south:o,east:a,north:s},(0,ne.getResolution)(e),.12)}var em=2;function Cr(e,t){let r=Math.log2(t/512),n=2/3*(e.zoom-r),i=Math.log(1/Math.cos(Math.PI*e.latitude/180));return Math.max(0,Math.floor(n+i-em))}var Lt=class extends Jl._Tileset2D{getTileIndices({viewport:t,minZoom:r,maxZoom:n}){if(t.latitude===void 0)return[];let[i,o,a,s]=t.getBounds(),{tileSize:l}=this.opts,f=Cr(t,l),c;if(typeof r=="number"&&Number.isFinite(r)&&f<r)return[];if(typeof n=="number"&&Number.isFinite(n)&&f>n){f=n;let u=(0,ne.latLngToCell)(t.latitude,t.longitude,n);c=(0,ne.gridDisk)(u,1)}else{let u=ec({west:i,north:s,east:a,south:o},f);c=tc(u,f)}return c.map(u=>({i:u}))}getTileId({i:t}){return t}getTileMetadata({i:t}){return{bbox:Jg(t)}}getTileZoom({i:t}){return(0,ne.getResolution)(t)}getParentIndex(t){let r=(0,ne.getResolution)(t.i);return{i:(0,ne.cellToParent)(t.i,r-1)}}};var rc=512;function qa(e){let{x:t,y:r,z:n}=Wt(e),i=rc/(1<<n);return[t*i,rc-r*i,i]}function tm(e,t){let[r,n,i]=qa(e);return[[r,n],[r+t*i,n-t*i]]}function zi(e,t=1){let[r,n]=tm(e,t),[i,o]=Pe(r),[a,s]=Pe(n);return[a,o,a,s,i,s,i,o,a,o]}var lo=q(Yt(),1);var Je={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},rm=Je.self||Je.window||Je.global||{},nm=Je.window||Je.self||Je.global||{},im=Je.global||Je.self||Je.window||{},om=Je.document||{};var Ar=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser);var nc=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),am=nc&&parseFloat(nc[1])||0;var ic=e=>typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer;function Ga(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function oc(...e){return sm(e)}function sm(e){let t=e.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=t.reduce((o,a)=>o+a.byteLength,0),n=new Uint8Array(r),i=0;for(let o of t)n.set(o,i),i+=o.byteLength;return n.buffer}async function Va(e){let t=[];for await(let r of e)t.push(fm(r));return oc(...t)}function fm(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:n}=e;return ac(t,r,n)}return ac(e)}function ac(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),i=new Uint8Array(n.length);return i.set(n),i.buffer}function sc(e){return e&&typeof e=="object"&&e.isBuffer}function It(e){if(sc(e))return e;if(e instanceof ArrayBuffer)return e;if(ic(e))return fc(e);if(ArrayBuffer.isView(e)){let t=e.buffer;return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function fc(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Pr(e){return t=>new Promise((r,n)=>e(t,(i,o)=>i?n(i):r(o)))}var Ui=class{constructor(t){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(t={}){Ga(t)}async compress(t){return await this.preload(),this.compressSync(t)}async decompress(t,r){return await this.preload(),this.decompressSync(t,r)}compressSync(t){throw new Error(`${this.name}: sync compression not supported`)}decompressSync(t,r){throw new Error(`${this.name}: sync decompression not supported`)}async*compressBatches(t){let r=await this.concatenate(t);yield this.compress(r)}async*decompressBatches(t){let r=await this.concatenate(t);yield this.decompress(r)}concatenate(t){return Va(t)}improveError(t){return t.message.includes(this.name)||(t.message=`${this.name} ${t.message}`),t}};var ir=q(Yu(),1),yt=q(Ku(),1),no=class extends Ui{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(t={}){super(t),this.options=t}async compress(t){if(!Ar&&this.options.deflate?.useZlib){let r=this.options.deflate?.gzip?await Pr(yt.default.gzip)(t):await Pr(yt.default.deflate)(t);return It(r)}return this.compressSync(t)}async decompress(t){if(!Ar&&this.options.deflate?.useZlib){let r=this.options.deflate?.gzip?await Pr(yt.default.gunzip)(t):await Pr(yt.default.inflate)(t);return It(r)}return this.decompressSync(t)}compressSync(t){if(!Ar&&this.options.deflate?.useZlib){let o=this.options.deflate?.gzip?yt.default.gzipSync(t):yt.default.deflateSync(t);return It(o)}let r=this.options?.deflate||{},n=new Uint8Array(t),i=this.options?.raw?ir.default.deflateRaw:ir.default.deflate;return It(i(n,r).buffer)}decompressSync(t){if(!Ar&&this.options.deflate?.useZlib){let o=this.options.deflate?.gzip?yt.default.gunzipSync(t):yt.default.inflateSync(t);return It(o)}let r=this.options?.deflate||{},n=new Uint8Array(t),i=this.options?.raw?ir.default.inflateRaw:ir.default.inflate;return It(i(n,r).buffer)}async*compressBatches(t){let r=this.options?.deflate||{},n=new ir.default.Deflate(r);yield*this.transformBatches(n,t)}async*decompressBatches(t){let r=this.options?.deflate||{},n=new ir.default.Inflate(r);yield*this.transformBatches(n,t)}async*transformBatches(t,r){t.onData=this._onData.bind(this),t.onEnd=this._onEnd.bind(this);for await(let a of r){let s=new Uint8Array(a);if(!t.push(s,!1))throw new Error(`${this._getError()}write`);yield*this._getChunks()}let n=new Uint8Array(0),i=t.push(n,!0);yield*this._getChunks()}_onData(t){this._chunks.push(t)}_onEnd(t){if(t!==0)throw new Error(this._getError(t)+this._chunks.length)}_getChunks(){let t=this._chunks;return this._chunks=[],t}_getError(t=0){let r={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};return`${this.name}: ${r[t]}`}};var kn=class extends no{name="gzip";extensions=["gz","gzip"];contentEncodings=["gzip","x-gzip"];isSupported=!0;constructor(t){super({...t,deflate:{...t?.gzip,gzip:!0}})}};function or(e,t,r,n){let i=t.type===2?t.readVarint()+t.pos:t.pos+1,o=t.buf.buffer.slice(t.pos,i);if(n?.compression==="gzip"){let s=new kn().decompressSync(o);r.value=new e(s)}else r.value=new e(o);return t.pos=i,r.value}var Ss=class e{static read(t,r){return t.readFields(e._readField,{key:"",value:null},r)}static _readField(t,r,n){t===1?r.key=n.readString():t===2&&(r.value=n.readString())}},xt=class e{static read(t,r){return t.readFields(e._readField,{},r)}static _readField(t,r,n){if(t===1){let{key:i,value:o}=Ss.read(n,n.readVarint()+n.pos);r[i]=o}}},Mn=class e{static read(t,r){let{value:n,size:i}=t.readFields(e._readField,{value:[],size:0},r);return{value:n,size:i}}static _readField(t,r,n){t===1?or(Float64Array,n,r):t===2&&(r.size=n.readVarint(!0))}},Ie=class e{static read(t,r){let{value:n,size:i}=t.readFields(e._readField,{value:[],size:0},r);return{value:new Uint32Array(n),size:i}}static _readField(t,r,n){t===1?n.readPackedVarint(r.value):t===2&&(r.size=n.readVarint(!0))}},Ln=class e{static read(t,r){return t.readFields(e._readField,{id:0},r)}static _readField(t,r,n){t===1&&(r.id=n.readVarint())}},Ts=class e{static read(t,r){return t.readFields(e._readField,{value:[]},r)}static _readField(t,r,n){t===1&&or(Float64Array,n,r)}},vt=class e{static read(t,r){return t.readFields(e._readField,{key:"",value:null},r)}static _readField(t,r,n){t===1?r.key=n.readString():t===2&&(r.value=Ts.read(n,n.readVarint()+n.pos))}},Cs=class e{static read(t,r){return t.readFields(e._readField,{positions:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},r)}static _readField(t,r,n){if(t===1)r.positions=Mn.read(n,n.readVarint()+n.pos);else if(t===2)r.globalFeatureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===3)r.featureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===4)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===5){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}else t===6&&r.fields.push(Ln.read(n,n.readVarint()+n.pos))}},As=class e{static read(t,r){return t.readFields(e._readField,{positions:null,pathIndices:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},r)}static _readField(t,r,n){if(t===1)r.positions=Mn.read(n,n.readVarint()+n.pos);else if(t===2)r.pathIndices=Ie.read(n,n.readVarint()+n.pos);else if(t===3)r.globalFeatureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===4)r.featureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===5)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===6){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}else t===7&&r.fields.push(Ln.read(n,n.readVarint()+n.pos))}},Ps=class e{static read(t,r){return t.readFields(e._readField,{positions:null,polygonIndices:null,globalFeatureIds:null,featureIds:null,primitivePolygonIndices:null,triangles:null,properties:[],numericProps:{},fields:[]},r)}static _readField(t,r,n){if(t===1)r.positions=Mn.read(n,n.readVarint()+n.pos);else if(t===2)r.polygonIndices=Ie.read(n,n.readVarint()+n.pos);else if(t===3)r.globalFeatureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===4)r.featureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===5)r.primitivePolygonIndices=Ie.read(n,n.readVarint()+n.pos);else if(t===6)r.triangles=Ie.read(n,n.readVarint()+n.pos);else if(t===7)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===8){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}else t===9&&r.fields.push(Ln.read(n,n.readVarint()+n.pos))}},io=class e{static read(t,r){return t.readFields(e._readField,{points:null,lines:null,polygons:null},r)}static _readField(t,r,n){t===1?r.points=Cs.read(n,n.readVarint()+n.pos):t===2?r.lines=As.read(n,n.readVarint()+n.pos):t===3&&(r.polygons=Ps.read(n,n.readVarint()+n.pos))}};var Fs=class e{static read(t,r){return t.readFields(e._readField,{value:[]},r)}static _readField(t,r,n){t===1&&or(BigUint64Array,n,r)}},ks=class e{static read(t,r){return t.readFields(e._readField,{indices:null,properties:[],numericProps:{}},r)}static _readField(t,r,n){if(t===1)r.indices=Fs.read(n,n.readVarint()+n.pos);else if(t===2)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===3){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}}},oo=class e{static read(t,r){return t.readFields(e._readField,{scheme:0,cells:null},r)}static _readField(t,r,n){t===1?r.scheme=n.readVarint():t===2&&(r.cells=ks.read(n,n.readVarint()+n.pos))}};var id=q(nd(),1);function Ut(e,t){let r=new id.default(e);return t.read(r)}function od(e){let{cells:t,scheme:r}=e,n=t.indices.value.length,i=[];for(let o=0;o<n;o++){let a=r==="h3"?cn(t.indices.value[o]):t.indices.value[o],s={...t.properties[o]};for(let l of Object.keys(t.numericProps))s[l]=t.numericProps[l].value[o];i.push({id:a,properties:s})}return i}var sd="9.4.0-beta.4",fd="cartoSpatialTile",yb={cartoSpatialTile:{scheme:"quadbin",workerUrl:Mt(fd,sd)}},xb={name:"CARTO Spatial Tile",version:sd,id:fd,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-spatial-tile"],category:"geometry",parse:async(e,t)=>ad(e,t),parseSync:ad,worker:!0,options:yb};function ad(e,t){if(!e)return null;let r=Ut(e,oo),{cells:n}=r,i=t?.cartoSpatialTile?.scheme;return od({cells:n,scheme:i})}var fo=xb;var ld=q(Ee(),1),cd=q(Ee(),1);function Ve(e,t,r=0){if(!e)return t;if(!t)return e;if(r>10)return t;let n={...e};for(let i in t){let o=t[i];o===e||o===t||(typeof o=="object"&&o!==null?n[i]=Ve(e[i],o,r+1):n[i]=o)}return n}function ud(e,t){let r={};for(let{geoid:n,...i}of t.properties)n in r?ld.log.warn("Duplicate geoid key in boundary mapping, using first occurance")():r[n]=i;for(let n of["points","lines","polygons"]){let i=e[n];if(i.positions.value.length===0)continue;i.properties=i.properties.map(({geoid:f})=>r[f]);let{positions:o,globalFeatureIds:a}=i,s=null;n==="lines"&&(s=i.pathIndices.value),n==="polygons"&&(s=i.polygonIndices.value);let l=o.value.length/o.size;for(let f in t.numericProps){let c=t.numericProps[f].value,u=c.constructor,d=new u(l);if(i.numericProps[f]={value:d,size:1},s)for(let h=0;h<s.length-1;h++){let g=s[h],x=s[h+1],S=a.value[g];d.fill(c[S],g,x)}else for(let h=0;h<l;h++){let g=a.value[h];d[h]=c[g]}}}return e}var Te={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="object"&&Array.isArray(e.tiles)&&e.tiles.every(r=>typeof r=="string"),equal:(e,t)=>(0,cd._deepEqual)(e,t,2),async:!0};(0,gd.registerLoaders)([fo]);function dd(e){if(e===Lt)return"h3";if(e===Qe)return"quadbin";throw new Error("Invalid tileset class")}var md={data:Te,clusterLevel:{type:"number",value:5,min:1},getPosition:{type:"accessor",value:({id:e})=>{if(typeof e=="string"){let[t,r]=(0,lo.cellToLatLng)(e);return[r,t]}return zi(e,.5).slice(2,4)}},getWeight:{type:"accessor",value:1},refinementStrategy:"no-overlap",tileSize:512},Rn=class extends pd.TileLayer{initializeState(){super.initializeState(),this.state.aggregationCache=new WeakMap,this.state.scheme=dd(this.props.TilesetClass)}updateState(t){let{props:r}=t,n=dd(r.TilesetClass);this.state.scheme!==n&&(this.setState({scheme:n,tileset:null}),this.state.aggregationCache=new WeakMap),super.updateState(t)}renderLayers(){let t=this.state.tileset?.tiles.filter(h=>h.isLoaded&&h.content&&this.state.tileset.isTileVisible(h));if(!t?.length||!this.state.tileset)return null;t.sort((h,g)=>g.zoom-h.zoom);let{getPosition:r,getWeight:n}=this.props,{aggregationCache:i,scheme:o}=this.state,a=o==="h3",s=Wl(t[0]),l=[],f=!1,c=this._getAggregationLevels(t);for(let h of t){let g=i.get(h.content);g||(g=new Map,i.set(h.content,g));let x=Zl(h,g,c,s,r,n,a?"h3":"quadbin");f||(f=x),l.push(...g.get(c))}l.sort((h,g)=>Number(g.count-h.count));let u=l?.map(h=>h.id);if(f||(f=!(0,In._deepEqual)(u,this.state.clusterIds,1)),this.setState({clusterIds:u}),f){let h=Yl(l,s),g=Kl(l);g.points.attributes={stats:h},this.setState({data:g})}let d={...this.props,id:"clusters",data:this.state.data,dataComparator:(h,g)=>{let x=h?.points?.properties?.map(T=>T.id),S=g?.points?.properties?.map(T=>T.id);return(0,In._deepEqual)(x,S,1)}};return new hd.GeoJsonLayer(this.getSubLayerProps(d))}getPickingInfo(t){let r=t.info;if(r.index!==-1){let{data:n}=t.sourceLayer.props;r.object=Ri(n,{globalFeatureId:r.index})}return r}_updateAutoHighlight(t){for(let r of this.getSubLayers())r.updateAutoHighlight(t)}filterSubLayer(){return!0}_getAggregationLevels(t){let r=this.state.scheme==="h3",n=t[0],i,o;r?(i=(0,lo.getResolution)(n.id),o=Cr(this.context.viewport,this.state.tileset.opts.tileSize)):(i=n.zoom,o=this.context.viewport.zoom);let a=Math.round(o-i);return Math.round(this.props.clusterLevel)-a}};Rn.layerName="ClusterGeoJsonLayer";Rn.defaultProps=md;var On=class extends In.CompositeLayer{getLoadOptions(){let t=this.props.data,r=t&&"scheme"in t?t.scheme:"quadbin";return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},cartoSpatialTile:{scheme:r}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r,maxresolution:n}=t,o=t&&"scheme"in t&&t.scheme==="h3"?Lt:Qe;return[new Rn(this.props,{id:`cluster-geojson-layer-${this.props.id}`,data:r,TilesetClass:o,maxZoom:n,loadOptions:this.getLoadOptions()})]}};On.layerName="ClusterTileLayer";On.defaultProps=md;var Dn=On;var xd=q(Ee(),1),Is=q(dt(),1);var bd=q(ln(),1);var yd=q(dt(),1);(0,bd.registerLoaders)([fo]);function vb(e){return e!=null&&e!==""}var wb={tileSize:512},Nn=class extends yd.TileLayer{_updateAutoHighlight(t){let{hoveredFeatureId:r}=this.state,n=t.object,i=null;if(n&&(i=n.id),r!==i){let{highlightColor:o}=this.props;typeof o=="function"&&(o=o(t)),this.setState({highlightColor:o,hoveredFeatureId:i})}}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:r}=this.state,n=t.content;return!vb(r)||!Array.isArray(n)||!this._featureInTile(t,r)?-1:n.findIndex(o=>o.id===r)}_featureInTile(t,r){let n=this.state.tileset,i=n.getTileZoom(t.index),o=t.index.q?"q":"i",a={[o]:r},s=n.getTileZoom(a);for(;!(s<=i);)a=n.getParentIndex(a),s=n.getTileZoom(a);return a[o]===t.index[o]}};Nn.layerName="SpatialIndexTileLayer";Nn.defaultProps=wb;var qr=Nn;var _b=e=>{let{data:t}=e,{index:r}=e.tile;return!t||!t.length?null:new Is.H3HexagonLayer(e,{getHexagon:n=>n.id,centerHexagon:r,highPrecision:!0})},Eb={data:Te,tileSize:512},zn=class extends xd.CompositeLayer{initializeState(){Is.H3HexagonLayer._checkH3Lib()}getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},cartoSpatialTile:{scheme:"h3"}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r}=t,{minresolution:n,maxresolution:i}=t;this.props.minZoom&&(n=Math.max(n,Cr({zoom:this.props.minZoom,latitude:0},this.props.tileSize))),this.props.maxZoom&&(i=Math.min(i,Cr({zoom:this.props.maxZoom,latitude:0},this.props.tileSize)));let o=this.getSubLayerClass("spatial-index-tile",qr);return new o(this.props,{id:`h3-tile-layer-${this.props.id}`,data:r,TilesetClass:Lt,renderSubLayers:_b,minZoom:n,maxZoom:i,loadOptions:this.getLoadOptions()})}};zn.layerName="H3TileLayer";zn.defaultProps=Eb;var ar=zn;var mo=q(Yt(),1),bo=q(Ee(),1),Ed=q(kt(),1);var Sb=`layout(std140) uniform heatmapUniforms {
7
+ "use strict";var __exports__=(()=>{var sg=Object.create;var Li=Object.defineProperty;var lg=Object.getOwnPropertyDescriptor;var fg=Object.getOwnPropertyNames;var cg=Object.getPrototypeOf,ug=Object.prototype.hasOwnProperty;var K=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Ra=(e,t)=>{for(var r in t)Li(e,r,{get:t[r],enumerable:!0})},ki=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of fg(t))!ug.call(e,i)&&i!==r&&Li(e,i,{get:()=>t[i],enumerable:!(n=lg(t,i))||n.enumerable});return e},Xe=(e,t,r)=>(ki(e,t,"default"),r&&ki(r,t,"default")),q=(e,t,r)=>(r=e!=null?sg(cg(e)):{},ki(t||!e||!e.__esModule?Li(r,"default",{value:e,enumerable:!0}):r,e)),dg=e=>ki(Li({},"__esModule",{value:!0}),e);var kt=K((C_,gf)=>{gf.exports=globalThis.deck});var dt=K((A_,mf)=>{mf.exports=globalThis.deck});var fn=K((P_,bf)=>{bf.exports=globalThis.loaders});var Ee=K((R_,wf)=>{wf.exports=globalThis.deck});var Yt=K((C3,Vf)=>{Vf.exports=globalThis.h3||{}});var pt=K(he=>{"use strict";var fm=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Int32Array<"u";function cm(e,t){return Object.prototype.hasOwnProperty.call(e,t)}he.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(var n in r)cm(r,n)&&(e[n]=r[n])}}return e};he.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var um={arraySet:function(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},dm={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};he.setTyped=function(e){e?(he.Buf8=Uint8Array,he.Buf16=Uint16Array,he.Buf32=Int32Array,he.assign(he,um)):(he.Buf8=Array,he.Buf16=Array,he.Buf32=Array,he.assign(he,dm))};he.setTyped(fm)});var Lc=K(Lr=>{"use strict";var hm=pt(),pm=4,fc=0,cc=1,gm=2;function kr(e){for(var t=e.length;--t>=0;)e[t]=0}var mm=0,mc=1,bm=2,ym=3,xm=258,Ka=29,xn=256,gn=xn+1+Ka,Fr=30,Xa=19,bc=2*gn+1,Kt=15,$a=16,vm=7,Qa=256,yc=16,xc=17,vc=18,Wa=[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],qi=[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],wm=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],wc=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],_m=512,gt=new Array((gn+2)*2);kr(gt);var pn=new Array(Fr*2);kr(pn);var mn=new Array(_m);kr(mn);var bn=new Array(xm-ym+1);kr(bn);var Ja=new Array(Ka);kr(Ja);var Gi=new Array(Fr);kr(Gi);function Ha(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var _c,Ec,Sc;function ja(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Tc(e){return e<256?mn[e]:mn[256+(e>>>7)]}function yn(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function me(e,t,r){e.bi_valid>$a-r?(e.bi_buf|=t<<e.bi_valid&65535,yn(e,e.bi_buf),e.bi_buf=t>>$a-e.bi_valid,e.bi_valid+=r-$a):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function et(e,t,r){me(e,r[t*2],r[t*2+1])}function Cc(e,t){var r=0;do r|=e&1,e>>>=1,r<<=1;while(--t>0);return r>>>1}function Em(e){e.bi_valid===16?(yn(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function Sm(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,f=t.stat_desc.max_length,l,c,u,d,h,g,x=0;for(d=0;d<=Kt;d++)e.bl_count[d]=0;for(r[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<bc;l++)c=e.heap[l],d=r[r[c*2+1]*2+1]+1,d>f&&(d=f,x++),r[c*2+1]=d,!(c>n)&&(e.bl_count[d]++,h=0,c>=s&&(h=a[c-s]),g=r[c*2],e.opt_len+=g*(d+h),o&&(e.static_len+=g*(i[c*2+1]+h)));if(x!==0){do{for(d=f-1;e.bl_count[d]===0;)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[f]--,x-=2}while(x>0);for(d=f;d!==0;d--)for(c=e.bl_count[d];c!==0;)u=e.heap[--l],!(u>n)&&(r[u*2+1]!==d&&(e.opt_len+=(d-r[u*2+1])*r[u*2],r[u*2+1]=d),c--)}}function Ac(e,t,r){var n=new Array(Kt+1),i=0,o,a;for(o=1;o<=Kt;o++)n[o]=i=i+r[o-1]<<1;for(a=0;a<=t;a++){var s=e[a*2+1];s!==0&&(e[a*2]=Cc(n[s]++,s))}}function Tm(){var e,t,r,n,i,o=new Array(Kt+1);for(r=0,n=0;n<Ka-1;n++)for(Ja[n]=r,e=0;e<1<<Wa[n];e++)bn[r++]=n;for(bn[r-1]=n,i=0,n=0;n<16;n++)for(Gi[n]=i,e=0;e<1<<qi[n];e++)mn[i++]=n;for(i>>=7;n<Fr;n++)for(Gi[n]=i<<7,e=0;e<1<<qi[n]-7;e++)mn[256+i++]=n;for(t=0;t<=Kt;t++)o[t]=0;for(e=0;e<=143;)gt[e*2+1]=8,e++,o[8]++;for(;e<=255;)gt[e*2+1]=9,e++,o[9]++;for(;e<=279;)gt[e*2+1]=7,e++,o[7]++;for(;e<=287;)gt[e*2+1]=8,e++,o[8]++;for(Ac(gt,gn+1,o),e=0;e<Fr;e++)pn[e*2+1]=5,pn[e*2]=Cc(e,5);_c=new Ha(gt,Wa,xn+1,gn,Kt),Ec=new Ha(pn,qi,0,Fr,Kt),Sc=new Ha(new Array(0),wm,0,Xa,vm)}function Pc(e){var t;for(t=0;t<gn;t++)e.dyn_ltree[t*2]=0;for(t=0;t<Fr;t++)e.dyn_dtree[t*2]=0;for(t=0;t<Xa;t++)e.bl_tree[t*2]=0;e.dyn_ltree[Qa*2]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function Fc(e){e.bi_valid>8?yn(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Cm(e,t,r,n){Fc(e),n&&(yn(e,r),yn(e,~r)),hm.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function uc(e,t,r,n){var i=t*2,o=r*2;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function Za(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&uc(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!uc(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function dc(e,t,r){var n,i,o=0,a,s;if(e.last_lit!==0)do n=e.pending_buf[e.d_buf+o*2]<<8|e.pending_buf[e.d_buf+o*2+1],i=e.pending_buf[e.l_buf+o],o++,n===0?et(e,i,t):(a=bn[i],et(e,a+xn+1,t),s=Wa[a],s!==0&&(i-=Ja[a],me(e,i,s)),n--,a=Tc(n),et(e,a,r),s=qi[a],s!==0&&(n-=Gi[a],me(e,n,s)));while(o<e.last_lit);et(e,Qa,t)}function Ya(e,t){var r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems,a,s,f=-1,l;for(e.heap_len=0,e.heap_max=bc,a=0;a<o;a++)r[a*2]!==0?(e.heap[++e.heap_len]=f=a,e.depth[a]=0):r[a*2+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=f<2?++f:0,r[l*2]=1,e.depth[l]=0,e.opt_len--,i&&(e.static_len-=n[l*2+1]);for(t.max_code=f,a=e.heap_len>>1;a>=1;a--)Za(e,r,a);l=o;do a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Za(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[l*2]=r[a*2]+r[s*2],e.depth[l]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[a*2+1]=r[s*2+1]=l,e.heap[1]=l++,Za(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],Sm(e,t),Ac(r,f,e.bl_count)}function hc(e,t,r){var n,i=-1,o,a=t[1],s=0,f=7,l=4;for(a===0&&(f=138,l=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)o=a,a=t[(n+1)*2+1],!(++s<f&&o===a)&&(s<l?e.bl_tree[o*2]+=s:o!==0?(o!==i&&e.bl_tree[o*2]++,e.bl_tree[yc*2]++):s<=10?e.bl_tree[xc*2]++:e.bl_tree[vc*2]++,s=0,i=o,a===0?(f=138,l=3):o===a?(f=6,l=3):(f=7,l=4))}function pc(e,t,r){var n,i=-1,o,a=t[1],s=0,f=7,l=4;for(a===0&&(f=138,l=3),n=0;n<=r;n++)if(o=a,a=t[(n+1)*2+1],!(++s<f&&o===a)){if(s<l)do et(e,o,e.bl_tree);while(--s!==0);else o!==0?(o!==i&&(et(e,o,e.bl_tree),s--),et(e,yc,e.bl_tree),me(e,s-3,2)):s<=10?(et(e,xc,e.bl_tree),me(e,s-3,3)):(et(e,vc,e.bl_tree),me(e,s-11,7));s=0,i=o,a===0?(f=138,l=3):o===a?(f=6,l=3):(f=7,l=4)}}function Am(e){var t;for(hc(e,e.dyn_ltree,e.l_desc.max_code),hc(e,e.dyn_dtree,e.d_desc.max_code),Ya(e,e.bl_desc),t=Xa-1;t>=3&&e.bl_tree[wc[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Pm(e,t,r,n){var i;for(me(e,t-257,5),me(e,r-1,5),me(e,n-4,4),i=0;i<n;i++)me(e,e.bl_tree[wc[i]*2+1],3);pc(e,e.dyn_ltree,t-1),pc(e,e.dyn_dtree,r-1)}function Fm(e){var t=4093624447,r;for(r=0;r<=31;r++,t>>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return fc;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return cc;for(r=32;r<xn;r++)if(e.dyn_ltree[r*2]!==0)return cc;return fc}var gc=!1;function km(e){gc||(Tm(),gc=!0),e.l_desc=new ja(e.dyn_ltree,_c),e.d_desc=new ja(e.dyn_dtree,Ec),e.bl_desc=new ja(e.bl_tree,Sc),e.bi_buf=0,e.bi_valid=0,Pc(e)}function kc(e,t,r,n){me(e,(mm<<1)+(n?1:0),3),Cm(e,t,r,!0)}function Lm(e){me(e,mc<<1,3),et(e,Qa,gt),Em(e)}function Mm(e,t,r,n){var i,o,a=0;e.level>0?(e.strm.data_type===gm&&(e.strm.data_type=Fm(e)),Ya(e,e.l_desc),Ya(e,e.d_desc),a=Am(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&t!==-1?kc(e,t,r,n):e.strategy===pm||o===i?(me(e,(mc<<1)+(n?1:0),3),dc(e,gt,pn)):(me(e,(bm<<1)+(n?1:0),3),Pm(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),dc(e,e.dyn_ltree,e.dyn_dtree)),Pc(e),n&&Fc(e)}function Im(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(bn[r]+xn+1)*2]++,e.dyn_dtree[Tc(t)*2]++),e.last_lit===e.lit_bufsize-1}Lr._tr_init=km;Lr._tr_stored_block=kc;Lr._tr_flush_block=Mm;Lr._tr_tally=Im;Lr._tr_align=Lm});var es=K((f5,Mc)=>{"use strict";function Rm(e,t,r,n){for(var i=e&65535|0,o=e>>>16&65535|0,a=0;r!==0;){a=r>2e3?2e3:r,r-=a;do i=i+t[n++]|0,o=o+i|0;while(--a);i%=65521,o%=65521}return i|o<<16|0}Mc.exports=Rm});var ts=K((c5,Ic)=>{"use strict";function Bm(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var Om=Bm();function Dm(e,t,r,n){var i=Om,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[(e^t[a])&255];return e^-1}Ic.exports=Dm});var Vi=K((u5,Rc)=>{"use strict";Rc.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}});var Vc=K(nt=>{"use strict";var pe=pt(),ke=Lc(),Nc=es(),Rt=ts(),Nm=Vi(),er=0,zm=1,Um=3,zt=4,Bc=5,rt=0,Oc=1,Le=-2,qm=-3,rs=-5,Gm=-1,Vm=1,$i=2,$m=3,Hm=4,jm=0,Zm=2,Wi=8,Wm=9,Ym=15,Km=8,Xm=29,Qm=256,is=Qm+1+Xm,Jm=30,e1=19,t1=2*is+1,r1=15,V=3,Dt=258,qe=Dt+V+1,n1=32,Yi=42,os=69,Hi=73,ji=91,Zi=103,Xt=113,wn=666,ae=1,_n=2,Qt=3,Rr=4,i1=3;function Nt(e,t){return e.msg=Nm[t],t}function Dc(e){return(e<<1)-(e>4?9:0)}function Ot(e){for(var t=e.length;--t>=0;)e[t]=0}function Bt(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(pe.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function le(e,t){ke._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Bt(e.strm)}function j(e,t){e.pending_buf[e.pending++]=t}function vn(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function o1(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,pe.arraySet(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=Nc(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Rt(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function zc(e,t){var r=e.max_chain_length,n=e.strstart,i,o,a=e.prev_length,s=e.nice_match,f=e.strstart>e.w_size-qe?e.strstart-(e.w_size-qe):0,l=e.window,c=e.w_mask,u=e.prev,d=e.strstart+Dt,h=l[n+a-1],g=l[n+a];e.prev_length>=e.good_match&&(r>>=2),s>e.lookahead&&(s=e.lookahead);do if(i=t,!(l[i+a]!==g||l[i+a-1]!==h||l[i]!==l[n]||l[++i]!==l[n+1])){n+=2,i++;do;while(l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&l[++n]===l[++i]&&n<d);if(o=Dt-(d-n),n=d-Dt,o>a){if(e.match_start=t,a=o,o>=s)break;h=l[n+a-1],g=l[n+a]}}while((t=u[t&c])>f&&--r!==0);return a<=e.lookahead?a:e.lookahead}function Jt(e){var t=e.w_size,r,n,i,o,a;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-qe)){pe.arraySet(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);o+=t}if(e.strm.avail_in===0)break;if(n=o1(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=n,e.lookahead+e.insert>=V)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+V-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<V)););}while(e.lookahead<qe&&e.strm.avail_in!==0)}function a1(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Jt(e),e.lookahead===0&&t===er)return ae;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,le(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-qe&&(le(e,!1),e.strm.avail_out===0))return ae}return e.insert=0,t===zt?(le(e,!0),e.strm.avail_out===0?Qt:Rr):(e.strstart>e.block_start&&(le(e,!1),e.strm.avail_out===0),ae)}function ns(e,t){for(var r,n;;){if(e.lookahead<qe){if(Jt(e),e.lookahead<qe&&t===er)return ae;if(e.lookahead===0)break}if(r=0,e.lookahead>=V&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),r!==0&&e.strstart-r<=e.w_size-qe&&(e.match_length=zc(e,r)),e.match_length>=V)if(n=ke._tr_tally(e,e.strstart-e.match_start,e.match_length-V),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=V){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(--e.match_length!==0);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=ke._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(le(e,!1),e.strm.avail_out===0))return ae}return e.insert=e.strstart<V-1?e.strstart:V-1,t===zt?(le(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(le(e,!1),e.strm.avail_out===0)?ae:_n}function Mr(e,t){for(var r,n,i;;){if(e.lookahead<qe){if(Jt(e),e.lookahead<qe&&t===er)return ae;if(e.lookahead===0)break}if(r=0,e.lookahead>=V&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=V-1,r!==0&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-qe&&(e.match_length=zc(e,r),e.match_length<=5&&(e.strategy===Vm||e.match_length===V&&e.strstart-e.match_start>4096)&&(e.match_length=V-1)),e.prev_length>=V&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-V,n=ke._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-V),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+V-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(--e.prev_length!==0);if(e.match_available=0,e.match_length=V-1,e.strstart++,n&&(le(e,!1),e.strm.avail_out===0))return ae}else if(e.match_available){if(n=ke._tr_tally(e,0,e.window[e.strstart-1]),n&&le(e,!1),e.strstart++,e.lookahead--,e.strm.avail_out===0)return ae}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=ke._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<V-1?e.strstart:V-1,t===zt?(le(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(le(e,!1),e.strm.avail_out===0)?ae:_n}function s1(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=Dt){if(Jt(e),e.lookahead<=Dt&&t===er)return ae;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=V&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+Dt;do;while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=Dt-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=V?(r=ke._tr_tally(e,1,e.match_length-V),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=ke._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(le(e,!1),e.strm.avail_out===0))return ae}return e.insert=0,t===zt?(le(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(le(e,!1),e.strm.avail_out===0)?ae:_n}function l1(e,t){for(var r;;){if(e.lookahead===0&&(Jt(e),e.lookahead===0)){if(t===er)return ae;break}if(e.match_length=0,r=ke._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(le(e,!1),e.strm.avail_out===0))return ae}return e.insert=0,t===zt?(le(e,!0),e.strm.avail_out===0?Qt:Rr):e.last_lit&&(le(e,!1),e.strm.avail_out===0)?ae:_n}function tt(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var Ir;Ir=[new tt(0,0,0,0,a1),new tt(4,4,8,4,ns),new tt(4,5,16,8,ns),new tt(4,6,32,32,ns),new tt(4,4,16,16,Mr),new tt(8,16,32,32,Mr),new tt(8,16,128,128,Mr),new tt(8,32,128,256,Mr),new tt(32,128,258,1024,Mr),new tt(32,258,258,4096,Mr)];function f1(e){e.window_size=2*e.w_size,Ot(e.head),e.max_lazy_match=Ir[e.level].max_lazy,e.good_match=Ir[e.level].good_length,e.nice_match=Ir[e.level].nice_length,e.max_chain_length=Ir[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=V-1,e.match_available=0,e.ins_h=0}function c1(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Wi,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new pe.Buf16(t1*2),this.dyn_dtree=new pe.Buf16((2*Jm+1)*2),this.bl_tree=new pe.Buf16((2*e1+1)*2),Ot(this.dyn_ltree),Ot(this.dyn_dtree),Ot(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new pe.Buf16(r1+1),this.heap=new pe.Buf16(2*is+1),Ot(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new pe.Buf16(2*is+1),Ot(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function Uc(e){var t;return!e||!e.state?Nt(e,Le):(e.total_in=e.total_out=0,e.data_type=Zm,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?Yi:Xt,e.adler=t.wrap===2?0:1,t.last_flush=er,ke._tr_init(t),rt)}function qc(e){var t=Uc(e);return t===rt&&f1(e.state),t}function u1(e,t){return!e||!e.state||e.state.wrap!==2?Le:(e.state.gzhead=t,rt)}function Gc(e,t,r,n,i,o){if(!e)return Le;var a=1;if(t===Gm&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>Wm||r!==Wi||n<8||n>15||t<0||t>9||o<0||o>Hm)return Nt(e,Le);n===8&&(n=9);var s=new c1;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+V-1)/V),s.window=new pe.Buf8(s.w_size*2),s.head=new pe.Buf16(s.hash_size),s.prev=new pe.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new pe.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=r,qc(e)}function d1(e,t){return Gc(e,t,Wi,Ym,Km,jm)}function h1(e,t){var r,n,i,o;if(!e||!e.state||t>Bc||t<0)return e?Nt(e,Le):Le;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===wn&&t!==zt)return Nt(e,e.avail_out===0?rs:Le);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===Yi)if(n.wrap===2)e.adler=0,j(n,31),j(n,139),j(n,8),n.gzhead?(j(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),j(n,n.gzhead.time&255),j(n,n.gzhead.time>>8&255),j(n,n.gzhead.time>>16&255),j(n,n.gzhead.time>>24&255),j(n,n.level===9?2:n.strategy>=$i||n.level<2?4:0),j(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(j(n,n.gzhead.extra.length&255),j(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Rt(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=os):(j(n,0),j(n,0),j(n,0),j(n,0),j(n,0),j(n,n.level===9?2:n.strategy>=$i||n.level<2?4:0),j(n,i1),n.status=Xt);else{var a=Wi+(n.w_bits-8<<4)<<8,s=-1;n.strategy>=$i||n.level<2?s=0:n.level<6?s=1:n.level===6?s=2:s=3,a|=s<<6,n.strstart!==0&&(a|=n1),a+=31-a%31,n.status=Xt,vn(n,a),n.strstart!==0&&(vn(n,e.adler>>>16),vn(n,e.adler&65535)),e.adler=1}if(n.status===os)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),Bt(e),i=n.pending,n.pending===n.pending_buf_size));)j(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Hi)}else n.status=Hi;if(n.status===Hi)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),Bt(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}n.gzindex<n.gzhead.name.length?o=n.gzhead.name.charCodeAt(n.gzindex++)&255:o=0,j(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),o===0&&(n.gzindex=0,n.status=ji)}else n.status=ji;if(n.status===ji)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),Bt(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}n.gzindex<n.gzhead.comment.length?o=n.gzhead.comment.charCodeAt(n.gzindex++)&255:o=0,j(n,o)}while(o!==0);n.gzhead.hcrc&&n.pending>i&&(e.adler=Rt(e.adler,n.pending_buf,n.pending-i,i)),o===0&&(n.status=Zi)}else n.status=Zi;if(n.status===Zi&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&Bt(e),n.pending+2<=n.pending_buf_size&&(j(n,e.adler&255),j(n,e.adler>>8&255),e.adler=0,n.status=Xt)):n.status=Xt),n.pending!==0){if(Bt(e),e.avail_out===0)return n.last_flush=-1,rt}else if(e.avail_in===0&&Dc(t)<=Dc(r)&&t!==zt)return Nt(e,rs);if(n.status===wn&&e.avail_in!==0)return Nt(e,rs);if(e.avail_in!==0||n.lookahead!==0||t!==er&&n.status!==wn){var f=n.strategy===$i?l1(n,t):n.strategy===$m?s1(n,t):Ir[n.level].func(n,t);if((f===Qt||f===Rr)&&(n.status=wn),f===ae||f===Qt)return e.avail_out===0&&(n.last_flush=-1),rt;if(f===_n&&(t===zm?ke._tr_align(n):t!==Bc&&(ke._tr_stored_block(n,0,0,!1),t===Um&&(Ot(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Bt(e),e.avail_out===0))return n.last_flush=-1,rt}return t!==zt?rt:n.wrap<=0?Oc:(n.wrap===2?(j(n,e.adler&255),j(n,e.adler>>8&255),j(n,e.adler>>16&255),j(n,e.adler>>24&255),j(n,e.total_in&255),j(n,e.total_in>>8&255),j(n,e.total_in>>16&255),j(n,e.total_in>>24&255)):(vn(n,e.adler>>>16),vn(n,e.adler&65535)),Bt(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?rt:Oc)}function p1(e){var t;return!e||!e.state?Le:(t=e.state.status,t!==Yi&&t!==os&&t!==Hi&&t!==ji&&t!==Zi&&t!==Xt&&t!==wn?Nt(e,Le):(e.state=null,t===Xt?Nt(e,qm):rt))}function g1(e,t){var r=t.length,n,i,o,a,s,f,l,c;if(!e||!e.state||(n=e.state,a=n.wrap,a===2||a===1&&n.status!==Yi||n.lookahead))return Le;for(a===1&&(e.adler=Nc(e.adler,t,r,0)),n.wrap=0,r>=n.w_size&&(a===0&&(Ot(n.head),n.strstart=0,n.block_start=0,n.insert=0),c=new pe.Buf8(n.w_size),pe.arraySet(c,t,r-n.w_size,n.w_size,0),t=c,r=n.w_size),s=e.avail_in,f=e.next_in,l=e.input,e.avail_in=r,e.next_in=0,e.input=t,Jt(n);n.lookahead>=V;){i=n.strstart,o=n.lookahead-(V-1);do n.ins_h=(n.ins_h<<n.hash_shift^n.window[i+V-1])&n.hash_mask,n.prev[i&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=i,i++;while(--o);n.strstart=i,n.lookahead=V-1,Jt(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=V-1,n.match_available=0,e.next_in=f,e.input=l,e.avail_in=s,n.wrap=a,rt}nt.deflateInit=d1;nt.deflateInit2=Gc;nt.deflateReset=qc;nt.deflateResetKeep=Uc;nt.deflateSetHeader=u1;nt.deflate=h1;nt.deflateEnd=p1;nt.deflateSetDictionary=g1;nt.deflateInfo="pako deflate (from Nodeca project)"});var as=K(Br=>{"use strict";var Ki=pt(),$c=!0,Hc=!0;try{String.fromCharCode.apply(null,[0])}catch{$c=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{Hc=!1}var En=new Ki.Buf8(256);for(mt=0;mt<256;mt++)En[mt]=mt>=252?6:mt>=248?5:mt>=240?4:mt>=224?3:mt>=192?2:1;var mt;En[254]=En[254]=1;Br.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<a&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Ki.Buf8(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),(r&64512)===55296&&i+1<a&&(n=e.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|r&63):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|r&63):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|r&63);return t};function jc(e,t){if(t<65534&&(e.subarray&&Hc||!e.subarray&&$c))return String.fromCharCode.apply(null,Ki.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}Br.buf2binstring=function(e){return jc(e,e.length)};Br.binstring2buf=function(e){for(var t=new Ki.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t};Br.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(a*2);for(n=0,r=0;r<a;){if(i=e[r++],i<128){s[n++]=i;continue}if(o=En[i],o>4){s[n++]=65533,r+=o-1;continue}for(i&=o===2?31:o===3?15:7;o>1&&r<a;)i=i<<6|e[r++]&63,o--;if(o>1){s[n++]=65533;continue}i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|i&1023)}return jc(s,n)};Br.utf8border=function(e,t){var r;for(t=t||e.length,t>e.length&&(t=e.length),r=t-1;r>=0&&(e[r]&192)===128;)r--;return r<0||r===0?t:r+En[e[r]]>t?r:t}});var ss=K((p5,Zc)=>{"use strict";function m1(){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}Zc.exports=m1});var Xc=K(Cn=>{"use strict";var Sn=Vc(),Tn=pt(),fs=as(),cs=Vi(),b1=ss(),Kc=Object.prototype.toString,y1=0,ls=4,Or=0,Wc=1,Yc=2,x1=-1,v1=0,w1=8;function tr(e){if(!(this instanceof tr))return new tr(e);this.options=Tn.assign({level:x1,method:w1,chunkSize:16384,windowBits:15,memLevel:8,strategy:v1,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new b1,this.strm.avail_out=0;var r=Sn.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==Or)throw new Error(cs[r]);if(t.header&&Sn.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(typeof t.dictionary=="string"?n=fs.string2buf(t.dictionary):Kc.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,r=Sn.deflateSetDictionary(this.strm,n),r!==Or)throw new Error(cs[r]);this._dict_set=!0}}tr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i,o;if(this.ended)return!1;o=t===~~t?t:t===!0?ls:y1,typeof e=="string"?r.input=fs.string2buf(e):Kc.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Tn.Buf8(n),r.next_out=0,r.avail_out=n),i=Sn.deflate(r,o),i!==Wc&&i!==Or)return this.onEnd(i),this.ended=!0,!1;(r.avail_out===0||r.avail_in===0&&(o===ls||o===Yc))&&(this.options.to==="string"?this.onData(fs.buf2binstring(Tn.shrinkBuf(r.output,r.next_out))):this.onData(Tn.shrinkBuf(r.output,r.next_out)))}while((r.avail_in>0||r.avail_out===0)&&i!==Wc);return o===ls?(i=Sn.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Or):(o===Yc&&(this.onEnd(Or),r.avail_out=0),!0)};tr.prototype.onData=function(e){this.chunks.push(e)};tr.prototype.onEnd=function(e){e===Or&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Tn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function us(e,t){var r=new tr(t);if(r.push(e,!0),r.err)throw r.msg||cs[r.err];return r.result}function _1(e,t){return t=t||{},t.raw=!0,us(e,t)}function E1(e,t){return t=t||{},t.gzip=!0,us(e,t)}Cn.Deflate=tr;Cn.deflate=us;Cn.deflateRaw=_1;Cn.gzip=E1});var Jc=K((m5,Qc)=>{"use strict";var Xi=30,S1=12;Qc.exports=function(t,r){var n,i,o,a,s,f,l,c,u,d,h,g,x,S,T,w,k,M,L,B,D,p,m,b,y;n=t.state,i=t.next_in,b=t.input,o=i+(t.avail_in-5),a=t.next_out,y=t.output,s=a-(r-t.avail_out),f=a+(t.avail_out-257),l=n.dmax,c=n.wsize,u=n.whave,d=n.wnext,h=n.window,g=n.hold,x=n.bits,S=n.lencode,T=n.distcode,w=(1<<n.lenbits)-1,k=(1<<n.distbits)-1;e:do{x<15&&(g+=b[i++]<<x,x+=8,g+=b[i++]<<x,x+=8),M=S[g&w];t:for(;;){if(L=M>>>24,g>>>=L,x-=L,L=M>>>16&255,L===0)y[a++]=M&65535;else if(L&16){B=M&65535,L&=15,L&&(x<L&&(g+=b[i++]<<x,x+=8),B+=g&(1<<L)-1,g>>>=L,x-=L),x<15&&(g+=b[i++]<<x,x+=8,g+=b[i++]<<x,x+=8),M=T[g&k];r:for(;;){if(L=M>>>24,g>>>=L,x-=L,L=M>>>16&255,L&16){if(D=M&65535,L&=15,x<L&&(g+=b[i++]<<x,x+=8,x<L&&(g+=b[i++]<<x,x+=8)),D+=g&(1<<L)-1,D>l){t.msg="invalid distance too far back",n.mode=Xi;break e}if(g>>>=L,x-=L,L=a-s,D>L){if(L=D-L,L>u&&n.sane){t.msg="invalid distance too far back",n.mode=Xi;break e}if(p=0,m=h,d===0){if(p+=c-L,L<B){B-=L;do y[a++]=h[p++];while(--L);p=a-D,m=y}}else if(d<L){if(p+=c+d-L,L-=d,L<B){B-=L;do y[a++]=h[p++];while(--L);if(p=0,d<B){L=d,B-=L;do y[a++]=h[p++];while(--L);p=a-D,m=y}}}else if(p+=d-L,L<B){B-=L;do y[a++]=h[p++];while(--L);p=a-D,m=y}for(;B>2;)y[a++]=m[p++],y[a++]=m[p++],y[a++]=m[p++],B-=3;B&&(y[a++]=m[p++],B>1&&(y[a++]=m[p++]))}else{p=a-D;do y[a++]=y[p++],y[a++]=y[p++],y[a++]=y[p++],B-=3;while(B>2);B&&(y[a++]=y[p++],B>1&&(y[a++]=y[p++]))}}else if((L&64)===0){M=T[(M&65535)+(g&(1<<L)-1)];continue r}else{t.msg="invalid distance code",n.mode=Xi;break e}break}}else if((L&64)===0){M=S[(M&65535)+(g&(1<<L)-1)];continue t}else if(L&32){n.mode=S1;break e}else{t.msg="invalid literal/length code",n.mode=Xi;break e}break}}while(i<o&&a<f);B=x>>3,i-=B,x-=B<<3,g&=(1<<x)-1,t.next_in=i,t.next_out=a,t.avail_in=i<o?5+(o-i):5-(i-o),t.avail_out=a<f?257+(f-a):257-(a-f),n.hold=g,n.bits=x}});var au=K((b5,ou)=>{"use strict";var eu=pt(),Dr=15,tu=852,ru=592,nu=0,ds=1,iu=2,T1=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],C1=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],A1=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],P1=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];ou.exports=function(t,r,n,i,o,a,s,f){var l=f.bits,c=0,u=0,d=0,h=0,g=0,x=0,S=0,T=0,w=0,k=0,M,L,B,D,p,m=null,b=0,y,v=new eu.Buf16(Dr+1),E=new eu.Buf16(Dr+1),F=null,_=0,C,P,A;for(c=0;c<=Dr;c++)v[c]=0;for(u=0;u<i;u++)v[r[n+u]]++;for(g=l,h=Dr;h>=1&&v[h]===0;h--);if(g>h&&(g=h),h===0)return o[a++]=1<<24|64<<16|0,o[a++]=1<<24|64<<16|0,f.bits=1,0;for(d=1;d<h&&v[d]===0;d++);for(g<d&&(g=d),T=1,c=1;c<=Dr;c++)if(T<<=1,T-=v[c],T<0)return-1;if(T>0&&(t===nu||h!==1))return-1;for(E[1]=0,c=1;c<Dr;c++)E[c+1]=E[c]+v[c];for(u=0;u<i;u++)r[n+u]!==0&&(s[E[r[n+u]]++]=u);if(t===nu?(m=F=s,y=19):t===ds?(m=T1,b-=257,F=C1,_-=257,y=256):(m=A1,F=P1,y=-1),k=0,u=0,c=d,p=a,x=g,S=0,B=-1,w=1<<g,D=w-1,t===ds&&w>tu||t===iu&&w>ru)return 1;for(;;){C=c-S,s[u]<y?(P=0,A=s[u]):s[u]>y?(P=F[_+s[u]],A=m[b+s[u]]):(P=96,A=0),M=1<<c-S,L=1<<x,d=L;do L-=M,o[p+(k>>S)+L]=C<<24|P<<16|A|0;while(L!==0);for(M=1<<c-1;k&M;)M>>=1;if(M!==0?(k&=M-1,k+=M):k=0,u++,--v[c]===0){if(c===h)break;c=r[n+s[u]]}if(c>g&&(k&D)!==B){for(S===0&&(S=g),p+=d,x=c-S,T=1<<x;x+S<h&&(T-=v[x+S],!(T<=0));)x++,T<<=1;if(w+=1<<x,t===ds&&w>tu||t===iu&&w>ru)return 1;B=k&D,o[B]=g<<24|x<<16|p-a|0}}return k!==0&&(o[p+k]=c-S<<24|64<<16|0),f.bits=g,0}});var qu=K(Ge=>{"use strict";var Se=pt(),ys=es(),it=ts(),F1=Jc(),An=au(),k1=0,Mu=1,Iu=2,su=4,L1=5,Qi=6,rr=0,M1=1,I1=2,Me=-2,Ru=-3,xs=-4,R1=-5,lu=8,Bu=1,fu=2,cu=3,uu=4,du=5,hu=6,pu=7,gu=8,mu=9,bu=10,to=11,bt=12,hs=13,yu=14,ps=15,xu=16,vu=17,wu=18,_u=19,Ji=20,eo=21,Eu=22,Su=23,Tu=24,Cu=25,Au=26,gs=27,Pu=28,Fu=29,X=30,vs=31,B1=32,O1=852,D1=592,N1=15,z1=N1;function ku(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function U1(){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 Se.Buf16(320),this.work=new Se.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function Ou(e){var t;return!e||!e.state?Me:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=Bu,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Se.Buf32(O1),t.distcode=t.distdyn=new Se.Buf32(D1),t.sane=1,t.back=-1,rr)}function Du(e){var t;return!e||!e.state?Me:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,Ou(e))}function Nu(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Me:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Du(e))}function zu(e,t){var r,n;return e?(n=new U1,e.state=n,n.window=null,r=Nu(e,t),r!==rr&&(e.state=null),r):Me}function q1(e){return zu(e,z1)}var Lu=!0,ms,bs;function G1(e){if(Lu){var t;for(ms=new Se.Buf32(512),bs=new Se.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(An(Mu,e.lens,0,288,ms,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;An(Iu,e.lens,0,32,bs,0,e.work,{bits:5}),Lu=!1}e.lencode=ms,e.lenbits=9,e.distcode=bs,e.distbits=5}function Uu(e,t,r,n){var i,o=e.state;return o.window===null&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Se.Buf8(o.wsize)),n>=o.wsize?(Se.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),Se.arraySet(o.window,t,r-n,i,o.wnext),n-=i,n?(Se.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}function V1(e,t){var r,n,i,o,a,s,f,l,c,u,d,h,g,x,S=0,T,w,k,M,L,B,D,p,m=new Se.Buf8(4),b,y,v=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&e.avail_in!==0)return Me;r=e.state,r.mode===bt&&(r.mode=hs),a=e.next_out,i=e.output,f=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,l=r.hold,c=r.bits,u=s,d=f,p=rr;e:for(;;)switch(r.mode){case Bu:if(r.wrap===0){r.mode=hs;break}for(;c<16;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(r.wrap&2&&l===35615){r.check=0,m[0]=l&255,m[1]=l>>>8&255,r.check=it(r.check,m,2,0),l=0,c=0,r.mode=fu;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((l&255)<<8)+(l>>8))%31){e.msg="incorrect header check",r.mode=X;break}if((l&15)!==lu){e.msg="unknown compression method",r.mode=X;break}if(l>>>=4,c-=4,D=(l&15)+8,r.wbits===0)r.wbits=D;else if(D>r.wbits){e.msg="invalid window size",r.mode=X;break}r.dmax=1<<D,e.adler=r.check=1,r.mode=l&512?bu:bt,l=0,c=0;break;case fu:for(;c<16;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(r.flags=l,(r.flags&255)!==lu){e.msg="unknown compression method",r.mode=X;break}if(r.flags&57344){e.msg="unknown header flags set",r.mode=X;break}r.head&&(r.head.text=l>>8&1),r.flags&512&&(m[0]=l&255,m[1]=l>>>8&255,r.check=it(r.check,m,2,0)),l=0,c=0,r.mode=cu;case cu:for(;c<32;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}r.head&&(r.head.time=l),r.flags&512&&(m[0]=l&255,m[1]=l>>>8&255,m[2]=l>>>16&255,m[3]=l>>>24&255,r.check=it(r.check,m,4,0)),l=0,c=0,r.mode=uu;case uu:for(;c<16;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}r.head&&(r.head.xflags=l&255,r.head.os=l>>8),r.flags&512&&(m[0]=l&255,m[1]=l>>>8&255,r.check=it(r.check,m,2,0)),l=0,c=0,r.mode=du;case du:if(r.flags&1024){for(;c<16;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}r.length=l,r.head&&(r.head.extra_len=l),r.flags&512&&(m[0]=l&255,m[1]=l>>>8&255,r.check=it(r.check,m,2,0)),l=0,c=0}else r.head&&(r.head.extra=null);r.mode=hu;case hu:if(r.flags&1024&&(h=r.length,h>s&&(h=s),h&&(r.head&&(D=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Se.arraySet(r.head.extra,n,o,h,D)),r.flags&512&&(r.check=it(r.check,n,h,o)),s-=h,o+=h,r.length-=h),r.length))break e;r.length=0,r.mode=pu;case pu:if(r.flags&2048){if(s===0)break e;h=0;do D=n[o+h++],r.head&&D&&r.length<65536&&(r.head.name+=String.fromCharCode(D));while(D&&h<s);if(r.flags&512&&(r.check=it(r.check,n,h,o)),s-=h,o+=h,D)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=gu;case gu:if(r.flags&4096){if(s===0)break e;h=0;do D=n[o+h++],r.head&&D&&r.length<65536&&(r.head.comment+=String.fromCharCode(D));while(D&&h<s);if(r.flags&512&&(r.check=it(r.check,n,h,o)),s-=h,o+=h,D)break e}else r.head&&(r.head.comment=null);r.mode=mu;case mu:if(r.flags&512){for(;c<16;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(l!==(r.check&65535)){e.msg="header crc mismatch",r.mode=X;break}l=0,c=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=bt;break;case bu:for(;c<32;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}e.adler=r.check=ku(l),l=0,c=0,r.mode=to;case to:if(r.havedict===0)return e.next_out=a,e.avail_out=f,e.next_in=o,e.avail_in=s,r.hold=l,r.bits=c,I1;e.adler=r.check=1,r.mode=bt;case bt:if(t===L1||t===Qi)break e;case hs:if(r.last){l>>>=c&7,c-=c&7,r.mode=gs;break}for(;c<3;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}switch(r.last=l&1,l>>>=1,c-=1,l&3){case 0:r.mode=yu;break;case 1:if(G1(r),r.mode=Ji,t===Qi){l>>>=2,c-=2;break e}break;case 2:r.mode=vu;break;case 3:e.msg="invalid block type",r.mode=X}l>>>=2,c-=2;break;case yu:for(l>>>=c&7,c-=c&7;c<32;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if((l&65535)!==(l>>>16^65535)){e.msg="invalid stored block lengths",r.mode=X;break}if(r.length=l&65535,l=0,c=0,r.mode=ps,t===Qi)break e;case ps:r.mode=xu;case xu:if(h=r.length,h){if(h>s&&(h=s),h>f&&(h=f),h===0)break e;Se.arraySet(i,n,o,h,a),s-=h,o+=h,f-=h,a+=h,r.length-=h;break}r.mode=bt;break;case vu:for(;c<14;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(r.nlen=(l&31)+257,l>>>=5,c-=5,r.ndist=(l&31)+1,l>>>=5,c-=5,r.ncode=(l&15)+4,l>>>=4,c-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=X;break}r.have=0,r.mode=wu;case wu:for(;r.have<r.ncode;){for(;c<3;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}r.lens[v[r.have++]]=l&7,l>>>=3,c-=3}for(;r.have<19;)r.lens[v[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,b={bits:r.lenbits},p=An(k1,r.lens,0,19,r.lencode,0,r.work,b),r.lenbits=b.bits,p){e.msg="invalid code lengths set",r.mode=X;break}r.have=0,r.mode=_u;case _u:for(;r.have<r.nlen+r.ndist;){for(;S=r.lencode[l&(1<<r.lenbits)-1],T=S>>>24,w=S>>>16&255,k=S&65535,!(T<=c);){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(k<16)l>>>=T,c-=T,r.lens[r.have++]=k;else{if(k===16){for(y=T+2;c<y;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(l>>>=T,c-=T,r.have===0){e.msg="invalid bit length repeat",r.mode=X;break}D=r.lens[r.have-1],h=3+(l&3),l>>>=2,c-=2}else if(k===17){for(y=T+3;c<y;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}l>>>=T,c-=T,D=0,h=3+(l&7),l>>>=3,c-=3}else{for(y=T+7;c<y;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}l>>>=T,c-=T,D=0,h=11+(l&127),l>>>=7,c-=7}if(r.have+h>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=X;break}for(;h--;)r.lens[r.have++]=D}}if(r.mode===X)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=X;break}if(r.lenbits=9,b={bits:r.lenbits},p=An(Mu,r.lens,0,r.nlen,r.lencode,0,r.work,b),r.lenbits=b.bits,p){e.msg="invalid literal/lengths set",r.mode=X;break}if(r.distbits=6,r.distcode=r.distdyn,b={bits:r.distbits},p=An(Iu,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,b),r.distbits=b.bits,p){e.msg="invalid distances set",r.mode=X;break}if(r.mode=Ji,t===Qi)break e;case Ji:r.mode=eo;case eo:if(s>=6&&f>=258){e.next_out=a,e.avail_out=f,e.next_in=o,e.avail_in=s,r.hold=l,r.bits=c,F1(e,d),a=e.next_out,i=e.output,f=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,l=r.hold,c=r.bits,r.mode===bt&&(r.back=-1);break}for(r.back=0;S=r.lencode[l&(1<<r.lenbits)-1],T=S>>>24,w=S>>>16&255,k=S&65535,!(T<=c);){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(w&&(w&240)===0){for(M=T,L=w,B=k;S=r.lencode[B+((l&(1<<M+L)-1)>>M)],T=S>>>24,w=S>>>16&255,k=S&65535,!(M+T<=c);){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}l>>>=M,c-=M,r.back+=M}if(l>>>=T,c-=T,r.back+=T,r.length=k,w===0){r.mode=Au;break}if(w&32){r.back=-1,r.mode=bt;break}if(w&64){e.msg="invalid literal/length code",r.mode=X;break}r.extra=w&15,r.mode=Eu;case Eu:if(r.extra){for(y=r.extra;c<y;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}r.length+=l&(1<<r.extra)-1,l>>>=r.extra,c-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Su;case Su:for(;S=r.distcode[l&(1<<r.distbits)-1],T=S>>>24,w=S>>>16&255,k=S&65535,!(T<=c);){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if((w&240)===0){for(M=T,L=w,B=k;S=r.distcode[B+((l&(1<<M+L)-1)>>M)],T=S>>>24,w=S>>>16&255,k=S&65535,!(M+T<=c);){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}l>>>=M,c-=M,r.back+=M}if(l>>>=T,c-=T,r.back+=T,w&64){e.msg="invalid distance code",r.mode=X;break}r.offset=k,r.extra=w&15,r.mode=Tu;case Tu:if(r.extra){for(y=r.extra;c<y;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}r.offset+=l&(1<<r.extra)-1,l>>>=r.extra,c-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=X;break}r.mode=Cu;case Cu:if(f===0)break e;if(h=d-f,r.offset>h){if(h=r.offset-h,h>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=X;break}h>r.wnext?(h-=r.wnext,g=r.wsize-h):g=r.wnext-h,h>r.length&&(h=r.length),x=r.window}else x=i,g=a-r.offset,h=r.length;h>f&&(h=f),f-=h,r.length-=h;do i[a++]=x[g++];while(--h);r.length===0&&(r.mode=eo);break;case Au:if(f===0)break e;i[a++]=r.length,f--,r.mode=eo;break;case gs:if(r.wrap){for(;c<32;){if(s===0)break e;s--,l|=n[o++]<<c,c+=8}if(d-=f,e.total_out+=d,r.total+=d,d&&(e.adler=r.check=r.flags?it(r.check,i,d,a-d):ys(r.check,i,d,a-d)),d=f,(r.flags?l:ku(l))!==r.check){e.msg="incorrect data check",r.mode=X;break}l=0,c=0}r.mode=Pu;case Pu:if(r.wrap&&r.flags){for(;c<32;){if(s===0)break e;s--,l+=n[o++]<<c,c+=8}if(l!==(r.total&4294967295)){e.msg="incorrect length check",r.mode=X;break}l=0,c=0}r.mode=Fu;case Fu:p=M1;break e;case X:p=Ru;break e;case vs:return xs;case B1:default:return Me}return e.next_out=a,e.avail_out=f,e.next_in=o,e.avail_in=s,r.hold=l,r.bits=c,(r.wsize||d!==e.avail_out&&r.mode<X&&(r.mode<gs||t!==su))&&Uu(e,e.output,e.next_out,d-e.avail_out)?(r.mode=vs,xs):(u-=e.avail_in,d-=e.avail_out,e.total_in+=u,e.total_out+=d,r.total+=d,r.wrap&&d&&(e.adler=r.check=r.flags?it(r.check,i,d,e.next_out-d):ys(r.check,i,d,e.next_out-d)),e.data_type=r.bits+(r.last?64:0)+(r.mode===bt?128:0)+(r.mode===Ji||r.mode===ps?256:0),(u===0&&d===0||t===su)&&p===rr&&(p=R1),p)}function $1(e){if(!e||!e.state)return Me;var t=e.state;return t.window&&(t.window=null),e.state=null,rr}function H1(e,t){var r;return!e||!e.state||(r=e.state,(r.wrap&2)===0)?Me:(r.head=t,t.done=!1,rr)}function j1(e,t){var r=t.length,n,i,o;return!e||!e.state||(n=e.state,n.wrap!==0&&n.mode!==to)?Me:n.mode===to&&(i=1,i=ys(i,t,r,0),i!==n.check)?Ru:(o=Uu(e,t,r,r),o?(n.mode=vs,xs):(n.havedict=1,rr))}Ge.inflateReset=Du;Ge.inflateReset2=Nu;Ge.inflateResetKeep=Ou;Ge.inflateInit=q1;Ge.inflateInit2=zu;Ge.inflate=V1;Ge.inflateEnd=$1;Ge.inflateGetHeader=H1;Ge.inflateSetDictionary=j1;Ge.inflateInfo="pako inflate (from Nodeca project)"});var ws=K((x5,Gu)=>{"use strict";Gu.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}});var $u=K((v5,Vu)=>{"use strict";function Z1(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}Vu.exports=Z1});var ju=K(Fn=>{"use strict";var Nr=qu(),Pn=pt(),ro=as(),ie=ws(),_s=Vi(),W1=ss(),Y1=$u(),Hu=Object.prototype.toString;function nr(e){if(!(this instanceof nr))return new nr(e);this.options=Pn.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(e&&e.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15)===0&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new W1,this.strm.avail_out=0;var r=Nr.inflateInit2(this.strm,t.windowBits);if(r!==ie.Z_OK)throw new Error(_s[r]);if(this.header=new Y1,Nr.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=ro.string2buf(t.dictionary):Hu.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=Nr.inflateSetDictionary(this.strm,t.dictionary),r!==ie.Z_OK)))throw new Error(_s[r])}nr.prototype.push=function(e,t){var r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,o,a,s,f,l,c=!1;if(this.ended)return!1;a=t===~~t?t:t===!0?ie.Z_FINISH:ie.Z_NO_FLUSH,typeof e=="string"?r.input=ro.binstring2buf(e):Hu.call(e)==="[object ArrayBuffer]"?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;do{if(r.avail_out===0&&(r.output=new Pn.Buf8(n),r.next_out=0,r.avail_out=n),o=Nr.inflate(r,ie.Z_NO_FLUSH),o===ie.Z_NEED_DICT&&i&&(o=Nr.inflateSetDictionary(this.strm,i)),o===ie.Z_BUF_ERROR&&c===!0&&(o=ie.Z_OK,c=!1),o!==ie.Z_STREAM_END&&o!==ie.Z_OK)return this.onEnd(o),this.ended=!0,!1;r.next_out&&(r.avail_out===0||o===ie.Z_STREAM_END||r.avail_in===0&&(a===ie.Z_FINISH||a===ie.Z_SYNC_FLUSH))&&(this.options.to==="string"?(s=ro.utf8border(r.output,r.next_out),f=r.next_out-s,l=ro.buf2string(r.output,s),r.next_out=f,r.avail_out=n-f,f&&Pn.arraySet(r.output,r.output,s,f,0),this.onData(l)):this.onData(Pn.shrinkBuf(r.output,r.next_out))),r.avail_in===0&&r.avail_out===0&&(c=!0)}while((r.avail_in>0||r.avail_out===0)&&o!==ie.Z_STREAM_END);return o===ie.Z_STREAM_END&&(a=ie.Z_FINISH),a===ie.Z_FINISH?(o=Nr.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===ie.Z_OK):(a===ie.Z_SYNC_FLUSH&&(this.onEnd(ie.Z_OK),r.avail_out=0),!0)};nr.prototype.onData=function(e){this.chunks.push(e)};nr.prototype.onEnd=function(e){e===ie.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Pn.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function Es(e,t){var r=new nr(t);if(r.push(e,!0),r.err)throw r.msg||_s[r.err];return r.result}function K1(e,t){return t=t||{},t.raw=!0,Es(e,t)}Fn.Inflate=nr;Fn.inflate=Es;Fn.inflateRaw=K1;Fn.ungzip=Es});var Yu=K((_5,Wu)=>{"use strict";var X1=pt().assign,Q1=Xc(),J1=ju(),eb=ws(),Zu={};X1(Zu,Q1,J1,eb);Wu.exports=Zu});var Ku=K(()=>{});var Xu=K(Ls=>{Ls.read=function(e,t,r,n,i){var o,a,s=i*8-n-1,f=(1<<s)-1,l=f>>1,c=-7,u=r?i-1:0,d=r?-1:1,h=e[t+u];for(u+=d,o=h&(1<<-c)-1,h>>=-c,c+=s;c>0;o=o*256+e[t+u],u+=d,c-=8);for(a=o&(1<<-c)-1,o>>=-c,c+=n;c>0;a=a*256+e[t+u],u+=d,c-=8);if(o===0)o=1-l;else{if(o===f)return a?NaN:(h?-1:1)*(1/0);a=a+Math.pow(2,n),o=o-l}return(h?-1:1)*a*Math.pow(2,o-n)};Ls.write=function(e,t,r,n,i,o){var a,s,f,l=o*8-i-1,c=(1<<l)-1,u=c>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,g=n?1:-1,x=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+u>=1?t+=d/f:t+=d*Math.pow(2,1-u),t*f>=2&&(a++,f/=2),a+u>=c?(s=0,a=c):a+u>=1?(s=(t*f-1)*Math.pow(2,i),a=a+u):(s=t*Math.pow(2,u-1)*Math.pow(2,i),a=0));i>=8;e[r+h]=s&255,h+=g,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[r+h]=a&255,h+=g,a/=256,l-=8);e[r+h-g]|=x*128}});var nd=K((U5,rd)=>{"use strict";rd.exports=Z;var ao=Xu();function Z(e){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(e)?e:new Uint8Array(e||0),this.pos=0,this.type=0,this.length=this.buf.length}Z.Varint=0;Z.Fixed64=1;Z.Bytes=2;Z.Fixed32=5;var Ms=65536*65536,Qu=1/Ms,tb=12,td=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");Z.prototype={destroy:function(){this.buf=null},readFields:function(e,t,r){for(r=r||this.length;this.pos<r;){var n=this.readVarint(),i=n>>3,o=this.pos;this.type=n&7,e(i,t,this),this.pos===o&&this.skip(n)}return t},readMessage:function(e,t){return this.readFields(e,t,this.readVarint()+this.pos)},readFixed32:function(){var e=so(this.buf,this.pos);return this.pos+=4,e},readSFixed32:function(){var e=ed(this.buf,this.pos);return this.pos+=4,e},readFixed64:function(){var e=so(this.buf,this.pos)+so(this.buf,this.pos+4)*Ms;return this.pos+=8,e},readSFixed64:function(){var e=so(this.buf,this.pos)+ed(this.buf,this.pos+4)*Ms;return this.pos+=8,e},readFloat:function(){var e=ao.read(this.buf,this.pos,!0,23,4);return this.pos+=4,e},readDouble:function(){var e=ao.read(this.buf,this.pos,!0,52,8);return this.pos+=8,e},readVarint:function(e){var t=this.buf,r,n;return n=t[this.pos++],r=n&127,n<128||(n=t[this.pos++],r|=(n&127)<<7,n<128)||(n=t[this.pos++],r|=(n&127)<<14,n<128)||(n=t[this.pos++],r|=(n&127)<<21,n<128)?r:(n=t[this.pos],r|=(n&15)<<28,rb(r,e,this))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var e=this.readVarint();return e%2===1?(e+1)/-2:e/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=tb&&td?mb(this.buf,t,e):gb(this.buf,t,e)},readBytes:function(){var e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t},readPackedVarint:function(e,t){if(this.type!==Z.Bytes)return e.push(this.readVarint(t));var r=wt(this);for(e=e||[];this.pos<r;)e.push(this.readVarint(t));return e},readPackedSVarint:function(e){if(this.type!==Z.Bytes)return e.push(this.readSVarint());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readSVarint());return e},readPackedBoolean:function(e){if(this.type!==Z.Bytes)return e.push(this.readBoolean());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readBoolean());return e},readPackedFloat:function(e){if(this.type!==Z.Bytes)return e.push(this.readFloat());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readFloat());return e},readPackedDouble:function(e){if(this.type!==Z.Bytes)return e.push(this.readDouble());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readDouble());return e},readPackedFixed32:function(e){if(this.type!==Z.Bytes)return e.push(this.readFixed32());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readFixed32());return e},readPackedSFixed32:function(e){if(this.type!==Z.Bytes)return e.push(this.readSFixed32());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed32());return e},readPackedFixed64:function(e){if(this.type!==Z.Bytes)return e.push(this.readFixed64());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readFixed64());return e},readPackedSFixed64:function(e){if(this.type!==Z.Bytes)return e.push(this.readSFixed64());var t=wt(this);for(e=e||[];this.pos<t;)e.push(this.readSFixed64());return e},skip:function(e){var t=e&7;if(t===Z.Varint)for(;this.buf[this.pos++]>127;);else if(t===Z.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Z.Fixed32)this.pos+=4;else if(t===Z.Fixed64)this.pos+=8;else throw new Error("Unimplemented type: "+t)},writeTag:function(e,t){this.writeVarint(e<<3|t)},realloc:function(e){for(var t=this.length||16;t<this.pos+e;)t*=2;if(t!==this.length){var r=new Uint8Array(t);r.set(this.buf),this.buf=r,this.length=t}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(e){this.realloc(4),Ur(this.buf,e,this.pos),this.pos+=4},writeSFixed32:function(e){this.realloc(4),Ur(this.buf,e,this.pos),this.pos+=4},writeFixed64:function(e){this.realloc(8),Ur(this.buf,e&-1,this.pos),Ur(this.buf,Math.floor(e*Qu),this.pos+4),this.pos+=8},writeSFixed64:function(e){this.realloc(8),Ur(this.buf,e&-1,this.pos),Ur(this.buf,Math.floor(e*Qu),this.pos+4),this.pos+=8},writeVarint:function(e){if(e=+e||0,e>268435455||e<0){nb(e,this);return}this.realloc(4),this.buf[this.pos++]=e&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=(e>>>=7)&127|(e>127?128:0),!(e<=127)&&(this.buf[this.pos++]=e>>>7&127)))},writeSVarint:function(e){this.writeVarint(e<0?-e*2-1:e*2)},writeBoolean:function(e){this.writeVarint(!!e)},writeString:function(e){e=String(e),this.realloc(e.length*4),this.pos++;var t=this.pos;this.pos=bb(this.buf,e,this.pos);var r=this.pos-t;r>=128&&Ju(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r},writeFloat:function(e){this.realloc(4),ao.write(this.buf,e,this.pos,!0,23,4),this.pos+=4},writeDouble:function(e){this.realloc(8),ao.write(this.buf,e,this.pos,!0,52,8),this.pos+=8},writeBytes:function(e){var t=e.length;this.writeVarint(t),this.realloc(t);for(var r=0;r<t;r++)this.buf[this.pos++]=e[r]},writeRawMessage:function(e,t){this.pos++;var r=this.pos;e(t,this);var n=this.pos-r;n>=128&&Ju(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n},writeMessage:function(e,t,r){this.writeTag(e,Z.Bytes),this.writeRawMessage(t,r)},writePackedVarint:function(e,t){t.length&&this.writeMessage(e,ab,t)},writePackedSVarint:function(e,t){t.length&&this.writeMessage(e,sb,t)},writePackedBoolean:function(e,t){t.length&&this.writeMessage(e,cb,t)},writePackedFloat:function(e,t){t.length&&this.writeMessage(e,lb,t)},writePackedDouble:function(e,t){t.length&&this.writeMessage(e,fb,t)},writePackedFixed32:function(e,t){t.length&&this.writeMessage(e,ub,t)},writePackedSFixed32:function(e,t){t.length&&this.writeMessage(e,db,t)},writePackedFixed64:function(e,t){t.length&&this.writeMessage(e,hb,t)},writePackedSFixed64:function(e,t){t.length&&this.writeMessage(e,pb,t)},writeBytesField:function(e,t){this.writeTag(e,Z.Bytes),this.writeBytes(t)},writeFixed32Field:function(e,t){this.writeTag(e,Z.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(e,t){this.writeTag(e,Z.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(e,t){this.writeTag(e,Z.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(e,t){this.writeTag(e,Z.Fixed64),this.writeSFixed64(t)},writeVarintField:function(e,t){this.writeTag(e,Z.Varint),this.writeVarint(t)},writeSVarintField:function(e,t){this.writeTag(e,Z.Varint),this.writeSVarint(t)},writeStringField:function(e,t){this.writeTag(e,Z.Bytes),this.writeString(t)},writeFloatField:function(e,t){this.writeTag(e,Z.Fixed32),this.writeFloat(t)},writeDoubleField:function(e,t){this.writeTag(e,Z.Fixed64),this.writeDouble(t)},writeBooleanField:function(e,t){this.writeVarintField(e,!!t)}};function rb(e,t,r){var n=r.buf,i,o;if(o=n[r.pos++],i=(o&112)>>4,o<128||(o=n[r.pos++],i|=(o&127)<<3,o<128)||(o=n[r.pos++],i|=(o&127)<<10,o<128)||(o=n[r.pos++],i|=(o&127)<<17,o<128)||(o=n[r.pos++],i|=(o&127)<<24,o<128)||(o=n[r.pos++],i|=(o&1)<<31,o<128))return zr(e,i,t);throw new Error("Expected varint not more than 10 bytes")}function wt(e){return e.type===Z.Bytes?e.readVarint()+e.pos:e.pos+1}function zr(e,t,r){return r?t*4294967296+(e>>>0):(t>>>0)*4294967296+(e>>>0)}function nb(e,t){var r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),r^4294967295?r=r+1|0:(r=0,n=n+1|0)),e>=18446744073709552e3||e<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");t.realloc(10),ib(r,n,t),ob(n,t)}function ib(e,t,r){r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos++]=e&127|128,e>>>=7,r.buf[r.pos]=e&127}function ob(e,t){var r=(e&7)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=e&127)))))}function Ju(e,t,r){var n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(Math.LN2*7));r.realloc(n);for(var i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function ab(e,t){for(var r=0;r<e.length;r++)t.writeVarint(e[r])}function sb(e,t){for(var r=0;r<e.length;r++)t.writeSVarint(e[r])}function lb(e,t){for(var r=0;r<e.length;r++)t.writeFloat(e[r])}function fb(e,t){for(var r=0;r<e.length;r++)t.writeDouble(e[r])}function cb(e,t){for(var r=0;r<e.length;r++)t.writeBoolean(e[r])}function ub(e,t){for(var r=0;r<e.length;r++)t.writeFixed32(e[r])}function db(e,t){for(var r=0;r<e.length;r++)t.writeSFixed32(e[r])}function hb(e,t){for(var r=0;r<e.length;r++)t.writeFixed64(e[r])}function pb(e,t){for(var r=0;r<e.length;r++)t.writeSFixed64(e[r])}function so(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+e[t+3]*16777216}function Ur(e,t,r){e[r]=t,e[r+1]=t>>>8,e[r+2]=t>>>16,e[r+3]=t>>>24}function ed(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16)+(e[t+3]<<24)}function gb(e,t,r){for(var n="",i=t;i<r;){var o=e[i],a=null,s=o>239?4:o>223?3:o>191?2:1;if(i+s>r)break;var f,l,c;s===1?o<128&&(a=o):s===2?(f=e[i+1],(f&192)===128&&(a=(o&31)<<6|f&63,a<=127&&(a=null))):s===3?(f=e[i+1],l=e[i+2],(f&192)===128&&(l&192)===128&&(a=(o&15)<<12|(f&63)<<6|l&63,(a<=2047||a>=55296&&a<=57343)&&(a=null))):s===4&&(f=e[i+1],l=e[i+2],c=e[i+3],(f&192)===128&&(l&192)===128&&(c&192)===128&&(a=(o&15)<<18|(f&63)<<12|(l&63)<<6|c&63,(a<=65535||a>=1114112)&&(a=null))),a===null?(a=65533,s=1):a>65535&&(a-=65536,n+=String.fromCharCode(a>>>10&1023|55296),a=56320|a&1023),n+=String.fromCharCode(a),i+=s}return n}function mb(e,t,r){return td.decode(e.subarray(t,r))}function bb(e,t,r){for(var n=0,i,o;n<t.length;n++){if(i=t.charCodeAt(n),i>55295&&i<57344)if(o)if(i<56320){e[r++]=239,e[r++]=191,e[r++]=189,o=i;continue}else i=o-55296<<10|i-56320|65536,o=null;else{i>56319||n+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):o=i;continue}else o&&(e[r++]=239,e[r++]=191,e[r++]=189,o=null);i<128?e[r++]=i:(i<2048?e[r++]=i>>6|192:(i<65536?e[r++]=i>>12|224:(e[r++]=i>>18|240,e[r++]=i>>12&63|128),e[r++]=i>>6&63|128),e[r++]=i&63|128)}return r}});var Zd=K((e4,qs)=>{"use strict";qs.exports=Ao;qs.exports.default=Ao;function Ao(e,t,r){r=r||2;var n=t&&t.length,i=n?t[0]*r:e.length,o=$d(e,0,i,r,!0),a=[];if(!o||o.next===o.prev)return a;var s,f,l,c,u,d,h;if(n&&(o=Qb(e,t,o,r)),e.length>80*r){s=l=e[0],f=c=e[1];for(var g=r;g<i;g+=r)u=e[g],d=e[g+1],u<s&&(s=u),d<f&&(f=d),u>l&&(l=u),d>c&&(c=d);h=Math.max(l-s,c-f),h=h!==0?32767/h:0}return Xn(o,a,r,s,f,h,0),a}function $d(e,t,r,n,i){var o,a;if(i===Us(e,t,r,n)>0)for(o=t;o<r;o+=n)a=Vd(o,e[o],e[o+1],a);else for(o=r-n;o>=t;o-=n)a=Vd(o,e[o],e[o+1],a);return a&&Po(a,a.next)&&(Jn(a),a=a.next),a}function lr(e,t){if(!e)return e;t||(t=e);var r=e,n;do if(n=!1,!r.steiner&&(Po(r,r.next)||J(r.prev,r,r.next)===0)){if(Jn(r),r=t=r.prev,r===r.next)break;n=!0}else r=r.next;while(n||r!==t);return t}function Xn(e,t,r,n,i,o,a){if(e){!a&&o&&ny(e,n,i,o);for(var s=e,f,l;e.prev!==e.next;){if(f=e.prev,l=e.next,o?Yb(e,n,i,o):Wb(e)){t.push(f.i/r|0),t.push(e.i/r|0),t.push(l.i/r|0),Jn(e),e=l.next,s=l.next;continue}if(e=l,e===s){a?a===1?(e=Kb(lr(e),t,r),Xn(e,t,r,n,i,o,2)):a===2&&Xb(e,t,r,n,i,o):Xn(lr(e),t,r,n,i,o,1);break}}}}function Wb(e){var t=e.prev,r=e,n=e.next;if(J(t,r,n)>=0)return!1;for(var i=t.x,o=r.x,a=n.x,s=t.y,f=r.y,l=n.y,c=i<o?i<a?i:a:o<a?o:a,u=s<f?s<l?s:l:f<l?f:l,d=i>o?i>a?i:a:o>a?o:a,h=s>f?s>l?s:l:f>l?f:l,g=n.next;g!==t;){if(g.x>=c&&g.x<=d&&g.y>=u&&g.y<=h&&Vr(i,s,o,f,a,l,g.x,g.y)&&J(g.prev,g,g.next)>=0)return!1;g=g.next}return!0}function Yb(e,t,r,n){var i=e.prev,o=e,a=e.next;if(J(i,o,a)>=0)return!1;for(var s=i.x,f=o.x,l=a.x,c=i.y,u=o.y,d=a.y,h=s<f?s<l?s:l:f<l?f:l,g=c<u?c<d?c:d:u<d?u:d,x=s>f?s>l?s:l:f>l?f:l,S=c>u?c>d?c:d:u>d?u:d,T=Ns(h,g,t,r,n),w=Ns(x,S,t,r,n),k=e.prevZ,M=e.nextZ;k&&k.z>=T&&M&&M.z<=w;){if(k.x>=h&&k.x<=x&&k.y>=g&&k.y<=S&&k!==i&&k!==a&&Vr(s,c,f,u,l,d,k.x,k.y)&&J(k.prev,k,k.next)>=0||(k=k.prevZ,M.x>=h&&M.x<=x&&M.y>=g&&M.y<=S&&M!==i&&M!==a&&Vr(s,c,f,u,l,d,M.x,M.y)&&J(M.prev,M,M.next)>=0))return!1;M=M.nextZ}for(;k&&k.z>=T;){if(k.x>=h&&k.x<=x&&k.y>=g&&k.y<=S&&k!==i&&k!==a&&Vr(s,c,f,u,l,d,k.x,k.y)&&J(k.prev,k,k.next)>=0)return!1;k=k.prevZ}for(;M&&M.z<=w;){if(M.x>=h&&M.x<=x&&M.y>=g&&M.y<=S&&M!==i&&M!==a&&Vr(s,c,f,u,l,d,M.x,M.y)&&J(M.prev,M,M.next)>=0)return!1;M=M.nextZ}return!0}function Kb(e,t,r){var n=e;do{var i=n.prev,o=n.next.next;!Po(i,o)&&Hd(i,n,n.next,o)&&Qn(i,o)&&Qn(o,i)&&(t.push(i.i/r|0),t.push(n.i/r|0),t.push(o.i/r|0),Jn(n),Jn(n.next),n=e=o),n=n.next}while(n!==e);return lr(n)}function Xb(e,t,r,n,i,o){var a=e;do{for(var s=a.next.next;s!==a.prev;){if(a.i!==s.i&&ay(a,s)){var f=jd(a,s);a=lr(a,a.next),f=lr(f,f.next),Xn(a,t,r,n,i,o,0),Xn(f,t,r,n,i,o,0);return}s=s.next}a=a.next}while(a!==e)}function Qb(e,t,r,n){var i=[],o,a,s,f,l;for(o=0,a=t.length;o<a;o++)s=t[o]*n,f=o<a-1?t[o+1]*n:e.length,l=$d(e,s,f,n,!1),l===l.next&&(l.steiner=!0),i.push(oy(l));for(i.sort(Jb),o=0;o<i.length;o++)r=ey(i[o],r);return r}function Jb(e,t){return e.x-t.x}function ey(e,t){var r=ty(e,t);if(!r)return t;var n=jd(r,e);return lr(n,n.next),lr(r,r.next)}function ty(e,t){var r=t,n=e.x,i=e.y,o=-1/0,a;do{if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){var s=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(s<=n&&s>o&&(o=s,a=r.x<r.next.x?r:r.next,s===n))return a}r=r.next}while(r!==t);if(!a)return null;var f=a,l=a.x,c=a.y,u=1/0,d;r=a;do n>=r.x&&r.x>=l&&n!==r.x&&Vr(i<c?n:o,i,l,c,i<c?o:n,i,r.x,r.y)&&(d=Math.abs(i-r.y)/(n-r.x),Qn(r,e)&&(d<u||d===u&&(r.x>a.x||r.x===a.x&&ry(a,r)))&&(a=r,u=d)),r=r.next;while(r!==f);return a}function ry(e,t){return J(e.prev,e,t.prev)<0&&J(t.next,e,e.next)<0}function ny(e,t,r,n){var i=e;do i.z===0&&(i.z=Ns(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,iy(i)}function iy(e){var t,r,n,i,o,a,s,f,l=1;do{for(r=e,e=null,o=null,a=0;r;){for(a++,n=r,s=0,t=0;t<l&&(s++,n=n.nextZ,!!n);t++);for(f=l;s>0||f>0&&n;)s!==0&&(f===0||!n||r.z<=n.z)?(i=r,r=r.nextZ,s--):(i=n,n=n.nextZ,f--),o?o.nextZ=i:e=i,i.prevZ=o,o=i;r=n}o.nextZ=null,l*=2}while(a>1);return e}function Ns(e,t,r,n,i){return e=(e-r)*i|0,t=(t-n)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function oy(e){var t=e,r=e;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==e);return r}function Vr(e,t,r,n,i,o,a,s){return(i-a)*(t-s)>=(e-a)*(o-s)&&(e-a)*(n-s)>=(r-a)*(t-s)&&(r-a)*(o-s)>=(i-a)*(n-s)}function ay(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!sy(e,t)&&(Qn(e,t)&&Qn(t,e)&&ly(e,t)&&(J(e.prev,e,t.prev)||J(e,t.prev,t))||Po(e,t)&&J(e.prev,e,e.next)>0&&J(t.prev,t,t.next)>0)}function J(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Po(e,t){return e.x===t.x&&e.y===t.y}function Hd(e,t,r,n){var i=Co(J(e,t,r)),o=Co(J(e,t,n)),a=Co(J(r,n,e)),s=Co(J(r,n,t));return!!(i!==o&&a!==s||i===0&&To(e,r,t)||o===0&&To(e,n,t)||a===0&&To(r,e,n)||s===0&&To(r,t,n))}function To(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Co(e){return e>0?1:e<0?-1:0}function sy(e,t){var r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Hd(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}function Qn(e,t){return J(e.prev,e,e.next)<0?J(e,t,e.next)>=0&&J(e,e.prev,t)>=0:J(e,t,e.prev)<0||J(e,e.next,t)<0}function ly(e,t){var r=e,n=!1,i=(e.x+t.x)/2,o=(e.y+t.y)/2;do r.y>o!=r.next.y>o&&r.next.y!==r.y&&i<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next;while(r!==e);return n}function jd(e,t){var r=new zs(e.i,e.x,e.y),n=new zs(t.i,t.x,t.y),i=e.next,o=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,o.next=n,n.prev=o,n}function Vd(e,t,r,n){var i=new zs(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Jn(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function zs(e,t,r){this.i=e,this.x=t,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ao.deviation=function(e,t,r,n){var i=t&&t.length,o=i?t[0]*r:e.length,a=Math.abs(Us(e,0,o,r));if(i)for(var s=0,f=t.length;s<f;s++){var l=t[s]*r,c=s<f-1?t[s+1]*r:e.length;a-=Math.abs(Us(e,l,c,r))}var u=0;for(s=0;s<n.length;s+=3){var d=n[s]*r,h=n[s+1]*r,g=n[s+2]*r;u+=Math.abs((e[d]-e[g])*(e[h+1]-e[d+1])-(e[d]-e[h])*(e[g+1]-e[d+1]))}return a===0&&u===0?0:Math.abs((u-a)/a)};function Us(e,t,r,n){for(var i=0,o=t,a=r-n;o<r;o+=n)i+=(e[a]-e[o])*(e[o+1]+e[a+1]),a=o;return i}Ao.flatten=function(e){for(var t=e[0][0].length,r={vertices:[],holes:[],dimensions:t},n=0,i=0;i<e.length;i++){for(var o=0;o<e[i].length;o++)for(var a=0;a<t;a++)r.vertices.push(e[i][o][a]);i>0&&(n+=e[i-1].length,r.holes.push(n))}return r}});var eh=K((o4,Jd)=>{Jd.exports=globalThis.deck});var Tr={};Ra(Tr,{carto:()=>S_});var La={};Ra(La,{BASEMAP:()=>eg,CARTO_LAYERS:()=>E_,CARTO_SOURCES:()=>Ip,CartoAPIError:()=>Er,ClusterTileLayer:()=>Dn,H3TileLayer:()=>ar,HeatmapTileLayer:()=>$n,LayerFactory:()=>hf,PointLabelLayer:()=>Zn,QuadbinTileLayer:()=>sr,RasterTileLayer:()=>Kn,SOURCE_DEFAULTS:()=>Ei,VectorTileLayer:()=>Hr,_GOOGLE_BASEMAPS:()=>Pa,_QuadbinLayer:()=>po,_RasterLayer:()=>_o,_STYLE_LAYER_GROUPS:()=>lf,_SpatialIndexTileLayer:()=>qr,_applyLayerGroupFilters:()=>Fa,_fetchStyle:()=>ka,_getStyleUrl:()=>Ye,boundaryQuerySource:()=>Kl,boundaryTableSource:()=>Xl,colorBins:()=>cf,colorCategories:()=>uf,colorContinuous:()=>df,fetchBasemapProps:()=>og,fetchMap:()=>ng,h3QuerySource:()=>ma,h3TableSource:()=>ba,h3TilesetSource:()=>ef,quadbinQuerySource:()=>xa,quadbinTableSource:()=>va,quadbinTilesetSource:()=>tf,query:()=>Rp,rasterSource:()=>wa,vectorQuerySource:()=>_a,vectorTableSource:()=>Ea,vectorTilesetSource:()=>Sa});var hd=q(kt(),1),pd=q(dt(),1),gd=q(fn(),1);function yf(e,t,r){switch(e.type){case"Point":return pg(e,t,r);case"LineString":return hg(e,t,r);case"Polygon":return xf(e,t,r);default:let n=e;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function xf(e,t=-1/0,r=1/0){let{positions:n}=e,i=e.polygonIndices.value.filter(f=>f>=t&&f<=r),o=e.primitivePolygonIndices.value.filter(f=>f>=t&&f<=r);if(!(i.length>2)){let f=[];for(let l=0;l<o.length-1;l++){let c=o[l],u=o[l+1],d=Mi(n,c,u);f.push(d)}return{type:"Polygon",coordinates:f}}let s=[];for(let f=0;f<i.length-1;f++){let l=i[f],c=i[f+1],u=xf(e,l,c).coordinates;s.push(u)}return{type:"MultiPolygon",coordinates:s}}function hg(e,t=-1/0,r=1/0){let{positions:n}=e,i=e.pathIndices.value.filter(s=>s>=t&&s<=r);if(!(i.length>2))return{type:"LineString",coordinates:Mi(n,i[0],i[1])};let a=[];for(let s=0;s<i.length-1;s++){let f=Mi(n,i[s],i[s+1]);a.push(f)}return{type:"MultiLineString",coordinates:a}}function pg(e,t,r){let{positions:n}=e,i=Mi(n,t,r);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Mi(e,t,r){t=t||0,r=r||e.value.length/e.size;let n=[];for(let i=t;i<r;i++){let o=Array();for(let a=i*e.size;a<(i+1)*e.size;a++)o.push(Number(e.value[a]));n.push(o)}return n}function Ri(e,t){let r=t?.globalFeatureId;return r!==void 0?gg(e,r):mg(e,t?.type)}function gg(e,t){let r=vf(e);for(let n of r){let i=0,o=n.featureIds.value[0];for(let a=0;a<n.featureIds.value.length;a++){let s=n.featureIds.value[a];if(s!==o){if(t===n.globalFeatureIds.value[i])return Ii(n,i,a);i=a,o=s}}if(t===n.globalFeatureIds.value[i])return Ii(n,i,n.featureIds.value.length)}throw new Error(`featureId:${t} not found`)}function mg(e,t){let r=vf(e,t);return bg(r)}function vf(e,t){let r=[];return e.points&&(e.points.type="Point",r.push(e.points)),e.lines&&(e.lines.type="LineString",r.push(e.lines)),e.polygons&&(e.polygons.type="Polygon",r.push(e.polygons)),r}function bg(e){let t=[];for(let r of e){if(r.featureIds.value.length===0)continue;let n=0,i=r.featureIds.value[0];for(let o=0;o<r.featureIds.value.length;o++){let a=r.featureIds.value[o];a!==i&&(t.push(Ii(r,n,o)),n=o,i=a)}t.push(Ii(r,n,r.featureIds.value.length))}return t}function Ii(e,t,r){let n=yf(e,t,r),i=xg(e,t,r),o=yg(e,t,r);return{type:"Feature",geometry:n,properties:i,...o}}function yg(e,t=0,r){return e.fields&&e.fields[e.featureIds.value[t]]}function xg(e,t=0,r){let n=Object.assign({},e.properties[e.featureIds.value[t]]);for(let i in e.numericProps)n[i]=e.numericProps[i].value[t];return n}var In=q(Ee(),1);var Zt=Math.PI,Sg=Zt/4,z_=Zt/180,_f=180/Zt,Ef=512;function Pe(e){let[t,r]=e,n=t/Ef*(2*Zt)-Zt,i=2*(Math.atan(Math.exp(r/Ef*(2*Zt)-Zt))-Sg);return[n*_f,i*_f]}var Z_=Math.PI/180;var Dg=Math.PI/180,Ng=180/Math.PI;function Lf(e){var t=Cf(e[0]+1,e[2]),r=Cf(e[0],e[2]),n=Af(e[1]+1,e[2]),i=Af(e[1],e[2]);return[r,n,t,i]}function zg(e){var t=Lf(e),r={type:"Polygon",coordinates:[[[t[0],t[1]],[t[0],t[3]],[t[2],t[3]],[t[2],t[1]],[t[0],t[1]]]]};return r}function Cf(e,t){return e/Math.pow(2,t)*360-180}function Af(e,t){var r=Math.PI-2*Math.PI*e/Math.pow(2,t);return Ng*Math.atan(.5*(Math.exp(r)-Math.exp(-r)))}function Oa(e,t,r){var n=Df(e,t,r);return n[0]=Math.floor(n[0]),n[1]=Math.floor(n[1]),n}function Mf(e){return[[e[0]*2,e[1]*2,e[2]+1],[e[0]*2+1,e[1]*2,e[2]+1],[e[0]*2+1,e[1]*2+1,e[2]+1],[e[0]*2,e[1]*2+1,e[2]+1]]}function If(e){return e[0]%2===0&&e[1]%2===0?[e[0]/2,e[1]/2,e[2]-1]:e[0]%2===0&&!e[1]%2===0?[e[0]/2,(e[1]-1)/2,e[2]-1]:!e[0]%2===0&&e[1]%2===0?[(e[0]-1)/2,e[1]/2,e[2]-1]:[(e[0]-1)/2,(e[1]-1)/2,e[2]-1]}function Rf(e){return Mf(If(e))}function Ug(e,t){for(var r=Rf(e),n=0;n<r.length;n++)if(!Bf(t,r[n]))return!1;return!0}function Bf(e,t){for(var r=0;r<e.length;r++)if(Of(e[r],t))return!0;return!1}function Of(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}function qg(e){for(var t="",r=e[2];r>0;r--){var n=0,i=1<<r-1;(e[0]&i)!==0&&n++,(e[1]&i)!==0&&(n+=2),t+=n.toString()}return t}function Gg(e){for(var t=0,r=0,n=e.length,i=n;i>0;i--){var o=1<<i-1;switch(e[n-i]){case"0":break;case"1":t|=o;break;case"2":r|=o;break;case"3":t|=o,r|=o;break}}return[t,r,n]}function Vg(e){var t=Oa(e[0],e[1],32),r=Oa(e[2],e[3],32),n=[t[0],t[1],r[0],r[1]],i=$g(n);if(i===0)return[0,0,0];var o=n[0]>>>32-i,a=n[1]>>>32-i;return[o,a,i]}function $g(e){for(var t=28,r=0;r<t;r++){var n=1<<32-(r+1);if((e[0]&n)!=(e[2]&n)||(e[1]&n)!=(e[3]&n))return r}return t}function Df(e,t,r){var n=Math.sin(t*Dg),i=Math.pow(2,r),o=i*(e/360+.5),a=i*(.5-.25*Math.log((1+n)/(1-n))/Math.PI);return[o,a,r]}var Bi={tileToGeoJSON:zg,tileToBBOX:Lf,getChildren:Mf,getParent:If,getSiblings:Rf,hasTile:Bf,hasSiblings:Ug,tilesEqual:Of,tileToQuadkey:qg,quadkeyToTile:Gg,pointToTile:Oa,bboxToTile:Vg,pointToTileFraction:Df},Hg=jg;function jg(e,t){var r,n,i=e.coordinates,o=t.max_zoom,a={},s=[];if(e.type==="Point")return[Bi.pointToTile(i[0],i[1],o)];if(e.type==="MultiPoint")for(r=0;r<i.length;r++)n=Bi.pointToTile(i[r][0],i[r][1],o),a[Ue(n[0],n[1],n[2])]=!0;else if(e.type==="LineString")Da(a,i,o);else if(e.type==="MultiLineString")for(r=0;r<i.length;r++)Da(a,i[r],o);else if(e.type==="Polygon")Pf(a,s,i,o);else if(e.type==="MultiPolygon")for(r=0;r<i.length;r++)Pf(a,s,i[r],o);else throw new Error("Geometry type not implemented");if(t.min_zoom!==o){var f=s.length;for(Ff(a,s),r=0;r<f;r++){var l=s[r];a[Ue(l[0],l[1],l[2])]=!0}return Zg(a,s,t)}return Ff(a,s),s}function Zg(e,t,r){for(var n=[],i=r.max_zoom;i>r.min_zoom;i--){for(var o={},a=[],s=0;s<t.length;s++){var f=t[s];if(f[0]%2===0&&f[1]%2===0){var l=Ue(f[0]+1,f[1],i),c=Ue(f[0],f[1]+1,i),u=Ue(f[0]+1,f[1]+1,i);if(e[l]&&e[c]&&e[u]){e[Ue(f[0],f[1],f[2])]=!1,e[l]=!1,e[c]=!1,e[u]=!1;var d=[f[0]/2,f[1]/2,i-1];i-1===r.min_zoom?n.push(d):(o[Ue(f[0]/2,f[1]/2,i-1)]=!0,a.push(d))}}}for(s=0;s<t.length;s++)f=t[s],e[Ue(f[0],f[1],f[2])]&&n.push(f);e=o,t=a}return n}function Pf(e,t,r,n){for(var i=[],o=0;o<r.length;o++){var a=[];Da(e,r[o],n,a);for(var s=0,f=a.length,l=f-1;s<f;l=s++){var c=(s+1)%f,u=a[s][1];(u>a[l][1]||u>a[c][1])&&(u<a[l][1]||u<a[c][1])&&u!==a[c][1]&&i.push(a[s])}}for(i.sort(Wg),o=0;o<i.length;o+=2){u=i[o][1];for(var d=i[o][0]+1;d<i[o+1][0];d++){var h=Ue(d,u,n);e[h]||t.push([d,u,n])}}}function Wg(e,t){return e[1]-t[1]||e[0]-t[0]}function Da(e,t,r,n){for(var i,o,a=0;a<t.length-1;a++){var s=Bi.pointToTileFraction(t[a][0],t[a][1],r),f=Bi.pointToTileFraction(t[a+1][0],t[a+1][1],r),l=s[0],c=s[1],u=f[0],d=f[1],h=u-l,g=d-c;if(!(g===0&&h===0)){var x=h>0?1:-1,S=g>0?1:-1,T=Math.floor(l),w=Math.floor(c),k=h===0?1/0:Math.abs(((h>0?1:0)+T-l)/h),M=g===0?1/0:Math.abs(((g>0?1:0)+w-c)/g),L=Math.abs(x/h),B=Math.abs(S/g);for((T!==i||w!==o)&&(e[Ue(T,w,r)]=!0,n&&w!==o&&n.push([T,w]),i=T,o=w);k<1||M<1;)k<M?(k+=L,T+=x):(M+=B,w+=S),e[Ue(T,w,r)]=!0,n&&w!==o&&n.push([T,w]),i=T,o=w}}n&&w===n[0][1]&&n.pop()}function Ff(e,t){for(var r=Object.keys(e),n=0;n<r.length;n++)t.push(Yg(+r[n]))}function Ue(e,t,r){var n=2*(1<<r);return(n*t+e)*32+r}function Yg(e){var t=e%32,r=2*(1<<t),n=(e-t)/32,i=n%r,o=(n-i)/r%r;return[i,o,t]}var Nf=[0x5555555555555555n,0x3333333333333333n,0x0f0f0f0f0f0f0f0fn,0x00ff00ff00ff00ffn,0x0000ffff0000ffffn,0x00000000ffffffffn],zf=[0n,1n,2n,4n,8n,16n],kf=512;function Kg(e){let{x:t,y:r,z:n}=Wt(e),i=kf/(1<<n);return[t*i,kf-r*i,i]}function Xg(e,t){let[r,n,i]=Kg(e);return[[r,n],[r+t*i,n-t*i]]}function Qg(e,t=1){let[r,n]=Xg(e,t),[i,o]=Pe(r),[a,s]=Pe(n);return[a,o,a,s,i,s,i,o,a,o]}function Uf(e){return BigInt(`0x${e}`)}function cn(e){return e.toString(16)}function un(e){if(e.z<0||e.z>26)throw new Error("Wrong zoom");let t=BigInt(e.z),r=BigInt(e.x)<<32n-t,n=BigInt(e.y)<<32n-t;for(let o=0;o<5;o++){let a=zf[5-o],s=Nf[4-o];r=(r|r<<a)&s,n=(n|n<<a)&s}return 0x4000000000000000n|1n<<59n|t<<52n|(r|n<<1n)>>12n|0xfffffffffffffn>>t*2n}function Wt(e){let t=e>>59n&7n,r=e>>57n&3n,n=e>>52n&0x1fn,i=(e&0xfffffffffffffn)<<12n;if(t!==1n&&r!==0n)throw new Error("Wrong mode");let o=i,a=i>>1n;for(let s=0;s<6;s++){let f=zf[s],l=Nf[s];o=(o|o>>f)&l,a=(a|a>>f)&l}return o=o>>32n-n,a=a>>32n-n,{z:Number(n),x:Number(o),y:Number(a)}}function ht(e){return e>>52n&0x1fn}function Oi(e){let t=ht(e)-1n;return e&~(0x1fn<<52n)|t<<52n|0xfffffffffffffn>>t*2n}function qf(e,t){let r=Number(t);return Hg(e,{min_zoom:r,max_zoom:r}).map(([n,i,o])=>un({x:n,y:i,z:o}))}function Gf(e){let t=Qg(e);return{type:"Polygon",coordinates:[[[t[0],t[1]],[t[2],t[3]],[t[4],t[5]],[t[6],t[7]],[t[0],t[1]]]]}}var Ni=q(Yt(),1),jf=q(Ee(),1);var $f=q(Ee(),1);function Fe(e,t){$f.log.assert(e,t)}function Hf(e,t){let{properties:r,numericProps:n}=e;return new Proxy(r[t]||{},{get(i,o){return o in n?n[o].value[t]:i[o]},has(i,o){return o in n||o in i},ownKeys(i){return[...Object.keys(n),...Reflect.ownKeys(i)]},getOwnPropertyDescriptor(i,o){return{enumerable:!0,configurable:!0}}})}function Lt(e,t){return`https://unpkg.com/@deck.gl/carto@${t}/dist/${e}-worker.js`}var dn=new Uint16Array,Na={positions:{value:new Float32Array,size:2},properties:[],numericProps:{},featureIds:{value:dn,size:1},globalFeatureIds:{value:dn,size:1}};function Di(){return{shape:"binary-feature-collection",points:{type:"Point",...Na},lines:{type:"LineString",pathIndices:{value:dn,size:1},...Na},polygons:{type:"Polygon",polygonIndices:{value:dn,size:1},primitivePolygonIndices:{value:dn,size:1},...Na}}}function hn(e,t,r,n,i,o=2){return{type:"Point",positions:{value:new Float32Array(e),size:o},featureIds:{value:new Uint16Array(t),size:1},globalFeatureIds:{value:new Uint32Array(r),size:1},numericProps:n,properties:i}}function za(e,t){let r={};return t&&Object.keys(t).forEach(n=>{r[n]={value:new Float32Array(e),size:1}}),r}function Ua(e,t,r,n){Object.keys(e).forEach(i=>{t[i].value[n]=e[i].value[r]})}function Zf(e,t,r,n=[],i,o,a="quadbin"){if(!e.content)return!1;e.userData||(e.userData={});let s=t.get(r)?.[0];if(s){if(n.every(l=>l.name in s))return!1;t.clear()}let f={};for(let l of e.content){let c=l.id,u=typeof i=="function"?i(l,{}):i;for(let S=0;S<r-1;S++)if(a==="h3"){let T=(0,Ni.getResolution)(c);c=(0,Ni.cellToParent)(c,Math.max(0,T-1))}else c=Oi(c);let d=String(c);if(!(d in f)){f[d]={id:c,count:0,position:[0,0]};for(let{name:S,aggregation:T}of n)T==="any"?f[d][S]=l.properties[S]:f[d][S]=0}let h=f[d].count;f[d].count+=typeof o=="function"?o(l,{}):o;let g=f[d].count,x=g-h;f[d].position[0]=(h*f[d].position[0]+x*u[0])/g,f[d].position[1]=(h*f[d].position[1]+x*u[1])/g;for(let{name:S,aggregation:T}of n){let w=f[d][S],k=l.properties[S];T==="average"?f[d][S]=(h*w+x*k)/g:T==="count"||T==="sum"?f[d][S]=w+k:T==="max"?f[d][S]=Math.max(w,k):T==="min"&&(f[d][S]=Math.min(w,k))}}return t.set(r,Object.values(f)),!0}function Wf(e){let t=[],r=["any","average","count","min","max","sum"];for(let n of Object.keys(e.content[0].properties)){let i=n.split("_").pop().toLowerCase();r.includes(i)||(jf.log.warn(`No valid aggregation present in ${n} property`)(),i="any"),t.push({name:n,aggregation:i})}return t}function Yf(e,t){let r={};for(let{name:n,aggregation:i}of t)if(r[n]={min:1/0,max:-1/0},i!=="any")for(let o of e)r[n].min=Math.min(r[n].min,o[n]),r[n].max=Math.max(r[n].max,o[n]);return r}function Kf(e){let t=new Float32Array(e.length*2),r=new Uint16Array(e.length);for(let n=0;n<e.length;n++)t.set(e[n].position,2*n),r[n]=n;return{...Di(),points:hn(t,r,r,{},e)}}var Xf=q(dt(),1);var Qe=class extends Xf._Tileset2D{getTileIndices(t){return super.getTileIndices(t).map(un).map(r=>({q:r,i:cn(r)}))}getTileId({q:t,i:r}){return r||cn(t)}getTileMetadata({q:t}){return super.getTileMetadata(Wt(t))}getTileZoom({q:t}){return Number(ht(t))}getParentIndex({q:t}){return{q:Oi(t)}}};var Jf=q(dt(),1),ne=q(Yt(),1),Qf=85.051128;function ec({west:e,north:t,east:r,south:n},i,o=1){let f=[[t,r],[n,r],[n,e],[t,e]].map(u=>(0,ne.latLngToCell)(u[0],u[1],i)).map(u=>Math.max(...(0,ne.originToDirectedEdges)(u).map(d=>(0,ne.edgeLength)(d,ne.UNITS.rads)))*180/Math.PI),l=Math.max(...f)*o,c=Math.min(180,l/Math.cos((t+n)/2*Math.PI/180));return{north:Math.min(t+l,Qf),east:r+c,south:Math.max(n-l,-Qf),west:e-c}}function tc({west:e,north:t,east:r,south:n},i){let o=Math.abs(r-e);if(o>180){let s=Math.ceil(o/180),f=[];for(let l=0;l<s;l++){let c=e+l*180,u=Math.min(c+179.9999999,r);f=f.concat(tc({west:c,north:t,east:u,south:n},i))}return[...new Set(f)]}return(0,ne.polygonToCells)([[t,r],[n,r],[n,e],[t,e],[t,r]],i)}function Jg(e){let t=(0,ne.cellToBoundary)(e),r=t.map(l=>l[0]),n=t.map(l=>l[1]),i=Math.min(...n),o=Math.min(...r),a=Math.max(...n),s=Math.max(...r);return ec({west:i,south:o,east:a,north:s},(0,ne.getResolution)(e),.12)}var em=2;function Cr(e,t){let r=Math.log2(t/512),n=2/3*(e.zoom-r),i=Math.log(1/Math.cos(Math.PI*e.latitude/180));return Math.max(0,Math.floor(n+i-em))}var Mt=class extends Jf._Tileset2D{getTileIndices({viewport:t,minZoom:r,maxZoom:n}){if(t.latitude===void 0)return[];let[i,o,a,s]=t.getBounds(),{tileSize:f}=this.opts,l=Cr(t,f),c;if(typeof r=="number"&&Number.isFinite(r)&&l<r)return[];if(typeof n=="number"&&Number.isFinite(n)&&l>n){l=n;let u=(0,ne.latLngToCell)(t.latitude,t.longitude,n);c=(0,ne.gridDisk)(u,1)}else{let u=ec({west:i,north:s,east:a,south:o},l);c=tc(u,l)}return c.map(u=>({i:u}))}getTileId({i:t}){return t}getTileMetadata({i:t}){return{bbox:Jg(t)}}getTileZoom({i:t}){return(0,ne.getResolution)(t)}getParentIndex(t){let r=(0,ne.getResolution)(t.i);return{i:(0,ne.cellToParent)(t.i,r-1)}}};var rc=512;function qa(e){let{x:t,y:r,z:n}=Wt(e),i=rc/(1<<n);return[t*i,rc-r*i,i]}function tm(e,t){let[r,n,i]=qa(e);return[[r,n],[r+t*i,n-t*i]]}function zi(e,t=1){let[r,n]=tm(e,t),[i,o]=Pe(r),[a,s]=Pe(n);return[a,o,a,s,i,s,i,o,a,o]}var fo=q(Yt(),1);var Je={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},rm=Je.self||Je.window||Je.global||{},nm=Je.window||Je.self||Je.global||{},im=Je.global||Je.self||Je.window||{},om=Je.document||{};var Ar=!!(typeof process!="object"||String(process)!=="[object process]"||process.browser);var nc=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),am=nc&&parseFloat(nc[1])||0;var ic=e=>typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer;function Ga(e){globalThis.loaders||={},globalThis.loaders.modules||={},Object.assign(globalThis.loaders.modules,e)}function oc(...e){return sm(e)}function sm(e){let t=e.map(o=>o instanceof ArrayBuffer?new Uint8Array(o):o),r=t.reduce((o,a)=>o+a.byteLength,0),n=new Uint8Array(r),i=0;for(let o of t)n.set(o,i),i+=o.byteLength;return n.buffer}async function Va(e){let t=[];for await(let r of e)t.push(lm(r));return oc(...t)}function lm(e){if(e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e)){let{buffer:t,byteOffset:r,byteLength:n}=e;return ac(t,r,n)}return ac(e)}function ac(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),i=new Uint8Array(n.length);return i.set(n),i.buffer}function sc(e){return e&&typeof e=="object"&&e.isBuffer}function It(e){if(sc(e))return e;if(e instanceof ArrayBuffer)return e;if(ic(e))return lc(e);if(ArrayBuffer.isView(e)){let t=e.buffer;return e.byteOffset===0&&e.byteLength===e.buffer.byteLength?t:t.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(typeof e=="string"){let t=e;return new TextEncoder().encode(t).buffer}if(e&&typeof e=="object"&&e._toArrayBuffer)return e._toArrayBuffer();throw new Error("toArrayBuffer")}function lc(e,t=0,r=e.byteLength-t){let n=new Uint8Array(e,t,r),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Pr(e){return t=>new Promise((r,n)=>e(t,(i,o)=>i?n(i):r(o)))}var Ui=class{constructor(t){this.compressBatches=this.compressBatches.bind(this),this.decompressBatches=this.decompressBatches.bind(this)}async preload(t={}){Ga(t)}async compress(t){return await this.preload(),this.compressSync(t)}async decompress(t,r){return await this.preload(),this.decompressSync(t,r)}compressSync(t){throw new Error(`${this.name}: sync compression not supported`)}decompressSync(t,r){throw new Error(`${this.name}: sync decompression not supported`)}async*compressBatches(t){let r=await this.concatenate(t);yield this.compress(r)}async*decompressBatches(t){let r=await this.concatenate(t);yield this.decompress(r)}concatenate(t){return Va(t)}improveError(t){return t.message.includes(this.name)||(t.message=`${this.name} ${t.message}`),t}};var ir=q(Yu(),1),yt=q(Ku(),1),no=class extends Ui{name="deflate";extensions=[];contentEncodings=["deflate"];isSupported=!0;options;_chunks=[];constructor(t={}){super(t),this.options=t}async compress(t){if(!Ar&&this.options.deflate?.useZlib){let r=this.options.deflate?.gzip?await Pr(yt.default.gzip)(t):await Pr(yt.default.deflate)(t);return It(r)}return this.compressSync(t)}async decompress(t){if(!Ar&&this.options.deflate?.useZlib){let r=this.options.deflate?.gzip?await Pr(yt.default.gunzip)(t):await Pr(yt.default.inflate)(t);return It(r)}return this.decompressSync(t)}compressSync(t){if(!Ar&&this.options.deflate?.useZlib){let o=this.options.deflate?.gzip?yt.default.gzipSync(t):yt.default.deflateSync(t);return It(o)}let r=this.options?.deflate||{},n=new Uint8Array(t),i=this.options?.raw?ir.default.deflateRaw:ir.default.deflate;return It(i(n,r).buffer)}decompressSync(t){if(!Ar&&this.options.deflate?.useZlib){let o=this.options.deflate?.gzip?yt.default.gunzipSync(t):yt.default.inflateSync(t);return It(o)}let r=this.options?.deflate||{},n=new Uint8Array(t),i=this.options?.raw?ir.default.inflateRaw:ir.default.inflate;return It(i(n,r).buffer)}async*compressBatches(t){let r=this.options?.deflate||{},n=new ir.default.Deflate(r);yield*this.transformBatches(n,t)}async*decompressBatches(t){let r=this.options?.deflate||{},n=new ir.default.Inflate(r);yield*this.transformBatches(n,t)}async*transformBatches(t,r){t.onData=this._onData.bind(this),t.onEnd=this._onEnd.bind(this);for await(let a of r){let s=new Uint8Array(a);if(!t.push(s,!1))throw new Error(`${this._getError()}write`);yield*this._getChunks()}let n=new Uint8Array(0),i=t.push(n,!0);yield*this._getChunks()}_onData(t){this._chunks.push(t)}_onEnd(t){if(t!==0)throw new Error(this._getError(t)+this._chunks.length)}_getChunks(){let t=this._chunks;return this._chunks=[],t}_getError(t=0){let r={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};return`${this.name}: ${r[t]}`}};var kn=class extends no{name="gzip";extensions=["gz","gzip"];contentEncodings=["gzip","x-gzip"];isSupported=!0;constructor(t){super({...t,deflate:{...t?.gzip,gzip:!0}})}};function or(e,t,r,n){let i=t.type===2?t.readVarint()+t.pos:t.pos+1,o=t.buf.buffer.slice(t.pos,i);if(n?.compression==="gzip"){let s=new kn().decompressSync(o);r.value=new e(s)}else r.value=new e(o);return t.pos=i,r.value}var Ss=class e{static read(t,r){return t.readFields(e._readField,{key:"",value:null},r)}static _readField(t,r,n){t===1?r.key=n.readString():t===2&&(r.value=n.readString())}},xt=class e{static read(t,r){return t.readFields(e._readField,{},r)}static _readField(t,r,n){if(t===1){let{key:i,value:o}=Ss.read(n,n.readVarint()+n.pos);r[i]=o}}},Ln=class e{static read(t,r){let{value:n,size:i}=t.readFields(e._readField,{value:[],size:0},r);return{value:n,size:i}}static _readField(t,r,n){t===1?or(Float64Array,n,r):t===2&&(r.size=n.readVarint(!0))}},Ie=class e{static read(t,r){let{value:n,size:i}=t.readFields(e._readField,{value:[],size:0},r);return{value:new Uint32Array(n),size:i}}static _readField(t,r,n){t===1?n.readPackedVarint(r.value):t===2&&(r.size=n.readVarint(!0))}},Mn=class e{static read(t,r){return t.readFields(e._readField,{id:0},r)}static _readField(t,r,n){t===1&&(r.id=n.readVarint())}},Ts=class e{static read(t,r){return t.readFields(e._readField,{value:[]},r)}static _readField(t,r,n){t===1&&or(Float64Array,n,r)}},vt=class e{static read(t,r){return t.readFields(e._readField,{key:"",value:null},r)}static _readField(t,r,n){t===1?r.key=n.readString():t===2&&(r.value=Ts.read(n,n.readVarint()+n.pos))}},Cs=class e{static read(t,r){return t.readFields(e._readField,{positions:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},r)}static _readField(t,r,n){if(t===1)r.positions=Ln.read(n,n.readVarint()+n.pos);else if(t===2)r.globalFeatureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===3)r.featureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===4)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===5){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}else t===6&&r.fields.push(Mn.read(n,n.readVarint()+n.pos))}},As=class e{static read(t,r){return t.readFields(e._readField,{positions:null,pathIndices:null,globalFeatureIds:null,featureIds:null,properties:[],numericProps:{},fields:[]},r)}static _readField(t,r,n){if(t===1)r.positions=Ln.read(n,n.readVarint()+n.pos);else if(t===2)r.pathIndices=Ie.read(n,n.readVarint()+n.pos);else if(t===3)r.globalFeatureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===4)r.featureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===5)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===6){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}else t===7&&r.fields.push(Mn.read(n,n.readVarint()+n.pos))}},Ps=class e{static read(t,r){return t.readFields(e._readField,{positions:null,polygonIndices:null,globalFeatureIds:null,featureIds:null,primitivePolygonIndices:null,triangles:null,properties:[],numericProps:{},fields:[]},r)}static _readField(t,r,n){if(t===1)r.positions=Ln.read(n,n.readVarint()+n.pos);else if(t===2)r.polygonIndices=Ie.read(n,n.readVarint()+n.pos);else if(t===3)r.globalFeatureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===4)r.featureIds=Ie.read(n,n.readVarint()+n.pos);else if(t===5)r.primitivePolygonIndices=Ie.read(n,n.readVarint()+n.pos);else if(t===6)r.triangles=Ie.read(n,n.readVarint()+n.pos);else if(t===7)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===8){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}else t===9&&r.fields.push(Mn.read(n,n.readVarint()+n.pos))}},io=class e{static read(t,r){return t.readFields(e._readField,{points:null,lines:null,polygons:null},r)}static _readField(t,r,n){t===1?r.points=Cs.read(n,n.readVarint()+n.pos):t===2?r.lines=As.read(n,n.readVarint()+n.pos):t===3&&(r.polygons=Ps.read(n,n.readVarint()+n.pos))}};var Fs=class e{static read(t,r){return t.readFields(e._readField,{value:[]},r)}static _readField(t,r,n){t===1&&or(BigUint64Array,n,r)}},ks=class e{static read(t,r){return t.readFields(e._readField,{indices:null,properties:[],numericProps:{}},r)}static _readField(t,r,n){if(t===1)r.indices=Fs.read(n,n.readVarint()+n.pos);else if(t===2)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===3){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}}},oo=class e{static read(t,r){return t.readFields(e._readField,{scheme:0,cells:null},r)}static _readField(t,r,n){t===1?r.scheme=n.readVarint():t===2&&(r.cells=ks.read(n,n.readVarint()+n.pos))}};var id=q(nd(),1);function Ut(e,t){let r=new id.default(e);return t.read(r)}function od(e){let{cells:t,scheme:r}=e,n=t.indices.value.length,i=[];for(let o=0;o<n;o++){let a=r==="h3"?cn(t.indices.value[o]):t.indices.value[o],s={...t.properties[o]};for(let f of Object.keys(t.numericProps))s[f]=t.numericProps[f].value[o];i.push({id:a,properties:s})}return i}var sd="9.4.1",ld="cartoSpatialTile",yb={cartoSpatialTile:{scheme:"quadbin",workerUrl:Lt(ld,sd)}},xb={name:"CARTO Spatial Tile",version:sd,id:ld,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-spatial-tile"],category:"geometry",parse:async(e,t)=>ad(e,t),parseSync:ad,worker:!0,options:yb};function ad(e,t){if(!e)return null;let r=Ut(e,oo),{cells:n}=r,i=t?.cartoSpatialTile?.scheme;return od({cells:n,scheme:i})}var lo=xb;var fd=q(Ee(),1),cd=q(Ee(),1);function Ve(e,t,r=0){if(!e)return t;if(!t)return e;if(r>10)return t;let n={...e};for(let i in t){let o=t[i];o===e||o===t||(typeof o=="object"&&o!==null?n[i]=Ve(e[i],o,r+1):n[i]=o)}return n}function ud(e,t){let r={};for(let{geoid:n,...i}of t.properties)n in r?fd.log.warn("Duplicate geoid key in boundary mapping, using first occurance")():r[n]=i;for(let n of["points","lines","polygons"]){let i=e[n];if(i.positions.value.length===0)continue;i.properties=i.properties.map(({geoid:l})=>r[l]);let{positions:o,globalFeatureIds:a}=i,s=null;n==="lines"&&(s=i.pathIndices.value),n==="polygons"&&(s=i.polygonIndices.value);let f=o.value.length/o.size;for(let l in t.numericProps){let c=t.numericProps[l].value,u=c.constructor,d=new u(f);if(i.numericProps[l]={value:d,size:1},s)for(let h=0;h<s.length-1;h++){let g=s[h],x=s[h+1],S=a.value[g];d.fill(c[S],g,x)}else for(let h=0;h<f;h++){let g=a.value[h];d[h]=c[g]}}}return e}var Te={type:"object",value:null,validate:(e,t)=>t.optional&&e===null||typeof e=="object"&&Array.isArray(e.tiles)&&e.tiles.every(r=>typeof r=="string"),equal:(e,t)=>(0,cd._deepEqual)(e,t,2),async:!0};(0,gd.registerLoaders)([lo]);function dd(e){if(e===Mt)return"h3";if(e===Qe)return"quadbin";throw new Error("Invalid tileset class")}var md={data:Te,clusterLevel:{type:"number",value:5,min:1},getPosition:{type:"accessor",value:({id:e})=>{if(typeof e=="string"){let[t,r]=(0,fo.cellToLatLng)(e);return[r,t]}return zi(e,.5).slice(2,4)}},getWeight:{type:"accessor",value:1},refinementStrategy:"no-overlap",tileSize:512},Rn=class extends pd.TileLayer{initializeState(){super.initializeState(),this.state.aggregationCache=new WeakMap,this.state.scheme=dd(this.props.TilesetClass)}updateState(t){let{props:r}=t,n=dd(r.TilesetClass);this.state.scheme!==n&&(this.setState({scheme:n,tileset:null}),this.state.aggregationCache=new WeakMap),super.updateState(t)}renderLayers(){let t=this.state.tileset?.tiles.filter(h=>h.isLoaded&&h.content&&this.state.tileset.isTileVisible(h));if(!t?.length||!this.state.tileset)return null;t.sort((h,g)=>g.zoom-h.zoom);let{getPosition:r,getWeight:n}=this.props,{aggregationCache:i,scheme:o}=this.state,a=o==="h3",s=Wf(t[0]),f=[],l=!1,c=this._getAggregationLevels(t);for(let h of t){let g=i.get(h.content);g||(g=new Map,i.set(h.content,g));let x=Zf(h,g,c,s,r,n,a?"h3":"quadbin");l||(l=x),f.push(...g.get(c))}f.sort((h,g)=>Number(g.count-h.count));let u=f?.map(h=>h.id);if(l||(l=!(0,In._deepEqual)(u,this.state.clusterIds,1)),this.setState({clusterIds:u}),l){let h=Yf(f,s),g=Kf(f);g.points.attributes={stats:h},this.setState({data:g})}let d={...this.props,id:"clusters",data:this.state.data,dataComparator:(h,g)=>{let x=h?.points?.properties?.map(T=>T.id),S=g?.points?.properties?.map(T=>T.id);return(0,In._deepEqual)(x,S,1)}};return new hd.GeoJsonLayer(this.getSubLayerProps(d))}getPickingInfo(t){let r=t.info;if(r.index!==-1){let{data:n}=t.sourceLayer.props;r.object=Ri(n,{globalFeatureId:r.index})}return r}_updateAutoHighlight(t){for(let r of this.getSubLayers())r.updateAutoHighlight(t)}filterSubLayer(){return!0}_getAggregationLevels(t){let r=this.state.scheme==="h3",n=t[0],i,o;r?(i=(0,fo.getResolution)(n.id),o=Cr(this.context.viewport,this.state.tileset.opts.tileSize)):(i=n.zoom,o=this.context.viewport.zoom);let a=Math.round(o-i);return Math.round(this.props.clusterLevel)-a}};Rn.layerName="ClusterGeoJsonLayer";Rn.defaultProps=md;var Bn=class extends In.CompositeLayer{getLoadOptions(){let t=this.props.data,r=t&&"scheme"in t?t.scheme:"quadbin";return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},cartoSpatialTile:{scheme:r}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r,maxresolution:n}=t,o=t&&"scheme"in t&&t.scheme==="h3"?Mt:Qe;return[new Rn(this.props,{id:`cluster-geojson-layer-${this.props.id}`,data:r,TilesetClass:o,maxZoom:n,loadOptions:this.getLoadOptions()})]}};Bn.layerName="ClusterTileLayer";Bn.defaultProps=md;var Dn=Bn;var xd=q(Ee(),1),Is=q(dt(),1);var bd=q(fn(),1);var yd=q(dt(),1);(0,bd.registerLoaders)([lo]);function vb(e){return e!=null&&e!==""}var wb={tileSize:512},Nn=class extends yd.TileLayer{_updateAutoHighlight(t){let{hoveredFeatureId:r}=this.state,n=t.object,i=null;if(n&&(i=n.id),r!==i){let{highlightColor:o}=this.props;typeof o=="function"&&(o=o(t)),this.setState({highlightColor:o,hoveredFeatureId:i})}}getSubLayerPropsByTile(t){return{highlightedObjectIndex:this.getHighlightedObjectIndex(t),highlightColor:this.state.highlightColor}}getHighlightedObjectIndex(t){let{hoveredFeatureId:r}=this.state,n=t.content;return!vb(r)||!Array.isArray(n)||!this._featureInTile(t,r)?-1:n.findIndex(o=>o.id===r)}_featureInTile(t,r){let n=this.state.tileset,i=n.getTileZoom(t.index),o=t.index.q?"q":"i",a={[o]:r},s=n.getTileZoom(a);for(;!(s<=i);)a=n.getParentIndex(a),s=n.getTileZoom(a);return a[o]===t.index[o]}};Nn.layerName="SpatialIndexTileLayer";Nn.defaultProps=wb;var qr=Nn;var _b=e=>{let{data:t}=e,{index:r}=e.tile;return!t||!t.length?null:new Is.H3HexagonLayer(e,{getHexagon:n=>n.id,centerHexagon:r,highPrecision:!0})},Eb={data:Te,tileSize:512},zn=class extends xd.CompositeLayer{initializeState(){Is.H3HexagonLayer._checkH3Lib()}getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},cartoSpatialTile:{scheme:"h3"}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r}=t,{minresolution:n,maxresolution:i}=t;this.props.minZoom&&(n=Math.max(n,Cr({zoom:this.props.minZoom,latitude:0},this.props.tileSize))),this.props.maxZoom&&(i=Math.min(i,Cr({zoom:this.props.maxZoom,latitude:0},this.props.tileSize)));let o=this.getSubLayerClass("spatial-index-tile",qr);return new o(this.props,{id:`h3-tile-layer-${this.props.id}`,data:r,TilesetClass:Mt,renderSubLayers:_b,minZoom:n,maxZoom:i,loadOptions:this.getLoadOptions()})}};zn.layerName="H3TileLayer";zn.defaultProps=Eb;var ar=zn;var mo=q(Yt(),1),bo=q(Ee(),1),Ed=q(kt(),1);var Sb=`layout(std140) uniform heatmapUniforms {
8
8
  vec2 colorDomain;
9
9
  vec2 delta;
10
10
  float intensity;
@@ -83,10 +83,10 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
83
83
 
84
84
  return color;
85
85
  }
86
- `,Rs={name:"heatmap",uniformPropTypes:{colorDomain:{value:[0,1]},delta:{value:[0,1]},intensity:{value:1,min:.1,max:10},opacity:{value:1,min:0,max:1},radiusPixels:{value:20,min:0,softMax:100}},uniformTypes:{colorDomain:"vec2<f32>",delta:"vec2<f32>",intensity:"f32",opacity:"f32",radiusPixels:"f32"},getUniforms:e=>{if(!e)return{};let{colorDomain:t=[0,1],colorTexture:r,delta:n=[1,0],intensity:i=1,opacity:o=1,radiusPixels:a=20}=e;return{colorDomain:t,colorTexture:r,delta:n,intensity:i,opacity:o,radiusPixels:a}},fs:Sb,passes:[{sampler:!0,uniforms:{delta:[1,0]}},{sampler:!0,uniforms:{delta:[0,1]}}]};var uo=q(Ee(),1),Tb={format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function Os(e){for(;e.parent&&!e.applyPostProcess;)e=e.parent;return e}var co=class extends uo.Layer{initializeState(){this.id=`draw-callback-${Os(this).props.id}`}_drawLayer(){Os(this).applyPostProcess()}};co.layerName="DrawCallbackLayer";function ho(e){var t;return t=class extends e{draw(n){let{shaderModuleProps:i}=n,{picking:o}=i,a=Os(this),s=!o.isActive&&a.enableRTT;s&&a.enableRTT(n),super.draw(n),s&&a.disableRTT()}},t.layerName=`RTT-${e.layerName}`,t}function Un(e,t){var r;return r=class extends e{initializeState(i){super.initializeState(i),this._createTextures(),this.internalState.postProcess=new uo.PostProcessEffect(t,this.props),this.internalState.postProcess.setup(i)}updateState(i){super.updateState(i),this.internalState.postProcess.setProps(this.props)}renderLayers(){let i=super.renderLayers();return i?(i=Array.isArray(i)?i:[i],[...i,new co]):null}_createTextures(){let{device:i}=this.context;this.internalState.renderBuffers=[0,1].map(o=>i.createFramebuffer({id:`layer-fbo-${o}`,colorAttachments:[i.createTexture(Tb)],depthStencilAttachment:"depth16unorm"}))}_resizeBuffers(i){let{shaderModuleProps:o}=i,{viewport:a}=this.context,{devicePixelRatio:s}=o.project,l=s*a.width,f=s*a.height;this.internalState.renderBuffers.forEach(c=>c.resize({width:l,height:f}))}enableRTT(i){this._resizeBuffers(i),this.internalState.originalRenderPass=this.context.renderPass;let[o]=this.internalState.renderBuffers;this.internalState.internalRenderPass=this.context.device.beginRenderPass({framebuffer:o,parameters:{viewport:[0,0,o.width,o.height]},clearColor:this.internalState.renderInProgress?!1:[0,0,0,0]}),this.internalState.renderInProgress=!0,this.context.renderPass=this.internalState.internalRenderPass}disableRTT(){this.internalState.internalRenderPass.end(),this.context.renderPass=this.internalState.originalRenderPass}applyPostProcess(){if(!this.internalState.renderInProgress)return;let[i,o]=this.internalState.renderBuffers,{framebuffer:a}=this.context.renderPass.props;this.internalState.postProcess.postRender({inputBuffer:i,swapBuffer:o,target:a}),this.internalState.renderInProgress=!1}_finalize(){this.internalState.renderBuffers.forEach(i=>{i.destroy()}),this.internalState.renderBuffers=null,this.internalState.postProcess.cleanup()}},r.layerName=`PostProcess${e.layerName}`,r}var Cb=`vec4 copy_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
86
+ `,Rs={name:"heatmap",uniformPropTypes:{colorDomain:{value:[0,1]},delta:{value:[0,1]},intensity:{value:1,min:.1,max:10},opacity:{value:1,min:0,max:1},radiusPixels:{value:20,min:0,softMax:100}},uniformTypes:{colorDomain:"vec2<f32>",delta:"vec2<f32>",intensity:"f32",opacity:"f32",radiusPixels:"f32"},getUniforms:e=>{if(!e)return{};let{colorDomain:t=[0,1],colorTexture:r,delta:n=[1,0],intensity:i=1,opacity:o=1,radiusPixels:a=20}=e;return{colorDomain:t,colorTexture:r,delta:n,intensity:i,opacity:o,radiusPixels:a}},fs:Sb,passes:[{sampler:!0,uniforms:{delta:[1,0]}},{sampler:!0,uniforms:{delta:[0,1]}}]};var uo=q(Ee(),1),Tb={format:"rgba8unorm",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function Bs(e){for(;e.parent&&!e.applyPostProcess;)e=e.parent;return e}var co=class extends uo.Layer{initializeState(){this.id=`draw-callback-${Bs(this).props.id}`}_drawLayer(){Bs(this).applyPostProcess()}};co.layerName="DrawCallbackLayer";function ho(e){var t;return t=class extends e{draw(n){let{shaderModuleProps:i}=n,{picking:o}=i,a=Bs(this),s=!o.isActive&&a.enableRTT;s&&a.enableRTT(n),super.draw(n),s&&a.disableRTT()}},t.layerName=`RTT-${e.layerName}`,t}function Un(e,t){var r;return r=class extends e{initializeState(i){super.initializeState(i),this._createTextures(),this.internalState.postProcess=new uo.PostProcessEffect(t,this.props),this.internalState.postProcess.setup(i)}updateState(i){super.updateState(i),this.internalState.postProcess.setProps(this.props)}renderLayers(){let i=super.renderLayers();return i?(i=Array.isArray(i)?i:[i],[...i,new co]):null}_createTextures(){let{device:i}=this.context;this.internalState.renderBuffers=[0,1].map(o=>i.createFramebuffer({id:`layer-fbo-${o}`,colorAttachments:[i.createTexture(Tb)],depthStencilAttachment:"depth16unorm"}))}_resizeBuffers(i){let{shaderModuleProps:o}=i,{viewport:a}=this.context,{devicePixelRatio:s}=o.project,f=s*a.width,l=s*a.height;this.internalState.renderBuffers.forEach(c=>c.resize({width:f,height:l}))}enableRTT(i){this._resizeBuffers(i),this.internalState.originalRenderPass=this.context.renderPass;let[o]=this.internalState.renderBuffers;this.internalState.internalRenderPass=this.context.device.beginRenderPass({framebuffer:o,parameters:{viewport:[0,0,o.width,o.height]},clearColor:this.internalState.renderInProgress?!1:[0,0,0,0]}),this.internalState.renderInProgress=!0,this.context.renderPass=this.internalState.internalRenderPass}disableRTT(){this.internalState.internalRenderPass.end(),this.context.renderPass=this.internalState.originalRenderPass}applyPostProcess(){if(!this.internalState.renderInProgress)return;let[i,o]=this.internalState.renderBuffers,{framebuffer:a}=this.context.renderPass.props;this.internalState.postProcess.postRender({inputBuffer:i,swapBuffer:o,target:a}),this.internalState.renderInProgress=!1}_finalize(){this.internalState.renderBuffers.forEach(i=>{i.destroy()}),this.internalState.renderBuffers=null,this.internalState.postProcess.cleanup()}},r.layerName=`PostProcess${e.layerName}`,r}var Cb=`vec4 copy_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
87
87
  return color;
88
88
  }
89
- `,vd={name:"copy",fs:Cb,getUniforms:()=>({}),passes:[{filter:!0}]};var _d=q(Ee(),1);var wd=q(dt(),1);var Ab={getQuadbin:{type:"accessor",value:e=>e.quadbin}},qn=class extends wd._GeoCellLayer{indexToBounds(){let{data:t,extruded:r,getQuadbin:n}=this.props,i=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,a)=>zi(n(o,a),i),updateTriggers:{getPolygon:i}}}};qn.layerName="QuadbinLayer";qn.defaultProps=Ab;var po=qn;var Pb=e=>{let{data:t}=e;if(!t||!t.length)return null;let r=typeof t[0].id=="bigint";return new po(e,{getQuadbin:r?n=>n.id:n=>Ul(n.id)})},Fb={data:Te,tileSize:512},Gn=class extends _d.CompositeLayer{getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},cartoSpatialTile:{scheme:"quadbin"}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r,maxresolution:n}=t,i=this.getSubLayerClass("spatial-index-tile",qr);return new i(this.props,{id:`quadbin-tile-layer-${this.props.id}`,data:r,TilesetClass:Qe,renderSubLayers:Pb,maxZoom:n,loadOptions:this.getLoadOptions()})}};Gn.layerName="QuadbinTileLayer";Gn.defaultProps=Fb;var sr=Gn;var kb=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]],Mb={format:"rgba8unorm",dimension:"2d",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function Sd(e){let t=Number(ht(e));return Math.pow(4,t)}function Td(e){let t=Number((0,mo.getResolution)(e));return(0,mo.getNumCells)(t)}function Lb(e){let t=new Uint8Array(e.length*4),r=0;for(let n=0;n<e.length;n++){let i=e[n];t[r++]=i[0],t[r++]=i[1],t[r++]=i[2],t[r++]=Number.isFinite(i[3])?i[3]:255}return t}var Ib=`layout(std140) uniform densityUniforms {
89
+ `,vd={name:"copy",fs:Cb,getUniforms:()=>({}),passes:[{filter:!0}]};var _d=q(Ee(),1);var wd=q(dt(),1);var Ab={getQuadbin:{type:"accessor",value:e=>e.quadbin}},qn=class extends wd._GeoCellLayer{indexToBounds(){let{data:t,extruded:r,getQuadbin:n}=this.props,i=r?.99:1;return{data:t,_normalize:!1,positionFormat:"XY",getPolygon:(o,a)=>zi(n(o,a),i),updateTriggers:{getPolygon:i}}}};qn.layerName="QuadbinLayer";qn.defaultProps=Ab;var po=qn;var Pb=e=>{let{data:t}=e;if(!t||!t.length)return null;let r=typeof t[0].id=="bigint";return new po(e,{getQuadbin:r?n=>n.id:n=>Uf(n.id)})},Fb={data:Te,tileSize:512},Gn=class extends _d.CompositeLayer{getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},cartoSpatialTile:{scheme:"quadbin"}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r,maxresolution:n}=t,i=this.getSubLayerClass("spatial-index-tile",qr);return new i(this.props,{id:`quadbin-tile-layer-${this.props.id}`,data:r,TilesetClass:Qe,renderSubLayers:Pb,maxZoom:n,loadOptions:this.getLoadOptions()})}};Gn.layerName="QuadbinTileLayer";Gn.defaultProps=Fb;var sr=Gn;var kb=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]],Lb={format:"rgba8unorm",dimension:"2d",width:1,height:1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};function Sd(e){let t=Number(ht(e));return Math.pow(4,t)}function Td(e){let t=Number((0,mo.getResolution)(e));return(0,mo.getNumCells)(t)}function Mb(e){let t=new Uint8Array(e.length*4),r=0;for(let n=0;n<e.length;n++){let i=e[n];t[r++]=i[0],t[r++]=i[1],t[r++]=i[2],t[r++]=Number.isFinite(i[3])?i[3]:255}return t}var Ib=`layout(std140) uniform densityUniforms {
90
90
  float factor;
91
91
  } density;
92
92
  `,Rb={name:"density",vs:Ib,uniformTypes:{factor:"f32"}},go=class extends ho(Ed.SolidPolygonLayer){getShaders(t){let r=super.getShaders(t);return r.inject={"vs:#main-end":`
@@ -106,8 +106,8 @@ vec4 heatmap_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
106
106
  weight *= SCALE;
107
107
  weight = clamp(weight, 0.0, MAX_VAL);
108
108
  vColor = vec4(mod(vec3(weight, floor(weight / SHIFT.yz)), 256.0), 255.0) / 255.0;
109
- `},r.modules=[...r.modules,Rb],r}draw(t){let r=this.props.data[0];if(r){let n=this.props.elevationScale,{scheme:i}=this.parent.parent.parent.parent.parent.state,a={factor:(i==="h3"?Td(r.id):Sd(r.id))/n};for(let s of this.state.models)s.shaderInputs.setProps({density:a})}super.draw(t)}};go.layerName="RTTSolidPolygonLayer";var Ob=Un(sr,Rs),Bb=Un(ar,Rs),Db={data:Te,getWeight:{type:"accessor",value:1},onMaxDensityChange:{type:"function",optional:!0,value:null},colorDomain:{type:"array",value:[0,1]},colorRange:kb,intensity:{type:"number",value:1},radiusPixels:{type:"number",min:0,max:100,value:20}},Vn=class extends bo.CompositeLayer{initializeState(){this.state={isLoaded:!1,scheme:null,tiles:new Set,viewportChanged:!1}}shouldUpdateState({changeFlags:t}){let{viewportChanged:r}=t;return this.setState({viewportChanged:r}),t.somethingChanged}updateState(t){let{props:r,oldProps:n}=t;super.updateState(t),(0,bo._deepEqual)(r.colorRange,n.colorRange,2)||this._updateColorTexture(t);let i=r.data&&"scheme"in r.data?r.data.scheme:null;this.state.scheme!==i&&(this.setState({scheme:i}),this.state.tiles.clear())}renderLayers(){let{data:t,getWeight:r,colorDomain:n,intensity:i,radiusPixels:o,_subLayerProps:a,updateTriggers:s,onMaxDensityChange:l,onViewportLoad:f,onTileLoad:c,onTileUnload:u,...d}=this.props,h=this.state.scheme==="h3",g=h?"hexagon-cell-hifi":"cell",x={...a,[g]:{...a?.[g],_subLayerProps:{...a?.[g]?._subLayerProps,fill:{...a?.[g]?._subLayerProps?.fill,type:go}}}},S=0,T=0,w=[...this.state.tiles].filter(m=>m.content),k=w.filter(m=>m.isVisible),L=k.length?k:w;for(let m of L){let b=m.content[0],y=h?Td(b.id):Sd(b.id);T=Math.max(m.userData.maxWeight*y,T),S=Math.max(m.zoom,S)}let M,O;h?(M=2/3*this.context.viewport.zoom-S-2.25,O=2.2):(M=this.context.viewport.zoom-S,O=2),T=T*Math.pow(O,M),typeof l=="function"&&l(T);let D=h?Bb:Ob,p=d;return new D(p,this.getSubLayerProps({id:"heatmap",data:t,getFillColor:0,getElevation:r,elevationScale:T,colorDomain:n,radiusPixels:o,intensity:i,_subLayerProps:x,refinementStrategy:"no-overlap",colorTexture:this.state.colorTexture,extruded:!1,stroked:!1,updateTriggers:{getElevation:s.getWeight},onViewportLoad:m=>{this.setState({isLoaded:!0}),typeof f=="function"&&f(m)},onTileLoad:m=>{let b=-1/0;if(typeof r!="function")b=r;else if(m.content)for(let y of m.content)b=Math.max(r(y,{}),b);m.userData={maxWeight:b},this.state.tiles.add(m),typeof c=="function"&&c(m)},onTileUnload:m=>{this.state.tiles.delete(m),typeof u=="function"&&u(m)},transitions:{elevationScale:{type:"spring",stiffness:.3,damping:.5}}}))}_updateColorTexture(t){let{colorRange:r}=t.props,{colorTexture:n}=this.state,i=Lb(r);n?.destroy(),n=this.context.device.createTexture({...Mb,data:i,width:r.length,height:1}),this.setState({colorTexture:n})}};Vn.layerName="HeatmapTileLayer";Vn.defaultProps=Db;var $n=Vn;var vo=q(Ee(),1),jn=q(kt(),1),[Cd,Ad,Pd,Fd]=[0,1,2,3],yo=class extends jn._TextBackgroundLayer{getShaders(){let t=super.getShaders(),r=t.vs;return r=r.replaceAll("textBackground.padding.","_padding."),r=r.replace("void main(void) {",`void main(void) {
110
- vec4 _padding = textBackground.padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);`),{...t,vs:r}}};yo.layerName="EnhancedTextBackgroundLayer";var xo=class extends jn.TextLayer{filterSubLayer({layer:t,renderPass:r}){let n=t.id.includes("primary-background");return r==="collision"?n:!n}};xo.layerName="EnhancedTextLayer";var Nb={...jn.TextLayer.defaultProps,getRadius:{type:"accessor",value:1},radiusScale:{type:"number",min:0,value:1}},Hn=class extends vo.CompositeLayer{calculatePixelOffset(t){let{getTextAnchor:r,getAlignmentBaseline:n,getRadius:i,getSecondaryText:o,radiusScale:a,secondarySizeScale:s,sizeScale:l}=this.props,f=r==="middle"?0:r==="start"?1:-1,c=n==="center"?0:n==="bottom"?1:-1,u=l/4,d=l*(1+1/4),h=.6*(1-c)*l,g=t?h:0;r==="middle"&&n==="top"&&o&&(g-=h,g-=s,g+=l);let x=1+1/4;return typeof i=="function"?(S,T)=>{let w=(T?i(S,T):1)*a*x;return[f*(w+u),c*(w+d)+g]}:[f*(i*a*x+u),c*(i*a*x+d)+g]}calculateBackgroundPadding(){let{getTextAnchor:t,getAlignmentBaseline:r,sizeScale:n}=this.props,i=12*n,o=3*n,a=[0,0,0,0];return r==="top"?a[Ad]=o:r==="bottom"?a[Fd]=o:(a[Ad]=.5*o,a[Fd]=.5*o),t==="start"?a[Cd]=i:t==="end"?a[Pd]=i:(a[Cd]=.5*i,a[Pd]=.5*i),a}renderTextLayer(t,{updateTriggers:r={},...n}){let{data:i,characterSet:o,fontFamily:a,fontSettings:s,fontWeight:l,outlineColor:f,outlineWidth:c,sizeScale:u,radiusScale:d,getAlignmentBaseline:h,getColor:g,getPosition:x,getTextAnchor:S,updateTriggers:T}=this.props;if(u<2){let w=this.parent?.props?.textSizeScale?"textSizeScale":"sizeScale";vo.log.warn(`${w} has small value (${u}). Note getTextSize is not supported on PointLabelLayer`)()}return new xo(this.getSubLayerProps({id:t,data:i,characterSet:o,fontFamily:a,fontSettings:s,fontWeight:l,outlineColor:f,outlineWidth:c,sizeScale:u,getAlignmentBaseline:h,getColor:g,getPosition:x,getTextAnchor:S,updateTriggers:{...T,...r,getPixelOffset:[T.getRadius,T.getTextAnchor,T.getAlignmentBaseline,d,u]}}),{getSize:1,_subLayerProps:{background:{type:yo}}},n)}renderLayers(){let{getText:t,getSecondaryColor:r,getSecondaryText:n,secondaryOutlineColor:i,secondarySizeScale:o,updateTriggers:a}=this.props,s=this.calculatePixelOffset(!1),l=this.calculateBackgroundPadding();return[this.renderTextLayer(`${a.getText}-primary`,{backgroundPadding:l,getText:t,getPixelOffset:s,background:!0}),!!n&&this.renderTextLayer(`${a.getSecondaryText}-secondary`,{getText:n,getPixelOffset:this.calculatePixelOffset(!0),getAlignmentBaseline:"top",...r&&{getColor:r},...o&&{sizeScale:o},...i&&{outlineColor:i}})]}};Hn.layerName="PointLabelLayer";Hn.defaultProps=Nb;var Zn=Hn;var Bd=q(Ee(),1);var Md=q(Ee(),1),Bs=q(kt(),1);var kd=`#version 300 es
109
+ `},r.modules=[...r.modules,Rb],r}draw(t){let r=this.props.data[0];if(r){let n=this.props.elevationScale,{scheme:i}=this.parent.parent.parent.parent.parent.state,a={factor:(i==="h3"?Td(r.id):Sd(r.id))/n};for(let s of this.state.models)s.shaderInputs.setProps({density:a})}super.draw(t)}};go.layerName="RTTSolidPolygonLayer";var Bb=Un(sr,Rs),Ob=Un(ar,Rs),Db={data:Te,getWeight:{type:"accessor",value:1},onMaxDensityChange:{type:"function",optional:!0,value:null},colorDomain:{type:"array",value:[0,1]},colorRange:kb,intensity:{type:"number",value:1},radiusPixels:{type:"number",min:0,max:100,value:20}},Vn=class extends bo.CompositeLayer{initializeState(){this.state={isLoaded:!1,scheme:null,tiles:new Set,viewportChanged:!1}}shouldUpdateState({changeFlags:t}){let{viewportChanged:r}=t;return this.setState({viewportChanged:r}),t.somethingChanged}updateState(t){let{props:r,oldProps:n}=t;super.updateState(t),(0,bo._deepEqual)(r.colorRange,n.colorRange,2)||this._updateColorTexture(t);let i=r.data&&"scheme"in r.data?r.data.scheme:null;this.state.scheme!==i&&(this.setState({scheme:i}),this.state.tiles.clear())}renderLayers(){let{data:t,getWeight:r,colorDomain:n,intensity:i,radiusPixels:o,_subLayerProps:a,updateTriggers:s,onMaxDensityChange:f,onViewportLoad:l,onTileLoad:c,onTileUnload:u,...d}=this.props,h=this.state.scheme==="h3",g=h?"hexagon-cell-hifi":"cell",x={...a,[g]:{...a?.[g],_subLayerProps:{...a?.[g]?._subLayerProps,fill:{...a?.[g]?._subLayerProps?.fill,type:go}}}},S=0,T=0,w=[...this.state.tiles].filter(m=>m.content),k=w.filter(m=>m.isVisible),M=k.length?k:w;for(let m of M){let b=m.content[0],y=h?Td(b.id):Sd(b.id);T=Math.max(m.userData.maxWeight*y,T),S=Math.max(m.zoom,S)}let L,B;h?(L=2/3*this.context.viewport.zoom-S-2.25,B=2.2):(L=this.context.viewport.zoom-S,B=2),T=T*Math.pow(B,L),typeof f=="function"&&f(T);let D=h?Ob:Bb,p=d;return new D(p,this.getSubLayerProps({id:"heatmap",data:t,getFillColor:0,getElevation:r,elevationScale:T,colorDomain:n,radiusPixels:o,intensity:i,_subLayerProps:x,refinementStrategy:"no-overlap",colorTexture:this.state.colorTexture,extruded:!1,stroked:!1,updateTriggers:{getElevation:s.getWeight},onViewportLoad:m=>{this.setState({isLoaded:!0}),typeof l=="function"&&l(m)},onTileLoad:m=>{let b=-1/0;if(typeof r!="function")b=r;else if(m.content)for(let y of m.content)b=Math.max(r(y,{}),b);m.userData={maxWeight:b},this.state.tiles.add(m),typeof c=="function"&&c(m)},onTileUnload:m=>{this.state.tiles.delete(m),typeof u=="function"&&u(m)},transitions:{elevationScale:{type:"spring",stiffness:.3,damping:.5}}}))}_updateColorTexture(t){let{colorRange:r}=t.props,{colorTexture:n}=this.state,i=Mb(r);n?.destroy(),n=this.context.device.createTexture({...Lb,data:i,width:r.length,height:1}),this.setState({colorTexture:n})}};Vn.layerName="HeatmapTileLayer";Vn.defaultProps=Db;var $n=Vn;var vo=q(Ee(),1),jn=q(kt(),1),[Cd,Ad,Pd,Fd]=[0,1,2,3],yo=class extends jn._TextBackgroundLayer{getShaders(){let t=super.getShaders(),r=t.vs;return r=r.replaceAll("textBackground.padding.","_padding."),r=r.replace("void main(void) {",`void main(void) {
110
+ vec4 _padding = textBackground.padding + instancePixelOffsets.xyxy * vec4(1.0, 1.0, -1.0, -1.0);`),{...t,vs:r}}};yo.layerName="EnhancedTextBackgroundLayer";var xo=class extends jn.TextLayer{filterSubLayer({layer:t,renderPass:r}){let n=t.id.endsWith("-collision-background");return r==="collision"?n:!n}renderLayers(){let t=super.renderLayers(),r=t[0],n=t[1],{renderBackground:i,collisionBackgroundPadding:o}=this.props,a=r&&new yo(r.props,{id:`${this.id}-collision-background`,padding:o});return[!!i&&r,a,n]}};xo.layerName="EnhancedTextLayer";var Nb={...jn.TextLayer.defaultProps,getRadius:{type:"accessor",value:1},radiusScale:{type:"number",min:0,value:1}},Hn=class extends vo.CompositeLayer{calculatePixelOffset(t){let{getTextAnchor:r,getAlignmentBaseline:n,getRadius:i,getSecondaryText:o,radiusScale:a,secondarySizeScale:s,sizeScale:f}=this.props,l=r==="middle"?0:r==="start"?1:-1,c=n==="center"?0:n==="bottom"?1:-1,u=f/4,d=f*(1+1/4),h=.6*(1-c)*f,g=t?h:0;r==="middle"&&n==="top"&&o&&(g-=h,g-=s,g+=f);let x=1+1/4;return typeof i=="function"?(S,T)=>{let w=(T?i(S,T):1)*a*x;return[l*(w+u),c*(w+d)+g]}:[l*(i*a*x+u),c*(i*a*x+d)+g]}calculateBackgroundPadding(){let{getTextAnchor:t,getAlignmentBaseline:r,sizeScale:n}=this.props,i=12*n,o=3*n,a=[0,0,0,0];return r==="top"?a[Ad]=o:r==="bottom"?a[Fd]=o:(a[Ad]=.5*o,a[Fd]=.5*o),t==="start"?a[Cd]=i:t==="end"?a[Pd]=i:(a[Cd]=.5*i,a[Pd]=.5*i),a}renderTextLayer(t,{updateTriggers:r={},...n}){let{data:i,characterSet:o,fontFamily:a,fontSettings:s,fontWeight:f,outlineColor:l,outlineWidth:c,sizeScale:u,getBackgroundColor:d,getBorderColor:h,getBorderWidth:g,backgroundBorderRadius:x,backgroundPadding:S,radiusScale:T,getAlignmentBaseline:w,getColor:k,getPosition:M,getTextAnchor:L,updateTriggers:B}=this.props;if(u<2){let D=this.parent?.props?.textSizeScale?"textSizeScale":"sizeScale";vo.log.warn(`${D} has small value (${u}). Note getTextSize is not supported on PointLabelLayer`)()}return new xo(this.getSubLayerProps({id:t,data:i,characterSet:o,fontFamily:a,fontSettings:s,fontWeight:f,outlineColor:l,outlineWidth:c,sizeScale:u,getBackgroundColor:d,getBorderColor:h,getBorderWidth:g,backgroundBorderRadius:x,backgroundPadding:S,getAlignmentBaseline:w,getColor:k,getPosition:M,getTextAnchor:L,updateTriggers:{...B,...r,getPixelOffset:[B.getRadius,B.getTextAnchor,B.getAlignmentBaseline,T,u]}}),{getSize:1},n)}renderLayers(){let{background:t,getText:r,getSecondaryColor:n,getSecondaryText:i,secondaryOutlineColor:o,secondarySizeScale:a,updateTriggers:s}=this.props,f=this.calculatePixelOffset(!1),l=this.calculateBackgroundPadding();return[this.renderTextLayer(`${s.getText}-primary`,{background:!0,renderBackground:t,getText:r,getPixelOffset:f,collisionBackgroundPadding:l}),!!i&&this.renderTextLayer(`${s.getSecondaryText}-secondary`,{getText:i,getPixelOffset:this.calculatePixelOffset(!0),getAlignmentBaseline:"top",...n&&{getColor:n},...a&&{sizeScale:a},...o&&{outlineColor:o}})]}};Hn.layerName="PointLabelLayer";Hn.defaultProps=Nb;var Zn=Hn;var Od=q(Ee(),1);var Ld=q(Ee(),1),Os=q(kt(),1);var kd=`#version 300 es
111
111
  #define SHADER_NAME raster-layer-vertex-shader
112
112
  in vec3 positions;
113
113
  in vec3 normals;
@@ -165,11 +165,11 @@ vColor = vec4(color.rgb, color.a * layer.opacity);
165
165
  }
166
166
  DECKGL_FILTER_COLOR(vColor, geometry);
167
167
  }
168
- `;var zb={...Bs.ColumnLayer.defaultProps,extruded:!1,diskResolution:4,vertices:[[-.5,-.5],[.5,-.5],[.5,.5],[-.5,.5]]},wo=class extends ho(Bs.ColumnLayer){getShaders(){let t=super.getShaders(),r=this.props.data,n=r.data.blockSize??Math.sqrt(r.length);return{...t,defines:{...t.defines,BLOCK_WIDTH:n},vs:kd}}initializeState(){this.getAttributeManager().addInstanced({instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:[255,255,255,255]}})}};wo.layerName="RasterColumnLayer";function Ub(e,t){return e.data===t.data&&e.length===t.length}var Wn=class extends Md.CompositeLayer{renderLayers(){let{data:t,getElevation:r,getFillColor:n,getLineColor:i,getLineWidth:o,tileIndex:a,updateTriggers:s}=this.props;if(!t||!a||t.length===0)return null;let l=t.blockSize??0,[f,c,u]=qa(a),d=[f,c],h=u/l,g=this.getSubLayerClass("column",wo),{highlightedObjectIndex:x,highlightColor:S}=this.state;return new g(this.props,this.getSubLayerProps({id:"cell",updateTriggers:s,getElevation:this.getSubLayerAccessor(r),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(i),getLineWidth:this.getSubLayerAccessor(o)}),{data:{data:t,length:l*l},dataComparator:Ub,offset:d,lineWidthScale:h,highlightedObjectIndex:x,highlightColor:S})}getSubLayerAccessor(t){return typeof t!="function"?super.getSubLayerAccessor(t):(r,n)=>{let{data:i,index:o}=n,a=i.data,s=Hl(a.cells,o);return t({properties:s},n)}}getPickingInfo(t){let r=super.getPickingInfo(t);return r.index!==-1&&(r.object=this.getSubLayerAccessor(n=>n)(void 0,{data:this.props,index:r.index})),r}_updateAutoHighlight(t){let{highlightedObjectIndex:r}=this.state,n=-1;if(t.index!==-1&&(n=t.index),r!==n){let{highlightColor:i}=this.props;typeof i=="function"&&(i=i(t)),this.setState({highlightColor:i,highlightedObjectIndex:n})}}};Wn.layerName="RasterLayer";Wn.defaultProps=zb;var _o=Wn;var Dd=q(dt(),1);var Nd=q(ln(),1);var qb={uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:BigUint64Array,int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:BigInt64Array,float32:Float32Array,float64:Float64Array},Ds=class e{static read(t,r){return t.readFields(e._readField,{name:"",type:"",data:null},r)}static _readField(t,r,n){if(t===1)r.name=n.readString();else if(t===2)r.type=n.readString();else if(t===3){let i=qb[r.type];if(!i)throw Error(`Invalid data type: ${r.type}`);r.data={};let{compression:o}=Gr;or(i,n,r.data,{compression:o})}}},Gr=class e{static read(t,r){return t.readFields(e._readField,{blockSize:0,bands:[]},r)}static _readField(t,r,n){t===1?r.blockSize=n.readVarint():t===2&&r.bands.push(Ds.read(n,n.readVarint()+n.pos))}};var Id="9.4.0-beta.4",Rd="cartoRasterTile",Gb={cartoRasterTile:{metadata:null,workerUrl:Mt(Rd,Id)}},Vb={name:"CARTO Raster Tile",version:Id,id:Rd,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-raster-tile"],category:"geometry",parse:async(e,t)=>Ld(e,t),parseSync:Ld,worker:!0,options:Gb};function Ld(e,t){let r=t?.cartoRasterTile?.metadata;if(!e||!r)return null;Gr.compression=r.compression;let n=Ut(e,Gr),{bands:i,blockSize:o}=n,a={};for(let s=0;s<i.length;s++){let{name:l,data:f}=i[s];a[l]=f}return{blockSize:o,cells:{numericProps:a,properties:[]}}}var Od=Vb;(0,Nd.registerLoaders)([Od]);var $b=e=>{let t=e.tile?.index?.q;return t?new _o(e,{tileIndex:t}):null},Hb={data:Te,refinementStrategy:"no-overlap",tileSize:512},Eo=class extends Un(Dd.TileLayer,vd){filterSubLayer(t){let{tile:r}=t.layer.props;return r?super.filterSubLayer(t):!0}};Eo.layerName="PostProcessTileLayer";var Yn=class extends Bd.CompositeLayer{getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r,minzoom:n,maxzoom:i,raster_metadata:o}=t,a=this.getSubLayerClass("tile",Eo),s=this.getLoadOptions();return new a(this.props,{id:`raster-tile-layer-${this.props.id}`,data:r,TilesetClass:Qe,renderSubLayers:$b,minZoom:n,maxZoom:i,loadOptions:{...s,cartoRasterTile:{...s?.cartoRasterTile,metadata:o}}})}};Yn.layerName="RasterTileLayer";Yn.defaultProps=Hb;var Kn=Yn;var ah=q(ln(),1);var So=class e{static read(t,r){return t.readFields(e._readField,{properties:[],numericProps:{}},r)}static _readField(t,r,n){if(t===1)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===2){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}}};var Ud="9.4.0-beta.4",qd="cartoPropertiesTile",jb={cartoPropertiesTile:{workerUrl:Mt(qd,Ud)}},Zb={name:"CARTO Properties Tile",version:Ud,id:qd,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-properties-tile"],category:"geometry",worker:!0,parse:async(e,t)=>zd(e,t),parseSync:zd,options:jb};function zd(e,t){return e?Ut(e,So):null}var Gd=Zb;var Yd=q(Zd(),1);var Kd="9.4.0-beta.4",Xd="cartoVectorTile",ly={cartoVectorTile:{workerUrl:Mt(Xd,Kd)}},cy={name:"CARTO Vector Tile",version:Kd,id:Xd,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-vector-tile"],category:"geometry",parse:async(e,t)=>Wd(e,t),parseSync:Wd,worker:!0,options:ly};function uy(e,t,{startPosition:r,endPosition:n,indices:i}){let o=e.positions.size,a=r*o,s=n*o,l=e.positions.value.subarray(a,s),f=i.slice(1).map(u=>u-r),c=(0,Yd.default)(l,f,o);for(let u=0,d=c.length;u<d;++u)t.push(r+c[u])}function dy(e){let{polygonIndices:t,primitivePolygonIndices:r}=e,n=[],i=0;for(let o=0;o<t.value.length-1;o++){let a=t.value[o],s=t.value[o+1],l=r.value.indexOf(s),f=r.value.subarray(i,l);i=l,uy(e,n,{startPosition:a,endPosition:s,indices:f})}e.triangles={value:new Uint32Array(n),size:1}}function Wd(e,t){if(!e)return null;let r=Ut(e,io);return r.polygons&&!r.polygons.triangles&&dy(r.polygons),r}var Qd=cy;var Fo=q(eh(),1),$r=q(dt(),1),sh=q(kt(),1);var th="_carto_bbox";function hy(e){if(typeof e!="string")return null;let t=e.split(",");return t.length!==4?null:t.map(Number)}function Gs(e){return Math.log(Math.tan(Math.PI/4+e*Math.PI/360))}function py(e,t,r){let n=(e[0]-t.west)/(t.east-t.west),i=r.west+n*(r.east-r.west),o=Gs(e[1]),a=Gs(t.north),s=Gs(t.south),l=(a-o)/(a-s),f=r.south+l*(r.north-r.south);return[i,f]}function nh(e,t){let r=t?t in e.numericProps:!1,n=new Map;for(let c=0;c<e.pathIndices.value.length-1;c++){let u=e.pathIndices.value[c],d=e.featureIds.value[u],h;t===void 0?h=d:r?h=e.numericProps[t].value[u]:e.properties[d]&&t in e.properties[d]?h=e.properties[d][t]:h=void 0;let g=xy(e,c);(!n.has(h)||g>n.get(h).length)&&n.set(h,{index:c,length:g})}let i=[],o=[],a=[],s=[],l=za(n.size,e.numericProps),f=0;for(let[c,{index:u}]of n){let d=vy(e,u);i.push(...d);let h=e.pathIndices.value[u],g=e.featureIds.value[h];a.push(f),o.push(e.properties[g]),s.push(e.globalFeatureIds.value[h]),Ua(e.numericProps,l,h,f),f++}return hn(i,a,s,l,o)}function ih(e,t,r,n){let i=!!(n&&e.properties.length>0&&th in e.properties[0]),o=i?n:t,{west:a,south:s,east:l,north:f}=o,u=(l-a)*(f-s)*1e-4,d=[],h=[],g=[],x=[],S=za(e.polygonIndices.value.length-1,e.numericProps),T=i&&n!==t,w=0,k=0,{extruded:L}=r;for(let M=0;M<e.polygonIndices.value.length-1;M++){let O=e.polygonIndices.value[M],D=e.polygonIndices.value[M+1],p=null,m=null;if(i){let b=e.featureIds.value[O],y=hy(e.properties[b][th]);if(y){let[v,E,F,_]=y;if((F-v)*(_-E)>=u){let P=[(v+F)/2,(E+_)/2];rh(P,n)&&(m=T?py(P,n,t):P)}}}else{if(gy(e,M)<u)continue;m=by(e,M)}if(m){let b=-1,y=[0,0],v=!1;for(;k<e.triangles.value.length;){let F=e.triangles.value[k];if(F>=D)break;if(v){k+=3;continue}let _=e.triangles.value[k+1],C=e.triangles.value[k+2],P=e.positions.value.subarray(F*e.positions.size,F*e.positions.size+e.positions.size),A=e.positions.value.subarray(_*e.positions.size,_*e.positions.size+e.positions.size),I=e.positions.value.subarray(C*e.positions.size,C*e.positions.size+e.positions.size);if(my(m,P,A,I))v=!0;else{let N=oh(P,A,I);N>b&&(b=N,y=[(P[0]+A[0]+I[0])/3,(P[1]+A[1]+I[1])/3])}k+=3}let E=v?m:y;rh(E,t)&&(p=E)}if(p){d.push(...p);let b=e.featureIds.value[O];if(L){let y=r.getElevation(void 0,{data:e,index:b});d.push(y*r.elevationScale)}h.push(e.properties[b]),g.push(w),x.push(e.globalFeatureIds.value[O]),Ua(e.numericProps,S,O,w),w++}}return e.numericProps&&Object.keys(S).forEach(M=>{S[M].value=S[M].value.slice(0,w)}),hn(d,g,x,S,h,L?3:2)}function gy(e,t){let{positions:{value:r,size:n},polygonIndices:{value:i},triangles:{value:o}}=e,a=i[t],s=i[t+1],l=0,f=0;for(;f<o.length&&!(o[f]>=a);)f+=3;for(;f<o.length;){let c=o[f];if(c>=s)break;let u=o[f+1],d=o[f+2],h=r.subarray(c*n,c*n+n),g=r.subarray(u*n,u*n+n),x=r.subarray(d*n,d*n+n);l+=oh(h,g,x),f+=3}return l}function rh([e,t],{west:r,east:n,south:i,north:o}){return e>=r&&e<n&&t>=i&&t<o}function my(e,t,r,n){let i=Math.abs((r[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(r[1]-t[1]))/2,o=Math.abs((t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1]))/2,a=Math.abs((r[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(r[1]-e[1]))/2,s=Math.abs((n[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(n[1]-e[1]))/2;return Math.abs(i-(o+a+s))<1e-10}function oh([e,t],[r,n],[i,o]){return Math.abs((e*(n-o)+r*(o-t)+i*(t-n))/2)}function by(e,t){let{positions:{value:r,size:n}}=e,i=n*e.polygonIndices.value[t],o=n*e.polygonIndices.value[t+1],a=1/0,s=1/0,l=-1/0,f=-1/0;for(let c=i;c<o;c+=n){let[u,d]=r.subarray(c,c+2);a=Math.min(a,u),s=Math.min(s,d),l=Math.max(l,u),f=Math.max(f,d)}return[(a+l)/2,(s+f)/2]}function yy(e,t){let{positions:{value:r}}=e,[n,i,o,a]=r.subarray(t,t+4);return Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2))}function xy(e,t){let{positions:{size:r}}=e,n=r*e.pathIndices.value[t],i=r*e.pathIndices.value[t+1],o=0;for(let a=n;a<i;a+=r)o+=yy(e,a);return o}function vy(e,t){let{positions:{value:r},pathIndices:{value:n}}=e,i=n[t]*2,a=(n[t+1]*2-i)/2;if(a===2){let[l,f,c,u]=r.subarray(i,i+4);return[(l+c)/2,(f+u)/2]}let s=i+Math.floor(a/2)*2;return[r[s],r[s+1]]}(0,ah.registerLoaders)([Gd,Qd]);var wy={west:0,east:1,south:0,north:1},_y={...$r.MVTLayer.defaultProps,autoLabels:!1,data:Te,dataComparator:Te.equal,tileSize:512},ei=class extends $r.MVTLayer{constructor(...t){super(...t)}initializeState(){super.initializeState(),this.setState({binary:!0})}updateState(t){let{props:r}=t;if(r.data){super.updateState(t);let i=new URL(r.data.tiles[0]).searchParams.get("formatTiles")==="mvt";this.setState({mvt:i})}}getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},gis:{format:"binary"}})}async getTileData(t){let r=this.props.data,{tiles:n,properties_tiles:i}=r,o=(0,$r._getURLFromTemplate)(n,t);if(!o)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:s}=this.props,{signal:l}=t,f=s(o,{propName:"data",layer:this,loadOptions:a,signal:l});if(!i)return await f;let c=(0,$r._getURLFromTemplate)(i,t);if(!c)return Promise.reject("Invalid properties URL");let u=s(c,{propName:"data",layer:this,loadOptions:a,signal:l}),[d,h]=await Promise.all([f,u]);return d?h?ud(d,h):d:null}renderSubLayers(t){if(t.data===null)return null;let r=t.tile.bbox,n=[],i={"points-text":{type:Zn,...t?._subLayerProps?.["points-text"],extensions:[new Fo.CollisionFilterExtension,...t.extensions||[],...t?._subLayerProps?.["points-text"]?.extensions||[]]}};if(this.state.mvt){let o={...t,_subLayerProps:{...t._subLayerProps,...i}};n.push(super.renderSubLayers(o))}else{let{west:o,south:a,east:s,north:l}=r,f=[new Fo.ClipExtension,...t.extensions||[]],c={clipBounds:[o,a,s,l]},u=h=>({[h]:{...c,...t?._subLayerProps?.[h],extensions:[...f,...t?._subLayerProps?.[h]?.extensions||[]]}}),d={...t,data:{...t.data,tileBbox:r},autoHighlight:!1,_subLayerProps:{...t._subLayerProps,...i,...u("polygons-fill"),...u("polygons-stroke"),...u("linestrings")}};n.push(new sh.GeoJsonLayer(d))}if(n[0]&&t.autoLabels){let o=Di();t.data.lines&&t.data.lines.positions.value.length>0&&(o.points=nh(t.data.lines,typeof t.autoLabels=="object"?t.autoLabels.uniqueIdProperty:void 0)),t.data.polygons&&t.data.polygons.positions.value.length>0&&(o.points=ih(t.data.polygons,this.state.mvt?wy:r,t,r)),n.push(n[0].clone({id:`${t.id}-labels`,data:o,pickable:!1,autoHighlight:!1}))}return n}renderLayers(){let t=super.renderLayers();if(!this.props.autoLabels)return t;let r=(t||[]).flat().filter(Boolean);return r.sort((n,i)=>{let o=n.id.includes("labels"),a=i.id.includes("labels");return o&&!a?1:!o&&a?-1:0}),r.map(n=>n.id.includes("labels")?n.clone({highlightedObjectIndex:-1}):n)}_isWGS84(){return this.state.mvt?super._isWGS84():!0}};ei.layerName="VectorTileLayer";ei.defaultProps=_y;var Hr=ei;var Nf=q(Yt(),1);var xp=q(Yt(),1);var Vs=class{add(t,r,n){if(typeof arguments[0]!="string")for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],r&&this[i][n?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}},$s=class{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(r=>{if(typeof r!="object"||!r.name||!r.init)throw new Error("Invalid JSEP plugin format");this.registered[r.name]||(r.init(this.jsep),this.registered[r.name]=r)})}},be=class e{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+e.version}static addUnaryOp(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}static addBinaryOp(t,r,n){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=r,n?e.right_associative.add(t):e.right_associative.delete(t),e}static addIdentifierChar(t){return e.additional_identifier_chars.add(t),e}static addLiteral(t,r){return e.literals[t]=r,e}static removeUnaryOp(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}static removeAllUnaryOps(){return e.unary_ops={},e.max_unop_len=0,e}static removeIdentifierChar(t){return e.additional_identifier_chars.delete(t),e}static removeBinaryOp(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}static removeAllBinaryOps(){return e.binary_ops={},e.max_binop_len=0,e}static removeLiteral(t){return delete e.literals[t],e}static removeAllLiterals(){return e.literals={},e}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new e(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(r=>r.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return e.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}throwError(t){let r=new Error(t+" at character "+this.index);throw r.index=this.index,r.description=t,r}runHook(t,r){if(e.hooks[t]){let n={context:this,node:r};return e.hooks.run(t,n),n.node}return r}searchHook(t){if(e.hooks[t]){let r={context:this};return e.hooks[t].find(function(n){return n.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let t=this.code;for(;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let t=this.gobbleExpressions(),r=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook("after-all",r)}gobbleExpressions(t){let r=[],n,i;for(;this.index<this.expr.length;)if(n=this.code,n===e.SEMCOL_CODE||n===e.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())r.push(i);else if(this.index<this.expr.length){if(n===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){let t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,e.max_binop_len),r=t.length;for(;r>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=r,t;t=t.substr(0,--r)}return!1}gobbleBinaryExpression(){let t,r,n,i,o,a,s,l,f;if(a=this.gobbleToken(),!a||(r=this.gobbleBinaryOp(),!r))return a;for(o={value:r,prec:e.binaryPrecedence(r),right_a:e.right_associative.has(r)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+r),i=[a,o,s];r=this.gobbleBinaryOp();){if(n=e.binaryPrecedence(r),n===0){this.index-=r.length;break}o={value:r,prec:n,right_a:e.right_associative.has(r)},f=r;let c=u=>o.right_a&&u.right_a?n>u.prec:n<=u.prec;for(;i.length>2&&c(i[i.length-2]);)s=i.pop(),r=i.pop().value,a=i.pop(),t={type:e.BINARY_EXP,operator:r,left:a,right:s},i.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+f),i.push(o,t)}for(l=i.length-1,t=i[l];l>1;)t={type:e.BINARY_EXP,operator:i[l-1].value,left:i[l-2],right:t},l-=2;return t}gobbleToken(){let t,r,n,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)i=this.gobbleArray();else{for(r=this.expr.substr(this.index,e.max_unop_len),n=r.length;n>0;){if(e.unary_ops.hasOwnProperty(r)&&(!e.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=n;let o=this.gobbleToken();return o||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:e.UNARY_EXP,operator:r,argument:o,prefix:!0})}r=r.substr(0,--n)}e.isIdentifierStart(t)?(i=this.gobbleIdentifier(),e.literals.hasOwnProperty(i.name)?i={type:e.LITERAL,value:e.literals[i.name],raw:i.name}:i.name===e.this_str&&(i={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let r=this.code;for(;r===e.PERIOD_CODE||r===e.OBRACK_CODE||r===e.OPAREN_CODE||r===e.QUMARK_CODE;){let n;if(r===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==e.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(r===e.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),r=this.code}return t}gobbleNumericLiteral(){let t="",r,n;for(;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(r=this.char,r==="e"||r==="E"){for(t+=this.expr.charAt(this.index++),r=this.char,(r==="+"||r==="-")&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return n=this.code,e.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(n===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:e.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="",r=this.index,n=this.expr.charAt(this.index++),i=!1;for(;this.index<this.expr.length;){let o=this.expr.charAt(this.index++);if(o===n){i=!0;break}else if(o==="\\")switch(o=this.expr.charAt(this.index++),o){case"n":t+=`
169
- `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=o}else t+=o}return i||this.throwError('Unclosed quote after "'+t+'"'),{type:e.LITERAL,value:t,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let t=this.code,r=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(t){let r=[],n=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===t){n=!0,this.index++,t===e.CPAREN_CODE&&i&&i>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===e.COMMA_CODE){if(this.index++,i++,i!==r.length){if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(let a=r.length;a<i;a++)r.push(null)}}else if(r.length!==i&&i!==0)this.throwError("Expected comma");else{let a=this.gobbleExpression();(!a||a.type===e.COMPOUND)&&this.throwError("Expected comma"),r.push(a)}}return n||this.throwError("Expected "+String.fromCharCode(t)),r}gobbleGroup(){this.index++;let t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}},Ey=new Vs;Object.assign(be,{hooks:Ey,plugins:new $s(be),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});be.max_unop_len=be.getMaxKeyLen(be.unary_ops);be.max_binop_len=be.getMaxKeyLen(be.binary_ops);var jr=e=>new be(e).parse(),Sy=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(be).filter(e=>!Sy.includes(e)&&jr[e]===void 0).forEach(e=>{jr[e]=be[e]});jr.Jsep=be;var Ty="ConditionalExpression",Cy={name:"ternary",init(e){e.hooks.add("after-expression",function(r){if(r.node&&this.code===e.QUMARK_CODE){this.index++;let n=r.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),r.node={type:Ty,test:n,consequent:i,alternate:o},n.operator&&e.binary_ops[n.operator]<=.9){let a=n;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;r.node.test=a.right,a.right=r.node,r.node=n}}else this.throwError("Expected :")}})}};jr.plugins.register(Cy);function ot(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hs(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ko(e){let t,r,n;e.length!==2?(t=ot,r=(s,l)=>ot(e(s),l),n=(s,l)=>e(s)-l):(t=e===ot||e===Hs?e:Ay,r=e,n=e);function i(s,l,f=0,c=s.length){if(f<c){if(t(l,l)!==0)return c;do{let u=f+c>>>1;r(s[u],l)<0?f=u+1:c=u}while(f<c)}return f}function o(s,l,f=0,c=s.length){if(f<c){if(t(l,l)!==0)return c;do{let u=f+c>>>1;r(s[u],l)<=0?f=u+1:c=u}while(f<c)}return f}function a(s,l,f=0,c=s.length){let u=i(s,l,f,c-1);return u>f&&n(s[u-1],l)>-n(s[u],l)?u-1:u}return{left:i,center:a,right:o}}function Ay(){return 0}function ti(e){return e===null?NaN:+e}var fh=ko(ot),lh=fh.right,Py=fh.left,Fy=ko(ti).center,_t=lh;var Zr=class extends Map{constructor(t,r=Ly){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(ch(this,t))}has(t){return super.has(ch(this,t))}set(t,r){return super.set(ky(this,t),r)}delete(t){return super.delete(My(this,t))}};function ch({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function ky({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function My({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function Ly(e){return e!==null&&typeof e=="object"?e.valueOf():e}var Iy=Math.sqrt(50),Ry=Math.sqrt(10),Oy=Math.sqrt(2);function Mo(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),a=o>=Iy?10:o>=Ry?5:o>=Oy?2:1,s,l,f;return i<0?(f=Math.pow(10,-i)/a,s=Math.round(e*f),l=Math.round(t*f),s/f<e&&++s,l/f>t&&--l,f=-f):(f=Math.pow(10,i)*a,s=Math.round(e/f),l=Math.round(t/f),s*f<e&&++s,l*f>t&&--l),l<s&&.5<=r&&r<2?Mo(e,t,r*2):[s,l,f]}function lr(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[i,o,a]=n?Mo(t,e,r):Mo(e,t,r);if(!(o>=i))return[];let s=o-i+1,l=new Array(s);if(n)if(a<0)for(let f=0;f<s;++f)l[f]=(o-f)/-a;else for(let f=0;f<s;++f)l[f]=(o-f)*a;else if(a<0)for(let f=0;f<s;++f)l[f]=(i+f)/-a;else for(let f=0;f<s;++f)l[f]=(i+f)*a;return l}function ri(e,t,r){return t=+t,e=+e,r=+r,Mo(e,t,r)[2]}function js(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?ri(t,e,r):ri(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function Zs(e,t,r=ti){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),a=+r(e[o],o,e),s=+r(e[o+1],o+1,e);return a+(s-a)*(i-o)}}function Lo(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n<i;)o[n]=e+n*r;return o}function ce(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var Ws=Symbol("implicit");function cr(){var e=new Zr,t=[],r=[],n=Ws;function i(o){let a=e.get(o);if(a===void 0){if(n!==Ws)return n;e.set(o,a=t.push(o)-1)}return r[a%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Zr;for(let a of o)e.has(a)||e.set(a,t.push(a)-1);return i},i.range=function(o){return arguments.length?(r=Array.from(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return cr(t,r).unknown(n)},ce.apply(i,arguments),i}function Io(){var e=cr().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,o,a,s=!1,l=0,f=0,c=.5;delete e.unknown;function u(){var d=t().length,h=i<n,g=h?i:n,x=h?n:i;o=(x-g)/Math.max(1,d-l+f*2),s&&(o=Math.floor(o)),g+=(x-g-o*(d-l))*c,a=o*(1-l),s&&(g=Math.round(g),a=Math.round(a));var S=Lo(d).map(function(T){return g+o*T});return r(h?S.reverse():S)}return e.domain=function(d){return arguments.length?(t(d),u()):t()},e.range=function(d){return arguments.length?([n,i]=d,n=+n,i=+i,u()):[n,i]},e.rangeRound=function(d){return[n,i]=d,n=+n,i=+i,s=!0,u()},e.bandwidth=function(){return a},e.step=function(){return o},e.round=function(d){return arguments.length?(s=!!d,u()):s},e.padding=function(d){return arguments.length?(l=Math.min(1,f=+d),u()):l},e.paddingInner=function(d){return arguments.length?(l=Math.min(1,d),u()):l},e.paddingOuter=function(d){return arguments.length?(f=+d,u()):f},e.align=function(d){return arguments.length?(c=Math.max(0,Math.min(1,d)),u()):c},e.copy=function(){return Io(t(),[n,i]).round(s).paddingInner(l).paddingOuter(f).align(c)},ce.apply(u(),arguments)}function uh(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return uh(t())},e}function Ys(){return uh(Io.apply(null,arguments).paddingInner(1))}function Ro(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Ks(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function oi(){}var ni=.7,Do=1/ni,Wr="\\s*([+-]?\\d+)\\s*",ii="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",By=/^#([0-9a-f]{3,8})$/,Dy=new RegExp(`^rgb\\(${Wr},${Wr},${Wr}\\)$`),Ny=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),zy=new RegExp(`^rgba\\(${Wr},${Wr},${Wr},${ii}\\)$`),Uy=new RegExp(`^rgba\\(${at},${at},${at},${ii}\\)$`),qy=new RegExp(`^hsl\\(${ii},${at},${at}\\)$`),Gy=new RegExp(`^hsla\\(${ii},${at},${at},${ii}\\)$`),dh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ro(oi,qt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:hh,formatHex:hh,formatHex8:Vy,formatHsl:$y,formatRgb:ph,toString:ph});function hh(){return this.rgb().formatHex()}function Vy(){return this.rgb().formatHex8()}function $y(){return vh(this).formatHsl()}function ph(){return this.rgb().formatRgb()}function qt(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=By.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?gh(t):r===3?new ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Oo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Oo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Dy.exec(e))?new ye(t[1],t[2],t[3],1):(t=Ny.exec(e))?new ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=zy.exec(e))?Oo(t[1],t[2],t[3],t[4]):(t=Uy.exec(e))?Oo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=qy.exec(e))?yh(t[1],t[2]/100,t[3]/100,1):(t=Gy.exec(e))?yh(t[1],t[2]/100,t[3]/100,t[4]):dh.hasOwnProperty(e)?gh(dh[e]):e==="transparent"?new ye(NaN,NaN,NaN,0):null}function gh(e){return new ye(e>>16&255,e>>8&255,e&255,1)}function Oo(e,t,r,n){return n<=0&&(e=t=r=NaN),new ye(e,t,r,n)}function Hy(e){return e instanceof oi||(e=qt(e)),e?(e=e.rgb(),new ye(e.r,e.g,e.b,e.opacity)):new ye}function Yr(e,t,r,n){return arguments.length===1?Hy(e):new ye(e,t,r,n??1)}function ye(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ro(ye,Yr,Ks(oi,{brighter(e){return e=e==null?Do:Math.pow(Do,e),new ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ni:Math.pow(ni,e),new ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ye(dr(this.r),dr(this.g),dr(this.b),No(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mh,formatHex:mh,formatHex8:jy,formatRgb:bh,toString:bh}));function mh(){return`#${ur(this.r)}${ur(this.g)}${ur(this.b)}`}function jy(){return`#${ur(this.r)}${ur(this.g)}${ur(this.b)}${ur((isNaN(this.opacity)?1:this.opacity)*255)}`}function bh(){let e=No(this.opacity);return`${e===1?"rgb(":"rgba("}${dr(this.r)}, ${dr(this.g)}, ${dr(this.b)}${e===1?")":`, ${e})`}`}function No(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ur(e){return e=dr(e),(e<16?"0":"")+e.toString(16)}function yh(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new $e(e,t,r,n)}function vh(e){if(e instanceof $e)return new $e(e.h,e.s,e.l,e.opacity);if(e instanceof oi||(e=qt(e)),!e)return new $e;if(e instanceof $e)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(r-n)/s+(r<n)*6:r===o?a=(n-t)/s+2:a=(t-r)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new $e(a,s,l,e.opacity)}function wh(e,t,r,n){return arguments.length===1?vh(e):new $e(e,t,r,n??1)}function $e(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ro($e,wh,Ks(oi,{brighter(e){return e=e==null?Do:Math.pow(Do,e),new $e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ni:Math.pow(ni,e),new $e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ye(Xs(e>=240?e-240:e+120,i,n),Xs(e,i,n),Xs(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new $e(xh(this.h),Bo(this.s),Bo(this.l),No(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=No(this.opacity);return`${e===1?"hsl(":"hsla("}${xh(this.h)}, ${Bo(this.s)*100}%, ${Bo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xh(e){return e=(e||0)%360,e<0?e+360:e}function Bo(e){return Math.max(0,Math.min(1,e||0))}function Xs(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}function Qs(e,t,r,n,i){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*r+(1+3*e+3*o-3*a)*n+a*i)/6}function _h(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],a=n>0?e[n-1]:2*i-o,s=n<t-1?e[n+2]:2*o-i;return Qs((r-n/t)*t,a,i,o,s)}}function Eh(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],o=e[n%t],a=e[(n+1)%t],s=e[(n+2)%t];return Qs((r-n/t)*t,i,o,a,s)}}var ai=e=>()=>e;function Zy(e,t){return function(r){return e+r*t}}function Wy(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Sh(e){return(e=+e)==1?zo:function(t,r){return r-t?Wy(t,r,e):ai(isNaN(t)?r:t)}}function zo(e,t){var r=t-e;return r?Zy(e,r):ai(isNaN(e)?t:e)}var Js=(function e(t){var r=Sh(t);function n(i,o){var a=r((i=Yr(i)).r,(o=Yr(o)).r),s=r(i.g,o.g),l=r(i.b,o.b),f=zo(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=l(c),i.opacity=f(c),i+""}}return n.gamma=e,n})(1);function Th(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),a,s;for(a=0;a<r;++a)s=Yr(t[a]),n[a]=s.r||0,i[a]=s.g||0,o[a]=s.b||0;return n=e(n),i=e(i),o=e(o),s.opacity=1,function(l){return s.r=n(l),s.g=i(l),s.b=o(l),s+""}}}var d9=Th(_h),h9=Th(Eh);function Ch(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function Ah(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ph(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),a;for(a=0;a<n;++a)i[a]=hr(e[a],t[a]);for(;a<r;++a)o[a]=t[a];return function(s){for(a=0;a<n;++a)o[a]=i[a](s);return o}}function Fh(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Gt(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function kh(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=hr(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var tf=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,ef=new RegExp(tf.source,"g");function Yy(e){return function(){return e}}function Ky(e){return function(t){return e(t)+""}}function Mh(e,t){var r=tf.lastIndex=ef.lastIndex=0,n,i,o,a=-1,s=[],l=[];for(e=e+"",t=t+"";(n=tf.exec(e))&&(i=ef.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),s[a]?s[a]+=o:s[++a]=o),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,l.push({i:a,x:Gt(n,i)})),r=ef.lastIndex;return r<t.length&&(o=t.slice(r),s[a]?s[a]+=o:s[++a]=o),s.length<2?l[0]?Ky(l[0].x):Yy(t):(t=l.length,function(f){for(var c=0,u;c<t;++c)s[(u=l[c]).i]=u.x(f);return s.join("")})}function hr(e,t){var r=typeof t,n;return t==null||r==="boolean"?ai(t):(r==="number"?Gt:r==="string"?(n=qt(t))?(t=n,Js):Mh:t instanceof qt?Js:t instanceof Date?Fh:Ah(t)?Ch:Array.isArray(t)?Ph:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?kh:Gt)(e,t)}function rf(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function nf(e){return function(){return e}}function of(e){return+e}var Lh=[0,1];function He(e){return e}function af(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:nf(isNaN(t)?NaN:.5)}function Xy(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Qy(e,t,r){var n=e[0],i=e[1],o=t[0],a=t[1];return i<n?(n=af(i,n),o=r(a,o)):(n=af(n,i),o=r(o,a)),function(s){return o(n(s))}}function Jy(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),a=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++a<n;)i[a]=af(e[a],e[a+1]),o[a]=r(t[a],t[a+1]);return function(s){var l=_t(e,s,1,n)-1;return o[l](i[l](s))}}function Kr(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function si(){var e=Lh,t=Lh,r=hr,n,i,o,a=He,s,l,f;function c(){var d=Math.min(e.length,t.length);return a!==He&&(a=Xy(e[0],e[d-1])),s=d>2?Jy:Qy,l=f=null,u}function u(d){return d==null||isNaN(d=+d)?o:(l||(l=s(e.map(n),t,r)))(n(a(d)))}return u.invert=function(d){return a(i((f||(f=s(t,e.map(n),Gt)))(d)))},u.domain=function(d){return arguments.length?(e=Array.from(d,of),c()):e.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),r=rf,c()},u.clamp=function(d){return arguments.length?(a=d?!0:He,c()):a!==He},u.interpolate=function(d){return arguments.length?(r=d,c()):r},u.unknown=function(d){return arguments.length?(o=d,u):o},function(d,h){return n=d,i=h,c()}}function sf(){return si()(He,He)}function Ih(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function pr(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function st(e){return e=pr(Math.abs(e)),e?e[1]:NaN}function Rh(e,t){return function(r,n){for(var i=r.length,o=[],a=0,s=e[0],l=0;i>0&&s>0&&(l+s+1>n&&(s=Math.max(1,n-l)),o.push(r.substring(i-=s,i+s)),!((l+=s+1)>n));)s=e[a=(a+1)%e.length];return o.reverse().join(t)}}function Oh(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var ex=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ft(e){if(!(t=ex.exec(e)))throw new Error("invalid format: "+e);var t;return new Uo({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}ft.prototype=Uo.prototype;function Uo(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Uo.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Bh(e){e:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var ff;function Dh(e,t){var r=pr(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(ff=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=n.length;return o===a?n:o>a?n+new Array(o-a+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+pr(e,Math.max(0,t+o-1))[0]}function lf(e,t){var r=pr(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var cf={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ih,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>lf(e*100,t),r:lf,s:Dh,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function uf(e){return e}var Nh=Array.prototype.map,zh=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Uh(e){var t=e.grouping===void 0||e.thousands===void 0?uf:Rh(Nh.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?uf:Oh(Nh.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"\u2212":e.minus+"",l=e.nan===void 0?"NaN":e.nan+"";function f(u){u=ft(u);var d=u.fill,h=u.align,g=u.sign,x=u.symbol,S=u.zero,T=u.width,w=u.comma,k=u.precision,L=u.trim,M=u.type;M==="n"?(w=!0,M="g"):cf[M]||(k===void 0&&(k=12),L=!0,M="g"),(S||d==="0"&&h==="=")&&(S=!0,d="0",h="=");var O=x==="$"?r:x==="#"&&/[boxX]/.test(M)?"0"+M.toLowerCase():"",D=x==="$"?n:/[%p]/.test(M)?a:"",p=cf[M],m=/[defgprs%]/.test(M);k=k===void 0?6:/[gprs]/.test(M)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function b(y){var v=O,E=D,F,_,C;if(M==="c")E=p(y)+E,y="";else{y=+y;var P=y<0||1/y<0;if(y=isNaN(y)?l:p(Math.abs(y),k),L&&(y=Bh(y)),P&&+y==0&&g!=="+"&&(P=!1),v=(P?g==="("?g:s:g==="-"||g==="("?"":g)+v,E=(M==="s"?zh[8+ff/3]:"")+E+(P&&g==="("?")":""),m){for(F=-1,_=y.length;++F<_;)if(C=y.charCodeAt(F),48>C||C>57){E=(C===46?i+y.slice(F+1):y.slice(F))+E,y=y.slice(0,F);break}}}w&&!S&&(y=t(y,1/0));var A=v.length+y.length+E.length,I=A<T?new Array(T-A+1).join(d):"";switch(w&&S&&(y=t(I+y,I.length?T-E.length:1/0),I=""),h){case"<":y=v+y+E+I;break;case"=":y=v+I+y+E;break;case"^":y=I.slice(0,A=I.length>>1)+v+y+E+I.slice(A);break;default:y=I+v+y+E;break}return o(y)}return b.toString=function(){return u+""},b}function c(u,d){var h=f((u=ft(u),u.type="f",u)),g=Math.max(-8,Math.min(8,Math.floor(st(d)/3)))*3,x=Math.pow(10,-g),S=zh[8+g/3];return function(T){return h(x*T)+S}}return{format:f,formatPrefix:c}}var qo,Et,Go;df({thousands:",",grouping:[3],currency:["$",""]});function df(e){return qo=Uh(e),Et=qo.format,Go=qo.formatPrefix,qo}function hf(e){return Math.max(0,-st(Math.abs(e)))}function pf(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(st(t)/3)))*3-st(Math.abs(e)))}function gf(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,st(t)-st(e))+1}function mf(e,t,r,n){var i=js(e,t,r),o;switch(n=ft(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=pf(i,a))&&(n.precision=o),Go(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=gf(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=hf(i))&&(n.precision=o-(n.type==="%")*2);break}}return Et(n)}function fi(e){var t=e.domain;return e.ticks=function(r){var n=t();return lr(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return mf(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,a=n[i],s=n[o],l,f,c=10;for(s<a&&(f=a,a=s,s=f,f=i,i=o,o=f);c-- >0;){if(f=ri(a,s,r),f===l)return n[i]=a,n[o]=s,t(n);if(f>0)a=Math.floor(a/f)*f,s=Math.ceil(s/f)*f;else if(f<0)a=Math.ceil(a*f)/f,s=Math.floor(s*f)/f;else break;l=f}return e},e}function gr(){var e=sf();return e.copy=function(){return Kr(e,gr())},ce.apply(e,arguments),fi(e)}function bf(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],a;return o<i&&(a=r,r=n,n=a,a=i,i=o,o=a),e[r]=t.floor(i),e[n]=t.ceil(o),e}function qh(e){return Math.log(e)}function Gh(e){return Math.exp(e)}function tx(e){return-Math.log(-e)}function rx(e){return-Math.exp(-e)}function nx(e){return isFinite(e)?+("1e"+e):e<0?0:e}function ix(e){return e===10?nx:e===Math.E?Math.exp:t=>Math.pow(e,t)}function ox(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Vh(e){return(t,r)=>-e(-t,r)}function ax(e){let t=e(qh,Gh),r=t.domain,n=10,i,o;function a(){return i=ox(n),o=ix(n),r()[0]<0?(i=Vh(i),o=Vh(o),e(tx,rx)):e(qh,Gh),t}return t.base=function(s){return arguments.length?(n=+s,a()):n},t.domain=function(s){return arguments.length?(r(s),a()):r()},t.ticks=s=>{let l=r(),f=l[0],c=l[l.length-1],u=c<f;u&&([f,c]=[c,f]);let d=i(f),h=i(c),g,x,S=s==null?10:+s,T=[];if(!(n%1)&&h-d<S){if(d=Math.floor(d),h=Math.ceil(h),f>0){for(;d<=h;++d)for(g=1;g<n;++g)if(x=d<0?g/o(-d):g*o(d),!(x<f)){if(x>c)break;T.push(x)}}else for(;d<=h;++d)for(g=n-1;g>=1;--g)if(x=d>0?g/o(-d):g*o(d),!(x<f)){if(x>c)break;T.push(x)}T.length*2<S&&(T=lr(f,c,S))}else T=lr(d,h,Math.min(h-d,S)).map(o);return u?T.reverse():T},t.tickFormat=(s,l)=>{if(s==null&&(s=10),l==null&&(l=n===10?"s":","),typeof l!="function"&&(!(n%1)&&(l=ft(l)).precision==null&&(l.trim=!0),l=Et(l)),s===1/0)return l;let f=Math.max(1,n*s/t.ticks().length);return c=>{let u=c/o(Math.round(i(c)));return u*n<n-.5&&(u*=n),u<=f?l(c):""}},t.nice=()=>r(bf(r(),{floor:s=>o(Math.floor(i(s))),ceil:s=>o(Math.ceil(i(s)))})),t}function li(){let e=ax(si()).domain([1,10]);return e.copy=()=>Kr(e,li()).base(e.base()),ce.apply(e,arguments),e}function $h(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function sx(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function fx(e){return e<0?-e*e:e*e}function lx(e){var t=e(He,He),r=1;function n(){return r===1?e(He,He):r===.5?e(sx,fx):e($h(r),$h(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},fi(t)}function Vo(){var e=lx(si());return e.copy=function(){return Kr(e,Vo()).exponent(e.exponent())},ce.apply(e,arguments),e}function yf(){return Vo.apply(null,arguments).exponent(.5)}function ci(){var e=[],t=[],r=[],n;function i(){var a=0,s=Math.max(1,t.length);for(r=new Array(s-1);++a<s;)r[a-1]=Zs(e,a/s);return o}function o(a){return a==null||isNaN(a=+a)?n:t[_t(r,a)]}return o.invertExtent=function(a){var s=t.indexOf(a);return s<0?[NaN,NaN]:[s>0?r[s-1]:e[0],s<r.length?r[s]:e[e.length-1]]},o.domain=function(a){if(!arguments.length)return e.slice();e=[];for(let s of a)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(ot),i()},o.range=function(a){return arguments.length?(t=Array.from(a),i()):t.slice()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return ci().domain(e).range(t).unknown(n)},ce.apply(o,arguments)}function ui(){var e=0,t=1,r=1,n=[.5],i=[0,1],o;function a(l){return l!=null&&l<=l?i[_t(n,l,0,r)]:o}function s(){var l=-1;for(n=new Array(r);++l<r;)n[l]=((l+1)*t-(l-r)*e)/(r+1);return a}return a.domain=function(l){return arguments.length?([e,t]=l,e=+e,t=+t,s()):[e,t]},a.range=function(l){return arguments.length?(r=(i=Array.from(l)).length-1,s()):i.slice()},a.invertExtent=function(l){var f=i.indexOf(l);return f<0?[NaN,NaN]:f<1?[e,n[0]]:f>=r?[n[r-1],t]:[n[f-1],n[f]]},a.unknown=function(l){return arguments.length&&(o=l),a},a.thresholds=function(){return n.slice()},a.copy=function(){return ui().domain([e,t]).range(i).unknown(o)},ce.apply(fi(a),arguments)}function mr(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[_t(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var a=t.indexOf(o);return[e[a-1],e[a]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return mr().domain(e).range(t).unknown(r)},ce.apply(i,arguments)}var t6={},cx=Object.create,Gf=Object.defineProperty,ux=Object.getOwnPropertyDescriptor,N0=Object.getOwnPropertyNames,dx=Object.getPrototypeOf,hx=Object.prototype.hasOwnProperty,px=(e,t,r)=>t in e?Gf(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gx=(e,t)=>function(){return t||(0,e[N0(e)[0]])((t={exports:{}}).exports,t),t.exports},mx=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of N0(t))!hx.call(e,i)&&i!==r&&Gf(e,i,{get:()=>t[i],enumerable:!(n=ux(t,i))||n.enumerable});return e},bx=(e,t,r)=>(r=e!=null?cx(dx(e)):{},mx(t||!e||!e.__esModule?Gf(r,"default",{value:e,enumerable:!0}):r,e)),B=(e,t,r)=>px(e,typeof t!="symbol"?t+"":t,r),yx=gx({"node_modules/thenby/thenBy.module.js"(e,t){"use strict";t.exports=(function(){function r(a){return a}function n(a){return typeof a=="string"?a.toLowerCase():a}function i(a,s){if(s=typeof s=="object"?s:{direction:s},typeof a!="function"){var l=a;a=function(h){return h[l]?h[l]:""}}if(a.length===1){var f=a,c=s.ignoreCase?n:r,u=s.cmp||function(h,g){return h<g?-1:h>g?1:0};a=function(h,g){return u(c(f(h)),c(f(g)))}}let d={"-1":"",desc:""};return s.direction in d?function(h,g){return-a(h,g)}:a}function o(a,s){var l=typeof this=="function"&&!this.firstBy?this:!1,f=i(a,s),c=l?function(u,d){return l(u,d)||f(u,d)}:f;return c.thenBy=o,c}return o.firstBy=o,o})()}}),xx="deck-gl-carto";function Ci(){return xx}var Vf=(e=>(e.IN="in",e.BETWEEN="between",e.CLOSED_OPEN="closed_open",e.TIME="time",e.STRING_SEARCH="stringSearch",e))(Vf||{}),z0=(e=>(e.V1="v1",e.V2="v2",e.V3="v3",e))(z0||{}),$f="https://gcp-us-east1.api.carto.com",U0={mapId:"tag-mapId"};var q0=(e=>(e.H3="h3",e.QUADBIN="quadbin",e))(q0||{});var vx=Object.freeze({h3:["h3","hex","h3id","hex_id","h3hex"],quadbin:["quadbin"]}),De={Count:"count",Avg:"avg",Min:"min",Max:"max",Sum:"sum",Custom:"custom"};function G0(e){return e.map(t=>t[0]===void 0||t[0]===null?[Number.MIN_SAFE_INTEGER,t[1]]:t[1]===void 0||t[1]===null?[t[0],Number.MAX_SAFE_INTEGER]:t)}var wx={in:_x,between:V0,time:Ex,closed_open:Sx,stringSearch:Tx};function _x(e,t){return e.includes(t)}function V0(e,t){let r=n=>{let[i,o]=n;return t>=i&&t<=o};return G0(e).some(r)}function Ex(e,t){let r=new Date(t).getTime();if(isFinite(r))return V0(e,r);throw new Error("Column used to filter by time isn't well formatted.")}function Sx(e,t){let r=n=>{let[i,o]=n;return t>=i&&t<o};return G0(e).some(r)}function Tx(e,t,r={}){let n=Hh(t,r),i=r.useRegExp?e:e.map(a=>{let s=Px(Hh(a,r));return r.mustStart&&(s=`^${s}`),r.mustEnd&&(s=`${s}$`),s}),o=new RegExp(i.join("|"),r.caseSensitive?"g":"gi");return!!n.match(o)}var Cx=/[.*+?^${}()|[\]\\]/g,Ax=new RegExp("\\p{Diacritic}","gu");function Px(e){return e.replace(Cx,"\\$&")}function Hh(e,t){let r=String(e);return t.keepSpecialCharacters||(r=r.normalize("NFD").replace(Ax,"")),r}var Fx={and:"every",or:"some"};function kx(e,t,r,n){let i=Fx[n];return e[i](o=>{let a=t[o],s=Object.keys(a);return!r||r[o]===null||r[o]===void 0?!1:s.every(l=>{let f=wx[l];if(!f)throw new Error(`"${l}" filter is not implemented.`);return f(a[l].values,r[o],a[l].params)})})}function Mx({filters:e={},type:t="boolean",filtersLogicalOperator:r="and"}){let n=Object.keys(e);return n.length?i=>{let o=i.properties||i,a=kx(n,e,o,r);return t==="number"?Number(a):a}:()=>t==="number"?1:!0}function Lx(e,t,r){return Object.keys(t).length?e.filter(Mx({filters:t,filtersLogicalOperator:r})):e}var W=11102230246251565e-32,ue=134217729,Ix=(3+8*W)*W;function xf(e,t,r,n,i){let o,a,s,l,f=t[0],c=n[0],u=0,d=0;c>f==c>-f?(o=f,f=t[++u]):(o=c,c=n[++d]);let h=0;if(u<e&&d<r)for(c>f==c>-f?(a=f+o,s=o-(a-f),f=t[++u]):(a=c+o,s=o-(a-c),c=n[++d]),o=a,s!==0&&(i[h++]=s);u<e&&d<r;)c>f==c>-f?(a=o+f,l=a-o,s=o-(a-l)+(f-l),f=t[++u]):(a=o+c,l=a-o,s=o-(a-l)+(c-l),c=n[++d]),o=a,s!==0&&(i[h++]=s);for(;u<e;)a=o+f,l=a-o,s=o-(a-l)+(f-l),f=t[++u],o=a,s!==0&&(i[h++]=s);for(;d<r;)a=o+c,l=a-o,s=o-(a-l)+(c-l),c=n[++d],o=a,s!==0&&(i[h++]=s);return(o!==0||h===0)&&(i[h++]=o),h}function Rx(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function R(e){return new Float64Array(e)}var Ox=(3+16*W)*W,Bx=(2+12*W)*W,Dx=(9+64*W)*W*W,Xr=R(4),jh=R(8),Zh=R(12),Wh=R(16),ge=R(4);function Nx(e,t,r,n,i,o,a){let s,l,f,c,u,d,h,g,x,S,T,w,k,L,M,O,D,p,m=e-i,b=r-i,y=t-o,v=n-o;L=m*v,d=ue*m,h=d-(d-m),g=m-h,d=ue*v,x=d-(d-v),S=v-x,M=g*S-(L-h*x-g*x-h*S),O=y*b,d=ue*y,h=d-(d-y),g=y-h,d=ue*b,x=d-(d-b),S=b-x,D=g*S-(O-h*x-g*x-h*S),T=M-D,u=M-T,Xr[0]=M-(T+u)+(u-D),w=L+T,u=w-L,k=L-(w-u)+(T-u),T=k-O,u=k-T,Xr[1]=k-(T+u)+(u-O),p=w+T,u=p-w,Xr[2]=w-(p-u)+(T-u),Xr[3]=p;let E=Rx(4,Xr),F=Bx*a;if(E>=F||-E>=F||(u=e-m,s=e-(m+u)+(u-i),u=r-b,f=r-(b+u)+(u-i),u=t-y,l=t-(y+u)+(u-o),u=n-v,c=n-(v+u)+(u-o),s===0&&l===0&&f===0&&c===0)||(F=Dx*a+Ix*Math.abs(E),E+=m*c+v*s-(y*f+b*l),E>=F||-E>=F))return E;L=s*v,d=ue*s,h=d-(d-s),g=s-h,d=ue*v,x=d-(d-v),S=v-x,M=g*S-(L-h*x-g*x-h*S),O=l*b,d=ue*l,h=d-(d-l),g=l-h,d=ue*b,x=d-(d-b),S=b-x,D=g*S-(O-h*x-g*x-h*S),T=M-D,u=M-T,ge[0]=M-(T+u)+(u-D),w=L+T,u=w-L,k=L-(w-u)+(T-u),T=k-O,u=k-T,ge[1]=k-(T+u)+(u-O),p=w+T,u=p-w,ge[2]=w-(p-u)+(T-u),ge[3]=p;let _=xf(4,Xr,4,ge,jh);L=m*c,d=ue*m,h=d-(d-m),g=m-h,d=ue*c,x=d-(d-c),S=c-x,M=g*S-(L-h*x-g*x-h*S),O=y*f,d=ue*y,h=d-(d-y),g=y-h,d=ue*f,x=d-(d-f),S=f-x,D=g*S-(O-h*x-g*x-h*S),T=M-D,u=M-T,ge[0]=M-(T+u)+(u-D),w=L+T,u=w-L,k=L-(w-u)+(T-u),T=k-O,u=k-T,ge[1]=k-(T+u)+(u-O),p=w+T,u=p-w,ge[2]=w-(p-u)+(T-u),ge[3]=p;let C=xf(_,jh,4,ge,Zh);L=s*c,d=ue*s,h=d-(d-s),g=s-h,d=ue*c,x=d-(d-c),S=c-x,M=g*S-(L-h*x-g*x-h*S),O=l*f,d=ue*l,h=d-(d-l),g=l-h,d=ue*f,x=d-(d-f),S=f-x,D=g*S-(O-h*x-g*x-h*S),T=M-D,u=M-T,ge[0]=M-(T+u)+(u-D),w=L+T,u=w-L,k=L-(w-u)+(T-u),T=k-O,u=k-T,ge[1]=k-(T+u)+(u-O),p=w+T,u=p-w,ge[2]=w-(p-u)+(T-u),ge[3]=p;let P=xf(C,Zh,4,ge,Wh);return Wh[P-1]}function zx(e,t,r,n,i,o){let a=(t-o)*(r-i),s=(e-i)*(n-o),l=a-s,f=Math.abs(a+s);return Math.abs(l)>=Ox*f?l:-Nx(e,t,r,n,i,o,f)}var gS=(7+56*W)*W,mS=(3+28*W)*W,bS=(26+288*W)*W*W,yS=R(4),xS=R(4),vS=R(4),wS=R(4),_S=R(4),ES=R(4),SS=R(4),TS=R(4),CS=R(4),AS=R(8),PS=R(8),FS=R(8),kS=R(4),MS=R(8),LS=R(8),IS=R(8),RS=R(12),OS=R(192),BS=R(192),DS=(10+96*W)*W,NS=(4+48*W)*W,zS=(44+576*W)*W*W,US=R(4),qS=R(4),GS=R(4),VS=R(4),$S=R(4),HS=R(4),jS=R(4),ZS=R(4),WS=R(8),YS=R(8),KS=R(8),XS=R(8),QS=R(8),JS=R(8),eT=R(8),tT=R(8),rT=R(8),nT=R(4),iT=R(4),oT=R(4),aT=R(8),sT=R(16),fT=R(16),lT=R(16),cT=R(32),uT=R(32),dT=R(48),hT=R(64),pT=R(1152),gT=R(1152),mT=(16+224*W)*W,bT=(5+72*W)*W,yT=(71+1408*W)*W*W,xT=R(4),vT=R(4),wT=R(4),_T=R(4),ET=R(4),ST=R(4),TT=R(4),CT=R(4),AT=R(4),PT=R(4),FT=R(24),kT=R(24),MT=R(24),LT=R(24),IT=R(24),RT=R(24),OT=R(24),BT=R(24),DT=R(24),NT=R(24),zT=R(1152),UT=R(1152),qT=R(1152),GT=R(1152),VT=R(1152),$T=R(2304),HT=R(2304),jT=R(3456),ZT=R(5760),WT=R(8),YT=R(8),KT=R(8),XT=R(16),QT=R(24),JT=R(48),eC=R(48),tC=R(96),rC=R(192),nC=R(384),iC=R(384),oC=R(384),aC=R(768),sC=R(96),fC=R(96),lC=R(96),cC=R(1152);function Ux(e,t){var r,n,i=0,o,a,s,l,f,c,u,d=e[0],h=e[1],g=t.length;for(r=0;r<g;r++){n=0;var x=t[r],S=x.length-1;if(c=x[0],c[0]!==x[S][0]&&c[1]!==x[S][1])throw new Error("First and last coordinates in a ring must be the same");for(a=c[0]-d,s=c[1]-h,n;n<S;n++){if(u=x[n+1],l=u[0]-d,f=u[1]-h,s===0&&f===0){if(l<=0&&a>=0||a<=0&&l>=0)return 0}else if(f>=0&&s<=0||f<=0&&s>=0){if(o=zx(a,l,s,f,0,0),o===0)return 0;(o>0&&f>0&&s<=0||o<0&&f<=0&&s>0)&&i++}c=u,s=f,a=l}}return i%2!==0}var Ce=63710088e-1,uC={centimeters:Ce*100,centimetres:Ce*100,degrees:360/(2*Math.PI),feet:Ce*3.28084,inches:Ce*39.37,kilometers:Ce/1e3,kilometres:Ce/1e3,meters:Ce,metres:Ce,miles:Ce/1609.344,millimeters:Ce*1e3,millimetres:Ce*1e3,nauticalmiles:Ce/1852,radians:1,yards:Ce*1.0936};function we(e,t,r={}){let n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function qx(e,t,r={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Yh(e[0])||!Yh(e[1]))throw new Error("coordinates must contain numbers");return we({type:"Point",coordinates:e},t,r)}function Hf(e,t,r={}){for(let i of e){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<i[i.length-1].length;o++)if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}return we({type:"Polygon",coordinates:e},t,r)}function $0(e,t,r={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return we({type:"LineString",coordinates:e},t,r)}function wi(e,t={}){let r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function H0(e,t,r={}){return we({type:"MultiLineString",coordinates:e},t,r)}function j0(e,t,r={}){return we({type:"MultiPolygon",coordinates:e},t,r)}function Yh(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Z0(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function xi(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Pt(e){return e.type==="Feature"?e.geometry:e}function Gx(e,t){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function Ne(e,t,r={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");let n=Z0(e),i=Pt(t),o=i.type,a=t.bbox,s=i.coordinates;if(a&&Vx(n,a)===!1)return!1;o==="Polygon"&&(s=[s]);let l=!1;for(var f=0;f<s.length;++f){let c=Ux(n,s[f]);if(c===0)return!r.ignoreBoundary;c&&(l=!0)}return l}function Vx(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}var W0=class{constructor(e=[],t=$x){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:r}=this,n=t[e];for(;e>0;){let i=e-1>>1,o=t[i];if(r(n,o)>=0)break;t[e]=o,e=i}t[e]=n}_down(e){let{data:t,compare:r}=this,n=this.length>>1,i=t[e];for(;e<n;){let o=(e<<1)+1,a=t[o],s=o+1;if(s<this.length&&r(t[s],a)<0&&(o=s,a=t[s]),r(a,i)>=0)break;t[e]=a,e=o}t[e]=i}};function $x(e,t){return e<t?-1:e>t?1:0}function Y0(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x?-1:e.p.y!==t.p.y?e.p.y>t.p.y?1:-1:1}function Hx(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y!==t.rightSweepEvent.p.y?e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1:1}var Kh=class{constructor(e,t,r,n){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=r,this.eventId=n,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}};function jx(e,t){if(e.type==="FeatureCollection"){let r=e.features;for(let n=0;n<r.length;n++)Xh(r[n],t)}else Xh(e,t)}var $o=0,Ho=0,jo=0;function Xh(e,t){let r=e.type==="Feature"?e.geometry:e,n=r.coordinates;(r.type==="Polygon"||r.type==="MultiLineString")&&(n=[n]),r.type==="LineString"&&(n=[[n]]);for(let i=0;i<n.length;i++)for(let o=0;o<n[i].length;o++){let a=n[i][o][0],s=null;Ho=Ho+1;for(let l=0;l<n[i][o].length-1;l++){s=n[i][o][l+1];let f=new Kh(a,$o,Ho,jo),c=new Kh(s,$o,Ho,jo+1);f.otherEvent=c,c.otherEvent=f,Y0(f,c)>0?(c.isLeftEndpoint=!0,f.isLeftEndpoint=!1):(f.isLeftEndpoint=!0,c.isLeftEndpoint=!1),t.push(f),t.push(c),a=s,jo=jo+1}}$o=$o+1}var Zx=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function Wx(e,t){if(e===null||t===null||e.leftSweepEvent.ringId===t.leftSweepEvent.ringId&&(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent)))return!1;let r=e.leftSweepEvent.p.x,n=e.leftSweepEvent.p.y,i=e.rightSweepEvent.p.x,o=e.rightSweepEvent.p.y,a=t.leftSweepEvent.p.x,s=t.leftSweepEvent.p.y,l=t.rightSweepEvent.p.x,f=t.rightSweepEvent.p.y,c=(f-s)*(i-r)-(l-a)*(o-n),u=(l-a)*(n-s)-(f-s)*(r-a),d=(i-r)*(n-s)-(o-n)*(r-a);if(c===0)return!1;let h=u/c,g=d/c;if(h>=0&&h<=1&&g>=0&&g<=1){let x=r+h*(i-r),S=n+h*(o-n);return[x,S]}return!1}function Yx(e,t){t=t||!1;let r=[],n=new W0([],Hx);for(;e.length;){let i=e.pop();if(i.isLeftEndpoint){let o=new Zx(i);for(let a=0;a<n.data.length;a++){let s=n.data[a];if(t&&s.leftSweepEvent.featureId===i.featureId)continue;let l=Wx(o,s);l!==!1&&r.push(l)}n.push(o)}else i.isLeftEndpoint===!1&&n.pop()}return r}function Kx(e,t){let r=new W0([],Y0);return jx(e,r),Yx(r,t)}var Xx=Kx,Qx=Xx;function jf(e,t,r={}){let{removeDuplicates:n=!0,ignoreSelfIntersections:i=!0}=r,o=[];e.type==="FeatureCollection"?o=o.concat(e.features):e.type==="Feature"?o.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&o.push(we(e)),t.type==="FeatureCollection"?o=o.concat(t.features):t.type==="Feature"?o.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&o.push(we(t));let a=Qx(wi(o),i),s=[];if(n){let l={};a.forEach(f=>{let c=f.join(",");l[c]||(l[c]=!0,s.push(f))})}else s=a;return wi(s.map(l=>qx(l)))}function K0(e,t,r){if(e!==null)for(var n,i,o,a,s,l,f,c=0,u=0,d,h=e.type,g=h==="FeatureCollection",x=h==="Feature",S=g?e.features.length:1,T=0;T<S;T++){f=g?e.features[T].geometry:x?e.geometry:e,d=f?f.type==="GeometryCollection":!1,s=d?f.geometries.length:1;for(var w=0;w<s;w++){var k=0,L=0;if(a=d?f.geometries[w]:f,a!==null){l=a.coordinates;var M=a.type;switch(c=r&&(M==="Polygon"||M==="MultiPolygon")?1:0,M){case null:break;case"Point":if(t(l,u,T,k,L)===!1)return!1;u++,k++;break;case"LineString":case"MultiPoint":for(n=0;n<l.length;n++){if(t(l[n],u,T,k,L)===!1)return!1;u++,M==="MultiPoint"&&k++}M==="LineString"&&k++;break;case"Polygon":case"MultiLineString":for(n=0;n<l.length;n++){for(i=0;i<l[n].length-c;i++){if(t(l[n][i],u,T,k,L)===!1)return!1;u++}M==="MultiLineString"&&k++,M==="Polygon"&&L++}M==="Polygon"&&k++;break;case"MultiPolygon":for(n=0;n<l.length;n++){for(L=0,i=0;i<l[n].length;i++){for(o=0;o<l[n][i].length-c;o++){if(t(l[n][i][o],u,T,k,L)===!1)return!1;u++}L++}k++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(K0(a.geometries[n],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function X0(e,t){var r,n,i,o,a,s,l,f,c,u,d=0,h=e.type==="FeatureCollection",g=e.type==="Feature",x=h?e.features.length:1;for(r=0;r<x;r++){for(s=h?e.features[r].geometry:g?e.geometry:e,f=h?e.features[r].properties:g?e.properties:{},c=h?e.features[r].bbox:g?e.bbox:void 0,u=h?e.features[r].id:g?e.id:void 0,l=s?s.type==="GeometryCollection":!1,a=l?s.geometries.length:1,i=0;i<a;i++){if(o=l?s.geometries[i]:s,o===null){if(t(null,d,f,c,u)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,d,f,c,u)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],d,f,c,u)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function ta(e,t){X0(e,function(r,n,i,o,a){var s=r===null?null:r.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(we(r,i,{bbox:o,id:a}),n,0)===!1?!1:void 0}var l;switch(s){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var f=0;f<r.coordinates.length;f++){var c=r.coordinates[f],u={type:l,coordinates:c};if(t(we(u,i),n,f)===!1)return!1}})}function Ff(e,t={}){let r=Pt(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),r.type){case"Polygon":return Jx(r,t);case"MultiPolygon":return ev(r,t);default:throw new Error("invalid poly")}}function Jx(e,t={}){let n=Pt(e).coordinates,i=t.properties?t.properties:e.type==="Feature"?e.properties:{};return Q0(n,i)}function ev(e,t={}){let n=Pt(e).coordinates,i=t.properties?t.properties:e.type==="Feature"?e.properties:{},o=[];return n.forEach(a=>{o.push(Q0(a,i))}),wi(o)}function Q0(e,t){return e.length>1?H0(e,t):$0(e[0],t)}function tv(e,t,{ignoreSelfIntersections:r=!0}={ignoreSelfIntersections:!0}){let n=!0;return ta(e,i=>{ta(t,o=>{if(n===!1)return!1;n=rv(i.geometry,o.geometry,r)})}),n}function rv(e,t,r){switch(e.type){case"Point":switch(t.type){case"Point":return!av(e.coordinates,t.coordinates);case"LineString":return!Qh(t,e);case"Polygon":return!Ne(e,t)}break;case"LineString":switch(t.type){case"Point":return!Qh(e,t);case"LineString":return!nv(e,t,r);case"Polygon":return!Jh(t,e,r)}break;case"Polygon":switch(t.type){case"Point":return!Ne(t,e);case"LineString":return!Jh(e,t,r);case"Polygon":return!iv(t,e,r)}}return!1}function Qh(e,t){for(let r=0;r<e.coordinates.length-1;r++)if(ov(e.coordinates[r],e.coordinates[r+1],t.coordinates))return!0;return!1}function nv(e,t,r){return jf(e,t,{ignoreSelfIntersections:r}).features.length>0}function Jh(e,t,r){for(let i of t.coordinates)if(Ne(i,e))return!0;return jf(t,Ff(e),{ignoreSelfIntersections:r}).features.length>0}function iv(e,t,r){for(let i of e.coordinates[0])if(Ne(i,t))return!0;for(let i of t.coordinates[0])if(Ne(i,e))return!0;return jf(Ff(e),Ff(t),{ignoreSelfIntersections:r}).features.length>0}function ov(e,t,r){let n=r[0]-e[0],i=r[1]-e[1],o=t[0]-e[0],a=t[1]-e[1];return n*a-i*o!==0?!1:Math.abs(o)>=Math.abs(a)?o>0?e[0]<=r[0]&&r[0]<=t[0]:t[0]<=r[0]&&r[0]<=e[0]:a>0?e[1]<=r[1]&&r[1]<=t[1]:t[1]<=r[1]&&r[1]<=e[1]}function av(e,t){return e[0]===t[0]&&e[1]===t[1]}function sv(e,t,{ignoreSelfIntersections:r=!0}={}){let n=!1;return ta(e,i=>{ta(t,o=>{if(n===!0)return!0;n=!tv(i.geometry,o.geometry,{ignoreSelfIntersections:r})})}),n}var J0=sv;function fv({geojson:e,spatialFilter:t,uniqueIdProperty:r}){let n=0,i=new Map;if(!t)return[];for(let o of e.features){let a=r?o.properties[r]:++n;!i.has(a)&&J0(t,o)&&i.set(a,o.properties)}return Array.from(i.values())}var dC=1/Math.PI*180,hC=1/180*Math.PI,lv={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...lv}};var pC=globalThis.mathgl.config;function cv(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function kf(e,t,r){return cv(e)?e.map((n,i)=>kf(n,t[i],r)):r*t+(1-r)*e}function e0(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var We=Math.PI,ep=We/4,t0=We/180,r0=180/We,ra=512;function Mf(e){let[t,r]=e;e0(Number.isFinite(t)),e0(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*t0,i=r*t0,o=ra*(n+We)/(2*We),a=ra*(We+Math.log(Math.tan(ep+i*.5)))/(2*We);return[o,a]}function uv(e){let[t,r]=e,n=t/ra*(2*We)-We,i=2*(Math.atan(Math.exp(r/ra*(2*We)-We))-ep);return[n*r0,i*r0]}var gC=Math.PI/180,dv={Point:tp,MultiPoint:pv,LineString:rp,MultiLineString:gv,Polygon:np,MultiPolygon:mv};function hv(e,t){let[r,n,i,o]=t,a=Mf([r,o]),s=Mf([i,n]),l=[a,s];if(e.type==="GeometryCollection")throw new Error("Unsupported geometry type GeometryCollection");let f=dv[e.type],c=f(e.coordinates,l);return{...e,coordinates:c}}function tp([e,t],[r,n]){let i=kf(r[0],n[0],e),o=kf(r[1],n[1],t);return uv([i,o])}function Zf(e,t){return e.map(r=>tp(r,t))}function pv(e,t){return Zf(e,t)}function rp(e,t){return Zf(e,t)}function gv(e,t){return e.map(r=>rp(r,t))}function np(e,t){return e.map(r=>Zf(r,t))}function mv(e,t){return e.map(r=>np(r,t))}function bv(e,t={}){let r=Number(e[0]),n=Number(e[1]),i=Number(e[2]),o=Number(e[3]);if(e.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");let a=[r,n];return Hf([[a,[i,n],[i,o],[r,o],a]],t.properties,{bbox:e,id:t.id})}var yv=bv;function na(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;let r=[1/0,1/0,-1/0,-1/0];return K0(e,n=>{r[0]>n[0]&&(r[0]=n[0]),r[1]>n[1]&&(r[1]=n[1]),r[2]<n[0]&&(r[2]=n[0]),r[3]<n[1]&&(r[3]=n[1])}),r}function ia(e,t,r={}){let n=Z0(e),i=xi(t);for(let o=0;o<i.length-1;o++){let a=!1;if(r.ignoreEndVertices&&(o===0&&(a="start"),o===i.length-2&&(a="end"),o===0&&o+1===i.length-1&&(a="both")),xv(i[o],i[o+1],n,a,typeof r.epsilon>"u"?null:r.epsilon))return!0}return!1}function xv(e,t,r,n,i){let o=r[0],a=r[1],s=e[0],l=e[1],f=t[0],c=t[1],u=r[0]-s,d=r[1]-l,h=f-s,g=c-l,x=u*g-d*h;if(i!==null){if(Math.abs(x)>i)return!1}else if(x!==0)return!1;if(Math.abs(h)===Math.abs(g)&&Math.abs(h)===0)return n?!1:r[0]===e[0]&&r[1]===e[1];if(n){if(n==="start")return Math.abs(h)>=Math.abs(g)?h>0?s<o&&o<=f:f<=o&&o<s:g>0?l<a&&a<=c:c<=a&&a<l;if(n==="end")return Math.abs(h)>=Math.abs(g)?h>0?s<=o&&o<f:f<o&&o<=s:g>0?l<=a&&a<c:c<a&&a<=l;if(n==="both")return Math.abs(h)>=Math.abs(g)?h>0?s<o&&o<f:f<o&&o<s:g>0?l<a&&a<c:c<a&&a<l}else return Math.abs(h)>=Math.abs(g)?h>0?s<=o&&o<=f:f<=o&&o<=s:g>0?l<=a&&a<=c:c<=a&&a<=l;return!1}function vv(e,t){var r=Pt(e),n=Pt(t),i=r.type,o=n.type;switch(i){case"Point":switch(o){case"MultiPoint":return wv(r,n);case"LineString":return ia(r,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Ne(r,n,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return _v(r,n);case"LineString":return Ev(r,n);case"Polygon":case"MultiPolygon":return Sv(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return Tv(r,n);case"Polygon":case"MultiPolygon":return Cv(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return Av(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function wv(e,t){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(op(t.coordinates[r],e.coordinates)){n=!0;break}return n}function _v(e,t){for(var r=0;r<e.coordinates.length;r++){for(var n=!1,i=0;i<t.coordinates.length;i++)op(e.coordinates[r],t.coordinates[i])&&(n=!0);if(!n)return!1}return!0}function Ev(e,t){for(var r=!1,n=0;n<e.coordinates.length;n++){if(!ia(e.coordinates[n],t))return!1;r||(r=ia(e.coordinates[n],t,{ignoreEndVertices:!0}))}return r}function Sv(e,t){for(var r=!0,n=!1,i=!1,o=0;o<e.coordinates.length;o++){if(i=Ne(e.coordinates[o],t),!i){r=!1;break}n||(i=Ne(e.coordinates[o],t,{ignoreBoundary:!0}))}return r&&i}function Tv(e,t){for(var r=0;r<e.coordinates.length;r++)if(!ia(e.coordinates[r],t))return!1;return!0}function Cv(e,t){var r=na(t),n=na(e);if(!ip(r,n))return!1;for(var i=!1,o=0;o<e.coordinates.length;o++){if(!Ne(e.coordinates[o],t))return!1;if(i||(i=Ne(e.coordinates[o],t,{ignoreBoundary:!0})),!i&&o<e.coordinates.length-1){var a=Pv(e.coordinates[o],e.coordinates[o+1]);i=Ne(a,t,{ignoreBoundary:!0})}}return i}function Av(e,t){var r=na(e),n=na(t);if(!ip(n,r))return!1;for(var i=0;i<e.coordinates[0].length;i++)if(!Ne(e.coordinates[0][i],t))return!1;return!0}function ip(e,t){return!(e[0]>t[0]||e[2]<t[2]||e[1]>t[1]||e[3]<t[3])}function op(e,t){return e[0]===t[0]&&e[1]===t[1]}function Pv(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var ap=vv,Fv=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,vf=Math.ceil,Oe=Math.floor,xe="[BigNumber Error] ",n0=xe+"Number primitive has more than 15 significant digits: ",je=1e14,U=14,wf=9007199254740991,_f=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Vt=1e7,se=1e9;function sp(e){var t,r,n,i=w.prototype={constructor:w,toString:null,valueOf:null},o=new w(1),a=20,s=4,l=-7,f=21,c=-1e7,u=1e7,d=!1,h=1,g=0,x={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function w(p,m){var b,y,v,E,F,_,C,P,A=this;if(!(A instanceof w))return new w(p,m);if(m==null){if(p&&p._isBigNumber===!0){A.s=p.s,!p.c||p.e>u?A.c=A.e=null:p.e<c?A.c=[A.e=0]:(A.e=p.e,A.c=p.c.slice());return}if((_=typeof p=="number")&&p*0==0){if(A.s=1/p<0?(p=-p,-1):1,p===~~p){for(E=0,F=p;F>=10;F/=10,E++);E>u?A.c=A.e=null:(A.e=E,A.c=[p]);return}P=String(p)}else{if(!Fv.test(P=String(p)))return n(A,P,_);A.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(E=P.indexOf("."))>-1&&(P=P.replace(".","")),(F=P.search(/e/i))>0?(E<0&&(E=F),E+=+P.slice(F+1),P=P.substring(0,F)):E<0&&(E=P.length)}else{if(ee(m,2,S.length,"Base"),m==10&&T)return A=new w(p),O(A,a+A.e+1,s);if(P=String(p),_=typeof p=="number"){if(p*0!=0)return n(A,P,_,m);if(A.s=1/p<0?(P=P.slice(1),-1):1,w.DEBUG&&P.replace(/^0\.0*|\./,"").length>15)throw Error(n0+p)}else A.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(b=S.slice(0,m),E=F=0,C=P.length;F<C;F++)if(b.indexOf(y=P.charAt(F))<0){if(y=="."){if(F>E){E=C;continue}}else if(!v&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){v=!0,F=-1,E=0;continue}return n(A,String(p),_,m)}_=!1,P=r(P,m,10,A.s),(E=P.indexOf("."))>-1?P=P.replace(".",""):E=P.length}for(F=0;P.charCodeAt(F)===48;F++);for(C=P.length;P.charCodeAt(--C)===48;);if(P=P.slice(F,++C)){if(C-=F,_&&w.DEBUG&&C>15&&(p>wf||p!==Oe(p)))throw Error(n0+A.s*p);if((E=E-F-1)>u)A.c=A.e=null;else if(E<c)A.c=[A.e=0];else{if(A.e=E,A.c=[],F=(E+1)%U,E<0&&(F+=U),F<C){for(F&&A.c.push(+P.slice(0,F)),C-=U;F<C;)A.c.push(+P.slice(F,F+=U));F=U-(P=P.slice(F)).length}else F-=C;for(;F--;P+="0");A.c.push(+P)}}else A.c=[A.e=0]}w.clone=sp,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(p){var m,b;if(p!=null)if(typeof p=="object"){if(p.hasOwnProperty(m="DECIMAL_PLACES")&&(b=p[m],ee(b,0,se,m),a=b),p.hasOwnProperty(m="ROUNDING_MODE")&&(b=p[m],ee(b,0,8,m),s=b),p.hasOwnProperty(m="EXPONENTIAL_AT")&&(b=p[m],b&&b.pop?(ee(b[0],-se,0,m),ee(b[1],0,se,m),l=b[0],f=b[1]):(ee(b,-se,se,m),l=-(f=b<0?-b:b))),p.hasOwnProperty(m="RANGE"))if(b=p[m],b&&b.pop)ee(b[0],-se,-1,m),ee(b[1],1,se,m),c=b[0],u=b[1];else if(ee(b,-se,se,m),b)c=-(u=b<0?-b:b);else throw Error(xe+m+" cannot be zero: "+b);if(p.hasOwnProperty(m="CRYPTO"))if(b=p[m],b===!!b)if(b)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))d=b;else throw d=!b,Error(xe+"crypto unavailable");else d=b;else throw Error(xe+m+" not true or false: "+b);if(p.hasOwnProperty(m="MODULO_MODE")&&(b=p[m],ee(b,0,9,m),h=b),p.hasOwnProperty(m="POW_PRECISION")&&(b=p[m],ee(b,0,se,m),g=b),p.hasOwnProperty(m="FORMAT"))if(b=p[m],typeof b=="object")x=b;else throw Error(xe+m+" not an object: "+b);if(p.hasOwnProperty(m="ALPHABET"))if(b=p[m],typeof b=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(b))T=b.slice(0,10)=="0123456789",S=b;else throw Error(xe+m+" invalid: "+b)}else throw Error(xe+"Object expected: "+p);return{DECIMAL_PLACES:a,ROUNDING_MODE:s,EXPONENTIAL_AT:[l,f],RANGE:[c,u],CRYPTO:d,MODULO_MODE:h,POW_PRECISION:g,FORMAT:x,ALPHABET:S}},w.isBigNumber=function(p){if(!p||p._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var m,b,y=p.c,v=p.e,E=p.s;e:if({}.toString.call(y)=="[object Array]"){if((E===1||E===-1)&&v>=-se&&v<=se&&v===Oe(v)){if(y[0]===0){if(v===0&&y.length===1)return!0;break e}if(m=(v+1)%U,m<1&&(m+=U),String(y[0]).length==m){for(m=0;m<y.length;m++)if(b=y[m],b<0||b>=je||b!==Oe(b))break e;if(b!==0)return!0}}}else if(y===null&&v===null&&(E===null||E===1||E===-1))return!0;throw Error(xe+"Invalid BigNumber: "+p)},w.maximum=w.max=function(){return L(arguments,-1)},w.minimum=w.min=function(){return L(arguments,1)},w.random=(function(){var p=9007199254740992,m=Math.random()*p&2097151?function(){return Oe(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var y,v,E,F,_,C=0,P=[],A=new w(o);if(b==null?b=a:ee(b,0,se),F=vf(b/U),d)if(crypto.getRandomValues){for(y=crypto.getRandomValues(new Uint32Array(F*=2));C<F;)_=y[C]*131072+(y[C+1]>>>11),_>=9e15?(v=crypto.getRandomValues(new Uint32Array(2)),y[C]=v[0],y[C+1]=v[1]):(P.push(_%1e14),C+=2);C=F/2}else if(crypto.randomBytes){for(y=crypto.randomBytes(F*=7);C<F;)_=(y[C]&31)*281474976710656+y[C+1]*1099511627776+y[C+2]*4294967296+y[C+3]*16777216+(y[C+4]<<16)+(y[C+5]<<8)+y[C+6],_>=9e15?crypto.randomBytes(7).copy(y,C):(P.push(_%1e14),C+=7);C=F/7}else throw d=!1,Error(xe+"crypto unavailable");if(!d)for(;C<F;)_=m(),_<9e15&&(P[C++]=_%1e14);for(F=P[--C],b%=U,F&&b&&(_=_f[U-b],P[C]=Oe(F/_)*_);P[C]===0;P.pop(),C--);if(C<0)P=[E=0];else{for(E=-1;P[0]===0;P.splice(0,1),E-=U);for(C=1,_=P[0];_>=10;_/=10,C++);C<U&&(E-=U-C)}return A.e=E,A.c=P,A}})(),w.sum=function(){for(var p=1,m=arguments,b=new w(m[0]);p<m.length;)b=b.plus(m[p++]);return b},r=(function(){var p="0123456789";function m(b,y,v,E){for(var F,_=[0],C,P=0,A=b.length;P<A;){for(C=_.length;C--;_[C]*=y);for(_[0]+=E.indexOf(b.charAt(P++)),F=0;F<_.length;F++)_[F]>v-1&&(_[F+1]==null&&(_[F+1]=0),_[F+1]+=_[F]/v|0,_[F]%=v)}return _.reverse()}return function(b,y,v,E,F){var _,C,P,A,I,N,z,H,te=b.indexOf("."),oe=a,$=s;for(te>=0&&(A=g,g=0,b=b.replace(".",""),H=new w(y),N=H.pow(b.length-te),g=A,H.c=m(St(Re(N.c),N.e,"0"),10,v,p),H.e=H.c.length),z=m(b,y,v,F?(_=S,p):(_=p,S)),P=A=z.length;z[--A]==0;z.pop());if(!z[0])return _.charAt(0);if(te<0?--P:(N.c=z,N.e=P,N.s=E,N=t(N,H,oe,$,v),z=N.c,I=N.r,P=N.e),C=P+oe+1,te=z[C],A=v/2,I=I||C<0||z[C+1]!=null,I=$<4?(te!=null||I)&&($==0||$==(N.s<0?3:2)):te>A||te==A&&($==4||I||$==6&&z[C-1]&1||$==(N.s<0?8:7)),C<1||!z[0])b=I?St(_.charAt(1),-oe,_.charAt(0)):_.charAt(0);else{if(z.length=C,I)for(--v;++z[--C]>v;)z[C]=0,C||(++P,z=[1].concat(z));for(A=z.length;!z[--A];);for(te=0,b="";te<=A;b+=_.charAt(z[te++]));b=St(b,P,_.charAt(0))}return b}})(),t=(function(){function p(y,v,E){var F,_,C,P,A=0,I=y.length,N=v%Vt,z=v/Vt|0;for(y=y.slice();I--;)C=y[I]%Vt,P=y[I]/Vt|0,F=z*C+P*N,_=N*C+F%Vt*Vt+A,A=(_/E|0)+(F/Vt|0)+z*P,y[I]=_%E;return A&&(y=[A].concat(y)),y}function m(y,v,E,F){var _,C;if(E!=F)C=E>F?1:-1;else for(_=C=0;_<E;_++)if(y[_]!=v[_]){C=y[_]>v[_]?1:-1;break}return C}function b(y,v,E,F){for(var _=0;E--;)y[E]-=_,_=y[E]<v[E]?1:0,y[E]=_*F+y[E]-v[E];for(;!y[0]&&y.length>1;y.splice(0,1));}return function(y,v,E,F,_){var C,P,A,I,N,z,H,te,oe,$,Y,le,Fi,La,Ia,Ke,fn,Ae=y.s==v.s?1:-1,de=y.c,re=v.c;if(!de||!de[0]||!re||!re[0])return new w(!y.s||!v.s||(de?re&&de[0]==re[0]:!re)?NaN:de&&de[0]==0||!re?Ae*0:Ae/0);for(te=new w(Ae),oe=te.c=[],P=y.e-v.e,Ae=E+P+1,_||(_=je,P=Be(y.e/U)-Be(v.e/U),Ae=Ae/U|0),A=0;re[A]==(de[A]||0);A++);if(re[A]>(de[A]||0)&&P--,Ae<0)oe.push(1),I=!0;else{for(La=de.length,Ke=re.length,A=0,Ae+=2,N=Oe(_/(re[0]+1)),N>1&&(re=p(re,N,_),de=p(de,N,_),Ke=re.length,La=de.length),Fi=Ke,$=de.slice(0,Ke),Y=$.length;Y<Ke;$[Y++]=0);fn=re.slice(),fn=[0].concat(fn),Ia=re[0],re[1]>=_/2&&Ia++;do{if(N=0,C=m(re,$,Ke,Y),C<0){if(le=$[0],Ke!=Y&&(le=le*_+($[1]||0)),N=Oe(le/Ia),N>1)for(N>=_&&(N=_-1),z=p(re,N,_),H=z.length,Y=$.length;m(z,$,H,Y)==1;)N--,b(z,Ke<H?fn:re,H,_),H=z.length,C=1;else N==0&&(C=N=1),z=re.slice(),H=z.length;if(H<Y&&(z=[0].concat(z)),b($,z,Y,_),Y=$.length,C==-1)for(;m(re,$,Ke,Y)<1;)N++,b($,Ke<Y?fn:re,Y,_),Y=$.length}else C===0&&(N++,$=[0]);oe[A++]=N,$[0]?$[Y++]=de[Fi]||0:($=[de[Fi]],Y=1)}while((Fi++<La||$[0]!=null)&&Ae--);I=$[0]!=null,oe[0]||oe.splice(0,1)}if(_==je){for(A=1,Ae=oe[0];Ae>=10;Ae/=10,A++);O(te,E+(te.e=A+P*U-1)+1,F,I)}else te.e=P,te.r=+I;return te}})();function k(p,m,b,y){var v,E,F,_,C;if(b==null?b=s:ee(b,0,8),!p.c)return p.toString();if(v=p.c[0],F=p.e,m==null)C=Re(p.c),C=y==1||y==2&&(F<=l||F>=f)?Wo(C,F):St(C,F,"0");else if(p=O(new w(p),m,b),E=p.e,C=Re(p.c),_=C.length,y==1||y==2&&(m<=E||E<=l)){for(;_<m;C+="0",_++);C=Wo(C,E)}else if(m-=F,C=St(C,E,"0"),E+1>_){if(--m>0)for(C+=".";m--;C+="0");}else if(m+=E-_,m>0)for(E+1==_&&(C+=".");m--;C+="0");return p.s<0&&v?"-"+C:C}function L(p,m){for(var b,y,v=1,E=new w(p[0]);v<p.length;v++)y=new w(p[v]),(!y.s||(b=br(E,y))===m||b===0&&E.s===m)&&(E=y);return E}function M(p,m,b){for(var y=1,v=m.length;!m[--v];m.pop());for(v=m[0];v>=10;v/=10,y++);return(b=y+b*U-1)>u?p.c=p.e=null:b<c?p.c=[p.e=0]:(p.e=b,p.c=m),p}n=(function(){var p=/^(-?)0([xbo])(?=\w[\w.]*$)/i,m=/^([^.]+)\.$/,b=/^\.([^.]+)$/,y=/^-?(Infinity|NaN)$/,v=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(E,F,_,C){var P,A=_?F:F.replace(v,"");if(y.test(A))E.s=isNaN(A)?null:A<0?-1:1;else{if(!_&&(A=A.replace(p,function(I,N,z){return P=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!C||C==P?N:I}),C&&(P=C,A=A.replace(m,"$1").replace(b,"0.$1")),F!=A))return new w(A,P);if(w.DEBUG)throw Error(xe+"Not a"+(C?" base "+C:"")+" number: "+F);E.s=null}E.c=E.e=null}})();function O(p,m,b,y){var v,E,F,_,C,P,A,I=p.c,N=_f;if(I){e:{for(v=1,_=I[0];_>=10;_/=10,v++);if(E=m-v,E<0)E+=U,F=m,C=I[P=0],A=Oe(C/N[v-F-1]%10);else if(P=vf((E+1)/U),P>=I.length)if(y){for(;I.length<=P;I.push(0));C=A=0,v=1,E%=U,F=E-U+1}else break e;else{for(C=_=I[P],v=1;_>=10;_/=10,v++);E%=U,F=E-U+v,A=F<0?0:Oe(C/N[v-F-1]%10)}if(y=y||m<0||I[P+1]!=null||(F<0?C:C%N[v-F-1]),y=b<4?(A||y)&&(b==0||b==(p.s<0?3:2)):A>5||A==5&&(b==4||y||b==6&&(E>0?F>0?C/N[v-F]:0:I[P-1])%10&1||b==(p.s<0?8:7)),m<1||!I[0])return I.length=0,y?(m-=p.e+1,I[0]=N[(U-m%U)%U],p.e=-m||0):I[0]=p.e=0,p;if(E==0?(I.length=P,_=1,P--):(I.length=P+1,_=N[U-E],I[P]=F>0?Oe(C/N[v-F]%N[F])*_:0),y)for(;;)if(P==0){for(E=1,F=I[0];F>=10;F/=10,E++);for(F=I[0]+=_,_=1;F>=10;F/=10,_++);E!=_&&(p.e++,I[0]==je&&(I[0]=1));break}else{if(I[P]+=_,I[P]!=je)break;I[P--]=0,_=1}for(E=I.length;I[--E]===0;I.pop());}p.e>u?p.c=p.e=null:p.e<c&&(p.c=[p.e=0])}return p}function D(p){var m,b=p.e;return b===null?p.toString():(m=Re(p.c),m=b<=l||b>=f?Wo(m,b):St(m,b,"0"),p.s<0?"-"+m:m)}return i.absoluteValue=i.abs=function(){var p=new w(this);return p.s<0&&(p.s=1),p},i.comparedTo=function(p,m){return br(this,new w(p,m))},i.decimalPlaces=i.dp=function(p,m){var b,y,v,E=this;if(p!=null)return ee(p,0,se),m==null?m=s:ee(m,0,8),O(new w(E),p+E.e+1,m);if(!(b=E.c))return null;if(y=((v=b.length-1)-Be(this.e/U))*U,v=b[v])for(;v%10==0;v/=10,y--);return y<0&&(y=0),y},i.dividedBy=i.div=function(p,m){return t(this,new w(p,m),a,s)},i.dividedToIntegerBy=i.idiv=function(p,m){return t(this,new w(p,m),0,1)},i.exponentiatedBy=i.pow=function(p,m){var b,y,v,E,F,_,C,P,A,I=this;if(p=new w(p),p.c&&!p.isInteger())throw Error(xe+"Exponent not an integer: "+D(p));if(m!=null&&(m=new w(m)),_=p.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!p.c||!p.c[0])return A=new w(Math.pow(+D(I),_?p.s*(2-Zo(p)):+D(p))),m?A.mod(m):A;if(C=p.s<0,m){if(m.c?!m.c[0]:!m.s)return new w(NaN);y=!C&&I.isInteger()&&m.isInteger(),y&&(I=I.mod(m))}else{if(p.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||_&&I.c[1]>=24e7:I.c[0]<8e13||_&&I.c[0]<=9999975e7)))return E=I.s<0&&Zo(p)?-0:0,I.e>-1&&(E=1/E),new w(C?1/E:E);g&&(E=vf(g/U+2))}for(_?(b=new w(.5),C&&(p.s=1),P=Zo(p)):(v=Math.abs(+D(p)),P=v%2),A=new w(o);;){if(P){if(A=A.times(I),!A.c)break;E?A.c.length>E&&(A.c.length=E):y&&(A=A.mod(m))}if(v){if(v=Oe(v/2),v===0)break;P=v%2}else if(p=p.times(b),O(p,p.e+1,1),p.e>14)P=Zo(p);else{if(v=+D(p),v===0)break;P=v%2}I=I.times(I),E?I.c&&I.c.length>E&&(I.c.length=E):y&&(I=I.mod(m))}return y?A:(C&&(A=o.div(A)),m?A.mod(m):E?O(A,g,s,F):A)},i.integerValue=function(p){var m=new w(this);return p==null?p=s:ee(p,0,8),O(m,m.e+1,p)},i.isEqualTo=i.eq=function(p,m){return br(this,new w(p,m))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(p,m){return br(this,new w(p,m))>0},i.isGreaterThanOrEqualTo=i.gte=function(p,m){return(m=br(this,new w(p,m)))===1||m===0},i.isInteger=function(){return!!this.c&&Be(this.e/U)>this.c.length-2},i.isLessThan=i.lt=function(p,m){return br(this,new w(p,m))<0},i.isLessThanOrEqualTo=i.lte=function(p,m){return(m=br(this,new w(p,m)))===-1||m===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(p,m){var b,y,v,E,F=this,_=F.s;if(p=new w(p,m),m=p.s,!_||!m)return new w(NaN);if(_!=m)return p.s=-m,F.plus(p);var C=F.e/U,P=p.e/U,A=F.c,I=p.c;if(!C||!P){if(!A||!I)return A?(p.s=-m,p):new w(I?F:NaN);if(!A[0]||!I[0])return I[0]?(p.s=-m,p):new w(A[0]?F:s==3?-0:0)}if(C=Be(C),P=Be(P),A=A.slice(),_=C-P){for((E=_<0)?(_=-_,v=A):(P=C,v=I),v.reverse(),m=_;m--;v.push(0));v.reverse()}else for(y=(E=(_=A.length)<(m=I.length))?_:m,_=m=0;m<y;m++)if(A[m]!=I[m]){E=A[m]<I[m];break}if(E&&(v=A,A=I,I=v,p.s=-p.s),m=(y=I.length)-(b=A.length),m>0)for(;m--;A[b++]=0);for(m=je-1;y>_;){if(A[--y]<I[y]){for(b=y;b&&!A[--b];A[b]=m);--A[b],A[y]+=je}A[y]-=I[y]}for(;A[0]==0;A.splice(0,1),--P);return A[0]?M(p,A,P):(p.s=s==3?-1:1,p.c=[p.e=0],p)},i.modulo=i.mod=function(p,m){var b,y,v=this;return p=new w(p,m),!v.c||!p.s||p.c&&!p.c[0]?new w(NaN):!p.c||v.c&&!v.c[0]?new w(v):(h==9?(y=p.s,p.s=1,b=t(v,p,0,3),p.s=y,b.s*=y):b=t(v,p,0,h),p=v.minus(b.times(p)),!p.c[0]&&h==1&&(p.s=v.s),p)},i.multipliedBy=i.times=function(p,m){var b,y,v,E,F,_,C,P,A,I,N,z,H,te,oe,$=this,Y=$.c,le=(p=new w(p,m)).c;if(!Y||!le||!Y[0]||!le[0])return!$.s||!p.s||Y&&!Y[0]&&!le||le&&!le[0]&&!Y?p.c=p.e=p.s=null:(p.s*=$.s,!Y||!le?p.c=p.e=null:(p.c=[0],p.e=0)),p;for(y=Be($.e/U)+Be(p.e/U),p.s*=$.s,C=Y.length,I=le.length,C<I&&(H=Y,Y=le,le=H,v=C,C=I,I=v),v=C+I,H=[];v--;H.push(0));for(te=je,oe=Vt,v=I;--v>=0;){for(b=0,N=le[v]%oe,z=le[v]/oe|0,F=C,E=v+F;E>v;)P=Y[--F]%oe,A=Y[F]/oe|0,_=z*P+A*N,P=N*P+_%oe*oe+H[E]+b,b=(P/te|0)+(_/oe|0)+z*A,H[E--]=P%te;H[E]=b}return b?++y:H.splice(0,1),M(p,H,y)},i.negated=function(){var p=new w(this);return p.s=-p.s||null,p},i.plus=function(p,m){var b,y=this,v=y.s;if(p=new w(p,m),m=p.s,!v||!m)return new w(NaN);if(v!=m)return p.s=-m,y.minus(p);var E=y.e/U,F=p.e/U,_=y.c,C=p.c;if(!E||!F){if(!_||!C)return new w(v/0);if(!_[0]||!C[0])return C[0]?p:new w(_[0]?y:v*0)}if(E=Be(E),F=Be(F),_=_.slice(),v=E-F){for(v>0?(F=E,b=C):(v=-v,b=_),b.reverse();v--;b.push(0));b.reverse()}for(v=_.length,m=C.length,v-m<0&&(b=C,C=_,_=b,m=v),v=0;m;)v=(_[--m]=_[m]+C[m]+v)/je|0,_[m]=je===_[m]?0:_[m]%je;return v&&(_=[v].concat(_),++F),M(p,_,F)},i.precision=i.sd=function(p,m){var b,y,v,E=this;if(p!=null&&p!==!!p)return ee(p,1,se),m==null?m=s:ee(m,0,8),O(new w(E),p,m);if(!(b=E.c))return null;if(v=b.length-1,y=v*U+1,v=b[v]){for(;v%10==0;v/=10,y--);for(v=b[0];v>=10;v/=10,y++);}return p&&E.e+1>y&&(y=E.e+1),y},i.shiftedBy=function(p){return ee(p,-wf,wf),this.times("1e"+p)},i.squareRoot=i.sqrt=function(){var p,m,b,y,v,E=this,F=E.c,_=E.s,C=E.e,P=a+4,A=new w("0.5");if(_!==1||!F||!F[0])return new w(!_||_<0&&(!F||F[0])?NaN:F?E:1/0);if(_=Math.sqrt(+D(E)),_==0||_==1/0?(m=Re(F),(m.length+C)%2==0&&(m+="0"),_=Math.sqrt(+m),C=Be((C+1)/2)-(C<0||C%2),_==1/0?m="5e"+C:(m=_.toExponential(),m=m.slice(0,m.indexOf("e")+1)+C),b=new w(m)):b=new w(_+""),b.c[0]){for(C=b.e,_=C+P,_<3&&(_=0);;)if(v=b,b=A.times(v.plus(t(E,v,P,1))),Re(v.c).slice(0,_)===(m=Re(b.c)).slice(0,_))if(b.e<C&&--_,m=m.slice(_-3,_+1),m=="9999"||!y&&m=="4999"){if(!y&&(O(v,v.e+a+2,0),v.times(v).eq(E))){b=v;break}P+=4,_+=4,y=1}else{(!+m||!+m.slice(1)&&m.charAt(0)=="5")&&(O(b,b.e+a+2,1),p=!b.times(b).eq(E));break}}return O(b,b.e+a+1,s,p)},i.toExponential=function(p,m){return p!=null&&(ee(p,0,se),p++),k(this,p,m,1)},i.toFixed=function(p,m){return p!=null&&(ee(p,0,se),p=p+this.e+1),k(this,p,m)},i.toFormat=function(p,m,b){var y,v=this;if(b==null)p!=null&&m&&typeof m=="object"?(b=m,m=null):p&&typeof p=="object"?(b=p,p=m=null):b=x;else if(typeof b!="object")throw Error(xe+"Argument not an object: "+b);if(y=v.toFixed(p,m),v.c){var E,F=y.split("."),_=+b.groupSize,C=+b.secondaryGroupSize,P=b.groupSeparator||"",A=F[0],I=F[1],N=v.s<0,z=N?A.slice(1):A,H=z.length;if(C&&(E=_,_=C,C=E,H-=E),_>0&&H>0){for(E=H%_||_,A=z.substr(0,E);E<H;E+=_)A+=P+z.substr(E,_);C>0&&(A+=P+z.slice(E)),N&&(A="-"+A)}y=I?A+(b.decimalSeparator||"")+((C=+b.fractionGroupSize)?I.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):I):A}return(b.prefix||"")+y+(b.suffix||"")},i.toFraction=function(p){var m,b,y,v,E,F,_,C,P,A,I,N,z=this,H=z.c;if(p!=null&&(_=new w(p),!_.isInteger()&&(_.c||_.s!==1)||_.lt(o)))throw Error(xe+"Argument "+(_.isInteger()?"out of range: ":"not an integer: ")+D(_));if(!H)return new w(z);for(m=new w(o),P=b=new w(o),y=C=new w(o),N=Re(H),E=m.e=N.length-z.e-1,m.c[0]=_f[(F=E%U)<0?U+F:F],p=!p||_.comparedTo(m)>0?E>0?m:P:_,F=u,u=1/0,_=new w(N),C.c[0]=0;A=t(_,m,0,1),v=b.plus(A.times(y)),v.comparedTo(p)!=1;)b=y,y=v,P=C.plus(A.times(v=P)),C=v,m=_.minus(A.times(v=m)),_=v;return v=t(p.minus(b),y,0,1),C=C.plus(v.times(P)),b=b.plus(v.times(y)),C.s=P.s=z.s,E=E*2,I=t(P,y,E,s).minus(z).abs().comparedTo(t(C,b,E,s).minus(z).abs())<1?[P,y]:[C,b],u=F,I},i.toNumber=function(){return+D(this)},i.toPrecision=function(p,m){return p!=null&&ee(p,1,se),k(this,p,m,2)},i.toString=function(p){var m,b=this,y=b.s,v=b.e;return v===null?y?(m="Infinity",y<0&&(m="-"+m)):m="NaN":(p==null?m=v<=l||v>=f?Wo(Re(b.c),v):St(Re(b.c),v,"0"):p===10&&T?(b=O(new w(b),a+v+1,s),m=St(Re(b.c),b.e,"0")):(ee(p,2,S.length,"Base"),m=r(St(Re(b.c),v,"0"),10,p,y,!0)),y<0&&b.c[0]&&(m="-"+m)),m},i.valueOf=i.toJSON=function(){return D(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,e!=null&&w.set(e),w}function Be(e){var t=e|0;return e>0||e===t?t:t-1}function Re(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=U-t.length;r--;t="0"+t);o+=t}for(i=o.length;o.charCodeAt(--i)===48;);return o.slice(0,i+1||1)}function br(e,t){var r,n,i=e.c,o=t.c,a=e.s,s=t.s,l=e.e,f=t.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=l==f,!i||!o)return n?0:!i^r?1:-1;if(!n)return l>f^r?1:-1;for(s=(l=i.length)<(f=o.length)?l:f,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return l==f?0:l>f^r?1:-1}function ee(e,t,r,n){if(e<t||e>r||e!==Oe(e))throw Error(xe+(n||"Argument")+(typeof e=="number"?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Zo(e){var t=e.c.length-1;return Be(e.e/U)==t&&e.c[t]%2!=0}function Wo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function St(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var kv=sp(),ct=kv,Mv=class{constructor(e){B(this,"key"),B(this,"left",null),B(this,"right",null),this.key=e}},di=class extends Mv{constructor(e){super(e)}},Lv=class{constructor(){B(this,"size",0),B(this,"modificationCount",0),B(this,"splayCount",0)}splay(e){let t=this.root;if(t==null)return this.compare(e,e),-1;let r=null,n=null,i=null,o=null,a=t,s=this.compare,l;for(;;)if(l=s(a.key,e),l>0){let f=a.left;if(f==null||(l=s(f.key,e),l>0&&(a.left=f.right,f.right=a,a=f,f=a.left,f==null)))break;r==null?n=a:r.left=a,r=a,a=f}else if(l<0){let f=a.right;if(f==null||(l=s(f.key,e),l<0&&(a.right=f.left,f.left=a,a=f,f=a.right,f==null)))break;i==null?o=a:i.right=a,i=a,a=f}else break;return i!=null&&(i.right=a.left,a.left=o),r!=null&&(r.left=a.right,a.right=n),this.root!==a&&(this.root=a,this.splayCount++),l}splayMin(e){let t=e,r=t.left;for(;r!=null;){let n=r;t.left=n.right,n.right=t,t=n,r=t.left}return t}splayMax(e){let t=e,r=t.right;for(;r!=null;){let n=r;t.right=n.left,n.left=t,t=n,r=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let r=this.root,n=r,i=r.left;if(this.size--,i==null)this.root=r.right;else{let o=r.right;r=this.splayMax(i),r.right=o,this.root=r}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;let r=this.root;if(r==null){this.root=e;return}t<0?(e.left=r,e.right=r.right,r.right=null):(e.right=r,e.left=r.left,r.left=null),this.root=e}_first(){let e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){let e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},i0,o0,oa=class gi extends Lv{constructor(t,r){super(),B(this,"root",null),B(this,"compare"),B(this,"validKey"),B(this,i0,"[object Set]"),this.compare=t??this.defaultCompare(),this.validKey=r??(n=>n!=null&&n!=null)}delete(t){return this.validKey(t)?this._delete(t)!=null:!1}deleteAll(t){for(let r of t)this.delete(r)}forEach(t){let r=this[Symbol.iterator](),n;for(;n=r.next(),!n.done;)t(n.value,n.value,this)}add(t){let r=this.splay(t);return r!=0&&this.addNewRoot(new di(t),r),this}addAndReturn(t){let r=this.splay(t);return r!=0&&this.addNewRoot(new di(t),r),this.root.key}addAll(t){for(let r of t)this.add(r)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)<0)return this.root.key;let n=this.root.left;if(n==null)return null;let i=n.right;for(;i!=null;)n=i,i=n.right;return n.key}firstAfter(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)>0)return this.root.key;let n=this.root.right;if(n==null)return null;let i=n.left;for(;i!=null;)n=i,i=n.left;return n.key}retainAll(t){let r=new gi(this.compare,this.validKey),n=this.modificationCount;for(let i of t){if(n!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(i)&&this.splay(i)==0&&r.add(this.root.key)}r.size!=this.size&&(this.root=r.root,this.size=r.size,this.modificationCount++)}lookup(t){return!this.validKey(t)||this.splay(t)!=0?null:this.root.key}intersection(t){let r=new gi(this.compare,this.validKey);for(let n of this)t.has(n)&&r.add(n);return r}difference(t){let r=new gi(this.compare,this.validKey);for(let n of this)t.has(n)||r.add(n);return r}union(t){let r=this.clone();return r.addAll(t),r}clone(){let t=new gi(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(t){if(t==null)return null;function r(i,o){let a,s;do{if(a=i.left,s=i.right,a!=null){let l=new di(a.key);o.left=l,r(a,l)}if(s!=null){let l=new di(s.key);o.right=l,i=s,o=l}}while(s!=null)}let n=new di(t.key);return r(t,n),n}toSet(){return this.clone()}entries(){return new Rv(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(o0=Symbol.iterator,i0=Symbol.toStringTag,o0)](){return new Iv(this.wrap())}},fp=class{constructor(e){B(this,"tree"),B(this,"path",new Array),B(this,"modificationCount",null),B(this,"splayCount"),this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;let e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let r=this.tree.getRoot();for(;r!=null;)this.path.push(r),r=r.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},Iv=class extends fp{getValue(e){return e.key}},Rv=class extends fp{getValue(e){return[e.key,e.key]}},lp=e=>()=>e,Lf=e=>{let t=e?(r,n)=>n.minus(r).abs().isLessThanOrEqualTo(e):lp(!1);return(r,n)=>t(r,n)?0:r.comparedTo(n)};function Ov(e){let t=e?(r,n,i,o,a)=>r.exponentiatedBy(2).isLessThanOrEqualTo(o.minus(n).exponentiatedBy(2).plus(a.minus(i).exponentiatedBy(2)).times(e)):lp(!1);return(r,n,i)=>{let o=r.x,a=r.y,s=i.x,l=i.y,f=a.minus(l).times(n.x.minus(s)).minus(o.minus(s).times(n.y.minus(l)));return t(f,o,a,s,l)?0:f.comparedTo(0)}}var Bv=e=>e,Dv=e=>{if(e){let t=new oa(Lf(e)),r=new oa(Lf(e)),n=(o,a)=>a.addAndReturn(o),i=o=>({x:n(o.x,t),y:n(o.y,r)});return i({x:new ct(0),y:new ct(0)}),i}return Bv},If=e=>({set:t=>{Ft=If(t)},reset:()=>If(e),compare:Lf(e),snap:Dv(e),orient:Ov(e)}),Ft=If(),hi=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Rf=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;let r=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,n=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,i=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,o=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:r,y:i},ur:{x:n,y:o}}},Jo=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),cp=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),aa=e=>cp(e,e).sqrt(),Nv=(e,t,r)=>{let n={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:r.x.minus(e.x),y:r.y.minus(e.y)};return Jo(i,n).div(aa(i)).div(aa(n))},zv=(e,t,r)=>{let n={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:r.x.minus(e.x),y:r.y.minus(e.y)};return cp(i,n).div(aa(i)).div(aa(n))},a0=(e,t,r)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(r.minus(e.y))),y:r},s0=(e,t,r)=>t.x.isZero()?null:{x:r,y:e.y.plus(t.y.div(t.x).times(r.minus(e.x)))},Uv=(e,t,r,n)=>{if(t.x.isZero())return s0(r,n,e.x);if(n.x.isZero())return s0(e,t,r.x);if(t.y.isZero())return a0(r,n,e.y);if(n.y.isZero())return a0(e,t,r.y);let i=Jo(t,n);if(i.isZero())return null;let o={x:r.x.minus(e.x),y:r.y.minus(e.y)},a=Jo(o,t).div(i),s=Jo(o,n).div(i),l=e.x.plus(s.times(t.x)),f=r.x.plus(a.times(n.x)),c=e.y.plus(s.times(t.y)),u=r.y.plus(a.times(n.y)),d=l.plus(f).div(2),h=c.plus(u).div(2);return{x:d,y:h}},lt=class up{constructor(t,r){B(this,"point"),B(this,"isLeft"),B(this,"segment"),B(this,"otherSE"),B(this,"consumedBy"),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=r}static compare(t,r){let n=up.comparePoints(t.point,r.point);return n!==0?n:(t.point!==r.point&&t.link(r),t.isLeft!==r.isLeft?t.isLeft?1:-1:sa.compare(t.segment,r.segment))}static comparePoints(t,r){return t.x.isLessThan(r.x)?-1:t.x.isGreaterThan(r.x)?1:t.y.isLessThan(r.y)?-1:t.y.isGreaterThan(r.y)?1:0}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");let r=t.point.events;for(let n=0,i=r.length;n<i;n++){let o=r[n];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}checkForConsuming(){let t=this.point.events.length;for(let r=0;r<t;r++){let n=this.point.events[r];if(n.segment.consumedBy===void 0)for(let i=r+1;i<t;i++){let o=this.point.events[i];o.consumedBy===void 0&&n.otherSE.point.events===o.otherSE.point.events&&n.segment.consume(o.segment)}}}getAvailableLinkedEvents(){let t=[];for(let r=0,n=this.point.events.length;r<n;r++){let i=this.point.events[r];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&t.push(i)}return t}getLeftmostComparator(t){let r=new Map,n=i=>{let o=i.otherSE;r.set(i,{sine:Nv(this.point,t.point,o.point),cosine:zv(this.point,t.point,o.point)})};return(i,o)=>{r.has(i)||n(i),r.has(o)||n(o);let{sine:a,cosine:s}=r.get(i),{sine:l,cosine:f}=r.get(o);return a.isGreaterThanOrEqualTo(0)&&l.isGreaterThanOrEqualTo(0)?s.isLessThan(f)?1:s.isGreaterThan(f)?-1:0:a.isLessThan(0)&&l.isLessThan(0)?s.isLessThan(f)?-1:s.isGreaterThan(f)?1:0:l.isLessThan(a)?-1:l.isGreaterThan(a)?1:0}}},qv=class Of{constructor(t){B(this,"events"),B(this,"poly"),B(this,"_isExteriorRing"),B(this,"_enclosingRing"),this.events=t;for(let r=0,n=t.length;r<n;r++)t[r].segment.ringOut=this;this.poly=null}static factory(t){let r=[];for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o.isInResult()||o.ringOut)continue;let a=null,s=o.leftSE,l=o.rightSE,f=[s],c=s.point,u=[];for(;a=s,s=l,f.push(s),s.point!==c;)for(;;){let d=s.getAvailableLinkedEvents();if(d.length===0){let x=f[0].point,S=f[f.length-1].point;throw new Error(`Unable to complete output ring starting at [${x.x}, ${x.y}]. Last matching segment found ends at [${S.x}, ${S.y}].`)}if(d.length===1){l=d[0].otherSE;break}let h=null;for(let x=0,S=u.length;x<S;x++)if(u[x].point===s.point){h=x;break}if(h!==null){let x=u.splice(h)[0],S=f.splice(x.index);S.unshift(S[0].otherSE),r.push(new Of(S.reverse()));continue}u.push({index:f.length,point:s.point});let g=s.getLeftmostComparator(a);l=d.sort(g)[0].otherSE;break}r.push(new Of(f))}return r}getGeom(){let t=this.events[0].point,r=[t];for(let f=1,c=this.events.length-1;f<c;f++){let u=this.events[f].point,d=this.events[f+1].point;Ft.orient(u,t,d)!==0&&(r.push(u),t=u)}if(r.length===1)return null;let n=r[0],i=r[1];Ft.orient(n,t,i)===0&&r.shift(),r.push(r[0]);let o=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:r.length-1,s=this.isExteriorRing()?r.length:-1,l=[];for(let f=a;f!=s;f+=o)l.push([r[f].x.toNumber(),r[f].y.toNumber()]);return l}isExteriorRing(){if(this._isExteriorRing===void 0){let t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let i=1,o=this.events.length;i<o;i++){let a=this.events[i];lt.compare(t,a)>0&&(t=a)}let r=t.segment.prevInResult(),n=r?r.prevInResult():null;for(;;){if(!r)return null;if(!n)return r.ringOut;if(n.ringOut!==r.ringOut)return n.ringOut?.enclosingRing()!==r.ringOut?r.ringOut:r.ringOut?.enclosingRing();r=n.prevInResult(),n=r?r.prevInResult():null}}},f0=class{constructor(e){B(this,"exteriorRing"),B(this,"interiorRings"),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=this.exteriorRing.getGeom();if(e===null)return null;let t=[e];for(let r=0,n=this.interiorRings.length;r<n;r++){let i=this.interiorRings[r].getGeom();i!==null&&t.push(i)}return t}},Gv=class{constructor(e){B(this,"rings"),B(this,"polys"),this.rings=e,this.polys=this._composePolys(e)}getGeom(){let e=[];for(let t=0,r=this.polys.length;t<r;t++){let n=this.polys[t].getGeom();n!==null&&e.push(n)}return e}_composePolys(e){let t=[];for(let r=0,n=e.length;r<n;r++){let i=e[r];if(!i.poly)if(i.isExteriorRing())t.push(new f0(i));else{let o=i.enclosingRing();o?.poly||t.push(new f0(o)),o?.poly?.addInterior(i)}}return t}},Vv=class{constructor(e,t=sa.compare){B(this,"queue"),B(this,"tree"),B(this,"segments"),this.queue=e,this.tree=new oa(t),this.segments=[]}process(e){let t=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),r;e.isLeft&&this.tree.add(t);let n=t,i=t;do n=this.tree.lastBefore(n);while(n!=null&&n.consumedBy!=null);do i=this.tree.firstAfter(i);while(i!=null&&i.consumedBy!=null);if(e.isLeft){let o=null;if(n){let s=n.getIntersection(t);if(s!==null&&(t.isAnEndpoint(s)||(o=s),!n.isAnEndpoint(s))){let l=this._splitSafely(n,s);for(let f=0,c=l.length;f<c;f++)r.push(l[f])}}let a=null;if(i){let s=i.getIntersection(t);if(s!==null&&(t.isAnEndpoint(s)||(a=s),!i.isAnEndpoint(s))){let l=this._splitSafely(i,s);for(let f=0,c=l.length;f<c;f++)r.push(l[f])}}if(o!==null||a!==null){let s=null;o===null?s=a:a===null?s=o:s=lt.comparePoints(o,a)<=0?o:a,this.queue.delete(t.rightSE),r.push(t.rightSE);let l=t.split(s);for(let f=0,c=l.length;f<c;f++)r.push(l[f])}r.length>0?(this.tree.delete(t),r.push(e)):(this.segments.push(t),t.prev=n)}else{if(n&&i){let o=n.getIntersection(i);if(o!==null){if(!n.isAnEndpoint(o)){let a=this._splitSafely(n,o);for(let s=0,l=a.length;s<l;s++)r.push(a[s])}if(!i.isAnEndpoint(o)){let a=this._splitSafely(i,o);for(let s=0,l=a.length;s<l;s++)r.push(a[s])}}}this.tree.delete(t)}return r}_splitSafely(e,t){this.tree.delete(e);let r=e.rightSE;this.queue.delete(r);let n=e.split(t);return n.push(r),e.consumedBy===void 0&&this.tree.add(e),n}},$v=class{constructor(){B(this,"type"),B(this,"numMultiPolys")}run(e,t,r){mi.type=e;let n=[new c0(t,!0)];for(let f=0,c=r.length;f<c;f++)n.push(new c0(r[f],!1));if(mi.numMultiPolys=n.length,mi.type==="difference"){let f=n[0],c=1;for(;c<n.length;)Rf(n[c].bbox,f.bbox)!==null?c++:n.splice(c,1)}if(mi.type==="intersection")for(let f=0,c=n.length;f<c;f++){let u=n[f];for(let d=f+1,h=n.length;d<h;d++)if(Rf(u.bbox,n[d].bbox)===null)return[]}let i=new oa(lt.compare);for(let f=0,c=n.length;f<c;f++){let u=n[f].getSweepEvents();for(let d=0,h=u.length;d<h;d++)i.add(u[d])}let o=new Vv(i),a=null;for(i.size!=0&&(a=i.first(),i.delete(a));a;){let f=o.process(a);for(let c=0,u=f.length;c<u;c++){let d=f[c];d.consumedBy===void 0&&i.add(d)}i.size!=0?(a=i.first(),i.delete(a)):a=null}Ft.reset();let s=qv.factory(o.segments);return new Gv(s).getGeom()}},mi=new $v,Bf=mi,Hv=0,sa=class ea{constructor(t,r,n,i){B(this,"id"),B(this,"leftSE"),B(this,"rightSE"),B(this,"rings"),B(this,"windings"),B(this,"ringOut"),B(this,"consumedBy"),B(this,"prev"),B(this,"_prevInResult"),B(this,"_beforeState"),B(this,"_afterState"),B(this,"_isInResult"),this.id=++Hv,this.leftSE=t,t.segment=this,t.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=t,this.rings=n,this.windings=i}static compare(t,r){let n=t.leftSE.point.x,i=r.leftSE.point.x,o=t.rightSE.point.x,a=r.rightSE.point.x;if(a.isLessThan(n))return 1;if(o.isLessThan(i))return-1;let s=t.leftSE.point.y,l=r.leftSE.point.y,f=t.rightSE.point.y,c=r.rightSE.point.y;if(n.isLessThan(i)){if(l.isLessThan(s)&&l.isLessThan(f))return 1;if(l.isGreaterThan(s)&&l.isGreaterThan(f))return-1;let u=t.comparePoint(r.leftSE.point);if(u<0)return 1;if(u>0)return-1;let d=r.comparePoint(t.rightSE.point);return d!==0?d:-1}if(n.isGreaterThan(i)){if(s.isLessThan(l)&&s.isLessThan(c))return-1;if(s.isGreaterThan(l)&&s.isGreaterThan(c))return 1;let u=r.comparePoint(t.leftSE.point);if(u!==0)return u;let d=t.comparePoint(r.rightSE.point);return d<0?1:d>0?-1:1}if(s.isLessThan(l))return-1;if(s.isGreaterThan(l))return 1;if(o.isLessThan(a)){let u=r.comparePoint(t.rightSE.point);if(u!==0)return u}if(o.isGreaterThan(a)){let u=t.comparePoint(r.rightSE.point);if(u<0)return 1;if(u>0)return-1}if(!o.eq(a)){let u=f.minus(s),d=o.minus(n),h=c.minus(l),g=a.minus(i);if(u.isGreaterThan(d)&&h.isLessThan(g))return 1;if(u.isLessThan(d)&&h.isGreaterThan(g))return-1}return o.isGreaterThan(a)?1:o.isLessThan(a)||f.isLessThan(c)?-1:f.isGreaterThan(c)?1:t.id<r.id?-1:t.id>r.id?1:0}static fromRing(t,r,n){let i,o,a,s=lt.comparePoints(t,r);if(s<0)i=t,o=r,a=1;else if(s>0)i=r,o=t,a=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);let l=new lt(i,!0),f=new lt(o,!1);return new ea(l,f,[n],[a])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let t=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t.isLessThan(r)?t:r},ur:{x:this.rightSE.point.x,y:t.isGreaterThan(r)?t:r}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(t){return t.x.eq(this.leftSE.point.x)&&t.y.eq(this.leftSE.point.y)||t.x.eq(this.rightSE.point.x)&&t.y.eq(this.rightSE.point.y)}comparePoint(t){return Ft.orient(this.leftSE.point,t,this.rightSE.point)}getIntersection(t){let r=this.bbox(),n=t.bbox(),i=Rf(r,n);if(i===null)return null;let o=this.leftSE.point,a=this.rightSE.point,s=t.leftSE.point,l=t.rightSE.point,f=hi(r,s)&&this.comparePoint(s)===0,c=hi(n,o)&&t.comparePoint(o)===0,u=hi(r,l)&&this.comparePoint(l)===0,d=hi(n,a)&&t.comparePoint(a)===0;if(c&&f)return d&&!u?a:!d&&u?l:null;if(c)return u&&o.x.eq(l.x)&&o.y.eq(l.y)?null:o;if(f)return d&&a.x.eq(s.x)&&a.y.eq(s.y)?null:s;if(d&&u)return null;if(d)return a;if(u)return l;let h=Uv(o,this.vector(),s,t.vector());return h===null||!hi(i,h)?null:Ft.snap(h)}split(t){let r=[],n=t.events!==void 0,i=new lt(t,!0),o=new lt(t,!1),a=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);let s=new ea(i,a,this.rings.slice(),this.windings.slice());return lt.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),lt.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}swapEvents(){let t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let r=0,n=this.windings.length;r<n;r++)this.windings[r]*=-1}consume(t){let r=this,n=t;for(;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;let i=ea.compare(r,n);if(i!==0){if(i>0){let o=r;r=n,n=o}if(r.prev===n){let o=r;r=n,n=o}for(let o=0,a=n.rings.length;o<a;o++){let s=n.rings[o],l=n.windings[o],f=r.rings.indexOf(s);f===-1?(r.rings.push(s),r.windings.push(l)):r.windings[f]+=l}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};let r=this._afterState.rings,n=this._afterState.windings,i=this._afterState.multiPolys;for(let s=0,l=this.rings.length;s<l;s++){let f=this.rings[s],c=this.windings[s],u=r.indexOf(f);u===-1?(r.push(f),n.push(c)):n[u]+=c}let o=[],a=[];for(let s=0,l=r.length;s<l;s++){if(n[s]===0)continue;let f=r[s],c=f.poly;if(a.indexOf(c)===-1)if(f.isExterior)o.push(c);else{a.indexOf(c)===-1&&a.push(c);let u=o.indexOf(f.poly);u!==-1&&o.splice(u,1)}}for(let s=0,l=o.length;s<l;s++){let f=o[s].multiPoly;i.indexOf(f)===-1&&i.push(f)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let t=this.beforeState().multiPolys,r=this.afterState().multiPolys;switch(Bf.type){case"union":{let n=t.length===0,i=r.length===0;this._isInResult=n!==i;break}case"intersection":{let n,i;t.length<r.length?(n=t.length,i=r.length):(n=r.length,i=t.length),this._isInResult=i===Bf.numMultiPolys&&n<i;break}case"xor":{let n=Math.abs(t.length-r.length);this._isInResult=n%2===1;break}case"difference":{let n=i=>i.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(r);break}}return this._isInResult}},l0=class{constructor(e,t,r){if(B(this,"poly"),B(this,"isExterior"),B(this,"segments"),B(this,"bbox"),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=Ft.snap({x:new ct(e[0][0]),y:new ct(e[0][1])});this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};let i=n;for(let o=1,a=e.length;o<a;o++){if(typeof e[o][0]!="number"||typeof e[o][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let s=Ft.snap({x:new ct(e[o][0]),y:new ct(e[o][1])});s.x.eq(i.x)&&s.y.eq(i.y)||(this.segments.push(sa.fromRing(i,s,this)),s.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=s.x),s.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=s.y),s.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=s.x),s.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=s.y),i=s)}(!n.x.eq(i.x)||!n.y.eq(i.y))&&this.segments.push(sa.fromRing(i,n,this))}getSweepEvents(){let e=[];for(let t=0,r=this.segments.length;t<r;t++){let n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},jv=class{constructor(e,t){if(B(this,"multiPoly"),B(this,"exteriorRing"),B(this,"interiorRings"),B(this,"bbox"),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new l0(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let r=1,n=e.length;r<n;r++){let i=new l0(e[r],this,!1);i.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=i.bbox.ur.y),this.interiorRings.push(i)}this.multiPoly=t}getSweepEvents(){let e=this.exteriorRing.getSweepEvents();for(let t=0,r=this.interiorRings.length;t<r;t++){let n=this.interiorRings[t].getSweepEvents();for(let i=0,o=n.length;i<o;i++)e.push(n[i])}return e}},c0=class{constructor(e,t){if(B(this,"isSubject"),B(this,"polys"),B(this,"bbox"),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new ct(Number.POSITIVE_INFINITY),y:new ct(Number.POSITIVE_INFINITY)},ur:{x:new ct(Number.NEGATIVE_INFINITY),y:new ct(Number.NEGATIVE_INFINITY)}};for(let r=0,n=e.length;r<n;r++){let i=new jv(e[r],this);i.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=i.bbox.ur.y),this.polys.push(i)}this.isSubject=t}getSweepEvents(){let e=[];for(let t=0,r=this.polys.length;t<r;t++){let n=this.polys[t].getSweepEvents();for(let i=0,o=n.length;i<o;i++)e.push(n[i])}return e}};var Zv=(e,...t)=>Bf.run("intersection",e,t),mC=Ft.set;function Wv(e,t={}){let r=[];if(X0(e,i=>{r.push(i.coordinates)}),r.length<2)throw new Error("Must specify at least 2 geometries");let n=Zv(r[0],...r.slice(1));return n.length===0?null:n.length===1?Hf(n[0],t.properties):j0(n,t.properties)}var dp=Wv,Yv={Point:hp,MultiPoint:Xv,LineString:pp,MultiLineString:Qv,Polygon:gp,MultiPolygon:Jv};function Kv(e,t){let[r,n,i,o]=t,a=Df([r,o]),s=Df([i,n]),l=[a,s];if(e.type==="GeometryCollection")throw new Error("Unsupported geometry type GeometryCollection");let f=Yv[e.type],c=f(e.coordinates,l);return{...e,coordinates:c}}function hp([e,t],[r,n]){let i=u0(r[0],n[0],e),o=u0(r[1],n[1],t);return[i,o]}function Wf(e,t){return e.map(r=>hp(Df(r),t))}function Xv(e,t){return Wf(e,t)}function pp(e,t){return Wf(e,t)}function Qv(e,t){return e.map(r=>pp(r,t))}function gp(e,t){return e.map(r=>Wf(r,t))}function Jv(e,t){return e.map(r=>gp(r,t))}function Df(e){return Mf(e)}function u0(e,t,r){return(r-e)/(t-e)}function e2(e,t,r){var n=e.length,i=Jr(e[0],t),o=[],a,s,l;let f,c;for(r||(r=[]),a=1;a<n;a++){for(f=e[a-1],c=e[a],s=l=Jr(c,t);;)if(i|s){if(i&s)break;i?(f=zf(f,c,i,t),i=Jr(f,t)):(c=zf(f,c,s,t),s=Jr(c,t))}else{o.push(f),s!==l?(o.push(c),a<n-1&&(r.push(o),o=[])):a===n-1&&o.push(c);break}i=l}return o.length&&r.push(o),r}function t2(e,t){var r,n,i,o,a,s,l;for(n=1;n<=8;n*=2){for(r=[],i=e[e.length-1],o=!(Jr(i,t)&n),a=0;a<e.length;a++)s=e[a],l=!(Jr(s,t)&n),l!==o&&r.push(zf(i,s,n,t)),l&&r.push(s),i=s,o=l;if(e=r,!e.length)break}return r}function zf(e,t,r,n){return r&8?[e[0]+(t[0]-e[0])*(n[3]-e[1])/(t[1]-e[1]),n[3]]:r&4?[e[0]+(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1]),n[1]]:r&2?[n[2],e[1]+(t[1]-e[1])*(n[2]-e[0])/(t[0]-e[0])]:r&1?[n[0],e[1]+(t[1]-e[1])*(n[0]-e[0])/(t[0]-e[0])]:null}function Jr(e,t){var r=0;return e[0]<t[0]?r|=1:e[0]>t[2]&&(r|=2),e[1]<t[1]?r|=4:e[1]>t[3]&&(r|=8),r}function r2(e,t){let r=Pt(e),n=r.type,i=e.type==="Feature"?e.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":{let a=[];return n==="LineString"&&(o=[o]),o.forEach(s=>{e2(s,t,a)}),a.length===1?$0(a[0],i):H0(a,i)}case"Polygon":return Hf(d0(o,t),i);case"MultiPolygon":return j0(o.map(a=>d0(a,t)),i);default:throw new Error("geometry "+n+" not supported")}}function d0(e,t){let r=[];for(let n of e){let i=t2(n,t);i.length>0&&((i[0][0]!==i[i.length-1][0]||i[0][1]!==i[i.length-1][1])&&i.push(i[0]),i.length>=4&&r.push(i))}return r}var h0=r2;function n2(e,t,r){let n=yv(e);if(!r||ap(n,r))return!0;let i=dp(wi([n,we(r)]));return i?t==="mvt"?Kv(i.geometry,e):i.geometry:!1}function i2(e,t,r){return mp(e,t,r)}function mp(e,t,r){let n=Gl(e);if(!r||ap(n,r))return!0;let i=dp(wi([we(n),we(r)]));if(!i)return!1;let o=ql(i.geometry,t);return new Set(o)}var o2=[-180,-90,0,90],a2=[0,-90,180,90];function s2(e,t){if(!t)return!0;let r=we(t),n=(0,Nf.polygonToCells)(h0(r,o2).geometry.coordinates,e,!0),i=(0,Nf.polygonToCells)(h0(r,a2).geometry.coordinates,e,!0);return new Set(n.concat(i))}var f2="__geomValue";function l2({tiles:e,tileFormat:t,spatialFilter:r,uniqueIdProperty:n,options:i}){let o=new Map;for(let a of e){if(a.isVisible===!1||!a.data)continue;let s=[a.bbox.west,a.bbox.south,a.bbox.east,a.bbox.north],l=n2(s,t,r);if(l===!1)continue;let f=l===!0?void 0:l;Sf({map:o,spatialFilter:f,data:a.data.points,type:"Point",bbox:s,tileFormat:t,uniqueIdProperty:n,options:i}),Sf({map:o,spatialFilter:f,data:a.data.lines,type:"LineString",bbox:s,tileFormat:t,uniqueIdProperty:n,options:i}),Sf({map:o,spatialFilter:f,data:a.data.polygons,type:"Polygon",bbox:s,tileFormat:t,uniqueIdProperty:n,options:i})}return Array.from(o.values())}function bp({map:e,data:t,startIndex:r,endIndex:n,type:i,bbox:o,tileFormat:a,uniqueIdProperty:s,storeGeometry:l,spatialFilter:f}){let c=d2(t,r),u=p2(c,s,e);if(!u||e.has(u))return;let d=null;if(l||f){let{positions:g}=t,x=m2(r,n,g);d=g2(x,i)}if(d&&f&&!J0(d,f))return;let h=h2(c);l&&d&&(h[f2]=a==="mvt"?hv(d,o):d),e.set(u,h)}function c2({map:e,data:t,spatialFilter:r,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}){let l=yp(t,n),f=s?.storeGeometry||!1;for(let c=0;c<l.length-1;c++){let u=l[c],d=l[c+1];bp({map:e,data:t,startIndex:u,endIndex:d,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,storeGeometry:f,spatialFilter:r})}}function yp(e,t){let r;switch(t){case"Polygon":r=e.primitivePolygonIndices;break;case"LineString":r=e.pathIndices;break;case"Point":r=y2(e);break;default:throw new Error(`Unsupported geometry type: ${t}`)}return r.value}function u2(e,t){return e.featureIds.value[t]}function d2(e,t){let r=u2(e,t),{properties:n,numericProps:i,fields:o}=e,a={uniqueId:o?.[r]?.id,properties:n[r],numericProps:{}};for(let s in i)a.numericProps[s]=i[s].value[t];return a}function h2(e){let{properties:t,numericProps:r}=e;return Object.assign({},t,r)}function p2(e,t,r){if(t)return Ef(e,t);if(e.uniqueId)return e.uniqueId;let n=r.size+1;return Ef(e,"cartodb_id")||Ef(e,"geoid")||n}function Ef(e,t){let{properties:r,numericProps:n}=e;return n[t]||r[t]}function g2(e,t){switch(t){case"Polygon":return{type:"Polygon",coordinates:[e]};case"LineString":return{type:"LineString",coordinates:e};case"Point":return{type:"Point",coordinates:e[0]};default:throw new Error("Invalid geometry type")}}function m2(e,t,r){let n=[];for(let i=e;i<t;i++)n.push(Array.from(r.value.subarray(i*r.size,(i+1)*r.size)));return n}function Sf({map:e,spatialFilter:t,data:r,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}){r?.properties.length&&(t?c2({map:e,data:r,spatialFilter:t,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}):b2({map:e,data:r,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}))}function b2({map:e,data:t,type:r,bbox:n,tileFormat:i,uniqueIdProperty:o,options:a}){let s=yp(t,r),l=a?.storeGeometry||!1;for(let f=0;f<s.length-1;f++){let c=s[f],u=s[f+1];bp({map:e,data:t,startIndex:c,endIndex:u,type:r,bbox:n,tileFormat:i,uniqueIdProperty:o,storeGeometry:l})}}function y2(e){let t=e.featureIds.value,r=t[t.length-1],n=t.constructor,i={value:new n(t.length+1),size:1};return i.value.set(t),i.value.set([r+1],t.length),i}function x2({tiles:e,spatialFilter:t,spatialDataColumn:r,spatialDataType:n}){let i=new Map,o=_2(n),a=w2(e,o),s=r||o;if(!a)return[];let l;o==="h3"&&(l=s2(a,t));for(let f of e)if(!(f.isVisible===!1||!f.data)){if(o==="quadbin"){let c=v2(f,o);l=mp(c,a,t)}l&&f.data.forEach(c=>{(l===!0||l.has(c.id))&&i.set(c.id,{...c.properties,[s]:c.id})})}return Array.from(i.values())}function v2(e,t){return t==="quadbin"?e.index.q:e.id}function w2(e,t){let r=e.find(n=>n.data?.length)?.data;if(r){if(t==="quadbin")return Number(ht(r[0].id));if(t==="h3")return(0,xp.getResolution)(r[0].id)}}function _2(e){switch(e){case"h3":return"h3";case"quadbin":return"quadbin";default:throw new Error("Unexpected spatial data type")}}var E2="3.4",_r="geom",vp=7e3,rn=.5,S2=1,Yf=4,Kf=6,wp="__aggregationValue",T2=`1 AS ${wp}`;function C2({tiles:e,...t}){let r={};for(let s of t.rasterMetadata.bands)r[s.name]={...s,nodata:Number(s.nodata)};if(e=e.filter(P2),e.length===0)return[];let n=ht(e[0].index.q),i=e[0].data.blockSize,o=n+BigInt(Math.log2(i)),a=new Map;for(let s of e){let l=s.index.q,f=i2(l,o,t.spatialFilter);if(f===!1)continue;let c=F2(l,o);for(let u=0;u<c.length;u++){if(f!==!0&&!f.has(c[u]))continue;let d={},h=!1;for(let g in s.data.cells.numericProps){let x=s.data.cells.numericProps[g].value[u],S=r[g];k2(x,S.nodata)&&(d[g]=s.data.cells.numericProps[g].value[u],h=!0)}h&&a.set(c[u],d)}}return Array.from(a.values())}function A2(e){return!!e.data?.cells}function P2(e){return!!(e.isVisible&&e.data?.cells?.numericProps)}function F2(e,t){let r=Wt(e),n=Number(t),i=2**(n-r.z),o=r.x*i,a=r.y*i,s=[];for(let l=0,f=i**2;l<f;l++){let c=o+l%i,u=a+Math.floor(l/i);s.push(un({x:c,y:u,z:n}))}return s}function k2(e,t){return Number.isNaN(e)?!1:t!==e}var vC=new Set(Object.values(Vf));function At(e){return Array.isArray(e)?e.map(t=>At(t)):typeof e!="object"?e:Object.entries(e).reduce((t,[r,n])=>(t[r.toLowerCase()]=typeof n=="object"&&n?At(n):n,t),{})}function Q(e,t){if(!e)throw new Error(t)}var _p=class bi extends Error{constructor(t){super(`${bi.NAME}: ${t}`),this.name=bi.NAME}static is(t){return t instanceof bi||t.message?.includes(bi.NAME)}};B(_p,"NAME","InvalidColumnError");var Uf=_p;function Ep(e){for(let t in e)return!1;return!0}var M2=e=>e!==null&&typeof e=="object",Sp=e=>M2(e)&&e.constructor==={}.constructor;function L2(e,...t){for(let r of t)for(let n in r)r[n]!==void 0&&(e[n]=r[n]);return e}function ua(e,t,r){let n=r.find(i=>i.name===t);return n&&n.type==="geometry"?"geo":e}function I2({tiles:e,spatialFilter:t,uniqueIdProperty:r,tileFormat:n,spatialDataColumn:i=_r,spatialDataType:o,rasterMetadata:a,storeGeometry:s=!1}){return o==="geo"?l2({tiles:e,tileFormat:n,spatialFilter:t,uniqueIdProperty:r,options:{storeGeometry:s}}):e.some(A2)?(Q(a,"Missing raster metadata"),C2({tiles:e,spatialFilter:t,spatialDataColumn:i,spatialDataType:o,rasterMetadata:a})):x2({tiles:e,spatialFilter:t,spatialDataColumn:i,spatialDataType:o})}var Er=class extends Error{constructor(e,t,r,n){let i="Failed to connect";r&&(i="Server returned: ",r.status===400?i+="Bad request":r.status===401||r.status===403?i+="Unauthorized access":r.status===404?i+="Not found":i+="Error",i+=` (${r.status}):`),i+=` ${e.message||e}`;let o=`${t.requestType} API request failed`;o+=`
168
+ `;var zb={...Os.ColumnLayer.defaultProps,extruded:!1,diskResolution:4,vertices:[[-.5,-.5],[.5,-.5],[.5,.5],[-.5,.5]]},wo=class extends ho(Os.ColumnLayer){getShaders(){let t=super.getShaders(),r=this.props.data,n=r.data.blockSize??Math.sqrt(r.length);return{...t,defines:{...t.defines,BLOCK_WIDTH:n},vs:kd}}initializeState(){this.getAttributeManager().addInstanced({instanceElevations:{size:1,transition:!0,accessor:"getElevation"},instanceFillColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getFillColor",defaultValue:[0,0,0,255]},instanceLineColors:{size:this.props.colorFormat.length,type:"unorm8",transition:!0,accessor:"getLineColor",defaultValue:[255,255,255,255]}})}};wo.layerName="RasterColumnLayer";function Ub(e,t){return e.data===t.data&&e.length===t.length}var Wn=class extends Ld.CompositeLayer{renderLayers(){let{data:t,getElevation:r,getFillColor:n,getLineColor:i,getLineWidth:o,tileIndex:a,updateTriggers:s}=this.props;if(!t||!a||t.length===0)return null;let f=t.blockSize??0,[l,c,u]=qa(a),d=[l,c],h=u/f,g=this.getSubLayerClass("column",wo),{highlightedObjectIndex:x,highlightColor:S}=this.state;return new g(this.props,this.getSubLayerProps({id:"cell",updateTriggers:s,getElevation:this.getSubLayerAccessor(r),getFillColor:this.getSubLayerAccessor(n),getLineColor:this.getSubLayerAccessor(i),getLineWidth:this.getSubLayerAccessor(o)}),{data:{data:t,length:f*f},dataComparator:Ub,offset:d,lineWidthScale:h,highlightedObjectIndex:x,highlightColor:S})}getSubLayerAccessor(t){return typeof t!="function"?super.getSubLayerAccessor(t):(r,n)=>{let{data:i,index:o}=n,a=i.data,s=Hf(a.cells,o);return t({properties:s},n)}}getPickingInfo(t){let r=super.getPickingInfo(t);return r.index!==-1&&(r.object=this.getSubLayerAccessor(n=>n)(void 0,{data:this.props,index:r.index})),r}_updateAutoHighlight(t){let{highlightedObjectIndex:r}=this.state,n=-1;if(t.index!==-1&&(n=t.index),r!==n){let{highlightColor:i}=this.props;typeof i=="function"&&(i=i(t)),this.setState({highlightColor:i,highlightedObjectIndex:n})}}};Wn.layerName="RasterLayer";Wn.defaultProps=zb;var _o=Wn;var Dd=q(dt(),1);var Nd=q(fn(),1);var qb={uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:BigUint64Array,int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:BigInt64Array,float32:Float32Array,float64:Float64Array},Ds=class e{static read(t,r){return t.readFields(e._readField,{name:"",type:"",data:null},r)}static _readField(t,r,n){if(t===1)r.name=n.readString();else if(t===2)r.type=n.readString();else if(t===3){let i=qb[r.type];if(!i)throw Error(`Invalid data type: ${r.type}`);r.data={};let{compression:o}=Gr;or(i,n,r.data,{compression:o})}}},Gr=class e{static read(t,r){return t.readFields(e._readField,{blockSize:0,bands:[]},r)}static _readField(t,r,n){t===1?r.blockSize=n.readVarint():t===2&&r.bands.push(Ds.read(n,n.readVarint()+n.pos))}};var Id="9.4.1",Rd="cartoRasterTile",Gb={cartoRasterTile:{metadata:null,workerUrl:Lt(Rd,Id)}},Vb={name:"CARTO Raster Tile",version:Id,id:Rd,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-raster-tile"],category:"geometry",parse:async(e,t)=>Md(e,t),parseSync:Md,worker:!0,options:Gb};function Md(e,t){let r=t?.cartoRasterTile?.metadata;if(!e||!r)return null;Gr.compression=r.compression;let n=Ut(e,Gr),{bands:i,blockSize:o}=n,a={};for(let s=0;s<i.length;s++){let{name:f,data:l}=i[s];a[f]=l}return{blockSize:o,cells:{numericProps:a,properties:[]}}}var Bd=Vb;(0,Nd.registerLoaders)([Bd]);var $b=e=>{let t=e.tile?.index?.q;return t?new _o(e,{tileIndex:t}):null},Hb={data:Te,refinementStrategy:"no-overlap",tileSize:512},Eo=class extends Un(Dd.TileLayer,vd){filterSubLayer(t){let{tile:r}=t.layer.props;return r?super.filterSubLayer(t):!0}};Eo.layerName="PostProcessTileLayer";var Yn=class extends Od.CompositeLayer{getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}}})}renderLayers(){let t=this.props.data;if(!t)return null;let{tiles:r,minzoom:n,maxzoom:i,raster_metadata:o}=t,a=this.getSubLayerClass("tile",Eo),s=this.getLoadOptions();return new a(this.props,{id:`raster-tile-layer-${this.props.id}`,data:r,TilesetClass:Qe,renderSubLayers:$b,minZoom:n,maxZoom:i,loadOptions:{...s,cartoRasterTile:{...s?.cartoRasterTile,metadata:o}}})}};Yn.layerName="RasterTileLayer";Yn.defaultProps=Hb;var Kn=Yn;var ah=q(fn(),1);var So=class e{static read(t,r){return t.readFields(e._readField,{properties:[],numericProps:{}},r)}static _readField(t,r,n){if(t===1)r.properties.push(xt.read(n,n.readVarint()+n.pos));else if(t===2){let i=vt.read(n,n.readVarint()+n.pos);r.numericProps[i.key]=i.value}}};var Ud="9.4.1",qd="cartoPropertiesTile",jb={cartoPropertiesTile:{workerUrl:Lt(qd,Ud)}},Zb={name:"CARTO Properties Tile",version:Ud,id:qd,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-properties-tile"],category:"geometry",worker:!0,parse:async(e,t)=>zd(e,t),parseSync:zd,options:jb};function zd(e,t){return e?Ut(e,So):null}var Gd=Zb;var Yd=q(Zd(),1);var Kd="9.4.1",Xd="cartoVectorTile",fy={cartoVectorTile:{workerUrl:Lt(Xd,Kd)}},cy={name:"CARTO Vector Tile",version:Kd,id:Xd,module:"carto",extensions:["pbf"],mimeTypes:["application/vnd.carto-vector-tile"],category:"geometry",parse:async(e,t)=>Wd(e,t),parseSync:Wd,worker:!0,options:fy};function uy(e,t,{startPosition:r,endPosition:n,indices:i}){let o=e.positions.size,a=r*o,s=n*o,f=e.positions.value.subarray(a,s),l=i.slice(1).map(u=>u-r),c=(0,Yd.default)(f,l,o);for(let u=0,d=c.length;u<d;++u)t.push(r+c[u])}function dy(e){let{polygonIndices:t,primitivePolygonIndices:r}=e,n=[],i=0;for(let o=0;o<t.value.length-1;o++){let a=t.value[o],s=t.value[o+1],f=r.value.indexOf(s),l=r.value.subarray(i,f);i=f,uy(e,n,{startPosition:a,endPosition:s,indices:l})}e.triangles={value:new Uint32Array(n),size:1}}function Wd(e,t){if(!e)return null;let r=Ut(e,io);return r.polygons&&!r.polygons.triangles&&dy(r.polygons),r}var Qd=cy;var Fo=q(eh(),1),$r=q(dt(),1),sh=q(kt(),1);var th="_carto_bbox";function hy(e){if(typeof e!="string")return null;let t=e.split(",");return t.length!==4?null:t.map(Number)}function Gs(e){return Math.log(Math.tan(Math.PI/4+e*Math.PI/360))}function py(e,t,r){let n=(e[0]-t.west)/(t.east-t.west),i=r.west+n*(r.east-r.west),o=Gs(e[1]),a=Gs(t.north),s=Gs(t.south),f=(a-o)/(a-s),l=r.south+f*(r.north-r.south);return[i,l]}function nh(e,t){let r=t?t in e.numericProps:!1,n=new Map;for(let c=0;c<e.pathIndices.value.length-1;c++){let u=e.pathIndices.value[c],d=e.featureIds.value[u],h;t===void 0?h=d:r?h=e.numericProps[t].value[u]:e.properties[d]&&t in e.properties[d]?h=e.properties[d][t]:h=void 0;let g=xy(e,c);(!n.has(h)||g>n.get(h).length)&&n.set(h,{index:c,length:g})}let i=[],o=[],a=[],s=[],f=za(n.size,e.numericProps),l=0;for(let[c,{index:u}]of n){let d=vy(e,u);i.push(...d);let h=e.pathIndices.value[u],g=e.featureIds.value[h];a.push(l),o.push(e.properties[g]),s.push(e.globalFeatureIds.value[h]),Ua(e.numericProps,f,h,l),l++}return hn(i,a,s,f,o)}function ih(e,t,r,n){let i=!!(n&&e.properties.length>0&&th in e.properties[0]),o=i?n:t,{west:a,south:s,east:f,north:l}=o,u=(f-a)*(l-s)*1e-4,d=[],h=[],g=[],x=[],S=za(e.polygonIndices.value.length-1,e.numericProps),T=i&&n!==t,w=0,k=0,{extruded:M}=r;for(let L=0;L<e.polygonIndices.value.length-1;L++){let B=e.polygonIndices.value[L],D=e.polygonIndices.value[L+1],p=null,m=null;if(i){let b=e.featureIds.value[B],y=hy(e.properties[b][th]);if(y){let[v,E,F,_]=y;if((F-v)*(_-E)>=u){let P=[(v+F)/2,(E+_)/2];rh(P,n)&&(m=T?py(P,n,t):P)}}}else{if(gy(e,L)<u)continue;m=by(e,L)}if(m){let b=-1,y=[0,0],v=!1;for(;k<e.triangles.value.length;){let F=e.triangles.value[k];if(F>=D)break;if(v){k+=3;continue}let _=e.triangles.value[k+1],C=e.triangles.value[k+2],P=e.positions.value.subarray(F*e.positions.size,F*e.positions.size+e.positions.size),A=e.positions.value.subarray(_*e.positions.size,_*e.positions.size+e.positions.size),I=e.positions.value.subarray(C*e.positions.size,C*e.positions.size+e.positions.size);if(my(m,P,A,I))v=!0;else{let N=oh(P,A,I);N>b&&(b=N,y=[(P[0]+A[0]+I[0])/3,(P[1]+A[1]+I[1])/3])}k+=3}let E=v?m:y;rh(E,t)&&(p=E)}if(p){d.push(...p);let b=e.featureIds.value[B];if(M){let y=r.getElevation(void 0,{data:e,index:b});d.push(y*r.elevationScale)}h.push(e.properties[b]),g.push(w),x.push(e.globalFeatureIds.value[B]),Ua(e.numericProps,S,B,w),w++}}return e.numericProps&&Object.keys(S).forEach(L=>{S[L].value=S[L].value.slice(0,w)}),hn(d,g,x,S,h,M?3:2)}function gy(e,t){let{positions:{value:r,size:n},polygonIndices:{value:i},triangles:{value:o}}=e,a=i[t],s=i[t+1],f=0,l=0;for(;l<o.length&&!(o[l]>=a);)l+=3;for(;l<o.length;){let c=o[l];if(c>=s)break;let u=o[l+1],d=o[l+2],h=r.subarray(c*n,c*n+n),g=r.subarray(u*n,u*n+n),x=r.subarray(d*n,d*n+n);f+=oh(h,g,x),l+=3}return f}function rh([e,t],{west:r,east:n,south:i,north:o}){return e>=r&&e<n&&t>=i&&t<o}function my(e,t,r,n){let i=Math.abs((r[0]-t[0])*(n[1]-t[1])-(n[0]-t[0])*(r[1]-t[1]))/2,o=Math.abs((t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1]))/2,a=Math.abs((r[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(r[1]-e[1]))/2,s=Math.abs((n[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(n[1]-e[1]))/2;return Math.abs(i-(o+a+s))<1e-10}function oh([e,t],[r,n],[i,o]){return Math.abs((e*(n-o)+r*(o-t)+i*(t-n))/2)}function by(e,t){let{positions:{value:r,size:n}}=e,i=n*e.polygonIndices.value[t],o=n*e.polygonIndices.value[t+1],a=1/0,s=1/0,f=-1/0,l=-1/0;for(let c=i;c<o;c+=n){let[u,d]=r.subarray(c,c+2);a=Math.min(a,u),s=Math.min(s,d),f=Math.max(f,u),l=Math.max(l,d)}return[(a+f)/2,(s+l)/2]}function yy(e,t){let{positions:{value:r}}=e,[n,i,o,a]=r.subarray(t,t+4);return Math.sqrt(Math.pow(o-n,2)+Math.pow(a-i,2))}function xy(e,t){let{positions:{size:r}}=e,n=r*e.pathIndices.value[t],i=r*e.pathIndices.value[t+1],o=0;for(let a=n;a<i;a+=r)o+=yy(e,a);return o}function vy(e,t){let{positions:{value:r},pathIndices:{value:n}}=e,i=n[t]*2,a=(n[t+1]*2-i)/2;if(a===2){let[f,l,c,u]=r.subarray(i,i+4);return[(f+c)/2,(l+u)/2]}let s=i+Math.floor(a/2)*2;return[r[s],r[s+1]]}(0,ah.registerLoaders)([Gd,Qd]);var wy={west:0,east:1,south:0,north:1},_y={...$r.MVTLayer.defaultProps,autoLabels:!1,data:Te,dataComparator:Te.equal,tileSize:512},ei=class extends $r.MVTLayer{constructor(...t){super(...t)}initializeState(){super.initializeState(),this.setState({binary:!0})}updateState(t){let{props:r}=t;if(r.data){super.updateState(t);let i=new URL(r.data.tiles[0]).searchParams.get("formatTiles")==="mvt";this.setState({mvt:i})}}getLoadOptions(){let t=this.props.data;return Ve(super.getLoadOptions(),{fetch:{headers:{Authorization:`Bearer ${t.accessToken}`}},gis:{format:"binary"}})}async getTileData(t){let r=this.props.data,{tiles:n,properties_tiles:i}=r,o=(0,$r._getURLFromTemplate)(n,t);if(!o)return Promise.reject("Invalid URL");let a=this.getLoadOptions(),{fetch:s}=this.props,{signal:f}=t,l=s(o,{propName:"data",layer:this,loadOptions:a,signal:f});if(!i)return await l;let c=(0,$r._getURLFromTemplate)(i,t);if(!c)return Promise.reject("Invalid properties URL");let u=s(c,{propName:"data",layer:this,loadOptions:a,signal:f}),[d,h]=await Promise.all([l,u]);return d?h?ud(d,h):d:null}renderSubLayers(t){if(t.data===null)return null;let r=t.tile.bbox,n=[],i={"points-text":{type:Zn,...t?._subLayerProps?.["points-text"],extensions:[new Fo.CollisionFilterExtension,...t.extensions||[],...t?._subLayerProps?.["points-text"]?.extensions||[]]}};if(this.state.mvt){let o={...t,_subLayerProps:{...t._subLayerProps,...i}};n.push(super.renderSubLayers(o))}else{let{west:o,south:a,east:s,north:f}=r,l=[new Fo.ClipExtension,...t.extensions||[]],c={clipBounds:[o,a,s,f]},u=h=>({[h]:{...c,...t?._subLayerProps?.[h],extensions:[...l,...t?._subLayerProps?.[h]?.extensions||[]]}}),d={...t,data:{...t.data,tileBbox:r},autoHighlight:!1,_subLayerProps:{...t._subLayerProps,...i,...u("polygons-fill"),...u("polygons-stroke"),...u("linestrings")}};n.push(new sh.GeoJsonLayer(d))}if(n[0]&&t.autoLabels){let o=Di();t.data.lines&&t.data.lines.positions.value.length>0&&(o.points=nh(t.data.lines,typeof t.autoLabels=="object"?t.autoLabels.uniqueIdProperty:void 0)),t.data.polygons&&t.data.polygons.positions.value.length>0&&(o.points=ih(t.data.polygons,this.state.mvt?wy:r,t,r)),n.push(n[0].clone({id:`${t.id}-labels`,data:o,pickable:!1,autoHighlight:!1}))}return n}renderLayers(){let t=super.renderLayers();if(!this.props.autoLabels)return t;let r=(t||[]).flat().filter(Boolean);return r.sort((n,i)=>{let o=n.id.includes("labels"),a=i.id.includes("labels");return o&&!a?1:!o&&a?-1:0}),r.map(n=>n.id.includes("labels")?n.clone({highlightedObjectIndex:-1}):n)}_isWGS84(){return this.state.mvt?super._isWGS84():!0}};ei.layerName="VectorTileLayer";ei.defaultProps=_y;var Hr=ei;var Dl=q(Yt(),1);var xp=q(Yt(),1);var Vs=class{add(t,r,n){if(typeof arguments[0]!="string")for(let i in arguments[0])this.add(i,arguments[0][i],arguments[1]);else(Array.isArray(t)?t:[t]).forEach(function(i){this[i]=this[i]||[],r&&this[i][n?"unshift":"push"](r)},this)}run(t,r){this[t]=this[t]||[],this[t].forEach(function(n){n.call(r&&r.context?r.context:r,r)})}},$s=class{constructor(t){this.jsep=t,this.registered={}}register(...t){t.forEach(r=>{if(typeof r!="object"||!r.name||!r.init)throw new Error("Invalid JSEP plugin format");this.registered[r.name]||(r.init(this.jsep),this.registered[r.name]=r)})}},be=class e{static get version(){return"1.4.0"}static toString(){return"JavaScript Expression Parser (JSEP) v"+e.version}static addUnaryOp(t){return e.max_unop_len=Math.max(t.length,e.max_unop_len),e.unary_ops[t]=1,e}static addBinaryOp(t,r,n){return e.max_binop_len=Math.max(t.length,e.max_binop_len),e.binary_ops[t]=r,n?e.right_associative.add(t):e.right_associative.delete(t),e}static addIdentifierChar(t){return e.additional_identifier_chars.add(t),e}static addLiteral(t,r){return e.literals[t]=r,e}static removeUnaryOp(t){return delete e.unary_ops[t],t.length===e.max_unop_len&&(e.max_unop_len=e.getMaxKeyLen(e.unary_ops)),e}static removeAllUnaryOps(){return e.unary_ops={},e.max_unop_len=0,e}static removeIdentifierChar(t){return e.additional_identifier_chars.delete(t),e}static removeBinaryOp(t){return delete e.binary_ops[t],t.length===e.max_binop_len&&(e.max_binop_len=e.getMaxKeyLen(e.binary_ops)),e.right_associative.delete(t),e}static removeAllBinaryOps(){return e.binary_ops={},e.max_binop_len=0,e}static removeLiteral(t){return delete e.literals[t],e}static removeAllLiterals(){return e.literals={},e}get char(){return this.expr.charAt(this.index)}get code(){return this.expr.charCodeAt(this.index)}constructor(t){this.expr=t,this.index=0}static parse(t){return new e(t).parse()}static getMaxKeyLen(t){return Math.max(0,...Object.keys(t).map(r=>r.length))}static isDecimalDigit(t){return t>=48&&t<=57}static binaryPrecedence(t){return e.binary_ops[t]||0}static isIdentifierStart(t){return t>=65&&t<=90||t>=97&&t<=122||t>=128&&!e.binary_ops[String.fromCharCode(t)]||e.additional_identifier_chars.has(String.fromCharCode(t))}static isIdentifierPart(t){return e.isIdentifierStart(t)||e.isDecimalDigit(t)}throwError(t){let r=new Error(t+" at character "+this.index);throw r.index=this.index,r.description=t,r}runHook(t,r){if(e.hooks[t]){let n={context:this,node:r};return e.hooks.run(t,n),n.node}return r}searchHook(t){if(e.hooks[t]){let r={context:this};return e.hooks[t].find(function(n){return n.call(r.context,r),r.node}),r.node}}gobbleSpaces(){let t=this.code;for(;t===e.SPACE_CODE||t===e.TAB_CODE||t===e.LF_CODE||t===e.CR_CODE;)t=this.expr.charCodeAt(++this.index);this.runHook("gobble-spaces")}parse(){this.runHook("before-all");let t=this.gobbleExpressions(),r=t.length===1?t[0]:{type:e.COMPOUND,body:t};return this.runHook("after-all",r)}gobbleExpressions(t){let r=[],n,i;for(;this.index<this.expr.length;)if(n=this.code,n===e.SEMCOL_CODE||n===e.COMMA_CODE)this.index++;else if(i=this.gobbleExpression())r.push(i);else if(this.index<this.expr.length){if(n===t)break;this.throwError('Unexpected "'+this.char+'"')}return r}gobbleExpression(){let t=this.searchHook("gobble-expression")||this.gobbleBinaryExpression();return this.gobbleSpaces(),this.runHook("after-expression",t)}gobbleBinaryOp(){this.gobbleSpaces();let t=this.expr.substr(this.index,e.max_binop_len),r=t.length;for(;r>0;){if(e.binary_ops.hasOwnProperty(t)&&(!e.isIdentifierStart(this.code)||this.index+t.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+t.length))))return this.index+=r,t;t=t.substr(0,--r)}return!1}gobbleBinaryExpression(){let t,r,n,i,o,a,s,f,l;if(a=this.gobbleToken(),!a||(r=this.gobbleBinaryOp(),!r))return a;for(o={value:r,prec:e.binaryPrecedence(r),right_a:e.right_associative.has(r)},s=this.gobbleToken(),s||this.throwError("Expected expression after "+r),i=[a,o,s];r=this.gobbleBinaryOp();){if(n=e.binaryPrecedence(r),n===0){this.index-=r.length;break}o={value:r,prec:n,right_a:e.right_associative.has(r)},l=r;let c=u=>o.right_a&&u.right_a?n>u.prec:n<=u.prec;for(;i.length>2&&c(i[i.length-2]);)s=i.pop(),r=i.pop().value,a=i.pop(),t={type:e.BINARY_EXP,operator:r,left:a,right:s},i.push(t);t=this.gobbleToken(),t||this.throwError("Expected expression after "+l),i.push(o,t)}for(f=i.length-1,t=i[f];f>1;)t={type:e.BINARY_EXP,operator:i[f-1].value,left:i[f-2],right:t},f-=2;return t}gobbleToken(){let t,r,n,i;if(this.gobbleSpaces(),i=this.searchHook("gobble-token"),i)return this.runHook("after-token",i);if(t=this.code,e.isDecimalDigit(t)||t===e.PERIOD_CODE)return this.gobbleNumericLiteral();if(t===e.SQUOTE_CODE||t===e.DQUOTE_CODE)i=this.gobbleStringLiteral();else if(t===e.OBRACK_CODE)i=this.gobbleArray();else{for(r=this.expr.substr(this.index,e.max_unop_len),n=r.length;n>0;){if(e.unary_ops.hasOwnProperty(r)&&(!e.isIdentifierStart(this.code)||this.index+r.length<this.expr.length&&!e.isIdentifierPart(this.expr.charCodeAt(this.index+r.length)))){this.index+=n;let o=this.gobbleToken();return o||this.throwError("missing unaryOp argument"),this.runHook("after-token",{type:e.UNARY_EXP,operator:r,argument:o,prefix:!0})}r=r.substr(0,--n)}e.isIdentifierStart(t)?(i=this.gobbleIdentifier(),e.literals.hasOwnProperty(i.name)?i={type:e.LITERAL,value:e.literals[i.name],raw:i.name}:i.name===e.this_str&&(i={type:e.THIS_EXP})):t===e.OPAREN_CODE&&(i=this.gobbleGroup())}return i?(i=this.gobbleTokenProperty(i),this.runHook("after-token",i)):this.runHook("after-token",!1)}gobbleTokenProperty(t){this.gobbleSpaces();let r=this.code;for(;r===e.PERIOD_CODE||r===e.OBRACK_CODE||r===e.OPAREN_CODE||r===e.QUMARK_CODE;){let n;if(r===e.QUMARK_CODE){if(this.expr.charCodeAt(this.index+1)!==e.PERIOD_CODE)break;n=!0,this.index+=2,this.gobbleSpaces(),r=this.code}this.index++,r===e.OBRACK_CODE?(t={type:e.MEMBER_EXP,computed:!0,object:t,property:this.gobbleExpression()},t.property||this.throwError('Unexpected "'+this.char+'"'),this.gobbleSpaces(),r=this.code,r!==e.CBRACK_CODE&&this.throwError("Unclosed ["),this.index++):r===e.OPAREN_CODE?t={type:e.CALL_EXP,arguments:this.gobbleArguments(e.CPAREN_CODE),callee:t}:(r===e.PERIOD_CODE||n)&&(n&&this.index--,this.gobbleSpaces(),t={type:e.MEMBER_EXP,computed:!1,object:t,property:this.gobbleIdentifier()}),n&&(t.optional=!0),this.gobbleSpaces(),r=this.code}return t}gobbleNumericLiteral(){let t="",r,n;for(;e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(this.code===e.PERIOD_CODE)for(t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);if(r=this.char,r==="e"||r==="E"){for(t+=this.expr.charAt(this.index++),r=this.char,(r==="+"||r==="-")&&(t+=this.expr.charAt(this.index++));e.isDecimalDigit(this.code);)t+=this.expr.charAt(this.index++);e.isDecimalDigit(this.expr.charCodeAt(this.index-1))||this.throwError("Expected exponent ("+t+this.char+")")}return n=this.code,e.isIdentifierStart(n)?this.throwError("Variable names cannot start with a number ("+t+this.char+")"):(n===e.PERIOD_CODE||t.length===1&&t.charCodeAt(0)===e.PERIOD_CODE)&&this.throwError("Unexpected period"),{type:e.LITERAL,value:parseFloat(t),raw:t}}gobbleStringLiteral(){let t="",r=this.index,n=this.expr.charAt(this.index++),i=!1;for(;this.index<this.expr.length;){let o=this.expr.charAt(this.index++);if(o===n){i=!0;break}else if(o==="\\")switch(o=this.expr.charAt(this.index++),o){case"n":t+=`
169
+ `;break;case"r":t+="\r";break;case"t":t+=" ";break;case"b":t+="\b";break;case"f":t+="\f";break;case"v":t+="\v";break;default:t+=o}else t+=o}return i||this.throwError('Unclosed quote after "'+t+'"'),{type:e.LITERAL,value:t,raw:this.expr.substring(r,this.index)}}gobbleIdentifier(){let t=this.code,r=this.index;for(e.isIdentifierStart(t)?this.index++:this.throwError("Unexpected "+this.char);this.index<this.expr.length&&(t=this.code,e.isIdentifierPart(t));)this.index++;return{type:e.IDENTIFIER,name:this.expr.slice(r,this.index)}}gobbleArguments(t){let r=[],n=!1,i=0;for(;this.index<this.expr.length;){this.gobbleSpaces();let o=this.code;if(o===t){n=!0,this.index++,t===e.CPAREN_CODE&&i&&i>=r.length&&this.throwError("Unexpected token "+String.fromCharCode(t));break}else if(o===e.COMMA_CODE){if(this.index++,i++,i!==r.length){if(t===e.CPAREN_CODE)this.throwError("Unexpected token ,");else if(t===e.CBRACK_CODE)for(let a=r.length;a<i;a++)r.push(null)}}else if(r.length!==i&&i!==0)this.throwError("Expected comma");else{let a=this.gobbleExpression();(!a||a.type===e.COMPOUND)&&this.throwError("Expected comma"),r.push(a)}}return n||this.throwError("Expected "+String.fromCharCode(t)),r}gobbleGroup(){this.index++;let t=this.gobbleExpressions(e.CPAREN_CODE);if(this.code===e.CPAREN_CODE)return this.index++,t.length===1?t[0]:t.length?{type:e.SEQUENCE_EXP,expressions:t}:!1;this.throwError("Unclosed (")}gobbleArray(){return this.index++,{type:e.ARRAY_EXP,elements:this.gobbleArguments(e.CBRACK_CODE)}}},Ey=new Vs;Object.assign(be,{hooks:Ey,plugins:new $s(be),COMPOUND:"Compound",SEQUENCE_EXP:"SequenceExpression",IDENTIFIER:"Identifier",MEMBER_EXP:"MemberExpression",LITERAL:"Literal",THIS_EXP:"ThisExpression",CALL_EXP:"CallExpression",UNARY_EXP:"UnaryExpression",BINARY_EXP:"BinaryExpression",ARRAY_EXP:"ArrayExpression",TAB_CODE:9,LF_CODE:10,CR_CODE:13,SPACE_CODE:32,PERIOD_CODE:46,COMMA_CODE:44,SQUOTE_CODE:39,DQUOTE_CODE:34,OPAREN_CODE:40,CPAREN_CODE:41,OBRACK_CODE:91,CBRACK_CODE:93,QUMARK_CODE:63,SEMCOL_CODE:59,COLON_CODE:58,unary_ops:{"-":1,"!":1,"~":1,"+":1},binary_ops:{"||":1,"??":1,"&&":2,"|":3,"^":4,"&":5,"==":6,"!=":6,"===":6,"!==":6,"<":7,">":7,"<=":7,">=":7,"<<":8,">>":8,">>>":8,"+":9,"-":9,"*":10,"/":10,"%":10,"**":11},right_associative:new Set(["**"]),additional_identifier_chars:new Set(["$","_"]),literals:{true:!0,false:!1,null:null},this_str:"this"});be.max_unop_len=be.getMaxKeyLen(be.unary_ops);be.max_binop_len=be.getMaxKeyLen(be.binary_ops);var jr=e=>new be(e).parse(),Sy=Object.getOwnPropertyNames(class{});Object.getOwnPropertyNames(be).filter(e=>!Sy.includes(e)&&jr[e]===void 0).forEach(e=>{jr[e]=be[e]});jr.Jsep=be;var Ty="ConditionalExpression",Cy={name:"ternary",init(e){e.hooks.add("after-expression",function(r){if(r.node&&this.code===e.QUMARK_CODE){this.index++;let n=r.node,i=this.gobbleExpression();if(i||this.throwError("Expected expression"),this.gobbleSpaces(),this.code===e.COLON_CODE){this.index++;let o=this.gobbleExpression();if(o||this.throwError("Expected expression"),r.node={type:Ty,test:n,consequent:i,alternate:o},n.operator&&e.binary_ops[n.operator]<=.9){let a=n;for(;a.right.operator&&e.binary_ops[a.right.operator]<=.9;)a=a.right;r.node.test=a.right,a.right=r.node,r.node=n}}else this.throwError("Expected :")}})}};jr.plugins.register(Cy);function ot(e,t){return e==null||t==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function Hs(e,t){return e==null||t==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function ko(e){let t,r,n;e.length!==2?(t=ot,r=(s,f)=>ot(e(s),f),n=(s,f)=>e(s)-f):(t=e===ot||e===Hs?e:Ay,r=e,n=e);function i(s,f,l=0,c=s.length){if(l<c){if(t(f,f)!==0)return c;do{let u=l+c>>>1;r(s[u],f)<0?l=u+1:c=u}while(l<c)}return l}function o(s,f,l=0,c=s.length){if(l<c){if(t(f,f)!==0)return c;do{let u=l+c>>>1;r(s[u],f)<=0?l=u+1:c=u}while(l<c)}return l}function a(s,f,l=0,c=s.length){let u=i(s,f,l,c-1);return u>l&&n(s[u-1],f)>-n(s[u],f)?u-1:u}return{left:i,center:a,right:o}}function Ay(){return 0}function ti(e){return e===null?NaN:+e}var lh=ko(ot),fh=lh.right,Py=lh.left,Fy=ko(ti).center,_t=fh;var Zr=class extends Map{constructor(t,r=My){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:r}}),t!=null)for(let[n,i]of t)this.set(n,i)}get(t){return super.get(ch(this,t))}has(t){return super.has(ch(this,t))}set(t,r){return super.set(ky(this,t),r)}delete(t){return super.delete(Ly(this,t))}};function ch({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function ky({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}function Ly({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}function My(e){return e!==null&&typeof e=="object"?e.valueOf():e}var Iy=Math.sqrt(50),Ry=Math.sqrt(10),By=Math.sqrt(2);function Lo(e,t,r){let n=(t-e)/Math.max(0,r),i=Math.floor(Math.log10(n)),o=n/Math.pow(10,i),a=o>=Iy?10:o>=Ry?5:o>=By?2:1,s,f,l;return i<0?(l=Math.pow(10,-i)/a,s=Math.round(e*l),f=Math.round(t*l),s/l<e&&++s,f/l>t&&--f,l=-l):(l=Math.pow(10,i)*a,s=Math.round(e/l),f=Math.round(t/l),s*l<e&&++s,f*l>t&&--f),f<s&&.5<=r&&r<2?Lo(e,t,r*2):[s,f,l]}function fr(e,t,r){if(t=+t,e=+e,r=+r,!(r>0))return[];if(e===t)return[e];let n=t<e,[i,o,a]=n?Lo(t,e,r):Lo(e,t,r);if(!(o>=i))return[];let s=o-i+1,f=new Array(s);if(n)if(a<0)for(let l=0;l<s;++l)f[l]=(o-l)/-a;else for(let l=0;l<s;++l)f[l]=(o-l)*a;else if(a<0)for(let l=0;l<s;++l)f[l]=(i+l)/-a;else for(let l=0;l<s;++l)f[l]=(i+l)*a;return f}function ri(e,t,r){return t=+t,e=+e,r=+r,Lo(e,t,r)[2]}function js(e,t,r){t=+t,e=+e,r=+r;let n=t<e,i=n?ri(t,e,r):ri(e,t,r);return(n?-1:1)*(i<0?1/-i:i)}function Zs(e,t,r=ti){if(!(!(n=e.length)||isNaN(t=+t))){if(t<=0||n<2)return+r(e[0],0,e);if(t>=1)return+r(e[n-1],n-1,e);var n,i=(n-1)*t,o=Math.floor(i),a=+r(e[o],o,e),s=+r(e[o+1],o+1,e);return a+(s-a)*(i-o)}}function Mo(e,t,r){e=+e,t=+t,r=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+r;for(var n=-1,i=Math.max(0,Math.ceil((t-e)/r))|0,o=new Array(i);++n<i;)o[n]=e+n*r;return o}function ce(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}var Ws=Symbol("implicit");function cr(){var e=new Zr,t=[],r=[],n=Ws;function i(o){let a=e.get(o);if(a===void 0){if(n!==Ws)return n;e.set(o,a=t.push(o)-1)}return r[a%r.length]}return i.domain=function(o){if(!arguments.length)return t.slice();t=[],e=new Zr;for(let a of o)e.has(a)||e.set(a,t.push(a)-1);return i},i.range=function(o){return arguments.length?(r=Array.from(o),i):r.slice()},i.unknown=function(o){return arguments.length?(n=o,i):n},i.copy=function(){return cr(t,r).unknown(n)},ce.apply(i,arguments),i}function Io(){var e=cr().unknown(void 0),t=e.domain,r=e.range,n=0,i=1,o,a,s=!1,f=0,l=0,c=.5;delete e.unknown;function u(){var d=t().length,h=i<n,g=h?i:n,x=h?n:i;o=(x-g)/Math.max(1,d-f+l*2),s&&(o=Math.floor(o)),g+=(x-g-o*(d-f))*c,a=o*(1-f),s&&(g=Math.round(g),a=Math.round(a));var S=Mo(d).map(function(T){return g+o*T});return r(h?S.reverse():S)}return e.domain=function(d){return arguments.length?(t(d),u()):t()},e.range=function(d){return arguments.length?([n,i]=d,n=+n,i=+i,u()):[n,i]},e.rangeRound=function(d){return[n,i]=d,n=+n,i=+i,s=!0,u()},e.bandwidth=function(){return a},e.step=function(){return o},e.round=function(d){return arguments.length?(s=!!d,u()):s},e.padding=function(d){return arguments.length?(f=Math.min(1,l=+d),u()):f},e.paddingInner=function(d){return arguments.length?(f=Math.min(1,d),u()):f},e.paddingOuter=function(d){return arguments.length?(l=+d,u()):l},e.align=function(d){return arguments.length?(c=Math.max(0,Math.min(1,d)),u()):c},e.copy=function(){return Io(t(),[n,i]).round(s).paddingInner(f).paddingOuter(l).align(c)},ce.apply(u(),arguments)}function uh(e){var t=e.copy;return e.padding=e.paddingOuter,delete e.paddingInner,delete e.paddingOuter,e.copy=function(){return uh(t())},e}function Ys(){return uh(Io.apply(null,arguments).paddingInner(1))}function Ro(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Ks(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function oi(){}var ni=.7,Do=1/ni,Wr="\\s*([+-]?\\d+)\\s*",ii="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",at="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Oy=/^#([0-9a-f]{3,8})$/,Dy=new RegExp(`^rgb\\(${Wr},${Wr},${Wr}\\)$`),Ny=new RegExp(`^rgb\\(${at},${at},${at}\\)$`),zy=new RegExp(`^rgba\\(${Wr},${Wr},${Wr},${ii}\\)$`),Uy=new RegExp(`^rgba\\(${at},${at},${at},${ii}\\)$`),qy=new RegExp(`^hsl\\(${ii},${at},${at}\\)$`),Gy=new RegExp(`^hsla\\(${ii},${at},${at},${ii}\\)$`),dh={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Ro(oi,qt,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:hh,formatHex:hh,formatHex8:Vy,formatHsl:$y,formatRgb:ph,toString:ph});function hh(){return this.rgb().formatHex()}function Vy(){return this.rgb().formatHex8()}function $y(){return vh(this).formatHsl()}function ph(){return this.rgb().formatRgb()}function qt(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Oy.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?gh(t):r===3?new ye(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Bo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Bo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Dy.exec(e))?new ye(t[1],t[2],t[3],1):(t=Ny.exec(e))?new ye(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=zy.exec(e))?Bo(t[1],t[2],t[3],t[4]):(t=Uy.exec(e))?Bo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=qy.exec(e))?yh(t[1],t[2]/100,t[3]/100,1):(t=Gy.exec(e))?yh(t[1],t[2]/100,t[3]/100,t[4]):dh.hasOwnProperty(e)?gh(dh[e]):e==="transparent"?new ye(NaN,NaN,NaN,0):null}function gh(e){return new ye(e>>16&255,e>>8&255,e&255,1)}function Bo(e,t,r,n){return n<=0&&(e=t=r=NaN),new ye(e,t,r,n)}function Hy(e){return e instanceof oi||(e=qt(e)),e?(e=e.rgb(),new ye(e.r,e.g,e.b,e.opacity)):new ye}function Yr(e,t,r,n){return arguments.length===1?Hy(e):new ye(e,t,r,n??1)}function ye(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}Ro(ye,Yr,Ks(oi,{brighter(e){return e=e==null?Do:Math.pow(Do,e),new ye(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?ni:Math.pow(ni,e),new ye(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ye(dr(this.r),dr(this.g),dr(this.b),No(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:mh,formatHex:mh,formatHex8:jy,formatRgb:bh,toString:bh}));function mh(){return`#${ur(this.r)}${ur(this.g)}${ur(this.b)}`}function jy(){return`#${ur(this.r)}${ur(this.g)}${ur(this.b)}${ur((isNaN(this.opacity)?1:this.opacity)*255)}`}function bh(){let e=No(this.opacity);return`${e===1?"rgb(":"rgba("}${dr(this.r)}, ${dr(this.g)}, ${dr(this.b)}${e===1?")":`, ${e})`}`}function No(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function dr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function ur(e){return e=dr(e),(e<16?"0":"")+e.toString(16)}function yh(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new $e(e,t,r,n)}function vh(e){if(e instanceof $e)return new $e(e.h,e.s,e.l,e.opacity);if(e instanceof oi||(e=qt(e)),!e)return new $e;if(e instanceof $e)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,f=(o+i)/2;return s?(t===o?a=(r-n)/s+(r<n)*6:r===o?a=(n-t)/s+2:a=(t-r)/s+4,s/=f<.5?o+i:2-o-i,a*=60):s=f>0&&f<1?0:a,new $e(a,s,f,e.opacity)}function wh(e,t,r,n){return arguments.length===1?vh(e):new $e(e,t,r,n??1)}function $e(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}Ro($e,wh,Ks(oi,{brighter(e){return e=e==null?Do:Math.pow(Do,e),new $e(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?ni:Math.pow(ni,e),new $e(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ye(Xs(e>=240?e-240:e+120,i,n),Xs(e,i,n),Xs(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new $e(xh(this.h),Oo(this.s),Oo(this.l),No(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=No(this.opacity);return`${e===1?"hsl(":"hsla("}${xh(this.h)}, ${Oo(this.s)*100}%, ${Oo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function xh(e){return e=(e||0)%360,e<0?e+360:e}function Oo(e){return Math.max(0,Math.min(1,e||0))}function Xs(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}function Qs(e,t,r,n,i){var o=e*e,a=o*e;return((1-3*e+3*o-a)*t+(4-6*o+3*a)*r+(1+3*e+3*o-3*a)*n+a*i)/6}function _h(e){var t=e.length-1;return function(r){var n=r<=0?r=0:r>=1?(r=1,t-1):Math.floor(r*t),i=e[n],o=e[n+1],a=n>0?e[n-1]:2*i-o,s=n<t-1?e[n+2]:2*o-i;return Qs((r-n/t)*t,a,i,o,s)}}function Eh(e){var t=e.length;return function(r){var n=Math.floor(((r%=1)<0?++r:r)*t),i=e[(n+t-1)%t],o=e[n%t],a=e[(n+1)%t],s=e[(n+2)%t];return Qs((r-n/t)*t,i,o,a,s)}}var ai=e=>()=>e;function Zy(e,t){return function(r){return e+r*t}}function Wy(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(n){return Math.pow(e+n*t,r)}}function Sh(e){return(e=+e)==1?zo:function(t,r){return r-t?Wy(t,r,e):ai(isNaN(t)?r:t)}}function zo(e,t){var r=t-e;return r?Zy(e,r):ai(isNaN(e)?t:e)}var Js=(function e(t){var r=Sh(t);function n(i,o){var a=r((i=Yr(i)).r,(o=Yr(o)).r),s=r(i.g,o.g),f=r(i.b,o.b),l=zo(i.opacity,o.opacity);return function(c){return i.r=a(c),i.g=s(c),i.b=f(c),i.opacity=l(c),i+""}}return n.gamma=e,n})(1);function Th(e){return function(t){var r=t.length,n=new Array(r),i=new Array(r),o=new Array(r),a,s;for(a=0;a<r;++a)s=Yr(t[a]),n[a]=s.r||0,i[a]=s.g||0,o[a]=s.b||0;return n=e(n),i=e(i),o=e(o),s.opacity=1,function(f){return s.r=n(f),s.g=i(f),s.b=o(f),s+""}}}var d9=Th(_h),h9=Th(Eh);function Ch(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,n=t.slice(),i;return function(o){for(i=0;i<r;++i)n[i]=e[i]*(1-o)+t[i]*o;return n}}function Ah(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Ph(e,t){var r=t?t.length:0,n=e?Math.min(r,e.length):0,i=new Array(n),o=new Array(r),a;for(a=0;a<n;++a)i[a]=hr(e[a],t[a]);for(;a<r;++a)o[a]=t[a];return function(s){for(a=0;a<n;++a)o[a]=i[a](s);return o}}function Fh(e,t){var r=new Date;return e=+e,t=+t,function(n){return r.setTime(e*(1-n)+t*n),r}}function Gt(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function kh(e,t){var r={},n={},i;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(i in t)i in e?r[i]=hr(e[i],t[i]):n[i]=t[i];return function(o){for(i in r)n[i]=r[i](o);return n}}var tl=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,el=new RegExp(tl.source,"g");function Yy(e){return function(){return e}}function Ky(e){return function(t){return e(t)+""}}function Lh(e,t){var r=tl.lastIndex=el.lastIndex=0,n,i,o,a=-1,s=[],f=[];for(e=e+"",t=t+"";(n=tl.exec(e))&&(i=el.exec(t));)(o=i.index)>r&&(o=t.slice(r,o),s[a]?s[a]+=o:s[++a]=o),(n=n[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,f.push({i:a,x:Gt(n,i)})),r=el.lastIndex;return r<t.length&&(o=t.slice(r),s[a]?s[a]+=o:s[++a]=o),s.length<2?f[0]?Ky(f[0].x):Yy(t):(t=f.length,function(l){for(var c=0,u;c<t;++c)s[(u=f[c]).i]=u.x(l);return s.join("")})}function hr(e,t){var r=typeof t,n;return t==null||r==="boolean"?ai(t):(r==="number"?Gt:r==="string"?(n=qt(t))?(t=n,Js):Lh:t instanceof qt?Js:t instanceof Date?Fh:Ah(t)?Ch:Array.isArray(t)?Ph:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?kh:Gt)(e,t)}function rl(e,t){return e=+e,t=+t,function(r){return Math.round(e*(1-r)+t*r)}}function nl(e){return function(){return e}}function il(e){return+e}var Mh=[0,1];function He(e){return e}function ol(e,t){return(t-=e=+e)?function(r){return(r-e)/t}:nl(isNaN(t)?NaN:.5)}function Xy(e,t){var r;return e>t&&(r=e,e=t,t=r),function(n){return Math.max(e,Math.min(t,n))}}function Qy(e,t,r){var n=e[0],i=e[1],o=t[0],a=t[1];return i<n?(n=ol(i,n),o=r(a,o)):(n=ol(n,i),o=r(o,a)),function(s){return o(n(s))}}function Jy(e,t,r){var n=Math.min(e.length,t.length)-1,i=new Array(n),o=new Array(n),a=-1;for(e[n]<e[0]&&(e=e.slice().reverse(),t=t.slice().reverse());++a<n;)i[a]=ol(e[a],e[a+1]),o[a]=r(t[a],t[a+1]);return function(s){var f=_t(e,s,1,n)-1;return o[f](i[f](s))}}function Kr(e,t){return t.domain(e.domain()).range(e.range()).interpolate(e.interpolate()).clamp(e.clamp()).unknown(e.unknown())}function si(){var e=Mh,t=Mh,r=hr,n,i,o,a=He,s,f,l;function c(){var d=Math.min(e.length,t.length);return a!==He&&(a=Xy(e[0],e[d-1])),s=d>2?Jy:Qy,f=l=null,u}function u(d){return d==null||isNaN(d=+d)?o:(f||(f=s(e.map(n),t,r)))(n(a(d)))}return u.invert=function(d){return a(i((l||(l=s(t,e.map(n),Gt)))(d)))},u.domain=function(d){return arguments.length?(e=Array.from(d,il),c()):e.slice()},u.range=function(d){return arguments.length?(t=Array.from(d),c()):t.slice()},u.rangeRound=function(d){return t=Array.from(d),r=rl,c()},u.clamp=function(d){return arguments.length?(a=d?!0:He,c()):a!==He},u.interpolate=function(d){return arguments.length?(r=d,c()):r},u.unknown=function(d){return arguments.length?(o=d,u):o},function(d,h){return n=d,i=h,c()}}function al(){return si()(He,He)}function Ih(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function pr(e,t){if((r=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var r,n=e.slice(0,r);return[n.length>1?n[0]+n.slice(2):n,+e.slice(r+1)]}function st(e){return e=pr(Math.abs(e)),e?e[1]:NaN}function Rh(e,t){return function(r,n){for(var i=r.length,o=[],a=0,s=e[0],f=0;i>0&&s>0&&(f+s+1>n&&(s=Math.max(1,n-f)),o.push(r.substring(i-=s,i+s)),!((f+=s+1)>n));)s=e[a=(a+1)%e.length];return o.reverse().join(t)}}function Bh(e){return function(t){return t.replace(/[0-9]/g,function(r){return e[+r]})}}var ex=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function lt(e){if(!(t=ex.exec(e)))throw new Error("invalid format: "+e);var t;return new Uo({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}lt.prototype=Uo.prototype;function Uo(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}Uo.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function Oh(e){e:for(var t=e.length,r=1,n=-1,i;r<t;++r)switch(e[r]){case".":n=i=r;break;case"0":n===0&&(n=r),i=r;break;default:if(!+e[r])break e;n>0&&(n=0);break}return n>0?e.slice(0,n)+e.slice(i+1):e}var sl;function Dh(e,t){var r=pr(e,t);if(!r)return e+"";var n=r[0],i=r[1],o=i-(sl=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,a=n.length;return o===a?n:o>a?n+new Array(o-a+1).join("0"):o>0?n.slice(0,o)+"."+n.slice(o):"0."+new Array(1-o).join("0")+pr(e,Math.max(0,t+o-1))[0]}function ll(e,t){var r=pr(e,t);if(!r)return e+"";var n=r[0],i=r[1];return i<0?"0."+new Array(-i).join("0")+n:n.length>i+1?n.slice(0,i+1)+"."+n.slice(i+1):n+new Array(i-n.length+2).join("0")}var fl={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:Ih,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>ll(e*100,t),r:ll,s:Dh,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function cl(e){return e}var Nh=Array.prototype.map,zh=["y","z","a","f","p","n","\xB5","m","","k","M","G","T","P","E","Z","Y"];function Uh(e){var t=e.grouping===void 0||e.thousands===void 0?cl:Rh(Nh.call(e.grouping,Number),e.thousands+""),r=e.currency===void 0?"":e.currency[0]+"",n=e.currency===void 0?"":e.currency[1]+"",i=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?cl:Bh(Nh.call(e.numerals,String)),a=e.percent===void 0?"%":e.percent+"",s=e.minus===void 0?"\u2212":e.minus+"",f=e.nan===void 0?"NaN":e.nan+"";function l(u){u=lt(u);var d=u.fill,h=u.align,g=u.sign,x=u.symbol,S=u.zero,T=u.width,w=u.comma,k=u.precision,M=u.trim,L=u.type;L==="n"?(w=!0,L="g"):fl[L]||(k===void 0&&(k=12),M=!0,L="g"),(S||d==="0"&&h==="=")&&(S=!0,d="0",h="=");var B=x==="$"?r:x==="#"&&/[boxX]/.test(L)?"0"+L.toLowerCase():"",D=x==="$"?n:/[%p]/.test(L)?a:"",p=fl[L],m=/[defgprs%]/.test(L);k=k===void 0?6:/[gprs]/.test(L)?Math.max(1,Math.min(21,k)):Math.max(0,Math.min(20,k));function b(y){var v=B,E=D,F,_,C;if(L==="c")E=p(y)+E,y="";else{y=+y;var P=y<0||1/y<0;if(y=isNaN(y)?f:p(Math.abs(y),k),M&&(y=Oh(y)),P&&+y==0&&g!=="+"&&(P=!1),v=(P?g==="("?g:s:g==="-"||g==="("?"":g)+v,E=(L==="s"?zh[8+sl/3]:"")+E+(P&&g==="("?")":""),m){for(F=-1,_=y.length;++F<_;)if(C=y.charCodeAt(F),48>C||C>57){E=(C===46?i+y.slice(F+1):y.slice(F))+E,y=y.slice(0,F);break}}}w&&!S&&(y=t(y,1/0));var A=v.length+y.length+E.length,I=A<T?new Array(T-A+1).join(d):"";switch(w&&S&&(y=t(I+y,I.length?T-E.length:1/0),I=""),h){case"<":y=v+y+E+I;break;case"=":y=v+I+y+E;break;case"^":y=I.slice(0,A=I.length>>1)+v+y+E+I.slice(A);break;default:y=I+v+y+E;break}return o(y)}return b.toString=function(){return u+""},b}function c(u,d){var h=l((u=lt(u),u.type="f",u)),g=Math.max(-8,Math.min(8,Math.floor(st(d)/3)))*3,x=Math.pow(10,-g),S=zh[8+g/3];return function(T){return h(x*T)+S}}return{format:l,formatPrefix:c}}var qo,Et,Go;ul({thousands:",",grouping:[3],currency:["$",""]});function ul(e){return qo=Uh(e),Et=qo.format,Go=qo.formatPrefix,qo}function dl(e){return Math.max(0,-st(Math.abs(e)))}function hl(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(st(t)/3)))*3-st(Math.abs(e)))}function pl(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,st(t)-st(e))+1}function gl(e,t,r,n){var i=js(e,t,r),o;switch(n=lt(n??",f"),n.type){case"s":{var a=Math.max(Math.abs(e),Math.abs(t));return n.precision==null&&!isNaN(o=hl(i,a))&&(n.precision=o),Go(n,a)}case"":case"e":case"g":case"p":case"r":{n.precision==null&&!isNaN(o=pl(i,Math.max(Math.abs(e),Math.abs(t))))&&(n.precision=o-(n.type==="e"));break}case"f":case"%":{n.precision==null&&!isNaN(o=dl(i))&&(n.precision=o-(n.type==="%")*2);break}}return Et(n)}function li(e){var t=e.domain;return e.ticks=function(r){var n=t();return fr(n[0],n[n.length-1],r??10)},e.tickFormat=function(r,n){var i=t();return gl(i[0],i[i.length-1],r??10,n)},e.nice=function(r){r==null&&(r=10);var n=t(),i=0,o=n.length-1,a=n[i],s=n[o],f,l,c=10;for(s<a&&(l=a,a=s,s=l,l=i,i=o,o=l);c-- >0;){if(l=ri(a,s,r),l===f)return n[i]=a,n[o]=s,t(n);if(l>0)a=Math.floor(a/l)*l,s=Math.ceil(s/l)*l;else if(l<0)a=Math.ceil(a*l)/l,s=Math.floor(s*l)/l;else break;f=l}return e},e}function gr(){var e=al();return e.copy=function(){return Kr(e,gr())},ce.apply(e,arguments),li(e)}function ml(e,t){e=e.slice();var r=0,n=e.length-1,i=e[r],o=e[n],a;return o<i&&(a=r,r=n,n=a,a=i,i=o,o=a),e[r]=t.floor(i),e[n]=t.ceil(o),e}function qh(e){return Math.log(e)}function Gh(e){return Math.exp(e)}function tx(e){return-Math.log(-e)}function rx(e){return-Math.exp(-e)}function nx(e){return isFinite(e)?+("1e"+e):e<0?0:e}function ix(e){return e===10?nx:e===Math.E?Math.exp:t=>Math.pow(e,t)}function ox(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function Vh(e){return(t,r)=>-e(-t,r)}function ax(e){let t=e(qh,Gh),r=t.domain,n=10,i,o;function a(){return i=ox(n),o=ix(n),r()[0]<0?(i=Vh(i),o=Vh(o),e(tx,rx)):e(qh,Gh),t}return t.base=function(s){return arguments.length?(n=+s,a()):n},t.domain=function(s){return arguments.length?(r(s),a()):r()},t.ticks=s=>{let f=r(),l=f[0],c=f[f.length-1],u=c<l;u&&([l,c]=[c,l]);let d=i(l),h=i(c),g,x,S=s==null?10:+s,T=[];if(!(n%1)&&h-d<S){if(d=Math.floor(d),h=Math.ceil(h),l>0){for(;d<=h;++d)for(g=1;g<n;++g)if(x=d<0?g/o(-d):g*o(d),!(x<l)){if(x>c)break;T.push(x)}}else for(;d<=h;++d)for(g=n-1;g>=1;--g)if(x=d>0?g/o(-d):g*o(d),!(x<l)){if(x>c)break;T.push(x)}T.length*2<S&&(T=fr(l,c,S))}else T=fr(d,h,Math.min(h-d,S)).map(o);return u?T.reverse():T},t.tickFormat=(s,f)=>{if(s==null&&(s=10),f==null&&(f=n===10?"s":","),typeof f!="function"&&(!(n%1)&&(f=lt(f)).precision==null&&(f.trim=!0),f=Et(f)),s===1/0)return f;let l=Math.max(1,n*s/t.ticks().length);return c=>{let u=c/o(Math.round(i(c)));return u*n<n-.5&&(u*=n),u<=l?f(c):""}},t.nice=()=>r(ml(r(),{floor:s=>o(Math.floor(i(s))),ceil:s=>o(Math.ceil(i(s)))})),t}function fi(){let e=ax(si()).domain([1,10]);return e.copy=()=>Kr(e,fi()).base(e.base()),ce.apply(e,arguments),e}function $h(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function sx(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function lx(e){return e<0?-e*e:e*e}function fx(e){var t=e(He,He),r=1;function n(){return r===1?e(He,He):r===.5?e(sx,lx):e($h(r),$h(1/r))}return t.exponent=function(i){return arguments.length?(r=+i,n()):r},li(t)}function Vo(){var e=fx(si());return e.copy=function(){return Kr(e,Vo()).exponent(e.exponent())},ce.apply(e,arguments),e}function bl(){return Vo.apply(null,arguments).exponent(.5)}function ci(){var e=[],t=[],r=[],n;function i(){var a=0,s=Math.max(1,t.length);for(r=new Array(s-1);++a<s;)r[a-1]=Zs(e,a/s);return o}function o(a){return a==null||isNaN(a=+a)?n:t[_t(r,a)]}return o.invertExtent=function(a){var s=t.indexOf(a);return s<0?[NaN,NaN]:[s>0?r[s-1]:e[0],s<r.length?r[s]:e[e.length-1]]},o.domain=function(a){if(!arguments.length)return e.slice();e=[];for(let s of a)s!=null&&!isNaN(s=+s)&&e.push(s);return e.sort(ot),i()},o.range=function(a){return arguments.length?(t=Array.from(a),i()):t.slice()},o.unknown=function(a){return arguments.length?(n=a,o):n},o.quantiles=function(){return r.slice()},o.copy=function(){return ci().domain(e).range(t).unknown(n)},ce.apply(o,arguments)}function ui(){var e=0,t=1,r=1,n=[.5],i=[0,1],o;function a(f){return f!=null&&f<=f?i[_t(n,f,0,r)]:o}function s(){var f=-1;for(n=new Array(r);++f<r;)n[f]=((f+1)*t-(f-r)*e)/(r+1);return a}return a.domain=function(f){return arguments.length?([e,t]=f,e=+e,t=+t,s()):[e,t]},a.range=function(f){return arguments.length?(r=(i=Array.from(f)).length-1,s()):i.slice()},a.invertExtent=function(f){var l=i.indexOf(f);return l<0?[NaN,NaN]:l<1?[e,n[0]]:l>=r?[n[r-1],t]:[n[l-1],n[l]]},a.unknown=function(f){return arguments.length&&(o=f),a},a.thresholds=function(){return n.slice()},a.copy=function(){return ui().domain([e,t]).range(i).unknown(o)},ce.apply(li(a),arguments)}function mr(){var e=[.5],t=[0,1],r,n=1;function i(o){return o!=null&&o<=o?t[_t(e,o,0,n)]:r}return i.domain=function(o){return arguments.length?(e=Array.from(o),n=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(o){return arguments.length?(t=Array.from(o),n=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(o){var a=t.indexOf(o);return[e[a-1],e[a]]},i.unknown=function(o){return arguments.length?(r=o,i):r},i.copy=function(){return mr().domain(e).range(t).unknown(r)},ce.apply(i,arguments)}var t6={},cx=Object.create,ql=Object.defineProperty,ux=Object.getOwnPropertyDescriptor,N0=Object.getOwnPropertyNames,dx=Object.getPrototypeOf,hx=Object.prototype.hasOwnProperty,px=(e,t,r)=>t in e?ql(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gx=(e,t)=>function(){return t||(0,e[N0(e)[0]])((t={exports:{}}).exports,t),t.exports},mx=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of N0(t))!hx.call(e,i)&&i!==r&&ql(e,i,{get:()=>t[i],enumerable:!(n=ux(t,i))||n.enumerable});return e},bx=(e,t,r)=>(r=e!=null?cx(dx(e)):{},mx(t||!e||!e.__esModule?ql(r,"default",{value:e,enumerable:!0}):r,e)),O=(e,t,r)=>px(e,typeof t!="symbol"?t+"":t,r),yx=gx({"node_modules/thenby/thenBy.module.js"(e,t){"use strict";t.exports=(function(){function r(a){return a}function n(a){return typeof a=="string"?a.toLowerCase():a}function i(a,s){if(s=typeof s=="object"?s:{direction:s},typeof a!="function"){var f=a;a=function(h){return h[f]?h[f]:""}}if(a.length===1){var l=a,c=s.ignoreCase?n:r,u=s.cmp||function(h,g){return h<g?-1:h>g?1:0};a=function(h,g){return u(c(l(h)),c(l(g)))}}let d={"-1":"",desc:""};return s.direction in d?function(h,g){return-a(h,g)}:a}function o(a,s){var f=typeof this=="function"&&!this.firstBy?this:!1,l=i(a,s),c=f?function(u,d){return f(u,d)||l(u,d)}:l;return c.thenBy=o,c}return o.firstBy=o,o})()}}),xx="deck-gl-carto";function Ci(){return xx}var Gl=(e=>(e.IN="in",e.BETWEEN="between",e.CLOSED_OPEN="closed_open",e.TIME="time",e.STRING_SEARCH="stringSearch",e))(Gl||{}),z0=(e=>(e.V1="v1",e.V2="v2",e.V3="v3",e))(z0||{}),Vl="https://gcp-us-east1.api.carto.com",U0={mapId:"tag-mapId"};var q0=(e=>(e.H3="h3",e.QUADBIN="quadbin",e))(q0||{});var vx=Object.freeze({h3:["h3","hex","h3id","hex_id","h3hex"],quadbin:["quadbin"]}),De={Count:"count",Avg:"avg",Min:"min",Max:"max",Sum:"sum",Custom:"custom"};function G0(e){return e.map(t=>t[0]===void 0||t[0]===null?[Number.MIN_SAFE_INTEGER,t[1]]:t[1]===void 0||t[1]===null?[t[0],Number.MAX_SAFE_INTEGER]:t)}var wx={in:_x,between:V0,time:Ex,closed_open:Sx,stringSearch:Tx};function _x(e,t){return e.includes(t)}function V0(e,t){let r=n=>{let[i,o]=n;return t>=i&&t<=o};return G0(e).some(r)}function Ex(e,t){let r=new Date(t).getTime();if(isFinite(r))return V0(e,r);throw new Error("Column used to filter by time isn't well formatted.")}function Sx(e,t){let r=n=>{let[i,o]=n;return t>=i&&t<o};return G0(e).some(r)}function Tx(e,t,r={}){let n=Hh(t,r),i=r.useRegExp?e:e.map(a=>{let s=Px(Hh(a,r));return r.mustStart&&(s=`^${s}`),r.mustEnd&&(s=`${s}$`),s}),o=new RegExp(i.join("|"),r.caseSensitive?"g":"gi");return!!n.match(o)}var Cx=/[.*+?^${}()|[\]\\]/g,Ax=new RegExp("\\p{Diacritic}","gu");function Px(e){return e.replace(Cx,"\\$&")}function Hh(e,t){let r=String(e);return t.keepSpecialCharacters||(r=r.normalize("NFD").replace(Ax,"")),r}var Fx={and:"every",or:"some"};function kx(e,t,r,n){let i=Fx[n];return e[i](o=>{let a=t[o],s=Object.keys(a);return!r||r[o]===null||r[o]===void 0?!1:s.every(f=>{let l=wx[f];if(!l)throw new Error(`"${f}" filter is not implemented.`);return l(a[f].values,r[o],a[f].params)})})}function Lx({filters:e={},type:t="boolean",filtersLogicalOperator:r="and"}){let n=Object.keys(e);return n.length?i=>{let o=i.properties||i,a=kx(n,e,o,r);return t==="number"?Number(a):a}:()=>t==="number"?1:!0}function Mx(e,t,r){return Object.keys(t).length?e.filter(Lx({filters:t,filtersLogicalOperator:r})):e}var W=11102230246251565e-32,ue=134217729,Ix=(3+8*W)*W;function yl(e,t,r,n,i){let o,a,s,f,l=t[0],c=n[0],u=0,d=0;c>l==c>-l?(o=l,l=t[++u]):(o=c,c=n[++d]);let h=0;if(u<e&&d<r)for(c>l==c>-l?(a=l+o,s=o-(a-l),l=t[++u]):(a=c+o,s=o-(a-c),c=n[++d]),o=a,s!==0&&(i[h++]=s);u<e&&d<r;)c>l==c>-l?(a=o+l,f=a-o,s=o-(a-f)+(l-f),l=t[++u]):(a=o+c,f=a-o,s=o-(a-f)+(c-f),c=n[++d]),o=a,s!==0&&(i[h++]=s);for(;u<e;)a=o+l,f=a-o,s=o-(a-f)+(l-f),l=t[++u],o=a,s!==0&&(i[h++]=s);for(;d<r;)a=o+c,f=a-o,s=o-(a-f)+(c-f),c=n[++d],o=a,s!==0&&(i[h++]=s);return(o!==0||h===0)&&(i[h++]=o),h}function Rx(e,t){let r=t[0];for(let n=1;n<e;n++)r+=t[n];return r}function R(e){return new Float64Array(e)}var Bx=(3+16*W)*W,Ox=(2+12*W)*W,Dx=(9+64*W)*W*W,Xr=R(4),jh=R(8),Zh=R(12),Wh=R(16),ge=R(4);function Nx(e,t,r,n,i,o,a){let s,f,l,c,u,d,h,g,x,S,T,w,k,M,L,B,D,p,m=e-i,b=r-i,y=t-o,v=n-o;M=m*v,d=ue*m,h=d-(d-m),g=m-h,d=ue*v,x=d-(d-v),S=v-x,L=g*S-(M-h*x-g*x-h*S),B=y*b,d=ue*y,h=d-(d-y),g=y-h,d=ue*b,x=d-(d-b),S=b-x,D=g*S-(B-h*x-g*x-h*S),T=L-D,u=L-T,Xr[0]=L-(T+u)+(u-D),w=M+T,u=w-M,k=M-(w-u)+(T-u),T=k-B,u=k-T,Xr[1]=k-(T+u)+(u-B),p=w+T,u=p-w,Xr[2]=w-(p-u)+(T-u),Xr[3]=p;let E=Rx(4,Xr),F=Ox*a;if(E>=F||-E>=F||(u=e-m,s=e-(m+u)+(u-i),u=r-b,l=r-(b+u)+(u-i),u=t-y,f=t-(y+u)+(u-o),u=n-v,c=n-(v+u)+(u-o),s===0&&f===0&&l===0&&c===0)||(F=Dx*a+Ix*Math.abs(E),E+=m*c+v*s-(y*l+b*f),E>=F||-E>=F))return E;M=s*v,d=ue*s,h=d-(d-s),g=s-h,d=ue*v,x=d-(d-v),S=v-x,L=g*S-(M-h*x-g*x-h*S),B=f*b,d=ue*f,h=d-(d-f),g=f-h,d=ue*b,x=d-(d-b),S=b-x,D=g*S-(B-h*x-g*x-h*S),T=L-D,u=L-T,ge[0]=L-(T+u)+(u-D),w=M+T,u=w-M,k=M-(w-u)+(T-u),T=k-B,u=k-T,ge[1]=k-(T+u)+(u-B),p=w+T,u=p-w,ge[2]=w-(p-u)+(T-u),ge[3]=p;let _=yl(4,Xr,4,ge,jh);M=m*c,d=ue*m,h=d-(d-m),g=m-h,d=ue*c,x=d-(d-c),S=c-x,L=g*S-(M-h*x-g*x-h*S),B=y*l,d=ue*y,h=d-(d-y),g=y-h,d=ue*l,x=d-(d-l),S=l-x,D=g*S-(B-h*x-g*x-h*S),T=L-D,u=L-T,ge[0]=L-(T+u)+(u-D),w=M+T,u=w-M,k=M-(w-u)+(T-u),T=k-B,u=k-T,ge[1]=k-(T+u)+(u-B),p=w+T,u=p-w,ge[2]=w-(p-u)+(T-u),ge[3]=p;let C=yl(_,jh,4,ge,Zh);M=s*c,d=ue*s,h=d-(d-s),g=s-h,d=ue*c,x=d-(d-c),S=c-x,L=g*S-(M-h*x-g*x-h*S),B=f*l,d=ue*f,h=d-(d-f),g=f-h,d=ue*l,x=d-(d-l),S=l-x,D=g*S-(B-h*x-g*x-h*S),T=L-D,u=L-T,ge[0]=L-(T+u)+(u-D),w=M+T,u=w-M,k=M-(w-u)+(T-u),T=k-B,u=k-T,ge[1]=k-(T+u)+(u-B),p=w+T,u=p-w,ge[2]=w-(p-u)+(T-u),ge[3]=p;let P=yl(C,Zh,4,ge,Wh);return Wh[P-1]}function zx(e,t,r,n,i,o){let a=(t-o)*(r-i),s=(e-i)*(n-o),f=a-s,l=Math.abs(a+s);return Math.abs(f)>=Bx*l?f:-Nx(e,t,r,n,i,o,l)}var gS=(7+56*W)*W,mS=(3+28*W)*W,bS=(26+288*W)*W*W,yS=R(4),xS=R(4),vS=R(4),wS=R(4),_S=R(4),ES=R(4),SS=R(4),TS=R(4),CS=R(4),AS=R(8),PS=R(8),FS=R(8),kS=R(4),LS=R(8),MS=R(8),IS=R(8),RS=R(12),BS=R(192),OS=R(192),DS=(10+96*W)*W,NS=(4+48*W)*W,zS=(44+576*W)*W*W,US=R(4),qS=R(4),GS=R(4),VS=R(4),$S=R(4),HS=R(4),jS=R(4),ZS=R(4),WS=R(8),YS=R(8),KS=R(8),XS=R(8),QS=R(8),JS=R(8),eT=R(8),tT=R(8),rT=R(8),nT=R(4),iT=R(4),oT=R(4),aT=R(8),sT=R(16),lT=R(16),fT=R(16),cT=R(32),uT=R(32),dT=R(48),hT=R(64),pT=R(1152),gT=R(1152),mT=(16+224*W)*W,bT=(5+72*W)*W,yT=(71+1408*W)*W*W,xT=R(4),vT=R(4),wT=R(4),_T=R(4),ET=R(4),ST=R(4),TT=R(4),CT=R(4),AT=R(4),PT=R(4),FT=R(24),kT=R(24),LT=R(24),MT=R(24),IT=R(24),RT=R(24),BT=R(24),OT=R(24),DT=R(24),NT=R(24),zT=R(1152),UT=R(1152),qT=R(1152),GT=R(1152),VT=R(1152),$T=R(2304),HT=R(2304),jT=R(3456),ZT=R(5760),WT=R(8),YT=R(8),KT=R(8),XT=R(16),QT=R(24),JT=R(48),eC=R(48),tC=R(96),rC=R(192),nC=R(384),iC=R(384),oC=R(384),aC=R(768),sC=R(96),lC=R(96),fC=R(96),cC=R(1152);function Ux(e,t){var r,n,i=0,o,a,s,f,l,c,u,d=e[0],h=e[1],g=t.length;for(r=0;r<g;r++){n=0;var x=t[r],S=x.length-1;if(c=x[0],c[0]!==x[S][0]&&c[1]!==x[S][1])throw new Error("First and last coordinates in a ring must be the same");for(a=c[0]-d,s=c[1]-h,n;n<S;n++){if(u=x[n+1],f=u[0]-d,l=u[1]-h,s===0&&l===0){if(f<=0&&a>=0||a<=0&&f>=0)return 0}else if(l>=0&&s<=0||l<=0&&s>=0){if(o=zx(a,f,s,l,0,0),o===0)return 0;(o>0&&l>0&&s<=0||o<0&&l<=0&&s>0)&&i++}c=u,s=l,a=f}}return i%2!==0}var Ce=63710088e-1,uC={centimeters:Ce*100,centimetres:Ce*100,degrees:360/(2*Math.PI),feet:Ce*3.28084,inches:Ce*39.37,kilometers:Ce/1e3,kilometres:Ce/1e3,meters:Ce,metres:Ce,miles:Ce/1609.344,millimeters:Ce*1e3,millimetres:Ce*1e3,nauticalmiles:Ce/1852,radians:1,yards:Ce*1.0936};function we(e,t,r={}){let n={type:"Feature"};return(r.id===0||r.id)&&(n.id=r.id),r.bbox&&(n.bbox=r.bbox),n.properties=t||{},n.geometry=e,n}function qx(e,t,r={}){if(!e)throw new Error("coordinates is required");if(!Array.isArray(e))throw new Error("coordinates must be an Array");if(e.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Yh(e[0])||!Yh(e[1]))throw new Error("coordinates must contain numbers");return we({type:"Point",coordinates:e},t,r)}function $l(e,t,r={}){for(let i of e){if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(i[i.length-1].length!==i[0].length)throw new Error("First and last Position are not equivalent.");for(let o=0;o<i[i.length-1].length;o++)if(i[i.length-1][o]!==i[0][o])throw new Error("First and last Position are not equivalent.")}return we({type:"Polygon",coordinates:e},t,r)}function $0(e,t,r={}){if(e.length<2)throw new Error("coordinates must be an array of two or more positions");return we({type:"LineString",coordinates:e},t,r)}function wi(e,t={}){let r={type:"FeatureCollection"};return t.id&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.features=e,r}function H0(e,t,r={}){return we({type:"MultiLineString",coordinates:e},t,r)}function j0(e,t,r={}){return we({type:"MultiPolygon",coordinates:e},t,r)}function Yh(e){return!isNaN(e)&&e!==null&&!Array.isArray(e)}function Z0(e){if(!e)throw new Error("coord is required");if(!Array.isArray(e)){if(e.type==="Feature"&&e.geometry!==null&&e.geometry.type==="Point")return[...e.geometry.coordinates];if(e.type==="Point")return[...e.coordinates]}if(Array.isArray(e)&&e.length>=2&&!Array.isArray(e[0])&&!Array.isArray(e[1]))return[...e];throw new Error("coord must be GeoJSON Point or an Array of numbers")}function xi(e){if(Array.isArray(e))return e;if(e.type==="Feature"){if(e.geometry!==null)return e.geometry.coordinates}else if(e.coordinates)return e.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Pt(e){return e.type==="Feature"?e.geometry:e}function Gx(e,t){return e.type==="FeatureCollection"?"FeatureCollection":e.type==="GeometryCollection"?"GeometryCollection":e.type==="Feature"&&e.geometry!==null?e.geometry.type:e.type}function Ne(e,t,r={}){if(!e)throw new Error("point is required");if(!t)throw new Error("polygon is required");let n=Z0(e),i=Pt(t),o=i.type,a=t.bbox,s=i.coordinates;if(a&&Vx(n,a)===!1)return!1;o==="Polygon"&&(s=[s]);let f=!1;for(var l=0;l<s.length;++l){let c=Ux(n,s[l]);if(c===0)return!r.ignoreBoundary;c&&(f=!0)}return f}function Vx(e,t){return t[0]<=e[0]&&t[1]<=e[1]&&t[2]>=e[0]&&t[3]>=e[1]}var W0=class{constructor(e=[],t=$x){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;let e=this.data[0],t=this.data.pop();return this.length--,this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){let{data:t,compare:r}=this,n=t[e];for(;e>0;){let i=e-1>>1,o=t[i];if(r(n,o)>=0)break;t[e]=o,e=i}t[e]=n}_down(e){let{data:t,compare:r}=this,n=this.length>>1,i=t[e];for(;e<n;){let o=(e<<1)+1,a=t[o],s=o+1;if(s<this.length&&r(t[s],a)<0&&(o=s,a=t[s]),r(a,i)>=0)break;t[e]=a,e=o}t[e]=i}};function $x(e,t){return e<t?-1:e>t?1:0}function Y0(e,t){return e.p.x>t.p.x?1:e.p.x<t.p.x?-1:e.p.y!==t.p.y?e.p.y>t.p.y?1:-1:1}function Hx(e,t){return e.rightSweepEvent.p.x>t.rightSweepEvent.p.x?1:e.rightSweepEvent.p.x<t.rightSweepEvent.p.x?-1:e.rightSweepEvent.p.y!==t.rightSweepEvent.p.y?e.rightSweepEvent.p.y<t.rightSweepEvent.p.y?1:-1:1}var Kh=class{constructor(e,t,r,n){this.p={x:e[0],y:e[1]},this.featureId=t,this.ringId=r,this.eventId=n,this.otherEvent=null,this.isLeftEndpoint=null}isSamePoint(e){return this.p.x===e.p.x&&this.p.y===e.p.y}};function jx(e,t){if(e.type==="FeatureCollection"){let r=e.features;for(let n=0;n<r.length;n++)Xh(r[n],t)}else Xh(e,t)}var $o=0,Ho=0,jo=0;function Xh(e,t){let r=e.type==="Feature"?e.geometry:e,n=r.coordinates;(r.type==="Polygon"||r.type==="MultiLineString")&&(n=[n]),r.type==="LineString"&&(n=[[n]]);for(let i=0;i<n.length;i++)for(let o=0;o<n[i].length;o++){let a=n[i][o][0],s=null;Ho=Ho+1;for(let f=0;f<n[i][o].length-1;f++){s=n[i][o][f+1];let l=new Kh(a,$o,Ho,jo),c=new Kh(s,$o,Ho,jo+1);l.otherEvent=c,c.otherEvent=l,Y0(l,c)>0?(c.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,c.isLeftEndpoint=!1),t.push(l),t.push(c),a=s,jo=jo+1}}$o=$o+1}var Zx=class{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}};function Wx(e,t){if(e===null||t===null||e.leftSweepEvent.ringId===t.leftSweepEvent.ringId&&(e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.leftSweepEvent)||e.rightSweepEvent.isSamePoint(t.rightSweepEvent)||e.leftSweepEvent.isSamePoint(t.leftSweepEvent)||e.leftSweepEvent.isSamePoint(t.rightSweepEvent)))return!1;let r=e.leftSweepEvent.p.x,n=e.leftSweepEvent.p.y,i=e.rightSweepEvent.p.x,o=e.rightSweepEvent.p.y,a=t.leftSweepEvent.p.x,s=t.leftSweepEvent.p.y,f=t.rightSweepEvent.p.x,l=t.rightSweepEvent.p.y,c=(l-s)*(i-r)-(f-a)*(o-n),u=(f-a)*(n-s)-(l-s)*(r-a),d=(i-r)*(n-s)-(o-n)*(r-a);if(c===0)return!1;let h=u/c,g=d/c;if(h>=0&&h<=1&&g>=0&&g<=1){let x=r+h*(i-r),S=n+h*(o-n);return[x,S]}return!1}function Yx(e,t){t=t||!1;let r=[],n=new W0([],Hx);for(;e.length;){let i=e.pop();if(i.isLeftEndpoint){let o=new Zx(i);for(let a=0;a<n.data.length;a++){let s=n.data[a];if(t&&s.leftSweepEvent.featureId===i.featureId)continue;let f=Wx(o,s);f!==!1&&r.push(f)}n.push(o)}else i.isLeftEndpoint===!1&&n.pop()}return r}function Kx(e,t){let r=new W0([],Y0);return jx(e,r),Yx(r,t)}var Xx=Kx,Qx=Xx;function Hl(e,t,r={}){let{removeDuplicates:n=!0,ignoreSelfIntersections:i=!0}=r,o=[];e.type==="FeatureCollection"?o=o.concat(e.features):e.type==="Feature"?o.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&o.push(we(e)),t.type==="FeatureCollection"?o=o.concat(t.features):t.type==="Feature"?o.push(t):(t.type==="LineString"||t.type==="Polygon"||t.type==="MultiLineString"||t.type==="MultiPolygon")&&o.push(we(t));let a=Qx(wi(o),i),s=[];if(n){let f={};a.forEach(l=>{let c=l.join(",");f[c]||(f[c]=!0,s.push(l))})}else s=a;return wi(s.map(f=>qx(f)))}function K0(e,t,r){if(e!==null)for(var n,i,o,a,s,f,l,c=0,u=0,d,h=e.type,g=h==="FeatureCollection",x=h==="Feature",S=g?e.features.length:1,T=0;T<S;T++){l=g?e.features[T].geometry:x?e.geometry:e,d=l?l.type==="GeometryCollection":!1,s=d?l.geometries.length:1;for(var w=0;w<s;w++){var k=0,M=0;if(a=d?l.geometries[w]:l,a!==null){f=a.coordinates;var L=a.type;switch(c=r&&(L==="Polygon"||L==="MultiPolygon")?1:0,L){case null:break;case"Point":if(t(f,u,T,k,M)===!1)return!1;u++,k++;break;case"LineString":case"MultiPoint":for(n=0;n<f.length;n++){if(t(f[n],u,T,k,M)===!1)return!1;u++,L==="MultiPoint"&&k++}L==="LineString"&&k++;break;case"Polygon":case"MultiLineString":for(n=0;n<f.length;n++){for(i=0;i<f[n].length-c;i++){if(t(f[n][i],u,T,k,M)===!1)return!1;u++}L==="MultiLineString"&&k++,L==="Polygon"&&M++}L==="Polygon"&&k++;break;case"MultiPolygon":for(n=0;n<f.length;n++){for(M=0,i=0;i<f[n].length;i++){for(o=0;o<f[n][i].length-c;o++){if(t(f[n][i][o],u,T,k,M)===!1)return!1;u++}M++}k++}break;case"GeometryCollection":for(n=0;n<a.geometries.length;n++)if(K0(a.geometries[n],t,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function X0(e,t){var r,n,i,o,a,s,f,l,c,u,d=0,h=e.type==="FeatureCollection",g=e.type==="Feature",x=h?e.features.length:1;for(r=0;r<x;r++){for(s=h?e.features[r].geometry:g?e.geometry:e,l=h?e.features[r].properties:g?e.properties:{},c=h?e.features[r].bbox:g?e.bbox:void 0,u=h?e.features[r].id:g?e.id:void 0,f=s?s.type==="GeometryCollection":!1,a=f?s.geometries.length:1,i=0;i<a;i++){if(o=f?s.geometries[i]:s,o===null){if(t(null,d,l,c,u)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(t(o,d,l,c,u)===!1)return!1;break}case"GeometryCollection":{for(n=0;n<o.geometries.length;n++)if(t(o.geometries[n],d,l,c,u)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}d++}}function ta(e,t){X0(e,function(r,n,i,o,a){var s=r===null?null:r.type;switch(s){case null:case"Point":case"LineString":case"Polygon":return t(we(r,i,{bbox:o,id:a}),n,0)===!1?!1:void 0}var f;switch(s){case"MultiPoint":f="Point";break;case"MultiLineString":f="LineString";break;case"MultiPolygon":f="Polygon";break}for(var l=0;l<r.coordinates.length;l++){var c=r.coordinates[l],u={type:f,coordinates:c};if(t(we(u,i),n,l)===!1)return!1}})}function Pl(e,t={}){let r=Pt(e);switch(!t.properties&&e.type==="Feature"&&(t.properties=e.properties),r.type){case"Polygon":return Jx(r,t);case"MultiPolygon":return ev(r,t);default:throw new Error("invalid poly")}}function Jx(e,t={}){let n=Pt(e).coordinates,i=t.properties?t.properties:e.type==="Feature"?e.properties:{};return Q0(n,i)}function ev(e,t={}){let n=Pt(e).coordinates,i=t.properties?t.properties:e.type==="Feature"?e.properties:{},o=[];return n.forEach(a=>{o.push(Q0(a,i))}),wi(o)}function Q0(e,t){return e.length>1?H0(e,t):$0(e[0],t)}function tv(e,t,{ignoreSelfIntersections:r=!0}={ignoreSelfIntersections:!0}){let n=!0;return ta(e,i=>{ta(t,o=>{if(n===!1)return!1;n=rv(i.geometry,o.geometry,r)})}),n}function rv(e,t,r){switch(e.type){case"Point":switch(t.type){case"Point":return!av(e.coordinates,t.coordinates);case"LineString":return!Qh(t,e);case"Polygon":return!Ne(e,t)}break;case"LineString":switch(t.type){case"Point":return!Qh(e,t);case"LineString":return!nv(e,t,r);case"Polygon":return!Jh(t,e,r)}break;case"Polygon":switch(t.type){case"Point":return!Ne(t,e);case"LineString":return!Jh(e,t,r);case"Polygon":return!iv(t,e,r)}}return!1}function Qh(e,t){for(let r=0;r<e.coordinates.length-1;r++)if(ov(e.coordinates[r],e.coordinates[r+1],t.coordinates))return!0;return!1}function nv(e,t,r){return Hl(e,t,{ignoreSelfIntersections:r}).features.length>0}function Jh(e,t,r){for(let i of t.coordinates)if(Ne(i,e))return!0;return Hl(t,Pl(e),{ignoreSelfIntersections:r}).features.length>0}function iv(e,t,r){for(let i of e.coordinates[0])if(Ne(i,t))return!0;for(let i of t.coordinates[0])if(Ne(i,e))return!0;return Hl(Pl(e),Pl(t),{ignoreSelfIntersections:r}).features.length>0}function ov(e,t,r){let n=r[0]-e[0],i=r[1]-e[1],o=t[0]-e[0],a=t[1]-e[1];return n*a-i*o!==0?!1:Math.abs(o)>=Math.abs(a)?o>0?e[0]<=r[0]&&r[0]<=t[0]:t[0]<=r[0]&&r[0]<=e[0]:a>0?e[1]<=r[1]&&r[1]<=t[1]:t[1]<=r[1]&&r[1]<=e[1]}function av(e,t){return e[0]===t[0]&&e[1]===t[1]}function sv(e,t,{ignoreSelfIntersections:r=!0}={}){let n=!1;return ta(e,i=>{ta(t,o=>{if(n===!0)return!0;n=!tv(i.geometry,o.geometry,{ignoreSelfIntersections:r})})}),n}var J0=sv;function lv({geojson:e,spatialFilter:t,uniqueIdProperty:r}){let n=0,i=new Map;if(!t)return[];for(let o of e.features){let a=r?o.properties[r]:++n;!i.has(a)&&J0(t,o)&&i.set(a,o.properties)}return Array.from(i.values())}var dC=1/Math.PI*180,hC=1/180*Math.PI,fv={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...fv}};var pC=globalThis.mathgl.config;function cv(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function Fl(e,t,r){return cv(e)?e.map((n,i)=>Fl(n,t[i],r)):r*t+(1-r)*e}function e0(e,t){if(!e)throw new Error(t||"@math.gl/web-mercator: assertion failed.")}var We=Math.PI,ep=We/4,t0=We/180,r0=180/We,ra=512;function kl(e){let[t,r]=e;e0(Number.isFinite(t)),e0(Number.isFinite(r)&&r>=-90&&r<=90,"invalid latitude");let n=t*t0,i=r*t0,o=ra*(n+We)/(2*We),a=ra*(We+Math.log(Math.tan(ep+i*.5)))/(2*We);return[o,a]}function uv(e){let[t,r]=e,n=t/ra*(2*We)-We,i=2*(Math.atan(Math.exp(r/ra*(2*We)-We))-ep);return[n*r0,i*r0]}var gC=Math.PI/180,dv={Point:tp,MultiPoint:pv,LineString:rp,MultiLineString:gv,Polygon:np,MultiPolygon:mv};function hv(e,t){let[r,n,i,o]=t,a=kl([r,o]),s=kl([i,n]),f=[a,s];if(e.type==="GeometryCollection")throw new Error("Unsupported geometry type GeometryCollection");let l=dv[e.type],c=l(e.coordinates,f);return{...e,coordinates:c}}function tp([e,t],[r,n]){let i=Fl(r[0],n[0],e),o=Fl(r[1],n[1],t);return uv([i,o])}function jl(e,t){return e.map(r=>tp(r,t))}function pv(e,t){return jl(e,t)}function rp(e,t){return jl(e,t)}function gv(e,t){return e.map(r=>rp(r,t))}function np(e,t){return e.map(r=>jl(r,t))}function mv(e,t){return e.map(r=>np(r,t))}function bv(e,t={}){let r=Number(e[0]),n=Number(e[1]),i=Number(e[2]),o=Number(e[3]);if(e.length===6)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");let a=[r,n];return $l([[a,[i,n],[i,o],[r,o],a]],t.properties,{bbox:e,id:t.id})}var yv=bv;function na(e,t={}){if(e.bbox!=null&&t.recompute!==!0)return e.bbox;let r=[1/0,1/0,-1/0,-1/0];return K0(e,n=>{r[0]>n[0]&&(r[0]=n[0]),r[1]>n[1]&&(r[1]=n[1]),r[2]<n[0]&&(r[2]=n[0]),r[3]<n[1]&&(r[3]=n[1])}),r}function ia(e,t,r={}){let n=Z0(e),i=xi(t);for(let o=0;o<i.length-1;o++){let a=!1;if(r.ignoreEndVertices&&(o===0&&(a="start"),o===i.length-2&&(a="end"),o===0&&o+1===i.length-1&&(a="both")),xv(i[o],i[o+1],n,a,typeof r.epsilon>"u"?null:r.epsilon))return!0}return!1}function xv(e,t,r,n,i){let o=r[0],a=r[1],s=e[0],f=e[1],l=t[0],c=t[1],u=r[0]-s,d=r[1]-f,h=l-s,g=c-f,x=u*g-d*h;if(i!==null){if(Math.abs(x)>i)return!1}else if(x!==0)return!1;if(Math.abs(h)===Math.abs(g)&&Math.abs(h)===0)return n?!1:r[0]===e[0]&&r[1]===e[1];if(n){if(n==="start")return Math.abs(h)>=Math.abs(g)?h>0?s<o&&o<=l:l<=o&&o<s:g>0?f<a&&a<=c:c<=a&&a<f;if(n==="end")return Math.abs(h)>=Math.abs(g)?h>0?s<=o&&o<l:l<o&&o<=s:g>0?f<=a&&a<c:c<a&&a<=f;if(n==="both")return Math.abs(h)>=Math.abs(g)?h>0?s<o&&o<l:l<o&&o<s:g>0?f<a&&a<c:c<a&&a<f}else return Math.abs(h)>=Math.abs(g)?h>0?s<=o&&o<=l:l<=o&&o<=s:g>0?f<=a&&a<=c:c<=a&&a<=f;return!1}function vv(e,t){var r=Pt(e),n=Pt(t),i=r.type,o=n.type;switch(i){case"Point":switch(o){case"MultiPoint":return wv(r,n);case"LineString":return ia(r,n,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return Ne(r,n,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return _v(r,n);case"LineString":return Ev(r,n);case"Polygon":case"MultiPolygon":return Sv(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return Tv(r,n);case"Polygon":case"MultiPolygon":return Cv(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return Av(r,n);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function wv(e,t){var r,n=!1;for(r=0;r<t.coordinates.length;r++)if(op(t.coordinates[r],e.coordinates)){n=!0;break}return n}function _v(e,t){for(var r=0;r<e.coordinates.length;r++){for(var n=!1,i=0;i<t.coordinates.length;i++)op(e.coordinates[r],t.coordinates[i])&&(n=!0);if(!n)return!1}return!0}function Ev(e,t){for(var r=!1,n=0;n<e.coordinates.length;n++){if(!ia(e.coordinates[n],t))return!1;r||(r=ia(e.coordinates[n],t,{ignoreEndVertices:!0}))}return r}function Sv(e,t){for(var r=!0,n=!1,i=!1,o=0;o<e.coordinates.length;o++){if(i=Ne(e.coordinates[o],t),!i){r=!1;break}n||(i=Ne(e.coordinates[o],t,{ignoreBoundary:!0}))}return r&&i}function Tv(e,t){for(var r=0;r<e.coordinates.length;r++)if(!ia(e.coordinates[r],t))return!1;return!0}function Cv(e,t){var r=na(t),n=na(e);if(!ip(r,n))return!1;for(var i=!1,o=0;o<e.coordinates.length;o++){if(!Ne(e.coordinates[o],t))return!1;if(i||(i=Ne(e.coordinates[o],t,{ignoreBoundary:!0})),!i&&o<e.coordinates.length-1){var a=Pv(e.coordinates[o],e.coordinates[o+1]);i=Ne(a,t,{ignoreBoundary:!0})}}return i}function Av(e,t){var r=na(e),n=na(t);if(!ip(n,r))return!1;for(var i=0;i<e.coordinates[0].length;i++)if(!Ne(e.coordinates[0][i],t))return!1;return!0}function ip(e,t){return!(e[0]>t[0]||e[2]<t[2]||e[1]>t[1]||e[3]<t[3])}function op(e,t){return e[0]===t[0]&&e[1]===t[1]}function Pv(e,t){return[(e[0]+t[0])/2,(e[1]+t[1])/2]}var ap=vv,Fv=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,xl=Math.ceil,Be=Math.floor,xe="[BigNumber Error] ",n0=xe+"Number primitive has more than 15 significant digits: ",je=1e14,U=14,vl=9007199254740991,wl=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],Vt=1e7,se=1e9;function sp(e){var t,r,n,i=w.prototype={constructor:w,toString:null,valueOf:null},o=new w(1),a=20,s=4,f=-7,l=21,c=-1e7,u=1e7,d=!1,h=1,g=0,x={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",T=!0;function w(p,m){var b,y,v,E,F,_,C,P,A=this;if(!(A instanceof w))return new w(p,m);if(m==null){if(p&&p._isBigNumber===!0){A.s=p.s,!p.c||p.e>u?A.c=A.e=null:p.e<c?A.c=[A.e=0]:(A.e=p.e,A.c=p.c.slice());return}if((_=typeof p=="number")&&p*0==0){if(A.s=1/p<0?(p=-p,-1):1,p===~~p){for(E=0,F=p;F>=10;F/=10,E++);E>u?A.c=A.e=null:(A.e=E,A.c=[p]);return}P=String(p)}else{if(!Fv.test(P=String(p)))return n(A,P,_);A.s=P.charCodeAt(0)==45?(P=P.slice(1),-1):1}(E=P.indexOf("."))>-1&&(P=P.replace(".","")),(F=P.search(/e/i))>0?(E<0&&(E=F),E+=+P.slice(F+1),P=P.substring(0,F)):E<0&&(E=P.length)}else{if(ee(m,2,S.length,"Base"),m==10&&T)return A=new w(p),B(A,a+A.e+1,s);if(P=String(p),_=typeof p=="number"){if(p*0!=0)return n(A,P,_,m);if(A.s=1/p<0?(P=P.slice(1),-1):1,w.DEBUG&&P.replace(/^0\.0*|\./,"").length>15)throw Error(n0+p)}else A.s=P.charCodeAt(0)===45?(P=P.slice(1),-1):1;for(b=S.slice(0,m),E=F=0,C=P.length;F<C;F++)if(b.indexOf(y=P.charAt(F))<0){if(y=="."){if(F>E){E=C;continue}}else if(!v&&(P==P.toUpperCase()&&(P=P.toLowerCase())||P==P.toLowerCase()&&(P=P.toUpperCase()))){v=!0,F=-1,E=0;continue}return n(A,String(p),_,m)}_=!1,P=r(P,m,10,A.s),(E=P.indexOf("."))>-1?P=P.replace(".",""):E=P.length}for(F=0;P.charCodeAt(F)===48;F++);for(C=P.length;P.charCodeAt(--C)===48;);if(P=P.slice(F,++C)){if(C-=F,_&&w.DEBUG&&C>15&&(p>vl||p!==Be(p)))throw Error(n0+A.s*p);if((E=E-F-1)>u)A.c=A.e=null;else if(E<c)A.c=[A.e=0];else{if(A.e=E,A.c=[],F=(E+1)%U,E<0&&(F+=U),F<C){for(F&&A.c.push(+P.slice(0,F)),C-=U;F<C;)A.c.push(+P.slice(F,F+=U));F=U-(P=P.slice(F)).length}else F-=C;for(;F--;P+="0");A.c.push(+P)}}else A.c=[A.e=0]}w.clone=sp,w.ROUND_UP=0,w.ROUND_DOWN=1,w.ROUND_CEIL=2,w.ROUND_FLOOR=3,w.ROUND_HALF_UP=4,w.ROUND_HALF_DOWN=5,w.ROUND_HALF_EVEN=6,w.ROUND_HALF_CEIL=7,w.ROUND_HALF_FLOOR=8,w.EUCLID=9,w.config=w.set=function(p){var m,b;if(p!=null)if(typeof p=="object"){if(p.hasOwnProperty(m="DECIMAL_PLACES")&&(b=p[m],ee(b,0,se,m),a=b),p.hasOwnProperty(m="ROUNDING_MODE")&&(b=p[m],ee(b,0,8,m),s=b),p.hasOwnProperty(m="EXPONENTIAL_AT")&&(b=p[m],b&&b.pop?(ee(b[0],-se,0,m),ee(b[1],0,se,m),f=b[0],l=b[1]):(ee(b,-se,se,m),f=-(l=b<0?-b:b))),p.hasOwnProperty(m="RANGE"))if(b=p[m],b&&b.pop)ee(b[0],-se,-1,m),ee(b[1],1,se,m),c=b[0],u=b[1];else if(ee(b,-se,se,m),b)c=-(u=b<0?-b:b);else throw Error(xe+m+" cannot be zero: "+b);if(p.hasOwnProperty(m="CRYPTO"))if(b=p[m],b===!!b)if(b)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))d=b;else throw d=!b,Error(xe+"crypto unavailable");else d=b;else throw Error(xe+m+" not true or false: "+b);if(p.hasOwnProperty(m="MODULO_MODE")&&(b=p[m],ee(b,0,9,m),h=b),p.hasOwnProperty(m="POW_PRECISION")&&(b=p[m],ee(b,0,se,m),g=b),p.hasOwnProperty(m="FORMAT"))if(b=p[m],typeof b=="object")x=b;else throw Error(xe+m+" not an object: "+b);if(p.hasOwnProperty(m="ALPHABET"))if(b=p[m],typeof b=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(b))T=b.slice(0,10)=="0123456789",S=b;else throw Error(xe+m+" invalid: "+b)}else throw Error(xe+"Object expected: "+p);return{DECIMAL_PLACES:a,ROUNDING_MODE:s,EXPONENTIAL_AT:[f,l],RANGE:[c,u],CRYPTO:d,MODULO_MODE:h,POW_PRECISION:g,FORMAT:x,ALPHABET:S}},w.isBigNumber=function(p){if(!p||p._isBigNumber!==!0)return!1;if(!w.DEBUG)return!0;var m,b,y=p.c,v=p.e,E=p.s;e:if({}.toString.call(y)=="[object Array]"){if((E===1||E===-1)&&v>=-se&&v<=se&&v===Be(v)){if(y[0]===0){if(v===0&&y.length===1)return!0;break e}if(m=(v+1)%U,m<1&&(m+=U),String(y[0]).length==m){for(m=0;m<y.length;m++)if(b=y[m],b<0||b>=je||b!==Be(b))break e;if(b!==0)return!0}}}else if(y===null&&v===null&&(E===null||E===1||E===-1))return!0;throw Error(xe+"Invalid BigNumber: "+p)},w.maximum=w.max=function(){return M(arguments,-1)},w.minimum=w.min=function(){return M(arguments,1)},w.random=(function(){var p=9007199254740992,m=Math.random()*p&2097151?function(){return Be(Math.random()*p)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(b){var y,v,E,F,_,C=0,P=[],A=new w(o);if(b==null?b=a:ee(b,0,se),F=xl(b/U),d)if(crypto.getRandomValues){for(y=crypto.getRandomValues(new Uint32Array(F*=2));C<F;)_=y[C]*131072+(y[C+1]>>>11),_>=9e15?(v=crypto.getRandomValues(new Uint32Array(2)),y[C]=v[0],y[C+1]=v[1]):(P.push(_%1e14),C+=2);C=F/2}else if(crypto.randomBytes){for(y=crypto.randomBytes(F*=7);C<F;)_=(y[C]&31)*281474976710656+y[C+1]*1099511627776+y[C+2]*4294967296+y[C+3]*16777216+(y[C+4]<<16)+(y[C+5]<<8)+y[C+6],_>=9e15?crypto.randomBytes(7).copy(y,C):(P.push(_%1e14),C+=7);C=F/7}else throw d=!1,Error(xe+"crypto unavailable");if(!d)for(;C<F;)_=m(),_<9e15&&(P[C++]=_%1e14);for(F=P[--C],b%=U,F&&b&&(_=wl[U-b],P[C]=Be(F/_)*_);P[C]===0;P.pop(),C--);if(C<0)P=[E=0];else{for(E=-1;P[0]===0;P.splice(0,1),E-=U);for(C=1,_=P[0];_>=10;_/=10,C++);C<U&&(E-=U-C)}return A.e=E,A.c=P,A}})(),w.sum=function(){for(var p=1,m=arguments,b=new w(m[0]);p<m.length;)b=b.plus(m[p++]);return b},r=(function(){var p="0123456789";function m(b,y,v,E){for(var F,_=[0],C,P=0,A=b.length;P<A;){for(C=_.length;C--;_[C]*=y);for(_[0]+=E.indexOf(b.charAt(P++)),F=0;F<_.length;F++)_[F]>v-1&&(_[F+1]==null&&(_[F+1]=0),_[F+1]+=_[F]/v|0,_[F]%=v)}return _.reverse()}return function(b,y,v,E,F){var _,C,P,A,I,N,z,H,te=b.indexOf("."),oe=a,$=s;for(te>=0&&(A=g,g=0,b=b.replace(".",""),H=new w(y),N=H.pow(b.length-te),g=A,H.c=m(St(Re(N.c),N.e,"0"),10,v,p),H.e=H.c.length),z=m(b,y,v,F?(_=S,p):(_=p,S)),P=A=z.length;z[--A]==0;z.pop());if(!z[0])return _.charAt(0);if(te<0?--P:(N.c=z,N.e=P,N.s=E,N=t(N,H,oe,$,v),z=N.c,I=N.r,P=N.e),C=P+oe+1,te=z[C],A=v/2,I=I||C<0||z[C+1]!=null,I=$<4?(te!=null||I)&&($==0||$==(N.s<0?3:2)):te>A||te==A&&($==4||I||$==6&&z[C-1]&1||$==(N.s<0?8:7)),C<1||!z[0])b=I?St(_.charAt(1),-oe,_.charAt(0)):_.charAt(0);else{if(z.length=C,I)for(--v;++z[--C]>v;)z[C]=0,C||(++P,z=[1].concat(z));for(A=z.length;!z[--A];);for(te=0,b="";te<=A;b+=_.charAt(z[te++]));b=St(b,P,_.charAt(0))}return b}})(),t=(function(){function p(y,v,E){var F,_,C,P,A=0,I=y.length,N=v%Vt,z=v/Vt|0;for(y=y.slice();I--;)C=y[I]%Vt,P=y[I]/Vt|0,F=z*C+P*N,_=N*C+F%Vt*Vt+A,A=(_/E|0)+(F/Vt|0)+z*P,y[I]=_%E;return A&&(y=[A].concat(y)),y}function m(y,v,E,F){var _,C;if(E!=F)C=E>F?1:-1;else for(_=C=0;_<E;_++)if(y[_]!=v[_]){C=y[_]>v[_]?1:-1;break}return C}function b(y,v,E,F){for(var _=0;E--;)y[E]-=_,_=y[E]<v[E]?1:0,y[E]=_*F+y[E]-v[E];for(;!y[0]&&y.length>1;y.splice(0,1));}return function(y,v,E,F,_){var C,P,A,I,N,z,H,te,oe,$,Y,fe,Fi,Ma,Ia,Ke,ln,Ae=y.s==v.s?1:-1,de=y.c,re=v.c;if(!de||!de[0]||!re||!re[0])return new w(!y.s||!v.s||(de?re&&de[0]==re[0]:!re)?NaN:de&&de[0]==0||!re?Ae*0:Ae/0);for(te=new w(Ae),oe=te.c=[],P=y.e-v.e,Ae=E+P+1,_||(_=je,P=Oe(y.e/U)-Oe(v.e/U),Ae=Ae/U|0),A=0;re[A]==(de[A]||0);A++);if(re[A]>(de[A]||0)&&P--,Ae<0)oe.push(1),I=!0;else{for(Ma=de.length,Ke=re.length,A=0,Ae+=2,N=Be(_/(re[0]+1)),N>1&&(re=p(re,N,_),de=p(de,N,_),Ke=re.length,Ma=de.length),Fi=Ke,$=de.slice(0,Ke),Y=$.length;Y<Ke;$[Y++]=0);ln=re.slice(),ln=[0].concat(ln),Ia=re[0],re[1]>=_/2&&Ia++;do{if(N=0,C=m(re,$,Ke,Y),C<0){if(fe=$[0],Ke!=Y&&(fe=fe*_+($[1]||0)),N=Be(fe/Ia),N>1)for(N>=_&&(N=_-1),z=p(re,N,_),H=z.length,Y=$.length;m(z,$,H,Y)==1;)N--,b(z,Ke<H?ln:re,H,_),H=z.length,C=1;else N==0&&(C=N=1),z=re.slice(),H=z.length;if(H<Y&&(z=[0].concat(z)),b($,z,Y,_),Y=$.length,C==-1)for(;m(re,$,Ke,Y)<1;)N++,b($,Ke<Y?ln:re,Y,_),Y=$.length}else C===0&&(N++,$=[0]);oe[A++]=N,$[0]?$[Y++]=de[Fi]||0:($=[de[Fi]],Y=1)}while((Fi++<Ma||$[0]!=null)&&Ae--);I=$[0]!=null,oe[0]||oe.splice(0,1)}if(_==je){for(A=1,Ae=oe[0];Ae>=10;Ae/=10,A++);B(te,E+(te.e=A+P*U-1)+1,F,I)}else te.e=P,te.r=+I;return te}})();function k(p,m,b,y){var v,E,F,_,C;if(b==null?b=s:ee(b,0,8),!p.c)return p.toString();if(v=p.c[0],F=p.e,m==null)C=Re(p.c),C=y==1||y==2&&(F<=f||F>=l)?Wo(C,F):St(C,F,"0");else if(p=B(new w(p),m,b),E=p.e,C=Re(p.c),_=C.length,y==1||y==2&&(m<=E||E<=f)){for(;_<m;C+="0",_++);C=Wo(C,E)}else if(m-=F,C=St(C,E,"0"),E+1>_){if(--m>0)for(C+=".";m--;C+="0");}else if(m+=E-_,m>0)for(E+1==_&&(C+=".");m--;C+="0");return p.s<0&&v?"-"+C:C}function M(p,m){for(var b,y,v=1,E=new w(p[0]);v<p.length;v++)y=new w(p[v]),(!y.s||(b=br(E,y))===m||b===0&&E.s===m)&&(E=y);return E}function L(p,m,b){for(var y=1,v=m.length;!m[--v];m.pop());for(v=m[0];v>=10;v/=10,y++);return(b=y+b*U-1)>u?p.c=p.e=null:b<c?p.c=[p.e=0]:(p.e=b,p.c=m),p}n=(function(){var p=/^(-?)0([xbo])(?=\w[\w.]*$)/i,m=/^([^.]+)\.$/,b=/^\.([^.]+)$/,y=/^-?(Infinity|NaN)$/,v=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(E,F,_,C){var P,A=_?F:F.replace(v,"");if(y.test(A))E.s=isNaN(A)?null:A<0?-1:1;else{if(!_&&(A=A.replace(p,function(I,N,z){return P=(z=z.toLowerCase())=="x"?16:z=="b"?2:8,!C||C==P?N:I}),C&&(P=C,A=A.replace(m,"$1").replace(b,"0.$1")),F!=A))return new w(A,P);if(w.DEBUG)throw Error(xe+"Not a"+(C?" base "+C:"")+" number: "+F);E.s=null}E.c=E.e=null}})();function B(p,m,b,y){var v,E,F,_,C,P,A,I=p.c,N=wl;if(I){e:{for(v=1,_=I[0];_>=10;_/=10,v++);if(E=m-v,E<0)E+=U,F=m,C=I[P=0],A=Be(C/N[v-F-1]%10);else if(P=xl((E+1)/U),P>=I.length)if(y){for(;I.length<=P;I.push(0));C=A=0,v=1,E%=U,F=E-U+1}else break e;else{for(C=_=I[P],v=1;_>=10;_/=10,v++);E%=U,F=E-U+v,A=F<0?0:Be(C/N[v-F-1]%10)}if(y=y||m<0||I[P+1]!=null||(F<0?C:C%N[v-F-1]),y=b<4?(A||y)&&(b==0||b==(p.s<0?3:2)):A>5||A==5&&(b==4||y||b==6&&(E>0?F>0?C/N[v-F]:0:I[P-1])%10&1||b==(p.s<0?8:7)),m<1||!I[0])return I.length=0,y?(m-=p.e+1,I[0]=N[(U-m%U)%U],p.e=-m||0):I[0]=p.e=0,p;if(E==0?(I.length=P,_=1,P--):(I.length=P+1,_=N[U-E],I[P]=F>0?Be(C/N[v-F]%N[F])*_:0),y)for(;;)if(P==0){for(E=1,F=I[0];F>=10;F/=10,E++);for(F=I[0]+=_,_=1;F>=10;F/=10,_++);E!=_&&(p.e++,I[0]==je&&(I[0]=1));break}else{if(I[P]+=_,I[P]!=je)break;I[P--]=0,_=1}for(E=I.length;I[--E]===0;I.pop());}p.e>u?p.c=p.e=null:p.e<c&&(p.c=[p.e=0])}return p}function D(p){var m,b=p.e;return b===null?p.toString():(m=Re(p.c),m=b<=f||b>=l?Wo(m,b):St(m,b,"0"),p.s<0?"-"+m:m)}return i.absoluteValue=i.abs=function(){var p=new w(this);return p.s<0&&(p.s=1),p},i.comparedTo=function(p,m){return br(this,new w(p,m))},i.decimalPlaces=i.dp=function(p,m){var b,y,v,E=this;if(p!=null)return ee(p,0,se),m==null?m=s:ee(m,0,8),B(new w(E),p+E.e+1,m);if(!(b=E.c))return null;if(y=((v=b.length-1)-Oe(this.e/U))*U,v=b[v])for(;v%10==0;v/=10,y--);return y<0&&(y=0),y},i.dividedBy=i.div=function(p,m){return t(this,new w(p,m),a,s)},i.dividedToIntegerBy=i.idiv=function(p,m){return t(this,new w(p,m),0,1)},i.exponentiatedBy=i.pow=function(p,m){var b,y,v,E,F,_,C,P,A,I=this;if(p=new w(p),p.c&&!p.isInteger())throw Error(xe+"Exponent not an integer: "+D(p));if(m!=null&&(m=new w(m)),_=p.e>14,!I.c||!I.c[0]||I.c[0]==1&&!I.e&&I.c.length==1||!p.c||!p.c[0])return A=new w(Math.pow(+D(I),_?p.s*(2-Zo(p)):+D(p))),m?A.mod(m):A;if(C=p.s<0,m){if(m.c?!m.c[0]:!m.s)return new w(NaN);y=!C&&I.isInteger()&&m.isInteger(),y&&(I=I.mod(m))}else{if(p.e>9&&(I.e>0||I.e<-1||(I.e==0?I.c[0]>1||_&&I.c[1]>=24e7:I.c[0]<8e13||_&&I.c[0]<=9999975e7)))return E=I.s<0&&Zo(p)?-0:0,I.e>-1&&(E=1/E),new w(C?1/E:E);g&&(E=xl(g/U+2))}for(_?(b=new w(.5),C&&(p.s=1),P=Zo(p)):(v=Math.abs(+D(p)),P=v%2),A=new w(o);;){if(P){if(A=A.times(I),!A.c)break;E?A.c.length>E&&(A.c.length=E):y&&(A=A.mod(m))}if(v){if(v=Be(v/2),v===0)break;P=v%2}else if(p=p.times(b),B(p,p.e+1,1),p.e>14)P=Zo(p);else{if(v=+D(p),v===0)break;P=v%2}I=I.times(I),E?I.c&&I.c.length>E&&(I.c.length=E):y&&(I=I.mod(m))}return y?A:(C&&(A=o.div(A)),m?A.mod(m):E?B(A,g,s,F):A)},i.integerValue=function(p){var m=new w(this);return p==null?p=s:ee(p,0,8),B(m,m.e+1,p)},i.isEqualTo=i.eq=function(p,m){return br(this,new w(p,m))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(p,m){return br(this,new w(p,m))>0},i.isGreaterThanOrEqualTo=i.gte=function(p,m){return(m=br(this,new w(p,m)))===1||m===0},i.isInteger=function(){return!!this.c&&Oe(this.e/U)>this.c.length-2},i.isLessThan=i.lt=function(p,m){return br(this,new w(p,m))<0},i.isLessThanOrEqualTo=i.lte=function(p,m){return(m=br(this,new w(p,m)))===-1||m===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(p,m){var b,y,v,E,F=this,_=F.s;if(p=new w(p,m),m=p.s,!_||!m)return new w(NaN);if(_!=m)return p.s=-m,F.plus(p);var C=F.e/U,P=p.e/U,A=F.c,I=p.c;if(!C||!P){if(!A||!I)return A?(p.s=-m,p):new w(I?F:NaN);if(!A[0]||!I[0])return I[0]?(p.s=-m,p):new w(A[0]?F:s==3?-0:0)}if(C=Oe(C),P=Oe(P),A=A.slice(),_=C-P){for((E=_<0)?(_=-_,v=A):(P=C,v=I),v.reverse(),m=_;m--;v.push(0));v.reverse()}else for(y=(E=(_=A.length)<(m=I.length))?_:m,_=m=0;m<y;m++)if(A[m]!=I[m]){E=A[m]<I[m];break}if(E&&(v=A,A=I,I=v,p.s=-p.s),m=(y=I.length)-(b=A.length),m>0)for(;m--;A[b++]=0);for(m=je-1;y>_;){if(A[--y]<I[y]){for(b=y;b&&!A[--b];A[b]=m);--A[b],A[y]+=je}A[y]-=I[y]}for(;A[0]==0;A.splice(0,1),--P);return A[0]?L(p,A,P):(p.s=s==3?-1:1,p.c=[p.e=0],p)},i.modulo=i.mod=function(p,m){var b,y,v=this;return p=new w(p,m),!v.c||!p.s||p.c&&!p.c[0]?new w(NaN):!p.c||v.c&&!v.c[0]?new w(v):(h==9?(y=p.s,p.s=1,b=t(v,p,0,3),p.s=y,b.s*=y):b=t(v,p,0,h),p=v.minus(b.times(p)),!p.c[0]&&h==1&&(p.s=v.s),p)},i.multipliedBy=i.times=function(p,m){var b,y,v,E,F,_,C,P,A,I,N,z,H,te,oe,$=this,Y=$.c,fe=(p=new w(p,m)).c;if(!Y||!fe||!Y[0]||!fe[0])return!$.s||!p.s||Y&&!Y[0]&&!fe||fe&&!fe[0]&&!Y?p.c=p.e=p.s=null:(p.s*=$.s,!Y||!fe?p.c=p.e=null:(p.c=[0],p.e=0)),p;for(y=Oe($.e/U)+Oe(p.e/U),p.s*=$.s,C=Y.length,I=fe.length,C<I&&(H=Y,Y=fe,fe=H,v=C,C=I,I=v),v=C+I,H=[];v--;H.push(0));for(te=je,oe=Vt,v=I;--v>=0;){for(b=0,N=fe[v]%oe,z=fe[v]/oe|0,F=C,E=v+F;E>v;)P=Y[--F]%oe,A=Y[F]/oe|0,_=z*P+A*N,P=N*P+_%oe*oe+H[E]+b,b=(P/te|0)+(_/oe|0)+z*A,H[E--]=P%te;H[E]=b}return b?++y:H.splice(0,1),L(p,H,y)},i.negated=function(){var p=new w(this);return p.s=-p.s||null,p},i.plus=function(p,m){var b,y=this,v=y.s;if(p=new w(p,m),m=p.s,!v||!m)return new w(NaN);if(v!=m)return p.s=-m,y.minus(p);var E=y.e/U,F=p.e/U,_=y.c,C=p.c;if(!E||!F){if(!_||!C)return new w(v/0);if(!_[0]||!C[0])return C[0]?p:new w(_[0]?y:v*0)}if(E=Oe(E),F=Oe(F),_=_.slice(),v=E-F){for(v>0?(F=E,b=C):(v=-v,b=_),b.reverse();v--;b.push(0));b.reverse()}for(v=_.length,m=C.length,v-m<0&&(b=C,C=_,_=b,m=v),v=0;m;)v=(_[--m]=_[m]+C[m]+v)/je|0,_[m]=je===_[m]?0:_[m]%je;return v&&(_=[v].concat(_),++F),L(p,_,F)},i.precision=i.sd=function(p,m){var b,y,v,E=this;if(p!=null&&p!==!!p)return ee(p,1,se),m==null?m=s:ee(m,0,8),B(new w(E),p,m);if(!(b=E.c))return null;if(v=b.length-1,y=v*U+1,v=b[v]){for(;v%10==0;v/=10,y--);for(v=b[0];v>=10;v/=10,y++);}return p&&E.e+1>y&&(y=E.e+1),y},i.shiftedBy=function(p){return ee(p,-vl,vl),this.times("1e"+p)},i.squareRoot=i.sqrt=function(){var p,m,b,y,v,E=this,F=E.c,_=E.s,C=E.e,P=a+4,A=new w("0.5");if(_!==1||!F||!F[0])return new w(!_||_<0&&(!F||F[0])?NaN:F?E:1/0);if(_=Math.sqrt(+D(E)),_==0||_==1/0?(m=Re(F),(m.length+C)%2==0&&(m+="0"),_=Math.sqrt(+m),C=Oe((C+1)/2)-(C<0||C%2),_==1/0?m="5e"+C:(m=_.toExponential(),m=m.slice(0,m.indexOf("e")+1)+C),b=new w(m)):b=new w(_+""),b.c[0]){for(C=b.e,_=C+P,_<3&&(_=0);;)if(v=b,b=A.times(v.plus(t(E,v,P,1))),Re(v.c).slice(0,_)===(m=Re(b.c)).slice(0,_))if(b.e<C&&--_,m=m.slice(_-3,_+1),m=="9999"||!y&&m=="4999"){if(!y&&(B(v,v.e+a+2,0),v.times(v).eq(E))){b=v;break}P+=4,_+=4,y=1}else{(!+m||!+m.slice(1)&&m.charAt(0)=="5")&&(B(b,b.e+a+2,1),p=!b.times(b).eq(E));break}}return B(b,b.e+a+1,s,p)},i.toExponential=function(p,m){return p!=null&&(ee(p,0,se),p++),k(this,p,m,1)},i.toFixed=function(p,m){return p!=null&&(ee(p,0,se),p=p+this.e+1),k(this,p,m)},i.toFormat=function(p,m,b){var y,v=this;if(b==null)p!=null&&m&&typeof m=="object"?(b=m,m=null):p&&typeof p=="object"?(b=p,p=m=null):b=x;else if(typeof b!="object")throw Error(xe+"Argument not an object: "+b);if(y=v.toFixed(p,m),v.c){var E,F=y.split("."),_=+b.groupSize,C=+b.secondaryGroupSize,P=b.groupSeparator||"",A=F[0],I=F[1],N=v.s<0,z=N?A.slice(1):A,H=z.length;if(C&&(E=_,_=C,C=E,H-=E),_>0&&H>0){for(E=H%_||_,A=z.substr(0,E);E<H;E+=_)A+=P+z.substr(E,_);C>0&&(A+=P+z.slice(E)),N&&(A="-"+A)}y=I?A+(b.decimalSeparator||"")+((C=+b.fractionGroupSize)?I.replace(new RegExp("\\d{"+C+"}\\B","g"),"$&"+(b.fractionGroupSeparator||"")):I):A}return(b.prefix||"")+y+(b.suffix||"")},i.toFraction=function(p){var m,b,y,v,E,F,_,C,P,A,I,N,z=this,H=z.c;if(p!=null&&(_=new w(p),!_.isInteger()&&(_.c||_.s!==1)||_.lt(o)))throw Error(xe+"Argument "+(_.isInteger()?"out of range: ":"not an integer: ")+D(_));if(!H)return new w(z);for(m=new w(o),P=b=new w(o),y=C=new w(o),N=Re(H),E=m.e=N.length-z.e-1,m.c[0]=wl[(F=E%U)<0?U+F:F],p=!p||_.comparedTo(m)>0?E>0?m:P:_,F=u,u=1/0,_=new w(N),C.c[0]=0;A=t(_,m,0,1),v=b.plus(A.times(y)),v.comparedTo(p)!=1;)b=y,y=v,P=C.plus(A.times(v=P)),C=v,m=_.minus(A.times(v=m)),_=v;return v=t(p.minus(b),y,0,1),C=C.plus(v.times(P)),b=b.plus(v.times(y)),C.s=P.s=z.s,E=E*2,I=t(P,y,E,s).minus(z).abs().comparedTo(t(C,b,E,s).minus(z).abs())<1?[P,y]:[C,b],u=F,I},i.toNumber=function(){return+D(this)},i.toPrecision=function(p,m){return p!=null&&ee(p,1,se),k(this,p,m,2)},i.toString=function(p){var m,b=this,y=b.s,v=b.e;return v===null?y?(m="Infinity",y<0&&(m="-"+m)):m="NaN":(p==null?m=v<=f||v>=l?Wo(Re(b.c),v):St(Re(b.c),v,"0"):p===10&&T?(b=B(new w(b),a+v+1,s),m=St(Re(b.c),b.e,"0")):(ee(p,2,S.length,"Base"),m=r(St(Re(b.c),v,"0"),10,p,y,!0)),y<0&&b.c[0]&&(m="-"+m)),m},i.valueOf=i.toJSON=function(){return D(this)},i._isBigNumber=!0,i[Symbol.toStringTag]="BigNumber",i[Symbol.for("nodejs.util.inspect.custom")]=i.valueOf,e!=null&&w.set(e),w}function Oe(e){var t=e|0;return e>0||e===t?t:t-1}function Re(e){for(var t,r,n=1,i=e.length,o=e[0]+"";n<i;){for(t=e[n++]+"",r=U-t.length;r--;t="0"+t);o+=t}for(i=o.length;o.charCodeAt(--i)===48;);return o.slice(0,i+1||1)}function br(e,t){var r,n,i=e.c,o=t.c,a=e.s,s=t.s,f=e.e,l=t.e;if(!a||!s)return null;if(r=i&&!i[0],n=o&&!o[0],r||n)return r?n?0:-s:a;if(a!=s)return a;if(r=a<0,n=f==l,!i||!o)return n?0:!i^r?1:-1;if(!n)return f>l^r?1:-1;for(s=(f=i.length)<(l=o.length)?f:l,a=0;a<s;a++)if(i[a]!=o[a])return i[a]>o[a]^r?1:-1;return f==l?0:f>l^r?1:-1}function ee(e,t,r,n){if(e<t||e>r||e!==Be(e))throw Error(xe+(n||"Argument")+(typeof e=="number"?e<t||e>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(e))}function Zo(e){var t=e.c.length-1;return Oe(e.e/U)==t&&e.c[t]%2!=0}function Wo(e,t){return(e.length>1?e.charAt(0)+"."+e.slice(1):e)+(t<0?"e":"e+")+t}function St(e,t,r){var n,i;if(t<0){for(i=r+".";++t;i+=r);e=i+e}else if(n=e.length,++t>n){for(i=r,t-=n;--t;i+=r);e+=i}else t<n&&(e=e.slice(0,t)+"."+e.slice(t));return e}var kv=sp(),ct=kv,Lv=class{constructor(e){O(this,"key"),O(this,"left",null),O(this,"right",null),this.key=e}},di=class extends Lv{constructor(e){super(e)}},Mv=class{constructor(){O(this,"size",0),O(this,"modificationCount",0),O(this,"splayCount",0)}splay(e){let t=this.root;if(t==null)return this.compare(e,e),-1;let r=null,n=null,i=null,o=null,a=t,s=this.compare,f;for(;;)if(f=s(a.key,e),f>0){let l=a.left;if(l==null||(f=s(l.key,e),f>0&&(a.left=l.right,l.right=a,a=l,l=a.left,l==null)))break;r==null?n=a:r.left=a,r=a,a=l}else if(f<0){let l=a.right;if(l==null||(f=s(l.key,e),f<0&&(a.right=l.left,l.left=a,a=l,l=a.right,l==null)))break;i==null?o=a:i.right=a,i=a,a=l}else break;return i!=null&&(i.right=a.left,a.left=o),r!=null&&(r.left=a.right,a.right=n),this.root!==a&&(this.root=a,this.splayCount++),f}splayMin(e){let t=e,r=t.left;for(;r!=null;){let n=r;t.left=n.right,n.right=t,t=n,r=t.left}return t}splayMax(e){let t=e,r=t.right;for(;r!=null;){let n=r;t.right=n.left,n.left=t,t=n,r=t.right}return t}_delete(e){if(this.root==null||this.splay(e)!=0)return null;let r=this.root,n=r,i=r.left;if(this.size--,i==null)this.root=r.right;else{let o=r.right;r=this.splayMax(i),r.right=o,this.root=r}return this.modificationCount++,n}addNewRoot(e,t){this.size++,this.modificationCount++;let r=this.root;if(r==null){this.root=e;return}t<0?(e.left=r,e.right=r.right,r.right=null):(e.right=r,e.left=r.left,r.left=null),this.root=e}_first(){let e=this.root;return e==null?null:(this.root=this.splayMin(e),this.root)}_last(){let e=this.root;return e==null?null:(this.root=this.splayMax(e),this.root)}clear(){this.root=null,this.size=0,this.modificationCount++}has(e){return this.validKey(e)&&this.splay(e)==0}defaultCompare(){return(e,t)=>e<t?-1:e>t?1:0}wrap(){return{getRoot:()=>this.root,setRoot:e=>{this.root=e},getSize:()=>this.size,getModificationCount:()=>this.modificationCount,getSplayCount:()=>this.splayCount,setSplayCount:e=>{this.splayCount=e},splay:e=>this.splay(e),has:e=>this.has(e)}}},i0,o0,oa=class gi extends Mv{constructor(t,r){super(),O(this,"root",null),O(this,"compare"),O(this,"validKey"),O(this,i0,"[object Set]"),this.compare=t??this.defaultCompare(),this.validKey=r??(n=>n!=null&&n!=null)}delete(t){return this.validKey(t)?this._delete(t)!=null:!1}deleteAll(t){for(let r of t)this.delete(r)}forEach(t){let r=this[Symbol.iterator](),n;for(;n=r.next(),!n.done;)t(n.value,n.value,this)}add(t){let r=this.splay(t);return r!=0&&this.addNewRoot(new di(t),r),this}addAndReturn(t){let r=this.splay(t);return r!=0&&this.addNewRoot(new di(t),r),this.root.key}addAll(t){for(let r of t)this.add(r)}isEmpty(){return this.root==null}isNotEmpty(){return this.root!=null}single(){if(this.size==0)throw"Bad state: No element";if(this.size>1)throw"Bad state: Too many element";return this.root.key}first(){if(this.size==0)throw"Bad state: No element";return this._first().key}last(){if(this.size==0)throw"Bad state: No element";return this._last().key}lastBefore(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)<0)return this.root.key;let n=this.root.left;if(n==null)return null;let i=n.right;for(;i!=null;)n=i,i=n.right;return n.key}firstAfter(t){if(t==null)throw"Invalid arguments(s)";if(this.root==null)return null;if(this.splay(t)>0)return this.root.key;let n=this.root.right;if(n==null)return null;let i=n.left;for(;i!=null;)n=i,i=n.left;return n.key}retainAll(t){let r=new gi(this.compare,this.validKey),n=this.modificationCount;for(let i of t){if(n!=this.modificationCount)throw"Concurrent modification during iteration.";this.validKey(i)&&this.splay(i)==0&&r.add(this.root.key)}r.size!=this.size&&(this.root=r.root,this.size=r.size,this.modificationCount++)}lookup(t){return!this.validKey(t)||this.splay(t)!=0?null:this.root.key}intersection(t){let r=new gi(this.compare,this.validKey);for(let n of this)t.has(n)&&r.add(n);return r}difference(t){let r=new gi(this.compare,this.validKey);for(let n of this)t.has(n)||r.add(n);return r}union(t){let r=this.clone();return r.addAll(t),r}clone(){let t=new gi(this.compare,this.validKey);return t.size=this.size,t.root=this.copyNode(this.root),t}copyNode(t){if(t==null)return null;function r(i,o){let a,s;do{if(a=i.left,s=i.right,a!=null){let f=new di(a.key);o.left=f,r(a,f)}if(s!=null){let f=new di(s.key);o.right=f,i=s,o=f}}while(s!=null)}let n=new di(t.key);return r(t,n),n}toSet(){return this.clone()}entries(){return new Rv(this.wrap())}keys(){return this[Symbol.iterator]()}values(){return this[Symbol.iterator]()}[(o0=Symbol.iterator,i0=Symbol.toStringTag,o0)](){return new Iv(this.wrap())}},lp=class{constructor(e){O(this,"tree"),O(this,"path",new Array),O(this,"modificationCount",null),O(this,"splayCount"),this.tree=e,this.splayCount=e.getSplayCount()}[Symbol.iterator](){return this}next(){return this.moveNext()?{done:!1,value:this.current()}:{done:!0,value:null}}current(){if(!this.path.length)return null;let e=this.path[this.path.length-1];return this.getValue(e)}rebuildPath(e){this.path.splice(0,this.path.length),this.tree.splay(e),this.path.push(this.tree.getRoot()),this.splayCount=this.tree.getSplayCount()}findLeftMostDescendent(e){for(;e!=null;)this.path.push(e),e=e.left}moveNext(){if(this.modificationCount!=this.tree.getModificationCount()){if(this.modificationCount==null){this.modificationCount=this.tree.getModificationCount();let r=this.tree.getRoot();for(;r!=null;)this.path.push(r),r=r.left;return this.path.length>0}throw"Concurrent modification during iteration."}if(!this.path.length)return!1;this.splayCount!=this.tree.getSplayCount()&&this.rebuildPath(this.path[this.path.length-1].key);let e=this.path[this.path.length-1],t=e.right;if(t!=null){for(;t!=null;)this.path.push(t),t=t.left;return!0}for(this.path.pop();this.path.length&&this.path[this.path.length-1].right===e;)e=this.path.pop();return this.path.length>0}},Iv=class extends lp{getValue(e){return e.key}},Rv=class extends lp{getValue(e){return[e.key,e.key]}},fp=e=>()=>e,Ll=e=>{let t=e?(r,n)=>n.minus(r).abs().isLessThanOrEqualTo(e):fp(!1);return(r,n)=>t(r,n)?0:r.comparedTo(n)};function Bv(e){let t=e?(r,n,i,o,a)=>r.exponentiatedBy(2).isLessThanOrEqualTo(o.minus(n).exponentiatedBy(2).plus(a.minus(i).exponentiatedBy(2)).times(e)):fp(!1);return(r,n,i)=>{let o=r.x,a=r.y,s=i.x,f=i.y,l=a.minus(f).times(n.x.minus(s)).minus(o.minus(s).times(n.y.minus(f)));return t(l,o,a,s,f)?0:l.comparedTo(0)}}var Ov=e=>e,Dv=e=>{if(e){let t=new oa(Ll(e)),r=new oa(Ll(e)),n=(o,a)=>a.addAndReturn(o),i=o=>({x:n(o.x,t),y:n(o.y,r)});return i({x:new ct(0),y:new ct(0)}),i}return Ov},Ml=e=>({set:t=>{Ft=Ml(t)},reset:()=>Ml(e),compare:Ll(e),snap:Dv(e),orient:Bv(e)}),Ft=Ml(),hi=(e,t)=>e.ll.x.isLessThanOrEqualTo(t.x)&&t.x.isLessThanOrEqualTo(e.ur.x)&&e.ll.y.isLessThanOrEqualTo(t.y)&&t.y.isLessThanOrEqualTo(e.ur.y),Il=(e,t)=>{if(t.ur.x.isLessThan(e.ll.x)||e.ur.x.isLessThan(t.ll.x)||t.ur.y.isLessThan(e.ll.y)||e.ur.y.isLessThan(t.ll.y))return null;let r=e.ll.x.isLessThan(t.ll.x)?t.ll.x:e.ll.x,n=e.ur.x.isLessThan(t.ur.x)?e.ur.x:t.ur.x,i=e.ll.y.isLessThan(t.ll.y)?t.ll.y:e.ll.y,o=e.ur.y.isLessThan(t.ur.y)?e.ur.y:t.ur.y;return{ll:{x:r,y:i},ur:{x:n,y:o}}},Jo=(e,t)=>e.x.times(t.y).minus(e.y.times(t.x)),cp=(e,t)=>e.x.times(t.x).plus(e.y.times(t.y)),aa=e=>cp(e,e).sqrt(),Nv=(e,t,r)=>{let n={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:r.x.minus(e.x),y:r.y.minus(e.y)};return Jo(i,n).div(aa(i)).div(aa(n))},zv=(e,t,r)=>{let n={x:t.x.minus(e.x),y:t.y.minus(e.y)},i={x:r.x.minus(e.x),y:r.y.minus(e.y)};return cp(i,n).div(aa(i)).div(aa(n))},a0=(e,t,r)=>t.y.isZero()?null:{x:e.x.plus(t.x.div(t.y).times(r.minus(e.y))),y:r},s0=(e,t,r)=>t.x.isZero()?null:{x:r,y:e.y.plus(t.y.div(t.x).times(r.minus(e.x)))},Uv=(e,t,r,n)=>{if(t.x.isZero())return s0(r,n,e.x);if(n.x.isZero())return s0(e,t,r.x);if(t.y.isZero())return a0(r,n,e.y);if(n.y.isZero())return a0(e,t,r.y);let i=Jo(t,n);if(i.isZero())return null;let o={x:r.x.minus(e.x),y:r.y.minus(e.y)},a=Jo(o,t).div(i),s=Jo(o,n).div(i),f=e.x.plus(s.times(t.x)),l=r.x.plus(a.times(n.x)),c=e.y.plus(s.times(t.y)),u=r.y.plus(a.times(n.y)),d=f.plus(l).div(2),h=c.plus(u).div(2);return{x:d,y:h}},ft=class up{constructor(t,r){O(this,"point"),O(this,"isLeft"),O(this,"segment"),O(this,"otherSE"),O(this,"consumedBy"),t.events===void 0?t.events=[this]:t.events.push(this),this.point=t,this.isLeft=r}static compare(t,r){let n=up.comparePoints(t.point,r.point);return n!==0?n:(t.point!==r.point&&t.link(r),t.isLeft!==r.isLeft?t.isLeft?1:-1:sa.compare(t.segment,r.segment))}static comparePoints(t,r){return t.x.isLessThan(r.x)?-1:t.x.isGreaterThan(r.x)?1:t.y.isLessThan(r.y)?-1:t.y.isGreaterThan(r.y)?1:0}link(t){if(t.point===this.point)throw new Error("Tried to link already linked events");let r=t.point.events;for(let n=0,i=r.length;n<i;n++){let o=r[n];this.point.events.push(o),o.point=this.point}this.checkForConsuming()}checkForConsuming(){let t=this.point.events.length;for(let r=0;r<t;r++){let n=this.point.events[r];if(n.segment.consumedBy===void 0)for(let i=r+1;i<t;i++){let o=this.point.events[i];o.consumedBy===void 0&&n.otherSE.point.events===o.otherSE.point.events&&n.segment.consume(o.segment)}}}getAvailableLinkedEvents(){let t=[];for(let r=0,n=this.point.events.length;r<n;r++){let i=this.point.events[r];i!==this&&!i.segment.ringOut&&i.segment.isInResult()&&t.push(i)}return t}getLeftmostComparator(t){let r=new Map,n=i=>{let o=i.otherSE;r.set(i,{sine:Nv(this.point,t.point,o.point),cosine:zv(this.point,t.point,o.point)})};return(i,o)=>{r.has(i)||n(i),r.has(o)||n(o);let{sine:a,cosine:s}=r.get(i),{sine:f,cosine:l}=r.get(o);return a.isGreaterThanOrEqualTo(0)&&f.isGreaterThanOrEqualTo(0)?s.isLessThan(l)?1:s.isGreaterThan(l)?-1:0:a.isLessThan(0)&&f.isLessThan(0)?s.isLessThan(l)?-1:s.isGreaterThan(l)?1:0:f.isLessThan(a)?-1:f.isGreaterThan(a)?1:0}}},qv=class Rl{constructor(t){O(this,"events"),O(this,"poly"),O(this,"_isExteriorRing"),O(this,"_enclosingRing"),this.events=t;for(let r=0,n=t.length;r<n;r++)t[r].segment.ringOut=this;this.poly=null}static factory(t){let r=[];for(let n=0,i=t.length;n<i;n++){let o=t[n];if(!o.isInResult()||o.ringOut)continue;let a=null,s=o.leftSE,f=o.rightSE,l=[s],c=s.point,u=[];for(;a=s,s=f,l.push(s),s.point!==c;)for(;;){let d=s.getAvailableLinkedEvents();if(d.length===0){let x=l[0].point,S=l[l.length-1].point;throw new Error(`Unable to complete output ring starting at [${x.x}, ${x.y}]. Last matching segment found ends at [${S.x}, ${S.y}].`)}if(d.length===1){f=d[0].otherSE;break}let h=null;for(let x=0,S=u.length;x<S;x++)if(u[x].point===s.point){h=x;break}if(h!==null){let x=u.splice(h)[0],S=l.splice(x.index);S.unshift(S[0].otherSE),r.push(new Rl(S.reverse()));continue}u.push({index:l.length,point:s.point});let g=s.getLeftmostComparator(a);f=d.sort(g)[0].otherSE;break}r.push(new Rl(l))}return r}getGeom(){let t=this.events[0].point,r=[t];for(let l=1,c=this.events.length-1;l<c;l++){let u=this.events[l].point,d=this.events[l+1].point;Ft.orient(u,t,d)!==0&&(r.push(u),t=u)}if(r.length===1)return null;let n=r[0],i=r[1];Ft.orient(n,t,i)===0&&r.shift(),r.push(r[0]);let o=this.isExteriorRing()?1:-1,a=this.isExteriorRing()?0:r.length-1,s=this.isExteriorRing()?r.length:-1,f=[];for(let l=a;l!=s;l+=o)f.push([r[l].x.toNumber(),r[l].y.toNumber()]);return f}isExteriorRing(){if(this._isExteriorRing===void 0){let t=this.enclosingRing();this._isExteriorRing=t?!t.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let t=this.events[0];for(let i=1,o=this.events.length;i<o;i++){let a=this.events[i];ft.compare(t,a)>0&&(t=a)}let r=t.segment.prevInResult(),n=r?r.prevInResult():null;for(;;){if(!r)return null;if(!n)return r.ringOut;if(n.ringOut!==r.ringOut)return n.ringOut?.enclosingRing()!==r.ringOut?r.ringOut:r.ringOut?.enclosingRing();r=n.prevInResult(),n=r?r.prevInResult():null}}},l0=class{constructor(e){O(this,"exteriorRing"),O(this,"interiorRings"),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}addInterior(e){this.interiorRings.push(e),e.poly=this}getGeom(){let e=this.exteriorRing.getGeom();if(e===null)return null;let t=[e];for(let r=0,n=this.interiorRings.length;r<n;r++){let i=this.interiorRings[r].getGeom();i!==null&&t.push(i)}return t}},Gv=class{constructor(e){O(this,"rings"),O(this,"polys"),this.rings=e,this.polys=this._composePolys(e)}getGeom(){let e=[];for(let t=0,r=this.polys.length;t<r;t++){let n=this.polys[t].getGeom();n!==null&&e.push(n)}return e}_composePolys(e){let t=[];for(let r=0,n=e.length;r<n;r++){let i=e[r];if(!i.poly)if(i.isExteriorRing())t.push(new l0(i));else{let o=i.enclosingRing();o?.poly||t.push(new l0(o)),o?.poly?.addInterior(i)}}return t}},Vv=class{constructor(e,t=sa.compare){O(this,"queue"),O(this,"tree"),O(this,"segments"),this.queue=e,this.tree=new oa(t),this.segments=[]}process(e){let t=e.segment,r=[];if(e.consumedBy)return e.isLeft?this.queue.delete(e.otherSE):this.tree.delete(t),r;e.isLeft&&this.tree.add(t);let n=t,i=t;do n=this.tree.lastBefore(n);while(n!=null&&n.consumedBy!=null);do i=this.tree.firstAfter(i);while(i!=null&&i.consumedBy!=null);if(e.isLeft){let o=null;if(n){let s=n.getIntersection(t);if(s!==null&&(t.isAnEndpoint(s)||(o=s),!n.isAnEndpoint(s))){let f=this._splitSafely(n,s);for(let l=0,c=f.length;l<c;l++)r.push(f[l])}}let a=null;if(i){let s=i.getIntersection(t);if(s!==null&&(t.isAnEndpoint(s)||(a=s),!i.isAnEndpoint(s))){let f=this._splitSafely(i,s);for(let l=0,c=f.length;l<c;l++)r.push(f[l])}}if(o!==null||a!==null){let s=null;o===null?s=a:a===null?s=o:s=ft.comparePoints(o,a)<=0?o:a,this.queue.delete(t.rightSE),r.push(t.rightSE);let f=t.split(s);for(let l=0,c=f.length;l<c;l++)r.push(f[l])}r.length>0?(this.tree.delete(t),r.push(e)):(this.segments.push(t),t.prev=n)}else{if(n&&i){let o=n.getIntersection(i);if(o!==null){if(!n.isAnEndpoint(o)){let a=this._splitSafely(n,o);for(let s=0,f=a.length;s<f;s++)r.push(a[s])}if(!i.isAnEndpoint(o)){let a=this._splitSafely(i,o);for(let s=0,f=a.length;s<f;s++)r.push(a[s])}}}this.tree.delete(t)}return r}_splitSafely(e,t){this.tree.delete(e);let r=e.rightSE;this.queue.delete(r);let n=e.split(t);return n.push(r),e.consumedBy===void 0&&this.tree.add(e),n}},$v=class{constructor(){O(this,"type"),O(this,"numMultiPolys")}run(e,t,r){mi.type=e;let n=[new c0(t,!0)];for(let l=0,c=r.length;l<c;l++)n.push(new c0(r[l],!1));if(mi.numMultiPolys=n.length,mi.type==="difference"){let l=n[0],c=1;for(;c<n.length;)Il(n[c].bbox,l.bbox)!==null?c++:n.splice(c,1)}if(mi.type==="intersection")for(let l=0,c=n.length;l<c;l++){let u=n[l];for(let d=l+1,h=n.length;d<h;d++)if(Il(u.bbox,n[d].bbox)===null)return[]}let i=new oa(ft.compare);for(let l=0,c=n.length;l<c;l++){let u=n[l].getSweepEvents();for(let d=0,h=u.length;d<h;d++)i.add(u[d])}let o=new Vv(i),a=null;for(i.size!=0&&(a=i.first(),i.delete(a));a;){let l=o.process(a);for(let c=0,u=l.length;c<u;c++){let d=l[c];d.consumedBy===void 0&&i.add(d)}i.size!=0?(a=i.first(),i.delete(a)):a=null}Ft.reset();let s=qv.factory(o.segments);return new Gv(s).getGeom()}},mi=new $v,Bl=mi,Hv=0,sa=class ea{constructor(t,r,n,i){O(this,"id"),O(this,"leftSE"),O(this,"rightSE"),O(this,"rings"),O(this,"windings"),O(this,"ringOut"),O(this,"consumedBy"),O(this,"prev"),O(this,"_prevInResult"),O(this,"_beforeState"),O(this,"_afterState"),O(this,"_isInResult"),this.id=++Hv,this.leftSE=t,t.segment=this,t.otherSE=r,this.rightSE=r,r.segment=this,r.otherSE=t,this.rings=n,this.windings=i}static compare(t,r){let n=t.leftSE.point.x,i=r.leftSE.point.x,o=t.rightSE.point.x,a=r.rightSE.point.x;if(a.isLessThan(n))return 1;if(o.isLessThan(i))return-1;let s=t.leftSE.point.y,f=r.leftSE.point.y,l=t.rightSE.point.y,c=r.rightSE.point.y;if(n.isLessThan(i)){if(f.isLessThan(s)&&f.isLessThan(l))return 1;if(f.isGreaterThan(s)&&f.isGreaterThan(l))return-1;let u=t.comparePoint(r.leftSE.point);if(u<0)return 1;if(u>0)return-1;let d=r.comparePoint(t.rightSE.point);return d!==0?d:-1}if(n.isGreaterThan(i)){if(s.isLessThan(f)&&s.isLessThan(c))return-1;if(s.isGreaterThan(f)&&s.isGreaterThan(c))return 1;let u=r.comparePoint(t.leftSE.point);if(u!==0)return u;let d=t.comparePoint(r.rightSE.point);return d<0?1:d>0?-1:1}if(s.isLessThan(f))return-1;if(s.isGreaterThan(f))return 1;if(o.isLessThan(a)){let u=r.comparePoint(t.rightSE.point);if(u!==0)return u}if(o.isGreaterThan(a)){let u=t.comparePoint(r.rightSE.point);if(u<0)return 1;if(u>0)return-1}if(!o.eq(a)){let u=l.minus(s),d=o.minus(n),h=c.minus(f),g=a.minus(i);if(u.isGreaterThan(d)&&h.isLessThan(g))return 1;if(u.isLessThan(d)&&h.isGreaterThan(g))return-1}return o.isGreaterThan(a)?1:o.isLessThan(a)||l.isLessThan(c)?-1:l.isGreaterThan(c)?1:t.id<r.id?-1:t.id>r.id?1:0}static fromRing(t,r,n){let i,o,a,s=ft.comparePoints(t,r);if(s<0)i=t,o=r,a=1;else if(s>0)i=r,o=t,a=-1;else throw new Error(`Tried to create degenerate segment at [${t.x}, ${t.y}]`);let f=new ft(i,!0),l=new ft(o,!1);return new ea(f,l,[n],[a])}replaceRightSE(t){this.rightSE=t,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let t=this.leftSE.point.y,r=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:t.isLessThan(r)?t:r},ur:{x:this.rightSE.point.x,y:t.isGreaterThan(r)?t:r}}}vector(){return{x:this.rightSE.point.x.minus(this.leftSE.point.x),y:this.rightSE.point.y.minus(this.leftSE.point.y)}}isAnEndpoint(t){return t.x.eq(this.leftSE.point.x)&&t.y.eq(this.leftSE.point.y)||t.x.eq(this.rightSE.point.x)&&t.y.eq(this.rightSE.point.y)}comparePoint(t){return Ft.orient(this.leftSE.point,t,this.rightSE.point)}getIntersection(t){let r=this.bbox(),n=t.bbox(),i=Il(r,n);if(i===null)return null;let o=this.leftSE.point,a=this.rightSE.point,s=t.leftSE.point,f=t.rightSE.point,l=hi(r,s)&&this.comparePoint(s)===0,c=hi(n,o)&&t.comparePoint(o)===0,u=hi(r,f)&&this.comparePoint(f)===0,d=hi(n,a)&&t.comparePoint(a)===0;if(c&&l)return d&&!u?a:!d&&u?f:null;if(c)return u&&o.x.eq(f.x)&&o.y.eq(f.y)?null:o;if(l)return d&&a.x.eq(s.x)&&a.y.eq(s.y)?null:s;if(d&&u)return null;if(d)return a;if(u)return f;let h=Uv(o,this.vector(),s,t.vector());return h===null||!hi(i,h)?null:Ft.snap(h)}split(t){let r=[],n=t.events!==void 0,i=new ft(t,!0),o=new ft(t,!1),a=this.rightSE;this.replaceRightSE(o),r.push(o),r.push(i);let s=new ea(i,a,this.rings.slice(),this.windings.slice());return ft.comparePoints(s.leftSE.point,s.rightSE.point)>0&&s.swapEvents(),ft.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),n&&(i.checkForConsuming(),o.checkForConsuming()),r}swapEvents(){let t=this.rightSE;this.rightSE=this.leftSE,this.leftSE=t,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let r=0,n=this.windings.length;r<n;r++)this.windings[r]*=-1}consume(t){let r=this,n=t;for(;r.consumedBy;)r=r.consumedBy;for(;n.consumedBy;)n=n.consumedBy;let i=ea.compare(r,n);if(i!==0){if(i>0){let o=r;r=n,n=o}if(r.prev===n){let o=r;r=n,n=o}for(let o=0,a=n.rings.length;o<a;o++){let s=n.rings[o],f=n.windings[o],l=r.rings.indexOf(s);l===-1?(r.rings.push(s),r.windings.push(f)):r.windings[l]+=f}n.rings=null,n.windings=null,n.consumedBy=r,n.leftSE.consumedBy=r.leftSE,n.rightSE.consumedBy=r.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let t=this.prev.consumedBy||this.prev;this._beforeState=t.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let t=this.beforeState();this._afterState={rings:t.rings.slice(0),windings:t.windings.slice(0),multiPolys:[]};let r=this._afterState.rings,n=this._afterState.windings,i=this._afterState.multiPolys;for(let s=0,f=this.rings.length;s<f;s++){let l=this.rings[s],c=this.windings[s],u=r.indexOf(l);u===-1?(r.push(l),n.push(c)):n[u]+=c}let o=[],a=[];for(let s=0,f=r.length;s<f;s++){if(n[s]===0)continue;let l=r[s],c=l.poly;if(a.indexOf(c)===-1)if(l.isExterior)o.push(c);else{a.indexOf(c)===-1&&a.push(c);let u=o.indexOf(l.poly);u!==-1&&o.splice(u,1)}}for(let s=0,f=o.length;s<f;s++){let l=o[s].multiPoly;i.indexOf(l)===-1&&i.push(l)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let t=this.beforeState().multiPolys,r=this.afterState().multiPolys;switch(Bl.type){case"union":{let n=t.length===0,i=r.length===0;this._isInResult=n!==i;break}case"intersection":{let n,i;t.length<r.length?(n=t.length,i=r.length):(n=r.length,i=t.length),this._isInResult=i===Bl.numMultiPolys&&n<i;break}case"xor":{let n=Math.abs(t.length-r.length);this._isInResult=n%2===1;break}case"difference":{let n=i=>i.length===1&&i[0].isSubject;this._isInResult=n(t)!==n(r);break}}return this._isInResult}},f0=class{constructor(e,t,r){if(O(this,"poly"),O(this,"isExterior"),O(this,"segments"),O(this,"bbox"),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=t,this.isExterior=r,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let n=Ft.snap({x:new ct(e[0][0]),y:new ct(e[0][1])});this.bbox={ll:{x:n.x,y:n.y},ur:{x:n.x,y:n.y}};let i=n;for(let o=1,a=e.length;o<a;o++){if(typeof e[o][0]!="number"||typeof e[o][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let s=Ft.snap({x:new ct(e[o][0]),y:new ct(e[o][1])});s.x.eq(i.x)&&s.y.eq(i.y)||(this.segments.push(sa.fromRing(i,s,this)),s.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=s.x),s.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=s.y),s.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=s.x),s.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=s.y),i=s)}(!n.x.eq(i.x)||!n.y.eq(i.y))&&this.segments.push(sa.fromRing(i,n,this))}getSweepEvents(){let e=[];for(let t=0,r=this.segments.length;t<r;t++){let n=this.segments[t];e.push(n.leftSE),e.push(n.rightSE)}return e}},jv=class{constructor(e,t){if(O(this,"multiPoly"),O(this,"exteriorRing"),O(this,"interiorRings"),O(this,"bbox"),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new f0(e[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let r=1,n=e.length;r<n;r++){let i=new f0(e[r],this,!1);i.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=i.bbox.ur.y),this.interiorRings.push(i)}this.multiPoly=t}getSweepEvents(){let e=this.exteriorRing.getSweepEvents();for(let t=0,r=this.interiorRings.length;t<r;t++){let n=this.interiorRings[t].getSweepEvents();for(let i=0,o=n.length;i<o;i++)e.push(n[i])}return e}},c0=class{constructor(e,t){if(O(this,"isSubject"),O(this,"polys"),O(this,"bbox"),!Array.isArray(e))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof e[0][0][0]=="number"&&(e=[e])}catch{}this.polys=[],this.bbox={ll:{x:new ct(Number.POSITIVE_INFINITY),y:new ct(Number.POSITIVE_INFINITY)},ur:{x:new ct(Number.NEGATIVE_INFINITY),y:new ct(Number.NEGATIVE_INFINITY)}};for(let r=0,n=e.length;r<n;r++){let i=new jv(e[r],this);i.bbox.ll.x.isLessThan(this.bbox.ll.x)&&(this.bbox.ll.x=i.bbox.ll.x),i.bbox.ll.y.isLessThan(this.bbox.ll.y)&&(this.bbox.ll.y=i.bbox.ll.y),i.bbox.ur.x.isGreaterThan(this.bbox.ur.x)&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y.isGreaterThan(this.bbox.ur.y)&&(this.bbox.ur.y=i.bbox.ur.y),this.polys.push(i)}this.isSubject=t}getSweepEvents(){let e=[];for(let t=0,r=this.polys.length;t<r;t++){let n=this.polys[t].getSweepEvents();for(let i=0,o=n.length;i<o;i++)e.push(n[i])}return e}};var Zv=(e,...t)=>Bl.run("intersection",e,t),mC=Ft.set;function Wv(e,t={}){let r=[];if(X0(e,i=>{r.push(i.coordinates)}),r.length<2)throw new Error("Must specify at least 2 geometries");let n=Zv(r[0],...r.slice(1));return n.length===0?null:n.length===1?$l(n[0],t.properties):j0(n,t.properties)}var dp=Wv,Yv={Point:hp,MultiPoint:Xv,LineString:pp,MultiLineString:Qv,Polygon:gp,MultiPolygon:Jv};function Kv(e,t){let[r,n,i,o]=t,a=Ol([r,o]),s=Ol([i,n]),f=[a,s];if(e.type==="GeometryCollection")throw new Error("Unsupported geometry type GeometryCollection");let l=Yv[e.type],c=l(e.coordinates,f);return{...e,coordinates:c}}function hp([e,t],[r,n]){let i=u0(r[0],n[0],e),o=u0(r[1],n[1],t);return[i,o]}function Zl(e,t){return e.map(r=>hp(Ol(r),t))}function Xv(e,t){return Zl(e,t)}function pp(e,t){return Zl(e,t)}function Qv(e,t){return e.map(r=>pp(r,t))}function gp(e,t){return e.map(r=>Zl(r,t))}function Jv(e,t){return e.map(r=>gp(r,t))}function Ol(e){return kl(e)}function u0(e,t,r){return(r-e)/(t-e)}function e2(e,t,r){var n=e.length,i=Jr(e[0],t),o=[],a,s,f;let l,c;for(r||(r=[]),a=1;a<n;a++){for(l=e[a-1],c=e[a],s=f=Jr(c,t);;)if(i|s){if(i&s)break;i?(l=Nl(l,c,i,t),i=Jr(l,t)):(c=Nl(l,c,s,t),s=Jr(c,t))}else{o.push(l),s!==f?(o.push(c),a<n-1&&(r.push(o),o=[])):a===n-1&&o.push(c);break}i=f}return o.length&&r.push(o),r}function t2(e,t){var r,n,i,o,a,s,f;for(n=1;n<=8;n*=2){for(r=[],i=e[e.length-1],o=!(Jr(i,t)&n),a=0;a<e.length;a++)s=e[a],f=!(Jr(s,t)&n),f!==o&&r.push(Nl(i,s,n,t)),f&&r.push(s),i=s,o=f;if(e=r,!e.length)break}return r}function Nl(e,t,r,n){return r&8?[e[0]+(t[0]-e[0])*(n[3]-e[1])/(t[1]-e[1]),n[3]]:r&4?[e[0]+(t[0]-e[0])*(n[1]-e[1])/(t[1]-e[1]),n[1]]:r&2?[n[2],e[1]+(t[1]-e[1])*(n[2]-e[0])/(t[0]-e[0])]:r&1?[n[0],e[1]+(t[1]-e[1])*(n[0]-e[0])/(t[0]-e[0])]:null}function Jr(e,t){var r=0;return e[0]<t[0]?r|=1:e[0]>t[2]&&(r|=2),e[1]<t[1]?r|=4:e[1]>t[3]&&(r|=8),r}function r2(e,t){let r=Pt(e),n=r.type,i=e.type==="Feature"?e.properties:{},o=r.coordinates;switch(n){case"LineString":case"MultiLineString":{let a=[];return n==="LineString"&&(o=[o]),o.forEach(s=>{e2(s,t,a)}),a.length===1?$0(a[0],i):H0(a,i)}case"Polygon":return $l(d0(o,t),i);case"MultiPolygon":return j0(o.map(a=>d0(a,t)),i);default:throw new Error("geometry "+n+" not supported")}}function d0(e,t){let r=[];for(let n of e){let i=t2(n,t);i.length>0&&((i[0][0]!==i[i.length-1][0]||i[0][1]!==i[i.length-1][1])&&i.push(i[0]),i.length>=4&&r.push(i))}return r}var h0=r2;function n2(e,t,r){let n=yv(e);if(!r||ap(n,r))return!0;let i=dp(wi([n,we(r)]));return i?t==="mvt"?Kv(i.geometry,e):i.geometry:!1}function i2(e,t,r){return mp(e,t,r)}function mp(e,t,r){let n=Gf(e);if(!r||ap(n,r))return!0;let i=dp(wi([we(n),we(r)]));if(!i)return!1;let o=qf(i.geometry,t);return new Set(o)}var o2=[-180,-90,0,90],a2=[0,-90,180,90];function s2(e,t){if(!t)return!0;let r=we(t),n=(0,Dl.polygonToCells)(h0(r,o2).geometry.coordinates,e,!0),i=(0,Dl.polygonToCells)(h0(r,a2).geometry.coordinates,e,!0);return new Set(n.concat(i))}var l2="__geomValue";function f2({tiles:e,tileFormat:t,spatialFilter:r,uniqueIdProperty:n,options:i}){let o=new Map;for(let a of e){if(a.isVisible===!1||!a.data)continue;let s=[a.bbox.west,a.bbox.south,a.bbox.east,a.bbox.north],f=n2(s,t,r);if(f===!1)continue;let l=f===!0?void 0:f;El({map:o,spatialFilter:l,data:a.data.points,type:"Point",bbox:s,tileFormat:t,uniqueIdProperty:n,options:i}),El({map:o,spatialFilter:l,data:a.data.lines,type:"LineString",bbox:s,tileFormat:t,uniqueIdProperty:n,options:i}),El({map:o,spatialFilter:l,data:a.data.polygons,type:"Polygon",bbox:s,tileFormat:t,uniqueIdProperty:n,options:i})}return Array.from(o.values())}function bp({map:e,data:t,startIndex:r,endIndex:n,type:i,bbox:o,tileFormat:a,uniqueIdProperty:s,storeGeometry:f,spatialFilter:l}){let c=d2(t,r),u=p2(c,s,e);if(!u||e.has(u))return;let d=null;if(f||l){let{positions:g}=t,x=m2(r,n,g);d=g2(x,i)}if(d&&l&&!J0(d,l))return;let h=h2(c);f&&d&&(h[l2]=a==="mvt"?hv(d,o):d),e.set(u,h)}function c2({map:e,data:t,spatialFilter:r,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}){let f=yp(t,n),l=s?.storeGeometry||!1;for(let c=0;c<f.length-1;c++){let u=f[c],d=f[c+1];bp({map:e,data:t,startIndex:u,endIndex:d,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,storeGeometry:l,spatialFilter:r})}}function yp(e,t){let r;switch(t){case"Polygon":r=e.primitivePolygonIndices;break;case"LineString":r=e.pathIndices;break;case"Point":r=y2(e);break;default:throw new Error(`Unsupported geometry type: ${t}`)}return r.value}function u2(e,t){return e.featureIds.value[t]}function d2(e,t){let r=u2(e,t),{properties:n,numericProps:i,fields:o}=e,a={uniqueId:o?.[r]?.id,properties:n[r],numericProps:{}};for(let s in i)a.numericProps[s]=i[s].value[t];return a}function h2(e){let{properties:t,numericProps:r}=e;return Object.assign({},t,r)}function p2(e,t,r){if(t)return _l(e,t);if(e.uniqueId)return e.uniqueId;let n=r.size+1;return _l(e,"cartodb_id")||_l(e,"geoid")||n}function _l(e,t){let{properties:r,numericProps:n}=e;return n[t]||r[t]}function g2(e,t){switch(t){case"Polygon":return{type:"Polygon",coordinates:[e]};case"LineString":return{type:"LineString",coordinates:e};case"Point":return{type:"Point",coordinates:e[0]};default:throw new Error("Invalid geometry type")}}function m2(e,t,r){let n=[];for(let i=e;i<t;i++)n.push(Array.from(r.value.subarray(i*r.size,(i+1)*r.size)));return n}function El({map:e,spatialFilter:t,data:r,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}){r?.properties.length&&(t?c2({map:e,data:r,spatialFilter:t,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}):b2({map:e,data:r,type:n,bbox:i,tileFormat:o,uniqueIdProperty:a,options:s}))}function b2({map:e,data:t,type:r,bbox:n,tileFormat:i,uniqueIdProperty:o,options:a}){let s=yp(t,r),f=a?.storeGeometry||!1;for(let l=0;l<s.length-1;l++){let c=s[l],u=s[l+1];bp({map:e,data:t,startIndex:c,endIndex:u,type:r,bbox:n,tileFormat:i,uniqueIdProperty:o,storeGeometry:f})}}function y2(e){let t=e.featureIds.value,r=t[t.length-1],n=t.constructor,i={value:new n(t.length+1),size:1};return i.value.set(t),i.value.set([r+1],t.length),i}function x2({tiles:e,spatialFilter:t,spatialDataColumn:r,spatialDataType:n}){let i=new Map,o=_2(n),a=w2(e,o),s=r||o;if(!a)return[];let f;o==="h3"&&(f=s2(a,t));for(let l of e)if(!(l.isVisible===!1||!l.data)){if(o==="quadbin"){let c=v2(l,o);f=mp(c,a,t)}f&&l.data.forEach(c=>{(f===!0||f.has(c.id))&&i.set(c.id,{...c.properties,[s]:c.id})})}return Array.from(i.values())}function v2(e,t){return t==="quadbin"?e.index.q:e.id}function w2(e,t){let r=e.find(n=>n.data?.length)?.data;if(r){if(t==="quadbin")return Number(ht(r[0].id));if(t==="h3")return(0,xp.getResolution)(r[0].id)}}function _2(e){switch(e){case"h3":return"h3";case"quadbin":return"quadbin";default:throw new Error("Unexpected spatial data type")}}var E2="3.4",_r="geom",vp=7e3,rn=.5,S2=1,Wl=4,Yl=6,wp="__aggregationValue",T2=`1 AS ${wp}`;function C2({tiles:e,...t}){let r={};for(let s of t.rasterMetadata.bands)r[s.name]={...s,nodata:Number(s.nodata)};if(e=e.filter(P2),e.length===0)return[];let n=ht(e[0].index.q),i=e[0].data.blockSize,o=n+BigInt(Math.log2(i)),a=new Map;for(let s of e){let f=s.index.q,l=i2(f,o,t.spatialFilter);if(l===!1)continue;let c=F2(f,o);for(let u=0;u<c.length;u++){if(l!==!0&&!l.has(c[u]))continue;let d={},h=!1;for(let g in s.data.cells.numericProps){let x=s.data.cells.numericProps[g].value[u],S=r[g];k2(x,S.nodata)&&(d[g]=s.data.cells.numericProps[g].value[u],h=!0)}h&&a.set(c[u],d)}}return Array.from(a.values())}function A2(e){return!!e.data?.cells}function P2(e){return!!(e.isVisible&&e.data?.cells?.numericProps)}function F2(e,t){let r=Wt(e),n=Number(t),i=2**(n-r.z),o=r.x*i,a=r.y*i,s=[];for(let f=0,l=i**2;f<l;f++){let c=o+f%i,u=a+Math.floor(f/i);s.push(un({x:c,y:u,z:n}))}return s}function k2(e,t){return Number.isNaN(e)?!1:t!==e}var vC=new Set(Object.values(Gl));function At(e){return Array.isArray(e)?e.map(t=>At(t)):typeof e!="object"?e:Object.entries(e).reduce((t,[r,n])=>(t[r.toLowerCase()]=typeof n=="object"&&n?At(n):n,t),{})}function Q(e,t){if(!e)throw new Error(t)}var _p=class bi extends Error{constructor(t){super(`${bi.NAME}: ${t}`),this.name=bi.NAME}static is(t){return t instanceof bi||t.message?.includes(bi.NAME)}};O(_p,"NAME","InvalidColumnError");var zl=_p;function Ep(e){for(let t in e)return!1;return!0}var L2=e=>e!==null&&typeof e=="object",Sp=e=>L2(e)&&e.constructor==={}.constructor;function M2(e,...t){for(let r of t)for(let n in r)r[n]!==void 0&&(e[n]=r[n]);return e}function ua(e,t,r){let n=r.find(i=>i.name===t);return n&&n.type==="geometry"?"geo":e}function I2({tiles:e,spatialFilter:t,uniqueIdProperty:r,tileFormat:n,spatialDataColumn:i=_r,spatialDataType:o,rasterMetadata:a,storeGeometry:s=!1}){return o==="geo"?f2({tiles:e,tileFormat:n,spatialFilter:t,uniqueIdProperty:r,options:{storeGeometry:s}}):e.some(A2)?(Q(a,"Missing raster metadata"),C2({tiles:e,spatialFilter:t,spatialDataColumn:i,spatialDataType:o,rasterMetadata:a})):x2({tiles:e,spatialFilter:t,spatialDataColumn:i,spatialDataType:o})}var Er=class extends Error{constructor(e,t,r,n){let i="Failed to connect";r&&(i="Server returned: ",r.status===400?i+="Bad request":r.status===401||r.status===403?i+="Unauthorized access":r.status===404?i+="Not found":i+="Error",i+=` (${r.status}):`),i+=` ${e.message||e}`;let o=`${t.requestType} API request failed`;o+=`
170
170
  ${i}`;for(let a of Object.keys(t))a!=="requestType"&&(o+=`
171
171
  ${R2(a)}: ${t[a]}`);o+=`
172
- `,super(o),B(this,"error"),B(this,"errorContext"),B(this,"response"),B(this,"responseJson"),this.name="CartoAPIError",this.response=r,this.responseJson=n,this.error=e,this.errorContext=t}};function R2(e){return e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase())}function O2(...e){return e.map(t=>t.endsWith("/")?t.slice(0,-1):t).join("/")}function _i(e,t,r,...n){return O2(e,t,r,...n)}function B2({apiBaseUrl:e,cartoMapId:t}){return _i(e,"v3","maps","public",t)}function D2({attribute:e,apiBaseUrl:t,connectionName:r,source:n,type:i}){return i==="query"?_i(t,"v3","stats",r,e):_i(t,"v3","stats",r,n,e)}function N2({apiBaseUrl:e,connectionName:t,endpoint:r}){return _i(e,"v3","maps",t,r)}function z2({apiBaseUrl:e,connectionName:t}){return _i(e,"v3","sql",t,"query")}var U2={Accept:"application/json","Content-Type":"application/json"},q2=new Map;async function tn({baseUrl:e,parameters:t={},headers:r={},errorContext:n,maxLengthURL:i=vp,localCache:o,signal:a}){t={v:E2,client:Ci(),...typeof deck<"u"&&deck.VERSION&&{deckglVersion:deck.VERSION},...t},e=H2(e,Object.keys(t));let s=V2(e,t,r),{cache:l,canReadCache:f,canStoreInCache:c}=G2(o);if(f&&l.has(s))return l.get(s);let u=$2(e,t),d={...U2,...r},h=u.length>i?fetch(e,{method:"POST",body:JSON.stringify(t),headers:d,signal:a}):fetch(u,{headers:d,signal:a}),g,x,S=h.then(T=>(g=T,g.json())).then(T=>{if(x=T,!g||!g.ok)throw new Error(T.error);return T}).catch(T=>{throw c&&l.delete(s),new Er(T,n,g,x)});return c&&l.set(s,S),S}function G2(e){let t=!e?.cacheControl?.includes("no-cache"),r=!e?.cacheControl?.includes("no-store");return{cache:e?.cache||q2,canReadCache:t,canStoreInCache:r}}function V2(e,t,r){let n=Object.entries(t).sort(([o],[a])=>o>a?1:-1),i=Object.entries(r).sort(([o],[a])=>o>a?1:-1);return JSON.stringify({baseUrl:e,parameters:n,headers:i})}function $2(e,t){let r=new URL(e);for(let[n,i]of Object.entries(t))Sp(i)||Array.isArray(i)?r.searchParams.set(n,JSON.stringify(i)):i!=null&&r.searchParams.set(n,i.toString());return r.toString()}function H2(e,t){let r=new URL(e);for(let n of t)r.searchParams.has(n)&&r.searchParams.delete(n);return r.toString()}var Ei={apiBaseUrl:$f,headers:{},maxLengthURL:vp};async function _e(e,t,r){let{accessToken:n,connectionName:i,cache:o,...a}=t,s={...Ei,clientId:Ci(),accessToken:n,connectionName:i,endpoint:e};for(let k in a)a[k]&&(s[k]=a[k]);let l=N2(s),{clientId:f,maxLengthURL:c,localCache:u}=s,d={Authorization:`Bearer ${t.accessToken}`,...t.headers},h={client:f,...t.tags,...r},g={requestType:"Map instantiation",connection:t.connectionName,type:e,source:JSON.stringify(h,void 0,2)},{tilejson:x,schema:S}=await tn({baseUrl:l,parameters:h,headers:d,errorContext:g,maxLengthURL:c,localCache:u}),T=x.url[0];o&&(o.value=parseInt(new URL(T).searchParams.get("cache")||"",10)),g.requestType="Map data";let w=await tn({baseUrl:T,parameters:{client:f},headers:d,errorContext:g,maxLengthURL:c,localCache:u});return n&&(w.accessToken=n),S&&(w.schema=S),w}var Xf=async function(e){let{columns:t,filters:r,tilesetTableName:n,propertiesSqlQuery:i,queryParameters:o}=e,a={tilesetTableName:n,propertiesSqlQuery:i};return t&&(a.columns=t.join(",")),r&&(a.filters=r),o&&(a.queryParameters=o),_e("boundary",e,a)},Qf=async function(e){let{filters:t,tilesetTableName:r,columns:n,propertiesTableName:i}=e,o={tilesetTableName:r,propertiesTableName:i};return n&&(o.columns=n.join(",")),t&&(o.filters=t),_e("boundary",e,o)},Tp=class Cp{constructor(t){B(this,"props"),this.props={...Cp.defaultProps,clientId:Ci(),...t}}destroy(){}};B(Tp,"defaultProps",{apiVersion:"v3",apiBaseUrl:$f,clientId:Ci(),filters:{},filtersLogicalOperator:"and"});var Jf=Tp;function j2({response:e,data:t}){if(t.error==="Column not found")throw new Uf(`${t.error} ${t.column_name}`);if(typeof t.error=="string"&&t.error?.includes("Missing columns"))throw new Uf(t.error);switch(e.status){case 401:throw new Error("Unauthorized access. Invalid credentials");case 403:throw new Error("Forbidden access to the requested data");default:throw new Error(t&&t.error&&typeof t.error=="string"?t.error:JSON.stringify(t?.hint||t.error?.[0]))}}async function Z2({url:e,accessToken:t,opts:r}){let n,i,o=r?.method==="POST";try{n=await fetch(e.toString(),{headers:{Authorization:`Bearer ${t}`,...o&&{"Content-Type":"application/json"},...r.headers},...o&&{method:r?.method,body:r?.body},signal:r?.signal,...r?.otherOptions}),i=await n.json()}catch(a){throw a.name==="AbortError"?a:new Error(`Failed request: ${a}`)}return n.ok||j2({response:n,data:i}),i}var p0=["category","histogram","formula","pick","timeseries","range","scatterplot","table","aggregations"],{V3:W2}=z0,Y2=2048;function Tt(e){Q(e.source,"executeModel: missing source"),Q(e.model,"executeModel: missing model"),Q(e.params,"executeModel: missing params"),Q(p0.includes(e.model),`executeModel: model provided isn't valid. Available models: ${p0.join(", ")}`);let{model:t,source:r,params:n,opts:i}=e,{type:o,apiVersion:a,apiBaseUrl:s,accessToken:l,connectionName:f,clientId:c}=r;Q(s,"executeModel: missing apiBaseUrl"),Q(l,"executeModel: missing accessToken"),Q(a===W2,"executeModel: SQL Model API requires CARTO 3+"),Q(o!=="tileset","executeModel: Tilesets not supported");let u=`${s}/v3/sql/${f}/model/${t}`,{data:d,filters:h,filtersLogicalOperator:g="and",spatialDataType:x="geo",spatialDataColumn:S=_r,spatialFiltersMode:T="intersects",tags:w}=r,k={type:o,client:c,source:d,params:n,queryParameters:r.queryParameters||"",filters:h,filtersLogicalOperator:g,...w??{}};k.spatialDataType=x,k.spatialDataColumn=S,r.spatialFilter&&(k.spatialFilters={[S]:r.spatialFilter},x!=="geo"&&(k.spatialFiltersMode=T));let L=u+"?"+K2(k).toString(),M=L.length<=Y2;return M&&(u=L),Z2({url:u,accessToken:r.accessToken,opts:{...i,method:M?"GET":"POST",...!M&&{body:JSON.stringify(k)}}})}function K2(e){let t=new URLSearchParams;for(let r in e)Sp(e[r])||Array.isArray(e[r])?t.append(r,JSON.stringify(e[r])):e[r]===null?t.append(r,"null"):e[r]!==void 0&&t.append(r,String(e[r]));return t}var X2=new Set(Object.values(Vf)),Q2=e=>X2.has(e);function Ap(e,t){if(!t)return{};let r={};for(let n in t)for(let i in t[n]){if(!Q2(i))continue;let o=t[n][i],a=!e||!o?.owner||o?.owner!==e;o&&a&&(r[n]||(r[n]={}),r[n][i]=o)}return r}var Pp="_carto_others",Fp=class extends Jf{_getModelSource(e,t){let r=this.props;return{apiVersion:r.apiVersion,apiBaseUrl:r.apiBaseUrl,clientId:r.clientId,accessToken:r.accessToken,connectionName:r.connectionName,filters:Ap(t,e||r.filters),filtersLogicalOperator:r.filtersLogicalOperator,spatialDataType:r.spatialDataType,spatialDataColumn:r.spatialDataColumn,tags:r.tags}}async getCategories(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,rawResult:a,...s}=e,{column:l,operation:f,operationColumn:c,operationExp:u,othersThreshold:d,orderBy:h}=s;f===De.Custom&&Q(u,"operationExp is required for custom operation");let g=await Tt({model:"category",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:l,operation:f,operationExp:u,operationColumn:c||l,othersThreshold:d,orderBy:h},opts:{signal:t,headers:this.props.headers}}),x=At(g.rows||[]);return a?g:d?[...x,{name:Pp,value:g?.metadata?.others}]:x}async getFeatures(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{columns:s,dataType:l,featureIds:f,z:c,limit:u,tileResolution:d,offset:h}=a;return Tt({model:"pick",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{columns:s,dataType:l,featureIds:f,z:c,offset:h,limit:u||1e3,tileResolution:d||rn},opts:{signal:t,headers:this.props.headers}}).then(({rows:g,metadata:x})=>({rows:g,metadata:x}))}async getFormula(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,operationExp:a,...s}=e,{column:l,operation:f}=s;return f===De.Custom&&Q(a,"operationExp is required for custom operation"),Tt({model:"formula",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:l??"*",operation:f??De.Count,operationExp:a},opts:{signal:t,headers:this.props.headers}}).then(c=>At(c.rows[0]))}async getHistogram(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{column:s,operation:l,ticks:f}=a,c=await Tt({model:"histogram",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s,operation:l,ticks:f},opts:{signal:t,headers:this.props.headers}}).then(u=>At(u.rows));if(c.length){let u=Array(f.length+1).fill(0);return c.forEach(({tick:d,value:h})=>u[d]=h),u}return[]}async getRange(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{column:s}=a;return Tt({model:"range",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s},opts:{signal:t,headers:this.props.headers}}).then(l=>At(l.rows[0]))}async getScatter(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{xAxisColumn:s,xAxisJoinOperation:l,yAxisColumn:f,yAxisJoinOperation:c}=a;return Tt({model:"scatterplot",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{xAxisColumn:s,xAxisJoinOperation:l,yAxisColumn:f,yAxisJoinOperation:c,limit:500},opts:{signal:t,headers:this.props.headers}}).then(d=>At(d.rows)).then(d=>d.map(({x:h,y:g})=>[h,g]))}async getTable(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{columns:s,sortBy:l,sortDirection:f,offset:c=0,limit:u=10}=a;return Tt({model:"table",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s,sortBy:l,sortDirection:f,limit:u,offset:c},opts:{signal:t,headers:this.props.headers}}).then(d=>({rows:d.rows??d.ROWS,totalCount:d.metadata?.total??d.METADATA?.TOTAL}))}async getTimeSeries(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{column:s,operationColumn:l,joinOperation:f,operation:c,operationExp:u,stepSize:d,stepMultiplier:h,splitByCategory:g,splitByCategoryLimit:x,splitByCategoryValues:S}=a;return c===De.Custom&&Q(u,"operationExp is required for custom operation"),Tt({model:"timeseries",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s,stepSize:d,stepMultiplier:h,operationColumn:l||s,joinOperation:f,operation:c,operationExp:u,splitByCategory:g,splitByCategoryLimit:x,splitByCategoryValues:S},opts:{signal:t,headers:this.props.headers}}).then(T=>({rows:At(T.rows),categories:T.metadata?.categories}))}async getAggregations(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,aggregations:a}=e;return Tt({model:"aggregations",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{aggregations:a},opts:{signal:t,headers:this.props.headers}}).then(s=>({rows:s.rows.map(l=>At(l))}))}async getExtent(e={}){let{signal:t,filters:r=this.props.filters,filterOwner:n}=e,{type:i,data:o,apiBaseUrl:a,apiVersion:s,connectionName:l,spatialDataColumn:f,spatialDataType:c,queryParameters:u}=this.getModelSource(r,n);Q(s==="v3","Stats API requires CARTO 3+");let d,h={filters:r,spatialDataType:c};i==="query"?(d=`${a}/${s}/stats/${l}/${f}`,h.q=o,h.queryParameters=u):d=`${a}/${s}/stats/${l}/${o}/${f}`;let g={Authorization:`Bearer ${this.props.accessToken}`,...this.props.headers};return tn({baseUrl:d,headers:g,signal:t,errorContext:{requestType:"Tile stats",connection:l,type:i},parameters:h}).then(({extent:{xmin:S,ymin:T,xmax:w,ymax:k}})=>({bbox:[S,T,w,k]}))}},da=class extends Fp{getModelSource(e,t){return{...super._getModelSource(e,t),type:"query",data:this.props.sqlQuery,queryParameters:this.props.queryParameters}}},Ht={count:e=>e.length,min:(...e)=>Yo(tw,...e),max:(...e)=>Yo(rw,...e),sum:(...e)=>Yo(kp,...e),avg:(...e)=>Yo(ew,...e)};function jt(e,t,r){if(t?.length){if(t.length===1){let i=e[t[0]];return g0(i)?Number(i):i}}else throw new Error("Cannot aggregate a feature without having keys");let n=Ht[r];if(!n)throw new Error(`${r} isn't a valid aggregation function`);return n(t.map(i=>{let o=e[i];return g0(o)?Number(o):o}))}function g0(e){return typeof e=="string"&&e.trim().length>0}var Yo=(e,t,r,n)=>{let i=ha(r),o=(i?.length||0)<=1?J2(t,i||[]):t;return e(o,r,n)};function J2(e,t){let r=n=>n!=null;return t?.length?e.filter(n=>r(n[t[0]])):e.filter(r)}function ew(e,t,r){return kp(e,t,r)/(e.length||1)}function kp(e,t,r){let n=ha(t);return n?e.reduce((i,o)=>i+jt(o,n,r),0):e.reduce((i,o)=>i+o,0)}function tw(e,t,r){let n=ha(t);if(n)return e.reduce((o,a)=>Math.min(o,jt(a,n,r)),1/0);let i=Number.POSITIVE_INFINITY;for(let o of e)i=Math.min(i,o);return i}function rw(e,t,r){let n=ha(t);if(n)return e.reduce((o,a)=>Math.max(o,jt(a,n,r)),-1/0);let i=Number.NEGATIVE_INFINITY;for(let o of e)i=Math.max(i,o);return i}function ha(e){return Array.isArray(e)?e:typeof e=="string"?[e]:void 0}var nw=bx(yx(),1);function iw(e,{sortBy:t,sortByDirection:r="asc",sortByColumnType:n="string"}={}){if(t===void 0)return e;if(!(Array.isArray(t)&&t.length||typeof t=="string"))throw new Error("Sorting options are bad formatted");let o=ow({sortBy:t,sortByDirection:r,sortByColumnType:n||"string"});return e.sort(o)}function ow({sortBy:e,sortByDirection:t,sortByColumnType:r}){let[n,...i]=aw({sortBy:e,sortByDirection:t,sortByColumnType:r}),o=(0,nw.firstBy)(...n);for(let a of i)o=o.thenBy(...a);return o}function aw({sortBy:e,sortByDirection:t,sortByColumnType:r}){let n=r==="number"&&{cmp:(i,o)=>i-o};return Array.isArray(e)||(e=[e]),e.map(i=>{if(typeof i=="string")return[i,{direction:t,...n}];if(Array.isArray(i)){if(i[1]===void 0)return[i,{direction:t,...n}];if(typeof i[1]=="object"){let o=n?{...n,...i[1]}:i[1];return[i[0],{direction:t,...o}]}}return i})}function sw({data:e,valuesColumns:t,joinOperation:r,keysColumn:n,operation:i,othersThreshold:o,orderBy:a="frequency_desc"}){if(Array.isArray(e)&&e.length===0)return{rows:null};let s=e.reduce((c,u)=>{let d=u[n],h=c.get(d)||[];c.set(d,h);let g=jt(u,t,r);return(i==="count"||g!==null)&&g!==void 0&&(h.push(g),c.set(d,h)),c},new Map),l=Ht[i];if(!l)return{rows:[]};let f=Array.from(s).map(([c,u])=>({name:c,value:l(u)})).sort(fw(a));if(o&&f.length>o){let c=f.slice(o).flatMap(({name:u})=>s.get(u));return{rows:f,metadata:{others:l(c)}}}return{rows:f}}function fw(e){switch(e){case"frequency_asc":return(t,r)=>t.value-r.value||Ko(t.name,r.name);case"frequency_desc":return(t,r)=>r.value-t.value||Ko(t.name,r.name);case"alphabetical_asc":return(t,r)=>Ko(t.name,r.name)||r.value-t.value;case"alphabetical_desc":return(t,r)=>Ko(r.name,t.name)||r.value-t.value}}function Ko(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e??"null").localeCompare(String(t??"null"))}function lw(e){let t=new Date(e),r=t.getUTCDay(),n=t.getUTCDate()-r+(r?1:-6);return t.setUTCDate(n),Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}var cw={year:e=>Date.UTC(e.getUTCFullYear()),month:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth()),week:e=>lw(e),day:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),hour:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours()),minute:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()),second:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())};function uw({data:e,valuesColumns:t,joinOperation:r,keysColumn:n,groupType:i,operation:o}){if(Array.isArray(e)&&e.length===0)return null;let a=cw[i];if(!a)return null;let s=e.reduce((f,c)=>{let u=c[n],d=new Date(u),h=a(d);if(!isNaN(h)){let g=f.get(h);g||(g=[],f.set(h,g));let x=jt(c,t,r);x!=null&&(g.push(x),f.set(h,g))}return f},new Map),l=Ht[o];return[...s.entries()].map(([f,c])=>({name:f,value:l(c)})).sort((f,c)=>f.name-c.name)}function dw({data:e,valuesColumns:t,joinOperation:r,ticks:n,operation:i}){if(Array.isArray(e)&&e.length===0)return[];let o=[Number.MIN_SAFE_INTEGER,...n].map((l,f,c)=>({bin:f,start:l,end:f===c.length-1?Number.MAX_SAFE_INTEGER:c[f+1],values:[]}));e.forEach(l=>{let f=jt(l,t,r);if(!(f!=null))return;let u=o.find(d=>d.start<=f&&d.end>f);u&&u.values.push(f)});let a=Ht[i];return o.map(l=>l.values).map(l=>l.length?a(l):0)}function hw({data:e,xAxisColumns:t,xAxisJoinOperation:r,yAxisColumns:n,yAxisJoinOperation:i}){return e.reduce((o,a)=>{let s=jt(a,t,r),l=s!=null,f=jt(a,n,i),c=f!=null;return l&&c&&o.push([s,f]),o},[])}var pw=Object.defineProperty,nn=(e,t)=>pw(e,"name",{value:t,configurable:!0}),Mp=class{constructor(t){this.direction=!1,this.compareProperties=!0;var r,n,i;this.precision=10**-((r=t?.precision)!=null?r:17),this.direction=(n=t?.direction)!=null?n:!1,this.compareProperties=(i=t?.compareProperties)!=null?i:!0}compare(t,r){if(t.type!==r.type||!yi(t,r))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,r.coordinates);case"LineString":return this.compareLine(t.coordinates,r.coordinates);case"Polygon":return this.comparePolygon(t,r);case"GeometryCollection":return this.compareGeometryCollection(t,r);case"Feature":return this.compareFeature(t,r);case"FeatureCollection":return this.compareFeatureCollection(t,r);default:if(t.type.startsWith("Multi")){let n=qf(t),i=qf(r);return n.every(o=>i.some(a=>this.compare(o,a)))}}return!1}compareCoord(t,r){return t.length===r.length&&t.every((n,i)=>Math.abs(n-r[i])<this.precision)}compareLine(t,r,n=0,i=!1){if(!yi(t,r))return!1;let o=t,a=r;if(i&&!this.compareCoord(o[0],a[0])){let l=this.fixStartIndex(a,o);if(l)a=l;else return!1}let s=this.compareCoord(o[n],a[n]);return this.direction||s?this.comparePath(o,a):this.compareCoord(o[n],a[a.length-(1+n)])?this.comparePath(o.slice().reverse(),a):!1}fixStartIndex(t,r){let n,i=-1;for(let o=0;o<t.length;o++)if(this.compareCoord(t[o],r[0])){i=o;break}return i>=0&&(n=[].concat(t.slice(i,t.length),t.slice(1,i+1))),n}comparePath(t,r){return t.every((n,i)=>this.compareCoord(n,r[i]))}comparePolygon(t,r){if(this.compareLine(t.coordinates[0],r.coordinates[0],1,!0)){let n=t.coordinates.slice(1,t.coordinates.length),i=r.coordinates.slice(1,r.coordinates.length);return n.every(o=>i.some(a=>this.compareLine(o,a,1,!0)))}return!1}compareGeometryCollection(t,r){return yi(t.geometries,r.geometries)&&this.compareBBox(t,r)&&t.geometries.every((n,i)=>this.compare(n,r.geometries[i]))}compareFeature(t,r){return t.id===r.id&&(this.compareProperties?el(t.properties,r.properties):!0)&&this.compareBBox(t,r)&&this.compare(t.geometry,r.geometry)}compareFeatureCollection(t,r){return yi(t.features,r.features)&&this.compareBBox(t,r)&&t.features.every((n,i)=>this.compare(n,r.features[i]))}compareBBox(t,r){return!t.bbox&&!r.bbox||(t.bbox&&r.bbox?this.compareCoord(t.bbox,r.bbox):!1)}};nn(Mp,"GeojsonEquality");var gw=Mp;function yi(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}nn(yi,"sameLength");function qf(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}nn(qf,"explode");function Lp(e,t,r){return new gw(r).compare(e,t)}nn(Lp,"geojsonEquality");function el(e,t){if(e===null&&t===null)return!0;if(e===null||t===null)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i of r){let o=e[i],a=t[i],s=m0(o)&&m0(a);if(s&&!el(o,a)||!s&&o!==a)return!1}return!0}nn(el,"equal");var m0=nn(e=>e!=null&&typeof e=="object","isObject");function b0(e,t={}){var r=typeof t=="object"?t.mutate:t;if(!e)throw new Error("geojson is required");var n=Gx(e),i=[];switch(n){case"LineString":i=Tf(e,n);break;case"MultiLineString":case"Polygon":xi(e).forEach(function(a){i.push(Tf(a,n))});break;case"MultiPolygon":xi(e).forEach(function(a){var s=[];a.forEach(function(l){s.push(Tf(l,n))}),i.push(s)});break;case"Point":return e;case"MultiPoint":var o={};xi(e).forEach(function(a){var s=a.join("-");Object.prototype.hasOwnProperty.call(o,s)||(i.push(a),o[s]=!0)});break;default:throw new Error(n+" geometry not supported")}return e.coordinates?r===!0?(e.coordinates=i,e):{type:n,coordinates:i}:r===!0?(e.geometry.coordinates=i,e):we({type:n,coordinates:i},e.properties,{bbox:e.bbox,id:e.id})}function Tf(e,t){var r=xi(e);if(r.length===2&&!y0(r[0],r[1]))return r;var n=[],i=r.length-1,o=n.length;n.push(r[0]);for(var a=1;a<i;a++){var s=n[n.length-1];r[a][0]===s[0]&&r[a][1]===s[1]||(n.push(r[a]),o=n.length,o>2&&x0(n[o-3],n[o-1],n[o-2])&&n.splice(n.length-2,1))}if(n.push(r[r.length-1]),o=n.length,(t==="Polygon"||t==="MultiPolygon")&&y0(r[0],r[r.length-1])&&o<4)throw new Error("invalid polygon");return t==="LineString"&&o<3||x0(n[o-3],n[o-1],n[o-2])&&n.splice(n.length-2,1),n}function y0(e,t){return e[0]===t[0]&&e[1]===t[1]}function x0(e,t,r){var n=r[0],i=r[1],o=e[0],a=e[1],s=t[0],l=t[1],f=n-o,c=i-a,u=s-o,d=l-a,h=f*d-c*u;return h!==0?!1:Math.abs(u)>=Math.abs(d)?u>0?o<=n&&n<=s:s<=n&&n<=o:d>0?a<=i&&i<=l:l<=i&&i<=a}function mw(e,t,r={}){let n=r.precision;if(n=n==null||isNaN(n)?6:n,typeof n!="number"||!(n>=0))throw new Error("precision must be a positive number");let i=Pt(e).type,o=Pt(t).type;return i!==o?!1:Lp(b0(e),b0(t),{precision:n})}var bw=class extends Jf{constructor(){super(...arguments),B(this,"_tiles",[]),B(this,"_features",[]),B(this,"_tileFeatureExtractOptions",{}),B(this,"_tileFeatureExtractPreviousInputs",{})}loadTiles(e){this._tiles=e,this._features.length=0}setTileFeatureExtractOptions(e){this._tileFeatureExtractOptions=e,this._features.length=0}_extractTileFeatures(e){let t=this._tileFeatureExtractPreviousInputs;this._features.length&&yw(t.spatialFilter,e)||(this._features=I2({...L2({},this.props,this._tileFeatureExtractOptions),tiles:this._tiles,spatialFilter:e}),t.spatialFilter=e)}loadGeoJSON({geojson:e,spatialFilter:t}){this._features=fv({geojson:e,spatialFilter:t,...this._tileFeatureExtractOptions}),this._tileFeatureExtractPreviousInputs.spatialFilter=t}async getFeatures(){throw new Error("getFeatures not supported for tilesets")}async getFormula({column:e="*",operation:t=De.Count,joinOperation:r,filters:n,filterOwner:i,spatialFilter:o}){let a=this._getFilteredFeatures(o,n,i);if(a.length===0&&t!==De.Count)return{value:null};if(t===De.Custom)throw new Error("Custom aggregation not supported for tilesets");(e&&e!=="*"||t!==De.Count)&&yr(this._features,e);let s=Ht[t];return Q(s,`Unsupported aggregation operation: ${t}`),{value:s(a,e,r)}}async getHistogram({operation:e=De.Count,ticks:t,column:r,joinOperation:n,filters:i,filterOwner:o,spatialFilter:a}){let s=this._getFilteredFeatures(a,i,o);return this._features.length?(yr(this._features,r),dw({data:s,valuesColumns:Qr(r),joinOperation:n,ticks:t,operation:e})):[]}async getCategories({column:e,operation:t=De.Count,operationColumn:r,joinOperation:n,filters:i,filterOwner:o,spatialFilter:a,othersThreshold:s,orderBy:l="frequency_desc",rawResult:f}){let c=this._getFilteredFeatures(a,i,o);if(!c.length)return[];yr(this._features,e,r);let u=sw({data:c,valuesColumns:Qr(r||e),joinOperation:n,keysColumn:e,operation:t,othersThreshold:s,orderBy:l});return f?u:s?[...u?.rows||[],{name:Pp,value:u?.metadata?.others}]:u?.rows||[]}async getScatter({xAxisColumn:e,yAxisColumn:t,xAxisJoinOperation:r,yAxisJoinOperation:n,filters:i,filterOwner:o,spatialFilter:a}){let s=this._getFilteredFeatures(a,i,o);return s.length?(yr(this._features,e,t),hw({data:s,xAxisColumns:Qr(e),xAxisJoinOperation:r,yAxisColumns:Qr(t),yAxisJoinOperation:n})):[]}async getTable({columns:e,searchFilterColumn:t,searchFilterText:r,sortBy:n,sortDirection:i,sortByColumnType:o,offset:a=0,limit:s=10,filters:l,filterOwner:f,spatialFilter:c}){let u=this._getFilteredFeatures(c,l,f);if(!u.length)return{rows:[],totalCount:0};t&&r&&(console.warn('WidgetTilesetSource: "searchFilterText" is deprecated, use "filters" and FilterType.STRING_SEARCH instead.'),u=u.filter(g=>g[t]&&String(g[t]).toLowerCase().includes(String(r).toLowerCase())));let d=iw(u,{sortBy:n,sortByDirection:i,sortByColumnType:o}),h=d.length;return d=d.slice(Math.min(a,h),Math.min(a+s,h)),d=d.map(g=>{let x={};for(let S of e)x[S]=g[S];return x}),{rows:d,totalCount:h}}async getTimeSeries({column:e,stepSize:t,operation:r,operationColumn:n,joinOperation:i,filters:o,filterOwner:a,spatialFilter:s}){let l=this._getFilteredFeatures(s,o,a);return l.length?(yr(this._features,e,n),Q(r!=="custom","Custom operation not supported for tilesets"),{rows:uw({data:l,valuesColumns:Qr(n||e),keysColumn:e,groupType:t,operation:r,joinOperation:i})||[]}):{rows:[]}}async getRange({column:e,filters:t,filterOwner:r,spatialFilter:n}){let i=this._getFilteredFeatures(n,t,r);return this._features.length?(yr(this._features,e),{min:Ht.min(i,e),max:Ht.max(i,e)}):null}async getAggregations({aggregations:e,filters:t,filterOwner:r,spatialFilter:n}){let i=this._getFilteredFeatures(n,t,r);if(!this._features.length)return{rows:[]};Q(typeof e!="string","Unsupported tileset SQL aggregation");let o={},a=new Set;for(let{column:s,operation:l,alias:f}of e){(s&&s!=="*"||l!==De.Count)&&yr(this._features,s);let c=f.toLowerCase();Q(!a.has(c),`Duplicate alias: ${c}`),a.add(c);let u=Ht[l];Q(u,`Unsupported operation: ${l}`),o[f]=u(i,s)}return{rows:[o]}}async getExtent(){return Promise.reject(new Error("not implemented"))}_getFilteredFeatures(e,t,r){return this._extractTileFeatures(e),Lx(this._features,Ap(r,t||this.props.filters),this.props.filtersLogicalOperator||"and")}};function yr(e,...t){let r=Array.from(new Set(t.map(Qr).flat())),n=Object.keys(e[0]),i=r.filter(o=>o&&!n.includes(o));if(i.length)throw new Uf(`Missing column(s): ${i.join(", ")}`)}function Qr(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function yw(e,t){return e===t?!0:!e||!t?!1:mw(e,t)}var pa=class extends Jf{constructor(e){super(e),B(this,"_localImpl",null),B(this,"_workerImpl",null),B(this,"_workerEnabled"),B(this,"_workerNextRequestId",1),this._workerEnabled=(e.widgetWorker??!0)&&!0&&typeof Worker<"u",this._workerEnabled||(this._localImpl=new bw(this.props))}destroy(){this._localImpl?.destroy(),this._localImpl=null,this._workerImpl?.terminate(),this._workerImpl=null,super.destroy()}_getWorker(){return this._workerImpl?this._workerImpl:(this.props.widgetWorkerUrl?this._workerImpl=new Worker(this.props.widgetWorkerUrl,{name:"cartowidgettileset"}):this._workerImpl=new Worker(new URL("@carto/api-client/worker",t6.url),{type:"module",name:"cartowidgettileset"}),this._workerImpl.addEventListener("error",e=>{console.error("widget-tileset-source worker error",e)}),this._workerImpl.postMessage({method:"init",params:[this.props]}),this._workerImpl)}_executeWorkerMethod(e,t,r){if(!this._workerEnabled)return this._localImpl[e](...t);let n=this._getWorker(),i=this._workerNextRequestId++,o=null,a=null;function s(c){let u=c.data;u.requestId===i&&(r?.aborted||(u.ok?o(u.result):a(new Error(u.error))))}function l(){a(new Error(r.reason))}n.addEventListener("message",s),r?.addEventListener("abort",l);let f=new Promise((c,u)=>{o=c,a=u,n.postMessage({requestId:i,method:e,params:t})});return f.finally(()=>{n.removeEventListener("message",s),r?.removeEventListener("abort",l)}),f}loadTiles(e){if(!this._workerEnabled)return this._localImpl.loadTiles(e);let t=this._getWorker();e=e.map(({id:r,index:n,bbox:i,isVisible:o,data:a})=>({id:r,index:n,isVisible:o,data:a,bbox:i})),t.postMessage({method:"loadTiles",params:[e]})}setTileFeatureExtractOptions(e){if(!this._workerEnabled)return this._localImpl?.setTileFeatureExtractOptions(e);this._getWorker().postMessage({method:"setTileFeatureExtractOptions",params:[e]})}loadGeoJSON({geojson:e,spatialFilter:t}){if(!this._workerEnabled)return this._localImpl.loadGeoJSON({geojson:e,spatialFilter:t});this._getWorker().postMessage({method:"loadGeoJSON",params:[{geojson:e,spatialFilter:t}]})}async getFeatures(){throw new Error("getFeatures not supported for tilesets")}async getFormula({signal:e,...t}){return this._executeWorkerMethod("getFormula",[t],e)}async getHistogram({signal:e,...t}){return this._executeWorkerMethod("getHistogram",[t],e)}async getCategories({signal:e,...t}){return this._executeWorkerMethod("getCategories",[t],e)}async getScatter({signal:e,...t}){return this._executeWorkerMethod("getScatter",[t],e)}async getTable({signal:e,...t}){return this._executeWorkerMethod("getTable",[t],e)}async getTimeSeries({signal:e,...t}){return this._executeWorkerMethod("getTimeSeries",[t],e)}async getRange({signal:e,...t}){return this._executeWorkerMethod("getRange",[t],e)}async getAggregations({signal:e,...t}){return this._executeWorkerMethod("getAggregations",[t],e)}async getExtent(){return Promise.resolve({bbox:this.props.spatialDataBounds})}},xw=class extends pa{},ga=class extends Fp{getModelSource(e,t){return{...super._getModelSource(e,t),type:"table",data:this.props.tableName}}},ma=async function(e){let{aggregationExp:t,aggregationResLevel:r=Yf,sqlQuery:n,spatialDataColumn:i="h3",queryParameters:o,filters:a}=e,s="h3",l={aggregationExp:t,spatialDataColumn:i,spatialDataType:s,q:n};return r&&(l.aggregationResLevel=String(r)),o&&(l.queryParameters=o),a&&(l.filters=a),_e("query",e,l).then(f=>({...f,widgetSource:new da({...e,spatialDataColumn:i,spatialDataType:ua(s,i,f.schema)})}))},ba=async function(e){let{aggregationExp:t,aggregationResLevel:r=Yf,spatialDataColumn:n="h3",tableName:i,filters:o}=e,a="h3",s={aggregationExp:t,name:i,spatialDataColumn:n,spatialDataType:a};return r&&(s.aggregationResLevel=String(r)),o&&(s.filters=o),_e("table",e,s).then(l=>({...l,widgetSource:new ga({...e,spatialDataColumn:n,spatialDataType:ua(a,n,l.schema)})}))};function ya(e){return new URL(e.tiles[0]).searchParams.get("formatTiles")==="mvt"?"mvt":"binary"}var tl=async function(e){let{tableName:t,spatialDataColumn:r="h3"}=e;return _e("tileset",e,{name:t}).then(i=>({...i,widgetSource:new pa({...e,tileFormat:ya(i),spatialDataColumn:r,spatialDataType:"h3",spatialDataBounds:i.bounds})}))},xa=async function(e){let{aggregationExp:t,aggregationResLevel:r=Kf,sqlQuery:n,spatialDataColumn:i="quadbin",queryParameters:o,filters:a}=e,s="quadbin",l={aggregationExp:t,q:n,spatialDataColumn:i,spatialDataType:s};return r&&(l.aggregationResLevel=String(r)),o&&(l.queryParameters=o),a&&(l.filters=a),_e("query",e,l).then(f=>({...f,widgetSource:new da({...e,spatialDataColumn:i,spatialDataType:ua(s,i,f.schema)})}))},va=async function(e){let{aggregationExp:t,aggregationResLevel:r=Kf,spatialDataColumn:n="quadbin",tableName:i,filters:o}=e,a="quadbin",s={aggregationExp:t,name:i,spatialDataColumn:n,spatialDataType:a};return r&&(s.aggregationResLevel=String(r)),o&&(s.filters=o),_e("table",e,s).then(l=>({...l,widgetSource:new ga({...e,spatialDataColumn:n,spatialDataType:ua(a,n,l.schema)})}))},rl=async function(e){let{tableName:t,spatialDataColumn:r="quadbin"}=e;return _e("tileset",e,{name:t}).then(i=>({...i,widgetSource:new pa({...e,tileFormat:ya(i),spatialDataColumn:r,spatialDataType:"quadbin",spatialDataBounds:i.bounds})}))},wa=async function(e){let{tableName:t,filters:r}=e,n={name:t};return r&&(n.filters=r),_e("raster",e,n).then(i=>({...i,widgetSource:new xw({...e,tileFormat:ya(i),spatialDataColumn:"quadbin",spatialDataType:"quadbin",spatialDataBounds:i.bounds,rasterMetadata:i.raster_metadata})}))},vw=async function(e){let{columns:t,spatialDataColumn:r=_r,sqlQuery:n,tileResolution:i=rn,queryParameters:o,aggregationExp:a,trajectoryIdColumn:s,timestampColumn:l}=e,f="trajectory",c={spatialDataColumn:r,spatialDataType:f,tileResolution:i.toString(),q:n,trajectoryIdColumn:s,timestampColumn:l};t&&(c.columns=t.join(",")),o&&(c.queryParameters=o),a&&(c.aggregationExp=a);let u=await _e("query",e,c),d=new da({...e,spatialDataColumn:r,spatialDataType:f,tileResolution:i}),h=await d.getRange({column:l});return{...u,widgetSource:d,timestampRange:h}},ww=async function(e){let{columns:t,spatialDataColumn:r=_r,tableName:n,tileResolution:i=rn,aggregationExp:o,trajectoryIdColumn:a,timestampColumn:s}=e,l="trajectory",f={name:n,spatialDataColumn:r,spatialDataType:l,tileResolution:i.toString(),trajectoryIdColumn:a,timestampColumn:s};t&&(f.columns=t.join(",")),o&&(f.aggregationExp=o);let c=await _e("table",e,f),u=new ga({...e,spatialDataColumn:r,spatialDataType:l,tileResolution:i}),d=await u.getRange({column:s});return{...c,widgetSource:u,timestampRange:d}},_a=async function(e){let{columns:t,filters:r,spatialDataColumn:n=_r,sqlQuery:i,tileResolution:o=rn,queryParameters:a,aggregationExp:s}=e,l="geo",f={spatialDataColumn:n,spatialDataType:l,tileResolution:o.toString(),q:i};return t&&(f.columns=t.join(",")),r&&(f.filters=r),a&&(f.queryParameters=a),s&&(f.aggregationExp=s),_e("query",e,f).then(c=>({...c,widgetSource:new da({...e,spatialDataColumn:n,spatialDataType:l,tileResolution:o})}))},Ea=async function(e){let{columns:t,filters:r,spatialDataColumn:n=_r,tableName:i,tileResolution:o=rn,aggregationExp:a}=e,s="geo",l={name:i,spatialDataColumn:n,spatialDataType:s,tileResolution:o.toString()};return t&&(l.columns=t.join(",")),r&&(l.filters=r),a&&(l.aggregationExp=a),_e("table",e,l).then(f=>({...f,widgetSource:new ga({...e,spatialDataColumn:n,spatialDataType:s,tileResolution:o})}))},Sa=async function(e){let{tableName:t,spatialDataColumn:r=_r}=e;return _e("tileset",e,{name:t}).then(i=>({...i,widgetSource:new pa({...e,tileFormat:ya(i),spatialDataColumn:r,spatialDataType:"geo",spatialDataBounds:i.bounds})}))};var Ip={boundaryQuerySource:Xf,boundaryTableSource:Qf,h3QuerySource:ma,h3TableSource:ba,h3TilesetSource:tl,quadbinQuerySource:xa,quadbinTableSource:va,quadbinTilesetSource:rl,rasterSource:wa,trajectoryQuerySource:vw,trajectoryTableSource:ww,vectorQuerySource:_a,vectorTableSource:Ea,vectorTilesetSource:Sa},Rp=async function(e){let{apiBaseUrl:t=Ei.apiBaseUrl,maxLengthURL:r=Ei.maxLengthURL,clientId:n=Ci(),localCache:i,connectionName:o,sqlQuery:a,queryParameters:s,internalParameters:l}=e,f={q:a};s&&(f.queryParameters=s);let c=z2({apiBaseUrl:t,connectionName:o}),u={Authorization:`Bearer ${e.accessToken}`,...e.headers},d={client:n,...e.tags,...l,...f},h={requestType:"SQL",connection:e.connectionName,type:"query",source:JSON.stringify(d,void 0,2)};return await tn({baseUrl:c,parameters:d,headers:u,errorContext:h,maxLengthURL:r,localCache:i,signal:e.signal})},_w="https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json",Ew=["positron","dark-matter","voyager"],Sw={roadmap:{mapTypeId:"roadmap",mapId:"3754c817b510f791"},"google-positron":{mapTypeId:"roadmap",mapId:"ea84ae4203ef21cd"},"google-dark-matter":{mapTypeId:"roadmap",mapId:"2fccc3b36c22a0e2"},"google-voyager":{mapTypeId:"roadmap",mapId:"885caf1e15bb9ef2"},satellite:{mapTypeId:"satellite"},hybrid:{mapTypeId:"hybrid"},terrain:{mapTypeId:"terrain"}},Tw=[{slug:"label",filter:({id:e})=>!!e.match(/(?=(label|_label|place-|place_|poi-|poi_|watername_|roadname_|housenumber))/),defaultVisibility:!0},{slug:"road",filter:({id:e})=>!!e.match(/(?=(road|railway|tunnel|street|bridge))(?!.*label)/),defaultVisibility:!0},{slug:"border",filter:({id:e})=>!!e.match(/border|boundaries|boundary_/),defaultVisibility:!1},{slug:"building",filter:({id:e})=>!!e.match(/building/),defaultVisibility:!0},{slug:"water",filter:({id:e})=>!!e.match(/(?=(water|stream|ferry))/),defaultVisibility:!0},{slug:"land",filter:({id:e})=>!!e.match(/(?=(parks|landcover|industrial|sand|hillshade|park_))/),defaultVisibility:!0}];function Cw(e,t){if(!Array.isArray(e?.layers))return e;let r=Tw.filter(i=>!t[i.slug]).map(i=>i.filter),n=e.layers.filter(i=>r.every(o=>!o(i)));return{...e,layers:n}}function Aw(e){return e&&Object.values(e).every(Boolean)===!1}function $t(e){return _w.replace("{basemap}",e)}async function Pw({styleUrl:e,errorContext:t}){let r;return await fetch(e,{mode:"cors"}).then(n=>(r=n,n.json())).catch(n=>{throw new Er(n,{...t,requestType:"Basemap style"},r)})}var _C={VOYAGER:$t("voyager"),POSITRON:$t("positron"),DARK_MATTER:$t("dark-matter"),VOYAGER_NOLABELS:$t("voyager-nolabels"),POSITRON_NOLABELS:$t("positron-nolabels"),DARK_MATTER_NOLABELS:$t("dark-matter-nolabels")};function Op(e){try{let t=zw(e),r=n=>Ct(t,n);return r.symbols=Nw(t),r}catch{return null}}function Ai(e,t=e.length){return new Array(t)}function vi(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var Fw=e=>(t,r)=>{let n=Math.min(t.length,r.length),i=Ai(t,n);for(let o=0;o<n;o++)i[o]=e(t[o],r[o]);return i},kw=e=>(t,r)=>{let n=t.length,i=Ai(t,n);for(let o=0;o<n;o++)i[o]=e(t[o],r);return i},Mw=e=>(t,r)=>{let n=r.length,i=Ai(r,n);for(let o=0;o<n;o++)i[o]=e(t,r[o]);return i},Lw=e=>t=>{let r=t.length,n=Ai(t,r);for(let i=0;i<r;i++)n[i]=e(t[i]);return n};function Ta(e,t){return Object.keys(e).reduce((r,n)=>(r[n]=t(e[n]),r),{})}var Ca={"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"&":(e,t)=>e&t,"==":(e,t)=>+(e==t),"!=":(e,t)=>+(e!=t),"===":(e,t)=>+(e===t),"!==":(e,t)=>+(e!==t),"<":(e,t)=>+(e<t),">":(e,t)=>+(e>t),"<=":(e,t)=>+(e<=t),">=":(e,t)=>+(e>=t),"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t},Bp={"-":e=>-e,"+":e=>+e,"~":e=>~e,"!":e=>+!e},Iw=Ta(Ca,Fw),Rw=Ta(Ca,Mw),Ow=Ta(Ca,kw),Bw=Ta(Bp,Lw);function Dw(e,t,r){let n=vi(t),i=vi(r);return n&&i?Iw[e]:n?Ow[e]:i?Rw[e]:Ca[e]}function Ct(e,t){let r=e;switch(r.type){case"BinaryExpression":{let n=Ct(r.left,t),i=Ct(r.right,t);return Dw(r.operator,n,i)(n,i)}case"ConditionalExpression":{let n=Ct(r.test,t);if(vi(n)){let i=n.length,o=Ct(r.consequent,t),a=Ct(r.alternate,t),s=Ai(n);for(let l=0;l<i;l++){let f=n[l]?o:a;s[l]=vi(f)?f[l]??NaN:f}return s}else return Ct(n?r.consequent:r.alternate,t)}case"Identifier":return t[r.name];case"Literal":return r.value;case"UnaryExpression":{let n=Ct(r.argument,t);return(vi(n)?Bw[r.operator]:Bp[r.operator])(n)}default:return}}function xr(e,t){let r=e;switch(t(r),r.type){case"BinaryExpression":{xr(r.left,t),xr(r.right,t);break}case"ConditionalExpression":{xr(r.test,t),xr(r.consequent,t),xr(r.alternate,t);break}case"UnaryExpression":{xr(r.argument,t);break}}}function Nw(e){let t=new Set;return xr(e,r=>{r.type==="Identifier"&&t.add(r.name)}),Array.from(t)}function zw(e){return jr(e)}function nl(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Dp(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Pi(){}var Si=.7,fa=1/Si,en="\\s*([+-]?\\d+)\\s*",Ti="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uw=/^#([0-9a-f]{3,8})$/,qw=new RegExp(`^rgb\\(${en},${en},${en}\\)$`),Gw=new RegExp(`^rgb\\(${ut},${ut},${ut}\\)$`),Vw=new RegExp(`^rgba\\(${en},${en},${en},${Ti}\\)$`),$w=new RegExp(`^rgba\\(${ut},${ut},${ut},${Ti}\\)$`),Hw=new RegExp(`^hsl\\(${Ti},${ut},${ut}\\)$`),jw=new RegExp(`^hsla\\(${Ti},${ut},${ut},${Ti}\\)$`),v0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};nl(Pi,il,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:w0,formatHex:w0,formatHex8:Zw,formatHsl:Ww,formatRgb:_0,toString:_0});function w0(){return this.rgb().formatHex()}function Zw(){return this.rgb().formatHex8()}function Ww(){return Np(this).formatHsl()}function _0(){return this.rgb().formatRgb()}function il(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Uw.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?E0(t):r===3?new ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Xo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Xo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=qw.exec(e))?new ve(t[1],t[2],t[3],1):(t=Gw.exec(e))?new ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Vw.exec(e))?Xo(t[1],t[2],t[3],t[4]):(t=$w.exec(e))?Xo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Hw.exec(e))?C0(t[1],t[2]/100,t[3]/100,1):(t=jw.exec(e))?C0(t[1],t[2]/100,t[3]/100,t[4]):v0.hasOwnProperty(e)?E0(v0[e]):e==="transparent"?new ve(NaN,NaN,NaN,0):null}function E0(e){return new ve(e>>16&255,e>>8&255,e&255,1)}function Xo(e,t,r,n){return n<=0&&(e=t=r=NaN),new ve(e,t,r,n)}function Yw(e){return e instanceof Pi||(e=il(e)),e?(e=e.rgb(),new ve(e.r,e.g,e.b,e.opacity)):new ve}function ol(e,t,r,n){return arguments.length===1?Yw(e):new ve(e,t,r,n??1)}function ve(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}nl(ve,ol,Dp(Pi,{brighter(e){return e=e==null?fa:Math.pow(fa,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ve(wr(this.r),wr(this.g),wr(this.b),la(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:S0,formatHex:S0,formatHex8:Kw,formatRgb:T0,toString:T0}));function S0(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}`}function Kw(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}${vr((isNaN(this.opacity)?1:this.opacity)*255)}`}function T0(){let e=la(this.opacity);return`${e===1?"rgb(":"rgba("}${wr(this.r)}, ${wr(this.g)}, ${wr(this.b)}${e===1?")":`, ${e})`}`}function la(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vr(e){return e=wr(e),(e<16?"0":"")+e.toString(16)}function C0(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Ze(e,t,r,n)}function Np(e){if(e instanceof Ze)return new Ze(e.h,e.s,e.l,e.opacity);if(e instanceof Pi||(e=il(e)),!e)return new Ze;if(e instanceof Ze)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,l=(o+i)/2;return s?(t===o?a=(r-n)/s+(r<n)*6:r===o?a=(n-t)/s+2:a=(t-r)/s+4,s/=l<.5?o+i:2-o-i,a*=60):s=l>0&&l<1?0:a,new Ze(a,s,l,e.opacity)}function Xw(e,t,r,n){return arguments.length===1?Np(e):new Ze(e,t,r,n??1)}function Ze(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}nl(Ze,Xw,Dp(Pi,{brighter(e){return e=e==null?fa:Math.pow(fa,e),new Ze(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,e),new Ze(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ve(Cf(e>=240?e-240:e+120,i,n),Cf(e,i,n),Cf(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Ze(A0(this.h),Qo(this.s),Qo(this.l),la(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=la(this.opacity);return`${e===1?"hsl(":"hsla("}${A0(this.h)}, ${Qo(this.s)*100}%, ${Qo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function A0(e){return e=(e||0)%360,e<0?e+360:e}function Qo(e){return Math.max(0,Math.min(1,e||0))}function Cf(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}function Qw(e,t){let{properties:r,numericProps:n}=e;return new Proxy(r[t]||{},{get(i,o){return o in n?n[o].value[t]:i[o]},has(i,o){return o in n||o in i},ownKeys(i){return[...Object.keys(n),...Reflect.ownKeys(i)]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}})}function zp(){let e;function t(r){return r===null?e:r}return t.invert=t,t.domain=t.range=r=>r,t.unknown=r=>(r&&(e=r),e),t.copy=()=>{let r=zp();return r.unknown(e),r},t}function Up(e){return!(e?.type==="tileset"||e.providerId==="databricks")}var Jw=new Intl.DateTimeFormat("en-US",{year:"2-digit",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:"UTC"});function e8(e){return Jw.format(new Date(e))}function t8(e){return String(Math.floor(new Date(e).getTime()/1e3))}function Af(e){let t=Math.pow(10,e);if(e<0){let r=Math.pow(10,-e);return Math.round(t*r)/r}return t}function qp({min:e,max:t,steps:r}){if(e===0){if(t===1/0)return[...Array(r-1)].map((a,s)=>Af(s+1));let n=Math.log10(t),o=Math.ceil(n)-r+1;return[...Array(r-1)].map((a,s)=>Af(o+s))}else{let n=Math.log10(e),i=Math.ceil(n)===n?n+1:Math.ceil(n);return[...Array(r-1)].map((o,a)=>Af(i+a))}}var Gp={linear:gr,ordinal:cr,log:li,point:Ys,quantile:ci,quantize:ui,sqrt:yf,custom:mr,identity:zp};function r8(e){return e}var al=e=>{let{r:t,g:r,b:n}=ol(e);return[t,r,n]},n8=e=>{let[t,r,n]=e,i=t.toString(16).padStart(2,"0"),o=r.toString(16).padStart(2,"0"),a=n.toString(16).padStart(2,"0");return`#${i}${o}${a}`.toUpperCase()},i8="#868d91",o8=al(i8),P0={getFillColor:"opacity",getLineColor:"strokeOpacity",getTextColor:"opacity"},a8=e=>{let{r:t,g:r,b:n,opacity:i}=ol(e);return[t,r,n,255*i]},s8={color:"getFillColor",isVisible:"visible",label:"cartoLabel",textLabel:{alignment:"getTextAlignmentBaseline",anchor:"getTextAnchor",color:"getTextColor",size:"getTextSize"},visConfig:{enable3d:"extruded",elevationScale:"elevationScale",filled:"filled",strokeColor:"getLineColor",stroked:"stroked",thickness:"getLineWidth",radius:"getPointRadius",wireframe:"wireframe"}},f8={isVisible:"visible",visConfig:{opacity:"opacity"}},l8={color:"getIconColor",visConfig:{radius:"getIconSize"}},c8={visConfig:{colorRange:e=>({colorRange:e.colors.map(a8)}),radius:e=>({radiusPixels:20+e}),opacity:"opacity"}},u8={lineMiterLimit:2,lineWidthUnits:"pixels",pointRadiusUnits:"pixels",rounded:!0,wrapLongitude:!1};function F0(e={},t={}){return{...e,...t,visConfig:{...e.visConfig,...t.visConfig}}}var d8=["geojson","grid","heatmap","hexagon","hexagonId","point"],k0=0,h8=64,p8=new Intl.NumberFormat("en-US",{maximumFractionDigits:2,notation:"compact"});function g8(e,t,r){if(d8.includes(e))throw new Error(`Outdated layer type: ${e}. Please open map in CARTO Builder to automatically migrate.`);if(e==="raster")return{propMap:f8,defaultProps:{}};let n=s8;t.visConfig?.customMarkers&&(n=F0(n,l8)),e==="heatmapTile"&&(n=F0(n,c8));let{aggregationExp:i,aggregationResLevel:o}=r;return{propMap:n,defaultProps:{...u8,...i&&{aggregationExp:i},...o&&{aggregationResLevel:o},uniqueIdProperty:"geoid"}}}function m8(e,t,r){if(t==="ordinal"||t==="point")return e.categories?e.categories.map(i=>i.category).filter(i=>i!=null).slice(0,r):[0,1];if(t==="quantile"&&e.quantiles){let i="global"in e.quantiles?e.quantiles.global:e.quantiles;if(r===2&&!i[2]&&i[4]?.length===5)return[i[4][0],i[4][2],i[4][4]];if(i[r])return i[r]}let{min:n}=e;return t==="log"&&n===0&&(n=1e-5),[n??0,e.max??1]}function Vp(e,t,r,n){if(e.tilestats){let{attributes:i}=e.tilestats.layers[0],o=i.find(a=>a.attribute===t);if(o)return m8(o,r,n)}return[0,1]}function Aa(e,t){return t.features||t.tilestats||t.raster_metadata?(r,n)=>{if(r)return e(r.properties||r.__source.object.properties);let{data:i,index:o}=n,a=Qw(i,o);return e(a)}:e}function $p(e){return e!==void 0?Math.round(255*Math.pow(e,1/2.2)):255}function Hp(e,t){let r=[e];return t&&(r=r.concat([t,t.toUpperCase()].map(n=>`${e}_${n}`))),r}function jp(e,t){for(let r of e)if(r in t)return[r];return e}function M0({name:e,colorColumn:t},r,{aggregation:n,range:i},o,a){let{scale:s,domain:l}=b8(t||e,t?"identity":r,i,a),f=$p(o),c=Hp(t||e,n);return{accessor:Aa(d=>{c[0]in d||(c=jp(c,d));let h=d[c[0]],g=s(h);return[...typeof g=="string"?al(g):g,h===null?0:f]},a),scaleDomain:s.domain(),domain:l,range:(s.range()||[]).map(n8)}}function b8(e,t,r,n){let i,o=[],{colors:a}=r,s=Vp(n,e,t,a.length);if(t!=="identity")if(r.colorMap){let{colorMap:l}=r;i=[],l.forEach(([f,c])=>{i.push(f),o.push(c)})}else if(t==="custom"&&r.uiCustomScaleType==="logarithmic"){let[l,f]=s;i=qp({min:l,max:f,steps:a.length}),o=a}else o=a;return{scale:Zp(t,i||s,o.map(al),o8),domain:s}}function Zp(e,t,r,n){let i=Gp[e]();return i.domain(t),i.range(r),i.unknown(n),i}var y8="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz4NCjwvc3ZnPg==";function x8(e,t,{fallbackUrl:r,maxIconSize:n,useMaskedIcons:i},o){let a=u=>({id:`${u}@@${n}`,url:u,width:n,height:n,mask:i}),s=r||y8;t?.othersMarker&&(s=t.othersMarker);let l=a(s);if(!t||!e)return()=>l;let f={};for(let{value:u,markerUrl:d}of t.markerMap)d&&(f[u]=a(d));return Aa(u=>{let d=u[e.name];return f[d]||l},o)}function v8(e,t){let{radiusRange:r,radius:n}=e,{radiusField:i,sizeField:o}=t;return Math.ceil(r&&(i||o)?r[1]:n)}function w8(e){return typeof e=="function"?(t,r)=>-e(t,r):-e}function pi({name:e},t,r,n,i){let o=t?Gp[t]():r8,a=[];t&&n&&(r!==De.Count?(a=Vp(i,e,t),o.domain(a)):a=o.domain(),o.range(n));let s=Hp(e,r);return{accessor:Aa(f=>{s[0]in f||(s=jp(s,f));let c=f[s[0]];return o(c)},i),domain:a,scaleDomain:a,range:n}}var L0={date:e8,integer:Et("i"),float:Et(".5f"),timestamp:t8,default:String};function I0({name:e,type:t},r){let n=L0[t]||L0.default;return Aa(o=>n(o[e]),r)}function R0(e,t,r,n){let{min:i,max:o}=t[n],a=e[n];if(i===o)return r[1];let s=(a-i)/(o-i);return r[0]+s*(r[1]-r[0])}function _8(e,t,r){return r&&e==="clusterTile"?E8(S8(r),"count",t):wp}function E8(e,t,r){let n=`${e}_${t}`;return r==="snowflake"?n.toUpperCase():n}function S8(e){return e?e[0].name:""}function T8(e){return e>=80||e>=72?24:e>=56?20:e>=40?16:e>=24?13:(e>=8,11)}var C8=[134,141,145],A8=["red","green","blue"];function Wp(e){return e==="nan"?t=>!isNaN(t):(typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?t=>t!==e&&!isNaN(t):()=>!0)}function sl(e){return t=>!t||!("data"in t)||!t?.data?.cells?.numericProps?t:e(t)}function P8(e,t){let r=Wp(t),n=Object.entries(e).map(([a,{value:s}])=>({bandName:a,values:s,copied:!1})),i=n[0].values.length;for(let a=0;a<i;a++){let s=!1;for(let l=0;l<n.length;l++)s=s||r(n[l].values[a]);if(!s)for(let l=0;l<n.length;l++)n[l].copied||(n[l].copied=!0,n[l].values=Array.from(n[l].values)),n[l].values[a]=NaN}return n.reduce((a,{bandName:s,values:l})=>(a[s]=l,a),{})}function F8({colorBand:e,rasterMetadata:t,usedSymbols:r}){if(!e||!e.type||e.type==="none")return;let n=e?.type==="expression"?e.value:void 0,i=n?Op(n):void 0;return sl(a=>{let s=a.data;if(n&&a.customExpressionResults?.[n])return a;let l=a.expressionEvalContext;if(!l){let c=r.reduce((u,d)=>(u[d]=s.cells.numericProps[d],u),{});l=P8(c,t.nodata),a={...a,expressionEvalContext:l}}if(!i||!n)return a;let f=i(l);return{...a,customExpressionResults:{...a.customExpressionResults,[n]:f}}})}function k8(e){let t=e.filter(r=>r);if(t.length!==0)return t.length===1?t[0]:r=>t.reduce((n,i)=>i(n),r)}function M8({bandDefs:e,attribute:t}){return sl(r=>{let n=r.length,i=f=>f?.type==="expression"?r.customExpressionResults?.[f.value]:f?.type==="band"?r.expressionEvalContext?.[f.value]:0,o=i(e.red),a=i(e.green),s=i(e.blue),l=new Uint8Array(n*4);for(let f=0,c=0;f<n;f++,c+=4){let u=typeof o=="number"?o:o?o[f]:NaN,d=typeof a=="number"?a:a?a[f]:NaN,h=typeof s=="number"?s:s?s[f]:NaN;isNaN(u)&&isNaN(d)&&isNaN(h)?ca(l,c,0,0,0,0):ca(l,c,u,d,h,255)}return r.customExpressionResults=void 0,r.expressionEvalContext=void 0,{...r,attributes:{[t]:l}}})}function L8(e){return Array.from(e.reduce((t,r)=>(r.type==="expression"&&(Op(r.value)?.symbols||[]).forEach(i=>t.add(i)),r.type==="band"&&t.add(r.value),t),new Set))}function I8({layerConfig:e,rasterMetadata:t,visualChannels:r}){let{visConfig:n}=e,{colorBands:i}=n,o={red:i?.find(c=>c.band==="red"),green:i?.find(c=>c.band==="green"),blue:i?.find(c=>c.band==="blue")},a=M8({bandDefs:o,attribute:"instanceFillColors"}),s=i?L8(i):[],l=A8.map(c=>F8({colorBand:o[c],rasterMetadata:t,usedSymbols:s}));return{dataTransform:k8([...l,a]),updateTriggers:Yp({layerConfig:e,visualChannels:r})}}function R8({bandName:e,scaleFun:t,nodata:r,attribute:n}){let i=Wp(r);return sl(o=>{let a=o.length,s=o.data.cells.numericProps[e].value,l=new Uint8Array(a*4);for(let f=0;f<a;f++){let c=s[f];if(!i(c))ca(l,f*4,0,0,0,0);else{let u=t(c);ca(l,f*4,u[0],u[1],u[2],255)}}return{...o,attributes:{[n]:l}}})}function O8(e,t,r){if(t==="ordinal")return r.colorMap?.map(([n])=>n)||[];if(t==="quantile"){let n=r.colors.length,i=e.stats.quantiles?.[n];return i?[e.stats.min,...i,e.stats.max]:[0,1]}return[e.stats.min,e.stats.max]}function B8({layerConfig:e,rasterMetadata:t,visualChannels:r}){let{visConfig:n}=e,{colorField:i}=r,{rasterStyleType:o}=n,a=o==="ColorRange"?n.colorRange:n.uniqueValuesColorRange,s=o==="ColorRange"?r.colorScale:"ordinal",l=t.bands.find(h=>h.name===i?.name);if(!i?.name||!s||!a||!l)return{};let f=O8(l,s,a),c=f;s==="custom"&&(a.uiCustomScaleType==="logarithmic"?c=qp({min:l.stats.min,max:l.stats.max,steps:a.colors.length}):c=a.colorMap?.map(([h])=>h)||[]);let u=Zp(s,c,a.colors.map(D8),C8);return{dataTransform:R8({bandName:l.name,scaleFun:u,nodata:l?.nodata??t.nodata,attribute:"instanceFillColors"}),updateTriggers:Yp({layerConfig:e,visualChannels:r}),domain:f,scaleDomain:u.domain(),range:a.colors,type:s,field:i}}function Yp({layerConfig:e,visualChannels:t}){let{visConfig:r}=e,{rasterStyleType:n}=r,i={rasterStyleType:n};return n==="ColorRange"?(i.colorRange=r.colorRange?.colors,i.colorMap=r.colorRange?.colorMap,i.colorScale=t.colorScale,i.colorFieldId=t.colorField?.name):n==="UniqueValues"?(i.colorMap=r.uniqueValuesColorRange?.colorMap,i.colorFieldId=t.colorField?.name):n==="Rgb"&&(i.colorBands=r.colorBands),{getFillColor:i}}function ca(e,t,r,n,i,o){e[t+0]=r,e[t+1]=n,e[t+2]=i,e[t+3]=o}function D8(e){let t=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),n=parseInt(e.slice(5,7),16);return[t,r,n]}function N8({mapConfig:e,layer:t,dataset:r}){let{filters:n,visState:i}=e,{layerBlending:o,interactionConfig:a}=i,{id:s,type:l,config:f,visualChannels:c}=t,{data:u,id:d}=r,{propMap:h,defaultProps:g}=g8(l,f,r),x=q8(f,h),{channelProps:S,scales:T}=G8(s,l,f,c,u,r);return{type:l,filters:Ep(n)||Up(r)?void 0:n[d],props:{id:s,data:u,...g,...U8(a),...x,...S,...z8(o,x.parameters||{}),...V8(u.accessToken)},scales:T}}function O0(e){let{keplerMapConfig:t,datasets:r,token:n}=e;Q(t.version==="v1","Only support Kepler v1");let i=t.config,{mapState:o,mapStyle:a,popupSettings:s,legendSettings:l,visState:f}=i,{layers:c}=f,u=[...c].reverse();return{id:e.id,title:e.title,description:e.description,createdAt:e.createdAt,updatedAt:e.updatedAt,initialViewState:o,mapStyle:a,popupSettings:s,legendSettings:l,token:n,layers:u.map(d=>{try{let{dataId:h}=d.config,g=r.find(S=>S.id===h);return Q(g,`No dataset matching dataId: ${h}`),N8({mapConfig:i,layer:d,dataset:g})}catch(h){console.error(h.message);return}})}}function z8(e,t){return e==="additive"?(t.blendColorSrcFactor=t.blendAlphaSrcFactor="src-alpha",t.blendColorDstFactor=t.blendAlphaDstFactor="dst-alpha",t.blendColorOperation=t.blendAlphaOperation="add"):e==="subtractive"&&(t.blendColorSrcFactor="one",t.blendColorDstFactor="one-minus-dst-color",t.blendAlphaSrcFactor="src-alpha",t.blendAlphaDstFactor="dst-alpha",t.blendColorOperation="subtract",t.blendAlphaOperation="add"),Object.keys(t).length?{parameters:t}:{}}function U8(e){let t=e&&e.tooltip.enabled;return{autoHighlight:t,pickable:t}}function Kp(e,t,r){for(let n in r){let i=e[n],o=r[n];if(i!==void 0)if(typeof o=="string")t[o]=i;else if(typeof o=="function"){let[a,s]=Object.entries(o(i))[0];t[a]=s}else typeof o=="object"&&Kp(i,t,o)}}function q8(e,t){let r={};Kp(e,r,t),r.stroked&&!r.getLineColor&&(r.getLineColor=r.getFillColor);for(let n in P0)if(Array.isArray(r[n])){let i=[...r[n]],o=P0[n],a=e.visConfig[o];i[3]=$p(a),r[n]=i}return r.highlightColor=e.visConfig.enable3d?[255,255,255,60]:[252,242,26,255],r}function G8(e,t,r,n,i,o){if(t==="raster"){let u=i.raster_metadata;if(!u)return{channelProps:{},scales:{}};if(r.visConfig.rasterStyleType==="Rgb")return{channelProps:I8({layerConfig:r,rasterMetadata:u,visualChannels:n}),scales:{fillColor:{type:"identity"}}};{let{dataTransform:h,updateTriggers:g,...x}=B8({layerConfig:r,visualChannels:n,rasterMetadata:u});return{channelProps:{dataTransform:h,updateTriggers:g},scales:{...x.type&&{fillColor:x}}}}}let{textLabel:a,visConfig:s}=r,l={},f={},c={};{let{colorField:u,colorScale:d}=n,{colorRange:h,colorAggregation:g}=s;if(u&&d&&h){let{accessor:x,...S}=M0(u,d,{aggregation:g,range:h},s.opacity,i);l.getFillColor=x,c.fillColor=f.getFillColor={field:u,type:d,...S}}else c.fillColor={}}if(t==="clusterTile"){let u=_8(t,o.providerId,i.schema);l.pointType=s.isTextVisible?"circle+text":"circle",l.clusterLevel=s.clusterLevel,l.getWeight=d=>d.properties[u],f.getWeight=u,l.getPointRadius=(d,h)=>R0(d.properties,h.data.attributes.stats,s.radiusRange,u),f.getPointRadius={aggregationExpAlias:u,radiusRange:s.radiusRange},l.textCharacterSet="auto",l.textFontFamily="Inter, sans",l.textFontSettings={sdf:!0},l.textFontWeight=600,l.getText=d=>p8.format(d.properties[u]),f.getText=u,l.getTextColor=r.textLabel[k0].color,l.textOutlineColor=[...r.textLabel[k0].outlineColor,h8],l.textOutlineWidth=5,l.textSizeUnits="pixels",l.getTextSize=(d,h)=>{let g=R0(d.properties,h.data.attributes.stats,s.radiusRange,u);return T8(g)},f.getTextSize={aggregationExpAlias:u,radiusRange:s.radiusRange}}{let u=s.radiusRange,{radiusField:d,radiusScale:h}=n;if(d&&u&&h){let{accessor:g,...x}=pi(d,h,s.radiusAggregation,u,i);l.getPointRadius=g,c.pointRadius=f.getPointRadius={field:d,type:h,...x}}}{let u=s.strokeColorRange,{strokeColorScale:d,strokeColorField:h}=n;if(h&&u&&d){let{strokeColorAggregation:g}=s,x=s.strokeOpacity!==void 0?s.strokeOpacity:1,{accessor:S,...T}=M0(h,d,{aggregation:g,range:u},x,i);l.getLineColor=S,c.lineColor=f.getLineColor={field:h,type:d,...T}}}{let{sizeField:u,sizeScale:d}=n,{sizeRange:h,sizeAggregation:g}=s;if(u&&h){let{accessor:x,...S}=pi(u,d,g,h,i);l.getLineWidth=x,c.lineWidth=f.getLineWidth={field:u,type:d||"identity",...S}}}{let{enable3d:u,heightRange:d}=s,{heightField:h,heightScale:g}=n;if(h&&d&&u){let{accessor:x,...S}=pi(h,g,s.heightAggregation,d,i);l.getElevation=x,c.elevation=f.getElevation={field:h,type:g||"identity",...S}}}{let{weightField:u}=n,{weightAggregation:d}=s;if(u&&d){let{accessor:h,...g}=pi(u,void 0,d,void 0,i);l.getWeight=h,c.weight=f.getWeight={field:u,type:"identity",...g}}}if(s.customMarkers){let u=v8(s,n),{getPointRadius:d,getFillColor:h}=l,{customMarkersUrl:g,customMarkersRange:x,filled:S}=s;if(l.pointType="icon",l.getIcon=x8(n.customMarkersField,x,{fallbackUrl:g,maxIconSize:u,useMaskedIcons:S},i),f.getIcon={customMarkersUrl:g,customMarkersRange:x,maxIconSize:u,useMaskedIcons:S},l._subLayerProps={"points-icon":{loadOptions:{image:{type:"imagebitmap"},imagebitmap:{resizeWidth:u,resizeHeight:u,resizeQuality:"high"}}}},h&&S&&(l.getIconColor=h,f.getIconColor=f.getFillColor),d&&(l.getIconSize=d,f.getIconSize=f.getPointRadius),n.rotationField){let{accessor:T}=pi(n.rotationField,void 0,null,void 0,i);l.getIconAngle=w8(T),f.getIconAngle=f.getRotationField}}else t==="tileset"&&(l.pointType="circle");if(a&&a.length&&a[0].field){let[u,d]=a,h=e;({alignment:l.getTextAlignmentBaseline,anchor:l.getTextAnchor,color:l.getTextColor,outlineColor:l.textOutlineColor,size:l.textSizeScale}=u);let{color:g,field:x,outlineColor:S,size:T}=d||{};l.getText=u.field&&I0(u.field,i);let w=x&&I0(x,i);l.pointType=`${l.pointType}+text`,l.textCharacterSet="auto",l.textFontFamily="Inter, sans",l.textFontSettings={sdf:!0},l.textFontWeight=600,l.textOutlineWidth=3,l._subLayerProps={...l._subLayerProps,"points-text":{collisionEnabled:!0,collisionGroup:h,...l.getPointRadius?{getRadius:l.getPointRadius}:{radiusScale:s.radius},...x&&{getSecondaryText:w,getSecondaryColor:g,secondarySizeScale:T,secondaryOutlineColor:S}}}}return{channelProps:{...l,updateTriggers:f},scales:c}}function V8(e){return{loadOptions:{fetch:{headers:{Authorization:`Bearer ${e}`}}}}}var $8="custom:",B0="positron";function Pf(e){let{longitude:t,latitude:r,...n}=e.mapState;return{center:[t,r],...n}}async function H8({config:e,errorContext:t,applyLayerFilters:r=!0}){let{mapStyle:n}=e,i=n.styleType||B0;if(i.startsWith($8)){let a=e.customBaseMaps?.customStyle;if(a)return{type:"maplibre",props:{style:a.style||a.url,...Pf(e)},attribution:a.customAttribution}}if(Ew.includes(i)){let{visibleLayerGroups:a}=n,s=$t(i),l=s,f=s;return r&&a&&Aw(a)&&(f=await Pw({styleUrl:s,errorContext:t}),l=Cw(f,a)),{type:"maplibre",props:{style:l,...Pf(e)},visibleLayerGroups:a,rawStyle:f}}let o=Sw[i];if(o){let{mapState:a}=e;return{type:"google-maps",props:{...o,center:{lat:a.latitude,lng:a.longitude},zoom:a.zoom+1,tilt:a.pitch,heading:a.bearing}}}return{type:"maplibre",props:{style:$t(B0),...Pf(e)}}}function j8({dataset:e,filters:t,options:r}){let{geoColumn:n,columns:i,type:o,source:a,queryParameters:s,aggregationExp:l,aggregationResLevel:f}=e,c=Z8(r),u=K8(n)||void 0,d=n?X8(n):void 0,h=W8(d),g=d==="h3",x=d==="quadbin",S=f;typeof f!="number"&&g?S=Yf:typeof f!="number"&&x&&(S=Kf);let T={aggregationExp:l||T2,aggregationResLevel:Y8(S,h),spatialDataColumn:u,...t&&{filters:t}},w={...c,tableName:a},k={...c,tableName:a,tileResolution:h},L={...c,sqlQuery:a,tileResolution:h,...s&&{queryParameters:s}},M={spatialDataColumn:u,...i&&{columns:i},...t&&{filters:t},...l&&{aggregationExp:l}};if(o==="raster")return wa({...c,tableName:a,...t&&{filters:t}});if(o==="tileset")return Sa({...w});if(o==="table")return g?ba({...k,...T}):x?va({...k,...T}):Ea({...k,...M});if(o==="query")return g?ma({...L,...T}):x?xa({...L,...T}):_a({...L,...M});throw new Error(`Invalid source type: ${o}`)}function Z8({accessToken:e,apiBaseUrl:t,connection:r,headers:n,maxLengthURL:i,tags:o}){return{accessToken:e,connectionName:r,apiBaseUrl:t,headers:n,maxLengthURL:i,...n?.["Cache-Control"]?.includes("no-cache")&&{localCache:{cacheControl:["no-cache"]}},tags:o}}function W8(e){return e!=="h3"?S2:rn}function Y8(e,t){if(typeof e=="number")return e-Math.log2(.5/t)}function K8(e){if(!e)return e;let t=e.split(":");return t.length===1?t[0]:t.length===2?t[1]:null}function X8(e){let t=e.split(":")[0];for(let r of Object.values(q0))if(vx[r].includes(t))return r;return null}async function Q8(e,t,r){let{connectionName:n}=e,i={},o=j8({dataset:e,filters:!Ep(t)&&Up(e)?t:void 0,options:{...r,connection:n,headers:r.headers,accessToken:r.accessToken,apiBaseUrl:r.apiBaseUrl,maxLengthURL:r.maxLengthURL,...r.mapId&&{tags:{[U0.mapId]:r.mapId}}}});e.data=await o;let a=!0;return i.value&&(a=e.cache!==i.value,e.cache=i.value),a}async function J8(e,t,r){let{connectionName:n,data:i,id:o,source:a,type:s,queryParameters:l}=t,{apiBaseUrl:f}=r,c={requestType:"Tile stats",connection:n,type:s,source:a};if(!("tilestats"in i))throw new Er(new Error(`Invalid dataset for tilestats: ${o}`),c);let u=D2({attribute:e,apiBaseUrl:f,...t}),d=new URLSearchParams(i.tiles[0]).get("client"),h={Authorization:`Bearer ${r.accessToken}`},g={};d&&(g.client=d),r.mapId&&(g[U0.mapId]=r.mapId),s==="query"&&(g.q=a,l&&(g.queryParameters=l));let x=await tn({baseUrl:u,headers:h,parameters:g,errorContext:c,maxLengthURL:r.maxLengthURL}),{attributes:S}=i.tilestats.layers[0],T=S.findIndex(w=>w.attribute===e);return S[T]=x,!0}async function D0({datasets:e,keplerMapConfig:t},r){let{filters:n}=t.config,i=e.map(o=>Q8(o,n[o.id],r));return await Promise.all(i)}async function e6({datasets:e,keplerMapConfig:t},r){let n=[],{layers:i}=t.config.visState;for(let s of i)for(let l of Object.keys(s.visualChannels)){let f=s.visualChannels[l]?.name;if(f){let c=e.find(u=>u.id===s.config.dataId);c&&c.type!=="tileset"&&c.data.tilestats&&n.push({attribute:f,dataset:c})}}let o=[];for(let s of n)o.find(({attribute:l,dataset:f})=>l===s.attribute&&f===s.dataset)||o.push(s);let a=o.map(({attribute:s,dataset:l})=>J8(s,l,r));return await Promise.all(a)}async function Xp({accessToken:e,apiBaseUrl:t=$f,cartoMapId:r,clientId:n,headers:i,autoRefresh:o,onNewData:a,maxLengthURL:s}){Q(r,'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})'),e&&(i={Authorization:`Bearer ${e}`,...i}),(o||a)&&(Q(a,"Must define `onNewData` when using autoRefresh"),Q(typeof a=="function","`onNewData` must be a function"),Q(typeof o=="number"&&o>0,"`autoRefresh` must be a positive number"));let l=B2({apiBaseUrl:t,cartoMapId:r}),f={requestType:"Public map",mapId:r},c=await tn({baseUrl:l,headers:i,errorContext:f,maxLengthURL:s}),u={mapId:r,accessToken:c.token||e,apiBaseUrl:t,clientId:n,headers:i,maxLengthURL:s},d;if(o){let w=setInterval(async()=>{let k=await D0(c,{...u,headers:{...i,"If-Modified-Since":new Date().toUTCString()}});a&&k.some(L=>L===!0)&&a(O0(c))},o*1e3);d=()=>{clearInterval(w)}}let h=c.keplerMapConfig.config.visState.layers.filter(({type:w})=>w==="geojson"||w==="point"),g=h.map(({config:w})=>w.dataId);c.datasets.forEach(w=>{if(g.includes(w.id)){let{config:k}=h.find(({config:L})=>L.dataId===w.id);w.format="geojson",!w.geoColumn&&k.columns.geojson&&(w.geoColumn=k.columns.geojson)}});let[x]=await Promise.all([H8({config:c.keplerMapConfig.config,errorContext:f}),D0(c,u)]);await e6(c,u);let S={...O0(c),basemap:x,stopAutoRefresh:d};return S.layers.filter(w=>(w.props?.pointType||"").includes("text")).length&&typeof window<"u"&&typeof document<"u"&&window.FontFace&&document.fonts&&!document.fonts.check("12px Inter")&&await new FontFace("Inter","url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2)").load().then(k=>document.fonts.add(k)),S}var CC=2**32-1;var r6="https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json",Qp=["positron","dark-matter","voyager"],Pa={roadmap:{mapTypeId:"roadmap",mapId:"3754c817b510f791"},"google-positron":{mapTypeId:"roadmap",mapId:"ea84ae4203ef21cd"},"google-dark-matter":{mapTypeId:"roadmap",mapId:"2fccc3b36c22a0e2"},"google-voyager":{mapTypeId:"roadmap",mapId:"885caf1e15bb9ef2"},satellite:{mapTypeId:"satellite"},hybrid:{mapTypeId:"hybrid"},terrain:{mapTypeId:"terrain"}},fl=[{slug:"label",filter:({id:e})=>!!e.match(/(?=(label|_label|place-|place_|poi-|poi_|watername_|roadname_|housenumber))/),defaultVisibility:!0},{slug:"road",filter:({id:e})=>!!e.match(/(?=(road|railway|tunnel|street|bridge))(?!.*label)/),defaultVisibility:!0},{slug:"border",filter:({id:e})=>!!e.match(/border|boundaries|boundary_/),defaultVisibility:!1},{slug:"building",filter:({id:e})=>!!e.match(/building/),defaultVisibility:!0},{slug:"water",filter:({id:e})=>!!e.match(/(?=(water|stream|ferry))/),defaultVisibility:!0},{slug:"land",filter:({id:e})=>!!e.match(/(?=(parks|landcover|industrial|sand|hillshade|park_))/),defaultVisibility:!0}];function Fa(e,t){if(!Array.isArray(e?.layers))return e;let r=fl.filter(i=>!t[i.slug]).map(i=>i.filter),n=e.layers.filter(i=>r.every(o=>!o(i)));return{...e,layers:n}}function Jp(e){return e&&Object.values(e).every(Boolean)===!1}function Ye(e){return r6.replace("{basemap}",e)}async function ka({styleUrl:e,errorContext:t}){let r;return await fetch(e,{mode:"cors"}).then(n=>(r=n,n.json())).catch(n=>{throw new Er(n,{...t,requestType:"Basemap style"},r)})}var eg={VOYAGER:Ye("voyager"),POSITRON:Ye("positron"),DARK_MATTER:Ye("dark-matter"),VOYAGER_NOLABELS:Ye("voyager-nolabels"),POSITRON_NOLABELS:Ye("positron-nolabels"),DARK_MATTER_NOLABELS:Ye("dark-matter-nolabels")};var ll={};Ra(ll,{Antique:()=>L6,ArmyRose:()=>T6,BluGrn:()=>u6,BluYl:()=>g6,Bold:()=>I6,BrwnYl:()=>S6,Burg:()=>i6,BurgYl:()=>o6,DarkMint:()=>d6,Earth:()=>M6,Emrld:()=>h6,Fall:()=>C6,Geyser:()=>A6,Magenta:()=>w6,Mint:()=>c6,OrYel:()=>s6,Pastel:()=>R6,Peach:()=>f6,PinkYl:()=>l6,Prism:()=>O6,Purp:()=>y6,PurpOr:()=>x6,RedOr:()=>a6,Safe:()=>B6,Sunset:()=>v6,SunsetDark:()=>_6,Teal:()=>m6,TealGrn:()=>b6,TealRose:()=>F6,Temps:()=>P6,Tropic:()=>k6,Vivid:()=>D6,ag_GrnYl:()=>p6,ag_Sunset:()=>E6,cb_Accent:()=>K6,cb_Blues:()=>i_,cb_BrBG:()=>c_,cb_BuGn:()=>N6,cb_BuPu:()=>z6,cb_Dark2:()=>X6,cb_GnBu:()=>U6,cb_Greens:()=>o_,cb_Greys:()=>a_,cb_OrRd:()=>q6,cb_Oranges:()=>s_,cb_PRGn:()=>d_,cb_Paired:()=>Q6,cb_Pastel1:()=>J6,cb_Pastel2:()=>e_,cb_PiYG:()=>u_,cb_PuBu:()=>G6,cb_PuBuGn:()=>V6,cb_PuOr:()=>h_,cb_PuRd:()=>$6,cb_Purples:()=>f_,cb_RdBu:()=>p_,cb_RdGy:()=>g_,cb_RdPu:()=>H6,cb_RdYlBu:()=>m_,cb_RdYlGn:()=>b_,cb_Reds:()=>l_,cb_Set1:()=>t_,cb_Set2:()=>r_,cb_Set3:()=>n_,cb_Spectral:()=>y_,cb_YlGn:()=>j6,cb_YlGnBu:()=>Z6,cb_YlOrBr:()=>W6,cb_YlOrRd:()=>Y6});var n6={schemeGroups:{sequential:["BuGn","BuPu","GnBu","OrRd","PuBu","PuBuGn","PuRd","RdPu","YlGn","YlGnBu","YlOrBr","YlOrRd"],singlehue:["Blues","Greens","Greys","Oranges","Purples","Reds"],diverging:["BrBG","PiYG","PRGn","PuOr","RdBu","RdGy","RdYlBu","RdYlGn","Spectral"],qualitative:["Accent","Dark2","Paired","Pastel1","Pastel2","Set1","Set2","Set3"]},YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},G=n6;var i6={2:["#ffc6c4","#672044"],3:["#ffc6c4","#cc607d","#672044"],4:["#ffc6c4","#e38191","#ad466c","#672044"],5:["#ffc6c4","#ee919b","#cc607d","#9e3963","#672044"],6:["#ffc6c4","#f29ca3","#da7489","#b95073","#93345d","#672044"],7:["#ffc6c4","#f4a3a8","#e38191","#cc607d","#ad466c","#8b3058","#672044"],tags:["quantitative"]},o6={2:["#fbe6c5","#70284a"],3:["#fbe6c5","#dc7176","#70284a"],4:["#fbe6c5","#ee8a82","#c8586c","#70284a"],5:["#fbe6c5","#f2a28a","#dc7176","#b24b65","#70284a"],6:["#fbe6c5","#f4b191","#e7807d","#d06270","#a44360","#70284a"],7:["#fbe6c5","#f5ba98","#ee8a82","#dc7176","#c8586c","#9c3f5d","#70284a"],tags:["quantitative"]},a6={2:["#f6d2a9","#b13f64"],3:["#f6d2a9","#ea8171","#b13f64"],4:["#f6d2a9","#f19c7c","#dd686c","#b13f64"],5:["#f6d2a9","#f3aa84","#ea8171","#d55d6a","#b13f64"],6:["#f6d2a9","#f4b28a","#ef9177","#e3726d","#cf5669","#b13f64"],7:["#f6d2a9","#f5b78e","#f19c7c","#ea8171","#dd686c","#ca5268","#b13f64"],tags:["quantitative"]},s6={2:["#ecda9a","#ee4d5a"],3:["#ecda9a","#f7945d","#ee4d5a"],4:["#ecda9a","#f3ad6a","#f97b57","#ee4d5a"],5:["#ecda9a","#f1b973","#f7945d","#f86f56","#ee4d5a"],6:["#ecda9a","#f0c079","#f5a363","#f98558","#f76856","#ee4d5a"],7:["#ecda9a","#efc47e","#f3ad6a","#f7945d","#f97b57","#f66356","#ee4d5a"],tags:["quantitative"]},f6={2:["#fde0c5","#eb4a40"],3:["#fde0c5","#f59e72","#eb4a40"],4:["#fde0c5","#f8b58b","#f2855d","#eb4a40"],5:["#fde0c5","#f9c098","#f59e72","#f17854","#eb4a40"],6:["#fde0c5","#fac7a1","#f7ac80","#f38f65","#f0704f","#eb4a40"],7:["#fde0c5","#facba6","#f8b58b","#f59e72","#f2855d","#ef6a4c","#eb4a40"],tags:["quantitative"]},l6={2:["#fef6b5","#e15383"],3:["#fef6b5","#ffa679","#e15383"],4:["#fef6b5","#ffc285","#fa8a76","#e15383"],5:["#fef6b5","#ffd08e","#ffa679","#f67b77","#e15383"],6:["#fef6b5","#ffd795","#ffb77f","#fd9576","#f37378","#e15383"],7:["#fef6b5","#ffdd9a","#ffc285","#ffa679","#fa8a76","#f16d7a","#e15383"],tags:["quantitative"]},c6={2:["#e4f1e1","#0d585f"],3:["#e4f1e1","#63a6a0","#0d585f"],4:["#e4f1e1","#89c0b6","#448c8a","#0d585f"],5:["#E4F1E1","#9CCDC1","#63A6A0","#337F7F","#0D585F"],6:["#e4f1e1","#abd4c7","#7ab5ad","#509693","#2c7778","#0d585f"],7:["#e4f1e1","#b4d9cc","#89c0b6","#63a6a0","#448c8a","#287274","#0d585f"],tags:["quantitative"]},u6={2:["#c4e6c3","#1d4f60"],3:["#c4e6c3","#4da284","#1d4f60"],4:["#c4e6c3","#6dbc90","#36877a","#1d4f60"],5:["#c4e6c3","#80c799","#4da284","#2d7974","#1d4f60"],6:["#c4e6c3","#8dce9f","#5fb28b","#3e927e","#297071","#1d4f60"],7:["#c4e6c3","#96d2a4","#6dbc90","#4da284","#36877a","#266b6e","#1d4f60"],tags:["quantitative"]},d6={2:["#d2fbd4","#123f5a"],3:["#d2fbd4","#559c9e","#123f5a"],4:["#d2fbd4","#7bbcb0","#3a7c89","#123f5a"],5:["#d2fbd4","#8eccb9","#559c9e","#2b6c7f","#123f5a"],6:["#d2fbd4","#9cd5be","#6cafa9","#458892","#266377","#123f5a"],7:["#d2fbd4","#a5dbc2","#7bbcb0","#559c9e","#3a7c89","#235d72","#123f5a"],tags:["quantitative"]},h6={2:["#d3f2a3","#074050"],3:["#d3f2a3","#4c9b82","#074050"],4:["#d3f2a3","#6cc08b","#217a79","#074050"],5:["#d3f2a3","#82d091","#4c9b82","#19696f","#074050"],6:["#d3f2a3","#8fda94","#60b187","#35877d","#145f69","#074050"],7:["#d3f2a3","#97e196","#6cc08b","#4c9b82","#217a79","#105965","#074050"],tags:["quantitative"]},p6={2:["#245668","#EDEF5D"],3:["#245668","#39AB7E","#EDEF5D"],4:["#245668","#0D8F81","#6EC574","#EDEF5D"],5:["#245668","#04817E","#39AB7E","#8BD16D","#EDEF5D"],6:["#245668","#09787C","#1D9A81","#58BB79","#9DD869","#EDEF5D"],7:["#245668","#0F7279","#0D8F81","#39AB7E","#6EC574","#A9DC67","#EDEF5D"],tags:["aggregation"]},g6={2:["#f7feae","#045275"],3:["#f7feae","#46aea0","#045275"],4:["#f7feae","#7ccba2","#089099","#045275"],5:["#f7feae","#9bd8a4","#46aea0","#058092","#045275"],6:["#f7feae","#ace1a4","#68bfa1","#2a9c9c","#02778e","#045275"],7:["#f7feae","#b7e6a5","#7ccba2","#46aea0","#089099","#00718b","#045275"],tags:["quantitative"]},m6={2:["#d1eeea","#2a5674"],3:["#d1eeea","#68abb8","#2a5674"],4:["#d1eeea","#85c4c9","#4f90a6","#2a5674"],5:["#d1eeea","#96d0d1","#68abb8","#45829b","#2a5674"],6:["#d1eeea","#a1d7d6","#79bbc3","#599bae","#3f7994","#2a5674"],7:["#d1eeea","#a8dbd9","#85c4c9","#68abb8","#4f90a6","#3b738f","#2a5674"],tags:["quantitative"]},b6={2:["#b0f2bc","#257d98"],3:["#b0f2bc","#4cc8a3","#257d98"],4:["#b0f2bc","#67dba5","#38b2a3","#257d98"],5:["#b0f2bc","#77e2a8","#4cc8a3","#31a6a2","#257d98"],6:["#b0f2bc","#82e6aa","#5bd4a4","#3fbba3","#2e9ea1","#257d98"],7:["#b0f2bc","#89e8ac","#67dba5","#4cc8a3","#38b2a3","#2c98a0","#257d98"],tags:["quantitative"]},y6={2:["#f3e0f7","#63589f"],3:["#f3e0f7","#b998dd","#63589f"],4:["#f3e0f7","#d1afe8","#9f82ce","#63589f"],5:["#f3e0f7","#dbbaed","#b998dd","#9178c4","#63589f"],6:["#f3e0f7","#e0c2ef","#c8a5e4","#aa8bd4","#8871be","#63589f"],7:["#f3e0f7","#e4c7f1","#d1afe8","#b998dd","#9f82ce","#826dba","#63589f"],tags:["quantitative"]},x6={2:["#f9ddda","#573b88"],3:["#f9ddda","#ce78b3","#573b88"],4:["#f9ddda","#e597b9","#ad5fad","#573b88"],5:["#f9ddda","#eda8bd","#ce78b3","#9955a8","#573b88"],6:["#f9ddda","#f0b2c1","#dd8ab6","#bb69b0","#8c4fa4","#573b88"],7:["#f9ddda","#f2b9c4","#e597b9","#ce78b3","#ad5fad","#834ba0","#573b88"],tags:["quantitative"]},v6={2:["#f3e79b","#5c53a5"],3:["#f3e79b","#eb7f86","#5c53a5"],4:["#f3e79b","#f8a07e","#ce6693","#5c53a5"],5:["#f3e79b","#fab27f","#eb7f86","#b95e9a","#5c53a5"],6:["#f3e79b","#fabc82","#f59280","#dc6f8e","#ab5b9e","#5c53a5"],7:["#f3e79b","#fac484","#f8a07e","#eb7f86","#ce6693","#a059a0","#5c53a5"],tags:["quantitative"]},w6={2:["#f3cbd3","#6c2167"],3:["#f3cbd3","#ca699d","#6c2167"],4:["#f3cbd3","#dd88ac","#b14d8e","#6c2167"],5:["#f3cbd3","#e498b4","#ca699d","#a24186","#6c2167"],6:["#f3cbd3","#e7a2b9","#d67ba5","#bc5894","#983a81","#6c2167"],7:["#f3cbd3","#eaa9bd","#dd88ac","#ca699d","#b14d8e","#91357d","#6c2167"],tags:["quantitative"]},_6={2:["#fcde9c","#7c1d6f"],3:["#fcde9c","#e34f6f","#7c1d6f"],4:["#fcde9c","#f0746e","#dc3977","#7c1d6f"],5:["#fcde9c","#f58670","#e34f6f","#d72d7c","#7c1d6f"],6:["#fcde9c","#f89872","#ec666d","#df4273","#c5287b","#7c1d6f"],7:["#fcde9c","#faa476","#f0746e","#e34f6f","#dc3977","#b9257a","#7c1d6f"],tags:["quantitative"]},E6={2:["#4b2991","#edd9a3"],3:["#4b2991","#ea4f88","#edd9a3"],4:["#4b2991","#c0369d","#fa7876","#edd9a3"],5:["#4b2991","#a52fa2","#ea4f88","#fa9074","#edd9a3"],6:["#4b2991","#932da3","#d43f96","#f7667c","#f89f77","#edd9a3"],7:["#4b2991","#872ca2","#c0369d","#ea4f88","#fa7876","#f6a97a","#edd9a3"],tags:["aggregation"]},S6={2:["#ede5cf","#541f3f"],3:["#ede5cf","#c1766f","#541f3f"],4:["#ede5cf","#d39c83","#a65461","#541f3f"],5:["#ede5cf","#daaf91","#c1766f","#95455a","#541f3f"],6:["#ede5cf","#ddba9b","#cd8c7a","#b26166","#8a3c56","#541f3f"],7:["#ede5cf","#e0c2a2","#d39c83","#c1766f","#a65461","#813753","#541f3f"],tags:["quantitative"]},T6={2:["#929b4f","#db8195"],3:["#a3ad62","#fdfbe4","#df91a3"],4:["#929b4f","#d9dbaf","#f3d1ca","#db8195"],5:["#879043","#c1c68c","#fdfbe4","#ebb4b8","#d8758b"],6:["#7f883b","#b0b874","#e3e4be","#f6ddd1","#e4a0ac","#d66d85"],7:["#798234","#a3ad62","#d0d3a2","#fdfbe4","#f0c6c3","#df91a3","#d46780"],tags:["diverging"]},C6={2:["#3d5941","#ca562c"],3:["#3d5941","#f6edbd","#ca562c"],4:["#3d5941","#b5b991","#edbb8a","#ca562c"],5:["#3d5941","#96a07c","#f6edbd","#e6a272","#ca562c"],6:["#3d5941","#839170","#cecea2","#f1cf9e","#e19464","#ca562c"],7:["#3d5941","#778868","#b5b991","#f6edbd","#edbb8a","#de8a5a","#ca562c"],tags:["diverging"]},A6={2:["#008080","#ca562c"],3:["#008080","#f6edbd","#ca562c"],4:["#008080","#b4c8a8","#edbb8a","#ca562c"],5:["#008080","#92b69e","#f6edbd","#e6a272","#ca562c"],6:["#008080","#7eab98","#ced7b1","#f1cf9e","#e19464","#ca562c"],7:["#008080","#70a494","#b4c8a8","#f6edbd","#edbb8a","#de8a5a","#ca562c"],tags:["diverging"]},P6={2:["#009392","#cf597e"],3:["#009392","#e9e29c","#cf597e"],4:["#009392","#9ccb86","#eeb479","#cf597e"],5:["#009392","#71be83","#e9e29c","#ed9c72","#cf597e"],6:["#009392","#52b684","#bcd48c","#edc783","#eb8d71","#cf597e"],7:["#009392","#39b185","#9ccb86","#e9e29c","#eeb479","#e88471","#cf597e"],tags:["diverging"]},F6={2:["#009392","#d0587e"],3:["#009392","#f1eac8","#d0587e"],4:["#009392","#91b8aa","#f1eac8","#dfa0a0","#d0587e"],5:["#009392","#91b8aa","#f1eac8","#dfa0a0","#d0587e"],6:["#009392","#72aaa1","#b1c7b3","#e5b9ad","#d98994","#d0587e"],7:["#009392","#72aaa1","#b1c7b3","#f1eac8","#e5b9ad","#d98994","#d0587e"],tags:["diverging"]},k6={2:["#009B9E","#C75DAB"],3:["#009B9E","#F1F1F1","#C75DAB"],4:["#009B9E","#A7D3D4","#E4C1D9","#C75DAB"],5:["#009B9E","#7CC5C6","#F1F1F1","#DDA9CD","#C75DAB"],6:["#009B9E","#5DBCBE","#C6DFDF","#E9D4E2","#D99BC6","#C75DAB"],7:["#009B9E","#42B7B9","#A7D3D4","#F1F1F1","#E4C1D9","#D691C1","#C75DAB"],tags:["diverging"]},M6={2:["#A16928","#2887a1"],3:["#A16928","#edeac2","#2887a1"],4:["#A16928","#d6bd8d","#b5c8b8","#2887a1"],5:["#A16928","#caa873","#edeac2","#98b7b2","#2887a1"],6:["#A16928","#c29b64","#e0cfa2","#cbd5bc","#85adaf","#2887a1"],7:["#A16928","#bd925a","#d6bd8d","#edeac2","#b5c8b8","#79a7ac","#2887a1"],tags:["diverging"]},L6={2:["#855C75","#D9AF6B","#7C7C7C"],3:["#855C75","#D9AF6B","#AF6458","#7C7C7C"],4:["#855C75","#D9AF6B","#AF6458","#736F4C","#7C7C7C"],5:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#7C7C7C"],6:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#7C7C7C"],7:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#7C7C7C"],8:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#7C7C7C"],9:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#7C7C7C"],10:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#7C7C7C"],11:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#467378","#7C7C7C"],tags:["qualitative"]},I6={2:["#7F3C8D","#11A579","#A5AA99"],3:["#7F3C8D","#11A579","#3969AC","#A5AA99"],4:["#7F3C8D","#11A579","#3969AC","#F2B701","#A5AA99"],5:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#A5AA99"],6:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#A5AA99"],7:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#A5AA99"],8:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#A5AA99"],9:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#A5AA99"],10:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#f97b72","#A5AA99"],11:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#f97b72","#4b4b8f","#A5AA99"],tags:["qualitative"]},R6={2:["#66C5CC","#F6CF71","#B3B3B3"],3:["#66C5CC","#F6CF71","#F89C74","#B3B3B3"],4:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#B3B3B3"],5:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#B3B3B3"],6:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#B3B3B3"],7:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#B3B3B3"],8:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#B3B3B3"],9:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B3B3B3"],10:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#B3B3B3"],11:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#D3B484","#B3B3B3"],tags:["qualitative"]},O6={2:["#5F4690","#1D6996","#666666"],3:["#5F4690","#1D6996","#38A6A5","#666666"],4:["#5F4690","#1D6996","#38A6A5","#0F8554","#666666"],5:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#666666"],6:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#666666"],7:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#666666"],8:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#666666"],9:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#666666"],10:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#666666"],11:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#994E95","#666666"],tags:["qualitative"]},B6={2:["#88CCEE","#CC6677","#888888"],3:["#88CCEE","#CC6677","#DDCC77","#888888"],4:["#88CCEE","#CC6677","#DDCC77","#117733","#888888"],5:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#888888"],6:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#888888"],7:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#888888"],8:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#888888"],9:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#888888"],10:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#661100","#888888"],11:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#661100","#6699CC","#888888"],tags:["qualitative","colorblind"]},D6={2:["#E58606","#5D69B1","#A5AA99"],3:["#E58606","#5D69B1","#52BCA3","#A5AA99"],4:["#E58606","#5D69B1","#52BCA3","#99C945","#A5AA99"],5:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#A5AA99"],6:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#A5AA99"],7:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#A5AA99"],8:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#A5AA99"],9:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#A5AA99"],10:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#ED645A","#A5AA99"],11:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#ED645A","#CC3A8E","#A5AA99"],tags:["qualitative"]},N6={...G.BuGn,tags:["quantitative"]},z6={...G.BuPu,tags:["quantitative"]},U6={...G.GnBu,tags:["quantitative"]},q6={...G.OrRd,tags:["quantitative"]},G6={...G.PuBu,tags:["quantitative"]},V6={...G.PuBuGn,tags:["quantitative"]},$6={...G.PuRd,tags:["quantitative"]},H6={...G.RdPu,tags:["quantitative"]},j6={...G.YlGn,tags:["quantitative"]},Z6={...G.YlGnBu,tags:["quantitative"]},W6={...G.YlOrBr,tags:["quantitative"]},Y6={...G.YlOrRd,tags:["quantitative"]},K6={...G.Accent,tags:["qualitative"]},X6={...G.Dark2,tags:["qualitative"]},Q6={...G.Paired,tags:["qualitative"]},J6={...G.Pastel1,tags:["qualitative"]},e_={...G.Pastel2,tags:["qualitative"]},t_={...G.Set1,tags:["qualitative"]},r_={...G.Set2,tags:["qualitative"]},n_={...G.Set3,tags:["qualitative"]},i_={...G.Blues,tags:["quantitative"]},o_={...G.Greens,tags:["quantitative"]},a_={...G.Greys,tags:["quantitative"]},s_={...G.Oranges,tags:["quantitative"]},f_={...G.Purples,tags:["quantitative"]},l_={...G.Reds,tags:["quantitative"]},c_={...G.BrBG,tags:["diverging"]},u_={...G.PiYG,tags:["diverging"]},d_={...G.PRGn,tags:["diverging"]},h_={...G.PuOr,tags:["diverging"]},p_={...G.RdBu,tags:["diverging"]},g_={...G.RdGy,tags:["diverging"]},m_={...G.RdYlBu,tags:["diverging"]},b_={...G.RdYlGn,tags:["diverging"]},y_={...G.Spectral,tags:["diverging"]};var on="PurpOr",an=[204,204,204],tg=[119,119,119];function Sr(e,t){let r=ll[e],n=t;Fe(r,`Palette "${e}" not found. Expected a CARTOColors string`);let i=Object.keys(r).filter(l=>l!=="tags").map(Number),o=Math.max(...i),a=Math.min(...i);!Number.isInteger(t)||t>o?n=o:t<a&&(n=a);let s=r[n];return r.tags&&r.tags.includes("qualitative")&&(s=s.slice(0,-1)),s.map(l=>x_(l))}function x_(e){let t=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(e);return t?[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(t=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(e),t?[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),parseInt(t[4]+t[4],16)]:(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),255]:(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),Fe(t,`Hexadecimal color "${e}" was not parsed correctly`),[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),parseInt(t[4],16)])))}var v_=Object.freeze(["function","string"]);function sn(e,t,r){return Fe(typeof t=="object",'Expected "data" to be an object'),Fe(v_.includes(typeof e),'Expected "attr" to be a function or string'),typeof e=="function"?e(t,r):t?.properties?.[e]}function cl({attr:e,domain:t,colors:r=on,nullColor:n=an}){Fe(Array.isArray(t),'Expected "domain" to be an array of numbers');let i=typeof r=="string"?Sr(r,t.length+1):r,o=mr().domain(t).range(i);return(a,s)=>{let l=sn(e,a,s);return typeof l=="number"&&Number.isFinite(l)?o(l):n}}function ul({attr:e,domain:t,colors:r=on,nullColor:n=an,othersColor:i=tg}){Fe(Array.isArray(t),'Expected "domain" to be an array of numbers or strings');let o={},a=typeof r=="string"?Sr(r,t.length):r;for(let[s,l]of t.entries())o[l]=a[s];return(s,l)=>{let f=sn(e,s,l);return typeof f=="number"&&Number.isFinite(f)||typeof f=="string"?o[f]||i:n}}function dl({attr:e,domain:t,colors:r=on,nullColor:n=an}){Fe(Array.isArray(t),'Expected "domain" to be an array of numbers');let i=typeof r=="string"?Sr(r,t.length):r,o=gr().domain(t).range(i);return(a,s)=>{let l=sn(e,a,s);return typeof l=="number"&&Number.isFinite(l)?o(l):n}}var w_={clusterTile:Dn,h3:ar,heatmapTile:$n,mvt:Hr,quadbin:sr,raster:Kn,tileset:Hr};function hl(e){let t=w_[e.type];if(!t)throw new Error(`No layer class found for type: ${e.type}`);return new t(e.props)}function rg(e){return{...e,layers:e.layers.map(t=>hl(t))}}async function ng(e){let{onNewData:t,...r}=e,n={...r,onNewData:typeof t=="function"?a=>{t(rg(a))}:void 0},i=await Xp(n);return rg(i)}var __="custom:",ig="positron";function pl(e){let{longitude:t,latitude:r,...n}=e.mapState;return{center:[t,r],...n}}async function og({config:e,errorContext:t,applyLayerFilters:r=!0}){let{mapStyle:n}=e,i=n.styleType||ig;if(i.startsWith(__)){let a=e.customBaseMaps?.customStyle;if(a)return{type:"maplibre",props:{style:a.style||a.url,...pl(e)},attribution:a.customAttribution}}if(Qp.includes(i)){let{visibleLayerGroups:a}=n,s=Ye(i),l=s,f=s;return r&&a&&Jp(a)&&(f=await ka({styleUrl:s,errorContext:t}),l=Fa(f,a)),{type:"maplibre",props:{style:l,...pl(e)},visibleLayerGroups:a,rawStyle:f}}let o=Pa[i];if(o){let{mapState:a}=e;return{type:"google-maps",props:{...o,center:{lat:a.latitude,lng:a.longitude},zoom:a.zoom+1,tilt:a.pitch,heading:a.bearing}}}return{type:"maplibre",props:{style:Ye(ig),...pl(e)}}}var E_={ClusterTileLayer:Dn,H3TileLayer:ar,HeatmapTileLayer:$n,PointLabelLayer:Zn,QuadbinTileLayer:sr,RasterTileLayer:Kn,VectorTileLayer:Hr};var ze={},ag=q(kt(),1);Xe(ze,q(kt(),1));if(!ag.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Xe(Tr,ze);var S_=Ma;globalThis.CartoLibrary=Ma;return dg(Tr);})();
172
+ `,super(o),O(this,"error"),O(this,"errorContext"),O(this,"response"),O(this,"responseJson"),this.name="CartoAPIError",this.response=r,this.responseJson=n,this.error=e,this.errorContext=t}};function R2(e){return e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase())}function B2(...e){return e.map(t=>t.endsWith("/")?t.slice(0,-1):t).join("/")}function _i(e,t,r,...n){return B2(e,t,r,...n)}function O2({apiBaseUrl:e,cartoMapId:t}){return _i(e,"v3","maps","public",t)}function D2({attribute:e,apiBaseUrl:t,connectionName:r,source:n,type:i}){return i==="query"?_i(t,"v3","stats",r,e):_i(t,"v3","stats",r,n,e)}function N2({apiBaseUrl:e,connectionName:t,endpoint:r}){return _i(e,"v3","maps",t,r)}function z2({apiBaseUrl:e,connectionName:t}){return _i(e,"v3","sql",t,"query")}var U2={Accept:"application/json","Content-Type":"application/json"},q2=new Map;async function tn({baseUrl:e,parameters:t={},headers:r={},errorContext:n,maxLengthURL:i=vp,localCache:o,signal:a}){t={v:E2,client:Ci(),...typeof deck<"u"&&deck.VERSION&&{deckglVersion:deck.VERSION},...t},e=H2(e,Object.keys(t));let s=V2(e,t,r),{cache:f,canReadCache:l,canStoreInCache:c}=G2(o);if(l&&f.has(s))return f.get(s);let u=$2(e,t),d={...U2,...r},h=u.length>i?fetch(e,{method:"POST",body:JSON.stringify(t),headers:d,signal:a}):fetch(u,{headers:d,signal:a}),g,x,S=h.then(T=>(g=T,g.json())).then(T=>{if(x=T,!g||!g.ok)throw new Error(T.error);return T}).catch(T=>{throw c&&f.delete(s),new Er(T,n,g,x)});return c&&f.set(s,S),S}function G2(e){let t=!e?.cacheControl?.includes("no-cache"),r=!e?.cacheControl?.includes("no-store");return{cache:e?.cache||q2,canReadCache:t,canStoreInCache:r}}function V2(e,t,r){let n=Object.entries(t).sort(([o],[a])=>o>a?1:-1),i=Object.entries(r).sort(([o],[a])=>o>a?1:-1);return JSON.stringify({baseUrl:e,parameters:n,headers:i})}function $2(e,t){let r=new URL(e);for(let[n,i]of Object.entries(t))Sp(i)||Array.isArray(i)?r.searchParams.set(n,JSON.stringify(i)):i!=null&&r.searchParams.set(n,i.toString());return r.toString()}function H2(e,t){let r=new URL(e);for(let n of t)r.searchParams.has(n)&&r.searchParams.delete(n);return r.toString()}var Ei={apiBaseUrl:Vl,headers:{},maxLengthURL:vp};async function _e(e,t,r){let{accessToken:n,connectionName:i,cache:o,...a}=t,s={...Ei,clientId:Ci(),accessToken:n,connectionName:i,endpoint:e};for(let k in a)a[k]&&(s[k]=a[k]);let f=N2(s),{clientId:l,maxLengthURL:c,localCache:u}=s,d={Authorization:`Bearer ${t.accessToken}`,...t.headers},h={client:l,...t.tags,...r},g={requestType:"Map instantiation",connection:t.connectionName,type:e,source:JSON.stringify(h,void 0,2)},{tilejson:x,schema:S}=await tn({baseUrl:f,parameters:h,headers:d,errorContext:g,maxLengthURL:c,localCache:u}),T=x.url[0];o&&(o.value=parseInt(new URL(T).searchParams.get("cache")||"",10)),g.requestType="Map data";let w=await tn({baseUrl:T,parameters:{client:l},headers:d,errorContext:g,maxLengthURL:c,localCache:u});return n&&(w.accessToken=n),S&&(w.schema=S),w}var Kl=async function(e){let{columns:t,filters:r,tilesetTableName:n,propertiesSqlQuery:i,queryParameters:o}=e,a={tilesetTableName:n,propertiesSqlQuery:i};return t&&(a.columns=t.join(",")),r&&(a.filters=r),o&&(a.queryParameters=o),_e("boundary",e,a)},Xl=async function(e){let{filters:t,tilesetTableName:r,columns:n,propertiesTableName:i}=e,o={tilesetTableName:r,propertiesTableName:i};return n&&(o.columns=n.join(",")),t&&(o.filters=t),_e("boundary",e,o)},Tp=class Cp{constructor(t){O(this,"props"),this.props={...Cp.defaultProps,clientId:Ci(),...t}}destroy(){}};O(Tp,"defaultProps",{apiVersion:"v3",apiBaseUrl:Vl,clientId:Ci(),filters:{},filtersLogicalOperator:"and"});var Ql=Tp;function j2({response:e,data:t}){if(t.error==="Column not found")throw new zl(`${t.error} ${t.column_name}`);if(typeof t.error=="string"&&t.error?.includes("Missing columns"))throw new zl(t.error);switch(e.status){case 401:throw new Error("Unauthorized access. Invalid credentials");case 403:throw new Error("Forbidden access to the requested data");default:throw new Error(t&&t.error&&typeof t.error=="string"?t.error:JSON.stringify(t?.hint||t.error?.[0]))}}async function Z2({url:e,accessToken:t,opts:r}){let n,i,o=r?.method==="POST";try{n=await fetch(e.toString(),{headers:{Authorization:`Bearer ${t}`,...o&&{"Content-Type":"application/json"},...r.headers},...o&&{method:r?.method,body:r?.body},signal:r?.signal,...r?.otherOptions}),i=await n.json()}catch(a){throw a.name==="AbortError"?a:new Error(`Failed request: ${a}`)}return n.ok||j2({response:n,data:i}),i}var p0=["category","histogram","formula","pick","timeseries","range","scatterplot","table","aggregations"],{V3:W2}=z0,Y2=2048;function Tt(e){Q(e.source,"executeModel: missing source"),Q(e.model,"executeModel: missing model"),Q(e.params,"executeModel: missing params"),Q(p0.includes(e.model),`executeModel: model provided isn't valid. Available models: ${p0.join(", ")}`);let{model:t,source:r,params:n,opts:i}=e,{type:o,apiVersion:a,apiBaseUrl:s,accessToken:f,connectionName:l,clientId:c}=r;Q(s,"executeModel: missing apiBaseUrl"),Q(f,"executeModel: missing accessToken"),Q(a===W2,"executeModel: SQL Model API requires CARTO 3+"),Q(o!=="tileset","executeModel: Tilesets not supported");let u=`${s}/v3/sql/${l}/model/${t}`,{data:d,filters:h,filtersLogicalOperator:g="and",spatialDataType:x="geo",spatialDataColumn:S=_r,spatialFiltersMode:T="intersects",tags:w}=r,k={type:o,client:c,source:d,params:n,queryParameters:r.queryParameters||"",filters:h,filtersLogicalOperator:g,...w??{}};k.spatialDataType=x,k.spatialDataColumn=S,r.spatialFilter&&(k.spatialFilters={[S]:r.spatialFilter},x!=="geo"&&(k.spatialFiltersMode=T));let M=u+"?"+K2(k).toString(),L=M.length<=Y2;return L&&(u=M),Z2({url:u,accessToken:r.accessToken,opts:{...i,method:L?"GET":"POST",...!L&&{body:JSON.stringify(k)}}})}function K2(e){let t=new URLSearchParams;for(let r in e)Sp(e[r])||Array.isArray(e[r])?t.append(r,JSON.stringify(e[r])):e[r]===null?t.append(r,"null"):e[r]!==void 0&&t.append(r,String(e[r]));return t}var X2=new Set(Object.values(Gl)),Q2=e=>X2.has(e);function Ap(e,t){if(!t)return{};let r={};for(let n in t)for(let i in t[n]){if(!Q2(i))continue;let o=t[n][i],a=!e||!o?.owner||o?.owner!==e;o&&a&&(r[n]||(r[n]={}),r[n][i]=o)}return r}var Pp="_carto_others",Fp=class extends Ql{_getModelSource(e,t){let r=this.props;return{apiVersion:r.apiVersion,apiBaseUrl:r.apiBaseUrl,clientId:r.clientId,accessToken:r.accessToken,connectionName:r.connectionName,filters:Ap(t,e||r.filters),filtersLogicalOperator:r.filtersLogicalOperator,spatialDataType:r.spatialDataType,spatialDataColumn:r.spatialDataColumn,tags:r.tags}}async getCategories(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,rawResult:a,...s}=e,{column:f,operation:l,operationColumn:c,operationExp:u,othersThreshold:d,orderBy:h}=s;l===De.Custom&&Q(u,"operationExp is required for custom operation");let g=await Tt({model:"category",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:f,operation:l,operationExp:u,operationColumn:c||f,othersThreshold:d,orderBy:h},opts:{signal:t,headers:this.props.headers}}),x=At(g.rows||[]);return a?g:d?[...x,{name:Pp,value:g?.metadata?.others}]:x}async getFeatures(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{columns:s,dataType:f,featureIds:l,z:c,limit:u,tileResolution:d,offset:h}=a;return Tt({model:"pick",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{columns:s,dataType:f,featureIds:l,z:c,offset:h,limit:u||1e3,tileResolution:d||rn},opts:{signal:t,headers:this.props.headers}}).then(({rows:g,metadata:x})=>({rows:g,metadata:x}))}async getFormula(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,operationExp:a,...s}=e,{column:f,operation:l}=s;return l===De.Custom&&Q(a,"operationExp is required for custom operation"),Tt({model:"formula",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:f??"*",operation:l??De.Count,operationExp:a},opts:{signal:t,headers:this.props.headers}}).then(c=>At(c.rows[0]))}async getHistogram(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{column:s,operation:f,ticks:l}=a,c=await Tt({model:"histogram",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s,operation:f,ticks:l},opts:{signal:t,headers:this.props.headers}}).then(u=>At(u.rows));if(c.length){let u=Array(l.length+1).fill(0);return c.forEach(({tick:d,value:h})=>u[d]=h),u}return[]}async getRange(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{column:s}=a;return Tt({model:"range",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s},opts:{signal:t,headers:this.props.headers}}).then(f=>At(f.rows[0]))}async getScatter(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{xAxisColumn:s,xAxisJoinOperation:f,yAxisColumn:l,yAxisJoinOperation:c}=a;return Tt({model:"scatterplot",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{xAxisColumn:s,xAxisJoinOperation:f,yAxisColumn:l,yAxisJoinOperation:c,limit:500},opts:{signal:t,headers:this.props.headers}}).then(d=>At(d.rows)).then(d=>d.map(({x:h,y:g})=>[h,g]))}async getTable(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{columns:s,sortBy:f,sortDirection:l,offset:c=0,limit:u=10}=a;return Tt({model:"table",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s,sortBy:f,sortDirection:l,limit:u,offset:c},opts:{signal:t,headers:this.props.headers}}).then(d=>({rows:d.rows??d.ROWS,totalCount:d.metadata?.total??d.METADATA?.TOTAL}))}async getTimeSeries(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,...a}=e,{column:s,operationColumn:f,joinOperation:l,operation:c,operationExp:u,stepSize:d,stepMultiplier:h,splitByCategory:g,splitByCategoryLimit:x,splitByCategoryValues:S}=a;return c===De.Custom&&Q(u,"operationExp is required for custom operation"),Tt({model:"timeseries",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{column:s,stepSize:d,stepMultiplier:h,operationColumn:f||s,joinOperation:l,operation:c,operationExp:u,splitByCategory:g,splitByCategoryLimit:x,splitByCategoryValues:S},opts:{signal:t,headers:this.props.headers}}).then(T=>({rows:At(T.rows),categories:T.metadata?.categories}))}async getAggregations(e){let{signal:t,filters:r=this.props.filters,filterOwner:n,spatialFilter:i,spatialFiltersMode:o,aggregations:a}=e;return Tt({model:"aggregations",source:{...this.getModelSource(r,n),spatialFiltersMode:o,spatialFilter:i},params:{aggregations:a},opts:{signal:t,headers:this.props.headers}}).then(s=>({rows:s.rows.map(f=>At(f))}))}async getExtent(e={}){let{signal:t,filters:r=this.props.filters,filterOwner:n}=e,{type:i,data:o,apiBaseUrl:a,apiVersion:s,connectionName:f,spatialDataColumn:l,spatialDataType:c,queryParameters:u}=this.getModelSource(r,n);Q(s==="v3","Stats API requires CARTO 3+");let d,h={filters:r,spatialDataType:c};i==="query"?(d=`${a}/${s}/stats/${f}/${l}`,h.q=o,h.queryParameters=u):d=`${a}/${s}/stats/${f}/${o}/${l}`;let g={Authorization:`Bearer ${this.props.accessToken}`,...this.props.headers};return tn({baseUrl:d,headers:g,signal:t,errorContext:{requestType:"Tile stats",connection:f,type:i},parameters:h}).then(({extent:{xmin:S,ymin:T,xmax:w,ymax:k}})=>({bbox:[S,T,w,k]}))}},da=class extends Fp{getModelSource(e,t){return{...super._getModelSource(e,t),type:"query",data:this.props.sqlQuery,queryParameters:this.props.queryParameters}}},Ht={count:e=>e.length,min:(...e)=>Yo(tw,...e),max:(...e)=>Yo(rw,...e),sum:(...e)=>Yo(kp,...e),avg:(...e)=>Yo(ew,...e)};function jt(e,t,r){if(t?.length){if(t.length===1){let i=e[t[0]];return g0(i)?Number(i):i}}else throw new Error("Cannot aggregate a feature without having keys");let n=Ht[r];if(!n)throw new Error(`${r} isn't a valid aggregation function`);return n(t.map(i=>{let o=e[i];return g0(o)?Number(o):o}))}function g0(e){return typeof e=="string"&&e.trim().length>0}var Yo=(e,t,r,n)=>{let i=ha(r),o=(i?.length||0)<=1?J2(t,i||[]):t;return e(o,r,n)};function J2(e,t){let r=n=>n!=null;return t?.length?e.filter(n=>r(n[t[0]])):e.filter(r)}function ew(e,t,r){return kp(e,t,r)/(e.length||1)}function kp(e,t,r){let n=ha(t);return n?e.reduce((i,o)=>i+jt(o,n,r),0):e.reduce((i,o)=>i+o,0)}function tw(e,t,r){let n=ha(t);if(n)return e.reduce((o,a)=>Math.min(o,jt(a,n,r)),1/0);let i=Number.POSITIVE_INFINITY;for(let o of e)i=Math.min(i,o);return i}function rw(e,t,r){let n=ha(t);if(n)return e.reduce((o,a)=>Math.max(o,jt(a,n,r)),-1/0);let i=Number.NEGATIVE_INFINITY;for(let o of e)i=Math.max(i,o);return i}function ha(e){return Array.isArray(e)?e:typeof e=="string"?[e]:void 0}var nw=bx(yx(),1);function iw(e,{sortBy:t,sortByDirection:r="asc",sortByColumnType:n="string"}={}){if(t===void 0)return e;if(!(Array.isArray(t)&&t.length||typeof t=="string"))throw new Error("Sorting options are bad formatted");let o=ow({sortBy:t,sortByDirection:r,sortByColumnType:n||"string"});return e.sort(o)}function ow({sortBy:e,sortByDirection:t,sortByColumnType:r}){let[n,...i]=aw({sortBy:e,sortByDirection:t,sortByColumnType:r}),o=(0,nw.firstBy)(...n);for(let a of i)o=o.thenBy(...a);return o}function aw({sortBy:e,sortByDirection:t,sortByColumnType:r}){let n=r==="number"&&{cmp:(i,o)=>i-o};return Array.isArray(e)||(e=[e]),e.map(i=>{if(typeof i=="string")return[i,{direction:t,...n}];if(Array.isArray(i)){if(i[1]===void 0)return[i,{direction:t,...n}];if(typeof i[1]=="object"){let o=n?{...n,...i[1]}:i[1];return[i[0],{direction:t,...o}]}}return i})}function sw({data:e,valuesColumns:t,joinOperation:r,keysColumn:n,operation:i,othersThreshold:o,orderBy:a="frequency_desc"}){if(Array.isArray(e)&&e.length===0)return{rows:null};let s=e.reduce((c,u)=>{let d=u[n],h=c.get(d)||[];c.set(d,h);let g=jt(u,t,r);return(i==="count"||g!==null)&&g!==void 0&&(h.push(g),c.set(d,h)),c},new Map),f=Ht[i];if(!f)return{rows:[]};let l=Array.from(s).map(([c,u])=>({name:c,value:f(u)})).sort(lw(a));if(o&&l.length>o){let c=l.slice(o).flatMap(({name:u})=>s.get(u));return{rows:l,metadata:{others:f(c)}}}return{rows:l}}function lw(e){switch(e){case"frequency_asc":return(t,r)=>t.value-r.value||Ko(t.name,r.name);case"frequency_desc":return(t,r)=>r.value-t.value||Ko(t.name,r.name);case"alphabetical_asc":return(t,r)=>Ko(t.name,r.name)||r.value-t.value;case"alphabetical_desc":return(t,r)=>Ko(r.name,t.name)||r.value-t.value}}function Ko(e,t){return typeof e=="number"&&typeof t=="number"?e-t:String(e??"null").localeCompare(String(t??"null"))}function fw(e){let t=new Date(e),r=t.getUTCDay(),n=t.getUTCDate()-r+(r?1:-6);return t.setUTCDate(n),Date.UTC(t.getUTCFullYear(),t.getUTCMonth(),t.getUTCDate())}var cw={year:e=>Date.UTC(e.getUTCFullYear()),month:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth()),week:e=>fw(e),day:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate()),hour:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours()),minute:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes()),second:e=>Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate(),e.getUTCHours(),e.getUTCMinutes(),e.getUTCSeconds())};function uw({data:e,valuesColumns:t,joinOperation:r,keysColumn:n,groupType:i,operation:o}){if(Array.isArray(e)&&e.length===0)return null;let a=cw[i];if(!a)return null;let s=e.reduce((l,c)=>{let u=c[n],d=new Date(u),h=a(d);if(!isNaN(h)){let g=l.get(h);g||(g=[],l.set(h,g));let x=jt(c,t,r);x!=null&&(g.push(x),l.set(h,g))}return l},new Map),f=Ht[o];return[...s.entries()].map(([l,c])=>({name:l,value:f(c)})).sort((l,c)=>l.name-c.name)}function dw({data:e,valuesColumns:t,joinOperation:r,ticks:n,operation:i}){if(Array.isArray(e)&&e.length===0)return[];let o=[Number.MIN_SAFE_INTEGER,...n].map((f,l,c)=>({bin:l,start:f,end:l===c.length-1?Number.MAX_SAFE_INTEGER:c[l+1],values:[]}));e.forEach(f=>{let l=jt(f,t,r);if(!(l!=null))return;let u=o.find(d=>d.start<=l&&d.end>l);u&&u.values.push(l)});let a=Ht[i];return o.map(f=>f.values).map(f=>f.length?a(f):0)}function hw({data:e,xAxisColumns:t,xAxisJoinOperation:r,yAxisColumns:n,yAxisJoinOperation:i}){return e.reduce((o,a)=>{let s=jt(a,t,r),f=s!=null,l=jt(a,n,i),c=l!=null;return f&&c&&o.push([s,l]),o},[])}var pw=Object.defineProperty,nn=(e,t)=>pw(e,"name",{value:t,configurable:!0}),Lp=class{constructor(t){this.direction=!1,this.compareProperties=!0;var r,n,i;this.precision=10**-((r=t?.precision)!=null?r:17),this.direction=(n=t?.direction)!=null?n:!1,this.compareProperties=(i=t?.compareProperties)!=null?i:!0}compare(t,r){if(t.type!==r.type||!yi(t,r))return!1;switch(t.type){case"Point":return this.compareCoord(t.coordinates,r.coordinates);case"LineString":return this.compareLine(t.coordinates,r.coordinates);case"Polygon":return this.comparePolygon(t,r);case"GeometryCollection":return this.compareGeometryCollection(t,r);case"Feature":return this.compareFeature(t,r);case"FeatureCollection":return this.compareFeatureCollection(t,r);default:if(t.type.startsWith("Multi")){let n=Ul(t),i=Ul(r);return n.every(o=>i.some(a=>this.compare(o,a)))}}return!1}compareCoord(t,r){return t.length===r.length&&t.every((n,i)=>Math.abs(n-r[i])<this.precision)}compareLine(t,r,n=0,i=!1){if(!yi(t,r))return!1;let o=t,a=r;if(i&&!this.compareCoord(o[0],a[0])){let f=this.fixStartIndex(a,o);if(f)a=f;else return!1}let s=this.compareCoord(o[n],a[n]);return this.direction||s?this.comparePath(o,a):this.compareCoord(o[n],a[a.length-(1+n)])?this.comparePath(o.slice().reverse(),a):!1}fixStartIndex(t,r){let n,i=-1;for(let o=0;o<t.length;o++)if(this.compareCoord(t[o],r[0])){i=o;break}return i>=0&&(n=[].concat(t.slice(i,t.length),t.slice(1,i+1))),n}comparePath(t,r){return t.every((n,i)=>this.compareCoord(n,r[i]))}comparePolygon(t,r){if(this.compareLine(t.coordinates[0],r.coordinates[0],1,!0)){let n=t.coordinates.slice(1,t.coordinates.length),i=r.coordinates.slice(1,r.coordinates.length);return n.every(o=>i.some(a=>this.compareLine(o,a,1,!0)))}return!1}compareGeometryCollection(t,r){return yi(t.geometries,r.geometries)&&this.compareBBox(t,r)&&t.geometries.every((n,i)=>this.compare(n,r.geometries[i]))}compareFeature(t,r){return t.id===r.id&&(this.compareProperties?Jl(t.properties,r.properties):!0)&&this.compareBBox(t,r)&&this.compare(t.geometry,r.geometry)}compareFeatureCollection(t,r){return yi(t.features,r.features)&&this.compareBBox(t,r)&&t.features.every((n,i)=>this.compare(n,r.features[i]))}compareBBox(t,r){return!t.bbox&&!r.bbox||(t.bbox&&r.bbox?this.compareCoord(t.bbox,r.bbox):!1)}};nn(Lp,"GeojsonEquality");var gw=Lp;function yi(e,t){return e.coordinates?e.coordinates.length===t.coordinates.length:e.length===t.length}nn(yi,"sameLength");function Ul(e){return e.coordinates.map(t=>({type:e.type.replace("Multi",""),coordinates:t}))}nn(Ul,"explode");function Mp(e,t,r){return new gw(r).compare(e,t)}nn(Mp,"geojsonEquality");function Jl(e,t){if(e===null&&t===null)return!0;if(e===null||t===null)return!1;let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(var i of r){let o=e[i],a=t[i],s=m0(o)&&m0(a);if(s&&!Jl(o,a)||!s&&o!==a)return!1}return!0}nn(Jl,"equal");var m0=nn(e=>e!=null&&typeof e=="object","isObject");function b0(e,t={}){var r=typeof t=="object"?t.mutate:t;if(!e)throw new Error("geojson is required");var n=Gx(e),i=[];switch(n){case"LineString":i=Sl(e,n);break;case"MultiLineString":case"Polygon":xi(e).forEach(function(a){i.push(Sl(a,n))});break;case"MultiPolygon":xi(e).forEach(function(a){var s=[];a.forEach(function(f){s.push(Sl(f,n))}),i.push(s)});break;case"Point":return e;case"MultiPoint":var o={};xi(e).forEach(function(a){var s=a.join("-");Object.prototype.hasOwnProperty.call(o,s)||(i.push(a),o[s]=!0)});break;default:throw new Error(n+" geometry not supported")}return e.coordinates?r===!0?(e.coordinates=i,e):{type:n,coordinates:i}:r===!0?(e.geometry.coordinates=i,e):we({type:n,coordinates:i},e.properties,{bbox:e.bbox,id:e.id})}function Sl(e,t){var r=xi(e);if(r.length===2&&!y0(r[0],r[1]))return r;var n=[],i=r.length-1,o=n.length;n.push(r[0]);for(var a=1;a<i;a++){var s=n[n.length-1];r[a][0]===s[0]&&r[a][1]===s[1]||(n.push(r[a]),o=n.length,o>2&&x0(n[o-3],n[o-1],n[o-2])&&n.splice(n.length-2,1))}if(n.push(r[r.length-1]),o=n.length,(t==="Polygon"||t==="MultiPolygon")&&y0(r[0],r[r.length-1])&&o<4)throw new Error("invalid polygon");return t==="LineString"&&o<3||x0(n[o-3],n[o-1],n[o-2])&&n.splice(n.length-2,1),n}function y0(e,t){return e[0]===t[0]&&e[1]===t[1]}function x0(e,t,r){var n=r[0],i=r[1],o=e[0],a=e[1],s=t[0],f=t[1],l=n-o,c=i-a,u=s-o,d=f-a,h=l*d-c*u;return h!==0?!1:Math.abs(u)>=Math.abs(d)?u>0?o<=n&&n<=s:s<=n&&n<=o:d>0?a<=i&&i<=f:f<=i&&i<=a}function mw(e,t,r={}){let n=r.precision;if(n=n==null||isNaN(n)?6:n,typeof n!="number"||!(n>=0))throw new Error("precision must be a positive number");let i=Pt(e).type,o=Pt(t).type;return i!==o?!1:Mp(b0(e),b0(t),{precision:n})}var bw=class extends Ql{constructor(){super(...arguments),O(this,"_tiles",[]),O(this,"_features",[]),O(this,"_tileFeatureExtractOptions",{}),O(this,"_tileFeatureExtractPreviousInputs",{})}loadTiles(e){this._tiles=e,this._features.length=0}setTileFeatureExtractOptions(e){this._tileFeatureExtractOptions=e,this._features.length=0}_extractTileFeatures(e){let t=this._tileFeatureExtractPreviousInputs;this._features.length&&yw(t.spatialFilter,e)||(this._features=I2({...M2({},this.props,this._tileFeatureExtractOptions),tiles:this._tiles,spatialFilter:e}),t.spatialFilter=e)}loadGeoJSON({geojson:e,spatialFilter:t}){this._features=lv({geojson:e,spatialFilter:t,...this._tileFeatureExtractOptions}),this._tileFeatureExtractPreviousInputs.spatialFilter=t}async getFeatures(){throw new Error("getFeatures not supported for tilesets")}async getFormula({column:e="*",operation:t=De.Count,joinOperation:r,filters:n,filterOwner:i,spatialFilter:o}){let a=this._getFilteredFeatures(o,n,i);if(a.length===0&&t!==De.Count)return{value:null};if(t===De.Custom)throw new Error("Custom aggregation not supported for tilesets");(e&&e!=="*"||t!==De.Count)&&yr(this._features,e);let s=Ht[t];return Q(s,`Unsupported aggregation operation: ${t}`),{value:s(a,e,r)}}async getHistogram({operation:e=De.Count,ticks:t,column:r,joinOperation:n,filters:i,filterOwner:o,spatialFilter:a}){let s=this._getFilteredFeatures(a,i,o);return this._features.length?(yr(this._features,r),dw({data:s,valuesColumns:Qr(r),joinOperation:n,ticks:t,operation:e})):[]}async getCategories({column:e,operation:t=De.Count,operationColumn:r,joinOperation:n,filters:i,filterOwner:o,spatialFilter:a,othersThreshold:s,orderBy:f="frequency_desc",rawResult:l}){let c=this._getFilteredFeatures(a,i,o);if(!c.length)return[];yr(this._features,e,r);let u=sw({data:c,valuesColumns:Qr(r||e),joinOperation:n,keysColumn:e,operation:t,othersThreshold:s,orderBy:f});return l?u:s?[...u?.rows||[],{name:Pp,value:u?.metadata?.others}]:u?.rows||[]}async getScatter({xAxisColumn:e,yAxisColumn:t,xAxisJoinOperation:r,yAxisJoinOperation:n,filters:i,filterOwner:o,spatialFilter:a}){let s=this._getFilteredFeatures(a,i,o);return s.length?(yr(this._features,e,t),hw({data:s,xAxisColumns:Qr(e),xAxisJoinOperation:r,yAxisColumns:Qr(t),yAxisJoinOperation:n})):[]}async getTable({columns:e,searchFilterColumn:t,searchFilterText:r,sortBy:n,sortDirection:i,sortByColumnType:o,offset:a=0,limit:s=10,filters:f,filterOwner:l,spatialFilter:c}){let u=this._getFilteredFeatures(c,f,l);if(!u.length)return{rows:[],totalCount:0};t&&r&&(console.warn('WidgetTilesetSource: "searchFilterText" is deprecated, use "filters" and FilterType.STRING_SEARCH instead.'),u=u.filter(g=>g[t]&&String(g[t]).toLowerCase().includes(String(r).toLowerCase())));let d=iw(u,{sortBy:n,sortByDirection:i,sortByColumnType:o}),h=d.length;return d=d.slice(Math.min(a,h),Math.min(a+s,h)),d=d.map(g=>{let x={};for(let S of e)x[S]=g[S];return x}),{rows:d,totalCount:h}}async getTimeSeries({column:e,stepSize:t,operation:r,operationColumn:n,joinOperation:i,filters:o,filterOwner:a,spatialFilter:s}){let f=this._getFilteredFeatures(s,o,a);return f.length?(yr(this._features,e,n),Q(r!=="custom","Custom operation not supported for tilesets"),{rows:uw({data:f,valuesColumns:Qr(n||e),keysColumn:e,groupType:t,operation:r,joinOperation:i})||[]}):{rows:[]}}async getRange({column:e,filters:t,filterOwner:r,spatialFilter:n}){let i=this._getFilteredFeatures(n,t,r);return this._features.length?(yr(this._features,e),{min:Ht.min(i,e),max:Ht.max(i,e)}):null}async getAggregations({aggregations:e,filters:t,filterOwner:r,spatialFilter:n}){let i=this._getFilteredFeatures(n,t,r);if(!this._features.length)return{rows:[]};Q(typeof e!="string","Unsupported tileset SQL aggregation");let o={},a=new Set;for(let{column:s,operation:f,alias:l}of e){(s&&s!=="*"||f!==De.Count)&&yr(this._features,s);let c=l.toLowerCase();Q(!a.has(c),`Duplicate alias: ${c}`),a.add(c);let u=Ht[f];Q(u,`Unsupported operation: ${f}`),o[l]=u(i,s)}return{rows:[o]}}async getExtent(){return Promise.reject(new Error("not implemented"))}_getFilteredFeatures(e,t,r){return this._extractTileFeatures(e),Mx(this._features,Ap(r,t||this.props.filters),this.props.filtersLogicalOperator||"and")}};function yr(e,...t){let r=Array.from(new Set(t.map(Qr).flat())),n=Object.keys(e[0]),i=r.filter(o=>o&&!n.includes(o));if(i.length)throw new zl(`Missing column(s): ${i.join(", ")}`)}function Qr(e){return Array.isArray(e)?e:typeof e=="string"?[e]:[]}function yw(e,t){return e===t?!0:!e||!t?!1:mw(e,t)}var pa=class extends Ql{constructor(e){super(e),O(this,"_localImpl",null),O(this,"_workerImpl",null),O(this,"_workerEnabled"),O(this,"_workerNextRequestId",1),this._workerEnabled=(e.widgetWorker??!0)&&!0&&typeof Worker<"u",this._workerEnabled||(this._localImpl=new bw(this.props))}destroy(){this._localImpl?.destroy(),this._localImpl=null,this._workerImpl?.terminate(),this._workerImpl=null,super.destroy()}_getWorker(){return this._workerImpl?this._workerImpl:(this.props.widgetWorkerUrl?this._workerImpl=new Worker(this.props.widgetWorkerUrl,{name:"cartowidgettileset"}):this._workerImpl=new Worker(new URL("@carto/api-client/worker",t6.url),{type:"module",name:"cartowidgettileset"}),this._workerImpl.addEventListener("error",e=>{console.error("widget-tileset-source worker error",e)}),this._workerImpl.postMessage({method:"init",params:[this.props]}),this._workerImpl)}_executeWorkerMethod(e,t,r){if(!this._workerEnabled)return this._localImpl[e](...t);let n=this._getWorker(),i=this._workerNextRequestId++,o=null,a=null;function s(c){let u=c.data;u.requestId===i&&(r?.aborted||(u.ok?o(u.result):a(new Error(u.error))))}function f(){a(new Error(r.reason))}n.addEventListener("message",s),r?.addEventListener("abort",f);let l=new Promise((c,u)=>{o=c,a=u,n.postMessage({requestId:i,method:e,params:t})});return l.finally(()=>{n.removeEventListener("message",s),r?.removeEventListener("abort",f)}),l}loadTiles(e){if(!this._workerEnabled)return this._localImpl.loadTiles(e);let t=this._getWorker();e=e.map(({id:r,index:n,bbox:i,isVisible:o,data:a})=>({id:r,index:n,isVisible:o,data:a,bbox:i})),t.postMessage({method:"loadTiles",params:[e]})}setTileFeatureExtractOptions(e){if(!this._workerEnabled)return this._localImpl?.setTileFeatureExtractOptions(e);this._getWorker().postMessage({method:"setTileFeatureExtractOptions",params:[e]})}loadGeoJSON({geojson:e,spatialFilter:t}){if(!this._workerEnabled)return this._localImpl.loadGeoJSON({geojson:e,spatialFilter:t});this._getWorker().postMessage({method:"loadGeoJSON",params:[{geojson:e,spatialFilter:t}]})}async getFeatures(){throw new Error("getFeatures not supported for tilesets")}async getFormula({signal:e,...t}){return this._executeWorkerMethod("getFormula",[t],e)}async getHistogram({signal:e,...t}){return this._executeWorkerMethod("getHistogram",[t],e)}async getCategories({signal:e,...t}){return this._executeWorkerMethod("getCategories",[t],e)}async getScatter({signal:e,...t}){return this._executeWorkerMethod("getScatter",[t],e)}async getTable({signal:e,...t}){return this._executeWorkerMethod("getTable",[t],e)}async getTimeSeries({signal:e,...t}){return this._executeWorkerMethod("getTimeSeries",[t],e)}async getRange({signal:e,...t}){return this._executeWorkerMethod("getRange",[t],e)}async getAggregations({signal:e,...t}){return this._executeWorkerMethod("getAggregations",[t],e)}async getExtent(){return Promise.resolve({bbox:this.props.spatialDataBounds})}},xw=class extends pa{},ga=class extends Fp{getModelSource(e,t){return{...super._getModelSource(e,t),type:"table",data:this.props.tableName}}},ma=async function(e){let{aggregationExp:t,aggregationResLevel:r=Wl,sqlQuery:n,spatialDataColumn:i="h3",queryParameters:o,filters:a}=e,s="h3",f={aggregationExp:t,spatialDataColumn:i,spatialDataType:s,q:n};return r&&(f.aggregationResLevel=String(r)),o&&(f.queryParameters=o),a&&(f.filters=a),_e("query",e,f).then(l=>({...l,widgetSource:new da({...e,spatialDataColumn:i,spatialDataType:ua(s,i,l.schema)})}))},ba=async function(e){let{aggregationExp:t,aggregationResLevel:r=Wl,spatialDataColumn:n="h3",tableName:i,filters:o}=e,a="h3",s={aggregationExp:t,name:i,spatialDataColumn:n,spatialDataType:a};return r&&(s.aggregationResLevel=String(r)),o&&(s.filters=o),_e("table",e,s).then(f=>({...f,widgetSource:new ga({...e,spatialDataColumn:n,spatialDataType:ua(a,n,f.schema)})}))};function ya(e){return new URL(e.tiles[0]).searchParams.get("formatTiles")==="mvt"?"mvt":"binary"}var ef=async function(e){let{tableName:t,spatialDataColumn:r="h3"}=e;return _e("tileset",e,{name:t}).then(i=>({...i,widgetSource:new pa({...e,tileFormat:ya(i),spatialDataColumn:r,spatialDataType:"h3",spatialDataBounds:i.bounds})}))},xa=async function(e){let{aggregationExp:t,aggregationResLevel:r=Yl,sqlQuery:n,spatialDataColumn:i="quadbin",queryParameters:o,filters:a}=e,s="quadbin",f={aggregationExp:t,q:n,spatialDataColumn:i,spatialDataType:s};return r&&(f.aggregationResLevel=String(r)),o&&(f.queryParameters=o),a&&(f.filters=a),_e("query",e,f).then(l=>({...l,widgetSource:new da({...e,spatialDataColumn:i,spatialDataType:ua(s,i,l.schema)})}))},va=async function(e){let{aggregationExp:t,aggregationResLevel:r=Yl,spatialDataColumn:n="quadbin",tableName:i,filters:o}=e,a="quadbin",s={aggregationExp:t,name:i,spatialDataColumn:n,spatialDataType:a};return r&&(s.aggregationResLevel=String(r)),o&&(s.filters=o),_e("table",e,s).then(f=>({...f,widgetSource:new ga({...e,spatialDataColumn:n,spatialDataType:ua(a,n,f.schema)})}))},tf=async function(e){let{tableName:t,spatialDataColumn:r="quadbin"}=e;return _e("tileset",e,{name:t}).then(i=>({...i,widgetSource:new pa({...e,tileFormat:ya(i),spatialDataColumn:r,spatialDataType:"quadbin",spatialDataBounds:i.bounds})}))},wa=async function(e){let{tableName:t,filters:r}=e,n={name:t};return r&&(n.filters=r),_e("raster",e,n).then(i=>({...i,widgetSource:new xw({...e,tileFormat:ya(i),spatialDataColumn:"quadbin",spatialDataType:"quadbin",spatialDataBounds:i.bounds,rasterMetadata:i.raster_metadata})}))},vw=async function(e){let{columns:t,spatialDataColumn:r=_r,sqlQuery:n,tileResolution:i=rn,queryParameters:o,aggregationExp:a,trajectoryIdColumn:s,timestampColumn:f}=e,l="trajectory",c={spatialDataColumn:r,spatialDataType:l,tileResolution:i.toString(),q:n,trajectoryIdColumn:s,timestampColumn:f};t&&(c.columns=t.join(",")),o&&(c.queryParameters=o),a&&(c.aggregationExp=a);let u=await _e("query",e,c),d=new da({...e,spatialDataColumn:r,spatialDataType:l,tileResolution:i}),h=await d.getRange({column:f});return{...u,widgetSource:d,timestampRange:h}},ww=async function(e){let{columns:t,spatialDataColumn:r=_r,tableName:n,tileResolution:i=rn,aggregationExp:o,trajectoryIdColumn:a,timestampColumn:s}=e,f="trajectory",l={name:n,spatialDataColumn:r,spatialDataType:f,tileResolution:i.toString(),trajectoryIdColumn:a,timestampColumn:s};t&&(l.columns=t.join(",")),o&&(l.aggregationExp=o);let c=await _e("table",e,l),u=new ga({...e,spatialDataColumn:r,spatialDataType:f,tileResolution:i}),d=await u.getRange({column:s});return{...c,widgetSource:u,timestampRange:d}},_a=async function(e){let{columns:t,filters:r,spatialDataColumn:n=_r,sqlQuery:i,tileResolution:o=rn,queryParameters:a,aggregationExp:s}=e,f="geo",l={spatialDataColumn:n,spatialDataType:f,tileResolution:o.toString(),q:i};return t&&(l.columns=t.join(",")),r&&(l.filters=r),a&&(l.queryParameters=a),s&&(l.aggregationExp=s),_e("query",e,l).then(c=>({...c,widgetSource:new da({...e,spatialDataColumn:n,spatialDataType:f,tileResolution:o})}))},Ea=async function(e){let{columns:t,filters:r,spatialDataColumn:n=_r,tableName:i,tileResolution:o=rn,aggregationExp:a}=e,s="geo",f={name:i,spatialDataColumn:n,spatialDataType:s,tileResolution:o.toString()};return t&&(f.columns=t.join(",")),r&&(f.filters=r),a&&(f.aggregationExp=a),_e("table",e,f).then(l=>({...l,widgetSource:new ga({...e,spatialDataColumn:n,spatialDataType:s,tileResolution:o})}))},Sa=async function(e){let{tableName:t,spatialDataColumn:r=_r}=e;return _e("tileset",e,{name:t}).then(i=>({...i,widgetSource:new pa({...e,tileFormat:ya(i),spatialDataColumn:r,spatialDataType:"geo",spatialDataBounds:i.bounds})}))};var Ip={boundaryQuerySource:Kl,boundaryTableSource:Xl,h3QuerySource:ma,h3TableSource:ba,h3TilesetSource:ef,quadbinQuerySource:xa,quadbinTableSource:va,quadbinTilesetSource:tf,rasterSource:wa,trajectoryQuerySource:vw,trajectoryTableSource:ww,vectorQuerySource:_a,vectorTableSource:Ea,vectorTilesetSource:Sa},Rp=async function(e){let{apiBaseUrl:t=Ei.apiBaseUrl,maxLengthURL:r=Ei.maxLengthURL,clientId:n=Ci(),localCache:i,connectionName:o,sqlQuery:a,queryParameters:s,internalParameters:f}=e,l={q:a};s&&(l.queryParameters=s);let c=z2({apiBaseUrl:t,connectionName:o}),u={Authorization:`Bearer ${e.accessToken}`,...e.headers},d={client:n,...e.tags,...f,...l},h={requestType:"SQL",connection:e.connectionName,type:"query",source:JSON.stringify(d,void 0,2)};return await tn({baseUrl:c,parameters:d,headers:u,errorContext:h,maxLengthURL:r,localCache:i,signal:e.signal})},_w="https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json",Ew=["positron","dark-matter","voyager"],Sw={roadmap:{mapTypeId:"roadmap",mapId:"3754c817b510f791"},"google-positron":{mapTypeId:"roadmap",mapId:"ea84ae4203ef21cd"},"google-dark-matter":{mapTypeId:"roadmap",mapId:"2fccc3b36c22a0e2"},"google-voyager":{mapTypeId:"roadmap",mapId:"885caf1e15bb9ef2"},satellite:{mapTypeId:"satellite"},hybrid:{mapTypeId:"hybrid"},terrain:{mapTypeId:"terrain"}},Tw=[{slug:"label",filter:({id:e})=>!!e.match(/(?=(label|_label|place-|place_|poi-|poi_|watername_|roadname_|housenumber))/),defaultVisibility:!0},{slug:"road",filter:({id:e})=>!!e.match(/(?=(road|railway|tunnel|street|bridge))(?!.*label)/),defaultVisibility:!0},{slug:"border",filter:({id:e})=>!!e.match(/border|boundaries|boundary_/),defaultVisibility:!1},{slug:"building",filter:({id:e})=>!!e.match(/building/),defaultVisibility:!0},{slug:"water",filter:({id:e})=>!!e.match(/(?=(water|stream|ferry))/),defaultVisibility:!0},{slug:"land",filter:({id:e})=>!!e.match(/(?=(parks|landcover|industrial|sand|hillshade|park_))/),defaultVisibility:!0}];function Cw(e,t){if(!Array.isArray(e?.layers))return e;let r=Tw.filter(i=>!t[i.slug]).map(i=>i.filter),n=e.layers.filter(i=>r.every(o=>!o(i)));return{...e,layers:n}}function Aw(e){return e&&Object.values(e).every(Boolean)===!1}function $t(e){return _w.replace("{basemap}",e)}async function Pw({styleUrl:e,errorContext:t}){let r;return await fetch(e,{mode:"cors"}).then(n=>(r=n,n.json())).catch(n=>{throw new Er(n,{...t,requestType:"Basemap style"},r)})}var _C={VOYAGER:$t("voyager"),POSITRON:$t("positron"),DARK_MATTER:$t("dark-matter"),VOYAGER_NOLABELS:$t("voyager-nolabels"),POSITRON_NOLABELS:$t("positron-nolabels"),DARK_MATTER_NOLABELS:$t("dark-matter-nolabels")};function Bp(e){try{let t=zw(e),r=n=>Ct(t,n);return r.symbols=Nw(t),r}catch{return null}}function Ai(e,t=e.length){return new Array(t)}function vi(e){return Array.isArray(e)||ArrayBuffer.isView(e)}var Fw=e=>(t,r)=>{let n=Math.min(t.length,r.length),i=Ai(t,n);for(let o=0;o<n;o++)i[o]=e(t[o],r[o]);return i},kw=e=>(t,r)=>{let n=t.length,i=Ai(t,n);for(let o=0;o<n;o++)i[o]=e(t[o],r);return i},Lw=e=>(t,r)=>{let n=r.length,i=Ai(r,n);for(let o=0;o<n;o++)i[o]=e(t,r[o]);return i},Mw=e=>t=>{let r=t.length,n=Ai(t,r);for(let i=0;i<r;i++)n[i]=e(t[i]);return n};function Ta(e,t){return Object.keys(e).reduce((r,n)=>(r[n]=t(e[n]),r),{})}var Ca={"||":(e,t)=>e||t,"&&":(e,t)=>e&&t,"|":(e,t)=>e|t,"^":(e,t)=>e^t,"&":(e,t)=>e&t,"==":(e,t)=>+(e==t),"!=":(e,t)=>+(e!=t),"===":(e,t)=>+(e===t),"!==":(e,t)=>+(e!==t),"<":(e,t)=>+(e<t),">":(e,t)=>+(e>t),"<=":(e,t)=>+(e<=t),">=":(e,t)=>+(e>=t),"<<":(e,t)=>e<<t,">>":(e,t)=>e>>t,">>>":(e,t)=>e>>>t,"+":(e,t)=>e+t,"-":(e,t)=>e-t,"*":(e,t)=>e*t,"/":(e,t)=>e/t,"%":(e,t)=>e%t},Op={"-":e=>-e,"+":e=>+e,"~":e=>~e,"!":e=>+!e},Iw=Ta(Ca,Fw),Rw=Ta(Ca,Lw),Bw=Ta(Ca,kw),Ow=Ta(Op,Mw);function Dw(e,t,r){let n=vi(t),i=vi(r);return n&&i?Iw[e]:n?Bw[e]:i?Rw[e]:Ca[e]}function Ct(e,t){let r=e;switch(r.type){case"BinaryExpression":{let n=Ct(r.left,t),i=Ct(r.right,t);return Dw(r.operator,n,i)(n,i)}case"ConditionalExpression":{let n=Ct(r.test,t);if(vi(n)){let i=n.length,o=Ct(r.consequent,t),a=Ct(r.alternate,t),s=Ai(n);for(let f=0;f<i;f++){let l=n[f]?o:a;s[f]=vi(l)?l[f]??NaN:l}return s}else return Ct(n?r.consequent:r.alternate,t)}case"Identifier":return t[r.name];case"Literal":return r.value;case"UnaryExpression":{let n=Ct(r.argument,t);return(vi(n)?Ow[r.operator]:Op[r.operator])(n)}default:return}}function xr(e,t){let r=e;switch(t(r),r.type){case"BinaryExpression":{xr(r.left,t),xr(r.right,t);break}case"ConditionalExpression":{xr(r.test,t),xr(r.consequent,t),xr(r.alternate,t);break}case"UnaryExpression":{xr(r.argument,t);break}}}function Nw(e){let t=new Set;return xr(e,r=>{r.type==="Identifier"&&t.add(r.name)}),Array.from(t)}function zw(e){return jr(e)}function rf(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function Dp(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function Pi(){}var Si=.7,la=1/Si,en="\\s*([+-]?\\d+)\\s*",Ti="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",ut="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",Uw=/^#([0-9a-f]{3,8})$/,qw=new RegExp(`^rgb\\(${en},${en},${en}\\)$`),Gw=new RegExp(`^rgb\\(${ut},${ut},${ut}\\)$`),Vw=new RegExp(`^rgba\\(${en},${en},${en},${Ti}\\)$`),$w=new RegExp(`^rgba\\(${ut},${ut},${ut},${Ti}\\)$`),Hw=new RegExp(`^hsl\\(${Ti},${ut},${ut}\\)$`),jw=new RegExp(`^hsla\\(${Ti},${ut},${ut},${Ti}\\)$`),v0={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};rf(Pi,nf,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:w0,formatHex:w0,formatHex8:Zw,formatHsl:Ww,formatRgb:_0,toString:_0});function w0(){return this.rgb().formatHex()}function Zw(){return this.rgb().formatHex8()}function Ww(){return Np(this).formatHsl()}function _0(){return this.rgb().formatRgb()}function nf(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=Uw.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?E0(t):r===3?new ve(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Xo(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Xo(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=qw.exec(e))?new ve(t[1],t[2],t[3],1):(t=Gw.exec(e))?new ve(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Vw.exec(e))?Xo(t[1],t[2],t[3],t[4]):(t=$w.exec(e))?Xo(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Hw.exec(e))?C0(t[1],t[2]/100,t[3]/100,1):(t=jw.exec(e))?C0(t[1],t[2]/100,t[3]/100,t[4]):v0.hasOwnProperty(e)?E0(v0[e]):e==="transparent"?new ve(NaN,NaN,NaN,0):null}function E0(e){return new ve(e>>16&255,e>>8&255,e&255,1)}function Xo(e,t,r,n){return n<=0&&(e=t=r=NaN),new ve(e,t,r,n)}function Yw(e){return e instanceof Pi||(e=nf(e)),e?(e=e.rgb(),new ve(e.r,e.g,e.b,e.opacity)):new ve}function of(e,t,r,n){return arguments.length===1?Yw(e):new ve(e,t,r,n??1)}function ve(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}rf(ve,of,Dp(Pi,{brighter(e){return e=e==null?la:Math.pow(la,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,e),new ve(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new ve(wr(this.r),wr(this.g),wr(this.b),fa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:S0,formatHex:S0,formatHex8:Kw,formatRgb:T0,toString:T0}));function S0(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}`}function Kw(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}${vr((isNaN(this.opacity)?1:this.opacity)*255)}`}function T0(){let e=fa(this.opacity);return`${e===1?"rgb(":"rgba("}${wr(this.r)}, ${wr(this.g)}, ${wr(this.b)}${e===1?")":`, ${e})`}`}function fa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function wr(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function vr(e){return e=wr(e),(e<16?"0":"")+e.toString(16)}function C0(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new Ze(e,t,r,n)}function Np(e){if(e instanceof Ze)return new Ze(e.h,e.s,e.l,e.opacity);if(e instanceof Pi||(e=nf(e)),!e)return new Ze;if(e instanceof Ze)return e;e=e.rgb();var t=e.r/255,r=e.g/255,n=e.b/255,i=Math.min(t,r,n),o=Math.max(t,r,n),a=NaN,s=o-i,f=(o+i)/2;return s?(t===o?a=(r-n)/s+(r<n)*6:r===o?a=(n-t)/s+2:a=(t-r)/s+4,s/=f<.5?o+i:2-o-i,a*=60):s=f>0&&f<1?0:a,new Ze(a,s,f,e.opacity)}function Xw(e,t,r,n){return arguments.length===1?Np(e):new Ze(e,t,r,n??1)}function Ze(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}rf(Ze,Xw,Dp(Pi,{brighter(e){return e=e==null?la:Math.pow(la,e),new Ze(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?Si:Math.pow(Si,e),new Ze(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,i=2*r-n;return new ve(Tl(e>=240?e-240:e+120,i,n),Tl(e,i,n),Tl(e<120?e+240:e-120,i,n),this.opacity)},clamp(){return new Ze(A0(this.h),Qo(this.s),Qo(this.l),fa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=fa(this.opacity);return`${e===1?"hsl(":"hsla("}${A0(this.h)}, ${Qo(this.s)*100}%, ${Qo(this.l)*100}%${e===1?")":`, ${e})`}`}}));function A0(e){return e=(e||0)%360,e<0?e+360:e}function Qo(e){return Math.max(0,Math.min(1,e||0))}function Tl(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}function Qw(e,t){let{properties:r,numericProps:n}=e;return new Proxy(r[t]||{},{get(i,o){return o in n?n[o].value[t]:i[o]},has(i,o){return o in n||o in i},ownKeys(i){return[...Object.keys(n),...Reflect.ownKeys(i)]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}})}function zp(){let e;function t(r){return r===null?e:r}return t.invert=t,t.domain=t.range=r=>r,t.unknown=r=>(r&&(e=r),e),t.copy=()=>{let r=zp();return r.unknown(e),r},t}function Up(e){return!(e?.type==="tileset"||e.providerId==="databricks")}var Jw=new Intl.DateTimeFormat("en-US",{year:"2-digit",month:"numeric",day:"numeric",hour:"numeric",minute:"numeric",second:"numeric",timeZone:"UTC"});function e8(e){return Jw.format(new Date(e))}function t8(e){return String(Math.floor(new Date(e).getTime()/1e3))}function Cl(e){let t=Math.pow(10,e);if(e<0){let r=Math.pow(10,-e);return Math.round(t*r)/r}return t}function qp({min:e,max:t,steps:r}){if(e===0){if(t===1/0)return[...Array(r-1)].map((a,s)=>Cl(s+1));let n=Math.log10(t),o=Math.ceil(n)-r+1;return[...Array(r-1)].map((a,s)=>Cl(o+s))}else{let n=Math.log10(e),i=Math.ceil(n)===n?n+1:Math.ceil(n);return[...Array(r-1)].map((o,a)=>Cl(i+a))}}var Gp={linear:gr,ordinal:cr,log:fi,point:Ys,quantile:ci,quantize:ui,sqrt:bl,custom:mr,identity:zp};function r8(e){return e}var af=e=>{let{r:t,g:r,b:n}=of(e);return[t,r,n]},n8=e=>{let[t,r,n]=e,i=t.toString(16).padStart(2,"0"),o=r.toString(16).padStart(2,"0"),a=n.toString(16).padStart(2,"0");return`#${i}${o}${a}`.toUpperCase()},i8="#868d91",o8=af(i8),P0={getFillColor:"opacity",getLineColor:"strokeOpacity",getTextColor:"opacity"},a8=e=>{let{r:t,g:r,b:n,opacity:i}=of(e);return[t,r,n,255*i]},s8={color:"getFillColor",isVisible:"visible",label:"cartoLabel",textLabel:{alignment:"getTextAlignmentBaseline",anchor:"getTextAnchor",color:"getTextColor",size:"getTextSize"},visConfig:{enable3d:"extruded",elevationScale:"elevationScale",filled:"filled",strokeColor:"getLineColor",stroked:"stroked",thickness:"getLineWidth",radius:"getPointRadius",wireframe:"wireframe"}},l8={isVisible:"visible",visConfig:{opacity:"opacity"}},f8={color:"getIconColor",visConfig:{radius:"getIconSize"}},c8={visConfig:{colorRange:e=>({colorRange:e.colors.map(a8)}),radius:e=>({radiusPixels:20+e}),opacity:"opacity"}},u8={lineMiterLimit:2,lineWidthUnits:"pixels",pointRadiusUnits:"pixels",rounded:!0,wrapLongitude:!1};function F0(e={},t={}){return{...e,...t,visConfig:{...e.visConfig,...t.visConfig}}}var d8=["geojson","grid","heatmap","hexagon","hexagonId","point"],k0=0,h8=64,p8=new Intl.NumberFormat("en-US",{maximumFractionDigits:2,notation:"compact"});function g8(e,t,r){if(d8.includes(e))throw new Error(`Outdated layer type: ${e}. Please open map in CARTO Builder to automatically migrate.`);if(e==="raster")return{propMap:l8,defaultProps:{}};let n=s8;t.visConfig?.customMarkers&&(n=F0(n,f8)),e==="heatmapTile"&&(n=F0(n,c8));let{aggregationExp:i,aggregationResLevel:o}=r;return{propMap:n,defaultProps:{...u8,...i&&{aggregationExp:i},...o&&{aggregationResLevel:o},uniqueIdProperty:"geoid"}}}function m8(e,t,r){if(t==="ordinal"||t==="point")return e.categories?e.categories.map(i=>i.category).filter(i=>i!=null).slice(0,r):[0,1];if(t==="quantile"&&e.quantiles){let i="global"in e.quantiles?e.quantiles.global:e.quantiles;if(r===2&&!i[2]&&i[4]?.length===5)return[i[4][0],i[4][2],i[4][4]];if(i[r])return i[r]}let{min:n}=e;return t==="log"&&n===0&&(n=1e-5),[n??0,e.max??1]}function Vp(e,t,r,n){if(e.tilestats){let{attributes:i}=e.tilestats.layers[0],o=i.find(a=>a.attribute===t);if(o)return m8(o,r,n)}return[0,1]}function Aa(e,t){return t.features||t.tilestats||t.raster_metadata?(r,n)=>{if(r)return e(r.properties||r.__source.object.properties);let{data:i,index:o}=n,a=Qw(i,o);return e(a)}:e}function $p(e){return e!==void 0?Math.round(255*Math.pow(e,1/2.2)):255}function Hp(e,t){let r=[e];return t&&(r=r.concat([t,t.toUpperCase()].map(n=>`${e}_${n}`))),r}function jp(e,t){for(let r of e)if(r in t)return[r];return e}function L0({name:e,colorColumn:t},r,{aggregation:n,range:i},o,a){let{scale:s,domain:f}=b8(t||e,t?"identity":r,i,a),l=$p(o),c=Hp(t||e,n);return{accessor:Aa(d=>{c[0]in d||(c=jp(c,d));let h=d[c[0]],g=s(h);return[...typeof g=="string"?af(g):g,h===null?0:l]},a),scaleDomain:s.domain(),domain:f,range:(s.range()||[]).map(n8)}}function b8(e,t,r,n){let i,o=[],{colors:a}=r,s=Vp(n,e,t,a.length);if(t!=="identity")if(r.colorMap){let{colorMap:f}=r;i=[],f.forEach(([l,c])=>{i.push(l),o.push(c)})}else if(t==="custom"&&r.uiCustomScaleType==="logarithmic"){let[f,l]=s;i=qp({min:f,max:l,steps:a.length}),o=a}else o=a;return{scale:Zp(t,i||s,o.map(af),o8),domain:s}}function Zp(e,t,r,n){let i=Gp[e]();return i.domain(t),i.range(r),i.unknown(n),i}var y8="data:image/svg+xml;charset=utf-8;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMTAwIDEwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCiAgPGNpcmNsZSBjeD0iNTAiIGN5PSI1MCIgcj0iNTAiLz4NCjwvc3ZnPg==";function x8(e,t,{fallbackUrl:r,maxIconSize:n,useMaskedIcons:i},o){let a=u=>({id:`${u}@@${n}`,url:u,width:n,height:n,mask:i}),s=r||y8;t?.othersMarker&&(s=t.othersMarker);let f=a(s);if(!t||!e)return()=>f;let l={};for(let{value:u,markerUrl:d}of t.markerMap)d&&(l[u]=a(d));return Aa(u=>{let d=u[e.name];return l[d]||f},o)}function v8(e,t){let{radiusRange:r,radius:n}=e,{radiusField:i,sizeField:o}=t;return Math.ceil(r&&(i||o)?r[1]:n)}function w8(e){return typeof e=="function"?(t,r)=>-e(t,r):-e}function pi({name:e},t,r,n,i){let o=t?Gp[t]():r8,a=[];t&&n&&(r!==De.Count?(a=Vp(i,e,t),o.domain(a)):a=o.domain(),o.range(n));let s=Hp(e,r);return{accessor:Aa(l=>{s[0]in l||(s=jp(s,l));let c=l[s[0]];return o(c)},i),domain:a,scaleDomain:a,range:n}}var M0={date:e8,integer:Et("i"),float:Et(".5f"),timestamp:t8,default:String};function I0({name:e,type:t},r){let n=M0[t]||M0.default;return Aa(o=>n(o[e]),r)}function R0(e,t,r,n){let{min:i,max:o}=t[n],a=e[n];if(i===o)return r[1];let s=(a-i)/(o-i);return r[0]+s*(r[1]-r[0])}function _8(e,t,r){return r&&e==="clusterTile"?E8(S8(r),"count",t):wp}function E8(e,t,r){let n=`${e}_${t}`;return r==="snowflake"?n.toUpperCase():n}function S8(e){return e?e[0].name:""}function T8(e){return e>=80||e>=72?24:e>=56?20:e>=40?16:e>=24?13:(e>=8,11)}var C8=[134,141,145],A8=["red","green","blue"];function Wp(e){return e==="nan"?t=>!isNaN(t):(typeof e=="string"&&(e=parseFloat(e)),typeof e=="number"?t=>t!==e&&!isNaN(t):()=>!0)}function sf(e){return t=>!t||!("data"in t)||!t?.data?.cells?.numericProps?t:e(t)}function P8(e,t){let r=Wp(t),n=Object.entries(e).map(([a,{value:s}])=>({bandName:a,values:s,copied:!1})),i=n[0].values.length;for(let a=0;a<i;a++){let s=!1;for(let f=0;f<n.length;f++)s=s||r(n[f].values[a]);if(!s)for(let f=0;f<n.length;f++)n[f].copied||(n[f].copied=!0,n[f].values=Array.from(n[f].values)),n[f].values[a]=NaN}return n.reduce((a,{bandName:s,values:f})=>(a[s]=f,a),{})}function F8({colorBand:e,rasterMetadata:t,usedSymbols:r}){if(!e||!e.type||e.type==="none")return;let n=e?.type==="expression"?e.value:void 0,i=n?Bp(n):void 0;return sf(a=>{let s=a.data;if(n&&a.customExpressionResults?.[n])return a;let f=a.expressionEvalContext;if(!f){let c=r.reduce((u,d)=>(u[d]=s.cells.numericProps[d],u),{});f=P8(c,t.nodata),a={...a,expressionEvalContext:f}}if(!i||!n)return a;let l=i(f);return{...a,customExpressionResults:{...a.customExpressionResults,[n]:l}}})}function k8(e){let t=e.filter(r=>r);if(t.length!==0)return t.length===1?t[0]:r=>t.reduce((n,i)=>i(n),r)}function L8({bandDefs:e,attribute:t}){return sf(r=>{let n=r.length,i=l=>l?.type==="expression"?r.customExpressionResults?.[l.value]:l?.type==="band"?r.expressionEvalContext?.[l.value]:0,o=i(e.red),a=i(e.green),s=i(e.blue),f=new Uint8Array(n*4);for(let l=0,c=0;l<n;l++,c+=4){let u=typeof o=="number"?o:o?o[l]:NaN,d=typeof a=="number"?a:a?a[l]:NaN,h=typeof s=="number"?s:s?s[l]:NaN;isNaN(u)&&isNaN(d)&&isNaN(h)?ca(f,c,0,0,0,0):ca(f,c,u,d,h,255)}return r.customExpressionResults=void 0,r.expressionEvalContext=void 0,{...r,attributes:{[t]:f}}})}function M8(e){return Array.from(e.reduce((t,r)=>(r.type==="expression"&&(Bp(r.value)?.symbols||[]).forEach(i=>t.add(i)),r.type==="band"&&t.add(r.value),t),new Set))}function I8({layerConfig:e,rasterMetadata:t,visualChannels:r}){let{visConfig:n}=e,{colorBands:i}=n,o={red:i?.find(c=>c.band==="red"),green:i?.find(c=>c.band==="green"),blue:i?.find(c=>c.band==="blue")},a=L8({bandDefs:o,attribute:"instanceFillColors"}),s=i?M8(i):[],f=A8.map(c=>F8({colorBand:o[c],rasterMetadata:t,usedSymbols:s}));return{dataTransform:k8([...f,a]),updateTriggers:Yp({layerConfig:e,visualChannels:r})}}function R8({bandName:e,scaleFun:t,nodata:r,attribute:n}){let i=Wp(r);return sf(o=>{let a=o.length,s=o.data.cells.numericProps[e].value,f=new Uint8Array(a*4);for(let l=0;l<a;l++){let c=s[l];if(!i(c))ca(f,l*4,0,0,0,0);else{let u=t(c);ca(f,l*4,u[0],u[1],u[2],255)}}return{...o,attributes:{[n]:f}}})}function B8(e,t,r){if(t==="ordinal")return r.colorMap?.map(([n])=>n)||[];if(t==="quantile"){let n=r.colors.length,i=e.stats.quantiles?.[n];return i?[e.stats.min,...i,e.stats.max]:[0,1]}return[e.stats.min,e.stats.max]}function O8({layerConfig:e,rasterMetadata:t,visualChannels:r}){let{visConfig:n}=e,{colorField:i}=r,{rasterStyleType:o}=n,a=o==="ColorRange"?n.colorRange:n.uniqueValuesColorRange,s=o==="ColorRange"?r.colorScale:"ordinal",f=t.bands.find(h=>h.name===i?.name);if(!i?.name||!s||!a||!f)return{};let l=B8(f,s,a),c=l;s==="custom"&&(a.uiCustomScaleType==="logarithmic"?c=qp({min:f.stats.min,max:f.stats.max,steps:a.colors.length}):c=a.colorMap?.map(([h])=>h)||[]);let u=Zp(s,c,a.colors.map(D8),C8);return{dataTransform:R8({bandName:f.name,scaleFun:u,nodata:f?.nodata??t.nodata,attribute:"instanceFillColors"}),updateTriggers:Yp({layerConfig:e,visualChannels:r}),domain:l,scaleDomain:u.domain(),range:a.colors,type:s,field:i}}function Yp({layerConfig:e,visualChannels:t}){let{visConfig:r}=e,{rasterStyleType:n}=r,i={rasterStyleType:n};return n==="ColorRange"?(i.colorRange=r.colorRange?.colors,i.colorMap=r.colorRange?.colorMap,i.colorScale=t.colorScale,i.colorFieldId=t.colorField?.name):n==="UniqueValues"?(i.colorMap=r.uniqueValuesColorRange?.colorMap,i.colorFieldId=t.colorField?.name):n==="Rgb"&&(i.colorBands=r.colorBands),{getFillColor:i}}function ca(e,t,r,n,i,o){e[t+0]=r,e[t+1]=n,e[t+2]=i,e[t+3]=o}function D8(e){let t=parseInt(e.slice(1,3),16),r=parseInt(e.slice(3,5),16),n=parseInt(e.slice(5,7),16);return[t,r,n]}function N8({mapConfig:e,layer:t,dataset:r}){let{filters:n,visState:i}=e,{layerBlending:o,interactionConfig:a}=i,{id:s,type:f,config:l,visualChannels:c}=t,{data:u,id:d}=r,{propMap:h,defaultProps:g}=g8(f,l,r),x=q8(l,h),{channelProps:S,scales:T}=G8(s,f,l,c,u,r);return{type:f,filters:Ep(n)||Up(r)?void 0:n[d],props:{id:s,data:u,...g,...U8(a),...x,...S,...z8(o,x.parameters||{}),...V8(u.accessToken)},scales:T}}function B0(e){let{keplerMapConfig:t,datasets:r,token:n}=e;Q(t.version==="v1","Only support Kepler v1");let i=t.config,{mapState:o,mapStyle:a,popupSettings:s,legendSettings:f,visState:l}=i,{layers:c}=l,u=[...c].reverse();return{id:e.id,title:e.title,description:e.description,createdAt:e.createdAt,updatedAt:e.updatedAt,initialViewState:o,mapStyle:a,popupSettings:s,legendSettings:f,token:n,layers:u.map(d=>{try{let{dataId:h}=d.config,g=r.find(S=>S.id===h);return Q(g,`No dataset matching dataId: ${h}`),N8({mapConfig:i,layer:d,dataset:g})}catch(h){console.error(h.message);return}})}}function z8(e,t){return e==="additive"?(t.blendColorSrcFactor=t.blendAlphaSrcFactor="src-alpha",t.blendColorDstFactor=t.blendAlphaDstFactor="dst-alpha",t.blendColorOperation=t.blendAlphaOperation="add"):e==="subtractive"&&(t.blendColorSrcFactor="one",t.blendColorDstFactor="one-minus-dst-color",t.blendAlphaSrcFactor="src-alpha",t.blendAlphaDstFactor="dst-alpha",t.blendColorOperation="subtract",t.blendAlphaOperation="add"),Object.keys(t).length?{parameters:t}:{}}function U8(e){let t=e&&e.tooltip.enabled;return{autoHighlight:t,pickable:t}}function Kp(e,t,r){for(let n in r){let i=e[n],o=r[n];if(i!==void 0)if(typeof o=="string")t[o]=i;else if(typeof o=="function"){let[a,s]=Object.entries(o(i))[0];t[a]=s}else typeof o=="object"&&Kp(i,t,o)}}function q8(e,t){let r={};Kp(e,r,t),r.stroked&&!r.getLineColor&&(r.getLineColor=r.getFillColor);for(let n in P0)if(Array.isArray(r[n])){let i=[...r[n]],o=P0[n],a=e.visConfig[o];i[3]=$p(a),r[n]=i}return r.highlightColor=e.visConfig.enable3d?[255,255,255,60]:[252,242,26,255],r}function G8(e,t,r,n,i,o){if(t==="raster"){let u=i.raster_metadata;if(!u)return{channelProps:{},scales:{}};if(r.visConfig.rasterStyleType==="Rgb")return{channelProps:I8({layerConfig:r,rasterMetadata:u,visualChannels:n}),scales:{fillColor:{type:"identity"}}};{let{dataTransform:h,updateTriggers:g,...x}=O8({layerConfig:r,visualChannels:n,rasterMetadata:u});return{channelProps:{dataTransform:h,updateTriggers:g},scales:{...x.type&&{fillColor:x}}}}}let{textLabel:a,visConfig:s}=r,f={},l={},c={};{let{colorField:u,colorScale:d}=n,{colorRange:h,colorAggregation:g}=s;if(u&&d&&h){let{accessor:x,...S}=L0(u,d,{aggregation:g,range:h},s.opacity,i);f.getFillColor=x,c.fillColor=l.getFillColor={field:u,type:d,...S}}else c.fillColor={}}if(t==="clusterTile"){let u=_8(t,o.providerId,i.schema);f.pointType=s.isTextVisible?"circle+text":"circle",f.clusterLevel=s.clusterLevel,f.getWeight=d=>d.properties[u],l.getWeight=u,f.getPointRadius=(d,h)=>R0(d.properties,h.data.attributes.stats,s.radiusRange,u),l.getPointRadius={aggregationExpAlias:u,radiusRange:s.radiusRange},f.textCharacterSet="auto",f.textFontFamily="Inter, sans",f.textFontSettings={sdf:!0},f.textFontWeight=600,f.getText=d=>p8.format(d.properties[u]),l.getText=u,f.getTextColor=r.textLabel[k0].color,f.textOutlineColor=[...r.textLabel[k0].outlineColor,h8],f.textOutlineWidth=5,f.textSizeUnits="pixels",f.getTextSize=(d,h)=>{let g=R0(d.properties,h.data.attributes.stats,s.radiusRange,u);return T8(g)},l.getTextSize={aggregationExpAlias:u,radiusRange:s.radiusRange}}{let u=s.radiusRange,{radiusField:d,radiusScale:h}=n;if(d&&u&&h){let{accessor:g,...x}=pi(d,h,s.radiusAggregation,u,i);f.getPointRadius=g,c.pointRadius=l.getPointRadius={field:d,type:h,...x}}}{let u=s.strokeColorRange,{strokeColorScale:d,strokeColorField:h}=n;if(h&&u&&d){let{strokeColorAggregation:g}=s,x=s.strokeOpacity!==void 0?s.strokeOpacity:1,{accessor:S,...T}=L0(h,d,{aggregation:g,range:u},x,i);f.getLineColor=S,c.lineColor=l.getLineColor={field:h,type:d,...T}}}{let{sizeField:u,sizeScale:d}=n,{sizeRange:h,sizeAggregation:g}=s;if(u&&h){let{accessor:x,...S}=pi(u,d,g,h,i);f.getLineWidth=x,c.lineWidth=l.getLineWidth={field:u,type:d||"identity",...S}}}{let{enable3d:u,heightRange:d}=s,{heightField:h,heightScale:g}=n;if(h&&d&&u){let{accessor:x,...S}=pi(h,g,s.heightAggregation,d,i);f.getElevation=x,c.elevation=l.getElevation={field:h,type:g||"identity",...S}}}{let{weightField:u}=n,{weightAggregation:d}=s;if(u&&d){let{accessor:h,...g}=pi(u,void 0,d,void 0,i);f.getWeight=h,c.weight=l.getWeight={field:u,type:"identity",...g}}}if(s.customMarkers){let u=v8(s,n),{getPointRadius:d,getFillColor:h}=f,{customMarkersUrl:g,customMarkersRange:x,filled:S}=s;if(f.pointType="icon",f.getIcon=x8(n.customMarkersField,x,{fallbackUrl:g,maxIconSize:u,useMaskedIcons:S},i),l.getIcon={customMarkersUrl:g,customMarkersRange:x,maxIconSize:u,useMaskedIcons:S},f._subLayerProps={"points-icon":{loadOptions:{image:{type:"imagebitmap"},imagebitmap:{resizeWidth:u,resizeHeight:u,resizeQuality:"high"}}}},h&&S&&(f.getIconColor=h,l.getIconColor=l.getFillColor),d&&(f.getIconSize=d,l.getIconSize=l.getPointRadius),n.rotationField){let{accessor:T}=pi(n.rotationField,void 0,null,void 0,i);f.getIconAngle=w8(T),l.getIconAngle=l.getRotationField}}else t==="tileset"&&(f.pointType="circle");if(a&&a.length&&a[0].field){let[u,d]=a,h=e;({alignment:f.getTextAlignmentBaseline,anchor:f.getTextAnchor,color:f.getTextColor,outlineColor:f.textOutlineColor,size:f.textSizeScale}=u);let{color:g,field:x,outlineColor:S,size:T}=d||{};f.getText=u.field&&I0(u.field,i);let w=x&&I0(x,i);f.pointType=`${f.pointType}+text`,f.textCharacterSet="auto",f.textFontFamily="Inter, sans",f.textFontSettings={sdf:!0},f.textFontWeight=600,f.textOutlineWidth=3,f._subLayerProps={...f._subLayerProps,"points-text":{collisionEnabled:!0,collisionGroup:h,...f.getPointRadius?{getRadius:f.getPointRadius}:{radiusScale:s.radius},...x&&{getSecondaryText:w,getSecondaryColor:g,secondarySizeScale:T,secondaryOutlineColor:S}}}}return{channelProps:{...f,updateTriggers:l},scales:c}}function V8(e){return{loadOptions:{fetch:{headers:{Authorization:`Bearer ${e}`}}}}}var $8="custom:",O0="positron";function Al(e){let{longitude:t,latitude:r,...n}=e.mapState;return{center:[t,r],...n}}async function H8({config:e,errorContext:t,applyLayerFilters:r=!0}){let{mapStyle:n}=e,i=n.styleType||O0;if(i.startsWith($8)){let a=e.customBaseMaps?.customStyle;if(a)return{type:"maplibre",props:{style:a.style||a.url,...Al(e)},attribution:a.customAttribution}}if(Ew.includes(i)){let{visibleLayerGroups:a}=n,s=$t(i),f=s,l=s;return r&&a&&Aw(a)&&(l=await Pw({styleUrl:s,errorContext:t}),f=Cw(l,a)),{type:"maplibre",props:{style:f,...Al(e)},visibleLayerGroups:a,rawStyle:l}}let o=Sw[i];if(o){let{mapState:a}=e;return{type:"google-maps",props:{...o,center:{lat:a.latitude,lng:a.longitude},zoom:a.zoom+1,tilt:a.pitch,heading:a.bearing}}}return{type:"maplibre",props:{style:$t(O0),...Al(e)}}}function j8({dataset:e,filters:t,options:r}){let{geoColumn:n,columns:i,type:o,source:a,queryParameters:s,aggregationExp:f,aggregationResLevel:l}=e,c=Z8(r),u=K8(n)||void 0,d=n?X8(n):void 0,h=W8(d),g=d==="h3",x=d==="quadbin",S=l;typeof l!="number"&&g?S=Wl:typeof l!="number"&&x&&(S=Yl);let T={aggregationExp:f||T2,aggregationResLevel:Y8(S,h),spatialDataColumn:u,...t&&{filters:t}},w={...c,tableName:a},k={...c,tableName:a,tileResolution:h},M={...c,sqlQuery:a,tileResolution:h,...s&&{queryParameters:s}},L={spatialDataColumn:u,...i&&{columns:i},...t&&{filters:t},...f&&{aggregationExp:f}};if(o==="raster")return wa({...c,tableName:a,...t&&{filters:t}});if(o==="tileset")return Sa({...w});if(o==="table")return g?ba({...k,...T}):x?va({...k,...T}):Ea({...k,...L});if(o==="query")return g?ma({...M,...T}):x?xa({...M,...T}):_a({...M,...L});throw new Error(`Invalid source type: ${o}`)}function Z8({accessToken:e,apiBaseUrl:t,connection:r,headers:n,maxLengthURL:i,tags:o}){return{accessToken:e,connectionName:r,apiBaseUrl:t,headers:n,maxLengthURL:i,...n?.["Cache-Control"]?.includes("no-cache")&&{localCache:{cacheControl:["no-cache"]}},tags:o}}function W8(e){return e!=="h3"?S2:rn}function Y8(e,t){if(typeof e=="number")return e-Math.log2(.5/t)}function K8(e){if(!e)return e;let t=e.split(":");return t.length===1?t[0]:t.length===2?t[1]:null}function X8(e){let t=e.split(":")[0];for(let r of Object.values(q0))if(vx[r].includes(t))return r;return null}async function Q8(e,t,r){let{connectionName:n}=e,i={},o=j8({dataset:e,filters:!Ep(t)&&Up(e)?t:void 0,options:{...r,connection:n,headers:r.headers,accessToken:r.accessToken,apiBaseUrl:r.apiBaseUrl,maxLengthURL:r.maxLengthURL,...r.mapId&&{tags:{[U0.mapId]:r.mapId}}}});e.data=await o;let a=!0;return i.value&&(a=e.cache!==i.value,e.cache=i.value),a}async function J8(e,t,r){let{connectionName:n,data:i,id:o,source:a,type:s,queryParameters:f}=t,{apiBaseUrl:l}=r,c={requestType:"Tile stats",connection:n,type:s,source:a};if(!("tilestats"in i))throw new Er(new Error(`Invalid dataset for tilestats: ${o}`),c);let u=D2({attribute:e,apiBaseUrl:l,...t}),d=new URLSearchParams(i.tiles[0]).get("client"),h={Authorization:`Bearer ${r.accessToken}`},g={};d&&(g.client=d),r.mapId&&(g[U0.mapId]=r.mapId),s==="query"&&(g.q=a,f&&(g.queryParameters=f));let x=await tn({baseUrl:u,headers:h,parameters:g,errorContext:c,maxLengthURL:r.maxLengthURL}),{attributes:S}=i.tilestats.layers[0],T=S.findIndex(w=>w.attribute===e);return S[T]=x,!0}async function D0({datasets:e,keplerMapConfig:t},r){let{filters:n}=t.config,i=e.map(o=>Q8(o,n[o.id],r));return await Promise.all(i)}async function e6({datasets:e,keplerMapConfig:t},r){let n=[],{layers:i}=t.config.visState;for(let s of i)for(let f of Object.keys(s.visualChannels)){let l=s.visualChannels[f]?.name;if(l){let c=e.find(u=>u.id===s.config.dataId);c&&c.type!=="tileset"&&c.data.tilestats&&n.push({attribute:l,dataset:c})}}let o=[];for(let s of n)o.find(({attribute:f,dataset:l})=>f===s.attribute&&l===s.dataset)||o.push(s);let a=o.map(({attribute:s,dataset:f})=>J8(s,f,r));return await Promise.all(a)}async function Xp({accessToken:e,apiBaseUrl:t=Vl,cartoMapId:r,clientId:n,headers:i,autoRefresh:o,onNewData:a,maxLengthURL:s}){Q(r,'Must define CARTO map id: fetchMap({cartoMapId: "XXXX-XXXX-XXXX"})'),e&&(i={Authorization:`Bearer ${e}`,...i}),(o||a)&&(Q(a,"Must define `onNewData` when using autoRefresh"),Q(typeof a=="function","`onNewData` must be a function"),Q(typeof o=="number"&&o>0,"`autoRefresh` must be a positive number"));let f=O2({apiBaseUrl:t,cartoMapId:r}),l={requestType:"Public map",mapId:r},c=await tn({baseUrl:f,headers:i,errorContext:l,maxLengthURL:s}),u={mapId:r,accessToken:c.token||e,apiBaseUrl:t,clientId:n,headers:i,maxLengthURL:s},d;if(o){let w=setInterval(async()=>{let k=await D0(c,{...u,headers:{...i,"If-Modified-Since":new Date().toUTCString()}});a&&k.some(M=>M===!0)&&a(B0(c))},o*1e3);d=()=>{clearInterval(w)}}let h=c.keplerMapConfig.config.visState.layers.filter(({type:w})=>w==="geojson"||w==="point"),g=h.map(({config:w})=>w.dataId);c.datasets.forEach(w=>{if(g.includes(w.id)){let{config:k}=h.find(({config:M})=>M.dataId===w.id);w.format="geojson",!w.geoColumn&&k.columns.geojson&&(w.geoColumn=k.columns.geojson)}});let[x]=await Promise.all([H8({config:c.keplerMapConfig.config,errorContext:l}),D0(c,u)]);await e6(c,u);let S={...B0(c),basemap:x,stopAutoRefresh:d};return S.layers.filter(w=>(w.props?.pointType||"").includes("text")).length&&typeof window<"u"&&typeof document<"u"&&window.FontFace&&document.fonts&&!document.fonts.check("12px Inter")&&await new FontFace("Inter","url(https://fonts.gstatic.com/s/inter/v12/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7W0Q5nw.woff2)").load().then(k=>document.fonts.add(k)),S}var CC=2**32-1;var r6="https://basemaps.cartocdn.com/gl/{basemap}-gl-style/style.json",Qp=["positron","dark-matter","voyager"],Pa={roadmap:{mapTypeId:"roadmap",mapId:"3754c817b510f791"},"google-positron":{mapTypeId:"roadmap",mapId:"ea84ae4203ef21cd"},"google-dark-matter":{mapTypeId:"roadmap",mapId:"2fccc3b36c22a0e2"},"google-voyager":{mapTypeId:"roadmap",mapId:"885caf1e15bb9ef2"},satellite:{mapTypeId:"satellite"},hybrid:{mapTypeId:"hybrid"},terrain:{mapTypeId:"terrain"}},lf=[{slug:"label",filter:({id:e})=>!!e.match(/(?=(label|_label|place-|place_|poi-|poi_|watername_|roadname_|housenumber))/),defaultVisibility:!0},{slug:"road",filter:({id:e})=>!!e.match(/(?=(road|railway|tunnel|street|bridge))(?!.*label)/),defaultVisibility:!0},{slug:"border",filter:({id:e})=>!!e.match(/border|boundaries|boundary_/),defaultVisibility:!1},{slug:"building",filter:({id:e})=>!!e.match(/building/),defaultVisibility:!0},{slug:"water",filter:({id:e})=>!!e.match(/(?=(water|stream|ferry))/),defaultVisibility:!0},{slug:"land",filter:({id:e})=>!!e.match(/(?=(parks|landcover|industrial|sand|hillshade|park_))/),defaultVisibility:!0}];function Fa(e,t){if(!Array.isArray(e?.layers))return e;let r=lf.filter(i=>!t[i.slug]).map(i=>i.filter),n=e.layers.filter(i=>r.every(o=>!o(i)));return{...e,layers:n}}function Jp(e){return e&&Object.values(e).every(Boolean)===!1}function Ye(e){return r6.replace("{basemap}",e)}async function ka({styleUrl:e,errorContext:t}){let r;return await fetch(e,{mode:"cors"}).then(n=>(r=n,n.json())).catch(n=>{throw new Er(n,{...t,requestType:"Basemap style"},r)})}var eg={VOYAGER:Ye("voyager"),POSITRON:Ye("positron"),DARK_MATTER:Ye("dark-matter"),VOYAGER_NOLABELS:Ye("voyager-nolabels"),POSITRON_NOLABELS:Ye("positron-nolabels"),DARK_MATTER_NOLABELS:Ye("dark-matter-nolabels")};var ff={};Ra(ff,{Antique:()=>M6,ArmyRose:()=>T6,BluGrn:()=>u6,BluYl:()=>g6,Bold:()=>I6,BrwnYl:()=>S6,Burg:()=>i6,BurgYl:()=>o6,DarkMint:()=>d6,Earth:()=>L6,Emrld:()=>h6,Fall:()=>C6,Geyser:()=>A6,Magenta:()=>w6,Mint:()=>c6,OrYel:()=>s6,Pastel:()=>R6,Peach:()=>l6,PinkYl:()=>f6,Prism:()=>B6,Purp:()=>y6,PurpOr:()=>x6,RedOr:()=>a6,Safe:()=>O6,Sunset:()=>v6,SunsetDark:()=>_6,Teal:()=>m6,TealGrn:()=>b6,TealRose:()=>F6,Temps:()=>P6,Tropic:()=>k6,Vivid:()=>D6,ag_GrnYl:()=>p6,ag_Sunset:()=>E6,cb_Accent:()=>K6,cb_Blues:()=>i_,cb_BrBG:()=>c_,cb_BuGn:()=>N6,cb_BuPu:()=>z6,cb_Dark2:()=>X6,cb_GnBu:()=>U6,cb_Greens:()=>o_,cb_Greys:()=>a_,cb_OrRd:()=>q6,cb_Oranges:()=>s_,cb_PRGn:()=>d_,cb_Paired:()=>Q6,cb_Pastel1:()=>J6,cb_Pastel2:()=>e_,cb_PiYG:()=>u_,cb_PuBu:()=>G6,cb_PuBuGn:()=>V6,cb_PuOr:()=>h_,cb_PuRd:()=>$6,cb_Purples:()=>l_,cb_RdBu:()=>p_,cb_RdGy:()=>g_,cb_RdPu:()=>H6,cb_RdYlBu:()=>m_,cb_RdYlGn:()=>b_,cb_Reds:()=>f_,cb_Set1:()=>t_,cb_Set2:()=>r_,cb_Set3:()=>n_,cb_Spectral:()=>y_,cb_YlGn:()=>j6,cb_YlGnBu:()=>Z6,cb_YlOrBr:()=>W6,cb_YlOrRd:()=>Y6});var n6={schemeGroups:{sequential:["BuGn","BuPu","GnBu","OrRd","PuBu","PuBuGn","PuRd","RdPu","YlGn","YlGnBu","YlOrBr","YlOrRd"],singlehue:["Blues","Greens","Greys","Oranges","Purples","Reds"],diverging:["BrBG","PiYG","PRGn","PuOr","RdBu","RdGy","RdYlBu","RdYlGn","Spectral"],qualitative:["Accent","Dark2","Paired","Pastel1","Pastel2","Set1","Set2","Set3"]},YlGn:{3:["#f7fcb9","#addd8e","#31a354"],4:["#ffffcc","#c2e699","#78c679","#238443"],5:["#ffffcc","#c2e699","#78c679","#31a354","#006837"],6:["#ffffcc","#d9f0a3","#addd8e","#78c679","#31a354","#006837"],7:["#ffffcc","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],8:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#005a32"],9:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"]},YlGnBu:{3:["#edf8b1","#7fcdbb","#2c7fb8"],4:["#ffffcc","#a1dab4","#41b6c4","#225ea8"],5:["#ffffcc","#a1dab4","#41b6c4","#2c7fb8","#253494"],6:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#2c7fb8","#253494"],7:["#ffffcc","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],8:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#0c2c84"],9:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"]},GnBu:{3:["#e0f3db","#a8ddb5","#43a2ca"],4:["#f0f9e8","#bae4bc","#7bccc4","#2b8cbe"],5:["#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac"],6:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#43a2ca","#0868ac"],7:["#f0f9e8","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],8:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#08589e"],9:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"]},BuGn:{3:["#e5f5f9","#99d8c9","#2ca25f"],4:["#edf8fb","#b2e2e2","#66c2a4","#238b45"],5:["#edf8fb","#b2e2e2","#66c2a4","#2ca25f","#006d2c"],6:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#2ca25f","#006d2c"],7:["#edf8fb","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],8:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#005824"],9:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"]},PuBuGn:{3:["#ece2f0","#a6bddb","#1c9099"],4:["#f6eff7","#bdc9e1","#67a9cf","#02818a"],5:["#f6eff7","#bdc9e1","#67a9cf","#1c9099","#016c59"],6:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#1c9099","#016c59"],7:["#f6eff7","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],8:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016450"],9:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"]},PuBu:{3:["#ece7f2","#a6bddb","#2b8cbe"],4:["#f1eef6","#bdc9e1","#74a9cf","#0570b0"],5:["#f1eef6","#bdc9e1","#74a9cf","#2b8cbe","#045a8d"],6:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#2b8cbe","#045a8d"],7:["#f1eef6","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],8:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#034e7b"],9:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"]},BuPu:{3:["#e0ecf4","#9ebcda","#8856a7"],4:["#edf8fb","#b3cde3","#8c96c6","#88419d"],5:["#edf8fb","#b3cde3","#8c96c6","#8856a7","#810f7c"],6:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8856a7","#810f7c"],7:["#edf8fb","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],8:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#6e016b"],9:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"]},RdPu:{3:["#fde0dd","#fa9fb5","#c51b8a"],4:["#feebe2","#fbb4b9","#f768a1","#ae017e"],5:["#feebe2","#fbb4b9","#f768a1","#c51b8a","#7a0177"],6:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#c51b8a","#7a0177"],7:["#feebe2","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],8:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177"],9:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"]},PuRd:{3:["#e7e1ef","#c994c7","#dd1c77"],4:["#f1eef6","#d7b5d8","#df65b0","#ce1256"],5:["#f1eef6","#d7b5d8","#df65b0","#dd1c77","#980043"],6:["#f1eef6","#d4b9da","#c994c7","#df65b0","#dd1c77","#980043"],7:["#f1eef6","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],8:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#91003f"],9:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"]},OrRd:{3:["#fee8c8","#fdbb84","#e34a33"],4:["#fef0d9","#fdcc8a","#fc8d59","#d7301f"],5:["#fef0d9","#fdcc8a","#fc8d59","#e34a33","#b30000"],6:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#e34a33","#b30000"],7:["#fef0d9","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],8:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#990000"],9:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"]},YlOrRd:{3:["#ffeda0","#feb24c","#f03b20"],4:["#ffffb2","#fecc5c","#fd8d3c","#e31a1c"],5:["#ffffb2","#fecc5c","#fd8d3c","#f03b20","#bd0026"],6:["#ffffb2","#fed976","#feb24c","#fd8d3c","#f03b20","#bd0026"],7:["#ffffb2","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],8:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#b10026"],9:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"]},YlOrBr:{3:["#fff7bc","#fec44f","#d95f0e"],4:["#ffffd4","#fed98e","#fe9929","#cc4c02"],5:["#ffffd4","#fed98e","#fe9929","#d95f0e","#993404"],6:["#ffffd4","#fee391","#fec44f","#fe9929","#d95f0e","#993404"],7:["#ffffd4","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],8:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#8c2d04"],9:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"]},Purples:{3:["#efedf5","#bcbddc","#756bb1"],4:["#f2f0f7","#cbc9e2","#9e9ac8","#6a51a3"],5:["#f2f0f7","#cbc9e2","#9e9ac8","#756bb1","#54278f"],6:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#756bb1","#54278f"],7:["#f2f0f7","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],8:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#4a1486"],9:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"]},Blues:{3:["#deebf7","#9ecae1","#3182bd"],4:["#eff3ff","#bdd7e7","#6baed6","#2171b5"],5:["#eff3ff","#bdd7e7","#6baed6","#3182bd","#08519c"],6:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#3182bd","#08519c"],7:["#eff3ff","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],8:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#084594"],9:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"]},Greens:{3:["#e5f5e0","#a1d99b","#31a354"],4:["#edf8e9","#bae4b3","#74c476","#238b45"],5:["#edf8e9","#bae4b3","#74c476","#31a354","#006d2c"],6:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#31a354","#006d2c"],7:["#edf8e9","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],8:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#005a32"],9:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"]},Oranges:{3:["#fee6ce","#fdae6b","#e6550d"],4:["#feedde","#fdbe85","#fd8d3c","#d94701"],5:["#feedde","#fdbe85","#fd8d3c","#e6550d","#a63603"],6:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#e6550d","#a63603"],7:["#feedde","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],8:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#8c2d04"],9:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"]},Reds:{3:["#fee0d2","#fc9272","#de2d26"],4:["#fee5d9","#fcae91","#fb6a4a","#cb181d"],5:["#fee5d9","#fcae91","#fb6a4a","#de2d26","#a50f15"],6:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#de2d26","#a50f15"],7:["#fee5d9","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],8:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#99000d"],9:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"]},Greys:{3:["#f0f0f0","#bdbdbd","#636363"],4:["#f7f7f7","#cccccc","#969696","#525252"],5:["#f7f7f7","#cccccc","#969696","#636363","#252525"],6:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#636363","#252525"],7:["#f7f7f7","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],8:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525"],9:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"]},PuOr:{3:["#f1a340","#f7f7f7","#998ec3"],4:["#e66101","#fdb863","#b2abd2","#5e3c99"],5:["#e66101","#fdb863","#f7f7f7","#b2abd2","#5e3c99"],6:["#b35806","#f1a340","#fee0b6","#d8daeb","#998ec3","#542788"],7:["#b35806","#f1a340","#fee0b6","#f7f7f7","#d8daeb","#998ec3","#542788"],8:["#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788"],9:["#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788"],10:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],11:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"]},BrBG:{3:["#d8b365","#f5f5f5","#5ab4ac"],4:["#a6611a","#dfc27d","#80cdc1","#018571"],5:["#a6611a","#dfc27d","#f5f5f5","#80cdc1","#018571"],6:["#8c510a","#d8b365","#f6e8c3","#c7eae5","#5ab4ac","#01665e"],7:["#8c510a","#d8b365","#f6e8c3","#f5f5f5","#c7eae5","#5ab4ac","#01665e"],8:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e"],9:["#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e"],10:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],11:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"]},PRGn:{3:["#af8dc3","#f7f7f7","#7fbf7b"],4:["#7b3294","#c2a5cf","#a6dba0","#008837"],5:["#7b3294","#c2a5cf","#f7f7f7","#a6dba0","#008837"],6:["#762a83","#af8dc3","#e7d4e8","#d9f0d3","#7fbf7b","#1b7837"],7:["#762a83","#af8dc3","#e7d4e8","#f7f7f7","#d9f0d3","#7fbf7b","#1b7837"],8:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837"],9:["#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837"],10:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],11:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"]},PiYG:{3:["#e9a3c9","#f7f7f7","#a1d76a"],4:["#d01c8b","#f1b6da","#b8e186","#4dac26"],5:["#d01c8b","#f1b6da","#f7f7f7","#b8e186","#4dac26"],6:["#c51b7d","#e9a3c9","#fde0ef","#e6f5d0","#a1d76a","#4d9221"],7:["#c51b7d","#e9a3c9","#fde0ef","#f7f7f7","#e6f5d0","#a1d76a","#4d9221"],8:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221"],9:["#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221"],10:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],11:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"]},RdBu:{3:["#ef8a62","#f7f7f7","#67a9cf"],4:["#ca0020","#f4a582","#92c5de","#0571b0"],5:["#ca0020","#f4a582","#f7f7f7","#92c5de","#0571b0"],6:["#b2182b","#ef8a62","#fddbc7","#d1e5f0","#67a9cf","#2166ac"],7:["#b2182b","#ef8a62","#fddbc7","#f7f7f7","#d1e5f0","#67a9cf","#2166ac"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"]},RdGy:{3:["#ef8a62","#ffffff","#999999"],4:["#ca0020","#f4a582","#bababa","#404040"],5:["#ca0020","#f4a582","#ffffff","#bababa","#404040"],6:["#b2182b","#ef8a62","#fddbc7","#e0e0e0","#999999","#4d4d4d"],7:["#b2182b","#ef8a62","#fddbc7","#ffffff","#e0e0e0","#999999","#4d4d4d"],8:["#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d"],9:["#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d"],10:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],11:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"]},RdYlBu:{3:["#fc8d59","#ffffbf","#91bfdb"],4:["#d7191c","#fdae61","#abd9e9","#2c7bb6"],5:["#d7191c","#fdae61","#ffffbf","#abd9e9","#2c7bb6"],6:["#d73027","#fc8d59","#fee090","#e0f3f8","#91bfdb","#4575b4"],7:["#d73027","#fc8d59","#fee090","#ffffbf","#e0f3f8","#91bfdb","#4575b4"],8:["#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4"],9:["#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"]},Spectral:{3:["#fc8d59","#ffffbf","#99d594"],4:["#d7191c","#fdae61","#abdda4","#2b83ba"],5:["#d7191c","#fdae61","#ffffbf","#abdda4","#2b83ba"],6:["#d53e4f","#fc8d59","#fee08b","#e6f598","#99d594","#3288bd"],7:["#d53e4f","#fc8d59","#fee08b","#ffffbf","#e6f598","#99d594","#3288bd"],8:["#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd"],9:["#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd"],10:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],11:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"]},RdYlGn:{3:["#fc8d59","#ffffbf","#91cf60"],4:["#d7191c","#fdae61","#a6d96a","#1a9641"],5:["#d7191c","#fdae61","#ffffbf","#a6d96a","#1a9641"],6:["#d73027","#fc8d59","#fee08b","#d9ef8b","#91cf60","#1a9850"],7:["#d73027","#fc8d59","#fee08b","#ffffbf","#d9ef8b","#91cf60","#1a9850"],8:["#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850"],9:["#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850"],10:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],11:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"]},Accent:{3:["#7fc97f","#beaed4","#fdc086"],4:["#7fc97f","#beaed4","#fdc086","#ffff99"],5:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0"],6:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f"],7:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17"],8:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"]},Dark2:{3:["#1b9e77","#d95f02","#7570b3"],4:["#1b9e77","#d95f02","#7570b3","#e7298a"],5:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e"],6:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02"],7:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d"],8:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"]},Paired:{3:["#a6cee3","#1f78b4","#b2df8a"],4:["#a6cee3","#1f78b4","#b2df8a","#33a02c"],5:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99"],6:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c"],7:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f"],8:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00"],9:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6"],10:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a"],11:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99"],12:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"]},Pastel1:{3:["#fbb4ae","#b3cde3","#ccebc5"],4:["#fbb4ae","#b3cde3","#ccebc5","#decbe4"],5:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6"],6:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc"],7:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd"],8:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec"],9:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},Pastel2:{3:["#b3e2cd","#fdcdac","#cbd5e8"],4:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4"],5:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9"],6:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae"],7:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc"],8:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"]},Set1:{3:["#e41a1c","#377eb8","#4daf4a"],4:["#e41a1c","#377eb8","#4daf4a","#984ea3"],5:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"],6:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33"],7:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628"],8:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf"],9:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"]},Set2:{3:["#66c2a5","#fc8d62","#8da0cb"],4:["#66c2a5","#fc8d62","#8da0cb","#e78ac3"],5:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854"],6:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f"],7:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494"],8:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"]},Set3:{3:["#8dd3c7","#ffffb3","#bebada"],4:["#8dd3c7","#ffffb3","#bebada","#fb8072"],5:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3"],6:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462"],7:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69"],8:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5"],9:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9"],10:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd"],11:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5"],12:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"]}},G=n6;var i6={2:["#ffc6c4","#672044"],3:["#ffc6c4","#cc607d","#672044"],4:["#ffc6c4","#e38191","#ad466c","#672044"],5:["#ffc6c4","#ee919b","#cc607d","#9e3963","#672044"],6:["#ffc6c4","#f29ca3","#da7489","#b95073","#93345d","#672044"],7:["#ffc6c4","#f4a3a8","#e38191","#cc607d","#ad466c","#8b3058","#672044"],tags:["quantitative"]},o6={2:["#fbe6c5","#70284a"],3:["#fbe6c5","#dc7176","#70284a"],4:["#fbe6c5","#ee8a82","#c8586c","#70284a"],5:["#fbe6c5","#f2a28a","#dc7176","#b24b65","#70284a"],6:["#fbe6c5","#f4b191","#e7807d","#d06270","#a44360","#70284a"],7:["#fbe6c5","#f5ba98","#ee8a82","#dc7176","#c8586c","#9c3f5d","#70284a"],tags:["quantitative"]},a6={2:["#f6d2a9","#b13f64"],3:["#f6d2a9","#ea8171","#b13f64"],4:["#f6d2a9","#f19c7c","#dd686c","#b13f64"],5:["#f6d2a9","#f3aa84","#ea8171","#d55d6a","#b13f64"],6:["#f6d2a9","#f4b28a","#ef9177","#e3726d","#cf5669","#b13f64"],7:["#f6d2a9","#f5b78e","#f19c7c","#ea8171","#dd686c","#ca5268","#b13f64"],tags:["quantitative"]},s6={2:["#ecda9a","#ee4d5a"],3:["#ecda9a","#f7945d","#ee4d5a"],4:["#ecda9a","#f3ad6a","#f97b57","#ee4d5a"],5:["#ecda9a","#f1b973","#f7945d","#f86f56","#ee4d5a"],6:["#ecda9a","#f0c079","#f5a363","#f98558","#f76856","#ee4d5a"],7:["#ecda9a","#efc47e","#f3ad6a","#f7945d","#f97b57","#f66356","#ee4d5a"],tags:["quantitative"]},l6={2:["#fde0c5","#eb4a40"],3:["#fde0c5","#f59e72","#eb4a40"],4:["#fde0c5","#f8b58b","#f2855d","#eb4a40"],5:["#fde0c5","#f9c098","#f59e72","#f17854","#eb4a40"],6:["#fde0c5","#fac7a1","#f7ac80","#f38f65","#f0704f","#eb4a40"],7:["#fde0c5","#facba6","#f8b58b","#f59e72","#f2855d","#ef6a4c","#eb4a40"],tags:["quantitative"]},f6={2:["#fef6b5","#e15383"],3:["#fef6b5","#ffa679","#e15383"],4:["#fef6b5","#ffc285","#fa8a76","#e15383"],5:["#fef6b5","#ffd08e","#ffa679","#f67b77","#e15383"],6:["#fef6b5","#ffd795","#ffb77f","#fd9576","#f37378","#e15383"],7:["#fef6b5","#ffdd9a","#ffc285","#ffa679","#fa8a76","#f16d7a","#e15383"],tags:["quantitative"]},c6={2:["#e4f1e1","#0d585f"],3:["#e4f1e1","#63a6a0","#0d585f"],4:["#e4f1e1","#89c0b6","#448c8a","#0d585f"],5:["#E4F1E1","#9CCDC1","#63A6A0","#337F7F","#0D585F"],6:["#e4f1e1","#abd4c7","#7ab5ad","#509693","#2c7778","#0d585f"],7:["#e4f1e1","#b4d9cc","#89c0b6","#63a6a0","#448c8a","#287274","#0d585f"],tags:["quantitative"]},u6={2:["#c4e6c3","#1d4f60"],3:["#c4e6c3","#4da284","#1d4f60"],4:["#c4e6c3","#6dbc90","#36877a","#1d4f60"],5:["#c4e6c3","#80c799","#4da284","#2d7974","#1d4f60"],6:["#c4e6c3","#8dce9f","#5fb28b","#3e927e","#297071","#1d4f60"],7:["#c4e6c3","#96d2a4","#6dbc90","#4da284","#36877a","#266b6e","#1d4f60"],tags:["quantitative"]},d6={2:["#d2fbd4","#123f5a"],3:["#d2fbd4","#559c9e","#123f5a"],4:["#d2fbd4","#7bbcb0","#3a7c89","#123f5a"],5:["#d2fbd4","#8eccb9","#559c9e","#2b6c7f","#123f5a"],6:["#d2fbd4","#9cd5be","#6cafa9","#458892","#266377","#123f5a"],7:["#d2fbd4","#a5dbc2","#7bbcb0","#559c9e","#3a7c89","#235d72","#123f5a"],tags:["quantitative"]},h6={2:["#d3f2a3","#074050"],3:["#d3f2a3","#4c9b82","#074050"],4:["#d3f2a3","#6cc08b","#217a79","#074050"],5:["#d3f2a3","#82d091","#4c9b82","#19696f","#074050"],6:["#d3f2a3","#8fda94","#60b187","#35877d","#145f69","#074050"],7:["#d3f2a3","#97e196","#6cc08b","#4c9b82","#217a79","#105965","#074050"],tags:["quantitative"]},p6={2:["#245668","#EDEF5D"],3:["#245668","#39AB7E","#EDEF5D"],4:["#245668","#0D8F81","#6EC574","#EDEF5D"],5:["#245668","#04817E","#39AB7E","#8BD16D","#EDEF5D"],6:["#245668","#09787C","#1D9A81","#58BB79","#9DD869","#EDEF5D"],7:["#245668","#0F7279","#0D8F81","#39AB7E","#6EC574","#A9DC67","#EDEF5D"],tags:["aggregation"]},g6={2:["#f7feae","#045275"],3:["#f7feae","#46aea0","#045275"],4:["#f7feae","#7ccba2","#089099","#045275"],5:["#f7feae","#9bd8a4","#46aea0","#058092","#045275"],6:["#f7feae","#ace1a4","#68bfa1","#2a9c9c","#02778e","#045275"],7:["#f7feae","#b7e6a5","#7ccba2","#46aea0","#089099","#00718b","#045275"],tags:["quantitative"]},m6={2:["#d1eeea","#2a5674"],3:["#d1eeea","#68abb8","#2a5674"],4:["#d1eeea","#85c4c9","#4f90a6","#2a5674"],5:["#d1eeea","#96d0d1","#68abb8","#45829b","#2a5674"],6:["#d1eeea","#a1d7d6","#79bbc3","#599bae","#3f7994","#2a5674"],7:["#d1eeea","#a8dbd9","#85c4c9","#68abb8","#4f90a6","#3b738f","#2a5674"],tags:["quantitative"]},b6={2:["#b0f2bc","#257d98"],3:["#b0f2bc","#4cc8a3","#257d98"],4:["#b0f2bc","#67dba5","#38b2a3","#257d98"],5:["#b0f2bc","#77e2a8","#4cc8a3","#31a6a2","#257d98"],6:["#b0f2bc","#82e6aa","#5bd4a4","#3fbba3","#2e9ea1","#257d98"],7:["#b0f2bc","#89e8ac","#67dba5","#4cc8a3","#38b2a3","#2c98a0","#257d98"],tags:["quantitative"]},y6={2:["#f3e0f7","#63589f"],3:["#f3e0f7","#b998dd","#63589f"],4:["#f3e0f7","#d1afe8","#9f82ce","#63589f"],5:["#f3e0f7","#dbbaed","#b998dd","#9178c4","#63589f"],6:["#f3e0f7","#e0c2ef","#c8a5e4","#aa8bd4","#8871be","#63589f"],7:["#f3e0f7","#e4c7f1","#d1afe8","#b998dd","#9f82ce","#826dba","#63589f"],tags:["quantitative"]},x6={2:["#f9ddda","#573b88"],3:["#f9ddda","#ce78b3","#573b88"],4:["#f9ddda","#e597b9","#ad5fad","#573b88"],5:["#f9ddda","#eda8bd","#ce78b3","#9955a8","#573b88"],6:["#f9ddda","#f0b2c1","#dd8ab6","#bb69b0","#8c4fa4","#573b88"],7:["#f9ddda","#f2b9c4","#e597b9","#ce78b3","#ad5fad","#834ba0","#573b88"],tags:["quantitative"]},v6={2:["#f3e79b","#5c53a5"],3:["#f3e79b","#eb7f86","#5c53a5"],4:["#f3e79b","#f8a07e","#ce6693","#5c53a5"],5:["#f3e79b","#fab27f","#eb7f86","#b95e9a","#5c53a5"],6:["#f3e79b","#fabc82","#f59280","#dc6f8e","#ab5b9e","#5c53a5"],7:["#f3e79b","#fac484","#f8a07e","#eb7f86","#ce6693","#a059a0","#5c53a5"],tags:["quantitative"]},w6={2:["#f3cbd3","#6c2167"],3:["#f3cbd3","#ca699d","#6c2167"],4:["#f3cbd3","#dd88ac","#b14d8e","#6c2167"],5:["#f3cbd3","#e498b4","#ca699d","#a24186","#6c2167"],6:["#f3cbd3","#e7a2b9","#d67ba5","#bc5894","#983a81","#6c2167"],7:["#f3cbd3","#eaa9bd","#dd88ac","#ca699d","#b14d8e","#91357d","#6c2167"],tags:["quantitative"]},_6={2:["#fcde9c","#7c1d6f"],3:["#fcde9c","#e34f6f","#7c1d6f"],4:["#fcde9c","#f0746e","#dc3977","#7c1d6f"],5:["#fcde9c","#f58670","#e34f6f","#d72d7c","#7c1d6f"],6:["#fcde9c","#f89872","#ec666d","#df4273","#c5287b","#7c1d6f"],7:["#fcde9c","#faa476","#f0746e","#e34f6f","#dc3977","#b9257a","#7c1d6f"],tags:["quantitative"]},E6={2:["#4b2991","#edd9a3"],3:["#4b2991","#ea4f88","#edd9a3"],4:["#4b2991","#c0369d","#fa7876","#edd9a3"],5:["#4b2991","#a52fa2","#ea4f88","#fa9074","#edd9a3"],6:["#4b2991","#932da3","#d43f96","#f7667c","#f89f77","#edd9a3"],7:["#4b2991","#872ca2","#c0369d","#ea4f88","#fa7876","#f6a97a","#edd9a3"],tags:["aggregation"]},S6={2:["#ede5cf","#541f3f"],3:["#ede5cf","#c1766f","#541f3f"],4:["#ede5cf","#d39c83","#a65461","#541f3f"],5:["#ede5cf","#daaf91","#c1766f","#95455a","#541f3f"],6:["#ede5cf","#ddba9b","#cd8c7a","#b26166","#8a3c56","#541f3f"],7:["#ede5cf","#e0c2a2","#d39c83","#c1766f","#a65461","#813753","#541f3f"],tags:["quantitative"]},T6={2:["#929b4f","#db8195"],3:["#a3ad62","#fdfbe4","#df91a3"],4:["#929b4f","#d9dbaf","#f3d1ca","#db8195"],5:["#879043","#c1c68c","#fdfbe4","#ebb4b8","#d8758b"],6:["#7f883b","#b0b874","#e3e4be","#f6ddd1","#e4a0ac","#d66d85"],7:["#798234","#a3ad62","#d0d3a2","#fdfbe4","#f0c6c3","#df91a3","#d46780"],tags:["diverging"]},C6={2:["#3d5941","#ca562c"],3:["#3d5941","#f6edbd","#ca562c"],4:["#3d5941","#b5b991","#edbb8a","#ca562c"],5:["#3d5941","#96a07c","#f6edbd","#e6a272","#ca562c"],6:["#3d5941","#839170","#cecea2","#f1cf9e","#e19464","#ca562c"],7:["#3d5941","#778868","#b5b991","#f6edbd","#edbb8a","#de8a5a","#ca562c"],tags:["diverging"]},A6={2:["#008080","#ca562c"],3:["#008080","#f6edbd","#ca562c"],4:["#008080","#b4c8a8","#edbb8a","#ca562c"],5:["#008080","#92b69e","#f6edbd","#e6a272","#ca562c"],6:["#008080","#7eab98","#ced7b1","#f1cf9e","#e19464","#ca562c"],7:["#008080","#70a494","#b4c8a8","#f6edbd","#edbb8a","#de8a5a","#ca562c"],tags:["diverging"]},P6={2:["#009392","#cf597e"],3:["#009392","#e9e29c","#cf597e"],4:["#009392","#9ccb86","#eeb479","#cf597e"],5:["#009392","#71be83","#e9e29c","#ed9c72","#cf597e"],6:["#009392","#52b684","#bcd48c","#edc783","#eb8d71","#cf597e"],7:["#009392","#39b185","#9ccb86","#e9e29c","#eeb479","#e88471","#cf597e"],tags:["diverging"]},F6={2:["#009392","#d0587e"],3:["#009392","#f1eac8","#d0587e"],4:["#009392","#91b8aa","#f1eac8","#dfa0a0","#d0587e"],5:["#009392","#91b8aa","#f1eac8","#dfa0a0","#d0587e"],6:["#009392","#72aaa1","#b1c7b3","#e5b9ad","#d98994","#d0587e"],7:["#009392","#72aaa1","#b1c7b3","#f1eac8","#e5b9ad","#d98994","#d0587e"],tags:["diverging"]},k6={2:["#009B9E","#C75DAB"],3:["#009B9E","#F1F1F1","#C75DAB"],4:["#009B9E","#A7D3D4","#E4C1D9","#C75DAB"],5:["#009B9E","#7CC5C6","#F1F1F1","#DDA9CD","#C75DAB"],6:["#009B9E","#5DBCBE","#C6DFDF","#E9D4E2","#D99BC6","#C75DAB"],7:["#009B9E","#42B7B9","#A7D3D4","#F1F1F1","#E4C1D9","#D691C1","#C75DAB"],tags:["diverging"]},L6={2:["#A16928","#2887a1"],3:["#A16928","#edeac2","#2887a1"],4:["#A16928","#d6bd8d","#b5c8b8","#2887a1"],5:["#A16928","#caa873","#edeac2","#98b7b2","#2887a1"],6:["#A16928","#c29b64","#e0cfa2","#cbd5bc","#85adaf","#2887a1"],7:["#A16928","#bd925a","#d6bd8d","#edeac2","#b5c8b8","#79a7ac","#2887a1"],tags:["diverging"]},M6={2:["#855C75","#D9AF6B","#7C7C7C"],3:["#855C75","#D9AF6B","#AF6458","#7C7C7C"],4:["#855C75","#D9AF6B","#AF6458","#736F4C","#7C7C7C"],5:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#7C7C7C"],6:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#7C7C7C"],7:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#7C7C7C"],8:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#7C7C7C"],9:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#7C7C7C"],10:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#7C7C7C"],11:["#855C75","#D9AF6B","#AF6458","#736F4C","#526A83","#625377","#68855C","#9C9C5E","#A06177","#8C785D","#467378","#7C7C7C"],tags:["qualitative"]},I6={2:["#7F3C8D","#11A579","#A5AA99"],3:["#7F3C8D","#11A579","#3969AC","#A5AA99"],4:["#7F3C8D","#11A579","#3969AC","#F2B701","#A5AA99"],5:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#A5AA99"],6:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#A5AA99"],7:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#A5AA99"],8:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#A5AA99"],9:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#A5AA99"],10:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#f97b72","#A5AA99"],11:["#7F3C8D","#11A579","#3969AC","#F2B701","#E73F74","#80BA5A","#E68310","#008695","#CF1C90","#f97b72","#4b4b8f","#A5AA99"],tags:["qualitative"]},R6={2:["#66C5CC","#F6CF71","#B3B3B3"],3:["#66C5CC","#F6CF71","#F89C74","#B3B3B3"],4:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#B3B3B3"],5:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#B3B3B3"],6:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#B3B3B3"],7:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#B3B3B3"],8:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#B3B3B3"],9:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B3B3B3"],10:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#B3B3B3"],11:["#66C5CC","#F6CF71","#F89C74","#DCB0F2","#87C55F","#9EB9F3","#FE88B1","#C9DB74","#8BE0A4","#B497E7","#D3B484","#B3B3B3"],tags:["qualitative"]},B6={2:["#5F4690","#1D6996","#666666"],3:["#5F4690","#1D6996","#38A6A5","#666666"],4:["#5F4690","#1D6996","#38A6A5","#0F8554","#666666"],5:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#666666"],6:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#666666"],7:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#666666"],8:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#666666"],9:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#666666"],10:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#666666"],11:["#5F4690","#1D6996","#38A6A5","#0F8554","#73AF48","#EDAD08","#E17C05","#CC503E","#94346E","#6F4070","#994E95","#666666"],tags:["qualitative"]},O6={2:["#88CCEE","#CC6677","#888888"],3:["#88CCEE","#CC6677","#DDCC77","#888888"],4:["#88CCEE","#CC6677","#DDCC77","#117733","#888888"],5:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#888888"],6:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#888888"],7:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#888888"],8:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#888888"],9:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#888888"],10:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#661100","#888888"],11:["#88CCEE","#CC6677","#DDCC77","#117733","#332288","#AA4499","#44AA99","#999933","#882255","#661100","#6699CC","#888888"],tags:["qualitative","colorblind"]},D6={2:["#E58606","#5D69B1","#A5AA99"],3:["#E58606","#5D69B1","#52BCA3","#A5AA99"],4:["#E58606","#5D69B1","#52BCA3","#99C945","#A5AA99"],5:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#A5AA99"],6:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#A5AA99"],7:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#A5AA99"],8:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#A5AA99"],9:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#A5AA99"],10:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#ED645A","#A5AA99"],11:["#E58606","#5D69B1","#52BCA3","#99C945","#CC61B0","#24796C","#DAA51B","#2F8AC4","#764E9F","#ED645A","#CC3A8E","#A5AA99"],tags:["qualitative"]},N6={...G.BuGn,tags:["quantitative"]},z6={...G.BuPu,tags:["quantitative"]},U6={...G.GnBu,tags:["quantitative"]},q6={...G.OrRd,tags:["quantitative"]},G6={...G.PuBu,tags:["quantitative"]},V6={...G.PuBuGn,tags:["quantitative"]},$6={...G.PuRd,tags:["quantitative"]},H6={...G.RdPu,tags:["quantitative"]},j6={...G.YlGn,tags:["quantitative"]},Z6={...G.YlGnBu,tags:["quantitative"]},W6={...G.YlOrBr,tags:["quantitative"]},Y6={...G.YlOrRd,tags:["quantitative"]},K6={...G.Accent,tags:["qualitative"]},X6={...G.Dark2,tags:["qualitative"]},Q6={...G.Paired,tags:["qualitative"]},J6={...G.Pastel1,tags:["qualitative"]},e_={...G.Pastel2,tags:["qualitative"]},t_={...G.Set1,tags:["qualitative"]},r_={...G.Set2,tags:["qualitative"]},n_={...G.Set3,tags:["qualitative"]},i_={...G.Blues,tags:["quantitative"]},o_={...G.Greens,tags:["quantitative"]},a_={...G.Greys,tags:["quantitative"]},s_={...G.Oranges,tags:["quantitative"]},l_={...G.Purples,tags:["quantitative"]},f_={...G.Reds,tags:["quantitative"]},c_={...G.BrBG,tags:["diverging"]},u_={...G.PiYG,tags:["diverging"]},d_={...G.PRGn,tags:["diverging"]},h_={...G.PuOr,tags:["diverging"]},p_={...G.RdBu,tags:["diverging"]},g_={...G.RdGy,tags:["diverging"]},m_={...G.RdYlBu,tags:["diverging"]},b_={...G.RdYlGn,tags:["diverging"]},y_={...G.Spectral,tags:["diverging"]};var on="PurpOr",an=[204,204,204],tg=[119,119,119];function Sr(e,t){let r=ff[e],n=t;Fe(r,`Palette "${e}" not found. Expected a CARTOColors string`);let i=Object.keys(r).filter(f=>f!=="tags").map(Number),o=Math.max(...i),a=Math.min(...i);!Number.isInteger(t)||t>o?n=o:t<a&&(n=a);let s=r[n];return r.tags&&r.tags.includes("qualitative")&&(s=s.slice(0,-1)),s.map(f=>x_(f))}function x_(e){let t=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(e);return t?[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),255]:(t=/^#?([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})([a-f\d]{1})$/i.exec(e),t?[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),parseInt(t[4]+t[4],16)]:(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),255]:(t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),Fe(t,`Hexadecimal color "${e}" was not parsed correctly`),[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),parseInt(t[4],16)])))}var v_=Object.freeze(["function","string"]);function sn(e,t,r){return Fe(typeof t=="object",'Expected "data" to be an object'),Fe(v_.includes(typeof e),'Expected "attr" to be a function or string'),typeof e=="function"?e(t,r):t?.properties?.[e]}function cf({attr:e,domain:t,colors:r=on,nullColor:n=an}){Fe(Array.isArray(t),'Expected "domain" to be an array of numbers');let i=typeof r=="string"?Sr(r,t.length+1):r,o=mr().domain(t).range(i);return(a,s)=>{let f=sn(e,a,s);return typeof f=="number"&&Number.isFinite(f)?o(f):n}}function uf({attr:e,domain:t,colors:r=on,nullColor:n=an,othersColor:i=tg}){Fe(Array.isArray(t),'Expected "domain" to be an array of numbers or strings');let o={},a=typeof r=="string"?Sr(r,t.length):r;for(let[s,f]of t.entries())o[f]=a[s];return(s,f)=>{let l=sn(e,s,f);return typeof l=="number"&&Number.isFinite(l)||typeof l=="string"?o[l]||i:n}}function df({attr:e,domain:t,colors:r=on,nullColor:n=an}){Fe(Array.isArray(t),'Expected "domain" to be an array of numbers');let i=typeof r=="string"?Sr(r,t.length):r,o=gr().domain(t).range(i);return(a,s)=>{let f=sn(e,a,s);return typeof f=="number"&&Number.isFinite(f)?o(f):n}}var w_={clusterTile:Dn,h3:ar,heatmapTile:$n,mvt:Hr,quadbin:sr,raster:Kn,tileset:Hr};function hf(e){let t=w_[e.type];if(!t)throw new Error(`No layer class found for type: ${e.type}`);return new t(e.props)}function rg(e){return{...e,layers:e.layers.map(t=>hf(t))}}async function ng(e){let{onNewData:t,...r}=e,n={...r,onNewData:typeof t=="function"?a=>{t(rg(a))}:void 0},i=await Xp(n);return rg(i)}var __="custom:",ig="positron";function pf(e){let{longitude:t,latitude:r,...n}=e.mapState;return{center:[t,r],...n}}async function og({config:e,errorContext:t,applyLayerFilters:r=!0}){let{mapStyle:n}=e,i=n.styleType||ig;if(i.startsWith(__)){let a=e.customBaseMaps?.customStyle;if(a)return{type:"maplibre",props:{style:a.style||a.url,...pf(e)},attribution:a.customAttribution}}if(Qp.includes(i)){let{visibleLayerGroups:a}=n,s=Ye(i),f=s,l=s;return r&&a&&Jp(a)&&(l=await ka({styleUrl:s,errorContext:t}),f=Fa(l,a)),{type:"maplibre",props:{style:f,...pf(e)},visibleLayerGroups:a,rawStyle:l}}let o=Pa[i];if(o){let{mapState:a}=e;return{type:"google-maps",props:{...o,center:{lat:a.latitude,lng:a.longitude},zoom:a.zoom+1,tilt:a.pitch,heading:a.bearing}}}return{type:"maplibre",props:{style:Ye(ig),...pf(e)}}}var E_={ClusterTileLayer:Dn,H3TileLayer:ar,HeatmapTileLayer:$n,PointLabelLayer:Zn,QuadbinTileLayer:sr,RasterTileLayer:Kn,VectorTileLayer:Hr};var ze={},ag=q(kt(),1);Xe(ze,q(kt(),1));if(!ag.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");Xe(Tr,ze);var S_=La;globalThis.CartoLibrary=La;return dg(Tr);})();
173
173
  /*! Bundled license information:
174
174
 
175
175
  ieee754/index.js: