diff --git a/_app/immutable/chunks/entry.B9W1ZgwB.js b/_app/immutable/chunks/entry.B9W1ZgwB.js new file mode 100644 index 0000000..615f95d --- /dev/null +++ b/_app/immutable/chunks/entry.B9W1ZgwB.js @@ -0,0 +1,3 @@ +import{V as it}from"./runtime.BRAqMMCI.js";import{w as pe}from"./index.DM8_DTYB.js";new URL("sveltekit-internal://");function ct(e,n){return e==="/"||n==="ignore"?e:n==="never"?e.endsWith("/")?e.slice(0,-1):e:n==="always"&&!e.endsWith("/")?e+"/":e}function lt(e){return e.split("%25").map(decodeURI).join("%25")}function ft(e){for(const n in e)e[n]=decodeURIComponent(e[n]);return e}function ce({href:e}){return e.split("#")[0]}const ut=["href","pathname","search","toString","toJSON"];function dt(e,n,t){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(r,o){if(o==="get"||o==="getAll"||o==="has")return s=>(t(s),r[o](s));n();const i=Reflect.get(r,o);return typeof i=="function"?i.bind(r):i}}),enumerable:!0,configurable:!0});for(const r of ut)Object.defineProperty(a,r,{get(){return n(),e[r]},enumerable:!0,configurable:!0});return a}const ht="/__data.json",pt=".html__data.json";function gt(e){return e.endsWith(".html")?e.replace(/\.html$/,pt):e.replace(/\/$/,"")+ht}function mt(...e){let n=5381;for(const t of e)if(typeof t=="string"){let a=t.length;for(;a;)n=n*33^t.charCodeAt(--a)}else if(ArrayBuffer.isView(t)){const a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);let r=a.length;for(;r;)n=n*33^a[--r]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function _t(e){const n=atob(e),t=new Uint8Array(n.length);for(let a=0;a((e instanceof Request?e.method:(n==null?void 0:n.method)||"GET")!=="GET"&&q.delete(ge(e)),$e(e,n));const q=new Map;function yt(e,n){const t=ge(e,n),a=document.querySelector(t);if(a!=null&&a.textContent){let{body:r,...o}=JSON.parse(a.textContent);const i=a.getAttribute("data-ttl");return i&&q.set(t,{body:r,init:o,ttl:1e3*Number(i)}),a.getAttribute("data-b64")!==null&&(r=_t(r)),Promise.resolve(new Response(r,o))}return window.fetch(e,n)}function wt(e,n,t){if(q.size>0){const a=ge(e,t),r=q.get(a);if(r){if(performance.now(){const r=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(a);if(r)return n.push({name:r[1],matcher:r[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(a);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!a)return;const i=a.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return le(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return le(String.fromCharCode(...c.slice(2).split("-").map(l=>parseInt(l,16))));const u=vt.exec(c),[,h,g,d,_]=u;return n.push({name:d,matcher:_,optional:!!h,rest:!!g,chained:g?f===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return le(c)}).join("")}).join("")}/?$`),params:n}}function Et(e){return!/^\([^)]+\)$/.test(e)}function kt(e){return e.slice(1).split("/").filter(Et)}function St(e,n,t){const a={},r=e.slice(1),o=r.filter(s=>s!==void 0);let i=0;for(let s=0;su).join("/"),i=0),f===void 0){c.rest&&(a[c.name]="");continue}if(!c.matcher||t[c.matcher](f)){a[c.name]=f;const u=n[s+1],h=r[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(a).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return a}function le(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function At({nodes:e,server_loads:n,dictionary:t,matchers:a}){const r=new Set(n);return Object.entries(t).map(([s,[c,f,u]])=>{const{pattern:h,params:g}=bt(s),d={id:s,exec:_=>{const l=h.exec(_);if(l)return St(l,g,a)},errors:[1,...u||[]].map(_=>e[_]),layouts:[0,...f||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,e[s]]}function i(s){return s===void 0?s:[r.has(s),e[s]]}}function Ce(e,n=JSON.parse){try{return n(sessionStorage[e])}catch{}}function Ie(e,n,t=JSON.stringify){const a=t(n);try{sessionStorage[e]=a}catch{}}var je;const P=((je=globalThis.__sveltekit_hueyu0)==null?void 0:je.base)??"";var De;const Rt=((De=globalThis.__sveltekit_hueyu0)==null?void 0:De.assets)??P,It="1733935418797",Ve="sveltekit:snapshot",Fe="sveltekit:scroll",qe="sveltekit:states",Lt="sveltekit:pageurl",D="sveltekit:history",M="sveltekit:navigation",J={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},K=location.origin;function Ge(e){if(e instanceof URL)return e;let n=document.baseURI;if(!n){const t=document.getElementsByTagName("base");n=t.length?t[0].href:document.URL}return new URL(e,n)}function me(){return{x:pageXOffset,y:pageYOffset}}function O(e,n){return e.getAttribute(`data-sveltekit-${n}`)}const Le={...J,"":J.hover};function Me(e){let n=e.assignedSlot??e.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function He(e,n){for(;e&&e!==n;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=Me(e)}}function ue(e,n){let t;try{t=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,r=!t||!!a||ne(t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(t==null?void 0:t.origin)===K&&e.hasAttribute("download");return{url:t,external:r,target:a,download:o}}function W(e){let n=null,t=null,a=null,r=null,o=null,i=null,s=e;for(;s&&s!==document.documentElement;)a===null&&(a=O(s,"preload-code")),r===null&&(r=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),t===null&&(t=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=Me(s);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Le[a??"off"],preload_data:Le[r??"off"],keepfocus:c(n),noscroll:c(t),reload:c(o),replace_state:c(i)}}function Pe(e){const n=pe(e);let t=!0;function a(){t=!0,n.update(i=>i)}function r(i){t=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||t&&c!==s)&&i(s=c)})}return{notify:a,set:r,subscribe:o}}function Pt(){const{set:e,subscribe:n}=pe(!1);let t;async function a(){clearTimeout(t);try{const r=await fetch(`${Rt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const i=(await r.json()).version!==It;return i&&(e(!0),clearTimeout(t)),i}catch{return!1}}return{subscribe:n,check:a}}function ne(e,n){return e.origin!==K||!e.pathname.startsWith(n)}const Tt=-1,Ut=-2,xt=-3,Nt=-4,Ot=-5,jt=-6;function Dt(e,n){if(typeof e=="number")return r(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const t=e,a=Array(t.length);function r(o,i=!1){if(o===Tt)return;if(o===xt)return NaN;if(o===Nt)return 1/0;if(o===Ot)return-1/0;if(o===jt)return-0;if(i)throw new Error("Invalid input");if(o in a)return a[o];const s=t[o];if(!s||typeof s!="object")a[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],f=n==null?void 0:n[c];if(f)return a[o]=f(r(s[1]));switch(c){case"Date":a[o]=new Date(s[1]);break;case"Set":const u=new Set;a[o]=u;for(let d=1;dn!=null)}class ae{constructor(n,t){this.status=n,typeof t=="string"?this.body={message:t}:t?this.body=t:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Ke{constructor(n,t){this.status=n,this.location=t}}class _e extends Error{constructor(n,t,a){super(a),this.status=n,this.text=t}}const Vt="x-sveltekit-invalidated",Ft="x-sveltekit-trailing-slash";function z(e){return e instanceof ae||e instanceof _e?e.status:500}function qt(e){return e instanceof _e?e.text:"Internal Error"}const N=Ce(Fe)??{},H=Ce(Ve)??{},U={url:Pe({}),page:Pe({}),navigating:pe(null),updated:Pt()};function ye(e){N[e]=me()}function Gt(e,n){let t=e+1;for(;N[t];)delete N[t],t+=1;for(t=n+1;H[t];)delete H[t],t+=1}function C(e){return location.href=e.href,new Promise(()=>{})}function Te(){}let re,de,X,T,he,V;const Ye=[],Z=[];let R=null;const Je=[],Mt=[];let j=[],y={branch:[],error:null,url:null},we=!1,Q=!1,Ue=!0,B=!1,F=!1,We=!1,ve=!1,be,S,L,I,ee;const G=new Set;async function tn(e,n,t){var r,o;document.URL!==location.href&&(location.href=location.href),V=e,re=At(e),T=document.documentElement,he=n,de=e.nodes[0],X=e.nodes[1],de(),X(),S=(r=history.state)==null?void 0:r[D],L=(o=history.state)==null?void 0:o[M],S||(S=L=Date.now(),history.replaceState({...history.state,[D]:S,[M]:L},""));const a=N[S];a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y)),t?await Xt(he,t):Wt(location.href,{replaceState:!0}),zt()}function Ht(){Ye.length=0,ve=!1}function ze(e){Z.some(n=>n==null?void 0:n.snapshot)&&(H[e]=Z.map(n=>{var t;return(t=n==null?void 0:n.snapshot)==null?void 0:t.capture()}))}function Xe(e){var n;(n=H[e])==null||n.forEach((t,a)=>{var r,o;(o=(r=Z[a])==null?void 0:r.snapshot)==null||o.restore(t)})}function xe(){ye(S),Ie(Fe,N),ze(L),Ie(Ve,H)}async function Ze(e,n,t,a){return Y({type:"goto",url:Ge(e),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:t,nav_token:a,accept:()=>{n.invalidateAll&&(ve=!0)}})}async function Bt(e){if(e.id!==(R==null?void 0:R.id)){const n={};G.add(n),R={id:e.id,token:n,promise:et({...e,preload:n}).then(t=>(G.delete(n),t.type==="loaded"&&t.state.error&&(R=null),t))}}return R.promise}async function fe(e){const n=re.find(t=>t.exec(tt(e)));n&&await Promise.all([...n.layouts,n.leaf].map(t=>t==null?void 0:t[1]()))}function Qe(e,n,t){var o;y=e.state;const a=document.querySelector("style[data-sveltekit]");a&&a.remove(),I=e.props.page,be=new V.root({target:n,props:{...e.props,stores:U,components:Z},hydrate:t}),Xe(L);const r={from:null,to:{params:y.params,route:{id:((o=y.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(i=>i(r)),Q=!0}function te({url:e,params:n,branch:t,status:a,error:r,route:o,form:i}){let s="never";if(P&&(e.pathname===P||e.pathname===P+"/"))s="always";else for(const d of t)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);e.pathname=ct(e.pathname,s),e.search=e.search;const c={type:"loaded",state:{url:e,params:n,branch:t,error:r,route:o},props:{constructors:Ct(t).map(d=>d.node.component),page:I}};i!==void 0&&(c.props.form=i);let f={},u=!I,h=0;for(let d=0;d(s&&(c.route=!0),l[m])}),params:new Proxy(a,{get:(l,m)=>(s&&c.params.add(m),l[m])}),data:(o==null?void 0:o.data)??null,url:dt(t,()=>{s&&(c.url=!0)},l=>{s&&c.search_params.add(l)}),async fetch(l,m){let b;l instanceof Request?(b=l.url,m={body:l.method==="GET"||l.method==="HEAD"?void 0:await l.blob(),cache:l.cache,credentials:l.credentials,headers:l.headers,integrity:l.integrity,keepalive:l.keepalive,method:l.method,mode:l.mode,redirect:l.redirect,referrer:l.referrer,referrerPolicy:l.referrerPolicy,signal:l.signal,...m}):b=l;const A=new URL(b,t);return s&&d(A.href),A.origin===t.origin&&(b=A.href.slice(t.origin.length)),Q?wt(b,A.href,m):yt(b,m)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(l){s=!1;try{return l()}finally{s=!0}}};i=await f.universal.load.call(null,_)??null}return{node:f,loader:e,server:o,universal:(h=f.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=f.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Ne(e,n,t,a,r,o){if(ve)return!0;if(!r)return!1;if(r.parent&&e||r.route&&n||r.url&&t)return!0;for(const i of r.search_params)if(a.has(i))return!0;for(const i of r.params)if(o[i]!==y.params[i])return!0;for(const i of r.dependencies)if(Ye.some(s=>s(new URL(i))))return!0;return!1}function ke(e,n){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?n??null:null}function Kt(e,n){if(!e)return new Set(n.searchParams.keys());const t=new Set([...e.searchParams.keys(),...n.searchParams.keys()]);for(const a of t){const r=e.searchParams.getAll(a),o=n.searchParams.getAll(a);r.every(i=>o.includes(i))&&o.every(i=>r.includes(i))&&t.delete(a)}return t}function Oe({error:e,url:n,route:t,params:a}){return{type:"loaded",state:{error:e,url:n,route:t,params:a,branch:[]},props:{page:I,constructors:[]}}}async function et({id:e,invalidating:n,url:t,params:a,route:r,preload:o}){if((R==null?void 0:R.id)===e)return G.delete(R.token),R.promise;const{errors:i,layouts:s,leaf:c}=r,f=[...s,c];i.forEach(p=>p==null?void 0:p().catch(()=>{})),f.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let u=null;const h=y.url?e!==y.url.pathname+y.url.search:!1,g=y.route?r.id!==y.route.id:!1,d=Kt(y.url,t);let _=!1;const l=f.map((p,v)=>{var x;const E=y.branch[v],k=!!(p!=null&&p[0])&&((E==null?void 0:E.loader)!==p[1]||Ne(_,g,h,d,(x=E.server)==null?void 0:x.uses,a));return k&&(_=!0),k});if(l.some(Boolean)){try{u=await rt(t,l)}catch(p){const v=await $(p,{url:t,params:a,route:{id:e}});return G.has(o)?Oe({error:v,url:t,params:a,route:r}):oe({status:z(p),error:v,url:t,route:r})}if(u.type==="redirect")return u}const m=u==null?void 0:u.nodes;let b=!1;const A=f.map(async(p,v)=>{var se;if(!p)return;const E=y.branch[v],k=m==null?void 0:m[v];if((!k||k.type==="skip")&&p[1]===(E==null?void 0:E.loader)&&!Ne(b,g,h,d,(se=E.universal)==null?void 0:se.uses,a))return E;if(b=!0,(k==null?void 0:k.type)==="error")throw k;return Ee({loader:p[1],url:t,params:a,route:r,parent:async()=>{var Re;const Ae={};for(let ie=0;ie{});const w=[];for(let p=0;pPromise.resolve({}),server_data_node:ke(o)}),c={node:await X(),loader:X,universal:null,server:null,data:null};return te({url:t,params:r,branch:[s,c],status:e,error:n,route:null})}function Se(e,n){if(!e||ne(e,P))return;let t;try{t=V.hooks.reroute({url:new URL(e)})??e.pathname}catch{return}const a=tt(t);for(const r of re){const o=r.exec(a);if(o)return{id:e.pathname+e.search,invalidating:n,route:r,params:ft(o),url:e}}}function tt(e){return lt(e.slice(P.length)||"/")}function nt({url:e,type:n,intent:t,delta:a}){let r=!1;const o=st(y,t,e,n);a!==void 0&&(o.navigation.delta=a);const i={...o.navigation,cancel:()=>{r=!0,o.reject(new Error("navigation cancelled"))}};return B||Je.forEach(s=>s(i)),r?null:o}async function Y({type:e,url:n,popped:t,keepfocus:a,noscroll:r,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:f=Te,block:u=Te}){const h=Se(n,!1),g=nt({url:n,type:e,delta:t==null?void 0:t.delta,intent:h});if(!g){u();return}const d=S,_=L;f(),B=!0,Q&&U.navigating.set(g.navigation),ee=c;let l=h&&await et(h);if(!l){if(ne(n,P))return await C(n);l=await at(n,{id:null},await $(new _e(404,"Not Found",`Not found: ${n.pathname}`),{url:n,params:{},route:{id:null}}),404)}if(n=(h==null?void 0:h.url)||n,ee!==c)return g.reject(new Error("navigation aborted")),!1;if(l.type==="redirect")if(s>=20)l=await oe({status:500,error:await $(new Error("Redirect loop"),{url:n,params:{},route:{id:null}}),url:n,route:{id:null}});else return Ze(new URL(l.location,n).href,{},s+1,c),!1;else l.props.page.status>=400&&await U.updated.check()&&await C(n);if(Ht(),ye(d),ze(_),l.props.page.url.pathname!==n.pathname&&(n.pathname=l.props.page.url.pathname),i=t?t.state:i,!t){const w=o?0:1,p={[D]:S+=w,[M]:L+=w,[qe]:i};(o?history.replaceState:history.pushState).call(history,p,"",n),o||Gt(S,L)}if(R=null,l.props.page.state=i,Q){y=l.state,l.props.page&&(l.props.page.url=n);const w=(await Promise.all(Mt.map(p=>p(g.navigation)))).filter(p=>typeof p=="function");if(w.length>0){let p=function(){j=j.filter(v=>!w.includes(v))};w.push(p),j.push(...w)}be.$set(l.props),We=!0}else Qe(l,he,!1);const{activeElement:m}=document;await it();const b=t?t.scroll:r?me():null;if(Ue){const w=n.hash&&document.getElementById(decodeURIComponent(n.hash.slice(1)));b?scrollTo(b.x,b.y):w?w.scrollIntoView():scrollTo(0,0)}const A=document.activeElement!==m&&document.activeElement!==document.body;!a&&!A&&Zt(),Ue=!0,l.props.page&&(I=l.props.page),B=!1,e==="popstate"&&Xe(L),g.fulfil(void 0),j.forEach(w=>w(g.navigation)),U.navigating.set(null)}async function at(e,n,t,a){return e.origin===K&&e.pathname===location.pathname&&!we?await oe({status:a,error:t,url:e,route:n}):await C(e)}function Jt(){let e;T.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(e),e=setTimeout(()=>{a(i,2)},20)});function n(o){a(o.composedPath()[0],1)}T.addEventListener("mousedown",n),T.addEventListener("touchstart",n,{passive:!0});const t=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&(fe(i.target.href),t.unobserve(i.target))},{threshold:0});function a(o,i){const s=He(o,T);if(!s)return;const{url:c,external:f,download:u}=ue(s,P);if(f||u)return;const h=W(s);if(!h.reload)if(i<=h.preload_data){const g=Se(c,!1);g&&Bt(g)}else i<=h.preload_code&&fe(c.pathname)}function r(){t.disconnect();for(const o of T.querySelectorAll("a")){const{url:i,external:s,download:c}=ue(o,P);if(s||c)continue;const f=W(o);f.reload||(f.preload_code===J.viewport&&t.observe(o),f.preload_code===J.eager&&fe(i.pathname))}}j.push(r),r()}function $(e,n){if(e instanceof ae)return e.body;const t=z(e),a=qt(e);return V.hooks.handleError({error:e,event:n,status:t,message:a})??{message:a}}function Wt(e,n={}){return e=Ge(e),e.origin!==K?Promise.reject(new Error("goto: invalid URL")):Ze(e,n,0)}function zt(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let a=!1;if(xe(),!B){const r=st(y,void 0,null,"leave"),o={...r.navigation,cancel:()=>{a=!0,r.reject(new Error("navigation cancelled"))}};Je.forEach(i=>i(o))}a?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&xe()}),(n=navigator.connection)!=null&&n.saveData||Jt(),T.addEventListener("click",async t=>{var g;if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const a=He(t.composedPath()[0],T);if(!a)return;const{url:r,external:o,target:i,download:s}=ue(a,P);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=W(a);if(!(a instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;if(o||c.reload){nt({url:r,type:"link"})?B=!0:t.preventDefault();return}const[u,h]=r.href.split("#");if(h!==void 0&&u===ce(location)){const[,d]=y.url.href.split("#");if(d===h){t.preventDefault(),h===""||h==="top"&&a.ownerDocument.getElementById("top")===null?window.scrollTo({top:0}):(g=a.ownerDocument.getElementById(h))==null||g.scrollIntoView();return}if(F=!0,ye(S),e(r),!c.replace_state)return;F=!1}t.preventDefault(),await new Promise(d=>{requestAnimationFrame(()=>{setTimeout(d,0)}),setTimeout(d,100)}),Y({type:"link",url:r,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??r.href===location.href})}),T.addEventListener("submit",t=>{if(t.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if(((r==null?void 0:r.formMethod)||a.method)!=="get")return;const i=new URL((r==null?void 0:r.hasAttribute("formaction"))&&(r==null?void 0:r.formAction)||a.action);if(ne(i,P))return;const s=t.target,c=W(s);if(c.reload)return;t.preventDefault(),t.stopPropagation();const f=new FormData(s),u=r==null?void 0:r.getAttribute("name");u&&f.append(u,(r==null?void 0:r.getAttribute("value"))??""),i.search=new URLSearchParams(f).toString(),Y({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href})}),addEventListener("popstate",async t=>{var a;if((a=t.state)!=null&&a[D]){const r=t.state[D];if(ee={},r===S)return;const o=N[r],i=t.state[qe]??{},s=new URL(t.state[Lt]??location.href),c=t.state[M],f=ce(location)===ce(y.url);if(c===L&&(We||f)){e(s),N[S]=me(),o&&scrollTo(o.x,o.y),i!==I.state&&(I={...I,state:i},be.$set({page:I})),S=r;return}const h=r-S;await Y({type:"popstate",url:s,popped:{state:i,scroll:o,delta:h},accept:()=>{S=r,L=c},block:()=>{history.go(-h)},nav_token:ee})}else if(!F){const r=new URL(location.href);e(r)}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[D]:++S,[M]:L},"",location.href))});for(const t of document.querySelectorAll("link"))t.rel==="icon"&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&U.navigating.set(null)});function e(t){y.url=t,U.page.set({...I,url:t}),U.page.notify()}}async function Xt(e,{status:n=200,error:t,node_ids:a,params:r,route:o,data:i,form:s}){we=!0;const c=new URL(location.href);({params:r={},route:o={id:null}}=Se(c,!1)||{});let f;try{const u=a.map(async(d,_)=>{const l=i[_];return l!=null&&l.uses&&(l.uses=ot(l.uses)),Ee({loader:V.nodes[d],url:c,params:r,route:o,parent:async()=>{const m={};for(let b=0;b<_;b+=1)Object.assign(m,(await u[b]).data);return m},server_data_node:ke(l)})}),h=await Promise.all(u),g=re.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let _=0;_o?"1":"0").join(""));const a=await $e(t.href);if(!a.ok){let o;throw(r=a.headers.get("content-type"))!=null&&r.includes("application/json")?o=await a.json():a.status===404?o="Not Found":a.status===500&&(o="Internal Error"),new ae(a.status,o)}return new Promise(async o=>{var h;const i=new Map,s=a.body.getReader(),c=new TextDecoder;function f(g){return Dt(g,{Promise:d=>new Promise((_,l)=>{i.set(d,{fulfil:_,reject:l})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?` +`:c.decode(d,{stream:!0});;){const _=u.indexOf(` +`);if(_===-1)break;const l=JSON.parse(u.slice(0,_));if(u=u.slice(_+1),l.type==="redirect")return o(l);if(l.type==="data")(h=l.nodes)==null||h.forEach(m=>{(m==null?void 0:m.type)==="data"&&(m.uses=ot(m.uses),m.data=f(m.data))}),o(l);else if(l.type==="chunk"){const{id:m,data:b,error:A}=l,w=i.get(m);i.delete(m),A?w.reject(f(A)):w.fulfil(f(b))}}}})}function ot(e){return{dependencies:new Set((e==null?void 0:e.dependencies)??[]),params:new Set((e==null?void 0:e.params)??[]),parent:!!(e!=null&&e.parent),route:!!(e!=null&&e.route),url:!!(e!=null&&e.url),search_params:new Set((e==null?void 0:e.search_params)??[])}}function Zt(){const e=document.querySelector("[autofocus]");if(e)e.focus();else{const n=document.body,t=n.getAttribute("tabindex");n.tabIndex=-1,n.focus({preventScroll:!0,focusVisible:!1}),t!==null?n.setAttribute("tabindex",t):n.removeAttribute("tabindex");const a=getSelection();if(a&&a.type!=="None"){const r=[];for(let o=0;o{if(a.rangeCount===r.length){for(let o=0;o{r=u,o=h});return i.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:((c=e.route)==null?void 0:c.id)??null},url:e.url},to:t&&{params:(n==null?void 0:n.params)??null,route:{id:((f=n==null?void 0:n.route)==null?void 0:f.id)??null},url:t},willUnload:!n,type:a,complete:i},fulfil:r,reject:o}}export{tn as a,U as s}; diff --git a/_app/immutable/chunks/entry.COc-_zOz.js b/_app/immutable/chunks/entry.COc-_zOz.js deleted file mode 100644 index 72887ea..0000000 --- a/_app/immutable/chunks/entry.COc-_zOz.js +++ /dev/null @@ -1,3 +0,0 @@ -import{V as it}from"./runtime.BRAqMMCI.js";import{w as pe}from"./index.DM8_DTYB.js";new URL("sveltekit-internal://");function ct(e,n){return e==="/"||n==="ignore"?e:n==="never"?e.endsWith("/")?e.slice(0,-1):e:n==="always"&&!e.endsWith("/")?e+"/":e}function lt(e){return e.split("%25").map(decodeURI).join("%25")}function ft(e){for(const n in e)e[n]=decodeURIComponent(e[n]);return e}function ce({href:e}){return e.split("#")[0]}const ut=["href","pathname","search","toString","toJSON"];function dt(e,n,t){const a=new URL(e);Object.defineProperty(a,"searchParams",{value:new Proxy(a.searchParams,{get(r,o){if(o==="get"||o==="getAll"||o==="has")return s=>(t(s),r[o](s));n();const i=Reflect.get(r,o);return typeof i=="function"?i.bind(r):i}}),enumerable:!0,configurable:!0});for(const r of ut)Object.defineProperty(a,r,{get(){return n(),e[r]},enumerable:!0,configurable:!0});return a}const ht="/__data.json",pt=".html__data.json";function gt(e){return e.endsWith(".html")?e.replace(/\.html$/,pt):e.replace(/\/$/,"")+ht}function mt(...e){let n=5381;for(const t of e)if(typeof t=="string"){let a=t.length;for(;a;)n=n*33^t.charCodeAt(--a)}else if(ArrayBuffer.isView(t)){const a=new Uint8Array(t.buffer,t.byteOffset,t.byteLength);let r=a.length;for(;r;)n=n*33^a[--r]}else throw new TypeError("value must be a string or TypedArray");return(n>>>0).toString(36)}function _t(e){const n=atob(e),t=new Uint8Array(n.length);for(let a=0;a((e instanceof Request?e.method:(n==null?void 0:n.method)||"GET")!=="GET"&&q.delete(ge(e)),$e(e,n));const q=new Map;function yt(e,n){const t=ge(e,n),a=document.querySelector(t);if(a!=null&&a.textContent){let{body:r,...o}=JSON.parse(a.textContent);const i=a.getAttribute("data-ttl");return i&&q.set(t,{body:r,init:o,ttl:1e3*Number(i)}),a.getAttribute("data-b64")!==null&&(r=_t(r)),Promise.resolve(new Response(r,o))}return window.fetch(e,n)}function wt(e,n,t){if(q.size>0){const a=ge(e,t),r=q.get(a);if(r){if(performance.now(){const r=/^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(a);if(r)return n.push({name:r[1],matcher:r[2],optional:!1,rest:!0,chained:!0}),"(?:/(.*))?";const o=/^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(a);if(o)return n.push({name:o[1],matcher:o[2],optional:!0,rest:!1,chained:!0}),"(?:/([^/]+))?";if(!a)return;const i=a.split(/\[(.+?)\](?!\])/);return"/"+i.map((c,f)=>{if(f%2){if(c.startsWith("x+"))return le(String.fromCharCode(parseInt(c.slice(2),16)));if(c.startsWith("u+"))return le(String.fromCharCode(...c.slice(2).split("-").map(l=>parseInt(l,16))));const u=vt.exec(c),[,h,g,d,_]=u;return n.push({name:d,matcher:_,optional:!!h,rest:!!g,chained:g?f===1&&i[0]==="":!1}),g?"(.*?)":h?"([^/]*)?":"([^/]+?)"}return le(c)}).join("")}).join("")}/?$`),params:n}}function Et(e){return!/^\([^)]+\)$/.test(e)}function kt(e){return e.slice(1).split("/").filter(Et)}function St(e,n,t){const a={},r=e.slice(1),o=r.filter(s=>s!==void 0);let i=0;for(let s=0;su).join("/"),i=0),f===void 0){c.rest&&(a[c.name]="");continue}if(!c.matcher||t[c.matcher](f)){a[c.name]=f;const u=n[s+1],h=r[s+1];u&&!u.rest&&u.optional&&h&&c.chained&&(i=0),!u&&!h&&Object.keys(a).length===o.length&&(i=0);continue}if(c.optional&&c.chained){i++;continue}return}if(!i)return a}function le(e){return e.normalize().replace(/[[\]]/g,"\\$&").replace(/%/g,"%25").replace(/\//g,"%2[Ff]").replace(/\?/g,"%3[Ff]").replace(/#/g,"%23").replace(/[.*+?^${}()|\\]/g,"\\$&")}function At({nodes:e,server_loads:n,dictionary:t,matchers:a}){const r=new Set(n);return Object.entries(t).map(([s,[c,f,u]])=>{const{pattern:h,params:g}=bt(s),d={id:s,exec:_=>{const l=h.exec(_);if(l)return St(l,g,a)},errors:[1,...u||[]].map(_=>e[_]),layouts:[0,...f||[]].map(i),leaf:o(c)};return d.errors.length=d.layouts.length=Math.max(d.errors.length,d.layouts.length),d});function o(s){const c=s<0;return c&&(s=~s),[c,e[s]]}function i(s){return s===void 0?s:[r.has(s),e[s]]}}function Ce(e,n=JSON.parse){try{return n(sessionStorage[e])}catch{}}function Ie(e,n,t=JSON.stringify){const a=t(n);try{sessionStorage[e]=a}catch{}}var je;const P=((je=globalThis.__sveltekit_14s0ct6)==null?void 0:je.base)??"";var De;const Rt=((De=globalThis.__sveltekit_14s0ct6)==null?void 0:De.assets)??P,It="1731457984989",Ve="sveltekit:snapshot",Fe="sveltekit:scroll",qe="sveltekit:states",Lt="sveltekit:pageurl",D="sveltekit:history",M="sveltekit:navigation",J={tap:1,hover:2,viewport:3,eager:4,off:-1,false:-1},K=location.origin;function Ge(e){if(e instanceof URL)return e;let n=document.baseURI;if(!n){const t=document.getElementsByTagName("base");n=t.length?t[0].href:document.URL}return new URL(e,n)}function me(){return{x:pageXOffset,y:pageYOffset}}function O(e,n){return e.getAttribute(`data-sveltekit-${n}`)}const Le={...J,"":J.hover};function Me(e){let n=e.assignedSlot??e.parentNode;return(n==null?void 0:n.nodeType)===11&&(n=n.host),n}function He(e,n){for(;e&&e!==n;){if(e.nodeName.toUpperCase()==="A"&&e.hasAttribute("href"))return e;e=Me(e)}}function ue(e,n){let t;try{t=new URL(e instanceof SVGAElement?e.href.baseVal:e.href,document.baseURI)}catch{}const a=e instanceof SVGAElement?e.target.baseVal:e.target,r=!t||!!a||ne(t,n)||(e.getAttribute("rel")||"").split(/\s+/).includes("external"),o=(t==null?void 0:t.origin)===K&&e.hasAttribute("download");return{url:t,external:r,target:a,download:o}}function W(e){let n=null,t=null,a=null,r=null,o=null,i=null,s=e;for(;s&&s!==document.documentElement;)a===null&&(a=O(s,"preload-code")),r===null&&(r=O(s,"preload-data")),n===null&&(n=O(s,"keepfocus")),t===null&&(t=O(s,"noscroll")),o===null&&(o=O(s,"reload")),i===null&&(i=O(s,"replacestate")),s=Me(s);function c(f){switch(f){case"":case"true":return!0;case"off":case"false":return!1;default:return}}return{preload_code:Le[a??"off"],preload_data:Le[r??"off"],keepfocus:c(n),noscroll:c(t),reload:c(o),replace_state:c(i)}}function Pe(e){const n=pe(e);let t=!0;function a(){t=!0,n.update(i=>i)}function r(i){t=!1,n.set(i)}function o(i){let s;return n.subscribe(c=>{(s===void 0||t&&c!==s)&&i(s=c)})}return{notify:a,set:r,subscribe:o}}function Pt(){const{set:e,subscribe:n}=pe(!1);let t;async function a(){clearTimeout(t);try{const r=await fetch(`${Rt}/_app/version.json`,{headers:{pragma:"no-cache","cache-control":"no-cache"}});if(!r.ok)return!1;const i=(await r.json()).version!==It;return i&&(e(!0),clearTimeout(t)),i}catch{return!1}}return{subscribe:n,check:a}}function ne(e,n){return e.origin!==K||!e.pathname.startsWith(n)}const Tt=-1,Ut=-2,xt=-3,Nt=-4,Ot=-5,jt=-6;function Dt(e,n){if(typeof e=="number")return r(e,!0);if(!Array.isArray(e)||e.length===0)throw new Error("Invalid input");const t=e,a=Array(t.length);function r(o,i=!1){if(o===Tt)return;if(o===xt)return NaN;if(o===Nt)return 1/0;if(o===Ot)return-1/0;if(o===jt)return-0;if(i)throw new Error("Invalid input");if(o in a)return a[o];const s=t[o];if(!s||typeof s!="object")a[o]=s;else if(Array.isArray(s))if(typeof s[0]=="string"){const c=s[0],f=n==null?void 0:n[c];if(f)return a[o]=f(r(s[1]));switch(c){case"Date":a[o]=new Date(s[1]);break;case"Set":const u=new Set;a[o]=u;for(let d=1;dn!=null)}class ae{constructor(n,t){this.status=n,typeof t=="string"?this.body={message:t}:t?this.body=t:this.body={message:`Error: ${n}`}}toString(){return JSON.stringify(this.body)}}class Ke{constructor(n,t){this.status=n,this.location=t}}class _e extends Error{constructor(n,t,a){super(a),this.status=n,this.text=t}}const Vt="x-sveltekit-invalidated",Ft="x-sveltekit-trailing-slash";function z(e){return e instanceof ae||e instanceof _e?e.status:500}function qt(e){return e instanceof _e?e.text:"Internal Error"}const N=Ce(Fe)??{},H=Ce(Ve)??{},U={url:Pe({}),page:Pe({}),navigating:pe(null),updated:Pt()};function ye(e){N[e]=me()}function Gt(e,n){let t=e+1;for(;N[t];)delete N[t],t+=1;for(t=n+1;H[t];)delete H[t],t+=1}function C(e){return location.href=e.href,new Promise(()=>{})}function Te(){}let re,de,X,T,he,V;const Ye=[],Z=[];let R=null;const Je=[],Mt=[];let j=[],y={branch:[],error:null,url:null},we=!1,Q=!1,Ue=!0,B=!1,F=!1,We=!1,ve=!1,be,S,L,I,ee;const G=new Set;async function tn(e,n,t){var r,o;document.URL!==location.href&&(location.href=location.href),V=e,re=At(e),T=document.documentElement,he=n,de=e.nodes[0],X=e.nodes[1],de(),X(),S=(r=history.state)==null?void 0:r[D],L=(o=history.state)==null?void 0:o[M],S||(S=L=Date.now(),history.replaceState({...history.state,[D]:S,[M]:L},""));const a=N[S];a&&(history.scrollRestoration="manual",scrollTo(a.x,a.y)),t?await Xt(he,t):Wt(location.href,{replaceState:!0}),zt()}function Ht(){Ye.length=0,ve=!1}function ze(e){Z.some(n=>n==null?void 0:n.snapshot)&&(H[e]=Z.map(n=>{var t;return(t=n==null?void 0:n.snapshot)==null?void 0:t.capture()}))}function Xe(e){var n;(n=H[e])==null||n.forEach((t,a)=>{var r,o;(o=(r=Z[a])==null?void 0:r.snapshot)==null||o.restore(t)})}function xe(){ye(S),Ie(Fe,N),ze(L),Ie(Ve,H)}async function Ze(e,n,t,a){return Y({type:"goto",url:Ge(e),keepfocus:n.keepFocus,noscroll:n.noScroll,replace_state:n.replaceState,state:n.state,redirect_count:t,nav_token:a,accept:()=>{n.invalidateAll&&(ve=!0)}})}async function Bt(e){if(e.id!==(R==null?void 0:R.id)){const n={};G.add(n),R={id:e.id,token:n,promise:et({...e,preload:n}).then(t=>(G.delete(n),t.type==="loaded"&&t.state.error&&(R=null),t))}}return R.promise}async function fe(e){const n=re.find(t=>t.exec(tt(e)));n&&await Promise.all([...n.layouts,n.leaf].map(t=>t==null?void 0:t[1]()))}function Qe(e,n,t){var o;y=e.state;const a=document.querySelector("style[data-sveltekit]");a&&a.remove(),I=e.props.page,be=new V.root({target:n,props:{...e.props,stores:U,components:Z},hydrate:t}),Xe(L);const r={from:null,to:{params:y.params,route:{id:((o=y.route)==null?void 0:o.id)??null},url:new URL(location.href)},willUnload:!1,type:"enter",complete:Promise.resolve()};j.forEach(i=>i(r)),Q=!0}function te({url:e,params:n,branch:t,status:a,error:r,route:o,form:i}){let s="never";if(P&&(e.pathname===P||e.pathname===P+"/"))s="always";else for(const d of t)(d==null?void 0:d.slash)!==void 0&&(s=d.slash);e.pathname=ct(e.pathname,s),e.search=e.search;const c={type:"loaded",state:{url:e,params:n,branch:t,error:r,route:o},props:{constructors:Ct(t).map(d=>d.node.component),page:I}};i!==void 0&&(c.props.form=i);let f={},u=!I,h=0;for(let d=0;d(s&&(c.route=!0),l[m])}),params:new Proxy(a,{get:(l,m)=>(s&&c.params.add(m),l[m])}),data:(o==null?void 0:o.data)??null,url:dt(t,()=>{s&&(c.url=!0)},l=>{s&&c.search_params.add(l)}),async fetch(l,m){let b;l instanceof Request?(b=l.url,m={body:l.method==="GET"||l.method==="HEAD"?void 0:await l.blob(),cache:l.cache,credentials:l.credentials,headers:l.headers,integrity:l.integrity,keepalive:l.keepalive,method:l.method,mode:l.mode,redirect:l.redirect,referrer:l.referrer,referrerPolicy:l.referrerPolicy,signal:l.signal,...m}):b=l;const A=new URL(b,t);return s&&d(A.href),A.origin===t.origin&&(b=A.href.slice(t.origin.length)),Q?wt(b,A.href,m):yt(b,m)},setHeaders:()=>{},depends:d,parent(){return s&&(c.parent=!0),n()},untrack(l){s=!1;try{return l()}finally{s=!0}}};i=await f.universal.load.call(null,_)??null}return{node:f,loader:e,server:o,universal:(h=f.universal)!=null&&h.load?{type:"data",data:i,uses:c}:null,data:i??(o==null?void 0:o.data)??null,slash:((g=f.universal)==null?void 0:g.trailingSlash)??(o==null?void 0:o.slash)}}function Ne(e,n,t,a,r,o){if(ve)return!0;if(!r)return!1;if(r.parent&&e||r.route&&n||r.url&&t)return!0;for(const i of r.search_params)if(a.has(i))return!0;for(const i of r.params)if(o[i]!==y.params[i])return!0;for(const i of r.dependencies)if(Ye.some(s=>s(new URL(i))))return!0;return!1}function ke(e,n){return(e==null?void 0:e.type)==="data"?e:(e==null?void 0:e.type)==="skip"?n??null:null}function Kt(e,n){if(!e)return new Set(n.searchParams.keys());const t=new Set([...e.searchParams.keys(),...n.searchParams.keys()]);for(const a of t){const r=e.searchParams.getAll(a),o=n.searchParams.getAll(a);r.every(i=>o.includes(i))&&o.every(i=>r.includes(i))&&t.delete(a)}return t}function Oe({error:e,url:n,route:t,params:a}){return{type:"loaded",state:{error:e,url:n,route:t,params:a,branch:[]},props:{page:I,constructors:[]}}}async function et({id:e,invalidating:n,url:t,params:a,route:r,preload:o}){if((R==null?void 0:R.id)===e)return G.delete(R.token),R.promise;const{errors:i,layouts:s,leaf:c}=r,f=[...s,c];i.forEach(p=>p==null?void 0:p().catch(()=>{})),f.forEach(p=>p==null?void 0:p[1]().catch(()=>{}));let u=null;const h=y.url?e!==y.url.pathname+y.url.search:!1,g=y.route?r.id!==y.route.id:!1,d=Kt(y.url,t);let _=!1;const l=f.map((p,v)=>{var x;const E=y.branch[v],k=!!(p!=null&&p[0])&&((E==null?void 0:E.loader)!==p[1]||Ne(_,g,h,d,(x=E.server)==null?void 0:x.uses,a));return k&&(_=!0),k});if(l.some(Boolean)){try{u=await rt(t,l)}catch(p){const v=await $(p,{url:t,params:a,route:{id:e}});return G.has(o)?Oe({error:v,url:t,params:a,route:r}):oe({status:z(p),error:v,url:t,route:r})}if(u.type==="redirect")return u}const m=u==null?void 0:u.nodes;let b=!1;const A=f.map(async(p,v)=>{var se;if(!p)return;const E=y.branch[v],k=m==null?void 0:m[v];if((!k||k.type==="skip")&&p[1]===(E==null?void 0:E.loader)&&!Ne(b,g,h,d,(se=E.universal)==null?void 0:se.uses,a))return E;if(b=!0,(k==null?void 0:k.type)==="error")throw k;return Ee({loader:p[1],url:t,params:a,route:r,parent:async()=>{var Re;const Ae={};for(let ie=0;ie{});const w=[];for(let p=0;pPromise.resolve({}),server_data_node:ke(o)}),c={node:await X(),loader:X,universal:null,server:null,data:null};return te({url:t,params:r,branch:[s,c],status:e,error:n,route:null})}function Se(e,n){if(!e||ne(e,P))return;let t;try{t=V.hooks.reroute({url:new URL(e)})??e.pathname}catch{return}const a=tt(t);for(const r of re){const o=r.exec(a);if(o)return{id:e.pathname+e.search,invalidating:n,route:r,params:ft(o),url:e}}}function tt(e){return lt(e.slice(P.length)||"/")}function nt({url:e,type:n,intent:t,delta:a}){let r=!1;const o=st(y,t,e,n);a!==void 0&&(o.navigation.delta=a);const i={...o.navigation,cancel:()=>{r=!0,o.reject(new Error("navigation cancelled"))}};return B||Je.forEach(s=>s(i)),r?null:o}async function Y({type:e,url:n,popped:t,keepfocus:a,noscroll:r,replace_state:o,state:i={},redirect_count:s=0,nav_token:c={},accept:f=Te,block:u=Te}){const h=Se(n,!1),g=nt({url:n,type:e,delta:t==null?void 0:t.delta,intent:h});if(!g){u();return}const d=S,_=L;f(),B=!0,Q&&U.navigating.set(g.navigation),ee=c;let l=h&&await et(h);if(!l){if(ne(n,P))return await C(n);l=await at(n,{id:null},await $(new _e(404,"Not Found",`Not found: ${n.pathname}`),{url:n,params:{},route:{id:null}}),404)}if(n=(h==null?void 0:h.url)||n,ee!==c)return g.reject(new Error("navigation aborted")),!1;if(l.type==="redirect")if(s>=20)l=await oe({status:500,error:await $(new Error("Redirect loop"),{url:n,params:{},route:{id:null}}),url:n,route:{id:null}});else return Ze(new URL(l.location,n).href,{},s+1,c),!1;else l.props.page.status>=400&&await U.updated.check()&&await C(n);if(Ht(),ye(d),ze(_),l.props.page.url.pathname!==n.pathname&&(n.pathname=l.props.page.url.pathname),i=t?t.state:i,!t){const w=o?0:1,p={[D]:S+=w,[M]:L+=w,[qe]:i};(o?history.replaceState:history.pushState).call(history,p,"",n),o||Gt(S,L)}if(R=null,l.props.page.state=i,Q){y=l.state,l.props.page&&(l.props.page.url=n);const w=(await Promise.all(Mt.map(p=>p(g.navigation)))).filter(p=>typeof p=="function");if(w.length>0){let p=function(){j=j.filter(v=>!w.includes(v))};w.push(p),j.push(...w)}be.$set(l.props),We=!0}else Qe(l,he,!1);const{activeElement:m}=document;await it();const b=t?t.scroll:r?me():null;if(Ue){const w=n.hash&&document.getElementById(decodeURIComponent(n.hash.slice(1)));b?scrollTo(b.x,b.y):w?w.scrollIntoView():scrollTo(0,0)}const A=document.activeElement!==m&&document.activeElement!==document.body;!a&&!A&&Zt(),Ue=!0,l.props.page&&(I=l.props.page),B=!1,e==="popstate"&&Xe(L),g.fulfil(void 0),j.forEach(w=>w(g.navigation)),U.navigating.set(null)}async function at(e,n,t,a){return e.origin===K&&e.pathname===location.pathname&&!we?await oe({status:a,error:t,url:e,route:n}):await C(e)}function Jt(){let e;T.addEventListener("mousemove",o=>{const i=o.target;clearTimeout(e),e=setTimeout(()=>{a(i,2)},20)});function n(o){a(o.composedPath()[0],1)}T.addEventListener("mousedown",n),T.addEventListener("touchstart",n,{passive:!0});const t=new IntersectionObserver(o=>{for(const i of o)i.isIntersecting&&(fe(i.target.href),t.unobserve(i.target))},{threshold:0});function a(o,i){const s=He(o,T);if(!s)return;const{url:c,external:f,download:u}=ue(s,P);if(f||u)return;const h=W(s);if(!h.reload)if(i<=h.preload_data){const g=Se(c,!1);g&&Bt(g)}else i<=h.preload_code&&fe(c.pathname)}function r(){t.disconnect();for(const o of T.querySelectorAll("a")){const{url:i,external:s,download:c}=ue(o,P);if(s||c)continue;const f=W(o);f.reload||(f.preload_code===J.viewport&&t.observe(o),f.preload_code===J.eager&&fe(i.pathname))}}j.push(r),r()}function $(e,n){if(e instanceof ae)return e.body;const t=z(e),a=qt(e);return V.hooks.handleError({error:e,event:n,status:t,message:a})??{message:a}}function Wt(e,n={}){return e=Ge(e),e.origin!==K?Promise.reject(new Error("goto: invalid URL")):Ze(e,n,0)}function zt(){var n;history.scrollRestoration="manual",addEventListener("beforeunload",t=>{let a=!1;if(xe(),!B){const r=st(y,void 0,null,"leave"),o={...r.navigation,cancel:()=>{a=!0,r.reject(new Error("navigation cancelled"))}};Je.forEach(i=>i(o))}a?(t.preventDefault(),t.returnValue=""):history.scrollRestoration="auto"}),addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&xe()}),(n=navigator.connection)!=null&&n.saveData||Jt(),T.addEventListener("click",async t=>{var g;if(t.button||t.which!==1||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey||t.defaultPrevented)return;const a=He(t.composedPath()[0],T);if(!a)return;const{url:r,external:o,target:i,download:s}=ue(a,P);if(!r)return;if(i==="_parent"||i==="_top"){if(window.parent!==window)return}else if(i&&i!=="_self")return;const c=W(a);if(!(a instanceof SVGAElement)&&r.protocol!==location.protocol&&!(r.protocol==="https:"||r.protocol==="http:")||s)return;if(o||c.reload){nt({url:r,type:"link"})?B=!0:t.preventDefault();return}const[u,h]=r.href.split("#");if(h!==void 0&&u===ce(location)){const[,d]=y.url.href.split("#");if(d===h){t.preventDefault(),h===""||h==="top"&&a.ownerDocument.getElementById("top")===null?window.scrollTo({top:0}):(g=a.ownerDocument.getElementById(h))==null||g.scrollIntoView();return}if(F=!0,ye(S),e(r),!c.replace_state)return;F=!1}t.preventDefault(),await new Promise(d=>{requestAnimationFrame(()=>{setTimeout(d,0)}),setTimeout(d,100)}),Y({type:"link",url:r,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??r.href===location.href})}),T.addEventListener("submit",t=>{if(t.defaultPrevented)return;const a=HTMLFormElement.prototype.cloneNode.call(t.target),r=t.submitter;if(((r==null?void 0:r.formMethod)||a.method)!=="get")return;const i=new URL((r==null?void 0:r.hasAttribute("formaction"))&&(r==null?void 0:r.formAction)||a.action);if(ne(i,P))return;const s=t.target,c=W(s);if(c.reload)return;t.preventDefault(),t.stopPropagation();const f=new FormData(s),u=r==null?void 0:r.getAttribute("name");u&&f.append(u,(r==null?void 0:r.getAttribute("value"))??""),i.search=new URLSearchParams(f).toString(),Y({type:"form",url:i,keepfocus:c.keepfocus,noscroll:c.noscroll,replace_state:c.replace_state??i.href===location.href})}),addEventListener("popstate",async t=>{var a;if((a=t.state)!=null&&a[D]){const r=t.state[D];if(ee={},r===S)return;const o=N[r],i=t.state[qe]??{},s=new URL(t.state[Lt]??location.href),c=t.state[M],f=ce(location)===ce(y.url);if(c===L&&(We||f)){e(s),N[S]=me(),o&&scrollTo(o.x,o.y),i!==I.state&&(I={...I,state:i},be.$set({page:I})),S=r;return}const h=r-S;await Y({type:"popstate",url:s,popped:{state:i,scroll:o,delta:h},accept:()=>{S=r,L=c},block:()=>{history.go(-h)},nav_token:ee})}else if(!F){const r=new URL(location.href);e(r)}}),addEventListener("hashchange",()=>{F&&(F=!1,history.replaceState({...history.state,[D]:++S,[M]:L},"",location.href))});for(const t of document.querySelectorAll("link"))t.rel==="icon"&&(t.href=t.href);addEventListener("pageshow",t=>{t.persisted&&U.navigating.set(null)});function e(t){y.url=t,U.page.set({...I,url:t}),U.page.notify()}}async function Xt(e,{status:n=200,error:t,node_ids:a,params:r,route:o,data:i,form:s}){we=!0;const c=new URL(location.href);({params:r={},route:o={id:null}}=Se(c,!1)||{});let f;try{const u=a.map(async(d,_)=>{const l=i[_];return l!=null&&l.uses&&(l.uses=ot(l.uses)),Ee({loader:V.nodes[d],url:c,params:r,route:o,parent:async()=>{const m={};for(let b=0;b<_;b+=1)Object.assign(m,(await u[b]).data);return m},server_data_node:ke(l)})}),h=await Promise.all(u),g=re.find(({id:d})=>d===o.id);if(g){const d=g.layouts;for(let _=0;_o?"1":"0").join(""));const a=await $e(t.href);if(!a.ok){let o;throw(r=a.headers.get("content-type"))!=null&&r.includes("application/json")?o=await a.json():a.status===404?o="Not Found":a.status===500&&(o="Internal Error"),new ae(a.status,o)}return new Promise(async o=>{var h;const i=new Map,s=a.body.getReader(),c=new TextDecoder;function f(g){return Dt(g,{Promise:d=>new Promise((_,l)=>{i.set(d,{fulfil:_,reject:l})})})}let u="";for(;;){const{done:g,value:d}=await s.read();if(g&&!u)break;for(u+=!d&&u?` -`:c.decode(d,{stream:!0});;){const _=u.indexOf(` -`);if(_===-1)break;const l=JSON.parse(u.slice(0,_));if(u=u.slice(_+1),l.type==="redirect")return o(l);if(l.type==="data")(h=l.nodes)==null||h.forEach(m=>{(m==null?void 0:m.type)==="data"&&(m.uses=ot(m.uses),m.data=f(m.data))}),o(l);else if(l.type==="chunk"){const{id:m,data:b,error:A}=l,w=i.get(m);i.delete(m),A?w.reject(f(A)):w.fulfil(f(b))}}}})}function ot(e){return{dependencies:new Set((e==null?void 0:e.dependencies)??[]),params:new Set((e==null?void 0:e.params)??[]),parent:!!(e!=null&&e.parent),route:!!(e!=null&&e.route),url:!!(e!=null&&e.url),search_params:new Set((e==null?void 0:e.search_params)??[])}}function Zt(){const e=document.querySelector("[autofocus]");if(e)e.focus();else{const n=document.body,t=n.getAttribute("tabindex");n.tabIndex=-1,n.focus({preventScroll:!0,focusVisible:!1}),t!==null?n.setAttribute("tabindex",t):n.removeAttribute("tabindex");const a=getSelection();if(a&&a.type!=="None"){const r=[];for(let o=0;o{if(a.rangeCount===r.length){for(let o=0;o{r=u,o=h});return i.catch(()=>{}),{navigation:{from:{params:e.params,route:{id:((c=e.route)==null?void 0:c.id)??null},url:e.url},to:t&&{params:(n==null?void 0:n.params)??null,route:{id:((f=n==null?void 0:n.route)==null?void 0:f.id)??null},url:t},willUnload:!n,type:a,complete:i},fulfil:r,reject:o}}export{tn as a,U as s}; diff --git a/_app/immutable/entry/app.Ce-R73AD.js b/_app/immutable/entry/app.BlBisTE_.js similarity index 96% rename from _app/immutable/entry/app.Ce-R73AD.js rename to _app/immutable/entry/app.BlBisTE_.js index d5fcfff..6d91644 100644 --- a/_app/immutable/entry/app.Ce-R73AD.js +++ b/_app/immutable/entry/app.BlBisTE_.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.COVN2ZcP.js","../chunks/disclose-version.CJ6P83X4.js","../chunks/runtime.BRAqMMCI.js","../chunks/misc.ChbGwrX_.js","../assets/0.BV1EeJyM.css","../nodes/1.BCf2ArRQ.js","../chunks/render.BMiLFty_.js","../chunks/store.iSMRLC3g.js","../chunks/index.DM8_DTYB.js","../chunks/entry.COc-_zOz.js","../nodes/2.D75nbMw1.js","../chunks/index-client.Dsykefas.js","../assets/2.2nFAMOmY.css"])))=>i.map(i=>d[i]); -var q=t=>{throw TypeError(t)};var z=(t,e,n)=>e.has(t)||q("Cannot "+n);var u=(t,e,n)=>(z(t,e,"read from private field"),n?n.call(t):e.get(t)),T=(t,e,n)=>e.has(t)?q("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),A=(t,e,n,o)=>(z(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n);import{O as J,P as X,S as d,Q as p,R as $,k as Z,D as x,i as ee,s as y,F,g as v,x as te,d as ne,T as se,y as re,w as ae,A as oe,U as ie,m as ce,p as fe,u as le,b as ue,V as de,a as he,t as me}from"../chunks/runtime.BRAqMMCI.js";import{h as _e,m as ye,u as ge,s as ve}from"../chunks/render.BMiLFty_.js";import{U as k,h as K,b as be,j as we,f as L,p as D,a as P,s as M,t as Q,c as Re,z as Ee,r as Pe}from"../chunks/disclose-version.CJ6P83X4.js";import{p as I,o as xe,i as C,b as j}from"../chunks/index-client.Dsykefas.js";function O(t,e=null,n){if(typeof t=="object"&&t!=null&&!J(t)&&!(X in t)){if(d in t){const s=t[d];if(s.t===t||s.p===t)return s.p}const o=se(t);if(o===p||o===$){const s=new Proxy(t,ke);return Z(t,d,{value:{s:new Map,v:x(0),a:ee(t),p:s,t},writable:!0,enumerable:!1}),s}}return t}function N(t,e=1){y(t,t.v+e)}const ke={defineProperty(t,e,n){if(n.value){const o=t[d],s=o.s.get(e);s!==void 0&&y(s,O(n.value,o))}return Reflect.defineProperty(t,e,n)},deleteProperty(t,e){const n=t[d],o=n.s.get(e),s=n.a,r=delete t[e];if(s&&r){const a=n.s.get("length"),c=t.length-1;a!==void 0&&a.v!==c&&y(a,c)}return o!==void 0&&y(o,k),r&&N(n.v),r},get(t,e,n){var r;if(e===d)return Reflect.get(t,d);const o=t[d];let s=o.s.get(e);if(s===void 0&&(!(e in t)||(r=F(t,e))!=null&&r.writable)&&(s=x(O(t[e],o)),o.s.set(e,s)),s!==void 0){const a=v(s);return a===k?void 0:a}return Reflect.get(t,e,n)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n&&"value"in n){const s=t[d].s.get(e);s&&(n.value=v(s))}return n},has(t,e){var r;if(e===d)return!0;const n=t[d],o=Reflect.has(t,e);let s=n.s.get(e);return(s!==void 0||te!==null&&(!o||(r=F(t,e))!=null&&r.writable))&&(s===void 0&&(s=x(o?O(t[e],n):k),n.s.set(e,s)),v(s)===k)?!1:o},set(t,e,n,o){const s=t[d];let r=s.s.get(e);r===void 0&&(ne(()=>o[e]),r=s.s.get(e)),r!==void 0&&y(r,O(n,s));const a=s.a,c=!(e in t);if(a&&e==="length")for(let l=n;l{s!==(s=e())&&(r&&(oe(r),r=null),s&&(r=ae(()=>n(o,s))))}),K&&(o=we)}function Oe(t){return class extends Se{constructor(e){super({component:t,...e})}}}var w,h;class Se{constructor(e){T(this,w);T(this,h);var n=new Map,o=(r,a)=>{var c=ce(a);return n.set(r,c),c};const s=new Proxy({...e.props||{},$$events:{}},{get(r,a){return v(n.get(a)??o(a,Reflect.get(r,a)))},has(r,a){return v(n.get(a)??o(a,Reflect.get(r,a))),Reflect.has(r,a)},set(r,a,c){return y(n.get(a)??o(a,c),c),Reflect.set(r,a,c)}});A(this,h,(e.hydrate?_e:ye)(e.component,{target:e.target,props:s,context:e.context,intro:e.intro??!1,recover:e.recover})),ie(),A(this,w,s.$$events);for(const r of Object.keys(u(this,h)))r==="$set"||r==="$destroy"||r==="$on"||Z(this,r,{get(){return u(this,h)[r]},set(a){u(this,h)[r]=a},enumerable:!0});u(this,h).$set=r=>{Object.assign(s,r)},u(this,h).$destroy=()=>{ge(u(this,h))}}$set(e){u(this,h).$set(e)}$on(e,n){u(this,w)[e]=u(this,w)[e]||[];const o=(...s)=>n.call(this,...s);return u(this,w)[e].push(o),()=>{u(this,w)[e]=u(this,w)[e].filter(s=>s!==o)}}$destroy(){u(this,h).$destroy()}}w=new WeakMap,h=new WeakMap;const Le="modulepreload",Te=function(t,e){return new URL(t,e).href},Y={},U=function(e,n,o){let s=Promise.resolve();if(n&&n.length>0){const r=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.all(n.map(f=>{if(f=Te(f,o),f in Y)return;Y[f]=!0;const l=f.endsWith(".css"),b=l?'[rel="stylesheet"]':"";if(!!o)for(let m=r.length-1;m>=0;m--){const g=r[m];if(g.href===f&&(!l||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${b}`))return;const i=document.createElement("link");if(i.rel=l?"stylesheet":Le,l||(i.as="script",i.crossOrigin=""),i.href=f,c&&i.setAttribute("nonce",c),document.head.appendChild(i),l)return new Promise((m,g)=>{i.addEventListener("load",m),i.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${f}`)))})}))}return s.then(()=>e()).catch(r=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r})},ze={};var Ae=Q('
'),De=Q(" ",1);function Ie(t,e){fe(e,!0);let n=I(e,"components",15,()=>[]),o=I(e,"data_0",3,null),s=I(e,"data_1",3,null);le(()=>e.stores.page.set(e.page)),ue(()=>{e.stores,e.page,e.constructors,n(),e.form,o(),s(),e.stores.page.notify()});let r=x(!1),a=x(!1),c=x(null);xe(()=>{const R=e.stores.page.subscribe(()=>{v(r)&&(y(a,!0),de().then(()=>{y(c,O(document.title||"untitled page"))}))});return y(r,!0),R});var f=De(),l=L(f);C(l,()=>e.constructors[1],R=>{var i=D(),m=L(i);B(m,()=>e.constructors[0],(g,E)=>{j(E(g,{get data(){return o()},children:(_,Ce)=>{var V=D(),W=L(V);B(W,()=>e.constructors[1],(G,H)=>{j(H(G,{get data(){return s()},get form(){return e.form}}),S=>n()[1]=S,()=>{var S;return(S=n())==null?void 0:S[1]})}),P(_,V)},$$slots:{default:!0}}),_=>n()[0]=_,()=>{var _;return(_=n())==null?void 0:_[0]})}),P(R,i)},R=>{var i=D(),m=L(i);B(m,()=>e.constructors[0],(g,E)=>{j(E(g,{get data(){return o()},get form(){return e.form}}),_=>n()[0]=_,()=>{var _;return(_=n())==null?void 0:_[0]})}),P(R,i)});var b=M(M(l,!0));C(b,()=>v(r),R=>{var i=Ae(),m=Re(i);C(m,()=>v(a),g=>{var E=Ee();me(()=>ve(E,v(c))),P(g,E)}),Pe(i),P(R,i)}),P(t,f),he()}const Fe=Oe(Ie),Ke=[()=>U(()=>import("../nodes/0.COVN2ZcP.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),()=>U(()=>import("../nodes/1.BCf2ArRQ.js"),__vite__mapDeps([5,1,2,6,7,8,9]),import.meta.url),()=>U(()=>import("../nodes/2.D75nbMw1.js"),__vite__mapDeps([10,1,2,11,7,8,6,3,12]),import.meta.url)],Me=[],Ne={"/":[2]},Ye={handleError:({error:t})=>{console.error(t)},reroute:()=>{}};export{Ne as dictionary,Ye as hooks,ze as matchers,Ke as nodes,Fe as root,Me as server_loads}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../nodes/0.COVN2ZcP.js","../chunks/disclose-version.CJ6P83X4.js","../chunks/runtime.BRAqMMCI.js","../chunks/misc.ChbGwrX_.js","../assets/0.BV1EeJyM.css","../nodes/1.CU8RZ_vV.js","../chunks/render.BMiLFty_.js","../chunks/store.iSMRLC3g.js","../chunks/index.DM8_DTYB.js","../chunks/entry.B9W1ZgwB.js","../nodes/2.C-dUTPH_.js","../chunks/index-client.Dsykefas.js","../assets/2.2nFAMOmY.css"])))=>i.map(i=>d[i]); +var q=t=>{throw TypeError(t)};var z=(t,e,n)=>e.has(t)||q("Cannot "+n);var u=(t,e,n)=>(z(t,e,"read from private field"),n?n.call(t):e.get(t)),T=(t,e,n)=>e.has(t)?q("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),A=(t,e,n,o)=>(z(t,e,"write to private field"),o?o.call(t,n):e.set(t,n),n);import{O as J,P as X,S as d,Q as p,R as $,k as Z,D as x,i as ee,s as y,F,g as v,x as te,d as ne,T as se,y as re,w as ae,A as oe,U as ie,m as ce,p as fe,u as le,b as ue,V as de,a as he,t as me}from"../chunks/runtime.BRAqMMCI.js";import{h as _e,m as ye,u as ge,s as ve}from"../chunks/render.BMiLFty_.js";import{U as k,h as K,b as be,j as we,f as L,p as D,a as P,s as M,t as Q,c as Re,z as Ee,r as Pe}from"../chunks/disclose-version.CJ6P83X4.js";import{p as I,o as xe,i as C,b as j}from"../chunks/index-client.Dsykefas.js";function O(t,e=null,n){if(typeof t=="object"&&t!=null&&!J(t)&&!(X in t)){if(d in t){const s=t[d];if(s.t===t||s.p===t)return s.p}const o=se(t);if(o===p||o===$){const s=new Proxy(t,ke);return Z(t,d,{value:{s:new Map,v:x(0),a:ee(t),p:s,t},writable:!0,enumerable:!1}),s}}return t}function N(t,e=1){y(t,t.v+e)}const ke={defineProperty(t,e,n){if(n.value){const o=t[d],s=o.s.get(e);s!==void 0&&y(s,O(n.value,o))}return Reflect.defineProperty(t,e,n)},deleteProperty(t,e){const n=t[d],o=n.s.get(e),s=n.a,r=delete t[e];if(s&&r){const a=n.s.get("length"),c=t.length-1;a!==void 0&&a.v!==c&&y(a,c)}return o!==void 0&&y(o,k),r&&N(n.v),r},get(t,e,n){var r;if(e===d)return Reflect.get(t,d);const o=t[d];let s=o.s.get(e);if(s===void 0&&(!(e in t)||(r=F(t,e))!=null&&r.writable)&&(s=x(O(t[e],o)),o.s.set(e,s)),s!==void 0){const a=v(s);return a===k?void 0:a}return Reflect.get(t,e,n)},getOwnPropertyDescriptor(t,e){const n=Reflect.getOwnPropertyDescriptor(t,e);if(n&&"value"in n){const s=t[d].s.get(e);s&&(n.value=v(s))}return n},has(t,e){var r;if(e===d)return!0;const n=t[d],o=Reflect.has(t,e);let s=n.s.get(e);return(s!==void 0||te!==null&&(!o||(r=F(t,e))!=null&&r.writable))&&(s===void 0&&(s=x(o?O(t[e],n):k),n.s.set(e,s)),v(s)===k)?!1:o},set(t,e,n,o){const s=t[d];let r=s.s.get(e);r===void 0&&(ne(()=>o[e]),r=s.s.get(e)),r!==void 0&&y(r,O(n,s));const a=s.a,c=!(e in t);if(a&&e==="length")for(let l=n;l{s!==(s=e())&&(r&&(oe(r),r=null),s&&(r=ae(()=>n(o,s))))}),K&&(o=we)}function Oe(t){return class extends Se{constructor(e){super({component:t,...e})}}}var w,h;class Se{constructor(e){T(this,w);T(this,h);var n=new Map,o=(r,a)=>{var c=ce(a);return n.set(r,c),c};const s=new Proxy({...e.props||{},$$events:{}},{get(r,a){return v(n.get(a)??o(a,Reflect.get(r,a)))},has(r,a){return v(n.get(a)??o(a,Reflect.get(r,a))),Reflect.has(r,a)},set(r,a,c){return y(n.get(a)??o(a,c),c),Reflect.set(r,a,c)}});A(this,h,(e.hydrate?_e:ye)(e.component,{target:e.target,props:s,context:e.context,intro:e.intro??!1,recover:e.recover})),ie(),A(this,w,s.$$events);for(const r of Object.keys(u(this,h)))r==="$set"||r==="$destroy"||r==="$on"||Z(this,r,{get(){return u(this,h)[r]},set(a){u(this,h)[r]=a},enumerable:!0});u(this,h).$set=r=>{Object.assign(s,r)},u(this,h).$destroy=()=>{ge(u(this,h))}}$set(e){u(this,h).$set(e)}$on(e,n){u(this,w)[e]=u(this,w)[e]||[];const o=(...s)=>n.call(this,...s);return u(this,w)[e].push(o),()=>{u(this,w)[e]=u(this,w)[e].filter(s=>s!==o)}}$destroy(){u(this,h).$destroy()}}w=new WeakMap,h=new WeakMap;const Le="modulepreload",Te=function(t,e){return new URL(t,e).href},Y={},U=function(e,n,o){let s=Promise.resolve();if(n&&n.length>0){const r=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=Promise.all(n.map(f=>{if(f=Te(f,o),f in Y)return;Y[f]=!0;const l=f.endsWith(".css"),b=l?'[rel="stylesheet"]':"";if(!!o)for(let m=r.length-1;m>=0;m--){const g=r[m];if(g.href===f&&(!l||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${f}"]${b}`))return;const i=document.createElement("link");if(i.rel=l?"stylesheet":Le,l||(i.as="script",i.crossOrigin=""),i.href=f,c&&i.setAttribute("nonce",c),document.head.appendChild(i),l)return new Promise((m,g)=>{i.addEventListener("load",m),i.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${f}`)))})}))}return s.then(()=>e()).catch(r=>{const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=r,window.dispatchEvent(a),!a.defaultPrevented)throw r})},ze={};var Ae=Q('
'),De=Q(" ",1);function Ie(t,e){fe(e,!0);let n=I(e,"components",15,()=>[]),o=I(e,"data_0",3,null),s=I(e,"data_1",3,null);le(()=>e.stores.page.set(e.page)),ue(()=>{e.stores,e.page,e.constructors,n(),e.form,o(),s(),e.stores.page.notify()});let r=x(!1),a=x(!1),c=x(null);xe(()=>{const R=e.stores.page.subscribe(()=>{v(r)&&(y(a,!0),de().then(()=>{y(c,O(document.title||"untitled page"))}))});return y(r,!0),R});var f=De(),l=L(f);C(l,()=>e.constructors[1],R=>{var i=D(),m=L(i);B(m,()=>e.constructors[0],(g,E)=>{j(E(g,{get data(){return o()},children:(_,Ce)=>{var V=D(),W=L(V);B(W,()=>e.constructors[1],(G,H)=>{j(H(G,{get data(){return s()},get form(){return e.form}}),S=>n()[1]=S,()=>{var S;return(S=n())==null?void 0:S[1]})}),P(_,V)},$$slots:{default:!0}}),_=>n()[0]=_,()=>{var _;return(_=n())==null?void 0:_[0]})}),P(R,i)},R=>{var i=D(),m=L(i);B(m,()=>e.constructors[0],(g,E)=>{j(E(g,{get data(){return o()},get form(){return e.form}}),_=>n()[0]=_,()=>{var _;return(_=n())==null?void 0:_[0]})}),P(R,i)});var b=M(M(l,!0));C(b,()=>v(r),R=>{var i=Ae(),m=Re(i);C(m,()=>v(a),g=>{var E=Ee();me(()=>ve(E,v(c))),P(g,E)}),Pe(i),P(R,i)}),P(t,f),he()}const Fe=Oe(Ie),Ke=[()=>U(()=>import("../nodes/0.COVN2ZcP.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url),()=>U(()=>import("../nodes/1.CU8RZ_vV.js"),__vite__mapDeps([5,1,2,6,7,8,9]),import.meta.url),()=>U(()=>import("../nodes/2.C-dUTPH_.js"),__vite__mapDeps([10,1,2,11,7,8,6,3,12]),import.meta.url)],Me=[],Ne={"/":[2]},Ye={handleError:({error:t})=>{console.error(t)},reroute:()=>{}};export{Ne as dictionary,Ye as hooks,ze as matchers,Ke as nodes,Fe as root,Me as server_loads}; diff --git a/_app/immutable/entry/start.CNtUyZog.js b/_app/immutable/entry/start.CNtUyZog.js deleted file mode 100644 index efb49fb..0000000 --- a/_app/immutable/entry/start.CNtUyZog.js +++ /dev/null @@ -1 +0,0 @@ -import{a as t}from"../chunks/entry.COc-_zOz.js";export{t as start}; diff --git a/_app/immutable/entry/start.CmVtWw0D.js b/_app/immutable/entry/start.CmVtWw0D.js new file mode 100644 index 0000000..2be45fa --- /dev/null +++ b/_app/immutable/entry/start.CmVtWw0D.js @@ -0,0 +1 @@ +import{a as t}from"../chunks/entry.B9W1ZgwB.js";export{t as start}; diff --git a/_app/immutable/nodes/1.BCf2ArRQ.js b/_app/immutable/nodes/1.CU8RZ_vV.js similarity index 91% rename from _app/immutable/nodes/1.BCf2ArRQ.js rename to _app/immutable/nodes/1.CU8RZ_vV.js index baec876..236e547 100644 --- a/_app/immutable/nodes/1.BCf2ArRQ.js +++ b/_app/immutable/nodes/1.CU8RZ_vV.js @@ -1 +1 @@ -import{f,c as i,s as n,a as v,t as d,r as c}from"../chunks/disclose-version.CJ6P83X4.js";import{p as h,t as l,a as _}from"../chunks/runtime.BRAqMMCI.js";import{s as g}from"../chunks/render.BMiLFty_.js";import{s as $,i as x,a as E}from"../chunks/store.iSMRLC3g.js";import{s as S}from"../chunks/entry.COc-_zOz.js";const j=()=>{const s=S;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},k={subscribe(s){return j().page.subscribe(s)}};var q=d("

",1);function C(s,e){h(e,!1);const m=$(),r=()=>E(k,"$page",m);x();var a=q(),t=f(a),u=i(t);c(t);var o=n(n(t,!0)),b=i(o);c(o),l(()=>{var p;g(u,r().status),g(b,(p=r().error)==null?void 0:p.message)}),v(s,a),_()}export{C as component}; +import{f,c as i,s as n,a as v,t as d,r as c}from"../chunks/disclose-version.CJ6P83X4.js";import{p as h,t as l,a as _}from"../chunks/runtime.BRAqMMCI.js";import{s as g}from"../chunks/render.BMiLFty_.js";import{s as $,i as x,a as E}from"../chunks/store.iSMRLC3g.js";import{s as S}from"../chunks/entry.B9W1ZgwB.js";const j=()=>{const s=S;return{page:{subscribe:s.page.subscribe},navigating:{subscribe:s.navigating.subscribe},updated:s.updated}},k={subscribe(s){return j().page.subscribe(s)}};var q=d("

",1);function C(s,e){h(e,!1);const m=$(),r=()=>E(k,"$page",m);x();var a=q(),t=f(a),u=i(t);c(t);var o=n(n(t,!0)),b=i(o);c(o),l(()=>{var p;g(u,r().status),g(b,(p=r().error)==null?void 0:p.message)}),v(s,a),_()}export{C as component}; diff --git a/_app/immutable/nodes/2.D75nbMw1.js b/_app/immutable/nodes/2.C-dUTPH_.js similarity index 87% rename from _app/immutable/nodes/2.D75nbMw1.js rename to _app/immutable/nodes/2.C-dUTPH_.js index 4fccda4..f67d8b6 100644 --- a/_app/immutable/nodes/2.D75nbMw1.js +++ b/_app/immutable/nodes/2.C-dUTPH_.js @@ -3,10 +3,10 @@ var DS=Object.defineProperty;var PS=(r,e,n)=>e in r?DS(r,e,{enumerable:!0,config * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 */const Lb=Symbol("Comlink.proxy"),AI=Symbol("Comlink.endpoint"),EI=Symbol("Comlink.releaseProxy"),gg=Symbol("Comlink.finalizer"),Mf=Symbol("Comlink.thrown"),zb=r=>typeof r=="object"&&r!==null||typeof r=="function",CI={canHandle:r=>zb(r)&&r[Lb],serialize(r){const{port1:e,port2:n}=new MessageChannel;return Hp(r,e),[n,[n]]},deserialize(r){return r.start(),Og(r)}},MI={canHandle:r=>zb(r)&&Mf in r,serialize({value:r}){let e;return r instanceof Error?e={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:e={isError:!1,value:r},[e,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},Bb=new Map([["proxy",CI],["throw",MI]]);function DI(r,e){for(const n of r)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function Hp(r,e=globalThis,n=["*"]){e.addEventListener("message",function l(p){if(!p||!p.data)return;if(!DI(n,p.origin)){console.warn(`Invalid origin '${p.origin}' for comlink proxy`);return}const{id:v,type:b,path:c}=Object.assign({path:[]},p.data),A=(p.data.argumentList||[]).map(Ml);let T;try{const z=c.slice(0,-1).reduce((U,j)=>U[j],r),B=c.reduce((U,j)=>U[j],r);switch(b){case"GET":T=B;break;case"SET":z[c.slice(-1)[0]]=Ml(p.data.value),T=!0;break;case"APPLY":T=B.apply(z,A);break;case"CONSTRUCT":{const U=new B(...A);T=FI(U)}break;case"ENDPOINT":{const{port1:U,port2:j}=new MessageChannel;Hp(r,j),T=RI(U,[U])}break;case"RELEASE":T=void 0;break;default:return}}catch(z){T={value:z,[Mf]:0}}Promise.resolve(T).catch(z=>({value:z,[Mf]:0})).then(z=>{const[B,U]=Kf(z);e.postMessage(Object.assign(Object.assign({},B),{id:v}),U),b==="RELEASE"&&(e.removeEventListener("message",l),Rb(e),gg in r&&typeof r[gg]=="function"&&r[gg]())}).catch(z=>{const[B,U]=Kf({value:new TypeError("Unserializable return value"),[Mf]:0});e.postMessage(Object.assign(Object.assign({},B),{id:v}),U)})}),e.start&&e.start()}function PI(r){return r.constructor.name==="MessagePort"}function Rb(r){PI(r)&&r.close()}function Og(r,e){return Ng(r,[],e)}function vf(r){if(r)throw new Error("Proxy has been released and is not useable")}function Fb(r){return Pc(r,{type:"RELEASE"}).then(()=>{Rb(r)})}const Hf=new WeakMap,Yf="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const e=(Hf.get(r)||0)-1;Hf.set(r,e),e===0&&Fb(r)});function LI(r,e){const n=(Hf.get(e)||0)+1;Hf.set(e,n),Yf&&Yf.register(r,e,r)}function zI(r){Yf&&Yf.unregister(r)}function Ng(r,e=[],n=function(){}){let l=!1;const p=new Proxy(n,{get(v,b){if(vf(l),b===EI)return()=>{zI(p),Fb(r),l=!0};if(b==="then"){if(e.length===0)return{then:()=>p};const c=Pc(r,{type:"GET",path:e.map(A=>A.toString())}).then(Ml);return c.then.bind(c)}return Ng(r,[...e,b])},set(v,b,c){vf(l);const[A,T]=Kf(c);return Pc(r,{type:"SET",path:[...e,b].map(z=>z.toString()),value:A},T).then(Ml)},apply(v,b,c){vf(l);const A=e[e.length-1];if(A===AI)return Pc(r,{type:"ENDPOINT"}).then(Ml);if(A==="bind")return Ng(r,e.slice(0,-1));const[T,z]=lv(c);return Pc(r,{type:"APPLY",path:e.map(B=>B.toString()),argumentList:T},z).then(Ml)},construct(v,b){vf(l);const[c,A]=lv(b);return Pc(r,{type:"CONSTRUCT",path:e.map(T=>T.toString()),argumentList:c},A).then(Ml)}});return LI(p,r),p}function BI(r){return Array.prototype.concat.apply([],r)}function lv(r){const e=r.map(Kf);return[e.map(n=>n[0]),BI(e.map(n=>n[1]))]}const Ob=new WeakMap;function RI(r,e){return Ob.set(r,e),r}function FI(r){return Object.assign(r,{[Lb]:!0})}function Kf(r){for(const[e,n]of Bb)if(n.canHandle(r)){const[l,p]=n.serialize(r);return[{type:"HANDLER",name:e,value:l},p]}return[{type:"RAW",value:r},Ob.get(r)||[]]}function Ml(r){switch(r.type){case"HANDLER":return Bb.get(r.name).deserialize(r.value);case"RAW":return r.value}}function Pc(r,e,n){return new Promise(l=>{const p=OI();r.addEventListener("message",function v(b){!b.data||!b.data.id||b.data.id!==p||(r.removeEventListener("message",v),l(b.data))}),r.start&&r.start(),r.postMessage(Object.assign({id:p},e),n)})}function OI(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let fr,Dl=0,Th=null;function Df(){return(Th===null||Th.byteLength===0)&&(Th=new Uint8Array(fr.memory.buffer)),Th}const Pf=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},NI=typeof Pf.encodeInto=="function"?function(r,e){return Pf.encodeInto(r,e)}:function(r,e){const n=Pf.encode(r);return e.set(n),{read:r.length,written:n.length}};function kh(r,e,n){if(n===void 0){const c=Pf.encode(r),A=e(c.length,1)>>>0;return Df().subarray(A,A+c.length).set(c),Dl=c.length,A}let l=r.length,p=e(l,1)>>>0;const v=Df();let b=0;for(;b127)break;v[p+b]=c}if(b!==l){b!==0&&(r=r.slice(b)),p=n(p,l,l=b+r.length*3,1)>>>0;const c=Df().subarray(p+b,p+l),A=NI(r,c);b+=A.written,p=n(p,l,b,1)>>>0}return Dl=b,p}function vh(r){return r==null}let El=null;function Zs(){return(El===null||El.buffer.detached===!0||El.buffer.detached===void 0&&El.buffer!==fr.memory.buffer)&&(El=new DataView(fr.memory.buffer)),El}const Nb=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&Nb.decode();function Ea(r,e){return r=r>>>0,Nb.decode(Df().subarray(r,r+e))}function Ug(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const p=r.description;return p==null?"Symbol":`Symbol(${p})`}if(e=="function"){const p=r.name;return typeof p=="string"&&p.length>0?`Function(${p})`:"Function"}if(Array.isArray(r)){const p=r.length;let v="[";p>0&&(v+=Ug(r[0]));for(let b=1;b1)l=n[1];else return toString.call(r);if(l=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} -${r.stack}`:l}const cv=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>{fr.__wbindgen_export_3.get(r.dtor)(r.a,r.b)});function UI(r,e,n,l){const p={a:r,b:e,cnt:1,dtor:n},v=(...b)=>{p.cnt++;const c=p.a;p.a=0;try{return l(c,p.b,...b)}finally{--p.cnt===0?(fr.__wbindgen_export_3.get(p.dtor)(c,p.b),cv.unregister(p)):p.a=c}};return v.original=p,cv.register(v,p,p),v}function $I(r,e,n){fr.closure1077_externref_shim(r,e,n)}function VI(r){const e=fr.__wbindgen_export_2.get(r);return fr.__externref_table_dealloc(r),e}function kl(r){return()=>{throw new Error(`${r} is not defined`)}}function jI(r){const e=fr.__externref_table_alloc();return fr.__wbindgen_export_2.set(e,r),e}function vn(r,e){try{return r.apply(this,e)}catch(n){const l=jI(n);fr.__wbindgen_exn_store(l)}}function qI(r,e,n,l){fr.closure14367_externref_shim(r,e,n,l)}const GI=["omit","same-origin","include"],ZI=["same-origin","no-cors","cors","navigate"],uv=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>fr.__wbg_backend_free(r>>>0,1));class Yp{static __wrap(e){e=e>>>0;const n=Object.create(Yp.prototype);return n.__wbg_ptr=e,uv.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,uv.unregister(this),e}free(){const e=this.__destroy_into_raw();fr.__wbg_backend_free(e,0)}constructor(){return fr.backend_new()}getCountries(){return fr.backend_getCountries(this.__wbg_ptr)}search(e,n){return fr.backend_search(this.__wbg_ptr,e,n)}downloadMetrics(e){return fr.backend_downloadMetrics(this.__wbg_ptr,e)}downloadMetricsSql(e){return fr.backend_downloadMetricsSql(this.__wbg_ptr,e)}downloadGeoms(e){return fr.backend_downloadGeoms(this.__wbg_ptr,e)}downloadDataRequest(e,n){const l=kh(n,fr.__wbindgen_malloc,fr.__wbindgen_realloc),p=Dl;return fr.backend_downloadDataRequest(this.__wbg_ptr,e,l,p)}downloadDataRequestMetrics(e){return fr.backend_downloadDataRequestMetrics(this.__wbg_ptr,e)}downloadDataRequestMetricsSql(e){return fr.backend_downloadDataRequestMetricsSql(this.__wbg_ptr,e)}downloadDataRequestGeoms(e){return fr.backend_downloadDataRequestGeoms(this.__wbg_ptr,e)}downloadDataRequestGeomsPmtiles(e){return fr.backend_downloadDataRequestGeomsPmtiles(this.__wbg_ptr,e)}addColours(e){let n,l;try{const b=fr.backend_addColours(this.__wbg_ptr,e);var p=b[0],v=b[1];if(b[3])throw p=0,v=0,VI(b[2]);return n=p,l=v,Ea(p,v)}finally{fr.__wbindgen_free(n,l,1)}}}async function WI(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(l){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",l);else throw l}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}}function HI(){const r={};return r.wbg={},r.wbg.__wbg_backend_new=function(e){return Yp.__wrap(e)},r.wbg.__wbindgen_string_get=function(e,n){const l=n,p=typeof l=="string"?l:void 0;var v=vh(p)?0:kh(p,fr.__wbindgen_malloc,fr.__wbindgen_realloc),b=Dl;Zs().setInt32(e+4*1,b,!0),Zs().setInt32(e+4*0,v,!0)},r.wbg.__wbindgen_string_new=function(e,n){return Ea(e,n)},r.wbg.__wbindgen_error_new=function(e,n){return new Error(Ea(e,n))},r.wbg.__wbindgen_boolean_get=function(e){const n=e;return typeof n=="boolean"?n?1:0:2},r.wbg.__wbindgen_is_bigint=function(e){return typeof e=="bigint"},r.wbg.__wbindgen_number_get=function(e,n){const l=n,p=typeof l=="number"?l:void 0;Zs().setFloat64(e+8*1,vh(p)?0:p,!0),Zs().setInt32(e+4*0,!vh(p),!0)},r.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},r.wbg.__wbindgen_in=function(e,n){return e in n},r.wbg.__wbindgen_bigint_from_i64=function(e){return e},r.wbg.__wbindgen_jsval_eq=function(e,n){return e===n},r.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},r.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},r.wbg.__wbindgen_is_undefined=function(e){return e===void 0},r.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},r.wbg.__wbindgen_jsval_loose_eq=function(e,n){return e==n},r.wbg.__wbindgen_as_number=function(e){return+e},r.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(e,n){return e[n]},r.wbg.__wbg_new_abda76e883ba8a5f=function(){return new Error},r.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const l=n.stack,p=kh(l,fr.__wbindgen_malloc,fr.__wbindgen_realloc),v=Dl;Zs().setInt32(e+4*1,v,!0),Zs().setInt32(e+4*0,p,!0)},r.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let l,p;try{l=e,p=n,console.error(Ea(e,n))}finally{fr.__wbindgen_free(l,p,1)}},r.wbg.__wbg_fetch_f8d735ba6fe1b719=typeof fetch=="function"?fetch:kl("fetch"),r.wbg.__wbg_queueMicrotask_848aa4969108a57e=function(e){return e.queueMicrotask},r.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},r.wbg.__wbg_queueMicrotask_c5419c06eab41e73=typeof queueMicrotask=="function"?queueMicrotask:kl("queueMicrotask"),r.wbg.__wbg_fetch_1fdc4448ed9eec00=function(e,n){return e.fetch(n)},r.wbg.__wbg_debug_69675dd374e2c249=typeof console.debug=="function"?console.debug:kl("console.debug"),r.wbg.__wbg_error_53abcd6a461f73d8=typeof console.error=="function"?console.error:kl("console.error"),r.wbg.__wbg_info_f073b719c8035bbf=typeof console.info=="function"?console.info:kl("console.info"),r.wbg.__wbg_log_f740dc2253ea759b=typeof console.log=="function"?console.log:kl("console.log"),r.wbg.__wbg_warn_41503a1c2194de89=typeof console.warn=="function"?console.warn:kl("console.warn"),r.wbg.__wbg_newwithstrandinit_4b92c89af0a8e383=function(){return vn(function(e,n,l){return new Request(Ea(e,n),l)},arguments)},r.wbg.__wbg_setbody_aa8b691bec428bf4=function(e,n){e.body=n},r.wbg.__wbg_setcredentials_a4e661320cdb9738=function(e,n){e.credentials=GI[n]},r.wbg.__wbg_setheaders_f5205d36e423a544=function(e,n){e.headers=n},r.wbg.__wbg_setmethod_ce2da76000b02f6a=function(e,n,l){e.method=Ea(n,l)},r.wbg.__wbg_setmode_4919fd636102c586=function(e,n){e.mode=ZI[n]},r.wbg.__wbg_setsignal_812ccb8269a7fd90=function(e,n){e.signal=n},r.wbg.__wbg_new_a9ae04a5200606a5=function(){return vn(function(){return new Headers},arguments)},r.wbg.__wbg_append_8b3e7f74a47ea7d5=function(){return vn(function(e,n,l,p,v){e.append(Ea(n,l),Ea(p,v))},arguments)},r.wbg.__wbg_instanceof_Response_3c0e210a57ff751d=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},r.wbg.__wbg_url_58af972663531d16=function(e,n){const l=n.url,p=kh(l,fr.__wbindgen_malloc,fr.__wbindgen_realloc),v=Dl;Zs().setInt32(e+4*1,v,!0),Zs().setInt32(e+4*0,p,!0)},r.wbg.__wbg_status_5f4e900d22140a18=function(e){return e.status},r.wbg.__wbg_headers_1b9bf90c73fae600=function(e){return e.headers},r.wbg.__wbg_arrayBuffer_144729e09879650e=function(){return vn(function(e){return e.arrayBuffer()},arguments)},r.wbg.__wbg_text_ebeee8b31af4c919=function(){return vn(function(e){return e.text()},arguments)},r.wbg.__wbg_signal_9acfcec9e7dffc22=function(e){return e.signal},r.wbg.__wbg_new_75169ae5a9683c55=function(){return vn(function(){return new AbortController},arguments)},r.wbg.__wbg_abort_c57daab47a6c1215=function(e){e.abort()},r.wbg.__wbg_crypto_1d1f22824a6a080c=function(e){return e.crypto},r.wbg.__wbg_process_4a72847cc503995b=function(e){return e.process},r.wbg.__wbg_versions_f686565e586dd935=function(e){return e.versions},r.wbg.__wbg_node_104a2ff8d6ea03a2=function(e){return e.node},r.wbg.__wbg_require_cca90b1a94a0255b=function(){return vn(function(){return module.require},arguments)},r.wbg.__wbg_msCrypto_eb05e62b530a1508=function(e){return e.msCrypto},r.wbg.__wbg_randomFillSync_5c9c955aa56b6049=function(){return vn(function(e,n){e.randomFillSync(n)},arguments)},r.wbg.__wbg_getRandomValues_3aa56aa6edec874c=function(){return vn(function(e,n){e.getRandomValues(n)},arguments)},r.wbg.__wbg_get_5419cf6b954aa11d=function(e,n){return e[n>>>0]},r.wbg.__wbg_length_f217bbbf7e8e4df4=function(e){return e.length},r.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43=function(e,n){return new Function(Ea(e,n))},r.wbg.__wbg_next_13b477da1eaa3897=function(e){return e.next},r.wbg.__wbg_next_b06e115d1b01e10b=function(){return vn(function(e){return e.next()},arguments)},r.wbg.__wbg_done_983b5ffcaec8c583=function(e){return e.done},r.wbg.__wbg_value_2ab8a198c834c26a=function(e){return e.value},r.wbg.__wbg_iterator_695d699a44d6234c=function(){return Symbol.iterator},r.wbg.__wbg_get_ef828680c64da212=function(){return vn(function(e,n){return Reflect.get(e,n)},arguments)},r.wbg.__wbg_call_a9ef466721e824f2=function(){return vn(function(e,n){return e.call(n)},arguments)},r.wbg.__wbg_new_e69b5f66fda8f13c=function(){return new Object},r.wbg.__wbg_self_bf91bf94d9e04084=function(){return vn(function(){return self.self},arguments)},r.wbg.__wbg_window_52dd9f07d03fd5f8=function(){return vn(function(){return window.window},arguments)},r.wbg.__wbg_globalThis_05c129bf37fcf1be=function(){return vn(function(){return globalThis.globalThis},arguments)},r.wbg.__wbg_global_3eca19bb09e9c484=function(){return vn(function(){return global.global},arguments)},r.wbg.__wbg_isArray_6f3b47f09adb61b5=function(e){return Array.isArray(e)},r.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7=function(e){let n;try{n=e instanceof ArrayBuffer}catch{n=!1}return n},r.wbg.__wbg_call_3bfa248576352471=function(){return vn(function(e,n,l){return e.call(n,l)},arguments)},r.wbg.__wbg_instanceof_Map_f96986929e7e89ed=function(e){let n;try{n=e instanceof Map}catch{n=!1}return n},r.wbg.__wbg_isSafeInteger_b9dff570f01a9100=function(e){return Number.isSafeInteger(e)},r.wbg.__wbg_entries_c02034de337d3ee2=function(e){return Object.entries(e)},r.wbg.__wbg_new_1073970097e5a420=function(e,n){try{var l={a:e,b:n},p=(b,c)=>{const A=l.a;l.a=0;try{return qI(A,l.b,b,c)}finally{l.a=A}};return new Promise(p)}finally{l.a=l.b=0}},r.wbg.__wbg_resolve_0aad7c1484731c99=function(e){return Promise.resolve(e)},r.wbg.__wbg_then_748f75edfb032440=function(e,n){return e.then(n)},r.wbg.__wbg_then_4866a7d9f55d8f3e=function(e,n,l){return e.then(n,l)},r.wbg.__wbg_buffer_ccaed51a635d8a2d=function(e){return e.buffer},r.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730=function(e,n,l){return new Uint8Array(e,n>>>0,l>>>0)},r.wbg.__wbg_new_fec2611eb9180f95=function(e){return new Uint8Array(e)},r.wbg.__wbg_set_ec2fcf81bc573fd9=function(e,n,l){e.set(n,l>>>0)},r.wbg.__wbg_length_9254c4bd3b9f23c4=function(e){return e.length},r.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36=function(e){let n;try{n=e instanceof Uint8Array}catch{n=!1}return n},r.wbg.__wbg_newwithlength_76462a666eca145f=function(e){return new Uint8Array(e>>>0)},r.wbg.__wbg_subarray_975a06f9dbd16995=function(e,n,l){return e.subarray(n>>>0,l>>>0)},r.wbg.__wbg_stringify_eead5648c09faaf8=function(){return vn(function(e){return JSON.stringify(e)},arguments)},r.wbg.__wbg_has_bd717f25f195f23d=function(){return vn(function(e,n){return Reflect.has(e,n)},arguments)},r.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const l=n,p=typeof l=="bigint"?l:void 0;Zs().setBigInt64(e+8*1,vh(p)?BigInt(0):p,!0),Zs().setInt32(e+4*0,!vh(p),!0)},r.wbg.__wbindgen_debug_string=function(e,n){const l=Ug(n),p=kh(l,fr.__wbindgen_malloc,fr.__wbindgen_realloc),v=Dl;Zs().setInt32(e+4*1,v,!0),Zs().setInt32(e+4*0,p,!0)},r.wbg.__wbindgen_throw=function(e,n){throw new Error(Ea(e,n))},r.wbg.__wbindgen_memory=function(){return fr.memory},r.wbg.__wbindgen_closure_wrapper2453=function(e,n,l){return UI(e,n,1078,$I)},r.wbg.__wbindgen_init_externref_table=function(){const e=fr.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},r}function YI(r,e){return fr=r.exports,Ub.__wbindgen_wasm_module=e,El=null,Th=null,fr.__wbindgen_start(),fr}async function Ub(r){if(fr!==void 0)return fr;typeof r<"u"&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof r>"u"&&(r=new URL("rust_backend_bg.wasm",import.meta.url));const e=HI();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:n,module:l}=await WI(await r,e);return YI(n,l)}class KI{constructor(){pg(this,"inner");this.inner=null}async initialise(){await Ub(),this.inner=await new Yp}unset(){this.inner=null}isLoaded(){return this.inner!=null}async addColours(e){if(!this.inner)throw new Error("RustBackend not initialised");const n=JSON.parse(this.inner.addColours(e));return console.log("RustBackend.addColours result",n),n}async getCountries(){if(!this.inner)throw new Error("RustBackend not initialised");const e=JSON.parse(await this.inner.getCountries());return console.log("RustBackend.getCountries result",e),e}async search(e,n){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.search(e,n))}async downloadMetrics(e){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.downloadMetrics(e))}async downloadGeoms(e){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.downloadGeoms(e))}async downloadDataRequestMetrics(e){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequestMetrics(e)}async downloadDataRequestMetricsSql(e){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequestMetricsSql(e)}async downloadDataRequestGeoms(e){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.downloadDataRequestGeoms(e))}async downloadDataRequestGeomsPmtiles(e){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequestGeomsPmtiles(e)}async downloadDataRequest(e,n="geojson"){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequest(e,n)}}Hp(KI);function ur(r,e,n,l){function p(v){return v instanceof n?v:new n(function(b){b(v)})}return new(n||(n=Promise))(function(v,b){function c(z){try{T(l.next(z))}catch(B){b(B)}}function A(z){try{T(l.throw(z))}catch(B){b(B)}}function T(z){z.done?v(z.value):p(z.value).then(c,A)}T((l=l.apply(r,e||[])).next())})}function hv(r){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&r[e],l=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&l>=r.length&&(r=void 0),{value:r&&r[l++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Sr(r){return this instanceof Sr?(this.v=r,this):new Sr(r)}function Ba(r,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var l=n.apply(r,e||[]),p,v=[];return p={},c("next"),c("throw"),c("return",b),p[Symbol.asyncIterator]=function(){return this},p;function b(j){return function(Q){return Promise.resolve(Q).then(j,B)}}function c(j,Q){l[j]&&(p[j]=function(ae){return new Promise(function(ne,Y){v.push([j,ae,ne,Y])>1||A(j,ae)})},Q&&(p[j]=Q(p[j])))}function A(j,Q){try{T(l[j](Q))}catch(ae){U(v[0][3],ae)}}function T(j){j.value instanceof Sr?Promise.resolve(j.value.v).then(z,B):U(v[0][2],j)}function z(j){A("next",j)}function B(j){A("throw",j)}function U(j,Q){j(Q),v.shift(),v.length&&A(v[0][0],v[0][1])}}function Lf(r){var e,n;return e={},l("next"),l("throw",function(p){throw p}),l("return"),e[Symbol.iterator]=function(){return this},e;function l(p,v){e[p]=r[p]?function(b){return(n=!n)?{value:Sr(r[p](b)),done:!1}:v?v(b):b}:v}}function zl(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],n;return e?e.call(r):(r=typeof hv=="function"?hv(r):r[Symbol.iterator](),n={},l("next"),l("throw"),l("return"),n[Symbol.asyncIterator]=function(){return this},n);function l(v){n[v]=r[v]&&function(b){return new Promise(function(c,A){b=r[v](b),p(c,A,b.done,b.value)})}}function p(v,b,c,A){Promise.resolve(A).then(function(T){v({value:T,done:c})},b)}}const XI=new TextDecoder("utf-8"),$g=r=>XI.decode(r),JI=new TextEncoder,by=r=>JI.encode(r),QI=r=>typeof r=="number",$b=r=>typeof r=="boolean",bn=r=>typeof r=="function",ks=r=>r!=null&&Object(r)===r,Nl=r=>ks(r)&&bn(r.then),Qh=r=>ks(r)&&bn(r[Symbol.iterator]),cu=r=>ks(r)&&bn(r[Symbol.asyncIterator]),Vg=r=>ks(r)&&ks(r.schema),Vb=r=>ks(r)&&"done"in r&&"value"in r,jb=r=>ks(r)&&bn(r.stat)&&QI(r.fd),qb=r=>ks(r)&&xy(r.body),Kp=r=>"_getDOMStream"in r&&"_getNodeStream"in r,eT=r=>ks(r)&&bn(r.abort)&&bn(r.getWriter)&&!Kp(r),xy=r=>ks(r)&&bn(r.cancel)&&bn(r.getReader)&&!Kp(r),tT=r=>ks(r)&&bn(r.end)&&bn(r.write)&&$b(r.writable)&&!Kp(r),Gb=r=>ks(r)&&bn(r.read)&&bn(r.pipe)&&$b(r.readable)&&!Kp(r),rT=r=>ks(r)&&bn(r.clear)&&bn(r.bytes)&&bn(r.position)&&bn(r.setPosition)&&bn(r.capacity)&&bn(r.getBufferIdentifier)&&bn(r.createLong),wy=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function iT(r){const e=r[0]?[r[0]]:[];let n,l,p,v;for(let b,c,A=0,T=0,z=r.length;++Az+B.byteLength,0);let p,v,b,c=0,A=-1;const T=Math.min(e||Number.POSITIVE_INFINITY,l);for(const z=n.length;++Ali(Int32Array,r),fv=r=>li(BigInt64Array,r),Nr=r=>li(Uint8Array,r),jg=r=>(r.next(),r);function*nT(r,e){const n=function*(p){yield p},l=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wy?n(e):Qh(e)?e:n(e);return yield*jg(function*(p){let v=null;do v=p.next(yield li(r,v));while(!v.done)}(l[Symbol.iterator]())),new r}const sT=r=>nT(Uint8Array,r);function Zb(r,e){return Ba(this,arguments,function*(){if(Nl(e))return yield Sr(yield Sr(yield*Lf(zl(Zb(r,yield Sr(e))))));const l=function(b){return Ba(this,arguments,function*(){yield yield Sr(yield Sr(b))})},p=function(b){return Ba(this,arguments,function*(){yield Sr(yield*Lf(zl(jg(function*(c){let A=null;do A=c.next(yield A==null?void 0:A.value);while(!A.done)}(b[Symbol.iterator]())))))})},v=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wy?l(e):Qh(e)?p(e):cu(e)?e:l(e);return yield Sr(yield*Lf(zl(jg(function(b){return Ba(this,arguments,function*(){let c=null;do c=yield Sr(b.next(yield yield Sr(li(r,c))));while(!c.done)})}(v[Symbol.asyncIterator]()))))),yield Sr(new r)})}const aT=r=>Zb(Uint8Array,r);function Wb(r,e,n){if(r!==0){n=n.slice(0,e);for(let l=-1,p=n.length;++l0)do if(r[n]!==e[n])return!1;while(++n(r.next(),r);function*lT(r){let e,n=!1,l=[],p,v,b,c=0;function A(){return v==="peek"?Ua(l,b)[0]:([p,l,c]=Ua(l,b),p)}({cmd:v,size:b}=(yield null)||{cmd:"read",size:0});const T=sT(r)[Symbol.iterator]();try{do if({done:e,value:p}=Number.isNaN(b-c)?T.next():T.next(b-c),!e&&p.byteLength>0&&(l.push(p),c+=p.byteLength),e||b<=c)do({cmd:v,size:b}=yield A());while(b0&&(p.push(v),A+=v.byteLength),n||c<=A)do({cmd:b,size:c}=yield yield Sr(T()));while(c0&&(p.push(Nr(v)),A+=v.byteLength),n||c<=A)do({cmd:b,size:c}=yield yield Sr(T()));while(c{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return ur(this,void 0,void 0,function*(){const{reader:n,source:l}=this;n&&(yield n.cancel(e).catch(()=>{})),l&&l.locked&&this.releaseLock()})}read(e){return ur(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=Nr(n)),n})}}const yg=(r,e)=>{const n=p=>l([e,p]);let l;return[e,n,new Promise(p=>(l=p)&&r.once(e,n))]};function dT(r){return Ba(this,arguments,function*(){const n=[];let l="error",p=!1,v=null,b,c,A=0,T=[],z;function B(){return b==="peek"?Ua(T,c)[0]:([z,T,A]=Ua(T,c),z)}if({cmd:b,size:c}=(yield yield Sr(null))||{cmd:"read",size:0},r.isTTY)return yield yield Sr(new Uint8Array(0)),yield Sr(null);try{n[0]=yg(r,"end"),n[1]=yg(r,"error");do{if(n[2]=yg(r,"readable"),[l,v]=yield Sr(Promise.race(n.map(j=>j[2]))),l==="error")break;if((p=l==="end")||(Number.isFinite(c-A)?(z=Nr(r.read(c-A)),z.byteLength0&&(T.push(z),A+=z.byteLength)),p||c<=A)do({cmd:b,size:c}=yield yield Sr(B()));while(c{for(const[Y,_e]of j)r.off(Y,_e);try{const Y=r.destroy;Y&&Y.call(r,Q),Q=void 0}catch(Y){Q=Y||Q}finally{Q!=null?ne(Q):ae()}})}})}var ln;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(ln||(ln={}));var Kn;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Kn||(Kn={}));var Yn;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Yn||(Yn={}));var Qs;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Qs||(Qs={}));var Jt;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Jt||(Jt={}));var $a;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})($a||($a={}));const _g=2,Pa=4,mo=4,ri=4,Wo=new Int32Array(2),pv=new Float32Array(Wo.buffer),mv=new Float64Array(Wo.buffer),xf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var qg;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(qg||(qg={}));let Qc=class Hb{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new Hb(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<>8}writeUint16(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8}writeInt32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeUint32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeInt64(e,n){this.writeInt32(e,Number(BigInt.asIntN(32,n))),this.writeInt32(e+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(e,n){this.writeUint32(e,Number(BigInt.asUintN(32,n))),this.writeUint32(e+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(e,n){pv[0]=n,this.writeInt32(e,Wo[0])}writeFloat64(e,n){mv[0]=n,this.writeInt32(e,Wo[xf?0:1]),this.writeInt32(e+4,Wo[xf?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=e);const l=~(this.bb.capacity()-this.space+n)+1&e-1;for(;this.space=0&&this.vtable[n]==0;n--);const l=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?e-this.vtable[n]:0);const p=2;this.addInt16(e-this.object_start);const v=(l+p)*_g;this.addInt16(v);let b=0;const c=this.space;e:for(n=0;n=0;b--)this.writeInt8(v.charCodeAt(b))}this.prep(this.minalign,Pa+p),this.addOffset(e),p&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,n){this.finish(e,n,!0)}requiredField(e,n){const l=this.bb.capacity()-e,p=l-this.bb.readInt32(l);if(!(n=0;l--)e.addInt32(n[l]);return e.endVector()}static startTypeIdsVector(e,n){e.startVector(4,n,4)}static endUnion(e){return e.endObject()}static createUnion(e,n,l){return Ss.startUnion(e),Ss.addMode(e,n),Ss.addTypeIds(e,l),Ss.endUnion(e)}}let wv=class Lh{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsUtf8(e,n){return(n||new Lh).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,n){return e.setPosition(e.position()+ri),(n||new Lh).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return Lh.startUtf8(e),Lh.endUtf8(e)}};var Ti;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(Ti||(Ti={}));let Ws=class Nf{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsField(e,n){return(n||new Nf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,n){return e.setPosition(e.position()+ri),(n||new Nf).__init(e.readInt32(e.position())+e.position(),e)}name(e){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):Ti.NONE}type(e){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(e,this.bb_pos+n):null}dictionary(e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new go).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(e,n){const l=this.bb.__offset(this.bb_pos,14);return l?(n||new Nf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,16);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,n){e.addFieldOffset(0,n,0)}static addNullable(e,n){e.addFieldInt8(1,+n,0)}static addTypeType(e,n){e.addFieldInt8(2,n,Ti.NONE)}static addType(e,n){e.addFieldOffset(3,n,0)}static addDictionary(e,n){e.addFieldOffset(4,n,0)}static addChildren(e,n){e.addFieldOffset(5,n,0)}static createChildrenVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startChildrenVector(e,n){e.startVector(4,n,4)}static addCustomMetadata(e,n){e.addFieldOffset(6,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endField(e){return e.endObject()}},Ma=class co{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsSchema(e,n){return(n||new co).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,n){return e.setPosition(e.position()+ri),(n||new co).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):eu.Little}fields(e,n){const l=this.bb.__offset(this.bb_pos,6);return l?(n||new Ws).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,8);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+e*8):BigInt(0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,n){e.addFieldInt16(0,n,eu.Little)}static addFields(e,n){e.addFieldOffset(1,n,0)}static createFieldsVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startFieldsVector(e,n){e.startVector(4,n,4)}static addCustomMetadata(e,n){e.addFieldOffset(2,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static addFeatures(e,n){e.addFieldOffset(3,n,0)}static createFeaturesVector(e,n){e.startVector(8,n.length,8);for(let l=n.length-1;l>=0;l--)e.addInt64(n[l]);return e.endVector()}static startFeaturesVector(e,n){e.startVector(8,n,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,n){e.finish(n)}static finishSizePrefixedSchemaBuffer(e,n){e.finish(n,void 0,!0)}static createSchema(e,n,l,p,v){return co.startSchema(e),co.addEndianness(e,n),co.addFields(e,l),co.addCustomMetadata(e,p),co.addFeatures(e,v),co.endSchema(e)}};var Zr;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(Zr||(Zr={}));var ce;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(ce||(ce={}));var ho;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(ho||(ho={}));const fT=void 0;function Vh(r){if(r===null)return"null";if(r===fT)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(e=>Vh(e))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(e,n)=>typeof n=="bigint"?`${n}`:n)}function yi(r){if(typeof r=="bigint"&&(rNumber.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Qb(r,e){return yi(r/e)+yi(r%e)/yi(e)}const pT=Symbol.for("isArrowBigNum");function _a(r,...e){return e.length===0?Object.setPrototypeOf(li(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...e),this.constructor.prototype)}_a.prototype[pT]=!0;_a.prototype.toJSON=function(){return`"${qh(this)}"`};_a.prototype.valueOf=function(r){return ex(this,r)};_a.prototype.toString=function(){return qh(this)};_a.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return ex(this);case"string":return qh(this);case"default":return yT(this)}return qh(this)};function Zc(...r){return _a.apply(this,r)}function Wc(...r){return _a.apply(this,r)}function jh(...r){return _a.apply(this,r)}Object.setPrototypeOf(Zc.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Wc.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(jh.prototype,Object.create(Uint32Array.prototype));Object.assign(Zc.prototype,_a.prototype,{constructor:Zc,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Wc.prototype,_a.prototype,{constructor:Wc,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(jh.prototype,_a.prototype,{constructor:jh,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const mT=BigInt(4294967296)*BigInt(4294967296),gT=mT-BigInt(1);function ex(r,e){const{buffer:n,byteOffset:l,byteLength:p,signed:v}=r,b=new BigUint64Array(n,l,p/8),c=v&&b.at(-1)&BigInt(1)<=0)return vg(r);e=e.slice();let l=1;for(let v=0;v(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(Vt.prototype);class Xo extends Vt{constructor(){super(ce.Null)}toString(){return"Null"}}rx=Symbol.toStringTag;Xo[rx]=(r=>r[Symbol.toStringTag]="Null")(Xo.prototype);class Ul extends Vt{constructor(e,n){super(ce.Int),this.isSigned=e,this.bitWidth=n}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}ix=Symbol.toStringTag;Ul[ix]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Ul.prototype);class Gh extends Ul{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Gh.prototype,"ArrayType",{value:Int32Array});class ep extends Vt{constructor(e){super(ce.Float),this.precision=e}get ArrayType(){switch(this.precision){case Yn.HALF:return Uint16Array;case Yn.SINGLE:return Float32Array;case Yn.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}nx=Symbol.toStringTag;ep[nx]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ep.prototype);class tp extends Vt{constructor(){super(ce.Binary)}toString(){return"Binary"}}sx=Symbol.toStringTag;tp[sx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(tp.prototype);class rp extends Vt{constructor(){super(ce.LargeBinary)}toString(){return"LargeBinary"}}ax=Symbol.toStringTag;rp[ax]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(rp.prototype);class ip extends Vt{constructor(){super(ce.Utf8)}toString(){return"Utf8"}}ox=Symbol.toStringTag;ip[ox]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(ip.prototype);class np extends Vt{constructor(){super(ce.LargeUtf8)}toString(){return"LargeUtf8"}}lx=Symbol.toStringTag;np[lx]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(np.prototype);class sp extends Vt{constructor(){super(ce.Bool)}toString(){return"Bool"}}cx=Symbol.toStringTag;sp[cx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(sp.prototype);class ap extends Vt{constructor(e,n,l=128){super(ce.Decimal),this.scale=e,this.precision=n,this.bitWidth=l}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}ux=Symbol.toStringTag;ap[ux]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ap.prototype);class op extends Vt{constructor(e){super(ce.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${Qs[this.unit]}>`}get ArrayType(){return this.unit===Qs.DAY?Int32Array:BigInt64Array}}hx=Symbol.toStringTag;op[hx]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(op.prototype);class lp extends Vt{constructor(e,n){super(ce.Time),this.unit=e,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${Jt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}dx=Symbol.toStringTag;lp[dx]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(lp.prototype);class cp extends Vt{constructor(e,n){super(ce.Timestamp),this.unit=e,this.timezone=n}toString(){return`Timestamp<${Jt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}fx=Symbol.toStringTag;cp[fx]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(cp.prototype);class up extends Vt{constructor(e){super(ce.Interval),this.unit=e}toString(){return`Interval<${$a[this.unit]}>`}}px=Symbol.toStringTag;up[px]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(up.prototype);class hp extends Vt{constructor(e){super(ce.Duration),this.unit=e}toString(){return`Duration<${Jt[this.unit]}>`}}mx=Symbol.toStringTag;hp[mx]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(hp.prototype);class dp extends Vt{constructor(e){super(ce.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}gx=Symbol.toStringTag;dp[gx]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(dp.prototype);class ls extends Vt{constructor(e){super(ce.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}yx=Symbol.toStringTag;ls[yx]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ls.prototype);class fp extends Vt{constructor(e,n,l){super(ce.Union),this.mode=e,this.children=l,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((p,v,b)=>(p[v]=b)&&p||p,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}_x=Symbol.toStringTag;fp[_x]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(fp.prototype);class pp extends Vt{constructor(e){super(ce.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}vx=Symbol.toStringTag;pp[vx]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(pp.prototype);class mp extends Vt{constructor(e,n){super(ce.FixedSizeList),this.listSize=e,this.children=[n]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}bx=Symbol.toStringTag;mp[bx]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(mp.prototype);class gp extends Vt{constructor(e,n=!1){var l,p,v;if(super(ce.Map),this.children=[e],this.keysSorted=n,e&&(e.name="entries",!((l=e==null?void 0:e.type)===null||l===void 0)&&l.children)){const b=(p=e==null?void 0:e.type)===null||p===void 0?void 0:p.children[0];b&&(b.name="key");const c=(v=e==null?void 0:e.type)===null||v===void 0?void 0:v.children[1];c&&(c.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}xx=Symbol.toStringTag;gp[xx]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(gp.prototype);const _T=(r=>()=>++r)(-1);class tu extends Vt{constructor(e,n,l,p){super(ce.Dictionary),this.indices=n,this.dictionary=e,this.isOrdered=p||!1,this.id=l==null?_T():yi(l)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}wx=Symbol.toStringTag;tu[wx]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(tu.prototype);function fo(r){const e=r;switch(r.typeId){case ce.Decimal:return r.bitWidth/32;case ce.Interval:return 1+e.unit;case ce.FixedSizeList:return e.listSize;case ce.FixedSizeBinary:return e.byteWidth;default:return 1}}class Cr{visitMany(e,...n){return e.map((l,p)=>this.visit(l,...n.map(v=>v[p])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,n=!0){return vT(this,e,n)}getVisitFnByTypeId(e,n=!0){return Uc(this,e,n)}visitNull(e,...n){return null}visitBool(e,...n){return null}visitInt(e,...n){return null}visitFloat(e,...n){return null}visitUtf8(e,...n){return null}visitLargeUtf8(e,...n){return null}visitBinary(e,...n){return null}visitLargeBinary(e,...n){return null}visitFixedSizeBinary(e,...n){return null}visitDate(e,...n){return null}visitTimestamp(e,...n){return null}visitTime(e,...n){return null}visitDecimal(e,...n){return null}visitList(e,...n){return null}visitStruct(e,...n){return null}visitUnion(e,...n){return null}visitDictionary(e,...n){return null}visitInterval(e,...n){return null}visitDuration(e,...n){return null}visitFixedSizeList(e,...n){return null}visitMap(e,...n){return null}}function vT(r,e,n=!0){return typeof e=="number"?Uc(r,e,n):typeof e=="string"&&e in ce?Uc(r,ce[e],n):e&&e instanceof Vt?Uc(r,Sv(e),n):e!=null&&e.type&&e.type instanceof Vt?Uc(r,Sv(e.type),n):Uc(r,ce.NONE,n)}function Uc(r,e,n=!0){let l=null;switch(e){case ce.Null:l=r.visitNull;break;case ce.Bool:l=r.visitBool;break;case ce.Int:l=r.visitInt;break;case ce.Int8:l=r.visitInt8||r.visitInt;break;case ce.Int16:l=r.visitInt16||r.visitInt;break;case ce.Int32:l=r.visitInt32||r.visitInt;break;case ce.Int64:l=r.visitInt64||r.visitInt;break;case ce.Uint8:l=r.visitUint8||r.visitInt;break;case ce.Uint16:l=r.visitUint16||r.visitInt;break;case ce.Uint32:l=r.visitUint32||r.visitInt;break;case ce.Uint64:l=r.visitUint64||r.visitInt;break;case ce.Float:l=r.visitFloat;break;case ce.Float16:l=r.visitFloat16||r.visitFloat;break;case ce.Float32:l=r.visitFloat32||r.visitFloat;break;case ce.Float64:l=r.visitFloat64||r.visitFloat;break;case ce.Utf8:l=r.visitUtf8;break;case ce.LargeUtf8:l=r.visitLargeUtf8;break;case ce.Binary:l=r.visitBinary;break;case ce.LargeBinary:l=r.visitLargeBinary;break;case ce.FixedSizeBinary:l=r.visitFixedSizeBinary;break;case ce.Date:l=r.visitDate;break;case ce.DateDay:l=r.visitDateDay||r.visitDate;break;case ce.DateMillisecond:l=r.visitDateMillisecond||r.visitDate;break;case ce.Timestamp:l=r.visitTimestamp;break;case ce.TimestampSecond:l=r.visitTimestampSecond||r.visitTimestamp;break;case ce.TimestampMillisecond:l=r.visitTimestampMillisecond||r.visitTimestamp;break;case ce.TimestampMicrosecond:l=r.visitTimestampMicrosecond||r.visitTimestamp;break;case ce.TimestampNanosecond:l=r.visitTimestampNanosecond||r.visitTimestamp;break;case ce.Time:l=r.visitTime;break;case ce.TimeSecond:l=r.visitTimeSecond||r.visitTime;break;case ce.TimeMillisecond:l=r.visitTimeMillisecond||r.visitTime;break;case ce.TimeMicrosecond:l=r.visitTimeMicrosecond||r.visitTime;break;case ce.TimeNanosecond:l=r.visitTimeNanosecond||r.visitTime;break;case ce.Decimal:l=r.visitDecimal;break;case ce.List:l=r.visitList;break;case ce.Struct:l=r.visitStruct;break;case ce.Union:l=r.visitUnion;break;case ce.DenseUnion:l=r.visitDenseUnion||r.visitUnion;break;case ce.SparseUnion:l=r.visitSparseUnion||r.visitUnion;break;case ce.Dictionary:l=r.visitDictionary;break;case ce.Interval:l=r.visitInterval;break;case ce.IntervalDayTime:l=r.visitIntervalDayTime||r.visitInterval;break;case ce.IntervalYearMonth:l=r.visitIntervalYearMonth||r.visitInterval;break;case ce.Duration:l=r.visitDuration;break;case ce.DurationSecond:l=r.visitDurationSecond||r.visitDuration;break;case ce.DurationMillisecond:l=r.visitDurationMillisecond||r.visitDuration;break;case ce.DurationMicrosecond:l=r.visitDurationMicrosecond||r.visitDuration;break;case ce.DurationNanosecond:l=r.visitDurationNanosecond||r.visitDuration;break;case ce.FixedSizeList:l=r.visitFixedSizeList;break;case ce.Map:l=r.visitMap;break}if(typeof l=="function")return l;if(!n)return()=>null;throw new Error(`Unrecognized type '${ce[e]}'`)}function Sv(r){switch(r.typeId){case ce.Null:return ce.Null;case ce.Int:{const{bitWidth:e,isSigned:n}=r;switch(e){case 8:return n?ce.Int8:ce.Uint8;case 16:return n?ce.Int16:ce.Uint16;case 32:return n?ce.Int32:ce.Uint32;case 64:return n?ce.Int64:ce.Uint64}return ce.Int}case ce.Float:switch(r.precision){case Yn.HALF:return ce.Float16;case Yn.SINGLE:return ce.Float32;case Yn.DOUBLE:return ce.Float64}return ce.Float;case ce.Binary:return ce.Binary;case ce.LargeBinary:return ce.LargeBinary;case ce.Utf8:return ce.Utf8;case ce.LargeUtf8:return ce.LargeUtf8;case ce.Bool:return ce.Bool;case ce.Decimal:return ce.Decimal;case ce.Time:switch(r.unit){case Jt.SECOND:return ce.TimeSecond;case Jt.MILLISECOND:return ce.TimeMillisecond;case Jt.MICROSECOND:return ce.TimeMicrosecond;case Jt.NANOSECOND:return ce.TimeNanosecond}return ce.Time;case ce.Timestamp:switch(r.unit){case Jt.SECOND:return ce.TimestampSecond;case Jt.MILLISECOND:return ce.TimestampMillisecond;case Jt.MICROSECOND:return ce.TimestampMicrosecond;case Jt.NANOSECOND:return ce.TimestampNanosecond}return ce.Timestamp;case ce.Date:switch(r.unit){case Qs.DAY:return ce.DateDay;case Qs.MILLISECOND:return ce.DateMillisecond}return ce.Date;case ce.Interval:switch(r.unit){case $a.DAY_TIME:return ce.IntervalDayTime;case $a.YEAR_MONTH:return ce.IntervalYearMonth}return ce.Interval;case ce.Duration:switch(r.unit){case Jt.SECOND:return ce.DurationSecond;case Jt.MILLISECOND:return ce.DurationMillisecond;case Jt.MICROSECOND:return ce.DurationMicrosecond;case Jt.NANOSECOND:return ce.DurationNanosecond}return ce.Duration;case ce.Map:return ce.Map;case ce.List:return ce.List;case ce.Struct:return ce.Struct;case ce.Union:switch(r.mode){case Kn.Dense:return ce.DenseUnion;case Kn.Sparse:return ce.SparseUnion}return ce.Union;case ce.FixedSizeBinary:return ce.FixedSizeBinary;case ce.FixedSizeList:return ce.FixedSizeList;case ce.Dictionary:return ce.Dictionary}throw new Error(`Unrecognized type '${ce[r.typeId]}'`)}Cr.prototype.visitInt8=null;Cr.prototype.visitInt16=null;Cr.prototype.visitInt32=null;Cr.prototype.visitInt64=null;Cr.prototype.visitUint8=null;Cr.prototype.visitUint16=null;Cr.prototype.visitUint32=null;Cr.prototype.visitUint64=null;Cr.prototype.visitFloat16=null;Cr.prototype.visitFloat32=null;Cr.prototype.visitFloat64=null;Cr.prototype.visitDateDay=null;Cr.prototype.visitDateMillisecond=null;Cr.prototype.visitTimestampSecond=null;Cr.prototype.visitTimestampMillisecond=null;Cr.prototype.visitTimestampMicrosecond=null;Cr.prototype.visitTimestampNanosecond=null;Cr.prototype.visitTimeSecond=null;Cr.prototype.visitTimeMillisecond=null;Cr.prototype.visitTimeMicrosecond=null;Cr.prototype.visitTimeNanosecond=null;Cr.prototype.visitDenseUnion=null;Cr.prototype.visitSparseUnion=null;Cr.prototype.visitIntervalDayTime=null;Cr.prototype.visitIntervalYearMonth=null;Cr.prototype.visitDuration=null;Cr.prototype.visitDurationSecond=null;Cr.prototype.visitDurationMillisecond=null;Cr.prototype.visitDurationMicrosecond=null;Cr.prototype.visitDurationNanosecond=null;const Sx=new Float64Array(1),Mc=new Uint32Array(Sx.buffer);function Ix(r){const e=(r&31744)>>10,n=(r&1023)/1024,l=Math.pow(-1,(r&32768)>>15);switch(e){case 31:return l*(n?Number.NaN:1/0);case 0:return l*(n?6103515625e-14*n:0)}return l*Math.pow(2,e-15)*(1+n)}function bT(r){if(r!==r)return 32256;Sx[0]=r;const e=(Mc[1]&2147483648)>>16&65535;let n=Mc[1]&2146435072,l=0;return n>=1089470464?Mc[0]>0?n=31744:(n=(n&2080374784)>>16,l=(Mc[1]&1048575)>>10):n<=1056964608?(l=1048576+(Mc[1]&1048575),l=1048576+(l<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,l=(Mc[1]&1048575)+512>>10),e|n|l&65535}class Qt extends Cr{}function rr(r){return(e,n,l)=>{if(e.setValid(n,l!=null))return r(e,n,l)}}const xT=(r,e,n)=>{r[e]=Math.floor(n/864e5)},Tx=(r,e,n,l)=>{if(n+1{const p=r+n;l?e[p>>3]|=1<>3]&=~(1<{r[e]=n},Iy=({values:r},e,n)=>{r[e]=n},kx=({values:r},e,n)=>{r[e]=bT(n)},ST=(r,e,n)=>{switch(r.type.precision){case Yn.HALF:return kx(r,e,n);case Yn.SINGLE:case Yn.DOUBLE:return Iy(r,e,n)}},Ax=({values:r},e,n)=>{xT(r,e,n.valueOf())},Ex=({values:r},e,n)=>{r[e]=BigInt(n)},IT=({stride:r,values:e},n,l)=>{e.set(l.subarray(0,r),r*n)},Cx=({values:r,valueOffsets:e},n,l)=>Tx(r,e,n,l),Mx=({values:r,valueOffsets:e},n,l)=>Tx(r,e,n,by(l)),TT=(r,e,n)=>{r.type.unit===Qs.DAY?Ax(r,e,n):Ex(r,e,n)},Dx=({values:r},e,n)=>{r[e]=BigInt(n/1e3)},Px=({values:r},e,n)=>{r[e]=BigInt(n)},Lx=({values:r},e,n)=>{r[e]=BigInt(n*1e3)},zx=({values:r},e,n)=>{r[e]=BigInt(n*1e6)},kT=(r,e,n)=>{switch(r.type.unit){case Jt.SECOND:return Dx(r,e,n);case Jt.MILLISECOND:return Px(r,e,n);case Jt.MICROSECOND:return Lx(r,e,n);case Jt.NANOSECOND:return zx(r,e,n)}},Bx=({values:r},e,n)=>{r[e]=n},Rx=({values:r},e,n)=>{r[e]=n},Fx=({values:r},e,n)=>{r[e]=n},Ox=({values:r},e,n)=>{r[e]=n},AT=(r,e,n)=>{switch(r.type.unit){case Jt.SECOND:return Bx(r,e,n);case Jt.MILLISECOND:return Rx(r,e,n);case Jt.MICROSECOND:return Fx(r,e,n);case Jt.NANOSECOND:return Ox(r,e,n)}},ET=({values:r,stride:e},n,l)=>{r.set(l.subarray(0,e),e*n)},CT=(r,e,n)=>{const l=r.children[0],p=r.valueOffsets,v=ea.getVisitFn(l);if(Array.isArray(n))for(let b=-1,c=p[e],A=p[e+1];c{const l=r.children[0],{valueOffsets:p}=r,v=ea.getVisitFn(l);let{[e]:b,[e+1]:c}=p;const A=n instanceof Map?n.entries():Object.entries(n);for(const T of A)if(v(l,b,T),++b>=c)break},DT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e[v]),PT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e.get(v)),LT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e.get(p.name)),zT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e[p.name]),BT=(r,e,n)=>{const l=r.type.children.map(v=>ea.getVisitFn(v.type)),p=n instanceof Map?LT(e,n):n instanceof ei?PT(e,n):Array.isArray(n)?DT(e,n):zT(e,n);r.type.children.forEach((v,b)=>p(l[b],r.children[b],v,b))},RT=(r,e,n)=>{r.type.mode===Kn.Dense?Nx(r,e,n):Ux(r,e,n)},Nx=(r,e,n)=>{const l=r.type.typeIdToChildIndex[r.typeIds[e]],p=r.children[l];ea.visit(p,r.valueOffsets[e],n)},Ux=(r,e,n)=>{const l=r.type.typeIdToChildIndex[r.typeIds[e]],p=r.children[l];ea.visit(p,e,n)},FT=(r,e,n)=>{var l;(l=r.dictionary)===null||l===void 0||l.set(r.values[e],n)},OT=(r,e,n)=>{r.type.unit===$a.DAY_TIME?$x(r,e,n):Vx(r,e,n)},$x=({values:r},e,n)=>{r.set(n.subarray(0,2),2*e)},Vx=({values:r},e,n)=>{r[e]=n[0]*12+n[1]%12},jx=({values:r},e,n)=>{r[e]=n},qx=({values:r},e,n)=>{r[e]=n},Gx=({values:r},e,n)=>{r[e]=n},Zx=({values:r},e,n)=>{r[e]=n},NT=(r,e,n)=>{switch(r.type.unit){case Jt.SECOND:return jx(r,e,n);case Jt.MILLISECOND:return qx(r,e,n);case Jt.MICROSECOND:return Gx(r,e,n);case Jt.NANOSECOND:return Zx(r,e,n)}},UT=(r,e,n)=>{const{stride:l}=r,p=r.children[0],v=ea.getVisitFn(p);if(Array.isArray(n))for(let b=-1,c=e*l;++b`${Vh(e)}: ${Vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new $T(this[fa],this[Hc])}}class $T{constructor(e,n){this.childIndex=0,this.children=e.children,this.rowIndex=n,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return en.name)}has(e,n){return e[fa].type.children.findIndex(l=>l.name===n)!==-1}getOwnPropertyDescriptor(e,n){if(e[fa].type.children.findIndex(l=>l.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,n){if(Reflect.has(e,n))return e[n];const l=e[fa].type.children.findIndex(p=>p.name===n);if(l!==-1){const p=As.visit(e[fa].children[l],e[Hc]);return Reflect.set(e,n,p),p}}set(e,n,l){const p=e[fa].type.children.findIndex(v=>v.name===n);return p!==-1?(ea.visit(e[fa].children[p],e[Hc],l),Reflect.set(e,n,l)):Reflect.has(e,n)||typeof n=="symbol"?Reflect.set(e,n,l):!1}}class Wt extends Cr{}function er(r){return(e,n)=>e.getValid(n)?r(e,n):null}const jT=(r,e)=>864e5*r[e],qT=(r,e)=>null,Wx=(r,e,n)=>{if(n+1>=e.length)return null;const l=yi(e[n]),p=yi(e[n+1]);return r.subarray(l,p)},GT=({offset:r,values:e},n)=>{const l=r+n;return(e[l>>3]&1<jT(r,e),Yx=({values:r},e)=>yi(r[e]),nl=({stride:r,values:e},n)=>e[r*n],ZT=({stride:r,values:e},n)=>Ix(e[r*n]),Kx=({values:r},e)=>r[e],WT=({stride:r,values:e},n)=>e.subarray(r*n,r*(n+1)),Xx=({values:r,valueOffsets:e},n)=>Wx(r,e,n),Jx=({values:r,valueOffsets:e},n)=>{const l=Wx(r,e,n);return l!==null?$g(l):null},HT=({values:r},e)=>r[e],YT=({type:r,values:e},n)=>r.precision!==Yn.HALF?e[n]:Ix(e[n]),KT=(r,e)=>r.type.unit===Qs.DAY?Hx(r,e):Yx(r,e),Qx=({values:r},e)=>1e3*yi(r[e]),e1=({values:r},e)=>yi(r[e]),t1=({values:r},e)=>Qb(r[e],BigInt(1e3)),r1=({values:r},e)=>Qb(r[e],BigInt(1e6)),XT=(r,e)=>{switch(r.type.unit){case Jt.SECOND:return Qx(r,e);case Jt.MILLISECOND:return e1(r,e);case Jt.MICROSECOND:return t1(r,e);case Jt.NANOSECOND:return r1(r,e)}},i1=({values:r},e)=>r[e],n1=({values:r},e)=>r[e],s1=({values:r},e)=>r[e],a1=({values:r},e)=>r[e],JT=(r,e)=>{switch(r.type.unit){case Jt.SECOND:return i1(r,e);case Jt.MILLISECOND:return n1(r,e);case Jt.MICROSECOND:return s1(r,e);case Jt.NANOSECOND:return a1(r,e)}},QT=({values:r,stride:e},n)=>Sy.decimal(r.subarray(e*n,e*(n+1))),ek=(r,e)=>{const{valueOffsets:n,stride:l,children:p}=r,{[e*l]:v,[e*l+1]:b}=n,A=p[0].slice(v,b-v);return new ei([A])},tk=(r,e)=>{const{valueOffsets:n,children:l}=r,{[e]:p,[e+1]:v}=n,b=l[0];return new ky(b.slice(p,v-p))},rk=(r,e)=>new Ty(r,e),ik=(r,e)=>r.type.mode===Kn.Dense?o1(r,e):l1(r,e),o1=(r,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[e]],l=r.children[n];return As.visit(l,r.valueOffsets[e])},l1=(r,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[e]],l=r.children[n];return As.visit(l,e)},nk=(r,e)=>{var n;return(n=r.dictionary)===null||n===void 0?void 0:n.get(r.values[e])},sk=(r,e)=>r.type.unit===$a.DAY_TIME?c1(r,e):u1(r,e),c1=({values:r},e)=>r.subarray(2*e,2*(e+1)),u1=({values:r},e)=>{const n=r[e],l=new Int32Array(2);return l[0]=Math.trunc(n/12),l[1]=Math.trunc(n%12),l},h1=({values:r},e)=>r[e],d1=({values:r},e)=>r[e],f1=({values:r},e)=>r[e],p1=({values:r},e)=>r[e],ak=(r,e)=>{switch(r.type.unit){case Jt.SECOND:return h1(r,e);case Jt.MILLISECOND:return d1(r,e);case Jt.MICROSECOND:return f1(r,e);case Jt.NANOSECOND:return p1(r,e)}},ok=(r,e)=>{const{stride:n,children:l}=r,v=l[0].slice(e*n,n);return new ei([v])};Wt.prototype.visitNull=er(qT);Wt.prototype.visitBool=er(GT);Wt.prototype.visitInt=er(HT);Wt.prototype.visitInt8=er(nl);Wt.prototype.visitInt16=er(nl);Wt.prototype.visitInt32=er(nl);Wt.prototype.visitInt64=er(Kx);Wt.prototype.visitUint8=er(nl);Wt.prototype.visitUint16=er(nl);Wt.prototype.visitUint32=er(nl);Wt.prototype.visitUint64=er(Kx);Wt.prototype.visitFloat=er(YT);Wt.prototype.visitFloat16=er(ZT);Wt.prototype.visitFloat32=er(nl);Wt.prototype.visitFloat64=er(nl);Wt.prototype.visitUtf8=er(Jx);Wt.prototype.visitLargeUtf8=er(Jx);Wt.prototype.visitBinary=er(Xx);Wt.prototype.visitLargeBinary=er(Xx);Wt.prototype.visitFixedSizeBinary=er(WT);Wt.prototype.visitDate=er(KT);Wt.prototype.visitDateDay=er(Hx);Wt.prototype.visitDateMillisecond=er(Yx);Wt.prototype.visitTimestamp=er(XT);Wt.prototype.visitTimestampSecond=er(Qx);Wt.prototype.visitTimestampMillisecond=er(e1);Wt.prototype.visitTimestampMicrosecond=er(t1);Wt.prototype.visitTimestampNanosecond=er(r1);Wt.prototype.visitTime=er(JT);Wt.prototype.visitTimeSecond=er(i1);Wt.prototype.visitTimeMillisecond=er(n1);Wt.prototype.visitTimeMicrosecond=er(s1);Wt.prototype.visitTimeNanosecond=er(a1);Wt.prototype.visitDecimal=er(QT);Wt.prototype.visitList=er(ek);Wt.prototype.visitStruct=er(rk);Wt.prototype.visitUnion=er(ik);Wt.prototype.visitDenseUnion=er(o1);Wt.prototype.visitSparseUnion=er(l1);Wt.prototype.visitDictionary=er(nk);Wt.prototype.visitInterval=er(sk);Wt.prototype.visitIntervalDayTime=er(c1);Wt.prototype.visitIntervalYearMonth=er(u1);Wt.prototype.visitDuration=er(ak);Wt.prototype.visitDurationSecond=er(h1);Wt.prototype.visitDurationMillisecond=er(d1);Wt.prototype.visitDurationMicrosecond=er(f1);Wt.prototype.visitDurationNanosecond=er(p1);Wt.prototype.visitFixedSizeList=er(ok);Wt.prototype.visitMap=er(tk);const As=new Wt,$c=Symbol.for("keys"),Yc=Symbol.for("vals"),Vc=Symbol.for("kKeysAsStrings"),Wg=Symbol.for("_kKeysAsStrings");class ky{constructor(e){return this[$c]=new ei([e.children[0]]).memoize(),this[Yc]=e.children[1],new Proxy(this,new ck)}get[Vc](){return this[Wg]||(this[Wg]=Array.from(this[$c].toArray(),String))}[Symbol.iterator](){return new lk(this[$c],this[Yc])}get size(){return this[$c].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[$c],n=this[Yc],l={};for(let p=-1,v=e.length;++p`${Vh(e)}: ${Vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class lk{constructor(e,n){this.keys=e,this.vals=n,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),As.visit(this.vals,e)]})}}class ck{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Vc]}has(e,n){return e[Vc].includes(n)}getOwnPropertyDescriptor(e,n){if(e[Vc].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,n){if(Reflect.has(e,n))return e[n];const l=e[Vc].indexOf(n);if(l!==-1){const p=As.visit(Reflect.get(e,Yc),l);return Reflect.set(e,n,p),p}}set(e,n,l){const p=e[Vc].indexOf(n);return p!==-1?(ea.visit(Reflect.get(e,Yc),p,l),Reflect.set(e,n,l)):Reflect.has(e,n)?Reflect.set(e,n,l):!1}}Object.defineProperties(ky.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[$c]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Yc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Wg]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Iv;function m1(r,e,n,l){const{length:p=0}=r;let v=typeof e!="number"?0:e,b=typeof n!="number"?p:n;return v<0&&(v=(v%p+p)%p),b<0&&(b=(b%p+p)%p),bp&&(b=p),l?l(r,v,b):[v,b]}const Ay=(r,e)=>r<0?e+r:r,Tv=r=>r!==r;function uu(r){if(typeof r!=="object"||r===null)return Tv(r)?Tv:n=>n===r;if(r instanceof Date){const n=r.valueOf();return l=>l instanceof Date?l.valueOf()===n:!1}return ArrayBuffer.isView(r)?n=>n?oT(r,n):!1:r instanceof Map?hk(r):Array.isArray(r)?uk(r):r instanceof ei?dk(r):fk(r,!0)}function uk(r){const e=[];for(let n=-1,l=r.length;++n!1;const l=[];for(let p=-1,v=n.length;++p{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return pk(r,n);case Map:return kv(r,n,n.keys());case ky:case Ty:case Object:case void 0:return kv(r,n,e||Object.keys(n))}return n instanceof ei?mk(r,n):!1}}function pk(r,e){const n=r.length;if(e.length!==n)return!1;for(let l=-1;++l>l}function yp(r,e,n){const l=n.byteLength+7&-8;if(r>0||n.byteLength>3):_p(new Ey(n,r,e,null,g1)).subarray(0,l)),p}return n}function _p(r){const e=[];let n=0,l=0,p=0;for(const b of r)b&&(p|=1<0)&&(e[n++]=p);const v=new Uint8Array(e.length+7&-8);return v.set(e),v}class Ey{constructor(e,n,l,p,v){this.bytes=e,this.length=l,this.context=p,this.get=v,this.bit=n%8,this.byteIndex=n>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,p=e+(e%8===0?0:8-e%8);return Hg(r,e,p)+Hg(r,l,n)+yk(r,p>>3,l-p>>3)}function yk(r,e,n){let l=0,p=Math.trunc(e);const v=new DataView(r.buffer,r.byteOffset,r.byteLength),b=n===void 0?r.byteLength:p+n;for(;b-p>=4;)l+=bg(v.getUint32(p)),p+=4;for(;b-p>=2;)l+=bg(v.getUint16(p)),p+=2;for(;b-p>=1;)l+=bg(v.getUint8(p)),p+=1;return l}function bg(r){let e=Math.trunc(r);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const _k=-1;class ai{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return Vt.isSparseUnion(e)?this.children.some(n=>n.nullable):Vt.isDenseUnion(e)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:n,values:l,nullBitmap:p,typeIds:v}=this;return n&&(e+=n.byteLength),l&&(e+=l.byteLength),p&&(e+=p.byteLength),v&&(e+=v.byteLength),this.children.reduce((b,c)=>b+c.byteLength,e)}get nullCount(){if(Vt.isUnion(this.type))return this.children.reduce((l,p)=>l+p.nullCount,0);let e=this._nullCount,n;return e<=_k&&(n=this.nullBitmap)&&(this._nullCount=e=n.length===0?0:this.length-Hg(n,this.offset,this.offset+this.length)),e}constructor(e,n,l,p,v,b=[],c){this.type=e,this.children=b,this.dictionary=c,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(l||0,0)),this._nullCount=Math.floor(Math.max(p||0,-1));let A;v instanceof ai?(this.stride=v.stride,this.values=v.values,this.typeIds=v.typeIds,this.nullBitmap=v.nullBitmap,this.valueOffsets=v.valueOffsets):(this.stride=fo(e),v&&((A=v[0])&&(this.valueOffsets=A),(A=v[1])&&(this.values=A),(A=v[2])&&(this.nullBitmap=A),(A=v[3])&&(this.typeIds=A)))}getValid(e){const{type:n}=this;if(Vt.isUnion(n)){const l=n,p=this.children[l.typeIdToChildIndex[this.typeIds[e]]],v=l.mode===Kn.Dense?this.valueOffsets[e]:e;return p.getValid(v)}if(this.nullable&&this.nullCount>0){const l=this.offset+e;return(this.nullBitmap[l>>3]&1<>3;(!v||v.byteLength<=z)&&(v=new Uint8Array((b+c+63&-64)>>3).fill(255),this.nullCount>0?(v.set(yp(b,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:v})):Object.assign(this,{nullBitmap:v,_nullCount:0}));const B=v[z];l=(B&T)!==0,v[z]=n?B|T:B&~T}return l!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(e=this.type,n=this.offset,l=this.length,p=this._nullCount,v=this,b=this.children){return new ai(e,n,l,p,v,b,this.dictionary)}slice(e,n){const{stride:l,typeId:p,children:v}=this,b=+(this._nullCount===0)-1,c=p===16?l:1,A=this._sliceBuffers(e,n,l,p);return this.clone(this.type,this.offset+e,n,b,A,v.length===0||this.valueOffsets?v:this._sliceChildren(v,c*e,c*n))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===ce.Null)return this.clone(this.type,0,e,0);const{length:n,nullCount:l}=this,p=new Uint8Array((e+63&-64)>>3).fill(255,0,n>>3);p[n>>3]=(1<0&&p.set(yp(this.offset,n,this.nullBitmap),0);const v=this.buffers;return v[ho.VALIDITY]=p,this.clone(this.type,0,e,l+(e-n),v)}_sliceBuffers(e,n,l,p){let v;const{buffers:b}=this;return(v=b[ho.TYPE])&&(b[ho.TYPE]=v.subarray(e,e+n)),(v=b[ho.OFFSET])&&(b[ho.OFFSET]=v.subarray(e,e+n+1))||(v=b[ho.DATA])&&(b[ho.DATA]=p===6?v:v.subarray(l*e,l*(e+n))),b}_sliceChildren(e,n,l){return e.map(p=>p.slice(n,l))}}ai.prototype.children=Object.freeze([]);class Fh extends Cr{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:n,["offset"]:l=0,["length"]:p=0}=e;return new ai(n,l,p,p)}visitBool(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length>>3,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitInt(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitFloat(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitUtf8(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitLargeUtf8(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=fv(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitBinary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitLargeBinary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=fv(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitFixedSizeBinary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitDate(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitTimestamp(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitTime(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitDecimal(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitList(e){const{["type"]:n,["offset"]:l=0,["child"]:p}=e,v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,void 0,v],[p])}visitStruct(e){const{["type"]:n,["offset"]:l=0,["children"]:p=[]}=e,v=Nr(e.nullBitmap),{length:b=p.reduce((A,{length:T})=>Math.max(A,T),0),nullCount:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,void 0,v],p)}visitUnion(e){const{["type"]:n,["offset"]:l=0,["children"]:p=[]}=e,v=li(n.ArrayType,e.typeIds),{["length"]:b=v.length,["nullCount"]:c=-1}=e;if(Vt.isSparseUnion(n))return new ai(n,l,b,c,[void 0,void 0,void 0,v],p);const A=bh(e.valueOffsets);return new ai(n,l,b,c,[A,void 0,void 0,v],p)}visitDictionary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.indices.ArrayType,e.data),{["dictionary"]:b=new ei([new Fh().visit({type:n.dictionary})])}=e,{["length"]:c=v.length,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[void 0,v,p],[],b)}visitInterval(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitDuration(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitFixedSizeList(e){const{["type"]:n,["offset"]:l=0,["child"]:p=new Fh().visit({type:n.valueType})}=e,v=Nr(e.nullBitmap),{["length"]:b=p.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,void 0,v],[p])}visitMap(e){const{["type"]:n,["offset"]:l=0,["child"]:p=new Fh().visit({type:n.childType})}=e,v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,void 0,v],[p])}}const vk=new Fh;function Dr(r){return vk.visit(r)}class Av{constructor(e=0,n){this.numChunks=e,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe.nullable)}function y1(r){return r.reduce((e,n)=>e+n.nullCount,0)}function _1(r){return r.reduce((e,n,l)=>(e[l+1]=e[l]+n.length,e),new Uint32Array(r.length+1))}function v1(r,e,n,l){const p=[];for(let v=-1,b=r.length;++v=l)break;if(n>=A+T)continue;if(A>=n&&A+T<=l){p.push(c);continue}const z=Math.max(0,n-A),B=Math.min(l-A,T);p.push(c.slice(z,B-z))}return p.length===0&&p.push(r[0].slice(0,0)),p}function Cy(r,e,n,l){let p=0,v=0,b=e.length-1;do{if(p>=b-1)return n0?0:-1}function wk(r,e){const{nullBitmap:n}=r;if(!n||r.nullCount<=0)return-1;let l=0;for(const p of new Ey(n,r.offset+(e||0),r.length,n,g1)){if(!p)return l;++l}return-1}function lr(r,e,n){if(e===void 0)return-1;if(e===null)switch(r.typeId){case ce.Union:break;case ce.Dictionary:break;default:return wk(r,n)}const l=As.getVisitFn(r),p=uu(e);for(let v=(n||0)-1,b=r.length;++v{const p=r.data[l];return p.values.subarray(0,p.length)[Symbol.iterator]()});let n=0;return new Av(r.data.length,l=>{const v=r.data[l].length,b=r.slice(n,n+v);return n+=v,new Sk(b)})}class Sk{constructor(e){this.vector=e,this.index=0}next(){return this.indexc.data):e;if(v.length===0||v.some(c=>!(c instanceof ai)))throw new TypeError("Vector constructor expects an Array of Data instances.");const b=(n=v[0])===null||n===void 0?void 0:n.type;switch(v.length){case 0:this._offsets=[0];break;case 1:{const{get:c,set:A,indexOf:T}=I1[b.typeId],z=v[0];this.isValid=B=>My(z,B),this.get=B=>c(z,B),this.set=(B,U)=>A(z,B,U),this.indexOf=B=>T(z,B),this._offsets=[0,z.length];break}default:Object.setPrototypeOf(this,T1[b.typeId]),this._offsets=_1(v);break}this.data=v,this.type=b,this.stride=fo(b),this.numChildren=(p=(l=b.children)===null||l===void 0?void 0:l.length)!==null&&p!==void 0?p:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,n)=>e+n.byteLength,0)}get nullable(){return bk(this.data)}get nullCount(){return y1(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${ce[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(Ay(e,this.length))}set(e,n){}indexOf(e,n){return-1}includes(e,n){return this.indexOf(e,n)>-1}[Symbol.iterator](){return Dy.visit(this)}concat(...e){return new ei(this.data.concat(e.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(e,n){return new ei(m1(this,e,n,({data:l,_offsets:p},v,b)=>v1(l,p,v,b)))}toJSON(){return[...this]}toArray(){const{type:e,data:n,length:l,stride:p,ArrayType:v}=this;switch(e.typeId){case ce.Int:case ce.Float:case ce.Decimal:case ce.Time:case ce.Timestamp:switch(n.length){case 0:return new v;case 1:return n[0].values.subarray(0,l*p);default:return n.reduce((b,{values:c,length:A})=>(b.array.set(c.subarray(0,A*p),b.offset),b.offset+=A*p,b),{array:new v(l*p),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(l=>l.name===e))}getChildAt(e){return e>-1&&en[e])):null}get isMemoized(){return Vt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Vt.isDictionary(this.type)){const e=new xp(this.data[0].dictionary),n=this.data.map(l=>{const p=l.clone();return p.dictionary=e,p});return new ei(n)}return new xp(this)}unmemoize(){if(Vt.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),n=this.data.map(l=>{const p=l.clone();return p.dictionary=e,p});return new ei(n)}return this}}S1=Symbol.toStringTag;ei[S1]=(r=>{r.type=Vt.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const e=Object.keys(ce).map(n=>ce[n]).filter(n=>typeof n=="number"&&n!==ce.NONE);for(const n of e){const l=As.getVisitFnByTypeId(n),p=ea.getVisitFnByTypeId(n),v=bp.getVisitFnByTypeId(n);I1[n]={get:l,set:p,indexOf:v},T1[n]=Object.create(r,{isValid:{value:vp(My)},get:{value:vp(As.getVisitFnByTypeId(n))},set:{value:b1(ea.getVisitFnByTypeId(n))},indexOf:{value:x1(bp.getVisitFnByTypeId(n))}})}return"Vector"})(ei.prototype);class xp extends ei{constructor(e){super(e.data);const n=this.get,l=this.set,p=this.slice,v=new Array(this.length);Object.defineProperty(this,"get",{value(b){const c=v[b];if(c!==void 0)return c;const A=n.call(this,b);return v[b]=A,A}}),Object.defineProperty(this,"set",{value(b,c){l.call(this,b,c),v[b]=c}}),Object.defineProperty(this,"slice",{value:(b,c)=>new xp(p.call(this,b,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new ei(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Yg{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,n,l,p){return e.prep(8,24),e.writeInt64(BigInt(p??0)),e.pad(4),e.writeInt32(l),e.writeInt64(BigInt(n??0)),e.offset()}}class Ps{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsFooter(e,n){return(n||new Ps).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,n){return e.setPosition(e.position()+ri),(n||new Ps).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ln.V1}schema(e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Ma).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(e,n){const l=this.bb.__offset(this.bb_pos,8);return l?(n||new Yg).__init(this.bb.__vector(this.bb_pos+l)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,n){const l=this.bb.__offset(this.bb_pos,10);return l?(n||new Yg).__init(this.bb.__vector(this.bb_pos+l)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,12);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,n){e.addFieldInt16(0,n,ln.V1)}static addSchema(e,n){e.addFieldOffset(1,n,0)}static addDictionaries(e,n){e.addFieldOffset(2,n,0)}static startDictionariesVector(e,n){e.startVector(24,n,8)}static addRecordBatches(e,n){e.addFieldOffset(3,n,0)}static startRecordBatchesVector(e,n){e.startVector(24,n,8)}static addCustomMetadata(e,n){e.addFieldOffset(4,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,n){e.finish(n)}static finishSizePrefixedFooterBuffer(e,n){e.finish(n,void 0,!0)}}class ti{constructor(e=[],n,l,p=ln.V5){this.fields=e||[],this.metadata=n||new Map,l||(l=Kg(this.fields)),this.dictionaries=l,this.metadataVersion=p}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,n)=>`${n}: ${e}`).join(", ")} }>`}select(e){const n=new Set(e),l=this.fields.filter(p=>n.has(p.name));return new ti(l,this.metadata)}selectAt(e){const n=e.map(l=>this.fields[l]).filter(Boolean);return new ti(n,this.metadata)}assign(...e){const n=e[0]instanceof ti?e[0]:Array.isArray(e[0])?new ti(e[0]):new ti(e),l=[...this.fields],p=wf(wf(new Map,this.metadata),n.metadata),v=n.fields.filter(c=>{const A=l.findIndex(T=>T.name===c.name);return~A?(l[A]=c.clone({metadata:wf(wf(new Map,l[A].metadata),c.metadata)}))&&!1:!0}),b=Kg(v,new Map);return new ti([...l,...v],p,new Map([...this.dictionaries,...b]))}}ti.prototype.fields=null;ti.prototype.metadata=null;ti.prototype.dictionaries=null;class Li{static new(...e){let[n,l,p,v]=e;return e[0]&&typeof e[0]=="object"&&({name:n}=e[0],l===void 0&&(l=e[0].type),p===void 0&&(p=e[0].nullable),v===void 0&&(v=e[0].metadata)),new Li(`${n}`,l,p,v)}constructor(e,n,l=!1,p){this.name=e,this.type=n,this.nullable=l,this.metadata=p||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[n,l,p,v]=e;return!e[0]||typeof e[0]!="object"?[n=this.name,l=this.type,p=this.nullable,v=this.metadata]=e:{name:n=this.name,type:l=this.type,nullable:p=this.nullable,metadata:v=this.metadata}=e[0],Li.new(n,l,p,v)}}Li.prototype.type=null;Li.prototype.name=null;Li.prototype.nullable=null;Li.prototype.metadata=null;function wf(r,e){return new Map([...r||new Map,...e||new Map])}function Kg(r,e=new Map){for(let n=-1,l=r.length;++n0&&Kg(v.children,e)}return e}var Ik=Yb,Tk=Qc;class Zh{static decode(e){e=new Tk(Nr(e));const n=Ps.getRootAsFooter(e),l=ti.decode(n.schema(),new Map,n.version());return new kk(l,n)}static encode(e){const n=new Ik,l=ti.encode(n,e.schema);Ps.startRecordBatchesVector(n,e.numRecordBatches);for(const b of[...e.recordBatches()].slice().reverse())Jo.encode(n,b);const p=n.endVector();Ps.startDictionariesVector(n,e.numDictionaries);for(const b of[...e.dictionaryBatches()].slice().reverse())Jo.encode(n,b);const v=n.endVector();return Ps.startFooter(n),Ps.addSchema(n,l),Ps.addVersion(n,ln.V5),Ps.addRecordBatches(n,p),Ps.addDictionaries(n,v),Ps.finishFooterBuffer(n,Ps.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,n=ln.V5,l,p){this.schema=e,this.version=n,l&&(this._recordBatches=l),p&&(this._dictionaryBatches=p)}*recordBatches(){for(let e,n=-1,l=this.numRecordBatches;++n=0&&e=0&&e=0&&e=0&&ethis._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return ur(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Wi);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Ys.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Ys.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return ur(this,void 0,void 0,function*(){return yield this.abort(e),Wi})}return(e){return ur(this,void 0,void 0,function*(){return yield this.close(),Wi})}read(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,l)=>{this.resolvers.push({resolve:n,reject:l})}):Promise.resolve(Wi)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Uf extends Ak{write(e){if((e=Nr(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?$g(this.toUint8Array(!0)):this.toUint8Array(!1).then($g)}toUint8Array(e=!1){return e?Ua(this._values)[0]:ur(this,void 0,void 0,function*(){var n,l,p,v;const b=[];let c=0;try{for(var A=!0,T=zl(this),z;z=yield T.next(),n=z.done,!n;A=!0){v=z.value,A=!1;const B=v;b.push(B),c+=B.byteLength}}catch(B){l={error:B}}finally{try{!A&&!n&&(p=T.return)&&(yield p.call(T))}finally{if(l)throw l.error}}return Ua(b,c)[0]})}}class wp{constructor(e){e&&(this.source=new Ek(Ys.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class ru{constructor(e){e instanceof ru?this.source=e.source:e instanceof Uf?this.source=new Al(Ys.fromAsyncIterable(e)):Gb(e)?this.source=new Al(Ys.fromNodeStream(e)):xy(e)?this.source=new Al(Ys.fromDOMStream(e)):qb(e)?this.source=new Al(Ys.fromDOMStream(e.body)):Qh(e)?this.source=new Al(Ys.fromIterable(e)):Nl(e)?this.source=new Al(Ys.fromAsyncIterable(e)):cu(e)&&(this.source=new Al(Ys.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Ek{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,n="read"){return this.source.next({cmd:n,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Wi)}return(e){return Object.create(this.source.return&&this.source.return(e)||Wi)}}class Al{constructor(e){this.source=e,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(e){return ur(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return ur(this,arguments,void 0,function*(n,l="read"){return yield this.source.next({cmd:l,size:n})})}throw(e){return ur(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(e))||Wi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(e){return ur(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(e))||Wi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class Cv extends wp{constructor(e,n){super(),this.position=0,this.buffer=Nr(e),this.size=n===void 0?this.buffer.byteLength:n}readInt32(e){const{buffer:n,byteOffset:l}=this.readAt(e,4);return new DataView(n,l).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),l=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let p=n[3]*l[3];this.buffer[0]=p&65535;let v=p>>>16;return p=n[2]*l[3],v+=p,p=n[3]*l[2]>>>0,v+=p,this.buffer[0]+=v<<16,this.buffer[1]=v>>>0>>16,this.buffer[1]+=n[1]*l[3]+n[2]*l[2]+n[3]*l[1],this.buffer[1]+=n[0]*l[3]+n[1]*l[2]+n[2]*l[1]+n[3]*l[0]<<16,this}_plus(e){const n=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],n>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(e){return this.buffer[1]>>0,n[2]=this.buffer[2]+e.buffer[2]>>>0,n[1]=this.buffer[1]+e.buffer[1]>>>0,n[0]=this.buffer[0]+e.buffer[0]>>>0,n[0]>>0&&++n[1],n[1]>>0&&++n[2],n[2]>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${jc(this.buffer[3])} ${jc(this.buffer[2])} ${jc(this.buffer[1])} ${jc(this.buffer[0])}`}static multiply(e,n){return new Da(new Uint32Array(e.buffer)).times(n)}static add(e,n){return new Da(new Uint32Array(e.buffer)).plus(n)}static from(e,n=new Uint32Array(4)){return Da.fromString(typeof e=="string"?e:e.toString(),n)}static fromNumber(e,n=new Uint32Array(4)){return Da.fromString(e.toString(),n)}static fromString(e,n=new Uint32Array(4)){const l=e.startsWith("-"),p=e.length,v=new Da(n);for(let b=l?1:0;b0&&this.readData(e,l)||new Uint8Array(0)}readOffsets(e,n){return this.readData(e,n)}readTypeIds(e,n){return this.readData(e,n)}readData(e,{length:n,offset:l}=this.nextBufferRange()){return this.bytes.subarray(l,l+n)}readDictionary(e){return this.dictionaries.get(e.id)}}class Mk extends A1{constructor(e,n,l,p,v){super(new Uint8Array(0),n,l,p,v),this.sources=e}readNullBitmap(e,n,{offset:l}=this.nextBufferRange()){return n<=0?new Uint8Array(0):_p(this.sources[l])}readOffsets(e,{offset:n}=this.nextBufferRange()){return li(Uint8Array,li(e.OffsetArrayType,this.sources[n]))}readTypeIds(e,{offset:n}=this.nextBufferRange()){return li(Uint8Array,li(e.ArrayType,this.sources[n]))}readData(e,{offset:n}=this.nextBufferRange()){const{sources:l}=this;return Vt.isTimestamp(e)||(Vt.isInt(e)||Vt.isTime(e))&&e.bitWidth===64||Vt.isDuration(e)||Vt.isDate(e)&&e.unit===Qs.MILLISECOND?li(Uint8Array,xs.convertArray(l[n])):Vt.isDecimal(e)?li(Uint8Array,Da.convertArray(l[n])):Vt.isBinary(e)||Vt.isLargeBinary(e)||Vt.isFixedSizeBinary(e)?Dk(l[n]):Vt.isBool(e)?_p(l[n]):Vt.isUtf8(e)||Vt.isLargeUtf8(e)?by(l[n].join("")):li(Uint8Array,li(e.ArrayType,l[n].map(p=>+p)))}}function Dk(r){const e=r.join(""),n=new Uint8Array(e.length/2);for(let l=0;l>1]=Number.parseInt(e.slice(l,l+2),16);return n}class Kt extends Cr{compareSchemas(e,n){return e===n||n instanceof e.constructor&&this.compareManyFields(e.fields,n.fields)}compareManyFields(e,n){return e===n||Array.isArray(e)&&Array.isArray(n)&&e.length===n.length&&e.every((l,p)=>this.compareFields(l,n[p]))}compareFields(e,n){return e===n||n instanceof e.constructor&&e.name===n.name&&e.nullable===n.nullable&&this.visit(e.type,n.type)}}function ds(r,e){return e instanceof r.constructor}function ql(r,e){return r===e||ds(r,e)}function vo(r,e){return r===e||ds(r,e)&&r.bitWidth===e.bitWidth&&r.isSigned===e.isSigned}function Jp(r,e){return r===e||ds(r,e)&&r.precision===e.precision}function Pk(r,e){return r===e||ds(r,e)&&r.byteWidth===e.byteWidth}function zy(r,e){return r===e||ds(r,e)&&r.unit===e.unit}function ed(r,e){return r===e||ds(r,e)&&r.unit===e.unit&&r.timezone===e.timezone}function td(r,e){return r===e||ds(r,e)&&r.unit===e.unit&&r.bitWidth===e.bitWidth}function Lk(r,e){return r===e||ds(r,e)&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}function zk(r,e){return r===e||ds(r,e)&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}function By(r,e){return r===e||ds(r,e)&&r.mode===e.mode&&r.typeIds.every((n,l)=>n===e.typeIds[l])&&Qo.compareManyFields(r.children,e.children)}function Bk(r,e){return r===e||ds(r,e)&&r.id===e.id&&r.isOrdered===e.isOrdered&&Qo.visit(r.indices,e.indices)&&Qo.visit(r.dictionary,e.dictionary)}function Ry(r,e){return r===e||ds(r,e)&&r.unit===e.unit}function rd(r,e){return r===e||ds(r,e)&&r.unit===e.unit}function Rk(r,e){return r===e||ds(r,e)&&r.listSize===e.listSize&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}function Fk(r,e){return r===e||ds(r,e)&&r.keysSorted===e.keysSorted&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}Kt.prototype.visitNull=ql;Kt.prototype.visitBool=ql;Kt.prototype.visitInt=vo;Kt.prototype.visitInt8=vo;Kt.prototype.visitInt16=vo;Kt.prototype.visitInt32=vo;Kt.prototype.visitInt64=vo;Kt.prototype.visitUint8=vo;Kt.prototype.visitUint16=vo;Kt.prototype.visitUint32=vo;Kt.prototype.visitUint64=vo;Kt.prototype.visitFloat=Jp;Kt.prototype.visitFloat16=Jp;Kt.prototype.visitFloat32=Jp;Kt.prototype.visitFloat64=Jp;Kt.prototype.visitUtf8=ql;Kt.prototype.visitLargeUtf8=ql;Kt.prototype.visitBinary=ql;Kt.prototype.visitLargeBinary=ql;Kt.prototype.visitFixedSizeBinary=Pk;Kt.prototype.visitDate=zy;Kt.prototype.visitDateDay=zy;Kt.prototype.visitDateMillisecond=zy;Kt.prototype.visitTimestamp=ed;Kt.prototype.visitTimestampSecond=ed;Kt.prototype.visitTimestampMillisecond=ed;Kt.prototype.visitTimestampMicrosecond=ed;Kt.prototype.visitTimestampNanosecond=ed;Kt.prototype.visitTime=td;Kt.prototype.visitTimeSecond=td;Kt.prototype.visitTimeMillisecond=td;Kt.prototype.visitTimeMicrosecond=td;Kt.prototype.visitTimeNanosecond=td;Kt.prototype.visitDecimal=ql;Kt.prototype.visitList=Lk;Kt.prototype.visitStruct=zk;Kt.prototype.visitUnion=By;Kt.prototype.visitDenseUnion=By;Kt.prototype.visitSparseUnion=By;Kt.prototype.visitDictionary=Bk;Kt.prototype.visitInterval=Ry;Kt.prototype.visitIntervalDayTime=Ry;Kt.prototype.visitIntervalYearMonth=Ry;Kt.prototype.visitDuration=rd;Kt.prototype.visitDurationSecond=rd;Kt.prototype.visitDurationMillisecond=rd;Kt.prototype.visitDurationMicrosecond=rd;Kt.prototype.visitDurationNanosecond=rd;Kt.prototype.visitFixedSizeList=Rk;Kt.prototype.visitMap=Fk;const Qo=new Kt;function Xg(r,e){return Qo.compareSchemas(r,e)}function xg(r,e){return Ok(r,e.map(n=>n.data.concat()))}function Ok(r,e){const n=[...r.fields],l=[],p={numBatches:e.reduce((B,U)=>Math.max(B,U.length),0)};let v=0,b=0,c=-1;const A=e.length;let T,z=[];for(;p.numBatches-- >0;){for(b=Number.POSITIVE_INFINITY,c=-1;++c0&&(l[v++]=Dr({type:new ls(n),length:b,nullCount:0,children:z.slice()})))}return[r=r.assign(n),l.map(B=>new Is(r,B))]}function Nk(r,e,n,l,p){var v;const b=(e+63&-64)>>3;for(let c=-1,A=l.length;++c=e)z===e?n[c]=T:(n[c]=T.slice(0,e),p.numBatches=Math.max(p.numBatches,l[c].unshift(T.slice(e,z-e))));else{const B=r[c];r[c]=B.clone({nullable:!0}),n[c]=(v=T==null?void 0:T._changeLengthAndBackfillNullBitmap(e))!==null&&v!==void 0?v:Dr({type:B.type,length:e,nullCount:e,nullBitmap:new Uint8Array(b)})}}return n}var E1;let el=class Cl{constructor(...e){var n,l;if(e.length===0)return this.batches=[],this.schema=new ti([]),this._offsets=[0],this;let p,v;e[0]instanceof ti&&(p=e.shift()),e.at(-1)instanceof Uint32Array&&(v=e.pop());const b=A=>{if(A){if(A instanceof Is)return[A];if(A instanceof Cl)return A.batches;if(A instanceof ai){if(A.type instanceof ls)return[new Is(new ti(A.type.children),A)]}else{if(Array.isArray(A))return A.flatMap(T=>b(T));if(typeof A[Symbol.iterator]=="function")return[...A].flatMap(T=>b(T));if(typeof A=="object"){const T=Object.keys(A),z=T.map(j=>new ei([A[j]])),B=p??new ti(T.map((j,Q)=>new Li(String(j),z[Q].type,z[Q].nullable))),[,U]=xg(B,z);return U.length===0?[new Is(A)]:U}}}return[]},c=e.flatMap(A=>b(A));if(p=(l=p??((n=c[0])===null||n===void 0?void 0:n.schema))!==null&&l!==void 0?l:new ti([]),!(p instanceof ti))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const A of c){if(!(A instanceof Is))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Xg(p,A.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=p,this.batches=c,this._offsets=v??_1(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,n)=>e+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=y1(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(Ay(e,this.numRows))}set(e,n){}indexOf(e,n){return-1}[Symbol.iterator](){return this.batches.length>0?Dy.visit(new ei(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ +${r.stack}`:l}const cv=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>{fr.__wbindgen_export_3.get(r.dtor)(r.a,r.b)});function UI(r,e,n,l){const p={a:r,b:e,cnt:1,dtor:n},v=(...b)=>{p.cnt++;const c=p.a;p.a=0;try{return l(c,p.b,...b)}finally{--p.cnt===0?(fr.__wbindgen_export_3.get(p.dtor)(c,p.b),cv.unregister(p)):p.a=c}};return v.original=p,cv.register(v,p,p),v}function $I(r,e,n){fr.closure1088_externref_shim(r,e,n)}function VI(r){const e=fr.__wbindgen_export_2.get(r);return fr.__externref_table_dealloc(r),e}function kl(r){return()=>{throw new Error(`${r} is not defined`)}}function jI(r){const e=fr.__externref_table_alloc();return fr.__wbindgen_export_2.set(e,r),e}function vn(r,e){try{return r.apply(this,e)}catch(n){const l=jI(n);fr.__wbindgen_exn_store(l)}}function qI(r,e,n,l){fr.closure14515_externref_shim(r,e,n,l)}const GI=["omit","same-origin","include"],ZI=["same-origin","no-cors","cors","navigate"],uv=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(r=>fr.__wbg_backend_free(r>>>0,1));class Yp{static __wrap(e){e=e>>>0;const n=Object.create(Yp.prototype);return n.__wbg_ptr=e,uv.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,uv.unregister(this),e}free(){const e=this.__destroy_into_raw();fr.__wbg_backend_free(e,0)}constructor(){return fr.backend_new()}getCountries(){return fr.backend_getCountries(this.__wbg_ptr)}search(e,n){return fr.backend_search(this.__wbg_ptr,e,n)}downloadMetrics(e){return fr.backend_downloadMetrics(this.__wbg_ptr,e)}downloadMetricsSql(e){return fr.backend_downloadMetricsSql(this.__wbg_ptr,e)}downloadGeoms(e){return fr.backend_downloadGeoms(this.__wbg_ptr,e)}downloadDataRequest(e,n){const l=kh(n,fr.__wbindgen_malloc,fr.__wbindgen_realloc),p=Dl;return fr.backend_downloadDataRequest(this.__wbg_ptr,e,l,p)}downloadDataRequestMetrics(e){return fr.backend_downloadDataRequestMetrics(this.__wbg_ptr,e)}downloadDataRequestMetricsSql(e){return fr.backend_downloadDataRequestMetricsSql(this.__wbg_ptr,e)}downloadDataRequestGeoms(e){return fr.backend_downloadDataRequestGeoms(this.__wbg_ptr,e)}downloadDataRequestGeomsPmtiles(e){return fr.backend_downloadDataRequestGeomsPmtiles(this.__wbg_ptr,e)}addColours(e){let n,l;try{const b=fr.backend_addColours(this.__wbg_ptr,e);var p=b[0],v=b[1];if(b[3])throw p=0,v=0,VI(b[2]);return n=p,l=v,Ea(p,v)}finally{fr.__wbindgen_free(n,l,1)}}}async function WI(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(l){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",l);else throw l}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}}function HI(){const r={};return r.wbg={},r.wbg.__wbindgen_string_get=function(e,n){const l=n,p=typeof l=="string"?l:void 0;var v=vh(p)?0:kh(p,fr.__wbindgen_malloc,fr.__wbindgen_realloc),b=Dl;Zs().setInt32(e+4*1,b,!0),Zs().setInt32(e+4*0,v,!0)},r.wbg.__wbg_backend_new=function(e){return Yp.__wrap(e)},r.wbg.__wbindgen_string_new=function(e,n){return Ea(e,n)},r.wbg.__wbindgen_boolean_get=function(e){const n=e;return typeof n=="boolean"?n?1:0:2},r.wbg.__wbindgen_is_bigint=function(e){return typeof e=="bigint"},r.wbg.__wbindgen_number_get=function(e,n){const l=n,p=typeof l=="number"?l:void 0;Zs().setFloat64(e+8*1,vh(p)?0:p,!0),Zs().setInt32(e+4*0,!vh(p),!0)},r.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},r.wbg.__wbindgen_in=function(e,n){return e in n},r.wbg.__wbindgen_bigint_from_i64=function(e){return e},r.wbg.__wbindgen_jsval_eq=function(e,n){return e===n},r.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},r.wbg.__wbindgen_error_new=function(e,n){return new Error(Ea(e,n))},r.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},r.wbg.__wbindgen_is_undefined=function(e){return e===void 0},r.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},r.wbg.__wbindgen_jsval_loose_eq=function(e,n){return e==n},r.wbg.__wbindgen_as_number=function(e){return+e},r.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(e,n){return e[n]},r.wbg.__wbg_new_abda76e883ba8a5f=function(){return new Error},r.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const l=n.stack,p=kh(l,fr.__wbindgen_malloc,fr.__wbindgen_realloc),v=Dl;Zs().setInt32(e+4*1,v,!0),Zs().setInt32(e+4*0,p,!0)},r.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let l,p;try{l=e,p=n,console.error(Ea(e,n))}finally{fr.__wbindgen_free(l,p,1)}},r.wbg.__wbg_fetch_f8d735ba6fe1b719=typeof fetch=="function"?fetch:kl("fetch"),r.wbg.__wbg_queueMicrotask_848aa4969108a57e=function(e){return e.queueMicrotask},r.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},r.wbg.__wbg_queueMicrotask_c5419c06eab41e73=typeof queueMicrotask=="function"?queueMicrotask:kl("queueMicrotask"),r.wbg.__wbg_fetch_1fdc4448ed9eec00=function(e,n){return e.fetch(n)},r.wbg.__wbg_debug_69675dd374e2c249=typeof console.debug=="function"?console.debug:kl("console.debug"),r.wbg.__wbg_error_53abcd6a461f73d8=typeof console.error=="function"?console.error:kl("console.error"),r.wbg.__wbg_info_f073b719c8035bbf=typeof console.info=="function"?console.info:kl("console.info"),r.wbg.__wbg_log_f740dc2253ea759b=typeof console.log=="function"?console.log:kl("console.log"),r.wbg.__wbg_warn_41503a1c2194de89=typeof console.warn=="function"?console.warn:kl("console.warn"),r.wbg.__wbg_newwithstrandinit_4b92c89af0a8e383=function(){return vn(function(e,n,l){return new Request(Ea(e,n),l)},arguments)},r.wbg.__wbg_setbody_aa8b691bec428bf4=function(e,n){e.body=n},r.wbg.__wbg_setcredentials_a4e661320cdb9738=function(e,n){e.credentials=GI[n]},r.wbg.__wbg_setheaders_f5205d36e423a544=function(e,n){e.headers=n},r.wbg.__wbg_setmethod_ce2da76000b02f6a=function(e,n,l){e.method=Ea(n,l)},r.wbg.__wbg_setmode_4919fd636102c586=function(e,n){e.mode=ZI[n]},r.wbg.__wbg_setsignal_812ccb8269a7fd90=function(e,n){e.signal=n},r.wbg.__wbg_new_a9ae04a5200606a5=function(){return vn(function(){return new Headers},arguments)},r.wbg.__wbg_append_8b3e7f74a47ea7d5=function(){return vn(function(e,n,l,p,v){e.append(Ea(n,l),Ea(p,v))},arguments)},r.wbg.__wbg_instanceof_Response_3c0e210a57ff751d=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},r.wbg.__wbg_url_58af972663531d16=function(e,n){const l=n.url,p=kh(l,fr.__wbindgen_malloc,fr.__wbindgen_realloc),v=Dl;Zs().setInt32(e+4*1,v,!0),Zs().setInt32(e+4*0,p,!0)},r.wbg.__wbg_status_5f4e900d22140a18=function(e){return e.status},r.wbg.__wbg_headers_1b9bf90c73fae600=function(e){return e.headers},r.wbg.__wbg_arrayBuffer_144729e09879650e=function(){return vn(function(e){return e.arrayBuffer()},arguments)},r.wbg.__wbg_text_ebeee8b31af4c919=function(){return vn(function(e){return e.text()},arguments)},r.wbg.__wbg_signal_9acfcec9e7dffc22=function(e){return e.signal},r.wbg.__wbg_new_75169ae5a9683c55=function(){return vn(function(){return new AbortController},arguments)},r.wbg.__wbg_abort_c57daab47a6c1215=function(e){e.abort()},r.wbg.__wbg_crypto_1d1f22824a6a080c=function(e){return e.crypto},r.wbg.__wbg_process_4a72847cc503995b=function(e){return e.process},r.wbg.__wbg_versions_f686565e586dd935=function(e){return e.versions},r.wbg.__wbg_node_104a2ff8d6ea03a2=function(e){return e.node},r.wbg.__wbg_require_cca90b1a94a0255b=function(){return vn(function(){return module.require},arguments)},r.wbg.__wbg_msCrypto_eb05e62b530a1508=function(e){return e.msCrypto},r.wbg.__wbg_randomFillSync_5c9c955aa56b6049=function(){return vn(function(e,n){e.randomFillSync(n)},arguments)},r.wbg.__wbg_getRandomValues_3aa56aa6edec874c=function(){return vn(function(e,n){e.getRandomValues(n)},arguments)},r.wbg.__wbg_get_5419cf6b954aa11d=function(e,n){return e[n>>>0]},r.wbg.__wbg_length_f217bbbf7e8e4df4=function(e){return e.length},r.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43=function(e,n){return new Function(Ea(e,n))},r.wbg.__wbg_next_13b477da1eaa3897=function(e){return e.next},r.wbg.__wbg_next_b06e115d1b01e10b=function(){return vn(function(e){return e.next()},arguments)},r.wbg.__wbg_done_983b5ffcaec8c583=function(e){return e.done},r.wbg.__wbg_value_2ab8a198c834c26a=function(e){return e.value},r.wbg.__wbg_iterator_695d699a44d6234c=function(){return Symbol.iterator},r.wbg.__wbg_get_ef828680c64da212=function(){return vn(function(e,n){return Reflect.get(e,n)},arguments)},r.wbg.__wbg_call_a9ef466721e824f2=function(){return vn(function(e,n){return e.call(n)},arguments)},r.wbg.__wbg_new_e69b5f66fda8f13c=function(){return new Object},r.wbg.__wbg_self_bf91bf94d9e04084=function(){return vn(function(){return self.self},arguments)},r.wbg.__wbg_window_52dd9f07d03fd5f8=function(){return vn(function(){return window.window},arguments)},r.wbg.__wbg_globalThis_05c129bf37fcf1be=function(){return vn(function(){return globalThis.globalThis},arguments)},r.wbg.__wbg_global_3eca19bb09e9c484=function(){return vn(function(){return global.global},arguments)},r.wbg.__wbg_isArray_6f3b47f09adb61b5=function(e){return Array.isArray(e)},r.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7=function(e){let n;try{n=e instanceof ArrayBuffer}catch{n=!1}return n},r.wbg.__wbg_call_3bfa248576352471=function(){return vn(function(e,n,l){return e.call(n,l)},arguments)},r.wbg.__wbg_instanceof_Map_f96986929e7e89ed=function(e){let n;try{n=e instanceof Map}catch{n=!1}return n},r.wbg.__wbg_isSafeInteger_b9dff570f01a9100=function(e){return Number.isSafeInteger(e)},r.wbg.__wbg_entries_c02034de337d3ee2=function(e){return Object.entries(e)},r.wbg.__wbg_new_1073970097e5a420=function(e,n){try{var l={a:e,b:n},p=(b,c)=>{const A=l.a;l.a=0;try{return qI(A,l.b,b,c)}finally{l.a=A}};return new Promise(p)}finally{l.a=l.b=0}},r.wbg.__wbg_resolve_0aad7c1484731c99=function(e){return Promise.resolve(e)},r.wbg.__wbg_then_748f75edfb032440=function(e,n){return e.then(n)},r.wbg.__wbg_then_4866a7d9f55d8f3e=function(e,n,l){return e.then(n,l)},r.wbg.__wbg_buffer_ccaed51a635d8a2d=function(e){return e.buffer},r.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730=function(e,n,l){return new Uint8Array(e,n>>>0,l>>>0)},r.wbg.__wbg_new_fec2611eb9180f95=function(e){return new Uint8Array(e)},r.wbg.__wbg_set_ec2fcf81bc573fd9=function(e,n,l){e.set(n,l>>>0)},r.wbg.__wbg_length_9254c4bd3b9f23c4=function(e){return e.length},r.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36=function(e){let n;try{n=e instanceof Uint8Array}catch{n=!1}return n},r.wbg.__wbg_newwithlength_76462a666eca145f=function(e){return new Uint8Array(e>>>0)},r.wbg.__wbg_subarray_975a06f9dbd16995=function(e,n,l){return e.subarray(n>>>0,l>>>0)},r.wbg.__wbg_stringify_eead5648c09faaf8=function(){return vn(function(e){return JSON.stringify(e)},arguments)},r.wbg.__wbg_has_bd717f25f195f23d=function(){return vn(function(e,n){return Reflect.has(e,n)},arguments)},r.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const l=n,p=typeof l=="bigint"?l:void 0;Zs().setBigInt64(e+8*1,vh(p)?BigInt(0):p,!0),Zs().setInt32(e+4*0,!vh(p),!0)},r.wbg.__wbindgen_debug_string=function(e,n){const l=Ug(n),p=kh(l,fr.__wbindgen_malloc,fr.__wbindgen_realloc),v=Dl;Zs().setInt32(e+4*1,v,!0),Zs().setInt32(e+4*0,p,!0)},r.wbg.__wbindgen_throw=function(e,n){throw new Error(Ea(e,n))},r.wbg.__wbindgen_memory=function(){return fr.memory},r.wbg.__wbindgen_closure_wrapper2470=function(e,n,l){return UI(e,n,1089,$I)},r.wbg.__wbindgen_init_externref_table=function(){const e=fr.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},r}function YI(r,e){return fr=r.exports,Ub.__wbindgen_wasm_module=e,El=null,Th=null,fr.__wbindgen_start(),fr}async function Ub(r){if(fr!==void 0)return fr;typeof r<"u"&&(Object.getPrototypeOf(r)===Object.prototype?{module_or_path:r}=r:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof r>"u"&&(r=new URL("rust_backend_bg.wasm",import.meta.url));const e=HI();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:n,module:l}=await WI(await r,e);return YI(n,l)}class KI{constructor(){pg(this,"inner");this.inner=null}async initialise(){await Ub(),this.inner=await new Yp}unset(){this.inner=null}isLoaded(){return this.inner!=null}isLoadedWithThrow(){if(!this.isLoaded())throw new Error("RustBackend not initialised")}async addColours(e){this.isLoadedWithThrow();const n=JSON.parse(this.inner.addColours(e));return console.log("RustBackend.addColours result",n),n}async getCountries(){this.isLoadedWithThrow();const e=JSON.parse(await this.inner.getCountries());return console.log("RustBackend.getCountries result",e),e}async search(e,n){return this.isLoadedWithThrow(),JSON.parse(await this.inner.search(e,n))}async downloadMetrics(e){return this.isLoadedWithThrow(),JSON.parse(await this.inner.downloadMetrics(e))}async downloadGeoms(e){return this.isLoadedWithThrow(),JSON.parse(await this.inner.downloadGeoms(e))}async downloadDataRequestMetrics(e){return this.isLoadedWithThrow(),await this.inner.downloadDataRequestMetrics(e)}async downloadDataRequestMetricsSql(e){return this.isLoadedWithThrow(),await this.inner.downloadDataRequestMetricsSql(e)}async downloadDataRequestGeoms(e){return this.isLoadedWithThrow(),JSON.parse(await this.inner.downloadDataRequestGeoms(e))}async downloadDataRequestGeomsPmtiles(e){return this.isLoadedWithThrow(),await this.inner.downloadDataRequestGeomsPmtiles(e)}async downloadDataRequest(e,n="geojson"){return this.isLoadedWithThrow(),await this.inner.downloadDataRequest(e,n)}}Hp(KI);function ur(r,e,n,l){function p(v){return v instanceof n?v:new n(function(b){b(v)})}return new(n||(n=Promise))(function(v,b){function c(z){try{T(l.next(z))}catch(B){b(B)}}function A(z){try{T(l.throw(z))}catch(B){b(B)}}function T(z){z.done?v(z.value):p(z.value).then(c,A)}T((l=l.apply(r,e||[])).next())})}function hv(r){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&r[e],l=0;if(n)return n.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&l>=r.length&&(r=void 0),{value:r&&r[l++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Sr(r){return this instanceof Sr?(this.v=r,this):new Sr(r)}function Ba(r,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var l=n.apply(r,e||[]),p,v=[];return p={},c("next"),c("throw"),c("return",b),p[Symbol.asyncIterator]=function(){return this},p;function b(j){return function(Q){return Promise.resolve(Q).then(j,B)}}function c(j,Q){l[j]&&(p[j]=function(ae){return new Promise(function(ne,Y){v.push([j,ae,ne,Y])>1||A(j,ae)})},Q&&(p[j]=Q(p[j])))}function A(j,Q){try{T(l[j](Q))}catch(ae){U(v[0][3],ae)}}function T(j){j.value instanceof Sr?Promise.resolve(j.value.v).then(z,B):U(v[0][2],j)}function z(j){A("next",j)}function B(j){A("throw",j)}function U(j,Q){j(Q),v.shift(),v.length&&A(v[0][0],v[0][1])}}function Lf(r){var e,n;return e={},l("next"),l("throw",function(p){throw p}),l("return"),e[Symbol.iterator]=function(){return this},e;function l(p,v){e[p]=r[p]?function(b){return(n=!n)?{value:Sr(r[p](b)),done:!1}:v?v(b):b}:v}}function zl(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],n;return e?e.call(r):(r=typeof hv=="function"?hv(r):r[Symbol.iterator](),n={},l("next"),l("throw"),l("return"),n[Symbol.asyncIterator]=function(){return this},n);function l(v){n[v]=r[v]&&function(b){return new Promise(function(c,A){b=r[v](b),p(c,A,b.done,b.value)})}}function p(v,b,c,A){Promise.resolve(A).then(function(T){v({value:T,done:c})},b)}}const XI=new TextDecoder("utf-8"),$g=r=>XI.decode(r),JI=new TextEncoder,by=r=>JI.encode(r),QI=r=>typeof r=="number",$b=r=>typeof r=="boolean",bn=r=>typeof r=="function",ks=r=>r!=null&&Object(r)===r,Nl=r=>ks(r)&&bn(r.then),Qh=r=>ks(r)&&bn(r[Symbol.iterator]),cu=r=>ks(r)&&bn(r[Symbol.asyncIterator]),Vg=r=>ks(r)&&ks(r.schema),Vb=r=>ks(r)&&"done"in r&&"value"in r,jb=r=>ks(r)&&bn(r.stat)&&QI(r.fd),qb=r=>ks(r)&&xy(r.body),Kp=r=>"_getDOMStream"in r&&"_getNodeStream"in r,eT=r=>ks(r)&&bn(r.abort)&&bn(r.getWriter)&&!Kp(r),xy=r=>ks(r)&&bn(r.cancel)&&bn(r.getReader)&&!Kp(r),tT=r=>ks(r)&&bn(r.end)&&bn(r.write)&&$b(r.writable)&&!Kp(r),Gb=r=>ks(r)&&bn(r.read)&&bn(r.pipe)&&$b(r.readable)&&!Kp(r),rT=r=>ks(r)&&bn(r.clear)&&bn(r.bytes)&&bn(r.position)&&bn(r.setPosition)&&bn(r.capacity)&&bn(r.getBufferIdentifier)&&bn(r.createLong),wy=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function iT(r){const e=r[0]?[r[0]]:[];let n,l,p,v;for(let b,c,A=0,T=0,z=r.length;++Az+B.byteLength,0);let p,v,b,c=0,A=-1;const T=Math.min(e||Number.POSITIVE_INFINITY,l);for(const z=n.length;++Ali(Int32Array,r),fv=r=>li(BigInt64Array,r),Nr=r=>li(Uint8Array,r),jg=r=>(r.next(),r);function*nT(r,e){const n=function*(p){yield p},l=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wy?n(e):Qh(e)?e:n(e);return yield*jg(function*(p){let v=null;do v=p.next(yield li(r,v));while(!v.done)}(l[Symbol.iterator]())),new r}const sT=r=>nT(Uint8Array,r);function Zb(r,e){return Ba(this,arguments,function*(){if(Nl(e))return yield Sr(yield Sr(yield*Lf(zl(Zb(r,yield Sr(e))))));const l=function(b){return Ba(this,arguments,function*(){yield yield Sr(yield Sr(b))})},p=function(b){return Ba(this,arguments,function*(){yield Sr(yield*Lf(zl(jg(function*(c){let A=null;do A=c.next(yield A==null?void 0:A.value);while(!A.done)}(b[Symbol.iterator]())))))})},v=typeof e=="string"||ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof wy?l(e):Qh(e)?p(e):cu(e)?e:l(e);return yield Sr(yield*Lf(zl(jg(function(b){return Ba(this,arguments,function*(){let c=null;do c=yield Sr(b.next(yield yield Sr(li(r,c))));while(!c.done)})}(v[Symbol.asyncIterator]()))))),yield Sr(new r)})}const aT=r=>Zb(Uint8Array,r);function Wb(r,e,n){if(r!==0){n=n.slice(0,e);for(let l=-1,p=n.length;++l0)do if(r[n]!==e[n])return!1;while(++n(r.next(),r);function*lT(r){let e,n=!1,l=[],p,v,b,c=0;function A(){return v==="peek"?Ua(l,b)[0]:([p,l,c]=Ua(l,b),p)}({cmd:v,size:b}=(yield null)||{cmd:"read",size:0});const T=sT(r)[Symbol.iterator]();try{do if({done:e,value:p}=Number.isNaN(b-c)?T.next():T.next(b-c),!e&&p.byteLength>0&&(l.push(p),c+=p.byteLength),e||b<=c)do({cmd:v,size:b}=yield A());while(b0&&(p.push(v),A+=v.byteLength),n||c<=A)do({cmd:b,size:c}=yield yield Sr(T()));while(c0&&(p.push(Nr(v)),A+=v.byteLength),n||c<=A)do({cmd:b,size:c}=yield yield Sr(T()));while(c{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(e){return ur(this,void 0,void 0,function*(){const{reader:n,source:l}=this;n&&(yield n.cancel(e).catch(()=>{})),l&&l.locked&&this.releaseLock()})}read(e){return ur(this,void 0,void 0,function*(){if(e===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=Nr(n)),n})}}const yg=(r,e)=>{const n=p=>l([e,p]);let l;return[e,n,new Promise(p=>(l=p)&&r.once(e,n))]};function dT(r){return Ba(this,arguments,function*(){const n=[];let l="error",p=!1,v=null,b,c,A=0,T=[],z;function B(){return b==="peek"?Ua(T,c)[0]:([z,T,A]=Ua(T,c),z)}if({cmd:b,size:c}=(yield yield Sr(null))||{cmd:"read",size:0},r.isTTY)return yield yield Sr(new Uint8Array(0)),yield Sr(null);try{n[0]=yg(r,"end"),n[1]=yg(r,"error");do{if(n[2]=yg(r,"readable"),[l,v]=yield Sr(Promise.race(n.map(j=>j[2]))),l==="error")break;if((p=l==="end")||(Number.isFinite(c-A)?(z=Nr(r.read(c-A)),z.byteLength0&&(T.push(z),A+=z.byteLength)),p||c<=A)do({cmd:b,size:c}=yield yield Sr(B()));while(c{for(const[Y,_e]of j)r.off(Y,_e);try{const Y=r.destroy;Y&&Y.call(r,Q),Q=void 0}catch(Y){Q=Y||Q}finally{Q!=null?ne(Q):ae()}})}})}var ln;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(ln||(ln={}));var Kn;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Kn||(Kn={}));var Yn;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Yn||(Yn={}));var Qs;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Qs||(Qs={}));var Jt;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Jt||(Jt={}));var $a;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})($a||($a={}));const _g=2,Pa=4,mo=4,ri=4,Wo=new Int32Array(2),pv=new Float32Array(Wo.buffer),mv=new Float64Array(Wo.buffer),xf=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var qg;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(qg||(qg={}));let Qc=class Hb{constructor(e){this.bytes_=e,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(e){return new Hb(new Uint8Array(e))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(e){this.position_=e}capacity(){return this.bytes_.length}readInt8(e){return this.readUint8(e)<<24>>24}readUint8(e){return this.bytes_[e]}readInt16(e){return this.readUint16(e)<<16>>16}readUint16(e){return this.bytes_[e]|this.bytes_[e+1]<<8}readInt32(e){return this.bytes_[e]|this.bytes_[e+1]<<8|this.bytes_[e+2]<<16|this.bytes_[e+3]<<24}readUint32(e){return this.readInt32(e)>>>0}readInt64(e){return BigInt.asIntN(64,BigInt(this.readUint32(e))+(BigInt(this.readUint32(e+4))<>8}writeUint16(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8}writeInt32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeUint32(e,n){this.bytes_[e]=n,this.bytes_[e+1]=n>>8,this.bytes_[e+2]=n>>16,this.bytes_[e+3]=n>>24}writeInt64(e,n){this.writeInt32(e,Number(BigInt.asIntN(32,n))),this.writeInt32(e+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(e,n){this.writeUint32(e,Number(BigInt.asUintN(32,n))),this.writeUint32(e+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(e,n){pv[0]=n,this.writeInt32(e,Wo[0])}writeFloat64(e,n){mv[0]=n,this.writeInt32(e,Wo[xf?0:1]),this.writeInt32(e+4,Wo[xf?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=e);const l=~(this.bb.capacity()-this.space+n)+1&e-1;for(;this.space=0&&this.vtable[n]==0;n--);const l=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?e-this.vtable[n]:0);const p=2;this.addInt16(e-this.object_start);const v=(l+p)*_g;this.addInt16(v);let b=0;const c=this.space;e:for(n=0;n=0;b--)this.writeInt8(v.charCodeAt(b))}this.prep(this.minalign,Pa+p),this.addOffset(e),p&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(e,n){this.finish(e,n,!0)}requiredField(e,n){const l=this.bb.capacity()-e,p=l-this.bb.readInt32(l);if(!(n=0;l--)e.addInt32(n[l]);return e.endVector()}static startTypeIdsVector(e,n){e.startVector(4,n,4)}static endUnion(e){return e.endObject()}static createUnion(e,n,l){return Ss.startUnion(e),Ss.addMode(e,n),Ss.addTypeIds(e,l),Ss.endUnion(e)}}let wv=class Lh{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsUtf8(e,n){return(n||new Lh).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsUtf8(e,n){return e.setPosition(e.position()+ri),(n||new Lh).__init(e.readInt32(e.position())+e.position(),e)}static startUtf8(e){e.startObject(0)}static endUtf8(e){return e.endObject()}static createUtf8(e){return Lh.startUtf8(e),Lh.endUtf8(e)}};var Ti;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(Ti||(Ti={}));let Ws=class Nf{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsField(e,n){return(n||new Nf).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsField(e,n){return e.setPosition(e.position()+ri),(n||new Nf).__init(e.readInt32(e.position())+e.position(),e)}name(e){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,e):null}nullable(){const e=this.bb.__offset(this.bb_pos,6);return e?!!this.bb.readInt8(this.bb_pos+e):!1}typeType(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.readUint8(this.bb_pos+e):Ti.NONE}type(e){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(e,this.bb_pos+n):null}dictionary(e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new go).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(e,n){const l=this.bb.__offset(this.bb_pos,14);return l?(n||new Nf).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}childrenLength(){const e=this.bb.__offset(this.bb_pos,14);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,16);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,16);return e?this.bb.__vector_len(this.bb_pos+e):0}static startField(e){e.startObject(7)}static addName(e,n){e.addFieldOffset(0,n,0)}static addNullable(e,n){e.addFieldInt8(1,+n,0)}static addTypeType(e,n){e.addFieldInt8(2,n,Ti.NONE)}static addType(e,n){e.addFieldOffset(3,n,0)}static addDictionary(e,n){e.addFieldOffset(4,n,0)}static addChildren(e,n){e.addFieldOffset(5,n,0)}static createChildrenVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startChildrenVector(e,n){e.startVector(4,n,4)}static addCustomMetadata(e,n){e.addFieldOffset(6,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endField(e){return e.endObject()}},Ma=class co{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsSchema(e,n){return(n||new co).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsSchema(e,n){return e.setPosition(e.position()+ri),(n||new co).__init(e.readInt32(e.position())+e.position(),e)}endianness(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):eu.Little}fields(e,n){const l=this.bb.__offset(this.bb_pos,6);return l?(n||new Ws).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}fieldsLength(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,8);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}features(e){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+e*8):BigInt(0)}featuresLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}static startSchema(e){e.startObject(4)}static addEndianness(e,n){e.addFieldInt16(0,n,eu.Little)}static addFields(e,n){e.addFieldOffset(1,n,0)}static createFieldsVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startFieldsVector(e,n){e.startVector(4,n,4)}static addCustomMetadata(e,n){e.addFieldOffset(2,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static addFeatures(e,n){e.addFieldOffset(3,n,0)}static createFeaturesVector(e,n){e.startVector(8,n.length,8);for(let l=n.length-1;l>=0;l--)e.addInt64(n[l]);return e.endVector()}static startFeaturesVector(e,n){e.startVector(8,n,8)}static endSchema(e){return e.endObject()}static finishSchemaBuffer(e,n){e.finish(n)}static finishSizePrefixedSchemaBuffer(e,n){e.finish(n,void 0,!0)}static createSchema(e,n,l,p,v){return co.startSchema(e),co.addEndianness(e,n),co.addFields(e,l),co.addCustomMetadata(e,p),co.addFeatures(e,v),co.endSchema(e)}};var Zr;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(Zr||(Zr={}));var ce;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(ce||(ce={}));var ho;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(ho||(ho={}));const fT=void 0;function Vh(r){if(r===null)return"null";if(r===fT)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(e=>Vh(e))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(e,n)=>typeof n=="bigint"?`${n}`:n)}function yi(r){if(typeof r=="bigint"&&(rNumber.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Qb(r,e){return yi(r/e)+yi(r%e)/yi(e)}const pT=Symbol.for("isArrowBigNum");function _a(r,...e){return e.length===0?Object.setPrototypeOf(li(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...e),this.constructor.prototype)}_a.prototype[pT]=!0;_a.prototype.toJSON=function(){return`"${qh(this)}"`};_a.prototype.valueOf=function(r){return ex(this,r)};_a.prototype.toString=function(){return qh(this)};_a.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return ex(this);case"string":return qh(this);case"default":return yT(this)}return qh(this)};function Zc(...r){return _a.apply(this,r)}function Wc(...r){return _a.apply(this,r)}function jh(...r){return _a.apply(this,r)}Object.setPrototypeOf(Zc.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Wc.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(jh.prototype,Object.create(Uint32Array.prototype));Object.assign(Zc.prototype,_a.prototype,{constructor:Zc,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Wc.prototype,_a.prototype,{constructor:Wc,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(jh.prototype,_a.prototype,{constructor:jh,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const mT=BigInt(4294967296)*BigInt(4294967296),gT=mT-BigInt(1);function ex(r,e){const{buffer:n,byteOffset:l,byteLength:p,signed:v}=r,b=new BigUint64Array(n,l,p/8),c=v&&b.at(-1)&BigInt(1)<=0)return vg(r);e=e.slice();let l=1;for(let v=0;v(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(Vt.prototype);class Xo extends Vt{constructor(){super(ce.Null)}toString(){return"Null"}}rx=Symbol.toStringTag;Xo[rx]=(r=>r[Symbol.toStringTag]="Null")(Xo.prototype);class Ul extends Vt{constructor(e,n){super(ce.Int),this.isSigned=e,this.bitWidth=n}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}ix=Symbol.toStringTag;Ul[ix]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Ul.prototype);class Gh extends Ul{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(Gh.prototype,"ArrayType",{value:Int32Array});class ep extends Vt{constructor(e){super(ce.Float),this.precision=e}get ArrayType(){switch(this.precision){case Yn.HALF:return Uint16Array;case Yn.SINGLE:return Float32Array;case Yn.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}nx=Symbol.toStringTag;ep[nx]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ep.prototype);class tp extends Vt{constructor(){super(ce.Binary)}toString(){return"Binary"}}sx=Symbol.toStringTag;tp[sx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(tp.prototype);class rp extends Vt{constructor(){super(ce.LargeBinary)}toString(){return"LargeBinary"}}ax=Symbol.toStringTag;rp[ax]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(rp.prototype);class ip extends Vt{constructor(){super(ce.Utf8)}toString(){return"Utf8"}}ox=Symbol.toStringTag;ip[ox]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(ip.prototype);class np extends Vt{constructor(){super(ce.LargeUtf8)}toString(){return"LargeUtf8"}}lx=Symbol.toStringTag;np[lx]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(np.prototype);class sp extends Vt{constructor(){super(ce.Bool)}toString(){return"Bool"}}cx=Symbol.toStringTag;sp[cx]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(sp.prototype);class ap extends Vt{constructor(e,n,l=128){super(ce.Decimal),this.scale=e,this.precision=n,this.bitWidth=l}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}ux=Symbol.toStringTag;ap[ux]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ap.prototype);class op extends Vt{constructor(e){super(ce.Date),this.unit=e}toString(){return`Date${(this.unit+1)*32}<${Qs[this.unit]}>`}get ArrayType(){return this.unit===Qs.DAY?Int32Array:BigInt64Array}}hx=Symbol.toStringTag;op[hx]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(op.prototype);class lp extends Vt{constructor(e,n){super(ce.Time),this.unit=e,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${Jt[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}dx=Symbol.toStringTag;lp[dx]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(lp.prototype);class cp extends Vt{constructor(e,n){super(ce.Timestamp),this.unit=e,this.timezone=n}toString(){return`Timestamp<${Jt[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}fx=Symbol.toStringTag;cp[fx]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(cp.prototype);class up extends Vt{constructor(e){super(ce.Interval),this.unit=e}toString(){return`Interval<${$a[this.unit]}>`}}px=Symbol.toStringTag;up[px]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(up.prototype);class hp extends Vt{constructor(e){super(ce.Duration),this.unit=e}toString(){return`Duration<${Jt[this.unit]}>`}}mx=Symbol.toStringTag;hp[mx]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(hp.prototype);class dp extends Vt{constructor(e){super(ce.List),this.children=[e]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}gx=Symbol.toStringTag;dp[gx]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(dp.prototype);class ls extends Vt{constructor(e){super(ce.Struct),this.children=e}toString(){return`Struct<{${this.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}yx=Symbol.toStringTag;ls[yx]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ls.prototype);class fp extends Vt{constructor(e,n,l){super(ce.Union),this.mode=e,this.children=l,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((p,v,b)=>(p[v]=b)&&p||p,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(e=>`${e.type}`).join(" | ")}>`}}_x=Symbol.toStringTag;fp[_x]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(fp.prototype);class pp extends Vt{constructor(e){super(ce.FixedSizeBinary),this.byteWidth=e}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}vx=Symbol.toStringTag;pp[vx]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(pp.prototype);class mp extends Vt{constructor(e,n){super(ce.FixedSizeList),this.listSize=e,this.children=[n]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}bx=Symbol.toStringTag;mp[bx]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(mp.prototype);class gp extends Vt{constructor(e,n=!1){var l,p,v;if(super(ce.Map),this.children=[e],this.keysSorted=n,e&&(e.name="entries",!((l=e==null?void 0:e.type)===null||l===void 0)&&l.children)){const b=(p=e==null?void 0:e.type)===null||p===void 0?void 0:p.children[0];b&&(b.name="key");const c=(v=e==null?void 0:e.type)===null||v===void 0?void 0:v.children[1];c&&(c.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(e=>`${e.name}:${e.type}`).join(", ")}}>`}}xx=Symbol.toStringTag;gp[xx]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(gp.prototype);const _T=(r=>()=>++r)(-1);class tu extends Vt{constructor(e,n,l,p){super(ce.Dictionary),this.indices=n,this.dictionary=e,this.isOrdered=p||!1,this.id=l==null?_T():yi(l)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}wx=Symbol.toStringTag;tu[wx]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(tu.prototype);function fo(r){const e=r;switch(r.typeId){case ce.Decimal:return r.bitWidth/32;case ce.Interval:return 1+e.unit;case ce.FixedSizeList:return e.listSize;case ce.FixedSizeBinary:return e.byteWidth;default:return 1}}class Cr{visitMany(e,...n){return e.map((l,p)=>this.visit(l,...n.map(v=>v[p])))}visit(...e){return this.getVisitFn(e[0],!1).apply(this,e)}getVisitFn(e,n=!0){return vT(this,e,n)}getVisitFnByTypeId(e,n=!0){return Uc(this,e,n)}visitNull(e,...n){return null}visitBool(e,...n){return null}visitInt(e,...n){return null}visitFloat(e,...n){return null}visitUtf8(e,...n){return null}visitLargeUtf8(e,...n){return null}visitBinary(e,...n){return null}visitLargeBinary(e,...n){return null}visitFixedSizeBinary(e,...n){return null}visitDate(e,...n){return null}visitTimestamp(e,...n){return null}visitTime(e,...n){return null}visitDecimal(e,...n){return null}visitList(e,...n){return null}visitStruct(e,...n){return null}visitUnion(e,...n){return null}visitDictionary(e,...n){return null}visitInterval(e,...n){return null}visitDuration(e,...n){return null}visitFixedSizeList(e,...n){return null}visitMap(e,...n){return null}}function vT(r,e,n=!0){return typeof e=="number"?Uc(r,e,n):typeof e=="string"&&e in ce?Uc(r,ce[e],n):e&&e instanceof Vt?Uc(r,Sv(e),n):e!=null&&e.type&&e.type instanceof Vt?Uc(r,Sv(e.type),n):Uc(r,ce.NONE,n)}function Uc(r,e,n=!0){let l=null;switch(e){case ce.Null:l=r.visitNull;break;case ce.Bool:l=r.visitBool;break;case ce.Int:l=r.visitInt;break;case ce.Int8:l=r.visitInt8||r.visitInt;break;case ce.Int16:l=r.visitInt16||r.visitInt;break;case ce.Int32:l=r.visitInt32||r.visitInt;break;case ce.Int64:l=r.visitInt64||r.visitInt;break;case ce.Uint8:l=r.visitUint8||r.visitInt;break;case ce.Uint16:l=r.visitUint16||r.visitInt;break;case ce.Uint32:l=r.visitUint32||r.visitInt;break;case ce.Uint64:l=r.visitUint64||r.visitInt;break;case ce.Float:l=r.visitFloat;break;case ce.Float16:l=r.visitFloat16||r.visitFloat;break;case ce.Float32:l=r.visitFloat32||r.visitFloat;break;case ce.Float64:l=r.visitFloat64||r.visitFloat;break;case ce.Utf8:l=r.visitUtf8;break;case ce.LargeUtf8:l=r.visitLargeUtf8;break;case ce.Binary:l=r.visitBinary;break;case ce.LargeBinary:l=r.visitLargeBinary;break;case ce.FixedSizeBinary:l=r.visitFixedSizeBinary;break;case ce.Date:l=r.visitDate;break;case ce.DateDay:l=r.visitDateDay||r.visitDate;break;case ce.DateMillisecond:l=r.visitDateMillisecond||r.visitDate;break;case ce.Timestamp:l=r.visitTimestamp;break;case ce.TimestampSecond:l=r.visitTimestampSecond||r.visitTimestamp;break;case ce.TimestampMillisecond:l=r.visitTimestampMillisecond||r.visitTimestamp;break;case ce.TimestampMicrosecond:l=r.visitTimestampMicrosecond||r.visitTimestamp;break;case ce.TimestampNanosecond:l=r.visitTimestampNanosecond||r.visitTimestamp;break;case ce.Time:l=r.visitTime;break;case ce.TimeSecond:l=r.visitTimeSecond||r.visitTime;break;case ce.TimeMillisecond:l=r.visitTimeMillisecond||r.visitTime;break;case ce.TimeMicrosecond:l=r.visitTimeMicrosecond||r.visitTime;break;case ce.TimeNanosecond:l=r.visitTimeNanosecond||r.visitTime;break;case ce.Decimal:l=r.visitDecimal;break;case ce.List:l=r.visitList;break;case ce.Struct:l=r.visitStruct;break;case ce.Union:l=r.visitUnion;break;case ce.DenseUnion:l=r.visitDenseUnion||r.visitUnion;break;case ce.SparseUnion:l=r.visitSparseUnion||r.visitUnion;break;case ce.Dictionary:l=r.visitDictionary;break;case ce.Interval:l=r.visitInterval;break;case ce.IntervalDayTime:l=r.visitIntervalDayTime||r.visitInterval;break;case ce.IntervalYearMonth:l=r.visitIntervalYearMonth||r.visitInterval;break;case ce.Duration:l=r.visitDuration;break;case ce.DurationSecond:l=r.visitDurationSecond||r.visitDuration;break;case ce.DurationMillisecond:l=r.visitDurationMillisecond||r.visitDuration;break;case ce.DurationMicrosecond:l=r.visitDurationMicrosecond||r.visitDuration;break;case ce.DurationNanosecond:l=r.visitDurationNanosecond||r.visitDuration;break;case ce.FixedSizeList:l=r.visitFixedSizeList;break;case ce.Map:l=r.visitMap;break}if(typeof l=="function")return l;if(!n)return()=>null;throw new Error(`Unrecognized type '${ce[e]}'`)}function Sv(r){switch(r.typeId){case ce.Null:return ce.Null;case ce.Int:{const{bitWidth:e,isSigned:n}=r;switch(e){case 8:return n?ce.Int8:ce.Uint8;case 16:return n?ce.Int16:ce.Uint16;case 32:return n?ce.Int32:ce.Uint32;case 64:return n?ce.Int64:ce.Uint64}return ce.Int}case ce.Float:switch(r.precision){case Yn.HALF:return ce.Float16;case Yn.SINGLE:return ce.Float32;case Yn.DOUBLE:return ce.Float64}return ce.Float;case ce.Binary:return ce.Binary;case ce.LargeBinary:return ce.LargeBinary;case ce.Utf8:return ce.Utf8;case ce.LargeUtf8:return ce.LargeUtf8;case ce.Bool:return ce.Bool;case ce.Decimal:return ce.Decimal;case ce.Time:switch(r.unit){case Jt.SECOND:return ce.TimeSecond;case Jt.MILLISECOND:return ce.TimeMillisecond;case Jt.MICROSECOND:return ce.TimeMicrosecond;case Jt.NANOSECOND:return ce.TimeNanosecond}return ce.Time;case ce.Timestamp:switch(r.unit){case Jt.SECOND:return ce.TimestampSecond;case Jt.MILLISECOND:return ce.TimestampMillisecond;case Jt.MICROSECOND:return ce.TimestampMicrosecond;case Jt.NANOSECOND:return ce.TimestampNanosecond}return ce.Timestamp;case ce.Date:switch(r.unit){case Qs.DAY:return ce.DateDay;case Qs.MILLISECOND:return ce.DateMillisecond}return ce.Date;case ce.Interval:switch(r.unit){case $a.DAY_TIME:return ce.IntervalDayTime;case $a.YEAR_MONTH:return ce.IntervalYearMonth}return ce.Interval;case ce.Duration:switch(r.unit){case Jt.SECOND:return ce.DurationSecond;case Jt.MILLISECOND:return ce.DurationMillisecond;case Jt.MICROSECOND:return ce.DurationMicrosecond;case Jt.NANOSECOND:return ce.DurationNanosecond}return ce.Duration;case ce.Map:return ce.Map;case ce.List:return ce.List;case ce.Struct:return ce.Struct;case ce.Union:switch(r.mode){case Kn.Dense:return ce.DenseUnion;case Kn.Sparse:return ce.SparseUnion}return ce.Union;case ce.FixedSizeBinary:return ce.FixedSizeBinary;case ce.FixedSizeList:return ce.FixedSizeList;case ce.Dictionary:return ce.Dictionary}throw new Error(`Unrecognized type '${ce[r.typeId]}'`)}Cr.prototype.visitInt8=null;Cr.prototype.visitInt16=null;Cr.prototype.visitInt32=null;Cr.prototype.visitInt64=null;Cr.prototype.visitUint8=null;Cr.prototype.visitUint16=null;Cr.prototype.visitUint32=null;Cr.prototype.visitUint64=null;Cr.prototype.visitFloat16=null;Cr.prototype.visitFloat32=null;Cr.prototype.visitFloat64=null;Cr.prototype.visitDateDay=null;Cr.prototype.visitDateMillisecond=null;Cr.prototype.visitTimestampSecond=null;Cr.prototype.visitTimestampMillisecond=null;Cr.prototype.visitTimestampMicrosecond=null;Cr.prototype.visitTimestampNanosecond=null;Cr.prototype.visitTimeSecond=null;Cr.prototype.visitTimeMillisecond=null;Cr.prototype.visitTimeMicrosecond=null;Cr.prototype.visitTimeNanosecond=null;Cr.prototype.visitDenseUnion=null;Cr.prototype.visitSparseUnion=null;Cr.prototype.visitIntervalDayTime=null;Cr.prototype.visitIntervalYearMonth=null;Cr.prototype.visitDuration=null;Cr.prototype.visitDurationSecond=null;Cr.prototype.visitDurationMillisecond=null;Cr.prototype.visitDurationMicrosecond=null;Cr.prototype.visitDurationNanosecond=null;const Sx=new Float64Array(1),Mc=new Uint32Array(Sx.buffer);function Ix(r){const e=(r&31744)>>10,n=(r&1023)/1024,l=Math.pow(-1,(r&32768)>>15);switch(e){case 31:return l*(n?Number.NaN:1/0);case 0:return l*(n?6103515625e-14*n:0)}return l*Math.pow(2,e-15)*(1+n)}function bT(r){if(r!==r)return 32256;Sx[0]=r;const e=(Mc[1]&2147483648)>>16&65535;let n=Mc[1]&2146435072,l=0;return n>=1089470464?Mc[0]>0?n=31744:(n=(n&2080374784)>>16,l=(Mc[1]&1048575)>>10):n<=1056964608?(l=1048576+(Mc[1]&1048575),l=1048576+(l<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,l=(Mc[1]&1048575)+512>>10),e|n|l&65535}class Qt extends Cr{}function rr(r){return(e,n,l)=>{if(e.setValid(n,l!=null))return r(e,n,l)}}const xT=(r,e,n)=>{r[e]=Math.floor(n/864e5)},Tx=(r,e,n,l)=>{if(n+1{const p=r+n;l?e[p>>3]|=1<>3]&=~(1<{r[e]=n},Iy=({values:r},e,n)=>{r[e]=n},kx=({values:r},e,n)=>{r[e]=bT(n)},ST=(r,e,n)=>{switch(r.type.precision){case Yn.HALF:return kx(r,e,n);case Yn.SINGLE:case Yn.DOUBLE:return Iy(r,e,n)}},Ax=({values:r},e,n)=>{xT(r,e,n.valueOf())},Ex=({values:r},e,n)=>{r[e]=BigInt(n)},IT=({stride:r,values:e},n,l)=>{e.set(l.subarray(0,r),r*n)},Cx=({values:r,valueOffsets:e},n,l)=>Tx(r,e,n,l),Mx=({values:r,valueOffsets:e},n,l)=>Tx(r,e,n,by(l)),TT=(r,e,n)=>{r.type.unit===Qs.DAY?Ax(r,e,n):Ex(r,e,n)},Dx=({values:r},e,n)=>{r[e]=BigInt(n/1e3)},Px=({values:r},e,n)=>{r[e]=BigInt(n)},Lx=({values:r},e,n)=>{r[e]=BigInt(n*1e3)},zx=({values:r},e,n)=>{r[e]=BigInt(n*1e6)},kT=(r,e,n)=>{switch(r.type.unit){case Jt.SECOND:return Dx(r,e,n);case Jt.MILLISECOND:return Px(r,e,n);case Jt.MICROSECOND:return Lx(r,e,n);case Jt.NANOSECOND:return zx(r,e,n)}},Bx=({values:r},e,n)=>{r[e]=n},Rx=({values:r},e,n)=>{r[e]=n},Fx=({values:r},e,n)=>{r[e]=n},Ox=({values:r},e,n)=>{r[e]=n},AT=(r,e,n)=>{switch(r.type.unit){case Jt.SECOND:return Bx(r,e,n);case Jt.MILLISECOND:return Rx(r,e,n);case Jt.MICROSECOND:return Fx(r,e,n);case Jt.NANOSECOND:return Ox(r,e,n)}},ET=({values:r,stride:e},n,l)=>{r.set(l.subarray(0,e),e*n)},CT=(r,e,n)=>{const l=r.children[0],p=r.valueOffsets,v=ea.getVisitFn(l);if(Array.isArray(n))for(let b=-1,c=p[e],A=p[e+1];c{const l=r.children[0],{valueOffsets:p}=r,v=ea.getVisitFn(l);let{[e]:b,[e+1]:c}=p;const A=n instanceof Map?n.entries():Object.entries(n);for(const T of A)if(v(l,b,T),++b>=c)break},DT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e[v]),PT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e.get(v)),LT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e.get(p.name)),zT=(r,e)=>(n,l,p,v)=>l&&n(l,r,e[p.name]),BT=(r,e,n)=>{const l=r.type.children.map(v=>ea.getVisitFn(v.type)),p=n instanceof Map?LT(e,n):n instanceof ei?PT(e,n):Array.isArray(n)?DT(e,n):zT(e,n);r.type.children.forEach((v,b)=>p(l[b],r.children[b],v,b))},RT=(r,e,n)=>{r.type.mode===Kn.Dense?Nx(r,e,n):Ux(r,e,n)},Nx=(r,e,n)=>{const l=r.type.typeIdToChildIndex[r.typeIds[e]],p=r.children[l];ea.visit(p,r.valueOffsets[e],n)},Ux=(r,e,n)=>{const l=r.type.typeIdToChildIndex[r.typeIds[e]],p=r.children[l];ea.visit(p,e,n)},FT=(r,e,n)=>{var l;(l=r.dictionary)===null||l===void 0||l.set(r.values[e],n)},OT=(r,e,n)=>{r.type.unit===$a.DAY_TIME?$x(r,e,n):Vx(r,e,n)},$x=({values:r},e,n)=>{r.set(n.subarray(0,2),2*e)},Vx=({values:r},e,n)=>{r[e]=n[0]*12+n[1]%12},jx=({values:r},e,n)=>{r[e]=n},qx=({values:r},e,n)=>{r[e]=n},Gx=({values:r},e,n)=>{r[e]=n},Zx=({values:r},e,n)=>{r[e]=n},NT=(r,e,n)=>{switch(r.type.unit){case Jt.SECOND:return jx(r,e,n);case Jt.MILLISECOND:return qx(r,e,n);case Jt.MICROSECOND:return Gx(r,e,n);case Jt.NANOSECOND:return Zx(r,e,n)}},UT=(r,e,n)=>{const{stride:l}=r,p=r.children[0],v=ea.getVisitFn(p);if(Array.isArray(n))for(let b=-1,c=e*l;++b`${Vh(e)}: ${Vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new $T(this[fa],this[Hc])}}class $T{constructor(e,n){this.childIndex=0,this.children=e.children,this.rowIndex=n,this.childFields=e.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const e=this.childIndex;return en.name)}has(e,n){return e[fa].type.children.findIndex(l=>l.name===n)!==-1}getOwnPropertyDescriptor(e,n){if(e[fa].type.children.findIndex(l=>l.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,n){if(Reflect.has(e,n))return e[n];const l=e[fa].type.children.findIndex(p=>p.name===n);if(l!==-1){const p=As.visit(e[fa].children[l],e[Hc]);return Reflect.set(e,n,p),p}}set(e,n,l){const p=e[fa].type.children.findIndex(v=>v.name===n);return p!==-1?(ea.visit(e[fa].children[p],e[Hc],l),Reflect.set(e,n,l)):Reflect.has(e,n)||typeof n=="symbol"?Reflect.set(e,n,l):!1}}class Wt extends Cr{}function er(r){return(e,n)=>e.getValid(n)?r(e,n):null}const jT=(r,e)=>864e5*r[e],qT=(r,e)=>null,Wx=(r,e,n)=>{if(n+1>=e.length)return null;const l=yi(e[n]),p=yi(e[n+1]);return r.subarray(l,p)},GT=({offset:r,values:e},n)=>{const l=r+n;return(e[l>>3]&1<jT(r,e),Yx=({values:r},e)=>yi(r[e]),nl=({stride:r,values:e},n)=>e[r*n],ZT=({stride:r,values:e},n)=>Ix(e[r*n]),Kx=({values:r},e)=>r[e],WT=({stride:r,values:e},n)=>e.subarray(r*n,r*(n+1)),Xx=({values:r,valueOffsets:e},n)=>Wx(r,e,n),Jx=({values:r,valueOffsets:e},n)=>{const l=Wx(r,e,n);return l!==null?$g(l):null},HT=({values:r},e)=>r[e],YT=({type:r,values:e},n)=>r.precision!==Yn.HALF?e[n]:Ix(e[n]),KT=(r,e)=>r.type.unit===Qs.DAY?Hx(r,e):Yx(r,e),Qx=({values:r},e)=>1e3*yi(r[e]),e1=({values:r},e)=>yi(r[e]),t1=({values:r},e)=>Qb(r[e],BigInt(1e3)),r1=({values:r},e)=>Qb(r[e],BigInt(1e6)),XT=(r,e)=>{switch(r.type.unit){case Jt.SECOND:return Qx(r,e);case Jt.MILLISECOND:return e1(r,e);case Jt.MICROSECOND:return t1(r,e);case Jt.NANOSECOND:return r1(r,e)}},i1=({values:r},e)=>r[e],n1=({values:r},e)=>r[e],s1=({values:r},e)=>r[e],a1=({values:r},e)=>r[e],JT=(r,e)=>{switch(r.type.unit){case Jt.SECOND:return i1(r,e);case Jt.MILLISECOND:return n1(r,e);case Jt.MICROSECOND:return s1(r,e);case Jt.NANOSECOND:return a1(r,e)}},QT=({values:r,stride:e},n)=>Sy.decimal(r.subarray(e*n,e*(n+1))),ek=(r,e)=>{const{valueOffsets:n,stride:l,children:p}=r,{[e*l]:v,[e*l+1]:b}=n,A=p[0].slice(v,b-v);return new ei([A])},tk=(r,e)=>{const{valueOffsets:n,children:l}=r,{[e]:p,[e+1]:v}=n,b=l[0];return new ky(b.slice(p,v-p))},rk=(r,e)=>new Ty(r,e),ik=(r,e)=>r.type.mode===Kn.Dense?o1(r,e):l1(r,e),o1=(r,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[e]],l=r.children[n];return As.visit(l,r.valueOffsets[e])},l1=(r,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[e]],l=r.children[n];return As.visit(l,e)},nk=(r,e)=>{var n;return(n=r.dictionary)===null||n===void 0?void 0:n.get(r.values[e])},sk=(r,e)=>r.type.unit===$a.DAY_TIME?c1(r,e):u1(r,e),c1=({values:r},e)=>r.subarray(2*e,2*(e+1)),u1=({values:r},e)=>{const n=r[e],l=new Int32Array(2);return l[0]=Math.trunc(n/12),l[1]=Math.trunc(n%12),l},h1=({values:r},e)=>r[e],d1=({values:r},e)=>r[e],f1=({values:r},e)=>r[e],p1=({values:r},e)=>r[e],ak=(r,e)=>{switch(r.type.unit){case Jt.SECOND:return h1(r,e);case Jt.MILLISECOND:return d1(r,e);case Jt.MICROSECOND:return f1(r,e);case Jt.NANOSECOND:return p1(r,e)}},ok=(r,e)=>{const{stride:n,children:l}=r,v=l[0].slice(e*n,n);return new ei([v])};Wt.prototype.visitNull=er(qT);Wt.prototype.visitBool=er(GT);Wt.prototype.visitInt=er(HT);Wt.prototype.visitInt8=er(nl);Wt.prototype.visitInt16=er(nl);Wt.prototype.visitInt32=er(nl);Wt.prototype.visitInt64=er(Kx);Wt.prototype.visitUint8=er(nl);Wt.prototype.visitUint16=er(nl);Wt.prototype.visitUint32=er(nl);Wt.prototype.visitUint64=er(Kx);Wt.prototype.visitFloat=er(YT);Wt.prototype.visitFloat16=er(ZT);Wt.prototype.visitFloat32=er(nl);Wt.prototype.visitFloat64=er(nl);Wt.prototype.visitUtf8=er(Jx);Wt.prototype.visitLargeUtf8=er(Jx);Wt.prototype.visitBinary=er(Xx);Wt.prototype.visitLargeBinary=er(Xx);Wt.prototype.visitFixedSizeBinary=er(WT);Wt.prototype.visitDate=er(KT);Wt.prototype.visitDateDay=er(Hx);Wt.prototype.visitDateMillisecond=er(Yx);Wt.prototype.visitTimestamp=er(XT);Wt.prototype.visitTimestampSecond=er(Qx);Wt.prototype.visitTimestampMillisecond=er(e1);Wt.prototype.visitTimestampMicrosecond=er(t1);Wt.prototype.visitTimestampNanosecond=er(r1);Wt.prototype.visitTime=er(JT);Wt.prototype.visitTimeSecond=er(i1);Wt.prototype.visitTimeMillisecond=er(n1);Wt.prototype.visitTimeMicrosecond=er(s1);Wt.prototype.visitTimeNanosecond=er(a1);Wt.prototype.visitDecimal=er(QT);Wt.prototype.visitList=er(ek);Wt.prototype.visitStruct=er(rk);Wt.prototype.visitUnion=er(ik);Wt.prototype.visitDenseUnion=er(o1);Wt.prototype.visitSparseUnion=er(l1);Wt.prototype.visitDictionary=er(nk);Wt.prototype.visitInterval=er(sk);Wt.prototype.visitIntervalDayTime=er(c1);Wt.prototype.visitIntervalYearMonth=er(u1);Wt.prototype.visitDuration=er(ak);Wt.prototype.visitDurationSecond=er(h1);Wt.prototype.visitDurationMillisecond=er(d1);Wt.prototype.visitDurationMicrosecond=er(f1);Wt.prototype.visitDurationNanosecond=er(p1);Wt.prototype.visitFixedSizeList=er(ok);Wt.prototype.visitMap=er(tk);const As=new Wt,$c=Symbol.for("keys"),Yc=Symbol.for("vals"),Vc=Symbol.for("kKeysAsStrings"),Wg=Symbol.for("_kKeysAsStrings");class ky{constructor(e){return this[$c]=new ei([e.children[0]]).memoize(),this[Yc]=e.children[1],new Proxy(this,new ck)}get[Vc](){return this[Wg]||(this[Wg]=Array.from(this[$c].toArray(),String))}[Symbol.iterator](){return new lk(this[$c],this[Yc])}get size(){return this[$c].length}toArray(){return Object.values(this.toJSON())}toJSON(){const e=this[$c],n=this[Yc],l={};for(let p=-1,v=e.length;++p`${Vh(e)}: ${Vh(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class lk{constructor(e,n){this.keys=e,this.vals=n,this.keyIndex=0,this.numKeys=e.length}[Symbol.iterator](){return this}next(){const e=this.keyIndex;return e===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(e),As.visit(this.vals,e)]})}}class ck{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(e){return e[Vc]}has(e,n){return e[Vc].includes(n)}getOwnPropertyDescriptor(e,n){if(e[Vc].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(e,n){if(Reflect.has(e,n))return e[n];const l=e[Vc].indexOf(n);if(l!==-1){const p=As.visit(Reflect.get(e,Yc),l);return Reflect.set(e,n,p),p}}set(e,n,l){const p=e[Vc].indexOf(n);return p!==-1?(ea.visit(Reflect.get(e,Yc),p,l),Reflect.set(e,n,l)):Reflect.has(e,n)?Reflect.set(e,n,l):!1}}Object.defineProperties(ky.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[$c]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Yc]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Wg]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Iv;function m1(r,e,n,l){const{length:p=0}=r;let v=typeof e!="number"?0:e,b=typeof n!="number"?p:n;return v<0&&(v=(v%p+p)%p),b<0&&(b=(b%p+p)%p),bp&&(b=p),l?l(r,v,b):[v,b]}const Ay=(r,e)=>r<0?e+r:r,Tv=r=>r!==r;function uu(r){if(typeof r!=="object"||r===null)return Tv(r)?Tv:n=>n===r;if(r instanceof Date){const n=r.valueOf();return l=>l instanceof Date?l.valueOf()===n:!1}return ArrayBuffer.isView(r)?n=>n?oT(r,n):!1:r instanceof Map?hk(r):Array.isArray(r)?uk(r):r instanceof ei?dk(r):fk(r,!0)}function uk(r){const e=[];for(let n=-1,l=r.length;++n!1;const l=[];for(let p=-1,v=n.length;++p{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return pk(r,n);case Map:return kv(r,n,n.keys());case ky:case Ty:case Object:case void 0:return kv(r,n,e||Object.keys(n))}return n instanceof ei?mk(r,n):!1}}function pk(r,e){const n=r.length;if(e.length!==n)return!1;for(let l=-1;++l>l}function yp(r,e,n){const l=n.byteLength+7&-8;if(r>0||n.byteLength>3):_p(new Ey(n,r,e,null,g1)).subarray(0,l)),p}return n}function _p(r){const e=[];let n=0,l=0,p=0;for(const b of r)b&&(p|=1<0)&&(e[n++]=p);const v=new Uint8Array(e.length+7&-8);return v.set(e),v}class Ey{constructor(e,n,l,p,v){this.bytes=e,this.length=l,this.context=p,this.get=v,this.bit=n%8,this.byteIndex=n>>3,this.byte=e[this.byteIndex++],this.index=0}next(){return this.index>3<<3,p=e+(e%8===0?0:8-e%8);return Hg(r,e,p)+Hg(r,l,n)+yk(r,p>>3,l-p>>3)}function yk(r,e,n){let l=0,p=Math.trunc(e);const v=new DataView(r.buffer,r.byteOffset,r.byteLength),b=n===void 0?r.byteLength:p+n;for(;b-p>=4;)l+=bg(v.getUint32(p)),p+=4;for(;b-p>=2;)l+=bg(v.getUint16(p)),p+=2;for(;b-p>=1;)l+=bg(v.getUint8(p)),p+=1;return l}function bg(r){let e=Math.trunc(r);return e=e-(e>>>1&1431655765),e=(e&858993459)+(e>>>2&858993459),(e+(e>>>4)&252645135)*16843009>>>24}const _k=-1;class ai{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:e}=this;return Vt.isSparseUnion(e)?this.children.some(n=>n.nullable):Vt.isDenseUnion(e)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let e=0;const{valueOffsets:n,values:l,nullBitmap:p,typeIds:v}=this;return n&&(e+=n.byteLength),l&&(e+=l.byteLength),p&&(e+=p.byteLength),v&&(e+=v.byteLength),this.children.reduce((b,c)=>b+c.byteLength,e)}get nullCount(){if(Vt.isUnion(this.type))return this.children.reduce((l,p)=>l+p.nullCount,0);let e=this._nullCount,n;return e<=_k&&(n=this.nullBitmap)&&(this._nullCount=e=n.length===0?0:this.length-Hg(n,this.offset,this.offset+this.length)),e}constructor(e,n,l,p,v,b=[],c){this.type=e,this.children=b,this.dictionary=c,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(l||0,0)),this._nullCount=Math.floor(Math.max(p||0,-1));let A;v instanceof ai?(this.stride=v.stride,this.values=v.values,this.typeIds=v.typeIds,this.nullBitmap=v.nullBitmap,this.valueOffsets=v.valueOffsets):(this.stride=fo(e),v&&((A=v[0])&&(this.valueOffsets=A),(A=v[1])&&(this.values=A),(A=v[2])&&(this.nullBitmap=A),(A=v[3])&&(this.typeIds=A)))}getValid(e){const{type:n}=this;if(Vt.isUnion(n)){const l=n,p=this.children[l.typeIdToChildIndex[this.typeIds[e]]],v=l.mode===Kn.Dense?this.valueOffsets[e]:e;return p.getValid(v)}if(this.nullable&&this.nullCount>0){const l=this.offset+e;return(this.nullBitmap[l>>3]&1<>3;(!v||v.byteLength<=z)&&(v=new Uint8Array((b+c+63&-64)>>3).fill(255),this.nullCount>0?(v.set(yp(b,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:v})):Object.assign(this,{nullBitmap:v,_nullCount:0}));const B=v[z];l=(B&T)!==0,v[z]=n?B|T:B&~T}return l!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(e=this.type,n=this.offset,l=this.length,p=this._nullCount,v=this,b=this.children){return new ai(e,n,l,p,v,b,this.dictionary)}slice(e,n){const{stride:l,typeId:p,children:v}=this,b=+(this._nullCount===0)-1,c=p===16?l:1,A=this._sliceBuffers(e,n,l,p);return this.clone(this.type,this.offset+e,n,b,A,v.length===0||this.valueOffsets?v:this._sliceChildren(v,c*e,c*n))}_changeLengthAndBackfillNullBitmap(e){if(this.typeId===ce.Null)return this.clone(this.type,0,e,0);const{length:n,nullCount:l}=this,p=new Uint8Array((e+63&-64)>>3).fill(255,0,n>>3);p[n>>3]=(1<0&&p.set(yp(this.offset,n,this.nullBitmap),0);const v=this.buffers;return v[ho.VALIDITY]=p,this.clone(this.type,0,e,l+(e-n),v)}_sliceBuffers(e,n,l,p){let v;const{buffers:b}=this;return(v=b[ho.TYPE])&&(b[ho.TYPE]=v.subarray(e,e+n)),(v=b[ho.OFFSET])&&(b[ho.OFFSET]=v.subarray(e,e+n+1))||(v=b[ho.DATA])&&(b[ho.DATA]=p===6?v:v.subarray(l*e,l*(e+n))),b}_sliceChildren(e,n,l){return e.map(p=>p.slice(n,l))}}ai.prototype.children=Object.freeze([]);class Fh extends Cr{visit(e){return this.getVisitFn(e.type).call(this,e)}visitNull(e){const{["type"]:n,["offset"]:l=0,["length"]:p=0}=e;return new ai(n,l,p,p)}visitBool(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length>>3,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitInt(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitFloat(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitUtf8(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitLargeUtf8(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=fv(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitBinary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitLargeBinary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.data),v=Nr(e.nullBitmap),b=fv(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,p,v])}visitFixedSizeBinary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitDate(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitTimestamp(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitTime(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitDecimal(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitList(e){const{["type"]:n,["offset"]:l=0,["child"]:p}=e,v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,void 0,v],[p])}visitStruct(e){const{["type"]:n,["offset"]:l=0,["children"]:p=[]}=e,v=Nr(e.nullBitmap),{length:b=p.reduce((A,{length:T})=>Math.max(A,T),0),nullCount:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,void 0,v],p)}visitUnion(e){const{["type"]:n,["offset"]:l=0,["children"]:p=[]}=e,v=li(n.ArrayType,e.typeIds),{["length"]:b=v.length,["nullCount"]:c=-1}=e;if(Vt.isSparseUnion(n))return new ai(n,l,b,c,[void 0,void 0,void 0,v],p);const A=bh(e.valueOffsets);return new ai(n,l,b,c,[A,void 0,void 0,v],p)}visitDictionary(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.indices.ArrayType,e.data),{["dictionary"]:b=new ei([new Fh().visit({type:n.dictionary})])}=e,{["length"]:c=v.length,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[void 0,v,p],[],b)}visitInterval(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitDuration(e){const{["type"]:n,["offset"]:l=0}=e,p=Nr(e.nullBitmap),v=li(n.ArrayType,e.data),{["length"]:b=v.length,["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,v,p])}visitFixedSizeList(e){const{["type"]:n,["offset"]:l=0,["child"]:p=new Fh().visit({type:n.valueType})}=e,v=Nr(e.nullBitmap),{["length"]:b=p.length/fo(n),["nullCount"]:c=e.nullBitmap?-1:0}=e;return new ai(n,l,b,c,[void 0,void 0,v],[p])}visitMap(e){const{["type"]:n,["offset"]:l=0,["child"]:p=new Fh().visit({type:n.childType})}=e,v=Nr(e.nullBitmap),b=bh(e.valueOffsets),{["length"]:c=b.length-1,["nullCount"]:A=e.nullBitmap?-1:0}=e;return new ai(n,l,c,A,[b,void 0,v],[p])}}const vk=new Fh;function Dr(r){return vk.visit(r)}class Av{constructor(e=0,n){this.numChunks=e,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndexe.nullable)}function y1(r){return r.reduce((e,n)=>e+n.nullCount,0)}function _1(r){return r.reduce((e,n,l)=>(e[l+1]=e[l]+n.length,e),new Uint32Array(r.length+1))}function v1(r,e,n,l){const p=[];for(let v=-1,b=r.length;++v=l)break;if(n>=A+T)continue;if(A>=n&&A+T<=l){p.push(c);continue}const z=Math.max(0,n-A),B=Math.min(l-A,T);p.push(c.slice(z,B-z))}return p.length===0&&p.push(r[0].slice(0,0)),p}function Cy(r,e,n,l){let p=0,v=0,b=e.length-1;do{if(p>=b-1)return n0?0:-1}function wk(r,e){const{nullBitmap:n}=r;if(!n||r.nullCount<=0)return-1;let l=0;for(const p of new Ey(n,r.offset+(e||0),r.length,n,g1)){if(!p)return l;++l}return-1}function lr(r,e,n){if(e===void 0)return-1;if(e===null)switch(r.typeId){case ce.Union:break;case ce.Dictionary:break;default:return wk(r,n)}const l=As.getVisitFn(r),p=uu(e);for(let v=(n||0)-1,b=r.length;++v{const p=r.data[l];return p.values.subarray(0,p.length)[Symbol.iterator]()});let n=0;return new Av(r.data.length,l=>{const v=r.data[l].length,b=r.slice(n,n+v);return n+=v,new Sk(b)})}class Sk{constructor(e){this.vector=e,this.index=0}next(){return this.indexc.data):e;if(v.length===0||v.some(c=>!(c instanceof ai)))throw new TypeError("Vector constructor expects an Array of Data instances.");const b=(n=v[0])===null||n===void 0?void 0:n.type;switch(v.length){case 0:this._offsets=[0];break;case 1:{const{get:c,set:A,indexOf:T}=I1[b.typeId],z=v[0];this.isValid=B=>My(z,B),this.get=B=>c(z,B),this.set=(B,U)=>A(z,B,U),this.indexOf=B=>T(z,B),this._offsets=[0,z.length];break}default:Object.setPrototypeOf(this,T1[b.typeId]),this._offsets=_1(v);break}this.data=v,this.type=b,this.stride=fo(b),this.numChildren=(p=(l=b.children)===null||l===void 0?void 0:l.length)!==null&&p!==void 0?p:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((e,n)=>e+n.byteLength,0)}get nullable(){return bk(this.data)}get nullCount(){return y1(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${ce[this.type.typeId]}Vector`}isValid(e){return!1}get(e){return null}at(e){return this.get(Ay(e,this.length))}set(e,n){}indexOf(e,n){return-1}includes(e,n){return this.indexOf(e,n)>-1}[Symbol.iterator](){return Dy.visit(this)}concat(...e){return new ei(this.data.concat(e.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(e,n){return new ei(m1(this,e,n,({data:l,_offsets:p},v,b)=>v1(l,p,v,b)))}toJSON(){return[...this]}toArray(){const{type:e,data:n,length:l,stride:p,ArrayType:v}=this;switch(e.typeId){case ce.Int:case ce.Float:case ce.Decimal:case ce.Time:case ce.Timestamp:switch(n.length){case 0:return new v;case 1:return n[0].values.subarray(0,l*p);default:return n.reduce((b,{values:c,length:A})=>(b.array.set(c.subarray(0,A*p),b.offset),b.offset+=A*p,b),{array:new v(l*p),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(e){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(l=>l.name===e))}getChildAt(e){return e>-1&&en[e])):null}get isMemoized(){return Vt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(Vt.isDictionary(this.type)){const e=new xp(this.data[0].dictionary),n=this.data.map(l=>{const p=l.clone();return p.dictionary=e,p});return new ei(n)}return new xp(this)}unmemoize(){if(Vt.isDictionary(this.type)&&this.isMemoized){const e=this.data[0].dictionary.unmemoize(),n=this.data.map(l=>{const p=l.clone();return p.dictionary=e,p});return new ei(n)}return this}}S1=Symbol.toStringTag;ei[S1]=(r=>{r.type=Vt.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const e=Object.keys(ce).map(n=>ce[n]).filter(n=>typeof n=="number"&&n!==ce.NONE);for(const n of e){const l=As.getVisitFnByTypeId(n),p=ea.getVisitFnByTypeId(n),v=bp.getVisitFnByTypeId(n);I1[n]={get:l,set:p,indexOf:v},T1[n]=Object.create(r,{isValid:{value:vp(My)},get:{value:vp(As.getVisitFnByTypeId(n))},set:{value:b1(ea.getVisitFnByTypeId(n))},indexOf:{value:x1(bp.getVisitFnByTypeId(n))}})}return"Vector"})(ei.prototype);class xp extends ei{constructor(e){super(e.data);const n=this.get,l=this.set,p=this.slice,v=new Array(this.length);Object.defineProperty(this,"get",{value(b){const c=v[b];if(c!==void 0)return c;const A=n.call(this,b);return v[b]=A,A}}),Object.defineProperty(this,"set",{value(b,c){l.call(this,b,c),v[b]=c}}),Object.defineProperty(this,"slice",{value:(b,c)=>new xp(p.call(this,b,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new ei(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class Yg{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(e,n,l,p){return e.prep(8,24),e.writeInt64(BigInt(p??0)),e.pad(4),e.writeInt32(l),e.writeInt64(BigInt(n??0)),e.offset()}}class Ps{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsFooter(e,n){return(n||new Ps).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsFooter(e,n){return e.setPosition(e.position()+ri),(n||new Ps).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ln.V1}schema(e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Ma).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(e,n){const l=this.bb.__offset(this.bb_pos,8);return l?(n||new Yg).__init(this.bb.__vector(this.bb_pos+l)+e*24,this.bb):null}dictionariesLength(){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__vector_len(this.bb_pos+e):0}recordBatches(e,n){const l=this.bb.__offset(this.bb_pos,10);return l?(n||new Yg).__init(this.bb.__vector(this.bb_pos+l)+e*24,this.bb):null}recordBatchesLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__vector_len(this.bb_pos+e):0}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,12);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startFooter(e){e.startObject(5)}static addVersion(e,n){e.addFieldInt16(0,n,ln.V1)}static addSchema(e,n){e.addFieldOffset(1,n,0)}static addDictionaries(e,n){e.addFieldOffset(2,n,0)}static startDictionariesVector(e,n){e.startVector(24,n,8)}static addRecordBatches(e,n){e.addFieldOffset(3,n,0)}static startRecordBatchesVector(e,n){e.startVector(24,n,8)}static addCustomMetadata(e,n){e.addFieldOffset(4,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endFooter(e){return e.endObject()}static finishFooterBuffer(e,n){e.finish(n)}static finishSizePrefixedFooterBuffer(e,n){e.finish(n,void 0,!0)}}class ti{constructor(e=[],n,l,p=ln.V5){this.fields=e||[],this.metadata=n||new Map,l||(l=Kg(this.fields)),this.dictionaries=l,this.metadataVersion=p}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(e=>e.name)}toString(){return`Schema<{ ${this.fields.map((e,n)=>`${n}: ${e}`).join(", ")} }>`}select(e){const n=new Set(e),l=this.fields.filter(p=>n.has(p.name));return new ti(l,this.metadata)}selectAt(e){const n=e.map(l=>this.fields[l]).filter(Boolean);return new ti(n,this.metadata)}assign(...e){const n=e[0]instanceof ti?e[0]:Array.isArray(e[0])?new ti(e[0]):new ti(e),l=[...this.fields],p=wf(wf(new Map,this.metadata),n.metadata),v=n.fields.filter(c=>{const A=l.findIndex(T=>T.name===c.name);return~A?(l[A]=c.clone({metadata:wf(wf(new Map,l[A].metadata),c.metadata)}))&&!1:!0}),b=Kg(v,new Map);return new ti([...l,...v],p,new Map([...this.dictionaries,...b]))}}ti.prototype.fields=null;ti.prototype.metadata=null;ti.prototype.dictionaries=null;class Li{static new(...e){let[n,l,p,v]=e;return e[0]&&typeof e[0]=="object"&&({name:n}=e[0],l===void 0&&(l=e[0].type),p===void 0&&(p=e[0].nullable),v===void 0&&(v=e[0].metadata)),new Li(`${n}`,l,p,v)}constructor(e,n,l=!1,p){this.name=e,this.type=n,this.nullable=l,this.metadata=p||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...e){let[n,l,p,v]=e;return!e[0]||typeof e[0]!="object"?[n=this.name,l=this.type,p=this.nullable,v=this.metadata]=e:{name:n=this.name,type:l=this.type,nullable:p=this.nullable,metadata:v=this.metadata}=e[0],Li.new(n,l,p,v)}}Li.prototype.type=null;Li.prototype.name=null;Li.prototype.nullable=null;Li.prototype.metadata=null;function wf(r,e){return new Map([...r||new Map,...e||new Map])}function Kg(r,e=new Map){for(let n=-1,l=r.length;++n0&&Kg(v.children,e)}return e}var Ik=Yb,Tk=Qc;class Zh{static decode(e){e=new Tk(Nr(e));const n=Ps.getRootAsFooter(e),l=ti.decode(n.schema(),new Map,n.version());return new kk(l,n)}static encode(e){const n=new Ik,l=ti.encode(n,e.schema);Ps.startRecordBatchesVector(n,e.numRecordBatches);for(const b of[...e.recordBatches()].slice().reverse())Jo.encode(n,b);const p=n.endVector();Ps.startDictionariesVector(n,e.numDictionaries);for(const b of[...e.dictionaryBatches()].slice().reverse())Jo.encode(n,b);const v=n.endVector();return Ps.startFooter(n),Ps.addSchema(n,l),Ps.addVersion(n,ln.V5),Ps.addRecordBatches(n,p),Ps.addDictionaries(n,v),Ps.finishFooterBuffer(n,Ps.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(e,n=ln.V5,l,p){this.schema=e,this.version=n,l&&(this._recordBatches=l),p&&(this._dictionaryBatches=p)}*recordBatches(){for(let e,n=-1,l=this.numRecordBatches;++n=0&&e=0&&e=0&&e=0&&ethis._closedPromiseResolve=e)}get closed(){return this._closedPromise}cancel(e){return ur(this,void 0,void 0,function*(){yield this.return(e)})}write(e){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(e):this.resolvers.shift().resolve({done:!1,value:e}))}abort(e){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:e}:this.resolvers.shift().reject({done:!0,value:e}))}close(){if(this._closedPromiseResolve){const{resolvers:e}=this;for(;e.length>0;)e.shift().resolve(Wi);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(e){return Ys.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,e)}toNodeStream(e){return Ys.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,e)}throw(e){return ur(this,void 0,void 0,function*(){return yield this.abort(e),Wi})}return(e){return ur(this,void 0,void 0,function*(){return yield this.close(),Wi})}read(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(...e){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((n,l)=>{this.resolvers.push({resolve:n,reject:l})}):Promise.resolve(Wi)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Uf extends Ak{write(e){if((e=Nr(e)).byteLength>0)return super.write(e)}toString(e=!1){return e?$g(this.toUint8Array(!0)):this.toUint8Array(!1).then($g)}toUint8Array(e=!1){return e?Ua(this._values)[0]:ur(this,void 0,void 0,function*(){var n,l,p,v;const b=[];let c=0;try{for(var A=!0,T=zl(this),z;z=yield T.next(),n=z.done,!n;A=!0){v=z.value,A=!1;const B=v;b.push(B),c+=B.byteLength}}catch(B){l={error:B}}finally{try{!A&&!n&&(p=T.return)&&(yield p.call(T))}finally{if(l)throw l.error}}return Ua(b,c)[0]})}}class wp{constructor(e){e&&(this.source=new Ek(Ys.fromIterable(e)))}[Symbol.iterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class ru{constructor(e){e instanceof ru?this.source=e.source:e instanceof Uf?this.source=new Al(Ys.fromAsyncIterable(e)):Gb(e)?this.source=new Al(Ys.fromNodeStream(e)):xy(e)?this.source=new Al(Ys.fromDOMStream(e)):qb(e)?this.source=new Al(Ys.fromDOMStream(e.body)):Qh(e)?this.source=new Al(Ys.fromIterable(e)):Nl(e)?this.source=new Al(Ys.fromAsyncIterable(e)):cu(e)&&(this.source=new Al(Ys.fromAsyncIterable(e)))}[Symbol.asyncIterator](){return this}next(e){return this.source.next(e)}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}get closed(){return this.source.closed}cancel(e){return this.source.cancel(e)}peek(e){return this.source.peek(e)}read(e){return this.source.read(e)}}class Ek{constructor(e){this.source=e}cancel(e){this.return(e)}peek(e){return this.next(e,"peek").value}read(e){return this.next(e,"read").value}next(e,n="read"){return this.source.next({cmd:n,size:e})}throw(e){return Object.create(this.source.throw&&this.source.throw(e)||Wi)}return(e){return Object.create(this.source.return&&this.source.return(e)||Wi)}}class Al{constructor(e){this.source=e,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(e){return ur(this,void 0,void 0,function*(){yield this.return(e)})}get closed(){return this._closedPromise}read(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"read")).value})}peek(e){return ur(this,void 0,void 0,function*(){return(yield this.next(e,"peek")).value})}next(e){return ur(this,arguments,void 0,function*(n,l="read"){return yield this.source.next({cmd:l,size:n})})}throw(e){return ur(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(e))||Wi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(e){return ur(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(e))||Wi;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class Cv extends wp{constructor(e,n){super(),this.position=0,this.buffer=Nr(e),this.size=n===void 0?this.buffer.byteLength:n}readInt32(e){const{buffer:n,byteOffset:l}=this.readAt(e,4);return new DataView(n,l).getInt32(0,!0)}seek(e){return this.position=Math.min(e,this.size),e>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),l=new Uint32Array([e.buffer[1]>>>16,e.buffer[1]&65535,e.buffer[0]>>>16,e.buffer[0]&65535]);let p=n[3]*l[3];this.buffer[0]=p&65535;let v=p>>>16;return p=n[2]*l[3],v+=p,p=n[3]*l[2]>>>0,v+=p,this.buffer[0]+=v<<16,this.buffer[1]=v>>>0>>16,this.buffer[1]+=n[1]*l[3]+n[2]*l[2]+n[3]*l[1],this.buffer[1]+=n[0]*l[3]+n[1]*l[2]+n[2]*l[1]+n[3]*l[0]<<16,this}_plus(e){const n=this.buffer[0]+e.buffer[0]>>>0;this.buffer[1]+=e.buffer[1],n>>0&&++this.buffer[1],this.buffer[0]=n}lessThan(e){return this.buffer[1]>>0,n[2]=this.buffer[2]+e.buffer[2]>>>0,n[1]=this.buffer[1]+e.buffer[1]>>>0,n[0]=this.buffer[0]+e.buffer[0]>>>0,n[0]>>0&&++n[1],n[1]>>0&&++n[2],n[2]>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${jc(this.buffer[3])} ${jc(this.buffer[2])} ${jc(this.buffer[1])} ${jc(this.buffer[0])}`}static multiply(e,n){return new Da(new Uint32Array(e.buffer)).times(n)}static add(e,n){return new Da(new Uint32Array(e.buffer)).plus(n)}static from(e,n=new Uint32Array(4)){return Da.fromString(typeof e=="string"?e:e.toString(),n)}static fromNumber(e,n=new Uint32Array(4)){return Da.fromString(e.toString(),n)}static fromString(e,n=new Uint32Array(4)){const l=e.startsWith("-"),p=e.length,v=new Da(n);for(let b=l?1:0;b0&&this.readData(e,l)||new Uint8Array(0)}readOffsets(e,n){return this.readData(e,n)}readTypeIds(e,n){return this.readData(e,n)}readData(e,{length:n,offset:l}=this.nextBufferRange()){return this.bytes.subarray(l,l+n)}readDictionary(e){return this.dictionaries.get(e.id)}}class Mk extends A1{constructor(e,n,l,p,v){super(new Uint8Array(0),n,l,p,v),this.sources=e}readNullBitmap(e,n,{offset:l}=this.nextBufferRange()){return n<=0?new Uint8Array(0):_p(this.sources[l])}readOffsets(e,{offset:n}=this.nextBufferRange()){return li(Uint8Array,li(e.OffsetArrayType,this.sources[n]))}readTypeIds(e,{offset:n}=this.nextBufferRange()){return li(Uint8Array,li(e.ArrayType,this.sources[n]))}readData(e,{offset:n}=this.nextBufferRange()){const{sources:l}=this;return Vt.isTimestamp(e)||(Vt.isInt(e)||Vt.isTime(e))&&e.bitWidth===64||Vt.isDuration(e)||Vt.isDate(e)&&e.unit===Qs.MILLISECOND?li(Uint8Array,xs.convertArray(l[n])):Vt.isDecimal(e)?li(Uint8Array,Da.convertArray(l[n])):Vt.isBinary(e)||Vt.isLargeBinary(e)||Vt.isFixedSizeBinary(e)?Dk(l[n]):Vt.isBool(e)?_p(l[n]):Vt.isUtf8(e)||Vt.isLargeUtf8(e)?by(l[n].join("")):li(Uint8Array,li(e.ArrayType,l[n].map(p=>+p)))}}function Dk(r){const e=r.join(""),n=new Uint8Array(e.length/2);for(let l=0;l>1]=Number.parseInt(e.slice(l,l+2),16);return n}class Kt extends Cr{compareSchemas(e,n){return e===n||n instanceof e.constructor&&this.compareManyFields(e.fields,n.fields)}compareManyFields(e,n){return e===n||Array.isArray(e)&&Array.isArray(n)&&e.length===n.length&&e.every((l,p)=>this.compareFields(l,n[p]))}compareFields(e,n){return e===n||n instanceof e.constructor&&e.name===n.name&&e.nullable===n.nullable&&this.visit(e.type,n.type)}}function ds(r,e){return e instanceof r.constructor}function ql(r,e){return r===e||ds(r,e)}function vo(r,e){return r===e||ds(r,e)&&r.bitWidth===e.bitWidth&&r.isSigned===e.isSigned}function Jp(r,e){return r===e||ds(r,e)&&r.precision===e.precision}function Pk(r,e){return r===e||ds(r,e)&&r.byteWidth===e.byteWidth}function zy(r,e){return r===e||ds(r,e)&&r.unit===e.unit}function ed(r,e){return r===e||ds(r,e)&&r.unit===e.unit&&r.timezone===e.timezone}function td(r,e){return r===e||ds(r,e)&&r.unit===e.unit&&r.bitWidth===e.bitWidth}function Lk(r,e){return r===e||ds(r,e)&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}function zk(r,e){return r===e||ds(r,e)&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}function By(r,e){return r===e||ds(r,e)&&r.mode===e.mode&&r.typeIds.every((n,l)=>n===e.typeIds[l])&&Qo.compareManyFields(r.children,e.children)}function Bk(r,e){return r===e||ds(r,e)&&r.id===e.id&&r.isOrdered===e.isOrdered&&Qo.visit(r.indices,e.indices)&&Qo.visit(r.dictionary,e.dictionary)}function Ry(r,e){return r===e||ds(r,e)&&r.unit===e.unit}function rd(r,e){return r===e||ds(r,e)&&r.unit===e.unit}function Rk(r,e){return r===e||ds(r,e)&&r.listSize===e.listSize&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}function Fk(r,e){return r===e||ds(r,e)&&r.keysSorted===e.keysSorted&&r.children.length===e.children.length&&Qo.compareManyFields(r.children,e.children)}Kt.prototype.visitNull=ql;Kt.prototype.visitBool=ql;Kt.prototype.visitInt=vo;Kt.prototype.visitInt8=vo;Kt.prototype.visitInt16=vo;Kt.prototype.visitInt32=vo;Kt.prototype.visitInt64=vo;Kt.prototype.visitUint8=vo;Kt.prototype.visitUint16=vo;Kt.prototype.visitUint32=vo;Kt.prototype.visitUint64=vo;Kt.prototype.visitFloat=Jp;Kt.prototype.visitFloat16=Jp;Kt.prototype.visitFloat32=Jp;Kt.prototype.visitFloat64=Jp;Kt.prototype.visitUtf8=ql;Kt.prototype.visitLargeUtf8=ql;Kt.prototype.visitBinary=ql;Kt.prototype.visitLargeBinary=ql;Kt.prototype.visitFixedSizeBinary=Pk;Kt.prototype.visitDate=zy;Kt.prototype.visitDateDay=zy;Kt.prototype.visitDateMillisecond=zy;Kt.prototype.visitTimestamp=ed;Kt.prototype.visitTimestampSecond=ed;Kt.prototype.visitTimestampMillisecond=ed;Kt.prototype.visitTimestampMicrosecond=ed;Kt.prototype.visitTimestampNanosecond=ed;Kt.prototype.visitTime=td;Kt.prototype.visitTimeSecond=td;Kt.prototype.visitTimeMillisecond=td;Kt.prototype.visitTimeMicrosecond=td;Kt.prototype.visitTimeNanosecond=td;Kt.prototype.visitDecimal=ql;Kt.prototype.visitList=Lk;Kt.prototype.visitStruct=zk;Kt.prototype.visitUnion=By;Kt.prototype.visitDenseUnion=By;Kt.prototype.visitSparseUnion=By;Kt.prototype.visitDictionary=Bk;Kt.prototype.visitInterval=Ry;Kt.prototype.visitIntervalDayTime=Ry;Kt.prototype.visitIntervalYearMonth=Ry;Kt.prototype.visitDuration=rd;Kt.prototype.visitDurationSecond=rd;Kt.prototype.visitDurationMillisecond=rd;Kt.prototype.visitDurationMicrosecond=rd;Kt.prototype.visitDurationNanosecond=rd;Kt.prototype.visitFixedSizeList=Rk;Kt.prototype.visitMap=Fk;const Qo=new Kt;function Xg(r,e){return Qo.compareSchemas(r,e)}function xg(r,e){return Ok(r,e.map(n=>n.data.concat()))}function Ok(r,e){const n=[...r.fields],l=[],p={numBatches:e.reduce((B,U)=>Math.max(B,U.length),0)};let v=0,b=0,c=-1;const A=e.length;let T,z=[];for(;p.numBatches-- >0;){for(b=Number.POSITIVE_INFINITY,c=-1;++c0&&(l[v++]=Dr({type:new ls(n),length:b,nullCount:0,children:z.slice()})))}return[r=r.assign(n),l.map(B=>new Is(r,B))]}function Nk(r,e,n,l,p){var v;const b=(e+63&-64)>>3;for(let c=-1,A=l.length;++c=e)z===e?n[c]=T:(n[c]=T.slice(0,e),p.numBatches=Math.max(p.numBatches,l[c].unshift(T.slice(e,z-e))));else{const B=r[c];r[c]=B.clone({nullable:!0}),n[c]=(v=T==null?void 0:T._changeLengthAndBackfillNullBitmap(e))!==null&&v!==void 0?v:Dr({type:B.type,length:e,nullCount:e,nullBitmap:new Uint8Array(b)})}}return n}var E1;let el=class Cl{constructor(...e){var n,l;if(e.length===0)return this.batches=[],this.schema=new ti([]),this._offsets=[0],this;let p,v;e[0]instanceof ti&&(p=e.shift()),e.at(-1)instanceof Uint32Array&&(v=e.pop());const b=A=>{if(A){if(A instanceof Is)return[A];if(A instanceof Cl)return A.batches;if(A instanceof ai){if(A.type instanceof ls)return[new Is(new ti(A.type.children),A)]}else{if(Array.isArray(A))return A.flatMap(T=>b(T));if(typeof A[Symbol.iterator]=="function")return[...A].flatMap(T=>b(T));if(typeof A=="object"){const T=Object.keys(A),z=T.map(j=>new ei([A[j]])),B=p??new ti(T.map((j,Q)=>new Li(String(j),z[Q].type,z[Q].nullable))),[,U]=xg(B,z);return U.length===0?[new Is(A)]:U}}}return[]},c=e.flatMap(A=>b(A));if(p=(l=p??((n=c[0])===null||n===void 0?void 0:n.schema))!==null&&l!==void 0?l:new ti([]),!(p instanceof ti))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const A of c){if(!(A instanceof Is))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Xg(p,A.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=p,this.batches=c,this._offsets=v??_1(this.data)}get data(){return this.batches.map(({data:e})=>e)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((e,n)=>e+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=y1(this.data)),this._nullCount}isValid(e){return!1}get(e){return null}at(e){return this.get(Ay(e,this.numRows))}set(e,n){}indexOf(e,n){return-1}[Symbol.iterator](){return this.batches.length>0?Dy.visit(new ei(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ ${this.toArray().join(`, `)} -]`}concat(...e){const n=this.schema,l=this.data.concat(e.flatMap(({data:p})=>p));return new Cl(n,l.map(p=>new Is(n,p)))}slice(e,n){const l=this.schema;[e,n]=m1({length:this.numRows},e,n);const p=v1(this.data,this._offsets,e,n);return new Cl(l,p.map(v=>new Is(l,v)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===e))}getChildAt(e){if(e>-1&&el.children[e]);if(n.length===0){const{type:l}=this.schema.fields[e],p=Dr({type:l,length:0,nullCount:0});n.push(p._changeLengthAndBackfillNullBitmap(this.numRows))}return new ei(n)}return null}setChild(e,n){var l;return this.setChildAt((l=this.schema.fields)===null||l===void 0?void 0:l.findIndex(p=>p.name===e),n)}setChildAt(e,n){let l=this.schema,p=[...this.batches];if(e>-1&&ethis.getChildAt(T));[v[e],c[e]]=[b,n],[l,p]=xg(l,c)}return new Cl(l,p)}select(e){const n=this.schema.fields.reduce((l,p,v)=>l.set(p.name,v),new Map);return this.selectAt(e.map(l=>n.get(l)).filter(l=>l>-1))}selectAt(e){const n=this.schema.selectAt(e),l=this.batches.map(p=>p.selectAt(e));return new Cl(n,l)}assign(e){const n=this.schema.fields,[l,p]=e.schema.fields.reduce((c,A,T)=>{const[z,B]=c,U=n.findIndex(j=>j.name===A.name);return~U?B[U]=T:z.push(T),c},[[],[]]),v=this.schema.assign(e.schema),b=[...n.map((c,A)=>[A,p[A]]).map(([c,A])=>A===void 0?this.getChildAt(c):e.getChildAt(A)),...l.map(c=>e.getChildAt(c))].filter(Boolean);return new Cl(...xg(v,b))}};E1=Symbol.toStringTag;el[E1]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=vp(My),r.get=vp(As.getVisitFn(ce.Struct)),r.set=b1(ea.getVisitFn(ce.Struct)),r.indexOf=x1(bp.getVisitFn(ce.Struct)),"Table"))(el.prototype);var C1;let Is=class zh{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof ti))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dr({nullCount:0,type:new ls(this.schema.fields),children:this.schema.fields.map(n=>Dr({type:n.type,nullCount:0}))})]=e,!(this.data instanceof ai))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Mv(this.schema,this.data.children);break}case 1:{const[n]=e,{fields:l,children:p,length:v}=Object.keys(n).reduce((A,T,z)=>(A.children[z]=n[T],A.length=Math.max(A.length,n[T].length),A.fields[z]=Li.new({name:T,type:n[T].type,nullable:!0}),A),{length:0,fields:new Array,children:new Array}),b=new ti(l),c=Dr({type:new ls(l),length:v,children:p,nullCount:0});[this.schema,this.data]=Mv(b,c.children,v);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=M1(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return As.visit(this.data,e)}at(e){return this.get(Ay(e,this.numRows))}set(e,n){return ea.visit(this.data,e,n)}indexOf(e,n){return bp.visit(this.data,e,n)}[Symbol.iterator](){return Dy.visit(new ei([this.data]))}toArray(){return[...this]}concat(...e){return new el(this.schema,[this,...e])}slice(e,n){const[l]=new ei([this.data]).slice(e,n).data;return new zh(this.schema,l)}getChild(e){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(l=>l.name===e))}getChildAt(e){return e>-1&&ep.name===e),n)}setChildAt(e,n){let l=this.schema,p=this.data;if(e>-1&&ec.name===v);~b&&(p[b]=this.data.children[b])}return new zh(n,Dr({type:l,length:this.numRows,children:p}))}selectAt(e){const n=this.schema.selectAt(e),l=e.map(v=>this.data.children[v]).filter(Boolean),p=Dr({type:new ls(n.fields),length:this.numRows,children:l});return new zh(n,p)}};C1=Symbol.toStringTag;Is[C1]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Is.prototype);function Mv(r,e,n=e.reduce((l,p)=>Math.max(l,p.length),0)){var l;const p=[...r.fields],v=[...e],b=(n+63&-64)>>3;for(const[c,A]of r.fields.entries()){const T=e[c];(!T||T.length!==n)&&(p[c]=A.clone({nullable:!0}),v[c]=(l=T==null?void 0:T._changeLengthAndBackfillNullBitmap(n))!==null&&l!==void 0?l:Dr({type:A.type,length:n,nullCount:n,nullBitmap:new Uint8Array(b)}))}return[r.assign(p),Dr({type:new ls(p),length:n,children:v})]}function M1(r,e,n=new Map){var l,p;if(((l=r==null?void 0:r.length)!==null&&l!==void 0?l:0)>0&&(r==null?void 0:r.length)===(e==null?void 0:e.length))for(let v=-1,b=r.length;++vDr({type:p.type})),l=Dr({type:new ls(e.fields),nullCount:0,children:n});super(e,l)}}let $o=class Ca{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsMessage(e,n){return(n||new Ca).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,n){return e.setPosition(e.position()+ri),(n||new Ca).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ln.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Zr.NONE}header(e){const n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(e,this.bb_pos+n):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,12);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,n){e.addFieldInt16(0,n,ln.V1)}static addHeaderType(e,n){e.addFieldInt8(1,n,Zr.NONE)}static addHeader(e,n){e.addFieldOffset(2,n,0)}static addBodyLength(e,n){e.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(e,n){e.addFieldOffset(4,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,n){e.finish(n)}static finishSizePrefixedMessageBuffer(e,n){e.finish(n,void 0,!0)}static createMessage(e,n,l,p,v,b){return Ca.startMessage(e),Ca.addVersion(e,n),Ca.addHeaderType(e,l),Ca.addHeader(e,p),Ca.addBodyLength(e,v),Ca.addCustomMetadata(e,b),Ca.endMessage(e)}};class Uk extends Cr{visit(e,n){return e==null||n==null?void 0:super.visit(e,n)}visitNull(e,n){return xv.startNull(n),xv.endNull(n)}visitInt(e,n){return zs.startInt(n),zs.addBitWidth(n,e.bitWidth),zs.addIsSigned(n,e.isSigned),zs.endInt(n)}visitFloat(e,n){return La.startFloatingPoint(n),La.addPrecision(n,e.precision),La.endFloatingPoint(n)}visitBinary(e,n){return gv.startBinary(n),gv.endBinary(n)}visitLargeBinary(e,n){return _v.startLargeBinary(n),_v.endLargeBinary(n)}visitBool(e,n){return yv.startBool(n),yv.endBool(n)}visitUtf8(e,n){return wv.startUtf8(n),wv.endUtf8(n)}visitLargeUtf8(e,n){return vv.startLargeUtf8(n),vv.endLargeUtf8(n)}visitDecimal(e,n){return Bc.startDecimal(n),Bc.addScale(n,e.scale),Bc.addPrecision(n,e.precision),Bc.addBitWidth(n,e.bitWidth),Bc.endDecimal(n)}visitDate(e,n){return zf.startDate(n),zf.addUnit(n,e.unit),zf.endDate(n)}visitTime(e,n){return Ks.startTime(n),Ks.addUnit(n,e.unit),Ks.addBitWidth(n,e.bitWidth),Ks.endTime(n)}visitTimestamp(e,n){const l=e.timezone&&n.createString(e.timezone)||void 0;return Xs.startTimestamp(n),Xs.addUnit(n,e.unit),l!==void 0&&Xs.addTimezone(n,l),Xs.endTimestamp(n)}visitInterval(e,n){return za.startInterval(n),za.addUnit(n,e.unit),za.endInterval(n)}visitDuration(e,n){return Bf.startDuration(n),Bf.addUnit(n,e.unit),Bf.endDuration(n)}visitList(e,n){return bv.startList(n),bv.endList(n)}visitStruct(e,n){return Pl.startStruct_(n),Pl.endStruct_(n)}visitUnion(e,n){Ss.startTypeIdsVector(n,e.typeIds.length);const l=Ss.createTypeIdsVector(n,e.typeIds);return Ss.startUnion(n),Ss.addMode(n,e.mode),Ss.addTypeIds(n,l),Ss.endUnion(n)}visitDictionary(e,n){const l=this.visit(e.indices,n);return go.startDictionaryEncoding(n),go.addId(n,BigInt(e.id)),go.addIsOrdered(n,e.isOrdered),l!==void 0&&go.addIndexType(n,l),go.endDictionaryEncoding(n)}visitFixedSizeBinary(e,n){return Rf.startFixedSizeBinary(n),Rf.addByteWidth(n,e.byteWidth),Rf.endFixedSizeBinary(n)}visitFixedSizeList(e,n){return Ff.startFixedSizeList(n),Ff.addListSize(n,e.listSize),Ff.endFixedSizeList(n)}visitMap(e,n){return Of.startMap(n),Of.addKeysSorted(n,e.keysSorted),Of.endMap(n)}}const wg=new Uk;function $k(r,e=new Map){return new ti(jk(r,e),$f(r.metadata),e)}function D1(r){return new Fs(r.count,P1(r.columns),L1(r.columns))}function Vk(r){return new Va(D1(r.data),r.id,r.isDelta)}function jk(r,e){return(r.fields||[]).filter(Boolean).map(n=>Li.fromJSON(n,e))}function Dv(r,e){return(r.children||[]).filter(Boolean).map(n=>Li.fromJSON(n,e))}function P1(r){return(r||[]).reduce((e,n)=>[...e,new tl(n.count,qk(n.VALIDITY)),...P1(n.children)],[])}function L1(r,e=[]){for(let n=-1,l=(r||[]).length;++ne+ +(n===0),0)}function Gk(r,e){let n,l,p,v,b,c;return!e||!(v=r.dictionary)?(b=Lv(r,Dv(r,e)),p=new Li(r.name,b,r.nullable,$f(r.metadata))):e.has(n=v.id)?(l=(l=v.indexType)?Pv(l):new Gh,c=new tu(e.get(n),l,n,v.isOrdered),p=new Li(r.name,c,r.nullable,$f(r.metadata))):(l=(l=v.indexType)?Pv(l):new Gh,e.set(n,b=Lv(r,Dv(r,e))),c=new tu(b,l,n,v.isOrdered),p=new Li(r.name,c,r.nullable,$f(r.metadata))),p||null}function $f(r=[]){return new Map(r.map(({key:e,value:n})=>[e,n]))}function Pv(r){return new Ul(r.isSigned,r.bitWidth)}function Lv(r,e){const n=r.type.name;switch(n){case"NONE":return new Xo;case"null":return new Xo;case"binary":return new tp;case"largebinary":return new rp;case"utf8":return new ip;case"largeutf8":return new np;case"bool":return new sp;case"list":return new dp((e||[])[0]);case"struct":return new ls(e||[]);case"struct_":return new ls(e||[])}switch(n){case"int":{const l=r.type;return new Ul(l.isSigned,l.bitWidth)}case"floatingpoint":{const l=r.type;return new ep(Yn[l.precision])}case"decimal":{const l=r.type;return new ap(l.scale,l.precision,l.bitWidth)}case"date":{const l=r.type;return new op(Qs[l.unit])}case"time":{const l=r.type;return new lp(Jt[l.unit],l.bitWidth)}case"timestamp":{const l=r.type;return new cp(Jt[l.unit],l.timezone)}case"interval":{const l=r.type;return new up($a[l.unit])}case"duration":{const l=r.type;return new hp(Jt[l.unit])}case"union":{const l=r.type,[p,...v]=(l.mode+"").toLowerCase(),b=p.toUpperCase()+v.join("");return new fp(Kn[b],l.typeIds||[],e||[])}case"fixedsizebinary":{const l=r.type;return new pp(l.byteWidth)}case"fixedsizelist":{const l=r.type;return new mp(l.listSize,(e||[])[0])}case"map":{const l=r.type;return new gp((e||[])[0],l.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Zk=Yb,Wk=Qc;class cs{static fromJSON(e,n){const l=new cs(0,ln.V5,n);return l._createHeader=Hk(e,n),l}static decode(e){e=new Wk(Nr(e));const n=$o.getRootAsMessage(e),l=n.bodyLength(),p=n.version(),v=n.headerType(),b=new cs(l,p,v);return b._createHeader=Yk(n,v),b}static encode(e){const n=new Zk;let l=-1;return e.isSchema()?l=ti.encode(n,e.header()):e.isRecordBatch()?l=Fs.encode(n,e.header()):e.isDictionaryBatch()&&(l=Va.encode(n,e.header())),$o.startMessage(n),$o.addVersion(n,ln.V5),$o.addHeader(n,l),$o.addHeaderType(n,e.headerType),$o.addBodyLength(n,BigInt(e.bodyLength)),$o.finishMessageBuffer(n,$o.endMessage(n)),n.asUint8Array()}static from(e,n=0){if(e instanceof ti)return new cs(0,ln.V5,Zr.Schema,e);if(e instanceof Fs)return new cs(n,ln.V5,Zr.RecordBatch,e);if(e instanceof Va)return new cs(n,ln.V5,Zr.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Zr.Schema}isRecordBatch(){return this.headerType===Zr.RecordBatch}isDictionaryBatch(){return this.headerType===Zr.DictionaryBatch}constructor(e,n,l,p){this._version=n,this._headerType=l,this.body=new Uint8Array(0),p&&(this._createHeader=()=>p),this._bodyLength=yi(e)}}class Fs{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,n,l){this._nodes=n,this._buffers=l,this._length=yi(e)}}class Va{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,n,l=!1){this._data=e,this._isDelta=l,this._id=yi(n)}}class Ra{constructor(e,n){this.offset=yi(e),this.length=yi(n)}}class tl{constructor(e,n){this.length=yi(e),this.nullCount=yi(n)}}function Hk(r,e){return()=>{switch(e){case Zr.Schema:return ti.fromJSON(r);case Zr.RecordBatch:return Fs.fromJSON(r);case Zr.DictionaryBatch:return Va.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Zr[e]}, type: ${e} }`)}}function Yk(r,e){return()=>{switch(e){case Zr.Schema:return ti.decode(r.header(new Ma),new Map,r.version());case Zr.RecordBatch:return Fs.decode(r.header(new uo),r.version());case Zr.DictionaryBatch:return Va.decode(r.header(new Lc),r.version())}throw new Error(`Unrecognized Message type: { name: ${Zr[e]}, type: ${e} }`)}}Li.encode=aA;Li.decode=nA;Li.fromJSON=Gk;ti.encode=sA;ti.decode=Kk;ti.fromJSON=$k;Fs.encode=oA;Fs.decode=Xk;Fs.fromJSON=D1;Va.encode=lA;Va.decode=Jk;Va.fromJSON=Vk;tl.encode=cA;tl.decode=eA;Ra.encode=uA;Ra.decode=Qk;function Kk(r,e=new Map,n=ln.V5){const l=iA(r,e);return new ti(l,Vf(r),e,n)}function Xk(r,e=ln.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Fs(r.length(),tA(r),rA(r,e))}function Jk(r,e=ln.V5){return new Va(Fs.decode(r.data(),e),r.id(),r.isDelta())}function Qk(r){return new Ra(r.offset(),r.length())}function eA(r){return new tl(r.length(),r.nullCount())}function tA(r){const e=[];for(let n,l=-1,p=-1,v=r.nodesLength();++lLi.encode(r,v));Ma.startFieldsVector(r,n.length);const l=Ma.createFieldsVector(r,n),p=e.metadata&&e.metadata.size>0?Ma.createCustomMetadataVector(r,[...e.metadata].map(([v,b])=>{const c=r.createString(`${v}`),A=r.createString(`${b}`);return xn.startKeyValue(r),xn.addKey(r,c),xn.addValue(r,A),xn.endKeyValue(r)})):-1;return Ma.startSchema(r),Ma.addFields(r,l),Ma.addEndianness(r,hA?eu.Little:eu.Big),p!==-1&&Ma.addCustomMetadata(r,p),Ma.endSchema(r)}function aA(r,e){let n=-1,l=-1,p=-1;const v=e.type;let b=e.typeId;Vt.isDictionary(v)?(b=v.dictionary.typeId,p=wg.visit(v,r),l=wg.visit(v.dictionary,r)):l=wg.visit(v,r);const c=(v.children||[]).map(z=>Li.encode(r,z)),A=Ws.createChildrenVector(r,c),T=e.metadata&&e.metadata.size>0?Ws.createCustomMetadataVector(r,[...e.metadata].map(([z,B])=>{const U=r.createString(`${z}`),j=r.createString(`${B}`);return xn.startKeyValue(r),xn.addKey(r,U),xn.addValue(r,j),xn.endKeyValue(r)})):-1;return e.name&&(n=r.createString(e.name)),Ws.startField(r),Ws.addType(r,l),Ws.addTypeType(r,b),Ws.addChildren(r,A),Ws.addNullable(r,!!e.nullable),n!==-1&&Ws.addName(r,n),p!==-1&&Ws.addDictionary(r,p),T!==-1&&Ws.addCustomMetadata(r,T),Ws.endField(r)}function oA(r,e){const n=e.nodes||[],l=e.buffers||[];uo.startNodesVector(r,n.length);for(const b of n.slice().reverse())tl.encode(r,b);const p=r.endVector();uo.startBuffersVector(r,l.length);for(const b of l.slice().reverse())Ra.encode(r,b);const v=r.endVector();return uo.startRecordBatch(r),uo.addLength(r,BigInt(e.length)),uo.addNodes(r,p),uo.addBuffers(r,v),uo.endRecordBatch(r)}function lA(r,e){const n=Fs.encode(r,e.data);return Lc.startDictionaryBatch(r),Lc.addId(r,BigInt(e.id)),Lc.addIsDelta(r,e.isDelta),Lc.addData(r,n),Lc.endDictionaryBatch(r)}function cA(r,e){return Jb.createFieldNode(r,BigInt(e.length),BigInt(e.nullCount))}function uA(r,e){return Xb.createBuffer(r,BigInt(e.offset),BigInt(e.length))}const hA=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),Oy=r=>`Expected ${Zr[r]} Message in stream, but was null or length 0.`,Ny=r=>`Header pointer of flatbuffer-encoded ${Zr[r]} Message is null or length 0.`,z1=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,B1=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`;class R1{constructor(e){this.source=e instanceof wp?e:new wp(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?Wi:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let n;if((n=this.next()).done)return null;if(e!=null&&n.value.headerType!==e)throw new Error(Oy(e));return n.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const n=Nr(this.source.read(e));if(n.byteLength[...p,...v.VALIDITY&&[v.VALIDITY]||[],...v.TYPE_ID&&[v.TYPE_ID]||[],...v.OFFSET&&[v.OFFSET]||[],...v.DATA&&[v.DATA]||[],...n(v.children)],[])}}readMessage(e){let n;if((n=this.next()).done)return null;if(e!=null&&n.value.headerType!==e)throw new Error(Oy(e));return n.value}readSchema(){const e=Zr.Schema,n=this.readMessage(e),l=n==null?void 0:n.header();if(!n||!l)throw new Error(Ny(e));return l}}const Qp=4,Jg="ARROW1",Wh=new Uint8Array(Jg.length);for(let r=0;rthis):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Ys.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Ys.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,n){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Js?e:Vg(e)?_A(e):jb(e)?xA(e):Nl(e)?ur(this,void 0,void 0,function*(){return yield Js.from(yield e)}):qb(e)||xy(e)||Gb(e)||cu(e)?bA(new ru(e)):vA(new wp(e))}static readAll(e){return e instanceof Js?e.isSync()?Fv(e):Ov(e):Vg(e)||ArrayBuffer.isView(e)||Qh(e)||Vb(e)?Fv(e):Ov(e)}}class Ip extends Js{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ba(this,arguments,function*(){yield Sr(yield*Lf(zl(this[Symbol.iterator]())))})}}class Tp extends Js{constructor(e){super(e),this._impl=e}readAll(){return ur(this,void 0,void 0,function*(){var e,n,l,p;const v=new Array;try{for(var b=!0,c=zl(this),A;A=yield c.next(),e=A.done,!e;b=!0){p=A.value,b=!1;const T=p;v.push(T)}}catch(T){n={error:T}}finally{try{!b&&!e&&(l=c.return)&&(yield l.call(c))}finally{if(n)throw n.error}}return v})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class O1 extends Ip{constructor(e){super(e),this._impl=e}}class mA extends Tp{constructor(e){super(e),this._impl=e}}class N1{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,n){const l=this._loadVectors(e,n,this.schema.fields),p=Dr({type:new ls(this.schema.fields),length:e.length,children:l});return new Is(this.schema,p)}_loadDictionaryBatch(e,n){const{id:l,isDelta:p}=e,{dictionaries:v,schema:b}=this,c=v.get(l),A=b.dictionaries.get(l),T=this._loadVectors(e.data,n,[A]);return(c&&p?c.concat(new ei(T)):new ei(T)).memoize()}_loadVectors(e,n,l){return new A1(n,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(l)}}class kp extends N1{constructor(e,n){super(n),this._reader=Vg(e)?new fA(this._handle=e):new R1(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=$1(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Wi}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Wi}next(){if(this.closed)return Wi;let e;const{_reader:n}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const l=e.header(),p=n.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(l,p)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const l=e.header(),p=n.readMessageBody(e.bodyLength),v=this._loadDictionaryBatch(l,p);this.dictionaries.set(l.id,v)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fy(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class Ap extends N1{constructor(e,n){super(n),this._reader=new dA(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return ur(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return ur(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=$1(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return ur(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Wi})}return(e){return ur(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Wi})}next(){return ur(this,void 0,void 0,function*(){if(this.closed)return Wi;let e;const{_reader:n}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const l=e.header(),p=yield n.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(l,p)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const l=e.header(),p=yield n.readMessageBody(e.bodyLength),v=this._loadDictionaryBatch(l,p);this.dictionaries.set(l.id,v)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fy(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return ur(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class U1 extends kp{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,n){super(e instanceof Cv?e:new Cv(e),n)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var n;if(this.closed)return null;this._footer||this.open();const l=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(e);if(l&&this._handle.seek(l.offset)){const p=this._reader.readMessage(Zr.RecordBatch);if(p!=null&&p.isRecordBatch()){const v=p.header(),b=this._reader.readMessageBody(p.bodyLength);return this._loadRecordBatch(v,b)}}return null}_readDictionaryBatch(e){var n;const l=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(e);if(l&&this._handle.seek(l.offset)){const p=this._reader.readMessage(Zr.DictionaryBatch);if(p!=null&&p.isDictionaryBatch()){const v=p.header(),b=this._reader.readMessageBody(p.bodyLength),c=this._loadDictionaryBatch(v,b);this.dictionaries.set(v.id,c)}}}_readFooter(){const{_handle:e}=this,n=e.size-F1,l=e.readInt32(n),p=e.readAt(n-l,l);return Zh.decode(p)}_readNextMessageAndValidate(e){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return ur(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const l of this._footer.dictionaryBatches())l&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,e)})}readRecordBatch(e){return ur(this,void 0,void 0,function*(){var n;if(this.closed)return null;this._footer||(yield this.open());const l=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(e);if(l&&(yield this._handle.seek(l.offset))){const p=yield this._reader.readMessage(Zr.RecordBatch);if(p!=null&&p.isRecordBatch()){const v=p.header(),b=yield this._reader.readMessageBody(p.bodyLength);return this._loadRecordBatch(v,b)}}return null})}_readDictionaryBatch(e){return ur(this,void 0,void 0,function*(){var n;const l=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(e);if(l&&(yield this._handle.seek(l.offset))){const p=yield this._reader.readMessage(Zr.DictionaryBatch);if(p!=null&&p.isDictionaryBatch()){const v=p.header(),b=yield this._reader.readMessageBody(p.bodyLength),c=this._loadDictionaryBatch(v,b);this.dictionaries.set(v.id,c)}}})}_readFooter(){return ur(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const n=e.size-F1,l=yield e.readInt32(n),p=yield e.readAt(n-l,l);return Zh.decode(p)})}_readNextMessageAndValidate(e){return ur(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?Uy(e)?new O1(new U1(r.read())):new Ip(new kp(r)):new Ip(new kp(function*(){}()))}function bA(r){return ur(this,void 0,void 0,function*(){const e=yield r.peek(id+7&-8);return e&&e.byteLength>=4?Uy(e)?new O1(new U1(yield r.read())):new Tp(new Ap(r)):new Tp(new Ap(function(){return Ba(this,arguments,function*(){})}()))})}function xA(r){return ur(this,void 0,void 0,function*(){const{size:e}=yield r.stat(),n=new Sp(r,e);return e>=pA&&Uy(yield n.readAt(0,id+7&-8))?new mA(new gA(n)):new Tp(new Ap(n))})}class Hi extends Cr{static assemble(...e){const n=p=>p.flatMap(v=>Array.isArray(v)?n(v):v instanceof Is?v.data.children:v.data),l=new Hi;return l.visitMany(n(e)),l}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof ei)return this.visitMany(e.data),this;const{type:n}=e;if(!Vt.isDictionary(n)){const{length:l}=e;if(l>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Vt.isUnion(n))this.nodes.push(new tl(l,0));else{const{nullCount:p}=e;Vt.isNull(n)||ma.call(this,p<=0?new Uint8Array(0):yp(e.offset,l,e.nullBitmap)),this.nodes.push(new tl(l,p))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function ma(r){const e=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Ra(this._byteLength,e)),this._byteLength+=e,this}function wA(r){var e;const{type:n,length:l,typeIds:p,valueOffsets:v}=r;if(ma.call(this,p),n.mode===Kn.Sparse)return Qg.call(this,r);if(n.mode===Kn.Dense){if(r.offset<=0)return ma.call(this,v),Qg.call(this,r);{const b=new Int32Array(l),c=Object.create(null),A=Object.create(null);for(let T,z,B=-1;++B{const B=n.typeIds[z],U=c[B],j=A[B];return T.slice(U,Math.min(l,j))}))}}return this}function SA(r){let e;return r.nullCount>=r.length?ma.call(this,new Uint8Array(0)):(e=r.values)instanceof Uint8Array?ma.call(this,yp(r.offset,r.length,e)):ma.call(this,_p(r.values))}function bo(r){return ma.call(this,r.values.subarray(0,r.length*r.stride))}function em(r){const{length:e,values:n,valueOffsets:l}=r,p=yi(l[0]),v=yi(l[e]),b=Math.min(v-p,n.byteLength-p);return ma.call(this,Wb(-p,e+1,l)),ma.call(this,n.subarray(p,p+b)),this}function $y(r){const{length:e,valueOffsets:n}=r;if(n){const{[0]:l,[e]:p}=n;return ma.call(this,Wb(-l,e+1,n)),this.visit(r.children[0].slice(l,p-l))}return this.visit(r.children[0])}function Qg(r){return this.visitMany(r.type.children.map((e,n)=>r.children[n]).filter(Boolean))[0]}Hi.prototype.visitBool=SA;Hi.prototype.visitInt=bo;Hi.prototype.visitFloat=bo;Hi.prototype.visitUtf8=em;Hi.prototype.visitLargeUtf8=em;Hi.prototype.visitBinary=em;Hi.prototype.visitLargeBinary=em;Hi.prototype.visitFixedSizeBinary=bo;Hi.prototype.visitDate=bo;Hi.prototype.visitTimestamp=bo;Hi.prototype.visitTime=bo;Hi.prototype.visitDecimal=bo;Hi.prototype.visitList=$y;Hi.prototype.visitStruct=Qg;Hi.prototype.visitUnion=wA;Hi.prototype.visitInterval=bo;Hi.prototype.visitDuration=bo;Hi.prototype.visitFixedSizeList=$y;Hi.prototype.visitMap=$y;class V1 extends Py{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,n){throw new Error('"throughDOM" not available in this environment')}constructor(e){super(),this._position=0,this._started=!1,this._sink=new Uf,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,ks(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Nl(e)?e.then(n=>this.writeAll(n)):cu(e)?Gy(this,e):qy(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,n=null){return e===this._sink||e instanceof Uf?this._sink=e:(this._sink=new Uf,e&&eT(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&tT(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!n||!Xg(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(e){let n=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof el&&!(n=e.schema))return this.finish()&&void 0;if(e instanceof Is&&!(n=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Xg(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}e instanceof Is?e instanceof Fy||this._writeRecordBatch(e):e instanceof el?this.writeAll(e.batches):Qh(e)&&this.writeAll(e)}_writeMessage(e,n=8){const l=n-1,p=cs.encode(e),v=p.byteLength,b=this._writeLegacyIpcFormat?4:8,c=v+b+l&~l,A=c-v-b;return e.headerType===Zr.RecordBatch?this._recordBatchBlocks.push(new Jo(c,e.bodyLength,this._position)):e.headerType===Zr.DictionaryBatch&&this._dictionaryBlocks.push(new Jo(c,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-b)),v>0&&this._write(p),this._writePadding(A)}_write(e){if(this._started){const n=Nr(e);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(e){return this._writeMessage(cs.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Wh)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){const{byteLength:n,nodes:l,bufferRegions:p,buffers:v}=Hi.assemble(e),b=new Fs(e.numRows,l,p),c=cs.from(b,n);return this._writeDictionaries(e)._writeMessage(c)._writeBodyBuffers(v)}_writeDictionaryBatch(e,n,l=!1){const{byteLength:p,nodes:v,bufferRegions:b,buffers:c}=Hi.assemble(new ei([e])),A=new Fs(e.length,v,b),T=new Va(A,n,l),z=cs.from(T,p);return this._writeMessage(z)._writeBodyBuffers(c)}_writeBodyBuffers(e){let n,l,p;for(let v=-1,b=e.length;++v0&&(this._write(n),(p=(l+7&-8)-l)>0&&this._writePadding(p));return this}_writeDictionaries(e){var n,l;for(const[p,v]of e.dictionaries){const b=(n=v==null?void 0:v.data)!==null&&n!==void 0?n:[],c=this._seenDictionaries.get(p),A=(l=this._dictionaryDeltaOffsets.get(p))!==null&&l!==void 0?l:0;if(!c||c.data[0]!==b[0])for(const[T,z]of b.entries())this._writeDictionaryBatch(z,p,T>0);else if(Al.writeAll(p)):cu(e)?Gy(l,e):qy(l,e)}}class jy extends V1{static writeAll(e){const n=new jy;return Nl(e)?e.then(l=>n.writeAll(l)):cu(e)?Gy(n,e):qy(n,e)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,n,l=!1){if(!l&&this._seenDictionaries.has(n))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(e,n,l)}_writeFooter(e){const n=Zh.encode(new Zh(e,ln.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function qy(r,e){let n=e;e instanceof el&&(n=e.batches,r.reset(void 0,e.schema));for(const l of n)r.write(l);return r.finish()}function Gy(r,e){return ur(this,void 0,void 0,function*(){var n,l,p,v,b,c,A;try{for(n=!0,l=zl(e);p=yield l.next(),v=p.done,!v;n=!0){A=p.value,n=!1;const T=A;r.write(T)}}catch(T){b={error:T}}finally{try{!n&&!v&&(c=l.return)&&(yield c.call(l))}finally{if(b)throw b.error}}return r.finish()})}function IA(r,e="stream"){return(e==="stream"?Vy:jy).writeAll(r).toUint8Array(!0)}var TA=Object.create,j1=Object.defineProperty,kA=Object.getOwnPropertyDescriptor,AA=Object.getOwnPropertyNames,EA=Object.getPrototypeOf,CA=Object.prototype.hasOwnProperty,MA=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),DA=(r,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of AA(e))!CA.call(r,p)&&p!==n&&j1(r,p,{get:()=>e[p],enumerable:!(l=kA(e,p))||l.enumerable});return r},PA=(r,e,n)=>(n=r!=null?TA(EA(r)):{},DA(!r||!r.__esModule?j1(n,"default",{value:r,enumerable:!0}):n,r)),LA=MA((r,e)=>{e.exports=Worker}),zA=(r=>(r[r.UNDEFINED=0]="UNDEFINED",r[r.AUTOMATIC=1]="AUTOMATIC",r[r.READ_ONLY=2]="READ_ONLY",r[r.READ_WRITE=3]="READ_WRITE",r))(zA||{}),BA=(r=>(r[r.IDENTIFIER=0]="IDENTIFIER",r[r.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",r[r.STRING_CONSTANT=2]="STRING_CONSTANT",r[r.OPERATOR=3]="OPERATOR",r[r.KEYWORD=4]="KEYWORD",r[r.COMMENT=5]="COMMENT",r))(BA||{}),RA=(r=>(r[r.NONE=0]="NONE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r))(RA||{}),FA=(r=>(r[r.NONE=0]="NONE",r[r.CONNECT=1]="CONNECT",r[r.DISCONNECT=2]="DISCONNECT",r[r.OPEN=3]="OPEN",r[r.QUERY=4]="QUERY",r[r.INSTANTIATE=5]="INSTANTIATE",r))(FA||{}),OA=(r=>(r[r.NONE=0]="NONE",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR",r[r.START=3]="START",r[r.RUN=4]="RUN",r[r.CAPTURE=5]="CAPTURE",r))(OA||{}),NA=(r=>(r[r.NONE=0]="NONE",r[r.WEB_WORKER=1]="WEB_WORKER",r[r.NODE_WORKER=2]="NODE_WORKER",r[r.BINDINGS=3]="BINDINGS",r[r.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",r))(NA||{}),UA=class{constructor(r=2){this.level=r}log(r){r.level>=this.level&&console.log(r)}},$A=(r=>(r[r.SUCCESS=0]="SUCCESS",r))($A||{}),VA=class{constructor(r,e){this._bindings=r,this._conn=e}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(r){return r(this._bindings,this._conn)}async query(r){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let e=await this._bindings.runQuery(this._conn,r),n=Js.from(e);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new el(n)}async send(r){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let e=await this._bindings.startPendingQuery(this._conn,r);for(;e==null;)e=await this._bindings.pollPendingQuery(this._conn);let n=new q1(this._bindings,this._conn,e),l=await Js.from(n);return console.assert(l.isAsync()),console.assert(l.isStream()),l}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(r){return await this._bindings.getTableNames(this._conn,r)}async prepare(r){let e=await this._bindings.createPrepared(this._conn,r);return new jA(this._bindings,this._conn,e)}async insertArrowTable(r,e){let n=IA(r,"stream");await this.insertArrowFromIPCStream(n,e)}async insertArrowFromIPCStream(r,e){await this._bindings.insertArrowFromIPCStream(this._conn,r,e)}async insertCSVFromPath(r,e){await this._bindings.insertCSVFromPath(this._conn,r,e)}async insertJSONFromPath(r,e){await this._bindings.insertJSONFromPath(this._conn,r,e)}},q1=class{constructor(r,e,n){this.db=r,this.conn=e,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let r;return this._inFlight!=null?(r=await this._inFlight,this._inFlight=null):r=await this.db.fetchQueryResults(this.conn),this._depleted=r.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:r}}[Symbol.asyncIterator](){return this}},jA=class{constructor(r,e,n){this.bindings=r,this.connectionId=e,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...r){let e=await this.bindings.runPrepared(this.connectionId,this.statementId,r),n=Js.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new el(n)}async send(...r){let e=await this.bindings.sendPrepared(this.connectionId,this.statementId,r),n=new q1(this.bindings,this.connectionId,e),l=await Js.from(n);return console.assert(l.isAsync()),console.assert(l.isStream()),l}},qA=(r=>(r.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",r.CLOSE_PREPARED="CLOSE_PREPARED",r.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",r.CONNECT="CONNECT",r.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",r.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",r.CREATE_PREPARED="CREATE_PREPARED",r.DISCONNECT="DISCONNECT",r.DROP_FILE="DROP_FILE",r.DROP_FILES="DROP_FILES",r.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",r.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",r.FLUSH_FILES="FLUSH_FILES",r.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",r.GET_TABLE_NAMES="GET_TABLE_NAMES",r.GET_VERSION="GET_VERSION",r.GLOB_FILE_INFOS="GLOB_FILE_INFOS",r.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",r.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",r.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",r.INSTANTIATE="INSTANTIATE",r.OPEN="OPEN",r.PING="PING",r.POLL_PENDING_QUERY="POLL_PENDING_QUERY",r.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",r.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",r.REGISTER_FILE_URL="REGISTER_FILE_URL",r.RESET="RESET",r.RUN_PREPARED="RUN_PREPARED",r.RUN_QUERY="RUN_QUERY",r.SEND_PREPARED="SEND_PREPARED",r.START_PENDING_QUERY="START_PENDING_QUERY",r.TOKENIZE="TOKENIZE",r))(qA||{}),GA=(r=>(r.CONNECTION_INFO="CONNECTION_INFO",r.ERROR="ERROR",r.FEATURE_FLAGS="FEATURE_FLAGS",r.FILE_BUFFER="FILE_BUFFER",r.FILE_INFOS="FILE_INFOS",r.FILE_SIZE="FILE_SIZE",r.FILE_STATISTICS="FILE_STATISTICS",r.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",r.LOG="LOG",r.OK="OK",r.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",r.QUERY_PLAN="QUERY_PLAN",r.QUERY_RESULT="QUERY_RESULT",r.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",r.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",r.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",r.REGISTERED_FILE="REGISTERED_FILE",r.SCRIPT_TOKENS="SCRIPT_TOKENS",r.SUCCESS="SUCCESS",r.TABLE_NAMES="TABLE_NAMES",r.VERSION_STRING="VERSION_STRING",r))(GA||{}),jr=class{constructor(r,e){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=r,this.data=e,this.promise=new Promise((n,l)=>{this.promiseResolver=n,this.promiseRejecter=l})}};function jf(r){switch(r.typeId){case ce.Binary:return{sqlType:"binary"};case ce.Bool:return{sqlType:"bool"};case ce.Date:return{sqlType:"date"};case ce.DateDay:return{sqlType:"date32[d]"};case ce.DateMillisecond:return{sqlType:"date64[ms]"};case ce.Decimal:{let e=r;return{sqlType:"decimal",precision:e.precision,scale:e.scale}}case ce.Float:return{sqlType:"float"};case ce.Float16:return{sqlType:"float16"};case ce.Float32:return{sqlType:"float32"};case ce.Float64:return{sqlType:"float64"};case ce.Int:return{sqlType:"int32"};case ce.Int16:return{sqlType:"int16"};case ce.Int32:return{sqlType:"int32"};case ce.Int64:return{sqlType:"int64"};case ce.Uint16:return{sqlType:"uint16"};case ce.Uint32:return{sqlType:"uint32"};case ce.Uint64:return{sqlType:"uint64"};case ce.Uint8:return{sqlType:"uint8"};case ce.IntervalDayTime:return{sqlType:"interval[dt]"};case ce.IntervalYearMonth:return{sqlType:"interval[m]"};case ce.List:return{sqlType:"list",valueType:jf(r.valueType)};case ce.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case ce.Null:return{sqlType:"null"};case ce.Utf8:return{sqlType:"utf8"};case ce.Struct:return{sqlType:"struct",fields:r.children.map(e=>ey(e.name,e.type))};case ce.Map:{let e=r;return{sqlType:"map",keyType:jf(e.keyType),valueType:jf(e.valueType)}}case ce.Time:return{sqlType:"time[s]"};case ce.TimeMicrosecond:return{sqlType:"time[us]"};case ce.TimeMillisecond:return{sqlType:"time[ms]"};case ce.TimeNanosecond:return{sqlType:"time[ns]"};case ce.TimeSecond:return{sqlType:"time[s]"};case ce.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case ce.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case ce.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case ce.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case ce.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function ey(r,e){let n=jf(e);return n.name=r,n}var ZA=new TextEncoder,WA=class{constructor(r,e=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=r,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),e!=null&&this.attach(e)}get logger(){return this._logger}attach(r){this._worker=r,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((e,n)=>{this._workerShutdownResolver=e})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(r,e=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,r),this._worker.postMessage({messageId:n,type:r.type,data:r.data},e),await r.promise}onMessage(r){var e;let n=r.data;switch(n.type){case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let p of this._onInstantiationProgress)p(n.data);return}}let l=this._pendingRequests.get(n.requestId);if(!l){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let p=new Error(n.data.message);p.name=n.data.name,(e=Object.getOwnPropertyDescriptor(p,"stack"))!=null&&e.writable&&(p.stack=n.data.stack),l.promiseRejecter(p);return}switch(l.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){l.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){l.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){l.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){l.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){l.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){l.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){l.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){l.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){l.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){l.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){l.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){l.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){l.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){l.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){l.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){l.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){l.promiseResolver(n.data);return}break}l.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(r){console.error(r),console.error("error in duckdb worker: ".concat(r.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let r=new jr("RESET",null);return await this.postTask(r)}async ping(){let r=new jr("PING",null);await this.postTask(r)}async dropFile(r){let e=new jr("DROP_FILE",r);return await this.postTask(e)}async dropFiles(){let r=new jr("DROP_FILES",null);return await this.postTask(r)}async flushFiles(){let r=new jr("FLUSH_FILES",null);return await this.postTask(r)}async instantiate(r,e=null,n=l=>{}){this._onInstantiationProgress.push(n);let l=new jr("INSTANTIATE",[r,e]);return await this.postTask(l)}async getVersion(){let r=new jr("GET_VERSION",null);return await this.postTask(r)}async getFeatureFlags(){let r=new jr("GET_FEATURE_FLAGS",null);return await this.postTask(r)}async open(r){let e=new jr("OPEN",r);await this.postTask(e)}async tokenize(r){let e=new jr("TOKENIZE",r);return await this.postTask(e)}async connectInternal(){let r=new jr("CONNECT",null);return await this.postTask(r)}async connect(){let r=await this.connectInternal();return new VA(this,r)}async disconnect(r){let e=new jr("DISCONNECT",r);await this.postTask(e)}async runQuery(r,e){let n=new jr("RUN_QUERY",[r,e]);return await this.postTask(n)}async startPendingQuery(r,e){let n=new jr("START_PENDING_QUERY",[r,e]);return await this.postTask(n)}async pollPendingQuery(r){let e=new jr("POLL_PENDING_QUERY",r);return await this.postTask(e)}async cancelPendingQuery(r){let e=new jr("CANCEL_PENDING_QUERY",r);return await this.postTask(e)}async fetchQueryResults(r){let e=new jr("FETCH_QUERY_RESULTS",r);return await this.postTask(e)}async getTableNames(r,e){let n=new jr("GET_TABLE_NAMES",[r,e]);return await this.postTask(n)}async createPrepared(r,e){let n=new jr("CREATE_PREPARED",[r,e]);return await this.postTask(n)}async closePrepared(r,e){let n=new jr("CLOSE_PREPARED",[r,e]);await this.postTask(n)}async runPrepared(r,e,n){let l=new jr("RUN_PREPARED",[r,e,n]);return await this.postTask(l)}async sendPrepared(r,e,n){let l=new jr("SEND_PREPARED",[r,e,n]);return await this.postTask(l)}async globFiles(r){let e=new jr("GLOB_FILE_INFOS",r);return await this.postTask(e)}async registerFileText(r,e){let n=ZA.encode(e);await this.registerFileBuffer(r,n)}async registerFileURL(r,e,n,l){e===void 0&&(e=r);let p=new jr("REGISTER_FILE_URL",[r,e,n,l]);await this.postTask(p)}async registerEmptyFileBuffer(r){}async registerFileBuffer(r,e){let n=new jr("REGISTER_FILE_BUFFER",[r,e]);await this.postTask(n,[e.buffer])}async registerFileHandle(r,e,n,l){let p=new jr("REGISTER_FILE_HANDLE",[r,e,n,l]);await this.postTask(p,[])}async collectFileStatistics(r,e){let n=new jr("COLLECT_FILE_STATISTICS",[r,e]);await this.postTask(n,[])}async exportFileStatistics(r){let e=new jr("EXPORT_FILE_STATISTICS",r);return await this.postTask(e,[])}async copyFileToBuffer(r){let e=new jr("COPY_FILE_TO_BUFFER",r);return await this.postTask(e)}async copyFileToPath(r,e){let n=new jr("COPY_FILE_TO_PATH",[r,e]);await this.postTask(n)}async insertArrowFromIPCStream(r,e,n){if(e.length==0)return;let l=new jr("INSERT_ARROW_FROM_IPC_STREAM",[r,e,n]);await this.postTask(l,[e.buffer])}async insertCSVFromPath(r,e,n){if(n.columns!==void 0){let p=[];for(let v in n.columns){let b=n.columns[v];p.push(ey(v,b))}n.columnsFlat=p,delete n.columns}let l=new jr("IMPORT_CSV_FROM_PATH",[r,e,n]);await this.postTask(l)}async insertJSONFromPath(r,e,n){if(n.columns!==void 0){let p=[];for(let v in n.columns){let b=n.columns[v];p.push(ey(v,b))}n.columnsFlat=p,delete n.columns}let l=new jr("IMPORT_JSON_FROM_PATH",[r,e,n]);await this.postTask(l)}},HA=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),YA=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),KA=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),XA=()=>(async r=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(r)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),Zy={name:"@duckdb/duckdb-wasm",version:"1.29.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.13",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},JA=Zy.name,QA=Zy.version,Wy=Zy.version.split(".");Wy[0];Wy[1];Wy[2];var eE=()=>typeof navigator>"u";function tE(){let r="https://cdn.jsdelivr.net/npm/".concat(JA,"@").concat(QA,"/dist/");return{mvp:{mainModule:"".concat(r,"duckdb-mvp.wasm"),mainWorker:"".concat(r,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(r,"duckdb-eh.wasm"),mainWorker:"".concat(r,"duckdb-browser-eh.worker.js")}}}var Sg=null,Ig=null,Tg=null,kg=null,Ag=null;async function rE(){return Sg==null&&(Sg=typeof BigInt64Array<"u"),Ig==null&&(Ig=await YA()),Tg==null&&(Tg=await XA()),kg==null&&(kg=await KA()),Ag==null&&(Ag=await HA()),{bigInt64Array:Sg,crossOriginIsolated:eE()||globalThis.crossOriginIsolated||!1,wasmExceptions:Ig,wasmSIMD:kg,wasmThreads:Tg,wasmBulkMemory:Ag}}async function iE(r){let e=await rE();if(e.wasmExceptions){if(e.wasmSIMD&&e.wasmThreads&&e.crossOriginIsolated&&r.coi)return{mainModule:r.coi.mainModule,mainWorker:r.coi.mainWorker,pthreadWorker:r.coi.pthreadWorker};if(r.eh)return{mainModule:r.eh.mainModule,mainWorker:r.eh.mainWorker,pthreadWorker:null}}return{mainModule:r.mvp.mainModule,mainWorker:r.mvp.mainWorker,pthreadWorker:null}}PA(LA());function nE(){let r=new TextDecoder;return e=>(typeof SharedArrayBuffer<"u"&&e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),r.decode(e))}nE();var sE=(r=>(r[r.BUFFER=0]="BUFFER",r[r.NODE_FS=1]="NODE_FS",r[r.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",r[r.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",r[r.HTTP=4]="HTTP",r[r.S3=5]="S3",r))(sE||{});class aE{constructor(){pg(this,"inner");this.inner=null}async initialise(){const e=tE(),n=await iE(e),l=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),p=new Worker(l),v=new UA,b=new WA(v,p);await b.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(l),this.inner=b}unset(){this.inner=null}isLoaded(){return this.inner!=null}async getMetrics(e){if(!this.inner)throw new Error("DuckDBBackend not initialised");const n=await this.inner.connect(),p=(await n.query(`INSTALL httpfs; LOAD httpfs; ${e}`)).toArray().map(v=>v.toJSON());return console.log(p),await n.close(),p}}Hp(aE);const ty=ci(null),G1=ci(null),tm=ci({kind:"title"}),ry=ci([]),Ep=ci(""),iy=ci(""),Bl=ci([]),Cp=ci([]),Nv=ci({}),Hy=ci([]),Yy=ci("pmtiles://https://popgetter.blob.core.windows.net/dev/v0.2/usa/geometries/tract_2019.pmtiles"),Ky="-",oE=r=>{const e=cE(r),{conflictingClassGroups:n,conflictingClassGroupModifiers:l}=r;return{getClassGroupId:b=>{const c=b.split(Ky);return c[0]===""&&c.length!==1&&c.shift(),Z1(c,e)||lE(b)},getConflictingClassGroupIds:(b,c)=>{const A=n[b]||[];return c&&l[b]?[...A,...l[b]]:A}}},Z1=(r,e)=>{var b;if(r.length===0)return e.classGroupId;const n=r[0],l=e.nextPart.get(n),p=l?Z1(r.slice(1),l):void 0;if(p)return p;if(e.validators.length===0)return;const v=r.join(Ky);return(b=e.validators.find(({validator:c})=>c(v)))==null?void 0:b.classGroupId},Uv=/^\[(.+)\]$/,lE=r=>{if(Uv.test(r)){const e=Uv.exec(r)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},cE=r=>{const{theme:e,prefix:n}=r,l={nextPart:new Map,validators:[]};return hE(Object.entries(r.classGroups),n).forEach(([v,b])=>{ny(b,l,v,e)}),l},ny=(r,e,n,l)=>{r.forEach(p=>{if(typeof p=="string"){const v=p===""?e:$v(e,p);v.classGroupId=n;return}if(typeof p=="function"){if(uE(p)){ny(p(l),e,n,l);return}e.validators.push({validator:p,classGroupId:n});return}Object.entries(p).forEach(([v,b])=>{ny(b,$v(e,v),n,l)})})},$v=(r,e)=>{let n=r;return e.split(Ky).forEach(l=>{n.nextPart.has(l)||n.nextPart.set(l,{nextPart:new Map,validators:[]}),n=n.nextPart.get(l)}),n},uE=r=>r.isThemeGetter,hE=(r,e)=>e?r.map(([n,l])=>{const p=l.map(v=>typeof v=="string"?e+v:typeof v=="object"?Object.fromEntries(Object.entries(v).map(([b,c])=>[e+b,c])):v);return[n,p]}):r,dE=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,l=new Map;const p=(v,b)=>{n.set(v,b),e++,e>r&&(e=0,l=n,n=new Map)};return{get(v){let b=n.get(v);if(b!==void 0)return b;if((b=l.get(v))!==void 0)return p(v,b),b},set(v,b){n.has(v)?n.set(v,b):p(v,b)}}},W1="!",fE=r=>{const{separator:e,experimentalParseClassName:n}=r,l=e.length===1,p=e[0],v=e.length,b=c=>{const A=[];let T=0,z=0,B;for(let ne=0;nez?B-z:void 0;return{modifiers:A,hasImportantModifier:j,baseClassName:Q,maybePostfixModifierPosition:ae}};return n?c=>n({className:c,parseClassName:b}):b},pE=r=>{if(r.length<=1)return r;const e=[];let n=[];return r.forEach(l=>{l[0]==="["?(e.push(...n.sort(),l),n=[]):n.push(l)}),e.push(...n.sort()),e},mE=r=>({cache:dE(r.cacheSize),parseClassName:fE(r),...oE(r)}),gE=/\s+/,yE=(r,e)=>{const{parseClassName:n,getClassGroupId:l,getConflictingClassGroupIds:p}=e,v=[],b=r.trim().split(gE);let c="";for(let A=b.length-1;A>=0;A-=1){const T=b[A],{modifiers:z,hasImportantModifier:B,baseClassName:U,maybePostfixModifierPosition:j}=n(T);let Q=!!j,ae=l(Q?U.substring(0,j):U);if(!ae){if(!Q){c=T+(c.length>0?" "+c:c);continue}if(ae=l(U),!ae){c=T+(c.length>0?" "+c:c);continue}Q=!1}const ne=pE(z).join(":"),Y=B?ne+W1:ne,_e=Y+ae;if(v.includes(_e))continue;v.push(_e);const de=p(ae,Q);for(let pe=0;pe0?" "+c:c)}return c};function Xy(){let r=0,e,n,l="";for(;r{if(typeof r=="string")return r;let e,n="";for(let l=0;lB(z),r());return n=mE(T),l=n.cache.get,p=n.cache.set,v=c,c(A)}function c(A){const T=l(A);if(T)return T;const z=yE(A,n);return p(A,z),z}return function(){return v(Xy.apply(null,arguments))}}const Di=r=>{const e=n=>n[r]||[];return e.isThemeGetter=!0,e},Y1=/^\[(?:([a-z-]+):)?(.+)\]$/i,vE=/^\d+\/\d+$/,bE=new Set(["px","full","screen"]),xE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,SE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,IE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oo=r=>Kc(r)||bE.has(r)||vE.test(r),Vo=r=>hu(r,"length",LE),Kc=r=>!!r&&!Number.isNaN(Number(r)),Eg=r=>hu(r,"number",Kc),xh=r=>!!r&&Number.isInteger(Number(r)),kE=r=>r.endsWith("%")&&Kc(r.slice(0,-1)),wr=r=>Y1.test(r),jo=r=>xE.test(r),AE=new Set(["length","size","percentage"]),EE=r=>hu(r,AE,K1),CE=r=>hu(r,"position",K1),ME=new Set(["image","url"]),DE=r=>hu(r,ME,BE),PE=r=>hu(r,"",zE),wh=()=>!0,hu=(r,e,n)=>{const l=Y1.exec(r);return l?l[1]?typeof e=="string"?l[1]===e:e.has(l[1]):n(l[2]):!1},LE=r=>wE.test(r)&&!SE.test(r),K1=()=>!1,zE=r=>IE.test(r),BE=r=>TE.test(r),RE=()=>{const r=Di("colors"),e=Di("spacing"),n=Di("blur"),l=Di("brightness"),p=Di("borderColor"),v=Di("borderRadius"),b=Di("borderSpacing"),c=Di("borderWidth"),A=Di("contrast"),T=Di("grayscale"),z=Di("hueRotate"),B=Di("invert"),U=Di("gap"),j=Di("gradientColorStops"),Q=Di("gradientColorStopPositions"),ae=Di("inset"),ne=Di("margin"),Y=Di("opacity"),_e=Di("padding"),de=Di("saturate"),pe=Di("scale"),Te=Di("sepia"),De=Di("skew"),je=Di("space"),ke=Di("translate"),$e=()=>["auto","contain","none"],Me=()=>["auto","hidden","clip","visible","scroll"],He=()=>["auto",wr,e],Ye=()=>[wr,e],Pe=()=>["",oo,Vo],tt=()=>["auto",Kc,wr],Je=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],lt=()=>["solid","dashed","dotted","double","none"],At=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ze=()=>["start","end","center","between","around","evenly","stretch"],ft=()=>["","0",wr],St=()=>["auto","avoid","all","avoid-page","page","left","right","column"],gt=()=>[Kc,wr];return{cacheSize:500,separator:":",theme:{colors:[wh],spacing:[oo,Vo],blur:["none","",jo,wr],brightness:gt(),borderColor:[r],borderRadius:["none","","full",jo,wr],borderSpacing:Ye(),borderWidth:Pe(),contrast:gt(),grayscale:ft(),hueRotate:gt(),invert:ft(),gap:Ye(),gradientColorStops:[r],gradientColorStopPositions:[kE,Vo],inset:He(),margin:He(),opacity:gt(),padding:Ye(),saturate:gt(),scale:gt(),sepia:ft(),skew:gt(),space:Ye(),translate:Ye()},classGroups:{aspect:[{aspect:["auto","square","video",wr]}],container:["container"],columns:[{columns:[jo]}],"break-after":[{"break-after":St()}],"break-before":[{"break-before":St()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Je(),wr]}],overflow:[{overflow:Me()}],"overflow-x":[{"overflow-x":Me()}],"overflow-y":[{"overflow-y":Me()}],overscroll:[{overscroll:$e()}],"overscroll-x":[{"overscroll-x":$e()}],"overscroll-y":[{"overscroll-y":$e()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[ae]}],"inset-x":[{"inset-x":[ae]}],"inset-y":[{"inset-y":[ae]}],start:[{start:[ae]}],end:[{end:[ae]}],top:[{top:[ae]}],right:[{right:[ae]}],bottom:[{bottom:[ae]}],left:[{left:[ae]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xh,wr]}],basis:[{basis:He()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",wr]}],grow:[{grow:ft()}],shrink:[{shrink:ft()}],order:[{order:["first","last","none",xh,wr]}],"grid-cols":[{"grid-cols":[wh]}],"col-start-end":[{col:["auto",{span:["full",xh,wr]},wr]}],"col-start":[{"col-start":tt()}],"col-end":[{"col-end":tt()}],"grid-rows":[{"grid-rows":[wh]}],"row-start-end":[{row:["auto",{span:[xh,wr]},wr]}],"row-start":[{"row-start":tt()}],"row-end":[{"row-end":tt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",wr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",wr]}],gap:[{gap:[U]}],"gap-x":[{"gap-x":[U]}],"gap-y":[{"gap-y":[U]}],"justify-content":[{justify:["normal",...Ze()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ze(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ze(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_e]}],px:[{px:[_e]}],py:[{py:[_e]}],ps:[{ps:[_e]}],pe:[{pe:[_e]}],pt:[{pt:[_e]}],pr:[{pr:[_e]}],pb:[{pb:[_e]}],pl:[{pl:[_e]}],m:[{m:[ne]}],mx:[{mx:[ne]}],my:[{my:[ne]}],ms:[{ms:[ne]}],me:[{me:[ne]}],mt:[{mt:[ne]}],mr:[{mr:[ne]}],mb:[{mb:[ne]}],ml:[{ml:[ne]}],"space-x":[{"space-x":[je]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[je]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",wr,e]}],"min-w":[{"min-w":[wr,e,"min","max","fit"]}],"max-w":[{"max-w":[wr,e,"none","full","min","max","fit","prose",{screen:[jo]},jo]}],h:[{h:[wr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[wr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[wr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[wr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",jo,Vo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Eg]}],"font-family":[{font:[wh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",wr]}],"line-clamp":[{"line-clamp":["none",Kc,Eg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",oo,wr]}],"list-image":[{"list-image":["none",wr]}],"list-style-type":[{list:["none","disc","decimal",wr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[r]}],"placeholder-opacity":[{"placeholder-opacity":[Y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[r]}],"text-opacity":[{"text-opacity":[Y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...lt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",oo,Vo]}],"underline-offset":[{"underline-offset":["auto",oo,wr]}],"text-decoration-color":[{decoration:[r]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Ye()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",wr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",wr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[Y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Je(),CE]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",EE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},DE]}],"bg-color":[{bg:[r]}],"gradient-from-pos":[{from:[Q]}],"gradient-via-pos":[{via:[Q]}],"gradient-to-pos":[{to:[Q]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],rounded:[{rounded:[v]}],"rounded-s":[{"rounded-s":[v]}],"rounded-e":[{"rounded-e":[v]}],"rounded-t":[{"rounded-t":[v]}],"rounded-r":[{"rounded-r":[v]}],"rounded-b":[{"rounded-b":[v]}],"rounded-l":[{"rounded-l":[v]}],"rounded-ss":[{"rounded-ss":[v]}],"rounded-se":[{"rounded-se":[v]}],"rounded-ee":[{"rounded-ee":[v]}],"rounded-es":[{"rounded-es":[v]}],"rounded-tl":[{"rounded-tl":[v]}],"rounded-tr":[{"rounded-tr":[v]}],"rounded-br":[{"rounded-br":[v]}],"rounded-bl":[{"rounded-bl":[v]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[Y]}],"border-style":[{border:[...lt(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[Y]}],"divide-style":[{divide:lt()}],"border-color":[{border:[p]}],"border-color-x":[{"border-x":[p]}],"border-color-y":[{"border-y":[p]}],"border-color-s":[{"border-s":[p]}],"border-color-e":[{"border-e":[p]}],"border-color-t":[{"border-t":[p]}],"border-color-r":[{"border-r":[p]}],"border-color-b":[{"border-b":[p]}],"border-color-l":[{"border-l":[p]}],"divide-color":[{divide:[p]}],"outline-style":[{outline:["",...lt()]}],"outline-offset":[{"outline-offset":[oo,wr]}],"outline-w":[{outline:[oo,Vo]}],"outline-color":[{outline:[r]}],"ring-w":[{ring:Pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[r]}],"ring-opacity":[{"ring-opacity":[Y]}],"ring-offset-w":[{"ring-offset":[oo,Vo]}],"ring-offset-color":[{"ring-offset":[r]}],shadow:[{shadow:["","inner","none",jo,PE]}],"shadow-color":[{shadow:[wh]}],opacity:[{opacity:[Y]}],"mix-blend":[{"mix-blend":[...At(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":At()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[l]}],contrast:[{contrast:[A]}],"drop-shadow":[{"drop-shadow":["","none",jo,wr]}],grayscale:[{grayscale:[T]}],"hue-rotate":[{"hue-rotate":[z]}],invert:[{invert:[B]}],saturate:[{saturate:[de]}],sepia:[{sepia:[Te]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[l]}],"backdrop-contrast":[{"backdrop-contrast":[A]}],"backdrop-grayscale":[{"backdrop-grayscale":[T]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z]}],"backdrop-invert":[{"backdrop-invert":[B]}],"backdrop-opacity":[{"backdrop-opacity":[Y]}],"backdrop-saturate":[{"backdrop-saturate":[de]}],"backdrop-sepia":[{"backdrop-sepia":[Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[b]}],"border-spacing-x":[{"border-spacing-x":[b]}],"border-spacing-y":[{"border-spacing-y":[b]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",wr]}],duration:[{duration:gt()}],ease:[{ease:["linear","in","out","in-out",wr]}],delay:[{delay:gt()}],animate:[{animate:["none","spin","ping","pulse","bounce",wr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[pe]}],"scale-x":[{"scale-x":[pe]}],"scale-y":[{"scale-y":[pe]}],rotate:[{rotate:[xh,wr]}],"translate-x":[{"translate-x":[ke]}],"translate-y":[{"translate-y":[ke]}],"skew-x":[{"skew-x":[De]}],"skew-y":[{"skew-y":[De]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",wr]}],accent:[{accent:["auto",r]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",wr]}],"caret-color":[{caret:[r]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Ye()}],"scroll-mx":[{"scroll-mx":Ye()}],"scroll-my":[{"scroll-my":Ye()}],"scroll-ms":[{"scroll-ms":Ye()}],"scroll-me":[{"scroll-me":Ye()}],"scroll-mt":[{"scroll-mt":Ye()}],"scroll-mr":[{"scroll-mr":Ye()}],"scroll-mb":[{"scroll-mb":Ye()}],"scroll-ml":[{"scroll-ml":Ye()}],"scroll-p":[{"scroll-p":Ye()}],"scroll-px":[{"scroll-px":Ye()}],"scroll-py":[{"scroll-py":Ye()}],"scroll-ps":[{"scroll-ps":Ye()}],"scroll-pe":[{"scroll-pe":Ye()}],"scroll-pt":[{"scroll-pt":Ye()}],"scroll-pr":[{"scroll-pr":Ye()}],"scroll-pb":[{"scroll-pb":Ye()}],"scroll-pl":[{"scroll-pl":Ye()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",wr]}],fill:[{fill:[r,"none"]}],"stroke-w":[{stroke:[oo,Vo,Eg]}],stroke:[{stroke:[r,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},$r=_E(RE),FE=r=>r;function X1(r){const e=r-1;return e*e*e+1}function OE(r){return r<.5?4*r*r*r:.5*Math.pow(2*r-2,3)+1}function sy(r){const e=typeof r=="string"&&r.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[r,"px"]}function NE(r,{delay:e=0,duration:n=400,easing:l=OE,amount:p=5,opacity:v=0}={}){const b=getComputedStyle(r),c=+b.opacity,A=b.filter==="none"?"":b.filter,T=c*(1-v),[z,B]=sy(p);return{delay:e,duration:n,easing:l,css:(U,j)=>`opacity: ${c-T*j}; filter: ${A} blur(${j*z}${B});`}}function UE(r,{delay:e=0,duration:n=400,easing:l=FE}={}){const p=+getComputedStyle(r).opacity;return{delay:e,duration:n,easing:l,css:v=>`opacity: ${v*p}`}}function $E(r,{delay:e=0,duration:n=400,easing:l=X1,x:p=0,y:v=0,opacity:b=0}={}){const c=getComputedStyle(r),A=+c.opacity,T=c.transform==="none"?"":c.transform,z=A*(1-b),[B,U]=sy(p),[j,Q]=sy(v);return{delay:e,duration:n,easing:l,css:(ae,ne)=>` +]`}concat(...e){const n=this.schema,l=this.data.concat(e.flatMap(({data:p})=>p));return new Cl(n,l.map(p=>new Is(n,p)))}slice(e,n){const l=this.schema;[e,n]=m1({length:this.numRows},e,n);const p=v1(this.data,this._offsets,e,n);return new Cl(l,p.map(v=>new Is(l,v)))}getChild(e){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===e))}getChildAt(e){if(e>-1&&el.children[e]);if(n.length===0){const{type:l}=this.schema.fields[e],p=Dr({type:l,length:0,nullCount:0});n.push(p._changeLengthAndBackfillNullBitmap(this.numRows))}return new ei(n)}return null}setChild(e,n){var l;return this.setChildAt((l=this.schema.fields)===null||l===void 0?void 0:l.findIndex(p=>p.name===e),n)}setChildAt(e,n){let l=this.schema,p=[...this.batches];if(e>-1&&ethis.getChildAt(T));[v[e],c[e]]=[b,n],[l,p]=xg(l,c)}return new Cl(l,p)}select(e){const n=this.schema.fields.reduce((l,p,v)=>l.set(p.name,v),new Map);return this.selectAt(e.map(l=>n.get(l)).filter(l=>l>-1))}selectAt(e){const n=this.schema.selectAt(e),l=this.batches.map(p=>p.selectAt(e));return new Cl(n,l)}assign(e){const n=this.schema.fields,[l,p]=e.schema.fields.reduce((c,A,T)=>{const[z,B]=c,U=n.findIndex(j=>j.name===A.name);return~U?B[U]=T:z.push(T),c},[[],[]]),v=this.schema.assign(e.schema),b=[...n.map((c,A)=>[A,p[A]]).map(([c,A])=>A===void 0?this.getChildAt(c):e.getChildAt(A)),...l.map(c=>e.getChildAt(c))].filter(Boolean);return new Cl(...xg(v,b))}};E1=Symbol.toStringTag;el[E1]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=vp(My),r.get=vp(As.getVisitFn(ce.Struct)),r.set=b1(ea.getVisitFn(ce.Struct)),r.indexOf=x1(bp.getVisitFn(ce.Struct)),"Table"))(el.prototype);var C1;let Is=class zh{constructor(...e){switch(e.length){case 2:{if([this.schema]=e,!(this.schema instanceof ti))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Dr({nullCount:0,type:new ls(this.schema.fields),children:this.schema.fields.map(n=>Dr({type:n.type,nullCount:0}))})]=e,!(this.data instanceof ai))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Mv(this.schema,this.data.children);break}case 1:{const[n]=e,{fields:l,children:p,length:v}=Object.keys(n).reduce((A,T,z)=>(A.children[z]=n[T],A.length=Math.max(A.length,n[T].length),A.fields[z]=Li.new({name:T,type:n[T].type,nullable:!0}),A),{length:0,fields:new Array,children:new Array}),b=new ti(l),c=Dr({type:new ls(l),length:v,children:p,nullCount:0});[this.schema,this.data]=Mv(b,c.children,v);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=M1(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(e){return this.data.getValid(e)}get(e){return As.visit(this.data,e)}at(e){return this.get(Ay(e,this.numRows))}set(e,n){return ea.visit(this.data,e,n)}indexOf(e,n){return bp.visit(this.data,e,n)}[Symbol.iterator](){return Dy.visit(new ei([this.data]))}toArray(){return[...this]}concat(...e){return new el(this.schema,[this,...e])}slice(e,n){const[l]=new ei([this.data]).slice(e,n).data;return new zh(this.schema,l)}getChild(e){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(l=>l.name===e))}getChildAt(e){return e>-1&&ep.name===e),n)}setChildAt(e,n){let l=this.schema,p=this.data;if(e>-1&&ec.name===v);~b&&(p[b]=this.data.children[b])}return new zh(n,Dr({type:l,length:this.numRows,children:p}))}selectAt(e){const n=this.schema.selectAt(e),l=e.map(v=>this.data.children[v]).filter(Boolean),p=Dr({type:new ls(n.fields),length:this.numRows,children:l});return new zh(n,p)}};C1=Symbol.toStringTag;Is[C1]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Is.prototype);function Mv(r,e,n=e.reduce((l,p)=>Math.max(l,p.length),0)){var l;const p=[...r.fields],v=[...e],b=(n+63&-64)>>3;for(const[c,A]of r.fields.entries()){const T=e[c];(!T||T.length!==n)&&(p[c]=A.clone({nullable:!0}),v[c]=(l=T==null?void 0:T._changeLengthAndBackfillNullBitmap(n))!==null&&l!==void 0?l:Dr({type:A.type,length:n,nullCount:n,nullBitmap:new Uint8Array(b)}))}return[r.assign(p),Dr({type:new ls(p),length:n,children:v})]}function M1(r,e,n=new Map){var l,p;if(((l=r==null?void 0:r.length)!==null&&l!==void 0?l:0)>0&&(r==null?void 0:r.length)===(e==null?void 0:e.length))for(let v=-1,b=r.length;++vDr({type:p.type})),l=Dr({type:new ls(e.fields),nullCount:0,children:n});super(e,l)}}let $o=class Ca{constructor(){this.bb=null,this.bb_pos=0}__init(e,n){return this.bb_pos=e,this.bb=n,this}static getRootAsMessage(e,n){return(n||new Ca).__init(e.readInt32(e.position())+e.position(),e)}static getSizePrefixedRootAsMessage(e,n){return e.setPosition(e.position()+ri),(n||new Ca).__init(e.readInt32(e.position())+e.position(),e)}version(){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.readInt16(this.bb_pos+e):ln.V1}headerType(){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readUint8(this.bb_pos+e):Zr.NONE}header(e){const n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(e,this.bb_pos+n):null}bodyLength(){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb_pos+e):BigInt("0")}customMetadata(e,n){const l=this.bb.__offset(this.bb_pos,12);return l?(n||new xn).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+l)+e*4),this.bb):null}customMetadataLength(){const e=this.bb.__offset(this.bb_pos,12);return e?this.bb.__vector_len(this.bb_pos+e):0}static startMessage(e){e.startObject(5)}static addVersion(e,n){e.addFieldInt16(0,n,ln.V1)}static addHeaderType(e,n){e.addFieldInt8(1,n,Zr.NONE)}static addHeader(e,n){e.addFieldOffset(2,n,0)}static addBodyLength(e,n){e.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(e,n){e.addFieldOffset(4,n,0)}static createCustomMetadataVector(e,n){e.startVector(4,n.length,4);for(let l=n.length-1;l>=0;l--)e.addOffset(n[l]);return e.endVector()}static startCustomMetadataVector(e,n){e.startVector(4,n,4)}static endMessage(e){return e.endObject()}static finishMessageBuffer(e,n){e.finish(n)}static finishSizePrefixedMessageBuffer(e,n){e.finish(n,void 0,!0)}static createMessage(e,n,l,p,v,b){return Ca.startMessage(e),Ca.addVersion(e,n),Ca.addHeaderType(e,l),Ca.addHeader(e,p),Ca.addBodyLength(e,v),Ca.addCustomMetadata(e,b),Ca.endMessage(e)}};class Uk extends Cr{visit(e,n){return e==null||n==null?void 0:super.visit(e,n)}visitNull(e,n){return xv.startNull(n),xv.endNull(n)}visitInt(e,n){return zs.startInt(n),zs.addBitWidth(n,e.bitWidth),zs.addIsSigned(n,e.isSigned),zs.endInt(n)}visitFloat(e,n){return La.startFloatingPoint(n),La.addPrecision(n,e.precision),La.endFloatingPoint(n)}visitBinary(e,n){return gv.startBinary(n),gv.endBinary(n)}visitLargeBinary(e,n){return _v.startLargeBinary(n),_v.endLargeBinary(n)}visitBool(e,n){return yv.startBool(n),yv.endBool(n)}visitUtf8(e,n){return wv.startUtf8(n),wv.endUtf8(n)}visitLargeUtf8(e,n){return vv.startLargeUtf8(n),vv.endLargeUtf8(n)}visitDecimal(e,n){return Bc.startDecimal(n),Bc.addScale(n,e.scale),Bc.addPrecision(n,e.precision),Bc.addBitWidth(n,e.bitWidth),Bc.endDecimal(n)}visitDate(e,n){return zf.startDate(n),zf.addUnit(n,e.unit),zf.endDate(n)}visitTime(e,n){return Ks.startTime(n),Ks.addUnit(n,e.unit),Ks.addBitWidth(n,e.bitWidth),Ks.endTime(n)}visitTimestamp(e,n){const l=e.timezone&&n.createString(e.timezone)||void 0;return Xs.startTimestamp(n),Xs.addUnit(n,e.unit),l!==void 0&&Xs.addTimezone(n,l),Xs.endTimestamp(n)}visitInterval(e,n){return za.startInterval(n),za.addUnit(n,e.unit),za.endInterval(n)}visitDuration(e,n){return Bf.startDuration(n),Bf.addUnit(n,e.unit),Bf.endDuration(n)}visitList(e,n){return bv.startList(n),bv.endList(n)}visitStruct(e,n){return Pl.startStruct_(n),Pl.endStruct_(n)}visitUnion(e,n){Ss.startTypeIdsVector(n,e.typeIds.length);const l=Ss.createTypeIdsVector(n,e.typeIds);return Ss.startUnion(n),Ss.addMode(n,e.mode),Ss.addTypeIds(n,l),Ss.endUnion(n)}visitDictionary(e,n){const l=this.visit(e.indices,n);return go.startDictionaryEncoding(n),go.addId(n,BigInt(e.id)),go.addIsOrdered(n,e.isOrdered),l!==void 0&&go.addIndexType(n,l),go.endDictionaryEncoding(n)}visitFixedSizeBinary(e,n){return Rf.startFixedSizeBinary(n),Rf.addByteWidth(n,e.byteWidth),Rf.endFixedSizeBinary(n)}visitFixedSizeList(e,n){return Ff.startFixedSizeList(n),Ff.addListSize(n,e.listSize),Ff.endFixedSizeList(n)}visitMap(e,n){return Of.startMap(n),Of.addKeysSorted(n,e.keysSorted),Of.endMap(n)}}const wg=new Uk;function $k(r,e=new Map){return new ti(jk(r,e),$f(r.metadata),e)}function D1(r){return new Fs(r.count,P1(r.columns),L1(r.columns))}function Vk(r){return new Va(D1(r.data),r.id,r.isDelta)}function jk(r,e){return(r.fields||[]).filter(Boolean).map(n=>Li.fromJSON(n,e))}function Dv(r,e){return(r.children||[]).filter(Boolean).map(n=>Li.fromJSON(n,e))}function P1(r){return(r||[]).reduce((e,n)=>[...e,new tl(n.count,qk(n.VALIDITY)),...P1(n.children)],[])}function L1(r,e=[]){for(let n=-1,l=(r||[]).length;++ne+ +(n===0),0)}function Gk(r,e){let n,l,p,v,b,c;return!e||!(v=r.dictionary)?(b=Lv(r,Dv(r,e)),p=new Li(r.name,b,r.nullable,$f(r.metadata))):e.has(n=v.id)?(l=(l=v.indexType)?Pv(l):new Gh,c=new tu(e.get(n),l,n,v.isOrdered),p=new Li(r.name,c,r.nullable,$f(r.metadata))):(l=(l=v.indexType)?Pv(l):new Gh,e.set(n,b=Lv(r,Dv(r,e))),c=new tu(b,l,n,v.isOrdered),p=new Li(r.name,c,r.nullable,$f(r.metadata))),p||null}function $f(r=[]){return new Map(r.map(({key:e,value:n})=>[e,n]))}function Pv(r){return new Ul(r.isSigned,r.bitWidth)}function Lv(r,e){const n=r.type.name;switch(n){case"NONE":return new Xo;case"null":return new Xo;case"binary":return new tp;case"largebinary":return new rp;case"utf8":return new ip;case"largeutf8":return new np;case"bool":return new sp;case"list":return new dp((e||[])[0]);case"struct":return new ls(e||[]);case"struct_":return new ls(e||[])}switch(n){case"int":{const l=r.type;return new Ul(l.isSigned,l.bitWidth)}case"floatingpoint":{const l=r.type;return new ep(Yn[l.precision])}case"decimal":{const l=r.type;return new ap(l.scale,l.precision,l.bitWidth)}case"date":{const l=r.type;return new op(Qs[l.unit])}case"time":{const l=r.type;return new lp(Jt[l.unit],l.bitWidth)}case"timestamp":{const l=r.type;return new cp(Jt[l.unit],l.timezone)}case"interval":{const l=r.type;return new up($a[l.unit])}case"duration":{const l=r.type;return new hp(Jt[l.unit])}case"union":{const l=r.type,[p,...v]=(l.mode+"").toLowerCase(),b=p.toUpperCase()+v.join("");return new fp(Kn[b],l.typeIds||[],e||[])}case"fixedsizebinary":{const l=r.type;return new pp(l.byteWidth)}case"fixedsizelist":{const l=r.type;return new mp(l.listSize,(e||[])[0])}case"map":{const l=r.type;return new gp((e||[])[0],l.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var Zk=Yb,Wk=Qc;class cs{static fromJSON(e,n){const l=new cs(0,ln.V5,n);return l._createHeader=Hk(e,n),l}static decode(e){e=new Wk(Nr(e));const n=$o.getRootAsMessage(e),l=n.bodyLength(),p=n.version(),v=n.headerType(),b=new cs(l,p,v);return b._createHeader=Yk(n,v),b}static encode(e){const n=new Zk;let l=-1;return e.isSchema()?l=ti.encode(n,e.header()):e.isRecordBatch()?l=Fs.encode(n,e.header()):e.isDictionaryBatch()&&(l=Va.encode(n,e.header())),$o.startMessage(n),$o.addVersion(n,ln.V5),$o.addHeader(n,l),$o.addHeaderType(n,e.headerType),$o.addBodyLength(n,BigInt(e.bodyLength)),$o.finishMessageBuffer(n,$o.endMessage(n)),n.asUint8Array()}static from(e,n=0){if(e instanceof ti)return new cs(0,ln.V5,Zr.Schema,e);if(e instanceof Fs)return new cs(n,ln.V5,Zr.RecordBatch,e);if(e instanceof Va)return new cs(n,ln.V5,Zr.DictionaryBatch,e);throw new Error(`Unrecognized Message header: ${e}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Zr.Schema}isRecordBatch(){return this.headerType===Zr.RecordBatch}isDictionaryBatch(){return this.headerType===Zr.DictionaryBatch}constructor(e,n,l,p){this._version=n,this._headerType=l,this.body=new Uint8Array(0),p&&(this._createHeader=()=>p),this._bodyLength=yi(e)}}class Fs{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(e,n,l){this._nodes=n,this._buffers=l,this._length=yi(e)}}class Va{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(e,n,l=!1){this._data=e,this._isDelta=l,this._id=yi(n)}}class Ra{constructor(e,n){this.offset=yi(e),this.length=yi(n)}}class tl{constructor(e,n){this.length=yi(e),this.nullCount=yi(n)}}function Hk(r,e){return()=>{switch(e){case Zr.Schema:return ti.fromJSON(r);case Zr.RecordBatch:return Fs.fromJSON(r);case Zr.DictionaryBatch:return Va.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Zr[e]}, type: ${e} }`)}}function Yk(r,e){return()=>{switch(e){case Zr.Schema:return ti.decode(r.header(new Ma),new Map,r.version());case Zr.RecordBatch:return Fs.decode(r.header(new uo),r.version());case Zr.DictionaryBatch:return Va.decode(r.header(new Lc),r.version())}throw new Error(`Unrecognized Message type: { name: ${Zr[e]}, type: ${e} }`)}}Li.encode=aA;Li.decode=nA;Li.fromJSON=Gk;ti.encode=sA;ti.decode=Kk;ti.fromJSON=$k;Fs.encode=oA;Fs.decode=Xk;Fs.fromJSON=D1;Va.encode=lA;Va.decode=Jk;Va.fromJSON=Vk;tl.encode=cA;tl.decode=eA;Ra.encode=uA;Ra.decode=Qk;function Kk(r,e=new Map,n=ln.V5){const l=iA(r,e);return new ti(l,Vf(r),e,n)}function Xk(r,e=ln.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Fs(r.length(),tA(r),rA(r,e))}function Jk(r,e=ln.V5){return new Va(Fs.decode(r.data(),e),r.id(),r.isDelta())}function Qk(r){return new Ra(r.offset(),r.length())}function eA(r){return new tl(r.length(),r.nullCount())}function tA(r){const e=[];for(let n,l=-1,p=-1,v=r.nodesLength();++lLi.encode(r,v));Ma.startFieldsVector(r,n.length);const l=Ma.createFieldsVector(r,n),p=e.metadata&&e.metadata.size>0?Ma.createCustomMetadataVector(r,[...e.metadata].map(([v,b])=>{const c=r.createString(`${v}`),A=r.createString(`${b}`);return xn.startKeyValue(r),xn.addKey(r,c),xn.addValue(r,A),xn.endKeyValue(r)})):-1;return Ma.startSchema(r),Ma.addFields(r,l),Ma.addEndianness(r,hA?eu.Little:eu.Big),p!==-1&&Ma.addCustomMetadata(r,p),Ma.endSchema(r)}function aA(r,e){let n=-1,l=-1,p=-1;const v=e.type;let b=e.typeId;Vt.isDictionary(v)?(b=v.dictionary.typeId,p=wg.visit(v,r),l=wg.visit(v.dictionary,r)):l=wg.visit(v,r);const c=(v.children||[]).map(z=>Li.encode(r,z)),A=Ws.createChildrenVector(r,c),T=e.metadata&&e.metadata.size>0?Ws.createCustomMetadataVector(r,[...e.metadata].map(([z,B])=>{const U=r.createString(`${z}`),j=r.createString(`${B}`);return xn.startKeyValue(r),xn.addKey(r,U),xn.addValue(r,j),xn.endKeyValue(r)})):-1;return e.name&&(n=r.createString(e.name)),Ws.startField(r),Ws.addType(r,l),Ws.addTypeType(r,b),Ws.addChildren(r,A),Ws.addNullable(r,!!e.nullable),n!==-1&&Ws.addName(r,n),p!==-1&&Ws.addDictionary(r,p),T!==-1&&Ws.addCustomMetadata(r,T),Ws.endField(r)}function oA(r,e){const n=e.nodes||[],l=e.buffers||[];uo.startNodesVector(r,n.length);for(const b of n.slice().reverse())tl.encode(r,b);const p=r.endVector();uo.startBuffersVector(r,l.length);for(const b of l.slice().reverse())Ra.encode(r,b);const v=r.endVector();return uo.startRecordBatch(r),uo.addLength(r,BigInt(e.length)),uo.addNodes(r,p),uo.addBuffers(r,v),uo.endRecordBatch(r)}function lA(r,e){const n=Fs.encode(r,e.data);return Lc.startDictionaryBatch(r),Lc.addId(r,BigInt(e.id)),Lc.addIsDelta(r,e.isDelta),Lc.addData(r,n),Lc.endDictionaryBatch(r)}function cA(r,e){return Jb.createFieldNode(r,BigInt(e.length),BigInt(e.nullCount))}function uA(r,e){return Xb.createBuffer(r,BigInt(e.offset),BigInt(e.length))}const hA=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),Oy=r=>`Expected ${Zr[r]} Message in stream, but was null or length 0.`,Ny=r=>`Header pointer of flatbuffer-encoded ${Zr[r]} Message is null or length 0.`,z1=(r,e)=>`Expected to read ${r} metadata bytes, but only read ${e}.`,B1=(r,e)=>`Expected to read ${r} bytes for message body, but only read ${e}.`;class R1{constructor(e){this.source=e instanceof wp?e:new wp(e)}[Symbol.iterator](){return this}next(){let e;return(e=this.readMetadataLength()).done||e.value===-1&&(e=this.readMetadataLength()).done||(e=this.readMetadata(e.value)).done?Wi:e}throw(e){return this.source.throw(e)}return(e){return this.source.return(e)}readMessage(e){let n;if((n=this.next()).done)return null;if(e!=null&&n.value.headerType!==e)throw new Error(Oy(e));return n.value}readMessageBody(e){if(e<=0)return new Uint8Array(0);const n=Nr(this.source.read(e));if(n.byteLength[...p,...v.VALIDITY&&[v.VALIDITY]||[],...v.TYPE_ID&&[v.TYPE_ID]||[],...v.OFFSET&&[v.OFFSET]||[],...v.DATA&&[v.DATA]||[],...n(v.children)],[])}}readMessage(e){let n;if((n=this.next()).done)return null;if(e!=null&&n.value.headerType!==e)throw new Error(Oy(e));return n.value}readSchema(){const e=Zr.Schema,n=this.readMessage(e),l=n==null?void 0:n.header();if(!n||!l)throw new Error(Ny(e));return l}}const Qp=4,Jg="ARROW1",Wh=new Uint8Array(Jg.length);for(let r=0;rthis):this}readRecordBatch(e){return this._impl.isFile()?this._impl.readRecordBatch(e):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Ys.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Ys.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,n){throw new Error('"throughDOM" not available in this environment')}static from(e){return e instanceof Js?e:Vg(e)?_A(e):jb(e)?xA(e):Nl(e)?ur(this,void 0,void 0,function*(){return yield Js.from(yield e)}):qb(e)||xy(e)||Gb(e)||cu(e)?bA(new ru(e)):vA(new wp(e))}static readAll(e){return e instanceof Js?e.isSync()?Fv(e):Ov(e):Vg(e)||ArrayBuffer.isView(e)||Qh(e)||Vb(e)?Fv(e):Ov(e)}}class Ip extends Js{constructor(e){super(e),this._impl=e}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ba(this,arguments,function*(){yield Sr(yield*Lf(zl(this[Symbol.iterator]())))})}}class Tp extends Js{constructor(e){super(e),this._impl=e}readAll(){return ur(this,void 0,void 0,function*(){var e,n,l,p;const v=new Array;try{for(var b=!0,c=zl(this),A;A=yield c.next(),e=A.done,!e;b=!0){p=A.value,b=!1;const T=p;v.push(T)}}catch(T){n={error:T}}finally{try{!b&&!e&&(l=c.return)&&(yield l.call(c))}finally{if(n)throw n.error}}return v})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class O1 extends Ip{constructor(e){super(e),this._impl=e}}class mA extends Tp{constructor(e){super(e),this._impl=e}}class N1{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(e=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=e}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(e){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=e,this.dictionaries=new Map,this}_loadRecordBatch(e,n){const l=this._loadVectors(e,n,this.schema.fields),p=Dr({type:new ls(this.schema.fields),length:e.length,children:l});return new Is(this.schema,p)}_loadDictionaryBatch(e,n){const{id:l,isDelta:p}=e,{dictionaries:v,schema:b}=this,c=v.get(l),A=b.dictionaries.get(l),T=this._loadVectors(e.data,n,[A]);return(c&&p?c.concat(new ei(T)):new ei(T)).memoize()}_loadVectors(e,n,l){return new A1(n,e.nodes,e.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(l)}}class kp extends N1{constructor(e,n){super(n),this._reader=Vg(e)?new fA(this._handle=e):new R1(this._handle=e)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(e){return this.closed||(this.autoDestroy=$1(this,e),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(e):Wi}return(e){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(e):Wi}next(){if(this.closed)return Wi;let e;const{_reader:n}=this;for(;e=this._readNextMessageAndValidate();)if(e.isSchema())this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const l=e.header(),p=n.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(l,p)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const l=e.header(),p=n.readMessageBody(e.bodyLength),v=this._loadDictionaryBatch(l,p);this.dictionaries.set(l.id,v)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fy(this.schema)}):this.return()}_readNextMessageAndValidate(e){return this._reader.readMessage(e)}}class Ap extends N1{constructor(e,n){super(n),this._reader=new dA(this._handle=e)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return ur(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(e){return ur(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=$1(this,e),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(e){return ur(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(e):Wi})}return(e){return ur(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(e):Wi})}next(){return ur(this,void 0,void 0,function*(){if(this.closed)return Wi;let e;const{_reader:n}=this;for(;e=yield this._readNextMessageAndValidate();)if(e.isSchema())yield this.reset(e.header());else if(e.isRecordBatch()){this._recordBatchIndex++;const l=e.header(),p=yield n.readMessageBody(e.bodyLength);return{done:!1,value:this._loadRecordBatch(l,p)}}else if(e.isDictionaryBatch()){this._dictionaryIndex++;const l=e.header(),p=yield n.readMessageBody(e.bodyLength),v=this._loadDictionaryBatch(l,p);this.dictionaries.set(l.id,v)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new Fy(this.schema)}):yield this.return()})}_readNextMessageAndValidate(e){return ur(this,void 0,void 0,function*(){return yield this._reader.readMessage(e)})}}class U1 extends kp{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(e,n){super(e instanceof Cv?e:new Cv(e),n)}isSync(){return!0}isFile(){return!0}open(e){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(e)}readRecordBatch(e){var n;if(this.closed)return null;this._footer||this.open();const l=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(e);if(l&&this._handle.seek(l.offset)){const p=this._reader.readMessage(Zr.RecordBatch);if(p!=null&&p.isRecordBatch()){const v=p.header(),b=this._reader.readMessageBody(p.bodyLength);return this._loadRecordBatch(v,b)}}return null}_readDictionaryBatch(e){var n;const l=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(e);if(l&&this._handle.seek(l.offset)){const p=this._reader.readMessage(Zr.DictionaryBatch);if(p!=null&&p.isDictionaryBatch()){const v=p.header(),b=this._reader.readMessageBody(p.bodyLength),c=this._loadDictionaryBatch(v,b);this.dictionaries.set(v.id,c)}}}_readFooter(){const{_handle:e}=this,n=e.size-F1,l=e.readInt32(n),p=e.readAt(n-l,l);return Zh.decode(p)}_readNextMessageAndValidate(e){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return ur(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const l of this._footer.dictionaryBatches())l&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,e)})}readRecordBatch(e){return ur(this,void 0,void 0,function*(){var n;if(this.closed)return null;this._footer||(yield this.open());const l=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(e);if(l&&(yield this._handle.seek(l.offset))){const p=yield this._reader.readMessage(Zr.RecordBatch);if(p!=null&&p.isRecordBatch()){const v=p.header(),b=yield this._reader.readMessageBody(p.bodyLength);return this._loadRecordBatch(v,b)}}return null})}_readDictionaryBatch(e){return ur(this,void 0,void 0,function*(){var n;const l=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(e);if(l&&(yield this._handle.seek(l.offset))){const p=yield this._reader.readMessage(Zr.DictionaryBatch);if(p!=null&&p.isDictionaryBatch()){const v=p.header(),b=yield this._reader.readMessageBody(p.bodyLength),c=this._loadDictionaryBatch(v,b);this.dictionaries.set(v.id,c)}}})}_readFooter(){return ur(this,void 0,void 0,function*(){const{_handle:e}=this;e._pending&&(yield e._pending);const n=e.size-F1,l=yield e.readInt32(n),p=yield e.readAt(n-l,l);return Zh.decode(p)})}_readNextMessageAndValidate(e){return ur(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?Uy(e)?new O1(new U1(r.read())):new Ip(new kp(r)):new Ip(new kp(function*(){}()))}function bA(r){return ur(this,void 0,void 0,function*(){const e=yield r.peek(id+7&-8);return e&&e.byteLength>=4?Uy(e)?new O1(new U1(yield r.read())):new Tp(new Ap(r)):new Tp(new Ap(function(){return Ba(this,arguments,function*(){})}()))})}function xA(r){return ur(this,void 0,void 0,function*(){const{size:e}=yield r.stat(),n=new Sp(r,e);return e>=pA&&Uy(yield n.readAt(0,id+7&-8))?new mA(new gA(n)):new Tp(new Ap(n))})}class Hi extends Cr{static assemble(...e){const n=p=>p.flatMap(v=>Array.isArray(v)?n(v):v instanceof Is?v.data.children:v.data),l=new Hi;return l.visitMany(n(e)),l}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(e){if(e instanceof ei)return this.visitMany(e.data),this;const{type:n}=e;if(!Vt.isDictionary(n)){const{length:l}=e;if(l>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(Vt.isUnion(n))this.nodes.push(new tl(l,0));else{const{nullCount:p}=e;Vt.isNull(n)||ma.call(this,p<=0?new Uint8Array(0):yp(e.offset,l,e.nullBitmap)),this.nodes.push(new tl(l,p))}}return super.visit(e)}visitNull(e){return this}visitDictionary(e){return this.visit(e.clone(e.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function ma(r){const e=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Ra(this._byteLength,e)),this._byteLength+=e,this}function wA(r){var e;const{type:n,length:l,typeIds:p,valueOffsets:v}=r;if(ma.call(this,p),n.mode===Kn.Sparse)return Qg.call(this,r);if(n.mode===Kn.Dense){if(r.offset<=0)return ma.call(this,v),Qg.call(this,r);{const b=new Int32Array(l),c=Object.create(null),A=Object.create(null);for(let T,z,B=-1;++B{const B=n.typeIds[z],U=c[B],j=A[B];return T.slice(U,Math.min(l,j))}))}}return this}function SA(r){let e;return r.nullCount>=r.length?ma.call(this,new Uint8Array(0)):(e=r.values)instanceof Uint8Array?ma.call(this,yp(r.offset,r.length,e)):ma.call(this,_p(r.values))}function bo(r){return ma.call(this,r.values.subarray(0,r.length*r.stride))}function em(r){const{length:e,values:n,valueOffsets:l}=r,p=yi(l[0]),v=yi(l[e]),b=Math.min(v-p,n.byteLength-p);return ma.call(this,Wb(-p,e+1,l)),ma.call(this,n.subarray(p,p+b)),this}function $y(r){const{length:e,valueOffsets:n}=r;if(n){const{[0]:l,[e]:p}=n;return ma.call(this,Wb(-l,e+1,n)),this.visit(r.children[0].slice(l,p-l))}return this.visit(r.children[0])}function Qg(r){return this.visitMany(r.type.children.map((e,n)=>r.children[n]).filter(Boolean))[0]}Hi.prototype.visitBool=SA;Hi.prototype.visitInt=bo;Hi.prototype.visitFloat=bo;Hi.prototype.visitUtf8=em;Hi.prototype.visitLargeUtf8=em;Hi.prototype.visitBinary=em;Hi.prototype.visitLargeBinary=em;Hi.prototype.visitFixedSizeBinary=bo;Hi.prototype.visitDate=bo;Hi.prototype.visitTimestamp=bo;Hi.prototype.visitTime=bo;Hi.prototype.visitDecimal=bo;Hi.prototype.visitList=$y;Hi.prototype.visitStruct=Qg;Hi.prototype.visitUnion=wA;Hi.prototype.visitInterval=bo;Hi.prototype.visitDuration=bo;Hi.prototype.visitFixedSizeList=$y;Hi.prototype.visitMap=$y;class V1 extends Py{static throughNode(e){throw new Error('"throughNode" not available in this environment')}static throughDOM(e,n){throw new Error('"throughDOM" not available in this environment')}constructor(e){super(),this._position=0,this._started=!1,this._sink=new Uf,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,ks(e)||(e={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof e.autoDestroy=="boolean"?e.autoDestroy:!0,this._writeLegacyIpcFormat=typeof e.writeLegacyIpcFormat=="boolean"?e.writeLegacyIpcFormat:!1}toString(e=!1){return this._sink.toString(e)}toUint8Array(e=!1){return this._sink.toUint8Array(e)}writeAll(e){return Nl(e)?e.then(n=>this.writeAll(n)):cu(e)?Gy(this,e):qy(this,e)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(e){return this._sink.toDOMStream(e)}toNodeStream(e){return this._sink.toNodeStream(e)}close(){return this.reset()._sink.close()}abort(e){return this.reset()._sink.abort(e)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(e=this._sink,n=null){return e===this._sink||e instanceof Uf?this._sink=e:(this._sink=new Uf,e&&eT(e)?this.toDOMStream({type:"bytes"}).pipeTo(e):e&&tT(e)&&this.toNodeStream({objectMode:!1}).pipe(e)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!n||!Xg(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(e){let n=null;if(this._sink){if(e==null)return this.finish()&&void 0;if(e instanceof el&&!(n=e.schema))return this.finish()&&void 0;if(e instanceof Is&&!(n=e.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!Xg(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}e instanceof Is?e instanceof Fy||this._writeRecordBatch(e):e instanceof el?this.writeAll(e.batches):Qh(e)&&this.writeAll(e)}_writeMessage(e,n=8){const l=n-1,p=cs.encode(e),v=p.byteLength,b=this._writeLegacyIpcFormat?4:8,c=v+b+l&~l,A=c-v-b;return e.headerType===Zr.RecordBatch?this._recordBatchBlocks.push(new Jo(c,e.bodyLength,this._position)):e.headerType===Zr.DictionaryBatch&&this._dictionaryBlocks.push(new Jo(c,e.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-b)),v>0&&this._write(p),this._writePadding(A)}_write(e){if(this._started){const n=Nr(e);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(e){return this._writeMessage(cs.from(e))}_writeFooter(e){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Wh)}_writePadding(e){return e>0?this._write(new Uint8Array(e)):this}_writeRecordBatch(e){const{byteLength:n,nodes:l,bufferRegions:p,buffers:v}=Hi.assemble(e),b=new Fs(e.numRows,l,p),c=cs.from(b,n);return this._writeDictionaries(e)._writeMessage(c)._writeBodyBuffers(v)}_writeDictionaryBatch(e,n,l=!1){const{byteLength:p,nodes:v,bufferRegions:b,buffers:c}=Hi.assemble(new ei([e])),A=new Fs(e.length,v,b),T=new Va(A,n,l),z=cs.from(T,p);return this._writeMessage(z)._writeBodyBuffers(c)}_writeBodyBuffers(e){let n,l,p;for(let v=-1,b=e.length;++v0&&(this._write(n),(p=(l+7&-8)-l)>0&&this._writePadding(p));return this}_writeDictionaries(e){var n,l;for(const[p,v]of e.dictionaries){const b=(n=v==null?void 0:v.data)!==null&&n!==void 0?n:[],c=this._seenDictionaries.get(p),A=(l=this._dictionaryDeltaOffsets.get(p))!==null&&l!==void 0?l:0;if(!c||c.data[0]!==b[0])for(const[T,z]of b.entries())this._writeDictionaryBatch(z,p,T>0);else if(Al.writeAll(p)):cu(e)?Gy(l,e):qy(l,e)}}class jy extends V1{static writeAll(e){const n=new jy;return Nl(e)?e.then(l=>n.writeAll(l)):cu(e)?Gy(n,e):qy(n,e)}constructor(){super(),this._autoDestroy=!0}_writeSchema(e){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(e,n,l=!1){if(!l&&this._seenDictionaries.has(n))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(e,n,l)}_writeFooter(e){const n=Zh.encode(new Zh(e,ln.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(e)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function qy(r,e){let n=e;e instanceof el&&(n=e.batches,r.reset(void 0,e.schema));for(const l of n)r.write(l);return r.finish()}function Gy(r,e){return ur(this,void 0,void 0,function*(){var n,l,p,v,b,c,A;try{for(n=!0,l=zl(e);p=yield l.next(),v=p.done,!v;n=!0){A=p.value,n=!1;const T=A;r.write(T)}}catch(T){b={error:T}}finally{try{!n&&!v&&(c=l.return)&&(yield c.call(l))}finally{if(b)throw b.error}}return r.finish()})}function IA(r,e="stream"){return(e==="stream"?Vy:jy).writeAll(r).toUint8Array(!0)}var TA=Object.create,j1=Object.defineProperty,kA=Object.getOwnPropertyDescriptor,AA=Object.getOwnPropertyNames,EA=Object.getPrototypeOf,CA=Object.prototype.hasOwnProperty,MA=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),DA=(r,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let p of AA(e))!CA.call(r,p)&&p!==n&&j1(r,p,{get:()=>e[p],enumerable:!(l=kA(e,p))||l.enumerable});return r},PA=(r,e,n)=>(n=r!=null?TA(EA(r)):{},DA(!r||!r.__esModule?j1(n,"default",{value:r,enumerable:!0}):n,r)),LA=MA((r,e)=>{e.exports=Worker}),zA=(r=>(r[r.UNDEFINED=0]="UNDEFINED",r[r.AUTOMATIC=1]="AUTOMATIC",r[r.READ_ONLY=2]="READ_ONLY",r[r.READ_WRITE=3]="READ_WRITE",r))(zA||{}),BA=(r=>(r[r.IDENTIFIER=0]="IDENTIFIER",r[r.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",r[r.STRING_CONSTANT=2]="STRING_CONSTANT",r[r.OPERATOR=3]="OPERATOR",r[r.KEYWORD=4]="KEYWORD",r[r.COMMENT=5]="COMMENT",r))(BA||{}),RA=(r=>(r[r.NONE=0]="NONE",r[r.DEBUG=1]="DEBUG",r[r.INFO=2]="INFO",r[r.WARNING=3]="WARNING",r[r.ERROR=4]="ERROR",r))(RA||{}),FA=(r=>(r[r.NONE=0]="NONE",r[r.CONNECT=1]="CONNECT",r[r.DISCONNECT=2]="DISCONNECT",r[r.OPEN=3]="OPEN",r[r.QUERY=4]="QUERY",r[r.INSTANTIATE=5]="INSTANTIATE",r))(FA||{}),OA=(r=>(r[r.NONE=0]="NONE",r[r.OK=1]="OK",r[r.ERROR=2]="ERROR",r[r.START=3]="START",r[r.RUN=4]="RUN",r[r.CAPTURE=5]="CAPTURE",r))(OA||{}),NA=(r=>(r[r.NONE=0]="NONE",r[r.WEB_WORKER=1]="WEB_WORKER",r[r.NODE_WORKER=2]="NODE_WORKER",r[r.BINDINGS=3]="BINDINGS",r[r.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",r))(NA||{}),UA=class{constructor(r=2){this.level=r}log(r){r.level>=this.level&&console.log(r)}},$A=(r=>(r[r.SUCCESS=0]="SUCCESS",r))($A||{}),VA=class{constructor(r,e){this._bindings=r,this._conn=e}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(r){return r(this._bindings,this._conn)}async query(r){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let e=await this._bindings.runQuery(this._conn,r),n=Js.from(e);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new el(n)}async send(r){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:r});let e=await this._bindings.startPendingQuery(this._conn,r);for(;e==null;)e=await this._bindings.pollPendingQuery(this._conn);let n=new q1(this._bindings,this._conn,e),l=await Js.from(n);return console.assert(l.isAsync()),console.assert(l.isStream()),l}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(r){return await this._bindings.getTableNames(this._conn,r)}async prepare(r){let e=await this._bindings.createPrepared(this._conn,r);return new jA(this._bindings,this._conn,e)}async insertArrowTable(r,e){let n=IA(r,"stream");await this.insertArrowFromIPCStream(n,e)}async insertArrowFromIPCStream(r,e){await this._bindings.insertArrowFromIPCStream(this._conn,r,e)}async insertCSVFromPath(r,e){await this._bindings.insertCSVFromPath(this._conn,r,e)}async insertJSONFromPath(r,e){await this._bindings.insertJSONFromPath(this._conn,r,e)}},q1=class{constructor(r,e,n){this.db=r,this.conn=e,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let r;return this._inFlight!=null?(r=await this._inFlight,this._inFlight=null):r=await this.db.fetchQueryResults(this.conn),this._depleted=r.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:r}}[Symbol.asyncIterator](){return this}},jA=class{constructor(r,e,n){this.bindings=r,this.connectionId=e,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...r){let e=await this.bindings.runPrepared(this.connectionId,this.statementId,r),n=Js.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new el(n)}async send(...r){let e=await this.bindings.sendPrepared(this.connectionId,this.statementId,r),n=new q1(this.bindings,this.connectionId,e),l=await Js.from(n);return console.assert(l.isAsync()),console.assert(l.isStream()),l}},qA=(r=>(r.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",r.CLOSE_PREPARED="CLOSE_PREPARED",r.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",r.CONNECT="CONNECT",r.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",r.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",r.CREATE_PREPARED="CREATE_PREPARED",r.DISCONNECT="DISCONNECT",r.DROP_FILE="DROP_FILE",r.DROP_FILES="DROP_FILES",r.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",r.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",r.FLUSH_FILES="FLUSH_FILES",r.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",r.GET_TABLE_NAMES="GET_TABLE_NAMES",r.GET_VERSION="GET_VERSION",r.GLOB_FILE_INFOS="GLOB_FILE_INFOS",r.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",r.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",r.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",r.INSTANTIATE="INSTANTIATE",r.OPEN="OPEN",r.PING="PING",r.POLL_PENDING_QUERY="POLL_PENDING_QUERY",r.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",r.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",r.REGISTER_FILE_URL="REGISTER_FILE_URL",r.RESET="RESET",r.RUN_PREPARED="RUN_PREPARED",r.RUN_QUERY="RUN_QUERY",r.SEND_PREPARED="SEND_PREPARED",r.START_PENDING_QUERY="START_PENDING_QUERY",r.TOKENIZE="TOKENIZE",r))(qA||{}),GA=(r=>(r.CONNECTION_INFO="CONNECTION_INFO",r.ERROR="ERROR",r.FEATURE_FLAGS="FEATURE_FLAGS",r.FILE_BUFFER="FILE_BUFFER",r.FILE_INFOS="FILE_INFOS",r.FILE_SIZE="FILE_SIZE",r.FILE_STATISTICS="FILE_STATISTICS",r.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",r.LOG="LOG",r.OK="OK",r.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",r.QUERY_PLAN="QUERY_PLAN",r.QUERY_RESULT="QUERY_RESULT",r.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",r.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",r.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",r.REGISTERED_FILE="REGISTERED_FILE",r.SCRIPT_TOKENS="SCRIPT_TOKENS",r.SUCCESS="SUCCESS",r.TABLE_NAMES="TABLE_NAMES",r.VERSION_STRING="VERSION_STRING",r))(GA||{}),jr=class{constructor(r,e){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=r,this.data=e,this.promise=new Promise((n,l)=>{this.promiseResolver=n,this.promiseRejecter=l})}};function jf(r){switch(r.typeId){case ce.Binary:return{sqlType:"binary"};case ce.Bool:return{sqlType:"bool"};case ce.Date:return{sqlType:"date"};case ce.DateDay:return{sqlType:"date32[d]"};case ce.DateMillisecond:return{sqlType:"date64[ms]"};case ce.Decimal:{let e=r;return{sqlType:"decimal",precision:e.precision,scale:e.scale}}case ce.Float:return{sqlType:"float"};case ce.Float16:return{sqlType:"float16"};case ce.Float32:return{sqlType:"float32"};case ce.Float64:return{sqlType:"float64"};case ce.Int:return{sqlType:"int32"};case ce.Int16:return{sqlType:"int16"};case ce.Int32:return{sqlType:"int32"};case ce.Int64:return{sqlType:"int64"};case ce.Uint16:return{sqlType:"uint16"};case ce.Uint32:return{sqlType:"uint32"};case ce.Uint64:return{sqlType:"uint64"};case ce.Uint8:return{sqlType:"uint8"};case ce.IntervalDayTime:return{sqlType:"interval[dt]"};case ce.IntervalYearMonth:return{sqlType:"interval[m]"};case ce.List:return{sqlType:"list",valueType:jf(r.valueType)};case ce.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case ce.Null:return{sqlType:"null"};case ce.Utf8:return{sqlType:"utf8"};case ce.Struct:return{sqlType:"struct",fields:r.children.map(e=>ey(e.name,e.type))};case ce.Map:{let e=r;return{sqlType:"map",keyType:jf(e.keyType),valueType:jf(e.valueType)}}case ce.Time:return{sqlType:"time[s]"};case ce.TimeMicrosecond:return{sqlType:"time[us]"};case ce.TimeMillisecond:return{sqlType:"time[ms]"};case ce.TimeNanosecond:return{sqlType:"time[ns]"};case ce.TimeSecond:return{sqlType:"time[s]"};case ce.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case ce.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case ce.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case ce.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case ce.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function ey(r,e){let n=jf(e);return n.name=r,n}var ZA=new TextEncoder,WA=class{constructor(r,e=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=r,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),e!=null&&this.attach(e)}get logger(){return this._logger}attach(r){this._worker=r,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((e,n)=>{this._workerShutdownResolver=e})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(r,e=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,r),this._worker.postMessage({messageId:n,type:r.type,data:r.data},e),await r.promise}onMessage(r){var e;let n=r.data;switch(n.type){case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let p of this._onInstantiationProgress)p(n.data);return}}let l=this._pendingRequests.get(n.requestId);if(!l){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let p=new Error(n.data.message);p.name=n.data.name,(e=Object.getOwnPropertyDescriptor(p,"stack"))!=null&&e.writable&&(p.stack=n.data.stack),l.promiseRejecter(p);return}switch(l.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){l.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){l.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){l.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){l.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){l.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){l.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){l.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){l.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){l.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){l.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){l.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){l.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){l.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){l.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){l.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){l.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){l.promiseResolver(n.data);return}break}l.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(r){console.error(r),console.error("error in duckdb worker: ".concat(r.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let r=new jr("RESET",null);return await this.postTask(r)}async ping(){let r=new jr("PING",null);await this.postTask(r)}async dropFile(r){let e=new jr("DROP_FILE",r);return await this.postTask(e)}async dropFiles(){let r=new jr("DROP_FILES",null);return await this.postTask(r)}async flushFiles(){let r=new jr("FLUSH_FILES",null);return await this.postTask(r)}async instantiate(r,e=null,n=l=>{}){this._onInstantiationProgress.push(n);let l=new jr("INSTANTIATE",[r,e]);return await this.postTask(l)}async getVersion(){let r=new jr("GET_VERSION",null);return await this.postTask(r)}async getFeatureFlags(){let r=new jr("GET_FEATURE_FLAGS",null);return await this.postTask(r)}async open(r){let e=new jr("OPEN",r);await this.postTask(e)}async tokenize(r){let e=new jr("TOKENIZE",r);return await this.postTask(e)}async connectInternal(){let r=new jr("CONNECT",null);return await this.postTask(r)}async connect(){let r=await this.connectInternal();return new VA(this,r)}async disconnect(r){let e=new jr("DISCONNECT",r);await this.postTask(e)}async runQuery(r,e){let n=new jr("RUN_QUERY",[r,e]);return await this.postTask(n)}async startPendingQuery(r,e){let n=new jr("START_PENDING_QUERY",[r,e]);return await this.postTask(n)}async pollPendingQuery(r){let e=new jr("POLL_PENDING_QUERY",r);return await this.postTask(e)}async cancelPendingQuery(r){let e=new jr("CANCEL_PENDING_QUERY",r);return await this.postTask(e)}async fetchQueryResults(r){let e=new jr("FETCH_QUERY_RESULTS",r);return await this.postTask(e)}async getTableNames(r,e){let n=new jr("GET_TABLE_NAMES",[r,e]);return await this.postTask(n)}async createPrepared(r,e){let n=new jr("CREATE_PREPARED",[r,e]);return await this.postTask(n)}async closePrepared(r,e){let n=new jr("CLOSE_PREPARED",[r,e]);await this.postTask(n)}async runPrepared(r,e,n){let l=new jr("RUN_PREPARED",[r,e,n]);return await this.postTask(l)}async sendPrepared(r,e,n){let l=new jr("SEND_PREPARED",[r,e,n]);return await this.postTask(l)}async globFiles(r){let e=new jr("GLOB_FILE_INFOS",r);return await this.postTask(e)}async registerFileText(r,e){let n=ZA.encode(e);await this.registerFileBuffer(r,n)}async registerFileURL(r,e,n,l){e===void 0&&(e=r);let p=new jr("REGISTER_FILE_URL",[r,e,n,l]);await this.postTask(p)}async registerEmptyFileBuffer(r){}async registerFileBuffer(r,e){let n=new jr("REGISTER_FILE_BUFFER",[r,e]);await this.postTask(n,[e.buffer])}async registerFileHandle(r,e,n,l){let p=new jr("REGISTER_FILE_HANDLE",[r,e,n,l]);await this.postTask(p,[])}async collectFileStatistics(r,e){let n=new jr("COLLECT_FILE_STATISTICS",[r,e]);await this.postTask(n,[])}async exportFileStatistics(r){let e=new jr("EXPORT_FILE_STATISTICS",r);return await this.postTask(e,[])}async copyFileToBuffer(r){let e=new jr("COPY_FILE_TO_BUFFER",r);return await this.postTask(e)}async copyFileToPath(r,e){let n=new jr("COPY_FILE_TO_PATH",[r,e]);await this.postTask(n)}async insertArrowFromIPCStream(r,e,n){if(e.length==0)return;let l=new jr("INSERT_ARROW_FROM_IPC_STREAM",[r,e,n]);await this.postTask(l,[e.buffer])}async insertCSVFromPath(r,e,n){if(n.columns!==void 0){let p=[];for(let v in n.columns){let b=n.columns[v];p.push(ey(v,b))}n.columnsFlat=p,delete n.columns}let l=new jr("IMPORT_CSV_FROM_PATH",[r,e,n]);await this.postTask(l)}async insertJSONFromPath(r,e,n){if(n.columns!==void 0){let p=[];for(let v in n.columns){let b=n.columns[v];p.push(ey(v,b))}n.columnsFlat=p,delete n.columns}let l=new jr("IMPORT_JSON_FROM_PATH",[r,e,n]);await this.postTask(l)}},HA=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),YA=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),KA=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),XA=()=>(async r=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(r)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),Zy={name:"@duckdb/duckdb-wasm",version:"1.29.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.13",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},JA=Zy.name,QA=Zy.version,Wy=Zy.version.split(".");Wy[0];Wy[1];Wy[2];var eE=()=>typeof navigator>"u";function tE(){let r="https://cdn.jsdelivr.net/npm/".concat(JA,"@").concat(QA,"/dist/");return{mvp:{mainModule:"".concat(r,"duckdb-mvp.wasm"),mainWorker:"".concat(r,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(r,"duckdb-eh.wasm"),mainWorker:"".concat(r,"duckdb-browser-eh.worker.js")}}}var Sg=null,Ig=null,Tg=null,kg=null,Ag=null;async function rE(){return Sg==null&&(Sg=typeof BigInt64Array<"u"),Ig==null&&(Ig=await YA()),Tg==null&&(Tg=await XA()),kg==null&&(kg=await KA()),Ag==null&&(Ag=await HA()),{bigInt64Array:Sg,crossOriginIsolated:eE()||globalThis.crossOriginIsolated||!1,wasmExceptions:Ig,wasmSIMD:kg,wasmThreads:Tg,wasmBulkMemory:Ag}}async function iE(r){let e=await rE();if(e.wasmExceptions){if(e.wasmSIMD&&e.wasmThreads&&e.crossOriginIsolated&&r.coi)return{mainModule:r.coi.mainModule,mainWorker:r.coi.mainWorker,pthreadWorker:r.coi.pthreadWorker};if(r.eh)return{mainModule:r.eh.mainModule,mainWorker:r.eh.mainWorker,pthreadWorker:null}}return{mainModule:r.mvp.mainModule,mainWorker:r.mvp.mainWorker,pthreadWorker:null}}PA(LA());function nE(){let r=new TextDecoder;return e=>(typeof SharedArrayBuffer<"u"&&e.buffer instanceof SharedArrayBuffer&&(e=new Uint8Array(e)),r.decode(e))}nE();var sE=(r=>(r[r.BUFFER=0]="BUFFER",r[r.NODE_FS=1]="NODE_FS",r[r.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",r[r.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",r[r.HTTP=4]="HTTP",r[r.S3=5]="S3",r))(sE||{});class aE{constructor(){pg(this,"inner");this.inner=null}async initialise(){const e=tE(),n=await iE(e),l=URL.createObjectURL(new Blob([`importScripts("${n.mainWorker}");`],{type:"text/javascript"})),p=new Worker(l),v=new UA,b=new WA(v,p);await b.instantiate(n.mainModule,n.pthreadWorker),URL.revokeObjectURL(l),this.inner=b}unset(){this.inner=null}isLoaded(){return this.inner!=null}isLoadedWithThrow(){if(!this.isLoaded())throw new Error("DuckDBBackend not initialised")}async getMetrics(e){this.isLoadedWithThrow();const n=await this.inner.connect(),p=(await n.query(`INSTALL httpfs; LOAD httpfs; ${e}`)).toArray().map(v=>v.toJSON());return console.log(p),await n.close(),p}}Hp(aE);const ty=ci(null),G1=ci(null),tm=ci({kind:"title"}),ry=ci([]),Ep=ci(""),iy=ci(""),Bl=ci([]),Cp=ci([]),Nv=ci({}),Hy=ci([]),Yy=ci("pmtiles://https://popgetter.blob.core.windows.net/dev/v0.2/usa/geometries/tract_2019.pmtiles"),Ky="-",oE=r=>{const e=cE(r),{conflictingClassGroups:n,conflictingClassGroupModifiers:l}=r;return{getClassGroupId:b=>{const c=b.split(Ky);return c[0]===""&&c.length!==1&&c.shift(),Z1(c,e)||lE(b)},getConflictingClassGroupIds:(b,c)=>{const A=n[b]||[];return c&&l[b]?[...A,...l[b]]:A}}},Z1=(r,e)=>{var b;if(r.length===0)return e.classGroupId;const n=r[0],l=e.nextPart.get(n),p=l?Z1(r.slice(1),l):void 0;if(p)return p;if(e.validators.length===0)return;const v=r.join(Ky);return(b=e.validators.find(({validator:c})=>c(v)))==null?void 0:b.classGroupId},Uv=/^\[(.+)\]$/,lE=r=>{if(Uv.test(r)){const e=Uv.exec(r)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},cE=r=>{const{theme:e,prefix:n}=r,l={nextPart:new Map,validators:[]};return hE(Object.entries(r.classGroups),n).forEach(([v,b])=>{ny(b,l,v,e)}),l},ny=(r,e,n,l)=>{r.forEach(p=>{if(typeof p=="string"){const v=p===""?e:$v(e,p);v.classGroupId=n;return}if(typeof p=="function"){if(uE(p)){ny(p(l),e,n,l);return}e.validators.push({validator:p,classGroupId:n});return}Object.entries(p).forEach(([v,b])=>{ny(b,$v(e,v),n,l)})})},$v=(r,e)=>{let n=r;return e.split(Ky).forEach(l=>{n.nextPart.has(l)||n.nextPart.set(l,{nextPart:new Map,validators:[]}),n=n.nextPart.get(l)}),n},uE=r=>r.isThemeGetter,hE=(r,e)=>e?r.map(([n,l])=>{const p=l.map(v=>typeof v=="string"?e+v:typeof v=="object"?Object.fromEntries(Object.entries(v).map(([b,c])=>[e+b,c])):v);return[n,p]}):r,dE=r=>{if(r<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,l=new Map;const p=(v,b)=>{n.set(v,b),e++,e>r&&(e=0,l=n,n=new Map)};return{get(v){let b=n.get(v);if(b!==void 0)return b;if((b=l.get(v))!==void 0)return p(v,b),b},set(v,b){n.has(v)?n.set(v,b):p(v,b)}}},W1="!",fE=r=>{const{separator:e,experimentalParseClassName:n}=r,l=e.length===1,p=e[0],v=e.length,b=c=>{const A=[];let T=0,z=0,B;for(let ne=0;nez?B-z:void 0;return{modifiers:A,hasImportantModifier:j,baseClassName:Q,maybePostfixModifierPosition:ae}};return n?c=>n({className:c,parseClassName:b}):b},pE=r=>{if(r.length<=1)return r;const e=[];let n=[];return r.forEach(l=>{l[0]==="["?(e.push(...n.sort(),l),n=[]):n.push(l)}),e.push(...n.sort()),e},mE=r=>({cache:dE(r.cacheSize),parseClassName:fE(r),...oE(r)}),gE=/\s+/,yE=(r,e)=>{const{parseClassName:n,getClassGroupId:l,getConflictingClassGroupIds:p}=e,v=[],b=r.trim().split(gE);let c="";for(let A=b.length-1;A>=0;A-=1){const T=b[A],{modifiers:z,hasImportantModifier:B,baseClassName:U,maybePostfixModifierPosition:j}=n(T);let Q=!!j,ae=l(Q?U.substring(0,j):U);if(!ae){if(!Q){c=T+(c.length>0?" "+c:c);continue}if(ae=l(U),!ae){c=T+(c.length>0?" "+c:c);continue}Q=!1}const ne=pE(z).join(":"),Y=B?ne+W1:ne,_e=Y+ae;if(v.includes(_e))continue;v.push(_e);const de=p(ae,Q);for(let pe=0;pe0?" "+c:c)}return c};function Xy(){let r=0,e,n,l="";for(;r{if(typeof r=="string")return r;let e,n="";for(let l=0;lB(z),r());return n=mE(T),l=n.cache.get,p=n.cache.set,v=c,c(A)}function c(A){const T=l(A);if(T)return T;const z=yE(A,n);return p(A,z),z}return function(){return v(Xy.apply(null,arguments))}}const Di=r=>{const e=n=>n[r]||[];return e.isThemeGetter=!0,e},Y1=/^\[(?:([a-z-]+):)?(.+)\]$/i,vE=/^\d+\/\d+$/,bE=new Set(["px","full","screen"]),xE=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,wE=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,SE=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,IE=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,TE=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,oo=r=>Kc(r)||bE.has(r)||vE.test(r),Vo=r=>hu(r,"length",LE),Kc=r=>!!r&&!Number.isNaN(Number(r)),Eg=r=>hu(r,"number",Kc),xh=r=>!!r&&Number.isInteger(Number(r)),kE=r=>r.endsWith("%")&&Kc(r.slice(0,-1)),wr=r=>Y1.test(r),jo=r=>xE.test(r),AE=new Set(["length","size","percentage"]),EE=r=>hu(r,AE,K1),CE=r=>hu(r,"position",K1),ME=new Set(["image","url"]),DE=r=>hu(r,ME,BE),PE=r=>hu(r,"",zE),wh=()=>!0,hu=(r,e,n)=>{const l=Y1.exec(r);return l?l[1]?typeof e=="string"?l[1]===e:e.has(l[1]):n(l[2]):!1},LE=r=>wE.test(r)&&!SE.test(r),K1=()=>!1,zE=r=>IE.test(r),BE=r=>TE.test(r),RE=()=>{const r=Di("colors"),e=Di("spacing"),n=Di("blur"),l=Di("brightness"),p=Di("borderColor"),v=Di("borderRadius"),b=Di("borderSpacing"),c=Di("borderWidth"),A=Di("contrast"),T=Di("grayscale"),z=Di("hueRotate"),B=Di("invert"),U=Di("gap"),j=Di("gradientColorStops"),Q=Di("gradientColorStopPositions"),ae=Di("inset"),ne=Di("margin"),Y=Di("opacity"),_e=Di("padding"),de=Di("saturate"),pe=Di("scale"),Te=Di("sepia"),De=Di("skew"),je=Di("space"),ke=Di("translate"),$e=()=>["auto","contain","none"],Me=()=>["auto","hidden","clip","visible","scroll"],He=()=>["auto",wr,e],Ye=()=>[wr,e],Pe=()=>["",oo,Vo],tt=()=>["auto",Kc,wr],Je=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],lt=()=>["solid","dashed","dotted","double","none"],At=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ze=()=>["start","end","center","between","around","evenly","stretch"],ft=()=>["","0",wr],St=()=>["auto","avoid","all","avoid-page","page","left","right","column"],gt=()=>[Kc,wr];return{cacheSize:500,separator:":",theme:{colors:[wh],spacing:[oo,Vo],blur:["none","",jo,wr],brightness:gt(),borderColor:[r],borderRadius:["none","","full",jo,wr],borderSpacing:Ye(),borderWidth:Pe(),contrast:gt(),grayscale:ft(),hueRotate:gt(),invert:ft(),gap:Ye(),gradientColorStops:[r],gradientColorStopPositions:[kE,Vo],inset:He(),margin:He(),opacity:gt(),padding:Ye(),saturate:gt(),scale:gt(),sepia:ft(),skew:gt(),space:Ye(),translate:Ye()},classGroups:{aspect:[{aspect:["auto","square","video",wr]}],container:["container"],columns:[{columns:[jo]}],"break-after":[{"break-after":St()}],"break-before":[{"break-before":St()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Je(),wr]}],overflow:[{overflow:Me()}],"overflow-x":[{"overflow-x":Me()}],"overflow-y":[{"overflow-y":Me()}],overscroll:[{overscroll:$e()}],"overscroll-x":[{"overscroll-x":$e()}],"overscroll-y":[{"overscroll-y":$e()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[ae]}],"inset-x":[{"inset-x":[ae]}],"inset-y":[{"inset-y":[ae]}],start:[{start:[ae]}],end:[{end:[ae]}],top:[{top:[ae]}],right:[{right:[ae]}],bottom:[{bottom:[ae]}],left:[{left:[ae]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",xh,wr]}],basis:[{basis:He()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",wr]}],grow:[{grow:ft()}],shrink:[{shrink:ft()}],order:[{order:["first","last","none",xh,wr]}],"grid-cols":[{"grid-cols":[wh]}],"col-start-end":[{col:["auto",{span:["full",xh,wr]},wr]}],"col-start":[{"col-start":tt()}],"col-end":[{"col-end":tt()}],"grid-rows":[{"grid-rows":[wh]}],"row-start-end":[{row:["auto",{span:[xh,wr]},wr]}],"row-start":[{"row-start":tt()}],"row-end":[{"row-end":tt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",wr]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",wr]}],gap:[{gap:[U]}],"gap-x":[{"gap-x":[U]}],"gap-y":[{"gap-y":[U]}],"justify-content":[{justify:["normal",...Ze()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ze(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ze(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[_e]}],px:[{px:[_e]}],py:[{py:[_e]}],ps:[{ps:[_e]}],pe:[{pe:[_e]}],pt:[{pt:[_e]}],pr:[{pr:[_e]}],pb:[{pb:[_e]}],pl:[{pl:[_e]}],m:[{m:[ne]}],mx:[{mx:[ne]}],my:[{my:[ne]}],ms:[{ms:[ne]}],me:[{me:[ne]}],mt:[{mt:[ne]}],mr:[{mr:[ne]}],mb:[{mb:[ne]}],ml:[{ml:[ne]}],"space-x":[{"space-x":[je]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[je]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",wr,e]}],"min-w":[{"min-w":[wr,e,"min","max","fit"]}],"max-w":[{"max-w":[wr,e,"none","full","min","max","fit","prose",{screen:[jo]},jo]}],h:[{h:[wr,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[wr,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[wr,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[wr,e,"auto","min","max","fit"]}],"font-size":[{text:["base",jo,Vo]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Eg]}],"font-family":[{font:[wh]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",wr]}],"line-clamp":[{"line-clamp":["none",Kc,Eg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",oo,wr]}],"list-image":[{"list-image":["none",wr]}],"list-style-type":[{list:["none","disc","decimal",wr]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[r]}],"placeholder-opacity":[{"placeholder-opacity":[Y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[r]}],"text-opacity":[{"text-opacity":[Y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...lt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",oo,Vo]}],"underline-offset":[{"underline-offset":["auto",oo,wr]}],"text-decoration-color":[{decoration:[r]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Ye()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",wr]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",wr]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[Y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Je(),CE]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",EE]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},DE]}],"bg-color":[{bg:[r]}],"gradient-from-pos":[{from:[Q]}],"gradient-via-pos":[{via:[Q]}],"gradient-to-pos":[{to:[Q]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],rounded:[{rounded:[v]}],"rounded-s":[{"rounded-s":[v]}],"rounded-e":[{"rounded-e":[v]}],"rounded-t":[{"rounded-t":[v]}],"rounded-r":[{"rounded-r":[v]}],"rounded-b":[{"rounded-b":[v]}],"rounded-l":[{"rounded-l":[v]}],"rounded-ss":[{"rounded-ss":[v]}],"rounded-se":[{"rounded-se":[v]}],"rounded-ee":[{"rounded-ee":[v]}],"rounded-es":[{"rounded-es":[v]}],"rounded-tl":[{"rounded-tl":[v]}],"rounded-tr":[{"rounded-tr":[v]}],"rounded-br":[{"rounded-br":[v]}],"rounded-bl":[{"rounded-bl":[v]}],"border-w":[{border:[c]}],"border-w-x":[{"border-x":[c]}],"border-w-y":[{"border-y":[c]}],"border-w-s":[{"border-s":[c]}],"border-w-e":[{"border-e":[c]}],"border-w-t":[{"border-t":[c]}],"border-w-r":[{"border-r":[c]}],"border-w-b":[{"border-b":[c]}],"border-w-l":[{"border-l":[c]}],"border-opacity":[{"border-opacity":[Y]}],"border-style":[{border:[...lt(),"hidden"]}],"divide-x":[{"divide-x":[c]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[c]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[Y]}],"divide-style":[{divide:lt()}],"border-color":[{border:[p]}],"border-color-x":[{"border-x":[p]}],"border-color-y":[{"border-y":[p]}],"border-color-s":[{"border-s":[p]}],"border-color-e":[{"border-e":[p]}],"border-color-t":[{"border-t":[p]}],"border-color-r":[{"border-r":[p]}],"border-color-b":[{"border-b":[p]}],"border-color-l":[{"border-l":[p]}],"divide-color":[{divide:[p]}],"outline-style":[{outline:["",...lt()]}],"outline-offset":[{"outline-offset":[oo,wr]}],"outline-w":[{outline:[oo,Vo]}],"outline-color":[{outline:[r]}],"ring-w":[{ring:Pe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[r]}],"ring-opacity":[{"ring-opacity":[Y]}],"ring-offset-w":[{"ring-offset":[oo,Vo]}],"ring-offset-color":[{"ring-offset":[r]}],shadow:[{shadow:["","inner","none",jo,PE]}],"shadow-color":[{shadow:[wh]}],opacity:[{opacity:[Y]}],"mix-blend":[{"mix-blend":[...At(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":At()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[l]}],contrast:[{contrast:[A]}],"drop-shadow":[{"drop-shadow":["","none",jo,wr]}],grayscale:[{grayscale:[T]}],"hue-rotate":[{"hue-rotate":[z]}],invert:[{invert:[B]}],saturate:[{saturate:[de]}],sepia:[{sepia:[Te]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[l]}],"backdrop-contrast":[{"backdrop-contrast":[A]}],"backdrop-grayscale":[{"backdrop-grayscale":[T]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[z]}],"backdrop-invert":[{"backdrop-invert":[B]}],"backdrop-opacity":[{"backdrop-opacity":[Y]}],"backdrop-saturate":[{"backdrop-saturate":[de]}],"backdrop-sepia":[{"backdrop-sepia":[Te]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[b]}],"border-spacing-x":[{"border-spacing-x":[b]}],"border-spacing-y":[{"border-spacing-y":[b]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",wr]}],duration:[{duration:gt()}],ease:[{ease:["linear","in","out","in-out",wr]}],delay:[{delay:gt()}],animate:[{animate:["none","spin","ping","pulse","bounce",wr]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[pe]}],"scale-x":[{"scale-x":[pe]}],"scale-y":[{"scale-y":[pe]}],rotate:[{rotate:[xh,wr]}],"translate-x":[{"translate-x":[ke]}],"translate-y":[{"translate-y":[ke]}],"skew-x":[{"skew-x":[De]}],"skew-y":[{"skew-y":[De]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",wr]}],accent:[{accent:["auto",r]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",wr]}],"caret-color":[{caret:[r]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Ye()}],"scroll-mx":[{"scroll-mx":Ye()}],"scroll-my":[{"scroll-my":Ye()}],"scroll-ms":[{"scroll-ms":Ye()}],"scroll-me":[{"scroll-me":Ye()}],"scroll-mt":[{"scroll-mt":Ye()}],"scroll-mr":[{"scroll-mr":Ye()}],"scroll-mb":[{"scroll-mb":Ye()}],"scroll-ml":[{"scroll-ml":Ye()}],"scroll-p":[{"scroll-p":Ye()}],"scroll-px":[{"scroll-px":Ye()}],"scroll-py":[{"scroll-py":Ye()}],"scroll-ps":[{"scroll-ps":Ye()}],"scroll-pe":[{"scroll-pe":Ye()}],"scroll-pt":[{"scroll-pt":Ye()}],"scroll-pr":[{"scroll-pr":Ye()}],"scroll-pb":[{"scroll-pb":Ye()}],"scroll-pl":[{"scroll-pl":Ye()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",wr]}],fill:[{fill:[r,"none"]}],"stroke-w":[{stroke:[oo,Vo,Eg]}],stroke:[{stroke:[r,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},$r=_E(RE),FE=r=>r;function X1(r){const e=r-1;return e*e*e+1}function OE(r){return r<.5?4*r*r*r:.5*Math.pow(2*r-2,3)+1}function sy(r){const e=typeof r=="string"&&r.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return e?[parseFloat(e[1]),e[2]||"px"]:[r,"px"]}function NE(r,{delay:e=0,duration:n=400,easing:l=OE,amount:p=5,opacity:v=0}={}){const b=getComputedStyle(r),c=+b.opacity,A=b.filter==="none"?"":b.filter,T=c*(1-v),[z,B]=sy(p);return{delay:e,duration:n,easing:l,css:(U,j)=>`opacity: ${c-T*j}; filter: ${A} blur(${j*z}${B});`}}function UE(r,{delay:e=0,duration:n=400,easing:l=FE}={}){const p=+getComputedStyle(r).opacity;return{delay:e,duration:n,easing:l,css:v=>`opacity: ${v*p}`}}function $E(r,{delay:e=0,duration:n=400,easing:l=X1,x:p=0,y:v=0,opacity:b=0}={}){const c=getComputedStyle(r),A=+c.opacity,T=c.transform==="none"?"":c.transform,z=A*(1-b),[B,U]=sy(p),[j,Q]=sy(v);return{delay:e,duration:n,easing:l,css:(ae,ne)=>` transform: ${T} translate(${(1-ae)*B}${U}, ${(1-ae)*j}${Q}); opacity: ${A-z*ne}`}}function VE(r,{delay:e=0,duration:n=400,easing:l=X1,axis:p="y"}={}){const v=getComputedStyle(r),b=+v.opacity,c=p==="y"?"height":"width",A=parseFloat(v[c]),T=p==="y"?["top","bottom"]:["left","right"],z=T.map(Y=>`${Y[0].toUpperCase()}${Y.slice(1)}`),B=parseFloat(v[`padding${z[0]}`]),U=parseFloat(v[`padding${z[1]}`]),j=parseFloat(v[`margin${z[0]}`]),Q=parseFloat(v[`margin${z[1]}`]),ae=parseFloat(v[`border${z[0]}Width`]),ne=parseFloat(v[`border${z[1]}Width`]);return{delay:e,duration:n,easing:l,css:Y=>`overflow: hidden;opacity: ${Math.min(Y*20,1)*b};${c}: ${Y*A}px;padding-${T[0]}: ${Y*B}px;padding-${T[1]}: ${Y*U}px;margin-${T[0]}: ${Y*j}px;margin-${T[1]}: ${Y*Q}px;border-${T[0]}-width: ${Y*ae}px;border-${T[1]}-width: ${Y*ne}px;`}}const jE={gray:"bg-gray-50 dark:bg-gray-800",red:"bg-red-50 dark:bg-gray-800",yellow:"bg-yellow-50 dark:bg-gray-800 ",green:"bg-green-50 dark:bg-gray-800 ",indigo:"bg-indigo-50 dark:bg-gray-800 ",purple:"bg-purple-50 dark:bg-gray-800 ",pink:"bg-pink-50 dark:bg-gray-800 ",blue:"bg-blue-50 dark:bg-gray-800 ",light:"bg-gray-50 dark:bg-gray-700",dark:"bg-gray-50 dark:bg-gray-800",default:"bg-white dark:bg-gray-800",dropdown:"bg-white dark:bg-gray-700",navbar:"bg-white dark:bg-gray-900",navbarUl:"bg-gray-50 dark:bg-gray-800",form:"bg-gray-50 dark:bg-gray-700",primary:"bg-primary-50 dark:bg-gray-800 ",orange:"bg-orange-50 dark:bg-orange-800",none:""};function qE(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["tag","color","rounded","border","shadow","node","use","options","role","transition","params","open"]);Pr(e,!1);const p=()=>{};Wn("background",!0);let v=le(e,"tag",8,()=>l.href?"a":"div"),b=le(e,"color",4,"default"),c=le(e,"rounded",0,!1),A=le(e,"border",0,!1),T=le(e,"shadow",0,!1),z=le(e,"node",12,()=>{}),B=le(e,"use",0,p),U=le(e,"options",8,()=>({})),j=le(e,"role",8,()=>{}),Q=le(e,"transition",8,()=>{}),ae=le(e,"params",8,()=>({})),ne=le(e,"open",0,!0);const Y=Jh(),_e={gray:"text-gray-800 dark:text-gray-300",red:"text-red-800 dark:text-red-400",yellow:"text-yellow-800 dark:text-yellow-300",green:"text-green-800 dark:text-green-400",indigo:"text-indigo-800 dark:text-indigo-400",purple:"text-purple-800 dark:text-purple-400",pink:"text-pink-800 dark:text-pink-400",blue:"text-blue-800 dark:text-blue-400",light:"text-gray-700 dark:text-gray-300",dark:"text-gray-700 dark:text-gray-300",default:"text-gray-500 dark:text-gray-400",dropdown:"text-gray-700 dark:text-gray-200",navbar:"text-gray-700 dark:text-gray-200",navbarUl:"text-gray-700 dark:text-gray-400",form:"text-gray-900 dark:text-white",primary:"text-primary-800 dark:text-primary-400",orange:"text-orange-800 dark:text-orange-400",none:""},de={gray:"border-gray-300 dark:border-gray-800 divide-gray-300 dark:divide-gray-800",red:"border-red-300 dark:border-red-800 divide-red-300 dark:divide-red-800",yellow:"border-yellow-300 dark:border-yellow-800 divide-yellow-300 dark:divide-yellow-800",green:"border-green-300 dark:border-green-800 divide-green-300 dark:divide-green-800",indigo:"border-indigo-300 dark:border-indigo-800 divide-indigo-300 dark:divide-indigo-800",purple:"border-purple-300 dark:border-purple-800 divide-purple-300 dark:divide-purple-800",pink:"border-pink-300 dark:border-pink-800 divide-pink-300 dark:divide-pink-800",blue:"border-blue-300 dark:border-blue-800 divide-blue-300 dark:divide-blue-800",light:"border-gray-500 divide-gray-500",dark:"border-gray-500 divide-gray-500",default:"border-gray-200 dark:border-gray-700 divide-gray-200 dark:divide-gray-700",dropdown:"border-gray-100 dark:border-gray-600 divide-gray-100 dark:divide-gray-600",navbar:"border-gray-100 dark:border-gray-700 divide-gray-100 dark:divide-gray-700",navbarUl:"border-gray-100 dark:border-gray-700 divide-gray-100 dark:divide-gray-700",form:"border-gray-300 dark:border-gray-700 divide-gray-300 dark:divide-gray-700",primary:"border-primary-500 dark:border-primary-200 divide-primary-500 dark:divide-primary-200 ",orange:"border-orange-300 dark:border-orange-800 divide-orange-300 dark:divide-orange-800",none:""};let pe=wt();bt(()=>ze(ne()),()=>{Y(ne()?"open":"close")}),bt(()=>ze(ne()),()=>{Y("show",ne())}),bt(()=>ze(b()),()=>{b(b()??"default")}),bt(()=>ze(b()),()=>{Wn("color",b())}),bt(()=>(ze(b()),ze(c()),ze(A()),ze(T()),ze(n)),()=>{ot(pe,$r(jE[b()],_e[b()],c()&&"rounded-lg",A()&&"border",de[b()],T()&&"shadow-md",n.class))}),_i(),zr();var Te=nr(),De=ct(Te);pr(De,()=>Q()&&ne(),je=>{var ke=nr(),$e=ct(ke);Uh($e,v,!1,(Me,He)=>{Ol(Me,Je=>z(Je),()=>z());let Ye;Pt(()=>Ye=$h(Me,Ye,{role:j(),...l,class:oe(pe)},"")),Pb(3,Me,Q,ae),Ko(Me,(Je,lt)=>B()(Je,lt),U),Ve("click",Me,function(Je){Ne.call(this,e,Je)}),Ve("mouseenter",Me,function(Je){Ne.call(this,e,Je)}),Ve("mouseleave",Me,function(Je){Ne.call(this,e,Je)}),Ve("focusin",Me,function(Je){Ne.call(this,e,Je)}),Ve("focusout",Me,function(Je){Ne.call(this,e,Je)});var Pe=nr(),tt=ct(Pe);hr(tt,Wr(e),{},null),xe(He,Pe)}),xe(je,ke)},je=>{var ke=nr(),$e=ct(ke);pr($e,ne,Me=>{var He=nr(),Ye=ct(He);Uh(Ye,v,!1,(Pe,tt)=>{Ol(Pe,Ze=>z(Ze),()=>z());let Je;Pt(()=>Je=$h(Pe,Je,{role:j(),...l,class:oe(pe)},"")),Ko(Pe,(Ze,ft)=>B()(Ze,ft),U),Ve("click",Pe,function(Ze){Ne.call(this,e,Ze)}),Ve("mouseenter",Pe,function(Ze){Ne.call(this,e,Ze)}),Ve("mouseleave",Pe,function(Ze){Ne.call(this,e,Ze)}),Ve("focusin",Pe,function(Ze){Ne.call(this,e,Ze)}),Ve("focusout",Pe,function(Ze){Ne.call(this,e,Ze)});var lt=nr(),At=ct(lt);hr(At,Wr(e),{},null),xe(tt,lt)}),xe(Me,He)},null,!0),xe(je,ke)}),xe(r,Te),Lr()}var GE=Xe(' '),ZE=Xe(" "),WE=Xe(' '),HE=Xe("");function YE(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["color","name","ariaLabel","size","href"]);Pr(e,!1);let p=le(e,"color",0,"default"),v=le(e,"name",8,()=>{}),b=le(e,"ariaLabel",8,()=>{}),c=le(e,"size",0,"md"),A=le(e,"href",8,()=>{});const T=Zi("background"),z={dark:"text-gray-500 hover:text-gray-900 hover:bg-gray-200 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600",gray:"text-gray-500 focus:ring-gray-400 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-gray-300",red:"text-red-500 focus:ring-red-400 hover:bg-red-200 dark:hover:bg-red-800 dark:hover:text-red-300",yellow:"text-yellow-500 focus:ring-yellow-400 hover:bg-yellow-200 dark:hover:bg-yellow-800 dark:hover:text-yellow-300",green:"text-green-500 focus:ring-green-400 hover:bg-green-200 dark:hover:bg-green-800 dark:hover:text-green-300",indigo:"text-indigo-500 focus:ring-indigo-400 hover:bg-indigo-200 dark:hover:bg-indigo-800 dark:hover:text-indigo-300",purple:"text-purple-500 focus:ring-purple-400 hover:bg-purple-200 dark:hover:bg-purple-800 dark:hover:text-purple-300",pink:"text-pink-500 focus:ring-pink-400 hover:bg-pink-200 dark:hover:bg-pink-800 dark:hover:text-pink-300",blue:"text-blue-500 focus:ring-blue-400 hover:bg-blue-200 dark:hover:bg-blue-800 dark:hover:text-blue-300",primary:"text-primary-500 focus:ring-primary-400 hover:bg-primary-200 dark:hover:bg-primary-800 dark:hover:text-primary-300",default:"focus:ring-gray-400 hover:bg-gray-100"},B={xs:"m-0.5 rounded-sm focus:ring-1 p-0.5",sm:"m-0.5 rounded focus:ring-1 p-0.5",md:"m-0.5 rounded-lg focus:ring-2 p-1.5",lg:"m-0.5 rounded-lg focus:ring-2 p-2.5"};let U=wt();const j={xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-5 h-5",lg:"w-5 h-5"};bt(()=>(ze(c()),ze(p()),ze(n)),()=>{ot(U,$r("focus:outline-none whitespace-normal",B[c()],z[p()],p()==="default"&&(T?"dark:hover:bg-gray-600":"dark:hover:bg-gray-700"),n.class))}),_i(),zr();var Q=nr(),ae=ct(Q);pr(ae,A,ne=>{var Y=ZE();let _e;var de=ut(Y);pr(de,v,Te=>{var De=GE(),je=ut(De);ht(De),Pt(()=>gi(je,v())),xe(Te,De)});var pe=we(we(de,!0));hr(pe,Wr(e),{get svgSize(){return j[c()]}},null),ht(Y),Pt(()=>_e=Ui(Y,_e,{href:A(),...l,class:oe(U),"aria-label":b()??v()},!0,"")),xe(ne,Y)},ne=>{var Y=HE();let _e;var de=ut(Y);pr(de,v,Te=>{var De=WE(),je=ut(De);ht(De),Pt(()=>gi(je,v())),xe(Te,De)});var pe=we(we(de,!0));hr(pe,Wr(e),{get svgSize(){return j[c()]}},null),ht(Y),Pt(()=>_e=Ui(Y,_e,{type:"button",...l,class:oe(U),"aria-label":b()??v()},!0,"")),Ve("click",Y,function(Te){Ne.call(this,e,Te)}),xe(ne,Y)}),xe(r,Q),Lr()}var KE=hs('');function J1(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["name"]);Pr(e,!1);let p=le(e,"name",0,"Close");zr();var v=Yo(()=>$r("ms-auto",n.class));YE(r,qp({get name(){return p()}},()=>l,{get class(){return oe(v)},$$events:{click(b){Ne.call(this,e,b)}},children:wb,$$slots:{default:(b,c)=>{const A=Yo(()=>c.svgSize);var T=KE();ut(T),ht(T),Pt(()=>Eb(T,oe(A))),xe(b,T)}},$$legacy:!0})),Lr()}var XE=Xe(""),JE=Xe("");function Hs(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["pill","outline","size","href","type","color","shadow","tag","checked","disabled"]);Pr(e,!1);const p=Zi("group");let v=le(e,"pill",0,!1),b=le(e,"outline",0,!1),c=le(e,"size",0,p?"sm":"md"),A=le(e,"href",8,()=>{}),T=le(e,"type",0,"button"),z=le(e,"color",8,()=>p?b()?"dark":"alternative":"primary"),B=le(e,"shadow",0,!1),U=le(e,"tag",0,"button"),j=le(e,"checked",8,()=>{}),Q=le(e,"disabled",0,!1);const ae={alternative:"text-gray-900 bg-white border border-gray-200 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-400 hover:text-primary-700 focus-within:text-primary-700 dark:focus-within:text-white dark:hover:text-white dark:hover:bg-gray-700",blue:"text-white bg-blue-700 hover:bg-blue-800 dark:bg-blue-600 dark:hover:bg-blue-700",dark:"text-white bg-gray-800 hover:bg-gray-900 dark:bg-gray-800 dark:hover:bg-gray-700",green:"text-white bg-green-700 hover:bg-green-800 dark:bg-green-600 dark:hover:bg-green-700",light:"text-gray-900 bg-white border border-gray-300 hover:bg-gray-100 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600",primary:"text-white bg-primary-700 hover:bg-primary-800 dark:bg-primary-600 dark:hover:bg-primary-700",purple:"text-white bg-purple-700 hover:bg-purple-800 dark:bg-purple-600 dark:hover:bg-purple-700",red:"text-white bg-red-700 hover:bg-red-800 dark:bg-red-600 dark:hover:bg-red-700",yellow:"text-white bg-yellow-400 hover:bg-yellow-500 ",none:""},ne={alternative:"text-primary-700 border dark:text-primary-500 bg-gray-100 dark:bg-gray-700 border-gray-300 shadow-gray-300 dark:shadow-gray-800 shadow-inner",blue:"text-blue-900 bg-blue-400 dark:bg-blue-500 shadow-blue-700 dark:shadow-blue-800 shadow-inner",dark:"text-white bg-gray-500 dark:bg-gray-600 shadow-gray-800 dark:shadow-gray-900 shadow-inner",green:"text-green-900 bg-green-400 dark:bg-green-500 shadow-green-700 dark:shadow-green-800 shadow-inner",light:"text-gray-900 bg-gray-100 border border-gray-300 dark:bg-gray-500 dark:text-gray-900 dark:border-gray-700 shadow-gray-300 dark:shadow-gray-700 shadow-inner",primary:"text-primary-900 bg-primary-400 dark:bg-primary-500 shadow-primary-700 dark:shadow-primary-800 shadow-inner",purple:"text-purple-900 bg-purple-400 dark:bg-purple-500 shadow-purple-700 dark:shadow-purple-800 shadow-inner",red:"text-red-900 bg-red-400 dark:bg-red-500 shadow-red-700 dark:shadow-red-800 shadow-inner",yellow:"text-yellow-900 bg-yellow-300 dark:bg-yellow-400 shadow-yellow-500 dark:shadow-yellow-700 shadow-inner",none:""},Y={alternative:"focus-within:ring-gray-200 dark:focus-within:ring-gray-700",blue:"focus-within:ring-blue-300 dark:focus-within:ring-blue-800",dark:"focus-within:ring-gray-300 dark:focus-within:ring-gray-700",green:"focus-within:ring-green-300 dark:focus-within:ring-green-800",light:"focus-within:ring-gray-200 dark:focus-within:ring-gray-700",primary:"focus-within:ring-primary-300 dark:focus-within:ring-primary-800",purple:"focus-within:ring-purple-300 dark:focus-within:ring-purple-900",red:"focus-within:ring-red-300 dark:focus-within:ring-red-900",yellow:"focus-within:ring-yellow-300 dark:focus-within:ring-yellow-900",none:""},_e={alternative:"shadow-gray-500/50 dark:shadow-gray-800/80",blue:"shadow-blue-500/50 dark:shadow-blue-800/80",dark:"shadow-gray-500/50 dark:shadow-gray-800/80",green:"shadow-green-500/50 dark:shadow-green-800/80",light:"shadow-gray-500/50 dark:shadow-gray-800/80",primary:"shadow-primary-500/50 dark:shadow-primary-800/80",purple:"shadow-purple-500/50 dark:shadow-purple-800/80",red:"shadow-red-500/50 dark:shadow-red-800/80 ",yellow:"shadow-yellow-500/50 dark:shadow-yellow-800/80 ",none:""},de={alternative:"text-gray-900 dark:text-gray-400 hover:text-white border border-gray-800 hover:bg-gray-900 focus-within:bg-gray-900 focus-within:text-white focus-within:ring-gray-300 dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-600 dark:focus-within:ring-gray-800",blue:"text-blue-700 hover:text-white border border-blue-700 hover:bg-blue-800 dark:border-blue-500 dark:text-blue-500 dark:hover:text-white dark:hover:bg-blue-600",dark:"text-gray-900 hover:text-white border border-gray-800 hover:bg-gray-900 focus-within:bg-gray-900 focus-within:text-white dark:border-gray-600 dark:hover:text-white dark:hover:bg-gray-600",green:"text-green-700 hover:text-white border border-green-700 hover:bg-green-800 dark:border-green-500 dark:text-green-500 dark:hover:text-white dark:hover:bg-green-600",light:"text-gray-500 hover:text-gray-900 bg-white border border-gray-200 dark:border-gray-600 dark:hover:text-white dark:text-gray-400 hover:bg-gray-50 dark:bg-gray-700 dark:hover:bg-gray-600",primary:"text-primary-700 hover:text-white border border-primary-700 hover:bg-primary-700 dark:border-primary-500 dark:text-primary-500 dark:hover:text-white dark:hover:bg-primary-600",purple:"text-purple-700 hover:text-white border border-purple-700 hover:bg-purple-800 dark:border-purple-400 dark:text-purple-400 dark:hover:text-white dark:hover:bg-purple-500",red:"text-red-700 hover:text-white border border-red-700 hover:bg-red-800 dark:border-red-500 dark:text-red-500 dark:hover:text-white dark:hover:bg-red-600",yellow:"text-yellow-400 hover:text-white border border-yellow-400 hover:bg-yellow-500 dark:border-yellow-300 dark:text-yellow-300 dark:hover:text-white dark:hover:bg-yellow-400",none:""},pe={xs:"px-3 py-2 text-xs",sm:"px-4 py-2 text-sm",md:"px-5 py-2.5 text-sm",lg:"px-5 py-3 text-base",xl:"px-6 py-3.5 text-base"},Te=()=>b()||z()==="alternative"||z()==="light";let De=wt();bt(()=>(ze(c()),ze(b()),ze(j()),ze(z()),ze(v()),ze(B()),ze(Q()),ze(n)),()=>{ot(De,$r("text-center font-medium",p?"focus-within:ring-2":"focus-within:ring-4",p&&"focus-within:z-10",p||"focus-within:outline-none","inline-flex items-center justify-center "+pe[c()],b()&&j()&&"border dark:border-gray-900",b()&&j()&&ne[z()],b()&&!j()&&de[z()],!b()&&j()&&ne[z()],!b()&&!j()&&ae[z()],z()==="alternative"&&(p&&!j()?"dark:bg-gray-700 dark:text-white dark:border-gray-700 dark:hover:border-gray-600 dark:hover:bg-gray-600":"dark:bg-transparent dark:border-gray-600 dark:hover:border-gray-600"),b()&&z()==="dark"&&(p?j()?"bg-gray-900 border-gray-800 dark:border-white dark:bg-gray-600":"dark:text-white border-gray-800 dark:border-white":"dark:text-gray-400 dark:border-gray-700"),Y[z()],Te()&&p&&"[&:not(:first-child)]:-ms-px",p?v()&&"first:rounded-s-full last:rounded-e-full"||"first:rounded-s-lg last:rounded-e-lg":v()&&"rounded-full"||"rounded-lg",B()&&"shadow-lg",B()&&_e[z()],Q()&&"cursor-not-allowed opacity-50",n.class))}),_i(),zr();var je=nr(),ke=ct(je);pr(ke,()=>A()&&!Q(),$e=>{var Me=XE();let He;var Ye=ut(Me);hr(Ye,Wr(e),{},null),ht(Me),Pt(()=>He=Ui(Me,He,{href:A(),...l,class:oe(De),role:"button"},!0,"")),Ve("click",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("change",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("keydown",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("keyup",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("touchstart",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("touchend",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("touchcancel",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("mouseenter",Me,function(Pe){Ne.call(this,e,Pe)}),Ve("mouseleave",Me,function(Pe){Ne.call(this,e,Pe)}),xe($e,Me)},$e=>{var Me=nr(),He=ct(Me);pr(He,()=>U()==="button",Ye=>{var Pe=JE();let tt;var Je=ut(Pe);hr(Je,Wr(e),{},null),ht(Pe),Pt(()=>tt=Ui(Pe,tt,{type:T(),...l,disabled:Q(),class:oe(De)},!0,"")),Ve("click",Pe,function(lt){Ne.call(this,e,lt)}),Ve("change",Pe,function(lt){Ne.call(this,e,lt)}),Ve("keydown",Pe,function(lt){Ne.call(this,e,lt)}),Ve("keyup",Pe,function(lt){Ne.call(this,e,lt)}),Ve("touchstart",Pe,function(lt){Ne.call(this,e,lt)}),Ve("touchend",Pe,function(lt){Ne.call(this,e,lt)}),Ve("touchcancel",Pe,function(lt){Ne.call(this,e,lt)}),Ve("mouseenter",Pe,function(lt){Ne.call(this,e,lt)}),Ve("mouseleave",Pe,function(lt){Ne.call(this,e,lt)}),xe(Ye,Pe)},Ye=>{var Pe=nr(),tt=ct(Pe);Uh(tt,U,!1,(Je,lt)=>{let At;Pt(()=>At=$h(Je,At,{...l,class:oe(De)},""));var Ze=nr(),ft=ct(Ze);hr(ft,Wr(e),{},null),xe(lt,Ze)}),xe(Ye,Pe)},!0),xe($e,Me)}),xe(r,je),Lr()}var QE=Xe("
");function Cg(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["size","divClass"]);Pr(e,!1);let p=le(e,"size",0,"md"),v=le(e,"divClass",0,"inline-flex rounded-lg shadow-sm");Wn("group",{size:p()}),zr();var b=QE();let c;var A=ut(b);hr(A,Wr(e),{},null),ht(b),Pt(()=>c=Ui(b,c,{...l,class:$r(v(),n.class),role:"group"},!0,"")),xe(r,b),Lr()}const eC=(r,e)=>{const n=l=>{l!=null&&l.target&&r&&!r.contains(l.target)&&!l.defaultPrevented&&e()};return document.addEventListener("click",n,!0),{destroy(){document.removeEventListener("click",n,!0)}}};var tC=Xe('
'),rC=Xe('
'),iC=Xe("
",1);function nC(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["activateClickOutside","hidden","position","leftOffset","rightOffset","topOffset","bottomOffset","width","backdrop","bgColor","bgOpacity","placement","id","divClass","transitionParams","transitionType"]);Pr(e,!1);let p=le(e,"activateClickOutside",0,!0),v=le(e,"hidden",4,!0),b=le(e,"position",0,"fixed"),c=le(e,"leftOffset",0,"inset-y-0 start-0"),A=le(e,"rightOffset",0,"inset-y-0 end-0"),T=le(e,"topOffset",0,"inset-x-0 top-0"),z=le(e,"bottomOffset",0,"inset-x-0 bottom-0"),B=le(e,"width",0,"w-80"),U=le(e,"backdrop",0,!0),j=le(e,"bgColor",0,"bg-gray-900"),Q=le(e,"bgOpacity",0,"bg-opacity-75"),ae=le(e,"placement",0,"left"),ne=le(e,"id",0,"drawer-example"),Y=le(e,"divClass",0,"overflow-y-auto z-50 p-4 bg-white dark:bg-gray-800"),_e=le(e,"transitionParams",8,()=>({})),de=le(e,"transitionType",0,"fly");function pe(Ye,Pe){switch(de()){case"slide":return VE(Ye,Pe);case"blur":return NE(Ye,Pe);case"fade":return UE(Ye,Pe);default:return $E(Ye,Pe)}}const Te={left:c(),right:A(),top:T(),bottom:z()},De=()=>{v(!v())},je=()=>p()&&!v()&&De();let ke=$r("fixed top-0 start-0 z-50 w-full h-full",U()&&j(),U()&&Q());function $e(Ye,Pe){return p()?eC(Ye,Pe):void 0}zr();var Me=nr(),He=ct(Me);pr(He,()=>!v(),Ye=>{var Pe=iC(),tt=ct(Pe);pr(tt,()=>U()&&p(),Ze=>{var ft=tC(),St=Sb(()=>()=>!v()&&De());En(ft,ke),Ve("click",ft,function(...gt){var Ct;return(Ct=oe(St))==null?void 0:Ct.apply(this,gt)},!1),xe(Ze,ft)},Ze=>{var ft=nr(),St=ct(ft);pr(St,()=>U()&&!p(),gt=>{var Ct=rC();En(Ct,ke),xe(gt,Ct)},null,!0),xe(Ze,ft)});var Je=we(we(tt,!0));let lt;var At=ut(Je);hr(At,Wr(e),{get hidden(){return v()}},null),ht(Je),Pt(()=>lt=Ui(Je,lt,{id:ne(),...l,class:$r(Y(),B(),b(),Te[ae()],n.class),tabindex:"-1","aria-controls":ne(),"aria-labelledby":ne()},!0,"")),Ko(Je,(Ze,ft)=>$e(Ze,ft),()=>je),Pb(3,Je,()=>pe,_e),xe(Ye,Pe)}),xe(r,Me),Lr()}const nu=Math.min,Rl=Math.max,Mp=Math.round,Sf=Math.floor,rl=r=>({x:r,y:r}),sC={left:"right",right:"left",bottom:"top",top:"bottom"},aC={start:"end",end:"start"};function ay(r,e,n){return Rl(r,nu(e,n))}function nd(r,e){return typeof r=="function"?r(e):r}function $l(r){return r.split("-")[0]}function sd(r){return r.split("-")[1]}function Q1(r){return r==="x"?"y":"x"}function Jy(r){return r==="y"?"height":"width"}function su(r){return["top","bottom"].includes($l(r))?"y":"x"}function Qy(r){return Q1(su(r))}function oC(r,e,n){n===void 0&&(n=!1);const l=sd(r),p=Qy(r),v=Jy(p);let b=p==="x"?l===(n?"end":"start")?"right":"left":l==="start"?"bottom":"top";return e.reference[v]>e.floating[v]&&(b=Dp(b)),[b,Dp(b)]}function lC(r){const e=Dp(r);return[oy(r),e,oy(e)]}function oy(r){return r.replace(/start|end/g,e=>aC[e])}function cC(r,e,n){const l=["left","right"],p=["right","left"],v=["top","bottom"],b=["bottom","top"];switch(r){case"top":case"bottom":return n?e?p:l:e?l:p;case"left":case"right":return e?v:b;default:return[]}}function uC(r,e,n,l){const p=sd(r);let v=cC($l(r),n==="start",l);return p&&(v=v.map(b=>b+"-"+p),e&&(v=v.concat(v.map(oy)))),v}function Dp(r){return r.replace(/left|right|bottom|top/g,e=>sC[e])}function hC(r){return{top:0,right:0,bottom:0,left:0,...r}}function ew(r){return typeof r!="number"?hC(r):{top:r,right:r,bottom:r,left:r}}function Pp(r){const{x:e,y:n,width:l,height:p}=r;return{width:l,height:p,top:n,left:e,right:e+l,bottom:n+p,x:e,y:n}}function Vv(r,e,n){let{reference:l,floating:p}=r;const v=su(e),b=Qy(e),c=Jy(b),A=$l(e),T=v==="y",z=l.x+l.width/2-p.width/2,B=l.y+l.height/2-p.height/2,U=l[c]/2-p[c]/2;let j;switch(A){case"top":j={x:z,y:l.y-p.height};break;case"bottom":j={x:z,y:l.y+l.height};break;case"right":j={x:l.x+l.width,y:B};break;case"left":j={x:l.x-p.width,y:B};break;default:j={x:l.x,y:l.y}}switch(sd(e)){case"start":j[b]-=U*(n&&T?-1:1);break;case"end":j[b]+=U*(n&&T?-1:1);break}return j}const dC=async(r,e,n)=>{const{placement:l="bottom",strategy:p="absolute",middleware:v=[],platform:b}=n,c=v.filter(Boolean),A=await(b.isRTL==null?void 0:b.isRTL(e));let T=await b.getElementRects({reference:r,floating:e,strategy:p}),{x:z,y:B}=Vv(T,l,A),U=l,j={},Q=0;for(let ae=0;ae({name:"arrow",options:r,async fn(e){const{x:n,y:l,placement:p,rects:v,platform:b,elements:c,middlewareData:A}=e,{element:T,padding:z=0}=nd(r,e)||{};if(T==null)return{};const B=ew(z),U={x:n,y:l},j=Qy(p),Q=Jy(j),ae=await b.getDimensions(T),ne=j==="y",Y=ne?"top":"left",_e=ne?"bottom":"right",de=ne?"clientHeight":"clientWidth",pe=v.reference[Q]+v.reference[j]-U[j]-v.floating[Q],Te=U[j]-v.reference[j],De=await(b.getOffsetParent==null?void 0:b.getOffsetParent(T));let je=De?De[de]:0;(!je||!await(b.isElement==null?void 0:b.isElement(De)))&&(je=c.floating[de]||v.floating[Q]);const ke=pe/2-Te/2,$e=je/2-ae[Q]/2-1,Me=nu(B[Y],$e),He=nu(B[_e],$e),Ye=Me,Pe=je-ae[Q]-He,tt=je/2-ae[Q]/2+ke,Je=ay(Ye,tt,Pe),lt=!A.arrow&&sd(p)!=null&&tt!==Je&&v.reference[Q]/2-(tttt<=0)){var He,Ye;const tt=(((He=v.flip)==null?void 0:He.index)||0)+1,Je=je[tt];if(Je)return{data:{index:tt,overflows:Me},reset:{placement:Je}};let lt=(Ye=Me.filter(At=>At.overflows[0]<=0).sort((At,Ze)=>At.overflows[1]-Ze.overflows[1])[0])==null?void 0:Ye.placement;if(!lt)switch(j){case"bestFit":{var Pe;const At=(Pe=Me.filter(Ze=>{if(De){const ft=su(Ze.placement);return ft===_e||ft==="y"}return!0}).map(Ze=>[Ze.placement,Ze.overflows.filter(ft=>ft>0).reduce((ft,St)=>ft+St,0)]).sort((Ze,ft)=>Ze[1]-ft[1])[0])==null?void 0:Pe[0];At&&(lt=At);break}case"initialPlacement":lt=c;break}if(p!==lt)return{reset:{placement:lt}}}return{}}}};async function mC(r,e){const{placement:n,platform:l,elements:p}=r,v=await(l.isRTL==null?void 0:l.isRTL(p.floating)),b=$l(n),c=sd(n),A=su(n)==="y",T=["left","top"].includes(b)?-1:1,z=v&&A?-1:1,B=nd(e,r);let{mainAxis:U,crossAxis:j,alignmentAxis:Q}=typeof B=="number"?{mainAxis:B,crossAxis:0,alignmentAxis:null}:{mainAxis:B.mainAxis||0,crossAxis:B.crossAxis||0,alignmentAxis:B.alignmentAxis};return c&&typeof Q=="number"&&(j=c==="end"?Q*-1:Q),A?{x:j*z,y:U*T}:{x:U*T,y:j*z}}const gC=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var n,l;const{x:p,y:v,placement:b,middlewareData:c}=e,A=await mC(e,r);return b===((n=c.offset)==null?void 0:n.placement)&&(l=c.arrow)!=null&&l.alignmentOffset?{}:{x:p+A.x,y:v+A.y,data:{...A,placement:b}}}}},yC=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:n,y:l,placement:p}=e,{mainAxis:v=!0,crossAxis:b=!1,limiter:c={fn:ne=>{let{x:Y,y:_e}=ne;return{x:Y,y:_e}}},...A}=nd(r,e),T={x:n,y:l},z=await tw(e,A),B=su($l(p)),U=Q1(B);let j=T[U],Q=T[B];if(v){const ne=U==="y"?"top":"left",Y=U==="y"?"bottom":"right",_e=j+z[ne],de=j-z[Y];j=ay(_e,j,de)}if(b){const ne=B==="y"?"top":"left",Y=B==="y"?"bottom":"right",_e=Q+z[ne],de=Q-z[Y];Q=ay(_e,Q,de)}const ae=c.fn({...e,[U]:j,[B]:Q});return{...ae,data:{x:ae.x-n,y:ae.y-l,enabled:{[U]:v,[B]:b}}}}}};function rm(){return typeof window<"u"}function du(r){return rw(r)?(r.nodeName||"").toLowerCase():"#document"}function Rs(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function qa(r){var e;return(e=(rw(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function rw(r){return rm()?r instanceof Node||r instanceof Rs(r).Node:!1}function ga(r){return rm()?r instanceof Element||r instanceof Rs(r).Element:!1}function ja(r){return rm()?r instanceof HTMLElement||r instanceof Rs(r).HTMLElement:!1}function jv(r){return!rm()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof Rs(r).ShadowRoot}function ad(r){const{overflow:e,overflowX:n,overflowY:l,display:p}=ya(r);return/auto|scroll|overlay|hidden|clip/.test(e+l+n)&&!["inline","contents"].includes(p)}function _C(r){return["table","td","th"].includes(du(r))}function im(r){return[":popover-open",":modal"].some(e=>{try{return r.matches(e)}catch{return!1}})}function e_(r){const e=t_(),n=ga(r)?ya(r):r;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(l=>(n.willChange||"").includes(l))||["paint","layout","strict","content"].some(l=>(n.contain||"").includes(l))}function vC(r){let e=il(r);for(;ja(e)&&!au(e);){if(e_(e))return e;if(im(e))return null;e=il(e)}return null}function t_(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function au(r){return["html","body","#document"].includes(du(r))}function ya(r){return Rs(r).getComputedStyle(r)}function nm(r){return ga(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function il(r){if(du(r)==="html")return r;const e=r.assignedSlot||r.parentNode||jv(r)&&r.host||qa(r);return jv(e)?e.host:e}function iw(r){const e=il(r);return au(e)?r.ownerDocument?r.ownerDocument.body:r.body:ja(e)&&ad(e)?e:iw(e)}function Hh(r,e,n){var l;e===void 0&&(e=[]),n===void 0&&(n=!0);const p=iw(r),v=p===((l=r.ownerDocument)==null?void 0:l.body),b=Rs(p);if(v){const c=ly(b);return e.concat(b,b.visualViewport||[],ad(p)?p:[],c&&n?Hh(c):[])}return e.concat(p,Hh(p,[],n))}function ly(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function nw(r){const e=ya(r);let n=parseFloat(e.width)||0,l=parseFloat(e.height)||0;const p=ja(r),v=p?r.offsetWidth:n,b=p?r.offsetHeight:l,c=Mp(n)!==v||Mp(l)!==b;return c&&(n=v,l=b),{width:n,height:l,$:c}}function r_(r){return ga(r)?r:r.contextElement}function Xc(r){const e=r_(r);if(!ja(e))return rl(1);const n=e.getBoundingClientRect(),{width:l,height:p,$:v}=nw(e);let b=(v?Mp(n.width):n.width)/l,c=(v?Mp(n.height):n.height)/p;return(!b||!Number.isFinite(b))&&(b=1),(!c||!Number.isFinite(c))&&(c=1),{x:b,y:c}}const bC=rl(0);function sw(r){const e=Rs(r);return!t_()||!e.visualViewport?bC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function xC(r,e,n){return e===void 0&&(e=!1),!n||e&&n!==Rs(r)?!1:e}function Vl(r,e,n,l){e===void 0&&(e=!1),n===void 0&&(n=!1);const p=r.getBoundingClientRect(),v=r_(r);let b=rl(1);e&&(l?ga(l)&&(b=Xc(l)):b=Xc(r));const c=xC(v,n,l)?sw(v):rl(0);let A=(p.left+c.x)/b.x,T=(p.top+c.y)/b.y,z=p.width/b.x,B=p.height/b.y;if(v){const U=Rs(v),j=l&&ga(l)?Rs(l):l;let Q=U,ae=ly(Q);for(;ae&&l&&j!==Q;){const ne=Xc(ae),Y=ae.getBoundingClientRect(),_e=ya(ae),de=Y.left+(ae.clientLeft+parseFloat(_e.paddingLeft))*ne.x,pe=Y.top+(ae.clientTop+parseFloat(_e.paddingTop))*ne.y;A*=ne.x,T*=ne.y,z*=ne.x,B*=ne.y,A+=de,T+=pe,Q=Rs(ae),ae=ly(Q)}}return Pp({width:z,height:B,x:A,y:T})}function wC(r){let{elements:e,rect:n,offsetParent:l,strategy:p}=r;const v=p==="fixed",b=qa(l),c=e?im(e.floating):!1;if(l===b||c&&v)return n;let A={scrollLeft:0,scrollTop:0},T=rl(1);const z=rl(0),B=ja(l);if((B||!B&&!v)&&((du(l)!=="body"||ad(b))&&(A=nm(l)),ja(l))){const U=Vl(l);T=Xc(l),z.x=U.x+l.clientLeft,z.y=U.y+l.clientTop}return{width:n.width*T.x,height:n.height*T.y,x:n.x*T.x-A.scrollLeft*T.x+z.x,y:n.y*T.y-A.scrollTop*T.y+z.y}}function SC(r){return Array.from(r.getClientRects())}function cy(r,e){const n=nm(r).scrollLeft;return e?e.left+n:Vl(qa(r)).left+n}function IC(r){const e=qa(r),n=nm(r),l=r.ownerDocument.body,p=Rl(e.scrollWidth,e.clientWidth,l.scrollWidth,l.clientWidth),v=Rl(e.scrollHeight,e.clientHeight,l.scrollHeight,l.clientHeight);let b=-n.scrollLeft+cy(r);const c=-n.scrollTop;return ya(l).direction==="rtl"&&(b+=Rl(e.clientWidth,l.clientWidth)-p),{width:p,height:v,x:b,y:c}}function TC(r,e){const n=Rs(r),l=qa(r),p=n.visualViewport;let v=l.clientWidth,b=l.clientHeight,c=0,A=0;if(p){v=p.width,b=p.height;const T=t_();(!T||T&&e==="fixed")&&(c=p.offsetLeft,A=p.offsetTop)}return{width:v,height:b,x:c,y:A}}function kC(r,e){const n=Vl(r,!0,e==="fixed"),l=n.top+r.clientTop,p=n.left+r.clientLeft,v=ja(r)?Xc(r):rl(1),b=r.clientWidth*v.x,c=r.clientHeight*v.y,A=p*v.x,T=l*v.y;return{width:b,height:c,x:A,y:T}}function qv(r,e,n){let l;if(e==="viewport")l=TC(r,n);else if(e==="document")l=IC(qa(r));else if(ga(e))l=kC(e,n);else{const p=sw(r);l={...e,x:e.x-p.x,y:e.y-p.y}}return Pp(l)}function aw(r,e){const n=il(r);return n===e||!ga(n)||au(n)?!1:ya(n).position==="fixed"||aw(n,e)}function AC(r,e){const n=e.get(r);if(n)return n;let l=Hh(r,[],!1).filter(c=>ga(c)&&du(c)!=="body"),p=null;const v=ya(r).position==="fixed";let b=v?il(r):r;for(;ga(b)&&!au(b);){const c=ya(b),A=e_(b);!A&&c.position==="fixed"&&(p=null),(v?!A&&!p:!A&&c.position==="static"&&!!p&&["absolute","fixed"].includes(p.position)||ad(b)&&!A&&aw(r,b))?l=l.filter(z=>z!==b):p=c,b=il(b)}return e.set(r,l),l}function EC(r){let{element:e,boundary:n,rootBoundary:l,strategy:p}=r;const b=[...n==="clippingAncestors"?im(e)?[]:AC(e,this._c):[].concat(n),l],c=b[0],A=b.reduce((T,z)=>{const B=qv(e,z,p);return T.top=Rl(B.top,T.top),T.right=nu(B.right,T.right),T.bottom=nu(B.bottom,T.bottom),T.left=Rl(B.left,T.left),T},qv(e,c,p));return{width:A.right-A.left,height:A.bottom-A.top,x:A.left,y:A.top}}function CC(r){const{width:e,height:n}=nw(r);return{width:e,height:n}}function MC(r,e,n){const l=ja(e),p=qa(e),v=n==="fixed",b=Vl(r,!0,v,e);let c={scrollLeft:0,scrollTop:0};const A=rl(0);if(l||!l&&!v)if((du(e)!=="body"||ad(p))&&(c=nm(e)),l){const j=Vl(e,!0,v,e);A.x=j.x+e.clientLeft,A.y=j.y+e.clientTop}else p&&(A.x=cy(p));let T=0,z=0;if(p&&!l&&!v){const j=p.getBoundingClientRect();z=j.top+c.scrollTop,T=j.left+c.scrollLeft-cy(p,j)}const B=b.left+c.scrollLeft-A.x-T,U=b.top+c.scrollTop-A.y-z;return{x:B,y:U,width:b.width,height:b.height}}function Mg(r){return ya(r).position==="static"}function Gv(r,e){if(!ja(r)||ya(r).position==="fixed")return null;if(e)return e(r);let n=r.offsetParent;return qa(r)===n&&(n=n.ownerDocument.body),n}function ow(r,e){const n=Rs(r);if(im(r))return n;if(!ja(r)){let p=il(r);for(;p&&!au(p);){if(ga(p)&&!Mg(p))return p;p=il(p)}return n}let l=Gv(r,e);for(;l&&_C(l)&&Mg(l);)l=Gv(l,e);return l&&au(l)&&Mg(l)&&!e_(l)?n:l||vC(r)||n}const DC=async function(r){const e=this.getOffsetParent||ow,n=this.getDimensions,l=await n(r.floating);return{reference:MC(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:l.width,height:l.height}}};function PC(r){return ya(r).direction==="rtl"}const LC={convertOffsetParentRelativeRectToViewportRelativeRect:wC,getDocumentElement:qa,getClippingRect:EC,getOffsetParent:ow,getElementRects:DC,getClientRects:SC,getDimensions:CC,getScale:Xc,isElement:ga,isRTL:PC};function zC(r,e){let n=null,l;const p=qa(r);function v(){var c;clearTimeout(l),(c=n)==null||c.disconnect(),n=null}function b(c,A){c===void 0&&(c=!1),A===void 0&&(A=1),v();const{left:T,top:z,width:B,height:U}=r.getBoundingClientRect();if(c||e(),!B||!U)return;const j=Sf(z),Q=Sf(p.clientWidth-(T+B)),ae=Sf(p.clientHeight-(z+U)),ne=Sf(T),_e={rootMargin:-j+"px "+-Q+"px "+-ae+"px "+-ne+"px",threshold:Rl(0,nu(1,A))||1};let de=!0;function pe(Te){const De=Te[0].intersectionRatio;if(De!==A){if(!de)return b();De?b(!1,De):l=setTimeout(()=>{b(!1,1e-7)},1e3)}de=!1}try{n=new IntersectionObserver(pe,{..._e,root:p.ownerDocument})}catch{n=new IntersectionObserver(pe,_e)}n.observe(r)}return b(!0),v}function Zv(r,e,n,l){l===void 0&&(l={});const{ancestorScroll:p=!0,ancestorResize:v=!0,elementResize:b=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:A=!1}=l,T=r_(r),z=p||v?[...T?Hh(T):[],...Hh(e)]:[];z.forEach(Y=>{p&&Y.addEventListener("scroll",n,{passive:!0}),v&&Y.addEventListener("resize",n)});const B=T&&c?zC(T,n):null;let U=-1,j=null;b&&(j=new ResizeObserver(Y=>{let[_e]=Y;_e&&_e.target===T&&j&&(j.unobserve(e),cancelAnimationFrame(U),U=requestAnimationFrame(()=>{var de;(de=j)==null||de.observe(e)})),n()}),T&&!A&&j.observe(T),j.observe(e));let Q,ae=A?Vl(r):null;A&&ne();function ne(){const Y=Vl(r);ae&&(Y.x!==ae.x||Y.y!==ae.y||Y.width!==ae.width||Y.height!==ae.height)&&n(),ae=Y,Q=requestAnimationFrame(ne)}return n(),()=>{var Y;z.forEach(_e=>{p&&_e.removeEventListener("scroll",n),v&&_e.removeEventListener("resize",n)}),B==null||B(),(Y=j)==null||Y.disconnect(),j=null,A&&cancelAnimationFrame(Q)}}const BC=gC,RC=yC,FC=pC,OC=fC,NC=(r,e,n)=>{const l=new Map,p={platform:LC,...n},v={...p.platform,_c:l};return dC(r,e,{...p,platform:v})};var UC=Xe("
"),$C=Xe("
"),VC=Xe(" ",1),jC=Xe(" ",1);function qC(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["activeContent","arrow","offset","placement","trigger","triggeredBy","reference","strategy","open","yOnly","middlewares"]);Pr(e,!1);const p=wt();let v=le(e,"activeContent",0,!1),b=le(e,"arrow",0,!0),c=le(e,"offset",0,8),A=le(e,"placement",0,"top"),T=le(e,"trigger",0,"hover"),z=le(e,"triggeredBy",8,()=>{}),B=le(e,"reference",8,()=>{}),U=le(e,"strategy",0,"absolute"),j=le(e,"open",4,!1),Q=le(e,"yOnly",0,!1),ae=le(e,"middlewares",8,()=>[FC(),RC()]);const ne=Jh();let Y=wt(),_e=wt(),de=wt(),pe=wt(),Te,De=wt(),je=wt(),ke=[];const $e=rt=>{oe(pe)===void 0&&console.error("trigger undefined"),!(!B()&&ke.includes(rt.target)&&oe(pe)!==rt.target&&(ot(pe,rt.target),j()))&&j(rt.type==="click"?!j():!0)},Me=rt=>rt.matches(":hover"),He=rt=>rt?`${rt}px`:"",Ye=rt=>{if(v()&&oe(de)){const Rt=[oe(pe),Te,...ke].filter(Boolean);setTimeout(()=>{rt.type==="mouseleave"&&!Rt.some(Me)&&j(!1)},100)}else j(!1)};let Pe=wt();const tt={left:"right",right:"left",bottom:"top",top:"bottom"};function Je(){NC(oe(pe),Te,{placement:A(),strategy:U(),middleware:oe(p)}).then(({x:rt,y:Rt,middlewareData:yr,placement:_t,strategy:Ge})=>{Te.style.position=Ge,Te.style.left=Q()?"0":He(rt),Te.style.top=He(Rt),yr.arrow&&oe(De)instanceof HTMLDivElement&&(Rh(De,oe(De).style.left=He(yr.arrow.x)),Rh(De,oe(De).style.top=He(yr.arrow.y)),ot(Pe,tt[_t.split("-")[0]]),Rh(De,oe(De).style[oe(Pe)]=He(-oe(De).offsetWidth/2-(n.border?1:0))))})}function lt(rt,Rt){Te=rt;let yr=Zv(Rt,Te,Je);return{update(_t){yr(),yr=Zv(_t,Te,Je)},destroy(){yr()}}}Gp(()=>{const rt=[["focusin",$e,oe(Y)],["focusout",Ye,oe(Y)],["click",$e,oe(_e)],["mouseenter",$e,oe(de)],["mouseleave",Ye,oe(de)]];return z()?ke=[...document.querySelectorAll(z())]:ke=oe(je).previousElementSibling?[oe(je).previousElementSibling]:[],ke.length||console.error("No triggers found."),ke.forEach(Rt=>{Rt.tabIndex<0&&(Rt.tabIndex=0);for(const[yr,_t,Ge]of rt)Ge&&Rt.addEventListener(yr,_t)}),B()?(ot(pe,document.querySelector(B())??document.body),oe(pe)===document.body?console.error(`Popup reference not found: '${B()}'`):(oe(Y)&&oe(pe).addEventListener("focusout",Ye),oe(de)&&oe(pe).addEventListener("mouseleave",Ye))):ot(pe,ke[0]),oe(_e)&&document.addEventListener("click",At),()=>{ke.forEach(Rt=>{if(Rt)for(const[yr,_t]of rt)Rt.removeEventListener(yr,_t)}),oe(pe)&&(oe(pe).removeEventListener("focusout",Ye),oe(pe).removeEventListener("mouseleave",Ye)),document.removeEventListener("click",At)}});function At(rt){j()&&!rt.composedPath().includes(Te)&&!ke.some(Rt=>rt.composedPath().includes(Rt))&&Ye(rt)}function Ze(rt,Rt){return rt?Rt:()=>{}}let ft=wt();function St(rt){return ot(De,rt),{destroy(){ot(De,null)}}}bt(()=>ze(T()),()=>{ot(Y,T()==="focus")}),bt(()=>ze(T()),()=>{ot(_e,T()==="click")}),bt(()=>ze(T()),()=>{ot(de,T()==="hover")}),bt(()=>ze(j()),()=>{ne("show",j())}),bt(()=>(ze(A()),oe(pe)),()=>{A()&&ot(pe,oe(pe))}),bt(()=>(ze(ae()),ze(c()),oe(De)),()=>{ot(p,[...ae(),BC(+c()),oe(De)&&OC({element:oe(De),padding:10})])}),bt(()=>(ze(n),oe(Pe)),()=>{ot(ft,Xy("absolute pointer-events-none block w-[10px] h-[10px] rotate-45 bg-inherit border-inherit",n.border&&oe(Pe)==="bottom"&&"border-b border-e",n.border&&oe(Pe)==="top"&&"border-t border-s ",n.border&&oe(Pe)==="right"&&"border-t border-e ",n.border&&oe(Pe)==="left"&&"border-b border-s "))}),_i(),zr();var gt=jC(),Ct=ct(gt);pr(Ct,()=>!oe(pe),rt=>{var Rt=UC();Ol(Rt,yr=>ot(je,yr),()=>oe(je)),xe(rt,Rt)});var Mt=we(we(Ct,!0));pr(Mt,()=>oe(pe),rt=>{var Rt=Yo(()=>v()?-1:void 0);qE(rt,qp({use:lt,get options(){return oe(pe)},get open(){return j()},set open(yr){j(yr)},role:"tooltip",get tabindex(){return oe(Rt)}},()=>l,{$$events:{focusin:Ze(v()&&oe(Y),$e),focusout:Ze(v()&&oe(Y),Ye),mouseenter:Ze(v()&&oe(de),$e),mouseleave:Ze(v()&&oe(de),Ye)},children:(yr,_t)=>{var Ge=VC(),Nt=ct(Ge);hr(Nt,Wr(e),{},null);var Ot=we(we(Nt,!0));pr(Ot,b,Ir=>{var cr=$C();Pt(()=>En(cr,oe(ft))),Ko(cr,Jr=>St(Jr)),xe(Ir,cr)}),xe(yr,Ge)},$$slots:{default:!0},$$legacy:!0}))}),xe(r,gt),Lr()}var GC=Xe("
"),ZC=Xe("
"),WC=Xe("
",1);function i_(r,e){const n=Ib(e),l=sr(e,["children","$$slots","$$events","$$legacy"]),p=sr(l,["activeUrl","open","containerClass","classContainer","headerClass","classHeader","footerClass","classFooter","activeClass","classActive","arrow","trigger","placement","color","shadow","rounded"]);Pr(e,!1);const v=wt(),b=wt(),c=wt(),A=wt();let T=le(e,"activeUrl",8,()=>{}),z=le(e,"open",4,!1),B=le(e,"containerClass",0,"divide-y z-50"),U=le(e,"classContainer",8,()=>{}),j=le(e,"headerClass",0,"py-1 overflow-hidden rounded-t-lg"),Q=le(e,"classHeader",8,()=>{}),ae=le(e,"footerClass",0,"py-1 overflow-hidden rounded-b-lg"),ne=le(e,"classFooter",8,()=>{}),Y=le(e,"activeClass",0,"text-primary-700 dark:text-primary-700 hover:text-primary-900 dark:hover:text-primary-900"),_e=le(e,"classActive",8,()=>{}),de=le(e,"arrow",0,!1),pe=le(e,"trigger",0,"click"),Te=le(e,"placement",0,"bottom"),De=le(e,"color",0,"dropdown"),je=le(e,"shadow",0,!0),ke=le(e,"rounded",0,!0);const $e=ci("");let Me=$r(Y(),_e());Wn("DropdownType",{activeClass:Me}),Wn("activeUrl",$e),bt(()=>ze(T()),()=>{$e.set(T()??"")}),bt(()=>(ze(B()),ze(U())),()=>{ot(v,$r(B(),U()))}),bt(()=>(ze(j()),ze(Q())),()=>{ot(b,$r(j(),Q()))}),bt(()=>ze(l),()=>{ot(c,$r("py-1",l.class))}),bt(()=>(ze(ae()),ze(ne())),()=>{ot(A,$r(ae(),ne()))}),_i(),zr(),qC(r,qp({activeContent:!0},()=>p,{get trigger(){return pe()},get arrow(){return de()},get placement(){return Te()},get shadow(){return je()},get rounded(){return ke()},get color(){return De()},get class(){return oe(v)},get open(){return z()},set open(He){z(He)},$$events:{show(He){Ne.call(this,e,He)}},children:(He,Ye)=>{var Pe=WC(),tt=ct(Pe);pr(tt,()=>n.header,Ze=>{var gt;var ft=GC(),St=ut(ft);hr(St,(gt=e.$$slots)==null?void 0:gt.header,{},null),ht(ft),Pt(()=>En(ft,oe(b))),xe(Ze,ft)});var Je=we(we(tt,!0)),lt=ut(Je);hr(lt,Wr(e),{},null),ht(Je);var At=we(we(Je,!0));pr(At,()=>n.footer,Ze=>{var gt;var ft=ZC(),St=ut(ft);hr(St,(gt=e.$$slots)==null?void 0:gt.footer,{},null),ht(ft),Pt(()=>En(ft,oe(A))),xe(Ze,ft)}),Pt(()=>En(Je,oe(c))),xe(He,Pe)},$$slots:{default:!0},$$legacy:!0})),Lr()}function lw(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["tag","show","use"]);let p=le(e,"tag",0,"div"),v=le(e,"show"),b=le(e,"use",0,()=>{});var c=nr(),A=ct(c);pr(A,v,T=>{var z=nr(),B=ct(z);Uh(B,p,!1,(U,j)=>{let Q;Pt(()=>Q=$h(U,Q,{...l},"")),Ko(U,Y=>b()(Y));var ae=nr(),ne=ct(ae);hr(ne,Wr(e),{},null),xe(j,ae)}),xe(T,z)},T=>{var z=nr(),B=ct(z);hr(B,Wr(e),{},null),xe(T,z)}),xe(r,c)}function n_(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["defaultClass","href","activeClass"]);Pr(e,!1);const p=wt(),v=wt();let b=le(e,"defaultClass",0,"font-medium py-2 px-4 text-sm hover:bg-gray-100 dark:hover:bg-gray-600"),c=le(e,"href",8,()=>{}),A=le(e,"activeClass",8,()=>{});const T=Zi("DropdownType")??{},z=Zi("activeUrl");let B=wt("");z.subscribe(Q=>{ot(B,Q)});let U=wt(!0);function j(Q){var ae;ot(U,((ae=Q.parentElement)==null?void 0:ae.tagName)==="UL")}bt(()=>(oe(B),ze(c())),()=>{ot(p,oe(B)?c()===oe(B):!1)}),bt(()=>(ze(b()),ze(c()),oe(p),ze(A()),ze(n)),()=>{ot(v,$r(b(),c()?"block":"w-full text-left",oe(p)&&(A()??T.activeClass),n.class))}),_i(),zr(),lw(r,{tag:"li",get show(){return oe(U)},use:j,children:(Q,ae)=>{var ne=nr(),Y=ct(ne);Uh(Y,()=>c()?"a":"button",!1,(_e,de)=>{let pe;Pt(()=>pe=$h(_e,pe,{href:c(),type:c()?void 0:"button",role:c()?"link":"button",...l,class:oe(v)},"")),Ve("click",_e,function(je){Ne.call(this,e,je)}),Ve("change",_e,function(je){Ne.call(this,e,je)}),Ve("keydown",_e,function(je){Ne.call(this,e,je)}),Ve("keyup",_e,function(je){Ne.call(this,e,je)}),Ve("focus",_e,function(je){Ne.call(this,e,je)}),Ve("blur",_e,function(je){Ne.call(this,e,je)}),Ve("mouseenter",_e,function(je){Ne.call(this,e,je)}),Ve("mouseleave",_e,function(je){Ne.call(this,e,je)});var Te=nr(),De=ct(Te);hr(De,Wr(e),{},null),xe(de,Te)}),xe(Q,ne)},$$slots:{default:!0},$$legacy:!0}),Lr()}var HC=Xe("");function qo(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["color","defaultClass","show"]);Pr(e,!1);const p=wt();let v=le(e,"color",4,"gray"),b=le(e,"defaultClass",0,"text-sm rtl:text-right font-medium block"),c=le(e,"show",0,!0),A=wt();const T={gray:"text-gray-900 dark:text-gray-300",green:"text-green-700 dark:text-green-500",red:"text-red-700 dark:text-red-500",disabled:"text-gray-400 dark:text-gray-500 grayscale contrast-50"};bt(()=>(oe(A),ze(v())),()=>{var j;const U=(j=oe(A))==null?void 0:j.control;v(U!=null&&U.disabled?"disabled":v())}),bt(()=>(ze(b()),ze(v()),ze(n)),()=>{ot(p,$r(b(),T[v()],n.class))}),_i(),zr();var z=nr(),B=ct(z);pr(B,c,U=>{var j=HC();Ol(j,ne=>ot(A,ne),()=>oe(A));let Q;var ae=ut(j);hr(ae,Wr(e),{},null),ht(j),Pt(()=>Q=Ui(j,Q,{...l,class:oe(p)},!0,"")),xe(U,j)},U=>{var j=nr(),Q=ct(j);hr(Q,Wr(e),{},null),xe(U,j)}),xe(r,z),Lr()}var YC=Xe("
"),KC=Xe(""),XC=Xe("
"),JC=Xe(" ",1);function QC(r){return r&&r==="xs"?"sm":r==="xl"?"lg":r}function uy(r,e){const n=Ib(e),l=sr(e,["children","$$slots","$$events","$$legacy"]),p=sr(l,["type","value","size","clearable","defaultClass","color","floatClass"]);Pr(e,!1);const v=wt();let b=le(e,"type",0,"text"),c=le(e,"value",12,()=>{}),A=le(e,"size",8,()=>{}),T=le(e,"clearable",0,!1),z=le(e,"defaultClass",0,"block w-full disabled:cursor-not-allowed disabled:opacity-50 rtl:text-right"),B=le(e,"color",0,"base"),U=le(e,"floatClass",0,"flex absolute inset-y-0 items-center text-gray-500 dark:text-gray-400");const j=Jh(),Q={base:"border border-gray-300 dark:border-gray-600",tinted:"border border-gray-300 dark:border-gray-500",green:"border border-green-500 dark:border-green-400",red:"border border-red-500 dark:border-red-400"},ae={base:"focus:border-primary-500 focus:ring-primary-500 dark:focus:border-primary-500 dark:focus:ring-primary-500",green:"focus:ring-green-500 focus:border-green-500 dark:focus:border-green-500 dark:focus:ring-green-500",red:"focus:ring-red-500 focus:border-red-500 dark:focus:ring-red-500 dark:focus:border-red-500"},ne={base:"bg-gray-50 text-gray-900 dark:bg-gray-700 dark:text-white dark:placeholder-gray-400",tinted:"bg-gray-50 text-gray-900 dark:bg-gray-600 dark:text-white dark:placeholder-gray-400",green:"bg-green-50 text-green-900 placeholder-green-700 dark:text-green-400 dark:placeholder-green-500 dark:bg-gray-700",red:"bg-red-50 text-red-900 placeholder-red-700 dark:text-red-500 dark:placeholder-red-500 dark:bg-gray-700"};let Y=Zi("background"),_e=Zi("group");const de={sm:"sm:text-xs",md:"text-sm",lg:"sm:text-base"},pe={sm:"ps-9",md:"ps-10",lg:"ps-11"},Te={sm:"pe-9",md:"pe-10",lg:"pe-11"},De={sm:"p-2",md:"p-2.5",lg:"p-3"};let je=wt();const ke=Me=>{Me.stopPropagation(),c(void 0),j("change")};bt(()=>ze(A()),()=>{ot(v,A()||QC(_e==null?void 0:_e.size)||"md")}),bt(()=>(ze(B()),ze(z()),oe(v),ze(T()),ze(l)),()=>{const Me=B()==="base"&&Y?"tinted":B();ot(je,$r([z(),De[oe(v)],n.left&&pe[oe(v)]||(T()||n.right)&&Te[oe(v)],ae[B()],ne[Me],Q[Me],de[oe(v)],_e||"rounded-lg",_e&&"first:rounded-s-lg last:rounded-e-lg",_e&&"[&:not(:first-child)]:-ms-px",l.class]))}),_i(),zr();var $e=Yo(()=>n.left||n.right);lw(r,{class:"relative w-full",get show(){return oe($e)},children:(Me,He)=>{var Ye=JC(),Pe=ct(Ye);pr(Pe,()=>n.left,At=>{var St;var Ze=YC();Pt(()=>En(Ze,`${$r(U(),l.classLeft)??""} start-0 ps-2.5 pointer-events-none`));var ft=ut(Ze);hr(ft,(St=e.$$slots)==null?void 0:St.left,{},null),ht(Ze),xe(At,Ze)});var tt=we(we(Pe,!0));hr(tt,Wr(e),{get props(){return{...p,class:oe(je)}}},At=>{var Ze=KC();Zp(Ze);let ft;Pt(()=>ft=Ui(Ze,ft,{...p,type:b(),class:oe(je)},!0,"")),Wp(Ze,c,St=>c(St)),Ve("blur",Ze,function(St){Ne.call(this,e,St)}),Ve("change",Ze,function(St){Ne.call(this,e,St)}),Ve("click",Ze,function(St){Ne.call(this,e,St)}),Ve("contextmenu",Ze,function(St){Ne.call(this,e,St)}),Ve("focus",Ze,function(St){Ne.call(this,e,St)}),Ve("keydown",Ze,function(St){Ne.call(this,e,St)}),Ve("keypress",Ze,function(St){Ne.call(this,e,St)}),Ve("keyup",Ze,function(St){Ne.call(this,e,St)}),Ve("mouseover",Ze,function(St){Ne.call(this,e,St)}),Ve("mouseenter",Ze,function(St){Ne.call(this,e,St)}),Ve("mouseleave",Ze,function(St){Ne.call(this,e,St)}),Ve("paste",Ze,function(St){Ne.call(this,e,St)}),Ve("input",Ze,function(St){Ne.call(this,e,St)}),xe(At,Ze)});var Je=we(we(tt,!0));pr(Je,()=>n.right,At=>{var St;var Ze=XC();Pt(()=>En(Ze,`${$r(U(),l.classRight)??""} end-0 pe-2.5`));var ft=ut(Ze);hr(ft,(St=e.$$slots)==null?void 0:St.right,{},null),ht(Ze),xe(At,Ze)});var lt=we(we(Je,!0));pr(lt,()=>T()&&c()&&`${c()}`.length>0,At=>{var Ze=Yo(()=>` ${$r(U(),l.classRight)??""} focus:ring-0 end-6 focus:ring-gray-400 dark:text-white`);J1(At,{get size(){return A()},color:"none",get class(){return oe(Ze)},$$events:{click:ke},$$legacy:!0})}),xe(Me,Ye)},$$slots:{default:!0},$$legacy:!0}),Lr()}var eM=Xe("");function Wv(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["value"]);let p=le(e,"value",4,0);uy(r,qp(()=>l,{children:wb,$$slots:{default:(v,b)=>{const c=Yo(()=>b.props);var A=eM();Zp(A);let T;Pt(()=>T=Ui(A,T,{...oe(c),type:"number"},!0,"")),Wp(A,p,z=>p(z)),Ve("blur",A,function(z){Ne.call(this,e,z)}),Ve("change",A,function(z){Ne.call(this,e,z)}),Ve("click",A,function(z){Ne.call(this,e,z)}),Ve("contextmenu",A,function(z){Ne.call(this,e,z)}),Ve("focus",A,function(z){Ne.call(this,e,z)}),Ve("keydown",A,function(z){Ne.call(this,e,z)}),Ve("keypress",A,function(z){Ne.call(this,e,z)}),Ve("keyup",A,function(z){Ne.call(this,e,z)}),Ve("mouseover",A,function(z){Ne.call(this,e,z)}),Ve("mouseenter",A,function(z){Ne.call(this,e,z)}),Ve("mouseleave",A,function(z){Ne.call(this,e,z)}),Ve("paste",A,function(z){Ne.call(this,e,z)}),Ve("input",A,function(z){Ne.call(this,e,z)}),xe(v,A)}},$$legacy:!0}))}function tM(r){const e=Math.cos(r*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}var rM=hs('');function iM(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["color","bg","customColor","size","currentFill","currentColor"]);Pr(e,!1);let p=le(e,"color",4,"primary"),v=le(e,"bg",0,"text-gray-300"),b=le(e,"customColor",0,""),c=le(e,"size",0,"8"),A=le(e,"currentFill",0,"currentFill"),T=le(e,"currentColor",0,"currentColor"),z=`w-${c()} h-${c()}`;A()!=="currentFill"&&p(void 0);const B={primary:"fill-primary-600",blue:"fill-blue-600",gray:"fill-gray-600 dark:fill-gray-300",green:"fill-green-500",red:"fill-red-600",yellow:"fill-yellow-400",pink:"fill-pink-600",purple:"fill-purple-600",white:"fill-white",custom:b()};let U=p()===void 0?"":B[p()]??B.blue;zr();var j=rM();let Q;var ae=ut(j),ne=we(ae);ht(j),Pt(()=>{Q=Ui(j,Q,{...l,role:"status",class:$r("inline -mt-px animate-spin dark:text-gray-600",z,v(),U,n.class),viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg"},!1,""),Ai(ae,"fill",T()),Ai(ne,"fill",A())}),xe(r,j),Lr()}var nM=hs(''),sM=Xe('
'),aM=Xe("
");function Lp(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["divClass","striped","hoverable","noborder","shadow","color","customeColor","items","filter","placeholder","innerDivClass","searchClass","svgDivClass","svgClass","inputClass"]);Pr(e,!1);let p=le(e,"divClass",0,"relative overflow-x-auto"),v=le(e,"striped",0,!1),b=le(e,"hoverable",0,!1),c=le(e,"noborder",0,!1),A=le(e,"shadow",0,!1),T=le(e,"color",0,"default"),z=le(e,"customeColor",0,""),B=le(e,"items",8,()=>[]),U=le(e,"filter",0,null),j=le(e,"placeholder",0,"Search"),Q=le(e,"innerDivClass",0,"p-4"),ae=le(e,"searchClass",0,"relative mt-1"),ne=le(e,"svgDivClass",0,"absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none"),Y=le(e,"svgClass",0,"w-5 h-5 text-gray-500 dark:text-gray-400"),_e=le(e,"inputClass",0,"bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-80 p-2.5 ps-10 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"),de=wt(""),pe=$r(_e(),n.classInput),Te=$r(ne(),n.classSvgDiv);const De={default:"text-gray-500 dark:text-gray-400",blue:"text-blue-100 dark:text-blue-100",green:"text-green-100 dark:text-green-100",red:"text-red-100 dark:text-red-100",yellow:"text-yellow-100 dark:text-yellow-100",purple:"text-purple-100 dark:text-purple-100",indigo:"text-indigo-100 dark:text-indigo-100",pink:"text-pink-100 dark:text-pink-100",custom:z()},je=ci(oe(de)),ke=ci(U());Wn("searchTerm",je),Wn("filter",ke),Wn("sorter",ci(null)),bt(()=>ze(v()),()=>{Wn("striped",v())}),bt(()=>ze(b()),()=>{Wn("hoverable",b())}),bt(()=>ze(c()),()=>{Wn("noborder",c())}),bt(()=>ze(T()),()=>{Wn("color",T())}),bt(()=>ze(B()),()=>{Wn("items",B())}),bt(()=>oe(de),()=>{je.set(oe(de))}),bt(()=>ze(U()),()=>{U()&&ke.set(U())}),_i(),zr();var $e=aM();Pt(()=>En($e,Xy(p(),A()&&"shadow-md sm:rounded-lg")));var Me=ut($e);pr(Me,U,tt=>{var At;var Je=nr(),lt=ct(Je);hr(lt,(At=e.$$slots)==null?void 0:At.search,{},Ze=>{var yr,_t;var ft=sM(),St=ut(ft),gt=we(we(St,!0)),Ct=ut(gt);En(Ct,Te);var Mt=ut(Ct);hr(Mt,(yr=e.$$slots)==null?void 0:yr.svgSearch,{},Ge=>{var Nt=nM();ut(Nt),ht(Nt),Pt(()=>Eb(Nt,Y())),xe(Ge,Nt)}),ht(Ct);var rt=we(we(Ct,!0));Zp(rt),En(rt,pe),ht(gt);var Rt=we(we(gt,!0));hr(Rt,(_t=e.$$slots)==null?void 0:_t.header,{},null),ht(ft),Pt(()=>{En(ft,Q()),En(gt,ae()),Ai(rt,"placeholder",j())}),Wp(rt,()=>oe(de),Ge=>ot(de,Ge)),xe(Ze,ft)}),xe(tt,Je)});var He=we(we(Me,!0));let Ye;var Pe=ut(He);hr(Pe,Wr(e),{},null),ht(He),ht($e),Pt(()=>Ye=Ui(He,Ye,{...l,class:$r("w-full text-left text-sm",De[T()],n.class)},!0,"")),xe(r,$e),Lr()}var oM=Xe("");function zp(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["tableBodyClass"]);Pr(e,!1);const p=Cn(),v=()=>br(U,"$filter",p),b=()=>br(j,"$searchTerm",p),c=()=>br(Q,"$sorter",p),A=wt(),T=wt(),z=wt();let B=le(e,"tableBodyClass",8,()=>{}),U=Zi("filter"),j=Zi("searchTerm"),Q=Zi("sorter");bt(()=>{},()=>{ot(A,Zi("items")||[])}),bt(()=>(v(),oe(A),b()),()=>{ot(T,v()?oe(A).filter(de=>v()(de,b())):oe(A))}),bt(()=>(c(),oe(T)),()=>{ot(z,c()?oe(T).toSorted((de,pe)=>c().sortDirection*c().sort(de,pe)):oe(T))}),_i(),zr();var ae=oM();let ne;var Y=ut(ae);hr(Y,Wr(e),{},null);var _e=we(Y);Oa(_e,1,()=>oe(z),Fa,(de,pe,Te)=>{var ke;var De=nr(),je=ct(De);hr(je,(ke=e.$$slots)==null?void 0:ke.row,{get item(){return Pi(pe)}},null),xe(de,De)}),ht(ae),Pt(()=>ne=Ui(ae,ne,{...l,class:B()},!0,"")),xe(r,ae),Lr()}var lM=Xe(""),cM=Xe("");function ws(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["tdClass"]);Pr(e,!1);let p=le(e,"tdClass",0,"px-6 py-4 whitespace-nowrap font-medium "),v=wt("default");ot(v,Zi("color"));let b=wt();bt(()=>(ze(p()),oe(v),ze(n)),()=>{ot(b,$r(p(),oe(v)==="default"?"text-gray-900 dark:text-white":"text-blue-50 whitespace-nowrap dark:text-blue-100",n.class))}),_i(),zr();var c=cM();let A;var T=ut(c);pr(T,()=>n.onclick,z=>{var B=lM(),U=ut(B);hr(U,Wr(e),{},null),ht(B),Ve("click",B,n.onclick,!1),xe(z,B)},z=>{var B=nr(),U=ct(B);hr(U,Wr(e),{},null),xe(z,B)}),ht(c),Pt(()=>A=Ui(c,A,{...l,class:oe(b)},!0,"")),xe(r,c),Lr()}var uM=Xe("");function Bp(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["color"]);Pr(e,!1);let p=le(e,"color",8,()=>Zi("color"));const v={default:"bg-white dark:bg-gray-800 dark:border-gray-700",blue:"bg-blue-500 border-blue-400",green:"bg-green-500 border-green-400",red:"bg-red-500 border-red-400",yellow:"bg-yellow-500 border-yellow-400",purple:"bg-purple-500 border-purple-400",custom:""},b={default:"hover:bg-gray-50 dark:hover:bg-gray-600",blue:"hover:bg-blue-400",green:"hover:bg-green-400",red:"hover:bg-red-400",yellow:"hover:bg-yellow-400",purple:"hover:bg-purple-400",custom:""},c={default:"odd:bg-white even:bg-gray-50 odd:dark:bg-gray-800 even:dark:bg-gray-700",blue:"odd:bg-blue-800 even:bg-blue-700 odd:dark:bg-blue-800 even:dark:bg-blue-700",green:"odd:bg-green-800 even:bg-green-700 odd:dark:bg-green-800 even:dark:bg-green-700",red:"odd:bg-red-800 even:bg-red-700 odd:dark:bg-red-800 even:dark:bg-red-700",yellow:"odd:bg-yellow-800 even:bg-yellow-700 odd:dark:bg-yellow-800 even:dark:bg-yellow-700",purple:"odd:bg-purple-800 even:bg-purple-700 odd:dark:bg-purple-800 even:dark:bg-purple-700",custom:""};let A=wt();bt(()=>(ze(p()),ze(n)),()=>{ot(A,$r([!Zi("noborder")&&"border-b last:border-b-0",v[p()],Zi("hoverable")&&b[p()],Zi("striped")&&c[p()],n.class]))}),_i(),zr();var T=uM();let z;var B=ut(T);hr(B,Wr(e),{},null),ht(T),Pt(()=>z=Ui(T,z,{...l,class:oe(A)},!0,"")),Ve("click",T,function(U){Ne.call(this,e,U)}),Ve("contextmenu",T,function(U){Ne.call(this,e,U)}),Ve("dblclick",T,function(U){Ne.call(this,e,U)}),xe(r,T),Lr()}var hM=Xe(""),dM=Xe("");function Rp(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["theadClass","defaultRow"]);Pr(e,!1);const p=wt();let v=le(e,"theadClass",0,"text-xs uppercase"),b=le(e,"defaultRow",0,!0),c=wt();ot(c,Zi("color"));let A=Zi("noborder"),T=Zi("striped");const B={default:A||T?"":"bg-gray-50 dark:bg-gray-700",blue:"bg-blue-600",green:"bg-green-600",red:"bg-red-600",yellow:"bg-yellow-600",purple:"bg-purple-600",custom:""};let U=oe(c)==="default"?"text-gray-700 dark:text-gray-400":oe(c)==="custom"?"":"text-white dark:text-white",j=T?"":oe(c)==="default"?"border-gray-700":oe(c)==="custom"?"":`border-${oe(c)}-400`;bt(()=>(ze(v()),oe(c),ze(n)),()=>{ot(p,$r(v(),U,T&&j,B[oe(c)],n.class))}),_i(),zr();var Q=dM();let ae;var ne=ut(Q);pr(ne,b,Y=>{var _e=hM(),de=ut(_e);hr(de,Wr(e),{},null),ht(_e),xe(Y,_e)},Y=>{var _e=nr(),de=ct(_e);hr(de,Wr(e),{},null),xe(Y,_e)}),ht(Q),Pt(()=>ae=Ui(Q,ae,{...l,class:oe(p)},!0,"")),xe(r,Q),Lr()}var fM=Xe(""),pM=Xe("");function os(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["padding","sort","defaultDirection","defaultSort","direction"]);Pr(e,!1);const p=Cn(),v=()=>br(B,"$sorter",p);let b=le(e,"padding",0,"px-6 py-3"),c=le(e,"sort",0,null),A=le(e,"defaultDirection",0,"asc"),T=le(e,"defaultSort",0,!1),z=le(e,"direction",12,()=>T()?A():null),B=Zi("sorter"),U=Math.random().toString(36).substring(2);T()&&j();function j(){!c()||!B||B.update(ne=>({id:U,sort:c(),sortDirection:(ne==null?void 0:ne.id)===U?-ne.sortDirection:A()==="asc"?1:-1}))}bt(()=>v(),()=>{var ne;z(((ne=v())==null?void 0:ne.id)===U?v().sortDirection===1?"asc":"desc":null)}),_i(),zr();var Q=nr(),ae=ct(Q);pr(ae,()=>c()&&B,ne=>{var Y=fM();let _e;var de=ut(Y);Pt(()=>En(de,$r("w-full text-left","after:absolute after:pl-3",z()==="asc"&&'after:content-["▲"]',z()==="desc"&&'after:content-["▼"]',b())));var pe=ut(de);hr(pe,Wr(e),{},null),ht(de),ht(Y),Pt(()=>_e=Ui(Y,_e,{...l,class:n.class,"aria-sort":z()?`${z()}ending`:void 0},!0,"")),Ve("click",Y,function(Te){Ne.call(this,e,Te)}),Ve("focus",Y,function(Te){Ne.call(this,e,Te)}),Ve("keydown",Y,function(Te){Ne.call(this,e,Te)}),Ve("keypress",Y,function(Te){Ne.call(this,e,Te)}),Ve("keyup",Y,function(Te){Ne.call(this,e,Te)}),Ve("mouseenter",Y,function(Te){Ne.call(this,e,Te)}),Ve("mouseleave",Y,function(Te){Ne.call(this,e,Te)}),Ve("mouseover",Y,function(Te){Ne.call(this,e,Te)}),Ve("click",de,j,!1),xe(ne,Y)},ne=>{var Y=pM();let _e;var de=ut(Y);hr(de,Wr(e),{},null),ht(Y),Pt(()=>_e=Ui(Y,_e,{...l,class:$r(b(),n.class)},!0,"")),Ve("click",Y,function(pe){Ne.call(this,e,pe)}),Ve("focus",Y,function(pe){Ne.call(this,e,pe)}),Ve("keydown",Y,function(pe){Ne.call(this,e,pe)}),Ve("keypress",Y,function(pe){Ne.call(this,e,pe)}),Ve("keyup",Y,function(pe){Ne.call(this,e,pe)}),Ve("mouseenter",Y,function(pe){Ne.call(this,e,pe)}),Ve("mouseleave",Y,function(pe){Ne.call(this,e,pe)}),Ve("mouseover",Y,function(pe){Ne.call(this,e,pe)}),xe(ne,Y)}),xe(r,Q),Lr()}var mM=Xe(''),gM=Xe('
  • ');function If(r,e){var de;const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["open","title","activeClasses","inactiveClasses","defaultClass","divClass"]);Pr(e,!1);let p=le(e,"open",4,!1),v=le(e,"title",0,"Tab title"),b=le(e,"activeClasses",8,()=>{}),c=le(e,"inactiveClasses",8,()=>{}),A=le(e,"defaultClass",0,"inline-block text-sm font-medium text-center disabled:cursor-not-allowed"),T=le(e,"divClass",0,"");const z=Zi("ctx")??{},B=z.selected??ci();function U(pe){return B.set(pe),{destroy:B.subscribe(De=>{De!==pe&&p(!1)})}}let j=wt();bt(()=>(ze(A()),ze(p()),ze(b()),ze(c())),()=>{ot(j,$r(A(),p()?b()??z.activeClasses:c()??z.inactiveClasses,p()&&"active"))}),_i(),zr();var Q=gM();Pt(()=>En(Q,$r("group",n.class)));var ae=ut(Q);let ne;var Y=ut(ae);hr(Y,(de=e.$$slots)==null?void 0:de.title,{},pe=>{var Te=Hn();Pt(()=>gi(Te,v())),xe(pe,Te)}),ht(ae);var _e=we(we(ae,!0));pr(_e,p,pe=>{var Te=mM(),De=ut(Te),je=ut(De);hr(je,Wr(e),{},null),ht(De),ht(Te),Pt(()=>En(De,T())),Ko(De,ke=>U(ke)),xe(pe,Te)}),ht(Q),Pt(()=>ne=Ui(ae,ne,{type:"button",role:"tab",...l,class:oe(j)},!0,"")),Ve("click",ae,()=>p(!0),!1),Ve("blur",ae,function(pe){Ne.call(this,e,pe)}),Ve("click",ae,function(pe){Ne.call(this,e,pe)}),Ve("contextmenu",ae,function(pe){Ne.call(this,e,pe)}),Ve("focus",ae,function(pe){Ne.call(this,e,pe)}),Ve("keydown",ae,function(pe){Ne.call(this,e,pe)}),Ve("keypress",ae,function(pe){Ne.call(this,e,pe)}),Ve("keyup",ae,function(pe){Ne.call(this,e,pe)}),Ve("mouseenter",ae,function(pe){Ne.call(this,e,pe)}),Ve("mouseleave",ae,function(pe){Ne.call(this,e,pe)}),Ve("mouseover",ae,function(pe){Ne.call(this,e,pe)}),xe(r,Q),Lr()}var yM=Xe('
    '),_M=Xe('
    ',1);function vM(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["tabStyle","defaultClass","contentClass","divider","activeClasses","inactiveClasses"]);Pr(e,!1);const p=wt();let v=le(e,"tabStyle",0,"none"),b=le(e,"defaultClass",0,"flex flex-wrap space-x-2 rtl:space-x-reverse"),c=le(e,"contentClass",0,"p-4 bg-gray-50 rounded-lg dark:bg-gray-800 mt-4"),A=le(e,"divider",4,!0),T=le(e,"activeClasses",0,"p-4 text-primary-600 bg-gray-100 rounded-t-lg dark:bg-gray-800 dark:text-primary-500"),z=le(e,"inactiveClasses",0,"p-4 text-gray-500 rounded-t-lg hover:text-gray-600 hover:bg-gray-50 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-300");const B={full:"p-4 w-full group-first:rounded-s-lg group-last:rounded-e-lg text-gray-900 bg-gray-100 focus:ring-4 focus:ring-primary-300 focus:outline-none dark:bg-gray-700 dark:text-white",pill:"py-3 px-4 text-white bg-primary-600 rounded-lg",underline:"p-4 text-primary-600 border-b-2 border-primary-600 dark:text-primary-500 dark:border-primary-500",none:""},U={full:"p-4 w-full group-first:rounded-s-lg group-last:rounded-e-lg text-gray-500 dark:text-gray-400 bg-white hover:text-gray-700 hover:bg-gray-50 focus:ring-4 focus:ring-primary-300 focus:outline-none dark:hover:text-white dark:bg-gray-800 dark:hover:bg-gray-700",pill:"py-3 px-4 text-gray-500 rounded-lg hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-white",underline:"p-4 border-b-2 border-transparent hover:text-gray-600 hover:border-gray-300 dark:hover:text-gray-300 text-gray-500 dark:text-gray-400",none:""},j={activeClasses:B[v()]||T(),inactiveClasses:U[v()]||z(),selected:ci()};Wn("ctx",j);function Q(Te){return{destroy:j.selected.subscribe(je=>{je&&Te.replaceChildren(je)})}}bt(()=>(ze(A()),ze(v())),()=>{A(["full","pill"].includes(v())?!1:A())}),bt(()=>(ze(b()),ze(v()),ze(n)),()=>{ot(p,$r(b(),v()==="underline"&&"-mb-px",n.class))}),_i(),zr();var ae=_M(),ne=ct(ae);let Y;var _e=ut(ne);hr(_e,Wr(e),{get tabStyle(){return v()}},null),ht(ne);var de=we(we(ne,!0));pr(de,A,Te=>{var ke;var De=nr(),je=ct(De);hr(je,(ke=e.$$slots)==null?void 0:ke.divider,{},$e=>{var Me=yM();xe($e,Me)}),xe(Te,De)});var pe=we(we(de,!0));Pt(()=>{Y=Ui(ne,Y,{...l,class:oe(p)},!0,""),En(pe,c())}),Ko(pe,Te=>Q(Te)),xe(r,ae),Lr()}var bM=hs(" "),xM=hs(" "),wM=hs(''),SM=hs(" "),IM=hs(" "),TM=hs('');function kM(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["size","role","color","withEvents","title","strokeWidth","desc","ariaLabel"]);Pr(e,!1);const p=Zi("iconCtx")??{},v={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"};let b=le(e,"size",8,()=>p.size||"md"),c=le(e,"role",8,()=>p.role||"img"),A=le(e,"color",8,()=>p.color||"currentColor"),T=le(e,"withEvents",8,()=>p.withEvents||!1),z=le(e,"title",8,()=>({})),B=le(e,"strokeWidth",8,()=>p.strokeWidth||"2"),U=le(e,"desc",8,()=>({})),j=`${z().id||""} ${U().id||""}`,Q=wt(!1),ae=le(e,"ariaLabel",0,"chevron down outline");bt(()=>(ze(z()),ze(U())),()=>{z().id||U().id?ot(Q,!0):ot(Q,!1)}),_i(),zr();var ne=nr(),Y=ct(ne);pr(Y,T,_e=>{var de=wM();let pe;var Te=ut(de);pr(Te,()=>z().id&&z().title,ke=>{var $e=bM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",z().id),gi(Me,z().title)}),xe(ke,$e)});var De=we(Te);pr(De,()=>U().id&&U().desc,ke=>{var $e=xM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",U().id),gi(Me,U().desc)}),xe(ke,$e)});var je=we(De);ht(de),Pt(()=>{pe=Ui(de,pe,{xmlns:"http://www.w3.org/2000/svg",fill:"none",color:A(),...l,class:$r("shrink-0",v[b()??"md"],n.class),role:c(),"aria-label":ae(),"aria-describedby":oe(Q)?j:void 0,viewBox:"0 0 24 24"},!1,""),Ai(je,"stroke-width",B())}),Ve("click",de,function(ke){Ne.call(this,e,ke)}),Ve("keydown",de,function(ke){Ne.call(this,e,ke)}),Ve("keyup",de,function(ke){Ne.call(this,e,ke)}),Ve("focus",de,function(ke){Ne.call(this,e,ke)}),Ve("blur",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseenter",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseleave",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseover",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseout",de,function(ke){Ne.call(this,e,ke)}),xe(_e,de)},_e=>{var de=TM();let pe;var Te=ut(de);pr(Te,()=>z().id&&z().title,ke=>{var $e=SM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",z().id),gi(Me,z().title)}),xe(ke,$e)});var De=we(Te);pr(De,()=>U().id&&U().desc,ke=>{var $e=IM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",U().id),gi(Me,U().desc)}),xe(ke,$e)});var je=we(De);ht(de),Pt(()=>{pe=Ui(de,pe,{xmlns:"http://www.w3.org/2000/svg",fill:"none",color:A(),...l,class:$r("shrink-0",v[b()??"md"],n.class),role:c(),"aria-label":ae(),"aria-describedby":oe(Q)?j:void 0,viewBox:"0 0 24 24"},!1,""),Ai(je,"stroke-width",B())}),xe(_e,de)}),xe(r,ne),Lr()}var AM=hs(" "),EM=hs(" "),CM=hs(''),MM=hs(" "),DM=hs(" "),PM=hs('');function cw(r,e){const n=sr(e,["children","$$slots","$$events","$$legacy"]),l=sr(n,["size","role","color","withEvents","title","strokeWidth","desc","ariaLabel"]);Pr(e,!1);const p=Zi("iconCtx")??{},v={xs:"w-3 h-3",sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6",xl:"w-8 h-8"};let b=le(e,"size",8,()=>p.size||"md"),c=le(e,"role",8,()=>p.role||"img"),A=le(e,"color",8,()=>p.color||"currentColor"),T=le(e,"withEvents",8,()=>p.withEvents||!1),z=le(e,"title",8,()=>({})),B=le(e,"strokeWidth",8,()=>p.strokeWidth||"2"),U=le(e,"desc",8,()=>({})),j=`${z().id||""} ${U().id||""}`,Q=wt(!1),ae=le(e,"ariaLabel",0,"chevron right outline");bt(()=>(ze(z()),ze(U())),()=>{z().id||U().id?ot(Q,!0):ot(Q,!1)}),_i(),zr();var ne=nr(),Y=ct(ne);pr(Y,T,_e=>{var de=CM();let pe;var Te=ut(de);pr(Te,()=>z().id&&z().title,ke=>{var $e=AM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",z().id),gi(Me,z().title)}),xe(ke,$e)});var De=we(Te);pr(De,()=>U().id&&U().desc,ke=>{var $e=EM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",U().id),gi(Me,U().desc)}),xe(ke,$e)});var je=we(De);ht(de),Pt(()=>{pe=Ui(de,pe,{xmlns:"http://www.w3.org/2000/svg",fill:"none",color:A(),...l,class:$r("shrink-0",v[b()??"md"],n.class),role:c(),"aria-label":ae(),"aria-describedby":oe(Q)?j:void 0,viewBox:"0 0 24 24"},!1,""),Ai(je,"stroke-width",B())}),Ve("click",de,function(ke){Ne.call(this,e,ke)}),Ve("keydown",de,function(ke){Ne.call(this,e,ke)}),Ve("keyup",de,function(ke){Ne.call(this,e,ke)}),Ve("focus",de,function(ke){Ne.call(this,e,ke)}),Ve("blur",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseenter",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseleave",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseover",de,function(ke){Ne.call(this,e,ke)}),Ve("mouseout",de,function(ke){Ne.call(this,e,ke)}),xe(_e,de)},_e=>{var de=PM();let pe;var Te=ut(de);pr(Te,()=>z().id&&z().title,ke=>{var $e=MM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",z().id),gi(Me,z().title)}),xe(ke,$e)});var De=we(Te);pr(De,()=>U().id&&U().desc,ke=>{var $e=DM(),Me=ut($e);ht($e),Pt(()=>{Ai($e,"id",U().id),gi(Me,U().desc)}),xe(ke,$e)});var je=we(De);ht(de),Pt(()=>{pe=Ui(de,pe,{xmlns:"http://www.w3.org/2000/svg",fill:"none",color:A(),...l,class:$r("shrink-0",v[b()??"md"],n.class),role:c(),"aria-label":ae(),"aria-describedby":oe(Q)?j:void 0,viewBox:"0 0 24 24"},!1,""),Ai(je,"stroke-width",B())}),xe(_e,de)}),xe(r,ne),Lr()}var LM=Xe('

    Search for metrics to preview and download.

    ');function uw(r){var e=LM();ut(e),ht(e),xe(r,e)}let zM=Date.now();function s_(r){return`${r}-${zM++}`}const a_=Symbol.for("svelte-maplibre");function od(){return Zi(a_)}function BM(r){let e=new WeakMap;return n=>{var b;let l=e.get(n.originalEvent);if(l!==void 0)return l;let v=(b=n.target.queryRenderedFeatures(n.point).find(c=>{var A;return(A=r.get(c.layer.id))==null?void 0:A.interactive}))==null?void 0:b.layer.id;return e.set(n.originalEvent,v),v}}function RM(){let r=new Map;return Wn(a_,{map:ci(null),source:mg(null),layer:mg(null),popupTarget:mg(null),cluster:ci(),loadedImages:ci(new Set),minzoom:ci(0),maxzoom:ci(24),layerEvent:ci(null),layerInfo:r,eventTopMost:BM(r)})}function Hv(r){return{subscribe:r.subscribe}}function hw({key:r,setPopupTarget:e=!1,setCluster:n=!1,setMouseEvent:l=!1}){let p=od(),v=ci(null),b=Hv(v),c={...p,[r]:Hv(v)};if(e&&(c.popupTarget=b),l){let A=ci(null);c.layerEvent=A,p.layerEvent=A}return n&&(c.cluster=ci()),Wn(a_,c),{...p,self:v}}function FM(){return hw({key:"source",setCluster:!0})}function dw(r=!0){return hw({key:"layer",setPopupTarget:r,setMouseEvent:r})}var OM=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function NM(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var fw={exports:{}};(function(r,e){(function(n,l){r.exports=l()})(OM,function(){var n,l,p;function v(c,A){if(!n)n=A;else if(!l)l=A;else{var T="var sharedChunk = {}; ("+n+")(sharedChunk); ("+l+")(sharedChunk);",z={};n(z),p=A(z),typeof window<"u"&&(p.workerUrl=window.URL.createObjectURL(new Blob([T],{type:"text/javascript"})))}}v(["exports"],function(c){function A(s,t,a,u){return new(a||(a=Promise))(function(d,g){function _(E){try{I(u.next(E))}catch(M){g(M)}}function x(E){try{I(u.throw(E))}catch(M){g(M)}}function I(E){var M;E.done?d(E.value):(M=E.value,M instanceof a?M:new a(function(L){L(M)})).then(_,x)}I((u=u.apply(s,t||[])).next())})}function T(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}typeof SuppressedError=="function"&&SuppressedError;var z=B;function B(s,t){this.x=s,this.y=t}B.prototype={clone:function(){return new B(this.x,this.y)},add:function(s){return this.clone()._add(s)},sub:function(s){return this.clone()._sub(s)},multByPoint:function(s){return this.clone()._multByPoint(s)},divByPoint:function(s){return this.clone()._divByPoint(s)},mult:function(s){return this.clone()._mult(s)},div:function(s){return this.clone()._div(s)},rotate:function(s){return this.clone()._rotate(s)},rotateAround:function(s,t){return this.clone()._rotateAround(s,t)},matMult:function(s){return this.clone()._matMult(s)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(s){return this.x===s.x&&this.y===s.y},dist:function(s){return Math.sqrt(this.distSqr(s))},distSqr:function(s){var t=s.x-this.x,a=s.y-this.y;return t*t+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(s){return Math.atan2(this.y-s.y,this.x-s.x)},angleWith:function(s){return this.angleWithSep(s.x,s.y)},angleWithSep:function(s,t){return Math.atan2(this.x*t-this.y*s,this.x*s+this.y*t)},_matMult:function(s){var t=s[2]*this.x+s[3]*this.y;return this.x=s[0]*this.x+s[1]*this.y,this.y=t,this},_add:function(s){return this.x+=s.x,this.y+=s.y,this},_sub:function(s){return this.x-=s.x,this.y-=s.y,this},_mult:function(s){return this.x*=s,this.y*=s,this},_div:function(s){return this.x/=s,this.y/=s,this},_multByPoint:function(s){return this.x*=s.x,this.y*=s.y,this},_divByPoint:function(s){return this.x/=s.x,this.y/=s.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var s=this.y;return this.y=this.x,this.x=-s,this},_rotate:function(s){var t=Math.cos(s),a=Math.sin(s),u=a*this.x+t*this.y;return this.x=t*this.x-a*this.y,this.y=u,this},_rotateAround:function(s,t){var a=Math.cos(s),u=Math.sin(s),d=t.y+u*(this.x-t.x)+a*(this.y-t.y);return this.x=t.x+a*(this.x-t.x)-u*(this.y-t.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},B.convert=function(s){return s instanceof B?s:Array.isArray(s)?new B(s[0],s[1]):s};var U=T(z),j=Q;function Q(s,t,a,u){this.cx=3*s,this.bx=3*(a-s)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(u-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=s,this.p1y=t,this.p2x=a,this.p2y=u}Q.prototype={sampleCurveX:function(s){return((this.ax*s+this.bx)*s+this.cx)*s},sampleCurveY:function(s){return((this.ay*s+this.by)*s+this.cy)*s},sampleCurveDerivativeX:function(s){return(3*this.ax*s+2*this.bx)*s+this.cx},solveCurveX:function(s,t){if(t===void 0&&(t=1e-6),s<0)return 0;if(s>1)return 1;for(var a=s,u=0;u<8;u++){var d=this.sampleCurveX(a)-s;if(Math.abs(d)d?_=a:x=a,a=.5*(x-_)+_;return a},solve:function(s,t){return this.sampleCurveY(this.solveCurveX(s,t))}};var ae=T(j);let ne,Y;function _e(){return ne==null&&(ne=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ne}function de(){if(Y==null&&(Y=!1,_e())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let u=0;u<5*5;u++){const d=4*u;t.fillStyle=`rgb(${d},${d+1},${d+2})`,t.fillRect(u%5,Math.floor(u/5),1,1)}const a=t.getImageData(0,0,5,5).data;for(let u=0;u<5*5*4;u++)if(u%4!=3&&a[u]!==u){Y=!0;break}}}return Y||!1}function pe(s,t,a,u){const d=new ae(s,t,a,u);return function(g){return d.solve(g)}}const Te=pe(.25,.1,.25,1);function De(s,t,a){return Math.min(a,Math.max(t,s))}function je(s,t,a){const u=a-t,d=((s-t)%u+u)%u+t;return d===t?a:d}function ke(s,...t){for(const a of t)for(const u in a)s[u]=a[u];return s}let $e=1;function Me(s,t,a){const u={};for(const d in s)u[d]=t.call(a||this,s[d],d,s);return u}function He(s,t,a){const u={};for(const d in s)t.call(a||this,s[d],d,s)&&(u[d]=s[d]);return u}function Ye(s){return Array.isArray(s)?s.map(Ye):typeof s=="object"&&s?Me(s,Ye):s}const Pe={};function tt(s){Pe[s]||(typeof console<"u"&&console.warn(s),Pe[s]=!0)}function Je(s,t,a){return(a.y-s.y)*(t.x-s.x)>(t.y-s.y)*(a.x-s.x)}function lt(s){let t=0;for(let a,u,d=0,g=s.length,_=g-1;d"u")throw new Error("VideoFrame not supported");const g=new VideoFrame(s,{timestamp:0});try{const _=g==null?void 0:g.format;if(!_||!_.startsWith("BGR")&&!_.startsWith("RGB"))throw new Error(`Unrecognized format ${_}`);const x=_.startsWith("BGR"),I=new Uint8ClampedArray(u*d*4);if(yield g.copyTo(I,function(E,M,L,F,$){const V=4*Math.max(-M,0),Z=(Math.max(0,L)-L)*F*4+V,ee=4*F,ie=Math.max(0,M),ye=Math.max(0,L);return{rect:{x:ie,y:ye,width:Math.min(E.width,M+F)-ie,height:Math.min(E.height,L+$)-ye},layout:[{offset:Z,stride:ee}]}}(s,t,a,u,d)),x)for(let E=0;EcancelAnimationFrame(t)}},getImageData(s,t=0){return this.getImageCanvasContext(s).getImageData(-t,-t,s.width+2*t,s.height+2*t)},getImageCanvasContext(s){const t=window.document.createElement("canvas"),a=t.getContext("2d",{willReadFrequently:!0});if(!a)throw new Error("failed to create canvas 2d context");return t.width=s.width,t.height=s.height,a.drawImage(s,0,0,s.width,s.height),a},resolveURL:s=>(rt||(rt=document.createElement("a")),rt.href=s,rt.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Rt==null&&(Rt=matchMedia("(prefers-reduced-motion: reduce)")),Rt.matches)}},_t={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};class Ge extends Error{constructor(t,a,u,d){super(`AJAXError: ${a} (${t}): ${u}`),this.status=t,this.statusText=a,this.url=u,this.body=d}}const Nt=At()?()=>self.worker&&self.worker.referrer:()=>(window.location.protocol==="blob:"?window.parent:window).location.href,Ot=s=>_t.REGISTERED_PROTOCOLS[s.substring(0,s.indexOf("://"))];function Ir(s,t){const a=new AbortController,u=new Request(s.url,{method:s.method||"GET",body:s.body,credentials:s.credentials,headers:s.headers,cache:s.cache,referrer:Nt(),signal:a.signal});let d=!1,g=!1;return s.type==="json"&&u.headers.set("Accept","application/json"),g||fetch(u).then(_=>_.ok?(x=>{(s.type==="arrayBuffer"||s.type==="image"?x.arrayBuffer():s.type==="json"?x.json():x.text()).then(I=>{g||(d=!0,t(null,I,x.headers.get("Cache-Control"),x.headers.get("Expires")))}).catch(I=>{g||t(new Error(I.message))})})(_):_.blob().then(x=>t(new Ge(_.status,_.statusText,s.url,x)))).catch(_=>{_.code!==20&&t(new Error(_.message))}),{cancel:()=>{g=!0,d||a.abort()}}}const cr=function(s,t){if(/:\/\//.test(s.url)&&!/^https?:|^file:/.test(s.url)){if(At()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",s,t);if(!At())return(Ot(s.url)||Ir)(s,t)}if(!(/^file:/.test(a=s.url)||/^file:/.test(Nt())&&!/^\w+:/.test(a))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return Ir(s,t);if(At()&&self.worker&&self.worker.actor)return self.worker.actor.send("getResource",s,t,void 0,!0)}var a;return function(u,d){const g=new XMLHttpRequest;g.open(u.method||"GET",u.url,!0),u.type!=="arrayBuffer"&&u.type!=="image"||(g.responseType="arraybuffer");for(const _ in u.headers)g.setRequestHeader(_,u.headers[_]);return u.type==="json"&&(g.responseType="text",g.setRequestHeader("Accept","application/json")),g.withCredentials=u.credentials==="include",g.onerror=()=>{d(new Error(g.statusText))},g.onload=()=>{if((g.status>=200&&g.status<300||g.status===0)&&g.response!==null){let _=g.response;if(u.type==="json")try{_=JSON.parse(g.response)}catch(x){return d(x)}d(null,_,g.getResponseHeader("Cache-Control"),g.getResponseHeader("Expires"))}else{const _=new Blob([g.response],{type:g.getResponseHeader("Content-Type")});d(new Ge(g.status,g.statusText,u.url,_))}},g.send(u.body),{cancel:()=>g.abort()}}(s,t)},Jr=function(s,t){return cr(ke(s,{type:"arrayBuffer"}),t)};function Ar(s){if(!s||s.indexOf("://")<=0||s.indexOf("data:image/")===0||s.indexOf("blob:")===0)return!0;const t=new URL(s),a=window.location;return t.protocol===a.protocol&&t.host===a.host}function Qr(s,t,a){a[s]&&a[s].indexOf(t)!==-1||(a[s]=a[s]||[],a[s].push(t))}function $i(s,t,a){if(a&&a[s]){const u=a[s].indexOf(t);u!==-1&&a[s].splice(u,1)}}class cn{constructor(t,a={}){ke(this,a),this.type=t}}class Mn extends cn{constructor(t,a={}){super("error",ke({error:t},a))}}class vi{on(t,a){return this._listeners=this._listeners||{},Qr(t,a,this._listeners),this}off(t,a){return $i(t,a,this._listeners),$i(t,a,this._oneTimeListeners),this}once(t,a){return a?(this._oneTimeListeners=this._oneTimeListeners||{},Qr(t,a,this._oneTimeListeners),this):new Promise(u=>this.once(t,u))}fire(t,a){typeof t=="string"&&(t=new cn(t,a||{}));const u=t.type;if(this.listens(u)){t.target=this;const d=this._listeners&&this._listeners[u]?this._listeners[u].slice():[];for(const x of d)x.call(this,t);const g=this._oneTimeListeners&&this._oneTimeListeners[u]?this._oneTimeListeners[u].slice():[];for(const x of g)$i(u,x,this._oneTimeListeners),x.call(this,t);const _=this._eventedParent;_&&(ke(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),_.fire(t))}else t instanceof Mn&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,a){return this._eventedParent=t,this._eventedParentData=a,this}}var Ce={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},light:{type:"light"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{},within:{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Vr=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Br(s,t){const a={};for(const u in s)u!=="ref"&&(a[u]=s[u]);return Vr.forEach(u=>{u in t&&(a[u]=t[u])}),a}function Xt(s,t){if(Array.isArray(s)){if(!Array.isArray(t)||s.length!==t.length)return!1;for(let a=0;a`:s.itemType.kind==="value"?"array":`array<${t}>`}return s.kind}const ve=[Ri,We,jt,xt,Hr,K,ii,X(qt),R,O,q];function he(s,t){if(t.kind==="error")return null;if(s.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!he(s.itemType,t.itemType))&&(typeof s.N!="number"||s.N===t.N))return null}else{if(s.kind===t.kind)return null;if(s.kind==="value"){for(const a of ve)if(!he(a,t))return null}}return`Expected ${te(s)} but found ${te(t)} instead.`}function se(s,t){return t.some(a=>a.kind===s.kind)}function ge(s,t){return t.some(a=>a==="null"?s===null:a==="array"?Array.isArray(s):a==="object"?s&&!Array.isArray(s)&&typeof s=="object":a===typeof s)}function Le(s,t){return s.kind==="array"&&t.kind==="array"?s.itemType.kind===t.itemType.kind&&typeof s.N=="number":s.kind===t.kind}const Be=.96422,Oe=.82521,zt=4/29,Gt=6/29,It=3*Gt*Gt,Ft=Gt*Gt*Gt,Zt=Math.PI/180,Ur=180/Math.PI;function Yr(s){return(s%=360)<0&&(s+=360),s}function Mr([s,t,a,u]){let d,g;const _=wn((.2225045*(s=Er(s))+.7168786*(t=Er(t))+.0606169*(a=Er(a)))/1);s===t&&t===a?d=g=_:(d=wn((.4360747*s+.3850649*t+.1430804*a)/Be),g=wn((.0139322*s+.0971045*t+.7141733*a)/Oe));const x=116*_-16;return[x<0?0:x,500*(d-_),200*(_-g),u]}function Er(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function wn(s){return s>Ft?Math.pow(s,1/3):s/It+zt}function ni([s,t,a,u]){let d=(s+16)/116,g=isNaN(t)?d:d+t/500,_=isNaN(a)?d:d-a/200;return d=1*pn(d),g=Be*pn(g),_=Oe*pn(_),[Yi(3.1338561*g-1.6168667*d-.4906146*_),Yi(-.9787684*g+1.9161415*d+.033454*_),Yi(.0719453*g-.2289914*d+1.4052427*_),u]}function Yi(s){return(s=s<=.00304?12.92*s:1.055*Math.pow(s,1/2.4)-.055)<0?0:s>1?1:s}function pn(s){return s>Gt?s*s*s:It*(s-zt)}function fs(s){return parseInt(s.padEnd(2,s),16)/255}function ud(s,t){return xo(t?s/100:s,0,1)}function xo(s,t,a){return Math.min(Math.max(t,s),a)}function wo(s){return!s.some(Number.isNaN)}const om={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};class qr{constructor(t,a,u,d=1,g=!0){this.r=t,this.g=a,this.b=u,this.a=d,g||(this.r*=d,this.g*=d,this.b*=d,d||this.overwriteGetter("rgb",[t,a,u,d]))}static parse(t){if(t instanceof qr)return t;if(typeof t!="string")return;const a=function(u){if((u=u.toLowerCase().trim())==="transparent")return[0,0,0,0];const d=om[u];if(d){const[_,x,I]=d;return[_/255,x/255,I/255,1]}if(u.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(u)){const _=u.length<6?1:2;let x=1;return[fs(u.slice(x,x+=_)),fs(u.slice(x,x+=_)),fs(u.slice(x,x+=_)),fs(u.slice(x,x+_)||"ff")]}if(u.startsWith("rgb")){const _=u.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(_){const[x,I,E,M,L,F,$,V,Z,ee,ie,ye]=_,ue=[M||" ",$||" ",ee].join("");if(ue===" "||ue===" /"||ue===",,"||ue===",,,"){const be=[E,F,Z].join(""),Ie=be==="%%%"?100:be===""?255:0;if(Ie){const Fe=[xo(+I/Ie,0,1),xo(+L/Ie,0,1),xo(+V/Ie,0,1),ie?ud(+ie,ye):1];if(wo(Fe))return Fe}}return}}const g=u.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(g){const[_,x,I,E,M,L,F,$,V]=g,Z=[I||" ",M||" ",F].join("");if(Z===" "||Z===" /"||Z===",,"||Z===",,,"){const ee=[+x,xo(+E,0,100),xo(+L,0,100),$?ud(+$,V):1];if(wo(ee))return function([ie,ye,ue,be]){function Ie(Fe){const mt=(Fe+ie/30)%12,kt=ye*Math.min(ue,1-ue);return ue-kt*Math.max(-1,Math.min(mt-3,9-mt,1))}return ie=Yr(ie),ye/=100,ue/=100,[Ie(0),Ie(8),Ie(4),be]}(ee)}}}(t);return a?new qr(...a,!1):void 0}get rgb(){const{r:t,g:a,b:u,a:d}=this,g=d||1/0;return this.overwriteGetter("rgb",[t/g,a/g,u/g,d])}get hcl(){return this.overwriteGetter("hcl",function(t){const[a,u,d,g]=Mr(t),_=Math.sqrt(u*u+d*d);return[Math.round(1e4*_)?Yr(Math.atan2(d,u)*Ur):NaN,_,a,g]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Mr(this.rgb))}overwriteGetter(t,a){return Object.defineProperty(this,t,{value:a}),a}toString(){const[t,a,u,d]=this.rgb;return`rgba(${[t,a,u].map(g=>Math.round(255*g)).join(",")},${d})`}}qr.black=new qr(0,0,0,1),qr.white=new qr(1,1,1,1),qr.transparent=new qr(0,0,0,0),qr.red=new qr(1,0,0,1);class fu{constructor(t,a,u){this.sensitivity=t?a?"variant":"case":a?"accent":"base",this.locale=u,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,a){return this.collator.compare(t,a)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Gl{constructor(t,a,u,d,g){this.text=t,this.image=a,this.scale=u,this.fontStack=d,this.textColor=g}}class Sn{constructor(t){this.sections=t}static fromString(t){return new Sn([new Gl(t,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Sn?t:Sn.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Xn{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Xn)return t;if(typeof t=="number")return new Xn([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const a of t)if(typeof a!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Xn(t)}}toString(){return JSON.stringify(this.values)}}const lm=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class ps{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof ps)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let a=0;a=0&&s<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof a=="number"&&a>=0&&a<=255?u===void 0||typeof u=="number"&&u>=0&&u<=1?null:`Invalid rgba value [${[s,t,a,u].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof u=="number"?[s,t,a,u]:[s,t,a]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function So(s){if(s===null||typeof s=="string"||typeof s=="boolean"||typeof s=="number"||s instanceof qr||s instanceof fu||s instanceof Sn||s instanceof Xn||s instanceof ps||s instanceof mn)return!0;if(Array.isArray(s)){for(const t of s)if(!So(t))return!1;return!0}if(typeof s=="object"){for(const t in s)if(!So(s[t]))return!1;return!0}return!1}function xi(s){if(s===null)return Ri;if(typeof s=="string")return jt;if(typeof s=="boolean")return xt;if(typeof s=="number")return We;if(s instanceof qr)return Hr;if(s instanceof fu)return On;if(s instanceof Sn)return K;if(s instanceof Xn)return R;if(s instanceof ps)return q;if(s instanceof mn)return O;if(Array.isArray(s)){const t=s.length;let a;for(const u of s){const d=xi(u);if(a){if(a===d)continue;a=qt;break}a=d}return X(a||qt,t)}return ii}function Rr(s){const t=typeof s;return s===null?"":t==="string"||t==="number"||t==="boolean"?String(s):s instanceof qr||s instanceof Sn||s instanceof Xn||s instanceof ps||s instanceof mn?s.toString():JSON.stringify(s)}class Ga{constructor(t,a){this.type=t,this.value=a}static parse(t,a){if(t.length!==2)return a.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!So(t[1]))return a.error("invalid value");const u=t[1];let d=xi(u);const g=a.expectedType;return d.kind!=="array"||d.N!==0||!g||g.kind!=="array"||typeof g.N=="number"&&g.N!==0||(d=g),new Ga(d,u)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class Ei{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Wl={string:jt,number:We,boolean:xt,object:ii};class ms{constructor(t,a){this.type=t,this.args=a}static parse(t,a){if(t.length<2)return a.error("Expected at least one argument.");let u,d=1;const g=t[0];if(g==="array"){let x,I;if(t.length>2){const E=t[1];if(typeof E!="string"||!(E in Wl)||E==="object")return a.error('The item type argument of "array" must be one of string, number, boolean',1);x=Wl[E],d++}else x=qt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return a.error('The length argument to "array" must be a positive integer literal',2);I=t[2],d++}u=X(x,I)}else{if(!Wl[g])throw new Error(`Types doesn't contain name = ${g}`);u=Wl[g]}const _=[];for(;dt.outputDefined())}}const pu={"to-boolean":xt,"to-color":Hr,"to-number":We,"to-string":jt};class va{constructor(t,a){this.type=t,this.args=a}static parse(t,a){if(t.length<2)return a.error("Expected at least one argument.");const u=t[0];if(!pu[u])throw new Error(`Can't parse ${u} as it is not part of the known types`);if((u==="to-boolean"||u==="to-string")&&t.length!==2)return a.error("Expected one argument.");const d=pu[u],g=[];for(let _=1;_4?`Invalid rbga value ${JSON.stringify(a)}: expected an array containing either three or four numeric values.`:Zl(a[0],a[1],a[2],a[3]),!u))return new qr(a[0]/255,a[1]/255,a[2]/255,a[3])}throw new Ei(u||`Could not parse color from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"padding":{let a;for(const u of this.args){a=u.evaluate(t);const d=Xn.parse(a);if(d)return d}throw new Ei(`Could not parse padding from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"variableAnchorOffsetCollection":{let a;for(const u of this.args){a=u.evaluate(t);const d=ps.parse(a);if(d)return d}throw new Ei(`Could not parse variableAnchorOffsetCollection from value '${typeof a=="string"?a:JSON.stringify(a)}'`)}case"number":{let a=null;for(const u of this.args){if(a=u.evaluate(t),a===null)return 0;const d=Number(a);if(!isNaN(d))return d}throw new Ei(`Could not convert ${JSON.stringify(a)} to number.`)}case"formatted":return Sn.fromString(Rr(this.args[0].evaluate(t)));case"resolvedImage":return mn.fromString(Rr(this.args[0].evaluate(t)));default:return Rr(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const hd=["Unknown","Point","LineString","Polygon"];class mu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?hd[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let a=this._parseColorCache[t];return a||(a=this._parseColorCache[t]=qr.parse(t)),a}}class Hl{constructor(t,a,u=[],d,g=new Bi,_=[]){this.registry=t,this.path=u,this.key=u.map(x=>`[${x}]`).join(""),this.scope=g,this.errors=_,this.expectedType=d,this._isConstant=a}parse(t,a,u,d,g={}){return a?this.concat(a,u,d)._parse(t,g):this._parse(t,g)}_parse(t,a){function u(d,g,_){return _==="assert"?new ms(g,[d]):_==="coerce"?new va(g,[d]):d}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const d=t[0];if(typeof d!="string")return this.error(`Expression name must be a string, but found ${typeof d} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const g=this.registry[d];if(g){let _=g.parse(t,this);if(!_)return null;if(this.expectedType){const x=this.expectedType,I=_.type;if(x.kind!=="string"&&x.kind!=="number"&&x.kind!=="boolean"&&x.kind!=="object"&&x.kind!=="array"||I.kind!=="value")if(x.kind!=="color"&&x.kind!=="formatted"&&x.kind!=="resolvedImage"||I.kind!=="value"&&I.kind!=="string")if(x.kind!=="padding"||I.kind!=="value"&&I.kind!=="number"&&I.kind!=="array")if(x.kind!=="variableAnchorOffsetCollection"||I.kind!=="value"&&I.kind!=="array"){if(this.checkSubtype(x,I))return null}else _=u(_,x,a.typeAnnotation||"coerce");else _=u(_,x,a.typeAnnotation||"coerce");else _=u(_,x,a.typeAnnotation||"coerce");else _=u(_,x,a.typeAnnotation||"assert")}if(!(_ instanceof Ga)&&_.type.kind!=="resolvedImage"&&this._isConstant(_)){const x=new mu;try{_=new Ga(_.type,_.evaluate(x))}catch(I){return this.error(I.message),null}}return _}return this.error(`Unknown expression "${d}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,a,u){const d=typeof t=="number"?this.path.concat(t):this.path,g=u?this.scope.concat(u):this.scope;return new Hl(this.registry,this._isConstant,d,a||null,g,this.errors)}error(t,...a){const u=`${this.key}${a.map(d=>`[${d}]`).join("")}`;this.errors.push(new ar(u,t))}checkSubtype(t,a){const u=he(t,a);return u&&this.error(u),u}}class Yl{constructor(t,a,u){this.type=On,this.locale=u,this.caseSensitive=t,this.diacriticSensitive=a}static parse(t,a){if(t.length!==2)return a.error("Expected one argument.");const u=t[1];if(typeof u!="object"||Array.isArray(u))return a.error("Collator options argument must be an object.");const d=a.parse(u["case-sensitive"]!==void 0&&u["case-sensitive"],1,xt);if(!d)return null;const g=a.parse(u["diacritic-sensitive"]!==void 0&&u["diacritic-sensitive"],1,xt);if(!g)return null;let _=null;return u.locale&&(_=a.parse(u.locale,1,jt),!_)?null:new Yl(d,g,_)}evaluate(t){return new fu(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}const ba=8192;function gu(s,t){s[0]=Math.min(s[0],t[0]),s[1]=Math.min(s[1],t[1]),s[2]=Math.max(s[2],t[0]),s[3]=Math.max(s[3],t[1])}function sl(s,t){return!(s[0]<=t[0]||s[2]>=t[2]||s[1]<=t[1]||s[3]>=t[3])}function dd(s,t){const a=(180+s[0])/360,u=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s[1]*Math.PI/360)))/360,d=Math.pow(2,t.z);return[Math.round(a*d*ba),Math.round(u*d*ba)]}function cm(s,t,a){const u=s[0]-t[0],d=s[1]-t[1],g=s[0]-a[0],_=s[1]-a[1];return u*_-g*d==0&&u*g<=0&&d*_<=0}function yu(s,t){let a=!1;for(let _=0,x=t.length;_(u=s)[1]!=(g=I[E+1])[1]>u[1]&&u[0]<(g[0]-d[0])*(u[1]-d[1])/(g[1]-d[1])+d[0]&&(a=!a)}}var u,d,g;return a}function _u(s,t){for(let a=0;a0&&x<0||_<0&&x>0}function um(s,t,a){for(const E of a)for(let M=0;Ma[2]){const d=.5*u;let g=s[0]-a[0]>d?-u:a[0]-s[0]>d?u:0;g===0&&(g=s[0]-a[2]>d?-u:a[2]-s[0]>d?u:0),s[0]+=g}gu(t,s)}function vu(s,t,a,u){const d=Math.pow(2,u.z)*ba,g=[u.x*ba,u.y*ba],_=[];for(const x of s)for(const I of x){const E=[I.x+g[0],I.y+g[1]];yd(E,t,a,d),_.push(E)}return _}function bu(s,t,a,u){const d=Math.pow(2,u.z)*ba,g=[u.x*ba,u.y*ba],_=[];for(const I of s){const E=[];for(const M of I){const L=[M.x+g[0],M.y+g[1]];gu(t,L),E.push(L)}_.push(E)}if(t[2]-t[0]<=d/2){(x=t)[0]=x[1]=1/0,x[2]=x[3]=-1/0;for(const I of _)for(const E of I)yd(E,t,a,d)}var x;return _}class Za{constructor(t,a){this.type=xt,this.geojson=t,this.geometries=a}static parse(t,a){if(t.length!==2)return a.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(So(t[1])){const u=t[1];if(u.type==="FeatureCollection")for(let d=0;d!Array.isArray(E)||E.length===t.length-1);let I=null;for(const[E,M]of x){I=new Hl(a.registry,Jl,a.path,null,a.scope);const L=[];let F=!1;for(let $=1;${return F=L,Array.isArray(F)?`(${F.map(te).join(", ")})`:`(${te(F.type)}...)`;var F}).join(" | "),M=[];for(let L=1;L{a=t?a&&Jl(u):a&&u instanceof Ga}),!!a&&Ql(s)&&ec(s,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Ql(s){if(s instanceof gs&&(s.name==="get"&&s.args.length===1||s.name==="feature-state"||s.name==="has"&&s.args.length===1||s.name==="properties"||s.name==="geometry-type"||s.name==="id"||/^filter-/.test(s.name))||s instanceof Za)return!1;let t=!0;return s.eachChild(a=>{t&&!Ql(a)&&(t=!1)}),t}function al(s){if(s instanceof gs&&s.name==="feature-state")return!1;let t=!0;return s.eachChild(a=>{t&&!al(a)&&(t=!1)}),t}function ec(s,t){if(s instanceof gs&&t.indexOf(s.name)>=0)return!1;let a=!0;return s.eachChild(u=>{a&&!ec(u,t)&&(a=!1)}),a}function Io(s,t){const a=s.length-1;let u,d,g=0,_=a,x=0;for(;g<=_;)if(x=Math.floor((g+_)/2),u=s[x],d=s[x+1],u<=t){if(x===a||tt))throw new Ei("Input is not a number.");_=x-1}return 0}class xa{constructor(t,a,u){this.type=t,this.input=a,this.labels=[],this.outputs=[];for(const[d,g]of u)this.labels.push(d),this.outputs.push(g)}static parse(t,a){if(t.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return a.error("Expected an even number of arguments.");const u=a.parse(t[1],1,We);if(!u)return null;const d=[];let g=null;a.expectedType&&a.expectedType.kind!=="value"&&(g=a.expectedType);for(let _=1;_=x)return a.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',E);const L=a.parse(I,M,g);if(!L)return null;g=g||L.type,d.push([x,L])}return new xa(g,u,d)}evaluate(t){const a=this.labels,u=this.outputs;if(a.length===1)return u[0].evaluate(t);const d=this.input.evaluate(t);if(d<=a[0])return u[0].evaluate(t);const g=a.length;return d>=a[g-1]?u[g-1].evaluate(t):u[Io(a,d)].evaluate(t)}eachChild(t){t(this.input);for(const a of this.outputs)t(a)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Tr(s,t,a){return s+a*(t-s)}function tc(s,t,a){return s.map((u,d)=>Tr(u,t[d],a))}const Jn={number:Tr,color:function(s,t,a,u="rgb"){switch(u){case"rgb":{const[d,g,_,x]=tc(s.rgb,t.rgb,a);return new qr(d,g,_,x,!1)}case"hcl":{const[d,g,_,x]=s.hcl,[I,E,M,L]=t.hcl;let F,$;if(isNaN(d)||isNaN(I))isNaN(d)?isNaN(I)?F=NaN:(F=I,_!==1&&_!==0||($=E)):(F=d,M!==1&&M!==0||($=g));else{let ye=I-d;I>d&&ye>180?ye-=360:I180&&(ye+=360),F=d+a*ye}const[V,Z,ee,ie]=function([ye,ue,be,Ie]){return ye=isNaN(ye)?0:ye*Zt,ni([be,Math.cos(ye)*ue,Math.sin(ye)*ue,Ie])}([F,$??Tr(g,E,a),Tr(_,M,a),Tr(x,L,a)]);return new qr(V,Z,ee,ie,!1)}case"lab":{const[d,g,_,x]=ni(tc(s.lab,t.lab,a));return new qr(d,g,_,x,!1)}}},array:tc,padding:function(s,t,a){return new Xn(tc(s.values,t.values,a))},variableAnchorOffsetCollection:function(s,t,a){const u=s.values,d=t.values;if(u.length!==d.length)throw new Ei(`Cannot interpolate values of different length. from: ${s.toString()}, to: ${t.toString()}`);const g=[];for(let _=0;_typeof M!="number"||M<0||M>1))return a.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);d={name:"cubic-bezier",controlPoints:E}}}if(t.length-1<4)return a.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return a.error("Expected an even number of arguments.");if(g=a.parse(g,2,We),!g)return null;const x=[];let I=null;u==="interpolate-hcl"||u==="interpolate-lab"?I=Hr:a.expectedType&&a.expectedType.kind!=="value"&&(I=a.expectedType);for(let E=0;E<_.length;E+=2){const M=_[E],L=_[E+1],F=E+3,$=E+4;if(typeof M!="number")return a.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',F);if(x.length&&x[x.length-1][0]>=M)return a.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',F);const V=a.parse(L,$,I);if(!V)return null;I=I||V.type,x.push([M,V])}return Le(I,We)||Le(I,Hr)||Le(I,R)||Le(I,q)||Le(I,X(We))?new Qn(I,u,d,g,x):a.error(`Type ${te(I)} is not interpolatable.`)}evaluate(t){const a=this.labels,u=this.outputs;if(a.length===1)return u[0].evaluate(t);const d=this.input.evaluate(t);if(d<=a[0])return u[0].evaluate(t);const g=a.length;if(d>=a[g-1])return u[g-1].evaluate(t);const _=Io(a,d),x=Qn.interpolationFactor(this.interpolation,d,a[_],a[_+1]),I=u[_].evaluate(t),E=u[_+1].evaluate(t);switch(this.operator){case"interpolate":return Jn[this.type.kind](I,E,x);case"interpolate-hcl":return Jn.color(I,E,x,"hcl");case"interpolate-lab":return Jn.color(I,E,x,"lab")}}eachChild(t){t(this.input);for(const a of this.outputs)t(a)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function xu(s,t,a,u){const d=u-a,g=s-a;return d===0?0:t===1?g/d:(Math.pow(t,g)-1)/(Math.pow(t,d)-1)}class rc{constructor(t,a){this.type=t,this.args=a}static parse(t,a){if(t.length<2)return a.error("Expectected at least one argument.");let u=null;const d=a.expectedType;d&&d.kind!=="value"&&(u=d);const g=[];for(const x of t.slice(1)){const I=a.parse(x,1+g.length,u,void 0,{typeAnnotation:"omit"});if(!I)return null;u=u||I.type,g.push(I)}if(!u)throw new Error("No output type");const _=d&&g.some(x=>he(d,x.type));return new rc(_?qt:u,g)}evaluate(t){let a,u=null,d=0;for(const g of this.args)if(d++,u=g.evaluate(t),u&&u instanceof mn&&!u.available&&(a||(a=u.name),u=null,d===this.args.length&&(u=a)),u!==null)break;return u}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}class ic{constructor(t,a){this.type=a.type,this.bindings=[].concat(t),this.result=a}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const a of this.bindings)t(a[1]);t(this.result)}static parse(t,a){if(t.length<4)return a.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const u=[];for(let g=1;g=u.length)throw new Ei(`Array index out of bounds: ${a} > ${u.length-1}.`);if(a!==Math.floor(a))throw new Ei(`Array index must be an integer, but found ${a} instead.`);return u[a]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Su{constructor(t,a){this.type=xt,this.needle=t,this.haystack=a}static parse(t,a){if(t.length!==3)return a.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const u=a.parse(t[1],1,qt),d=a.parse(t[2],2,qt);return u&&d?se(u.type,[xt,jt,We,Ri,qt])?new Su(u,d):a.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(u.type)} instead`):null}evaluate(t){const a=this.needle.evaluate(t),u=this.haystack.evaluate(t);if(!u)return!1;if(!ge(a,["boolean","string","number","null"]))throw new Ei(`Expected first argument to be of type boolean, string, number or null, but found ${te(xi(a))} instead.`);if(!ge(u,["string","array"]))throw new Ei(`Expected second argument to be of type array or string, but found ${te(xi(u))} instead.`);return u.indexOf(a)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class nc{constructor(t,a,u){this.type=We,this.needle=t,this.haystack=a,this.fromIndex=u}static parse(t,a){if(t.length<=2||t.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const u=a.parse(t[1],1,qt),d=a.parse(t[2],2,qt);if(!u||!d)return null;if(!se(u.type,[xt,jt,We,Ri,qt]))return a.error(`Expected first argument to be of type boolean, string, number or null, but found ${te(u.type)} instead`);if(t.length===4){const g=a.parse(t[3],3,We);return g?new nc(u,d,g):null}return new nc(u,d)}evaluate(t){const a=this.needle.evaluate(t),u=this.haystack.evaluate(t);if(!ge(a,["boolean","string","number","null"]))throw new Ei(`Expected first argument to be of type boolean, string, number or null, but found ${te(xi(a))} instead.`);if(!ge(u,["string","array"]))throw new Ei(`Expected second argument to be of type array or string, but found ${te(xi(u))} instead.`);if(this.fromIndex){const d=this.fromIndex.evaluate(t);return u.indexOf(a,d)}return u.indexOf(a)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Iu{constructor(t,a,u,d,g,_){this.inputType=t,this.type=a,this.input=u,this.cases=d,this.outputs=g,this.otherwise=_}static parse(t,a){if(t.length<5)return a.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return a.error("Expected an even number of arguments.");let u,d;a.expectedType&&a.expectedType.kind!=="value"&&(d=a.expectedType);const g={},_=[];for(let E=2;ENumber.MAX_SAFE_INTEGER)return F.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof V=="number"&&Math.floor(V)!==V)return F.error("Numeric branch labels must be integer values.");if(u){if(F.checkSubtype(u,xi(V)))return null}else u=xi(V);if(g[String(V)]!==void 0)return F.error("Branch labels must be unique.");g[String(V)]=_.length}const $=a.parse(L,E,d);if(!$)return null;d=d||$.type,_.push($)}const x=a.parse(t[1],1,qt);if(!x)return null;const I=a.parse(t[t.length-1],t.length-1,d);return I?x.type.kind!=="value"&&a.concat(1).checkSubtype(u,x.type)?null:new Iu(u,d,x,g,_,I):null}evaluate(t){const a=this.input.evaluate(t);return(xi(a)===this.inputType&&this.outputs[this.cases[a]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Tu{constructor(t,a,u){this.type=t,this.branches=a,this.otherwise=u}static parse(t,a){if(t.length<4)return a.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return a.error("Expected an odd number of arguments.");let u;a.expectedType&&a.expectedType.kind!=="value"&&(u=a.expectedType);const d=[];for(let _=1;_a.outputDefined())&&this.otherwise.outputDefined()}}class sc{constructor(t,a,u,d){this.type=t,this.input=a,this.beginIndex=u,this.endIndex=d}static parse(t,a){if(t.length<=2||t.length>=5)return a.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const u=a.parse(t[1],1,qt),d=a.parse(t[2],2,We);if(!u||!d)return null;if(!se(u.type,[X(qt),jt,qt]))return a.error(`Expected first argument to be of type array or string, but found ${te(u.type)} instead`);if(t.length===4){const g=a.parse(t[3],3,We);return g?new sc(u.type,u,d,g):null}return new sc(u.type,u,d)}evaluate(t){const a=this.input.evaluate(t),u=this.beginIndex.evaluate(t);if(!ge(a,["string","array"]))throw new Ei(`Expected first argument to be of type array or string, but found ${te(xi(a))} instead.`);if(this.endIndex){const d=this.endIndex.evaluate(t);return a.slice(u,d)}return a.slice(u)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function _d(s,t){return s==="=="||s==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function vd(s,t,a,u){return u.compare(t,a)===0}function To(s,t,a){const u=s!=="=="&&s!=="!=";return class pw{constructor(g,_,x){this.type=xt,this.lhs=g,this.rhs=_,this.collator=x,this.hasUntypedArgument=g.type.kind==="value"||_.type.kind==="value"}static parse(g,_){if(g.length!==3&&g.length!==4)return _.error("Expected two or three arguments.");const x=g[0];let I=_.parse(g[1],1,qt);if(!I)return null;if(!_d(x,I.type))return _.concat(1).error(`"${x}" comparisons are not supported for type '${te(I.type)}'.`);let E=_.parse(g[2],2,qt);if(!E)return null;if(!_d(x,E.type))return _.concat(2).error(`"${x}" comparisons are not supported for type '${te(E.type)}'.`);if(I.type.kind!==E.type.kind&&I.type.kind!=="value"&&E.type.kind!=="value")return _.error(`Cannot compare types '${te(I.type)}' and '${te(E.type)}'.`);u&&(I.type.kind==="value"&&E.type.kind!=="value"?I=new ms(E.type,[I]):I.type.kind!=="value"&&E.type.kind==="value"&&(E=new ms(I.type,[E])));let M=null;if(g.length===4){if(I.type.kind!=="string"&&E.type.kind!=="string"&&I.type.kind!=="value"&&E.type.kind!=="value")return _.error("Cannot use collator to compare non-string types.");if(M=_.parse(g[3],3,On),!M)return null}return new pw(I,E,M)}evaluate(g){const _=this.lhs.evaluate(g),x=this.rhs.evaluate(g);if(u&&this.hasUntypedArgument){const I=xi(_),E=xi(x);if(I.kind!==E.kind||I.kind!=="string"&&I.kind!=="number")throw new Ei(`Expected arguments for "${s}" to be (string, string) or (number, number), but found (${I.kind}, ${E.kind}) instead.`)}if(this.collator&&!u&&this.hasUntypedArgument){const I=xi(_),E=xi(x);if(I.kind!=="string"||E.kind!=="string")return t(g,_,x)}return this.collator?a(g,_,x,this.collator.evaluate(g)):t(g,_,x)}eachChild(g){g(this.lhs),g(this.rhs),this.collator&&g(this.collator)}outputDefined(){return!0}}}const hm=To("==",function(s,t,a){return t===a},vd),dm=To("!=",function(s,t,a){return t!==a},function(s,t,a,u){return!vd(0,t,a,u)}),fm=To("<",function(s,t,a){return t",function(s,t,a){return t>a},function(s,t,a,u){return u.compare(t,a)>0}),mm=To("<=",function(s,t,a){return t<=a},function(s,t,a,u){return u.compare(t,a)<=0}),gm=To(">=",function(s,t,a){return t>=a},function(s,t,a,u){return u.compare(t,a)>=0});class ku{constructor(t,a,u,d,g){this.type=jt,this.number=t,this.locale=a,this.currency=u,this.minFractionDigits=d,this.maxFractionDigits=g}static parse(t,a){if(t.length!==3)return a.error("Expected two arguments.");const u=a.parse(t[1],1,We);if(!u)return null;const d=t[2];if(typeof d!="object"||Array.isArray(d))return a.error("NumberFormat options argument must be an object.");let g=null;if(d.locale&&(g=a.parse(d.locale,1,jt),!g))return null;let _=null;if(d.currency&&(_=a.parse(d.currency,1,jt),!_))return null;let x=null;if(d["min-fraction-digits"]&&(x=a.parse(d["min-fraction-digits"],1,We),!x))return null;let I=null;return d["max-fraction-digits"]&&(I=a.parse(d["max-fraction-digits"],1,We),!I)?null:new ku(u,g,_,x,I)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class ac{constructor(t){this.type=K,this.sections=t}static parse(t,a){if(t.length<2)return a.error("Expected at least one argument.");const u=t[1];if(!Array.isArray(u)&&typeof u=="object")return a.error("First argument must be an image or text section.");const d=[];let g=!1;for(let _=1;_<=t.length-1;++_){const x=t[_];if(g&&typeof x=="object"&&!Array.isArray(x)){g=!1;let I=null;if(x["font-scale"]&&(I=a.parse(x["font-scale"],1,We),!I))return null;let E=null;if(x["text-font"]&&(E=a.parse(x["text-font"],1,X(jt)),!E))return null;let M=null;if(x["text-color"]&&(M=a.parse(x["text-color"],1,Hr),!M))return null;const L=d[d.length-1];L.scale=I,L.font=E,L.textColor=M}else{const I=a.parse(t[_],1,qt);if(!I)return null;const E=I.type.kind;if(E!=="string"&&E!=="value"&&E!=="null"&&E!=="resolvedImage")return a.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");g=!0,d.push({content:I,scale:null,font:null,textColor:null})}}return new ac(d)}evaluate(t){return new Sn(this.sections.map(a=>{const u=a.content.evaluate(t);return xi(u)===O?new Gl("",u,null,null,null):new Gl(Rr(u),null,a.scale?a.scale.evaluate(t):null,a.font?a.font.evaluate(t).join(","):null,a.textColor?a.textColor.evaluate(t):null)}))}eachChild(t){for(const a of this.sections)t(a.content),a.scale&&t(a.scale),a.font&&t(a.font),a.textColor&&t(a.textColor)}outputDefined(){return!1}}class Au{constructor(t){this.type=O,this.input=t}static parse(t,a){if(t.length!==2)return a.error("Expected two arguments.");const u=a.parse(t[1],1,jt);return u?new Au(u):a.error("No image name provided.")}evaluate(t){const a=this.input.evaluate(t),u=mn.fromString(a);return u&&t.availableImages&&(u.available=t.availableImages.indexOf(a)>-1),u}eachChild(t){t(this.input)}outputDefined(){return!1}}class Eu{constructor(t){this.type=We,this.input=t}static parse(t,a){if(t.length!==2)return a.error(`Expected 1 argument, but found ${t.length-1} instead.`);const u=a.parse(t[1],1);return u?u.type.kind!=="array"&&u.type.kind!=="string"&&u.type.kind!=="value"?a.error(`Expected argument of type string or array, but found ${te(u.type)} instead.`):new Eu(u):null}evaluate(t){const a=this.input.evaluate(t);if(typeof a=="string"||Array.isArray(a))return a.length;throw new Ei(`Expected value to be of type string or array, but found ${te(xi(a))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const ko={"==":hm,"!=":dm,">":pm,"<":fm,">=":gm,"<=":mm,array:ms,at:wu,boolean:ms,case:Tu,coalesce:rc,collator:Yl,format:ac,image:Au,in:Su,"index-of":nc,interpolate:Qn,"interpolate-hcl":Qn,"interpolate-lab":Qn,length:Eu,let:ic,literal:Ga,match:Iu,number:ms,"number-format":ku,object:ms,slice:sc,step:xa,string:ms,"to-boolean":va,"to-color":va,"to-number":va,"to-string":va,var:Xl,within:Za};function bd(s,[t,a,u,d]){t=t.evaluate(s),a=a.evaluate(s),u=u.evaluate(s);const g=d?d.evaluate(s):1,_=Zl(t,a,u,g);if(_)throw new Ei(_);return new qr(t/255,a/255,u/255,g,!1)}function xd(s,t){return s in t}function Cu(s,t){const a=t[s];return a===void 0?null:a}function Wa(s){return{type:s}}function wd(s){return{result:"success",value:s}}function wa(s){return{result:"error",value:s}}function Ao(s){return s["property-type"]==="data-driven"||s["property-type"]==="cross-faded-data-driven"}function Sd(s){return!!s.expression&&s.expression.parameters.indexOf("zoom")>-1}function Mu(s){return!!s.expression&&s.expression.interpolated}function Fr(s){return s instanceof Number?"number":s instanceof String?"string":s instanceof Boolean?"boolean":Array.isArray(s)?"array":s===null?"null":typeof s}function wi(s){return typeof s=="object"&&s!==null&&!Array.isArray(s)}function ym(s){return s}function kr(s,t){const a=t.type==="color",u=s.stops&&typeof s.stops[0][0]=="object",d=u||!(u||s.property!==void 0),g=s.type||(Mu(t)?"exponential":"interval");if(a||t.type==="padding"){const M=a?qr.parse:Xn.parse;(s=dn({},s)).stops&&(s.stops=s.stops.map(L=>[L[0],M(L[1])])),s.default=M(s.default?s.default:t.default)}if(s.colorSpace&&(_=s.colorSpace)!=="rgb"&&_!=="hcl"&&_!=="lab")throw new Error(`Unknown color space: "${s.colorSpace}"`);var _;let x,I,E;if(g==="exponential")x=ol;else if(g==="interval")x=pi;else if(g==="categorical"){x=Si,I=Object.create(null);for(const M of s.stops)I[M[0]]=M[1];E=typeof s.stops[0][0]}else{if(g!=="identity")throw new Error(`Unknown function type "${g}"`);x=Id}if(u){const M={},L=[];for(let V=0;VV[0]),evaluate:({zoom:V},Z)=>ol({stops:F,base:s.base},t,V).evaluate(V,Z)}}if(d){const M=g==="exponential"?{name:"exponential",base:s.base!==void 0?s.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:Qn.interpolationFactor.bind(void 0,M),zoomStops:s.stops.map(L=>L[0]),evaluate:({zoom:L})=>x(s,t,L,I,E)}}return{kind:"source",evaluate(M,L){const F=L&&L.properties?L.properties[s.property]:void 0;return F===void 0?Ha(s.default,t.default):x(s,t,F,I,E)}}}function Ha(s,t,a){return s!==void 0?s:t!==void 0?t:a!==void 0?a:void 0}function Si(s,t,a,u,d){return Ha(typeof a===d?u[a]:void 0,s.default,t.default)}function pi(s,t,a){if(Fr(a)!=="number")return Ha(s.default,t.default);const u=s.stops.length;if(u===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[u-1][0])return s.stops[u-1][1];const d=Io(s.stops.map(g=>g[0]),a);return s.stops[d][1]}function ol(s,t,a){const u=s.base!==void 0?s.base:1;if(Fr(a)!=="number")return Ha(s.default,t.default);const d=s.stops.length;if(d===1||a<=s.stops[0][0])return s.stops[0][1];if(a>=s.stops[d-1][0])return s.stops[d-1][1];const g=Io(s.stops.map(M=>M[0]),a),_=function(M,L,F,$){const V=$-F,Z=M-F;return V===0?0:L===1?Z/V:(Math.pow(L,Z)-1)/(Math.pow(L,V)-1)}(a,u,s.stops[g][0],s.stops[g+1][0]),x=s.stops[g][1],I=s.stops[g+1][1],E=Jn[t.type]||ym;return typeof x.evaluate=="function"?{evaluate(...M){const L=x.evaluate.apply(void 0,M),F=I.evaluate.apply(void 0,M);if(L!==void 0&&F!==void 0)return E(L,F,_,s.colorSpace)}}:E(x,I,_,s.colorSpace)}function Id(s,t,a){switch(t.type){case"color":a=qr.parse(a);break;case"formatted":a=Sn.fromString(a.toString());break;case"resolvedImage":a=mn.fromString(a.toString());break;case"padding":a=Xn.parse(a);break;default:Fr(a)===t.type||t.type==="enum"&&t.values[a]||(a=void 0)}return Ha(a,s.default,t.default)}gs.register(ko,{error:[{kind:"error"},[jt],(s,[t])=>{throw new Ei(t.evaluate(s))}],typeof:[jt,[qt],(s,[t])=>te(xi(t.evaluate(s)))],"to-rgba":[X(We,4),[Hr],(s,[t])=>{const[a,u,d,g]=t.evaluate(s).rgb;return[255*a,255*u,255*d,g]}],rgb:[Hr,[We,We,We],bd],rgba:[Hr,[We,We,We,We],bd],has:{type:xt,overloads:[[[jt],(s,[t])=>xd(t.evaluate(s),s.properties())],[[jt,ii],(s,[t,a])=>xd(t.evaluate(s),a.evaluate(s))]]},get:{type:qt,overloads:[[[jt],(s,[t])=>Cu(t.evaluate(s),s.properties())],[[jt,ii],(s,[t,a])=>Cu(t.evaluate(s),a.evaluate(s))]]},"feature-state":[qt,[jt],(s,[t])=>Cu(t.evaluate(s),s.featureState||{})],properties:[ii,[],s=>s.properties()],"geometry-type":[jt,[],s=>s.geometryType()],id:[qt,[],s=>s.id()],zoom:[We,[],s=>s.globals.zoom],"heatmap-density":[We,[],s=>s.globals.heatmapDensity||0],"line-progress":[We,[],s=>s.globals.lineProgress||0],accumulated:[qt,[],s=>s.globals.accumulated===void 0?null:s.globals.accumulated],"+":[We,Wa(We),(s,t)=>{let a=0;for(const u of t)a+=u.evaluate(s);return a}],"*":[We,Wa(We),(s,t)=>{let a=1;for(const u of t)a*=u.evaluate(s);return a}],"-":{type:We,overloads:[[[We,We],(s,[t,a])=>t.evaluate(s)-a.evaluate(s)],[[We],(s,[t])=>-t.evaluate(s)]]},"/":[We,[We,We],(s,[t,a])=>t.evaluate(s)/a.evaluate(s)],"%":[We,[We,We],(s,[t,a])=>t.evaluate(s)%a.evaluate(s)],ln2:[We,[],()=>Math.LN2],pi:[We,[],()=>Math.PI],e:[We,[],()=>Math.E],"^":[We,[We,We],(s,[t,a])=>Math.pow(t.evaluate(s),a.evaluate(s))],sqrt:[We,[We],(s,[t])=>Math.sqrt(t.evaluate(s))],log10:[We,[We],(s,[t])=>Math.log(t.evaluate(s))/Math.LN10],ln:[We,[We],(s,[t])=>Math.log(t.evaluate(s))],log2:[We,[We],(s,[t])=>Math.log(t.evaluate(s))/Math.LN2],sin:[We,[We],(s,[t])=>Math.sin(t.evaluate(s))],cos:[We,[We],(s,[t])=>Math.cos(t.evaluate(s))],tan:[We,[We],(s,[t])=>Math.tan(t.evaluate(s))],asin:[We,[We],(s,[t])=>Math.asin(t.evaluate(s))],acos:[We,[We],(s,[t])=>Math.acos(t.evaluate(s))],atan:[We,[We],(s,[t])=>Math.atan(t.evaluate(s))],min:[We,Wa(We),(s,t)=>Math.min(...t.map(a=>a.evaluate(s)))],max:[We,Wa(We),(s,t)=>Math.max(...t.map(a=>a.evaluate(s)))],abs:[We,[We],(s,[t])=>Math.abs(t.evaluate(s))],round:[We,[We],(s,[t])=>{const a=t.evaluate(s);return a<0?-Math.round(-a):Math.round(a)}],floor:[We,[We],(s,[t])=>Math.floor(t.evaluate(s))],ceil:[We,[We],(s,[t])=>Math.ceil(t.evaluate(s))],"filter-==":[xt,[jt,qt],(s,[t,a])=>s.properties()[t.value]===a.value],"filter-id-==":[xt,[qt],(s,[t])=>s.id()===t.value],"filter-type-==":[xt,[jt],(s,[t])=>s.geometryType()===t.value],"filter-<":[xt,[jt,qt],(s,[t,a])=>{const u=s.properties()[t.value],d=a.value;return typeof u==typeof d&&u{const a=s.id(),u=t.value;return typeof a==typeof u&&a":[xt,[jt,qt],(s,[t,a])=>{const u=s.properties()[t.value],d=a.value;return typeof u==typeof d&&u>d}],"filter-id->":[xt,[qt],(s,[t])=>{const a=s.id(),u=t.value;return typeof a==typeof u&&a>u}],"filter-<=":[xt,[jt,qt],(s,[t,a])=>{const u=s.properties()[t.value],d=a.value;return typeof u==typeof d&&u<=d}],"filter-id-<=":[xt,[qt],(s,[t])=>{const a=s.id(),u=t.value;return typeof a==typeof u&&a<=u}],"filter->=":[xt,[jt,qt],(s,[t,a])=>{const u=s.properties()[t.value],d=a.value;return typeof u==typeof d&&u>=d}],"filter-id->=":[xt,[qt],(s,[t])=>{const a=s.id(),u=t.value;return typeof a==typeof u&&a>=u}],"filter-has":[xt,[qt],(s,[t])=>t.value in s.properties()],"filter-has-id":[xt,[],s=>s.id()!==null&&s.id()!==void 0],"filter-type-in":[xt,[X(jt)],(s,[t])=>t.value.indexOf(s.geometryType())>=0],"filter-id-in":[xt,[X(qt)],(s,[t])=>t.value.indexOf(s.id())>=0],"filter-in-small":[xt,[jt,X(qt)],(s,[t,a])=>a.value.indexOf(s.properties()[t.value])>=0],"filter-in-large":[xt,[jt,X(qt)],(s,[t,a])=>function(u,d,g,_){for(;g<=_;){const x=g+_>>1;if(d[x]===u)return!0;d[x]>u?_=x-1:g=x+1}return!1}(s.properties()[t.value],a.value,0,a.value.length-1)],all:{type:xt,overloads:[[[xt,xt],(s,[t,a])=>t.evaluate(s)&&a.evaluate(s)],[Wa(xt),(s,t)=>{for(const a of t)if(!a.evaluate(s))return!1;return!0}]]},any:{type:xt,overloads:[[[xt,xt],(s,[t,a])=>t.evaluate(s)||a.evaluate(s)],[Wa(xt),(s,t)=>{for(const a of t)if(a.evaluate(s))return!0;return!1}]]},"!":[xt,[xt],(s,[t])=>!t.evaluate(s)],"is-supported-script":[xt,[jt],(s,[t])=>{const a=s.globals&&s.globals.isSupportedScript;return!a||a(t.evaluate(s))}],upcase:[jt,[jt],(s,[t])=>t.evaluate(s).toUpperCase()],downcase:[jt,[jt],(s,[t])=>t.evaluate(s).toLowerCase()],concat:[jt,Wa(qt),(s,t)=>t.map(a=>Rr(a.evaluate(s))).join("")],"resolved-locale":[jt,[On],(s,[t])=>t.evaluate(s).resolvedLocale()]});class Du{constructor(t,a){var u;this.expression=t,this._warningHistory={},this._evaluator=new mu,this._defaultValue=a?(u=a).type==="color"&&wi(u.default)?new qr(0,0,0,0):u.type==="color"?qr.parse(u.default)||null:u.type==="padding"?Xn.parse(u.default)||null:u.type==="variableAnchorOffsetCollection"?ps.parse(u.default)||null:u.default===void 0?null:u.default:null,this._enumValues=a&&a.type==="enum"?a.values:null}evaluateWithoutErrorHandling(t,a,u,d,g,_){return this._evaluator.globals=t,this._evaluator.feature=a,this._evaluator.featureState=u,this._evaluator.canonical=d,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=_,this.expression.evaluate(this._evaluator)}evaluate(t,a,u,d,g,_){this._evaluator.globals=t,this._evaluator.feature=a||null,this._evaluator.featureState=u||null,this._evaluator.canonical=d,this._evaluator.availableImages=g||null,this._evaluator.formattedSection=_||null;try{const x=this.expression.evaluate(this._evaluator);if(x==null||typeof x=="number"&&x!=x)return this._defaultValue;if(this._enumValues&&!(x in this._enumValues))throw new Ei(`Expected value to be one of ${Object.keys(this._enumValues).map(I=>JSON.stringify(I)).join(", ")}, but found ${JSON.stringify(x)} instead.`);return x}catch(x){return this._warningHistory[x.message]||(this._warningHistory[x.message]=!0,typeof console<"u"&&console.warn(x.message)),this._defaultValue}}}function oc(s){return Array.isArray(s)&&s.length>0&&typeof s[0]=="string"&&s[0]in ko}function lc(s,t){const a=new Hl(ko,Jl,[],t?function(d){const g={color:Hr,string:jt,number:We,enum:jt,boolean:xt,formatted:K,padding:R,resolvedImage:O,variableAnchorOffsetCollection:q};return d.type==="array"?X(g[d.value]||qt,d.length):g[d.type]}(t):void 0),u=a.parse(s,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return u?wd(new Du(u,t)):wa(a.errors)}class Pu{constructor(t,a){this.kind=t,this._styleExpression=a,this.isStateDependent=t!=="constant"&&!al(a.expression)}evaluateWithoutErrorHandling(t,a,u,d,g,_){return this._styleExpression.evaluateWithoutErrorHandling(t,a,u,d,g,_)}evaluate(t,a,u,d,g,_){return this._styleExpression.evaluate(t,a,u,d,g,_)}}class cc{constructor(t,a,u,d){this.kind=t,this.zoomStops=u,this._styleExpression=a,this.isStateDependent=t!=="camera"&&!al(a.expression),this.interpolationType=d}evaluateWithoutErrorHandling(t,a,u,d,g,_){return this._styleExpression.evaluateWithoutErrorHandling(t,a,u,d,g,_)}evaluate(t,a,u,d,g,_){return this._styleExpression.evaluate(t,a,u,d,g,_)}interpolationFactor(t,a,u){return this.interpolationType?Qn.interpolationFactor(this.interpolationType,t,a,u):0}}function Lu(s,t){const a=lc(s,t);if(a.result==="error")return a;const u=a.value.expression,d=Ql(u);if(!d&&!Ao(t))return wa([new ar("","data expressions not supported")]);const g=ec(u,["zoom"]);if(!g&&!Sd(t))return wa([new ar("","zoom expressions not supported")]);const _=cl(u);return _||g?_ instanceof ar?wa([_]):_ instanceof Qn&&!Mu(t)?wa([new ar("",'"interpolate" expressions cannot be used with this property')]):wd(_?new cc(d?"camera":"composite",a.value,_.labels,_ instanceof Qn?_.interpolation:void 0):new Pu(d?"constant":"source",a.value)):wa([new ar("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ll{constructor(t,a){this._parameters=t,this._specification=a,dn(this,kr(this._parameters,this._specification))}static deserialize(t){return new ll(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function cl(s){let t=null;if(s instanceof ic)t=cl(s.result);else if(s instanceof rc){for(const a of s.args)if(t=cl(a),t)break}else(s instanceof xa||s instanceof Qn)&&s.input instanceof gs&&s.input.name==="zoom"&&(t=s);return t instanceof ar||s.eachChild(a=>{const u=cl(a);u instanceof ar?t=u:!t&&u?t=new ar("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&u&&t!==u&&(t=new ar("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function ul(s){if(s===!0||s===!1)return!0;if(!Array.isArray(s)||s.length===0)return!1;switch(s[0]){case"has":return s.length>=2&&s[1]!=="$id"&&s[1]!=="$type";case"in":return s.length>=3&&(typeof s[1]!="string"||Array.isArray(s[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return s.length!==3||Array.isArray(s[1])||Array.isArray(s[2]);case"any":case"all":for(const t of s.slice(1))if(!ul(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const _m={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function zu(s){if(s==null)return{filter:()=>!0,needGeometry:!1};ul(s)||(s=uc(s));const t=lc(s,_m);if(t.result==="error")throw new Error(t.value.map(a=>`${a.key}: ${a.message}`).join(", "));return{filter:(a,u,d)=>t.value.evaluate(a,u,{},d),needGeometry:Td(s)}}function vm(s,t){return st?1:0}function Td(s){if(!Array.isArray(s))return!1;if(s[0]==="within")return!0;for(let t=1;t"||t==="<="||t===">="?Bu(s[1],s[2],t):t==="any"?(a=s.slice(1),["any"].concat(a.map(uc))):t==="all"?["all"].concat(s.slice(1).map(uc)):t==="none"?["all"].concat(s.slice(1).map(uc).map(hl)):t==="in"?kd(s[1],s.slice(2)):t==="!in"?hl(kd(s[1],s.slice(2))):t==="has"?Ad(s[1]):t==="!has"?hl(Ad(s[1])):t!=="within"||s;var a}function Bu(s,t,a){switch(s){case"$type":return[`filter-type-${a}`,t];case"$id":return[`filter-id-${a}`,t];default:return[`filter-${a}`,s,t]}}function kd(s,t){if(t.length===0)return!1;switch(s){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(a=>typeof a!=typeof t[0])?["filter-in-large",s,["literal",t.sort(vm)]]:["filter-in-small",s,["literal",t]]}}function Ad(s){switch(s){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",s]}}function hl(s){return["!",s]}function hc(s){const t=typeof s;if(t==="number"||t==="boolean"||t==="string"||s==null)return JSON.stringify(s);if(Array.isArray(s)){let d="[";for(const g of s)d+=`${hc(g)},`;return`${d}]`}const a=Object.keys(s).sort();let u="{";for(let d=0;du.maximum?[new qe(t,a,`${a} is greater than the maximum value ${u.maximum}`)]:[]}function fc(s){const t=s.valueSpec,a=Ci(s.value.type);let u,d,g,_={};const x=a!=="categorical"&&s.value.property===void 0,I=!x,E=Fr(s.value.stops)==="array"&&Fr(s.value.stops[0])==="array"&&Fr(s.value.stops[0][0])==="object",M=Nn({key:s.key,value:s.value,valueSpec:s.styleSpec.function,validateSpec:s.validateSpec,style:s.style,styleSpec:s.styleSpec,objectElementValidators:{stops:function($){if(a==="identity")return[new qe($.key,$.value,'identity function may not have a "stops" property')];let V=[];const Z=$.value;return V=V.concat(Eo({key:$.key,value:Z,valueSpec:$.valueSpec,validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec,arrayElementValidator:L})),Fr(Z)==="array"&&Z.length===0&&V.push(new qe($.key,Z,"array must have at least one stop")),V},default:function($){return $.validateSpec({key:$.key,value:$.value,valueSpec:t,validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec})}}});return a==="identity"&&x&&M.push(new qe(s.key,s.value,'missing required property "property"')),a==="identity"||s.value.stops||M.push(new qe(s.key,s.value,'missing required property "stops"')),a==="exponential"&&s.valueSpec.expression&&!Mu(s.valueSpec)&&M.push(new qe(s.key,s.value,"exponential functions not supported")),s.styleSpec.$version>=8&&(I&&!Ao(s.valueSpec)?M.push(new qe(s.key,s.value,"property functions not supported")):x&&!Sd(s.valueSpec)&&M.push(new qe(s.key,s.value,"zoom functions not supported"))),a!=="categorical"&&!E||s.value.property!==void 0||M.push(new qe(s.key,s.value,'"property" property is required')),M;function L($){let V=[];const Z=$.value,ee=$.key;if(Fr(Z)!=="array")return[new qe(ee,Z,`array expected, ${Fr(Z)} found`)];if(Z.length!==2)return[new qe(ee,Z,`array length 2 expected, length ${Z.length} found`)];if(E){if(Fr(Z[0])!=="object")return[new qe(ee,Z,`object expected, ${Fr(Z[0])} found`)];if(Z[0].zoom===void 0)return[new qe(ee,Z,"object stop key must have zoom")];if(Z[0].value===void 0)return[new qe(ee,Z,"object stop key must have value")];if(g&&g>Ci(Z[0].zoom))return[new qe(ee,Z[0].zoom,"stop zoom values must appear in ascending order")];Ci(Z[0].zoom)!==g&&(g=Ci(Z[0].zoom),d=void 0,_={}),V=V.concat(Nn({key:`${ee}[0]`,value:Z[0],valueSpec:{zoom:{}},validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec,objectElementValidators:{zoom:dl,value:F}}))}else V=V.concat(F({key:`${ee}[0]`,value:Z[0],valueSpec:{},validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec},Z));return oc(Ya(Z[1]))?V.concat([new qe(`${ee}[1]`,Z[1],"expressions are not allowed in function stops.")]):V.concat($.validateSpec({key:`${ee}[1]`,value:Z[1],valueSpec:t,validateSpec:$.validateSpec,style:$.style,styleSpec:$.styleSpec}))}function F($,V){const Z=Fr($.value),ee=Ci($.value),ie=$.value!==null?$.value:V;if(u){if(Z!==u)return[new qe($.key,ie,`${Z} stop domain type must match previous stop domain type ${u}`)]}else u=Z;if(Z!=="number"&&Z!=="string"&&Z!=="boolean")return[new qe($.key,ie,"stop domain value must be a number, string, or boolean")];if(Z!=="number"&&a!=="categorical"){let ye=`number expected, ${Z} found`;return Ao(t)&&a===void 0&&(ye+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new qe($.key,ie,ye)]}return a!=="categorical"||Z!=="number"||isFinite(ee)&&Math.floor(ee)===ee?a!=="categorical"&&Z==="number"&&d!==void 0&&eenew qe(`${s.key}${u.key}`,s.value,u.message));const a=t.value.expression||t.value._styleExpression.expression;if(s.expressionContext==="property"&&s.propertyKey==="text-font"&&!a.outputDefined())return[new qe(s.key,s.value,`Invalid data expression for "${s.propertyKey}". Output values must be contained as literals within the expression.`)];if(s.expressionContext==="property"&&s.propertyType==="layout"&&!al(a))return[new qe(s.key,s.value,'"feature-state" data expressions are not supported with layout properties.')];if(s.expressionContext==="filter"&&!al(a))return[new qe(s.key,s.value,'"feature-state" data expressions are not supported with filters.')];if(s.expressionContext&&s.expressionContext.indexOf("cluster")===0){if(!ec(a,["zoom","feature-state"]))return[new qe(s.key,s.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(s.expressionContext==="cluster-initial"&&!Ql(a))return[new qe(s.key,s.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function fl(s){const t=s.key,a=s.value,u=s.valueSpec,d=[];return Array.isArray(u.values)?u.values.indexOf(Ci(a))===-1&&d.push(new qe(t,a,`expected one of [${u.values.join(", ")}], ${JSON.stringify(a)} found`)):Object.keys(u.values).indexOf(Ci(a))===-1&&d.push(new qe(t,a,`expected one of [${Object.keys(u.values).join(", ")}], ${JSON.stringify(a)} found`)),d}function Co(s){return ul(Ya(s.value))?Ka(dn({},s,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Cd(s)}function Cd(s){const t=s.value,a=s.key;if(Fr(t)!=="array")return[new qe(a,t,`array expected, ${Fr(t)} found`)];const u=s.styleSpec;let d,g=[];if(t.length<1)return[new qe(a,t,"filter array must have at least 1 element")];switch(g=g.concat(fl({key:`${a}[0]`,value:t[0],valueSpec:u.filter_operator,style:s.style,styleSpec:s.styleSpec})),Ci(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Ci(t[1])==="$type"&&g.push(new qe(a,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&g.push(new qe(a,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(d=Fr(t[1]),d!=="string"&&g.push(new qe(`${a}[1]`,t[1],`string expected, ${d} found`)));for(let _=2;_{E in a&&t.push(new qe(u,a[E],`"${E}" is prohibited for ref layers`))}),d.layers.forEach(E=>{Ci(E.id)===x&&(I=E)}),I?I.ref?t.push(new qe(u,a.ref,"ref cannot reference another ref layer")):_=Ci(I.type):t.push(new qe(u,a.ref,`ref layer "${x}" not found`))}else if(_!=="background")if(a.source){const I=d.sources&&d.sources[a.source],E=I&&Ci(I.type);I?E==="vector"&&_==="raster"?t.push(new qe(u,a.source,`layer "${a.id}" requires a raster source`)):E!=="raster-dem"&&_==="hillshade"?t.push(new qe(u,a.source,`layer "${a.id}" requires a raster-dem source`)):E==="raster"&&_!=="raster"?t.push(new qe(u,a.source,`layer "${a.id}" requires a vector source`)):E!=="vector"||a["source-layer"]?E==="raster-dem"&&_!=="hillshade"?t.push(new qe(u,a.source,"raster-dem source can only be used with layer type 'hillshade'.")):_!=="line"||!a.paint||!a.paint["line-gradient"]||E==="geojson"&&I.lineMetrics||t.push(new qe(u,a,`layer "${a.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new qe(u,a,`layer "${a.id}" must specify a "source-layer"`)):t.push(new qe(u,a.source,`source "${a.source}" not found`))}else t.push(new qe(u,a,'missing required property "source"'));return t=t.concat(Nn({key:u,value:a,valueSpec:g.layer,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,objectElementValidators:{"*":()=>[],type:()=>s.validateSpec({key:`${u}.type`,value:a.type,valueSpec:g.layer.type,style:s.style,styleSpec:s.styleSpec,validateSpec:s.validateSpec,object:a,objectKey:"type"}),filter:Co,layout:I=>Nn({layer:a,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":E=>Pd(dn({layerType:_},E))}}),paint:I=>Nn({layer:a,key:I.key,value:I.value,style:I.style,styleSpec:I.styleSpec,validateSpec:I.validateSpec,objectElementValidators:{"*":E=>Dd(dn({layerType:_},E))}})}})),t}function Os(s){const t=s.value,a=s.key,u=Fr(t);return u!=="string"?[new qe(a,t,`string expected, ${u} found`)]:[]}const pl={promoteId:function({key:s,value:t}){if(Fr(t)==="string")return Os({key:s,value:t});{const a=[];for(const u in t)a.push(...Os({key:`${s}.${u}`,value:t[u]}));return a}}};function es(s){const t=s.value,a=s.key,u=s.styleSpec,d=s.style,g=s.validateSpec;if(!t.type)return[new qe(a,t,'"type" is required')];const _=Ci(t.type);let x;switch(_){case"vector":case"raster":return x=Nn({key:a,value:t,valueSpec:u[`source_${_.replace("-","_")}`],style:s.style,styleSpec:u,objectElementValidators:pl,validateSpec:g}),x;case"raster-dem":return x=function(I){var E;const M=(E=I.sourceName)!==null&&E!==void 0?E:"",L=I.value,F=I.styleSpec,$=F.source_raster_dem,V=I.style;let Z=[];const ee=Fr(L);if(L===void 0)return Z;if(ee!=="object")return Z.push(new qe("source_raster_dem",L,`object expected, ${ee} found`)),Z;const ie=Ci(L.encoding)==="custom",ye=["redFactor","greenFactor","blueFactor","baseShift"],ue=I.value.encoding?`"${I.value.encoding}"`:"Default";for(const be in L)!ie&&ye.includes(be)?Z.push(new qe(be,L[be],`In "${M}": "${be}" is only valid when "encoding" is set to "custom". ${ue} encoding found`)):$[be]?Z=Z.concat(I.validateSpec({key:be,value:L[be],valueSpec:$[be],validateSpec:I.validateSpec,style:V,styleSpec:F})):Z.push(new qe(be,L[be],`unknown property "${be}"`));return Z}({sourceName:a,value:t,style:s.style,styleSpec:u,validateSpec:g}),x;case"geojson":if(x=Nn({key:a,value:t,valueSpec:u.source_geojson,style:d,styleSpec:u,validateSpec:g,objectElementValidators:pl}),t.cluster)for(const I in t.clusterProperties){const[E,M]=t.clusterProperties[I],L=typeof E=="string"?[E,["accumulated"],["get",I]]:E;x.push(...Ka({key:`${a}.${I}.map`,value:M,validateSpec:g,expressionContext:"cluster-map"})),x.push(...Ka({key:`${a}.${I}.reduce`,value:L,validateSpec:g,expressionContext:"cluster-reduce"}))}return x;case"video":return Nn({key:a,value:t,valueSpec:u.source_video,style:d,validateSpec:g,styleSpec:u});case"image":return Nn({key:a,value:t,valueSpec:u.source_image,style:d,validateSpec:g,styleSpec:u});case"canvas":return[new qe(a,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return fl({key:`${a}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:d,validateSpec:g,styleSpec:u})}}function ml(s){const t=s.value,a=s.styleSpec,u=a.light,d=s.style;let g=[];const _=Fr(t);if(t===void 0)return g;if(_!=="object")return g=g.concat([new qe("light",t,`object expected, ${_} found`)]),g;for(const x in t){const I=x.match(/^(.*)-transition$/);g=g.concat(I&&u[I[1]]&&u[I[1]].transition?s.validateSpec({key:x,value:t[x],valueSpec:a.transition,validateSpec:s.validateSpec,style:d,styleSpec:a}):u[x]?s.validateSpec({key:x,value:t[x],valueSpec:u[x],validateSpec:s.validateSpec,style:d,styleSpec:a}):[new qe(x,t[x],`unknown property "${x}"`)])}return g}function zd(s){const t=s.value,a=s.styleSpec,u=a.terrain,d=s.style;let g=[];const _=Fr(t);if(t===void 0)return g;if(_!=="object")return g=g.concat([new qe("terrain",t,`object expected, ${_} found`)]),g;for(const x in t)g=g.concat(u[x]?s.validateSpec({key:x,value:t[x],valueSpec:u[x],validateSpec:s.validateSpec,style:d,styleSpec:a}):[new qe(x,t[x],`unknown property "${x}"`)]);return g}function Bd(s){let t=[];const a=s.value,u=s.key;if(Array.isArray(a)){const d=[],g=[];for(const _ in a)a[_].id&&d.includes(a[_].id)&&t.push(new qe(u,a,`all the sprites' ids must be unique, but ${a[_].id} is duplicated`)),d.push(a[_].id),a[_].url&&g.includes(a[_].url)&&t.push(new qe(u,a,`all the sprites' URLs must be unique, but ${a[_].url} is duplicated`)),g.push(a[_].url),t=t.concat(Nn({key:`${u}[${_}]`,value:a[_],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:s.validateSpec}));return t}return Os({key:u,value:a})}const Rd={"*":()=>[],array:Eo,boolean:function(s){const t=s.value,a=s.key,u=Fr(t);return u!=="boolean"?[new qe(a,t,`boolean expected, ${u} found`)]:[]},number:dl,color:function(s){const t=s.key,a=s.value,u=Fr(a);return u!=="string"?[new qe(t,a,`color expected, ${u} found`)]:qr.parse(String(a))?[]:[new qe(t,a,`color expected, "${a}" found`)]},constants:Ed,enum:fl,filter:Co,function:fc,layer:Ld,object:Nn,source:es,light:ml,terrain:zd,string:Os,formatted:function(s){return Os(s).length===0?[]:Ka(s)},resolvedImage:function(s){return Os(s).length===0?[]:Ka(s)},padding:function(s){const t=s.key,a=s.value;if(Fr(a)==="array"){if(a.length<1||a.length>4)return[new qe(t,a,`padding requires 1 to 4 values; ${a.length} values found`)];const u={type:"number"};let d=[];for(let g=0;g[]}})),s.constants&&(a=a.concat(Ed({key:"constants",value:s.constants,style:s,styleSpec:t,validateSpec:ta}))),pc(a)}function ra(s){return function(t){return s({...t,validateSpec:ta})}}function pc(s){return[].concat(s).sort((t,a)=>t.line-a.line)}function ia(s){return function(...t){return pc(s.apply(this,t))}}ys.source=ia(ra(es)),ys.sprite=ia(ra(Bd)),ys.glyphs=ia(ra(Fd)),ys.light=ia(ra(ml)),ys.terrain=ia(ra(zd)),ys.layer=ia(ra(Ld)),ys.filter=ia(ra(Co)),ys.paintProperty=ia(ra(Dd)),ys.layoutProperty=ia(ra(Pd));const na=ys,bm=na.light,Ru=na.paintProperty,Od=na.layoutProperty;function mc(s,t){let a=!1;if(t&&t.length)for(const u of t)s.fire(new Mn(new Error(u.message))),a=!0;return a}class Mo{constructor(t,a,u){const d=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const _=new Int32Array(this.arrayBuffer);t=_[0],this.d=(a=_[1])+2*(u=_[2]);for(let I=0;I=L[V+0]&&d>=L[V+1])?(x[$]=!0,_.push(M[$])):x[$]=!1}}}}_forEachCell(t,a,u,d,g,_,x,I){const E=this._convertToCellCoord(t),M=this._convertToCellCoord(a),L=this._convertToCellCoord(u),F=this._convertToCellCoord(d);for(let $=E;$<=L;$++)for(let V=M;V<=F;V++){const Z=this.d*V+$;if((!I||I(this._convertFromCellCoord($),this._convertFromCellCoord(V),this._convertFromCellCoord($+1),this._convertFromCellCoord(V+1)))&&g.call(this,t,a,u,d,Z,_,x,I))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,a=3+this.cells.length+1+1;let u=0;for(let _=0;_=0)continue;const _=s[g];d[g]=sa[u].shallow.indexOf(g)>=0?_:Sa(_,t)}s instanceof Error&&(d.message=s.message)}if(d.$name)throw new Error("$name property is reserved for worker serialization logic.");return u!=="Object"&&(d.$name=u),d}throw new Error("can't serialize object of type "+typeof s)}function Do(s){if(s==null||typeof s=="boolean"||typeof s=="number"||typeof s=="string"||s instanceof Boolean||s instanceof Number||s instanceof String||s instanceof Date||s instanceof RegExp||s instanceof Blob||gc(s)||ft(s)||ArrayBuffer.isView(s)||s instanceof ImageData)return s;if(Array.isArray(s))return s.map(Do);if(typeof s=="object"){const t=s.$name||"Object";if(!sa[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:a}=sa[t];if(!a)throw new Error(`can't deserialize unregistered class ${t}`);if(a.deserialize)return a.deserialize(s);const u=Object.create(a.prototype);for(const d of Object.keys(s)){if(d==="$name")continue;const g=s[d];u[d]=sa[t].shallow.indexOf(d)>=0?g:Do(g)}return u}throw new Error("can't deserialize object of type "+typeof s)}class Nd{constructor(){this.first=!0}update(t,a){const u=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=u,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=u,!0):(this.lastFloorZoom>u?(this.lastIntegerZoom=u+1,this.lastIntegerZoomTime=a):this.lastFloorZooms>=128&&s<=255,Arabic:s=>s>=1536&&s<=1791,"Arabic Supplement":s=>s>=1872&&s<=1919,"Arabic Extended-A":s=>s>=2208&&s<=2303,"Hangul Jamo":s=>s>=4352&&s<=4607,"Unified Canadian Aboriginal Syllabics":s=>s>=5120&&s<=5759,Khmer:s=>s>=6016&&s<=6143,"Unified Canadian Aboriginal Syllabics Extended":s=>s>=6320&&s<=6399,"General Punctuation":s=>s>=8192&&s<=8303,"Letterlike Symbols":s=>s>=8448&&s<=8527,"Number Forms":s=>s>=8528&&s<=8591,"Miscellaneous Technical":s=>s>=8960&&s<=9215,"Control Pictures":s=>s>=9216&&s<=9279,"Optical Character Recognition":s=>s>=9280&&s<=9311,"Enclosed Alphanumerics":s=>s>=9312&&s<=9471,"Geometric Shapes":s=>s>=9632&&s<=9727,"Miscellaneous Symbols":s=>s>=9728&&s<=9983,"Miscellaneous Symbols and Arrows":s=>s>=11008&&s<=11263,"CJK Radicals Supplement":s=>s>=11904&&s<=12031,"Kangxi Radicals":s=>s>=12032&&s<=12255,"Ideographic Description Characters":s=>s>=12272&&s<=12287,"CJK Symbols and Punctuation":s=>s>=12288&&s<=12351,Hiragana:s=>s>=12352&&s<=12447,Katakana:s=>s>=12448&&s<=12543,Bopomofo:s=>s>=12544&&s<=12591,"Hangul Compatibility Jamo":s=>s>=12592&&s<=12687,Kanbun:s=>s>=12688&&s<=12703,"Bopomofo Extended":s=>s>=12704&&s<=12735,"CJK Strokes":s=>s>=12736&&s<=12783,"Katakana Phonetic Extensions":s=>s>=12784&&s<=12799,"Enclosed CJK Letters and Months":s=>s>=12800&&s<=13055,"CJK Compatibility":s=>s>=13056&&s<=13311,"CJK Unified Ideographs Extension A":s=>s>=13312&&s<=19903,"Yijing Hexagram Symbols":s=>s>=19904&&s<=19967,"CJK Unified Ideographs":s=>s>=19968&&s<=40959,"Yi Syllables":s=>s>=40960&&s<=42127,"Yi Radicals":s=>s>=42128&&s<=42191,"Hangul Jamo Extended-A":s=>s>=43360&&s<=43391,"Hangul Syllables":s=>s>=44032&&s<=55215,"Hangul Jamo Extended-B":s=>s>=55216&&s<=55295,"Private Use Area":s=>s>=57344&&s<=63743,"CJK Compatibility Ideographs":s=>s>=63744&&s<=64255,"Arabic Presentation Forms-A":s=>s>=64336&&s<=65023,"Vertical Forms":s=>s>=65040&&s<=65055,"CJK Compatibility Forms":s=>s>=65072&&s<=65103,"Small Form Variants":s=>s>=65104&&s<=65135,"Arabic Presentation Forms-B":s=>s>=65136&&s<=65279,"Halfwidth and Fullwidth Forms":s=>s>=65280&&s<=65519};function Fu(s){for(const t of s)if(Nu(t.charCodeAt(0)))return!0;return!1}function Ou(s){for(const t of s)if(!xm(t.charCodeAt(0)))return!1;return!0}function xm(s){return!(pt.Arabic(s)||pt["Arabic Supplement"](s)||pt["Arabic Extended-A"](s)||pt["Arabic Presentation Forms-A"](s)||pt["Arabic Presentation Forms-B"](s))}function Nu(s){return!(s!==746&&s!==747&&(s<4352||!(pt["Bopomofo Extended"](s)||pt.Bopomofo(s)||pt["CJK Compatibility Forms"](s)&&!(s>=65097&&s<=65103)||pt["CJK Compatibility Ideographs"](s)||pt["CJK Compatibility"](s)||pt["CJK Radicals Supplement"](s)||pt["CJK Strokes"](s)||!(!pt["CJK Symbols and Punctuation"](s)||s>=12296&&s<=12305||s>=12308&&s<=12319||s===12336)||pt["CJK Unified Ideographs Extension A"](s)||pt["CJK Unified Ideographs"](s)||pt["Enclosed CJK Letters and Months"](s)||pt["Hangul Compatibility Jamo"](s)||pt["Hangul Jamo Extended-A"](s)||pt["Hangul Jamo Extended-B"](s)||pt["Hangul Jamo"](s)||pt["Hangul Syllables"](s)||pt.Hiragana(s)||pt["Ideographic Description Characters"](s)||pt.Kanbun(s)||pt["Kangxi Radicals"](s)||pt["Katakana Phonetic Extensions"](s)||pt.Katakana(s)&&s!==12540||!(!pt["Halfwidth and Fullwidth Forms"](s)||s===65288||s===65289||s===65293||s>=65306&&s<=65310||s===65339||s===65341||s===65343||s>=65371&&s<=65503||s===65507||s>=65512&&s<=65519)||!(!pt["Small Form Variants"](s)||s>=65112&&s<=65118||s>=65123&&s<=65126)||pt["Unified Canadian Aboriginal Syllabics"](s)||pt["Unified Canadian Aboriginal Syllabics Extended"](s)||pt["Vertical Forms"](s)||pt["Yijing Hexagram Symbols"](s)||pt["Yi Syllables"](s)||pt["Yi Radicals"](s))))}function Ud(s){return!(Nu(s)||function(t){return!!(pt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||pt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||pt["Letterlike Symbols"](t)||pt["Number Forms"](t)||pt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||pt["Control Pictures"](t)&&t!==9251||pt["Optical Character Recognition"](t)||pt["Enclosed Alphanumerics"](t)||pt["Geometric Shapes"](t)||pt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||pt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||pt["CJK Symbols and Punctuation"](t)||pt.Katakana(t)||pt["Private Use Area"](t)||pt["CJK Compatibility Forms"](t)||pt["Small Form Variants"](t)||pt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(s))}function $d(s){return s>=1424&&s<=2303||pt["Arabic Presentation Forms-A"](s)||pt["Arabic Presentation Forms-B"](s)}function Vd(s,t){return!(!t&&$d(s)||s>=2304&&s<=3583||s>=3840&&s<=4255||pt.Khmer(s))}function wm(s){for(const t of s)if($d(t.charCodeAt(0)))return!0;return!1}const Uu="deferred",$u="loading",Vu="loaded";let ju=null,Un="unavailable",Ia=null;const gl=function(s){s&&typeof s=="string"&&s.indexOf("NetworkError")>-1&&(Un="error"),ju&&ju(s)};function qu(){yl.fire(new cn("pluginStateChange",{pluginStatus:Un,pluginURL:Ia}))}const yl=new vi,Gu=function(){return Un},jd=function(){if(Un!==Uu||!Ia)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");Un=$u,qu(),Ia&&Jr({url:Ia},s=>{s?gl(s):(Un=Vu,qu())})},ts={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>Un===Vu||ts.applyArabicShaping!=null,isLoading:()=>Un===$u,setState(s){if(!At())throw new Error("Cannot set the state of the rtl-text-plugin when not in the web-worker context");Un=s.pluginStatus,Ia=s.pluginURL},isParsed(){if(!At())throw new Error("rtl-text-plugin is only parsed on the worker-threads");return ts.applyArabicShaping!=null&&ts.processBidirectionalText!=null&&ts.processStyledBidirectionalText!=null},getPluginURL(){if(!At())throw new Error("rtl-text-plugin url can only be queried from the worker threads");return Ia}};class ui{constructor(t,a){this.zoom=t,a?(this.now=a.now,this.fadeDuration=a.fadeDuration,this.zoomHistory=a.zoomHistory,this.transition=a.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Nd,this.transition={})}isSupportedScript(t){return function(a,u){for(const d of a)if(!Vd(d.charCodeAt(0),u))return!1;return!0}(t,ts.isLoaded())}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,a=t-Math.floor(t),u=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:a+(1-a)*u}:{fromScale:.5,toScale:1,t:1-(1-u)*a}}}class yc{constructor(t,a){this.property=t,this.value=a,this.expression=function(u,d){if(wi(u))return new ll(u,d);if(oc(u)){const g=Lu(u,d);if(g.result==="error")throw new Error(g.value.map(_=>`${_.key}: ${_.message}`).join(", "));return g.value}{let g=u;return d.type==="color"&&typeof u=="string"?g=qr.parse(u):d.type!=="padding"||typeof u!="number"&&!Array.isArray(u)?d.type==="variableAnchorOffsetCollection"&&Array.isArray(u)&&(g=ps.parse(u)):g=Xn.parse(u),{kind:"constant",evaluate:()=>g}}}(a===void 0?t.specification.default:a,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,a,u){return this.property.possiblyEvaluate(this,t,a,u)}}class Zu{constructor(t){this.property=t,this.value=new yc(t,void 0)}transitioned(t,a){return new Gd(this.property,this.value,a,ke({},t.transition,this.transition),t.now)}untransitioned(){return new Gd(this.property,this.value,null,{},0)}}class qd{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Ye(this._values[t].value.value)}setValue(t,a){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Zu(this._values[t].property)),this._values[t].value=new yc(this._values[t].property,a===null?void 0:Ye(a))}getTransition(t){return Ye(this._values[t].transition)}setTransition(t,a){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Zu(this._values[t].property)),this._values[t].transition=Ye(a)||void 0}serialize(){const t={};for(const a of Object.keys(this._values)){const u=this.getValue(a);u!==void 0&&(t[a]=u);const d=this.getTransition(a);d!==void 0&&(t[`${a}-transition`]=d)}return t}transitioned(t,a){const u=new Zd(this._properties);for(const d of Object.keys(this._values))u._values[d]=this._values[d].transitioned(t,a._values[d]);return u}untransitioned(){const t=new Zd(this._properties);for(const a of Object.keys(this._values))t._values[a]=this._values[a].untransitioned();return t}}class Gd{constructor(t,a,u,d,g){this.property=t,this.value=a,this.begin=g+d.delay||0,this.end=this.begin+d.duration||0,t.specification.transition&&(d.delay||d.duration)&&(this.prior=u)}possiblyEvaluate(t,a,u){const d=t.now||0,g=this.value.possiblyEvaluate(t,a,u),_=this.prior;if(_){if(d>this.end)return this.prior=null,g;if(this.value.isDataDriven())return this.prior=null,g;if(d=1)return 1;const E=I*I,M=E*I;return 4*(I<.5?M:3*(I-E)+M-.75)}(x))}}return g}}class Zd{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,a,u){const d=new _c(this._properties);for(const g of Object.keys(this._values))d._values[g]=this._values[g].possiblyEvaluate(t,a,u);return d}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Sm{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Ye(this._values[t].value)}setValue(t,a){this._values[t]=new yc(this._values[t].property,a===null?void 0:Ye(a))}serialize(){const t={};for(const a of Object.keys(this._values)){const u=this.getValue(a);u!==void 0&&(t[a]=u)}return t}possiblyEvaluate(t,a,u){const d=new _c(this._properties);for(const g of Object.keys(this._values))d._values[g]=this._values[g].possiblyEvaluate(t,a,u);return d}}class Dn{constructor(t,a,u){this.property=t,this.value=a,this.parameters=u}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,a,u,d){return this.property.evaluate(this.value,this.parameters,t,a,u,d)}}class _c{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Lt{constructor(t){this.specification=t}possiblyEvaluate(t,a){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(a)}interpolate(t,a,u){const d=Jn[this.specification.type];return d?d(t,a,u):t}}class Ut{constructor(t,a){this.specification=t,this.overrides=a}possiblyEvaluate(t,a,u,d){return new Dn(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(a,null,{},u,d)}:t.expression,a)}interpolate(t,a,u){if(t.value.kind!=="constant"||a.value.kind!=="constant")return t;if(t.value.value===void 0||a.value.value===void 0)return new Dn(this,{kind:"constant",value:void 0},t.parameters);const d=Jn[this.specification.type];if(d){const g=d(t.value.value,a.value.value,u);return new Dn(this,{kind:"constant",value:g},t.parameters)}return t}evaluate(t,a,u,d,g,_){return t.kind==="constant"?t.value:t.evaluate(a,u,d,g,_)}}class _l extends Ut{possiblyEvaluate(t,a,u,d){if(t.value===void 0)return new Dn(this,{kind:"constant",value:void 0},a);if(t.expression.kind==="constant"){const g=t.expression.evaluate(a,null,{},u,d),_=t.property.specification.type==="resolvedImage"&&typeof g!="string"?g.name:g,x=this._calculate(_,_,_,a);return new Dn(this,{kind:"constant",value:x},a)}if(t.expression.kind==="camera"){const g=this._calculate(t.expression.evaluate({zoom:a.zoom-1}),t.expression.evaluate({zoom:a.zoom}),t.expression.evaluate({zoom:a.zoom+1}),a);return new Dn(this,{kind:"constant",value:g},a)}return new Dn(this,t.expression,a)}evaluate(t,a,u,d,g,_){if(t.kind==="source"){const x=t.evaluate(a,u,d,g,_);return this._calculate(x,x,x,a)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(a.zoom)-1},u,d),t.evaluate({zoom:Math.floor(a.zoom)},u,d),t.evaluate({zoom:Math.floor(a.zoom)+1},u,d),a):t.value}_calculate(t,a,u,d){return d.zoom>d.zoomHistory.lastIntegerZoom?{from:t,to:a}:{from:u,to:a}}interpolate(t){return t}}class Wu{constructor(t){this.specification=t}possiblyEvaluate(t,a,u,d){if(t.value!==void 0){if(t.expression.kind==="constant"){const g=t.expression.evaluate(a,null,{},u,d);return this._calculate(g,g,g,a)}return this._calculate(t.expression.evaluate(new ui(Math.floor(a.zoom-1),a)),t.expression.evaluate(new ui(Math.floor(a.zoom),a)),t.expression.evaluate(new ui(Math.floor(a.zoom+1),a)),a)}}_calculate(t,a,u,d){return d.zoom>d.zoomHistory.lastIntegerZoom?{from:t,to:a}:{from:u,to:a}}interpolate(t){return t}}class Hu{constructor(t){this.specification=t}possiblyEvaluate(t,a,u,d){return!!t.expression.evaluate(a,null,{},u,d)}interpolate(){return!1}}class Vi{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const a in t){const u=t[a];u.specification.overridable&&this.overridableProperties.push(a);const d=this.defaultPropertyValues[a]=new yc(u,void 0),g=this.defaultTransitionablePropertyValues[a]=new Zu(u);this.defaultTransitioningPropertyValues[a]=g.untransitioned(),this.defaultPossiblyEvaluatedValues[a]=d.possiblyEvaluate({})}}}yt("DataDrivenProperty",Ut),yt("DataConstantProperty",Lt),yt("CrossFadedDataDrivenProperty",_l),yt("CrossFadedProperty",Wu),yt("ColorRampProperty",Hu);const Yu="-transition";class _s extends vi{constructor(t,a){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),a.layout&&(this._unevaluatedLayout=new Sm(a.layout)),a.paint)){this._transitionablePaint=new qd(a.paint);for(const u in t.paint)this.setPaintProperty(u,t.paint[u],{validate:!1});for(const u in t.layout)this.setLayoutProperty(u,t.layout[u],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new _c(a.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,a,u={}){a!=null&&this._validate(Od,`layers.${this.id}.layout.${t}`,t,a,u)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,a):this.visibility=a)}getPaintProperty(t){return t.endsWith(Yu)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,a,u={}){if(a!=null&&this._validate(Ru,`layers.${this.id}.paint.${t}`,t,a,u))return!1;if(t.endsWith(Yu))return this._transitionablePaint.setTransition(t.slice(0,-11),a||void 0),!1;{const d=this._transitionablePaint._values[t],g=d.property.specification["property-type"]==="cross-faded-data-driven",_=d.value.isDataDriven(),x=d.value;this._transitionablePaint.setValue(t,a),this._handleSpecialPaintPropertyUpdate(t);const I=this._transitionablePaint._values[t].value;return I.isDataDriven()||_||g||this._handleOverridablePaintPropertyUpdate(t,x,I)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,a,u){return!1}isHidden(t){return!!(this.minzoom&&t=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,a){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,a)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,a)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),He(t,(a,u)=>!(a===void 0||u==="layout"&&!Object.keys(a).length||u==="paint"&&!Object.keys(a).length))}_validate(t,a,u,d,g={}){return(!g||g.validate!==!1)&&mc(this,t.call(na,{key:a,layerType:this.type,objectKey:u,value:d,styleSpec:Ce,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const a=this.paint.get(t);if(a instanceof Dn&&Ao(a.property.specification)&&(a.value.kind==="source"||a.value.kind==="composite")&&a.value.isStateDependent)return!0}return!1}}const Wd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Xa{constructor(t,a){this._structArray=t,this._pos1=a*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Mi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,a){return t._trim(),a&&(t.isTransferred=!0,a.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const a=Object.create(this.prototype);return a.arrayBuffer=t.arrayBuffer,a.length=t.length,a.capacity=t.arrayBuffer.byteLength/a.bytesPerElement,a._refreshViews(),a}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const a=this.uint8;this._refreshViews(),a&&this.uint8.set(a)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ii(s,t=1){let a=0,u=0;return{members:s.map(d=>{const g=Wd[d.type].BYTES_PER_ELEMENT,_=a=Po(a,Math.max(t,g)),x=d.components||1;return u=Math.max(u,g),a+=g*x,{name:d.name,type:d.type,components:x,offset:_}}),size:Po(a,Math.max(u,t)),alignment:t}}function Po(s,t){return Math.ceil(s/t)*t}class vl extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,a){const u=this.length;return this.resize(u+1),this.emplace(u,t,a)}emplace(t,a,u){const d=2*t;return this.int16[d+0]=a,this.int16[d+1]=u,t}}vl.prototype.bytesPerElement=4,yt("StructArrayLayout2i4",vl);class bl extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,a,u)}emplace(t,a,u,d){const g=3*t;return this.int16[g+0]=a,this.int16[g+1]=u,this.int16[g+2]=d,t}}bl.prototype.bytesPerElement=6,yt("StructArrayLayout3i6",bl);class Ja extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,a,u,d){const g=this.length;return this.resize(g+1),this.emplace(g,t,a,u,d)}emplace(t,a,u,d,g){const _=4*t;return this.int16[_+0]=a,this.int16[_+1]=u,this.int16[_+2]=d,this.int16[_+3]=g,t}}Ja.prototype.bytesPerElement=8,yt("StructArrayLayout4i8",Ja);class Ku extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,a,u,d,g,_)}emplace(t,a,u,d,g,_,x){const I=6*t;return this.int16[I+0]=a,this.int16[I+1]=u,this.int16[I+2]=d,this.int16[I+3]=g,this.int16[I+4]=_,this.int16[I+5]=x,t}}Ku.prototype.bytesPerElement=12,yt("StructArrayLayout2i4i12",Ku);class Xu extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,a,u,d,g,_)}emplace(t,a,u,d,g,_,x){const I=4*t,E=8*t;return this.int16[I+0]=a,this.int16[I+1]=u,this.uint8[E+4]=d,this.uint8[E+5]=g,this.uint8[E+6]=_,this.uint8[E+7]=x,t}}Xu.prototype.bytesPerElement=8,yt("StructArrayLayout2i4ub8",Xu);class Lo extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,a){const u=this.length;return this.resize(u+1),this.emplace(u,t,a)}emplace(t,a,u){const d=2*t;return this.float32[d+0]=a,this.float32[d+1]=u,t}}Lo.prototype.bytesPerElement=8,yt("StructArrayLayout2f8",Lo);class Ju extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_,x,I,E,M){const L=this.length;return this.resize(L+1),this.emplace(L,t,a,u,d,g,_,x,I,E,M)}emplace(t,a,u,d,g,_,x,I,E,M,L){const F=10*t;return this.uint16[F+0]=a,this.uint16[F+1]=u,this.uint16[F+2]=d,this.uint16[F+3]=g,this.uint16[F+4]=_,this.uint16[F+5]=x,this.uint16[F+6]=I,this.uint16[F+7]=E,this.uint16[F+8]=M,this.uint16[F+9]=L,t}}Ju.prototype.bytesPerElement=20,yt("StructArrayLayout10ui20",Ju);class Qu extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_,x,I,E,M,L,F){const $=this.length;return this.resize($+1),this.emplace($,t,a,u,d,g,_,x,I,E,M,L,F)}emplace(t,a,u,d,g,_,x,I,E,M,L,F,$){const V=12*t;return this.int16[V+0]=a,this.int16[V+1]=u,this.int16[V+2]=d,this.int16[V+3]=g,this.uint16[V+4]=_,this.uint16[V+5]=x,this.uint16[V+6]=I,this.uint16[V+7]=E,this.int16[V+8]=M,this.int16[V+9]=L,this.int16[V+10]=F,this.int16[V+11]=$,t}}Qu.prototype.bytesPerElement=24,yt("StructArrayLayout4i4ui4i24",Qu);class Or extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,a,u)}emplace(t,a,u,d){const g=3*t;return this.float32[g+0]=a,this.float32[g+1]=u,this.float32[g+2]=d,t}}Or.prototype.bytesPerElement=12,yt("StructArrayLayout3f12",Or);class m extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const a=this.length;return this.resize(a+1),this.emplace(a,t)}emplace(t,a){return this.uint32[1*t+0]=a,t}}m.prototype.bytesPerElement=4,yt("StructArrayLayout1ul4",m);class i extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_,x,I,E){const M=this.length;return this.resize(M+1),this.emplace(M,t,a,u,d,g,_,x,I,E)}emplace(t,a,u,d,g,_,x,I,E,M){const L=10*t,F=5*t;return this.int16[L+0]=a,this.int16[L+1]=u,this.int16[L+2]=d,this.int16[L+3]=g,this.int16[L+4]=_,this.int16[L+5]=x,this.uint32[F+3]=I,this.uint16[L+8]=E,this.uint16[L+9]=M,t}}i.prototype.bytesPerElement=20,yt("StructArrayLayout6i1ul2ui20",i);class o extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_){const x=this.length;return this.resize(x+1),this.emplace(x,t,a,u,d,g,_)}emplace(t,a,u,d,g,_,x){const I=6*t;return this.int16[I+0]=a,this.int16[I+1]=u,this.int16[I+2]=d,this.int16[I+3]=g,this.int16[I+4]=_,this.int16[I+5]=x,t}}o.prototype.bytesPerElement=12,yt("StructArrayLayout2i2i2i12",o);class h extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g){const _=this.length;return this.resize(_+1),this.emplace(_,t,a,u,d,g)}emplace(t,a,u,d,g,_){const x=4*t,I=8*t;return this.float32[x+0]=a,this.float32[x+1]=u,this.float32[x+2]=d,this.int16[I+6]=g,this.int16[I+7]=_,t}}h.prototype.bytesPerElement=16,yt("StructArrayLayout2f1f2i16",h);class f extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,a,u,d){const g=this.length;return this.resize(g+1),this.emplace(g,t,a,u,d)}emplace(t,a,u,d,g){const _=12*t,x=3*t;return this.uint8[_+0]=a,this.uint8[_+1]=u,this.float32[x+1]=d,this.float32[x+2]=g,t}}f.prototype.bytesPerElement=12,yt("StructArrayLayout2ub2f12",f);class y extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,a,u)}emplace(t,a,u,d){const g=3*t;return this.uint16[g+0]=a,this.uint16[g+1]=u,this.uint16[g+2]=d,t}}y.prototype.bytesPerElement=6,yt("StructArrayLayout3ui6",y);class w extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_,x,I,E,M,L,F,$,V,Z,ee,ie){const ye=this.length;return this.resize(ye+1),this.emplace(ye,t,a,u,d,g,_,x,I,E,M,L,F,$,V,Z,ee,ie)}emplace(t,a,u,d,g,_,x,I,E,M,L,F,$,V,Z,ee,ie,ye){const ue=24*t,be=12*t,Ie=48*t;return this.int16[ue+0]=a,this.int16[ue+1]=u,this.uint16[ue+2]=d,this.uint16[ue+3]=g,this.uint32[be+2]=_,this.uint32[be+3]=x,this.uint32[be+4]=I,this.uint16[ue+10]=E,this.uint16[ue+11]=M,this.uint16[ue+12]=L,this.float32[be+7]=F,this.float32[be+8]=$,this.uint8[Ie+36]=V,this.uint8[Ie+37]=Z,this.uint8[Ie+38]=ee,this.uint32[be+10]=ie,this.int16[ue+22]=ye,t}}w.prototype.bytesPerElement=48,yt("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",w);class S extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,a,u,d,g,_,x,I,E,M,L,F,$,V,Z,ee,ie,ye,ue,be,Ie,Fe,mt,kt,dt,at,it,vt){const nt=this.length;return this.resize(nt+1),this.emplace(nt,t,a,u,d,g,_,x,I,E,M,L,F,$,V,Z,ee,ie,ye,ue,be,Ie,Fe,mt,kt,dt,at,it,vt)}emplace(t,a,u,d,g,_,x,I,E,M,L,F,$,V,Z,ee,ie,ye,ue,be,Ie,Fe,mt,kt,dt,at,it,vt,nt){const Qe=32*t,Bt=16*t;return this.int16[Qe+0]=a,this.int16[Qe+1]=u,this.int16[Qe+2]=d,this.int16[Qe+3]=g,this.int16[Qe+4]=_,this.int16[Qe+5]=x,this.int16[Qe+6]=I,this.int16[Qe+7]=E,this.uint16[Qe+8]=M,this.uint16[Qe+9]=L,this.uint16[Qe+10]=F,this.uint16[Qe+11]=$,this.uint16[Qe+12]=V,this.uint16[Qe+13]=Z,this.uint16[Qe+14]=ee,this.uint16[Qe+15]=ie,this.uint16[Qe+16]=ye,this.uint16[Qe+17]=ue,this.uint16[Qe+18]=be,this.uint16[Qe+19]=Ie,this.uint16[Qe+20]=Fe,this.uint16[Qe+21]=mt,this.uint16[Qe+22]=kt,this.uint32[Bt+12]=dt,this.float32[Bt+13]=at,this.float32[Bt+14]=it,this.uint16[Qe+30]=vt,this.uint16[Qe+31]=nt,t}}S.prototype.bytesPerElement=64,yt("StructArrayLayout8i15ui1ul2f2ui64",S);class k extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const a=this.length;return this.resize(a+1),this.emplace(a,t)}emplace(t,a){return this.float32[1*t+0]=a,t}}k.prototype.bytesPerElement=4,yt("StructArrayLayout1f4",k);class C extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,a,u)}emplace(t,a,u,d){const g=3*t;return this.uint16[6*t+0]=a,this.float32[g+1]=u,this.float32[g+2]=d,t}}C.prototype.bytesPerElement=12,yt("StructArrayLayout1ui2f12",C);class D extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,a,u){const d=this.length;return this.resize(d+1),this.emplace(d,t,a,u)}emplace(t,a,u,d){const g=4*t;return this.uint32[2*t+0]=a,this.uint16[g+2]=u,this.uint16[g+3]=d,t}}D.prototype.bytesPerElement=8,yt("StructArrayLayout1ul2ui8",D);class P extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,a){const u=this.length;return this.resize(u+1),this.emplace(u,t,a)}emplace(t,a,u){const d=2*t;return this.uint16[d+0]=a,this.uint16[d+1]=u,t}}P.prototype.bytesPerElement=4,yt("StructArrayLayout2ui4",P);class N extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const a=this.length;return this.resize(a+1),this.emplace(a,t)}emplace(t,a){return this.uint16[1*t+0]=a,t}}N.prototype.bytesPerElement=2,yt("StructArrayLayout1ui2",N);class H extends Mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,a,u,d){const g=this.length;return this.resize(g+1),this.emplace(g,t,a,u,d)}emplace(t,a,u,d,g){const _=4*t;return this.float32[_+0]=a,this.float32[_+1]=u,this.float32[_+2]=d,this.float32[_+3]=g,t}}H.prototype.bytesPerElement=16,yt("StructArrayLayout4f16",H);class W extends Xa{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new U(this.anchorPointX,this.anchorPointY)}}W.prototype.size=20;class J extends i{get(t){return new W(this,t)}}yt("CollisionBoxArray",J);class G extends Xa{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}G.prototype.size=48;class fe extends w{get(t){return new G(this,t)}}yt("PlacedSymbolArray",fe);class Se extends Xa{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}Se.prototype.size=64;class re extends S{get(t){return new Se(this,t)}}yt("SymbolInstanceArray",re);class me extends k{getoffsetX(t){return this.float32[1*t+0]}}yt("GlyphOffsetArray",me);class Ae extends bl{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}yt("SymbolLineVertexArray",Ae);class Ee extends Xa{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}Ee.prototype.size=12;class Re extends C{get(t){return new Ee(this,t)}}yt("TextAnchorOffsetArray",Re);class Ke extends Xa{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}Ke.prototype.size=8;class Ue extends D{get(t){return new Ke(this,t)}}yt("FeatureIndexArray",Ue);class et extends vl{}class Tt extends vl{}class _r extends vl{}class st extends Ku{}class $t extends Xu{}class Et extends Lo{}class Gr extends Ju{}class gr extends Qu{}class or extends Or{}class vr extends m{}class Fi extends o{}class si extends f{}class gn extends y{}class Qi extends P{}const ji=Ii([{name:"a_pos",components:2,type:"Int16"}],4),{members:rs}=ji;class hi{constructor(t=[]){this.segments=t}prepareSegment(t,a,u,d){let g=this.segments[this.segments.length-1];return t>hi.MAX_VERTEX_ARRAY_LENGTH&&tt(`Max vertices per segment is ${hi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}`),(!g||g.vertexLength+t>hi.MAX_VERTEX_ARRAY_LENGTH||g.sortKey!==d)&&(g={vertexOffset:a.length,primitiveOffset:u.length,vertexLength:0,primitiveLength:0},d!==void 0&&(g.sortKey=d),this.segments.push(g)),g}get(){return this.segments}destroy(){for(const t of this.segments)for(const a in t.vaos)t.vaos[a].destroy()}static simpleSegment(t,a,u,d){return new hi([{vertexOffset:t,primitiveOffset:a,vertexLength:u,primitiveLength:d,vaos:{},sortKey:0}])}}function Ns(s,t){return 256*(s=De(Math.floor(s),0,255))+De(Math.floor(t),0,255)}hi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,yt("SegmentVector",hi);const Us=Ii([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var Ta={exports:{}},Qa={exports:{}};Qa.exports=function(s,t){var a,u,d,g,_,x,I,E;for(u=s.length-(a=3&s.length),d=t,_=3432918353,x=461845907,E=0;E>>16)*_&65535)<<16)&4294967295)<<15|I>>>17))*x+(((I>>>16)*x&65535)<<16)&4294967295)<<13|d>>>19))+((5*(d>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(I=0,a){case 3:I^=(255&s.charCodeAt(E+2))<<16;case 2:I^=(255&s.charCodeAt(E+1))<<8;case 1:d^=I=(65535&(I=(I=(65535&(I^=255&s.charCodeAt(E)))*_+(((I>>>16)*_&65535)<<16)&4294967295)<<15|I>>>17))*x+(((I>>>16)*x&65535)<<16)&4294967295}return d^=s.length,d=2246822507*(65535&(d^=d>>>16))+((2246822507*(d>>>16)&65535)<<16)&4294967295,d=3266489909*(65535&(d^=d>>>13))+((3266489909*(d>>>16)&65535)<<16)&4294967295,(d^=d>>>16)>>>0};var zo=Qa.exports,In={exports:{}};In.exports=function(s,t){for(var a,u=s.length,d=t^u,g=0;u>=4;)a=1540483477*(65535&(a=255&s.charCodeAt(g)|(255&s.charCodeAt(++g))<<8|(255&s.charCodeAt(++g))<<16|(255&s.charCodeAt(++g))<<24))+((1540483477*(a>>>16)&65535)<<16),d=1540483477*(65535&d)+((1540483477*(d>>>16)&65535)<<16)^(a=1540483477*(65535&(a^=a>>>24))+((1540483477*(a>>>16)&65535)<<16)),u-=4,++g;switch(u){case 3:d^=(255&s.charCodeAt(g+2))<<16;case 2:d^=(255&s.charCodeAt(g+1))<<8;case 1:d=1540483477*(65535&(d^=255&s.charCodeAt(g)))+((1540483477*(d>>>16)&65535)<<16)}return d=1540483477*(65535&(d^=d>>>13))+((1540483477*(d>>>16)&65535)<<16),(d^=d>>>15)>>>0};var yn=zo,Pn=In.exports;Ta.exports=yn,Ta.exports.murmur3=yn,Ta.exports.murmur2=Pn;var eo=T(Ta.exports);class Oi{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,a,u,d){this.ids.push(en(t)),this.positions.push(a,u,d)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const a=en(t);let u=0,d=this.ids.length-1;for(;u>1;this.ids[_]>=a?d=_:u=_+1}const g=[];for(;this.ids[u]===a;)g.push({index:this.positions[3*u],start:this.positions[3*u+1],end:this.positions[3*u+2]}),u++;return g}static serialize(t,a){const u=new Float64Array(t.ids),d=new Uint32Array(t.positions);return $n(u,d,0,u.length-1),a&&a.push(u.buffer,d.buffer),{ids:u,positions:d}}static deserialize(t){const a=new Oi;return a.ids=t.ids,a.positions=t.positions,a.indexed=!0,a}}function en(s){const t=+s;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:eo(String(s))}function $n(s,t,a,u){for(;a>1];let g=a-1,_=u+1;for(;;){do g++;while(s[g]d);if(g>=_)break;Ni(s,g,_),Ni(t,3*g,3*_),Ni(t,3*g+1,3*_+1),Ni(t,3*g+2,3*_+2)}_-a`u_${d}`),this.type=u}setUniform(t,a,u){t.set(u.constantOr(this.value))}getBinding(t,a,u){return this.type==="color"?new Yd(t,a):new vc(t,a)}}class ro{constructor(t,a){this.uniformNames=a.map(u=>`u_${u}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,a){this.pixelRatioFrom=a.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=a.tlbr,this.patternTo=t.tlbr}setUniform(t,a,u,d){const g=d==="u_pattern_to"?this.patternTo:d==="u_pattern_from"?this.patternFrom:d==="u_pixel_ratio_to"?this.pixelRatioTo:d==="u_pixel_ratio_from"?this.pixelRatioFrom:null;g&&t.set(g)}getBinding(t,a,u){return u.substr(0,9)==="u_pattern"?new Hd(t,a):new vc(t,a)}}class Vs{constructor(t,a,u,d){this.expression=t,this.type=u,this.maxValue=0,this.paintVertexAttributes=a.map(g=>({name:`a_${g}`,type:"Float32",components:u==="color"?2:1,offset:0})),this.paintVertexArray=new d}populatePaintArray(t,a,u,d,g){const _=this.paintVertexArray.length,x=this.expression.evaluate(new ui(0),a,{},d,[],g);this.paintVertexArray.resize(t),this._setPaintValue(_,t,x)}updatePaintArray(t,a,u,d){const g=this.expression.evaluate({zoom:0},u,d);this._setPaintValue(t,a,g)}_setPaintValue(t,a,u){if(this.type==="color"){const d=eh(u);for(let g=t;g`u_${x}_t`),this.type=u,this.useIntegerZoom=d,this.zoom=g,this.maxValue=0,this.paintVertexAttributes=a.map(x=>({name:`a_${x}`,type:"Float32",components:u==="color"?4:2,offset:0})),this.paintVertexArray=new _}populatePaintArray(t,a,u,d,g){const _=this.expression.evaluate(new ui(this.zoom),a,{},d,[],g),x=this.expression.evaluate(new ui(this.zoom+1),a,{},d,[],g),I=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(I,t,_,x)}updatePaintArray(t,a,u,d){const g=this.expression.evaluate({zoom:this.zoom},u,d),_=this.expression.evaluate({zoom:this.zoom+1},u,d);this._setPaintValue(t,a,g,_)}_setPaintValue(t,a,u,d){if(this.type==="color"){const g=eh(u),_=eh(d);for(let x=t;x`#define HAS_UNIFORM_${d}`))}return t}getBinderAttributes(){const t=[];for(const a in this.binders){const u=this.binders[a];if(u instanceof Vs||u instanceof vs)for(let d=0;d!0){this.programConfigurations={};for(const d of t)this.programConfigurations[d.id]=new th(d,a,u);this.needsUpload=!1,this._featureMap=new Oi,this._bufferOffset=0}populatePaintArrays(t,a,u,d,g,_){for(const x in this.programConfigurations)this.programConfigurations[x].populatePaintArrays(t,a,d,g,_);a.id!==void 0&&this._featureMap.add(a.id,u,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,a,u,d){for(const g of u)this.needsUpload=this.programConfigurations[g.id].updatePaintArrays(t,this._featureMap,a,g,d)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const a in this.programConfigurations)this.programConfigurations[a].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Fw(s,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[s]||[s.replace(`${t}-`,"").replace(/-/g,"_")]}function m_(s,t,a){const u={color:{source:Lo,composite:H},number:{source:k,composite:Lo}},d=function(g){return{"line-pattern":{source:Gr,composite:Gr},"fill-pattern":{source:Gr,composite:Gr},"fill-extrusion-pattern":{source:Gr,composite:Gr}}[g]}(s);return d&&d[a]||u[t][a]}yt("ConstantBinder",$s),yt("CrossFadedConstantBinder",ro),yt("SourceExpressionBinder",Vs),yt("CrossFadedCompositeBinder",js),yt("CompositeExpressionBinder",vs),yt("ProgramConfiguration",th,{omit:["_buffers"]}),yt("ProgramConfigurationSet",aa);const Ki=8192,Tm=Math.pow(2,14)-1,g_=-Tm-1;function xl(s){const t=Ki/s.extent,a=s.loadGeometry();for(let u=0;u_.x+1||I<_.y||I>_.y+1)&&tt("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return a}function wl(s,t){return{type:s.type,id:s.id,properties:s.properties,geometry:t?xl(s):[]}}function Kd(s,t,a,u,d){s.emplaceBack(2*t+(u+1)/2,2*a+(d+1)/2)}class km{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(a=>a.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Tt,this.indexArray=new gn,this.segments=new hi,this.programConfigurations=new aa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(t,a,u){const d=this.layers[0],g=[];let _=null,x=!1;d.type==="circle"&&(_=d.layout.get("circle-sort-key"),x=!_.isConstant());for(const{feature:I,id:E,index:M,sourceLayerIndex:L}of t){const F=this.layers[0]._featureFilter.needGeometry,$=wl(I,F);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),$,u))continue;const V=x?_.evaluate($,{},u):void 0,Z={id:E,properties:I.properties,type:I.type,sourceLayerIndex:L,index:M,geometry:F?$.geometry:xl(I),patterns:{},sortKey:V};g.push(Z)}x&&g.sort((I,E)=>I.sortKey-E.sortKey);for(const I of g){const{geometry:E,index:M,sourceLayerIndex:L}=I,F=t[M].feature;this.addFeature(I,E,M,u),a.featureIndex.insert(F,E,M,L,this.index)}}update(t,a,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,a,this.stateDependentLayers,u)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,rs),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,a,u,d){for(const g of a)for(const _ of g){const x=_.x,I=_.y;if(x<0||x>=Ki||I<0||I>=Ki)continue;const E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,t.sortKey),M=E.vertexLength;Kd(this.layoutVertexArray,x,I,-1,-1),Kd(this.layoutVertexArray,x,I,1,-1),Kd(this.layoutVertexArray,x,I,1,1),Kd(this.layoutVertexArray,x,I,-1,1),this.indexArray.emplaceBack(M,M+1,M+2),this.indexArray.emplaceBack(M,M+3,M+2),E.vertexLength+=4,E.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,u,{},d)}}function y_(s,t){for(let a=0;a1){if(Am(s,t))return!0;for(let u=0;u1?a:a.sub(t)._mult(d)._add(t))}function b_(s,t){let a,u,d,g=!1;for(let _=0;_t.y!=d.y>t.y&&t.x<(d.x-u.x)*(t.y-u.y)/(d.y-u.y)+u.x&&(g=!g)}return g}function bc(s,t){let a=!1;for(let u=0,d=s.length-1;ut.y!=_.y>t.y&&t.x<(_.x-g.x)*(t.y-g.y)/(_.y-g.y)+g.x&&(a=!a)}return a}function $w(s,t,a){const u=a[0],d=a[2];if(s.xd.x&&t.x>d.x||s.yd.y&&t.y>d.y)return!1;const g=Je(s,t,a[0]);return g!==Je(s,t,a[1])||g!==Je(s,t,a[2])||g!==Je(s,t,a[3])}function rh(s,t,a){const u=t.paint.get(s).value;return u.kind==="constant"?u.value:a.programConfigurations.get(t.id).getMaxValue(s)}function Xd(s){return Math.sqrt(s[0]*s[0]+s[1]*s[1])}function Jd(s,t,a,u,d){if(!t[0]&&!t[1])return s;const g=U.convert(t)._mult(d);a==="viewport"&&g._rotate(-u);const _=[];for(let x=0;xI_(ee,Z))}(E,I),$=L?M*x:M;for(const V of d)for(const Z of V){const ee=L?Z:I_(Z,I);let ie=$;const ye=Qd([],[Z.x,Z.y,0,1],I);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ie*=ye[3]/_.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ie*=_.cameraToCenterDistance/ye[3]),Ow(F,ee,ie))return!0}return!1}}function I_(s,t){const a=Qd([],[s.x,s.y,0,1],t);return new U(a[0]/a[3],a[1]/a[3])}class T_ extends km{}let k_;yt("HeatmapBucket",T_,{omit:["layers"]});var Gw={get paint(){return k_=k_||new Vi({"heatmap-radius":new Ut(Ce.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Ut(Ce.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Lt(Ce.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Hu(Ce.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Lt(Ce.paint_heatmap["heatmap-opacity"])})}};function Mm(s,{width:t,height:a},u,d){if(d){if(d instanceof Uint8ClampedArray)d=new Uint8Array(d.buffer);else if(d.length!==t*a*u)throw new RangeError(`mismatched image size. expected: ${d.length} but got: ${t*a*u}`)}else d=new Uint8Array(t*a*u);return s.width=t,s.height=a,s.data=d,s}function A_(s,{width:t,height:a},u){if(t===s.width&&a===s.height)return;const d=Mm({},{width:t,height:a},u);Dm(s,d,{x:0,y:0},{x:0,y:0},{width:Math.min(s.width,t),height:Math.min(s.height,a)},u),s.width=t,s.height=a,s.data=d.data}function Dm(s,t,a,u,d,g){if(d.width===0||d.height===0)return t;if(d.width>s.width||d.height>s.height||a.x>s.width-d.width||a.y>s.height-d.height)throw new RangeError("out of range source coordinates for image copy");if(d.width>t.width||d.height>t.height||u.x>t.width-d.width||u.y>t.height-d.height)throw new RangeError("out of range destination coordinates for image copy");const _=s.data,x=t.data;if(_===x)throw new Error("srcData equals dstData, so image is already copied");for(let I=0;I{t[s.evaluationKey]=I;const E=s.expression.evaluate(t);d.data[_+x+0]=Math.floor(255*E.r/E.a),d.data[_+x+1]=Math.floor(255*E.g/E.a),d.data[_+x+2]=Math.floor(255*E.b/E.a),d.data[_+x+3]=Math.floor(255*E.a)};if(s.clips)for(let _=0,x=0;_80*a){u=g=s[0],d=_=s[1];for(var V=a;Vg&&(g=x),I>_&&(_=I);E=(E=Math.max(g-u,_-d))!==0?32767/E:0}return sh(F,$,a,u,d,E,0),$}function M_(s,t,a,u,d){var g,_;if(d===Bm(s,t,a,u)>0)for(g=t;g=t;g-=u)_=L_(g,s[g],s[g+1],_);return _&&tf(_,_.next)&&(oh(_),_=_.next),_}function Sl(s,t){if(!s)return s;t||(t=s);var a,u=s;do if(a=!1,u.steiner||!tf(u,u.next)&&qi(u.prev,u,u.next)!==0)u=u.next;else{if(oh(u),(u=t=u.prev)===u.next)break;a=!0}while(a||u!==t);return t}function sh(s,t,a,u,d,g,_){if(s){!_&&g&&function(M,L,F,$){var V=M;do V.z===0&&(V.z=Lm(V.x,V.y,L,F,$)),V.prevZ=V.prev,V.nextZ=V.next,V=V.next;while(V!==M);V.prevZ.nextZ=null,V.prevZ=null,function(Z){var ee,ie,ye,ue,be,Ie,Fe,mt,kt=1;do{for(ie=Z,Z=null,be=null,Ie=0;ie;){for(Ie++,ye=ie,Fe=0,ee=0;ee0||mt>0&&ye;)Fe!==0&&(mt===0||!ye||ie.z<=ye.z)?(ue=ie,ie=ie.nextZ,Fe--):(ue=ye,ye=ye.nextZ,mt--),be?be.nextZ=ue:Z=ue,ue.prevZ=be,be=ue;ie=ye}be.nextZ=null,kt*=2}while(Ie>1)}(V)}(s,u,d,g);for(var x,I,E=s;s.prev!==s.next;)if(x=s.prev,I=s.next,g?Jw(s,u,d,g):Xw(s))t.push(x.i/a|0),t.push(s.i/a|0),t.push(I.i/a|0),oh(s),s=I.next,E=I.next;else if((s=I)===E){_?_===1?sh(s=Qw(Sl(s),t,a),t,a,u,d,g,2):_===2&&e2(s,t,a,u,d,g):sh(Sl(s),t,a,u,d,g,1);break}}}function Xw(s){var t=s.prev,a=s,u=s.next;if(qi(t,a,u)>=0)return!1;for(var d=t.x,g=a.x,_=u.x,x=t.y,I=a.y,E=u.y,M=dg?d>_?d:_:g>_?g:_,$=x>I?x>E?x:E:I>E?I:E,V=u.next;V!==t;){if(V.x>=M&&V.x<=F&&V.y>=L&&V.y<=$&&wc(d,x,g,I,_,E,V.x,V.y)&&qi(V.prev,V,V.next)>=0)return!1;V=V.next}return!0}function Jw(s,t,a,u){var d=s.prev,g=s,_=s.next;if(qi(d,g,_)>=0)return!1;for(var x=d.x,I=g.x,E=_.x,M=d.y,L=g.y,F=_.y,$=xI?x>E?x:E:I>E?I:E,ee=M>L?M>F?M:F:L>F?L:F,ie=Lm($,V,t,a,u),ye=Lm(Z,ee,t,a,u),ue=s.prevZ,be=s.nextZ;ue&&ue.z>=ie&&be&&be.z<=ye;){if(ue.x>=$&&ue.x<=Z&&ue.y>=V&&ue.y<=ee&&ue!==d&&ue!==_&&wc(x,M,I,L,E,F,ue.x,ue.y)&&qi(ue.prev,ue,ue.next)>=0||(ue=ue.prevZ,be.x>=$&&be.x<=Z&&be.y>=V&&be.y<=ee&&be!==d&&be!==_&&wc(x,M,I,L,E,F,be.x,be.y)&&qi(be.prev,be,be.next)>=0))return!1;be=be.nextZ}for(;ue&&ue.z>=ie;){if(ue.x>=$&&ue.x<=Z&&ue.y>=V&&ue.y<=ee&&ue!==d&&ue!==_&&wc(x,M,I,L,E,F,ue.x,ue.y)&&qi(ue.prev,ue,ue.next)>=0)return!1;ue=ue.prevZ}for(;be&&be.z<=ye;){if(be.x>=$&&be.x<=Z&&be.y>=V&&be.y<=ee&&be!==d&&be!==_&&wc(x,M,I,L,E,F,be.x,be.y)&&qi(be.prev,be,be.next)>=0)return!1;be=be.nextZ}return!0}function Qw(s,t,a){var u=s;do{var d=u.prev,g=u.next.next;!tf(d,g)&&D_(d,u,u.next,g)&&ah(d,g)&&ah(g,d)&&(t.push(d.i/a|0),t.push(u.i/a|0),t.push(g.i/a|0),oh(u),oh(u.next),u=s=g),u=u.next}while(u!==s);return Sl(u)}function e2(s,t,a,u,d,g){var _=s;do{for(var x=_.next.next;x!==_.prev;){if(_.i!==x.i&&s2(_,x)){var I=P_(_,x);return _=Sl(_,_.next),I=Sl(I,I.next),sh(_,t,a,u,d,g,0),void sh(I,t,a,u,d,g,0)}x=x.next}_=_.next}while(_!==s)}function t2(s,t){return s.x-t.x}function r2(s,t){var a=function(d,g){var _,x=g,I=d.x,E=d.y,M=-1/0;do{if(E<=x.y&&E>=x.next.y&&x.next.y!==x.y){var L=x.x+(E-x.y)*(x.next.x-x.x)/(x.next.y-x.y);if(L<=I&&L>M&&(M=L,_=x.x=x.x&&x.x>=V&&I!==x.x&&wc(E_.x||x.x===_.x&&i2(_,x)))&&(_=x,ee=F)),x=x.next;while(x!==$);return _}(s,t);if(!a)return t;var u=P_(a,s);return Sl(u,u.next),Sl(a,a.next)}function i2(s,t){return qi(s.prev,s,t.prev)<0&&qi(t.next,s,s.next)<0}function Lm(s,t,a,u,d){return(s=1431655765&((s=858993459&((s=252645135&((s=16711935&((s=(s-a)*d|0)|s<<8))|s<<4))|s<<2))|s<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-u)*d|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function n2(s){var t=s,a=s;do(t.x=(s-_)*(g-x)&&(s-_)*(u-x)>=(a-_)*(t-x)&&(a-_)*(g-x)>=(d-_)*(u-x)}function s2(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!function(a,u){var d=a;do{if(d.i!==a.i&&d.next.i!==a.i&&d.i!==u.i&&d.next.i!==u.i&&D_(d,d.next,a,u))return!0;d=d.next}while(d!==a);return!1}(s,t)&&(ah(s,t)&&ah(t,s)&&function(a,u){var d=a,g=!1,_=(a.x+u.x)/2,x=(a.y+u.y)/2;do d.y>x!=d.next.y>x&&d.next.y!==d.y&&_<(d.next.x-d.x)*(x-d.y)/(d.next.y-d.y)+d.x&&(g=!g),d=d.next;while(d!==a);return g}(s,t)&&(qi(s.prev,s,t.prev)||qi(s,t.prev,t))||tf(s,t)&&qi(s.prev,s,s.next)>0&&qi(t.prev,t,t.next)>0)}function qi(s,t,a){return(t.y-s.y)*(a.x-t.x)-(t.x-s.x)*(a.y-t.y)}function tf(s,t){return s.x===t.x&&s.y===t.y}function D_(s,t,a,u){var d=nf(qi(s,t,a)),g=nf(qi(s,t,u)),_=nf(qi(a,u,s)),x=nf(qi(a,u,t));return d!==g&&_!==x||!(d!==0||!rf(s,a,t))||!(g!==0||!rf(s,u,t))||!(_!==0||!rf(a,s,u))||!(x!==0||!rf(a,t,u))}function rf(s,t,a){return t.x<=Math.max(s.x,a.x)&&t.x>=Math.min(s.x,a.x)&&t.y<=Math.max(s.y,a.y)&&t.y>=Math.min(s.y,a.y)}function nf(s){return s>0?1:s<0?-1:0}function ah(s,t){return qi(s.prev,s,s.next)<0?qi(s,t,s.next)>=0&&qi(s,s.prev,t)>=0:qi(s,t,s.prev)<0||qi(s,s.next,t)<0}function P_(s,t){var a=new zm(s.i,s.x,s.y),u=new zm(t.i,t.x,t.y),d=s.next,g=t.prev;return s.next=t,t.prev=s,a.next=d,d.prev=a,u.next=a,a.prev=u,g.next=u,u.prev=g,u}function L_(s,t,a,u){var d=new zm(s,t,a);return u?(d.next=u.next,d.prev=u,u.next.prev=d,u.next=d):(d.prev=d,d.next=d),d}function oh(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function zm(s,t,a){this.i=s,this.x=t,this.y=a,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Bm(s,t,a,u){for(var d=0,g=t,_=a-u;g0&&a.holes.push(u+=s[d-1].length)}return a};var z_=T(Pm.exports);function a2(s,t,a,u,d){B_(s,t,a,u||s.length-1,d||o2)}function B_(s,t,a,u,d){for(;u>a;){if(u-a>600){var g=u-a+1,_=t-a+1,x=Math.log(g),I=.5*Math.exp(2*x/3),E=.5*Math.sqrt(x*I*(g-I)/g)*(_-g/2<0?-1:1);B_(s,t,Math.max(a,Math.floor(t-_*I/g+E)),Math.min(u,Math.floor(t+(g-_)*I/g+E)),d)}var M=s[t],L=a,F=u;for(lh(s,a,t),d(s[u],M)>0&&lh(s,a,u);L0;)F--}d(s[a],M)===0?lh(s,a,F):lh(s,++F,u),F<=t&&(a=F+1),t<=F&&(u=F-1)}}function lh(s,t,a){var u=s[t];s[t]=s[a],s[a]=u}function o2(s,t){return st?1:0}function Rm(s,t){const a=s.length;if(a<=1)return[s];const u=[];let d,g;for(let _=0;_1)for(let _=0;_a.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new _r,this.indexArray=new gn,this.indexArray2=new Qi,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new hi,this.segments2=new hi,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(t,a,u){this.hasPattern=Fm("fill",this.layers,a);const d=this.layers[0].layout.get("fill-sort-key"),g=!d.isConstant(),_=[];for(const{feature:x,id:I,index:E,sourceLayerIndex:M}of t){const L=this.layers[0]._featureFilter.needGeometry,F=wl(x,L);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),F,u))continue;const $=g?d.evaluate(F,{},u,a.availableImages):void 0,V={id:I,properties:x.properties,type:x.type,sourceLayerIndex:M,index:E,geometry:L?F.geometry:xl(x),patterns:{},sortKey:$};_.push(V)}g&&_.sort((x,I)=>x.sortKey-I.sortKey);for(const x of _){const{geometry:I,index:E,sourceLayerIndex:M}=x;if(this.hasPattern){const L=Om("fill",this.layers,x,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(x,I,E,u,{});a.featureIndex.insert(t[E].feature,I,E,M,this.index)}}update(t,a,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,a,this.stateDependentLayers,u)}addFeatures(t,a,u){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,a,u)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Kw),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,a,u,d,g){for(const _ of Rm(a,500)){let x=0;for(const $ of _)x+=$.length;const I=this.segments.prepareSegment(x,this.layoutVertexArray,this.indexArray),E=I.vertexLength,M=[],L=[];for(const $ of _){if($.length===0)continue;$!==_[0]&&L.push(M.length/2);const V=this.segments2.prepareSegment($.length,this.layoutVertexArray,this.indexArray2),Z=V.vertexLength;this.layoutVertexArray.emplaceBack($[0].x,$[0].y),this.indexArray2.emplaceBack(Z+$.length-1,Z),M.push($[0].x),M.push($[0].y);for(let ee=1;ee<$.length;ee++)this.layoutVertexArray.emplaceBack($[ee].x,$[ee].y),this.indexArray2.emplaceBack(Z+ee-1,Z+ee),M.push($[ee].x),M.push($[ee].y);V.vertexLength+=$.length,V.primitiveLength+=$.length}const F=z_(M,L);for(let $=0;$>3}if(d--,u===1||u===2)g+=s.readSVarint(),_+=s.readSVarint(),u===1&&(t&&x.push(t),t=[]),t.push(new p2(g,_));else{if(u!==7)throw new Error("unknown command "+u);t&&t.push(t[0].clone())}}return t&&x.push(t),x},Sc.prototype.bbox=function(){var s=this._pbf;s.pos=this._geometry;for(var t=s.readVarint()+s.pos,a=1,u=0,d=0,g=0,_=1/0,x=-1/0,I=1/0,E=-1/0;s.pos>3}if(u--,a===1||a===2)(d+=s.readSVarint())<_&&(_=d),d>x&&(x=d),(g+=s.readSVarint())E&&(E=g);else if(a!==7)throw new Error("unknown command "+a)}return[_,I,x,E]},Sc.prototype.toGeoJSON=function(s,t,a){var u,d,g=this.extent*Math.pow(2,a),_=this.extent*s,x=this.extent*t,I=this.loadGeometry(),E=Sc.types[this.type];function M($){for(var V=0;V<$.length;V++){var Z=$[V];$[V]=[360*(Z.x+_)/g-180,360/Math.PI*Math.atan(Math.exp((180-360*(Z.y+x)/g)*Math.PI/180))-90]}}switch(this.type){case 1:var L=[];for(u=0;u>3;d=_===1?u.readString():_===2?u.readFloat():_===3?u.readDouble():_===4?u.readVarint64():_===5?u.readVarint():_===6?u.readSVarint():_===7?u.readBoolean():null}return d}(a))}U_.prototype.feature=function(s){if(s<0||s>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[s];var t=this._pbf.readVarint()+this._pbf.pos;return new y2(this._pbf,t,this.extent,this._keys,this._values)};var v2=N_;function b2(s,t,a){if(s===3){var u=new v2(a,a.readVarint()+a.pos);u.length&&(t[u.name]=u)}}Bo.VectorTile=function(s,t){this.layers=s.readFields(b2,{},t)},Bo.VectorTileFeature=O_,Bo.VectorTileLayer=N_;const x2=Bo.VectorTileFeature.types,Um=Math.pow(2,13);function ch(s,t,a,u,d,g,_,x){s.emplaceBack(t,a,2*Math.floor(u*Um)+_,d*Um*2,g*Um*2,Math.round(x))}class $m{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(a=>a.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new st,this.centroidVertexArray=new et,this.indexArray=new gn,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new hi,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(t,a,u){this.features=[],this.hasPattern=Fm("fill-extrusion",this.layers,a);for(const{feature:d,id:g,index:_,sourceLayerIndex:x}of t){const I=this.layers[0]._featureFilter.needGeometry,E=wl(d,I);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),E,u))continue;const M={id:g,sourceLayerIndex:x,index:_,geometry:I?E.geometry:xl(d),properties:d.properties,type:d.type,patterns:{}};this.hasPattern?this.features.push(Om("fill-extrusion",this.layers,M,this.zoom,a)):this.addFeature(M,M.geometry,_,u,{}),a.featureIndex.insert(d,M.geometry,_,x,this.index,!0)}}addFeatures(t,a,u){for(const d of this.features){const{geometry:g}=d;this.addFeature(d,g,d.index,a,u)}}update(t,a,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,a,this.stateDependentLayers,u)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,f2),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,d2.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,a,u,d,g){const _={x:0,y:0,vertexCount:0};for(const x of Rm(a,500)){let I=0;for(const V of x)I+=V.length;let E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const V of x){if(V.length===0||S2(V))continue;let Z=0;for(let ee=0;ee=1){const ye=V[ee-1];if(!w2(ie,ye)){E.vertexLength+4>hi.MAX_VERTEX_ARRAY_LENGTH&&(E=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const ue=ie.sub(ye)._perp()._unit(),be=ye.dist(ie);Z+be>32768&&(Z=0),ch(this.layoutVertexArray,ie.x,ie.y,ue.x,ue.y,0,0,Z),ch(this.layoutVertexArray,ie.x,ie.y,ue.x,ue.y,0,1,Z),_.x+=2*ie.x,_.y+=2*ie.y,_.vertexCount+=2,Z+=be,ch(this.layoutVertexArray,ye.x,ye.y,ue.x,ue.y,0,0,Z),ch(this.layoutVertexArray,ye.x,ye.y,ue.x,ue.y,0,1,Z),_.x+=2*ye.x,_.y+=2*ye.y,_.vertexCount+=2;const Ie=E.vertexLength;this.indexArray.emplaceBack(Ie,Ie+2,Ie+1),this.indexArray.emplaceBack(Ie+1,Ie+2,Ie+3),E.vertexLength+=4,E.primitiveLength+=2}}}}if(E.vertexLength+I>hi.MAX_VERTEX_ARRAY_LENGTH&&(E=this.segments.prepareSegment(I,this.layoutVertexArray,this.indexArray)),x2[t.type]!=="Polygon")continue;const M=[],L=[],F=E.vertexLength;for(const V of x)if(V.length!==0){V!==x[0]&&L.push(M.length/2);for(let Z=0;ZKi)||s.y===t.y&&(s.y<0||s.y>Ki)}function S2(s){return s.every(t=>t.x<0)||s.every(t=>t.x>Ki)||s.every(t=>t.y<0)||s.every(t=>t.y>Ki)}let $_;yt("FillExtrusionBucket",$m,{omit:["layers","features"]});var I2={get paint(){return $_=$_||new Vi({"fill-extrusion-opacity":new Lt(Ce["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Ut(Ce["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Lt(Ce["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Lt(Ce["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new _l(Ce["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Ut(Ce["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Ut(Ce["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Lt(Ce["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class T2 extends _s{constructor(t){super(t,I2)}createBucket(t){return new $m(t)}queryRadius(){return Xd(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(t,a,u,d,g,_,x,I){const E=Jd(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),_.angle,x),M=this.paint.get("fill-extrusion-height").evaluate(a,u),L=this.paint.get("fill-extrusion-base").evaluate(a,u),F=function(V,Z,ee,ie){const ye=[];for(const ue of V){const be=[ue.x,ue.y,0,1];Qd(be,be,Z),ye.push(new U(be[0]/be[3],be[1]/be[3]))}return ye}(E,I),$=function(V,Z,ee,ie){const ye=[],ue=[],be=ie[8]*Z,Ie=ie[9]*Z,Fe=ie[10]*Z,mt=ie[11]*Z,kt=ie[8]*ee,dt=ie[9]*ee,at=ie[10]*ee,it=ie[11]*ee;for(const vt of V){const nt=[],Qe=[];for(const Bt of vt){const Dt=Bt.x,mr=Bt.y,di=ie[0]*Dt+ie[4]*mr+ie[12],mi=ie[1]*Dt+ie[5]*mr+ie[13],rn=ie[2]*Dt+ie[6]*mr+ie[14],bs=ie[3]*Dt+ie[7]*mr+ie[15],jn=rn+Fe,Xi=bs+mt,_n=di+kt,kn=mi+dt,qn=rn+at,Gn=bs+it,nn=new U((di+be)/Xi,(mi+Ie)/Xi);nn.z=jn/Xi,nt.push(nn);const sn=new U(_n/Gn,kn/Gn);sn.z=qn/Gn,Qe.push(sn)}ye.push(nt),ue.push(Qe)}return[ye,ue]}(d,L,M,I);return function(V,Z,ee){let ie=1/0;__(ee,Z)&&(ie=V_(ee,Z[0]));for(let ye=0;yea.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(a=>{this.gradients[a.id]={}}),this.layoutVertexArray=new $t,this.layoutVertexArray2=new Et,this.indexArray=new gn,this.programConfigurations=new aa(t.layers,t.zoom),this.segments=new hi,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(a=>a.isStateDependent()).map(a=>a.id)}populate(t,a,u){this.hasPattern=Fm("line",this.layers,a);const d=this.layers[0].layout.get("line-sort-key"),g=!d.isConstant(),_=[];for(const{feature:x,id:I,index:E,sourceLayerIndex:M}of t){const L=this.layers[0]._featureFilter.needGeometry,F=wl(x,L);if(!this.layers[0]._featureFilter.filter(new ui(this.zoom),F,u))continue;const $=g?d.evaluate(F,{},u):void 0,V={id:I,properties:x.properties,type:x.type,sourceLayerIndex:M,index:E,geometry:L?F.geometry:xl(x),patterns:{},sortKey:$};_.push(V)}g&&_.sort((x,I)=>x.sortKey-I.sortKey);for(const x of _){const{geometry:I,index:E,sourceLayerIndex:M}=x;if(this.hasPattern){const L=Om("line",this.layers,x,this.zoom,a);this.patternFeatures.push(L)}else this.addFeature(x,I,E,u,{});a.featureIndex.insert(t[E].feature,I,E,M,this.index)}}update(t,a,u){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,a,this.stateDependentLayers,u)}addFeatures(t,a,u){for(const d of this.patternFeatures)this.addFeature(d,d.geometry,d.index,a,u)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,C2)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,A2),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,a,u,d,g){const _=this.layers[0].layout,x=_.get("line-join").evaluate(t,{}),I=_.get("line-cap"),E=_.get("line-miter-limit"),M=_.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const L of a)this.addLine(L,t,x,I,E,M);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,u,g,d)}addLine(t,a,u,d,g,_){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ie=0;ie=2&&t[I-1].equals(t[I-2]);)I--;let E=0;for(;E0;if(mt&&ie>E){const it=F.dist($);if(it>2*M){const vt=F.sub(F.sub($)._mult(M/it)._round());this.updateDistance($,vt),this.addCurrentVertex(vt,Z,0,0,L),$=vt}}const dt=$&&V;let at=dt?u:x?"butt":d;if(dt&&at==="round"&&(Ie<_?at="miter":Ie<=2&&(at="fakeround")),at==="miter"&&Ie>g&&(at="bevel"),at==="bevel"&&(Ie>2&&(at="flipbevel"),Ie100)ye=ee.mult(-1);else{const it=Ie*Z.add(ee).mag()/Z.sub(ee).mag();ye._perp()._mult(it*(kt?-1:1))}this.addCurrentVertex(F,ye,0,0,L),this.addCurrentVertex(F,ye.mult(-1),0,0,L)}else if(at==="bevel"||at==="fakeround"){const it=-Math.sqrt(Ie*Ie-1),vt=kt?it:0,nt=kt?0:it;if($&&this.addCurrentVertex(F,Z,vt,nt,L),at==="fakeround"){const Qe=Math.round(180*Fe/Math.PI/20);for(let Bt=1;Bt2*M){const vt=F.add(V.sub(F)._mult(M/it)._round());this.updateDistance(F,vt),this.addCurrentVertex(vt,ee,0,0,L),F=vt}}}}addCurrentVertex(t,a,u,d,g,_=!1){const x=a.y*d-a.x,I=-a.y-a.x*d;this.addHalfVertex(t,a.x+a.y*u,a.y-a.x*u,_,!1,u,g),this.addHalfVertex(t,x,I,_,!0,-d,g),this.distance>j_/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,a,u,d,g,_))}addHalfVertex({x:t,y:a},u,d,g,_,x,I){const E=.5*(this.lineClips?this.scaledDistance*(j_-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(g?1:0),(a<<1)+(_?1:0),Math.round(63*u)+128,Math.round(63*d)+128,1+(x===0?0:x<0?-1:1)|(63&E)<<2,E>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=I.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,M),I.primitiveLength++),_?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,a){this.distance+=t.dist(a),this.updateScaledDistance()}}let q_,G_;yt("LineBucket",Vm,{omit:["layers","patternFeatures"]});var Z_={get paint(){return G_=G_||new Vi({"line-opacity":new Ut(Ce.paint_line["line-opacity"]),"line-color":new Ut(Ce.paint_line["line-color"]),"line-translate":new Lt(Ce.paint_line["line-translate"]),"line-translate-anchor":new Lt(Ce.paint_line["line-translate-anchor"]),"line-width":new Ut(Ce.paint_line["line-width"]),"line-gap-width":new Ut(Ce.paint_line["line-gap-width"]),"line-offset":new Ut(Ce.paint_line["line-offset"]),"line-blur":new Ut(Ce.paint_line["line-blur"]),"line-dasharray":new Wu(Ce.paint_line["line-dasharray"]),"line-pattern":new _l(Ce.paint_line["line-pattern"]),"line-gradient":new Hu(Ce.paint_line["line-gradient"])})},get layout(){return q_=q_||new Vi({"line-cap":new Lt(Ce.layout_line["line-cap"]),"line-join":new Ut(Ce.layout_line["line-join"]),"line-miter-limit":new Lt(Ce.layout_line["line-miter-limit"]),"line-round-limit":new Lt(Ce.layout_line["line-round-limit"]),"line-sort-key":new Ut(Ce.layout_line["line-sort-key"])})}};class P2 extends Ut{possiblyEvaluate(t,a){return a=new ui(Math.floor(a.zoom),{now:a.now,fadeDuration:a.fadeDuration,zoomHistory:a.zoomHistory,transition:a.transition}),super.possiblyEvaluate(t,a)}evaluate(t,a,u,d){return a=ke({},a,{zoom:Math.floor(a.zoom)}),super.evaluate(t,a,u,d)}}let sf;class L2 extends _s{constructor(t){super(t,Z_),this.gradientVersion=0,sf||(sf=new P2(Z_.paint.properties["line-width"].specification),sf.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const a=this.gradientExpression();this.stepInterpolant=!!function(u){return u._styleExpression!==void 0}(a)&&a._styleExpression.expression instanceof xa,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,a){super.recalculate(t,a),this.paint._values["line-floorwidth"]=sf.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Vm(t)}queryRadius(t){const a=t,u=W_(rh("line-width",this,a),rh("line-gap-width",this,a)),d=rh("line-offset",this,a);return u/2+Math.abs(d)+Xd(this.paint.get("line-translate"))}queryIntersectsFeature(t,a,u,d,g,_,x){const I=Jd(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),_.angle,x),E=x/2*W_(this.paint.get("line-width").evaluate(a,u),this.paint.get("line-gap-width").evaluate(a,u)),M=this.paint.get("line-offset").evaluate(a,u);return M&&(d=function(L,F){const $=[];for(let V=0;V=3){for(let ee=0;ee0?t+2*s:s}const z2=Ii([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),B2=Ii([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ii([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const R2=Ii([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"}]);Ii([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const H_=Ii([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),F2=Ii([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function O2(s,t,a){return s.sections.forEach(u=>{u.text=function(d,g,_){const x=g.layout.get("text-transform").evaluate(_,{});return x==="uppercase"?d=d.toLocaleUpperCase():x==="lowercase"&&(d=d.toLocaleLowerCase()),ts.applyArabicShaping&&(d=ts.applyArabicShaping(d)),d}(u.text,t,a)}),s}Ii([{name:"triangle",components:3,type:"Uint16"}]),Ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ii([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Ii([{type:"Float32",name:"offsetX"}]),Ii([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ii([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const hh={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var tn=24,Y_=Kr,K_=function(s,t,a,u,d){var g,_,x=8*d-u-1,I=(1<>1,M=-7,L=d-1,F=-1,$=s[t+L];for(L+=F,g=$&(1<<-M)-1,$>>=-M,M+=x;M>0;g=256*g+s[t+L],L+=F,M-=8);for(_=g&(1<<-M)-1,g>>=-M,M+=u;M>0;_=256*_+s[t+L],L+=F,M-=8);if(g===0)g=1-E;else{if(g===I)return _?NaN:1/0*($?-1:1);_+=Math.pow(2,u),g-=E}return($?-1:1)*_*Math.pow(2,g-u)},X_=function(s,t,a,u,d,g){var _,x,I,E=8*g-d-1,M=(1<>1,F=d===23?Math.pow(2,-24)-Math.pow(2,-77):0,$=0,V=1,Z=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(x=isNaN(t)?1:0,_=M):(_=Math.floor(Math.log(t)/Math.LN2),t*(I=Math.pow(2,-_))<1&&(_--,I*=2),(t+=_+L>=1?F/I:F*Math.pow(2,1-L))*I>=2&&(_++,I/=2),_+L>=M?(x=0,_=M):_+L>=1?(x=(t*I-1)*Math.pow(2,d),_+=L):(x=t*Math.pow(2,L-1)*Math.pow(2,d),_=0));d>=8;s[a+$]=255&x,$+=V,x/=256,d-=8);for(_=_<0;s[a+$]=255&_,$+=V,_/=256,E-=8);s[a+$-V]|=128*Z};function Kr(s){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(s)?s:new Uint8Array(s||0),this.pos=0,this.type=0,this.length=this.buf.length}Kr.Varint=0,Kr.Fixed64=1,Kr.Bytes=2,Kr.Fixed32=5;var jm=4294967296,J_=1/jm,Q_=typeof TextDecoder>"u"?null:new TextDecoder("utf8");function io(s){return s.type===Kr.Bytes?s.readVarint()+s.pos:s.pos+1}function Ic(s,t,a){return a?4294967296*t+(s>>>0):4294967296*(t>>>0)+(s>>>0)}function e0(s,t,a){var u=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));a.realloc(u);for(var d=a.pos-1;d>=s;d--)a.buf[d+u]=a.buf[d]}function N2(s,t){for(var a=0;a>>8,s[a+2]=t>>>16,s[a+3]=t>>>24}function t0(s,t){return(s[t]|s[t+1]<<8|s[t+2]<<16)+(s[t+3]<<24)}Kr.prototype={destroy:function(){this.buf=null},readFields:function(s,t,a){for(a=a||this.length;this.pos>3,g=this.pos;this.type=7&u,s(d,t,this),this.pos===g&&this.skip(u)}return t},readMessage:function(s,t){return this.readFields(s,t,this.readVarint()+this.pos)},readFixed32:function(){var s=af(this.buf,this.pos);return this.pos+=4,s},readSFixed32:function(){var s=t0(this.buf,this.pos);return this.pos+=4,s},readFixed64:function(){var s=af(this.buf,this.pos)+af(this.buf,this.pos+4)*jm;return this.pos+=8,s},readSFixed64:function(){var s=af(this.buf,this.pos)+t0(this.buf,this.pos+4)*jm;return this.pos+=8,s},readFloat:function(){var s=K_(this.buf,this.pos,!0,23,4);return this.pos+=4,s},readDouble:function(){var s=K_(this.buf,this.pos,!0,52,8);return this.pos+=8,s},readVarint:function(s){var t,a,u=this.buf;return t=127&(a=u[this.pos++]),a<128?t:(t|=(127&(a=u[this.pos++]))<<7,a<128?t:(t|=(127&(a=u[this.pos++]))<<14,a<128?t:(t|=(127&(a=u[this.pos++]))<<21,a<128?t:function(d,g,_){var x,I,E=_.buf;if(x=(112&(I=E[_.pos++]))>>4,I<128||(x|=(127&(I=E[_.pos++]))<<3,I<128)||(x|=(127&(I=E[_.pos++]))<<10,I<128)||(x|=(127&(I=E[_.pos++]))<<17,I<128)||(x|=(127&(I=E[_.pos++]))<<24,I<128)||(x|=(1&(I=E[_.pos++]))<<31,I<128))return Ic(d,x,g);throw new Error("Expected varint not more than 10 bytes")}(t|=(15&(a=u[this.pos]))<<28,s,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var s=this.readVarint();return s%2==1?(s+1)/-2:s/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var s=this.readVarint()+this.pos,t=this.pos;return this.pos=s,s-t>=12&&Q_?function(a,u,d){return Q_.decode(a.subarray(u,d))}(this.buf,t,s):function(a,u,d){for(var g="",_=u;_239?4:M>223?3:M>191?2:1;if(_+F>d)break;F===1?M<128&&(L=M):F===2?(192&(x=a[_+1]))==128&&(L=(31&M)<<6|63&x)<=127&&(L=null):F===3?(I=a[_+2],(192&(x=a[_+1]))==128&&(192&I)==128&&((L=(15&M)<<12|(63&x)<<6|63&I)<=2047||L>=55296&&L<=57343)&&(L=null)):F===4&&(I=a[_+2],E=a[_+3],(192&(x=a[_+1]))==128&&(192&I)==128&&(192&E)==128&&((L=(15&M)<<18|(63&x)<<12|(63&I)<<6|63&E)<=65535||L>=1114112)&&(L=null)),L===null?(L=65533,F=1):L>65535&&(L-=65536,g+=String.fromCharCode(L>>>10&1023|55296),L=56320|1023&L),g+=String.fromCharCode(L),_+=F}return g}(this.buf,t,s)},readBytes:function(){var s=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,s);return this.pos=s,t},readPackedVarint:function(s,t){if(this.type!==Kr.Bytes)return s.push(this.readVarint(t));var a=io(this);for(s=s||[];this.pos127;);else if(t===Kr.Bytes)this.pos=this.readVarint()+this.pos;else if(t===Kr.Fixed32)this.pos+=4;else{if(t!==Kr.Fixed64)throw new Error("Unimplemented type: "+t);this.pos+=8}},writeTag:function(s,t){this.writeVarint(s<<3|t)},realloc:function(s){for(var t=this.length||16;t268435455||s<0?function(t,a){var u,d;if(t>=0?(u=t%4294967296|0,d=t/4294967296|0):(d=~(-t/4294967296),4294967295^(u=~(-t%4294967296))?u=u+1|0:(u=0,d=d+1|0)),t>=18446744073709552e3||t<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");a.realloc(10),function(g,_,x){x.buf[x.pos++]=127&g|128,g>>>=7,x.buf[x.pos++]=127&g|128,g>>>=7,x.buf[x.pos++]=127&g|128,g>>>=7,x.buf[x.pos++]=127&g|128,x.buf[x.pos]=127&(g>>>=7)}(u,0,a),function(g,_){var x=(7&g)<<4;_.buf[_.pos++]|=x|((g>>>=3)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g|((g>>>=7)?128:0),g&&(_.buf[_.pos++]=127&g)))))}(d,a)}(s,this):(this.realloc(4),this.buf[this.pos++]=127&s|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=127&(s>>>=7)|(s>127?128:0),s<=127||(this.buf[this.pos++]=s>>>7&127))))},writeSVarint:function(s){this.writeVarint(s<0?2*-s-1:2*s)},writeBoolean:function(s){this.writeVarint(!!s)},writeString:function(s){s=String(s),this.realloc(4*s.length),this.pos++;var t=this.pos;this.pos=function(u,d,g){for(var _,x,I=0;I55295&&_<57344){if(!x){_>56319||I+1===d.length?(u[g++]=239,u[g++]=191,u[g++]=189):x=_;continue}if(_<56320){u[g++]=239,u[g++]=191,u[g++]=189,x=_;continue}_=x-55296<<10|_-56320|65536,x=null}else x&&(u[g++]=239,u[g++]=191,u[g++]=189,x=null);_<128?u[g++]=_:(_<2048?u[g++]=_>>6|192:(_<65536?u[g++]=_>>12|224:(u[g++]=_>>18|240,u[g++]=_>>12&63|128),u[g++]=_>>6&63|128),u[g++]=63&_|128)}return g}(this.buf,s,this.pos);var a=this.pos-t;a>=128&&e0(t,a,this),this.pos=t-1,this.writeVarint(a),this.pos+=a},writeFloat:function(s){this.realloc(4),X_(this.buf,s,this.pos,!0,23,4),this.pos+=4},writeDouble:function(s){this.realloc(8),X_(this.buf,s,this.pos,!0,52,8),this.pos+=8},writeBytes:function(s){var t=s.length;this.writeVarint(t),this.realloc(t);for(var a=0;a=128&&e0(a,u,this),this.pos=a-1,this.writeVarint(u),this.pos+=u},writeMessage:function(s,t,a){this.writeTag(s,Kr.Bytes),this.writeRawMessage(t,a)},writePackedVarint:function(s,t){t.length&&this.writeMessage(s,N2,t)},writePackedSVarint:function(s,t){t.length&&this.writeMessage(s,U2,t)},writePackedBoolean:function(s,t){t.length&&this.writeMessage(s,j2,t)},writePackedFloat:function(s,t){t.length&&this.writeMessage(s,$2,t)},writePackedDouble:function(s,t){t.length&&this.writeMessage(s,V2,t)},writePackedFixed32:function(s,t){t.length&&this.writeMessage(s,q2,t)},writePackedSFixed32:function(s,t){t.length&&this.writeMessage(s,G2,t)},writePackedFixed64:function(s,t){t.length&&this.writeMessage(s,Z2,t)},writePackedSFixed64:function(s,t){t.length&&this.writeMessage(s,W2,t)},writeBytesField:function(s,t){this.writeTag(s,Kr.Bytes),this.writeBytes(t)},writeFixed32Field:function(s,t){this.writeTag(s,Kr.Fixed32),this.writeFixed32(t)},writeSFixed32Field:function(s,t){this.writeTag(s,Kr.Fixed32),this.writeSFixed32(t)},writeFixed64Field:function(s,t){this.writeTag(s,Kr.Fixed64),this.writeFixed64(t)},writeSFixed64Field:function(s,t){this.writeTag(s,Kr.Fixed64),this.writeSFixed64(t)},writeVarintField:function(s,t){this.writeTag(s,Kr.Varint),this.writeVarint(t)},writeSVarintField:function(s,t){this.writeTag(s,Kr.Varint),this.writeSVarint(t)},writeStringField:function(s,t){this.writeTag(s,Kr.Bytes),this.writeString(t)},writeFloatField:function(s,t){this.writeTag(s,Kr.Fixed32),this.writeFloat(t)},writeDoubleField:function(s,t){this.writeTag(s,Kr.Fixed64),this.writeDouble(t)},writeBooleanField:function(s,t){this.writeVarintField(s,!!t)}};var qm=T(Y_);const Gm=3;function H2(s,t,a){s===1&&a.readMessage(Y2,t)}function Y2(s,t,a){if(s===3){const{id:u,bitmap:d,width:g,height:_,left:x,top:I,advance:E}=a.readMessage(K2,{});t.push({id:u,bitmap:new nh({width:g+2*Gm,height:_+2*Gm},d),metrics:{width:g,height:_,left:x,top:I,advance:E}})}}function K2(s,t,a){s===1?t.id=a.readVarint():s===2?t.bitmap=a.readBytes():s===3?t.width=a.readVarint():s===4?t.height=a.readVarint():s===5?t.left=a.readSVarint():s===6?t.top=a.readSVarint():s===7&&(t.advance=a.readVarint())}const r0=Gm;function i0(s){let t=0,a=0;for(const _ of s)t+=_.w*_.h,a=Math.max(a,_.w);s.sort((_,x)=>x.h-_.h);const u=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),a),h:1/0}];let d=0,g=0;for(const _ of s)for(let x=u.length-1;x>=0;x--){const I=u[x];if(!(_.w>I.w||_.h>I.h)){if(_.x=I.x,_.y=I.y,g=Math.max(g,_.y+_.h),d=Math.max(d,_.x+_.w),_.w===I.w&&_.h===I.h){const E=u.pop();x=0&&u>=t&&lf[this.text.charCodeAt(u)];u--)a--;this.text=this.text.substring(t,a),this.sectionIndex=this.sectionIndex.slice(t,a)}substring(t,a){const u=new kc;return u.text=this.text.substring(t,a),u.sectionIndex=this.sectionIndex.slice(t,a),u.sections=this.sections,u}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,a)=>Math.max(t,this.sections[a].scale),0)}addTextSection(t,a){this.text+=t.text,this.sections.push(fh.forText(t.scale,t.fontStack||a));const u=this.sections.length-1;for(let d=0;d=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function of(s,t,a,u,d,g,_,x,I,E,M,L,F,$,V,Z){const ee=kc.fromFeature(s,d);let ie;L===c.ai.vertical&&ee.verticalizePunctuation();const{processBidirectionalText:ye,processStyledBidirectionalText:ue}=ts;if(ye&&ee.sections.length===1){ie=[];const Fe=ye(ee.toString(),Wm(ee,E,g,t,u,$,V));for(const mt of Fe){const kt=new kc;kt.text=mt,kt.sections=ee.sections;for(let dt=0;dt0&&so>ns&&(ns=so)}else{const Ms=kt[xr.fontStack],as=Ms&&Ms[An];if(as&&as.rect)oa=as.rect,qs=as.metrics;else{const so=mt[xr.fontStack],_h=so&&so[An];if(!_h)continue;qs=_h.metrics}on=(sn-xr.scale)*tn}Gs?(Fe.verticalizable=!0,zn.push({glyph:An,imageName:la,x:di,y:mi+on,vertical:Gs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:Bn,metrics:qs,rect:oa}),di+=no*xr.scale+Bt):(zn.push({glyph:An,imageName:la,x:di,y:mi+on,vertical:Gs,scale:xr.scale,fontStack:xr.fontStack,sectionIndex:Bn,metrics:qs,rect:oa}),di+=qs.advance*xr.scale+Bt)}zn.length!==0&&(rn=Math.max(di-Bt,rn),Q2(zn,0,zn.length-1,jn,ns)),di=0;const ss=it*sn+ns;Zn.lineOffset=Math.max(ns,Ln),mi+=ss,bs=Math.max(ss,bs),++Xi}var _n;const kn=mi-dh,{horizontalAlign:qn,verticalAlign:Gn}=Hm(vt);(function(nn,sn,Ln,Zn,zn,ns,ss,an,xr){const Bn=(sn-Ln)*zn;let An=0;An=ns!==ss?-an*Zn-dh:(-Zn*xr+.5)*ss;for(const on of nn)for(const qs of on.positionedGlyphs)qs.x+=Bn,qs.y+=An})(Fe.positionedLines,jn,qn,Gn,rn,bs,it,kn,at.length),Fe.top+=-Gn*kn,Fe.bottom=Fe.top+kn,Fe.left+=-qn*rn,Fe.right=Fe.left+rn}(Ie,t,a,u,ie,_,x,I,L,E,F,Z),!function(Fe){for(const mt of Fe)if(mt.positionedGlyphs.length!==0)return!1;return!0}(be)&&Ie}const lf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},X2={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function s0(s,t,a,u,d,g){if(t.imageName){const _=u[t.imageName];return _?_.displaySize[0]*t.scale*tn/g+d:0}{const _=a[t.fontStack],x=_&&_[s];return x?x.metrics.advance*t.scale+d:0}}function a0(s,t,a,u){const d=Math.pow(s-t,2);return u?s=0;let M=0;for(let F=0;F_.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=Cm([]),this.placementViewportMatrix=Cm([]);const a=this.layers[0]._unevaluatedLayout._values;this.textSizeData=u0(this.zoom,a["text-size"]),this.iconSizeData=u0(this.zoom,a["icon-size"]);const u=this.layers[0].layout,d=u.get("symbol-sort-key"),g=u.get("symbol-z-order");this.canOverlap=Ym(u,"text-overlap","text-allow-overlap")!=="never"||Ym(u,"icon-overlap","icon-allow-overlap")!=="never"||u.get("text-ignore-placement")||u.get("icon-ignore-placement"),this.sortFeaturesByKey=g!=="viewport-y"&&!d.isConstant(),this.sortFeaturesByY=(g==="viewport-y"||g==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,u.get("symbol-placement")==="point"&&(this.writingModes=u.get("text-writing-mode").map(_=>c.ai[_])),this.stateDependentLayerIds=this.layers.filter(_=>_.isStateDependent()).map(_=>_.id),this.sourceID=t.sourceID}createArrays(){this.text=new Xm(new aa(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Xm(new aa(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new me,this.lineVertexArray=new Ae,this.symbolInstances=new re,this.textAnchorOffsets=new Re}calculateGlyphDependencies(t,a,u,d,g){for(let _=0;_0)&&(_.value.kind!=="constant"||_.value.value.length>0),M=I.value.kind!=="constant"||!!I.value.value||Object.keys(I.parameters).length>0,L=g.get("symbol-sort-key");if(this.features=[],!E&&!M)return;const F=a.iconDependencies,$=a.glyphDependencies,V=a.availableImages,Z=new ui(this.zoom);for(const{feature:ee,id:ie,index:ye,sourceLayerIndex:ue}of t){const be=d._featureFilter.needGeometry,Ie=wl(ee,be);if(!d._featureFilter.filter(Z,Ie,u))continue;let Fe,mt;if(be||(Ie.geometry=xl(ee)),E){const dt=d.getValueAndResolveTokens("text-field",Ie,u,V),at=Sn.factory(dt);iS(at)&&(this.hasRTLText=!0),(!this.hasRTLText||Gu()==="unavailable"||this.hasRTLText&&ts.isParsed())&&(Fe=O2(at,d,Ie))}if(M){const dt=d.getValueAndResolveTokens("icon-image",Ie,u,V);mt=dt instanceof mn?dt:mn.fromString(dt)}if(!Fe&&!mt)continue;const kt=this.sortFeaturesByKey?L.evaluate(Ie,{},u):void 0;if(this.features.push({id:ie,text:Fe,icon:mt,index:ye,sourceLayerIndex:ue,geometry:Ie.geometry,properties:ee.properties,type:tS[ee.type],sortKey:kt}),mt&&(F[mt.name]=!0),Fe){const dt=_.evaluate(Ie,{},u).join(","),at=g.get("text-rotation-alignment")!=="viewport"&&g.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(c.ai.vertical)>=0;for(const it of Fe.sections)if(it.image)F[it.image.name]=!0;else{const vt=Fu(Fe.toString()),nt=it.fontStack||dt,Qe=$[nt]=$[nt]||{};this.calculateGlyphDependencies(it.text,Qe,at,this.allowVerticalPlacement,vt)}}}g.get("symbol-placement")==="line"&&(this.features=function(ee){const ie={},ye={},ue=[];let be=0;function Ie(dt){ue.push(ee[dt]),be++}function Fe(dt,at,it){const vt=ye[dt];return delete ye[dt],ye[at]=vt,ue[vt].geometry[0].pop(),ue[vt].geometry[0]=ue[vt].geometry[0].concat(it[0]),vt}function mt(dt,at,it){const vt=ie[at];return delete ie[at],ie[dt]=vt,ue[vt].geometry[0].shift(),ue[vt].geometry[0]=it[0].concat(ue[vt].geometry[0]),vt}function kt(dt,at,it){const vt=it?at[0][at[0].length-1]:at[0][0];return`${dt}:${vt.x}:${vt.y}`}for(let dt=0;dtdt.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ee,ie)=>ee.sortKey-ie.sortKey)}update(t,a,u){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,a,this.layers,u),this.icon.programConfigurations.updatePaintArrays(t,a,this.layers,u))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,a){const u=this.lineVertexArray.length;if(t.segment!==void 0){let d=t.dist(a[t.segment+1]),g=t.dist(a[t.segment]);const _={};for(let x=t.segment+1;x=0;x--)_[x]={x:a[x].x,y:a[x].y,tileUnitDistanceFromAnchor:g},x>0&&(g+=a[x-1].dist(a[x]));for(let x=0;x0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,a){const u=t.placedSymbolArray.get(a),d=u.vertexStartIndex+4*u.numGlyphs;for(let g=u.vertexStartIndex;gd[x]-d[I]||g[I]-g[x]),_}addToSortKeyRanges(t,a){const u=this.sortKeyRanges[this.sortKeyRanges.length-1];u&&u.sortKey===a?u.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:a,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const a of this.symbolInstanceIndexes){const u=this.symbolInstances.get(a);this.featureSortOrder.push(u.featureIndex),[u.rightJustifiedTextSymbolIndex,u.centerJustifiedTextSymbolIndex,u.leftJustifiedTextSymbolIndex].forEach((d,g,_)=>{d>=0&&_.indexOf(d)===g&&this.addIndicesForPlacedSymbol(this.text,d)}),u.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,u.verticalPlacedTextSymbolIndex),u.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,u.placedIconSymbolIndex),u.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,u.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let h0,d0;yt("SymbolBucket",Ac,{omit:["layers","collisionBoxArray","features","compareText"]}),Ac.MAX_GLYPHS=65535,Ac.addDynamicAttributes=Km;var Qm={get paint(){return d0=d0||new Vi({"icon-opacity":new Ut(Ce.paint_symbol["icon-opacity"]),"icon-color":new Ut(Ce.paint_symbol["icon-color"]),"icon-halo-color":new Ut(Ce.paint_symbol["icon-halo-color"]),"icon-halo-width":new Ut(Ce.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Ut(Ce.paint_symbol["icon-halo-blur"]),"icon-translate":new Lt(Ce.paint_symbol["icon-translate"]),"icon-translate-anchor":new Lt(Ce.paint_symbol["icon-translate-anchor"]),"text-opacity":new Ut(Ce.paint_symbol["text-opacity"]),"text-color":new Ut(Ce.paint_symbol["text-color"],{runtimeType:Hr,getOverride:s=>s.textColor,hasOverride:s=>!!s.textColor}),"text-halo-color":new Ut(Ce.paint_symbol["text-halo-color"]),"text-halo-width":new Ut(Ce.paint_symbol["text-halo-width"]),"text-halo-blur":new Ut(Ce.paint_symbol["text-halo-blur"]),"text-translate":new Lt(Ce.paint_symbol["text-translate"]),"text-translate-anchor":new Lt(Ce.paint_symbol["text-translate-anchor"])})},get layout(){return h0=h0||new Vi({"symbol-placement":new Lt(Ce.layout_symbol["symbol-placement"]),"symbol-spacing":new Lt(Ce.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Lt(Ce.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Ut(Ce.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Lt(Ce.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Lt(Ce.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Lt(Ce.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Lt(Ce.layout_symbol["icon-ignore-placement"]),"icon-optional":new Lt(Ce.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Lt(Ce.layout_symbol["icon-rotation-alignment"]),"icon-size":new Ut(Ce.layout_symbol["icon-size"]),"icon-text-fit":new Lt(Ce.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Lt(Ce.layout_symbol["icon-text-fit-padding"]),"icon-image":new Ut(Ce.layout_symbol["icon-image"]),"icon-rotate":new Ut(Ce.layout_symbol["icon-rotate"]),"icon-padding":new Ut(Ce.layout_symbol["icon-padding"]),"icon-keep-upright":new Lt(Ce.layout_symbol["icon-keep-upright"]),"icon-offset":new Ut(Ce.layout_symbol["icon-offset"]),"icon-anchor":new Ut(Ce.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Lt(Ce.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Lt(Ce.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Lt(Ce.layout_symbol["text-rotation-alignment"]),"text-field":new Ut(Ce.layout_symbol["text-field"]),"text-font":new Ut(Ce.layout_symbol["text-font"]),"text-size":new Ut(Ce.layout_symbol["text-size"]),"text-max-width":new Ut(Ce.layout_symbol["text-max-width"]),"text-line-height":new Lt(Ce.layout_symbol["text-line-height"]),"text-letter-spacing":new Ut(Ce.layout_symbol["text-letter-spacing"]),"text-justify":new Ut(Ce.layout_symbol["text-justify"]),"text-radial-offset":new Ut(Ce.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Lt(Ce.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Ut(Ce.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Ut(Ce.layout_symbol["text-anchor"]),"text-max-angle":new Lt(Ce.layout_symbol["text-max-angle"]),"text-writing-mode":new Lt(Ce.layout_symbol["text-writing-mode"]),"text-rotate":new Ut(Ce.layout_symbol["text-rotate"]),"text-padding":new Lt(Ce.layout_symbol["text-padding"]),"text-keep-upright":new Lt(Ce.layout_symbol["text-keep-upright"]),"text-transform":new Ut(Ce.layout_symbol["text-transform"]),"text-offset":new Ut(Ce.layout_symbol["text-offset"]),"text-allow-overlap":new Lt(Ce.layout_symbol["text-allow-overlap"]),"text-overlap":new Lt(Ce.layout_symbol["text-overlap"]),"text-ignore-placement":new Lt(Ce.layout_symbol["text-ignore-placement"]),"text-optional":new Lt(Ce.layout_symbol["text-optional"])})}};class f0{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:Ri,this.defaultValue=t}evaluate(t){if(t.formattedSection){const a=this.defaultValue.property.overrides;if(a&&a.hasOverride(t.formattedSection))return a.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}yt("FormatSectionOverride",f0,{omit:["defaultValue"]});class uf extends _s{constructor(t){super(t,Qm)}recalculate(t,a){if(super.recalculate(t,a),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const u=this.layout.get("text-writing-mode");if(u){const d=[];for(const g of u)d.indexOf(g)<0&&d.push(g);this.layout._values["text-writing-mode"]=d}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,a,u,d){const g=this.layout.get(t).evaluate(a,{},u,d),_=this._unevaluatedLayout._values[t];return _.isDataDriven()||oc(_.value)||!g?g:function(x,I){return I.replace(/{([^{}]+)}/g,(E,M)=>x&&M in x?String(x[M]):"")}(a.properties,g)}createBucket(t){return new Ac(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Qm.paint.overridableProperties){if(!uf.hasPaintOverride(this.layout,t))continue;const a=this.paint.get(t),u=new f0(a),d=new Du(u,a.property.specification);let g=null;g=a.value.kind==="constant"||a.value.kind==="source"?new Pu("source",d):new cc("composite",d,a.value.zoomStops),this.paint._values[t]=new Dn(a.property,g,a.parameters)}}_handleOverridablePaintPropertyUpdate(t,a,u){return!(!this.layout||a.isDataDriven()||u.isDataDriven())&&uf.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,a){const u=t.get("text-field"),d=Qm.paint.properties[a];let g=!1;const _=x=>{for(const I of x)if(d.overrides&&d.overrides.hasOverride(I))return void(g=!0)};if(u.value.kind==="constant"&&u.value.value instanceof Sn)_(u.value.value.sections);else if(u.value.kind==="source"){const x=E=>{g||(E instanceof Ga&&xi(E.value)===K?_(E.value.sections):E instanceof ac?_(E.sections):E.eachChild(x))},I=u.value;I._styleExpression&&x(I._styleExpression.expression)}return g}}let p0;var nS={get paint(){return p0=p0||new Vi({"background-color":new Lt(Ce.paint_background["background-color"]),"background-pattern":new Wu(Ce.paint_background["background-pattern"]),"background-opacity":new Lt(Ce.paint_background["background-opacity"])})}};class sS extends _s{constructor(t){super(t,nS)}}let m0;var aS={get paint(){return m0=m0||new Vi({"raster-opacity":new Lt(Ce.paint_raster["raster-opacity"]),"raster-hue-rotate":new Lt(Ce.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Lt(Ce.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Lt(Ce.paint_raster["raster-brightness-max"]),"raster-saturation":new Lt(Ce.paint_raster["raster-saturation"]),"raster-contrast":new Lt(Ce.paint_raster["raster-contrast"]),"raster-resampling":new Lt(Ce.paint_raster["raster-resampling"]),"raster-fade-duration":new Lt(Ce.paint_raster["raster-fade-duration"])})}};class oS extends _s{constructor(t){super(t,aS)}}class lS extends _s{constructor(t){super(t,{}),this.onAdd=a=>{this.implementation.onAdd&&this.implementation.onAdd(a,a.painter.context.gl)},this.onRemove=a=>{this.implementation.onRemove&&this.implementation.onRemove(a,a.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class cS{constructor(t){this._callback=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._callback()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._callback()},0))}remove(){delete this._channel,this._callback=()=>{}}}const eg=63710088e-1;class Oo{constructor(t,a){if(isNaN(t)||isNaN(a))throw new Error(`Invalid LngLat object: (${t}, ${a})`);if(this.lng=+t,this.lat=+a,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Oo(je(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const a=Math.PI/180,u=this.lat*a,d=t.lat*a,g=Math.sin(u)*Math.sin(d)+Math.cos(u)*Math.cos(d)*Math.cos((t.lng-this.lng)*a);return eg*Math.acos(Math.min(g,1))}static convert(t){if(t instanceof Oo)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new Oo(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new Oo(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}const g0=2*Math.PI*eg;function y0(s){return g0*Math.cos(s*Math.PI/180)}function _0(s){return(180+s)/360}function v0(s){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+s*Math.PI/360)))/360}function b0(s,t){return s/y0(t)}function x0(s){return 360*s-180}function tg(s){return 360/Math.PI*Math.atan(Math.exp((180-360*s)*Math.PI/180))-90}class hf{constructor(t,a,u=0){this.x=+t,this.y=+a,this.z=+u}static fromLngLat(t,a=0){const u=Oo.convert(t);return new hf(_0(u.lng),v0(u.lat),b0(a,u.lat))}toLngLat(){return new Oo(x0(this.x),tg(this.y))}toAltitude(){return this.z*y0(tg(this.y))}meterInMercatorCoordinateUnits(){return 1/g0*(t=tg(this.y),1/Math.cos(t*Math.PI/180));var t}}function w0(s,t,a){var u=2*Math.PI*6378137/256/Math.pow(2,a);return[s*u-2*Math.PI*6378137/2,t*u-2*Math.PI*6378137/2]}class rg{constructor(t,a,u){if(t<0||t>25||u<0||u>=Math.pow(2,t)||a<0||a>=Math.pow(2,t))throw new Error(`x=${a}, y=${u}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=a,this.y=u,this.key=mh(0,t,t,a,u)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,a,u){const d=(_=this.y,x=this.z,I=w0(256*(g=this.x),256*(_=Math.pow(2,x)-_-1),x),E=w0(256*(g+1),256*(_+1),x),I[0]+","+I[1]+","+E[0]+","+E[1]);var g,_,x,I,E;const M=function(L,F,$){let V,Z="";for(let ee=L;ee>0;ee--)V=1<1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,d)}isChildOf(t){const a=this.z-t.z;return a>0&&t.x===this.x>>a&&t.y===this.y>>a}getTilePoint(t){const a=Math.pow(2,this.z);return new U((t.x*a-this.x)*Ki,(t.y*a-this.y)*Ki)}toString(){return`${this.z}/${this.x}/${this.y}`}}class S0{constructor(t,a){this.wrap=t,this.canonical=a,this.key=mh(t,a.z,a.z,a.x,a.y)}}class Cs{constructor(t,a,u,d,g){if(t= z; overscaledZ = ${t}; z = ${u}`);this.overscaledZ=t,this.wrap=a,this.canonical=new rg(u,+d,+g),this.key=mh(a,t,u,d,g)}clone(){return new Cs(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-t;return t>this.canonical.z?new Cs(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Cs(t,this.wrap,t,this.canonical.x>>a,this.canonical.y>>a)}calculateScaledKey(t,a){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const u=this.canonical.z-t;return t>this.canonical.z?mh(this.wrap*+a,t,this.canonical.z,this.canonical.x,this.canonical.y):mh(this.wrap*+a,t,t,this.canonical.x>>u,this.canonical.y>>u)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const a=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ>a&&t.canonical.y===this.canonical.y>>a}children(t){if(this.overscaledZ>=t)return[new Cs(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const a=this.canonical.z+1,u=2*this.canonical.x,d=2*this.canonical.y;return[new Cs(a,this.wrap,a,u,d),new Cs(a,this.wrap,a,u+1,d),new Cs(a,this.wrap,a,u,d+1),new Cs(a,this.wrap,a,u+1,d+1)]}isLessThan(t){return this.wrapt.wrap)&&(this.overscaledZt.overscaledZ)&&(this.canonical.xt.canonical.x)&&this.canonical.ythis.max&&(this.max=L),L=this.dim+1||a<-1||a>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(a+1)*this.stride+(t+1)}unpack(t,a,u){return t*this.redFactor+a*this.greenFactor+u*this.blueFactor-this.baseShift}getPixels(){return new Es({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,a,u){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let d=a*this.dim,g=a*this.dim+this.dim,_=u*this.dim,x=u*this.dim+this.dim;switch(a){case-1:d=g-1;break;case 1:g=d+1}switch(u){case-1:_=x-1;break;case 1:x=_+1}const I=-a*this.dim,E=-u*this.dim;for(let M=_;M=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class k0{constructor(t,a,u,d,g){this.type="Feature",this._vectorTileFeature=t,t._z=a,t._x=u,t._y=d,this.properties=t.properties,this.id=g}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const a in this)a!=="_geometry"&&a!=="_vectorTileFeature"&&(t[a]=this[a]);return t}}class A0{constructor(t,a){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Mo(Ki,16,0),this.grid3D=new Mo(Ki,16,0),this.featureIndexArray=new Ue,this.promoteId=a}insert(t,a,u,d,g,_){const x=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(u,d,g);const I=_?this.grid3D:this.grid;for(let E=0;E=0&&L[3]>=0&&I.insert(x,L[0],L[1],L[2],L[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Bo.VectorTile(new qm(this.rawTileData)).layers,this.sourceLayerCoder=new T0(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,a,u,d){this.loadVTLayers();const g=t.params||{},_=Ki/t.tileSize/t.scale,x=zu(g.filter),I=t.queryGeometry,E=t.queryPadding*_,M=C0(I),L=this.grid.query(M.minX-E,M.minY-E,M.maxX+E,M.maxY+E),F=C0(t.cameraQueryGeometry),$=this.grid3D.query(F.minX-E,F.minY-E,F.maxX+E,F.maxY+E,(ee,ie,ye,ue)=>function(be,Ie,Fe,mt,kt){for(const at of be)if(Ie<=at.x&&Fe<=at.y&&mt>=at.x&&kt>=at.y)return!0;const dt=[new U(Ie,Fe),new U(Ie,kt),new U(mt,kt),new U(mt,Fe)];if(be.length>2){for(const at of dt)if(bc(be,at))return!0}for(let at=0;at(ue||(ue=xl(be)),Ie.queryIntersectsFeature(I,be,Fe,ue,this.z,t.transform,_,t.pixelPosMatrix)))}return V}loadMatchingFeature(t,a,u,d,g,_,x,I,E,M,L){const F=this.bucketLayerIDs[a];if(_&&!function(ee,ie){for(let ye=0;ye=0)return!0;return!1}(_,F))return;const $=this.sourceLayerCoder.decode(u),V=this.vtLayers[$].feature(d);if(g.needGeometry){const ee=wl(V,!0);if(!g.filter(new ui(this.tileID.overscaledZ),ee,this.tileID.canonical))return}else if(!g.filter(new ui(this.tileID.overscaledZ),V))return;const Z=this.getId(V,$);for(let ee=0;ee{const x=t instanceof _c?t.get(_):null;return x&&x.evaluate?x.evaluate(a,u,d):x})}function C0(s){let t=1/0,a=1/0,u=-1/0,d=-1/0;for(const g of s)t=Math.min(t,g.x),a=Math.min(a,g.y),u=Math.max(u,g.x),d=Math.max(d,g.y);return{minX:t,minY:a,maxX:u,maxY:d}}function uS(s,t){return t-s}function M0(s,t,a,u,d){const g=[];for(let _=0;_=u&&L.x>=u||(M.x>=u?M=new U(u,M.y+(u-M.x)/(L.x-M.x)*(L.y-M.y))._round():L.x>=u&&(L=new U(u,M.y+(u-M.x)/(L.x-M.x)*(L.y-M.y))._round()),M.y>=d&&L.y>=d||(M.y>=d?M=new U(M.x+(d-M.y)/(L.y-M.y)*(L.x-M.x),d)._round():L.y>=d&&(L=new U(M.x+(d-M.y)/(L.y-M.y)*(L.x-M.x),d)._round()),I&&M.equals(I[I.length-1])||(I=[M],g.push(I)),I.push(L)))))}}return g}yt("FeatureIndex",A0,{omit:["rawTileData","sourceLayerCoder"]});class No extends U{constructor(t,a,u,d){super(t,a),this.angle=u,d!==void 0&&(this.segment=d)}clone(){return new No(this.x,this.y,this.angle,this.segment)}}function D0(s,t,a,u,d){if(t.segment===void 0||a===0)return!0;let g=t,_=t.segment+1,x=0;for(;x>-a/2;){if(_--,_<0)return!1;x-=s[_].dist(g),g=s[_]}x+=s[_].dist(s[_+1]),_++;const I=[];let E=0;for(;xu;)E-=I.shift().angleDelta;if(E>d)return!1;_++,x+=M.dist(L)}return!0}function P0(s){let t=0;for(let a=0;aE){const V=(E-I)/$,Z=Jn.number(L.x,F.x,V),ee=Jn.number(L.y,F.y,V),ie=new No(Z,ee,F.angleTo(L),M);return ie._round(),!_||D0(s,ie,x,_,t)?ie:void 0}I+=$}}function dS(s,t,a,u,d,g,_,x,I){const E=L0(u,g,_),M=z0(u,d),L=M*_,F=s[0].x===0||s[0].x===I||s[0].y===0||s[0].y===I;return t-L=0&&be=0&&Ie=0&&F+E<=M){const Fe=new No(be,Ie,ye,V);Fe._round(),u&&!D0(s,Fe,g,u,d)||$.push(Fe)}}L+=ie}return x||$.length||_||($=B0(s,L/2,a,u,d,g,_,!0,I)),$}yt("Anchor",No);const Ec=is;function R0(s,t,a,u){const d=[],g=s.image,_=g.pixelRatio,x=g.paddedRect.w-2*Ec,I=g.paddedRect.h-2*Ec,E=s.right-s.left,M=s.bottom-s.top,L=g.stretchX||[[0,x]],F=g.stretchY||[[0,I]],$=(it,vt)=>it+vt[1]-vt[0],V=L.reduce($,0),Z=F.reduce($,0),ee=x-V,ie=I-Z;let ye=0,ue=V,be=0,Ie=Z,Fe=0,mt=ee,kt=0,dt=ie;if(g.content&&u){const it=g.content;ye=df(L,0,it[0]),be=df(F,0,it[1]),ue=df(L,it[0],it[2]),Ie=df(F,it[1],it[3]),Fe=it[0]-ye,kt=it[1]-be,mt=it[2]-it[0]-ue,dt=it[3]-it[1]-Ie}const at=(it,vt,nt,Qe)=>{const Bt=ff(it.stretch-ye,ue,E,s.left),Dt=pf(it.fixed-Fe,mt,it.stretch,V),mr=ff(vt.stretch-be,Ie,M,s.top),di=pf(vt.fixed-kt,dt,vt.stretch,Z),mi=ff(nt.stretch-ye,ue,E,s.left),rn=pf(nt.fixed-Fe,mt,nt.stretch,V),bs=ff(Qe.stretch-be,Ie,M,s.top),jn=pf(Qe.fixed-kt,dt,Qe.stretch,Z),Xi=new U(Bt,mr),_n=new U(mi,mr),kn=new U(mi,bs),qn=new U(Bt,bs),Gn=new U(Dt/_,di/_),nn=new U(rn/_,jn/_),sn=t*Math.PI/180;if(sn){const zn=Math.sin(sn),ns=Math.cos(sn),ss=[ns,-zn,zn,ns];Xi._matMult(ss),_n._matMult(ss),qn._matMult(ss),kn._matMult(ss)}const Ln=it.stretch+it.fixed,Zn=vt.stretch+vt.fixed;return{tl:Xi,tr:_n,bl:qn,br:kn,tex:{x:g.paddedRect.x+Ec+Ln,y:g.paddedRect.y+Ec+Zn,w:nt.stretch+nt.fixed-Ln,h:Qe.stretch+Qe.fixed-Zn},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Gn,pixelOffsetBR:nn,minFontScaleX:mt/_/E,minFontScaleY:dt/_/M,isSDF:a}};if(u&&(g.stretchX||g.stretchY)){const it=F0(L,ee,V),vt=F0(F,ie,Z);for(let nt=0;nt0&&(V=Math.max(10,V),this.circleDiameter=V)}else{let L=_.top*x-I[0],F=_.bottom*x+I[2],$=_.left*x-I[3],V=_.right*x+I[1];const Z=_.collisionPadding;if(Z&&($-=Z[0]*x,L-=Z[1]*x,V+=Z[2]*x,F+=Z[3]*x),M){const ee=new U($,L),ie=new U(V,L),ye=new U($,F),ue=new U(V,F),be=M*Math.PI/180;ee._rotate(be),ie._rotate(be),ye._rotate(be),ue._rotate(be),$=Math.min(ee.x,ie.x,ye.x,ue.x),V=Math.max(ee.x,ie.x,ye.x,ue.x),L=Math.min(ee.y,ie.y,ye.y,ue.y),F=Math.max(ee.y,ie.y,ye.y,ue.y)}t.emplaceBack(a.x,a.y,$,L,V,F,u,d,g)}this.boxEndIndex=t.length}}class fS{constructor(t=[],a=pS){if(this.data=t,this.length=this.data.length,this.compare=a,this.length>0)for(let u=(this.length>>1)-1;u>=0;u--)this._down(u)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const t=this.data[0],a=this.data.pop();return this.length--,this.length>0&&(this.data[0]=a,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:a,compare:u}=this,d=a[t];for(;t>0;){const g=t-1>>1,_=a[g];if(u(d,_)>=0)break;a[t]=_,t=g}a[t]=d}_down(t){const{data:a,compare:u}=this,d=this.length>>1,g=a[t];for(;t=0)break;a[t]=x,t=_}a[t]=g}}function pS(s,t){return st?1:0}function mS(s,t=1,a=!1){let u=1/0,d=1/0,g=-1/0,_=-1/0;const x=s[0];for(let $=0;$g)&&(g=V.x),(!$||V.y>_)&&(_=V.y)}const I=Math.min(g-u,_-d);let E=I/2;const M=new fS([],gS);if(I===0)return new U(u,d);for(let $=u;$L.d||!L.d)&&(L=$,a&&console.log("found best %d after %d probes",Math.round(1e4*$.d)/1e4,F)),$.max-L.d<=t||(E=$.h/2,M.push(new Cc($.p.x-E,$.p.y-E,E,s)),M.push(new Cc($.p.x+E,$.p.y-E,E,s)),M.push(new Cc($.p.x-E,$.p.y+E,E,s)),M.push(new Cc($.p.x+E,$.p.y+E,E,s)),F+=4)}return a&&(console.log(`num probes: ${F}`),console.log(`best distance: ${L.d}`)),L.p}function gS(s,t){return t.max-s.max}function Cc(s,t,a,u){this.p=new U(s,t),this.h=a,this.d=function(d,g){let _=!1,x=1/0;for(let I=0;Id.y!=V.y>d.y&&d.x<(V.x-$.x)*(d.y-$.y)/(V.y-$.y)+$.x&&(_=!_),x=Math.min(x,v_(d,$,V))}}return(_?1:-1)*Math.sqrt(x)}(this.p,u),this.max=this.d+this.h*Math.SQRT2}var Tn;c.aq=void 0,(Tn=c.aq||(c.aq={}))[Tn.center=1]="center",Tn[Tn.left=2]="left",Tn[Tn.right=3]="right",Tn[Tn.top=4]="top",Tn[Tn.bottom=5]="bottom",Tn[Tn["top-left"]=6]="top-left",Tn[Tn["top-right"]=7]="top-right",Tn[Tn["bottom-left"]=8]="bottom-left",Tn[Tn["bottom-right"]=9]="bottom-right";const Uo=7,ig=Number.POSITIVE_INFINITY;function O0(s,t){return t[1]!==ig?function(a,u,d){let g=0,_=0;switch(u=Math.abs(u),d=Math.abs(d),a){case"top-right":case"top-left":case"top":_=d-Uo;break;case"bottom-right":case"bottom-left":case"bottom":_=-d+Uo}switch(a){case"top-right":case"bottom-right":case"right":g=-u;break;case"top-left":case"bottom-left":case"left":g=u}return[g,_]}(s,t[0],t[1]):function(a,u){let d=0,g=0;u<0&&(u=0);const _=u/Math.SQRT2;switch(a){case"top-right":case"top-left":g=_-Uo;break;case"bottom-right":case"bottom-left":g=-_+Uo;break;case"bottom":g=-u+Uo;break;case"top":g=u-Uo}switch(a){case"top-right":case"bottom-right":d=-_;break;case"top-left":case"bottom-left":d=_;break;case"left":d=u;break;case"right":d=-u}return[d,g]}(s,t[0])}function N0(s,t,a){var u;const d=s.layout,g=(u=d.get("text-variable-anchor-offset"))===null||u===void 0?void 0:u.evaluate(t,{},a);if(g){const x=g.values,I=[];for(let E=0;EF*tn);M.startsWith("top")?L[1]-=Uo:M.startsWith("bottom")&&(L[1]+=Uo),I[E+1]=L}return new ps(I)}const _=d.get("text-variable-anchor");if(_){let x;x=s._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[d.get("text-radial-offset").evaluate(t,{},a)*tn,ig]:d.get("text-offset").evaluate(t,{},a).map(E=>E*tn);const I=[];for(const E of _)I.push(E,O0(E,x));return new ps(I)}return null}function ng(s){switch(s){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function yS(s,t,a,u,d,g,_,x,I,E,M){let L=g.textMaxSize.evaluate(t,{});L===void 0&&(L=_);const F=s.layers[0].layout,$=F.get("icon-offset").evaluate(t,{},M),V=$0(a.horizontal),Z=_/24,ee=s.tilePixelRatio*Z,ie=s.tilePixelRatio*L/24,ye=s.tilePixelRatio*x,ue=s.tilePixelRatio*F.get("symbol-spacing"),be=F.get("text-padding")*s.tilePixelRatio,Ie=function(Qe,Bt,Dt,mr=1){const di=Qe.get("icon-padding").evaluate(Bt,{},Dt),mi=di&&di.values;return[mi[0]*mr,mi[1]*mr,mi[2]*mr,mi[3]*mr]}(F,t,M,s.tilePixelRatio),Fe=F.get("text-max-angle")/180*Math.PI,mt=F.get("text-rotation-alignment")!=="viewport"&&F.get("symbol-placement")!=="point",kt=F.get("icon-rotation-alignment")==="map"&&F.get("symbol-placement")!=="point",dt=F.get("symbol-placement"),at=ue/2,it=F.get("icon-text-fit");let vt;u&&it!=="none"&&(s.allowVerticalPlacement&&a.vertical&&(vt=c0(u,a.vertical,it,F.get("icon-text-fit-padding"),$,Z)),V&&(u=c0(u,V,it,F.get("icon-text-fit-padding"),$,Z)));const nt=(Qe,Bt)=>{Bt.x<0||Bt.x>=Ki||Bt.y<0||Bt.y>=Ki||function(Dt,mr,di,mi,rn,bs,jn,Xi,_n,kn,qn,Gn,nn,sn,Ln,Zn,zn,ns,ss,an,xr,Bn,An,on,qs){const oa=Dt.addToLineVertexArray(mr,di);let la,no,Gs,Ms,as=0,so=0,_h=0,G0=0,dg=-1,fg=-1;const ao={};let Z0=eo("");if(Dt.allowVerticalPlacement&&mi.vertical){const Rn=Xi.layout.get("text-rotate").evaluate(xr,{},on)+90;Gs=new mf(_n,mr,kn,qn,Gn,mi.vertical,nn,sn,Ln,Rn),jn&&(Ms=new mf(_n,mr,kn,qn,Gn,jn,zn,ns,Ln,Rn))}if(rn){const Rn=Xi.layout.get("icon-rotate").evaluate(xr,{}),Ds=Xi.layout.get("icon-text-fit")!=="none",Il=R0(rn,Rn,An,Ds),ua=jn?R0(jn,Rn,An,Ds):void 0;no=new mf(_n,mr,kn,qn,Gn,rn,zn,ns,!1,Rn),as=4*Il.length;const Tl=Dt.iconSizeData;let Aa=null;Tl.kind==="source"?(Aa=[ka*Xi.layout.get("icon-size").evaluate(xr,{})],Aa[0]>Fo&&tt(`${Dt.layerIds[0]}: Value for "icon-size" is >= ${ph}. Reduce your "icon-size".`)):Tl.kind==="composite"&&(Aa=[ka*Bn.compositeIconSizes[0].evaluate(xr,{},on),ka*Bn.compositeIconSizes[1].evaluate(xr,{},on)],(Aa[0]>Fo||Aa[1]>Fo)&&tt(`${Dt.layerIds[0]}: Value for "icon-size" is >= ${ph}. Reduce your "icon-size".`)),Dt.addSymbols(Dt.icon,Il,Aa,an,ss,xr,c.ai.none,mr,oa.lineStartIndex,oa.lineLength,-1,on),dg=Dt.icon.placedSymbolArray.length-1,ua&&(so=4*ua.length,Dt.addSymbols(Dt.icon,ua,Aa,an,ss,xr,c.ai.vertical,mr,oa.lineStartIndex,oa.lineLength,-1,on),fg=Dt.icon.placedSymbolArray.length-1)}const W0=Object.keys(mi.horizontal);for(const Rn of W0){const Ds=mi.horizontal[Rn];if(!la){Z0=eo(Ds.text);const ua=Xi.layout.get("text-rotate").evaluate(xr,{},on);la=new mf(_n,mr,kn,qn,Gn,Ds,nn,sn,Ln,ua)}const Il=Ds.positionedLines.length===1;if(_h+=U0(Dt,mr,Ds,bs,Xi,Ln,xr,Zn,oa,mi.vertical?c.ai.horizontal:c.ai.horizontalOnly,Il?W0:[Rn],ao,dg,Bn,on),Il)break}mi.vertical&&(G0+=U0(Dt,mr,mi.vertical,bs,Xi,Ln,xr,Zn,oa,c.ai.vertical,["vertical"],ao,fg,Bn,on));const bS=la?la.boxStartIndex:Dt.collisionBoxArray.length,xS=la?la.boxEndIndex:Dt.collisionBoxArray.length,wS=Gs?Gs.boxStartIndex:Dt.collisionBoxArray.length,SS=Gs?Gs.boxEndIndex:Dt.collisionBoxArray.length,IS=no?no.boxStartIndex:Dt.collisionBoxArray.length,TS=no?no.boxEndIndex:Dt.collisionBoxArray.length,kS=Ms?Ms.boxStartIndex:Dt.collisionBoxArray.length,AS=Ms?Ms.boxEndIndex:Dt.collisionBoxArray.length;let ca=-1;const yf=(Rn,Ds)=>Rn&&Rn.circleDiameter?Math.max(Rn.circleDiameter,Ds):Ds;ca=yf(la,ca),ca=yf(Gs,ca),ca=yf(no,ca),ca=yf(Ms,ca);const H0=ca>-1?1:0;H0&&(ca*=qs/tn),Dt.glyphOffsetArray.length>=Ac.MAX_GLYPHS&&tt("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),xr.sortKey!==void 0&&Dt.addToSortKeyRanges(Dt.symbolInstances.length,xr.sortKey);const ES=N0(Xi,xr,on),[CS,MS]=function(Rn,Ds){const Il=Rn.length,ua=Ds==null?void 0:Ds.values;if((ua==null?void 0:ua.length)>0)for(let Tl=0;Tl=0?ao.right:-1,ao.center>=0?ao.center:-1,ao.left>=0?ao.left:-1,ao.vertical||-1,dg,fg,Z0,bS,xS,wS,SS,IS,TS,kS,AS,kn,_h,G0,as,so,H0,0,nn,ca,CS,MS)}(s,Bt,Qe,a,u,d,vt,s.layers[0],s.collisionBoxArray,t.index,t.sourceLayerIndex,s.index,ee,[be,be,be,be],mt,I,ye,Ie,kt,$,t,g,E,M,_)};if(dt==="line")for(const Qe of M0(t.geometry,0,0,Ki,Ki)){const Bt=dS(Qe,ue,Fe,a.vertical||V,u,24,ie,s.overscaling,Ki);for(const Dt of Bt)V&&_S(s,V.text,at,Dt)||nt(Qe,Dt)}else if(dt==="line-center"){for(const Qe of t.geometry)if(Qe.length>1){const Bt=hS(Qe,Fe,a.vertical||V,u,24,ie);Bt&&nt(Qe,Bt)}}else if(t.type==="Polygon")for(const Qe of Rm(t.geometry,0)){const Bt=mS(Qe,16);nt(Qe[0],new No(Bt.x,Bt.y,0))}else if(t.type==="LineString")for(const Qe of t.geometry)nt(Qe,new No(Qe[0].x,Qe[0].y,0));else if(t.type==="Point")for(const Qe of t.geometry)for(const Bt of Qe)nt([Bt],new No(Bt.x,Bt.y,0))}function U0(s,t,a,u,d,g,_,x,I,E,M,L,F,$,V){const Z=function(ye,ue,be,Ie,Fe,mt,kt,dt){const at=Ie.layout.get("text-rotate").evaluate(mt,{})*Math.PI/180,it=[];for(const vt of ue.positionedLines)for(const nt of vt.positionedGlyphs){if(!nt.rect)continue;const Qe=nt.rect||{};let Bt=r0+1,Dt=!0,mr=1,di=0;const mi=(Fe||dt)&&nt.vertical,rn=nt.metrics.advance*nt.scale/2;if(dt&&ue.verticalizable&&(di=vt.lineOffset/2-(nt.imageName?-(tn-nt.metrics.width*nt.scale)/2:(nt.scale-1)*tn)),nt.imageName){const an=kt[nt.imageName];Dt=an.sdf,mr=an.pixelRatio,Bt=is/mr}const bs=Fe?[nt.x+rn,nt.y]:[0,0];let jn=Fe?[0,0]:[nt.x+rn+be[0],nt.y+be[1]-di],Xi=[0,0];mi&&(Xi=jn,jn=[0,0]);const _n=nt.metrics.isDoubleResolution?2:1,kn=(nt.metrics.left-Bt)*nt.scale-rn+jn[0],qn=(-nt.metrics.top-Bt)*nt.scale+jn[1],Gn=kn+Qe.w/_n*nt.scale/mr,nn=qn+Qe.h/_n*nt.scale/mr,sn=new U(kn,qn),Ln=new U(Gn,qn),Zn=new U(kn,nn),zn=new U(Gn,nn);if(mi){const an=new U(-rn,rn-dh),xr=-Math.PI/2,Bn=tn/2-rn,An=new U(5-dh-Bn,-(nt.imageName?Bn:0)),on=new U(...Xi);sn._rotateAround(xr,an)._add(An)._add(on),Ln._rotateAround(xr,an)._add(An)._add(on),Zn._rotateAround(xr,an)._add(An)._add(on),zn._rotateAround(xr,an)._add(An)._add(on)}if(at){const an=Math.sin(at),xr=Math.cos(at),Bn=[xr,-an,an,xr];sn._matMult(Bn),Ln._matMult(Bn),Zn._matMult(Bn),zn._matMult(Bn)}const ns=new U(0,0),ss=new U(0,0);it.push({tl:sn,tr:Ln,bl:Zn,br:zn,tex:Qe,writingMode:ue.writingMode,glyphOffset:bs,sectionIndex:nt.sectionIndex,isSDF:Dt,pixelOffsetTL:ns,pixelOffsetBR:ss,minFontScaleX:0,minFontScaleY:0})}return it}(0,a,x,d,g,_,u,s.allowVerticalPlacement),ee=s.textSizeData;let ie=null;ee.kind==="source"?(ie=[ka*d.layout.get("text-size").evaluate(_,{})],ie[0]>Fo&&tt(`${s.layerIds[0]}: Value for "text-size" is >= ${ph}. Reduce your "text-size".`)):ee.kind==="composite"&&(ie=[ka*$.compositeTextSizes[0].evaluate(_,{},V),ka*$.compositeTextSizes[1].evaluate(_,{},V)],(ie[0]>Fo||ie[1]>Fo)&&tt(`${s.layerIds[0]}: Value for "text-size" is >= ${ph}. Reduce your "text-size".`)),s.addSymbols(s.text,Z,ie,x,g,_,E,t,I.lineStartIndex,I.lineLength,F,V);for(const ye of M)L[ye]=s.text.placedSymbolArray.length-1;return 4*Z.length}function $0(s){for(const t in s)return s[t];return null}function _S(s,t,a,u){const d=s.compareText;if(t in d){const g=d[t];for(let _=g.length-1;_>=0;_--)if(u.dist(g[_])>4;if(d!==1)throw new Error(`Got v${d} data when expected v1.`);const g=V0[15&u];if(!g)throw new Error("Unrecognized array type.");const[_]=new Uint16Array(t,2,1),[x]=new Uint32Array(t,4,1);return new sg(x,_,g,t)}constructor(t,a=64,u=Float64Array,d){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+a,2),65535),this.ArrayType=u,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const g=V0.indexOf(this.ArrayType),_=2*t*this.ArrayType.BYTES_PER_ELEMENT,x=t*this.IndexArrayType.BYTES_PER_ELEMENT,I=(8-x%8)%8;if(g<0)throw new Error(`Unexpected typed array class: ${u}.`);d&&d instanceof ArrayBuffer?(this.data=d,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+x+I,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+_+x+I),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+x+I,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+g]),new Uint16Array(this.data,2,1)[0]=a,new Uint32Array(this.data,4,1)[0]=t)}add(t,a){const u=this._pos>>1;return this.ids[u]=u,this.coords[this._pos++]=t,this.coords[this._pos++]=a,u}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return ag(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,a,u,d){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:g,coords:_,nodeSize:x}=this,I=[0,g.length-1,0],E=[];for(;I.length;){const M=I.pop()||0,L=I.pop()||0,F=I.pop()||0;if(L-F<=x){for(let ee=F;ee<=L;ee++){const ie=_[2*ee],ye=_[2*ee+1];ie>=t&&ie<=u&&ye>=a&&ye<=d&&E.push(g[ee])}continue}const $=F+L>>1,V=_[2*$],Z=_[2*$+1];V>=t&&V<=u&&Z>=a&&Z<=d&&E.push(g[$]),(M===0?t<=V:a<=Z)&&(I.push(F),I.push($-1),I.push(1-M)),(M===0?u>=V:d>=Z)&&(I.push($+1),I.push(L),I.push(1-M))}return E}within(t,a,u){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:g,nodeSize:_}=this,x=[0,d.length-1,0],I=[],E=u*u;for(;x.length;){const M=x.pop()||0,L=x.pop()||0,F=x.pop()||0;if(L-F<=_){for(let ee=F;ee<=L;ee++)q0(g[2*ee],g[2*ee+1],t,a)<=E&&I.push(d[ee]);continue}const $=F+L>>1,V=g[2*$],Z=g[2*$+1];q0(V,Z,t,a)<=E&&I.push(d[$]),(M===0?t-u<=V:a-u<=Z)&&(x.push(F),x.push($-1),x.push(1-M)),(M===0?t+u>=V:a+u>=Z)&&(x.push($+1),x.push(L),x.push(1-M))}return I}}function ag(s,t,a,u,d,g){if(d-u<=a)return;const _=u+d>>1;j0(s,t,_,u,d,g),ag(s,t,a,u,_-1,1-g),ag(s,t,a,_+1,d,1-g)}function j0(s,t,a,u,d,g){for(;d>u;){if(d-u>600){const E=d-u+1,M=a-u+1,L=Math.log(E),F=.5*Math.exp(2*L/3),$=.5*Math.sqrt(L*F*(E-F)/E)*(M-E/2<0?-1:1);j0(s,t,a,Math.max(u,Math.floor(a-M*F/E+$)),Math.min(d,Math.floor(a+(E-M)*F/E+$)),g)}const _=t[2*a+g];let x=u,I=d;for(gh(s,t,u,a),t[2*d+g]>_&&gh(s,t,u,d);x_;)I--}t[2*u+g]===_?gh(s,t,u,I):(I++,gh(s,t,I,d)),I<=a&&(u=I+1),a<=I&&(d=I-1)}}function gh(s,t,a,u){og(s,a,u),og(t,2*a,2*u),og(t,2*a+1,2*u+1)}function og(s,t,a){const u=s[t];s[t]=s[a],s[a]=u}function q0(s,t,a,u){const d=s-a,g=t-u;return d*d+g*g}var lg;c.bh=void 0,(lg=c.bh||(c.bh={})).create="create",lg.load="load",lg.fullLoad="fullLoad";let gf=null,yh=[];const cg=1e3/60,ug="loadTime",hg="fullLoadTime",vS={mark(s){performance.mark(s)},frame(s){const t=s;gf!=null&&yh.push(t-gf),gf=t},clearMetrics(){gf=null,yh=[],performance.clearMeasures(ug),performance.clearMeasures(hg);for(const s in c.bh)performance.clearMarks(c.bh[s])},getPerformanceMetrics(){performance.measure(ug,c.bh.create,c.bh.load),performance.measure(hg,c.bh.create,c.bh.fullLoad);const s=performance.getEntriesByName(ug)[0].duration,t=performance.getEntriesByName(hg)[0].duration,a=yh.length,u=1/(yh.reduce((g,_)=>g+_,0)/a/1e3),d=yh.filter(g=>g>cg).reduce((g,_)=>g+(_-cg)/cg,0);return{loadTime:s,fullLoadTime:t,fps:u,percentDroppedFrames:d/(a+d)*100,totalFrames:a}}};c.$=function(s,t,a){var u,d,g,_,x,I,E,M,L,F,$,V,Z=a[0],ee=a[1],ie=a[2];return t===s?(s[12]=t[0]*Z+t[4]*ee+t[8]*ie+t[12],s[13]=t[1]*Z+t[5]*ee+t[9]*ie+t[13],s[14]=t[2]*Z+t[6]*ee+t[10]*ie+t[14],s[15]=t[3]*Z+t[7]*ee+t[11]*ie+t[15]):(d=t[1],g=t[2],_=t[3],x=t[4],I=t[5],E=t[6],M=t[7],L=t[8],F=t[9],$=t[10],V=t[11],s[0]=u=t[0],s[1]=d,s[2]=g,s[3]=_,s[4]=x,s[5]=I,s[6]=E,s[7]=M,s[8]=L,s[9]=F,s[10]=$,s[11]=V,s[12]=u*Z+x*ee+L*ie+t[12],s[13]=d*Z+I*ee+F*ie+t[13],s[14]=g*Z+E*ee+$*ie+t[14],s[15]=_*Z+M*ee+V*ie+t[15]),s},c.A=xc,c.B=Jn,c.C=class{constructor(s,t,a){this.receive=u=>{const d=u.data,g=d.id;if(g&&(!d.targetMapId||this.mapId===d.targetMapId))if(d.type===""){delete this.tasks[g];const _=this.cancelCallbacks[g];delete this.cancelCallbacks[g],_&&_()}else At()||d.mustQueue?(this.tasks[g]=d,this.taskQueue.push(g),this.invoker.trigger()):this.processTask(g,d)},this.process=()=>{if(!this.taskQueue.length)return;const u=this.taskQueue.shift(),d=this.tasks[u];delete this.tasks[u],this.taskQueue.length&&this.invoker.trigger(),d&&this.processTask(u,d)},this.target=s,this.parent=t,this.mapId=a,this.callbacks={},this.tasks={},this.taskQueue=[],this.cancelCallbacks={},this.invoker=new cS(this.process),this.target.addEventListener("message",this.receive,!1),this.globalScope=At()?s:window}send(s,t,a,u,d=!1){const g=Math.round(1e18*Math.random()).toString(36).substring(0,10);a&&(this.callbacks[g]=a);const _=[],x={id:g,type:s,hasCallback:!!a,targetMapId:u,mustQueue:d,sourceMapId:this.mapId,data:Sa(t,_)};return this.target.postMessage(x,{transfer:_}),{cancel:()=>{a&&delete this.callbacks[g],this.target.postMessage({id:g,type:"",targetMapId:u,sourceMapId:this.mapId})}}}processTask(s,t){if(t.type===""){const a=this.callbacks[s];delete this.callbacks[s],a&&(t.error?a(Do(t.error)):a(null,Do(t.data)))}else{let a=!1;const u=[],d=t.hasCallback?(x,I)=>{a=!0,delete this.cancelCallbacks[s];const E={id:s,type:"",sourceMapId:this.mapId,error:x?Sa(x):null,data:Sa(I,u)};this.target.postMessage(E,{transfer:u})}:x=>{a=!0};let g=null;const _=Do(t.data);if(this.parent[t.type])g=this.parent[t.type](t.sourceMapId,_,d);else if("getWorkerSource"in this.parent){const x=t.type.split(".");g=this.parent.getWorkerSource(t.sourceMapId,x[0],_.source)[x[1]](_,d)}else d(new Error(`Could not find function ${t.type}`));!a&&g&&g.cancel&&(this.cancelCallbacks[s]=g.cancel)}}remove(){this.invoker.remove(),this.target.removeEventListener("message",this.receive,!1)}},c.D=Lt,c.E=vi,c.F=function(s,t){const a={};for(let u=0;u{}}},c.Y=qe,c.Z=function(){var s=new xc(16);return xc!=Float32Array&&(s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=0,s[12]=0,s[13]=0,s[14]=0),s[0]=1,s[5]=1,s[10]=1,s[15]=1,s},c._=A,c.a=ft,c.a$=class extends N{},c.a0=function(s,t,a){var u=a[0],d=a[1],g=a[2];return s[0]=t[0]*u,s[1]=t[1]*u,s[2]=t[2]*u,s[3]=t[3]*u,s[4]=t[4]*d,s[5]=t[5]*d,s[6]=t[6]*d,s[7]=t[7]*d,s[8]=t[8]*g,s[9]=t[9]*g,s[10]=t[10]*g,s[11]=t[11]*g,s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15],s},c.a1=S_,c.a2=function(){return $e++},c.a3=J,c.a4=Ac,c.a5=function(){ts.isLoading()||ts.isLoaded()||Gu()!=="deferred"||jd()},c.a6=zu,c.a7=wl,c.a8=ui,c.a9=k0,c.aA=gl,c.aB=function(s){s=s.slice();const t=Object.create(null);for(let a=0;a{u[_.source]?a.push({command:ir.removeLayer,args:[_.id]}):g.push(_)}),a=a.concat(d),function(_,x,I){x=x||[];const E=(_=_||[]).map(fi),M=x.map(fi),L=_.reduce(hn,{}),F=x.reduce(hn,{}),$=E.slice(),V=Object.create(null);let Z,ee,ie,ye,ue,be,Ie;for(Z=0,ee=0;Z@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(a,u,d,g)=>{const _=d||g;return t[u]=!_||_.toLowerCase(),""}),t["max-age"]){const a=parseInt(t["max-age"],10);isNaN(a)?delete t["max-age"]:t["max-age"]=a}return t},c.ab=function(s,t){const a=[];for(const u in s)u in t||a.push(u);return a},c.ac=function(s){if(Ze==null){const t=s.navigator?s.navigator.userAgent:null;Ze=!!s.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Ze},c.ad=De,c.ae=function(s,t,a){var u=Math.sin(a),d=Math.cos(a),g=t[0],_=t[1],x=t[2],I=t[3],E=t[4],M=t[5],L=t[6],F=t[7];return t!==s&&(s[8]=t[8],s[9]=t[9],s[10]=t[10],s[11]=t[11],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[0]=g*d+E*u,s[1]=_*d+M*u,s[2]=x*d+L*u,s[3]=I*d+F*u,s[4]=E*d-g*u,s[5]=M*d-_*u,s[6]=L*d-x*u,s[7]=F*d-I*u,s},c.af=function(s){var t=new xc(16);return t[0]=s[0],t[1]=s[1],t[2]=s[2],t[3]=s[3],t[4]=s[4],t[5]=s[5],t[6]=s[6],t[7]=s[7],t[8]=s[8],t[9]=s[9],t[10]=s[10],t[11]=s[11],t[12]=s[12],t[13]=s[13],t[14]=s[14],t[15]=s[15],t},c.ag=Qd,c.ah=function(s,t){let a=0,u=0;if(s.kind==="constant")u=s.layoutSize;else if(s.kind!=="source"){const{interpolationType:d,minZoom:g,maxZoom:_}=s,x=d?De(Qn.interpolationFactor(d,t,g,_),0,1):0;s.kind==="camera"?u=Jn.number(s.minSize,s.maxSize,x):a=x}return{uSizeT:a,uSize:u}},c.aj=function(s,{uSize:t,uSizeT:a},{lowerSize:u,upperSize:d}){return s.kind==="source"?u/ka:s.kind==="composite"?Jn.number(u/ka,d/ka,a):t},c.ak=Km,c.al=function(s,t,a,u){const d=t.y-s.y,g=t.x-s.x,_=u.y-a.y,x=u.x-a.x,I=_*g-x*d;if(I===0)return null;const E=(x*(s.y-a.y)-_*(s.x-a.x))/I;return new U(s.x+E*g,s.y+E*d)},c.am=M0,c.an=y_,c.ao=Cm,c.ap=tn,c.ar=Ym,c.as=function(s,t){var a=t[0],u=t[1],d=t[2],g=t[3],_=t[4],x=t[5],I=t[6],E=t[7],M=t[8],L=t[9],F=t[10],$=t[11],V=t[12],Z=t[13],ee=t[14],ie=t[15],ye=a*x-u*_,ue=a*I-d*_,be=a*E-g*_,Ie=u*I-d*x,Fe=u*E-g*x,mt=d*E-g*I,kt=M*Z-L*V,dt=M*ee-F*V,at=M*ie-$*V,it=L*ee-F*Z,vt=L*ie-$*Z,nt=F*ie-$*ee,Qe=ye*nt-ue*vt+be*it+Ie*at-Fe*dt+mt*kt;return Qe?(s[0]=(x*nt-I*vt+E*it)*(Qe=1/Qe),s[1]=(d*vt-u*nt-g*it)*Qe,s[2]=(Z*mt-ee*Fe+ie*Ie)*Qe,s[3]=(F*Fe-L*mt-$*Ie)*Qe,s[4]=(I*at-_*nt-E*dt)*Qe,s[5]=(a*nt-d*at+g*dt)*Qe,s[6]=(ee*be-V*mt-ie*ue)*Qe,s[7]=(M*mt-F*be+$*ue)*Qe,s[8]=(_*vt-x*at+E*kt)*Qe,s[9]=(u*at-a*vt-g*kt)*Qe,s[10]=(V*Fe-Z*be+ie*ye)*Qe,s[11]=(L*be-M*Fe-$*ye)*Qe,s[12]=(x*dt-_*it-I*kt)*Qe,s[13]=(a*it-u*dt+d*kt)*Qe,s[14]=(Z*ue-V*Ie-ee*ye)*Qe,s[15]=(M*Ie-L*ue+F*ye)*Qe,s):null},c.at=ng,c.au=Hm,c.av=sg,c.aw=function(){const s={},t=Ce.$version;for(const a in Ce.$root){const u=Ce.$root[a];if(u.required){let d=null;d=a==="version"?t:u.type==="array"?[]:{},d!=null&&(s[a]=d)}}return s},c.ax=ir,c.ay=Nd,c.az=Nt,c.b=function(s,t){const a=new Blob([new Uint8Array(s)],{type:"image/png"});createImageBitmap(a).then(u=>{t(null,u)}).catch(u=>{t(new Error(`Could not load image because of ${u.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})},c.b0=gn,c.b1=function(s,t){var a=s[0],u=s[1],d=s[2],g=s[3],_=s[4],x=s[5],I=s[6],E=s[7],M=s[8],L=s[9],F=s[10],$=s[11],V=s[12],Z=s[13],ee=s[14],ie=s[15],ye=t[0],ue=t[1],be=t[2],Ie=t[3],Fe=t[4],mt=t[5],kt=t[6],dt=t[7],at=t[8],it=t[9],vt=t[10],nt=t[11],Qe=t[12],Bt=t[13],Dt=t[14],mr=t[15];return Math.abs(a-ye)<=Vn*Math.max(1,Math.abs(a),Math.abs(ye))&&Math.abs(u-ue)<=Vn*Math.max(1,Math.abs(u),Math.abs(ue))&&Math.abs(d-be)<=Vn*Math.max(1,Math.abs(d),Math.abs(be))&&Math.abs(g-Ie)<=Vn*Math.max(1,Math.abs(g),Math.abs(Ie))&&Math.abs(_-Fe)<=Vn*Math.max(1,Math.abs(_),Math.abs(Fe))&&Math.abs(x-mt)<=Vn*Math.max(1,Math.abs(x),Math.abs(mt))&&Math.abs(I-kt)<=Vn*Math.max(1,Math.abs(I),Math.abs(kt))&&Math.abs(E-dt)<=Vn*Math.max(1,Math.abs(E),Math.abs(dt))&&Math.abs(M-at)<=Vn*Math.max(1,Math.abs(M),Math.abs(at))&&Math.abs(L-it)<=Vn*Math.max(1,Math.abs(L),Math.abs(it))&&Math.abs(F-vt)<=Vn*Math.max(1,Math.abs(F),Math.abs(vt))&&Math.abs($-nt)<=Vn*Math.max(1,Math.abs($),Math.abs(nt))&&Math.abs(V-Qe)<=Vn*Math.max(1,Math.abs(V),Math.abs(Qe))&&Math.abs(Z-Bt)<=Vn*Math.max(1,Math.abs(Z),Math.abs(Bt))&&Math.abs(ee-Dt)<=Vn*Math.max(1,Math.abs(ee),Math.abs(Dt))&&Math.abs(ie-mr)<=Vn*Math.max(1,Math.abs(ie),Math.abs(mr))},c.b2=function(s,t){return s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[4]=t[4],s[5]=t[5],s[6]=t[6],s[7]=t[7],s[8]=t[8],s[9]=t[9],s[10]=t[10],s[11]=t[11],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15],s},c.b3=function(s,t,a){return s[0]=t[0]*a[0],s[1]=t[1]*a[1],s[2]=t[2]*a[2],s[3]=t[3]*a[3],s},c.b4=function(s,t){return s[0]*t[0]+s[1]*t[1]+s[2]*t[2]+s[3]*t[3]},c.b5=je,c.b6=S0,c.b7=b0,c.b8=function(s,t,a,u,d){var g,_=1/Math.tan(t/2);return s[0]=_/a,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=_,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[11]=-1,s[12]=0,s[13]=0,s[15]=0,d!=null&&d!==1/0?(s[10]=(d+u)*(g=1/(u-d)),s[14]=2*d*u*g):(s[10]=-1,s[14]=-2*u),s},c.b9=function(s,t,a){var u=Math.sin(a),d=Math.cos(a),g=t[4],_=t[5],x=t[6],I=t[7],E=t[8],M=t[9],L=t[10],F=t[11];return t!==s&&(s[0]=t[0],s[1]=t[1],s[2]=t[2],s[3]=t[3],s[12]=t[12],s[13]=t[13],s[14]=t[14],s[15]=t[15]),s[4]=g*d+E*u,s[5]=_*d+M*u,s[6]=x*d+L*u,s[7]=I*d+F*u,s[8]=E*d-g*u,s[9]=M*d-_*u,s[10]=L*d-x*u,s[11]=F*d-I*u,s},c.bA=z,c.bB=Y_,c.bC=lc,c.bD=ts,c.ba=pe,c.bb=Te,c.bc=function(s,t){return s[0]=t[0],s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=t[1],s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=t[2],s[11]=0,s[12]=0,s[13]=0,s[14]=0,s[15]=1,s},c.bd=class extends bl{},c.be=eg,c.bf=x0,c.bg=vS,c.bi=Ge,c.bj=function(s,t,a=!1){if(Un===Uu||Un===$u||Un===Vu)throw new Error("setRTLTextPlugin cannot be called multiple times.");Ia=yr.resolveURL(s),Un=Uu,ju=t,qu(),a||jd()},c.bk=Gu,c.bl=function(s,t){const a={};for(let d=0;dQe*tn)}let dt=_?"center":a.get("text-justify").evaluate(E,{},s.canonical);const at=a.get("symbol-placement"),it=at==="point"?a.get("text-max-width").evaluate(E,{},s.canonical)*tn:0,vt=()=>{s.bucket.allowVerticalPlacement&&Fu(be)&&(V.vertical=of(Z,s.glyphMap,s.glyphPositions,s.imagePositions,M,it,g,mt,"left",Fe,ie,c.ai.vertical,!0,at,F,L))};if(!_&&kt){const nt=new Set;if(dt==="auto")for(let Bt=0;Bt{t(null,a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=St})},a.onerror=()=>t(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const u=new Blob([new Uint8Array(s)],{type:"image/png"});a.src=s.byteLength?URL.createObjectURL(u):St},c.e=ke,c.f=function(s,t){return cr(ke(s,{type:"json"}),t)},c.g=Ot,c.h=yr,c.i=At,c.j=Mn,c.k=cn,c.l=Jr,c.m=cr,c.n=function(s){return new qm(s).readFields(H2,[])},c.o=function(s,t,a){if(!s.length)return a(null,[]);let u=s.length;const d=new Array(s.length);let g=null;s.forEach((_,x)=>{t(_,(I,E)=>{I&&(g=I),d[x]=E,--u==0&&a(g,d)})})},c.p=i0,c.q=nh,c.r=Vi,c.s=Ar,c.t=bm,c.u=pt,c.v=Ce,c.w=tt,c.x=mc,c.y=na,c.z=function([s,t,a]){return t+=90,t*=Math.PI/180,a*=Math.PI/180,{x:s*Math.cos(t)*Math.sin(a),y:s*Math.sin(t)*Math.sin(a),z:s*Math.cos(a)}}}),v(["./shared"],function(c){class A{constructor(R){this.keyCache={},R&&this.replace(R)}replace(R){this._layerConfigs={},this._layers={},this.update(R,[])}update(R,O){for(const X of R){this._layerConfigs[X.id]=X;const te=this._layers[X.id]=c.aC(X);te._featureFilter=c.a6(te.filter),this.keyCache[X.id]&&delete this.keyCache[X.id]}for(const X of O)delete this.keyCache[X],delete this._layerConfigs[X],delete this._layers[X];this.familiesBySource={};const q=c.bl(Object.values(this._layerConfigs),this.keyCache);for(const X of q){const te=X.map(Be=>this._layers[Be.id]),ve=te[0];if(ve.visibility==="none")continue;const he=ve.source||"";let se=this.familiesBySource[he];se||(se=this.familiesBySource[he]={});const ge=ve.sourceLayer||"_geojsonTileLayer";let Le=se[ge];Le||(Le=se[ge]=[]),Le.push(te)}}}class T{constructor(R){const O={},q=[];for(const he in R){const se=R[he],ge=O[he]={};for(const Le in se){const Be=se[+Le];if(!Be||Be.bitmap.width===0||Be.bitmap.height===0)continue;const Oe={x:0,y:0,w:Be.bitmap.width+2,h:Be.bitmap.height+2};q.push(Oe),ge[Le]={rect:Oe,metrics:Be.metrics}}}const{w:X,h:te}=c.p(q),ve=new c.q({width:X||1,height:te||1});for(const he in R){const se=R[he];for(const ge in se){const Le=se[+ge];if(!Le||Le.bitmap.width===0||Le.bitmap.height===0)continue;const Be=O[he][ge].rect;c.q.copy(Le.bitmap,ve,{x:0,y:0},{x:Be.x+1,y:Be.y+1},Le.bitmap)}}this.image=ve,this.positions=O}}c.bm("GlyphAtlas",T);class z{constructor(R){this.tileID=new c.O(R.tileID.overscaledZ,R.tileID.wrap,R.tileID.canonical.z,R.tileID.canonical.x,R.tileID.canonical.y),this.uid=R.uid,this.zoom=R.zoom,this.pixelRatio=R.pixelRatio,this.tileSize=R.tileSize,this.source=R.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=R.showCollisionBoxes,this.collectResourceTiming=!!R.collectResourceTiming,this.returnDependencies=!!R.returnDependencies,this.promoteId=R.promoteId,this.inFlightDependencies=[],this.dependencySentinel=-1}parse(R,O,q,X,te){this.status="parsing",this.data=R,this.collisionBoxArray=new c.a3;const ve=new c.bn(Object.keys(R.layers).sort()),he=new c.bo(this.tileID,this.promoteId);he.bucketLayerIDs=[];const se={},ge={featureIndex:he,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:q},Le=O.familiesBySource[this.source];for(const Mr in Le){const Er=R.layers[Mr];if(!Er)continue;Er.version===1&&c.w(`Vector tile source "${this.source}" layer "${Mr}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const wn=ve.encode(Mr),ni=[];for(let Yi=0;Yi=pn.maxzoom||pn.visibility!=="none"&&(B(Yi,this.zoom,q),(se[pn.id]=pn.createBucket({index:he.bucketLayerIDs.length,layers:Yi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:wn,sourceID:this.source})).populate(ni,ge,this.tileID.canonical),he.bucketLayerIDs.push(Yi.map(fs=>fs.id)))}}let Be,Oe,zt,Gt;const It=c.aH(ge.glyphDependencies,Mr=>Object.keys(Mr).map(Number));this.inFlightDependencies.forEach(Mr=>Mr==null?void 0:Mr.cancel()),this.inFlightDependencies=[];const Ft=++this.dependencySentinel;Object.keys(It).length?this.inFlightDependencies.push(X.send("getGlyphs",{uid:this.uid,stacks:It,source:this.source,tileID:this.tileID,type:"glyphs"},(Mr,Er)=>{Ft===this.dependencySentinel&&(Be||(Be=Mr,Oe=Er,Yr.call(this)))})):Oe={};const Zt=Object.keys(ge.iconDependencies);Zt.length?this.inFlightDependencies.push(X.send("getImages",{icons:Zt,source:this.source,tileID:this.tileID,type:"icons"},(Mr,Er)=>{Ft===this.dependencySentinel&&(Be||(Be=Mr,zt=Er,Yr.call(this)))})):zt={};const Ur=Object.keys(ge.patternDependencies);function Yr(){if(Be)return te(Be);if(Oe&&zt&&Gt){const Mr=new T(Oe),Er=new c.bp(zt,Gt);for(const wn in se){const ni=se[wn];ni instanceof c.a4?(B(ni.layers,this.zoom,q),c.bq({bucket:ni,glyphMap:Oe,glyphPositions:Mr.positions,imageMap:zt,imagePositions:Er.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):ni.hasPattern&&(ni instanceof c.br||ni instanceof c.bs||ni instanceof c.bt)&&(B(ni.layers,this.zoom,q),ni.addFeatures(ge,this.tileID.canonical,Er.patternPositions))}this.status="done",te(null,{buckets:Object.values(se).filter(wn=>!wn.isEmpty()),featureIndex:he,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Mr.image,imageAtlas:Er,glyphMap:this.returnDependencies?Oe:null,iconMap:this.returnDependencies?zt:null,glyphPositions:this.returnDependencies?Mr.positions:null})}}Ur.length?this.inFlightDependencies.push(X.send("getImages",{icons:Ur,source:this.source,tileID:this.tileID,type:"patterns"},(Mr,Er)=>{Ft===this.dependencySentinel&&(Be||(Be=Mr,Gt=Er,Yr.call(this)))})):Gt={},Yr.call(this)}}function B(K,R,O){const q=new c.a8(R);for(const X of K)X.recalculate(q,O)}function U(K,R){const O=c.l(K.request,(q,X,te,ve)=>{if(q)R(q);else if(X)try{const he=new c.bw.VectorTile(new c.bv(X));R(null,{vectorTile:he,rawData:X,cacheControl:te,expires:ve})}catch(he){const se=new Uint8Array(X);let ge=`Unable to parse the tile at ${K.request.url}, `;ge+=se[0]===31&&se[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${he.messge}`,R(new Error(ge))}});return()=>{O.cancel(),R()}}class j{constructor(R,O,q,X){this.actor=R,this.layerIndex=O,this.availableImages=q,this.loadVectorData=X||U,this.fetching={},this.loading={},this.loaded={}}loadTile(R,O){const q=R.uid;this.loading||(this.loading={});const X=!!(R&&R.request&&R.request.collectResourceTiming)&&new c.bu(R.request),te=this.loading[q]=new z(R);te.abort=this.loadVectorData(R,(ve,he)=>{if(delete this.loading[q],ve||!he)return te.status="done",this.loaded[q]=te,O(ve);const se=he.rawData,ge={};he.expires&&(ge.expires=he.expires),he.cacheControl&&(ge.cacheControl=he.cacheControl);const Le={};if(X){const Be=X.finish();Be&&(Le.resourceTiming=JSON.parse(JSON.stringify(Be)))}te.vectorTile=he.vectorTile,te.parse(he.vectorTile,this.layerIndex,this.availableImages,this.actor,(Be,Oe)=>{if(delete this.fetching[q],Be||!Oe)return O(Be);O(null,c.e({rawTileData:se.slice(0)},Oe,ge,Le))}),this.loaded=this.loaded||{},this.loaded[q]=te,this.fetching[q]={rawTileData:se,cacheControl:ge,resourceTiming:Le}})}reloadTile(R,O){const q=this.loaded,X=R.uid;if(q&&q[X]){const te=q[X];te.showCollisionBoxes=R.showCollisionBoxes,te.status==="parsing"?te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor,(ve,he)=>{if(ve||!he)return O(ve,he);let se;if(this.fetching[X]){const{rawTileData:ge,cacheControl:Le,resourceTiming:Be}=this.fetching[X];delete this.fetching[X],se=c.e({rawTileData:ge.slice(0)},he,Le,Be)}else se=he;O(null,se)}):te.status==="done"&&(te.vectorTile?te.parse(te.vectorTile,this.layerIndex,this.availableImages,this.actor,O):O())}}abortTile(R,O){const q=this.loading,X=R.uid;q&&q[X]&&q[X].abort&&(q[X].abort(),delete q[X]),O()}removeTile(R,O){const q=this.loaded,X=R.uid;q&&q[X]&&delete q[X],O()}}class Q{constructor(){this.loaded={}}loadTile(R,O){return c._(this,void 0,void 0,function*(){const{uid:q,encoding:X,rawImageData:te,redFactor:ve,greenFactor:he,blueFactor:se,baseShift:ge}=R,Le=te.width+2,Be=te.height+2,Oe=c.a(te)?new c.R({width:Le,height:Be},yield c.bx(te,-1,-1,Le,Be)):te,zt=new c.by(q,Oe,X,ve,he,se,ge);this.loaded=this.loaded||{},this.loaded[q]=zt,O(null,zt)})}removeTile(R){const O=this.loaded,q=R.uid;O&&O[q]&&delete O[q]}}function ae(K,R){if(K.length!==0){ne(K[0],R);for(var O=1;O=Math.abs(he)?O-se+he:he-se+O,O=se}O+q>=0!=!!R&&K.reverse()}var Y=c.bz(function K(R,O){var q,X=R&&R.type;if(X==="FeatureCollection")for(q=0;q>31}function At(K,R){for(var O=K.loadGeometry(),q=K.type,X=0,te=0,ve=O.length,he=0;heK},gt=Math.fround||(Ct=new Float32Array(1),K=>(Ct[0]=+K,Ct[0]));var Ct;const Mt=3,rt=5,Rt=6;class yr{constructor(R){this.options=Object.assign(Object.create(St),R),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(R){const{log:O,minZoom:q,maxZoom:X}=this.options;O&&console.time("total time");const te=`prepare ${R.length} points`;O&&console.time(te),this.points=R;const ve=[];for(let se=0;se=q;se--){const ge=+Date.now();he=this.trees[se]=this._createTree(this._cluster(he,se)),O&&console.log("z%d: %d clusters in %dms",se,he.numItems,+Date.now()-ge)}return O&&console.timeEnd("total time"),this}getClusters(R,O){let q=((R[0]+180)%360+360)%360-180;const X=Math.max(-90,Math.min(90,R[1]));let te=R[2]===180?180:((R[2]+180)%360+360)%360-180;const ve=Math.max(-90,Math.min(90,R[3]));if(R[2]-R[0]>=360)q=-180,te=180;else if(q>te){const Be=this.getClusters([q,X,180,ve],O),Oe=this.getClusters([-180,X,te,ve],O);return Be.concat(Oe)}const he=this.trees[this._limitZoom(O)],se=he.range(Nt(q),Ot(ve),Nt(te),Ot(X)),ge=he.data,Le=[];for(const Be of se){const Oe=this.stride*Be;Le.push(ge[Oe+rt]>1?_t(ge,Oe,this.clusterProps):this.points[ge[Oe+Mt]])}return Le}getChildren(R){const O=this._getOriginId(R),q=this._getOriginZoom(R),X="No cluster with the specified id.",te=this.trees[q];if(!te)throw new Error(X);const ve=te.data;if(O*this.stride>=ve.length)throw new Error(X);const he=this.options.radius/(this.options.extent*Math.pow(2,q-1)),se=te.within(ve[O*this.stride],ve[O*this.stride+1],he),ge=[];for(const Le of se){const Be=Le*this.stride;ve[Be+4]===R&&ge.push(ve[Be+rt]>1?_t(ve,Be,this.clusterProps):this.points[ve[Be+Mt]])}if(ge.length===0)throw new Error(X);return ge}getLeaves(R,O,q){const X=[];return this._appendLeaves(X,R,O=O||10,q=q||0,0),X}getTile(R,O,q){const X=this.trees[this._limitZoom(R)],te=Math.pow(2,R),{extent:ve,radius:he}=this.options,se=he/ve,ge=(q-se)/te,Le=(q+1+se)/te,Be={features:[]};return this._addTileFeatures(X.range((O-se)/te,ge,(O+1+se)/te,Le),X.data,O,q,te,Be),O===0&&this._addTileFeatures(X.range(1-se/te,ge,1,Le),X.data,te,q,te,Be),O===te-1&&this._addTileFeatures(X.range(0,ge,se/te,Le),X.data,-1,q,te,Be),Be.features.length?Be:null}getClusterExpansionZoom(R){let O=this._getOriginZoom(R)-1;for(;O<=this.options.maxZoom;){const q=this.getChildren(R);if(O++,q.length!==1)break;R=q[0].properties.cluster_id}return O}_appendLeaves(R,O,q,X,te){const ve=this.getChildren(O);for(const he of ve){const se=he.properties;if(se&&se.cluster?te+se.point_count<=X?te+=se.point_count:te=this._appendLeaves(R,se.cluster_id,q,X,te):te1;let Le,Be,Oe;if(ge)Le=Ge(O,se,this.clusterProps),Be=O[se],Oe=O[se+1];else{const It=this.points[O[se+Mt]];Le=It.properties;const[Ft,Zt]=It.geometry.coordinates;Be=Nt(Ft),Oe=Ot(Zt)}const zt={type:1,geometry:[[Math.round(this.options.extent*(Be*te-q)),Math.round(this.options.extent*(Oe*te-X))]],tags:Le};let Gt;Gt=ge||this.options.generateId?O[se+Mt]:this.points[O[se+Mt]].id,Gt!==void 0&&(zt.id=Gt),ve.features.push(zt)}}_limitZoom(R){return Math.max(this.options.minZoom,Math.min(Math.floor(+R),this.options.maxZoom+1))}_cluster(R,O){const{radius:q,extent:X,reduce:te,minPoints:ve}=this.options,he=q/(X*Math.pow(2,O)),se=R.data,ge=[],Le=this.stride;for(let Be=0;BeO&&(Ft+=se[Ur+rt])}if(Ft>It&&Ft>=ve){let Zt,Ur=Oe*It,Yr=zt*It,Mr=-1;const Er=((Be/Le|0)<<5)+(O+1)+this.points.length;for(const wn of Gt){const ni=wn*Le;if(se[ni+2]<=O)continue;se[ni+2]=O;const Yi=se[ni+rt];Ur+=se[ni]*Yi,Yr+=se[ni+1]*Yi,se[ni+4]=Er,te&&(Zt||(Zt=this._map(se,Be,!0),Mr=this.clusterProps.length,this.clusterProps.push(Zt)),te(Zt,this._map(se,ni)))}se[Be+4]=Er,ge.push(Ur/Ft,Yr/Ft,1/0,Er,-1,Ft),te&&ge.push(Mr)}else{for(let Zt=0;Zt1)for(const Zt of Gt){const Ur=Zt*Le;if(!(se[Ur+2]<=O)){se[Ur+2]=O;for(let Yr=0;Yr>5}_getOriginZoom(R){return(R-this.points.length)%32}_map(R,O,q){if(R[O+rt]>1){const ve=this.clusterProps[R[O+Rt]];return q?Object.assign({},ve):ve}const X=this.points[R[O+Mt]].properties,te=this.options.map(X);return q&&te===X?Object.assign({},te):te}}function _t(K,R,O){return{type:"Feature",id:K[R+Mt],properties:Ge(K,R,O),geometry:{type:"Point",coordinates:[(q=K[R],360*(q-.5)),Ir(K[R+1])]}};var q}function Ge(K,R,O){const q=K[R+rt],X=q>=1e4?`${Math.round(q/1e3)}k`:q>=1e3?Math.round(q/100)/10+"k":q,te=K[R+Rt],ve=te===-1?{}:Object.assign({},O[te]);return Object.assign(ve,{cluster:!0,cluster_id:K[R+Mt],point_count:q,point_count_abbreviated:X})}function Nt(K){return K/360+.5}function Ot(K){const R=Math.sin(K*Math.PI/180),O=.5-.25*Math.log((1+R)/(1-R))/Math.PI;return O<0?0:O>1?1:O}function Ir(K){const R=(180-360*K)*Math.PI/180;return 360*Math.atan(Math.exp(R))/Math.PI-90}function cr(K,R,O,q){for(var X,te=q,ve=O-R>>1,he=O-R,se=K[R],ge=K[R+1],Le=K[O],Be=K[O+1],Oe=R+3;Oete)X=Oe,te=zt;else if(zt===te){var Gt=Math.abs(Oe-ve);Gtq&&(X-R>3&&cr(K,R,X,q),K[X+2]=te,O-X>3&&cr(K,X,O,q))}function Jr(K,R,O,q,X,te){var ve=X-O,he=te-q;if(ve!==0||he!==0){var se=((K-O)*ve+(R-q)*he)/(ve*ve+he*he);se>1?(O=X,q=te):se>0&&(O+=ve*se,q+=he*se)}return(ve=K-O)*ve+(he=R-q)*he}function Ar(K,R,O,q){var X={id:K===void 0?null:K,type:R,geometry:O,tags:q,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(te){var ve=te.geometry,he=te.type;if(he==="Point"||he==="MultiPoint"||he==="LineString")Qr(te,ve);else if(he==="Polygon"||he==="MultiLineString")for(var se=0;se0&&(ve+=q?(X*ge-se*te)/2:Math.sqrt(Math.pow(se-X,2)+Math.pow(ge-te,2))),X=se,te=ge}var Le=R.length-3;R[2]=1,cr(R,0,Le,O),R[Le+2]=1,R.size=Math.abs(ve),R.start=0,R.end=R.size}function vi(K,R,O,q){for(var X=0;X1?1:O}function Br(K,R,O,q,X,te,ve,he){if(q/=R,te>=(O/=R)&&ve=q)return null;for(var se=[],ge=0;ge=O&&Gt=q)){var It=[];if(Oe==="Point"||Oe==="MultiPoint")Xt(Be,It,O,q,X);else if(Oe==="LineString")ir(Be,It,O,q,X,!1,he.lineMetrics);else if(Oe==="MultiLineString")fn(Be,It,O,q,X,!1);else if(Oe==="Polygon")fn(Be,It,O,q,X,!0);else if(Oe==="MultiPolygon")for(var Ft=0;Ft=O&&ve<=q&&(R.push(K[te]),R.push(K[te+1]),R.push(K[te+2]))}}function ir(K,R,O,q,X,te,ve){for(var he,se,ge=bi(K),Le=X===0?un:Ji,Be=K.start,Oe=0;OeO&&(se=Le(ge,zt,Gt,Ft,Zt,O),ve&&(ge.start=Be+he*se)):Ur>q?Yr=O&&(se=Le(ge,zt,Gt,Ft,Zt,O),Mr=!0),Yr>q&&Ur<=q&&(se=Le(ge,zt,Gt,Ft,Zt,q),Mr=!0),!te&&Mr&&(ve&&(ge.end=Be+he*se),R.push(ge),ge=bi(K)),ve&&(Be+=he)}var Er=K.length-3;zt=K[Er],Gt=K[Er+1],It=K[Er+2],(Ur=X===0?zt:Gt)>=O&&Ur<=q&&zi(ge,zt,Gt,It),Er=ge.length-3,te&&Er>=3&&(ge[Er]!==ge[0]||ge[Er+1]!==ge[1])&&zi(ge,ge[0],ge[1],ge[2]),ge.length&&R.push(ge)}function bi(K){var R=[];return R.size=K.size,R.start=K.start,R.end=K.end,R}function fn(K,R,O,q,X,te){for(var ve=0;veve.maxX&&(ve.maxX=Le),Be>ve.maxY&&(ve.maxY=Be)}return ve}function Bi(K,R,O,q){var X=R.geometry,te=R.type,ve=[];if(te==="Point"||te==="MultiPoint")for(var he=0;he0&&R.size<(X?ve:q))O.numPoints+=R.length/3;else{for(var he=[],se=0;seve)&&(O.numSimplified++,he.push(R[se]),he.push(R[se+1])),O.numPoints++;X&&function(ge,Le){for(var Be=0,Oe=0,zt=ge.length,Gt=zt-2;Oe0===Le)for(Oe=0,zt=ge.length;Oe24)throw new Error("maxZoom should be in the 0-24 range");if(R.promoteId&&R.generateId)throw new Error("promoteId and generateId cannot be used together.");var q=function(X,te){var ve=[];if(X.type==="FeatureCollection")for(var he=0;he1&&console.time("creation"),Oe=this.tiles[Be]=ar(K,R,O,q,se),this.tileCoords.push({z:R,x:O,y:q}),ge)){ge>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",R,O,q,Oe.numFeatures,Oe.numPoints,Oe.numSimplified),console.timeEnd("creation"));var zt="z"+R;this.stats[zt]=(this.stats[zt]||0)+1,this.total++}if(Oe.source=K,X){if(R===se.maxZoom||R===X)continue;var Gt=1<1&&console.time("clipping");var It,Ft,Zt,Ur,Yr,Mr,Er=.5*se.buffer/se.extent,wn=.5-Er,ni=.5+Er,Yi=1+Er;It=Ft=Zt=Ur=null,Yr=Br(K,Le,O-Er,O+ni,0,Oe.minX,Oe.maxX,se),Mr=Br(K,Le,O+wn,O+Yi,0,Oe.minX,Oe.maxX,se),K=null,Yr&&(It=Br(Yr,Le,q-Er,q+ni,1,Oe.minY,Oe.maxY,se),Ft=Br(Yr,Le,q+wn,q+Yi,1,Oe.minY,Oe.maxY,se),Yr=null),Mr&&(Zt=Br(Mr,Le,q-Er,q+ni,1,Oe.minY,Oe.maxY,se),Ur=Br(Mr,Le,q+wn,q+Yi,1,Oe.minY,Oe.maxY,se),Mr=null),ge>1&&console.timeEnd("clipping"),he.push(It||[],R+1,2*O,2*q),he.push(Ft||[],R+1,2*O,2*q+1),he.push(Zt||[],R+1,2*O+1,2*q),he.push(Ur||[],R+1,2*O+1,2*q+1)}}},We.prototype.getTile=function(K,R,O){var q=this.options,X=q.extent,te=q.debug;if(K<0||K>24)return null;var ve=1<1&&console.log("drilling down to z%d-%d-%d",K,R,O);for(var se,ge=K,Le=R,Be=O;!se&&ge>0;)ge--,Le=Math.floor(Le/2),Be=Math.floor(Be/2),se=this.tiles[jt(ge,Le,Be)];return se&&se.source?(te>1&&console.log("found parent tile z%d-%d-%d",ge,Le,Be),te>1&&console.time("drilling down"),this.splitTile(se.source,ge,Le,Be,K,R,O),te>1&&console.timeEnd("drilling down"),this.tiles[he]?qe(this.tiles[he],X):null):null};class qt extends j{constructor(R,O,q,X){super(R,O,q),this._dataUpdateable=new Map,this.loadGeoJSON=(te,ve)=>{const{promoteId:he}=te;if(te.request)return c.f(te.request,(se,ge,Le,Be)=>{this._dataUpdateable=Hr(ge,he)?ii(ge,he):void 0,ve(se,ge,Le,Be)});if(typeof te.data=="string")try{const se=JSON.parse(te.data);this._dataUpdateable=Hr(se,he)?ii(se,he):void 0,ve(null,se)}catch{ve(new Error(`Input data given to '${te.source}' is not a valid GeoJSON object.`))}else te.dataDiff?this._dataUpdateable?(function(se,ge,Le){var Be,Oe,zt,Gt;if(ge.removeAll&&se.clear(),ge.remove)for(const It of ge.remove)se.delete(It);if(ge.add)for(const It of ge.add){const Ft=xt(It,Le);Ft!=null&&se.set(Ft,It)}if(ge.update)for(const It of ge.update){let Ft=se.get(It.id);if(Ft==null)continue;const Zt=!It.removeAllProperties&&(((Be=It.removeProperties)===null||Be===void 0?void 0:Be.length)>0||((Oe=It.addOrUpdateProperties)===null||Oe===void 0?void 0:Oe.length)>0);if((It.newGeometry||It.removeAllProperties||Zt)&&(Ft=Object.assign({},Ft),se.set(It.id,Ft),Zt&&(Ft.properties=Object.assign({},Ft.properties))),It.newGeometry&&(Ft.geometry=It.newGeometry),It.removeAllProperties)Ft.properties={};else if(((zt=It.removeProperties)===null||zt===void 0?void 0:zt.length)>0)for(const Ur of It.removeProperties)Object.prototype.hasOwnProperty.call(Ft.properties,Ur)&&delete Ft.properties[Ur];if(((Gt=It.addOrUpdateProperties)===null||Gt===void 0?void 0:Gt.length)>0)for(const{key:Ur,value:Yr}of It.addOrUpdateProperties)Ft.properties[Ur]=Yr}}(this._dataUpdateable,te.dataDiff,he),ve(null,{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())})):ve(new Error(`Cannot update existing geojson data in ${te.source}`)):ve(new Error(`Input data given to '${te.source}' is not a valid GeoJSON object.`));return{cancel:()=>{}}},this.loadVectorData=this.loadGeoJSONTile,X&&(this.loadGeoJSON=X)}loadGeoJSONTile(R,O){const q=R.tileID.canonical;if(!this._geoJSONIndex)return O(null,null);const X=this._geoJSONIndex.getTile(q.z,q.x,q.y);if(!X)return O(null,null);const te=new class{constructor(he){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=c.N,this.length=he.length,this._features=he}feature(he){return new class{constructor(se){this._feature=se,this.extent=c.N,this.type=se.type,this.properties=se.tags,"id"in se&&!isNaN(se.id)&&(this.id=parseInt(se.id,10))}loadGeometry(){if(this._feature.type===1){const se=[];for(const ge of this._feature.geometry)se.push([new c.P(ge[0],ge[1])]);return se}{const se=[];for(const ge of this._feature.geometry){const Le=[];for(const Be of ge)Le.push(new c.P(Be[0],Be[1]));se.push(Le)}return se}}toGeoJSON(se,ge,Le){return _e.call(this,se,ge,Le)}}(this._features[he])}}(X.features);let ve=ft(te);ve.byteOffset===0&&ve.byteLength===ve.buffer.byteLength||(ve=new Uint8Array(ve)),O(null,{vectorTile:te,rawData:ve.buffer})}loadData(R,O){var q;(q=this._pendingRequest)===null||q===void 0||q.cancel(),this._pendingCallback&&this._pendingCallback(null,{abandoned:!0});const X=!!(R&&R.request&&R.request.collectResourceTiming)&&new c.bu(R.request);this._pendingCallback=O,this._pendingRequest=this.loadGeoJSON(R,(te,ve)=>{if(delete this._pendingCallback,delete this._pendingRequest,te||!ve)return O(te);if(typeof ve!="object")return O(new Error(`Input data given to '${R.source}' is not a valid GeoJSON object.`));{Y(ve,!0);try{if(R.filter){const se=c.bC(R.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(se.result==="error")throw new Error(se.value.map(Le=>`${Le.key}: ${Le.message}`).join(", "));ve={type:"FeatureCollection",features:ve.features.filter(Le=>se.value.evaluate({zoom:0},Le))}}this._geoJSONIndex=R.cluster?new yr(function({superclusterOptions:se,clusterProperties:ge}){if(!ge||!se)return se;const Le={},Be={},Oe={accumulated:null,zoom:0},zt={properties:null},Gt=Object.keys(ge);for(const It of Gt){const[Ft,Zt]=ge[It],Ur=c.bC(Zt),Yr=c.bC(typeof Ft=="string"?[Ft,["accumulated"],["get",It]]:Ft);Le[It]=Ur.value,Be[It]=Yr.value}return se.map=It=>{zt.properties=It;const Ft={};for(const Zt of Gt)Ft[Zt]=Le[Zt].evaluate(Oe,zt);return Ft},se.reduce=(It,Ft)=>{zt.properties=Ft;for(const Zt of Gt)Oe.accumulated=It[Zt],It[Zt]=Be[Zt].evaluate(Oe,zt)},se}(R)).load(ve.features):function(se,ge){return new We(se,ge)}(ve,R.geojsonVtOptions)}catch(se){return O(se)}this.loaded={};const he={};if(X){const se=X.finish();se&&(he.resourceTiming={},he.resourceTiming[R.source]=JSON.parse(JSON.stringify(se)))}O(null,he)}})}reloadTile(R,O){const q=this.loaded;return q&&q[R.uid]?super.reloadTile(R,O):this.loadTile(R,O)}removeSource(R,O){this._pendingCallback&&this._pendingCallback(null,{abandoned:!0}),O()}getClusterExpansionZoom(R,O){try{O(null,this._geoJSONIndex.getClusterExpansionZoom(R.clusterId))}catch(q){O(q)}}getClusterChildren(R,O){try{O(null,this._geoJSONIndex.getChildren(R.clusterId))}catch(q){O(q)}}getClusterLeaves(R,O){try{O(null,this._geoJSONIndex.getLeaves(R.clusterId,R.limit,R.offset))}catch(q){O(q)}}}class On{constructor(R){this.self=R,this.actor=new c.C(R,this),this.layerIndexes={},this.availableImages={},this.workerSourceTypes={vector:j,geojson:qt},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(O,q)=>{if(this.workerSourceTypes[O])throw new Error(`Worker source with name "${O}" already registered.`);this.workerSourceTypes[O]=q},this.self.registerRTLTextPlugin=O=>{if(c.bD.isParsed())throw new Error("RTL text plugin already registered.");c.bD.applyArabicShaping=O.applyArabicShaping,c.bD.processBidirectionalText=O.processBidirectionalText,c.bD.processStyledBidirectionalText=O.processStyledBidirectionalText}}setReferrer(R,O){this.referrer=O}setImages(R,O,q){this.availableImages[R]=O;for(const X in this.workerSources[R]){const te=this.workerSources[R][X];for(const ve in te)te[ve].availableImages=O}q()}setLayers(R,O,q){this.getLayerIndex(R).replace(O),q()}updateLayers(R,O,q){this.getLayerIndex(R).update(O.layers,O.removedIds),q()}loadTile(R,O,q){this.getWorkerSource(R,O.type,O.source).loadTile(O,q)}loadDEMTile(R,O,q){this.getDEMWorkerSource(R,O.source).loadTile(O,q)}reloadTile(R,O,q){this.getWorkerSource(R,O.type,O.source).reloadTile(O,q)}abortTile(R,O,q){this.getWorkerSource(R,O.type,O.source).abortTile(O,q)}removeTile(R,O,q){this.getWorkerSource(R,O.type,O.source).removeTile(O,q)}removeDEMTile(R,O){this.getDEMWorkerSource(R,O.source).removeTile(O)}removeSource(R,O,q){if(!this.workerSources[R]||!this.workerSources[R][O.type]||!this.workerSources[R][O.type][O.source])return;const X=this.workerSources[R][O.type][O.source];delete this.workerSources[R][O.type][O.source],X.removeSource!==void 0?X.removeSource(O,q):q()}loadWorkerSource(R,O,q){try{this.self.importScripts(O.url),q()}catch(X){q(X.toString())}}syncRTLPluginState(R,O,q){try{c.bD.setState(O);const X=c.bD.getPluginURL();if(c.bD.isLoaded()&&!c.bD.isParsed()&&X!=null){this.self.importScripts(X);const te=c.bD.isParsed();q(te?void 0:new Error(`RTL Text Plugin failed to import scripts from ${X}`),te)}}catch(X){q(X.toString())}}getAvailableImages(R){let O=this.availableImages[R];return O||(O=[]),O}getLayerIndex(R){let O=this.layerIndexes[R];return O||(O=this.layerIndexes[R]=new A),O}getWorkerSource(R,O,q){return this.workerSources[R]||(this.workerSources[R]={}),this.workerSources[R][O]||(this.workerSources[R][O]={}),this.workerSources[R][O][q]||(this.workerSources[R][O][q]=new this.workerSourceTypes[O]({send:(X,te,ve)=>{this.actor.send(X,te,ve,R)}},this.getLayerIndex(R),this.getAvailableImages(R))),this.workerSources[R][O][q]}getDEMWorkerSource(R,O){return this.demWorkerSources[R]||(this.demWorkerSources[R]={}),this.demWorkerSources[R][O]||(this.demWorkerSources[R][O]=new Q),this.demWorkerSources[R][O]}}return c.i()&&(self.worker=new On(self)),On}),v(["./shared"],function(c){var A="3.6.2";class T{static testProp(i){if(!T.docStyle)return i[0];for(let o=0;o{window.removeEventListener("click",T.suppressClickInternal,!0)},0)}static mousePos(i,o){const h=i.getBoundingClientRect();return new c.P(o.clientX-h.left-i.clientLeft,o.clientY-h.top-i.clientTop)}static touchPos(i,o){const h=i.getBoundingClientRect(),f=[];for(let y=0;y{i=[],o=0,h=0,f={}},m.addThrottleControl=C=>{const D=h++;return f[D]=C,D},m.removeThrottleControl=C=>{delete f[C],S()},m.getImage=(C,D,P=!0)=>{z.supported&&(C.headers||(C.headers={}),C.headers.accept="image/webp,*/*");const N={requestParameters:C,supportImageRefresh:P,callback:D,cancelled:!1,completed:!1,cancel:()=>{N.completed||N.cancelled||(N.cancelled=!0,N.innerRequest&&(N.innerRequest.cancel(),o--),S())}};return i.push(N),S(),N};const y=C=>{const{requestParameters:D,supportImageRefresh:P,callback:N}=C;return c.e(D,{type:"image"}),(P!==!1||c.i()||c.g(D.url)||D.headers&&!Object.keys(D.headers).reduce((H,W)=>H&&W==="accept",!0)?c.m:k)(D,(H,W,J,G)=>{w(C,N,H,W,J,G)})},w=(C,D,P,N,H,W)=>{P?D(P):N instanceof HTMLImageElement||c.a(N)?D(null,N):N&&((J,G)=>{typeof createImageBitmap=="function"?c.b(J,G):c.d(J,G)})(N,(J,G)=>{J!=null?D(J):G!=null&&D(null,G,{cacheControl:H,expires:W})}),C.cancelled||(C.completed=!0,o--,S())},S=()=>{const C=(()=>{const D=Object.keys(f);let P=!1;if(D.length>0){for(const N of D)if(P=f[N](),P)break}return P})()?c.c.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.c.MAX_PARALLEL_IMAGE_REQUESTS;for(let D=o;D0;D++){const P=i.shift();if(P.cancelled){D--;continue}const N=y(P);o++,P.innerRequest=N}},k=(C,D)=>{const P=new Image,N=C.url;let H=!1;const W=C.credentials;return W&&W==="include"?P.crossOrigin="use-credentials":(W&&W==="same-origin"||!c.s(N))&&(P.crossOrigin="anonymous"),P.fetchPriority="high",P.onload=()=>{D(null,P),P.onerror=P.onload=null},P.onerror=()=>{H||D(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.")),P.onerror=P.onload=null},P.src=N,{cancel:()=>{H=!0,P.src=""}}}}(ne||(ne={})),ne.resetRequestQueue(),function(m){m.Glyphs="Glyphs",m.Image="Image",m.Source="Source",m.SpriteImage="SpriteImage",m.SpriteJSON="SpriteJSON",m.Style="Style",m.Tile="Tile",m.Unknown="Unknown"}(Y||(Y={}));class _e{constructor(i){this._transformRequestFn=i}transformRequest(i,o){return this._transformRequestFn&&this._transformRequestFn(i,o)||{url:i}}normalizeSpriteURL(i,o,h){const f=function(y){const w=y.match(de);if(!w)throw new Error(`Unable to parse URL "${y}"`);return{protocol:w[1],authority:w[2],path:w[3]||"/",params:w[4]?w[4].split("&"):[]}}(i);return f.path+=`${o}${h}`,function(y){const w=y.params.length?`?${y.params.join("&")}`:"";return`${y.protocol}://${y.authority}${y.path}${w}`}(f)}setTransformRequest(i){this._transformRequestFn=i}}const de=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function pe(m){var i=new c.A(3);return i[0]=m[0],i[1]=m[1],i[2]=m[2],i}var Te,De=function(m,i,o){return m[0]=i[0]-o[0],m[1]=i[1]-o[1],m[2]=i[2]-o[2],m};Te=new c.A(3),c.A!=Float32Array&&(Te[0]=0,Te[1]=0,Te[2]=0);var je=function(m){var i=m[0],o=m[1];return i*i+o*o};function ke(m){const i=[];if(typeof m=="string")i.push({id:"default",url:m});else if(m&&m.length>0){const o=[];for(const{id:h,url:f}of m){const y=`${h}${f}`;o.indexOf(y)===-1&&(o.push(y),i.push({id:h,url:f}))}}return i}function $e(m,i,o,h,f){if(h)return void m(h);if(f!==Object.values(i).length||f!==Object.values(o).length)return;const y={};for(const w in i){y[w]={};const S=c.h.getImageCanvasContext(o[w]),k=i[w];for(const C in k){const{width:D,height:P,x:N,y:H,sdf:W,pixelRatio:J,stretchX:G,stretchY:fe,content:Se}=k[C];y[w][C]={data:null,pixelRatio:J,sdf:W,stretchX:G,stretchY:fe,content:Se,spriteData:{width:D,height:P,x:N,y:H,context:S}}}}m(null,y)}(function(){var m=new c.A(2);c.A!=Float32Array&&(m[0]=0,m[1]=0)})();class Me{constructor(i,o,h,f){this.context=i,this.format=h,this.texture=i.gl.createTexture(),this.update(o,f)}update(i,o,h){const{width:f,height:y}=i,w=!(this.size&&this.size[0]===f&&this.size[1]===y||h),{context:S}=this,{gl:k}=S;if(this.useMipmap=!!(o&&o.useMipmap),k.bindTexture(k.TEXTURE_2D,this.texture),S.pixelStoreUnpackFlipY.set(!1),S.pixelStoreUnpack.set(1),S.pixelStoreUnpackPremultiplyAlpha.set(this.format===k.RGBA&&(!o||o.premultiply!==!1)),w)this.size=[f,y],i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||c.a(i)?k.texImage2D(k.TEXTURE_2D,0,this.format,this.format,k.UNSIGNED_BYTE,i):k.texImage2D(k.TEXTURE_2D,0,this.format,f,y,0,this.format,k.UNSIGNED_BYTE,i.data);else{const{x:C,y:D}=h||{x:0,y:0};i instanceof HTMLImageElement||i instanceof HTMLCanvasElement||i instanceof HTMLVideoElement||i instanceof ImageData||c.a(i)?k.texSubImage2D(k.TEXTURE_2D,0,C,D,k.RGBA,k.UNSIGNED_BYTE,i):k.texSubImage2D(k.TEXTURE_2D,0,C,D,f,y,k.RGBA,k.UNSIGNED_BYTE,i.data)}this.useMipmap&&this.isSizePowerOfTwo()&&k.generateMipmap(k.TEXTURE_2D)}bind(i,o,h){const{context:f}=this,{gl:y}=f;y.bindTexture(y.TEXTURE_2D,this.texture),h!==y.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(h=y.LINEAR),i!==this.filter&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MAG_FILTER,i),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_MIN_FILTER,h||i),this.filter=i),o!==this.wrap&&(y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_S,o),y.texParameteri(y.TEXTURE_2D,y.TEXTURE_WRAP_T,o),this.wrap=o)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:i}=this.context;i.deleteTexture(this.texture),this.texture=null}}function He(m){const{userImage:i}=m;return!!(i&&i.render&&i.render())&&(m.data.replace(new Uint8Array(i.data.buffer)),!0)}class Ye extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(i){if(this.loaded!==i&&(this.loaded=i,i)){for(const{ids:o,callback:h}of this.requestors)this._notify(o,h);this.requestors=[]}}getImage(i){const o=this.images[i];if(o&&!o.data&&o.spriteData){const h=o.spriteData;o.data=new c.R({width:h.width,height:h.height},h.context.getImageData(h.x,h.y,h.width,h.height).data),o.spriteData=null}return o}addImage(i,o){if(this.images[i])throw new Error(`Image id ${i} already exist, use updateImage instead`);this._validate(i,o)&&(this.images[i]=o)}_validate(i,o){let h=!0;const f=o.data||o.spriteData;return this._validateStretch(o.stretchX,f&&f.width)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "stretchX" value`))),h=!1),this._validateStretch(o.stretchY,f&&f.height)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "stretchY" value`))),h=!1),this._validateContent(o.content,o)||(this.fire(new c.j(new Error(`Image "${i}" has invalid "content" value`))),h=!1),h}_validateStretch(i,o){if(!i)return!0;let h=0;for(const f of i){if(f[0]-1);k++,y[k]=S,w[k]=C,w[k+1]=Pe}for(let S=0,k=0;S{let S=this.entries[f];S||(S=this.entries[f]={glyphs:{},requests:{},ranges:{}});let k=S.glyphs[y];if(k!==void 0)return void w(null,{stack:f,id:y,glyph:k});if(k=this._tinySDF(S,f,y),k)return S.glyphs[y]=k,void w(null,{stack:f,id:y,glyph:k});const C=Math.floor(y/256);if(256*C>65535)return void w(new Error("glyphs > 65535 not supported"));if(S.ranges[C])return void w(null,{stack:f,id:y,glyph:k});if(!this.url)return void w(new Error("glyphsUrl is not set"));let D=S.requests[C];D||(D=S.requests[C]=[],lt.loadGlyphRange(f,C,this.url,this.requestManager,(P,N)=>{if(N){for(const H in N)this._doesCharSupportLocalGlyph(+H)||(S.glyphs[+H]=N[+H]);S.ranges[C]=!0}for(const H of D)H(P,N);delete S.requests[C]})),D.push((P,N)=>{P?w(P):N&&w(null,{stack:f,id:y,glyph:N[y]||null})})},(f,y)=>{if(f)o(f);else if(y){const w={};for(const{stack:S,id:k,glyph:C}of y)(w[S]||(w[S]={}))[k]=C&&{id:C.id,bitmap:C.bitmap.clone(),metrics:C.metrics};o(null,w)}})}_doesCharSupportLocalGlyph(i){return!!this.localIdeographFontFamily&&(c.u["CJK Unified Ideographs"](i)||c.u["Hangul Syllables"](i)||c.u.Hiragana(i)||c.u.Katakana(i))}_tinySDF(i,o,h){const f=this.localIdeographFontFamily;if(!f||!this._doesCharSupportLocalGlyph(h))return;let y=i.tinySDF;if(!y){let S="400";/bold/i.test(o)?S="900":/medium/i.test(o)?S="500":/light/i.test(o)&&(S="200"),y=i.tinySDF=new lt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:f,fontWeight:S})}const w=y.draw(String.fromCharCode(h));return{id:h,bitmap:new c.q({width:w.width||60,height:w.height||60},w.data),metrics:{width:w.glyphWidth/2||24,height:w.glyphHeight/2||24,left:w.glyphLeft/2+.5||0,top:w.glyphTop/2-27.5||-8,advance:w.glyphAdvance/2||24,isDoubleResolution:!0}}}}lt.loadGlyphRange=function(m,i,o,h,f){const y=256*i,w=y+255,S=h.transformRequest(o.replace("{fontstack}",m).replace("{range}",`${y}-${w}`),Y.Glyphs);c.l(S,(k,C)=>{if(k)f(k);else if(C){const D={};for(const P of c.n(C))D[P.id]=P;f(null,D)}})},lt.TinySDF=class{constructor({fontSize:m=24,buffer:i=3,radius:o=8,cutoff:h=.25,fontFamily:f="sans-serif",fontWeight:y="normal",fontStyle:w="normal"}={}){this.buffer=i,this.cutoff=h,this.radius=o;const S=this.size=m+4*i,k=this._createCanvas(S),C=this.ctx=k.getContext("2d",{willReadFrequently:!0});C.font=`${w} ${y} ${m}px ${f}`,C.textBaseline="alphabetic",C.textAlign="left",C.fillStyle="black",this.gridOuter=new Float64Array(S*S),this.gridInner=new Float64Array(S*S),this.f=new Float64Array(S),this.z=new Float64Array(S+1),this.v=new Uint16Array(S)}_createCanvas(m){const i=document.createElement("canvas");return i.width=i.height=m,i}draw(m){const{width:i,actualBoundingBoxAscent:o,actualBoundingBoxDescent:h,actualBoundingBoxLeft:f,actualBoundingBoxRight:y}=this.ctx.measureText(m),w=Math.ceil(o),S=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(y-f))),k=Math.min(this.size-this.buffer,w+Math.ceil(h)),C=S+2*this.buffer,D=k+2*this.buffer,P=Math.max(C*D,0),N=new Uint8ClampedArray(P),H={data:N,width:C,height:D,glyphWidth:S,glyphHeight:k,glyphTop:w,glyphLeft:0,glyphAdvance:i};if(S===0||k===0)return H;const{ctx:W,buffer:J,gridInner:G,gridOuter:fe}=this;W.clearRect(J,J,S,k),W.fillText(m,J,J+w);const Se=W.getImageData(J,J,S,k);fe.fill(Pe,0,P),G.fill(0,0,P);for(let re=0;re0?Re*Re:0,G[Ee]=Re<0?Re*Re:0}}tt(fe,0,0,C,D,C,this.f,this.v,this.z),tt(G,J,J,S,k,C,this.f,this.v,this.z);for(let re=0;re1&&(k=i[++S]);const D=Math.abs(C-k.left),P=Math.abs(C-k.right),N=Math.min(D,P);let H;const W=y/h*(f+1);if(k.isDash){const J=f-Math.abs(W);H=Math.sqrt(N*N+J*J)}else H=f-Math.sqrt(N*N+W*W);this.data[w+C]=Math.max(0,Math.min(255,H+128))}}}addRegularDash(i){for(let S=i.length-1;S>=0;--S){const k=i[S],C=i[S+1];k.zeroLength?i.splice(S,1):C&&C.isDash===k.isDash&&(C.left=k.left,i.splice(S,1))}const o=i[0],h=i[i.length-1];o.isDash===h.isDash&&(o.left=h.left-this.width,h.right=o.right+this.width);const f=this.width*this.nextRow;let y=0,w=i[y];for(let S=0;S1&&(w=i[++y]);const k=Math.abs(S-w.left),C=Math.abs(S-w.right),D=Math.min(k,C);this.data[f+S]=Math.max(0,Math.min(255,(w.isDash?D:-D)+128))}}addDash(i,o){const h=o?7:0,f=2*h+1;if(this.nextRow+f>this.height)return c.w("LineAtlas out of space"),null;let y=0;for(let S=0;S{f.send(i,o,y)},h=h||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(i=!0){this.actors.forEach(o=>{o.remove()}),this.actors=[],i&&this.workerPool.release(this.id)}}function Ct(m,i,o){const h=function(f,y){if(f)return o(f);if(y){const w=c.F(c.e(y,m),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);y.vector_layers&&(w.vectorLayers=y.vector_layers,w.vectorLayerIds=w.vectorLayers.map(S=>S.id)),o(null,w)}};return m.url?c.f(i.transformRequest(m.url,Y.Source),h):c.h.frame(()=>h(null,m))}class Mt{constructor(i,o){i&&(o?this.setSouthWest(i).setNorthEast(o):Array.isArray(i)&&(i.length===4?this.setSouthWest([i[0],i[1]]).setNorthEast([i[2],i[3]]):this.setSouthWest(i[0]).setNorthEast(i[1])))}setNorthEast(i){return this._ne=i instanceof c.L?new c.L(i.lng,i.lat):c.L.convert(i),this}setSouthWest(i){return this._sw=i instanceof c.L?new c.L(i.lng,i.lat):c.L.convert(i),this}extend(i){const o=this._sw,h=this._ne;let f,y;if(i instanceof c.L)f=i,y=i;else{if(!(i instanceof Mt))return Array.isArray(i)?i.length===4||i.every(Array.isArray)?this.extend(Mt.convert(i)):this.extend(c.L.convert(i)):i&&("lng"in i||"lon"in i)&&"lat"in i?this.extend(c.L.convert(i)):this;if(f=i._sw,y=i._ne,!f||!y)return this}return o||h?(o.lng=Math.min(f.lng,o.lng),o.lat=Math.min(f.lat,o.lat),h.lng=Math.max(y.lng,h.lng),h.lat=Math.max(y.lat,h.lat)):(this._sw=new c.L(f.lng,f.lat),this._ne=new c.L(y.lng,y.lat)),this}getCenter(){return new c.L((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.L(this.getWest(),this.getNorth())}getSouthEast(){return new c.L(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(i){const{lng:o,lat:h}=c.L.convert(i);let f=this._sw.lng<=o&&o<=this._ne.lng;return this._sw.lng>this._ne.lng&&(f=this._sw.lng>=o&&o>=this._ne.lng),this._sw.lat<=h&&h<=this._ne.lat&&f}static convert(i){return i instanceof Mt?i:i&&new Mt(i)}static fromLngLat(i,o=0){const h=360*o/40075017,f=h/Math.cos(Math.PI/180*i.lat);return new Mt(new c.L(i.lng-f,i.lat-h),new c.L(i.lng+f,i.lat+h))}}class rt{constructor(i,o,h){this.bounds=Mt.convert(this.validateBounds(i)),this.minzoom=o||0,this.maxzoom=h||24}validateBounds(i){return Array.isArray(i)&&i.length===4?[Math.max(-180,i[0]),Math.max(-90,i[1]),Math.min(180,i[2]),Math.min(90,i[3])]:[-180,-90,180,90]}contains(i){const o=Math.pow(2,i.z),h=Math.floor(c.G(this.bounds.getWest())*o),f=Math.floor(c.H(this.bounds.getNorth())*o),y=Math.ceil(c.G(this.bounds.getEast())*o),w=Math.ceil(c.H(this.bounds.getSouth())*o);return i.x>=h&&i.x=f&&i.y{this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Ct(this._options,this.map._requestManager,(y,w)=>{this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),y?this.fire(new c.j(y)):w&&(c.e(this,w),w.bounds&&(this.tileBounds=new rt(w.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))})},this.serialize=()=>c.e({},this._options),this.id=i,this.dispatcher=h,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,c.e(this,c.F(o,["url","scheme","tileSize","promoteId"])),this._options=c.e({type:"vector"},o),this._collectResourceTiming=o.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(f)}loaded(){return this._loaded}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}onAdd(i){this.map=i,this.load()}setSourceProperty(i){this._tileJSONRequest&&this._tileJSONRequest.cancel(),i(),this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}setUrl(i){return this.setSourceProperty(()=>{this.url=i,this._options.url=i}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}loadTile(i,o){const h=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f={request:this.map._requestManager.transformRequest(h,Y.Tile),uid:i.uid,tileID:i.tileID,zoom:i.tileID.overscaledZ,tileSize:this.tileSize*i.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};function y(w,S){return delete i.request,i.aborted?o(null):w&&w.status!==404?o(w):(S&&S.resourceTiming&&(i.resourceTiming=S.resourceTiming),this.map._refreshExpiredTiles&&S&&i.setExpiryData(S),i.loadVectorData(S,this.map.painter),o(null),void(i.reloadCallback&&(this.loadTile(i,i.reloadCallback),i.reloadCallback=null)))}f.request.collectResourceTiming=this._collectResourceTiming,i.actor&&i.state!=="expired"?i.state==="loading"?i.reloadCallback=o:i.request=i.actor.send("reloadTile",f,y.bind(this)):(i.actor=this.dispatcher.getActor(),i.request=i.actor.send("loadTile",f,y.bind(this)))}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.actor&&i.actor.send("abortTile",{uid:i.uid,type:this.type,source:this.id},void 0)}unloadTile(i){i.unloadVectorData(),i.actor&&i.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id},void 0)}hasTransition(){return!1}}class yr extends c.E{constructor(i,o,h,f){super(),this.id=i,this.dispatcher=h,this.setEventedParent(f),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},o),c.e(this,c.F(o,["url","scheme","tileSize"]))}load(){this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this._tileJSONRequest=Ct(this._options,this.map._requestManager,(i,o)=>{this._tileJSONRequest=null,this._loaded=!0,i?this.fire(new c.j(i)):o&&(c.e(this,o),o.bounds&&(this.tileBounds=new rt(o.bounds,this.minzoom,this.maxzoom)),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})))})}loaded(){return this._loaded}onAdd(i){this.map=i,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}setSourceProperty(i){this._tileJSONRequest&&this._tileJSONRequest.cancel(),i(),this.load()}setTiles(i){return this.setSourceProperty(()=>{this._options.tiles=i}),this}serialize(){return c.e({},this._options)}hasTile(i){return!this.tileBounds||this.tileBounds.contains(i.canonical)}loadTile(i,o){const h=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);i.request=ne.getImage(this.map._requestManager.transformRequest(h,Y.Tile),(f,y,w)=>{if(delete i.request,i.aborted)i.state="unloaded",o(null);else if(f)i.state="errored",o(f);else if(y){this.map._refreshExpiredTiles&&w&&i.setExpiryData(w);const S=this.map.painter.context,k=S.gl;i.texture=this.map.painter.getTileTexture(y.width),i.texture?i.texture.update(y,{useMipmap:!0}):(i.texture=new Me(S,y,k.RGBA,{useMipmap:!0}),i.texture.bind(k.LINEAR,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),S.extTextureFilterAnisotropic&&k.texParameterf(k.TEXTURE_2D,S.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,S.extTextureFilterAnisotropicMax)),i.state="loaded",o(null)}},this.map._refreshExpiredTiles)}abortTile(i,o){i.request&&(i.request.cancel(),delete i.request),o()}unloadTile(i,o){i.texture&&this.map.painter.saveTileTexture(i.texture),o()}hasTransition(){return!1}}class _t extends yr{constructor(i,o,h,f){super(i,o,h,f),this.type="raster-dem",this.maxzoom=22,this._options=c.e({type:"raster-dem"},o),this.encoding=o.encoding||"mapbox",this.redFactor=o.redFactor,this.greenFactor=o.greenFactor,this.blueFactor=o.blueFactor,this.baseShift=o.baseShift}loadTile(i,o){const h=i.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f=this.map._requestManager.transformRequest(h,Y.Tile);function y(w,S){w&&(i.state="errored",o(w)),S&&(i.dem=S,i.needsHillshadePrepare=!0,i.needsTerrainPrepare=!0,i.state="loaded",o(null))}i.neighboringTiles=this._getNeighboringTiles(i.tileID),i.request=ne.getImage(f,(w,S,k)=>c._(this,void 0,void 0,function*(){if(delete i.request,i.aborted)i.state="unloaded",o(null);else if(w)i.state="errored",o(w);else if(S){this.map._refreshExpiredTiles&&i.setExpiryData(k);const C=c.a(S)&&c.J()?S:yield function(P){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.K()){const N=P.width+2,H=P.height+2;try{return new c.R({width:N,height:H},yield c.M(P,-1,-1,N,H))}catch{}}return c.h.getImageData(P,1)})}(S),D={uid:i.uid,coord:i.tileID,source:this.id,rawImageData:C,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};i.actor&&i.state!=="expired"||(i.actor=this.dispatcher.getActor(),i.actor.send("loadDEMTile",D,y))}}),this.map._refreshExpiredTiles)}_getNeighboringTiles(i){const o=i.canonical,h=Math.pow(2,o.z),f=(o.x-1+h)%h,y=o.x===0?i.wrap-1:i.wrap,w=(o.x+1+h)%h,S=o.x+1===h?i.wrap+1:i.wrap,k={};return k[new c.O(i.overscaledZ,y,o.z,f,o.y).key]={backfilled:!1},k[new c.O(i.overscaledZ,S,o.z,w,o.y).key]={backfilled:!1},o.y>0&&(k[new c.O(i.overscaledZ,y,o.z,f,o.y-1).key]={backfilled:!1},k[new c.O(i.overscaledZ,i.wrap,o.z,o.x,o.y-1).key]={backfilled:!1},k[new c.O(i.overscaledZ,S,o.z,w,o.y-1).key]={backfilled:!1}),o.y+1{this._updateWorkerData()},this.serialize=()=>c.e({},this._options,{type:this.type,data:this._data}),this.id=i,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=h.getActor(),this.setEventedParent(f),this._data=o.data,this._options=c.e({},o),this._collectResourceTiming=o.collectResourceTiming,o.maxzoom!==void 0&&(this.maxzoom=o.maxzoom),o.type&&(this.type=o.type),o.attribution&&(this.attribution=o.attribution),this.promoteId=o.promoteId;const y=c.N/this.tileSize;this.workerOptions=c.e({source:this.id,cluster:o.cluster||!1,geojsonVtOptions:{buffer:(o.buffer!==void 0?o.buffer:128)*y,tolerance:(o.tolerance!==void 0?o.tolerance:.375)*y,extent:c.N,maxZoom:this.maxzoom,lineMetrics:o.lineMetrics||!1,generateId:o.generateId||!1},superclusterOptions:{maxZoom:o.clusterMaxZoom!==void 0?o.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,o.clusterMinPoints||2),extent:c.N,radius:(o.clusterRadius||50)*y,log:!1,generateId:o.generateId||!1},clusterProperties:o.clusterProperties,filter:o.filter},o.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}onAdd(i){this.map=i,this.load()}setData(i){return this._data=i,this._updateWorkerData(),this}updateData(i){return this._updateWorkerData(i),this}setClusterOptions(i){return this.workerOptions.cluster=i.cluster,i&&(i.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=i.clusterRadius),i.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=i.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(i,o){return this.actor.send("geojson.getClusterExpansionZoom",{clusterId:i,source:this.id},o),this}getClusterChildren(i,o){return this.actor.send("geojson.getClusterChildren",{clusterId:i,source:this.id},o),this}getClusterLeaves(i,o,h,f){return this.actor.send("geojson.getClusterLeaves",{source:this.id,clusterId:i,limit:o,offset:h},f),this}_updateWorkerData(i){const o=c.e({},this.workerOptions);i?o.dataDiff=i:typeof this._data=="string"?(o.request=this.map._requestManager.transformRequest(c.h.resolveURL(this._data),Y.Source),o.request.collectResourceTiming=this._collectResourceTiming):o.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new c.k("dataloading",{dataType:"source"})),this.actor.send(`${this.type}.loadData`,o,(h,f)=>{if(this._pendingLoads--,this._removed||f&&f.abandoned)return void this.fire(new c.k("dataabort",{dataType:"source"}));let y=null;if(f&&f.resourceTiming&&f.resourceTiming[this.id]&&(y=f.resourceTiming[this.id].slice(0)),h)return void this.fire(new c.j(h));const w={dataType:"source"};this._collectResourceTiming&&y&&y.length>0&&c.e(w,{resourceTiming:y}),this.fire(new c.k("data",Object.assign(Object.assign({},w),{sourceDataType:"metadata"}))),this.fire(new c.k("data",Object.assign(Object.assign({},w),{sourceDataType:"content"})))})}loaded(){return this._pendingLoads===0}loadTile(i,o){const h=i.actor?"reloadTile":"loadTile";i.actor=this.actor;const f={type:this.type,uid:i.uid,tileID:i.tileID,zoom:i.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};i.request=this.actor.send(h,f,(y,w)=>(delete i.request,i.unloadVectorData(),i.aborted?o(null):y?o(y):(i.loadVectorData(w,this.map.painter,h==="reloadTile"),o(null))))}abortTile(i){i.request&&(i.request.cancel(),delete i.request),i.aborted=!0}unloadTile(i){i.unloadVectorData(),this.actor.send("removeTile",{uid:i.uid,type:this.type,source:this.id})}onRemove(){this._removed=!0,this.actor.send("removeSource",{type:this.type,source:this.id})}hasTransition(){return!1}}var Nt=c.Q([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class Ot extends c.E{constructor(i,o,h,f){super(),this.load=(y,w)=>{this._loaded=!1,this.fire(new c.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=ne.getImage(this.map._requestManager.transformRequest(this.url,Y.Image),(S,k)=>{this._request=null,this._loaded=!0,S?this.fire(new c.j(S)):k&&(this.image=k,y&&(this.coordinates=y),w&&w(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||!this.image)return;const y=this.map.painter.context,w=y.gl;this.boundsBuffer||(this.boundsBuffer=y.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=c.S.simpleSegment(0,0,4,2)),this.texture||(this.texture=new Me(y,this.image,w.RGBA),this.texture.bind(w.LINEAR,w.CLAMP_TO_EDGE));let S=!1;for(const k in this.tiles){const C=this.tiles[k];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,S=!0)}S&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"image",url:this.options.url,coordinates:this.coordinates}),this.id=i,this.dispatcher=h,this.coordinates=o.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(f),this.options=o}loaded(){return this._loaded}updateImage(i){return i.url?(this._request&&(this._request.cancel(),this._request=null),this.options.url=i.url,this.load(i.coordinates,()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new c.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(i){this.map=i,this.load()}onRemove(){this._request&&(this._request.cancel(),this._request=null)}setCoordinates(i){this.coordinates=i;const o=i.map(c.U.fromLngLat);this.tileID=function(f){let y=1/0,w=1/0,S=-1/0,k=-1/0;for(const N of f)y=Math.min(y,N.x),w=Math.min(w,N.y),S=Math.max(S,N.x),k=Math.max(k,N.y);const C=Math.max(S-y,k-w),D=Math.max(0,Math.floor(-Math.log(C)/Math.LN2)),P=Math.pow(2,D);return new c.W(D,Math.floor((y+S)/2*P),Math.floor((w+k)/2*P))}(o),this.minzoom=this.maxzoom=this.tileID.z;const h=o.map(f=>this.tileID.getTilePoint(f)._round());return this._boundsArray=new c.V,this._boundsArray.emplaceBack(h[0].x,h[0].y,0,0),this._boundsArray.emplaceBack(h[1].x,h[1].y,c.N,0),this._boundsArray.emplaceBack(h[3].x,h[3].y,0,c.N),this._boundsArray.emplaceBack(h[2].x,h[2].y,c.N,c.N),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new c.k("data",{dataType:"source",sourceDataType:"content"})),this}loadTile(i,o){this.tileID&&this.tileID.equals(i.tileID.canonical)?(this.tiles[String(i.tileID.wrap)]=i,i.buckets={},o(null)):(i.state="errored",o(null))}hasTransition(){return!1}}class Ir extends Ot{constructor(i,o,h,f){super(i,o,h,f),this.load=()=>{this._loaded=!1;const y=this.options;this.urls=[];for(const w of y.urls)this.urls.push(this.map._requestManager.transformRequest(w,Y.Source).url);c.X(this.urls,(w,S)=>{this._loaded=!0,w?this.fire(new c.j(w)):S&&(this.video=S,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading())})},this.prepare=()=>{if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const y=this.map.painter.context,w=y.gl;this.boundsBuffer||(this.boundsBuffer=y.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=c.S.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(w.LINEAR,w.CLAMP_TO_EDGE),w.texSubImage2D(w.TEXTURE_2D,0,0,0,w.RGBA,w.UNSIGNED_BYTE,this.video)):(this.texture=new Me(y,this.video,w.RGBA),this.texture.bind(w.LINEAR,w.CLAMP_TO_EDGE));let S=!1;for(const k in this.tiles){const C=this.tiles[k];C.state!=="loaded"&&(C.state="loaded",C.texture=this.texture,S=!0)}S&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"video",urls:this.urls,coordinates:this.coordinates}),this.roundZoom=!0,this.type="video",this.options=o}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(i){if(this.video){const o=this.video.seekable;io.end(0)?this.fire(new c.j(new c.Y(`sources.${this.id}`,null,`Playback for this video can be set only between the ${o.start(0)} and ${o.end(0)}-second mark.`))):this.video.currentTime=i}}getVideo(){return this.video}onAdd(i){this.map||(this.map=i,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}hasTransition(){return this.video&&!this.video.paused}}class cr extends Ot{constructor(i,o,h,f){super(i,o,h,f),this.load=()=>{this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new c.j(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())},this.prepare=()=>{let y=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,y=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,y=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const w=this.map.painter.context,S=w.gl;this.boundsBuffer||(this.boundsBuffer=w.createVertexBuffer(this._boundsArray,Nt.members)),this.boundsSegments||(this.boundsSegments=c.S.simpleSegment(0,0,4,2)),this.texture?(y||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new Me(w,this.canvas,S.RGBA,{premultiply:!0});let k=!1;for(const C in this.tiles){const D=this.tiles[C];D.state!=="loaded"&&(D.state="loaded",D.texture=this.texture,k=!0)}k&&this.fire(new c.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))},this.serialize=()=>({type:"canvas",coordinates:this.coordinates}),o.coordinates?Array.isArray(o.coordinates)&&o.coordinates.length===4&&!o.coordinates.some(y=>!Array.isArray(y)||y.length!==2||y.some(w=>typeof w!="number"))||this.fire(new c.j(new c.Y(`sources.${i}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.j(new c.Y(`sources.${i}`,null,'missing required property "coordinates"'))),o.animate&&typeof o.animate!="boolean"&&this.fire(new c.j(new c.Y(`sources.${i}`,null,'optional "animate" property must be a boolean value'))),o.canvas?typeof o.canvas=="string"||o.canvas instanceof HTMLCanvasElement||this.fire(new c.j(new c.Y(`sources.${i}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.j(new c.Y(`sources.${i}`,null,'missing required property "canvas"'))),this.options=o,this.animate=o.animate===void 0||o.animate}getCanvas(){return this.canvas}onAdd(i){this.map=i,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const i of[this.canvas.width,this.canvas.height])if(isNaN(i)||i<=0)return!0;return!1}}const Jr={},Ar=m=>{switch(m){case"geojson":return Ge;case"image":return Ot;case"raster":return yr;case"raster-dem":return _t;case"vector":return Rt;case"video":return Ir;case"canvas":return cr}return Jr[m]};function Qr(m,i){const o=c.Z();return c.$(o,o,[1,1,0]),c.a0(o,o,[.5*m.width,.5*m.height,1]),c.a1(o,o,m.calculatePosMatrix(i.toUnwrapped()))}function $i(m,i,o,h,f,y){const w=function(P,N,H){if(P)for(const W of P){const J=N[W];if(J&&J.source===H&&J.type==="fill-extrusion")return!0}else for(const W in N){const J=N[W];if(J.source===H&&J.type==="fill-extrusion")return!0}return!1}(f&&f.layers,i,m.id),S=y.maxPitchScaleFactor(),k=m.tilesIn(h,S,w);k.sort(cn);const C=[];for(const P of k)C.push({wrappedTileID:P.tileID.wrapped().key,queryResults:P.tile.queryRenderedFeatures(i,o,m._state,P.queryGeometry,P.cameraQueryGeometry,P.scale,f,y,S,Qr(m.transform,P.tileID))});const D=function(P){const N={},H={};for(const W of P){const J=W.queryResults,G=W.wrappedTileID,fe=H[G]=H[G]||{};for(const Se in J){const re=J[Se],me=fe[Se]=fe[Se]||{},Ae=N[Se]=N[Se]||[];for(const Ee of re)me[Ee.featureIndex]||(me[Ee.featureIndex]=!0,Ae.push(Ee))}}return N}(C);for(const P in D)D[P].forEach(N=>{const H=N.feature,W=m.getFeatureState(H.layer["source-layer"],H.id);H.source=H.layer.source,H.layer["source-layer"]&&(H.sourceLayer=H.layer["source-layer"]),H.state=W});return D}function cn(m,i){const o=m.tileID,h=i.tileID;return o.overscaledZ-h.overscaledZ||o.canonical.y-h.canonical.y||o.wrap-h.wrap||o.canonical.x-h.canonical.x}class Mn{constructor(i,o){this.timeAdded=0,this.fadeEndTime=0,this.tileID=i,this.uid=c.a2(),this.uses=0,this.tileSize=o,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(i){const o=i+this.timeAdded;oy.getLayer(C)).filter(Boolean);if(k.length!==0){S.layers=k,S.stateDependentLayerIds&&(S.stateDependentLayers=S.stateDependentLayerIds.map(C=>k.filter(D=>D.id===C)[0]));for(const C of k)w[C.id]=S}}return w}(i.buckets,o.style),this.hasSymbolBuckets=!1;for(const f in this.buckets){const y=this.buckets[f];if(y instanceof c.a4){if(this.hasSymbolBuckets=!0,!h)break;y.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const f in this.buckets){const y=this.buckets[f];if(y instanceof c.a4&&y.hasRTLText){this.hasRTLText=!0,c.a5();break}}this.queryPadding=0;for(const f in this.buckets){const y=this.buckets[f];this.queryPadding=Math.max(this.queryPadding,o.style.getLayer(f).queryRadius(y))}i.imageAtlas&&(this.imageAtlas=i.imageAtlas),i.glyphAtlasImage&&(this.glyphAtlasImage=i.glyphAtlasImage)}else this.collisionBoxArray=new c.a3}unloadVectorData(){for(const i in this.buckets)this.buckets[i].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(i){return this.buckets[i.id]}upload(i){for(const h in this.buckets){const f=this.buckets[h];f.uploadPending()&&f.upload(i)}const o=i.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Me(i,this.imageAtlas.image,o.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Me(i,this.glyphAtlasImage,o.ALPHA),this.glyphAtlasImage=null)}prepare(i){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(i,this.imageAtlasTexture)}queryRenderedFeatures(i,o,h,f,y,w,S,k,C,D){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:f,cameraQueryGeometry:y,scale:w,tileSize:this.tileSize,pixelPosMatrix:D,transform:k,params:S,queryPadding:this.queryPadding*C},i,o,h):{}}querySourceFeatures(i,o){const h=this.latestFeatureIndex;if(!h||!h.rawTileData)return;const f=h.loadVTLayers(),y=o&&o.sourceLayer?o.sourceLayer:"",w=f._geojsonTileLayer||f[y];if(!w)return;const S=c.a6(o&&o.filter),{z:k,x:C,y:D}=this.tileID.canonical,P={z:k,x:C,y:D};for(let N=0;Nh)f=!1;else if(o)if(this.expirationTime{this.remove(i,y)},h)),this.data[f].push(y),this.order.push(f),this.order.length>this.max){const w=this._getAndRemoveByKey(this.order[0]);w&&this.onRemove(w)}return this}has(i){return i.wrapped().key in this.data}getAndRemove(i){return this.has(i)?this._getAndRemoveByKey(i.wrapped().key):null}_getAndRemoveByKey(i){const o=this.data[i].shift();return o.timeout&&clearTimeout(o.timeout),this.data[i].length===0&&delete this.data[i],this.order.splice(this.order.indexOf(i),1),o.value}getByKey(i){const o=this.data[i];return o?o[0].value:null}get(i){return this.has(i)?this.data[i.wrapped().key][0].value:null}remove(i,o){if(!this.has(i))return this;const h=i.wrapped().key,f=o===void 0?0:this.data[h].indexOf(o),y=this.data[h][f];return this.data[h].splice(f,1),y.timeout&&clearTimeout(y.timeout),this.data[h].length===0&&delete this.data[h],this.onRemove(y.value),this.order.splice(this.order.indexOf(h),1),this}setMaxSize(i){for(this.max=i;this.order.length>this.max;){const o=this._getAndRemoveByKey(this.order[0]);o&&this.onRemove(o)}return this}filter(i){const o=[];for(const h in this.data)for(const f of this.data[h])i(f.value)||o.push(f);for(const h of o)this.remove(h.value.tileID,h)}}class Ce{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(i,o,h){const f=String(o);if(this.stateChanges[i]=this.stateChanges[i]||{},this.stateChanges[i][f]=this.stateChanges[i][f]||{},c.e(this.stateChanges[i][f],h),this.deletedStates[i]===null){this.deletedStates[i]={};for(const y in this.state[i])y!==f&&(this.deletedStates[i][y]=null)}else if(this.deletedStates[i]&&this.deletedStates[i][f]===null){this.deletedStates[i][f]={};for(const y in this.state[i][f])h[y]||(this.deletedStates[i][f][y]=null)}else for(const y in h)this.deletedStates[i]&&this.deletedStates[i][f]&&this.deletedStates[i][f][y]===null&&delete this.deletedStates[i][f][y]}removeFeatureState(i,o,h){if(this.deletedStates[i]===null)return;const f=String(o);if(this.deletedStates[i]=this.deletedStates[i]||{},h&&o!==void 0)this.deletedStates[i][f]!==null&&(this.deletedStates[i][f]=this.deletedStates[i][f]||{},this.deletedStates[i][f][h]=null);else if(o!==void 0)if(this.stateChanges[i]&&this.stateChanges[i][f])for(h in this.deletedStates[i][f]={},this.stateChanges[i][f])this.deletedStates[i][f][h]=null;else this.deletedStates[i][f]=null;else this.deletedStates[i]=null}getState(i,o){const h=String(o),f=c.e({},(this.state[i]||{})[h],(this.stateChanges[i]||{})[h]);if(this.deletedStates[i]===null)return{};if(this.deletedStates[i]){const y=this.deletedStates[i][o];if(y===null)return{};for(const w in y)delete f[w]}return f}initializeTileState(i,o){i.setFeatureState(this.state,o)}coalesceChanges(i,o){const h={};for(const f in this.stateChanges){this.state[f]=this.state[f]||{};const y={};for(const w in this.stateChanges[f])this.state[f][w]||(this.state[f][w]={}),c.e(this.state[f][w],this.stateChanges[f][w]),y[w]=this.state[f][w];h[f]=y}for(const f in this.deletedStates){this.state[f]=this.state[f]||{};const y={};if(this.deletedStates[f]===null)for(const w in this.state[f])y[w]={},this.state[f][w]={};else for(const w in this.deletedStates[f]){if(this.deletedStates[f][w]===null)this.state[f][w]={};else for(const S of Object.keys(this.deletedStates[f][w]))delete this.state[f][w][S];y[w]=this.state[f][w]}h[f]=h[f]||{},c.e(h[f],y)}if(this.stateChanges={},this.deletedStates={},Object.keys(h).length!==0)for(const f in i)i[f].setFeatureState(h,o)}}class Vr extends c.E{constructor(i,o,h){super(),this.id=i,this.dispatcher=h,this.on("data",f=>{f.dataType==="source"&&f.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&f.dataType==="source"&&f.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((f,y,w,S)=>{const k=new(Ar(y.type))(f,y,w,S);if(k.id!==f)throw new Error(`Expected Source id to be ${f} instead of ${k.id}`);return k})(i,o,h,this),this._tiles={},this._cache=new vi(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ce,this._didEmitContent=!1,this._updated=!1}onAdd(i){this.map=i,this._maxTileCacheSize=i?i._maxTileCacheSize:null,this._maxTileCacheZoomLevels=i?i._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(i)}onRemove(i){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(i)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const i in this._tiles){const o=this._tiles[i];if(o.state!=="loaded"&&o.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const i=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,i&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(i,o){return this._source.loadTile(i,o)}_unloadTile(i){if(this._source.unloadTile)return this._source.unloadTile(i,()=>{})}_abortTile(i){this._source.abortTile&&this._source.abortTile(i,()=>{}),this._source.fire(new c.k("dataabort",{tile:i,coord:i.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(i){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const o in this._tiles){const h=this._tiles[o];h.upload(i),h.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(i=>i.tileID).sort(Br).map(i=>i.key)}getRenderableIds(i){const o=[];for(const h in this._tiles)this._isIdRenderable(h,i)&&o.push(this._tiles[h]);return i?o.sort((h,f)=>{const y=h.tileID,w=f.tileID,S=new c.P(y.canonical.x,y.canonical.y)._rotate(this.transform.angle),k=new c.P(w.canonical.x,w.canonical.y)._rotate(this.transform.angle);return y.overscaledZ-w.overscaledZ||k.y-S.y||k.x-S.x}).map(h=>h.tileID.key):o.map(h=>h.tileID).sort(Br).map(h=>h.key)}hasRenderableParent(i){const o=this.findLoadedParent(i,0);return!!o&&this._isIdRenderable(o.tileID.key)}_isIdRenderable(i,o){return this._tiles[i]&&this._tiles[i].hasData()&&!this._coveredTiles[i]&&(o||!this._tiles[i].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)this._tiles[i].state!=="errored"&&this._reloadTile(i,"reloading")}}_reloadTile(i,o){const h=this._tiles[i];h&&(h.state!=="loading"&&(h.state=o),this._loadTile(h,this._tileLoaded.bind(this,h,i,o)))}_tileLoaded(i,o,h,f){if(f)return i.state="errored",void(f.status!==404?this._source.fire(new c.j(f,{tile:i})):this.update(this.transform,this.terrain));i.timeAdded=c.h.now(),h==="expired"&&(i.refreshedUponExpiration=!0),this._setTileReloadTimer(o,i),this.getSource().type==="raster-dem"&&i.dem&&this._backfillDEM(i),this._state.initializeTileState(i,this.map?this.map.painter:null),i.aborted||this._source.fire(new c.k("data",{dataType:"source",tile:i,coord:i.tileID}))}_backfillDEM(i){const o=this.getRenderableIds();for(let f=0;f1||(Math.abs(w)>1&&(Math.abs(w+k)===1?w+=k:Math.abs(w-k)===1&&(w-=k)),y.dem&&f.dem&&(f.dem.backfillBorder(y.dem,w,S),f.neighboringTiles&&f.neighboringTiles[C]&&(f.neighboringTiles[C].backfilled=!0)))}}getTile(i){return this.getTileByID(i.key)}getTileByID(i){return this._tiles[i]}_retainLoadedChildren(i,o,h,f){for(const y in this._tiles){let w=this._tiles[y];if(f[y]||!w.hasData()||w.tileID.overscaledZ<=o||w.tileID.overscaledZ>h)continue;let S=w.tileID;for(;w&&w.tileID.overscaledZ>o+1;){const C=w.tileID.scaledTo(w.tileID.overscaledZ-1);w=this._tiles[C.key],w&&w.hasData()&&(S=C)}let k=S;for(;k.overscaledZ>o;)if(k=k.scaledTo(k.overscaledZ-1),i[k.key]){f[S.key]=S;break}}}findLoadedParent(i,o){if(i.key in this._loadedParentTiles){const h=this._loadedParentTiles[i.key];return h&&h.tileID.overscaledZ>=o?h:null}for(let h=i.overscaledZ-1;h>=o;h--){const f=i.scaledTo(h),y=this._getLoadedTile(f);if(y)return y}}_getLoadedTile(i){const o=this._tiles[i.key];return o&&o.hasData()?o:this._cache.getByKey(i.wrapped().key)}updateCacheSize(i){const o=Math.ceil(i.width/this._source.tileSize)+1,h=Math.ceil(i.height/this._source.tileSize)+1,f=Math.floor(o*h*(this._maxTileCacheZoomLevels===null?c.c.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),y=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,f):f;this._cache.setMaxSize(y)}handleWrapJump(i){const o=Math.round((i-(this._prevLng===void 0?i:this._prevLng))/360);if(this._prevLng=i,o){const h={};for(const f in this._tiles){const y=this._tiles[f];y.tileID=y.tileID.unwrapTo(y.tileID.wrap+o),h[y.tileID.key]=y}this._tiles=h;for(const f in this._timers)clearTimeout(this._timers[f]),delete this._timers[f];for(const f in this._tiles)this._setTileReloadTimer(f,this._tiles[f])}}update(i,o){if(this.transform=i,this.terrain=o,!this._sourceLoaded||this._paused)return;let h;this.updateCacheSize(i),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?h=i.getVisibleUnwrappedCoordinates(this._source.tileID).map(D=>new c.O(D.canonical.z,D.wrap,D.canonical.z,D.canonical.x,D.canonical.y)):(h=i.coveringTiles({tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:o}),this._source.hasTile&&(h=h.filter(D=>this._source.hasTile(D)))):h=[];const f=i.coveringZoomLevel(this._source),y=Math.max(f-Vr.maxOverzooming,this._source.minzoom),w=Math.max(f+Vr.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const D={};for(const P of h)if(P.canonical.z>this._source.minzoom){const N=P.scaledTo(P.canonical.z-1);D[N.key]=N;const H=P.scaledTo(Math.max(this._source.minzoom,Math.min(P.canonical.z,5)));D[H.key]=H}h=h.concat(Object.values(D))}const S=h.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,S&&this.fire(new c.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const k=this._updateRetainedTiles(h,f);if(Xt(this._source.type)){const D={},P={},N=Object.keys(k),H=c.h.now();for(const W of N){const J=k[W],G=this._tiles[W];if(!G||G.fadeEndTime!==0&&G.fadeEndTime<=H)continue;const fe=this.findLoadedParent(J,y);fe&&(this._addTile(fe.tileID),D[fe.tileID.key]=fe.tileID),P[W]=J}this._retainLoadedChildren(P,f,w,k);for(const W in D)k[W]||(this._coveredTiles[W]=!0,k[W]=D[W]);if(o){const W={},J={};for(const G of h)this._tiles[G.key].hasData()?W[G.key]=G:J[G.key]=G;for(const G in J){const fe=J[G].children(this._source.maxzoom);this._tiles[fe[0].key]&&this._tiles[fe[1].key]&&this._tiles[fe[2].key]&&this._tiles[fe[3].key]&&(W[fe[0].key]=k[fe[0].key]=fe[0],W[fe[1].key]=k[fe[1].key]=fe[1],W[fe[2].key]=k[fe[2].key]=fe[2],W[fe[3].key]=k[fe[3].key]=fe[3],delete J[G])}for(const G in J){const fe=this.findLoadedParent(J[G],this._source.minzoom);if(fe){W[fe.tileID.key]=k[fe.tileID.key]=fe.tileID;for(const Se in W)W[Se].isChildOf(fe.tileID)&&delete W[Se]}}for(const G in this._tiles)W[G]||(this._coveredTiles[G]=!0)}}for(const D in k)this._tiles[D].clearFadeHold();const C=c.ab(this._tiles,k);for(const D of C){const P=this._tiles[D];P.hasSymbolBuckets&&!P.holdingForFade()?P.setHoldDuration(this.map._fadeDuration):P.hasSymbolBuckets&&!P.symbolFadeFinished()||this._removeTile(D)}this._updateLoadedParentTileCache()}releaseSymbolFadeTiles(){for(const i in this._tiles)this._tiles[i].holdingForFade()&&this._removeTile(i)}_updateRetainedTiles(i,o){const h={},f={},y=Math.max(o-Vr.maxOverzooming,this._source.minzoom),w=Math.max(o+Vr.maxUnderzooming,this._source.minzoom),S={};for(const k of i){const C=this._addTile(k);h[k.key]=k,C.hasData()||othis._source.maxzoom){const P=k.children(this._source.maxzoom)[0],N=this.getTile(P);if(N&&N.hasData()){h[P.key]=P;continue}}else{const P=k.children(this._source.maxzoom);if(h[P[0].key]&&h[P[1].key]&&h[P[2].key]&&h[P[3].key])continue}let D=C.wasRequested();for(let P=k.overscaledZ-1;P>=y;--P){const N=k.scaledTo(P);if(f[N.key])break;if(f[N.key]=!0,C=this.getTile(N),!C&&D&&(C=this._addTile(N)),C){const H=C.hasData();if((D||H)&&(h[N.key]=N),D=C.wasRequested(),H)break}}}return h}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const i in this._tiles){const o=[];let h,f=this._tiles[i].tileID;for(;f.overscaledZ>0;){if(f.key in this._loadedParentTiles){h=this._loadedParentTiles[f.key];break}o.push(f.key);const y=f.scaledTo(f.overscaledZ-1);if(h=this._getLoadedTile(y),h)break;f=y}for(const y of o)this._loadedParentTiles[y]=h}}_addTile(i){let o=this._tiles[i.key];if(o)return o;o=this._cache.getAndRemove(i),o&&(this._setTileReloadTimer(i.key,o),o.tileID=i,this._state.initializeTileState(o,this.map?this.map.painter:null),this._cacheTimers[i.key]&&(clearTimeout(this._cacheTimers[i.key]),delete this._cacheTimers[i.key],this._setTileReloadTimer(i.key,o)));const h=o;return o||(o=new Mn(i,this._source.tileSize*i.overscaleFactor()),this._loadTile(o,this._tileLoaded.bind(this,o,i.key,o.state))),o.uses++,this._tiles[i.key]=o,h||this._source.fire(new c.k("dataloading",{tile:o,coord:o.tileID,dataType:"source"})),o}_setTileReloadTimer(i,o){i in this._timers&&(clearTimeout(this._timers[i]),delete this._timers[i]);const h=o.getExpiryTimeout();h&&(this._timers[i]=setTimeout(()=>{this._reloadTile(i,"expired"),delete this._timers[i]},h))}_removeTile(i){const o=this._tiles[i];o&&(o.uses--,delete this._tiles[i],this._timers[i]&&(clearTimeout(this._timers[i]),delete this._timers[i]),o.uses>0||(o.hasData()&&o.state!=="reloading"?this._cache.add(o.tileID,o,o.getExpiryTimeout()):(o.aborted=!0,this._abortTile(o),this._unloadTile(o))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const i in this._tiles)this._removeTile(i);this._cache.reset()}tilesIn(i,o,h){const f=[],y=this.transform;if(!y)return f;const w=h?y.getCameraQueryGeometry(i):i,S=i.map(W=>y.pointCoordinate(W,this.terrain)),k=w.map(W=>y.pointCoordinate(W,this.terrain)),C=this.getIds();let D=1/0,P=1/0,N=-1/0,H=-1/0;for(const W of k)D=Math.min(D,W.x),P=Math.min(P,W.y),N=Math.max(N,W.x),H=Math.max(H,W.y);for(let W=0;W=0&&re[1].y+Se>=0){const me=S.map(Ee=>G.getTilePoint(Ee)),Ae=k.map(Ee=>G.getTilePoint(Ee));f.push({tile:J,tileID:G,queryGeometry:me,cameraQueryGeometry:Ae,scale:fe})}}return f}getVisibleCoordinates(i){const o=this.getRenderableIds(i).map(h=>this._tiles[h].tileID);for(const h of o)h.posMatrix=this.transform.calculatePosMatrix(h.toUnwrapped());return o}hasTransition(){if(this._source.hasTransition())return!0;if(Xt(this._source.type)){const i=c.h.now();for(const o in this._tiles)if(this._tiles[o].fadeEndTime>=i)return!0}return!1}setFeatureState(i,o,h){this._state.updateState(i=i||"_geojsonTileLayer",o,h)}removeFeatureState(i,o,h){this._state.removeFeatureState(i=i||"_geojsonTileLayer",o,h)}getFeatureState(i,o){return this._state.getState(i=i||"_geojsonTileLayer",o)}setDependencies(i,o,h){const f=this._tiles[i];f&&f.setDependencies(o,h)}reloadTilesForDependencies(i,o){for(const h in this._tiles)this._tiles[h].hasDependency(i,o)&&this._reloadTile(h,"reloading");this._cache.filter(h=>!h.hasDependency(i,o))}}function Br(m,i){const o=Math.abs(2*m.wrap)-+(m.wrap<0),h=Math.abs(2*i.wrap)-+(i.wrap<0);return m.overscaledZ-i.overscaledZ||h-o||i.canonical.y-m.canonical.y||i.canonical.x-m.canonical.x}function Xt(m){return m==="raster"||m==="image"||m==="video"}Vr.maxOverzooming=10,Vr.maxUnderzooming=3;const ir="mapboxgl_preloaded_worker_pool";class bi{constructor(){this.active={}}acquire(i){if(!this.workers)for(this.workers=[];this.workers.length{o.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[ir]}numActive(){return Object.keys(this.active).length}}const fn=Math.floor(c.h.hardwareConcurrency/2);let zi;function un(){return zi||(zi=new bi),zi}bi.workerCount=c.ac(globalThis)?Math.max(Math.min(fn,3),1):1;class Ji{constructor(i,o){this.reset(i,o)}reset(i,o){this.points=i||[],this._distances=[0];for(let h=1;h0?(f-w)/S:0;return this.points[y].mult(1-k).add(this.points[o].mult(k))}}function fi(m,i){let o=!0;return m==="always"||m!=="never"&&i!=="never"||(o=!1),o}class hn{constructor(i,o,h){const f=this.boxCells=[],y=this.circleCells=[];this.xCellCount=Math.ceil(i/h),this.yCellCount=Math.ceil(o/h);for(let w=0;wthis.width||f<0||o>this.height)return[];const k=[];if(i<=0&&o<=0&&this.width<=h&&this.height<=f){if(y)return[{key:null,x1:i,y1:o,x2:h,y2:f}];for(let C=0;C0}hitTestCircle(i,o,h,f,y){const w=i-h,S=i+h,k=o-h,C=o+h;if(S<0||w>this.width||C<0||k>this.height)return!1;const D=[];return this._forEachCell(w,k,S,C,this._queryCellCircle,D,{hitTest:!0,overlapMode:f,circle:{x:i,y:o,radius:h},seenUids:{box:{},circle:{}}},y),D.length>0}_queryCell(i,o,h,f,y,w,S,k){const{seenUids:C,hitTest:D,overlapMode:P}=S,N=this.boxCells[y];if(N!==null){const W=this.bboxes;for(const J of N)if(!C.box[J]){C.box[J]=!0;const G=4*J,fe=this.boxKeys[J];if(i<=W[G+2]&&o<=W[G+3]&&h>=W[G+0]&&f>=W[G+1]&&(!k||k(fe))&&(!D||!fi(P,fe.overlapMode))&&(w.push({key:fe,x1:W[G],y1:W[G+1],x2:W[G+2],y2:W[G+3]}),D))return!0}}const H=this.circleCells[y];if(H!==null){const W=this.circles;for(const J of H)if(!C.circle[J]){C.circle[J]=!0;const G=3*J,fe=this.circleKeys[J];if(this._circleAndRectCollide(W[G],W[G+1],W[G+2],i,o,h,f)&&(!k||k(fe))&&(!D||!fi(P,fe.overlapMode))){const Se=W[G],re=W[G+1],me=W[G+2];if(w.push({key:fe,x1:Se-me,y1:re-me,x2:Se+me,y2:re+me}),D)return!0}}}return!1}_queryCellCircle(i,o,h,f,y,w,S,k){const{circle:C,seenUids:D,overlapMode:P}=S,N=this.boxCells[y];if(N!==null){const W=this.bboxes;for(const J of N)if(!D.box[J]){D.box[J]=!0;const G=4*J,fe=this.boxKeys[J];if(this._circleAndRectCollide(C.x,C.y,C.radius,W[G+0],W[G+1],W[G+2],W[G+3])&&(!k||k(fe))&&!fi(P,fe.overlapMode))return w.push(!0),!0}}const H=this.circleCells[y];if(H!==null){const W=this.circles;for(const J of H)if(!D.circle[J]){D.circle[J]=!0;const G=3*J,fe=this.circleKeys[J];if(this._circlesCollide(W[G],W[G+1],W[G+2],C.x,C.y,C.radius)&&(!k||k(fe))&&!fi(P,fe.overlapMode))return w.push(!0),!0}}}_forEachCell(i,o,h,f,y,w,S,k){const C=this._convertToXCellCoord(i),D=this._convertToYCellCoord(o),P=this._convertToXCellCoord(h),N=this._convertToYCellCoord(f);for(let H=C;H<=P;H++)for(let W=D;W<=N;W++)if(y.call(this,i,o,h,f,this.xCellCount*W+H,w,S,k))return}_convertToXCellCoord(i){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(i*this.xScale)))}_convertToYCellCoord(i){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(i*this.yScale)))}_circlesCollide(i,o,h,f,y,w){const S=f-i,k=y-o,C=h+w;return C*C>S*S+k*k}_circleAndRectCollide(i,o,h,f,y,w,S){const k=(w-f)/2,C=Math.abs(i-(f+k));if(C>k+h)return!1;const D=(S-y)/2,P=Math.abs(o-(y+D));if(P>D+h)return!1;if(C<=k||P<=D)return!0;const N=C-k,H=P-D;return N*N+H*H<=h*h}}function qe(m,i,o,h,f){const y=c.Z();return i?(c.a0(y,y,[1/f,1/f,1]),o||c.ae(y,y,h.angle)):c.a1(y,h.labelPlaneMatrix,m),y}function dn(m,i,o,h,f){if(i){const y=c.af(m);return c.a0(y,y,[f,f,1]),o||c.ae(y,y,-h.angle),y}return h.glCoordMatrix}function ar(m,i,o){let h;o?(h=[m.x,m.y,o(m.x,m.y),1],c.ag(h,h,i)):(h=[m.x,m.y,0,1],X(h,h,i));const f=h[3];return{point:new c.P(h[0]/f,h[1]/f),signedDistanceFromCamera:f}}function Bi(m,i){return .5+m/i*.5}function Ri(m,i){const o=m[0]/m[3],h=m[1]/m[3];return o>=-i[0]&&o<=i[0]&&h>=-i[1]&&h<=i[1]}function We(m,i,o,h,f,y,w,S,k,C){const D=h?m.textSizeData:m.iconSizeData,P=c.ah(D,o.transform.zoom),N=[256/o.width*2+1,256/o.height*2+1],H=h?m.text.dynamicLayoutVertexArray:m.icon.dynamicLayoutVertexArray;H.clear();const W=m.lineVertexArray,J=h?m.text.placedSymbolArray:m.icon.placedSymbolArray,G=o.transform.width/o.transform.height;let fe=!1;for(let Se=0;SeMath.abs(o.x-i.x)*h?{useVertical:!0}:(m===c.ai.vertical?i.yo.x)?{needsFlipping:!0}:null}function Hr(m,i,o,h,f,y,w,S,k,C,D,P,N,H,W,J){const G=i/24,fe=m.lineOffsetX*G,Se=m.lineOffsetY*G;let re;if(m.numGlyphs>1){const me=m.glyphStartIndex+m.numGlyphs,Ae=m.lineStartIndex,Ee=m.lineStartIndex+m.lineLength,Re=jt(G,S,fe,Se,o,D,P,m,k,y,N,W,J);if(!Re)return{notEnoughRoom:!0};const Ke=ar(Re.first.point,w,J).point,Ue=ar(Re.last.point,w,J).point;if(h&&!o){const et=xt(m.writingMode,Ke,Ue,H);if(et)return et}re=[Re.first];for(let et=m.glyphStartIndex+1;et0?Ke.point:ii(P,Re,Ae,1,f,J),et=xt(m.writingMode,Ae,Ue,H);if(et)return et}const me=R(G*S.getoffsetX(m.glyphStartIndex),fe,Se,o,D,P,m.segment,m.lineStartIndex,m.lineStartIndex+m.lineLength,k,y,N,W,J);if(!me)return{notEnoughRoom:!0};re=[me]}for(const me of re)c.ak(C,me.point,me.angle);return{}}function ii(m,i,o,h,f,y){const w=ar(m.add(m.sub(i)._unit()),f,y).point,S=o.sub(w);return o.add(S._mult(h/S.mag()))}function qt(m,i){const{projectionCache:o,lineVertexArray:h,labelPlaneMatrix:f,tileAnchorPoint:y,distanceFromAnchor:w,getElevation:S,previousVertex:k,direction:C,absOffsetX:D}=i;if(o.projections[m])return o.projections[m];const P=new c.P(h.getx(m),h.gety(m)),N=ar(P,f,S);if(N.signedDistanceFromCamera>0)return o.projections[m]=N.point,N.point;const H=m-C;return ii(w===0?y:new c.P(h.getx(H),h.gety(H)),P,k,D-w+1,f,S)}function On(m,i,o){return m._unit()._perp()._mult(i*o)}function K(m,i,o,h,f,y,w,S){const{projectionCache:k,direction:C}=S;if(k.offsets[m])return k.offsets[m];const D=o.add(i);if(m+C=f)return k.offsets[m]=D,D;const P=qt(m+C,S),N=On(P.sub(o),w,C),H=o.add(N),W=P.add(N);return k.offsets[m]=c.al(y,D,H,W)||D,k.offsets[m]}function R(m,i,o,h,f,y,w,S,k,C,D,P,N,H){const W=h?m-i:m+i;let J=W>0?1:-1,G=0;h&&(J*=-1,G=Math.PI),J<0&&(G+=Math.PI);let fe,Se,re=J>0?S+w:S+w+1,me=f,Ae=f,Ee=0,Re=0;const Ke=Math.abs(W),Ue=[];let et;for(;Ee+Re<=Ke;){if(re+=J,re=k)return null;Ee+=Re,Ae=me,Se=fe;const st={projectionCache:P,lineVertexArray:C,labelPlaneMatrix:D,tileAnchorPoint:y,distanceFromAnchor:Ee,getElevation:H,previousVertex:Ae,direction:J,absOffsetX:Ke};if(me=qt(re,st),o===0)Ue.push(Ae),et=me.sub(Ae);else{let $t;const Et=me.sub(Ae);$t=Et.mag()===0?On(qt(re+J,st).sub(me),o,J):On(Et,o,J),Se||(Se=Ae.add($t)),fe=K(re,$t,me,S,k,Se,o,st),Ue.push(Se),et=fe.sub(Se)}Re=et.mag()}const Tt=et._mult((Ke-Ee)/Re)._add(Se||Ae),_r=G+Math.atan2(me.y-Ae.y,me.x-Ae.x);return Ue.push(Tt),{point:Tt,angle:N?_r:0,path:Ue}}const O=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function q(m,i){for(let o=0;o=1;or--)Et.push(st.path[or]);for(let or=1;or<$t.path.length;or++)Et.push($t.path[or]);const Gr=2.5*Ue;if(k){const or=Et.map(vr=>ar(vr,k,W));Et=or.some(vr=>vr.signedDistanceFromCamera<=0)?[]:or.map(vr=>vr.point)}let gr=[];if(Et.length>0){const or=Et[0].clone(),vr=Et[0].clone();for(let Fi=1;Fi=et.x&&vr.x<=Tt.x&&or.y>=et.y&&vr.y<=Tt.y?[Et]:vr.xTt.x||vr.yTt.y?[]:c.am([Et],et.x,et.y,Tt.x,Tt.y)}for(const or of gr){_r.reset(or,.25*Ue);let vr=0;vr=_r.length<=.5*Ue?1:Math.ceil(_r.paddedLength/Gr)+1;for(let Fi=0;Fi=this.screenRightBoundary||fthis.screenBottomBoundary}isInsideGrid(i,o,h,f){return h>=0&&i=0&&oh.collisionGroupID===o}}return this.collisionGroups[i]}}function Gt(m,i,o,h,f){const{horizontalAlign:y,verticalAlign:w}=c.au(m);return new c.P(-(y-.5)*i+h[0]*f,-(w-.5)*o+h[1]*f)}function It(m,i,o,h,f,y){const{x1:w,x2:S,y1:k,y2:C,anchorPointX:D,anchorPointY:P}=m,N=new c.P(i,o);return h&&N._rotate(f?y:-y),{x1:w+N.x,y1:k+N.y,x2:S+N.x,y2:C+N.y,anchorPointX:D,anchorPointY:P}}class Ft{constructor(i,o,h,f,y){this.transform=i.clone(),this.terrain=o,this.collisionIndex=new ve(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=h,this.retainedQueryData={},this.collisionGroups=new zt(f),this.collisionCircleArrays={},this.prevPlacement=y,y&&(y.prevPlacement=void 0),this.placedOrientations={}}getBucketParts(i,o,h,f){const y=h.getBucket(o),w=h.latestFeatureIndex;if(!y||!w||o.id!==y.layerIds[0])return;const S=h.collisionBoxArray,k=y.layers[0].layout,C=Math.pow(2,this.transform.zoom-h.tileID.overscaledZ),D=h.tileSize/c.N,P=this.transform.calculatePosMatrix(h.tileID.toUnwrapped()),N=k.get("text-pitch-alignment")==="map",H=k.get("text-rotation-alignment")==="map",W=he(h,1,this.transform.zoom),J=qe(P,N,H,this.transform,W);let G=null;if(N){const Se=dn(P,N,H,this.transform,W);G=c.a1([],this.transform.labelPlaneMatrix,Se)}this.retainedQueryData[y.bucketInstanceId]=new Oe(y.bucketInstanceId,w,y.sourceLayerIndex,y.index,h.tileID);const fe={bucket:y,layout:k,posMatrix:P,textLabelPlaneMatrix:J,labelToScreenMatrix:G,scale:C,textPixelRatio:D,holdingForFade:h.holdingForFade(),collisionBoxArray:S,partiallyEvaluatedTextSize:c.ah(y.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(y.sourceID)};if(f)for(const Se of y.sortKeyRanges){const{sortKey:re,symbolInstanceStart:me,symbolInstanceEnd:Ae}=Se;i.push({sortKey:re,symbolInstanceStart:me,symbolInstanceEnd:Ae,parameters:fe})}else i.push({symbolInstanceStart:0,symbolInstanceEnd:y.symbolInstances.length,parameters:fe})}attemptAnchorPlacement(i,o,h,f,y,w,S,k,C,D,P,N,H,W,J,G){const fe=c.aq[i.textAnchor],Se=[i.textOffset0,i.textOffset1],re=Gt(fe,h,f,Se,y),me=this.collisionIndex.placeCollisionBox(It(o,re.x,re.y,w,S,this.transform.angle),P,k,C,D.predicate,G);if((!J||this.collisionIndex.placeCollisionBox(It(J,re.x,re.y,w,S,this.transform.angle),P,k,C,D.predicate,G).box.length!==0)&&me.box.length>0){let Ae;if(this.prevPlacement&&this.prevPlacement.variableOffsets[N.crossTileID]&&this.prevPlacement.placements[N.crossTileID]&&this.prevPlacement.placements[N.crossTileID].text&&(Ae=this.prevPlacement.variableOffsets[N.crossTileID].anchor),N.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[N.crossTileID]={textOffset:Se,width:h,height:f,anchor:fe,textBoxScale:y,prevAnchor:Ae},this.markUsedJustification(H,fe,N,W),H.allowVerticalPlacement&&(this.markUsedOrientation(H,W,N),this.placedOrientations[N.crossTileID]=W),{shift:re,placedGlyphBoxes:me}}}placeLayerBucketPart(i,o,h){const{bucket:f,layout:y,posMatrix:w,textLabelPlaneMatrix:S,labelToScreenMatrix:k,textPixelRatio:C,holdingForFade:D,collisionBoxArray:P,partiallyEvaluatedTextSize:N,collisionGroup:H}=i.parameters,W=y.get("text-optional"),J=y.get("icon-optional"),G=c.ar(y,"text-overlap","text-allow-overlap"),fe=G==="always",Se=c.ar(y,"icon-overlap","icon-allow-overlap"),re=Se==="always",me=y.get("text-rotation-alignment")==="map",Ae=y.get("text-pitch-alignment")==="map",Ee=y.get("icon-text-fit")!=="none",Re=y.get("symbol-z-order")==="viewport-y",Ke=fe&&(re||!f.hasIconData()||J),Ue=re&&(fe||!f.hasTextData()||W);!f.collisionArrays&&P&&f.deserializeCollisionBoxes(P);const et=this.retainedQueryData[f.bucketInstanceId].tileID,Tt=this.terrain?(st,$t)=>this.terrain.getElevation(et,st,$t):null,_r=(st,$t)=>{var Et,Gr;if(o[st.crossTileID])return;if(D)return void(this.placements[st.crossTileID]=new Le(!1,!1,!1));let gr=!1,or=!1,vr=!0,Fi=null,si={box:null,offscreen:null},gn={box:null,offscreen:null},Qi=null,ji=null,rs=null,hi=0,Ns=0,Us=0;$t.textFeatureIndex?hi=$t.textFeatureIndex:st.useRuntimeCollisionCircles&&(hi=st.featureIndex),$t.verticalTextFeatureIndex&&(Ns=$t.verticalTextFeatureIndex);const Ta=$t.textBox;if(Ta){const In=Oi=>{let en=c.ai.horizontal;if(f.allowVerticalPlacement&&!Oi&&this.prevPlacement){const $n=this.prevPlacement.placedOrientations[st.crossTileID];$n&&(this.placedOrientations[st.crossTileID]=$n,en=$n,this.markUsedOrientation(f,en,st))}return en},yn=(Oi,en)=>{if(f.allowVerticalPlacement&&st.numVerticalGlyphVertices>0&&$t.verticalTextBox){for(const $n of f.writingModes)if($n===c.ai.vertical?(si=en(),gn=si):si=Oi(),si&&si.box&&si.box.length)break}else si=Oi()},Pn=st.textAnchorOffsetStartIndex,eo=st.textAnchorOffsetEndIndex;if(eo===Pn){const Oi=(en,$n)=>{const Ni=this.collisionIndex.placeCollisionBox(en,G,C,w,H.predicate,Tt);return Ni&&Ni.box&&Ni.box.length&&(this.markUsedOrientation(f,$n,st),this.placedOrientations[st.crossTileID]=$n),Ni};yn(()=>Oi(Ta,c.ai.horizontal),()=>{const en=$t.verticalTextBox;return f.allowVerticalPlacement&&st.numVerticalGlyphVertices>0&&en?Oi(en,c.ai.vertical):{box:null,offscreen:null}}),In(si&&si.box&&si.box.length)}else{let Oi=c.aq[(Gr=(Et=this.prevPlacement)===null||Et===void 0?void 0:Et.variableOffsets[st.crossTileID])===null||Gr===void 0?void 0:Gr.anchor];const en=(Ni,to,vc)=>{const Hd=Ni.x2-Ni.x1,Yd=Ni.y2-Ni.y1,Im=st.textBoxScale,eh=Ee&&Se==="never"?to:null;let $s={box:[],offscreen:!1},ro=G==="never"?1:2,Vs="never";Oi&&ro++;for(let vs=0;vsen(Ta,$t.iconBox,c.ai.horizontal),()=>{const Ni=$t.verticalTextBox;return f.allowVerticalPlacement&&!(si&&si.box&&si.box.length)&&st.numVerticalGlyphVertices>0&&Ni?en(Ni,$t.verticalIconBox,c.ai.vertical):{box:null,offscreen:null}}),si&&(gr=si.box,vr=si.offscreen);const $n=In(si&&si.box);if(!gr&&this.prevPlacement){const Ni=this.prevPlacement.variableOffsets[st.crossTileID];Ni&&(this.variableOffsets[st.crossTileID]=Ni,this.markUsedJustification(f,Ni.anchor,st,$n))}}}if(Qi=si,gr=Qi&&Qi.box&&Qi.box.length>0,vr=Qi&&Qi.offscreen,st.useRuntimeCollisionCircles){const In=f.text.placedSymbolArray.get(st.centerJustifiedTextSymbolIndex),yn=c.aj(f.textSizeData,N,In),Pn=y.get("text-padding");ji=this.collisionIndex.placeCollisionCircles(G,In,f.lineVertexArray,f.glyphOffsetArray,yn,w,S,k,h,Ae,H.predicate,st.collisionCircleDiameter,Pn,Tt),ji.circles.length&&ji.collisionDetected&&!h&&c.w("Collisions detected, but collision boxes are not shown"),gr=fe||ji.circles.length>0&&!ji.collisionDetected,vr=vr&&ji.offscreen}if($t.iconFeatureIndex&&(Us=$t.iconFeatureIndex),$t.iconBox){const In=yn=>{const Pn=Ee&&Fi?It(yn,Fi.x,Fi.y,me,Ae,this.transform.angle):yn;return this.collisionIndex.placeCollisionBox(Pn,Se,C,w,H.predicate,Tt)};gn&&gn.box&&gn.box.length&&$t.verticalIconBox?(rs=In($t.verticalIconBox),or=rs.box.length>0):(rs=In($t.iconBox),or=rs.box.length>0),vr=vr&&rs.offscreen}const Qa=W||st.numHorizontalGlyphVertices===0&&st.numVerticalGlyphVertices===0,zo=J||st.numIconVertices===0;if(Qa||zo?zo?Qa||(or=or&&gr):gr=or&&gr:or=gr=or&&gr,gr&&Qi&&Qi.box&&this.collisionIndex.insertCollisionBox(Qi.box,G,y.get("text-ignore-placement"),f.bucketInstanceId,gn&&gn.box&&Ns?Ns:hi,H.ID),or&&rs&&this.collisionIndex.insertCollisionBox(rs.box,Se,y.get("icon-ignore-placement"),f.bucketInstanceId,Us,H.ID),ji&&(gr&&this.collisionIndex.insertCollisionCircles(ji.circles,G,y.get("text-ignore-placement"),f.bucketInstanceId,hi,H.ID),h)){const In=f.bucketInstanceId;let yn=this.collisionCircleArrays[In];yn===void 0&&(yn=this.collisionCircleArrays[In]=new Be);for(let Pn=0;Pn=0;--$t){const Et=st[$t];_r(f.symbolInstances.get(Et),f.collisionArrays[Et])}}else for(let st=i.symbolInstanceStart;st=0&&(i.text.placedSymbolArray.get(S).crossTileID=y>=0&&S!==y?0:h.crossTileID)}markUsedOrientation(i,o,h){const f=o===c.ai.horizontal||o===c.ai.horizontalOnly?o:0,y=o===c.ai.vertical?o:0,w=[h.leftJustifiedTextSymbolIndex,h.centerJustifiedTextSymbolIndex,h.rightJustifiedTextSymbolIndex];for(const S of w)i.text.placedSymbolArray.get(S).placedOrientation=f;h.verticalPlacedTextSymbolIndex&&(i.text.placedSymbolArray.get(h.verticalPlacedTextSymbolIndex).placedOrientation=y)}commit(i){this.commitTime=i,this.zoomAtLastRecencyCheck=this.transform.zoom;const o=this.prevPlacement;let h=!1;this.prevZoomAdjustment=o?o.zoomAdjustment(this.transform.zoom):0;const f=o?o.symbolFadeChange(i):1,y=o?o.opacities:{},w=o?o.variableOffsets:{},S=o?o.placedOrientations:{};for(const k in this.placements){const C=this.placements[k],D=y[k];D?(this.opacities[k]=new ge(D,f,C.text,C.icon),h=h||C.text!==D.text.placed||C.icon!==D.icon.placed):(this.opacities[k]=new ge(null,f,C.text,C.icon,C.skipFade),h=h||C.text||C.icon)}for(const k in y){const C=y[k];if(!this.opacities[k]){const D=new ge(C,f,!1,!1);D.isHidden()||(this.opacities[k]=D,h=h||C.text.placed||C.icon.placed)}}for(const k in w)this.variableOffsets[k]||!this.opacities[k]||this.opacities[k].isHidden()||(this.variableOffsets[k]=w[k]);for(const k in S)this.placedOrientations[k]||!this.opacities[k]||this.opacities[k].isHidden()||(this.placedOrientations[k]=S[k]);if(o&&o.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");h?this.lastPlacementChangeTime=i:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=o?o.lastPlacementChangeTime:i)}updateLayerOpacities(i,o){const h={};for(const f of o){const y=f.getBucket(i);y&&f.latestFeatureIndex&&i.id===y.layerIds[0]&&this.updateBucketOpacities(y,h,f.collisionBoxArray)}}updateBucketOpacities(i,o,h){i.hasTextData()&&(i.text.opacityVertexArray.clear(),i.text.hasVisibleVertices=!1),i.hasIconData()&&(i.icon.opacityVertexArray.clear(),i.icon.hasVisibleVertices=!1),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexArray.clear(),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexArray.clear();const f=i.layers[0],y=f.layout,w=new ge(null,0,!1,!1,!0),S=y.get("text-allow-overlap"),k=y.get("icon-allow-overlap"),C=f._unevaluatedLayout.hasValue("text-variable-anchor")||f._unevaluatedLayout.hasValue("text-variable-anchor-offset"),D=y.get("text-rotation-alignment")==="map",P=y.get("text-pitch-alignment")==="map",N=y.get("icon-text-fit")!=="none",H=new ge(null,0,S&&(k||!i.hasIconData()||y.get("icon-optional")),k&&(S||!i.hasTextData()||y.get("text-optional")),!0);!i.collisionArrays&&h&&(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData())&&i.deserializeCollisionBoxes(h);const W=(J,G,fe)=>{for(let Se=0;Se0,Ee=this.placedOrientations[G.crossTileID],Re=Ee===c.ai.vertical,Ke=Ee===c.ai.horizontal||Ee===c.ai.horizontalOnly;if(fe>0||Se>0){const Ue=pn(me.text);W(i.text,fe,Re?fs:Ue),W(i.text,Se,Ke?fs:Ue);const et=me.text.isHidden();[G.rightJustifiedTextSymbolIndex,G.centerJustifiedTextSymbolIndex,G.leftJustifiedTextSymbolIndex].forEach(st=>{st>=0&&(i.text.placedSymbolArray.get(st).hidden=et||Re?1:0)}),G.verticalPlacedTextSymbolIndex>=0&&(i.text.placedSymbolArray.get(G.verticalPlacedTextSymbolIndex).hidden=et||Ke?1:0);const Tt=this.variableOffsets[G.crossTileID];Tt&&this.markUsedJustification(i,Tt.anchor,G,Ee);const _r=this.placedOrientations[G.crossTileID];_r&&(this.markUsedJustification(i,"left",G,_r),this.markUsedOrientation(i,_r,G))}if(Ae){const Ue=pn(me.icon),et=!(N&&G.verticalPlacedIconSymbolIndex&&Re);G.placedIconSymbolIndex>=0&&(W(i.icon,G.numIconVertices,et?Ue:fs),i.icon.placedSymbolArray.get(G.placedIconSymbolIndex).hidden=me.icon.isHidden()),G.verticalPlacedIconSymbolIndex>=0&&(W(i.icon,G.numVerticalIconVertices,et?fs:Ue),i.icon.placedSymbolArray.get(G.verticalPlacedIconSymbolIndex).hidden=me.icon.isHidden())}if(i.hasIconCollisionBoxData()||i.hasTextCollisionBoxData()){const Ue=i.collisionArrays[J];if(Ue){let et=new c.P(0,0);if(Ue.textBox||Ue.verticalTextBox){let _r=!0;if(C){const st=this.variableOffsets[re];st?(et=Gt(st.anchor,st.width,st.height,st.textOffset,st.textBoxScale),D&&et._rotate(P?this.transform.angle:-this.transform.angle)):_r=!1}Ue.textBox&&Zt(i.textCollisionBox.collisionVertexArray,me.text.placed,!_r||Re,et.x,et.y),Ue.verticalTextBox&&Zt(i.textCollisionBox.collisionVertexArray,me.text.placed,!_r||Ke,et.x,et.y)}const Tt=!!(!Ke&&Ue.verticalIconBox);Ue.iconBox&&Zt(i.iconCollisionBox.collisionVertexArray,me.icon.placed,Tt,N?et.x:0,N?et.y:0),Ue.verticalIconBox&&Zt(i.iconCollisionBox.collisionVertexArray,me.icon.placed,!Tt,N?et.x:0,N?et.y:0)}}}if(i.sortFeatures(this.transform.angle),this.retainedQueryData[i.bucketInstanceId]&&(this.retainedQueryData[i.bucketInstanceId].featureSortOrder=i.featureSortOrder),i.hasTextData()&&i.text.opacityVertexBuffer&&i.text.opacityVertexBuffer.updateData(i.text.opacityVertexArray),i.hasIconData()&&i.icon.opacityVertexBuffer&&i.icon.opacityVertexBuffer.updateData(i.icon.opacityVertexArray),i.hasIconCollisionBoxData()&&i.iconCollisionBox.collisionVertexBuffer&&i.iconCollisionBox.collisionVertexBuffer.updateData(i.iconCollisionBox.collisionVertexArray),i.hasTextCollisionBoxData()&&i.textCollisionBox.collisionVertexBuffer&&i.textCollisionBox.collisionVertexBuffer.updateData(i.textCollisionBox.collisionVertexArray),i.text.opacityVertexArray.length!==i.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${i.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${i.text.layoutVertexArray.length}) / 4`);if(i.icon.opacityVertexArray.length!==i.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${i.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${i.icon.layoutVertexArray.length}) / 4`);if(i.bucketInstanceId in this.collisionCircleArrays){const J=this.collisionCircleArrays[i.bucketInstanceId];i.placementInvProjMatrix=J.invProjMatrix,i.placementViewportMatrix=J.viewportMatrix,i.collisionCircleArray=J.circles,delete this.collisionCircleArrays[i.bucketInstanceId]}}symbolFadeChange(i){return this.fadeDuration===0?1:(i-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(i){return Math.max(0,(this.transform.zoom-i)/1.5)}hasTransitions(i){return this.stale||i-this.lastPlacementChangeTimei}setStale(){this.stale=!0}}function Zt(m,i,o,h,f){m.emplaceBack(i?1:0,o?1:0,h||0,f||0),m.emplaceBack(i?1:0,o?1:0,h||0,f||0),m.emplaceBack(i?1:0,o?1:0,h||0,f||0),m.emplaceBack(i?1:0,o?1:0,h||0,f||0)}const Ur=Math.pow(2,25),Yr=Math.pow(2,24),Mr=Math.pow(2,17),Er=Math.pow(2,16),wn=Math.pow(2,9),ni=Math.pow(2,8),Yi=Math.pow(2,1);function pn(m){if(m.opacity===0&&!m.placed)return 0;if(m.opacity===1&&m.placed)return 4294967295;const i=m.placed?1:0,o=Math.floor(127*m.opacity);return o*Ur+i*Yr+o*Mr+i*Er+o*wn+i*ni+o*Yi+i}const fs=0;class ud{constructor(i){this._sortAcrossTiles=i.layout.get("symbol-z-order")!=="viewport-y"&&!i.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(i,o,h,f,y){const w=this._bucketParts;for(;this._currentTileIndexS.sortKey-k.sortKey));this._currentPartIndex!this._forceFullPlacement&&c.h.now()-f>2;for(;this._currentPlacementIndex>=0;){const w=o[i[this._currentPlacementIndex]],S=this.placement.collisionIndex.transform.zoom;if(w.type==="symbol"&&(!w.minzoom||w.minzoom<=S)&&(!w.maxzoom||w.maxzoom>S)){if(this._inProgressLayer||(this._inProgressLayer=new ud(w)),this._inProgressLayer.continuePlacement(h[w.source],this.placement,this._showCollisionBoxes,w,y))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(i){return this.placement.commit(i),this.placement}}const wo=512/c.N/2;class om{constructor(i,o,h){this.tileID=i,this.bucketInstanceId=h,this._symbolsByKey={};const f=new Map;for(let y=0;y({x:Math.floor(k.anchorX*wo),y:Math.floor(k.anchorY*wo)})),crossTileIDs:w.map(k=>k.crossTileID)};if(S.positions.length>128){const k=new c.av(S.positions.length,16,Uint16Array);for(const{x:C,y:D}of S.positions)k.add(C,D);k.finish(),delete S.positions,S.index=k}this._symbolsByKey[y]=S}}getScaledCoordinates(i,o){const{x:h,y:f,z:y}=this.tileID.canonical,{x:w,y:S,z:k}=o.canonical,C=wo/Math.pow(2,k-y),D=(S*c.N+i.anchorY)*C,P=f*c.N*wo;return{x:Math.floor((w*c.N+i.anchorX)*C-h*c.N*wo),y:Math.floor(D-P)}}findMatches(i,o,h){const f=this.tileID.canonical.zi)}}class qr{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class fu{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(i){const o=Math.round((i-this.lng)/360);if(o!==0)for(const h in this.indexes){const f=this.indexes[h],y={};for(const w in f){const S=f[w];S.tileID=S.tileID.unwrapTo(S.tileID.wrap+o),y[S.tileID.key]=S}this.indexes[h]=y}this.lng=i}addBucket(i,o,h){if(this.indexes[i.overscaledZ]&&this.indexes[i.overscaledZ][i.key]){if(this.indexes[i.overscaledZ][i.key].bucketInstanceId===o.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(i.overscaledZ,this.indexes[i.overscaledZ][i.key])}for(let y=0;yi.overscaledZ)for(const S in w){const k=w[S];k.tileID.isChildOf(i)&&k.findMatches(o.symbolInstances,i,f)}else{const S=w[i.scaledTo(Number(y)).key];S&&S.findMatches(o.symbolInstances,i,f)}}for(let y=0;y{o[h]=!0});for(const h in this.layerIndexes)o[h]||delete this.layerIndexes[h]}}const Sn=(m,i)=>c.x(m,i&&i.filter(o=>o.identifier!=="source.canvas")),Xn=c.F(c.ax,["addLayer","removeLayer","setPaintProperty","setLayoutProperty","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setGlyphs","setSprite"]),lm=c.F(c.ax,["setCenter","setZoom","setBearing","setPitch"]),ps=c.aw();class mn extends c.E{constructor(i,o={}){super(),this.map=i,this.dispatcher=new gt(un(),this,i._getMapId()),this.imageManager=new Ye,this.imageManager.setEventedParent(this),this.glyphManager=new lt(i._requestManager,o.localIdeographFontFamily),this.lineAtlas=new St(256,512),this.crossTileSymbolIndex=new Gl,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.ay,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("setReferrer",c.az());const h=this;this._rtlTextPluginCallback=mn.registerForPluginStateChange(f=>{h.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:f.pluginStatus,pluginURL:f.pluginURL},(y,w)=>{if(c.aA(y),w&&w.every(S=>S))for(const S in h.sourceCaches){const k=h.sourceCaches[S].getSource().type;k!=="vector"&&k!=="geojson"||h.sourceCaches[S].reload()}})}),this.on("data",f=>{if(f.dataType!=="source"||f.sourceDataType!=="metadata")return;const y=this.sourceCaches[f.sourceId];if(!y)return;const w=y.getSource();if(w&&w.vectorLayerIds)for(const S in this._layers){const k=this._layers[S];k.source===w.id&&this._validateLayer(k)}})}loadURL(i,o={},h){this.fire(new c.k("dataloading",{dataType:"style"})),o.validate=typeof o.validate!="boolean"||o.validate;const f=this.map._requestManager.transformRequest(i,Y.Style);this._request=c.f(f,(y,w)=>{this._request=null,y?this.fire(new c.j(y)):w&&this._load(w,o,h)})}loadJSON(i,o={},h){this.fire(new c.k("dataloading",{dataType:"style"})),this._request=c.h.frame(()=>{this._request=null,o.validate=o.validate!==!1,this._load(i,o,h)})}loadEmpty(){this.fire(new c.k("dataloading",{dataType:"style"})),this._load(ps,{validate:!1})}_load(i,o,h){var f;const y=o.transformStyle?o.transformStyle(h,i):i;if(!o.validate||!Sn(this,c.y(y))){this._loaded=!0,this.stylesheet=y;for(const w in y.sources)this.addSource(w,y.sources[w],{validate:!1});y.sprite?this._loadSprite(y.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(y.glyphs),this._createLayers(),this.light=new ft(this.stylesheet.light),this.map.setTerrain((f=this.stylesheet.terrain)!==null&&f!==void 0?f:null),this.fire(new c.k("data",{dataType:"style"})),this.fire(new c.k("style.load"))}}_createLayers(){const i=c.aB(this.stylesheet.layers);this.dispatcher.broadcast("setLayers",i),this._order=i.map(o=>o.id),this._layers={},this._serializedLayers=null;for(const o of i){const h=c.aC(o);h.setEventedParent(this,{layer:{id:o.id}}),this._layers[o.id]=h}}_loadSprite(i,o=!1,h=void 0){this.imageManager.setLoaded(!1),this._spriteRequest=function(f,y,w,S){const k=ke(f),C=k.length,D=w>1?"@2x":"",P={},N={},H={};for(const{id:W,url:J}of k){const G=y.transformRequest(y.normalizeSpriteURL(J,D,".json"),Y.SpriteJSON),fe=`${W}_${G.url}`;P[fe]=c.f(G,(me,Ae)=>{delete P[fe],N[W]=Ae,$e(S,N,H,me,C)});const Se=y.transformRequest(y.normalizeSpriteURL(J,D,".png"),Y.SpriteImage),re=`${W}_${Se.url}`;P[re]=ne.getImage(Se,(me,Ae)=>{delete P[re],H[W]=Ae,$e(S,N,H,me,C)})}return{cancel(){for(const W of Object.values(P))W.cancel()}}}(i,this.map._requestManager,this.map.getPixelRatio(),(f,y)=>{if(this._spriteRequest=null,f)this.fire(new c.j(f));else if(y)for(const w in y){this._spritesImagesIds[w]=[];const S=this._spritesImagesIds[w]?this._spritesImagesIds[w].filter(k=>!(k in y)):[];for(const k of S)this.imageManager.removeImage(k),this._changedImages[k]=!0;for(const k in y[w]){const C=w==="default"?k:`${w}:${k}`;this._spritesImagesIds[w].push(C),C in this.imageManager.images?this.imageManager.updateImage(C,y[w][k],!1):this.imageManager.addImage(C,y[w][k]),o&&(this._changedImages[C]=!0)}}this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),o&&(this._changed=!0),this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"})),h&&h(f)})}_unloadSprite(){for(const i of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(i),this._changedImages[i]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}_validateLayer(i){const o=this.sourceCaches[i.source];if(!o)return;const h=i.sourceLayer;if(!h)return;const f=o.getSource();(f.type==="geojson"||f.vectorLayerIds&&f.vectorLayerIds.indexOf(h)===-1)&&this.fire(new c.j(new Error(`Source layer "${h}" does not exist on source "${f.id}" as specified by style layer "${i.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const i in this.sourceCaches)if(!this.sourceCaches[i].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(i){const o=this._serializedAllLayers();if(!i||i.length===0)return Object.values(o);const h=[];for(const f of i)o[f]&&h.push(o[f]);return h}_serializedAllLayers(){let i=this._serializedLayers;if(i)return i;i=this._serializedLayers={};const o=Object.keys(this._layers);for(const h of o){const f=this._layers[h];f.type!=="custom"&&(i[h]=f.serialize())}return i}hasTransitions(){if(this.light&&this.light.hasTransition())return!0;for(const i in this.sourceCaches)if(this.sourceCaches[i].hasTransition())return!0;for(const i in this._layers)if(this._layers[i].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(i){if(!this._loaded)return;const o=this._changed;if(this._changed){const f=Object.keys(this._updatedLayers),y=Object.keys(this._removedLayers);(f.length||y.length)&&this._updateWorkerLayers(f,y);for(const w in this._updatedSources){const S=this._updatedSources[w];if(S==="reload")this._reloadSource(w);else{if(S!=="clear")throw new Error(`Invalid action ${S}`);this._clearSource(w)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const w in this._updatedPaintProps)this._layers[w].updateTransitions(i);this.light.updateTransitions(i),this._resetUpdates()}const h={};for(const f in this.sourceCaches){const y=this.sourceCaches[f];h[f]=y.used,y.used=!1}for(const f of this._order){const y=this._layers[f];y.recalculate(i,this._availableImages),!y.isHidden(i.zoom)&&y.source&&(this.sourceCaches[y.source].used=!0)}for(const f in h){const y=this.sourceCaches[f];h[f]!==y.used&&y.fire(new c.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:f}))}this.light.recalculate(i),this.z=i.zoom,o&&this.fire(new c.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const i=Object.keys(this._changedImages);if(i.length){for(const o in this.sourceCaches)this.sourceCaches[o].reloadTilesForDependencies(["icons","patterns"],i);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(i,o){this.dispatcher.broadcast("updateLayers",{layers:this._serializeByIds(i),removedIds:o})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(i,o={}){this._checkLoaded();const h=this.serialize();if(i=o.transformStyle?o.transformStyle(h,i):i,Sn(this,c.y(i)))return!1;(i=c.aD(i)).layers=c.aB(i.layers);const f=c.aE(h,i).filter(w=>!(w.command in lm));if(f.length===0)return!1;const y=f.filter(w=>!(w.command in Xn));if(y.length>0)throw new Error(`Unimplemented: ${y.map(w=>w.command).join(", ")}.`);for(const w of f)w.command!=="setTransition"&&this[w.command].apply(this,w.args);return this.stylesheet=i,this._serializedLayers=null,!0}addImage(i,o){if(this.getImage(i))return this.fire(new c.j(new Error(`An image named "${i}" already exists.`)));this.imageManager.addImage(i,o),this._afterImageUpdated(i)}updateImage(i,o){this.imageManager.updateImage(i,o)}getImage(i){return this.imageManager.getImage(i)}removeImage(i){if(!this.getImage(i))return this.fire(new c.j(new Error(`An image named "${i}" does not exist.`)));this.imageManager.removeImage(i),this._afterImageUpdated(i)}_afterImageUpdated(i){this._availableImages=this.imageManager.listImages(),this._changedImages[i]=!0,this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(i,o,h={}){if(this._checkLoaded(),this.sourceCaches[i]!==void 0)throw new Error(`Source "${i}" already exists.`);if(!o.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(o).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(o.type)>=0&&this._validate(c.y.source,`sources.${i}`,o,null,h))return;this.map&&this.map._collectResourceTiming&&(o.collectResourceTiming=!0);const f=this.sourceCaches[i]=new Vr(i,o,this.dispatcher);f.style=this,f.setEventedParent(this,()=>({isSourceLoaded:f.loaded(),source:f.serialize(),sourceId:i})),f.onAdd(this.map),this._changed=!0}removeSource(i){if(this._checkLoaded(),this.sourceCaches[i]===void 0)throw new Error("There is no source with this ID");for(const h in this._layers)if(this._layers[h].source===i)return this.fire(new c.j(new Error(`Source "${i}" cannot be removed while layer "${h}" is using it.`)));const o=this.sourceCaches[i];delete this.sourceCaches[i],delete this._updatedSources[i],o.fire(new c.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:i})),o.setEventedParent(null),o.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(i,o){if(this._checkLoaded(),this.sourceCaches[i]===void 0)throw new Error(`There is no source with this ID=${i}`);const h=this.sourceCaches[i].getSource();if(h.type!=="geojson")throw new Error(`geojsonSource.type is ${h.type}, which is !== 'geojson`);h.setData(o),this._changed=!0}getSource(i){return this.sourceCaches[i]&&this.sourceCaches[i].getSource()}addLayer(i,o,h={}){this._checkLoaded();const f=i.id;if(this.getLayer(f))return void this.fire(new c.j(new Error(`Layer "${f}" already exists on this map.`)));let y;if(i.type==="custom"){if(Sn(this,c.aF(i)))return;y=c.aC(i)}else{if("source"in i&&typeof i.source=="object"&&(this.addSource(f,i.source),i=c.aD(i),i=c.e(i,{source:f})),this._validate(c.y.layer,`layers.${f}`,i,{arrayIndex:-1},h))return;y=c.aC(i),this._validateLayer(y),y.setEventedParent(this,{layer:{id:f}})}const w=o?this._order.indexOf(o):this._order.length;if(o&&w===-1)this.fire(new c.j(new Error(`Cannot add layer "${f}" before non-existing layer "${o}".`)));else{if(this._order.splice(w,0,f),this._layerOrderChanged=!0,this._layers[f]=y,this._removedLayers[f]&&y.source&&y.type!=="custom"){const S=this._removedLayers[f];delete this._removedLayers[f],S.type!==y.type?this._updatedSources[y.source]="clear":(this._updatedSources[y.source]="reload",this.sourceCaches[y.source].pause())}this._updateLayer(y),y.onAdd&&y.onAdd(this.map)}}moveLayer(i,o){if(this._checkLoaded(),this._changed=!0,!this._layers[i])return void this.fire(new c.j(new Error(`The layer '${i}' does not exist in the map's style and cannot be moved.`)));if(i===o)return;const h=this._order.indexOf(i);this._order.splice(h,1);const f=o?this._order.indexOf(o):this._order.length;o&&f===-1?this.fire(new c.j(new Error(`Cannot move layer "${i}" before non-existing layer "${o}".`))):(this._order.splice(f,0,i),this._layerOrderChanged=!0)}removeLayer(i){this._checkLoaded();const o=this._layers[i];if(!o)return void this.fire(new c.j(new Error(`Cannot remove non-existing layer "${i}".`)));o.setEventedParent(null);const h=this._order.indexOf(i);this._order.splice(h,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[i]=o,delete this._layers[i],this._serializedLayers&&delete this._serializedLayers[i],delete this._updatedLayers[i],delete this._updatedPaintProps[i],o.onRemove&&o.onRemove(this.map)}getLayer(i){return this._layers[i]}getLayersOrder(){return[...this._order]}hasLayer(i){return i in this._layers}setLayerZoomRange(i,o,h){this._checkLoaded();const f=this.getLayer(i);f?f.minzoom===o&&f.maxzoom===h||(o!=null&&(f.minzoom=o),h!=null&&(f.maxzoom=h),this._updateLayer(f)):this.fire(new c.j(new Error(`Cannot set the zoom range of non-existing layer "${i}".`)))}setFilter(i,o,h={}){this._checkLoaded();const f=this.getLayer(i);if(f){if(!c.aG(f.filter,o))return o==null?(f.filter=void 0,void this._updateLayer(f)):void(this._validate(c.y.filter,`layers.${f.id}.filter`,o,null,h)||(f.filter=c.aD(o),this._updateLayer(f)))}else this.fire(new c.j(new Error(`Cannot filter non-existing layer "${i}".`)))}getFilter(i){return c.aD(this.getLayer(i).filter)}setLayoutProperty(i,o,h,f={}){this._checkLoaded();const y=this.getLayer(i);y?c.aG(y.getLayoutProperty(o),h)||(y.setLayoutProperty(o,h,f),this._updateLayer(y)):this.fire(new c.j(new Error(`Cannot style non-existing layer "${i}".`)))}getLayoutProperty(i,o){const h=this.getLayer(i);if(h)return h.getLayoutProperty(o);this.fire(new c.j(new Error(`Cannot get style of non-existing layer "${i}".`)))}setPaintProperty(i,o,h,f={}){this._checkLoaded();const y=this.getLayer(i);y?c.aG(y.getPaintProperty(o),h)||(y.setPaintProperty(o,h,f)&&this._updateLayer(y),this._changed=!0,this._updatedPaintProps[i]=!0):this.fire(new c.j(new Error(`Cannot style non-existing layer "${i}".`)))}getPaintProperty(i,o){return this.getLayer(i).getPaintProperty(o)}setFeatureState(i,o){this._checkLoaded();const h=i.source,f=i.sourceLayer,y=this.sourceCaches[h];if(y===void 0)return void this.fire(new c.j(new Error(`The source '${h}' does not exist in the map's style.`)));const w=y.getSource().type;w==="geojson"&&f?this.fire(new c.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):w!=="vector"||f?(i.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),y.setFeatureState(f,i.id,o)):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(i,o){this._checkLoaded();const h=i.source,f=this.sourceCaches[h];if(f===void 0)return void this.fire(new c.j(new Error(`The source '${h}' does not exist in the map's style.`)));const y=f.getSource().type,w=y==="vector"?i.sourceLayer:void 0;y!=="vector"||w?o&&typeof i.id!="string"&&typeof i.id!="number"?this.fire(new c.j(new Error("A feature id is required to remove its specific state property."))):f.removeFeatureState(w,i.id,o):this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(i){this._checkLoaded();const o=i.source,h=i.sourceLayer,f=this.sourceCaches[o];if(f!==void 0)return f.getSource().type!=="vector"||h?(i.id===void 0&&this.fire(new c.j(new Error("The feature id parameter must be provided."))),f.getFeatureState(h,i.id)):void this.fire(new c.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.j(new Error(`The source '${o}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const i=c.aH(this.sourceCaches,y=>y.serialize()),o=this._serializeByIds(this._order),h=this.map.getTerrain()||void 0,f=this.stylesheet;return c.aI({version:f.version,name:f.name,metadata:f.metadata,light:f.light,center:f.center,zoom:f.zoom,bearing:f.bearing,pitch:f.pitch,sprite:f.sprite,glyphs:f.glyphs,transition:f.transition,sources:i,layers:o,terrain:h},y=>y!==void 0)}_updateLayer(i){this._updatedLayers[i.id]=!0,i.source&&!this._updatedSources[i.source]&&this.sourceCaches[i.source].getSource().type!=="raster"&&(this._updatedSources[i.source]="reload",this.sourceCaches[i.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(i){const o=w=>this._layers[w].type==="fill-extrusion",h={},f=[];for(let w=this._order.length-1;w>=0;w--){const S=this._order[w];if(o(S)){h[S]=w;for(const k of i){const C=k[S];if(C)for(const D of C)f.push(D)}}}f.sort((w,S)=>S.intersectionZ-w.intersectionZ);const y=[];for(let w=this._order.length-1;w>=0;w--){const S=this._order[w];if(o(S))for(let k=f.length-1;k>=0;k--){const C=f[k].feature;if(h[C.layer.id]{const Ke=fe.featureSortOrder;if(Ke){const Ue=Ke.indexOf(Ee.featureIndex);return Ke.indexOf(Re.featureIndex)-Ue}return Re.featureIndex-Ee.featureIndex});for(const Ee of Ae)me.push(Ee)}}for(const fe in W)W[fe].forEach(Se=>{const re=Se.feature,me=C[S[fe].source].getFeatureState(re.layer["source-layer"],re.id);re.source=re.layer.source,re.layer["source-layer"]&&(re.sourceLayer=re.layer["source-layer"]),re.state=me});return W}(this._layers,w,this.sourceCaches,i,o,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(y)}querySourceFeatures(i,o){o&&o.filter&&this._validate(c.y.filter,"querySourceFeatures.filter",o.filter,null,o);const h=this.sourceCaches[i];return h?function(f,y){const w=f.getRenderableIds().map(C=>f.getTileByID(C)),S=[],k={};for(let C=0;C{Jr[f]=y})(i,o),o.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:i,url:o.workerSourceURL},h):h(null,null))}getLight(){return this.light.getLight()}setLight(i,o={}){this._checkLoaded();const h=this.light.getLight();let f=!1;for(const w in i)if(!c.aG(i[w],h[w])){f=!0;break}if(!f)return;const y={now:c.h.now(),transition:c.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(i,o),this.light.updateTransitions(y)}_validate(i,o,h,f,y={}){return(!y||y.validate!==!1)&&Sn(this,i.call(c.y,c.e({key:o,style:this.serialize(),value:h,styleSpec:c.v},f)))}_remove(i=!0){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),c.aJ.off("pluginStateChange",this._rtlTextPluginCallback);for(const o in this._layers)this._layers[o].setEventedParent(null);for(const o in this.sourceCaches){const h=this.sourceCaches[o];h.setEventedParent(null),h.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),this.dispatcher.remove(i)}_clearSource(i){this.sourceCaches[i].clearTiles()}_reloadSource(i){this.sourceCaches[i].resume(),this.sourceCaches[i].reload()}_updateSources(i){for(const o in this.sourceCaches)this.sourceCaches[o].update(i,this.map.terrain)}_generateCollisionBoxes(){for(const i in this.sourceCaches)this._reloadSource(i)}_updatePlacement(i,o,h,f,y=!1){let w=!1,S=!1;const k={};for(const C of this._order){const D=this._layers[C];if(D.type!=="symbol")continue;if(!k[D.source]){const N=this.sourceCaches[D.source];k[D.source]=N.getRenderableIds(!0).map(H=>N.getTileByID(H)).sort((H,W)=>W.tileID.overscaledZ-H.tileID.overscaledZ||(H.tileID.isLessThan(W.tileID)?-1:1))}const P=this.crossTileSymbolIndex.addLayer(D,k[D.source],i.center.lng);w=w||P}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((y=y||this._layerOrderChanged||h===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(c.h.now(),i.zoom))&&(this.pauseablePlacement=new xo(i,this.map.terrain,this._order,y,o,h,f,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,k),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(c.h.now()),S=!0),w&&this.pauseablePlacement.placement.setStale()),S||w)for(const C of this._order){const D=this._layers[C];D.type==="symbol"&&this.placement.updateLayerOpacities(D,k[D.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(c.h.now())}_releaseSymbolFadeTiles(){for(const i in this.sourceCaches)this.sourceCaches[i].releaseSymbolFadeTiles()}getImages(i,o,h){this.imageManager.getImages(o.icons,h),this._updateTilesForChangedImages();const f=this.sourceCaches[o.source];f&&f.setDependencies(o.tileID.key,o.type,o.icons)}getGlyphs(i,o,h){this.glyphManager.getGlyphs(o.stacks,h);const f=this.sourceCaches[o.source];f&&f.setDependencies(o.tileID.key,o.type,[""])}getResource(i,o,h){return c.m(o,h)}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(i,o={}){this._checkLoaded(),i&&this._validate(c.y.glyphs,"glyphs",i,null,o)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=i,this.glyphManager.entries={},this.glyphManager.setURL(i))}addSprite(i,o,h={},f){this._checkLoaded();const y=[{id:i,url:o}],w=[...ke(this.stylesheet.sprite),...y];this._validate(c.y.sprite,"sprite",w,null,h)||(this.stylesheet.sprite=w,this._loadSprite(y,!0,f))}removeSprite(i){this._checkLoaded();const o=ke(this.stylesheet.sprite);if(o.find(h=>h.id===i)){if(this._spritesImagesIds[i])for(const h of this._spritesImagesIds[i])this.imageManager.removeImage(h),this._changedImages[h]=!0;o.splice(o.findIndex(h=>h.id===i),1),this.stylesheet.sprite=o.length>0?o:void 0,delete this._spritesImagesIds[i],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("setImages",this._availableImages),this.fire(new c.k("data",{dataType:"style"}))}else this.fire(new c.j(new Error(`Sprite "${i}" doesn't exists on this map.`)))}getSprite(){return ke(this.stylesheet.sprite)}setSprite(i,o={},h){this._checkLoaded(),i&&this._validate(c.y.sprite,"sprite",i,null,o)||(this.stylesheet.sprite=i,i?this._loadSprite(i,!0,h):(this._unloadSprite(),h&&h(null)))}}mn.registerForPluginStateChange=c.aK;var Zl=c.Q([{name:"a_pos",type:"Int16",components:2}]),So="attribute vec3 a_pos3d;uniform mat4 u_matrix;uniform float u_ele_delta;varying vec2 v_texture_pos;varying float v_depth;void main() {float extent=8192.0;float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/extent;gl_Position=u_matrix*vec4(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta,1.0);v_depth=gl_Position.z/gl_Position.w;}";const xi={prelude:Rr(`#ifdef GL_ES @@ -587,4 +587,4 @@ uniform ${D} ${P} u_${N}; `),re=S.createShader(S.FRAGMENT_SHADER);if(S.isContextLost())return void(this.failedToCreate=!0);if(S.shaderSource(re,fe),S.compileShader(re),!S.getShaderParameter(re,S.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${S.getShaderInfoLog(re)}`);S.attachShader(this.program,re);const me=S.createShader(S.VERTEX_SHADER);if(S.isContextLost())return void(this.failedToCreate=!0);if(S.shaderSource(me,Se),S.compileShader(me),!S.getShaderParameter(me,S.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${S.getShaderInfoLog(me)}`);S.attachShader(this.program,me),this.attributes={};const Ae={};this.numAttributes=D.length;for(let Ee=0;Ee({u_depth:new c.aL(Ee,Re.u_depth),u_terrain:new c.aL(Ee,Re.u_terrain),u_terrain_dim:new c.aM(Ee,Re.u_terrain_dim),u_terrain_matrix:new c.aN(Ee,Re.u_terrain_matrix),u_terrain_unpack:new c.aO(Ee,Re.u_terrain_unpack),u_terrain_exaggeration:new c.aM(Ee,Re.u_terrain_exaggeration)}))(i,Ae),this.binderUniforms=h?h.getUniforms(i,Ae):[]}draw(i,o,h,f,y,w,S,k,C,D,P,N,H,W,J,G,fe,Se){const re=i.gl;if(this.failedToCreate)return;if(i.program.set(this.program),i.setDepthMode(h),i.setStencilMode(f),i.setColorMode(y),i.setCullFace(w),k){i.activeTexture.set(re.TEXTURE2),re.bindTexture(re.TEXTURE_2D,k.depthTexture),i.activeTexture.set(re.TEXTURE3),re.bindTexture(re.TEXTURE_2D,k.texture);for(const Ae in this.terrainUniforms)this.terrainUniforms[Ae].set(k[Ae])}for(const Ae in this.fixedUniforms)this.fixedUniforms[Ae].set(S[Ae]);J&&J.setUniforms(i,this.binderUniforms,H,{zoom:W});let me=0;switch(o){case re.LINES:me=2;break;case re.TRIANGLES:me=3;break;case re.LINE_STRIP:me=1}for(const Ae of N.get()){const Ee=Ae.vaos||(Ae.vaos={});(Ee[C]||(Ee[C]=new Ga)).bind(i,this,D,J?J.getPaintVertexBuffers():[],P,Ae.vertexOffset,G,fe,Se),re.drawElements(o,Ae.primitiveLength*me,re.UNSIGNED_SHORT,Ae.primitiveOffset*me*2)}}}function ms(m,i,o){const h=1/he(o,1,i.transform.tileZoom),f=Math.pow(2,o.tileID.overscaledZ),y=o.tileSize*Math.pow(2,i.transform.tileZoom)/f,w=y*(o.tileID.canonical.x+o.tileID.wrap*f),S=y*o.tileID.canonical.y;return{u_image:0,u_texsize:o.imageAtlasTexture.size,u_scale:[h,m.fromScale,m.toScale],u_fade:m.t,u_pixel_coord_upper:[w>>16,S>>16],u_pixel_coord_lower:[65535&w,65535&S]}}const pu=(m,i,o,h)=>{const f=i.style.light,y=f.properties.get("position"),w=[y.x,y.y,y.z],S=function(){var C=new c.A(9);return c.A!=Float32Array&&(C[1]=0,C[2]=0,C[3]=0,C[5]=0,C[6]=0,C[7]=0),C[0]=1,C[4]=1,C[8]=1,C}();f.properties.get("anchor")==="viewport"&&function(C,D){var P=Math.sin(D),N=Math.cos(D);C[0]=N,C[1]=P,C[2]=0,C[3]=-P,C[4]=N,C[5]=0,C[6]=0,C[7]=0,C[8]=1}(S,-i.transform.angle),function(C,D,P){var N=D[0],H=D[1],W=D[2];C[0]=N*P[0]+H*P[3]+W*P[6],C[1]=N*P[1]+H*P[4]+W*P[7],C[2]=N*P[2]+H*P[5]+W*P[8]}(w,w,S);const k=f.properties.get("color");return{u_matrix:m,u_lightpos:w,u_lightintensity:f.properties.get("intensity"),u_lightcolor:[k.r,k.g,k.b],u_vertical_gradient:+o,u_opacity:h}},va=(m,i,o,h,f,y,w)=>c.e(pu(m,i,o,h),ms(y,i,w),{u_height_factor:-Math.pow(2,f.overscaledZ)/w.tileSize/8}),hd=m=>({u_matrix:m}),mu=(m,i,o,h)=>c.e(hd(m),ms(o,i,h)),Hl=(m,i)=>({u_matrix:m,u_world:i}),Yl=(m,i,o,h,f)=>c.e(mu(m,i,o,h),{u_world:f}),ba=(m,i,o,h)=>{const f=m.transform;let y,w;if(h.paint.get("circle-pitch-alignment")==="map"){const S=he(o,1,f.zoom);y=!0,w=[S,S]}else y=!1,w=f.pixelsToGLUnits;return{u_camera_to_center_distance:f.cameraToCenterDistance,u_scale_with_map:+(h.paint.get("circle-pitch-scale")==="map"),u_matrix:m.translatePosMatrix(i.posMatrix,o,h.paint.get("circle-translate"),h.paint.get("circle-translate-anchor")),u_pitch_with_map:+y,u_device_pixel_ratio:m.pixelRatio,u_extrude_scale:w}},gu=(m,i,o)=>{const h=he(o,1,i.zoom),f=Math.pow(2,i.zoom-o.tileID.overscaledZ),y=o.tileID.overscaleFactor();return{u_matrix:m,u_camera_to_center_distance:i.cameraToCenterDistance,u_pixels_to_tile_units:h,u_extrude_scale:[i.pixelsToGLUnits[0]/(h*f),i.pixelsToGLUnits[1]/(h*f)],u_overscale_factor:y}},sl=(m,i,o=1)=>({u_matrix:m,u_color:i,u_overlay:0,u_overlay_scale:o}),dd=m=>({u_matrix:m}),cm=(m,i,o,h)=>({u_matrix:m,u_extrude_scale:he(i,1,o),u_intensity:h});function yu(m,i){const o=Math.pow(2,i.canonical.z),h=i.canonical.y;return[new c.U(0,h/o).toLngLat().lat,new c.U(0,(h+1)/o).toLngLat().lat]}const _u=(m,i,o,h)=>{const f=m.transform;return{u_matrix:Kl(m,i,o,h),u_ratio:1/he(i,1,f.zoom),u_device_pixel_ratio:m.pixelRatio,u_units_to_pixels:[1/f.pixelsToGLUnits[0],1/f.pixelsToGLUnits[1]]}},fd=(m,i,o,h,f)=>c.e(_u(m,i,o,f),{u_image:0,u_image_height:h}),um=(m,i,o,h,f)=>{const y=m.transform,w=md(i,y);return{u_matrix:Kl(m,i,o,f),u_texsize:i.imageAtlasTexture.size,u_ratio:1/he(i,1,y.zoom),u_device_pixel_ratio:m.pixelRatio,u_image:0,u_scale:[w,h.fromScale,h.toScale],u_fade:h.t,u_units_to_pixels:[1/y.pixelsToGLUnits[0],1/y.pixelsToGLUnits[1]]}},pd=(m,i,o,h,f,y)=>{const w=m.lineAtlas,S=md(i,m.transform),k=o.layout.get("line-cap")==="round",C=w.getDash(h.from,k),D=w.getDash(h.to,k),P=C.width*f.fromScale,N=D.width*f.toScale;return c.e(_u(m,i,o,y),{u_patternscale_a:[S/P,-C.height/2],u_patternscale_b:[S/N,-D.height/2],u_sdfgamma:w.width/(256*Math.min(P,N)*m.pixelRatio)/2,u_image:0,u_tex_y_a:C.y,u_tex_y_b:D.y,u_mix:f.t})};function md(m,i){return 1/he(m,1,i.tileZoom)}function Kl(m,i,o,h){return m.translatePosMatrix(h?h.posMatrix:i.tileID.posMatrix,i,o.paint.get("line-translate"),o.paint.get("line-translate-anchor"))}const gd=(m,i,o,h,f)=>{return{u_matrix:m,u_tl_parent:i,u_scale_parent:o,u_buffer_scale:1,u_fade_t:h.mix,u_opacity:h.opacity*f.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:f.paint.get("raster-brightness-min"),u_brightness_high:f.paint.get("raster-brightness-max"),u_saturation_factor:(w=f.paint.get("raster-saturation"),w>0?1-1/(1.001-w):-w),u_contrast_factor:(y=f.paint.get("raster-contrast"),y>0?1/(1-y):1+y),u_spin_weights:yd(f.paint.get("raster-hue-rotate"))};var y,w};function yd(m){m*=Math.PI/180;const i=Math.sin(m),o=Math.cos(m);return[(2*o+1)/3,(-Math.sqrt(3)*i-o+1)/3,(Math.sqrt(3)*i-o+1)/3]}const vu=(m,i,o,h,f,y,w,S,k,C)=>{const D=f.transform;return{u_is_size_zoom_constant:+(m==="constant"||m==="source"),u_is_size_feature_constant:+(m==="constant"||m==="camera"),u_size_t:i?i.uSizeT:0,u_size:i?i.uSize:0,u_camera_to_center_distance:D.cameraToCenterDistance,u_pitch:D.pitch/360*2*Math.PI,u_rotate_symbol:+o,u_aspect_ratio:D.width/D.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_matrix:y,u_label_plane_matrix:w,u_coord_matrix:S,u_is_text:+k,u_pitch_with_map:+h,u_texsize:C,u_texture:0}},bu=(m,i,o,h,f,y,w,S,k,C,D)=>{const P=f.transform;return c.e(vu(m,i,o,h,f,y,w,S,k,C),{u_gamma_scale:h?Math.cos(P._pitch)*P.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:+D})},Za=(m,i,o,h,f,y,w,S,k,C)=>c.e(bu(m,i,o,h,f,y,w,S,!0,k,!0),{u_texsize_icon:C,u_texture_icon:1}),Xl=(m,i,o)=>({u_matrix:m,u_opacity:i,u_color:o}),gs=(m,i,o,h,f,y)=>c.e(function(w,S,k,C){const D=k.imageManager.getPattern(w.from.toString()),P=k.imageManager.getPattern(w.to.toString()),{width:N,height:H}=k.imageManager.getPixelSize(),W=Math.pow(2,C.tileID.overscaledZ),J=C.tileSize*Math.pow(2,k.transform.tileZoom)/W,G=J*(C.tileID.canonical.x+C.tileID.wrap*W),fe=J*C.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:D.tl,u_pattern_br_a:D.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[N,H],u_mix:S.t,u_pattern_size_a:D.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:S.fromScale,u_scale_b:S.toScale,u_tile_units_to_pixels:1/he(C,1,k.transform.tileZoom),u_pixel_coord_upper:[G>>16,fe>>16],u_pixel_coord_lower:[65535&G,65535&fe]}}(h,y,o,f),{u_matrix:m,u_opacity:i}),Jl={fillExtrusion:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_lightpos:new c.aP(m,i.u_lightpos),u_lightintensity:new c.aM(m,i.u_lightintensity),u_lightcolor:new c.aP(m,i.u_lightcolor),u_vertical_gradient:new c.aM(m,i.u_vertical_gradient),u_opacity:new c.aM(m,i.u_opacity)}),fillExtrusionPattern:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_lightpos:new c.aP(m,i.u_lightpos),u_lightintensity:new c.aM(m,i.u_lightintensity),u_lightcolor:new c.aP(m,i.u_lightcolor),u_vertical_gradient:new c.aM(m,i.u_vertical_gradient),u_height_factor:new c.aM(m,i.u_height_factor),u_image:new c.aL(m,i.u_image),u_texsize:new c.aQ(m,i.u_texsize),u_pixel_coord_upper:new c.aQ(m,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(m,i.u_pixel_coord_lower),u_scale:new c.aP(m,i.u_scale),u_fade:new c.aM(m,i.u_fade),u_opacity:new c.aM(m,i.u_opacity)}),fill:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix)}),fillPattern:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_image:new c.aL(m,i.u_image),u_texsize:new c.aQ(m,i.u_texsize),u_pixel_coord_upper:new c.aQ(m,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(m,i.u_pixel_coord_lower),u_scale:new c.aP(m,i.u_scale),u_fade:new c.aM(m,i.u_fade)}),fillOutline:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_world:new c.aQ(m,i.u_world)}),fillOutlinePattern:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_world:new c.aQ(m,i.u_world),u_image:new c.aL(m,i.u_image),u_texsize:new c.aQ(m,i.u_texsize),u_pixel_coord_upper:new c.aQ(m,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(m,i.u_pixel_coord_lower),u_scale:new c.aP(m,i.u_scale),u_fade:new c.aM(m,i.u_fade)}),circle:(m,i)=>({u_camera_to_center_distance:new c.aM(m,i.u_camera_to_center_distance),u_scale_with_map:new c.aL(m,i.u_scale_with_map),u_pitch_with_map:new c.aL(m,i.u_pitch_with_map),u_extrude_scale:new c.aQ(m,i.u_extrude_scale),u_device_pixel_ratio:new c.aM(m,i.u_device_pixel_ratio),u_matrix:new c.aN(m,i.u_matrix)}),collisionBox:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_camera_to_center_distance:new c.aM(m,i.u_camera_to_center_distance),u_pixels_to_tile_units:new c.aM(m,i.u_pixels_to_tile_units),u_extrude_scale:new c.aQ(m,i.u_extrude_scale),u_overscale_factor:new c.aM(m,i.u_overscale_factor)}),collisionCircle:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_inv_matrix:new c.aN(m,i.u_inv_matrix),u_camera_to_center_distance:new c.aM(m,i.u_camera_to_center_distance),u_viewport_size:new c.aQ(m,i.u_viewport_size)}),debug:(m,i)=>({u_color:new c.aR(m,i.u_color),u_matrix:new c.aN(m,i.u_matrix),u_overlay:new c.aL(m,i.u_overlay),u_overlay_scale:new c.aM(m,i.u_overlay_scale)}),clippingMask:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix)}),heatmap:(m,i)=>({u_extrude_scale:new c.aM(m,i.u_extrude_scale),u_intensity:new c.aM(m,i.u_intensity),u_matrix:new c.aN(m,i.u_matrix)}),heatmapTexture:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_world:new c.aQ(m,i.u_world),u_image:new c.aL(m,i.u_image),u_color_ramp:new c.aL(m,i.u_color_ramp),u_opacity:new c.aM(m,i.u_opacity)}),hillshade:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_image:new c.aL(m,i.u_image),u_latrange:new c.aQ(m,i.u_latrange),u_light:new c.aQ(m,i.u_light),u_shadow:new c.aR(m,i.u_shadow),u_highlight:new c.aR(m,i.u_highlight),u_accent:new c.aR(m,i.u_accent)}),hillshadePrepare:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_image:new c.aL(m,i.u_image),u_dimension:new c.aQ(m,i.u_dimension),u_zoom:new c.aM(m,i.u_zoom),u_unpack:new c.aO(m,i.u_unpack)}),line:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_ratio:new c.aM(m,i.u_ratio),u_device_pixel_ratio:new c.aM(m,i.u_device_pixel_ratio),u_units_to_pixels:new c.aQ(m,i.u_units_to_pixels)}),lineGradient:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_ratio:new c.aM(m,i.u_ratio),u_device_pixel_ratio:new c.aM(m,i.u_device_pixel_ratio),u_units_to_pixels:new c.aQ(m,i.u_units_to_pixels),u_image:new c.aL(m,i.u_image),u_image_height:new c.aM(m,i.u_image_height)}),linePattern:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_texsize:new c.aQ(m,i.u_texsize),u_ratio:new c.aM(m,i.u_ratio),u_device_pixel_ratio:new c.aM(m,i.u_device_pixel_ratio),u_image:new c.aL(m,i.u_image),u_units_to_pixels:new c.aQ(m,i.u_units_to_pixels),u_scale:new c.aP(m,i.u_scale),u_fade:new c.aM(m,i.u_fade)}),lineSDF:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_ratio:new c.aM(m,i.u_ratio),u_device_pixel_ratio:new c.aM(m,i.u_device_pixel_ratio),u_units_to_pixels:new c.aQ(m,i.u_units_to_pixels),u_patternscale_a:new c.aQ(m,i.u_patternscale_a),u_patternscale_b:new c.aQ(m,i.u_patternscale_b),u_sdfgamma:new c.aM(m,i.u_sdfgamma),u_image:new c.aL(m,i.u_image),u_tex_y_a:new c.aM(m,i.u_tex_y_a),u_tex_y_b:new c.aM(m,i.u_tex_y_b),u_mix:new c.aM(m,i.u_mix)}),raster:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_tl_parent:new c.aQ(m,i.u_tl_parent),u_scale_parent:new c.aM(m,i.u_scale_parent),u_buffer_scale:new c.aM(m,i.u_buffer_scale),u_fade_t:new c.aM(m,i.u_fade_t),u_opacity:new c.aM(m,i.u_opacity),u_image0:new c.aL(m,i.u_image0),u_image1:new c.aL(m,i.u_image1),u_brightness_low:new c.aM(m,i.u_brightness_low),u_brightness_high:new c.aM(m,i.u_brightness_high),u_saturation_factor:new c.aM(m,i.u_saturation_factor),u_contrast_factor:new c.aM(m,i.u_contrast_factor),u_spin_weights:new c.aP(m,i.u_spin_weights)}),symbolIcon:(m,i)=>({u_is_size_zoom_constant:new c.aL(m,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aL(m,i.u_is_size_feature_constant),u_size_t:new c.aM(m,i.u_size_t),u_size:new c.aM(m,i.u_size),u_camera_to_center_distance:new c.aM(m,i.u_camera_to_center_distance),u_pitch:new c.aM(m,i.u_pitch),u_rotate_symbol:new c.aL(m,i.u_rotate_symbol),u_aspect_ratio:new c.aM(m,i.u_aspect_ratio),u_fade_change:new c.aM(m,i.u_fade_change),u_matrix:new c.aN(m,i.u_matrix),u_label_plane_matrix:new c.aN(m,i.u_label_plane_matrix),u_coord_matrix:new c.aN(m,i.u_coord_matrix),u_is_text:new c.aL(m,i.u_is_text),u_pitch_with_map:new c.aL(m,i.u_pitch_with_map),u_texsize:new c.aQ(m,i.u_texsize),u_texture:new c.aL(m,i.u_texture)}),symbolSDF:(m,i)=>({u_is_size_zoom_constant:new c.aL(m,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aL(m,i.u_is_size_feature_constant),u_size_t:new c.aM(m,i.u_size_t),u_size:new c.aM(m,i.u_size),u_camera_to_center_distance:new c.aM(m,i.u_camera_to_center_distance),u_pitch:new c.aM(m,i.u_pitch),u_rotate_symbol:new c.aL(m,i.u_rotate_symbol),u_aspect_ratio:new c.aM(m,i.u_aspect_ratio),u_fade_change:new c.aM(m,i.u_fade_change),u_matrix:new c.aN(m,i.u_matrix),u_label_plane_matrix:new c.aN(m,i.u_label_plane_matrix),u_coord_matrix:new c.aN(m,i.u_coord_matrix),u_is_text:new c.aL(m,i.u_is_text),u_pitch_with_map:new c.aL(m,i.u_pitch_with_map),u_texsize:new c.aQ(m,i.u_texsize),u_texture:new c.aL(m,i.u_texture),u_gamma_scale:new c.aM(m,i.u_gamma_scale),u_device_pixel_ratio:new c.aM(m,i.u_device_pixel_ratio),u_is_halo:new c.aL(m,i.u_is_halo)}),symbolTextAndIcon:(m,i)=>({u_is_size_zoom_constant:new c.aL(m,i.u_is_size_zoom_constant),u_is_size_feature_constant:new c.aL(m,i.u_is_size_feature_constant),u_size_t:new c.aM(m,i.u_size_t),u_size:new c.aM(m,i.u_size),u_camera_to_center_distance:new c.aM(m,i.u_camera_to_center_distance),u_pitch:new c.aM(m,i.u_pitch),u_rotate_symbol:new c.aL(m,i.u_rotate_symbol),u_aspect_ratio:new c.aM(m,i.u_aspect_ratio),u_fade_change:new c.aM(m,i.u_fade_change),u_matrix:new c.aN(m,i.u_matrix),u_label_plane_matrix:new c.aN(m,i.u_label_plane_matrix),u_coord_matrix:new c.aN(m,i.u_coord_matrix),u_is_text:new c.aL(m,i.u_is_text),u_pitch_with_map:new c.aL(m,i.u_pitch_with_map),u_texsize:new c.aQ(m,i.u_texsize),u_texsize_icon:new c.aQ(m,i.u_texsize_icon),u_texture:new c.aL(m,i.u_texture),u_texture_icon:new c.aL(m,i.u_texture_icon),u_gamma_scale:new c.aM(m,i.u_gamma_scale),u_device_pixel_ratio:new c.aM(m,i.u_device_pixel_ratio),u_is_halo:new c.aL(m,i.u_is_halo)}),background:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_opacity:new c.aM(m,i.u_opacity),u_color:new c.aR(m,i.u_color)}),backgroundPattern:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_opacity:new c.aM(m,i.u_opacity),u_image:new c.aL(m,i.u_image),u_pattern_tl_a:new c.aQ(m,i.u_pattern_tl_a),u_pattern_br_a:new c.aQ(m,i.u_pattern_br_a),u_pattern_tl_b:new c.aQ(m,i.u_pattern_tl_b),u_pattern_br_b:new c.aQ(m,i.u_pattern_br_b),u_texsize:new c.aQ(m,i.u_texsize),u_mix:new c.aM(m,i.u_mix),u_pattern_size_a:new c.aQ(m,i.u_pattern_size_a),u_pattern_size_b:new c.aQ(m,i.u_pattern_size_b),u_scale_a:new c.aM(m,i.u_scale_a),u_scale_b:new c.aM(m,i.u_scale_b),u_pixel_coord_upper:new c.aQ(m,i.u_pixel_coord_upper),u_pixel_coord_lower:new c.aQ(m,i.u_pixel_coord_lower),u_tile_units_to_pixels:new c.aM(m,i.u_tile_units_to_pixels)}),terrain:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_texture:new c.aL(m,i.u_texture),u_ele_delta:new c.aM(m,i.u_ele_delta)}),terrainDepth:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_ele_delta:new c.aM(m,i.u_ele_delta)}),terrainCoords:(m,i)=>({u_matrix:new c.aN(m,i.u_matrix),u_texture:new c.aL(m,i.u_texture),u_terrain_coords_id:new c.aM(m,i.u_terrain_coords_id),u_ele_delta:new c.aM(m,i.u_ele_delta)})};class Ql{constructor(i,o,h){this.context=i;const f=i.gl;this.buffer=f.createBuffer(),this.dynamicDraw=!!h,this.context.unbindVAO(),i.bindElementBuffer.set(this.buffer),f.bufferData(f.ELEMENT_ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?f.DYNAMIC_DRAW:f.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(i){const o=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),o.bufferSubData(o.ELEMENT_ARRAY_BUFFER,0,i.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const al={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class ec{constructor(i,o,h,f){this.length=o.length,this.attributes=h,this.itemSize=o.bytesPerElement,this.dynamicDraw=f,this.context=i;const y=i.gl;this.buffer=y.createBuffer(),i.bindVertexBuffer.set(this.buffer),y.bufferData(y.ARRAY_BUFFER,o.arrayBuffer,this.dynamicDraw?y.DYNAMIC_DRAW:y.STATIC_DRAW),this.dynamicDraw||delete o.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(i){if(i.length!==this.length)throw new Error(`Length of new data is ${i.length}, which doesn't match current length of ${this.length}`);const o=this.context.gl;this.bind(),o.bufferSubData(o.ARRAY_BUFFER,0,i.arrayBuffer)}enableAttributes(i,o){for(let h=0;h0){const et=c.Z(),Tt=Re;c.aU(et,Ee.placementInvProjMatrix,m.transform.glCoordMatrix),c.aU(et,et,Ee.placementViewportMatrix),D.push({circleArray:Ue,circleOffset:N,transform:Tt,invTransform:et,coord:me}),P+=Ue.length/4,N=P}Ke&&C.draw(S,k.LINES,kr.disabled,Si.disabled,m.colorModeForRenderPass(),pi.disabled,gu(Re,m.transform,Ae),m.style.map.terrain&&m.style.map.terrain.getTerrainData(me),o.id,Ke.layoutVertexBuffer,Ke.indexBuffer,Ke.segments,null,m.transform.zoom,null,null,Ke.collisionVertexBuffer)}if(!w||!D.length)return;const H=m.useProgram("collisionCircle"),W=new c.aV;W.resize(4*P),W._trim();let J=0;for(const re of D)for(let me=0;me=0&&(W[G.associatedIconIndex]={shiftedAnchor:_r,angle:st})}else q(G.numGlyphs,N)}if(C){H.clear();const J=m.icon.placedSymbolArray;for(let G=0;Gm.style.map.terrain.getElevation(Ke,$n,Ni):null,en=o.layout.get("text-rotation-alignment")==="map";We(et,Ke.posMatrix,m,f,hi,Ns,G,C,en,Oi)}const Qa=m.translatePosMatrix(Ke.posMatrix,Ue,y,w),zo=fe||f&&Ee||Ta?Du:hi,In=m.translatePosMatrix(Ns,Ue,y,w,!0),yn=st&&o.paint.get(f?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Pn;Pn=st?et.iconsInText?Za($t.kind,gr,Se,G,m,Qa,zo,In,vr,Qi):bu($t.kind,gr,Se,G,m,Qa,zo,In,f,vr,!0):vu($t.kind,gr,Se,G,m,Qa,zo,In,f,vr);const eo={program:Gr,buffers:Tt,uniformValues:Pn,atlasTexture:Fi,atlasTextureIcon:ji,atlasInterpolation:si,atlasInterpolationIcon:gn,isSDF:st,hasHalo:yn};if(re&&et.canOverlap){me=!0;const Oi=Tt.segments.get();for(const en of Oi)Re.push({segments:new c.S([en]),sortKey:en.sortKey,state:eo,terrainData:or})}else Re.push({segments:Tt.segments,sortKey:0,state:eo,terrainData:or})}me&&Re.sort((Ke,Ue)=>Ke.sortKey-Ue.sortKey);for(const Ke of Re){const Ue=Ke.state;if(N.activeTexture.set(H.TEXTURE0),Ue.atlasTexture.bind(Ue.atlasInterpolation,H.CLAMP_TO_EDGE),Ue.atlasTextureIcon&&(N.activeTexture.set(H.TEXTURE1),Ue.atlasTextureIcon&&Ue.atlasTextureIcon.bind(Ue.atlasInterpolationIcon,H.CLAMP_TO_EDGE)),Ue.isSDF){const et=Ue.uniformValues;Ue.hasHalo&&(et.u_is_halo=1,Lu(Ue.buffers,Ke.segments,o,m,Ue.program,Ae,D,P,et,Ke.terrainData)),et.u_is_halo=0}Lu(Ue.buffers,Ke.segments,o,m,Ue.program,Ae,D,P,Ue.uniformValues,Ke.terrainData)}}function Lu(m,i,o,h,f,y,w,S,k,C){const D=h.context;f.draw(D,D.gl.TRIANGLES,y,w,S,pi.disabled,k,C,o.id,m.layoutVertexBuffer,m.indexBuffer,i,o.paint,h.transform.zoom,m.programConfigurations.get(o.id),m.dynamicLayoutVertexBuffer,m.opacityVertexBuffer)}function ll(m,i,o,h,f){if(!o||!h||!h.imageAtlas)return;const y=h.imageAtlas.patternPositions;let w=y[o.to.toString()],S=y[o.from.toString()];if(!w&&S&&(w=S),!S&&w&&(S=w),!w||!S){const k=f.getPaintProperty(i);w=y[k],S=y[k]}w&&S&&m.setConstantPatternPositions(w,S)}function cl(m,i,o,h,f,y,w){const S=m.context.gl,k="fill-pattern",C=o.paint.get(k),D=C&&C.constantOr(1),P=o.getCrossfadeParameters();let N,H,W,J,G;w?(H=D&&!o.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",N=S.LINES):(H=D?"fillPattern":"fill",N=S.TRIANGLES);const fe=C.constantOr(null);for(const Se of h){const re=i.getTile(Se);if(D&&!re.patternsLoaded())continue;const me=re.getBucket(o);if(!me)continue;const Ae=me.programConfigurations.get(o.id),Ee=m.useProgram(H,Ae),Re=m.style.map.terrain&&m.style.map.terrain.getTerrainData(Se);D&&(m.context.activeTexture.set(S.TEXTURE0),re.imageAtlasTexture.bind(S.LINEAR,S.CLAMP_TO_EDGE),Ae.updatePaintBuffers(P)),ll(Ae,k,fe,re,o);const Ke=Re?Se:null,Ue=m.translatePosMatrix(Ke?Ke.posMatrix:Se.posMatrix,re,o.paint.get("fill-translate"),o.paint.get("fill-translate-anchor"));if(w){J=me.indexBuffer2,G=me.segments2;const et=[S.drawingBufferWidth,S.drawingBufferHeight];W=H==="fillOutlinePattern"&&D?Yl(Ue,m,P,re,et):Hl(Ue,et)}else J=me.indexBuffer,G=me.segments,W=D?mu(Ue,m,P,re):hd(Ue);Ee.draw(m.context,N,f,m.stencilModeForClipping(Se),y,pi.disabled,W,Re,o.id,me.layoutVertexBuffer,J,G,o.paint,m.transform.zoom,Ae)}}function ul(m,i,o,h,f,y,w){const S=m.context,k=S.gl,C="fill-extrusion-pattern",D=o.paint.get(C),P=D.constantOr(1),N=o.getCrossfadeParameters(),H=o.paint.get("fill-extrusion-opacity"),W=D.constantOr(null);for(const J of h){const G=i.getTile(J),fe=G.getBucket(o);if(!fe)continue;const Se=m.style.map.terrain&&m.style.map.terrain.getTerrainData(J),re=fe.programConfigurations.get(o.id),me=m.useProgram(P?"fillExtrusionPattern":"fillExtrusion",re);P&&(m.context.activeTexture.set(k.TEXTURE0),G.imageAtlasTexture.bind(k.LINEAR,k.CLAMP_TO_EDGE),re.updatePaintBuffers(N)),ll(re,C,W,G,o);const Ae=m.translatePosMatrix(J.posMatrix,G,o.paint.get("fill-extrusion-translate"),o.paint.get("fill-extrusion-translate-anchor")),Ee=o.paint.get("fill-extrusion-vertical-gradient"),Re=P?va(Ae,m,Ee,H,J,N,G):pu(Ae,m,Ee,H);me.draw(S,S.gl.TRIANGLES,f,y,w,pi.backCCW,Re,Se,o.id,fe.layoutVertexBuffer,fe.indexBuffer,fe.segments,o.paint,m.transform.zoom,re,m.style.map.terrain&&fe.centroidVertexBuffer)}}function _m(m,i,o,h,f,y,w){const S=m.context,k=S.gl,C=o.fbo;if(!C)return;const D=m.useProgram("hillshade"),P=m.style.map.terrain&&m.style.map.terrain.getTerrainData(i);S.activeTexture.set(k.TEXTURE0),k.bindTexture(k.TEXTURE_2D,C.colorAttachment.get()),D.draw(S,k.TRIANGLES,f,y,w,pi.disabled,((N,H,W,J)=>{const G=W.paint.get("hillshade-shadow-color"),fe=W.paint.get("hillshade-highlight-color"),Se=W.paint.get("hillshade-accent-color");let re=W.paint.get("hillshade-illumination-direction")*(Math.PI/180);W.paint.get("hillshade-illumination-anchor")==="viewport"&&(re-=N.transform.angle);const me=!N.options.moving;return{u_matrix:J?J.posMatrix:N.transform.calculatePosMatrix(H.tileID.toUnwrapped(),me),u_image:0,u_latrange:yu(0,H.tileID),u_light:[W.paint.get("hillshade-exaggeration"),re],u_shadow:G,u_highlight:fe,u_accent:Se}})(m,o,h,P?i:null),P,h.id,m.rasterBoundsBuffer,m.quadTriangleIndexBuffer,m.rasterBoundsSegments)}function zu(m,i,o,h,f,y){const w=m.context,S=w.gl,k=i.dem;if(k&&k.data){const C=k.dim,D=k.stride,P=k.getPixels();if(w.activeTexture.set(S.TEXTURE1),w.pixelStoreUnpackPremultiplyAlpha.set(!1),i.demTexture=i.demTexture||m.getTileTexture(D),i.demTexture){const H=i.demTexture;H.update(P,{premultiply:!1}),H.bind(S.NEAREST,S.CLAMP_TO_EDGE)}else i.demTexture=new Me(w,P,S.RGBA,{premultiply:!1}),i.demTexture.bind(S.NEAREST,S.CLAMP_TO_EDGE);w.activeTexture.set(S.TEXTURE0);let N=i.fbo;if(!N){const H=new Me(w,{width:C,height:C,data:null},S.RGBA);H.bind(S.LINEAR,S.CLAMP_TO_EDGE),N=i.fbo=w.createFramebuffer(C,C,!0,!1),N.colorAttachment.set(H.texture)}w.bindFramebuffer.set(N.framebuffer),w.viewport.set([0,0,C,C]),m.useProgram("hillshadePrepare").draw(w,S.TRIANGLES,h,f,y,pi.disabled,((H,W)=>{const J=W.stride,G=c.Z();return c.aS(G,0,c.N,-c.N,0,0,1),c.$(G,G,[0,-c.N,0]),{u_matrix:G,u_image:1,u_dimension:[J,J],u_zoom:H.overscaledZ,u_unpack:W.getUnpackVector()}})(i.tileID,k),null,o.id,m.rasterBoundsBuffer,m.quadTriangleIndexBuffer,m.rasterBoundsSegments),i.needsHillshadePrepare=!1}}function vm(m,i,o,h,f,y){const w=h.paint.get("raster-fade-duration");if(!y&&w>0){const S=c.h.now(),k=(S-m.timeAdded)/w,C=i?(S-i.timeAdded)/w:-1,D=o.getSource(),P=f.coveringZoomLevel({tileSize:D.tileSize,roundZoom:D.roundZoom}),N=!i||Math.abs(i.tileID.overscaledZ-P)>Math.abs(m.tileID.overscaledZ-P),H=N&&m.refreshedUponExpiration?1:c.ad(N?k:1-C,0,1);return m.refreshedUponExpiration&&k>=1&&(m.refreshedUponExpiration=!1),i?{opacity:1,mix:1-H}:{opacity:H,mix:0}}return{opacity:1,mix:0}}const Td=new c.aT(1,0,0,1),uc=new c.aT(0,1,0,1),Bu=new c.aT(0,0,1,1),kd=new c.aT(1,0,1,1),Ad=new c.aT(0,1,1,1);function hl(m,i,o,h){dc(m,0,i+o/2,m.transform.width,o,h)}function hc(m,i,o,h){dc(m,i-o/2,0,o,m.transform.height,h)}function dc(m,i,o,h,f,y){const w=m.context,S=w.gl;S.enable(S.SCISSOR_TEST),S.scissor(i*m.pixelRatio,o*m.pixelRatio,h*m.pixelRatio,f*m.pixelRatio),w.clear({color:y}),S.disable(S.SCISSOR_TEST)}function Ed(m,i,o){const h=m.context,f=h.gl,y=o.posMatrix,w=m.useProgram("debug"),S=kr.disabled,k=Si.disabled,C=m.colorModeForRenderPass(),D="$debug",P=m.style.map.terrain&&m.style.map.terrain.getTerrainData(o);h.activeTexture.set(f.TEXTURE0);const N=i.getTileByID(o.key).latestRawTileData,H=Math.floor((N&&N.byteLength||0)/1024),W=i.getTile(o).tileSize,J=512/Math.min(W,512)*(o.overscaledZ/m.transform.zoom)*.5;let G=o.canonical.toString();o.overscaledZ!==o.canonical.z&&(G+=` => ${o.overscaledZ}`),function(fe,Se){fe.initDebugOverlayCanvas();const re=fe.debugOverlayCanvas,me=fe.context.gl,Ae=fe.debugOverlayCanvas.getContext("2d");Ae.clearRect(0,0,re.width,re.height),Ae.shadowColor="white",Ae.shadowBlur=2,Ae.lineWidth=1.5,Ae.strokeStyle="white",Ae.textBaseline="top",Ae.font="bold 36px Open Sans, sans-serif",Ae.fillText(Se,5,5),Ae.strokeText(Se,5,5),fe.debugOverlayTexture.update(re),fe.debugOverlayTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE)}(m,`${G} ${H}kB`),w.draw(h,f.TRIANGLES,S,k,wi.alphaBlended,pi.disabled,sl(y,c.aT.transparent,J),null,D,m.debugBuffer,m.quadTriangleIndexBuffer,m.debugSegments),w.draw(h,f.LINE_STRIP,S,k,C,pi.disabled,sl(y,c.aT.red),P,D,m.debugBuffer,m.tileBorderIndexBuffer,m.debugSegments)}function Ci(m,i,o){const h=m.context,f=h.gl,y=m.colorModeForRenderPass(),w=new kr(f.LEQUAL,kr.ReadWrite,m.depthRangeFor3D),S=m.useProgram("terrain"),k=i.getTerrainMesh();h.bindFramebuffer.set(null),h.viewport.set([0,0,m.width,m.height]);for(const C of o){const D=m.renderToTexture.getTexture(C),P=i.getTerrainData(C.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,D.texture);const N={u_matrix:m.transform.calculatePosMatrix(C.tileID.toUnwrapped()),u_texture:0,u_ele_delta:i.getMeshFrameDelta(m.transform.zoom)};S.draw(h,f.TRIANGLES,w,Si.disabled,y,pi.backCCW,N,P,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}}class Ya{constructor(i,o){this.context=new ym(i),this.transform=o,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.Z(),renderTime:0},this.setup(),this.numSublayers=Vr.maxUnderzooming+Vr.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Gl}resize(i,o,h){if(this.width=Math.floor(i*h),this.height=Math.floor(o*h),this.pixelRatio=h,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const f of this.style._order)this.style._layers[f].resize()}setup(){const i=this.context,o=new c.a_;o.emplaceBack(0,0),o.emplaceBack(c.N,0),o.emplaceBack(0,c.N),o.emplaceBack(c.N,c.N),this.tileExtentBuffer=i.createVertexBuffer(o,Zl.members),this.tileExtentSegments=c.S.simpleSegment(0,0,4,2);const h=new c.a_;h.emplaceBack(0,0),h.emplaceBack(c.N,0),h.emplaceBack(0,c.N),h.emplaceBack(c.N,c.N),this.debugBuffer=i.createVertexBuffer(h,Zl.members),this.debugSegments=c.S.simpleSegment(0,0,4,5);const f=new c.V;f.emplaceBack(0,0,0,0),f.emplaceBack(c.N,0,c.N,0),f.emplaceBack(0,c.N,0,c.N),f.emplaceBack(c.N,c.N,c.N,c.N),this.rasterBoundsBuffer=i.createVertexBuffer(f,Nt.members),this.rasterBoundsSegments=c.S.simpleSegment(0,0,4,2);const y=new c.a_;y.emplaceBack(0,0),y.emplaceBack(1,0),y.emplaceBack(0,1),y.emplaceBack(1,1),this.viewportBuffer=i.createVertexBuffer(y,Zl.members),this.viewportSegments=c.S.simpleSegment(0,0,4,2);const w=new c.a$;w.emplaceBack(0),w.emplaceBack(1),w.emplaceBack(3),w.emplaceBack(2),w.emplaceBack(0),this.tileBorderIndexBuffer=i.createIndexBuffer(w);const S=new c.b0;S.emplaceBack(0,1,2),S.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=i.createIndexBuffer(S);const k=this.context.gl;this.stencilClearMode=new Si({func:k.ALWAYS,mask:0},0,255,k.ZERO,k.ZERO,k.ZERO)}clearStencil(){const i=this.context,o=i.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const h=c.Z();c.aS(h,0,this.width,this.height,0,0,1),c.a0(h,h,[o.drawingBufferWidth,o.drawingBufferHeight,0]),this.useProgram("clippingMask").draw(i,o.TRIANGLES,kr.disabled,this.stencilClearMode,wi.disabled,pi.disabled,dd(h),null,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(i,o){if(this.currentStencilSource===i.source||!i.isTileClipped()||!o||!o.length)return;this.currentStencilSource=i.source;const h=this.context,f=h.gl;this.nextStencilID+o.length>256&&this.clearStencil(),h.setColorMode(wi.disabled),h.setDepthMode(kr.disabled);const y=this.useProgram("clippingMask");this._tileClippingMaskIDs={};for(const w of o){const S=this._tileClippingMaskIDs[w.key]=this.nextStencilID++,k=this.style.map.terrain&&this.style.map.terrain.getTerrainData(w);y.draw(h,f.TRIANGLES,kr.disabled,new Si({func:f.ALWAYS,mask:0},S,255,f.KEEP,f.KEEP,f.REPLACE),wi.disabled,pi.disabled,dd(w.posMatrix),k,"$clipping",this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const i=this.nextStencilID++,o=this.context.gl;return new Si({func:o.NOTEQUAL,mask:255},i,255,o.KEEP,o.KEEP,o.REPLACE)}stencilModeForClipping(i){const o=this.context.gl;return new Si({func:o.EQUAL,mask:255},this._tileClippingMaskIDs[i.key],0,o.KEEP,o.KEEP,o.REPLACE)}stencilConfigForOverlap(i){const o=this.context.gl,h=i.sort((w,S)=>S.overscaledZ-w.overscaledZ),f=h[h.length-1].overscaledZ,y=h[0].overscaledZ-f+1;if(y>1){this.currentStencilSource=void 0,this.nextStencilID+y>256&&this.clearStencil();const w={};for(let S=0;S=0;this.currentLayer--){const k=this.style._layers[h[this.currentLayer]],C=f[k.source],D=y[k.source];this._renderTileClippingMasks(k,D),this.renderLayer(this,C,k,D)}for(this.renderPass="translucent",this.currentLayer=0;this.currentLayerG.source&&!G.isHidden(D)?[C.sourceCaches[G.source]]:[]),H=N.filter(G=>G.getSource().type==="vector"),W=N.filter(G=>G.getSource().type!=="vector"),J=G=>{(!P||P.getSource().maxzoomJ(G)),P||W.forEach(G=>J(G)),P}(this.style,this.transform.zoom);k&&function(C,D,P){for(let N=0;NH.style.map.terrain.getElevation(Ee,$t,Et):null)}}}(k,y,S,w,S.layout.get("text-rotation-alignment"),S.layout.get("text-pitch-alignment"),C),S.paint.get("icon-opacity").constantOr(1)!==0&&cc(y,w,S,k,!1,S.paint.get("icon-translate"),S.paint.get("icon-translate-anchor"),S.layout.get("icon-rotation-alignment"),S.layout.get("icon-pitch-alignment"),S.layout.get("icon-keep-upright"),D,P),S.paint.get("text-opacity").constantOr(1)!==0&&cc(y,w,S,k,!0,S.paint.get("text-translate"),S.paint.get("text-translate-anchor"),S.layout.get("text-rotation-alignment"),S.layout.get("text-pitch-alignment"),S.layout.get("text-keep-upright"),D,P),w.map.showCollisionBoxes&&(Id(y,w,S,k,S.paint.get("text-translate"),S.paint.get("text-translate-anchor"),!0),Id(y,w,S,k,S.paint.get("icon-translate"),S.paint.get("icon-translate-anchor"),!1))})(i,o,h,f,this.style.placement.variableOffsets);break;case"circle":(function(y,w,S,k){if(y.renderPass!=="translucent")return;const C=S.paint.get("circle-opacity"),D=S.paint.get("circle-stroke-width"),P=S.paint.get("circle-stroke-opacity"),N=!S.layout.get("circle-sort-key").isConstant();if(C.constantOr(1)===0&&(D.constantOr(1)===0||P.constantOr(1)===0))return;const H=y.context,W=H.gl,J=y.depthModeForSublayer(0,kr.ReadOnly),G=Si.disabled,fe=y.colorModeForRenderPass(),Se=[];for(let re=0;rere.sortKey-me.sortKey);for(const re of Se){const{programConfiguration:me,program:Ae,layoutVertexBuffer:Ee,indexBuffer:Re,uniformValues:Ke,terrainData:Ue}=re.state;Ae.draw(H,W.TRIANGLES,J,G,fe,pi.disabled,Ke,Ue,S.id,Ee,Re,re.segments,S.paint,y.transform.zoom,me)}})(i,o,h,f);break;case"heatmap":(function(y,w,S,k){if(S.paint.get("heatmap-opacity")!==0)if(y.renderPass==="offscreen"){const C=y.context,D=C.gl,P=Si.disabled,N=new wi([D.ONE,D.ONE],c.aT.transparent,[!0,!0,!0,!0]);(function(H,W,J){const G=H.gl;H.activeTexture.set(G.TEXTURE1),H.viewport.set([0,0,W.width/4,W.height/4]);let fe=J.heatmapFbo;if(fe)G.bindTexture(G.TEXTURE_2D,fe.colorAttachment.get()),H.bindFramebuffer.set(fe.framebuffer);else{const Se=G.createTexture();G.bindTexture(G.TEXTURE_2D,Se),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_S,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_WRAP_T,G.CLAMP_TO_EDGE),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MIN_FILTER,G.LINEAR),G.texParameteri(G.TEXTURE_2D,G.TEXTURE_MAG_FILTER,G.LINEAR),fe=J.heatmapFbo=H.createFramebuffer(W.width/4,W.height/4,!1,!1),function(re,me,Ae,Ee){var Re,Ke;const Ue=re.gl,et=(Re=re.HALF_FLOAT)!==null&&Re!==void 0?Re:Ue.UNSIGNED_BYTE,Tt=(Ke=re.RGBA16F)!==null&&Ke!==void 0?Ke:Ue.RGBA;Ue.texImage2D(Ue.TEXTURE_2D,0,Tt,me.width/4,me.height/4,0,Ue.RGBA,et,null),Ee.colorAttachment.set(Ae)}(H,W,Se,fe)}})(C,y,S),C.clear({color:c.aT.transparent});for(let H=0;H{const re=c.Z();c.aS(re,0,J.width,J.height,0,0,1);const me=J.context.gl;return{u_matrix:re,u_world:[me.drawingBufferWidth,me.drawingBufferHeight],u_image:0,u_color_ramp:1,u_opacity:G.paint.get("heatmap-opacity")}})(C,D),null,D.id,C.viewportBuffer,C.quadTriangleIndexBuffer,C.viewportSegments,D.paint,C.transform.zoom)}(y,S))})(i,o,h,f);break;case"line":(function(y,w,S,k){if(y.renderPass!=="translucent")return;const C=S.paint.get("line-opacity"),D=S.paint.get("line-width");if(C.constantOr(1)===0||D.constantOr(1)===0)return;const P=y.depthModeForSublayer(0,kr.ReadOnly),N=y.colorModeForRenderPass(),H=S.paint.get("line-dasharray"),W=S.paint.get("line-pattern"),J=W.constantOr(1),G=S.paint.get("line-gradient"),fe=S.getCrossfadeParameters(),Se=J?"linePattern":H?"lineSDF":G?"lineGradient":"line",re=y.context,me=re.gl;let Ae=!0;for(const Ee of k){const Re=w.getTile(Ee);if(J&&!Re.patternsLoaded())continue;const Ke=Re.getBucket(S);if(!Ke)continue;const Ue=Ke.programConfigurations.get(S.id),et=y.context.program.get(),Tt=y.useProgram(Se,Ue),_r=Ae||Tt.program!==et,st=y.style.map.terrain&&y.style.map.terrain.getTerrainData(Ee),$t=W.constantOr(null);if($t&&Re.imageAtlas){const gr=Re.imageAtlas,or=gr.patternPositions[$t.to.toString()],vr=gr.patternPositions[$t.from.toString()];or&&vr&&Ue.setConstantPatternPositions(or,vr)}const Et=st?Ee:null,Gr=J?um(y,Re,S,fe,Et):H?pd(y,Re,S,H,fe,Et):G?fd(y,Re,S,Ke.lineClipsArray.length,Et):_u(y,Re,S,Et);if(J)re.activeTexture.set(me.TEXTURE0),Re.imageAtlasTexture.bind(me.LINEAR,me.CLAMP_TO_EDGE),Ue.updatePaintBuffers(fe);else if(H&&(_r||y.lineAtlas.dirty))re.activeTexture.set(me.TEXTURE0),y.lineAtlas.bind(re);else if(G){const gr=Ke.gradients[S.id];let or=gr.texture;if(S.gradientVersion!==gr.version){let vr=256;if(S.stepInterpolant){const Fi=w.getSource().maxzoom,si=Ee.canonical.z===Fi?Math.ceil(1<0?o.pop():null}isPatternMissing(i){if(!i)return!1;if(!i.from||!i.to)return!0;const o=this.imageManager.getPattern(i.from.toString()),h=this.imageManager.getPattern(i.to.toString());return!o||!h}useProgram(i,o){this.cache=this.cache||{};const h=i+(o?o.cacheKey:"")+(this._showOverdrawInspector?"/overdraw":"")+(this.style.map.terrain?"/terrain":"");return this.cache[h]||(this.cache[h]=new Wl(this.context,xi[i],o,Jl[i],this._showOverdrawInspector,this.style.map.terrain)),this.cache[h]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const i=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(i.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Me(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:i,drawingBufferHeight:o}=this.context.gl;return this.width!==i||this.height!==o}}class Nn{constructor(i,o){this.points=i,this.planes=o}static fromInvProjectionMatrix(i,o,h){const f=Math.pow(2,h),y=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(S=>{const k=1/(S=c.ag([],S,i))[3]/o*f;return c.b3(S,S,[k,k,1/S[3],k])}),w=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(S=>{const k=function(N,H){var W=H[0],J=H[1],G=H[2],fe=W*W+J*J+G*G;return fe>0&&(fe=1/Math.sqrt(fe)),N[0]=H[0]*fe,N[1]=H[1]*fe,N[2]=H[2]*fe,N}([],function(N,H,W){var J=H[0],G=H[1],fe=H[2],Se=W[0],re=W[1],me=W[2];return N[0]=G*me-fe*re,N[1]=fe*Se-J*me,N[2]=J*re-G*Se,N}([],De([],y[S[0]],y[S[1]]),De([],y[S[2]],y[S[1]]))),C=-((D=k)[0]*(P=y[S[1]])[0]+D[1]*P[1]+D[2]*P[2]);var D,P;return k.concat(C)});return new Nn(y,w)}}class Eo{constructor(i,o){this.min=i,this.max=o,this.center=function(h,f,y){return h[0]=.5*f[0],h[1]=.5*f[1],h[2]=.5*f[2],h}([],function(h,f,y){return h[0]=f[0]+y[0],h[1]=f[1]+y[1],h[2]=f[2]+y[2],h}([],this.min,this.max))}quadrant(i){const o=[i%2==0,i<2],h=pe(this.min),f=pe(this.max);for(let y=0;y=0&&w++;if(w===0)return 0;w!==o.length&&(h=!1)}if(h)return 2;for(let f=0;f<3;f++){let y=Number.MAX_VALUE,w=-Number.MAX_VALUE;for(let S=0;Sthis.max[f]-this.min[f])return 0}return 1}}class dl{constructor(i=0,o=0,h=0,f=0){if(isNaN(i)||i<0||isNaN(o)||o<0||isNaN(h)||h<0||isNaN(f)||f<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=i,this.bottom=o,this.left=h,this.right=f}interpolate(i,o,h){return o.top!=null&&i.top!=null&&(this.top=c.B.number(i.top,o.top,h)),o.bottom!=null&&i.bottom!=null&&(this.bottom=c.B.number(i.bottom,o.bottom,h)),o.left!=null&&i.left!=null&&(this.left=c.B.number(i.left,o.left,h)),o.right!=null&&i.right!=null&&(this.right=c.B.number(i.right,o.right,h)),this}getCenter(i,o){const h=c.ad((this.left+i-this.right)/2,0,i),f=c.ad((this.top+o-this.bottom)/2,0,o);return new c.P(h,f)}equals(i){return this.top===i.top&&this.bottom===i.bottom&&this.left===i.left&&this.right===i.right}clone(){return new dl(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}class fc{constructor(i,o,h,f,y){this.tileSize=512,this.maxValidLatitude=85.051129,this._renderWorldCopies=y===void 0||!!y,this._minZoom=i||0,this._maxZoom=o||22,this._minPitch=h??0,this._maxPitch=f??60,this.setMaxBounds(),this.width=0,this.height=0,this._center=new c.L(0,0),this._elevation=0,this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._unmodified=!0,this._edgeInsets=new dl,this._posMatrixCache={},this._alignedPosMatrixCache={},this._minEleveationForCurrentTile=0}clone(){const i=new fc(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies);return i.apply(this),i}apply(i){this.tileSize=i.tileSize,this.latRange=i.latRange,this.width=i.width,this.height=i.height,this._center=i._center,this._elevation=i._elevation,this._minEleveationForCurrentTile=i._minEleveationForCurrentTile,this.zoom=i.zoom,this.angle=i.angle,this._fov=i._fov,this._pitch=i._pitch,this._unmodified=i._unmodified,this._edgeInsets=i._edgeInsets.clone(),this._calcMatrices()}get minZoom(){return this._minZoom}set minZoom(i){this._minZoom!==i&&(this._minZoom=i,this.zoom=Math.max(this.zoom,i))}get maxZoom(){return this._maxZoom}set maxZoom(i){this._maxZoom!==i&&(this._maxZoom=i,this.zoom=Math.min(this.zoom,i))}get minPitch(){return this._minPitch}set minPitch(i){this._minPitch!==i&&(this._minPitch=i,this.pitch=Math.max(this.pitch,i))}get maxPitch(){return this._maxPitch}set maxPitch(i){this._maxPitch!==i&&(this._maxPitch=i,this.pitch=Math.min(this.pitch,i))}get renderWorldCopies(){return this._renderWorldCopies}set renderWorldCopies(i){i===void 0?i=!0:i===null&&(i=!1),this._renderWorldCopies=i}get worldSize(){return this.tileSize*this.scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new c.P(this.width,this.height)}get bearing(){return-this.angle/Math.PI*180}set bearing(i){const o=-c.b5(i,-180,180)*Math.PI/180;this.angle!==o&&(this._unmodified=!1,this.angle=o,this._calcMatrices(),this.rotationMatrix=function(){var h=new c.A(4);return c.A!=Float32Array&&(h[1]=0,h[2]=0),h[0]=1,h[3]=1,h}(),function(h,f,y){var w=f[0],S=f[1],k=f[2],C=f[3],D=Math.sin(y),P=Math.cos(y);h[0]=w*P+k*D,h[1]=S*P+C*D,h[2]=w*-D+k*P,h[3]=S*-D+C*P}(this.rotationMatrix,this.rotationMatrix,this.angle))}get pitch(){return this._pitch/Math.PI*180}set pitch(i){const o=c.ad(i,this.minPitch,this.maxPitch)/180*Math.PI;this._pitch!==o&&(this._unmodified=!1,this._pitch=o,this._calcMatrices())}get fov(){return this._fov/Math.PI*180}set fov(i){i=Math.max(.01,Math.min(60,i)),this._fov!==i&&(this._unmodified=!1,this._fov=i/180*Math.PI,this._calcMatrices())}get zoom(){return this._zoom}set zoom(i){const o=Math.min(Math.max(i,this.minZoom),this.maxZoom);this._zoom!==o&&(this._unmodified=!1,this._zoom=o,this.tileZoom=Math.max(0,Math.floor(o)),this.scale=this.zoomScale(o),this._constrain(),this._calcMatrices())}get center(){return this._center}set center(i){i.lat===this._center.lat&&i.lng===this._center.lng||(this._unmodified=!1,this._center=i,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}set elevation(i){i!==this._elevation&&(this._elevation=i,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}set padding(i){this._edgeInsets.equals(i)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,i,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this.width,this.height)}isPaddingEqual(i){return this._edgeInsets.equals(i)}interpolatePadding(i,o,h){this._unmodified=!1,this._edgeInsets.interpolate(i,o,h),this._constrain(),this._calcMatrices()}coveringZoomLevel(i){const o=(i.roundZoom?Math.round:Math.floor)(this.zoom+this.scaleZoom(this.tileSize/i.tileSize));return Math.max(0,o)}getVisibleUnwrappedCoordinates(i){const o=[new c.b6(0,i)];if(this._renderWorldCopies){const h=this.pointCoordinate(new c.P(0,0)),f=this.pointCoordinate(new c.P(this.width,0)),y=this.pointCoordinate(new c.P(this.width,this.height)),w=this.pointCoordinate(new c.P(0,this.height)),S=Math.floor(Math.min(h.x,f.x,y.x,w.x)),k=Math.floor(Math.max(h.x,f.x,y.x,w.x)),C=1;for(let D=S-C;D<=k+C;D++)D!==0&&o.push(new c.b6(D,i))}return o}coveringTiles(i){var o,h;let f=this.coveringZoomLevel(i);const y=f;if(i.minzoom!==void 0&&fi.maxzoom&&(f=i.maxzoom);const w=this.pointCoordinate(this.getCameraPoint()),S=c.U.fromLngLat(this.center),k=Math.pow(2,f),C=[k*w.x,k*w.y,0],D=[k*S.x,k*S.y,0],P=Nn.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,f);let N=i.minzoom||0;!i.terrain&&this.pitch<=60&&this._edgeInsets.top<.1&&(N=f);const H=i.terrain?2/Math.min(this.tileSize,i.tileSize)*this.tileSize:3,W=re=>({aabb:new Eo([re*k,0,0],[(re+1)*k,k,0]),zoom:0,x:0,y:0,wrap:re,fullyVisible:!1}),J=[],G=[],fe=f,Se=i.reparseOverscaled?y:f;if(this._renderWorldCopies)for(let re=1;re<=3;re++)J.push(W(-re)),J.push(W(re));for(J.push(W(0));J.length>0;){const re=J.pop(),me=re.x,Ae=re.y;let Ee=re.fullyVisible;if(!Ee){const Tt=re.aabb.intersects(P);if(Tt===0)continue;Ee=Tt===2}const Re=i.terrain?C:D,Ke=re.aabb.distanceX(Re),Ue=re.aabb.distanceY(Re),et=Math.max(Math.abs(Ke),Math.abs(Ue));if(re.zoom===fe||et>H+(1<=N){const Tt=fe-re.zoom,_r=C[0]-.5-(me<>1),$t=re.zoom+1;let Et=re.aabb.quadrant(Tt);if(i.terrain){const Gr=new c.O($t,re.wrap,$t,_r,st),gr=i.terrain.getMinMaxElevation(Gr),or=(o=gr.minElevation)!==null&&o!==void 0?o:this.elevation,vr=(h=gr.maxElevation)!==null&&h!==void 0?h:this.elevation;Et=new Eo([Et.min[0],Et.min[1],or],[Et.max[0],Et.max[1],vr])}J.push({aabb:Et,zoom:$t,x:_r,y:st,wrap:re.wrap,fullyVisible:Ee})}}return G.sort((re,me)=>re.distanceSq-me.distanceSq).map(re=>re.tileID)}resize(i,o){this.width=i,this.height=o,this.pixelsToGLUnits=[2/i,-2/o],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(i){return Math.pow(2,i)}scaleZoom(i){return Math.log(i)/Math.LN2}project(i){const o=c.ad(i.lat,-this.maxValidLatitude,this.maxValidLatitude);return new c.P(c.G(i.lng)*this.worldSize,c.H(o)*this.worldSize)}unproject(i){return new c.U(i.x/this.worldSize,i.y/this.worldSize).toLngLat()}get point(){return this.project(this.center)}getCameraPosition(){return{lngLat:this.pointLocation(this.getCameraPoint()),altitude:Math.cos(this._pitch)*this.cameraToCenterDistance/this._pixelPerMeter+this.elevation}}recalculateZoom(i){const o=this.pointLocation(this.centerPoint,i),h=i.getElevationForLngLatZoom(o,this.tileZoom);if(!(this.elevation-h))return;const f=this.getCameraPosition(),y=c.U.fromLngLat(f.lngLat,f.altitude),w=c.U.fromLngLat(o,h),S=y.x-w.x,k=y.y-w.y,C=y.z-w.z,D=Math.sqrt(S*S+k*k+C*C),P=this.scaleZoom(this.cameraToCenterDistance/D/this.tileSize);this._elevation=h,this._center=o,this.zoom=P}setLocationAtPoint(i,o){const h=this.pointCoordinate(o),f=this.pointCoordinate(this.centerPoint),y=this.locationCoordinate(i),w=new c.U(y.x-(h.x-f.x),y.y-(h.y-f.y));this.center=this.coordinateLocation(w),this._renderWorldCopies&&(this.center=this.center.wrap())}locationPoint(i,o){return o?this.coordinatePoint(this.locationCoordinate(i),o.getElevationForLngLatZoom(i,this.tileZoom),this.pixelMatrix3D):this.coordinatePoint(this.locationCoordinate(i))}pointLocation(i,o){return this.coordinateLocation(this.pointCoordinate(i,o))}locationCoordinate(i){return c.U.fromLngLat(i)}coordinateLocation(i){return i&&i.toLngLat()}pointCoordinate(i,o){if(o){const N=o.pointCoordinate(i);if(N!=null)return N}const h=[i.x,i.y,0,1],f=[i.x,i.y,1,1];c.ag(h,h,this.pixelMatrixInverse),c.ag(f,f,this.pixelMatrixInverse);const y=h[3],w=f[3],S=h[1]/y,k=f[1]/w,C=h[2]/y,D=f[2]/w,P=C===D?0:(0-C)/(D-C);return new c.U(c.B.number(h[0]/y,f[0]/w,P)/this.worldSize,c.B.number(S,k,P)/this.worldSize)}coordinatePoint(i,o=0,h=this.pixelMatrix){const f=[i.x*this.worldSize,i.y*this.worldSize,o,1];return c.ag(f,f,h),new c.P(f[0]/f[3],f[1]/f[3])}getBounds(){const i=Math.max(0,this.height/2-this.getHorizon());return new Mt().extend(this.pointLocation(new c.P(0,i))).extend(this.pointLocation(new c.P(this.width,i))).extend(this.pointLocation(new c.P(this.width,this.height))).extend(this.pointLocation(new c.P(0,this.height)))}getMaxBounds(){return this.latRange&&this.latRange.length===2&&this.lngRange&&this.lngRange.length===2?new Mt([this.lngRange[0],this.latRange[0]],[this.lngRange[1],this.latRange[1]]):null}getHorizon(){return Math.tan(Math.PI/2-this._pitch)*this.cameraToCenterDistance*.85}setMaxBounds(i){i?(this.lngRange=[i.getWest(),i.getEast()],this.latRange=[i.getSouth(),i.getNorth()],this._constrain()):(this.lngRange=null,this.latRange=[-this.maxValidLatitude,this.maxValidLatitude])}calculatePosMatrix(i,o=!1){const h=i.key,f=o?this._alignedPosMatrixCache:this._posMatrixCache;if(f[h])return f[h];const y=i.canonical,w=this.worldSize/this.zoomScale(y.z),S=y.x+Math.pow(2,y.z)*i.wrap,k=c.ao(new Float64Array(16));return c.$(k,k,[S*w,y.y*w,0]),c.a0(k,k,[w/c.N,w/c.N,1]),c.a1(k,o?this.alignedProjMatrix:this.projMatrix,k),f[h]=new Float32Array(k),f[h]}customLayerMatrix(){return this.mercatorMatrix.slice()}_constrain(){if(!this.center||!this.width||!this.height||this._constraining)return;this._constraining=!0;let i,o,h,f,y=-90,w=90,S=-180,k=180;const C=this.size,D=this._unmodified;if(this.latRange){const H=this.latRange;y=c.H(H[1])*this.worldSize,w=c.H(H[0])*this.worldSize,i=w-yw&&(f=w-W)}if(this.lngRange){const H=(S+k)/2,W=c.b5(P.x,H-this.worldSize/2,H+this.worldSize/2),J=C.x/2;W-Jk&&(h=k-J)}h===void 0&&f===void 0||(this.center=this.unproject(new c.P(h!==void 0?h:P.x,f!==void 0?f:P.y)).wrap()),this._unmodified=D,this._constraining=!1}_calcMatrices(){if(!this.height)return;const i=this.centerOffset,o=this.point.x,h=this.point.y;this.cameraToCenterDistance=.5/Math.tan(this._fov/2)*this.height,this._pixelPerMeter=c.b7(1,this.center.lat)*this.worldSize;let f=c.ao(new Float64Array(16));c.a0(f,f,[this.width/2,-this.height/2,1]),c.$(f,f,[1,-1,0]),this.labelPlaneMatrix=f,f=c.ao(new Float64Array(16)),c.a0(f,f,[1,-1,1]),c.$(f,f,[-1,-1,0]),c.a0(f,f,[2/this.width,2/this.height,1]),this.glCoordMatrix=f;const y=this.cameraToCenterDistance+this._elevation*this._pixelPerMeter/Math.cos(this._pitch),w=Math.min(this.elevation,this._minEleveationForCurrentTile),S=y-w*this._pixelPerMeter/Math.cos(this._pitch),k=w<0?S:y,C=Math.PI/2+this._pitch,D=this._fov*(.5+i.y/this.height),P=Math.sin(D)*k/Math.sin(c.ad(Math.PI-C-D,.01,Math.PI-.01)),N=this.getHorizon(),H=2*Math.atan(N/this.cameraToCenterDistance)*(.5+i.y/(2*N)),W=Math.sin(H)*k/Math.sin(c.ad(Math.PI-C-H,.01,Math.PI-.01)),J=Math.min(P,W),G=1.01*(Math.cos(Math.PI/2-this._pitch)*J+k),fe=this.height/50;f=new Float64Array(16),c.b8(f,this._fov,this.width/this.height,fe,G),f[8]=2*-i.x/this.width,f[9]=2*i.y/this.height,c.a0(f,f,[1,-1,1]),c.$(f,f,[0,0,-this.cameraToCenterDistance]),c.b9(f,f,this._pitch),c.ae(f,f,this.angle),c.$(f,f,[-o,-h,0]),this.mercatorMatrix=c.a0([],f,[this.worldSize,this.worldSize,this.worldSize]),c.a0(f,f,[1,1,this._pixelPerMeter]),this.pixelMatrix=c.a1(new Float64Array(16),this.labelPlaneMatrix,f),c.$(f,f,[0,0,-this.elevation]),this.projMatrix=f,this.invProjMatrix=c.as([],f),this.pixelMatrix3D=c.a1(new Float64Array(16),this.labelPlaneMatrix,f);const Se=this.width%2/2,re=this.height%2/2,me=Math.cos(this.angle),Ae=Math.sin(this.angle),Ee=o-Math.round(o)+me*Se+Ae*re,Re=h-Math.round(h)+me*re+Ae*Se,Ke=new Float64Array(f);if(c.$(Ke,Ke,[Ee>.5?Ee-1:Ee,Re>.5?Re-1:Re,0]),this.alignedProjMatrix=Ke,f=c.as(new Float64Array(16),this.pixelMatrix),!f)throw new Error("failed to invert matrix");this.pixelMatrixInverse=f,this._posMatrixCache={},this._alignedPosMatrixCache={}}maxPitchScaleFactor(){if(!this.pixelMatrixInverse)return 1;const i=this.pointCoordinate(new c.P(0,0)),o=[i.x*this.worldSize,i.y*this.worldSize,0,1];return c.ag(o,o,this.pixelMatrix)[3]/this.cameraToCenterDistance}getCameraPoint(){const i=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new c.P(0,i))}getCameraQueryGeometry(i){const o=this.getCameraPoint();if(i.length===1)return[i[0],o];{let h=o.x,f=o.y,y=o.x,w=o.y;for(const S of i)h=Math.min(h,S.x),f=Math.min(f,S.y),y=Math.max(y,S.x),w=Math.max(w,S.y);return[new c.P(h,f),new c.P(y,f),new c.P(y,w),new c.P(h,w),new c.P(h,f)]}}}function Ka(m,i){let o,h=!1,f=null,y=null;const w=()=>{f=null,h&&(m.apply(y,o),f=setTimeout(w,i),h=!1)};return(...S)=>(h=!0,y=this,o=S,f||w(),f)}class fl{constructor(i){this._getCurrentHash=()=>{const o=window.location.hash.replace("#","");if(this._hashName){let h;return o.split("&").map(f=>f.split("=")).forEach(f=>{f[0]===this._hashName&&(h=f)}),(h&&h[1]||"").split("/")}return o.split("/")},this._onHashChange=()=>{const o=this._getCurrentHash();if(o.length>=3&&!o.some(h=>isNaN(h))){const h=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(o[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+o[2],+o[1]],zoom:+o[0],bearing:h,pitch:+(o[4]||0)}),!0}return!1},this._updateHashUnthrottled=()=>{const o=window.location.href.replace(/(#.+)?$/,this.getHashString());try{window.history.replaceState(window.history.state,null,o)}catch{}},this._updateHash=Ka(this._updateHashUnthrottled,300),this._hashName=i&&encodeURIComponent(i)}addTo(i){return this._map=i,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),delete this._map,this}getHashString(i){const o=this._map.getCenter(),h=Math.round(100*this._map.getZoom())/100,f=Math.ceil((h*Math.LN2+Math.log(512/360/.5))/Math.LN10),y=Math.pow(10,f),w=Math.round(o.lng*y)/y,S=Math.round(o.lat*y)/y,k=this._map.getBearing(),C=this._map.getPitch();let D="";if(D+=i?`/${w}/${S}/${h}`:`${h}/${S}/${w}`,(k||C)&&(D+="/"+Math.round(10*k)/10),C&&(D+=`/${Math.round(C)}`),this._hashName){const P=this._hashName;let N=!1;const H=window.location.hash.slice(1).split("&").map(W=>{const J=W.split("=")[0];return J===P?(N=!0,`${J}=${D}`):W}).filter(W=>W);return N||H.push(`${P}=${D}`),`#${H.join("&")}`}return`#${D}`}}const Co={linearity:.3,easing:c.ba(0,0,.3,1)},Cd=c.e({deceleration:2500,maxSpeed:1400},Co),Md=c.e({deceleration:20,maxSpeed:1400},Co),Dd=c.e({deceleration:1e3,maxSpeed:360},Co),Pd=c.e({deceleration:1e3,maxSpeed:90},Co);class Ld{constructor(i){this._map=i,this.clear()}clear(){this._inertiaBuffer=[]}record(i){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:c.h.now(),settings:i})}_drainInertiaBuffer(){const i=this._inertiaBuffer,o=c.h.now();for(;i.length>0&&o-i[0].time>160;)i.shift()}_onMoveEnd(i){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const o={zoom:0,bearing:0,pitch:0,pan:new c.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:y}of this._inertiaBuffer)o.zoom+=y.zoomDelta||0,o.bearing+=y.bearingDelta||0,o.pitch+=y.pitchDelta||0,y.panDelta&&o.pan._add(y.panDelta),y.around&&(o.around=y.around),y.pinchAround&&(o.pinchAround=y.pinchAround);const h=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,f={};if(o.pan.mag()){const y=pl(o.pan.mag(),h,c.e({},Cd,i||{}));f.offset=o.pan.mult(y.amount/o.pan.mag()),f.center=this._map.transform.center,Os(f,y)}if(o.zoom){const y=pl(o.zoom,h,Md);f.zoom=this._map.transform.zoom+y.amount,Os(f,y)}if(o.bearing){const y=pl(o.bearing,h,Dd);f.bearing=this._map.transform.bearing+c.ad(y.amount,-179,179),Os(f,y)}if(o.pitch){const y=pl(o.pitch,h,Pd);f.pitch=this._map.transform.pitch+y.amount,Os(f,y)}if(f.zoom||f.bearing){const y=o.pinchAround===void 0?o.around:o.pinchAround;f.around=y?this._map.unproject(y):this._map.getCenter()}return this.clear(),c.e(f,{noMoveStart:!0})}}function Os(m,i){(!m.duration||m.durationo.unproject(k)),S=y.reduce((k,C,D,P)=>k.add(C.div(P.length)),new c.P(0,0));super(i,{points:y,point:S,lngLats:w,lngLat:o.unproject(S),originalEvent:h}),this._defaultPrevented=!1}}class zd extends c.k{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(i,o,h){super(i,{originalEvent:h}),this._defaultPrevented=!1}}class Bd{constructor(i,o){this._map=i,this._clickTolerance=o.clickTolerance}reset(){delete this._mousedownPos}wheel(i){return this._firePreventable(new zd(i.type,this._map,i))}mousedown(i,o){return this._mousedownPos=o,this._firePreventable(new es(i.type,this._map,i))}mouseup(i){this._map.fire(new es(i.type,this._map,i))}click(i,o){this._mousedownPos&&this._mousedownPos.dist(o)>=this._clickTolerance||this._map.fire(new es(i.type,this._map,i))}dblclick(i){return this._firePreventable(new es(i.type,this._map,i))}mouseover(i){this._map.fire(new es(i.type,this._map,i))}mouseout(i){this._map.fire(new es(i.type,this._map,i))}touchstart(i){return this._firePreventable(new ml(i.type,this._map,i))}touchmove(i){this._map.fire(new ml(i.type,this._map,i))}touchend(i){this._map.fire(new ml(i.type,this._map,i))}touchcancel(i){this._map.fire(new ml(i.type,this._map,i))}_firePreventable(i){if(this._map.fire(i),i.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Rd{constructor(i){this._map=i}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(i){this._map.fire(new es(i.type,this._map,i))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new es("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(i){this._delayContextMenu?this._contextMenuEvent=i:this._ignoreContextMenu||this._map.fire(new es(i.type,this._map,i)),this._map.listens("contextmenu")&&i.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ta{constructor(i){this._map=i}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(i){return this.transform.pointLocation(c.P.convert(i),this._map.terrain)}}class Fd{constructor(i,o){this._map=i,this._tr=new ta(i),this._el=i.getCanvasContainer(),this._container=i.getContainer(),this._clickTolerance=o.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(i,o){this.isEnabled()&&i.shiftKey&&i.button===0&&(T.disableDrag(),this._startPos=this._lastPos=o,this._active=!0)}mousemoveWindow(i,o){if(!this._active)return;const h=o;if(this._lastPos.equals(h)||!this._box&&h.dist(this._startPos)y.fitScreenCoordinates(h,f,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",i)}keydown(i){this._active&&i.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",i))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(T.remove(this._box),this._box=null),T.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(i,o){return this._map.fire(new c.k(i,{originalEvent:o}))}}function ys(m,i){if(m.length!==i.length)throw new Error(`The number of touches and points are not equal - touches ${m.length}, points ${i.length}`);const o={};for(let h=0;hthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=i.timeStamp),h.length===this.numTouches&&(this.centroid=function(f){const y=new c.P(0,0);for(const w of f)y._add(w);return y.div(f.length)}(o),this.touches=ys(h,o)))}touchmove(i,o,h){if(this.aborted||!this.centroid)return;const f=ys(h,o);for(const y in this.touches){const w=f[y];(!w||w.dist(this.touches[y])>30)&&(this.aborted=!0)}}touchend(i,o,h){if((!this.centroid||i.timeStamp-this.startTime>500)&&(this.aborted=!0),h.length===0){const f=!this.aborted&&this.centroid;if(this.reset(),f)return f}}}class pc{constructor(i){this.singleTap=new ra(i),this.numTaps=i.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(i,o,h){this.singleTap.touchstart(i,o,h)}touchmove(i,o,h){this.singleTap.touchmove(i,o,h)}touchend(i,o,h){const f=this.singleTap.touchend(i,o,h);if(f){const y=i.timeStamp-this.lastTime<500,w=!this.lastTap||this.lastTap.dist(f)<30;if(y&&w||this.reset(),this.count++,this.lastTime=i.timeStamp,this.lastTap=f,this.count===this.numTaps)return this.reset(),f}}}class ia{constructor(i){this._tr=new ta(i),this._zoomIn=new pc({numTouches:1,numTaps:2}),this._zoomOut=new pc({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(i,o,h){this._zoomIn.touchstart(i,o,h),this._zoomOut.touchstart(i,o,h)}touchmove(i,o,h){this._zoomIn.touchmove(i,o,h),this._zoomOut.touchmove(i,o,h)}touchend(i,o,h){const f=this._zoomIn.touchend(i,o,h),y=this._zoomOut.touchend(i,o,h),w=this._tr;return f?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:S=>S.easeTo({duration:300,zoom:w.zoom+1,around:w.unproject(f)},{originalEvent:i})}):y?(this._active=!0,i.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:S=>S.easeTo({duration:300,zoom:w.zoom-1,around:w.unproject(y)},{originalEvent:i})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class na{constructor(i){this._enabled=!!i.enable,this._moveStateManager=i.moveStateManager,this._clickTolerance=i.clickTolerance||1,this._moveFunction=i.move,this._activateOnStart=!!i.activateOnStart,i.assignEvents(this),this.reset()}reset(i){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(i)}_move(...i){const o=this._moveFunction(...i);if(o.bearingDelta||o.pitchDelta||o.around||o.panDelta)return this._active=!0,o}dragStart(i,o){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(i)&&(this._moveStateManager.startMove(i),this._lastPoint=o.length?o[0]:o,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(i,o){if(!this.isEnabled())return;const h=this._lastPoint;if(!h)return;if(i.preventDefault(),!this._moveStateManager.isValidMoveEvent(i))return void this.reset(i);const f=o.length?o[0]:o;return!this._moved&&f.dist(h){m.mousedown=m.dragStart,m.mousemoveWindow=m.dragMove,m.mouseup=m.dragEnd,m.contextmenu=function(i){i.preventDefault()}},Mo=({enable:m,clickTolerance:i,bearingDegreesPerPixelMoved:o=.8})=>{const h=new Ru({checkCorrectEvent:f=>T.mouseButton(f)===0&&f.ctrlKey||T.mouseButton(f)===2});return new na({clickTolerance:i,move:(f,y)=>({bearingDelta:(y.x-f.x)*o}),moveStateManager:h,enable:m,assignEvents:mc})},sa=({enable:m,clickTolerance:i,pitchDegreesPerPixelMoved:o=-.5})=>{const h=new Ru({checkCorrectEvent:f=>T.mouseButton(f)===0&&f.ctrlKey||T.mouseButton(f)===2});return new na({clickTolerance:i,move:(f,y)=>({pitchDelta:(y.y-f.y)*o}),moveStateManager:h,enable:m,assignEvents:mc})};class yt{constructor(i,o){this._minTouches=i.cooperativeGestures?2:1,this._clickTolerance=i.clickTolerance||1,this._map=o,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.P(0,0),setTimeout(()=>{this._cancelCooperativeMessage=!1},200)}touchstart(i,o,h){return this._calculateTransform(i,o,h)}touchmove(i,o,h){if(this._map._cooperativeGestures&&(this._minTouches===2&&h.length<2&&!this._cancelCooperativeMessage?this._map._onCooperativeGesture(i,!1,h.length):this._cancelCooperativeMessage||(this._cancelCooperativeMessage=!0)),this._active&&!(h.length0&&(this._active=!0);const f=ys(h,o),y=new c.P(0,0),w=new c.P(0,0);let S=0;for(const C in f){const D=f[C],P=this._touches[C];P&&(y._add(D),w._add(D.sub(P)),S++,f[C]=D)}if(this._touches=f,SMath.abs(m.x)}class xm extends gc{constructor(i){super(),this._map=i}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(i,o,h){super.touchstart(i,o,h),this._currentTouchCount=h.length}_start(i){this._lastPoints=i,Ou(i[0].sub(i[1]))&&(this._valid=!1)}_move(i,o,h){if(this._map._cooperativeGestures&&this._currentTouchCount<3)return;const f=i[0].sub(this._lastPoints[0]),y=i[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(f,y,h.timeStamp),this._valid?(this._lastPoints=i,this._active=!0,{pitchDelta:(f.y+y.y)/2*-.5}):void 0}gestureBeginsVertically(i,o,h){if(this._valid!==void 0)return this._valid;const f=i.mag()>=2,y=o.mag()>=2;if(!f&&!y)return;if(!f||!y)return this._firstMove===void 0&&(this._firstMove=h),h-this._firstMove<100&&void 0;const w=i.y>0==o.y>0;return Ou(i)&&Ou(o)&&w}}const Nu={panStep:100,bearingStep:15,pitchStep:10};class Ud{constructor(i){this._tr=new ta(i);const o=Nu;this._panStep=o.panStep,this._bearingStep=o.bearingStep,this._pitchStep=o.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(i){if(i.altKey||i.ctrlKey||i.metaKey)return;let o=0,h=0,f=0,y=0,w=0;switch(i.keyCode){case 61:case 107:case 171:case 187:o=1;break;case 189:case 109:case 173:o=-1;break;case 37:i.shiftKey?h=-1:(i.preventDefault(),y=-1);break;case 39:i.shiftKey?h=1:(i.preventDefault(),y=1);break;case 38:i.shiftKey?f=1:(i.preventDefault(),w=-1);break;case 40:i.shiftKey?f=-1:(i.preventDefault(),w=1);break;default:return}return this._rotationDisabled&&(h=0,f=0),{cameraAnimation:S=>{const k=this._tr;S.easeTo({duration:300,easeId:"keyboardHandler",easing:$d,zoom:o?Math.round(k.zoom)+o*(i.shiftKey?2:1):k.zoom,bearing:k.bearing+h*this._bearingStep,pitch:k.pitch+f*this._pitchStep,offset:[-y*this._panStep,-w*this._panStep],center:k.center},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function $d(m){return m*(2-m)}const Vd=4.000244140625;class wm{constructor(i,o){this._onTimeout=h=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(h)},this._map=i,this._tr=new ta(i),this._el=i.getCanvasContainer(),this._triggerRenderFrame=o,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(i){this._defaultZoomRate=i}setWheelZoomRate(i){this._wheelZoomRate=i}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(i){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!i&&i.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}wheel(i){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!i[this._map._metaKey])return;i.preventDefault()}let o=i.deltaMode===WheelEvent.DOM_DELTA_LINE?40*i.deltaY:i.deltaY;const h=c.h.now(),f=h-(this._lastWheelEventTime||0);this._lastWheelEventTime=h,o!==0&&o%Vd==0?this._type="wheel":o!==0&&Math.abs(o)<4?this._type="trackpad":f>400?(this._type=null,this._lastValue=o,this._timeout=setTimeout(this._onTimeout,40,i)):this._type||(this._type=Math.abs(f*o)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,o+=this._lastValue)),i.shiftKey&&o&&(o/=4),this._type&&(this._lastWheelEvent=i,this._delta-=o,this._active||this._start(i)),i.preventDefault()}_start(i){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const o=T.mousePos(this._el,i),h=this._tr;this._around=c.L.convert(this._aroundCenter?h.center:h.unproject(o)),this._aroundPoint=h.transform.locationPoint(this._around),this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const i=this._tr.transform;if(this._delta!==0){const S=this._type==="wheel"&&Math.abs(this._delta)>Vd?this._wheelZoomRate:this._defaultZoomRate;let k=2/(1+Math.exp(-Math.abs(this._delta*S)));this._delta<0&&k!==0&&(k=1/k);const C=typeof this._targetZoom=="number"?i.zoomScale(this._targetZoom):i.scale;this._targetZoom=Math.min(i.maxZoom,Math.max(i.minZoom,i.scaleZoom(C*k))),this._type==="wheel"&&(this._startZoom=i.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const o=typeof this._targetZoom=="number"?this._targetZoom:i.zoom,h=this._startZoom,f=this._easing;let y,w=!1;if(this._type==="wheel"&&h&&f){const S=Math.min((c.h.now()-this._lastWheelEventTime)/200,1),k=f(S);y=c.B.number(h,o,k),S<1?this._frameId||(this._frameId=!0):w=!0}else y=o,w=!0;return this._active=!0,w&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200)),{noInertia:!0,needsRenderFrame:!w,zoomDelta:y-i.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(i){let o=c.bb;if(this._prevEase){const h=this._prevEase,f=(c.h.now()-h.start)/h.duration,y=h.easing(f+.01)-h.easing(f),w=.27/Math.sqrt(y*y+1e-4)*.01,S=Math.sqrt(.0729-w*w);o=c.ba(w,S,.25,1)}return this._prevEase={start:c.h.now(),duration:i,easing:o},o}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class Uu{constructor(i,o){this._clickZoom=i,this._tapZoom=o}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class $u{constructor(i){this._tr=new ta(i),this.reset()}reset(){this._active=!1}dblclick(i,o){return i.preventDefault(),{cameraAnimation:h=>{h.easeTo({duration:300,zoom:this._tr.zoom+(i.shiftKey?-1:1),around:this._tr.unproject(o)},{originalEvent:i})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Vu{constructor(){this._tap=new pc({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(i,o,h){if(!this._swipePoint)if(this._tapTime){const f=o[0],y=i.timeStamp-this._tapTime<500,w=this._tapPoint.dist(f)<30;y&&w?h.length>0&&(this._swipePoint=f,this._swipeTouch=h[0].identifier):this.reset()}else this._tap.touchstart(i,o,h)}touchmove(i,o,h){if(this._tapTime){if(this._swipePoint){if(h[0].identifier!==this._swipeTouch)return;const f=o[0],y=f.y-this._swipePoint.y;return this._swipePoint=f,i.preventDefault(),this._active=!0,{zoomDelta:y/128}}}else this._tap.touchmove(i,o,h)}touchend(i,o,h){if(this._tapTime)this._swipePoint&&h.length===0&&this.reset();else{const f=this._tap.touchend(i,o,h);f&&(this._tapTime=i.timeStamp,this._tapPoint=f)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ju{constructor(i,o,h){this._el=i,this._mousePan=o,this._touchPan=h}enable(i){this._inertiaOptions=i||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class Un{constructor(i,o,h){this._pitchWithRotate=i.pitchWithRotate,this._mouseRotate=o,this._mousePitch=h}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class Ia{constructor(i,o,h,f){this._el=i,this._touchZoom=o,this._touchRotate=h,this._tapDragZoom=f,this._rotationDisabled=!1,this._enabled=!0}enable(i){this._touchZoom.enable(i),this._rotationDisabled||this._touchRotate.enable(i),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const gl=m=>m.zoom||m.drag||m.pitch||m.rotate;class qu extends c.k{}function yl(m){return m.panDelta&&m.panDelta.mag()||m.zoomDelta||m.bearingDelta||m.pitchDelta}class Gu{constructor(i,o){this.handleWindowEvent=f=>{this.handleEvent(f,`${f.type}Window`)},this.handleEvent=(f,y)=>{if(f.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const w=f.type==="renderFrame"?void 0:f,S={needsRenderFrame:!1},k={},C={},D=f.touches,P=D?this._getMapTouches(D):void 0,N=P?T.touchPos(this._el,P):T.mousePos(this._el,f);for(const{handlerName:J,handler:G,allowed:fe}of this._handlers){if(!G.isEnabled())continue;let Se;this._blockedByActive(C,fe,J)?G.reset():G[y||f.type]&&(Se=G[y||f.type](f,N,P),this.mergeHandlerResult(S,k,Se,J,w),Se&&Se.needsRenderFrame&&this._triggerRenderFrame()),(Se||G.isActive())&&(C[J]=G)}const H={};for(const J in this._previousActiveHandlers)C[J]||(H[J]=w);this._previousActiveHandlers=C,(Object.keys(H).length||yl(S))&&(this._changes.push([S,k,H]),this._triggerRenderFrame()),(Object.keys(C).length||yl(S))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:W}=S;W&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],W(this._map))},this._map=i,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ld(i),this._bearingSnap=o.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(o);const h=this._el;this._listeners=[[h,"touchstart",{passive:!0}],[h,"touchmove",{passive:!1}],[h,"touchend",void 0],[h,"touchcancel",void 0],[h,"mousedown",void 0],[h,"mousemove",void 0],[h,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[h,"mouseover",void 0],[h,"mouseout",void 0],[h,"dblclick",void 0],[h,"click",void 0],[h,"keydown",{capture:!1}],[h,"keyup",void 0],[h,"wheel",{passive:!1}],[h,"contextmenu",void 0],[window,"blur",void 0]];for(const[f,y,w]of this._listeners)T.addEventListener(f,y,f===document?this.handleWindowEvent:this.handleEvent,w)}destroy(){for(const[i,o,h]of this._listeners)T.removeEventListener(i,o,i===document?this.handleWindowEvent:this.handleEvent,h)}_addDefaultHandlers(i){const o=this._map,h=o.getCanvasContainer();this._add("mapEvent",new Bd(o,i));const f=o.boxZoom=new Fd(o,i);this._add("boxZoom",f),i.interactive&&i.boxZoom&&f.enable();const y=new ia(o),w=new $u(o);o.doubleClickZoom=new Uu(w,y),this._add("tapZoom",y),this._add("clickZoom",w),i.interactive&&i.doubleClickZoom&&o.doubleClickZoom.enable();const S=new Vu;this._add("tapDragZoom",S);const k=o.touchPitch=new xm(o);this._add("touchPitch",k),i.interactive&&i.touchPitch&&o.touchPitch.enable(i.touchPitch);const C=Mo(i),D=sa(i);o.dragRotate=new Un(i,C,D),this._add("mouseRotate",C,["mousePitch"]),this._add("mousePitch",D,["mouseRotate"]),i.interactive&&i.dragRotate&&o.dragRotate.enable();const P=(({enable:fe,clickTolerance:Se})=>{const re=new Ru({checkCorrectEvent:me=>T.mouseButton(me)===0&&!me.ctrlKey});return new na({clickTolerance:Se,move:(me,Ae)=>({around:Ae,panDelta:Ae.sub(me)}),activateOnStart:!0,moveStateManager:re,enable:fe,assignEvents:mc})})(i),N=new yt(i,o);o.dragPan=new ju(h,P,N),this._add("mousePan",P),this._add("touchPan",N,["touchZoom","touchRotate"]),i.interactive&&i.dragPan&&o.dragPan.enable(i.dragPan);const H=new Fu,W=new Nd;o.touchZoomRotate=new Ia(h,W,H,S),this._add("touchRotate",H,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),i.interactive&&i.touchZoomRotate&&o.touchZoomRotate.enable(i.touchZoomRotate);const J=o.scrollZoom=new wm(o,()=>this._triggerRenderFrame());this._add("scrollZoom",J,["mousePan"]),i.interactive&&i.scrollZoom&&o.scrollZoom.enable(i.scrollZoom);const G=o.keyboard=new Ud(o);this._add("keyboard",G),i.interactive&&i.keyboard&&o.keyboard.enable(),this._add("blockableMapEvent",new Rd(o))}_add(i,o,h){this._handlers.push({handlerName:i,handler:o,allowed:h}),this._handlersById[i]=o}stop(i){if(!this._updatingCamera){for(const{handler:o}of this._handlers)o.reset();this._inertia.clear(),this._fireEvents({},{},i),this._changes=[]}}isActive(){for(const{handler:i}of this._handlers)if(i.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!gl(this._eventsInProgress)||this.isZooming()}_blockedByActive(i,o,h){for(const f in i)if(f!==h&&(!o||o.indexOf(f)<0))return!0;return!1}_getMapTouches(i){const o=[];for(const h of i)this._el.contains(h.target)&&o.push(h);return o}mergeHandlerResult(i,o,h,f,y){if(!h)return;c.e(i,h);const w={handlerName:f,originalEvent:h.originalEvent||y};h.zoomDelta!==void 0&&(o.zoom=w),h.panDelta!==void 0&&(o.drag=w),h.pitchDelta!==void 0&&(o.pitch=w),h.bearingDelta!==void 0&&(o.rotate=w)}_applyChanges(){const i={},o={},h={};for(const[f,y,w]of this._changes)f.panDelta&&(i.panDelta=(i.panDelta||new c.P(0,0))._add(f.panDelta)),f.zoomDelta&&(i.zoomDelta=(i.zoomDelta||0)+f.zoomDelta),f.bearingDelta&&(i.bearingDelta=(i.bearingDelta||0)+f.bearingDelta),f.pitchDelta&&(i.pitchDelta=(i.pitchDelta||0)+f.pitchDelta),f.around!==void 0&&(i.around=f.around),f.pinchAround!==void 0&&(i.pinchAround=f.pinchAround),f.noInertia&&(i.noInertia=f.noInertia),c.e(o,y),c.e(h,w);this._updateMapTransform(i,o,h),this._changes=[]}_updateMapTransform(i,o,h){const f=this._map,y=f._getTransformForUpdate(),w=f.terrain;if(!(yl(i)||w&&this._terrainMovement))return this._fireEvents(o,h,!0);let{panDelta:S,zoomDelta:k,bearingDelta:C,pitchDelta:D,around:P,pinchAround:N}=i;N!==void 0&&(P=N),f._stop(!0),P=P||f.transform.centerPoint;const H=y.pointLocation(S?P.sub(S):P);C&&(y.bearing+=C),D&&(y.pitch+=D),k&&(y.zoom+=k),w?this._terrainMovement||!o.drag&&!o.zoom?o.drag&&this._terrainMovement?y.center=y.pointLocation(y.centerPoint.sub(S)):y.setLocationAtPoint(H,P):(this._terrainMovement=!0,this._map._elevationFreeze=!0,y.setLocationAtPoint(H,P),this._map.once("moveend",()=>{this._map._elevationFreeze=!1,this._terrainMovement=!1,y.recalculateZoom(f.terrain)})):y.setLocationAtPoint(H,P),f._applyUpdatedTransform(y),this._map._update(),i.noInertia||this._inertia.record(i),this._fireEvents(o,h,!0)}_fireEvents(i,o,h){const f=gl(this._eventsInProgress),y=gl(i),w={};for(const D in i){const{originalEvent:P}=i[D];this._eventsInProgress[D]||(w[`${D}start`]=P),this._eventsInProgress[D]=i[D]}!f&&y&&this._fireEvent("movestart",y.originalEvent);for(const D in w)this._fireEvent(D,w[D]);y&&this._fireEvent("move",y.originalEvent);for(const D in i){const{originalEvent:P}=i[D];this._fireEvent(D,P)}const S={};let k;for(const D in this._eventsInProgress){const{handlerName:P,originalEvent:N}=this._eventsInProgress[D];this._handlersById[P].isActive()||(delete this._eventsInProgress[D],k=o[P]||N,S[`${D}end`]=k)}for(const D in S)this._fireEvent(D,S[D]);const C=gl(this._eventsInProgress);if(h&&(f||y)&&!C){this._updatingCamera=!0;const D=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),P=N=>N!==0&&-this._bearingSnap{delete this._frameId,this.handleEvent(new qu("renderFrame",{timeStamp:i})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class jd extends c.E{constructor(i,o){super(),this._renderFrameCallback=()=>{const h=Math.min((c.h.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(h)),h<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=i,this._bearingSnap=o.bearingSnap,this.on("moveend",()=>{delete this._requestedCameraState})}getCenter(){return new c.L(this.transform.center.lng,this.transform.center.lat)}setCenter(i,o){return this.jumpTo({center:i},o)}panBy(i,o,h){return i=c.P.convert(i).mult(-1),this.panTo(this.transform.center,c.e({offset:i},o),h)}panTo(i,o,h){return this.easeTo(c.e({center:i},o),h)}getZoom(){return this.transform.zoom}setZoom(i,o){return this.jumpTo({zoom:i},o),this}zoomTo(i,o,h){return this.easeTo(c.e({zoom:i},o),h)}zoomIn(i,o){return this.zoomTo(this.getZoom()+1,i,o),this}zoomOut(i,o){return this.zoomTo(this.getZoom()-1,i,o),this}getBearing(){return this.transform.bearing}setBearing(i,o){return this.jumpTo({bearing:i},o),this}getPadding(){return this.transform.padding}setPadding(i,o){return this.jumpTo({padding:i},o),this}rotateTo(i,o,h){return this.easeTo(c.e({bearing:i},o),h)}resetNorth(i,o){return this.rotateTo(0,c.e({duration:1e3},i),o),this}resetNorthPitch(i,o){return this.easeTo(c.e({bearing:0,pitch:0,duration:1e3},i),o),this}snapToNorth(i,o){return Math.abs(this.getBearing()){if(this._zooming&&(h.zoom=c.B.number(f,k,Ee)),this._rotating&&(h.bearing=c.B.number(y,C,Ee)),this._pitching&&(h.pitch=c.B.number(w,D,Ee)),this._padding&&(h.interpolatePadding(S,P,Ee),H=h.centerPoint.add(N)),this.terrain&&!i.freezeElevation&&this._updateElevation(Ee),re)h.setLocationAtPoint(re,me);else{const Re=h.zoomScale(h.zoom-f),Ke=k>f?Math.min(2,Se):Math.max(.5,Se),Ue=Math.pow(Ke,1-Ee),et=h.unproject(G.add(fe.mult(Ee*Ue)).mult(Re));h.setLocationAtPoint(h.renderWorldCopies?et.wrap():et,H)}this._applyUpdatedTransform(h),this._fireMoveEvents(o)},Ee=>{this.terrain&&this._finalizeElevation(),this._afterEase(o,Ee)},i),this}_prepareEase(i,o,h={}){this._moving=!0,o||h.moving||this.fire(new c.k("movestart",i)),this._zooming&&!h.zooming&&this.fire(new c.k("zoomstart",i)),this._rotating&&!h.rotating&&this.fire(new c.k("rotatestart",i)),this._pitching&&!h.pitching&&this.fire(new c.k("pitchstart",i))}_prepareElevation(i){this._elevationCenter=i,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(i){this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);const o=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(i<1&&o!==this._elevationTarget){const h=this._elevationTarget-this._elevationStart;this._elevationStart+=i*(h-(o-(h*i+this._elevationStart))/(1-i)),this._elevationTarget=o}this.transform.elevation=c.B.number(this._elevationStart,this._elevationTarget,i)}_finalizeElevation(){this._elevationFreeze=!1,this.transform.recalculateZoom(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_applyUpdatedTransform(i){if(!this.transformCameraUpdate)return;const o=i.clone(),{center:h,zoom:f,pitch:y,bearing:w,elevation:S}=this.transformCameraUpdate(o);h&&(o.center=h),f!==void 0&&(o.zoom=f),y!==void 0&&(o.pitch=y),w!==void 0&&(o.bearing=w),S!==void 0&&(o.elevation=S),this.transform.apply(o)}_fireMoveEvents(i){this.fire(new c.k("move",i)),this._zooming&&this.fire(new c.k("zoom",i)),this._rotating&&this.fire(new c.k("rotate",i)),this._pitching&&this.fire(new c.k("pitch",i))}_afterEase(i,o){if(this._easeId&&o&&this._easeId===o)return;delete this._easeId;const h=this._zooming,f=this._rotating,y=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,h&&this.fire(new c.k("zoomend",i)),f&&this.fire(new c.k("rotateend",i)),y&&this.fire(new c.k("pitchend",i)),this.fire(new c.k("moveend",i))}flyTo(i,o){if(!i.essential&&c.h.prefersReducedMotion){const Et=c.F(i,["center","zoom","bearing","pitch","around"]);return this.jumpTo(Et,o)}this.stop(),i=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.bb},i);const h=this._getTransformForUpdate(),f=this.getZoom(),y=this.getBearing(),w=this.getPitch(),S=this.getPadding(),k="zoom"in i?c.ad(+i.zoom,h.minZoom,h.maxZoom):f,C="bearing"in i?this._normalizeBearing(i.bearing,y):y,D="pitch"in i?+i.pitch:w,P="padding"in i?i.padding:h.padding,N=h.zoomScale(k-f),H=c.P.convert(i.offset);let W=h.centerPoint.add(H);const J=h.pointLocation(W),G=c.L.convert(i.center||J);this._normalizeCenter(G);const fe=h.project(J),Se=h.project(G).sub(fe);let re=i.curve;const me=Math.max(h.width,h.height),Ae=me/N,Ee=Se.mag();if("minZoom"in i){const Et=c.ad(Math.min(i.minZoom,f,k),h.minZoom,h.maxZoom),Gr=me/h.zoomScale(Et-f);re=Math.sqrt(Gr/Ee*2)}const Re=re*re;function Ke(Et){const Gr=(Ae*Ae-me*me+(Et?-1:1)*Re*Re*Ee*Ee)/(2*(Et?Ae:me)*Re*Ee);return Math.log(Math.sqrt(Gr*Gr+1)-Gr)}function Ue(Et){return(Math.exp(Et)-Math.exp(-Et))/2}function et(Et){return(Math.exp(Et)+Math.exp(-Et))/2}const Tt=Ke(!1);let _r=function(Et){return et(Tt)/et(Tt+re*Et)},st=function(Et){return me*((et(Tt)*(Ue(Gr=Tt+re*Et)/et(Gr))-Ue(Tt))/Re)/Ee;var Gr},$t=(Ke(!0)-Tt)/re;if(Math.abs(Ee)<1e-6||!isFinite($t)){if(Math.abs(me-Ae)<1e-6)return this.easeTo(i,o);const Et=Aei.maxDuration&&(i.duration=0),this._zooming=!0,this._rotating=y!==C,this._pitching=D!==w,this._padding=!h.isPaddingEqual(P),this._prepareEase(o,!1),this.terrain&&this._prepareElevation(G),this._ease(Et=>{const Gr=Et*$t,gr=1/_r(Gr);h.zoom=Et===1?k:f+h.scaleZoom(gr),this._rotating&&(h.bearing=c.B.number(y,C,Et)),this._pitching&&(h.pitch=c.B.number(w,D,Et)),this._padding&&(h.interpolatePadding(S,P,Et),W=h.centerPoint.add(H)),this.terrain&&!i.freezeElevation&&this._updateElevation(Et);const or=Et===1?G:h.unproject(fe.add(Se.mult(st(Gr))).mult(gr));h.setLocationAtPoint(h.renderWorldCopies?or.wrap():or,W),this._applyUpdatedTransform(h),this._fireMoveEvents(o)},()=>{this.terrain&&this._finalizeElevation(),this._afterEase(o)},i),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(i,o){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const h=this._onEaseEnd;delete this._onEaseEnd,h.call(this,o)}if(!i){const h=this.handlers;h&&h.stop(!1)}return this}_ease(i,o,h){h.animate===!1||h.duration===0?(i(1),o()):(this._easeStart=c.h.now(),this._easeOptions=h,this._onEaseFrame=i,this._onEaseEnd=o,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(i,o){i=c.b5(i,-180,180);const h=Math.abs(i-o);return Math.abs(i-360-o)180?-360:h<-180?360:0}queryTerrainElevation(i){return this.terrain?this.terrain.getElevationForLngLatZoom(c.L.convert(i),this.transform.tileZoom)-this.transform.elevation:null}}class ts{constructor(i={}){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=o=>{!o||o.sourceDataType!=="metadata"&&o.sourceDataType!=="visibility"&&o.dataType!=="style"&&o.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=i}getDefaultPosition(){return"bottom-right"}onAdd(i){return this._map=i,this._compact=this.options&&this.options.compact,this._container=T.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=T.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=T.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){T.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(i,o){const h=this._map._getUIString(`AttributionControl.${o}`);i.title=h,i.setAttribute("aria-label",h)}_updateAttributions(){if(!this._map.style)return;let i=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?i=i.concat(this.options.customAttribution.map(f=>typeof f!="string"?"":f)):typeof this.options.customAttribution=="string"&&i.push(this.options.customAttribution)),this._map.style.stylesheet){const f=this._map.style.stylesheet;this.styleOwner=f.owner,this.styleId=f.id}const o=this._map.style.sourceCaches;for(const f in o){const y=o[f];if(y.used||y.usedForTerrain){const w=y.getSource();w.attribution&&i.indexOf(w.attribution)<0&&i.push(w.attribution)}}i=i.filter(f=>String(f).trim()),i.sort((f,y)=>f.length-y.length),i=i.filter((f,y)=>{for(let w=y+1;w=0)return!1;return!0});const h=i.join(" | ");h!==this._attribHTML&&(this._attribHTML=h,i.length?(this._innerContainer.innerHTML=h,this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class ui{constructor(i={}){this._updateCompact=()=>{const o=this._container.children;if(o.length){const h=o[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&h.classList.add("maplibregl-compact"):h.classList.remove("maplibregl-compact")}},this.options=i}getDefaultPosition(){return"bottom-left"}onAdd(i){this._map=i,this._compact=this.options&&this.options.compact,this._container=T.create("div","maplibregl-ctrl");const o=T.create("a","maplibregl-ctrl-logo");return o.target="_blank",o.rel="noopener nofollow",o.href="https://maplibre.org/",o.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),o.setAttribute("rel","noopener nofollow"),this._container.appendChild(o),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){T.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class yc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(i){const o=++this._id;return this._queue.push({callback:i,id:o,cancelled:!1}),o}remove(i){const o=this._currentlyRunning,h=o?this._queue.concat(o):this._queue;for(const f of h)if(f.id===i)return void(f.cancelled=!0)}run(i=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const o=this._currentlyRunning=this._queue;this._queue=[];for(const h of o)if(!h.cancelled&&(h.callback(i),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}const Zu={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"Mapbox logo","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","TerrainControl.enableTerrain":"Enable terrain","TerrainControl.disableTerrain":"Disable terrain"};var qd=c.Q([{name:"a_pos3d",type:"Int16",components:3}]);class Gd extends c.E{constructor(i){super(),this.sourceCache=i,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.deltaZoom=1,i.usedForTerrain=!0,i.tileSize=this.tileSize*2**this.deltaZoom}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(i,o){this.sourceCache.update(i,o),this._renderableTilesKeys=[];const h={};for(const f of i.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:o}))h[f.key]=!0,this._renderableTilesKeys.push(f.key),this._tiles[f.key]||(f.posMatrix=new Float64Array(16),c.aS(f.posMatrix,0,c.N,0,c.N,0,1),this._tiles[f.key]=new Mn(f,this.tileSize));for(const f in this._tiles)h[f]||delete this._tiles[f]}freeRtt(i){for(const o in this._tiles){const h=this._tiles[o];(!i||h.tileID.equals(i)||h.tileID.isChildOf(i)||i.isChildOf(h.tileID))&&(h.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(i=>this.getTileByID(i))}getTileByID(i){return this._tiles[i]}getTerrainCoords(i){const o={};for(const h of this._renderableTilesKeys){const f=this._tiles[h].tileID;if(f.canonical.equals(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16),c.aS(y.posMatrix,0,c.N,0,c.N,0,1),o[h]=y}else if(f.canonical.isChildOf(i.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=f.canonical.z-i.canonical.z,S=f.canonical.x-(f.canonical.x>>w<>w<>w;c.aS(y.posMatrix,0,C,0,C,0,1),c.$(y.posMatrix,y.posMatrix,[-S*C,-k*C,0]),o[h]=y}else if(i.canonical.isChildOf(f.canonical)){const y=i.clone();y.posMatrix=new Float64Array(16);const w=i.canonical.z-f.canonical.z,S=i.canonical.x-(i.canonical.x>>w<>w<>w;c.aS(y.posMatrix,0,c.N,0,c.N,0,1),c.$(y.posMatrix,y.posMatrix,[S*C,k*C,0]),c.a0(y.posMatrix,y.posMatrix,[1/2**w,1/2**w,0]),o[h]=y}}return o}getSourceTile(i,o){const h=this.sourceCache._source;let f=i.overscaledZ-this.deltaZoom;if(f>h.maxzoom&&(f=h.maxzoom),f=h.minzoom&&(!y||!y.dem);)y=this.sourceCache.getTileByID(i.scaledTo(f--).key);return y}tilesAfterTime(i=Date.now()){return Object.values(this._tiles).filter(o=>o.timeAdded>=i)}}class Zd{constructor(i,o,h){this.painter=i,this.sourceCache=new Gd(o),this.options=h,this.exaggeration=typeof h.exaggeration=="number"?h.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(i,o,h,f=c.N){var y;if(!(o>=0&&o=0&&hi.canonical.z&&(i.canonical.z>=f?y=i.canonical.z-f:c.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const w=i.canonical.x-(i.canonical.x>>y<>y<>8<<4|y>>8,o[w+3]=0;const h=new c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(o.buffer)),f=new Me(i,h,i.gl.RGBA,{premultiply:!1});return f.bind(i.gl.NEAREST,i.gl.CLAMP_TO_EDGE),this._coordsTexture=f,f}pointCoordinate(i){const o=new Uint8Array(4),h=this.painter.context,f=h.gl;h.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),f.readPixels(i.x,this.painter.height/devicePixelRatio-i.y-1,1,1,f.RGBA,f.UNSIGNED_BYTE,o),h.bindFramebuffer.set(null);const y=o[0]+(o[2]>>4<<8),w=o[1]+((15&o[2])<<8),S=this.coordsIndex[255-o[3]],k=S&&this.sourceCache.getTileByID(S);if(!k)return null;const C=this._coordsTextureSize,D=(1<0&&Math.sign(y)<0||!h&&Math.sign(f)<0&&Math.sign(y)>0?(f=360*Math.sign(y)+f,c.G(f)):o}}class Sm{constructor(i,o,h){this._context=i,this._size=o,this._tileSize=h,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const i of this._objects)i.texture.destroy(),i.fbo.destroy()}_createObject(i){const o=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),h=new Me(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return h.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),o.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),o.colorAttachment.set(h.texture),{id:i,fbo:o,texture:h,stamp:-1,inUse:!1}}getObjectForId(i){return this._objects[i]}useObject(i){i.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(o=>i.id!==o),this._recentlyUsed.push(i.id)}stampObject(i){i.stamp=++this._stamp}getOrCreateFreeObject(){for(const o of this._recentlyUsed)if(!this._objects[o].inUse)return this._objects[o];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const i=this._createObject(this._objects.length);return this._objects.push(i),i}freeObject(i){i.inUse=!1}freeAllObjects(){for(const i of this._objects)this.freeObject(i)}isFull(){return!(this._objects.length!i.inUse)===!1}}const Dn={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class _c{constructor(i,o){this.painter=i,this.terrain=o,this.pool=new Sm(i.context,30,o.sourceCache.tileSize*o.qualityFactor)}destruct(){this.pool.destruct()}getTexture(i){return this.pool.getObjectForId(i.rtt[this._stacks.length-1].id).texture}prepareForRender(i,o){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=i._order.filter(h=>!i._layers[h].isHidden(o)),this._coordsDescendingInv={};for(const h in i.sourceCaches){this._coordsDescendingInv[h]={};const f=i.sourceCaches[h].getVisibleCoordinates();for(const y of f){const w=this.terrain.sourceCache.getTerrainCoords(y);for(const S in w)this._coordsDescendingInv[h][S]||(this._coordsDescendingInv[h][S]=[]),this._coordsDescendingInv[h][S].push(w[S])}}this._coordsDescendingInvStr={};for(const h of i._order){const f=i._layers[h],y=f.source;if(Dn[f.type]&&!this._coordsDescendingInvStr[y]){this._coordsDescendingInvStr[y]={};for(const w in this._coordsDescendingInv[y])this._coordsDescendingInvStr[y][w]=this._coordsDescendingInv[y][w].map(S=>S.key).sort().join()}}for(const h of this._renderableTiles)for(const f in this._coordsDescendingInvStr){const y=this._coordsDescendingInvStr[f][h.tileID.key];y&&y!==h.rttCoords[f]&&(h.rtt=[])}}renderLayer(i){if(i.isHidden(this.painter.transform.zoom))return!1;const o=i.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===i.id;if(Dn[o]&&(this._prevType&&Dn[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(i.id),!f))return!0;if(Dn[this._prevType]||Dn[o]&&f){this._prevType=o;const y=this._stacks.length-1,w=this._stacks[y]||[];for(const S of this._renderableTiles){if(this.pool.isFull()&&(Ci(this.painter,this.terrain,this._rttTiles),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(S),S.rtt[y]){const C=this.pool.getObjectForId(S.rtt[y].id);if(C.stamp===S.rtt[y].stamp){this.pool.useObject(C);continue}}const k=this.pool.getOrCreateFreeObject();this.pool.useObject(k),this.pool.stampObject(k),S.rtt[y]={id:k.id,stamp:k.stamp},h.context.bindFramebuffer.set(k.fbo.framebuffer),h.context.clear({color:c.aT.transparent,stencil:0}),h.currentStencilSource=void 0;for(let C=0;C{m.touchstart=m.dragStart,m.touchmoveWindow=m.dragMove,m.touchend=m.dragEnd},Wu={showCompass:!0,showZoom:!0,visualizePitch:!1};class Hu{constructor(i,o,h=!1){this.mousedown=w=>{this.startMouse(c.e({},w,{ctrlKey:!0,preventDefault:()=>w.preventDefault()}),T.mousePos(this.element,w)),T.addEventListener(window,"mousemove",this.mousemove),T.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=w=>{this.moveMouse(w,T.mousePos(this.element,w))},this.mouseup=w=>{this.mouseRotate.dragEnd(w),this.mousePitch&&this.mousePitch.dragEnd(w),this.offTemp()},this.touchstart=w=>{w.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=T.touchPos(this.element,w.targetTouches)[0],this.startTouch(w,this._startPos),T.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.addEventListener(window,"touchend",this.touchend))},this.touchmove=w=>{w.targetTouches.length!==1?this.reset():(this._lastPos=T.touchPos(this.element,w.targetTouches)[0],this.moveTouch(w,this._lastPos))},this.touchend=w=>{w.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos){this.mouseRotate.reset(),this.mousePitch&&this.mousePitch.reset(),this.touchRotate.reset(),this.touchPitch&&this.touchPitch.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10;const f=i.dragRotate._mouseRotate.getClickTolerance(),y=i.dragRotate._mousePitch.getClickTolerance();this.element=o,this.mouseRotate=Mo({clickTolerance:f,enable:!0}),this.touchRotate=(({enable:w,clickTolerance:S,bearingDegreesPerPixelMoved:k=.8})=>{const C=new Od;return new na({clickTolerance:S,move:(D,P)=>({bearingDelta:(P.x-D.x)*k}),moveStateManager:C,enable:w,assignEvents:_l})})({clickTolerance:f,enable:!0}),this.map=i,h&&(this.mousePitch=sa({clickTolerance:y,enable:!0}),this.touchPitch=(({enable:w,clickTolerance:S,pitchDegreesPerPixelMoved:k=-.5})=>{const C=new Od;return new na({clickTolerance:S,move:(D,P)=>({pitchDelta:(P.y-D.y)*k}),moveStateManager:C,enable:w,assignEvents:_l})})({clickTolerance:y,enable:!0})),T.addEventListener(o,"mousedown",this.mousedown),T.addEventListener(o,"touchstart",this.touchstart,{passive:!1}),T.addEventListener(o,"touchcancel",this.reset)}startMouse(i,o){this.mouseRotate.dragStart(i,o),this.mousePitch&&this.mousePitch.dragStart(i,o),T.disableDrag()}startTouch(i,o){this.touchRotate.dragStart(i,o),this.touchPitch&&this.touchPitch.dragStart(i,o),T.disableDrag()}moveMouse(i,o){const h=this.map,{bearingDelta:f}=this.mouseRotate.dragMove(i,o)||{};if(f&&h.setBearing(h.getBearing()+f),this.mousePitch){const{pitchDelta:y}=this.mousePitch.dragMove(i,o)||{};y&&h.setPitch(h.getPitch()+y)}}moveTouch(i,o){const h=this.map,{bearingDelta:f}=this.touchRotate.dragMove(i,o)||{};if(f&&h.setBearing(h.getBearing()+f),this.touchPitch){const{pitchDelta:y}=this.touchPitch.dragMove(i,o)||{};y&&h.setPitch(h.getPitch()+y)}}off(){const i=this.element;T.removeEventListener(i,"mousedown",this.mousedown),T.removeEventListener(i,"touchstart",this.touchstart,{passive:!1}),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend),T.removeEventListener(i,"touchcancel",this.reset),this.offTemp()}offTemp(){T.enableDrag(),T.removeEventListener(window,"mousemove",this.mousemove),T.removeEventListener(window,"mouseup",this.mouseup),T.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),T.removeEventListener(window,"touchend",this.touchend)}}let Vi;function Yu(m,i,o){if(m=new c.L(m.lng,m.lat),i){const h=new c.L(m.lng-360,m.lat),f=new c.L(m.lng+360,m.lat),y=o.locationPoint(m).distSqr(i);o.locationPoint(h).distSqr(i)180;){const h=o.locationPoint(m);if(h.x>=0&&h.y>=0&&h.x<=o.width&&h.y<=o.height)break;m.lng>o.center.lng?m.lng-=360:m.lng+=360}return m}const _s={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function Wd(m,i,o){const h=m.classList;for(const f in _s)h.remove(`maplibregl-${o}-anchor-${f}`);h.add(`maplibregl-${o}-anchor-${i}`)}class Xa extends c.E{constructor(i){if(super(),this._onKeyPress=o=>{const h=o.code,f=o.charCode||o.keyCode;h!=="Space"&&h!=="Enter"&&f!==32&&f!==13||this.togglePopup()},this._onMapClick=o=>{const h=o.originalEvent.target,f=this._element;this._popup&&(h===f||f.contains(h))&&this.togglePopup()},this._update=o=>{if(!this._map)return;const h=this._map.loaded()&&!this._map.isMoving();((o==null?void 0:o.type)==="terrain"||(o==null?void 0:o.type)==="render"&&!h)&&this._map.once("render",this._update),this._map.transform.renderWorldCopies&&(this._lngLat=Yu(this._lngLat,this._pos,this._map.transform)),this._pos=this._map.project(this._lngLat)._add(this._offset);let f="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?f=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(f=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let y="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?y="rotateX(0deg)":this._pitchAlignment==="map"&&(y=`rotateX(${this._map.getPitch()}deg)`),o&&o.type!=="moveend"||(this._pos=this._pos.round()),T.setTransform(this._element,`${_s[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${y} ${f}`),this._map.terrain&&!this._opacityTimeout&&(this._opacityTimeout=setTimeout(()=>{const w=this._map.unproject(this._pos),S=40075016686e-3*Math.abs(Math.cos(this._lngLat.lat*Math.PI/180))/Math.pow(2,this._map.transform.tileZoom+8);this._element.style.opacity=w.distanceTo(this._lngLat)>20*S?"0.2":"1.0",this._opacityTimeout=null},100))},this._onMove=o=>{if(!this._isDragging){const h=this._clickTolerance||this._map._clickTolerance;this._isDragging=o.point.dist(this._pointerdownPos)>=h}this._isDragging&&(this._pos=o.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new c.k("dragstart"))),this.fire(new c.k("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new c.k("dragend")),this._state="inactive"},this._addDragHandler=o=>{this._element.contains(o.originalEvent.target)&&(o.preventDefault(),this._positionDelta=o.point.sub(this._pos).add(this._offset),this._pointerdownPos=o.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=i&&i.anchor||"center",this._color=i&&i.color||"#3FB1CE",this._scale=i&&i.scale||1,this._draggable=i&&i.draggable||!1,this._clickTolerance=i&&i.clickTolerance||0,this._isDragging=!1,this._state="inactive",this._rotation=i&&i.rotation||0,this._rotationAlignment=i&&i.rotationAlignment||"auto",this._pitchAlignment=i&&i.pitchAlignment&&i.pitchAlignment!=="auto"?i.pitchAlignment:this._rotationAlignment,i&&i.element)this._element=i.element,this._offset=c.P.convert(i&&i.offset||[0,0]);else{this._defaultMarker=!0,this._element=T.create("div"),this._element.setAttribute("aria-label","Map marker");const o=T.createNS("http://www.w3.org/2000/svg","svg"),h=41,f=27;o.setAttributeNS(null,"display","block"),o.setAttributeNS(null,"height",`${h}px`),o.setAttributeNS(null,"width",`${f}px`),o.setAttributeNS(null,"viewBox",`0 0 ${f} ${h}`);const y=T.createNS("http://www.w3.org/2000/svg","g");y.setAttributeNS(null,"stroke","none"),y.setAttributeNS(null,"stroke-width","1"),y.setAttributeNS(null,"fill","none"),y.setAttributeNS(null,"fill-rule","evenodd");const w=T.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill-rule","nonzero");const S=T.createNS("http://www.w3.org/2000/svg","g");S.setAttributeNS(null,"transform","translate(3.0, 29.0)"),S.setAttributeNS(null,"fill","#000000");const k=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const fe of k){const Se=T.createNS("http://www.w3.org/2000/svg","ellipse");Se.setAttributeNS(null,"opacity","0.04"),Se.setAttributeNS(null,"cx","10.5"),Se.setAttributeNS(null,"cy","5.80029008"),Se.setAttributeNS(null,"rx",fe.rx),Se.setAttributeNS(null,"ry",fe.ry),S.appendChild(Se)}const C=T.createNS("http://www.w3.org/2000/svg","g");C.setAttributeNS(null,"fill",this._color);const D=T.createNS("http://www.w3.org/2000/svg","path");D.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),C.appendChild(D);const P=T.createNS("http://www.w3.org/2000/svg","g");P.setAttributeNS(null,"opacity","0.25"),P.setAttributeNS(null,"fill","#000000");const N=T.createNS("http://www.w3.org/2000/svg","path");N.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),P.appendChild(N);const H=T.createNS("http://www.w3.org/2000/svg","g");H.setAttributeNS(null,"transform","translate(6.0, 7.0)"),H.setAttributeNS(null,"fill","#FFFFFF");const W=T.createNS("http://www.w3.org/2000/svg","g");W.setAttributeNS(null,"transform","translate(8.0, 8.0)");const J=T.createNS("http://www.w3.org/2000/svg","circle");J.setAttributeNS(null,"fill","#000000"),J.setAttributeNS(null,"opacity","0.25"),J.setAttributeNS(null,"cx","5.5"),J.setAttributeNS(null,"cy","5.5"),J.setAttributeNS(null,"r","5.4999962");const G=T.createNS("http://www.w3.org/2000/svg","circle");G.setAttributeNS(null,"fill","#FFFFFF"),G.setAttributeNS(null,"cx","5.5"),G.setAttributeNS(null,"cy","5.5"),G.setAttributeNS(null,"r","5.4999962"),W.appendChild(J),W.appendChild(G),w.appendChild(S),w.appendChild(C),w.appendChild(P),w.appendChild(H),w.appendChild(W),o.appendChild(w),o.setAttributeNS(null,"height",h*this._scale+"px"),o.setAttributeNS(null,"width",f*this._scale+"px"),this._element.appendChild(o),this._offset=c.P.convert(i&&i.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",o=>{o.preventDefault()}),this._element.addEventListener("mousedown",o=>{o.preventDefault()}),Wd(this._element,this._anchor,"marker"),i&&i.className)for(const o of i.className.split(" "))this._element.classList.add(o);this._popup=null}addTo(i){return this.remove(),this._map=i,i.getCanvasContainer().appendChild(this._element),i.on("move",this._update),i.on("moveend",this._update),i.on("terrain",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),T.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(i){return this._lngLat=c.L.convert(i),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(i){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),i){if(!("offset"in i.options)){const f=Math.abs(13.5)/Math.SQRT2;i.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[f,-1*(38.1-13.5+f)],"bottom-right":[-f,-1*(38.1-13.5+f)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=i,this._lngLat&&this._popup.setLngLat(this._lngLat),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}getPopup(){return this._popup}togglePopup(){const i=this._popup;return i?(i.isOpen()?i.remove():i.addTo(this._map),this):this}getOffset(){return this._offset}setOffset(i){return this._offset=c.P.convert(i),this._update(),this}addClassName(i){this._element.classList.add(i)}removeClassName(i){this._element.classList.remove(i)}toggleClassName(i){return this._element.classList.toggle(i)}setDraggable(i){return this._draggable=!!i,this._map&&(i?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(i){return this._rotation=i||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(i){return this._rotationAlignment=i||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(i){return this._pitchAlignment=i&&i!=="auto"?i:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}}const Mi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Ii=0,Po=!1;const vl={maxWidth:100,unit:"metric"};function bl(m,i,o){const h=o&&o.maxWidth||100,f=m._container.clientHeight/2,y=m.unproject([0,f]),w=m.unproject([h,f]),S=y.distanceTo(w);if(o&&o.unit==="imperial"){const k=3.2808*S;k>5280?Ja(i,h,k/5280,m._getUIString("ScaleControl.Miles")):Ja(i,h,k,m._getUIString("ScaleControl.Feet"))}else o&&o.unit==="nautical"?Ja(i,h,S/1852,m._getUIString("ScaleControl.NauticalMiles")):S>=1e3?Ja(i,h,S/1e3,m._getUIString("ScaleControl.Kilometers")):Ja(i,h,S,m._getUIString("ScaleControl.Meters"))}function Ja(m,i,o,h){const f=function(y){const w=Math.pow(10,`${Math.floor(y)}`.length-1);let S=y/w;return S=S>=10?10:S>=5?5:S>=3?3:S>=2?2:S>=1?1:function(k){const C=Math.pow(10,Math.ceil(-Math.log(k)/Math.LN10));return Math.round(k*C)/C}(S),w*S}(o);m.style.width=i*(f/o)+"px",m.innerHTML=`${f} ${h}`}const Ku={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px"},Xu=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function Lo(m){if(m){if(typeof m=="number"){const i=Math.round(Math.abs(m)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,m),"top-left":new c.P(i,i),"top-right":new c.P(-i,i),bottom:new c.P(0,-m),"bottom-left":new c.P(i,-i),"bottom-right":new c.P(-i,-i),left:new c.P(m,0),right:new c.P(-m,0)}}if(m instanceof c.P||Array.isArray(m)){const i=c.P.convert(m);return{center:i,top:i,"top-left":i,"top-right":i,bottom:i,"bottom-left":i,"bottom-right":i,left:i,right:i}}return{center:c.P.convert(m.center||[0,0]),top:c.P.convert(m.top||[0,0]),"top-left":c.P.convert(m["top-left"]||[0,0]),"top-right":c.P.convert(m["top-right"]||[0,0]),bottom:c.P.convert(m.bottom||[0,0]),"bottom-left":c.P.convert(m["bottom-left"]||[0,0]),"bottom-right":c.P.convert(m["bottom-right"]||[0,0]),left:c.P.convert(m.left||[0,0]),right:c.P.convert(m.right||[0,0])}}return Lo(new c.P(0,0))}const Ju={extend:(m,...i)=>c.e(m,...i),run(m){m()},logToElement(m,i=!1,o="log"){const h=window.document.getElementById(o);h&&(i&&(h.innerHTML=""),h.innerHTML+=`
    ${m}`)}},Qu=A;class Or{static get version(){return Qu}static get workerCount(){return bi.workerCount}static set workerCount(i){bi.workerCount=i}static get maxParallelImageRequests(){return c.c.MAX_PARALLEL_IMAGE_REQUESTS}static set maxParallelImageRequests(i){c.c.MAX_PARALLEL_IMAGE_REQUESTS=i}static get workerUrl(){return c.c.WORKER_URL}static set workerUrl(i){c.c.WORKER_URL=i}static addProtocol(i,o){c.c.REGISTERED_PROTOCOLS[i]=o}static removeProtocol(i){delete c.c.REGISTERED_PROTOCOLS[i]}}return Or.Map=class extends jd{constructor(m){if(c.bg.mark(c.bh.create),(m=c.e({},Ut,m)).minZoom!=null&&m.maxZoom!=null&&m.minZoom>m.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(m.minPitch!=null&&m.maxPitch!=null&&m.minPitch>m.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(m.minPitch!=null&&m.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(m.maxPitch!=null&&m.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(super(new fc(m.minZoom,m.maxZoom,m.minPitch,m.maxPitch,m.renderWorldCopies),{bearingSnap:m.bearingSnap}),this._cooperativeGesturesOnWheel=i=>{this._onCooperativeGesture(i,i[this._metaKey],1)},this._contextLost=i=>{i.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new c.k("webglcontextlost",{originalEvent:i}))},this._contextRestored=i=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.k("webglcontextrestored",{originalEvent:i}))},this._onMapScroll=i=>{if(i.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=m.interactive,this._cooperativeGestures=m.cooperativeGestures,this._metaKey=navigator.platform.indexOf("Mac")===0?"metaKey":"ctrlKey",this._maxTileCacheSize=m.maxTileCacheSize,this._maxTileCacheZoomLevels=m.maxTileCacheZoomLevels,this._failIfMajorPerformanceCaveat=m.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=m.preserveDrawingBuffer,this._antialias=m.antialias,this._trackResize=m.trackResize,this._bearingSnap=m.bearingSnap,this._refreshExpiredTiles=m.refreshExpiredTiles,this._fadeDuration=m.fadeDuration,this._crossSourceCollisions=m.crossSourceCollisions,this._crossFadingFactor=1,this._collectResourceTiming=m.collectResourceTiming,this._renderTaskQueue=new yc,this._controls=[],this._mapId=c.a2(),this._locale=c.e({},Zu,m.locale),this._clickTolerance=m.clickTolerance,this._overridePixelRatio=m.pixelRatio,this._maxCanvasSize=m.maxCanvasSize,this.transformCameraUpdate=m.transformCameraUpdate,this._imageQueueHandle=ne.addThrottleControl(()=>this.isMoving()),this._requestManager=new _e(m.transformRequest),typeof m.container=="string"){if(this._container=document.getElementById(m.container),!this._container)throw new Error(`Container '${m.container}' not found.`)}else{if(!(m.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=m.container}if(m.maxBounds&&this.setMaxBounds(m.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let i=!1;const o=Ka(h=>{this._trackResize&&!this._removed&&this.resize(h)._update()},50);this._resizeObserver=new ResizeObserver(h=>{i?o(h):i=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Gu(this,m),this._cooperativeGestures&&this._setupCooperativeGestures(),this._hash=m.hash&&new fl(typeof m.hash=="string"&&m.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch}),m.bounds&&(this.resize(),this.fitBounds(m.bounds,c.e({},m.fitBoundsOptions,{duration:0})))),this.resize(),this._localIdeographFontFamily=m.localIdeographFontFamily,this._validateStyle=m.validateStyle,m.style&&this.setStyle(m.style,{localIdeographFontFamily:m.localIdeographFontFamily}),m.attributionControl&&this.addControl(new ts({customAttribution:m.customAttribution})),m.maplibreLogo&&this.addControl(new ui,m.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet)}),this.on("data",i=>{this._update(i.dataType==="style"),this.fire(new c.k(`${i.dataType}data`,i))}),this.on("dataloading",i=>{this.fire(new c.k(`${i.dataType}dataloading`,i))}),this.on("dataabort",i=>{this.fire(new c.k("sourcedataabort",i))})}_getMapId(){return this._mapId}addControl(m,i){if(i===void 0&&(i=m.getDefaultPosition?m.getDefaultPosition():"top-right"),!m||!m.onAdd)return this.fire(new c.j(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const o=m.onAdd(this);this._controls.push(m);const h=this._controlPositions[i];return i.indexOf("bottom")!==-1?h.insertBefore(o,h.firstChild):h.appendChild(o),this}removeControl(m){if(!m||!m.onRemove)return this.fire(new c.j(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const i=this._controls.indexOf(m);return i>-1&&this._controls.splice(i,1),m.onRemove(this),this}hasControl(m){return this._controls.indexOf(m)>-1}calculateCameraOptionsFromTo(m,i,o,h){return h==null&&this.terrain&&(h=this.terrain.getElevationForLngLatZoom(o,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(m,i,o,h)}resize(m){var i;const o=this._containerDimensions(),h=o[0],f=o[1],y=this._getClampedPixelRatio(h,f);if(this._resizeCanvas(h,f,y),this.painter.resize(h,f,y),this.painter.overLimit()){const S=this.painter.context.gl;this._maxCanvasSize=[S.drawingBufferWidth,S.drawingBufferHeight];const k=this._getClampedPixelRatio(h,f);this._resizeCanvas(h,f,k),this.painter.resize(h,f,k)}this.transform.resize(h,f),(i=this._requestedCameraState)===null||i===void 0||i.resize(h,f);const w=!this._moving;return w&&(this.stop(),this.fire(new c.k("movestart",m)).fire(new c.k("move",m))),this.fire(new c.k("resize",m)),w&&this.fire(new c.k("moveend",m)),this}_getClampedPixelRatio(m,i){const{0:o,1:h}=this._maxCanvasSize,f=this.getPixelRatio(),y=m*f,w=i*f;return Math.min(y>o?o/y:1,w>h?h/w:1)*f}getPixelRatio(){var m;return(m=this._overridePixelRatio)!==null&&m!==void 0?m:devicePixelRatio}setPixelRatio(m){this._overridePixelRatio=m,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(m){return this.transform.setMaxBounds(Mt.convert(m)),this._update()}setMinZoom(m){if((m=m??-2)>=-2&&m<=this.transform.maxZoom)return this.transform.minZoom=m,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=m,this._update(),this.getZoom()>m&&this.setZoom(m),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(m){if((m=m??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(m>=0&&m<=this.transform.maxPitch)return this.transform.minPitch=m,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(m>=this.transform.minPitch)return this.transform.maxPitch=m,this._update(),this.getPitch()>m&&this.setPitch(m),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(m){return this.transform.renderWorldCopies=m,this._update()}getCooperativeGestures(){return this._cooperativeGestures}setCooperativeGestures(m){return this._cooperativeGestures=m,this._cooperativeGestures?this._setupCooperativeGestures():this._destroyCooperativeGestures(),this}project(m){return this.transform.locationPoint(c.L.convert(m),this.style&&this.terrain)}unproject(m){return this.transform.pointLocation(c.P.convert(m),this.terrain)}isMoving(){var m;return this._moving||((m=this.handlers)===null||m===void 0?void 0:m.isMoving())}isZooming(){var m;return this._zooming||((m=this.handlers)===null||m===void 0?void 0:m.isZooming())}isRotating(){var m;return this._rotating||((m=this.handlers)===null||m===void 0?void 0:m.isRotating())}_createDelegatedListener(m,i,o){if(m==="mouseenter"||m==="mouseover"){let h=!1;return{layer:i,listener:o,delegates:{mousemove:y=>{const w=this.getLayer(i)?this.queryRenderedFeatures(y.point,{layers:[i]}):[];w.length?h||(h=!0,o.call(this,new es(m,this,y.originalEvent,{features:w}))):h=!1},mouseout:()=>{h=!1}}}}if(m==="mouseleave"||m==="mouseout"){let h=!1;return{layer:i,listener:o,delegates:{mousemove:w=>{(this.getLayer(i)?this.queryRenderedFeatures(w.point,{layers:[i]}):[]).length?h=!0:h&&(h=!1,o.call(this,new es(m,this,w.originalEvent)))},mouseout:w=>{h&&(h=!1,o.call(this,new es(m,this,w.originalEvent)))}}}}{const h=f=>{const y=this.getLayer(i)?this.queryRenderedFeatures(f.point,{layers:[i]}):[];y.length&&(f.features=y,o.call(this,f),delete f.features)};return{layer:i,listener:o,delegates:{[m]:h}}}}on(m,i,o){if(o===void 0)return super.on(m,i);const h=this._createDelegatedListener(m,i,o);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[m]=this._delegatedListeners[m]||[],this._delegatedListeners[m].push(h);for(const f in h.delegates)this.on(f,h.delegates[f]);return this}once(m,i,o){if(o===void 0)return super.once(m,i);const h=this._createDelegatedListener(m,i,o);for(const f in h.delegates)this.once(f,h.delegates[f]);return this}off(m,i,o){return o===void 0?super.off(m,i):(this._delegatedListeners&&this._delegatedListeners[m]&&(h=>{const f=this._delegatedListeners[m];for(let y=0;ythis._updateStyle(m,i));const o=this.style&&i.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!m)),m?(this.style=new mn(this,i||{}),this.style.setEventedParent(this,{style:this.style}),typeof m=="string"?this.style.loadURL(m,i,o):this.style.loadJSON(m,i,o),this):(delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new mn(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(m,i){if(typeof m=="string"){const o=this._requestManager.transformRequest(m,Y.Style);c.f(o,(h,f)=>{h?this.fire(new c.j(h)):f&&this._updateDiff(f,i)})}else typeof m=="object"&&this._updateDiff(m,i)}_updateDiff(m,i){try{this.style.setState(m,i)&&this._update(!0)}catch(o){c.w(`Unable to perform style diff: ${o.message||o.error||o}. Rebuilding the style from scratch.`),this._updateStyle(m,i)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():c.w("There is no style added to the map.")}addSource(m,i){return this._lazyInitEmptyStyle(),this.style.addSource(m,i),this._update(!0)}isSourceLoaded(m){const i=this.style&&this.style.sourceCaches[m];if(i!==void 0)return i.loaded();this.fire(new c.j(new Error(`There is no source with ID '${m}'`)))}setTerrain(m){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),m){const i=this.style.sourceCaches[m.source];if(!i)throw new Error(`cannot load terrain, because there exists no source with ID: ${m.source}`);for(const o in this.style._layers){const h=this.style._layers[o];h.type==="hillshade"&&h.source===m.source&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new Zd(this.painter,i,m),this.painter.renderToTexture=new _c(this.painter,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._terrainDataCallback=o=>{o.dataType==="style"?this.terrain.sourceCache.freeRtt():o.dataType==="source"&&o.tile&&(o.sourceId!==m.source||this._elevationFreeze||(this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.terrain.sourceCache.freeRtt(o.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0;return this.fire(new c.k("terrain",{terrain:m})),this}getTerrain(){var m,i;return(i=(m=this.terrain)===null||m===void 0?void 0:m.options)!==null&&i!==void 0?i:null}areTilesLoaded(){const m=this.style&&this.style.sourceCaches;for(const i in m){const o=m[i]._tiles;for(const h in o){const f=o[h];if(f.state!=="loaded"&&f.state!=="errored")return!1}}return!0}addSourceType(m,i,o){return this._lazyInitEmptyStyle(),this.style.addSourceType(m,i,o)}removeSource(m){return this.style.removeSource(m),this._update(!0)}getSource(m){return this.style.getSource(m)}addImage(m,i,o={}){const{pixelRatio:h=1,sdf:f=!1,stretchX:y,stretchY:w,content:S}=o;if(this._lazyInitEmptyStyle(),!(i instanceof HTMLImageElement||c.a(i))){if(i.width===void 0||i.height===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:k,height:C,data:D}=i,P=i;return this.style.addImage(m,{data:new c.R({width:k,height:C},new Uint8Array(D)),pixelRatio:h,stretchX:y,stretchY:w,content:S,sdf:f,version:0,userImage:P}),P.onAdd&&P.onAdd(this,m),this}}{const{width:k,height:C,data:D}=c.h.getImageData(i);this.style.addImage(m,{data:new c.R({width:k,height:C},D),pixelRatio:h,stretchX:y,stretchY:w,content:S,sdf:f,version:0})}}updateImage(m,i){const o=this.style.getImage(m);if(!o)return this.fire(new c.j(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const h=i instanceof HTMLImageElement||c.a(i)?c.h.getImageData(i):i,{width:f,height:y,data:w}=h;if(f===void 0||y===void 0)return this.fire(new c.j(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(f!==o.data.width||y!==o.data.height)return this.fire(new c.j(new Error("The width and height of the updated image must be that same as the previous version of the image")));const S=!(i instanceof HTMLImageElement||c.a(i));return o.data.replace(w,S),this.style.updateImage(m,o),this}getImage(m){return this.style.getImage(m)}hasImage(m){return m?!!this.style.getImage(m):(this.fire(new c.j(new Error("Missing required image id"))),!1)}removeImage(m){this.style.removeImage(m)}loadImage(m,i){ne.getImage(this._requestManager.transformRequest(m,Y.Image),i)}listImages(){return this.style.listImages()}addLayer(m,i){return this._lazyInitEmptyStyle(),this.style.addLayer(m,i),this._update(!0)}moveLayer(m,i){return this.style.moveLayer(m,i),this._update(!0)}removeLayer(m){return this.style.removeLayer(m),this._update(!0)}getLayer(m){return this.style.getLayer(m)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(m,i,o){return this.style.setLayerZoomRange(m,i,o),this._update(!0)}setFilter(m,i,o={}){return this.style.setFilter(m,i,o),this._update(!0)}getFilter(m){return this.style.getFilter(m)}setPaintProperty(m,i,o,h={}){return this.style.setPaintProperty(m,i,o,h),this._update(!0)}getPaintProperty(m,i){return this.style.getPaintProperty(m,i)}setLayoutProperty(m,i,o,h={}){return this.style.setLayoutProperty(m,i,o,h),this._update(!0)}getLayoutProperty(m,i){return this.style.getLayoutProperty(m,i)}setGlyphs(m,i={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(m,i),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(m,i,o={}){return this._lazyInitEmptyStyle(),this.style.addSprite(m,i,o,h=>{h||this._update(!0)}),this}removeSprite(m){return this._lazyInitEmptyStyle(),this.style.removeSprite(m),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(m,i={}){return this._lazyInitEmptyStyle(),this.style.setSprite(m,i,o=>{o||this._update(!0)}),this}setLight(m,i={}){return this._lazyInitEmptyStyle(),this.style.setLight(m,i),this._update(!0)}getLight(){return this.style.getLight()}setFeatureState(m,i){return this.style.setFeatureState(m,i),this._update()}removeFeatureState(m,i){return this.style.removeFeatureState(m,i),this._update()}getFeatureState(m){return this.style.getFeatureState(m)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let m=0,i=0;return this._container&&(m=this._container.clientWidth||400,i=this._container.clientHeight||300),[m,i]}_setupContainer(){const m=this._container;m.classList.add("maplibregl-map");const i=this._canvasContainer=T.create("div","maplibregl-canvas-container",m);this._interactive&&i.classList.add("maplibregl-interactive"),this._canvas=T.create("canvas","maplibregl-canvas",i),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex","0"),this._canvas.setAttribute("aria-label","Map"),this._canvas.setAttribute("role","region");const o=this._containerDimensions(),h=this._getClampedPixelRatio(o[0],o[1]);this._resizeCanvas(o[0],o[1],h);const f=this._controlContainer=T.create("div","maplibregl-control-container",m),y=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(w=>{y[w]=T.create("div",`maplibregl-ctrl-${w} `,f)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_setupCooperativeGestures(){this._cooperativeGesturesScreen=T.create("div","maplibregl-cooperative-gesture-screen",this._container);let m=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.windowsHelpText?this._cooperativeGestures.windowsHelpText:"Use Ctrl + scroll to zoom the map";navigator.platform.indexOf("Mac")===0&&(m=typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.macHelpText?this._cooperativeGestures.macHelpText:"Use ⌘ + scroll to zoom the map"),this._cooperativeGesturesScreen.innerHTML=`
    ${m}
    ${typeof this._cooperativeGestures!="boolean"&&this._cooperativeGestures.mobileHelpText?this._cooperativeGestures.mobileHelpText:"Use two fingers to move the map"}
    - `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){T.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(m,i,o){this._canvas.width=Math.floor(o*m),this._canvas.height=Math.floor(o*i),this._canvas.style.width=`${m}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const m={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",h=>{i={requestedAttributes:m},h&&(i.statusMessage=h.statusMessage,i.type=h.type)},{once:!0});const o=this._canvas.getContext("webgl2",m)||this._canvas.getContext("webgl",m);if(!o){const h="Failed to initialize WebGL";throw i?(i.message=h,new Error(JSON.stringify(i))):new Error(h)}this.painter=new Ya(o,this.transform),z.testSupport(o)}_onCooperativeGesture(m,i,o){return!i&&o<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(m){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||m,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(m){return this._update(),this._renderTaskQueue.add(m)}_cancelRenderFrame(m){this._renderTaskQueue.remove(m)}_render(m){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(m),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,y=c.h.now();this.style.zoomHistory.update(f,y);const w=new c.a8(f,{now:y,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),S=w.crossFadingFactor();S===1&&S===this._crossFadingFactor||(o=!0,this._crossFadingFactor=S),this.style.update(w)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bg.mark(c.bh.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const h=this._sourcesDirty||this._styleDirty||this._placementDirty;return h||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,c.bg.mark(c.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var m;this._hash&&this._hash.remove();for(const o of this._controls)o.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ne.removeThrottleControl(this._imageQueueHandle),(m=this._resizeObserver)===null||m===void 0||m.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),c.bg.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.h.frame(m=>{c.bg.frame(m),this._frame=null,this._render(m)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(m){this._showTileBoundaries!==m&&(this._showTileBoundaries=m,this._update())}get showPadding(){return!!this._showPadding}set showPadding(m){this._showPadding!==m&&(this._showPadding=m,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(m){this._showCollisionBoxes!==m&&(this._showCollisionBoxes=m,m?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(m){this._showOverdrawInspector!==m&&(this._showOverdrawInspector=m,this._update())}get repaint(){return!!this._repaint}set repaint(m){this._repaint!==m&&(this._repaint=m,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(m){this._vertices=m,this._update()}get version(){return Lt}getCameraTargetElevation(){return this.transform.elevation}},Or.NavigationControl=class{constructor(m){this._updateZoomButtons=()=>{const i=this._map.getZoom(),o=i===this._map.getMaxZoom(),h=i===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())},this._rotateCompassArrow=()=>{const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=i},this._setButtonTitle=(i,o)=>{const h=this._map._getUIString(`NavigationControl.${o}`);i.title=h,i.setAttribute("aria-label",h)},this.options=c.e({},Wu,m),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(m){return this._map=m,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Hu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(m,i){const o=T.create("button",m,this._container);return o.type="button",o.addEventListener("click",i),o}},Or.GeolocateControl=class extends c.E{constructor(m){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const o=new c.L(i.coords.longitude,i.coords.latitude),h=i.coords.accuracy,f=this._map.getBearing(),y=c.e({bearing:f},this.options.fitBoundsOptions),w=Mt.fromLngLat(o,h);this._map.fitBounds(w,y,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const o=new c.L(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=i=>{if(this._map){if(this.options.trackUserLocation)if(i.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&Po)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Xa({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Xa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",o=>{o.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o.originalEvent&&o.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")))})}},this.options=c.e({},Mi,m)}onAdd(m){return this._map=m,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(i,o=!1){Vi===void 0||o?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(h=>{Vi=h.state!=="denied",i(Vi)}).catch(()=>{Vi=!!window.navigator.geolocation,i(Vi)}):(Vi=!!window.navigator.geolocation,i(Vi)):i(Vi)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ii=0,Po=!1}_isOutOfMapMaxBounds(m){const i=this._map.getMaxBounds(),o=m.coords;return i&&(o.longitudei.getEast()||o.latitudei.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const m=this._map.getBounds(),i=m.getSouthEast(),o=m.getNorthEast(),h=i.distanceTo(o),f=Math.ceil(this._accuracy/(h/this._map._container.clientHeight)*2);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ii--,Po=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let m;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ii++,Ii>1?(m={maximumAge:6e5,timeout:0},Po=!0):(m=this.options.positionOptions,Po=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,m)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Or.AttributionControl=ts,Or.LogoControl=ui,Or.ScaleControl=class{constructor(m){this._onMove=()=>{bl(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,bl(this._map,this._container,this.options)},this.options=c.e({},vl,m)}getDefaultPosition(){return"bottom-left"}onAdd(m){return this._map=m,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",m.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Or.FullscreenControl=class extends c.E{constructor(m={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,m&&m.container&&(m.container instanceof HTMLElement?this._container=m.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(m){return this._map=m,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const m=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",m).setAttribute("aria-hidden","true"),m.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const m=this._getTitle();this._fullscreenButton.setAttribute("aria-label",m),this._fullscreenButton.title=m}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},Or.TerrainControl=class{constructor(m){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=m}onAdd(m){return this._map=m,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Or.Popup=class extends c.E{constructor(m){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new c.k("close")),this),this._onMouseUp=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const w of this.options.className.split(" "))this._container.classList.add(w);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Yu(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!i)return;const o=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);let h=this.options.anchor;const f=Lo(this.options.offset);if(!h){const w=this._container.offsetWidth,S=this._container.offsetHeight;let k;k=o.y+f.bottom.ythis._map.transform.height-S?["bottom"]:[],o.xthis._map.transform.width-w/2&&k.push("right"),h=k.length===0?"bottom":k.join("-")}const y=o.add(f[h]).round();T.setTransform(this._container,`${_s[h]} translate(${y.x}px,${y.y}px)`),Wd(this._container,h,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Ku),m)}addTo(m){return this._map&&this.remove(),this._map=m,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(m){return this._lngLat=c.L.convert(m),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(m){return this.setDOMContent(document.createTextNode(m))}setHTML(m){const i=document.createDocumentFragment(),o=document.createElement("body");let h;for(o.innerHTML=m;h=o.firstChild,h;)i.appendChild(h);return this.setDOMContent(i)}getMaxWidth(){var m;return(m=this._container)===null||m===void 0?void 0:m.style.maxWidth}setMaxWidth(m){return this.options.maxWidth=m,this._update(),this}setDOMContent(m){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(m),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(m){this._container&&this._container.classList.add(m)}removeClassName(m){this._container&&this._container.classList.remove(m)}setOffset(m){return this.options.offset=m,this._update(),this}toggleClassName(m){if(this._container)return this._container.classList.toggle(m)}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const m=this._container.querySelector(Xu);m&&m.focus()}},Or.Marker=Xa,Or.Style=mn,Or.LngLat=c.L,Or.LngLatBounds=Mt,Or.Point=c.P,Or.MercatorCoordinate=c.U,Or.Evented=c.E,Or.AJAXError=c.bi,Or.config=c.c,Or.CanvasSource=cr,Or.GeoJSONSource=Ge,Or.ImageSource=Ot,Or.RasterDEMTileSource=_t,Or.RasterTileSource=yr,Or.VectorTileSource=Rt,Or.VideoSource=Ir,Or.setRTLTextPlugin=c.bj,Or.getRTLTextPluginStatus=c.bk,Or.prewarm=function(){un().acquire(ir)},Or.clearPrewarmedResources=function(){const m=zi;m&&(m.isPreloaded()&&m.numActive()===1?(m.release(ir),zi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},Ju.extend(Or,{isSafari:c.ac,getPerformanceMetrics:c.bg.getPerformanceMetrics}),Or});var b=p;return b})})(fw);var UM=fw.exports;const jl=NM(UM);function Yv(r){let e;return n=>{if(n)for(let l in n){let p=e==null?void 0:e[l],v=n[l];p!==v&&r(l,v,p)}else if(e)for(let l in e)r(l,void 0,e[l]);e=n}}function $M(r,...e){let n=[r];for(let l of e)if(l)Array.isArray(l)&&l[0]===r?n.push(...l.slice(1)):n.push(l);else continue;if(n.length!==1)return n.length===2?n[1]:n}function VM(r){return r===!0?["has","point_count"]:r===!1?["!",["has","point_count"]]:void 0}function jM(r,e){return["case",["boolean",["feature-state","hover"],!1],e,r]}var o_=qM;function qM(r){var e,n,l;if(r){if(Array.isArray(r)){for(e=[],n=r.length,l=0;lbr(St,"$minZoomContext",n),p=()=>br(gt,"$maxZoomContext",n),v=()=>br(ft,"$layer",n),b=()=>br(At,"$map",n),c=()=>br(Ze,"$sourceName",n),A=wt(),T=wt(),z=wt(),B=wt(),U=wt(),j=wt(),Q=wt();let ae=le(e,"id",8,()=>s_("layer")),ne=le(e,"source",8,()=>{}),Y=le(e,"sourceLayer",8,()=>{}),_e=le(e,"beforeId",8,()=>{}),de=le(e,"beforeLayerType",8,()=>{}),pe=le(e,"type"),Te=le(e,"paint",8,()=>{}),De=le(e,"layout",8,()=>{}),je=le(e,"filter",8,()=>{}),ke=le(e,"applyToClusters",8,()=>{}),$e=le(e,"minzoom",8,()=>{}),Me=le(e,"maxzoom",8,()=>{}),He=le(e,"manageHoverState",0,!1),Ye=le(e,"hovered",4,null),Pe=le(e,"interactive",0,!0),tt=le(e,"hoverCursor",8,()=>{}),Je=le(e,"eventsIfTopMost",0,!1);const lt=Jh(),{map:At,source:Ze,self:ft,minzoom:St,maxzoom:gt,eventTopMost:Ct,layerInfo:Mt}=dw();lu(()=>{var Ge;v()&&b()&&(Mt.delete(v()),(Ge=b())==null||Ge.removeLayer(v()))});let rt=wt(void 0),Rt=wt(!0);bt(()=>ze(ke()),()=>{ot(A,VM(ke()))}),bt(()=>(oe(A),ze(je())),()=>{ot(T,$M("all",oe(A),je()))}),bt(()=>(ze($e()),l()),()=>{ot(z,$e()??l())}),bt(()=>(ze(Me()),p()),()=>{ot(B,Me()??p())}),bt(()=>(ze(ne()),c()),()=>{ot(U,ne()||c())}),bt(()=>(b(),v(),ze(ae()),oe(U),ze(Pe()),ze(Je()),ze(_e()),ze(de()),ze(pe()),ze(Y()),oe(T),ze(Te()),ze(De()),oe(z),oe(B),ze(tt()),ze(He()),oe(rt)),()=>{if(b()&&v()!==ae()&&oe(U)){let Ge=function(Ot){var Ar,Qr;if(!Pe()||!v()||!b()||Je()&&Ct(Ot)!==v())return;let Ir=Ot.features??[],cr=(Qr=(Ar=Ir[0])==null?void 0:Ar.properties)==null?void 0:Qr.cluster_id,Jr={event:Ot,map:b(),clusterId:cr,layer:v(),source:oe(U),features:Ir};lt(Ot.type,Jr)};v()&&Mt.delete(v());let Nt=_e();if(!_e()&&de()){let Ot=b().getStyle().layers,Ir=typeof de()=="function"?de():Jr=>Jr.type===de(),cr=Ot==null?void 0:Ot.find(Ir);cr&&(Nt=cr.id)}ki(ft,ae()),b().addLayer(o_({id:v(),type:pe(),source:oe(U),"source-layer":Y(),filter:oe(T),paint:Te(),layout:De(),minzoom:oe(z),maxzoom:oe(B)}),Nt),ot(Rt,!0),b().on("click",v(),Ge),b().on("dblclick",v(),Ge),b().on("contextmenu",v(),Ge),b().on("mouseenter",v(),Ot=>{var Ar,Qr;if(!Pe()||!v()||!b()||Je()&&Ct(Ot)!==v())return;tt()&&(b().getCanvas().style.cursor=tt());let Ir=Ot.features??[];Ye(Ir[0]??null);let cr=(Qr=(Ar=Ir[0])==null?void 0:Ar.properties)==null?void 0:Qr.cluster_id,Jr={event:Ot,map:b(),clusterId:cr,layer:v(),source:oe(U),features:Ir};lt("mouseenter",Jr)}),b().on("mousemove",v(),Ot=>{var Ar,Qr,$i,cn,Mn,vi;if(!Pe())return;if(Je()&&Ct(Ot)!==v()){Ye(null),He()&&oe(rt)!==void 0&&((Ar=b())==null||Ar.setFeatureState({source:oe(U),sourceLayer:Y(),id:oe(rt)},{hover:!1}),ot(rt,void 0));return}b().getCanvas().style.cursor=tt();let Ir=Ot.features??[],cr=($i=(Qr=Ir[0])==null?void 0:Qr.properties)==null?void 0:$i.cluster_id,Jr=(cn=Ir[0])==null?void 0:cn.id;Jr!==oe(rt)&&(He()&&(oe(rt)!==void 0&&((Mn=b())==null||Mn.setFeatureState({source:oe(U),id:oe(rt),sourceLayer:Y()},{hover:!1})),(vi=b())==null||vi.setFeatureState({source:oe(U),id:Jr,sourceLayer:Y()},{hover:!0})),ot(rt,Jr),Ye(Ir[0]??null)),lt("mousemove",{event:Ot,map:b(),clusterId:cr,layer:v(),source:oe(U),features:Ir})}),b().on("mouseleave",v(),Ot=>{var Ir;if(!(!Pe()||!v()||!b())){if(tt()&&(b().getCanvas().style.cursor=""),Ye(null),He()&&oe(rt)!==void 0){const cr={source:oe(U),id:oe(rt),sourceLayer:Y()};(Ir=b())==null||Ir.setFeatureState(cr,{hover:!1}),ot(rt,void 0)}lt("mouseleave",{map:b(),layer:v(),source:oe(U)})}})}}),bt(()=>(v(),ze(Pe())),()=>{v()&&Mt.set(v(),{interactive:Pe()})}),bt(()=>(v(),b()),()=>{ot(j,v()?Yv((Ge,Nt)=>{var Ot;return(Ot=b())==null?void 0:Ot.setPaintProperty(v(),Ge,Nt)}):void 0)}),bt(()=>(v(),b()),()=>{ot(Q,v()?Yv((Ge,Nt)=>{var Ot;return(Ot=b())==null?void 0:Ot.setLayoutProperty(v(),Ge,Nt)}):void 0)}),bt(()=>(oe(j),ze(Te())),()=>{var Ge;(Ge=oe(j))==null||Ge(Te())}),bt(()=>(oe(Q),ze(De())),()=>{var Ge;(Ge=oe(Q))==null||Ge(De())}),bt(()=>(v(),b(),oe(z),oe(B)),()=>{var Ge;v()&&((Ge=b())==null||Ge.setLayerZoomRange(v(),oe(z),oe(B)))}),bt(()=>(v(),oe(Rt),b(),oe(T)),()=>{var Ge;v()&&(oe(Rt)?ot(Rt,!1):(Ge=b())==null||Ge.setFilter(v(),oe(T)))}),_i(),zr();var yr=nr(),_t=ct(yr);pr(_t,v,Ge=>{var Nt=nr(),Ot=ct(Nt);Tb(Ot,v,Ir=>{var cr=nr(),Jr=ct(cr);hr(Jr,Wr(e),{},null),xe(Ir,cr)}),xe(Ge,Nt)}),xe(r,yr),Lr()}function ZM(r,e){Pr(e,!1);let n=le(e,"id",8,()=>s_("fill")),l=le(e,"source",8,()=>{}),p=le(e,"sourceLayer",8,()=>{}),v=le(e,"beforeId",8,()=>{}),b=le(e,"beforeLayerType",8,()=>{}),c=le(e,"paint"),A=le(e,"layout",8,()=>{}),T=le(e,"filter",8,()=>{}),z=le(e,"minzoom",8,()=>{}),B=le(e,"maxzoom",8,()=>{}),U=le(e,"hoverCursor",8,()=>{}),j=le(e,"manageHoverState",0,!1),Q=le(e,"hovered",4,null),ae=le(e,"eventsIfTopMost",0,!1),ne=le(e,"interactive",0,!0);zr(),GM(r,{get id(){return n()},type:"fill",get source(){return l()},get sourceLayer(){return p()},get beforeId(){return v()},get beforeLayerType(){return b()},get paint(){return c()},get layout(){return A()},get filter(){return T()},get minzoom(){return z()},get maxzoom(){return B()},get hoverCursor(){return U()},get manageHoverState(){return j()},get eventsIfTopMost(){return ae()},get interactive(){return ne()},get hovered(){return Q()},set hovered(Y){Q(Y)},$$events:{click(Y){Ne.call(this,e,Y)},dblclick(Y){Ne.call(this,e,Y)},contextmenu(Y){Ne.call(this,e,Y)},mouseenter(Y){Ne.call(this,e,Y)},mousemove(Y){Ne.call(this,e,Y)},mouseleave(Y){Ne.call(this,e,Y)}},children:(Y,_e)=>{var de=nr(),pe=ct(de);hr(pe,Wr(e),{},null),xe(Y,de)},$$slots:{default:!0},$$legacy:!0}),Lr()}function WM(r,e){Pr(e,!1);const n=Cn(),l=()=>br(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"top-left"),b=le(e,"container",8,()=>{}),c=wt(null);lu(()=>{var A;(A=l())!=null&&A.loaded()&&oe(c)&&l().removeControl(oe(c))}),bt(()=>(l(),oe(c),ze(b()),ze(v())),()=>{if(l()&&!oe(c)){let A;typeof b()=="string"?A=document.querySelector(b())??void 0:A=b(),ot(c,new jl.FullscreenControl({container:A})),l().addControl(oe(c),v())}}),_i(),zr(),Lr()}function HM(r,e,n,l,p){let v=!1;r.getSource(e)&&(v=!0,r.removeSource(e));const b=()=>{l(e)&&(r.addSource(e,n),p())};if(v){const c=()=>{e&&(r.getSource(e)?setTimeout(c,1):b())};c()}else b()}function YM(r,e,n){sI().then(()=>{let l=aI(r);if(!l)return;l.getSource(e)===n&&l.removeSource(e)})}function KM(r,e){Pr(e,!1);const n=Cn(),l=()=>br(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"top-left"),b=le(e,"positionOptions",8,()=>{}),c=le(e,"fitBoundsOptions",8,()=>{}),A=le(e,"trackUserLocation",0,!1),T=le(e,"showAccuracyCircle",0,!0),z=le(e,"showUserLocation",0,!0),B=wt(null);lu(()=>{var U;(U=l())!=null&&U.loaded()&&oe(B)&&l().removeControl(oe(B))}),bt(()=>(l(),oe(B),ze(b()),ze(c()),ze(A()),ze(T()),ze(z()),ze(v())),()=>{l()&&!oe(B)&&(ot(B,new jl.GeolocateControl({positionOptions:b(),fitBoundsOptions:c(),trackUserLocation:A(),showAccuracyCircle:T(),showUserLocation:z()})),l().addControl(oe(B),v()))}),_i(),zr(),Lr()}function XM(r,e){Pr(e,!1);const n=Cn(),l=()=>br(T,"$map",n),p=()=>br(z,"$source",n);let v=le(e,"data"),b=le(e,"idCol"),c=le(e,"sourceLayer",8,()=>{}),A=wt(new Set);const{map:T,source:z}=dw();bt(()=>(ze(v()),l(),p(),ze(b()),oe(A),ze(c())),()=>{if(v()&&l()&&p()){let B=new Set;for(const U of v()){const j=U[b()];if(!j)continue;oe(A).delete(j),B.add(j);const Q={id:j,source:p(),sourceLayer:c()},ae=l().getFeatureState(Q);let ne=!1;for(const Y of Object.keys(U))if(ae[Y]!==U[Y]){ne=!0;break}ne&&l().setFeatureState(Q,U)}for(const U of oe(A)){const j={id:U,source:p(),sourceLayer:c()},Q=l().getFeatureState(j);for(const ae of Object.keys(Q))l().removeFeatureState(j,ae)}ot(A,B)}}),_i(),zr(),Lr()}function JM(r){let e=r.getCenter(),n=Math.round(r.getZoom()*100)/100,l=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,l),v=Math.round(e.lat*p)/p,b=Math.round(e.lng*p)/p,c=`${n}/${v}/${b}`,A=r.getBearing(),T=r.getPitch();return(A||T)&&(c+=`/${Math.round(A*10)/10}`),T&&(c+=`/${Math.round(T)}`),`#${c}`}function QM(r){return r.replace("#","").split("/").map(parseFloat)}var Tf=l_;function l_(r,e){return r===e||r!==r&&e!==e?!0:typeof r!=typeof e||{}.toString.call(r)!={}.toString.call(e)||r!==Object(r)||!r?!1:Array.isArray(r)?Kv(r,e):{}.toString.call(r)=="[object Set]"?Kv(Array.from(r),Array.from(e)):{}.toString.call(r)=="[object Object]"?t3(r,e):e3(r,e)}function e3(r,e){return r.toString()===e.toString()}function Kv(r,e){var n=r.length;if(n!=e.length)return!1;for(var l=0;lbr(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"top-left"),b=le(e,"showCompass",0,!0),c=le(e,"showZoom",0,!0),A=le(e,"visualizePitch",0,!1),T=wt(null);lu(()=>{var z;(z=l())!=null&&z.loaded()&&oe(T)&&l().removeControl(oe(T))}),bt(()=>(l(),oe(T),ze(b()),ze(c()),ze(A()),ze(v())),()=>{l()&&!oe(T)&&(ot(T,new jl.NavigationControl({showCompass:b(),showZoom:c(),visualizePitch:A()})),l().addControl(oe(T),v()))}),_i(),zr(),Lr()}function i3(r,e){Pr(e,!1);const n=Cn(),l=()=>br(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"bottom-left"),b=le(e,"maxWidth",8,()=>{}),c=le(e,"unit",0,"metric"),A=wt(null);lu(()=>{var T;(T=l())!=null&&T.loaded()&&oe(A)&&l().removeControl(oe(A))}),bt(()=>(l(),oe(A),ze(b()),ze(c()),ze(v())),()=>{l()&&!oe(A)&&(ot(A,new jl.ScaleControl({maxWidth:b(),unit:c()})),l().addControl(oe(A),v()))}),_i(),zr(),Lr()}var n3=Xe(" ",1),s3=Xe(" ",1),a3=Xe("
    ");function o3(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Je,"$mapInstance",n),p=()=>br(lt,"$loadedImages",n),v=wt(),b=wt();let c=le(e,"map",4,null),A=le(e,"class",8,()=>{}),T=le(e,"style"),z=le(e,"diffStyleUpdates",0,!1),B=le(e,"center",12,()=>{}),U=le(e,"zoom",12,()=>{}),j=le(e,"pitch",4,0),Q=le(e,"bearing",4,0),ae=le(e,"bounds",12,()=>{}),ne=le(e,"hash",0,!1),Y=le(e,"loaded",4,!1),_e=le(e,"minZoom",0,0),de=le(e,"maxZoom",0,22),pe=le(e,"zoomOnDoubleClick",0,!0),Te=le(e,"interactive",0,!0),De=le(e,"attributionControl",0,!0),je=le(e,"cooperativeGestures",0,!1),ke=le(e,"preserveDrawingBuffer",0,!1),$e=le(e,"maxBounds",8,()=>{}),Me=le(e,"images",8,()=>[]),He=le(e,"standardControls",0,!1),Ye=le(e,"filterLayers",8,()=>{}),Pe=le(e,"transformRequest",8,()=>{});const tt=Jh(),{map:Je,loadedImages:lt}=RM();let At=new Set;function Ze(_t){var Ge;(Ge=l())!=null&&Ge.loaded()&&("url"in _t?(At.add(_t.id),l().loadImage(_t.url,(Nt,Ot)=>{var Ir;At.delete(_t.id),Nt?tt("error",Nt):Ot&&((Ir=l())==null||Ir.addImage(_t.id,Ot,_t.options),p().add(_t.id),ki(lt,p()))})):(l().addImage(_t.id,_t.data,_t.options),p().add(_t.id),ki(lt,p())))}let ft=wt(void 0),St=wt(void 0),gt=wt(void 0),Ct=wt(void 0);function Mt(_t){if(ne()){let Ge=QM(window.location.hash);Ge.length>=3&&(U(Ge[0]),B([Ge[2],Ge[1]])),Ge.length==5&&(Q(Ge[3]),j(Ge[4]))}return ki(Je,new jl.Map(o_({container:_t,style:T(),center:B(),zoom:U(),pitch:j(),bearing:Q(),minZoom:_e(),maxZoom:de(),interactive:Te(),preserveDrawingBuffer:ke(),maxBounds:$e(),bounds:ae(),attributionControl:De(),transformRequest:Pe(),cooperativeGestures:je()}))),l().on("load",Ge=>{Y(!0),tt("load",l())}),l().on("error",Ge=>tt("error",{...Ge,map:l()})),l().on("movestart",Ge=>tt("movestart",{...Ge,map:l()})),l().on("moveend",Ge=>{if(B(Ge.target.getCenter()),U(Ge.target.getZoom()),ae(Ge.target.getBounds()),tt("moveend",{...Ge,map:l()}),ne()){let Nt=window.location.href.replace(/(#.+)?$/,JM(l()));window.history.replaceState(window.history.state,"",Nt)}}),l().on("zoomstart",Ge=>tt("zoomstart",{...Ge,map:l()})),l().on("zoom",Ge=>{U(Ge.target.getZoom()),tt("zoom",{...Ge,map:l()})}),l().on("zoomend",Ge=>{U(Ge.target.getZoom()),tt("zoomend",{...Ge,map:l()})}),l().on("style.load",()=>{if(l()){const Ge=l().getStyle();if(ot(ft,Ge.layers.map(Nt=>Nt.id)),ot(St,Object.keys(Ge.sources)),oe(Ct))for(const[Nt,Ot]of Object.entries(oe(Ct)))l().addSource(Nt,Ot);if(oe(gt))for(const Nt of oe(gt))l().addLayer(Nt)}}),l().on("styledata",Ge=>{if(l()&&Ye()){const Nt=l().getStyle().layers;if(Nt)for(let Ot of Nt)Ye()(Ot)||l().setLayoutProperty(Ot.id,"visibility","none")}tt("styledata",{...Ge,map:l()})}),{destroy(){var Ge;Y(!1),(Ge=l())==null||Ge.remove(),ki(Je,null)}}}let rt=wt(T());bt(()=>ze(He()),()=>{ot(v,typeof He()=="boolean"?void 0:He())}),bt(()=>l(),()=>{c(l())}),bt(()=>(ze(Y()),l(),ze(Me())),()=>{var _t;if(Y()&&((_t=l())!=null&&_t.loaded()))for(let Ge of Me())!At.has(Ge.id)&&!l().hasImage(Ge.id)&&Ze(Ge)}),bt(()=>(ze(Me()),p()),()=>{ot(b,Me().every(_t=>p().has(_t.id)))}),bt(()=>(l(),ze(T()),oe(rt),oe(ft),oe(St),ze(z())),()=>{if(l()&&!Tf(T(),oe(rt))){const _t=l().getStyle();if(oe(ft)&&ot(gt,_t.layers.filter(Ge=>!oe(ft).includes(Ge.id))),oe(St)){const Ge=Object.keys(_t.sources).filter(Nt=>!oe(St).includes(Nt));ot(Ct,{});for(const Nt of Ge)Rh(Ct,oe(Ct)[Nt]=_t.sources[Nt])}ot(rt,T()),l().setStyle(T(),{diff:z()})}}),bt(()=>(ze(B()),l()),()=>{var _t,Ge;B()&&!Tf(B(),(_t=l())==null?void 0:_t.getCenter())&&((Ge=l())==null||Ge.panTo(B()))}),bt(()=>(ze(U()),l()),()=>{var _t,Ge;U()&&!Tf(U(),(_t=l())==null?void 0:_t.getZoom())&&((Ge=l())==null||Ge.zoomTo(U()))}),bt(()=>(ze(ae()),l()),()=>{var _t,Ge;ae()&&!Tf(ae(),(_t=l())==null?void 0:_t.getBounds())&&((Ge=l())==null||Ge.fitBounds(ae()))}),bt(()=>(ze(pe()),l()),()=>{var _t,Ge;pe()?(_t=l())==null||_t.doubleClickZoom.enable():(Ge=l())==null||Ge.doubleClickZoom.disable()}),_i(),zr();var Rt=a3(),yr=ut(Rt);pr(yr,()=>l()&&Y(),_t=>{var Ge=s3(),Nt=ct(Ge);pr(Nt,He,Ir=>{var cr=n3(),Jr=ct(cr);r3(Jr,{get position(){return oe(v)},$$legacy:!0});var Ar=we(we(Jr,!0));KM(Ar,{get position(){return oe(v)},fitBoundsOptions:{maxZoom:12},$$legacy:!0});var Qr=we(we(Ar,!0));WM(Qr,{get position(){return oe(v)},$$legacy:!0});var $i=we(we(Qr,!0));i3($i,{get position(){return oe(v)},$$legacy:!0}),xe(Ir,cr)});var Ot=we(we(Nt,!0));hr(Ot,Wr(e),{get map(){return l()},get loadedImages(){return p()},get allImagesLoaded(){return oe(b)}},null),xe(_t,Ge)}),ht(Rt),Pt(()=>{En(Rt,`${A()??""} svelte-p00lfq`),gI(Rt,"expand-map",!A())}),Ko(Rt,_t=>Mt(_t)),xe(r,Rt),Lr()}const l3=Math.sqrt(50),c3=Math.sqrt(10),u3=Math.sqrt(2);function Fp(r,e,n){const l=(e-r)/Math.max(0,n),p=Math.floor(Math.log10(l)),v=l/Math.pow(10,p),b=v>=l3?10:v>=c3?5:v>=u3?2:1;let c,A,T;return p<0?(T=Math.pow(10,-p)/b,c=Math.round(r*T),A=Math.round(e*T),c/Te&&--A,T=-T):(T=Math.pow(10,p)*b,c=Math.round(r/T),A=Math.round(e/T),c*Te&&--A),A0))return[];if(r===e)return[r];const l=e=p))return[];const c=v-p+1,A=new Array(c);if(l)if(b<0)for(let T=0;Tnew Promise((l,p)=>{var v=A=>{try{c(n.next(A))}catch(T){p(T)}},b=A=>{try{c(n.throw(A))}catch(T){p(T)}},c=A=>A.done?l(A.value):Promise.resolve(A.value).then(v,b);c((n=n.apply(r,e)).next())}),Bs=Uint8Array,Oh=Uint16Array,f3=Int32Array,mw=new Bs([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gw=new Bs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),p3=new Bs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yw=function(r,e){for(var n=new Oh(31),l=0;l<31;++l)n[l]=e+=1<>1|(Xr&21845)<<1,lo=(lo&52428)>>2|(lo&13107)<<2,lo=(lo&61680)>>4|(lo&3855)<<4,bw[Xr]=((lo&65280)>>8|(lo&255)<<8)>>1;var lo,Xr,Nh=function(r,e,n){for(var l=r.length,p=0,v=new Oh(e);p>A]=T}return c},ld=new Bs(288);for(Xr=0;Xr<144;++Xr)ld[Xr]=8;var Xr;for(Xr=144;Xr<256;++Xr)ld[Xr]=9;var Xr;for(Xr=256;Xr<280;++Xr)ld[Xr]=7;var Xr;for(Xr=280;Xr<288;++Xr)ld[Xr]=8;var Xr,xw=new Bs(32);for(Xr=0;Xr<32;++Xr)xw[Xr]=5;var Xr,_3=Nh(ld,9),v3=Nh(xw,5),Dg=function(r){for(var e=r[0],n=1;ne&&(e=r[n]);return e},ha=function(r,e,n){var l=e/8|0;return(r[l]|r[l+1]<<8)>>(e&7)&n},Pg=function(r,e){var n=e/8|0;return(r[n]|r[n+1]<<8|r[n+2]<<16)>>(e&7)},b3=function(r){return(r+7)/8|0},x3=function(r,e,n){(n==null||n>r.length)&&(n=r.length);var l=new Bs(n-e);return l.set(r.subarray(e,n)),l},w3=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ls=function(r,e,n){var l=new Error(e||w3[r]);if(l.code=r,Error.captureStackTrace&&Error.captureStackTrace(l,Ls),!n)throw l;return l},c_=function(r,e,n,l){var p=r.length,v=0;if(!p||e.f&&!e.l)return n||new Bs(0);var b=!n||e.i!=2,c=e.i;n||(n=new Bs(p*3));var A=function(Ot){var Ir=n.length;if(Ot>Ir){var cr=new Bs(Math.max(Ir*2,Ot));cr.set(n),n=cr}},T=e.f||0,z=e.p||0,B=e.b||0,U=e.l,j=e.d,Q=e.m,ae=e.n,ne=p*8;do{if(!U){T=ha(r,z,1);var Y=ha(r,z+1,3);if(z+=3,Y)if(Y==1)U=_3,j=v3,Q=9,ae=5;else if(Y==2){var Te=ha(r,z,31)+257,De=ha(r,z+10,15)+4,je=Te+ha(r,z+5,31)+1;z+=14;for(var ke=new Bs(je),$e=new Bs(19),Me=0;Me>4;if(_e<16)ke[Me++]=_e;else{var Je=0,lt=0;for(_e==16?(lt=3+ha(r,z,3),z+=2,Je=ke[Me-1]):_e==17?(lt=3+ha(r,z,7),z+=3):_e==18&&(lt=11+ha(r,z,127),z+=7);lt--;)ke[Me++]=Je}}var At=ke.subarray(0,Te),Ze=ke.subarray(Te);Q=Dg(At),ae=Dg(Ze),U=Nh(At,Q),j=Nh(Ze,ae)}else Ls(1);else{var _e=b3(z)+4,de=r[_e-4]|r[_e-3]<<8,pe=_e+de;if(pe>p){c&&Ls(0);break}b&&A(B+de),n.set(r.subarray(_e,pe),B),e.b=B+=de,e.p=z=pe*8,e.f=T;continue}if(z>ne){c&&Ls(0);break}}b&&A(B+131072);for(var ft=(1<>4;if(z+=Je&15,z>ne){c&&Ls(0);break}if(Je||Ls(2),Ct<256)n[B++]=Ct;else if(Ct==256){gt=z,U=null;break}else{var Mt=Ct-254;if(Ct>264){var Me=Ct-257,rt=mw[Me];Mt=ha(r,z,(1<>4;Rt||Ls(3),z+=Rt&15;var Ze=y3[yr];if(yr>3){var rt=gw[yr];Ze+=Pg(r,z)&(1<ne){c&&Ls(0);break}b&&A(B+131072);var _t=B+Mt;if(B>3&1)+(e>>4&1);l>0;l-=!r[n++]);return n+(e&2)},T3=function(r){var e=r.length;return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0},k3=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&Ls(6,"invalid zlib data"),(r[1]>>5&1)==+!e&&Ls(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function A3(r,e){return c_(r,{i:2},e,e)}function E3(r,e){var n=I3(r);return n+8>r.length&&Ls(6,"invalid gzip data"),c_(r.subarray(n,-8),{i:2},new Bs(T3(r)),e)}function C3(r,e){return c_(r.subarray(k3(r,e),-4),{i:2},e,e)}function dy(r,e){return r[0]==31&&r[1]==139&&r[2]==8?E3(r,e):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?A3(r,e):C3(r,e)}var M3=typeof TextDecoder<"u"&&new TextDecoder,D3=0;try{M3.decode(S3,{stream:!0}),D3=1}catch{}var ww=(r,e)=>r*Math.pow(2,e),Sh=(r,e)=>Math.floor(r/Math.pow(2,e)),Op=(r,e)=>ww(r.getUint16(e+1,!0),8)+r.getUint8(e),Sw=(r,e)=>ww(r.getUint32(e+2,!0),16)+r.getUint16(e,!0),P3=(r,e,n,l,p)=>{if(r!=l.getUint8(p))return r-l.getUint8(p);const v=Op(l,p+1);if(e!=v)return e-v;const b=Op(l,p+4);return n!=b?n-b:0},L3=(r,e,n,l)=>{const p=Iw(r,e|128,n,l);return p?{z:e,x:n,y:l,offset:p[0],length:p[1],is_dir:!0}:null},Xv=(r,e,n,l)=>{const p=Iw(r,e,n,l);return p?{z:e,x:n,y:l,offset:p[0],length:p[1],is_dir:!1}:null},Iw=(r,e,n,l)=>{let p=0,v=r.byteLength/17-1;for(;p<=v;){const b=v+p>>1,c=P3(e,n,l,r,b*17);if(c>0)p=b+1;else if(c<0)v=b-1;else return[Sw(r,b*17+7),r.getUint32(b*17+13,!0)]}return null},z3=(r,e)=>r.is_dir&&!e.is_dir?1:!r.is_dir&&e.is_dir?-1:r.z!==e.z?r.z-e.z:r.x!==e.x?r.x-e.x:r.y-e.y,Tw=(r,e)=>{const n=r.getUint8(e*17);return{z:n&127,x:Op(r,e*17+1),y:Op(r,e*17+4),offset:Sw(r,e*17+7),length:r.getUint32(e*17+13,!0),is_dir:n>>7===1}},Jv=r=>{const e=[],n=new DataView(r);for(let l=0;l{r.sort(z3);const e=new ArrayBuffer(17*r.length),n=new Uint8Array(e);for(let l=0;l>8&255,n[l*17+3]=p.x>>16&255,n[l*17+4]=p.y&255,n[l*17+5]=p.y>>8&255,n[l*17+6]=p.y>>16&255,n[l*17+7]=p.offset&255,n[l*17+8]=Sh(p.offset,8)&255,n[l*17+9]=Sh(p.offset,16)&255,n[l*17+10]=Sh(p.offset,24)&255,n[l*17+11]=Sh(p.offset,32)&255,n[l*17+12]=Sh(p.offset,48)&255,n[l*17+13]=p.length&255,n[l*17+14]=p.length>>8&255,n[l*17+15]=p.length>>16&255,n[l*17+16]=p.length>>24&255}return e},R3=(r,e)=>{if(r.byteLength<17)return null;const n=r.byteLength/17,l=Tw(r,n-1);if(l.is_dir){const p=l.z,v=e.z-p,b=Math.trunc(e.x/(1<{if(r.type=="json"){const n=r.url.substr(10);let l=this.tiles.get(n);return l||(l=new Qv(n),this.tiles.set(n,l)),l.getHeader().then(p=>{const v={tiles:[r.url+"/{z}/{x}/{y}"],minzoom:p.minZoom,maxzoom:p.maxZoom,bounds:[p.minLon,p.minLat,p.maxLon,p.maxLat]};e(null,v,null,null)}).catch(p=>{e(p,null,null,null)}),{cancel:()=>{}}}else{const n=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=r.url.match(n);if(!l)throw new Error("Invalid PMTiles protocol URL");const p=l[1];let v=this.tiles.get(p);v||(v=new Qv(p),this.tiles.set(p,v));const b=l[2],c=l[3],A=l[4],T=new AbortController,z=T.signal;let B=()=>{T.abort()};return v.getHeader().then(U=>{v.getZxy(+b,+c,+A,z).then(j=>{j?e(null,new Uint8Array(j.data),j.cacheControl,j.expires):U.tileType==1?e(null,new Uint8Array,null,null):e(null,null,null,null)}).catch(j=>{j.name!=="AbortError"&&e(j,null,null,null)})}),{cancel:B}}},this.tiles=new Map}add(r){this.tiles.set(r.source.getKey(),r)}get(r){return this.tiles.get(r)}};function Dc(r,e){return(e>>>0)*4294967296+(r>>>0)}function U3(r,e){const n=e.buf;let l,p;if(p=n[e.pos++],l=(p&112)>>4,p<128||(p=n[e.pos++],l|=(p&127)<<3,p<128)||(p=n[e.pos++],l|=(p&127)<<10,p<128)||(p=n[e.pos++],l|=(p&127)<<17,p<128)||(p=n[e.pos++],l|=(p&127)<<24,p<128)||(p=n[e.pos++],l|=(p&1)<<31,p<128))return Dc(r,l);throw new Error("Expected varint not more than 10 bytes")}function Ih(r){const e=r.buf;let n,l;return l=e[r.pos++],n=l&127,l<128||(l=e[r.pos++],n|=(l&127)<<7,l<128)||(l=e[r.pos++],n|=(l&127)<<14,l<128)||(l=e[r.pos++],n|=(l&127)<<21,l<128)?n:(l=e[r.pos],n|=(l&15)<<28,U3(n,r))}function $3(r,e,n,l){if(l==0){n==1&&(e[0]=r-1-e[0],e[1]=r-1-e[1]);const p=e[0];e[0]=e[1],e[1]=p}}var V3=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function j3(r,e,n){if(r>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Math.pow(2,r)-1||n>Math.pow(2,r)-1)throw Error("tile x/y outside zoom level bounds");const l=V3[r],p=Math.pow(2,r);let v=0,b=0,c=0;const A=[e,n];let T=p/2;for(;T>0;)v=(A[0]&T)>0?1:0,b=(A[1]&T)>0?1:0,c+=T*T*(3*v^b),$3(T,A,v,b),T=T/2;return l+c}function Aw(r,e){return us(this,null,function*(){if(e===1||e===0)return r;if(e===2){if(typeof globalThis.DecompressionStream>"u")return dy(new Uint8Array(r));{let l=new Response(r).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(l).arrayBuffer()}}else throw Error("Compression method not supported")})}var q3=127;function G3(r,e){let n=0,l=r.length-1;for(;n<=l;){const p=l+n>>1,v=e-r[p].tileId;if(v>0)n=p+1;else if(v<0)l=p-1;else return r[p]}return l>=0&&(r[l].runLength===0||e-r[l].tileId=300)throw Error("Bad response code: "+v.status);const b=v.headers.get("Content-Length");if(v.status===200&&(!b||+b>e))throw l&&l.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield v.arrayBuffer(),etag:v.headers.get("ETag")||void 0,cacheControl:v.headers.get("Cache-Control")||void 0,expires:v.headers.get("Expires")||void 0}})}};function da(r,e){const n=r.getUint32(e+4,!0),l=r.getUint32(e+0,!0);return n*Math.pow(2,32)+l}function W3(r,e){const n=new DataView(r),l=n.getUint8(7);if(l>3)throw Error(`Archive is spec version ${l} but this library supports up to spec version 3`);return{specVersion:l,rootDirectoryOffset:da(n,8),rootDirectoryLength:da(n,16),jsonMetadataOffset:da(n,24),jsonMetadataLength:da(n,32),leafDirectoryOffset:da(n,40),leafDirectoryLength:da(n,48),tileDataOffset:da(n,56),tileDataLength:da(n,64),numAddressedTiles:da(n,72),numTileEntries:da(n,80),numTileContents:da(n,88),clustered:n.getUint8(96)===1,internalCompression:n.getUint8(97),tileCompression:n.getUint8(98),tileType:n.getUint8(99),minZoom:n.getUint8(100),maxZoom:n.getUint8(101),minLon:n.getInt32(102,!0)/1e7,minLat:n.getInt32(106,!0)/1e7,maxLon:n.getInt32(110,!0)/1e7,maxLat:n.getInt32(114,!0)/1e7,centerZoom:n.getUint8(118),centerLon:n.getInt32(119,!0)/1e7,centerLat:n.getInt32(123,!0)/1e7,etag:e}}function Ew(r){const e={buf:new Uint8Array(r),pos:0},n=Ih(e),l=[];let p=0;for(let v=0;v0?l[v].offset=l[v-1].offset+l[v-1].length:l[v].offset=b-1}return l}function H3(r){const e=new DataView(r);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var qc=class extends Error{};function Y3(r,e,n,l){return us(this,null,function*(){const p=yield r.getBytes(0,16384);if(new DataView(p.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(H3(p.data)<3)return[yield kw.getHeader(r)];const b=p.data.slice(0,q3);let c=p.etag;l&&p.etag!=l&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+r.getKey()),c=void 0);const A=W3(b,c);if(n){const T=p.data.slice(A.rootDirectoryOffset,A.rootDirectoryOffset+A.rootDirectoryLength),z=r.getKey()+"|"+(A.etag||"")+"|"+A.rootDirectoryOffset+"|"+A.rootDirectoryLength,B=Ew(yield e(T,A.internalCompression));return[A,[z,B.length,B]]}return[A,void 0]})}function K3(r,e,n,l,p){return us(this,null,function*(){const v=yield r.getBytes(n,l);if(p.etag&&p.etag!==v.etag)throw new qc(v.etag);const b=yield e(v.data,p.internalCompression),c=Ew(b);if(c.length===0)throw new Error("Empty directory is invalid");return c})}var X3=class{constructor(r=100,e=!0,n=Aw){this.cache=new Map,this.maxCacheEntries=r,this.counter=1,this.prefetch=e,this.decompress=n}getHeader(r,e){return us(this,null,function*(){const n=r.getKey();if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;const l=new Promise((p,v)=>{Y3(r,this.decompress,this.prefetch,e).then(b=>{b[1]&&this.cache.set(b[1][0],{lastUsed:this.counter++,data:Promise.resolve(b[1][2])}),p(b[0]),this.prune()}).catch(b=>{v(b)})});return this.cache.set(n,{lastUsed:this.counter++,data:l}),l})}getDirectory(r,e,n,l){return us(this,null,function*(){const p=r.getKey()+"|"+(l.etag||"")+"|"+e+"|"+n;if(this.cache.has(p))return this.cache.get(p).lastUsed=this.counter++,yield this.cache.get(p).data;const v=new Promise((b,c)=>{K3(r,this.decompress,e,n,l).then(A=>{b(A),this.prune()}).catch(A=>{c(A)})});return this.cache.set(p,{lastUsed:this.counter++,data:v}),v})}getArrayBuffer(r,e,n,l){return us(this,null,function*(){const p=r.getKey()+"|"+(l.etag||"")+"|"+e+"|"+n;if(this.cache.has(p))return this.cache.get(p).lastUsed=this.counter++,yield this.cache.get(p).data;const v=new Promise((b,c)=>{r.getBytes(e,n).then(A=>{if(l.etag&&l.etag!==A.etag)throw new qc(A.etag);b(A.data),this.cache.has(p),this.prune()}).catch(A=>{c(A)})});return this.cache.set(p,{lastUsed:this.counter++,data:v}),v})}prune(){if(this.cache.size>=this.maxCacheEntries){let r=1/0,e;this.cache.forEach((n,l)=>{n.lastUsedv.maxZoom)return;let b=v.rootDirectoryOffset,c=v.rootDirectoryLength;for(let A=0;A<=3;A++){const T=yield this.cache.getDirectory(this.source,b,c,v),z=G3(T,p);if(z)if(z.runLength>0){const B=yield this.source.getBytes(v.tileDataOffset+z.offset,z.length,l);if(v.etag&&v.etag!==B.etag)throw new qc(B.etag);return{data:yield this.decompress(B.data,v.tileCompression),cacheControl:B.cacheControl,expires:B.expires}}else b=v.leafDirectoryOffset+z.offset,c=z.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(r,e,n,l){return us(this,null,function*(){try{return yield this.getZxyAttempt(r,e,n,l)}catch(p){if(p instanceof qc)return this.cache.invalidate(this.source,p.message),yield this.getZxyAttempt(r,e,n,l);throw p}})}getMetadataAttempt(){return us(this,null,function*(){const r=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(r.jsonMetadataOffset,r.jsonMetadataLength);if(r.etag&&r.etag!==e.etag)throw new qc(e.etag);const n=yield this.decompress(e.data,r.internalCompression),l=new TextDecoder("utf-8");return JSON.parse(l.decode(n))})}getMetadata(){return us(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(r){if(r instanceof qc)return this.cache.invalidate(this.source,r.message),yield this.getMetadataAttempt();throw r}})}};function J3(r,e){Pr(e,!1);const n=Cn(),l=()=>br(T,"$map",n),p=()=>br(z,"$source",n);let v=le(e,"id",8,()=>s_("vector")),b=le(e,"url",0,null),c=le(e,"tiles",0,null),A=le(e,"promoteId",0,null);if(b()&&b().includes("pmtiles://")&&!jl.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let Q=new N3;jl.addProtocol("pmtiles",Q.tile)}const{map:T,self:z}=FM();let B=wt();lu(()=>{p()&&l()&&(YM(T,p(),oe(B)),ki(z,null),ot(B,void 0))}),bt(()=>(l(),p(),ze(v()),ze(b()),ze(c()),ze(A())),()=>{l()&&p()!==v()&&(ki(z,v()),HM(l(),p(),o_({type:"vector",url:b(),tiles:c(),promoteId:A()}),Q=>l()&&Q===p(),()=>{var Q;p()&&ot(B,(Q=l())==null?void 0:Q.getSource(p()))}))}),bt(()=>(l(),ze(v())),()=>{var Q;(Q=l())==null||Q.on("style.load",()=>{var ae;ot(B,(ae=l())==null?void 0:ae.getSource(v()))})}),_i(),zr();var U=nr(),j=ct(U);pr(j,p,Q=>{var ae=nr(),ne=ct(ae);Tb(ne,p,Y=>{var _e=nr(),de=ct(_e);hr(de,Wr(e),{},null),xe(Y,_e)}),xe(Q,ae)}),xe(r,U),Lr()}var Q3=Xe(" ",1);function u_(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Hy,"$previewMetricMapColors",n);let p=wt(!0),v=wt(),b=le(e,"bounds",4);Yy.subscribe(T=>{ot(v,T),ot(p,!1),setTimeout(()=>ot(p,!0),0)}),zr();var c=nr(),A=ct(c);pr(A,()=>oe(p),T=>{o3(T,{style:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",standardControls:!0,center:[0,53],zoom:2,get bounds(){return b()},set bounds(z){b(z)},children:(z,B)=>{J3(z,{get url(){return oe(v)},promoteId:"GEO_ID",children:(U,j)=>{var Q=Q3(),ae=ct(Q),ne=Yo(()=>({"fill-color":["coalesce",["feature-state","color"],"#102020"],"fill-opacity":jM(.7,1)}));ZM(ae,{get paint(){return oe(ne)},sourceLayer:"geoms",manageHoverState:!0,eventsIfTopMost:!0,hoverCursor:"pointer",$$legacy:!0});var Y=we(we(ae,!0));XM(Y,{get data(){return l()},idCol:"GEO_ID",sourceLayer:"geoms",$$legacy:!0}),xe(U,Q)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0})}),xe(r,c),Lr()}var eD=Xe('

    Pick country...

    '),tD=Xe('
    '),rD=Xe('
    ');function iD(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Ep,"$selectedCountry",n),p=()=>br(ry,"$countries",n);let v=wt();function b(c){ki(Ep,c),console.log("Selected country: ",l()),ki(tm,{kind:"level"})}Gp(async()=>{ki(Hy,[]),ki(Bl,[]),ki(Cp,[])}),zr(),vy(r,{$$slots:{sidebar:(c,A)=>{var T=tD(),z=ut(T),B=ut(z);uw(B);var U=we(we(B,!0));Hs(U,{children:(Q,ae)=>{var ne=eD(),Y=ut(ne);ut(Y),ht(Y);var _e=we(we(Y,!0));cw(_e,{color:"grey",size:"lg",class:"text-grey ms-2 h-6 w-6 dark:text-gray-500",$$legacy:!0}),ht(ne),xe(Q,ne)},$$slots:{default:!0},$$legacy:!0});var j=we(we(U,!0));i_(j,{placement:"right-start",children:(Q,ae)=>{var ne=nr(),Y=ct(ne);Oa(Y,1,p,Fa,(_e,de,pe)=>{n_(_e,{$$events:{click:()=>b(Pi(de).country_name_short_en)},children:(Te,De)=>{dr();var je=Hn();Pt(()=>gi(je,Pi(de).country_name_short_en)),xe(Te,je)},$$slots:{default:!0},$$legacy:!0})}),xe(Q,ne)},$$slots:{default:!0},$$legacy:!0}),ht(z),ht(T),xe(c,T)},map:(c,A)=>{var T=rD(),z=ut(T);u_(z,{get bounds(){return oe(v)},set bounds(B){ot(v,B)},$$legacy:!0}),ht(T),xe(c,T)}},$$legacy:!0}),Lr()}function nD(r){return new Worker(""+new URL("../workers/rust_worker-BdWdqBP_.js",import.meta.url).href,{type:"module",name:r==null?void 0:r.name})}function sD(r){return new Worker(""+new URL("../workers/duckdb_worker-DqZfXcIA.js",import.meta.url).href,{type:"module",name:r==null?void 0:r.name})}var aD=Xe('
    ');function eb(r,e){let n=le(e,"searchTerm",4);var l=aD(),p=ut(l);Zp(p),ht(l),Wp(p,n,v=>n(v)),Ve("input",p,function(v){Ne.call(this,e,v)}),xe(r,l)}const Fn=[];for(let r=0;r<256;++r)Fn.push((r+256).toString(16).slice(1));function oD(r,e=0){return(Fn[r[e+0]]+Fn[r[e+1]]+Fn[r[e+2]]+Fn[r[e+3]]+"-"+Fn[r[e+4]]+Fn[r[e+5]]+"-"+Fn[r[e+6]]+Fn[r[e+7]]+"-"+Fn[r[e+8]]+Fn[r[e+9]]+"-"+Fn[r[e+10]]+Fn[r[e+11]]+Fn[r[e+12]]+Fn[r[e+13]]+Fn[r[e+14]]+Fn[r[e+15]]).toLowerCase()}let Lg;const lD=new Uint8Array(16);function cD(){if(!Lg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Lg=crypto.getRandomValues.bind(crypto)}return Lg(lD)}const uD=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tb={randomUUID:uD};function hD(r,e,n){if(tb.randomUUID&&!e&&!r)return tb.randomUUID();r=r||{};const l=r.random||(r.rng||cD)();return l[6]=l[6]&15|64,l[8]=l[8]&63|128,oD(l)}var dD=Xe("ID",1),fD=Xe("Name",1),pD=Xe("Description",1),mD=Xe("Column",1),gD=Xe("Year",1),yD=Xe("Selected metrics",1),_D=Xe(" ",1),vD=Xe("Remove",1),bD=Xe(" ",1),xD=Xe(" ",1),wD=Xe("
    ");function SD(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Bl,"$selectedMetricsList",n);function p(A){console.log(A);const T=l().indexOf(A);T>-1&&l().splice(T,1),ki(Bl,[...l()])}let v=le(e,"nameAndDescriptionClass",0,"max-w-md whitespace-normal break-words border-b border-gray-200 px-2 py-2");zr();var b=wD(),c=ut(b);Lp(c,{children:(A,T)=>{var z=xD(),B=ct(z);Rp(B,{children:(j,Q)=>{var ae=_D(),ne=ct(ae);os(ne,{children:(De,je)=>{dr();var ke=dD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var Y=we(we(ne,!0));os(Y,{get class(){return v()},children:(De,je)=>{dr();var ke=fD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var _e=we(we(Y,!0));os(_e,{get class(){return v()},children:(De,je)=>{dr();var ke=pD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var de=we(we(_e,!0));os(de,{children:(De,je)=>{dr();var ke=mD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var pe=we(we(de,!0));os(pe,{children:(De,je)=>{dr();var ke=gD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var Te=we(we(pe,!0));os(Te,{children:(De,je)=>{dr();var ke=yD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0}),xe(j,ae)},$$slots:{default:!0},$$legacy:!0});var U=we(we(B,!0));zp(U,{tableBodyClass:"divide-y",children:(j,Q)=>{var ae=nr(),ne=ct(ae);Oa(ne,1,l,Fa,(Y,_e,de)=>{Bp(Y,{children:(pe,Te)=>{var De=bD(),je=ct(De);ws(je,{children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_id.slice(0,8))),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var ke=we(we(je,!0));ws(ke,{get class(){return v()},children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_human_readable_name)),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var $e=we(we(ke,!0));ws($e,{get class(){return v()},children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_description)),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var Me=we(we($e,!0));ws(Me,{children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_parquet_column_name)),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var He=we(we(Me,!0));ws(He,{children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).source_data_release_collection_period_start.slice(0,4))),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var Ye=we(we(He,!0));ws(Ye,{children:(Pe,tt)=>{Hs(Pe,{color:"light",$$events:{click:()=>p(Pi(_e))},children:(Je,lt)=>{dr();var At=vD();xe(Je,At)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(pe,De)},$$slots:{default:!0},$$legacy:!0})}),xe(j,ae)},$$slots:{default:!0},$$legacy:!0}),xe(A,z)},$$slots:{default:!0},$$legacy:!0}),ht(b),xe(r,b),Lr()}function ID(r,e){switch(arguments.length){case 0:break;case 1:{typeof r=="function"?this.interpolator(r):this.range(r);break}default:{this.domain(r),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}function h_(r,e,n){r.prototype=e.prototype=n,n.constructor=r}function Cw(r,e){var n=Object.create(r.prototype);for(var l in e)n[l]=e[l];return n}function cd(){}var Yh=.7,Np=1/Yh,Jc="\\s*([+-]?\\d+)\\s*",Kh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Na="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",TD=/^#([0-9a-f]{3,8})$/,kD=new RegExp(`^rgb\\(${Jc},${Jc},${Jc}\\)$`),AD=new RegExp(`^rgb\\(${Na},${Na},${Na}\\)$`),ED=new RegExp(`^rgba\\(${Jc},${Jc},${Jc},${Kh}\\)$`),CD=new RegExp(`^rgba\\(${Na},${Na},${Na},${Kh}\\)$`),MD=new RegExp(`^hsl\\(${Kh},${Na},${Na}\\)$`),DD=new RegExp(`^hsla\\(${Kh},${Na},${Na},${Kh}\\)$`),rb={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};h_(cd,Xh,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ib,formatHex:ib,formatHex8:PD,formatHsl:LD,formatRgb:nb,toString:nb});function ib(){return this.rgb().formatHex()}function PD(){return this.rgb().formatHex8()}function LD(){return Mw(this).formatHsl()}function nb(){return this.rgb().formatRgb()}function Xh(r){var e,n;return r=(r+"").trim().toLowerCase(),(e=TD.exec(r))?(n=e[1].length,e=parseInt(e[1],16),n===6?sb(e):n===3?new Ts(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?kf(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?kf(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=kD.exec(r))?new Ts(e[1],e[2],e[3],1):(e=AD.exec(r))?new Ts(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ED.exec(r))?kf(e[1],e[2],e[3],e[4]):(e=CD.exec(r))?kf(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=MD.exec(r))?lb(e[1],e[2]/100,e[3]/100,1):(e=DD.exec(r))?lb(e[1],e[2]/100,e[3]/100,e[4]):rb.hasOwnProperty(r)?sb(rb[r]):r==="transparent"?new Ts(NaN,NaN,NaN,0):null}function sb(r){return new Ts(r>>16&255,r>>8&255,r&255,1)}function kf(r,e,n,l){return l<=0&&(r=e=n=NaN),new Ts(r,e,n,l)}function zD(r){return r instanceof cd||(r=Xh(r)),r?(r=r.rgb(),new Ts(r.r,r.g,r.b,r.opacity)):new Ts}function fy(r,e,n,l){return arguments.length===1?zD(r):new Ts(r,e,n,l??1)}function Ts(r,e,n,l){this.r=+r,this.g=+e,this.b=+n,this.opacity=+l}h_(Ts,fy,Cw(cd,{brighter(r){return r=r==null?Np:Math.pow(Np,r),new Ts(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Yh:Math.pow(Yh,r),new Ts(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ts(Fl(this.r),Fl(this.g),Fl(this.b),Up(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:ab,formatHex:ab,formatHex8:BD,formatRgb:ob,toString:ob}));function ab(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}`}function BD(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}${Ll((isNaN(this.opacity)?1:this.opacity)*255)}`}function ob(){const r=Up(this.opacity);return`${r===1?"rgb(":"rgba("}${Fl(this.r)}, ${Fl(this.g)}, ${Fl(this.b)}${r===1?")":`, ${r})`}`}function Up(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Fl(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ll(r){return r=Fl(r),(r<16?"0":"")+r.toString(16)}function lb(r,e,n,l){return l<=0?r=e=n=NaN:n<=0||n>=1?r=e=NaN:e<=0&&(r=NaN),new pa(r,e,n,l)}function Mw(r){if(r instanceof pa)return new pa(r.h,r.s,r.l,r.opacity);if(r instanceof cd||(r=Xh(r)),!r)return new pa;if(r instanceof pa)return r;r=r.rgb();var e=r.r/255,n=r.g/255,l=r.b/255,p=Math.min(e,n,l),v=Math.max(e,n,l),b=NaN,c=v-p,A=(v+p)/2;return c?(e===v?b=(n-l)/c+(n0&&A<1?0:b,new pa(b,c,A,r.opacity)}function RD(r,e,n,l){return arguments.length===1?Mw(r):new pa(r,e,n,l??1)}function pa(r,e,n,l){this.h=+r,this.s=+e,this.l=+n,this.opacity=+l}h_(pa,RD,Cw(cd,{brighter(r){return r=r==null?Np:Math.pow(Np,r),new pa(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Yh:Math.pow(Yh,r),new pa(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,n=this.l,l=n+(n<.5?n:1-n)*e,p=2*n-l;return new Ts(zg(r>=240?r-240:r+120,p,l),zg(r,p,l),zg(r<120?r+240:r-120,p,l),this.opacity)},clamp(){return new pa(cb(this.h),Af(this.s),Af(this.l),Up(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(){const r=Up(this.opacity);return`${r===1?"hsl(":"hsla("}${cb(this.h)}, ${Af(this.s)*100}%, ${Af(this.l)*100}%${r===1?")":`, ${r})`}`}}));function cb(r){return r=(r||0)%360,r<0?r+360:r}function Af(r){return Math.max(0,Math.min(1,r||0))}function zg(r,e,n){return(r<60?e+(n-e)*r/60:r<180?n:r<240?e+(n-e)*(240-r)/60:e)*255}const d_=r=>()=>r;function FD(r,e){return function(n){return r+n*e}}function OD(r,e,n){return r=Math.pow(r,n),e=Math.pow(e,n)-r,n=1/n,function(l){return Math.pow(r+l*e,n)}}function ND(r){return(r=+r)==1?Dw:function(e,n){return n-e?OD(e,n,r):d_(isNaN(e)?n:e)}}function Dw(r,e){var n=e-r;return n?FD(r,n):d_(isNaN(r)?e:r)}const ub=function r(e){var n=ND(e);function l(p,v){var b=n((p=fy(p)).r,(v=fy(v)).r),c=n(p.g,v.g),A=n(p.b,v.b),T=Dw(p.opacity,v.opacity);return function(z){return p.r=b(z),p.g=c(z),p.b=A(z),p.opacity=T(z),p+""}}return l.gamma=r,l}(1);function UD(r,e){e||(e=[]);var n=r?Math.min(e.length,r.length):0,l=e.slice(),p;return function(v){for(p=0;pn&&(v=e.slice(n,v),c[b]?c[b]+=v:c[++b]=v),(l=l[0])===(p=p[0])?c[b]?c[b]+=p:c[++b]=p:(c[++b]=null,A.push({i:b,x:py(l,p)})),n=Bg.lastIndex;return n=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function $p(r,e){if((n=(r=e?r.toExponential(e-1):r.toExponential()).indexOf("e"))<0)return null;var n,l=r.slice(0,n);return[l.length>1?l[0]+l.slice(2):l,+r.slice(n+1)]}function ou(r){return r=$p(Math.abs(r)),r?r[1]:NaN}function KD(r,e){return function(n,l){for(var p=n.length,v=[],b=0,c=r[0],A=0;p>0&&c>0&&(A+c+1>l&&(c=Math.max(1,l-A)),v.push(n.substring(p-=c,p+c)),!((A+=c+1)>l));)c=r[b=(b+1)%r.length];return v.reverse().join(e)}}function XD(r){return function(e){return e.replace(/[0-9]/g,function(n){return r[+n]})}}var JD=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Vp(r){if(!(e=JD.exec(r)))throw new Error("invalid format: "+r);var e;return new p_({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Vp.prototype=p_.prototype;function p_(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}p_.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 QD(r){e:for(var e=r.length,n=1,l=-1,p;n0&&(l=0);break}return l>0?r.slice(0,l)+r.slice(p+1):r}var Lw;function eP(r,e){var n=$p(r,e);if(!n)return r+"";var l=n[0],p=n[1],v=p-(Lw=Math.max(-8,Math.min(8,Math.floor(p/3)))*3)+1,b=l.length;return v===b?l:v>b?l+new Array(v-b+1).join("0"):v>0?l.slice(0,v)+"."+l.slice(v):"0."+new Array(1-v).join("0")+$p(r,Math.max(0,e+v-1))[0]}function hb(r,e){var n=$p(r,e);if(!n)return r+"";var l=n[0],p=n[1];return p<0?"0."+new Array(-p).join("0")+l:l.length>p+1?l.slice(0,p+1)+"."+l.slice(p+1):l+new Array(p-l.length+2).join("0")}const db={"%":(r,e)=>(r*100).toFixed(e),b:r=>Math.round(r).toString(2),c:r=>r+"",d:YD,e:(r,e)=>r.toExponential(e),f:(r,e)=>r.toFixed(e),g:(r,e)=>r.toPrecision(e),o:r=>Math.round(r).toString(8),p:(r,e)=>hb(r*100,e),r:hb,s:eP,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function fb(r){return r}var pb=Array.prototype.map,mb=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tP(r){var e=r.grouping===void 0||r.thousands===void 0?fb:KD(pb.call(r.grouping,Number),r.thousands+""),n=r.currency===void 0?"":r.currency[0]+"",l=r.currency===void 0?"":r.currency[1]+"",p=r.decimal===void 0?".":r.decimal+"",v=r.numerals===void 0?fb:XD(pb.call(r.numerals,String)),b=r.percent===void 0?"%":r.percent+"",c=r.minus===void 0?"−":r.minus+"",A=r.nan===void 0?"NaN":r.nan+"";function T(B){B=Vp(B);var U=B.fill,j=B.align,Q=B.sign,ae=B.symbol,ne=B.zero,Y=B.width,_e=B.comma,de=B.precision,pe=B.trim,Te=B.type;Te==="n"?(_e=!0,Te="g"):db[Te]||(de===void 0&&(de=12),pe=!0,Te="g"),(ne||U==="0"&&j==="=")&&(ne=!0,U="0",j="=");var De=ae==="$"?n:ae==="#"&&/[boxX]/.test(Te)?"0"+Te.toLowerCase():"",je=ae==="$"?l:/[%p]/.test(Te)?b:"",ke=db[Te],$e=/[defgprs%]/.test(Te);de=de===void 0?6:/[gprs]/.test(Te)?Math.max(1,Math.min(21,de)):Math.max(0,Math.min(20,de));function Me(He){var Ye=De,Pe=je,tt,Je,lt;if(Te==="c")Pe=ke(He)+Pe,He="";else{He=+He;var At=He<0||1/He<0;if(He=isNaN(He)?A:ke(Math.abs(He),de),pe&&(He=QD(He)),At&&+He==0&&Q!=="+"&&(At=!1),Ye=(At?Q==="("?Q:c:Q==="-"||Q==="("?"":Q)+Ye,Pe=(Te==="s"?mb[8+Lw/3]:"")+Pe+(At&&Q==="("?")":""),$e){for(tt=-1,Je=He.length;++ttlt||lt>57){Pe=(lt===46?p+He.slice(tt+1):He.slice(tt))+Pe,He=He.slice(0,tt);break}}}_e&&!ne&&(He=e(He,1/0));var Ze=Ye.length+He.length+Pe.length,ft=Ze>1)+Ye+He+Pe+ft.slice(Ze);break;default:He=ft+Ye+He+Pe;break}return v(He)}return Me.toString=function(){return B+""},Me}function z(B,U){var j=T((B=Vp(B),B.type="f",B)),Q=Math.max(-8,Math.min(8,Math.floor(ou(U)/3)))*3,ae=Math.pow(10,-Q),ne=mb[8+Q/3];return function(Y){return j(ae*Y)+ne}}return{format:T,formatPrefix:z}}var Ef,zw,Bw;rP({thousands:",",grouping:[3],currency:["$",""]});function rP(r){return Ef=tP(r),zw=Ef.format,Bw=Ef.formatPrefix,Ef}function iP(r){return Math.max(0,-ou(Math.abs(r)))}function nP(r,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ou(e)/3)))*3-ou(Math.abs(r)))}function sP(r,e){return r=Math.abs(r),e=Math.abs(e)-r,Math.max(0,ou(e)-ou(r))+1}function aP(r,e,n,l){var p=d3(r,e,n),v;switch(l=Vp(l??",f"),l.type){case"s":{var b=Math.max(Math.abs(r),Math.abs(e));return l.precision==null&&!isNaN(v=nP(p,b))&&(l.precision=v),Bw(l,b)}case"":case"e":case"g":case"p":case"r":{l.precision==null&&!isNaN(v=sP(p,Math.max(Math.abs(r),Math.abs(e))))&&(l.precision=v-(l.type==="e"));break}case"f":case"%":{l.precision==null&&!isNaN(v=iP(p))&&(l.precision=v-(l.type==="%")*2);break}}return zw(l)}function oP(r){var e=r.domain;return r.ticks=function(n){var l=e();return h3(l[0],l[l.length-1],n??10)},r.tickFormat=function(n,l){var p=e();return aP(p[0],p[p.length-1],n??10,l)},r.nice=function(n){n==null&&(n=10);var l=e(),p=0,v=l.length-1,b=l[p],c=l[v],A,T,z=10;for(c0;){if(T=hy(b,c,n),T===A)return l[p]=b,l[v]=c,e(l);if(T>0)b=Math.floor(b/T)*T,c=Math.ceil(c/T)*T;else if(T<0)b=Math.ceil(b*T)/T,c=Math.floor(c*T)/T;else break;A=T}return r},r}function lP(){var r=0,e=1,n,l,p,v,b=Pw,c=!1,A;function T(B){return B==null||isNaN(B=+B)?A:b(p===0?.5:(B=(v(B)-n)*p,c?Math.max(0,Math.min(1,B)):B))}T.domain=function(B){return arguments.length?([r,e]=B,n=v(r=+r),l=v(e=+e),p=n===l?0:1/(l-n),T):[r,e]},T.clamp=function(B){return arguments.length?(c=!!B,T):c},T.interpolator=function(B){return arguments.length?(b=B,T):b};function z(B){return function(U){var j,Q;return arguments.length?([j,Q]=U,b=B(j,Q),T):[b(0),b(1)]}}return T.range=z(f_),T.rangeRound=z(HD),T.unknown=function(B){return arguments.length?(A=B,T):A},function(B){return v=B,n=B(r),l=B(e),p=n===l?0:1/(l-n),T}}function cP(r,e){return e.domain(r.domain()).interpolator(r.interpolator()).clamp(r.clamp()).unknown(r.unknown())}function Rw(){var r=oP(lP()(Pw));return r.copy=function(){return cP(r,Rw())},ID.apply(r,arguments)}function sm(r){for(var e=r.length/6|0,n=new Array(e),l=0;l ",1),fP=Xe(" ",1),pP=Xe("
    ");function mP(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Nv,"$previewMetricMap",n),p=()=>br(Cp,"$previewedMetricsList",n),v=()=>br(Yy,"$tileUrl",n),b=()=>br(Bl,"$selectedMetricsList",n);function c(z){console.log("Set preview metric map: ",z),Nv.set(z);let B=l().metric_parquet_column_name;const U=Math.min(...p().map(ae=>Number(ae[B]))),j=Math.max(...p().map(ae=>Number(ae[B]))),Q=Rw(uP).domain([U,j]);console.log("min:",U),console.log("max:",j),ki(Hy,p().map(ae=>("color"in ae&&delete ae.color,{...ae,color:Q(Number(ae[B]))}))),console.log(v())}zr();var A=pP(),T=ut(A);Lp(T,{children:(z,B)=>{var U=fP(),j=ct(U);Rp(j,{children:(ae,ne)=>{var Y=dP(),_e=ct(Y);os(_e,{children:(pe,Te)=>{dr();var De=hP();xe(pe,De)},$$slots:{default:!0},$$legacy:!0});var de=we(we(_e,!0));Oa(de,1,b,Fa,(pe,Te,De)=>{os(pe,{children:(je,ke)=>{Hs(je,{size:"xs",color:"light",$$events:{click:()=>c(Pi(Te))},children:($e,Me)=>{dr();var He=Hn();Pt(()=>gi(He,Pi(Te).metric_parquet_column_name)),xe($e,He)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0})}),xe(ae,Y)},$$slots:{default:!0},$$legacy:!0});var Q=we(we(j,!0));zp(Q,{children:(ae,ne)=>{var Y=nr(),_e=ct(Y);Oa(_e,1,()=>p().slice(0,10),Fa,(de,pe,Te)=>{Bp(de,{children:(De,je)=>{var ke=nr(),$e=ct(ke);Oa($e,1,()=>Object.keys(Pi(pe)).map(function(Me){return String(Pi(pe)[Me])}),Fa,(Me,He,Ye)=>{ws(Me,{class:"justified",children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(He))),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0})}),xe(De,ke)},$$slots:{default:!0},$$legacy:!0})}),xe(ae,Y)},$$slots:{default:!0},$$legacy:!0}),xe(z,U)},$$slots:{default:!0},$$legacy:!0}),ht(A),xe(r,A),Lr()}var gP=Xe("Home",1),yP=Xe("Selected metrics and Preview",1),_P=Xe("Search term ",1),vP=Xe("Page ",1),bP=Xe("Name",1),xP=Xe("Year",1),wP=Xe("Selected metrics",1),SP=Xe(" ",1),IP=Xe("Add",1),TP=Xe(" ",1),kP=Xe(" ",1),AP=Xe('
    '),EP=Xe('

    Selected metrics

    ',1),CP=Xe('

    Preview of selected metrics

    ',1),MP=Xe("Search term ",1),DP=Xe("Page ",1),PP=Xe("Name",1),LP=Xe("Description",1),zP=Xe("Year",1),BP=Xe("Selected metrics",1),RP=Xe(" ",1),FP=Xe("Add",1),OP=Xe(" ",1),NP=Xe(" ",1),UP=Xe('
    ',1),$P=Xe("Bounding Box (left, bottom, right, top)"),VP=Xe("Get from map",1),jP=Xe(" ",1),qP=Xe(" ",1),GP=Xe("Output format: ",1),ZP=Xe("Copy",1),WP=Xe(" ",1),HP=Xe("Popgetter CLI command ",1),YP=Xe("Download and save",1),KP=Xe("Download and save data ",1),XP=Xe('
    ',1),JP=Xe(" ",1),QP=Xe(" ",1),e4=Xe('
    ');function t4(r,e){Pr(e,!1);const n=Cn(),l=()=>br(ty,"$rustBackend",n),p=()=>br(G1,"$duckdbBackend",n),v=()=>br(Bl,"$selectedMetricsList",n),b=()=>br(Cp,"$previewedMetricsList",n),c=()=>br(iy,"$selectedLevel",n),A=()=>br(Ep,"$selectedCountry",n),T=()=>br(Pe,"$page",n),z=["geojson","csv","geojsonseq"];let B=wt("csv"),U=wt(),j=wt(""),Q=wt(!1),ae={y:320,duration:200,easing:tM};async function ne(gt){try{console.log(gt),await l().isLoaded()||await l().initialise();let Ct=await l().downloadDataRequestMetricsSql(gt);console.log(Ct),await p().isLoaded()||await p().initialise();const Mt=await p().getMetrics(Ct);return console.log(Mt),Mt}catch(Ct){window.alert(`Failed to download: ${Ct}`)}}async function Y(){if(v().length===0)return[];const gt=v().map(Rt=>({MetricId:{id:Rt.metric_id}}));console.log(gt);let Ct={region:[],metrics:gt,years:[]};const Mt=await ne(Ct);ki(Cp,Mt),await l().isLoaded()||await l().initialise();try{let Rt=await l().downloadDataRequestGeomsPmtiles(Ct);console.log(Rt),ki(Yy,Rt)}catch(Rt){window.alert(`Failed to get tile URL: ${Rt}`)}console.log(b().slice(0,10))}function _e(){let gt=v().map(rt=>`--id ${rt.metric_id}`).join(" "),Ct="--output-format "+oe(B),Mt=oe(j)===""?"":"--bbox "+oe(j);return["popgetter","data",gt,Ct,Mt].join(" ")}function de(gt){console.log(gt),v().indexOf(gt)===-1?v().push(gt):console.log("Not added"),ki(Bl,[...v()])}function pe(gt){console.log(gt);const Ct=v().indexOf(gt);Ct>-1&&v().splice(Ct,1),ki(Bl,[...v()])}async function Te(gt,Ct){try{return await l().isLoaded()||await l().initialise(),await l().search(gt,Ct)}catch(Mt){window.alert(`Failed to search: ${Mt}`)}}function De(){console.log("Bounds:",oe(U)),ot(j,[oe(U)._sw.lng,oe(U)._sw.lat,oe(U)._ne.lng,oe(U)._ne.lat].map(gt=>Number(gt.toFixed(6)).toString()).join(","))}async function je(gt){await l().isLoaded()||await l().initialise();try{console.log(gt);let Mt=await l().downloadDataRequest(gt,oe(B));return console.log(Mt),Mt}catch(Mt){window.alert(`Failed to download: ${Mt}`)}}function ke(gt){let Ct=hD()+"."+oe(B).toLowerCase();const Mt=new Blob([gt],{type:"text/plain"}),rt=document.createElement("a");rt.download=Ct,rt.href=URL.createObjectURL(Mt),document.body.appendChild(rt),rt.click(),document.body.removeChild(rt),URL.revokeObjectURL(rt.href)}let $e=wt(""),Me={},He=[],Ye=wt([]);const Pe=ci(0);async function tt(){Me={metric_id:[],text:[{text:oe($e),context:["Hxl","HumanReadableName","Description"],config:{match_type:"Regex",case_sensitivity:"Insensitive"}}],geometry_level:{value:c(),config:{match_type:"Exact",case_sensitivity:"Insensitive"}},year_range:[],country:{value:A(),config:{match_type:"Regex",case_sensitivity:"Insensitive"}},region_spec:[]},console.log(Me),console.log(T()),He=await Te(Me,T()),ot(Ye,He.slice(0,10)),console.log(He)}function Je(gt,Ct){let Mt;return function(...rt){clearTimeout(Mt),Mt=setTimeout(()=>{gt.apply(this,rt)},Ct)}}const lt=Je(tt,300);async function At(){console.log("Bbox",oe(j));let gt={region:oe(j)===""?[]:[{BoundingBox:oe(j).split(",").map(Ct=>Number(Number(Ct).toFixed(6)))}],metrics:v().map(Ct=>({MetricId:{id:Ct.metric_id}}))};console.log("DataRequestSpec"),console.log(gt),ke(await je(gt))}const Ze="max-w-md whitespace-normal break-words border-b border-gray-200 px-2 py-2",ft="text-align: left; margin-top: 2.5%; margin-bottom: 5%; ",St="text-align: left; margin-top: 1.0%; margin-bottom: 1.0%; ";return zr(),vy(r,{$$slots:{sidebar:(gt,Ct)=>{var Mt=AP(),rt=ut(Mt);Ai(rt,"style",ft);var Rt=ut(rt);Hs(Rt,{color:"light",$$events:{click:()=>ki(tm,{kind:"title"})},children:(cr,Jr)=>{dr();var Ar=gP();xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0});var yr=we(we(Rt,!0));Hs(yr,{color:"light",$$events:{click:()=>ot(Q,!1)},children:(cr,Jr)=>{dr();var Ar=yP();xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),ht(rt);var _t=we(we(rt,!0));Ai(_t,"style",ft);var Ge=ut(_t);qo(Ge,{class:"space-y-2",children:(cr,Jr)=>{dr();var Ar=_P(),Qr=we(ct(Ar,!0));eb(Qr,{get searchTerm(){return oe($e)},set searchTerm($i){ot($e,$i)},$$events:{input:lt},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0});var Nt=we(we(Ge,!0));qo(Nt,{class:"space-y-2",children:(cr,Jr)=>{dr();var Ar=vP(),Qr=we(ct(Ar,!0));Wv(Qr,{get value(){return T()},set value($i){ki(Pe,$i)},$$events:{input:lt},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),ht(_t);var Ot=we(we(_t,!0)),Ir=ut(Ot);Lp(Ir,{children:(cr,Jr)=>{var Ar=kP(),Qr=ct(Ar);Rp(Qr,{children:(cn,Mn)=>{var vi=SP(),Ce=ct(vi);os(Ce,{children:(Xt,ir)=>{dr();var bi=bP();xe(Xt,bi)},$$slots:{default:!0},$$legacy:!0});var Vr=we(we(Ce,!0));os(Vr,{children:(Xt,ir)=>{dr();var bi=xP();xe(Xt,bi)},$$slots:{default:!0},$$legacy:!0});var Br=we(we(Vr,!0));os(Br,{children:(Xt,ir)=>{dr();var bi=wP();xe(Xt,bi)},$$slots:{default:!0},$$legacy:!0}),xe(cn,vi)},$$slots:{default:!0},$$legacy:!0});var $i=we(we(Qr,!0));zp($i,{tableBodyClass:"divide-y",children:(cn,Mn)=>{var vi=nr(),Ce=ct(vi);Oa(Ce,1,()=>oe(Ye),Fa,(Vr,Br,Xt)=>{Bp(Vr,{children:(ir,bi)=>{var fn=TP(),zi=ct(fn);ws(zi,{class:Ze,children:(fi,hn)=>{dr();var qe=Hn();Pt(()=>gi(qe,Pi(Br).metric_human_readable_name)),xe(fi,qe)},$$slots:{default:!0},$$legacy:!0});var un=we(we(zi,!0));ws(un,{children:(fi,hn)=>{dr();var qe=Hn();Pt(()=>gi(qe,Pi(Br).source_data_release_collection_period_start.slice(0,4))),xe(fi,qe)},$$slots:{default:!0},$$legacy:!0});var Ji=we(we(un,!0));ws(Ji,{children:(fi,hn)=>{Hs(fi,{color:"light",$$events:{click:()=>de(Pi(Br))},children:(qe,dn)=>{dr();var ar=IP();xe(qe,ar)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(ir,fn)},$$slots:{default:!0},$$legacy:!0})}),xe(cn,vi)},$$slots:{default:!0},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),ht(Ot),ht(Mt),xe(gt,Mt)},map:(gt,Ct)=>{var Mt=e4(),rt=ut(Mt);u_(rt,{get bounds(){return oe(U)},set bounds(_t){ot(U,_t)},$$legacy:!0});var Rt=we(we(rt,!0)),yr=ut(Rt);nC(yr,{placement:"top",position:"absolute",transitionType:"fly",width:"w-full",activateClickOutside:!1,transitionParams:ae,backdrop:!1,get hidden(){return oe(Q)},set hidden(_t){ot(Q,_t)},id:"sidebar8",children:(_t,Ge)=>{var Nt=QP(),Ot=ct(Nt);J1(Ot,{class:"mb-4 dark:text-white",$$events:{click:()=>ot(Q,!0)},$$legacy:!0});var Ir=we(we(Ot,!0));vM(Ir,{children:(cr,Jr)=>{var Ar=JP(),Qr=ct(Ar);If(Qr,{open:!0,title:"Selected Metrics",children:(vi,Ce)=>{var Vr=EP(),Br=ct(Vr);ut(Br),ht(Br);var Xt=we(we(Br,!0));SD(Xt,{$$legacy:!0}),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0});var $i=we(we(Qr,!0));If($i,{title:"Preview",$$events:{click:()=>Y()},children:(vi,Ce)=>{var Vr=CP(),Br=ct(Vr),Xt=ut(Br),ir=we(ut(Xt)),bi=Sb(()=>()=>At());ht(Xt),ht(Br);var fn=we(we(Br,!0));mP(fn,{$$legacy:!0}),Ve("click",ir,function(...zi){var un;return(un=oe(bi))==null?void 0:un.apply(this,zi)},!1),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0});var cn=we(we($i,!0));If(cn,{title:"Advanced Search",children:(vi,Ce)=>{var Vr=UP(),Br=ct(Vr);Ai(Br,"style",ft);var Xt=ut(Br);qo(Xt,{class:"space-y-2",children:(zi,un)=>{dr();var Ji=MP(),fi=we(ct(Ji,!0));eb(fi,{get searchTerm(){return oe($e)},set searchTerm(hn){ot($e,hn)},$$events:{input:lt},$$legacy:!0}),xe(zi,Ji)},$$slots:{default:!0},$$legacy:!0});var ir=we(we(Xt,!0));qo(ir,{class:"space-y-2",children:(zi,un)=>{dr();var Ji=DP(),fi=we(ct(Ji,!0));Wv(fi,{get value(){return T()},set value(hn){ki(Pe,hn)},$$events:{input:lt},$$legacy:!0}),xe(zi,Ji)},$$slots:{default:!0},$$legacy:!0}),ht(Br);var bi=we(we(Br,!0)),fn=ut(bi);Lp(fn,{children:(zi,un)=>{var Ji=NP(),fi=ct(Ji);Rp(fi,{children:(qe,dn)=>{var ar=RP(),Bi=ct(ar);os(Bi,{children:(xt,Hr)=>{dr();var ii=PP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0});var Ri=we(we(Bi,!0));os(Ri,{children:(xt,Hr)=>{dr();var ii=LP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0});var We=we(we(Ri,!0));os(We,{children:(xt,Hr)=>{dr();var ii=zP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0});var jt=we(we(We,!0));os(jt,{children:(xt,Hr)=>{dr();var ii=BP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0});var hn=we(we(fi,!0));zp(hn,{tableBodyClass:"divide-y",children:(qe,dn)=>{var ar=nr(),Bi=ct(ar);Oa(Bi,1,()=>oe(Ye),Fa,(Ri,We,jt)=>{Bp(Ri,{children:(xt,Hr)=>{var ii=OP(),qt=ct(ii);ws(qt,{class:Ze,children:(O,q)=>{dr();var X=Hn();Pt(()=>gi(X,Pi(We).metric_human_readable_name)),xe(O,X)},$$slots:{default:!0},$$legacy:!0});var On=we(we(qt,!0));ws(On,{class:Ze,children:(O,q)=>{dr();var X=Hn();Pt(()=>gi(X,Pi(We).metric_description)),xe(O,X)},$$slots:{default:!0},$$legacy:!0});var K=we(we(On,!0));ws(K,{children:(O,q)=>{dr();var X=Hn();Pt(()=>gi(X,Pi(We).source_data_release_collection_period_start.slice(0,4))),xe(O,X)},$$slots:{default:!0},$$legacy:!0});var R=we(we(K,!0));ws(R,{children:(O,q)=>{Hs(O,{color:"light",$$events:{click:()=>de(Pi(We))},children:(X,te)=>{dr();var ve=FP();xe(X,ve)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(xt,ii)},$$slots:{default:!0},$$legacy:!0})}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),xe(zi,Ji)},$$slots:{default:!0},$$legacy:!0}),ht(bi),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0});var Mn=we(we(cn,!0));If(Mn,{title:"Download",$$events:{click:()=>{De(),Y()}},children:(vi,Ce)=>{var Vr=XP(),Br=ct(Vr),Xt=ut(Br);Ai(Xt,"style",St);var ir=ut(Xt);qo(ir,{class:"space-y-2",children:(qe,dn)=>{var ar=$P();xe(qe,ar)},$$slots:{default:!0},$$legacy:!0});var bi=we(we(ir,!0));Cg(bi,{class:"w-full",children:(qe,dn)=>{var ar=jP(),Bi=ct(ar);uy(Bi,{id:"bbox",type:"text",placeholder:"",get value(){return oe(j)},set value(We){ot(j,We)},$$legacy:!0});var Ri=we(we(Bi,!0));Hs(Ri,{color:"light",class:"w-80",$$events:{click:()=>De()},children:(We,jt)=>{dr();var xt=VP();xe(We,xt)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(Xt);var fn=we(we(Xt,!0));Ai(fn,"style",St);var zi=ut(fn);qo(zi,{class:"space-y-2",children:(qe,dn)=>{dr();var ar=GP(),Bi=we(ct(ar,!0));Hs(Bi,{color:"light",children:(We,jt)=>{dr();var xt=qP(),Hr=ct(xt,!0),ii=we(Hr);kM(ii,{class:"ms-2 h-6 w-6",$$legacy:!0}),Pt(()=>gi(Hr,`${oe(B)??""} `)),xe(We,xt)},$$slots:{default:!0},$$legacy:!0});var Ri=we(we(Bi,!0));i_(Ri,{children:(We,jt)=>{var xt=nr(),Hr=ct(xt);Oa(Hr,1,()=>z,Fa,(ii,qt,On)=>{n_(ii,{$$events:{click:()=>ot(B,Pi(qt))},children:(K,R)=>{dr();var O=Hn();Pt(()=>gi(O,Pi(qt))),xe(K,O)},$$slots:{default:!0},$$legacy:!0})}),xe(We,xt)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(fn),ht(Br);var un=we(we(Br,!0));Ai(un,"style",St);var Ji=ut(un);qo(Ji,{class:"space-y-2",children:(qe,dn)=>{dr();var ar=HP(),Bi=we(ct(ar,!0));Cg(Bi,{class:"w-full",children:(Ri,We)=>{var jt=WP(),xt=ct(jt),Hr=Yo(_e);uy(xt,{id:"popgetter-data-cli",readonly:!0,get value(){return oe(Hr)},$$legacy:!0});var ii=we(we(xt,!0));Hs(ii,{color:"light","data-copy-to-clipboard-target":"popgetter-data-cli",$$events:{click:()=>{console.log(_e()),navigator.clipboard.writeText(_e())}},children:(qt,On)=>{dr();var K=ZP();xe(qt,K)},$$slots:{default:!0},$$legacy:!0}),xe(Ri,jt)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(un);var fi=we(we(un,!0));Ai(fi,"style",St);var hn=ut(fi);qo(hn,{class:"space-y-2",children:(qe,dn)=>{dr();var ar=KP(),Bi=we(ct(ar,!0));Cg(Bi,{class:"w-full",children:(Ri,We)=>{Hs(Ri,{color:"light",$$events:{click:()=>{At()}},children:(jt,xt)=>{dr();var Hr=YP();xe(jt,Hr)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(fi),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),xe(_t,Nt)},$$slots:{default:!0},$$legacy:!0}),ht(Rt),ht(Mt),xe(gt,Mt)}},$$legacy:!0}),SI(e,"remove",pe),Lr({remove:pe})}var r4=Xe('

    Pick geometry level...

    '),i4=Xe('
  • '),n4=Xe('
    '),s4=Xe('
    ');function a4(r,e){Pr(e,!1);const n=Cn(),l=()=>br(iy,"$selectedLevel",n),p=()=>br(Ep,"$selectedCountry",n),v={"United States":["tract","county","block_group"],Scotland:["OutputArea2011","CouncilArea2011","DataZone2011"],"Northern Ireland":["LGD14","DZ21","SDZ21"],"England and Wales":["msoa","lsoa","rgn","oa","ctry","ltla"],Belgium:["statistical_sector","municipality"]};let b=wt([]),c=wt();function A(T){ki(iy,T),console.log("Selected country: ",p()),console.log("Selected level: ",l()),ki(tm,{kind:"download"})}Gp(async()=>{try{ot(b,v[p()+""]),console.log(oe(b));return}catch(T){window.alert(`Failed to get levels: ${T}`)}}),zr(),vy(r,{$$slots:{sidebar:(T,z)=>{var B=n4(),U=ut(B),j=ut(U);uw(j);var Q=we(we(j,!0));Hs(Q,{children:(ne,Y)=>{var _e=r4(),de=ut(_e);ut(de),ht(de);var pe=we(we(de,!0));cw(pe,{color:"grey",size:"lg",class:"text-grey ms-2 h-6 w-6 dark:text-gray-500",$$legacy:!0}),ht(_e),xe(ne,_e)},$$slots:{default:!0},$$legacy:!0});var ae=we(we(Q,!0));i_(ae,{children:(ne,Y)=>{var _e=nr(),de=ct(_e);Oa(de,1,()=>oe(b),Fa,(pe,Te,De)=>{var je=i4(),ke=ut(je);n_(ke,{$$events:{click:()=>A(Pi(Te))},children:($e,Me)=>{dr();var He=Hn();Pt(()=>gi(He,Pi(Te))),xe($e,He)},$$slots:{default:!0},$$legacy:!0}),ht(je),xe(pe,je)}),xe(ne,_e)},$$slots:{default:!0},$$legacy:!0}),ht(U),ht(B),xe(T,B)},map:(T,z)=>{var B=s4(),U=ut(B);u_(U,{get bounds(){return oe(c)},set bounds(j){ot(c,j)},$$legacy:!0}),ht(B),xe(T,B)}},$$legacy:!0}),Lr()}var o4=Xe('

    Popgetter browser

    '),l4=Xe('
    ');function _4(r,e){Pr(e,!1);const n=Cn(),l=()=>br(ty,"$rustBackend",n),p=()=>br(ry,"$countries",n),v=()=>br(Fg,"$sidebarContents",n),b=()=>br(tm,"$mode",n);let c=wt(!1);Gp(async()=>{const T=Og(new nD);let z=await new T;ty.set(z);const B=Og(new sD);let U=await new B;G1.set(U),await l().isLoaded()||await l().initialise(),ki(ry,await l().getCountries()),console.log(p()),ot(c,!0)});let A=wt();bt(()=>(oe(A),v()),()=>{oe(A)&&v()&&(Rh(A,oe(A).innerHTML=""),oe(A).appendChild(v()))}),_i(),zr(),TI(r,{$$slots:{left:(T,z)=>{var B=o4(),U=ut(B),j=we(we(U,!0));Ol(j,Q=>ot(A,Q),()=>oe(A)),ht(B),xe(T,B)},main:(T,z)=>{var B=l4(),U=ut(B);pr(U,()=>oe(c),j=>{var Q=nr(),ae=ct(Q);pr(ae,()=>b().kind=="title",ne=>{iD(ne,{$$legacy:!0})},ne=>{var Y=nr(),_e=ct(Y);pr(_e,()=>b().kind=="level",de=>{a4(de,{$$legacy:!0})},de=>{var pe=nr(),Te=ct(pe);pr(Te,()=>b().kind=="download",De=>{t4(De,{$$legacy:!0})},null,!0),xe(de,pe)},!0),xe(ne,Y)}),xe(j,Q)},j=>{iM(j,{$$legacy:!0})}),ht(B),xe(T,B)}},$$legacy:!0}),Lr()}export{_4 as component}; + `,this._cooperativeGesturesScreen.setAttribute("aria-hidden","true"),this._canvasContainer.addEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.add("maplibregl-cooperative-gestures")}_destroyCooperativeGestures(){T.remove(this._cooperativeGesturesScreen),this._canvasContainer.removeEventListener("wheel",this._cooperativeGesturesOnWheel,!1),this._canvasContainer.classList.remove("maplibregl-cooperative-gestures")}_resizeCanvas(m,i,o){this._canvas.width=Math.floor(o*m),this._canvas.height=Math.floor(o*i),this._canvas.style.width=`${m}px`,this._canvas.style.height=`${i}px`}_setupPainter(){const m={alpha:!0,stencil:!0,depth:!0,failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1};let i=null;this._canvas.addEventListener("webglcontextcreationerror",h=>{i={requestedAttributes:m},h&&(i.statusMessage=h.statusMessage,i.type=h.type)},{once:!0});const o=this._canvas.getContext("webgl2",m)||this._canvas.getContext("webgl",m);if(!o){const h="Failed to initialize WebGL";throw i?(i.message=h,new Error(JSON.stringify(i))):new Error(h)}this.painter=new Ya(o,this.transform),z.testSupport(o)}_onCooperativeGesture(m,i,o){return!i&&o<2&&(this._cooperativeGesturesScreen.classList.add("maplibregl-show"),setTimeout(()=>{this._cooperativeGesturesScreen.classList.remove("maplibregl-show")},100)),!1}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(m){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||m,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(m){return this._update(),this._renderTaskQueue.add(m)}_cancelRenderFrame(m){this._renderTaskQueue.remove(m)}_render(m){const i=this._idleTriggered?this._fadeDuration:0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(m),this._removed)return;let o=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const f=this.transform.zoom,y=c.h.now();this.style.zoomHistory.update(f,y);const w=new c.a8(f,{now:y,fadeDuration:i,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),S=w.crossFadingFactor();S===1&&S===this._crossFadingFactor||(o=!0,this._crossFadingFactor=S),this.style.update(w)}this.style&&this._sourcesDirty&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform._minEleveationForCurrentTile=this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom),this._elevationFreeze||(this.transform.elevation=this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform._minEleveationForCurrentTile=0,this.transform.elevation=0),this._placementDirty=this.style&&this.style._updatePlacement(this.painter.transform,this.showCollisionBoxes,i,this._crossSourceCollisions),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:i,showPadding:this.showPadding}),this.fire(new c.k("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.bg.mark(c.bh.load),this.fire(new c.k("load"))),this.style&&(this.style.hasTransitions()||o)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const h=this._sourcesDirty||this._styleDirty||this._placementDirty;return h||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.k("idle")),!this._loaded||this._fullyLoaded||h||(this._fullyLoaded=!0,c.bg.mark(c.bh.fullLoad)),this}redraw(){return this.style&&(this._frame&&(this._frame.cancel(),this._frame=null),this._render(0)),this}remove(){var m;this._hash&&this._hash.remove();for(const o of this._controls)o.onRemove(this);this._controls=[],this._frame&&(this._frame.cancel(),this._frame=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),ne.removeThrottleControl(this._imageQueueHandle),(m=this._resizeObserver)===null||m===void 0||m.disconnect();const i=this.painter.context.gl.getExtension("WEBGL_lose_context");i&&i.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),T.remove(this._canvasContainer),T.remove(this._controlContainer),this._cooperativeGestures&&this._destroyCooperativeGestures(),this._container.classList.remove("maplibregl-map"),c.bg.clearMetrics(),this._removed=!0,this.fire(new c.k("remove"))}triggerRepaint(){this.style&&!this._frame&&(this._frame=c.h.frame(m=>{c.bg.frame(m),this._frame=null,this._render(m)}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(m){this._showTileBoundaries!==m&&(this._showTileBoundaries=m,this._update())}get showPadding(){return!!this._showPadding}set showPadding(m){this._showPadding!==m&&(this._showPadding=m,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(m){this._showCollisionBoxes!==m&&(this._showCollisionBoxes=m,m?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(m){this._showOverdrawInspector!==m&&(this._showOverdrawInspector=m,this._update())}get repaint(){return!!this._repaint}set repaint(m){this._repaint!==m&&(this._repaint=m,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(m){this._vertices=m,this._update()}get version(){return Lt}getCameraTargetElevation(){return this.transform.elevation}},Or.NavigationControl=class{constructor(m){this._updateZoomButtons=()=>{const i=this._map.getZoom(),o=i===this._map.getMaxZoom(),h=i===this._map.getMinZoom();this._zoomInButton.disabled=o,this._zoomOutButton.disabled=h,this._zoomInButton.setAttribute("aria-disabled",o.toString()),this._zoomOutButton.setAttribute("aria-disabled",h.toString())},this._rotateCompassArrow=()=>{const i=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitch*(Math.PI/180)),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${this._map.transform.angle*(180/Math.PI)}deg)`:`rotate(${this._map.transform.angle*(180/Math.PI)}deg)`;this._compassIcon.style.transform=i},this._setButtonTitle=(i,o)=>{const h=this._map._getUIString(`NavigationControl.${o}`);i.title=h,i.setAttribute("aria-label",h)},this.options=c.e({},Wu,m),this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",i=>i.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",i=>this._map.zoomIn({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",i=>this._map.zoomOut({},{originalEvent:i})),T.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",i=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:i}):this._map.resetNorth({},{originalEvent:i})}),this._compassIcon=T.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(m){return this._map=m,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Hu(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){T.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(m,i){const o=T.create("button",m,this._container);return o.type="button",o.addEventListener("click",i),o}},Or.GeolocateControl=class extends c.E{constructor(m){super(),this._onSuccess=i=>{if(this._map){if(this._isOutOfMapMaxBounds(i))return this._setErrorState(),this.fire(new c.k("outofmaxbounds",i)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=i,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(i),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(i),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new c.k("geolocate",i)),this._finish()}},this._updateCamera=i=>{const o=new c.L(i.coords.longitude,i.coords.latitude),h=i.coords.accuracy,f=this._map.getBearing(),y=c.e({bearing:f},this.options.fitBoundsOptions),w=Mt.fromLngLat(o,h);this._map.fitBounds(w,y,{geolocateSource:!0})},this._updateMarker=i=>{if(i){const o=new c.L(i.coords.longitude,i.coords.latitude);this._accuracyCircleMarker.setLngLat(o).addTo(this._map),this._userLocationDotMarker.setLngLat(o).addTo(this._map),this._accuracy=i.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=i=>{if(this._map){if(this.options.trackUserLocation)if(i.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(i.code===3&&Po)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.k("error",i)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=i=>{if(this._map){if(this._container.addEventListener("contextmenu",o=>o.preventDefault()),this._geolocateButton=T.create("button","maplibregl-ctrl-geolocate",this._container),T.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",i===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const o=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}else{const o=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.title=o,this._geolocateButton.setAttribute("aria-label",o)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=T.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Xa({element:this._dotElement}),this._circleElement=T.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Xa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",this.trigger.bind(this)),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",o=>{o.geolocateSource||this._watchState!=="ACTIVE_LOCK"||o.originalEvent&&o.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new c.k("trackuserlocationend")))})}},this.options=c.e({},Mi,m)}onAdd(m){return this._map=m,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),function(i,o=!1){Vi===void 0||o?window.navigator.permissions!==void 0?window.navigator.permissions.query({name:"geolocation"}).then(h=>{Vi=h.state!=="denied",i(Vi)}).catch(()=>{Vi=!!window.navigator.geolocation,i(Vi)}):(Vi=!!window.navigator.geolocation,i(Vi)):i(Vi)}(this._setupUI),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),T.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Ii=0,Po=!1}_isOutOfMapMaxBounds(m){const i=this._map.getMaxBounds(),o=m.coords;return i&&(o.longitudei.getEast()||o.latitudei.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const m=this._map.getBounds(),i=m.getSouthEast(),o=m.getNorthEast(),h=i.distanceTo(o),f=Math.ceil(this._accuracy/(h/this._map._container.clientHeight)*2);this._circleElement.style.width=`${f}px`,this._circleElement.style.height=`${f}px`}trigger(){if(!this._setup)return c.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new c.k("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":Ii--,Po=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new c.k("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new c.k("trackuserlocationstart"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let m;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),Ii++,Ii>1?(m={maximumAge:6e5,timeout:0},Po=!0):(m=this.options.positionOptions,Po=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,m)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},Or.AttributionControl=ts,Or.LogoControl=ui,Or.ScaleControl=class{constructor(m){this._onMove=()=>{bl(this._map,this._container,this.options)},this.setUnit=i=>{this.options.unit=i,bl(this._map,this._container,this.options)},this.options=c.e({},vl,m)}getDefaultPosition(){return"bottom-left"}onAdd(m){return this._map=m,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-scale",m.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){T.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},Or.FullscreenControl=class extends c.E{constructor(m={}){super(),this._onFullscreenChange=()=>{(window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement)===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,m&&m.container&&(m.container instanceof HTMLElement?this._container=m.container:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(m){return this._map=m,this._container||(this._container=this._map.getContainer()),this._controlContainer=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){T.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const m=this._fullscreenButton=T.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);T.create("span","maplibregl-ctrl-icon",m).setAttribute("aria-hidden","true"),m.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const m=this._getTitle();this._fullscreenButton.setAttribute("aria-label",m),this._fullscreenButton.title=m}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.k("fullscreenstart")),this._map._cooperativeGestures&&(this._prevCooperativeGestures=this._map._cooperativeGestures,this._map.setCooperativeGestures())):(this.fire(new c.k("fullscreenend")),this._prevCooperativeGestures&&(this._map.setCooperativeGestures(this._prevCooperativeGestures),delete this._prevCooperativeGestures))}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},Or.TerrainControl=class{constructor(m){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.disableTerrain")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.enableTerrain"))},this.options=m}onAdd(m){return this._map=m,this._container=T.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=T.create("button","maplibregl-ctrl-terrain",this._container),T.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){T.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},Or.Popup=class extends c.E{constructor(m){super(),this.remove=()=>(this._content&&T.remove(this._content),this._container&&(T.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),delete this._map),this.fire(new c.k("close")),this),this._onMouseUp=i=>{this._update(i.point)},this._onMouseMove=i=>{this._update(i.point)},this._onDrag=i=>{this._update(i.point)},this._update=i=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=T.create("div","maplibregl-popup",this._map.getContainer()),this._tip=T.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const w of this.options.className.split(" "))this._container.classList.add(w);this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._map.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=Yu(this._lngLat,this._pos,this._map.transform)),this._trackPointer&&!i)return;const o=this._pos=this._trackPointer&&i?i:this._map.project(this._lngLat);let h=this.options.anchor;const f=Lo(this.options.offset);if(!h){const w=this._container.offsetWidth,S=this._container.offsetHeight;let k;k=o.y+f.bottom.ythis._map.transform.height-S?["bottom"]:[],o.xthis._map.transform.width-w/2&&k.push("right"),h=k.length===0?"bottom":k.join("-")}const y=o.add(f[h]).round();T.setTransform(this._container,`${_s[h]} translate(${y.x}px,${y.y}px)`),Wd(this._container,h,"popup")},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(Ku),m)}addTo(m){return this._map&&this.remove(),this._map=m,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new c.k("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(m){return this._lngLat=c.L.convert(m),this._pos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(m){return this.setDOMContent(document.createTextNode(m))}setHTML(m){const i=document.createDocumentFragment(),o=document.createElement("body");let h;for(o.innerHTML=m;h=o.firstChild,h;)i.appendChild(h);return this.setDOMContent(i)}getMaxWidth(){var m;return(m=this._container)===null||m===void 0?void 0:m.style.maxWidth}setMaxWidth(m){return this.options.maxWidth=m,this._update(),this}setDOMContent(m){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=T.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(m),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(m){this._container&&this._container.classList.add(m)}removeClassName(m){this._container&&this._container.classList.remove(m)}setOffset(m){return this.options.offset=m,this._update(),this}toggleClassName(m){if(this._container)return this._container.classList.toggle(m)}_createCloseButton(){this.options.closeButton&&(this._closeButton=T.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.setAttribute("aria-label","Close popup"),this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const m=this._container.querySelector(Xu);m&&m.focus()}},Or.Marker=Xa,Or.Style=mn,Or.LngLat=c.L,Or.LngLatBounds=Mt,Or.Point=c.P,Or.MercatorCoordinate=c.U,Or.Evented=c.E,Or.AJAXError=c.bi,Or.config=c.c,Or.CanvasSource=cr,Or.GeoJSONSource=Ge,Or.ImageSource=Ot,Or.RasterDEMTileSource=_t,Or.RasterTileSource=yr,Or.VectorTileSource=Rt,Or.VideoSource=Ir,Or.setRTLTextPlugin=c.bj,Or.getRTLTextPluginStatus=c.bk,Or.prewarm=function(){un().acquire(ir)},Or.clearPrewarmedResources=function(){const m=zi;m&&(m.isPreloaded()&&m.numActive()===1?(m.release(ir),zi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},Ju.extend(Or,{isSafari:c.ac,getPerformanceMetrics:c.bg.getPerformanceMetrics}),Or});var b=p;return b})})(fw);var UM=fw.exports;const jl=NM(UM);function Yv(r){let e;return n=>{if(n)for(let l in n){let p=e==null?void 0:e[l],v=n[l];p!==v&&r(l,v,p)}else if(e)for(let l in e)r(l,void 0,e[l]);e=n}}function $M(r,...e){let n=[r];for(let l of e)if(l)Array.isArray(l)&&l[0]===r?n.push(...l.slice(1)):n.push(l);else continue;if(n.length!==1)return n.length===2?n[1]:n}function VM(r){return r===!0?["has","point_count"]:r===!1?["!",["has","point_count"]]:void 0}function jM(r,e){return["case",["boolean",["feature-state","hover"],!1],e,r]}var o_=qM;function qM(r){var e,n,l;if(r){if(Array.isArray(r)){for(e=[],n=r.length,l=0;lbr(St,"$minZoomContext",n),p=()=>br(gt,"$maxZoomContext",n),v=()=>br(ft,"$layer",n),b=()=>br(At,"$map",n),c=()=>br(Ze,"$sourceName",n),A=wt(),T=wt(),z=wt(),B=wt(),U=wt(),j=wt(),Q=wt();let ae=le(e,"id",8,()=>s_("layer")),ne=le(e,"source",8,()=>{}),Y=le(e,"sourceLayer",8,()=>{}),_e=le(e,"beforeId",8,()=>{}),de=le(e,"beforeLayerType",8,()=>{}),pe=le(e,"type"),Te=le(e,"paint",8,()=>{}),De=le(e,"layout",8,()=>{}),je=le(e,"filter",8,()=>{}),ke=le(e,"applyToClusters",8,()=>{}),$e=le(e,"minzoom",8,()=>{}),Me=le(e,"maxzoom",8,()=>{}),He=le(e,"manageHoverState",0,!1),Ye=le(e,"hovered",4,null),Pe=le(e,"interactive",0,!0),tt=le(e,"hoverCursor",8,()=>{}),Je=le(e,"eventsIfTopMost",0,!1);const lt=Jh(),{map:At,source:Ze,self:ft,minzoom:St,maxzoom:gt,eventTopMost:Ct,layerInfo:Mt}=dw();lu(()=>{var Ge;v()&&b()&&(Mt.delete(v()),(Ge=b())==null||Ge.removeLayer(v()))});let rt=wt(void 0),Rt=wt(!0);bt(()=>ze(ke()),()=>{ot(A,VM(ke()))}),bt(()=>(oe(A),ze(je())),()=>{ot(T,$M("all",oe(A),je()))}),bt(()=>(ze($e()),l()),()=>{ot(z,$e()??l())}),bt(()=>(ze(Me()),p()),()=>{ot(B,Me()??p())}),bt(()=>(ze(ne()),c()),()=>{ot(U,ne()||c())}),bt(()=>(b(),v(),ze(ae()),oe(U),ze(Pe()),ze(Je()),ze(_e()),ze(de()),ze(pe()),ze(Y()),oe(T),ze(Te()),ze(De()),oe(z),oe(B),ze(tt()),ze(He()),oe(rt)),()=>{if(b()&&v()!==ae()&&oe(U)){let Ge=function(Ot){var Ar,Qr;if(!Pe()||!v()||!b()||Je()&&Ct(Ot)!==v())return;let Ir=Ot.features??[],cr=(Qr=(Ar=Ir[0])==null?void 0:Ar.properties)==null?void 0:Qr.cluster_id,Jr={event:Ot,map:b(),clusterId:cr,layer:v(),source:oe(U),features:Ir};lt(Ot.type,Jr)};v()&&Mt.delete(v());let Nt=_e();if(!_e()&&de()){let Ot=b().getStyle().layers,Ir=typeof de()=="function"?de():Jr=>Jr.type===de(),cr=Ot==null?void 0:Ot.find(Ir);cr&&(Nt=cr.id)}ki(ft,ae()),b().addLayer(o_({id:v(),type:pe(),source:oe(U),"source-layer":Y(),filter:oe(T),paint:Te(),layout:De(),minzoom:oe(z),maxzoom:oe(B)}),Nt),ot(Rt,!0),b().on("click",v(),Ge),b().on("dblclick",v(),Ge),b().on("contextmenu",v(),Ge),b().on("mouseenter",v(),Ot=>{var Ar,Qr;if(!Pe()||!v()||!b()||Je()&&Ct(Ot)!==v())return;tt()&&(b().getCanvas().style.cursor=tt());let Ir=Ot.features??[];Ye(Ir[0]??null);let cr=(Qr=(Ar=Ir[0])==null?void 0:Ar.properties)==null?void 0:Qr.cluster_id,Jr={event:Ot,map:b(),clusterId:cr,layer:v(),source:oe(U),features:Ir};lt("mouseenter",Jr)}),b().on("mousemove",v(),Ot=>{var Ar,Qr,$i,cn,Mn,vi;if(!Pe())return;if(Je()&&Ct(Ot)!==v()){Ye(null),He()&&oe(rt)!==void 0&&((Ar=b())==null||Ar.setFeatureState({source:oe(U),sourceLayer:Y(),id:oe(rt)},{hover:!1}),ot(rt,void 0));return}b().getCanvas().style.cursor=tt();let Ir=Ot.features??[],cr=($i=(Qr=Ir[0])==null?void 0:Qr.properties)==null?void 0:$i.cluster_id,Jr=(cn=Ir[0])==null?void 0:cn.id;Jr!==oe(rt)&&(He()&&(oe(rt)!==void 0&&((Mn=b())==null||Mn.setFeatureState({source:oe(U),id:oe(rt),sourceLayer:Y()},{hover:!1})),(vi=b())==null||vi.setFeatureState({source:oe(U),id:Jr,sourceLayer:Y()},{hover:!0})),ot(rt,Jr),Ye(Ir[0]??null)),lt("mousemove",{event:Ot,map:b(),clusterId:cr,layer:v(),source:oe(U),features:Ir})}),b().on("mouseleave",v(),Ot=>{var Ir;if(!(!Pe()||!v()||!b())){if(tt()&&(b().getCanvas().style.cursor=""),Ye(null),He()&&oe(rt)!==void 0){const cr={source:oe(U),id:oe(rt),sourceLayer:Y()};(Ir=b())==null||Ir.setFeatureState(cr,{hover:!1}),ot(rt,void 0)}lt("mouseleave",{map:b(),layer:v(),source:oe(U)})}})}}),bt(()=>(v(),ze(Pe())),()=>{v()&&Mt.set(v(),{interactive:Pe()})}),bt(()=>(v(),b()),()=>{ot(j,v()?Yv((Ge,Nt)=>{var Ot;return(Ot=b())==null?void 0:Ot.setPaintProperty(v(),Ge,Nt)}):void 0)}),bt(()=>(v(),b()),()=>{ot(Q,v()?Yv((Ge,Nt)=>{var Ot;return(Ot=b())==null?void 0:Ot.setLayoutProperty(v(),Ge,Nt)}):void 0)}),bt(()=>(oe(j),ze(Te())),()=>{var Ge;(Ge=oe(j))==null||Ge(Te())}),bt(()=>(oe(Q),ze(De())),()=>{var Ge;(Ge=oe(Q))==null||Ge(De())}),bt(()=>(v(),b(),oe(z),oe(B)),()=>{var Ge;v()&&((Ge=b())==null||Ge.setLayerZoomRange(v(),oe(z),oe(B)))}),bt(()=>(v(),oe(Rt),b(),oe(T)),()=>{var Ge;v()&&(oe(Rt)?ot(Rt,!1):(Ge=b())==null||Ge.setFilter(v(),oe(T)))}),_i(),zr();var yr=nr(),_t=ct(yr);pr(_t,v,Ge=>{var Nt=nr(),Ot=ct(Nt);Tb(Ot,v,Ir=>{var cr=nr(),Jr=ct(cr);hr(Jr,Wr(e),{},null),xe(Ir,cr)}),xe(Ge,Nt)}),xe(r,yr),Lr()}function ZM(r,e){Pr(e,!1);let n=le(e,"id",8,()=>s_("fill")),l=le(e,"source",8,()=>{}),p=le(e,"sourceLayer",8,()=>{}),v=le(e,"beforeId",8,()=>{}),b=le(e,"beforeLayerType",8,()=>{}),c=le(e,"paint"),A=le(e,"layout",8,()=>{}),T=le(e,"filter",8,()=>{}),z=le(e,"minzoom",8,()=>{}),B=le(e,"maxzoom",8,()=>{}),U=le(e,"hoverCursor",8,()=>{}),j=le(e,"manageHoverState",0,!1),Q=le(e,"hovered",4,null),ae=le(e,"eventsIfTopMost",0,!1),ne=le(e,"interactive",0,!0);zr(),GM(r,{get id(){return n()},type:"fill",get source(){return l()},get sourceLayer(){return p()},get beforeId(){return v()},get beforeLayerType(){return b()},get paint(){return c()},get layout(){return A()},get filter(){return T()},get minzoom(){return z()},get maxzoom(){return B()},get hoverCursor(){return U()},get manageHoverState(){return j()},get eventsIfTopMost(){return ae()},get interactive(){return ne()},get hovered(){return Q()},set hovered(Y){Q(Y)},$$events:{click(Y){Ne.call(this,e,Y)},dblclick(Y){Ne.call(this,e,Y)},contextmenu(Y){Ne.call(this,e,Y)},mouseenter(Y){Ne.call(this,e,Y)},mousemove(Y){Ne.call(this,e,Y)},mouseleave(Y){Ne.call(this,e,Y)}},children:(Y,_e)=>{var de=nr(),pe=ct(de);hr(pe,Wr(e),{},null),xe(Y,de)},$$slots:{default:!0},$$legacy:!0}),Lr()}function WM(r,e){Pr(e,!1);const n=Cn(),l=()=>br(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"top-left"),b=le(e,"container",8,()=>{}),c=wt(null);lu(()=>{var A;(A=l())!=null&&A.loaded()&&oe(c)&&l().removeControl(oe(c))}),bt(()=>(l(),oe(c),ze(b()),ze(v())),()=>{if(l()&&!oe(c)){let A;typeof b()=="string"?A=document.querySelector(b())??void 0:A=b(),ot(c,new jl.FullscreenControl({container:A})),l().addControl(oe(c),v())}}),_i(),zr(),Lr()}function HM(r,e,n,l,p){let v=!1;r.getSource(e)&&(v=!0,r.removeSource(e));const b=()=>{l(e)&&(r.addSource(e,n),p())};if(v){const c=()=>{e&&(r.getSource(e)?setTimeout(c,1):b())};c()}else b()}function YM(r,e,n){sI().then(()=>{let l=aI(r);if(!l)return;l.getSource(e)===n&&l.removeSource(e)})}function KM(r,e){Pr(e,!1);const n=Cn(),l=()=>br(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"top-left"),b=le(e,"positionOptions",8,()=>{}),c=le(e,"fitBoundsOptions",8,()=>{}),A=le(e,"trackUserLocation",0,!1),T=le(e,"showAccuracyCircle",0,!0),z=le(e,"showUserLocation",0,!0),B=wt(null);lu(()=>{var U;(U=l())!=null&&U.loaded()&&oe(B)&&l().removeControl(oe(B))}),bt(()=>(l(),oe(B),ze(b()),ze(c()),ze(A()),ze(T()),ze(z()),ze(v())),()=>{l()&&!oe(B)&&(ot(B,new jl.GeolocateControl({positionOptions:b(),fitBoundsOptions:c(),trackUserLocation:A(),showAccuracyCircle:T(),showUserLocation:z()})),l().addControl(oe(B),v()))}),_i(),zr(),Lr()}function XM(r,e){Pr(e,!1);const n=Cn(),l=()=>br(T,"$map",n),p=()=>br(z,"$source",n);let v=le(e,"data"),b=le(e,"idCol"),c=le(e,"sourceLayer",8,()=>{}),A=wt(new Set);const{map:T,source:z}=dw();bt(()=>(ze(v()),l(),p(),ze(b()),oe(A),ze(c())),()=>{if(v()&&l()&&p()){let B=new Set;for(const U of v()){const j=U[b()];if(!j)continue;oe(A).delete(j),B.add(j);const Q={id:j,source:p(),sourceLayer:c()},ae=l().getFeatureState(Q);let ne=!1;for(const Y of Object.keys(U))if(ae[Y]!==U[Y]){ne=!0;break}ne&&l().setFeatureState(Q,U)}for(const U of oe(A)){const j={id:U,source:p(),sourceLayer:c()},Q=l().getFeatureState(j);for(const ae of Object.keys(Q))l().removeFeatureState(j,ae)}ot(A,B)}}),_i(),zr(),Lr()}function JM(r){let e=r.getCenter(),n=Math.round(r.getZoom()*100)/100,l=Math.ceil((n*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,l),v=Math.round(e.lat*p)/p,b=Math.round(e.lng*p)/p,c=`${n}/${v}/${b}`,A=r.getBearing(),T=r.getPitch();return(A||T)&&(c+=`/${Math.round(A*10)/10}`),T&&(c+=`/${Math.round(T)}`),`#${c}`}function QM(r){return r.replace("#","").split("/").map(parseFloat)}var Tf=l_;function l_(r,e){return r===e||r!==r&&e!==e?!0:typeof r!=typeof e||{}.toString.call(r)!={}.toString.call(e)||r!==Object(r)||!r?!1:Array.isArray(r)?Kv(r,e):{}.toString.call(r)=="[object Set]"?Kv(Array.from(r),Array.from(e)):{}.toString.call(r)=="[object Object]"?t3(r,e):e3(r,e)}function e3(r,e){return r.toString()===e.toString()}function Kv(r,e){var n=r.length;if(n!=e.length)return!1;for(var l=0;lbr(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"top-left"),b=le(e,"showCompass",0,!0),c=le(e,"showZoom",0,!0),A=le(e,"visualizePitch",0,!1),T=wt(null);lu(()=>{var z;(z=l())!=null&&z.loaded()&&oe(T)&&l().removeControl(oe(T))}),bt(()=>(l(),oe(T),ze(b()),ze(c()),ze(A()),ze(v())),()=>{l()&&!oe(T)&&(ot(T,new jl.NavigationControl({showCompass:b(),showZoom:c(),visualizePitch:A()})),l().addControl(oe(T),v()))}),_i(),zr(),Lr()}function i3(r,e){Pr(e,!1);const n=Cn(),l=()=>br(p,"$map",n),{map:p}=od();let v=le(e,"position",0,"bottom-left"),b=le(e,"maxWidth",8,()=>{}),c=le(e,"unit",0,"metric"),A=wt(null);lu(()=>{var T;(T=l())!=null&&T.loaded()&&oe(A)&&l().removeControl(oe(A))}),bt(()=>(l(),oe(A),ze(b()),ze(c()),ze(v())),()=>{l()&&!oe(A)&&(ot(A,new jl.ScaleControl({maxWidth:b(),unit:c()})),l().addControl(oe(A),v()))}),_i(),zr(),Lr()}var n3=Xe(" ",1),s3=Xe(" ",1),a3=Xe("
    ");function o3(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Je,"$mapInstance",n),p=()=>br(lt,"$loadedImages",n),v=wt(),b=wt();let c=le(e,"map",4,null),A=le(e,"class",8,()=>{}),T=le(e,"style"),z=le(e,"diffStyleUpdates",0,!1),B=le(e,"center",12,()=>{}),U=le(e,"zoom",12,()=>{}),j=le(e,"pitch",4,0),Q=le(e,"bearing",4,0),ae=le(e,"bounds",12,()=>{}),ne=le(e,"hash",0,!1),Y=le(e,"loaded",4,!1),_e=le(e,"minZoom",0,0),de=le(e,"maxZoom",0,22),pe=le(e,"zoomOnDoubleClick",0,!0),Te=le(e,"interactive",0,!0),De=le(e,"attributionControl",0,!0),je=le(e,"cooperativeGestures",0,!1),ke=le(e,"preserveDrawingBuffer",0,!1),$e=le(e,"maxBounds",8,()=>{}),Me=le(e,"images",8,()=>[]),He=le(e,"standardControls",0,!1),Ye=le(e,"filterLayers",8,()=>{}),Pe=le(e,"transformRequest",8,()=>{});const tt=Jh(),{map:Je,loadedImages:lt}=RM();let At=new Set;function Ze(_t){var Ge;(Ge=l())!=null&&Ge.loaded()&&("url"in _t?(At.add(_t.id),l().loadImage(_t.url,(Nt,Ot)=>{var Ir;At.delete(_t.id),Nt?tt("error",Nt):Ot&&((Ir=l())==null||Ir.addImage(_t.id,Ot,_t.options),p().add(_t.id),ki(lt,p()))})):(l().addImage(_t.id,_t.data,_t.options),p().add(_t.id),ki(lt,p())))}let ft=wt(void 0),St=wt(void 0),gt=wt(void 0),Ct=wt(void 0);function Mt(_t){if(ne()){let Ge=QM(window.location.hash);Ge.length>=3&&(U(Ge[0]),B([Ge[2],Ge[1]])),Ge.length==5&&(Q(Ge[3]),j(Ge[4]))}return ki(Je,new jl.Map(o_({container:_t,style:T(),center:B(),zoom:U(),pitch:j(),bearing:Q(),minZoom:_e(),maxZoom:de(),interactive:Te(),preserveDrawingBuffer:ke(),maxBounds:$e(),bounds:ae(),attributionControl:De(),transformRequest:Pe(),cooperativeGestures:je()}))),l().on("load",Ge=>{Y(!0),tt("load",l())}),l().on("error",Ge=>tt("error",{...Ge,map:l()})),l().on("movestart",Ge=>tt("movestart",{...Ge,map:l()})),l().on("moveend",Ge=>{if(B(Ge.target.getCenter()),U(Ge.target.getZoom()),ae(Ge.target.getBounds()),tt("moveend",{...Ge,map:l()}),ne()){let Nt=window.location.href.replace(/(#.+)?$/,JM(l()));window.history.replaceState(window.history.state,"",Nt)}}),l().on("zoomstart",Ge=>tt("zoomstart",{...Ge,map:l()})),l().on("zoom",Ge=>{U(Ge.target.getZoom()),tt("zoom",{...Ge,map:l()})}),l().on("zoomend",Ge=>{U(Ge.target.getZoom()),tt("zoomend",{...Ge,map:l()})}),l().on("style.load",()=>{if(l()){const Ge=l().getStyle();if(ot(ft,Ge.layers.map(Nt=>Nt.id)),ot(St,Object.keys(Ge.sources)),oe(Ct))for(const[Nt,Ot]of Object.entries(oe(Ct)))l().addSource(Nt,Ot);if(oe(gt))for(const Nt of oe(gt))l().addLayer(Nt)}}),l().on("styledata",Ge=>{if(l()&&Ye()){const Nt=l().getStyle().layers;if(Nt)for(let Ot of Nt)Ye()(Ot)||l().setLayoutProperty(Ot.id,"visibility","none")}tt("styledata",{...Ge,map:l()})}),{destroy(){var Ge;Y(!1),(Ge=l())==null||Ge.remove(),ki(Je,null)}}}let rt=wt(T());bt(()=>ze(He()),()=>{ot(v,typeof He()=="boolean"?void 0:He())}),bt(()=>l(),()=>{c(l())}),bt(()=>(ze(Y()),l(),ze(Me())),()=>{var _t;if(Y()&&((_t=l())!=null&&_t.loaded()))for(let Ge of Me())!At.has(Ge.id)&&!l().hasImage(Ge.id)&&Ze(Ge)}),bt(()=>(ze(Me()),p()),()=>{ot(b,Me().every(_t=>p().has(_t.id)))}),bt(()=>(l(),ze(T()),oe(rt),oe(ft),oe(St),ze(z())),()=>{if(l()&&!Tf(T(),oe(rt))){const _t=l().getStyle();if(oe(ft)&&ot(gt,_t.layers.filter(Ge=>!oe(ft).includes(Ge.id))),oe(St)){const Ge=Object.keys(_t.sources).filter(Nt=>!oe(St).includes(Nt));ot(Ct,{});for(const Nt of Ge)Rh(Ct,oe(Ct)[Nt]=_t.sources[Nt])}ot(rt,T()),l().setStyle(T(),{diff:z()})}}),bt(()=>(ze(B()),l()),()=>{var _t,Ge;B()&&!Tf(B(),(_t=l())==null?void 0:_t.getCenter())&&((Ge=l())==null||Ge.panTo(B()))}),bt(()=>(ze(U()),l()),()=>{var _t,Ge;U()&&!Tf(U(),(_t=l())==null?void 0:_t.getZoom())&&((Ge=l())==null||Ge.zoomTo(U()))}),bt(()=>(ze(ae()),l()),()=>{var _t,Ge;ae()&&!Tf(ae(),(_t=l())==null?void 0:_t.getBounds())&&((Ge=l())==null||Ge.fitBounds(ae()))}),bt(()=>(ze(pe()),l()),()=>{var _t,Ge;pe()?(_t=l())==null||_t.doubleClickZoom.enable():(Ge=l())==null||Ge.doubleClickZoom.disable()}),_i(),zr();var Rt=a3(),yr=ut(Rt);pr(yr,()=>l()&&Y(),_t=>{var Ge=s3(),Nt=ct(Ge);pr(Nt,He,Ir=>{var cr=n3(),Jr=ct(cr);r3(Jr,{get position(){return oe(v)},$$legacy:!0});var Ar=we(we(Jr,!0));KM(Ar,{get position(){return oe(v)},fitBoundsOptions:{maxZoom:12},$$legacy:!0});var Qr=we(we(Ar,!0));WM(Qr,{get position(){return oe(v)},$$legacy:!0});var $i=we(we(Qr,!0));i3($i,{get position(){return oe(v)},$$legacy:!0}),xe(Ir,cr)});var Ot=we(we(Nt,!0));hr(Ot,Wr(e),{get map(){return l()},get loadedImages(){return p()},get allImagesLoaded(){return oe(b)}},null),xe(_t,Ge)}),ht(Rt),Pt(()=>{En(Rt,`${A()??""} svelte-p00lfq`),gI(Rt,"expand-map",!A())}),Ko(Rt,_t=>Mt(_t)),xe(r,Rt),Lr()}const l3=Math.sqrt(50),c3=Math.sqrt(10),u3=Math.sqrt(2);function Fp(r,e,n){const l=(e-r)/Math.max(0,n),p=Math.floor(Math.log10(l)),v=l/Math.pow(10,p),b=v>=l3?10:v>=c3?5:v>=u3?2:1;let c,A,T;return p<0?(T=Math.pow(10,-p)/b,c=Math.round(r*T),A=Math.round(e*T),c/Te&&--A,T=-T):(T=Math.pow(10,p)*b,c=Math.round(r/T),A=Math.round(e/T),c*Te&&--A),A0))return[];if(r===e)return[r];const l=e=p))return[];const c=v-p+1,A=new Array(c);if(l)if(b<0)for(let T=0;Tnew Promise((l,p)=>{var v=A=>{try{c(n.next(A))}catch(T){p(T)}},b=A=>{try{c(n.throw(A))}catch(T){p(T)}},c=A=>A.done?l(A.value):Promise.resolve(A.value).then(v,b);c((n=n.apply(r,e)).next())}),Bs=Uint8Array,Oh=Uint16Array,f3=Int32Array,mw=new Bs([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gw=new Bs([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),p3=new Bs([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),yw=function(r,e){for(var n=new Oh(31),l=0;l<31;++l)n[l]=e+=1<>1|(Xr&21845)<<1,lo=(lo&52428)>>2|(lo&13107)<<2,lo=(lo&61680)>>4|(lo&3855)<<4,bw[Xr]=((lo&65280)>>8|(lo&255)<<8)>>1;var lo,Xr,Nh=function(r,e,n){for(var l=r.length,p=0,v=new Oh(e);p>A]=T}return c},ld=new Bs(288);for(Xr=0;Xr<144;++Xr)ld[Xr]=8;var Xr;for(Xr=144;Xr<256;++Xr)ld[Xr]=9;var Xr;for(Xr=256;Xr<280;++Xr)ld[Xr]=7;var Xr;for(Xr=280;Xr<288;++Xr)ld[Xr]=8;var Xr,xw=new Bs(32);for(Xr=0;Xr<32;++Xr)xw[Xr]=5;var Xr,_3=Nh(ld,9),v3=Nh(xw,5),Dg=function(r){for(var e=r[0],n=1;ne&&(e=r[n]);return e},ha=function(r,e,n){var l=e/8|0;return(r[l]|r[l+1]<<8)>>(e&7)&n},Pg=function(r,e){var n=e/8|0;return(r[n]|r[n+1]<<8|r[n+2]<<16)>>(e&7)},b3=function(r){return(r+7)/8|0},x3=function(r,e,n){(n==null||n>r.length)&&(n=r.length);var l=new Bs(n-e);return l.set(r.subarray(e,n)),l},w3=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Ls=function(r,e,n){var l=new Error(e||w3[r]);if(l.code=r,Error.captureStackTrace&&Error.captureStackTrace(l,Ls),!n)throw l;return l},c_=function(r,e,n,l){var p=r.length,v=0;if(!p||e.f&&!e.l)return n||new Bs(0);var b=!n||e.i!=2,c=e.i;n||(n=new Bs(p*3));var A=function(Ot){var Ir=n.length;if(Ot>Ir){var cr=new Bs(Math.max(Ir*2,Ot));cr.set(n),n=cr}},T=e.f||0,z=e.p||0,B=e.b||0,U=e.l,j=e.d,Q=e.m,ae=e.n,ne=p*8;do{if(!U){T=ha(r,z,1);var Y=ha(r,z+1,3);if(z+=3,Y)if(Y==1)U=_3,j=v3,Q=9,ae=5;else if(Y==2){var Te=ha(r,z,31)+257,De=ha(r,z+10,15)+4,je=Te+ha(r,z+5,31)+1;z+=14;for(var ke=new Bs(je),$e=new Bs(19),Me=0;Me>4;if(_e<16)ke[Me++]=_e;else{var Je=0,lt=0;for(_e==16?(lt=3+ha(r,z,3),z+=2,Je=ke[Me-1]):_e==17?(lt=3+ha(r,z,7),z+=3):_e==18&&(lt=11+ha(r,z,127),z+=7);lt--;)ke[Me++]=Je}}var At=ke.subarray(0,Te),Ze=ke.subarray(Te);Q=Dg(At),ae=Dg(Ze),U=Nh(At,Q),j=Nh(Ze,ae)}else Ls(1);else{var _e=b3(z)+4,de=r[_e-4]|r[_e-3]<<8,pe=_e+de;if(pe>p){c&&Ls(0);break}b&&A(B+de),n.set(r.subarray(_e,pe),B),e.b=B+=de,e.p=z=pe*8,e.f=T;continue}if(z>ne){c&&Ls(0);break}}b&&A(B+131072);for(var ft=(1<>4;if(z+=Je&15,z>ne){c&&Ls(0);break}if(Je||Ls(2),Ct<256)n[B++]=Ct;else if(Ct==256){gt=z,U=null;break}else{var Mt=Ct-254;if(Ct>264){var Me=Ct-257,rt=mw[Me];Mt=ha(r,z,(1<>4;Rt||Ls(3),z+=Rt&15;var Ze=y3[yr];if(yr>3){var rt=gw[yr];Ze+=Pg(r,z)&(1<ne){c&&Ls(0);break}b&&A(B+131072);var _t=B+Mt;if(B>3&1)+(e>>4&1);l>0;l-=!r[n++]);return n+(e&2)},T3=function(r){var e=r.length;return(r[e-4]|r[e-3]<<8|r[e-2]<<16|r[e-1]<<24)>>>0},k3=function(r,e){return((r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31)&&Ls(6,"invalid zlib data"),(r[1]>>5&1)==+!e&&Ls(6,"invalid zlib data: "+(r[1]&32?"need":"unexpected")+" dictionary"),(r[1]>>3&4)+2};function A3(r,e){return c_(r,{i:2},e,e)}function E3(r,e){var n=I3(r);return n+8>r.length&&Ls(6,"invalid gzip data"),c_(r.subarray(n,-8),{i:2},new Bs(T3(r)),e)}function C3(r,e){return c_(r.subarray(k3(r,e),-4),{i:2},e,e)}function dy(r,e){return r[0]==31&&r[1]==139&&r[2]==8?E3(r,e):(r[0]&15)!=8||r[0]>>4>7||(r[0]<<8|r[1])%31?A3(r,e):C3(r,e)}var M3=typeof TextDecoder<"u"&&new TextDecoder,D3=0;try{M3.decode(S3,{stream:!0}),D3=1}catch{}var ww=(r,e)=>r*Math.pow(2,e),Sh=(r,e)=>Math.floor(r/Math.pow(2,e)),Op=(r,e)=>ww(r.getUint16(e+1,!0),8)+r.getUint8(e),Sw=(r,e)=>ww(r.getUint32(e+2,!0),16)+r.getUint16(e,!0),P3=(r,e,n,l,p)=>{if(r!=l.getUint8(p))return r-l.getUint8(p);const v=Op(l,p+1);if(e!=v)return e-v;const b=Op(l,p+4);return n!=b?n-b:0},L3=(r,e,n,l)=>{const p=Iw(r,e|128,n,l);return p?{z:e,x:n,y:l,offset:p[0],length:p[1],is_dir:!0}:null},Xv=(r,e,n,l)=>{const p=Iw(r,e,n,l);return p?{z:e,x:n,y:l,offset:p[0],length:p[1],is_dir:!1}:null},Iw=(r,e,n,l)=>{let p=0,v=r.byteLength/17-1;for(;p<=v;){const b=v+p>>1,c=P3(e,n,l,r,b*17);if(c>0)p=b+1;else if(c<0)v=b-1;else return[Sw(r,b*17+7),r.getUint32(b*17+13,!0)]}return null},z3=(r,e)=>r.is_dir&&!e.is_dir?1:!r.is_dir&&e.is_dir?-1:r.z!==e.z?r.z-e.z:r.x!==e.x?r.x-e.x:r.y-e.y,Tw=(r,e)=>{const n=r.getUint8(e*17);return{z:n&127,x:Op(r,e*17+1),y:Op(r,e*17+4),offset:Sw(r,e*17+7),length:r.getUint32(e*17+13,!0),is_dir:n>>7===1}},Jv=r=>{const e=[],n=new DataView(r);for(let l=0;l{r.sort(z3);const e=new ArrayBuffer(17*r.length),n=new Uint8Array(e);for(let l=0;l>8&255,n[l*17+3]=p.x>>16&255,n[l*17+4]=p.y&255,n[l*17+5]=p.y>>8&255,n[l*17+6]=p.y>>16&255,n[l*17+7]=p.offset&255,n[l*17+8]=Sh(p.offset,8)&255,n[l*17+9]=Sh(p.offset,16)&255,n[l*17+10]=Sh(p.offset,24)&255,n[l*17+11]=Sh(p.offset,32)&255,n[l*17+12]=Sh(p.offset,48)&255,n[l*17+13]=p.length&255,n[l*17+14]=p.length>>8&255,n[l*17+15]=p.length>>16&255,n[l*17+16]=p.length>>24&255}return e},R3=(r,e)=>{if(r.byteLength<17)return null;const n=r.byteLength/17,l=Tw(r,n-1);if(l.is_dir){const p=l.z,v=e.z-p,b=Math.trunc(e.x/(1<{if(r.type=="json"){const n=r.url.substr(10);let l=this.tiles.get(n);return l||(l=new Qv(n),this.tiles.set(n,l)),l.getHeader().then(p=>{const v={tiles:[r.url+"/{z}/{x}/{y}"],minzoom:p.minZoom,maxzoom:p.maxZoom,bounds:[p.minLon,p.minLat,p.maxLon,p.maxLat]};e(null,v,null,null)}).catch(p=>{e(p,null,null,null)}),{cancel:()=>{}}}else{const n=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=r.url.match(n);if(!l)throw new Error("Invalid PMTiles protocol URL");const p=l[1];let v=this.tiles.get(p);v||(v=new Qv(p),this.tiles.set(p,v));const b=l[2],c=l[3],A=l[4],T=new AbortController,z=T.signal;let B=()=>{T.abort()};return v.getHeader().then(U=>{v.getZxy(+b,+c,+A,z).then(j=>{j?e(null,new Uint8Array(j.data),j.cacheControl,j.expires):U.tileType==1?e(null,new Uint8Array,null,null):e(null,null,null,null)}).catch(j=>{j.name!=="AbortError"&&e(j,null,null,null)})}),{cancel:B}}},this.tiles=new Map}add(r){this.tiles.set(r.source.getKey(),r)}get(r){return this.tiles.get(r)}};function Dc(r,e){return(e>>>0)*4294967296+(r>>>0)}function U3(r,e){const n=e.buf;let l,p;if(p=n[e.pos++],l=(p&112)>>4,p<128||(p=n[e.pos++],l|=(p&127)<<3,p<128)||(p=n[e.pos++],l|=(p&127)<<10,p<128)||(p=n[e.pos++],l|=(p&127)<<17,p<128)||(p=n[e.pos++],l|=(p&127)<<24,p<128)||(p=n[e.pos++],l|=(p&1)<<31,p<128))return Dc(r,l);throw new Error("Expected varint not more than 10 bytes")}function Ih(r){const e=r.buf;let n,l;return l=e[r.pos++],n=l&127,l<128||(l=e[r.pos++],n|=(l&127)<<7,l<128)||(l=e[r.pos++],n|=(l&127)<<14,l<128)||(l=e[r.pos++],n|=(l&127)<<21,l<128)?n:(l=e[r.pos],n|=(l&15)<<28,U3(n,r))}function $3(r,e,n,l){if(l==0){n==1&&(e[0]=r-1-e[0],e[1]=r-1-e[1]);const p=e[0];e[0]=e[1],e[1]=p}}var V3=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function j3(r,e,n){if(r>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>Math.pow(2,r)-1||n>Math.pow(2,r)-1)throw Error("tile x/y outside zoom level bounds");const l=V3[r],p=Math.pow(2,r);let v=0,b=0,c=0;const A=[e,n];let T=p/2;for(;T>0;)v=(A[0]&T)>0?1:0,b=(A[1]&T)>0?1:0,c+=T*T*(3*v^b),$3(T,A,v,b),T=T/2;return l+c}function Aw(r,e){return us(this,null,function*(){if(e===1||e===0)return r;if(e===2){if(typeof globalThis.DecompressionStream>"u")return dy(new Uint8Array(r));{let l=new Response(r).body.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(l).arrayBuffer()}}else throw Error("Compression method not supported")})}var q3=127;function G3(r,e){let n=0,l=r.length-1;for(;n<=l;){const p=l+n>>1,v=e-r[p].tileId;if(v>0)n=p+1;else if(v<0)l=p-1;else return r[p]}return l>=0&&(r[l].runLength===0||e-r[l].tileId=300)throw Error("Bad response code: "+v.status);const b=v.headers.get("Content-Length");if(v.status===200&&(!b||+b>e))throw l&&l.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield v.arrayBuffer(),etag:v.headers.get("ETag")||void 0,cacheControl:v.headers.get("Cache-Control")||void 0,expires:v.headers.get("Expires")||void 0}})}};function da(r,e){const n=r.getUint32(e+4,!0),l=r.getUint32(e+0,!0);return n*Math.pow(2,32)+l}function W3(r,e){const n=new DataView(r),l=n.getUint8(7);if(l>3)throw Error(`Archive is spec version ${l} but this library supports up to spec version 3`);return{specVersion:l,rootDirectoryOffset:da(n,8),rootDirectoryLength:da(n,16),jsonMetadataOffset:da(n,24),jsonMetadataLength:da(n,32),leafDirectoryOffset:da(n,40),leafDirectoryLength:da(n,48),tileDataOffset:da(n,56),tileDataLength:da(n,64),numAddressedTiles:da(n,72),numTileEntries:da(n,80),numTileContents:da(n,88),clustered:n.getUint8(96)===1,internalCompression:n.getUint8(97),tileCompression:n.getUint8(98),tileType:n.getUint8(99),minZoom:n.getUint8(100),maxZoom:n.getUint8(101),minLon:n.getInt32(102,!0)/1e7,minLat:n.getInt32(106,!0)/1e7,maxLon:n.getInt32(110,!0)/1e7,maxLat:n.getInt32(114,!0)/1e7,centerZoom:n.getUint8(118),centerLon:n.getInt32(119,!0)/1e7,centerLat:n.getInt32(123,!0)/1e7,etag:e}}function Ew(r){const e={buf:new Uint8Array(r),pos:0},n=Ih(e),l=[];let p=0;for(let v=0;v0?l[v].offset=l[v-1].offset+l[v-1].length:l[v].offset=b-1}return l}function H3(r){const e=new DataView(r);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var qc=class extends Error{};function Y3(r,e,n,l){return us(this,null,function*(){const p=yield r.getBytes(0,16384);if(new DataView(p.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(H3(p.data)<3)return[yield kw.getHeader(r)];const b=p.data.slice(0,q3);let c=p.etag;l&&p.etag!=l&&(console.warn("ETag conflict detected; your HTTP server might not support content-based ETag headers. ETags disabled for "+r.getKey()),c=void 0);const A=W3(b,c);if(n){const T=p.data.slice(A.rootDirectoryOffset,A.rootDirectoryOffset+A.rootDirectoryLength),z=r.getKey()+"|"+(A.etag||"")+"|"+A.rootDirectoryOffset+"|"+A.rootDirectoryLength,B=Ew(yield e(T,A.internalCompression));return[A,[z,B.length,B]]}return[A,void 0]})}function K3(r,e,n,l,p){return us(this,null,function*(){const v=yield r.getBytes(n,l);if(p.etag&&p.etag!==v.etag)throw new qc(v.etag);const b=yield e(v.data,p.internalCompression),c=Ew(b);if(c.length===0)throw new Error("Empty directory is invalid");return c})}var X3=class{constructor(r=100,e=!0,n=Aw){this.cache=new Map,this.maxCacheEntries=r,this.counter=1,this.prefetch=e,this.decompress=n}getHeader(r,e){return us(this,null,function*(){const n=r.getKey();if(this.cache.has(n))return this.cache.get(n).lastUsed=this.counter++,yield this.cache.get(n).data;const l=new Promise((p,v)=>{Y3(r,this.decompress,this.prefetch,e).then(b=>{b[1]&&this.cache.set(b[1][0],{lastUsed:this.counter++,data:Promise.resolve(b[1][2])}),p(b[0]),this.prune()}).catch(b=>{v(b)})});return this.cache.set(n,{lastUsed:this.counter++,data:l}),l})}getDirectory(r,e,n,l){return us(this,null,function*(){const p=r.getKey()+"|"+(l.etag||"")+"|"+e+"|"+n;if(this.cache.has(p))return this.cache.get(p).lastUsed=this.counter++,yield this.cache.get(p).data;const v=new Promise((b,c)=>{K3(r,this.decompress,e,n,l).then(A=>{b(A),this.prune()}).catch(A=>{c(A)})});return this.cache.set(p,{lastUsed:this.counter++,data:v}),v})}getArrayBuffer(r,e,n,l){return us(this,null,function*(){const p=r.getKey()+"|"+(l.etag||"")+"|"+e+"|"+n;if(this.cache.has(p))return this.cache.get(p).lastUsed=this.counter++,yield this.cache.get(p).data;const v=new Promise((b,c)=>{r.getBytes(e,n).then(A=>{if(l.etag&&l.etag!==A.etag)throw new qc(A.etag);b(A.data),this.cache.has(p),this.prune()}).catch(A=>{c(A)})});return this.cache.set(p,{lastUsed:this.counter++,data:v}),v})}prune(){if(this.cache.size>=this.maxCacheEntries){let r=1/0,e;this.cache.forEach((n,l)=>{n.lastUsedv.maxZoom)return;let b=v.rootDirectoryOffset,c=v.rootDirectoryLength;for(let A=0;A<=3;A++){const T=yield this.cache.getDirectory(this.source,b,c,v),z=G3(T,p);if(z)if(z.runLength>0){const B=yield this.source.getBytes(v.tileDataOffset+z.offset,z.length,l);if(v.etag&&v.etag!==B.etag)throw new qc(B.etag);return{data:yield this.decompress(B.data,v.tileCompression),cacheControl:B.cacheControl,expires:B.expires}}else b=v.leafDirectoryOffset+z.offset,c=z.length;else return}throw Error("Maximum directory depth exceeded")})}getZxy(r,e,n,l){return us(this,null,function*(){try{return yield this.getZxyAttempt(r,e,n,l)}catch(p){if(p instanceof qc)return this.cache.invalidate(this.source,p.message),yield this.getZxyAttempt(r,e,n,l);throw p}})}getMetadataAttempt(){return us(this,null,function*(){const r=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(r.jsonMetadataOffset,r.jsonMetadataLength);if(r.etag&&r.etag!==e.etag)throw new qc(e.etag);const n=yield this.decompress(e.data,r.internalCompression),l=new TextDecoder("utf-8");return JSON.parse(l.decode(n))})}getMetadata(){return us(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(r){if(r instanceof qc)return this.cache.invalidate(this.source,r.message),yield this.getMetadataAttempt();throw r}})}};function J3(r,e){Pr(e,!1);const n=Cn(),l=()=>br(T,"$map",n),p=()=>br(z,"$source",n);let v=le(e,"id",8,()=>s_("vector")),b=le(e,"url",0,null),c=le(e,"tiles",0,null),A=le(e,"promoteId",0,null);if(b()&&b().includes("pmtiles://")&&!jl.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let Q=new N3;jl.addProtocol("pmtiles",Q.tile)}const{map:T,self:z}=FM();let B=wt();lu(()=>{p()&&l()&&(YM(T,p(),oe(B)),ki(z,null),ot(B,void 0))}),bt(()=>(l(),p(),ze(v()),ze(b()),ze(c()),ze(A())),()=>{l()&&p()!==v()&&(ki(z,v()),HM(l(),p(),o_({type:"vector",url:b(),tiles:c(),promoteId:A()}),Q=>l()&&Q===p(),()=>{var Q;p()&&ot(B,(Q=l())==null?void 0:Q.getSource(p()))}))}),bt(()=>(l(),ze(v())),()=>{var Q;(Q=l())==null||Q.on("style.load",()=>{var ae;ot(B,(ae=l())==null?void 0:ae.getSource(v()))})}),_i(),zr();var U=nr(),j=ct(U);pr(j,p,Q=>{var ae=nr(),ne=ct(ae);Tb(ne,p,Y=>{var _e=nr(),de=ct(_e);hr(de,Wr(e),{},null),xe(Y,_e)}),xe(Q,ae)}),xe(r,U),Lr()}var Q3=Xe(" ",1);function u_(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Hy,"$previewMetricMapColors",n);let p=wt(!0),v=wt(),b=le(e,"bounds",4);Yy.subscribe(T=>{ot(v,T),ot(p,!1),setTimeout(()=>ot(p,!0),0)}),zr();var c=nr(),A=ct(c);pr(A,()=>oe(p),T=>{o3(T,{style:"https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",standardControls:!0,center:[0,53],zoom:2,get bounds(){return b()},set bounds(z){b(z)},children:(z,B)=>{J3(z,{get url(){return oe(v)},promoteId:"GEO_ID",children:(U,j)=>{var Q=Q3(),ae=ct(Q),ne=Yo(()=>({"fill-color":["coalesce",["feature-state","color"],"#102020"],"fill-opacity":jM(.7,1)}));ZM(ae,{get paint(){return oe(ne)},sourceLayer:"geoms",manageHoverState:!0,eventsIfTopMost:!0,hoverCursor:"pointer",$$legacy:!0});var Y=we(we(ae,!0));XM(Y,{get data(){return l()},idCol:"GEO_ID",sourceLayer:"geoms",$$legacy:!0}),xe(U,Q)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0})}),xe(r,c),Lr()}var eD=Xe('

    Pick country...

    '),tD=Xe('
    '),rD=Xe('
    ');function iD(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Ep,"$selectedCountry",n),p=()=>br(ry,"$countries",n);let v=wt();function b(c){ki(Ep,c),console.log("Selected country: ",l()),ki(tm,{kind:"level"})}Gp(async()=>{ki(Hy,[]),ki(Bl,[]),ki(Cp,[])}),zr(),vy(r,{$$slots:{sidebar:(c,A)=>{var T=tD(),z=ut(T),B=ut(z);uw(B);var U=we(we(B,!0));Hs(U,{children:(Q,ae)=>{var ne=eD(),Y=ut(ne);ut(Y),ht(Y);var _e=we(we(Y,!0));cw(_e,{color:"grey",size:"lg",class:"text-grey ms-2 h-6 w-6 dark:text-gray-500",$$legacy:!0}),ht(ne),xe(Q,ne)},$$slots:{default:!0},$$legacy:!0});var j=we(we(U,!0));i_(j,{placement:"right-start",children:(Q,ae)=>{var ne=nr(),Y=ct(ne);Oa(Y,1,p,Fa,(_e,de,pe)=>{n_(_e,{$$events:{click:()=>b(Pi(de).country_name_short_en)},children:(Te,De)=>{dr();var je=Hn();Pt(()=>gi(je,Pi(de).country_name_short_en)),xe(Te,je)},$$slots:{default:!0},$$legacy:!0})}),xe(Q,ne)},$$slots:{default:!0},$$legacy:!0}),ht(z),ht(T),xe(c,T)},map:(c,A)=>{var T=rD(),z=ut(T);u_(z,{get bounds(){return oe(v)},set bounds(B){ot(v,B)},$$legacy:!0}),ht(T),xe(c,T)}},$$legacy:!0}),Lr()}function nD(r){return new Worker(""+new URL("../workers/rust_worker-tYahfuf4.js",import.meta.url).href,{type:"module",name:r==null?void 0:r.name})}function sD(r){return new Worker(""+new URL("../workers/duckdb_worker-L1CNRNFh.js",import.meta.url).href,{type:"module",name:r==null?void 0:r.name})}var aD=Xe('
    ');function eb(r,e){let n=le(e,"searchTerm",4);var l=aD(),p=ut(l);Zp(p),ht(l),Wp(p,n,v=>n(v)),Ve("input",p,function(v){Ne.call(this,e,v)}),xe(r,l)}const Fn=[];for(let r=0;r<256;++r)Fn.push((r+256).toString(16).slice(1));function oD(r,e=0){return(Fn[r[e+0]]+Fn[r[e+1]]+Fn[r[e+2]]+Fn[r[e+3]]+"-"+Fn[r[e+4]]+Fn[r[e+5]]+"-"+Fn[r[e+6]]+Fn[r[e+7]]+"-"+Fn[r[e+8]]+Fn[r[e+9]]+"-"+Fn[r[e+10]]+Fn[r[e+11]]+Fn[r[e+12]]+Fn[r[e+13]]+Fn[r[e+14]]+Fn[r[e+15]]).toLowerCase()}let Lg;const lD=new Uint8Array(16);function cD(){if(!Lg){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Lg=crypto.getRandomValues.bind(crypto)}return Lg(lD)}const uD=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),tb={randomUUID:uD};function hD(r,e,n){if(tb.randomUUID&&!e&&!r)return tb.randomUUID();r=r||{};const l=r.random||(r.rng||cD)();return l[6]=l[6]&15|64,l[8]=l[8]&63|128,oD(l)}var dD=Xe("ID",1),fD=Xe("Name",1),pD=Xe("Description",1),mD=Xe("Column",1),gD=Xe("Year",1),yD=Xe("Selected metrics",1),_D=Xe(" ",1),vD=Xe("Remove",1),bD=Xe(" ",1),xD=Xe(" ",1),wD=Xe("
    ");function SD(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Bl,"$selectedMetricsList",n);function p(A){console.log(A);const T=l().indexOf(A);T>-1&&l().splice(T,1),ki(Bl,[...l()])}let v=le(e,"nameAndDescriptionClass",0,"max-w-md whitespace-normal break-words border-b border-gray-200 px-2 py-2");zr();var b=wD(),c=ut(b);Lp(c,{children:(A,T)=>{var z=xD(),B=ct(z);Rp(B,{children:(j,Q)=>{var ae=_D(),ne=ct(ae);os(ne,{children:(De,je)=>{dr();var ke=dD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var Y=we(we(ne,!0));os(Y,{get class(){return v()},children:(De,je)=>{dr();var ke=fD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var _e=we(we(Y,!0));os(_e,{get class(){return v()},children:(De,je)=>{dr();var ke=pD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var de=we(we(_e,!0));os(de,{children:(De,je)=>{dr();var ke=mD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var pe=we(we(de,!0));os(pe,{children:(De,je)=>{dr();var ke=gD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0});var Te=we(we(pe,!0));os(Te,{children:(De,je)=>{dr();var ke=yD();xe(De,ke)},$$slots:{default:!0},$$legacy:!0}),xe(j,ae)},$$slots:{default:!0},$$legacy:!0});var U=we(we(B,!0));zp(U,{tableBodyClass:"divide-y",children:(j,Q)=>{var ae=nr(),ne=ct(ae);Oa(ne,1,l,Fa,(Y,_e,de)=>{Bp(Y,{children:(pe,Te)=>{var De=bD(),je=ct(De);ws(je,{children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_id.slice(0,8))),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var ke=we(we(je,!0));ws(ke,{get class(){return v()},children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_human_readable_name)),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var $e=we(we(ke,!0));ws($e,{get class(){return v()},children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_description)),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var Me=we(we($e,!0));ws(Me,{children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).metric_parquet_column_name)),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var He=we(we(Me,!0));ws(He,{children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(_e).source_data_release_collection_period_start.slice(0,4))),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0});var Ye=we(we(He,!0));ws(Ye,{children:(Pe,tt)=>{Hs(Pe,{color:"light",$$events:{click:()=>p(Pi(_e))},children:(Je,lt)=>{dr();var At=vD();xe(Je,At)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(pe,De)},$$slots:{default:!0},$$legacy:!0})}),xe(j,ae)},$$slots:{default:!0},$$legacy:!0}),xe(A,z)},$$slots:{default:!0},$$legacy:!0}),ht(b),xe(r,b),Lr()}function ID(r,e){switch(arguments.length){case 0:break;case 1:{typeof r=="function"?this.interpolator(r):this.range(r);break}default:{this.domain(r),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}function h_(r,e,n){r.prototype=e.prototype=n,n.constructor=r}function Cw(r,e){var n=Object.create(r.prototype);for(var l in e)n[l]=e[l];return n}function cd(){}var Yh=.7,Np=1/Yh,Jc="\\s*([+-]?\\d+)\\s*",Kh="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Na="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",TD=/^#([0-9a-f]{3,8})$/,kD=new RegExp(`^rgb\\(${Jc},${Jc},${Jc}\\)$`),AD=new RegExp(`^rgb\\(${Na},${Na},${Na}\\)$`),ED=new RegExp(`^rgba\\(${Jc},${Jc},${Jc},${Kh}\\)$`),CD=new RegExp(`^rgba\\(${Na},${Na},${Na},${Kh}\\)$`),MD=new RegExp(`^hsl\\(${Kh},${Na},${Na}\\)$`),DD=new RegExp(`^hsla\\(${Kh},${Na},${Na},${Kh}\\)$`),rb={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};h_(cd,Xh,{copy(r){return Object.assign(new this.constructor,this,r)},displayable(){return this.rgb().displayable()},hex:ib,formatHex:ib,formatHex8:PD,formatHsl:LD,formatRgb:nb,toString:nb});function ib(){return this.rgb().formatHex()}function PD(){return this.rgb().formatHex8()}function LD(){return Mw(this).formatHsl()}function nb(){return this.rgb().formatRgb()}function Xh(r){var e,n;return r=(r+"").trim().toLowerCase(),(e=TD.exec(r))?(n=e[1].length,e=parseInt(e[1],16),n===6?sb(e):n===3?new Ts(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?kf(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?kf(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=kD.exec(r))?new Ts(e[1],e[2],e[3],1):(e=AD.exec(r))?new Ts(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=ED.exec(r))?kf(e[1],e[2],e[3],e[4]):(e=CD.exec(r))?kf(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=MD.exec(r))?lb(e[1],e[2]/100,e[3]/100,1):(e=DD.exec(r))?lb(e[1],e[2]/100,e[3]/100,e[4]):rb.hasOwnProperty(r)?sb(rb[r]):r==="transparent"?new Ts(NaN,NaN,NaN,0):null}function sb(r){return new Ts(r>>16&255,r>>8&255,r&255,1)}function kf(r,e,n,l){return l<=0&&(r=e=n=NaN),new Ts(r,e,n,l)}function zD(r){return r instanceof cd||(r=Xh(r)),r?(r=r.rgb(),new Ts(r.r,r.g,r.b,r.opacity)):new Ts}function fy(r,e,n,l){return arguments.length===1?zD(r):new Ts(r,e,n,l??1)}function Ts(r,e,n,l){this.r=+r,this.g=+e,this.b=+n,this.opacity=+l}h_(Ts,fy,Cw(cd,{brighter(r){return r=r==null?Np:Math.pow(Np,r),new Ts(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Yh:Math.pow(Yh,r),new Ts(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ts(Fl(this.r),Fl(this.g),Fl(this.b),Up(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:ab,formatHex:ab,formatHex8:BD,formatRgb:ob,toString:ob}));function ab(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}`}function BD(){return`#${Ll(this.r)}${Ll(this.g)}${Ll(this.b)}${Ll((isNaN(this.opacity)?1:this.opacity)*255)}`}function ob(){const r=Up(this.opacity);return`${r===1?"rgb(":"rgba("}${Fl(this.r)}, ${Fl(this.g)}, ${Fl(this.b)}${r===1?")":`, ${r})`}`}function Up(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function Fl(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function Ll(r){return r=Fl(r),(r<16?"0":"")+r.toString(16)}function lb(r,e,n,l){return l<=0?r=e=n=NaN:n<=0||n>=1?r=e=NaN:e<=0&&(r=NaN),new pa(r,e,n,l)}function Mw(r){if(r instanceof pa)return new pa(r.h,r.s,r.l,r.opacity);if(r instanceof cd||(r=Xh(r)),!r)return new pa;if(r instanceof pa)return r;r=r.rgb();var e=r.r/255,n=r.g/255,l=r.b/255,p=Math.min(e,n,l),v=Math.max(e,n,l),b=NaN,c=v-p,A=(v+p)/2;return c?(e===v?b=(n-l)/c+(n0&&A<1?0:b,new pa(b,c,A,r.opacity)}function RD(r,e,n,l){return arguments.length===1?Mw(r):new pa(r,e,n,l??1)}function pa(r,e,n,l){this.h=+r,this.s=+e,this.l=+n,this.opacity=+l}h_(pa,RD,Cw(cd,{brighter(r){return r=r==null?Np:Math.pow(Np,r),new pa(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Yh:Math.pow(Yh,r),new pa(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,e=isNaN(r)||isNaN(this.s)?0:this.s,n=this.l,l=n+(n<.5?n:1-n)*e,p=2*n-l;return new Ts(zg(r>=240?r-240:r+120,p,l),zg(r,p,l),zg(r<120?r+240:r-120,p,l),this.opacity)},clamp(){return new pa(cb(this.h),Af(this.s),Af(this.l),Up(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(){const r=Up(this.opacity);return`${r===1?"hsl(":"hsla("}${cb(this.h)}, ${Af(this.s)*100}%, ${Af(this.l)*100}%${r===1?")":`, ${r})`}`}}));function cb(r){return r=(r||0)%360,r<0?r+360:r}function Af(r){return Math.max(0,Math.min(1,r||0))}function zg(r,e,n){return(r<60?e+(n-e)*r/60:r<180?n:r<240?e+(n-e)*(240-r)/60:e)*255}const d_=r=>()=>r;function FD(r,e){return function(n){return r+n*e}}function OD(r,e,n){return r=Math.pow(r,n),e=Math.pow(e,n)-r,n=1/n,function(l){return Math.pow(r+l*e,n)}}function ND(r){return(r=+r)==1?Dw:function(e,n){return n-e?OD(e,n,r):d_(isNaN(e)?n:e)}}function Dw(r,e){var n=e-r;return n?FD(r,n):d_(isNaN(r)?e:r)}const ub=function r(e){var n=ND(e);function l(p,v){var b=n((p=fy(p)).r,(v=fy(v)).r),c=n(p.g,v.g),A=n(p.b,v.b),T=Dw(p.opacity,v.opacity);return function(z){return p.r=b(z),p.g=c(z),p.b=A(z),p.opacity=T(z),p+""}}return l.gamma=r,l}(1);function UD(r,e){e||(e=[]);var n=r?Math.min(e.length,r.length):0,l=e.slice(),p;return function(v){for(p=0;pn&&(v=e.slice(n,v),c[b]?c[b]+=v:c[++b]=v),(l=l[0])===(p=p[0])?c[b]?c[b]+=p:c[++b]=p:(c[++b]=null,A.push({i:b,x:py(l,p)})),n=Bg.lastIndex;return n=1e21?r.toLocaleString("en").replace(/,/g,""):r.toString(10)}function $p(r,e){if((n=(r=e?r.toExponential(e-1):r.toExponential()).indexOf("e"))<0)return null;var n,l=r.slice(0,n);return[l.length>1?l[0]+l.slice(2):l,+r.slice(n+1)]}function ou(r){return r=$p(Math.abs(r)),r?r[1]:NaN}function KD(r,e){return function(n,l){for(var p=n.length,v=[],b=0,c=r[0],A=0;p>0&&c>0&&(A+c+1>l&&(c=Math.max(1,l-A)),v.push(n.substring(p-=c,p+c)),!((A+=c+1)>l));)c=r[b=(b+1)%r.length];return v.reverse().join(e)}}function XD(r){return function(e){return e.replace(/[0-9]/g,function(n){return r[+n]})}}var JD=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Vp(r){if(!(e=JD.exec(r)))throw new Error("invalid format: "+r);var e;return new p_({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}Vp.prototype=p_.prototype;function p_(r){this.fill=r.fill===void 0?" ":r.fill+"",this.align=r.align===void 0?">":r.align+"",this.sign=r.sign===void 0?"-":r.sign+"",this.symbol=r.symbol===void 0?"":r.symbol+"",this.zero=!!r.zero,this.width=r.width===void 0?void 0:+r.width,this.comma=!!r.comma,this.precision=r.precision===void 0?void 0:+r.precision,this.trim=!!r.trim,this.type=r.type===void 0?"":r.type+""}p_.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 QD(r){e:for(var e=r.length,n=1,l=-1,p;n0&&(l=0);break}return l>0?r.slice(0,l)+r.slice(p+1):r}var Lw;function eP(r,e){var n=$p(r,e);if(!n)return r+"";var l=n[0],p=n[1],v=p-(Lw=Math.max(-8,Math.min(8,Math.floor(p/3)))*3)+1,b=l.length;return v===b?l:v>b?l+new Array(v-b+1).join("0"):v>0?l.slice(0,v)+"."+l.slice(v):"0."+new Array(1-v).join("0")+$p(r,Math.max(0,e+v-1))[0]}function hb(r,e){var n=$p(r,e);if(!n)return r+"";var l=n[0],p=n[1];return p<0?"0."+new Array(-p).join("0")+l:l.length>p+1?l.slice(0,p+1)+"."+l.slice(p+1):l+new Array(p-l.length+2).join("0")}const db={"%":(r,e)=>(r*100).toFixed(e),b:r=>Math.round(r).toString(2),c:r=>r+"",d:YD,e:(r,e)=>r.toExponential(e),f:(r,e)=>r.toFixed(e),g:(r,e)=>r.toPrecision(e),o:r=>Math.round(r).toString(8),p:(r,e)=>hb(r*100,e),r:hb,s:eP,X:r=>Math.round(r).toString(16).toUpperCase(),x:r=>Math.round(r).toString(16)};function fb(r){return r}var pb=Array.prototype.map,mb=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function tP(r){var e=r.grouping===void 0||r.thousands===void 0?fb:KD(pb.call(r.grouping,Number),r.thousands+""),n=r.currency===void 0?"":r.currency[0]+"",l=r.currency===void 0?"":r.currency[1]+"",p=r.decimal===void 0?".":r.decimal+"",v=r.numerals===void 0?fb:XD(pb.call(r.numerals,String)),b=r.percent===void 0?"%":r.percent+"",c=r.minus===void 0?"−":r.minus+"",A=r.nan===void 0?"NaN":r.nan+"";function T(B){B=Vp(B);var U=B.fill,j=B.align,Q=B.sign,ae=B.symbol,ne=B.zero,Y=B.width,_e=B.comma,de=B.precision,pe=B.trim,Te=B.type;Te==="n"?(_e=!0,Te="g"):db[Te]||(de===void 0&&(de=12),pe=!0,Te="g"),(ne||U==="0"&&j==="=")&&(ne=!0,U="0",j="=");var De=ae==="$"?n:ae==="#"&&/[boxX]/.test(Te)?"0"+Te.toLowerCase():"",je=ae==="$"?l:/[%p]/.test(Te)?b:"",ke=db[Te],$e=/[defgprs%]/.test(Te);de=de===void 0?6:/[gprs]/.test(Te)?Math.max(1,Math.min(21,de)):Math.max(0,Math.min(20,de));function Me(He){var Ye=De,Pe=je,tt,Je,lt;if(Te==="c")Pe=ke(He)+Pe,He="";else{He=+He;var At=He<0||1/He<0;if(He=isNaN(He)?A:ke(Math.abs(He),de),pe&&(He=QD(He)),At&&+He==0&&Q!=="+"&&(At=!1),Ye=(At?Q==="("?Q:c:Q==="-"||Q==="("?"":Q)+Ye,Pe=(Te==="s"?mb[8+Lw/3]:"")+Pe+(At&&Q==="("?")":""),$e){for(tt=-1,Je=He.length;++ttlt||lt>57){Pe=(lt===46?p+He.slice(tt+1):He.slice(tt))+Pe,He=He.slice(0,tt);break}}}_e&&!ne&&(He=e(He,1/0));var Ze=Ye.length+He.length+Pe.length,ft=Ze>1)+Ye+He+Pe+ft.slice(Ze);break;default:He=ft+Ye+He+Pe;break}return v(He)}return Me.toString=function(){return B+""},Me}function z(B,U){var j=T((B=Vp(B),B.type="f",B)),Q=Math.max(-8,Math.min(8,Math.floor(ou(U)/3)))*3,ae=Math.pow(10,-Q),ne=mb[8+Q/3];return function(Y){return j(ae*Y)+ne}}return{format:T,formatPrefix:z}}var Ef,zw,Bw;rP({thousands:",",grouping:[3],currency:["$",""]});function rP(r){return Ef=tP(r),zw=Ef.format,Bw=Ef.formatPrefix,Ef}function iP(r){return Math.max(0,-ou(Math.abs(r)))}function nP(r,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(ou(e)/3)))*3-ou(Math.abs(r)))}function sP(r,e){return r=Math.abs(r),e=Math.abs(e)-r,Math.max(0,ou(e)-ou(r))+1}function aP(r,e,n,l){var p=d3(r,e,n),v;switch(l=Vp(l??",f"),l.type){case"s":{var b=Math.max(Math.abs(r),Math.abs(e));return l.precision==null&&!isNaN(v=nP(p,b))&&(l.precision=v),Bw(l,b)}case"":case"e":case"g":case"p":case"r":{l.precision==null&&!isNaN(v=sP(p,Math.max(Math.abs(r),Math.abs(e))))&&(l.precision=v-(l.type==="e"));break}case"f":case"%":{l.precision==null&&!isNaN(v=iP(p))&&(l.precision=v-(l.type==="%")*2);break}}return zw(l)}function oP(r){var e=r.domain;return r.ticks=function(n){var l=e();return h3(l[0],l[l.length-1],n??10)},r.tickFormat=function(n,l){var p=e();return aP(p[0],p[p.length-1],n??10,l)},r.nice=function(n){n==null&&(n=10);var l=e(),p=0,v=l.length-1,b=l[p],c=l[v],A,T,z=10;for(c0;){if(T=hy(b,c,n),T===A)return l[p]=b,l[v]=c,e(l);if(T>0)b=Math.floor(b/T)*T,c=Math.ceil(c/T)*T;else if(T<0)b=Math.ceil(b*T)/T,c=Math.floor(c*T)/T;else break;A=T}return r},r}function lP(){var r=0,e=1,n,l,p,v,b=Pw,c=!1,A;function T(B){return B==null||isNaN(B=+B)?A:b(p===0?.5:(B=(v(B)-n)*p,c?Math.max(0,Math.min(1,B)):B))}T.domain=function(B){return arguments.length?([r,e]=B,n=v(r=+r),l=v(e=+e),p=n===l?0:1/(l-n),T):[r,e]},T.clamp=function(B){return arguments.length?(c=!!B,T):c},T.interpolator=function(B){return arguments.length?(b=B,T):b};function z(B){return function(U){var j,Q;return arguments.length?([j,Q]=U,b=B(j,Q),T):[b(0),b(1)]}}return T.range=z(f_),T.rangeRound=z(HD),T.unknown=function(B){return arguments.length?(A=B,T):A},function(B){return v=B,n=B(r),l=B(e),p=n===l?0:1/(l-n),T}}function cP(r,e){return e.domain(r.domain()).interpolator(r.interpolator()).clamp(r.clamp()).unknown(r.unknown())}function Rw(){var r=oP(lP()(Pw));return r.copy=function(){return cP(r,Rw())},ID.apply(r,arguments)}function sm(r){for(var e=r.length/6|0,n=new Array(e),l=0;l ",1),fP=Xe(" ",1),pP=Xe("
    ");function mP(r,e){Pr(e,!1);const n=Cn(),l=()=>br(Nv,"$previewMetricMap",n),p=()=>br(Cp,"$previewedMetricsList",n),v=()=>br(Yy,"$tileUrl",n),b=()=>br(Bl,"$selectedMetricsList",n);function c(z){console.log("Set preview metric map: ",z),Nv.set(z);let B=l().metric_parquet_column_name;const U=Math.min(...p().map(ae=>Number(ae[B]))),j=Math.max(...p().map(ae=>Number(ae[B]))),Q=Rw(uP).domain([U,j]);console.log("min:",U),console.log("max:",j),ki(Hy,p().map(ae=>("color"in ae&&delete ae.color,{...ae,color:Q(Number(ae[B]))}))),console.log(v())}zr();var A=pP(),T=ut(A);Lp(T,{children:(z,B)=>{var U=fP(),j=ct(U);Rp(j,{children:(ae,ne)=>{var Y=dP(),_e=ct(Y);os(_e,{children:(pe,Te)=>{dr();var De=hP();xe(pe,De)},$$slots:{default:!0},$$legacy:!0});var de=we(we(_e,!0));Oa(de,1,b,Fa,(pe,Te,De)=>{os(pe,{children:(je,ke)=>{Hs(je,{size:"xs",color:"light",$$events:{click:()=>c(Pi(Te))},children:($e,Me)=>{dr();var He=Hn();Pt(()=>gi(He,Pi(Te).metric_parquet_column_name)),xe($e,He)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0})}),xe(ae,Y)},$$slots:{default:!0},$$legacy:!0});var Q=we(we(j,!0));zp(Q,{children:(ae,ne)=>{var Y=nr(),_e=ct(Y);Oa(_e,1,()=>p().slice(0,10),Fa,(de,pe,Te)=>{Bp(de,{children:(De,je)=>{var ke=nr(),$e=ct(ke);Oa($e,1,()=>Object.keys(Pi(pe)).map(function(Me){return String(Pi(pe)[Me])}),Fa,(Me,He,Ye)=>{ws(Me,{class:"justified",children:(Pe,tt)=>{dr();var Je=Hn();Pt(()=>gi(Je,Pi(He))),xe(Pe,Je)},$$slots:{default:!0},$$legacy:!0})}),xe(De,ke)},$$slots:{default:!0},$$legacy:!0})}),xe(ae,Y)},$$slots:{default:!0},$$legacy:!0}),xe(z,U)},$$slots:{default:!0},$$legacy:!0}),ht(A),xe(r,A),Lr()}var gP=Xe("Home",1),yP=Xe("Selected metrics and Preview",1),_P=Xe("Search term ",1),vP=Xe("Page ",1),bP=Xe("Name",1),xP=Xe("Year",1),wP=Xe("Selected metrics",1),SP=Xe(" ",1),IP=Xe("Add",1),TP=Xe(" ",1),kP=Xe(" ",1),AP=Xe('
    '),EP=Xe('

    Selected metrics

    ',1),CP=Xe('

    Preview of selected metrics

    ',1),MP=Xe("Search term ",1),DP=Xe("Page ",1),PP=Xe("Name",1),LP=Xe("Description",1),zP=Xe("Year",1),BP=Xe("Selected metrics",1),RP=Xe(" ",1),FP=Xe("Add",1),OP=Xe(" ",1),NP=Xe(" ",1),UP=Xe('
    ',1),$P=Xe("Bounding Box (left, bottom, right, top)"),VP=Xe("Get from map",1),jP=Xe(" ",1),qP=Xe(" ",1),GP=Xe("Output format: ",1),ZP=Xe("Copy",1),WP=Xe(" ",1),HP=Xe("Popgetter CLI command ",1),YP=Xe("Download and save",1),KP=Xe("Download and save data ",1),XP=Xe('
    ',1),JP=Xe(" ",1),QP=Xe(" ",1),e4=Xe('
    ');function t4(r,e){Pr(e,!1);const n=Cn(),l=()=>br(ty,"$rustBackend",n),p=()=>br(G1,"$duckdbBackend",n),v=()=>br(Bl,"$selectedMetricsList",n),b=()=>br(Cp,"$previewedMetricsList",n),c=()=>br(iy,"$selectedLevel",n),A=()=>br(Ep,"$selectedCountry",n),T=()=>br(Pe,"$page",n),z=["geojson","csv","geojsonseq"];let B=wt("csv"),U=wt(),j=wt(""),Q=wt(!1),ae={y:320,duration:200,easing:tM};async function ne(gt){try{console.log(gt),await l().isLoaded()||await l().initialise();let Ct=await l().downloadDataRequestMetricsSql(gt);console.log(Ct),await p().isLoaded()||await p().initialise();const Mt=await p().getMetrics(Ct);return console.log(Mt),Mt}catch(Ct){window.alert(`Failed to download: ${Ct}`)}}async function Y(){if(v().length===0)return[];const gt=v().map(Rt=>({MetricId:{id:Rt.metric_id}}));console.log(gt);let Ct={region:[],metrics:gt,years:[]};const Mt=await ne(Ct);ki(Cp,Mt),await l().isLoaded()||await l().initialise();try{let Rt=await l().downloadDataRequestGeomsPmtiles(Ct);console.log(Rt),ki(Yy,Rt)}catch(Rt){window.alert(`Failed to get tile URL: ${Rt}`)}console.log(b().slice(0,10))}function _e(){let gt=v().map(rt=>`--id ${rt.metric_id}`).join(" "),Ct="--output-format "+oe(B),Mt=oe(j)===""?"":"--bbox "+oe(j);return["popgetter","data",gt,Ct,Mt].join(" ")}function de(gt){console.log(gt),v().indexOf(gt)===-1?v().push(gt):console.log("Not added"),ki(Bl,[...v()])}function pe(gt){console.log(gt);const Ct=v().indexOf(gt);Ct>-1&&v().splice(Ct,1),ki(Bl,[...v()])}async function Te(gt,Ct){try{return await l().isLoaded()||await l().initialise(),await l().search(gt,Ct)}catch(Mt){window.alert(`Failed to search: ${Mt}`)}}function De(){console.log("Bounds:",oe(U)),ot(j,[oe(U)._sw.lng,oe(U)._sw.lat,oe(U)._ne.lng,oe(U)._ne.lat].map(gt=>Number(gt.toFixed(6)).toString()).join(","))}async function je(gt){await l().isLoaded()||await l().initialise();try{console.log(gt);let Mt=await l().downloadDataRequest(gt,oe(B));return console.log(Mt),Mt}catch(Mt){window.alert(`Failed to download: ${Mt}`)}}function ke(gt){let Ct=hD()+"."+oe(B).toLowerCase();const Mt=new Blob([gt],{type:"text/plain"}),rt=document.createElement("a");rt.download=Ct,rt.href=URL.createObjectURL(Mt),document.body.appendChild(rt),rt.click(),document.body.removeChild(rt),URL.revokeObjectURL(rt.href)}let $e=wt(""),Me={},He=[],Ye=wt([]);const Pe=ci(0);async function tt(){Me={metric_id:[],text:[{text:oe($e),context:["Hxl","HumanReadableName","Description"],config:{match_type:"Regex",case_sensitivity:"Insensitive"}}],geometry_level:{value:c(),config:{match_type:"Exact",case_sensitivity:"Insensitive"}},year_range:[],country:{value:A(),config:{match_type:"Regex",case_sensitivity:"Insensitive"}},region_spec:[]},console.log(Me),console.log(T()),He=await Te(Me,T()),ot(Ye,He.slice(0,10)),console.log(He)}function Je(gt,Ct){let Mt;return function(...rt){clearTimeout(Mt),Mt=setTimeout(()=>{gt.apply(this,rt)},Ct)}}const lt=Je(tt,300);async function At(){console.log("Bbox",oe(j));let gt={region:oe(j)===""?[]:[{BoundingBox:oe(j).split(",").map(Ct=>Number(Number(Ct).toFixed(6)))}],metrics:v().map(Ct=>({MetricId:{id:Ct.metric_id}}))};console.log("DataRequestSpec"),console.log(gt),ke(await je(gt))}const Ze="max-w-md whitespace-normal break-words border-b border-gray-200 px-2 py-2",ft="text-align: left; margin-top: 2.5%; margin-bottom: 5%; ",St="text-align: left; margin-top: 1.0%; margin-bottom: 1.0%; ";return zr(),vy(r,{$$slots:{sidebar:(gt,Ct)=>{var Mt=AP(),rt=ut(Mt);Ai(rt,"style",ft);var Rt=ut(rt);Hs(Rt,{color:"light",$$events:{click:()=>ki(tm,{kind:"title"})},children:(cr,Jr)=>{dr();var Ar=gP();xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0});var yr=we(we(Rt,!0));Hs(yr,{color:"light",$$events:{click:()=>ot(Q,!1)},children:(cr,Jr)=>{dr();var Ar=yP();xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),ht(rt);var _t=we(we(rt,!0));Ai(_t,"style",ft);var Ge=ut(_t);qo(Ge,{class:"space-y-2",children:(cr,Jr)=>{dr();var Ar=_P(),Qr=we(ct(Ar,!0));eb(Qr,{get searchTerm(){return oe($e)},set searchTerm($i){ot($e,$i)},$$events:{input:lt},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0});var Nt=we(we(Ge,!0));qo(Nt,{class:"space-y-2",children:(cr,Jr)=>{dr();var Ar=vP(),Qr=we(ct(Ar,!0));Wv(Qr,{get value(){return T()},set value($i){ki(Pe,$i)},$$events:{input:lt},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),ht(_t);var Ot=we(we(_t,!0)),Ir=ut(Ot);Lp(Ir,{children:(cr,Jr)=>{var Ar=kP(),Qr=ct(Ar);Rp(Qr,{children:(cn,Mn)=>{var vi=SP(),Ce=ct(vi);os(Ce,{children:(Xt,ir)=>{dr();var bi=bP();xe(Xt,bi)},$$slots:{default:!0},$$legacy:!0});var Vr=we(we(Ce,!0));os(Vr,{children:(Xt,ir)=>{dr();var bi=xP();xe(Xt,bi)},$$slots:{default:!0},$$legacy:!0});var Br=we(we(Vr,!0));os(Br,{children:(Xt,ir)=>{dr();var bi=wP();xe(Xt,bi)},$$slots:{default:!0},$$legacy:!0}),xe(cn,vi)},$$slots:{default:!0},$$legacy:!0});var $i=we(we(Qr,!0));zp($i,{tableBodyClass:"divide-y",children:(cn,Mn)=>{var vi=nr(),Ce=ct(vi);Oa(Ce,1,()=>oe(Ye),Fa,(Vr,Br,Xt)=>{Bp(Vr,{children:(ir,bi)=>{var fn=TP(),zi=ct(fn);ws(zi,{class:Ze,children:(fi,hn)=>{dr();var qe=Hn();Pt(()=>gi(qe,Pi(Br).metric_human_readable_name)),xe(fi,qe)},$$slots:{default:!0},$$legacy:!0});var un=we(we(zi,!0));ws(un,{children:(fi,hn)=>{dr();var qe=Hn();Pt(()=>gi(qe,Pi(Br).source_data_release_collection_period_start.slice(0,4))),xe(fi,qe)},$$slots:{default:!0},$$legacy:!0});var Ji=we(we(un,!0));ws(Ji,{children:(fi,hn)=>{Hs(fi,{color:"light",$$events:{click:()=>de(Pi(Br))},children:(qe,dn)=>{dr();var ar=IP();xe(qe,ar)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(ir,fn)},$$slots:{default:!0},$$legacy:!0})}),xe(cn,vi)},$$slots:{default:!0},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),ht(Ot),ht(Mt),xe(gt,Mt)},map:(gt,Ct)=>{var Mt=e4(),rt=ut(Mt);u_(rt,{get bounds(){return oe(U)},set bounds(_t){ot(U,_t)},$$legacy:!0});var Rt=we(we(rt,!0)),yr=ut(Rt);nC(yr,{placement:"top",position:"absolute",transitionType:"fly",width:"w-full",activateClickOutside:!1,transitionParams:ae,backdrop:!1,get hidden(){return oe(Q)},set hidden(_t){ot(Q,_t)},id:"sidebar8",children:(_t,Ge)=>{var Nt=QP(),Ot=ct(Nt);J1(Ot,{class:"mb-4 dark:text-white",$$events:{click:()=>ot(Q,!0)},$$legacy:!0});var Ir=we(we(Ot,!0));vM(Ir,{children:(cr,Jr)=>{var Ar=JP(),Qr=ct(Ar);If(Qr,{open:!0,title:"Selected Metrics",children:(vi,Ce)=>{var Vr=EP(),Br=ct(Vr);ut(Br),ht(Br);var Xt=we(we(Br,!0));SD(Xt,{$$legacy:!0}),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0});var $i=we(we(Qr,!0));If($i,{title:"Preview",$$events:{click:()=>Y()},children:(vi,Ce)=>{var Vr=CP(),Br=ct(Vr),Xt=ut(Br),ir=we(ut(Xt)),bi=Sb(()=>()=>At());ht(Xt),ht(Br);var fn=we(we(Br,!0));mP(fn,{$$legacy:!0}),Ve("click",ir,function(...zi){var un;return(un=oe(bi))==null?void 0:un.apply(this,zi)},!1),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0});var cn=we(we($i,!0));If(cn,{title:"Advanced Search",children:(vi,Ce)=>{var Vr=UP(),Br=ct(Vr);Ai(Br,"style",ft);var Xt=ut(Br);qo(Xt,{class:"space-y-2",children:(zi,un)=>{dr();var Ji=MP(),fi=we(ct(Ji,!0));eb(fi,{get searchTerm(){return oe($e)},set searchTerm(hn){ot($e,hn)},$$events:{input:lt},$$legacy:!0}),xe(zi,Ji)},$$slots:{default:!0},$$legacy:!0});var ir=we(we(Xt,!0));qo(ir,{class:"space-y-2",children:(zi,un)=>{dr();var Ji=DP(),fi=we(ct(Ji,!0));Wv(fi,{get value(){return T()},set value(hn){ki(Pe,hn)},$$events:{input:lt},$$legacy:!0}),xe(zi,Ji)},$$slots:{default:!0},$$legacy:!0}),ht(Br);var bi=we(we(Br,!0)),fn=ut(bi);Lp(fn,{children:(zi,un)=>{var Ji=NP(),fi=ct(Ji);Rp(fi,{children:(qe,dn)=>{var ar=RP(),Bi=ct(ar);os(Bi,{children:(xt,Hr)=>{dr();var ii=PP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0});var Ri=we(we(Bi,!0));os(Ri,{children:(xt,Hr)=>{dr();var ii=LP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0});var We=we(we(Ri,!0));os(We,{children:(xt,Hr)=>{dr();var ii=zP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0});var jt=we(we(We,!0));os(jt,{children:(xt,Hr)=>{dr();var ii=BP();xe(xt,ii)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0});var hn=we(we(fi,!0));zp(hn,{tableBodyClass:"divide-y",children:(qe,dn)=>{var ar=nr(),Bi=ct(ar);Oa(Bi,1,()=>oe(Ye),Fa,(Ri,We,jt)=>{Bp(Ri,{children:(xt,Hr)=>{var ii=OP(),qt=ct(ii);ws(qt,{class:Ze,children:(O,q)=>{dr();var X=Hn();Pt(()=>gi(X,Pi(We).metric_human_readable_name)),xe(O,X)},$$slots:{default:!0},$$legacy:!0});var On=we(we(qt,!0));ws(On,{class:Ze,children:(O,q)=>{dr();var X=Hn();Pt(()=>gi(X,Pi(We).metric_description)),xe(O,X)},$$slots:{default:!0},$$legacy:!0});var K=we(we(On,!0));ws(K,{children:(O,q)=>{dr();var X=Hn();Pt(()=>gi(X,Pi(We).source_data_release_collection_period_start.slice(0,4))),xe(O,X)},$$slots:{default:!0},$$legacy:!0});var R=we(we(K,!0));ws(R,{children:(O,q)=>{Hs(O,{color:"light",$$events:{click:()=>de(Pi(We))},children:(X,te)=>{dr();var ve=FP();xe(X,ve)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(xt,ii)},$$slots:{default:!0},$$legacy:!0})}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),xe(zi,Ji)},$$slots:{default:!0},$$legacy:!0}),ht(bi),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0});var Mn=we(we(cn,!0));If(Mn,{title:"Download",$$events:{click:()=>{De(),Y()}},children:(vi,Ce)=>{var Vr=XP(),Br=ct(Vr),Xt=ut(Br);Ai(Xt,"style",St);var ir=ut(Xt);qo(ir,{class:"space-y-2",children:(qe,dn)=>{var ar=$P();xe(qe,ar)},$$slots:{default:!0},$$legacy:!0});var bi=we(we(ir,!0));Cg(bi,{class:"w-full",children:(qe,dn)=>{var ar=jP(),Bi=ct(ar);uy(Bi,{id:"bbox",type:"text",placeholder:"",get value(){return oe(j)},set value(We){ot(j,We)},$$legacy:!0});var Ri=we(we(Bi,!0));Hs(Ri,{color:"light",class:"w-80",$$events:{click:()=>De()},children:(We,jt)=>{dr();var xt=VP();xe(We,xt)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(Xt);var fn=we(we(Xt,!0));Ai(fn,"style",St);var zi=ut(fn);qo(zi,{class:"space-y-2",children:(qe,dn)=>{dr();var ar=GP(),Bi=we(ct(ar,!0));Hs(Bi,{color:"light",children:(We,jt)=>{dr();var xt=qP(),Hr=ct(xt,!0),ii=we(Hr);kM(ii,{class:"ms-2 h-6 w-6",$$legacy:!0}),Pt(()=>gi(Hr,`${oe(B)??""} `)),xe(We,xt)},$$slots:{default:!0},$$legacy:!0});var Ri=we(we(Bi,!0));i_(Ri,{children:(We,jt)=>{var xt=nr(),Hr=ct(xt);Oa(Hr,1,()=>z,Fa,(ii,qt,On)=>{n_(ii,{$$events:{click:()=>ot(B,Pi(qt))},children:(K,R)=>{dr();var O=Hn();Pt(()=>gi(O,Pi(qt))),xe(K,O)},$$slots:{default:!0},$$legacy:!0})}),xe(We,xt)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(fn),ht(Br);var un=we(we(Br,!0));Ai(un,"style",St);var Ji=ut(un);qo(Ji,{class:"space-y-2",children:(qe,dn)=>{dr();var ar=HP(),Bi=we(ct(ar,!0));Cg(Bi,{class:"w-full",children:(Ri,We)=>{var jt=WP(),xt=ct(jt),Hr=Yo(_e);uy(xt,{id:"popgetter-data-cli",readonly:!0,get value(){return oe(Hr)},$$legacy:!0});var ii=we(we(xt,!0));Hs(ii,{color:"light","data-copy-to-clipboard-target":"popgetter-data-cli",$$events:{click:()=>{console.log(_e()),navigator.clipboard.writeText(_e())}},children:(qt,On)=>{dr();var K=ZP();xe(qt,K)},$$slots:{default:!0},$$legacy:!0}),xe(Ri,jt)},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(un);var fi=we(we(un,!0));Ai(fi,"style",St);var hn=ut(fi);qo(hn,{class:"space-y-2",children:(qe,dn)=>{dr();var ar=KP(),Bi=we(ct(ar,!0));Cg(Bi,{class:"w-full",children:(Ri,We)=>{Hs(Ri,{color:"light",$$events:{click:()=>{At()}},children:(jt,xt)=>{dr();var Hr=YP();xe(jt,Hr)},$$slots:{default:!0},$$legacy:!0})},$$slots:{default:!0},$$legacy:!0}),xe(qe,ar)},$$slots:{default:!0},$$legacy:!0}),ht(fi),xe(vi,Vr)},$$slots:{default:!0},$$legacy:!0}),xe(cr,Ar)},$$slots:{default:!0},$$legacy:!0}),xe(_t,Nt)},$$slots:{default:!0},$$legacy:!0}),ht(Rt),ht(Mt),xe(gt,Mt)}},$$legacy:!0}),SI(e,"remove",pe),Lr({remove:pe})}var r4=Xe('

    Pick geometry level...

    '),i4=Xe('
  • '),n4=Xe('
    '),s4=Xe('
    ');function a4(r,e){Pr(e,!1);const n=Cn(),l=()=>br(iy,"$selectedLevel",n),p=()=>br(Ep,"$selectedCountry",n),v={"United States":["tract","county","block_group"],Scotland:["OutputArea2011","CouncilArea2011","DataZone2011"],"Northern Ireland":["LGD14","DZ21","SDZ21"],"England and Wales":["msoa","lsoa","rgn","oa","ctry","ltla"],Belgium:["statistical_sector","municipality"]};let b=wt([]),c=wt();function A(T){ki(iy,T),console.log("Selected country: ",p()),console.log("Selected level: ",l()),ki(tm,{kind:"download"})}Gp(async()=>{try{ot(b,v[p()+""]),console.log(oe(b));return}catch(T){window.alert(`Failed to get levels: ${T}`)}}),zr(),vy(r,{$$slots:{sidebar:(T,z)=>{var B=n4(),U=ut(B),j=ut(U);uw(j);var Q=we(we(j,!0));Hs(Q,{children:(ne,Y)=>{var _e=r4(),de=ut(_e);ut(de),ht(de);var pe=we(we(de,!0));cw(pe,{color:"grey",size:"lg",class:"text-grey ms-2 h-6 w-6 dark:text-gray-500",$$legacy:!0}),ht(_e),xe(ne,_e)},$$slots:{default:!0},$$legacy:!0});var ae=we(we(Q,!0));i_(ae,{children:(ne,Y)=>{var _e=nr(),de=ct(_e);Oa(de,1,()=>oe(b),Fa,(pe,Te,De)=>{var je=i4(),ke=ut(je);n_(ke,{$$events:{click:()=>A(Pi(Te))},children:($e,Me)=>{dr();var He=Hn();Pt(()=>gi(He,Pi(Te))),xe($e,He)},$$slots:{default:!0},$$legacy:!0}),ht(je),xe(pe,je)}),xe(ne,_e)},$$slots:{default:!0},$$legacy:!0}),ht(U),ht(B),xe(T,B)},map:(T,z)=>{var B=s4(),U=ut(B);u_(U,{get bounds(){return oe(c)},set bounds(j){ot(c,j)},$$legacy:!0}),ht(B),xe(T,B)}},$$legacy:!0}),Lr()}var o4=Xe('

    Popgetter browser

    '),l4=Xe('
    ');function _4(r,e){Pr(e,!1);const n=Cn(),l=()=>br(ty,"$rustBackend",n),p=()=>br(ry,"$countries",n),v=()=>br(Fg,"$sidebarContents",n),b=()=>br(tm,"$mode",n);let c=wt(!1);Gp(async()=>{const T=Og(new nD);let z=await new T;ty.set(z);const B=Og(new sD);let U=await new B;G1.set(U),await l().isLoaded()||await l().initialise(),ki(ry,await l().getCountries()),console.log(p()),ot(c,!0)});let A=wt();bt(()=>(oe(A),v()),()=>{oe(A)&&v()&&(Rh(A,oe(A).innerHTML=""),oe(A).appendChild(v()))}),_i(),zr(),TI(r,{$$slots:{left:(T,z)=>{var B=o4(),U=ut(B),j=we(we(U,!0));Ol(j,Q=>ot(A,Q),()=>oe(A)),ht(B),xe(T,B)},main:(T,z)=>{var B=l4(),U=ut(B);pr(U,()=>oe(c),j=>{var Q=nr(),ae=ct(Q);pr(ae,()=>b().kind=="title",ne=>{iD(ne,{$$legacy:!0})},ne=>{var Y=nr(),_e=ct(Y);pr(_e,()=>b().kind=="level",de=>{a4(de,{$$legacy:!0})},de=>{var pe=nr(),Te=ct(pe);pr(Te,()=>b().kind=="download",De=>{t4(De,{$$legacy:!0})},null,!0),xe(de,pe)},!0),xe(ne,Y)}),xe(j,Q)},j=>{iM(j,{$$legacy:!0})}),ht(B),xe(T,B)}},$$legacy:!0}),Lr()}export{_4 as component}; diff --git a/_app/immutable/workers/assets/rust_backend_bg-w-zFaO6K.wasm b/_app/immutable/workers/assets/rust_backend_bg-DgvIor_q.wasm similarity index 64% rename from _app/immutable/workers/assets/rust_backend_bg-w-zFaO6K.wasm rename to _app/immutable/workers/assets/rust_backend_bg-DgvIor_q.wasm index c552582..a21e7b6 100644 Binary files a/_app/immutable/workers/assets/rust_backend_bg-w-zFaO6K.wasm and b/_app/immutable/workers/assets/rust_backend_bg-DgvIor_q.wasm differ diff --git a/_app/immutable/workers/duckdb_worker-DqZfXcIA.js b/_app/immutable/workers/duckdb_worker-L1CNRNFh.js similarity index 95% rename from _app/immutable/workers/duckdb_worker-DqZfXcIA.js rename to _app/immutable/workers/duckdb_worker-L1CNRNFh.js index dc325c0..dd4cbf4 100644 --- a/_app/immutable/workers/duckdb_worker-DqZfXcIA.js +++ b/_app/immutable/workers/duckdb_worker-L1CNRNFh.js @@ -2,7 +2,7 @@ var jo=Object.defineProperty;var zo=(i,t,e)=>t in i?jo(i,t,{enumerable:!0,config * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 - */const Es=Symbol("Comlink.proxy"),Vo=Symbol("Comlink.endpoint"),$o=Symbol("Comlink.releaseProxy"),Ki=Symbol("Comlink.finalizer"),Je=Symbol("Comlink.thrown"),Ds=i=>typeof i=="object"&&i!==null||typeof i=="function",Wo={canHandle:i=>Ds(i)&&i[Es],serialize(i){const{port1:t,port2:e}=new MessageChannel;return Sn(i,t),[e,[e]]},deserialize(i){return i.start(),qo(i)}},Yo={canHandle:i=>Ds(i)&&Je in i,serialize({value:i}){let t;return i instanceof Error?t={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:t={isError:!1,value:i},[t,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},Fs=new Map([["proxy",Wo],["throw",Yo]]);function Go(i,t){for(const e of i)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function Sn(i,t=globalThis,e=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Go(e,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:r,type:o,path:a}=Object.assign({path:[]},s.data),c=(s.data.argumentList||[]).map(Kt);let u;try{const d=a.slice(0,-1).reduce((F,T)=>F[T],i),h=a.reduce((F,T)=>F[T],i);switch(o){case"GET":u=h;break;case"SET":d[a.slice(-1)[0]]=Kt(s.data.value),u=!0;break;case"APPLY":u=h.apply(d,c);break;case"CONSTRUCT":{const F=new h(...c);u=Xo(F)}break;case"ENDPOINT":{const{port1:F,port2:T}=new MessageChannel;Sn(i,T),u=Zo(F,[F])}break;case"RELEASE":u=void 0;break;default:return}}catch(d){u={value:d,[Je]:0}}Promise.resolve(u).catch(d=>({value:d,[Je]:0})).then(d=>{const[h,F]=di(d);t.postMessage(Object.assign(Object.assign({},h),{id:r}),F),o==="RELEASE"&&(t.removeEventListener("message",n),Ns(t),Ki in i&&typeof i[Ki]=="function"&&i[Ki]())}).catch(d=>{const[h,F]=di({value:new TypeError("Unserializable return value"),[Je]:0});t.postMessage(Object.assign(Object.assign({},h),{id:r}),F)})}),t.start&&t.start()}function Ho(i){return i.constructor.name==="MessagePort"}function Ns(i){Ho(i)&&i.close()}function qo(i,t){return cn(i,[],t)}function He(i){if(i)throw new Error("Proxy has been released and is not useable")}function Rs(i){return ne(i,{type:"RELEASE"}).then(()=>{Ns(i)})}const li=new WeakMap,ui="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{const t=(li.get(i)||0)-1;li.set(i,t),t===0&&Rs(i)});function Ko(i,t){const e=(li.get(t)||0)+1;li.set(t,e),ui&&ui.register(i,t,i)}function Qo(i){ui&&ui.unregister(i)}function cn(i,t=[],e=function(){}){let n=!1;const s=new Proxy(e,{get(r,o){if(He(n),o===$o)return()=>{Qo(s),Rs(i),n=!0};if(o==="then"){if(t.length===0)return{then:()=>s};const a=ne(i,{type:"GET",path:t.map(c=>c.toString())}).then(Kt);return a.then.bind(a)}return cn(i,[...t,o])},set(r,o,a){He(n);const[c,u]=di(a);return ne(i,{type:"SET",path:[...t,o].map(d=>d.toString()),value:c},u).then(Kt)},apply(r,o,a){He(n);const c=t[t.length-1];if(c===Vo)return ne(i,{type:"ENDPOINT"}).then(Kt);if(c==="bind")return cn(i,t.slice(0,-1));const[u,d]=Xn(a);return ne(i,{type:"APPLY",path:t.map(h=>h.toString()),argumentList:u},d).then(Kt)},construct(r,o){He(n);const[a,c]=Xn(o);return ne(i,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:a},c).then(Kt)}});return Ko(s,i),s}function Jo(i){return Array.prototype.concat.apply([],i)}function Xn(i){const t=i.map(di);return[t.map(e=>e[0]),Jo(t.map(e=>e[1]))]}const Ls=new WeakMap;function Zo(i,t){return Ls.set(i,t),i}function Xo(i){return Object.assign(i,{[Es]:!0})}function di(i){for(const[t,e]of Fs)if(e.canHandle(i)){const[n,s]=e.serialize(i);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:i},Ls.get(i)||[]]}function Kt(i){switch(i.type){case"HANDLER":return Fs.get(i.name).deserialize(i.value);case"RAW":return i.value}}function ne(i,t,e){return new Promise(n=>{const s=ta();i.addEventListener("message",function r(o){!o.data||!o.data.id||o.data.id!==s||(i.removeEventListener("message",r),n(o.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:s},t),e)})}function ta(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function B(i,t,e,n){function s(r){return r instanceof e?r:new e(function(o){o(r)})}return new(e||(e=Promise))(function(r,o){function a(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?r(d.value):s(d.value).then(a,c)}u((n=n.apply(i,t||[])).next())})}function ts(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function A(i){return this instanceof A?(this.v=i,this):new A(i)}function Bt(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(i,t||[]),s,r=[];return s={},a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(T){return function(H){return Promise.resolve(H).then(T,h)}}function a(T,H){n[T]&&(s[T]=function(ee){return new Promise(function(qi,Pt){r.push([T,ee,qi,Pt])>1||c(T,ee)})},H&&(s[T]=H(s[T])))}function c(T,H){try{u(n[T](H))}catch(ee){F(r[0][3],ee)}}function u(T){T.value instanceof A?Promise.resolve(T.value.v).then(d,h):F(r[0][2],T)}function d(T){c("next",T)}function h(T){c("throw",T)}function F(T,H){T(H),r.shift(),r.length&&c(r[0][0],r[0][1])}}function Ze(i){var t,e;return t={},n("next"),n("throw",function(s){throw s}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(s,r){t[s]=i[s]?function(o){return(e=!e)?{value:A(i[s](o)),done:!1}:r?r(o):o}:r}}function Jt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof ts=="function"?ts(i):i[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=i[r]&&function(o){return new Promise(function(a,c){o=i[r](o),s(a,c,o.done,o.value)})}}function s(r,o,a,c){Promise.resolve(c).then(function(u){r({value:u,done:a})},o)}}const ea=new TextDecoder("utf-8"),ln=i=>ea.decode(i),ia=new TextEncoder,Bn=i=>ia.encode(i),na=i=>typeof i=="number",Us=i=>typeof i=="boolean",Y=i=>typeof i=="function",nt=i=>i!=null&&Object(i)===i,Zt=i=>nt(i)&&Y(i.then),Ve=i=>nt(i)&&Y(i[Symbol.iterator]),Be=i=>nt(i)&&Y(i[Symbol.asyncIterator]),un=i=>nt(i)&&nt(i.schema),Ms=i=>nt(i)&&"done"in i&&"value"in i,ks=i=>nt(i)&&Y(i.stat)&&na(i.fd),Cs=i=>nt(i)&&An(i.body),$i=i=>"_getDOMStream"in i&&"_getNodeStream"in i,sa=i=>nt(i)&&Y(i.abort)&&Y(i.getWriter)&&!$i(i),An=i=>nt(i)&&Y(i.cancel)&&Y(i.getReader)&&!$i(i),ra=i=>nt(i)&&Y(i.end)&&Y(i.write)&&Us(i.writable)&&!$i(i),Ps=i=>nt(i)&&Y(i.read)&&Y(i.pipe)&&Us(i.readable)&&!$i(i),oa=i=>nt(i)&&Y(i.clear)&&Y(i.bytes)&&Y(i.position)&&Y(i.setPosition)&&Y(i.capacity)&&Y(i.getBufferIdentifier)&&Y(i.createLong),Tn=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function aa(i){const t=i[0]?[i[0]]:[];let e,n,s,r;for(let o,a,c=0,u=0,d=i.length;++cd+h.byteLength,0);let s,r,o,a=0,c=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,n);for(const d=e.length;++cP(Int32Array,i),is=i=>P(BigInt64Array,i),D=i=>P(Uint8Array,i),dn=i=>(i.next(),i);function*ca(i,t){const e=function*(s){yield s},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Tn?e(t):Ve(t)?t:e(t);return yield*dn(function*(s){let r=null;do r=s.next(yield P(i,r));while(!r.done)}(n[Symbol.iterator]())),new i}const la=i=>ca(Uint8Array,i);function xs(i,t){return Bt(this,arguments,function*(){if(Zt(t))return yield A(yield A(yield*Ze(Jt(xs(i,yield A(t))))));const n=function(o){return Bt(this,arguments,function*(){yield yield A(yield A(o))})},s=function(o){return Bt(this,arguments,function*(){yield A(yield*Ze(Jt(dn(function*(a){let c=null;do c=a.next(yield c==null?void 0:c.value);while(!c.done)}(o[Symbol.iterator]())))))})},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Tn?n(t):Ve(t)?s(t):Be(t)?t:n(t);return yield A(yield*Ze(Jt(dn(function(o){return Bt(this,arguments,function*(){let a=null;do a=yield A(o.next(yield yield A(P(i,a))));while(!a.done)})}(r[Symbol.asyncIterator]()))))),yield A(new i)})}const ua=i=>xs(Uint8Array,i);function js(i,t,e){if(i!==0){e=e.slice(0,t);for(let n=-1,s=e.length;++n0)do if(i[e]!==t[e])return!1;while(++e(i.next(),i);function*ha(i){let t,e=!1,n=[],s,r,o,a=0;function c(){return r==="peek"?Tt(n,o)[0]:([s,n,a]=Tt(n,o),s)}({cmd:r,size:o}=(yield null)||{cmd:"read",size:0});const u=la(i)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?u.next():u.next(o-a),!t&&s.byteLength>0&&(n.push(s),a+=s.byteLength),t||o<=a)do({cmd:r,size:o}=yield c());while(o0&&(s.push(r),c+=r.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield A(u()));while(a0&&(s.push(D(r)),c+=r.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield A(u()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return B(this,void 0,void 0,function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return B(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=D(e)),e})}}const Qi=(i,t)=>{const e=s=>n([t,s]);let n;return[t,e,new Promise(s=>(n=s)&&i.once(t,e))]};function ma(i){return Bt(this,arguments,function*(){const e=[];let n="error",s=!1,r=null,o,a,c=0,u=[],d;function h(){return o==="peek"?Tt(u,a)[0]:([d,u,c]=Tt(u,a),d)}if({cmd:o,size:a}=(yield yield A(null))||{cmd:"read",size:0},i.isTTY)return yield yield A(new Uint8Array(0)),yield A(null);try{e[0]=Qi(i,"end"),e[1]=Qi(i,"error");do{if(e[2]=Qi(i,"readable"),[n,r]=yield A(Promise.race(e.map(T=>T[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(a-c)?(d=D(i.read(a-c)),d.byteLength0&&(u.push(d),c+=d.byteLength)),s||a<=c)do({cmd:o,size:a}=yield yield A(h()));while(a{for(const[Pt,xo]of T)i.off(Pt,xo);try{const Pt=i.destroy;Pt&&Pt.call(i,H),H=void 0}catch(Pt){H=Pt||H}finally{H!=null?qi(H):ee()}})}})}var W;(function(i){i[i.V1=0]="V1",i[i.V2=1]="V2",i[i.V3=2]="V3",i[i.V4=3]="V4",i[i.V5=4]="V5"})(W||(W={}));var K;(function(i){i[i.Sparse=0]="Sparse",i[i.Dense=1]="Dense"})(K||(K={}));var q;(function(i){i[i.HALF=0]="HALF",i[i.SINGLE=1]="SINGLE",i[i.DOUBLE=2]="DOUBLE"})(q||(q={}));var ft;(function(i){i[i.DAY=0]="DAY",i[i.MILLISECOND=1]="MILLISECOND"})(ft||(ft={}));var g;(function(i){i[i.SECOND=0]="SECOND",i[i.MILLISECOND=1]="MILLISECOND",i[i.MICROSECOND=2]="MICROSECOND",i[i.NANOSECOND=3]="NANOSECOND"})(g||(g={}));var Ot;(function(i){i[i.YEAR_MONTH=0]="YEAR_MONTH",i[i.DAY_TIME=1]="DAY_TIME",i[i.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Ot||(Ot={}));const Ji=2,vt=4,Lt=4,M=4,zt=new Int32Array(2),ns=new Float32Array(zt.buffer),ss=new Float64Array(zt.buffer),Ke=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var hn;(function(i){i[i.UTF8_BYTES=1]="UTF8_BYTES",i[i.UTF16_STRING=2]="UTF16_STRING"})(hn||(hn={}));let _e=class zs{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new zs(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){ns[0]=e,this.writeInt32(t,zt[0])}writeFloat64(t,e){ss[0]=e,this.writeInt32(t,zt[Ke?0:1]),this.writeInt32(t+4,zt[Ke?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);const n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space=0&&this.vtable[e]==0;e--);const n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const s=2;this.addInt16(t-this.object_start);const r=(n+s)*Ji;this.addInt16(r);let o=0;const a=this.space;t:for(e=0;e=0;o--)this.writeInt8(r.charCodeAt(o))}this.prep(this.minalign,vt+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,s=n-this.bb.readInt32(n);if(!(e=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return et.startUnion(t),et.addMode(t,e),et.addTypeIds(t,n),et.endUnion(t)}}let ds=class Le{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+M),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Le.startUtf8(t),Le.endUtf8(t)}};var j;(function(i){i[i.NONE=0]="NONE",i[i.Null=1]="Null",i[i.Int=2]="Int",i[i.FloatingPoint=3]="FloatingPoint",i[i.Binary=4]="Binary",i[i.Utf8=5]="Utf8",i[i.Bool=6]="Bool",i[i.Decimal=7]="Decimal",i[i.Date=8]="Date",i[i.Time=9]="Time",i[i.Timestamp=10]="Timestamp",i[i.Interval=11]="Interval",i[i.List=12]="List",i[i.Struct_=13]="Struct_",i[i.Union=14]="Union",i[i.FixedSizeBinary=15]="FixedSizeBinary",i[i.FixedSizeList=16]="FixedSizeList",i[i.Map=17]="Map",i[i.Duration=18]="Duration",i[i.LargeBinary=19]="LargeBinary",i[i.LargeUtf8=20]="LargeUtf8",i[i.LargeList=21]="LargeList",i[i.RunEndEncoded=22]="RunEndEncoded"})(j||(j={}));let ct=class si{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new si).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+M),(e||new si).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):j.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new Ut).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new si).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,j.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}},_t=class Dt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+M),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):we.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new ct).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,we.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,s,r){return Dt.startSchema(t),Dt.addEndianness(t,e),Dt.addFields(t,n),Dt.addCustomMetadata(t,s),Dt.addFeatures(t,r),Dt.endSchema(t)}};var R;(function(i){i[i.NONE=0]="NONE",i[i.Schema=1]="Schema",i[i.DictionaryBatch=2]="DictionaryBatch",i[i.RecordBatch=3]="RecordBatch",i[i.Tensor=4]="Tensor",i[i.SparseTensor=5]="SparseTensor"})(R||(R={}));var l;(function(i){i[i.NONE=0]="NONE",i[i.Null=1]="Null",i[i.Int=2]="Int",i[i.Float=3]="Float",i[i.Binary=4]="Binary",i[i.Utf8=5]="Utf8",i[i.Bool=6]="Bool",i[i.Decimal=7]="Decimal",i[i.Date=8]="Date",i[i.Time=9]="Time",i[i.Timestamp=10]="Timestamp",i[i.Interval=11]="Interval",i[i.List=12]="List",i[i.Struct=13]="Struct",i[i.Union=14]="Union",i[i.FixedSizeBinary=15]="FixedSizeBinary",i[i.FixedSizeList=16]="FixedSizeList",i[i.Map=17]="Map",i[i.Duration=18]="Duration",i[i.LargeBinary=19]="LargeBinary",i[i.LargeUtf8=20]="LargeUtf8",i[i.Dictionary=-1]="Dictionary",i[i.Int8=-2]="Int8",i[i.Int16=-3]="Int16",i[i.Int32=-4]="Int32",i[i.Int64=-5]="Int64",i[i.Uint8=-6]="Uint8",i[i.Uint16=-7]="Uint16",i[i.Uint32=-8]="Uint32",i[i.Uint64=-9]="Uint64",i[i.Float16=-10]="Float16",i[i.Float32=-11]="Float32",i[i.Float64=-12]="Float64",i[i.DateDay=-13]="DateDay",i[i.DateMillisecond=-14]="DateMillisecond",i[i.TimestampSecond=-15]="TimestampSecond",i[i.TimestampMillisecond=-16]="TimestampMillisecond",i[i.TimestampMicrosecond=-17]="TimestampMicrosecond",i[i.TimestampNanosecond=-18]="TimestampNanosecond",i[i.TimeSecond=-19]="TimeSecond",i[i.TimeMillisecond=-20]="TimeMillisecond",i[i.TimeMicrosecond=-21]="TimeMicrosecond",i[i.TimeNanosecond=-22]="TimeNanosecond",i[i.DenseUnion=-23]="DenseUnion",i[i.SparseUnion=-24]="SparseUnion",i[i.IntervalDayTime=-25]="IntervalDayTime",i[i.IntervalYearMonth=-26]="IntervalYearMonth",i[i.DurationSecond=-27]="DurationSecond",i[i.DurationMillisecond=-28]="DurationMillisecond",i[i.DurationMicrosecond=-29]="DurationMicrosecond",i[i.DurationNanosecond=-30]="DurationNanosecond"})(l||(l={}));var Nt;(function(i){i[i.OFFSET=0]="OFFSET",i[i.DATA=1]="DATA",i[i.VALIDITY=2]="VALIDITY",i[i.TYPE=3]="TYPE"})(Nt||(Nt={}));const ba=void 0;function ke(i){if(i===null)return"null";if(i===ba)return"undefined";switch(typeof i){case"number":return`${i}`;case"bigint":return`${i}`;case"string":return`"${i}"`}return typeof i[Symbol.toPrimitive]=="function"?i[Symbol.toPrimitive]("string"):ArrayBuffer.isView(i)?i instanceof BigInt64Array||i instanceof BigUint64Array?`[${[...i].map(t=>ke(t))}]`:`[${i}]`:ArrayBuffer.isView(i)?`[${i}]`:JSON.stringify(i,(t,e)=>typeof e=="bigint"?`${e}`:e)}function x(i){if(typeof i=="bigint"&&(iNumber.MAX_SAFE_INTEGER))throw new TypeError(`${i} is not safe to convert to a number.`);return Number(i)}function Gs(i,t){return x(i/t)+x(i%t)/x(t)}const ga=Symbol.for("isArrowBigNum");function bt(i,...t){return t.length===0?Object.setPrototypeOf(P(this.TypedArray,i),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(i,...t),this.constructor.prototype)}bt.prototype[ga]=!0;bt.prototype.toJSON=function(){return`"${Pe(this)}"`};bt.prototype.valueOf=function(i){return Hs(this,i)};bt.prototype.toString=function(){return Pe(this)};bt.prototype[Symbol.toPrimitive]=function(i="default"){switch(i){case"number":return Hs(this);case"string":return Pe(this);case"default":return va(this)}return Pe(this)};function ye(...i){return bt.apply(this,i)}function me(...i){return bt.apply(this,i)}function Ce(...i){return bt.apply(this,i)}Object.setPrototypeOf(ye.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(me.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ce.prototype,Object.create(Uint32Array.prototype));Object.assign(ye.prototype,bt.prototype,{constructor:ye,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(me.prototype,bt.prototype,{constructor:me,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ce.prototype,bt.prototype,{constructor:Ce,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const _a=BigInt(4294967296)*BigInt(4294967296),wa=_a-BigInt(1);function Hs(i,t){const{buffer:e,byteOffset:n,byteLength:s,signed:r}=i,o=new BigUint64Array(e,n,s/8),a=r&&o.at(-1)&BigInt(1)<=0)return Zi(i);t=t.slice();let n=1;for(let r=0;r(i.children=null,i.ArrayType=Array,i.OffsetArrayType=Int32Array,i[Symbol.toStringTag]="DataType"))(f.prototype);class $t extends f{constructor(){super(l.Null)}toString(){return"Null"}}Ks=Symbol.toStringTag;$t[Ks]=(i=>i[Symbol.toStringTag]="Null")($t.prototype);class Xt extends f{constructor(t,e){super(l.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Qs=Symbol.toStringTag;Xt[Qs]=(i=>(i.isSigned=null,i.bitWidth=null,i[Symbol.toStringTag]="Int"))(Xt.prototype);class xe extends Xt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(xe.prototype,"ArrayType",{value:Int32Array});class yi extends f{constructor(t){super(l.Float),this.precision=t}get ArrayType(){switch(this.precision){case q.HALF:return Uint16Array;case q.SINGLE:return Float32Array;case q.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Js=Symbol.toStringTag;yi[Js]=(i=>(i.precision=null,i[Symbol.toStringTag]="Float"))(yi.prototype);class mi extends f{constructor(){super(l.Binary)}toString(){return"Binary"}}Zs=Symbol.toStringTag;mi[Zs]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Binary"))(mi.prototype);class bi extends f{constructor(){super(l.LargeBinary)}toString(){return"LargeBinary"}}Xs=Symbol.toStringTag;bi[Xs]=(i=>(i.ArrayType=Uint8Array,i.OffsetArrayType=BigInt64Array,i[Symbol.toStringTag]="LargeBinary"))(bi.prototype);class gi extends f{constructor(){super(l.Utf8)}toString(){return"Utf8"}}tr=Symbol.toStringTag;gi[tr]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Utf8"))(gi.prototype);class _i extends f{constructor(){super(l.LargeUtf8)}toString(){return"LargeUtf8"}}er=Symbol.toStringTag;_i[er]=(i=>(i.ArrayType=Uint8Array,i.OffsetArrayType=BigInt64Array,i[Symbol.toStringTag]="LargeUtf8"))(_i.prototype);class wi extends f{constructor(){super(l.Bool)}toString(){return"Bool"}}ir=Symbol.toStringTag;wi[ir]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Bool"))(wi.prototype);class vi extends f{constructor(t,e,n=128){super(l.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}nr=Symbol.toStringTag;vi[nr]=(i=>(i.scale=null,i.precision=null,i.ArrayType=Uint32Array,i[Symbol.toStringTag]="Decimal"))(vi.prototype);class Ii extends f{constructor(t){super(l.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ft[this.unit]}>`}get ArrayType(){return this.unit===ft.DAY?Int32Array:BigInt64Array}}sr=Symbol.toStringTag;Ii[sr]=(i=>(i.unit=null,i[Symbol.toStringTag]="Date"))(Ii.prototype);class Si extends f{constructor(t,e){super(l.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${g[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}rr=Symbol.toStringTag;Si[rr]=(i=>(i.unit=null,i.bitWidth=null,i[Symbol.toStringTag]="Time"))(Si.prototype);class Bi extends f{constructor(t,e){super(l.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${g[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}or=Symbol.toStringTag;Bi[or]=(i=>(i.unit=null,i.timezone=null,i.ArrayType=BigInt64Array,i[Symbol.toStringTag]="Timestamp"))(Bi.prototype);class Ai extends f{constructor(t){super(l.Interval),this.unit=t}toString(){return`Interval<${Ot[this.unit]}>`}}ar=Symbol.toStringTag;Ai[ar]=(i=>(i.unit=null,i.ArrayType=Int32Array,i[Symbol.toStringTag]="Interval"))(Ai.prototype);class Ti extends f{constructor(t){super(l.Duration),this.unit=t}toString(){return`Duration<${g[this.unit]}>`}}cr=Symbol.toStringTag;Ti[cr]=(i=>(i.unit=null,i.ArrayType=BigInt64Array,i[Symbol.toStringTag]="Duration"))(Ti.prototype);class Oi extends f{constructor(t){super(l.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}lr=Symbol.toStringTag;Oi[lr]=(i=>(i.children=null,i[Symbol.toStringTag]="List"))(Oi.prototype);class J extends f{constructor(t){super(l.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}ur=Symbol.toStringTag;J[ur]=(i=>(i.children=null,i[Symbol.toStringTag]="Struct"))(J.prototype);class Ei extends f{constructor(t,e,n){super(l.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((s,r,o)=>(s[r]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}dr=Symbol.toStringTag;Ei[dr]=(i=>(i.mode=null,i.typeIds=null,i.children=null,i.typeIdToChildIndex=null,i.ArrayType=Int8Array,i[Symbol.toStringTag]="Union"))(Ei.prototype);class Di extends f{constructor(t){super(l.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}hr=Symbol.toStringTag;Di[hr]=(i=>(i.byteWidth=null,i.ArrayType=Uint8Array,i[Symbol.toStringTag]="FixedSizeBinary"))(Di.prototype);class Fi extends f{constructor(t,e){super(l.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}fr=Symbol.toStringTag;Fi[fr]=(i=>(i.children=null,i.listSize=null,i[Symbol.toStringTag]="FixedSizeList"))(Fi.prototype);class Ni extends f{constructor(t,e=!1){var n,s,r;if(super(l.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){const o=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");const a=(r=t==null?void 0:t.type)===null||r===void 0?void 0:r.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}pr=Symbol.toStringTag;Ni[pr]=(i=>(i.children=null,i.keysSorted=null,i[Symbol.toStringTag]="Map_"))(Ni.prototype);const Ia=(i=>()=>++i)(-1);class ve extends f{constructor(t,e,n,s){super(l.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=s||!1,this.id=n==null?Ia():x(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}yr=Symbol.toStringTag;ve[yr]=(i=>(i.id=null,i.indices=null,i.isOrdered=null,i.dictionary=null,i[Symbol.toStringTag]="Dictionary"))(ve.prototype);function Rt(i){const t=i;switch(i.typeId){case l.Decimal:return i.bitWidth/32;case l.Interval:return 1+t.unit;case l.FixedSizeList:return t.listSize;case l.FixedSizeBinary:return t.byteWidth;default:return 1}}class O{visitMany(t,...e){return t.map((n,s)=>this.visit(n,...e.map(r=>r[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Sa(this,t,e)}getVisitFnByTypeId(t,e=!0){return de(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Sa(i,t,e=!0){return typeof t=="number"?de(i,t,e):typeof t=="string"&&t in l?de(i,l[t],e):t&&t instanceof f?de(i,hs(t),e):t!=null&&t.type&&t.type instanceof f?de(i,hs(t.type),e):de(i,l.NONE,e)}function de(i,t,e=!0){let n=null;switch(t){case l.Null:n=i.visitNull;break;case l.Bool:n=i.visitBool;break;case l.Int:n=i.visitInt;break;case l.Int8:n=i.visitInt8||i.visitInt;break;case l.Int16:n=i.visitInt16||i.visitInt;break;case l.Int32:n=i.visitInt32||i.visitInt;break;case l.Int64:n=i.visitInt64||i.visitInt;break;case l.Uint8:n=i.visitUint8||i.visitInt;break;case l.Uint16:n=i.visitUint16||i.visitInt;break;case l.Uint32:n=i.visitUint32||i.visitInt;break;case l.Uint64:n=i.visitUint64||i.visitInt;break;case l.Float:n=i.visitFloat;break;case l.Float16:n=i.visitFloat16||i.visitFloat;break;case l.Float32:n=i.visitFloat32||i.visitFloat;break;case l.Float64:n=i.visitFloat64||i.visitFloat;break;case l.Utf8:n=i.visitUtf8;break;case l.LargeUtf8:n=i.visitLargeUtf8;break;case l.Binary:n=i.visitBinary;break;case l.LargeBinary:n=i.visitLargeBinary;break;case l.FixedSizeBinary:n=i.visitFixedSizeBinary;break;case l.Date:n=i.visitDate;break;case l.DateDay:n=i.visitDateDay||i.visitDate;break;case l.DateMillisecond:n=i.visitDateMillisecond||i.visitDate;break;case l.Timestamp:n=i.visitTimestamp;break;case l.TimestampSecond:n=i.visitTimestampSecond||i.visitTimestamp;break;case l.TimestampMillisecond:n=i.visitTimestampMillisecond||i.visitTimestamp;break;case l.TimestampMicrosecond:n=i.visitTimestampMicrosecond||i.visitTimestamp;break;case l.TimestampNanosecond:n=i.visitTimestampNanosecond||i.visitTimestamp;break;case l.Time:n=i.visitTime;break;case l.TimeSecond:n=i.visitTimeSecond||i.visitTime;break;case l.TimeMillisecond:n=i.visitTimeMillisecond||i.visitTime;break;case l.TimeMicrosecond:n=i.visitTimeMicrosecond||i.visitTime;break;case l.TimeNanosecond:n=i.visitTimeNanosecond||i.visitTime;break;case l.Decimal:n=i.visitDecimal;break;case l.List:n=i.visitList;break;case l.Struct:n=i.visitStruct;break;case l.Union:n=i.visitUnion;break;case l.DenseUnion:n=i.visitDenseUnion||i.visitUnion;break;case l.SparseUnion:n=i.visitSparseUnion||i.visitUnion;break;case l.Dictionary:n=i.visitDictionary;break;case l.Interval:n=i.visitInterval;break;case l.IntervalDayTime:n=i.visitIntervalDayTime||i.visitInterval;break;case l.IntervalYearMonth:n=i.visitIntervalYearMonth||i.visitInterval;break;case l.Duration:n=i.visitDuration;break;case l.DurationSecond:n=i.visitDurationSecond||i.visitDuration;break;case l.DurationMillisecond:n=i.visitDurationMillisecond||i.visitDuration;break;case l.DurationMicrosecond:n=i.visitDurationMicrosecond||i.visitDuration;break;case l.DurationNanosecond:n=i.visitDurationNanosecond||i.visitDuration;break;case l.FixedSizeList:n=i.visitFixedSizeList;break;case l.Map:n=i.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${l[t]}'`)}function hs(i){switch(i.typeId){case l.Null:return l.Null;case l.Int:{const{bitWidth:t,isSigned:e}=i;switch(t){case 8:return e?l.Int8:l.Uint8;case 16:return e?l.Int16:l.Uint16;case 32:return e?l.Int32:l.Uint32;case 64:return e?l.Int64:l.Uint64}return l.Int}case l.Float:switch(i.precision){case q.HALF:return l.Float16;case q.SINGLE:return l.Float32;case q.DOUBLE:return l.Float64}return l.Float;case l.Binary:return l.Binary;case l.LargeBinary:return l.LargeBinary;case l.Utf8:return l.Utf8;case l.LargeUtf8:return l.LargeUtf8;case l.Bool:return l.Bool;case l.Decimal:return l.Decimal;case l.Time:switch(i.unit){case g.SECOND:return l.TimeSecond;case g.MILLISECOND:return l.TimeMillisecond;case g.MICROSECOND:return l.TimeMicrosecond;case g.NANOSECOND:return l.TimeNanosecond}return l.Time;case l.Timestamp:switch(i.unit){case g.SECOND:return l.TimestampSecond;case g.MILLISECOND:return l.TimestampMillisecond;case g.MICROSECOND:return l.TimestampMicrosecond;case g.NANOSECOND:return l.TimestampNanosecond}return l.Timestamp;case l.Date:switch(i.unit){case ft.DAY:return l.DateDay;case ft.MILLISECOND:return l.DateMillisecond}return l.Date;case l.Interval:switch(i.unit){case Ot.DAY_TIME:return l.IntervalDayTime;case Ot.YEAR_MONTH:return l.IntervalYearMonth}return l.Interval;case l.Duration:switch(i.unit){case g.SECOND:return l.DurationSecond;case g.MILLISECOND:return l.DurationMillisecond;case g.MICROSECOND:return l.DurationMicrosecond;case g.NANOSECOND:return l.DurationNanosecond}return l.Duration;case l.Map:return l.Map;case l.List:return l.List;case l.Struct:return l.Struct;case l.Union:switch(i.mode){case K.Dense:return l.DenseUnion;case K.Sparse:return l.SparseUnion}return l.Union;case l.FixedSizeBinary:return l.FixedSizeBinary;case l.FixedSizeList:return l.FixedSizeList;case l.Dictionary:return l.Dictionary}throw new Error(`Unrecognized type '${l[i.typeId]}'`)}O.prototype.visitInt8=null;O.prototype.visitInt16=null;O.prototype.visitInt32=null;O.prototype.visitInt64=null;O.prototype.visitUint8=null;O.prototype.visitUint16=null;O.prototype.visitUint32=null;O.prototype.visitUint64=null;O.prototype.visitFloat16=null;O.prototype.visitFloat32=null;O.prototype.visitFloat64=null;O.prototype.visitDateDay=null;O.prototype.visitDateMillisecond=null;O.prototype.visitTimestampSecond=null;O.prototype.visitTimestampMillisecond=null;O.prototype.visitTimestampMicrosecond=null;O.prototype.visitTimestampNanosecond=null;O.prototype.visitTimeSecond=null;O.prototype.visitTimeMillisecond=null;O.prototype.visitTimeMicrosecond=null;O.prototype.visitTimeNanosecond=null;O.prototype.visitDenseUnion=null;O.prototype.visitSparseUnion=null;O.prototype.visitIntervalDayTime=null;O.prototype.visitIntervalYearMonth=null;O.prototype.visitDuration=null;O.prototype.visitDurationSecond=null;O.prototype.visitDurationMillisecond=null;O.prototype.visitDurationMicrosecond=null;O.prototype.visitDurationNanosecond=null;const mr=new Float64Array(1),ie=new Uint32Array(mr.buffer);function br(i){const t=(i&31744)>>10,e=(i&1023)/1024,n=Math.pow(-1,(i&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function Ba(i){if(i!==i)return 32256;mr[0]=i;const t=(ie[1]&2147483648)>>16&65535;let e=ie[1]&2146435072,n=0;return e>=1089470464?ie[0]>0?e=31744:(e=(e&2080374784)>>16,n=(ie[1]&1048575)>>10):e<=1056964608?(n=1048576+(ie[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(ie[1]&1048575)+512>>10),t|e|n&65535}class _ extends O{}function I(i){return(t,e,n)=>{if(t.setValid(e,n!=null))return i(t,e,n)}}const Aa=(i,t,e)=>{i[t]=Math.floor(e/864e5)},gr=(i,t,e,n)=>{if(e+1{const s=i+e;n?t[s>>3]|=1<>3]&=~(1<{i[t]=e},En=({values:i},t,e)=>{i[t]=e},_r=({values:i},t,e)=>{i[t]=Ba(e)},Oa=(i,t,e)=>{switch(i.type.precision){case q.HALF:return _r(i,t,e);case q.SINGLE:case q.DOUBLE:return En(i,t,e)}},wr=({values:i},t,e)=>{Aa(i,t,e.valueOf())},vr=({values:i},t,e)=>{i[t]=BigInt(e)},Ea=({stride:i,values:t},e,n)=>{t.set(n.subarray(0,i),i*e)},Ir=({values:i,valueOffsets:t},e,n)=>gr(i,t,e,n),Sr=({values:i,valueOffsets:t},e,n)=>gr(i,t,e,Bn(n)),Da=(i,t,e)=>{i.type.unit===ft.DAY?wr(i,t,e):vr(i,t,e)},Br=({values:i},t,e)=>{i[t]=BigInt(e/1e3)},Ar=({values:i},t,e)=>{i[t]=BigInt(e)},Tr=({values:i},t,e)=>{i[t]=BigInt(e*1e3)},Or=({values:i},t,e)=>{i[t]=BigInt(e*1e6)},Fa=(i,t,e)=>{switch(i.type.unit){case g.SECOND:return Br(i,t,e);case g.MILLISECOND:return Ar(i,t,e);case g.MICROSECOND:return Tr(i,t,e);case g.NANOSECOND:return Or(i,t,e)}},Er=({values:i},t,e)=>{i[t]=e},Dr=({values:i},t,e)=>{i[t]=e},Fr=({values:i},t,e)=>{i[t]=e},Nr=({values:i},t,e)=>{i[t]=e},Na=(i,t,e)=>{switch(i.type.unit){case g.SECOND:return Er(i,t,e);case g.MILLISECOND:return Dr(i,t,e);case g.MICROSECOND:return Fr(i,t,e);case g.NANOSECOND:return Nr(i,t,e)}},Ra=({values:i,stride:t},e,n)=>{i.set(n.subarray(0,t),t*e)},La=(i,t,e)=>{const n=i.children[0],s=i.valueOffsets,r=pt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=s[t],c=s[t+1];a{const n=i.children[0],{valueOffsets:s}=i,r=pt.getVisitFn(n);let{[t]:o,[t+1]:a}=s;const c=e instanceof Map?e.entries():Object.entries(e);for(const u of c)if(r(n,o,u),++o>=a)break},Ma=(i,t)=>(e,n,s,r)=>n&&e(n,i,t[r]),ka=(i,t)=>(e,n,s,r)=>n&&e(n,i,t.get(r)),Ca=(i,t)=>(e,n,s,r)=>n&&e(n,i,t.get(s.name)),Pa=(i,t)=>(e,n,s,r)=>n&&e(n,i,t[s.name]),xa=(i,t,e)=>{const n=i.type.children.map(r=>pt.getVisitFn(r.type)),s=e instanceof Map?Ca(t,e):e instanceof L?ka(t,e):Array.isArray(e)?Ma(t,e):Pa(t,e);i.type.children.forEach((r,o)=>s(n[o],i.children[o],r,o))},ja=(i,t,e)=>{i.type.mode===K.Dense?Rr(i,t,e):Lr(i,t,e)},Rr=(i,t,e)=>{const n=i.type.typeIdToChildIndex[i.typeIds[t]],s=i.children[n];pt.visit(s,i.valueOffsets[t],e)},Lr=(i,t,e)=>{const n=i.type.typeIdToChildIndex[i.typeIds[t]],s=i.children[n];pt.visit(s,t,e)},za=(i,t,e)=>{var n;(n=i.dictionary)===null||n===void 0||n.set(i.values[t],e)},Va=(i,t,e)=>{i.type.unit===Ot.DAY_TIME?Ur(i,t,e):Mr(i,t,e)},Ur=({values:i},t,e)=>{i.set(e.subarray(0,2),2*t)},Mr=({values:i},t,e)=>{i[t]=e[0]*12+e[1]%12},kr=({values:i},t,e)=>{i[t]=e},Cr=({values:i},t,e)=>{i[t]=e},Pr=({values:i},t,e)=>{i[t]=e},xr=({values:i},t,e)=>{i[t]=e},$a=(i,t,e)=>{switch(i.type.unit){case g.SECOND:return kr(i,t,e);case g.MILLISECOND:return Cr(i,t,e);case g.MICROSECOND:return Pr(i,t,e);case g.NANOSECOND:return xr(i,t,e)}},Wa=(i,t,e)=>{const{stride:n}=i,s=i.children[0],r=pt.getVisitFn(s);if(Array.isArray(e))for(let o=-1,a=t*n;++o`${ke(t)}: ${ke(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ya(this[yt],this[be])}}class Ya{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return te.name)}has(t,e){return t[yt].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[yt].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[yt].type.children.findIndex(s=>s.name===e);if(n!==-1){const s=st.visit(t[yt].children[n],t[be]);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[yt].type.children.findIndex(r=>r.name===e);return s!==-1?(pt.visit(t[yt].children[s],t[be],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}class p extends O{}function w(i){return(t,e)=>t.getValid(e)?i(t,e):null}const Ha=(i,t)=>864e5*i[t],qa=(i,t)=>null,jr=(i,t,e)=>{if(e+1>=t.length)return null;const n=x(t[e]),s=x(t[e+1]);return i.subarray(n,s)},Ka=({offset:i,values:t},e)=>{const n=i+e;return(t[n>>3]&1<Ha(i,t),Vr=({values:i},t)=>x(i[t]),Ht=({stride:i,values:t},e)=>t[i*e],Qa=({stride:i,values:t},e)=>br(t[i*e]),$r=({values:i},t)=>i[t],Ja=({stride:i,values:t},e)=>t.subarray(i*e,i*(e+1)),Wr=({values:i,valueOffsets:t},e)=>jr(i,t,e),Yr=({values:i,valueOffsets:t},e)=>{const n=jr(i,t,e);return n!==null?ln(n):null},Za=({values:i},t)=>i[t],Xa=({type:i,values:t},e)=>i.precision!==q.HALF?t[e]:br(t[e]),tc=(i,t)=>i.type.unit===ft.DAY?zr(i,t):Vr(i,t),Gr=({values:i},t)=>1e3*x(i[t]),Hr=({values:i},t)=>x(i[t]),qr=({values:i},t)=>Gs(i[t],BigInt(1e3)),Kr=({values:i},t)=>Gs(i[t],BigInt(1e6)),ec=(i,t)=>{switch(i.type.unit){case g.SECOND:return Gr(i,t);case g.MILLISECOND:return Hr(i,t);case g.MICROSECOND:return qr(i,t);case g.NANOSECOND:return Kr(i,t)}},Qr=({values:i},t)=>i[t],Jr=({values:i},t)=>i[t],Zr=({values:i},t)=>i[t],Xr=({values:i},t)=>i[t],ic=(i,t)=>{switch(i.type.unit){case g.SECOND:return Qr(i,t);case g.MILLISECOND:return Jr(i,t);case g.MICROSECOND:return Zr(i,t);case g.NANOSECOND:return Xr(i,t)}},nc=({values:i,stride:t},e)=>On.decimal(i.subarray(t*e,t*(e+1))),sc=(i,t)=>{const{valueOffsets:e,stride:n,children:s}=i,{[t*n]:r,[t*n+1]:o}=e,c=s[0].slice(r,o-r);return new L([c])},rc=(i,t)=>{const{valueOffsets:e,children:n}=i,{[t]:s,[t+1]:r}=e,o=n[0];return new Fn(o.slice(s,r-s))},oc=(i,t)=>new Dn(i,t),ac=(i,t)=>i.type.mode===K.Dense?to(i,t):eo(i,t),to=(i,t)=>{const e=i.type.typeIdToChildIndex[i.typeIds[t]],n=i.children[e];return st.visit(n,i.valueOffsets[t])},eo=(i,t)=>{const e=i.type.typeIdToChildIndex[i.typeIds[t]],n=i.children[e];return st.visit(n,t)},cc=(i,t)=>{var e;return(e=i.dictionary)===null||e===void 0?void 0:e.get(i.values[t])},lc=(i,t)=>i.type.unit===Ot.DAY_TIME?io(i,t):no(i,t),io=({values:i},t)=>i.subarray(2*t,2*(t+1)),no=({values:i},t)=>{const e=i[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},so=({values:i},t)=>i[t],ro=({values:i},t)=>i[t],oo=({values:i},t)=>i[t],ao=({values:i},t)=>i[t],uc=(i,t)=>{switch(i.type.unit){case g.SECOND:return so(i,t);case g.MILLISECOND:return ro(i,t);case g.MICROSECOND:return oo(i,t);case g.NANOSECOND:return ao(i,t)}},dc=(i,t)=>{const{stride:e,children:n}=i,r=n[0].slice(t*e,e);return new L([r])};p.prototype.visitNull=w(qa);p.prototype.visitBool=w(Ka);p.prototype.visitInt=w(Za);p.prototype.visitInt8=w(Ht);p.prototype.visitInt16=w(Ht);p.prototype.visitInt32=w(Ht);p.prototype.visitInt64=w($r);p.prototype.visitUint8=w(Ht);p.prototype.visitUint16=w(Ht);p.prototype.visitUint32=w(Ht);p.prototype.visitUint64=w($r);p.prototype.visitFloat=w(Xa);p.prototype.visitFloat16=w(Qa);p.prototype.visitFloat32=w(Ht);p.prototype.visitFloat64=w(Ht);p.prototype.visitUtf8=w(Yr);p.prototype.visitLargeUtf8=w(Yr);p.prototype.visitBinary=w(Wr);p.prototype.visitLargeBinary=w(Wr);p.prototype.visitFixedSizeBinary=w(Ja);p.prototype.visitDate=w(tc);p.prototype.visitDateDay=w(zr);p.prototype.visitDateMillisecond=w(Vr);p.prototype.visitTimestamp=w(ec);p.prototype.visitTimestampSecond=w(Gr);p.prototype.visitTimestampMillisecond=w(Hr);p.prototype.visitTimestampMicrosecond=w(qr);p.prototype.visitTimestampNanosecond=w(Kr);p.prototype.visitTime=w(ic);p.prototype.visitTimeSecond=w(Qr);p.prototype.visitTimeMillisecond=w(Jr);p.prototype.visitTimeMicrosecond=w(Zr);p.prototype.visitTimeNanosecond=w(Xr);p.prototype.visitDecimal=w(nc);p.prototype.visitList=w(sc);p.prototype.visitStruct=w(oc);p.prototype.visitUnion=w(ac);p.prototype.visitDenseUnion=w(to);p.prototype.visitSparseUnion=w(eo);p.prototype.visitDictionary=w(cc);p.prototype.visitInterval=w(lc);p.prototype.visitIntervalDayTime=w(io);p.prototype.visitIntervalYearMonth=w(no);p.prototype.visitDuration=w(uc);p.prototype.visitDurationSecond=w(so);p.prototype.visitDurationMillisecond=w(ro);p.prototype.visitDurationMicrosecond=w(oo);p.prototype.visitDurationNanosecond=w(ao);p.prototype.visitFixedSizeList=w(dc);p.prototype.visitMap=w(rc);const st=new p,he=Symbol.for("keys"),ge=Symbol.for("vals"),fe=Symbol.for("kKeysAsStrings"),yn=Symbol.for("_kKeysAsStrings");class Fn{constructor(t){return this[he]=new L([t.children[0]]).memoize(),this[ge]=t.children[1],new Proxy(this,new fc)}get[fe](){return this[yn]||(this[yn]=Array.from(this[he].toArray(),String))}[Symbol.iterator](){return new hc(this[he],this[ge])}get size(){return this[he].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[he],e=this[ge],n={};for(let s=-1,r=t.length;++s`${ke(t)}: ${ke(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class hc{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),st.visit(this.vals,t)]})}}class fc{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[fe]}has(t,e){return t[fe].includes(e)}getOwnPropertyDescriptor(t,e){if(t[fe].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[fe].indexOf(e);if(n!==-1){const s=st.visit(Reflect.get(t,ge),n);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[fe].indexOf(e);return s!==-1?(pt.visit(Reflect.get(t,ge),s,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(Fn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[he]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ge]:{writable:!0,enumerable:!1,configurable:!1,value:null},[yn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let fs;function co(i,t,e,n){const{length:s=0}=i;let r=typeof t!="number"?0:t,o=typeof e!="number"?s:e;return r<0&&(r=(r%s+s)%s),o<0&&(o=(o%s+s)%s),os&&(o=s),n?n(i,r,o):[r,o]}const Nn=(i,t)=>i<0?t+i:i,ps=i=>i!==i;function Ae(i){if(typeof i!=="object"||i===null)return ps(i)?ps:e=>e===i;if(i instanceof Date){const e=i.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(i)?e=>e?da(i,e):!1:i instanceof Map?yc(i):Array.isArray(i)?pc(i):i instanceof L?mc(i):bc(i,!0)}function pc(i){const t=[];for(let e=-1,n=i.length;++e!1;const n=[];for(let s=-1,r=e.length;++s{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return gc(i,e);case Map:return ys(i,e,e.keys());case Fn:case Dn:case Object:case void 0:return ys(i,e,t||Object.keys(e))}return e instanceof L?_c(i,e):!1}}function gc(i,t){const e=i.length;if(t.length!==e)return!1;for(let n=-1;++n>n}function Ri(i,t,e){const n=e.byteLength+7&-8;if(i>0||e.byteLength>3):Li(new Rn(e,i,t,null,lo)).subarray(0,n)),s}return e}function Li(i){const t=[];let e=0,n=0,s=0;for(const o of i)o&&(s|=1<0)&&(t[e++]=s);const r=new Uint8Array(t.length+7&-8);return r.set(t),r}class Rn{constructor(t,e,n,s,r){this.bytes=t,this.length=n,this.context=s,this.get=r,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,s=t+(t%8===0?0:8-t%8);return mn(i,t,s)+mn(i,n,e)+vc(i,s>>3,n-s>>3)}function vc(i,t,e){let n=0,s=Math.trunc(t);const r=new DataView(i.buffer,i.byteOffset,i.byteLength),o=e===void 0?i.byteLength:s+e;for(;o-s>=4;)n+=Xi(r.getUint32(s)),s+=4;for(;o-s>=2;)n+=Xi(r.getUint16(s)),s+=2;for(;o-s>=1;)n+=Xi(r.getUint8(s)),s+=1;return n}function Xi(i){let t=Math.trunc(i);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Ic=-1;class k{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return f.isSparseUnion(t)?this.children.some(e=>e.nullable):f.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:s,typeIds:r}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),r&&(t+=r.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(f.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let t=this._nullCount,e;return t<=Ic&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-mn(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,s,r,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let c;r instanceof k?(this.stride=r.stride,this.values=r.values,this.typeIds=r.typeIds,this.nullBitmap=r.nullBitmap,this.valueOffsets=r.valueOffsets):(this.stride=Rt(t),r&&((c=r[0])&&(this.valueOffsets=c),(c=r[1])&&(this.values=c),(c=r[2])&&(this.nullBitmap=c),(c=r[3])&&(this.typeIds=c)))}getValid(t){const{type:e}=this;if(f.isUnion(e)){const n=e,s=this.children[n.typeIdToChildIndex[this.typeIds[t]]],r=n.mode===K.Dense?this.valueOffsets[t]:t;return s.getValid(r)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<>3;(!r||r.byteLength<=d)&&(r=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(Ri(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));const h=r[d];n=(h&u)!==0,r[d]=e?h|u:h&~u}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,s=this._nullCount,r=this,o=this.children){return new k(t,e,n,s,r,o,this.dictionary)}slice(t,e){const{stride:n,typeId:s,children:r}=this,o=+(this._nullCount===0)-1,a=s===16?n:1,c=this._sliceBuffers(t,e,n,s);return this.clone(this.type,this.offset+t,e,o,c,r.length===0||this.valueOffsets?r:this._sliceChildren(r,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===l.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);s[e>>3]=(1<0&&s.set(Ri(this.offset,e,this.nullBitmap),0);const r=this.buffers;return r[Nt.VALIDITY]=s,this.clone(this.type,0,t,n+(t-e),r)}_sliceBuffers(t,e,n,s){let r;const{buffers:o}=this;return(r=o[Nt.TYPE])&&(o[Nt.TYPE]=r.subarray(t,t+e)),(r=o[Nt.OFFSET])&&(o[Nt.OFFSET]=r.subarray(t,t+e+1))||(r=o[Nt.DATA])&&(o[Nt.DATA]=s===6?r:r.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(s=>s.slice(e,n))}}k.prototype.children=Object.freeze([]);class Me extends O{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:s=0}=t;return new k(e,n,s,s)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=Te(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitLargeUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=is(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=Te(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitLargeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=is(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:s}=t,r=D(t.nullBitmap),o=Te(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,void 0,r],[s])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,r=D(t.nullBitmap),{length:o=s.reduce((c,{length:u})=>Math.max(c,u),0),nullCount:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,void 0,r],s)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,r=P(e.ArrayType,t.typeIds),{["length"]:o=r.length,["nullCount"]:a=-1}=t;if(f.isSparseUnion(e))return new k(e,n,o,a,[void 0,void 0,void 0,r],s);const c=Te(t.valueOffsets);return new k(e,n,o,a,[c,void 0,void 0,r],s)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.indices.ArrayType,t.data),{["dictionary"]:o=new L([new Me().visit({type:e.dictionary})])}=t,{["length"]:a=r.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[void 0,r,s],[],o)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new Me().visit({type:e.valueType})}=t,r=D(t.nullBitmap),{["length"]:o=s.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,void 0,r],[s])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new Me().visit({type:e.childType})}=t,r=D(t.nullBitmap),o=Te(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,void 0,r],[s])}}const Sc=new Me;function E(i){return Sc.visit(i)}class ms{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function uo(i){return i.reduce((t,e)=>t+e.nullCount,0)}function ho(i){return i.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(i.length+1))}function fo(i,t,e,n){const s=[];for(let r=-1,o=i.length;++r=n)break;if(e>=c+u)continue;if(c>=e&&c+u<=n){s.push(a);continue}const d=Math.max(0,e-c),h=Math.min(n-c,u);s.push(a.slice(d,h-d))}return s.length===0&&s.push(i[0].slice(0,0)),s}function Ln(i,t,e,n){let s=0,r=0,o=t.length-1;do{if(s>=o-1)return e0?0:-1}function Tc(i,t){const{nullBitmap:e}=i;if(!e||i.nullCount<=0)return-1;let n=0;for(const s of new Rn(e,i.offset+(t||0),i.length,e,lo)){if(!s)return n;++n}return-1}function S(i,t,e){if(t===void 0)return-1;if(t===null)switch(i.typeId){case l.Union:break;case l.Dictionary:break;default:return Tc(i,e)}const n=st.getVisitFn(i),s=Ae(t);for(let r=(e||0)-1,o=i.length;++r{const s=i.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let e=0;return new ms(i.data.length,n=>{const r=i.data[n].length,o=i.slice(e,e+r);return e+=r,new Oc(o)})}class Oc{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(r.length===0||r.some(a=>!(a instanceof k)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=r[0])===null||e===void 0?void 0:e.type;switch(r.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:c,indexOf:u}=go[o.typeId],d=r[0];this.isValid=h=>Un(d,h),this.get=h=>a(d,h),this.set=(h,F)=>c(d,h,F),this.indexOf=h=>u(d,h),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,_o[o.typeId]),this._offsets=ho(r);break}this.data=r,this.type=o,this.stride=Rt(o),this.numChildren=(s=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Bc(this.data)}get nullCount(){return uo(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${l[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Nn(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Mn.visit(this)}concat(...t){return new L(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new L(co(this,t,e,({data:n,_offsets:s},r,o)=>fo(n,s,r,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:s,ArrayType:r}=this;switch(t.typeId){case l.Int:case l.Float:case l.Decimal:case l.Time:case l.Timestamp:switch(e.length){case 0:return new r;case 1:return e[0].values.subarray(0,n*s);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*s),o.offset),o.offset+=c*s,o),{array:new r(n*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return f.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(f.isDictionary(this.type)){const t=new ki(this.data[0].dictionary),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new L(e)}return new ki(this)}unmemoize(){if(f.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new L(e)}return this}}bo=Symbol.toStringTag;L[bo]=(i=>{i.type=f.prototype,i.data=[],i.length=0,i.stride=1,i.numChildren=0,i._offsets=new Uint32Array([0]),i[Symbol.isConcatSpreadable]=!0;const t=Object.keys(l).map(e=>l[e]).filter(e=>typeof e=="number"&&e!==l.NONE);for(const e of t){const n=st.getVisitFnByTypeId(e),s=pt.getVisitFnByTypeId(e),r=Mi.getVisitFnByTypeId(e);go[e]={get:n,set:s,indexOf:r},_o[e]=Object.create(i,{isValid:{value:Ui(Un)},get:{value:Ui(st.getVisitFnByTypeId(e))},set:{value:po(pt.getVisitFnByTypeId(e))},indexOf:{value:yo(Mi.getVisitFnByTypeId(e))}})}return"Vector"})(L.prototype);class ki extends L{constructor(t){super(t.data);const e=this.get,n=this.set,s=this.slice,r=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=r[o];if(a!==void 0)return a;const c=e.call(this,o);return r[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),r[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new ki(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new L(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class bn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}class rt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new rt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+M),(e||new rt).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):W.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new _t).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new bn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new bn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,W.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}class U{constructor(t=[],e,n,s=W.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=gn(this.fields)),this.dictionaries=n,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){const e=new Set(t),n=this.fields.filter(s=>e.has(s.name));return new U(n,this.metadata)}selectAt(t){const e=t.map(n=>this.fields[n]).filter(Boolean);return new U(e,this.metadata)}assign(...t){const e=t[0]instanceof U?t[0]:Array.isArray(t[0])?new U(t[0]):new U(t),n=[...this.fields],s=Qe(Qe(new Map,this.metadata),e.metadata),r=e.fields.filter(a=>{const c=n.findIndex(u=>u.name===a.name);return~c?(n[c]=a.clone({metadata:Qe(Qe(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=gn(r,new Map);return new U([...n,...r],s,new Map([...this.dictionaries,...o]))}}U.prototype.fields=null;U.prototype.metadata=null;U.prototype.dictionaries=null;class z{static new(...t){let[e,n,s,r]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),s===void 0&&(s=t[0].nullable),r===void 0&&(r=t[0].metadata)),new z(`${e}`,n,s,r)}constructor(t,e,n=!1,s){this.name=t,this.type=e,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,s,r]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,s=this.nullable,r=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:s=this.nullable,metadata:r=this.metadata}=t[0],z.new(e,n,s,r)}}z.prototype.type=null;z.prototype.name=null;z.prototype.nullable=null;z.prototype.metadata=null;function Qe(i,t){return new Map([...i||new Map,...t||new Map])}function gn(i,t=new Map){for(let e=-1,n=i.length;++e0&&gn(r.children,t)}return t}var Ec=Vs,Dc=_e;class je{static decode(t){t=new Dc(D(t));const e=rt.getRootAsFooter(t),n=U.decode(e.schema(),new Map,e.version());return new Fc(n,e)}static encode(t){const e=new Ec,n=U.encode(e,t.schema);rt.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())Wt.encode(e,o);const s=e.endVector();rt.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())Wt.encode(e,o);const r=e.endVector();return rt.startFooter(e),rt.addSchema(e,n),rt.addVersion(e,W.V5),rt.addRecordBatches(e,s),rt.addDictionaries(e,r),rt.finishFooterBuffer(e,rt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=W.V5,n,s){this.schema=t,this.version=e,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return B(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(V);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return lt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return lt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return B(this,void 0,void 0,function*(){return yield this.abort(t),V})}return(t){return B(this,void 0,void 0,function*(){return yield this.close(),V})}read(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(V)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class ri extends Nc{write(t){if((t=D(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ln(this.toUint8Array(!0)):this.toUint8Array(!1).then(ln)}toUint8Array(t=!1){return t?Tt(this._values)[0]:B(this,void 0,void 0,function*(){var e,n,s,r;const o=[];let a=0;try{for(var c=!0,u=Jt(this),d;d=yield u.next(),e=d.done,!e;c=!0){r=d.value,c=!1;const h=r;o.push(h),a+=h.byteLength}}catch(h){n={error:h}}finally{try{!c&&!e&&(s=u.return)&&(yield s.call(u))}finally{if(n)throw n.error}}return Tt(o,a)[0]})}}class Ci{constructor(t){t&&(this.source=new Rc(lt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Ie{constructor(t){t instanceof Ie?this.source=t.source:t instanceof ri?this.source=new qt(lt.fromAsyncIterable(t)):Ps(t)?this.source=new qt(lt.fromNodeStream(t)):An(t)?this.source=new qt(lt.fromDOMStream(t)):Cs(t)?this.source=new qt(lt.fromDOMStream(t.body)):Ve(t)?this.source=new qt(lt.fromIterable(t)):Zt(t)?this.source=new qt(lt.fromAsyncIterable(t)):Be(t)&&(this.source=new qt(lt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Rc{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||V)}return(t){return Object.create(this.source.return&&this.source.return(t)||V)}}class qt{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return B(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return B(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return B(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||V;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return B(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||V;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class gs extends Ci{constructor(t,e){super(),this.position=0,this.buffer=D(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let s=e[3]*n[3];this.buffer[0]=s&65535;let r=s>>>16;return s=e[2]*n[3],r+=s,s=e[3]*n[2]>>>0,r+=s,this.buffer[0]+=r<<16,this.buffer[1]=r>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${pe(this.buffer[3])} ${pe(this.buffer[2])} ${pe(this.buffer[1])} ${pe(this.buffer[0])}`}static multiply(t,e){return new wt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new wt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return wt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return wt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),s=t.length,r=new wt(e);for(let o=n?1:0;o0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class Uc extends vo{constructor(t,e,n,s,r){super(new Uint8Array(0),e,n,s,r),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Li(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return P(Uint8Array,P(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return P(Uint8Array,P(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return f.isTimestamp(t)||(f.isInt(t)||f.isTime(t))&&t.bitWidth===64||f.isDuration(t)||f.isDate(t)&&t.unit===ft.MILLISECOND?P(Uint8Array,tt.convertArray(n[e])):f.isDecimal(t)?P(Uint8Array,wt.convertArray(n[e])):f.isBinary(t)||f.isLargeBinary(t)||f.isFixedSizeBinary(t)?Mc(n[e]):f.isBool(t)?Li(n[e]):f.isUtf8(t)||f.isLargeUtf8(t)?Bn(n[e].join("")):P(Uint8Array,P(t.ArrayType,n[e].map(s=>+s)))}}function Mc(i){const t=i.join(""),e=new Uint8Array(t.length/2);for(let n=0;n>1]=Number.parseInt(t.slice(n,n+2),16);return e}class b extends O{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,s)=>this.compareFields(n,e[s]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function X(i,t){return t instanceof i.constructor}function te(i,t){return i===t||X(i,t)}function kt(i,t){return i===t||X(i,t)&&i.bitWidth===t.bitWidth&&i.isSigned===t.isSigned}function Yi(i,t){return i===t||X(i,t)&&i.precision===t.precision}function kc(i,t){return i===t||X(i,t)&&i.byteWidth===t.byteWidth}function Pn(i,t){return i===t||X(i,t)&&i.unit===t.unit}function $e(i,t){return i===t||X(i,t)&&i.unit===t.unit&&i.timezone===t.timezone}function We(i,t){return i===t||X(i,t)&&i.unit===t.unit&&i.bitWidth===t.bitWidth}function Cc(i,t){return i===t||X(i,t)&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}function Pc(i,t){return i===t||X(i,t)&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}function xn(i,t){return i===t||X(i,t)&&i.mode===t.mode&&i.typeIds.every((e,n)=>e===t.typeIds[n])&&Yt.compareManyFields(i.children,t.children)}function xc(i,t){return i===t||X(i,t)&&i.id===t.id&&i.isOrdered===t.isOrdered&&Yt.visit(i.indices,t.indices)&&Yt.visit(i.dictionary,t.dictionary)}function jn(i,t){return i===t||X(i,t)&&i.unit===t.unit}function Ye(i,t){return i===t||X(i,t)&&i.unit===t.unit}function jc(i,t){return i===t||X(i,t)&&i.listSize===t.listSize&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}function zc(i,t){return i===t||X(i,t)&&i.keysSorted===t.keysSorted&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}b.prototype.visitNull=te;b.prototype.visitBool=te;b.prototype.visitInt=kt;b.prototype.visitInt8=kt;b.prototype.visitInt16=kt;b.prototype.visitInt32=kt;b.prototype.visitInt64=kt;b.prototype.visitUint8=kt;b.prototype.visitUint16=kt;b.prototype.visitUint32=kt;b.prototype.visitUint64=kt;b.prototype.visitFloat=Yi;b.prototype.visitFloat16=Yi;b.prototype.visitFloat32=Yi;b.prototype.visitFloat64=Yi;b.prototype.visitUtf8=te;b.prototype.visitLargeUtf8=te;b.prototype.visitBinary=te;b.prototype.visitLargeBinary=te;b.prototype.visitFixedSizeBinary=kc;b.prototype.visitDate=Pn;b.prototype.visitDateDay=Pn;b.prototype.visitDateMillisecond=Pn;b.prototype.visitTimestamp=$e;b.prototype.visitTimestampSecond=$e;b.prototype.visitTimestampMillisecond=$e;b.prototype.visitTimestampMicrosecond=$e;b.prototype.visitTimestampNanosecond=$e;b.prototype.visitTime=We;b.prototype.visitTimeSecond=We;b.prototype.visitTimeMillisecond=We;b.prototype.visitTimeMicrosecond=We;b.prototype.visitTimeNanosecond=We;b.prototype.visitDecimal=te;b.prototype.visitList=Cc;b.prototype.visitStruct=Pc;b.prototype.visitUnion=xn;b.prototype.visitDenseUnion=xn;b.prototype.visitSparseUnion=xn;b.prototype.visitDictionary=xc;b.prototype.visitInterval=jn;b.prototype.visitIntervalDayTime=jn;b.prototype.visitIntervalYearMonth=jn;b.prototype.visitDuration=Ye;b.prototype.visitDurationSecond=Ye;b.prototype.visitDurationMillisecond=Ye;b.prototype.visitDurationMicrosecond=Ye;b.prototype.visitDurationNanosecond=Ye;b.prototype.visitFixedSizeList=jc;b.prototype.visitMap=zc;const Yt=new b;function _n(i,t){return Yt.compareSchemas(i,t)}function tn(i,t){return Vc(i,t.map(e=>e.data.concat()))}function Vc(i,t){const e=[...i.fields],n=[],s={numBatches:t.reduce((h,F)=>Math.max(h,F.length),0)};let r=0,o=0,a=-1;const c=t.length;let u,d=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(n[r++]=E({type:new J(e),length:o,nullCount:0,children:d.slice()})))}return[i=i.assign(e),n.map(h=>new it(i,h))]}function $c(i,t,e,n,s){var r;const o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a=t)d===t?e[a]=u:(e[a]=u.slice(0,t),s.numBatches=Math.max(s.numBatches,n[a].unshift(u.slice(t,d-t))));else{const h=i[a];i[a]=h.clone({nullable:!0}),e[a]=(r=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&r!==void 0?r:E({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Io;class Q{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new U([]),this._offsets=[0],this;let s,r;t[0]instanceof U&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());const o=c=>{if(c){if(c instanceof it)return[c];if(c instanceof Q)return c.batches;if(c instanceof k){if(c.type instanceof J)return[new it(new U(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(u=>o(u));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(u=>o(u));if(typeof c=="object"){const u=Object.keys(c),d=u.map(T=>new L([c[T]])),h=s??new U(u.map((T,H)=>new z(String(T),d[H].type,d[H].nullable))),[,F]=tn(h,d);return F.length===0?[new it(c)]:F}}}return[]},a=t.flatMap(c=>o(c));if(s=(n=s??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new U([]),!(s instanceof U))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const c of a){if(!(c instanceof it))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!_n(s,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=r??ho(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=uo(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Nn(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Mn.visit(new L(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ + */const Es=Symbol("Comlink.proxy"),Vo=Symbol("Comlink.endpoint"),$o=Symbol("Comlink.releaseProxy"),Ki=Symbol("Comlink.finalizer"),Je=Symbol("Comlink.thrown"),Ds=i=>typeof i=="object"&&i!==null||typeof i=="function",Wo={canHandle:i=>Ds(i)&&i[Es],serialize(i){const{port1:t,port2:e}=new MessageChannel;return Sn(i,t),[e,[e]]},deserialize(i){return i.start(),qo(i)}},Yo={canHandle:i=>Ds(i)&&Je in i,serialize({value:i}){let t;return i instanceof Error?t={isError:!0,value:{message:i.message,name:i.name,stack:i.stack}}:t={isError:!1,value:i},[t,[]]},deserialize(i){throw i.isError?Object.assign(new Error(i.value.message),i.value):i.value}},Fs=new Map([["proxy",Wo],["throw",Yo]]);function Go(i,t){for(const e of i)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function Sn(i,t=globalThis,e=["*"]){t.addEventListener("message",function n(s){if(!s||!s.data)return;if(!Go(e,s.origin)){console.warn(`Invalid origin '${s.origin}' for comlink proxy`);return}const{id:r,type:o,path:a}=Object.assign({path:[]},s.data),c=(s.data.argumentList||[]).map(Kt);let u;try{const d=a.slice(0,-1).reduce((F,A)=>F[A],i),h=a.reduce((F,A)=>F[A],i);switch(o){case"GET":u=h;break;case"SET":d[a.slice(-1)[0]]=Kt(s.data.value),u=!0;break;case"APPLY":u=h.apply(d,c);break;case"CONSTRUCT":{const F=new h(...c);u=Xo(F)}break;case"ENDPOINT":{const{port1:F,port2:A}=new MessageChannel;Sn(i,A),u=Zo(F,[F])}break;case"RELEASE":u=void 0;break;default:return}}catch(d){u={value:d,[Je]:0}}Promise.resolve(u).catch(d=>({value:d,[Je]:0})).then(d=>{const[h,F]=di(d);t.postMessage(Object.assign(Object.assign({},h),{id:r}),F),o==="RELEASE"&&(t.removeEventListener("message",n),Ns(t),Ki in i&&typeof i[Ki]=="function"&&i[Ki]())}).catch(d=>{const[h,F]=di({value:new TypeError("Unserializable return value"),[Je]:0});t.postMessage(Object.assign(Object.assign({},h),{id:r}),F)})}),t.start&&t.start()}function Ho(i){return i.constructor.name==="MessagePort"}function Ns(i){Ho(i)&&i.close()}function qo(i,t){return cn(i,[],t)}function He(i){if(i)throw new Error("Proxy has been released and is not useable")}function Rs(i){return ne(i,{type:"RELEASE"}).then(()=>{Ns(i)})}const li=new WeakMap,ui="FinalizationRegistry"in globalThis&&new FinalizationRegistry(i=>{const t=(li.get(i)||0)-1;li.set(i,t),t===0&&Rs(i)});function Ko(i,t){const e=(li.get(t)||0)+1;li.set(t,e),ui&&ui.register(i,t,i)}function Qo(i){ui&&ui.unregister(i)}function cn(i,t=[],e=function(){}){let n=!1;const s=new Proxy(e,{get(r,o){if(He(n),o===$o)return()=>{Qo(s),Rs(i),n=!0};if(o==="then"){if(t.length===0)return{then:()=>s};const a=ne(i,{type:"GET",path:t.map(c=>c.toString())}).then(Kt);return a.then.bind(a)}return cn(i,[...t,o])},set(r,o,a){He(n);const[c,u]=di(a);return ne(i,{type:"SET",path:[...t,o].map(d=>d.toString()),value:c},u).then(Kt)},apply(r,o,a){He(n);const c=t[t.length-1];if(c===Vo)return ne(i,{type:"ENDPOINT"}).then(Kt);if(c==="bind")return cn(i,t.slice(0,-1));const[u,d]=Xn(a);return ne(i,{type:"APPLY",path:t.map(h=>h.toString()),argumentList:u},d).then(Kt)},construct(r,o){He(n);const[a,c]=Xn(o);return ne(i,{type:"CONSTRUCT",path:t.map(u=>u.toString()),argumentList:a},c).then(Kt)}});return Ko(s,i),s}function Jo(i){return Array.prototype.concat.apply([],i)}function Xn(i){const t=i.map(di);return[t.map(e=>e[0]),Jo(t.map(e=>e[1]))]}const Ls=new WeakMap;function Zo(i,t){return Ls.set(i,t),i}function Xo(i){return Object.assign(i,{[Es]:!0})}function di(i){for(const[t,e]of Fs)if(e.canHandle(i)){const[n,s]=e.serialize(i);return[{type:"HANDLER",name:t,value:n},s]}return[{type:"RAW",value:i},Ls.get(i)||[]]}function Kt(i){switch(i.type){case"HANDLER":return Fs.get(i.name).deserialize(i.value);case"RAW":return i.value}}function ne(i,t,e){return new Promise(n=>{const s=ta();i.addEventListener("message",function r(o){!o.data||!o.data.id||o.data.id!==s||(i.removeEventListener("message",r),n(o.data))}),i.start&&i.start(),i.postMessage(Object.assign({id:s},t),e)})}function ta(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function B(i,t,e,n){function s(r){return r instanceof e?r:new e(function(o){o(r)})}return new(e||(e=Promise))(function(r,o){function a(d){try{u(n.next(d))}catch(h){o(h)}}function c(d){try{u(n.throw(d))}catch(h){o(h)}}function u(d){d.done?r(d.value):s(d.value).then(a,c)}u((n=n.apply(i,t||[])).next())})}function ts(i){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&i[t],n=0;if(e)return e.call(i);if(i&&typeof i.length=="number")return{next:function(){return i&&n>=i.length&&(i=void 0),{value:i&&i[n++],done:!i}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function T(i){return this instanceof T?(this.v=i,this):new T(i)}function Bt(i,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(i,t||[]),s,r=[];return s={},a("next"),a("throw"),a("return",o),s[Symbol.asyncIterator]=function(){return this},s;function o(A){return function(H){return Promise.resolve(H).then(A,h)}}function a(A,H){n[A]&&(s[A]=function(ee){return new Promise(function(qi,Pt){r.push([A,ee,qi,Pt])>1||c(A,ee)})},H&&(s[A]=H(s[A])))}function c(A,H){try{u(n[A](H))}catch(ee){F(r[0][3],ee)}}function u(A){A.value instanceof T?Promise.resolve(A.value.v).then(d,h):F(r[0][2],A)}function d(A){c("next",A)}function h(A){c("throw",A)}function F(A,H){A(H),r.shift(),r.length&&c(r[0][0],r[0][1])}}function Ze(i){var t,e;return t={},n("next"),n("throw",function(s){throw s}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(s,r){t[s]=i[s]?function(o){return(e=!e)?{value:T(i[s](o)),done:!1}:r?r(o):o}:r}}function Jt(i){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=i[Symbol.asyncIterator],e;return t?t.call(i):(i=typeof ts=="function"?ts(i):i[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(r){e[r]=i[r]&&function(o){return new Promise(function(a,c){o=i[r](o),s(a,c,o.done,o.value)})}}function s(r,o,a,c){Promise.resolve(c).then(function(u){r({value:u,done:a})},o)}}const ea=new TextDecoder("utf-8"),ln=i=>ea.decode(i),ia=new TextEncoder,Bn=i=>ia.encode(i),na=i=>typeof i=="number",Us=i=>typeof i=="boolean",Y=i=>typeof i=="function",nt=i=>i!=null&&Object(i)===i,Zt=i=>nt(i)&&Y(i.then),Ve=i=>nt(i)&&Y(i[Symbol.iterator]),Be=i=>nt(i)&&Y(i[Symbol.asyncIterator]),un=i=>nt(i)&&nt(i.schema),Ms=i=>nt(i)&&"done"in i&&"value"in i,ks=i=>nt(i)&&Y(i.stat)&&na(i.fd),Cs=i=>nt(i)&&Tn(i.body),$i=i=>"_getDOMStream"in i&&"_getNodeStream"in i,sa=i=>nt(i)&&Y(i.abort)&&Y(i.getWriter)&&!$i(i),Tn=i=>nt(i)&&Y(i.cancel)&&Y(i.getReader)&&!$i(i),ra=i=>nt(i)&&Y(i.end)&&Y(i.write)&&Us(i.writable)&&!$i(i),Ps=i=>nt(i)&&Y(i.read)&&Y(i.pipe)&&Us(i.readable)&&!$i(i),oa=i=>nt(i)&&Y(i.clear)&&Y(i.bytes)&&Y(i.position)&&Y(i.setPosition)&&Y(i.capacity)&&Y(i.getBufferIdentifier)&&Y(i.createLong),An=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function aa(i){const t=i[0]?[i[0]]:[];let e,n,s,r;for(let o,a,c=0,u=0,d=i.length;++cd+h.byteLength,0);let s,r,o,a=0,c=-1;const u=Math.min(t||Number.POSITIVE_INFINITY,n);for(const d=e.length;++cP(Int32Array,i),is=i=>P(BigInt64Array,i),D=i=>P(Uint8Array,i),dn=i=>(i.next(),i);function*ca(i,t){const e=function*(s){yield s},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof An?e(t):Ve(t)?t:e(t);return yield*dn(function*(s){let r=null;do r=s.next(yield P(i,r));while(!r.done)}(n[Symbol.iterator]())),new i}const la=i=>ca(Uint8Array,i);function xs(i,t){return Bt(this,arguments,function*(){if(Zt(t))return yield T(yield T(yield*Ze(Jt(xs(i,yield T(t))))));const n=function(o){return Bt(this,arguments,function*(){yield yield T(yield T(o))})},s=function(o){return Bt(this,arguments,function*(){yield T(yield*Ze(Jt(dn(function*(a){let c=null;do c=a.next(yield c==null?void 0:c.value);while(!c.done)}(o[Symbol.iterator]())))))})},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof An?n(t):Ve(t)?s(t):Be(t)?t:n(t);return yield T(yield*Ze(Jt(dn(function(o){return Bt(this,arguments,function*(){let a=null;do a=yield T(o.next(yield yield T(P(i,a))));while(!a.done)})}(r[Symbol.asyncIterator]()))))),yield T(new i)})}const ua=i=>xs(Uint8Array,i);function js(i,t,e){if(i!==0){e=e.slice(0,t);for(let n=-1,s=e.length;++n0)do if(i[e]!==t[e])return!1;while(++e(i.next(),i);function*ha(i){let t,e=!1,n=[],s,r,o,a=0;function c(){return r==="peek"?At(n,o)[0]:([s,n,a]=At(n,o),s)}({cmd:r,size:o}=(yield null)||{cmd:"read",size:0});const u=la(i)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(o-a)?u.next():u.next(o-a),!t&&s.byteLength>0&&(n.push(s),a+=s.byteLength),t||o<=a)do({cmd:r,size:o}=yield c());while(o0&&(s.push(r),c+=r.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield T(u()));while(a0&&(s.push(D(r)),c+=r.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield T(u()));while(a{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return B(this,void 0,void 0,function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return B(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=D(e)),e})}}const Qi=(i,t)=>{const e=s=>n([t,s]);let n;return[t,e,new Promise(s=>(n=s)&&i.once(t,e))]};function ma(i){return Bt(this,arguments,function*(){const e=[];let n="error",s=!1,r=null,o,a,c=0,u=[],d;function h(){return o==="peek"?At(u,a)[0]:([d,u,c]=At(u,a),d)}if({cmd:o,size:a}=(yield yield T(null))||{cmd:"read",size:0},i.isTTY)return yield yield T(new Uint8Array(0)),yield T(null);try{e[0]=Qi(i,"end"),e[1]=Qi(i,"error");do{if(e[2]=Qi(i,"readable"),[n,r]=yield T(Promise.race(e.map(A=>A[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(a-c)?(d=D(i.read(a-c)),d.byteLength0&&(u.push(d),c+=d.byteLength)),s||a<=c)do({cmd:o,size:a}=yield yield T(h()));while(a{for(const[Pt,xo]of A)i.off(Pt,xo);try{const Pt=i.destroy;Pt&&Pt.call(i,H),H=void 0}catch(Pt){H=Pt||H}finally{H!=null?qi(H):ee()}})}})}var W;(function(i){i[i.V1=0]="V1",i[i.V2=1]="V2",i[i.V3=2]="V3",i[i.V4=3]="V4",i[i.V5=4]="V5"})(W||(W={}));var K;(function(i){i[i.Sparse=0]="Sparse",i[i.Dense=1]="Dense"})(K||(K={}));var q;(function(i){i[i.HALF=0]="HALF",i[i.SINGLE=1]="SINGLE",i[i.DOUBLE=2]="DOUBLE"})(q||(q={}));var ft;(function(i){i[i.DAY=0]="DAY",i[i.MILLISECOND=1]="MILLISECOND"})(ft||(ft={}));var g;(function(i){i[i.SECOND=0]="SECOND",i[i.MILLISECOND=1]="MILLISECOND",i[i.MICROSECOND=2]="MICROSECOND",i[i.NANOSECOND=3]="NANOSECOND"})(g||(g={}));var Ot;(function(i){i[i.YEAR_MONTH=0]="YEAR_MONTH",i[i.DAY_TIME=1]="DAY_TIME",i[i.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Ot||(Ot={}));const Ji=2,vt=4,Lt=4,M=4,zt=new Int32Array(2),ns=new Float32Array(zt.buffer),ss=new Float64Array(zt.buffer),Ke=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var hn;(function(i){i[i.UTF8_BYTES=1]="UTF8_BYTES",i[i.UTF16_STRING=2]="UTF16_STRING"})(hn||(hn={}));let _e=class zs{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new zs(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){ns[0]=e,this.writeInt32(t,zt[0])}writeFloat64(t,e){ss[0]=e,this.writeInt32(t,zt[Ke?0:1]),this.writeInt32(t+4,zt[Ke?1:0])}getBufferIdentifier(){if(this.bytes_.lengththis.minalign&&(this.minalign=t);const n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space=0&&this.vtable[e]==0;e--);const n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const s=2;this.addInt16(t-this.object_start);const r=(n+s)*Ji;this.addInt16(r);let o=0;const a=this.space;t:for(e=0;e=0;o--)this.writeInt8(r.charCodeAt(o))}this.prep(this.minalign,vt+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,s=n-this.bb.readInt32(n);if(!(e=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return et.startUnion(t),et.addMode(t,e),et.addTypeIds(t,n),et.endUnion(t)}}let ds=class Le{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+M),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Le.startUtf8(t),Le.endUtf8(t)}};var j;(function(i){i[i.NONE=0]="NONE",i[i.Null=1]="Null",i[i.Int=2]="Int",i[i.FloatingPoint=3]="FloatingPoint",i[i.Binary=4]="Binary",i[i.Utf8=5]="Utf8",i[i.Bool=6]="Bool",i[i.Decimal=7]="Decimal",i[i.Date=8]="Date",i[i.Time=9]="Time",i[i.Timestamp=10]="Timestamp",i[i.Interval=11]="Interval",i[i.List=12]="List",i[i.Struct_=13]="Struct_",i[i.Union=14]="Union",i[i.FixedSizeBinary=15]="FixedSizeBinary",i[i.FixedSizeList=16]="FixedSizeList",i[i.Map=17]="Map",i[i.Duration=18]="Duration",i[i.LargeBinary=19]="LargeBinary",i[i.LargeUtf8=20]="LargeUtf8",i[i.LargeList=21]="LargeList",i[i.RunEndEncoded=22]="RunEndEncoded"})(j||(j={}));let ct=class si{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new si).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+M),(e||new si).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):j.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new Ut).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new si).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,j.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}},_t=class Dt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+M),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):we.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new ct).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,we.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,s,r){return Dt.startSchema(t),Dt.addEndianness(t,e),Dt.addFields(t,n),Dt.addCustomMetadata(t,s),Dt.addFeatures(t,r),Dt.endSchema(t)}};var R;(function(i){i[i.NONE=0]="NONE",i[i.Schema=1]="Schema",i[i.DictionaryBatch=2]="DictionaryBatch",i[i.RecordBatch=3]="RecordBatch",i[i.Tensor=4]="Tensor",i[i.SparseTensor=5]="SparseTensor"})(R||(R={}));var l;(function(i){i[i.NONE=0]="NONE",i[i.Null=1]="Null",i[i.Int=2]="Int",i[i.Float=3]="Float",i[i.Binary=4]="Binary",i[i.Utf8=5]="Utf8",i[i.Bool=6]="Bool",i[i.Decimal=7]="Decimal",i[i.Date=8]="Date",i[i.Time=9]="Time",i[i.Timestamp=10]="Timestamp",i[i.Interval=11]="Interval",i[i.List=12]="List",i[i.Struct=13]="Struct",i[i.Union=14]="Union",i[i.FixedSizeBinary=15]="FixedSizeBinary",i[i.FixedSizeList=16]="FixedSizeList",i[i.Map=17]="Map",i[i.Duration=18]="Duration",i[i.LargeBinary=19]="LargeBinary",i[i.LargeUtf8=20]="LargeUtf8",i[i.Dictionary=-1]="Dictionary",i[i.Int8=-2]="Int8",i[i.Int16=-3]="Int16",i[i.Int32=-4]="Int32",i[i.Int64=-5]="Int64",i[i.Uint8=-6]="Uint8",i[i.Uint16=-7]="Uint16",i[i.Uint32=-8]="Uint32",i[i.Uint64=-9]="Uint64",i[i.Float16=-10]="Float16",i[i.Float32=-11]="Float32",i[i.Float64=-12]="Float64",i[i.DateDay=-13]="DateDay",i[i.DateMillisecond=-14]="DateMillisecond",i[i.TimestampSecond=-15]="TimestampSecond",i[i.TimestampMillisecond=-16]="TimestampMillisecond",i[i.TimestampMicrosecond=-17]="TimestampMicrosecond",i[i.TimestampNanosecond=-18]="TimestampNanosecond",i[i.TimeSecond=-19]="TimeSecond",i[i.TimeMillisecond=-20]="TimeMillisecond",i[i.TimeMicrosecond=-21]="TimeMicrosecond",i[i.TimeNanosecond=-22]="TimeNanosecond",i[i.DenseUnion=-23]="DenseUnion",i[i.SparseUnion=-24]="SparseUnion",i[i.IntervalDayTime=-25]="IntervalDayTime",i[i.IntervalYearMonth=-26]="IntervalYearMonth",i[i.DurationSecond=-27]="DurationSecond",i[i.DurationMillisecond=-28]="DurationMillisecond",i[i.DurationMicrosecond=-29]="DurationMicrosecond",i[i.DurationNanosecond=-30]="DurationNanosecond"})(l||(l={}));var Nt;(function(i){i[i.OFFSET=0]="OFFSET",i[i.DATA=1]="DATA",i[i.VALIDITY=2]="VALIDITY",i[i.TYPE=3]="TYPE"})(Nt||(Nt={}));const ba=void 0;function ke(i){if(i===null)return"null";if(i===ba)return"undefined";switch(typeof i){case"number":return`${i}`;case"bigint":return`${i}`;case"string":return`"${i}"`}return typeof i[Symbol.toPrimitive]=="function"?i[Symbol.toPrimitive]("string"):ArrayBuffer.isView(i)?i instanceof BigInt64Array||i instanceof BigUint64Array?`[${[...i].map(t=>ke(t))}]`:`[${i}]`:ArrayBuffer.isView(i)?`[${i}]`:JSON.stringify(i,(t,e)=>typeof e=="bigint"?`${e}`:e)}function x(i){if(typeof i=="bigint"&&(iNumber.MAX_SAFE_INTEGER))throw new TypeError(`${i} is not safe to convert to a number.`);return Number(i)}function Gs(i,t){return x(i/t)+x(i%t)/x(t)}const ga=Symbol.for("isArrowBigNum");function bt(i,...t){return t.length===0?Object.setPrototypeOf(P(this.TypedArray,i),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(i,...t),this.constructor.prototype)}bt.prototype[ga]=!0;bt.prototype.toJSON=function(){return`"${Pe(this)}"`};bt.prototype.valueOf=function(i){return Hs(this,i)};bt.prototype.toString=function(){return Pe(this)};bt.prototype[Symbol.toPrimitive]=function(i="default"){switch(i){case"number":return Hs(this);case"string":return Pe(this);case"default":return va(this)}return Pe(this)};function ye(...i){return bt.apply(this,i)}function me(...i){return bt.apply(this,i)}function Ce(...i){return bt.apply(this,i)}Object.setPrototypeOf(ye.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(me.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ce.prototype,Object.create(Uint32Array.prototype));Object.assign(ye.prototype,bt.prototype,{constructor:ye,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(me.prototype,bt.prototype,{constructor:me,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ce.prototype,bt.prototype,{constructor:Ce,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const _a=BigInt(4294967296)*BigInt(4294967296),wa=_a-BigInt(1);function Hs(i,t){const{buffer:e,byteOffset:n,byteLength:s,signed:r}=i,o=new BigUint64Array(e,n,s/8),a=r&&o.at(-1)&BigInt(1)<=0)return Zi(i);t=t.slice();let n=1;for(let r=0;r(i.children=null,i.ArrayType=Array,i.OffsetArrayType=Int32Array,i[Symbol.toStringTag]="DataType"))(f.prototype);class $t extends f{constructor(){super(l.Null)}toString(){return"Null"}}Ks=Symbol.toStringTag;$t[Ks]=(i=>i[Symbol.toStringTag]="Null")($t.prototype);class Xt extends f{constructor(t,e){super(l.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}Qs=Symbol.toStringTag;Xt[Qs]=(i=>(i.isSigned=null,i.bitWidth=null,i[Symbol.toStringTag]="Int"))(Xt.prototype);class xe extends Xt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(xe.prototype,"ArrayType",{value:Int32Array});class yi extends f{constructor(t){super(l.Float),this.precision=t}get ArrayType(){switch(this.precision){case q.HALF:return Uint16Array;case q.SINGLE:return Float32Array;case q.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Js=Symbol.toStringTag;yi[Js]=(i=>(i.precision=null,i[Symbol.toStringTag]="Float"))(yi.prototype);class mi extends f{constructor(){super(l.Binary)}toString(){return"Binary"}}Zs=Symbol.toStringTag;mi[Zs]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Binary"))(mi.prototype);class bi extends f{constructor(){super(l.LargeBinary)}toString(){return"LargeBinary"}}Xs=Symbol.toStringTag;bi[Xs]=(i=>(i.ArrayType=Uint8Array,i.OffsetArrayType=BigInt64Array,i[Symbol.toStringTag]="LargeBinary"))(bi.prototype);class gi extends f{constructor(){super(l.Utf8)}toString(){return"Utf8"}}tr=Symbol.toStringTag;gi[tr]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Utf8"))(gi.prototype);class _i extends f{constructor(){super(l.LargeUtf8)}toString(){return"LargeUtf8"}}er=Symbol.toStringTag;_i[er]=(i=>(i.ArrayType=Uint8Array,i.OffsetArrayType=BigInt64Array,i[Symbol.toStringTag]="LargeUtf8"))(_i.prototype);class wi extends f{constructor(){super(l.Bool)}toString(){return"Bool"}}ir=Symbol.toStringTag;wi[ir]=(i=>(i.ArrayType=Uint8Array,i[Symbol.toStringTag]="Bool"))(wi.prototype);class vi extends f{constructor(t,e,n=128){super(l.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}nr=Symbol.toStringTag;vi[nr]=(i=>(i.scale=null,i.precision=null,i.ArrayType=Uint32Array,i[Symbol.toStringTag]="Decimal"))(vi.prototype);class Ii extends f{constructor(t){super(l.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${ft[this.unit]}>`}get ArrayType(){return this.unit===ft.DAY?Int32Array:BigInt64Array}}sr=Symbol.toStringTag;Ii[sr]=(i=>(i.unit=null,i[Symbol.toStringTag]="Date"))(Ii.prototype);class Si extends f{constructor(t,e){super(l.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${g[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}rr=Symbol.toStringTag;Si[rr]=(i=>(i.unit=null,i.bitWidth=null,i[Symbol.toStringTag]="Time"))(Si.prototype);class Bi extends f{constructor(t,e){super(l.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${g[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}or=Symbol.toStringTag;Bi[or]=(i=>(i.unit=null,i.timezone=null,i.ArrayType=BigInt64Array,i[Symbol.toStringTag]="Timestamp"))(Bi.prototype);class Ti extends f{constructor(t){super(l.Interval),this.unit=t}toString(){return`Interval<${Ot[this.unit]}>`}}ar=Symbol.toStringTag;Ti[ar]=(i=>(i.unit=null,i.ArrayType=Int32Array,i[Symbol.toStringTag]="Interval"))(Ti.prototype);class Ai extends f{constructor(t){super(l.Duration),this.unit=t}toString(){return`Duration<${g[this.unit]}>`}}cr=Symbol.toStringTag;Ai[cr]=(i=>(i.unit=null,i.ArrayType=BigInt64Array,i[Symbol.toStringTag]="Duration"))(Ai.prototype);class Oi extends f{constructor(t){super(l.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}lr=Symbol.toStringTag;Oi[lr]=(i=>(i.children=null,i[Symbol.toStringTag]="List"))(Oi.prototype);class J extends f{constructor(t){super(l.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}ur=Symbol.toStringTag;J[ur]=(i=>(i.children=null,i[Symbol.toStringTag]="Struct"))(J.prototype);class Ei extends f{constructor(t,e,n){super(l.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((s,r,o)=>(s[r]=o)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}dr=Symbol.toStringTag;Ei[dr]=(i=>(i.mode=null,i.typeIds=null,i.children=null,i.typeIdToChildIndex=null,i.ArrayType=Int8Array,i[Symbol.toStringTag]="Union"))(Ei.prototype);class Di extends f{constructor(t){super(l.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}hr=Symbol.toStringTag;Di[hr]=(i=>(i.byteWidth=null,i.ArrayType=Uint8Array,i[Symbol.toStringTag]="FixedSizeBinary"))(Di.prototype);class Fi extends f{constructor(t,e){super(l.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}fr=Symbol.toStringTag;Fi[fr]=(i=>(i.children=null,i.listSize=null,i[Symbol.toStringTag]="FixedSizeList"))(Fi.prototype);class Ni extends f{constructor(t,e=!1){var n,s,r;if(super(l.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){const o=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[0];o&&(o.name="key");const a=(r=t==null?void 0:t.type)===null||r===void 0?void 0:r.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}pr=Symbol.toStringTag;Ni[pr]=(i=>(i.children=null,i.keysSorted=null,i[Symbol.toStringTag]="Map_"))(Ni.prototype);const Ia=(i=>()=>++i)(-1);class ve extends f{constructor(t,e,n,s){super(l.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=s||!1,this.id=n==null?Ia():x(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}yr=Symbol.toStringTag;ve[yr]=(i=>(i.id=null,i.indices=null,i.isOrdered=null,i.dictionary=null,i[Symbol.toStringTag]="Dictionary"))(ve.prototype);function Rt(i){const t=i;switch(i.typeId){case l.Decimal:return i.bitWidth/32;case l.Interval:return 1+t.unit;case l.FixedSizeList:return t.listSize;case l.FixedSizeBinary:return t.byteWidth;default:return 1}}class O{visitMany(t,...e){return t.map((n,s)=>this.visit(n,...e.map(r=>r[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Sa(this,t,e)}getVisitFnByTypeId(t,e=!0){return de(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}}function Sa(i,t,e=!0){return typeof t=="number"?de(i,t,e):typeof t=="string"&&t in l?de(i,l[t],e):t&&t instanceof f?de(i,hs(t),e):t!=null&&t.type&&t.type instanceof f?de(i,hs(t.type),e):de(i,l.NONE,e)}function de(i,t,e=!0){let n=null;switch(t){case l.Null:n=i.visitNull;break;case l.Bool:n=i.visitBool;break;case l.Int:n=i.visitInt;break;case l.Int8:n=i.visitInt8||i.visitInt;break;case l.Int16:n=i.visitInt16||i.visitInt;break;case l.Int32:n=i.visitInt32||i.visitInt;break;case l.Int64:n=i.visitInt64||i.visitInt;break;case l.Uint8:n=i.visitUint8||i.visitInt;break;case l.Uint16:n=i.visitUint16||i.visitInt;break;case l.Uint32:n=i.visitUint32||i.visitInt;break;case l.Uint64:n=i.visitUint64||i.visitInt;break;case l.Float:n=i.visitFloat;break;case l.Float16:n=i.visitFloat16||i.visitFloat;break;case l.Float32:n=i.visitFloat32||i.visitFloat;break;case l.Float64:n=i.visitFloat64||i.visitFloat;break;case l.Utf8:n=i.visitUtf8;break;case l.LargeUtf8:n=i.visitLargeUtf8;break;case l.Binary:n=i.visitBinary;break;case l.LargeBinary:n=i.visitLargeBinary;break;case l.FixedSizeBinary:n=i.visitFixedSizeBinary;break;case l.Date:n=i.visitDate;break;case l.DateDay:n=i.visitDateDay||i.visitDate;break;case l.DateMillisecond:n=i.visitDateMillisecond||i.visitDate;break;case l.Timestamp:n=i.visitTimestamp;break;case l.TimestampSecond:n=i.visitTimestampSecond||i.visitTimestamp;break;case l.TimestampMillisecond:n=i.visitTimestampMillisecond||i.visitTimestamp;break;case l.TimestampMicrosecond:n=i.visitTimestampMicrosecond||i.visitTimestamp;break;case l.TimestampNanosecond:n=i.visitTimestampNanosecond||i.visitTimestamp;break;case l.Time:n=i.visitTime;break;case l.TimeSecond:n=i.visitTimeSecond||i.visitTime;break;case l.TimeMillisecond:n=i.visitTimeMillisecond||i.visitTime;break;case l.TimeMicrosecond:n=i.visitTimeMicrosecond||i.visitTime;break;case l.TimeNanosecond:n=i.visitTimeNanosecond||i.visitTime;break;case l.Decimal:n=i.visitDecimal;break;case l.List:n=i.visitList;break;case l.Struct:n=i.visitStruct;break;case l.Union:n=i.visitUnion;break;case l.DenseUnion:n=i.visitDenseUnion||i.visitUnion;break;case l.SparseUnion:n=i.visitSparseUnion||i.visitUnion;break;case l.Dictionary:n=i.visitDictionary;break;case l.Interval:n=i.visitInterval;break;case l.IntervalDayTime:n=i.visitIntervalDayTime||i.visitInterval;break;case l.IntervalYearMonth:n=i.visitIntervalYearMonth||i.visitInterval;break;case l.Duration:n=i.visitDuration;break;case l.DurationSecond:n=i.visitDurationSecond||i.visitDuration;break;case l.DurationMillisecond:n=i.visitDurationMillisecond||i.visitDuration;break;case l.DurationMicrosecond:n=i.visitDurationMicrosecond||i.visitDuration;break;case l.DurationNanosecond:n=i.visitDurationNanosecond||i.visitDuration;break;case l.FixedSizeList:n=i.visitFixedSizeList;break;case l.Map:n=i.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${l[t]}'`)}function hs(i){switch(i.typeId){case l.Null:return l.Null;case l.Int:{const{bitWidth:t,isSigned:e}=i;switch(t){case 8:return e?l.Int8:l.Uint8;case 16:return e?l.Int16:l.Uint16;case 32:return e?l.Int32:l.Uint32;case 64:return e?l.Int64:l.Uint64}return l.Int}case l.Float:switch(i.precision){case q.HALF:return l.Float16;case q.SINGLE:return l.Float32;case q.DOUBLE:return l.Float64}return l.Float;case l.Binary:return l.Binary;case l.LargeBinary:return l.LargeBinary;case l.Utf8:return l.Utf8;case l.LargeUtf8:return l.LargeUtf8;case l.Bool:return l.Bool;case l.Decimal:return l.Decimal;case l.Time:switch(i.unit){case g.SECOND:return l.TimeSecond;case g.MILLISECOND:return l.TimeMillisecond;case g.MICROSECOND:return l.TimeMicrosecond;case g.NANOSECOND:return l.TimeNanosecond}return l.Time;case l.Timestamp:switch(i.unit){case g.SECOND:return l.TimestampSecond;case g.MILLISECOND:return l.TimestampMillisecond;case g.MICROSECOND:return l.TimestampMicrosecond;case g.NANOSECOND:return l.TimestampNanosecond}return l.Timestamp;case l.Date:switch(i.unit){case ft.DAY:return l.DateDay;case ft.MILLISECOND:return l.DateMillisecond}return l.Date;case l.Interval:switch(i.unit){case Ot.DAY_TIME:return l.IntervalDayTime;case Ot.YEAR_MONTH:return l.IntervalYearMonth}return l.Interval;case l.Duration:switch(i.unit){case g.SECOND:return l.DurationSecond;case g.MILLISECOND:return l.DurationMillisecond;case g.MICROSECOND:return l.DurationMicrosecond;case g.NANOSECOND:return l.DurationNanosecond}return l.Duration;case l.Map:return l.Map;case l.List:return l.List;case l.Struct:return l.Struct;case l.Union:switch(i.mode){case K.Dense:return l.DenseUnion;case K.Sparse:return l.SparseUnion}return l.Union;case l.FixedSizeBinary:return l.FixedSizeBinary;case l.FixedSizeList:return l.FixedSizeList;case l.Dictionary:return l.Dictionary}throw new Error(`Unrecognized type '${l[i.typeId]}'`)}O.prototype.visitInt8=null;O.prototype.visitInt16=null;O.prototype.visitInt32=null;O.prototype.visitInt64=null;O.prototype.visitUint8=null;O.prototype.visitUint16=null;O.prototype.visitUint32=null;O.prototype.visitUint64=null;O.prototype.visitFloat16=null;O.prototype.visitFloat32=null;O.prototype.visitFloat64=null;O.prototype.visitDateDay=null;O.prototype.visitDateMillisecond=null;O.prototype.visitTimestampSecond=null;O.prototype.visitTimestampMillisecond=null;O.prototype.visitTimestampMicrosecond=null;O.prototype.visitTimestampNanosecond=null;O.prototype.visitTimeSecond=null;O.prototype.visitTimeMillisecond=null;O.prototype.visitTimeMicrosecond=null;O.prototype.visitTimeNanosecond=null;O.prototype.visitDenseUnion=null;O.prototype.visitSparseUnion=null;O.prototype.visitIntervalDayTime=null;O.prototype.visitIntervalYearMonth=null;O.prototype.visitDuration=null;O.prototype.visitDurationSecond=null;O.prototype.visitDurationMillisecond=null;O.prototype.visitDurationMicrosecond=null;O.prototype.visitDurationNanosecond=null;const mr=new Float64Array(1),ie=new Uint32Array(mr.buffer);function br(i){const t=(i&31744)>>10,e=(i&1023)/1024,n=Math.pow(-1,(i&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function Ba(i){if(i!==i)return 32256;mr[0]=i;const t=(ie[1]&2147483648)>>16&65535;let e=ie[1]&2146435072,n=0;return e>=1089470464?ie[0]>0?e=31744:(e=(e&2080374784)>>16,n=(ie[1]&1048575)>>10):e<=1056964608?(n=1048576+(ie[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(ie[1]&1048575)+512>>10),t|e|n&65535}class _ extends O{}function I(i){return(t,e,n)=>{if(t.setValid(e,n!=null))return i(t,e,n)}}const Ta=(i,t,e)=>{i[t]=Math.floor(e/864e5)},gr=(i,t,e,n)=>{if(e+1{const s=i+e;n?t[s>>3]|=1<>3]&=~(1<{i[t]=e},En=({values:i},t,e)=>{i[t]=e},_r=({values:i},t,e)=>{i[t]=Ba(e)},Oa=(i,t,e)=>{switch(i.type.precision){case q.HALF:return _r(i,t,e);case q.SINGLE:case q.DOUBLE:return En(i,t,e)}},wr=({values:i},t,e)=>{Ta(i,t,e.valueOf())},vr=({values:i},t,e)=>{i[t]=BigInt(e)},Ea=({stride:i,values:t},e,n)=>{t.set(n.subarray(0,i),i*e)},Ir=({values:i,valueOffsets:t},e,n)=>gr(i,t,e,n),Sr=({values:i,valueOffsets:t},e,n)=>gr(i,t,e,Bn(n)),Da=(i,t,e)=>{i.type.unit===ft.DAY?wr(i,t,e):vr(i,t,e)},Br=({values:i},t,e)=>{i[t]=BigInt(e/1e3)},Tr=({values:i},t,e)=>{i[t]=BigInt(e)},Ar=({values:i},t,e)=>{i[t]=BigInt(e*1e3)},Or=({values:i},t,e)=>{i[t]=BigInt(e*1e6)},Fa=(i,t,e)=>{switch(i.type.unit){case g.SECOND:return Br(i,t,e);case g.MILLISECOND:return Tr(i,t,e);case g.MICROSECOND:return Ar(i,t,e);case g.NANOSECOND:return Or(i,t,e)}},Er=({values:i},t,e)=>{i[t]=e},Dr=({values:i},t,e)=>{i[t]=e},Fr=({values:i},t,e)=>{i[t]=e},Nr=({values:i},t,e)=>{i[t]=e},Na=(i,t,e)=>{switch(i.type.unit){case g.SECOND:return Er(i,t,e);case g.MILLISECOND:return Dr(i,t,e);case g.MICROSECOND:return Fr(i,t,e);case g.NANOSECOND:return Nr(i,t,e)}},Ra=({values:i,stride:t},e,n)=>{i.set(n.subarray(0,t),t*e)},La=(i,t,e)=>{const n=i.children[0],s=i.valueOffsets,r=pt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=s[t],c=s[t+1];a{const n=i.children[0],{valueOffsets:s}=i,r=pt.getVisitFn(n);let{[t]:o,[t+1]:a}=s;const c=e instanceof Map?e.entries():Object.entries(e);for(const u of c)if(r(n,o,u),++o>=a)break},Ma=(i,t)=>(e,n,s,r)=>n&&e(n,i,t[r]),ka=(i,t)=>(e,n,s,r)=>n&&e(n,i,t.get(r)),Ca=(i,t)=>(e,n,s,r)=>n&&e(n,i,t.get(s.name)),Pa=(i,t)=>(e,n,s,r)=>n&&e(n,i,t[s.name]),xa=(i,t,e)=>{const n=i.type.children.map(r=>pt.getVisitFn(r.type)),s=e instanceof Map?Ca(t,e):e instanceof L?ka(t,e):Array.isArray(e)?Ma(t,e):Pa(t,e);i.type.children.forEach((r,o)=>s(n[o],i.children[o],r,o))},ja=(i,t,e)=>{i.type.mode===K.Dense?Rr(i,t,e):Lr(i,t,e)},Rr=(i,t,e)=>{const n=i.type.typeIdToChildIndex[i.typeIds[t]],s=i.children[n];pt.visit(s,i.valueOffsets[t],e)},Lr=(i,t,e)=>{const n=i.type.typeIdToChildIndex[i.typeIds[t]],s=i.children[n];pt.visit(s,t,e)},za=(i,t,e)=>{var n;(n=i.dictionary)===null||n===void 0||n.set(i.values[t],e)},Va=(i,t,e)=>{i.type.unit===Ot.DAY_TIME?Ur(i,t,e):Mr(i,t,e)},Ur=({values:i},t,e)=>{i.set(e.subarray(0,2),2*t)},Mr=({values:i},t,e)=>{i[t]=e[0]*12+e[1]%12},kr=({values:i},t,e)=>{i[t]=e},Cr=({values:i},t,e)=>{i[t]=e},Pr=({values:i},t,e)=>{i[t]=e},xr=({values:i},t,e)=>{i[t]=e},$a=(i,t,e)=>{switch(i.type.unit){case g.SECOND:return kr(i,t,e);case g.MILLISECOND:return Cr(i,t,e);case g.MICROSECOND:return Pr(i,t,e);case g.NANOSECOND:return xr(i,t,e)}},Wa=(i,t,e)=>{const{stride:n}=i,s=i.children[0],r=pt.getVisitFn(s);if(Array.isArray(e))for(let o=-1,a=t*n;++o`${ke(t)}: ${ke(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Ya(this[yt],this[be])}}class Ya{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return te.name)}has(t,e){return t[yt].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[yt].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[yt].type.children.findIndex(s=>s.name===e);if(n!==-1){const s=st.visit(t[yt].children[n],t[be]);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[yt].type.children.findIndex(r=>r.name===e);return s!==-1?(pt.visit(t[yt].children[s],t[be],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}class p extends O{}function w(i){return(t,e)=>t.getValid(e)?i(t,e):null}const Ha=(i,t)=>864e5*i[t],qa=(i,t)=>null,jr=(i,t,e)=>{if(e+1>=t.length)return null;const n=x(t[e]),s=x(t[e+1]);return i.subarray(n,s)},Ka=({offset:i,values:t},e)=>{const n=i+e;return(t[n>>3]&1<Ha(i,t),Vr=({values:i},t)=>x(i[t]),Ht=({stride:i,values:t},e)=>t[i*e],Qa=({stride:i,values:t},e)=>br(t[i*e]),$r=({values:i},t)=>i[t],Ja=({stride:i,values:t},e)=>t.subarray(i*e,i*(e+1)),Wr=({values:i,valueOffsets:t},e)=>jr(i,t,e),Yr=({values:i,valueOffsets:t},e)=>{const n=jr(i,t,e);return n!==null?ln(n):null},Za=({values:i},t)=>i[t],Xa=({type:i,values:t},e)=>i.precision!==q.HALF?t[e]:br(t[e]),tc=(i,t)=>i.type.unit===ft.DAY?zr(i,t):Vr(i,t),Gr=({values:i},t)=>1e3*x(i[t]),Hr=({values:i},t)=>x(i[t]),qr=({values:i},t)=>Gs(i[t],BigInt(1e3)),Kr=({values:i},t)=>Gs(i[t],BigInt(1e6)),ec=(i,t)=>{switch(i.type.unit){case g.SECOND:return Gr(i,t);case g.MILLISECOND:return Hr(i,t);case g.MICROSECOND:return qr(i,t);case g.NANOSECOND:return Kr(i,t)}},Qr=({values:i},t)=>i[t],Jr=({values:i},t)=>i[t],Zr=({values:i},t)=>i[t],Xr=({values:i},t)=>i[t],ic=(i,t)=>{switch(i.type.unit){case g.SECOND:return Qr(i,t);case g.MILLISECOND:return Jr(i,t);case g.MICROSECOND:return Zr(i,t);case g.NANOSECOND:return Xr(i,t)}},nc=({values:i,stride:t},e)=>On.decimal(i.subarray(t*e,t*(e+1))),sc=(i,t)=>{const{valueOffsets:e,stride:n,children:s}=i,{[t*n]:r,[t*n+1]:o}=e,c=s[0].slice(r,o-r);return new L([c])},rc=(i,t)=>{const{valueOffsets:e,children:n}=i,{[t]:s,[t+1]:r}=e,o=n[0];return new Fn(o.slice(s,r-s))},oc=(i,t)=>new Dn(i,t),ac=(i,t)=>i.type.mode===K.Dense?to(i,t):eo(i,t),to=(i,t)=>{const e=i.type.typeIdToChildIndex[i.typeIds[t]],n=i.children[e];return st.visit(n,i.valueOffsets[t])},eo=(i,t)=>{const e=i.type.typeIdToChildIndex[i.typeIds[t]],n=i.children[e];return st.visit(n,t)},cc=(i,t)=>{var e;return(e=i.dictionary)===null||e===void 0?void 0:e.get(i.values[t])},lc=(i,t)=>i.type.unit===Ot.DAY_TIME?io(i,t):no(i,t),io=({values:i},t)=>i.subarray(2*t,2*(t+1)),no=({values:i},t)=>{const e=i[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},so=({values:i},t)=>i[t],ro=({values:i},t)=>i[t],oo=({values:i},t)=>i[t],ao=({values:i},t)=>i[t],uc=(i,t)=>{switch(i.type.unit){case g.SECOND:return so(i,t);case g.MILLISECOND:return ro(i,t);case g.MICROSECOND:return oo(i,t);case g.NANOSECOND:return ao(i,t)}},dc=(i,t)=>{const{stride:e,children:n}=i,r=n[0].slice(t*e,e);return new L([r])};p.prototype.visitNull=w(qa);p.prototype.visitBool=w(Ka);p.prototype.visitInt=w(Za);p.prototype.visitInt8=w(Ht);p.prototype.visitInt16=w(Ht);p.prototype.visitInt32=w(Ht);p.prototype.visitInt64=w($r);p.prototype.visitUint8=w(Ht);p.prototype.visitUint16=w(Ht);p.prototype.visitUint32=w(Ht);p.prototype.visitUint64=w($r);p.prototype.visitFloat=w(Xa);p.prototype.visitFloat16=w(Qa);p.prototype.visitFloat32=w(Ht);p.prototype.visitFloat64=w(Ht);p.prototype.visitUtf8=w(Yr);p.prototype.visitLargeUtf8=w(Yr);p.prototype.visitBinary=w(Wr);p.prototype.visitLargeBinary=w(Wr);p.prototype.visitFixedSizeBinary=w(Ja);p.prototype.visitDate=w(tc);p.prototype.visitDateDay=w(zr);p.prototype.visitDateMillisecond=w(Vr);p.prototype.visitTimestamp=w(ec);p.prototype.visitTimestampSecond=w(Gr);p.prototype.visitTimestampMillisecond=w(Hr);p.prototype.visitTimestampMicrosecond=w(qr);p.prototype.visitTimestampNanosecond=w(Kr);p.prototype.visitTime=w(ic);p.prototype.visitTimeSecond=w(Qr);p.prototype.visitTimeMillisecond=w(Jr);p.prototype.visitTimeMicrosecond=w(Zr);p.prototype.visitTimeNanosecond=w(Xr);p.prototype.visitDecimal=w(nc);p.prototype.visitList=w(sc);p.prototype.visitStruct=w(oc);p.prototype.visitUnion=w(ac);p.prototype.visitDenseUnion=w(to);p.prototype.visitSparseUnion=w(eo);p.prototype.visitDictionary=w(cc);p.prototype.visitInterval=w(lc);p.prototype.visitIntervalDayTime=w(io);p.prototype.visitIntervalYearMonth=w(no);p.prototype.visitDuration=w(uc);p.prototype.visitDurationSecond=w(so);p.prototype.visitDurationMillisecond=w(ro);p.prototype.visitDurationMicrosecond=w(oo);p.prototype.visitDurationNanosecond=w(ao);p.prototype.visitFixedSizeList=w(dc);p.prototype.visitMap=w(rc);const st=new p,he=Symbol.for("keys"),ge=Symbol.for("vals"),fe=Symbol.for("kKeysAsStrings"),yn=Symbol.for("_kKeysAsStrings");class Fn{constructor(t){return this[he]=new L([t.children[0]]).memoize(),this[ge]=t.children[1],new Proxy(this,new fc)}get[fe](){return this[yn]||(this[yn]=Array.from(this[he].toArray(),String))}[Symbol.iterator](){return new hc(this[he],this[ge])}get size(){return this[he].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[he],e=this[ge],n={};for(let s=-1,r=t.length;++s`${ke(t)}: ${ke(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class hc{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),st.visit(this.vals,t)]})}}class fc{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[fe]}has(t,e){return t[fe].includes(e)}getOwnPropertyDescriptor(t,e){if(t[fe].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[fe].indexOf(e);if(n!==-1){const s=st.visit(Reflect.get(t,ge),n);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[fe].indexOf(e);return s!==-1?(pt.visit(Reflect.get(t,ge),s,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(Fn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[he]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ge]:{writable:!0,enumerable:!1,configurable:!1,value:null},[yn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let fs;function co(i,t,e,n){const{length:s=0}=i;let r=typeof t!="number"?0:t,o=typeof e!="number"?s:e;return r<0&&(r=(r%s+s)%s),o<0&&(o=(o%s+s)%s),os&&(o=s),n?n(i,r,o):[r,o]}const Nn=(i,t)=>i<0?t+i:i,ps=i=>i!==i;function Te(i){if(typeof i!=="object"||i===null)return ps(i)?ps:e=>e===i;if(i instanceof Date){const e=i.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(i)?e=>e?da(i,e):!1:i instanceof Map?yc(i):Array.isArray(i)?pc(i):i instanceof L?mc(i):bc(i,!0)}function pc(i){const t=[];for(let e=-1,n=i.length;++e!1;const n=[];for(let s=-1,r=e.length;++s{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return gc(i,e);case Map:return ys(i,e,e.keys());case Fn:case Dn:case Object:case void 0:return ys(i,e,t||Object.keys(e))}return e instanceof L?_c(i,e):!1}}function gc(i,t){const e=i.length;if(t.length!==e)return!1;for(let n=-1;++n>n}function Ri(i,t,e){const n=e.byteLength+7&-8;if(i>0||e.byteLength>3):Li(new Rn(e,i,t,null,lo)).subarray(0,n)),s}return e}function Li(i){const t=[];let e=0,n=0,s=0;for(const o of i)o&&(s|=1<0)&&(t[e++]=s);const r=new Uint8Array(t.length+7&-8);return r.set(t),r}class Rn{constructor(t,e,n,s,r){this.bytes=t,this.length=n,this.context=s,this.get=r,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index>3<<3,s=t+(t%8===0?0:8-t%8);return mn(i,t,s)+mn(i,n,e)+vc(i,s>>3,n-s>>3)}function vc(i,t,e){let n=0,s=Math.trunc(t);const r=new DataView(i.buffer,i.byteOffset,i.byteLength),o=e===void 0?i.byteLength:s+e;for(;o-s>=4;)n+=Xi(r.getUint32(s)),s+=4;for(;o-s>=2;)n+=Xi(r.getUint16(s)),s+=2;for(;o-s>=1;)n+=Xi(r.getUint8(s)),s+=1;return n}function Xi(i){let t=Math.trunc(i);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Ic=-1;class k{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return f.isSparseUnion(t)?this.children.some(e=>e.nullable):f.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:s,typeIds:r}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),r&&(t+=r.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(f.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let t=this._nullCount,e;return t<=Ic&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-mn(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,s,r,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let c;r instanceof k?(this.stride=r.stride,this.values=r.values,this.typeIds=r.typeIds,this.nullBitmap=r.nullBitmap,this.valueOffsets=r.valueOffsets):(this.stride=Rt(t),r&&((c=r[0])&&(this.valueOffsets=c),(c=r[1])&&(this.values=c),(c=r[2])&&(this.nullBitmap=c),(c=r[3])&&(this.typeIds=c)))}getValid(t){const{type:e}=this;if(f.isUnion(e)){const n=e,s=this.children[n.typeIdToChildIndex[this.typeIds[t]]],r=n.mode===K.Dense?this.valueOffsets[t]:t;return s.getValid(r)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<>3;(!r||r.byteLength<=d)&&(r=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0?(r.set(Ri(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:r})):Object.assign(this,{nullBitmap:r,_nullCount:0}));const h=r[d];n=(h&u)!==0,r[d]=e?h|u:h&~u}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,s=this._nullCount,r=this,o=this.children){return new k(t,e,n,s,r,o,this.dictionary)}slice(t,e){const{stride:n,typeId:s,children:r}=this,o=+(this._nullCount===0)-1,a=s===16?n:1,c=this._sliceBuffers(t,e,n,s);return this.clone(this.type,this.offset+t,e,o,c,r.length===0||this.valueOffsets?r:this._sliceChildren(r,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===l.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);s[e>>3]=(1<0&&s.set(Ri(this.offset,e,this.nullBitmap),0);const r=this.buffers;return r[Nt.VALIDITY]=s,this.clone(this.type,0,t,n+(t-e),r)}_sliceBuffers(t,e,n,s){let r;const{buffers:o}=this;return(r=o[Nt.TYPE])&&(o[Nt.TYPE]=r.subarray(t,t+e)),(r=o[Nt.OFFSET])&&(o[Nt.OFFSET]=r.subarray(t,t+e+1))||(r=o[Nt.DATA])&&(o[Nt.DATA]=s===6?r:r.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(s=>s.slice(e,n))}}k.prototype.children=Object.freeze([]);class Me extends O{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:s=0}=t;return new k(e,n,s,s)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=Ae(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitLargeUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=is(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=Ae(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitLargeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.data),r=D(t.nullBitmap),o=is(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,s,r])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:s}=t,r=D(t.nullBitmap),o=Ae(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,void 0,r],[s])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,r=D(t.nullBitmap),{length:o=s.reduce((c,{length:u})=>Math.max(c,u),0),nullCount:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,void 0,r],s)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,r=P(e.ArrayType,t.typeIds),{["length"]:o=r.length,["nullCount"]:a=-1}=t;if(f.isSparseUnion(e))return new k(e,n,o,a,[void 0,void 0,void 0,r],s);const c=Ae(t.valueOffsets);return new k(e,n,o,a,[c,void 0,void 0,r],s)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.indices.ArrayType,t.data),{["dictionary"]:o=new L([new Me().visit({type:e.dictionary})])}=t,{["length"]:a=r.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[void 0,r,s],[],o)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,s=D(t.nullBitmap),r=P(e.ArrayType,t.data),{["length"]:o=r.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,r,s])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new Me().visit({type:e.valueType})}=t,r=D(t.nullBitmap),{["length"]:o=s.length/Rt(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new k(e,n,o,a,[void 0,void 0,r],[s])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new Me().visit({type:e.childType})}=t,r=D(t.nullBitmap),o=Ae(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new k(e,n,a,c,[o,void 0,r],[s])}}const Sc=new Me;function E(i){return Sc.visit(i)}class ms{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndext.nullable)}function uo(i){return i.reduce((t,e)=>t+e.nullCount,0)}function ho(i){return i.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(i.length+1))}function fo(i,t,e,n){const s=[];for(let r=-1,o=i.length;++r=n)break;if(e>=c+u)continue;if(c>=e&&c+u<=n){s.push(a);continue}const d=Math.max(0,e-c),h=Math.min(n-c,u);s.push(a.slice(d,h-d))}return s.length===0&&s.push(i[0].slice(0,0)),s}function Ln(i,t,e,n){let s=0,r=0,o=t.length-1;do{if(s>=o-1)return e0?0:-1}function Ac(i,t){const{nullBitmap:e}=i;if(!e||i.nullCount<=0)return-1;let n=0;for(const s of new Rn(e,i.offset+(t||0),i.length,e,lo)){if(!s)return n;++n}return-1}function S(i,t,e){if(t===void 0)return-1;if(t===null)switch(i.typeId){case l.Union:break;case l.Dictionary:break;default:return Ac(i,e)}const n=st.getVisitFn(i),s=Te(t);for(let r=(e||0)-1,o=i.length;++r{const s=i.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let e=0;return new ms(i.data.length,n=>{const r=i.data[n].length,o=i.slice(e,e+r);return e+=r,new Oc(o)})}class Oc{constructor(t){this.vector=t,this.index=0}next(){return this.indexa.data):t;if(r.length===0||r.some(a=>!(a instanceof k)))throw new TypeError("Vector constructor expects an Array of Data instances.");const o=(e=r[0])===null||e===void 0?void 0:e.type;switch(r.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:c,indexOf:u}=go[o.typeId],d=r[0];this.isValid=h=>Un(d,h),this.get=h=>a(d,h),this.set=(h,F)=>c(d,h,F),this.indexOf=h=>u(d,h),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,_o[o.typeId]),this._offsets=ho(r);break}this.data=r,this.type=o,this.stride=Rt(o),this.numChildren=(s=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Bc(this.data)}get nullCount(){return uo(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${l[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Nn(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Mn.visit(this)}concat(...t){return new L(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new L(co(this,t,e,({data:n,_offsets:s},r,o)=>fo(n,s,r,o)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:s,ArrayType:r}=this;switch(t.typeId){case l.Int:case l.Float:case l.Decimal:case l.Time:case l.Timestamp:switch(e.length){case 0:return new r;case 1:return e[0].values.subarray(0,n*s);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*s),o.offset),o.offset+=c*s,o),{array:new r(n*s),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&te[t])):null}get isMemoized(){return f.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(f.isDictionary(this.type)){const t=new ki(this.data[0].dictionary),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new L(e)}return new ki(this)}unmemoize(){if(f.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new L(e)}return this}}bo=Symbol.toStringTag;L[bo]=(i=>{i.type=f.prototype,i.data=[],i.length=0,i.stride=1,i.numChildren=0,i._offsets=new Uint32Array([0]),i[Symbol.isConcatSpreadable]=!0;const t=Object.keys(l).map(e=>l[e]).filter(e=>typeof e=="number"&&e!==l.NONE);for(const e of t){const n=st.getVisitFnByTypeId(e),s=pt.getVisitFnByTypeId(e),r=Mi.getVisitFnByTypeId(e);go[e]={get:n,set:s,indexOf:r},_o[e]=Object.create(i,{isValid:{value:Ui(Un)},get:{value:Ui(st.getVisitFnByTypeId(e))},set:{value:po(pt.getVisitFnByTypeId(e))},indexOf:{value:yo(Mi.getVisitFnByTypeId(e))}})}return"Vector"})(L.prototype);class ki extends L{constructor(t){super(t.data);const e=this.get,n=this.set,s=this.slice,r=new Array(this.length);Object.defineProperty(this,"get",{value(o){const a=r[o];if(a!==void 0)return a;const c=e.call(this,o);return r[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),r[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new ki(s.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new L(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class bn{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}class rt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new rt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+M),(e||new rt).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):W.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new _t).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new bn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new bn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,W.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}}class U{constructor(t=[],e,n,s=W.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=gn(this.fields)),this.dictionaries=n,this.metadataVersion=s}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){const e=new Set(t),n=this.fields.filter(s=>e.has(s.name));return new U(n,this.metadata)}selectAt(t){const e=t.map(n=>this.fields[n]).filter(Boolean);return new U(e,this.metadata)}assign(...t){const e=t[0]instanceof U?t[0]:Array.isArray(t[0])?new U(t[0]):new U(t),n=[...this.fields],s=Qe(Qe(new Map,this.metadata),e.metadata),r=e.fields.filter(a=>{const c=n.findIndex(u=>u.name===a.name);return~c?(n[c]=a.clone({metadata:Qe(Qe(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=gn(r,new Map);return new U([...n,...r],s,new Map([...this.dictionaries,...o]))}}U.prototype.fields=null;U.prototype.metadata=null;U.prototype.dictionaries=null;class z{static new(...t){let[e,n,s,r]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),s===void 0&&(s=t[0].nullable),r===void 0&&(r=t[0].metadata)),new z(`${e}`,n,s,r)}constructor(t,e,n=!1,s){this.name=t,this.type=e,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,s,r]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,s=this.nullable,r=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:s=this.nullable,metadata:r=this.metadata}=t[0],z.new(e,n,s,r)}}z.prototype.type=null;z.prototype.name=null;z.prototype.nullable=null;z.prototype.metadata=null;function Qe(i,t){return new Map([...i||new Map,...t||new Map])}function gn(i,t=new Map){for(let e=-1,n=i.length;++e0&&gn(r.children,t)}return t}var Ec=Vs,Dc=_e;class je{static decode(t){t=new Dc(D(t));const e=rt.getRootAsFooter(t),n=U.decode(e.schema(),new Map,e.version());return new Fc(n,e)}static encode(t){const e=new Ec,n=U.encode(e,t.schema);rt.startRecordBatchesVector(e,t.numRecordBatches);for(const o of[...t.recordBatches()].slice().reverse())Wt.encode(e,o);const s=e.endVector();rt.startDictionariesVector(e,t.numDictionaries);for(const o of[...t.dictionaryBatches()].slice().reverse())Wt.encode(e,o);const r=e.endVector();return rt.startFooter(e),rt.addSchema(e,n),rt.addVersion(e,W.V5),rt.addRecordBatches(e,s),rt.addDictionaries(e,r),rt.finishFooterBuffer(e,rt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=W.V5,n,s){this.schema=t,this.version=e,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e=0&&t=0&&t=0&&t=0&&tthis._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return B(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(V);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return lt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return lt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return B(this,void 0,void 0,function*(){return yield this.abort(t),V})}return(t){return B(this,void 0,void 0,function*(){return yield this.close(),V})}read(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(V)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class ri extends Nc{write(t){if((t=D(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ln(this.toUint8Array(!0)):this.toUint8Array(!1).then(ln)}toUint8Array(t=!1){return t?At(this._values)[0]:B(this,void 0,void 0,function*(){var e,n,s,r;const o=[];let a=0;try{for(var c=!0,u=Jt(this),d;d=yield u.next(),e=d.done,!e;c=!0){r=d.value,c=!1;const h=r;o.push(h),a+=h.byteLength}}catch(h){n={error:h}}finally{try{!c&&!e&&(s=u.return)&&(yield s.call(u))}finally{if(n)throw n.error}}return At(o,a)[0]})}}class Ci{constructor(t){t&&(this.source=new Rc(lt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Ie{constructor(t){t instanceof Ie?this.source=t.source:t instanceof ri?this.source=new qt(lt.fromAsyncIterable(t)):Ps(t)?this.source=new qt(lt.fromNodeStream(t)):Tn(t)?this.source=new qt(lt.fromDOMStream(t)):Cs(t)?this.source=new qt(lt.fromDOMStream(t.body)):Ve(t)?this.source=new qt(lt.fromIterable(t)):Zt(t)?this.source=new qt(lt.fromAsyncIterable(t)):Be(t)&&(this.source=new qt(lt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Rc{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||V)}return(t){return Object.create(this.source.return&&this.source.return(t)||V)}}class qt{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return B(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return B(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return B(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return B(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||V;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return B(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||V;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class gs extends Ci{constructor(t,e){super(),this.position=0,this.buffer=D(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let s=e[3]*n[3];this.buffer[0]=s&65535;let r=s>>>16;return s=e[2]*n[3],r+=s,s=e[3]*n[2]>>>0,r+=s,this.buffer[0]+=r<<16,this.buffer[1]=r>>>0>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){const e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]>>0&&++e[1],e[1]>>0&&++e[2],e[2]>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${pe(this.buffer[3])} ${pe(this.buffer[2])} ${pe(this.buffer[1])} ${pe(this.buffer[0])}`}static multiply(t,e){return new wt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new wt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return wt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return wt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),s=t.length,r=new wt(e);for(let o=n?1:0;o0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}}class Uc extends vo{constructor(t,e,n,s,r){super(new Uint8Array(0),e,n,s,r),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Li(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return P(Uint8Array,P(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return P(Uint8Array,P(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return f.isTimestamp(t)||(f.isInt(t)||f.isTime(t))&&t.bitWidth===64||f.isDuration(t)||f.isDate(t)&&t.unit===ft.MILLISECOND?P(Uint8Array,tt.convertArray(n[e])):f.isDecimal(t)?P(Uint8Array,wt.convertArray(n[e])):f.isBinary(t)||f.isLargeBinary(t)||f.isFixedSizeBinary(t)?Mc(n[e]):f.isBool(t)?Li(n[e]):f.isUtf8(t)||f.isLargeUtf8(t)?Bn(n[e].join("")):P(Uint8Array,P(t.ArrayType,n[e].map(s=>+s)))}}function Mc(i){const t=i.join(""),e=new Uint8Array(t.length/2);for(let n=0;n>1]=Number.parseInt(t.slice(n,n+2),16);return e}class b extends O{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,s)=>this.compareFields(n,e[s]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}}function X(i,t){return t instanceof i.constructor}function te(i,t){return i===t||X(i,t)}function kt(i,t){return i===t||X(i,t)&&i.bitWidth===t.bitWidth&&i.isSigned===t.isSigned}function Yi(i,t){return i===t||X(i,t)&&i.precision===t.precision}function kc(i,t){return i===t||X(i,t)&&i.byteWidth===t.byteWidth}function Pn(i,t){return i===t||X(i,t)&&i.unit===t.unit}function $e(i,t){return i===t||X(i,t)&&i.unit===t.unit&&i.timezone===t.timezone}function We(i,t){return i===t||X(i,t)&&i.unit===t.unit&&i.bitWidth===t.bitWidth}function Cc(i,t){return i===t||X(i,t)&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}function Pc(i,t){return i===t||X(i,t)&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}function xn(i,t){return i===t||X(i,t)&&i.mode===t.mode&&i.typeIds.every((e,n)=>e===t.typeIds[n])&&Yt.compareManyFields(i.children,t.children)}function xc(i,t){return i===t||X(i,t)&&i.id===t.id&&i.isOrdered===t.isOrdered&&Yt.visit(i.indices,t.indices)&&Yt.visit(i.dictionary,t.dictionary)}function jn(i,t){return i===t||X(i,t)&&i.unit===t.unit}function Ye(i,t){return i===t||X(i,t)&&i.unit===t.unit}function jc(i,t){return i===t||X(i,t)&&i.listSize===t.listSize&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}function zc(i,t){return i===t||X(i,t)&&i.keysSorted===t.keysSorted&&i.children.length===t.children.length&&Yt.compareManyFields(i.children,t.children)}b.prototype.visitNull=te;b.prototype.visitBool=te;b.prototype.visitInt=kt;b.prototype.visitInt8=kt;b.prototype.visitInt16=kt;b.prototype.visitInt32=kt;b.prototype.visitInt64=kt;b.prototype.visitUint8=kt;b.prototype.visitUint16=kt;b.prototype.visitUint32=kt;b.prototype.visitUint64=kt;b.prototype.visitFloat=Yi;b.prototype.visitFloat16=Yi;b.prototype.visitFloat32=Yi;b.prototype.visitFloat64=Yi;b.prototype.visitUtf8=te;b.prototype.visitLargeUtf8=te;b.prototype.visitBinary=te;b.prototype.visitLargeBinary=te;b.prototype.visitFixedSizeBinary=kc;b.prototype.visitDate=Pn;b.prototype.visitDateDay=Pn;b.prototype.visitDateMillisecond=Pn;b.prototype.visitTimestamp=$e;b.prototype.visitTimestampSecond=$e;b.prototype.visitTimestampMillisecond=$e;b.prototype.visitTimestampMicrosecond=$e;b.prototype.visitTimestampNanosecond=$e;b.prototype.visitTime=We;b.prototype.visitTimeSecond=We;b.prototype.visitTimeMillisecond=We;b.prototype.visitTimeMicrosecond=We;b.prototype.visitTimeNanosecond=We;b.prototype.visitDecimal=te;b.prototype.visitList=Cc;b.prototype.visitStruct=Pc;b.prototype.visitUnion=xn;b.prototype.visitDenseUnion=xn;b.prototype.visitSparseUnion=xn;b.prototype.visitDictionary=xc;b.prototype.visitInterval=jn;b.prototype.visitIntervalDayTime=jn;b.prototype.visitIntervalYearMonth=jn;b.prototype.visitDuration=Ye;b.prototype.visitDurationSecond=Ye;b.prototype.visitDurationMillisecond=Ye;b.prototype.visitDurationMicrosecond=Ye;b.prototype.visitDurationNanosecond=Ye;b.prototype.visitFixedSizeList=jc;b.prototype.visitMap=zc;const Yt=new b;function _n(i,t){return Yt.compareSchemas(i,t)}function tn(i,t){return Vc(i,t.map(e=>e.data.concat()))}function Vc(i,t){const e=[...i.fields],n=[],s={numBatches:t.reduce((h,F)=>Math.max(h,F.length),0)};let r=0,o=0,a=-1;const c=t.length;let u,d=[];for(;s.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a0&&(n[r++]=E({type:new J(e),length:o,nullCount:0,children:d.slice()})))}return[i=i.assign(e),n.map(h=>new it(i,h))]}function $c(i,t,e,n,s){var r;const o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a=t)d===t?e[a]=u:(e[a]=u.slice(0,t),s.numBatches=Math.max(s.numBatches,n[a].unshift(u.slice(t,d-t))));else{const h=i[a];i[a]=h.clone({nullable:!0}),e[a]=(r=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&r!==void 0?r:E({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var Io;class Q{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new U([]),this._offsets=[0],this;let s,r;t[0]instanceof U&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(r=t.pop());const o=c=>{if(c){if(c instanceof it)return[c];if(c instanceof Q)return c.batches;if(c instanceof k){if(c.type instanceof J)return[new it(new U(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(u=>o(u));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(u=>o(u));if(typeof c=="object"){const u=Object.keys(c),d=u.map(A=>new L([c[A]])),h=s??new U(u.map((A,H)=>new z(String(A),d[H].type,d[H].nullable))),[,F]=tn(h,d);return F.length===0?[new it(c)]:F}}}return[]},a=t.flatMap(c=>o(c));if(s=(n=s??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new U([]),!(s instanceof U))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const c of a){if(!(c instanceof it))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!_n(s,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=r??ho(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=uo(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Nn(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Mn.visit(new L(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[ ${this.toArray().join(`, `)} -]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap(({data:s})=>s));return new Q(e,n.map(s=>new it(e,s)))}slice(t,e){const n=this.schema;[t,e]=co({length:this.numRows},t,e);const s=fo(this.data,this._offsets,t,e);return new Q(n,s.map(r=>new it(n,r)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&tn.children[t]);if(e.length===0){const{type:n}=this.schema.fields[t],s=E({type:n,length:0,nullCount:0});e.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new L(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=[...this.batches];if(t>-1&&tthis.getChildAt(u));[r[t],a[t]]=[o,e],[n,s]=tn(n,a)}return new Q(n,s)}select(t){const e=this.schema.fields.reduce((n,s,r)=>n.set(s.name,r),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map(s=>s.selectAt(t));return new Q(e,n)}assign(t){const e=this.schema.fields,[n,s]=t.schema.fields.reduce((a,c,u)=>{const[d,h]=a,F=e.findIndex(T=>T.name===c.name);return~F?h[F]=u:d.push(u),a},[[],[]]),r=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,s[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new Q(...tn(r,o))}}Io=Symbol.toStringTag;Q[Io]=(i=>(i.schema=null,i.batches=[],i._offsets=new Uint32Array([0]),i._nullCount=-1,i[Symbol.isConcatSpreadable]=!0,i.isValid=Ui(Un),i.get=Ui(st.getVisitFn(l.Struct)),i.set=po(pt.getVisitFn(l.Struct)),i.indexOf=yo(Mi.getVisitFn(l.Struct)),"Table"))(Q.prototype);var So;let it=class Ue{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=E({nullCount:0,type:new J(this.schema.fields),children:this.schema.fields.map(e=>E({type:e.type,nullCount:0}))})]=t,!(this.data instanceof k))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=_s(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:s,length:r}=Object.keys(e).reduce((c,u,d)=>(c.children[d]=e[u],c.length=Math.max(c.length,e[u].length),c.fields[d]=z.new({name:u,type:e[u].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new U(n),a=E({type:new J(n),length:r,children:s,nullCount:0});[this.schema,this.data]=_s(o,a.children,r);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Bo(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return st.visit(this.data,t)}at(t){return this.get(Nn(t,this.numRows))}set(t,e){return pt.visit(this.data,t,e)}indexOf(t,e){return Mi.visit(this.data,t,e)}[Symbol.iterator](){return Mn.visit(new L([this.data]))}toArray(){return[...this]}concat(...t){return new Q(this.schema,[this,...t])}slice(t,e){const[n]=new L([this.data]).slice(t,e).data;return new Ue(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&ts.name===t),e)}setChildAt(t,e){let n=this.schema,s=this.data;if(t>-1&&ta.name===r);~o&&(s[o]=this.data.children[o])}return new Ue(e,E({type:n,length:this.numRows,children:s}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(r=>this.data.children[r]).filter(Boolean),s=E({type:new J(e.fields),length:this.numRows,children:n});return new Ue(e,s)}};So=Symbol.toStringTag;it[So]=(i=>(i._nullCount=-1,i[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(it.prototype);function _s(i,t,e=t.reduce((n,s)=>Math.max(n,s.length),0)){var n;const s=[...i.fields],r=[...t],o=(e+63&-64)>>3;for(const[a,c]of i.fields.entries()){const u=t[a];(!u||u.length!==e)&&(s[a]=c.clone({nullable:!0}),r[a]=(n=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:E({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[i.assign(s),E({type:new J(s),length:e,children:r})]}function Bo(i,t,e=new Map){var n,s;if(((n=i==null?void 0:i.length)!==null&&n!==void 0?n:0)>0&&(i==null?void 0:i.length)===(t==null?void 0:t.length))for(let r=-1,o=i.length;++rE({type:s.type})),n=E({type:new J(t.fields),nullCount:0,children:e});super(t,n)}}let xt=class gt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+M),(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):W.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):R.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,W.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,R.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,s,r,o){return gt.startMessage(t),gt.addVersion(t,e),gt.addHeaderType(t,n),gt.addHeader(t,s),gt.addBodyLength(t,r),gt.addCustomMetadata(t,o),gt.endMessage(t)}};class Wc extends O{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return us.startNull(e),us.endNull(e)}visitInt(t,e){return ot.startInt(e),ot.addBitWidth(e,t.bitWidth),ot.addIsSigned(e,t.isSigned),ot.endInt(e)}visitFloat(t,e){return It.startFloatingPoint(e),It.addPrecision(e,t.precision),It.endFloatingPoint(e)}visitBinary(t,e){return rs.startBinary(e),rs.endBinary(e)}visitLargeBinary(t,e){return as.startLargeBinary(e),as.endLargeBinary(e)}visitBool(t,e){return os.startBool(e),os.endBool(e)}visitUtf8(t,e){return ds.startUtf8(e),ds.endUtf8(e)}visitLargeUtf8(t,e){return cs.startLargeUtf8(e),cs.endLargeUtf8(e)}visitDecimal(t,e){return oe.startDecimal(e),oe.addScale(e,t.scale),oe.addPrecision(e,t.precision),oe.addBitWidth(e,t.bitWidth),oe.endDecimal(e)}visitDate(t,e){return Xe.startDate(e),Xe.addUnit(e,t.unit),Xe.endDate(e)}visitTime(t,e){return ut.startTime(e),ut.addUnit(e,t.unit),ut.addBitWidth(e,t.bitWidth),ut.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return dt.startTimestamp(e),dt.addUnit(e,t.unit),n!==void 0&&dt.addTimezone(e,n),dt.endTimestamp(e)}visitInterval(t,e){return St.startInterval(e),St.addUnit(e,t.unit),St.endInterval(e)}visitDuration(t,e){return ti.startDuration(e),ti.addUnit(e,t.unit),ti.endDuration(e)}visitList(t,e){return ls.startList(e),ls.endList(e)}visitStruct(t,e){return Qt.startStruct_(e),Qt.endStruct_(e)}visitUnion(t,e){et.startTypeIdsVector(e,t.typeIds.length);const n=et.createTypeIdsVector(e,t.typeIds);return et.startUnion(e),et.addMode(e,t.mode),et.addTypeIds(e,n),et.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return Ut.startDictionaryEncoding(e),Ut.addId(e,BigInt(t.id)),Ut.addIsOrdered(e,t.isOrdered),n!==void 0&&Ut.addIndexType(e,n),Ut.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ei.startFixedSizeBinary(e),ei.addByteWidth(e,t.byteWidth),ei.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return ii.startFixedSizeList(e),ii.addListSize(e,t.listSize),ii.endFixedSizeList(e)}visitMap(t,e){return ni.startMap(e),ni.addKeysSorted(e,t.keysSorted),ni.endMap(e)}}const en=new Wc;function Yc(i,t=new Map){return new U(Hc(i,t),oi(i.metadata),t)}function Ao(i){return new at(i.count,To(i.columns),Oo(i.columns))}function Gc(i){return new Et(Ao(i.data),i.id,i.isDelta)}function Hc(i,t){return(i.fields||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function ws(i,t){return(i.children||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function To(i){return(i||[]).reduce((t,e)=>[...t,new Gt(e.count,qc(e.VALIDITY)),...To(e.children)],[])}function Oo(i,t=[]){for(let e=-1,n=(i||[]).length;++et+ +(e===0),0)}function Kc(i,t){let e,n,s,r,o,a;return!t||!(r=i.dictionary)?(o=Is(i,ws(i,t)),s=new z(i.name,o,i.nullable,oi(i.metadata))):t.has(e=r.id)?(n=(n=r.indexType)?vs(n):new xe,a=new ve(t.get(e),n,e,r.isOrdered),s=new z(i.name,a,i.nullable,oi(i.metadata))):(n=(n=r.indexType)?vs(n):new xe,t.set(e,o=Is(i,ws(i,t))),a=new ve(o,n,e,r.isOrdered),s=new z(i.name,a,i.nullable,oi(i.metadata))),s||null}function oi(i=[]){return new Map(i.map(({key:t,value:e})=>[t,e]))}function vs(i){return new Xt(i.isSigned,i.bitWidth)}function Is(i,t){const e=i.type.name;switch(e){case"NONE":return new $t;case"null":return new $t;case"binary":return new mi;case"largebinary":return new bi;case"utf8":return new gi;case"largeutf8":return new _i;case"bool":return new wi;case"list":return new Oi((t||[])[0]);case"struct":return new J(t||[]);case"struct_":return new J(t||[])}switch(e){case"int":{const n=i.type;return new Xt(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=i.type;return new yi(q[n.precision])}case"decimal":{const n=i.type;return new vi(n.scale,n.precision,n.bitWidth)}case"date":{const n=i.type;return new Ii(ft[n.unit])}case"time":{const n=i.type;return new Si(g[n.unit],n.bitWidth)}case"timestamp":{const n=i.type;return new Bi(g[n.unit],n.timezone)}case"interval":{const n=i.type;return new Ai(Ot[n.unit])}case"duration":{const n=i.type;return new Ti(g[n.unit])}case"union":{const n=i.type,[s,...r]=(n.mode+"").toLowerCase(),o=s.toUpperCase()+r.join("");return new Ei(K[o],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=i.type;return new Di(n.byteWidth)}case"fixedsizelist":{const n=i.type;return new Fi(n.listSize,(t||[])[0])}case"map":{const n=i.type;return new Ni((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Qc=Vs,Jc=_e;class Z{static fromJSON(t,e){const n=new Z(0,W.V5,e);return n._createHeader=Zc(t,e),n}static decode(t){t=new Jc(D(t));const e=xt.getRootAsMessage(t),n=e.bodyLength(),s=e.version(),r=e.headerType(),o=new Z(n,s,r);return o._createHeader=Xc(e,r),o}static encode(t){const e=new Qc;let n=-1;return t.isSchema()?n=U.encode(e,t.header()):t.isRecordBatch()?n=at.encode(e,t.header()):t.isDictionaryBatch()&&(n=Et.encode(e,t.header())),xt.startMessage(e),xt.addVersion(e,W.V5),xt.addHeader(e,n),xt.addHeaderType(e,t.headerType),xt.addBodyLength(e,BigInt(t.bodyLength)),xt.finishMessageBuffer(e,xt.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new Z(0,W.V5,R.Schema,t);if(t instanceof at)return new Z(e,W.V5,R.RecordBatch,t);if(t instanceof Et)return new Z(e,W.V5,R.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}constructor(t,e,n,s){this._version=e,this._headerType=n,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=x(t)}}class at{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=x(t)}}class Et{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=x(e)}}class At{constructor(t,e){this.offset=x(t),this.length=x(e)}}class Gt{constructor(t,e){this.length=x(t),this.nullCount=x(e)}}function Zc(i,t){return()=>{switch(t){case R.Schema:return U.fromJSON(i);case R.RecordBatch:return at.fromJSON(i);case R.DictionaryBatch:return Et.fromJSON(i)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function Xc(i,t){return()=>{switch(t){case R.Schema:return U.decode(i.header(new _t),new Map,i.version());case R.RecordBatch:return at.decode(i.header(new Ft),i.version());case R.DictionaryBatch:return Et.decode(i.header(new se),i.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}z.encode=ul;z.decode=cl;z.fromJSON=Kc;U.encode=ll;U.decode=tl;U.fromJSON=Yc;at.encode=dl;at.decode=el;at.fromJSON=Ao;Et.encode=hl;Et.decode=il;Et.fromJSON=Gc;Gt.encode=fl;Gt.decode=sl;At.encode=pl;At.decode=nl;function tl(i,t=new Map,e=W.V5){const n=al(i,t);return new U(n,ai(i),t,e)}function el(i,t=W.V5){if(i.compression()!==null)throw new Error("Record batch compression not implemented");return new at(i.length(),rl(i),ol(i,t))}function il(i,t=W.V5){return new Et(at.decode(i.data(),t),i.id(),i.isDelta())}function nl(i){return new At(i.offset(),i.length())}function sl(i){return new Gt(i.length(),i.nullCount())}function rl(i){const t=[];for(let e,n=-1,s=-1,r=i.nodesLength();++nz.encode(i,r));_t.startFieldsVector(i,e.length);const n=_t.createFieldsVector(i,e),s=t.metadata&&t.metadata.size>0?_t.createCustomMetadataVector(i,[...t.metadata].map(([r,o])=>{const a=i.createString(`${r}`),c=i.createString(`${o}`);return G.startKeyValue(i),G.addKey(i,a),G.addValue(i,c),G.endKeyValue(i)})):-1;return _t.startSchema(i),_t.addFields(i,n),_t.addEndianness(i,yl?we.Little:we.Big),s!==-1&&_t.addCustomMetadata(i,s),_t.endSchema(i)}function ul(i,t){let e=-1,n=-1,s=-1;const r=t.type;let o=t.typeId;f.isDictionary(r)?(o=r.dictionary.typeId,s=en.visit(r,i),n=en.visit(r.dictionary,i)):n=en.visit(r,i);const a=(r.children||[]).map(d=>z.encode(i,d)),c=ct.createChildrenVector(i,a),u=t.metadata&&t.metadata.size>0?ct.createCustomMetadataVector(i,[...t.metadata].map(([d,h])=>{const F=i.createString(`${d}`),T=i.createString(`${h}`);return G.startKeyValue(i),G.addKey(i,F),G.addValue(i,T),G.endKeyValue(i)})):-1;return t.name&&(e=i.createString(t.name)),ct.startField(i),ct.addType(i,n),ct.addTypeType(i,o),ct.addChildren(i,c),ct.addNullable(i,!!t.nullable),e!==-1&&ct.addName(i,e),s!==-1&&ct.addDictionary(i,s),u!==-1&&ct.addCustomMetadata(i,u),ct.endField(i)}function dl(i,t){const e=t.nodes||[],n=t.buffers||[];Ft.startNodesVector(i,e.length);for(const o of e.slice().reverse())Gt.encode(i,o);const s=i.endVector();Ft.startBuffersVector(i,n.length);for(const o of n.slice().reverse())At.encode(i,o);const r=i.endVector();return Ft.startRecordBatch(i),Ft.addLength(i,BigInt(t.length)),Ft.addNodes(i,s),Ft.addBuffers(i,r),Ft.endRecordBatch(i)}function hl(i,t){const e=at.encode(i,t.data);return se.startDictionaryBatch(i),se.addId(i,BigInt(t.id)),se.addIsDelta(i,t.isDelta),se.addData(i,e),se.endDictionaryBatch(i)}function fl(i,t){return Ys.createFieldNode(i,BigInt(t.length),BigInt(t.nullCount))}function pl(i,t){return Ws.createBuffer(i,BigInt(t.offset),BigInt(t.length))}const yl=(()=>{const i=new ArrayBuffer(2);return new DataView(i).setInt16(0,256,!0),new Int16Array(i)[0]===256})(),Vn=i=>`Expected ${R[i]} Message in stream, but was null or length 0.`,$n=i=>`Header pointer of flatbuffer-encoded ${R[i]} Message is null or length 0.`,Eo=(i,t)=>`Expected to read ${i} metadata bytes, but only read ${t}.`,Do=(i,t)=>`Expected to read ${i} bytes for message body, but only read ${t}.`;class Fo{constructor(t){this.source=t instanceof Ci?t:new Ci(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?V:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Vn(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=D(this.source.read(t));if(e.byteLength[...s,...r.VALIDITY&&[r.VALIDITY]||[],...r.TYPE_ID&&[r.TYPE_ID]||[],...r.OFFSET&&[r.OFFSET]||[],...r.DATA&&[r.DATA]||[],...e(r.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Vn(t));return e.value}readSchema(){const t=R.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error($n(t));return n}}const Gi=4,wn="ARROW1",ze=new Uint8Array(wn.length);for(let i=0;ithis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return lt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return lt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof ht?t:un(t)?Il(t):ks(t)?Al(t):Zt(t)?B(this,void 0,void 0,function*(){return yield ht.from(yield t)}):Cs(t)||An(t)||Ps(t)||Be(t)?Bl(new Ie(t)):Sl(new Ci(t))}static readAll(t){return t instanceof ht?t.isSync()?Ts(t):Os(t):un(t)||ArrayBuffer.isView(t)||Ve(t)||Ms(t)?Ts(t):Os(t)}}class xi extends ht{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Bt(this,arguments,function*(){yield A(yield*Ze(Jt(this[Symbol.iterator]())))})}}class ji extends ht{constructor(t){super(t),this._impl=t}readAll(){return B(this,void 0,void 0,function*(){var t,e,n,s;const r=new Array;try{for(var o=!0,a=Jt(this),c;c=yield a.next(),t=c.done,!t;o=!0){s=c.value,o=!1;const u=s;r.push(u)}}catch(u){e={error:u}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return r})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Ro extends xi{constructor(t){super(t),this._impl=t}}class _l extends ji{constructor(t){super(t),this._impl=t}}class Lo{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const n=this._loadVectors(t,e,this.schema.fields),s=E({type:new J(this.schema.fields),length:t.length,children:n});return new it(this.schema,s)}_loadDictionaryBatch(t,e){const{id:n,isDelta:s}=t,{dictionaries:r,schema:o}=this,a=r.get(n),c=o.dictionaries.get(n),u=this._loadVectors(t.data,e,[c]);return(a&&s?a.concat(new L(u)):new L(u)).memoize()}_loadVectors(t,e,n){return new vo(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class zi extends Lo{constructor(t,e){super(e),this._reader=un(t)?new bl(this._handle=t):new Fo(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Mo(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):V}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):V}next(){if(this.closed)return V;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new zn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Vi extends Lo{constructor(t,e){super(e),this._reader=new ml(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return B(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return B(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Mo(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return B(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):V})}return(t){return B(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):V})}next(){return B(this,void 0,void 0,function*(){if(this.closed)return V;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new zn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return B(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Uo extends zi{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof gs?t:new gs(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(R.RecordBatch);if(s!=null&&s.isRecordBatch()){const r=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(r,o)}}return null}_readDictionaryBatch(t){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(R.DictionaryBatch);if(s!=null&&s.isDictionaryBatch()){const r=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(r,o);this.dictionaries.set(r.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-No,n=t.readInt32(e),s=t.readAt(e-n,n);return je.decode(s)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return B(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return B(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(R.RecordBatch);if(s!=null&&s.isRecordBatch()){const r=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(r,o)}}return null})}_readDictionaryBatch(t){return B(this,void 0,void 0,function*(){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(R.DictionaryBatch);if(s!=null&&s.isDictionaryBatch()){const r=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(r,o);this.dictionaries.set(r.id,a)}}})}_readFooter(){return B(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-No,n=yield t.readInt32(e),s=yield t.readAt(e-n,n);return je.decode(s)})}_readNextMessageAndValidate(t){return B(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?Wn(t)?new Ro(new Uo(i.read())):new xi(new zi(i)):new xi(new zi(function*(){}()))}function Bl(i){return B(this,void 0,void 0,function*(){const t=yield i.peek(Ge+7&-8);return t&&t.byteLength>=4?Wn(t)?new Ro(new Uo(yield i.read())):new ji(new Vi(i)):new ji(new Vi(function(){return Bt(this,arguments,function*(){})}()))})}function Al(i){return B(this,void 0,void 0,function*(){const{size:t}=yield i.stat(),e=new Pi(i,t);return t>=gl&&Wn(yield e.readAt(0,Ge+7&-8))?new _l(new wl(e)):new ji(new Vi(e))})}class $ extends O{static assemble(...t){const e=s=>s.flatMap(r=>Array.isArray(r)?e(r):r instanceof it?r.data.children:r.data),n=new $;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof L)return this.visitMany(t.data),this;const{type:e}=t;if(!f.isDictionary(e)){const{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(f.isUnion(e))this.nodes.push(new Gt(n,0));else{const{nullCount:s}=t;f.isNull(e)||mt.call(this,s<=0?new Uint8Array(0):Ri(t.offset,n,t.nullBitmap)),this.nodes.push(new Gt(n,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function mt(i){const t=i.byteLength+7&-8;return this.buffers.push(i),this.bufferRegions.push(new At(this._byteLength,t)),this._byteLength+=t,this}function Tl(i){var t;const{type:e,length:n,typeIds:s,valueOffsets:r}=i;if(mt.call(this,s),e.mode===K.Sparse)return vn.call(this,i);if(e.mode===K.Dense){if(i.offset<=0)return mt.call(this,r),vn.call(this,i);{const o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let u,d,h=-1;++h{const h=e.typeIds[d],F=a[h],T=c[h];return u.slice(F,Math.min(n,T))}))}}return this}function Ol(i){let t;return i.nullCount>=i.length?mt.call(this,new Uint8Array(0)):(t=i.values)instanceof Uint8Array?mt.call(this,Ri(i.offset,i.length,t)):mt.call(this,Li(i.values))}function Ct(i){return mt.call(this,i.values.subarray(0,i.length*i.stride))}function Hi(i){const{length:t,values:e,valueOffsets:n}=i,s=x(n[0]),r=x(n[t]),o=Math.min(r-s,e.byteLength-s);return mt.call(this,js(-s,t+1,n)),mt.call(this,e.subarray(s,s+o)),this}function Yn(i){const{length:t,valueOffsets:e}=i;if(e){const{[0]:n,[t]:s}=e;return mt.call(this,js(-n,t+1,e)),this.visit(i.children[0].slice(n,s-n))}return this.visit(i.children[0])}function vn(i){return this.visitMany(i.type.children.map((t,e)=>i.children[e]).filter(Boolean))[0]}$.prototype.visitBool=Ol;$.prototype.visitInt=Ct;$.prototype.visitFloat=Ct;$.prototype.visitUtf8=Hi;$.prototype.visitLargeUtf8=Hi;$.prototype.visitBinary=Hi;$.prototype.visitLargeBinary=Hi;$.prototype.visitFixedSizeBinary=Ct;$.prototype.visitDate=Ct;$.prototype.visitTimestamp=Ct;$.prototype.visitTime=Ct;$.prototype.visitDecimal=Ct;$.prototype.visitList=Yn;$.prototype.visitStruct=vn;$.prototype.visitUnion=Tl;$.prototype.visitInterval=Ct;$.prototype.visitDuration=Ct;$.prototype.visitFixedSizeList=Yn;$.prototype.visitMap=Yn;class ko extends kn{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new ri,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,nt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Zt(t)?t.then(e=>this.writeAll(e)):Be(t)?Kn(this,t):qn(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof ri?this._sink=t:(this._sink=new ri,t&&sa(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ra(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!_n(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Q&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof it&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!_n(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof it?t instanceof zn||this._writeRecordBatch(t):t instanceof Q?this.writeAll(t.batches):Ve(t)&&this.writeAll(t)}_writeMessage(t,e=8){const n=e-1,s=Z.encode(t),r=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=r+o+n&~n,c=a-r-o;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new Wt(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new Wt(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),r>0&&this._write(s),this._writePadding(c)}_write(t){if(this._started){const e=D(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Z.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ze)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:n,bufferRegions:s,buffers:r}=$.assemble(t),o=new at(t.numRows,n,s),a=Z.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(r)}_writeDictionaryBatch(t,e,n=!1){const{byteLength:s,nodes:r,bufferRegions:o,buffers:a}=$.assemble(new L([t])),c=new at(t.length,r,o),u=new Et(c,e,n),d=Z.from(u,s);return this._writeMessage(d)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,s;for(let r=-1,o=t.length;++r0&&(this._write(e),(s=(n+7&-8)-n)>0&&this._writePadding(s));return this}_writeDictionaries(t){var e,n;for(const[s,r]of t.dictionaries){const o=(e=r==null?void 0:r.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(s),c=(n=this._dictionaryDeltaOffsets.get(s))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(const[u,d]of o.entries())this._writeDictionaryBatch(d,s,u>0);else if(cn.writeAll(s)):Be(t)?Kn(n,t):qn(n,t)}}class Hn extends ko{static writeAll(t){const e=new Hn;return Zt(t)?t.then(n=>e.writeAll(n)):Be(t)?Kn(e,t):qn(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){const e=je.encode(new je(t,W.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function qn(i,t){let e=t;t instanceof Q&&(e=t.batches,i.reset(void 0,t.schema));for(const n of e)i.write(n);return i.finish()}function Kn(i,t){return B(this,void 0,void 0,function*(){var e,n,s,r,o,a,c;try{for(e=!0,n=Jt(t);s=yield n.next(),r=s.done,!r;e=!0){c=s.value,e=!1;const u=c;i.write(u)}}catch(u){o={error:u}}finally{try{!e&&!r&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return i.finish()})}function El(i,t="stream"){return(t==="stream"?Gn:Hn).writeAll(i).toUint8Array(!0)}var Dl=Object.create,Co=Object.defineProperty,Fl=Object.getOwnPropertyDescriptor,Nl=Object.getOwnPropertyNames,Rl=Object.getPrototypeOf,Ll=Object.prototype.hasOwnProperty,Ul=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ml=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Nl(t))!Ll.call(i,s)&&s!==e&&Co(i,s,{get:()=>t[s],enumerable:!(n=Fl(t,s))||n.enumerable});return i},kl=(i,t,e)=>(e=i!=null?Dl(Rl(i)):{},Ml(!i||!i.__esModule?Co(e,"default",{value:i,enumerable:!0}):e,i)),Cl=Ul((i,t)=>{t.exports=Worker}),Pl=(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i.AUTOMATIC=1]="AUTOMATIC",i[i.READ_ONLY=2]="READ_ONLY",i[i.READ_WRITE=3]="READ_WRITE",i))(Pl||{}),xl=(i=>(i[i.IDENTIFIER=0]="IDENTIFIER",i[i.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",i[i.STRING_CONSTANT=2]="STRING_CONSTANT",i[i.OPERATOR=3]="OPERATOR",i[i.KEYWORD=4]="KEYWORD",i[i.COMMENT=5]="COMMENT",i))(xl||{}),jl=(i=>(i[i.NONE=0]="NONE",i[i.DEBUG=1]="DEBUG",i[i.INFO=2]="INFO",i[i.WARNING=3]="WARNING",i[i.ERROR=4]="ERROR",i))(jl||{}),zl=(i=>(i[i.NONE=0]="NONE",i[i.CONNECT=1]="CONNECT",i[i.DISCONNECT=2]="DISCONNECT",i[i.OPEN=3]="OPEN",i[i.QUERY=4]="QUERY",i[i.INSTANTIATE=5]="INSTANTIATE",i))(zl||{}),Vl=(i=>(i[i.NONE=0]="NONE",i[i.OK=1]="OK",i[i.ERROR=2]="ERROR",i[i.START=3]="START",i[i.RUN=4]="RUN",i[i.CAPTURE=5]="CAPTURE",i))(Vl||{}),$l=(i=>(i[i.NONE=0]="NONE",i[i.WEB_WORKER=1]="WEB_WORKER",i[i.NODE_WORKER=2]="NODE_WORKER",i[i.BINDINGS=3]="BINDINGS",i[i.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",i))($l||{}),Wl=class{constructor(i=2){this.level=i}log(i){i.level>=this.level&&console.log(i)}},Yl=(i=>(i[i.SUCCESS=0]="SUCCESS",i))(Yl||{}),Gl=class{constructor(i,t){this._bindings=i,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(i){return i(this._bindings,this._conn)}async query(i){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:i});let t=await this._bindings.runQuery(this._conn,i),e=ht.from(t);return console.assert(e.isSync(),"Reader is not sync"),console.assert(e.isFile(),"Reader is not file"),new Q(e)}async send(i){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:i});let t=await this._bindings.startPendingQuery(this._conn,i);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let e=new Po(this._bindings,this._conn,t),n=await ht.from(e);return console.assert(n.isAsync()),console.assert(n.isStream()),n}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(i){return await this._bindings.getTableNames(this._conn,i)}async prepare(i){let t=await this._bindings.createPrepared(this._conn,i);return new Hl(this._bindings,this._conn,t)}async insertArrowTable(i,t){let e=El(i,"stream");await this.insertArrowFromIPCStream(e,t)}async insertArrowFromIPCStream(i,t){await this._bindings.insertArrowFromIPCStream(this._conn,i,t)}async insertCSVFromPath(i,t){await this._bindings.insertCSVFromPath(this._conn,i,t)}async insertJSONFromPath(i,t){await this._bindings.insertJSONFromPath(this._conn,i,t)}},Po=class{constructor(i,t,e){this.db=i,this.conn=t,this.header=e,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let i;return this._inFlight!=null?(i=await this._inFlight,this._inFlight=null):i=await this.db.fetchQueryResults(this.conn),this._depleted=i.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:i}}[Symbol.asyncIterator](){return this}},Hl=class{constructor(i,t,e){this.bindings=i,this.connectionId=t,this.statementId=e}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...i){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,i),e=ht.from(t);return console.assert(e.isSync()),console.assert(e.isFile()),new Q(e)}async send(...i){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,i),e=new Po(this.bindings,this.connectionId,t),n=await ht.from(e);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},ql=(i=>(i.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",i.CLOSE_PREPARED="CLOSE_PREPARED",i.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",i.CONNECT="CONNECT",i.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",i.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",i.CREATE_PREPARED="CREATE_PREPARED",i.DISCONNECT="DISCONNECT",i.DROP_FILE="DROP_FILE",i.DROP_FILES="DROP_FILES",i.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",i.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",i.FLUSH_FILES="FLUSH_FILES",i.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",i.GET_TABLE_NAMES="GET_TABLE_NAMES",i.GET_VERSION="GET_VERSION",i.GLOB_FILE_INFOS="GLOB_FILE_INFOS",i.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",i.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",i.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",i.INSTANTIATE="INSTANTIATE",i.OPEN="OPEN",i.PING="PING",i.POLL_PENDING_QUERY="POLL_PENDING_QUERY",i.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",i.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",i.REGISTER_FILE_URL="REGISTER_FILE_URL",i.RESET="RESET",i.RUN_PREPARED="RUN_PREPARED",i.RUN_QUERY="RUN_QUERY",i.SEND_PREPARED="SEND_PREPARED",i.START_PENDING_QUERY="START_PENDING_QUERY",i.TOKENIZE="TOKENIZE",i))(ql||{}),Kl=(i=>(i.CONNECTION_INFO="CONNECTION_INFO",i.ERROR="ERROR",i.FEATURE_FLAGS="FEATURE_FLAGS",i.FILE_BUFFER="FILE_BUFFER",i.FILE_INFOS="FILE_INFOS",i.FILE_SIZE="FILE_SIZE",i.FILE_STATISTICS="FILE_STATISTICS",i.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",i.LOG="LOG",i.OK="OK",i.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",i.QUERY_PLAN="QUERY_PLAN",i.QUERY_RESULT="QUERY_RESULT",i.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",i.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",i.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",i.REGISTERED_FILE="REGISTERED_FILE",i.SCRIPT_TOKENS="SCRIPT_TOKENS",i.SUCCESS="SUCCESS",i.TABLE_NAMES="TABLE_NAMES",i.VERSION_STRING="VERSION_STRING",i))(Kl||{}),N=class{constructor(i,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=i,this.data=t,this.promise=new Promise((e,n)=>{this.promiseResolver=e,this.promiseRejecter=n})}};function ci(i){switch(i.typeId){case l.Binary:return{sqlType:"binary"};case l.Bool:return{sqlType:"bool"};case l.Date:return{sqlType:"date"};case l.DateDay:return{sqlType:"date32[d]"};case l.DateMillisecond:return{sqlType:"date64[ms]"};case l.Decimal:{let t=i;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case l.Float:return{sqlType:"float"};case l.Float16:return{sqlType:"float16"};case l.Float32:return{sqlType:"float32"};case l.Float64:return{sqlType:"float64"};case l.Int:return{sqlType:"int32"};case l.Int16:return{sqlType:"int16"};case l.Int32:return{sqlType:"int32"};case l.Int64:return{sqlType:"int64"};case l.Uint16:return{sqlType:"uint16"};case l.Uint32:return{sqlType:"uint32"};case l.Uint64:return{sqlType:"uint64"};case l.Uint8:return{sqlType:"uint8"};case l.IntervalDayTime:return{sqlType:"interval[dt]"};case l.IntervalYearMonth:return{sqlType:"interval[m]"};case l.List:return{sqlType:"list",valueType:ci(i.valueType)};case l.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:i.byteWidth};case l.Null:return{sqlType:"null"};case l.Utf8:return{sqlType:"utf8"};case l.Struct:return{sqlType:"struct",fields:i.children.map(t=>In(t.name,t.type))};case l.Map:{let t=i;return{sqlType:"map",keyType:ci(t.keyType),valueType:ci(t.valueType)}}case l.Time:return{sqlType:"time[s]"};case l.TimeMicrosecond:return{sqlType:"time[us]"};case l.TimeMillisecond:return{sqlType:"time[ms]"};case l.TimeNanosecond:return{sqlType:"time[ns]"};case l.TimeSecond:return{sqlType:"time[s]"};case l.Timestamp:return{sqlType:"timestamp",timezone:i.timezone||void 0};case l.TimestampSecond:return{sqlType:"timestamp[s]",timezone:i.timezone||void 0};case l.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:i.timezone||void 0};case l.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:i.timezone||void 0};case l.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:i.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(i.toString()))}function In(i,t){let e=ci(t);return e.name=i,e}var Ql=new TextEncoder,Jl=class{constructor(i,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=i,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(i){this._worker=i,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,e)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(i,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let e=this._nextMessageId++;return this._pendingRequests.set(e,i),this._worker.postMessage({messageId:e,type:i.type,data:i.data},t),await i.promise}onMessage(i){var t;let e=i.data;switch(e.type){case"LOG":{this._logger.log(e.data);return}case"INSTANTIATE_PROGRESS":{for(let s of this._onInstantiationProgress)s(e.data);return}}let n=this._pendingRequests.get(e.requestId);if(!n){console.warn("unassociated response: [".concat(e.requestId,", ").concat(e.type.toString(),"]"));return}if(this._pendingRequests.delete(e.requestId),e.type=="ERROR"){let s=new Error(e.data.message);s.name=e.data.name,(t=Object.getOwnPropertyDescriptor(s,"stack"))!=null&&t.writable&&(s.stack=e.data.stack),n.promiseRejecter(s);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(e.type=="OK"){n.promiseResolver(e.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],e.type=="OK"){n.promiseResolver(e.data);return}break;case"GLOB_FILE_INFOS":if(e.type=="FILE_INFOS"){n.promiseResolver(e.data);return}break;case"GET_VERSION":if(e.type=="VERSION_STRING"){n.promiseResolver(e.data);return}break;case"GET_FEATURE_FLAGS":if(e.type=="FEATURE_FLAGS"){n.promiseResolver(e.data);return}break;case"GET_TABLE_NAMES":if(e.type=="TABLE_NAMES"){n.promiseResolver(e.data);return}break;case"TOKENIZE":if(e.type=="SCRIPT_TOKENS"){n.promiseResolver(e.data);return}break;case"COPY_FILE_TO_BUFFER":if(e.type=="FILE_BUFFER"){n.promiseResolver(e.data);return}break;case"EXPORT_FILE_STATISTICS":if(e.type=="FILE_STATISTICS"){n.promiseResolver(e.data);return}break;case"CONNECT":if(e.type=="CONNECTION_INFO"){n.promiseResolver(e.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(e.type=="QUERY_RESULT"){n.promiseResolver(e.data);return}break;case"SEND_PREPARED":if(e.type=="QUERY_RESULT_HEADER"){n.promiseResolver(e.data);return}break;case"START_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"POLL_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],e.type=="SUCCESS"){n.promiseResolver(e.data);return}break;case"FETCH_QUERY_RESULTS":if(e.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(e.data);return}break;case"CREATE_PREPARED":if(e.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(e.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(e.type.toString())))}onError(i){console.error(i),console.error("error in duckdb worker: ".concat(i.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let i=new N("RESET",null);return await this.postTask(i)}async ping(){let i=new N("PING",null);await this.postTask(i)}async dropFile(i){let t=new N("DROP_FILE",i);return await this.postTask(t)}async dropFiles(){let i=new N("DROP_FILES",null);return await this.postTask(i)}async flushFiles(){let i=new N("FLUSH_FILES",null);return await this.postTask(i)}async instantiate(i,t=null,e=n=>{}){this._onInstantiationProgress.push(e);let n=new N("INSTANTIATE",[i,t]);return await this.postTask(n)}async getVersion(){let i=new N("GET_VERSION",null);return await this.postTask(i)}async getFeatureFlags(){let i=new N("GET_FEATURE_FLAGS",null);return await this.postTask(i)}async open(i){let t=new N("OPEN",i);await this.postTask(t)}async tokenize(i){let t=new N("TOKENIZE",i);return await this.postTask(t)}async connectInternal(){let i=new N("CONNECT",null);return await this.postTask(i)}async connect(){let i=await this.connectInternal();return new Gl(this,i)}async disconnect(i){let t=new N("DISCONNECT",i);await this.postTask(t)}async runQuery(i,t){let e=new N("RUN_QUERY",[i,t]);return await this.postTask(e)}async startPendingQuery(i,t){let e=new N("START_PENDING_QUERY",[i,t]);return await this.postTask(e)}async pollPendingQuery(i){let t=new N("POLL_PENDING_QUERY",i);return await this.postTask(t)}async cancelPendingQuery(i){let t=new N("CANCEL_PENDING_QUERY",i);return await this.postTask(t)}async fetchQueryResults(i){let t=new N("FETCH_QUERY_RESULTS",i);return await this.postTask(t)}async getTableNames(i,t){let e=new N("GET_TABLE_NAMES",[i,t]);return await this.postTask(e)}async createPrepared(i,t){let e=new N("CREATE_PREPARED",[i,t]);return await this.postTask(e)}async closePrepared(i,t){let e=new N("CLOSE_PREPARED",[i,t]);await this.postTask(e)}async runPrepared(i,t,e){let n=new N("RUN_PREPARED",[i,t,e]);return await this.postTask(n)}async sendPrepared(i,t,e){let n=new N("SEND_PREPARED",[i,t,e]);return await this.postTask(n)}async globFiles(i){let t=new N("GLOB_FILE_INFOS",i);return await this.postTask(t)}async registerFileText(i,t){let e=Ql.encode(t);await this.registerFileBuffer(i,e)}async registerFileURL(i,t,e,n){t===void 0&&(t=i);let s=new N("REGISTER_FILE_URL",[i,t,e,n]);await this.postTask(s)}async registerEmptyFileBuffer(i){}async registerFileBuffer(i,t){let e=new N("REGISTER_FILE_BUFFER",[i,t]);await this.postTask(e,[t.buffer])}async registerFileHandle(i,t,e,n){let s=new N("REGISTER_FILE_HANDLE",[i,t,e,n]);await this.postTask(s,[])}async collectFileStatistics(i,t){let e=new N("COLLECT_FILE_STATISTICS",[i,t]);await this.postTask(e,[])}async exportFileStatistics(i){let t=new N("EXPORT_FILE_STATISTICS",i);return await this.postTask(t,[])}async copyFileToBuffer(i){let t=new N("COPY_FILE_TO_BUFFER",i);return await this.postTask(t)}async copyFileToPath(i,t){let e=new N("COPY_FILE_TO_PATH",[i,t]);await this.postTask(e)}async insertArrowFromIPCStream(i,t,e){if(t.length==0)return;let n=new N("INSERT_ARROW_FROM_IPC_STREAM",[i,t,e]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(i,t,e){if(e.columns!==void 0){let s=[];for(let r in e.columns){let o=e.columns[r];s.push(In(r,o))}e.columnsFlat=s,delete e.columns}let n=new N("IMPORT_CSV_FROM_PATH",[i,t,e]);await this.postTask(n)}async insertJSONFromPath(i,t,e){if(e.columns!==void 0){let s=[];for(let r in e.columns){let o=e.columns[r];s.push(In(r,o))}e.columnsFlat=s,delete e.columns}let n=new N("IMPORT_JSON_FROM_PATH",[i,t,e]);await this.postTask(n)}},Zl=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Xl=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),tu=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),eu=()=>(async i=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(i)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),Qn={name:"@duckdb/duckdb-wasm",version:"1.29.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.13",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},iu=Qn.name,nu=Qn.version,Jn=Qn.version.split(".");Jn[0];Jn[1];Jn[2];var su=()=>typeof navigator>"u";function ru(){let i="https://cdn.jsdelivr.net/npm/".concat(iu,"@").concat(nu,"/dist/");return{mvp:{mainModule:"".concat(i,"duckdb-mvp.wasm"),mainWorker:"".concat(i,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(i,"duckdb-eh.wasm"),mainWorker:"".concat(i,"duckdb-browser-eh.worker.js")}}}var nn=null,sn=null,rn=null,on=null,an=null;async function ou(){return nn==null&&(nn=typeof BigInt64Array<"u"),sn==null&&(sn=await Xl()),rn==null&&(rn=await eu()),on==null&&(on=await tu()),an==null&&(an=await Zl()),{bigInt64Array:nn,crossOriginIsolated:su()||globalThis.crossOriginIsolated||!1,wasmExceptions:sn,wasmSIMD:on,wasmThreads:rn,wasmBulkMemory:an}}async function au(i){let t=await ou();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&i.coi)return{mainModule:i.coi.mainModule,mainWorker:i.coi.mainWorker,pthreadWorker:i.coi.pthreadWorker};if(i.eh)return{mainModule:i.eh.mainModule,mainWorker:i.eh.mainWorker,pthreadWorker:null}}return{mainModule:i.mvp.mainModule,mainWorker:i.mvp.mainWorker,pthreadWorker:null}}kl(Cl());function cu(){let i=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),i.decode(t))}cu();var lu=(i=>(i[i.BUFFER=0]="BUFFER",i[i.NODE_FS=1]="NODE_FS",i[i.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",i[i.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",i[i.HTTP=4]="HTTP",i[i.S3=5]="S3",i))(lu||{});class uu{constructor(){Zn(this,"inner");this.inner=null}async initialise(){const t=ru(),e=await au(t),n=URL.createObjectURL(new Blob([`importScripts("${e.mainWorker}");`],{type:"text/javascript"})),s=new Worker(n),r=new Wl,o=new Jl(r,s);await o.instantiate(e.mainModule,e.pthreadWorker),URL.revokeObjectURL(n),this.inner=o}unset(){this.inner=null}isLoaded(){return this.inner!=null}async getMetrics(t){if(!this.inner)throw new Error("DuckDBBackend not initialised");const e=await this.inner.connect(),s=(await e.query(`INSTALL httpfs; LOAD httpfs; ${t}`)).toArray().map(r=>r.toJSON());return console.log(s),await e.close(),s}}Sn(uu); +]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap(({data:s})=>s));return new Q(e,n.map(s=>new it(e,s)))}slice(t,e){const n=this.schema;[t,e]=co({length:this.numRows},t,e);const s=fo(this.data,this._offsets,t,e);return new Q(n,s.map(r=>new it(n,r)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&tn.children[t]);if(e.length===0){const{type:n}=this.schema.fields[t],s=E({type:n,length:0,nullCount:0});e.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new L(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=[...this.batches];if(t>-1&&tthis.getChildAt(u));[r[t],a[t]]=[o,e],[n,s]=tn(n,a)}return new Q(n,s)}select(t){const e=this.schema.fields.reduce((n,s,r)=>n.set(s.name,r),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map(s=>s.selectAt(t));return new Q(e,n)}assign(t){const e=this.schema.fields,[n,s]=t.schema.fields.reduce((a,c,u)=>{const[d,h]=a,F=e.findIndex(A=>A.name===c.name);return~F?h[F]=u:d.push(u),a},[[],[]]),r=this.schema.assign(t.schema),o=[...e.map((a,c)=>[c,s[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new Q(...tn(r,o))}}Io=Symbol.toStringTag;Q[Io]=(i=>(i.schema=null,i.batches=[],i._offsets=new Uint32Array([0]),i._nullCount=-1,i[Symbol.isConcatSpreadable]=!0,i.isValid=Ui(Un),i.get=Ui(st.getVisitFn(l.Struct)),i.set=po(pt.getVisitFn(l.Struct)),i.indexOf=yo(Mi.getVisitFn(l.Struct)),"Table"))(Q.prototype);var So;let it=class Ue{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=E({nullCount:0,type:new J(this.schema.fields),children:this.schema.fields.map(e=>E({type:e.type,nullCount:0}))})]=t,!(this.data instanceof k))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=_s(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:s,length:r}=Object.keys(e).reduce((c,u,d)=>(c.children[d]=e[u],c.length=Math.max(c.length,e[u].length),c.fields[d]=z.new({name:u,type:e[u].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new U(n),a=E({type:new J(n),length:r,children:s,nullCount:0});[this.schema,this.data]=_s(o,a.children,r);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Bo(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return st.visit(this.data,t)}at(t){return this.get(Nn(t,this.numRows))}set(t,e){return pt.visit(this.data,t,e)}indexOf(t,e){return Mi.visit(this.data,t,e)}[Symbol.iterator](){return Mn.visit(new L([this.data]))}toArray(){return[...this]}concat(...t){return new Q(this.schema,[this,...t])}slice(t,e){const[n]=new L([this.data]).slice(t,e).data;return new Ue(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&ts.name===t),e)}setChildAt(t,e){let n=this.schema,s=this.data;if(t>-1&&ta.name===r);~o&&(s[o]=this.data.children[o])}return new Ue(e,E({type:n,length:this.numRows,children:s}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(r=>this.data.children[r]).filter(Boolean),s=E({type:new J(e.fields),length:this.numRows,children:n});return new Ue(e,s)}};So=Symbol.toStringTag;it[So]=(i=>(i._nullCount=-1,i[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(it.prototype);function _s(i,t,e=t.reduce((n,s)=>Math.max(n,s.length),0)){var n;const s=[...i.fields],r=[...t],o=(e+63&-64)>>3;for(const[a,c]of i.fields.entries()){const u=t[a];(!u||u.length!==e)&&(s[a]=c.clone({nullable:!0}),r[a]=(n=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:E({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[i.assign(s),E({type:new J(s),length:e,children:r})]}function Bo(i,t,e=new Map){var n,s;if(((n=i==null?void 0:i.length)!==null&&n!==void 0?n:0)>0&&(i==null?void 0:i.length)===(t==null?void 0:t.length))for(let r=-1,o=i.length;++rE({type:s.type})),n=E({type:new J(t.fields),nullCount:0,children:e});super(t,n)}}let xt=class gt{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+M),(e||new gt).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):W.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):R.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new G).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,W.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,R.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,s,r,o){return gt.startMessage(t),gt.addVersion(t,e),gt.addHeaderType(t,n),gt.addHeader(t,s),gt.addBodyLength(t,r),gt.addCustomMetadata(t,o),gt.endMessage(t)}};class Wc extends O{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return us.startNull(e),us.endNull(e)}visitInt(t,e){return ot.startInt(e),ot.addBitWidth(e,t.bitWidth),ot.addIsSigned(e,t.isSigned),ot.endInt(e)}visitFloat(t,e){return It.startFloatingPoint(e),It.addPrecision(e,t.precision),It.endFloatingPoint(e)}visitBinary(t,e){return rs.startBinary(e),rs.endBinary(e)}visitLargeBinary(t,e){return as.startLargeBinary(e),as.endLargeBinary(e)}visitBool(t,e){return os.startBool(e),os.endBool(e)}visitUtf8(t,e){return ds.startUtf8(e),ds.endUtf8(e)}visitLargeUtf8(t,e){return cs.startLargeUtf8(e),cs.endLargeUtf8(e)}visitDecimal(t,e){return oe.startDecimal(e),oe.addScale(e,t.scale),oe.addPrecision(e,t.precision),oe.addBitWidth(e,t.bitWidth),oe.endDecimal(e)}visitDate(t,e){return Xe.startDate(e),Xe.addUnit(e,t.unit),Xe.endDate(e)}visitTime(t,e){return ut.startTime(e),ut.addUnit(e,t.unit),ut.addBitWidth(e,t.bitWidth),ut.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return dt.startTimestamp(e),dt.addUnit(e,t.unit),n!==void 0&&dt.addTimezone(e,n),dt.endTimestamp(e)}visitInterval(t,e){return St.startInterval(e),St.addUnit(e,t.unit),St.endInterval(e)}visitDuration(t,e){return ti.startDuration(e),ti.addUnit(e,t.unit),ti.endDuration(e)}visitList(t,e){return ls.startList(e),ls.endList(e)}visitStruct(t,e){return Qt.startStruct_(e),Qt.endStruct_(e)}visitUnion(t,e){et.startTypeIdsVector(e,t.typeIds.length);const n=et.createTypeIdsVector(e,t.typeIds);return et.startUnion(e),et.addMode(e,t.mode),et.addTypeIds(e,n),et.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return Ut.startDictionaryEncoding(e),Ut.addId(e,BigInt(t.id)),Ut.addIsOrdered(e,t.isOrdered),n!==void 0&&Ut.addIndexType(e,n),Ut.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return ei.startFixedSizeBinary(e),ei.addByteWidth(e,t.byteWidth),ei.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return ii.startFixedSizeList(e),ii.addListSize(e,t.listSize),ii.endFixedSizeList(e)}visitMap(t,e){return ni.startMap(e),ni.addKeysSorted(e,t.keysSorted),ni.endMap(e)}}const en=new Wc;function Yc(i,t=new Map){return new U(Hc(i,t),oi(i.metadata),t)}function To(i){return new at(i.count,Ao(i.columns),Oo(i.columns))}function Gc(i){return new Et(To(i.data),i.id,i.isDelta)}function Hc(i,t){return(i.fields||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function ws(i,t){return(i.children||[]).filter(Boolean).map(e=>z.fromJSON(e,t))}function Ao(i){return(i||[]).reduce((t,e)=>[...t,new Gt(e.count,qc(e.VALIDITY)),...Ao(e.children)],[])}function Oo(i,t=[]){for(let e=-1,n=(i||[]).length;++et+ +(e===0),0)}function Kc(i,t){let e,n,s,r,o,a;return!t||!(r=i.dictionary)?(o=Is(i,ws(i,t)),s=new z(i.name,o,i.nullable,oi(i.metadata))):t.has(e=r.id)?(n=(n=r.indexType)?vs(n):new xe,a=new ve(t.get(e),n,e,r.isOrdered),s=new z(i.name,a,i.nullable,oi(i.metadata))):(n=(n=r.indexType)?vs(n):new xe,t.set(e,o=Is(i,ws(i,t))),a=new ve(o,n,e,r.isOrdered),s=new z(i.name,a,i.nullable,oi(i.metadata))),s||null}function oi(i=[]){return new Map(i.map(({key:t,value:e})=>[t,e]))}function vs(i){return new Xt(i.isSigned,i.bitWidth)}function Is(i,t){const e=i.type.name;switch(e){case"NONE":return new $t;case"null":return new $t;case"binary":return new mi;case"largebinary":return new bi;case"utf8":return new gi;case"largeutf8":return new _i;case"bool":return new wi;case"list":return new Oi((t||[])[0]);case"struct":return new J(t||[]);case"struct_":return new J(t||[])}switch(e){case"int":{const n=i.type;return new Xt(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=i.type;return new yi(q[n.precision])}case"decimal":{const n=i.type;return new vi(n.scale,n.precision,n.bitWidth)}case"date":{const n=i.type;return new Ii(ft[n.unit])}case"time":{const n=i.type;return new Si(g[n.unit],n.bitWidth)}case"timestamp":{const n=i.type;return new Bi(g[n.unit],n.timezone)}case"interval":{const n=i.type;return new Ti(Ot[n.unit])}case"duration":{const n=i.type;return new Ai(g[n.unit])}case"union":{const n=i.type,[s,...r]=(n.mode+"").toLowerCase(),o=s.toUpperCase()+r.join("");return new Ei(K[o],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=i.type;return new Di(n.byteWidth)}case"fixedsizelist":{const n=i.type;return new Fi(n.listSize,(t||[])[0])}case"map":{const n=i.type;return new Ni((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Qc=Vs,Jc=_e;class Z{static fromJSON(t,e){const n=new Z(0,W.V5,e);return n._createHeader=Zc(t,e),n}static decode(t){t=new Jc(D(t));const e=xt.getRootAsMessage(t),n=e.bodyLength(),s=e.version(),r=e.headerType(),o=new Z(n,s,r);return o._createHeader=Xc(e,r),o}static encode(t){const e=new Qc;let n=-1;return t.isSchema()?n=U.encode(e,t.header()):t.isRecordBatch()?n=at.encode(e,t.header()):t.isDictionaryBatch()&&(n=Et.encode(e,t.header())),xt.startMessage(e),xt.addVersion(e,W.V5),xt.addHeader(e,n),xt.addHeaderType(e,t.headerType),xt.addBodyLength(e,BigInt(t.bodyLength)),xt.finishMessageBuffer(e,xt.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new Z(0,W.V5,R.Schema,t);if(t instanceof at)return new Z(e,W.V5,R.RecordBatch,t);if(t instanceof Et)return new Z(e,W.V5,R.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${t}`)}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}constructor(t,e,n,s){this._version=e,this._headerType=n,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=x(t)}}class at{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=x(t)}}class Et{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=x(e)}}class Tt{constructor(t,e){this.offset=x(t),this.length=x(e)}}class Gt{constructor(t,e){this.length=x(t),this.nullCount=x(e)}}function Zc(i,t){return()=>{switch(t){case R.Schema:return U.fromJSON(i);case R.RecordBatch:return at.fromJSON(i);case R.DictionaryBatch:return Et.fromJSON(i)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function Xc(i,t){return()=>{switch(t){case R.Schema:return U.decode(i.header(new _t),new Map,i.version());case R.RecordBatch:return at.decode(i.header(new Ft),i.version());case R.DictionaryBatch:return Et.decode(i.header(new se),i.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}z.encode=ul;z.decode=cl;z.fromJSON=Kc;U.encode=ll;U.decode=tl;U.fromJSON=Yc;at.encode=dl;at.decode=el;at.fromJSON=To;Et.encode=hl;Et.decode=il;Et.fromJSON=Gc;Gt.encode=fl;Gt.decode=sl;Tt.encode=pl;Tt.decode=nl;function tl(i,t=new Map,e=W.V5){const n=al(i,t);return new U(n,ai(i),t,e)}function el(i,t=W.V5){if(i.compression()!==null)throw new Error("Record batch compression not implemented");return new at(i.length(),rl(i),ol(i,t))}function il(i,t=W.V5){return new Et(at.decode(i.data(),t),i.id(),i.isDelta())}function nl(i){return new Tt(i.offset(),i.length())}function sl(i){return new Gt(i.length(),i.nullCount())}function rl(i){const t=[];for(let e,n=-1,s=-1,r=i.nodesLength();++nz.encode(i,r));_t.startFieldsVector(i,e.length);const n=_t.createFieldsVector(i,e),s=t.metadata&&t.metadata.size>0?_t.createCustomMetadataVector(i,[...t.metadata].map(([r,o])=>{const a=i.createString(`${r}`),c=i.createString(`${o}`);return G.startKeyValue(i),G.addKey(i,a),G.addValue(i,c),G.endKeyValue(i)})):-1;return _t.startSchema(i),_t.addFields(i,n),_t.addEndianness(i,yl?we.Little:we.Big),s!==-1&&_t.addCustomMetadata(i,s),_t.endSchema(i)}function ul(i,t){let e=-1,n=-1,s=-1;const r=t.type;let o=t.typeId;f.isDictionary(r)?(o=r.dictionary.typeId,s=en.visit(r,i),n=en.visit(r.dictionary,i)):n=en.visit(r,i);const a=(r.children||[]).map(d=>z.encode(i,d)),c=ct.createChildrenVector(i,a),u=t.metadata&&t.metadata.size>0?ct.createCustomMetadataVector(i,[...t.metadata].map(([d,h])=>{const F=i.createString(`${d}`),A=i.createString(`${h}`);return G.startKeyValue(i),G.addKey(i,F),G.addValue(i,A),G.endKeyValue(i)})):-1;return t.name&&(e=i.createString(t.name)),ct.startField(i),ct.addType(i,n),ct.addTypeType(i,o),ct.addChildren(i,c),ct.addNullable(i,!!t.nullable),e!==-1&&ct.addName(i,e),s!==-1&&ct.addDictionary(i,s),u!==-1&&ct.addCustomMetadata(i,u),ct.endField(i)}function dl(i,t){const e=t.nodes||[],n=t.buffers||[];Ft.startNodesVector(i,e.length);for(const o of e.slice().reverse())Gt.encode(i,o);const s=i.endVector();Ft.startBuffersVector(i,n.length);for(const o of n.slice().reverse())Tt.encode(i,o);const r=i.endVector();return Ft.startRecordBatch(i),Ft.addLength(i,BigInt(t.length)),Ft.addNodes(i,s),Ft.addBuffers(i,r),Ft.endRecordBatch(i)}function hl(i,t){const e=at.encode(i,t.data);return se.startDictionaryBatch(i),se.addId(i,BigInt(t.id)),se.addIsDelta(i,t.isDelta),se.addData(i,e),se.endDictionaryBatch(i)}function fl(i,t){return Ys.createFieldNode(i,BigInt(t.length),BigInt(t.nullCount))}function pl(i,t){return Ws.createBuffer(i,BigInt(t.offset),BigInt(t.length))}const yl=(()=>{const i=new ArrayBuffer(2);return new DataView(i).setInt16(0,256,!0),new Int16Array(i)[0]===256})(),Vn=i=>`Expected ${R[i]} Message in stream, but was null or length 0.`,$n=i=>`Header pointer of flatbuffer-encoded ${R[i]} Message is null or length 0.`,Eo=(i,t)=>`Expected to read ${i} metadata bytes, but only read ${t}.`,Do=(i,t)=>`Expected to read ${i} bytes for message body, but only read ${t}.`;class Fo{constructor(t){this.source=t instanceof Ci?t:new Ci(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?V:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Vn(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=D(this.source.read(t));if(e.byteLength[...s,...r.VALIDITY&&[r.VALIDITY]||[],...r.TYPE_ID&&[r.TYPE_ID]||[],...r.OFFSET&&[r.OFFSET]||[],...r.DATA&&[r.DATA]||[],...e(r.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Vn(t));return e.value}readSchema(){const t=R.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error($n(t));return n}}const Gi=4,wn="ARROW1",ze=new Uint8Array(wn.length);for(let i=0;ithis):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return lt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return lt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof ht?t:un(t)?Il(t):ks(t)?Tl(t):Zt(t)?B(this,void 0,void 0,function*(){return yield ht.from(yield t)}):Cs(t)||Tn(t)||Ps(t)||Be(t)?Bl(new Ie(t)):Sl(new Ci(t))}static readAll(t){return t instanceof ht?t.isSync()?As(t):Os(t):un(t)||ArrayBuffer.isView(t)||Ve(t)||Ms(t)?As(t):Os(t)}}class xi extends ht{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Bt(this,arguments,function*(){yield T(yield*Ze(Jt(this[Symbol.iterator]())))})}}class ji extends ht{constructor(t){super(t),this._impl=t}readAll(){return B(this,void 0,void 0,function*(){var t,e,n,s;const r=new Array;try{for(var o=!0,a=Jt(this),c;c=yield a.next(),t=c.done,!t;o=!0){s=c.value,o=!1;const u=s;r.push(u)}}catch(u){e={error:u}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return r})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class Ro extends xi{constructor(t){super(t),this._impl=t}}class _l extends ji{constructor(t){super(t),this._impl=t}}class Lo{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){const n=this._loadVectors(t,e,this.schema.fields),s=E({type:new J(this.schema.fields),length:t.length,children:n});return new it(this.schema,s)}_loadDictionaryBatch(t,e){const{id:n,isDelta:s}=t,{dictionaries:r,schema:o}=this,a=r.get(n),c=o.dictionaries.get(n),u=this._loadVectors(t.data,e,[c]);return(a&&s?a.concat(new L(u)):new L(u)).memoize()}_loadVectors(t,e,n){return new vo(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class zi extends Lo{constructor(t,e){super(e),this._reader=un(t)?new bl(this._handle=t):new Fo(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=Mo(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):V}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):V}next(){if(this.closed)return V;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new zn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class Vi extends Lo{constructor(t,e){super(e),this._reader=new ml(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return B(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return B(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Mo(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return B(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):V})}return(t){return B(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):V})}next(){return B(this,void 0,void 0,function*(){if(this.closed)return V;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength),r=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,r)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new zn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return B(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Uo extends zi{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof gs?t:new gs(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(R.RecordBatch);if(s!=null&&s.isRecordBatch()){const r=s.header(),o=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(r,o)}}return null}_readDictionaryBatch(t){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(R.DictionaryBatch);if(s!=null&&s.isDictionaryBatch()){const r=s.header(),o=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(r,o);this.dictionaries.set(r.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-No,n=t.readInt32(e),s=t.readAt(e-n,n);return je.decode(s)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndexsuper.open}});return B(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return B(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(R.RecordBatch);if(s!=null&&s.isRecordBatch()){const r=s.header(),o=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(r,o)}}return null})}_readDictionaryBatch(t){return B(this,void 0,void 0,function*(){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(R.DictionaryBatch);if(s!=null&&s.isDictionaryBatch()){const r=s.header(),o=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(r,o);this.dictionaries.set(r.id,a)}}})}_readFooter(){return B(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-No,n=yield t.readInt32(e),s=yield t.readAt(e-n,n);return je.decode(s)})}_readNextMessageAndValidate(t){return B(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex=4?Wn(t)?new Ro(new Uo(i.read())):new xi(new zi(i)):new xi(new zi(function*(){}()))}function Bl(i){return B(this,void 0,void 0,function*(){const t=yield i.peek(Ge+7&-8);return t&&t.byteLength>=4?Wn(t)?new Ro(new Uo(yield i.read())):new ji(new Vi(i)):new ji(new Vi(function(){return Bt(this,arguments,function*(){})}()))})}function Tl(i){return B(this,void 0,void 0,function*(){const{size:t}=yield i.stat(),e=new Pi(i,t);return t>=gl&&Wn(yield e.readAt(0,Ge+7&-8))?new _l(new wl(e)):new ji(new Vi(e))})}class $ extends O{static assemble(...t){const e=s=>s.flatMap(r=>Array.isArray(r)?e(r):r instanceof it?r.data.children:r.data),n=new $;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof L)return this.visitMany(t.data),this;const{type:e}=t;if(!f.isDictionary(e)){const{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(f.isUnion(e))this.nodes.push(new Gt(n,0));else{const{nullCount:s}=t;f.isNull(e)||mt.call(this,s<=0?new Uint8Array(0):Ri(t.offset,n,t.nullBitmap)),this.nodes.push(new Gt(n,s))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}}function mt(i){const t=i.byteLength+7&-8;return this.buffers.push(i),this.bufferRegions.push(new Tt(this._byteLength,t)),this._byteLength+=t,this}function Al(i){var t;const{type:e,length:n,typeIds:s,valueOffsets:r}=i;if(mt.call(this,s),e.mode===K.Sparse)return vn.call(this,i);if(e.mode===K.Dense){if(i.offset<=0)return mt.call(this,r),vn.call(this,i);{const o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let u,d,h=-1;++h{const h=e.typeIds[d],F=a[h],A=c[h];return u.slice(F,Math.min(n,A))}))}}return this}function Ol(i){let t;return i.nullCount>=i.length?mt.call(this,new Uint8Array(0)):(t=i.values)instanceof Uint8Array?mt.call(this,Ri(i.offset,i.length,t)):mt.call(this,Li(i.values))}function Ct(i){return mt.call(this,i.values.subarray(0,i.length*i.stride))}function Hi(i){const{length:t,values:e,valueOffsets:n}=i,s=x(n[0]),r=x(n[t]),o=Math.min(r-s,e.byteLength-s);return mt.call(this,js(-s,t+1,n)),mt.call(this,e.subarray(s,s+o)),this}function Yn(i){const{length:t,valueOffsets:e}=i;if(e){const{[0]:n,[t]:s}=e;return mt.call(this,js(-n,t+1,e)),this.visit(i.children[0].slice(n,s-n))}return this.visit(i.children[0])}function vn(i){return this.visitMany(i.type.children.map((t,e)=>i.children[e]).filter(Boolean))[0]}$.prototype.visitBool=Ol;$.prototype.visitInt=Ct;$.prototype.visitFloat=Ct;$.prototype.visitUtf8=Hi;$.prototype.visitLargeUtf8=Hi;$.prototype.visitBinary=Hi;$.prototype.visitLargeBinary=Hi;$.prototype.visitFixedSizeBinary=Ct;$.prototype.visitDate=Ct;$.prototype.visitTimestamp=Ct;$.prototype.visitTime=Ct;$.prototype.visitDecimal=Ct;$.prototype.visitList=Yn;$.prototype.visitStruct=vn;$.prototype.visitUnion=Al;$.prototype.visitInterval=Ct;$.prototype.visitDuration=Ct;$.prototype.visitFixedSizeList=Yn;$.prototype.visitMap=Yn;class ko extends kn{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new ri,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,nt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Zt(t)?t.then(e=>this.writeAll(e)):Be(t)?Kn(this,t):qn(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof ri?this._sink=t:(this._sink=new ri,t&&sa(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ra(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!_n(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Q&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof it&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!_n(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof it?t instanceof zn||this._writeRecordBatch(t):t instanceof Q?this.writeAll(t.batches):Ve(t)&&this.writeAll(t)}_writeMessage(t,e=8){const n=e-1,s=Z.encode(t),r=s.byteLength,o=this._writeLegacyIpcFormat?4:8,a=r+o+n&~n,c=a-r-o;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new Wt(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new Wt(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),r>0&&this._write(s),this._writePadding(c)}_write(t){if(this._started){const e=D(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(Z.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ze)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:e,nodes:n,bufferRegions:s,buffers:r}=$.assemble(t),o=new at(t.numRows,n,s),a=Z.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(r)}_writeDictionaryBatch(t,e,n=!1){const{byteLength:s,nodes:r,bufferRegions:o,buffers:a}=$.assemble(new L([t])),c=new at(t.length,r,o),u=new Et(c,e,n),d=Z.from(u,s);return this._writeMessage(d)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,s;for(let r=-1,o=t.length;++r0&&(this._write(e),(s=(n+7&-8)-n)>0&&this._writePadding(s));return this}_writeDictionaries(t){var e,n;for(const[s,r]of t.dictionaries){const o=(e=r==null?void 0:r.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(s),c=(n=this._dictionaryDeltaOffsets.get(s))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==o[0])for(const[u,d]of o.entries())this._writeDictionaryBatch(d,s,u>0);else if(cn.writeAll(s)):Be(t)?Kn(n,t):qn(n,t)}}class Hn extends ko{static writeAll(t){const e=new Hn;return Zt(t)?t.then(n=>e.writeAll(n)):Be(t)?Kn(e,t):qn(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){const e=je.encode(new je(t,W.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}}function qn(i,t){let e=t;t instanceof Q&&(e=t.batches,i.reset(void 0,t.schema));for(const n of e)i.write(n);return i.finish()}function Kn(i,t){return B(this,void 0,void 0,function*(){var e,n,s,r,o,a,c;try{for(e=!0,n=Jt(t);s=yield n.next(),r=s.done,!r;e=!0){c=s.value,e=!1;const u=c;i.write(u)}}catch(u){o={error:u}}finally{try{!e&&!r&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return i.finish()})}function El(i,t="stream"){return(t==="stream"?Gn:Hn).writeAll(i).toUint8Array(!0)}var Dl=Object.create,Co=Object.defineProperty,Fl=Object.getOwnPropertyDescriptor,Nl=Object.getOwnPropertyNames,Rl=Object.getPrototypeOf,Ll=Object.prototype.hasOwnProperty,Ul=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports),Ml=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Nl(t))!Ll.call(i,s)&&s!==e&&Co(i,s,{get:()=>t[s],enumerable:!(n=Fl(t,s))||n.enumerable});return i},kl=(i,t,e)=>(e=i!=null?Dl(Rl(i)):{},Ml(!i||!i.__esModule?Co(e,"default",{value:i,enumerable:!0}):e,i)),Cl=Ul((i,t)=>{t.exports=Worker}),Pl=(i=>(i[i.UNDEFINED=0]="UNDEFINED",i[i.AUTOMATIC=1]="AUTOMATIC",i[i.READ_ONLY=2]="READ_ONLY",i[i.READ_WRITE=3]="READ_WRITE",i))(Pl||{}),xl=(i=>(i[i.IDENTIFIER=0]="IDENTIFIER",i[i.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",i[i.STRING_CONSTANT=2]="STRING_CONSTANT",i[i.OPERATOR=3]="OPERATOR",i[i.KEYWORD=4]="KEYWORD",i[i.COMMENT=5]="COMMENT",i))(xl||{}),jl=(i=>(i[i.NONE=0]="NONE",i[i.DEBUG=1]="DEBUG",i[i.INFO=2]="INFO",i[i.WARNING=3]="WARNING",i[i.ERROR=4]="ERROR",i))(jl||{}),zl=(i=>(i[i.NONE=0]="NONE",i[i.CONNECT=1]="CONNECT",i[i.DISCONNECT=2]="DISCONNECT",i[i.OPEN=3]="OPEN",i[i.QUERY=4]="QUERY",i[i.INSTANTIATE=5]="INSTANTIATE",i))(zl||{}),Vl=(i=>(i[i.NONE=0]="NONE",i[i.OK=1]="OK",i[i.ERROR=2]="ERROR",i[i.START=3]="START",i[i.RUN=4]="RUN",i[i.CAPTURE=5]="CAPTURE",i))(Vl||{}),$l=(i=>(i[i.NONE=0]="NONE",i[i.WEB_WORKER=1]="WEB_WORKER",i[i.NODE_WORKER=2]="NODE_WORKER",i[i.BINDINGS=3]="BINDINGS",i[i.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",i))($l||{}),Wl=class{constructor(i=2){this.level=i}log(i){i.level>=this.level&&console.log(i)}},Yl=(i=>(i[i.SUCCESS=0]="SUCCESS",i))(Yl||{}),Gl=class{constructor(i,t){this._bindings=i,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(i){return i(this._bindings,this._conn)}async query(i){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:i});let t=await this._bindings.runQuery(this._conn,i),e=ht.from(t);return console.assert(e.isSync(),"Reader is not sync"),console.assert(e.isFile(),"Reader is not file"),new Q(e)}async send(i){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:i});let t=await this._bindings.startPendingQuery(this._conn,i);for(;t==null;)t=await this._bindings.pollPendingQuery(this._conn);let e=new Po(this._bindings,this._conn,t),n=await ht.from(e);return console.assert(n.isAsync()),console.assert(n.isStream()),n}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(i){return await this._bindings.getTableNames(this._conn,i)}async prepare(i){let t=await this._bindings.createPrepared(this._conn,i);return new Hl(this._bindings,this._conn,t)}async insertArrowTable(i,t){let e=El(i,"stream");await this.insertArrowFromIPCStream(e,t)}async insertArrowFromIPCStream(i,t){await this._bindings.insertArrowFromIPCStream(this._conn,i,t)}async insertCSVFromPath(i,t){await this._bindings.insertCSVFromPath(this._conn,i,t)}async insertJSONFromPath(i,t){await this._bindings.insertJSONFromPath(this._conn,i,t)}},Po=class{constructor(i,t,e){this.db=i,this.conn=t,this.header=e,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let i;return this._inFlight!=null?(i=await this._inFlight,this._inFlight=null):i=await this.db.fetchQueryResults(this.conn),this._depleted=i.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:i}}[Symbol.asyncIterator](){return this}},Hl=class{constructor(i,t,e){this.bindings=i,this.connectionId=t,this.statementId=e}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...i){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,i),e=ht.from(t);return console.assert(e.isSync()),console.assert(e.isFile()),new Q(e)}async send(...i){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,i),e=new Po(this.bindings,this.connectionId,t),n=await ht.from(e);return console.assert(n.isAsync()),console.assert(n.isStream()),n}},ql=(i=>(i.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",i.CLOSE_PREPARED="CLOSE_PREPARED",i.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",i.CONNECT="CONNECT",i.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",i.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",i.CREATE_PREPARED="CREATE_PREPARED",i.DISCONNECT="DISCONNECT",i.DROP_FILE="DROP_FILE",i.DROP_FILES="DROP_FILES",i.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",i.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",i.FLUSH_FILES="FLUSH_FILES",i.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",i.GET_TABLE_NAMES="GET_TABLE_NAMES",i.GET_VERSION="GET_VERSION",i.GLOB_FILE_INFOS="GLOB_FILE_INFOS",i.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",i.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",i.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",i.INSTANTIATE="INSTANTIATE",i.OPEN="OPEN",i.PING="PING",i.POLL_PENDING_QUERY="POLL_PENDING_QUERY",i.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",i.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",i.REGISTER_FILE_URL="REGISTER_FILE_URL",i.RESET="RESET",i.RUN_PREPARED="RUN_PREPARED",i.RUN_QUERY="RUN_QUERY",i.SEND_PREPARED="SEND_PREPARED",i.START_PENDING_QUERY="START_PENDING_QUERY",i.TOKENIZE="TOKENIZE",i))(ql||{}),Kl=(i=>(i.CONNECTION_INFO="CONNECTION_INFO",i.ERROR="ERROR",i.FEATURE_FLAGS="FEATURE_FLAGS",i.FILE_BUFFER="FILE_BUFFER",i.FILE_INFOS="FILE_INFOS",i.FILE_SIZE="FILE_SIZE",i.FILE_STATISTICS="FILE_STATISTICS",i.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",i.LOG="LOG",i.OK="OK",i.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",i.QUERY_PLAN="QUERY_PLAN",i.QUERY_RESULT="QUERY_RESULT",i.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",i.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",i.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",i.REGISTERED_FILE="REGISTERED_FILE",i.SCRIPT_TOKENS="SCRIPT_TOKENS",i.SUCCESS="SUCCESS",i.TABLE_NAMES="TABLE_NAMES",i.VERSION_STRING="VERSION_STRING",i))(Kl||{}),N=class{constructor(i,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=i,this.data=t,this.promise=new Promise((e,n)=>{this.promiseResolver=e,this.promiseRejecter=n})}};function ci(i){switch(i.typeId){case l.Binary:return{sqlType:"binary"};case l.Bool:return{sqlType:"bool"};case l.Date:return{sqlType:"date"};case l.DateDay:return{sqlType:"date32[d]"};case l.DateMillisecond:return{sqlType:"date64[ms]"};case l.Decimal:{let t=i;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case l.Float:return{sqlType:"float"};case l.Float16:return{sqlType:"float16"};case l.Float32:return{sqlType:"float32"};case l.Float64:return{sqlType:"float64"};case l.Int:return{sqlType:"int32"};case l.Int16:return{sqlType:"int16"};case l.Int32:return{sqlType:"int32"};case l.Int64:return{sqlType:"int64"};case l.Uint16:return{sqlType:"uint16"};case l.Uint32:return{sqlType:"uint32"};case l.Uint64:return{sqlType:"uint64"};case l.Uint8:return{sqlType:"uint8"};case l.IntervalDayTime:return{sqlType:"interval[dt]"};case l.IntervalYearMonth:return{sqlType:"interval[m]"};case l.List:return{sqlType:"list",valueType:ci(i.valueType)};case l.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:i.byteWidth};case l.Null:return{sqlType:"null"};case l.Utf8:return{sqlType:"utf8"};case l.Struct:return{sqlType:"struct",fields:i.children.map(t=>In(t.name,t.type))};case l.Map:{let t=i;return{sqlType:"map",keyType:ci(t.keyType),valueType:ci(t.valueType)}}case l.Time:return{sqlType:"time[s]"};case l.TimeMicrosecond:return{sqlType:"time[us]"};case l.TimeMillisecond:return{sqlType:"time[ms]"};case l.TimeNanosecond:return{sqlType:"time[ns]"};case l.TimeSecond:return{sqlType:"time[s]"};case l.Timestamp:return{sqlType:"timestamp",timezone:i.timezone||void 0};case l.TimestampSecond:return{sqlType:"timestamp[s]",timezone:i.timezone||void 0};case l.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:i.timezone||void 0};case l.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:i.timezone||void 0};case l.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:i.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(i.toString()))}function In(i,t){let e=ci(t);return e.name=i,e}var Ql=new TextEncoder,Jl=class{constructor(i,t=null){this._onInstantiationProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=i,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(i){this._worker=i,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,e)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(i,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let e=this._nextMessageId++;return this._pendingRequests.set(e,i),this._worker.postMessage({messageId:e,type:i.type,data:i.data},t),await i.promise}onMessage(i){var t;let e=i.data;switch(e.type){case"LOG":{this._logger.log(e.data);return}case"INSTANTIATE_PROGRESS":{for(let s of this._onInstantiationProgress)s(e.data);return}}let n=this._pendingRequests.get(e.requestId);if(!n){console.warn("unassociated response: [".concat(e.requestId,", ").concat(e.type.toString(),"]"));return}if(this._pendingRequests.delete(e.requestId),e.type=="ERROR"){let s=new Error(e.data.message);s.name=e.data.name,(t=Object.getOwnPropertyDescriptor(s,"stack"))!=null&&t.writable&&(s.stack=e.data.stack),n.promiseRejecter(s);return}switch(n.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(e.type=="OK"){n.promiseResolver(e.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],e.type=="OK"){n.promiseResolver(e.data);return}break;case"GLOB_FILE_INFOS":if(e.type=="FILE_INFOS"){n.promiseResolver(e.data);return}break;case"GET_VERSION":if(e.type=="VERSION_STRING"){n.promiseResolver(e.data);return}break;case"GET_FEATURE_FLAGS":if(e.type=="FEATURE_FLAGS"){n.promiseResolver(e.data);return}break;case"GET_TABLE_NAMES":if(e.type=="TABLE_NAMES"){n.promiseResolver(e.data);return}break;case"TOKENIZE":if(e.type=="SCRIPT_TOKENS"){n.promiseResolver(e.data);return}break;case"COPY_FILE_TO_BUFFER":if(e.type=="FILE_BUFFER"){n.promiseResolver(e.data);return}break;case"EXPORT_FILE_STATISTICS":if(e.type=="FILE_STATISTICS"){n.promiseResolver(e.data);return}break;case"CONNECT":if(e.type=="CONNECTION_INFO"){n.promiseResolver(e.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(e.type=="QUERY_RESULT"){n.promiseResolver(e.data);return}break;case"SEND_PREPARED":if(e.type=="QUERY_RESULT_HEADER"){n.promiseResolver(e.data);return}break;case"START_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"POLL_PENDING_QUERY":if(e.type=="QUERY_RESULT_HEADER_OR_NULL"){n.promiseResolver(e.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],e.type=="SUCCESS"){n.promiseResolver(e.data);return}break;case"FETCH_QUERY_RESULTS":if(e.type=="QUERY_RESULT_CHUNK"){n.promiseResolver(e.data);return}break;case"CREATE_PREPARED":if(e.type=="PREPARED_STATEMENT_ID"){n.promiseResolver(e.data);return}break}n.promiseRejecter(new Error("unexpected response type: ".concat(e.type.toString())))}onError(i){console.error(i),console.error("error in duckdb worker: ".concat(i.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let i=new N("RESET",null);return await this.postTask(i)}async ping(){let i=new N("PING",null);await this.postTask(i)}async dropFile(i){let t=new N("DROP_FILE",i);return await this.postTask(t)}async dropFiles(){let i=new N("DROP_FILES",null);return await this.postTask(i)}async flushFiles(){let i=new N("FLUSH_FILES",null);return await this.postTask(i)}async instantiate(i,t=null,e=n=>{}){this._onInstantiationProgress.push(e);let n=new N("INSTANTIATE",[i,t]);return await this.postTask(n)}async getVersion(){let i=new N("GET_VERSION",null);return await this.postTask(i)}async getFeatureFlags(){let i=new N("GET_FEATURE_FLAGS",null);return await this.postTask(i)}async open(i){let t=new N("OPEN",i);await this.postTask(t)}async tokenize(i){let t=new N("TOKENIZE",i);return await this.postTask(t)}async connectInternal(){let i=new N("CONNECT",null);return await this.postTask(i)}async connect(){let i=await this.connectInternal();return new Gl(this,i)}async disconnect(i){let t=new N("DISCONNECT",i);await this.postTask(t)}async runQuery(i,t){let e=new N("RUN_QUERY",[i,t]);return await this.postTask(e)}async startPendingQuery(i,t){let e=new N("START_PENDING_QUERY",[i,t]);return await this.postTask(e)}async pollPendingQuery(i){let t=new N("POLL_PENDING_QUERY",i);return await this.postTask(t)}async cancelPendingQuery(i){let t=new N("CANCEL_PENDING_QUERY",i);return await this.postTask(t)}async fetchQueryResults(i){let t=new N("FETCH_QUERY_RESULTS",i);return await this.postTask(t)}async getTableNames(i,t){let e=new N("GET_TABLE_NAMES",[i,t]);return await this.postTask(e)}async createPrepared(i,t){let e=new N("CREATE_PREPARED",[i,t]);return await this.postTask(e)}async closePrepared(i,t){let e=new N("CLOSE_PREPARED",[i,t]);await this.postTask(e)}async runPrepared(i,t,e){let n=new N("RUN_PREPARED",[i,t,e]);return await this.postTask(n)}async sendPrepared(i,t,e){let n=new N("SEND_PREPARED",[i,t,e]);return await this.postTask(n)}async globFiles(i){let t=new N("GLOB_FILE_INFOS",i);return await this.postTask(t)}async registerFileText(i,t){let e=Ql.encode(t);await this.registerFileBuffer(i,e)}async registerFileURL(i,t,e,n){t===void 0&&(t=i);let s=new N("REGISTER_FILE_URL",[i,t,e,n]);await this.postTask(s)}async registerEmptyFileBuffer(i){}async registerFileBuffer(i,t){let e=new N("REGISTER_FILE_BUFFER",[i,t]);await this.postTask(e,[t.buffer])}async registerFileHandle(i,t,e,n){let s=new N("REGISTER_FILE_HANDLE",[i,t,e,n]);await this.postTask(s,[])}async collectFileStatistics(i,t){let e=new N("COLLECT_FILE_STATISTICS",[i,t]);await this.postTask(e,[])}async exportFileStatistics(i){let t=new N("EXPORT_FILE_STATISTICS",i);return await this.postTask(t,[])}async copyFileToBuffer(i){let t=new N("COPY_FILE_TO_BUFFER",i);return await this.postTask(t)}async copyFileToPath(i,t){let e=new N("COPY_FILE_TO_PATH",[i,t]);await this.postTask(e)}async insertArrowFromIPCStream(i,t,e){if(t.length==0)return;let n=new N("INSERT_ARROW_FROM_IPC_STREAM",[i,t,e]);await this.postTask(n,[t.buffer])}async insertCSVFromPath(i,t,e){if(e.columns!==void 0){let s=[];for(let r in e.columns){let o=e.columns[r];s.push(In(r,o))}e.columnsFlat=s,delete e.columns}let n=new N("IMPORT_CSV_FROM_PATH",[i,t,e]);await this.postTask(n)}async insertJSONFromPath(i,t,e){if(e.columns!==void 0){let s=[];for(let r in e.columns){let o=e.columns[r];s.push(In(r,o))}e.columnsFlat=s,delete e.columns}let n=new N("IMPORT_JSON_FROM_PATH",[i,t,e]);await this.postTask(n)}},Zl=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),Xl=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),tu=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),eu=()=>(async i=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(i)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),Qn={name:"@duckdb/duckdb-wasm",version:"1.29.0",description:"DuckDB powered by WebAssembly",license:"MIT",repository:{type:"git",url:"https://github.com/duckdb/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.4","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.34.0","fast-glob":"^3.3.2",jasmine:"^5.1.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.0",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.25.13",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}},iu=Qn.name,nu=Qn.version,Jn=Qn.version.split(".");Jn[0];Jn[1];Jn[2];var su=()=>typeof navigator>"u";function ru(){let i="https://cdn.jsdelivr.net/npm/".concat(iu,"@").concat(nu,"/dist/");return{mvp:{mainModule:"".concat(i,"duckdb-mvp.wasm"),mainWorker:"".concat(i,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(i,"duckdb-eh.wasm"),mainWorker:"".concat(i,"duckdb-browser-eh.worker.js")}}}var nn=null,sn=null,rn=null,on=null,an=null;async function ou(){return nn==null&&(nn=typeof BigInt64Array<"u"),sn==null&&(sn=await Xl()),rn==null&&(rn=await eu()),on==null&&(on=await tu()),an==null&&(an=await Zl()),{bigInt64Array:nn,crossOriginIsolated:su()||globalThis.crossOriginIsolated||!1,wasmExceptions:sn,wasmSIMD:on,wasmThreads:rn,wasmBulkMemory:an}}async function au(i){let t=await ou();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&i.coi)return{mainModule:i.coi.mainModule,mainWorker:i.coi.mainWorker,pthreadWorker:i.coi.pthreadWorker};if(i.eh)return{mainModule:i.eh.mainModule,mainWorker:i.eh.mainWorker,pthreadWorker:null}}return{mainModule:i.mvp.mainModule,mainWorker:i.mvp.mainWorker,pthreadWorker:null}}kl(Cl());function cu(){let i=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),i.decode(t))}cu();var lu=(i=>(i[i.BUFFER=0]="BUFFER",i[i.NODE_FS=1]="NODE_FS",i[i.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",i[i.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",i[i.HTTP=4]="HTTP",i[i.S3=5]="S3",i))(lu||{});class uu{constructor(){Zn(this,"inner");this.inner=null}async initialise(){const t=ru(),e=await au(t),n=URL.createObjectURL(new Blob([`importScripts("${e.mainWorker}");`],{type:"text/javascript"})),s=new Worker(n),r=new Wl,o=new Jl(r,s);await o.instantiate(e.mainModule,e.pthreadWorker),URL.revokeObjectURL(n),this.inner=o}unset(){this.inner=null}isLoaded(){return this.inner!=null}isLoadedWithThrow(){if(!this.isLoaded())throw new Error("DuckDBBackend not initialised")}async getMetrics(t){this.isLoadedWithThrow();const e=await this.inner.connect(),s=(await e.query(`INSTALL httpfs; LOAD httpfs; ${t}`)).toArray().map(r=>r.toJSON());return console.log(s),await e.close(),s}}Sn(uu); diff --git a/_app/immutable/workers/rust_worker-BdWdqBP_.js b/_app/immutable/workers/rust_worker-tYahfuf4.js similarity index 64% rename from _app/immutable/workers/rust_worker-BdWdqBP_.js rename to _app/immutable/workers/rust_worker-tYahfuf4.js index 0b2b777..0f6cef6 100644 --- a/_app/immutable/workers/rust_worker-BdWdqBP_.js +++ b/_app/immutable/workers/rust_worker-tYahfuf4.js @@ -1,6 +1,6 @@ -var K=Object.defineProperty;var X=(t,e,n)=>e in t?K(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var N=(t,e,n)=>X(t,typeof e!="symbol"?e+"":e,n);/** +var X=Object.defineProperty;var K=(t,e,n)=>e in t?X(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var N=(t,e,n)=>K(t,typeof e!="symbol"?e+"":e,n);/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: Apache-2.0 - */const W=Symbol("Comlink.proxy"),Q=Symbol("Comlink.endpoint"),Z=Symbol("Comlink.releaseProxy"),I=Symbol("Comlink.finalizer"),q=Symbol("Comlink.thrown"),G=t=>typeof t=="object"&&t!==null||typeof t=="function",ee={canHandle:t=>G(t)&&t[W],serialize(t){const{port1:e,port2:n}=new MessageChannel;return B(t,e),[n,[n]]},deserialize(t){return t.start(),oe(t)}},te={canHandle:t=>G(t)&&q in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},V=new Map([["proxy",ee],["throw",te]]);function ne(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function B(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(o){if(!o||!o.data)return;if(!ne(n,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:a,type:i,path:c}=Object.assign({path:[]},o.data),u=(o.data.argumentList||[]).map(m);let f;try{const b=c.slice(0,-1).reduce((g,k)=>g[k],t),d=c.reduce((g,k)=>g[k],t);switch(i){case"GET":f=d;break;case"SET":b[c.slice(-1)[0]]=m(o.data.value),f=!0;break;case"APPLY":f=d.apply(b,u);break;case"CONSTRUCT":{const g=new d(...u);f=ue(g)}break;case"ENDPOINT":{const{port1:g,port2:k}=new MessageChannel;B(t,k),f=ce(g,[g])}break;case"RELEASE":f=void 0;break;default:return}}catch(b){f={value:b,[q]:0}}Promise.resolve(f).catch(b=>({value:b,[q]:0})).then(b=>{const[d,g]=C(b);e.postMessage(Object.assign(Object.assign({},d),{id:a}),g),i==="RELEASE"&&(e.removeEventListener("message",r),H(e),I in t&&typeof t[I]=="function"&&t[I]())}).catch(b=>{const[d,g]=C({value:new TypeError("Unserializable return value"),[q]:0});e.postMessage(Object.assign(Object.assign({},d),{id:a}),g)})}),e.start&&e.start()}function re(t){return t.constructor.name==="MessagePort"}function H(t){re(t)&&t.close()}function oe(t,e){return j(t,[],e)}function M(t){if(t)throw new Error("Proxy has been released and is not useable")}function $(t){return R(t,{type:"RELEASE"}).then(()=>{H(t)})}const D=new WeakMap,T="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(D.get(t)||0)-1;D.set(t,e),e===0&&$(t)});function se(t,e){const n=(D.get(e)||0)+1;D.set(e,n),T&&T.register(t,e,t)}function ie(t){T&&T.unregister(t)}function j(t,e=[],n=function(){}){let r=!1;const o=new Proxy(n,{get(a,i){if(M(r),i===Z)return()=>{ie(o),$(t),r=!0};if(i==="then"){if(e.length===0)return{then:()=>o};const c=R(t,{type:"GET",path:e.map(u=>u.toString())}).then(m);return c.then.bind(c)}return j(t,[...e,i])},set(a,i,c){M(r);const[u,f]=C(c);return R(t,{type:"SET",path:[...e,i].map(b=>b.toString()),value:u},f).then(m)},apply(a,i,c){M(r);const u=e[e.length-1];if(u===Q)return R(t,{type:"ENDPOINT"}).then(m);if(u==="bind")return j(t,e.slice(0,-1));const[f,b]=F(c);return R(t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:f},b).then(m)},construct(a,i){M(r);const[c,u]=F(i);return R(t,{type:"CONSTRUCT",path:e.map(f=>f.toString()),argumentList:c},u).then(m)}});return se(o,t),o}function ae(t){return Array.prototype.concat.apply([],t)}function F(t){const e=t.map(C);return[e.map(n=>n[0]),ae(e.map(n=>n[1]))]}const J=new WeakMap;function ce(t,e){return J.set(t,e),t}function ue(t){return Object.assign(t,{[W]:!0})}function C(t){for(const[e,n]of V)if(n.canHandle(t)){const[r,o]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},o]}return[{type:"RAW",value:t},J.get(t)||[]]}function m(t){switch(t.type){case"HANDLER":return V.get(t.name).deserialize(t.value);case"RAW":return t.value}}function R(t,e,n){return new Promise(r=>{const o=_e();t.addEventListener("message",function a(i){!i.data||!i.data.id||i.data.id!==o||(t.removeEventListener("message",a),r(i.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:o},e),n)})}function _e(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let s,p=0,S=null;function A(){return(S===null||S.byteLength===0)&&(S=new Uint8Array(s.memory.buffer)),S}const O=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},fe=typeof O.encodeInto=="function"?function(t,e){return O.encodeInto(t,e)}:function(t,e){const n=O.encode(t);return e.set(n),{read:t.length,written:n.length}};function x(t,e,n){if(n===void 0){const c=O.encode(t),u=e(c.length,1)>>>0;return A().subarray(u,u+c.length).set(c),p=c.length,u}let r=t.length,o=e(r,1)>>>0;const a=A();let i=0;for(;i127)break;a[o+i]=c}if(i!==r){i!==0&&(t=t.slice(i)),o=n(o,r,r=i+t.length*3,1)>>>0;const c=A().subarray(o+i,o+r),u=fe(t,c);i+=u.written,o=n(o,r,i,1)>>>0}return p=i,o}function E(t){return t==null}let h=null;function w(){return(h===null||h.buffer.detached===!0||h.buffer.detached===void 0&&h.buffer!==s.memory.buffer)&&(h=new DataView(s.memory.buffer)),h}const v=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&v.decode();function l(t,e){return t=t>>>0,v.decode(A().subarray(t,t+e))}function L(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const o=t.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){const o=t.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(t)){const o=t.length;let a="[";o>0&&(a+=L(t[0]));for(let i=1;i1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} -${t.stack}`:r}const z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{s.__wbindgen_export_3.get(t.dtor)(t.a,t.b)});function be(t,e,n,r){const o={a:t,b:e,cnt:1,dtor:n},a=(...i)=>{o.cnt++;const c=o.a;o.a=0;try{return r(c,o.b,...i)}finally{--o.cnt===0?(s.__wbindgen_export_3.get(o.dtor)(c,o.b),z.unregister(o)):o.a=c}};return a.original=o,z.register(a,o,o),a}function ge(t,e,n){s.closure1077_externref_shim(t,e,n)}function we(t){const e=s.__wbindgen_export_2.get(t);return s.__externref_table_dealloc(t),e}function y(t){return()=>{throw new Error(`${t} is not defined`)}}function le(t){const e=s.__externref_table_alloc();return s.__wbindgen_export_2.set(e,t),e}function _(t,e){try{return t.apply(this,e)}catch(n){const r=le(n);s.__wbindgen_exn_store(r)}}function de(t,e,n,r){s.closure14367_externref_shim(t,e,n,r)}const ye=["omit","same-origin","include"],he=["same-origin","no-cors","cors","navigate"],U=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>s.__wbg_backend_free(t>>>0,1));class P{static __wrap(e){e=e>>>0;const n=Object.create(P.prototype);return n.__wbg_ptr=e,U.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,U.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_backend_free(e,0)}constructor(){return s.backend_new()}getCountries(){return s.backend_getCountries(this.__wbg_ptr)}search(e,n){return s.backend_search(this.__wbg_ptr,e,n)}downloadMetrics(e){return s.backend_downloadMetrics(this.__wbg_ptr,e)}downloadMetricsSql(e){return s.backend_downloadMetricsSql(this.__wbg_ptr,e)}downloadGeoms(e){return s.backend_downloadGeoms(this.__wbg_ptr,e)}downloadDataRequest(e,n){const r=x(n,s.__wbindgen_malloc,s.__wbindgen_realloc),o=p;return s.backend_downloadDataRequest(this.__wbg_ptr,e,r,o)}downloadDataRequestMetrics(e){return s.backend_downloadDataRequestMetrics(this.__wbg_ptr,e)}downloadDataRequestMetricsSql(e){return s.backend_downloadDataRequestMetricsSql(this.__wbg_ptr,e)}downloadDataRequestGeoms(e){return s.backend_downloadDataRequestGeoms(this.__wbg_ptr,e)}downloadDataRequestGeomsPmtiles(e){return s.backend_downloadDataRequestGeomsPmtiles(this.__wbg_ptr,e)}addColours(e){let n,r;try{const i=s.backend_addColours(this.__wbg_ptr,e);var o=i[0],a=i[1];if(i[3])throw o=0,a=0,we(i[2]);return n=o,r=a,l(o,a)}finally{s.__wbindgen_free(n,r,1)}}}async function me(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function pe(){const t={};return t.wbg={},t.wbg.__wbg_backend_new=function(e){return P.__wrap(e)},t.wbg.__wbindgen_string_get=function(e,n){const r=n,o=typeof r=="string"?r:void 0;var a=E(o)?0:x(o,s.__wbindgen_malloc,s.__wbindgen_realloc),i=p;w().setInt32(e+4*1,i,!0),w().setInt32(e+4*0,a,!0)},t.wbg.__wbindgen_string_new=function(e,n){return l(e,n)},t.wbg.__wbindgen_error_new=function(e,n){return new Error(l(e,n))},t.wbg.__wbindgen_boolean_get=function(e){const n=e;return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_bigint=function(e){return typeof e=="bigint"},t.wbg.__wbindgen_number_get=function(e,n){const r=n,o=typeof r=="number"?r:void 0;w().setFloat64(e+8*1,E(o)?0:o,!0),w().setInt32(e+4*0,!E(o),!0)},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbindgen_in=function(e,n){return e in n},t.wbg.__wbindgen_bigint_from_i64=function(e){return e},t.wbg.__wbindgen_jsval_eq=function(e,n){return e===n},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return e==n},t.wbg.__wbindgen_as_number=function(e){return+e},t.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(e,n){return e[n]},t.wbg.__wbg_new_abda76e883ba8a5f=function(){return new Error},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=n.stack,o=x(r,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p;w().setInt32(e+4*1,a,!0),w().setInt32(e+4*0,o,!0)},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,o;try{r=e,o=n,console.error(l(e,n))}finally{s.__wbindgen_free(r,o,1)}},t.wbg.__wbg_fetch_f8d735ba6fe1b719=typeof fetch=="function"?fetch:y("fetch"),t.wbg.__wbg_queueMicrotask_848aa4969108a57e=function(e){return e.queueMicrotask},t.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbg_queueMicrotask_c5419c06eab41e73=typeof queueMicrotask=="function"?queueMicrotask:y("queueMicrotask"),t.wbg.__wbg_fetch_1fdc4448ed9eec00=function(e,n){return e.fetch(n)},t.wbg.__wbg_debug_69675dd374e2c249=typeof console.debug=="function"?console.debug:y("console.debug"),t.wbg.__wbg_error_53abcd6a461f73d8=typeof console.error=="function"?console.error:y("console.error"),t.wbg.__wbg_info_f073b719c8035bbf=typeof console.info=="function"?console.info:y("console.info"),t.wbg.__wbg_log_f740dc2253ea759b=typeof console.log=="function"?console.log:y("console.log"),t.wbg.__wbg_warn_41503a1c2194de89=typeof console.warn=="function"?console.warn:y("console.warn"),t.wbg.__wbg_newwithstrandinit_4b92c89af0a8e383=function(){return _(function(e,n,r){return new Request(l(e,n),r)},arguments)},t.wbg.__wbg_setbody_aa8b691bec428bf4=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_a4e661320cdb9738=function(e,n){e.credentials=ye[n]},t.wbg.__wbg_setheaders_f5205d36e423a544=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_ce2da76000b02f6a=function(e,n,r){e.method=l(n,r)},t.wbg.__wbg_setmode_4919fd636102c586=function(e,n){e.mode=he[n]},t.wbg.__wbg_setsignal_812ccb8269a7fd90=function(e,n){e.signal=n},t.wbg.__wbg_new_a9ae04a5200606a5=function(){return _(function(){return new Headers},arguments)},t.wbg.__wbg_append_8b3e7f74a47ea7d5=function(){return _(function(e,n,r,o,a){e.append(l(n,r),l(o,a))},arguments)},t.wbg.__wbg_instanceof_Response_3c0e210a57ff751d=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_url_58af972663531d16=function(e,n){const r=n.url,o=x(r,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p;w().setInt32(e+4*1,a,!0),w().setInt32(e+4*0,o,!0)},t.wbg.__wbg_status_5f4e900d22140a18=function(e){return e.status},t.wbg.__wbg_headers_1b9bf90c73fae600=function(e){return e.headers},t.wbg.__wbg_arrayBuffer_144729e09879650e=function(){return _(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_text_ebeee8b31af4c919=function(){return _(function(e){return e.text()},arguments)},t.wbg.__wbg_signal_9acfcec9e7dffc22=function(e){return e.signal},t.wbg.__wbg_new_75169ae5a9683c55=function(){return _(function(){return new AbortController},arguments)},t.wbg.__wbg_abort_c57daab47a6c1215=function(e){e.abort()},t.wbg.__wbg_crypto_1d1f22824a6a080c=function(e){return e.crypto},t.wbg.__wbg_process_4a72847cc503995b=function(e){return e.process},t.wbg.__wbg_versions_f686565e586dd935=function(e){return e.versions},t.wbg.__wbg_node_104a2ff8d6ea03a2=function(e){return e.node},t.wbg.__wbg_require_cca90b1a94a0255b=function(){return _(function(){return module.require},arguments)},t.wbg.__wbg_msCrypto_eb05e62b530a1508=function(e){return e.msCrypto},t.wbg.__wbg_randomFillSync_5c9c955aa56b6049=function(){return _(function(e,n){e.randomFillSync(n)},arguments)},t.wbg.__wbg_getRandomValues_3aa56aa6edec874c=function(){return _(function(e,n){e.getRandomValues(n)},arguments)},t.wbg.__wbg_get_5419cf6b954aa11d=function(e,n){return e[n>>>0]},t.wbg.__wbg_length_f217bbbf7e8e4df4=function(e){return e.length},t.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43=function(e,n){return new Function(l(e,n))},t.wbg.__wbg_next_13b477da1eaa3897=function(e){return e.next},t.wbg.__wbg_next_b06e115d1b01e10b=function(){return _(function(e){return e.next()},arguments)},t.wbg.__wbg_done_983b5ffcaec8c583=function(e){return e.done},t.wbg.__wbg_value_2ab8a198c834c26a=function(e){return e.value},t.wbg.__wbg_iterator_695d699a44d6234c=function(){return Symbol.iterator},t.wbg.__wbg_get_ef828680c64da212=function(){return _(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_call_a9ef466721e824f2=function(){return _(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_new_e69b5f66fda8f13c=function(){return new Object},t.wbg.__wbg_self_bf91bf94d9e04084=function(){return _(function(){return self.self},arguments)},t.wbg.__wbg_window_52dd9f07d03fd5f8=function(){return _(function(){return window.window},arguments)},t.wbg.__wbg_globalThis_05c129bf37fcf1be=function(){return _(function(){return globalThis.globalThis},arguments)},t.wbg.__wbg_global_3eca19bb09e9c484=function(){return _(function(){return global.global},arguments)},t.wbg.__wbg_isArray_6f3b47f09adb61b5=function(e){return Array.isArray(e)},t.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7=function(e){let n;try{n=e instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_call_3bfa248576352471=function(){return _(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_instanceof_Map_f96986929e7e89ed=function(e){let n;try{n=e instanceof Map}catch{n=!1}return n},t.wbg.__wbg_isSafeInteger_b9dff570f01a9100=function(e){return Number.isSafeInteger(e)},t.wbg.__wbg_entries_c02034de337d3ee2=function(e){return Object.entries(e)},t.wbg.__wbg_new_1073970097e5a420=function(e,n){try{var r={a:e,b:n},o=(i,c)=>{const u=r.a;r.a=0;try{return de(u,r.b,i,c)}finally{r.a=u}};return new Promise(o)}finally{r.a=r.b=0}},t.wbg.__wbg_resolve_0aad7c1484731c99=function(e){return Promise.resolve(e)},t.wbg.__wbg_then_748f75edfb032440=function(e,n){return e.then(n)},t.wbg.__wbg_then_4866a7d9f55d8f3e=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_buffer_ccaed51a635d8a2d=function(e){return e.buffer},t.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_new_fec2611eb9180f95=function(e){return new Uint8Array(e)},t.wbg.__wbg_set_ec2fcf81bc573fd9=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_length_9254c4bd3b9f23c4=function(e){return e.length},t.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36=function(e){let n;try{n=e instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbg_newwithlength_76462a666eca145f=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_subarray_975a06f9dbd16995=function(e,n,r){return e.subarray(n>>>0,r>>>0)},t.wbg.__wbg_stringify_eead5648c09faaf8=function(){return _(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_has_bd717f25f195f23d=function(){return _(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const r=n,o=typeof r=="bigint"?r:void 0;w().setBigInt64(e+8*1,E(o)?BigInt(0):o,!0),w().setInt32(e+4*0,!E(o),!0)},t.wbg.__wbindgen_debug_string=function(e,n){const r=L(n),o=x(r,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p;w().setInt32(e+4*1,a,!0),w().setInt32(e+4*0,o,!0)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(l(e,n))},t.wbg.__wbindgen_memory=function(){return s.memory},t.wbg.__wbindgen_closure_wrapper2453=function(e,n,r){return be(e,n,1078,ge)},t.wbg.__wbindgen_init_externref_table=function(){const e=s.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t}function Re(t,e){return s=t.exports,Y.__wbindgen_wasm_module=e,h=null,S=null,s.__wbindgen_start(),s}async function Y(t){if(s!==void 0)return s;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL(""+new URL("assets/rust_backend_bg-w-zFaO6K.wasm",import.meta.url).href,import.meta.url));const e=pe();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await me(await t,e);return Re(n,r)}class ke{constructor(){N(this,"inner");this.inner=null}async initialise(){await Y(),this.inner=await new P}unset(){this.inner=null}isLoaded(){return this.inner!=null}async addColours(e){if(!this.inner)throw new Error("RustBackend not initialised");const n=JSON.parse(this.inner.addColours(e));return console.log("RustBackend.addColours result",n),n}async getCountries(){if(!this.inner)throw new Error("RustBackend not initialised");const e=JSON.parse(await this.inner.getCountries());return console.log("RustBackend.getCountries result",e),e}async search(e,n){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.search(e,n))}async downloadMetrics(e){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.downloadMetrics(e))}async downloadGeoms(e){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.downloadGeoms(e))}async downloadDataRequestMetrics(e){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequestMetrics(e)}async downloadDataRequestMetricsSql(e){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequestMetricsSql(e)}async downloadDataRequestGeoms(e){if(!this.inner)throw new Error("RustBackend not initialised");return JSON.parse(await this.inner.downloadDataRequestGeoms(e))}async downloadDataRequestGeomsPmtiles(e){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequestGeomsPmtiles(e)}async downloadDataRequest(e,n="geojson"){if(!this.inner)throw new Error("RustBackend not initialised");return await this.inner.downloadDataRequest(e,n)}}B(ke); + */const G=Symbol("Comlink.proxy"),Q=Symbol("Comlink.endpoint"),Z=Symbol("Comlink.releaseProxy"),W=Symbol("Comlink.finalizer"),T=Symbol("Comlink.thrown"),B=t=>typeof t=="object"&&t!==null||typeof t=="function",ee={canHandle:t=>B(t)&&t[G],serialize(t){const{port1:e,port2:n}=new MessageChannel;return j(t,e),[n,[n]]},deserialize(t){return t.start(),oe(t)}},te={canHandle:t=>B(t)&&T in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},V=new Map([["proxy",ee],["throw",te]]);function ne(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function j(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(o){if(!o||!o.data)return;if(!ne(n,o.origin)){console.warn(`Invalid origin '${o.origin}' for comlink proxy`);return}const{id:a,type:i,path:c}=Object.assign({path:[]},o.data),u=(o.data.argumentList||[]).map(m);let f;try{const b=c.slice(0,-1).reduce((g,k)=>g[k],t),l=c.reduce((g,k)=>g[k],t);switch(i){case"GET":f=l;break;case"SET":b[c.slice(-1)[0]]=m(o.data.value),f=!0;break;case"APPLY":f=l.apply(b,u);break;case"CONSTRUCT":{const g=new l(...u);f=ue(g)}break;case"ENDPOINT":{const{port1:g,port2:k}=new MessageChannel;j(t,k),f=ce(g,[g])}break;case"RELEASE":f=void 0;break;default:return}}catch(b){f={value:b,[T]:0}}Promise.resolve(f).catch(b=>({value:b,[T]:0})).then(b=>{const[l,g]=L(b);e.postMessage(Object.assign(Object.assign({},l),{id:a}),g),i==="RELEASE"&&(e.removeEventListener("message",r),H(e),W in t&&typeof t[W]=="function"&&t[W]())}).catch(b=>{const[l,g]=L({value:new TypeError("Unserializable return value"),[T]:0});e.postMessage(Object.assign(Object.assign({},l),{id:a}),g)})}),e.start&&e.start()}function re(t){return t.constructor.name==="MessagePort"}function H(t){re(t)&&t.close()}function oe(t,e){return I(t,[],e)}function M(t){if(t)throw new Error("Proxy has been released and is not useable")}function $(t){return R(t,{type:"RELEASE"}).then(()=>{H(t)})}const O=new WeakMap,D="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(O.get(t)||0)-1;O.set(t,e),e===0&&$(t)});function se(t,e){const n=(O.get(e)||0)+1;O.set(e,n),D&&D.register(t,e,t)}function ie(t){D&&D.unregister(t)}function I(t,e=[],n=function(){}){let r=!1;const o=new Proxy(n,{get(a,i){if(M(r),i===Z)return()=>{ie(o),$(t),r=!0};if(i==="then"){if(e.length===0)return{then:()=>o};const c=R(t,{type:"GET",path:e.map(u=>u.toString())}).then(m);return c.then.bind(c)}return I(t,[...e,i])},set(a,i,c){M(r);const[u,f]=L(c);return R(t,{type:"SET",path:[...e,i].map(b=>b.toString()),value:u},f).then(m)},apply(a,i,c){M(r);const u=e[e.length-1];if(u===Q)return R(t,{type:"ENDPOINT"}).then(m);if(u==="bind")return I(t,e.slice(0,-1));const[f,b]=F(c);return R(t,{type:"APPLY",path:e.map(l=>l.toString()),argumentList:f},b).then(m)},construct(a,i){M(r);const[c,u]=F(i);return R(t,{type:"CONSTRUCT",path:e.map(f=>f.toString()),argumentList:c},u).then(m)}});return se(o,t),o}function ae(t){return Array.prototype.concat.apply([],t)}function F(t){const e=t.map(L);return[e.map(n=>n[0]),ae(e.map(n=>n[1]))]}const J=new WeakMap;function ce(t,e){return J.set(t,e),t}function ue(t){return Object.assign(t,{[G]:!0})}function L(t){for(const[e,n]of V)if(n.canHandle(t)){const[r,o]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},o]}return[{type:"RAW",value:t},J.get(t)||[]]}function m(t){switch(t.type){case"HANDLER":return V.get(t.name).deserialize(t.value);case"RAW":return t.value}}function R(t,e,n){return new Promise(r=>{const o=_e();t.addEventListener("message",function a(i){!i.data||!i.data.id||i.data.id!==o||(t.removeEventListener("message",a),r(i.data))}),t.start&&t.start(),t.postMessage(Object.assign({id:o},e),n)})}function _e(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}let s,p=0,S=null;function q(){return(S===null||S.byteLength===0)&&(S=new Uint8Array(s.memory.buffer)),S}const A=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},fe=typeof A.encodeInto=="function"?function(t,e){return A.encodeInto(t,e)}:function(t,e){const n=A.encode(t);return e.set(n),{read:t.length,written:n.length}};function x(t,e,n){if(n===void 0){const c=A.encode(t),u=e(c.length,1)>>>0;return q().subarray(u,u+c.length).set(c),p=c.length,u}let r=t.length,o=e(r,1)>>>0;const a=q();let i=0;for(;i127)break;a[o+i]=c}if(i!==r){i!==0&&(t=t.slice(i)),o=n(o,r,r=i+t.length*3,1)>>>0;const c=q().subarray(o+i,o+r),u=fe(t,c);i+=u.written,o=n(o,r,i,1)>>>0}return p=i,o}function E(t){return t==null}let h=null;function w(){return(h===null||h.buffer.detached===!0||h.buffer.detached===void 0&&h.buffer!==s.memory.buffer)&&(h=new DataView(s.memory.buffer)),h}const v=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&v.decode();function d(t,e){return t=t>>>0,v.decode(q().subarray(t,t+e))}function P(t){const e=typeof t;if(e=="number"||e=="boolean"||t==null)return`${t}`;if(e=="string")return`"${t}"`;if(e=="symbol"){const o=t.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){const o=t.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(t)){const o=t.length;let a="[";o>0&&(a+=P(t[0]));for(let i=1;i1)r=n[1];else return toString.call(t);if(r=="Object")try{return"Object("+JSON.stringify(t)+")"}catch{return"Object"}return t instanceof Error?`${t.name}: ${t.message} +${t.stack}`:r}const U=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>{s.__wbindgen_export_3.get(t.dtor)(t.a,t.b)});function be(t,e,n,r){const o={a:t,b:e,cnt:1,dtor:n},a=(...i)=>{o.cnt++;const c=o.a;o.a=0;try{return r(c,o.b,...i)}finally{--o.cnt===0?(s.__wbindgen_export_3.get(o.dtor)(c,o.b),U.unregister(o)):o.a=c}};return a.original=o,U.register(a,o,o),a}function ge(t,e,n){s.closure1088_externref_shim(t,e,n)}function we(t){const e=s.__wbindgen_export_2.get(t);return s.__externref_table_dealloc(t),e}function y(t){return()=>{throw new Error(`${t} is not defined`)}}function de(t){const e=s.__externref_table_alloc();return s.__wbindgen_export_2.set(e,t),e}function _(t,e){try{return t.apply(this,e)}catch(n){const r=de(n);s.__wbindgen_exn_store(r)}}function le(t,e,n,r){s.closure14515_externref_shim(t,e,n,r)}const ye=["omit","same-origin","include"],he=["same-origin","no-cors","cors","navigate"],z=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>s.__wbg_backend_free(t>>>0,1));class C{static __wrap(e){e=e>>>0;const n=Object.create(C.prototype);return n.__wbg_ptr=e,z.register(n,n.__wbg_ptr,n),n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,z.unregister(this),e}free(){const e=this.__destroy_into_raw();s.__wbg_backend_free(e,0)}constructor(){return s.backend_new()}getCountries(){return s.backend_getCountries(this.__wbg_ptr)}search(e,n){return s.backend_search(this.__wbg_ptr,e,n)}downloadMetrics(e){return s.backend_downloadMetrics(this.__wbg_ptr,e)}downloadMetricsSql(e){return s.backend_downloadMetricsSql(this.__wbg_ptr,e)}downloadGeoms(e){return s.backend_downloadGeoms(this.__wbg_ptr,e)}downloadDataRequest(e,n){const r=x(n,s.__wbindgen_malloc,s.__wbindgen_realloc),o=p;return s.backend_downloadDataRequest(this.__wbg_ptr,e,r,o)}downloadDataRequestMetrics(e){return s.backend_downloadDataRequestMetrics(this.__wbg_ptr,e)}downloadDataRequestMetricsSql(e){return s.backend_downloadDataRequestMetricsSql(this.__wbg_ptr,e)}downloadDataRequestGeoms(e){return s.backend_downloadDataRequestGeoms(this.__wbg_ptr,e)}downloadDataRequestGeomsPmtiles(e){return s.backend_downloadDataRequestGeomsPmtiles(this.__wbg_ptr,e)}addColours(e){let n,r;try{const i=s.backend_addColours(this.__wbg_ptr,e);var o=i[0],a=i[1];if(i[3])throw o=0,a=0,we(i[2]);return n=o,r=a,d(o,a)}finally{s.__wbindgen_free(n,r,1)}}}async function me(t,e){if(typeof Response=="function"&&t instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(t,e)}catch(r){if(t.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",r);else throw r}const n=await t.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(t,e);return n instanceof WebAssembly.Instance?{instance:n,module:t}:n}}function pe(){const t={};return t.wbg={},t.wbg.__wbindgen_string_get=function(e,n){const r=n,o=typeof r=="string"?r:void 0;var a=E(o)?0:x(o,s.__wbindgen_malloc,s.__wbindgen_realloc),i=p;w().setInt32(e+4*1,i,!0),w().setInt32(e+4*0,a,!0)},t.wbg.__wbg_backend_new=function(e){return C.__wrap(e)},t.wbg.__wbindgen_string_new=function(e,n){return d(e,n)},t.wbg.__wbindgen_boolean_get=function(e){const n=e;return typeof n=="boolean"?n?1:0:2},t.wbg.__wbindgen_is_bigint=function(e){return typeof e=="bigint"},t.wbg.__wbindgen_number_get=function(e,n){const r=n,o=typeof r=="number"?r:void 0;w().setFloat64(e+8*1,E(o)?0:o,!0),w().setInt32(e+4*0,!E(o),!0)},t.wbg.__wbindgen_is_object=function(e){const n=e;return typeof n=="object"&&n!==null},t.wbg.__wbindgen_in=function(e,n){return e in n},t.wbg.__wbindgen_bigint_from_i64=function(e){return e},t.wbg.__wbindgen_jsval_eq=function(e,n){return e===n},t.wbg.__wbindgen_bigint_from_u64=function(e){return BigInt.asUintN(64,e)},t.wbg.__wbindgen_error_new=function(e,n){return new Error(d(e,n))},t.wbg.__wbindgen_is_string=function(e){return typeof e=="string"},t.wbg.__wbindgen_is_undefined=function(e){return e===void 0},t.wbg.__wbindgen_cb_drop=function(e){const n=e.original;return n.cnt--==1?(n.a=0,!0):!1},t.wbg.__wbindgen_jsval_loose_eq=function(e,n){return e==n},t.wbg.__wbindgen_as_number=function(e){return+e},t.wbg.__wbg_getwithrefkey_edc2c8960f0f1191=function(e,n){return e[n]},t.wbg.__wbg_new_abda76e883ba8a5f=function(){return new Error},t.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const r=n.stack,o=x(r,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p;w().setInt32(e+4*1,a,!0),w().setInt32(e+4*0,o,!0)},t.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let r,o;try{r=e,o=n,console.error(d(e,n))}finally{s.__wbindgen_free(r,o,1)}},t.wbg.__wbg_fetch_f8d735ba6fe1b719=typeof fetch=="function"?fetch:y("fetch"),t.wbg.__wbg_queueMicrotask_848aa4969108a57e=function(e){return e.queueMicrotask},t.wbg.__wbindgen_is_function=function(e){return typeof e=="function"},t.wbg.__wbg_queueMicrotask_c5419c06eab41e73=typeof queueMicrotask=="function"?queueMicrotask:y("queueMicrotask"),t.wbg.__wbg_fetch_1fdc4448ed9eec00=function(e,n){return e.fetch(n)},t.wbg.__wbg_debug_69675dd374e2c249=typeof console.debug=="function"?console.debug:y("console.debug"),t.wbg.__wbg_error_53abcd6a461f73d8=typeof console.error=="function"?console.error:y("console.error"),t.wbg.__wbg_info_f073b719c8035bbf=typeof console.info=="function"?console.info:y("console.info"),t.wbg.__wbg_log_f740dc2253ea759b=typeof console.log=="function"?console.log:y("console.log"),t.wbg.__wbg_warn_41503a1c2194de89=typeof console.warn=="function"?console.warn:y("console.warn"),t.wbg.__wbg_newwithstrandinit_4b92c89af0a8e383=function(){return _(function(e,n,r){return new Request(d(e,n),r)},arguments)},t.wbg.__wbg_setbody_aa8b691bec428bf4=function(e,n){e.body=n},t.wbg.__wbg_setcredentials_a4e661320cdb9738=function(e,n){e.credentials=ye[n]},t.wbg.__wbg_setheaders_f5205d36e423a544=function(e,n){e.headers=n},t.wbg.__wbg_setmethod_ce2da76000b02f6a=function(e,n,r){e.method=d(n,r)},t.wbg.__wbg_setmode_4919fd636102c586=function(e,n){e.mode=he[n]},t.wbg.__wbg_setsignal_812ccb8269a7fd90=function(e,n){e.signal=n},t.wbg.__wbg_new_a9ae04a5200606a5=function(){return _(function(){return new Headers},arguments)},t.wbg.__wbg_append_8b3e7f74a47ea7d5=function(){return _(function(e,n,r,o,a){e.append(d(n,r),d(o,a))},arguments)},t.wbg.__wbg_instanceof_Response_3c0e210a57ff751d=function(e){let n;try{n=e instanceof Response}catch{n=!1}return n},t.wbg.__wbg_url_58af972663531d16=function(e,n){const r=n.url,o=x(r,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p;w().setInt32(e+4*1,a,!0),w().setInt32(e+4*0,o,!0)},t.wbg.__wbg_status_5f4e900d22140a18=function(e){return e.status},t.wbg.__wbg_headers_1b9bf90c73fae600=function(e){return e.headers},t.wbg.__wbg_arrayBuffer_144729e09879650e=function(){return _(function(e){return e.arrayBuffer()},arguments)},t.wbg.__wbg_text_ebeee8b31af4c919=function(){return _(function(e){return e.text()},arguments)},t.wbg.__wbg_signal_9acfcec9e7dffc22=function(e){return e.signal},t.wbg.__wbg_new_75169ae5a9683c55=function(){return _(function(){return new AbortController},arguments)},t.wbg.__wbg_abort_c57daab47a6c1215=function(e){e.abort()},t.wbg.__wbg_crypto_1d1f22824a6a080c=function(e){return e.crypto},t.wbg.__wbg_process_4a72847cc503995b=function(e){return e.process},t.wbg.__wbg_versions_f686565e586dd935=function(e){return e.versions},t.wbg.__wbg_node_104a2ff8d6ea03a2=function(e){return e.node},t.wbg.__wbg_require_cca90b1a94a0255b=function(){return _(function(){return module.require},arguments)},t.wbg.__wbg_msCrypto_eb05e62b530a1508=function(e){return e.msCrypto},t.wbg.__wbg_randomFillSync_5c9c955aa56b6049=function(){return _(function(e,n){e.randomFillSync(n)},arguments)},t.wbg.__wbg_getRandomValues_3aa56aa6edec874c=function(){return _(function(e,n){e.getRandomValues(n)},arguments)},t.wbg.__wbg_get_5419cf6b954aa11d=function(e,n){return e[n>>>0]},t.wbg.__wbg_length_f217bbbf7e8e4df4=function(e){return e.length},t.wbg.__wbg_newnoargs_1ede4bf2ebbaaf43=function(e,n){return new Function(d(e,n))},t.wbg.__wbg_next_13b477da1eaa3897=function(e){return e.next},t.wbg.__wbg_next_b06e115d1b01e10b=function(){return _(function(e){return e.next()},arguments)},t.wbg.__wbg_done_983b5ffcaec8c583=function(e){return e.done},t.wbg.__wbg_value_2ab8a198c834c26a=function(e){return e.value},t.wbg.__wbg_iterator_695d699a44d6234c=function(){return Symbol.iterator},t.wbg.__wbg_get_ef828680c64da212=function(){return _(function(e,n){return Reflect.get(e,n)},arguments)},t.wbg.__wbg_call_a9ef466721e824f2=function(){return _(function(e,n){return e.call(n)},arguments)},t.wbg.__wbg_new_e69b5f66fda8f13c=function(){return new Object},t.wbg.__wbg_self_bf91bf94d9e04084=function(){return _(function(){return self.self},arguments)},t.wbg.__wbg_window_52dd9f07d03fd5f8=function(){return _(function(){return window.window},arguments)},t.wbg.__wbg_globalThis_05c129bf37fcf1be=function(){return _(function(){return globalThis.globalThis},arguments)},t.wbg.__wbg_global_3eca19bb09e9c484=function(){return _(function(){return global.global},arguments)},t.wbg.__wbg_isArray_6f3b47f09adb61b5=function(e){return Array.isArray(e)},t.wbg.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7=function(e){let n;try{n=e instanceof ArrayBuffer}catch{n=!1}return n},t.wbg.__wbg_call_3bfa248576352471=function(){return _(function(e,n,r){return e.call(n,r)},arguments)},t.wbg.__wbg_instanceof_Map_f96986929e7e89ed=function(e){let n;try{n=e instanceof Map}catch{n=!1}return n},t.wbg.__wbg_isSafeInteger_b9dff570f01a9100=function(e){return Number.isSafeInteger(e)},t.wbg.__wbg_entries_c02034de337d3ee2=function(e){return Object.entries(e)},t.wbg.__wbg_new_1073970097e5a420=function(e,n){try{var r={a:e,b:n},o=(i,c)=>{const u=r.a;r.a=0;try{return le(u,r.b,i,c)}finally{r.a=u}};return new Promise(o)}finally{r.a=r.b=0}},t.wbg.__wbg_resolve_0aad7c1484731c99=function(e){return Promise.resolve(e)},t.wbg.__wbg_then_748f75edfb032440=function(e,n){return e.then(n)},t.wbg.__wbg_then_4866a7d9f55d8f3e=function(e,n,r){return e.then(n,r)},t.wbg.__wbg_buffer_ccaed51a635d8a2d=function(e){return e.buffer},t.wbg.__wbg_newwithbyteoffsetandlength_7e3eb787208af730=function(e,n,r){return new Uint8Array(e,n>>>0,r>>>0)},t.wbg.__wbg_new_fec2611eb9180f95=function(e){return new Uint8Array(e)},t.wbg.__wbg_set_ec2fcf81bc573fd9=function(e,n,r){e.set(n,r>>>0)},t.wbg.__wbg_length_9254c4bd3b9f23c4=function(e){return e.length},t.wbg.__wbg_instanceof_Uint8Array_df0761410414ef36=function(e){let n;try{n=e instanceof Uint8Array}catch{n=!1}return n},t.wbg.__wbg_newwithlength_76462a666eca145f=function(e){return new Uint8Array(e>>>0)},t.wbg.__wbg_subarray_975a06f9dbd16995=function(e,n,r){return e.subarray(n>>>0,r>>>0)},t.wbg.__wbg_stringify_eead5648c09faaf8=function(){return _(function(e){return JSON.stringify(e)},arguments)},t.wbg.__wbg_has_bd717f25f195f23d=function(){return _(function(e,n){return Reflect.has(e,n)},arguments)},t.wbg.__wbindgen_bigint_get_as_i64=function(e,n){const r=n,o=typeof r=="bigint"?r:void 0;w().setBigInt64(e+8*1,E(o)?BigInt(0):o,!0),w().setInt32(e+4*0,!E(o),!0)},t.wbg.__wbindgen_debug_string=function(e,n){const r=P(n),o=x(r,s.__wbindgen_malloc,s.__wbindgen_realloc),a=p;w().setInt32(e+4*1,a,!0),w().setInt32(e+4*0,o,!0)},t.wbg.__wbindgen_throw=function(e,n){throw new Error(d(e,n))},t.wbg.__wbindgen_memory=function(){return s.memory},t.wbg.__wbindgen_closure_wrapper2470=function(e,n,r){return be(e,n,1089,ge)},t.wbg.__wbindgen_init_externref_table=function(){const e=s.__wbindgen_export_2,n=e.grow(4);e.set(0,void 0),e.set(n+0,void 0),e.set(n+1,null),e.set(n+2,!0),e.set(n+3,!1)},t}function Re(t,e){return s=t.exports,Y.__wbindgen_wasm_module=e,h=null,S=null,s.__wbindgen_start(),s}async function Y(t){if(s!==void 0)return s;typeof t<"u"&&(Object.getPrototypeOf(t)===Object.prototype?{module_or_path:t}=t:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof t>"u"&&(t=new URL(""+new URL("assets/rust_backend_bg-DgvIor_q.wasm",import.meta.url).href,import.meta.url));const e=pe();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:n,module:r}=await me(await t,e);return Re(n,r)}class ke{constructor(){N(this,"inner");this.inner=null}async initialise(){await Y(),this.inner=await new C}unset(){this.inner=null}isLoaded(){return this.inner!=null}isLoadedWithThrow(){if(!this.isLoaded())throw new Error("RustBackend not initialised")}async addColours(e){this.isLoadedWithThrow();const n=JSON.parse(this.inner.addColours(e));return console.log("RustBackend.addColours result",n),n}async getCountries(){this.isLoadedWithThrow();const e=JSON.parse(await this.inner.getCountries());return console.log("RustBackend.getCountries result",e),e}async search(e,n){return this.isLoadedWithThrow(),JSON.parse(await this.inner.search(e,n))}async downloadMetrics(e){return this.isLoadedWithThrow(),JSON.parse(await this.inner.downloadMetrics(e))}async downloadGeoms(e){return this.isLoadedWithThrow(),JSON.parse(await this.inner.downloadGeoms(e))}async downloadDataRequestMetrics(e){return this.isLoadedWithThrow(),await this.inner.downloadDataRequestMetrics(e)}async downloadDataRequestMetricsSql(e){return this.isLoadedWithThrow(),await this.inner.downloadDataRequestMetricsSql(e)}async downloadDataRequestGeoms(e){return this.isLoadedWithThrow(),JSON.parse(await this.inner.downloadDataRequestGeoms(e))}async downloadDataRequestGeomsPmtiles(e){return this.isLoadedWithThrow(),await this.inner.downloadDataRequestGeomsPmtiles(e)}async downloadDataRequest(e,n="geojson"){return this.isLoadedWithThrow(),await this.inner.downloadDataRequest(e,n)}}j(ke); diff --git a/_app/version.json b/_app/version.json index ba57140..9ab1d2f 100644 --- a/_app/version.json +++ b/_app/version.json @@ -1 +1 @@ -{"version":"1731457984989"} \ No newline at end of file +{"version":"1733935418797"} \ No newline at end of file diff --git a/assets/rust_backend_bg.wasm b/assets/rust_backend_bg.wasm index c552582..a21e7b6 100644 Binary files a/assets/rust_backend_bg.wasm and b/assets/rust_backend_bg.wasm differ diff --git a/index.html b/index.html index cbf110a..bedc74a 100644 --- a/index.html +++ b/index.html @@ -5,11 +5,11 @@ - - + + - + @@ -18,15 +18,15 @@