@opengis/admin 0.1.32 → 0.1.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,7 +33,7 @@ Use slot props instead:
33
33
  - Location:`,Ce),Z({});let Xe;if(Ce.path!=null)process.env.NODE_ENV!=="production"&&"params"in Ce&&!("name"in Ce)&&Object.keys(Ce.params).length&&en(`Path "${Ce.path}" was passed with params but they will be ignored. Use a named route alongside params instead.`),Xe=wn({},Ce,{path:mg(n,Ce.path,je.path).path});else{const At=wn({},Ce.params);for(const ln in At)At[ln]==null&&delete At[ln];Xe=wn({},Ce,{params:E(At)}),je.params=E(je.params)}const lt=e.resolve(Xe,je),Bt=Ce.hash||"";process.env.NODE_ENV!=="production"&&Bt&&!Bt.startsWith("#")&&en(`A \`hash\` should always start with the character "#". Replace "${Bt}" with "#${Bt}".`),lt.params=k(T(lt.params));const rn=ZT(i,wn({},Ce,{hash:jT(Bt),path:lt.path})),Dt=r.createHref(rn);return process.env.NODE_ENV!=="production"&&(Dt.startsWith("//")?en(`Location "${Ce}" resolved to "${Dt}". A resolved location cannot start with multiple slashes.`):lt.matched.length||en(`No match found for location with path "${Ce.path!=null?Ce.path:Ce}"`)),wn({fullPath:rn,hash:Bt,query:i===bx?AM(Ce.query):Ce.query||{}},lt,{redirectedFrom:void 0,href:Dt})}function ee(Ce){return typeof Ce=="string"?mg(n,Ce,g.value.path):wn({},Ce)}function oe(Ce,je){if(_!==Ce)return fc(8,{from:je,to:Ce})}function J(Ce){return Me(Ce)}function Ae(Ce){return J(wn(ee(Ce),{replace:!0}))}function ke(Ce){const je=Ce.matched[Ce.matched.length-1];if(je&&je.redirect){const{redirect:Xe}=je;let lt=typeof Xe=="function"?Xe(Ce):Xe;if(typeof lt=="string"&&(lt=lt.includes("?")||lt.includes("#")?lt=ee(lt):{path:lt},lt.params={}),process.env.NODE_ENV!=="production"&&lt.path==null&&!("name"in lt))throw en(`Invalid redirect found:
34
34
  ${JSON.stringify(lt,null,2)}
35
35
  when navigating to "${Ce.fullPath}". A redirect must contain a name or path. This will break in production.`),new Error("Invalid redirect");return wn({query:Ce.query,hash:Ce.hash,params:lt.path!=null?{}:Ce.params},lt)}}function Me(Ce,je){const Xe=_=Z(Ce),lt=g.value,Bt=Ce.state,rn=Ce.force,Dt=Ce.replace===!0,At=ke(Xe);if(At)return Me(wn(ee(At),{state:typeof At=="object"?wn({},Bt,At.state):Bt,force:rn,replace:Dt}),je||Xe);const ln=Xe;ln.redirectedFrom=je;let we;return!rn&&rx(i,lt,Xe)&&(we=fc(16,{to:ln,from:lt}),In(lt,lt,!0,!1)),(we?Promise.resolve(we):Ye(ln,lt)).catch(En=>xo(En)?xo(En,2)?En:hn(En):Mt(En,ln,lt)).then(En=>{if(En){if(xo(En,2))return process.env.NODE_ENV!=="production"&&rx(i,Z(En.to),ln)&&je&&(je._count=je._count?je._count+1:1)>30?(en(`Detected a possibly infinite redirection in a navigation guard when going from "${lt.fullPath}" to "${ln.fullPath}". Aborting to avoid a Stack Overflow.
36
- Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`),Promise.reject(new Error("Infinite redirect in navigation guard"))):Me(wn({replace:Dt},ee(En.to),{state:typeof En.to=="object"?wn({},Bt,En.to.state):Bt,force:rn}),je||ln)}else En=Nt(ln,lt,!0,Dt,Bt);return it(ln,lt,En),En})}function Le(Ce,je){const Xe=oe(Ce,je);return Xe?Promise.reject(Xe):Promise.resolve()}function Ie(Ce){const je=Wn.values().next().value;return je&&typeof je.runWithContext=="function"?je.runWithContext(Ce):Ce()}function Ye(Ce,je){let Xe;const[lt,Bt,rn]=XM(Ce,je);Xe=vg(lt.reverse(),"beforeRouteLeave",Ce,je);for(const At of lt)At.leaveGuards.forEach(ln=>{Xe.push(oa(ln,Ce,je))});const Dt=Le.bind(null,Ce,je);return Xe.push(Dt),Gn(Xe).then(()=>{Xe=[];for(const At of a.list())Xe.push(oa(At,Ce,je));return Xe.push(Dt),Gn(Xe)}).then(()=>{Xe=vg(Bt,"beforeRouteUpdate",Ce,je);for(const At of Bt)At.updateGuards.forEach(ln=>{Xe.push(oa(ln,Ce,je))});return Xe.push(Dt),Gn(Xe)}).then(()=>{Xe=[];for(const At of rn)if(At.beforeEnter)if(Hr(At.beforeEnter))for(const ln of At.beforeEnter)Xe.push(oa(ln,Ce,je));else Xe.push(oa(At.beforeEnter,Ce,je));return Xe.push(Dt),Gn(Xe)}).then(()=>(Ce.matched.forEach(At=>At.enterCallbacks={}),Xe=vg(rn,"beforeRouteEnter",Ce,je,Ie),Xe.push(Dt),Gn(Xe))).then(()=>{Xe=[];for(const At of u.list())Xe.push(oa(At,Ce,je));return Xe.push(Dt),Gn(Xe)}).catch(At=>xo(At,8)?At:Promise.reject(At))}function it(Ce,je,Xe){l.list().forEach(lt=>Ie(()=>lt(Ce,je,Xe)))}function Nt(Ce,je,Xe,lt,Bt){const rn=oe(Ce,je);if(rn)return rn;const Dt=je===sa,At=bo?history.state:{};Xe&&(lt||Dt?r.replace(Ce.fullPath,wn({scroll:Dt&&At&&At.scroll},Bt)):r.push(Ce.fullPath,Bt)),g.value=Ce,In(Ce,je,Xe,Dt),hn()}let ht;function Rt(){ht||(ht=r.listen((Ce,je,Xe)=>{if(!jn.listening)return;const lt=Z(Ce),Bt=ke(lt);if(Bt){Me(wn(Bt,{replace:!0}),lt).catch(Ju);return}_=lt;const rn=g.value;bo&&nM(ax(rn.fullPath,Xe.delta),hp()),Ye(lt,rn).catch(Dt=>xo(Dt,12)?Dt:xo(Dt,2)?(Me(Dt.to,lt).then(At=>{xo(At,20)&&!Xe.delta&&Xe.type===Qu.pop&&r.go(-1,!1)}).catch(Ju),Promise.reject()):(Xe.delta&&r.go(-Xe.delta,!1),Mt(Dt,lt,rn))).then(Dt=>{Dt=Dt||Nt(lt,rn,!1),Dt&&(Xe.delta&&!xo(Dt,8)?r.go(-Xe.delta,!1):Xe.type===Qu.pop&&xo(Dt,20)&&r.go(-1,!1)),it(lt,rn,Dt)}).catch(Ju)}))}let Xt=th(),nn=th(),jt;function Mt(Ce,je,Xe){hn(Ce);const lt=nn.list();return lt.length?lt.forEach(Bt=>Bt(Ce,je,Xe)):(process.env.NODE_ENV!=="production"&&en("uncaught error during route navigation:"),console.error(Ce)),Promise.reject(Ce)}function Sn(){return jt&&g.value!==sa?Promise.resolve():new Promise((Ce,je)=>{Xt.add([Ce,je])})}function hn(Ce){return jt||(jt=!Ce,Rt(),Xt.list().forEach(([je,Xe])=>Ce?Xe(Ce):je()),Xt.reset()),Ce}function In(Ce,je,Xe,lt){const{scrollBehavior:Bt}=t;if(!bo||!Bt)return Promise.resolve();const rn=!Xe&&iM(ax(Ce.fullPath,0))||(lt||!Xe)&&history.state&&history.state.scroll||null;return S.nextTick().then(()=>Bt(Ce,je,rn)).then(Dt=>Dt&&tM(Dt)).catch(Dt=>Mt(Dt,Ce,je))}const bn=Ce=>r.go(Ce);let pi;const Wn=new Set,jn={currentRoute:g,listening:!0,addRoute:I,removeRoute:z,clearRoutes:e.clearRoutes,hasRoute:H,getRoutes:V,resolve:Z,options:t,push:J,replace:Ae,go:bn,back:()=>bn(-1),forward:()=>bn(1),beforeEach:a.add,beforeResolve:u.add,afterEach:l.add,onError:nn.add,isReady:Sn,install(Ce){const je=this;Ce.component("RouterLink",DM),Ce.component("RouterView",LM),Ce.config.globalProperties.$router=je,Object.defineProperty(Ce.config.globalProperties,"$route",{enumerable:!0,get:()=>S.unref(g)}),bo&&!pi&&g.value===sa&&(pi=!0,J(r.location).catch(Bt=>{process.env.NODE_ENV!=="production"&&en("Unexpected error when starting the router:",Bt)}));const Xe={};for(const Bt in sa)Object.defineProperty(Xe,Bt,{get:()=>g.value[Bt],enumerable:!0});Ce.provide(bg,je),Ce.provide(vx,S.shallowReactive(Xe)),Ce.provide(xg,g);const lt=Ce.unmount;Wn.add(Ce),Ce.unmount=function(){Wn.delete(Ce),Wn.size<1&&(_=sa,ht&&ht(),ht=null,g.value=sa,pi=!1,jt=!1),lt()},process.env.NODE_ENV!=="production"&&bo&&FM(Ce,je,e)}};function Gn(Ce){return Ce.reduce((je,Xe)=>je.then(()=>Ie(Xe)),Promise.resolve())}return jn}function XM(t,e){const n=[],i=[],r=[],a=Math.max(e.matched.length,t.matched.length);for(let u=0;u<a;u++){const l=e.matched[u];l&&(t.matched.find(_=>ra(_,l))?i.push(l):n.push(l));const g=t.matched[u];g&&(e.matched.find(_=>ra(_,g))||r.push(g))}return[n,i,r]}const KM=[{name:"edit",path:"/edit",component:()=>Promise.resolve().then(()=>d$)},{name:"add",path:"/add",component:()=>Promise.resolve().then(()=>x$)},{name:"card-view",path:"/card",component:()=>Promise.resolve().then(()=>hS),children:[{name:"table",path:":table",component:()=>Promise.resolve().then(()=>hS),children:[{name:"card",path:":id",component:()=>Promise.resolve().then(()=>q$)}]}]}],JM={},QM={class:"bg-gray-200 w-full px-16 md:px-0 h-screen flex items-center justify-center"},eA={class:"bg-white border border-gray-200 flex flex-col items-center justify-center px-4 md:px-8 lg:px-24 py-8 rounded-lg shadow-2xl"};function tA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",QM,[S.createElementVNode("div",eA,[e[2]||(e[2]=S.createElementVNode("p",{class:"text-6xl md:text-7xl lg:text-9xl font-bold tracking-wider text-gray-300"}," 404 ",-1)),e[3]||(e[3]=S.createElementVNode("p",{class:"text-2xl md:text-3xl lg:text-5xl font-bold tracking-wider text-gray-500 mt-4"}," Сторінку не знайдено ",-1)),e[4]||(e[4]=S.createElementVNode("p",{class:"text-gray-500 mt-4 pb-4 border-b-2 text-center"}," Вибачте, така сторінка не існує ",-1)),S.createElementVNode("div",{onClick:e[0]||(e[0]=u=>t.$router.push("/")),class:"flex cursor-pointer items-center space-x-2 bg-blue-600 hover:bg-blue-700 text-gray-100 px-4 py-2 mt-6 rounded transition duration-150",title:"Return Home"},e[1]||(e[1]=[S.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[S.createElementVNode("path",{"fill-rule":"evenodd",d:"M9.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L7.414 9H15a1 1 0 110 2H7.414l2.293 2.293a1 1 0 010 1.414z","clip-rule":"evenodd"})],-1),S.createElementVNode("span",null,"Повернутись на головну",-1)]))])])}const nA=_t(JM,[["render",tA]]),iA=t=>{const e=KM.map(i=>({...i}));return{router:YM({history:aM(),routes:[{path:"/404",name:"404",component:nA},{path:"/",name:"global",component:()=>Promise.resolve().then(()=>B8),children:[...e,...t,{path:"/:catchAll(.*)",component:()=>Promise.resolve().then(()=>w7)}]}]}),routerData:e}},rA={props:{value:{type:[String,Number,Array,Boolean],default:()=>""},data:{type:Object},table:{type:String},name:String,inline:{type:Boolean,default:()=>!1}},methods:{async changeData(t){var e;try{await wt.put(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`,{...this.data,[this.name]:t}),await this.$emit("update-table")}catch(n){console.log(n)}}}},sA={class:"text-start"},oA={key:1,class:"text-start"};function aA(t,e,n,i,r,a){const u=S.resolveComponent("VsInlineEdit");return n.inline?(S.openBlock(),S.createBlock(u,{key:0,"model-value":n.value,onUpdateValue:a.changeData},{default:S.withCtx(()=>[S.createElementVNode("button",sA,S.toDisplayString(n.value),1)]),_:1},8,["model-value","onUpdateValue"])):(S.openBlock(),S.createElementBlock("div",oA,S.toDisplayString(n.value),1))}const Ox=_t(rA,[["render",aA]]),lA={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var t;return(t=this.data)==null?void 0:t[this.name+"_data"]}},methods:{getBGColor(t){if(t!=null&&t.includes("#")){let e;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return e=t.substring(1).split(""),e.length==3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]]),e="0x"+e.join(""),"rgba("+[e>>16&255,e>>8&255,e&255].join(",")+",0.2)";throw new Error("Bad Hex")}else if(typeof t=="string"){const e=document.createElement("div");e.style.color=t,document.body.appendChild(e);const n=getComputedStyle(e).color;return document.body.removeChild(e),n.replace("rgb","rgba").replace(")",", 0.2)")}else throw new Error("Invalid color format")}}},cA={class:"w-full flex justify-start"},uA={key:1};function hA(t,e,n,i,r,a){var u,l,g;return S.openBlock(),S.createElementBlock("div",cA,[a.getData?(S.openBlock(),S.createElementBlock("div",{key:0,class:"p-2 ps-1.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium text-black rounded-full",style:S.normalizeStyle({backgroundColor:a.getBGColor((u=a.getData)==null?void 0:u.color),color:(l=a.getData)==null?void 0:l.color})},S.toDisplayString((g=a.getData)==null?void 0:g.text),5)):(S.openBlock(),S.createElementBlock("div",uA,"-"))])}const dA=_t(lA,[["render",hA]]),pA={},fA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function mA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",fA,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const gA={components:{IconCheck:_t(pA,[["render",mA]])},props:{value:Boolean}},yA={class:"px-[20px]"},_A={key:1};function bA(t,e,n,i,r,a){const u=S.resolveComponent("IconCheck");return S.openBlock(),S.createElementBlock("div",yA,[n.value?(S.openBlock(),S.createBlock(u,{key:0,height:"24",width:"24",class:"text-blue-500"})):(S.openBlock(),S.createElementBlock("div",_A))])}const zx=_t(gA,[["render",bA]]),xA={props:{data:Object,name:String},computed:{getData(){var t,e,n;return((e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.text)||((n=this.data)==null?void 0:n[this.name+"_text"])}}},vA={class:""},wA={key:0},kA={key:1},SA={key:1};function EA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",vA,[a.getData?(S.openBlock(),S.createElementBlock("div",wA,[typeof a.getData=="object"?(S.openBlock(!0),S.createElementBlock(S.Fragment,{key:0},S.renderList(a.getData,(u,l)=>(S.openBlock(),S.createElementBlock("div",{key:l},S.toDisplayString(u),1))),128)):(S.openBlock(),S.createElementBlock("div",kA,S.toDisplayString(a.getData),1))])):(S.openBlock(),S.createElementBlock("div",SA,"-"))])}const CA=_t(xA,[["render",EA]]),TA={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var t,e;return((t=this.data)==null?void 0:t[this.name])||((e=this.data)==null?void 0:e[this.name+"_data"])}},methods:{}},MA={class:"w-full flex justify-start"},AA={key:0,class:"js-clipboard [--is-toggle-tooltip:false] hs-tooltip p-2 bg-stone-100 text-stone-800 text-xs rounded-md cursor-pointer"},PA={key:1};function IA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",MA,[a.getData?(S.openBlock(),S.createElementBlock("div",AA,S.toDisplayString(a.getData),1)):(S.openBlock(),S.createElementBlock("div",PA,"-"))])}const DA=_t(TA,[["render",IA]]);//! moment.js
36
+ Are you always returning a new location within a navigation guard? That would lead to this error. Only return when redirecting or aborting, that should fix this. This might break in production if not fixed.`),Promise.reject(new Error("Infinite redirect in navigation guard"))):Me(wn({replace:Dt},ee(En.to),{state:typeof En.to=="object"?wn({},Bt,En.to.state):Bt,force:rn}),je||ln)}else En=Nt(ln,lt,!0,Dt,Bt);return it(ln,lt,En),En})}function Le(Ce,je){const Xe=oe(Ce,je);return Xe?Promise.reject(Xe):Promise.resolve()}function Ie(Ce){const je=Wn.values().next().value;return je&&typeof je.runWithContext=="function"?je.runWithContext(Ce):Ce()}function Ye(Ce,je){let Xe;const[lt,Bt,rn]=XM(Ce,je);Xe=vg(lt.reverse(),"beforeRouteLeave",Ce,je);for(const At of lt)At.leaveGuards.forEach(ln=>{Xe.push(oa(ln,Ce,je))});const Dt=Le.bind(null,Ce,je);return Xe.push(Dt),Gn(Xe).then(()=>{Xe=[];for(const At of a.list())Xe.push(oa(At,Ce,je));return Xe.push(Dt),Gn(Xe)}).then(()=>{Xe=vg(Bt,"beforeRouteUpdate",Ce,je);for(const At of Bt)At.updateGuards.forEach(ln=>{Xe.push(oa(ln,Ce,je))});return Xe.push(Dt),Gn(Xe)}).then(()=>{Xe=[];for(const At of rn)if(At.beforeEnter)if(Hr(At.beforeEnter))for(const ln of At.beforeEnter)Xe.push(oa(ln,Ce,je));else Xe.push(oa(At.beforeEnter,Ce,je));return Xe.push(Dt),Gn(Xe)}).then(()=>(Ce.matched.forEach(At=>At.enterCallbacks={}),Xe=vg(rn,"beforeRouteEnter",Ce,je,Ie),Xe.push(Dt),Gn(Xe))).then(()=>{Xe=[];for(const At of u.list())Xe.push(oa(At,Ce,je));return Xe.push(Dt),Gn(Xe)}).catch(At=>xo(At,8)?At:Promise.reject(At))}function it(Ce,je,Xe){l.list().forEach(lt=>Ie(()=>lt(Ce,je,Xe)))}function Nt(Ce,je,Xe,lt,Bt){const rn=oe(Ce,je);if(rn)return rn;const Dt=je===sa,At=bo?history.state:{};Xe&&(lt||Dt?r.replace(Ce.fullPath,wn({scroll:Dt&&At&&At.scroll},Bt)):r.push(Ce.fullPath,Bt)),g.value=Ce,In(Ce,je,Xe,Dt),hn()}let ht;function Rt(){ht||(ht=r.listen((Ce,je,Xe)=>{if(!jn.listening)return;const lt=Z(Ce),Bt=ke(lt);if(Bt){Me(wn(Bt,{replace:!0}),lt).catch(Ju);return}_=lt;const rn=g.value;bo&&nM(ax(rn.fullPath,Xe.delta),hp()),Ye(lt,rn).catch(Dt=>xo(Dt,12)?Dt:xo(Dt,2)?(Me(Dt.to,lt).then(At=>{xo(At,20)&&!Xe.delta&&Xe.type===Qu.pop&&r.go(-1,!1)}).catch(Ju),Promise.reject()):(Xe.delta&&r.go(-Xe.delta,!1),Mt(Dt,lt,rn))).then(Dt=>{Dt=Dt||Nt(lt,rn,!1),Dt&&(Xe.delta&&!xo(Dt,8)?r.go(-Xe.delta,!1):Xe.type===Qu.pop&&xo(Dt,20)&&r.go(-1,!1)),it(lt,rn,Dt)}).catch(Ju)}))}let Xt=th(),nn=th(),jt;function Mt(Ce,je,Xe){hn(Ce);const lt=nn.list();return lt.length?lt.forEach(Bt=>Bt(Ce,je,Xe)):(process.env.NODE_ENV!=="production"&&en("uncaught error during route navigation:"),console.error(Ce)),Promise.reject(Ce)}function Sn(){return jt&&g.value!==sa?Promise.resolve():new Promise((Ce,je)=>{Xt.add([Ce,je])})}function hn(Ce){return jt||(jt=!Ce,Rt(),Xt.list().forEach(([je,Xe])=>Ce?Xe(Ce):je()),Xt.reset()),Ce}function In(Ce,je,Xe,lt){const{scrollBehavior:Bt}=t;if(!bo||!Bt)return Promise.resolve();const rn=!Xe&&iM(ax(Ce.fullPath,0))||(lt||!Xe)&&history.state&&history.state.scroll||null;return S.nextTick().then(()=>Bt(Ce,je,rn)).then(Dt=>Dt&&tM(Dt)).catch(Dt=>Mt(Dt,Ce,je))}const bn=Ce=>r.go(Ce);let pi;const Wn=new Set,jn={currentRoute:g,listening:!0,addRoute:I,removeRoute:z,clearRoutes:e.clearRoutes,hasRoute:H,getRoutes:V,resolve:Z,options:t,push:J,replace:Ae,go:bn,back:()=>bn(-1),forward:()=>bn(1),beforeEach:a.add,beforeResolve:u.add,afterEach:l.add,onError:nn.add,isReady:Sn,install(Ce){const je=this;Ce.component("RouterLink",DM),Ce.component("RouterView",LM),Ce.config.globalProperties.$router=je,Object.defineProperty(Ce.config.globalProperties,"$route",{enumerable:!0,get:()=>S.unref(g)}),bo&&!pi&&g.value===sa&&(pi=!0,J(r.location).catch(Bt=>{process.env.NODE_ENV!=="production"&&en("Unexpected error when starting the router:",Bt)}));const Xe={};for(const Bt in sa)Object.defineProperty(Xe,Bt,{get:()=>g.value[Bt],enumerable:!0});Ce.provide(bg,je),Ce.provide(vx,S.shallowReactive(Xe)),Ce.provide(xg,g);const lt=Ce.unmount;Wn.add(Ce),Ce.unmount=function(){Wn.delete(Ce),Wn.size<1&&(_=sa,ht&&ht(),ht=null,g.value=sa,pi=!1,jt=!1),lt()},process.env.NODE_ENV!=="production"&&bo&&FM(Ce,je,e)}};function Gn(Ce){return Ce.reduce((je,Xe)=>je.then(()=>Ie(Xe)),Promise.resolve())}return jn}function XM(t,e){const n=[],i=[],r=[],a=Math.max(e.matched.length,t.matched.length);for(let u=0;u<a;u++){const l=e.matched[u];l&&(t.matched.find(_=>ra(_,l))?i.push(l):n.push(l));const g=t.matched[u];g&&(e.matched.find(_=>ra(_,g))||r.push(g))}return[n,i,r]}const KM=[{name:"edit",path:"/edit",component:()=>Promise.resolve().then(()=>d$)},{name:"add",path:"/add",component:()=>Promise.resolve().then(()=>x$)},{name:"card-view",path:"/card",component:()=>Promise.resolve().then(()=>hS),children:[{name:"table",path:":table",component:()=>Promise.resolve().then(()=>hS),children:[{name:"card",path:":id",component:()=>Promise.resolve().then(()=>H$)}]}]}],JM={},QM={class:"bg-gray-200 w-full px-16 md:px-0 h-screen flex items-center justify-center"},eA={class:"bg-white border border-gray-200 flex flex-col items-center justify-center px-4 md:px-8 lg:px-24 py-8 rounded-lg shadow-2xl"};function tA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",QM,[S.createElementVNode("div",eA,[e[2]||(e[2]=S.createElementVNode("p",{class:"text-6xl md:text-7xl lg:text-9xl font-bold tracking-wider text-gray-300"}," 404 ",-1)),e[3]||(e[3]=S.createElementVNode("p",{class:"text-2xl md:text-3xl lg:text-5xl font-bold tracking-wider text-gray-500 mt-4"}," Сторінку не знайдено ",-1)),e[4]||(e[4]=S.createElementVNode("p",{class:"text-gray-500 mt-4 pb-4 border-b-2 text-center"}," Вибачте, така сторінка не існує ",-1)),S.createElementVNode("div",{onClick:e[0]||(e[0]=u=>t.$router.push("/")),class:"flex cursor-pointer items-center space-x-2 bg-blue-600 hover:bg-blue-700 text-gray-100 px-4 py-2 mt-6 rounded transition duration-150",title:"Return Home"},e[1]||(e[1]=[S.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor"},[S.createElementVNode("path",{"fill-rule":"evenodd",d:"M9.707 14.707a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 1.414L7.414 9H15a1 1 0 110 2H7.414l2.293 2.293a1 1 0 010 1.414z","clip-rule":"evenodd"})],-1),S.createElementVNode("span",null,"Повернутись на головну",-1)]))])])}const nA=_t(JM,[["render",tA]]),iA=t=>{const e=KM.map(i=>({...i}));return{router:YM({history:aM(),routes:[{path:"/404",name:"404",component:nA},{path:"/",name:"global",component:()=>Promise.resolve().then(()=>N8),children:[...e,...t,{path:"/:catchAll(.*)",component:()=>Promise.resolve().then(()=>v7)}]}]}),routerData:e}},rA={props:{value:{type:[String,Number,Array,Boolean],default:()=>""},data:{type:Object},table:{type:String},name:String,inline:{type:Boolean,default:()=>!1}},methods:{async changeData(t){var e;try{await wt.put(`/api/table/${this.table}/${(e=this.data)==null?void 0:e.id}`,{...this.data,[this.name]:t}),await this.$emit("update-table")}catch(n){console.log(n)}}}},sA={class:"text-start"},oA={key:1,class:"text-start"};function aA(t,e,n,i,r,a){const u=S.resolveComponent("VsInlineEdit");return n.inline?(S.openBlock(),S.createBlock(u,{key:0,"model-value":n.value,onUpdateValue:a.changeData},{default:S.withCtx(()=>[S.createElementVNode("button",sA,S.toDisplayString(n.value),1)]),_:1},8,["model-value","onUpdateValue"])):(S.openBlock(),S.createElementBlock("div",oA,S.toDisplayString(n.value),1))}const Ox=_t(rA,[["render",aA]]),lA={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var t;return(t=this.data)==null?void 0:t[this.name+"_data"]}},methods:{getBGColor(t){if(t!=null&&t.includes("#")){let e;if(/^#([A-Fa-f0-9]{3}){1,2}$/.test(t))return e=t.substring(1).split(""),e.length==3&&(e=[e[0],e[0],e[1],e[1],e[2],e[2]]),e="0x"+e.join(""),"rgba("+[e>>16&255,e>>8&255,e&255].join(",")+",0.2)";throw new Error("Bad Hex")}else if(typeof t=="string"){const e=document.createElement("div");e.style.color=t,document.body.appendChild(e);const n=getComputedStyle(e).color;return document.body.removeChild(e),n.replace("rgb","rgba").replace(")",", 0.2)")}else throw new Error("Invalid color format")}}},cA={class:"w-full flex justify-start"},uA={key:1};function hA(t,e,n,i,r,a){var u,l,g;return S.openBlock(),S.createElementBlock("div",cA,[a.getData?(S.openBlock(),S.createElementBlock("div",{key:0,class:"p-2 ps-1.5 px-2 inline-flex items-center gap-x-1.5 text-xs font-medium text-black rounded-full",style:S.normalizeStyle({backgroundColor:a.getBGColor((u=a.getData)==null?void 0:u.color),color:(l=a.getData)==null?void 0:l.color})},S.toDisplayString((g=a.getData)==null?void 0:g.text),5)):(S.openBlock(),S.createElementBlock("div",uA,"-"))])}const dA=_t(lA,[["render",hA]]),pA={},fA={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function mA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",fA,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const gA={components:{IconCheck:_t(pA,[["render",mA]])},props:{value:Boolean}},yA={class:"px-[20px]"},_A={key:1};function bA(t,e,n,i,r,a){const u=S.resolveComponent("IconCheck");return S.openBlock(),S.createElementBlock("div",yA,[n.value?(S.openBlock(),S.createBlock(u,{key:0,height:"24",width:"24",class:"text-blue-500"})):(S.openBlock(),S.createElementBlock("div",_A))])}const zx=_t(gA,[["render",bA]]),xA={props:{data:Object,name:String},computed:{getData(){var t,e,n;return((e=(t=this.data)==null?void 0:t[this.name+"_data"])==null?void 0:e.text)||((n=this.data)==null?void 0:n[this.name+"_text"])}}},vA={class:""},wA={key:0},kA={key:1},SA={key:1};function EA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",vA,[a.getData?(S.openBlock(),S.createElementBlock("div",wA,[typeof a.getData=="object"?(S.openBlock(!0),S.createElementBlock(S.Fragment,{key:0},S.renderList(a.getData,(u,l)=>(S.openBlock(),S.createElementBlock("div",{key:l},S.toDisplayString(u),1))),128)):(S.openBlock(),S.createElementBlock("div",kA,S.toDisplayString(a.getData),1))])):(S.openBlock(),S.createElementBlock("div",SA,"-"))])}const CA=_t(xA,[["render",EA]]),TA={props:{value:{type:[String,Number],default:()=>""},data:Object,name:String},computed:{getData(){var t,e;return((t=this.data)==null?void 0:t[this.name])||((e=this.data)==null?void 0:e[this.name+"_data"])}},methods:{}},MA={class:"w-full flex justify-start"},AA={key:0,class:"js-clipboard [--is-toggle-tooltip:false] hs-tooltip p-2 bg-stone-100 text-stone-800 text-xs rounded-md cursor-pointer"},PA={key:1};function IA(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",MA,[a.getData?(S.openBlock(),S.createElementBlock("div",AA,S.toDisplayString(a.getData),1)):(S.openBlock(),S.createElementBlock("div",PA,"-"))])}const DA=_t(TA,[["render",IA]]);//! moment.js
37
37
  //! version : 2.30.1
38
38
  //! authors : Tim Wood, Iskren Chernev, Moment.js contributors
39
39
  //! license : MIT
@@ -46,7 +46,7 @@ at.version="2.30.1",OA(qn),at.fn=$e,at.min=vI,at.max=wI,at.now=kI,at.utc=Ys,at.u
46
46
  * MapLibre GL JS
47
47
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v4.7.0/LICENSE.txt
48
48
  */(function(t,e){(function(n,i){t.exports=i()})(jO,function(){var n={},i={};function r(u,l,g){if(i[u]=g,u==="index"){var _="var sharedModule = {}; ("+i.shared+")(sharedModule); ("+i.worker+")(sharedModule);",k={};return i.shared(k),i.index(n,k),typeof window<"u"&&n.setWorkerUrl(window.URL.createObjectURL(new Blob([_],{type:"text/javascript"}))),n}}r("shared",["exports"],function(u){function l(c,o,h,p){return new(h||(h=Promise))(function(y,v){function w(O){try{A(p.next(O))}catch(R){v(R)}}function C(O){try{A(p.throw(O))}catch(R){v(R)}}function A(O){var R;O.done?y(O.value):(R=O.value,R instanceof h?R:new h(function(N){N(R)})).then(w,C)}A((p=p.apply(c,o||[])).next())})}function g(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}typeof SuppressedError=="function"&&SuppressedError;var _=k;function k(c,o){this.x=c,this.y=o}k.prototype={clone:function(){return new k(this.x,this.y)},add:function(c){return this.clone()._add(c)},sub:function(c){return this.clone()._sub(c)},multByPoint:function(c){return this.clone()._multByPoint(c)},divByPoint:function(c){return this.clone()._divByPoint(c)},mult:function(c){return this.clone()._mult(c)},div:function(c){return this.clone()._div(c)},rotate:function(c){return this.clone()._rotate(c)},rotateAround:function(c,o){return this.clone()._rotateAround(c,o)},matMult:function(c){return this.clone()._matMult(c)},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(c){return this.x===c.x&&this.y===c.y},dist:function(c){return Math.sqrt(this.distSqr(c))},distSqr:function(c){var o=c.x-this.x,h=c.y-this.y;return o*o+h*h},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(c){return Math.atan2(this.y-c.y,this.x-c.x)},angleWith:function(c){return this.angleWithSep(c.x,c.y)},angleWithSep:function(c,o){return Math.atan2(this.x*o-this.y*c,this.x*c+this.y*o)},_matMult:function(c){var o=c[2]*this.x+c[3]*this.y;return this.x=c[0]*this.x+c[1]*this.y,this.y=o,this},_add:function(c){return this.x+=c.x,this.y+=c.y,this},_sub:function(c){return this.x-=c.x,this.y-=c.y,this},_mult:function(c){return this.x*=c,this.y*=c,this},_div:function(c){return this.x/=c,this.y/=c,this},_multByPoint:function(c){return this.x*=c.x,this.y*=c.y,this},_divByPoint:function(c){return this.x/=c.x,this.y/=c.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var c=this.y;return this.y=this.x,this.x=-c,this},_rotate:function(c){var o=Math.cos(c),h=Math.sin(c),p=h*this.x+o*this.y;return this.x=o*this.x-h*this.y,this.y=p,this},_rotateAround:function(c,o){var h=Math.cos(c),p=Math.sin(c),y=o.y+p*(this.x-o.x)+h*(this.y-o.y);return this.x=o.x+h*(this.x-o.x)-p*(this.y-o.y),this.y=y,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},k.convert=function(c){return c instanceof k?c:Array.isArray(c)?new k(c[0],c[1]):c};var E=g(_),T=I;function I(c,o,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=o,this.p2x=h,this.p2y=p}I.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,o){if(o===void 0&&(o=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var y=this.sampleCurveX(h)-c;if(Math.abs(y)<o)return h;var v=this.sampleCurveDerivativeX(h);if(Math.abs(v)<1e-6)break;h-=y/v}var w=0,C=1;for(h=c,p=0;p<20&&(y=this.sampleCurveX(h),!(Math.abs(y-c)<o));p++)c>y?w=h:C=h,h=.5*(C-w)+w;return h},solve:function(c,o){return this.sampleCurveY(this.solveCurveX(c,o))}};var z=g(T);let V,H;function Z(){return V==null&&(V=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),V}function ee(){if(H==null&&(H=!1,Z())){const o=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(o){for(let p=0;p<5*5;p++){const y=4*p;o.fillStyle=`rgb(${y},${y+1},${y+2})`,o.fillRect(p%5,Math.floor(p/5),1,1)}const h=o.getImageData(0,0,5,5).data;for(let p=0;p<5*5*4;p++)if(p%4!=3&&h[p]!==p){H=!0;break}}}return H||!1}function oe(c,o,h,p){const y=new z(c,o,h,p);return v=>y.solve(v)}const J=oe(.25,.1,.25,1);function Ae(c,o,h){return Math.min(h,Math.max(o,c))}function ke(c,o,h){const p=h-o,y=((c-o)%p+p)%p+o;return y===o?h:y}function Me(c,...o){for(const h of o)for(const p in h)c[p]=h[p];return c}let Le=1;function Ie(c,o,h){const p={};for(const y in c)p[y]=o.call(this,c[y],y,c);return p}function Ye(c,o,h){const p={};for(const y in c)o.call(this,c[y],y,c)&&(p[y]=c[y]);return p}function it(c){return Array.isArray(c)?c.map(it):typeof c=="object"&&c?Ie(c,it):c}const Nt={};function ht(c){Nt[c]||(typeof console<"u"&&console.warn(c),Nt[c]=!0)}function Rt(c,o,h){return(h.y-c.y)*(o.x-c.x)>(o.y-c.y)*(h.x-c.x)}function Xt(c){return typeof WorkerGlobalScope<"u"&&c!==void 0&&c instanceof WorkerGlobalScope}let nn=null;function jt(c){return typeof ImageBitmap<"u"&&c instanceof ImageBitmap}const Mt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Sn(c,o,h,p,y){return l(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const v=new VideoFrame(c,{timestamp:0});try{const w=v==null?void 0:v.format;if(!w||!w.startsWith("BGR")&&!w.startsWith("RGB"))throw new Error(`Unrecognized format ${w}`);const C=w.startsWith("BGR"),A=new Uint8ClampedArray(p*y*4);if(yield v.copyTo(A,function(O,R,N,$,q){const G=4*Math.max(-R,0),X=(Math.max(0,N)-N)*$*4+G,ie=4*$,ae=Math.max(0,R),be=Math.max(0,N);return{rect:{x:ae,y:be,width:Math.min(O.width,R+$)-ae,height:Math.min(O.height,N+q)-be},layout:[{offset:X,stride:ie}]}}(c,o,h,p,y)),C)for(let O=0;O<A.length;O+=4){const R=A[O];A[O]=A[O+2],A[O+2]=R}return A}finally{v.close()}})}let hn,In;const bn="AbortError";function pi(){return new Error(bn)}const Wn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function jn(c){return Wn.REGISTERED_PROTOCOLS[c.substring(0,c.indexOf("://"))]}const Gn="global-dispatcher";class Ce extends Error{constructor(o,h,p,y){super(`AJAXError: ${h} (${o}): ${p}`),this.status=o,this.statusText=h,this.url=p,this.body=y}}const je=()=>Xt(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Xe=function(c,o){if(/:\/\//.test(c.url)&&!/^https?:|^file:/.test(c.url)){const p=jn(c.url);if(p)return p(c,o);if(Xt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,targetMapId:Gn},o)}if(!(/^file:/.test(h=c.url)||/^file:/.test(je())&&!/^\w+:/.test(h))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(p,y){return l(this,void 0,void 0,function*(){const v=new Request(p.url,{method:p.method||"GET",body:p.body,credentials:p.credentials,headers:p.headers,cache:p.cache,referrer:je(),signal:y.signal});p.type!=="json"||v.headers.has("Accept")||v.headers.set("Accept","application/json");const w=yield fetch(v);if(!w.ok){const O=yield w.blob();throw new Ce(w.status,w.statusText,p.url,O)}let C;C=p.type==="arrayBuffer"||p.type==="image"?w.arrayBuffer():p.type==="json"?w.json():w.text();const A=yield C;if(y.signal.aborted)throw pi();return{data:A,cacheControl:w.headers.get("Cache-Control"),expires:w.headers.get("Expires")}})}(c,o);if(Xt(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:c,mustQueue:!0,targetMapId:Gn},o)}var h;return function(p,y){return new Promise((v,w)=>{var C;const A=new XMLHttpRequest;A.open(p.method||"GET",p.url,!0),p.type!=="arrayBuffer"&&p.type!=="image"||(A.responseType="arraybuffer");for(const O in p.headers)A.setRequestHeader(O,p.headers[O]);p.type==="json"&&(A.responseType="text",!((C=p.headers)===null||C===void 0)&&C.Accept||A.setRequestHeader("Accept","application/json")),A.withCredentials=p.credentials==="include",A.onerror=()=>{w(new Error(A.statusText))},A.onload=()=>{if(!y.signal.aborted)if((A.status>=200&&A.status<300||A.status===0)&&A.response!==null){let O=A.response;if(p.type==="json")try{O=JSON.parse(A.response)}catch(R){return void w(R)}v({data:O,cacheControl:A.getResponseHeader("Cache-Control"),expires:A.getResponseHeader("Expires")})}else{const O=new Blob([A.response],{type:A.getResponseHeader("Content-Type")});w(new Ce(A.status,A.statusText,p.url,O))}},y.signal.addEventListener("abort",()=>{A.abort(),w(pi())}),A.send(p.body)})}(c,o)};function lt(c){if(!c||c.indexOf("://")<=0||c.indexOf("data:image/")===0||c.indexOf("blob:")===0)return!0;const o=new URL(c),h=window.location;return o.protocol===h.protocol&&o.host===h.host}function Bt(c,o,h){h[c]&&h[c].indexOf(o)!==-1||(h[c]=h[c]||[],h[c].push(o))}function rn(c,o,h){if(h&&h[c]){const p=h[c].indexOf(o);p!==-1&&h[c].splice(p,1)}}class Dt{constructor(o,h={}){Me(this,h),this.type=o}}class At extends Dt{constructor(o,h={}){super("error",Me({error:o},h))}}class ln{on(o,h){return this._listeners=this._listeners||{},Bt(o,h,this._listeners),this}off(o,h){return rn(o,h,this._listeners),rn(o,h,this._oneTimeListeners),this}once(o,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},Bt(o,h,this._oneTimeListeners),this):new Promise(p=>this.once(o,p))}fire(o,h){typeof o=="string"&&(o=new Dt(o,h||{}));const p=o.type;if(this.listens(p)){o.target=this;const y=this._listeners&&this._listeners[p]?this._listeners[p].slice():[];for(const C of y)C.call(this,o);const v=this._oneTimeListeners&&this._oneTimeListeners[p]?this._oneTimeListeners[p].slice():[];for(const C of v)rn(p,C,this._oneTimeListeners),C.call(this,o);const w=this._eventedParent;w&&(Me(o,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),w.fire(o))}else o instanceof At&&console.error(o.error);return this}listens(o){return this._listeners&&this._listeners[o]&&this._listeners[o].length>0||this._oneTimeListeners&&this._oneTimeListeners[o]&&this._oneTimeListeners[o].length>0||this._eventedParent&&this._eventedParent.listens(o)}setEventedParent(o,h){return this._eventedParent=o,this._eventedParentData=h,this}}var we={$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"},sky:{type:"sky"},projection:{type:"projection"},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":{}}},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}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"enum",default:"mercator",values:{mercator:{},globe:{}}}},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 En=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function Ss(c,o){const h={};for(const p in c)p!=="ref"&&(h[p]=c[p]);return En.forEach(p=>{p in o&&(h[p]=o[p])}),h}function Kt(c,o){if(Array.isArray(c)){if(!Array.isArray(o)||c.length!==o.length)return!1;for(let h=0;h<c.length;h++)if(!Kt(c[h],o[h]))return!1;return!0}if(typeof c=="object"&&c!==null&&o!==null){if(typeof o!="object"||Object.keys(c).length!==Object.keys(o).length)return!1;for(const h in c)if(!Kt(c[h],o[h]))return!1;return!0}return c===o}function dn(c,o){c.push(o)}function er(c,o,h){dn(h,{command:"addSource",args:[c,o[c]]})}function tr(c,o,h){dn(o,{command:"removeSource",args:[c]}),h[c]=!0}function bi(c,o,h,p){tr(c,h,p),er(c,o,h)}function Dr(c,o,h){let p;for(p in c[h])if(Object.prototype.hasOwnProperty.call(c[h],p)&&p!=="data"&&!Kt(c[h][p],o[h][p]))return!1;for(p in o[h])if(Object.prototype.hasOwnProperty.call(o[h],p)&&p!=="data"&&!Kt(c[h][p],o[h][p]))return!1;return!0}function xi(c,o,h,p,y,v){c=c||{},o=o||{};for(const w in c)Object.prototype.hasOwnProperty.call(c,w)&&(Kt(c[w],o[w])||h.push({command:v,args:[p,w,o[w],y]}));for(const w in o)Object.prototype.hasOwnProperty.call(o,w)&&!Object.prototype.hasOwnProperty.call(c,w)&&(Kt(c[w],o[w])||h.push({command:v,args:[p,w,o[w],y]}))}function Es(c){return c.id}function Cs(c,o){return c[o.id]=o,c}class Be{constructor(o,h,p,y){this.message=(o?`${o}: `:"")+p,y&&(this.identifier=y),h!=null&&h.__line__&&(this.line=h.__line__)}}function Or(c,...o){for(const h of o)for(const p in h)c[p]=h[p];return c}class vi extends Error{constructor(o,h){super(h),this.message=h,this.key=o}}class zr{constructor(o,h=[]){this.parent=o,this.bindings={};for(const[p,y]of h)this.bindings[p]=y}concat(o){return new zr(this,o)}get(o){if(this.bindings[o])return this.bindings[o];if(this.parent)return this.parent.get(o);throw new Error(`${o} not found in scope.`)}has(o){return!!this.bindings[o]||!!this.parent&&this.parent.has(o)}}const Ts={kind:"null"},qe={kind:"number"},ve={kind:"string"},Re={kind:"boolean"},xt={kind:"color"},Ut={kind:"object"},Je={kind:"value"},Rn={kind:"collator"},Kn={kind:"formatted"},Ui={kind:"padding"},pr={kind:"resolvedImage"},se={kind:"variableAnchorOffsetCollection"};function U(c,o){return{kind:"array",itemType:c,N:o}}function j(c){if(c.kind==="array"){const o=j(c.itemType);return typeof c.N=="number"?`array<${o}, ${c.N}>`:c.itemType.kind==="value"?"array":`array<${o}>`}return c.kind}const Y=[Ts,qe,ve,Re,xt,Kn,Ut,U(Je),Ui,pr,se];function ne(c,o){if(o.kind==="error")return null;if(c.kind==="array"){if(o.kind==="array"&&(o.N===0&&o.itemType.kind==="value"||!ne(c.itemType,o.itemType))&&(typeof c.N!="number"||c.N===o.N))return null}else{if(c.kind===o.kind)return null;if(c.kind==="value"){for(const h of Y)if(!ne(h,o))return null}}return`Expected ${j(c)} but found ${j(o)} instead.`}function de(c,o){return o.some(h=>h.kind===c.kind)}function fe(c,o){return o.some(h=>h==="null"?c===null:h==="array"?Array.isArray(c):h==="object"?c&&!Array.isArray(c)&&typeof c=="object":h===typeof c)}function _e(c,o){return c.kind==="array"&&o.kind==="array"?c.itemType.kind===o.itemType.kind&&typeof c.N=="number":c.kind===o.kind}const ue=.96422,Te=.82521,ze=4/29,Se=6/29,Ue=3*Se*Se,bt=Se*Se*Se,kt=Math.PI/180,sn=180/Math.PI;function Lt(c){return(c%=360)<0&&(c+=360),c}function on([c,o,h,p]){let y,v;const w=ri((.2225045*(c=Zt(c))+.7168786*(o=Zt(o))+.0606169*(h=Zt(h)))/1);c===o&&o===h?y=v=w:(y=ri((.4360747*c+.3850649*o+.1430804*h)/ue),v=ri((.0139322*c+.0971045*o+.7141733*h)/Te));const C=116*w-16;return[C<0?0:C,500*(y-w),200*(w-v),p]}function Zt(c){return c<=.04045?c/12.92:Math.pow((c+.055)/1.055,2.4)}function ri(c){return c>bt?Math.pow(c,1/3):c/Ue+ze}function Zn([c,o,h,p]){let y=(c+16)/116,v=isNaN(o)?y:y+o/500,w=isNaN(h)?y:y-h/200;return y=1*xn(y),v=ue*xn(v),w=Te*xn(w),[$t(3.1338561*v-1.6168667*y-.4906146*w),$t(-.9787684*v+1.9161415*y+.033454*w),$t(.0719453*v-.2289914*y+1.4052427*w),p]}function $t(c){return(c=c<=.00304?12.92*c:1.055*Math.pow(c,1/2.4)-.055)<0?0:c>1?1:c}function xn(c){return c>Se?c*c*c:Ue*(c-ze)}function Un(c){return parseInt(c.padEnd(2,c),16)/255}function fi(c,o){return wi(o?c/100:c,0,1)}function wi(c,o,h){return Math.min(Math.max(o,c),h)}function Hi(c){return!c.some(Number.isNaN)}const Ma={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 vn{constructor(o,h,p,y=1,v=!0){this.r=o,this.g=h,this.b=p,this.a=y,v||(this.r*=y,this.g*=y,this.b*=y,y||this.overwriteGetter("rgb",[o,h,p,y]))}static parse(o){if(o instanceof vn)return o;if(typeof o!="string")return;const h=function(p){if((p=p.toLowerCase().trim())==="transparent")return[0,0,0,0];const y=Ma[p];if(y){const[w,C,A]=y;return[w/255,C/255,A/255,1]}if(p.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(p)){const w=p.length<6?1:2;let C=1;return[Un(p.slice(C,C+=w)),Un(p.slice(C,C+=w)),Un(p.slice(C,C+=w)),Un(p.slice(C,C+w)||"ff")]}if(p.startsWith("rgb")){const w=p.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(w){const[C,A,O,R,N,$,q,G,X,ie,ae,be]=w,pe=[R||" ",q||" ",ie].join("");if(pe===" "||pe===" /"||pe===",,"||pe===",,,"){const ye=[O,$,X].join(""),Ee=ye==="%%%"?100:ye===""?255:0;if(Ee){const Ne=[wi(+A/Ee,0,1),wi(+N/Ee,0,1),wi(+G/Ee,0,1),ae?fi(+ae,be):1];if(Hi(Ne))return Ne}}return}}const v=p.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(v){const[w,C,A,O,R,N,$,q,G]=v,X=[A||" ",R||" ",$].join("");if(X===" "||X===" /"||X===",,"||X===",,,"){const ie=[+C,wi(+O,0,100),wi(+N,0,100),q?fi(+q,G):1];if(Hi(ie))return function([ae,be,pe,ye]){function Ee(Ne){const tt=(Ne+ae/30)%12,St=be*Math.min(pe,1-pe);return pe-St*Math.max(-1,Math.min(tt-3,9-tt,1))}return ae=Lt(ae),be/=100,pe/=100,[Ee(0),Ee(8),Ee(4),ye]}(ie)}}}(o);return h?new vn(...h,!1):void 0}get rgb(){const{r:o,g:h,b:p,a:y}=this,v=y||1/0;return this.overwriteGetter("rgb",[o/v,h/v,p/v,y])}get hcl(){return this.overwriteGetter("hcl",function(o){const[h,p,y,v]=on(o),w=Math.sqrt(p*p+y*y);return[Math.round(1e4*w)?Lt(Math.atan2(y,p)*sn):NaN,w,h,v]}(this.rgb))}get lab(){return this.overwriteGetter("lab",on(this.rgb))}overwriteGetter(o,h){return Object.defineProperty(this,o,{value:h}),h}toString(){const[o,h,p,y]=this.rgb;return`rgba(${[o,h,p].map(v=>Math.round(255*v)).join(",")},${y})`}}vn.black=new vn(0,0,0,1),vn.white=new vn(1,1,1,1),vn.transparent=new vn(0,0,0,0),vn.red=new vn(1,0,0,1);class Zh{constructor(o,h,p){this.sensitivity=o?h?"variant":"case":h?"accent":"base",this.locale=p,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(o,h){return this.collator.compare(o,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Yh{constructor(o,h,p,y,v){this.text=o,this.image=h,this.scale=p,this.fontStack=y,this.textColor=v}}class fr{constructor(o){this.sections=o}static fromString(o){return new fr([new Yh(o,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(o=>o.text.length!==0||o.image&&o.image.name.length!==0)}static factory(o){return o instanceof fr?o:fr.fromString(o)}toString(){return this.sections.length===0?"":this.sections.map(o=>o.text).join("")}}class mr{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof mr)return o;if(typeof o=="number")return new mr([o,o,o,o]);if(Array.isArray(o)&&!(o.length<1||o.length>4)){for(const h of o)if(typeof h!="number")return;switch(o.length){case 1:o=[o[0],o[0],o[0],o[0]];break;case 2:o=[o[0],o[1],o[0],o[1]];break;case 3:o=[o[0],o[1],o[2],o[1]]}return new mr(o)}}toString(){return JSON.stringify(this.values)}}const Z0=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Rr{constructor(o){this.values=o.slice()}static parse(o){if(o instanceof Rr)return o;if(Array.isArray(o)&&!(o.length<1)&&o.length%2==0){for(let h=0;h<o.length;h+=2){const p=o[h],y=o[h+1];if(typeof p!="string"||!Z0.has(p)||!Array.isArray(y)||y.length!==2||typeof y[0]!="number"||typeof y[1]!="number")return}return new Rr(o)}}toString(){return JSON.stringify(this.values)}}class gr{constructor(o){this.name=o.name,this.available=o.available}toString(){return this.name}static fromString(o){return o?new gr({name:o,available:!1}):null}}function Aa(c,o,h,p){return typeof c=="number"&&c>=0&&c<=255&&typeof o=="number"&&o>=0&&o<=255&&typeof h=="number"&&h>=0&&h<=255?p===void 0||typeof p=="number"&&p>=0&&p<=1?null:`Invalid rgba value [${[c,o,h,p].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof p=="number"?[c,o,h,p]:[c,o,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Vo(c){if(c===null||typeof c=="string"||typeof c=="boolean"||typeof c=="number"||c instanceof vn||c instanceof Zh||c instanceof fr||c instanceof mr||c instanceof Rr||c instanceof gr)return!0;if(Array.isArray(c)){for(const o of c)if(!Vo(o))return!1;return!0}if(typeof c=="object"){for(const o in c)if(!Vo(c[o]))return!1;return!0}return!1}function si(c){if(c===null)return Ts;if(typeof c=="string")return ve;if(typeof c=="boolean")return Re;if(typeof c=="number")return qe;if(c instanceof vn)return xt;if(c instanceof Zh)return Rn;if(c instanceof fr)return Kn;if(c instanceof mr)return Ui;if(c instanceof Rr)return se;if(c instanceof gr)return pr;if(Array.isArray(c)){const o=c.length;let h;for(const p of c){const y=si(p);if(h){if(h===y)continue;h=Je;break}h=y}return U(h||Je,o)}return Ut}function Nl(c){const o=typeof c;return c===null?"":o==="string"||o==="number"||o==="boolean"?String(c):c instanceof vn||c instanceof fr||c instanceof mr||c instanceof Rr||c instanceof gr?c.toString():JSON.stringify(c)}class Kr{constructor(o,h){this.type=o,this.value=h}static parse(o,h){if(o.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${o.length-1} instead.`);if(!Vo(o[1]))return h.error("invalid value");const p=o[1];let y=si(p);const v=h.expectedType;return y.kind!=="array"||y.N!==0||!v||v.kind!=="array"||typeof v.N=="number"&&v.N!==0||(y=v),new Kr(y,p)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}class ti{constructor(o){this.name="ExpressionEvaluationError",this.message=o}toJSON(){return this.message}}const eu={string:ve,number:qe,boolean:Re,object:Ut};class Jr{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");let p,y=1;const v=o[0];if(v==="array"){let C,A;if(o.length>2){const O=o[1];if(typeof O!="string"||!(O in eu)||O==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);C=eu[O],y++}else C=Je;if(o.length>3){if(o[2]!==null&&(typeof o[2]!="number"||o[2]<0||o[2]!==Math.floor(o[2])))return h.error('The length argument to "array" must be a positive integer literal',2);A=o[2],y++}p=U(C,A)}else{if(!eu[v])throw new Error(`Types doesn't contain name = ${v}`);p=eu[v]}const w=[];for(;y<o.length;y++){const C=h.parse(o[y],y,Je);if(!C)return null;w.push(C)}return new Jr(p,w)}evaluate(o){for(let h=0;h<this.args.length;h++){const p=this.args[h].evaluate(o);if(!ne(this.type,si(p)))return p;if(h===this.args.length-1)throw new ti(`Expected value to be of type ${j(this.type)}, but found ${j(si(p))} instead.`)}throw new Error}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Xh={"to-boolean":Re,"to-color":xt,"to-number":qe,"to-string":ve};class Qr{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[0];if(!Xh[p])throw new Error(`Can't parse ${p} as it is not part of the known types`);if((p==="to-boolean"||p==="to-string")&&o.length!==2)return h.error("Expected one argument.");const y=Xh[p],v=[];for(let w=1;w<o.length;w++){const C=h.parse(o[w],w,Je);if(!C)return null;v.push(C)}return new Qr(y,v)}evaluate(o){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(o);case"color":{let h,p;for(const y of this.args){if(h=y.evaluate(o),p=null,h instanceof vn)return h;if(typeof h=="string"){const v=o.parseColor(h);if(v)return v}else if(Array.isArray(h)&&(p=h.length<3||h.length>4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:Aa(h[0],h[1],h[2],h[3]),!p))return new vn(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new ti(p||`Could not parse color from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"padding":{let h;for(const p of this.args){h=p.evaluate(o);const y=mr.parse(h);if(y)return y}throw new ti(`Could not parse padding from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"variableAnchorOffsetCollection":{let h;for(const p of this.args){h=p.evaluate(o);const y=Rr.parse(h);if(y)return y}throw new ti(`Could not parse variableAnchorOffsetCollection from value '${typeof h=="string"?h:JSON.stringify(h)}'`)}case"number":{let h=null;for(const p of this.args){if(h=p.evaluate(o),h===null)return 0;const y=Number(h);if(!isNaN(y))return y}throw new ti(`Could not convert ${JSON.stringify(h)} to number.`)}case"formatted":return fr.fromString(Nl(this.args[0].evaluate(o)));case"resolvedImage":return gr.fromString(Nl(this.args[0].evaluate(o)));default:return Nl(this.args[0].evaluate(o))}}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}const Y0=["Unknown","Point","LineString","Polygon"];class tu{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"?Y0[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(o){let h=this._parseColorCache[o];return h||(h=this._parseColorCache[o]=vn.parse(o)),h}}class $o{constructor(o,h,p=[],y,v=new zr,w=[]){this.registry=o,this.path=p,this.key=p.map(C=>`[${C}]`).join(""),this.scope=v,this.errors=w,this.expectedType=y,this._isConstant=h}parse(o,h,p,y,v={}){return h?this.concat(h,p,y)._parse(o,v):this._parse(o,v)}_parse(o,h){function p(y,v,w){return w==="assert"?new Jr(v,[y]):w==="coerce"?new Qr(v,[y]):y}if(o!==null&&typeof o!="string"&&typeof o!="boolean"&&typeof o!="number"||(o=["literal",o]),Array.isArray(o)){if(o.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const y=o[0];if(typeof y!="string")return this.error(`Expression name must be a string, but found ${typeof y} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const v=this.registry[y];if(v){let w=v.parse(o,this);if(!w)return null;if(this.expectedType){const C=this.expectedType,A=w.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||A.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||A.kind!=="value"&&A.kind!=="string")if(C.kind!=="padding"||A.kind!=="value"&&A.kind!=="number"&&A.kind!=="array")if(C.kind!=="variableAnchorOffsetCollection"||A.kind!=="value"&&A.kind!=="array"){if(this.checkSubtype(C,A))return null}else w=p(w,C,h.typeAnnotation||"coerce");else w=p(w,C,h.typeAnnotation||"coerce");else w=p(w,C,h.typeAnnotation||"coerce");else w=p(w,C,h.typeAnnotation||"assert")}if(!(w instanceof Kr)&&w.type.kind!=="resolvedImage"&&this._isConstant(w)){const C=new tu;try{w=new Kr(w.type,w.evaluate(C))}catch(A){return this.error(A.message),null}}return w}return this.error(`Unknown expression "${y}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(o===void 0?"'undefined' value invalid. Use null instead.":typeof o=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof o} instead.`)}concat(o,h,p){const y=typeof o=="number"?this.path.concat(o):this.path,v=p?this.scope.concat(p):this.scope;return new $o(this.registry,this._isConstant,y,h||null,v,this.errors)}error(o,...h){const p=`${this.key}${h.map(y=>`[${y}]`).join("")}`;this.errors.push(new vi(p,o))}checkSubtype(o,h){const p=ne(o,h);return p&&this.error(p),p}}class uo{constructor(o,h){this.type=h.type,this.bindings=[].concat(o),this.result=h}evaluate(o){return this.result.evaluate(o)}eachChild(o){for(const h of this.bindings)o(h[1]);o(this.result)}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found ${o.length-1} instead.`);const p=[];for(let v=1;v<o.length-1;v+=2){const w=o[v];if(typeof w!="string")return h.error(`Expected string, but found ${typeof w} instead.`,v);if(/[^a-zA-Z0-9_]/.test(w))return h.error("Variable names must contain only alphanumeric characters or '_'.",v);const C=h.parse(o[v+1],v+1);if(!C)return null;p.push([w,C])}const y=h.parse(o[o.length-1],o.length-1,h.expectedType,p);return y?new uo(p,y):null}outputDefined(){return this.result.outputDefined()}}class pn{constructor(o,h){this.type=h.type,this.name=o,this.boundExpression=h}static parse(o,h){if(o.length!==2||typeof o[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const p=o[1];return h.scope.has(p)?new pn(p,h.scope.get(p)):h.error(`Unknown variable "${p}". Make sure "${p}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(o){return this.boundExpression.evaluate(o)}eachChild(){}outputDefined(){return!1}}class Kh{constructor(o,h,p){this.type=o,this.index=h,this.input=p}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,qe),y=h.parse(o[2],2,U(h.expectedType||Je));return p&&y?new Kh(y.type.itemType,p,y):null}evaluate(o){const h=this.index.evaluate(o),p=this.input.evaluate(o);if(h<0)throw new ti(`Array index out of bounds: ${h} < 0.`);if(h>=p.length)throw new ti(`Array index out of bounds: ${h} > ${p.length-1}.`);if(h!==Math.floor(h))throw new ti(`Array index must be an integer, but found ${h} instead.`);return p[h]}eachChild(o){o(this.index),o(this.input)}outputDefined(){return!1}}class Jh{constructor(o,h){this.type=Re,this.needle=o,this.haystack=h}static parse(o,h){if(o.length!==3)return h.error(`Expected 2 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Je),y=h.parse(o[2],2,Je);return p&&y?de(p.type,[Re,ve,qe,Ts,Je])?new Jh(p,y):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${j(p.type)} instead`):null}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!p)return!1;if(!fe(h,["boolean","string","number","null"]))throw new ti(`Expected first argument to be of type boolean, string, number or null, but found ${j(si(h))} instead.`);if(!fe(p,["string","array"]))throw new ti(`Expected second argument to be of type array or string, but found ${j(si(p))} instead.`);return p.indexOf(h)>=0}eachChild(o){o(this.needle),o(this.haystack)}outputDefined(){return!0}}class Pa{constructor(o,h,p){this.type=qe,this.needle=o,this.haystack=h,this.fromIndex=p}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Je),y=h.parse(o[2],2,Je);if(!p||!y)return null;if(!de(p.type,[Re,ve,qe,Ts,Je]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${j(p.type)} instead`);if(o.length===4){const v=h.parse(o[3],3,qe);return v?new Pa(p,y,v):null}return new Pa(p,y)}evaluate(o){const h=this.needle.evaluate(o),p=this.haystack.evaluate(o);if(!fe(h,["boolean","string","number","null"]))throw new ti(`Expected first argument to be of type boolean, string, number or null, but found ${j(si(h))} instead.`);let y;if(this.fromIndex&&(y=this.fromIndex.evaluate(o)),fe(p,["string"])){const v=p.indexOf(h,y);return v===-1?-1:[...p.slice(0,v)].length}if(fe(p,["array"]))return p.indexOf(h,y);throw new ti(`Expected second argument to be of type array or string, but found ${j(si(p))} instead.`)}eachChild(o){o(this.needle),o(this.haystack),this.fromIndex&&o(this.fromIndex)}outputDefined(){return!1}}class Qh{constructor(o,h,p,y,v,w){this.inputType=o,this.type=h,this.input=p,this.cases=y,this.outputs=v,this.otherwise=w}static parse(o,h){if(o.length<5)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if(o.length%2!=1)return h.error("Expected an even number of arguments.");let p,y;h.expectedType&&h.expectedType.kind!=="value"&&(y=h.expectedType);const v={},w=[];for(let O=2;O<o.length-1;O+=2){let R=o[O];const N=o[O+1];Array.isArray(R)||(R=[R]);const $=h.concat(O);if(R.length===0)return $.error("Expected at least one branch label.");for(const G of R){if(typeof G!="number"&&typeof G!="string")return $.error("Branch labels must be numbers or strings.");if(typeof G=="number"&&Math.abs(G)>Number.MAX_SAFE_INTEGER)return $.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof G=="number"&&Math.floor(G)!==G)return $.error("Numeric branch labels must be integer values.");if(p){if($.checkSubtype(p,si(G)))return null}else p=si(G);if(v[String(G)]!==void 0)return $.error("Branch labels must be unique.");v[String(G)]=w.length}const q=h.parse(N,O,y);if(!q)return null;y=y||q.type,w.push(q)}const C=h.parse(o[1],1,Je);if(!C)return null;const A=h.parse(o[o.length-1],o.length-1,y);return A?C.type.kind!=="value"&&h.concat(1).checkSubtype(p,C.type)?null:new Qh(p,y,C,v,w,A):null}evaluate(o){const h=this.input.evaluate(o);return(si(h)===this.inputType&&this.outputs[this.cases[h]]||this.otherwise).evaluate(o)}eachChild(o){o(this.input),this.outputs.forEach(o),o(this.otherwise)}outputDefined(){return this.outputs.every(o=>o.outputDefined())&&this.otherwise.outputDefined()}}class nu{constructor(o,h,p){this.type=o,this.branches=h,this.otherwise=p}static parse(o,h){if(o.length<4)return h.error(`Expected at least 3 arguments, but found only ${o.length-1}.`);if(o.length%2!=0)return h.error("Expected an odd number of arguments.");let p;h.expectedType&&h.expectedType.kind!=="value"&&(p=h.expectedType);const y=[];for(let w=1;w<o.length-1;w+=2){const C=h.parse(o[w],w,Re);if(!C)return null;const A=h.parse(o[w+1],w+1,p);if(!A)return null;y.push([C,A]),p=p||A.type}const v=h.parse(o[o.length-1],o.length-1,p);if(!v)return null;if(!p)throw new Error("Can't infer output type");return new nu(p,y,v)}evaluate(o){for(const[h,p]of this.branches)if(h.evaluate(o))return p.evaluate(o);return this.otherwise.evaluate(o)}eachChild(o){for(const[h,p]of this.branches)o(h),o(p);o(this.otherwise)}outputDefined(){return this.branches.every(([o,h])=>h.outputDefined())&&this.otherwise.outputDefined()}}class Bl{constructor(o,h,p,y){this.type=o,this.input=h,this.beginIndex=p,this.endIndex=y}static parse(o,h){if(o.length<=2||o.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${o.length-1} instead.`);const p=h.parse(o[1],1,Je),y=h.parse(o[2],2,qe);if(!p||!y)return null;if(!de(p.type,[U(Je),ve,Je]))return h.error(`Expected first argument to be of type array or string, but found ${j(p.type)} instead`);if(o.length===4){const v=h.parse(o[3],3,qe);return v?new Bl(p.type,p,y,v):null}return new Bl(p.type,p,y)}evaluate(o){const h=this.input.evaluate(o),p=this.beginIndex.evaluate(o);let y;if(this.endIndex&&(y=this.endIndex.evaluate(o)),fe(h,["string"]))return[...h].slice(p,y).join("");if(fe(h,["array"]))return h.slice(p,y);throw new ti(`Expected first argument to be of type array or string, but found ${j(si(h))} instead.`)}eachChild(o){o(this.input),o(this.beginIndex),this.endIndex&&o(this.endIndex)}outputDefined(){return!1}}function iu(c,o){const h=c.length-1;let p,y,v=0,w=h,C=0;for(;v<=w;)if(C=Math.floor((v+w)/2),p=c[C],y=c[C+1],p<=o){if(C===h||o<y)return C;v=C+1}else{if(!(p>o))throw new ti("Input is not a number.");w=C-1}return 0}class Ia{constructor(o,h,p){this.type=o,this.input=h,this.labels=[],this.outputs=[];for(const[y,v]of p)this.labels.push(y),this.outputs.push(v)}static parse(o,h){if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");const p=h.parse(o[1],1,qe);if(!p)return null;const y=[];let v=null;h.expectedType&&h.expectedType.kind!=="value"&&(v=h.expectedType);for(let w=1;w<o.length;w+=2){const C=w===1?-1/0:o[w],A=o[w+1],O=w,R=w+1;if(typeof C!="number")return h.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',O);if(y.length&&y[y.length-1][0]>=C)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',O);const N=h.parse(A,R,v);if(!N)return null;v=v||N.type,y.push([C,N])}return new Ia(v,p,y)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const v=h.length;return y>=h[v-1]?p[v-1].evaluate(o):p[iu(h,y)].evaluate(o)}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function Gf(c){return c&&c.__esModule&&Object.prototype.hasOwnProperty.call(c,"default")?c.default:c}var X0=Zf;function Zf(c,o,h,p){this.cx=3*c,this.bx=3*(h-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*o,this.by=3*(p-o)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=o,this.p2x=h,this.p2y=p}Zf.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,o){if(o===void 0&&(o=1e-6),c<0)return 0;if(c>1)return 1;for(var h=c,p=0;p<8;p++){var y=this.sampleCurveX(h)-c;if(Math.abs(y)<o)return h;var v=this.sampleCurveDerivativeX(h);if(Math.abs(v)<1e-6)break;h-=y/v}var w=0,C=1;for(h=c,p=0;p<20&&(y=this.sampleCurveX(h),!(Math.abs(y-c)<o));p++)c>y?w=h:C=h,h=.5*(C-w)+w;return h},solve:function(c,o){return this.sampleCurveY(this.solveCurveX(c,o))}};var K0=Gf(X0);function jo(c,o,h){return c+h*(o-c)}function Fl(c,o,h){return c.map((p,y)=>jo(p,o[y],h))}const nr={number:jo,color:function(c,o,h,p="rgb"){switch(p){case"rgb":{const[y,v,w,C]=Fl(c.rgb,o.rgb,h);return new vn(y,v,w,C,!1)}case"hcl":{const[y,v,w,C]=c.hcl,[A,O,R,N]=o.hcl;let $,q;if(isNaN(y)||isNaN(A))isNaN(y)?isNaN(A)?$=NaN:($=A,w!==1&&w!==0||(q=O)):($=y,R!==1&&R!==0||(q=v));else{let be=A-y;A>y&&be>180?be-=360:A<y&&y-A>180&&(be+=360),$=y+h*be}const[G,X,ie,ae]=function([be,pe,ye,Ee]){return be=isNaN(be)?0:be*kt,Zn([ye,Math.cos(be)*pe,Math.sin(be)*pe,Ee])}([$,q??jo(v,O,h),jo(w,R,h),jo(C,N,h)]);return new vn(G,X,ie,ae,!1)}case"lab":{const[y,v,w,C]=Zn(Fl(c.lab,o.lab,h));return new vn(y,v,w,C,!1)}}},array:Fl,padding:function(c,o,h){return new mr(Fl(c.values,o.values,h))},variableAnchorOffsetCollection:function(c,o,h){const p=c.values,y=o.values;if(p.length!==y.length)throw new ti(`Cannot interpolate values of different length. from: ${c.toString()}, to: ${o.toString()}`);const v=[];for(let w=0;w<p.length;w+=2){if(p[w]!==y[w])throw new ti(`Cannot interpolate values containing mismatched anchors. from[${w}]: ${p[w]}, to[${w}]: ${y[w]}`);v.push(p[w]);const[C,A]=p[w+1],[O,R]=y[w+1];v.push([jo(C,O,h),jo(A,R,h)])}return new Rr(v)}};class ir{constructor(o,h,p,y,v){this.type=o,this.operator=h,this.interpolation=p,this.input=y,this.labels=[],this.outputs=[];for(const[w,C]of v)this.labels.push(w),this.outputs.push(C)}static interpolationFactor(o,h,p,y){let v=0;if(o.name==="exponential")v=ru(h,o.base,p,y);else if(o.name==="linear")v=ru(h,1,p,y);else if(o.name==="cubic-bezier"){const w=o.controlPoints;v=new K0(w[0],w[1],w[2],w[3]).solve(ru(h,1,p,y))}return v}static parse(o,h){let[p,y,v,...w]=o;if(!Array.isArray(y)||y.length===0)return h.error("Expected an interpolation type expression.",1);if(y[0]==="linear")y={name:"linear"};else if(y[0]==="exponential"){const O=y[1];if(typeof O!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);y={name:"exponential",base:O}}else{if(y[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(y[0])}`,1,0);{const O=y.slice(1);if(O.length!==4||O.some(R=>typeof R!="number"||R<0||R>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);y={name:"cubic-bezier",controlPoints:O}}}if(o.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${o.length-1}.`);if((o.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(v=h.parse(v,2,qe),!v)return null;const C=[];let A=null;p==="interpolate-hcl"||p==="interpolate-lab"?A=xt:h.expectedType&&h.expectedType.kind!=="value"&&(A=h.expectedType);for(let O=0;O<w.length;O+=2){const R=w[O],N=w[O+1],$=O+3,q=O+4;if(typeof R!="number")return h.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',$);if(C.length&&C[C.length-1][0]>=R)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',$);const G=h.parse(N,q,A);if(!G)return null;A=A||G.type,C.push([R,G])}return _e(A,qe)||_e(A,xt)||_e(A,Ui)||_e(A,se)||_e(A,U(qe))?new ir(A,p,y,v,C):h.error(`Type ${j(A)} is not interpolatable.`)}evaluate(o){const h=this.labels,p=this.outputs;if(h.length===1)return p[0].evaluate(o);const y=this.input.evaluate(o);if(y<=h[0])return p[0].evaluate(o);const v=h.length;if(y>=h[v-1])return p[v-1].evaluate(o);const w=iu(h,y),C=ir.interpolationFactor(this.interpolation,y,h[w],h[w+1]),A=p[w].evaluate(o),O=p[w+1].evaluate(o);switch(this.operator){case"interpolate":return nr[this.type.kind](A,O,C);case"interpolate-hcl":return nr.color(A,O,C,"hcl");case"interpolate-lab":return nr.color(A,O,C,"lab")}}eachChild(o){o(this.input);for(const h of this.outputs)o(h)}outputDefined(){return this.outputs.every(o=>o.outputDefined())}}function ru(c,o,h,p){const y=p-h,v=c-h;return y===0?0:o===1?v/y:(Math.pow(o,v)-1)/(Math.pow(o,y)-1)}class su{constructor(o,h){this.type=o,this.args=h}static parse(o,h){if(o.length<2)return h.error("Expectected at least one argument.");let p=null;const y=h.expectedType;y&&y.kind!=="value"&&(p=y);const v=[];for(const C of o.slice(1)){const A=h.parse(C,1+v.length,p,void 0,{typeAnnotation:"omit"});if(!A)return null;p=p||A.type,v.push(A)}if(!p)throw new Error("No output type");const w=y&&v.some(C=>ne(y,C.type));return new su(w?Je:p,v)}evaluate(o){let h,p=null,y=0;for(const v of this.args)if(y++,p=v.evaluate(o),p&&p instanceof gr&&!p.available&&(h||(h=p.name),p=null,y===this.args.length&&(p=h)),p!==null)break;return p}eachChild(o){this.args.forEach(o)}outputDefined(){return this.args.every(o=>o.outputDefined())}}function ou(c,o){return c==="=="||c==="!="?o.kind==="boolean"||o.kind==="string"||o.kind==="number"||o.kind==="null"||o.kind==="value":o.kind==="string"||o.kind==="number"||o.kind==="value"}function Yf(c,o,h,p){return p.compare(o,h)===0}function Da(c,o,h){const p=c!=="=="&&c!=="!=";return class XE{constructor(v,w,C){this.type=Re,this.lhs=v,this.rhs=w,this.collator=C,this.hasUntypedArgument=v.type.kind==="value"||w.type.kind==="value"}static parse(v,w){if(v.length!==3&&v.length!==4)return w.error("Expected two or three arguments.");const C=v[0];let A=w.parse(v[1],1,Je);if(!A)return null;if(!ou(C,A.type))return w.concat(1).error(`"${C}" comparisons are not supported for type '${j(A.type)}'.`);let O=w.parse(v[2],2,Je);if(!O)return null;if(!ou(C,O.type))return w.concat(2).error(`"${C}" comparisons are not supported for type '${j(O.type)}'.`);if(A.type.kind!==O.type.kind&&A.type.kind!=="value"&&O.type.kind!=="value")return w.error(`Cannot compare types '${j(A.type)}' and '${j(O.type)}'.`);p&&(A.type.kind==="value"&&O.type.kind!=="value"?A=new Jr(O.type,[A]):A.type.kind!=="value"&&O.type.kind==="value"&&(O=new Jr(A.type,[O])));let R=null;if(v.length===4){if(A.type.kind!=="string"&&O.type.kind!=="string"&&A.type.kind!=="value"&&O.type.kind!=="value")return w.error("Cannot use collator to compare non-string types.");if(R=w.parse(v[3],3,Rn),!R)return null}return new XE(A,O,R)}evaluate(v){const w=this.lhs.evaluate(v),C=this.rhs.evaluate(v);if(p&&this.hasUntypedArgument){const A=si(w),O=si(C);if(A.kind!==O.kind||A.kind!=="string"&&A.kind!=="number")throw new ti(`Expected arguments for "${c}" to be (string, string) or (number, number), but found (${A.kind}, ${O.kind}) instead.`)}if(this.collator&&!p&&this.hasUntypedArgument){const A=si(w),O=si(C);if(A.kind!=="string"||O.kind!=="string")return o(v,w,C)}return this.collator?h(v,w,C,this.collator.evaluate(v)):o(v,w,C)}eachChild(v){v(this.lhs),v(this.rhs),this.collator&&v(this.collator)}outputDefined(){return!0}}}const J0=Da("==",function(c,o,h){return o===h},Yf),Xf=Da("!=",function(c,o,h){return o!==h},function(c,o,h,p){return!Yf(0,o,h,p)}),Kf=Da("<",function(c,o,h){return o<h},function(c,o,h,p){return p.compare(o,h)<0}),Q0=Da(">",function(c,o,h){return o>h},function(c,o,h,p){return p.compare(o,h)>0}),e_=Da("<=",function(c,o,h){return o<=h},function(c,o,h,p){return p.compare(o,h)<=0}),Jf=Da(">=",function(c,o,h){return o>=h},function(c,o,h,p){return p.compare(o,h)>=0});class Vl{constructor(o,h,p){this.type=Rn,this.locale=p,this.caseSensitive=o,this.diacriticSensitive=h}static parse(o,h){if(o.length!==2)return h.error("Expected one argument.");const p=o[1];if(typeof p!="object"||Array.isArray(p))return h.error("Collator options argument must be an object.");const y=h.parse(p["case-sensitive"]!==void 0&&p["case-sensitive"],1,Re);if(!y)return null;const v=h.parse(p["diacritic-sensitive"]!==void 0&&p["diacritic-sensitive"],1,Re);if(!v)return null;let w=null;return p.locale&&(w=h.parse(p.locale,1,ve),!w)?null:new Vl(y,v,w)}evaluate(o){return new Zh(this.caseSensitive.evaluate(o),this.diacriticSensitive.evaluate(o),this.locale?this.locale.evaluate(o):null)}eachChild(o){o(this.caseSensitive),o(this.diacriticSensitive),this.locale&&o(this.locale)}outputDefined(){return!1}}class ed{constructor(o,h,p,y,v){this.type=ve,this.number=o,this.locale=h,this.currency=p,this.minFractionDigits=y,this.maxFractionDigits=v}static parse(o,h){if(o.length!==3)return h.error("Expected two arguments.");const p=h.parse(o[1],1,qe);if(!p)return null;const y=o[2];if(typeof y!="object"||Array.isArray(y))return h.error("NumberFormat options argument must be an object.");let v=null;if(y.locale&&(v=h.parse(y.locale,1,ve),!v))return null;let w=null;if(y.currency&&(w=h.parse(y.currency,1,ve),!w))return null;let C=null;if(y["min-fraction-digits"]&&(C=h.parse(y["min-fraction-digits"],1,qe),!C))return null;let A=null;return y["max-fraction-digits"]&&(A=h.parse(y["max-fraction-digits"],1,qe),!A)?null:new ed(p,v,w,C,A)}evaluate(o){return new Intl.NumberFormat(this.locale?this.locale.evaluate(o):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(o):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(o):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(o):void 0}).format(this.number.evaluate(o))}eachChild(o){o(this.number),this.locale&&o(this.locale),this.currency&&o(this.currency),this.minFractionDigits&&o(this.minFractionDigits),this.maxFractionDigits&&o(this.maxFractionDigits)}outputDefined(){return!1}}class au{constructor(o){this.type=Kn,this.sections=o}static parse(o,h){if(o.length<2)return h.error("Expected at least one argument.");const p=o[1];if(!Array.isArray(p)&&typeof p=="object")return h.error("First argument must be an image or text section.");const y=[];let v=!1;for(let w=1;w<=o.length-1;++w){const C=o[w];if(v&&typeof C=="object"&&!Array.isArray(C)){v=!1;let A=null;if(C["font-scale"]&&(A=h.parse(C["font-scale"],1,qe),!A))return null;let O=null;if(C["text-font"]&&(O=h.parse(C["text-font"],1,U(ve)),!O))return null;let R=null;if(C["text-color"]&&(R=h.parse(C["text-color"],1,xt),!R))return null;const N=y[y.length-1];N.scale=A,N.font=O,N.textColor=R}else{const A=h.parse(o[w],1,Je);if(!A)return null;const O=A.type.kind;if(O!=="string"&&O!=="value"&&O!=="null"&&O!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");v=!0,y.push({content:A,scale:null,font:null,textColor:null})}}return new au(y)}evaluate(o){return new fr(this.sections.map(h=>{const p=h.content.evaluate(o);return si(p)===pr?new Yh("",p,null,null,null):new Yh(Nl(p),null,h.scale?h.scale.evaluate(o):null,h.font?h.font.evaluate(o).join(","):null,h.textColor?h.textColor.evaluate(o):null)}))}eachChild(o){for(const h of this.sections)o(h.content),h.scale&&o(h.scale),h.font&&o(h.font),h.textColor&&o(h.textColor)}outputDefined(){return!1}}class td{constructor(o){this.type=pr,this.input=o}static parse(o,h){if(o.length!==2)return h.error("Expected two arguments.");const p=h.parse(o[1],1,ve);return p?new td(p):h.error("No image name provided.")}evaluate(o){const h=this.input.evaluate(o),p=gr.fromString(h);return p&&o.availableImages&&(p.available=o.availableImages.indexOf(h)>-1),p}eachChild(o){o(this.input)}outputDefined(){return!1}}class nd{constructor(o){this.type=qe,this.input=o}static parse(o,h){if(o.length!==2)return h.error(`Expected 1 argument, but found ${o.length-1} instead.`);const p=h.parse(o[1],1);return p?p.type.kind!=="array"&&p.type.kind!=="string"&&p.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${j(p.type)} instead.`):new nd(p):null}evaluate(o){const h=this.input.evaluate(o);if(typeof h=="string")return[...h].length;if(Array.isArray(h))return h.length;throw new ti(`Expected value to be of type string or array, but found ${j(si(h))} instead.`)}eachChild(o){o(this.input)}outputDefined(){return!1}}const Ms=8192;function t_(c,o){const h=(180+c[0])/360,p=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c[1]*Math.PI/360)))/360,y=Math.pow(2,o.z);return[Math.round(h*y*Ms),Math.round(p*y*Ms)]}function id(c,o){const h=Math.pow(2,o.z);return[(y=(c[0]/Ms+o.x)/h,360*y-180),(p=(c[1]/Ms+o.y)/h,360/Math.PI*Math.atan(Math.exp((180-360*p)*Math.PI/180))-90)];var p,y}function Uo(c,o){c[0]=Math.min(c[0],o[0]),c[1]=Math.min(c[1],o[1]),c[2]=Math.max(c[2],o[0]),c[3]=Math.max(c[3],o[1])}function ho(c,o){return!(c[0]<=o[0]||c[2]>=o[2]||c[1]<=o[1]||c[3]>=o[3])}function gn(c,o,h){const p=c[0]-o[0],y=c[1]-o[1],v=c[0]-h[0],w=c[1]-h[1];return p*w-v*y==0&&p*v<=0&&y*w<=0}function lu(c,o,h,p){return(y=[p[0]-h[0],p[1]-h[1]])[0]*(v=[o[0]-c[0],o[1]-c[1]])[1]-y[1]*v[0]!=0&&!(!em(c,o,h,p)||!em(h,p,c,o));var y,v}function n_(c,o,h){for(const p of h)for(let y=0;y<p.length-1;++y)if(lu(c,o,p[y],p[y+1]))return!0;return!1}function Oa(c,o,h=!1){let p=!1;for(const C of o)for(let A=0;A<C.length-1;A++){if(gn(c,C[A],C[A+1]))return h;(v=C[A])[1]>(y=c)[1]!=(w=C[A+1])[1]>y[1]&&y[0]<(w[0]-v[0])*(y[1]-v[1])/(w[1]-v[1])+v[0]&&(p=!p)}var y,v,w;return p}function i_(c,o){for(const h of o)if(Oa(c,h))return!0;return!1}function Qf(c,o){for(const h of c)if(!Oa(h,o))return!1;for(let h=0;h<c.length-1;++h)if(n_(c[h],c[h+1],o))return!1;return!0}function r_(c,o){for(const h of o)if(Qf(c,h))return!0;return!1}function em(c,o,h,p){const y=p[0]-h[0],v=p[1]-h[1],w=(c[0]-h[0])*v-y*(c[1]-h[1]),C=(o[0]-h[0])*v-y*(o[1]-h[1]);return w>0&&C<0||w<0&&C>0}function rd(c,o,h){const p=[];for(let y=0;y<c.length;y++){const v=[];for(let w=0;w<c[y].length;w++){const C=t_(c[y][w],h);Uo(o,C),v.push(C)}p.push(v)}return p}function tm(c,o,h){const p=[];for(let y=0;y<c.length;y++){const v=rd(c[y],o,h);p.push(v)}return p}function nm(c,o,h,p){if(c[0]<h[0]||c[0]>h[2]){const y=.5*p;let v=c[0]-h[0]>y?-p:h[0]-c[0]>y?p:0;v===0&&(v=c[0]-h[2]>y?-p:h[2]-c[0]>y?p:0),c[0]+=v}Uo(o,c)}function im(c,o,h,p){const y=Math.pow(2,p.z)*Ms,v=[p.x*Ms,p.y*Ms],w=[];for(const C of c)for(const A of C){const O=[A.x+v[0],A.y+v[1]];nm(O,o,h,y),w.push(O)}return w}function rm(c,o,h,p){const y=Math.pow(2,p.z)*Ms,v=[p.x*Ms,p.y*Ms],w=[];for(const A of c){const O=[];for(const R of A){const N=[R.x+v[0],R.y+v[1]];Uo(o,N),O.push(N)}w.push(O)}if(o[2]-o[0]<=y/2){(C=o)[0]=C[1]=1/0,C[2]=C[3]=-1/0;for(const A of w)for(const O of A)nm(O,o,h,y)}var C;return w}class Ho{constructor(o,h){this.type=Re,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Vo(o[1])){const p=o[1];if(p.type==="FeatureCollection"){const y=[];for(const v of p.features){const{type:w,coordinates:C}=v.geometry;w==="Polygon"&&y.push(C),w==="MultiPolygon"&&y.push(...C)}if(y.length)return new Ho(p,{type:"MultiPolygon",coordinates:y})}else if(p.type==="Feature"){const y=p.geometry.type;if(y==="Polygon"||y==="MultiPolygon")return new Ho(p,p.geometry)}else if(p.type==="Polygon"||p.type==="MultiPolygon")return new Ho(p,p)}return h.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],w=h.canonicalID();if(p.type==="Polygon"){const C=rd(p.coordinates,v,w),A=im(h.geometry(),y,v,w);if(!ho(y,v))return!1;for(const O of A)if(!Oa(O,C))return!1}if(p.type==="MultiPolygon"){const C=tm(p.coordinates,v,w),A=im(h.geometry(),y,v,w);if(!ho(y,v))return!1;for(const O of A)if(!i_(O,C))return!1}return!0}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const y=[1/0,1/0,-1/0,-1/0],v=[1/0,1/0,-1/0,-1/0],w=h.canonicalID();if(p.type==="Polygon"){const C=rd(p.coordinates,v,w),A=rm(h.geometry(),y,v,w);if(!ho(y,v))return!1;for(const O of A)if(!Qf(O,C))return!1}if(p.type==="MultiPolygon"){const C=tm(p.coordinates,v,w),A=rm(h.geometry(),y,v,w);if(!ho(y,v))return!1;for(const O of A)if(!r_(O,C))return!1}return!0}(o,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let sm=class{constructor(c=[],o=(h,p)=>h<p?-1:h>p?1:0){if(this.data=c,this.length=this.data.length,this.compare=o,this.length>0)for(let h=(this.length>>1)-1;h>=0;h--)this._down(h)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],o=this.data.pop();return--this.length>0&&(this.data[0]=o,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:o,compare:h}=this,p=o[c];for(;c>0;){const y=c-1>>1,v=o[y];if(h(p,v)>=0)break;o[c]=v,c=y}o[c]=p}_down(c){const{data:o,compare:h}=this,p=this.length>>1,y=o[c];for(;c<p;){let v=1+(c<<1);const w=v+1;if(w<this.length&&h(o[w],o[v])<0&&(v=w),h(o[v],y)>=0)break;o[c]=o[v],c=v}o[c]=y}};function s_(c,o,h,p,y){om(c,o,h,p||c.length-1,y||o_)}function om(c,o,h,p,y){for(;p>h;){if(p-h>600){var v=p-h+1,w=o-h+1,C=Math.log(v),A=.5*Math.exp(2*C/3),O=.5*Math.sqrt(C*A*(v-A)/v)*(w-v/2<0?-1:1);om(c,o,Math.max(h,Math.floor(o-w*A/v+O)),Math.min(p,Math.floor(o+(v-w)*A/v+O)),y)}var R=c[o],N=h,$=p;for($l(c,h,o),y(c[p],R)>0&&$l(c,h,p);N<$;){for($l(c,N,$),N++,$--;y(c[N],R)<0;)N++;for(;y(c[$],R)>0;)$--}y(c[h],R)===0?$l(c,h,$):$l(c,++$,p),$<=o&&(h=$+1),o<=$&&(p=$-1)}}function $l(c,o,h){var p=c[o];c[o]=c[h],c[h]=p}function o_(c,o){return c<o?-1:c>o?1:0}function cu(c,o){if(c.length<=1)return[c];const h=[];let p,y;for(const v of c){const w=l_(v);w!==0&&(v.area=Math.abs(w),y===void 0&&(y=w<0),y===w<0?(p&&h.push(p),p=[v]):p.push(v))}if(p&&h.push(p),o>1)for(let v=0;v<h.length;v++)h[v].length<=o||(s_(h[v],o,1,h[v].length-1,a_),h[v]=h[v].slice(0,o));return h}function a_(c,o){return o.area-c.area}function l_(c){let o=0;for(let h,p,y=0,v=c.length,w=v-1;y<v;w=y++)h=c[y],p=c[w],o+=(p.x-h.x)*(h.y+p.y);return o}const am=1/298.257223563,lm=am*(2-am),cm=Math.PI/180;class sd{constructor(o){const h=6378.137*cm*1e3,p=Math.cos(o*cm),y=1/(1-lm*(1-p*p)),v=Math.sqrt(y);this.kx=h*v*p,this.ky=h*v*y*(1-lm)}distance(o,h){const p=this.wrap(o[0]-h[0])*this.kx,y=(o[1]-h[1])*this.ky;return Math.sqrt(p*p+y*y)}pointOnLine(o,h){let p,y,v,w,C=1/0;for(let A=0;A<o.length-1;A++){let O=o[A][0],R=o[A][1],N=this.wrap(o[A+1][0]-O)*this.kx,$=(o[A+1][1]-R)*this.ky,q=0;N===0&&$===0||(q=(this.wrap(h[0]-O)*this.kx*N+(h[1]-R)*this.ky*$)/(N*N+$*$),q>1?(O=o[A+1][0],R=o[A+1][1]):q>0&&(O+=N/this.kx*q,R+=$/this.ky*q)),N=this.wrap(h[0]-O)*this.kx,$=(h[1]-R)*this.ky;const G=N*N+$*$;G<C&&(C=G,p=O,y=R,v=A,w=q)}return{point:[p,y],index:v,t:Math.max(0,Math.min(1,w))}}wrap(o){for(;o<-180;)o+=360;for(;o>180;)o-=360;return o}}function um(c,o){return o[0]-c[0]}function uu(c){return c[1]-c[0]+1}function Hs(c,o){return c[1]>=c[0]&&c[1]<o}function od(c,o){if(c[0]>c[1])return[null,null];const h=uu(c);if(o){if(h===2)return[c,null];const y=Math.floor(h/2);return[[c[0],c[0]+y],[c[0]+y,c[1]]]}if(h===1)return[c,null];const p=Math.floor(h/2)-1;return[[c[0],c[0]+p],[c[0]+p+1,c[1]]]}function ad(c,o){if(!Hs(o,c.length))return[1/0,1/0,-1/0,-1/0];const h=[1/0,1/0,-1/0,-1/0];for(let p=o[0];p<=o[1];++p)Uo(h,c[p]);return h}function ld(c){const o=[1/0,1/0,-1/0,-1/0];for(const h of c)for(const p of h)Uo(o,p);return o}function hu(c){return c[0]!==-1/0&&c[1]!==-1/0&&c[2]!==1/0&&c[3]!==1/0}function cd(c,o,h){if(!hu(c)||!hu(o))return NaN;let p=0,y=0;return c[2]<o[0]&&(p=o[0]-c[2]),c[0]>o[2]&&(p=c[0]-o[2]),c[1]>o[3]&&(y=c[1]-o[3]),c[3]<o[1]&&(y=o[1]-c[3]),h.distance([0,0],[p,y])}function qo(c,o,h){const p=h.pointOnLine(o,c);return h.distance(c,p.point)}function ud(c,o,h,p,y){const v=Math.min(qo(c,[h,p],y),qo(o,[h,p],y)),w=Math.min(qo(h,[c,o],y),qo(p,[c,o],y));return Math.min(v,w)}function c_(c,o,h,p,y){if(!Hs(o,c.length)||!Hs(p,h.length))return 1/0;let v=1/0;for(let w=o[0];w<o[1];++w){const C=c[w],A=c[w+1];for(let O=p[0];O<p[1];++O){const R=h[O],N=h[O+1];if(lu(C,A,R,N))return 0;v=Math.min(v,ud(C,A,R,N,y))}}return v}function Jn(c,o,h,p,y){if(!Hs(o,c.length)||!Hs(p,h.length))return NaN;let v=1/0;for(let w=o[0];w<=o[1];++w)for(let C=p[0];C<=p[1];++C)if(v=Math.min(v,y.distance(c[w],h[C])),v===0)return v;return v}function u_(c,o,h){if(Oa(c,o,!0))return 0;let p=1/0;for(const y of o){const v=y[0],w=y[y.length-1];if(v!==w&&(p=Math.min(p,qo(c,[w,v],h)),p===0))return p;const C=h.pointOnLine(y,c);if(p=Math.min(p,h.distance(c,C.point)),p===0)return p}return p}function Ht(c,o,h,p){if(!Hs(o,c.length))return NaN;for(let v=o[0];v<=o[1];++v)if(Oa(c[v],h,!0))return 0;let y=1/0;for(let v=o[0];v<o[1];++v){const w=c[v],C=c[v+1];for(const A of h)for(let O=0,R=A.length,N=R-1;O<R;N=O++){const $=A[N],q=A[O];if(lu(w,C,$,q))return 0;y=Math.min(y,ud(w,C,$,q,p))}}return y}function du(c,o){for(const h of c)for(const p of h)if(Oa(p,o,!0))return!0;return!1}function Dn(c,o,h,p=1/0){const y=ld(c),v=ld(o);if(p!==1/0&&cd(y,v,h)>=p)return p;if(ho(y,v)){if(du(c,o))return 0}else if(du(o,c))return 0;let w=1/0;for(const C of c)for(let A=0,O=C.length,R=O-1;A<O;R=A++){const N=C[R],$=C[A];for(const q of o)for(let G=0,X=q.length,ie=X-1;G<X;ie=G++){const ae=q[ie],be=q[G];if(lu(N,$,ae,be))return 0;w=Math.min(w,ud(N,$,ae,be,h))}}return w}function Cn(c,o,h,p,y,v){if(!v)return;const w=cd(ad(p,v),y,h);w<o&&c.push([w,v,[0,0]])}function Wo(c,o,h,p,y,v,w){if(!v||!w)return;const C=cd(ad(p,v),ad(y,w),h);C<o&&c.push([C,v,w])}function jl(c,o,h,p,y=1/0){let v=Math.min(p.distance(c[0],h[0][0]),y);if(v===0)return v;const w=new sm([[0,[0,c.length-1],[0,0]]],um),C=ld(h);for(;w.length>0;){const A=w.pop();if(A[0]>=v)continue;const O=A[1],R=o?50:100;if(uu(O)<=R){if(!Hs(O,c.length))return NaN;if(o){const N=Ht(c,O,h,p);if(isNaN(N)||N===0)return N;v=Math.min(v,N)}else for(let N=O[0];N<=O[1];++N){const $=u_(c[N],h,p);if(v=Math.min(v,$),v===0)return 0}}else{const N=od(O,o);Cn(w,v,p,c,C,N[0]),Cn(w,v,p,c,C,N[1])}}return v}function Ul(c,o,h,p,y,v=1/0){let w=Math.min(v,y.distance(c[0],h[0]));if(w===0)return w;const C=new sm([[0,[0,c.length-1],[0,h.length-1]]],um);for(;C.length>0;){const A=C.pop();if(A[0]>=w)continue;const O=A[1],R=A[2],N=o?50:100,$=p?50:100;if(uu(O)<=N&&uu(R)<=$){if(!Hs(O,c.length)&&Hs(R,h.length))return NaN;let q;if(o&&p)q=c_(c,O,h,R,y),w=Math.min(w,q);else if(o&&!p){const G=c.slice(O[0],O[1]+1);for(let X=R[0];X<=R[1];++X)if(q=qo(h[X],G,y),w=Math.min(w,q),w===0)return w}else if(!o&&p){const G=h.slice(R[0],R[1]+1);for(let X=O[0];X<=O[1];++X)if(q=qo(c[X],G,y),w=Math.min(w,q),w===0)return w}else q=Jn(c,O,h,R,y),w=Math.min(w,q)}else{const q=od(O,o),G=od(R,p);Wo(C,w,y,c,h,q[0],G[0]),Wo(C,w,y,c,h,q[0],G[1]),Wo(C,w,y,c,h,q[1],G[0]),Wo(C,w,y,c,h,q[1],G[1])}}return w}function hd(c){return c.type==="MultiPolygon"?c.coordinates.map(o=>({type:"Polygon",coordinates:o})):c.type==="MultiLineString"?c.coordinates.map(o=>({type:"LineString",coordinates:o})):c.type==="MultiPoint"?c.coordinates.map(o=>({type:"Point",coordinates:o})):[c]}class Go{constructor(o,h){this.type=qe,this.geojson=o,this.geometries=h}static parse(o,h){if(o.length!==2)return h.error(`'distance' expression requires exactly one argument, but found ${o.length-1} instead.`);if(Vo(o[1])){const p=o[1];if(p.type==="FeatureCollection")return new Go(p,p.features.map(y=>hd(y.geometry)).flat());if(p.type==="Feature")return new Go(p,hd(p.geometry));if("type"in p&&"coordinates"in p)return new Go(p,hd(p))}return h.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(o){if(o.geometry()!=null&&o.canonicalID()!=null){if(o.geometryType()==="Point")return function(h,p){const y=h.geometry(),v=y.flat().map(A=>id([A.x,A.y],h.canonical));if(y.length===0)return NaN;const w=new sd(v[0][1]);let C=1/0;for(const A of p){switch(A.type){case"Point":C=Math.min(C,Ul(v,!1,[A.coordinates],!1,w,C));break;case"LineString":C=Math.min(C,Ul(v,!1,A.coordinates,!0,w,C));break;case"Polygon":C=Math.min(C,jl(v,!1,A.coordinates,w,C))}if(C===0)return C}return C}(o,this.geometries);if(o.geometryType()==="LineString")return function(h,p){const y=h.geometry(),v=y.flat().map(A=>id([A.x,A.y],h.canonical));if(y.length===0)return NaN;const w=new sd(v[0][1]);let C=1/0;for(const A of p){switch(A.type){case"Point":C=Math.min(C,Ul(v,!0,[A.coordinates],!1,w,C));break;case"LineString":C=Math.min(C,Ul(v,!0,A.coordinates,!0,w,C));break;case"Polygon":C=Math.min(C,jl(v,!0,A.coordinates,w,C))}if(C===0)return C}return C}(o,this.geometries);if(o.geometryType()==="Polygon")return function(h,p){const y=h.geometry();if(y.length===0||y[0].length===0)return NaN;const v=cu(y,0).map(A=>A.map(O=>O.map(R=>id([R.x,R.y],h.canonical)))),w=new sd(v[0][0][0][1]);let C=1/0;for(const A of p)for(const O of v){switch(A.type){case"Point":C=Math.min(C,jl([A.coordinates],!1,O,w,C));break;case"LineString":C=Math.min(C,jl(A.coordinates,!0,O,w,C));break;case"Polygon":C=Math.min(C,Dn(O,A.coordinates,w,C))}if(C===0)return C}return C}(o,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const za={"==":J0,"!=":Xf,">":Q0,"<":Kf,">=":Jf,"<=":e_,array:Jr,at:Kh,boolean:Jr,case:nu,coalesce:su,collator:Vl,format:au,image:td,in:Jh,"index-of":Pa,interpolate:ir,"interpolate-hcl":ir,"interpolate-lab":ir,length:nd,let:uo,literal:Kr,match:Qh,number:Jr,"number-format":ed,object:Jr,slice:Bl,step:Ia,string:Jr,"to-boolean":Qr,"to-color":Qr,"to-number":Qr,"to-string":Qr,var:pn,within:Ho,distance:Go};class Lr{constructor(o,h,p,y){this.name=o,this.type=h,this._evaluate=p,this.args=y}evaluate(o){return this._evaluate(o,this.args)}eachChild(o){this.args.forEach(o)}outputDefined(){return!1}static parse(o,h){const p=o[0],y=Lr.definitions[p];if(!y)return h.error(`Unknown expression "${p}". If you wanted a literal array, use ["literal", [...]].`,0);const v=Array.isArray(y)?y[0]:y.type,w=Array.isArray(y)?[[y[1],y[2]]]:y.overloads,C=w.filter(([O])=>!Array.isArray(O)||O.length===o.length-1);let A=null;for(const[O,R]of C){A=new $o(h.registry,Hl,h.path,null,h.scope);const N=[];let $=!1;for(let q=1;q<o.length;q++){const G=o[q],X=Array.isArray(O)?O[q-1]:O.type,ie=A.parse(G,1+N.length,X);if(!ie){$=!0;break}N.push(ie)}if(!$)if(Array.isArray(O)&&O.length!==N.length)A.error(`Expected ${O.length} arguments, but found ${N.length} instead.`);else{for(let q=0;q<N.length;q++){const G=Array.isArray(O)?O[q]:O.type,X=N[q];A.concat(q+1).checkSubtype(G,X.type)}if(A.errors.length===0)return new Lr(p,v,R,N)}}if(C.length===1)h.errors.push(...A.errors);else{const O=(C.length?C:w).map(([N])=>{return $=N,Array.isArray($)?`(${$.map(j).join(", ")})`:`(${j($.type)}...)`;var $}).join(" | "),R=[];for(let N=1;N<o.length;N++){const $=h.parse(o[N],1+R.length);if(!$)return null;R.push(j($.type))}h.error(`Expected arguments of type ${O}, but found (${R.join(", ")}) instead.`)}return null}static register(o,h){Lr.definitions=h;for(const p in h)o[p]=Lr}}function dd(c,[o,h,p,y]){o=o.evaluate(c),h=h.evaluate(c),p=p.evaluate(c);const v=y?y.evaluate(c):1,w=Aa(o,h,p,v);if(w)throw new ti(w);return new vn(o/255,h/255,p/255,v,!1)}function pd(c,o){return c in o}function fd(c,o){const h=o[c];return h===void 0?null:h}function Zo(c){return{type:c}}function Hl(c){if(c instanceof pn)return Hl(c.boundExpression);if(c instanceof Lr&&c.name==="error"||c instanceof Vl||c instanceof Ho||c instanceof Go)return!1;const o=c instanceof Qr||c instanceof Jr;let h=!0;return c.eachChild(p=>{h=o?h&&Hl(p):h&&p instanceof Kr}),!!h&&ql(c)&&Wl(c,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function ql(c){if(c instanceof Lr&&(c.name==="get"&&c.args.length===1||c.name==="feature-state"||c.name==="has"&&c.args.length===1||c.name==="properties"||c.name==="geometry-type"||c.name==="id"||/^filter-/.test(c.name))||c instanceof Ho||c instanceof Go)return!1;let o=!0;return c.eachChild(h=>{o&&!ql(h)&&(o=!1)}),o}function Ra(c){if(c instanceof Lr&&c.name==="feature-state")return!1;let o=!0;return c.eachChild(h=>{o&&!Ra(h)&&(o=!1)}),o}function Wl(c,o){if(c instanceof Lr&&o.indexOf(c.name)>=0)return!1;let h=!0;return c.eachChild(p=>{h&&!Wl(p,o)&&(h=!1)}),h}function pu(c){return{result:"success",value:c}}function La(c){return{result:"error",value:c}}function Na(c){return c["property-type"]==="data-driven"||c["property-type"]==="cross-faded-data-driven"}function hm(c){return!!c.expression&&c.expression.parameters.indexOf("zoom")>-1}function md(c){return!!c.expression&&c.expression.interpolated}function cn(c){return c instanceof Number?"number":c instanceof String?"string":c instanceof Boolean?"boolean":Array.isArray(c)?"array":c===null?"null":typeof c}function fu(c){return typeof c=="object"&&c!==null&&!Array.isArray(c)}function h_(c){return c}function dm(c,o){const h=o.type==="color",p=c.stops&&typeof c.stops[0][0]=="object",y=p||!(p||c.property!==void 0),v=c.type||(md(o)?"exponential":"interval");if(h||o.type==="padding"){const R=h?vn.parse:mr.parse;(c=Or({},c)).stops&&(c.stops=c.stops.map(N=>[N[0],R(N[1])])),c.default=R(c.default?c.default:o.default)}if(c.colorSpace&&(w=c.colorSpace)!=="rgb"&&w!=="hcl"&&w!=="lab")throw new Error(`Unknown color space: "${c.colorSpace}"`);var w;let C,A,O;if(v==="exponential")C=fm;else if(v==="interval")C=mu;else if(v==="categorical"){C=pm,A=Object.create(null);for(const R of c.stops)A[R[0]]=R[1];O=typeof c.stops[0][0]}else{if(v!=="identity")throw new Error(`Unknown function type "${v}"`);C=mm}if(p){const R={},N=[];for(let G=0;G<c.stops.length;G++){const X=c.stops[G],ie=X[0].zoom;R[ie]===void 0&&(R[ie]={zoom:ie,type:c.type,property:c.property,default:c.default,stops:[]},N.push(ie)),R[ie].stops.push([X[0].value,X[1]])}const $=[];for(const G of N)$.push([R[G].zoom,dm(R[G],o)]);const q={name:"linear"};return{kind:"composite",interpolationType:q,interpolationFactor:ir.interpolationFactor.bind(void 0,q),zoomStops:$.map(G=>G[0]),evaluate:({zoom:G},X)=>fm({stops:$,base:c.base},o,G).evaluate(G,X)}}if(y){const R=v==="exponential"?{name:"exponential",base:c.base!==void 0?c.base:1}:null;return{kind:"camera",interpolationType:R,interpolationFactor:ir.interpolationFactor.bind(void 0,R),zoomStops:c.stops.map(N=>N[0]),evaluate:({zoom:N})=>C(c,o,N,A,O)}}return{kind:"source",evaluate(R,N){const $=N&&N.properties?N.properties[c.property]:void 0;return $===void 0?Ba(c.default,o.default):C(c,o,$,A,O)}}}function Ba(c,o,h){return c!==void 0?c:o!==void 0?o:h!==void 0?h:void 0}function pm(c,o,h,p,y){return Ba(typeof h===y?p[h]:void 0,c.default,o.default)}function mu(c,o,h){if(cn(h)!=="number")return Ba(c.default,o.default);const p=c.stops.length;if(p===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[p-1][0])return c.stops[p-1][1];const y=iu(c.stops.map(v=>v[0]),h);return c.stops[y][1]}function fm(c,o,h){const p=c.base!==void 0?c.base:1;if(cn(h)!=="number")return Ba(c.default,o.default);const y=c.stops.length;if(y===1||h<=c.stops[0][0])return c.stops[0][1];if(h>=c.stops[y-1][0])return c.stops[y-1][1];const v=iu(c.stops.map(R=>R[0]),h),w=function(R,N,$,q){const G=q-$,X=R-$;return G===0?0:N===1?X/G:(Math.pow(N,X)-1)/(Math.pow(N,G)-1)}(h,p,c.stops[v][0],c.stops[v+1][0]),C=c.stops[v][1],A=c.stops[v+1][1],O=nr[o.type]||h_;return typeof C.evaluate=="function"?{evaluate(...R){const N=C.evaluate.apply(void 0,R),$=A.evaluate.apply(void 0,R);if(N!==void 0&&$!==void 0)return O(N,$,w,c.colorSpace)}}:O(C,A,w,c.colorSpace)}function mm(c,o,h){switch(o.type){case"color":h=vn.parse(h);break;case"formatted":h=fr.fromString(h.toString());break;case"resolvedImage":h=gr.fromString(h.toString());break;case"padding":h=mr.parse(h);break;default:cn(h)===o.type||o.type==="enum"&&o.values[h]||(h=void 0)}return Ba(h,c.default,o.default)}Lr.register(za,{error:[{kind:"error"},[ve],(c,[o])=>{throw new ti(o.evaluate(c))}],typeof:[ve,[Je],(c,[o])=>j(si(o.evaluate(c)))],"to-rgba":[U(qe,4),[xt],(c,[o])=>{const[h,p,y,v]=o.evaluate(c).rgb;return[255*h,255*p,255*y,v]}],rgb:[xt,[qe,qe,qe],dd],rgba:[xt,[qe,qe,qe,qe],dd],has:{type:Re,overloads:[[[ve],(c,[o])=>pd(o.evaluate(c),c.properties())],[[ve,Ut],(c,[o,h])=>pd(o.evaluate(c),h.evaluate(c))]]},get:{type:Je,overloads:[[[ve],(c,[o])=>fd(o.evaluate(c),c.properties())],[[ve,Ut],(c,[o,h])=>fd(o.evaluate(c),h.evaluate(c))]]},"feature-state":[Je,[ve],(c,[o])=>fd(o.evaluate(c),c.featureState||{})],properties:[Ut,[],c=>c.properties()],"geometry-type":[ve,[],c=>c.geometryType()],id:[Je,[],c=>c.id()],zoom:[qe,[],c=>c.globals.zoom],"heatmap-density":[qe,[],c=>c.globals.heatmapDensity||0],"line-progress":[qe,[],c=>c.globals.lineProgress||0],accumulated:[Je,[],c=>c.globals.accumulated===void 0?null:c.globals.accumulated],"+":[qe,Zo(qe),(c,o)=>{let h=0;for(const p of o)h+=p.evaluate(c);return h}],"*":[qe,Zo(qe),(c,o)=>{let h=1;for(const p of o)h*=p.evaluate(c);return h}],"-":{type:qe,overloads:[[[qe,qe],(c,[o,h])=>o.evaluate(c)-h.evaluate(c)],[[qe],(c,[o])=>-o.evaluate(c)]]},"/":[qe,[qe,qe],(c,[o,h])=>o.evaluate(c)/h.evaluate(c)],"%":[qe,[qe,qe],(c,[o,h])=>o.evaluate(c)%h.evaluate(c)],ln2:[qe,[],()=>Math.LN2],pi:[qe,[],()=>Math.PI],e:[qe,[],()=>Math.E],"^":[qe,[qe,qe],(c,[o,h])=>Math.pow(o.evaluate(c),h.evaluate(c))],sqrt:[qe,[qe],(c,[o])=>Math.sqrt(o.evaluate(c))],log10:[qe,[qe],(c,[o])=>Math.log(o.evaluate(c))/Math.LN10],ln:[qe,[qe],(c,[o])=>Math.log(o.evaluate(c))],log2:[qe,[qe],(c,[o])=>Math.log(o.evaluate(c))/Math.LN2],sin:[qe,[qe],(c,[o])=>Math.sin(o.evaluate(c))],cos:[qe,[qe],(c,[o])=>Math.cos(o.evaluate(c))],tan:[qe,[qe],(c,[o])=>Math.tan(o.evaluate(c))],asin:[qe,[qe],(c,[o])=>Math.asin(o.evaluate(c))],acos:[qe,[qe],(c,[o])=>Math.acos(o.evaluate(c))],atan:[qe,[qe],(c,[o])=>Math.atan(o.evaluate(c))],min:[qe,Zo(qe),(c,o)=>Math.min(...o.map(h=>h.evaluate(c)))],max:[qe,Zo(qe),(c,o)=>Math.max(...o.map(h=>h.evaluate(c)))],abs:[qe,[qe],(c,[o])=>Math.abs(o.evaluate(c))],round:[qe,[qe],(c,[o])=>{const h=o.evaluate(c);return h<0?-Math.round(-h):Math.round(h)}],floor:[qe,[qe],(c,[o])=>Math.floor(o.evaluate(c))],ceil:[qe,[qe],(c,[o])=>Math.ceil(o.evaluate(c))],"filter-==":[Re,[ve,Je],(c,[o,h])=>c.properties()[o.value]===h.value],"filter-id-==":[Re,[Je],(c,[o])=>c.id()===o.value],"filter-type-==":[Re,[ve],(c,[o])=>c.geometryType()===o.value],"filter-<":[Re,[ve,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p<y}],"filter-id-<":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h<p}],"filter->":[Re,[ve,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p>y}],"filter-id->":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h>p}],"filter-<=":[Re,[ve,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p<=y}],"filter-id-<=":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h<=p}],"filter->=":[Re,[ve,Je],(c,[o,h])=>{const p=c.properties()[o.value],y=h.value;return typeof p==typeof y&&p>=y}],"filter-id->=":[Re,[Je],(c,[o])=>{const h=c.id(),p=o.value;return typeof h==typeof p&&h>=p}],"filter-has":[Re,[Je],(c,[o])=>o.value in c.properties()],"filter-has-id":[Re,[],c=>c.id()!==null&&c.id()!==void 0],"filter-type-in":[Re,[U(ve)],(c,[o])=>o.value.indexOf(c.geometryType())>=0],"filter-id-in":[Re,[U(Je)],(c,[o])=>o.value.indexOf(c.id())>=0],"filter-in-small":[Re,[ve,U(Je)],(c,[o,h])=>h.value.indexOf(c.properties()[o.value])>=0],"filter-in-large":[Re,[ve,U(Je)],(c,[o,h])=>function(p,y,v,w){for(;v<=w;){const C=v+w>>1;if(y[C]===p)return!0;y[C]>p?w=C-1:v=C+1}return!1}(c.properties()[o.value],h.value,0,h.value.length-1)],all:{type:Re,overloads:[[[Re,Re],(c,[o,h])=>o.evaluate(c)&&h.evaluate(c)],[Zo(Re),(c,o)=>{for(const h of o)if(!h.evaluate(c))return!1;return!0}]]},any:{type:Re,overloads:[[[Re,Re],(c,[o,h])=>o.evaluate(c)||h.evaluate(c)],[Zo(Re),(c,o)=>{for(const h of o)if(h.evaluate(c))return!0;return!1}]]},"!":[Re,[Re],(c,[o])=>!o.evaluate(c)],"is-supported-script":[Re,[ve],(c,[o])=>{const h=c.globals&&c.globals.isSupportedScript;return!h||h(o.evaluate(c))}],upcase:[ve,[ve],(c,[o])=>o.evaluate(c).toUpperCase()],downcase:[ve,[ve],(c,[o])=>o.evaluate(c).toLowerCase()],concat:[ve,Zo(Je),(c,o)=>o.map(h=>Nl(h.evaluate(c))).join("")],"resolved-locale":[ve,[Rn],(c,[o])=>o.evaluate(c).resolvedLocale()]});class gu{constructor(o,h){var p;this.expression=o,this._warningHistory={},this._evaluator=new tu,this._defaultValue=h?(p=h).type==="color"&&fu(p.default)?new vn(0,0,0,0):p.type==="color"?vn.parse(p.default)||null:p.type==="padding"?mr.parse(p.default)||null:p.type==="variableAnchorOffsetCollection"?Rr.parse(p.default)||null:p.default===void 0?null:p.default:null,this._enumValues=h&&h.type==="enum"?h.values:null}evaluateWithoutErrorHandling(o,h,p,y,v,w){return this._evaluator.globals=o,this._evaluator.feature=h,this._evaluator.featureState=p,this._evaluator.canonical=y,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w,this.expression.evaluate(this._evaluator)}evaluate(o,h,p,y,v,w){this._evaluator.globals=o,this._evaluator.feature=h||null,this._evaluator.featureState=p||null,this._evaluator.canonical=y,this._evaluator.availableImages=v||null,this._evaluator.formattedSection=w||null;try{const C=this.expression.evaluate(this._evaluator);if(C==null||typeof C=="number"&&C!=C)return this._defaultValue;if(this._enumValues&&!(C in this._enumValues))throw new ti(`Expected value to be one of ${Object.keys(this._enumValues).map(A=>JSON.stringify(A)).join(", ")}, but found ${JSON.stringify(C)} instead.`);return C}catch(C){return this._warningHistory[C.message]||(this._warningHistory[C.message]=!0,typeof console<"u"&&console.warn(C.message)),this._defaultValue}}}function yu(c){return Array.isArray(c)&&c.length>0&&typeof c[0]=="string"&&c[0]in za}function Fa(c,o){const h=new $o(za,Hl,[],o?function(y){const v={color:xt,string:ve,number:qe,enum:ve,boolean:Re,formatted:Kn,padding:Ui,resolvedImage:pr,variableAnchorOffsetCollection:se};return y.type==="array"?U(v[y.value]||Je,y.length):v[y.type]}(o):void 0),p=h.parse(c,void 0,void 0,void 0,o&&o.type==="string"?{typeAnnotation:"coerce"}:void 0);return p?pu(new gu(p,o)):La(h.errors)}class Va{constructor(o,h){this.kind=o,this._styleExpression=h,this.isStateDependent=o!=="constant"&&!Ra(h.expression)}evaluateWithoutErrorHandling(o,h,p,y,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,v,w)}evaluate(o,h,p,y,v,w){return this._styleExpression.evaluate(o,h,p,y,v,w)}}class $a{constructor(o,h,p,y){this.kind=o,this.zoomStops=p,this._styleExpression=h,this.isStateDependent=o!=="camera"&&!Ra(h.expression),this.interpolationType=y}evaluateWithoutErrorHandling(o,h,p,y,v,w){return this._styleExpression.evaluateWithoutErrorHandling(o,h,p,y,v,w)}evaluate(o,h,p,y,v,w){return this._styleExpression.evaluate(o,h,p,y,v,w)}interpolationFactor(o,h,p){return this.interpolationType?ir.interpolationFactor(this.interpolationType,o,h,p):0}}function gd(c,o){const h=Fa(c,o);if(h.result==="error")return h;const p=h.value.expression,y=ql(p);if(!y&&!Na(o))return La([new vi("","data expressions not supported")]);const v=Wl(p,["zoom"]);if(!v&&!hm(o))return La([new vi("","zoom expressions not supported")]);const w=Gl(p);return w||v?w instanceof vi?La([w]):w instanceof ir&&!md(o)?La([new vi("",'"interpolate" expressions cannot be used with this property')]):pu(w?new $a(y?"camera":"composite",h.value,w.labels,w instanceof ir?w.interpolation:void 0):new Va(y?"constant":"source",h.value)):La([new vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class ja{constructor(o,h){this._parameters=o,this._specification=h,Or(this,dm(this._parameters,this._specification))}static deserialize(o){return new ja(o._parameters,o._specification)}static serialize(o){return{_parameters:o._parameters,_specification:o._specification}}}function Gl(c){let o=null;if(c instanceof uo)o=Gl(c.result);else if(c instanceof su){for(const h of c.args)if(o=Gl(h),o)break}else(c instanceof Ia||c instanceof ir)&&c.input instanceof Lr&&c.input.name==="zoom"&&(o=c);return o instanceof vi||c.eachChild(h=>{const p=Gl(h);p instanceof vi?o=p:!o&&p?o=new vi("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):o&&p&&o!==p&&(o=new vi("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),o}function _u(c){if(c===!0||c===!1)return!0;if(!Array.isArray(c)||c.length===0)return!1;switch(c[0]){case"has":return c.length>=2&&c[1]!=="$id"&&c[1]!=="$type";case"in":return c.length>=3&&(typeof c[1]!="string"||Array.isArray(c[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return c.length!==3||Array.isArray(c[1])||Array.isArray(c[2]);case"any":case"all":for(const o of c.slice(1))if(!_u(o)&&typeof o!="boolean")return!1;return!0;default:return!0}}const bu={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function yd(c){if(c==null)return{filter:()=>!0,needGeometry:!1};_u(c)||(c=xu(c));const o=Fa(c,bu);if(o.result==="error")throw new Error(o.value.map(h=>`${h.key}: ${h.message}`).join(", "));return{filter:(h,p,y)=>o.value.evaluate(h,p,{},y),needGeometry:gm(c)}}function d_(c,o){return c<o?-1:c>o?1:0}function gm(c){if(!Array.isArray(c))return!1;if(c[0]==="within"||c[0]==="distance")return!0;for(let o=1;o<c.length;o++)if(gm(c[o]))return!0;return!1}function xu(c){if(!c)return!0;const o=c[0];return c.length<=1?o!=="any":o==="=="?_d(c[1],c[2],"=="):o==="!="?Pi(_d(c[1],c[2],"==")):o==="<"||o===">"||o==="<="||o===">="?_d(c[1],c[2],o):o==="any"?(h=c.slice(1),["any"].concat(h.map(xu))):o==="all"?["all"].concat(c.slice(1).map(xu)):o==="none"?["all"].concat(c.slice(1).map(xu).map(Pi)):o==="in"?Zl(c[1],c.slice(2)):o==="!in"?Pi(Zl(c[1],c.slice(2))):o==="has"?Yl(c[1]):o!=="!has"||Pi(Yl(c[1]));var h}function _d(c,o,h){switch(c){case"$type":return[`filter-type-${h}`,o];case"$id":return[`filter-id-${h}`,o];default:return[`filter-${h}`,c,o]}}function Zl(c,o){if(o.length===0)return!1;switch(c){case"$type":return["filter-type-in",["literal",o]];case"$id":return["filter-id-in",["literal",o]];default:return o.length>200&&!o.some(h=>typeof h!=typeof o[0])?["filter-in-large",c,["literal",o.sort(d_)]]:["filter-in-small",c,["literal",o]]}}function Yl(c){switch(c){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",c]}}function Pi(c){return["!",c]}function Yo(c){const o=typeof c;if(o==="number"||o==="boolean"||o==="string"||c==null)return JSON.stringify(c);if(Array.isArray(c)){let y="[";for(const v of c)y+=`${Yo(v)},`;return`${y}]`}const h=Object.keys(c).sort();let p="{";for(let y=0;y<h.length;y++)p+=`${JSON.stringify(h[y])}:${Yo(c[h[y]])},`;return`${p}}`}function ym(c){let o="";for(const h of En)o+=`/${Yo(c[h])}`;return o}function _m(c){const o=c.value;return o?[new Be(c.key,o,"constants have been deprecated as of v8")]:[]}function Qn(c){return c instanceof Number||c instanceof String||c instanceof Boolean?c.valueOf():c}function es(c){if(Array.isArray(c))return c.map(es);if(c instanceof Object&&!(c instanceof Number||c instanceof String||c instanceof Boolean)){const o={};for(const h in c)o[h]=es(c[h]);return o}return Qn(c)}function yr(c){const o=c.key,h=c.value,p=c.valueSpec||{},y=c.objectElementValidators||{},v=c.style,w=c.styleSpec,C=c.validateSpec;let A=[];const O=cn(h);if(O!=="object")return[new Be(o,h,`object expected, ${O} found`)];for(const R in h){const N=R.split(".")[0],$=p[N]||p["*"];let q;if(y[N])q=y[N];else if(p[N])q=C;else if(y["*"])q=y["*"];else{if(!p["*"]){A.push(new Be(o,h[R],`unknown property "${R}"`));continue}q=C}A=A.concat(q({key:(o&&`${o}.`)+R,value:h[R],valueSpec:$,style:v,styleSpec:w,object:h,objectKey:R,validateSpec:C},h))}for(const R in p)y[R]||p[R].required&&p[R].default===void 0&&h[R]===void 0&&A.push(new Be(o,h,`missing required property "${R}"`));return A}function Xl(c){const o=c.value,h=c.valueSpec,p=c.style,y=c.styleSpec,v=c.key,w=c.arrayElementValidator||c.validateSpec;if(cn(o)!=="array")return[new Be(v,o,`array expected, ${cn(o)} found`)];if(h.length&&o.length!==h.length)return[new Be(v,o,`array length ${h.length} expected, length ${o.length} found`)];if(h["min-length"]&&o.length<h["min-length"])return[new Be(v,o,`array length at least ${h["min-length"]} expected, length ${o.length} found`)];let C={type:h.value,values:h.values};y.$version<7&&(C.function=h.function),cn(h.value)==="object"&&(C=h.value);let A=[];for(let O=0;O<o.length;O++)A=A.concat(w({array:o,arrayIndex:O,value:o[O],valueSpec:C,validateSpec:c.validateSpec,style:p,styleSpec:y,key:`${v}[${O}]`}));return A}function bd(c){const o=c.key,h=c.value,p=c.valueSpec;let y=cn(h);return y==="number"&&h!=h&&(y="NaN"),y!=="number"?[new Be(o,h,`number expected, ${y} found`)]:"minimum"in p&&h<p.minimum?[new Be(o,h,`${h} is less than the minimum value ${p.minimum}`)]:"maximum"in p&&h>p.maximum?[new Be(o,h,`${h} is greater than the maximum value ${p.maximum}`)]:[]}function vu(c){const o=c.valueSpec,h=Qn(c.value.type);let p,y,v,w={};const C=h!=="categorical"&&c.value.property===void 0,A=!C,O=cn(c.value.stops)==="array"&&cn(c.value.stops[0])==="array"&&cn(c.value.stops[0][0])==="object",R=yr({key:c.key,value:c.value,valueSpec:c.styleSpec.function,validateSpec:c.validateSpec,style:c.style,styleSpec:c.styleSpec,objectElementValidators:{stops:function(q){if(h==="identity")return[new Be(q.key,q.value,'identity function may not have a "stops" property')];let G=[];const X=q.value;return G=G.concat(Xl({key:q.key,value:X,valueSpec:q.valueSpec,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,arrayElementValidator:N})),cn(X)==="array"&&X.length===0&&G.push(new Be(q.key,X,"array must have at least one stop")),G},default:function(q){return q.validateSpec({key:q.key,value:q.value,valueSpec:o,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec})}}});return h==="identity"&&C&&R.push(new Be(c.key,c.value,'missing required property "property"')),h==="identity"||c.value.stops||R.push(new Be(c.key,c.value,'missing required property "stops"')),h==="exponential"&&c.valueSpec.expression&&!md(c.valueSpec)&&R.push(new Be(c.key,c.value,"exponential functions not supported")),c.styleSpec.$version>=8&&(A&&!Na(c.valueSpec)?R.push(new Be(c.key,c.value,"property functions not supported")):C&&!hm(c.valueSpec)&&R.push(new Be(c.key,c.value,"zoom functions not supported"))),h!=="categorical"&&!O||c.value.property!==void 0||R.push(new Be(c.key,c.value,'"property" property is required')),R;function N(q){let G=[];const X=q.value,ie=q.key;if(cn(X)!=="array")return[new Be(ie,X,`array expected, ${cn(X)} found`)];if(X.length!==2)return[new Be(ie,X,`array length 2 expected, length ${X.length} found`)];if(O){if(cn(X[0])!=="object")return[new Be(ie,X,`object expected, ${cn(X[0])} found`)];if(X[0].zoom===void 0)return[new Be(ie,X,"object stop key must have zoom")];if(X[0].value===void 0)return[new Be(ie,X,"object stop key must have value")];if(v&&v>Qn(X[0].zoom))return[new Be(ie,X[0].zoom,"stop zoom values must appear in ascending order")];Qn(X[0].zoom)!==v&&(v=Qn(X[0].zoom),y=void 0,w={}),G=G.concat(yr({key:`${ie}[0]`,value:X[0],valueSpec:{zoom:{}},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec,objectElementValidators:{zoom:bd,value:$}}))}else G=G.concat($({key:`${ie}[0]`,value:X[0],valueSpec:{},validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec},X));return yu(es(X[1]))?G.concat([new Be(`${ie}[1]`,X[1],"expressions are not allowed in function stops.")]):G.concat(q.validateSpec({key:`${ie}[1]`,value:X[1],valueSpec:o,validateSpec:q.validateSpec,style:q.style,styleSpec:q.styleSpec}))}function $(q,G){const X=cn(q.value),ie=Qn(q.value),ae=q.value!==null?q.value:G;if(p){if(X!==p)return[new Be(q.key,ae,`${X} stop domain type must match previous stop domain type ${p}`)]}else p=X;if(X!=="number"&&X!=="string"&&X!=="boolean")return[new Be(q.key,ae,"stop domain value must be a number, string, or boolean")];if(X!=="number"&&h!=="categorical"){let be=`number expected, ${X} found`;return Na(o)&&h===void 0&&(be+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Be(q.key,ae,be)]}return h!=="categorical"||X!=="number"||isFinite(ie)&&Math.floor(ie)===ie?h!=="categorical"&&X==="number"&&y!==void 0&&ie<y?[new Be(q.key,ae,"stop domain values must appear in ascending order")]:(y=ie,h==="categorical"&&ie in w?[new Be(q.key,ae,"stop domain values must be unique")]:(w[ie]=!0,[])):[new Be(q.key,ae,`integer expected, found ${ie}`)]}}function Ua(c){const o=(c.expressionContext==="property"?gd:Fa)(es(c.value),c.valueSpec);if(o.result==="error")return o.value.map(p=>new Be(`${c.key}${p.key}`,c.value,p.message));const h=o.value.expression||o.value._styleExpression.expression;if(c.expressionContext==="property"&&c.propertyKey==="text-font"&&!h.outputDefined())return[new Be(c.key,c.value,`Invalid data expression for "${c.propertyKey}". Output values must be contained as literals within the expression.`)];if(c.expressionContext==="property"&&c.propertyType==="layout"&&!Ra(h))return[new Be(c.key,c.value,'"feature-state" data expressions are not supported with layout properties.')];if(c.expressionContext==="filter"&&!Ra(h))return[new Be(c.key,c.value,'"feature-state" data expressions are not supported with filters.')];if(c.expressionContext&&c.expressionContext.indexOf("cluster")===0){if(!Wl(h,["zoom","feature-state"]))return[new Be(c.key,c.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(c.expressionContext==="cluster-initial"&&!ql(h))return[new Be(c.key,c.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function qs(c){const o=c.key,h=c.value,p=c.valueSpec,y=[];return Array.isArray(p.values)?p.values.indexOf(Qn(h))===-1&&y.push(new Be(o,h,`expected one of [${p.values.join(", ")}], ${JSON.stringify(h)} found`)):Object.keys(p.values).indexOf(Qn(h))===-1&&y.push(new Be(o,h,`expected one of [${Object.keys(p.values).join(", ")}], ${JSON.stringify(h)} found`)),y}function xd(c){return _u(es(c.value))?Ua(Or({},c,{expressionContext:"filter",valueSpec:{value:"boolean"}})):wu(c)}function wu(c){const o=c.value,h=c.key;if(cn(o)!=="array")return[new Be(h,o,`array expected, ${cn(o)} found`)];const p=c.styleSpec;let y,v=[];if(o.length<1)return[new Be(h,o,"filter array must have at least 1 element")];switch(v=v.concat(qs({key:`${h}[0]`,value:o[0],valueSpec:p.filter_operator,style:c.style,styleSpec:c.styleSpec})),Qn(o[0])){case"<":case"<=":case">":case">=":o.length>=2&&Qn(o[1])==="$type"&&v.push(new Be(h,o,`"$type" cannot be use with operator "${o[0]}"`));case"==":case"!=":o.length!==3&&v.push(new Be(h,o,`filter array for operator "${o[0]}" must have 3 elements`));case"in":case"!in":o.length>=2&&(y=cn(o[1]),y!=="string"&&v.push(new Be(`${h}[1]`,o[1],`string expected, ${y} found`)));for(let w=2;w<o.length;w++)y=cn(o[w]),Qn(o[1])==="$type"?v=v.concat(qs({key:`${h}[${w}]`,value:o[w],valueSpec:p.geometry_type,style:c.style,styleSpec:c.styleSpec})):y!=="string"&&y!=="number"&&y!=="boolean"&&v.push(new Be(`${h}[${w}]`,o[w],`string, number, or boolean expected, ${y} found`));break;case"any":case"all":case"none":for(let w=1;w<o.length;w++)v=v.concat(wu({key:`${h}[${w}]`,value:o[w],style:c.style,styleSpec:c.styleSpec}));break;case"has":case"!has":y=cn(o[1]),o.length!==2?v.push(new Be(h,o,`filter array for "${o[0]}" operator must have 2 elements`)):y!=="string"&&v.push(new Be(`${h}[1]`,o[1],`string expected, ${y} found`))}return v}function vd(c,o){const h=c.key,p=c.validateSpec,y=c.style,v=c.styleSpec,w=c.value,C=c.objectKey,A=v[`${o}_${c.layerType}`];if(!A)return[];const O=C.match(/^(.*)-transition$/);if(o==="paint"&&O&&A[O[1]]&&A[O[1]].transition)return p({key:h,value:w,valueSpec:v.transition,style:y,styleSpec:v});const R=c.valueSpec||A[C];if(!R)return[new Be(h,w,`unknown property "${C}"`)];let N;if(cn(w)==="string"&&Na(R)&&!R.tokens&&(N=/^{([^}]+)}$/.exec(w)))return[new Be(h,w,`"${C}" does not support interpolation syntax
49
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(N[1])} }\`.`)];const $=[];return c.layerType==="symbol"&&(C==="text-field"&&y&&!y.glyphs&&$.push(new Be(h,w,'use of "text-field" requires a style "glyphs" property')),C==="text-font"&&fu(es(w))&&Qn(w.type)==="identity"&&$.push(new Be(h,w,'"text-font" does not support identity functions'))),$.concat(p({key:c.key,value:w,valueSpec:R,style:y,styleSpec:v,expressionContext:"property",propertyType:o,propertyKey:C}))}function ku(c){return vd(c,"paint")}function wd(c){return vd(c,"layout")}function kd(c){let o=[];const h=c.value,p=c.key,y=c.style,v=c.styleSpec;h.type||h.ref||o.push(new Be(p,h,'either "type" or "ref" is required'));let w=Qn(h.type);const C=Qn(h.ref);if(h.id){const A=Qn(h.id);for(let O=0;O<c.arrayIndex;O++){const R=y.layers[O];Qn(R.id)===A&&o.push(new Be(p,h.id,`duplicate layer id "${h.id}", previously used at line ${R.id.__line__}`))}}if("ref"in h){let A;["type","source","source-layer","filter","layout"].forEach(O=>{O in h&&o.push(new Be(p,h[O],`"${O}" is prohibited for ref layers`))}),y.layers.forEach(O=>{Qn(O.id)===C&&(A=O)}),A?A.ref?o.push(new Be(p,h.ref,"ref cannot reference another ref layer")):w=Qn(A.type):o.push(new Be(p,h.ref,`ref layer "${C}" not found`))}else if(w!=="background")if(h.source){const A=y.sources&&y.sources[h.source],O=A&&Qn(A.type);A?O==="vector"&&w==="raster"?o.push(new Be(p,h.source,`layer "${h.id}" requires a raster source`)):O!=="raster-dem"&&w==="hillshade"?o.push(new Be(p,h.source,`layer "${h.id}" requires a raster-dem source`)):O==="raster"&&w!=="raster"?o.push(new Be(p,h.source,`layer "${h.id}" requires a vector source`)):O!=="vector"||h["source-layer"]?O==="raster-dem"&&w!=="hillshade"?o.push(new Be(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!h.paint||!h.paint["line-gradient"]||O==="geojson"&&A.lineMetrics||o.push(new Be(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new Be(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new Be(p,h.source,`source "${h.source}" not found`))}else o.push(new Be(p,h,'missing required property "source"'));return o=o.concat(yr({key:p,value:h,valueSpec:v.layer,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,objectElementValidators:{"*":()=>[],type:()=>c.validateSpec({key:`${p}.type`,value:h.type,valueSpec:v.layer.type,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,object:h,objectKey:"type"}),filter:xd,layout:A=>yr({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":O=>wd(Or({layerType:w},O))}}),paint:A=>yr({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":O=>ku(Or({layerType:w},O))}})}})),o}function Xo(c){const o=c.value,h=c.key,p=cn(o);return p!=="string"?[new Be(h,o,`string expected, ${p} found`)]:[]}const Su={promoteId:function({key:c,value:o}){if(cn(o)==="string")return Xo({key:c,value:o});{const h=[];for(const p in o)h.push(...Xo({key:`${c}.${p}`,value:o[p]}));return h}}};function Kl(c){const o=c.value,h=c.key,p=c.styleSpec,y=c.style,v=c.validateSpec;if(!o.type)return[new Be(h,o,'"type" is required')];const w=Qn(o.type);let C;switch(w){case"vector":case"raster":return C=yr({key:h,value:o,valueSpec:p[`source_${w.replace("-","_")}`],style:c.style,styleSpec:p,objectElementValidators:Su,validateSpec:v}),C;case"raster-dem":return C=function(A){var O;const R=(O=A.sourceName)!==null&&O!==void 0?O:"",N=A.value,$=A.styleSpec,q=$.source_raster_dem,G=A.style;let X=[];const ie=cn(N);if(N===void 0)return X;if(ie!=="object")return X.push(new Be("source_raster_dem",N,`object expected, ${ie} found`)),X;const ae=Qn(N.encoding)==="custom",be=["redFactor","greenFactor","blueFactor","baseShift"],pe=A.value.encoding?`"${A.value.encoding}"`:"Default";for(const ye in N)!ae&&be.includes(ye)?X.push(new Be(ye,N[ye],`In "${R}": "${ye}" is only valid when "encoding" is set to "custom". ${pe} encoding found`)):q[ye]?X=X.concat(A.validateSpec({key:ye,value:N[ye],valueSpec:q[ye],validateSpec:A.validateSpec,style:G,styleSpec:$})):X.push(new Be(ye,N[ye],`unknown property "${ye}"`));return X}({sourceName:h,value:o,style:c.style,styleSpec:p,validateSpec:v}),C;case"geojson":if(C=yr({key:h,value:o,valueSpec:p.source_geojson,style:y,styleSpec:p,validateSpec:v,objectElementValidators:Su}),o.cluster)for(const A in o.clusterProperties){const[O,R]=o.clusterProperties[A],N=typeof O=="string"?[O,["accumulated"],["get",A]]:O;C.push(...Ua({key:`${h}.${A}.map`,value:R,validateSpec:v,expressionContext:"cluster-map"})),C.push(...Ua({key:`${h}.${A}.reduce`,value:N,validateSpec:v,expressionContext:"cluster-reduce"}))}return C;case"video":return yr({key:h,value:o,valueSpec:p.source_video,style:y,validateSpec:v,styleSpec:p});case"image":return yr({key:h,value:o,valueSpec:p.source_image,style:y,validateSpec:v,styleSpec:p});case"canvas":return[new Be(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qs({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:v,styleSpec:p})}}function Sd(c){const o=c.value,h=c.styleSpec,p=h.light,y=c.style;let v=[];const w=cn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new Be("light",o,`object expected, ${w} found`)]),v;for(const C in o){const A=C.match(/^(.*)-transition$/);v=v.concat(A&&p[A[1]]&&p[A[1]].transition?c.validateSpec({key:C,value:o[C],valueSpec:h.transition,validateSpec:c.validateSpec,style:y,styleSpec:h}):p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],validateSpec:c.validateSpec,style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)])}return v}function Ed(c){const o=c.value,h=c.styleSpec,p=h.sky,y=c.style,v=cn(o);if(o===void 0)return[];if(v!=="object")return[new Be("sky",o,`object expected, ${v} found`)];let w=[];for(const C in o)w=w.concat(p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)]);return w}function Cd(c){const o=c.value,h=c.styleSpec,p=h.terrain,y=c.style;let v=[];const w=cn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new Be("terrain",o,`object expected, ${w} found`)]),v;for(const C in o)v=v.concat(p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],validateSpec:c.validateSpec,style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)]);return v}function Td(c){let o=[];const h=c.value,p=c.key;if(Array.isArray(h)){const y=[],v=[];for(const w in h)h[w].id&&y.includes(h[w].id)&&o.push(new Be(p,h,`all the sprites' ids must be unique, but ${h[w].id} is duplicated`)),y.push(h[w].id),h[w].url&&v.includes(h[w].url)&&o.push(new Be(p,h,`all the sprites' URLs must be unique, but ${h[w].url} is duplicated`)),v.push(h[w].url),o=o.concat(yr({key:`${p}[${w}]`,value:h[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:c.validateSpec}));return o}return Xo({key:p,value:h})}const Eu={"*":()=>[],array:Xl,boolean:function(c){const o=c.value,h=c.key,p=cn(o);return p!=="boolean"?[new Be(h,o,`boolean expected, ${p} found`)]:[]},number:bd,color:function(c){const o=c.key,h=c.value,p=cn(h);return p!=="string"?[new Be(o,h,`color expected, ${p} found`)]:vn.parse(String(h))?[]:[new Be(o,h,`color expected, "${h}" found`)]},constants:_m,enum:qs,filter:xd,function:vu,layer:kd,object:yr,source:Kl,light:Sd,sky:Ed,terrain:Cd,projection:function(c){const o=c.value,h=c.styleSpec,p=h.projection,y=c.style,v=cn(o);if(o===void 0)return[];if(v!=="object")return[new Be("projection",o,`object expected, ${v} found`)];let w=[];for(const C in o)w=w.concat(p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)]);return w},string:Xo,formatted:function(c){return Xo(c).length===0?[]:Ua(c)},resolvedImage:function(c){return Xo(c).length===0?[]:Ua(c)},padding:function(c){const o=c.key,h=c.value;if(cn(h)==="array"){if(h.length<1||h.length>4)return[new Be(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let y=[];for(let v=0;v<h.length;v++)y=y.concat(c.validateSpec({key:`${o}[${v}]`,value:h[v],validateSpec:c.validateSpec,valueSpec:p}));return y}return bd({key:o,value:h,valueSpec:{}})},variableAnchorOffsetCollection:function(c){const o=c.key,h=c.value,p=cn(h),y=c.styleSpec;if(p!=="array"||h.length<1||h.length%2!=0)return[new Be(o,h,"variableAnchorOffsetCollection requires a non-empty array of even length")];let v=[];for(let w=0;w<h.length;w+=2)v=v.concat(qs({key:`${o}[${w}]`,value:h[w],valueSpec:y.layout_symbol["text-anchor"]})),v=v.concat(Xl({key:`${o}[${w+1}]`,value:h[w+1],valueSpec:{length:2,value:"number"},validateSpec:c.validateSpec,style:c.style,styleSpec:y}));return v},sprite:Td};function Ha(c){const o=c.value,h=c.valueSpec,p=c.styleSpec;return c.validateSpec=Ha,h.expression&&fu(Qn(o))?vu(c):h.expression&&yu(es(o))?Ua(c):h.type&&Eu[h.type]?Eu[h.type](c):yr(Or({},c,{valueSpec:h.type?p[h.type]:h}))}function bm(c){const o=c.value,h=c.key,p=Xo(c);return p.length||(o.indexOf("{fontstack}")===-1&&p.push(new Be(h,o,'"glyphs" url must include a "{fontstack}" token')),o.indexOf("{range}")===-1&&p.push(new Be(h,o,'"glyphs" url must include a "{range}" token'))),p}function Nr(c,o=we){let h=[];return h=h.concat(Ha({key:"",value:c,valueSpec:o.$root,styleSpec:o,style:c,validateSpec:Ha,objectElementValidators:{glyphs:bm,"*":()=>[]}})),c.constants&&(h=h.concat(_m({key:"constants",value:c.constants,style:c,styleSpec:o,validateSpec:Ha}))),Md(h)}function As(c){return function(o){return c({...o,validateSpec:Ha})}}function Md(c){return[].concat(c).sort((o,h)=>o.line-h.line)}function ts(c){return function(...o){return Md(c.apply(this,o))}}Nr.source=ts(As(Kl)),Nr.sprite=ts(As(Td)),Nr.glyphs=ts(As(bm)),Nr.light=ts(As(Sd)),Nr.sky=ts(As(Ed)),Nr.terrain=ts(As(Cd)),Nr.layer=ts(As(kd)),Nr.filter=ts(As(xd)),Nr.paintProperty=ts(As(ku)),Nr.layoutProperty=ts(As(wd));const Ko=Nr,p_=Ko.light,f_=Ko.sky,xm=Ko.paintProperty,vm=Ko.layoutProperty;function Ad(c,o){let h=!1;if(o&&o.length)for(const p of o)c.fire(new At(new Error(p.message))),h=!0;return h}class qa{constructor(o,h,p){const y=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(h=w[1])+2*(p=w[2]);for(let A=0;A<this.d*this.d;A++){const O=w[3+A],R=w[3+A+1];y.push(O===R?null:w.subarray(O,R))}const C=w[3+y.length+1];this.keys=w.subarray(w[3+y.length],C),this.bboxes=w.subarray(C),this.insert=this._insertReadonly}else{this.d=h+2*p;for(let w=0;w<this.d*this.d;w++)y.push([]);this.keys=[],this.bboxes=[]}this.n=h,this.extent=o,this.padding=p,this.scale=h/o,this.uid=0;const v=p/h*o;this.min=-v,this.max=o+v}insert(o,h,p,y,v){this._forEachCell(h,p,y,v,this._insertCell,this.uid++,void 0,void 0),this.keys.push(o),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(y),this.bboxes.push(v)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(o,h,p,y,v,w){this.cells[v].push(w)}query(o,h,p,y,v){const w=this.min,C=this.max;if(o<=w&&h<=w&&C<=p&&C<=y&&!v)return Array.prototype.slice.call(this.keys);{const A=[];return this._forEachCell(o,h,p,y,this._queryCell,A,{},v),A}}_queryCell(o,h,p,y,v,w,C,A){const O=this.cells[v];if(O!==null){const R=this.keys,N=this.bboxes;for(let $=0;$<O.length;$++){const q=O[$];if(C[q]===void 0){const G=4*q;(A?A(N[G+0],N[G+1],N[G+2],N[G+3]):o<=N[G+2]&&h<=N[G+3]&&p>=N[G+0]&&y>=N[G+1])?(C[q]=!0,w.push(R[q])):C[q]=!1}}}}_forEachCell(o,h,p,y,v,w,C,A){const O=this._convertToCellCoord(o),R=this._convertToCellCoord(h),N=this._convertToCellCoord(p),$=this._convertToCellCoord(y);for(let q=O;q<=N;q++)for(let G=R;G<=$;G++){const X=this.d*G+q;if((!A||A(this._convertFromCellCoord(q),this._convertFromCellCoord(G),this._convertFromCellCoord(q+1),this._convertFromCellCoord(G+1)))&&v.call(this,o,h,p,y,X,w,C,A))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,h=3+this.cells.length+1+1;let p=0;for(let w=0;w<this.cells.length;w++)p+=this.cells[w].length;const y=new Int32Array(h+p+this.keys.length+this.bboxes.length);y[0]=this.extent,y[1]=this.n,y[2]=this.padding;let v=h;for(let w=0;w<o.length;w++){const C=o[w];y[3+w]=v,y.set(C,v),v+=C.length}return y[3+o.length]=v,y.set(this.keys,v),v+=this.keys.length,y[3+o.length+1]=v,y.set(this.bboxes,v),v+=this.bboxes.length,y.buffer}static serialize(o,h){const p=o.toArrayBuffer();return h&&h.push(p),{buffer:p}}static deserialize(o){return new qa(o.buffer)}}const Br={};function ot(c,o,h={}){if(Br[c])throw new Error(`${c} is already registered.`);Object.defineProperty(o,"_classRegistryKey",{value:c,writeable:!1}),Br[c]={klass:o,omit:h.omit||[],shallow:h.shallow||[]}}ot("Object",Object),ot("TransferableGridIndex",qa),ot("Color",vn),ot("Error",Error),ot("AJAXError",Ce),ot("ResolvedImage",gr),ot("StylePropertyFunction",ja),ot("StyleExpression",gu,{omit:["_evaluator"]}),ot("ZoomDependentExpression",$a),ot("ZoomConstantExpression",Va),ot("CompoundExpression",Lr,{omit:["_evaluate"]});for(const c in za)za[c]._classRegistryKey||ot(`Expression_${c}`,za[c]);function Cu(c){return c&&typeof ArrayBuffer<"u"&&(c instanceof ArrayBuffer||c.constructor&&c.constructor.name==="ArrayBuffer")}function Pd(c){return c.$name||c.constructor._classRegistryKey}function wm(c){return!function(o){if(o===null||typeof o!="object")return!1;const h=Pd(o);return!(!h||h==="Object")}(c)&&(c==null||typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c instanceof Boolean||c instanceof Number||c instanceof String||c instanceof Date||c instanceof RegExp||c instanceof Blob||c instanceof Error||Cu(c)||jt(c)||ArrayBuffer.isView(c)||c instanceof ImageData)}function Wa(c,o){if(wm(c))return(Cu(c)||jt(c))&&o&&o.push(c),ArrayBuffer.isView(c)&&o&&o.push(c.buffer),c instanceof ImageData&&o&&o.push(c.data.buffer),c;if(Array.isArray(c)){const v=[];for(const w of c)v.push(Wa(w,o));return v}if(typeof c!="object")throw new Error("can't serialize object of type "+typeof c);const h=Pd(c);if(!h)throw new Error(`can't serialize object of unregistered class ${c.constructor.name}`);if(!Br[h])throw new Error(`${h} is not registered.`);const{klass:p}=Br[h],y=p.serialize?p.serialize(c,o):{};if(p.serialize){if(o&&y===o[o.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const v in c){if(!c.hasOwnProperty(v)||Br[h].omit.indexOf(v)>=0)continue;const w=c[v];y[v]=Br[h].shallow.indexOf(v)>=0?w:Wa(w,o)}c instanceof Error&&(y.message=c.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(y.$name=h),y}function Ga(c){if(wm(c))return c;if(Array.isArray(c))return c.map(Ga);if(typeof c!="object")throw new Error("can't deserialize object of type "+typeof c);const o=Pd(c)||"Object";if(!Br[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=Br[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(c);const p=Object.create(h.prototype);for(const y of Object.keys(c)){if(y==="$name")continue;const v=c[y];p[y]=Br[o].shallow.indexOf(y)>=0?v:Ga(v)}return p}class Id{constructor(){this.first=!0}update(o,h){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoom<p&&(this.lastIntegerZoom=p,this.lastIntegerZoomTime=h),o!==this.lastZoom&&(this.lastZoom=o,this.lastFloorZoom=p,!0))}}const Jt={"Latin-1 Supplement":c=>c>=128&&c<=255,"Hangul Jamo":c=>c>=4352&&c<=4607,Khmer:c=>c>=6016&&c<=6143,"General Punctuation":c=>c>=8192&&c<=8303,"Letterlike Symbols":c=>c>=8448&&c<=8527,"Number Forms":c=>c>=8528&&c<=8591,"Miscellaneous Technical":c=>c>=8960&&c<=9215,"Control Pictures":c=>c>=9216&&c<=9279,"Optical Character Recognition":c=>c>=9280&&c<=9311,"Enclosed Alphanumerics":c=>c>=9312&&c<=9471,"Geometric Shapes":c=>c>=9632&&c<=9727,"Miscellaneous Symbols":c=>c>=9728&&c<=9983,"Miscellaneous Symbols and Arrows":c=>c>=11008&&c<=11263,"Ideographic Description Characters":c=>c>=12272&&c<=12287,"CJK Symbols and Punctuation":c=>c>=12288&&c<=12351,Katakana:c=>c>=12448&&c<=12543,Kanbun:c=>c>=12688&&c<=12703,"CJK Strokes":c=>c>=12736&&c<=12783,"Enclosed CJK Letters and Months":c=>c>=12800&&c<=13055,"CJK Compatibility":c=>c>=13056&&c<=13311,"Yijing Hexagram Symbols":c=>c>=19904&&c<=19967,"Private Use Area":c=>c>=57344&&c<=63743,"Vertical Forms":c=>c>=65040&&c<=65055,"CJK Compatibility Forms":c=>c>=65072&&c<=65103,"Small Form Variants":c=>c>=65104&&c<=65135,"Halfwidth and Fullwidth Forms":c=>c>=65280&&c<=65519};function Dd(c){for(const o of c)if(zd(o.charCodeAt(0)))return!0;return!1}function m_(c){for(const o of c)if(!Za(o.charCodeAt(0)))return!1;return!0}function Od(c){const o=c.map(h=>{try{return new RegExp(`\\p{sc=${h}}`,"u").source}catch{return null}}).filter(h=>h);return new RegExp(o.join("|"),"u")}const g_=Od(["Arab","Dupl","Mong","Ougr","Syrc"]);function Za(c){return!g_.test(String.fromCodePoint(c))}const km=Od(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function zd(c){return!(c!==746&&c!==747&&(c<4352||!(Jt["CJK Compatibility Forms"](c)&&!(c>=65097&&c<=65103)||Jt["CJK Compatibility"](c)||Jt["CJK Strokes"](c)||!(!Jt["CJK Symbols and Punctuation"](c)||c>=12296&&c<=12305||c>=12308&&c<=12319||c===12336)||Jt["Enclosed CJK Letters and Months"](c)||Jt["Ideographic Description Characters"](c)||Jt.Kanbun(c)||Jt.Katakana(c)&&c!==12540||!(!Jt["Halfwidth and Fullwidth Forms"](c)||c===65288||c===65289||c===65293||c>=65306&&c<=65310||c===65339||c===65341||c===65343||c>=65371&&c<=65503||c===65507||c>=65512&&c<=65519)||!(!Jt["Small Form Variants"](c)||c>=65112&&c<=65118||c>=65123&&c<=65126)||Jt["Vertical Forms"](c)||Jt["Yijing Hexagram Symbols"](c)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(c))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(c))||km.test(String.fromCodePoint(c)))))}function Sm(c){return!(zd(c)||function(o){return!!(Jt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||Jt["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||Jt["Letterlike Symbols"](o)||Jt["Number Forms"](o)||Jt["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||Jt["Control Pictures"](o)&&o!==9251||Jt["Optical Character Recognition"](o)||Jt["Enclosed Alphanumerics"](o)||Jt["Geometric Shapes"](o)||Jt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||Jt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||Jt["CJK Symbols and Punctuation"](o)||Jt.Katakana(o)||Jt["Private Use Area"](o)||Jt["CJK Compatibility Forms"](o)||Jt["Small Form Variants"](o)||Jt["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(c))}const y_=Od(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Rd(c){return y_.test(String.fromCodePoint(c))}function __(c,o){return!(!o&&Rd(c)||c>=2304&&c<=3583||c>=3840&&c<=4255||Jt.Khmer(c))}function b_(c){for(const o of c)if(Rd(o.charCodeAt(0)))return!0;return!1}const _r=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(c){this.pluginStatus=c.pluginStatus,this.pluginURL=c.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(c){this.applyArabicShaping=c.applyArabicShaping,this.processBidirectionalText=c.processBidirectionalText,this.processStyledBidirectionalText=c.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Ln{constructor(o,h){this.zoom=o,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Id,this.transition={})}isSupportedScript(o){return function(h,p){for(const y of h)if(!__(y.charCodeAt(0),p))return!1;return!0}(o,_r.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,h=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Ya{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,y){if(fu(p))return new ja(p,y);if(yu(p)){const v=gd(p,y);if(v.result==="error")throw new Error(v.value.map(w=>`${w.key}: ${w.message}`).join(", "));return v.value}{let v=p;return y.type==="color"&&typeof p=="string"?v=vn.parse(p):y.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(v=Rr.parse(p)):v=mr.parse(p),{kind:"constant",evaluate:()=>v}}}(h===void 0?o.specification.default:h,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,h,p){return this.property.possiblyEvaluate(this,o,h,p)}}class Tu{constructor(o){this.property=o,this.value=new Ya(o,void 0)}transitioned(o,h){return new Em(this.property,this.value,h,Me({},o.transition,this.transition),o.now)}untransitioned(){return new Em(this.property,this.value,null,{},0)}}class Mu{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return it(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Tu(this._values[o].property)),this._values[o].value=new Ya(this._values[o].property,h===null?void 0:it(h))}getTransition(o){return it(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Tu(this._values[o].property)),this._values[o].transition=it(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const y=this.getTransition(h);y!==void 0&&(o[`${h}-transition`]=y)}return o}transitioned(o,h){const p=new Jl(this._properties);for(const y of Object.keys(this._values))p._values[y]=this._values[y].transitioned(o,h._values[y]);return p}untransitioned(){const o=new Jl(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Em{constructor(o,h,p,y,v){this.property=o,this.value=h,this.begin=v+y.delay||0,this.end=this.begin+y.duration||0,o.specification.transition&&(y.delay||y.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const y=o.now||0,v=this.value.possiblyEvaluate(o,h,p),w=this.prior;if(w){if(y>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(y<this.begin)return w.possiblyEvaluate(o,h,p);{const C=(y-this.begin)/(this.end-this.begin);return this.property.interpolate(w.possiblyEvaluate(o,h,p),v,function(A){if(A<=0)return 0;if(A>=1)return 1;const O=A*A,R=O*A;return 4*(A<.5?R:3*(A-O)+R-.75)}(C))}}return v}}class Jl{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const y=new ec(this._properties);for(const v of Object.keys(this._values))y._values[v]=this._values[v].possiblyEvaluate(o,h,p);return y}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Ql{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return it(this._values[o].value)}setValue(o,h){this._values[o]=new Ya(this._values[o].property,h===null?void 0:it(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const y=new ec(this._properties);for(const v of Object.keys(this._values))y._values[v]=this._values[v].possiblyEvaluate(o,h,p);return y}}class Ps{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,y){return this.property.evaluate(this.value,this.parameters,o,h,p,y)}}class ec{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class dt{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const y=nr[this.specification.type];return y?y(o,h,p):o}}class Et{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,y){return new Ps(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,y)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new Ps(this,{kind:"constant",value:void 0},o.parameters);const y=nr[this.specification.type];if(y){const v=y(o.value.value,h.value.value,p);return new Ps(this,{kind:"constant",value:v},o.parameters)}return o}evaluate(o,h,p,y,v,w){return o.kind==="constant"?o.value:o.evaluate(h,p,y,v,w)}}class Au extends Et{possiblyEvaluate(o,h,p,y){if(o.value===void 0)return new Ps(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const v=o.expression.evaluate(h,null,{},p,y),w=o.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,C=this._calculate(w,w,w,h);return new Ps(this,{kind:"constant",value:C},h)}if(o.expression.kind==="camera"){const v=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new Ps(this,{kind:"constant",value:v},h)}return new Ps(this,o.expression,h)}evaluate(o,h,p,y,v,w){if(o.kind==="source"){const C=o.evaluate(h,p,y,v,w);return this._calculate(C,C,C,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,y),o.evaluate({zoom:Math.floor(h.zoom)},p,y),o.evaluate({zoom:Math.floor(h.zoom)+1},p,y),h):o.value}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Pu{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){if(o.value!==void 0){if(o.expression.kind==="constant"){const v=o.expression.evaluate(h,null,{},p,y);return this._calculate(v,v,v,h)}return this._calculate(o.expression.evaluate(new Ln(Math.floor(h.zoom-1),h)),o.expression.evaluate(new Ln(Math.floor(h.zoom),h)),o.expression.evaluate(new Ln(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Ld{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){return!!o.expression.evaluate(h,null,{},p,y)}interpolate(){return!1}}class x{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const y=this.defaultPropertyValues[h]=new Ya(p,void 0),v=this.defaultTransitionablePropertyValues[h]=new Tu(p);this.defaultTransitioningPropertyValues[h]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=y.possiblyEvaluate({})}}}ot("DataDrivenProperty",Et),ot("DataConstantProperty",dt),ot("CrossFadedDataDrivenProperty",Au),ot("CrossFadedProperty",Pu),ot("ColorRampProperty",Ld);const s="-transition";class d extends ln{constructor(o,h){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),h.layout&&(this._unevaluatedLayout=new Ql(h.layout)),h.paint)){this._transitionablePaint=new Mu(h.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ec(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,h,p={}){h!=null&&this._validate(vm,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(s)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(xm,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(s))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const y=this._transitionablePaint._values[o],v=y.property.specification["property-type"]==="cross-faded-data-driven",w=y.value.isDataDriven(),C=y.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const A=this._transitionablePaint._values[o].value;return A.isDataDriven()||w||v||this._handleOverridablePaintPropertyUpdate(o,C,A)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,p){return!1}isHidden(o){return!!(this.minzoom&&o<this.minzoom)||!!(this.maxzoom&&o>=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}serialize(){const o={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&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Ye(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,y,v={}){return(!v||v.validate!==!1)&&Ad(this,o.call(Ko,{key:h,layerType:this.type,objectKey:p,value:y,styleSpec:we,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const h=this.paint.get(o);if(h instanceof Ps&&Na(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const f={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class m{constructor(o,h){this._structArray=o,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class b{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,h){return o._trim(),h&&(o.isTransferred=!0,h.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const h=Object.create(this.prototype);return h.arrayBuffer=o.arrayBuffer,h.length=o.length,h.capacity=o.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function M(c,o=1){let h=0,p=0;return{members:c.map(y=>{const v=f[y.type].BYTES_PER_ELEMENT,w=h=P(h,Math.max(o,v)),C=y.components||1;return p=Math.max(p,v),h+=v*C,{name:y.name,type:y.type,components:C,offset:w}}),size:P(h,Math.max(p,o)),alignment:o}}function P(c,o){return Math.ceil(c/o)*o}class D extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.int16[y+0]=h,this.int16[y+1]=p,o}}D.prototype.bytesPerElement=4,ot("StructArrayLayout2i4",D);class L extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.int16[v+0]=h,this.int16[v+1]=p,this.int16[v+2]=y,o}}L.prototype.bytesPerElement=6,ot("StructArrayLayout3i6",L);class B extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const v=this.length;return this.resize(v+1),this.emplace(v,o,h,p,y)}emplace(o,h,p,y,v){const w=4*o;return this.int16[w+0]=h,this.int16[w+1]=p,this.int16[w+2]=y,this.int16[w+3]=v,o}}B.prototype.bytesPerElement=8,ot("StructArrayLayout4i8",B);class F extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=6*o;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=y,this.int16[A+3]=v,this.int16[A+4]=w,this.int16[A+5]=C,o}}F.prototype.bytesPerElement=12,ot("StructArrayLayout2i4i12",F);class W extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=4*o,O=8*o;return this.int16[A+0]=h,this.int16[A+1]=p,this.uint8[O+4]=y,this.uint8[O+5]=v,this.uint8[O+6]=w,this.uint8[O+7]=C,o}}W.prototype.bytesPerElement=8,ot("StructArrayLayout2i4ub8",W);class K extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.float32[y+0]=h,this.float32[y+1]=p,o}}K.prototype.bytesPerElement=8,ot("StructArrayLayout2f8",K);class Q extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w,C,A,O,R){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,y,v,w,C,A,O,R)}emplace(o,h,p,y,v,w,C,A,O,R,N){const $=10*o;return this.uint16[$+0]=h,this.uint16[$+1]=p,this.uint16[$+2]=y,this.uint16[$+3]=v,this.uint16[$+4]=w,this.uint16[$+5]=C,this.uint16[$+6]=A,this.uint16[$+7]=O,this.uint16[$+8]=R,this.uint16[$+9]=N,o}}Q.prototype.bytesPerElement=20,ot("StructArrayLayout10ui20",Q);class re extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w,C,A,O,R,N,$){const q=this.length;return this.resize(q+1),this.emplace(q,o,h,p,y,v,w,C,A,O,R,N,$)}emplace(o,h,p,y,v,w,C,A,O,R,N,$,q){const G=12*o;return this.int16[G+0]=h,this.int16[G+1]=p,this.int16[G+2]=y,this.int16[G+3]=v,this.uint16[G+4]=w,this.uint16[G+5]=C,this.uint16[G+6]=A,this.uint16[G+7]=O,this.int16[G+8]=R,this.int16[G+9]=N,this.int16[G+10]=$,this.int16[G+11]=q,o}}re.prototype.bytesPerElement=24,ot("StructArrayLayout4i4ui4i24",re);class le extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.float32[v+0]=h,this.float32[v+1]=p,this.float32[v+2]=y,o}}le.prototype.bytesPerElement=12,ot("StructArrayLayout3f12",le);class ce extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}ce.prototype.bytesPerElement=4,ot("StructArrayLayout1ul4",ce);class he extends b{_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(o,h,p,y,v,w,C,A,O){const R=this.length;return this.resize(R+1),this.emplace(R,o,h,p,y,v,w,C,A,O)}emplace(o,h,p,y,v,w,C,A,O,R){const N=10*o,$=5*o;return this.int16[N+0]=h,this.int16[N+1]=p,this.int16[N+2]=y,this.int16[N+3]=v,this.int16[N+4]=w,this.int16[N+5]=C,this.uint32[$+3]=A,this.uint16[N+8]=O,this.uint16[N+9]=R,o}}he.prototype.bytesPerElement=20,ot("StructArrayLayout6i1ul2ui20",he);class te extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=6*o;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=y,this.int16[A+3]=v,this.int16[A+4]=w,this.int16[A+5]=C,o}}te.prototype.bytesPerElement=12,ot("StructArrayLayout2i2i2i12",te);class me extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v){const w=this.length;return this.resize(w+1),this.emplace(w,o,h,p,y,v)}emplace(o,h,p,y,v,w){const C=4*o,A=8*o;return this.float32[C+0]=h,this.float32[C+1]=p,this.float32[C+2]=y,this.int16[A+6]=v,this.int16[A+7]=w,o}}me.prototype.bytesPerElement=16,ot("StructArrayLayout2f1f2i16",me);class ge extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=16*o,O=4*o,R=8*o;return this.uint8[A+0]=h,this.uint8[A+1]=p,this.float32[O+1]=y,this.float32[O+2]=v,this.int16[R+6]=w,this.int16[R+7]=C,o}}ge.prototype.bytesPerElement=16,ot("StructArrayLayout2ub2f2i16",ge);class xe extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.uint16[v+0]=h,this.uint16[v+1]=p,this.uint16[v+2]=y,o}}xe.prototype.bytesPerElement=6,ot("StructArrayLayout3ui6",xe);class Oe extends b{_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(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae){const be=this.length;return this.resize(be+1),this.emplace(be,o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae)}emplace(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be){const pe=24*o,ye=12*o,Ee=48*o;return this.int16[pe+0]=h,this.int16[pe+1]=p,this.uint16[pe+2]=y,this.uint16[pe+3]=v,this.uint32[ye+2]=w,this.uint32[ye+3]=C,this.uint32[ye+4]=A,this.uint16[pe+10]=O,this.uint16[pe+11]=R,this.uint16[pe+12]=N,this.float32[ye+7]=$,this.float32[ye+8]=q,this.uint8[Ee+36]=G,this.uint8[Ee+37]=X,this.uint8[Ee+38]=ie,this.uint32[ye+10]=ae,this.int16[pe+22]=be,o}}Oe.prototype.bytesPerElement=48,ot("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Oe);class Fe extends b{_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(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be,pe,ye,Ee,Ne,tt,St,Qe,Ze,mt,ct){const rt=this.length;return this.resize(rt+1),this.emplace(rt,o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be,pe,ye,Ee,Ne,tt,St,Qe,Ze,mt,ct)}emplace(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be,pe,ye,Ee,Ne,tt,St,Qe,Ze,mt,ct,rt){const De=32*o,yt=16*o;return this.int16[De+0]=h,this.int16[De+1]=p,this.int16[De+2]=y,this.int16[De+3]=v,this.int16[De+4]=w,this.int16[De+5]=C,this.int16[De+6]=A,this.int16[De+7]=O,this.uint16[De+8]=R,this.uint16[De+9]=N,this.uint16[De+10]=$,this.uint16[De+11]=q,this.uint16[De+12]=G,this.uint16[De+13]=X,this.uint16[De+14]=ie,this.uint16[De+15]=ae,this.uint16[De+16]=be,this.uint16[De+17]=pe,this.uint16[De+18]=ye,this.uint16[De+19]=Ee,this.uint16[De+20]=Ne,this.uint16[De+21]=tt,this.uint16[De+22]=St,this.uint32[yt+12]=Qe,this.float32[yt+13]=Ze,this.float32[yt+14]=mt,this.uint16[De+30]=ct,this.uint16[De+31]=rt,o}}Fe.prototype.bytesPerElement=64,ot("StructArrayLayout8i15ui1ul2f2ui64",Fe);class Ke extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.float32[1*o+0]=h,o}}Ke.prototype.bytesPerElement=4,ot("StructArrayLayout1f4",Ke);class nt extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.uint16[6*o+0]=h,this.float32[v+1]=p,this.float32[v+2]=y,o}}nt.prototype.bytesPerElement=12,ot("StructArrayLayout1ui2f12",nt);class We extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=4*o;return this.uint32[2*o+0]=h,this.uint16[v+2]=p,this.uint16[v+3]=y,o}}We.prototype.bytesPerElement=8,ot("StructArrayLayout1ul2ui8",We);class He extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.uint16[y+0]=h,this.uint16[y+1]=p,o}}He.prototype.bytesPerElement=4,ot("StructArrayLayout2ui4",He);class pt extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint16[1*o+0]=h,o}}pt.prototype.bytesPerElement=2,ot("StructArrayLayout1ui2",pt);class Ot extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const v=this.length;return this.resize(v+1),this.emplace(v,o,h,p,y)}emplace(o,h,p,y,v){const w=4*o;return this.float32[w+0]=h,this.float32[w+1]=p,this.float32[w+2]=y,this.float32[w+3]=v,o}}Ot.prototype.bytesPerElement=16,ot("StructArrayLayout4f16",Ot);class Ge extends m{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 E(this.anchorPointX,this.anchorPointY)}}Ge.prototype.size=20;class et extends he{get(o){return new Ge(this,o)}}ot("CollisionBoxArray",et);class Pt extends m{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(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Pt.prototype.size=48;class Nn extends Oe{get(o){return new Pt(this,o)}}ot("PlacedSymbolArray",Nn);class Ft extends m{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(o){this._structArray.uint32[this._pos4+12]=o}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]}}Ft.prototype.size=64;class Yt extends Fe{get(o){return new Ft(this,o)}}ot("SymbolInstanceArray",Yt);class Bn extends Ke{getoffsetX(o){return this.float32[1*o+0]}}ot("GlyphOffsetArray",Bn);class Ii extends L{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}ot("SymbolLineVertexArray",Ii);class ns extends m{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]}}ns.prototype.size=12;class Fn extends nt{get(o){return new ns(this,o)}}ot("TextAnchorOffsetArray",Fn);class rr extends m{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]}}rr.prototype.size=8;class qi extends We{get(o){return new rr(this,o)}}ot("FeatureIndexArray",qi);class Di extends D{}class Wi extends D{}class Is extends D{}class Xa extends F{}class Iu extends W{}class Ka extends K{}class Fr extends Q{}class Du extends re{}class Nd extends le{}class Vr extends ce{}class $r extends te{}class po extends ge{}class is extends xe{}class ki extends He{}const Oi=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:br}=Oi;class Qt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,y){let v=this.segments[this.segments.length-1];return o>Qt.MAX_VERTEX_ARRAY_LENGTH&&ht(`Max vertices per segment is ${Qt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>Qt.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==y)&&(v={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},y!==void 0&&(v.sortKey=y),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,y){return new Qt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:y,vaos:{},sortKey:0}])}}function Jo(c,o){return 256*(c=Ae(Math.floor(c),0,255))+Ae(Math.floor(o),0,255)}Qt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ot("SegmentVector",Qt);const Ja=M([{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 Qa={exports:{}},Cm={exports:{}};Cm.exports=function(c,o){var h,p,y,v,w,C,A,O;for(p=c.length-(h=3&c.length),y=o,w=3432918353,C=461845907,O=0;O<p;)A=255&c.charCodeAt(O)|(255&c.charCodeAt(++O))<<8|(255&c.charCodeAt(++O))<<16|(255&c.charCodeAt(++O))<<24,++O,y=27492+(65535&(v=5*(65535&(y=(y^=A=(65535&(A=(A=(65535&A)*w+(((A>>>16)*w&65535)<<16)&4294967295)<<15|A>>>17))*C+(((A>>>16)*C&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(A=0,h){case 3:A^=(255&c.charCodeAt(O+2))<<16;case 2:A^=(255&c.charCodeAt(O+1))<<8;case 1:y^=A=(65535&(A=(A=(65535&(A^=255&c.charCodeAt(O)))*w+(((A>>>16)*w&65535)<<16)&4294967295)<<15|A>>>17))*C+(((A>>>16)*C&65535)<<16)&4294967295}return y^=c.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var x_=Cm.exports,Tm={exports:{}};Tm.exports=function(c,o){for(var h,p=c.length,y=o^p,v=0;p>=4;)h=1540483477*(65535&(h=255&c.charCodeAt(v)|(255&c.charCodeAt(++v))<<8|(255&c.charCodeAt(++v))<<16|(255&c.charCodeAt(++v))<<24))+((1540483477*(h>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++v;switch(p){case 3:y^=(255&c.charCodeAt(v+2))<<16;case 2:y^=(255&c.charCodeAt(v+1))<<8;case 1:y=1540483477*(65535&(y^=255&c.charCodeAt(v)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var fo=x_,Mm=Tm.exports;Qa.exports=fo,Qa.exports.murmur3=fo,Qa.exports.murmur2=Mm;var Ou=g(Qa.exports);class tc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,y){this.ids.push(zu(o)),this.positions.push(h,p,y)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zu(o);let p=0,y=this.ids.length-1;for(;p<y;){const w=p+y>>1;this.ids[w]>=h?y=w:p=w+1}const v=[];for(;this.ids[p]===h;)v.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return v}static serialize(o,h){const p=new Float64Array(o.ids),y=new Uint32Array(o.positions);return Ru(p,y,0,p.length-1),h&&h.push(p.buffer,y.buffer),{ids:p,positions:y}}static deserialize(o){const h=new tc;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function zu(c){const o=+c;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Ou(String(c))}function Ru(c,o,h,p){for(;h<p;){const y=c[h+p>>1];let v=h-1,w=p+1;for(;;){do v++;while(c[v]<y);do w--;while(c[w]>y);if(v>=w)break;el(c,v,w),el(o,3*v,3*w),el(o,3*v+1,3*w+1),el(o,3*v+2,3*w+2)}w-h<p-w?(Ru(c,o,h,w),h=w+1):(Ru(c,o,w+1,p),p=w)}}function el(c,o,h){const p=c[o];c[o]=c[h],c[h]=p}ot("FeaturePositionMap",tc);class nc{constructor(o,h){this.gl=o.gl,this.location=h}}class Am extends nc{constructor(o,h){super(o,h),this.current=0}set(o){this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class pS extends nc{constructor(o,h){super(o,h),this.current=[0,0,0,0]}set(o){o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3]))}}class fS extends nc{constructor(o,h){super(o,h),this.current=vn.transparent}set(o){o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a))}}const k7=new Float32Array(16);function v_(c){return[Jo(255*c.r,255*c.g),Jo(255*c.b,255*c.a)]}class Bd{constructor(o,h,p){this.value=o,this.uniformNames=h.map(y=>`u_${y}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new fS(o,h):new Am(o,h)}}class Lu{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,y){const v=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&o.set(v)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new pS(o,h):new Am(o,h)}}class Qo{constructor(o,h,p,y){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(v=>({name:`a_${v}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(o,h,p,y,v){const w=this.paintVertexArray.length,C=this.expression.evaluate(new Ln(0),h,{},y,[],v);this.paintVertexArray.resize(o),this._setPaintValue(w,o,C)}updatePaintArray(o,h,p,y){const v=this.expression.evaluate({zoom:0},p,y);this._setPaintValue(o,h,v)}_setPaintValue(o,h,p){if(this.type==="color"){const y=v_(p);for(let v=o;v<h;v++)this.paintVertexArray.emplace(v,y[0],y[1])}else{for(let y=o;y<h;y++)this.paintVertexArray.emplace(y,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}}upload(o){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=o.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ws{constructor(o,h,p,y,v,w){this.expression=o,this.uniformNames=h.map(C=>`u_${C}_t`),this.type=p,this.useIntegerZoom=y,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=h.map(C=>({name:`a_${C}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,h,p,y,v){const w=this.expression.evaluate(new Ln(this.zoom),h,{},y,[],v),C=this.expression.evaluate(new Ln(this.zoom+1),h,{},y,[],v),A=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(A,o,w,C)}updatePaintArray(o,h,p,y){const v=this.expression.evaluate({zoom:this.zoom},p,y),w=this.expression.evaluate({zoom:this.zoom+1},p,y);this._setPaintValue(o,h,v,w)}_setPaintValue(o,h,p,y){if(this.type==="color"){const v=v_(p),w=v_(y);for(let C=o;C<h;C++)this.paintVertexArray.emplace(C,v[0],v[1],w[0],w[1])}else{for(let v=o;v<h;v++)this.paintVertexArray.emplace(v,p,y);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(y))}}upload(o){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=o.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(o,h){const p=this.useIntegerZoom?Math.floor(h.zoom):h.zoom,y=Ae(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);o.set(y)}getBinding(o,h,p){return new Am(o,h)}}class tl{constructor(o,h,p,y,v,w){this.expression=o,this.type=h,this.useIntegerZoom=p,this.zoom=y,this.layerId=w,this.zoomInPaintVertexArray=new v,this.zoomOutPaintVertexArray=new v}populatePaintArray(o,h,p){const y=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(o),this.zoomOutPaintVertexArray.resize(o),this._setPaintValues(y,o,h.patterns&&h.patterns[this.layerId],p)}updatePaintArray(o,h,p,y,v){this._setPaintValues(o,h,p.patterns&&p.patterns[this.layerId],v)}_setPaintValues(o,h,p,y){if(!y||!p)return;const{min:v,mid:w,max:C}=p,A=y[v],O=y[w],R=y[C];if(A&&O&&R)for(let N=o;N<h;N++)this.zoomInPaintVertexArray.emplace(N,O.tl[0],O.tl[1],O.br[0],O.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],O.pixelRatio,A.pixelRatio),this.zoomOutPaintVertexArray.emplace(N,O.tl[0],O.tl[1],O.br[0],O.br[1],R.tl[0],R.tl[1],R.br[0],R.br[1],O.pixelRatio,R.pixelRatio)}upload(o){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=o.createVertexBuffer(this.zoomInPaintVertexArray,Ja.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=o.createVertexBuffer(this.zoomOutPaintVertexArray,Ja.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class mS{constructor(o,h,p){this.binders={},this._buffers=[];const y=[];for(const v in o.paint._values){if(!p(v))continue;const w=o.paint.get(v);if(!(w instanceof Ps&&Na(w.property.specification)))continue;const C=S7(v,o.type),A=w.value,O=w.property.specification.type,R=w.property.useIntegerZoom,N=w.property.specification["property-type"],$=N==="cross-faded"||N==="cross-faded-data-driven";if(A.kind==="constant")this.binders[v]=$?new Lu(A.value,C):new Bd(A.value,C,O),y.push(`/u_${v}`);else if(A.kind==="source"||$){const q=gS(v,O,"source");this.binders[v]=$?new tl(A,O,R,h,q,o.id):new Qo(A,C,O,q),y.push(`/a_${v}`)}else{const q=gS(v,O,"composite");this.binders[v]=new Ws(A,C,O,R,h,q),y.push(`/z_${v}`)}}this.cacheKey=y.sort().join("")}getMaxValue(o){const h=this.binders[o];return h instanceof Qo||h instanceof Ws?h.maxValue:0}populatePaintArrays(o,h,p,y,v){for(const w in this.binders){const C=this.binders[w];(C instanceof Qo||C instanceof Ws||C instanceof tl)&&C.populatePaintArray(o,h,p,y,v)}}setConstantPatternPositions(o,h){for(const p in this.binders){const y=this.binders[p];y instanceof Lu&&y.setConstantPatternPositions(o,h)}}updatePaintArrays(o,h,p,y,v){let w=!1;for(const C in o){const A=h.getPositions(C);for(const O of A){const R=p.feature(O.index);for(const N in this.binders){const $=this.binders[N];if(($ instanceof Qo||$ instanceof Ws||$ instanceof tl)&&$.expression.isStateDependent===!0){const q=y.paint.get(N);$.expression=q.value,$.updatePaintArray(O.start,O.end,R,o[C],v),w=!0}}}}return w}defines(){const o=[];for(const h in this.binders){const p=this.binders[h];(p instanceof Bd||p instanceof Lu)&&o.push(...p.uniformNames.map(y=>`#define HAS_UNIFORM_${y}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Qo||p instanceof Ws)for(let y=0;y<p.paintVertexAttributes.length;y++)o.push(p.paintVertexAttributes[y].name);else if(p instanceof tl)for(let y=0;y<Ja.members.length;y++)o.push(Ja.members[y].name)}return o}getBinderUniforms(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Bd||p instanceof Lu||p instanceof Ws)for(const y of p.uniformNames)o.push(y)}return o}getPaintVertexBuffers(){return this._buffers}getUniforms(o,h){const p=[];for(const y in this.binders){const v=this.binders[y];if(v instanceof Bd||v instanceof Lu||v instanceof Ws){for(const w of v.uniformNames)if(h[w]){const C=v.getBinding(o,h[w],w);p.push({name:w,property:y,binding:C})}}}return p}setUniforms(o,h,p,y){for(const{name:v,property:w,binding:C}of h)this.binders[w].setUniform(C,y,p.get(w),v)}updatePaintBuffers(o){this._buffers=[];for(const h in this.binders){const p=this.binders[h];if(o&&p instanceof tl){const y=o.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;y&&this._buffers.push(y)}else(p instanceof Qo||p instanceof Ws)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}}upload(o){for(const h in this.binders){const p=this.binders[h];(p instanceof Qo||p instanceof Ws||p instanceof tl)&&p.upload(o)}this.updatePaintBuffers()}destroy(){for(const o in this.binders){const h=this.binders[o];(h instanceof Qo||h instanceof Ws||h instanceof tl)&&h.destroy()}}}class ic{constructor(o,h,p=()=>!0){this.programConfigurations={};for(const y of o)this.programConfigurations[y.id]=new mS(y,h,p);this.needsUpload=!1,this._featureMap=new tc,this._bufferOffset=0}populatePaintArrays(o,h,p,y,v,w){for(const C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(o,h,y,v,w);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,y){for(const v of p)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(o,this._featureMap,h,v,y)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function S7(c,o){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"]}[c]||[c.replace(`${o}-`,"").replace(/-/g,"_")]}function gS(c,o,h){const p={color:{source:K,composite:Ot},number:{source:Ke,composite:K}},y=function(v){return{"line-pattern":{source:Fr,composite:Fr},"fill-pattern":{source:Fr,composite:Fr},"fill-extrusion-pattern":{source:Fr,composite:Fr}}[v]}(c);return y&&y[h]||p[o][h]}ot("ConstantBinder",Bd),ot("CrossFadedConstantBinder",Lu),ot("SourceExpressionBinder",Qo),ot("CrossFadedCompositeBinder",tl),ot("CompositeExpressionBinder",Ws),ot("ProgramConfiguration",mS,{omit:["_buffers"]}),ot("ProgramConfigurationSet",ic);const oi=8192,w_=Math.pow(2,14)-1,yS=-w_-1;function rc(c){const o=oi/c.extent,h=c.loadGeometry();for(let p=0;p<h.length;p++){const y=h[p];for(let v=0;v<y.length;v++){const w=y[v],C=Math.round(w.x*o),A=Math.round(w.y*o);w.x=Ae(C,yS,w_),w.y=Ae(A,yS,w_),(C<w.x||C>w.x+1||A<w.y||A>w.y+1)&&ht("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function sc(c,o){return{type:c.type,id:c.id,properties:c.properties,geometry:o?rc(c):[]}}function Pm(c,o,h,p,y){c.emplaceBack(2*o+(p+1)/2,2*h+(y+1)/2)}class k_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Wi,this.indexArray=new is,this.segments=new Qt,this.programConfigurations=new ic(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const y=this.layers[0],v=[];let w=null,C=!1;y.type==="circle"&&(w=y.layout.get("circle-sort-key"),C=!w.isConstant());for(const{feature:A,id:O,index:R,sourceLayerIndex:N}of o){const $=this.layers[0]._featureFilter.needGeometry,q=sc(A,$);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),q,p))continue;const G=C?w.evaluate(q,{},p):void 0,X={id:O,properties:A.properties,type:A.type,sourceLayerIndex:N,index:R,geometry:$?q.geometry:rc(A),patterns:{},sortKey:G};v.push(X)}C&&v.sort((A,O)=>A.sortKey-O.sortKey);for(const A of v){const{geometry:O,index:R,sourceLayerIndex:N}=A,$=o[R].feature;this.addFeature(A,O,R,p),h.featureIndex.insert($,O,R,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,br),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,h,p,y){for(const v of h)for(const w of v){const C=w.x,A=w.y;if(C<0||C>=oi||A<0||A>=oi)continue;const O=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),R=O.vertexLength;Pm(this.layoutVertexArray,C,A,-1,-1),Pm(this.layoutVertexArray,C,A,1,-1),Pm(this.layoutVertexArray,C,A,1,1),Pm(this.layoutVertexArray,C,A,-1,1),this.indexArray.emplaceBack(R,R+1,R+2),this.indexArray.emplaceBack(R,R+3,R+2),O.vertexLength+=4,O.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},y)}}function _S(c,o){for(let h=0;h<c.length;h++)if(Nu(o,c[h]))return!0;for(let h=0;h<o.length;h++)if(Nu(c,o[h]))return!0;return!!S_(c,o)}function E7(c,o,h){return!!Nu(c,o)||!!E_(o,c,h)}function bS(c,o){if(c.length===1)return vS(o,c[0]);for(let h=0;h<o.length;h++){const p=o[h];for(let y=0;y<p.length;y++)if(Nu(c,p[y]))return!0}for(let h=0;h<c.length;h++)if(vS(o,c[h]))return!0;for(let h=0;h<o.length;h++)if(S_(c,o[h]))return!0;return!1}function C7(c,o,h){if(c.length>1){if(S_(c,o))return!0;for(let p=0;p<o.length;p++)if(E_(o[p],c,h))return!0}for(let p=0;p<c.length;p++)if(E_(c[p],o,h))return!0;return!1}function S_(c,o){if(c.length===0||o.length===0)return!1;for(let h=0;h<c.length-1;h++){const p=c[h],y=c[h+1];for(let v=0;v<o.length-1;v++)if(T7(p,y,o[v],o[v+1]))return!0}return!1}function T7(c,o,h,p){return Rt(c,h,p)!==Rt(o,h,p)&&Rt(c,o,h)!==Rt(c,o,p)}function E_(c,o,h){const p=h*h;if(o.length===1)return c.distSqr(o[0])<p;for(let y=1;y<o.length;y++)if(xS(c,o[y-1],o[y])<p)return!0;return!1}function xS(c,o,h){const p=o.distSqr(h);if(p===0)return c.distSqr(o);const y=((c.x-o.x)*(h.x-o.x)+(c.y-o.y)*(h.y-o.y))/p;return c.distSqr(y<0?o:y>1?h:h.sub(o)._mult(y)._add(o))}function vS(c,o){let h,p,y,v=!1;for(let w=0;w<c.length;w++){h=c[w];for(let C=0,A=h.length-1;C<h.length;A=C++)p=h[C],y=h[A],p.y>o.y!=y.y>o.y&&o.x<(y.x-p.x)*(o.y-p.y)/(y.y-p.y)+p.x&&(v=!v)}return v}function Nu(c,o){let h=!1;for(let p=0,y=c.length-1;p<c.length;y=p++){const v=c[p],w=c[y];v.y>o.y!=w.y>o.y&&o.x<(w.x-v.x)*(o.y-v.y)/(w.y-v.y)+v.x&&(h=!h)}return h}function M7(c,o,h){const p=h[0],y=h[2];if(c.x<p.x&&o.x<p.x||c.x>y.x&&o.x>y.x||c.y<p.y&&o.y<p.y||c.y>y.y&&o.y>y.y)return!1;const v=Rt(c,o,h[0]);return v!==Rt(c,o,h[1])||v!==Rt(c,o,h[2])||v!==Rt(c,o,h[3])}function Fd(c,o,h){const p=o.paint.get(c).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(c)}function Im(c){return Math.sqrt(c[0]*c[0]+c[1]*c[1])}function Dm(c,o,h,p,y){if(!o[0]&&!o[1])return c;const v=E.convert(o)._mult(y);h==="viewport"&&v._rotate(-p);const w=[];for(let C=0;C<c.length;C++)w.push(c[C].sub(v));return w}let wS,kS;ot("CircleBucket",k_,{omit:["layers"]});var A7={get paint(){return kS=kS||new x({"circle-radius":new Et(we.paint_circle["circle-radius"]),"circle-color":new Et(we.paint_circle["circle-color"]),"circle-blur":new Et(we.paint_circle["circle-blur"]),"circle-opacity":new Et(we.paint_circle["circle-opacity"]),"circle-translate":new dt(we.paint_circle["circle-translate"]),"circle-translate-anchor":new dt(we.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new dt(we.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new dt(we.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Et(we.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Et(we.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Et(we.paint_circle["circle-stroke-opacity"])})},get layout(){return wS=wS||new x({"circle-sort-key":new Et(we.layout_circle["circle-sort-key"])})}},sr=1e-6,Bu=typeof Float32Array<"u"?Float32Array:Array;function C_(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function SS(c,o,h){var p=o[0],y=o[1],v=o[2],w=o[3],C=o[4],A=o[5],O=o[6],R=o[7],N=o[8],$=o[9],q=o[10],G=o[11],X=o[12],ie=o[13],ae=o[14],be=o[15],pe=h[0],ye=h[1],Ee=h[2],Ne=h[3];return c[0]=pe*p+ye*C+Ee*N+Ne*X,c[1]=pe*y+ye*A+Ee*$+Ne*ie,c[2]=pe*v+ye*O+Ee*q+Ne*ae,c[3]=pe*w+ye*R+Ee*G+Ne*be,c[4]=(pe=h[4])*p+(ye=h[5])*C+(Ee=h[6])*N+(Ne=h[7])*X,c[5]=pe*y+ye*A+Ee*$+Ne*ie,c[6]=pe*v+ye*O+Ee*q+Ne*ae,c[7]=pe*w+ye*R+Ee*G+Ne*be,c[8]=(pe=h[8])*p+(ye=h[9])*C+(Ee=h[10])*N+(Ne=h[11])*X,c[9]=pe*y+ye*A+Ee*$+Ne*ie,c[10]=pe*v+ye*O+Ee*q+Ne*ae,c[11]=pe*w+ye*R+Ee*G+Ne*be,c[12]=(pe=h[12])*p+(ye=h[13])*C+(Ee=h[14])*N+(Ne=h[15])*X,c[13]=pe*y+ye*A+Ee*$+Ne*ie,c[14]=pe*v+ye*O+Ee*q+Ne*ae,c[15]=pe*w+ye*R+Ee*G+Ne*be,c}Math.hypot||(Math.hypot=function(){for(var c=0,o=arguments.length;o--;)c+=arguments[o]*arguments[o];return Math.sqrt(c)});var Vd,P7=SS;function Om(c,o,h){var p=o[0],y=o[1],v=o[2],w=o[3];return c[0]=h[0]*p+h[4]*y+h[8]*v+h[12]*w,c[1]=h[1]*p+h[5]*y+h[9]*v+h[13]*w,c[2]=h[2]*p+h[6]*y+h[10]*v+h[14]*w,c[3]=h[3]*p+h[7]*y+h[11]*v+h[15]*w,c}Vd=new Bu(4),Bu!=Float32Array&&(Vd[0]=0,Vd[1]=0,Vd[2]=0,Vd[3]=0);class I7 extends d{constructor(o){super(o,A7)}createBucket(o){return new k_(o)}queryRadius(o){const h=o;return Fd("circle-radius",this,h)+Fd("circle-stroke-width",this,h)+Im(this.paint.get("circle-translate"))}queryIntersectsFeature(o,h,p,y,v,w,C,A){const O=Dm(o,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),w.angle,C),R=this.paint.get("circle-radius").evaluate(h,p)+this.paint.get("circle-stroke-width").evaluate(h,p),N=this.paint.get("circle-pitch-alignment")==="map",$=N?O:function(G,X){return G.map(ie=>ES(ie,X))}(O,A),q=N?R*C:R;for(const G of y)for(const X of G){const ie=N?X:ES(X,A);let ae=q;const be=Om([],[X.x,X.y,0,1],A);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ae*=be[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ae*=w.cameraToCenterDistance/be[3]),E7($,ie,ae))return!0}return!1}}function ES(c,o){const h=Om([],[c.x,c.y,0,1],o);return new E(h[0]/h[3],h[1]/h[3])}class CS extends k_{}let TS;ot("HeatmapBucket",CS,{omit:["layers"]});var D7={get paint(){return TS=TS||new x({"heatmap-radius":new Et(we.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Et(we.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new dt(we.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ld(we.paint_heatmap["heatmap-color"]),"heatmap-opacity":new dt(we.paint_heatmap["heatmap-opacity"])})}};function T_(c,{width:o,height:h},p,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${o*h*p}`)}else y=new Uint8Array(o*h*p);return c.width=o,c.height=h,c.data=y,c}function MS(c,{width:o,height:h},p){if(o===c.width&&h===c.height)return;const y=T_({},{width:o,height:h},p);M_(c,y,{x:0,y:0},{x:0,y:0},{width:Math.min(c.width,o),height:Math.min(c.height,h)},p),c.width=o,c.height=h,c.data=y.data}function M_(c,o,h,p,y,v){if(y.width===0||y.height===0)return o;if(y.width>c.width||y.height>c.height||h.x>c.width-y.width||h.y>c.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>o.width||y.height>o.height||p.x>o.width-y.width||p.y>o.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const w=c.data,C=o.data;if(w===C)throw new Error("srcData equals dstData, so image is already copied");for(let A=0;A<y.height;A++){const O=((h.y+A)*c.width+h.x)*v,R=((p.y+A)*o.width+p.x)*v;for(let N=0;N<y.width*v;N++)C[R+N]=w[O+N]}return o}class $d{constructor(o,h){T_(this,o,1,h)}resize(o){MS(this,o,1)}clone(){return new $d({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,y,v){M_(o,h,p,y,v,1)}}class rs{constructor(o,h){T_(this,o,4,h)}resize(o){MS(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new rs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,y,v){M_(o,h,p,y,v,4)}}function AS(c){const o={},h=c.resolution||256,p=c.clips?c.clips.length:1,y=c.image||new rs({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const v=(w,C,A)=>{o[c.evaluationKey]=A;const O=c.expression.evaluate(o);y.data[w+C+0]=Math.floor(255*O.r/O.a),y.data[w+C+1]=Math.floor(255*O.g/O.a),y.data[w+C+2]=Math.floor(255*O.b/O.a),y.data[w+C+3]=Math.floor(255*O.a)};if(c.clips)for(let w=0,C=0;w<p;++w,C+=4*h)for(let A=0,O=0;A<h;A++,O+=4){const R=A/(h-1),{start:N,end:$}=c.clips[w];v(C,O,N*(1-R)+$*R)}else for(let w=0,C=0;w<h;w++,C+=4)v(0,C,w/(h-1));return y}ot("AlphaImage",$d),ot("RGBAImage",rs);const A_="big-fb";class O7 extends d{createBucket(o){return new CS(o)}constructor(o){super(o,D7),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(o){o==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=AS({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(A_)&&this.heatmapFbos.delete(A_)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let PS;var z7={get paint(){return PS=PS||new x({"hillshade-illumination-direction":new dt(we.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new dt(we.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new dt(we.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new dt(we.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new dt(we.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new dt(we.paint_hillshade["hillshade-accent-color"])})}};class R7 extends d{constructor(o){super(o,z7)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const L7=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:N7}=L7;function IS(c,o,h=2){const p=o&&o.length,y=p?o[0]*h:c.length;let v=DS(c,0,y,h,!0);const w=[];if(!v||v.next===v.prev)return w;let C,A,O;if(p&&(v=function(R,N,$,q){const G=[];for(let X=0,ie=N.length;X<ie;X++){const ae=DS(R,N[X]*q,X<ie-1?N[X+1]*q:R.length,q,!1);ae===ae.next&&(ae.steiner=!0),G.push(q7(ae))}G.sort(j7);for(let X=0;X<G.length;X++)$=U7(G[X],$);return $}(c,o,v,h)),c.length>80*h){C=1/0,A=1/0;let R=-1/0,N=-1/0;for(let $=h;$<y;$+=h){const q=c[$],G=c[$+1];q<C&&(C=q),G<A&&(A=G),q>R&&(R=q),G>N&&(N=G)}O=Math.max(R-C,N-A),O=O!==0?32767/O:0}return jd(v,w,h,C,A,O,0),w}function DS(c,o,h,p,y){let v;if(y===function(w,C,A,O){let R=0;for(let N=C,$=A-O;N<A;N+=O)R+=(w[$]-w[N])*(w[N+1]+w[$+1]),$=N;return R}(c,o,h,p)>0)for(let w=o;w<h;w+=p)v=RS(w/p|0,c[w],c[w+1],v);else for(let w=h-p;w>=o;w-=p)v=RS(w/p|0,c[w],c[w+1],v);return v&&zm(v,v.next)&&(Hd(v),v=v.next),v}function oc(c,o){if(!c)return c;o||(o=c);let h,p=c;do if(h=!1,p.steiner||!zm(p,p.next)&&ni(p.prev,p,p.next)!==0)p=p.next;else{if(Hd(p),p=o=p.prev,p===p.next)break;h=!0}while(h||p!==o);return o}function jd(c,o,h,p,y,v,w){if(!c)return;!w&&v&&function(A,O,R,N){let $=A;do $.z===0&&($.z=P_($.x,$.y,O,R,N)),$.prevZ=$.prev,$.nextZ=$.next,$=$.next;while($!==A);$.prevZ.nextZ=null,$.prevZ=null,function(q){let G,X=1;do{let ie,ae=q;q=null;let be=null;for(G=0;ae;){G++;let pe=ae,ye=0;for(let Ne=0;Ne<X&&(ye++,pe=pe.nextZ,pe);Ne++);let Ee=X;for(;ye>0||Ee>0&&pe;)ye!==0&&(Ee===0||!pe||ae.z<=pe.z)?(ie=ae,ae=ae.nextZ,ye--):(ie=pe,pe=pe.nextZ,Ee--),be?be.nextZ=ie:q=ie,ie.prevZ=be,be=ie;ae=pe}be.nextZ=null,X*=2}while(G>1)}($)}(c,p,y,v);let C=c;for(;c.prev!==c.next;){const A=c.prev,O=c.next;if(v?F7(c,p,y,v):B7(c))o.push(A.i,c.i,O.i),Hd(c),c=O.next,C=O.next;else if((c=O)===C){w?w===1?jd(c=V7(oc(c),o),o,h,p,y,v,2):w===2&&$7(c,o,h,p,y,v):jd(oc(c),o,h,p,y,v,1);break}}}function B7(c){const o=c.prev,h=c,p=c.next;if(ni(o,h,p)>=0)return!1;const y=o.x,v=h.x,w=p.x,C=o.y,A=h.y,O=p.y,R=y<v?y<w?y:w:v<w?v:w,N=C<A?C<O?C:O:A<O?A:O,$=y>v?y>w?y:w:v>w?v:w,q=C>A?C>O?C:O:A>O?A:O;let G=p.next;for(;G!==o;){if(G.x>=R&&G.x<=$&&G.y>=N&&G.y<=q&&Fu(y,C,v,A,w,O,G.x,G.y)&&ni(G.prev,G,G.next)>=0)return!1;G=G.next}return!0}function F7(c,o,h,p){const y=c.prev,v=c,w=c.next;if(ni(y,v,w)>=0)return!1;const C=y.x,A=v.x,O=w.x,R=y.y,N=v.y,$=w.y,q=C<A?C<O?C:O:A<O?A:O,G=R<N?R<$?R:$:N<$?N:$,X=C>A?C>O?C:O:A>O?A:O,ie=R>N?R>$?R:$:N>$?N:$,ae=P_(q,G,o,h,p),be=P_(X,ie,o,h,p);let pe=c.prevZ,ye=c.nextZ;for(;pe&&pe.z>=ae&&ye&&ye.z<=be;){if(pe.x>=q&&pe.x<=X&&pe.y>=G&&pe.y<=ie&&pe!==y&&pe!==w&&Fu(C,R,A,N,O,$,pe.x,pe.y)&&ni(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,ye.x>=q&&ye.x<=X&&ye.y>=G&&ye.y<=ie&&ye!==y&&ye!==w&&Fu(C,R,A,N,O,$,ye.x,ye.y)&&ni(ye.prev,ye,ye.next)>=0))return!1;ye=ye.nextZ}for(;pe&&pe.z>=ae;){if(pe.x>=q&&pe.x<=X&&pe.y>=G&&pe.y<=ie&&pe!==y&&pe!==w&&Fu(C,R,A,N,O,$,pe.x,pe.y)&&ni(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;ye&&ye.z<=be;){if(ye.x>=q&&ye.x<=X&&ye.y>=G&&ye.y<=ie&&ye!==y&&ye!==w&&Fu(C,R,A,N,O,$,ye.x,ye.y)&&ni(ye.prev,ye,ye.next)>=0)return!1;ye=ye.nextZ}return!0}function V7(c,o){let h=c;do{const p=h.prev,y=h.next.next;!zm(p,y)&&OS(p,h,h.next,y)&&Ud(p,y)&&Ud(y,p)&&(o.push(p.i,h.i,y.i),Hd(h),Hd(h.next),h=c=y),h=h.next}while(h!==c);return oc(h)}function $7(c,o,h,p,y,v){let w=c;do{let C=w.next.next;for(;C!==w.prev;){if(w.i!==C.i&&W7(w,C)){let A=zS(w,C);return w=oc(w,w.next),A=oc(A,A.next),jd(w,o,h,p,y,v,0),void jd(A,o,h,p,y,v,0)}C=C.next}w=w.next}while(w!==c)}function j7(c,o){return c.x-o.x}function U7(c,o){const h=function(y,v){let w=v;const C=y.x,A=y.y;let O,R=-1/0;do{if(A<=w.y&&A>=w.next.y&&w.next.y!==w.y){const X=w.x+(A-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(X<=C&&X>R&&(R=X,O=w.x<w.next.x?w:w.next,X===C))return O}w=w.next}while(w!==v);if(!O)return null;const N=O,$=O.x,q=O.y;let G=1/0;w=O;do{if(C>=w.x&&w.x>=$&&C!==w.x&&Fu(A<q?C:R,A,$,q,A<q?R:C,A,w.x,w.y)){const X=Math.abs(A-w.y)/(C-w.x);Ud(w,y)&&(X<G||X===G&&(w.x>O.x||w.x===O.x&&H7(O,w)))&&(O=w,G=X)}w=w.next}while(w!==N);return O}(c,o);if(!h)return o;const p=zS(h,c);return oc(p,p.next),oc(h,h.next)}function H7(c,o){return ni(c.prev,c,o.prev)<0&&ni(o.next,c,c.next)<0}function P_(c,o,h,p,y){return(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-h)*y|0)|c<<8))|c<<4))|c<<2))|c<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*y|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function q7(c){let o=c,h=c;do(o.x<h.x||o.x===h.x&&o.y<h.y)&&(h=o),o=o.next;while(o!==c);return h}function Fu(c,o,h,p,y,v,w,C){return(y-w)*(o-C)>=(c-w)*(v-C)&&(c-w)*(p-C)>=(h-w)*(o-C)&&(h-w)*(v-C)>=(y-w)*(p-C)}function W7(c,o){return c.next.i!==o.i&&c.prev.i!==o.i&&!function(h,p){let y=h;do{if(y.i!==h.i&&y.next.i!==h.i&&y.i!==p.i&&y.next.i!==p.i&&OS(y,y.next,h,p))return!0;y=y.next}while(y!==h);return!1}(c,o)&&(Ud(c,o)&&Ud(o,c)&&function(h,p){let y=h,v=!1;const w=(h.x+p.x)/2,C=(h.y+p.y)/2;do y.y>C!=y.next.y>C&&y.next.y!==y.y&&w<(y.next.x-y.x)*(C-y.y)/(y.next.y-y.y)+y.x&&(v=!v),y=y.next;while(y!==h);return v}(c,o)&&(ni(c.prev,c,o.prev)||ni(c,o.prev,o))||zm(c,o)&&ni(c.prev,c,c.next)>0&&ni(o.prev,o,o.next)>0)}function ni(c,o,h){return(o.y-c.y)*(h.x-o.x)-(o.x-c.x)*(h.y-o.y)}function zm(c,o){return c.x===o.x&&c.y===o.y}function OS(c,o,h,p){const y=Lm(ni(c,o,h)),v=Lm(ni(c,o,p)),w=Lm(ni(h,p,c)),C=Lm(ni(h,p,o));return y!==v&&w!==C||!(y!==0||!Rm(c,h,o))||!(v!==0||!Rm(c,p,o))||!(w!==0||!Rm(h,c,p))||!(C!==0||!Rm(h,o,p))}function Rm(c,o,h){return o.x<=Math.max(c.x,h.x)&&o.x>=Math.min(c.x,h.x)&&o.y<=Math.max(c.y,h.y)&&o.y>=Math.min(c.y,h.y)}function Lm(c){return c>0?1:c<0?-1:0}function Ud(c,o){return ni(c.prev,c,c.next)<0?ni(c,o,c.next)>=0&&ni(c,c.prev,o)>=0:ni(c,o,c.prev)<0||ni(c,c.next,o)<0}function zS(c,o){const h=I_(c.i,c.x,c.y),p=I_(o.i,o.x,o.y),y=c.next,v=o.prev;return c.next=o,o.prev=c,h.next=y,y.prev=h,p.next=h,h.prev=p,v.next=p,p.prev=v,p}function RS(c,o,h,p){const y=I_(c,o,h);return p?(y.next=p.next,y.prev=p,p.next.prev=y,p.next=y):(y.prev=y,y.next=y),y}function Hd(c){c.next.prev=c.prev,c.prev.next=c.next,c.prevZ&&(c.prevZ.nextZ=c.nextZ),c.nextZ&&(c.nextZ.prevZ=c.prevZ)}function I_(c,o,h){return{i:c,x:o,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function D_(c,o,h){const p=h.patternDependencies;let y=!1;for(const v of o){const w=v.paint.get(`${c}-pattern`);w.isConstant()||(y=!0);const C=w.constantOr(null);C&&(y=!0,p[C.to]=!0,p[C.from]=!0)}return y}function O_(c,o,h,p,y){const v=y.patternDependencies;for(const w of o){const C=w.paint.get(`${c}-pattern`).value;if(C.kind!=="constant"){let A=C.evaluate({zoom:p-1},h,{},y.availableImages),O=C.evaluate({zoom:p},h,{},y.availableImages),R=C.evaluate({zoom:p+1},h,{},y.availableImages);A=A&&A.name?A.name:A,O=O&&O.name?O.name:O,R=R&&R.name?R.name:R,v[A]=!0,v[O]=!0,v[R]=!0,h.patterns[w.id]={min:A,mid:O,max:R}}}return h}class z_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Is,this.indexArray=new is,this.indexArray2=new ki,this.programConfigurations=new ic(o.layers,o.zoom),this.segments=new Qt,this.segments2=new Qt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=D_("fill",this.layers,h);const y=this.layers[0].layout.get("fill-sort-key"),v=!y.isConstant(),w=[];for(const{feature:C,id:A,index:O,sourceLayerIndex:R}of o){const N=this.layers[0]._featureFilter.needGeometry,$=sc(C,N);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),$,p))continue;const q=v?y.evaluate($,{},p,h.availableImages):void 0,G={id:A,properties:C.properties,type:C.type,sourceLayerIndex:R,index:O,geometry:N?$.geometry:rc(C),patterns:{},sortKey:q};w.push(G)}v&&w.sort((C,A)=>C.sortKey-A.sortKey);for(const C of w){const{geometry:A,index:O,sourceLayerIndex:R}=C;if(this.hasPattern){const N=O_("fill",this.layers,C,this.zoom,h);this.patternFeatures.push(N)}else this.addFeature(C,A,O,p,{});h.featureIndex.insert(o[O].feature,A,O,R,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,N7),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),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(o,h,p,y,v){for(const w of cu(h,500)){let C=0;for(const q of w)C+=q.length;const A=this.segments.prepareSegment(C,this.layoutVertexArray,this.indexArray),O=A.vertexLength,R=[],N=[];for(const q of w){if(q.length===0)continue;q!==w[0]&&N.push(R.length/2);const G=this.segments2.prepareSegment(q.length,this.layoutVertexArray,this.indexArray2),X=G.vertexLength;this.layoutVertexArray.emplaceBack(q[0].x,q[0].y),this.indexArray2.emplaceBack(X+q.length-1,X),R.push(q[0].x),R.push(q[0].y);for(let ie=1;ie<q.length;ie++)this.layoutVertexArray.emplaceBack(q[ie].x,q[ie].y),this.indexArray2.emplaceBack(X+ie-1,X+ie),R.push(q[ie].x),R.push(q[ie].y);G.vertexLength+=q.length,G.primitiveLength+=q.length}const $=IS(R,N);for(let q=0;q<$.length;q+=3)this.indexArray.emplaceBack(O+$[q],O+$[q+1],O+$[q+2]);A.vertexLength+=C,A.primitiveLength+=$.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,y)}}let LS,NS;ot("FillBucket",z_,{omit:["layers","patternFeatures"]});var G7={get paint(){return NS=NS||new x({"fill-antialias":new dt(we.paint_fill["fill-antialias"]),"fill-opacity":new Et(we.paint_fill["fill-opacity"]),"fill-color":new Et(we.paint_fill["fill-color"]),"fill-outline-color":new Et(we.paint_fill["fill-outline-color"]),"fill-translate":new dt(we.paint_fill["fill-translate"]),"fill-translate-anchor":new dt(we.paint_fill["fill-translate-anchor"]),"fill-pattern":new Au(we.paint_fill["fill-pattern"])})},get layout(){return LS=LS||new x({"fill-sort-key":new Et(we.layout_fill["fill-sort-key"])})}};class Z7 extends d{constructor(o){super(o,G7)}recalculate(o,h){super.recalculate(o,h);const p=this.paint._values["fill-outline-color"];p.value.kind==="constant"&&p.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(o){return new z_(o)}queryRadius(){return Im(this.paint.get("fill-translate"))}queryIntersectsFeature(o,h,p,y,v,w,C){return bS(Dm(o,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),w.angle,C),y)}isTileClipped(){return!0}}const Y7=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),X7=M([{name:"a_centroid",components:2,type:"Int16"}],4),{members:K7}=Y7;var nl={},J7=_,BS=Vu;function Vu(c,o,h,p,y){this.properties={},this.extent=h,this.type=0,this._pbf=c,this._geometry=-1,this._keys=p,this._values=y,c.readFields(Q7,this,o)}function Q7(c,o,h){c==1?o.id=h.readVarint():c==2?function(p,y){for(var v=p.readVarint()+p.pos;p.pos<v;){var w=y._keys[p.readVarint()],C=y._values[p.readVarint()];y.properties[w]=C}}(h,o):c==3?o.type=h.readVarint():c==4&&(o._geometry=h.pos)}function e9(c){for(var o,h,p=0,y=0,v=c.length,w=v-1;y<v;w=y++)p+=((h=c[w]).x-(o=c[y]).x)*(o.y+h.y);return p}Vu.types=["Unknown","Point","LineString","Polygon"],Vu.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var o,h=c.readVarint()+c.pos,p=1,y=0,v=0,w=0,C=[];c.pos<h;){if(y<=0){var A=c.readVarint();p=7&A,y=A>>3}if(y--,p===1||p===2)v+=c.readSVarint(),w+=c.readSVarint(),p===1&&(o&&C.push(o),o=[]),o.push(new J7(v,w));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&C.push(o),C},Vu.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var o=c.readVarint()+c.pos,h=1,p=0,y=0,v=0,w=1/0,C=-1/0,A=1/0,O=-1/0;c.pos<o;){if(p<=0){var R=c.readVarint();h=7&R,p=R>>3}if(p--,h===1||h===2)(y+=c.readSVarint())<w&&(w=y),y>C&&(C=y),(v+=c.readSVarint())<A&&(A=v),v>O&&(O=v);else if(h!==7)throw new Error("unknown command "+h)}return[w,A,C,O]},Vu.prototype.toGeoJSON=function(c,o,h){var p,y,v=this.extent*Math.pow(2,h),w=this.extent*c,C=this.extent*o,A=this.loadGeometry(),O=Vu.types[this.type];function R(q){for(var G=0;G<q.length;G++){var X=q[G];q[G]=[360*(X.x+w)/v-180,360/Math.PI*Math.atan(Math.exp((180-360*(X.y+C)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var N=[];for(p=0;p<A.length;p++)N[p]=A[p][0];R(A=N);break;case 2:for(p=0;p<A.length;p++)R(A[p]);break;case 3:for(A=function(q){var G=q.length;if(G<=1)return[q];for(var X,ie,ae=[],be=0;be<G;be++){var pe=e9(q[be]);pe!==0&&(ie===void 0&&(ie=pe<0),ie===pe<0?(X&&ae.push(X),X=[q[be]]):X.push(q[be]))}return X&&ae.push(X),ae}(A),p=0;p<A.length;p++)for(y=0;y<A[p].length;y++)R(A[p][y])}A.length===1?A=A[0]:O="Multi"+O;var $={type:"Feature",geometry:{type:O,coordinates:A},properties:this.properties};return"id"in this&&($.id=this.id),$};var t9=BS,FS=VS;function VS(c,o){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=c,this._keys=[],this._values=[],this._features=[],c.readFields(n9,this,o),this.length=this._features.length}function n9(c,o,h){c===15?o.version=h.readVarint():c===1?o.name=h.readString():c===5?o.extent=h.readVarint():c===2?o._features.push(h.pos):c===3?o._keys.push(h.readString()):c===4&&o._values.push(function(p){for(var y=null,v=p.readVarint()+p.pos;p.pos<v;){var w=p.readVarint()>>3;y=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return y}(h))}VS.prototype.feature=function(c){if(c<0||c>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];var o=this._pbf.readVarint()+this._pbf.pos;return new t9(this._pbf,o,this.extent,this._keys,this._values)};var i9=FS;function r9(c,o,h){if(c===3){var p=new i9(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}nl.VectorTile=function(c,o){this.layers=c.readFields(r9,{},o)},nl.VectorTileFeature=BS,nl.VectorTileLayer=FS;const s9=nl.VectorTileFeature.types,R_=Math.pow(2,13);function qd(c,o,h,p,y,v,w,C){c.emplaceBack(o,h,2*Math.floor(p*R_)+w,y*R_*2,v*R_*2,Math.round(C))}class L_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Xa,this.centroidVertexArray=new Di,this.indexArray=new is,this.programConfigurations=new ic(o.layers,o.zoom),this.segments=new Qt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=D_("fill-extrusion",this.layers,h);for(const{feature:y,id:v,index:w,sourceLayerIndex:C}of o){const A=this.layers[0]._featureFilter.needGeometry,O=sc(y,A);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),O,p))continue;const R={id:v,sourceLayerIndex:C,index:w,geometry:A?O.geometry:rc(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(O_("fill-extrusion",this.layers,R,this.zoom,h)):this.addFeature(R,R.geometry,w,p,{}),h.featureIndex.insert(y,R.geometry,w,C,this.index,!0)}}addFeatures(o,h,p){for(const y of this.features){const{geometry:v}=y;this.addFeature(y,v,y.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,K7),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,X7.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,h,p,y,v){for(const w of cu(h,500)){const C={x:0,y:0,vertexCount:0};let A=0;for(const G of w)A+=G.length;let O=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const G of w){if(G.length===0||a9(G))continue;let X=0;for(let ie=0;ie<G.length;ie++){const ae=G[ie];if(ie>=1){const be=G[ie-1];if(!o9(ae,be)){O.vertexLength+4>Qt.MAX_VERTEX_ARRAY_LENGTH&&(O=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const pe=ae.sub(be)._perp()._unit(),ye=be.dist(ae);X+ye>32768&&(X=0),qd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,0,X),qd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,1,X),C.x+=2*ae.x,C.y+=2*ae.y,C.vertexCount+=2,X+=ye,qd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,0,X),qd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,1,X),C.x+=2*be.x,C.y+=2*be.y,C.vertexCount+=2;const Ee=O.vertexLength;this.indexArray.emplaceBack(Ee,Ee+2,Ee+1),this.indexArray.emplaceBack(Ee+1,Ee+2,Ee+3),O.vertexLength+=4,O.primitiveLength+=2}}}}if(O.vertexLength+A>Qt.MAX_VERTEX_ARRAY_LENGTH&&(O=this.segments.prepareSegment(A,this.layoutVertexArray,this.indexArray)),s9[o.type]!=="Polygon")continue;const R=[],N=[],$=O.vertexLength;for(const G of w)if(G.length!==0){G!==w[0]&&N.push(R.length/2);for(let X=0;X<G.length;X++){const ie=G[X];qd(this.layoutVertexArray,ie.x,ie.y,0,0,1,1,0),C.x+=ie.x,C.y+=ie.y,C.vertexCount+=1,R.push(ie.x),R.push(ie.y)}}const q=IS(R,N);for(let G=0;G<q.length;G+=3)this.indexArray.emplaceBack($+q[G],$+q[G+2],$+q[G+1]);O.primitiveLength+=q.length/3,O.vertexLength+=A;for(let G=0;G<C.vertexCount;G++){const X=Math.floor(C.x/C.vertexCount),ie=Math.floor(C.y/C.vertexCount);this.centroidVertexArray.emplaceBack(X,ie)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,y)}}function o9(c,o){return c.x===o.x&&(c.x<0||c.x>oi)||c.y===o.y&&(c.y<0||c.y>oi)}function a9(c){return c.every(o=>o.x<0)||c.every(o=>o.x>oi)||c.every(o=>o.y<0)||c.every(o=>o.y>oi)}let $S;ot("FillExtrusionBucket",L_,{omit:["layers","features"]});var l9={get paint(){return $S=$S||new x({"fill-extrusion-opacity":new dt(we["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Et(we["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new dt(we["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new dt(we["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Au(we["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Et(we["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Et(we["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new dt(we["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class c9 extends d{constructor(o){super(o,l9)}createBucket(o){return new L_(o)}queryRadius(){return Im(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,y,v,w,C,A){const O=Dm(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,C),R=this.paint.get("fill-extrusion-height").evaluate(h,p),N=this.paint.get("fill-extrusion-base").evaluate(h,p),$=function(G,X,ie,ae){const be=[];for(const pe of G){const ye=[pe.x,pe.y,0,1];Om(ye,ye,X),be.push(new E(ye[0]/ye[3],ye[1]/ye[3]))}return be}(O,A),q=function(G,X,ie,ae){const be=[],pe=[],ye=ae[8]*X,Ee=ae[9]*X,Ne=ae[10]*X,tt=ae[11]*X,St=ae[8]*ie,Qe=ae[9]*ie,Ze=ae[10]*ie,mt=ae[11]*ie;for(const ct of G){const rt=[],De=[];for(const yt of ct){const ft=yt.x,It=yt.y,Pn=ae[0]*ft+ae[4]*It+ae[12],Mn=ae[1]*ft+ae[5]*It+ae[13],mi=ae[2]*ft+ae[6]*It+ae[14],Ds=ae[3]*ft+ae[7]*It+ae[15],Ri=mi+Ne,gi=Ds+tt,or=Pn+St,ar=Mn+Qe,lr=mi+Ze,ei=Ds+mt,yi=new E((Pn+ye)/gi,(Mn+Ee)/gi);yi.z=Ri/gi,rt.push(yi);const Gi=new E(or/ei,ar/ei);Gi.z=lr/ei,De.push(Gi)}be.push(rt),pe.push(De)}return[be,pe]}(y,N,R,A);return function(G,X,ie){let ae=1/0;bS(ie,X)&&(ae=jS(ie,X[0]));for(let be=0;be<X.length;be++){const pe=X[be],ye=G[be];for(let Ee=0;Ee<pe.length-1;Ee++){const Ne=pe[Ee],tt=[Ne,pe[Ee+1],ye[Ee+1],ye[Ee],Ne];_S(ie,tt)&&(ae=Math.min(ae,jS(ie,tt)))}}return ae!==1/0&&ae}(q[0],q[1],$)}}function Wd(c,o){return c.x*o.x+c.y*o.y}function jS(c,o){if(c.length===1){let h=0;const p=o[h++];let y;for(;!y||p.equals(y);)if(y=o[h++],!y)return 1/0;for(;h<o.length;h++){const v=o[h],w=c[0],C=y.sub(p),A=v.sub(p),O=w.sub(p),R=Wd(C,C),N=Wd(C,A),$=Wd(A,A),q=Wd(O,C),G=Wd(O,A),X=R*$-N*N,ie=($*q-N*G)/X,ae=(R*G-N*q)/X,be=p.z*(1-ie-ae)+y.z*ie+v.z*ae;if(isFinite(be))return be}return 1/0}{let h=1/0;for(const p of o)h=Math.min(h,p.z);return h}}const u9=M([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:h9}=u9,d9=M([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:p9}=d9,f9=nl.VectorTileFeature.types,m9=Math.cos(Math.PI/180*37.5),US=Math.pow(2,14)/.5;class N_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new Iu,this.layoutVertexArray2=new Ka,this.indexArray=new is,this.programConfigurations=new ic(o.layers,o.zoom),this.segments=new Qt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=D_("line",this.layers,h);const y=this.layers[0].layout.get("line-sort-key"),v=!y.isConstant(),w=[];for(const{feature:C,id:A,index:O,sourceLayerIndex:R}of o){const N=this.layers[0]._featureFilter.needGeometry,$=sc(C,N);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),$,p))continue;const q=v?y.evaluate($,{},p):void 0,G={id:A,properties:C.properties,type:C.type,sourceLayerIndex:R,index:O,geometry:N?$.geometry:rc(C),patterns:{},sortKey:q};w.push(G)}v&&w.sort((C,A)=>C.sortKey-A.sortKey);for(const C of w){const{geometry:A,index:O,sourceLayerIndex:R}=C;if(this.hasPattern){const N=O_("line",this.layers,C,this.zoom,h);this.patternFeatures.push(N)}else this.addFeature(C,A,O,p,{});h.featureIndex.insert(o[O].feature,A,O,R,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,p9)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,h9),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,h,p,y,v){const w=this.layers[0].layout,C=w.get("line-join").evaluate(o,{}),A=w.get("line-cap"),O=w.get("line-miter-limit"),R=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const N of h)this.addLine(N,o,C,A,O,R);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,y)}addLine(o,h,p,y,v,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ae=0;ae<o.length-1;ae++)this.totalDistance+=o[ae].dist(o[ae+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const C=f9[h.type]==="Polygon";let A=o.length;for(;A>=2&&o[A-1].equals(o[A-2]);)A--;let O=0;for(;O<A-1&&o[O].equals(o[O+1]);)O++;if(A<(C?3:2))return;p==="bevel"&&(v=1.05);const R=this.overscaling<=16?15*oi/(512*this.overscaling):0,N=this.segments.prepareSegment(10*A,this.layoutVertexArray,this.indexArray);let $,q,G,X,ie;this.e1=this.e2=-1,C&&($=o[A-2],ie=o[O].sub($)._unit()._perp());for(let ae=O;ae<A;ae++){if(G=ae===A-1?C?o[O+1]:void 0:o[ae+1],G&&o[ae].equals(G))continue;ie&&(X=ie),$&&(q=$),$=o[ae],ie=G?G.sub($)._unit()._perp():X,X=X||ie;let be=X.add(ie);be.x===0&&be.y===0||be._unit();const pe=X.x*ie.x+X.y*ie.y,ye=be.x*ie.x+be.y*ie.y,Ee=ye!==0?1/ye:1/0,Ne=2*Math.sqrt(2-2*ye),tt=ye<m9&&q&&G,St=X.x*ie.y-X.y*ie.x>0;if(tt&&ae>O){const mt=$.dist(q);if(mt>2*R){const ct=$.sub($.sub(q)._mult(R/mt)._round());this.updateDistance(q,ct),this.addCurrentVertex(ct,X,0,0,N),q=ct}}const Qe=q&&G;let Ze=Qe?p:C?"butt":y;if(Qe&&Ze==="round"&&(Ee<w?Ze="miter":Ee<=2&&(Ze="fakeround")),Ze==="miter"&&Ee>v&&(Ze="bevel"),Ze==="bevel"&&(Ee>2&&(Ze="flipbevel"),Ee<v&&(Ze="miter")),q&&this.updateDistance(q,$),Ze==="miter")be._mult(Ee),this.addCurrentVertex($,be,0,0,N);else if(Ze==="flipbevel"){if(Ee>100)be=ie.mult(-1);else{const mt=Ee*X.add(ie).mag()/X.sub(ie).mag();be._perp()._mult(mt*(St?-1:1))}this.addCurrentVertex($,be,0,0,N),this.addCurrentVertex($,be.mult(-1),0,0,N)}else if(Ze==="bevel"||Ze==="fakeround"){const mt=-Math.sqrt(Ee*Ee-1),ct=St?mt:0,rt=St?0:mt;if(q&&this.addCurrentVertex($,X,ct,rt,N),Ze==="fakeround"){const De=Math.round(180*Ne/Math.PI/20);for(let yt=1;yt<De;yt++){let ft=yt/De;if(ft!==.5){const Pn=ft-.5;ft+=ft*Pn*(ft-1)*((1.0904+pe*(pe*(3.55645-1.43519*pe)-3.2452))*Pn*Pn+(.848013+pe*(.215638*pe-1.06021)))}const It=ie.sub(X)._mult(ft)._add(X)._unit()._mult(St?-1:1);this.addHalfVertex($,It.x,It.y,!1,St,0,N)}}G&&this.addCurrentVertex($,ie,-ct,-rt,N)}else if(Ze==="butt")this.addCurrentVertex($,be,0,0,N);else if(Ze==="square"){const mt=q?1:-1;this.addCurrentVertex($,be,mt,mt,N)}else Ze==="round"&&(q&&(this.addCurrentVertex($,X,0,0,N),this.addCurrentVertex($,X,1,1,N,!0)),G&&(this.addCurrentVertex($,ie,-1,-1,N,!0),this.addCurrentVertex($,ie,0,0,N)));if(tt&&ae<A-1){const mt=$.dist(G);if(mt>2*R){const ct=$.add(G.sub($)._mult(R/mt)._round());this.updateDistance($,ct),this.addCurrentVertex(ct,ie,0,0,N),$=ct}}}}addCurrentVertex(o,h,p,y,v,w=!1){const C=h.y*y-h.x,A=-h.y-h.x*y;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,w,!1,p,v),this.addHalfVertex(o,C,A,w,!0,-y,v),this.distance>US/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,y,v,w))}addHalfVertex({x:o,y:h},p,y,v,w,C,A){const O=.5*(this.lineClips?this.scaledDistance*(US-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(v?1:0),(h<<1)+(w?1:0),Math.round(63*p)+128,Math.round(63*y)+128,1+(C===0?0:C<0?-1:1)|(63&O)<<2,O>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const R=A.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),A.primitiveLength++),w?this.e2=R:this.e1=R}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,h){this.distance+=o.dist(h),this.updateScaledDistance()}}let HS,qS;ot("LineBucket",N_,{omit:["layers","patternFeatures"]});var WS={get paint(){return qS=qS||new x({"line-opacity":new Et(we.paint_line["line-opacity"]),"line-color":new Et(we.paint_line["line-color"]),"line-translate":new dt(we.paint_line["line-translate"]),"line-translate-anchor":new dt(we.paint_line["line-translate-anchor"]),"line-width":new Et(we.paint_line["line-width"]),"line-gap-width":new Et(we.paint_line["line-gap-width"]),"line-offset":new Et(we.paint_line["line-offset"]),"line-blur":new Et(we.paint_line["line-blur"]),"line-dasharray":new Pu(we.paint_line["line-dasharray"]),"line-pattern":new Au(we.paint_line["line-pattern"]),"line-gradient":new Ld(we.paint_line["line-gradient"])})},get layout(){return HS=HS||new x({"line-cap":new dt(we.layout_line["line-cap"]),"line-join":new Et(we.layout_line["line-join"]),"line-miter-limit":new dt(we.layout_line["line-miter-limit"]),"line-round-limit":new dt(we.layout_line["line-round-limit"]),"line-sort-key":new Et(we.layout_line["line-sort-key"])})}};class g9 extends Et{possiblyEvaluate(o,h){return h=new Ln(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,y){return h=Me({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,y)}}let Nm;class y9 extends d{constructor(o){super(o,WS),this.gradientVersion=0,Nm||(Nm=new g9(WS.paint.properties["line-width"].specification),Nm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Ia,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,h){super.recalculate(o,h),this.paint._values["line-floorwidth"]=Nm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new N_(o)}queryRadius(o){const h=o,p=GS(Fd("line-width",this,h),Fd("line-gap-width",this,h)),y=Fd("line-offset",this,h);return p/2+Math.abs(y)+Im(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,y,v,w,C){const A=Dm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,C),O=C/2*GS(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),R=this.paint.get("line-offset").evaluate(h,p);return R&&(y=function(N,$){const q=[];for(let G=0;G<N.length;G++){const X=N[G],ie=[];for(let ae=0;ae<X.length;ae++){const be=X[ae-1],pe=X[ae],ye=X[ae+1],Ee=ae===0?new E(0,0):pe.sub(be)._unit()._perp(),Ne=ae===X.length-1?new E(0,0):ye.sub(pe)._unit()._perp(),tt=Ee._add(Ne)._unit(),St=tt.x*Ne.x+tt.y*Ne.y;St!==0&&tt._mult(1/St),ie.push(tt._mult($)._add(pe))}q.push(ie)}return q}(y,R*C)),function(N,$,q){for(let G=0;G<$.length;G++){const X=$[G];if(N.length>=3){for(let ie=0;ie<X.length;ie++)if(Nu(N,X[ie]))return!0}if(C7(N,X,q))return!0}return!1}(A,y,O)}isTileClipped(){return!0}}function GS(c,o){return o>0?o+2*c:c}const _9=M([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),b9=M([{name:"a_projected_pos",components:3,type:"Float32"}],4);M([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const x9=M([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);M([{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 ZS=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),v9=M([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function w9(c,o,h){return c.sections.forEach(p=>{p.text=function(y,v,w){const C=v.layout.get("text-transform").evaluate(w,{});return C==="uppercase"?y=y.toLocaleUpperCase():C==="lowercase"&&(y=y.toLocaleLowerCase()),_r.applyArabicShaping&&(y=_r.applyArabicShaping(y)),y}(p.text,o,h)}),c}M([{name:"triangle",components:3,type:"Uint16"}]),M([{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"}]),M([{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"}]),M([{type:"Float32",name:"offsetX"}]),M([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),M([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Gd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var li=24,YS=Tn,XS=function(c,o,h,p,y){var v,w,C=8*y-p-1,A=(1<<C)-1,O=A>>1,R=-7,N=y-1,$=-1,q=c[o+N];for(N+=$,v=q&(1<<-R)-1,q>>=-R,R+=C;R>0;v=256*v+c[o+N],N+=$,R-=8);for(w=v&(1<<-R)-1,v>>=-R,R+=p;R>0;w=256*w+c[o+N],N+=$,R-=8);if(v===0)v=1-O;else{if(v===A)return w?NaN:1/0*(q?-1:1);w+=Math.pow(2,p),v-=O}return(q?-1:1)*w*Math.pow(2,v-p)},KS=function(c,o,h,p,y,v){var w,C,A,O=8*v-y-1,R=(1<<O)-1,N=R>>1,$=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,q=0,G=1,X=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(C=isNaN(o)?1:0,w=R):(w=Math.floor(Math.log(o)/Math.LN2),o*(A=Math.pow(2,-w))<1&&(w--,A*=2),(o+=w+N>=1?$/A:$*Math.pow(2,1-N))*A>=2&&(w++,A/=2),w+N>=R?(C=0,w=R):w+N>=1?(C=(o*A-1)*Math.pow(2,y),w+=N):(C=o*Math.pow(2,N-1)*Math.pow(2,y),w=0));y>=8;c[h+q]=255&C,q+=G,C/=256,y-=8);for(w=w<<y|C,O+=y;O>0;c[h+q]=255&w,q+=G,w/=256,O-=8);c[h+q-G]|=128*X};function Tn(c){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(c)?c:new Uint8Array(c||0),this.pos=0,this.type=0,this.length=this.buf.length}Tn.Varint=0,Tn.Fixed64=1,Tn.Bytes=2,Tn.Fixed32=5;var B_=4294967296,JS=1/B_,QS=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ea(c){return c.type===Tn.Bytes?c.readVarint()+c.pos:c.pos+1}function $u(c,o,h){return h?4294967296*o+(c>>>0):4294967296*(o>>>0)+(c>>>0)}function eE(c,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var y=h.pos-1;y>=c;y--)h.buf[y+p]=h.buf[y]}function k9(c,o){for(var h=0;h<c.length;h++)o.writeVarint(c[h])}function S9(c,o){for(var h=0;h<c.length;h++)o.writeSVarint(c[h])}function E9(c,o){for(var h=0;h<c.length;h++)o.writeFloat(c[h])}function C9(c,o){for(var h=0;h<c.length;h++)o.writeDouble(c[h])}function T9(c,o){for(var h=0;h<c.length;h++)o.writeBoolean(c[h])}function M9(c,o){for(var h=0;h<c.length;h++)o.writeFixed32(c[h])}function A9(c,o){for(var h=0;h<c.length;h++)o.writeSFixed32(c[h])}function P9(c,o){for(var h=0;h<c.length;h++)o.writeFixed64(c[h])}function I9(c,o){for(var h=0;h<c.length;h++)o.writeSFixed64(c[h])}function Bm(c,o){return(c[o]|c[o+1]<<8|c[o+2]<<16)+16777216*c[o+3]}function ju(c,o,h){c[h]=o,c[h+1]=o>>>8,c[h+2]=o>>>16,c[h+3]=o>>>24}function tE(c,o){return(c[o]|c[o+1]<<8|c[o+2]<<16)+(c[o+3]<<24)}Tn.prototype={destroy:function(){this.buf=null},readFields:function(c,o,h){for(h=h||this.length;this.pos<h;){var p=this.readVarint(),y=p>>3,v=this.pos;this.type=7&p,c(y,o,this),this.pos===v&&this.skip(p)}return o},readMessage:function(c,o){return this.readFields(c,o,this.readVarint()+this.pos)},readFixed32:function(){var c=Bm(this.buf,this.pos);return this.pos+=4,c},readSFixed32:function(){var c=tE(this.buf,this.pos);return this.pos+=4,c},readFixed64:function(){var c=Bm(this.buf,this.pos)+Bm(this.buf,this.pos+4)*B_;return this.pos+=8,c},readSFixed64:function(){var c=Bm(this.buf,this.pos)+tE(this.buf,this.pos+4)*B_;return this.pos+=8,c},readFloat:function(){var c=XS(this.buf,this.pos,!0,23,4);return this.pos+=4,c},readDouble:function(){var c=XS(this.buf,this.pos,!0,52,8);return this.pos+=8,c},readVarint:function(c){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(y,v,w){var C,A,O=w.buf;if(C=(112&(A=O[w.pos++]))>>4,A<128||(C|=(127&(A=O[w.pos++]))<<3,A<128)||(C|=(127&(A=O[w.pos++]))<<10,A<128)||(C|=(127&(A=O[w.pos++]))<<17,A<128)||(C|=(127&(A=O[w.pos++]))<<24,A<128)||(C|=(1&(A=O[w.pos++]))<<31,A<128))return $u(y,C,v);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[this.pos]))<<28,c,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var c=this.readVarint();return c%2==1?(c+1)/-2:c/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var c=this.readVarint()+this.pos,o=this.pos;return this.pos=c,c-o>=12&&QS?function(h,p,y){return QS.decode(h.subarray(p,y))}(this.buf,o,c):function(h,p,y){for(var v="",w=p;w<y;){var C,A,O,R=h[w],N=null,$=R>239?4:R>223?3:R>191?2:1;if(w+$>y)break;$===1?R<128&&(N=R):$===2?(192&(C=h[w+1]))==128&&(N=(31&R)<<6|63&C)<=127&&(N=null):$===3?(A=h[w+2],(192&(C=h[w+1]))==128&&(192&A)==128&&((N=(15&R)<<12|(63&C)<<6|63&A)<=2047||N>=55296&&N<=57343)&&(N=null)):$===4&&(A=h[w+2],O=h[w+3],(192&(C=h[w+1]))==128&&(192&A)==128&&(192&O)==128&&((N=(15&R)<<18|(63&C)<<12|(63&A)<<6|63&O)<=65535||N>=1114112)&&(N=null)),N===null?(N=65533,$=1):N>65535&&(N-=65536,v+=String.fromCharCode(N>>>10&1023|55296),N=56320|1023&N),v+=String.fromCharCode(N),w+=$}return v}(this.buf,o,c)},readBytes:function(){var c=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,c);return this.pos=c,o},readPackedVarint:function(c,o){if(this.type!==Tn.Bytes)return c.push(this.readVarint(o));var h=ea(this);for(c=c||[];this.pos<h;)c.push(this.readVarint(o));return c},readPackedSVarint:function(c){if(this.type!==Tn.Bytes)return c.push(this.readSVarint());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readSVarint());return c},readPackedBoolean:function(c){if(this.type!==Tn.Bytes)return c.push(this.readBoolean());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readBoolean());return c},readPackedFloat:function(c){if(this.type!==Tn.Bytes)return c.push(this.readFloat());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readFloat());return c},readPackedDouble:function(c){if(this.type!==Tn.Bytes)return c.push(this.readDouble());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readDouble());return c},readPackedFixed32:function(c){if(this.type!==Tn.Bytes)return c.push(this.readFixed32());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readFixed32());return c},readPackedSFixed32:function(c){if(this.type!==Tn.Bytes)return c.push(this.readSFixed32());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readSFixed32());return c},readPackedFixed64:function(c){if(this.type!==Tn.Bytes)return c.push(this.readFixed64());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readFixed64());return c},readPackedSFixed64:function(c){if(this.type!==Tn.Bytes)return c.push(this.readSFixed64());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readSFixed64());return c},skip:function(c){var o=7&c;if(o===Tn.Varint)for(;this.buf[this.pos++]>127;);else if(o===Tn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Tn.Fixed32)this.pos+=4;else{if(o!==Tn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(c,o){this.writeVarint(c<<3|o)},realloc:function(c){for(var o=this.length||16;o<this.pos+c;)o*=2;if(o!==this.length){var h=new Uint8Array(o);h.set(this.buf),this.buf=h,this.length=o}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(c){this.realloc(4),ju(this.buf,c,this.pos),this.pos+=4},writeSFixed32:function(c){this.realloc(4),ju(this.buf,c,this.pos),this.pos+=4},writeFixed64:function(c){this.realloc(8),ju(this.buf,-1&c,this.pos),ju(this.buf,Math.floor(c*JS),this.pos+4),this.pos+=8},writeSFixed64:function(c){this.realloc(8),ju(this.buf,-1&c,this.pos),ju(this.buf,Math.floor(c*JS),this.pos+4),this.pos+=8},writeVarint:function(c){(c=+c||0)>268435455||c<0?function(o,h){var p,y;if(o>=0?(p=o%4294967296|0,y=o/4294967296|0):(y=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,y=y+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(v,w,C){C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,C.buf[C.pos]=127&(v>>>=7)}(p,0,h),function(v,w){var C=(7&v)<<4;w.buf[w.pos++]|=C|((v>>>=3)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v)))))}(y,h)}(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))},writeSVarint:function(c){this.writeVarint(c<0?2*-c-1:2*c)},writeBoolean:function(c){this.writeVarint(!!c)},writeString:function(c){c=String(c),this.realloc(4*c.length),this.pos++;var o=this.pos;this.pos=function(p,y,v){for(var w,C,A=0;A<y.length;A++){if((w=y.charCodeAt(A))>55295&&w<57344){if(!C){w>56319||A+1===y.length?(p[v++]=239,p[v++]=191,p[v++]=189):C=w;continue}if(w<56320){p[v++]=239,p[v++]=191,p[v++]=189,C=w;continue}w=C-55296<<10|w-56320|65536,C=null}else C&&(p[v++]=239,p[v++]=191,p[v++]=189,C=null);w<128?p[v++]=w:(w<2048?p[v++]=w>>6|192:(w<65536?p[v++]=w>>12|224:(p[v++]=w>>18|240,p[v++]=w>>12&63|128),p[v++]=w>>6&63|128),p[v++]=63&w|128)}return v}(this.buf,c,this.pos);var h=this.pos-o;h>=128&&eE(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(c){this.realloc(4),KS(this.buf,c,this.pos,!0,23,4),this.pos+=4},writeDouble:function(c){this.realloc(8),KS(this.buf,c,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var o=c.length;this.writeVarint(o),this.realloc(o);for(var h=0;h<o;h++)this.buf[this.pos++]=c[h]},writeRawMessage:function(c,o){this.pos++;var h=this.pos;c(o,this);var p=this.pos-h;p>=128&&eE(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(c,o,h){this.writeTag(c,Tn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(c,o){o.length&&this.writeMessage(c,k9,o)},writePackedSVarint:function(c,o){o.length&&this.writeMessage(c,S9,o)},writePackedBoolean:function(c,o){o.length&&this.writeMessage(c,T9,o)},writePackedFloat:function(c,o){o.length&&this.writeMessage(c,E9,o)},writePackedDouble:function(c,o){o.length&&this.writeMessage(c,C9,o)},writePackedFixed32:function(c,o){o.length&&this.writeMessage(c,M9,o)},writePackedSFixed32:function(c,o){o.length&&this.writeMessage(c,A9,o)},writePackedFixed64:function(c,o){o.length&&this.writeMessage(c,P9,o)},writePackedSFixed64:function(c,o){o.length&&this.writeMessage(c,I9,o)},writeBytesField:function(c,o){this.writeTag(c,Tn.Bytes),this.writeBytes(o)},writeFixed32Field:function(c,o){this.writeTag(c,Tn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(c,o){this.writeTag(c,Tn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(c,o){this.writeTag(c,Tn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(c,o){this.writeTag(c,Tn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(c,o){this.writeTag(c,Tn.Varint),this.writeVarint(o)},writeSVarintField:function(c,o){this.writeTag(c,Tn.Varint),this.writeSVarint(o)},writeStringField:function(c,o){this.writeTag(c,Tn.Bytes),this.writeString(o)},writeFloatField:function(c,o){this.writeTag(c,Tn.Fixed32),this.writeFloat(o)},writeDoubleField:function(c,o){this.writeTag(c,Tn.Fixed64),this.writeDouble(o)},writeBooleanField:function(c,o){this.writeVarintField(c,!!o)}};var F_=g(YS);const V_=3;function D9(c,o,h){c===1&&h.readMessage(O9,o)}function O9(c,o,h){if(c===3){const{id:p,bitmap:y,width:v,height:w,left:C,top:A,advance:O}=h.readMessage(z9,{});o.push({id:p,bitmap:new $d({width:v+2*V_,height:w+2*V_},y),metrics:{width:v,height:w,left:C,top:A,advance:O}})}}function z9(c,o,h){c===1?o.id=h.readVarint():c===2?o.bitmap=h.readBytes():c===3?o.width=h.readVarint():c===4?o.height=h.readVarint():c===5?o.left=h.readSVarint():c===6?o.top=h.readSVarint():c===7&&(o.advance=h.readVarint())}const nE=V_;function iE(c){let o=0,h=0;for(const w of c)o+=w.w*w.h,h=Math.max(h,w.w);c.sort((w,C)=>C.h-w.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let y=0,v=0;for(const w of c)for(let C=p.length-1;C>=0;C--){const A=p[C];if(!(w.w>A.w||w.h>A.h)){if(w.x=A.x,w.y=A.y,v=Math.max(v,w.y+w.h),y=Math.max(y,w.x+w.w),w.w===A.w&&w.h===A.h){const O=p.pop();C<p.length&&(p[C]=O)}else w.h===A.h?(A.x+=w.w,A.w-=w.w):w.w===A.w?(A.y+=w.h,A.h-=w.h):(p.push({x:A.x+w.w,y:A.y,w:A.w-w.w,h:w.h}),A.y+=w.h,A.h-=w.h);break}}return{w:y,h:v,fill:o/(y*v)||0}}const xr=1;class $_{constructor(o,{pixelRatio:h,version:p,stretchX:y,stretchY:v,content:w,textFitWidth:C,textFitHeight:A}){this.paddedRect=o,this.pixelRatio=h,this.stretchX=y,this.stretchY=v,this.content=w,this.version=p,this.textFitWidth=C,this.textFitHeight=A}get tl(){return[this.paddedRect.x+xr,this.paddedRect.y+xr]}get br(){return[this.paddedRect.x+this.paddedRect.w-xr,this.paddedRect.y+this.paddedRect.h-xr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*xr)/this.pixelRatio,(this.paddedRect.h-2*xr)/this.pixelRatio]}}class rE{constructor(o,h){const p={},y={};this.haveRenderCallbacks=[];const v=[];this.addImages(o,p,v),this.addImages(h,y,v);const{w,h:C}=iE(v),A=new rs({width:w||1,height:C||1});for(const O in o){const R=o[O],N=p[O].paddedRect;rs.copy(R.data,A,{x:0,y:0},{x:N.x+xr,y:N.y+xr},R.data)}for(const O in h){const R=h[O],N=y[O].paddedRect,$=N.x+xr,q=N.y+xr,G=R.data.width,X=R.data.height;rs.copy(R.data,A,{x:0,y:0},{x:$,y:q},R.data),rs.copy(R.data,A,{x:0,y:X-1},{x:$,y:q-1},{width:G,height:1}),rs.copy(R.data,A,{x:0,y:0},{x:$,y:q+X},{width:G,height:1}),rs.copy(R.data,A,{x:G-1,y:0},{x:$-1,y:q},{width:1,height:X}),rs.copy(R.data,A,{x:0,y:0},{x:$+G,y:q},{width:1,height:X})}this.image=A,this.iconPositions=p,this.patternPositions=y}addImages(o,h,p){for(const y in o){const v=o[y],w={x:0,y:0,w:v.data.width+2*xr,h:v.data.height+2*xr};p.push(w),h[y]=new $_(w,v),v.hasRenderCallback&&this.haveRenderCallbacks.push(y)}}patchUpdatedImages(o,h){o.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const p in o.updatedImages)this.patchUpdatedImage(this.iconPositions[p],o.getImage(p),h),this.patchUpdatedImage(this.patternPositions[p],o.getImage(p),h)}patchUpdatedImage(o,h,p){if(!o||!h||o.version===h.version)return;o.version=h.version;const[y,v]=o.tl;p.update(h.data,void 0,{x:y,y:v})}}var il;ot("ImagePosition",$_),ot("ImageAtlas",rE),u.ah=void 0,(il=u.ah||(u.ah={}))[il.none=0]="none",il[il.horizontal=1]="horizontal",il[il.vertical=2]="vertical",il[il.horizontalOnly=3]="horizontalOnly";const Zd=-17;class Yd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(o,h){const p=new Yd;return p.scale=o||1,p.fontStack=h,p}static forImage(o){const h=new Yd;return h.imageName=o,h}}class Uu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(o,h){const p=new Uu;for(let y=0;y<o.sections.length;y++){const v=o.sections[y];v.image?p.addImageSection(v):p.addTextSection(v,h)}return p}length(){return this.text.length}getSection(o){return this.sections[this.sectionIndex[o]]}getSectionIndex(o){return this.sectionIndex[o]}getCharCode(o){return this.text.charCodeAt(o)}verticalizePunctuation(){this.text=function(o){let h="";for(let p=0;p<o.length;p++){const y=o.charCodeAt(p+1)||null,v=o.charCodeAt(p-1)||null;h+=y&&Sm(y)&&!Gd[o[p+1]]||v&&Sm(v)&&!Gd[o[p-1]]||!Gd[o[p]]?o[p]:Gd[o[p]]}return h}(this.text)}trim(){let o=0;for(let p=0;p<this.text.length&&Vm[this.text.charCodeAt(p)];p++)o++;let h=this.text.length;for(let p=this.text.length-1;p>=0&&p>=o&&Vm[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(o,h),this.sectionIndex=this.sectionIndex.slice(o,h)}substring(o,h){const p=new Uu;return p.text=this.text.substring(o,h),p.sectionIndex=this.sectionIndex.slice(o,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,h)=>Math.max(o,this.sections[h].scale),0)}addTextSection(o,h){this.text+=o.text,this.sections.push(Yd.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let y=0;y<o.text.length;++y)this.sectionIndex.push(p)}addImageSection(o){const h=o.image?o.image.name:"";if(h.length===0)return void ht("Can't add FormattedSection with an empty image.");const p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push(Yd.forImage(h)),this.sectionIndex.push(this.sections.length-1)):ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Fm(c,o,h,p,y,v,w,C,A,O,R,N,$,q,G){const X=Uu.fromFeature(c,y);let ie;N===u.ah.vertical&&X.verticalizePunctuation();const{processBidirectionalText:ae,processStyledBidirectionalText:be}=_r;if(ae&&X.sections.length===1){ie=[];const Ee=ae(X.toString(),j_(X,O,v,o,p,q));for(const Ne of Ee){const tt=new Uu;tt.text=Ne,tt.sections=X.sections;for(let St=0;St<Ne.length;St++)tt.sectionIndex.push(0);ie.push(tt)}}else if(be){ie=[];const Ee=be(X.text,X.sectionIndex,j_(X,O,v,o,p,q));for(const Ne of Ee){const tt=new Uu;tt.text=Ne[0],tt.sectionIndex=Ne[1],tt.sections=X.sections,ie.push(tt)}}else ie=function(Ee,Ne){const tt=[],St=Ee.text;let Qe=0;for(const Ze of Ne)tt.push(Ee.substring(Qe,Ze)),Qe=Ze;return Qe<St.length&&tt.push(Ee.substring(Qe,St.length)),tt}(X,j_(X,O,v,o,p,q));const pe=[],ye={positionedLines:pe,text:X.toString(),top:R[1],bottom:R[1],left:R[0],right:R[0],writingMode:N,iconsInText:!1,verticalizable:!1};return function(Ee,Ne,tt,St,Qe,Ze,mt,ct,rt,De,yt,ft){let It=0,Pn=Zd,Mn=0,mi=0;const Ds=ct==="right"?1:ct==="left"?0:.5;let Ri=0;for(const ei of Qe){ei.trim();const yi=ei.getMaxScale(),Gi=(yi-1)*li,Li={positionedGlyphs:[],lineOffset:0};Ee.positionedLines[Ri]=Li;const cr=Li.positionedGlyphs;let Ni=0;if(!ei.length()){Pn+=Ze,++Ri;continue}for(let vr=0;vr<ei.length();vr++){const un=ei.getSection(vr),On=ei.getSectionIndex(vr),Vn=ei.getCharCode(vr);let jr=0,Yn=null,Gu=null,go=null,yo=li;const Os=!(rt===u.ah.horizontal||!yt&&!zd(Vn)||yt&&(Vm[Vn]||(gi=Vn,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(gi)))));if(un.imageName){const ls=St[un.imageName];if(!ls)continue;go=un.imageName,Ee.iconsInText=Ee.iconsInText||!0,Gu=ls.paddedRect;const Si=ls.displaySize;un.scale=un.scale*li/ft,Yn={width:Si[0],height:Si[1],left:xr,top:-nE,advance:Os?Si[1]:Si[0]},jr=Gi+(li-Si[1]*un.scale),yo=Yn.advance;const ta=Os?Si[0]*un.scale-li*yi:Si[1]*un.scale-li*yi;ta>0&&ta>Ni&&(Ni=ta)}else{const ls=tt[un.fontStack],Si=ls&&ls[Vn];if(Si&&Si.rect)Gu=Si.rect,Yn=Si.metrics;else{const ta=Ne[un.fontStack],tp=ta&&ta[Vn];if(!tp)continue;Yn=tp.metrics}jr=(yi-un.scale)*li}Os?(Ee.verticalizable=!0,cr.push({glyph:Vn,imageName:go,x:It,y:Pn+jr,vertical:Os,scale:un.scale,fontStack:un.fontStack,sectionIndex:On,metrics:Yn,rect:Gu}),It+=yo*un.scale+De):(cr.push({glyph:Vn,imageName:go,x:It,y:Pn+jr,vertical:Os,scale:un.scale,fontStack:un.fontStack,sectionIndex:On,metrics:Yn,rect:Gu}),It+=Yn.advance*un.scale+De)}cr.length!==0&&(Mn=Math.max(It-De,Mn),B9(cr,0,cr.length-1,Ds,Ni)),It=0;const as=Ze*yi+Ni;Li.lineOffset=Math.max(Ni,Gi),Pn+=as,mi=Math.max(as,mi),++Ri}var gi;const or=Pn-Zd,{horizontalAlign:ar,verticalAlign:lr}=U_(mt);(function(ei,yi,Gi,Li,cr,Ni,as,vr,un){const On=(yi-Gi)*cr;let Vn=0;Vn=Ni!==as?-vr*Li-Zd:(-Li*un+.5)*as;for(const jr of ei)for(const Yn of jr.positionedGlyphs)Yn.x+=On,Yn.y+=Vn})(Ee.positionedLines,Ds,ar,lr,Mn,mi,Ze,or,Qe.length),Ee.top+=-lr*or,Ee.bottom=Ee.top+or,Ee.left+=-ar*Mn,Ee.right=Ee.left+Mn}(ye,o,h,p,ie,w,C,A,N,O,$,G),!function(Ee){for(const Ne of Ee)if(Ne.positionedGlyphs.length!==0)return!1;return!0}(pe)&&ye}const Vm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},R9={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},L9={40:!0};function sE(c,o,h,p,y,v){if(o.imageName){const w=p[o.imageName];return w?w.displaySize[0]*o.scale*li/v+y:0}{const w=h[o.fontStack],C=w&&w[c];return C?C.metrics.advance*o.scale+y:0}}function oE(c,o,h,p){const y=Math.pow(c-o,2);return p?c<o?y/2:2*y:y+Math.abs(h)*h}function N9(c,o,h){let p=0;return c===10&&(p-=1e4),h&&(p+=150),c!==40&&c!==65288||(p+=50),o!==41&&o!==65289||(p+=50),p}function aE(c,o,h,p,y,v){let w=null,C=oE(o,h,y,v);for(const A of p){const O=oE(o-A.x,h,y,v)+A.badness;O<=C&&(w=A,C=O)}return{index:c,x:o,priorBreak:w,badness:C}}function lE(c){return c?lE(c.priorBreak).concat(c.index):[]}function j_(c,o,h,p,y,v){if(!c)return[];const w=[],C=function(N,$,q,G,X,ie){let ae=0;for(let be=0;be<N.length();be++){const pe=N.getSection(be);ae+=sE(N.getCharCode(be),pe,G,X,$,ie)}return ae/Math.max(1,Math.ceil(ae/q))}(c,o,h,p,y,v),A=c.text.indexOf("​")>=0;let O=0;for(let N=0;N<c.length();N++){const $=c.getSection(N),q=c.getCharCode(N);if(Vm[q]||(O+=sE(q,$,p,y,o,v)),N<c.length()-1){const G=!((R=q)<11904)&&(!!Jt["CJK Compatibility Forms"](R)||!!Jt["CJK Compatibility"](R)||!!Jt["CJK Strokes"](R)||!!Jt["CJK Symbols and Punctuation"](R)||!!Jt["Enclosed CJK Letters and Months"](R)||!!Jt["Halfwidth and Fullwidth Forms"](R)||!!Jt["Ideographic Description Characters"](R)||!!Jt["Vertical Forms"](R)||km.test(String.fromCodePoint(R)));(R9[q]||G||$.imageName||N!==c.length()-2&&L9[c.getCharCode(N+1)])&&w.push(aE(N+1,O,C,w,N9(q,c.getCharCode(N+1),G&&A),!1))}}var R;return lE(aE(c.length(),O,C,w,0,!0))}function U_(c){let o=.5,h=.5;switch(c){case"right":case"top-right":case"bottom-right":o=1;break;case"left":case"top-left":case"bottom-left":o=0}switch(c){case"bottom":case"bottom-right":case"bottom-left":h=1;break;case"top":case"top-right":case"top-left":h=0}return{horizontalAlign:o,verticalAlign:h}}function B9(c,o,h,p,y){if(!p&&!y)return;const v=c[h],w=(c[h].x+v.metrics.advance*v.scale)*p;for(let C=o;C<=h;C++)c[C].x-=w,c[C].y+=y}function F9(c,o,h){const{horizontalAlign:p,verticalAlign:y}=U_(h),v=o[0]-c.displaySize[0]*p,w=o[1]-c.displaySize[1]*y;return{image:c,top:w,bottom:w+c.displaySize[1],left:v,right:v+c.displaySize[0]}}function cE(c){var o,h;let p=c.left,y=c.top,v=c.right-p,w=c.bottom-y;const C=(o=c.image.textFitWidth)!==null&&o!==void 0?o:"stretchOrShrink",A=(h=c.image.textFitHeight)!==null&&h!==void 0?h:"stretchOrShrink",O=(c.image.content[2]-c.image.content[0])/(c.image.content[3]-c.image.content[1]);if(A==="proportional"){if(C==="stretchOnly"&&v/w<O||C==="proportional"){const R=Math.ceil(w*O);p*=R/v,v=R}}else if(C==="proportional"&&A==="stretchOnly"&&O!==0&&v/w>O){const R=Math.ceil(v/O);y*=R/w,w=R}return{x1:p,y1:y,x2:p+v,y2:y+w}}function uE(c,o,h,p,y,v){const w=c.image;let C;if(w.content){const ie=w.content,ae=w.pixelRatio||1;C=[ie[0]/ae,ie[1]/ae,w.displaySize[0]-ie[2]/ae,w.displaySize[1]-ie[3]/ae]}const A=o.left*v,O=o.right*v;let R,N,$,q;h==="width"||h==="both"?(q=y[0]+A-p[3],N=y[0]+O+p[1]):(q=y[0]+(A+O-w.displaySize[0])/2,N=q+w.displaySize[0]);const G=o.top*v,X=o.bottom*v;return h==="height"||h==="both"?(R=y[1]+G-p[0],$=y[1]+X+p[2]):(R=y[1]+(G+X-w.displaySize[1])/2,$=R+w.displaySize[1]),{image:w,top:R,right:N,bottom:$,left:q,collisionPadding:C}}const Xd=255,mo=128,rl=Xd*mo;function hE(c,o){const{expression:h}=o;if(h.kind==="constant")return{kind:"constant",layoutSize:h.evaluate(new Ln(c+1))};if(h.kind==="source")return{kind:"source"};{const{zoomStops:p,interpolationType:y}=h;let v=0;for(;v<p.length&&p[v]<=c;)v++;v=Math.max(0,v-1);let w=v;for(;w<p.length&&p[w]<c+1;)w++;w=Math.min(p.length-1,w);const C=p[v],A=p[w];return h.kind==="composite"?{kind:"composite",minZoom:C,maxZoom:A,interpolationType:y}:{kind:"camera",minZoom:C,maxZoom:A,minSize:h.evaluate(new Ln(C)),maxSize:h.evaluate(new Ln(A)),interpolationType:y}}}function H_(c,o,h){let p="never";const y=c.get(o);return y?p=y:c.get(h)&&(p="always"),p}const V9=nl.VectorTileFeature.types,$9=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function $m(c,o,h,p,y,v,w,C,A,O,R,N,$){const q=C?Math.min(rl,Math.round(C[0])):0,G=C?Math.min(rl,Math.round(C[1])):0;c.emplaceBack(o,h,Math.round(32*p),Math.round(32*y),v,w,(q<<1)+(A?1:0),G,16*O,16*R,256*N,256*$)}function q_(c,o,h){c.emplaceBack(o.x,o.y,h),c.emplaceBack(o.x,o.y,h),c.emplaceBack(o.x,o.y,h),c.emplaceBack(o.x,o.y,h)}function j9(c){for(const o of c.sections)if(b_(o.text))return!0;return!1}class W_{constructor(o){this.layoutVertexArray=new Du,this.indexArray=new is,this.programConfigurations=o,this.segments=new Qt,this.dynamicLayoutVertexArray=new Nd,this.opacityVertexArray=new Vr,this.hasVisibleVertices=!1,this.placedSymbolArray=new Nn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(o,h,p,y){this.isEmpty()||(p&&(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,_9.members),this.indexBuffer=o.createIndexBuffer(this.indexArray,h),this.dynamicLayoutVertexBuffer=o.createVertexBuffer(this.dynamicLayoutVertexArray,b9.members,!0),this.opacityVertexBuffer=o.createVertexBuffer(this.opacityVertexArray,$9,!0),this.opacityVertexBuffer.itemSize=1),(p||y)&&this.programConfigurations.upload(o))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ot("SymbolBuffers",W_);class G_{constructor(o,h,p){this.layoutVertexArray=new o,this.layoutAttributes=h,this.indexArray=new p,this.segments=new Qt,this.collisionVertexArray=new po}upload(o){this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=o.createVertexBuffer(this.collisionVertexArray,x9.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ot("CollisionBuffers",G_);class Hu{constructor(o){this.collisionBoxArray=o.collisionBoxArray,this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(w=>w.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=C_([]),this.placementViewportMatrix=C_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hE(this.zoom,h["text-size"]),this.iconSizeData=hE(this.zoom,h["icon-size"]);const p=this.layers[0].layout,y=p.get("symbol-sort-key"),v=p.get("symbol-z-order");this.canOverlap=H_(p,"text-overlap","text-allow-overlap")!=="never"||H_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(w=>u.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new W_(new ic(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new W_(new ic(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new Bn,this.lineVertexArray=new Ii,this.symbolInstances=new Yt,this.textAnchorOffsets=new Fn}calculateGlyphDependencies(o,h,p,y,v){for(let w=0;w<o.length;w++)if(h[o.charCodeAt(w)]=!0,(p||y)&&v){const C=Gd[o.charAt(w)];C&&(h[C.charCodeAt(0)]=!0)}}populate(o,h,p){const y=this.layers[0],v=y.layout,w=v.get("text-font"),C=v.get("text-field"),A=v.get("icon-image"),O=(C.value.kind!=="constant"||C.value.value instanceof fr&&!C.value.value.isEmpty()||C.value.value.toString().length>0)&&(w.value.kind!=="constant"||w.value.value.length>0),R=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,N=v.get("symbol-sort-key");if(this.features=[],!O&&!R)return;const $=h.iconDependencies,q=h.glyphDependencies,G=h.availableImages,X=new Ln(this.zoom);for(const{feature:ie,id:ae,index:be,sourceLayerIndex:pe}of o){const ye=y._featureFilter.needGeometry,Ee=sc(ie,ye);if(!y._featureFilter.filter(X,Ee,p))continue;let Ne,tt;if(ye||(Ee.geometry=rc(ie)),O){const Qe=y.getValueAndResolveTokens("text-field",Ee,p,G),Ze=fr.factory(Qe),mt=this.hasRTLText=this.hasRTLText||j9(Ze);(!mt||_r.getRTLTextPluginStatus()==="unavailable"||mt&&_r.isParsed())&&(Ne=w9(Ze,y,Ee))}if(R){const Qe=y.getValueAndResolveTokens("icon-image",Ee,p,G);tt=Qe instanceof gr?Qe:gr.fromString(Qe)}if(!Ne&&!tt)continue;const St=this.sortFeaturesByKey?N.evaluate(Ee,{},p):void 0;if(this.features.push({id:ae,text:Ne,icon:tt,index:be,sourceLayerIndex:pe,geometry:Ee.geometry,properties:ie.properties,type:V9[ie.type],sortKey:St}),tt&&($[tt.name]=!0),Ne){const Qe=w.evaluate(Ee,{},p).join(","),Ze=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(u.ah.vertical)>=0;for(const mt of Ne.sections)if(mt.image)$[mt.image.name]=!0;else{const ct=Dd(Ne.toString()),rt=mt.fontStack||Qe,De=q[rt]=q[rt]||{};this.calculateGlyphDependencies(mt.text,De,Ze,this.allowVerticalPlacement,ct)}}}v.get("symbol-placement")==="line"&&(this.features=function(ie){const ae={},be={},pe=[];let ye=0;function Ee(Qe){pe.push(ie[Qe]),ye++}function Ne(Qe,Ze,mt){const ct=be[Qe];return delete be[Qe],be[Ze]=ct,pe[ct].geometry[0].pop(),pe[ct].geometry[0]=pe[ct].geometry[0].concat(mt[0]),ct}function tt(Qe,Ze,mt){const ct=ae[Ze];return delete ae[Ze],ae[Qe]=ct,pe[ct].geometry[0].shift(),pe[ct].geometry[0]=mt[0].concat(pe[ct].geometry[0]),ct}function St(Qe,Ze,mt){const ct=mt?Ze[0][Ze[0].length-1]:Ze[0][0];return`${Qe}:${ct.x}:${ct.y}`}for(let Qe=0;Qe<ie.length;Qe++){const Ze=ie[Qe],mt=Ze.geometry,ct=Ze.text?Ze.text.toString():null;if(!ct){Ee(Qe);continue}const rt=St(ct,mt),De=St(ct,mt,!0);if(rt in be&&De in ae&&be[rt]!==ae[De]){const yt=tt(rt,De,mt),ft=Ne(rt,De,pe[yt].geometry);delete ae[rt],delete be[De],be[St(ct,pe[ft].geometry,!0)]=ft,pe[yt].geometry=null}else rt in be?Ne(rt,De,mt):De in ae?tt(rt,De,mt):(Ee(Qe),ae[rt]=ye-1,be[De]=ye-1)}return pe.filter(Qe=>Qe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ie,ae)=>ie.sortKey-ae.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,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(o,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let y=o.dist(h[o.segment+1]),v=o.dist(h[o.segment]);const w={};for(let C=o.segment+1;C<h.length;C++)w[C]={x:h[C].x,y:h[C].y,tileUnitDistanceFromAnchor:y},C<h.length-1&&(y+=h[C+1].dist(h[C]));for(let C=o.segment||0;C>=0;C--)w[C]={x:h[C].x,y:h[C].y,tileUnitDistanceFromAnchor:v},C>0&&(v+=h[C-1].dist(h[C]));for(let C=0;C<h.length;C++){const A=w[C];this.lineVertexArray.emplaceBack(A.x,A.y,A.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(o,h,p,y,v,w,C,A,O,R,N,$){const q=o.indexArray,G=o.layoutVertexArray,X=o.segments.prepareSegment(4*h.length,G,q,this.canOverlap?w.sortKey:void 0),ie=this.glyphOffsetArray.length,ae=X.vertexLength,be=this.allowVerticalPlacement&&C===u.ah.vertical?Math.PI/2:0,pe=w.text&&w.text.sections;for(let ye=0;ye<h.length;ye++){const{tl:Ee,tr:Ne,bl:tt,br:St,tex:Qe,pixelOffsetTL:Ze,pixelOffsetBR:mt,minFontScaleX:ct,minFontScaleY:rt,glyphOffset:De,isSDF:yt,sectionIndex:ft}=h[ye],It=X.vertexLength,Pn=De[1];$m(G,A.x,A.y,Ee.x,Pn+Ee.y,Qe.x,Qe.y,p,yt,Ze.x,Ze.y,ct,rt),$m(G,A.x,A.y,Ne.x,Pn+Ne.y,Qe.x+Qe.w,Qe.y,p,yt,mt.x,Ze.y,ct,rt),$m(G,A.x,A.y,tt.x,Pn+tt.y,Qe.x,Qe.y+Qe.h,p,yt,Ze.x,mt.y,ct,rt),$m(G,A.x,A.y,St.x,Pn+St.y,Qe.x+Qe.w,Qe.y+Qe.h,p,yt,mt.x,mt.y,ct,rt),q_(o.dynamicLayoutVertexArray,A,be),q.emplaceBack(It,It+1,It+2),q.emplaceBack(It+1,It+2,It+3),X.vertexLength+=4,X.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(De[0]),ye!==h.length-1&&ft===h[ye+1].sectionIndex||o.programConfigurations.populatePaintArrays(G.length,w,w.index,{},$,pe&&pe[ft])}o.placedSymbolArray.emplaceBack(A.x,A.y,ie,this.glyphOffsetArray.length-ie,ae,O,R,A.segment,p?p[0]:0,p?p[1]:0,y[0],y[1],C,0,!1,0,N)}_addCollisionDebugVertex(o,h,p,y,v,w){return h.emplaceBack(0,0),o.emplaceBack(p.x,p.y,y,v,Math.round(w.x),Math.round(w.y))}addCollisionDebugVertices(o,h,p,y,v,w,C){const A=v.segments.prepareSegment(4,v.layoutVertexArray,v.indexArray),O=A.vertexLength,R=v.layoutVertexArray,N=v.collisionVertexArray,$=C.anchorX,q=C.anchorY;this._addCollisionDebugVertex(R,N,w,$,q,new E(o,h)),this._addCollisionDebugVertex(R,N,w,$,q,new E(p,h)),this._addCollisionDebugVertex(R,N,w,$,q,new E(p,y)),this._addCollisionDebugVertex(R,N,w,$,q,new E(o,y)),A.vertexLength+=4;const G=v.indexArray;G.emplaceBack(O,O+1),G.emplaceBack(O+1,O+2),G.emplaceBack(O+2,O+3),G.emplaceBack(O+3,O),A.primitiveLength+=4}addDebugCollisionBoxes(o,h,p,y){for(let v=o;v<h;v++){const w=this.collisionBoxArray.get(v);this.addCollisionDebugVertices(w.x1,w.y1,w.x2,w.y2,y?this.textCollisionBox:this.iconCollisionBox,w.anchorPoint,p)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new G_($r,ZS.members,ki),this.iconCollisionBox=new G_($r,ZS.members,ki);for(let o=0;o<this.symbolInstances.length;o++){const h=this.symbolInstances.get(o);this.addDebugCollisionBoxes(h.textBoxStartIndex,h.textBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.iconBoxStartIndex,h.iconBoxEndIndex,h,!1),this.addDebugCollisionBoxes(h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,!1)}}_deserializeCollisionBoxesForSymbol(o,h,p,y,v,w,C,A,O){const R={};for(let N=h;N<p;N++){const $=o.get(N);R.textBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.textFeatureIndex=$.featureIndex;break}for(let N=y;N<v;N++){const $=o.get(N);R.verticalTextBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.verticalTextFeatureIndex=$.featureIndex;break}for(let N=w;N<C;N++){const $=o.get(N);R.iconBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.iconFeatureIndex=$.featureIndex;break}for(let N=A;N<O;N++){const $=o.get(N);R.verticalIconBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.verticalIconFeatureIndex=$.featureIndex;break}return R}deserializeCollisionBoxes(o){this.collisionArrays=[];for(let h=0;h<this.symbolInstances.length;h++){const p=this.symbolInstances.get(h);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(o,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}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(o,h){const p=o.placedSymbolArray.get(h),y=p.vertexStartIndex+4*p.numGlyphs;for(let v=p.vertexStartIndex;v<y;v+=4)o.indexArray.emplaceBack(v,v+1,v+2),o.indexArray.emplaceBack(v+1,v+2,v+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),y=[],v=[],w=[];for(let C=0;C<this.symbolInstances.length;++C){w.push(C);const A=this.symbolInstances.get(C);y.push(0|Math.round(h*A.anchorX+p*A.anchorY)),v.push(A.featureIndex)}return w.sort((C,A)=>y[C]-y[A]||v[A]-v[C]),w}addToSortKeyRanges(o,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((y,v,w)=>{y>=0&&w.indexOf(y)===v&&this.addIndicesForPlacedSymbol(this.text,y)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let dE,pE;ot("SymbolBucket",Hu,{omit:["layers","collisionBoxArray","features","compareText"]}),Hu.MAX_GLYPHS=65535,Hu.addDynamicAttributes=q_;var Z_={get paint(){return pE=pE||new x({"icon-opacity":new Et(we.paint_symbol["icon-opacity"]),"icon-color":new Et(we.paint_symbol["icon-color"]),"icon-halo-color":new Et(we.paint_symbol["icon-halo-color"]),"icon-halo-width":new Et(we.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Et(we.paint_symbol["icon-halo-blur"]),"icon-translate":new dt(we.paint_symbol["icon-translate"]),"icon-translate-anchor":new dt(we.paint_symbol["icon-translate-anchor"]),"text-opacity":new Et(we.paint_symbol["text-opacity"]),"text-color":new Et(we.paint_symbol["text-color"],{runtimeType:xt,getOverride:c=>c.textColor,hasOverride:c=>!!c.textColor}),"text-halo-color":new Et(we.paint_symbol["text-halo-color"]),"text-halo-width":new Et(we.paint_symbol["text-halo-width"]),"text-halo-blur":new Et(we.paint_symbol["text-halo-blur"]),"text-translate":new dt(we.paint_symbol["text-translate"]),"text-translate-anchor":new dt(we.paint_symbol["text-translate-anchor"])})},get layout(){return dE=dE||new x({"symbol-placement":new dt(we.layout_symbol["symbol-placement"]),"symbol-spacing":new dt(we.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new dt(we.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Et(we.layout_symbol["symbol-sort-key"]),"symbol-z-order":new dt(we.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new dt(we.layout_symbol["icon-allow-overlap"]),"icon-overlap":new dt(we.layout_symbol["icon-overlap"]),"icon-ignore-placement":new dt(we.layout_symbol["icon-ignore-placement"]),"icon-optional":new dt(we.layout_symbol["icon-optional"]),"icon-rotation-alignment":new dt(we.layout_symbol["icon-rotation-alignment"]),"icon-size":new Et(we.layout_symbol["icon-size"]),"icon-text-fit":new dt(we.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new dt(we.layout_symbol["icon-text-fit-padding"]),"icon-image":new Et(we.layout_symbol["icon-image"]),"icon-rotate":new Et(we.layout_symbol["icon-rotate"]),"icon-padding":new Et(we.layout_symbol["icon-padding"]),"icon-keep-upright":new dt(we.layout_symbol["icon-keep-upright"]),"icon-offset":new Et(we.layout_symbol["icon-offset"]),"icon-anchor":new Et(we.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new dt(we.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new dt(we.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new dt(we.layout_symbol["text-rotation-alignment"]),"text-field":new Et(we.layout_symbol["text-field"]),"text-font":new Et(we.layout_symbol["text-font"]),"text-size":new Et(we.layout_symbol["text-size"]),"text-max-width":new Et(we.layout_symbol["text-max-width"]),"text-line-height":new dt(we.layout_symbol["text-line-height"]),"text-letter-spacing":new Et(we.layout_symbol["text-letter-spacing"]),"text-justify":new Et(we.layout_symbol["text-justify"]),"text-radial-offset":new Et(we.layout_symbol["text-radial-offset"]),"text-variable-anchor":new dt(we.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Et(we.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Et(we.layout_symbol["text-anchor"]),"text-max-angle":new dt(we.layout_symbol["text-max-angle"]),"text-writing-mode":new dt(we.layout_symbol["text-writing-mode"]),"text-rotate":new Et(we.layout_symbol["text-rotate"]),"text-padding":new dt(we.layout_symbol["text-padding"]),"text-keep-upright":new dt(we.layout_symbol["text-keep-upright"]),"text-transform":new Et(we.layout_symbol["text-transform"]),"text-offset":new Et(we.layout_symbol["text-offset"]),"text-allow-overlap":new dt(we.layout_symbol["text-allow-overlap"]),"text-overlap":new dt(we.layout_symbol["text-overlap"]),"text-ignore-placement":new dt(we.layout_symbol["text-ignore-placement"]),"text-optional":new dt(we.layout_symbol["text-optional"])})}};class fE{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:Ts,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ot("FormatSectionOverride",fE,{omit:["defaultValue"]});class jm extends d{constructor(o){super(o,Z_)}recalculate(o,h){if(super.recalculate(o,h),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 p=this.layout.get("text-writing-mode");if(p){const y=[];for(const v of p)y.indexOf(v)<0&&y.push(v);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,y){const v=this.layout.get(o).evaluate(h,{},p,y),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||yu(w.value)||!v?v:function(C,A){return A.replace(/{([^{}]+)}/g,(O,R)=>C&&R in C?String(C[R]):"")}(h.properties,v)}createBucket(o){return new Hu(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of Z_.paint.overridableProperties){if(!jm.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new fE(h),y=new gu(p,h.property.specification);let v=null;v=h.value.kind==="constant"||h.value.kind==="source"?new Va("source",y):new $a("composite",y,h.value.zoomStops),this.paint._values[o]=new Ps(h.property,v,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&jm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),y=Z_.paint.properties[h];let v=!1;const w=C=>{for(const A of C)if(y.overrides&&y.overrides.hasOverride(A))return void(v=!0)};if(p.value.kind==="constant"&&p.value.value instanceof fr)w(p.value.value.sections);else if(p.value.kind==="source"){const C=O=>{v||(O instanceof Kr&&si(O.value)===Kn?w(O.value.sections):O instanceof au?w(O.sections):O.eachChild(C))},A=p.value;A._styleExpression&&C(A._styleExpression.expression)}return v}}let mE;var U9={get paint(){return mE=mE||new x({"background-color":new dt(we.paint_background["background-color"]),"background-pattern":new Pu(we.paint_background["background-pattern"]),"background-opacity":new dt(we.paint_background["background-opacity"])})}};class H9 extends d{constructor(o){super(o,U9)}}let gE;var q9={get paint(){return gE=gE||new x({"raster-opacity":new dt(we.paint_raster["raster-opacity"]),"raster-hue-rotate":new dt(we.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new dt(we.paint_raster["raster-brightness-min"]),"raster-brightness-max":new dt(we.paint_raster["raster-brightness-max"]),"raster-saturation":new dt(we.paint_raster["raster-saturation"]),"raster-contrast":new dt(we.paint_raster["raster-contrast"]),"raster-resampling":new dt(we.paint_raster["raster-resampling"]),"raster-fade-duration":new dt(we.paint_raster["raster-fade-duration"])})}};class W9 extends d{constructor(o){super(o,q9)}}class G9 extends d{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=o}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 Z9{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Y_=63710088e-1;class sl{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sl(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,y=o.lat*h,v=Math.sin(p)*Math.sin(y)+Math.cos(p)*Math.cos(y)*Math.cos((o.lng-this.lng)*h);return Y_*Math.acos(Math.min(v,1))}static convert(o){if(o instanceof sl)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new sl(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new sl(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const yE=2*Math.PI*Y_;function _E(c){return yE*Math.cos(c*Math.PI/180)}function bE(c){return(180+c)/360}function xE(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function vE(c,o){return c/_E(o)}function X_(c){return 360/Math.PI*Math.atan(Math.exp((180-360*c)*Math.PI/180))-90}class Kd{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=sl.convert(o);return new Kd(bE(p.lng),xE(p.lat),vE(h,p.lat))}toLngLat(){return new sl(360*this.x-180,X_(this.y))}toAltitude(){return this.z*_E(X_(this.y))}meterInMercatorCoordinateUnits(){return 1/yE*(o=X_(this.y),1/Math.cos(o*Math.PI/180));var o}}function wE(c,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[c*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class K_{constructor(o,h,p){if(!function(y,v,w){return!(y<0||y>25||w<0||w>=Math.pow(2,y)||v<0||v>=Math.pow(2,y))}(o,h,p))throw new Error(`x=${h}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=h,this.y=p,this.key=Jd(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const y=(w=this.y,C=this.z,A=wE(256*(v=this.x),256*(w=Math.pow(2,C)-w-1),C),O=wE(256*(v+1),256*(w+1),C),A[0]+","+A[1]+","+O[0]+","+O[1]);var v,w,C,A,O;const R=function(N,$,q){let G,X="";for(let ie=N;ie>0;ie--)G=1<<ie-1,X+=($&G?1:0)+(q&G?2:0);return X}(this.z,this.x,this.y);return o[(this.x+this.y)%o.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(p==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,h>1?"@2x":"").replace(/{quadkey}/g,R).replace(/{bbox-epsg-3857}/g,y)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new E((o.x*h-this.x)*oi,(o.y*h-this.y)*oi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class kE{constructor(o,h){this.wrap=o,this.canonical=h,this.key=Jd(o,h.z,h.z,h.x,h.y)}}class ss{constructor(o,h,p,y,v){if(o<p)throw new Error(`overscaledZ should be >= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new K_(p,+y,+v),this.key=Jd(h,o,p,y,v)}clone(){return new ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-o;return o>this.canonical.z?new ss(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ss(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?Jd(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):Jd(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ<this.overscaledZ&&o.canonical.x===this.canonical.x>>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,y=2*this.canonical.y;return[new ss(h,this.wrap,h,p,y),new ss(h,this.wrap,h,p+1,y),new ss(h,this.wrap,h,p,y+1),new ss(h,this.wrap,h,p+1,y+1)]}isLessThan(o){return this.wrap<o.wrap||!(this.wrap>o.wrap)&&(this.overscaledZ<o.overscaledZ||!(this.overscaledZ>o.overscaledZ)&&(this.canonical.x<o.canonical.x||!(this.canonical.x>o.canonical.x)&&this.canonical.y<o.canonical.y))}wrapped(){return new ss(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(o){return new ss(this.overscaledZ,o,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new kE(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(o){return this.canonical.getTilePoint(new Kd(o.x-this.wrap,o.y))}}function Jd(c,o,h,p,y){(c*=2)<0&&(c=-1*c-1);const v=1<<h;return(v*v*c+v*y+p).toString(36)+h.toString(36)+o.toString(36)}ot("CanonicalTileID",K_),ot("OverscaledTileID",ss,{omit:["posMatrix"]});class SE{constructor(o,h,p,y=1,v=1,w=1,C=0){if(this.uid=o,h.height!==h.width)throw new RangeError("DEM tiles must be square");if(p&&!["mapbox","terrarium","custom"].includes(p))return void ht(`"${p}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=h.height;const A=this.dim=h.height-2;switch(this.data=new Uint32Array(h.data.buffer),p){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=y,this.greenFactor=v,this.blueFactor=w,this.baseShift=C;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let O=0;O<A;O++)this.data[this._idx(-1,O)]=this.data[this._idx(0,O)],this.data[this._idx(A,O)]=this.data[this._idx(A-1,O)],this.data[this._idx(O,-1)]=this.data[this._idx(O,0)],this.data[this._idx(O,A)]=this.data[this._idx(O,A-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(A,-1)]=this.data[this._idx(A-1,0)],this.data[this._idx(-1,A)]=this.data[this._idx(0,A-1)],this.data[this._idx(A,A)]=this.data[this._idx(A-1,A-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let O=0;O<A;O++)for(let R=0;R<A;R++){const N=this.get(O,R);N>this.max&&(this.max=N),N<this.min&&(this.min=N)}}get(o,h){const p=new Uint8Array(this.data.buffer),y=4*this._idx(o,h);return this.unpack(p[y],p[y+1],p[y+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(o,h){if(o<-1||o>=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new rs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let y=h*this.dim,v=h*this.dim+this.dim,w=p*this.dim,C=p*this.dim+this.dim;switch(h){case-1:y=v-1;break;case 1:v=y+1}switch(p){case-1:w=C-1;break;case 1:C=w+1}const A=-h*this.dim,O=-p*this.dim;for(let R=w;R<C;R++)for(let N=y;N<v;N++)this.data[this._idx(N,R)]=o.data[this._idx(N+A,R+O)]}}ot("DEMData",SE);class EE{constructor(o){this._stringToNumber={},this._numberToString=[];for(let h=0;h<o.length;h++){const p=o[h];this._stringToNumber[p]=h,this._numberToString[h]=p}}encode(o){return this._stringToNumber[o]}decode(o){if(o>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class CE{constructor(o,h,p,y,v){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=y,this.properties=o.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class TE{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new qa(oi,16,0),this.grid3D=new qa(oi,16,0),this.featureIndexArray=new qi,this.promoteId=h}insert(o,h,p,y,v,w){const C=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,y,v);const A=w?this.grid3D:this.grid;for(let O=0;O<h.length;O++){const R=h[O],N=[1/0,1/0,-1/0,-1/0];for(let $=0;$<R.length;$++){const q=R[$];N[0]=Math.min(N[0],q.x),N[1]=Math.min(N[1],q.y),N[2]=Math.max(N[2],q.x),N[3]=Math.max(N[3],q.y)}N[0]<oi&&N[1]<oi&&N[2]>=0&&N[3]>=0&&A.insert(C,N[0],N[1],N[2],N[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new nl.VectorTile(new F_(this.rawTileData)).layers,this.sourceLayerCoder=new EE(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,y){this.loadVTLayers();const v=o.params||{},w=oi/o.tileSize/o.scale,C=yd(v.filter),A=o.queryGeometry,O=o.queryPadding*w,R=AE(A),N=this.grid.query(R.minX-O,R.minY-O,R.maxX+O,R.maxY+O),$=AE(o.cameraQueryGeometry),q=this.grid3D.query($.minX-O,$.minY-O,$.maxX+O,$.maxY+O,(ie,ae,be,pe)=>function(ye,Ee,Ne,tt,St){for(const Ze of ye)if(Ee<=Ze.x&&Ne<=Ze.y&&tt>=Ze.x&&St>=Ze.y)return!0;const Qe=[new E(Ee,Ne),new E(Ee,St),new E(tt,St),new E(tt,Ne)];if(ye.length>2){for(const Ze of Qe)if(Nu(ye,Ze))return!0}for(let Ze=0;Ze<ye.length-1;Ze++)if(M7(ye[Ze],ye[Ze+1],Qe))return!0;return!1}(o.cameraQueryGeometry,ie-O,ae-O,be+O,pe+O));for(const ie of q)N.push(ie);N.sort(Y9);const G={};let X;for(let ie=0;ie<N.length;ie++){const ae=N[ie];if(ae===X)continue;X=ae;const be=this.featureIndexArray.get(ae);let pe=null;this.loadMatchingFeature(G,be.bucketIndex,be.sourceLayerIndex,be.featureIndex,C,v.layers,v.availableImages,h,p,y,(ye,Ee,Ne)=>(pe||(pe=rc(ye)),Ee.queryIntersectsFeature(A,ye,Ne,pe,this.z,o.transform,w,o.pixelPosMatrix)))}return G}loadMatchingFeature(o,h,p,y,v,w,C,A,O,R,N){const $=this.bucketLayerIDs[h];if(w&&!function(ie,ae){for(let be=0;be<ie.length;be++)if(ae.indexOf(ie[be])>=0)return!0;return!1}(w,$))return;const q=this.sourceLayerCoder.decode(p),G=this.vtLayers[q].feature(y);if(v.needGeometry){const ie=sc(G,!0);if(!v.filter(new Ln(this.tileID.overscaledZ),ie,this.tileID.canonical))return}else if(!v.filter(new Ln(this.tileID.overscaledZ),G))return;const X=this.getId(G,q);for(let ie=0;ie<$.length;ie++){const ae=$[ie];if(w&&w.indexOf(ae)<0)continue;const be=A[ae];if(!be)continue;let pe={};X&&R&&(pe=R.getState(be.sourceLayer||"_geojsonTileLayer",X));const ye=Me({},O[ae]);ye.paint=ME(ye.paint,be.paint,G,pe,C),ye.layout=ME(ye.layout,be.layout,G,pe,C);const Ee=!N||N(G,be,pe);if(!Ee)continue;const Ne=new CE(G,this.z,this.x,this.y,X);Ne.layer=ye;let tt=o[ae];tt===void 0&&(tt=o[ae]=[]),tt.push({featureIndex:y,feature:Ne,intersectionZ:Ee})}}lookupSymbolFeatures(o,h,p,y,v,w,C,A){const O={};this.loadVTLayers();const R=yd(v);for(const N of o)this.loadMatchingFeature(O,p,y,N,R,w,C,A,h);return O}hasLayer(o){for(const h of this.bucketLayerIDs)for(const p of h)if(o===p)return!0;return!1}getId(o,h){let p=o.id;return this.promoteId&&(p=o.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[h]],typeof p=="boolean"&&(p=Number(p))),p}}function ME(c,o,h,p,y){return Ie(c,(v,w)=>{const C=o instanceof ec?o.get(w):null;return C&&C.evaluate?C.evaluate(h,p,y):C})}function AE(c){let o=1/0,h=1/0,p=-1/0,y=-1/0;for(const v of c)o=Math.min(o,v.x),h=Math.min(h,v.y),p=Math.max(p,v.x),y=Math.max(y,v.y);return{minX:o,minY:h,maxX:p,maxY:y}}function Y9(c,o){return o-c}function PE(c,o,h,p,y){const v=[];for(let w=0;w<c.length;w++){const C=c[w];let A;for(let O=0;O<C.length-1;O++){let R=C[O],N=C[O+1];R.x<o&&N.x<o||(R.x<o?R=new E(o,R.y+(o-R.x)/(N.x-R.x)*(N.y-R.y))._round():N.x<o&&(N=new E(o,R.y+(o-R.x)/(N.x-R.x)*(N.y-R.y))._round()),R.y<h&&N.y<h||(R.y<h?R=new E(R.x+(h-R.y)/(N.y-R.y)*(N.x-R.x),h)._round():N.y<h&&(N=new E(R.x+(h-R.y)/(N.y-R.y)*(N.x-R.x),h)._round()),R.x>=p&&N.x>=p||(R.x>=p?R=new E(p,R.y+(p-R.x)/(N.x-R.x)*(N.y-R.y))._round():N.x>=p&&(N=new E(p,R.y+(p-R.x)/(N.x-R.x)*(N.y-R.y))._round()),R.y>=y&&N.y>=y||(R.y>=y?R=new E(R.x+(y-R.y)/(N.y-R.y)*(N.x-R.x),y)._round():N.y>=y&&(N=new E(R.x+(y-R.y)/(N.y-R.y)*(N.x-R.x),y)._round()),A&&R.equals(A[A.length-1])||(A=[R],v.push(A)),A.push(N)))))}}return v}ot("FeatureIndex",TE,{omit:["rawTileData","sourceLayerCoder"]});class ol extends E{constructor(o,h,p,y){super(o,h),this.angle=p,y!==void 0&&(this.segment=y)}clone(){return new ol(this.x,this.y,this.angle,this.segment)}}function IE(c,o,h,p,y){if(o.segment===void 0||h===0)return!0;let v=o,w=o.segment+1,C=0;for(;C>-h/2;){if(w--,w<0)return!1;C-=c[w].dist(v),v=c[w]}C+=c[w].dist(c[w+1]),w++;const A=[];let O=0;for(;C<h/2;){const R=c[w],N=c[w+1];if(!N)return!1;let $=c[w-1].angleTo(R)-R.angleTo(N);for($=Math.abs(($+3*Math.PI)%(2*Math.PI)-Math.PI),A.push({distance:C,angleDelta:$}),O+=$;C-A[0].distance>p;)O-=A.shift().angleDelta;if(O>y)return!1;w++,C+=R.dist(N)}return!0}function DE(c){let o=0;for(let h=0;h<c.length-1;h++)o+=c[h].dist(c[h+1]);return o}function OE(c,o,h){return c?.6*o*h:0}function zE(c,o){return Math.max(c?c.right-c.left:0,o?o.right-o.left:0)}function X9(c,o,h,p,y,v){const w=OE(h,y,v),C=zE(h,p)*v;let A=0;const O=DE(c)/2;for(let R=0;R<c.length-1;R++){const N=c[R],$=c[R+1],q=N.dist($);if(A+q>O){const G=(O-A)/q,X=nr.number(N.x,$.x,G),ie=nr.number(N.y,$.y,G),ae=new ol(X,ie,$.angleTo(N),R);return ae._round(),!w||IE(c,ae,C,w,o)?ae:void 0}A+=q}}function K9(c,o,h,p,y,v,w,C,A){const O=OE(p,v,w),R=zE(p,y),N=R*w,$=c[0].x===0||c[0].x===A||c[0].y===0||c[0].y===A;return o-N<o/4&&(o=N+o/4),RE(c,$?o/2*C%o:(R/2+2*v)*w*C%o,o,O,h,N,$,!1,A)}function RE(c,o,h,p,y,v,w,C,A){const O=v/2,R=DE(c);let N=0,$=o-h,q=[];for(let G=0;G<c.length-1;G++){const X=c[G],ie=c[G+1],ae=X.dist(ie),be=ie.angleTo(X);for(;$+h<N+ae;){$+=h;const pe=($-N)/ae,ye=nr.number(X.x,ie.x,pe),Ee=nr.number(X.y,ie.y,pe);if(ye>=0&&ye<A&&Ee>=0&&Ee<A&&$-O>=0&&$+O<=R){const Ne=new ol(ye,Ee,be,G);Ne._round(),p&&!IE(c,Ne,v,p,y)||q.push(Ne)}}N+=ae}return C||q.length||w||(q=RE(c,N/2,h,p,y,v,w,!0,A)),q}ot("Anchor",ol);const qu=xr;function LE(c,o,h,p){const y=[],v=c.image,w=v.pixelRatio,C=v.paddedRect.w-2*qu,A=v.paddedRect.h-2*qu;let O={x1:c.left,y1:c.top,x2:c.right,y2:c.bottom};const R=v.stretchX||[[0,C]],N=v.stretchY||[[0,A]],$=(De,yt)=>De+yt[1]-yt[0],q=R.reduce($,0),G=N.reduce($,0),X=C-q,ie=A-G;let ae=0,be=q,pe=0,ye=G,Ee=0,Ne=X,tt=0,St=ie;if(v.content&&p){const De=v.content,yt=De[2]-De[0],ft=De[3]-De[1];(v.textFitWidth||v.textFitHeight)&&(O=cE(c)),ae=Um(R,0,De[0]),pe=Um(N,0,De[1]),be=Um(R,De[0],De[2]),ye=Um(N,De[1],De[3]),Ee=De[0]-ae,tt=De[1]-pe,Ne=yt-be,St=ft-ye}const Qe=O.x1,Ze=O.y1,mt=O.x2-Qe,ct=O.y2-Ze,rt=(De,yt,ft,It)=>{const Pn=Hm(De.stretch-ae,be,mt,Qe),Mn=qm(De.fixed-Ee,Ne,De.stretch,q),mi=Hm(yt.stretch-pe,ye,ct,Ze),Ds=qm(yt.fixed-tt,St,yt.stretch,G),Ri=Hm(ft.stretch-ae,be,mt,Qe),gi=qm(ft.fixed-Ee,Ne,ft.stretch,q),or=Hm(It.stretch-pe,ye,ct,Ze),ar=qm(It.fixed-tt,St,It.stretch,G),lr=new E(Pn,mi),ei=new E(Ri,mi),yi=new E(Ri,or),Gi=new E(Pn,or),Li=new E(Mn/w,Ds/w),cr=new E(gi/w,ar/w),Ni=o*Math.PI/180;if(Ni){const un=Math.sin(Ni),On=Math.cos(Ni),Vn=[On,-un,un,On];lr._matMult(Vn),ei._matMult(Vn),Gi._matMult(Vn),yi._matMult(Vn)}const as=De.stretch+De.fixed,vr=yt.stretch+yt.fixed;return{tl:lr,tr:ei,bl:Gi,br:yi,tex:{x:v.paddedRect.x+qu+as,y:v.paddedRect.y+qu+vr,w:ft.stretch+ft.fixed-as,h:It.stretch+It.fixed-vr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Li,pixelOffsetBR:cr,minFontScaleX:Ne/w/mt,minFontScaleY:St/w/ct,isSDF:h}};if(p&&(v.stretchX||v.stretchY)){const De=NE(R,X,q),yt=NE(N,ie,G);for(let ft=0;ft<De.length-1;ft++){const It=De[ft],Pn=De[ft+1];for(let Mn=0;Mn<yt.length-1;Mn++)y.push(rt(It,yt[Mn],Pn,yt[Mn+1]))}}else y.push(rt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:C+1},{fixed:0,stretch:A+1}));return y}function Um(c,o,h){let p=0;for(const y of c)p+=Math.max(o,Math.min(h,y[1]))-Math.max(o,Math.min(h,y[0]));return p}function NE(c,o,h){const p=[{fixed:-qu,stretch:0}];for(const[y,v]of c){const w=p[p.length-1];p.push({fixed:y-w.stretch,stretch:w.stretch}),p.push({fixed:y-w.stretch,stretch:w.stretch+(v-y)})}return p.push({fixed:o+qu,stretch:h}),p}function Hm(c,o,h,p){return c/o*h+p}function qm(c,o,h,p){return c-o*h/p}class Wm{constructor(o,h,p,y,v,w,C,A,O,R){var N;if(this.boxStartIndex=o.length,O){let $=w.top,q=w.bottom;const G=w.collisionPadding;G&&($-=G[1],q+=G[3]);let X=q-$;X>0&&(X=Math.max(10,X),this.circleDiameter=X)}else{const $=!((N=w.image)===null||N===void 0)&&N.content&&(w.image.textFitWidth||w.image.textFitHeight)?cE(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};$.y1=$.y1*C-A[0],$.y2=$.y2*C+A[2],$.x1=$.x1*C-A[3],$.x2=$.x2*C+A[1];const q=w.collisionPadding;if(q&&($.x1-=q[0]*C,$.y1-=q[1]*C,$.x2+=q[2]*C,$.y2+=q[3]*C),R){const G=new E($.x1,$.y1),X=new E($.x2,$.y1),ie=new E($.x1,$.y2),ae=new E($.x2,$.y2),be=R*Math.PI/180;G._rotate(be),X._rotate(be),ie._rotate(be),ae._rotate(be),$.x1=Math.min(G.x,X.x,ie.x,ae.x),$.x2=Math.max(G.x,X.x,ie.x,ae.x),$.y1=Math.min(G.y,X.y,ie.y,ae.y),$.y2=Math.max(G.y,X.y,ie.y,ae.y)}o.emplaceBack(h.x,h.y,$.x1,$.y1,$.x2,$.y2,p,y,v)}this.boxEndIndex=o.length}}class J9{constructor(o=[],h=(p,y)=>p<y?-1:p>y?1:0){if(this.data=o,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this._up(this.length++)}pop(){if(this.length===0)return;const o=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,y=h[o];for(;o>0;){const v=o-1>>1,w=h[v];if(p(y,w)>=0)break;h[o]=w,o=v}h[o]=y}_down(o){const{data:h,compare:p}=this,y=this.length>>1,v=h[o];for(;o<y;){let w=1+(o<<1);const C=w+1;if(C<this.length&&p(h[C],h[w])<0&&(w=C),p(h[w],v)>=0)break;h[o]=h[w],o=w}h[o]=v}}function Q9(c,o=1,h=!1){let p=1/0,y=1/0,v=-1/0,w=-1/0;const C=c[0];for(let q=0;q<C.length;q++){const G=C[q];(!q||G.x<p)&&(p=G.x),(!q||G.y<y)&&(y=G.y),(!q||G.x>v)&&(v=G.x),(!q||G.y>w)&&(w=G.y)}const A=Math.min(v-p,w-y);let O=A/2;const R=new J9([],eU);if(A===0)return new E(p,y);for(let q=p;q<v;q+=A)for(let G=y;G<w;G+=A)R.push(new Wu(q+O,G+O,O,c));let N=function(q){let G=0,X=0,ie=0;const ae=q[0];for(let be=0,pe=ae.length,ye=pe-1;be<pe;ye=be++){const Ee=ae[be],Ne=ae[ye],tt=Ee.x*Ne.y-Ne.x*Ee.y;X+=(Ee.x+Ne.x)*tt,ie+=(Ee.y+Ne.y)*tt,G+=3*tt}return new Wu(X/G,ie/G,0,q)}(c),$=R.length;for(;R.length;){const q=R.pop();(q.d>N.d||!N.d)&&(N=q,h&&console.log("found best %d after %d probes",Math.round(1e4*q.d)/1e4,$)),q.max-N.d<=o||(O=q.h/2,R.push(new Wu(q.p.x-O,q.p.y-O,O,c)),R.push(new Wu(q.p.x+O,q.p.y-O,O,c)),R.push(new Wu(q.p.x-O,q.p.y+O,O,c)),R.push(new Wu(q.p.x+O,q.p.y+O,O,c)),$+=4)}return h&&(console.log(`num probes: ${$}`),console.log(`best distance: ${N.d}`)),N.p}function eU(c,o){return o.max-c.max}function Wu(c,o,h,p){this.p=new E(c,o),this.h=h,this.d=function(y,v){let w=!1,C=1/0;for(let A=0;A<v.length;A++){const O=v[A];for(let R=0,N=O.length,$=N-1;R<N;$=R++){const q=O[R],G=O[$];q.y>y.y!=G.y>y.y&&y.x<(G.x-q.x)*(y.y-q.y)/(G.y-q.y)+q.x&&(w=!w),C=Math.min(C,xS(y,q,G))}}return(w?1:-1)*Math.sqrt(C)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var zi;u.aq=void 0,(zi=u.aq||(u.aq={}))[zi.center=1]="center",zi[zi.left=2]="left",zi[zi.right=3]="right",zi[zi.top=4]="top",zi[zi.bottom=5]="bottom",zi[zi["top-left"]=6]="top-left",zi[zi["top-right"]=7]="top-right",zi[zi["bottom-left"]=8]="bottom-left",zi[zi["bottom-right"]=9]="bottom-right";const al=7,J_=Number.POSITIVE_INFINITY;function BE(c,o){return o[1]!==J_?function(h,p,y){let v=0,w=0;switch(p=Math.abs(p),y=Math.abs(y),h){case"top-right":case"top-left":case"top":w=y-al;break;case"bottom-right":case"bottom-left":case"bottom":w=-y+al}switch(h){case"top-right":case"bottom-right":case"right":v=-p;break;case"top-left":case"bottom-left":case"left":v=p}return[v,w]}(c,o[0],o[1]):function(h,p){let y=0,v=0;p<0&&(p=0);const w=p/Math.SQRT2;switch(h){case"top-right":case"top-left":v=w-al;break;case"bottom-right":case"bottom-left":v=-w+al;break;case"bottom":v=-p+al;break;case"top":v=p-al}switch(h){case"top-right":case"bottom-right":y=-w;break;case"top-left":case"bottom-left":y=w;break;case"left":y=p;break;case"right":y=-p}return[y,v]}(c,o[0])}function FE(c,o,h){var p;const y=c.layout,v=(p=y.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(v){const C=v.values,A=[];for(let O=0;O<C.length;O+=2){const R=A[O]=C[O],N=C[O+1].map($=>$*li);R.startsWith("top")?N[1]-=al:R.startsWith("bottom")&&(N[1]+=al),A[O+1]=N}return new Rr(A)}const w=y.get("text-variable-anchor");if(w){let C;C=c._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(o,{},h)*li,J_]:y.get("text-offset").evaluate(o,{},h).map(O=>O*li);const A=[];for(const O of w)A.push(O,BE(O,C));return new Rr(A)}return null}function Q_(c){switch(c){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function tU(c,o,h,p,y,v,w,C,A,O,R){let N=v.textMaxSize.evaluate(o,{});N===void 0&&(N=w);const $=c.layers[0].layout,q=$.get("icon-offset").evaluate(o,{},R),G=$E(h.horizontal),X=w/24,ie=c.tilePixelRatio*X,ae=c.tilePixelRatio*N/24,be=c.tilePixelRatio*C,pe=c.tilePixelRatio*$.get("symbol-spacing"),ye=$.get("text-padding")*c.tilePixelRatio,Ee=function(De,yt,ft,It=1){const Pn=De.get("icon-padding").evaluate(yt,{},ft),Mn=Pn&&Pn.values;return[Mn[0]*It,Mn[1]*It,Mn[2]*It,Mn[3]*It]}($,o,R,c.tilePixelRatio),Ne=$.get("text-max-angle")/180*Math.PI,tt=$.get("text-rotation-alignment")!=="viewport"&&$.get("symbol-placement")!=="point",St=$.get("icon-rotation-alignment")==="map"&&$.get("symbol-placement")!=="point",Qe=$.get("symbol-placement"),Ze=pe/2,mt=$.get("icon-text-fit");let ct;p&&mt!=="none"&&(c.allowVerticalPlacement&&h.vertical&&(ct=uE(p,h.vertical,mt,$.get("icon-text-fit-padding"),q,X)),G&&(p=uE(p,G,mt,$.get("icon-text-fit-padding"),q,X)));const rt=(De,yt)=>{yt.x<0||yt.x>=oi||yt.y<0||yt.y>=oi||function(ft,It,Pn,Mn,mi,Ds,Ri,gi,or,ar,lr,ei,yi,Gi,Li,cr,Ni,as,vr,un,On,Vn,jr,Yn,Gu){const go=ft.addToLineVertexArray(It,Pn);let yo,Os,ls,Si,ta=0,tp=0,qE=0,WE=0,ab=-1,lb=-1;const na={};let GE=Ou("");if(ft.allowVerticalPlacement&&Mn.vertical){const Zi=gi.layout.get("text-rotate").evaluate(On,{},Yn)+90;ls=new Wm(or,It,ar,lr,ei,Mn.vertical,yi,Gi,Li,Zi),Ri&&(Si=new Wm(or,It,ar,lr,ei,Ri,Ni,as,Li,Zi))}if(mi){const Zi=gi.layout.get("icon-rotate").evaluate(On,{}),cs=gi.layout.get("icon-text-fit")!=="none",ac=LE(mi,Zi,jr,cs),Zs=Ri?LE(Ri,Zi,jr,cs):void 0;Os=new Wm(or,It,ar,lr,ei,mi,Ni,as,!1,Zi),ta=4*ac.length;const lc=ft.iconSizeData;let _o=null;lc.kind==="source"?(_o=[mo*gi.layout.get("icon-size").evaluate(On,{})],_o[0]>rl&&ht(`${ft.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)):lc.kind==="composite"&&(_o=[mo*Vn.compositeIconSizes[0].evaluate(On,{},Yn),mo*Vn.compositeIconSizes[1].evaluate(On,{},Yn)],(_o[0]>rl||_o[1]>rl)&&ht(`${ft.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)),ft.addSymbols(ft.icon,ac,_o,un,vr,On,u.ah.none,It,go.lineStartIndex,go.lineLength,-1,Yn),ab=ft.icon.placedSymbolArray.length-1,Zs&&(tp=4*Zs.length,ft.addSymbols(ft.icon,Zs,_o,un,vr,On,u.ah.vertical,It,go.lineStartIndex,go.lineLength,-1,Yn),lb=ft.icon.placedSymbolArray.length-1)}const ZE=Object.keys(Mn.horizontal);for(const Zi of ZE){const cs=Mn.horizontal[Zi];if(!yo){GE=Ou(cs.text);const Zs=gi.layout.get("text-rotate").evaluate(On,{},Yn);yo=new Wm(or,It,ar,lr,ei,cs,yi,Gi,Li,Zs)}const ac=cs.positionedLines.length===1;if(qE+=VE(ft,It,cs,Ds,gi,Li,On,cr,go,Mn.vertical?u.ah.horizontal:u.ah.horizontalOnly,ac?ZE:[Zi],na,ab,Vn,Yn),ac)break}Mn.vertical&&(WE+=VE(ft,It,Mn.vertical,Ds,gi,Li,On,cr,go,u.ah.vertical,["vertical"],na,lb,Vn,Yn));const rU=yo?yo.boxStartIndex:ft.collisionBoxArray.length,sU=yo?yo.boxEndIndex:ft.collisionBoxArray.length,oU=ls?ls.boxStartIndex:ft.collisionBoxArray.length,aU=ls?ls.boxEndIndex:ft.collisionBoxArray.length,lU=Os?Os.boxStartIndex:ft.collisionBoxArray.length,cU=Os?Os.boxEndIndex:ft.collisionBoxArray.length,uU=Si?Si.boxStartIndex:ft.collisionBoxArray.length,hU=Si?Si.boxEndIndex:ft.collisionBoxArray.length;let Gs=-1;const Zm=(Zi,cs)=>Zi&&Zi.circleDiameter?Math.max(Zi.circleDiameter,cs):cs;Gs=Zm(yo,Gs),Gs=Zm(ls,Gs),Gs=Zm(Os,Gs),Gs=Zm(Si,Gs);const YE=Gs>-1?1:0;YE&&(Gs*=Gu/li),ft.glyphOffsetArray.length>=Hu.MAX_GLYPHS&&ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),On.sortKey!==void 0&&ft.addToSortKeyRanges(ft.symbolInstances.length,On.sortKey);const dU=FE(gi,On,Yn),[pU,fU]=function(Zi,cs){const ac=Zi.length,Zs=cs==null?void 0:cs.values;if((Zs==null?void 0:Zs.length)>0)for(let lc=0;lc<Zs.length;lc+=2){const _o=Zs[lc+1];Zi.emplaceBack(u.aq[Zs[lc]],_o[0],_o[1])}return[ac,Zi.length]}(ft.textAnchorOffsets,dU);ft.symbolInstances.emplaceBack(It.x,It.y,na.right>=0?na.right:-1,na.center>=0?na.center:-1,na.left>=0?na.left:-1,na.vertical||-1,ab,lb,GE,rU,sU,oU,aU,lU,cU,uU,hU,ar,qE,WE,ta,tp,YE,0,yi,Gs,pU,fU)}(c,yt,De,h,p,y,ct,c.layers[0],c.collisionBoxArray,o.index,o.sourceLayerIndex,c.index,ie,[ye,ye,ye,ye],tt,A,be,Ee,St,q,o,v,O,R,w)};if(Qe==="line")for(const De of PE(o.geometry,0,0,oi,oi)){const yt=K9(De,pe,Ne,h.vertical||G,p,24,ae,c.overscaling,oi);for(const ft of yt)G&&nU(c,G.text,Ze,ft)||rt(De,ft)}else if(Qe==="line-center"){for(const De of o.geometry)if(De.length>1){const yt=X9(De,Ne,h.vertical||G,p,24,ae);yt&&rt(De,yt)}}else if(o.type==="Polygon")for(const De of cu(o.geometry,0)){const yt=Q9(De,16);rt(De[0],new ol(yt.x,yt.y,0))}else if(o.type==="LineString")for(const De of o.geometry)rt(De,new ol(De[0].x,De[0].y,0));else if(o.type==="Point")for(const De of o.geometry)for(const yt of De)rt([yt],new ol(yt.x,yt.y,0))}function VE(c,o,h,p,y,v,w,C,A,O,R,N,$,q,G){const X=function(be,pe,ye,Ee,Ne,tt,St,Qe){const Ze=Ee.layout.get("text-rotate").evaluate(tt,{})*Math.PI/180,mt=[];for(const ct of pe.positionedLines)for(const rt of ct.positionedGlyphs){if(!rt.rect)continue;const De=rt.rect||{};let yt=nE+1,ft=!0,It=1,Pn=0;const Mn=(Ne||Qe)&&rt.vertical,mi=rt.metrics.advance*rt.scale/2;if(Qe&&pe.verticalizable&&(Pn=ct.lineOffset/2-(rt.imageName?-(li-rt.metrics.width*rt.scale)/2:(rt.scale-1)*li)),rt.imageName){const un=St[rt.imageName];ft=un.sdf,It=un.pixelRatio,yt=xr/It}const Ds=Ne?[rt.x+mi,rt.y]:[0,0];let Ri=Ne?[0,0]:[rt.x+mi+ye[0],rt.y+ye[1]-Pn],gi=[0,0];Mn&&(gi=Ri,Ri=[0,0]);const or=rt.metrics.isDoubleResolution?2:1,ar=(rt.metrics.left-yt)*rt.scale-mi+Ri[0],lr=(-rt.metrics.top-yt)*rt.scale+Ri[1],ei=ar+De.w/or*rt.scale/It,yi=lr+De.h/or*rt.scale/It,Gi=new E(ar,lr),Li=new E(ei,lr),cr=new E(ar,yi),Ni=new E(ei,yi);if(Mn){const un=new E(-mi,mi-Zd),On=-Math.PI/2,Vn=li/2-mi,jr=new E(5-Zd-Vn,-(rt.imageName?Vn:0)),Yn=new E(...gi);Gi._rotateAround(On,un)._add(jr)._add(Yn),Li._rotateAround(On,un)._add(jr)._add(Yn),cr._rotateAround(On,un)._add(jr)._add(Yn),Ni._rotateAround(On,un)._add(jr)._add(Yn)}if(Ze){const un=Math.sin(Ze),On=Math.cos(Ze),Vn=[On,-un,un,On];Gi._matMult(Vn),Li._matMult(Vn),cr._matMult(Vn),Ni._matMult(Vn)}const as=new E(0,0),vr=new E(0,0);mt.push({tl:Gi,tr:Li,bl:cr,br:Ni,tex:De,writingMode:pe.writingMode,glyphOffset:Ds,sectionIndex:rt.sectionIndex,isSDF:ft,pixelOffsetTL:as,pixelOffsetBR:vr,minFontScaleX:0,minFontScaleY:0})}return mt}(0,h,C,y,v,w,p,c.allowVerticalPlacement),ie=c.textSizeData;let ae=null;ie.kind==="source"?(ae=[mo*y.layout.get("text-size").evaluate(w,{})],ae[0]>rl&&ht(`${c.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)):ie.kind==="composite"&&(ae=[mo*q.compositeTextSizes[0].evaluate(w,{},G),mo*q.compositeTextSizes[1].evaluate(w,{},G)],(ae[0]>rl||ae[1]>rl)&&ht(`${c.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)),c.addSymbols(c.text,X,ae,C,v,w,O,o,A.lineStartIndex,A.lineLength,$,G);for(const be of R)N[be]=c.text.placedSymbolArray.length-1;return 4*X.length}function $E(c){for(const o in c)return c[o];return null}function nU(c,o,h,p){const y=c.compareText;if(o in y){const v=y[o];for(let w=v.length-1;w>=0;w--)if(p.dist(v[w])<h)return!0}else y[o]=[];return y[o].push(p),!1}const jE=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class eb{static from(o){if(!(o instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,p]=new Uint8Array(o,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const y=p>>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const v=jE[15&p];if(!v)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[C]=new Uint32Array(o,4,1);return new eb(C,w,v,o)}constructor(o,h=64,p=Float64Array,y){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const v=jE.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,C=o*this.IndexArrayType.BYTES_PER_ELEMENT,A=(8-C%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${p}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+C+A,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+C+A),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+C+A,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return tb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:w,nodeSize:C}=this,A=[0,v.length-1,0],O=[];for(;A.length;){const R=A.pop()||0,N=A.pop()||0,$=A.pop()||0;if(N-$<=C){for(let ie=$;ie<=N;ie++){const ae=w[2*ie],be=w[2*ie+1];ae>=o&&ae<=p&&be>=h&&be<=y&&O.push(v[ie])}continue}const q=$+N>>1,G=w[2*q],X=w[2*q+1];G>=o&&G<=p&&X>=h&&X<=y&&O.push(v[q]),(R===0?o<=G:h<=X)&&(A.push($),A.push(q-1),A.push(1-R)),(R===0?p>=G:y>=X)&&(A.push(q+1),A.push(N),A.push(1-R))}return O}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:v,nodeSize:w}=this,C=[0,y.length-1,0],A=[],O=p*p;for(;C.length;){const R=C.pop()||0,N=C.pop()||0,$=C.pop()||0;if(N-$<=w){for(let ie=$;ie<=N;ie++)HE(v[2*ie],v[2*ie+1],o,h)<=O&&A.push(y[ie]);continue}const q=$+N>>1,G=v[2*q],X=v[2*q+1];HE(G,X,o,h)<=O&&A.push(y[q]),(R===0?o-p<=G:h-p<=X)&&(C.push($),C.push(q-1),C.push(1-R)),(R===0?o+p>=G:h+p>=X)&&(C.push(q+1),C.push(N),C.push(1-R))}return A}}function tb(c,o,h,p,y,v){if(y-p<=h)return;const w=p+y>>1;UE(c,o,w,p,y,v),tb(c,o,h,p,w-1,1-v),tb(c,o,h,w+1,y,1-v)}function UE(c,o,h,p,y,v){for(;y>p;){if(y-p>600){const O=y-p+1,R=h-p+1,N=Math.log(O),$=.5*Math.exp(2*N/3),q=.5*Math.sqrt(N*$*(O-$)/O)*(R-O/2<0?-1:1);UE(c,o,h,Math.max(p,Math.floor(h-R*$/O+q)),Math.min(y,Math.floor(h+(O-R)*$/O+q)),v)}const w=o[2*h+v];let C=p,A=y;for(Qd(c,o,p,h),o[2*y+v]>w&&Qd(c,o,p,y);C<A;){for(Qd(c,o,C,A),C++,A--;o[2*C+v]<w;)C++;for(;o[2*A+v]>w;)A--}o[2*p+v]===w?Qd(c,o,p,A):(A++,Qd(c,o,A,y)),A<=h&&(p=A+1),h<=A&&(y=A-1)}}function Qd(c,o,h,p){nb(c,h,p),nb(o,2*h,2*p),nb(o,2*h+1,2*p+1)}function nb(c,o,h){const p=c[o];c[o]=c[h],c[h]=p}function HE(c,o,h,p){const y=c-h,v=o-p;return y*y+v*v}var ib;u.bg=void 0,(ib=u.bg||(u.bg={})).create="create",ib.load="load",ib.fullLoad="fullLoad";let Gm=null,ep=[];const rb=1e3/60,sb="loadTime",ob="fullLoadTime",iU={mark(c){performance.mark(c)},frame(c){const o=c;Gm!=null&&ep.push(o-Gm),Gm=o},clearMetrics(){Gm=null,ep=[],performance.clearMeasures(sb),performance.clearMeasures(ob);for(const c in u.bg)performance.clearMarks(u.bg[c])},getPerformanceMetrics(){performance.measure(sb,u.bg.create,u.bg.load),performance.measure(ob,u.bg.create,u.bg.fullLoad);const c=performance.getEntriesByName(sb)[0].duration,o=performance.getEntriesByName(ob)[0].duration,h=ep.length,p=1/(ep.reduce((v,w)=>v+w,0)/h/1e3),y=ep.filter(v=>v>rb).reduce((v,w)=>v+(w-rb)/rb,0);return{loadTime:c,fullLoadTime:o,fps:p,percentDroppedFrames:y/(h+y)*100,totalFrames:h}}};u.$=class extends B{},u.A=Bu,u.B=f_,u.C=function(c){if(nn==null){const o=c.navigator?c.navigator.userAgent:null;nn=!!c.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return nn},u.D=dt,u.E=ln,u.F=class{constructor(c,o){this.target=c,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new Z9(()=>this.process()),this.subscription=function(h,p,y,v){return h.addEventListener(p,y,!1),{unsubscribe:()=>{h.removeEventListener(p,y,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Xt(self)?c:window}registerMessageHandler(c,o){this.messageHandlers[c]=o}sendAsync(c,o){return new Promise((h,p)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const C={id:y,type:"<cancel>",origin:location.origin,targetMapId:c.targetMapId,sourceMapId:this.mapId};this.target.postMessage(C)},{once:!0});const v=[],w=Object.assign(Object.assign({},c),{id:y,sourceMapId:this.mapId,origin:location.origin,data:Wa(c.data,v)});this.target.postMessage(w,{transfer:v})})}receive(c){const o=c.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!=="resource://android"&&location.origin!=="resource://android"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type==="<cancel>"){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(Xt(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const c=this.taskQueue.shift(),o=this.tasks[c];delete this.tasks[c],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(c,o)}processTask(c,o){return l(this,void 0,void 0,function*(){if(o.type==="<response>"){const y=this.resolveRejects[c];return delete this.resolveRejects[c],y?void(o.error?y.reject(Ga(o.error)):y.resolve(Ga(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(c,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=Ga(o.data),p=new AbortController;this.abortControllers[c]=p;try{const y=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(c,null,y)}catch(y){this.completeTask(c,y)}})}completeTask(c,o,h){const p=[];delete this.abortControllers[c];const y={id:c,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:o?Wa(o):null,data:Wa(h,p)};this.target.postMessage(y,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},u.G=Gn,u.H=function(){var c=new Bu(16);return Bu!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0),c[0]=1,c[5]=1,c[10]=1,c[15]=1,c},u.I=$_,u.J=function(c,o,h){var p,y,v,w,C,A,O,R,N,$,q,G,X=h[0],ie=h[1],ae=h[2];return o===c?(c[12]=o[0]*X+o[4]*ie+o[8]*ae+o[12],c[13]=o[1]*X+o[5]*ie+o[9]*ae+o[13],c[14]=o[2]*X+o[6]*ie+o[10]*ae+o[14],c[15]=o[3]*X+o[7]*ie+o[11]*ae+o[15]):(y=o[1],v=o[2],w=o[3],C=o[4],A=o[5],O=o[6],R=o[7],N=o[8],$=o[9],q=o[10],G=o[11],c[0]=p=o[0],c[1]=y,c[2]=v,c[3]=w,c[4]=C,c[5]=A,c[6]=O,c[7]=R,c[8]=N,c[9]=$,c[10]=q,c[11]=G,c[12]=p*X+C*ie+N*ae+o[12],c[13]=y*X+A*ie+$*ae+o[13],c[14]=v*X+O*ie+q*ae+o[14],c[15]=w*X+R*ie+G*ae+o[15]),c},u.K=function(c,o,h){var p=h[0],y=h[1],v=h[2];return c[0]=o[0]*p,c[1]=o[1]*p,c[2]=o[2]*p,c[3]=o[3]*p,c[4]=o[4]*y,c[5]=o[5]*y,c[6]=o[6]*y,c[7]=o[7]*y,c[8]=o[8]*v,c[9]=o[9]*v,c[10]=o[10]*v,c[11]=o[11]*v,c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15],c},u.L=SS,u.M=function(c,o){const h={};for(let p=0;p<o.length;p++){const y=o[p];y in c&&(h[y]=c[y])}return h},u.N=sl,u.O=bE,u.P=E,u.Q=xE,u.R=rs,u.S=ss,u.T=Mu,u.U=Z,u.V=ee,u.W=Sn,u.X=oi,u.Y=M,u.Z=Kd,u._=l,u.a=Wn,u.a$=function(c,o){var h=c[0],p=c[1],y=c[2],v=c[3],w=c[4],C=c[5],A=c[6],O=c[7],R=c[8],N=c[9],$=c[10],q=c[11],G=c[12],X=c[13],ie=c[14],ae=c[15],be=o[0],pe=o[1],ye=o[2],Ee=o[3],Ne=o[4],tt=o[5],St=o[6],Qe=o[7],Ze=o[8],mt=o[9],ct=o[10],rt=o[11],De=o[12],yt=o[13],ft=o[14],It=o[15];return Math.abs(h-be)<=sr*Math.max(1,Math.abs(h),Math.abs(be))&&Math.abs(p-pe)<=sr*Math.max(1,Math.abs(p),Math.abs(pe))&&Math.abs(y-ye)<=sr*Math.max(1,Math.abs(y),Math.abs(ye))&&Math.abs(v-Ee)<=sr*Math.max(1,Math.abs(v),Math.abs(Ee))&&Math.abs(w-Ne)<=sr*Math.max(1,Math.abs(w),Math.abs(Ne))&&Math.abs(C-tt)<=sr*Math.max(1,Math.abs(C),Math.abs(tt))&&Math.abs(A-St)<=sr*Math.max(1,Math.abs(A),Math.abs(St))&&Math.abs(O-Qe)<=sr*Math.max(1,Math.abs(O),Math.abs(Qe))&&Math.abs(R-Ze)<=sr*Math.max(1,Math.abs(R),Math.abs(Ze))&&Math.abs(N-mt)<=sr*Math.max(1,Math.abs(N),Math.abs(mt))&&Math.abs($-ct)<=sr*Math.max(1,Math.abs($),Math.abs(ct))&&Math.abs(q-rt)<=sr*Math.max(1,Math.abs(q),Math.abs(rt))&&Math.abs(G-De)<=sr*Math.max(1,Math.abs(G),Math.abs(De))&&Math.abs(X-yt)<=sr*Math.max(1,Math.abs(X),Math.abs(yt))&&Math.abs(ie-ft)<=sr*Math.max(1,Math.abs(ie),Math.abs(ft))&&Math.abs(ae-It)<=sr*Math.max(1,Math.abs(ae),Math.abs(It))},u.a0=Qt,u.a1=K_,u.a2=Be,u.a3=c=>{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of c){const y=window.document.createElement("source");lt(p)||(o.crossOrigin="Anonymous"),y.src=p,o.appendChild(y)}})},u.a4=function(){return Le++},u.a5=et,u.a6=Hu,u.a7=yd,u.a8=sc,u.a9=CE,u.aA=function(c){if(c.type==="custom")return new G9(c);switch(c.type){case"background":return new H9(c);case"circle":return new I7(c);case"fill":return new Z7(c);case"fill-extrusion":return new c9(c);case"heatmap":return new O7(c);case"hillshade":return new R7(c);case"line":return new y9(c);case"raster":return new W9(c);case"symbol":return new jm(c)}},u.aB=it,u.aC=function(c,o){if(!c)return[{command:"setStyle",args:[o]}];let h=[];try{if(!Kt(c.version,o.version))return[{command:"setStyle",args:[o]}];Kt(c.center,o.center)||h.push({command:"setCenter",args:[o.center]}),Kt(c.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),Kt(c.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),Kt(c.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),Kt(c.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),Kt(c.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),Kt(c.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),Kt(c.light,o.light)||h.push({command:"setLight",args:[o.light]}),Kt(c.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),Kt(c.sky,o.sky)||h.push({command:"setSky",args:[o.sky]}),Kt(c.projection,o.projection)||h.push({command:"setProjection",args:[o.projection]});const p={},y=[];(function(w,C,A,O){let R;for(R in C=C||{},w=w||{})Object.prototype.hasOwnProperty.call(w,R)&&(Object.prototype.hasOwnProperty.call(C,R)||tr(R,A,O));for(R in C)Object.prototype.hasOwnProperty.call(C,R)&&(Object.prototype.hasOwnProperty.call(w,R)?Kt(w[R],C[R])||(w[R].type==="geojson"&&C[R].type==="geojson"&&Dr(w,C,R)?dn(A,{command:"setGeoJSONSourceData",args:[R,C[R].data]}):bi(R,C,A,O)):er(R,C,A))})(c.sources,o.sources,y,p);const v=[];c.layers&&c.layers.forEach(w=>{"source"in w&&p[w.source]?h.push({command:"removeLayer",args:[w.id]}):v.push(w)}),h=h.concat(y),function(w,C,A){C=C||[];const O=(w=w||[]).map(Es),R=C.map(Es),N=w.reduce(Cs,{}),$=C.reduce(Cs,{}),q=O.slice(),G=Object.create(null);let X,ie,ae,be,pe;for(let ye=0,Ee=0;ye<O.length;ye++)X=O[ye],Object.prototype.hasOwnProperty.call($,X)?Ee++:(dn(A,{command:"removeLayer",args:[X]}),q.splice(q.indexOf(X,Ee),1));for(let ye=0,Ee=0;ye<R.length;ye++)X=R[R.length-1-ye],q[q.length-1-ye]!==X&&(Object.prototype.hasOwnProperty.call(N,X)?(dn(A,{command:"removeLayer",args:[X]}),q.splice(q.lastIndexOf(X,q.length-Ee),1)):Ee++,be=q[q.length-ye],dn(A,{command:"addLayer",args:[$[X],be]}),q.splice(q.length-ye,0,X),G[X]=!0);for(let ye=0;ye<R.length;ye++)if(X=R[ye],ie=N[X],ae=$[X],!G[X]&&!Kt(ie,ae))if(Kt(ie.source,ae.source)&&Kt(ie["source-layer"],ae["source-layer"])&&Kt(ie.type,ae.type)){for(pe in xi(ie.layout,ae.layout,A,X,null,"setLayoutProperty"),xi(ie.paint,ae.paint,A,X,null,"setPaintProperty"),Kt(ie.filter,ae.filter)||dn(A,{command:"setFilter",args:[X,ae.filter]}),Kt(ie.minzoom,ae.minzoom)&&Kt(ie.maxzoom,ae.maxzoom)||dn(A,{command:"setLayerZoomRange",args:[X,ae.minzoom,ae.maxzoom]}),ie)Object.prototype.hasOwnProperty.call(ie,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?xi(ie[pe],ae[pe],A,X,pe.slice(6),"setPaintProperty"):Kt(ie[pe],ae[pe])||dn(A,{command:"setLayerProperty",args:[X,pe,ae[pe]]}));for(pe in ae)Object.prototype.hasOwnProperty.call(ae,pe)&&!Object.prototype.hasOwnProperty.call(ie,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?xi(ie[pe],ae[pe],A,X,pe.slice(6),"setPaintProperty"):Kt(ie[pe],ae[pe])||dn(A,{command:"setLayerProperty",args:[X,pe,ae[pe]]}))}else dn(A,{command:"removeLayer",args:[X]}),be=q[q.lastIndexOf(X)+1],dn(A,{command:"addLayer",args:[ae,be]})}(v,o.layers,h)}catch(p){console.warn("Unable to compute style diff:",p),h=[{command:"setStyle",args:[o]}]}return h},u.aD=function(c){const o=[],h=c.id;return h===void 0&&o.push({message:`layers.${h}: missing required property "id"`}),c.render===void 0&&o.push({message:`layers.${h}: missing required method "render"`}),c.renderingMode&&c.renderingMode!=="2d"&&c.renderingMode!=="3d"&&o.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),o},u.aE=function c(o,h){if(Array.isArray(o)){if(!Array.isArray(h)||o.length!==h.length)return!1;for(let p=0;p<o.length;p++)if(!c(o[p],h[p]))return!1;return!0}if(typeof o=="object"&&o!==null&&h!==null){if(typeof h!="object"||Object.keys(o).length!==Object.keys(h).length)return!1;for(const p in o)if(!c(o[p],h[p]))return!1;return!0}return o===h},u.aF=Ie,u.aG=Ye,u.aH=class extends nc{constructor(c,o){super(c,o),this.current=0}set(c){this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}},u.aI=Am,u.aJ=class extends nc{constructor(c,o){super(c,o),this.current=k7}set(c){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let o=1;o<16;o++)if(c[o]!==this.current[o]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}},u.aK=pS,u.aL=fS,u.aM=vn,u.aN=class extends nc{constructor(c,o){super(c,o),this.current=[0,0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2]))}},u.aO=class extends nc{constructor(c,o){super(c,o),this.current=[0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1]))}},u.aP=function(c,o,h,p,y,v,w){var C=1/(o-h),A=1/(p-y),O=1/(v-w);return c[0]=-2*C,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*A,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*O,c[11]=0,c[12]=(o+h)*C,c[13]=(y+p)*A,c[14]=(w+v)*O,c[15]=1,c},u.aQ=P7,u.aR=class extends me{},u.aS=v9,u.aT=class extends xe{},u.aU=A_,u.aV=function(c){return c<=1?1:Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))},u.aW=AS,u.aX=Di,u.aY=is,u.aZ=class extends pt{},u.a_=function(c,o){return c[0]===o[0]&&c[1]===o[1]&&c[2]===o[2]&&c[3]===o[3]&&c[4]===o[4]&&c[5]===o[5]&&c[6]===o[6]&&c[7]===o[7]&&c[8]===o[8]&&c[9]===o[9]&&c[10]===o[10]&&c[11]===o[11]&&c[12]===o[12]&&c[13]===o[13]&&c[14]===o[14]&&c[15]===o[15]},u.aa=function(c){const o={};if(c.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,y,v)=>{const w=y||v;return o[p]=!w||w.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},u.ab=function(c,o){const h=[];for(const p in c)p in o||h.push(p);return h},u.ac=Ae,u.ad=function(c,o,h){var p=Math.sin(h),y=Math.cos(h),v=o[0],w=o[1],C=o[2],A=o[3],O=o[4],R=o[5],N=o[6],$=o[7];return o!==c&&(c[8]=o[8],c[9]=o[9],c[10]=o[10],c[11]=o[11],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c[0]=v*y+O*p,c[1]=w*y+R*p,c[2]=C*y+N*p,c[3]=A*y+$*p,c[4]=O*y-v*p,c[5]=R*y-w*p,c[6]=N*y-C*p,c[7]=$*y-A*p,c},u.ae=function(c){var o=new Bu(16);return o[0]=c[0],o[1]=c[1],o[2]=c[2],o[3]=c[3],o[4]=c[4],o[5]=c[5],o[6]=c[6],o[7]=c[7],o[8]=c[8],o[9]=c[9],o[10]=c[10],o[11]=c[11],o[12]=c[12],o[13]=c[13],o[14]=c[14],o[15]=c[15],o},u.af=Om,u.ag=function(c,o){let h=0,p=0;if(c.kind==="constant")p=c.layoutSize;else if(c.kind!=="source"){const{interpolationType:y,minZoom:v,maxZoom:w}=c,C=y?Ae(ir.interpolationFactor(y,o,v,w),0,1):0;c.kind==="camera"?p=nr.number(c.minSize,c.maxSize,C):h=C}return{uSizeT:h,uSize:p}},u.ai=function(c,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:y}){return c.kind==="source"?p/mo:c.kind==="composite"?nr.number(p/mo,y/mo,h):o},u.aj=q_,u.ak=function(c,o,h,p){const y=o.y-c.y,v=o.x-c.x,w=p.y-h.y,C=p.x-h.x,A=w*v-C*y;if(A===0)return null;const O=(C*(c.y-h.y)-w*(c.x-h.x))/A;return new E(c.x+O*v,c.y+O*y)},u.al=PE,u.am=_S,u.an=C_,u.ao=function(c){let o=1/0,h=1/0,p=-1/0,y=-1/0;for(const v of c)o=Math.min(o,v.x),h=Math.min(h,v.y),p=Math.max(p,v.x),y=Math.max(y,v.y);return[o,h,p,y]},u.ap=li,u.ar=H_,u.as=function(c,o){var h=o[0],p=o[1],y=o[2],v=o[3],w=o[4],C=o[5],A=o[6],O=o[7],R=o[8],N=o[9],$=o[10],q=o[11],G=o[12],X=o[13],ie=o[14],ae=o[15],be=h*C-p*w,pe=h*A-y*w,ye=h*O-v*w,Ee=p*A-y*C,Ne=p*O-v*C,tt=y*O-v*A,St=R*X-N*G,Qe=R*ie-$*G,Ze=R*ae-q*G,mt=N*ie-$*X,ct=N*ae-q*X,rt=$*ae-q*ie,De=be*rt-pe*ct+ye*mt+Ee*Ze-Ne*Qe+tt*St;return De?(c[0]=(C*rt-A*ct+O*mt)*(De=1/De),c[1]=(y*ct-p*rt-v*mt)*De,c[2]=(X*tt-ie*Ne+ae*Ee)*De,c[3]=($*Ne-N*tt-q*Ee)*De,c[4]=(A*Ze-w*rt-O*Qe)*De,c[5]=(h*rt-y*Ze+v*Qe)*De,c[6]=(ie*ye-G*tt-ae*pe)*De,c[7]=(R*tt-$*ye+q*pe)*De,c[8]=(w*ct-C*Ze+O*St)*De,c[9]=(p*Ze-h*ct-v*St)*De,c[10]=(G*Ne-X*ye+ae*be)*De,c[11]=(N*ye-R*Ne-q*be)*De,c[12]=(C*Qe-w*mt-A*St)*De,c[13]=(h*mt-p*Qe+y*St)*De,c[14]=(X*pe-G*Ee-ie*be)*De,c[15]=(R*Ee-N*pe+$*be)*De,c):null},u.at=Q_,u.au=U_,u.av=eb,u.aw=function(){const c={},o=we.$version;for(const h in we.$root){const p=we.$root[h];if(p.required){let y=null;y=h==="version"?o:p.type==="array"?[]:{},y!=null&&(c[h]=y)}}return c},u.ax=Id,u.ay=je,u.az=function(c){c=c.slice();const o=Object.create(null);for(let h=0;h<c.length;h++)o[c[h].id]=c[h];for(let h=0;h<c.length;h++)"ref"in c[h]&&(c[h]=Ss(c[h],o[c[h].ref]));return c},u.b=jt,u.b0=function(c,o){return c[0]=o[0],c[1]=o[1],c[2]=o[2],c[3]=o[3],c[4]=o[4],c[5]=o[5],c[6]=o[6],c[7]=o[7],c[8]=o[8],c[9]=o[9],c[10]=o[10],c[11]=o[11],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15],c},u.b1=function(c,o,h){return c[0]=o[0]*h[0],c[1]=o[1]*h[1],c[2]=o[2]*h[2],c[3]=o[3]*h[3],c},u.b2=function(c,o){return c[0]*o[0]+c[1]*o[1]+c[2]*o[2]+c[3]*o[3]},u.b3=ke,u.b4=kE,u.b5=vE,u.b6=function(c,o,h,p,y){var v,w=1/Math.tan(o/2);return c[0]=w/h,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=w,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=-1,c[12]=0,c[13]=0,c[15]=0,y!=null&&y!==1/0?(c[10]=(y+p)*(v=1/(p-y)),c[14]=2*y*p*v):(c[10]=-1,c[14]=-2*p),c},u.b7=function(c,o,h){var p=Math.sin(h),y=Math.cos(h),v=o[4],w=o[5],C=o[6],A=o[7],O=o[8],R=o[9],N=o[10],$=o[11];return o!==c&&(c[0]=o[0],c[1]=o[1],c[2]=o[2],c[3]=o[3],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c[4]=v*y+O*p,c[5]=w*y+R*p,c[6]=C*y+N*p,c[7]=A*y+$*p,c[8]=O*y-v*p,c[9]=R*y-w*p,c[10]=N*y-C*p,c[11]=$*y-A*p,c},u.b8=oe,u.b9=J,u.bA=YS,u.bB=function(c){return c.message===bn},u.bC=Fa,u.bD=_r,u.ba=function(c){return c*Math.PI/180},u.bb=function(c,o){const{x:h,y:p}=Kd.fromLngLat(o);return!(c<0||c>25||p<0||p>=1||h<0||h>=1)},u.bc=function(c,o){return c[0]=o[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=o[1],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=o[2],c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c},u.bd=class extends L{},u.be=Y_,u.bf=iU,u.bh=Ce,u.bi=function(c,o){Wn.REGISTERED_PROTOCOLS[c]=o},u.bj=function(c){delete Wn.REGISTERED_PROTOCOLS[c]},u.bk=function(c,o){const h={};for(let y=0;y<c.length;y++){const v=o&&o[c[y].id]||ym(c[y]);o&&(o[c[y].id]=v);let w=h[v];w||(w=h[v]=[]),w.push(c[y])}const p=[];for(const y in h)p.push(h[y]);return p},u.bl=ot,u.bm=EE,u.bn=TE,u.bo=rE,u.bp=function(c){c.bucket.createArrays(),c.bucket.tilePixelRatio=oi/(512*c.bucket.overscaling),c.bucket.compareText={},c.bucket.iconsNeedLinear=!1;const o=c.bucket.layers[0],h=o.layout,p=o._unevaluatedLayout._values,y={layoutIconSize:p["icon-size"].possiblyEvaluate(new Ln(c.bucket.zoom+1),c.canonical),layoutTextSize:p["text-size"].possiblyEvaluate(new Ln(c.bucket.zoom+1),c.canonical),textMaxSize:p["text-size"].possiblyEvaluate(new Ln(18))};if(c.bucket.textSizeData.kind==="composite"){const{minZoom:O,maxZoom:R}=c.bucket.textSizeData;y.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Ln(O),c.canonical),p["text-size"].possiblyEvaluate(new Ln(R),c.canonical)]}if(c.bucket.iconSizeData.kind==="composite"){const{minZoom:O,maxZoom:R}=c.bucket.iconSizeData;y.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Ln(O),c.canonical),p["icon-size"].possiblyEvaluate(new Ln(R),c.canonical)]}const v=h.get("text-line-height")*li,w=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point",C=h.get("text-keep-upright"),A=h.get("text-size");for(const O of c.bucket.features){const R=h.get("text-font").evaluate(O,{},c.canonical).join(","),N=A.evaluate(O,{},c.canonical),$=y.layoutTextSize.evaluate(O,{},c.canonical),q=y.layoutIconSize.evaluate(O,{},c.canonical),G={horizontal:{},vertical:void 0},X=O.text;let ie,ae=[0,0];if(X){const ye=X.toString(),Ee=h.get("text-letter-spacing").evaluate(O,{},c.canonical)*li,Ne=m_(ye)?Ee:0,tt=h.get("text-anchor").evaluate(O,{},c.canonical),St=FE(o,O,c.canonical);if(!St){const ct=h.get("text-radial-offset").evaluate(O,{},c.canonical);ae=ct?BE(tt,[ct*li,J_]):h.get("text-offset").evaluate(O,{},c.canonical).map(rt=>rt*li)}let Qe=w?"center":h.get("text-justify").evaluate(O,{},c.canonical);const Ze=h.get("symbol-placement")==="point"?h.get("text-max-width").evaluate(O,{},c.canonical)*li:1/0,mt=()=>{c.bucket.allowVerticalPlacement&&Dd(ye)&&(G.vertical=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,tt,"left",Ne,ae,u.ah.vertical,!0,$,N))};if(!w&&St){const ct=new Set;if(Qe==="auto")for(let De=0;De<St.values.length;De+=2)ct.add(Q_(St.values[De]));else ct.add(Qe);let rt=!1;for(const De of ct)if(!G.horizontal[De])if(rt)G.horizontal[De]=G.horizontal[0];else{const yt=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,"center",De,Ne,ae,u.ah.horizontal,!1,$,N);yt&&(G.horizontal[De]=yt,rt=yt.positionedLines.length===1)}mt()}else{Qe==="auto"&&(Qe=Q_(tt));const ct=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,tt,Qe,Ne,ae,u.ah.horizontal,!1,$,N);ct&&(G.horizontal[Qe]=ct),mt(),Dd(ye)&&w&&C&&(G.vertical=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,tt,Qe,Ne,ae,u.ah.vertical,!1,$,N))}}let be=!1;if(O.icon&&O.icon.name){const ye=c.imageMap[O.icon.name];ye&&(ie=F9(c.imagePositions[O.icon.name],h.get("icon-offset").evaluate(O,{},c.canonical),h.get("icon-anchor").evaluate(O,{},c.canonical)),be=!!ye.sdf,c.bucket.sdfIcons===void 0?c.bucket.sdfIcons=be:c.bucket.sdfIcons!==be&&ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ye.pixelRatio!==c.bucket.pixelRatio||h.get("icon-rotate").constantOr(1)!==0)&&(c.bucket.iconsNeedLinear=!0))}const pe=$E(G.horizontal)||G.vertical;c.bucket.iconsInText=!!pe&&pe.iconsInText,(pe||ie)&&tU(c.bucket,O,G,ie,c.imageMap,y,$,q,ae,be,c.canonical)}c.showCollisionBoxes&&c.bucket.generateCollisionDebugBuffers()},u.bq=N_,u.br=z_,u.bs=L_,u.bt=nl,u.bu=F_,u.bv=class{constructor(c){this._marks={start:[c.url,"start"].join("#"),end:[c.url,"end"].join("#"),measure:c.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let c=performance.getEntriesByName(this._marks.measure);return c.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),c=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),c}},u.bw=function(c,o,h,p,y){return l(this,void 0,void 0,function*(){if(ee())try{return yield Sn(c,o,h,p,y)}catch{}return function(v,w,C,A,O){const R=v.width,N=v.height;hn&&In||(hn=new OffscreenCanvas(R,N),In=hn.getContext("2d",{willReadFrequently:!0})),hn.width=R,hn.height=N,In.drawImage(v,0,0,R,N);const $=In.getImageData(w,C,A,O);return In.clearRect(0,0,R,N),$.data}(c,o,h,p,y)})},u.bx=SE,u.by=g,u.bz=_,u.c=pi,u.d=c=>l(void 0,void 0,void 0,function*(){if(c.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(c)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),u.e=Me,u.f=c=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Mt})},p.onerror=()=>h(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 y=new Blob([new Uint8Array(c)],{type:"image/png"});p.src=c.byteLength?URL.createObjectURL(y):Mt}),u.g=jn,u.h=(c,o)=>Xe(Me(c,{type:"json"}),o),u.i=Xt,u.j=At,u.k=Dt,u.l=(c,o)=>Xe(Me(c,{type:"arrayBuffer"}),o),u.m=Xe,u.n=function(c){return new F_(c).readFields(D9,[])},u.o=$d,u.p=iE,u.q=x,u.r=p_,u.s=lt,u.t=Ad,u.u=Ko,u.v=we,u.w=ht,u.x=function([c,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:c*Math.cos(o)*Math.sin(h),y:c*Math.sin(o)*Math.sin(h),z:c*Math.cos(h)}},u.y=nr,u.z=Ln}),r("worker",["./shared"],function(u){class l{constructor(U){this.keyCache={},U&&this.replace(U)}replace(U){this._layerConfigs={},this._layers={},this.update(U,[])}update(U,j){for(const ne of U){this._layerConfigs[ne.id]=ne;const de=this._layers[ne.id]=u.aA(ne);de._featureFilter=u.a7(de.filter),this.keyCache[ne.id]&&delete this.keyCache[ne.id]}for(const ne of j)delete this.keyCache[ne],delete this._layerConfigs[ne],delete this._layers[ne];this.familiesBySource={};const Y=u.bk(Object.values(this._layerConfigs),this.keyCache);for(const ne of Y){const de=ne.map(Se=>this._layers[Se.id]),fe=de[0];if(fe.visibility==="none")continue;const _e=fe.source||"";let ue=this.familiesBySource[_e];ue||(ue=this.familiesBySource[_e]={});const Te=fe.sourceLayer||"_geojsonTileLayer";let ze=ue[Te];ze||(ze=ue[Te]=[]),ze.push(de)}}}class g{constructor(U){const j={},Y=[];for(const _e in U){const ue=U[_e],Te=j[_e]={};for(const ze in ue){const Se=ue[+ze];if(!Se||Se.bitmap.width===0||Se.bitmap.height===0)continue;const Ue={x:0,y:0,w:Se.bitmap.width+2,h:Se.bitmap.height+2};Y.push(Ue),Te[ze]={rect:Ue,metrics:Se.metrics}}}const{w:ne,h:de}=u.p(Y),fe=new u.o({width:ne||1,height:de||1});for(const _e in U){const ue=U[_e];for(const Te in ue){const ze=ue[+Te];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Se=j[_e][Te].rect;u.o.copy(ze.bitmap,fe,{x:0,y:0},{x:Se.x+1,y:Se.y+1},ze.bitmap)}}this.image=fe,this.positions=j}}u.bl("GlyphAtlas",g);class _{constructor(U){this.tileID=new u.S(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.uid=U.uid,this.zoom=U.zoom,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=U.showCollisionBoxes,this.collectResourceTiming=!!U.collectResourceTiming,this.returnDependencies=!!U.returnDependencies,this.promoteId=U.promoteId,this.inFlightDependencies=[]}parse(U,j,Y,ne){return u._(this,void 0,void 0,function*(){this.status="parsing",this.data=U,this.collisionBoxArray=new u.a5;const de=new u.bm(Object.keys(U.layers).sort()),fe=new u.bn(this.tileID,this.promoteId);fe.bucketLayerIDs=[];const _e={},ue={featureIndex:fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:Y},Te=j.familiesBySource[this.source];for(const $t in Te){const xn=U.layers[$t];if(!xn)continue;xn.version===1&&u.w(`Vector tile source "${this.source}" layer "${$t}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Un=de.encode($t),fi=[];for(let wi=0;wi<xn.length;wi++){const Hi=xn.feature(wi),Ma=fe.getId(Hi,$t);fi.push({feature:Hi,id:Ma,index:wi,sourceLayerIndex:Un})}for(const wi of Te[$t]){const Hi=wi[0];Hi.source!==this.source&&u.w(`layer.source = ${Hi.source} does not equal this.source = ${this.source}`),Hi.minzoom&&this.zoom<Math.floor(Hi.minzoom)||Hi.maxzoom&&this.zoom>=Hi.maxzoom||Hi.visibility!=="none"&&(k(wi,this.zoom,Y),(_e[Hi.id]=Hi.createBucket({index:fe.bucketLayerIDs.length,layers:wi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Un,sourceID:this.source})).populate(fi,ue,this.tileID.canonical),fe.bucketLayerIDs.push(wi.map(Ma=>Ma.id)))}}const ze=u.aF(ue.glyphDependencies,$t=>Object.keys($t).map(Number));this.inFlightDependencies.forEach($t=>$t==null?void 0:$t.abort()),this.inFlightDependencies=[];let Se=Promise.resolve({});if(Object.keys(ze).length){const $t=new AbortController;this.inFlightDependencies.push($t),Se=ne.sendAsync({type:"GG",data:{stacks:ze,source:this.source,tileID:this.tileID,type:"glyphs"}},$t)}const Ue=Object.keys(ue.iconDependencies);let bt=Promise.resolve({});if(Ue.length){const $t=new AbortController;this.inFlightDependencies.push($t),bt=ne.sendAsync({type:"GI",data:{icons:Ue,source:this.source,tileID:this.tileID,type:"icons"}},$t)}const kt=Object.keys(ue.patternDependencies);let sn=Promise.resolve({});if(kt.length){const $t=new AbortController;this.inFlightDependencies.push($t),sn=ne.sendAsync({type:"GI",data:{icons:kt,source:this.source,tileID:this.tileID,type:"patterns"}},$t)}const[Lt,on,Zt]=yield Promise.all([Se,bt,sn]),ri=new g(Lt),Zn=new u.bo(on,Zt);for(const $t in _e){const xn=_e[$t];xn instanceof u.a6?(k(xn.layers,this.zoom,Y),u.bp({bucket:xn,glyphMap:Lt,glyphPositions:ri.positions,imageMap:on,imagePositions:Zn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):xn.hasPattern&&(xn instanceof u.bq||xn instanceof u.br||xn instanceof u.bs)&&(k(xn.layers,this.zoom,Y),xn.addFeatures(ue,this.tileID.canonical,Zn.patternPositions))}return this.status="done",{buckets:Object.values(_e).filter($t=>!$t.isEmpty()),featureIndex:fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ri.image,imageAtlas:Zn,glyphMap:this.returnDependencies?Lt:null,iconMap:this.returnDependencies?on:null,glyphPositions:this.returnDependencies?ri.positions:null}})}}function k(se,U,j){const Y=new u.z(U);for(const ne of se)ne.recalculate(Y,j)}class E{constructor(U,j,Y){this.actor=U,this.layerIndex=j,this.availableImages=Y,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(U,j){return u._(this,void 0,void 0,function*(){const Y=yield u.l(U.request,j);try{return{vectorTile:new u.bt.VectorTile(new u.bu(Y.data)),rawData:Y.data,cacheControl:Y.cacheControl,expires:Y.expires}}catch(ne){const de=new Uint8Array(Y.data);let fe=`Unable to parse the tile at ${U.request.url}, `;throw fe+=de[0]===31&&de[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ne.message}`,new Error(fe)}})}loadTile(U){return u._(this,void 0,void 0,function*(){const j=U.uid,Y=!!(U&&U.request&&U.request.collectResourceTiming)&&new u.bv(U.request),ne=new _(U);this.loading[j]=ne;const de=new AbortController;ne.abort=de;try{const fe=yield this.loadVectorTile(U,de);if(delete this.loading[j],!fe)return null;const _e=fe.rawData,ue={};fe.expires&&(ue.expires=fe.expires),fe.cacheControl&&(ue.cacheControl=fe.cacheControl);const Te={};if(Y){const Se=Y.finish();Se&&(Te.resourceTiming=JSON.parse(JSON.stringify(Se)))}ne.vectorTile=fe.vectorTile;const ze=ne.parse(fe.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[j]=ne,this.fetching[j]={rawTileData:_e,cacheControl:ue,resourceTiming:Te};try{const Se=yield ze;return u.e({rawTileData:_e.slice(0)},Se,ue,Te)}finally{delete this.fetching[j]}}catch(fe){throw delete this.loading[j],ne.status="done",this.loaded[j]=ne,fe}})}reloadTile(U){return u._(this,void 0,void 0,function*(){const j=U.uid;if(!this.loaded||!this.loaded[j])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const Y=this.loaded[j];if(Y.showCollisionBoxes=U.showCollisionBoxes,Y.status==="parsing"){const ne=yield Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor);let de;if(this.fetching[j]){const{rawTileData:fe,cacheControl:_e,resourceTiming:ue}=this.fetching[j];delete this.fetching[j],de=u.e({rawTileData:fe.slice(0)},ne,_e,ue)}else de=ne;return de}if(Y.status==="done"&&Y.vectorTile)return Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(U){return u._(this,void 0,void 0,function*(){const j=this.loading,Y=U.uid;j&&j[Y]&&j[Y].abort&&(j[Y].abort.abort(),delete j[Y])})}removeTile(U){return u._(this,void 0,void 0,function*(){this.loaded&&this.loaded[U.uid]&&delete this.loaded[U.uid]})}}class T{constructor(){this.loaded={}}loadTile(U){return u._(this,void 0,void 0,function*(){const{uid:j,encoding:Y,rawImageData:ne,redFactor:de,greenFactor:fe,blueFactor:_e,baseShift:ue}=U,Te=ne.width+2,ze=ne.height+2,Se=u.b(ne)?new u.R({width:Te,height:ze},yield u.bw(ne,-1,-1,Te,ze)):ne,Ue=new u.bx(j,Se,Y,de,fe,_e,ue);return this.loaded=this.loaded||{},this.loaded[j]=Ue,Ue})}removeTile(U){const j=this.loaded,Y=U.uid;j&&j[Y]&&delete j[Y]}}function I(se,U){if(se.length!==0){z(se[0],U);for(var j=1;j<se.length;j++)z(se[j],!U)}}function z(se,U){for(var j=0,Y=0,ne=0,de=se.length,fe=de-1;ne<de;fe=ne++){var _e=(se[ne][0]-se[fe][0])*(se[fe][1]+se[ne][1]),ue=j+_e;Y+=Math.abs(j)>=Math.abs(_e)?j-ue+_e:_e-ue+j,j=ue}j+Y>=0!=!!U&&se.reverse()}var V=u.by(function se(U,j){var Y,ne=U&&U.type;if(ne==="FeatureCollection")for(Y=0;Y<U.features.length;Y++)se(U.features[Y],j);else if(ne==="GeometryCollection")for(Y=0;Y<U.geometries.length;Y++)se(U.geometries[Y],j);else if(ne==="Feature")se(U.geometry,j);else if(ne==="Polygon")I(U.coordinates,j);else if(ne==="MultiPolygon")for(Y=0;Y<U.coordinates.length;Y++)I(U.coordinates[Y],j);return U});const H=u.bt.VectorTileFeature.prototype.toGeoJSON;var Z={exports:{}},ee=u.bz,oe=u.bt.VectorTileFeature,J=Ae;function Ae(se,U){this.options=U||{},this.features=se,this.length=se.length}function ke(se,U){this.id=typeof se.id=="number"?se.id:void 0,this.type=se.type,this.rawGeometry=se.type===1?[se.geometry]:se.geometry,this.properties=se.tags,this.extent=U||4096}Ae.prototype.feature=function(se){return new ke(this.features[se],this.options.extent)},ke.prototype.loadGeometry=function(){var se=this.rawGeometry;this.geometry=[];for(var U=0;U<se.length;U++){for(var j=se[U],Y=[],ne=0;ne<j.length;ne++)Y.push(new ee(j[ne][0],j[ne][1]));this.geometry.push(Y)}return this.geometry},ke.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var se=this.geometry,U=1/0,j=-1/0,Y=1/0,ne=-1/0,de=0;de<se.length;de++)for(var fe=se[de],_e=0;_e<fe.length;_e++){var ue=fe[_e];U=Math.min(U,ue.x),j=Math.max(j,ue.x),Y=Math.min(Y,ue.y),ne=Math.max(ne,ue.y)}return[U,Y,j,ne]},ke.prototype.toGeoJSON=oe.prototype.toGeoJSON;var Me=u.bA,Le=J;function Ie(se){var U=new Me;return function(j,Y){for(var ne in j.layers)Y.writeMessage(3,Ye,j.layers[ne])}(se,U),U.finish()}function Ye(se,U){var j;U.writeVarintField(15,se.version||1),U.writeStringField(1,se.name||""),U.writeVarintField(5,se.extent||4096);var Y={keys:[],values:[],keycache:{},valuecache:{}};for(j=0;j<se.length;j++)Y.feature=se.feature(j),U.writeMessage(2,it,Y);var ne=Y.keys;for(j=0;j<ne.length;j++)U.writeStringField(3,ne[j]);var de=Y.values;for(j=0;j<de.length;j++)U.writeMessage(4,nn,de[j])}function it(se,U){var j=se.feature;j.id!==void 0&&U.writeVarintField(1,j.id),U.writeMessage(2,Nt,se),U.writeVarintField(3,j.type),U.writeMessage(4,Xt,j)}function Nt(se,U){var j=se.feature,Y=se.keys,ne=se.values,de=se.keycache,fe=se.valuecache;for(var _e in j.properties){var ue=j.properties[_e],Te=de[_e];if(ue!==null){Te===void 0&&(Y.push(_e),de[_e]=Te=Y.length-1),U.writeVarint(Te);var ze=typeof ue;ze!=="string"&&ze!=="boolean"&&ze!=="number"&&(ue=JSON.stringify(ue));var Se=ze+":"+ue,Ue=fe[Se];Ue===void 0&&(ne.push(ue),fe[Se]=Ue=ne.length-1),U.writeVarint(Ue)}}}function ht(se,U){return(U<<3)+(7&se)}function Rt(se){return se<<1^se>>31}function Xt(se,U){for(var j=se.loadGeometry(),Y=se.type,ne=0,de=0,fe=j.length,_e=0;_e<fe;_e++){var ue=j[_e],Te=1;Y===1&&(Te=ue.length),U.writeVarint(ht(1,Te));for(var ze=Y===3?ue.length-1:ue.length,Se=0;Se<ze;Se++){Se===1&&Y!==1&&U.writeVarint(ht(2,ze-1));var Ue=ue[Se].x-ne,bt=ue[Se].y-de;U.writeVarint(Rt(Ue)),U.writeVarint(Rt(bt)),ne+=Ue,de+=bt}Y===3&&U.writeVarint(ht(7,1))}}function nn(se,U){var j=typeof se;j==="string"?U.writeStringField(1,se):j==="boolean"?U.writeBooleanField(7,se):j==="number"&&(se%1!=0?U.writeDoubleField(3,se):se<0?U.writeSVarintField(6,se):U.writeVarintField(5,se))}Z.exports=Ie,Z.exports.fromVectorTileJs=Ie,Z.exports.fromGeojsonVt=function(se,U){U=U||{};var j={};for(var Y in se)j[Y]=new Le(se[Y].features,U),j[Y].name=Y,j[Y].version=U.version,j[Y].extent=U.extent;return Ie({layers:j})},Z.exports.GeoJSONWrapper=Le;var jt=u.by(Z.exports);const Mt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:se=>se},Sn=Math.fround||(hn=new Float32Array(1),se=>(hn[0]=+se,hn[0]));var hn;const In=3,bn=5,pi=6;class Wn{constructor(U){this.options=Object.assign(Object.create(Mt),U),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(U){const{log:j,minZoom:Y,maxZoom:ne}=this.options;j&&console.time("total time");const de=`prepare ${U.length} points`;j&&console.time(de),this.points=U;const fe=[];for(let ue=0;ue<U.length;ue++){const Te=U[ue];if(!Te.geometry)continue;const[ze,Se]=Te.geometry.coordinates,Ue=Sn(Ce(ze)),bt=Sn(je(Se));fe.push(Ue,bt,1/0,ue,-1,1),this.options.reduce&&fe.push(0)}let _e=this.trees[ne+1]=this._createTree(fe);j&&console.timeEnd(de);for(let ue=ne;ue>=Y;ue--){const Te=+Date.now();_e=this.trees[ue]=this._createTree(this._cluster(_e,ue)),j&&console.log("z%d: %d clusters in %dms",ue,_e.numItems,+Date.now()-Te)}return j&&console.timeEnd("total time"),this}getClusters(U,j){let Y=((U[0]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,U[1]));let de=U[2]===180?180:((U[2]+180)%360+360)%360-180;const fe=Math.max(-90,Math.min(90,U[3]));if(U[2]-U[0]>=360)Y=-180,de=180;else if(Y>de){const Se=this.getClusters([Y,ne,180,fe],j),Ue=this.getClusters([-180,ne,de,fe],j);return Se.concat(Ue)}const _e=this.trees[this._limitZoom(j)],ue=_e.range(Ce(Y),je(fe),Ce(de),je(ne)),Te=_e.data,ze=[];for(const Se of ue){const Ue=this.stride*Se;ze.push(Te[Ue+bn]>1?jn(Te,Ue,this.clusterProps):this.points[Te[Ue+In]])}return ze}getChildren(U){const j=this._getOriginId(U),Y=this._getOriginZoom(U),ne="No cluster with the specified id.",de=this.trees[Y];if(!de)throw new Error(ne);const fe=de.data;if(j*this.stride>=fe.length)throw new Error(ne);const _e=this.options.radius/(this.options.extent*Math.pow(2,Y-1)),ue=de.within(fe[j*this.stride],fe[j*this.stride+1],_e),Te=[];for(const ze of ue){const Se=ze*this.stride;fe[Se+4]===U&&Te.push(fe[Se+bn]>1?jn(fe,Se,this.clusterProps):this.points[fe[Se+In]])}if(Te.length===0)throw new Error(ne);return Te}getLeaves(U,j,Y){const ne=[];return this._appendLeaves(ne,U,j=j||10,Y=Y||0,0),ne}getTile(U,j,Y){const ne=this.trees[this._limitZoom(U)],de=Math.pow(2,U),{extent:fe,radius:_e}=this.options,ue=_e/fe,Te=(Y-ue)/de,ze=(Y+1+ue)/de,Se={features:[]};return this._addTileFeatures(ne.range((j-ue)/de,Te,(j+1+ue)/de,ze),ne.data,j,Y,de,Se),j===0&&this._addTileFeatures(ne.range(1-ue/de,Te,1,ze),ne.data,de,Y,de,Se),j===de-1&&this._addTileFeatures(ne.range(0,Te,ue/de,ze),ne.data,-1,Y,de,Se),Se.features.length?Se:null}getClusterExpansionZoom(U){let j=this._getOriginZoom(U)-1;for(;j<=this.options.maxZoom;){const Y=this.getChildren(U);if(j++,Y.length!==1)break;U=Y[0].properties.cluster_id}return j}_appendLeaves(U,j,Y,ne,de){const fe=this.getChildren(j);for(const _e of fe){const ue=_e.properties;if(ue&&ue.cluster?de+ue.point_count<=ne?de+=ue.point_count:de=this._appendLeaves(U,ue.cluster_id,Y,ne,de):de<ne?de++:U.push(_e),U.length===Y)break}return de}_createTree(U){const j=new u.av(U.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Y=0;Y<U.length;Y+=this.stride)j.add(U[Y],U[Y+1]);return j.finish(),j.data=U,j}_addTileFeatures(U,j,Y,ne,de,fe){for(const _e of U){const ue=_e*this.stride,Te=j[ue+bn]>1;let ze,Se,Ue;if(Te)ze=Gn(j,ue,this.clusterProps),Se=j[ue],Ue=j[ue+1];else{const sn=this.points[j[ue+In]];ze=sn.properties;const[Lt,on]=sn.geometry.coordinates;Se=Ce(Lt),Ue=je(on)}const bt={type:1,geometry:[[Math.round(this.options.extent*(Se*de-Y)),Math.round(this.options.extent*(Ue*de-ne))]],tags:ze};let kt;kt=Te||this.options.generateId?j[ue+In]:this.points[j[ue+In]].id,kt!==void 0&&(bt.id=kt),fe.features.push(bt)}}_limitZoom(U){return Math.max(this.options.minZoom,Math.min(Math.floor(+U),this.options.maxZoom+1))}_cluster(U,j){const{radius:Y,extent:ne,reduce:de,minPoints:fe}=this.options,_e=Y/(ne*Math.pow(2,j)),ue=U.data,Te=[],ze=this.stride;for(let Se=0;Se<ue.length;Se+=ze){if(ue[Se+2]<=j)continue;ue[Se+2]=j;const Ue=ue[Se],bt=ue[Se+1],kt=U.within(ue[Se],ue[Se+1],_e),sn=ue[Se+bn];let Lt=sn;for(const on of kt){const Zt=on*ze;ue[Zt+2]>j&&(Lt+=ue[Zt+bn])}if(Lt>sn&&Lt>=fe){let on,Zt=Ue*sn,ri=bt*sn,Zn=-1;const $t=((Se/ze|0)<<5)+(j+1)+this.points.length;for(const xn of kt){const Un=xn*ze;if(ue[Un+2]<=j)continue;ue[Un+2]=j;const fi=ue[Un+bn];Zt+=ue[Un]*fi,ri+=ue[Un+1]*fi,ue[Un+4]=$t,de&&(on||(on=this._map(ue,Se,!0),Zn=this.clusterProps.length,this.clusterProps.push(on)),de(on,this._map(ue,Un)))}ue[Se+4]=$t,Te.push(Zt/Lt,ri/Lt,1/0,$t,-1,Lt),de&&Te.push(Zn)}else{for(let on=0;on<ze;on++)Te.push(ue[Se+on]);if(Lt>1)for(const on of kt){const Zt=on*ze;if(!(ue[Zt+2]<=j)){ue[Zt+2]=j;for(let ri=0;ri<ze;ri++)Te.push(ue[Zt+ri])}}}}return Te}_getOriginId(U){return U-this.points.length>>5}_getOriginZoom(U){return(U-this.points.length)%32}_map(U,j,Y){if(U[j+bn]>1){const fe=this.clusterProps[U[j+pi]];return Y?Object.assign({},fe):fe}const ne=this.points[U[j+In]].properties,de=this.options.map(ne);return Y&&de===ne?Object.assign({},de):de}}function jn(se,U,j){return{type:"Feature",id:se[U+In],properties:Gn(se,U,j),geometry:{type:"Point",coordinates:[(Y=se[U],360*(Y-.5)),Xe(se[U+1])]}};var Y}function Gn(se,U,j){const Y=se[U+bn],ne=Y>=1e4?`${Math.round(Y/1e3)}k`:Y>=1e3?Math.round(Y/100)/10+"k":Y,de=se[U+pi],fe=de===-1?{}:Object.assign({},j[de]);return Object.assign(fe,{cluster:!0,cluster_id:se[U+In],point_count:Y,point_count_abbreviated:ne})}function Ce(se){return se/360+.5}function je(se){const U=Math.sin(se*Math.PI/180),j=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return j<0?0:j>1?1:j}function Xe(se){const U=(180-360*se)*Math.PI/180;return 360*Math.atan(Math.exp(U))/Math.PI-90}function lt(se,U,j,Y){let ne=Y;const de=U+(j-U>>1);let fe,_e=j-U;const ue=se[U],Te=se[U+1],ze=se[j],Se=se[j+1];for(let Ue=U+3;Ue<j;Ue+=3){const bt=Bt(se[Ue],se[Ue+1],ue,Te,ze,Se);if(bt>ne)fe=Ue,ne=bt;else if(bt===ne){const kt=Math.abs(Ue-de);kt<_e&&(fe=Ue,_e=kt)}}ne>Y&&(fe-U>3&&lt(se,U,fe,Y),se[fe+2]=ne,j-fe>3&&lt(se,fe,j,Y))}function Bt(se,U,j,Y,ne,de){let fe=ne-j,_e=de-Y;if(fe!==0||_e!==0){const ue=((se-j)*fe+(U-Y)*_e)/(fe*fe+_e*_e);ue>1?(j=ne,Y=de):ue>0&&(j+=fe*ue,Y+=_e*ue)}return fe=se-j,_e=U-Y,fe*fe+_e*_e}function rn(se,U,j,Y){const ne={id:se??null,type:U,geometry:j,tags:Y,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(U==="Point"||U==="MultiPoint"||U==="LineString")Dt(ne,j);else if(U==="Polygon")Dt(ne,j[0]);else if(U==="MultiLineString")for(const de of j)Dt(ne,de);else if(U==="MultiPolygon")for(const de of j)Dt(ne,de[0]);return ne}function Dt(se,U){for(let j=0;j<U.length;j+=3)se.minX=Math.min(se.minX,U[j]),se.minY=Math.min(se.minY,U[j+1]),se.maxX=Math.max(se.maxX,U[j]),se.maxY=Math.max(se.maxY,U[j+1])}function At(se,U,j,Y){if(!U.geometry)return;const ne=U.geometry.coordinates;if(ne&&ne.length===0)return;const de=U.geometry.type,fe=Math.pow(j.tolerance/((1<<j.maxZoom)*j.extent),2);let _e=[],ue=U.id;if(j.promoteId?ue=U.properties[j.promoteId]:j.generateId&&(ue=Y||0),de==="Point")ln(ne,_e);else if(de==="MultiPoint")for(const Te of ne)ln(Te,_e);else if(de==="LineString")we(ne,_e,fe,!1);else if(de==="MultiLineString"){if(j.lineMetrics){for(const Te of ne)_e=[],we(Te,_e,fe,!1),se.push(rn(ue,"LineString",_e,U.properties));return}En(ne,_e,fe,!1)}else if(de==="Polygon")En(ne,_e,fe,!0);else{if(de!=="MultiPolygon"){if(de==="GeometryCollection"){for(const Te of U.geometry.geometries)At(se,{id:ue,geometry:Te,properties:U.properties},j,Y);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Te of ne){const ze=[];En(Te,ze,fe,!0),_e.push(ze)}}se.push(rn(ue,de,_e,U.properties))}function ln(se,U){U.push(Ss(se[0]),Kt(se[1]),0)}function we(se,U,j,Y){let ne,de,fe=0;for(let ue=0;ue<se.length;ue++){const Te=Ss(se[ue][0]),ze=Kt(se[ue][1]);U.push(Te,ze,0),ue>0&&(fe+=Y?(ne*ze-Te*de)/2:Math.sqrt(Math.pow(Te-ne,2)+Math.pow(ze-de,2))),ne=Te,de=ze}const _e=U.length-3;U[2]=1,lt(U,0,_e,j),U[_e+2]=1,U.size=Math.abs(fe),U.start=0,U.end=U.size}function En(se,U,j,Y){for(let ne=0;ne<se.length;ne++){const de=[];we(se[ne],de,j,Y),U.push(de)}}function Ss(se){return se/360+.5}function Kt(se){const U=Math.sin(se*Math.PI/180),j=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return j<0?0:j>1?1:j}function dn(se,U,j,Y,ne,de,fe,_e){if(Y/=U,de>=(j/=U)&&fe<Y)return se;if(fe<j||de>=Y)return null;const ue=[];for(const Te of se){const ze=Te.geometry;let Se=Te.type;const Ue=ne===0?Te.minX:Te.minY,bt=ne===0?Te.maxX:Te.maxY;if(Ue>=j&&bt<Y){ue.push(Te);continue}if(bt<j||Ue>=Y)continue;let kt=[];if(Se==="Point"||Se==="MultiPoint")er(ze,kt,j,Y,ne);else if(Se==="LineString")tr(ze,kt,j,Y,ne,!1,_e.lineMetrics);else if(Se==="MultiLineString")Dr(ze,kt,j,Y,ne,!1);else if(Se==="Polygon")Dr(ze,kt,j,Y,ne,!0);else if(Se==="MultiPolygon")for(const sn of ze){const Lt=[];Dr(sn,Lt,j,Y,ne,!0),Lt.length&&kt.push(Lt)}if(kt.length){if(_e.lineMetrics&&Se==="LineString"){for(const sn of kt)ue.push(rn(Te.id,Se,sn,Te.tags));continue}Se!=="LineString"&&Se!=="MultiLineString"||(kt.length===1?(Se="LineString",kt=kt[0]):Se="MultiLineString"),Se!=="Point"&&Se!=="MultiPoint"||(Se=kt.length===3?"Point":"MultiPoint"),ue.push(rn(Te.id,Se,kt,Te.tags))}}return ue.length?ue:null}function er(se,U,j,Y,ne){for(let de=0;de<se.length;de+=3){const fe=se[de+ne];fe>=j&&fe<=Y&&xi(U,se[de],se[de+1],se[de+2])}}function tr(se,U,j,Y,ne,de,fe){let _e=bi(se);const ue=ne===0?Es:Cs;let Te,ze,Se=se.start;for(let Lt=0;Lt<se.length-3;Lt+=3){const on=se[Lt],Zt=se[Lt+1],ri=se[Lt+2],Zn=se[Lt+3],$t=se[Lt+4],xn=ne===0?on:Zt,Un=ne===0?Zn:$t;let fi=!1;fe&&(Te=Math.sqrt(Math.pow(on-Zn,2)+Math.pow(Zt-$t,2))),xn<j?Un>j&&(ze=ue(_e,on,Zt,Zn,$t,j),fe&&(_e.start=Se+Te*ze)):xn>Y?Un<Y&&(ze=ue(_e,on,Zt,Zn,$t,Y),fe&&(_e.start=Se+Te*ze)):xi(_e,on,Zt,ri),Un<j&&xn>=j&&(ze=ue(_e,on,Zt,Zn,$t,j),fi=!0),Un>Y&&xn<=Y&&(ze=ue(_e,on,Zt,Zn,$t,Y),fi=!0),!de&&fi&&(fe&&(_e.end=Se+Te*ze),U.push(_e),_e=bi(se)),fe&&(Se+=Te)}let Ue=se.length-3;const bt=se[Ue],kt=se[Ue+1],sn=ne===0?bt:kt;sn>=j&&sn<=Y&&xi(_e,bt,kt,se[Ue+2]),Ue=_e.length-3,de&&Ue>=3&&(_e[Ue]!==_e[0]||_e[Ue+1]!==_e[1])&&xi(_e,_e[0],_e[1],_e[2]),_e.length&&U.push(_e)}function bi(se){const U=[];return U.size=se.size,U.start=se.start,U.end=se.end,U}function Dr(se,U,j,Y,ne,de){for(const fe of se)tr(fe,U,j,Y,ne,de,!1)}function xi(se,U,j,Y){se.push(U,j,Y)}function Es(se,U,j,Y,ne,de){const fe=(de-U)/(Y-U);return xi(se,de,j+(ne-j)*fe,1),fe}function Cs(se,U,j,Y,ne,de){const fe=(de-j)/(ne-j);return xi(se,U+(Y-U)*fe,de,1),fe}function Be(se,U){const j=[];for(let Y=0;Y<se.length;Y++){const ne=se[Y],de=ne.type;let fe;if(de==="Point"||de==="MultiPoint"||de==="LineString")fe=Or(ne.geometry,U);else if(de==="MultiLineString"||de==="Polygon"){fe=[];for(const _e of ne.geometry)fe.push(Or(_e,U))}else if(de==="MultiPolygon"){fe=[];for(const _e of ne.geometry){const ue=[];for(const Te of _e)ue.push(Or(Te,U));fe.push(ue)}}j.push(rn(ne.id,de,fe,ne.tags))}return j}function Or(se,U){const j=[];j.size=se.size,se.start!==void 0&&(j.start=se.start,j.end=se.end);for(let Y=0;Y<se.length;Y+=3)j.push(se[Y]+U,se[Y+1],se[Y+2]);return j}function vi(se,U){if(se.transformed)return se;const j=1<<se.z,Y=se.x,ne=se.y;for(const de of se.features){const fe=de.geometry,_e=de.type;if(de.geometry=[],_e===1)for(let ue=0;ue<fe.length;ue+=2)de.geometry.push(zr(fe[ue],fe[ue+1],U,j,Y,ne));else for(let ue=0;ue<fe.length;ue++){const Te=[];for(let ze=0;ze<fe[ue].length;ze+=2)Te.push(zr(fe[ue][ze],fe[ue][ze+1],U,j,Y,ne));de.geometry.push(Te)}}return se.transformed=!0,se}function zr(se,U,j,Y,ne,de){return[Math.round(j*(se*Y-ne)),Math.round(j*(U*Y-de))]}function Ts(se,U,j,Y,ne){const de=U===ne.maxZoom?0:ne.tolerance/((1<<U)*ne.extent),fe={features:[],numPoints:0,numSimplified:0,numFeatures:se.length,source:null,x:j,y:Y,z:U,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of se)qe(fe,_e,de,ne);return fe}function qe(se,U,j,Y){const ne=U.geometry,de=U.type,fe=[];if(se.minX=Math.min(se.minX,U.minX),se.minY=Math.min(se.minY,U.minY),se.maxX=Math.max(se.maxX,U.maxX),se.maxY=Math.max(se.maxY,U.maxY),de==="Point"||de==="MultiPoint")for(let _e=0;_e<ne.length;_e+=3)fe.push(ne[_e],ne[_e+1]),se.numPoints++,se.numSimplified++;else if(de==="LineString")ve(fe,ne,se,j,!1,!1);else if(de==="MultiLineString"||de==="Polygon")for(let _e=0;_e<ne.length;_e++)ve(fe,ne[_e],se,j,de==="Polygon",_e===0);else if(de==="MultiPolygon")for(let _e=0;_e<ne.length;_e++){const ue=ne[_e];for(let Te=0;Te<ue.length;Te++)ve(fe,ue[Te],se,j,!0,Te===0)}if(fe.length){let _e=U.tags||null;if(de==="LineString"&&Y.lineMetrics){_e={};for(const Te in U.tags)_e[Te]=U.tags[Te];_e.mapbox_clip_start=ne.start/ne.size,_e.mapbox_clip_end=ne.end/ne.size}const ue={geometry:fe,type:de==="Polygon"||de==="MultiPolygon"?3:de==="LineString"||de==="MultiLineString"?2:1,tags:_e};U.id!==null&&(ue.id=U.id),se.features.push(ue)}}function ve(se,U,j,Y,ne,de){const fe=Y*Y;if(Y>0&&U.size<(ne?fe:Y))return void(j.numPoints+=U.length/3);const _e=[];for(let ue=0;ue<U.length;ue+=3)(Y===0||U[ue+2]>fe)&&(j.numSimplified++,_e.push(U[ue],U[ue+1])),j.numPoints++;ne&&function(ue,Te){let ze=0;for(let Se=0,Ue=ue.length,bt=Ue-2;Se<Ue;bt=Se,Se+=2)ze+=(ue[Se]-ue[bt])*(ue[Se+1]+ue[bt+1]);if(ze>0===Te)for(let Se=0,Ue=ue.length;Se<Ue/2;Se+=2){const bt=ue[Se],kt=ue[Se+1];ue[Se]=ue[Ue-2-Se],ue[Se+1]=ue[Ue-1-Se],ue[Ue-2-Se]=bt,ue[Ue-1-Se]=kt}}(_e,de),se.push(_e)}const Re={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class xt{constructor(U,j){const Y=(j=this.options=function(de,fe){for(const _e in fe)de[_e]=fe[_e];return de}(Object.create(Re),j)).debug;if(Y&&console.time("preprocess data"),j.maxZoom<0||j.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(j.promoteId&&j.generateId)throw new Error("promoteId and generateId cannot be used together.");let ne=function(de,fe){const _e=[];if(de.type==="FeatureCollection")for(let ue=0;ue<de.features.length;ue++)At(_e,de.features[ue],fe,ue);else At(_e,de.type==="Feature"?de:{geometry:de},fe);return _e}(U,j);this.tiles={},this.tileCoords=[],Y&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",j.indexMaxZoom,j.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ne=function(de,fe){const _e=fe.buffer/fe.extent;let ue=de;const Te=dn(de,1,-1-_e,_e,0,-1,2,fe),ze=dn(de,1,1-_e,2+_e,0,-1,2,fe);return(Te||ze)&&(ue=dn(de,1,-_e,1+_e,0,-1,2,fe)||[],Te&&(ue=Be(Te,1).concat(ue)),ze&&(ue=ue.concat(Be(ze,-1)))),ue}(ne,j),ne.length&&this.splitTile(ne,0,0,0),Y&&(ne.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(U,j,Y,ne,de,fe,_e){const ue=[U,j,Y,ne],Te=this.options,ze=Te.debug;for(;ue.length;){ne=ue.pop(),Y=ue.pop(),j=ue.pop(),U=ue.pop();const Se=1<<j,Ue=Ut(j,Y,ne);let bt=this.tiles[Ue];if(!bt&&(ze>1&&console.time("creation"),bt=this.tiles[Ue]=Ts(U,j,Y,ne,Te),this.tileCoords.push({z:j,x:Y,y:ne}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",j,Y,ne,bt.numFeatures,bt.numPoints,bt.numSimplified),console.timeEnd("creation"));const fi=`z${j}`;this.stats[fi]=(this.stats[fi]||0)+1,this.total++}if(bt.source=U,de==null){if(j===Te.indexMaxZoom||bt.numPoints<=Te.indexMaxPoints)continue}else{if(j===Te.maxZoom||j===de)continue;if(de!=null){const fi=de-j;if(Y!==fe>>fi||ne!==_e>>fi)continue}}if(bt.source=null,U.length===0)continue;ze>1&&console.time("clipping");const kt=.5*Te.buffer/Te.extent,sn=.5-kt,Lt=.5+kt,on=1+kt;let Zt=null,ri=null,Zn=null,$t=null,xn=dn(U,Se,Y-kt,Y+Lt,0,bt.minX,bt.maxX,Te),Un=dn(U,Se,Y+sn,Y+on,0,bt.minX,bt.maxX,Te);U=null,xn&&(Zt=dn(xn,Se,ne-kt,ne+Lt,1,bt.minY,bt.maxY,Te),ri=dn(xn,Se,ne+sn,ne+on,1,bt.minY,bt.maxY,Te),xn=null),Un&&(Zn=dn(Un,Se,ne-kt,ne+Lt,1,bt.minY,bt.maxY,Te),$t=dn(Un,Se,ne+sn,ne+on,1,bt.minY,bt.maxY,Te),Un=null),ze>1&&console.timeEnd("clipping"),ue.push(Zt||[],j+1,2*Y,2*ne),ue.push(ri||[],j+1,2*Y,2*ne+1),ue.push(Zn||[],j+1,2*Y+1,2*ne),ue.push($t||[],j+1,2*Y+1,2*ne+1)}}getTile(U,j,Y){U=+U,j=+j,Y=+Y;const ne=this.options,{extent:de,debug:fe}=ne;if(U<0||U>24)return null;const _e=1<<U,ue=Ut(U,j=j+_e&_e-1,Y);if(this.tiles[ue])return vi(this.tiles[ue],de);fe>1&&console.log("drilling down to z%d-%d-%d",U,j,Y);let Te,ze=U,Se=j,Ue=Y;for(;!Te&&ze>0;)ze--,Se>>=1,Ue>>=1,Te=this.tiles[Ut(ze,Se,Ue)];return Te&&Te.source?(fe>1&&(console.log("found parent tile z%d-%d-%d",ze,Se,Ue),console.time("drilling down")),this.splitTile(Te.source,ze,Se,Ue,U,j,Y),fe>1&&console.timeEnd("drilling down"),this.tiles[ue]?vi(this.tiles[ue],de):null):null}}function Ut(se,U,j){return 32*((1<<se)*j+U)+se}function Je(se,U){return U?se.properties[U]:se.id}function Rn(se,U){if(se==null)return!0;if(se.type==="Feature")return Je(se,U)!=null;if(se.type==="FeatureCollection"){const j=new Set;for(const Y of se.features){const ne=Je(Y,U);if(ne==null||j.has(ne))return!1;j.add(ne)}return!0}return!1}function Kn(se,U){const j=new Map;if(se!=null)if(se.type==="Feature")j.set(Je(se,U),se);else for(const Y of se.features)j.set(Je(Y,U),Y);return j}class Ui extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(U,j){return u._(this,void 0,void 0,function*(){const Y=U.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ne=this._geoJSONIndex.getTile(Y.z,Y.x,Y.y);if(!ne)return null;const de=new class{constructor(_e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=u.X,this.length=_e.length,this._features=_e}feature(_e){return new class{constructor(ue){this._feature=ue,this.extent=u.X,this.type=ue.type,this.properties=ue.tags,"id"in ue&&!isNaN(ue.id)&&(this.id=parseInt(ue.id,10))}loadGeometry(){if(this._feature.type===1){const ue=[];for(const Te of this._feature.geometry)ue.push([new u.P(Te[0],Te[1])]);return ue}{const ue=[];for(const Te of this._feature.geometry){const ze=[];for(const Se of Te)ze.push(new u.P(Se[0],Se[1]));ue.push(ze)}return ue}}toGeoJSON(ue,Te,ze){return H.call(this,ue,Te,ze)}}(this._features[_e])}}(ne.features);let fe=jt(de);return fe.byteOffset===0&&fe.byteLength===fe.buffer.byteLength||(fe=new Uint8Array(fe)),{vectorTile:de,rawData:fe.buffer}})}loadData(U){return u._(this,void 0,void 0,function*(){var j;(j=this._pendingRequest)===null||j===void 0||j.abort();const Y=!!(U&&U.request&&U.request.collectResourceTiming)&&new u.bv(U.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(U,this._pendingRequest),this._geoJSONIndex=U.cluster?new Wn(function({superclusterOptions:fe,clusterProperties:_e}){if(!_e||!fe)return fe;const ue={},Te={},ze={accumulated:null,zoom:0},Se={properties:null},Ue=Object.keys(_e);for(const bt of Ue){const[kt,sn]=_e[bt],Lt=u.bC(sn),on=u.bC(typeof kt=="string"?[kt,["accumulated"],["get",bt]]:kt);ue[bt]=Lt.value,Te[bt]=on.value}return fe.map=bt=>{Se.properties=bt;const kt={};for(const sn of Ue)kt[sn]=ue[sn].evaluate(ze,Se);return kt},fe.reduce=(bt,kt)=>{Se.properties=kt;for(const sn of Ue)ze.accumulated=bt[sn],bt[sn]=Te[sn].evaluate(ze,Se)},fe}(U)).load((yield this._pendingData).features):(ne=yield this._pendingData,new xt(ne,U.geojsonVtOptions)),this.loaded={};const de={};if(Y){const fe=Y.finish();fe&&(de.resourceTiming={},de.resourceTiming[U.source]=JSON.parse(JSON.stringify(fe)))}return de}catch(de){if(delete this._pendingRequest,u.bB(de))return{abandoned:!0};throw de}var ne})}getData(){return u._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(U){const j=this.loaded;return j&&j[U.uid]?super.reloadTile(U):this.loadTile(U)}loadAndProcessGeoJSON(U,j){return u._(this,void 0,void 0,function*(){let Y=yield this.loadGeoJSON(U,j);if(delete this._pendingRequest,typeof Y!="object")throw new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`);if(V(Y,!0),U.filter){const ne=u.bC(U.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ne.result==="error")throw new Error(ne.value.map(fe=>`${fe.key}: ${fe.message}`).join(", "));Y={type:"FeatureCollection",features:Y.features.filter(fe=>ne.value.evaluate({zoom:0},fe))}}return Y})}loadGeoJSON(U,j){return u._(this,void 0,void 0,function*(){const{promoteId:Y}=U;if(U.request){const ne=yield u.h(U.request,j);return this._dataUpdateable=Rn(ne.data,Y)?Kn(ne.data,Y):void 0,ne.data}if(typeof U.data=="string")try{const ne=JSON.parse(U.data);return this._dataUpdateable=Rn(ne,Y)?Kn(ne,Y):void 0,ne}catch{throw new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`)}if(!U.dataDiff)throw new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${U.source}`);return function(ne,de,fe){var _e,ue,Te,ze;if(de.removeAll&&ne.clear(),de.remove)for(const Se of de.remove)ne.delete(Se);if(de.add)for(const Se of de.add){const Ue=Je(Se,fe);Ue!=null&&ne.set(Ue,Se)}if(de.update)for(const Se of de.update){let Ue=ne.get(Se.id);if(Ue==null)continue;const bt=!Se.removeAllProperties&&(((_e=Se.removeProperties)===null||_e===void 0?void 0:_e.length)>0||((ue=Se.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Se.newGeometry||Se.removeAllProperties||bt)&&(Ue=Object.assign({},Ue),ne.set(Se.id,Ue),bt&&(Ue.properties=Object.assign({},Ue.properties))),Se.newGeometry&&(Ue.geometry=Se.newGeometry),Se.removeAllProperties)Ue.properties={};else if(((Te=Se.removeProperties)===null||Te===void 0?void 0:Te.length)>0)for(const kt of Se.removeProperties)Object.prototype.hasOwnProperty.call(Ue.properties,kt)&&delete Ue.properties[kt];if(((ze=Se.addOrUpdateProperties)===null||ze===void 0?void 0:ze.length)>0)for(const{key:kt,value:sn}of Se.addOrUpdateProperties)Ue.properties[kt]=sn}}(this._dataUpdateable,U.dataDiff,Y),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(U){return u._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(U){return this._geoJSONIndex.getClusterExpansionZoom(U.clusterId)}getClusterChildren(U){return this._geoJSONIndex.getChildren(U.clusterId)}getClusterLeaves(U){return this._geoJSONIndex.getLeaves(U.clusterId,U.limit,U.offset)}}class pr{constructor(U){this.self=U,this.actor=new u.F(U),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(j,Y)=>{if(this.externalWorkerSourceTypes[j])throw new Error(`Worker source with name "${j}" already registered.`);this.externalWorkerSourceTypes[j]=Y},this.self.addProtocol=u.bi,this.self.removeProtocol=u.bj,this.self.registerRTLTextPlugin=j=>{if(u.bD.isParsed())throw new Error("RTL text plugin already registered.");u.bD.setMethods(j)},this.actor.registerMessageHandler("LDT",(j,Y)=>this._getDEMWorkerSource(j,Y.source).loadTile(Y)),this.actor.registerMessageHandler("RDT",(j,Y)=>u._(this,void 0,void 0,function*(){this._getDEMWorkerSource(j,Y.source).removeTile(Y)})),this.actor.registerMessageHandler("GCEZ",(j,Y)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(j,Y.type,Y.source).getClusterExpansionZoom(Y)})),this.actor.registerMessageHandler("GCC",(j,Y)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(j,Y.type,Y.source).getClusterChildren(Y)})),this.actor.registerMessageHandler("GCL",(j,Y)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(j,Y.type,Y.source).getClusterLeaves(Y)})),this.actor.registerMessageHandler("LD",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).loadData(Y)),this.actor.registerMessageHandler("GD",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).getData()),this.actor.registerMessageHandler("LT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).loadTile(Y)),this.actor.registerMessageHandler("RT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).reloadTile(Y)),this.actor.registerMessageHandler("AT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).abortTile(Y)),this.actor.registerMessageHandler("RMT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).removeTile(Y)),this.actor.registerMessageHandler("RS",(j,Y)=>u._(this,void 0,void 0,function*(){if(!this.workerSources[j]||!this.workerSources[j][Y.type]||!this.workerSources[j][Y.type][Y.source])return;const ne=this.workerSources[j][Y.type][Y.source];delete this.workerSources[j][Y.type][Y.source],ne.removeSource!==void 0&&ne.removeSource(Y)})),this.actor.registerMessageHandler("RM",j=>u._(this,void 0,void 0,function*(){delete this.layerIndexes[j],delete this.availableImages[j],delete this.workerSources[j],delete this.demWorkerSources[j]})),this.actor.registerMessageHandler("SR",(j,Y)=>u._(this,void 0,void 0,function*(){this.referrer=Y})),this.actor.registerMessageHandler("SRPS",(j,Y)=>this._syncRTLPluginState(j,Y)),this.actor.registerMessageHandler("IS",(j,Y)=>u._(this,void 0,void 0,function*(){this.self.importScripts(Y)})),this.actor.registerMessageHandler("SI",(j,Y)=>this._setImages(j,Y)),this.actor.registerMessageHandler("UL",(j,Y)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(j).update(Y.layers,Y.removedIds)})),this.actor.registerMessageHandler("SL",(j,Y)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(j).replace(Y)}))}_setImages(U,j){return u._(this,void 0,void 0,function*(){this.availableImages[U]=j;for(const Y in this.workerSources[U]){const ne=this.workerSources[U][Y];for(const de in ne)ne[de].availableImages=j}})}_syncRTLPluginState(U,j){return u._(this,void 0,void 0,function*(){if(u.bD.isParsed())return u.bD.getState();if(j.pluginStatus!=="loading")return u.bD.setState(j),j;const Y=j.pluginURL;if(this.self.importScripts(Y),u.bD.isParsed()){const ne={pluginStatus:"loaded",pluginURL:Y};return u.bD.setState(ne),ne}throw u.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${Y}`)})}_getAvailableImages(U){let j=this.availableImages[U];return j||(j=[]),j}_getLayerIndex(U){let j=this.layerIndexes[U];return j||(j=this.layerIndexes[U]=new l),j}_getWorkerSource(U,j,Y){if(this.workerSources[U]||(this.workerSources[U]={}),this.workerSources[U][j]||(this.workerSources[U][j]={}),!this.workerSources[U][j][Y]){const ne={sendAsync:(de,fe)=>(de.targetMapId=U,this.actor.sendAsync(de,fe))};switch(j){case"vector":this.workerSources[U][j][Y]=new E(ne,this._getLayerIndex(U),this._getAvailableImages(U));break;case"geojson":this.workerSources[U][j][Y]=new Ui(ne,this._getLayerIndex(U),this._getAvailableImages(U));break;default:this.workerSources[U][j][Y]=new this.externalWorkerSourceTypes[j](ne,this._getLayerIndex(U),this._getAvailableImages(U))}}return this.workerSources[U][j][Y]}_getDEMWorkerSource(U,j){return this.demWorkerSources[U]||(this.demWorkerSources[U]={}),this.demWorkerSources[U][j]||(this.demWorkerSources[U][j]=new T),this.demWorkerSources[U][j]}}return u.i(self)&&(self.worker=new pr(self)),pr}),r("index",["exports","./shared"],function(u,l){var g="4.7.0";let _,k;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:x=>new Promise((s,d)=>{const f=requestAnimationFrame(s);x.signal.addEventListener("abort",()=>{cancelAnimationFrame(f),d(l.c())})}),getImageData(x,s=0){return this.getImageCanvasContext(x).getImageData(-s,-s,x.width+2*s,x.height+2*s)},getImageCanvasContext(x){const s=window.document.createElement("canvas"),d=s.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return s.width=x.width,s.height=x.height,d.drawImage(x,0,0,x.width,x.height),d},resolveURL:x=>(_||(_=document.createElement("a")),_.href=x,_.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(k==null&&(k=matchMedia("(prefers-reduced-motion: reduce)")),k.matches)}};class T{static testProp(s){if(!T.docStyle)return s[0];for(let d=0;d<s.length;d++)if(s[d]in T.docStyle)return s[d];return s[0]}static create(s,d,f){const m=window.document.createElement(s);return d!==void 0&&(m.className=d),f&&f.appendChild(m),m}static createNS(s,d){return window.document.createElementNS(s,d)}static disableDrag(){T.docStyle&&T.selectProp&&(T.userSelect=T.docStyle[T.selectProp],T.docStyle[T.selectProp]="none")}static enableDrag(){T.docStyle&&T.selectProp&&(T.docStyle[T.selectProp]=T.userSelect)}static setTransform(s,d){s.style[T.transformProp]=d}static addEventListener(s,d,f,m={}){s.addEventListener(d,f,"passive"in m?m:m.capture)}static removeEventListener(s,d,f,m={}){s.removeEventListener(d,f,"passive"in m?m:m.capture)}static suppressClickInternal(s){s.preventDefault(),s.stopPropagation(),window.removeEventListener("click",T.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",T.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",T.suppressClickInternal,!0)},0)}static getScale(s){const d=s.getBoundingClientRect();return{x:d.width/s.offsetWidth||1,y:d.height/s.offsetHeight||1,boundingClientRect:d}}static getPoint(s,d,f){const m=d.boundingClientRect;return new l.P((f.clientX-m.left)/d.x-s.clientLeft,(f.clientY-m.top)/d.y-s.clientTop)}static mousePos(s,d){const f=T.getScale(s);return T.getPoint(s,f,d)}static touchPos(s,d){const f=[],m=T.getScale(s);for(let b=0;b<d.length;b++)f.push(T.getPoint(s,m,d[b]));return f}static mouseButton(s){return s.button}static remove(s){s.parentNode&&s.parentNode.removeChild(s)}}T.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,T.selectProp=T.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),T.transformProp=T.testProp(["transform","WebkitTransform"]);const I={supported:!1,testSupport:function(x){!H&&V&&(Z?ee(x):z=x)}};let z,V,H=!1,Z=!1;function ee(x){const s=x.createTexture();x.bindTexture(x.TEXTURE_2D,s);try{if(x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,V),x.isContextLost())return;I.supported=!0}catch{}x.deleteTexture(s),H=!0}var oe;typeof document<"u"&&(V=document.createElement("img"),V.onload=()=>{z&&ee(z),z=null,Z=!0},V.onerror=()=>{H=!0,z=null},V.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(x){let s,d,f,m;x.resetRequestQueue=()=>{s=[],d=0,f=0,m={}},x.addThrottleControl=D=>{const L=f++;return m[L]=D,L},x.removeThrottleControl=D=>{delete m[D],M()},x.getImage=(D,L,B=!0)=>new Promise((F,W)=>{I.supported&&(D.headers||(D.headers={}),D.headers.accept="image/webp,*/*"),l.e(D,{type:"image"}),s.push({abortController:L,requestParameters:D,supportImageRefresh:B,state:"queued",onError:K=>{W(K)},onSuccess:K=>{F(K)}}),M()});const b=D=>l._(this,void 0,void 0,function*(){D.state="running";const{requestParameters:L,supportImageRefresh:B,onError:F,onSuccess:W,abortController:K}=D,Q=B===!1&&!l.i(self)&&!l.g(L.url)&&(!L.headers||Object.keys(L.headers).reduce((ce,he)=>ce&&he==="accept",!0));d++;const re=Q?P(L,K):l.m(L,K);try{const ce=yield re;delete D.abortController,D.state="completed",ce.data instanceof HTMLImageElement||l.b(ce.data)?W(ce):ce.data&&W({data:yield(le=ce.data,typeof createImageBitmap=="function"?l.d(le):l.f(le)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete D.abortController,F(ce)}finally{d--,M()}var le}),M=()=>{const D=(()=>{for(const L of Object.keys(m))if(m[L]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let L=d;L<D&&s.length>0;L++){const B=s.shift();B.abortController.signal.aborted?L--:b(B)}},P=(D,L)=>new Promise((B,F)=>{const W=new Image,K=D.url,Q=D.credentials;Q&&Q==="include"?W.crossOrigin="use-credentials":(Q&&Q==="same-origin"||!l.s(K))&&(W.crossOrigin="anonymous"),L.signal.addEventListener("abort",()=>{W.src="",F(l.c())}),W.fetchPriority="high",W.onload=()=>{W.onerror=W.onload=null,B({data:W})},W.onerror=()=>{W.onerror=W.onload=null,L.signal.aborted||F(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."))},W.src=K})}(oe||(oe={})),oe.resetRequestQueue();class J{constructor(s){this._transformRequestFn=s}transformRequest(s,d){return this._transformRequestFn&&this._transformRequestFn(s,d)||{url:s}}setTransformRequest(s){this._transformRequestFn=s}}function Ae(x){var s=new l.A(3);return s[0]=x[0],s[1]=x[1],s[2]=x[2],s}var ke,Me=function(x,s,d){return x[0]=s[0]-d[0],x[1]=s[1]-d[1],x[2]=s[2]-d[2],x};ke=new l.A(3),l.A!=Float32Array&&(ke[0]=0,ke[1]=0,ke[2]=0);var Le=function(x){var s=x[0],d=x[1];return s*s+d*d};function Ie(x){const s=[];if(typeof x=="string")s.push({id:"default",url:x});else if(x&&x.length>0){const d=[];for(const{id:f,url:m}of x){const b=`${f}${m}`;d.indexOf(b)===-1&&(d.push(b),s.push({id:f,url:m}))}}return s}function Ye(x,s,d){const f=x.split("?");return f[0]+=`${s}${d}`,f.join("?")}(function(){var x=new l.A(2);l.A!=Float32Array&&(x[0]=0,x[1]=0)})();class it{constructor(s,d,f,m){this.context=s,this.format=f,this.texture=s.gl.createTexture(),this.update(d,m)}update(s,d,f){const{width:m,height:b}=s,M=!(this.size&&this.size[0]===m&&this.size[1]===b||f),{context:P}=this,{gl:D}=P;if(this.useMipmap=!!(d&&d.useMipmap),D.bindTexture(D.TEXTURE_2D,this.texture),P.pixelStoreUnpackFlipY.set(!1),P.pixelStoreUnpack.set(1),P.pixelStoreUnpackPremultiplyAlpha.set(this.format===D.RGBA&&(!d||d.premultiply!==!1)),M)this.size=[m,b],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?D.texImage2D(D.TEXTURE_2D,0,this.format,this.format,D.UNSIGNED_BYTE,s):D.texImage2D(D.TEXTURE_2D,0,this.format,m,b,0,this.format,D.UNSIGNED_BYTE,s.data);else{const{x:L,y:B}=f||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?D.texSubImage2D(D.TEXTURE_2D,0,L,B,D.RGBA,D.UNSIGNED_BYTE,s):D.texSubImage2D(D.TEXTURE_2D,0,L,B,m,b,D.RGBA,D.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&D.generateMipmap(D.TEXTURE_2D)}bind(s,d,f){const{context:m}=this,{gl:b}=m;b.bindTexture(b.TEXTURE_2D,this.texture),f!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(f=b.LINEAR),s!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,s),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,f||s),this.filter=s),d!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,d),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function Nt(x){const{userImage:s}=x;return!!(s&&s.render&&s.render())&&(x.data.replace(new Uint8Array(s.data.buffer)),!0)}class ht extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:d,promiseResolve:f}of this.requestors)f(this._getImagesForIds(d));this.requestors=[]}}getImage(s){const d=this.images[s];if(d&&!d.data&&d.spriteData){const f=d.spriteData;d.data=new l.R({width:f.width,height:f.height},f.context.getImageData(f.x,f.y,f.width,f.height).data),d.spriteData=null}return d}addImage(s,d){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,d)&&(this.images[s]=d)}_validate(s,d){let f=!0;const m=d.data||d.spriteData;return this._validateStretch(d.stretchX,m&&m.width)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchX" value`))),f=!1),this._validateStretch(d.stretchY,m&&m.height)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchY" value`))),f=!1),this._validateContent(d.content,d)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "content" value`))),f=!1),f}_validateStretch(s,d){if(!s)return!0;let f=0;for(const m of s){if(m[0]<f||m[1]<m[0]||d<m[1])return!1;f=m[1]}return!0}_validateContent(s,d){if(!s)return!0;if(s.length!==4)return!1;const f=d.spriteData,m=f&&f.width||d.data.width,b=f&&f.height||d.data.height;return!(s[0]<0||m<s[0]||s[1]<0||b<s[1]||s[2]<0||m<s[2]||s[3]<0||b<s[3]||s[2]<s[0]||s[3]<s[1])}updateImage(s,d,f=!0){const m=this.getImage(s);if(f&&(m.data.width!==d.data.width||m.data.height!==d.data.height))throw new Error(`size mismatch between old image (${m.data.width}x${m.data.height}) and new image (${d.data.width}x${d.data.height}).`);d.version=m.version+1,this.images[s]=d,this.updatedImages[s]=!0}removeImage(s){const d=this.images[s];delete this.images[s],delete this.patterns[s],d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(s){return new Promise((d,f)=>{let m=!0;if(!this.isLoaded())for(const b of s)this.images[b]||(m=!1);this.isLoaded()||m?d(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:d})})}_getImagesForIds(s){const d={};for(const f of s){let m=this.getImage(f);m||(this.fire(new l.k("styleimagemissing",{id:f})),m=this.getImage(f)),m?d[f]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:l.w(`Image "${f}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return d}getPixelSize(){const{width:s,height:d}=this.atlasImage;return{width:s,height:d}}getPattern(s){const d=this.patterns[s],f=this.getImage(s);if(!f)return null;if(d&&d.position.version===f.version)return d.position;if(d)d.position.version=f.version;else{const m={w:f.data.width+2,h:f.data.height+2,x:0,y:0},b=new l.I(m,f);this.patterns[s]={bin:m,position:b}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const d=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(s,this.atlasImage,d.RGBA),this.atlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const b in this.patterns)s.push(this.patterns[b].bin);const{w:d,h:f}=l.p(s),m=this.atlasImage;m.resize({width:d||1,height:f||1});for(const b in this.patterns){const{bin:M}=this.patterns[b],P=M.x+1,D=M.y+1,L=this.getImage(b).data,B=L.width,F=L.height;l.R.copy(L,m,{x:0,y:0},{x:P,y:D},{width:B,height:F}),l.R.copy(L,m,{x:0,y:F-1},{x:P,y:D-1},{width:B,height:1}),l.R.copy(L,m,{x:0,y:0},{x:P,y:D+F},{width:B,height:1}),l.R.copy(L,m,{x:B-1,y:0},{x:P-1,y:D},{width:1,height:F}),l.R.copy(L,m,{x:0,y:0},{x:P+B,y:D},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const d of s){if(this.callbackDispatchedThisFrame[d])continue;this.callbackDispatchedThisFrame[d]=!0;const f=this.getImage(d);f||l.w(`Image with ID: "${d}" was not found`),Nt(f)&&this.updateImage(d,f)}}}const Rt=1e20;function Xt(x,s,d,f,m,b,M,P,D){for(let L=s;L<s+f;L++)nn(x,d*b+L,b,m,M,P,D);for(let L=d;L<d+m;L++)nn(x,L*b+s,1,f,M,P,D)}function nn(x,s,d,f,m,b,M){b[0]=0,M[0]=-Rt,M[1]=Rt,m[0]=x[s];for(let P=1,D=0,L=0;P<f;P++){m[P]=x[s+P*d];const B=P*P;do{const F=b[D];L=(m[P]-m[F]+B-F*F)/(P-F)/2}while(L<=M[D]&&--D>-1);D++,b[D]=P,M[D]=L,M[D+1]=Rt}for(let P=0,D=0;P<f;P++){for(;M[D+1]<P;)D++;const L=b[D],B=P-L;x[s+P*d]=m[L]+B*B}}class jt{constructor(s,d){this.requestManager=s,this.localIdeographFontFamily=d,this.entries={}}setURL(s){this.url=s}getGlyphs(s){return l._(this,void 0,void 0,function*(){const d=[];for(const b in s)for(const M of s[b])d.push(this._getAndCacheGlyphsPromise(b,M));const f=yield Promise.all(d),m={};for(const{stack:b,id:M,glyph:P}of f)m[b]||(m[b]={}),m[b][M]=P&&{id:P.id,bitmap:P.bitmap.clone(),metrics:P.metrics};return m})}_getAndCacheGlyphsPromise(s,d){return l._(this,void 0,void 0,function*(){let f=this.entries[s];f||(f=this.entries[s]={glyphs:{},requests:{},ranges:{}});let m=f.glyphs[d];if(m!==void 0)return{stack:s,id:d,glyph:m};if(m=this._tinySDF(f,s,d),m)return f.glyphs[d]=m,{stack:s,id:d,glyph:m};const b=Math.floor(d/256);if(256*b>65535)throw new Error("glyphs > 65535 not supported");if(f.ranges[b])return{stack:s,id:d,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!f.requests[b]){const P=jt.loadGlyphRange(s,b,this.url,this.requestManager);f.requests[b]=P}const M=yield f.requests[b];for(const P in M)this._doesCharSupportLocalGlyph(+P)||(f.glyphs[+P]=M[+P]);return f.ranges[b]=!0,{stack:s,id:d,glyph:M[d]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(s))}_tinySDF(s,d,f){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(f))return;let b=s.tinySDF;if(!b){let P="400";/bold/i.test(d)?P="900":/medium/i.test(d)?P="500":/light/i.test(d)&&(P="200"),b=s.tinySDF=new jt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:P})}const M=b.draw(String.fromCharCode(f));return{id:f,bitmap:new l.o({width:M.width||60,height:M.height||60},M.data),metrics:{width:M.glyphWidth/2||24,height:M.glyphHeight/2||24,left:M.glyphLeft/2+.5||0,top:M.glyphTop/2-27.5||-8,advance:M.glyphAdvance/2||24,isDoubleResolution:!0}}}}jt.loadGlyphRange=function(x,s,d,f){return l._(this,void 0,void 0,function*(){const m=256*s,b=m+255,M=f.transformRequest(d.replace("{fontstack}",x).replace("{range}",`${m}-${b}`),"Glyphs"),P=yield l.l(M,new AbortController);if(!P||!P.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${b}`);const D={};for(const L of l.n(P.data))D[L.id]=L;return D})},jt.TinySDF=class{constructor({fontSize:x=24,buffer:s=3,radius:d=8,cutoff:f=.25,fontFamily:m="sans-serif",fontWeight:b="normal",fontStyle:M="normal"}={}){this.buffer=s,this.cutoff=f,this.radius=d;const P=this.size=x+4*s,D=this._createCanvas(P),L=this.ctx=D.getContext("2d",{willReadFrequently:!0});L.font=`${M} ${b} ${x}px ${m}`,L.textBaseline="alphabetic",L.textAlign="left",L.fillStyle="black",this.gridOuter=new Float64Array(P*P),this.gridInner=new Float64Array(P*P),this.f=new Float64Array(P),this.z=new Float64Array(P+1),this.v=new Uint16Array(P)}_createCanvas(x){const s=document.createElement("canvas");return s.width=s.height=x,s}draw(x){const{width:s,actualBoundingBoxAscent:d,actualBoundingBoxDescent:f,actualBoundingBoxLeft:m,actualBoundingBoxRight:b}=this.ctx.measureText(x),M=Math.ceil(d),P=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-m))),D=Math.min(this.size-this.buffer,M+Math.ceil(f)),L=P+2*this.buffer,B=D+2*this.buffer,F=Math.max(L*B,0),W=new Uint8ClampedArray(F),K={data:W,width:L,height:B,glyphWidth:P,glyphHeight:D,glyphTop:M,glyphLeft:0,glyphAdvance:s};if(P===0||D===0)return K;const{ctx:Q,buffer:re,gridInner:le,gridOuter:ce}=this;Q.clearRect(re,re,P,D),Q.fillText(x,re,re+M);const he=Q.getImageData(re,re,P,D);ce.fill(Rt,0,F),le.fill(0,0,F);for(let te=0;te<D;te++)for(let me=0;me<P;me++){const ge=he.data[4*(te*P+me)+3]/255;if(ge===0)continue;const xe=(te+re)*L+me+re;if(ge===1)ce[xe]=0,le[xe]=Rt;else{const Oe=.5-ge;ce[xe]=Oe>0?Oe*Oe:0,le[xe]=Oe<0?Oe*Oe:0}}Xt(ce,0,0,L,B,L,this.f,this.v,this.z),Xt(le,re,re,P,D,L,this.f,this.v,this.z);for(let te=0;te<F;te++){const me=Math.sqrt(ce[te])-Math.sqrt(le[te]);W[te]=Math.round(255-255*(me/this.radius+this.cutoff))}return K}};class Mt{constructor(){this.specification=l.v.light.position}possiblyEvaluate(s,d){return l.x(s.expression.evaluate(d))}interpolate(s,d,f){return{x:l.y.number(s.x,d.x,f),y:l.y.number(s.y,d.y,f),z:l.y.number(s.z,d.z,f)}}}let Sn;class hn extends l.E{constructor(s){super(),Sn=Sn||new l.q({anchor:new l.D(l.v.light.anchor),position:new Mt,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(Sn),this.setLight(s),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(s,d={}){if(!this._validate(l.r,s,d))for(const f in s){const m=s[f];f.endsWith("-transition")?this._transitionable.setTransition(f.slice(0,-11),m):this._transitionable.setValue(f,m)}}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,d,f){return(!f||f.validate!==!1)&&l.t(this,s.call(l.u,{value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v}))}}const In=new l.q({"sky-color":new l.D(l.v.sky["sky-color"]),"horizon-color":new l.D(l.v.sky["horizon-color"]),"fog-color":new l.D(l.v.sky["fog-color"]),"fog-ground-blend":new l.D(l.v.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.v.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.v.sky["atmosphere-blend"])});class bn extends l.E{constructor(s){super(),this._transitionable=new l.T(In),this.setSky(s),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.z(0))}setSky(s,d={}){if(!this._validate(l.B,s,d)){s||(s={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const f in s){const m=s[f];f.endsWith("-transition")?this._transitionable.setTransition(f.slice(0,-11),m):this._transitionable.setValue(f,m)}}}getSky(){return this._transitionable.serialize()}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,d,f={}){return(f==null?void 0:f.validate)!==!1&&l.t(this,s.call(l.u,l.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}calculateFogBlendOpacity(s){return s<60?0:s<70?(s-60)/10:1}}class pi{constructor(s,d){this.width=s,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(s,d){const f=s.join(",")+String(d);return this.dashEntry[f]||(this.dashEntry[f]=this.addDash(s,d)),this.dashEntry[f]}getDashRanges(s,d,f){const m=[];let b=s.length%2==1?-s[s.length-1]*f:0,M=s[0]*f,P=!0;m.push({left:b,right:M,isDash:P,zeroLength:s[0]===0});let D=s[0];for(let L=1;L<s.length;L++){P=!P;const B=s[L];b=D*f,D+=B,M=D*f,m.push({left:b,right:M,isDash:P,zeroLength:B===0})}return m}addRoundDash(s,d,f){const m=d/2;for(let b=-f;b<=f;b++){const M=this.width*(this.nextRow+f+b);let P=0,D=s[P];for(let L=0;L<this.width;L++){L/D.right>1&&(D=s[++P]);const B=Math.abs(L-D.left),F=Math.abs(L-D.right),W=Math.min(B,F);let K;const Q=b/f*(m+1);if(D.isDash){const re=m-Math.abs(Q);K=Math.sqrt(W*W+re*re)}else K=m-Math.sqrt(W*W+Q*Q);this.data[M+L]=Math.max(0,Math.min(255,K+128))}}}addRegularDash(s){for(let P=s.length-1;P>=0;--P){const D=s[P],L=s[P+1];D.zeroLength?s.splice(P,1):L&&L.isDash===D.isDash&&(L.left=D.left,s.splice(P,1))}const d=s[0],f=s[s.length-1];d.isDash===f.isDash&&(d.left=f.left-this.width,f.right=d.right+this.width);const m=this.width*this.nextRow;let b=0,M=s[b];for(let P=0;P<this.width;P++){P/M.right>1&&(M=s[++b]);const D=Math.abs(P-M.left),L=Math.abs(P-M.right),B=Math.min(D,L);this.data[m+P]=Math.max(0,Math.min(255,(M.isDash?B:-B)+128))}}addDash(s,d){const f=d?7:0,m=2*f+1;if(this.nextRow+m>this.height)return l.w("LineAtlas out of space"),null;let b=0;for(let P=0;P<s.length;P++)b+=s[P];if(b!==0){const P=this.width/b,D=this.getDashRanges(s,this.width,P);d?this.addRoundDash(D,P,f):this.addRegularDash(D)}const M={y:(this.nextRow+f+.5)/this.height,height:2*f/this.height,width:b};return this.nextRow+=m,this.dirty=!0,M}bind(s){const d=s.gl;this.texture?(d.bindTexture(d.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,d.texSubImage2D(d.TEXTURE_2D,0,0,0,this.width,this.height,d.ALPHA,d.UNSIGNED_BYTE,this.data))):(this.texture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this.texture),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texImage2D(d.TEXTURE_2D,0,d.ALPHA,this.width,this.height,0,d.ALPHA,d.UNSIGNED_BYTE,this.data))}}const Wn="maplibre_preloaded_worker_pool";class jn{constructor(){this.active={}}acquire(s){if(!this.workers)for(this.workers=[];this.workers.length<jn.workerCount;)this.workers.push(new Worker(l.a.WORKER_URL));return this.active[s]=!0,this.workers.slice()}release(s){delete this.active[s],this.numActive()===0&&(this.workers.forEach(d=>{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Wn]}numActive(){return Object.keys(this.active).length}}const Gn=Math.floor(E.hardwareConcurrency/2);let Ce,je;function Xe(){return Ce||(Ce=new jn),Ce}jn.workerCount=l.C(globalThis)?Math.max(Math.min(Gn,3),1):1;class lt{constructor(s,d){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=d;const f=this.workerPool.acquire(d);for(let m=0;m<f.length;m++){const b=new l.F(f[m],d);b.name=`Worker ${m}`,this.actors.push(b)}if(!this.actors.length)throw new Error("No actors found")}broadcast(s,d){const f=[];for(const m of this.actors)f.push(m.sendAsync({type:s,data:d}));return Promise.all(f)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(s=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,d){for(const f of this.actors)f.registerMessageHandler(s,d)}}function Bt(){return je||(je=new lt(Xe(),l.G),je.registerMessageHandler("GR",(x,s,d)=>l.m(s,d))),je}function rn(x,s){const d=l.H();return l.J(d,d,[1,1,0]),l.K(d,d,[.5*x.width,.5*x.height,1]),l.L(d,d,x.calculatePosMatrix(s.toUnwrapped()))}function Dt(x,s,d,f,m,b){const M=function(F,W,K){if(F)for(const Q of F){const re=W[Q];if(re&&re.source===K&&re.type==="fill-extrusion")return!0}else for(const Q in W){const re=W[Q];if(re.source===K&&re.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,x.id),P=b.maxPitchScaleFactor(),D=x.tilesIn(f,P,M);D.sort(At);const L=[];for(const F of D)L.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,d,x._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,b,P,rn(x.transform,F.tileID))});const B=function(F){const W={},K={};for(const Q of F){const re=Q.queryResults,le=Q.wrappedTileID,ce=K[le]=K[le]||{};for(const he in re){const te=re[he],me=ce[he]=ce[he]||{},ge=W[he]=W[he]||[];for(const xe of te)me[xe.featureIndex]||(me[xe.featureIndex]=!0,ge.push(xe))}}return W}(L);for(const F in B)B[F].forEach(W=>{const K=W.feature,Q=x.getFeatureState(K.layer["source-layer"],K.id);K.source=K.layer.source,K.layer["source-layer"]&&(K.sourceLayer=K.layer["source-layer"]),K.state=Q});return B}function At(x,s){const d=x.tileID,f=s.tileID;return d.overscaledZ-f.overscaledZ||d.canonical.y-f.canonical.y||d.wrap-f.wrap||d.canonical.x-f.canonical.x}function ln(x,s,d){return l._(this,void 0,void 0,function*(){let f=x;if(x.url?f=(yield l.h(s.transformRequest(x.url,"Source"),d)).data:yield E.frameAsync(d),!f)return null;const m=l.M(l.e(f,x),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in f&&f.vector_layers&&(m.vectorLayerIds=f.vector_layers.map(b=>b.id)),m})}class we{constructor(s,d){s&&(d?this.setSouthWest(s).setNorthEast(d):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof l.N?new l.N(s.lng,s.lat):l.N.convert(s),this}setSouthWest(s){return this._sw=s instanceof l.N?new l.N(s.lng,s.lat):l.N.convert(s),this}extend(s){const d=this._sw,f=this._ne;let m,b;if(s instanceof l.N)m=s,b=s;else{if(!(s instanceof we))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(we.convert(s)):this.extend(l.N.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(l.N.convert(s)):this;if(m=s._sw,b=s._ne,!m||!b)return this}return d||f?(d.lng=Math.min(m.lng,d.lng),d.lat=Math.min(m.lat,d.lat),f.lng=Math.max(b.lng,f.lng),f.lat=Math.max(b.lat,f.lat)):(this._sw=new l.N(m.lng,m.lat),this._ne=new l.N(b.lng,b.lat)),this}getCenter(){return new l.N((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 l.N(this.getWest(),this.getNorth())}getSouthEast(){return new l.N(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(s){const{lng:d,lat:f}=l.N.convert(s);let m=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=f&&f<=this._ne.lat&&m}static convert(s){return s instanceof we?s:s&&new we(s)}static fromLngLat(s,d=0){const f=360*d/40075017,m=f/Math.cos(Math.PI/180*s.lat);return new we(new l.N(s.lng-m,s.lat-f),new l.N(s.lng+m,s.lat+f))}adjustAntiMeridian(){const s=new l.N(this._sw.lng,this._sw.lat),d=new l.N(this._ne.lng,this._ne.lat);return new we(s,s.lng>d.lng?new l.N(d.lng+360,d.lat):d)}}class En{constructor(s,d,f){this.bounds=we.convert(this.validateBounds(s)),this.minzoom=d||0,this.maxzoom=f||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const d=Math.pow(2,s.z),f=Math.floor(l.O(this.bounds.getWest())*d),m=Math.floor(l.Q(this.bounds.getNorth())*d),b=Math.ceil(l.O(this.bounds.getEast())*d),M=Math.ceil(l.Q(this.bounds.getSouth())*d);return s.x>=f&&s.x<b&&s.y>=m&&s.y<M}}class Ss extends l.E{constructor(s,d,f,m){if(super(),this.id=s,this.dispatcher=f,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.M(d,["url","scheme","tileSize","promoteId"])),this._options=l.e({type:"vector"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(m)}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ln(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),s&&(l.e(this,s),s.bounds&&(this.tileBounds=new En(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.j(s))}})}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.abort(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f={request:this.map._requestManager.transformRequest(d,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};f.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((b,M)=>{s.reloadPromise={resolve:b,reject:M}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const b=yield s.actor.sendAsync({type:m,data:f},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,b)}catch(b){if(delete s.abortController,s.aborted)return;if(b&&b.status!==404)throw b;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,d){if(d&&d.resourceTiming&&(s.resourceTiming=d.resourceTiming),d&&this.map._refreshExpiredTiles&&s.setExpiryData(d),s.loadVectorData(d,this.map.painter),s.reloadPromise){const f=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(f.resolve).catch(f.reject)}}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Kt extends l.E{constructor(s,d,f,m){super(),this.id=s,this.dispatcher=f,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},d),l.e(this,l.M(d,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ln(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(l.e(this,s),s.bounds&&(this.tileBounds=new En(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return l.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const f=yield oe.getImage(this.map._requestManager.transformRequest(d,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(f&&f.data){this.map._refreshExpiredTiles&&f.cacheControl&&f.expires&&s.setExpiryData({cacheControl:f.cacheControl,expires:f.expires});const m=this.map.painter.context,b=m.gl,M=f.data;s.texture=this.map.painter.getTileTexture(M.width),s.texture?s.texture.update(M,{useMipmap:!0}):(s.texture=new it(m,M,b.RGBA,{useMipmap:!0}),s.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST)),s.state="loaded"}}catch(f){if(delete s.abortController,s.aborted)s.state="unloaded";else if(f)throw s.state="errored",f}})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class dn extends Kt{constructor(s,d,f,m){super(s,d,f,m),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},d),this.encoding=d.encoding||"mapbox",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f=this.map._requestManager.transformRequest(d,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield oe.getImage(f,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const b=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const M=l.b(b)&&l.U()?b:yield this.readImageNow(b),P={type:this.type,uid:s.uid,source:this.id,rawImageData:M,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const D=yield s.actor.sendAsync({type:"LDT",data:P});s.dem=D,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.V()){const d=s.width+2,f=s.height+2;try{return new l.R({width:d,height:f},yield l.W(s,-1,-1,d,f))}catch{}}return E.getImageData(s,1)})}_getNeighboringTiles(s){const d=s.canonical,f=Math.pow(2,d.z),m=(d.x-1+f)%f,b=d.x===0?s.wrap-1:s.wrap,M=(d.x+1+f)%f,P=d.x+1===f?s.wrap+1:s.wrap,D={};return D[new l.S(s.overscaledZ,b,d.z,m,d.y).key]={backfilled:!1},D[new l.S(s.overscaledZ,P,d.z,M,d.y).key]={backfilled:!1},d.y>0&&(D[new l.S(s.overscaledZ,b,d.z,m,d.y-1).key]={backfilled:!1},D[new l.S(s.overscaledZ,s.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},D[new l.S(s.overscaledZ,P,d.z,M,d.y-1).key]={backfilled:!1}),d.y+1<f&&(D[new l.S(s.overscaledZ,b,d.z,m,d.y+1).key]={backfilled:!1},D[new l.S(s.overscaledZ,s.wrap,d.z,d.x,d.y+1).key]={backfilled:!1},D[new l.S(s.overscaledZ,P,d.z,M,d.y+1).key]={backfilled:!1}),D}unloadTile(s){return l._(this,void 0,void 0,function*(){s.demTexture&&this.map.painter.saveTileTexture(s.demTexture),s.fbo&&(s.fbo.destroy(),delete s.fbo),s.dem&&delete s.dem,delete s.neighboringTiles,s.state="unloaded",s.actor&&(yield s.actor.sendAsync({type:"RDT",data:{type:this.type,uid:s.uid,source:this.id}}))})}}class er extends l.E{constructor(s,d,f,m){super(),this.id=s,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=f.getActor(),this.setEventedParent(m),this._data=d.data,this._options=l.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;const b=l.X/this.tileSize;d.clusterMaxZoom!==void 0&&this.maxzoom<=d.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${d.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*b,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*b,extent:l.X,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:l.X,radius:(d.clusterRadius||50)*b,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return l._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(s){this.map=s,this.load()}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){return this._updateWorkerData(s),this}getData(){return l._(this,void 0,void 0,function*(){const s=l.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:s})})}setClusterOptions(s){return this.workerOptions.cluster=s.cluster,s&&(s.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=s.clusterRadius),s.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=s.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(s){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:s,source:this.id}})}getClusterChildren(s){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:s,source:this.id}})}getClusterLeaves(s,d,f){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:s,limit:d,offset:f}})}_updateWorkerData(s){return l._(this,void 0,void 0,function*(){const d=l.e({type:this.type},this.workerOptions);s?d.dataDiff=s:typeof this._data=="string"?(d.request=this.map._requestManager.transformRequest(E.resolveURL(this._data),"Source"),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"}));try{const f=yield this.actor.sendAsync({type:"LD",data:d});if(this._pendingLoads--,this._removed||f.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let m=null;f.resourceTiming&&f.resourceTiming[this.id]&&(m=f.resourceTiming[this.id].slice(0));const b={dataType:"source"};this._collectResourceTiming&&m&&m.length>0&&l.e(b,{resourceTiming:m}),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"content"})))}catch(f){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(f))}})}loaded(){return this._pendingLoads===0}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.actor?"RT":"LT";s.actor=this.actor;const f={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const m=yield this.actor.sendAsync({type:d,data:f},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,d==="RT")})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var tr=l.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class bi extends l.E{constructor(s,d,f,m){super(),this.id=s,this.dispatcher=f,this.coordinates=d.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=d}load(s){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const d=yield oe.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,d&&d.data&&(this.image=d.data,s&&(this.coordinates=s),this._finishLoading())}catch(d){this._request=null,this._loaded=!0,this.fire(new l.j(d))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const d=s.map(l.Z.fromLngLat);this.tileID=function(m){let b=1/0,M=1/0,P=-1/0,D=-1/0;for(const W of m)b=Math.min(b,W.x),M=Math.min(M,W.y),P=Math.max(P,W.x),D=Math.max(D,W.y);const L=Math.max(P-b,D-M),B=Math.max(0,Math.floor(-Math.log(L)/Math.LN2)),F=Math.pow(2,B);return new l.a1(B,Math.floor((b+P)/2*F),Math.floor((M+D)/2*F))}(d),this.minzoom=this.maxzoom=this.tileID.z;const f=d.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new l.$,this._boundsArray.emplaceBack(f[0].x,f[0].y,0,0),this._boundsArray.emplaceBack(f[1].x,f[1].y,l.X,0),this._boundsArray.emplaceBack(f[3].x,f[3].y,0,l.X),this._boundsArray.emplaceBack(f[2].x,f[2].y,l.X,l.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,d=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,tr.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new it(s,this.image,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let f=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,f=!0)}f&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Dr extends bi{constructor(s,d,f,m){super(s,d,f,m),this.roundZoom=!0,this.type="video",this.options=d}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const d of s.urls)this.urls.push(this.map._requestManager.transformRequest(d,"Source").url);try{const d=yield l.a3(this.urls);if(this._loaded=!0,!d)return;this.video=d,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(d){this.fire(new l.j(d))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const d=this.video.seekable;s<d.start(0)||s>d.end(0)?this.fire(new l.j(new l.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,d=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,tr.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new it(s,this.video,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let f=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,f=!0)}f&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class xi extends bi{constructor(s,d,f,m){super(s,d,f,m),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(M=>typeof M!="number"))||this.fire(new l.j(new l.a2(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a2(`sources.${s}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new l.j(new l.a2(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a2(`sources.${s}`,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 l.j(new l.a2(`sources.${s}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){return l._(this,void 0,void 0,function*(){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 l.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())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context,f=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,tr.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new it(d,this.canvas,f.RGBA,{premultiply:!0});let m=!1;for(const b in this.tiles){const M=this.tiles[b];M.state!=="loaded"&&(M.state="loaded",M.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Es={},Cs=x=>{switch(x){case"geojson":return er;case"image":return bi;case"raster":return Kt;case"raster-dem":return dn;case"vector":return Ss;case"video":return Dr;case"canvas":return xi}return Es[x]},Be="RTLPluginLoaded";class Or extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Bt()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(d=>{throw this.status="error",d})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return l._(this,arguments,void 0,function*(d,f=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(d),!this.url)throw new Error(`requested url ${d} is invalid`);if(this.status==="unavailable"){if(!f)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Be))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let vi=null;function zr(){return vi||(vi=new Or),vi}class Ts{constructor(s,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=l.a4(),this.uses=0,this.tileSize=d,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(s){const d=s+this.timeAdded;d<this.fadeEndTime||(this.fadeEndTime=d)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(s){this.demTexture&&s.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(s,d,f){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",s){s.featureIndex&&(this.latestFeatureIndex=s.featureIndex,s.rawTileData?(this.latestRawTileData=s.rawTileData,this.latestFeatureIndex.rawTileData=s.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=s.collisionBoxArray,this.buckets=function(m,b){const M={};if(!b)return M;for(const P of m){const D=P.layerIds.map(L=>b.getLayer(L)).filter(Boolean);if(D.length!==0){P.layers=D,P.stateDependentLayerIds&&(P.stateDependentLayers=P.stateDependentLayerIds.map(L=>D.filter(B=>B.id===L)[0]));for(const L of D)M[L.id]=P}}return M}(s.buckets,d.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const b=this.buckets[m];if(b instanceof l.a6){if(this.hasSymbolBuckets=!0,!f)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const b=this.buckets[m];if(b instanceof l.a6&&b.hasRTLText){this.hasRTLText=!0,zr().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const b=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(m).queryRadius(b))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new l.a5}unloadVectorData(){for(const s in this.buckets)this.buckets[s].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(s){return this.buckets[s.id]}upload(s){for(const f in this.buckets){const m=this.buckets[f];m.uploadPending()&&m.upload(s)}const d=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(s,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(s,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,d,f,m,b,M,P,D,L,B){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:b,scale:M,tileSize:this.tileSize,pixelPosMatrix:B,transform:D,params:P,queryPadding:this.queryPadding*L},s,d,f):{}}querySourceFeatures(s,d){const f=this.latestFeatureIndex;if(!f||!f.rawTileData)return;const m=f.loadVTLayers(),b=d&&d.sourceLayer?d.sourceLayer:"",M=m._geojsonTileLayer||m[b];if(!M)return;const P=l.a7(d&&d.filter),{z:D,x:L,y:B}=this.tileID.canonical,F={z:D,x:L,y:B};for(let W=0;W<M.length;W++){const K=M.feature(W);if(P.needGeometry){const le=l.a8(K,!0);if(!P.filter(new l.z(this.tileID.overscaledZ),le,this.tileID.canonical))continue}else if(!P.filter(new l.z(this.tileID.overscaledZ),K))continue;const Q=f.getId(K,b),re=new l.a9(K,D,L,B,Q);re.tile=F,s.push(re)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(s){const d=this.expirationTime;if(s.cacheControl){const f=l.aa(s.cacheControl);f["max-age"]&&(this.expirationTime=Date.now()+1e3*f["max-age"])}else s.expires&&(this.expirationTime=new Date(s.expires).getTime());if(this.expirationTime){const f=Date.now();let m=!1;if(this.expirationTime>f)m=!1;else if(d)if(this.expirationTime<d)m=!0;else{const b=this.expirationTime-d;b?this.expirationTime=f+Math.max(b,3e4):m=!0}else m=!0;m?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(s,d){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(s).length===0)return;const f=this.latestFeatureIndex.loadVTLayers();for(const m in this.buckets){if(!d.style.hasLayer(m))continue;const b=this.buckets[m],M=b.layers[0].sourceLayer||"_geojsonTileLayer",P=f[M],D=s[M];if(!P||!D||Object.keys(D).length===0)continue;b.update(D,P,this.imageAtlas&&this.imageAtlas.patternPositions||{});const L=d&&d.style&&d.style.getLayer(m);L&&(this.queryPadding=Math.max(this.queryPadding,L.queryRadius(b)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<E.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(s){this.symbolFadeHoldUntil=E.now()+s}setDependencies(s,d){const f={};for(const m of d)f[m]=!0;this.dependencies[s]=f}hasDependency(s,d){for(const f of s){const m=this.dependencies[f];if(m){for(const b of d)if(m[b])return!0}}return!1}}class qe{constructor(s,d){this.max=s,this.onRemove=d,this.reset()}reset(){for(const s in this.data)for(const d of this.data[s])d.timeout&&clearTimeout(d.timeout),this.onRemove(d.value);return this.data={},this.order=[],this}add(s,d,f){const m=s.wrapped().key;this.data[m]===void 0&&(this.data[m]=[]);const b={value:d,timeout:void 0};if(f!==void 0&&(b.timeout=setTimeout(()=>{this.remove(s,b)},f)),this.data[m].push(b),this.order.push(m),this.order.length>this.max){const M=this._getAndRemoveByKey(this.order[0]);M&&this.onRemove(M)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const d=this.data[s].shift();return d.timeout&&clearTimeout(d.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),d.value}getByKey(s){const d=this.data[s];return d?d[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,d){if(!this.has(s))return this;const f=s.wrapped().key,m=d===void 0?0:this.data[f].indexOf(d),b=this.data[f][m];return this.data[f].splice(m,1),b.timeout&&clearTimeout(b.timeout),this.data[f].length===0&&delete this.data[f],this.onRemove(b.value),this.order.splice(this.order.indexOf(f),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(s){const d=[];for(const f in this.data)for(const m of this.data[f])s(m.value)||d.push(m);for(const f of d)this.remove(f.value.tileID,f)}}class ve{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,d,f){const m=String(d);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},l.e(this.stateChanges[s][m],f),this.deletedStates[s]===null){this.deletedStates[s]={};for(const b in this.state[s])b!==m&&(this.deletedStates[s][b]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const b in this.state[s][m])f[b]||(this.deletedStates[s][m][b]=null)}else for(const b in f)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][b]===null&&delete this.deletedStates[s][m][b]}removeFeatureState(s,d,f){if(this.deletedStates[s]===null)return;const m=String(d);if(this.deletedStates[s]=this.deletedStates[s]||{},f&&d!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][f]=null);else if(d!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(f in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][f]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,d){const f=String(d),m=l.e({},(this.state[s]||{})[f],(this.stateChanges[s]||{})[f]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const b=this.deletedStates[s][d];if(b===null)return{};for(const M in b)delete m[M]}return m}initializeTileState(s,d){s.setFeatureState(this.state,d)}coalesceChanges(s,d){const f={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const b={};for(const M in this.stateChanges[m])this.state[m][M]||(this.state[m][M]={}),l.e(this.state[m][M],this.stateChanges[m][M]),b[M]=this.state[m][M];f[m]=b}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const b={};if(this.deletedStates[m]===null)for(const M in this.state[m])b[M]={},this.state[m][M]={};else for(const M in this.deletedStates[m]){if(this.deletedStates[m][M]===null)this.state[m][M]={};else for(const P of Object.keys(this.deletedStates[m][M]))delete this.state[m][M][P];b[M]=this.state[m][M]}f[m]=f[m]||{},l.e(f[m],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(f).length!==0)for(const m in s)s[m].setFeatureState(f,d)}}class Re extends l.E{constructor(s,d,f){super(),this.id=s,this.dispatcher=f,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,b,M,P)=>{const D=new(Cs(b.type))(m,b,M,P);if(D.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${D.id}`);return D})(s,d,f,this),this._tiles={},this._cache=new qe(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ve,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}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 s in this._tiles){const d=this._tiles[s];if(d.state!=="loaded"&&d.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,d,f){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,d,f)}catch(m){s.state="errored",m.status!==404?this._source.fire(new l.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new l.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const d in this._tiles){const f=this._tiles[d];f.upload(s),f.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(xt).map(s=>s.key)}getRenderableIds(s){const d=[];for(const f in this._tiles)this._isIdRenderable(f,s)&&d.push(this._tiles[f]);return s?d.sort((f,m)=>{const b=f.tileID,M=m.tileID,P=new l.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),D=new l.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-M.overscaledZ||D.y-P.y||D.x-P.x}).map(f=>f.tileID.key):d.map(f=>f.tileID).sort(xt).map(f=>f.key)}hasRenderableParent(s){const d=this.findLoadedParent(s,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(s,d){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(d||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,d){return l._(this,void 0,void 0,function*(){const f=this._tiles[s];f&&(f.state!=="loading"&&(f.state=d),yield this._loadTile(f,s,d))})}_tileLoaded(s,d,f){s.timeAdded=E.now(),f==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(d,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const d=this.getRenderableIds();for(let m=0;m<d.length;m++){const b=d[m];if(s.neighboringTiles&&s.neighboringTiles[b]){const M=this.getTileByID(b);f(s,M),f(M,s)}}function f(m,b){m.needsHillshadePrepare=!0,m.needsTerrainPrepare=!0;let M=b.tileID.canonical.x-m.tileID.canonical.x;const P=b.tileID.canonical.y-m.tileID.canonical.y,D=Math.pow(2,m.tileID.canonical.z),L=b.tileID.key;M===0&&P===0||Math.abs(P)>1||(Math.abs(M)>1&&(Math.abs(M+D)===1?M+=D:Math.abs(M-D)===1&&(M-=D)),b.dem&&m.dem&&(m.dem.backfillBorder(b.dem,M,P),m.neighboringTiles&&m.neighboringTiles[L]&&(m.neighboringTiles[L].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,d,f,m){for(const b in this._tiles){let M=this._tiles[b];if(m[b]||!M.hasData()||M.tileID.overscaledZ<=d||M.tileID.overscaledZ>f)continue;let P=M.tileID;for(;M&&M.tileID.overscaledZ>d+1;){const L=M.tileID.scaledTo(M.tileID.overscaledZ-1);M=this._tiles[L.key],M&&M.hasData()&&(P=L)}let D=P;for(;D.overscaledZ>d;)if(D=D.scaledTo(D.overscaledZ-1),s[D.key]){m[P.key]=P;break}}}findLoadedParent(s,d){if(s.key in this._loadedParentTiles){const f=this._loadedParentTiles[s.key];return f&&f.tileID.overscaledZ>=d?f:null}for(let f=s.overscaledZ-1;f>=d;f--){const m=s.scaledTo(f),b=this._getLoadedTile(m);if(b)return b}}findLoadedSibling(s){return this._getLoadedTile(s)}_getLoadedTile(s){const d=this._tiles[s.key];return d&&d.hasData()?d:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const d=Math.ceil(s.width/this._source.tileSize)+1,f=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(d*f*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(b)}handleWrapJump(s){const d=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,d){const f={};for(const m in this._tiles){const b=this._tiles[m];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+d),f[b.tileID.key]=b}this._tiles=f;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(s,d,f,m,b,M){const P={},D={},L=Object.keys(s),B=E.now();for(const F of L){const W=s[F],K=this._tiles[F];if(!K||K.fadeEndTime!==0&&K.fadeEndTime<=B)continue;const Q=this.findLoadedParent(W,d),re=this.findLoadedSibling(W),le=Q||re||null;le&&(this._addTile(le.tileID),P[le.tileID.key]=le.tileID),D[F]=W}this._retainLoadedChildren(D,m,f,s);for(const F in P)s[F]||(this._coveredTiles[F]=!0,s[F]=P[F]);if(M){const F={},W={};for(const K of b)this._tiles[K.key].hasData()?F[K.key]=K:W[K.key]=K;for(const K in W){const Q=W[K].children(this._source.maxzoom);this._tiles[Q[0].key]&&this._tiles[Q[1].key]&&this._tiles[Q[2].key]&&this._tiles[Q[3].key]&&(F[Q[0].key]=s[Q[0].key]=Q[0],F[Q[1].key]=s[Q[1].key]=Q[1],F[Q[2].key]=s[Q[2].key]=Q[2],F[Q[3].key]=s[Q[3].key]=Q[3],delete W[K])}for(const K in W){const Q=W[K],re=this.findLoadedParent(Q,this._source.minzoom),le=this.findLoadedSibling(Q),ce=re||le||null;if(ce){F[ce.tileID.key]=s[ce.tileID.key]=ce.tileID;for(const he in F)F[he].isChildOf(ce.tileID)&&delete F[he]}}for(const K in this._tiles)F[K]||(this._coveredTiles[K]=!0)}}update(s,d){if(!this._sourceLoaded||this._paused)return;let f;this.transform=s,this.terrain=d,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?f=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(B=>new l.S(B.canonical.z,B.wrap,B.canonical.z,B.canonical.x,B.canonical.y)):(f=s.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:d}),this._source.hasTile&&(f=f.filter(B=>this._source.hasTile(B)))):f=[];const m=s.coveringZoomLevel(this._source),b=Math.max(m-Re.maxOverzooming,this._source.minzoom),M=Math.max(m+Re.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const B={};for(const F of f)if(F.canonical.z>this._source.minzoom){const W=F.scaledTo(F.canonical.z-1);B[W.key]=W;const K=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));B[K.key]=K}f=f.concat(Object.values(B))}const P=f.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,P&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const D=this._updateRetainedTiles(f,m);Ut(this._source.type)&&this._updateCoveredAndRetainedTiles(D,b,M,m,f,d);for(const B in D)this._tiles[B].clearFadeHold();const L=l.ab(this._tiles,D);for(const B of L){const F=this._tiles[B];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(B)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,d){var f;const m={},b={},M=Math.max(d-Re.maxOverzooming,this._source.minzoom),P=Math.max(d+Re.maxUnderzooming,this._source.minzoom),D={};for(const L of s){const B=this._addTile(L);m[L.key]=L,B.hasData()||d<this._source.maxzoom&&(D[L.key]=L)}this._retainLoadedChildren(D,d,P,m);for(const L of s){let B=this._tiles[L.key];if(B.hasData())continue;if(d+1>this._source.maxzoom){const W=L.children(this._source.maxzoom)[0],K=this.getTile(W);if(K&&K.hasData()){m[W.key]=W;continue}}else{const W=L.children(this._source.maxzoom);if(m[W[0].key]&&m[W[1].key]&&m[W[2].key]&&m[W[3].key])continue}let F=B.wasRequested();for(let W=L.overscaledZ-1;W>=M;--W){const K=L.scaledTo(W);if(b[K.key])break;if(b[K.key]=!0,B=this.getTile(K),!B&&F&&(B=this._addTile(K)),B){const Q=B.hasData();if((Q||!(!((f=this.map)===null||f===void 0)&&f.cancelPendingTileRequestsWhileZooming)||F)&&(m[K.key]=K),F=B.wasRequested(),Q)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const d=[];let f,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){f=this._loadedParentTiles[m.key];break}d.push(m.key);const b=m.scaledTo(m.overscaledZ-1);if(f=this._getLoadedTile(b),f)break;m=b}for(const b of d)this._loadedParentTiles[b]=f}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const s in this._tiles){const d=this._tiles[s].tileID,f=this._getLoadedTile(d);this._loadedSiblingTiles[d.key]=f}}_addTile(s){let d=this._tiles[s.key];if(d)return d;d=this._cache.getAndRemove(s),d&&(this._setTileReloadTimer(s.key,d),d.tileID=s,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,d)));const f=d;return d||(d=new Ts(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(d,s.key,d.state)),d.uses++,this._tiles[s.key]=d,f||this._source.fire(new l.k("dataloading",{tile:d,coord:d.tileID,dataType:"source"})),d}_setTileReloadTimer(s,d){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const f=d.getExpiryTimeout();f&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},f))}_removeTile(s){const d=this._tiles[s];d&&(d.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),d.uses>0||(d.hasData()&&d.state!=="reloading"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}_dataHandler(s){const d=s.sourceDataType;s.dataType==="source"&&d==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&d==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,d,f){const m=[],b=this.transform;if(!b)return m;const M=f?b.getCameraQueryGeometry(s):s,P=s.map(Q=>b.pointCoordinate(Q,this.terrain)),D=M.map(Q=>b.pointCoordinate(Q,this.terrain)),L=this.getIds();let B=1/0,F=1/0,W=-1/0,K=-1/0;for(const Q of D)B=Math.min(B,Q.x),F=Math.min(F,Q.y),W=Math.max(W,Q.x),K=Math.max(K,Q.y);for(let Q=0;Q<L.length;Q++){const re=this._tiles[L[Q]];if(re.holdingForFade())continue;const le=re.tileID,ce=Math.pow(2,b.zoom-re.tileID.overscaledZ),he=d*re.queryPadding*l.X/re.tileSize/ce,te=[le.getTilePoint(new l.Z(B,F)),le.getTilePoint(new l.Z(W,K))];if(te[0].x-he<l.X&&te[0].y-he<l.X&&te[1].x+he>=0&&te[1].y+he>=0){const me=P.map(xe=>le.getTilePoint(xe)),ge=D.map(xe=>le.getTilePoint(xe));m.push({tile:re,tileID:le,queryGeometry:me,cameraQueryGeometry:ge,scale:ce})}}return m}getVisibleCoordinates(s){const d=this.getRenderableIds(s).map(f=>this._tiles[f].tileID);for(const f of d)f.posMatrix=this.transform.calculatePosMatrix(f.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(Ut(this._source.type)){const s=E.now();for(const d in this._tiles)if(this._tiles[d].fadeEndTime>=s)return!0}return!1}setFeatureState(s,d,f){this._state.updateState(s=s||"_geojsonTileLayer",d,f)}removeFeatureState(s,d,f){this._state.removeFeatureState(s=s||"_geojsonTileLayer",d,f)}getFeatureState(s,d){return this._state.getState(s=s||"_geojsonTileLayer",d)}setDependencies(s,d,f){const m=this._tiles[s];m&&m.setDependencies(d,f)}reloadTilesForDependencies(s,d){for(const f in this._tiles)this._tiles[f].hasDependency(s,d)&&this._reloadTile(f,"reloading");this._cache.filter(f=>!f.hasDependency(s,d))}}function xt(x,s){const d=Math.abs(2*x.wrap)-+(x.wrap<0),f=Math.abs(2*s.wrap)-+(s.wrap<0);return x.overscaledZ-s.overscaledZ||f-d||s.canonical.y-x.canonical.y||s.canonical.x-x.canonical.x}function Ut(x){return x==="raster"||x==="image"||x==="video"}Re.maxOverzooming=10,Re.maxUnderzooming=3;class Je{constructor(s,d){this.reset(s,d)}reset(s,d){this.points=s||[],this._distances=[0];for(let f=1;f<this.points.length;f++)this._distances[f]=this._distances[f-1]+this.points[f].dist(this.points[f-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(d||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(s){if(this.points.length===1)return this.points[0];s=l.ac(s,0,1);let d=1,f=this._distances[d];const m=s*this.paddedLength+this.padding;for(;f<m&&d<this._distances.length;)f=this._distances[++d];const b=d-1,M=this._distances[b],P=f-M,D=P>0?(m-M)/P:0;return this.points[b].mult(1-D).add(this.points[d].mult(D))}}function Rn(x,s){let d=!0;return x==="always"||x!=="never"&&s!=="never"||(d=!1),d}class Kn{constructor(s,d,f){const m=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/f),this.yCellCount=Math.ceil(d/f);for(let M=0;M<this.xCellCount*this.yCellCount;M++)m.push([]),b.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=s,this.height=d,this.xScale=this.xCellCount/s,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(s,d,f,m,b){this._forEachCell(d,f,m,b,this._insertBoxCell,this.boxUid++),this.boxKeys.push(s),this.bboxes.push(d),this.bboxes.push(f),this.bboxes.push(m),this.bboxes.push(b)}insertCircle(s,d,f,m){this._forEachCell(d-m,f-m,d+m,f+m,this._insertCircleCell,this.circleUid++),this.circleKeys.push(s),this.circles.push(d),this.circles.push(f),this.circles.push(m)}_insertBoxCell(s,d,f,m,b,M){this.boxCells[b].push(M)}_insertCircleCell(s,d,f,m,b,M){this.circleCells[b].push(M)}_query(s,d,f,m,b,M,P){if(f<0||s>this.width||m<0||d>this.height)return[];const D=[];if(s<=0&&d<=0&&this.width<=f&&this.height<=m){if(b)return[{key:null,x1:s,y1:d,x2:f,y2:m}];for(let L=0;L<this.boxKeys.length;L++)D.push({key:this.boxKeys[L],x1:this.bboxes[4*L],y1:this.bboxes[4*L+1],x2:this.bboxes[4*L+2],y2:this.bboxes[4*L+3]});for(let L=0;L<this.circleKeys.length;L++){const B=this.circles[3*L],F=this.circles[3*L+1],W=this.circles[3*L+2];D.push({key:this.circleKeys[L],x1:B-W,y1:F-W,x2:B+W,y2:F+W})}}else this._forEachCell(s,d,f,m,this._queryCell,D,{hitTest:b,overlapMode:M,seenUids:{box:{},circle:{}}},P);return D}query(s,d,f,m){return this._query(s,d,f,m,!1,null)}hitTest(s,d,f,m,b,M){return this._query(s,d,f,m,!0,b,M).length>0}hitTestCircle(s,d,f,m,b){const M=s-f,P=s+f,D=d-f,L=d+f;if(P<0||M>this.width||L<0||D>this.height)return!1;const B=[];return this._forEachCell(M,D,P,L,this._queryCellCircle,B,{hitTest:!0,overlapMode:m,circle:{x:s,y:d,radius:f},seenUids:{box:{},circle:{}}},b),B.length>0}_queryCell(s,d,f,m,b,M,P,D){const{seenUids:L,hitTest:B,overlapMode:F}=P,W=this.boxCells[b];if(W!==null){const Q=this.bboxes;for(const re of W)if(!L.box[re]){L.box[re]=!0;const le=4*re,ce=this.boxKeys[re];if(s<=Q[le+2]&&d<=Q[le+3]&&f>=Q[le+0]&&m>=Q[le+1]&&(!D||D(ce))&&(!B||!Rn(F,ce.overlapMode))&&(M.push({key:ce,x1:Q[le],y1:Q[le+1],x2:Q[le+2],y2:Q[le+3]}),B))return!0}}const K=this.circleCells[b];if(K!==null){const Q=this.circles;for(const re of K)if(!L.circle[re]){L.circle[re]=!0;const le=3*re,ce=this.circleKeys[re];if(this._circleAndRectCollide(Q[le],Q[le+1],Q[le+2],s,d,f,m)&&(!D||D(ce))&&(!B||!Rn(F,ce.overlapMode))){const he=Q[le],te=Q[le+1],me=Q[le+2];if(M.push({key:ce,x1:he-me,y1:te-me,x2:he+me,y2:te+me}),B)return!0}}}return!1}_queryCellCircle(s,d,f,m,b,M,P,D){const{circle:L,seenUids:B,overlapMode:F}=P,W=this.boxCells[b];if(W!==null){const Q=this.bboxes;for(const re of W)if(!B.box[re]){B.box[re]=!0;const le=4*re,ce=this.boxKeys[re];if(this._circleAndRectCollide(L.x,L.y,L.radius,Q[le+0],Q[le+1],Q[le+2],Q[le+3])&&(!D||D(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}const K=this.circleCells[b];if(K!==null){const Q=this.circles;for(const re of K)if(!B.circle[re]){B.circle[re]=!0;const le=3*re,ce=this.circleKeys[re];if(this._circlesCollide(Q[le],Q[le+1],Q[le+2],L.x,L.y,L.radius)&&(!D||D(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}}_forEachCell(s,d,f,m,b,M,P,D){const L=this._convertToXCellCoord(s),B=this._convertToYCellCoord(d),F=this._convertToXCellCoord(f),W=this._convertToYCellCoord(m);for(let K=L;K<=F;K++)for(let Q=B;Q<=W;Q++)if(b.call(this,s,d,f,m,this.xCellCount*Q+K,M,P,D))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,d,f,m,b,M){const P=m-s,D=b-d,L=f+M;return L*L>P*P+D*D}_circleAndRectCollide(s,d,f,m,b,M,P){const D=(M-m)/2,L=Math.abs(s-(m+D));if(L>D+f)return!1;const B=(P-b)/2,F=Math.abs(d-(b+B));if(F>B+f)return!1;if(L<=D||F<=B)return!0;const W=L-D,K=F-B;return W*W+K*K<=f*f}}function Ui(x,s,d,f,m){const b=l.H();return s?(l.K(b,b,[1/m,1/m,1]),d||l.ad(b,b,f.angle)):l.L(b,f.labelPlaneMatrix,x),b}function pr(x,s,d,f,m){if(s){const b=l.ae(x);return l.K(b,b,[m,m,1]),d||l.ad(b,b,-f.angle),b}return f.glCoordMatrix}function se(x,s,d,f){let m;f?(m=[x,s,f(x,s),1],l.af(m,m,d)):(m=[x,s,0,1],sn(m,m,d));const b=m[3];return{point:new l.P(m[0]/b,m[1]/b),signedDistanceFromCamera:b,isOccluded:!1}}function U(x,s){return .5+x/s*.5}function j(x,s){return x.x>=-s[0]&&x.x<=s[0]&&x.y>=-s[1]&&x.y<=s[1]}function Y(x,s,d,f,m,b,M,P,D,L,B,F,W,K,Q){const re=f?x.textSizeData:x.iconSizeData,le=l.ag(re,d.transform.zoom),ce=[256/d.width*2+1,256/d.height*2+1],he=f?x.text.dynamicLayoutVertexArray:x.icon.dynamicLayoutVertexArray;he.clear();const te=x.lineVertexArray,me=f?x.text.placedSymbolArray:x.icon.placedSymbolArray,ge=d.transform.width/d.transform.height;let xe=!1;for(let Oe=0;Oe<me.length;Oe++){const Fe=me.get(Oe);if(Fe.hidden||Fe.writingMode===l.ah.vertical&&!xe){kt(Fe.numGlyphs,he);continue}xe=!1;const Ke=se(Fe.anchorX,Fe.anchorY,s,Q);if(!j(Ke.point,ce)){kt(Fe.numGlyphs,he);continue}const nt=U(d.transform.cameraToCenterDistance,Ke.signedDistanceFromCamera),We=l.ai(re,le,Fe),He=M?We/nt:We*nt,pt={getElevation:Q,labelPlaneMatrix:m,lineVertexArray:te,pitchWithMap:M,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:L,tileAnchorPoint:new l.P(Fe.anchorX,Fe.anchorY),unwrappedTileID:B,width:F,height:W,translation:K},Ot=fe(pt,Fe,He,!1,P,s,b,x.glyphOffsetArray,he,ge,D);xe=Ot.useVertical,(Ot.notEnoughRoom||xe||Ot.needsFlipping&&fe(pt,Fe,He,!0,P,s,b,x.glyphOffsetArray,he,ge,D).notEnoughRoom)&&kt(Fe.numGlyphs,he)}f?x.text.dynamicLayoutVertexBuffer.updateData(he):x.icon.dynamicLayoutVertexBuffer.updateData(he)}function ne(x,s,d,f,m,b,M,P){const D=b.glyphStartIndex+b.numGlyphs,L=b.lineStartIndex,B=b.lineStartIndex+b.lineLength,F=s.getoffsetX(b.glyphStartIndex),W=s.getoffsetX(D-1),K=Ue(x*F,d,f,m,b.segment,L,B,P,M);if(!K)return null;const Q=Ue(x*W,d,f,m,b.segment,L,B,P,M);return Q?P.projectionCache.anyProjectionOccluded?null:{first:K,last:Q}:null}function de(x,s,d,f){return x===l.ah.horizontal&&Math.abs(d.y-s.y)>Math.abs(d.x-s.x)*f?{useVertical:!0}:(x===l.ah.vertical?s.y<d.y:s.x>d.x)?{needsFlipping:!0}:null}function fe(x,s,d,f,m,b,M,P,D,L,B){const F=d/24,W=s.lineOffsetX*F,K=s.lineOffsetY*F;let Q;if(s.numGlyphs>1){const re=s.glyphStartIndex+s.numGlyphs,le=s.lineStartIndex,ce=s.lineStartIndex+s.lineLength,he=ne(F,P,W,K,f,s,B,x);if(!he)return{notEnoughRoom:!0};const te=se(he.first.point.x,he.first.point.y,M,x.getElevation).point,me=se(he.last.point.x,he.last.point.y,M,x.getElevation).point;if(m&&!f){const ge=de(s.writingMode,te,me,L);if(ge)return ge}Q=[he.first];for(let ge=s.glyphStartIndex+1;ge<re-1;ge++)Q.push(Ue(F*P.getoffsetX(ge),W,K,f,s.segment,le,ce,x,B));Q.push(he.last)}else{if(m&&!f){const le=se(x.tileAnchorPoint.x,x.tileAnchorPoint.y,b,x.getElevation).point,ce=s.lineStartIndex+s.segment+1,he=new l.P(x.lineVertexArray.getx(ce),x.lineVertexArray.gety(ce)),te=se(he.x,he.y,b,x.getElevation),me=te.signedDistanceFromCamera>0?te.point:function(xe,Oe,Fe,Ke,nt,We){return _e(xe,Oe,Fe,1,nt,We)}(x.tileAnchorPoint,he,le,0,b,x),ge=de(s.writingMode,le,me,L);if(ge)return ge}const re=Ue(F*P.getoffsetX(s.glyphStartIndex),W,K,f,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,x,B);if(!re||x.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};Q=[re]}for(const re of Q)l.aj(D,re.point,re.angle);return{}}function _e(x,s,d,f,m,b){const M=x.add(x.sub(s)._unit()),P=m!==void 0?se(M.x,M.y,m,b.getElevation).point:Te(M.x,M.y,b).point,D=d.sub(P);return d.add(D._mult(f/D.mag()))}function ue(x,s,d){const f=s.projectionCache;if(f.projections[x])return f.projections[x];const m=new l.P(s.lineVertexArray.getx(x),s.lineVertexArray.gety(x)),b=Te(m.x,m.y,s);if(b.signedDistanceFromCamera>0)return f.projections[x]=b.point,f.anyProjectionOccluded=f.anyProjectionOccluded||b.isOccluded,b.point;const M=x-d.direction;return function(P,D,L,B,F){return _e(P,D,L,B,void 0,F)}(d.distanceFromAnchor===0?s.tileAnchorPoint:new l.P(s.lineVertexArray.getx(M),s.lineVertexArray.gety(M)),m,d.previousVertex,d.absOffsetX-d.distanceFromAnchor+1,s)}function Te(x,s,d){const f=x+d.translation[0],m=s+d.translation[1];let b;return!d.pitchWithMap&&d.projection.useSpecialProjectionForSymbols?(b=d.projection.projectTileCoordinates(f,m,d.unwrappedTileID,d.getElevation),b.point.x=(.5*b.point.x+.5)*d.width,b.point.y=(.5*-b.point.y+.5)*d.height):(b=se(f,m,d.labelPlaneMatrix,d.getElevation),b.isOccluded=!1),b}function ze(x,s,d){return x._unit()._perp()._mult(s*d)}function Se(x,s,d,f,m,b,M,P,D){if(P.projectionCache.offsets[x])return P.projectionCache.offsets[x];const L=d.add(s);if(x+D.direction<f||x+D.direction>=m)return P.projectionCache.offsets[x]=L,L;const B=ue(x+D.direction,P,D),F=ze(B.sub(d),M,D.direction),W=d.add(F),K=B.add(F);return P.projectionCache.offsets[x]=l.ak(b,L,W,K)||L,P.projectionCache.offsets[x]}function Ue(x,s,d,f,m,b,M,P,D){const L=f?x-s:x+s;let B=L>0?1:-1,F=0;f&&(B*=-1,F=Math.PI),B<0&&(F+=Math.PI);let W,K=B>0?b+m:b+m+1;P.projectionCache.cachedAnchorPoint?W=P.projectionCache.cachedAnchorPoint:(W=Te(P.tileAnchorPoint.x,P.tileAnchorPoint.y,P).point,P.projectionCache.cachedAnchorPoint=W);let Q,re,le=W,ce=W,he=0,te=0;const me=Math.abs(L),ge=[];let xe;for(;he+te<=me;){if(K+=B,K<b||K>=M)return null;he+=te,ce=le,re=Q;const Ke={absOffsetX:me,direction:B,distanceFromAnchor:he,previousVertex:ce};if(le=ue(K,P,Ke),d===0)ge.push(ce),xe=le.sub(ce);else{let nt;const We=le.sub(ce);nt=We.mag()===0?ze(ue(K+B,P,Ke).sub(le),d,B):ze(We,d,B),re||(re=ce.add(nt)),Q=Se(K,nt,le,b,M,re,d,P,Ke),ge.push(re),xe=Q.sub(re)}te=xe.mag()}const Oe=xe._mult((me-he)/te)._add(re||ce),Fe=F+Math.atan2(le.y-ce.y,le.x-ce.x);return ge.push(Oe),{point:Oe,angle:D?Fe:0,path:ge}}const bt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function kt(x,s){for(let d=0;d<x;d++){const f=s.length;s.resize(f+4),s.float32.set(bt,3*f)}}function sn(x,s,d){const f=s[0],m=s[1];return x[0]=d[0]*f+d[4]*m+d[12],x[1]=d[1]*f+d[5]*m+d[13],x[3]=d[3]*f+d[7]*m+d[15],x}const Lt=100;class on{constructor(s,d,f=new Kn(s.width+200,s.height+200,25),m=new Kn(s.width+200,s.height+200,25)){this.transform=s,this.mapProjection=d,this.grid=f,this.ignoredGrid=m,this.pitchFactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Lt,this.screenBottomBoundary=s.height+Lt,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,d,f,m,b,M,P,D,L,B,F){const W=s.anchorPointX+D[0],K=s.anchorPointY+D[1],Q=this.projectAndGetPerspectiveRatio(m,W,K,b,B),re=f*Q.perspectiveRatio;let le;if(M||P)le=this._projectCollisionBox(s,re,m,b,M,P,D,Q,B,F);else{const ge=Q.point.x+(F?F.x*re:0),xe=Q.point.y+(F?F.y*re:0);le={allPointsOccluded:!1,box:[ge+s.x1*re,xe+s.y1*re,ge+s.x2*re,xe+s.y2*re]}}const[ce,he,te,me]=le.box;return this.mapProjection.useSpecialProjectionForSymbols&&(M?le.allPointsOccluded:this.mapProjection.isOccluded(W,K,b))||Q.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ce,he,te,me)||d!=="always"&&this.grid.hitTest(ce,he,te,me,d,L)?{box:[ce,he,te,me],placeable:!1,offscreen:!1}:{box:[ce,he,te,me],placeable:!0,offscreen:this.isOffscreen(ce,he,te,me)}}placeCollisionCircles(s,d,f,m,b,M,P,D,L,B,F,W,K,Q,re,le){const ce=[],he=new l.P(d.anchorX,d.anchorY),te=this.getPerspectiveRatio(M,he.x,he.y,P,le),me=(F?b/te:b*te)/l.ap,ge={getElevation:le,labelPlaneMatrix:D,lineVertexArray:f,pitchWithMap:F,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:he,unwrappedTileID:P,width:this.transform.width,height:this.transform.height,translation:re},xe=ne(me,m,d.lineOffsetX*me,d.lineOffsetY*me,!1,d,!1,ge);let Oe=!1,Fe=!1,Ke=!0;if(xe){const nt=.5*K*te+Q,We=new l.P(-100,-100),He=new l.P(this.screenRightBoundary,this.screenBottomBoundary),pt=new Je,Ot=xe.first,Ge=xe.last;let et=[];for(let Ft=Ot.path.length-1;Ft>=1;Ft--)et.push(Ot.path[Ft]);for(let Ft=1;Ft<Ge.path.length;Ft++)et.push(Ge.path[Ft]);const Pt=2.5*nt;if(L){const Ft=this.projectPathToScreenSpace(et,ge,L);et=Ft.some(Yt=>Yt.signedDistanceFromCamera<=0)?[]:Ft.map(Yt=>Yt.point)}let Nn=[];if(et.length>0){const Ft=et[0].clone(),Yt=et[0].clone();for(let Bn=1;Bn<et.length;Bn++)Ft.x=Math.min(Ft.x,et[Bn].x),Ft.y=Math.min(Ft.y,et[Bn].y),Yt.x=Math.max(Yt.x,et[Bn].x),Yt.y=Math.max(Yt.y,et[Bn].y);Nn=Ft.x>=We.x&&Yt.x<=He.x&&Ft.y>=We.y&&Yt.y<=He.y?[et]:Yt.x<We.x||Ft.x>He.x||Yt.y<We.y||Ft.y>He.y?[]:l.al([et],We.x,We.y,He.x,He.y)}for(const Ft of Nn){pt.reset(Ft,.25*nt);let Yt=0;Yt=pt.length<=.5*nt?1:Math.ceil(pt.paddedLength/Pt)+1;for(let Bn=0;Bn<Yt;Bn++){const Ii=Bn/Math.max(Yt-1,1),ns=pt.lerp(Ii),Fn=ns.x+Lt,rr=ns.y+Lt;ce.push(Fn,rr,nt,0);const qi=Fn-nt,Di=rr-nt,Wi=Fn+nt,Is=rr+nt;if(Ke=Ke&&this.isOffscreen(qi,Di,Wi,Is),Fe=Fe||this.isInsideGrid(qi,Di,Wi,Is),s!=="always"&&this.grid.hitTestCircle(Fn,rr,nt,s,W)&&(Oe=!0,!B))return{circles:[],offscreen:!1,collisionDetected:Oe}}}}return{circles:!B&&Oe||!Fe||te<this.perspectiveRatioCutoff?[]:ce,offscreen:Ke,collisionDetected:Oe}}projectPathToScreenSpace(s,d,f){return s.map(m=>se(m.x,m.y,f,d.getElevation))}queryRenderedSymbols(s){if(s.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const d=[];let f=1/0,m=1/0,b=-1/0,M=-1/0;for(const B of s){const F=new l.P(B.x+Lt,B.y+Lt);f=Math.min(f,F.x),m=Math.min(m,F.y),b=Math.max(b,F.x),M=Math.max(M,F.y),d.push(F)}const P=this.grid.query(f,m,b,M).concat(this.ignoredGrid.query(f,m,b,M)),D={},L={};for(const B of P){const F=B.key;if(D[F.bucketInstanceId]===void 0&&(D[F.bucketInstanceId]={}),D[F.bucketInstanceId][F.featureIndex])continue;const W=[new l.P(B.x1,B.y1),new l.P(B.x2,B.y1),new l.P(B.x2,B.y2),new l.P(B.x1,B.y2)];l.am(d,W)&&(D[F.bucketInstanceId][F.featureIndex]=!0,L[F.bucketInstanceId]===void 0&&(L[F.bucketInstanceId]=[]),L[F.bucketInstanceId].push(F.featureIndex))}return L}insertCollisionBox(s,d,f,m,b,M){(f?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:b,collisionGroupID:M,overlapMode:d},s[0],s[1],s[2],s[3])}insertCollisionCircles(s,d,f,m,b,M){const P=f?this.ignoredGrid:this.grid,D={bucketInstanceId:m,featureIndex:b,collisionGroupID:M,overlapMode:d};for(let L=0;L<s.length;L+=4)P.insertCircle(D,s[L],s[L+1],s[L+2])}projectAndGetPerspectiveRatio(s,d,f,m,b){let M;b?(M=[d,f,b(d,f),1],l.af(M,M,s)):(M=[d,f,0,1],sn(M,M,s));const P=M[3];return{point:new l.P((M[0]/P+1)/2*this.transform.width+Lt,(-M[1]/P+1)/2*this.transform.height+Lt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/P*.5,isOccluded:!1,signedDistanceFromCamera:P}}getPerspectiveRatio(s,d,f,m,b){const M=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(d,f,m,b):se(d,f,s,b);return .5+this.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5}isOffscreen(s,d,f,m){return f<Lt||s>=this.screenRightBoundary||m<Lt||d>this.screenBottomBoundary}isInsideGrid(s,d,f,m){return f>=0&&s<this.gridRightBoundary&&m>=0&&d<this.gridBottomBoundary}getViewportMatrix(){const s=l.an([]);return l.J(s,s,[-100,-100,0]),s}_projectCollisionBox(s,d,f,m,b,M,P,D,L,B){let F=new l.P(1,0),W=new l.P(0,1);const K=new l.P(s.anchorPointX+P[0],s.anchorPointY+P[1]);if(M&&!b){const Ke=this.projectAndGetPerspectiveRatio(f,K.x+1,K.y,m,L).point.sub(D.point).unit(),nt=Math.atan(Ke.y/Ke.x)+(Ke.x<0?Math.PI:0),We=Math.sin(nt),He=Math.cos(nt);F=new l.P(He,We),W=new l.P(-We,He)}else if(!M&&b){const Ke=-this.transform.angle,nt=Math.sin(Ke),We=Math.cos(Ke);F=new l.P(We,nt),W=new l.P(-nt,We)}let Q=D.point,re=d;if(b){Q=K;const Ke=this.transform.zoom-Math.floor(this.transform.zoom);re=Math.pow(2,-Ke),re*=this.mapProjection.getPitchedTextCorrection(this.transform,K,m),B||(re*=l.ac(.5+D.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}B&&(Q=Q.add(F.mult(B.x*re)).add(W.mult(B.y*re)));const le=s.x1*re,ce=s.x2*re,he=(le+ce)/2,te=s.y1*re,me=s.y2*re,ge=(te+me)/2,xe=[{offsetX:le,offsetY:te},{offsetX:he,offsetY:te},{offsetX:ce,offsetY:te},{offsetX:ce,offsetY:ge},{offsetX:ce,offsetY:me},{offsetX:he,offsetY:me},{offsetX:le,offsetY:me},{offsetX:le,offsetY:ge}];let Oe=[];for(const{offsetX:Ke,offsetY:nt}of xe)Oe.push(new l.P(Q.x+F.x*Ke+W.x*nt,Q.y+F.y*Ke+W.y*nt));let Fe=!1;if(b){const Ke=Oe.map(nt=>this.projectAndGetPerspectiveRatio(f,nt.x,nt.y,m,L));Fe=Ke.some(nt=>!nt.isOccluded),Oe=Ke.map(nt=>nt.point)}else Fe=!0;return{box:l.ao(Oe),allPointsOccluded:!Fe}}}function Zt(x,s,d){return s*(l.X/(x.tileSize*Math.pow(2,d-x.tileID.overscaledZ)))}class ri{constructor(s,d,f,m){this.opacity=s?Math.max(0,Math.min(1,s.opacity+(s.placed?d:-d))):m&&f?1:0,this.placed=f}isHidden(){return this.opacity===0&&!this.placed}}class Zn{constructor(s,d,f,m,b){this.text=new ri(s?s.text:null,d,f,b),this.icon=new ri(s?s.icon:null,d,m,b)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class $t{constructor(s,d,f){this.text=s,this.icon=d,this.skipFade=f}}class xn{constructor(){this.invProjMatrix=l.H(),this.viewportMatrix=l.H(),this.circles=[]}}class Un{constructor(s,d,f,m,b){this.bucketInstanceId=s,this.featureIndex=d,this.sourceLayerIndex=f,this.bucketIndex=m,this.tileID=b}}class fi{constructor(s){this.crossSourceCollisions=s,this.maxGroupID=0,this.collisionGroups={}}get(s){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[s]){const d=++this.maxGroupID;this.collisionGroups[s]={ID:d,predicate:f=>f.collisionGroupID===d}}return this.collisionGroups[s]}}function wi(x,s,d,f,m){const{horizontalAlign:b,verticalAlign:M}=l.au(x);return new l.P(-(b-.5)*s+f[0]*m,-(M-.5)*d+f[1]*m)}class Hi{constructor(s,d,f,m,b,M){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new on(this.transform,d),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new fi(b),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(s){const d=this.terrain;return d?(f,m)=>d.getElevation(s,f,m):null}getBucketParts(s,d,f,m){const b=f.getBucket(d),M=f.latestFeatureIndex;if(!b||!M||d.id!==b.layerIds[0])return;const P=f.collisionBoxArray,D=b.layers[0].layout,L=b.layers[0].paint,B=Math.pow(2,this.transform.zoom-f.tileID.overscaledZ),F=f.tileSize/l.X,W=f.tileID.toUnwrapped(),K=this.transform.calculatePosMatrix(W),Q=D.get("text-pitch-alignment")==="map",re=D.get("text-rotation-alignment")==="map",le=Zt(f,1,this.transform.zoom),ce=this.collisionIndex.mapProjection.translatePosition(this.transform,f,L.get("text-translate"),L.get("text-translate-anchor")),he=this.collisionIndex.mapProjection.translatePosition(this.transform,f,L.get("icon-translate"),L.get("icon-translate-anchor")),te=Ui(K,Q,re,this.transform,le);let me=null;if(Q){const xe=pr(K,Q,re,this.transform,le);me=l.L([],this.transform.labelPlaneMatrix,xe)}this.retainedQueryData[b.bucketInstanceId]=new Un(b.bucketInstanceId,M,b.sourceLayerIndex,b.index,f.tileID);const ge={bucket:b,layout:D,translationText:ce,translationIcon:he,posMatrix:K,unwrappedTileID:W,textLabelPlaneMatrix:te,labelToScreenMatrix:me,scale:B,textPixelRatio:F,holdingForFade:f.holdingForFade(),collisionBoxArray:P,partiallyEvaluatedTextSize:l.ag(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(m)for(const xe of b.sortKeyRanges){const{sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:Ke}=xe;s.push({sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:Ke,parameters:ge})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:ge})}attemptAnchorPlacement(s,d,f,m,b,M,P,D,L,B,F,W,K,Q,re,le,ce,he,te){const me=l.aq[s.textAnchor],ge=[s.textOffset0,s.textOffset1],xe=wi(me,f,m,ge,b),Oe=this.collisionIndex.placeCollisionBox(d,W,D,L,B,P,M,le,F.predicate,te,xe);if((!he||this.collisionIndex.placeCollisionBox(he,W,D,L,B,P,M,ce,F.predicate,te,xe).placeable)&&Oe.placeable){let Fe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[K.crossTileID]&&this.prevPlacement.placements[K.crossTileID]&&this.prevPlacement.placements[K.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[K.crossTileID].anchor),K.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[K.crossTileID]={textOffset:ge,width:f,height:m,anchor:me,textBoxScale:b,prevAnchor:Fe},this.markUsedJustification(Q,me,K,re),Q.allowVerticalPlacement&&(this.markUsedOrientation(Q,re,K),this.placedOrientations[K.crossTileID]=re),{shift:xe,placedGlyphBoxes:Oe}}}placeLayerBucketPart(s,d,f){const{bucket:m,layout:b,translationText:M,translationIcon:P,posMatrix:D,unwrappedTileID:L,textLabelPlaneMatrix:B,labelToScreenMatrix:F,textPixelRatio:W,holdingForFade:K,collisionBoxArray:Q,partiallyEvaluatedTextSize:re,collisionGroup:le}=s.parameters,ce=b.get("text-optional"),he=b.get("icon-optional"),te=l.ar(b,"text-overlap","text-allow-overlap"),me=te==="always",ge=l.ar(b,"icon-overlap","icon-allow-overlap"),xe=ge==="always",Oe=b.get("text-rotation-alignment")==="map",Fe=b.get("text-pitch-alignment")==="map",Ke=b.get("icon-text-fit")!=="none",nt=b.get("symbol-z-order")==="viewport-y",We=me&&(xe||!m.hasIconData()||he),He=xe&&(me||!m.hasTextData()||ce);!m.collisionArrays&&Q&&m.deserializeCollisionBoxes(Q);const pt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),Ot=(Ge,et,Pt)=>{var Nn,Ft;if(d[Ge.crossTileID])return;if(K)return void(this.placements[Ge.crossTileID]=new $t(!1,!1,!1));let Yt=!1,Bn=!1,Ii=!0,ns=null,Fn={box:null,placeable:!1,offscreen:null},rr={box:null,placeable:!1,offscreen:null},qi=null,Di=null,Wi=null,Is=0,Xa=0,Iu=0;et.textFeatureIndex?Is=et.textFeatureIndex:Ge.useRuntimeCollisionCircles&&(Is=Ge.featureIndex),et.verticalTextFeatureIndex&&(Xa=et.verticalTextFeatureIndex);const Ka=et.textBox;if(Ka){const Vr=ki=>{let Oi=l.ah.horizontal;if(m.allowVerticalPlacement&&!ki&&this.prevPlacement){const br=this.prevPlacement.placedOrientations[Ge.crossTileID];br&&(this.placedOrientations[Ge.crossTileID]=br,Oi=br,this.markUsedOrientation(m,Oi,Ge))}return Oi},$r=(ki,Oi)=>{if(m.allowVerticalPlacement&&Ge.numVerticalGlyphVertices>0&&et.verticalTextBox){for(const br of m.writingModes)if(br===l.ah.vertical?(Fn=Oi(),rr=Fn):Fn=ki(),Fn&&Fn.placeable)break}else Fn=ki()},po=Ge.textAnchorOffsetStartIndex,is=Ge.textAnchorOffsetEndIndex;if(is===po){const ki=(Oi,br)=>{const Qt=this.collisionIndex.placeCollisionBox(Oi,te,W,D,L,Fe,Oe,M,le.predicate,pt);return Qt&&Qt.placeable&&(this.markUsedOrientation(m,br,Ge),this.placedOrientations[Ge.crossTileID]=br),Qt};$r(()=>ki(Ka,l.ah.horizontal),()=>{const Oi=et.verticalTextBox;return m.allowVerticalPlacement&&Ge.numVerticalGlyphVertices>0&&Oi?ki(Oi,l.ah.vertical):{box:null,offscreen:null}}),Vr(Fn&&Fn.placeable)}else{let ki=l.aq[(Ft=(Nn=this.prevPlacement)===null||Nn===void 0?void 0:Nn.variableOffsets[Ge.crossTileID])===null||Ft===void 0?void 0:Ft.anchor];const Oi=(Qt,Jo,Ja)=>{const Qa=Qt.x2-Qt.x1,Cm=Qt.y2-Qt.y1,x_=Ge.textBoxScale,Tm=Ke&&ge==="never"?Jo:null;let fo=null,Mm=te==="never"?1:2,Ou="never";ki&&Mm++;for(let tc=0;tc<Mm;tc++){for(let zu=po;zu<is;zu++){const Ru=m.textAnchorOffsets.get(zu);if(ki&&Ru.textAnchor!==ki)continue;const el=this.attemptAnchorPlacement(Ru,Qt,Qa,Cm,x_,Oe,Fe,W,D,L,le,Ou,Ge,m,Ja,M,P,Tm,pt);if(el&&(fo=el.placedGlyphBoxes,fo&&fo.placeable))return Yt=!0,ns=el.shift,fo}ki?ki=null:Ou=te}return f&&!fo&&(fo={box:this.collisionIndex.placeCollisionBox(Ka,"always",W,D,L,Fe,Oe,M,le.predicate,pt,new l.P(0,0)).box,offscreen:!1,placeable:!1}),fo};$r(()=>Oi(Ka,et.iconBox,l.ah.horizontal),()=>{const Qt=et.verticalTextBox;return m.allowVerticalPlacement&&(!Fn||!Fn.placeable)&&Ge.numVerticalGlyphVertices>0&&Qt?Oi(Qt,et.verticalIconBox,l.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Fn&&(Yt=Fn.placeable,Ii=Fn.offscreen);const br=Vr(Fn&&Fn.placeable);if(!Yt&&this.prevPlacement){const Qt=this.prevPlacement.variableOffsets[Ge.crossTileID];Qt&&(this.variableOffsets[Ge.crossTileID]=Qt,this.markUsedJustification(m,Qt.anchor,Ge,br))}}}if(qi=Fn,Yt=qi&&qi.placeable,Ii=qi&&qi.offscreen,Ge.useRuntimeCollisionCircles){const Vr=m.text.placedSymbolArray.get(Ge.centerJustifiedTextSymbolIndex),$r=l.ai(m.textSizeData,re,Vr),po=b.get("text-padding");Di=this.collisionIndex.placeCollisionCircles(te,Vr,m.lineVertexArray,m.glyphOffsetArray,$r,D,L,B,F,f,Fe,le.predicate,Ge.collisionCircleDiameter,po,M,pt),Di.circles.length&&Di.collisionDetected&&!f&&l.w("Collisions detected, but collision boxes are not shown"),Yt=me||Di.circles.length>0&&!Di.collisionDetected,Ii=Ii&&Di.offscreen}if(et.iconFeatureIndex&&(Iu=et.iconFeatureIndex),et.iconBox){const Vr=$r=>this.collisionIndex.placeCollisionBox($r,ge,W,D,L,Fe,Oe,P,le.predicate,pt,Ke&&ns?ns:void 0);rr&&rr.placeable&&et.verticalIconBox?(Wi=Vr(et.verticalIconBox),Bn=Wi.placeable):(Wi=Vr(et.iconBox),Bn=Wi.placeable),Ii=Ii&&Wi.offscreen}const Fr=ce||Ge.numHorizontalGlyphVertices===0&&Ge.numVerticalGlyphVertices===0,Du=he||Ge.numIconVertices===0;Fr||Du?Du?Fr||(Bn=Bn&&Yt):Yt=Bn&&Yt:Bn=Yt=Bn&&Yt;const Nd=Bn&&Wi.placeable;if(Yt&&qi.placeable&&this.collisionIndex.insertCollisionBox(qi.box,te,b.get("text-ignore-placement"),m.bucketInstanceId,rr&&rr.placeable&&Xa?Xa:Is,le.ID),Nd&&this.collisionIndex.insertCollisionBox(Wi.box,ge,b.get("icon-ignore-placement"),m.bucketInstanceId,Iu,le.ID),Di&&Yt&&this.collisionIndex.insertCollisionCircles(Di.circles,te,b.get("text-ignore-placement"),m.bucketInstanceId,Is,le.ID),f&&this.storeCollisionData(m.bucketInstanceId,Pt,et,qi,Wi,Di),Ge.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ge.crossTileID]=new $t(Yt||We,Bn||He,Ii||m.justReloaded),d[Ge.crossTileID]=!0};if(nt){if(s.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ge=m.getSortedSymbolIndexes(this.transform.angle);for(let et=Ge.length-1;et>=0;--et){const Pt=Ge[et];Ot(m.symbolInstances.get(Pt),m.collisionArrays[Pt],Pt)}}else for(let Ge=s.symbolInstanceStart;Ge<s.symbolInstanceEnd;Ge++)Ot(m.symbolInstances.get(Ge),m.collisionArrays[Ge],Ge);if(f&&m.bucketInstanceId in this.collisionCircleArrays){const Ge=this.collisionCircleArrays[m.bucketInstanceId];l.as(Ge.invProjMatrix,D),Ge.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}storeCollisionData(s,d,f,m,b,M){if(f.textBox||f.iconBox){let P,D;this.collisionBoxArrays.has(s)?P=this.collisionBoxArrays.get(s):(P=new Map,this.collisionBoxArrays.set(s,P)),P.has(d)?D=P.get(d):(D={text:null,icon:null},P.set(d,D)),f.textBox&&(D.text=m.box),f.iconBox&&(D.icon=b.box)}if(M){let P=this.collisionCircleArrays[s];P===void 0&&(P=this.collisionCircleArrays[s]=new xn);for(let D=0;D<M.circles.length;D+=4)P.circles.push(M.circles[D+0]),P.circles.push(M.circles[D+1]),P.circles.push(M.circles[D+2]),P.circles.push(M.collisionDetected?1:0)}}markUsedJustification(s,d,f,m){let b;b=m===l.ah.vertical?f.verticalPlacedTextSymbolIndex:{left:f.leftJustifiedTextSymbolIndex,center:f.centerJustifiedTextSymbolIndex,right:f.rightJustifiedTextSymbolIndex}[l.at(d)];const M=[f.leftJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.rightJustifiedTextSymbolIndex,f.verticalPlacedTextSymbolIndex];for(const P of M)P>=0&&(s.text.placedSymbolArray.get(P).crossTileID=b>=0&&P!==b?0:f.crossTileID)}markUsedOrientation(s,d,f){const m=d===l.ah.horizontal||d===l.ah.horizontalOnly?d:0,b=d===l.ah.vertical?d:0,M=[f.leftJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.rightJustifiedTextSymbolIndex];for(const P of M)s.text.placedSymbolArray.get(P).placedOrientation=m;f.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(f.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const d=this.prevPlacement;let f=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;const m=d?d.symbolFadeChange(s):1,b=d?d.opacities:{},M=d?d.variableOffsets:{},P=d?d.placedOrientations:{};for(const D in this.placements){const L=this.placements[D],B=b[D];B?(this.opacities[D]=new Zn(B,m,L.text,L.icon),f=f||L.text!==B.text.placed||L.icon!==B.icon.placed):(this.opacities[D]=new Zn(null,m,L.text,L.icon,L.skipFade),f=f||L.text||L.icon)}for(const D in b){const L=b[D];if(!this.opacities[D]){const B=new Zn(L,m,!1,!1);B.isHidden()||(this.opacities[D]=B,f=f||L.text.placed||L.icon.placed)}}for(const D in M)this.variableOffsets[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.variableOffsets[D]=M[D]);for(const D in P)this.placedOrientations[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.placedOrientations[D]=P[D]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");f?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:s)}updateLayerOpacities(s,d){const f={};for(const m of d){const b=m.getBucket(s);b&&m.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,m.tileID,f,m.collisionBoxArray)}}updateBucketOpacities(s,d,f,m){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const b=s.layers[0],M=b.layout,P=new Zn(null,0,!1,!1,!0),D=M.get("text-allow-overlap"),L=M.get("icon-allow-overlap"),B=b._unevaluatedLayout.hasValue("text-variable-anchor")||b._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=M.get("text-rotation-alignment")==="map",W=M.get("text-pitch-alignment")==="map",K=M.get("icon-text-fit")!=="none",Q=new Zn(null,0,D&&(L||!s.hasIconData()||M.get("icon-optional")),L&&(D||!s.hasTextData()||M.get("text-optional")),!0);!s.collisionArrays&&m&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(m);const re=(ce,he,te)=>{for(let me=0;me<he/4;me++)ce.opacityVertexArray.emplaceBack(te);ce.hasVisibleVertices=ce.hasVisibleVertices||te!==Aa},le=this.collisionBoxArrays.get(s.bucketInstanceId);for(let ce=0;ce<s.symbolInstances.length;ce++){const he=s.symbolInstances.get(ce),{numHorizontalGlyphVertices:te,numVerticalGlyphVertices:me,crossTileID:ge}=he;let xe=this.opacities[ge];f[ge]?xe=P:xe||(xe=Q,this.opacities[ge]=xe),f[ge]=!0;const Oe=he.numIconVertices>0,Fe=this.placedOrientations[he.crossTileID],Ke=Fe===l.ah.vertical,nt=Fe===l.ah.horizontal||Fe===l.ah.horizontalOnly;if(te>0||me>0){const He=gr(xe.text);re(s.text,te,Ke?Aa:He),re(s.text,me,nt?Aa:He);const pt=xe.text.isHidden();[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach(et=>{et>=0&&(s.text.placedSymbolArray.get(et).hidden=pt||Ke?1:0)}),he.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(he.verticalPlacedTextSymbolIndex).hidden=pt||nt?1:0);const Ot=this.variableOffsets[he.crossTileID];Ot&&this.markUsedJustification(s,Ot.anchor,he,Fe);const Ge=this.placedOrientations[he.crossTileID];Ge&&(this.markUsedJustification(s,"left",he,Ge),this.markUsedOrientation(s,Ge,he))}if(Oe){const He=gr(xe.icon),pt=!(K&&he.verticalPlacedIconSymbolIndex&&Ke);he.placedIconSymbolIndex>=0&&(re(s.icon,he.numIconVertices,pt?He:Aa),s.icon.placedSymbolArray.get(he.placedIconSymbolIndex).hidden=xe.icon.isHidden()),he.verticalPlacedIconSymbolIndex>=0&&(re(s.icon,he.numVerticalIconVertices,pt?Aa:He),s.icon.placedSymbolArray.get(he.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}const We=le&&le.has(ce)?le.get(ce):{text:null,icon:null};if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const He=s.collisionArrays[ce];if(He){let pt=new l.P(0,0);if(He.textBox||He.verticalTextBox){let Ot=!0;if(B){const Ge=this.variableOffsets[ge];Ge?(pt=wi(Ge.anchor,Ge.width,Ge.height,Ge.textOffset,Ge.textBoxScale),F&&pt._rotate(W?this.transform.angle:-this.transform.angle)):Ot=!1}if(He.textBox||He.verticalTextBox){let Ge;He.textBox&&(Ge=Ke),He.verticalTextBox&&(Ge=nt),Ma(s.textCollisionBox.collisionVertexArray,xe.text.placed,!Ot||Ge,We.text,pt.x,pt.y)}}if(He.iconBox||He.verticalIconBox){const Ot=!!(!nt&&He.verticalIconBox);let Ge;He.iconBox&&(Ge=Ot),He.verticalIconBox&&(Ge=!Ot),Ma(s.iconCollisionBox.collisionVertexArray,xe.icon.placed,Ge,We.icon,K?pt.x:0,K?pt.y:0)}}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const ce=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ce.invProjMatrix,s.placementViewportMatrix=ce.viewportMatrix,s.collisionCircleArray=ce.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(s,d){const f=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*f>s}setStale(){this.stale=!0}}function Ma(x,s,d,f,m,b){f&&f.length!==0||(f=[0,0,0,0]);const M=f[0]-Lt,P=f[1]-Lt,D=f[2]-Lt,L=f[3]-Lt;x.emplaceBack(s?1:0,d?1:0,m||0,b||0,M,P),x.emplaceBack(s?1:0,d?1:0,m||0,b||0,D,P),x.emplaceBack(s?1:0,d?1:0,m||0,b||0,D,L),x.emplaceBack(s?1:0,d?1:0,m||0,b||0,M,L)}const vn=Math.pow(2,25),Zh=Math.pow(2,24),Yh=Math.pow(2,17),fr=Math.pow(2,16),mr=Math.pow(2,9),Z0=Math.pow(2,8),Rr=Math.pow(2,1);function gr(x){if(x.opacity===0&&!x.placed)return 0;if(x.opacity===1&&x.placed)return 4294967295;const s=x.placed?1:0,d=Math.floor(127*x.opacity);return d*vn+s*Zh+d*Yh+s*fr+d*mr+s*Z0+d*Rr+s}const Aa=0;function Vo(){return{isOccluded:(x,s,d)=>!1,getPitchedTextCorrection:(x,s,d)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(x,s,d,f){throw new Error("Not implemented.")},translatePosition:(x,s,d,f)=>function(m,b,M,P,D=!1){if(!M[0]&&!M[1])return[0,0];const L=D?P==="map"?m.angle:0:P==="viewport"?-m.angle:0;if(L){const B=Math.sin(L),F=Math.cos(L);M=[M[0]*F-M[1]*B,M[0]*B+M[1]*F]}return[D?M[0]:Zt(b,M[0],m.zoom),D?M[1]:Zt(b,M[1],m.zoom)]}(x,s,d,f),getCircleRadiusCorrection:x=>1}}class si{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,d,f,m,b){const M=this._bucketParts;for(;this._currentTileIndex<s.length;)if(d.getBucketParts(M,m,s[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,b())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort((P,D)=>P.sortKey-D.sortKey));this._currentPartIndex<M.length;)if(d.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,f),this._currentPartIndex++,b())return!0;return!1}}class Nl{constructor(s,d,f,m,b,M,P,D){this.placement=new Hi(s,Vo(),d,M,P,D),this._currentPlacementIndex=f.length-1,this._forceFullPlacement=m,this._showCollisionBoxes=b,this._done=!1}isDone(){return this._done}continuePlacement(s,d,f){const m=E.now(),b=()=>!this._forceFullPlacement&&E.now()-m>2;for(;this._currentPlacementIndex>=0;){const M=d[s[this._currentPlacementIndex]],P=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=P)&&(!M.maxzoom||M.maxzoom>P)){if(this._inProgressLayer||(this._inProgressLayer=new si(M)),this._inProgressLayer.continuePlacement(f[M.source],this.placement,this._showCollisionBoxes,M,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const Kr=512/l.X/2;class ti{constructor(s,d,f){this.tileID=s,this.bucketInstanceId=f,this._symbolsByKey={};const m=new Map;for(let b=0;b<d.length;b++){const M=d.get(b),P=M.key,D=m.get(P);D?D.push(M):m.set(P,[M])}for(const[b,M]of m){const P={positions:M.map(D=>({x:Math.floor(D.anchorX*Kr),y:Math.floor(D.anchorY*Kr)})),crossTileIDs:M.map(D=>D.crossTileID)};if(P.positions.length>128){const D=new l.av(P.positions.length,16,Uint16Array);for(const{x:L,y:B}of P.positions)D.add(L,B);D.finish(),delete P.positions,P.index=D}this._symbolsByKey[b]=P}}getScaledCoordinates(s,d){const{x:f,y:m,z:b}=this.tileID.canonical,{x:M,y:P,z:D}=d.canonical,L=Kr/Math.pow(2,D-b),B=(P*l.X+s.anchorY)*L,F=m*l.X*Kr;return{x:Math.floor((M*l.X+s.anchorX)*L-f*l.X*Kr),y:Math.floor(B-F)}}findMatches(s,d,f){const m=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z);for(let b=0;b<s.length;b++){const M=s.get(b);if(M.crossTileID)continue;const P=this._symbolsByKey[M.key];if(!P)continue;const D=this.getScaledCoordinates(M,d);if(P.index){const L=P.index.range(D.x-m,D.y-m,D.x+m,D.y+m).sort();for(const B of L){const F=P.crossTileIDs[B];if(!f[F]){f[F]=!0,M.crossTileID=F;break}}}else if(P.positions)for(let L=0;L<P.positions.length;L++){const B=P.positions[L],F=P.crossTileIDs[L];if(Math.abs(B.x-D.x)<=m&&Math.abs(B.y-D.y)<=m&&!f[F]){f[F]=!0,M.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:s})=>s)}}class eu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Jr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const d=Math.round((s-this.lng)/360);if(d!==0)for(const f in this.indexes){const m=this.indexes[f],b={};for(const M in m){const P=m[M];P.tileID=P.tileID.unwrapTo(P.tileID.wrap+d),b[P.tileID.key]=P}this.indexes[f]=b}this.lng=s}addBucket(s,d,f){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let b=0;b<d.symbolInstances.length;b++)d.symbolInstances.get(b).crossTileID=0;this.usedCrossTileIDs[s.overscaledZ]||(this.usedCrossTileIDs[s.overscaledZ]={});const m=this.usedCrossTileIDs[s.overscaledZ];for(const b in this.indexes){const M=this.indexes[b];if(Number(b)>s.overscaledZ)for(const P in M){const D=M[P];D.tileID.isChildOf(s)&&D.findMatches(d.symbolInstances,s,m)}else{const P=M[s.scaledTo(Number(b)).key];P&&P.findMatches(d.symbolInstances,s,m)}}for(let b=0;b<d.symbolInstances.length;b++){const M=d.symbolInstances.get(b);M.crossTileID||(M.crossTileID=f.generate(),m[M.crossTileID]=!0)}return this.indexes[s.overscaledZ]===void 0&&(this.indexes[s.overscaledZ]={}),this.indexes[s.overscaledZ][s.key]=new ti(s,d.symbolInstances,d.bucketInstanceId),!0}removeBucketCrossTileIDs(s,d){for(const f of d.getCrossTileIDsLists())for(const m of f)delete this.usedCrossTileIDs[s][m]}removeStaleBuckets(s){let d=!1;for(const f in this.indexes){const m=this.indexes[f];for(const b in m)s[m[b].bucketInstanceId]||(this.removeBucketCrossTileIDs(f,m[b]),delete m[b],d=!0)}return d}}class Xh{constructor(){this.layerIndexes={},this.crossTileIDs=new eu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(s,d,f){let m=this.layerIndexes[s.id];m===void 0&&(m=this.layerIndexes[s.id]=new Jr);let b=!1;const M={};m.handleWrapJump(f);for(const P of d){const D=P.getBucket(s);D&&s.id===D.layerIds[0]&&(D.bucketInstanceId||(D.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(P.tileID,D,this.crossTileIDs)&&(b=!0),M[D.bucketInstanceId]=!0)}return m.removeStaleBuckets(M)&&(b=!0),b}pruneUnusedLayers(s){const d={};s.forEach(f=>{d[f]=!0});for(const f in this.layerIndexes)d[f]||delete this.layerIndexes[f]}}const Qr=(x,s)=>l.t(x,s&&s.filter(d=>d.identifier!=="source.canvas")),Y0=l.aw();class tu extends l.E{constructor(s,d={}){super(),this._rtlPluginLoaded=()=>{for(const f in this.sourceCaches){const m=this.sourceCaches[f].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[f].reload()}},this.map=s,this.dispatcher=new lt(Xe(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(f,m)=>this.getGlyphs(f,m)),this.dispatcher.registerMessageHandler("GI",(f,m)=>this.getImages(f,m)),this.imageManager=new ht,this.imageManager.setEventedParent(this),this.glyphManager=new jt(s._requestManager,d.localIdeographFontFamily),this.lineAtlas=new pi(256,512),this.crossTileSymbolIndex=new Xh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ay()),zr().on(Be,this._rtlPluginLoaded),this.on("data",f=>{if(f.dataType!=="source"||f.sourceDataType!=="metadata")return;const m=this.sourceCaches[f.sourceId];if(!m)return;const b=m.getSource();if(b&&b.vectorLayerIds)for(const M in this._layers){const P=this._layers[M];P.source===b.id&&this._validateLayer(P)}})}loadURL(s,d={},f){this.fire(new l.k("dataloading",{dataType:"style"})),d.validate=typeof d.validate!="boolean"||d.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController;const b=this._loadStyleRequest;l.h(m,this._loadStyleRequest).then(M=>{this._loadStyleRequest=null,this._load(M.data,d,f)}).catch(M=>{this._loadStyleRequest=null,M&&!b.signal.aborted&&this.fire(new l.j(M))})}loadJSON(s,d={},f){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,d.validate=d.validate!==!1,this._load(s,d,f)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(Y0,{validate:!1})}_load(s,d,f){var m;const b=d.transformStyle?d.transformStyle(f,s):s;if(!d.validate||!Qr(this,l.u(b))){this._loaded=!0,this.stylesheet=b;for(const M in b.sources)this.addSource(M,b.sources[M],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new hn(this.stylesheet.light),this.sky=new bn(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const s=l.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(d=>d.id),this._layers={},this._serializedLayers=null;for(const d of s){const f=l.aA(d);f.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=f}}_loadSprite(s,d=!1,f=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(b,M,P,D){return l._(this,void 0,void 0,function*(){const L=Ie(b),B=P>1?"@2x":"",F={},W={};for(const{id:K,url:Q}of L){const re=M.transformRequest(Ye(Q,B,".json"),"SpriteJSON");F[K]=l.h(re,D);const le=M.transformRequest(Ye(Q,B,".png"),"SpriteImage");W[K]=oe.getImage(le,D)}return yield Promise.all([...Object.values(F),...Object.values(W)]),function(K,Q){return l._(this,void 0,void 0,function*(){const re={};for(const le in K){re[le]={};const ce=E.getImageCanvasContext((yield Q[le]).data),he=(yield K[le]).data;for(const te in he){const{width:me,height:ge,x:xe,y:Oe,sdf:Fe,pixelRatio:Ke,stretchX:nt,stretchY:We,content:He,textFitWidth:pt,textFitHeight:Ot}=he[te];re[le][te]={data:null,pixelRatio:Ke,sdf:Fe,stretchX:nt,stretchY:We,content:He,textFitWidth:pt,textFitHeight:Ot,spriteData:{width:me,height:ge,x:xe,y:Oe,context:ce}}}}return re})}(F,W)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(b=>{if(this._spriteRequest=null,b)for(const M in b){this._spritesImagesIds[M]=[];const P=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter(D=>!(D in b)):[];for(const D of P)this.imageManager.removeImage(D),this._changedImages[D]=!0;for(const D in b[M]){const L=M==="default"?D:`${M}:${D}`;this._spritesImagesIds[M].push(L),L in this.imageManager.images?this.imageManager.updateImage(L,b[M][D],!1):this.imageManager.addImage(L,b[M][D]),d&&(this._changedImages[L]=!0)}}}).catch(b=>{this._spriteRequest=null,m=b,this.fire(new l.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),f&&f(m)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(s){const d=this.sourceCaches[s.source];if(!d)return;const f=s.sourceLayer;if(!f)return;const m=d.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(f)===-1)&&this.fire(new l.j(new Error(`Source layer "${f}" does not exist on source "${m.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s,d=!1){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(d?l.aB(f):f);const m=[];for(const b of s)if(f[b]){const M=d?l.aB(f[b]):f[b];m.push(M)}return m}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const d=Object.keys(this._layers);for(const f of d){const m=this._layers[f];m.type!=="custom"&&(s[f]=m.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const d=this._changed;if(d){const m=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(m.length||b.length)&&this._updateWorkerLayers(m,b);for(const M in this._updatedSources){const P=this._updatedSources[M];if(P==="reload")this._reloadSource(M);else{if(P!=="clear")throw new Error(`Invalid action ${P}`);this._clearSource(M)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const M in this._updatedPaintProps)this._layers[M].updateTransitions(s);this.light.updateTransitions(s),this.sky.updateTransitions(s),this._resetUpdates()}const f={};for(const m in this.sourceCaches){const b=this.sourceCaches[m];f[m]=b.used,b.used=!1}for(const m of this._order){const b=this._layers[m];b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const m in f){const b=this.sourceCaches[m];!!f[m]!=!!b.used&&b.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.sky.recalculate(s),this.z=s.zoom,d&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,d){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s,!1),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,d={}){var f;this._checkLoaded();const m=this.serialize();if(s=d.transformStyle?d.transformStyle(m,s):s,((f=d.validate)===null||f===void 0||f)&&Qr(this,l.u(s)))return!1;(s=l.aB(s)).layers=l.az(s.layers);const b=l.aC(m,s),M=this._getOperationsToPerform(b);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(", ")}.`);if(M.operations.length===0)return!1;for(const P of M.operations)P();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const d=[],f=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":d.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":d.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":d.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":d.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":d.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":d.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":d.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":d.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":d.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":d.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":d.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":d.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":d.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":d.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":d.push(()=>{});break;default:f.push(m.command)}return{operations:d,unimplemented:f}}addImage(s,d){if(this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,d),this._afterImageUpdated(s)}updateImage(s,d){this.imageManager.updateImage(s,d)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,d,f={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(d.type)>=0&&this._validate(l.u.source,`sources.${s}`,d,null,f))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Re(s,d,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const f in this._layers)if(this._layers[f].source===s)return this.fire(new l.j(new Error(`Source "${s}" cannot be removed while layer "${f}" is using it.`)));const d=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],d.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,d){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const f=this.sourceCaches[s].getSource();if(f.type!=="geojson")throw new Error(`geojsonSource.type is ${f.type}, which is !== 'geojson`);f.setData(d),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,d,f={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new l.j(new Error(`Layer "${m}" already exists on this map.`)));let b;if(s.type==="custom"){if(Qr(this,l.aD(s)))return;b=l.aA(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=l.aB(s),s=l.e(s,{source:m})),this._validate(l.u.layer,`layers.${m}`,s,{arrayIndex:-1},f))return;b=l.aA(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:m}})}const M=d?this._order.indexOf(d):this._order.length;if(d&&M===-1)this.fire(new l.j(new Error(`Cannot add layer "${m}" before non-existing layer "${d}".`)));else{if(this._order.splice(M,0,m),this._layerOrderChanged=!0,this._layers[m]=b,this._removedLayers[m]&&b.source&&b.type!=="custom"){const P=this._removedLayers[m];delete this._removedLayers[m],P.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(s,d){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new l.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===d)return;const f=this._order.indexOf(s);this._order.splice(f,1);const m=d?this._order.indexOf(d):this._order.length;d&&m===-1?this.fire(new l.j(new Error(`Cannot move layer "${s}" before non-existing layer "${d}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const d=this._layers[s];if(!d)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${s}".`)));d.setEventedParent(null);const f=this._order.indexOf(s);this._order.splice(f,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=d,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],d.onRemove&&d.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,d,f){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===d&&m.maxzoom===f||(d!=null&&(m.minzoom=d),f!=null&&(m.maxzoom=f),this._updateLayer(m)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,d,f={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!l.aE(m.filter,d))return d==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(l.u.filter,`layers.${m.id}.filter`,d,null,f)||(m.filter=l.aB(d),this._updateLayer(m)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return l.aB(this.getLayer(s).filter)}setLayoutProperty(s,d,f,m={}){this._checkLoaded();const b=this.getLayer(s);b?l.aE(b.getLayoutProperty(d),f)||(b.setLayoutProperty(d,f,m),this._updateLayer(b)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,d){const f=this.getLayer(s);if(f)return f.getLayoutProperty(d);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,d,f,m={}){this._checkLoaded();const b=this.getLayer(s);b?l.aE(b.getPaintProperty(d),f)||(b.setPaintProperty(d,f,m)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,d){return this.getLayer(s).getPaintProperty(d)}setFeatureState(s,d){this._checkLoaded();const f=s.source,m=s.sourceLayer,b=this.sourceCaches[f];if(b===void 0)return void this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)));const M=b.getSource().type;M==="geojson"&&m?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):M!=="vector"||m?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(m,s.id,d)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,d){this._checkLoaded();const f=s.source,m=this.sourceCaches[f];if(m===void 0)return void this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)));const b=m.getSource().type,M=b==="vector"?s.sourceLayer:void 0;b!=="vector"||M?d&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(M,s.id,d):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const d=s.source,f=s.sourceLayer,m=this.sourceCaches[d];if(m!==void 0)return m.getSource().type!=="vector"||f?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(f,s.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=l.aF(this.sourceCaches,b=>b.serialize()),d=this._serializeByIds(this._order,!0),f=this.map.getTerrain()||void 0,m=this.stylesheet;return l.aG({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:d,terrain:f},b=>b!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const d=M=>this._layers[M].type==="fill-extrusion",f={},m=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P)){f[P]=M;for(const D of s){const L=D[P];if(L)for(const B of L)m.push(B)}}}m.sort((M,P)=>P.intersectionZ-M.intersectionZ);const b=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P))for(let D=m.length-1;D>=0;D--){const L=m[D].feature;if(f[L.layer.id]<M)break;b.push(L),m.pop()}else for(const D of s){const L=D[P];if(L)for(const B of L)b.push(B.feature)}}return b}queryRenderedFeatures(s,d,f){d&&d.filter&&this._validate(l.u.filter,"queryRenderedFeatures.filter",d.filter,null,d);const m={};if(d&&d.layers){if(!Array.isArray(d.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const P of d.layers){const D=this._layers[P];if(!D)return this.fire(new l.j(new Error(`The layer '${P}' does not exist in the map's style and cannot be queried for features.`))),[];m[D.source]=!0}}const b=[];d.availableImages=this._availableImages;const M=this._serializedAllLayers();for(const P in this.sourceCaches)d.layers&&!m[P]||b.push(Dt(this.sourceCaches[P],this._layers,M,s,d,f));return this.placement&&b.push(function(P,D,L,B,F,W,K){const Q={},re=W.queryRenderedSymbols(B),le=[];for(const ce of Object.keys(re).map(Number))le.push(K[ce]);le.sort(At);for(const ce of le){const he=ce.featureIndex.lookupSymbolFeatures(re[ce.bucketInstanceId],D,ce.bucketIndex,ce.sourceLayerIndex,F.filter,F.layers,F.availableImages,P);for(const te in he){const me=Q[te]=Q[te]||[],ge=he[te];ge.sort((xe,Oe)=>{const Fe=ce.featureSortOrder;if(Fe){const Ke=Fe.indexOf(xe.featureIndex);return Fe.indexOf(Oe.featureIndex)-Ke}return Oe.featureIndex-xe.featureIndex});for(const xe of ge)me.push(xe)}}for(const ce in Q)Q[ce].forEach(he=>{const te=he.feature,me=L[P[ce].source].getFeatureState(te.layer["source-layer"],te.id);te.source=te.layer.source,te.layer["source-layer"]&&(te.sourceLayer=te.layer["source-layer"]),te.state=me});return Q}(this._layers,M,this.sourceCaches,s,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,d){d&&d.filter&&this._validate(l.u.filter,"querySourceFeatures.filter",d.filter,null,d);const f=this.sourceCaches[s];return f?function(m,b){const M=m.getRenderableIds().map(L=>m.getTileByID(L)),P=[],D={};for(let L=0;L<M.length;L++){const B=M[L],F=B.tileID.canonical.key;D[F]||(D[F]=!0,B.querySourceFeatures(P,b))}return P}(f,d):[]}getLight(){return this.light.getLight()}setLight(s,d={}){this._checkLoaded();const f=this.light.getLight();let m=!1;for(const M in s)if(!l.aE(s[M],f[M])){m=!0;break}if(!m)return;const b={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(s,d),this.light.updateTransitions(b)}getSky(){var s;return(s=this.stylesheet)===null||s===void 0?void 0:s.sky}setSky(s,d={}){const f=this.getSky();let m=!1;if(!s&&!f)return;if(s&&!f)m=!0;else if(!s&&f)m=!0;else for(const M in s)if(!l.aE(s[M],f[M])){m=!0;break}if(!m)return;const b={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=s,this.sky.setSky(s,d),this.sky.updateTransitions(b)}_validate(s,d,f,m,b={}){return(!b||b.validate!==!1)&&Qr(this,s.call(l.u,l.e({key:d,style:this.serialize(),value:f,styleSpec:l.v},m)))}_remove(s=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),zr().off(Be,this._rtlPluginLoaded);for(const d in this._layers)this._layers[d].setEventedParent(null);for(const d in this.sourceCaches){const f=this.sourceCaches[d];f.setEventedParent(null),f.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),s&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(s)}_clearSource(s){this.sourceCaches[s].clearTiles()}_reloadSource(s){this.sourceCaches[s].resume(),this.sourceCaches[s].reload()}_updateSources(s){for(const d in this.sourceCaches)this.sourceCaches[d].update(s,this.map.terrain)}_generateCollisionBoxes(){for(const s in this.sourceCaches)this._reloadSource(s)}_updatePlacement(s,d,f,m,b=!1){let M=!1,P=!1;const D={};for(const L of this._order){const B=this._layers[L];if(B.type!=="symbol")continue;if(!D[B.source]){const W=this.sourceCaches[B.source];D[B.source]=W.getRenderableIds(!0).map(K=>W.getTileByID(K)).sort((K,Q)=>Q.tileID.overscaledZ-K.tileID.overscaledZ||(K.tileID.isLessThan(Q.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(B,D[B.source],s.center.lng);M=M||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||f===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),s.zoom))&&(this.pauseablePlacement=new Nl(s,this.map.terrain,this._order,b,d,f,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,D),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),P=!0),M&&this.pauseablePlacement.placement.setStale()),P||M)for(const L of this._order){const B=this._layers[L];B.type==="symbol"&&this.placement.updateLayerOpacities(B,D[B.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,d){return l._(this,void 0,void 0,function*(){const f=yield this.imageManager.getImages(d.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[d.source];return m&&m.setDependencies(d.tileID.key,d.type,d.icons),f})}getGlyphs(s,d){return l._(this,void 0,void 0,function*(){const f=yield this.glyphManager.getGlyphs(d.stacks),m=this.sourceCaches[d.source];return m&&m.setDependencies(d.tileID.key,d.type,[""]),f})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,d={}){this._checkLoaded(),s&&this._validate(l.u.glyphs,"glyphs",s,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,d,f={},m){this._checkLoaded();const b=[{id:s,url:d}],M=[...Ie(this.stylesheet.sprite),...b];this._validate(l.u.sprite,"sprite",M,null,f)||(this.stylesheet.sprite=M,this._loadSprite(b,!0,m))}removeSprite(s){this._checkLoaded();const d=Ie(this.stylesheet.sprite);if(d.find(f=>f.id===s)){if(this._spritesImagesIds[s])for(const f of this._spritesImagesIds[s])this.imageManager.removeImage(f),this._changedImages[f]=!0;d.splice(d.findIndex(f=>f.id===s),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Ie(this.stylesheet.sprite)}setSprite(s,d={},f){this._checkLoaded(),s&&this._validate(l.u.sprite,"sprite",s,null,d)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,f):(this._unloadSprite(),f&&f(null)))}}var $o=l.Y([{name:"a_pos",type:"Int16",components:2}]);const uo={prelude:pn(`#ifdef GL_ES
49
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(N[1])} }\`.`)];const $=[];return c.layerType==="symbol"&&(C==="text-field"&&y&&!y.glyphs&&$.push(new Be(h,w,'use of "text-field" requires a style "glyphs" property')),C==="text-font"&&fu(es(w))&&Qn(w.type)==="identity"&&$.push(new Be(h,w,'"text-font" does not support identity functions'))),$.concat(p({key:c.key,value:w,valueSpec:R,style:y,styleSpec:v,expressionContext:"property",propertyType:o,propertyKey:C}))}function ku(c){return vd(c,"paint")}function wd(c){return vd(c,"layout")}function kd(c){let o=[];const h=c.value,p=c.key,y=c.style,v=c.styleSpec;h.type||h.ref||o.push(new Be(p,h,'either "type" or "ref" is required'));let w=Qn(h.type);const C=Qn(h.ref);if(h.id){const A=Qn(h.id);for(let O=0;O<c.arrayIndex;O++){const R=y.layers[O];Qn(R.id)===A&&o.push(new Be(p,h.id,`duplicate layer id "${h.id}", previously used at line ${R.id.__line__}`))}}if("ref"in h){let A;["type","source","source-layer","filter","layout"].forEach(O=>{O in h&&o.push(new Be(p,h[O],`"${O}" is prohibited for ref layers`))}),y.layers.forEach(O=>{Qn(O.id)===C&&(A=O)}),A?A.ref?o.push(new Be(p,h.ref,"ref cannot reference another ref layer")):w=Qn(A.type):o.push(new Be(p,h.ref,`ref layer "${C}" not found`))}else if(w!=="background")if(h.source){const A=y.sources&&y.sources[h.source],O=A&&Qn(A.type);A?O==="vector"&&w==="raster"?o.push(new Be(p,h.source,`layer "${h.id}" requires a raster source`)):O!=="raster-dem"&&w==="hillshade"?o.push(new Be(p,h.source,`layer "${h.id}" requires a raster-dem source`)):O==="raster"&&w!=="raster"?o.push(new Be(p,h.source,`layer "${h.id}" requires a vector source`)):O!=="vector"||h["source-layer"]?O==="raster-dem"&&w!=="hillshade"?o.push(new Be(p,h.source,"raster-dem source can only be used with layer type 'hillshade'.")):w!=="line"||!h.paint||!h.paint["line-gradient"]||O==="geojson"&&A.lineMetrics||o.push(new Be(p,h,`layer "${h.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):o.push(new Be(p,h,`layer "${h.id}" must specify a "source-layer"`)):o.push(new Be(p,h.source,`source "${h.source}" not found`))}else o.push(new Be(p,h,'missing required property "source"'));return o=o.concat(yr({key:p,value:h,valueSpec:v.layer,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,objectElementValidators:{"*":()=>[],type:()=>c.validateSpec({key:`${p}.type`,value:h.type,valueSpec:v.layer.type,style:c.style,styleSpec:c.styleSpec,validateSpec:c.validateSpec,object:h,objectKey:"type"}),filter:xd,layout:A=>yr({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":O=>wd(Or({layerType:w},O))}}),paint:A=>yr({layer:h,key:A.key,value:A.value,style:A.style,styleSpec:A.styleSpec,validateSpec:A.validateSpec,objectElementValidators:{"*":O=>ku(Or({layerType:w},O))}})}})),o}function Xo(c){const o=c.value,h=c.key,p=cn(o);return p!=="string"?[new Be(h,o,`string expected, ${p} found`)]:[]}const Su={promoteId:function({key:c,value:o}){if(cn(o)==="string")return Xo({key:c,value:o});{const h=[];for(const p in o)h.push(...Xo({key:`${c}.${p}`,value:o[p]}));return h}}};function Kl(c){const o=c.value,h=c.key,p=c.styleSpec,y=c.style,v=c.validateSpec;if(!o.type)return[new Be(h,o,'"type" is required')];const w=Qn(o.type);let C;switch(w){case"vector":case"raster":return C=yr({key:h,value:o,valueSpec:p[`source_${w.replace("-","_")}`],style:c.style,styleSpec:p,objectElementValidators:Su,validateSpec:v}),C;case"raster-dem":return C=function(A){var O;const R=(O=A.sourceName)!==null&&O!==void 0?O:"",N=A.value,$=A.styleSpec,q=$.source_raster_dem,G=A.style;let X=[];const ie=cn(N);if(N===void 0)return X;if(ie!=="object")return X.push(new Be("source_raster_dem",N,`object expected, ${ie} found`)),X;const ae=Qn(N.encoding)==="custom",be=["redFactor","greenFactor","blueFactor","baseShift"],pe=A.value.encoding?`"${A.value.encoding}"`:"Default";for(const ye in N)!ae&&be.includes(ye)?X.push(new Be(ye,N[ye],`In "${R}": "${ye}" is only valid when "encoding" is set to "custom". ${pe} encoding found`)):q[ye]?X=X.concat(A.validateSpec({key:ye,value:N[ye],valueSpec:q[ye],validateSpec:A.validateSpec,style:G,styleSpec:$})):X.push(new Be(ye,N[ye],`unknown property "${ye}"`));return X}({sourceName:h,value:o,style:c.style,styleSpec:p,validateSpec:v}),C;case"geojson":if(C=yr({key:h,value:o,valueSpec:p.source_geojson,style:y,styleSpec:p,validateSpec:v,objectElementValidators:Su}),o.cluster)for(const A in o.clusterProperties){const[O,R]=o.clusterProperties[A],N=typeof O=="string"?[O,["accumulated"],["get",A]]:O;C.push(...Ua({key:`${h}.${A}.map`,value:R,validateSpec:v,expressionContext:"cluster-map"})),C.push(...Ua({key:`${h}.${A}.reduce`,value:N,validateSpec:v,expressionContext:"cluster-reduce"}))}return C;case"video":return yr({key:h,value:o,valueSpec:p.source_video,style:y,validateSpec:v,styleSpec:p});case"image":return yr({key:h,value:o,valueSpec:p.source_image,style:y,validateSpec:v,styleSpec:p});case"canvas":return[new Be(h,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return qs({key:`${h}.type`,value:o.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]},style:y,validateSpec:v,styleSpec:p})}}function Sd(c){const o=c.value,h=c.styleSpec,p=h.light,y=c.style;let v=[];const w=cn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new Be("light",o,`object expected, ${w} found`)]),v;for(const C in o){const A=C.match(/^(.*)-transition$/);v=v.concat(A&&p[A[1]]&&p[A[1]].transition?c.validateSpec({key:C,value:o[C],valueSpec:h.transition,validateSpec:c.validateSpec,style:y,styleSpec:h}):p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],validateSpec:c.validateSpec,style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)])}return v}function Ed(c){const o=c.value,h=c.styleSpec,p=h.sky,y=c.style,v=cn(o);if(o===void 0)return[];if(v!=="object")return[new Be("sky",o,`object expected, ${v} found`)];let w=[];for(const C in o)w=w.concat(p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)]);return w}function Cd(c){const o=c.value,h=c.styleSpec,p=h.terrain,y=c.style;let v=[];const w=cn(o);if(o===void 0)return v;if(w!=="object")return v=v.concat([new Be("terrain",o,`object expected, ${w} found`)]),v;for(const C in o)v=v.concat(p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],validateSpec:c.validateSpec,style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)]);return v}function Td(c){let o=[];const h=c.value,p=c.key;if(Array.isArray(h)){const y=[],v=[];for(const w in h)h[w].id&&y.includes(h[w].id)&&o.push(new Be(p,h,`all the sprites' ids must be unique, but ${h[w].id} is duplicated`)),y.push(h[w].id),h[w].url&&v.includes(h[w].url)&&o.push(new Be(p,h,`all the sprites' URLs must be unique, but ${h[w].url} is duplicated`)),v.push(h[w].url),o=o.concat(yr({key:`${p}[${w}]`,value:h[w],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:c.validateSpec}));return o}return Xo({key:p,value:h})}const Eu={"*":()=>[],array:Xl,boolean:function(c){const o=c.value,h=c.key,p=cn(o);return p!=="boolean"?[new Be(h,o,`boolean expected, ${p} found`)]:[]},number:bd,color:function(c){const o=c.key,h=c.value,p=cn(h);return p!=="string"?[new Be(o,h,`color expected, ${p} found`)]:vn.parse(String(h))?[]:[new Be(o,h,`color expected, "${h}" found`)]},constants:_m,enum:qs,filter:xd,function:vu,layer:kd,object:yr,source:Kl,light:Sd,sky:Ed,terrain:Cd,projection:function(c){const o=c.value,h=c.styleSpec,p=h.projection,y=c.style,v=cn(o);if(o===void 0)return[];if(v!=="object")return[new Be("projection",o,`object expected, ${v} found`)];let w=[];for(const C in o)w=w.concat(p[C]?c.validateSpec({key:C,value:o[C],valueSpec:p[C],style:y,styleSpec:h}):[new Be(C,o[C],`unknown property "${C}"`)]);return w},string:Xo,formatted:function(c){return Xo(c).length===0?[]:Ua(c)},resolvedImage:function(c){return Xo(c).length===0?[]:Ua(c)},padding:function(c){const o=c.key,h=c.value;if(cn(h)==="array"){if(h.length<1||h.length>4)return[new Be(o,h,`padding requires 1 to 4 values; ${h.length} values found`)];const p={type:"number"};let y=[];for(let v=0;v<h.length;v++)y=y.concat(c.validateSpec({key:`${o}[${v}]`,value:h[v],validateSpec:c.validateSpec,valueSpec:p}));return y}return bd({key:o,value:h,valueSpec:{}})},variableAnchorOffsetCollection:function(c){const o=c.key,h=c.value,p=cn(h),y=c.styleSpec;if(p!=="array"||h.length<1||h.length%2!=0)return[new Be(o,h,"variableAnchorOffsetCollection requires a non-empty array of even length")];let v=[];for(let w=0;w<h.length;w+=2)v=v.concat(qs({key:`${o}[${w}]`,value:h[w],valueSpec:y.layout_symbol["text-anchor"]})),v=v.concat(Xl({key:`${o}[${w+1}]`,value:h[w+1],valueSpec:{length:2,value:"number"},validateSpec:c.validateSpec,style:c.style,styleSpec:y}));return v},sprite:Td};function Ha(c){const o=c.value,h=c.valueSpec,p=c.styleSpec;return c.validateSpec=Ha,h.expression&&fu(Qn(o))?vu(c):h.expression&&yu(es(o))?Ua(c):h.type&&Eu[h.type]?Eu[h.type](c):yr(Or({},c,{valueSpec:h.type?p[h.type]:h}))}function bm(c){const o=c.value,h=c.key,p=Xo(c);return p.length||(o.indexOf("{fontstack}")===-1&&p.push(new Be(h,o,'"glyphs" url must include a "{fontstack}" token')),o.indexOf("{range}")===-1&&p.push(new Be(h,o,'"glyphs" url must include a "{range}" token'))),p}function Nr(c,o=we){let h=[];return h=h.concat(Ha({key:"",value:c,valueSpec:o.$root,styleSpec:o,style:c,validateSpec:Ha,objectElementValidators:{glyphs:bm,"*":()=>[]}})),c.constants&&(h=h.concat(_m({key:"constants",value:c.constants,style:c,styleSpec:o,validateSpec:Ha}))),Md(h)}function As(c){return function(o){return c({...o,validateSpec:Ha})}}function Md(c){return[].concat(c).sort((o,h)=>o.line-h.line)}function ts(c){return function(...o){return Md(c.apply(this,o))}}Nr.source=ts(As(Kl)),Nr.sprite=ts(As(Td)),Nr.glyphs=ts(As(bm)),Nr.light=ts(As(Sd)),Nr.sky=ts(As(Ed)),Nr.terrain=ts(As(Cd)),Nr.layer=ts(As(kd)),Nr.filter=ts(As(xd)),Nr.paintProperty=ts(As(ku)),Nr.layoutProperty=ts(As(wd));const Ko=Nr,p_=Ko.light,f_=Ko.sky,xm=Ko.paintProperty,vm=Ko.layoutProperty;function Ad(c,o){let h=!1;if(o&&o.length)for(const p of o)c.fire(new At(new Error(p.message))),h=!0;return h}class qa{constructor(o,h,p){const y=this.cells=[];if(o instanceof ArrayBuffer){this.arrayBuffer=o;const w=new Int32Array(this.arrayBuffer);o=w[0],this.d=(h=w[1])+2*(p=w[2]);for(let A=0;A<this.d*this.d;A++){const O=w[3+A],R=w[3+A+1];y.push(O===R?null:w.subarray(O,R))}const C=w[3+y.length+1];this.keys=w.subarray(w[3+y.length],C),this.bboxes=w.subarray(C),this.insert=this._insertReadonly}else{this.d=h+2*p;for(let w=0;w<this.d*this.d;w++)y.push([]);this.keys=[],this.bboxes=[]}this.n=h,this.extent=o,this.padding=p,this.scale=h/o,this.uid=0;const v=p/h*o;this.min=-v,this.max=o+v}insert(o,h,p,y,v){this._forEachCell(h,p,y,v,this._insertCell,this.uid++,void 0,void 0),this.keys.push(o),this.bboxes.push(h),this.bboxes.push(p),this.bboxes.push(y),this.bboxes.push(v)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(o,h,p,y,v,w){this.cells[v].push(w)}query(o,h,p,y,v){const w=this.min,C=this.max;if(o<=w&&h<=w&&C<=p&&C<=y&&!v)return Array.prototype.slice.call(this.keys);{const A=[];return this._forEachCell(o,h,p,y,this._queryCell,A,{},v),A}}_queryCell(o,h,p,y,v,w,C,A){const O=this.cells[v];if(O!==null){const R=this.keys,N=this.bboxes;for(let $=0;$<O.length;$++){const q=O[$];if(C[q]===void 0){const G=4*q;(A?A(N[G+0],N[G+1],N[G+2],N[G+3]):o<=N[G+2]&&h<=N[G+3]&&p>=N[G+0]&&y>=N[G+1])?(C[q]=!0,w.push(R[q])):C[q]=!1}}}}_forEachCell(o,h,p,y,v,w,C,A){const O=this._convertToCellCoord(o),R=this._convertToCellCoord(h),N=this._convertToCellCoord(p),$=this._convertToCellCoord(y);for(let q=O;q<=N;q++)for(let G=R;G<=$;G++){const X=this.d*G+q;if((!A||A(this._convertFromCellCoord(q),this._convertFromCellCoord(G),this._convertFromCellCoord(q+1),this._convertFromCellCoord(G+1)))&&v.call(this,o,h,p,y,X,w,C,A))return}}_convertFromCellCoord(o){return(o-this.padding)/this.scale}_convertToCellCoord(o){return Math.max(0,Math.min(this.d-1,Math.floor(o*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const o=this.cells,h=3+this.cells.length+1+1;let p=0;for(let w=0;w<this.cells.length;w++)p+=this.cells[w].length;const y=new Int32Array(h+p+this.keys.length+this.bboxes.length);y[0]=this.extent,y[1]=this.n,y[2]=this.padding;let v=h;for(let w=0;w<o.length;w++){const C=o[w];y[3+w]=v,y.set(C,v),v+=C.length}return y[3+o.length]=v,y.set(this.keys,v),v+=this.keys.length,y[3+o.length+1]=v,y.set(this.bboxes,v),v+=this.bboxes.length,y.buffer}static serialize(o,h){const p=o.toArrayBuffer();return h&&h.push(p),{buffer:p}}static deserialize(o){return new qa(o.buffer)}}const Br={};function ot(c,o,h={}){if(Br[c])throw new Error(`${c} is already registered.`);Object.defineProperty(o,"_classRegistryKey",{value:c,writeable:!1}),Br[c]={klass:o,omit:h.omit||[],shallow:h.shallow||[]}}ot("Object",Object),ot("TransferableGridIndex",qa),ot("Color",vn),ot("Error",Error),ot("AJAXError",Ce),ot("ResolvedImage",gr),ot("StylePropertyFunction",ja),ot("StyleExpression",gu,{omit:["_evaluator"]}),ot("ZoomDependentExpression",$a),ot("ZoomConstantExpression",Va),ot("CompoundExpression",Lr,{omit:["_evaluate"]});for(const c in za)za[c]._classRegistryKey||ot(`Expression_${c}`,za[c]);function Cu(c){return c&&typeof ArrayBuffer<"u"&&(c instanceof ArrayBuffer||c.constructor&&c.constructor.name==="ArrayBuffer")}function Pd(c){return c.$name||c.constructor._classRegistryKey}function wm(c){return!function(o){if(o===null||typeof o!="object")return!1;const h=Pd(o);return!(!h||h==="Object")}(c)&&(c==null||typeof c=="boolean"||typeof c=="number"||typeof c=="string"||c instanceof Boolean||c instanceof Number||c instanceof String||c instanceof Date||c instanceof RegExp||c instanceof Blob||c instanceof Error||Cu(c)||jt(c)||ArrayBuffer.isView(c)||c instanceof ImageData)}function Wa(c,o){if(wm(c))return(Cu(c)||jt(c))&&o&&o.push(c),ArrayBuffer.isView(c)&&o&&o.push(c.buffer),c instanceof ImageData&&o&&o.push(c.data.buffer),c;if(Array.isArray(c)){const v=[];for(const w of c)v.push(Wa(w,o));return v}if(typeof c!="object")throw new Error("can't serialize object of type "+typeof c);const h=Pd(c);if(!h)throw new Error(`can't serialize object of unregistered class ${c.constructor.name}`);if(!Br[h])throw new Error(`${h} is not registered.`);const{klass:p}=Br[h],y=p.serialize?p.serialize(c,o):{};if(p.serialize){if(o&&y===o[o.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const v in c){if(!c.hasOwnProperty(v)||Br[h].omit.indexOf(v)>=0)continue;const w=c[v];y[v]=Br[h].shallow.indexOf(v)>=0?w:Wa(w,o)}c instanceof Error&&(y.message=c.message)}if(y.$name)throw new Error("$name property is reserved for worker serialization logic.");return h!=="Object"&&(y.$name=h),y}function Ga(c){if(wm(c))return c;if(Array.isArray(c))return c.map(Ga);if(typeof c!="object")throw new Error("can't deserialize object of type "+typeof c);const o=Pd(c)||"Object";if(!Br[o])throw new Error(`can't deserialize unregistered class ${o}`);const{klass:h}=Br[o];if(!h)throw new Error(`can't deserialize unregistered class ${o}`);if(h.deserialize)return h.deserialize(c);const p=Object.create(h.prototype);for(const y of Object.keys(c)){if(y==="$name")continue;const v=c[y];p[y]=Br[o].shallow.indexOf(y)>=0?v:Ga(v)}return p}class Id{constructor(){this.first=!0}update(o,h){const p=Math.floor(o);return this.first?(this.first=!1,this.lastIntegerZoom=p,this.lastIntegerZoomTime=0,this.lastZoom=o,this.lastFloorZoom=p,!0):(this.lastFloorZoom>p?(this.lastIntegerZoom=p+1,this.lastIntegerZoomTime=h):this.lastFloorZoom<p&&(this.lastIntegerZoom=p,this.lastIntegerZoomTime=h),o!==this.lastZoom&&(this.lastZoom=o,this.lastFloorZoom=p,!0))}}const Jt={"Latin-1 Supplement":c=>c>=128&&c<=255,"Hangul Jamo":c=>c>=4352&&c<=4607,Khmer:c=>c>=6016&&c<=6143,"General Punctuation":c=>c>=8192&&c<=8303,"Letterlike Symbols":c=>c>=8448&&c<=8527,"Number Forms":c=>c>=8528&&c<=8591,"Miscellaneous Technical":c=>c>=8960&&c<=9215,"Control Pictures":c=>c>=9216&&c<=9279,"Optical Character Recognition":c=>c>=9280&&c<=9311,"Enclosed Alphanumerics":c=>c>=9312&&c<=9471,"Geometric Shapes":c=>c>=9632&&c<=9727,"Miscellaneous Symbols":c=>c>=9728&&c<=9983,"Miscellaneous Symbols and Arrows":c=>c>=11008&&c<=11263,"Ideographic Description Characters":c=>c>=12272&&c<=12287,"CJK Symbols and Punctuation":c=>c>=12288&&c<=12351,Katakana:c=>c>=12448&&c<=12543,Kanbun:c=>c>=12688&&c<=12703,"CJK Strokes":c=>c>=12736&&c<=12783,"Enclosed CJK Letters and Months":c=>c>=12800&&c<=13055,"CJK Compatibility":c=>c>=13056&&c<=13311,"Yijing Hexagram Symbols":c=>c>=19904&&c<=19967,"Private Use Area":c=>c>=57344&&c<=63743,"Vertical Forms":c=>c>=65040&&c<=65055,"CJK Compatibility Forms":c=>c>=65072&&c<=65103,"Small Form Variants":c=>c>=65104&&c<=65135,"Halfwidth and Fullwidth Forms":c=>c>=65280&&c<=65519};function Dd(c){for(const o of c)if(zd(o.charCodeAt(0)))return!0;return!1}function m_(c){for(const o of c)if(!Za(o.charCodeAt(0)))return!1;return!0}function Od(c){const o=c.map(h=>{try{return new RegExp(`\\p{sc=${h}}`,"u").source}catch{return null}}).filter(h=>h);return new RegExp(o.join("|"),"u")}const g_=Od(["Arab","Dupl","Mong","Ougr","Syrc"]);function Za(c){return!g_.test(String.fromCodePoint(c))}const km=Od(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function zd(c){return!(c!==746&&c!==747&&(c<4352||!(Jt["CJK Compatibility Forms"](c)&&!(c>=65097&&c<=65103)||Jt["CJK Compatibility"](c)||Jt["CJK Strokes"](c)||!(!Jt["CJK Symbols and Punctuation"](c)||c>=12296&&c<=12305||c>=12308&&c<=12319||c===12336)||Jt["Enclosed CJK Letters and Months"](c)||Jt["Ideographic Description Characters"](c)||Jt.Kanbun(c)||Jt.Katakana(c)&&c!==12540||!(!Jt["Halfwidth and Fullwidth Forms"](c)||c===65288||c===65289||c===65293||c>=65306&&c<=65310||c===65339||c===65341||c===65343||c>=65371&&c<=65503||c===65507||c>=65512&&c<=65519)||!(!Jt["Small Form Variants"](c)||c>=65112&&c<=65118||c>=65123&&c<=65126)||Jt["Vertical Forms"](c)||Jt["Yijing Hexagram Symbols"](c)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(c))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(c))||km.test(String.fromCodePoint(c)))))}function Sm(c){return!(zd(c)||function(o){return!!(Jt["Latin-1 Supplement"](o)&&(o===167||o===169||o===174||o===177||o===188||o===189||o===190||o===215||o===247)||Jt["General Punctuation"](o)&&(o===8214||o===8224||o===8225||o===8240||o===8241||o===8251||o===8252||o===8258||o===8263||o===8264||o===8265||o===8273)||Jt["Letterlike Symbols"](o)||Jt["Number Forms"](o)||Jt["Miscellaneous Technical"](o)&&(o>=8960&&o<=8967||o>=8972&&o<=8991||o>=8996&&o<=9e3||o===9003||o>=9085&&o<=9114||o>=9150&&o<=9165||o===9167||o>=9169&&o<=9179||o>=9186&&o<=9215)||Jt["Control Pictures"](o)&&o!==9251||Jt["Optical Character Recognition"](o)||Jt["Enclosed Alphanumerics"](o)||Jt["Geometric Shapes"](o)||Jt["Miscellaneous Symbols"](o)&&!(o>=9754&&o<=9759)||Jt["Miscellaneous Symbols and Arrows"](o)&&(o>=11026&&o<=11055||o>=11088&&o<=11097||o>=11192&&o<=11243)||Jt["CJK Symbols and Punctuation"](o)||Jt.Katakana(o)||Jt["Private Use Area"](o)||Jt["CJK Compatibility Forms"](o)||Jt["Small Form Variants"](o)||Jt["Halfwidth and Fullwidth Forms"](o)||o===8734||o===8756||o===8757||o>=9984&&o<=10087||o>=10102&&o<=10131||o===65532||o===65533)}(c))}const y_=Od(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Rd(c){return y_.test(String.fromCodePoint(c))}function __(c,o){return!(!o&&Rd(c)||c>=2304&&c<=3583||c>=3840&&c<=4255||Jt.Khmer(c))}function b_(c){for(const o of c)if(Rd(o.charCodeAt(0)))return!0;return!1}const _r=new class{constructor(){this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null}setState(c){this.pluginStatus=c.pluginStatus,this.pluginURL=c.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(c){this.applyArabicShaping=c.applyArabicShaping,this.processBidirectionalText=c.processBidirectionalText,this.processStyledBidirectionalText=c.processStyledBidirectionalText}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getPluginURL(){return this.pluginURL}getRTLTextPluginStatus(){return this.pluginStatus}};class Ln{constructor(o,h){this.zoom=o,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.zoomHistory=h.zoomHistory,this.transition=h.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new Id,this.transition={})}isSupportedScript(o){return function(h,p){for(const y of h)if(!__(y.charCodeAt(0),p))return!1;return!0}(o,_r.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const o=this.zoom,h=o-Math.floor(o),p=this.crossFadingFactor();return o>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:h+(1-h)*p}:{fromScale:.5,toScale:1,t:1-(1-p)*h}}}class Ya{constructor(o,h){this.property=o,this.value=h,this.expression=function(p,y){if(fu(p))return new ja(p,y);if(yu(p)){const v=gd(p,y);if(v.result==="error")throw new Error(v.value.map(w=>`${w.key}: ${w.message}`).join(", "));return v.value}{let v=p;return y.type==="color"&&typeof p=="string"?v=vn.parse(p):y.type!=="padding"||typeof p!="number"&&!Array.isArray(p)?y.type==="variableAnchorOffsetCollection"&&Array.isArray(p)&&(v=Rr.parse(p)):v=mr.parse(p),{kind:"constant",evaluate:()=>v}}}(h===void 0?o.specification.default:h,o.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(o,h,p){return this.property.possiblyEvaluate(this,o,h,p)}}class Tu{constructor(o){this.property=o,this.value=new Ya(o,void 0)}transitioned(o,h){return new Em(this.property,this.value,h,Me({},o.transition,this.transition),o.now)}untransitioned(){return new Em(this.property,this.value,null,{},0)}}class Mu{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitionablePropertyValues)}getValue(o){return it(this._values[o].value.value)}setValue(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Tu(this._values[o].property)),this._values[o].value=new Ya(this._values[o].property,h===null?void 0:it(h))}getTransition(o){return it(this._values[o].transition)}setTransition(o,h){Object.prototype.hasOwnProperty.call(this._values,o)||(this._values[o]=new Tu(this._values[o].property)),this._values[o].transition=it(h)||void 0}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p);const y=this.getTransition(h);y!==void 0&&(o[`${h}-transition`]=y)}return o}transitioned(o,h){const p=new Jl(this._properties);for(const y of Object.keys(this._values))p._values[y]=this._values[y].transitioned(o,h._values[y]);return p}untransitioned(){const o=new Jl(this._properties);for(const h of Object.keys(this._values))o._values[h]=this._values[h].untransitioned();return o}}class Em{constructor(o,h,p,y,v){this.property=o,this.value=h,this.begin=v+y.delay||0,this.end=this.begin+y.duration||0,o.specification.transition&&(y.delay||y.duration)&&(this.prior=p)}possiblyEvaluate(o,h,p){const y=o.now||0,v=this.value.possiblyEvaluate(o,h,p),w=this.prior;if(w){if(y>this.end)return this.prior=null,v;if(this.value.isDataDriven())return this.prior=null,v;if(y<this.begin)return w.possiblyEvaluate(o,h,p);{const C=(y-this.begin)/(this.end-this.begin);return this.property.interpolate(w.possiblyEvaluate(o,h,p),v,function(A){if(A<=0)return 0;if(A>=1)return 1;const O=A*A,R=O*A;return 4*(A<.5?R:3*(A-O)+R-.75)}(C))}}return v}}class Jl{constructor(o){this._properties=o,this._values=Object.create(o.defaultTransitioningPropertyValues)}possiblyEvaluate(o,h,p){const y=new ec(this._properties);for(const v of Object.keys(this._values))y._values[v]=this._values[v].possiblyEvaluate(o,h,p);return y}hasTransition(){for(const o of Object.keys(this._values))if(this._values[o].prior)return!0;return!1}}class Ql{constructor(o){this._properties=o,this._values=Object.create(o.defaultPropertyValues)}hasValue(o){return this._values[o].value!==void 0}getValue(o){return it(this._values[o].value)}setValue(o,h){this._values[o]=new Ya(this._values[o].property,h===null?void 0:it(h))}serialize(){const o={};for(const h of Object.keys(this._values)){const p=this.getValue(h);p!==void 0&&(o[h]=p)}return o}possiblyEvaluate(o,h,p){const y=new ec(this._properties);for(const v of Object.keys(this._values))y._values[v]=this._values[v].possiblyEvaluate(o,h,p);return y}}class Ps{constructor(o,h,p){this.property=o,this.value=h,this.parameters=p}isConstant(){return this.value.kind==="constant"}constantOr(o){return this.value.kind==="constant"?this.value.value:o}evaluate(o,h,p,y){return this.property.evaluate(this.value,this.parameters,o,h,p,y)}}class ec{constructor(o){this._properties=o,this._values=Object.create(o.defaultPossiblyEvaluatedValues)}get(o){return this._values[o]}}class dt{constructor(o){this.specification=o}possiblyEvaluate(o,h){if(o.isDataDriven())throw new Error("Value should not be data driven");return o.expression.evaluate(h)}interpolate(o,h,p){const y=nr[this.specification.type];return y?y(o,h,p):o}}class Et{constructor(o,h){this.specification=o,this.overrides=h}possiblyEvaluate(o,h,p,y){return new Ps(this,o.expression.kind==="constant"||o.expression.kind==="camera"?{kind:"constant",value:o.expression.evaluate(h,null,{},p,y)}:o.expression,h)}interpolate(o,h,p){if(o.value.kind!=="constant"||h.value.kind!=="constant")return o;if(o.value.value===void 0||h.value.value===void 0)return new Ps(this,{kind:"constant",value:void 0},o.parameters);const y=nr[this.specification.type];if(y){const v=y(o.value.value,h.value.value,p);return new Ps(this,{kind:"constant",value:v},o.parameters)}return o}evaluate(o,h,p,y,v,w){return o.kind==="constant"?o.value:o.evaluate(h,p,y,v,w)}}class Au extends Et{possiblyEvaluate(o,h,p,y){if(o.value===void 0)return new Ps(this,{kind:"constant",value:void 0},h);if(o.expression.kind==="constant"){const v=o.expression.evaluate(h,null,{},p,y),w=o.property.specification.type==="resolvedImage"&&typeof v!="string"?v.name:v,C=this._calculate(w,w,w,h);return new Ps(this,{kind:"constant",value:C},h)}if(o.expression.kind==="camera"){const v=this._calculate(o.expression.evaluate({zoom:h.zoom-1}),o.expression.evaluate({zoom:h.zoom}),o.expression.evaluate({zoom:h.zoom+1}),h);return new Ps(this,{kind:"constant",value:v},h)}return new Ps(this,o.expression,h)}evaluate(o,h,p,y,v,w){if(o.kind==="source"){const C=o.evaluate(h,p,y,v,w);return this._calculate(C,C,C,h)}return o.kind==="composite"?this._calculate(o.evaluate({zoom:Math.floor(h.zoom)-1},p,y),o.evaluate({zoom:Math.floor(h.zoom)},p,y),o.evaluate({zoom:Math.floor(h.zoom)+1},p,y),h):o.value}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Pu{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){if(o.value!==void 0){if(o.expression.kind==="constant"){const v=o.expression.evaluate(h,null,{},p,y);return this._calculate(v,v,v,h)}return this._calculate(o.expression.evaluate(new Ln(Math.floor(h.zoom-1),h)),o.expression.evaluate(new Ln(Math.floor(h.zoom),h)),o.expression.evaluate(new Ln(Math.floor(h.zoom+1),h)),h)}}_calculate(o,h,p,y){return y.zoom>y.zoomHistory.lastIntegerZoom?{from:o,to:h}:{from:p,to:h}}interpolate(o){return o}}class Ld{constructor(o){this.specification=o}possiblyEvaluate(o,h,p,y){return!!o.expression.evaluate(h,null,{},p,y)}interpolate(){return!1}}class x{constructor(o){this.properties=o,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const h in o){const p=o[h];p.specification.overridable&&this.overridableProperties.push(h);const y=this.defaultPropertyValues[h]=new Ya(p,void 0),v=this.defaultTransitionablePropertyValues[h]=new Tu(p);this.defaultTransitioningPropertyValues[h]=v.untransitioned(),this.defaultPossiblyEvaluatedValues[h]=y.possiblyEvaluate({})}}}ot("DataDrivenProperty",Et),ot("DataConstantProperty",dt),ot("CrossFadedDataDrivenProperty",Au),ot("CrossFadedProperty",Pu),ot("ColorRampProperty",Ld);const s="-transition";class d extends ln{constructor(o,h){if(super(),this.id=o.id,this.type=o.type,this._featureFilter={filter:()=>!0,needGeometry:!1},o.type!=="custom"&&(this.metadata=o.metadata,this.minzoom=o.minzoom,this.maxzoom=o.maxzoom,o.type!=="background"&&(this.source=o.source,this.sourceLayer=o["source-layer"],this.filter=o.filter),h.layout&&(this._unevaluatedLayout=new Ql(h.layout)),h.paint)){this._transitionablePaint=new Mu(h.paint);for(const p in o.paint)this.setPaintProperty(p,o.paint[p],{validate:!1});for(const p in o.layout)this.setLayoutProperty(p,o.layout[p],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new ec(h.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(o){return o==="visibility"?this.visibility:this._unevaluatedLayout.getValue(o)}setLayoutProperty(o,h,p={}){h!=null&&this._validate(vm,`layers.${this.id}.layout.${o}`,o,h,p)||(o!=="visibility"?this._unevaluatedLayout.setValue(o,h):this.visibility=h)}getPaintProperty(o){return o.endsWith(s)?this._transitionablePaint.getTransition(o.slice(0,-11)):this._transitionablePaint.getValue(o)}setPaintProperty(o,h,p={}){if(h!=null&&this._validate(xm,`layers.${this.id}.paint.${o}`,o,h,p))return!1;if(o.endsWith(s))return this._transitionablePaint.setTransition(o.slice(0,-11),h||void 0),!1;{const y=this._transitionablePaint._values[o],v=y.property.specification["property-type"]==="cross-faded-data-driven",w=y.value.isDataDriven(),C=y.value;this._transitionablePaint.setValue(o,h),this._handleSpecialPaintPropertyUpdate(o);const A=this._transitionablePaint._values[o].value;return A.isDataDriven()||w||v||this._handleOverridablePaintPropertyUpdate(o,C,A)}}_handleSpecialPaintPropertyUpdate(o){}_handleOverridablePaintPropertyUpdate(o,h,p){return!1}isHidden(o){return!!(this.minzoom&&o<this.minzoom)||!!(this.maxzoom&&o>=this.maxzoom)||this.visibility==="none"}updateTransitions(o){this._transitioningPaint=this._transitionablePaint.transitioned(o,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(o,h){o.getCrossfadeParameters&&(this._crossfadeParameters=o.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(o,void 0,h)),this.paint=this._transitioningPaint.possiblyEvaluate(o,void 0,h)}serialize(){const o={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&&(o.layout=o.layout||{},o.layout.visibility=this.visibility),Ye(o,(h,p)=>!(h===void 0||p==="layout"&&!Object.keys(h).length||p==="paint"&&!Object.keys(h).length))}_validate(o,h,p,y,v={}){return(!v||v.validate!==!1)&&Ad(this,o.call(Ko,{key:h,layerType:this.type,objectKey:p,value:y,styleSpec:we,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const o in this.paint._values){const h=this.paint.get(o);if(h instanceof Ps&&Na(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}return!1}}const f={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class m{constructor(o,h){this._structArray=o,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class b{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(o,h){return o._trim(),h&&(o.isTransferred=!0,h.push(o.arrayBuffer)),{length:o.length,arrayBuffer:o.arrayBuffer}}static deserialize(o){const h=Object.create(this.prototype);return h.arrayBuffer=o.arrayBuffer,h.length=o.length,h.capacity=o.arrayBuffer.byteLength/h.bytesPerElement,h._refreshViews(),h}_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(o){this.reserve(o),this.length=o}reserve(o){if(o>this.capacity){this.capacity=Math.max(o,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function M(c,o=1){let h=0,p=0;return{members:c.map(y=>{const v=f[y.type].BYTES_PER_ELEMENT,w=h=P(h,Math.max(o,v)),C=y.components||1;return p=Math.max(p,v),h+=v*C,{name:y.name,type:y.type,components:C,offset:w}}),size:P(h,Math.max(p,o)),alignment:o}}function P(c,o){return Math.ceil(c/o)*o}class D extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.int16[y+0]=h,this.int16[y+1]=p,o}}D.prototype.bytesPerElement=4,ot("StructArrayLayout2i4",D);class L extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.int16[v+0]=h,this.int16[v+1]=p,this.int16[v+2]=y,o}}L.prototype.bytesPerElement=6,ot("StructArrayLayout3i6",L);class B extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const v=this.length;return this.resize(v+1),this.emplace(v,o,h,p,y)}emplace(o,h,p,y,v){const w=4*o;return this.int16[w+0]=h,this.int16[w+1]=p,this.int16[w+2]=y,this.int16[w+3]=v,o}}B.prototype.bytesPerElement=8,ot("StructArrayLayout4i8",B);class F extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=6*o;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=y,this.int16[A+3]=v,this.int16[A+4]=w,this.int16[A+5]=C,o}}F.prototype.bytesPerElement=12,ot("StructArrayLayout2i4i12",F);class W extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=4*o,O=8*o;return this.int16[A+0]=h,this.int16[A+1]=p,this.uint8[O+4]=y,this.uint8[O+5]=v,this.uint8[O+6]=w,this.uint8[O+7]=C,o}}W.prototype.bytesPerElement=8,ot("StructArrayLayout2i4ub8",W);class K extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.float32[y+0]=h,this.float32[y+1]=p,o}}K.prototype.bytesPerElement=8,ot("StructArrayLayout2f8",K);class Q extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w,C,A,O,R){const N=this.length;return this.resize(N+1),this.emplace(N,o,h,p,y,v,w,C,A,O,R)}emplace(o,h,p,y,v,w,C,A,O,R,N){const $=10*o;return this.uint16[$+0]=h,this.uint16[$+1]=p,this.uint16[$+2]=y,this.uint16[$+3]=v,this.uint16[$+4]=w,this.uint16[$+5]=C,this.uint16[$+6]=A,this.uint16[$+7]=O,this.uint16[$+8]=R,this.uint16[$+9]=N,o}}Q.prototype.bytesPerElement=20,ot("StructArrayLayout10ui20",Q);class re extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w,C,A,O,R,N,$){const q=this.length;return this.resize(q+1),this.emplace(q,o,h,p,y,v,w,C,A,O,R,N,$)}emplace(o,h,p,y,v,w,C,A,O,R,N,$,q){const G=12*o;return this.int16[G+0]=h,this.int16[G+1]=p,this.int16[G+2]=y,this.int16[G+3]=v,this.uint16[G+4]=w,this.uint16[G+5]=C,this.uint16[G+6]=A,this.uint16[G+7]=O,this.int16[G+8]=R,this.int16[G+9]=N,this.int16[G+10]=$,this.int16[G+11]=q,o}}re.prototype.bytesPerElement=24,ot("StructArrayLayout4i4ui4i24",re);class le extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.float32[v+0]=h,this.float32[v+1]=p,this.float32[v+2]=y,o}}le.prototype.bytesPerElement=12,ot("StructArrayLayout3f12",le);class ce extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint32[1*o+0]=h,o}}ce.prototype.bytesPerElement=4,ot("StructArrayLayout1ul4",ce);class he extends b{_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(o,h,p,y,v,w,C,A,O){const R=this.length;return this.resize(R+1),this.emplace(R,o,h,p,y,v,w,C,A,O)}emplace(o,h,p,y,v,w,C,A,O,R){const N=10*o,$=5*o;return this.int16[N+0]=h,this.int16[N+1]=p,this.int16[N+2]=y,this.int16[N+3]=v,this.int16[N+4]=w,this.int16[N+5]=C,this.uint32[$+3]=A,this.uint16[N+8]=O,this.uint16[N+9]=R,o}}he.prototype.bytesPerElement=20,ot("StructArrayLayout6i1ul2ui20",he);class te extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=6*o;return this.int16[A+0]=h,this.int16[A+1]=p,this.int16[A+2]=y,this.int16[A+3]=v,this.int16[A+4]=w,this.int16[A+5]=C,o}}te.prototype.bytesPerElement=12,ot("StructArrayLayout2i2i2i12",te);class me extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v){const w=this.length;return this.resize(w+1),this.emplace(w,o,h,p,y,v)}emplace(o,h,p,y,v,w){const C=4*o,A=8*o;return this.float32[C+0]=h,this.float32[C+1]=p,this.float32[C+2]=y,this.int16[A+6]=v,this.int16[A+7]=w,o}}me.prototype.bytesPerElement=16,ot("StructArrayLayout2f1f2i16",me);class ge extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(o,h,p,y,v,w){const C=this.length;return this.resize(C+1),this.emplace(C,o,h,p,y,v,w)}emplace(o,h,p,y,v,w,C){const A=16*o,O=4*o,R=8*o;return this.uint8[A+0]=h,this.uint8[A+1]=p,this.float32[O+1]=y,this.float32[O+2]=v,this.int16[R+6]=w,this.int16[R+7]=C,o}}ge.prototype.bytesPerElement=16,ot("StructArrayLayout2ub2f2i16",ge);class xe extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.uint16[v+0]=h,this.uint16[v+1]=p,this.uint16[v+2]=y,o}}xe.prototype.bytesPerElement=6,ot("StructArrayLayout3ui6",xe);class Oe extends b{_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(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae){const be=this.length;return this.resize(be+1),this.emplace(be,o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae)}emplace(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be){const pe=24*o,ye=12*o,Ee=48*o;return this.int16[pe+0]=h,this.int16[pe+1]=p,this.uint16[pe+2]=y,this.uint16[pe+3]=v,this.uint32[ye+2]=w,this.uint32[ye+3]=C,this.uint32[ye+4]=A,this.uint16[pe+10]=O,this.uint16[pe+11]=R,this.uint16[pe+12]=N,this.float32[ye+7]=$,this.float32[ye+8]=q,this.uint8[Ee+36]=G,this.uint8[Ee+37]=X,this.uint8[Ee+38]=ie,this.uint32[ye+10]=ae,this.int16[pe+22]=be,o}}Oe.prototype.bytesPerElement=48,ot("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",Oe);class Fe extends b{_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(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be,pe,ye,Ee,Ne,tt,St,Qe,Ze,mt,ct){const rt=this.length;return this.resize(rt+1),this.emplace(rt,o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be,pe,ye,Ee,Ne,tt,St,Qe,Ze,mt,ct)}emplace(o,h,p,y,v,w,C,A,O,R,N,$,q,G,X,ie,ae,be,pe,ye,Ee,Ne,tt,St,Qe,Ze,mt,ct,rt){const De=32*o,yt=16*o;return this.int16[De+0]=h,this.int16[De+1]=p,this.int16[De+2]=y,this.int16[De+3]=v,this.int16[De+4]=w,this.int16[De+5]=C,this.int16[De+6]=A,this.int16[De+7]=O,this.uint16[De+8]=R,this.uint16[De+9]=N,this.uint16[De+10]=$,this.uint16[De+11]=q,this.uint16[De+12]=G,this.uint16[De+13]=X,this.uint16[De+14]=ie,this.uint16[De+15]=ae,this.uint16[De+16]=be,this.uint16[De+17]=pe,this.uint16[De+18]=ye,this.uint16[De+19]=Ee,this.uint16[De+20]=Ne,this.uint16[De+21]=tt,this.uint16[De+22]=St,this.uint32[yt+12]=Qe,this.float32[yt+13]=Ze,this.float32[yt+14]=mt,this.uint16[De+30]=ct,this.uint16[De+31]=rt,o}}Fe.prototype.bytesPerElement=64,ot("StructArrayLayout8i15ui1ul2f2ui64",Fe);class Ke extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.float32[1*o+0]=h,o}}Ke.prototype.bytesPerElement=4,ot("StructArrayLayout1f4",Ke);class nt extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=3*o;return this.uint16[6*o+0]=h,this.float32[v+1]=p,this.float32[v+2]=y,o}}nt.prototype.bytesPerElement=12,ot("StructArrayLayout1ui2f12",nt);class We extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h,p){const y=this.length;return this.resize(y+1),this.emplace(y,o,h,p)}emplace(o,h,p,y){const v=4*o;return this.uint32[2*o+0]=h,this.uint16[v+2]=p,this.uint16[v+3]=y,o}}We.prototype.bytesPerElement=8,ot("StructArrayLayout1ul2ui8",We);class He extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o,h){const p=this.length;return this.resize(p+1),this.emplace(p,o,h)}emplace(o,h,p){const y=2*o;return this.uint16[y+0]=h,this.uint16[y+1]=p,o}}He.prototype.bytesPerElement=4,ot("StructArrayLayout2ui4",He);class pt extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(o){const h=this.length;return this.resize(h+1),this.emplace(h,o)}emplace(o,h){return this.uint16[1*o+0]=h,o}}pt.prototype.bytesPerElement=2,ot("StructArrayLayout1ui2",pt);class Ot extends b{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(o,h,p,y){const v=this.length;return this.resize(v+1),this.emplace(v,o,h,p,y)}emplace(o,h,p,y,v){const w=4*o;return this.float32[w+0]=h,this.float32[w+1]=p,this.float32[w+2]=y,this.float32[w+3]=v,o}}Ot.prototype.bytesPerElement=16,ot("StructArrayLayout4f16",Ot);class Ge extends m{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 E(this.anchorPointX,this.anchorPointY)}}Ge.prototype.size=20;class et extends he{get(o){return new Ge(this,o)}}ot("CollisionBoxArray",et);class Pt extends m{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(o){this._structArray.uint8[this._pos1+37]=o}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(o){this._structArray.uint8[this._pos1+38]=o}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(o){this._structArray.uint32[this._pos4+10]=o}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}Pt.prototype.size=48;class Nn extends Oe{get(o){return new Pt(this,o)}}ot("PlacedSymbolArray",Nn);class Ft extends m{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(o){this._structArray.uint32[this._pos4+12]=o}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]}}Ft.prototype.size=64;class Yt extends Fe{get(o){return new Ft(this,o)}}ot("SymbolInstanceArray",Yt);class Bn extends Ke{getoffsetX(o){return this.float32[1*o+0]}}ot("GlyphOffsetArray",Bn);class Ii extends L{getx(o){return this.int16[3*o+0]}gety(o){return this.int16[3*o+1]}gettileUnitDistanceFromAnchor(o){return this.int16[3*o+2]}}ot("SymbolLineVertexArray",Ii);class ns extends m{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]}}ns.prototype.size=12;class Fn extends nt{get(o){return new ns(this,o)}}ot("TextAnchorOffsetArray",Fn);class rr extends m{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]}}rr.prototype.size=8;class qi extends We{get(o){return new rr(this,o)}}ot("FeatureIndexArray",qi);class Di extends D{}class Wi extends D{}class Is extends D{}class Xa extends F{}class Iu extends W{}class Ka extends K{}class Fr extends Q{}class Du extends re{}class Nd extends le{}class Vr extends ce{}class $r extends te{}class po extends ge{}class is extends xe{}class ki extends He{}const Oi=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:br}=Oi;class Qt{constructor(o=[]){this.segments=o}prepareSegment(o,h,p,y){let v=this.segments[this.segments.length-1];return o>Qt.MAX_VERTEX_ARRAY_LENGTH&&ht(`Max vertices per segment is ${Qt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${o}`),(!v||v.vertexLength+o>Qt.MAX_VERTEX_ARRAY_LENGTH||v.sortKey!==y)&&(v={vertexOffset:h.length,primitiveOffset:p.length,vertexLength:0,primitiveLength:0},y!==void 0&&(v.sortKey=y),this.segments.push(v)),v}get(){return this.segments}destroy(){for(const o of this.segments)for(const h in o.vaos)o.vaos[h].destroy()}static simpleSegment(o,h,p,y){return new Qt([{vertexOffset:o,primitiveOffset:h,vertexLength:p,primitiveLength:y,vaos:{},sortKey:0}])}}function Jo(c,o){return 256*(c=Ae(Math.floor(c),0,255))+Ae(Math.floor(o),0,255)}Qt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ot("SegmentVector",Qt);const Ja=M([{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 Qa={exports:{}},Cm={exports:{}};Cm.exports=function(c,o){var h,p,y,v,w,C,A,O;for(p=c.length-(h=3&c.length),y=o,w=3432918353,C=461845907,O=0;O<p;)A=255&c.charCodeAt(O)|(255&c.charCodeAt(++O))<<8|(255&c.charCodeAt(++O))<<16|(255&c.charCodeAt(++O))<<24,++O,y=27492+(65535&(v=5*(65535&(y=(y^=A=(65535&(A=(A=(65535&A)*w+(((A>>>16)*w&65535)<<16)&4294967295)<<15|A>>>17))*C+(((A>>>16)*C&65535)<<16)&4294967295)<<13|y>>>19))+((5*(y>>>16)&65535)<<16)&4294967295))+((58964+(v>>>16)&65535)<<16);switch(A=0,h){case 3:A^=(255&c.charCodeAt(O+2))<<16;case 2:A^=(255&c.charCodeAt(O+1))<<8;case 1:y^=A=(65535&(A=(A=(65535&(A^=255&c.charCodeAt(O)))*w+(((A>>>16)*w&65535)<<16)&4294967295)<<15|A>>>17))*C+(((A>>>16)*C&65535)<<16)&4294967295}return y^=c.length,y=2246822507*(65535&(y^=y>>>16))+((2246822507*(y>>>16)&65535)<<16)&4294967295,y=3266489909*(65535&(y^=y>>>13))+((3266489909*(y>>>16)&65535)<<16)&4294967295,(y^=y>>>16)>>>0};var x_=Cm.exports,Tm={exports:{}};Tm.exports=function(c,o){for(var h,p=c.length,y=o^p,v=0;p>=4;)h=1540483477*(65535&(h=255&c.charCodeAt(v)|(255&c.charCodeAt(++v))<<8|(255&c.charCodeAt(++v))<<16|(255&c.charCodeAt(++v))<<24))+((1540483477*(h>>>16)&65535)<<16),y=1540483477*(65535&y)+((1540483477*(y>>>16)&65535)<<16)^(h=1540483477*(65535&(h^=h>>>24))+((1540483477*(h>>>16)&65535)<<16)),p-=4,++v;switch(p){case 3:y^=(255&c.charCodeAt(v+2))<<16;case 2:y^=(255&c.charCodeAt(v+1))<<8;case 1:y=1540483477*(65535&(y^=255&c.charCodeAt(v)))+((1540483477*(y>>>16)&65535)<<16)}return y=1540483477*(65535&(y^=y>>>13))+((1540483477*(y>>>16)&65535)<<16),(y^=y>>>15)>>>0};var fo=x_,Mm=Tm.exports;Qa.exports=fo,Qa.exports.murmur3=fo,Qa.exports.murmur2=Mm;var Ou=g(Qa.exports);class tc{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(o,h,p,y){this.ids.push(zu(o)),this.positions.push(h,p,y)}getPositions(o){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const h=zu(o);let p=0,y=this.ids.length-1;for(;p<y;){const w=p+y>>1;this.ids[w]>=h?y=w:p=w+1}const v=[];for(;this.ids[p]===h;)v.push({index:this.positions[3*p],start:this.positions[3*p+1],end:this.positions[3*p+2]}),p++;return v}static serialize(o,h){const p=new Float64Array(o.ids),y=new Uint32Array(o.positions);return Ru(p,y,0,p.length-1),h&&h.push(p.buffer,y.buffer),{ids:p,positions:y}}static deserialize(o){const h=new tc;return h.ids=o.ids,h.positions=o.positions,h.indexed=!0,h}}function zu(c){const o=+c;return!isNaN(o)&&o<=Number.MAX_SAFE_INTEGER?o:Ou(String(c))}function Ru(c,o,h,p){for(;h<p;){const y=c[h+p>>1];let v=h-1,w=p+1;for(;;){do v++;while(c[v]<y);do w--;while(c[w]>y);if(v>=w)break;el(c,v,w),el(o,3*v,3*w),el(o,3*v+1,3*w+1),el(o,3*v+2,3*w+2)}w-h<p-w?(Ru(c,o,h,w),h=w+1):(Ru(c,o,w+1,p),p=w)}}function el(c,o,h){const p=c[o];c[o]=c[h],c[h]=p}ot("FeaturePositionMap",tc);class nc{constructor(o,h){this.gl=o.gl,this.location=h}}class Am extends nc{constructor(o,h){super(o,h),this.current=0}set(o){this.current!==o&&(this.current=o,this.gl.uniform1f(this.location,o))}}class pS extends nc{constructor(o,h){super(o,h),this.current=[0,0,0,0]}set(o){o[0]===this.current[0]&&o[1]===this.current[1]&&o[2]===this.current[2]&&o[3]===this.current[3]||(this.current=o,this.gl.uniform4f(this.location,o[0],o[1],o[2],o[3]))}}class fS extends nc{constructor(o,h){super(o,h),this.current=vn.transparent}set(o){o.r===this.current.r&&o.g===this.current.g&&o.b===this.current.b&&o.a===this.current.a||(this.current=o,this.gl.uniform4f(this.location,o.r,o.g,o.b,o.a))}}const w7=new Float32Array(16);function v_(c){return[Jo(255*c.r,255*c.g),Jo(255*c.b,255*c.a)]}class Bd{constructor(o,h,p){this.value=o,this.uniformNames=h.map(y=>`u_${y}`),this.type=p}setUniform(o,h,p){o.set(p.constantOr(this.value))}getBinding(o,h,p){return this.type==="color"?new fS(o,h):new Am(o,h)}}class Lu{constructor(o,h){this.uniformNames=h.map(p=>`u_${p}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(o,h){this.pixelRatioFrom=h.pixelRatio,this.pixelRatioTo=o.pixelRatio,this.patternFrom=h.tlbr,this.patternTo=o.tlbr}setUniform(o,h,p,y){const v=y==="u_pattern_to"?this.patternTo:y==="u_pattern_from"?this.patternFrom:y==="u_pixel_ratio_to"?this.pixelRatioTo:y==="u_pixel_ratio_from"?this.pixelRatioFrom:null;v&&o.set(v)}getBinding(o,h,p){return p.substr(0,9)==="u_pattern"?new pS(o,h):new Am(o,h)}}class Qo{constructor(o,h,p,y){this.expression=o,this.type=p,this.maxValue=0,this.paintVertexAttributes=h.map(v=>({name:`a_${v}`,type:"Float32",components:p==="color"?2:1,offset:0})),this.paintVertexArray=new y}populatePaintArray(o,h,p,y,v){const w=this.paintVertexArray.length,C=this.expression.evaluate(new Ln(0),h,{},y,[],v);this.paintVertexArray.resize(o),this._setPaintValue(w,o,C)}updatePaintArray(o,h,p,y){const v=this.expression.evaluate({zoom:0},p,y);this._setPaintValue(o,h,v)}_setPaintValue(o,h,p){if(this.type==="color"){const y=v_(p);for(let v=o;v<h;v++)this.paintVertexArray.emplace(v,y[0],y[1])}else{for(let y=o;y<h;y++)this.paintVertexArray.emplace(y,p);this.maxValue=Math.max(this.maxValue,Math.abs(p))}}upload(o){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=o.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Ws{constructor(o,h,p,y,v,w){this.expression=o,this.uniformNames=h.map(C=>`u_${C}_t`),this.type=p,this.useIntegerZoom=y,this.zoom=v,this.maxValue=0,this.paintVertexAttributes=h.map(C=>({name:`a_${C}`,type:"Float32",components:p==="color"?4:2,offset:0})),this.paintVertexArray=new w}populatePaintArray(o,h,p,y,v){const w=this.expression.evaluate(new Ln(this.zoom),h,{},y,[],v),C=this.expression.evaluate(new Ln(this.zoom+1),h,{},y,[],v),A=this.paintVertexArray.length;this.paintVertexArray.resize(o),this._setPaintValue(A,o,w,C)}updatePaintArray(o,h,p,y){const v=this.expression.evaluate({zoom:this.zoom},p,y),w=this.expression.evaluate({zoom:this.zoom+1},p,y);this._setPaintValue(o,h,v,w)}_setPaintValue(o,h,p,y){if(this.type==="color"){const v=v_(p),w=v_(y);for(let C=o;C<h;C++)this.paintVertexArray.emplace(C,v[0],v[1],w[0],w[1])}else{for(let v=o;v<h;v++)this.paintVertexArray.emplace(v,p,y);this.maxValue=Math.max(this.maxValue,Math.abs(p),Math.abs(y))}}upload(o){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=o.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(o,h){const p=this.useIntegerZoom?Math.floor(h.zoom):h.zoom,y=Ae(this.expression.interpolationFactor(p,this.zoom,this.zoom+1),0,1);o.set(y)}getBinding(o,h,p){return new Am(o,h)}}class tl{constructor(o,h,p,y,v,w){this.expression=o,this.type=h,this.useIntegerZoom=p,this.zoom=y,this.layerId=w,this.zoomInPaintVertexArray=new v,this.zoomOutPaintVertexArray=new v}populatePaintArray(o,h,p){const y=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(o),this.zoomOutPaintVertexArray.resize(o),this._setPaintValues(y,o,h.patterns&&h.patterns[this.layerId],p)}updatePaintArray(o,h,p,y,v){this._setPaintValues(o,h,p.patterns&&p.patterns[this.layerId],v)}_setPaintValues(o,h,p,y){if(!y||!p)return;const{min:v,mid:w,max:C}=p,A=y[v],O=y[w],R=y[C];if(A&&O&&R)for(let N=o;N<h;N++)this.zoomInPaintVertexArray.emplace(N,O.tl[0],O.tl[1],O.br[0],O.br[1],A.tl[0],A.tl[1],A.br[0],A.br[1],O.pixelRatio,A.pixelRatio),this.zoomOutPaintVertexArray.emplace(N,O.tl[0],O.tl[1],O.br[0],O.br[1],R.tl[0],R.tl[1],R.br[0],R.br[1],O.pixelRatio,R.pixelRatio)}upload(o){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=o.createVertexBuffer(this.zoomInPaintVertexArray,Ja.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=o.createVertexBuffer(this.zoomOutPaintVertexArray,Ja.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class mS{constructor(o,h,p){this.binders={},this._buffers=[];const y=[];for(const v in o.paint._values){if(!p(v))continue;const w=o.paint.get(v);if(!(w instanceof Ps&&Na(w.property.specification)))continue;const C=k7(v,o.type),A=w.value,O=w.property.specification.type,R=w.property.useIntegerZoom,N=w.property.specification["property-type"],$=N==="cross-faded"||N==="cross-faded-data-driven";if(A.kind==="constant")this.binders[v]=$?new Lu(A.value,C):new Bd(A.value,C,O),y.push(`/u_${v}`);else if(A.kind==="source"||$){const q=gS(v,O,"source");this.binders[v]=$?new tl(A,O,R,h,q,o.id):new Qo(A,C,O,q),y.push(`/a_${v}`)}else{const q=gS(v,O,"composite");this.binders[v]=new Ws(A,C,O,R,h,q),y.push(`/z_${v}`)}}this.cacheKey=y.sort().join("")}getMaxValue(o){const h=this.binders[o];return h instanceof Qo||h instanceof Ws?h.maxValue:0}populatePaintArrays(o,h,p,y,v){for(const w in this.binders){const C=this.binders[w];(C instanceof Qo||C instanceof Ws||C instanceof tl)&&C.populatePaintArray(o,h,p,y,v)}}setConstantPatternPositions(o,h){for(const p in this.binders){const y=this.binders[p];y instanceof Lu&&y.setConstantPatternPositions(o,h)}}updatePaintArrays(o,h,p,y,v){let w=!1;for(const C in o){const A=h.getPositions(C);for(const O of A){const R=p.feature(O.index);for(const N in this.binders){const $=this.binders[N];if(($ instanceof Qo||$ instanceof Ws||$ instanceof tl)&&$.expression.isStateDependent===!0){const q=y.paint.get(N);$.expression=q.value,$.updatePaintArray(O.start,O.end,R,o[C],v),w=!0}}}}return w}defines(){const o=[];for(const h in this.binders){const p=this.binders[h];(p instanceof Bd||p instanceof Lu)&&o.push(...p.uniformNames.map(y=>`#define HAS_UNIFORM_${y}`))}return o}getBinderAttributes(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Qo||p instanceof Ws)for(let y=0;y<p.paintVertexAttributes.length;y++)o.push(p.paintVertexAttributes[y].name);else if(p instanceof tl)for(let y=0;y<Ja.members.length;y++)o.push(Ja.members[y].name)}return o}getBinderUniforms(){const o=[];for(const h in this.binders){const p=this.binders[h];if(p instanceof Bd||p instanceof Lu||p instanceof Ws)for(const y of p.uniformNames)o.push(y)}return o}getPaintVertexBuffers(){return this._buffers}getUniforms(o,h){const p=[];for(const y in this.binders){const v=this.binders[y];if(v instanceof Bd||v instanceof Lu||v instanceof Ws){for(const w of v.uniformNames)if(h[w]){const C=v.getBinding(o,h[w],w);p.push({name:w,property:y,binding:C})}}}return p}setUniforms(o,h,p,y){for(const{name:v,property:w,binding:C}of h)this.binders[w].setUniform(C,y,p.get(w),v)}updatePaintBuffers(o){this._buffers=[];for(const h in this.binders){const p=this.binders[h];if(o&&p instanceof tl){const y=o.fromScale===2?p.zoomInPaintVertexBuffer:p.zoomOutPaintVertexBuffer;y&&this._buffers.push(y)}else(p instanceof Qo||p instanceof Ws)&&p.paintVertexBuffer&&this._buffers.push(p.paintVertexBuffer)}}upload(o){for(const h in this.binders){const p=this.binders[h];(p instanceof Qo||p instanceof Ws||p instanceof tl)&&p.upload(o)}this.updatePaintBuffers()}destroy(){for(const o in this.binders){const h=this.binders[o];(h instanceof Qo||h instanceof Ws||h instanceof tl)&&h.destroy()}}}class ic{constructor(o,h,p=()=>!0){this.programConfigurations={};for(const y of o)this.programConfigurations[y.id]=new mS(y,h,p);this.needsUpload=!1,this._featureMap=new tc,this._bufferOffset=0}populatePaintArrays(o,h,p,y,v,w){for(const C in this.programConfigurations)this.programConfigurations[C].populatePaintArrays(o,h,y,v,w);h.id!==void 0&&this._featureMap.add(h.id,p,this._bufferOffset,o),this._bufferOffset=o,this.needsUpload=!0}updatePaintArrays(o,h,p,y){for(const v of p)this.needsUpload=this.programConfigurations[v.id].updatePaintArrays(o,this._featureMap,h,v,y)||this.needsUpload}get(o){return this.programConfigurations[o]}upload(o){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(o);this.needsUpload=!1}}destroy(){for(const o in this.programConfigurations)this.programConfigurations[o].destroy()}}function k7(c,o){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"]}[c]||[c.replace(`${o}-`,"").replace(/-/g,"_")]}function gS(c,o,h){const p={color:{source:K,composite:Ot},number:{source:Ke,composite:K}},y=function(v){return{"line-pattern":{source:Fr,composite:Fr},"fill-pattern":{source:Fr,composite:Fr},"fill-extrusion-pattern":{source:Fr,composite:Fr}}[v]}(c);return y&&y[h]||p[o][h]}ot("ConstantBinder",Bd),ot("CrossFadedConstantBinder",Lu),ot("SourceExpressionBinder",Qo),ot("CrossFadedCompositeBinder",tl),ot("CompositeExpressionBinder",Ws),ot("ProgramConfiguration",mS,{omit:["_buffers"]}),ot("ProgramConfigurationSet",ic);const oi=8192,w_=Math.pow(2,14)-1,yS=-w_-1;function rc(c){const o=oi/c.extent,h=c.loadGeometry();for(let p=0;p<h.length;p++){const y=h[p];for(let v=0;v<y.length;v++){const w=y[v],C=Math.round(w.x*o),A=Math.round(w.y*o);w.x=Ae(C,yS,w_),w.y=Ae(A,yS,w_),(C<w.x||C>w.x+1||A<w.y||A>w.y+1)&&ht("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return h}function sc(c,o){return{type:c.type,id:c.id,properties:c.properties,geometry:o?rc(c):[]}}function Pm(c,o,h,p,y){c.emplaceBack(2*o+(p+1)/2,2*h+(y+1)/2)}class k_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Wi,this.indexArray=new is,this.segments=new Qt,this.programConfigurations=new ic(o.layers,o.zoom),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){const y=this.layers[0],v=[];let w=null,C=!1;y.type==="circle"&&(w=y.layout.get("circle-sort-key"),C=!w.isConstant());for(const{feature:A,id:O,index:R,sourceLayerIndex:N}of o){const $=this.layers[0]._featureFilter.needGeometry,q=sc(A,$);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),q,p))continue;const G=C?w.evaluate(q,{},p):void 0,X={id:O,properties:A.properties,type:A.type,sourceLayerIndex:N,index:R,geometry:$?q.geometry:rc(A),patterns:{},sortKey:G};v.push(X)}C&&v.sort((A,O)=>A.sortKey-O.sortKey);for(const A of v){const{geometry:O,index:R,sourceLayerIndex:N}=A,$=o[R].feature;this.addFeature(A,O,R,p),h.featureIndex.insert($,O,R,N,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,br),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(o,h,p,y){for(const v of h)for(const w of v){const C=w.x,A=w.y;if(C<0||C>=oi||A<0||A>=oi)continue;const O=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,o.sortKey),R=O.vertexLength;Pm(this.layoutVertexArray,C,A,-1,-1),Pm(this.layoutVertexArray,C,A,1,-1),Pm(this.layoutVertexArray,C,A,1,1),Pm(this.layoutVertexArray,C,A,-1,1),this.indexArray.emplaceBack(R,R+1,R+2),this.indexArray.emplaceBack(R,R+3,R+2),O.vertexLength+=4,O.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,{},y)}}function _S(c,o){for(let h=0;h<c.length;h++)if(Nu(o,c[h]))return!0;for(let h=0;h<o.length;h++)if(Nu(c,o[h]))return!0;return!!S_(c,o)}function S7(c,o,h){return!!Nu(c,o)||!!E_(o,c,h)}function bS(c,o){if(c.length===1)return vS(o,c[0]);for(let h=0;h<o.length;h++){const p=o[h];for(let y=0;y<p.length;y++)if(Nu(c,p[y]))return!0}for(let h=0;h<c.length;h++)if(vS(o,c[h]))return!0;for(let h=0;h<o.length;h++)if(S_(c,o[h]))return!0;return!1}function E7(c,o,h){if(c.length>1){if(S_(c,o))return!0;for(let p=0;p<o.length;p++)if(E_(o[p],c,h))return!0}for(let p=0;p<c.length;p++)if(E_(c[p],o,h))return!0;return!1}function S_(c,o){if(c.length===0||o.length===0)return!1;for(let h=0;h<c.length-1;h++){const p=c[h],y=c[h+1];for(let v=0;v<o.length-1;v++)if(C7(p,y,o[v],o[v+1]))return!0}return!1}function C7(c,o,h,p){return Rt(c,h,p)!==Rt(o,h,p)&&Rt(c,o,h)!==Rt(c,o,p)}function E_(c,o,h){const p=h*h;if(o.length===1)return c.distSqr(o[0])<p;for(let y=1;y<o.length;y++)if(xS(c,o[y-1],o[y])<p)return!0;return!1}function xS(c,o,h){const p=o.distSqr(h);if(p===0)return c.distSqr(o);const y=((c.x-o.x)*(h.x-o.x)+(c.y-o.y)*(h.y-o.y))/p;return c.distSqr(y<0?o:y>1?h:h.sub(o)._mult(y)._add(o))}function vS(c,o){let h,p,y,v=!1;for(let w=0;w<c.length;w++){h=c[w];for(let C=0,A=h.length-1;C<h.length;A=C++)p=h[C],y=h[A],p.y>o.y!=y.y>o.y&&o.x<(y.x-p.x)*(o.y-p.y)/(y.y-p.y)+p.x&&(v=!v)}return v}function Nu(c,o){let h=!1;for(let p=0,y=c.length-1;p<c.length;y=p++){const v=c[p],w=c[y];v.y>o.y!=w.y>o.y&&o.x<(w.x-v.x)*(o.y-v.y)/(w.y-v.y)+v.x&&(h=!h)}return h}function T7(c,o,h){const p=h[0],y=h[2];if(c.x<p.x&&o.x<p.x||c.x>y.x&&o.x>y.x||c.y<p.y&&o.y<p.y||c.y>y.y&&o.y>y.y)return!1;const v=Rt(c,o,h[0]);return v!==Rt(c,o,h[1])||v!==Rt(c,o,h[2])||v!==Rt(c,o,h[3])}function Fd(c,o,h){const p=o.paint.get(c).value;return p.kind==="constant"?p.value:h.programConfigurations.get(o.id).getMaxValue(c)}function Im(c){return Math.sqrt(c[0]*c[0]+c[1]*c[1])}function Dm(c,o,h,p,y){if(!o[0]&&!o[1])return c;const v=E.convert(o)._mult(y);h==="viewport"&&v._rotate(-p);const w=[];for(let C=0;C<c.length;C++)w.push(c[C].sub(v));return w}let wS,kS;ot("CircleBucket",k_,{omit:["layers"]});var M7={get paint(){return kS=kS||new x({"circle-radius":new Et(we.paint_circle["circle-radius"]),"circle-color":new Et(we.paint_circle["circle-color"]),"circle-blur":new Et(we.paint_circle["circle-blur"]),"circle-opacity":new Et(we.paint_circle["circle-opacity"]),"circle-translate":new dt(we.paint_circle["circle-translate"]),"circle-translate-anchor":new dt(we.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new dt(we.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new dt(we.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new Et(we.paint_circle["circle-stroke-width"]),"circle-stroke-color":new Et(we.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new Et(we.paint_circle["circle-stroke-opacity"])})},get layout(){return wS=wS||new x({"circle-sort-key":new Et(we.layout_circle["circle-sort-key"])})}},sr=1e-6,Bu=typeof Float32Array<"u"?Float32Array:Array;function C_(c){return c[0]=1,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=1,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=1,c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c}function SS(c,o,h){var p=o[0],y=o[1],v=o[2],w=o[3],C=o[4],A=o[5],O=o[6],R=o[7],N=o[8],$=o[9],q=o[10],G=o[11],X=o[12],ie=o[13],ae=o[14],be=o[15],pe=h[0],ye=h[1],Ee=h[2],Ne=h[3];return c[0]=pe*p+ye*C+Ee*N+Ne*X,c[1]=pe*y+ye*A+Ee*$+Ne*ie,c[2]=pe*v+ye*O+Ee*q+Ne*ae,c[3]=pe*w+ye*R+Ee*G+Ne*be,c[4]=(pe=h[4])*p+(ye=h[5])*C+(Ee=h[6])*N+(Ne=h[7])*X,c[5]=pe*y+ye*A+Ee*$+Ne*ie,c[6]=pe*v+ye*O+Ee*q+Ne*ae,c[7]=pe*w+ye*R+Ee*G+Ne*be,c[8]=(pe=h[8])*p+(ye=h[9])*C+(Ee=h[10])*N+(Ne=h[11])*X,c[9]=pe*y+ye*A+Ee*$+Ne*ie,c[10]=pe*v+ye*O+Ee*q+Ne*ae,c[11]=pe*w+ye*R+Ee*G+Ne*be,c[12]=(pe=h[12])*p+(ye=h[13])*C+(Ee=h[14])*N+(Ne=h[15])*X,c[13]=pe*y+ye*A+Ee*$+Ne*ie,c[14]=pe*v+ye*O+Ee*q+Ne*ae,c[15]=pe*w+ye*R+Ee*G+Ne*be,c}Math.hypot||(Math.hypot=function(){for(var c=0,o=arguments.length;o--;)c+=arguments[o]*arguments[o];return Math.sqrt(c)});var Vd,A7=SS;function Om(c,o,h){var p=o[0],y=o[1],v=o[2],w=o[3];return c[0]=h[0]*p+h[4]*y+h[8]*v+h[12]*w,c[1]=h[1]*p+h[5]*y+h[9]*v+h[13]*w,c[2]=h[2]*p+h[6]*y+h[10]*v+h[14]*w,c[3]=h[3]*p+h[7]*y+h[11]*v+h[15]*w,c}Vd=new Bu(4),Bu!=Float32Array&&(Vd[0]=0,Vd[1]=0,Vd[2]=0,Vd[3]=0);class P7 extends d{constructor(o){super(o,M7)}createBucket(o){return new k_(o)}queryRadius(o){const h=o;return Fd("circle-radius",this,h)+Fd("circle-stroke-width",this,h)+Im(this.paint.get("circle-translate"))}queryIntersectsFeature(o,h,p,y,v,w,C,A){const O=Dm(o,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),w.angle,C),R=this.paint.get("circle-radius").evaluate(h,p)+this.paint.get("circle-stroke-width").evaluate(h,p),N=this.paint.get("circle-pitch-alignment")==="map",$=N?O:function(G,X){return G.map(ie=>ES(ie,X))}(O,A),q=N?R*C:R;for(const G of y)for(const X of G){const ie=N?X:ES(X,A);let ae=q;const be=Om([],[X.x,X.y,0,1],A);if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?ae*=be[3]/w.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(ae*=w.cameraToCenterDistance/be[3]),S7($,ie,ae))return!0}return!1}}function ES(c,o){const h=Om([],[c.x,c.y,0,1],o);return new E(h[0]/h[3],h[1]/h[3])}class CS extends k_{}let TS;ot("HeatmapBucket",CS,{omit:["layers"]});var I7={get paint(){return TS=TS||new x({"heatmap-radius":new Et(we.paint_heatmap["heatmap-radius"]),"heatmap-weight":new Et(we.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new dt(we.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Ld(we.paint_heatmap["heatmap-color"]),"heatmap-opacity":new dt(we.paint_heatmap["heatmap-opacity"])})}};function T_(c,{width:o,height:h},p,y){if(y){if(y instanceof Uint8ClampedArray)y=new Uint8Array(y.buffer);else if(y.length!==o*h*p)throw new RangeError(`mismatched image size. expected: ${y.length} but got: ${o*h*p}`)}else y=new Uint8Array(o*h*p);return c.width=o,c.height=h,c.data=y,c}function MS(c,{width:o,height:h},p){if(o===c.width&&h===c.height)return;const y=T_({},{width:o,height:h},p);M_(c,y,{x:0,y:0},{x:0,y:0},{width:Math.min(c.width,o),height:Math.min(c.height,h)},p),c.width=o,c.height=h,c.data=y.data}function M_(c,o,h,p,y,v){if(y.width===0||y.height===0)return o;if(y.width>c.width||y.height>c.height||h.x>c.width-y.width||h.y>c.height-y.height)throw new RangeError("out of range source coordinates for image copy");if(y.width>o.width||y.height>o.height||p.x>o.width-y.width||p.y>o.height-y.height)throw new RangeError("out of range destination coordinates for image copy");const w=c.data,C=o.data;if(w===C)throw new Error("srcData equals dstData, so image is already copied");for(let A=0;A<y.height;A++){const O=((h.y+A)*c.width+h.x)*v,R=((p.y+A)*o.width+p.x)*v;for(let N=0;N<y.width*v;N++)C[R+N]=w[O+N]}return o}class $d{constructor(o,h){T_(this,o,1,h)}resize(o){MS(this,o,1)}clone(){return new $d({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,y,v){M_(o,h,p,y,v,1)}}class rs{constructor(o,h){T_(this,o,4,h)}resize(o){MS(this,o,4)}replace(o,h){h?this.data.set(o):this.data=o instanceof Uint8ClampedArray?new Uint8Array(o.buffer):o}clone(){return new rs({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(o,h,p,y,v){M_(o,h,p,y,v,4)}}function AS(c){const o={},h=c.resolution||256,p=c.clips?c.clips.length:1,y=c.image||new rs({width:h,height:p});if(Math.log(h)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${h}`);const v=(w,C,A)=>{o[c.evaluationKey]=A;const O=c.expression.evaluate(o);y.data[w+C+0]=Math.floor(255*O.r/O.a),y.data[w+C+1]=Math.floor(255*O.g/O.a),y.data[w+C+2]=Math.floor(255*O.b/O.a),y.data[w+C+3]=Math.floor(255*O.a)};if(c.clips)for(let w=0,C=0;w<p;++w,C+=4*h)for(let A=0,O=0;A<h;A++,O+=4){const R=A/(h-1),{start:N,end:$}=c.clips[w];v(C,O,N*(1-R)+$*R)}else for(let w=0,C=0;w<h;w++,C+=4)v(0,C,w/(h-1));return y}ot("AlphaImage",$d),ot("RGBAImage",rs);const A_="big-fb";class D7 extends d{createBucket(o){return new CS(o)}constructor(o){super(o,I7),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(o){o==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=AS({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(A_)&&this.heatmapFbos.delete(A_)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let PS;var O7={get paint(){return PS=PS||new x({"hillshade-illumination-direction":new dt(we.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new dt(we.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new dt(we.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new dt(we.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new dt(we.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new dt(we.paint_hillshade["hillshade-accent-color"])})}};class z7 extends d{constructor(o){super(o,O7)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const R7=M([{name:"a_pos",components:2,type:"Int16"}],4),{members:L7}=R7;function IS(c,o,h=2){const p=o&&o.length,y=p?o[0]*h:c.length;let v=DS(c,0,y,h,!0);const w=[];if(!v||v.next===v.prev)return w;let C,A,O;if(p&&(v=function(R,N,$,q){const G=[];for(let X=0,ie=N.length;X<ie;X++){const ae=DS(R,N[X]*q,X<ie-1?N[X+1]*q:R.length,q,!1);ae===ae.next&&(ae.steiner=!0),G.push(H7(ae))}G.sort($7);for(let X=0;X<G.length;X++)$=j7(G[X],$);return $}(c,o,v,h)),c.length>80*h){C=1/0,A=1/0;let R=-1/0,N=-1/0;for(let $=h;$<y;$+=h){const q=c[$],G=c[$+1];q<C&&(C=q),G<A&&(A=G),q>R&&(R=q),G>N&&(N=G)}O=Math.max(R-C,N-A),O=O!==0?32767/O:0}return jd(v,w,h,C,A,O,0),w}function DS(c,o,h,p,y){let v;if(y===function(w,C,A,O){let R=0;for(let N=C,$=A-O;N<A;N+=O)R+=(w[$]-w[N])*(w[N+1]+w[$+1]),$=N;return R}(c,o,h,p)>0)for(let w=o;w<h;w+=p)v=RS(w/p|0,c[w],c[w+1],v);else for(let w=h-p;w>=o;w-=p)v=RS(w/p|0,c[w],c[w+1],v);return v&&zm(v,v.next)&&(Hd(v),v=v.next),v}function oc(c,o){if(!c)return c;o||(o=c);let h,p=c;do if(h=!1,p.steiner||!zm(p,p.next)&&ni(p.prev,p,p.next)!==0)p=p.next;else{if(Hd(p),p=o=p.prev,p===p.next)break;h=!0}while(h||p!==o);return o}function jd(c,o,h,p,y,v,w){if(!c)return;!w&&v&&function(A,O,R,N){let $=A;do $.z===0&&($.z=P_($.x,$.y,O,R,N)),$.prevZ=$.prev,$.nextZ=$.next,$=$.next;while($!==A);$.prevZ.nextZ=null,$.prevZ=null,function(q){let G,X=1;do{let ie,ae=q;q=null;let be=null;for(G=0;ae;){G++;let pe=ae,ye=0;for(let Ne=0;Ne<X&&(ye++,pe=pe.nextZ,pe);Ne++);let Ee=X;for(;ye>0||Ee>0&&pe;)ye!==0&&(Ee===0||!pe||ae.z<=pe.z)?(ie=ae,ae=ae.nextZ,ye--):(ie=pe,pe=pe.nextZ,Ee--),be?be.nextZ=ie:q=ie,ie.prevZ=be,be=ie;ae=pe}be.nextZ=null,X*=2}while(G>1)}($)}(c,p,y,v);let C=c;for(;c.prev!==c.next;){const A=c.prev,O=c.next;if(v?B7(c,p,y,v):N7(c))o.push(A.i,c.i,O.i),Hd(c),c=O.next,C=O.next;else if((c=O)===C){w?w===1?jd(c=F7(oc(c),o),o,h,p,y,v,2):w===2&&V7(c,o,h,p,y,v):jd(oc(c),o,h,p,y,v,1);break}}}function N7(c){const o=c.prev,h=c,p=c.next;if(ni(o,h,p)>=0)return!1;const y=o.x,v=h.x,w=p.x,C=o.y,A=h.y,O=p.y,R=y<v?y<w?y:w:v<w?v:w,N=C<A?C<O?C:O:A<O?A:O,$=y>v?y>w?y:w:v>w?v:w,q=C>A?C>O?C:O:A>O?A:O;let G=p.next;for(;G!==o;){if(G.x>=R&&G.x<=$&&G.y>=N&&G.y<=q&&Fu(y,C,v,A,w,O,G.x,G.y)&&ni(G.prev,G,G.next)>=0)return!1;G=G.next}return!0}function B7(c,o,h,p){const y=c.prev,v=c,w=c.next;if(ni(y,v,w)>=0)return!1;const C=y.x,A=v.x,O=w.x,R=y.y,N=v.y,$=w.y,q=C<A?C<O?C:O:A<O?A:O,G=R<N?R<$?R:$:N<$?N:$,X=C>A?C>O?C:O:A>O?A:O,ie=R>N?R>$?R:$:N>$?N:$,ae=P_(q,G,o,h,p),be=P_(X,ie,o,h,p);let pe=c.prevZ,ye=c.nextZ;for(;pe&&pe.z>=ae&&ye&&ye.z<=be;){if(pe.x>=q&&pe.x<=X&&pe.y>=G&&pe.y<=ie&&pe!==y&&pe!==w&&Fu(C,R,A,N,O,$,pe.x,pe.y)&&ni(pe.prev,pe,pe.next)>=0||(pe=pe.prevZ,ye.x>=q&&ye.x<=X&&ye.y>=G&&ye.y<=ie&&ye!==y&&ye!==w&&Fu(C,R,A,N,O,$,ye.x,ye.y)&&ni(ye.prev,ye,ye.next)>=0))return!1;ye=ye.nextZ}for(;pe&&pe.z>=ae;){if(pe.x>=q&&pe.x<=X&&pe.y>=G&&pe.y<=ie&&pe!==y&&pe!==w&&Fu(C,R,A,N,O,$,pe.x,pe.y)&&ni(pe.prev,pe,pe.next)>=0)return!1;pe=pe.prevZ}for(;ye&&ye.z<=be;){if(ye.x>=q&&ye.x<=X&&ye.y>=G&&ye.y<=ie&&ye!==y&&ye!==w&&Fu(C,R,A,N,O,$,ye.x,ye.y)&&ni(ye.prev,ye,ye.next)>=0)return!1;ye=ye.nextZ}return!0}function F7(c,o){let h=c;do{const p=h.prev,y=h.next.next;!zm(p,y)&&OS(p,h,h.next,y)&&Ud(p,y)&&Ud(y,p)&&(o.push(p.i,h.i,y.i),Hd(h),Hd(h.next),h=c=y),h=h.next}while(h!==c);return oc(h)}function V7(c,o,h,p,y,v){let w=c;do{let C=w.next.next;for(;C!==w.prev;){if(w.i!==C.i&&q7(w,C)){let A=zS(w,C);return w=oc(w,w.next),A=oc(A,A.next),jd(w,o,h,p,y,v,0),void jd(A,o,h,p,y,v,0)}C=C.next}w=w.next}while(w!==c)}function $7(c,o){return c.x-o.x}function j7(c,o){const h=function(y,v){let w=v;const C=y.x,A=y.y;let O,R=-1/0;do{if(A<=w.y&&A>=w.next.y&&w.next.y!==w.y){const X=w.x+(A-w.y)*(w.next.x-w.x)/(w.next.y-w.y);if(X<=C&&X>R&&(R=X,O=w.x<w.next.x?w:w.next,X===C))return O}w=w.next}while(w!==v);if(!O)return null;const N=O,$=O.x,q=O.y;let G=1/0;w=O;do{if(C>=w.x&&w.x>=$&&C!==w.x&&Fu(A<q?C:R,A,$,q,A<q?R:C,A,w.x,w.y)){const X=Math.abs(A-w.y)/(C-w.x);Ud(w,y)&&(X<G||X===G&&(w.x>O.x||w.x===O.x&&U7(O,w)))&&(O=w,G=X)}w=w.next}while(w!==N);return O}(c,o);if(!h)return o;const p=zS(h,c);return oc(p,p.next),oc(h,h.next)}function U7(c,o){return ni(c.prev,c,o.prev)<0&&ni(o.next,c,c.next)<0}function P_(c,o,h,p,y){return(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-h)*y|0)|c<<8))|c<<4))|c<<2))|c<<1))|(o=1431655765&((o=858993459&((o=252645135&((o=16711935&((o=(o-p)*y|0)|o<<8))|o<<4))|o<<2))|o<<1))<<1}function H7(c){let o=c,h=c;do(o.x<h.x||o.x===h.x&&o.y<h.y)&&(h=o),o=o.next;while(o!==c);return h}function Fu(c,o,h,p,y,v,w,C){return(y-w)*(o-C)>=(c-w)*(v-C)&&(c-w)*(p-C)>=(h-w)*(o-C)&&(h-w)*(v-C)>=(y-w)*(p-C)}function q7(c,o){return c.next.i!==o.i&&c.prev.i!==o.i&&!function(h,p){let y=h;do{if(y.i!==h.i&&y.next.i!==h.i&&y.i!==p.i&&y.next.i!==p.i&&OS(y,y.next,h,p))return!0;y=y.next}while(y!==h);return!1}(c,o)&&(Ud(c,o)&&Ud(o,c)&&function(h,p){let y=h,v=!1;const w=(h.x+p.x)/2,C=(h.y+p.y)/2;do y.y>C!=y.next.y>C&&y.next.y!==y.y&&w<(y.next.x-y.x)*(C-y.y)/(y.next.y-y.y)+y.x&&(v=!v),y=y.next;while(y!==h);return v}(c,o)&&(ni(c.prev,c,o.prev)||ni(c,o.prev,o))||zm(c,o)&&ni(c.prev,c,c.next)>0&&ni(o.prev,o,o.next)>0)}function ni(c,o,h){return(o.y-c.y)*(h.x-o.x)-(o.x-c.x)*(h.y-o.y)}function zm(c,o){return c.x===o.x&&c.y===o.y}function OS(c,o,h,p){const y=Lm(ni(c,o,h)),v=Lm(ni(c,o,p)),w=Lm(ni(h,p,c)),C=Lm(ni(h,p,o));return y!==v&&w!==C||!(y!==0||!Rm(c,h,o))||!(v!==0||!Rm(c,p,o))||!(w!==0||!Rm(h,c,p))||!(C!==0||!Rm(h,o,p))}function Rm(c,o,h){return o.x<=Math.max(c.x,h.x)&&o.x>=Math.min(c.x,h.x)&&o.y<=Math.max(c.y,h.y)&&o.y>=Math.min(c.y,h.y)}function Lm(c){return c>0?1:c<0?-1:0}function Ud(c,o){return ni(c.prev,c,c.next)<0?ni(c,o,c.next)>=0&&ni(c,c.prev,o)>=0:ni(c,o,c.prev)<0||ni(c,c.next,o)<0}function zS(c,o){const h=I_(c.i,c.x,c.y),p=I_(o.i,o.x,o.y),y=c.next,v=o.prev;return c.next=o,o.prev=c,h.next=y,y.prev=h,p.next=h,h.prev=p,v.next=p,p.prev=v,p}function RS(c,o,h,p){const y=I_(c,o,h);return p?(y.next=p.next,y.prev=p,p.next.prev=y,p.next=y):(y.prev=y,y.next=y),y}function Hd(c){c.next.prev=c.prev,c.prev.next=c.next,c.prevZ&&(c.prevZ.nextZ=c.nextZ),c.nextZ&&(c.nextZ.prevZ=c.prevZ)}function I_(c,o,h){return{i:c,x:o,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function D_(c,o,h){const p=h.patternDependencies;let y=!1;for(const v of o){const w=v.paint.get(`${c}-pattern`);w.isConstant()||(y=!0);const C=w.constantOr(null);C&&(y=!0,p[C.to]=!0,p[C.from]=!0)}return y}function O_(c,o,h,p,y){const v=y.patternDependencies;for(const w of o){const C=w.paint.get(`${c}-pattern`).value;if(C.kind!=="constant"){let A=C.evaluate({zoom:p-1},h,{},y.availableImages),O=C.evaluate({zoom:p},h,{},y.availableImages),R=C.evaluate({zoom:p+1},h,{},y.availableImages);A=A&&A.name?A.name:A,O=O&&O.name?O.name:O,R=R&&R.name?R.name:R,v[A]=!0,v[O]=!0,v[R]=!0,h.patterns[w.id]={min:A,mid:O,max:R}}}return h}class z_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new Is,this.indexArray=new is,this.indexArray2=new ki,this.programConfigurations=new ic(o.layers,o.zoom),this.segments=new Qt,this.segments2=new Qt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=D_("fill",this.layers,h);const y=this.layers[0].layout.get("fill-sort-key"),v=!y.isConstant(),w=[];for(const{feature:C,id:A,index:O,sourceLayerIndex:R}of o){const N=this.layers[0]._featureFilter.needGeometry,$=sc(C,N);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),$,p))continue;const q=v?y.evaluate($,{},p,h.availableImages):void 0,G={id:A,properties:C.properties,type:C.type,sourceLayerIndex:R,index:O,geometry:N?$.geometry:rc(C),patterns:{},sortKey:q};w.push(G)}v&&w.sort((C,A)=>C.sortKey-A.sortKey);for(const C of w){const{geometry:A,index:O,sourceLayerIndex:R}=C;if(this.hasPattern){const N=O_("fill",this.layers,C,this.zoom,h);this.patternFeatures.push(N)}else this.addFeature(C,A,O,p,{});h.featureIndex.insert(o[O].feature,A,O,R,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,L7),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.indexBuffer2=o.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(o),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(o,h,p,y,v){for(const w of cu(h,500)){let C=0;for(const q of w)C+=q.length;const A=this.segments.prepareSegment(C,this.layoutVertexArray,this.indexArray),O=A.vertexLength,R=[],N=[];for(const q of w){if(q.length===0)continue;q!==w[0]&&N.push(R.length/2);const G=this.segments2.prepareSegment(q.length,this.layoutVertexArray,this.indexArray2),X=G.vertexLength;this.layoutVertexArray.emplaceBack(q[0].x,q[0].y),this.indexArray2.emplaceBack(X+q.length-1,X),R.push(q[0].x),R.push(q[0].y);for(let ie=1;ie<q.length;ie++)this.layoutVertexArray.emplaceBack(q[ie].x,q[ie].y),this.indexArray2.emplaceBack(X+ie-1,X+ie),R.push(q[ie].x),R.push(q[ie].y);G.vertexLength+=q.length,G.primitiveLength+=q.length}const $=IS(R,N);for(let q=0;q<$.length;q+=3)this.indexArray.emplaceBack(O+$[q],O+$[q+1],O+$[q+2]);A.vertexLength+=C,A.primitiveLength+=$.length/3}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,y)}}let LS,NS;ot("FillBucket",z_,{omit:["layers","patternFeatures"]});var W7={get paint(){return NS=NS||new x({"fill-antialias":new dt(we.paint_fill["fill-antialias"]),"fill-opacity":new Et(we.paint_fill["fill-opacity"]),"fill-color":new Et(we.paint_fill["fill-color"]),"fill-outline-color":new Et(we.paint_fill["fill-outline-color"]),"fill-translate":new dt(we.paint_fill["fill-translate"]),"fill-translate-anchor":new dt(we.paint_fill["fill-translate-anchor"]),"fill-pattern":new Au(we.paint_fill["fill-pattern"])})},get layout(){return LS=LS||new x({"fill-sort-key":new Et(we.layout_fill["fill-sort-key"])})}};class G7 extends d{constructor(o){super(o,W7)}recalculate(o,h){super.recalculate(o,h);const p=this.paint._values["fill-outline-color"];p.value.kind==="constant"&&p.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(o){return new z_(o)}queryRadius(){return Im(this.paint.get("fill-translate"))}queryIntersectsFeature(o,h,p,y,v,w,C){return bS(Dm(o,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),w.angle,C),y)}isTileClipped(){return!0}}const Z7=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Y7=M([{name:"a_centroid",components:2,type:"Int16"}],4),{members:X7}=Z7;var nl={},K7=_,BS=Vu;function Vu(c,o,h,p,y){this.properties={},this.extent=h,this.type=0,this._pbf=c,this._geometry=-1,this._keys=p,this._values=y,c.readFields(J7,this,o)}function J7(c,o,h){c==1?o.id=h.readVarint():c==2?function(p,y){for(var v=p.readVarint()+p.pos;p.pos<v;){var w=y._keys[p.readVarint()],C=y._values[p.readVarint()];y.properties[w]=C}}(h,o):c==3?o.type=h.readVarint():c==4&&(o._geometry=h.pos)}function Q7(c){for(var o,h,p=0,y=0,v=c.length,w=v-1;y<v;w=y++)p+=((h=c[w]).x-(o=c[y]).x)*(o.y+h.y);return p}Vu.types=["Unknown","Point","LineString","Polygon"],Vu.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var o,h=c.readVarint()+c.pos,p=1,y=0,v=0,w=0,C=[];c.pos<h;){if(y<=0){var A=c.readVarint();p=7&A,y=A>>3}if(y--,p===1||p===2)v+=c.readSVarint(),w+=c.readSVarint(),p===1&&(o&&C.push(o),o=[]),o.push(new K7(v,w));else{if(p!==7)throw new Error("unknown command "+p);o&&o.push(o[0].clone())}}return o&&C.push(o),C},Vu.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var o=c.readVarint()+c.pos,h=1,p=0,y=0,v=0,w=1/0,C=-1/0,A=1/0,O=-1/0;c.pos<o;){if(p<=0){var R=c.readVarint();h=7&R,p=R>>3}if(p--,h===1||h===2)(y+=c.readSVarint())<w&&(w=y),y>C&&(C=y),(v+=c.readSVarint())<A&&(A=v),v>O&&(O=v);else if(h!==7)throw new Error("unknown command "+h)}return[w,A,C,O]},Vu.prototype.toGeoJSON=function(c,o,h){var p,y,v=this.extent*Math.pow(2,h),w=this.extent*c,C=this.extent*o,A=this.loadGeometry(),O=Vu.types[this.type];function R(q){for(var G=0;G<q.length;G++){var X=q[G];q[G]=[360*(X.x+w)/v-180,360/Math.PI*Math.atan(Math.exp((180-360*(X.y+C)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var N=[];for(p=0;p<A.length;p++)N[p]=A[p][0];R(A=N);break;case 2:for(p=0;p<A.length;p++)R(A[p]);break;case 3:for(A=function(q){var G=q.length;if(G<=1)return[q];for(var X,ie,ae=[],be=0;be<G;be++){var pe=Q7(q[be]);pe!==0&&(ie===void 0&&(ie=pe<0),ie===pe<0?(X&&ae.push(X),X=[q[be]]):X.push(q[be]))}return X&&ae.push(X),ae}(A),p=0;p<A.length;p++)for(y=0;y<A[p].length;y++)R(A[p][y])}A.length===1?A=A[0]:O="Multi"+O;var $={type:"Feature",geometry:{type:O,coordinates:A},properties:this.properties};return"id"in this&&($.id=this.id),$};var e9=BS,FS=VS;function VS(c,o){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=c,this._keys=[],this._values=[],this._features=[],c.readFields(t9,this,o),this.length=this._features.length}function t9(c,o,h){c===15?o.version=h.readVarint():c===1?o.name=h.readString():c===5?o.extent=h.readVarint():c===2?o._features.push(h.pos):c===3?o._keys.push(h.readString()):c===4&&o._values.push(function(p){for(var y=null,v=p.readVarint()+p.pos;p.pos<v;){var w=p.readVarint()>>3;y=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return y}(h))}VS.prototype.feature=function(c){if(c<0||c>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];var o=this._pbf.readVarint()+this._pbf.pos;return new e9(this._pbf,o,this.extent,this._keys,this._values)};var n9=FS;function i9(c,o,h){if(c===3){var p=new n9(h,h.readVarint()+h.pos);p.length&&(o[p.name]=p)}}nl.VectorTile=function(c,o){this.layers=c.readFields(i9,{},o)},nl.VectorTileFeature=BS,nl.VectorTileLayer=FS;const r9=nl.VectorTileFeature.types,R_=Math.pow(2,13);function qd(c,o,h,p,y,v,w,C){c.emplaceBack(o,h,2*Math.floor(p*R_)+w,y*R_*2,v*R_*2,Math.round(C))}class L_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.layoutVertexArray=new Xa,this.centroidVertexArray=new Di,this.indexArray=new is,this.programConfigurations=new ic(o.layers,o.zoom),this.segments=new Qt,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.features=[],this.hasPattern=D_("fill-extrusion",this.layers,h);for(const{feature:y,id:v,index:w,sourceLayerIndex:C}of o){const A=this.layers[0]._featureFilter.needGeometry,O=sc(y,A);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),O,p))continue;const R={id:v,sourceLayerIndex:C,index:w,geometry:A?O.geometry:rc(y),properties:y.properties,type:y.type,patterns:{}};this.hasPattern?this.features.push(O_("fill-extrusion",this.layers,R,this.zoom,h)):this.addFeature(R,R.geometry,w,p,{}),h.featureIndex.insert(y,R.geometry,w,C,this.index,!0)}}addFeatures(o,h,p){for(const y of this.features){const{geometry:v}=y;this.addFeature(y,v,y.index,h,p)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,X7),this.centroidVertexBuffer=o.createVertexBuffer(this.centroidVertexArray,Y7.members,!0),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(o,h,p,y,v){for(const w of cu(h,500)){const C={x:0,y:0,vertexCount:0};let A=0;for(const G of w)A+=G.length;let O=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray);for(const G of w){if(G.length===0||o9(G))continue;let X=0;for(let ie=0;ie<G.length;ie++){const ae=G[ie];if(ie>=1){const be=G[ie-1];if(!s9(ae,be)){O.vertexLength+4>Qt.MAX_VERTEX_ARRAY_LENGTH&&(O=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const pe=ae.sub(be)._perp()._unit(),ye=be.dist(ae);X+ye>32768&&(X=0),qd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,0,X),qd(this.layoutVertexArray,ae.x,ae.y,pe.x,pe.y,0,1,X),C.x+=2*ae.x,C.y+=2*ae.y,C.vertexCount+=2,X+=ye,qd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,0,X),qd(this.layoutVertexArray,be.x,be.y,pe.x,pe.y,0,1,X),C.x+=2*be.x,C.y+=2*be.y,C.vertexCount+=2;const Ee=O.vertexLength;this.indexArray.emplaceBack(Ee,Ee+2,Ee+1),this.indexArray.emplaceBack(Ee+1,Ee+2,Ee+3),O.vertexLength+=4,O.primitiveLength+=2}}}}if(O.vertexLength+A>Qt.MAX_VERTEX_ARRAY_LENGTH&&(O=this.segments.prepareSegment(A,this.layoutVertexArray,this.indexArray)),r9[o.type]!=="Polygon")continue;const R=[],N=[],$=O.vertexLength;for(const G of w)if(G.length!==0){G!==w[0]&&N.push(R.length/2);for(let X=0;X<G.length;X++){const ie=G[X];qd(this.layoutVertexArray,ie.x,ie.y,0,0,1,1,0),C.x+=ie.x,C.y+=ie.y,C.vertexCount+=1,R.push(ie.x),R.push(ie.y)}}const q=IS(R,N);for(let G=0;G<q.length;G+=3)this.indexArray.emplaceBack($+q[G],$+q[G+2],$+q[G+1]);O.primitiveLength+=q.length/3,O.vertexLength+=A;for(let G=0;G<C.vertexCount;G++){const X=Math.floor(C.x/C.vertexCount),ie=Math.floor(C.y/C.vertexCount);this.centroidVertexArray.emplaceBack(X,ie)}}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,y)}}function s9(c,o){return c.x===o.x&&(c.x<0||c.x>oi)||c.y===o.y&&(c.y<0||c.y>oi)}function o9(c){return c.every(o=>o.x<0)||c.every(o=>o.x>oi)||c.every(o=>o.y<0)||c.every(o=>o.y>oi)}let $S;ot("FillExtrusionBucket",L_,{omit:["layers","features"]});var a9={get paint(){return $S=$S||new x({"fill-extrusion-opacity":new dt(we["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new Et(we["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new dt(we["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new dt(we["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Au(we["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new Et(we["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new Et(we["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new dt(we["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class l9 extends d{constructor(o){super(o,a9)}createBucket(o){return new L_(o)}queryRadius(){return Im(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature(o,h,p,y,v,w,C,A){const O=Dm(o,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),w.angle,C),R=this.paint.get("fill-extrusion-height").evaluate(h,p),N=this.paint.get("fill-extrusion-base").evaluate(h,p),$=function(G,X,ie,ae){const be=[];for(const pe of G){const ye=[pe.x,pe.y,0,1];Om(ye,ye,X),be.push(new E(ye[0]/ye[3],ye[1]/ye[3]))}return be}(O,A),q=function(G,X,ie,ae){const be=[],pe=[],ye=ae[8]*X,Ee=ae[9]*X,Ne=ae[10]*X,tt=ae[11]*X,St=ae[8]*ie,Qe=ae[9]*ie,Ze=ae[10]*ie,mt=ae[11]*ie;for(const ct of G){const rt=[],De=[];for(const yt of ct){const ft=yt.x,It=yt.y,Pn=ae[0]*ft+ae[4]*It+ae[12],Mn=ae[1]*ft+ae[5]*It+ae[13],mi=ae[2]*ft+ae[6]*It+ae[14],Ds=ae[3]*ft+ae[7]*It+ae[15],Ri=mi+Ne,gi=Ds+tt,or=Pn+St,ar=Mn+Qe,lr=mi+Ze,ei=Ds+mt,yi=new E((Pn+ye)/gi,(Mn+Ee)/gi);yi.z=Ri/gi,rt.push(yi);const Gi=new E(or/ei,ar/ei);Gi.z=lr/ei,De.push(Gi)}be.push(rt),pe.push(De)}return[be,pe]}(y,N,R,A);return function(G,X,ie){let ae=1/0;bS(ie,X)&&(ae=jS(ie,X[0]));for(let be=0;be<X.length;be++){const pe=X[be],ye=G[be];for(let Ee=0;Ee<pe.length-1;Ee++){const Ne=pe[Ee],tt=[Ne,pe[Ee+1],ye[Ee+1],ye[Ee],Ne];_S(ie,tt)&&(ae=Math.min(ae,jS(ie,tt)))}}return ae!==1/0&&ae}(q[0],q[1],$)}}function Wd(c,o){return c.x*o.x+c.y*o.y}function jS(c,o){if(c.length===1){let h=0;const p=o[h++];let y;for(;!y||p.equals(y);)if(y=o[h++],!y)return 1/0;for(;h<o.length;h++){const v=o[h],w=c[0],C=y.sub(p),A=v.sub(p),O=w.sub(p),R=Wd(C,C),N=Wd(C,A),$=Wd(A,A),q=Wd(O,C),G=Wd(O,A),X=R*$-N*N,ie=($*q-N*G)/X,ae=(R*G-N*q)/X,be=p.z*(1-ie-ae)+y.z*ie+v.z*ae;if(isFinite(be))return be}return 1/0}{let h=1/0;for(const p of o)h=Math.min(h,p.z);return h}}const c9=M([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:u9}=c9,h9=M([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:d9}=h9,p9=nl.VectorTileFeature.types,f9=Math.cos(Math.PI/180*37.5),US=Math.pow(2,14)/.5;class N_{constructor(o){this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(h=>h.id),this.index=o.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new Iu,this.layoutVertexArray2=new Ka,this.indexArray=new is,this.programConfigurations=new ic(o.layers,o.zoom),this.segments=new Qt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id)}populate(o,h,p){this.hasPattern=D_("line",this.layers,h);const y=this.layers[0].layout.get("line-sort-key"),v=!y.isConstant(),w=[];for(const{feature:C,id:A,index:O,sourceLayerIndex:R}of o){const N=this.layers[0]._featureFilter.needGeometry,$=sc(C,N);if(!this.layers[0]._featureFilter.filter(new Ln(this.zoom),$,p))continue;const q=v?y.evaluate($,{},p):void 0,G={id:A,properties:C.properties,type:C.type,sourceLayerIndex:R,index:O,geometry:N?$.geometry:rc(C),patterns:{},sortKey:q};w.push(G)}v&&w.sort((C,A)=>C.sortKey-A.sortKey);for(const C of w){const{geometry:A,index:O,sourceLayerIndex:R}=C;if(this.hasPattern){const N=O_("line",this.layers,C,this.zoom,h);this.patternFeatures.push(N)}else this.addFeature(C,A,O,p,{});h.featureIndex.insert(o[O].feature,A,O,R,this.index)}}update(o,h,p){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(o,h,this.stateDependentLayers,p)}addFeatures(o,h,p){for(const y of this.patternFeatures)this.addFeature(y,y.geometry,y.index,h,p)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(o){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=o.createVertexBuffer(this.layoutVertexArray2,d9)),this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,u9),this.indexBuffer=o.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(o),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(o){if(o.properties&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(o.properties,"mapbox_clip_end"))return{start:+o.properties.mapbox_clip_start,end:+o.properties.mapbox_clip_end}}addFeature(o,h,p,y,v){const w=this.layers[0].layout,C=w.get("line-join").evaluate(o,{}),A=w.get("line-cap"),O=w.get("line-miter-limit"),R=w.get("line-round-limit");this.lineClips=this.lineFeatureClips(o);for(const N of h)this.addLine(N,o,C,A,O,R);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,o,p,v,y)}addLine(o,h,p,y,v,w){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,this.lineClips){this.lineClipsArray.push(this.lineClips);for(let ae=0;ae<o.length-1;ae++)this.totalDistance+=o[ae].dist(o[ae+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const C=p9[h.type]==="Polygon";let A=o.length;for(;A>=2&&o[A-1].equals(o[A-2]);)A--;let O=0;for(;O<A-1&&o[O].equals(o[O+1]);)O++;if(A<(C?3:2))return;p==="bevel"&&(v=1.05);const R=this.overscaling<=16?15*oi/(512*this.overscaling):0,N=this.segments.prepareSegment(10*A,this.layoutVertexArray,this.indexArray);let $,q,G,X,ie;this.e1=this.e2=-1,C&&($=o[A-2],ie=o[O].sub($)._unit()._perp());for(let ae=O;ae<A;ae++){if(G=ae===A-1?C?o[O+1]:void 0:o[ae+1],G&&o[ae].equals(G))continue;ie&&(X=ie),$&&(q=$),$=o[ae],ie=G?G.sub($)._unit()._perp():X,X=X||ie;let be=X.add(ie);be.x===0&&be.y===0||be._unit();const pe=X.x*ie.x+X.y*ie.y,ye=be.x*ie.x+be.y*ie.y,Ee=ye!==0?1/ye:1/0,Ne=2*Math.sqrt(2-2*ye),tt=ye<f9&&q&&G,St=X.x*ie.y-X.y*ie.x>0;if(tt&&ae>O){const mt=$.dist(q);if(mt>2*R){const ct=$.sub($.sub(q)._mult(R/mt)._round());this.updateDistance(q,ct),this.addCurrentVertex(ct,X,0,0,N),q=ct}}const Qe=q&&G;let Ze=Qe?p:C?"butt":y;if(Qe&&Ze==="round"&&(Ee<w?Ze="miter":Ee<=2&&(Ze="fakeround")),Ze==="miter"&&Ee>v&&(Ze="bevel"),Ze==="bevel"&&(Ee>2&&(Ze="flipbevel"),Ee<v&&(Ze="miter")),q&&this.updateDistance(q,$),Ze==="miter")be._mult(Ee),this.addCurrentVertex($,be,0,0,N);else if(Ze==="flipbevel"){if(Ee>100)be=ie.mult(-1);else{const mt=Ee*X.add(ie).mag()/X.sub(ie).mag();be._perp()._mult(mt*(St?-1:1))}this.addCurrentVertex($,be,0,0,N),this.addCurrentVertex($,be.mult(-1),0,0,N)}else if(Ze==="bevel"||Ze==="fakeround"){const mt=-Math.sqrt(Ee*Ee-1),ct=St?mt:0,rt=St?0:mt;if(q&&this.addCurrentVertex($,X,ct,rt,N),Ze==="fakeround"){const De=Math.round(180*Ne/Math.PI/20);for(let yt=1;yt<De;yt++){let ft=yt/De;if(ft!==.5){const Pn=ft-.5;ft+=ft*Pn*(ft-1)*((1.0904+pe*(pe*(3.55645-1.43519*pe)-3.2452))*Pn*Pn+(.848013+pe*(.215638*pe-1.06021)))}const It=ie.sub(X)._mult(ft)._add(X)._unit()._mult(St?-1:1);this.addHalfVertex($,It.x,It.y,!1,St,0,N)}}G&&this.addCurrentVertex($,ie,-ct,-rt,N)}else if(Ze==="butt")this.addCurrentVertex($,be,0,0,N);else if(Ze==="square"){const mt=q?1:-1;this.addCurrentVertex($,be,mt,mt,N)}else Ze==="round"&&(q&&(this.addCurrentVertex($,X,0,0,N),this.addCurrentVertex($,X,1,1,N,!0)),G&&(this.addCurrentVertex($,ie,-1,-1,N,!0),this.addCurrentVertex($,ie,0,0,N)));if(tt&&ae<A-1){const mt=$.dist(G);if(mt>2*R){const ct=$.add(G.sub($)._mult(R/mt)._round());this.updateDistance($,ct),this.addCurrentVertex(ct,ie,0,0,N),$=ct}}}}addCurrentVertex(o,h,p,y,v,w=!1){const C=h.y*y-h.x,A=-h.y-h.x*y;this.addHalfVertex(o,h.x+h.y*p,h.y-h.x*p,w,!1,p,v),this.addHalfVertex(o,C,A,w,!0,-y,v),this.distance>US/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(o,h,p,y,v,w))}addHalfVertex({x:o,y:h},p,y,v,w,C,A){const O=.5*(this.lineClips?this.scaledDistance*(US-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((o<<1)+(v?1:0),(h<<1)+(w?1:0),Math.round(63*p)+128,Math.round(63*y)+128,1+(C===0?0:C<0?-1:1)|(63&O)<<2,O>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const R=A.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,R),A.primitiveLength++),w?this.e2=R:this.e1=R}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(o,h){this.distance+=o.dist(h),this.updateScaledDistance()}}let HS,qS;ot("LineBucket",N_,{omit:["layers","patternFeatures"]});var WS={get paint(){return qS=qS||new x({"line-opacity":new Et(we.paint_line["line-opacity"]),"line-color":new Et(we.paint_line["line-color"]),"line-translate":new dt(we.paint_line["line-translate"]),"line-translate-anchor":new dt(we.paint_line["line-translate-anchor"]),"line-width":new Et(we.paint_line["line-width"]),"line-gap-width":new Et(we.paint_line["line-gap-width"]),"line-offset":new Et(we.paint_line["line-offset"]),"line-blur":new Et(we.paint_line["line-blur"]),"line-dasharray":new Pu(we.paint_line["line-dasharray"]),"line-pattern":new Au(we.paint_line["line-pattern"]),"line-gradient":new Ld(we.paint_line["line-gradient"])})},get layout(){return HS=HS||new x({"line-cap":new dt(we.layout_line["line-cap"]),"line-join":new Et(we.layout_line["line-join"]),"line-miter-limit":new dt(we.layout_line["line-miter-limit"]),"line-round-limit":new dt(we.layout_line["line-round-limit"]),"line-sort-key":new Et(we.layout_line["line-sort-key"])})}};class m9 extends Et{possiblyEvaluate(o,h){return h=new Ln(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,zoomHistory:h.zoomHistory,transition:h.transition}),super.possiblyEvaluate(o,h)}evaluate(o,h,p,y){return h=Me({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(o,h,p,y)}}let Nm;class g9 extends d{constructor(o){super(o,WS),this.gradientVersion=0,Nm||(Nm=new m9(WS.paint.properties["line-width"].specification),Nm.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(o){if(o==="line-gradient"){const h=this.gradientExpression();this.stepInterpolant=!!function(p){return p._styleExpression!==void 0}(h)&&h._styleExpression.expression instanceof Ia,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(o,h){super.recalculate(o,h),this.paint._values["line-floorwidth"]=Nm.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,o)}createBucket(o){return new N_(o)}queryRadius(o){const h=o,p=GS(Fd("line-width",this,h),Fd("line-gap-width",this,h)),y=Fd("line-offset",this,h);return p/2+Math.abs(y)+Im(this.paint.get("line-translate"))}queryIntersectsFeature(o,h,p,y,v,w,C){const A=Dm(o,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),w.angle,C),O=C/2*GS(this.paint.get("line-width").evaluate(h,p),this.paint.get("line-gap-width").evaluate(h,p)),R=this.paint.get("line-offset").evaluate(h,p);return R&&(y=function(N,$){const q=[];for(let G=0;G<N.length;G++){const X=N[G],ie=[];for(let ae=0;ae<X.length;ae++){const be=X[ae-1],pe=X[ae],ye=X[ae+1],Ee=ae===0?new E(0,0):pe.sub(be)._unit()._perp(),Ne=ae===X.length-1?new E(0,0):ye.sub(pe)._unit()._perp(),tt=Ee._add(Ne)._unit(),St=tt.x*Ne.x+tt.y*Ne.y;St!==0&&tt._mult(1/St),ie.push(tt._mult($)._add(pe))}q.push(ie)}return q}(y,R*C)),function(N,$,q){for(let G=0;G<$.length;G++){const X=$[G];if(N.length>=3){for(let ie=0;ie<X.length;ie++)if(Nu(N,X[ie]))return!0}if(E7(N,X,q))return!0}return!1}(A,y,O)}isTileClipped(){return!0}}function GS(c,o){return o>0?o+2*c:c}const y9=M([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),_9=M([{name:"a_projected_pos",components:3,type:"Float32"}],4);M([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const b9=M([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);M([{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 ZS=M([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),x9=M([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function v9(c,o,h){return c.sections.forEach(p=>{p.text=function(y,v,w){const C=v.layout.get("text-transform").evaluate(w,{});return C==="uppercase"?y=y.toLocaleUpperCase():C==="lowercase"&&(y=y.toLocaleLowerCase()),_r.applyArabicShaping&&(y=_r.applyArabicShaping(y)),y}(p.text,o,h)}),c}M([{name:"triangle",components:3,type:"Uint16"}]),M([{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"}]),M([{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"}]),M([{type:"Float32",name:"offsetX"}]),M([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),M([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Gd={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var li=24,YS=Tn,XS=function(c,o,h,p,y){var v,w,C=8*y-p-1,A=(1<<C)-1,O=A>>1,R=-7,N=y-1,$=-1,q=c[o+N];for(N+=$,v=q&(1<<-R)-1,q>>=-R,R+=C;R>0;v=256*v+c[o+N],N+=$,R-=8);for(w=v&(1<<-R)-1,v>>=-R,R+=p;R>0;w=256*w+c[o+N],N+=$,R-=8);if(v===0)v=1-O;else{if(v===A)return w?NaN:1/0*(q?-1:1);w+=Math.pow(2,p),v-=O}return(q?-1:1)*w*Math.pow(2,v-p)},KS=function(c,o,h,p,y,v){var w,C,A,O=8*v-y-1,R=(1<<O)-1,N=R>>1,$=y===23?Math.pow(2,-24)-Math.pow(2,-77):0,q=0,G=1,X=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(C=isNaN(o)?1:0,w=R):(w=Math.floor(Math.log(o)/Math.LN2),o*(A=Math.pow(2,-w))<1&&(w--,A*=2),(o+=w+N>=1?$/A:$*Math.pow(2,1-N))*A>=2&&(w++,A/=2),w+N>=R?(C=0,w=R):w+N>=1?(C=(o*A-1)*Math.pow(2,y),w+=N):(C=o*Math.pow(2,N-1)*Math.pow(2,y),w=0));y>=8;c[h+q]=255&C,q+=G,C/=256,y-=8);for(w=w<<y|C,O+=y;O>0;c[h+q]=255&w,q+=G,w/=256,O-=8);c[h+q-G]|=128*X};function Tn(c){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(c)?c:new Uint8Array(c||0),this.pos=0,this.type=0,this.length=this.buf.length}Tn.Varint=0,Tn.Fixed64=1,Tn.Bytes=2,Tn.Fixed32=5;var B_=4294967296,JS=1/B_,QS=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function ea(c){return c.type===Tn.Bytes?c.readVarint()+c.pos:c.pos+1}function $u(c,o,h){return h?4294967296*o+(c>>>0):4294967296*(o>>>0)+(c>>>0)}function eE(c,o,h){var p=o<=16383?1:o<=2097151?2:o<=268435455?3:Math.floor(Math.log(o)/(7*Math.LN2));h.realloc(p);for(var y=h.pos-1;y>=c;y--)h.buf[y+p]=h.buf[y]}function w9(c,o){for(var h=0;h<c.length;h++)o.writeVarint(c[h])}function k9(c,o){for(var h=0;h<c.length;h++)o.writeSVarint(c[h])}function S9(c,o){for(var h=0;h<c.length;h++)o.writeFloat(c[h])}function E9(c,o){for(var h=0;h<c.length;h++)o.writeDouble(c[h])}function C9(c,o){for(var h=0;h<c.length;h++)o.writeBoolean(c[h])}function T9(c,o){for(var h=0;h<c.length;h++)o.writeFixed32(c[h])}function M9(c,o){for(var h=0;h<c.length;h++)o.writeSFixed32(c[h])}function A9(c,o){for(var h=0;h<c.length;h++)o.writeFixed64(c[h])}function P9(c,o){for(var h=0;h<c.length;h++)o.writeSFixed64(c[h])}function Bm(c,o){return(c[o]|c[o+1]<<8|c[o+2]<<16)+16777216*c[o+3]}function ju(c,o,h){c[h]=o,c[h+1]=o>>>8,c[h+2]=o>>>16,c[h+3]=o>>>24}function tE(c,o){return(c[o]|c[o+1]<<8|c[o+2]<<16)+(c[o+3]<<24)}Tn.prototype={destroy:function(){this.buf=null},readFields:function(c,o,h){for(h=h||this.length;this.pos<h;){var p=this.readVarint(),y=p>>3,v=this.pos;this.type=7&p,c(y,o,this),this.pos===v&&this.skip(p)}return o},readMessage:function(c,o){return this.readFields(c,o,this.readVarint()+this.pos)},readFixed32:function(){var c=Bm(this.buf,this.pos);return this.pos+=4,c},readSFixed32:function(){var c=tE(this.buf,this.pos);return this.pos+=4,c},readFixed64:function(){var c=Bm(this.buf,this.pos)+Bm(this.buf,this.pos+4)*B_;return this.pos+=8,c},readSFixed64:function(){var c=Bm(this.buf,this.pos)+tE(this.buf,this.pos+4)*B_;return this.pos+=8,c},readFloat:function(){var c=XS(this.buf,this.pos,!0,23,4);return this.pos+=4,c},readDouble:function(){var c=XS(this.buf,this.pos,!0,52,8);return this.pos+=8,c},readVarint:function(c){var o,h,p=this.buf;return o=127&(h=p[this.pos++]),h<128?o:(o|=(127&(h=p[this.pos++]))<<7,h<128?o:(o|=(127&(h=p[this.pos++]))<<14,h<128?o:(o|=(127&(h=p[this.pos++]))<<21,h<128?o:function(y,v,w){var C,A,O=w.buf;if(C=(112&(A=O[w.pos++]))>>4,A<128||(C|=(127&(A=O[w.pos++]))<<3,A<128)||(C|=(127&(A=O[w.pos++]))<<10,A<128)||(C|=(127&(A=O[w.pos++]))<<17,A<128)||(C|=(127&(A=O[w.pos++]))<<24,A<128)||(C|=(1&(A=O[w.pos++]))<<31,A<128))return $u(y,C,v);throw new Error("Expected varint not more than 10 bytes")}(o|=(15&(h=p[this.pos]))<<28,c,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var c=this.readVarint();return c%2==1?(c+1)/-2:c/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var c=this.readVarint()+this.pos,o=this.pos;return this.pos=c,c-o>=12&&QS?function(h,p,y){return QS.decode(h.subarray(p,y))}(this.buf,o,c):function(h,p,y){for(var v="",w=p;w<y;){var C,A,O,R=h[w],N=null,$=R>239?4:R>223?3:R>191?2:1;if(w+$>y)break;$===1?R<128&&(N=R):$===2?(192&(C=h[w+1]))==128&&(N=(31&R)<<6|63&C)<=127&&(N=null):$===3?(A=h[w+2],(192&(C=h[w+1]))==128&&(192&A)==128&&((N=(15&R)<<12|(63&C)<<6|63&A)<=2047||N>=55296&&N<=57343)&&(N=null)):$===4&&(A=h[w+2],O=h[w+3],(192&(C=h[w+1]))==128&&(192&A)==128&&(192&O)==128&&((N=(15&R)<<18|(63&C)<<12|(63&A)<<6|63&O)<=65535||N>=1114112)&&(N=null)),N===null?(N=65533,$=1):N>65535&&(N-=65536,v+=String.fromCharCode(N>>>10&1023|55296),N=56320|1023&N),v+=String.fromCharCode(N),w+=$}return v}(this.buf,o,c)},readBytes:function(){var c=this.readVarint()+this.pos,o=this.buf.subarray(this.pos,c);return this.pos=c,o},readPackedVarint:function(c,o){if(this.type!==Tn.Bytes)return c.push(this.readVarint(o));var h=ea(this);for(c=c||[];this.pos<h;)c.push(this.readVarint(o));return c},readPackedSVarint:function(c){if(this.type!==Tn.Bytes)return c.push(this.readSVarint());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readSVarint());return c},readPackedBoolean:function(c){if(this.type!==Tn.Bytes)return c.push(this.readBoolean());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readBoolean());return c},readPackedFloat:function(c){if(this.type!==Tn.Bytes)return c.push(this.readFloat());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readFloat());return c},readPackedDouble:function(c){if(this.type!==Tn.Bytes)return c.push(this.readDouble());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readDouble());return c},readPackedFixed32:function(c){if(this.type!==Tn.Bytes)return c.push(this.readFixed32());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readFixed32());return c},readPackedSFixed32:function(c){if(this.type!==Tn.Bytes)return c.push(this.readSFixed32());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readSFixed32());return c},readPackedFixed64:function(c){if(this.type!==Tn.Bytes)return c.push(this.readFixed64());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readFixed64());return c},readPackedSFixed64:function(c){if(this.type!==Tn.Bytes)return c.push(this.readSFixed64());var o=ea(this);for(c=c||[];this.pos<o;)c.push(this.readSFixed64());return c},skip:function(c){var o=7&c;if(o===Tn.Varint)for(;this.buf[this.pos++]>127;);else if(o===Tn.Bytes)this.pos=this.readVarint()+this.pos;else if(o===Tn.Fixed32)this.pos+=4;else{if(o!==Tn.Fixed64)throw new Error("Unimplemented type: "+o);this.pos+=8}},writeTag:function(c,o){this.writeVarint(c<<3|o)},realloc:function(c){for(var o=this.length||16;o<this.pos+c;)o*=2;if(o!==this.length){var h=new Uint8Array(o);h.set(this.buf),this.buf=h,this.length=o}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(c){this.realloc(4),ju(this.buf,c,this.pos),this.pos+=4},writeSFixed32:function(c){this.realloc(4),ju(this.buf,c,this.pos),this.pos+=4},writeFixed64:function(c){this.realloc(8),ju(this.buf,-1&c,this.pos),ju(this.buf,Math.floor(c*JS),this.pos+4),this.pos+=8},writeSFixed64:function(c){this.realloc(8),ju(this.buf,-1&c,this.pos),ju(this.buf,Math.floor(c*JS),this.pos+4),this.pos+=8},writeVarint:function(c){(c=+c||0)>268435455||c<0?function(o,h){var p,y;if(o>=0?(p=o%4294967296|0,y=o/4294967296|0):(y=~(-o/4294967296),4294967295^(p=~(-o%4294967296))?p=p+1|0:(p=0,y=y+1|0)),o>=18446744073709552e3||o<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(v,w,C){C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,v>>>=7,C.buf[C.pos++]=127&v|128,C.buf[C.pos]=127&(v>>>=7)}(p,0,h),function(v,w){var C=(7&v)<<4;w.buf[w.pos++]|=C|((v>>>=3)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v|((v>>>=7)?128:0),v&&(w.buf[w.pos++]=127&v)))))}(y,h)}(c,this):(this.realloc(4),this.buf[this.pos++]=127&c|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=127&(c>>>=7)|(c>127?128:0),c<=127||(this.buf[this.pos++]=c>>>7&127))))},writeSVarint:function(c){this.writeVarint(c<0?2*-c-1:2*c)},writeBoolean:function(c){this.writeVarint(!!c)},writeString:function(c){c=String(c),this.realloc(4*c.length),this.pos++;var o=this.pos;this.pos=function(p,y,v){for(var w,C,A=0;A<y.length;A++){if((w=y.charCodeAt(A))>55295&&w<57344){if(!C){w>56319||A+1===y.length?(p[v++]=239,p[v++]=191,p[v++]=189):C=w;continue}if(w<56320){p[v++]=239,p[v++]=191,p[v++]=189,C=w;continue}w=C-55296<<10|w-56320|65536,C=null}else C&&(p[v++]=239,p[v++]=191,p[v++]=189,C=null);w<128?p[v++]=w:(w<2048?p[v++]=w>>6|192:(w<65536?p[v++]=w>>12|224:(p[v++]=w>>18|240,p[v++]=w>>12&63|128),p[v++]=w>>6&63|128),p[v++]=63&w|128)}return v}(this.buf,c,this.pos);var h=this.pos-o;h>=128&&eE(o,h,this),this.pos=o-1,this.writeVarint(h),this.pos+=h},writeFloat:function(c){this.realloc(4),KS(this.buf,c,this.pos,!0,23,4),this.pos+=4},writeDouble:function(c){this.realloc(8),KS(this.buf,c,this.pos,!0,52,8),this.pos+=8},writeBytes:function(c){var o=c.length;this.writeVarint(o),this.realloc(o);for(var h=0;h<o;h++)this.buf[this.pos++]=c[h]},writeRawMessage:function(c,o){this.pos++;var h=this.pos;c(o,this);var p=this.pos-h;p>=128&&eE(h,p,this),this.pos=h-1,this.writeVarint(p),this.pos+=p},writeMessage:function(c,o,h){this.writeTag(c,Tn.Bytes),this.writeRawMessage(o,h)},writePackedVarint:function(c,o){o.length&&this.writeMessage(c,w9,o)},writePackedSVarint:function(c,o){o.length&&this.writeMessage(c,k9,o)},writePackedBoolean:function(c,o){o.length&&this.writeMessage(c,C9,o)},writePackedFloat:function(c,o){o.length&&this.writeMessage(c,S9,o)},writePackedDouble:function(c,o){o.length&&this.writeMessage(c,E9,o)},writePackedFixed32:function(c,o){o.length&&this.writeMessage(c,T9,o)},writePackedSFixed32:function(c,o){o.length&&this.writeMessage(c,M9,o)},writePackedFixed64:function(c,o){o.length&&this.writeMessage(c,A9,o)},writePackedSFixed64:function(c,o){o.length&&this.writeMessage(c,P9,o)},writeBytesField:function(c,o){this.writeTag(c,Tn.Bytes),this.writeBytes(o)},writeFixed32Field:function(c,o){this.writeTag(c,Tn.Fixed32),this.writeFixed32(o)},writeSFixed32Field:function(c,o){this.writeTag(c,Tn.Fixed32),this.writeSFixed32(o)},writeFixed64Field:function(c,o){this.writeTag(c,Tn.Fixed64),this.writeFixed64(o)},writeSFixed64Field:function(c,o){this.writeTag(c,Tn.Fixed64),this.writeSFixed64(o)},writeVarintField:function(c,o){this.writeTag(c,Tn.Varint),this.writeVarint(o)},writeSVarintField:function(c,o){this.writeTag(c,Tn.Varint),this.writeSVarint(o)},writeStringField:function(c,o){this.writeTag(c,Tn.Bytes),this.writeString(o)},writeFloatField:function(c,o){this.writeTag(c,Tn.Fixed32),this.writeFloat(o)},writeDoubleField:function(c,o){this.writeTag(c,Tn.Fixed64),this.writeDouble(o)},writeBooleanField:function(c,o){this.writeVarintField(c,!!o)}};var F_=g(YS);const V_=3;function I9(c,o,h){c===1&&h.readMessage(D9,o)}function D9(c,o,h){if(c===3){const{id:p,bitmap:y,width:v,height:w,left:C,top:A,advance:O}=h.readMessage(O9,{});o.push({id:p,bitmap:new $d({width:v+2*V_,height:w+2*V_},y),metrics:{width:v,height:w,left:C,top:A,advance:O}})}}function O9(c,o,h){c===1?o.id=h.readVarint():c===2?o.bitmap=h.readBytes():c===3?o.width=h.readVarint():c===4?o.height=h.readVarint():c===5?o.left=h.readSVarint():c===6?o.top=h.readSVarint():c===7&&(o.advance=h.readVarint())}const nE=V_;function iE(c){let o=0,h=0;for(const w of c)o+=w.w*w.h,h=Math.max(h,w.w);c.sort((w,C)=>C.h-w.h);const p=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(o/.95)),h),h:1/0}];let y=0,v=0;for(const w of c)for(let C=p.length-1;C>=0;C--){const A=p[C];if(!(w.w>A.w||w.h>A.h)){if(w.x=A.x,w.y=A.y,v=Math.max(v,w.y+w.h),y=Math.max(y,w.x+w.w),w.w===A.w&&w.h===A.h){const O=p.pop();C<p.length&&(p[C]=O)}else w.h===A.h?(A.x+=w.w,A.w-=w.w):w.w===A.w?(A.y+=w.h,A.h-=w.h):(p.push({x:A.x+w.w,y:A.y,w:A.w-w.w,h:w.h}),A.y+=w.h,A.h-=w.h);break}}return{w:y,h:v,fill:o/(y*v)||0}}const xr=1;class $_{constructor(o,{pixelRatio:h,version:p,stretchX:y,stretchY:v,content:w,textFitWidth:C,textFitHeight:A}){this.paddedRect=o,this.pixelRatio=h,this.stretchX=y,this.stretchY=v,this.content=w,this.version=p,this.textFitWidth=C,this.textFitHeight=A}get tl(){return[this.paddedRect.x+xr,this.paddedRect.y+xr]}get br(){return[this.paddedRect.x+this.paddedRect.w-xr,this.paddedRect.y+this.paddedRect.h-xr]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*xr)/this.pixelRatio,(this.paddedRect.h-2*xr)/this.pixelRatio]}}class rE{constructor(o,h){const p={},y={};this.haveRenderCallbacks=[];const v=[];this.addImages(o,p,v),this.addImages(h,y,v);const{w,h:C}=iE(v),A=new rs({width:w||1,height:C||1});for(const O in o){const R=o[O],N=p[O].paddedRect;rs.copy(R.data,A,{x:0,y:0},{x:N.x+xr,y:N.y+xr},R.data)}for(const O in h){const R=h[O],N=y[O].paddedRect,$=N.x+xr,q=N.y+xr,G=R.data.width,X=R.data.height;rs.copy(R.data,A,{x:0,y:0},{x:$,y:q},R.data),rs.copy(R.data,A,{x:0,y:X-1},{x:$,y:q-1},{width:G,height:1}),rs.copy(R.data,A,{x:0,y:0},{x:$,y:q+X},{width:G,height:1}),rs.copy(R.data,A,{x:G-1,y:0},{x:$-1,y:q},{width:1,height:X}),rs.copy(R.data,A,{x:0,y:0},{x:$+G,y:q},{width:1,height:X})}this.image=A,this.iconPositions=p,this.patternPositions=y}addImages(o,h,p){for(const y in o){const v=o[y],w={x:0,y:0,w:v.data.width+2*xr,h:v.data.height+2*xr};p.push(w),h[y]=new $_(w,v),v.hasRenderCallback&&this.haveRenderCallbacks.push(y)}}patchUpdatedImages(o,h){o.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const p in o.updatedImages)this.patchUpdatedImage(this.iconPositions[p],o.getImage(p),h),this.patchUpdatedImage(this.patternPositions[p],o.getImage(p),h)}patchUpdatedImage(o,h,p){if(!o||!h||o.version===h.version)return;o.version=h.version;const[y,v]=o.tl;p.update(h.data,void 0,{x:y,y:v})}}var il;ot("ImagePosition",$_),ot("ImageAtlas",rE),u.ah=void 0,(il=u.ah||(u.ah={}))[il.none=0]="none",il[il.horizontal=1]="horizontal",il[il.vertical=2]="vertical",il[il.horizontalOnly=3]="horizontalOnly";const Zd=-17;class Yd{constructor(){this.scale=1,this.fontStack="",this.imageName=null}static forText(o,h){const p=new Yd;return p.scale=o||1,p.fontStack=h,p}static forImage(o){const h=new Yd;return h.imageName=o,h}}class Uu{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(o,h){const p=new Uu;for(let y=0;y<o.sections.length;y++){const v=o.sections[y];v.image?p.addImageSection(v):p.addTextSection(v,h)}return p}length(){return this.text.length}getSection(o){return this.sections[this.sectionIndex[o]]}getSectionIndex(o){return this.sectionIndex[o]}getCharCode(o){return this.text.charCodeAt(o)}verticalizePunctuation(){this.text=function(o){let h="";for(let p=0;p<o.length;p++){const y=o.charCodeAt(p+1)||null,v=o.charCodeAt(p-1)||null;h+=y&&Sm(y)&&!Gd[o[p+1]]||v&&Sm(v)&&!Gd[o[p-1]]||!Gd[o[p]]?o[p]:Gd[o[p]]}return h}(this.text)}trim(){let o=0;for(let p=0;p<this.text.length&&Vm[this.text.charCodeAt(p)];p++)o++;let h=this.text.length;for(let p=this.text.length-1;p>=0&&p>=o&&Vm[this.text.charCodeAt(p)];p--)h--;this.text=this.text.substring(o,h),this.sectionIndex=this.sectionIndex.slice(o,h)}substring(o,h){const p=new Uu;return p.text=this.text.substring(o,h),p.sectionIndex=this.sectionIndex.slice(o,h),p.sections=this.sections,p}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((o,h)=>Math.max(o,this.sections[h].scale),0)}addTextSection(o,h){this.text+=o.text,this.sections.push(Yd.forText(o.scale,o.fontStack||h));const p=this.sections.length-1;for(let y=0;y<o.text.length;++y)this.sectionIndex.push(p)}addImageSection(o){const h=o.image?o.image.name:"";if(h.length===0)return void ht("Can't add FormattedSection with an empty image.");const p=this.getNextImageSectionCharCode();p?(this.text+=String.fromCharCode(p),this.sections.push(Yd.forImage(h)),this.sectionIndex.push(this.sections.length-1)):ht("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Fm(c,o,h,p,y,v,w,C,A,O,R,N,$,q,G){const X=Uu.fromFeature(c,y);let ie;N===u.ah.vertical&&X.verticalizePunctuation();const{processBidirectionalText:ae,processStyledBidirectionalText:be}=_r;if(ae&&X.sections.length===1){ie=[];const Ee=ae(X.toString(),j_(X,O,v,o,p,q));for(const Ne of Ee){const tt=new Uu;tt.text=Ne,tt.sections=X.sections;for(let St=0;St<Ne.length;St++)tt.sectionIndex.push(0);ie.push(tt)}}else if(be){ie=[];const Ee=be(X.text,X.sectionIndex,j_(X,O,v,o,p,q));for(const Ne of Ee){const tt=new Uu;tt.text=Ne[0],tt.sectionIndex=Ne[1],tt.sections=X.sections,ie.push(tt)}}else ie=function(Ee,Ne){const tt=[],St=Ee.text;let Qe=0;for(const Ze of Ne)tt.push(Ee.substring(Qe,Ze)),Qe=Ze;return Qe<St.length&&tt.push(Ee.substring(Qe,St.length)),tt}(X,j_(X,O,v,o,p,q));const pe=[],ye={positionedLines:pe,text:X.toString(),top:R[1],bottom:R[1],left:R[0],right:R[0],writingMode:N,iconsInText:!1,verticalizable:!1};return function(Ee,Ne,tt,St,Qe,Ze,mt,ct,rt,De,yt,ft){let It=0,Pn=Zd,Mn=0,mi=0;const Ds=ct==="right"?1:ct==="left"?0:.5;let Ri=0;for(const ei of Qe){ei.trim();const yi=ei.getMaxScale(),Gi=(yi-1)*li,Li={positionedGlyphs:[],lineOffset:0};Ee.positionedLines[Ri]=Li;const cr=Li.positionedGlyphs;let Ni=0;if(!ei.length()){Pn+=Ze,++Ri;continue}for(let vr=0;vr<ei.length();vr++){const un=ei.getSection(vr),On=ei.getSectionIndex(vr),Vn=ei.getCharCode(vr);let jr=0,Yn=null,Gu=null,go=null,yo=li;const Os=!(rt===u.ah.horizontal||!yt&&!zd(Vn)||yt&&(Vm[Vn]||(gi=Vn,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(gi)))));if(un.imageName){const ls=St[un.imageName];if(!ls)continue;go=un.imageName,Ee.iconsInText=Ee.iconsInText||!0,Gu=ls.paddedRect;const Si=ls.displaySize;un.scale=un.scale*li/ft,Yn={width:Si[0],height:Si[1],left:xr,top:-nE,advance:Os?Si[1]:Si[0]},jr=Gi+(li-Si[1]*un.scale),yo=Yn.advance;const ta=Os?Si[0]*un.scale-li*yi:Si[1]*un.scale-li*yi;ta>0&&ta>Ni&&(Ni=ta)}else{const ls=tt[un.fontStack],Si=ls&&ls[Vn];if(Si&&Si.rect)Gu=Si.rect,Yn=Si.metrics;else{const ta=Ne[un.fontStack],tp=ta&&ta[Vn];if(!tp)continue;Yn=tp.metrics}jr=(yi-un.scale)*li}Os?(Ee.verticalizable=!0,cr.push({glyph:Vn,imageName:go,x:It,y:Pn+jr,vertical:Os,scale:un.scale,fontStack:un.fontStack,sectionIndex:On,metrics:Yn,rect:Gu}),It+=yo*un.scale+De):(cr.push({glyph:Vn,imageName:go,x:It,y:Pn+jr,vertical:Os,scale:un.scale,fontStack:un.fontStack,sectionIndex:On,metrics:Yn,rect:Gu}),It+=Yn.advance*un.scale+De)}cr.length!==0&&(Mn=Math.max(It-De,Mn),N9(cr,0,cr.length-1,Ds,Ni)),It=0;const as=Ze*yi+Ni;Li.lineOffset=Math.max(Ni,Gi),Pn+=as,mi=Math.max(as,mi),++Ri}var gi;const or=Pn-Zd,{horizontalAlign:ar,verticalAlign:lr}=U_(mt);(function(ei,yi,Gi,Li,cr,Ni,as,vr,un){const On=(yi-Gi)*cr;let Vn=0;Vn=Ni!==as?-vr*Li-Zd:(-Li*un+.5)*as;for(const jr of ei)for(const Yn of jr.positionedGlyphs)Yn.x+=On,Yn.y+=Vn})(Ee.positionedLines,Ds,ar,lr,Mn,mi,Ze,or,Qe.length),Ee.top+=-lr*or,Ee.bottom=Ee.top+or,Ee.left+=-ar*Mn,Ee.right=Ee.left+Mn}(ye,o,h,p,ie,w,C,A,N,O,$,G),!function(Ee){for(const Ne of Ee)if(Ne.positionedGlyphs.length!==0)return!1;return!0}(pe)&&ye}const Vm={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},z9={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},R9={40:!0};function sE(c,o,h,p,y,v){if(o.imageName){const w=p[o.imageName];return w?w.displaySize[0]*o.scale*li/v+y:0}{const w=h[o.fontStack],C=w&&w[c];return C?C.metrics.advance*o.scale+y:0}}function oE(c,o,h,p){const y=Math.pow(c-o,2);return p?c<o?y/2:2*y:y+Math.abs(h)*h}function L9(c,o,h){let p=0;return c===10&&(p-=1e4),h&&(p+=150),c!==40&&c!==65288||(p+=50),o!==41&&o!==65289||(p+=50),p}function aE(c,o,h,p,y,v){let w=null,C=oE(o,h,y,v);for(const A of p){const O=oE(o-A.x,h,y,v)+A.badness;O<=C&&(w=A,C=O)}return{index:c,x:o,priorBreak:w,badness:C}}function lE(c){return c?lE(c.priorBreak).concat(c.index):[]}function j_(c,o,h,p,y,v){if(!c)return[];const w=[],C=function(N,$,q,G,X,ie){let ae=0;for(let be=0;be<N.length();be++){const pe=N.getSection(be);ae+=sE(N.getCharCode(be),pe,G,X,$,ie)}return ae/Math.max(1,Math.ceil(ae/q))}(c,o,h,p,y,v),A=c.text.indexOf("​")>=0;let O=0;for(let N=0;N<c.length();N++){const $=c.getSection(N),q=c.getCharCode(N);if(Vm[q]||(O+=sE(q,$,p,y,o,v)),N<c.length()-1){const G=!((R=q)<11904)&&(!!Jt["CJK Compatibility Forms"](R)||!!Jt["CJK Compatibility"](R)||!!Jt["CJK Strokes"](R)||!!Jt["CJK Symbols and Punctuation"](R)||!!Jt["Enclosed CJK Letters and Months"](R)||!!Jt["Halfwidth and Fullwidth Forms"](R)||!!Jt["Ideographic Description Characters"](R)||!!Jt["Vertical Forms"](R)||km.test(String.fromCodePoint(R)));(z9[q]||G||$.imageName||N!==c.length()-2&&R9[c.getCharCode(N+1)])&&w.push(aE(N+1,O,C,w,L9(q,c.getCharCode(N+1),G&&A),!1))}}var R;return lE(aE(c.length(),O,C,w,0,!0))}function U_(c){let o=.5,h=.5;switch(c){case"right":case"top-right":case"bottom-right":o=1;break;case"left":case"top-left":case"bottom-left":o=0}switch(c){case"bottom":case"bottom-right":case"bottom-left":h=1;break;case"top":case"top-right":case"top-left":h=0}return{horizontalAlign:o,verticalAlign:h}}function N9(c,o,h,p,y){if(!p&&!y)return;const v=c[h],w=(c[h].x+v.metrics.advance*v.scale)*p;for(let C=o;C<=h;C++)c[C].x-=w,c[C].y+=y}function B9(c,o,h){const{horizontalAlign:p,verticalAlign:y}=U_(h),v=o[0]-c.displaySize[0]*p,w=o[1]-c.displaySize[1]*y;return{image:c,top:w,bottom:w+c.displaySize[1],left:v,right:v+c.displaySize[0]}}function cE(c){var o,h;let p=c.left,y=c.top,v=c.right-p,w=c.bottom-y;const C=(o=c.image.textFitWidth)!==null&&o!==void 0?o:"stretchOrShrink",A=(h=c.image.textFitHeight)!==null&&h!==void 0?h:"stretchOrShrink",O=(c.image.content[2]-c.image.content[0])/(c.image.content[3]-c.image.content[1]);if(A==="proportional"){if(C==="stretchOnly"&&v/w<O||C==="proportional"){const R=Math.ceil(w*O);p*=R/v,v=R}}else if(C==="proportional"&&A==="stretchOnly"&&O!==0&&v/w>O){const R=Math.ceil(v/O);y*=R/w,w=R}return{x1:p,y1:y,x2:p+v,y2:y+w}}function uE(c,o,h,p,y,v){const w=c.image;let C;if(w.content){const ie=w.content,ae=w.pixelRatio||1;C=[ie[0]/ae,ie[1]/ae,w.displaySize[0]-ie[2]/ae,w.displaySize[1]-ie[3]/ae]}const A=o.left*v,O=o.right*v;let R,N,$,q;h==="width"||h==="both"?(q=y[0]+A-p[3],N=y[0]+O+p[1]):(q=y[0]+(A+O-w.displaySize[0])/2,N=q+w.displaySize[0]);const G=o.top*v,X=o.bottom*v;return h==="height"||h==="both"?(R=y[1]+G-p[0],$=y[1]+X+p[2]):(R=y[1]+(G+X-w.displaySize[1])/2,$=R+w.displaySize[1]),{image:w,top:R,right:N,bottom:$,left:q,collisionPadding:C}}const Xd=255,mo=128,rl=Xd*mo;function hE(c,o){const{expression:h}=o;if(h.kind==="constant")return{kind:"constant",layoutSize:h.evaluate(new Ln(c+1))};if(h.kind==="source")return{kind:"source"};{const{zoomStops:p,interpolationType:y}=h;let v=0;for(;v<p.length&&p[v]<=c;)v++;v=Math.max(0,v-1);let w=v;for(;w<p.length&&p[w]<c+1;)w++;w=Math.min(p.length-1,w);const C=p[v],A=p[w];return h.kind==="composite"?{kind:"composite",minZoom:C,maxZoom:A,interpolationType:y}:{kind:"camera",minZoom:C,maxZoom:A,minSize:h.evaluate(new Ln(C)),maxSize:h.evaluate(new Ln(A)),interpolationType:y}}}function H_(c,o,h){let p="never";const y=c.get(o);return y?p=y:c.get(h)&&(p="always"),p}const F9=nl.VectorTileFeature.types,V9=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function $m(c,o,h,p,y,v,w,C,A,O,R,N,$){const q=C?Math.min(rl,Math.round(C[0])):0,G=C?Math.min(rl,Math.round(C[1])):0;c.emplaceBack(o,h,Math.round(32*p),Math.round(32*y),v,w,(q<<1)+(A?1:0),G,16*O,16*R,256*N,256*$)}function q_(c,o,h){c.emplaceBack(o.x,o.y,h),c.emplaceBack(o.x,o.y,h),c.emplaceBack(o.x,o.y,h),c.emplaceBack(o.x,o.y,h)}function $9(c){for(const o of c.sections)if(b_(o.text))return!0;return!1}class W_{constructor(o){this.layoutVertexArray=new Du,this.indexArray=new is,this.programConfigurations=o,this.segments=new Qt,this.dynamicLayoutVertexArray=new Nd,this.opacityVertexArray=new Vr,this.hasVisibleVertices=!1,this.placedSymbolArray=new Nn}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(o,h,p,y){this.isEmpty()||(p&&(this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,y9.members),this.indexBuffer=o.createIndexBuffer(this.indexArray,h),this.dynamicLayoutVertexBuffer=o.createVertexBuffer(this.dynamicLayoutVertexArray,_9.members,!0),this.opacityVertexBuffer=o.createVertexBuffer(this.opacityVertexArray,V9,!0),this.opacityVertexBuffer.itemSize=1),(p||y)&&this.programConfigurations.upload(o))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}ot("SymbolBuffers",W_);class G_{constructor(o,h,p){this.layoutVertexArray=new o,this.layoutAttributes=h,this.indexArray=new p,this.segments=new Qt,this.collisionVertexArray=new po}upload(o){this.layoutVertexBuffer=o.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=o.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=o.createVertexBuffer(this.collisionVertexArray,b9.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}ot("CollisionBuffers",G_);class Hu{constructor(o){this.collisionBoxArray=o.collisionBoxArray,this.zoom=o.zoom,this.overscaling=o.overscaling,this.layers=o.layers,this.layerIds=this.layers.map(w=>w.id),this.index=o.index,this.pixelRatio=o.pixelRatio,this.sourceLayerIndex=o.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=C_([]),this.placementViewportMatrix=C_([]);const h=this.layers[0]._unevaluatedLayout._values;this.textSizeData=hE(this.zoom,h["text-size"]),this.iconSizeData=hE(this.zoom,h["icon-size"]);const p=this.layers[0].layout,y=p.get("symbol-sort-key"),v=p.get("symbol-z-order");this.canOverlap=H_(p,"text-overlap","text-allow-overlap")!=="never"||H_(p,"icon-overlap","icon-allow-overlap")!=="never"||p.get("text-ignore-placement")||p.get("icon-ignore-placement"),this.sortFeaturesByKey=v!=="viewport-y"&&!y.isConstant(),this.sortFeaturesByY=(v==="viewport-y"||v==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,p.get("symbol-placement")==="point"&&(this.writingModes=p.get("text-writing-mode").map(w=>u.ah[w])),this.stateDependentLayerIds=this.layers.filter(w=>w.isStateDependent()).map(w=>w.id),this.sourceID=o.sourceID}createArrays(){this.text=new W_(new ic(this.layers,this.zoom,o=>/^text/.test(o))),this.icon=new W_(new ic(this.layers,this.zoom,o=>/^icon/.test(o))),this.glyphOffsetArray=new Bn,this.lineVertexArray=new Ii,this.symbolInstances=new Yt,this.textAnchorOffsets=new Fn}calculateGlyphDependencies(o,h,p,y,v){for(let w=0;w<o.length;w++)if(h[o.charCodeAt(w)]=!0,(p||y)&&v){const C=Gd[o.charAt(w)];C&&(h[C.charCodeAt(0)]=!0)}}populate(o,h,p){const y=this.layers[0],v=y.layout,w=v.get("text-font"),C=v.get("text-field"),A=v.get("icon-image"),O=(C.value.kind!=="constant"||C.value.value instanceof fr&&!C.value.value.isEmpty()||C.value.value.toString().length>0)&&(w.value.kind!=="constant"||w.value.value.length>0),R=A.value.kind!=="constant"||!!A.value.value||Object.keys(A.parameters).length>0,N=v.get("symbol-sort-key");if(this.features=[],!O&&!R)return;const $=h.iconDependencies,q=h.glyphDependencies,G=h.availableImages,X=new Ln(this.zoom);for(const{feature:ie,id:ae,index:be,sourceLayerIndex:pe}of o){const ye=y._featureFilter.needGeometry,Ee=sc(ie,ye);if(!y._featureFilter.filter(X,Ee,p))continue;let Ne,tt;if(ye||(Ee.geometry=rc(ie)),O){const Qe=y.getValueAndResolveTokens("text-field",Ee,p,G),Ze=fr.factory(Qe),mt=this.hasRTLText=this.hasRTLText||$9(Ze);(!mt||_r.getRTLTextPluginStatus()==="unavailable"||mt&&_r.isParsed())&&(Ne=v9(Ze,y,Ee))}if(R){const Qe=y.getValueAndResolveTokens("icon-image",Ee,p,G);tt=Qe instanceof gr?Qe:gr.fromString(Qe)}if(!Ne&&!tt)continue;const St=this.sortFeaturesByKey?N.evaluate(Ee,{},p):void 0;if(this.features.push({id:ae,text:Ne,icon:tt,index:be,sourceLayerIndex:pe,geometry:Ee.geometry,properties:ie.properties,type:F9[ie.type],sortKey:St}),tt&&($[tt.name]=!0),Ne){const Qe=w.evaluate(Ee,{},p).join(","),Ze=v.get("text-rotation-alignment")!=="viewport"&&v.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(u.ah.vertical)>=0;for(const mt of Ne.sections)if(mt.image)$[mt.image.name]=!0;else{const ct=Dd(Ne.toString()),rt=mt.fontStack||Qe,De=q[rt]=q[rt]||{};this.calculateGlyphDependencies(mt.text,De,Ze,this.allowVerticalPlacement,ct)}}}v.get("symbol-placement")==="line"&&(this.features=function(ie){const ae={},be={},pe=[];let ye=0;function Ee(Qe){pe.push(ie[Qe]),ye++}function Ne(Qe,Ze,mt){const ct=be[Qe];return delete be[Qe],be[Ze]=ct,pe[ct].geometry[0].pop(),pe[ct].geometry[0]=pe[ct].geometry[0].concat(mt[0]),ct}function tt(Qe,Ze,mt){const ct=ae[Ze];return delete ae[Ze],ae[Qe]=ct,pe[ct].geometry[0].shift(),pe[ct].geometry[0]=mt[0].concat(pe[ct].geometry[0]),ct}function St(Qe,Ze,mt){const ct=mt?Ze[0][Ze[0].length-1]:Ze[0][0];return`${Qe}:${ct.x}:${ct.y}`}for(let Qe=0;Qe<ie.length;Qe++){const Ze=ie[Qe],mt=Ze.geometry,ct=Ze.text?Ze.text.toString():null;if(!ct){Ee(Qe);continue}const rt=St(ct,mt),De=St(ct,mt,!0);if(rt in be&&De in ae&&be[rt]!==ae[De]){const yt=tt(rt,De,mt),ft=Ne(rt,De,pe[yt].geometry);delete ae[rt],delete be[De],be[St(ct,pe[ft].geometry,!0)]=ft,pe[yt].geometry=null}else rt in be?Ne(rt,De,mt):De in ae?tt(rt,De,mt):(Ee(Qe),ae[rt]=ye-1,be[De]=ye-1)}return pe.filter(Qe=>Qe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((ie,ae)=>ie.sortKey-ae.sortKey)}update(o,h,p){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(o,h,this.layers,p),this.icon.programConfigurations.updatePaintArrays(o,h,this.layers,p))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(o){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(o),this.iconCollisionBox.upload(o)),this.text.upload(o,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(o,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(o,h){const p=this.lineVertexArray.length;if(o.segment!==void 0){let y=o.dist(h[o.segment+1]),v=o.dist(h[o.segment]);const w={};for(let C=o.segment+1;C<h.length;C++)w[C]={x:h[C].x,y:h[C].y,tileUnitDistanceFromAnchor:y},C<h.length-1&&(y+=h[C+1].dist(h[C]));for(let C=o.segment||0;C>=0;C--)w[C]={x:h[C].x,y:h[C].y,tileUnitDistanceFromAnchor:v},C>0&&(v+=h[C-1].dist(h[C]));for(let C=0;C<h.length;C++){const A=w[C];this.lineVertexArray.emplaceBack(A.x,A.y,A.tileUnitDistanceFromAnchor)}}return{lineStartIndex:p,lineLength:this.lineVertexArray.length-p}}addSymbols(o,h,p,y,v,w,C,A,O,R,N,$){const q=o.indexArray,G=o.layoutVertexArray,X=o.segments.prepareSegment(4*h.length,G,q,this.canOverlap?w.sortKey:void 0),ie=this.glyphOffsetArray.length,ae=X.vertexLength,be=this.allowVerticalPlacement&&C===u.ah.vertical?Math.PI/2:0,pe=w.text&&w.text.sections;for(let ye=0;ye<h.length;ye++){const{tl:Ee,tr:Ne,bl:tt,br:St,tex:Qe,pixelOffsetTL:Ze,pixelOffsetBR:mt,minFontScaleX:ct,minFontScaleY:rt,glyphOffset:De,isSDF:yt,sectionIndex:ft}=h[ye],It=X.vertexLength,Pn=De[1];$m(G,A.x,A.y,Ee.x,Pn+Ee.y,Qe.x,Qe.y,p,yt,Ze.x,Ze.y,ct,rt),$m(G,A.x,A.y,Ne.x,Pn+Ne.y,Qe.x+Qe.w,Qe.y,p,yt,mt.x,Ze.y,ct,rt),$m(G,A.x,A.y,tt.x,Pn+tt.y,Qe.x,Qe.y+Qe.h,p,yt,Ze.x,mt.y,ct,rt),$m(G,A.x,A.y,St.x,Pn+St.y,Qe.x+Qe.w,Qe.y+Qe.h,p,yt,mt.x,mt.y,ct,rt),q_(o.dynamicLayoutVertexArray,A,be),q.emplaceBack(It,It+1,It+2),q.emplaceBack(It+1,It+2,It+3),X.vertexLength+=4,X.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(De[0]),ye!==h.length-1&&ft===h[ye+1].sectionIndex||o.programConfigurations.populatePaintArrays(G.length,w,w.index,{},$,pe&&pe[ft])}o.placedSymbolArray.emplaceBack(A.x,A.y,ie,this.glyphOffsetArray.length-ie,ae,O,R,A.segment,p?p[0]:0,p?p[1]:0,y[0],y[1],C,0,!1,0,N)}_addCollisionDebugVertex(o,h,p,y,v,w){return h.emplaceBack(0,0),o.emplaceBack(p.x,p.y,y,v,Math.round(w.x),Math.round(w.y))}addCollisionDebugVertices(o,h,p,y,v,w,C){const A=v.segments.prepareSegment(4,v.layoutVertexArray,v.indexArray),O=A.vertexLength,R=v.layoutVertexArray,N=v.collisionVertexArray,$=C.anchorX,q=C.anchorY;this._addCollisionDebugVertex(R,N,w,$,q,new E(o,h)),this._addCollisionDebugVertex(R,N,w,$,q,new E(p,h)),this._addCollisionDebugVertex(R,N,w,$,q,new E(p,y)),this._addCollisionDebugVertex(R,N,w,$,q,new E(o,y)),A.vertexLength+=4;const G=v.indexArray;G.emplaceBack(O,O+1),G.emplaceBack(O+1,O+2),G.emplaceBack(O+2,O+3),G.emplaceBack(O+3,O),A.primitiveLength+=4}addDebugCollisionBoxes(o,h,p,y){for(let v=o;v<h;v++){const w=this.collisionBoxArray.get(v);this.addCollisionDebugVertices(w.x1,w.y1,w.x2,w.y2,y?this.textCollisionBox:this.iconCollisionBox,w.anchorPoint,p)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new G_($r,ZS.members,ki),this.iconCollisionBox=new G_($r,ZS.members,ki);for(let o=0;o<this.symbolInstances.length;o++){const h=this.symbolInstances.get(o);this.addDebugCollisionBoxes(h.textBoxStartIndex,h.textBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.verticalTextBoxStartIndex,h.verticalTextBoxEndIndex,h,!0),this.addDebugCollisionBoxes(h.iconBoxStartIndex,h.iconBoxEndIndex,h,!1),this.addDebugCollisionBoxes(h.verticalIconBoxStartIndex,h.verticalIconBoxEndIndex,h,!1)}}_deserializeCollisionBoxesForSymbol(o,h,p,y,v,w,C,A,O){const R={};for(let N=h;N<p;N++){const $=o.get(N);R.textBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.textFeatureIndex=$.featureIndex;break}for(let N=y;N<v;N++){const $=o.get(N);R.verticalTextBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.verticalTextFeatureIndex=$.featureIndex;break}for(let N=w;N<C;N++){const $=o.get(N);R.iconBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.iconFeatureIndex=$.featureIndex;break}for(let N=A;N<O;N++){const $=o.get(N);R.verticalIconBox={x1:$.x1,y1:$.y1,x2:$.x2,y2:$.y2,anchorPointX:$.anchorPointX,anchorPointY:$.anchorPointY},R.verticalIconFeatureIndex=$.featureIndex;break}return R}deserializeCollisionBoxes(o){this.collisionArrays=[];for(let h=0;h<this.symbolInstances.length;h++){const p=this.symbolInstances.get(h);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(o,p.textBoxStartIndex,p.textBoxEndIndex,p.verticalTextBoxStartIndex,p.verticalTextBoxEndIndex,p.iconBoxStartIndex,p.iconBoxEndIndex,p.verticalIconBoxStartIndex,p.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}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(o,h){const p=o.placedSymbolArray.get(h),y=p.vertexStartIndex+4*p.numGlyphs;for(let v=p.vertexStartIndex;v<y;v+=4)o.indexArray.emplaceBack(v,v+1,v+2),o.indexArray.emplaceBack(v+1,v+2,v+3)}getSortedSymbolIndexes(o){if(this.sortedAngle===o&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const h=Math.sin(o),p=Math.cos(o),y=[],v=[],w=[];for(let C=0;C<this.symbolInstances.length;++C){w.push(C);const A=this.symbolInstances.get(C);y.push(0|Math.round(h*A.anchorX+p*A.anchorY)),v.push(A.featureIndex)}return w.sort((C,A)=>y[C]-y[A]||v[A]-v[C]),w}addToSortKeyRanges(o,h){const p=this.sortKeyRanges[this.sortKeyRanges.length-1];p&&p.sortKey===h?p.symbolInstanceEnd=o+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:o,symbolInstanceEnd:o+1})}sortFeatures(o){if(this.sortFeaturesByY&&this.sortedAngle!==o&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(o),this.sortedAngle=o,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const p=this.symbolInstances.get(h);this.featureSortOrder.push(p.featureIndex),[p.rightJustifiedTextSymbolIndex,p.centerJustifiedTextSymbolIndex,p.leftJustifiedTextSymbolIndex].forEach((y,v,w)=>{y>=0&&w.indexOf(y)===v&&this.addIndicesForPlacedSymbol(this.text,y)}),p.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,p.verticalPlacedTextSymbolIndex),p.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.placedIconSymbolIndex),p.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,p.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let dE,pE;ot("SymbolBucket",Hu,{omit:["layers","collisionBoxArray","features","compareText"]}),Hu.MAX_GLYPHS=65535,Hu.addDynamicAttributes=q_;var Z_={get paint(){return pE=pE||new x({"icon-opacity":new Et(we.paint_symbol["icon-opacity"]),"icon-color":new Et(we.paint_symbol["icon-color"]),"icon-halo-color":new Et(we.paint_symbol["icon-halo-color"]),"icon-halo-width":new Et(we.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Et(we.paint_symbol["icon-halo-blur"]),"icon-translate":new dt(we.paint_symbol["icon-translate"]),"icon-translate-anchor":new dt(we.paint_symbol["icon-translate-anchor"]),"text-opacity":new Et(we.paint_symbol["text-opacity"]),"text-color":new Et(we.paint_symbol["text-color"],{runtimeType:xt,getOverride:c=>c.textColor,hasOverride:c=>!!c.textColor}),"text-halo-color":new Et(we.paint_symbol["text-halo-color"]),"text-halo-width":new Et(we.paint_symbol["text-halo-width"]),"text-halo-blur":new Et(we.paint_symbol["text-halo-blur"]),"text-translate":new dt(we.paint_symbol["text-translate"]),"text-translate-anchor":new dt(we.paint_symbol["text-translate-anchor"])})},get layout(){return dE=dE||new x({"symbol-placement":new dt(we.layout_symbol["symbol-placement"]),"symbol-spacing":new dt(we.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new dt(we.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Et(we.layout_symbol["symbol-sort-key"]),"symbol-z-order":new dt(we.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new dt(we.layout_symbol["icon-allow-overlap"]),"icon-overlap":new dt(we.layout_symbol["icon-overlap"]),"icon-ignore-placement":new dt(we.layout_symbol["icon-ignore-placement"]),"icon-optional":new dt(we.layout_symbol["icon-optional"]),"icon-rotation-alignment":new dt(we.layout_symbol["icon-rotation-alignment"]),"icon-size":new Et(we.layout_symbol["icon-size"]),"icon-text-fit":new dt(we.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new dt(we.layout_symbol["icon-text-fit-padding"]),"icon-image":new Et(we.layout_symbol["icon-image"]),"icon-rotate":new Et(we.layout_symbol["icon-rotate"]),"icon-padding":new Et(we.layout_symbol["icon-padding"]),"icon-keep-upright":new dt(we.layout_symbol["icon-keep-upright"]),"icon-offset":new Et(we.layout_symbol["icon-offset"]),"icon-anchor":new Et(we.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new dt(we.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new dt(we.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new dt(we.layout_symbol["text-rotation-alignment"]),"text-field":new Et(we.layout_symbol["text-field"]),"text-font":new Et(we.layout_symbol["text-font"]),"text-size":new Et(we.layout_symbol["text-size"]),"text-max-width":new Et(we.layout_symbol["text-max-width"]),"text-line-height":new dt(we.layout_symbol["text-line-height"]),"text-letter-spacing":new Et(we.layout_symbol["text-letter-spacing"]),"text-justify":new Et(we.layout_symbol["text-justify"]),"text-radial-offset":new Et(we.layout_symbol["text-radial-offset"]),"text-variable-anchor":new dt(we.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new Et(we.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new Et(we.layout_symbol["text-anchor"]),"text-max-angle":new dt(we.layout_symbol["text-max-angle"]),"text-writing-mode":new dt(we.layout_symbol["text-writing-mode"]),"text-rotate":new Et(we.layout_symbol["text-rotate"]),"text-padding":new dt(we.layout_symbol["text-padding"]),"text-keep-upright":new dt(we.layout_symbol["text-keep-upright"]),"text-transform":new Et(we.layout_symbol["text-transform"]),"text-offset":new Et(we.layout_symbol["text-offset"]),"text-allow-overlap":new dt(we.layout_symbol["text-allow-overlap"]),"text-overlap":new dt(we.layout_symbol["text-overlap"]),"text-ignore-placement":new dt(we.layout_symbol["text-ignore-placement"]),"text-optional":new dt(we.layout_symbol["text-optional"])})}};class fE{constructor(o){if(o.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=o.property.overrides?o.property.overrides.runtimeType:Ts,this.defaultValue=o}evaluate(o){if(o.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(o.formattedSection))return h.getOverride(o.formattedSection)}return o.feature&&o.featureState?this.defaultValue.evaluate(o.feature,o.featureState):this.defaultValue.property.specification.default}eachChild(o){this.defaultValue.isConstant()||o(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ot("FormatSectionOverride",fE,{omit:["defaultValue"]});class jm extends d{constructor(o){super(o,Z_)}recalculate(o,h){if(super.recalculate(o,h),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 p=this.layout.get("text-writing-mode");if(p){const y=[];for(const v of p)y.indexOf(v)<0&&y.push(v);this.layout._values["text-writing-mode"]=y}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(o,h,p,y){const v=this.layout.get(o).evaluate(h,{},p,y),w=this._unevaluatedLayout._values[o];return w.isDataDriven()||yu(w.value)||!v?v:function(C,A){return A.replace(/{([^{}]+)}/g,(O,R)=>C&&R in C?String(C[R]):"")}(h.properties,v)}createBucket(o){return new Hu(o)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const o of Z_.paint.overridableProperties){if(!jm.hasPaintOverride(this.layout,o))continue;const h=this.paint.get(o),p=new fE(h),y=new gu(p,h.property.specification);let v=null;v=h.value.kind==="constant"||h.value.kind==="source"?new Va("source",y):new $a("composite",y,h.value.zoomStops),this.paint._values[o]=new Ps(h.property,v,h.parameters)}}_handleOverridablePaintPropertyUpdate(o,h,p){return!(!this.layout||h.isDataDriven()||p.isDataDriven())&&jm.hasPaintOverride(this.layout,o)}static hasPaintOverride(o,h){const p=o.get("text-field"),y=Z_.paint.properties[h];let v=!1;const w=C=>{for(const A of C)if(y.overrides&&y.overrides.hasOverride(A))return void(v=!0)};if(p.value.kind==="constant"&&p.value.value instanceof fr)w(p.value.value.sections);else if(p.value.kind==="source"){const C=O=>{v||(O instanceof Kr&&si(O.value)===Kn?w(O.value.sections):O instanceof au?w(O.sections):O.eachChild(C))},A=p.value;A._styleExpression&&C(A._styleExpression.expression)}return v}}let mE;var j9={get paint(){return mE=mE||new x({"background-color":new dt(we.paint_background["background-color"]),"background-pattern":new Pu(we.paint_background["background-pattern"]),"background-opacity":new dt(we.paint_background["background-opacity"])})}};class U9 extends d{constructor(o){super(o,j9)}}let gE;var H9={get paint(){return gE=gE||new x({"raster-opacity":new dt(we.paint_raster["raster-opacity"]),"raster-hue-rotate":new dt(we.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new dt(we.paint_raster["raster-brightness-min"]),"raster-brightness-max":new dt(we.paint_raster["raster-brightness-max"]),"raster-saturation":new dt(we.paint_raster["raster-saturation"]),"raster-contrast":new dt(we.paint_raster["raster-contrast"]),"raster-resampling":new dt(we.paint_raster["raster-resampling"]),"raster-fade-duration":new dt(we.paint_raster["raster-fade-duration"])})}};class q9 extends d{constructor(o){super(o,H9)}}class W9 extends d{constructor(o){super(o,{}),this.onAdd=h=>{this.implementation.onAdd&&this.implementation.onAdd(h,h.painter.context.gl)},this.onRemove=h=>{this.implementation.onRemove&&this.implementation.onRemove(h,h.painter.context.gl)},this.implementation=o}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 G9{constructor(o){this._methodToThrottle=o,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const Y_=63710088e-1;class sl{constructor(o,h){if(isNaN(o)||isNaN(h))throw new Error(`Invalid LngLat object: (${o}, ${h})`);if(this.lng=+o,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new sl(ke(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(o){const h=Math.PI/180,p=this.lat*h,y=o.lat*h,v=Math.sin(p)*Math.sin(y)+Math.cos(p)*Math.cos(y)*Math.cos((o.lng-this.lng)*h);return Y_*Math.acos(Math.min(v,1))}static convert(o){if(o instanceof sl)return o;if(Array.isArray(o)&&(o.length===2||o.length===3))return new sl(Number(o[0]),Number(o[1]));if(!Array.isArray(o)&&typeof o=="object"&&o!==null)return new sl(Number("lng"in o?o.lng:o.lon),Number(o.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const yE=2*Math.PI*Y_;function _E(c){return yE*Math.cos(c*Math.PI/180)}function bE(c){return(180+c)/360}function xE(c){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+c*Math.PI/360)))/360}function vE(c,o){return c/_E(o)}function X_(c){return 360/Math.PI*Math.atan(Math.exp((180-360*c)*Math.PI/180))-90}class Kd{constructor(o,h,p=0){this.x=+o,this.y=+h,this.z=+p}static fromLngLat(o,h=0){const p=sl.convert(o);return new Kd(bE(p.lng),xE(p.lat),vE(h,p.lat))}toLngLat(){return new sl(360*this.x-180,X_(this.y))}toAltitude(){return this.z*_E(X_(this.y))}meterInMercatorCoordinateUnits(){return 1/yE*(o=X_(this.y),1/Math.cos(o*Math.PI/180));var o}}function wE(c,o,h){var p=2*Math.PI*6378137/256/Math.pow(2,h);return[c*p-2*Math.PI*6378137/2,o*p-2*Math.PI*6378137/2]}class K_{constructor(o,h,p){if(!function(y,v,w){return!(y<0||y>25||w<0||w>=Math.pow(2,y)||v<0||v>=Math.pow(2,y))}(o,h,p))throw new Error(`x=${h}, y=${p}, z=${o} outside of bounds. 0<=x<${Math.pow(2,o)}, 0<=y<${Math.pow(2,o)} 0<=z<=25 `);this.z=o,this.x=h,this.y=p,this.key=Jd(0,o,o,h,p)}equals(o){return this.z===o.z&&this.x===o.x&&this.y===o.y}url(o,h,p){const y=(w=this.y,C=this.z,A=wE(256*(v=this.x),256*(w=Math.pow(2,C)-w-1),C),O=wE(256*(v+1),256*(w+1),C),A[0]+","+A[1]+","+O[0]+","+O[1]);var v,w,C,A,O;const R=function(N,$,q){let G,X="";for(let ie=N;ie>0;ie--)G=1<<ie-1,X+=($&G?1:0)+(q&G?2:0);return X}(this.z,this.x,this.y);return o[(this.x+this.y)%o.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(p==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,h>1?"@2x":"").replace(/{quadkey}/g,R).replace(/{bbox-epsg-3857}/g,y)}isChildOf(o){const h=this.z-o.z;return h>0&&o.x===this.x>>h&&o.y===this.y>>h}getTilePoint(o){const h=Math.pow(2,this.z);return new E((o.x*h-this.x)*oi,(o.y*h-this.y)*oi)}toString(){return`${this.z}/${this.x}/${this.y}`}}class kE{constructor(o,h){this.wrap=o,this.canonical=h,this.key=Jd(o,h.z,h.z,h.x,h.y)}}class ss{constructor(o,h,p,y,v){if(o<p)throw new Error(`overscaledZ should be >= z; overscaledZ = ${o}; z = ${p}`);this.overscaledZ=o,this.wrap=h,this.canonical=new K_(p,+y,+v),this.key=Jd(h,o,p,y,v)}clone(){return new ss(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(o){return this.overscaledZ===o.overscaledZ&&this.wrap===o.wrap&&this.canonical.equals(o.canonical)}scaledTo(o){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const h=this.canonical.z-o;return o>this.canonical.z?new ss(o,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new ss(o,this.wrap,o,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(o,h){if(o>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${o}; overscaledZ = ${this.overscaledZ}`);const p=this.canonical.z-o;return o>this.canonical.z?Jd(this.wrap*+h,o,this.canonical.z,this.canonical.x,this.canonical.y):Jd(this.wrap*+h,o,o,this.canonical.x>>p,this.canonical.y>>p)}isChildOf(o){if(o.wrap!==this.wrap)return!1;const h=this.canonical.z-o.canonical.z;return o.overscaledZ===0||o.overscaledZ<this.overscaledZ&&o.canonical.x===this.canonical.x>>h&&o.canonical.y===this.canonical.y>>h}children(o){if(this.overscaledZ>=o)return[new ss(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,p=2*this.canonical.x,y=2*this.canonical.y;return[new ss(h,this.wrap,h,p,y),new ss(h,this.wrap,h,p+1,y),new ss(h,this.wrap,h,p,y+1),new ss(h,this.wrap,h,p+1,y+1)]}isLessThan(o){return this.wrap<o.wrap||!(this.wrap>o.wrap)&&(this.overscaledZ<o.overscaledZ||!(this.overscaledZ>o.overscaledZ)&&(this.canonical.x<o.canonical.x||!(this.canonical.x>o.canonical.x)&&this.canonical.y<o.canonical.y))}wrapped(){return new ss(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(o){return new ss(this.overscaledZ,o,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new kE(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(o){return this.canonical.getTilePoint(new Kd(o.x-this.wrap,o.y))}}function Jd(c,o,h,p,y){(c*=2)<0&&(c=-1*c-1);const v=1<<h;return(v*v*c+v*y+p).toString(36)+h.toString(36)+o.toString(36)}ot("CanonicalTileID",K_),ot("OverscaledTileID",ss,{omit:["posMatrix"]});class SE{constructor(o,h,p,y=1,v=1,w=1,C=0){if(this.uid=o,h.height!==h.width)throw new RangeError("DEM tiles must be square");if(p&&!["mapbox","terrarium","custom"].includes(p))return void ht(`"${p}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=h.height;const A=this.dim=h.height-2;switch(this.data=new Uint32Array(h.data.buffer),p){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=y,this.greenFactor=v,this.blueFactor=w,this.baseShift=C;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let O=0;O<A;O++)this.data[this._idx(-1,O)]=this.data[this._idx(0,O)],this.data[this._idx(A,O)]=this.data[this._idx(A-1,O)],this.data[this._idx(O,-1)]=this.data[this._idx(O,0)],this.data[this._idx(O,A)]=this.data[this._idx(O,A-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(A,-1)]=this.data[this._idx(A-1,0)],this.data[this._idx(-1,A)]=this.data[this._idx(0,A-1)],this.data[this._idx(A,A)]=this.data[this._idx(A-1,A-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let O=0;O<A;O++)for(let R=0;R<A;R++){const N=this.get(O,R);N>this.max&&(this.max=N),N<this.min&&(this.min=N)}}get(o,h){const p=new Uint8Array(this.data.buffer),y=4*this._idx(o,h);return this.unpack(p[y],p[y+1],p[y+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(o,h){if(o<-1||o>=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(o+1)}unpack(o,h,p){return o*this.redFactor+h*this.greenFactor+p*this.blueFactor-this.baseShift}getPixels(){return new rs({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(o,h,p){if(this.dim!==o.dim)throw new Error("dem dimension mismatch");let y=h*this.dim,v=h*this.dim+this.dim,w=p*this.dim,C=p*this.dim+this.dim;switch(h){case-1:y=v-1;break;case 1:v=y+1}switch(p){case-1:w=C-1;break;case 1:C=w+1}const A=-h*this.dim,O=-p*this.dim;for(let R=w;R<C;R++)for(let N=y;N<v;N++)this.data[this._idx(N,R)]=o.data[this._idx(N+A,R+O)]}}ot("DEMData",SE);class EE{constructor(o){this._stringToNumber={},this._numberToString=[];for(let h=0;h<o.length;h++){const p=o[h];this._stringToNumber[p]=h,this._numberToString[h]=p}}encode(o){return this._stringToNumber[o]}decode(o){if(o>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${o} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[o]}}class CE{constructor(o,h,p,y,v){this.type="Feature",this._vectorTileFeature=o,o._z=h,o._x=p,o._y=y,this.properties=o.properties,this.id=v}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(o){this._geometry=o}toJSON(){const o={geometry:this.geometry};for(const h in this)h!=="_geometry"&&h!=="_vectorTileFeature"&&(o[h]=this[h]);return o}}class TE{constructor(o,h){this.tileID=o,this.x=o.canonical.x,this.y=o.canonical.y,this.z=o.canonical.z,this.grid=new qa(oi,16,0),this.grid3D=new qa(oi,16,0),this.featureIndexArray=new qi,this.promoteId=h}insert(o,h,p,y,v,w){const C=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(p,y,v);const A=w?this.grid3D:this.grid;for(let O=0;O<h.length;O++){const R=h[O],N=[1/0,1/0,-1/0,-1/0];for(let $=0;$<R.length;$++){const q=R[$];N[0]=Math.min(N[0],q.x),N[1]=Math.min(N[1],q.y),N[2]=Math.max(N[2],q.x),N[3]=Math.max(N[3],q.y)}N[0]<oi&&N[1]<oi&&N[2]>=0&&N[3]>=0&&A.insert(C,N[0],N[1],N[2],N[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new nl.VectorTile(new F_(this.rawTileData)).layers,this.sourceLayerCoder=new EE(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(o,h,p,y){this.loadVTLayers();const v=o.params||{},w=oi/o.tileSize/o.scale,C=yd(v.filter),A=o.queryGeometry,O=o.queryPadding*w,R=AE(A),N=this.grid.query(R.minX-O,R.minY-O,R.maxX+O,R.maxY+O),$=AE(o.cameraQueryGeometry),q=this.grid3D.query($.minX-O,$.minY-O,$.maxX+O,$.maxY+O,(ie,ae,be,pe)=>function(ye,Ee,Ne,tt,St){for(const Ze of ye)if(Ee<=Ze.x&&Ne<=Ze.y&&tt>=Ze.x&&St>=Ze.y)return!0;const Qe=[new E(Ee,Ne),new E(Ee,St),new E(tt,St),new E(tt,Ne)];if(ye.length>2){for(const Ze of Qe)if(Nu(ye,Ze))return!0}for(let Ze=0;Ze<ye.length-1;Ze++)if(T7(ye[Ze],ye[Ze+1],Qe))return!0;return!1}(o.cameraQueryGeometry,ie-O,ae-O,be+O,pe+O));for(const ie of q)N.push(ie);N.sort(Z9);const G={};let X;for(let ie=0;ie<N.length;ie++){const ae=N[ie];if(ae===X)continue;X=ae;const be=this.featureIndexArray.get(ae);let pe=null;this.loadMatchingFeature(G,be.bucketIndex,be.sourceLayerIndex,be.featureIndex,C,v.layers,v.availableImages,h,p,y,(ye,Ee,Ne)=>(pe||(pe=rc(ye)),Ee.queryIntersectsFeature(A,ye,Ne,pe,this.z,o.transform,w,o.pixelPosMatrix)))}return G}loadMatchingFeature(o,h,p,y,v,w,C,A,O,R,N){const $=this.bucketLayerIDs[h];if(w&&!function(ie,ae){for(let be=0;be<ie.length;be++)if(ae.indexOf(ie[be])>=0)return!0;return!1}(w,$))return;const q=this.sourceLayerCoder.decode(p),G=this.vtLayers[q].feature(y);if(v.needGeometry){const ie=sc(G,!0);if(!v.filter(new Ln(this.tileID.overscaledZ),ie,this.tileID.canonical))return}else if(!v.filter(new Ln(this.tileID.overscaledZ),G))return;const X=this.getId(G,q);for(let ie=0;ie<$.length;ie++){const ae=$[ie];if(w&&w.indexOf(ae)<0)continue;const be=A[ae];if(!be)continue;let pe={};X&&R&&(pe=R.getState(be.sourceLayer||"_geojsonTileLayer",X));const ye=Me({},O[ae]);ye.paint=ME(ye.paint,be.paint,G,pe,C),ye.layout=ME(ye.layout,be.layout,G,pe,C);const Ee=!N||N(G,be,pe);if(!Ee)continue;const Ne=new CE(G,this.z,this.x,this.y,X);Ne.layer=ye;let tt=o[ae];tt===void 0&&(tt=o[ae]=[]),tt.push({featureIndex:y,feature:Ne,intersectionZ:Ee})}}lookupSymbolFeatures(o,h,p,y,v,w,C,A){const O={};this.loadVTLayers();const R=yd(v);for(const N of o)this.loadMatchingFeature(O,p,y,N,R,w,C,A,h);return O}hasLayer(o){for(const h of this.bucketLayerIDs)for(const p of h)if(o===p)return!0;return!1}getId(o,h){let p=o.id;return this.promoteId&&(p=o.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[h]],typeof p=="boolean"&&(p=Number(p))),p}}function ME(c,o,h,p,y){return Ie(c,(v,w)=>{const C=o instanceof ec?o.get(w):null;return C&&C.evaluate?C.evaluate(h,p,y):C})}function AE(c){let o=1/0,h=1/0,p=-1/0,y=-1/0;for(const v of c)o=Math.min(o,v.x),h=Math.min(h,v.y),p=Math.max(p,v.x),y=Math.max(y,v.y);return{minX:o,minY:h,maxX:p,maxY:y}}function Z9(c,o){return o-c}function PE(c,o,h,p,y){const v=[];for(let w=0;w<c.length;w++){const C=c[w];let A;for(let O=0;O<C.length-1;O++){let R=C[O],N=C[O+1];R.x<o&&N.x<o||(R.x<o?R=new E(o,R.y+(o-R.x)/(N.x-R.x)*(N.y-R.y))._round():N.x<o&&(N=new E(o,R.y+(o-R.x)/(N.x-R.x)*(N.y-R.y))._round()),R.y<h&&N.y<h||(R.y<h?R=new E(R.x+(h-R.y)/(N.y-R.y)*(N.x-R.x),h)._round():N.y<h&&(N=new E(R.x+(h-R.y)/(N.y-R.y)*(N.x-R.x),h)._round()),R.x>=p&&N.x>=p||(R.x>=p?R=new E(p,R.y+(p-R.x)/(N.x-R.x)*(N.y-R.y))._round():N.x>=p&&(N=new E(p,R.y+(p-R.x)/(N.x-R.x)*(N.y-R.y))._round()),R.y>=y&&N.y>=y||(R.y>=y?R=new E(R.x+(y-R.y)/(N.y-R.y)*(N.x-R.x),y)._round():N.y>=y&&(N=new E(R.x+(y-R.y)/(N.y-R.y)*(N.x-R.x),y)._round()),A&&R.equals(A[A.length-1])||(A=[R],v.push(A)),A.push(N)))))}}return v}ot("FeatureIndex",TE,{omit:["rawTileData","sourceLayerCoder"]});class ol extends E{constructor(o,h,p,y){super(o,h),this.angle=p,y!==void 0&&(this.segment=y)}clone(){return new ol(this.x,this.y,this.angle,this.segment)}}function IE(c,o,h,p,y){if(o.segment===void 0||h===0)return!0;let v=o,w=o.segment+1,C=0;for(;C>-h/2;){if(w--,w<0)return!1;C-=c[w].dist(v),v=c[w]}C+=c[w].dist(c[w+1]),w++;const A=[];let O=0;for(;C<h/2;){const R=c[w],N=c[w+1];if(!N)return!1;let $=c[w-1].angleTo(R)-R.angleTo(N);for($=Math.abs(($+3*Math.PI)%(2*Math.PI)-Math.PI),A.push({distance:C,angleDelta:$}),O+=$;C-A[0].distance>p;)O-=A.shift().angleDelta;if(O>y)return!1;w++,C+=R.dist(N)}return!0}function DE(c){let o=0;for(let h=0;h<c.length-1;h++)o+=c[h].dist(c[h+1]);return o}function OE(c,o,h){return c?.6*o*h:0}function zE(c,o){return Math.max(c?c.right-c.left:0,o?o.right-o.left:0)}function Y9(c,o,h,p,y,v){const w=OE(h,y,v),C=zE(h,p)*v;let A=0;const O=DE(c)/2;for(let R=0;R<c.length-1;R++){const N=c[R],$=c[R+1],q=N.dist($);if(A+q>O){const G=(O-A)/q,X=nr.number(N.x,$.x,G),ie=nr.number(N.y,$.y,G),ae=new ol(X,ie,$.angleTo(N),R);return ae._round(),!w||IE(c,ae,C,w,o)?ae:void 0}A+=q}}function X9(c,o,h,p,y,v,w,C,A){const O=OE(p,v,w),R=zE(p,y),N=R*w,$=c[0].x===0||c[0].x===A||c[0].y===0||c[0].y===A;return o-N<o/4&&(o=N+o/4),RE(c,$?o/2*C%o:(R/2+2*v)*w*C%o,o,O,h,N,$,!1,A)}function RE(c,o,h,p,y,v,w,C,A){const O=v/2,R=DE(c);let N=0,$=o-h,q=[];for(let G=0;G<c.length-1;G++){const X=c[G],ie=c[G+1],ae=X.dist(ie),be=ie.angleTo(X);for(;$+h<N+ae;){$+=h;const pe=($-N)/ae,ye=nr.number(X.x,ie.x,pe),Ee=nr.number(X.y,ie.y,pe);if(ye>=0&&ye<A&&Ee>=0&&Ee<A&&$-O>=0&&$+O<=R){const Ne=new ol(ye,Ee,be,G);Ne._round(),p&&!IE(c,Ne,v,p,y)||q.push(Ne)}}N+=ae}return C||q.length||w||(q=RE(c,N/2,h,p,y,v,w,!0,A)),q}ot("Anchor",ol);const qu=xr;function LE(c,o,h,p){const y=[],v=c.image,w=v.pixelRatio,C=v.paddedRect.w-2*qu,A=v.paddedRect.h-2*qu;let O={x1:c.left,y1:c.top,x2:c.right,y2:c.bottom};const R=v.stretchX||[[0,C]],N=v.stretchY||[[0,A]],$=(De,yt)=>De+yt[1]-yt[0],q=R.reduce($,0),G=N.reduce($,0),X=C-q,ie=A-G;let ae=0,be=q,pe=0,ye=G,Ee=0,Ne=X,tt=0,St=ie;if(v.content&&p){const De=v.content,yt=De[2]-De[0],ft=De[3]-De[1];(v.textFitWidth||v.textFitHeight)&&(O=cE(c)),ae=Um(R,0,De[0]),pe=Um(N,0,De[1]),be=Um(R,De[0],De[2]),ye=Um(N,De[1],De[3]),Ee=De[0]-ae,tt=De[1]-pe,Ne=yt-be,St=ft-ye}const Qe=O.x1,Ze=O.y1,mt=O.x2-Qe,ct=O.y2-Ze,rt=(De,yt,ft,It)=>{const Pn=Hm(De.stretch-ae,be,mt,Qe),Mn=qm(De.fixed-Ee,Ne,De.stretch,q),mi=Hm(yt.stretch-pe,ye,ct,Ze),Ds=qm(yt.fixed-tt,St,yt.stretch,G),Ri=Hm(ft.stretch-ae,be,mt,Qe),gi=qm(ft.fixed-Ee,Ne,ft.stretch,q),or=Hm(It.stretch-pe,ye,ct,Ze),ar=qm(It.fixed-tt,St,It.stretch,G),lr=new E(Pn,mi),ei=new E(Ri,mi),yi=new E(Ri,or),Gi=new E(Pn,or),Li=new E(Mn/w,Ds/w),cr=new E(gi/w,ar/w),Ni=o*Math.PI/180;if(Ni){const un=Math.sin(Ni),On=Math.cos(Ni),Vn=[On,-un,un,On];lr._matMult(Vn),ei._matMult(Vn),Gi._matMult(Vn),yi._matMult(Vn)}const as=De.stretch+De.fixed,vr=yt.stretch+yt.fixed;return{tl:lr,tr:ei,bl:Gi,br:yi,tex:{x:v.paddedRect.x+qu+as,y:v.paddedRect.y+qu+vr,w:ft.stretch+ft.fixed-as,h:It.stretch+It.fixed-vr},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Li,pixelOffsetBR:cr,minFontScaleX:Ne/w/mt,minFontScaleY:St/w/ct,isSDF:h}};if(p&&(v.stretchX||v.stretchY)){const De=NE(R,X,q),yt=NE(N,ie,G);for(let ft=0;ft<De.length-1;ft++){const It=De[ft],Pn=De[ft+1];for(let Mn=0;Mn<yt.length-1;Mn++)y.push(rt(It,yt[Mn],Pn,yt[Mn+1]))}}else y.push(rt({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:C+1},{fixed:0,stretch:A+1}));return y}function Um(c,o,h){let p=0;for(const y of c)p+=Math.max(o,Math.min(h,y[1]))-Math.max(o,Math.min(h,y[0]));return p}function NE(c,o,h){const p=[{fixed:-qu,stretch:0}];for(const[y,v]of c){const w=p[p.length-1];p.push({fixed:y-w.stretch,stretch:w.stretch}),p.push({fixed:y-w.stretch,stretch:w.stretch+(v-y)})}return p.push({fixed:o+qu,stretch:h}),p}function Hm(c,o,h,p){return c/o*h+p}function qm(c,o,h,p){return c-o*h/p}class Wm{constructor(o,h,p,y,v,w,C,A,O,R){var N;if(this.boxStartIndex=o.length,O){let $=w.top,q=w.bottom;const G=w.collisionPadding;G&&($-=G[1],q+=G[3]);let X=q-$;X>0&&(X=Math.max(10,X),this.circleDiameter=X)}else{const $=!((N=w.image)===null||N===void 0)&&N.content&&(w.image.textFitWidth||w.image.textFitHeight)?cE(w):{x1:w.left,y1:w.top,x2:w.right,y2:w.bottom};$.y1=$.y1*C-A[0],$.y2=$.y2*C+A[2],$.x1=$.x1*C-A[3],$.x2=$.x2*C+A[1];const q=w.collisionPadding;if(q&&($.x1-=q[0]*C,$.y1-=q[1]*C,$.x2+=q[2]*C,$.y2+=q[3]*C),R){const G=new E($.x1,$.y1),X=new E($.x2,$.y1),ie=new E($.x1,$.y2),ae=new E($.x2,$.y2),be=R*Math.PI/180;G._rotate(be),X._rotate(be),ie._rotate(be),ae._rotate(be),$.x1=Math.min(G.x,X.x,ie.x,ae.x),$.x2=Math.max(G.x,X.x,ie.x,ae.x),$.y1=Math.min(G.y,X.y,ie.y,ae.y),$.y2=Math.max(G.y,X.y,ie.y,ae.y)}o.emplaceBack(h.x,h.y,$.x1,$.y1,$.x2,$.y2,p,y,v)}this.boxEndIndex=o.length}}class K9{constructor(o=[],h=(p,y)=>p<y?-1:p>y?1:0){if(this.data=o,this.length=this.data.length,this.compare=h,this.length>0)for(let p=(this.length>>1)-1;p>=0;p--)this._down(p)}push(o){this.data.push(o),this._up(this.length++)}pop(){if(this.length===0)return;const o=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),o}peek(){return this.data[0]}_up(o){const{data:h,compare:p}=this,y=h[o];for(;o>0;){const v=o-1>>1,w=h[v];if(p(y,w)>=0)break;h[o]=w,o=v}h[o]=y}_down(o){const{data:h,compare:p}=this,y=this.length>>1,v=h[o];for(;o<y;){let w=1+(o<<1);const C=w+1;if(C<this.length&&p(h[C],h[w])<0&&(w=C),p(h[w],v)>=0)break;h[o]=h[w],o=w}h[o]=v}}function J9(c,o=1,h=!1){let p=1/0,y=1/0,v=-1/0,w=-1/0;const C=c[0];for(let q=0;q<C.length;q++){const G=C[q];(!q||G.x<p)&&(p=G.x),(!q||G.y<y)&&(y=G.y),(!q||G.x>v)&&(v=G.x),(!q||G.y>w)&&(w=G.y)}const A=Math.min(v-p,w-y);let O=A/2;const R=new K9([],Q9);if(A===0)return new E(p,y);for(let q=p;q<v;q+=A)for(let G=y;G<w;G+=A)R.push(new Wu(q+O,G+O,O,c));let N=function(q){let G=0,X=0,ie=0;const ae=q[0];for(let be=0,pe=ae.length,ye=pe-1;be<pe;ye=be++){const Ee=ae[be],Ne=ae[ye],tt=Ee.x*Ne.y-Ne.x*Ee.y;X+=(Ee.x+Ne.x)*tt,ie+=(Ee.y+Ne.y)*tt,G+=3*tt}return new Wu(X/G,ie/G,0,q)}(c),$=R.length;for(;R.length;){const q=R.pop();(q.d>N.d||!N.d)&&(N=q,h&&console.log("found best %d after %d probes",Math.round(1e4*q.d)/1e4,$)),q.max-N.d<=o||(O=q.h/2,R.push(new Wu(q.p.x-O,q.p.y-O,O,c)),R.push(new Wu(q.p.x+O,q.p.y-O,O,c)),R.push(new Wu(q.p.x-O,q.p.y+O,O,c)),R.push(new Wu(q.p.x+O,q.p.y+O,O,c)),$+=4)}return h&&(console.log(`num probes: ${$}`),console.log(`best distance: ${N.d}`)),N.p}function Q9(c,o){return o.max-c.max}function Wu(c,o,h,p){this.p=new E(c,o),this.h=h,this.d=function(y,v){let w=!1,C=1/0;for(let A=0;A<v.length;A++){const O=v[A];for(let R=0,N=O.length,$=N-1;R<N;$=R++){const q=O[R],G=O[$];q.y>y.y!=G.y>y.y&&y.x<(G.x-q.x)*(y.y-q.y)/(G.y-q.y)+q.x&&(w=!w),C=Math.min(C,xS(y,q,G))}}return(w?1:-1)*Math.sqrt(C)}(this.p,p),this.max=this.d+this.h*Math.SQRT2}var zi;u.aq=void 0,(zi=u.aq||(u.aq={}))[zi.center=1]="center",zi[zi.left=2]="left",zi[zi.right=3]="right",zi[zi.top=4]="top",zi[zi.bottom=5]="bottom",zi[zi["top-left"]=6]="top-left",zi[zi["top-right"]=7]="top-right",zi[zi["bottom-left"]=8]="bottom-left",zi[zi["bottom-right"]=9]="bottom-right";const al=7,J_=Number.POSITIVE_INFINITY;function BE(c,o){return o[1]!==J_?function(h,p,y){let v=0,w=0;switch(p=Math.abs(p),y=Math.abs(y),h){case"top-right":case"top-left":case"top":w=y-al;break;case"bottom-right":case"bottom-left":case"bottom":w=-y+al}switch(h){case"top-right":case"bottom-right":case"right":v=-p;break;case"top-left":case"bottom-left":case"left":v=p}return[v,w]}(c,o[0],o[1]):function(h,p){let y=0,v=0;p<0&&(p=0);const w=p/Math.SQRT2;switch(h){case"top-right":case"top-left":v=w-al;break;case"bottom-right":case"bottom-left":v=-w+al;break;case"bottom":v=-p+al;break;case"top":v=p-al}switch(h){case"top-right":case"bottom-right":y=-w;break;case"top-left":case"bottom-left":y=w;break;case"left":y=p;break;case"right":y=-p}return[y,v]}(c,o[0])}function FE(c,o,h){var p;const y=c.layout,v=(p=y.get("text-variable-anchor-offset"))===null||p===void 0?void 0:p.evaluate(o,{},h);if(v){const C=v.values,A=[];for(let O=0;O<C.length;O+=2){const R=A[O]=C[O],N=C[O+1].map($=>$*li);R.startsWith("top")?N[1]-=al:R.startsWith("bottom")&&(N[1]+=al),A[O+1]=N}return new Rr(A)}const w=y.get("text-variable-anchor");if(w){let C;C=c._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[y.get("text-radial-offset").evaluate(o,{},h)*li,J_]:y.get("text-offset").evaluate(o,{},h).map(O=>O*li);const A=[];for(const O of w)A.push(O,BE(O,C));return new Rr(A)}return null}function Q_(c){switch(c){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function eU(c,o,h,p,y,v,w,C,A,O,R){let N=v.textMaxSize.evaluate(o,{});N===void 0&&(N=w);const $=c.layers[0].layout,q=$.get("icon-offset").evaluate(o,{},R),G=$E(h.horizontal),X=w/24,ie=c.tilePixelRatio*X,ae=c.tilePixelRatio*N/24,be=c.tilePixelRatio*C,pe=c.tilePixelRatio*$.get("symbol-spacing"),ye=$.get("text-padding")*c.tilePixelRatio,Ee=function(De,yt,ft,It=1){const Pn=De.get("icon-padding").evaluate(yt,{},ft),Mn=Pn&&Pn.values;return[Mn[0]*It,Mn[1]*It,Mn[2]*It,Mn[3]*It]}($,o,R,c.tilePixelRatio),Ne=$.get("text-max-angle")/180*Math.PI,tt=$.get("text-rotation-alignment")!=="viewport"&&$.get("symbol-placement")!=="point",St=$.get("icon-rotation-alignment")==="map"&&$.get("symbol-placement")!=="point",Qe=$.get("symbol-placement"),Ze=pe/2,mt=$.get("icon-text-fit");let ct;p&&mt!=="none"&&(c.allowVerticalPlacement&&h.vertical&&(ct=uE(p,h.vertical,mt,$.get("icon-text-fit-padding"),q,X)),G&&(p=uE(p,G,mt,$.get("icon-text-fit-padding"),q,X)));const rt=(De,yt)=>{yt.x<0||yt.x>=oi||yt.y<0||yt.y>=oi||function(ft,It,Pn,Mn,mi,Ds,Ri,gi,or,ar,lr,ei,yi,Gi,Li,cr,Ni,as,vr,un,On,Vn,jr,Yn,Gu){const go=ft.addToLineVertexArray(It,Pn);let yo,Os,ls,Si,ta=0,tp=0,qE=0,WE=0,ab=-1,lb=-1;const na={};let GE=Ou("");if(ft.allowVerticalPlacement&&Mn.vertical){const Zi=gi.layout.get("text-rotate").evaluate(On,{},Yn)+90;ls=new Wm(or,It,ar,lr,ei,Mn.vertical,yi,Gi,Li,Zi),Ri&&(Si=new Wm(or,It,ar,lr,ei,Ri,Ni,as,Li,Zi))}if(mi){const Zi=gi.layout.get("icon-rotate").evaluate(On,{}),cs=gi.layout.get("icon-text-fit")!=="none",ac=LE(mi,Zi,jr,cs),Zs=Ri?LE(Ri,Zi,jr,cs):void 0;Os=new Wm(or,It,ar,lr,ei,mi,Ni,as,!1,Zi),ta=4*ac.length;const lc=ft.iconSizeData;let _o=null;lc.kind==="source"?(_o=[mo*gi.layout.get("icon-size").evaluate(On,{})],_o[0]>rl&&ht(`${ft.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)):lc.kind==="composite"&&(_o=[mo*Vn.compositeIconSizes[0].evaluate(On,{},Yn),mo*Vn.compositeIconSizes[1].evaluate(On,{},Yn)],(_o[0]>rl||_o[1]>rl)&&ht(`${ft.layerIds[0]}: Value for "icon-size" is >= ${Xd}. Reduce your "icon-size".`)),ft.addSymbols(ft.icon,ac,_o,un,vr,On,u.ah.none,It,go.lineStartIndex,go.lineLength,-1,Yn),ab=ft.icon.placedSymbolArray.length-1,Zs&&(tp=4*Zs.length,ft.addSymbols(ft.icon,Zs,_o,un,vr,On,u.ah.vertical,It,go.lineStartIndex,go.lineLength,-1,Yn),lb=ft.icon.placedSymbolArray.length-1)}const ZE=Object.keys(Mn.horizontal);for(const Zi of ZE){const cs=Mn.horizontal[Zi];if(!yo){GE=Ou(cs.text);const Zs=gi.layout.get("text-rotate").evaluate(On,{},Yn);yo=new Wm(or,It,ar,lr,ei,cs,yi,Gi,Li,Zs)}const ac=cs.positionedLines.length===1;if(qE+=VE(ft,It,cs,Ds,gi,Li,On,cr,go,Mn.vertical?u.ah.horizontal:u.ah.horizontalOnly,ac?ZE:[Zi],na,ab,Vn,Yn),ac)break}Mn.vertical&&(WE+=VE(ft,It,Mn.vertical,Ds,gi,Li,On,cr,go,u.ah.vertical,["vertical"],na,lb,Vn,Yn));const iU=yo?yo.boxStartIndex:ft.collisionBoxArray.length,rU=yo?yo.boxEndIndex:ft.collisionBoxArray.length,sU=ls?ls.boxStartIndex:ft.collisionBoxArray.length,oU=ls?ls.boxEndIndex:ft.collisionBoxArray.length,aU=Os?Os.boxStartIndex:ft.collisionBoxArray.length,lU=Os?Os.boxEndIndex:ft.collisionBoxArray.length,cU=Si?Si.boxStartIndex:ft.collisionBoxArray.length,uU=Si?Si.boxEndIndex:ft.collisionBoxArray.length;let Gs=-1;const Zm=(Zi,cs)=>Zi&&Zi.circleDiameter?Math.max(Zi.circleDiameter,cs):cs;Gs=Zm(yo,Gs),Gs=Zm(ls,Gs),Gs=Zm(Os,Gs),Gs=Zm(Si,Gs);const YE=Gs>-1?1:0;YE&&(Gs*=Gu/li),ft.glyphOffsetArray.length>=Hu.MAX_GLYPHS&&ht("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),On.sortKey!==void 0&&ft.addToSortKeyRanges(ft.symbolInstances.length,On.sortKey);const hU=FE(gi,On,Yn),[dU,pU]=function(Zi,cs){const ac=Zi.length,Zs=cs==null?void 0:cs.values;if((Zs==null?void 0:Zs.length)>0)for(let lc=0;lc<Zs.length;lc+=2){const _o=Zs[lc+1];Zi.emplaceBack(u.aq[Zs[lc]],_o[0],_o[1])}return[ac,Zi.length]}(ft.textAnchorOffsets,hU);ft.symbolInstances.emplaceBack(It.x,It.y,na.right>=0?na.right:-1,na.center>=0?na.center:-1,na.left>=0?na.left:-1,na.vertical||-1,ab,lb,GE,iU,rU,sU,oU,aU,lU,cU,uU,ar,qE,WE,ta,tp,YE,0,yi,Gs,dU,pU)}(c,yt,De,h,p,y,ct,c.layers[0],c.collisionBoxArray,o.index,o.sourceLayerIndex,c.index,ie,[ye,ye,ye,ye],tt,A,be,Ee,St,q,o,v,O,R,w)};if(Qe==="line")for(const De of PE(o.geometry,0,0,oi,oi)){const yt=X9(De,pe,Ne,h.vertical||G,p,24,ae,c.overscaling,oi);for(const ft of yt)G&&tU(c,G.text,Ze,ft)||rt(De,ft)}else if(Qe==="line-center"){for(const De of o.geometry)if(De.length>1){const yt=Y9(De,Ne,h.vertical||G,p,24,ae);yt&&rt(De,yt)}}else if(o.type==="Polygon")for(const De of cu(o.geometry,0)){const yt=J9(De,16);rt(De[0],new ol(yt.x,yt.y,0))}else if(o.type==="LineString")for(const De of o.geometry)rt(De,new ol(De[0].x,De[0].y,0));else if(o.type==="Point")for(const De of o.geometry)for(const yt of De)rt([yt],new ol(yt.x,yt.y,0))}function VE(c,o,h,p,y,v,w,C,A,O,R,N,$,q,G){const X=function(be,pe,ye,Ee,Ne,tt,St,Qe){const Ze=Ee.layout.get("text-rotate").evaluate(tt,{})*Math.PI/180,mt=[];for(const ct of pe.positionedLines)for(const rt of ct.positionedGlyphs){if(!rt.rect)continue;const De=rt.rect||{};let yt=nE+1,ft=!0,It=1,Pn=0;const Mn=(Ne||Qe)&&rt.vertical,mi=rt.metrics.advance*rt.scale/2;if(Qe&&pe.verticalizable&&(Pn=ct.lineOffset/2-(rt.imageName?-(li-rt.metrics.width*rt.scale)/2:(rt.scale-1)*li)),rt.imageName){const un=St[rt.imageName];ft=un.sdf,It=un.pixelRatio,yt=xr/It}const Ds=Ne?[rt.x+mi,rt.y]:[0,0];let Ri=Ne?[0,0]:[rt.x+mi+ye[0],rt.y+ye[1]-Pn],gi=[0,0];Mn&&(gi=Ri,Ri=[0,0]);const or=rt.metrics.isDoubleResolution?2:1,ar=(rt.metrics.left-yt)*rt.scale-mi+Ri[0],lr=(-rt.metrics.top-yt)*rt.scale+Ri[1],ei=ar+De.w/or*rt.scale/It,yi=lr+De.h/or*rt.scale/It,Gi=new E(ar,lr),Li=new E(ei,lr),cr=new E(ar,yi),Ni=new E(ei,yi);if(Mn){const un=new E(-mi,mi-Zd),On=-Math.PI/2,Vn=li/2-mi,jr=new E(5-Zd-Vn,-(rt.imageName?Vn:0)),Yn=new E(...gi);Gi._rotateAround(On,un)._add(jr)._add(Yn),Li._rotateAround(On,un)._add(jr)._add(Yn),cr._rotateAround(On,un)._add(jr)._add(Yn),Ni._rotateAround(On,un)._add(jr)._add(Yn)}if(Ze){const un=Math.sin(Ze),On=Math.cos(Ze),Vn=[On,-un,un,On];Gi._matMult(Vn),Li._matMult(Vn),cr._matMult(Vn),Ni._matMult(Vn)}const as=new E(0,0),vr=new E(0,0);mt.push({tl:Gi,tr:Li,bl:cr,br:Ni,tex:De,writingMode:pe.writingMode,glyphOffset:Ds,sectionIndex:rt.sectionIndex,isSDF:ft,pixelOffsetTL:as,pixelOffsetBR:vr,minFontScaleX:0,minFontScaleY:0})}return mt}(0,h,C,y,v,w,p,c.allowVerticalPlacement),ie=c.textSizeData;let ae=null;ie.kind==="source"?(ae=[mo*y.layout.get("text-size").evaluate(w,{})],ae[0]>rl&&ht(`${c.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)):ie.kind==="composite"&&(ae=[mo*q.compositeTextSizes[0].evaluate(w,{},G),mo*q.compositeTextSizes[1].evaluate(w,{},G)],(ae[0]>rl||ae[1]>rl)&&ht(`${c.layerIds[0]}: Value for "text-size" is >= ${Xd}. Reduce your "text-size".`)),c.addSymbols(c.text,X,ae,C,v,w,O,o,A.lineStartIndex,A.lineLength,$,G);for(const be of R)N[be]=c.text.placedSymbolArray.length-1;return 4*X.length}function $E(c){for(const o in c)return c[o];return null}function tU(c,o,h,p){const y=c.compareText;if(o in y){const v=y[o];for(let w=v.length-1;w>=0;w--)if(p.dist(v[w])<h)return!0}else y[o]=[];return y[o].push(p),!1}const jE=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class eb{static from(o){if(!(o instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,p]=new Uint8Array(o,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const y=p>>4;if(y!==1)throw new Error(`Got v${y} data when expected v1.`);const v=jE[15&p];if(!v)throw new Error("Unrecognized array type.");const[w]=new Uint16Array(o,2,1),[C]=new Uint32Array(o,4,1);return new eb(C,w,v,o)}constructor(o,h=64,p=Float64Array,y){if(isNaN(o)||o<0)throw new Error(`Unpexpected numItems value: ${o}.`);this.numItems=+o,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=p,this.IndexArrayType=o<65536?Uint16Array:Uint32Array;const v=jE.indexOf(this.ArrayType),w=2*o*this.ArrayType.BYTES_PER_ELEMENT,C=o*this.IndexArrayType.BYTES_PER_ELEMENT,A=(8-C%8)%8;if(v<0)throw new Error(`Unexpected typed array class: ${p}.`);y&&y instanceof ArrayBuffer?(this.data=y,this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+C+A,2*o),this._pos=2*o,this._finished=!0):(this.data=new ArrayBuffer(8+w+C+A),this.ids=new this.IndexArrayType(this.data,8,o),this.coords=new this.ArrayType(this.data,8+C+A,2*o),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+v]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=o)}add(o,h){const p=this._pos>>1;return this.ids[p]=p,this.coords[this._pos++]=o,this.coords[this._pos++]=h,p}finish(){const o=this._pos>>1;if(o!==this.numItems)throw new Error(`Added ${o} items when expected ${this.numItems}.`);return tb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(o,h,p,y){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:w,nodeSize:C}=this,A=[0,v.length-1,0],O=[];for(;A.length;){const R=A.pop()||0,N=A.pop()||0,$=A.pop()||0;if(N-$<=C){for(let ie=$;ie<=N;ie++){const ae=w[2*ie],be=w[2*ie+1];ae>=o&&ae<=p&&be>=h&&be<=y&&O.push(v[ie])}continue}const q=$+N>>1,G=w[2*q],X=w[2*q+1];G>=o&&G<=p&&X>=h&&X<=y&&O.push(v[q]),(R===0?o<=G:h<=X)&&(A.push($),A.push(q-1),A.push(1-R)),(R===0?p>=G:y>=X)&&(A.push(q+1),A.push(N),A.push(1-R))}return O}within(o,h,p){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:y,coords:v,nodeSize:w}=this,C=[0,y.length-1,0],A=[],O=p*p;for(;C.length;){const R=C.pop()||0,N=C.pop()||0,$=C.pop()||0;if(N-$<=w){for(let ie=$;ie<=N;ie++)HE(v[2*ie],v[2*ie+1],o,h)<=O&&A.push(y[ie]);continue}const q=$+N>>1,G=v[2*q],X=v[2*q+1];HE(G,X,o,h)<=O&&A.push(y[q]),(R===0?o-p<=G:h-p<=X)&&(C.push($),C.push(q-1),C.push(1-R)),(R===0?o+p>=G:h+p>=X)&&(C.push(q+1),C.push(N),C.push(1-R))}return A}}function tb(c,o,h,p,y,v){if(y-p<=h)return;const w=p+y>>1;UE(c,o,w,p,y,v),tb(c,o,h,p,w-1,1-v),tb(c,o,h,w+1,y,1-v)}function UE(c,o,h,p,y,v){for(;y>p;){if(y-p>600){const O=y-p+1,R=h-p+1,N=Math.log(O),$=.5*Math.exp(2*N/3),q=.5*Math.sqrt(N*$*(O-$)/O)*(R-O/2<0?-1:1);UE(c,o,h,Math.max(p,Math.floor(h-R*$/O+q)),Math.min(y,Math.floor(h+(O-R)*$/O+q)),v)}const w=o[2*h+v];let C=p,A=y;for(Qd(c,o,p,h),o[2*y+v]>w&&Qd(c,o,p,y);C<A;){for(Qd(c,o,C,A),C++,A--;o[2*C+v]<w;)C++;for(;o[2*A+v]>w;)A--}o[2*p+v]===w?Qd(c,o,p,A):(A++,Qd(c,o,A,y)),A<=h&&(p=A+1),h<=A&&(y=A-1)}}function Qd(c,o,h,p){nb(c,h,p),nb(o,2*h,2*p),nb(o,2*h+1,2*p+1)}function nb(c,o,h){const p=c[o];c[o]=c[h],c[h]=p}function HE(c,o,h,p){const y=c-h,v=o-p;return y*y+v*v}var ib;u.bg=void 0,(ib=u.bg||(u.bg={})).create="create",ib.load="load",ib.fullLoad="fullLoad";let Gm=null,ep=[];const rb=1e3/60,sb="loadTime",ob="fullLoadTime",nU={mark(c){performance.mark(c)},frame(c){const o=c;Gm!=null&&ep.push(o-Gm),Gm=o},clearMetrics(){Gm=null,ep=[],performance.clearMeasures(sb),performance.clearMeasures(ob);for(const c in u.bg)performance.clearMarks(u.bg[c])},getPerformanceMetrics(){performance.measure(sb,u.bg.create,u.bg.load),performance.measure(ob,u.bg.create,u.bg.fullLoad);const c=performance.getEntriesByName(sb)[0].duration,o=performance.getEntriesByName(ob)[0].duration,h=ep.length,p=1/(ep.reduce((v,w)=>v+w,0)/h/1e3),y=ep.filter(v=>v>rb).reduce((v,w)=>v+(w-rb)/rb,0);return{loadTime:c,fullLoadTime:o,fps:p,percentDroppedFrames:y/(h+y)*100,totalFrames:h}}};u.$=class extends B{},u.A=Bu,u.B=f_,u.C=function(c){if(nn==null){const o=c.navigator?c.navigator.userAgent:null;nn=!!c.safari||!(!o||!(/\b(iPad|iPhone|iPod)\b/.test(o)||o.match("Safari")&&!o.match("Chrome")))}return nn},u.D=dt,u.E=ln,u.F=class{constructor(c,o){this.target=c,this.mapId=o,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new G9(()=>this.process()),this.subscription=function(h,p,y,v){return h.addEventListener(p,y,!1),{unsubscribe:()=>{h.removeEventListener(p,y,!1)}}}(this.target,"message",h=>this.receive(h)),this.globalScope=Xt(self)?c:window}registerMessageHandler(c,o){this.messageHandlers[c]=o}sendAsync(c,o){return new Promise((h,p)=>{const y=Math.round(1e18*Math.random()).toString(36).substring(0,10);this.resolveRejects[y]={resolve:h,reject:p},o&&o.signal.addEventListener("abort",()=>{delete this.resolveRejects[y];const C={id:y,type:"<cancel>",origin:location.origin,targetMapId:c.targetMapId,sourceMapId:this.mapId};this.target.postMessage(C)},{once:!0});const v=[],w=Object.assign(Object.assign({},c),{id:y,sourceMapId:this.mapId,origin:location.origin,data:Wa(c.data,v)});this.target.postMessage(w,{transfer:v})})}receive(c){const o=c.data,h=o.id;if(!(o.origin!=="file://"&&location.origin!=="file://"&&o.origin!=="resource://android"&&location.origin!=="resource://android"&&o.origin!==location.origin||o.targetMapId&&this.mapId!==o.targetMapId)){if(o.type==="<cancel>"){delete this.tasks[h];const p=this.abortControllers[h];return delete this.abortControllers[h],void(p&&p.abort())}if(Xt(self)||o.mustQueue)return this.tasks[h]=o,this.taskQueue.push(h),void this.invoker.trigger();this.processTask(h,o)}}process(){if(this.taskQueue.length===0)return;const c=this.taskQueue.shift(),o=this.tasks[c];delete this.tasks[c],this.taskQueue.length>0&&this.invoker.trigger(),o&&this.processTask(c,o)}processTask(c,o){return l(this,void 0,void 0,function*(){if(o.type==="<response>"){const y=this.resolveRejects[c];return delete this.resolveRejects[c],y?void(o.error?y.reject(Ga(o.error)):y.resolve(Ga(o.data))):void 0}if(!this.messageHandlers[o.type])return void this.completeTask(c,new Error(`Could not find a registered handler for ${o.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const h=Ga(o.data),p=new AbortController;this.abortControllers[c]=p;try{const y=yield this.messageHandlers[o.type](o.sourceMapId,h,p);this.completeTask(c,null,y)}catch(y){this.completeTask(c,y)}})}completeTask(c,o,h){const p=[];delete this.abortControllers[c];const y={id:c,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:o?Wa(o):null,data:Wa(h,p)};this.target.postMessage(y,{transfer:p})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},u.G=Gn,u.H=function(){var c=new Bu(16);return Bu!=Float32Array&&(c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=0,c[12]=0,c[13]=0,c[14]=0),c[0]=1,c[5]=1,c[10]=1,c[15]=1,c},u.I=$_,u.J=function(c,o,h){var p,y,v,w,C,A,O,R,N,$,q,G,X=h[0],ie=h[1],ae=h[2];return o===c?(c[12]=o[0]*X+o[4]*ie+o[8]*ae+o[12],c[13]=o[1]*X+o[5]*ie+o[9]*ae+o[13],c[14]=o[2]*X+o[6]*ie+o[10]*ae+o[14],c[15]=o[3]*X+o[7]*ie+o[11]*ae+o[15]):(y=o[1],v=o[2],w=o[3],C=o[4],A=o[5],O=o[6],R=o[7],N=o[8],$=o[9],q=o[10],G=o[11],c[0]=p=o[0],c[1]=y,c[2]=v,c[3]=w,c[4]=C,c[5]=A,c[6]=O,c[7]=R,c[8]=N,c[9]=$,c[10]=q,c[11]=G,c[12]=p*X+C*ie+N*ae+o[12],c[13]=y*X+A*ie+$*ae+o[13],c[14]=v*X+O*ie+q*ae+o[14],c[15]=w*X+R*ie+G*ae+o[15]),c},u.K=function(c,o,h){var p=h[0],y=h[1],v=h[2];return c[0]=o[0]*p,c[1]=o[1]*p,c[2]=o[2]*p,c[3]=o[3]*p,c[4]=o[4]*y,c[5]=o[5]*y,c[6]=o[6]*y,c[7]=o[7]*y,c[8]=o[8]*v,c[9]=o[9]*v,c[10]=o[10]*v,c[11]=o[11]*v,c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15],c},u.L=SS,u.M=function(c,o){const h={};for(let p=0;p<o.length;p++){const y=o[p];y in c&&(h[y]=c[y])}return h},u.N=sl,u.O=bE,u.P=E,u.Q=xE,u.R=rs,u.S=ss,u.T=Mu,u.U=Z,u.V=ee,u.W=Sn,u.X=oi,u.Y=M,u.Z=Kd,u._=l,u.a=Wn,u.a$=function(c,o){var h=c[0],p=c[1],y=c[2],v=c[3],w=c[4],C=c[5],A=c[6],O=c[7],R=c[8],N=c[9],$=c[10],q=c[11],G=c[12],X=c[13],ie=c[14],ae=c[15],be=o[0],pe=o[1],ye=o[2],Ee=o[3],Ne=o[4],tt=o[5],St=o[6],Qe=o[7],Ze=o[8],mt=o[9],ct=o[10],rt=o[11],De=o[12],yt=o[13],ft=o[14],It=o[15];return Math.abs(h-be)<=sr*Math.max(1,Math.abs(h),Math.abs(be))&&Math.abs(p-pe)<=sr*Math.max(1,Math.abs(p),Math.abs(pe))&&Math.abs(y-ye)<=sr*Math.max(1,Math.abs(y),Math.abs(ye))&&Math.abs(v-Ee)<=sr*Math.max(1,Math.abs(v),Math.abs(Ee))&&Math.abs(w-Ne)<=sr*Math.max(1,Math.abs(w),Math.abs(Ne))&&Math.abs(C-tt)<=sr*Math.max(1,Math.abs(C),Math.abs(tt))&&Math.abs(A-St)<=sr*Math.max(1,Math.abs(A),Math.abs(St))&&Math.abs(O-Qe)<=sr*Math.max(1,Math.abs(O),Math.abs(Qe))&&Math.abs(R-Ze)<=sr*Math.max(1,Math.abs(R),Math.abs(Ze))&&Math.abs(N-mt)<=sr*Math.max(1,Math.abs(N),Math.abs(mt))&&Math.abs($-ct)<=sr*Math.max(1,Math.abs($),Math.abs(ct))&&Math.abs(q-rt)<=sr*Math.max(1,Math.abs(q),Math.abs(rt))&&Math.abs(G-De)<=sr*Math.max(1,Math.abs(G),Math.abs(De))&&Math.abs(X-yt)<=sr*Math.max(1,Math.abs(X),Math.abs(yt))&&Math.abs(ie-ft)<=sr*Math.max(1,Math.abs(ie),Math.abs(ft))&&Math.abs(ae-It)<=sr*Math.max(1,Math.abs(ae),Math.abs(It))},u.a0=Qt,u.a1=K_,u.a2=Be,u.a3=c=>{const o=window.document.createElement("video");return o.muted=!0,new Promise(h=>{o.onloadstart=()=>{h(o)};for(const p of c){const y=window.document.createElement("source");lt(p)||(o.crossOrigin="Anonymous"),y.src=p,o.appendChild(y)}})},u.a4=function(){return Le++},u.a5=et,u.a6=Hu,u.a7=yd,u.a8=sc,u.a9=CE,u.aA=function(c){if(c.type==="custom")return new W9(c);switch(c.type){case"background":return new U9(c);case"circle":return new P7(c);case"fill":return new G7(c);case"fill-extrusion":return new l9(c);case"heatmap":return new D7(c);case"hillshade":return new z7(c);case"line":return new g9(c);case"raster":return new q9(c);case"symbol":return new jm(c)}},u.aB=it,u.aC=function(c,o){if(!c)return[{command:"setStyle",args:[o]}];let h=[];try{if(!Kt(c.version,o.version))return[{command:"setStyle",args:[o]}];Kt(c.center,o.center)||h.push({command:"setCenter",args:[o.center]}),Kt(c.zoom,o.zoom)||h.push({command:"setZoom",args:[o.zoom]}),Kt(c.bearing,o.bearing)||h.push({command:"setBearing",args:[o.bearing]}),Kt(c.pitch,o.pitch)||h.push({command:"setPitch",args:[o.pitch]}),Kt(c.sprite,o.sprite)||h.push({command:"setSprite",args:[o.sprite]}),Kt(c.glyphs,o.glyphs)||h.push({command:"setGlyphs",args:[o.glyphs]}),Kt(c.transition,o.transition)||h.push({command:"setTransition",args:[o.transition]}),Kt(c.light,o.light)||h.push({command:"setLight",args:[o.light]}),Kt(c.terrain,o.terrain)||h.push({command:"setTerrain",args:[o.terrain]}),Kt(c.sky,o.sky)||h.push({command:"setSky",args:[o.sky]}),Kt(c.projection,o.projection)||h.push({command:"setProjection",args:[o.projection]});const p={},y=[];(function(w,C,A,O){let R;for(R in C=C||{},w=w||{})Object.prototype.hasOwnProperty.call(w,R)&&(Object.prototype.hasOwnProperty.call(C,R)||tr(R,A,O));for(R in C)Object.prototype.hasOwnProperty.call(C,R)&&(Object.prototype.hasOwnProperty.call(w,R)?Kt(w[R],C[R])||(w[R].type==="geojson"&&C[R].type==="geojson"&&Dr(w,C,R)?dn(A,{command:"setGeoJSONSourceData",args:[R,C[R].data]}):bi(R,C,A,O)):er(R,C,A))})(c.sources,o.sources,y,p);const v=[];c.layers&&c.layers.forEach(w=>{"source"in w&&p[w.source]?h.push({command:"removeLayer",args:[w.id]}):v.push(w)}),h=h.concat(y),function(w,C,A){C=C||[];const O=(w=w||[]).map(Es),R=C.map(Es),N=w.reduce(Cs,{}),$=C.reduce(Cs,{}),q=O.slice(),G=Object.create(null);let X,ie,ae,be,pe;for(let ye=0,Ee=0;ye<O.length;ye++)X=O[ye],Object.prototype.hasOwnProperty.call($,X)?Ee++:(dn(A,{command:"removeLayer",args:[X]}),q.splice(q.indexOf(X,Ee),1));for(let ye=0,Ee=0;ye<R.length;ye++)X=R[R.length-1-ye],q[q.length-1-ye]!==X&&(Object.prototype.hasOwnProperty.call(N,X)?(dn(A,{command:"removeLayer",args:[X]}),q.splice(q.lastIndexOf(X,q.length-Ee),1)):Ee++,be=q[q.length-ye],dn(A,{command:"addLayer",args:[$[X],be]}),q.splice(q.length-ye,0,X),G[X]=!0);for(let ye=0;ye<R.length;ye++)if(X=R[ye],ie=N[X],ae=$[X],!G[X]&&!Kt(ie,ae))if(Kt(ie.source,ae.source)&&Kt(ie["source-layer"],ae["source-layer"])&&Kt(ie.type,ae.type)){for(pe in xi(ie.layout,ae.layout,A,X,null,"setLayoutProperty"),xi(ie.paint,ae.paint,A,X,null,"setPaintProperty"),Kt(ie.filter,ae.filter)||dn(A,{command:"setFilter",args:[X,ae.filter]}),Kt(ie.minzoom,ae.minzoom)&&Kt(ie.maxzoom,ae.maxzoom)||dn(A,{command:"setLayerZoomRange",args:[X,ae.minzoom,ae.maxzoom]}),ie)Object.prototype.hasOwnProperty.call(ie,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?xi(ie[pe],ae[pe],A,X,pe.slice(6),"setPaintProperty"):Kt(ie[pe],ae[pe])||dn(A,{command:"setLayerProperty",args:[X,pe,ae[pe]]}));for(pe in ae)Object.prototype.hasOwnProperty.call(ae,pe)&&!Object.prototype.hasOwnProperty.call(ie,pe)&&pe!=="layout"&&pe!=="paint"&&pe!=="filter"&&pe!=="metadata"&&pe!=="minzoom"&&pe!=="maxzoom"&&(pe.indexOf("paint.")===0?xi(ie[pe],ae[pe],A,X,pe.slice(6),"setPaintProperty"):Kt(ie[pe],ae[pe])||dn(A,{command:"setLayerProperty",args:[X,pe,ae[pe]]}))}else dn(A,{command:"removeLayer",args:[X]}),be=q[q.lastIndexOf(X)+1],dn(A,{command:"addLayer",args:[ae,be]})}(v,o.layers,h)}catch(p){console.warn("Unable to compute style diff:",p),h=[{command:"setStyle",args:[o]}]}return h},u.aD=function(c){const o=[],h=c.id;return h===void 0&&o.push({message:`layers.${h}: missing required property "id"`}),c.render===void 0&&o.push({message:`layers.${h}: missing required method "render"`}),c.renderingMode&&c.renderingMode!=="2d"&&c.renderingMode!=="3d"&&o.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),o},u.aE=function c(o,h){if(Array.isArray(o)){if(!Array.isArray(h)||o.length!==h.length)return!1;for(let p=0;p<o.length;p++)if(!c(o[p],h[p]))return!1;return!0}if(typeof o=="object"&&o!==null&&h!==null){if(typeof h!="object"||Object.keys(o).length!==Object.keys(h).length)return!1;for(const p in o)if(!c(o[p],h[p]))return!1;return!0}return o===h},u.aF=Ie,u.aG=Ye,u.aH=class extends nc{constructor(c,o){super(c,o),this.current=0}set(c){this.current!==c&&(this.current=c,this.gl.uniform1i(this.location,c))}},u.aI=Am,u.aJ=class extends nc{constructor(c,o){super(c,o),this.current=w7}set(c){if(c[12]!==this.current[12]||c[0]!==this.current[0])return this.current=c,void this.gl.uniformMatrix4fv(this.location,!1,c);for(let o=1;o<16;o++)if(c[o]!==this.current[o]){this.current=c,this.gl.uniformMatrix4fv(this.location,!1,c);break}}},u.aK=pS,u.aL=fS,u.aM=vn,u.aN=class extends nc{constructor(c,o){super(c,o),this.current=[0,0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]&&c[2]===this.current[2]||(this.current=c,this.gl.uniform3f(this.location,c[0],c[1],c[2]))}},u.aO=class extends nc{constructor(c,o){super(c,o),this.current=[0,0]}set(c){c[0]===this.current[0]&&c[1]===this.current[1]||(this.current=c,this.gl.uniform2f(this.location,c[0],c[1]))}},u.aP=function(c,o,h,p,y,v,w){var C=1/(o-h),A=1/(p-y),O=1/(v-w);return c[0]=-2*C,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=-2*A,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=2*O,c[11]=0,c[12]=(o+h)*C,c[13]=(y+p)*A,c[14]=(w+v)*O,c[15]=1,c},u.aQ=A7,u.aR=class extends me{},u.aS=x9,u.aT=class extends xe{},u.aU=A_,u.aV=function(c){return c<=1?1:Math.pow(2,Math.ceil(Math.log(c)/Math.LN2))},u.aW=AS,u.aX=Di,u.aY=is,u.aZ=class extends pt{},u.a_=function(c,o){return c[0]===o[0]&&c[1]===o[1]&&c[2]===o[2]&&c[3]===o[3]&&c[4]===o[4]&&c[5]===o[5]&&c[6]===o[6]&&c[7]===o[7]&&c[8]===o[8]&&c[9]===o[9]&&c[10]===o[10]&&c[11]===o[11]&&c[12]===o[12]&&c[13]===o[13]&&c[14]===o[14]&&c[15]===o[15]},u.aa=function(c){const o={};if(c.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,p,y,v)=>{const w=y||v;return o[p]=!w||w.toLowerCase(),""}),o["max-age"]){const h=parseInt(o["max-age"],10);isNaN(h)?delete o["max-age"]:o["max-age"]=h}return o},u.ab=function(c,o){const h=[];for(const p in c)p in o||h.push(p);return h},u.ac=Ae,u.ad=function(c,o,h){var p=Math.sin(h),y=Math.cos(h),v=o[0],w=o[1],C=o[2],A=o[3],O=o[4],R=o[5],N=o[6],$=o[7];return o!==c&&(c[8]=o[8],c[9]=o[9],c[10]=o[10],c[11]=o[11],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c[0]=v*y+O*p,c[1]=w*y+R*p,c[2]=C*y+N*p,c[3]=A*y+$*p,c[4]=O*y-v*p,c[5]=R*y-w*p,c[6]=N*y-C*p,c[7]=$*y-A*p,c},u.ae=function(c){var o=new Bu(16);return o[0]=c[0],o[1]=c[1],o[2]=c[2],o[3]=c[3],o[4]=c[4],o[5]=c[5],o[6]=c[6],o[7]=c[7],o[8]=c[8],o[9]=c[9],o[10]=c[10],o[11]=c[11],o[12]=c[12],o[13]=c[13],o[14]=c[14],o[15]=c[15],o},u.af=Om,u.ag=function(c,o){let h=0,p=0;if(c.kind==="constant")p=c.layoutSize;else if(c.kind!=="source"){const{interpolationType:y,minZoom:v,maxZoom:w}=c,C=y?Ae(ir.interpolationFactor(y,o,v,w),0,1):0;c.kind==="camera"?p=nr.number(c.minSize,c.maxSize,C):h=C}return{uSizeT:h,uSize:p}},u.ai=function(c,{uSize:o,uSizeT:h},{lowerSize:p,upperSize:y}){return c.kind==="source"?p/mo:c.kind==="composite"?nr.number(p/mo,y/mo,h):o},u.aj=q_,u.ak=function(c,o,h,p){const y=o.y-c.y,v=o.x-c.x,w=p.y-h.y,C=p.x-h.x,A=w*v-C*y;if(A===0)return null;const O=(C*(c.y-h.y)-w*(c.x-h.x))/A;return new E(c.x+O*v,c.y+O*y)},u.al=PE,u.am=_S,u.an=C_,u.ao=function(c){let o=1/0,h=1/0,p=-1/0,y=-1/0;for(const v of c)o=Math.min(o,v.x),h=Math.min(h,v.y),p=Math.max(p,v.x),y=Math.max(y,v.y);return[o,h,p,y]},u.ap=li,u.ar=H_,u.as=function(c,o){var h=o[0],p=o[1],y=o[2],v=o[3],w=o[4],C=o[5],A=o[6],O=o[7],R=o[8],N=o[9],$=o[10],q=o[11],G=o[12],X=o[13],ie=o[14],ae=o[15],be=h*C-p*w,pe=h*A-y*w,ye=h*O-v*w,Ee=p*A-y*C,Ne=p*O-v*C,tt=y*O-v*A,St=R*X-N*G,Qe=R*ie-$*G,Ze=R*ae-q*G,mt=N*ie-$*X,ct=N*ae-q*X,rt=$*ae-q*ie,De=be*rt-pe*ct+ye*mt+Ee*Ze-Ne*Qe+tt*St;return De?(c[0]=(C*rt-A*ct+O*mt)*(De=1/De),c[1]=(y*ct-p*rt-v*mt)*De,c[2]=(X*tt-ie*Ne+ae*Ee)*De,c[3]=($*Ne-N*tt-q*Ee)*De,c[4]=(A*Ze-w*rt-O*Qe)*De,c[5]=(h*rt-y*Ze+v*Qe)*De,c[6]=(ie*ye-G*tt-ae*pe)*De,c[7]=(R*tt-$*ye+q*pe)*De,c[8]=(w*ct-C*Ze+O*St)*De,c[9]=(p*Ze-h*ct-v*St)*De,c[10]=(G*Ne-X*ye+ae*be)*De,c[11]=(N*ye-R*Ne-q*be)*De,c[12]=(C*Qe-w*mt-A*St)*De,c[13]=(h*mt-p*Qe+y*St)*De,c[14]=(X*pe-G*Ee-ie*be)*De,c[15]=(R*Ee-N*pe+$*be)*De,c):null},u.at=Q_,u.au=U_,u.av=eb,u.aw=function(){const c={},o=we.$version;for(const h in we.$root){const p=we.$root[h];if(p.required){let y=null;y=h==="version"?o:p.type==="array"?[]:{},y!=null&&(c[h]=y)}}return c},u.ax=Id,u.ay=je,u.az=function(c){c=c.slice();const o=Object.create(null);for(let h=0;h<c.length;h++)o[c[h].id]=c[h];for(let h=0;h<c.length;h++)"ref"in c[h]&&(c[h]=Ss(c[h],o[c[h].ref]));return c},u.b=jt,u.b0=function(c,o){return c[0]=o[0],c[1]=o[1],c[2]=o[2],c[3]=o[3],c[4]=o[4],c[5]=o[5],c[6]=o[6],c[7]=o[7],c[8]=o[8],c[9]=o[9],c[10]=o[10],c[11]=o[11],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15],c},u.b1=function(c,o,h){return c[0]=o[0]*h[0],c[1]=o[1]*h[1],c[2]=o[2]*h[2],c[3]=o[3]*h[3],c},u.b2=function(c,o){return c[0]*o[0]+c[1]*o[1]+c[2]*o[2]+c[3]*o[3]},u.b3=ke,u.b4=kE,u.b5=vE,u.b6=function(c,o,h,p,y){var v,w=1/Math.tan(o/2);return c[0]=w/h,c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=w,c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[11]=-1,c[12]=0,c[13]=0,c[15]=0,y!=null&&y!==1/0?(c[10]=(y+p)*(v=1/(p-y)),c[14]=2*y*p*v):(c[10]=-1,c[14]=-2*p),c},u.b7=function(c,o,h){var p=Math.sin(h),y=Math.cos(h),v=o[4],w=o[5],C=o[6],A=o[7],O=o[8],R=o[9],N=o[10],$=o[11];return o!==c&&(c[0]=o[0],c[1]=o[1],c[2]=o[2],c[3]=o[3],c[12]=o[12],c[13]=o[13],c[14]=o[14],c[15]=o[15]),c[4]=v*y+O*p,c[5]=w*y+R*p,c[6]=C*y+N*p,c[7]=A*y+$*p,c[8]=O*y-v*p,c[9]=R*y-w*p,c[10]=N*y-C*p,c[11]=$*y-A*p,c},u.b8=oe,u.b9=J,u.bA=YS,u.bB=function(c){return c.message===bn},u.bC=Fa,u.bD=_r,u.ba=function(c){return c*Math.PI/180},u.bb=function(c,o){const{x:h,y:p}=Kd.fromLngLat(o);return!(c<0||c>25||p<0||p>=1||h<0||h>=1)},u.bc=function(c,o){return c[0]=o[0],c[1]=0,c[2]=0,c[3]=0,c[4]=0,c[5]=o[1],c[6]=0,c[7]=0,c[8]=0,c[9]=0,c[10]=o[2],c[11]=0,c[12]=0,c[13]=0,c[14]=0,c[15]=1,c},u.bd=class extends L{},u.be=Y_,u.bf=nU,u.bh=Ce,u.bi=function(c,o){Wn.REGISTERED_PROTOCOLS[c]=o},u.bj=function(c){delete Wn.REGISTERED_PROTOCOLS[c]},u.bk=function(c,o){const h={};for(let y=0;y<c.length;y++){const v=o&&o[c[y].id]||ym(c[y]);o&&(o[c[y].id]=v);let w=h[v];w||(w=h[v]=[]),w.push(c[y])}const p=[];for(const y in h)p.push(h[y]);return p},u.bl=ot,u.bm=EE,u.bn=TE,u.bo=rE,u.bp=function(c){c.bucket.createArrays(),c.bucket.tilePixelRatio=oi/(512*c.bucket.overscaling),c.bucket.compareText={},c.bucket.iconsNeedLinear=!1;const o=c.bucket.layers[0],h=o.layout,p=o._unevaluatedLayout._values,y={layoutIconSize:p["icon-size"].possiblyEvaluate(new Ln(c.bucket.zoom+1),c.canonical),layoutTextSize:p["text-size"].possiblyEvaluate(new Ln(c.bucket.zoom+1),c.canonical),textMaxSize:p["text-size"].possiblyEvaluate(new Ln(18))};if(c.bucket.textSizeData.kind==="composite"){const{minZoom:O,maxZoom:R}=c.bucket.textSizeData;y.compositeTextSizes=[p["text-size"].possiblyEvaluate(new Ln(O),c.canonical),p["text-size"].possiblyEvaluate(new Ln(R),c.canonical)]}if(c.bucket.iconSizeData.kind==="composite"){const{minZoom:O,maxZoom:R}=c.bucket.iconSizeData;y.compositeIconSizes=[p["icon-size"].possiblyEvaluate(new Ln(O),c.canonical),p["icon-size"].possiblyEvaluate(new Ln(R),c.canonical)]}const v=h.get("text-line-height")*li,w=h.get("text-rotation-alignment")!=="viewport"&&h.get("symbol-placement")!=="point",C=h.get("text-keep-upright"),A=h.get("text-size");for(const O of c.bucket.features){const R=h.get("text-font").evaluate(O,{},c.canonical).join(","),N=A.evaluate(O,{},c.canonical),$=y.layoutTextSize.evaluate(O,{},c.canonical),q=y.layoutIconSize.evaluate(O,{},c.canonical),G={horizontal:{},vertical:void 0},X=O.text;let ie,ae=[0,0];if(X){const ye=X.toString(),Ee=h.get("text-letter-spacing").evaluate(O,{},c.canonical)*li,Ne=m_(ye)?Ee:0,tt=h.get("text-anchor").evaluate(O,{},c.canonical),St=FE(o,O,c.canonical);if(!St){const ct=h.get("text-radial-offset").evaluate(O,{},c.canonical);ae=ct?BE(tt,[ct*li,J_]):h.get("text-offset").evaluate(O,{},c.canonical).map(rt=>rt*li)}let Qe=w?"center":h.get("text-justify").evaluate(O,{},c.canonical);const Ze=h.get("symbol-placement")==="point"?h.get("text-max-width").evaluate(O,{},c.canonical)*li:1/0,mt=()=>{c.bucket.allowVerticalPlacement&&Dd(ye)&&(G.vertical=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,tt,"left",Ne,ae,u.ah.vertical,!0,$,N))};if(!w&&St){const ct=new Set;if(Qe==="auto")for(let De=0;De<St.values.length;De+=2)ct.add(Q_(St.values[De]));else ct.add(Qe);let rt=!1;for(const De of ct)if(!G.horizontal[De])if(rt)G.horizontal[De]=G.horizontal[0];else{const yt=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,"center",De,Ne,ae,u.ah.horizontal,!1,$,N);yt&&(G.horizontal[De]=yt,rt=yt.positionedLines.length===1)}mt()}else{Qe==="auto"&&(Qe=Q_(tt));const ct=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,tt,Qe,Ne,ae,u.ah.horizontal,!1,$,N);ct&&(G.horizontal[Qe]=ct),mt(),Dd(ye)&&w&&C&&(G.vertical=Fm(X,c.glyphMap,c.glyphPositions,c.imagePositions,R,Ze,v,tt,Qe,Ne,ae,u.ah.vertical,!1,$,N))}}let be=!1;if(O.icon&&O.icon.name){const ye=c.imageMap[O.icon.name];ye&&(ie=B9(c.imagePositions[O.icon.name],h.get("icon-offset").evaluate(O,{},c.canonical),h.get("icon-anchor").evaluate(O,{},c.canonical)),be=!!ye.sdf,c.bucket.sdfIcons===void 0?c.bucket.sdfIcons=be:c.bucket.sdfIcons!==be&&ht("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(ye.pixelRatio!==c.bucket.pixelRatio||h.get("icon-rotate").constantOr(1)!==0)&&(c.bucket.iconsNeedLinear=!0))}const pe=$E(G.horizontal)||G.vertical;c.bucket.iconsInText=!!pe&&pe.iconsInText,(pe||ie)&&eU(c.bucket,O,G,ie,c.imageMap,y,$,q,ae,be,c.canonical)}c.showCollisionBoxes&&c.bucket.generateCollisionDebugBuffers()},u.bq=N_,u.br=z_,u.bs=L_,u.bt=nl,u.bu=F_,u.bv=class{constructor(c){this._marks={start:[c.url,"start"].join("#"),end:[c.url,"end"].join("#"),measure:c.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let c=performance.getEntriesByName(this._marks.measure);return c.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),c=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),c}},u.bw=function(c,o,h,p,y){return l(this,void 0,void 0,function*(){if(ee())try{return yield Sn(c,o,h,p,y)}catch{}return function(v,w,C,A,O){const R=v.width,N=v.height;hn&&In||(hn=new OffscreenCanvas(R,N),In=hn.getContext("2d",{willReadFrequently:!0})),hn.width=R,hn.height=N,In.drawImage(v,0,0,R,N);const $=In.getImageData(w,C,A,O);return In.clearRect(0,0,R,N),$.data}(c,o,h,p,y)})},u.bx=SE,u.by=g,u.bz=_,u.c=pi,u.d=c=>l(void 0,void 0,void 0,function*(){if(c.byteLength===0)return createImageBitmap(new ImageData(1,1));const o=new Blob([new Uint8Array(c)],{type:"image/png"});try{return createImageBitmap(o)}catch(h){throw new Error(`Could not load image because of ${h.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),u.e=Me,u.f=c=>new Promise((o,h)=>{const p=new Image;p.onload=()=>{o(p),URL.revokeObjectURL(p.src),p.onload=null,window.requestAnimationFrame(()=>{p.src=Mt})},p.onerror=()=>h(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 y=new Blob([new Uint8Array(c)],{type:"image/png"});p.src=c.byteLength?URL.createObjectURL(y):Mt}),u.g=jn,u.h=(c,o)=>Xe(Me(c,{type:"json"}),o),u.i=Xt,u.j=At,u.k=Dt,u.l=(c,o)=>Xe(Me(c,{type:"arrayBuffer"}),o),u.m=Xe,u.n=function(c){return new F_(c).readFields(I9,[])},u.o=$d,u.p=iE,u.q=x,u.r=p_,u.s=lt,u.t=Ad,u.u=Ko,u.v=we,u.w=ht,u.x=function([c,o,h]){return o+=90,o*=Math.PI/180,h*=Math.PI/180,{x:c*Math.cos(o)*Math.sin(h),y:c*Math.sin(o)*Math.sin(h),z:c*Math.cos(h)}},u.y=nr,u.z=Ln}),r("worker",["./shared"],function(u){class l{constructor(U){this.keyCache={},U&&this.replace(U)}replace(U){this._layerConfigs={},this._layers={},this.update(U,[])}update(U,j){for(const ne of U){this._layerConfigs[ne.id]=ne;const de=this._layers[ne.id]=u.aA(ne);de._featureFilter=u.a7(de.filter),this.keyCache[ne.id]&&delete this.keyCache[ne.id]}for(const ne of j)delete this.keyCache[ne],delete this._layerConfigs[ne],delete this._layers[ne];this.familiesBySource={};const Y=u.bk(Object.values(this._layerConfigs),this.keyCache);for(const ne of Y){const de=ne.map(Se=>this._layers[Se.id]),fe=de[0];if(fe.visibility==="none")continue;const _e=fe.source||"";let ue=this.familiesBySource[_e];ue||(ue=this.familiesBySource[_e]={});const Te=fe.sourceLayer||"_geojsonTileLayer";let ze=ue[Te];ze||(ze=ue[Te]=[]),ze.push(de)}}}class g{constructor(U){const j={},Y=[];for(const _e in U){const ue=U[_e],Te=j[_e]={};for(const ze in ue){const Se=ue[+ze];if(!Se||Se.bitmap.width===0||Se.bitmap.height===0)continue;const Ue={x:0,y:0,w:Se.bitmap.width+2,h:Se.bitmap.height+2};Y.push(Ue),Te[ze]={rect:Ue,metrics:Se.metrics}}}const{w:ne,h:de}=u.p(Y),fe=new u.o({width:ne||1,height:de||1});for(const _e in U){const ue=U[_e];for(const Te in ue){const ze=ue[+Te];if(!ze||ze.bitmap.width===0||ze.bitmap.height===0)continue;const Se=j[_e][Te].rect;u.o.copy(ze.bitmap,fe,{x:0,y:0},{x:Se.x+1,y:Se.y+1},ze.bitmap)}}this.image=fe,this.positions=j}}u.bl("GlyphAtlas",g);class _{constructor(U){this.tileID=new u.S(U.tileID.overscaledZ,U.tileID.wrap,U.tileID.canonical.z,U.tileID.canonical.x,U.tileID.canonical.y),this.uid=U.uid,this.zoom=U.zoom,this.pixelRatio=U.pixelRatio,this.tileSize=U.tileSize,this.source=U.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=U.showCollisionBoxes,this.collectResourceTiming=!!U.collectResourceTiming,this.returnDependencies=!!U.returnDependencies,this.promoteId=U.promoteId,this.inFlightDependencies=[]}parse(U,j,Y,ne){return u._(this,void 0,void 0,function*(){this.status="parsing",this.data=U,this.collisionBoxArray=new u.a5;const de=new u.bm(Object.keys(U.layers).sort()),fe=new u.bn(this.tileID,this.promoteId);fe.bucketLayerIDs=[];const _e={},ue={featureIndex:fe,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:Y},Te=j.familiesBySource[this.source];for(const $t in Te){const xn=U.layers[$t];if(!xn)continue;xn.version===1&&u.w(`Vector tile source "${this.source}" layer "${$t}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const Un=de.encode($t),fi=[];for(let wi=0;wi<xn.length;wi++){const Hi=xn.feature(wi),Ma=fe.getId(Hi,$t);fi.push({feature:Hi,id:Ma,index:wi,sourceLayerIndex:Un})}for(const wi of Te[$t]){const Hi=wi[0];Hi.source!==this.source&&u.w(`layer.source = ${Hi.source} does not equal this.source = ${this.source}`),Hi.minzoom&&this.zoom<Math.floor(Hi.minzoom)||Hi.maxzoom&&this.zoom>=Hi.maxzoom||Hi.visibility!=="none"&&(k(wi,this.zoom,Y),(_e[Hi.id]=Hi.createBucket({index:fe.bucketLayerIDs.length,layers:wi,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:Un,sourceID:this.source})).populate(fi,ue,this.tileID.canonical),fe.bucketLayerIDs.push(wi.map(Ma=>Ma.id)))}}const ze=u.aF(ue.glyphDependencies,$t=>Object.keys($t).map(Number));this.inFlightDependencies.forEach($t=>$t==null?void 0:$t.abort()),this.inFlightDependencies=[];let Se=Promise.resolve({});if(Object.keys(ze).length){const $t=new AbortController;this.inFlightDependencies.push($t),Se=ne.sendAsync({type:"GG",data:{stacks:ze,source:this.source,tileID:this.tileID,type:"glyphs"}},$t)}const Ue=Object.keys(ue.iconDependencies);let bt=Promise.resolve({});if(Ue.length){const $t=new AbortController;this.inFlightDependencies.push($t),bt=ne.sendAsync({type:"GI",data:{icons:Ue,source:this.source,tileID:this.tileID,type:"icons"}},$t)}const kt=Object.keys(ue.patternDependencies);let sn=Promise.resolve({});if(kt.length){const $t=new AbortController;this.inFlightDependencies.push($t),sn=ne.sendAsync({type:"GI",data:{icons:kt,source:this.source,tileID:this.tileID,type:"patterns"}},$t)}const[Lt,on,Zt]=yield Promise.all([Se,bt,sn]),ri=new g(Lt),Zn=new u.bo(on,Zt);for(const $t in _e){const xn=_e[$t];xn instanceof u.a6?(k(xn.layers,this.zoom,Y),u.bp({bucket:xn,glyphMap:Lt,glyphPositions:ri.positions,imageMap:on,imagePositions:Zn.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical})):xn.hasPattern&&(xn instanceof u.bq||xn instanceof u.br||xn instanceof u.bs)&&(k(xn.layers,this.zoom,Y),xn.addFeatures(ue,this.tileID.canonical,Zn.patternPositions))}return this.status="done",{buckets:Object.values(_e).filter($t=>!$t.isEmpty()),featureIndex:fe,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ri.image,imageAtlas:Zn,glyphMap:this.returnDependencies?Lt:null,iconMap:this.returnDependencies?on:null,glyphPositions:this.returnDependencies?ri.positions:null}})}}function k(se,U,j){const Y=new u.z(U);for(const ne of se)ne.recalculate(Y,j)}class E{constructor(U,j,Y){this.actor=U,this.layerIndex=j,this.availableImages=Y,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(U,j){return u._(this,void 0,void 0,function*(){const Y=yield u.l(U.request,j);try{return{vectorTile:new u.bt.VectorTile(new u.bu(Y.data)),rawData:Y.data,cacheControl:Y.cacheControl,expires:Y.expires}}catch(ne){const de=new Uint8Array(Y.data);let fe=`Unable to parse the tile at ${U.request.url}, `;throw fe+=de[0]===31&&de[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${ne.message}`,new Error(fe)}})}loadTile(U){return u._(this,void 0,void 0,function*(){const j=U.uid,Y=!!(U&&U.request&&U.request.collectResourceTiming)&&new u.bv(U.request),ne=new _(U);this.loading[j]=ne;const de=new AbortController;ne.abort=de;try{const fe=yield this.loadVectorTile(U,de);if(delete this.loading[j],!fe)return null;const _e=fe.rawData,ue={};fe.expires&&(ue.expires=fe.expires),fe.cacheControl&&(ue.cacheControl=fe.cacheControl);const Te={};if(Y){const Se=Y.finish();Se&&(Te.resourceTiming=JSON.parse(JSON.stringify(Se)))}ne.vectorTile=fe.vectorTile;const ze=ne.parse(fe.vectorTile,this.layerIndex,this.availableImages,this.actor);this.loaded[j]=ne,this.fetching[j]={rawTileData:_e,cacheControl:ue,resourceTiming:Te};try{const Se=yield ze;return u.e({rawTileData:_e.slice(0)},Se,ue,Te)}finally{delete this.fetching[j]}}catch(fe){throw delete this.loading[j],ne.status="done",this.loaded[j]=ne,fe}})}reloadTile(U){return u._(this,void 0,void 0,function*(){const j=U.uid;if(!this.loaded||!this.loaded[j])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const Y=this.loaded[j];if(Y.showCollisionBoxes=U.showCollisionBoxes,Y.status==="parsing"){const ne=yield Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor);let de;if(this.fetching[j]){const{rawTileData:fe,cacheControl:_e,resourceTiming:ue}=this.fetching[j];delete this.fetching[j],de=u.e({rawTileData:fe.slice(0)},ne,_e,ue)}else de=ne;return de}if(Y.status==="done"&&Y.vectorTile)return Y.parse(Y.vectorTile,this.layerIndex,this.availableImages,this.actor)})}abortTile(U){return u._(this,void 0,void 0,function*(){const j=this.loading,Y=U.uid;j&&j[Y]&&j[Y].abort&&(j[Y].abort.abort(),delete j[Y])})}removeTile(U){return u._(this,void 0,void 0,function*(){this.loaded&&this.loaded[U.uid]&&delete this.loaded[U.uid]})}}class T{constructor(){this.loaded={}}loadTile(U){return u._(this,void 0,void 0,function*(){const{uid:j,encoding:Y,rawImageData:ne,redFactor:de,greenFactor:fe,blueFactor:_e,baseShift:ue}=U,Te=ne.width+2,ze=ne.height+2,Se=u.b(ne)?new u.R({width:Te,height:ze},yield u.bw(ne,-1,-1,Te,ze)):ne,Ue=new u.bx(j,Se,Y,de,fe,_e,ue);return this.loaded=this.loaded||{},this.loaded[j]=Ue,Ue})}removeTile(U){const j=this.loaded,Y=U.uid;j&&j[Y]&&delete j[Y]}}function I(se,U){if(se.length!==0){z(se[0],U);for(var j=1;j<se.length;j++)z(se[j],!U)}}function z(se,U){for(var j=0,Y=0,ne=0,de=se.length,fe=de-1;ne<de;fe=ne++){var _e=(se[ne][0]-se[fe][0])*(se[fe][1]+se[ne][1]),ue=j+_e;Y+=Math.abs(j)>=Math.abs(_e)?j-ue+_e:_e-ue+j,j=ue}j+Y>=0!=!!U&&se.reverse()}var V=u.by(function se(U,j){var Y,ne=U&&U.type;if(ne==="FeatureCollection")for(Y=0;Y<U.features.length;Y++)se(U.features[Y],j);else if(ne==="GeometryCollection")for(Y=0;Y<U.geometries.length;Y++)se(U.geometries[Y],j);else if(ne==="Feature")se(U.geometry,j);else if(ne==="Polygon")I(U.coordinates,j);else if(ne==="MultiPolygon")for(Y=0;Y<U.coordinates.length;Y++)I(U.coordinates[Y],j);return U});const H=u.bt.VectorTileFeature.prototype.toGeoJSON;var Z={exports:{}},ee=u.bz,oe=u.bt.VectorTileFeature,J=Ae;function Ae(se,U){this.options=U||{},this.features=se,this.length=se.length}function ke(se,U){this.id=typeof se.id=="number"?se.id:void 0,this.type=se.type,this.rawGeometry=se.type===1?[se.geometry]:se.geometry,this.properties=se.tags,this.extent=U||4096}Ae.prototype.feature=function(se){return new ke(this.features[se],this.options.extent)},ke.prototype.loadGeometry=function(){var se=this.rawGeometry;this.geometry=[];for(var U=0;U<se.length;U++){for(var j=se[U],Y=[],ne=0;ne<j.length;ne++)Y.push(new ee(j[ne][0],j[ne][1]));this.geometry.push(Y)}return this.geometry},ke.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var se=this.geometry,U=1/0,j=-1/0,Y=1/0,ne=-1/0,de=0;de<se.length;de++)for(var fe=se[de],_e=0;_e<fe.length;_e++){var ue=fe[_e];U=Math.min(U,ue.x),j=Math.max(j,ue.x),Y=Math.min(Y,ue.y),ne=Math.max(ne,ue.y)}return[U,Y,j,ne]},ke.prototype.toGeoJSON=oe.prototype.toGeoJSON;var Me=u.bA,Le=J;function Ie(se){var U=new Me;return function(j,Y){for(var ne in j.layers)Y.writeMessage(3,Ye,j.layers[ne])}(se,U),U.finish()}function Ye(se,U){var j;U.writeVarintField(15,se.version||1),U.writeStringField(1,se.name||""),U.writeVarintField(5,se.extent||4096);var Y={keys:[],values:[],keycache:{},valuecache:{}};for(j=0;j<se.length;j++)Y.feature=se.feature(j),U.writeMessage(2,it,Y);var ne=Y.keys;for(j=0;j<ne.length;j++)U.writeStringField(3,ne[j]);var de=Y.values;for(j=0;j<de.length;j++)U.writeMessage(4,nn,de[j])}function it(se,U){var j=se.feature;j.id!==void 0&&U.writeVarintField(1,j.id),U.writeMessage(2,Nt,se),U.writeVarintField(3,j.type),U.writeMessage(4,Xt,j)}function Nt(se,U){var j=se.feature,Y=se.keys,ne=se.values,de=se.keycache,fe=se.valuecache;for(var _e in j.properties){var ue=j.properties[_e],Te=de[_e];if(ue!==null){Te===void 0&&(Y.push(_e),de[_e]=Te=Y.length-1),U.writeVarint(Te);var ze=typeof ue;ze!=="string"&&ze!=="boolean"&&ze!=="number"&&(ue=JSON.stringify(ue));var Se=ze+":"+ue,Ue=fe[Se];Ue===void 0&&(ne.push(ue),fe[Se]=Ue=ne.length-1),U.writeVarint(Ue)}}}function ht(se,U){return(U<<3)+(7&se)}function Rt(se){return se<<1^se>>31}function Xt(se,U){for(var j=se.loadGeometry(),Y=se.type,ne=0,de=0,fe=j.length,_e=0;_e<fe;_e++){var ue=j[_e],Te=1;Y===1&&(Te=ue.length),U.writeVarint(ht(1,Te));for(var ze=Y===3?ue.length-1:ue.length,Se=0;Se<ze;Se++){Se===1&&Y!==1&&U.writeVarint(ht(2,ze-1));var Ue=ue[Se].x-ne,bt=ue[Se].y-de;U.writeVarint(Rt(Ue)),U.writeVarint(Rt(bt)),ne+=Ue,de+=bt}Y===3&&U.writeVarint(ht(7,1))}}function nn(se,U){var j=typeof se;j==="string"?U.writeStringField(1,se):j==="boolean"?U.writeBooleanField(7,se):j==="number"&&(se%1!=0?U.writeDoubleField(3,se):se<0?U.writeSVarintField(6,se):U.writeVarintField(5,se))}Z.exports=Ie,Z.exports.fromVectorTileJs=Ie,Z.exports.fromGeojsonVt=function(se,U){U=U||{};var j={};for(var Y in se)j[Y]=new Le(se[Y].features,U),j[Y].name=Y,j[Y].version=U.version,j[Y].extent=U.extent;return Ie({layers:j})},Z.exports.GeoJSONWrapper=Le;var jt=u.by(Z.exports);const Mt={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:se=>se},Sn=Math.fround||(hn=new Float32Array(1),se=>(hn[0]=+se,hn[0]));var hn;const In=3,bn=5,pi=6;class Wn{constructor(U){this.options=Object.assign(Object.create(Mt),U),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(U){const{log:j,minZoom:Y,maxZoom:ne}=this.options;j&&console.time("total time");const de=`prepare ${U.length} points`;j&&console.time(de),this.points=U;const fe=[];for(let ue=0;ue<U.length;ue++){const Te=U[ue];if(!Te.geometry)continue;const[ze,Se]=Te.geometry.coordinates,Ue=Sn(Ce(ze)),bt=Sn(je(Se));fe.push(Ue,bt,1/0,ue,-1,1),this.options.reduce&&fe.push(0)}let _e=this.trees[ne+1]=this._createTree(fe);j&&console.timeEnd(de);for(let ue=ne;ue>=Y;ue--){const Te=+Date.now();_e=this.trees[ue]=this._createTree(this._cluster(_e,ue)),j&&console.log("z%d: %d clusters in %dms",ue,_e.numItems,+Date.now()-Te)}return j&&console.timeEnd("total time"),this}getClusters(U,j){let Y=((U[0]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,U[1]));let de=U[2]===180?180:((U[2]+180)%360+360)%360-180;const fe=Math.max(-90,Math.min(90,U[3]));if(U[2]-U[0]>=360)Y=-180,de=180;else if(Y>de){const Se=this.getClusters([Y,ne,180,fe],j),Ue=this.getClusters([-180,ne,de,fe],j);return Se.concat(Ue)}const _e=this.trees[this._limitZoom(j)],ue=_e.range(Ce(Y),je(fe),Ce(de),je(ne)),Te=_e.data,ze=[];for(const Se of ue){const Ue=this.stride*Se;ze.push(Te[Ue+bn]>1?jn(Te,Ue,this.clusterProps):this.points[Te[Ue+In]])}return ze}getChildren(U){const j=this._getOriginId(U),Y=this._getOriginZoom(U),ne="No cluster with the specified id.",de=this.trees[Y];if(!de)throw new Error(ne);const fe=de.data;if(j*this.stride>=fe.length)throw new Error(ne);const _e=this.options.radius/(this.options.extent*Math.pow(2,Y-1)),ue=de.within(fe[j*this.stride],fe[j*this.stride+1],_e),Te=[];for(const ze of ue){const Se=ze*this.stride;fe[Se+4]===U&&Te.push(fe[Se+bn]>1?jn(fe,Se,this.clusterProps):this.points[fe[Se+In]])}if(Te.length===0)throw new Error(ne);return Te}getLeaves(U,j,Y){const ne=[];return this._appendLeaves(ne,U,j=j||10,Y=Y||0,0),ne}getTile(U,j,Y){const ne=this.trees[this._limitZoom(U)],de=Math.pow(2,U),{extent:fe,radius:_e}=this.options,ue=_e/fe,Te=(Y-ue)/de,ze=(Y+1+ue)/de,Se={features:[]};return this._addTileFeatures(ne.range((j-ue)/de,Te,(j+1+ue)/de,ze),ne.data,j,Y,de,Se),j===0&&this._addTileFeatures(ne.range(1-ue/de,Te,1,ze),ne.data,de,Y,de,Se),j===de-1&&this._addTileFeatures(ne.range(0,Te,ue/de,ze),ne.data,-1,Y,de,Se),Se.features.length?Se:null}getClusterExpansionZoom(U){let j=this._getOriginZoom(U)-1;for(;j<=this.options.maxZoom;){const Y=this.getChildren(U);if(j++,Y.length!==1)break;U=Y[0].properties.cluster_id}return j}_appendLeaves(U,j,Y,ne,de){const fe=this.getChildren(j);for(const _e of fe){const ue=_e.properties;if(ue&&ue.cluster?de+ue.point_count<=ne?de+=ue.point_count:de=this._appendLeaves(U,ue.cluster_id,Y,ne,de):de<ne?de++:U.push(_e),U.length===Y)break}return de}_createTree(U){const j=new u.av(U.length/this.stride|0,this.options.nodeSize,Float32Array);for(let Y=0;Y<U.length;Y+=this.stride)j.add(U[Y],U[Y+1]);return j.finish(),j.data=U,j}_addTileFeatures(U,j,Y,ne,de,fe){for(const _e of U){const ue=_e*this.stride,Te=j[ue+bn]>1;let ze,Se,Ue;if(Te)ze=Gn(j,ue,this.clusterProps),Se=j[ue],Ue=j[ue+1];else{const sn=this.points[j[ue+In]];ze=sn.properties;const[Lt,on]=sn.geometry.coordinates;Se=Ce(Lt),Ue=je(on)}const bt={type:1,geometry:[[Math.round(this.options.extent*(Se*de-Y)),Math.round(this.options.extent*(Ue*de-ne))]],tags:ze};let kt;kt=Te||this.options.generateId?j[ue+In]:this.points[j[ue+In]].id,kt!==void 0&&(bt.id=kt),fe.features.push(bt)}}_limitZoom(U){return Math.max(this.options.minZoom,Math.min(Math.floor(+U),this.options.maxZoom+1))}_cluster(U,j){const{radius:Y,extent:ne,reduce:de,minPoints:fe}=this.options,_e=Y/(ne*Math.pow(2,j)),ue=U.data,Te=[],ze=this.stride;for(let Se=0;Se<ue.length;Se+=ze){if(ue[Se+2]<=j)continue;ue[Se+2]=j;const Ue=ue[Se],bt=ue[Se+1],kt=U.within(ue[Se],ue[Se+1],_e),sn=ue[Se+bn];let Lt=sn;for(const on of kt){const Zt=on*ze;ue[Zt+2]>j&&(Lt+=ue[Zt+bn])}if(Lt>sn&&Lt>=fe){let on,Zt=Ue*sn,ri=bt*sn,Zn=-1;const $t=((Se/ze|0)<<5)+(j+1)+this.points.length;for(const xn of kt){const Un=xn*ze;if(ue[Un+2]<=j)continue;ue[Un+2]=j;const fi=ue[Un+bn];Zt+=ue[Un]*fi,ri+=ue[Un+1]*fi,ue[Un+4]=$t,de&&(on||(on=this._map(ue,Se,!0),Zn=this.clusterProps.length,this.clusterProps.push(on)),de(on,this._map(ue,Un)))}ue[Se+4]=$t,Te.push(Zt/Lt,ri/Lt,1/0,$t,-1,Lt),de&&Te.push(Zn)}else{for(let on=0;on<ze;on++)Te.push(ue[Se+on]);if(Lt>1)for(const on of kt){const Zt=on*ze;if(!(ue[Zt+2]<=j)){ue[Zt+2]=j;for(let ri=0;ri<ze;ri++)Te.push(ue[Zt+ri])}}}}return Te}_getOriginId(U){return U-this.points.length>>5}_getOriginZoom(U){return(U-this.points.length)%32}_map(U,j,Y){if(U[j+bn]>1){const fe=this.clusterProps[U[j+pi]];return Y?Object.assign({},fe):fe}const ne=this.points[U[j+In]].properties,de=this.options.map(ne);return Y&&de===ne?Object.assign({},de):de}}function jn(se,U,j){return{type:"Feature",id:se[U+In],properties:Gn(se,U,j),geometry:{type:"Point",coordinates:[(Y=se[U],360*(Y-.5)),Xe(se[U+1])]}};var Y}function Gn(se,U,j){const Y=se[U+bn],ne=Y>=1e4?`${Math.round(Y/1e3)}k`:Y>=1e3?Math.round(Y/100)/10+"k":Y,de=se[U+pi],fe=de===-1?{}:Object.assign({},j[de]);return Object.assign(fe,{cluster:!0,cluster_id:se[U+In],point_count:Y,point_count_abbreviated:ne})}function Ce(se){return se/360+.5}function je(se){const U=Math.sin(se*Math.PI/180),j=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return j<0?0:j>1?1:j}function Xe(se){const U=(180-360*se)*Math.PI/180;return 360*Math.atan(Math.exp(U))/Math.PI-90}function lt(se,U,j,Y){let ne=Y;const de=U+(j-U>>1);let fe,_e=j-U;const ue=se[U],Te=se[U+1],ze=se[j],Se=se[j+1];for(let Ue=U+3;Ue<j;Ue+=3){const bt=Bt(se[Ue],se[Ue+1],ue,Te,ze,Se);if(bt>ne)fe=Ue,ne=bt;else if(bt===ne){const kt=Math.abs(Ue-de);kt<_e&&(fe=Ue,_e=kt)}}ne>Y&&(fe-U>3&&lt(se,U,fe,Y),se[fe+2]=ne,j-fe>3&&lt(se,fe,j,Y))}function Bt(se,U,j,Y,ne,de){let fe=ne-j,_e=de-Y;if(fe!==0||_e!==0){const ue=((se-j)*fe+(U-Y)*_e)/(fe*fe+_e*_e);ue>1?(j=ne,Y=de):ue>0&&(j+=fe*ue,Y+=_e*ue)}return fe=se-j,_e=U-Y,fe*fe+_e*_e}function rn(se,U,j,Y){const ne={id:se??null,type:U,geometry:j,tags:Y,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(U==="Point"||U==="MultiPoint"||U==="LineString")Dt(ne,j);else if(U==="Polygon")Dt(ne,j[0]);else if(U==="MultiLineString")for(const de of j)Dt(ne,de);else if(U==="MultiPolygon")for(const de of j)Dt(ne,de[0]);return ne}function Dt(se,U){for(let j=0;j<U.length;j+=3)se.minX=Math.min(se.minX,U[j]),se.minY=Math.min(se.minY,U[j+1]),se.maxX=Math.max(se.maxX,U[j]),se.maxY=Math.max(se.maxY,U[j+1])}function At(se,U,j,Y){if(!U.geometry)return;const ne=U.geometry.coordinates;if(ne&&ne.length===0)return;const de=U.geometry.type,fe=Math.pow(j.tolerance/((1<<j.maxZoom)*j.extent),2);let _e=[],ue=U.id;if(j.promoteId?ue=U.properties[j.promoteId]:j.generateId&&(ue=Y||0),de==="Point")ln(ne,_e);else if(de==="MultiPoint")for(const Te of ne)ln(Te,_e);else if(de==="LineString")we(ne,_e,fe,!1);else if(de==="MultiLineString"){if(j.lineMetrics){for(const Te of ne)_e=[],we(Te,_e,fe,!1),se.push(rn(ue,"LineString",_e,U.properties));return}En(ne,_e,fe,!1)}else if(de==="Polygon")En(ne,_e,fe,!0);else{if(de!=="MultiPolygon"){if(de==="GeometryCollection"){for(const Te of U.geometry.geometries)At(se,{id:ue,geometry:Te,properties:U.properties},j,Y);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Te of ne){const ze=[];En(Te,ze,fe,!0),_e.push(ze)}}se.push(rn(ue,de,_e,U.properties))}function ln(se,U){U.push(Ss(se[0]),Kt(se[1]),0)}function we(se,U,j,Y){let ne,de,fe=0;for(let ue=0;ue<se.length;ue++){const Te=Ss(se[ue][0]),ze=Kt(se[ue][1]);U.push(Te,ze,0),ue>0&&(fe+=Y?(ne*ze-Te*de)/2:Math.sqrt(Math.pow(Te-ne,2)+Math.pow(ze-de,2))),ne=Te,de=ze}const _e=U.length-3;U[2]=1,lt(U,0,_e,j),U[_e+2]=1,U.size=Math.abs(fe),U.start=0,U.end=U.size}function En(se,U,j,Y){for(let ne=0;ne<se.length;ne++){const de=[];we(se[ne],de,j,Y),U.push(de)}}function Ss(se){return se/360+.5}function Kt(se){const U=Math.sin(se*Math.PI/180),j=.5-.25*Math.log((1+U)/(1-U))/Math.PI;return j<0?0:j>1?1:j}function dn(se,U,j,Y,ne,de,fe,_e){if(Y/=U,de>=(j/=U)&&fe<Y)return se;if(fe<j||de>=Y)return null;const ue=[];for(const Te of se){const ze=Te.geometry;let Se=Te.type;const Ue=ne===0?Te.minX:Te.minY,bt=ne===0?Te.maxX:Te.maxY;if(Ue>=j&&bt<Y){ue.push(Te);continue}if(bt<j||Ue>=Y)continue;let kt=[];if(Se==="Point"||Se==="MultiPoint")er(ze,kt,j,Y,ne);else if(Se==="LineString")tr(ze,kt,j,Y,ne,!1,_e.lineMetrics);else if(Se==="MultiLineString")Dr(ze,kt,j,Y,ne,!1);else if(Se==="Polygon")Dr(ze,kt,j,Y,ne,!0);else if(Se==="MultiPolygon")for(const sn of ze){const Lt=[];Dr(sn,Lt,j,Y,ne,!0),Lt.length&&kt.push(Lt)}if(kt.length){if(_e.lineMetrics&&Se==="LineString"){for(const sn of kt)ue.push(rn(Te.id,Se,sn,Te.tags));continue}Se!=="LineString"&&Se!=="MultiLineString"||(kt.length===1?(Se="LineString",kt=kt[0]):Se="MultiLineString"),Se!=="Point"&&Se!=="MultiPoint"||(Se=kt.length===3?"Point":"MultiPoint"),ue.push(rn(Te.id,Se,kt,Te.tags))}}return ue.length?ue:null}function er(se,U,j,Y,ne){for(let de=0;de<se.length;de+=3){const fe=se[de+ne];fe>=j&&fe<=Y&&xi(U,se[de],se[de+1],se[de+2])}}function tr(se,U,j,Y,ne,de,fe){let _e=bi(se);const ue=ne===0?Es:Cs;let Te,ze,Se=se.start;for(let Lt=0;Lt<se.length-3;Lt+=3){const on=se[Lt],Zt=se[Lt+1],ri=se[Lt+2],Zn=se[Lt+3],$t=se[Lt+4],xn=ne===0?on:Zt,Un=ne===0?Zn:$t;let fi=!1;fe&&(Te=Math.sqrt(Math.pow(on-Zn,2)+Math.pow(Zt-$t,2))),xn<j?Un>j&&(ze=ue(_e,on,Zt,Zn,$t,j),fe&&(_e.start=Se+Te*ze)):xn>Y?Un<Y&&(ze=ue(_e,on,Zt,Zn,$t,Y),fe&&(_e.start=Se+Te*ze)):xi(_e,on,Zt,ri),Un<j&&xn>=j&&(ze=ue(_e,on,Zt,Zn,$t,j),fi=!0),Un>Y&&xn<=Y&&(ze=ue(_e,on,Zt,Zn,$t,Y),fi=!0),!de&&fi&&(fe&&(_e.end=Se+Te*ze),U.push(_e),_e=bi(se)),fe&&(Se+=Te)}let Ue=se.length-3;const bt=se[Ue],kt=se[Ue+1],sn=ne===0?bt:kt;sn>=j&&sn<=Y&&xi(_e,bt,kt,se[Ue+2]),Ue=_e.length-3,de&&Ue>=3&&(_e[Ue]!==_e[0]||_e[Ue+1]!==_e[1])&&xi(_e,_e[0],_e[1],_e[2]),_e.length&&U.push(_e)}function bi(se){const U=[];return U.size=se.size,U.start=se.start,U.end=se.end,U}function Dr(se,U,j,Y,ne,de){for(const fe of se)tr(fe,U,j,Y,ne,de,!1)}function xi(se,U,j,Y){se.push(U,j,Y)}function Es(se,U,j,Y,ne,de){const fe=(de-U)/(Y-U);return xi(se,de,j+(ne-j)*fe,1),fe}function Cs(se,U,j,Y,ne,de){const fe=(de-j)/(ne-j);return xi(se,U+(Y-U)*fe,de,1),fe}function Be(se,U){const j=[];for(let Y=0;Y<se.length;Y++){const ne=se[Y],de=ne.type;let fe;if(de==="Point"||de==="MultiPoint"||de==="LineString")fe=Or(ne.geometry,U);else if(de==="MultiLineString"||de==="Polygon"){fe=[];for(const _e of ne.geometry)fe.push(Or(_e,U))}else if(de==="MultiPolygon"){fe=[];for(const _e of ne.geometry){const ue=[];for(const Te of _e)ue.push(Or(Te,U));fe.push(ue)}}j.push(rn(ne.id,de,fe,ne.tags))}return j}function Or(se,U){const j=[];j.size=se.size,se.start!==void 0&&(j.start=se.start,j.end=se.end);for(let Y=0;Y<se.length;Y+=3)j.push(se[Y]+U,se[Y+1],se[Y+2]);return j}function vi(se,U){if(se.transformed)return se;const j=1<<se.z,Y=se.x,ne=se.y;for(const de of se.features){const fe=de.geometry,_e=de.type;if(de.geometry=[],_e===1)for(let ue=0;ue<fe.length;ue+=2)de.geometry.push(zr(fe[ue],fe[ue+1],U,j,Y,ne));else for(let ue=0;ue<fe.length;ue++){const Te=[];for(let ze=0;ze<fe[ue].length;ze+=2)Te.push(zr(fe[ue][ze],fe[ue][ze+1],U,j,Y,ne));de.geometry.push(Te)}}return se.transformed=!0,se}function zr(se,U,j,Y,ne,de){return[Math.round(j*(se*Y-ne)),Math.round(j*(U*Y-de))]}function Ts(se,U,j,Y,ne){const de=U===ne.maxZoom?0:ne.tolerance/((1<<U)*ne.extent),fe={features:[],numPoints:0,numSimplified:0,numFeatures:se.length,source:null,x:j,y:Y,z:U,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const _e of se)qe(fe,_e,de,ne);return fe}function qe(se,U,j,Y){const ne=U.geometry,de=U.type,fe=[];if(se.minX=Math.min(se.minX,U.minX),se.minY=Math.min(se.minY,U.minY),se.maxX=Math.max(se.maxX,U.maxX),se.maxY=Math.max(se.maxY,U.maxY),de==="Point"||de==="MultiPoint")for(let _e=0;_e<ne.length;_e+=3)fe.push(ne[_e],ne[_e+1]),se.numPoints++,se.numSimplified++;else if(de==="LineString")ve(fe,ne,se,j,!1,!1);else if(de==="MultiLineString"||de==="Polygon")for(let _e=0;_e<ne.length;_e++)ve(fe,ne[_e],se,j,de==="Polygon",_e===0);else if(de==="MultiPolygon")for(let _e=0;_e<ne.length;_e++){const ue=ne[_e];for(let Te=0;Te<ue.length;Te++)ve(fe,ue[Te],se,j,!0,Te===0)}if(fe.length){let _e=U.tags||null;if(de==="LineString"&&Y.lineMetrics){_e={};for(const Te in U.tags)_e[Te]=U.tags[Te];_e.mapbox_clip_start=ne.start/ne.size,_e.mapbox_clip_end=ne.end/ne.size}const ue={geometry:fe,type:de==="Polygon"||de==="MultiPolygon"?3:de==="LineString"||de==="MultiLineString"?2:1,tags:_e};U.id!==null&&(ue.id=U.id),se.features.push(ue)}}function ve(se,U,j,Y,ne,de){const fe=Y*Y;if(Y>0&&U.size<(ne?fe:Y))return void(j.numPoints+=U.length/3);const _e=[];for(let ue=0;ue<U.length;ue+=3)(Y===0||U[ue+2]>fe)&&(j.numSimplified++,_e.push(U[ue],U[ue+1])),j.numPoints++;ne&&function(ue,Te){let ze=0;for(let Se=0,Ue=ue.length,bt=Ue-2;Se<Ue;bt=Se,Se+=2)ze+=(ue[Se]-ue[bt])*(ue[Se+1]+ue[bt+1]);if(ze>0===Te)for(let Se=0,Ue=ue.length;Se<Ue/2;Se+=2){const bt=ue[Se],kt=ue[Se+1];ue[Se]=ue[Ue-2-Se],ue[Se+1]=ue[Ue-1-Se],ue[Ue-2-Se]=bt,ue[Ue-1-Se]=kt}}(_e,de),se.push(_e)}const Re={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class xt{constructor(U,j){const Y=(j=this.options=function(de,fe){for(const _e in fe)de[_e]=fe[_e];return de}(Object.create(Re),j)).debug;if(Y&&console.time("preprocess data"),j.maxZoom<0||j.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(j.promoteId&&j.generateId)throw new Error("promoteId and generateId cannot be used together.");let ne=function(de,fe){const _e=[];if(de.type==="FeatureCollection")for(let ue=0;ue<de.features.length;ue++)At(_e,de.features[ue],fe,ue);else At(_e,de.type==="Feature"?de:{geometry:de},fe);return _e}(U,j);this.tiles={},this.tileCoords=[],Y&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",j.indexMaxZoom,j.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),ne=function(de,fe){const _e=fe.buffer/fe.extent;let ue=de;const Te=dn(de,1,-1-_e,_e,0,-1,2,fe),ze=dn(de,1,1-_e,2+_e,0,-1,2,fe);return(Te||ze)&&(ue=dn(de,1,-_e,1+_e,0,-1,2,fe)||[],Te&&(ue=Be(Te,1).concat(ue)),ze&&(ue=ue.concat(Be(ze,-1)))),ue}(ne,j),ne.length&&this.splitTile(ne,0,0,0),Y&&(ne.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(U,j,Y,ne,de,fe,_e){const ue=[U,j,Y,ne],Te=this.options,ze=Te.debug;for(;ue.length;){ne=ue.pop(),Y=ue.pop(),j=ue.pop(),U=ue.pop();const Se=1<<j,Ue=Ut(j,Y,ne);let bt=this.tiles[Ue];if(!bt&&(ze>1&&console.time("creation"),bt=this.tiles[Ue]=Ts(U,j,Y,ne,Te),this.tileCoords.push({z:j,x:Y,y:ne}),ze)){ze>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",j,Y,ne,bt.numFeatures,bt.numPoints,bt.numSimplified),console.timeEnd("creation"));const fi=`z${j}`;this.stats[fi]=(this.stats[fi]||0)+1,this.total++}if(bt.source=U,de==null){if(j===Te.indexMaxZoom||bt.numPoints<=Te.indexMaxPoints)continue}else{if(j===Te.maxZoom||j===de)continue;if(de!=null){const fi=de-j;if(Y!==fe>>fi||ne!==_e>>fi)continue}}if(bt.source=null,U.length===0)continue;ze>1&&console.time("clipping");const kt=.5*Te.buffer/Te.extent,sn=.5-kt,Lt=.5+kt,on=1+kt;let Zt=null,ri=null,Zn=null,$t=null,xn=dn(U,Se,Y-kt,Y+Lt,0,bt.minX,bt.maxX,Te),Un=dn(U,Se,Y+sn,Y+on,0,bt.minX,bt.maxX,Te);U=null,xn&&(Zt=dn(xn,Se,ne-kt,ne+Lt,1,bt.minY,bt.maxY,Te),ri=dn(xn,Se,ne+sn,ne+on,1,bt.minY,bt.maxY,Te),xn=null),Un&&(Zn=dn(Un,Se,ne-kt,ne+Lt,1,bt.minY,bt.maxY,Te),$t=dn(Un,Se,ne+sn,ne+on,1,bt.minY,bt.maxY,Te),Un=null),ze>1&&console.timeEnd("clipping"),ue.push(Zt||[],j+1,2*Y,2*ne),ue.push(ri||[],j+1,2*Y,2*ne+1),ue.push(Zn||[],j+1,2*Y+1,2*ne),ue.push($t||[],j+1,2*Y+1,2*ne+1)}}getTile(U,j,Y){U=+U,j=+j,Y=+Y;const ne=this.options,{extent:de,debug:fe}=ne;if(U<0||U>24)return null;const _e=1<<U,ue=Ut(U,j=j+_e&_e-1,Y);if(this.tiles[ue])return vi(this.tiles[ue],de);fe>1&&console.log("drilling down to z%d-%d-%d",U,j,Y);let Te,ze=U,Se=j,Ue=Y;for(;!Te&&ze>0;)ze--,Se>>=1,Ue>>=1,Te=this.tiles[Ut(ze,Se,Ue)];return Te&&Te.source?(fe>1&&(console.log("found parent tile z%d-%d-%d",ze,Se,Ue),console.time("drilling down")),this.splitTile(Te.source,ze,Se,Ue,U,j,Y),fe>1&&console.timeEnd("drilling down"),this.tiles[ue]?vi(this.tiles[ue],de):null):null}}function Ut(se,U,j){return 32*((1<<se)*j+U)+se}function Je(se,U){return U?se.properties[U]:se.id}function Rn(se,U){if(se==null)return!0;if(se.type==="Feature")return Je(se,U)!=null;if(se.type==="FeatureCollection"){const j=new Set;for(const Y of se.features){const ne=Je(Y,U);if(ne==null||j.has(ne))return!1;j.add(ne)}return!0}return!1}function Kn(se,U){const j=new Map;if(se!=null)if(se.type==="Feature")j.set(Je(se,U),se);else for(const Y of se.features)j.set(Je(Y,U),Y);return j}class Ui extends E{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(U,j){return u._(this,void 0,void 0,function*(){const Y=U.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const ne=this._geoJSONIndex.getTile(Y.z,Y.x,Y.y);if(!ne)return null;const de=new class{constructor(_e){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=u.X,this.length=_e.length,this._features=_e}feature(_e){return new class{constructor(ue){this._feature=ue,this.extent=u.X,this.type=ue.type,this.properties=ue.tags,"id"in ue&&!isNaN(ue.id)&&(this.id=parseInt(ue.id,10))}loadGeometry(){if(this._feature.type===1){const ue=[];for(const Te of this._feature.geometry)ue.push([new u.P(Te[0],Te[1])]);return ue}{const ue=[];for(const Te of this._feature.geometry){const ze=[];for(const Se of Te)ze.push(new u.P(Se[0],Se[1]));ue.push(ze)}return ue}}toGeoJSON(ue,Te,ze){return H.call(this,ue,Te,ze)}}(this._features[_e])}}(ne.features);let fe=jt(de);return fe.byteOffset===0&&fe.byteLength===fe.buffer.byteLength||(fe=new Uint8Array(fe)),{vectorTile:de,rawData:fe.buffer}})}loadData(U){return u._(this,void 0,void 0,function*(){var j;(j=this._pendingRequest)===null||j===void 0||j.abort();const Y=!!(U&&U.request&&U.request.collectResourceTiming)&&new u.bv(U.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(U,this._pendingRequest),this._geoJSONIndex=U.cluster?new Wn(function({superclusterOptions:fe,clusterProperties:_e}){if(!_e||!fe)return fe;const ue={},Te={},ze={accumulated:null,zoom:0},Se={properties:null},Ue=Object.keys(_e);for(const bt of Ue){const[kt,sn]=_e[bt],Lt=u.bC(sn),on=u.bC(typeof kt=="string"?[kt,["accumulated"],["get",bt]]:kt);ue[bt]=Lt.value,Te[bt]=on.value}return fe.map=bt=>{Se.properties=bt;const kt={};for(const sn of Ue)kt[sn]=ue[sn].evaluate(ze,Se);return kt},fe.reduce=(bt,kt)=>{Se.properties=kt;for(const sn of Ue)ze.accumulated=bt[sn],bt[sn]=Te[sn].evaluate(ze,Se)},fe}(U)).load((yield this._pendingData).features):(ne=yield this._pendingData,new xt(ne,U.geojsonVtOptions)),this.loaded={};const de={};if(Y){const fe=Y.finish();fe&&(de.resourceTiming={},de.resourceTiming[U.source]=JSON.parse(JSON.stringify(fe)))}return de}catch(de){if(delete this._pendingRequest,u.bB(de))return{abandoned:!0};throw de}var ne})}getData(){return u._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(U){const j=this.loaded;return j&&j[U.uid]?super.reloadTile(U):this.loadTile(U)}loadAndProcessGeoJSON(U,j){return u._(this,void 0,void 0,function*(){let Y=yield this.loadGeoJSON(U,j);if(delete this._pendingRequest,typeof Y!="object")throw new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`);if(V(Y,!0),U.filter){const ne=u.bC(U.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(ne.result==="error")throw new Error(ne.value.map(fe=>`${fe.key}: ${fe.message}`).join(", "));Y={type:"FeatureCollection",features:Y.features.filter(fe=>ne.value.evaluate({zoom:0},fe))}}return Y})}loadGeoJSON(U,j){return u._(this,void 0,void 0,function*(){const{promoteId:Y}=U;if(U.request){const ne=yield u.h(U.request,j);return this._dataUpdateable=Rn(ne.data,Y)?Kn(ne.data,Y):void 0,ne.data}if(typeof U.data=="string")try{const ne=JSON.parse(U.data);return this._dataUpdateable=Rn(ne,Y)?Kn(ne,Y):void 0,ne}catch{throw new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`)}if(!U.dataDiff)throw new Error(`Input data given to '${U.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${U.source}`);return function(ne,de,fe){var _e,ue,Te,ze;if(de.removeAll&&ne.clear(),de.remove)for(const Se of de.remove)ne.delete(Se);if(de.add)for(const Se of de.add){const Ue=Je(Se,fe);Ue!=null&&ne.set(Ue,Se)}if(de.update)for(const Se of de.update){let Ue=ne.get(Se.id);if(Ue==null)continue;const bt=!Se.removeAllProperties&&(((_e=Se.removeProperties)===null||_e===void 0?void 0:_e.length)>0||((ue=Se.addOrUpdateProperties)===null||ue===void 0?void 0:ue.length)>0);if((Se.newGeometry||Se.removeAllProperties||bt)&&(Ue=Object.assign({},Ue),ne.set(Se.id,Ue),bt&&(Ue.properties=Object.assign({},Ue.properties))),Se.newGeometry&&(Ue.geometry=Se.newGeometry),Se.removeAllProperties)Ue.properties={};else if(((Te=Se.removeProperties)===null||Te===void 0?void 0:Te.length)>0)for(const kt of Se.removeProperties)Object.prototype.hasOwnProperty.call(Ue.properties,kt)&&delete Ue.properties[kt];if(((ze=Se.addOrUpdateProperties)===null||ze===void 0?void 0:ze.length)>0)for(const{key:kt,value:sn}of Se.addOrUpdateProperties)Ue.properties[kt]=sn}}(this._dataUpdateable,U.dataDiff,Y),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(U){return u._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(U){return this._geoJSONIndex.getClusterExpansionZoom(U.clusterId)}getClusterChildren(U){return this._geoJSONIndex.getChildren(U.clusterId)}getClusterLeaves(U){return this._geoJSONIndex.getLeaves(U.clusterId,U.limit,U.offset)}}class pr{constructor(U){this.self=U,this.actor=new u.F(U),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(j,Y)=>{if(this.externalWorkerSourceTypes[j])throw new Error(`Worker source with name "${j}" already registered.`);this.externalWorkerSourceTypes[j]=Y},this.self.addProtocol=u.bi,this.self.removeProtocol=u.bj,this.self.registerRTLTextPlugin=j=>{if(u.bD.isParsed())throw new Error("RTL text plugin already registered.");u.bD.setMethods(j)},this.actor.registerMessageHandler("LDT",(j,Y)=>this._getDEMWorkerSource(j,Y.source).loadTile(Y)),this.actor.registerMessageHandler("RDT",(j,Y)=>u._(this,void 0,void 0,function*(){this._getDEMWorkerSource(j,Y.source).removeTile(Y)})),this.actor.registerMessageHandler("GCEZ",(j,Y)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(j,Y.type,Y.source).getClusterExpansionZoom(Y)})),this.actor.registerMessageHandler("GCC",(j,Y)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(j,Y.type,Y.source).getClusterChildren(Y)})),this.actor.registerMessageHandler("GCL",(j,Y)=>u._(this,void 0,void 0,function*(){return this._getWorkerSource(j,Y.type,Y.source).getClusterLeaves(Y)})),this.actor.registerMessageHandler("LD",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).loadData(Y)),this.actor.registerMessageHandler("GD",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).getData()),this.actor.registerMessageHandler("LT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).loadTile(Y)),this.actor.registerMessageHandler("RT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).reloadTile(Y)),this.actor.registerMessageHandler("AT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).abortTile(Y)),this.actor.registerMessageHandler("RMT",(j,Y)=>this._getWorkerSource(j,Y.type,Y.source).removeTile(Y)),this.actor.registerMessageHandler("RS",(j,Y)=>u._(this,void 0,void 0,function*(){if(!this.workerSources[j]||!this.workerSources[j][Y.type]||!this.workerSources[j][Y.type][Y.source])return;const ne=this.workerSources[j][Y.type][Y.source];delete this.workerSources[j][Y.type][Y.source],ne.removeSource!==void 0&&ne.removeSource(Y)})),this.actor.registerMessageHandler("RM",j=>u._(this,void 0,void 0,function*(){delete this.layerIndexes[j],delete this.availableImages[j],delete this.workerSources[j],delete this.demWorkerSources[j]})),this.actor.registerMessageHandler("SR",(j,Y)=>u._(this,void 0,void 0,function*(){this.referrer=Y})),this.actor.registerMessageHandler("SRPS",(j,Y)=>this._syncRTLPluginState(j,Y)),this.actor.registerMessageHandler("IS",(j,Y)=>u._(this,void 0,void 0,function*(){this.self.importScripts(Y)})),this.actor.registerMessageHandler("SI",(j,Y)=>this._setImages(j,Y)),this.actor.registerMessageHandler("UL",(j,Y)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(j).update(Y.layers,Y.removedIds)})),this.actor.registerMessageHandler("SL",(j,Y)=>u._(this,void 0,void 0,function*(){this._getLayerIndex(j).replace(Y)}))}_setImages(U,j){return u._(this,void 0,void 0,function*(){this.availableImages[U]=j;for(const Y in this.workerSources[U]){const ne=this.workerSources[U][Y];for(const de in ne)ne[de].availableImages=j}})}_syncRTLPluginState(U,j){return u._(this,void 0,void 0,function*(){if(u.bD.isParsed())return u.bD.getState();if(j.pluginStatus!=="loading")return u.bD.setState(j),j;const Y=j.pluginURL;if(this.self.importScripts(Y),u.bD.isParsed()){const ne={pluginStatus:"loaded",pluginURL:Y};return u.bD.setState(ne),ne}throw u.bD.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${Y}`)})}_getAvailableImages(U){let j=this.availableImages[U];return j||(j=[]),j}_getLayerIndex(U){let j=this.layerIndexes[U];return j||(j=this.layerIndexes[U]=new l),j}_getWorkerSource(U,j,Y){if(this.workerSources[U]||(this.workerSources[U]={}),this.workerSources[U][j]||(this.workerSources[U][j]={}),!this.workerSources[U][j][Y]){const ne={sendAsync:(de,fe)=>(de.targetMapId=U,this.actor.sendAsync(de,fe))};switch(j){case"vector":this.workerSources[U][j][Y]=new E(ne,this._getLayerIndex(U),this._getAvailableImages(U));break;case"geojson":this.workerSources[U][j][Y]=new Ui(ne,this._getLayerIndex(U),this._getAvailableImages(U));break;default:this.workerSources[U][j][Y]=new this.externalWorkerSourceTypes[j](ne,this._getLayerIndex(U),this._getAvailableImages(U))}}return this.workerSources[U][j][Y]}_getDEMWorkerSource(U,j){return this.demWorkerSources[U]||(this.demWorkerSources[U]={}),this.demWorkerSources[U][j]||(this.demWorkerSources[U][j]=new T),this.demWorkerSources[U][j]}}return u.i(self)&&(self.worker=new pr(self)),pr}),r("index",["exports","./shared"],function(u,l){var g="4.7.0";let _,k;const E={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frameAsync:x=>new Promise((s,d)=>{const f=requestAnimationFrame(s);x.signal.addEventListener("abort",()=>{cancelAnimationFrame(f),d(l.c())})}),getImageData(x,s=0){return this.getImageCanvasContext(x).getImageData(-s,-s,x.width+2*s,x.height+2*s)},getImageCanvasContext(x){const s=window.document.createElement("canvas"),d=s.getContext("2d",{willReadFrequently:!0});if(!d)throw new Error("failed to create canvas 2d context");return s.width=x.width,s.height=x.height,d.drawImage(x,0,0,x.width,x.height),d},resolveURL:x=>(_||(_=document.createElement("a")),_.href=x,_.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(k==null&&(k=matchMedia("(prefers-reduced-motion: reduce)")),k.matches)}};class T{static testProp(s){if(!T.docStyle)return s[0];for(let d=0;d<s.length;d++)if(s[d]in T.docStyle)return s[d];return s[0]}static create(s,d,f){const m=window.document.createElement(s);return d!==void 0&&(m.className=d),f&&f.appendChild(m),m}static createNS(s,d){return window.document.createElementNS(s,d)}static disableDrag(){T.docStyle&&T.selectProp&&(T.userSelect=T.docStyle[T.selectProp],T.docStyle[T.selectProp]="none")}static enableDrag(){T.docStyle&&T.selectProp&&(T.docStyle[T.selectProp]=T.userSelect)}static setTransform(s,d){s.style[T.transformProp]=d}static addEventListener(s,d,f,m={}){s.addEventListener(d,f,"passive"in m?m:m.capture)}static removeEventListener(s,d,f,m={}){s.removeEventListener(d,f,"passive"in m?m:m.capture)}static suppressClickInternal(s){s.preventDefault(),s.stopPropagation(),window.removeEventListener("click",T.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",T.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",T.suppressClickInternal,!0)},0)}static getScale(s){const d=s.getBoundingClientRect();return{x:d.width/s.offsetWidth||1,y:d.height/s.offsetHeight||1,boundingClientRect:d}}static getPoint(s,d,f){const m=d.boundingClientRect;return new l.P((f.clientX-m.left)/d.x-s.clientLeft,(f.clientY-m.top)/d.y-s.clientTop)}static mousePos(s,d){const f=T.getScale(s);return T.getPoint(s,f,d)}static touchPos(s,d){const f=[],m=T.getScale(s);for(let b=0;b<d.length;b++)f.push(T.getPoint(s,m,d[b]));return f}static mouseButton(s){return s.button}static remove(s){s.parentNode&&s.parentNode.removeChild(s)}}T.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,T.selectProp=T.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),T.transformProp=T.testProp(["transform","WebkitTransform"]);const I={supported:!1,testSupport:function(x){!H&&V&&(Z?ee(x):z=x)}};let z,V,H=!1,Z=!1;function ee(x){const s=x.createTexture();x.bindTexture(x.TEXTURE_2D,s);try{if(x.texImage2D(x.TEXTURE_2D,0,x.RGBA,x.RGBA,x.UNSIGNED_BYTE,V),x.isContextLost())return;I.supported=!0}catch{}x.deleteTexture(s),H=!0}var oe;typeof document<"u"&&(V=document.createElement("img"),V.onload=()=>{z&&ee(z),z=null,Z=!0},V.onerror=()=>{H=!0,z=null},V.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(x){let s,d,f,m;x.resetRequestQueue=()=>{s=[],d=0,f=0,m={}},x.addThrottleControl=D=>{const L=f++;return m[L]=D,L},x.removeThrottleControl=D=>{delete m[D],M()},x.getImage=(D,L,B=!0)=>new Promise((F,W)=>{I.supported&&(D.headers||(D.headers={}),D.headers.accept="image/webp,*/*"),l.e(D,{type:"image"}),s.push({abortController:L,requestParameters:D,supportImageRefresh:B,state:"queued",onError:K=>{W(K)},onSuccess:K=>{F(K)}}),M()});const b=D=>l._(this,void 0,void 0,function*(){D.state="running";const{requestParameters:L,supportImageRefresh:B,onError:F,onSuccess:W,abortController:K}=D,Q=B===!1&&!l.i(self)&&!l.g(L.url)&&(!L.headers||Object.keys(L.headers).reduce((ce,he)=>ce&&he==="accept",!0));d++;const re=Q?P(L,K):l.m(L,K);try{const ce=yield re;delete D.abortController,D.state="completed",ce.data instanceof HTMLImageElement||l.b(ce.data)?W(ce):ce.data&&W({data:yield(le=ce.data,typeof createImageBitmap=="function"?l.d(le):l.f(le)),cacheControl:ce.cacheControl,expires:ce.expires})}catch(ce){delete D.abortController,F(ce)}finally{d--,M()}var le}),M=()=>{const D=(()=>{for(const L of Object.keys(m))if(m[L]())return!0;return!1})()?l.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:l.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let L=d;L<D&&s.length>0;L++){const B=s.shift();B.abortController.signal.aborted?L--:b(B)}},P=(D,L)=>new Promise((B,F)=>{const W=new Image,K=D.url,Q=D.credentials;Q&&Q==="include"?W.crossOrigin="use-credentials":(Q&&Q==="same-origin"||!l.s(K))&&(W.crossOrigin="anonymous"),L.signal.addEventListener("abort",()=>{W.src="",F(l.c())}),W.fetchPriority="high",W.onload=()=>{W.onerror=W.onload=null,B({data:W})},W.onerror=()=>{W.onerror=W.onload=null,L.signal.aborted||F(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."))},W.src=K})}(oe||(oe={})),oe.resetRequestQueue();class J{constructor(s){this._transformRequestFn=s}transformRequest(s,d){return this._transformRequestFn&&this._transformRequestFn(s,d)||{url:s}}setTransformRequest(s){this._transformRequestFn=s}}function Ae(x){var s=new l.A(3);return s[0]=x[0],s[1]=x[1],s[2]=x[2],s}var ke,Me=function(x,s,d){return x[0]=s[0]-d[0],x[1]=s[1]-d[1],x[2]=s[2]-d[2],x};ke=new l.A(3),l.A!=Float32Array&&(ke[0]=0,ke[1]=0,ke[2]=0);var Le=function(x){var s=x[0],d=x[1];return s*s+d*d};function Ie(x){const s=[];if(typeof x=="string")s.push({id:"default",url:x});else if(x&&x.length>0){const d=[];for(const{id:f,url:m}of x){const b=`${f}${m}`;d.indexOf(b)===-1&&(d.push(b),s.push({id:f,url:m}))}}return s}function Ye(x,s,d){const f=x.split("?");return f[0]+=`${s}${d}`,f.join("?")}(function(){var x=new l.A(2);l.A!=Float32Array&&(x[0]=0,x[1]=0)})();class it{constructor(s,d,f,m){this.context=s,this.format=f,this.texture=s.gl.createTexture(),this.update(d,m)}update(s,d,f){const{width:m,height:b}=s,M=!(this.size&&this.size[0]===m&&this.size[1]===b||f),{context:P}=this,{gl:D}=P;if(this.useMipmap=!!(d&&d.useMipmap),D.bindTexture(D.TEXTURE_2D,this.texture),P.pixelStoreUnpackFlipY.set(!1),P.pixelStoreUnpack.set(1),P.pixelStoreUnpackPremultiplyAlpha.set(this.format===D.RGBA&&(!d||d.premultiply!==!1)),M)this.size=[m,b],s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?D.texImage2D(D.TEXTURE_2D,0,this.format,this.format,D.UNSIGNED_BYTE,s):D.texImage2D(D.TEXTURE_2D,0,this.format,m,b,0,this.format,D.UNSIGNED_BYTE,s.data);else{const{x:L,y:B}=f||{x:0,y:0};s instanceof HTMLImageElement||s instanceof HTMLCanvasElement||s instanceof HTMLVideoElement||s instanceof ImageData||l.b(s)?D.texSubImage2D(D.TEXTURE_2D,0,L,B,D.RGBA,D.UNSIGNED_BYTE,s):D.texSubImage2D(D.TEXTURE_2D,0,L,B,m,b,D.RGBA,D.UNSIGNED_BYTE,s.data)}this.useMipmap&&this.isSizePowerOfTwo()&&D.generateMipmap(D.TEXTURE_2D)}bind(s,d,f){const{context:m}=this,{gl:b}=m;b.bindTexture(b.TEXTURE_2D,this.texture),f!==b.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(f=b.LINEAR),s!==this.filter&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,s),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,f||s),this.filter=s),d!==this.wrap&&(b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,d),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,d),this.wrap=d)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:s}=this.context;s.deleteTexture(this.texture),this.texture=null}}function Nt(x){const{userImage:s}=x;return!!(s&&s.render&&s.render())&&(x.data.replace(new Uint8Array(s.data.buffer)),!0)}class ht extends l.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new l.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(s){if(this.loaded!==s&&(this.loaded=s,s)){for(const{ids:d,promiseResolve:f}of this.requestors)f(this._getImagesForIds(d));this.requestors=[]}}getImage(s){const d=this.images[s];if(d&&!d.data&&d.spriteData){const f=d.spriteData;d.data=new l.R({width:f.width,height:f.height},f.context.getImageData(f.x,f.y,f.width,f.height).data),d.spriteData=null}return d}addImage(s,d){if(this.images[s])throw new Error(`Image id ${s} already exist, use updateImage instead`);this._validate(s,d)&&(this.images[s]=d)}_validate(s,d){let f=!0;const m=d.data||d.spriteData;return this._validateStretch(d.stretchX,m&&m.width)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchX" value`))),f=!1),this._validateStretch(d.stretchY,m&&m.height)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "stretchY" value`))),f=!1),this._validateContent(d.content,d)||(this.fire(new l.j(new Error(`Image "${s}" has invalid "content" value`))),f=!1),f}_validateStretch(s,d){if(!s)return!0;let f=0;for(const m of s){if(m[0]<f||m[1]<m[0]||d<m[1])return!1;f=m[1]}return!0}_validateContent(s,d){if(!s)return!0;if(s.length!==4)return!1;const f=d.spriteData,m=f&&f.width||d.data.width,b=f&&f.height||d.data.height;return!(s[0]<0||m<s[0]||s[1]<0||b<s[1]||s[2]<0||m<s[2]||s[3]<0||b<s[3]||s[2]<s[0]||s[3]<s[1])}updateImage(s,d,f=!0){const m=this.getImage(s);if(f&&(m.data.width!==d.data.width||m.data.height!==d.data.height))throw new Error(`size mismatch between old image (${m.data.width}x${m.data.height}) and new image (${d.data.width}x${d.data.height}).`);d.version=m.version+1,this.images[s]=d,this.updatedImages[s]=!0}removeImage(s){const d=this.images[s];delete this.images[s],delete this.patterns[s],d.userImage&&d.userImage.onRemove&&d.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(s){return new Promise((d,f)=>{let m=!0;if(!this.isLoaded())for(const b of s)this.images[b]||(m=!1);this.isLoaded()||m?d(this._getImagesForIds(s)):this.requestors.push({ids:s,promiseResolve:d})})}_getImagesForIds(s){const d={};for(const f of s){let m=this.getImage(f);m||(this.fire(new l.k("styleimagemissing",{id:f})),m=this.getImage(f)),m?d[f]={data:m.data.clone(),pixelRatio:m.pixelRatio,sdf:m.sdf,version:m.version,stretchX:m.stretchX,stretchY:m.stretchY,content:m.content,textFitWidth:m.textFitWidth,textFitHeight:m.textFitHeight,hasRenderCallback:!!(m.userImage&&m.userImage.render)}:l.w(`Image "${f}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return d}getPixelSize(){const{width:s,height:d}=this.atlasImage;return{width:s,height:d}}getPattern(s){const d=this.patterns[s],f=this.getImage(s);if(!f)return null;if(d&&d.position.version===f.version)return d.position;if(d)d.position.version=f.version;else{const m={w:f.data.width+2,h:f.data.height+2,x:0,y:0},b=new l.I(m,f);this.patterns[s]={bin:m,position:b}}return this._updatePatternAtlas(),this.patterns[s].position}bind(s){const d=s.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new it(s,this.atlasImage,d.RGBA),this.atlasTexture.bind(d.LINEAR,d.CLAMP_TO_EDGE)}_updatePatternAtlas(){const s=[];for(const b in this.patterns)s.push(this.patterns[b].bin);const{w:d,h:f}=l.p(s),m=this.atlasImage;m.resize({width:d||1,height:f||1});for(const b in this.patterns){const{bin:M}=this.patterns[b],P=M.x+1,D=M.y+1,L=this.getImage(b).data,B=L.width,F=L.height;l.R.copy(L,m,{x:0,y:0},{x:P,y:D},{width:B,height:F}),l.R.copy(L,m,{x:0,y:F-1},{x:P,y:D-1},{width:B,height:1}),l.R.copy(L,m,{x:0,y:0},{x:P,y:D+F},{width:B,height:1}),l.R.copy(L,m,{x:B-1,y:0},{x:P-1,y:D},{width:1,height:F}),l.R.copy(L,m,{x:0,y:0},{x:P+B,y:D},{width:1,height:F})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(s){for(const d of s){if(this.callbackDispatchedThisFrame[d])continue;this.callbackDispatchedThisFrame[d]=!0;const f=this.getImage(d);f||l.w(`Image with ID: "${d}" was not found`),Nt(f)&&this.updateImage(d,f)}}}const Rt=1e20;function Xt(x,s,d,f,m,b,M,P,D){for(let L=s;L<s+f;L++)nn(x,d*b+L,b,m,M,P,D);for(let L=d;L<d+m;L++)nn(x,L*b+s,1,f,M,P,D)}function nn(x,s,d,f,m,b,M){b[0]=0,M[0]=-Rt,M[1]=Rt,m[0]=x[s];for(let P=1,D=0,L=0;P<f;P++){m[P]=x[s+P*d];const B=P*P;do{const F=b[D];L=(m[P]-m[F]+B-F*F)/(P-F)/2}while(L<=M[D]&&--D>-1);D++,b[D]=P,M[D]=L,M[D+1]=Rt}for(let P=0,D=0;P<f;P++){for(;M[D+1]<P;)D++;const L=b[D],B=P-L;x[s+P*d]=m[L]+B*B}}class jt{constructor(s,d){this.requestManager=s,this.localIdeographFontFamily=d,this.entries={}}setURL(s){this.url=s}getGlyphs(s){return l._(this,void 0,void 0,function*(){const d=[];for(const b in s)for(const M of s[b])d.push(this._getAndCacheGlyphsPromise(b,M));const f=yield Promise.all(d),m={};for(const{stack:b,id:M,glyph:P}of f)m[b]||(m[b]={}),m[b][M]=P&&{id:P.id,bitmap:P.bitmap.clone(),metrics:P.metrics};return m})}_getAndCacheGlyphsPromise(s,d){return l._(this,void 0,void 0,function*(){let f=this.entries[s];f||(f=this.entries[s]={glyphs:{},requests:{},ranges:{}});let m=f.glyphs[d];if(m!==void 0)return{stack:s,id:d,glyph:m};if(m=this._tinySDF(f,s,d),m)return f.glyphs[d]=m,{stack:s,id:d,glyph:m};const b=Math.floor(d/256);if(256*b>65535)throw new Error("glyphs > 65535 not supported");if(f.ranges[b])return{stack:s,id:d,glyph:m};if(!this.url)throw new Error("glyphsUrl is not set");if(!f.requests[b]){const P=jt.loadGlyphRange(s,b,this.url,this.requestManager);f.requests[b]=P}const M=yield f.requests[b];for(const P in M)this._doesCharSupportLocalGlyph(+P)||(f.glyphs[+P]=M[+P]);return f.ranges[b]=!0,{stack:s,id:d,glyph:M[d]||null}})}_doesCharSupportLocalGlyph(s){return!!this.localIdeographFontFamily&&new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(s))}_tinySDF(s,d,f){const m=this.localIdeographFontFamily;if(!m||!this._doesCharSupportLocalGlyph(f))return;let b=s.tinySDF;if(!b){let P="400";/bold/i.test(d)?P="900":/medium/i.test(d)?P="500":/light/i.test(d)&&(P="200"),b=s.tinySDF=new jt.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:m,fontWeight:P})}const M=b.draw(String.fromCharCode(f));return{id:f,bitmap:new l.o({width:M.width||60,height:M.height||60},M.data),metrics:{width:M.glyphWidth/2||24,height:M.glyphHeight/2||24,left:M.glyphLeft/2+.5||0,top:M.glyphTop/2-27.5||-8,advance:M.glyphAdvance/2||24,isDoubleResolution:!0}}}}jt.loadGlyphRange=function(x,s,d,f){return l._(this,void 0,void 0,function*(){const m=256*s,b=m+255,M=f.transformRequest(d.replace("{fontstack}",x).replace("{range}",`${m}-${b}`),"Glyphs"),P=yield l.l(M,new AbortController);if(!P||!P.data)throw new Error(`Could not load glyph range. range: ${s}, ${m}-${b}`);const D={};for(const L of l.n(P.data))D[L.id]=L;return D})},jt.TinySDF=class{constructor({fontSize:x=24,buffer:s=3,radius:d=8,cutoff:f=.25,fontFamily:m="sans-serif",fontWeight:b="normal",fontStyle:M="normal"}={}){this.buffer=s,this.cutoff=f,this.radius=d;const P=this.size=x+4*s,D=this._createCanvas(P),L=this.ctx=D.getContext("2d",{willReadFrequently:!0});L.font=`${M} ${b} ${x}px ${m}`,L.textBaseline="alphabetic",L.textAlign="left",L.fillStyle="black",this.gridOuter=new Float64Array(P*P),this.gridInner=new Float64Array(P*P),this.f=new Float64Array(P),this.z=new Float64Array(P+1),this.v=new Uint16Array(P)}_createCanvas(x){const s=document.createElement("canvas");return s.width=s.height=x,s}draw(x){const{width:s,actualBoundingBoxAscent:d,actualBoundingBoxDescent:f,actualBoundingBoxLeft:m,actualBoundingBoxRight:b}=this.ctx.measureText(x),M=Math.ceil(d),P=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(b-m))),D=Math.min(this.size-this.buffer,M+Math.ceil(f)),L=P+2*this.buffer,B=D+2*this.buffer,F=Math.max(L*B,0),W=new Uint8ClampedArray(F),K={data:W,width:L,height:B,glyphWidth:P,glyphHeight:D,glyphTop:M,glyphLeft:0,glyphAdvance:s};if(P===0||D===0)return K;const{ctx:Q,buffer:re,gridInner:le,gridOuter:ce}=this;Q.clearRect(re,re,P,D),Q.fillText(x,re,re+M);const he=Q.getImageData(re,re,P,D);ce.fill(Rt,0,F),le.fill(0,0,F);for(let te=0;te<D;te++)for(let me=0;me<P;me++){const ge=he.data[4*(te*P+me)+3]/255;if(ge===0)continue;const xe=(te+re)*L+me+re;if(ge===1)ce[xe]=0,le[xe]=Rt;else{const Oe=.5-ge;ce[xe]=Oe>0?Oe*Oe:0,le[xe]=Oe<0?Oe*Oe:0}}Xt(ce,0,0,L,B,L,this.f,this.v,this.z),Xt(le,re,re,P,D,L,this.f,this.v,this.z);for(let te=0;te<F;te++){const me=Math.sqrt(ce[te])-Math.sqrt(le[te]);W[te]=Math.round(255-255*(me/this.radius+this.cutoff))}return K}};class Mt{constructor(){this.specification=l.v.light.position}possiblyEvaluate(s,d){return l.x(s.expression.evaluate(d))}interpolate(s,d,f){return{x:l.y.number(s.x,d.x,f),y:l.y.number(s.y,d.y,f),z:l.y.number(s.z,d.z,f)}}}let Sn;class hn extends l.E{constructor(s){super(),Sn=Sn||new l.q({anchor:new l.D(l.v.light.anchor),position:new Mt,color:new l.D(l.v.light.color),intensity:new l.D(l.v.light.intensity)}),this._transitionable=new l.T(Sn),this.setLight(s),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(s,d={}){if(!this._validate(l.r,s,d))for(const f in s){const m=s[f];f.endsWith("-transition")?this._transitionable.setTransition(f.slice(0,-11),m):this._transitionable.setValue(f,m)}}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,d,f){return(!f||f.validate!==!1)&&l.t(this,s.call(l.u,{value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v}))}}const In=new l.q({"sky-color":new l.D(l.v.sky["sky-color"]),"horizon-color":new l.D(l.v.sky["horizon-color"]),"fog-color":new l.D(l.v.sky["fog-color"]),"fog-ground-blend":new l.D(l.v.sky["fog-ground-blend"]),"horizon-fog-blend":new l.D(l.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new l.D(l.v.sky["sky-horizon-blend"]),"atmosphere-blend":new l.D(l.v.sky["atmosphere-blend"])});class bn extends l.E{constructor(s){super(),this._transitionable=new l.T(In),this.setSky(s),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new l.z(0))}setSky(s,d={}){if(!this._validate(l.B,s,d)){s||(s={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const f in s){const m=s[f];f.endsWith("-transition")?this._transitionable.setTransition(f.slice(0,-11),m):this._transitionable.setValue(f,m)}}}getSky(){return this._transitionable.serialize()}updateTransitions(s){this._transitioning=this._transitionable.transitioned(s,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(s){this.properties=this._transitioning.possiblyEvaluate(s)}_validate(s,d,f={}){return(f==null?void 0:f.validate)!==!1&&l.t(this,s.call(l.u,l.e({value:d,style:{glyphs:!0,sprite:!0},styleSpec:l.v})))}calculateFogBlendOpacity(s){return s<60?0:s<70?(s-60)/10:1}}class pi{constructor(s,d){this.width=s,this.height=d,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(s,d){const f=s.join(",")+String(d);return this.dashEntry[f]||(this.dashEntry[f]=this.addDash(s,d)),this.dashEntry[f]}getDashRanges(s,d,f){const m=[];let b=s.length%2==1?-s[s.length-1]*f:0,M=s[0]*f,P=!0;m.push({left:b,right:M,isDash:P,zeroLength:s[0]===0});let D=s[0];for(let L=1;L<s.length;L++){P=!P;const B=s[L];b=D*f,D+=B,M=D*f,m.push({left:b,right:M,isDash:P,zeroLength:B===0})}return m}addRoundDash(s,d,f){const m=d/2;for(let b=-f;b<=f;b++){const M=this.width*(this.nextRow+f+b);let P=0,D=s[P];for(let L=0;L<this.width;L++){L/D.right>1&&(D=s[++P]);const B=Math.abs(L-D.left),F=Math.abs(L-D.right),W=Math.min(B,F);let K;const Q=b/f*(m+1);if(D.isDash){const re=m-Math.abs(Q);K=Math.sqrt(W*W+re*re)}else K=m-Math.sqrt(W*W+Q*Q);this.data[M+L]=Math.max(0,Math.min(255,K+128))}}}addRegularDash(s){for(let P=s.length-1;P>=0;--P){const D=s[P],L=s[P+1];D.zeroLength?s.splice(P,1):L&&L.isDash===D.isDash&&(L.left=D.left,s.splice(P,1))}const d=s[0],f=s[s.length-1];d.isDash===f.isDash&&(d.left=f.left-this.width,f.right=d.right+this.width);const m=this.width*this.nextRow;let b=0,M=s[b];for(let P=0;P<this.width;P++){P/M.right>1&&(M=s[++b]);const D=Math.abs(P-M.left),L=Math.abs(P-M.right),B=Math.min(D,L);this.data[m+P]=Math.max(0,Math.min(255,(M.isDash?B:-B)+128))}}addDash(s,d){const f=d?7:0,m=2*f+1;if(this.nextRow+m>this.height)return l.w("LineAtlas out of space"),null;let b=0;for(let P=0;P<s.length;P++)b+=s[P];if(b!==0){const P=this.width/b,D=this.getDashRanges(s,this.width,P);d?this.addRoundDash(D,P,f):this.addRegularDash(D)}const M={y:(this.nextRow+f+.5)/this.height,height:2*f/this.height,width:b};return this.nextRow+=m,this.dirty=!0,M}bind(s){const d=s.gl;this.texture?(d.bindTexture(d.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,d.texSubImage2D(d.TEXTURE_2D,0,0,0,this.width,this.height,d.ALPHA,d.UNSIGNED_BYTE,this.data))):(this.texture=d.createTexture(),d.bindTexture(d.TEXTURE_2D,this.texture),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,d.REPEAT),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,d.LINEAR),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,d.LINEAR),d.texImage2D(d.TEXTURE_2D,0,d.ALPHA,this.width,this.height,0,d.ALPHA,d.UNSIGNED_BYTE,this.data))}}const Wn="maplibre_preloaded_worker_pool";class jn{constructor(){this.active={}}acquire(s){if(!this.workers)for(this.workers=[];this.workers.length<jn.workerCount;)this.workers.push(new Worker(l.a.WORKER_URL));return this.active[s]=!0,this.workers.slice()}release(s){delete this.active[s],this.numActive()===0&&(this.workers.forEach(d=>{d.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Wn]}numActive(){return Object.keys(this.active).length}}const Gn=Math.floor(E.hardwareConcurrency/2);let Ce,je;function Xe(){return Ce||(Ce=new jn),Ce}jn.workerCount=l.C(globalThis)?Math.max(Math.min(Gn,3),1):1;class lt{constructor(s,d){this.workerPool=s,this.actors=[],this.currentActor=0,this.id=d;const f=this.workerPool.acquire(d);for(let m=0;m<f.length;m++){const b=new l.F(f[m],d);b.name=`Worker ${m}`,this.actors.push(b)}if(!this.actors.length)throw new Error("No actors found")}broadcast(s,d){const f=[];for(const m of this.actors)f.push(m.sendAsync({type:s,data:d}));return Promise.all(f)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(s=!0){this.actors.forEach(d=>{d.remove()}),this.actors=[],s&&this.workerPool.release(this.id)}registerMessageHandler(s,d){for(const f of this.actors)f.registerMessageHandler(s,d)}}function Bt(){return je||(je=new lt(Xe(),l.G),je.registerMessageHandler("GR",(x,s,d)=>l.m(s,d))),je}function rn(x,s){const d=l.H();return l.J(d,d,[1,1,0]),l.K(d,d,[.5*x.width,.5*x.height,1]),l.L(d,d,x.calculatePosMatrix(s.toUnwrapped()))}function Dt(x,s,d,f,m,b){const M=function(F,W,K){if(F)for(const Q of F){const re=W[Q];if(re&&re.source===K&&re.type==="fill-extrusion")return!0}else for(const Q in W){const re=W[Q];if(re.source===K&&re.type==="fill-extrusion")return!0}return!1}(m&&m.layers,s,x.id),P=b.maxPitchScaleFactor(),D=x.tilesIn(f,P,M);D.sort(At);const L=[];for(const F of D)L.push({wrappedTileID:F.tileID.wrapped().key,queryResults:F.tile.queryRenderedFeatures(s,d,x._state,F.queryGeometry,F.cameraQueryGeometry,F.scale,m,b,P,rn(x.transform,F.tileID))});const B=function(F){const W={},K={};for(const Q of F){const re=Q.queryResults,le=Q.wrappedTileID,ce=K[le]=K[le]||{};for(const he in re){const te=re[he],me=ce[he]=ce[he]||{},ge=W[he]=W[he]||[];for(const xe of te)me[xe.featureIndex]||(me[xe.featureIndex]=!0,ge.push(xe))}}return W}(L);for(const F in B)B[F].forEach(W=>{const K=W.feature,Q=x.getFeatureState(K.layer["source-layer"],K.id);K.source=K.layer.source,K.layer["source-layer"]&&(K.sourceLayer=K.layer["source-layer"]),K.state=Q});return B}function At(x,s){const d=x.tileID,f=s.tileID;return d.overscaledZ-f.overscaledZ||d.canonical.y-f.canonical.y||d.wrap-f.wrap||d.canonical.x-f.canonical.x}function ln(x,s,d){return l._(this,void 0,void 0,function*(){let f=x;if(x.url?f=(yield l.h(s.transformRequest(x.url,"Source"),d)).data:yield E.frameAsync(d),!f)return null;const m=l.M(l.e(f,x),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in f&&f.vector_layers&&(m.vectorLayerIds=f.vector_layers.map(b=>b.id)),m})}class we{constructor(s,d){s&&(d?this.setSouthWest(s).setNorthEast(d):Array.isArray(s)&&(s.length===4?this.setSouthWest([s[0],s[1]]).setNorthEast([s[2],s[3]]):this.setSouthWest(s[0]).setNorthEast(s[1])))}setNorthEast(s){return this._ne=s instanceof l.N?new l.N(s.lng,s.lat):l.N.convert(s),this}setSouthWest(s){return this._sw=s instanceof l.N?new l.N(s.lng,s.lat):l.N.convert(s),this}extend(s){const d=this._sw,f=this._ne;let m,b;if(s instanceof l.N)m=s,b=s;else{if(!(s instanceof we))return Array.isArray(s)?s.length===4||s.every(Array.isArray)?this.extend(we.convert(s)):this.extend(l.N.convert(s)):s&&("lng"in s||"lon"in s)&&"lat"in s?this.extend(l.N.convert(s)):this;if(m=s._sw,b=s._ne,!m||!b)return this}return d||f?(d.lng=Math.min(m.lng,d.lng),d.lat=Math.min(m.lat,d.lat),f.lng=Math.max(b.lng,f.lng),f.lat=Math.max(b.lat,f.lat)):(this._sw=new l.N(m.lng,m.lat),this._ne=new l.N(b.lng,b.lat)),this}getCenter(){return new l.N((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 l.N(this.getWest(),this.getNorth())}getSouthEast(){return new l.N(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(s){const{lng:d,lat:f}=l.N.convert(s);let m=this._sw.lng<=d&&d<=this._ne.lng;return this._sw.lng>this._ne.lng&&(m=this._sw.lng>=d&&d>=this._ne.lng),this._sw.lat<=f&&f<=this._ne.lat&&m}static convert(s){return s instanceof we?s:s&&new we(s)}static fromLngLat(s,d=0){const f=360*d/40075017,m=f/Math.cos(Math.PI/180*s.lat);return new we(new l.N(s.lng-m,s.lat-f),new l.N(s.lng+m,s.lat+f))}adjustAntiMeridian(){const s=new l.N(this._sw.lng,this._sw.lat),d=new l.N(this._ne.lng,this._ne.lat);return new we(s,s.lng>d.lng?new l.N(d.lng+360,d.lat):d)}}class En{constructor(s,d,f){this.bounds=we.convert(this.validateBounds(s)),this.minzoom=d||0,this.maxzoom=f||24}validateBounds(s){return Array.isArray(s)&&s.length===4?[Math.max(-180,s[0]),Math.max(-90,s[1]),Math.min(180,s[2]),Math.min(90,s[3])]:[-180,-90,180,90]}contains(s){const d=Math.pow(2,s.z),f=Math.floor(l.O(this.bounds.getWest())*d),m=Math.floor(l.Q(this.bounds.getNorth())*d),b=Math.ceil(l.O(this.bounds.getEast())*d),M=Math.ceil(l.Q(this.bounds.getSouth())*d);return s.x>=f&&s.x<b&&s.y>=m&&s.y<M}}class Ss extends l.E{constructor(s,d,f,m){if(super(),this.id=s,this.dispatcher=f,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,l.e(this,l.M(d,["url","scheme","tileSize","promoteId"])),this._options=l.e({type:"vector"},d),this._collectResourceTiming=d.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(m)}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ln(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),s&&(l.e(this,s),s.bounds&&(this.tileBounds=new En(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.j(s))}})}loaded(){return this._loaded}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}onAdd(s){this.map=s,this.load()}setSourceProperty(s){this._tileJSONRequest&&this._tileJSONRequest.abort(),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return l.e({},this._options)}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f={request:this.map._requestManager.transformRequest(d,"Tile"),uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,tileSize:this.tileSize*s.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};f.request.collectResourceTiming=this._collectResourceTiming;let m="RT";if(s.actor&&s.state!=="expired"){if(s.state==="loading")return new Promise((b,M)=>{s.reloadPromise={resolve:b,reject:M}})}else s.actor=this.dispatcher.getActor(),m="LT";s.abortController=new AbortController;try{const b=yield s.actor.sendAsync({type:m,data:f},s.abortController);if(delete s.abortController,s.aborted)return;this._afterTileLoadWorkerResponse(s,b)}catch(b){if(delete s.abortController,s.aborted)return;if(b&&b.status!==404)throw b;this._afterTileLoadWorkerResponse(s,null)}})}_afterTileLoadWorkerResponse(s,d){if(d&&d.resourceTiming&&(s.resourceTiming=d.resourceTiming),d&&this.map._refreshExpiredTiles&&s.setExpiryData(d),s.loadVectorData(d,this.map.painter),s.reloadPromise){const f=s.reloadPromise;s.reloadPromise=null,this.loadTile(s).then(f.resolve).catch(f.reject)}}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.actor&&(yield s.actor.sendAsync({type:"AT",data:{uid:s.uid,type:this.type,source:this.id}}))})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),s.actor&&(yield s.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Kt extends l.E{constructor(s,d,f,m){super(),this.id=s,this.dispatcher=f,this.setEventedParent(m),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=l.e({type:"raster"},d),l.e(this,l.M(d,["url","scheme","tileSize"]))}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const s=yield ln(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,s&&(l.e(this,s),s.bounds&&(this.tileBounds=new En(s.bounds,this.minzoom,this.maxzoom)),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})))}catch(s){this._tileJSONRequest=null,this.fire(new l.j(s))}})}loaded(){return this._loaded}onAdd(s){this.map=s,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(s){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),s(),this.load()}setTiles(s){return this.setSourceProperty(()=>{this._options.tiles=s}),this}setUrl(s){return this.setSourceProperty(()=>{this.url=s,this._options.url=s}),this}serialize(){return l.e({},this._options)}hasTile(s){return!this.tileBounds||this.tileBounds.contains(s.canonical)}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);s.abortController=new AbortController;try{const f=yield oe.getImage(this.map._requestManager.transformRequest(d,"Tile"),s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(f&&f.data){this.map._refreshExpiredTiles&&f.cacheControl&&f.expires&&s.setExpiryData({cacheControl:f.cacheControl,expires:f.expires});const m=this.map.painter.context,b=m.gl,M=f.data;s.texture=this.map.painter.getTileTexture(M.width),s.texture?s.texture.update(M,{useMipmap:!0}):(s.texture=new it(m,M,b.RGBA,{useMipmap:!0}),s.texture.bind(b.LINEAR,b.CLAMP_TO_EDGE,b.LINEAR_MIPMAP_NEAREST)),s.state="loaded"}}catch(f){if(delete s.abortController,s.aborted)s.state="unloaded";else if(f)throw s.state="errored",f}})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController)})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.texture&&this.map.painter.saveTileTexture(s.texture)})}hasTransition(){return!1}}class dn extends Kt{constructor(s,d,f,m){super(s,d,f,m),this.type="raster-dem",this.maxzoom=22,this._options=l.e({type:"raster-dem"},d),this.encoding=d.encoding||"mapbox",this.redFactor=d.redFactor,this.greenFactor=d.greenFactor,this.blueFactor=d.blueFactor,this.baseShift=d.baseShift}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),f=this.map._requestManager.transformRequest(d,"Tile");s.neighboringTiles=this._getNeighboringTiles(s.tileID),s.abortController=new AbortController;try{const m=yield oe.getImage(f,s.abortController,this.map._refreshExpiredTiles);if(delete s.abortController,s.aborted)return void(s.state="unloaded");if(m&&m.data){const b=m.data;this.map._refreshExpiredTiles&&m.cacheControl&&m.expires&&s.setExpiryData({cacheControl:m.cacheControl,expires:m.expires});const M=l.b(b)&&l.U()?b:yield this.readImageNow(b),P={type:this.type,uid:s.uid,source:this.id,rawImageData:M,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!s.actor||s.state==="expired"){s.actor=this.dispatcher.getActor();const D=yield s.actor.sendAsync({type:"LDT",data:P});s.dem=D,s.needsHillshadePrepare=!0,s.needsTerrainPrepare=!0,s.state="loaded"}}}catch(m){if(delete s.abortController,s.aborted)s.state="unloaded";else if(m)throw s.state="errored",m}})}readImageNow(s){return l._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&l.V()){const d=s.width+2,f=s.height+2;try{return new l.R({width:d,height:f},yield l.W(s,-1,-1,d,f))}catch{}}return E.getImageData(s,1)})}_getNeighboringTiles(s){const d=s.canonical,f=Math.pow(2,d.z),m=(d.x-1+f)%f,b=d.x===0?s.wrap-1:s.wrap,M=(d.x+1+f)%f,P=d.x+1===f?s.wrap+1:s.wrap,D={};return D[new l.S(s.overscaledZ,b,d.z,m,d.y).key]={backfilled:!1},D[new l.S(s.overscaledZ,P,d.z,M,d.y).key]={backfilled:!1},d.y>0&&(D[new l.S(s.overscaledZ,b,d.z,m,d.y-1).key]={backfilled:!1},D[new l.S(s.overscaledZ,s.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},D[new l.S(s.overscaledZ,P,d.z,M,d.y-1).key]={backfilled:!1}),d.y+1<f&&(D[new l.S(s.overscaledZ,b,d.z,m,d.y+1).key]={backfilled:!1},D[new l.S(s.overscaledZ,s.wrap,d.z,d.x,d.y+1).key]={backfilled:!1},D[new l.S(s.overscaledZ,P,d.z,M,d.y+1).key]={backfilled:!1}),D}unloadTile(s){return l._(this,void 0,void 0,function*(){s.demTexture&&this.map.painter.saveTileTexture(s.demTexture),s.fbo&&(s.fbo.destroy(),delete s.fbo),s.dem&&delete s.dem,delete s.neighboringTiles,s.state="unloaded",s.actor&&(yield s.actor.sendAsync({type:"RDT",data:{type:this.type,uid:s.uid,source:this.id}}))})}}class er extends l.E{constructor(s,d,f,m){super(),this.id=s,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=f.getActor(),this.setEventedParent(m),this._data=d.data,this._options=l.e({},d),this._collectResourceTiming=d.collectResourceTiming,d.maxzoom!==void 0&&(this.maxzoom=d.maxzoom),d.type&&(this.type=d.type),d.attribution&&(this.attribution=d.attribution),this.promoteId=d.promoteId;const b=l.X/this.tileSize;d.clusterMaxZoom!==void 0&&this.maxzoom<=d.clusterMaxZoom&&l.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${d.clusterMaxZoom}".`),this.workerOptions=l.e({source:this.id,cluster:d.cluster||!1,geojsonVtOptions:{buffer:(d.buffer!==void 0?d.buffer:128)*b,tolerance:(d.tolerance!==void 0?d.tolerance:.375)*b,extent:l.X,maxZoom:this.maxzoom,lineMetrics:d.lineMetrics||!1,generateId:d.generateId||!1},superclusterOptions:{maxZoom:d.clusterMaxZoom!==void 0?d.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,d.clusterMinPoints||2),extent:l.X,radius:(d.clusterRadius||50)*b,log:!1,generateId:d.generateId||!1},clusterProperties:d.clusterProperties,filter:d.filter},d.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}load(){return l._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(s){this.map=s,this.load()}setData(s){return this._data=s,this._updateWorkerData(),this}updateData(s){return this._updateWorkerData(s),this}getData(){return l._(this,void 0,void 0,function*(){const s=l.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:s})})}setClusterOptions(s){return this.workerOptions.cluster=s.cluster,s&&(s.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=s.clusterRadius),s.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=s.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(s){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:s,source:this.id}})}getClusterChildren(s){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:s,source:this.id}})}getClusterLeaves(s,d,f){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:s,limit:d,offset:f}})}_updateWorkerData(s){return l._(this,void 0,void 0,function*(){const d=l.e({type:this.type},this.workerOptions);s?d.dataDiff=s:typeof this._data=="string"?(d.request=this.map._requestManager.transformRequest(E.resolveURL(this._data),"Source"),d.request.collectResourceTiming=this._collectResourceTiming):d.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new l.k("dataloading",{dataType:"source"}));try{const f=yield this.actor.sendAsync({type:"LD",data:d});if(this._pendingLoads--,this._removed||f.abandoned)return void this.fire(new l.k("dataabort",{dataType:"source"}));let m=null;f.resourceTiming&&f.resourceTiming[this.id]&&(m=f.resourceTiming[this.id].slice(0));const b={dataType:"source"};this._collectResourceTiming&&m&&m.length>0&&l.e(b,{resourceTiming:m}),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"metadata"}))),this.fire(new l.k("data",Object.assign(Object.assign({},b),{sourceDataType:"content"})))}catch(f){if(this._pendingLoads--,this._removed)return void this.fire(new l.k("dataabort",{dataType:"source"}));this.fire(new l.j(f))}})}loaded(){return this._pendingLoads===0}loadTile(s){return l._(this,void 0,void 0,function*(){const d=s.actor?"RT":"LT";s.actor=this.actor;const f={type:this.type,uid:s.uid,tileID:s.tileID,zoom:s.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId};s.abortController=new AbortController;const m=yield this.actor.sendAsync({type:d,data:f},s.abortController);delete s.abortController,s.unloadVectorData(),s.aborted||s.loadVectorData(m,this.map.painter,d==="RT")})}abortTile(s){return l._(this,void 0,void 0,function*(){s.abortController&&(s.abortController.abort(),delete s.abortController),s.aborted=!0})}unloadTile(s){return l._(this,void 0,void 0,function*(){s.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:s.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return l.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}var tr=l.Y([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class bi extends l.E{constructor(s,d,f,m){super(),this.id=s,this.dispatcher=f,this.coordinates=d.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(m),this.options=d}load(s){return l._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new l.k("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const d=yield oe.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,d&&d.data&&(this.image=d.data,s&&(this.coordinates=s),this._finishLoading())}catch(d){this._request=null,this._loaded=!0,this.fire(new l.j(d))}})}loaded(){return this._loaded}updateImage(s){return s.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=s.url,this.load(s.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new l.k("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(s){this.map=s,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(s){this.coordinates=s;const d=s.map(l.Z.fromLngLat);this.tileID=function(m){let b=1/0,M=1/0,P=-1/0,D=-1/0;for(const W of m)b=Math.min(b,W.x),M=Math.min(M,W.y),P=Math.max(P,W.x),D=Math.max(D,W.y);const L=Math.max(P-b,D-M),B=Math.max(0,Math.floor(-Math.log(L)/Math.LN2)),F=Math.pow(2,B);return new l.a1(B,Math.floor((b+P)/2*F),Math.floor((M+D)/2*F))}(d),this.minzoom=this.maxzoom=this.tileID.z;const f=d.map(m=>this.tileID.getTilePoint(m)._round());return this._boundsArray=new l.$,this._boundsArray.emplaceBack(f[0].x,f[0].y,0,0),this._boundsArray.emplaceBack(f[1].x,f[1].y,l.X,0),this._boundsArray.emplaceBack(f[3].x,f[3].y,0,l.X),this._boundsArray.emplaceBack(f[2].x,f[2].y,l.X,l.X),this.boundsBuffer&&(this.boundsBuffer.destroy(),delete this.boundsBuffer),this.fire(new l.k("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const s=this.map.painter.context,d=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,tr.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture||(this.texture=new it(s,this.image,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let f=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,f=!0)}f&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(s){return l._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(s.tileID.canonical)?(this.tiles[String(s.tileID.wrap)]=s,s.buckets={}):s.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}}class Dr extends bi{constructor(s,d,f,m){super(s,d,f,m),this.roundZoom=!0,this.type="video",this.options=d}load(){return l._(this,void 0,void 0,function*(){this._loaded=!1;const s=this.options;this.urls=[];for(const d of s.urls)this.urls.push(this.map._requestManager.transformRequest(d,"Source").url);try{const d=yield l.a3(this.urls);if(this._loaded=!0,!d)return;this.video=d,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(d){this.fire(new l.j(d))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(s){if(this.video){const d=this.video.seekable;s<d.start(0)||s>d.end(0)?this.fire(new l.j(new l.a2(`sources.${this.id}`,null,`Playback for this video can be set only between the ${d.start(0)} and ${d.end(0)}-second mark.`))):this.video.currentTime=s}}getVideo(){return this.video}onAdd(s){this.map||(this.map=s,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const s=this.map.painter.context,d=s.gl;this.boundsBuffer||(this.boundsBuffer=s.createVertexBuffer(this._boundsArray,tr.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new it(s,this.video,d.RGBA),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE));let f=!1;for(const m in this.tiles){const b=this.tiles[m];b.state!=="loaded"&&(b.state="loaded",b.texture=this.texture,f=!0)}f&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class xi extends bi{constructor(s,d,f,m){super(s,d,f,m),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(b=>!Array.isArray(b)||b.length!==2||b.some(M=>typeof M!="number"))||this.fire(new l.j(new l.a2(`sources.${s}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new l.j(new l.a2(`sources.${s}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new l.j(new l.a2(`sources.${s}`,null,'optional "animate" property must be a boolean value'))),d.canvas?typeof d.canvas=="string"||d.canvas instanceof HTMLCanvasElement||this.fire(new l.j(new l.a2(`sources.${s}`,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 l.j(new l.a2(`sources.${s}`,null,'missing required property "canvas"'))),this.options=d,this.animate=d.animate===void 0||d.animate}load(){return l._(this,void 0,void 0,function*(){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 l.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())})}getCanvas(){return this.canvas}onAdd(s){this.map=s,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let s=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,s=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,s=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context,f=d.gl;this.boundsBuffer||(this.boundsBuffer=d.createVertexBuffer(this._boundsArray,tr.members)),this.boundsSegments||(this.boundsSegments=l.a0.simpleSegment(0,0,4,2)),this.texture?(s||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new it(d,this.canvas,f.RGBA,{premultiply:!0});let m=!1;for(const b in this.tiles){const M=this.tiles[b];M.state!=="loaded"&&(M.state="loaded",M.texture=this.texture,m=!0)}m&&this.fire(new l.k("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const s of[this.canvas.width,this.canvas.height])if(isNaN(s)||s<=0)return!0;return!1}}const Es={},Cs=x=>{switch(x){case"geojson":return er;case"image":return bi;case"raster":return Kt;case"raster-dem":return dn;case"vector":return Ss;case"video":return Dr;case"canvas":return xi}return Es[x]},Be="RTLPluginLoaded";class Or extends l.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Bt()}_syncState(s){return this.status=s,this.dispatcher.broadcast("SRPS",{pluginStatus:s,pluginURL:this.url}).catch(d=>{throw this.status="error",d})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(s){return l._(this,arguments,void 0,function*(d,f=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=E.resolveURL(d),!this.url)throw new Error(`requested url ${d} is invalid`);if(this.status==="unavailable"){if(!f)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return l._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new l.k(Be))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let vi=null;function zr(){return vi||(vi=new Or),vi}class Ts{constructor(s,d){this.timeAdded=0,this.fadeEndTime=0,this.tileID=s,this.uid=l.a4(),this.uses=0,this.tileSize=d,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(s){const d=s+this.timeAdded;d<this.fadeEndTime||(this.fadeEndTime=d)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(s){this.demTexture&&s.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(s,d,f){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",s){s.featureIndex&&(this.latestFeatureIndex=s.featureIndex,s.rawTileData?(this.latestRawTileData=s.rawTileData,this.latestFeatureIndex.rawTileData=s.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=s.collisionBoxArray,this.buckets=function(m,b){const M={};if(!b)return M;for(const P of m){const D=P.layerIds.map(L=>b.getLayer(L)).filter(Boolean);if(D.length!==0){P.layers=D,P.stateDependentLayerIds&&(P.stateDependentLayers=P.stateDependentLayerIds.map(L=>D.filter(B=>B.id===L)[0]));for(const L of D)M[L.id]=P}}return M}(s.buckets,d.style),this.hasSymbolBuckets=!1;for(const m in this.buckets){const b=this.buckets[m];if(b instanceof l.a6){if(this.hasSymbolBuckets=!0,!f)break;b.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const m in this.buckets){const b=this.buckets[m];if(b instanceof l.a6&&b.hasRTLText){this.hasRTLText=!0,zr().lazyLoad();break}}this.queryPadding=0;for(const m in this.buckets){const b=this.buckets[m];this.queryPadding=Math.max(this.queryPadding,d.style.getLayer(m).queryRadius(b))}s.imageAtlas&&(this.imageAtlas=s.imageAtlas),s.glyphAtlasImage&&(this.glyphAtlasImage=s.glyphAtlasImage)}else this.collisionBoxArray=new l.a5}unloadVectorData(){for(const s in this.buckets)this.buckets[s].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(s){return this.buckets[s.id]}upload(s){for(const f in this.buckets){const m=this.buckets[f];m.uploadPending()&&m.upload(s)}const d=s.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new it(s,this.imageAtlas.image,d.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new it(s,this.glyphAtlasImage,d.ALPHA),this.glyphAtlasImage=null)}prepare(s){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(s,this.imageAtlasTexture)}queryRenderedFeatures(s,d,f,m,b,M,P,D,L,B){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:m,cameraQueryGeometry:b,scale:M,tileSize:this.tileSize,pixelPosMatrix:B,transform:D,params:P,queryPadding:this.queryPadding*L},s,d,f):{}}querySourceFeatures(s,d){const f=this.latestFeatureIndex;if(!f||!f.rawTileData)return;const m=f.loadVTLayers(),b=d&&d.sourceLayer?d.sourceLayer:"",M=m._geojsonTileLayer||m[b];if(!M)return;const P=l.a7(d&&d.filter),{z:D,x:L,y:B}=this.tileID.canonical,F={z:D,x:L,y:B};for(let W=0;W<M.length;W++){const K=M.feature(W);if(P.needGeometry){const le=l.a8(K,!0);if(!P.filter(new l.z(this.tileID.overscaledZ),le,this.tileID.canonical))continue}else if(!P.filter(new l.z(this.tileID.overscaledZ),K))continue;const Q=f.getId(K,b),re=new l.a9(K,D,L,B,Q);re.tile=F,s.push(re)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(s){const d=this.expirationTime;if(s.cacheControl){const f=l.aa(s.cacheControl);f["max-age"]&&(this.expirationTime=Date.now()+1e3*f["max-age"])}else s.expires&&(this.expirationTime=new Date(s.expires).getTime());if(this.expirationTime){const f=Date.now();let m=!1;if(this.expirationTime>f)m=!1;else if(d)if(this.expirationTime<d)m=!0;else{const b=this.expirationTime-d;b?this.expirationTime=f+Math.max(b,3e4):m=!0}else m=!0;m?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(s,d){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(s).length===0)return;const f=this.latestFeatureIndex.loadVTLayers();for(const m in this.buckets){if(!d.style.hasLayer(m))continue;const b=this.buckets[m],M=b.layers[0].sourceLayer||"_geojsonTileLayer",P=f[M],D=s[M];if(!P||!D||Object.keys(D).length===0)continue;b.update(D,P,this.imageAtlas&&this.imageAtlas.patternPositions||{});const L=d&&d.style&&d.style.getLayer(m);L&&(this.queryPadding=Math.max(this.queryPadding,L.queryRadius(b)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<E.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(s){this.symbolFadeHoldUntil=E.now()+s}setDependencies(s,d){const f={};for(const m of d)f[m]=!0;this.dependencies[s]=f}hasDependency(s,d){for(const f of s){const m=this.dependencies[f];if(m){for(const b of d)if(m[b])return!0}}return!1}}class qe{constructor(s,d){this.max=s,this.onRemove=d,this.reset()}reset(){for(const s in this.data)for(const d of this.data[s])d.timeout&&clearTimeout(d.timeout),this.onRemove(d.value);return this.data={},this.order=[],this}add(s,d,f){const m=s.wrapped().key;this.data[m]===void 0&&(this.data[m]=[]);const b={value:d,timeout:void 0};if(f!==void 0&&(b.timeout=setTimeout(()=>{this.remove(s,b)},f)),this.data[m].push(b),this.order.push(m),this.order.length>this.max){const M=this._getAndRemoveByKey(this.order[0]);M&&this.onRemove(M)}return this}has(s){return s.wrapped().key in this.data}getAndRemove(s){return this.has(s)?this._getAndRemoveByKey(s.wrapped().key):null}_getAndRemoveByKey(s){const d=this.data[s].shift();return d.timeout&&clearTimeout(d.timeout),this.data[s].length===0&&delete this.data[s],this.order.splice(this.order.indexOf(s),1),d.value}getByKey(s){const d=this.data[s];return d?d[0].value:null}get(s){return this.has(s)?this.data[s.wrapped().key][0].value:null}remove(s,d){if(!this.has(s))return this;const f=s.wrapped().key,m=d===void 0?0:this.data[f].indexOf(d),b=this.data[f][m];return this.data[f].splice(m,1),b.timeout&&clearTimeout(b.timeout),this.data[f].length===0&&delete this.data[f],this.onRemove(b.value),this.order.splice(this.order.indexOf(f),1),this}setMaxSize(s){for(this.max=s;this.order.length>this.max;){const d=this._getAndRemoveByKey(this.order[0]);d&&this.onRemove(d)}return this}filter(s){const d=[];for(const f in this.data)for(const m of this.data[f])s(m.value)||d.push(m);for(const f of d)this.remove(f.value.tileID,f)}}class ve{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(s,d,f){const m=String(d);if(this.stateChanges[s]=this.stateChanges[s]||{},this.stateChanges[s][m]=this.stateChanges[s][m]||{},l.e(this.stateChanges[s][m],f),this.deletedStates[s]===null){this.deletedStates[s]={};for(const b in this.state[s])b!==m&&(this.deletedStates[s][b]=null)}else if(this.deletedStates[s]&&this.deletedStates[s][m]===null){this.deletedStates[s][m]={};for(const b in this.state[s][m])f[b]||(this.deletedStates[s][m][b]=null)}else for(const b in f)this.deletedStates[s]&&this.deletedStates[s][m]&&this.deletedStates[s][m][b]===null&&delete this.deletedStates[s][m][b]}removeFeatureState(s,d,f){if(this.deletedStates[s]===null)return;const m=String(d);if(this.deletedStates[s]=this.deletedStates[s]||{},f&&d!==void 0)this.deletedStates[s][m]!==null&&(this.deletedStates[s][m]=this.deletedStates[s][m]||{},this.deletedStates[s][m][f]=null);else if(d!==void 0)if(this.stateChanges[s]&&this.stateChanges[s][m])for(f in this.deletedStates[s][m]={},this.stateChanges[s][m])this.deletedStates[s][m][f]=null;else this.deletedStates[s][m]=null;else this.deletedStates[s]=null}getState(s,d){const f=String(d),m=l.e({},(this.state[s]||{})[f],(this.stateChanges[s]||{})[f]);if(this.deletedStates[s]===null)return{};if(this.deletedStates[s]){const b=this.deletedStates[s][d];if(b===null)return{};for(const M in b)delete m[M]}return m}initializeTileState(s,d){s.setFeatureState(this.state,d)}coalesceChanges(s,d){const f={};for(const m in this.stateChanges){this.state[m]=this.state[m]||{};const b={};for(const M in this.stateChanges[m])this.state[m][M]||(this.state[m][M]={}),l.e(this.state[m][M],this.stateChanges[m][M]),b[M]=this.state[m][M];f[m]=b}for(const m in this.deletedStates){this.state[m]=this.state[m]||{};const b={};if(this.deletedStates[m]===null)for(const M in this.state[m])b[M]={},this.state[m][M]={};else for(const M in this.deletedStates[m]){if(this.deletedStates[m][M]===null)this.state[m][M]={};else for(const P of Object.keys(this.deletedStates[m][M]))delete this.state[m][M][P];b[M]=this.state[m][M]}f[m]=f[m]||{},l.e(f[m],b)}if(this.stateChanges={},this.deletedStates={},Object.keys(f).length!==0)for(const m in s)s[m].setFeatureState(f,d)}}class Re extends l.E{constructor(s,d,f){super(),this.id=s,this.dispatcher=f,this.on("data",m=>this._dataHandler(m)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((m,b,M,P)=>{const D=new(Cs(b.type))(m,b,M,P);if(D.id!==m)throw new Error(`Expected Source id to be ${m} instead of ${D.id}`);return D})(s,d,f,this),this._tiles={},this._cache=new qe(0,m=>this._unloadTile(m)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new ve,this._didEmitContent=!1,this._updated=!1}onAdd(s){this.map=s,this._maxTileCacheSize=s?s._maxTileCacheSize:null,this._maxTileCacheZoomLevels=s?s._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(s)}onRemove(s){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(s)}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 s in this._tiles){const d=this._tiles[s];if(d.state!=="loaded"&&d.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const s=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,s&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(s,d,f){return l._(this,void 0,void 0,function*(){try{yield this._source.loadTile(s),this._tileLoaded(s,d,f)}catch(m){s.state="errored",m.status!==404?this._source.fire(new l.j(m,{tile:s})):this.update(this.transform,this.terrain)}})}_unloadTile(s){this._source.unloadTile&&this._source.unloadTile(s)}_abortTile(s){this._source.abortTile&&this._source.abortTile(s),this._source.fire(new l.k("dataabort",{tile:s,coord:s.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(s){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const d in this._tiles){const f=this._tiles[d];f.upload(s),f.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(s=>s.tileID).sort(xt).map(s=>s.key)}getRenderableIds(s){const d=[];for(const f in this._tiles)this._isIdRenderable(f,s)&&d.push(this._tiles[f]);return s?d.sort((f,m)=>{const b=f.tileID,M=m.tileID,P=new l.P(b.canonical.x,b.canonical.y)._rotate(this.transform.angle),D=new l.P(M.canonical.x,M.canonical.y)._rotate(this.transform.angle);return b.overscaledZ-M.overscaledZ||D.y-P.y||D.x-P.x}).map(f=>f.tileID.key):d.map(f=>f.tileID).sort(xt).map(f=>f.key)}hasRenderableParent(s){const d=this.findLoadedParent(s,0);return!!d&&this._isIdRenderable(d.tileID.key)}_isIdRenderable(s,d){return this._tiles[s]&&this._tiles[s].hasData()&&!this._coveredTiles[s]&&(d||!this._tiles[s].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const s in this._tiles)this._tiles[s].state!=="errored"&&this._reloadTile(s,"reloading")}}_reloadTile(s,d){return l._(this,void 0,void 0,function*(){const f=this._tiles[s];f&&(f.state!=="loading"&&(f.state=d),yield this._loadTile(f,s,d))})}_tileLoaded(s,d,f){s.timeAdded=E.now(),f==="expired"&&(s.refreshedUponExpiration=!0),this._setTileReloadTimer(d,s),this.getSource().type==="raster-dem"&&s.dem&&this._backfillDEM(s),this._state.initializeTileState(s,this.map?this.map.painter:null),s.aborted||this._source.fire(new l.k("data",{dataType:"source",tile:s,coord:s.tileID}))}_backfillDEM(s){const d=this.getRenderableIds();for(let m=0;m<d.length;m++){const b=d[m];if(s.neighboringTiles&&s.neighboringTiles[b]){const M=this.getTileByID(b);f(s,M),f(M,s)}}function f(m,b){m.needsHillshadePrepare=!0,m.needsTerrainPrepare=!0;let M=b.tileID.canonical.x-m.tileID.canonical.x;const P=b.tileID.canonical.y-m.tileID.canonical.y,D=Math.pow(2,m.tileID.canonical.z),L=b.tileID.key;M===0&&P===0||Math.abs(P)>1||(Math.abs(M)>1&&(Math.abs(M+D)===1?M+=D:Math.abs(M-D)===1&&(M-=D)),b.dem&&m.dem&&(m.dem.backfillBorder(b.dem,M,P),m.neighboringTiles&&m.neighboringTiles[L]&&(m.neighboringTiles[L].backfilled=!0)))}}getTile(s){return this.getTileByID(s.key)}getTileByID(s){return this._tiles[s]}_retainLoadedChildren(s,d,f,m){for(const b in this._tiles){let M=this._tiles[b];if(m[b]||!M.hasData()||M.tileID.overscaledZ<=d||M.tileID.overscaledZ>f)continue;let P=M.tileID;for(;M&&M.tileID.overscaledZ>d+1;){const L=M.tileID.scaledTo(M.tileID.overscaledZ-1);M=this._tiles[L.key],M&&M.hasData()&&(P=L)}let D=P;for(;D.overscaledZ>d;)if(D=D.scaledTo(D.overscaledZ-1),s[D.key]){m[P.key]=P;break}}}findLoadedParent(s,d){if(s.key in this._loadedParentTiles){const f=this._loadedParentTiles[s.key];return f&&f.tileID.overscaledZ>=d?f:null}for(let f=s.overscaledZ-1;f>=d;f--){const m=s.scaledTo(f),b=this._getLoadedTile(m);if(b)return b}}findLoadedSibling(s){return this._getLoadedTile(s)}_getLoadedTile(s){const d=this._tiles[s.key];return d&&d.hasData()?d:this._cache.getByKey(s.wrapped().key)}updateCacheSize(s){const d=Math.ceil(s.width/this._source.tileSize)+1,f=Math.ceil(s.height/this._source.tileSize)+1,m=Math.floor(d*f*(this._maxTileCacheZoomLevels===null?l.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),b=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,m):m;this._cache.setMaxSize(b)}handleWrapJump(s){const d=Math.round((s-(this._prevLng===void 0?s:this._prevLng))/360);if(this._prevLng=s,d){const f={};for(const m in this._tiles){const b=this._tiles[m];b.tileID=b.tileID.unwrapTo(b.tileID.wrap+d),f[b.tileID.key]=b}this._tiles=f;for(const m in this._timers)clearTimeout(this._timers[m]),delete this._timers[m];for(const m in this._tiles)this._setTileReloadTimer(m,this._tiles[m])}}_updateCoveredAndRetainedTiles(s,d,f,m,b,M){const P={},D={},L=Object.keys(s),B=E.now();for(const F of L){const W=s[F],K=this._tiles[F];if(!K||K.fadeEndTime!==0&&K.fadeEndTime<=B)continue;const Q=this.findLoadedParent(W,d),re=this.findLoadedSibling(W),le=Q||re||null;le&&(this._addTile(le.tileID),P[le.tileID.key]=le.tileID),D[F]=W}this._retainLoadedChildren(D,m,f,s);for(const F in P)s[F]||(this._coveredTiles[F]=!0,s[F]=P[F]);if(M){const F={},W={};for(const K of b)this._tiles[K.key].hasData()?F[K.key]=K:W[K.key]=K;for(const K in W){const Q=W[K].children(this._source.maxzoom);this._tiles[Q[0].key]&&this._tiles[Q[1].key]&&this._tiles[Q[2].key]&&this._tiles[Q[3].key]&&(F[Q[0].key]=s[Q[0].key]=Q[0],F[Q[1].key]=s[Q[1].key]=Q[1],F[Q[2].key]=s[Q[2].key]=Q[2],F[Q[3].key]=s[Q[3].key]=Q[3],delete W[K])}for(const K in W){const Q=W[K],re=this.findLoadedParent(Q,this._source.minzoom),le=this.findLoadedSibling(Q),ce=re||le||null;if(ce){F[ce.tileID.key]=s[ce.tileID.key]=ce.tileID;for(const he in F)F[he].isChildOf(ce.tileID)&&delete F[he]}}for(const K in this._tiles)F[K]||(this._coveredTiles[K]=!0)}}update(s,d){if(!this._sourceLoaded||this._paused)return;let f;this.transform=s,this.terrain=d,this.updateCacheSize(s),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?f=s.getVisibleUnwrappedCoordinates(this._source.tileID).map(B=>new l.S(B.canonical.z,B.wrap,B.canonical.z,B.canonical.x,B.canonical.y)):(f=s.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:d}),this._source.hasTile&&(f=f.filter(B=>this._source.hasTile(B)))):f=[];const m=s.coveringZoomLevel(this._source),b=Math.max(m-Re.maxOverzooming,this._source.minzoom),M=Math.max(m+Re.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const B={};for(const F of f)if(F.canonical.z>this._source.minzoom){const W=F.scaledTo(F.canonical.z-1);B[W.key]=W;const K=F.scaledTo(Math.max(this._source.minzoom,Math.min(F.canonical.z,5)));B[K.key]=K}f=f.concat(Object.values(B))}const P=f.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,P&&this.fire(new l.k("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const D=this._updateRetainedTiles(f,m);Ut(this._source.type)&&this._updateCoveredAndRetainedTiles(D,b,M,m,f,d);for(const B in D)this._tiles[B].clearFadeHold();const L=l.ab(this._tiles,D);for(const B of L){const F=this._tiles[B];F.hasSymbolBuckets&&!F.holdingForFade()?F.setHoldDuration(this.map._fadeDuration):F.hasSymbolBuckets&&!F.symbolFadeFinished()||this._removeTile(B)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const s in this._tiles)this._tiles[s].holdingForFade()&&this._removeTile(s)}_updateRetainedTiles(s,d){var f;const m={},b={},M=Math.max(d-Re.maxOverzooming,this._source.minzoom),P=Math.max(d+Re.maxUnderzooming,this._source.minzoom),D={};for(const L of s){const B=this._addTile(L);m[L.key]=L,B.hasData()||d<this._source.maxzoom&&(D[L.key]=L)}this._retainLoadedChildren(D,d,P,m);for(const L of s){let B=this._tiles[L.key];if(B.hasData())continue;if(d+1>this._source.maxzoom){const W=L.children(this._source.maxzoom)[0],K=this.getTile(W);if(K&&K.hasData()){m[W.key]=W;continue}}else{const W=L.children(this._source.maxzoom);if(m[W[0].key]&&m[W[1].key]&&m[W[2].key]&&m[W[3].key])continue}let F=B.wasRequested();for(let W=L.overscaledZ-1;W>=M;--W){const K=L.scaledTo(W);if(b[K.key])break;if(b[K.key]=!0,B=this.getTile(K),!B&&F&&(B=this._addTile(K)),B){const Q=B.hasData();if((Q||!(!((f=this.map)===null||f===void 0)&&f.cancelPendingTileRequestsWhileZooming)||F)&&(m[K.key]=K),F=B.wasRequested(),Q)break}}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const s in this._tiles){const d=[];let f,m=this._tiles[s].tileID;for(;m.overscaledZ>0;){if(m.key in this._loadedParentTiles){f=this._loadedParentTiles[m.key];break}d.push(m.key);const b=m.scaledTo(m.overscaledZ-1);if(f=this._getLoadedTile(b),f)break;m=b}for(const b of d)this._loadedParentTiles[b]=f}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const s in this._tiles){const d=this._tiles[s].tileID,f=this._getLoadedTile(d);this._loadedSiblingTiles[d.key]=f}}_addTile(s){let d=this._tiles[s.key];if(d)return d;d=this._cache.getAndRemove(s),d&&(this._setTileReloadTimer(s.key,d),d.tileID=s,this._state.initializeTileState(d,this.map?this.map.painter:null),this._cacheTimers[s.key]&&(clearTimeout(this._cacheTimers[s.key]),delete this._cacheTimers[s.key],this._setTileReloadTimer(s.key,d)));const f=d;return d||(d=new Ts(s,this._source.tileSize*s.overscaleFactor()),this._loadTile(d,s.key,d.state)),d.uses++,this._tiles[s.key]=d,f||this._source.fire(new l.k("dataloading",{tile:d,coord:d.tileID,dataType:"source"})),d}_setTileReloadTimer(s,d){s in this._timers&&(clearTimeout(this._timers[s]),delete this._timers[s]);const f=d.getExpiryTimeout();f&&(this._timers[s]=setTimeout(()=>{this._reloadTile(s,"expired"),delete this._timers[s]},f))}_removeTile(s){const d=this._tiles[s];d&&(d.uses--,delete this._tiles[s],this._timers[s]&&(clearTimeout(this._timers[s]),delete this._timers[s]),d.uses>0||(d.hasData()&&d.state!=="reloading"?this._cache.add(d.tileID,d,d.getExpiryTimeout()):(d.aborted=!0,this._abortTile(d),this._unloadTile(d))))}_dataHandler(s){const d=s.sourceDataType;s.dataType==="source"&&d==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&s.dataType==="source"&&d==="content"&&(this.reload(),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const s in this._tiles)this._removeTile(s);this._cache.reset()}tilesIn(s,d,f){const m=[],b=this.transform;if(!b)return m;const M=f?b.getCameraQueryGeometry(s):s,P=s.map(Q=>b.pointCoordinate(Q,this.terrain)),D=M.map(Q=>b.pointCoordinate(Q,this.terrain)),L=this.getIds();let B=1/0,F=1/0,W=-1/0,K=-1/0;for(const Q of D)B=Math.min(B,Q.x),F=Math.min(F,Q.y),W=Math.max(W,Q.x),K=Math.max(K,Q.y);for(let Q=0;Q<L.length;Q++){const re=this._tiles[L[Q]];if(re.holdingForFade())continue;const le=re.tileID,ce=Math.pow(2,b.zoom-re.tileID.overscaledZ),he=d*re.queryPadding*l.X/re.tileSize/ce,te=[le.getTilePoint(new l.Z(B,F)),le.getTilePoint(new l.Z(W,K))];if(te[0].x-he<l.X&&te[0].y-he<l.X&&te[1].x+he>=0&&te[1].y+he>=0){const me=P.map(xe=>le.getTilePoint(xe)),ge=D.map(xe=>le.getTilePoint(xe));m.push({tile:re,tileID:le,queryGeometry:me,cameraQueryGeometry:ge,scale:ce})}}return m}getVisibleCoordinates(s){const d=this.getRenderableIds(s).map(f=>this._tiles[f].tileID);for(const f of d)f.posMatrix=this.transform.calculatePosMatrix(f.toUnwrapped());return d}hasTransition(){if(this._source.hasTransition())return!0;if(Ut(this._source.type)){const s=E.now();for(const d in this._tiles)if(this._tiles[d].fadeEndTime>=s)return!0}return!1}setFeatureState(s,d,f){this._state.updateState(s=s||"_geojsonTileLayer",d,f)}removeFeatureState(s,d,f){this._state.removeFeatureState(s=s||"_geojsonTileLayer",d,f)}getFeatureState(s,d){return this._state.getState(s=s||"_geojsonTileLayer",d)}setDependencies(s,d,f){const m=this._tiles[s];m&&m.setDependencies(d,f)}reloadTilesForDependencies(s,d){for(const f in this._tiles)this._tiles[f].hasDependency(s,d)&&this._reloadTile(f,"reloading");this._cache.filter(f=>!f.hasDependency(s,d))}}function xt(x,s){const d=Math.abs(2*x.wrap)-+(x.wrap<0),f=Math.abs(2*s.wrap)-+(s.wrap<0);return x.overscaledZ-s.overscaledZ||f-d||s.canonical.y-x.canonical.y||s.canonical.x-x.canonical.x}function Ut(x){return x==="raster"||x==="image"||x==="video"}Re.maxOverzooming=10,Re.maxUnderzooming=3;class Je{constructor(s,d){this.reset(s,d)}reset(s,d){this.points=s||[],this._distances=[0];for(let f=1;f<this.points.length;f++)this._distances[f]=this._distances[f-1]+this.points[f].dist(this.points[f-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(d||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(s){if(this.points.length===1)return this.points[0];s=l.ac(s,0,1);let d=1,f=this._distances[d];const m=s*this.paddedLength+this.padding;for(;f<m&&d<this._distances.length;)f=this._distances[++d];const b=d-1,M=this._distances[b],P=f-M,D=P>0?(m-M)/P:0;return this.points[b].mult(1-D).add(this.points[d].mult(D))}}function Rn(x,s){let d=!0;return x==="always"||x!=="never"&&s!=="never"||(d=!1),d}class Kn{constructor(s,d,f){const m=this.boxCells=[],b=this.circleCells=[];this.xCellCount=Math.ceil(s/f),this.yCellCount=Math.ceil(d/f);for(let M=0;M<this.xCellCount*this.yCellCount;M++)m.push([]),b.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=s,this.height=d,this.xScale=this.xCellCount/s,this.yScale=this.yCellCount/d,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(s,d,f,m,b){this._forEachCell(d,f,m,b,this._insertBoxCell,this.boxUid++),this.boxKeys.push(s),this.bboxes.push(d),this.bboxes.push(f),this.bboxes.push(m),this.bboxes.push(b)}insertCircle(s,d,f,m){this._forEachCell(d-m,f-m,d+m,f+m,this._insertCircleCell,this.circleUid++),this.circleKeys.push(s),this.circles.push(d),this.circles.push(f),this.circles.push(m)}_insertBoxCell(s,d,f,m,b,M){this.boxCells[b].push(M)}_insertCircleCell(s,d,f,m,b,M){this.circleCells[b].push(M)}_query(s,d,f,m,b,M,P){if(f<0||s>this.width||m<0||d>this.height)return[];const D=[];if(s<=0&&d<=0&&this.width<=f&&this.height<=m){if(b)return[{key:null,x1:s,y1:d,x2:f,y2:m}];for(let L=0;L<this.boxKeys.length;L++)D.push({key:this.boxKeys[L],x1:this.bboxes[4*L],y1:this.bboxes[4*L+1],x2:this.bboxes[4*L+2],y2:this.bboxes[4*L+3]});for(let L=0;L<this.circleKeys.length;L++){const B=this.circles[3*L],F=this.circles[3*L+1],W=this.circles[3*L+2];D.push({key:this.circleKeys[L],x1:B-W,y1:F-W,x2:B+W,y2:F+W})}}else this._forEachCell(s,d,f,m,this._queryCell,D,{hitTest:b,overlapMode:M,seenUids:{box:{},circle:{}}},P);return D}query(s,d,f,m){return this._query(s,d,f,m,!1,null)}hitTest(s,d,f,m,b,M){return this._query(s,d,f,m,!0,b,M).length>0}hitTestCircle(s,d,f,m,b){const M=s-f,P=s+f,D=d-f,L=d+f;if(P<0||M>this.width||L<0||D>this.height)return!1;const B=[];return this._forEachCell(M,D,P,L,this._queryCellCircle,B,{hitTest:!0,overlapMode:m,circle:{x:s,y:d,radius:f},seenUids:{box:{},circle:{}}},b),B.length>0}_queryCell(s,d,f,m,b,M,P,D){const{seenUids:L,hitTest:B,overlapMode:F}=P,W=this.boxCells[b];if(W!==null){const Q=this.bboxes;for(const re of W)if(!L.box[re]){L.box[re]=!0;const le=4*re,ce=this.boxKeys[re];if(s<=Q[le+2]&&d<=Q[le+3]&&f>=Q[le+0]&&m>=Q[le+1]&&(!D||D(ce))&&(!B||!Rn(F,ce.overlapMode))&&(M.push({key:ce,x1:Q[le],y1:Q[le+1],x2:Q[le+2],y2:Q[le+3]}),B))return!0}}const K=this.circleCells[b];if(K!==null){const Q=this.circles;for(const re of K)if(!L.circle[re]){L.circle[re]=!0;const le=3*re,ce=this.circleKeys[re];if(this._circleAndRectCollide(Q[le],Q[le+1],Q[le+2],s,d,f,m)&&(!D||D(ce))&&(!B||!Rn(F,ce.overlapMode))){const he=Q[le],te=Q[le+1],me=Q[le+2];if(M.push({key:ce,x1:he-me,y1:te-me,x2:he+me,y2:te+me}),B)return!0}}}return!1}_queryCellCircle(s,d,f,m,b,M,P,D){const{circle:L,seenUids:B,overlapMode:F}=P,W=this.boxCells[b];if(W!==null){const Q=this.bboxes;for(const re of W)if(!B.box[re]){B.box[re]=!0;const le=4*re,ce=this.boxKeys[re];if(this._circleAndRectCollide(L.x,L.y,L.radius,Q[le+0],Q[le+1],Q[le+2],Q[le+3])&&(!D||D(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}const K=this.circleCells[b];if(K!==null){const Q=this.circles;for(const re of K)if(!B.circle[re]){B.circle[re]=!0;const le=3*re,ce=this.circleKeys[re];if(this._circlesCollide(Q[le],Q[le+1],Q[le+2],L.x,L.y,L.radius)&&(!D||D(ce))&&!Rn(F,ce.overlapMode))return M.push(!0),!0}}}_forEachCell(s,d,f,m,b,M,P,D){const L=this._convertToXCellCoord(s),B=this._convertToYCellCoord(d),F=this._convertToXCellCoord(f),W=this._convertToYCellCoord(m);for(let K=L;K<=F;K++)for(let Q=B;Q<=W;Q++)if(b.call(this,s,d,f,m,this.xCellCount*Q+K,M,P,D))return}_convertToXCellCoord(s){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(s*this.xScale)))}_convertToYCellCoord(s){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(s*this.yScale)))}_circlesCollide(s,d,f,m,b,M){const P=m-s,D=b-d,L=f+M;return L*L>P*P+D*D}_circleAndRectCollide(s,d,f,m,b,M,P){const D=(M-m)/2,L=Math.abs(s-(m+D));if(L>D+f)return!1;const B=(P-b)/2,F=Math.abs(d-(b+B));if(F>B+f)return!1;if(L<=D||F<=B)return!0;const W=L-D,K=F-B;return W*W+K*K<=f*f}}function Ui(x,s,d,f,m){const b=l.H();return s?(l.K(b,b,[1/m,1/m,1]),d||l.ad(b,b,f.angle)):l.L(b,f.labelPlaneMatrix,x),b}function pr(x,s,d,f,m){if(s){const b=l.ae(x);return l.K(b,b,[m,m,1]),d||l.ad(b,b,-f.angle),b}return f.glCoordMatrix}function se(x,s,d,f){let m;f?(m=[x,s,f(x,s),1],l.af(m,m,d)):(m=[x,s,0,1],sn(m,m,d));const b=m[3];return{point:new l.P(m[0]/b,m[1]/b),signedDistanceFromCamera:b,isOccluded:!1}}function U(x,s){return .5+x/s*.5}function j(x,s){return x.x>=-s[0]&&x.x<=s[0]&&x.y>=-s[1]&&x.y<=s[1]}function Y(x,s,d,f,m,b,M,P,D,L,B,F,W,K,Q){const re=f?x.textSizeData:x.iconSizeData,le=l.ag(re,d.transform.zoom),ce=[256/d.width*2+1,256/d.height*2+1],he=f?x.text.dynamicLayoutVertexArray:x.icon.dynamicLayoutVertexArray;he.clear();const te=x.lineVertexArray,me=f?x.text.placedSymbolArray:x.icon.placedSymbolArray,ge=d.transform.width/d.transform.height;let xe=!1;for(let Oe=0;Oe<me.length;Oe++){const Fe=me.get(Oe);if(Fe.hidden||Fe.writingMode===l.ah.vertical&&!xe){kt(Fe.numGlyphs,he);continue}xe=!1;const Ke=se(Fe.anchorX,Fe.anchorY,s,Q);if(!j(Ke.point,ce)){kt(Fe.numGlyphs,he);continue}const nt=U(d.transform.cameraToCenterDistance,Ke.signedDistanceFromCamera),We=l.ai(re,le,Fe),He=M?We/nt:We*nt,pt={getElevation:Q,labelPlaneMatrix:m,lineVertexArray:te,pitchWithMap:M,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:L,tileAnchorPoint:new l.P(Fe.anchorX,Fe.anchorY),unwrappedTileID:B,width:F,height:W,translation:K},Ot=fe(pt,Fe,He,!1,P,s,b,x.glyphOffsetArray,he,ge,D);xe=Ot.useVertical,(Ot.notEnoughRoom||xe||Ot.needsFlipping&&fe(pt,Fe,He,!0,P,s,b,x.glyphOffsetArray,he,ge,D).notEnoughRoom)&&kt(Fe.numGlyphs,he)}f?x.text.dynamicLayoutVertexBuffer.updateData(he):x.icon.dynamicLayoutVertexBuffer.updateData(he)}function ne(x,s,d,f,m,b,M,P){const D=b.glyphStartIndex+b.numGlyphs,L=b.lineStartIndex,B=b.lineStartIndex+b.lineLength,F=s.getoffsetX(b.glyphStartIndex),W=s.getoffsetX(D-1),K=Ue(x*F,d,f,m,b.segment,L,B,P,M);if(!K)return null;const Q=Ue(x*W,d,f,m,b.segment,L,B,P,M);return Q?P.projectionCache.anyProjectionOccluded?null:{first:K,last:Q}:null}function de(x,s,d,f){return x===l.ah.horizontal&&Math.abs(d.y-s.y)>Math.abs(d.x-s.x)*f?{useVertical:!0}:(x===l.ah.vertical?s.y<d.y:s.x>d.x)?{needsFlipping:!0}:null}function fe(x,s,d,f,m,b,M,P,D,L,B){const F=d/24,W=s.lineOffsetX*F,K=s.lineOffsetY*F;let Q;if(s.numGlyphs>1){const re=s.glyphStartIndex+s.numGlyphs,le=s.lineStartIndex,ce=s.lineStartIndex+s.lineLength,he=ne(F,P,W,K,f,s,B,x);if(!he)return{notEnoughRoom:!0};const te=se(he.first.point.x,he.first.point.y,M,x.getElevation).point,me=se(he.last.point.x,he.last.point.y,M,x.getElevation).point;if(m&&!f){const ge=de(s.writingMode,te,me,L);if(ge)return ge}Q=[he.first];for(let ge=s.glyphStartIndex+1;ge<re-1;ge++)Q.push(Ue(F*P.getoffsetX(ge),W,K,f,s.segment,le,ce,x,B));Q.push(he.last)}else{if(m&&!f){const le=se(x.tileAnchorPoint.x,x.tileAnchorPoint.y,b,x.getElevation).point,ce=s.lineStartIndex+s.segment+1,he=new l.P(x.lineVertexArray.getx(ce),x.lineVertexArray.gety(ce)),te=se(he.x,he.y,b,x.getElevation),me=te.signedDistanceFromCamera>0?te.point:function(xe,Oe,Fe,Ke,nt,We){return _e(xe,Oe,Fe,1,nt,We)}(x.tileAnchorPoint,he,le,0,b,x),ge=de(s.writingMode,le,me,L);if(ge)return ge}const re=Ue(F*P.getoffsetX(s.glyphStartIndex),W,K,f,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,x,B);if(!re||x.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};Q=[re]}for(const re of Q)l.aj(D,re.point,re.angle);return{}}function _e(x,s,d,f,m,b){const M=x.add(x.sub(s)._unit()),P=m!==void 0?se(M.x,M.y,m,b.getElevation).point:Te(M.x,M.y,b).point,D=d.sub(P);return d.add(D._mult(f/D.mag()))}function ue(x,s,d){const f=s.projectionCache;if(f.projections[x])return f.projections[x];const m=new l.P(s.lineVertexArray.getx(x),s.lineVertexArray.gety(x)),b=Te(m.x,m.y,s);if(b.signedDistanceFromCamera>0)return f.projections[x]=b.point,f.anyProjectionOccluded=f.anyProjectionOccluded||b.isOccluded,b.point;const M=x-d.direction;return function(P,D,L,B,F){return _e(P,D,L,B,void 0,F)}(d.distanceFromAnchor===0?s.tileAnchorPoint:new l.P(s.lineVertexArray.getx(M),s.lineVertexArray.gety(M)),m,d.previousVertex,d.absOffsetX-d.distanceFromAnchor+1,s)}function Te(x,s,d){const f=x+d.translation[0],m=s+d.translation[1];let b;return!d.pitchWithMap&&d.projection.useSpecialProjectionForSymbols?(b=d.projection.projectTileCoordinates(f,m,d.unwrappedTileID,d.getElevation),b.point.x=(.5*b.point.x+.5)*d.width,b.point.y=(.5*-b.point.y+.5)*d.height):(b=se(f,m,d.labelPlaneMatrix,d.getElevation),b.isOccluded=!1),b}function ze(x,s,d){return x._unit()._perp()._mult(s*d)}function Se(x,s,d,f,m,b,M,P,D){if(P.projectionCache.offsets[x])return P.projectionCache.offsets[x];const L=d.add(s);if(x+D.direction<f||x+D.direction>=m)return P.projectionCache.offsets[x]=L,L;const B=ue(x+D.direction,P,D),F=ze(B.sub(d),M,D.direction),W=d.add(F),K=B.add(F);return P.projectionCache.offsets[x]=l.ak(b,L,W,K)||L,P.projectionCache.offsets[x]}function Ue(x,s,d,f,m,b,M,P,D){const L=f?x-s:x+s;let B=L>0?1:-1,F=0;f&&(B*=-1,F=Math.PI),B<0&&(F+=Math.PI);let W,K=B>0?b+m:b+m+1;P.projectionCache.cachedAnchorPoint?W=P.projectionCache.cachedAnchorPoint:(W=Te(P.tileAnchorPoint.x,P.tileAnchorPoint.y,P).point,P.projectionCache.cachedAnchorPoint=W);let Q,re,le=W,ce=W,he=0,te=0;const me=Math.abs(L),ge=[];let xe;for(;he+te<=me;){if(K+=B,K<b||K>=M)return null;he+=te,ce=le,re=Q;const Ke={absOffsetX:me,direction:B,distanceFromAnchor:he,previousVertex:ce};if(le=ue(K,P,Ke),d===0)ge.push(ce),xe=le.sub(ce);else{let nt;const We=le.sub(ce);nt=We.mag()===0?ze(ue(K+B,P,Ke).sub(le),d,B):ze(We,d,B),re||(re=ce.add(nt)),Q=Se(K,nt,le,b,M,re,d,P,Ke),ge.push(re),xe=Q.sub(re)}te=xe.mag()}const Oe=xe._mult((me-he)/te)._add(re||ce),Fe=F+Math.atan2(le.y-ce.y,le.x-ce.x);return ge.push(Oe),{point:Oe,angle:D?Fe:0,path:ge}}const bt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function kt(x,s){for(let d=0;d<x;d++){const f=s.length;s.resize(f+4),s.float32.set(bt,3*f)}}function sn(x,s,d){const f=s[0],m=s[1];return x[0]=d[0]*f+d[4]*m+d[12],x[1]=d[1]*f+d[5]*m+d[13],x[3]=d[3]*f+d[7]*m+d[15],x}const Lt=100;class on{constructor(s,d,f=new Kn(s.width+200,s.height+200,25),m=new Kn(s.width+200,s.height+200,25)){this.transform=s,this.mapProjection=d,this.grid=f,this.ignoredGrid=m,this.pitchFactor=Math.cos(s._pitch)*s.cameraToCenterDistance,this.screenRightBoundary=s.width+Lt,this.screenBottomBoundary=s.height+Lt,this.gridRightBoundary=s.width+200,this.gridBottomBoundary=s.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(s,d,f,m,b,M,P,D,L,B,F){const W=s.anchorPointX+D[0],K=s.anchorPointY+D[1],Q=this.projectAndGetPerspectiveRatio(m,W,K,b,B),re=f*Q.perspectiveRatio;let le;if(M||P)le=this._projectCollisionBox(s,re,m,b,M,P,D,Q,B,F);else{const ge=Q.point.x+(F?F.x*re:0),xe=Q.point.y+(F?F.y*re:0);le={allPointsOccluded:!1,box:[ge+s.x1*re,xe+s.y1*re,ge+s.x2*re,xe+s.y2*re]}}const[ce,he,te,me]=le.box;return this.mapProjection.useSpecialProjectionForSymbols&&(M?le.allPointsOccluded:this.mapProjection.isOccluded(W,K,b))||Q.perspectiveRatio<this.perspectiveRatioCutoff||!this.isInsideGrid(ce,he,te,me)||d!=="always"&&this.grid.hitTest(ce,he,te,me,d,L)?{box:[ce,he,te,me],placeable:!1,offscreen:!1}:{box:[ce,he,te,me],placeable:!0,offscreen:this.isOffscreen(ce,he,te,me)}}placeCollisionCircles(s,d,f,m,b,M,P,D,L,B,F,W,K,Q,re,le){const ce=[],he=new l.P(d.anchorX,d.anchorY),te=this.getPerspectiveRatio(M,he.x,he.y,P,le),me=(F?b/te:b*te)/l.ap,ge={getElevation:le,labelPlaneMatrix:D,lineVertexArray:f,pitchWithMap:F,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},projection:this.mapProjection,tileAnchorPoint:he,unwrappedTileID:P,width:this.transform.width,height:this.transform.height,translation:re},xe=ne(me,m,d.lineOffsetX*me,d.lineOffsetY*me,!1,d,!1,ge);let Oe=!1,Fe=!1,Ke=!0;if(xe){const nt=.5*K*te+Q,We=new l.P(-100,-100),He=new l.P(this.screenRightBoundary,this.screenBottomBoundary),pt=new Je,Ot=xe.first,Ge=xe.last;let et=[];for(let Ft=Ot.path.length-1;Ft>=1;Ft--)et.push(Ot.path[Ft]);for(let Ft=1;Ft<Ge.path.length;Ft++)et.push(Ge.path[Ft]);const Pt=2.5*nt;if(L){const Ft=this.projectPathToScreenSpace(et,ge,L);et=Ft.some(Yt=>Yt.signedDistanceFromCamera<=0)?[]:Ft.map(Yt=>Yt.point)}let Nn=[];if(et.length>0){const Ft=et[0].clone(),Yt=et[0].clone();for(let Bn=1;Bn<et.length;Bn++)Ft.x=Math.min(Ft.x,et[Bn].x),Ft.y=Math.min(Ft.y,et[Bn].y),Yt.x=Math.max(Yt.x,et[Bn].x),Yt.y=Math.max(Yt.y,et[Bn].y);Nn=Ft.x>=We.x&&Yt.x<=He.x&&Ft.y>=We.y&&Yt.y<=He.y?[et]:Yt.x<We.x||Ft.x>He.x||Yt.y<We.y||Ft.y>He.y?[]:l.al([et],We.x,We.y,He.x,He.y)}for(const Ft of Nn){pt.reset(Ft,.25*nt);let Yt=0;Yt=pt.length<=.5*nt?1:Math.ceil(pt.paddedLength/Pt)+1;for(let Bn=0;Bn<Yt;Bn++){const Ii=Bn/Math.max(Yt-1,1),ns=pt.lerp(Ii),Fn=ns.x+Lt,rr=ns.y+Lt;ce.push(Fn,rr,nt,0);const qi=Fn-nt,Di=rr-nt,Wi=Fn+nt,Is=rr+nt;if(Ke=Ke&&this.isOffscreen(qi,Di,Wi,Is),Fe=Fe||this.isInsideGrid(qi,Di,Wi,Is),s!=="always"&&this.grid.hitTestCircle(Fn,rr,nt,s,W)&&(Oe=!0,!B))return{circles:[],offscreen:!1,collisionDetected:Oe}}}}return{circles:!B&&Oe||!Fe||te<this.perspectiveRatioCutoff?[]:ce,offscreen:Ke,collisionDetected:Oe}}projectPathToScreenSpace(s,d,f){return s.map(m=>se(m.x,m.y,f,d.getElevation))}queryRenderedSymbols(s){if(s.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const d=[];let f=1/0,m=1/0,b=-1/0,M=-1/0;for(const B of s){const F=new l.P(B.x+Lt,B.y+Lt);f=Math.min(f,F.x),m=Math.min(m,F.y),b=Math.max(b,F.x),M=Math.max(M,F.y),d.push(F)}const P=this.grid.query(f,m,b,M).concat(this.ignoredGrid.query(f,m,b,M)),D={},L={};for(const B of P){const F=B.key;if(D[F.bucketInstanceId]===void 0&&(D[F.bucketInstanceId]={}),D[F.bucketInstanceId][F.featureIndex])continue;const W=[new l.P(B.x1,B.y1),new l.P(B.x2,B.y1),new l.P(B.x2,B.y2),new l.P(B.x1,B.y2)];l.am(d,W)&&(D[F.bucketInstanceId][F.featureIndex]=!0,L[F.bucketInstanceId]===void 0&&(L[F.bucketInstanceId]=[]),L[F.bucketInstanceId].push(F.featureIndex))}return L}insertCollisionBox(s,d,f,m,b,M){(f?this.ignoredGrid:this.grid).insert({bucketInstanceId:m,featureIndex:b,collisionGroupID:M,overlapMode:d},s[0],s[1],s[2],s[3])}insertCollisionCircles(s,d,f,m,b,M){const P=f?this.ignoredGrid:this.grid,D={bucketInstanceId:m,featureIndex:b,collisionGroupID:M,overlapMode:d};for(let L=0;L<s.length;L+=4)P.insertCircle(D,s[L],s[L+1],s[L+2])}projectAndGetPerspectiveRatio(s,d,f,m,b){let M;b?(M=[d,f,b(d,f),1],l.af(M,M,s)):(M=[d,f,0,1],sn(M,M,s));const P=M[3];return{point:new l.P((M[0]/P+1)/2*this.transform.width+Lt,(-M[1]/P+1)/2*this.transform.height+Lt),perspectiveRatio:.5+this.transform.cameraToCenterDistance/P*.5,isOccluded:!1,signedDistanceFromCamera:P}}getPerspectiveRatio(s,d,f,m,b){const M=this.mapProjection.useSpecialProjectionForSymbols?this.mapProjection.projectTileCoordinates(d,f,m,b):se(d,f,s,b);return .5+this.transform.cameraToCenterDistance/M.signedDistanceFromCamera*.5}isOffscreen(s,d,f,m){return f<Lt||s>=this.screenRightBoundary||m<Lt||d>this.screenBottomBoundary}isInsideGrid(s,d,f,m){return f>=0&&s<this.gridRightBoundary&&m>=0&&d<this.gridBottomBoundary}getViewportMatrix(){const s=l.an([]);return l.J(s,s,[-100,-100,0]),s}_projectCollisionBox(s,d,f,m,b,M,P,D,L,B){let F=new l.P(1,0),W=new l.P(0,1);const K=new l.P(s.anchorPointX+P[0],s.anchorPointY+P[1]);if(M&&!b){const Ke=this.projectAndGetPerspectiveRatio(f,K.x+1,K.y,m,L).point.sub(D.point).unit(),nt=Math.atan(Ke.y/Ke.x)+(Ke.x<0?Math.PI:0),We=Math.sin(nt),He=Math.cos(nt);F=new l.P(He,We),W=new l.P(-We,He)}else if(!M&&b){const Ke=-this.transform.angle,nt=Math.sin(Ke),We=Math.cos(Ke);F=new l.P(We,nt),W=new l.P(-nt,We)}let Q=D.point,re=d;if(b){Q=K;const Ke=this.transform.zoom-Math.floor(this.transform.zoom);re=Math.pow(2,-Ke),re*=this.mapProjection.getPitchedTextCorrection(this.transform,K,m),B||(re*=l.ac(.5+D.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))}B&&(Q=Q.add(F.mult(B.x*re)).add(W.mult(B.y*re)));const le=s.x1*re,ce=s.x2*re,he=(le+ce)/2,te=s.y1*re,me=s.y2*re,ge=(te+me)/2,xe=[{offsetX:le,offsetY:te},{offsetX:he,offsetY:te},{offsetX:ce,offsetY:te},{offsetX:ce,offsetY:ge},{offsetX:ce,offsetY:me},{offsetX:he,offsetY:me},{offsetX:le,offsetY:me},{offsetX:le,offsetY:ge}];let Oe=[];for(const{offsetX:Ke,offsetY:nt}of xe)Oe.push(new l.P(Q.x+F.x*Ke+W.x*nt,Q.y+F.y*Ke+W.y*nt));let Fe=!1;if(b){const Ke=Oe.map(nt=>this.projectAndGetPerspectiveRatio(f,nt.x,nt.y,m,L));Fe=Ke.some(nt=>!nt.isOccluded),Oe=Ke.map(nt=>nt.point)}else Fe=!0;return{box:l.ao(Oe),allPointsOccluded:!Fe}}}function Zt(x,s,d){return s*(l.X/(x.tileSize*Math.pow(2,d-x.tileID.overscaledZ)))}class ri{constructor(s,d,f,m){this.opacity=s?Math.max(0,Math.min(1,s.opacity+(s.placed?d:-d))):m&&f?1:0,this.placed=f}isHidden(){return this.opacity===0&&!this.placed}}class Zn{constructor(s,d,f,m,b){this.text=new ri(s?s.text:null,d,f,b),this.icon=new ri(s?s.icon:null,d,m,b)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class $t{constructor(s,d,f){this.text=s,this.icon=d,this.skipFade=f}}class xn{constructor(){this.invProjMatrix=l.H(),this.viewportMatrix=l.H(),this.circles=[]}}class Un{constructor(s,d,f,m,b){this.bucketInstanceId=s,this.featureIndex=d,this.sourceLayerIndex=f,this.bucketIndex=m,this.tileID=b}}class fi{constructor(s){this.crossSourceCollisions=s,this.maxGroupID=0,this.collisionGroups={}}get(s){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[s]){const d=++this.maxGroupID;this.collisionGroups[s]={ID:d,predicate:f=>f.collisionGroupID===d}}return this.collisionGroups[s]}}function wi(x,s,d,f,m){const{horizontalAlign:b,verticalAlign:M}=l.au(x);return new l.P(-(b-.5)*s+f[0]*m,-(M-.5)*d+f[1]*m)}class Hi{constructor(s,d,f,m,b,M){this.transform=s.clone(),this.terrain=f,this.collisionIndex=new on(this.transform,d),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new fi(b),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(s){const d=this.terrain;return d?(f,m)=>d.getElevation(s,f,m):null}getBucketParts(s,d,f,m){const b=f.getBucket(d),M=f.latestFeatureIndex;if(!b||!M||d.id!==b.layerIds[0])return;const P=f.collisionBoxArray,D=b.layers[0].layout,L=b.layers[0].paint,B=Math.pow(2,this.transform.zoom-f.tileID.overscaledZ),F=f.tileSize/l.X,W=f.tileID.toUnwrapped(),K=this.transform.calculatePosMatrix(W),Q=D.get("text-pitch-alignment")==="map",re=D.get("text-rotation-alignment")==="map",le=Zt(f,1,this.transform.zoom),ce=this.collisionIndex.mapProjection.translatePosition(this.transform,f,L.get("text-translate"),L.get("text-translate-anchor")),he=this.collisionIndex.mapProjection.translatePosition(this.transform,f,L.get("icon-translate"),L.get("icon-translate-anchor")),te=Ui(K,Q,re,this.transform,le);let me=null;if(Q){const xe=pr(K,Q,re,this.transform,le);me=l.L([],this.transform.labelPlaneMatrix,xe)}this.retainedQueryData[b.bucketInstanceId]=new Un(b.bucketInstanceId,M,b.sourceLayerIndex,b.index,f.tileID);const ge={bucket:b,layout:D,translationText:ce,translationIcon:he,posMatrix:K,unwrappedTileID:W,textLabelPlaneMatrix:te,labelToScreenMatrix:me,scale:B,textPixelRatio:F,holdingForFade:f.holdingForFade(),collisionBoxArray:P,partiallyEvaluatedTextSize:l.ag(b.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(b.sourceID)};if(m)for(const xe of b.sortKeyRanges){const{sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:Ke}=xe;s.push({sortKey:Oe,symbolInstanceStart:Fe,symbolInstanceEnd:Ke,parameters:ge})}else s.push({symbolInstanceStart:0,symbolInstanceEnd:b.symbolInstances.length,parameters:ge})}attemptAnchorPlacement(s,d,f,m,b,M,P,D,L,B,F,W,K,Q,re,le,ce,he,te){const me=l.aq[s.textAnchor],ge=[s.textOffset0,s.textOffset1],xe=wi(me,f,m,ge,b),Oe=this.collisionIndex.placeCollisionBox(d,W,D,L,B,P,M,le,F.predicate,te,xe);if((!he||this.collisionIndex.placeCollisionBox(he,W,D,L,B,P,M,ce,F.predicate,te,xe).placeable)&&Oe.placeable){let Fe;if(this.prevPlacement&&this.prevPlacement.variableOffsets[K.crossTileID]&&this.prevPlacement.placements[K.crossTileID]&&this.prevPlacement.placements[K.crossTileID].text&&(Fe=this.prevPlacement.variableOffsets[K.crossTileID].anchor),K.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[K.crossTileID]={textOffset:ge,width:f,height:m,anchor:me,textBoxScale:b,prevAnchor:Fe},this.markUsedJustification(Q,me,K,re),Q.allowVerticalPlacement&&(this.markUsedOrientation(Q,re,K),this.placedOrientations[K.crossTileID]=re),{shift:xe,placedGlyphBoxes:Oe}}}placeLayerBucketPart(s,d,f){const{bucket:m,layout:b,translationText:M,translationIcon:P,posMatrix:D,unwrappedTileID:L,textLabelPlaneMatrix:B,labelToScreenMatrix:F,textPixelRatio:W,holdingForFade:K,collisionBoxArray:Q,partiallyEvaluatedTextSize:re,collisionGroup:le}=s.parameters,ce=b.get("text-optional"),he=b.get("icon-optional"),te=l.ar(b,"text-overlap","text-allow-overlap"),me=te==="always",ge=l.ar(b,"icon-overlap","icon-allow-overlap"),xe=ge==="always",Oe=b.get("text-rotation-alignment")==="map",Fe=b.get("text-pitch-alignment")==="map",Ke=b.get("icon-text-fit")!=="none",nt=b.get("symbol-z-order")==="viewport-y",We=me&&(xe||!m.hasIconData()||he),He=xe&&(me||!m.hasTextData()||ce);!m.collisionArrays&&Q&&m.deserializeCollisionBoxes(Q);const pt=this._getTerrainElevationFunc(this.retainedQueryData[m.bucketInstanceId].tileID),Ot=(Ge,et,Pt)=>{var Nn,Ft;if(d[Ge.crossTileID])return;if(K)return void(this.placements[Ge.crossTileID]=new $t(!1,!1,!1));let Yt=!1,Bn=!1,Ii=!0,ns=null,Fn={box:null,placeable:!1,offscreen:null},rr={box:null,placeable:!1,offscreen:null},qi=null,Di=null,Wi=null,Is=0,Xa=0,Iu=0;et.textFeatureIndex?Is=et.textFeatureIndex:Ge.useRuntimeCollisionCircles&&(Is=Ge.featureIndex),et.verticalTextFeatureIndex&&(Xa=et.verticalTextFeatureIndex);const Ka=et.textBox;if(Ka){const Vr=ki=>{let Oi=l.ah.horizontal;if(m.allowVerticalPlacement&&!ki&&this.prevPlacement){const br=this.prevPlacement.placedOrientations[Ge.crossTileID];br&&(this.placedOrientations[Ge.crossTileID]=br,Oi=br,this.markUsedOrientation(m,Oi,Ge))}return Oi},$r=(ki,Oi)=>{if(m.allowVerticalPlacement&&Ge.numVerticalGlyphVertices>0&&et.verticalTextBox){for(const br of m.writingModes)if(br===l.ah.vertical?(Fn=Oi(),rr=Fn):Fn=ki(),Fn&&Fn.placeable)break}else Fn=ki()},po=Ge.textAnchorOffsetStartIndex,is=Ge.textAnchorOffsetEndIndex;if(is===po){const ki=(Oi,br)=>{const Qt=this.collisionIndex.placeCollisionBox(Oi,te,W,D,L,Fe,Oe,M,le.predicate,pt);return Qt&&Qt.placeable&&(this.markUsedOrientation(m,br,Ge),this.placedOrientations[Ge.crossTileID]=br),Qt};$r(()=>ki(Ka,l.ah.horizontal),()=>{const Oi=et.verticalTextBox;return m.allowVerticalPlacement&&Ge.numVerticalGlyphVertices>0&&Oi?ki(Oi,l.ah.vertical):{box:null,offscreen:null}}),Vr(Fn&&Fn.placeable)}else{let ki=l.aq[(Ft=(Nn=this.prevPlacement)===null||Nn===void 0?void 0:Nn.variableOffsets[Ge.crossTileID])===null||Ft===void 0?void 0:Ft.anchor];const Oi=(Qt,Jo,Ja)=>{const Qa=Qt.x2-Qt.x1,Cm=Qt.y2-Qt.y1,x_=Ge.textBoxScale,Tm=Ke&&ge==="never"?Jo:null;let fo=null,Mm=te==="never"?1:2,Ou="never";ki&&Mm++;for(let tc=0;tc<Mm;tc++){for(let zu=po;zu<is;zu++){const Ru=m.textAnchorOffsets.get(zu);if(ki&&Ru.textAnchor!==ki)continue;const el=this.attemptAnchorPlacement(Ru,Qt,Qa,Cm,x_,Oe,Fe,W,D,L,le,Ou,Ge,m,Ja,M,P,Tm,pt);if(el&&(fo=el.placedGlyphBoxes,fo&&fo.placeable))return Yt=!0,ns=el.shift,fo}ki?ki=null:Ou=te}return f&&!fo&&(fo={box:this.collisionIndex.placeCollisionBox(Ka,"always",W,D,L,Fe,Oe,M,le.predicate,pt,new l.P(0,0)).box,offscreen:!1,placeable:!1}),fo};$r(()=>Oi(Ka,et.iconBox,l.ah.horizontal),()=>{const Qt=et.verticalTextBox;return m.allowVerticalPlacement&&(!Fn||!Fn.placeable)&&Ge.numVerticalGlyphVertices>0&&Qt?Oi(Qt,et.verticalIconBox,l.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Fn&&(Yt=Fn.placeable,Ii=Fn.offscreen);const br=Vr(Fn&&Fn.placeable);if(!Yt&&this.prevPlacement){const Qt=this.prevPlacement.variableOffsets[Ge.crossTileID];Qt&&(this.variableOffsets[Ge.crossTileID]=Qt,this.markUsedJustification(m,Qt.anchor,Ge,br))}}}if(qi=Fn,Yt=qi&&qi.placeable,Ii=qi&&qi.offscreen,Ge.useRuntimeCollisionCircles){const Vr=m.text.placedSymbolArray.get(Ge.centerJustifiedTextSymbolIndex),$r=l.ai(m.textSizeData,re,Vr),po=b.get("text-padding");Di=this.collisionIndex.placeCollisionCircles(te,Vr,m.lineVertexArray,m.glyphOffsetArray,$r,D,L,B,F,f,Fe,le.predicate,Ge.collisionCircleDiameter,po,M,pt),Di.circles.length&&Di.collisionDetected&&!f&&l.w("Collisions detected, but collision boxes are not shown"),Yt=me||Di.circles.length>0&&!Di.collisionDetected,Ii=Ii&&Di.offscreen}if(et.iconFeatureIndex&&(Iu=et.iconFeatureIndex),et.iconBox){const Vr=$r=>this.collisionIndex.placeCollisionBox($r,ge,W,D,L,Fe,Oe,P,le.predicate,pt,Ke&&ns?ns:void 0);rr&&rr.placeable&&et.verticalIconBox?(Wi=Vr(et.verticalIconBox),Bn=Wi.placeable):(Wi=Vr(et.iconBox),Bn=Wi.placeable),Ii=Ii&&Wi.offscreen}const Fr=ce||Ge.numHorizontalGlyphVertices===0&&Ge.numVerticalGlyphVertices===0,Du=he||Ge.numIconVertices===0;Fr||Du?Du?Fr||(Bn=Bn&&Yt):Yt=Bn&&Yt:Bn=Yt=Bn&&Yt;const Nd=Bn&&Wi.placeable;if(Yt&&qi.placeable&&this.collisionIndex.insertCollisionBox(qi.box,te,b.get("text-ignore-placement"),m.bucketInstanceId,rr&&rr.placeable&&Xa?Xa:Is,le.ID),Nd&&this.collisionIndex.insertCollisionBox(Wi.box,ge,b.get("icon-ignore-placement"),m.bucketInstanceId,Iu,le.ID),Di&&Yt&&this.collisionIndex.insertCollisionCircles(Di.circles,te,b.get("text-ignore-placement"),m.bucketInstanceId,Is,le.ID),f&&this.storeCollisionData(m.bucketInstanceId,Pt,et,qi,Wi,Di),Ge.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(m.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ge.crossTileID]=new $t(Yt||We,Bn||He,Ii||m.justReloaded),d[Ge.crossTileID]=!0};if(nt){if(s.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ge=m.getSortedSymbolIndexes(this.transform.angle);for(let et=Ge.length-1;et>=0;--et){const Pt=Ge[et];Ot(m.symbolInstances.get(Pt),m.collisionArrays[Pt],Pt)}}else for(let Ge=s.symbolInstanceStart;Ge<s.symbolInstanceEnd;Ge++)Ot(m.symbolInstances.get(Ge),m.collisionArrays[Ge],Ge);if(f&&m.bucketInstanceId in this.collisionCircleArrays){const Ge=this.collisionCircleArrays[m.bucketInstanceId];l.as(Ge.invProjMatrix,D),Ge.viewportMatrix=this.collisionIndex.getViewportMatrix()}m.justReloaded=!1}storeCollisionData(s,d,f,m,b,M){if(f.textBox||f.iconBox){let P,D;this.collisionBoxArrays.has(s)?P=this.collisionBoxArrays.get(s):(P=new Map,this.collisionBoxArrays.set(s,P)),P.has(d)?D=P.get(d):(D={text:null,icon:null},P.set(d,D)),f.textBox&&(D.text=m.box),f.iconBox&&(D.icon=b.box)}if(M){let P=this.collisionCircleArrays[s];P===void 0&&(P=this.collisionCircleArrays[s]=new xn);for(let D=0;D<M.circles.length;D+=4)P.circles.push(M.circles[D+0]),P.circles.push(M.circles[D+1]),P.circles.push(M.circles[D+2]),P.circles.push(M.collisionDetected?1:0)}}markUsedJustification(s,d,f,m){let b;b=m===l.ah.vertical?f.verticalPlacedTextSymbolIndex:{left:f.leftJustifiedTextSymbolIndex,center:f.centerJustifiedTextSymbolIndex,right:f.rightJustifiedTextSymbolIndex}[l.at(d)];const M=[f.leftJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.rightJustifiedTextSymbolIndex,f.verticalPlacedTextSymbolIndex];for(const P of M)P>=0&&(s.text.placedSymbolArray.get(P).crossTileID=b>=0&&P!==b?0:f.crossTileID)}markUsedOrientation(s,d,f){const m=d===l.ah.horizontal||d===l.ah.horizontalOnly?d:0,b=d===l.ah.vertical?d:0,M=[f.leftJustifiedTextSymbolIndex,f.centerJustifiedTextSymbolIndex,f.rightJustifiedTextSymbolIndex];for(const P of M)s.text.placedSymbolArray.get(P).placedOrientation=m;f.verticalPlacedTextSymbolIndex&&(s.text.placedSymbolArray.get(f.verticalPlacedTextSymbolIndex).placedOrientation=b)}commit(s){this.commitTime=s,this.zoomAtLastRecencyCheck=this.transform.zoom;const d=this.prevPlacement;let f=!1;this.prevZoomAdjustment=d?d.zoomAdjustment(this.transform.zoom):0;const m=d?d.symbolFadeChange(s):1,b=d?d.opacities:{},M=d?d.variableOffsets:{},P=d?d.placedOrientations:{};for(const D in this.placements){const L=this.placements[D],B=b[D];B?(this.opacities[D]=new Zn(B,m,L.text,L.icon),f=f||L.text!==B.text.placed||L.icon!==B.icon.placed):(this.opacities[D]=new Zn(null,m,L.text,L.icon,L.skipFade),f=f||L.text||L.icon)}for(const D in b){const L=b[D];if(!this.opacities[D]){const B=new Zn(L,m,!1,!1);B.isHidden()||(this.opacities[D]=B,f=f||L.text.placed||L.icon.placed)}}for(const D in M)this.variableOffsets[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.variableOffsets[D]=M[D]);for(const D in P)this.placedOrientations[D]||!this.opacities[D]||this.opacities[D].isHidden()||(this.placedOrientations[D]=P[D]);if(d&&d.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");f?this.lastPlacementChangeTime=s:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=d?d.lastPlacementChangeTime:s)}updateLayerOpacities(s,d){const f={};for(const m of d){const b=m.getBucket(s);b&&m.latestFeatureIndex&&s.id===b.layerIds[0]&&this.updateBucketOpacities(b,m.tileID,f,m.collisionBoxArray)}}updateBucketOpacities(s,d,f,m){s.hasTextData()&&(s.text.opacityVertexArray.clear(),s.text.hasVisibleVertices=!1),s.hasIconData()&&(s.icon.opacityVertexArray.clear(),s.icon.hasVisibleVertices=!1),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexArray.clear(),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexArray.clear();const b=s.layers[0],M=b.layout,P=new Zn(null,0,!1,!1,!0),D=M.get("text-allow-overlap"),L=M.get("icon-allow-overlap"),B=b._unevaluatedLayout.hasValue("text-variable-anchor")||b._unevaluatedLayout.hasValue("text-variable-anchor-offset"),F=M.get("text-rotation-alignment")==="map",W=M.get("text-pitch-alignment")==="map",K=M.get("icon-text-fit")!=="none",Q=new Zn(null,0,D&&(L||!s.hasIconData()||M.get("icon-optional")),L&&(D||!s.hasTextData()||M.get("text-optional")),!0);!s.collisionArrays&&m&&(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData())&&s.deserializeCollisionBoxes(m);const re=(ce,he,te)=>{for(let me=0;me<he/4;me++)ce.opacityVertexArray.emplaceBack(te);ce.hasVisibleVertices=ce.hasVisibleVertices||te!==Aa},le=this.collisionBoxArrays.get(s.bucketInstanceId);for(let ce=0;ce<s.symbolInstances.length;ce++){const he=s.symbolInstances.get(ce),{numHorizontalGlyphVertices:te,numVerticalGlyphVertices:me,crossTileID:ge}=he;let xe=this.opacities[ge];f[ge]?xe=P:xe||(xe=Q,this.opacities[ge]=xe),f[ge]=!0;const Oe=he.numIconVertices>0,Fe=this.placedOrientations[he.crossTileID],Ke=Fe===l.ah.vertical,nt=Fe===l.ah.horizontal||Fe===l.ah.horizontalOnly;if(te>0||me>0){const He=gr(xe.text);re(s.text,te,Ke?Aa:He),re(s.text,me,nt?Aa:He);const pt=xe.text.isHidden();[he.rightJustifiedTextSymbolIndex,he.centerJustifiedTextSymbolIndex,he.leftJustifiedTextSymbolIndex].forEach(et=>{et>=0&&(s.text.placedSymbolArray.get(et).hidden=pt||Ke?1:0)}),he.verticalPlacedTextSymbolIndex>=0&&(s.text.placedSymbolArray.get(he.verticalPlacedTextSymbolIndex).hidden=pt||nt?1:0);const Ot=this.variableOffsets[he.crossTileID];Ot&&this.markUsedJustification(s,Ot.anchor,he,Fe);const Ge=this.placedOrientations[he.crossTileID];Ge&&(this.markUsedJustification(s,"left",he,Ge),this.markUsedOrientation(s,Ge,he))}if(Oe){const He=gr(xe.icon),pt=!(K&&he.verticalPlacedIconSymbolIndex&&Ke);he.placedIconSymbolIndex>=0&&(re(s.icon,he.numIconVertices,pt?He:Aa),s.icon.placedSymbolArray.get(he.placedIconSymbolIndex).hidden=xe.icon.isHidden()),he.verticalPlacedIconSymbolIndex>=0&&(re(s.icon,he.numVerticalIconVertices,pt?Aa:He),s.icon.placedSymbolArray.get(he.verticalPlacedIconSymbolIndex).hidden=xe.icon.isHidden())}const We=le&&le.has(ce)?le.get(ce):{text:null,icon:null};if(s.hasIconCollisionBoxData()||s.hasTextCollisionBoxData()){const He=s.collisionArrays[ce];if(He){let pt=new l.P(0,0);if(He.textBox||He.verticalTextBox){let Ot=!0;if(B){const Ge=this.variableOffsets[ge];Ge?(pt=wi(Ge.anchor,Ge.width,Ge.height,Ge.textOffset,Ge.textBoxScale),F&&pt._rotate(W?this.transform.angle:-this.transform.angle)):Ot=!1}if(He.textBox||He.verticalTextBox){let Ge;He.textBox&&(Ge=Ke),He.verticalTextBox&&(Ge=nt),Ma(s.textCollisionBox.collisionVertexArray,xe.text.placed,!Ot||Ge,We.text,pt.x,pt.y)}}if(He.iconBox||He.verticalIconBox){const Ot=!!(!nt&&He.verticalIconBox);let Ge;He.iconBox&&(Ge=Ot),He.verticalIconBox&&(Ge=!Ot),Ma(s.iconCollisionBox.collisionVertexArray,xe.icon.placed,Ge,We.icon,K?pt.x:0,K?pt.y:0)}}}}if(s.sortFeatures(this.transform.angle),this.retainedQueryData[s.bucketInstanceId]&&(this.retainedQueryData[s.bucketInstanceId].featureSortOrder=s.featureSortOrder),s.hasTextData()&&s.text.opacityVertexBuffer&&s.text.opacityVertexBuffer.updateData(s.text.opacityVertexArray),s.hasIconData()&&s.icon.opacityVertexBuffer&&s.icon.opacityVertexBuffer.updateData(s.icon.opacityVertexArray),s.hasIconCollisionBoxData()&&s.iconCollisionBox.collisionVertexBuffer&&s.iconCollisionBox.collisionVertexBuffer.updateData(s.iconCollisionBox.collisionVertexArray),s.hasTextCollisionBoxData()&&s.textCollisionBox.collisionVertexBuffer&&s.textCollisionBox.collisionVertexBuffer.updateData(s.textCollisionBox.collisionVertexArray),s.text.opacityVertexArray.length!==s.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${s.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${s.text.layoutVertexArray.length}) / 4`);if(s.icon.opacityVertexArray.length!==s.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${s.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${s.icon.layoutVertexArray.length}) / 4`);if(s.bucketInstanceId in this.collisionCircleArrays){const ce=this.collisionCircleArrays[s.bucketInstanceId];s.placementInvProjMatrix=ce.invProjMatrix,s.placementViewportMatrix=ce.viewportMatrix,s.collisionCircleArray=ce.circles,delete this.collisionCircleArrays[s.bucketInstanceId]}}symbolFadeChange(s){return this.fadeDuration===0?1:(s-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(s){return Math.max(0,(this.transform.zoom-s)/1.5)}hasTransitions(s){return this.stale||s-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(s,d){const f=this.zoomAtLastRecencyCheck===d?1-this.zoomAdjustment(d):1;return this.zoomAtLastRecencyCheck=d,this.commitTime+this.fadeDuration*f>s}setStale(){this.stale=!0}}function Ma(x,s,d,f,m,b){f&&f.length!==0||(f=[0,0,0,0]);const M=f[0]-Lt,P=f[1]-Lt,D=f[2]-Lt,L=f[3]-Lt;x.emplaceBack(s?1:0,d?1:0,m||0,b||0,M,P),x.emplaceBack(s?1:0,d?1:0,m||0,b||0,D,P),x.emplaceBack(s?1:0,d?1:0,m||0,b||0,D,L),x.emplaceBack(s?1:0,d?1:0,m||0,b||0,M,L)}const vn=Math.pow(2,25),Zh=Math.pow(2,24),Yh=Math.pow(2,17),fr=Math.pow(2,16),mr=Math.pow(2,9),Z0=Math.pow(2,8),Rr=Math.pow(2,1);function gr(x){if(x.opacity===0&&!x.placed)return 0;if(x.opacity===1&&x.placed)return 4294967295;const s=x.placed?1:0,d=Math.floor(127*x.opacity);return d*vn+s*Zh+d*Yh+s*fr+d*mr+s*Z0+d*Rr+s}const Aa=0;function Vo(){return{isOccluded:(x,s,d)=>!1,getPitchedTextCorrection:(x,s,d)=>1,get useSpecialProjectionForSymbols(){return!1},projectTileCoordinates(x,s,d,f){throw new Error("Not implemented.")},translatePosition:(x,s,d,f)=>function(m,b,M,P,D=!1){if(!M[0]&&!M[1])return[0,0];const L=D?P==="map"?m.angle:0:P==="viewport"?-m.angle:0;if(L){const B=Math.sin(L),F=Math.cos(L);M=[M[0]*F-M[1]*B,M[0]*B+M[1]*F]}return[D?M[0]:Zt(b,M[0],m.zoom),D?M[1]:Zt(b,M[1],m.zoom)]}(x,s,d,f),getCircleRadiusCorrection:x=>1}}class si{constructor(s){this._sortAcrossTiles=s.layout.get("symbol-z-order")!=="viewport-y"&&!s.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(s,d,f,m,b){const M=this._bucketParts;for(;this._currentTileIndex<s.length;)if(d.getBucketParts(M,m,s[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,b())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,M.sort((P,D)=>P.sortKey-D.sortKey));this._currentPartIndex<M.length;)if(d.placeLayerBucketPart(M[this._currentPartIndex],this._seenCrossTileIDs,f),this._currentPartIndex++,b())return!0;return!1}}class Nl{constructor(s,d,f,m,b,M,P,D){this.placement=new Hi(s,Vo(),d,M,P,D),this._currentPlacementIndex=f.length-1,this._forceFullPlacement=m,this._showCollisionBoxes=b,this._done=!1}isDone(){return this._done}continuePlacement(s,d,f){const m=E.now(),b=()=>!this._forceFullPlacement&&E.now()-m>2;for(;this._currentPlacementIndex>=0;){const M=d[s[this._currentPlacementIndex]],P=this.placement.collisionIndex.transform.zoom;if(M.type==="symbol"&&(!M.minzoom||M.minzoom<=P)&&(!M.maxzoom||M.maxzoom>P)){if(this._inProgressLayer||(this._inProgressLayer=new si(M)),this._inProgressLayer.continuePlacement(f[M.source],this.placement,this._showCollisionBoxes,M,b))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(s){return this.placement.commit(s),this.placement}}const Kr=512/l.X/2;class ti{constructor(s,d,f){this.tileID=s,this.bucketInstanceId=f,this._symbolsByKey={};const m=new Map;for(let b=0;b<d.length;b++){const M=d.get(b),P=M.key,D=m.get(P);D?D.push(M):m.set(P,[M])}for(const[b,M]of m){const P={positions:M.map(D=>({x:Math.floor(D.anchorX*Kr),y:Math.floor(D.anchorY*Kr)})),crossTileIDs:M.map(D=>D.crossTileID)};if(P.positions.length>128){const D=new l.av(P.positions.length,16,Uint16Array);for(const{x:L,y:B}of P.positions)D.add(L,B);D.finish(),delete P.positions,P.index=D}this._symbolsByKey[b]=P}}getScaledCoordinates(s,d){const{x:f,y:m,z:b}=this.tileID.canonical,{x:M,y:P,z:D}=d.canonical,L=Kr/Math.pow(2,D-b),B=(P*l.X+s.anchorY)*L,F=m*l.X*Kr;return{x:Math.floor((M*l.X+s.anchorX)*L-f*l.X*Kr),y:Math.floor(B-F)}}findMatches(s,d,f){const m=this.tileID.canonical.z<d.canonical.z?1:Math.pow(2,this.tileID.canonical.z-d.canonical.z);for(let b=0;b<s.length;b++){const M=s.get(b);if(M.crossTileID)continue;const P=this._symbolsByKey[M.key];if(!P)continue;const D=this.getScaledCoordinates(M,d);if(P.index){const L=P.index.range(D.x-m,D.y-m,D.x+m,D.y+m).sort();for(const B of L){const F=P.crossTileIDs[B];if(!f[F]){f[F]=!0,M.crossTileID=F;break}}}else if(P.positions)for(let L=0;L<P.positions.length;L++){const B=P.positions[L],F=P.crossTileIDs[L];if(Math.abs(B.x-D.x)<=m&&Math.abs(B.y-D.y)<=m&&!f[F]){f[F]=!0,M.crossTileID=F;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:s})=>s)}}class eu{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Jr{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(s){const d=Math.round((s-this.lng)/360);if(d!==0)for(const f in this.indexes){const m=this.indexes[f],b={};for(const M in m){const P=m[M];P.tileID=P.tileID.unwrapTo(P.tileID.wrap+d),b[P.tileID.key]=P}this.indexes[f]=b}this.lng=s}addBucket(s,d,f){if(this.indexes[s.overscaledZ]&&this.indexes[s.overscaledZ][s.key]){if(this.indexes[s.overscaledZ][s.key].bucketInstanceId===d.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(s.overscaledZ,this.indexes[s.overscaledZ][s.key])}for(let b=0;b<d.symbolInstances.length;b++)d.symbolInstances.get(b).crossTileID=0;this.usedCrossTileIDs[s.overscaledZ]||(this.usedCrossTileIDs[s.overscaledZ]={});const m=this.usedCrossTileIDs[s.overscaledZ];for(const b in this.indexes){const M=this.indexes[b];if(Number(b)>s.overscaledZ)for(const P in M){const D=M[P];D.tileID.isChildOf(s)&&D.findMatches(d.symbolInstances,s,m)}else{const P=M[s.scaledTo(Number(b)).key];P&&P.findMatches(d.symbolInstances,s,m)}}for(let b=0;b<d.symbolInstances.length;b++){const M=d.symbolInstances.get(b);M.crossTileID||(M.crossTileID=f.generate(),m[M.crossTileID]=!0)}return this.indexes[s.overscaledZ]===void 0&&(this.indexes[s.overscaledZ]={}),this.indexes[s.overscaledZ][s.key]=new ti(s,d.symbolInstances,d.bucketInstanceId),!0}removeBucketCrossTileIDs(s,d){for(const f of d.getCrossTileIDsLists())for(const m of f)delete this.usedCrossTileIDs[s][m]}removeStaleBuckets(s){let d=!1;for(const f in this.indexes){const m=this.indexes[f];for(const b in m)s[m[b].bucketInstanceId]||(this.removeBucketCrossTileIDs(f,m[b]),delete m[b],d=!0)}return d}}class Xh{constructor(){this.layerIndexes={},this.crossTileIDs=new eu,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(s,d,f){let m=this.layerIndexes[s.id];m===void 0&&(m=this.layerIndexes[s.id]=new Jr);let b=!1;const M={};m.handleWrapJump(f);for(const P of d){const D=P.getBucket(s);D&&s.id===D.layerIds[0]&&(D.bucketInstanceId||(D.bucketInstanceId=++this.maxBucketInstanceId),m.addBucket(P.tileID,D,this.crossTileIDs)&&(b=!0),M[D.bucketInstanceId]=!0)}return m.removeStaleBuckets(M)&&(b=!0),b}pruneUnusedLayers(s){const d={};s.forEach(f=>{d[f]=!0});for(const f in this.layerIndexes)d[f]||delete this.layerIndexes[f]}}const Qr=(x,s)=>l.t(x,s&&s.filter(d=>d.identifier!=="source.canvas")),Y0=l.aw();class tu extends l.E{constructor(s,d={}){super(),this._rtlPluginLoaded=()=>{for(const f in this.sourceCaches){const m=this.sourceCaches[f].getSource().type;m!=="vector"&&m!=="geojson"||this.sourceCaches[f].reload()}},this.map=s,this.dispatcher=new lt(Xe(),s._getMapId()),this.dispatcher.registerMessageHandler("GG",(f,m)=>this.getGlyphs(f,m)),this.dispatcher.registerMessageHandler("GI",(f,m)=>this.getImages(f,m)),this.imageManager=new ht,this.imageManager.setEventedParent(this),this.glyphManager=new jt(s._requestManager,d.localIdeographFontFamily),this.lineAtlas=new pi(256,512),this.crossTileSymbolIndex=new Xh,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new l.ax,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",l.ay()),zr().on(Be,this._rtlPluginLoaded),this.on("data",f=>{if(f.dataType!=="source"||f.sourceDataType!=="metadata")return;const m=this.sourceCaches[f.sourceId];if(!m)return;const b=m.getSource();if(b&&b.vectorLayerIds)for(const M in this._layers){const P=this._layers[M];P.source===b.id&&this._validateLayer(P)}})}loadURL(s,d={},f){this.fire(new l.k("dataloading",{dataType:"style"})),d.validate=typeof d.validate!="boolean"||d.validate;const m=this.map._requestManager.transformRequest(s,"Style");this._loadStyleRequest=new AbortController;const b=this._loadStyleRequest;l.h(m,this._loadStyleRequest).then(M=>{this._loadStyleRequest=null,this._load(M.data,d,f)}).catch(M=>{this._loadStyleRequest=null,M&&!b.signal.aborted&&this.fire(new l.j(M))})}loadJSON(s,d={},f){this.fire(new l.k("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,E.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,d.validate=d.validate!==!1,this._load(s,d,f)}).catch(()=>{})}loadEmpty(){this.fire(new l.k("dataloading",{dataType:"style"})),this._load(Y0,{validate:!1})}_load(s,d,f){var m;const b=d.transformStyle?d.transformStyle(f,s):s;if(!d.validate||!Qr(this,l.u(b))){this._loaded=!0,this.stylesheet=b;for(const M in b.sources)this.addSource(M,b.sources[M],{validate:!1});b.sprite?this._loadSprite(b.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(b.glyphs),this._createLayers(),this.light=new hn(this.stylesheet.light),this.sky=new bn(this.stylesheet.sky),this.map.setTerrain((m=this.stylesheet.terrain)!==null&&m!==void 0?m:null),this.fire(new l.k("data",{dataType:"style"})),this.fire(new l.k("style.load"))}}_createLayers(){const s=l.az(this.stylesheet.layers);this.dispatcher.broadcast("SL",s),this._order=s.map(d=>d.id),this._layers={},this._serializedLayers=null;for(const d of s){const f=l.aA(d);f.setEventedParent(this,{layer:{id:d.id}}),this._layers[d.id]=f}}_loadSprite(s,d=!1,f=void 0){let m;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(b,M,P,D){return l._(this,void 0,void 0,function*(){const L=Ie(b),B=P>1?"@2x":"",F={},W={};for(const{id:K,url:Q}of L){const re=M.transformRequest(Ye(Q,B,".json"),"SpriteJSON");F[K]=l.h(re,D);const le=M.transformRequest(Ye(Q,B,".png"),"SpriteImage");W[K]=oe.getImage(le,D)}return yield Promise.all([...Object.values(F),...Object.values(W)]),function(K,Q){return l._(this,void 0,void 0,function*(){const re={};for(const le in K){re[le]={};const ce=E.getImageCanvasContext((yield Q[le]).data),he=(yield K[le]).data;for(const te in he){const{width:me,height:ge,x:xe,y:Oe,sdf:Fe,pixelRatio:Ke,stretchX:nt,stretchY:We,content:He,textFitWidth:pt,textFitHeight:Ot}=he[te];re[le][te]={data:null,pixelRatio:Ke,sdf:Fe,stretchX:nt,stretchY:We,content:He,textFitWidth:pt,textFitHeight:Ot,spriteData:{width:me,height:ge,x:xe,y:Oe,context:ce}}}}return re})}(F,W)})}(s,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(b=>{if(this._spriteRequest=null,b)for(const M in b){this._spritesImagesIds[M]=[];const P=this._spritesImagesIds[M]?this._spritesImagesIds[M].filter(D=>!(D in b)):[];for(const D of P)this.imageManager.removeImage(D),this._changedImages[D]=!0;for(const D in b[M]){const L=M==="default"?D:`${M}:${D}`;this._spritesImagesIds[M].push(L),L in this.imageManager.images?this.imageManager.updateImage(L,b[M][D],!1):this.imageManager.addImage(L,b[M][D]),d&&(this._changedImages[L]=!0)}}}).catch(b=>{this._spriteRequest=null,m=b,this.fire(new l.j(m))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),d&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"})),f&&f(m)})}_unloadSprite(){for(const s of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(s),this._changedImages[s]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}_validateLayer(s){const d=this.sourceCaches[s.source];if(!d)return;const f=s.sourceLayer;if(!f)return;const m=d.getSource();(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(f)===-1)&&this.fire(new l.j(new Error(`Source layer "${f}" does not exist on source "${m.id}" as specified by style layer "${s.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const s in this.sourceCaches)if(!this.sourceCaches[s].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(s,d=!1){const f=this._serializedAllLayers();if(!s||s.length===0)return Object.values(d?l.aB(f):f);const m=[];for(const b of s)if(f[b]){const M=d?l.aB(f[b]):f[b];m.push(M)}return m}_serializedAllLayers(){let s=this._serializedLayers;if(s)return s;s=this._serializedLayers={};const d=Object.keys(this._layers);for(const f of d){const m=this._layers[f];m.type!=="custom"&&(s[f]=m.serialize())}return s}hasTransitions(){if(this.light&&this.light.hasTransition()||this.sky&&this.sky.hasTransition())return!0;for(const s in this.sourceCaches)if(this.sourceCaches[s].hasTransition())return!0;for(const s in this._layers)if(this._layers[s].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(s){if(!this._loaded)return;const d=this._changed;if(d){const m=Object.keys(this._updatedLayers),b=Object.keys(this._removedLayers);(m.length||b.length)&&this._updateWorkerLayers(m,b);for(const M in this._updatedSources){const P=this._updatedSources[M];if(P==="reload")this._reloadSource(M);else{if(P!=="clear")throw new Error(`Invalid action ${P}`);this._clearSource(M)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const M in this._updatedPaintProps)this._layers[M].updateTransitions(s);this.light.updateTransitions(s),this.sky.updateTransitions(s),this._resetUpdates()}const f={};for(const m in this.sourceCaches){const b=this.sourceCaches[m];f[m]=b.used,b.used=!1}for(const m of this._order){const b=this._layers[m];b.recalculate(s,this._availableImages),!b.isHidden(s.zoom)&&b.source&&(this.sourceCaches[b.source].used=!0)}for(const m in f){const b=this.sourceCaches[m];!!f[m]!=!!b.used&&b.fire(new l.k("data",{sourceDataType:"visibility",dataType:"source",sourceId:m}))}this.light.recalculate(s),this.sky.recalculate(s),this.z=s.zoom,d&&this.fire(new l.k("data",{dataType:"style"}))}_updateTilesForChangedImages(){const s=Object.keys(this._changedImages);if(s.length){for(const d in this.sourceCaches)this.sourceCaches[d].reloadTilesForDependencies(["icons","patterns"],s);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const s in this.sourceCaches)this.sourceCaches[s].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(s,d){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(s,!1),removedIds:d})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(s,d={}){var f;this._checkLoaded();const m=this.serialize();if(s=d.transformStyle?d.transformStyle(m,s):s,((f=d.validate)===null||f===void 0||f)&&Qr(this,l.u(s)))return!1;(s=l.aB(s)).layers=l.az(s.layers);const b=l.aC(m,s),M=this._getOperationsToPerform(b);if(M.unimplemented.length>0)throw new Error(`Unimplemented: ${M.unimplemented.join(", ")}.`);if(M.operations.length===0)return!1;for(const P of M.operations)P();return this.stylesheet=s,this._serializedLayers=null,!0}_getOperationsToPerform(s){const d=[],f=[];for(const m of s)switch(m.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":continue;case"addLayer":d.push(()=>this.addLayer.apply(this,m.args));break;case"removeLayer":d.push(()=>this.removeLayer.apply(this,m.args));break;case"setPaintProperty":d.push(()=>this.setPaintProperty.apply(this,m.args));break;case"setLayoutProperty":d.push(()=>this.setLayoutProperty.apply(this,m.args));break;case"setFilter":d.push(()=>this.setFilter.apply(this,m.args));break;case"addSource":d.push(()=>this.addSource.apply(this,m.args));break;case"removeSource":d.push(()=>this.removeSource.apply(this,m.args));break;case"setLayerZoomRange":d.push(()=>this.setLayerZoomRange.apply(this,m.args));break;case"setLight":d.push(()=>this.setLight.apply(this,m.args));break;case"setGeoJSONSourceData":d.push(()=>this.setGeoJSONSourceData.apply(this,m.args));break;case"setGlyphs":d.push(()=>this.setGlyphs.apply(this,m.args));break;case"setSprite":d.push(()=>this.setSprite.apply(this,m.args));break;case"setSky":d.push(()=>this.setSky.apply(this,m.args));break;case"setTerrain":d.push(()=>this.map.setTerrain.apply(this,m.args));break;case"setTransition":d.push(()=>{});break;default:f.push(m.command)}return{operations:d,unimplemented:f}}addImage(s,d){if(this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" already exists.`)));this.imageManager.addImage(s,d),this._afterImageUpdated(s)}updateImage(s,d){this.imageManager.updateImage(s,d)}getImage(s){return this.imageManager.getImage(s)}removeImage(s){if(!this.getImage(s))return this.fire(new l.j(new Error(`An image named "${s}" does not exist.`)));this.imageManager.removeImage(s),this._afterImageUpdated(s)}_afterImageUpdated(s){this._availableImages=this.imageManager.listImages(),this._changedImages[s]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(s,d,f={}){if(this._checkLoaded(),this.sourceCaches[s]!==void 0)throw new Error(`Source "${s}" already exists.`);if(!d.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(d).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(d.type)>=0&&this._validate(l.u.source,`sources.${s}`,d,null,f))return;this.map&&this.map._collectResourceTiming&&(d.collectResourceTiming=!0);const m=this.sourceCaches[s]=new Re(s,d,this.dispatcher);m.style=this,m.setEventedParent(this,()=>({isSourceLoaded:m.loaded(),source:m.serialize(),sourceId:s})),m.onAdd(this.map),this._changed=!0}removeSource(s){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error("There is no source with this ID");for(const f in this._layers)if(this._layers[f].source===s)return this.fire(new l.j(new Error(`Source "${s}" cannot be removed while layer "${f}" is using it.`)));const d=this.sourceCaches[s];delete this.sourceCaches[s],delete this._updatedSources[s],d.fire(new l.k("data",{sourceDataType:"metadata",dataType:"source",sourceId:s})),d.setEventedParent(null),d.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(s,d){if(this._checkLoaded(),this.sourceCaches[s]===void 0)throw new Error(`There is no source with this ID=${s}`);const f=this.sourceCaches[s].getSource();if(f.type!=="geojson")throw new Error(`geojsonSource.type is ${f.type}, which is !== 'geojson`);f.setData(d),this._changed=!0}getSource(s){return this.sourceCaches[s]&&this.sourceCaches[s].getSource()}addLayer(s,d,f={}){this._checkLoaded();const m=s.id;if(this.getLayer(m))return void this.fire(new l.j(new Error(`Layer "${m}" already exists on this map.`)));let b;if(s.type==="custom"){if(Qr(this,l.aD(s)))return;b=l.aA(s)}else{if("source"in s&&typeof s.source=="object"&&(this.addSource(m,s.source),s=l.aB(s),s=l.e(s,{source:m})),this._validate(l.u.layer,`layers.${m}`,s,{arrayIndex:-1},f))return;b=l.aA(s),this._validateLayer(b),b.setEventedParent(this,{layer:{id:m}})}const M=d?this._order.indexOf(d):this._order.length;if(d&&M===-1)this.fire(new l.j(new Error(`Cannot add layer "${m}" before non-existing layer "${d}".`)));else{if(this._order.splice(M,0,m),this._layerOrderChanged=!0,this._layers[m]=b,this._removedLayers[m]&&b.source&&b.type!=="custom"){const P=this._removedLayers[m];delete this._removedLayers[m],P.type!==b.type?this._updatedSources[b.source]="clear":(this._updatedSources[b.source]="reload",this.sourceCaches[b.source].pause())}this._updateLayer(b),b.onAdd&&b.onAdd(this.map)}}moveLayer(s,d){if(this._checkLoaded(),this._changed=!0,!this._layers[s])return void this.fire(new l.j(new Error(`The layer '${s}' does not exist in the map's style and cannot be moved.`)));if(s===d)return;const f=this._order.indexOf(s);this._order.splice(f,1);const m=d?this._order.indexOf(d):this._order.length;d&&m===-1?this.fire(new l.j(new Error(`Cannot move layer "${s}" before non-existing layer "${d}".`))):(this._order.splice(m,0,s),this._layerOrderChanged=!0)}removeLayer(s){this._checkLoaded();const d=this._layers[s];if(!d)return void this.fire(new l.j(new Error(`Cannot remove non-existing layer "${s}".`)));d.setEventedParent(null);const f=this._order.indexOf(s);this._order.splice(f,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[s]=d,delete this._layers[s],this._serializedLayers&&delete this._serializedLayers[s],delete this._updatedLayers[s],delete this._updatedPaintProps[s],d.onRemove&&d.onRemove(this.map)}getLayer(s){return this._layers[s]}getLayersOrder(){return[...this._order]}hasLayer(s){return s in this._layers}setLayerZoomRange(s,d,f){this._checkLoaded();const m=this.getLayer(s);m?m.minzoom===d&&m.maxzoom===f||(d!=null&&(m.minzoom=d),f!=null&&(m.maxzoom=f),this._updateLayer(m)):this.fire(new l.j(new Error(`Cannot set the zoom range of non-existing layer "${s}".`)))}setFilter(s,d,f={}){this._checkLoaded();const m=this.getLayer(s);if(m){if(!l.aE(m.filter,d))return d==null?(m.filter=void 0,void this._updateLayer(m)):void(this._validate(l.u.filter,`layers.${m.id}.filter`,d,null,f)||(m.filter=l.aB(d),this._updateLayer(m)))}else this.fire(new l.j(new Error(`Cannot filter non-existing layer "${s}".`)))}getFilter(s){return l.aB(this.getLayer(s).filter)}setLayoutProperty(s,d,f,m={}){this._checkLoaded();const b=this.getLayer(s);b?l.aE(b.getLayoutProperty(d),f)||(b.setLayoutProperty(d,f,m),this._updateLayer(b)):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getLayoutProperty(s,d){const f=this.getLayer(s);if(f)return f.getLayoutProperty(d);this.fire(new l.j(new Error(`Cannot get style of non-existing layer "${s}".`)))}setPaintProperty(s,d,f,m={}){this._checkLoaded();const b=this.getLayer(s);b?l.aE(b.getPaintProperty(d),f)||(b.setPaintProperty(d,f,m)&&this._updateLayer(b),this._changed=!0,this._updatedPaintProps[s]=!0,this._serializedLayers=null):this.fire(new l.j(new Error(`Cannot style non-existing layer "${s}".`)))}getPaintProperty(s,d){return this.getLayer(s).getPaintProperty(d)}setFeatureState(s,d){this._checkLoaded();const f=s.source,m=s.sourceLayer,b=this.sourceCaches[f];if(b===void 0)return void this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)));const M=b.getSource().type;M==="geojson"&&m?this.fire(new l.j(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):M!=="vector"||m?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),b.setFeatureState(m,s.id,d)):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(s,d){this._checkLoaded();const f=s.source,m=this.sourceCaches[f];if(m===void 0)return void this.fire(new l.j(new Error(`The source '${f}' does not exist in the map's style.`)));const b=m.getSource().type,M=b==="vector"?s.sourceLayer:void 0;b!=="vector"||M?d&&typeof s.id!="string"&&typeof s.id!="number"?this.fire(new l.j(new Error("A feature id is required to remove its specific state property."))):m.removeFeatureState(M,s.id,d):this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(s){this._checkLoaded();const d=s.source,f=s.sourceLayer,m=this.sourceCaches[d];if(m!==void 0)return m.getSource().type!=="vector"||f?(s.id===void 0&&this.fire(new l.j(new Error("The feature id parameter must be provided."))),m.getFeatureState(f,s.id)):void this.fire(new l.j(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new l.j(new Error(`The source '${d}' does not exist in the map's style.`)))}getTransition(){return l.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const s=l.aF(this.sourceCaches,b=>b.serialize()),d=this._serializeByIds(this._order,!0),f=this.map.getTerrain()||void 0,m=this.stylesheet;return l.aG({version:m.version,name:m.name,metadata:m.metadata,light:m.light,sky:m.sky,center:m.center,zoom:m.zoom,bearing:m.bearing,pitch:m.pitch,sprite:m.sprite,glyphs:m.glyphs,transition:m.transition,sources:s,layers:d,terrain:f},b=>b!==void 0)}_updateLayer(s){this._updatedLayers[s.id]=!0,s.source&&!this._updatedSources[s.source]&&this.sourceCaches[s.source].getSource().type!=="raster"&&(this._updatedSources[s.source]="reload",this.sourceCaches[s.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(s){const d=M=>this._layers[M].type==="fill-extrusion",f={},m=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P)){f[P]=M;for(const D of s){const L=D[P];if(L)for(const B of L)m.push(B)}}}m.sort((M,P)=>P.intersectionZ-M.intersectionZ);const b=[];for(let M=this._order.length-1;M>=0;M--){const P=this._order[M];if(d(P))for(let D=m.length-1;D>=0;D--){const L=m[D].feature;if(f[L.layer.id]<M)break;b.push(L),m.pop()}else for(const D of s){const L=D[P];if(L)for(const B of L)b.push(B.feature)}}return b}queryRenderedFeatures(s,d,f){d&&d.filter&&this._validate(l.u.filter,"queryRenderedFeatures.filter",d.filter,null,d);const m={};if(d&&d.layers){if(!Array.isArray(d.layers))return this.fire(new l.j(new Error("parameters.layers must be an Array."))),[];for(const P of d.layers){const D=this._layers[P];if(!D)return this.fire(new l.j(new Error(`The layer '${P}' does not exist in the map's style and cannot be queried for features.`))),[];m[D.source]=!0}}const b=[];d.availableImages=this._availableImages;const M=this._serializedAllLayers();for(const P in this.sourceCaches)d.layers&&!m[P]||b.push(Dt(this.sourceCaches[P],this._layers,M,s,d,f));return this.placement&&b.push(function(P,D,L,B,F,W,K){const Q={},re=W.queryRenderedSymbols(B),le=[];for(const ce of Object.keys(re).map(Number))le.push(K[ce]);le.sort(At);for(const ce of le){const he=ce.featureIndex.lookupSymbolFeatures(re[ce.bucketInstanceId],D,ce.bucketIndex,ce.sourceLayerIndex,F.filter,F.layers,F.availableImages,P);for(const te in he){const me=Q[te]=Q[te]||[],ge=he[te];ge.sort((xe,Oe)=>{const Fe=ce.featureSortOrder;if(Fe){const Ke=Fe.indexOf(xe.featureIndex);return Fe.indexOf(Oe.featureIndex)-Ke}return Oe.featureIndex-xe.featureIndex});for(const xe of ge)me.push(xe)}}for(const ce in Q)Q[ce].forEach(he=>{const te=he.feature,me=L[P[ce].source].getFeatureState(te.layer["source-layer"],te.id);te.source=te.layer.source,te.layer["source-layer"]&&(te.sourceLayer=te.layer["source-layer"]),te.state=me});return Q}(this._layers,M,this.sourceCaches,s,d,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(b)}querySourceFeatures(s,d){d&&d.filter&&this._validate(l.u.filter,"querySourceFeatures.filter",d.filter,null,d);const f=this.sourceCaches[s];return f?function(m,b){const M=m.getRenderableIds().map(L=>m.getTileByID(L)),P=[],D={};for(let L=0;L<M.length;L++){const B=M[L],F=B.tileID.canonical.key;D[F]||(D[F]=!0,B.querySourceFeatures(P,b))}return P}(f,d):[]}getLight(){return this.light.getLight()}setLight(s,d={}){this._checkLoaded();const f=this.light.getLight();let m=!1;for(const M in s)if(!l.aE(s[M],f[M])){m=!0;break}if(!m)return;const b={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(s,d),this.light.updateTransitions(b)}getSky(){var s;return(s=this.stylesheet)===null||s===void 0?void 0:s.sky}setSky(s,d={}){const f=this.getSky();let m=!1;if(!s&&!f)return;if(s&&!f)m=!0;else if(!s&&f)m=!0;else for(const M in s)if(!l.aE(s[M],f[M])){m=!0;break}if(!m)return;const b={now:E.now(),transition:l.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=s,this.sky.setSky(s,d),this.sky.updateTransitions(b)}_validate(s,d,f,m,b={}){return(!b||b.validate!==!1)&&Qr(this,s.call(l.u,l.e({key:d,style:this.serialize(),value:f,styleSpec:l.v},m)))}_remove(s=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),zr().off(Be,this._rtlPluginLoaded);for(const d in this._layers)this._layers[d].setEventedParent(null);for(const d in this.sourceCaches){const f=this.sourceCaches[d];f.setEventedParent(null),f.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),s&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(s)}_clearSource(s){this.sourceCaches[s].clearTiles()}_reloadSource(s){this.sourceCaches[s].resume(),this.sourceCaches[s].reload()}_updateSources(s){for(const d in this.sourceCaches)this.sourceCaches[d].update(s,this.map.terrain)}_generateCollisionBoxes(){for(const s in this.sourceCaches)this._reloadSource(s)}_updatePlacement(s,d,f,m,b=!1){let M=!1,P=!1;const D={};for(const L of this._order){const B=this._layers[L];if(B.type!=="symbol")continue;if(!D[B.source]){const W=this.sourceCaches[B.source];D[B.source]=W.getRenderableIds(!0).map(K=>W.getTileByID(K)).sort((K,Q)=>Q.tileID.overscaledZ-K.tileID.overscaledZ||(K.tileID.isLessThan(Q.tileID)?-1:1))}const F=this.crossTileSymbolIndex.addLayer(B,D[B.source],s.center.lng);M=M||F}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((b=b||this._layerOrderChanged||f===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(E.now(),s.zoom))&&(this.pauseablePlacement=new Nl(s,this.map.terrain,this._order,b,d,f,m,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,D),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(E.now()),P=!0),M&&this.pauseablePlacement.placement.setStale()),P||M)for(const L of this._order){const B=this._layers[L];B.type==="symbol"&&this.placement.updateLayerOpacities(B,D[B.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(E.now())}_releaseSymbolFadeTiles(){for(const s in this.sourceCaches)this.sourceCaches[s].releaseSymbolFadeTiles()}getImages(s,d){return l._(this,void 0,void 0,function*(){const f=yield this.imageManager.getImages(d.icons);this._updateTilesForChangedImages();const m=this.sourceCaches[d.source];return m&&m.setDependencies(d.tileID.key,d.type,d.icons),f})}getGlyphs(s,d){return l._(this,void 0,void 0,function*(){const f=yield this.glyphManager.getGlyphs(d.stacks),m=this.sourceCaches[d.source];return m&&m.setDependencies(d.tileID.key,d.type,[""]),f})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(s,d={}){this._checkLoaded(),s&&this._validate(l.u.glyphs,"glyphs",s,null,d)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=s,this.glyphManager.entries={},this.glyphManager.setURL(s))}addSprite(s,d,f={},m){this._checkLoaded();const b=[{id:s,url:d}],M=[...Ie(this.stylesheet.sprite),...b];this._validate(l.u.sprite,"sprite",M,null,f)||(this.stylesheet.sprite=M,this._loadSprite(b,!0,m))}removeSprite(s){this._checkLoaded();const d=Ie(this.stylesheet.sprite);if(d.find(f=>f.id===s)){if(this._spritesImagesIds[s])for(const f of this._spritesImagesIds[s])this.imageManager.removeImage(f),this._changedImages[f]=!0;d.splice(d.findIndex(f=>f.id===s),1),this.stylesheet.sprite=d.length>0?d:void 0,delete this._spritesImagesIds[s],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new l.k("data",{dataType:"style"}))}else this.fire(new l.j(new Error(`Sprite "${s}" doesn't exists on this map.`)))}getSprite(){return Ie(this.stylesheet.sprite)}setSprite(s,d={},f){this._checkLoaded(),s&&this._validate(l.u.sprite,"sprite",s,null,d)||(this.stylesheet.sprite=s,s?this._loadSprite(s,!0,f):(this._unloadSprite(),f&&f(null)))}}var $o=l.Y([{name:"a_pos",type:"Int16",components:2}]);const uo={prelude:pn(`#ifdef GL_ES
50
50
  precision mediump float;
51
51
  #else
52
52
  #if !defined(lowp)
@@ -738,4 +738,4 @@ img.ProseMirror-separator {
738
738
 
739
739
  `);return!a||!u?!1:t.chain().command(({tr:l})=>(l.delete(i.pos-2,i.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:i}=e,{$from:r,empty:a}=n;if(!a||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:i.nodeAt(l)?t.commands.command(({tr:_})=>(_.setSelection(Gt.near(i.resolve(l))),!0)):t.commands.exitCode()}}},addInputRules(){return[E0({find:AF,type:this.type,getAttributes:t=>({language:t[1]})}),E0({find:PF,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Fi({key:new Mr("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),i=e.clipboardData.getData("vscode-editor-data"),r=i?JSON.parse(i):void 0,a=r==null?void 0:r.mode;if(!n||!a)return!1;const{tr:u,schema:l}=t.state,g=l.text(n.replace(/\r\n?/g,`
740
740
  `));return u.replaceSelectionWith(this.type.create({language:a},g)),u.selection.$from.parent.type!==this.type&&u.setSelection(Vt.near(u.doc.resolve(Math.max(0,u.selection.from-2)))),u.setMeta("paste",!0),t.dispatch(u),!0}}})]}}),IF=xs.create({name:"doc",topNode:!0,content:"block+"});function DF(t={}){return new Fi({view(e){return new OF(e,t)}})}class OF{constructor(e,n){var i;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(i=n.width)!==null&&i!==void 0?i:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let a=u=>{this[r](u)};return e.dom.addEventListener(r,a),{name:r,handler:a}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,i;if(n){let l=e.nodeBefore,g=e.nodeAfter;if(l||g){let _=this.editorView.nodeDOM(this.cursorPos-(l?l.nodeSize:0));if(_){let k=_.getBoundingClientRect(),E=l?k.bottom:k.top;l&&g&&(E=(E+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),i={left:k.left,right:k.right,top:E-this.width/2,bottom:E+this.width/2}}}}if(!i){let l=this.editorView.coordsAtPos(this.cursorPos);i={left:l.left-this.width/2,right:l.left+this.width/2,top:l.top,bottom:l.bottom}}let r=this.editorView.dom.offsetParent;this.element||(this.element=r.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let a,u;if(!r||r==document.body&&getComputedStyle(r).position=="static")a=-pageXOffset,u=-pageYOffset;else{let l=r.getBoundingClientRect();a=l.left-r.scrollLeft,u=l.top-r.scrollTop}this.element.style.left=i.left-a+"px",this.element.style.top=i.top-u+"px",this.element.style.width=i.right-i.left+"px",this.element.style.height=i.bottom-i.top+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),i=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),r=i&&i.type.spec.disableDropCursor,a=typeof r=="function"?r(this.editorView,n,e):r;if(n&&!a){let u=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=mw(this.editorView.state.doc,u,this.editorView.dragging.slice);l!=null&&(u=l)}this.setCursor(u),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){(e.target==this.editorView.dom||!this.editorView.dom.contains(e.relatedTarget))&&this.setCursor(null)}}const zF=ji.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[DF(this.options)]}});class ii extends Gt{constructor(e){super(e,e)}map(e,n){let i=e.resolve(n.map(this.head));return ii.valid(i)?new ii(i):Gt.near(i)}content(){return ut.empty}eq(e){return e instanceof ii&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ii(e.resolve(n.pos))}getBookmark(){return new H0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!RF(e)||!LF(e))return!1;let i=n.type.spec.allowGapCursor;if(i!=null)return i;let r=n.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,n,i=!1){e:for(;;){if(!i&&ii.valid(e))return e;let r=e.pos,a=null;for(let u=e.depth;;u--){let l=e.node(u);if(n>0?e.indexAfter(u)<l.childCount:e.index(u)>0){a=l.child(n>0?e.indexAfter(u):e.index(u)-1);break}else if(u==0)return null;r+=n;let g=e.doc.resolve(r);if(ii.valid(g))return g}for(;;){let u=n>0?a.firstChild:a.lastChild;if(!u){if(a.isAtom&&!a.isText&&!zt.isSelectable(a)){e=e.doc.resolve(r+a.nodeSize*n),i=!1;continue e}break}a=u,r+=n;let l=e.doc.resolve(r);if(ii.valid(l))return l}return null}}}ii.prototype.visible=!1,ii.findFrom=ii.findGapCursorFrom,Gt.jsonID("gapcursor",ii);class H0{constructor(e){this.pos=e}map(e){return new H0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return ii.valid(n)?new ii(n):Gt.near(n)}}function RF(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),i=t.node(e);if(n==0){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function LF(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),i=t.node(e);if(n==i.childCount){if(i.type.spec.isolating)return!0;continue}for(let r=i.child(n);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||r.isAtom||r.type.spec.isolating)return!0;if(r.inlineContent)return!1}}return!0}function NF(){return new Fi({props:{decorations:$F,createSelectionBetween(t,e,n){return e.pos==n.pos&&ii.valid(n)?new ii(n):null},handleClick:FF,handleKeyDown:BF,handleDOMEvents:{beforeinput:VF}}})}const BF=$k({ArrowLeft:Hf("horiz",-1),ArrowRight:Hf("horiz",1),ArrowUp:Hf("vert",-1),ArrowDown:Hf("vert",1)});function Hf(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(i,r,a){let u=i.selection,l=e>0?u.$to:u.$from,g=u.empty;if(u instanceof Vt){if(!a.endOfTextblock(n)||l.depth==0)return!1;g=!1,l=i.doc.resolve(e>0?l.after():l.before())}let _=ii.findGapCursorFrom(l,e,g);return _?(r&&r(i.tr.setSelection(new ii(_))),!0):!1}}function FF(t,e,n){if(!t||!t.editable)return!1;let i=t.state.doc.resolve(e);if(!ii.valid(i))return!1;let r=t.posAtCoords({left:n.clientX,top:n.clientY});return r&&r.inside>-1&&zt.isSelectable(t.state.doc.nodeAt(r.inside))?!1:(t.dispatch(t.state.tr.setSelection(new ii(i))),!0)}function VF(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof ii))return!1;let{$from:n}=t.state.selection,i=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!i)return!1;let r=Ve.empty;for(let u=i.length-1;u>=0;u--)r=Ve.from(i[u].createAndFill(null,r));let a=t.state.tr.replace(n.pos,n.pos,new ut(r,0,0));return a.setSelection(Vt.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function $F(t){if(!(t.selection instanceof ii))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",hi.create(t.doc,[Gr.widget(t.selection.head,e,{key:"gapcursor"})])}const jF=ji.create({name:"gapCursor",addProseMirrorPlugins(){return[NF()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=tn(vt(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),UF=xs.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",di(this.options.HTMLAttributes,t)]},renderText(){return`
741
- `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:i})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:a}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:u}=this.options,{splittableMarks:l}=i.extensionManager,g=a||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:_,dispatch:k})=>{if(k&&g&&u){const E=g.filter(T=>l.includes(T.type.name));_.ensureMarks(E)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),HF=xs.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,di(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>E0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var qf=200,Ai=function(){};Ai.prototype.append=function(e){return e.length?(e=Ai.from(e),!this.length&&e||e.length<qf&&this.leafAppend(e)||this.length<qf&&e.leafPrepend(this)||this.appendInner(e)):this},Ai.prototype.prepend=function(e){return e.length?Ai.from(e).append(this):this},Ai.prototype.appendInner=function(e){return new qF(this,e)},Ai.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ai.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ai.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ai.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)},Ai.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(a,u){return r.push(e(a,u))},n,i),r},Ai.from=function(e){return e instanceof Ai?e:e&&e.length?new nS(e):Ai.empty};var nS=function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new e(this.values.slice(r,a))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,a,u,l){for(var g=a;g<u;g++)if(r(this.values[g],l+g)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,u,l){for(var g=a-1;g>=u;g--)if(r(this.values[g],l+g)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=qf)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=qf)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ai);Ai.empty=new nS([]);var qF=function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,a,u){var l=this.left.length;if(r<l&&this.left.forEachInner(i,r,Math.min(a,l),u)===!1||a>l&&this.right.forEachInner(i,Math.max(r-l,0),Math.min(this.length,a)-l,u+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,a,u){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(i,r-l,Math.max(a,l)-l,u+l)===!1||a<l&&this.left.forEachInvertedInner(i,Math.min(r,l),a,u)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(i,r):i>=a?this.right.slice(i-a,r-a):this.left.slice(i,a).append(this.right.slice(0,r-a))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e}(Ai);const WF=500;class Us{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let u=e.tr,l,g,_=[],k=[];return this.items.forEach((E,T)=>{if(!E.step){r||(r=this.remapping(i,T+1),a=r.maps.length),a--,k.push(E);return}if(r){k.push(new co(E.map));let I=E.step.map(r.slice(a)),z;I&&u.maybeStep(I).doc&&(z=u.mapping.maps[u.mapping.maps.length-1],_.push(new co(z,void 0,void 0,_.length+k.length))),a--,z&&r.appendMap(z,a)}else u.maybeStep(E.step);if(E.selection)return l=r?E.selection.map(r.slice(a)):E.selection,g=new Us(this.items.slice(0,i).append(k.reverse().concat(_)),this.eventCount-1),!1},this.items.length,0),{remaining:g,transform:u,selection:l}}addTransform(e,n,i,r){let a=[],u=this.eventCount,l=this.items,g=!r&&l.length?l.get(l.length-1):null;for(let k=0;k<e.steps.length;k++){let E=e.steps[k].invert(e.docs[k]),T=new co(e.mapping.maps[k],E,n),I;(I=g&&g.merge(T))&&(T=I,k?a.pop():l=l.slice(0,l.length-1)),a.push(T),n&&(u++,n=void 0),r||(g=T)}let _=u-i.depth;return _>ZF&&(l=GF(l,_),u-=_),new Us(l.append(a),u)}remapping(e,n){let i=new Pc;return this.items.forEach((r,a)=>{let u=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,u)},e,n),i}addMaps(e){return this.eventCount==0?this:new Us(this.items.append(e.map(n=>new co(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-n),a=e.mapping,u=e.steps.length,l=this.eventCount;this.items.forEach(T=>{T.selection&&l--},r);let g=n;this.items.forEach(T=>{let I=a.getMirror(--g);if(I==null)return;u=Math.min(u,I);let z=a.maps[I];if(T.step){let V=e.steps[I].invert(e.docs[I]),H=T.selection&&T.selection.map(a.slice(g+1,I));H&&l++,i.push(new co(z,V,H))}else i.push(new co(z))},r);let _=[];for(let T=n;T<u;T++)_.push(new co(a.maps[T]));let k=this.items.slice(0,r).append(_).append(i),E=new Us(k,l);return E.emptyItemCount()>WF&&(E=E.compress(this.items.length-i.length)),E}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,r=[],a=0;return this.items.forEach((u,l)=>{if(l>=e)r.push(u),u.selection&&a++;else if(u.step){let g=u.step.map(n.slice(i)),_=g&&g.getMap();if(i--,_&&n.appendMap(_,i),g){let k=u.selection&&u.selection.map(n.slice(i));k&&a++;let E=new co(_.invert(),g,k),T,I=r.length-1;(T=r.length&&r[I].merge(E))?r[I]=T:r.push(E)}}else u.map&&i--},this.items.length,0),new Us(Ai.from(r.reverse()),a)}}Us.empty=new Us(Ai.empty,0);function GF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class co{constructor(e,n,i,r){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new co(n.getMap().invert(),n,this.selection)}}}class Ta{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const ZF=20;function YF(t,e,n,i){let r=n.getMeta(Ll),a;if(r)return r.historyState;n.getMeta(JF)&&(t=new Ta(t.done,t.undone,null,0,-1));let u=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(u&&u.getMeta(Ll))return u.getMeta(Ll).redo?new Ta(t.done.addTransform(n,void 0,i,Wf(e)),t.undone,iS(n.mapping.maps),t.prevTime,t.prevComposition):new Ta(t.done,t.undone.addTransform(n,void 0,i,Wf(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(u&&u.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),g=t.prevTime==0||!u&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-i.newGroupDelay||!XF(n,t.prevRanges)),_=u?q0(t.prevRanges,n.mapping):iS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Wf(e)),Us.empty,_,n.time,l??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Ta(t.done.rebased(n,a),t.undone.rebased(n,a),q0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),q0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function XF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,r)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function iS(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,r,a,u)=>e.push(a,u));return e}function q0(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let r=e.map(t[i],1),a=e.map(t[i+1],-1);r<=a&&n.push(r,a)}return n}function KF(t,e,n){let i=Wf(e),r=Ll.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,i);if(!a)return null;let u=a.selection.resolve(a.transform.doc),l=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,i),g=new Ta(n?l:a.remaining,n?a.remaining:l,null,0,-1);return a.transform.setSelection(u).setMeta(Ll,{redo:n,historyState:g})}let W0=!1,rS=null;function Wf(t){let e=t.plugins;if(rS!=e){W0=!1,rS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){W0=!0;break}}return W0}const Ll=new Mr("history"),JF=new Mr("closeHistory");function QF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Fi({key:Ll,state:{init(){return new Ta(Us.empty,Us.empty,null,0,-1)},apply(e,n,i){return YF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?oS:i=="historyRedo"?aS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function sS(t,e){return(n,i)=>{let r=Ll.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=KF(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const oS=sS(!1,!0),aS=sS(!0,!0),eV=ji.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>oS(t,e),redo:()=>({state:t,dispatch:e})=>aS(t,e)}},addProseMirrorPlugins(){return[QF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),tV=xs.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",di(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:i,$to:r}=n,a=t();return i.parentOffset===0?a.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},{type:this.name}):l2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:u,dispatch:l})=>{var g;if(l){const{$to:_}=u.selection,k=_.end();if(_.nodeAfter)_.nodeAfter.isTextblock?u.setSelection(Vt.create(u.doc,_.pos+1)):_.nodeAfter.isBlock?u.setSelection(zt.create(u.doc,_.pos)):u.setSelection(Vt.create(u.doc,_.pos));else{const E=(g=_.parent.type.contentMatch.defaultType)===null||g===void 0?void 0:g.create();E&&(u.insert(k,E),u.setSelection(Vt.create(u.doc,k+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[O5({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),nV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,iV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,rV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,sV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,oV=Lo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[qc({find:nV,type:this.type}),qc({find:rV,type:this.type})]},addPasteRules(){return[Wc({find:iV,type:this.type}),Wc({find:sV,type:this.type})]}}),lS=/^(\d+)\.\s$/,aV=xs.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",di(this.options.HTMLAttributes,n),0]:["ol",di(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(U0.name,this.editor.getAttributes(Uf.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Nh({find:lS,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Nh({find:lS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Uf.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),lV=xs.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,uV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,hV=Lo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[qc({find:cV,type:this.type})]},addPasteRules(){return[Wc({find:uV,type:this.type})]}}),dV=xs.create({name:"text",group:"inline"}),pV=ji.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,_,k,E,T,I,z,V,H,Z;const ee=[];return this.options.bold!==!1&&ee.push(SF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&ee.push(bF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&ee.push(EF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&ee.push(MF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&ee.push(tS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&ee.push(IF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&ee.push(zF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&ee.push(jF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&ee.push(UF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&ee.push(HF.configure((_=this.options)===null||_===void 0?void 0:_.heading)),this.options.history!==!1&&ee.push(eV.configure((k=this.options)===null||k===void 0?void 0:k.history)),this.options.horizontalRule!==!1&&ee.push(tV.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&ee.push(oV.configure((T=this.options)===null||T===void 0?void 0:T.italic)),this.options.listItem!==!1&&ee.push(U0.configure((I=this.options)===null||I===void 0?void 0:I.listItem)),this.options.orderedList!==!1&&ee.push(aV.configure((z=this.options)===null||z===void 0?void 0:z.orderedList)),this.options.paragraph!==!1&&ee.push(lV.configure((V=this.options)===null||V===void 0?void 0:V.paragraph)),this.options.strike!==!1&&ee.push(hV.configure((H=this.options)===null||H===void 0?void 0:H.strike)),this.options.text!==!1&&ee.push(dV.configure((Z=this.options)===null||Z===void 0?void 0:Z.text)),ee}});function fV(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=z5(n),g=new RegExp(`\\s${l}$`),_=a?"^":"",k=i?new RegExp(`${_}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${_}(?:^)?${l}[^\\s${l}]*`,"gm"),E=((e=u.nodeBefore)===null||e===void 0?void 0:e.isText)&&u.nodeBefore.text;if(!E)return null;const T=u.pos-E.length,I=Array.from(E.matchAll(k)).pop();if(!I||I.input===void 0||I.index===void 0)return null;const z=I.input.slice(Math.max(0,I.index-1),I.index),V=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(z);if(r!==null&&!V)return null;const H=T+I.index;let Z=H+I[0].length;return i&&g.test(E.slice(Z-1,Z+1))&&(I[0]+=" ",Z+=1),H<u.pos&&Z>=u.pos?{range:{from:H,to:Z},query:I[0].slice(n.length),text:I[0]}:null}const mV=new Mr("suggestion");function gV({pluginKey:t=mV,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:_=()=>[],render:k=()=>({}),allow:E=()=>!0,findSuggestionMatch:T=fV}){let I;const z=k==null?void 0:k(),V=new Fi({key:t,view(){return{update:async(H,Z)=>{var ee,oe,J,Ae,ke,Me,Le;const Ie=(ee=this.key)===null||ee===void 0?void 0:ee.getState(Z),Ye=(oe=this.key)===null||oe===void 0?void 0:oe.getState(H.state),it=Ie.active&&Ye.active&&Ie.range.from!==Ye.range.from,Nt=!Ie.active&&Ye.active,ht=Ie.active&&!Ye.active,Rt=!Nt&&!ht&&Ie.query!==Ye.query,Xt=Nt||it&&Rt,nn=Rt||it,jt=ht||it&&Rt;if(!Xt&&!nn&&!jt)return;const Mt=jt&&!Xt?Ie:Ye,Sn=H.dom.querySelector(`[data-decoration-id="${Mt.decorationId}"]`);I={editor:e,range:Mt.range,query:Mt.query,text:Mt.text,items:[],command:hn=>g({editor:e,range:Mt.range,props:hn}),decorationNode:Sn,clientRect:Sn?()=>{var hn;const{decorationId:In}=(hn=this.key)===null||hn===void 0?void 0:hn.getState(e.state),bn=H.dom.querySelector(`[data-decoration-id="${In}"]`);return(bn==null?void 0:bn.getBoundingClientRect())||null}:null},Xt&&((J=z==null?void 0:z.onBeforeStart)===null||J===void 0||J.call(z,I)),nn&&((Ae=z==null?void 0:z.onBeforeUpdate)===null||Ae===void 0||Ae.call(z,I)),(nn||Xt)&&(I.items=await _({editor:e,query:Mt.query})),jt&&((ke=z==null?void 0:z.onExit)===null||ke===void 0||ke.call(z,I)),nn&&((Me=z==null?void 0:z.onUpdate)===null||Me===void 0||Me.call(z,I)),Xt&&((Le=z==null?void 0:z.onStart)===null||Le===void 0||Le.call(z,I))},destroy:()=>{var H;I&&((H=z==null?void 0:z.onExit)===null||H===void 0||H.call(z,I))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(H,Z,ee,oe){const{isEditable:J}=e,{composing:Ae}=e.view,{selection:ke}=H,{empty:Me,from:Le}=ke,Ie={...Z};if(Ie.composing=Ae,J&&(Me||e.view.composing)){(Le<Z.range.from||Le>Z.range.to)&&!Ae&&!Z.composing&&(Ie.active=!1);const Ye=T({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:ke.$from}),it=`id_${Math.floor(Math.random()*4294967295)}`;Ye&&E({editor:e,state:oe,range:Ye.range,isActive:Z.active})?(Ie.active=!0,Ie.decorationId=Z.decorationId?Z.decorationId:it,Ie.range=Ye.range,Ie.query=Ye.query,Ie.text=Ye.text):Ie.active=!1}else Ie.active=!1;return Ie.active||(Ie.decorationId=null,Ie.range={from:0,to:0},Ie.query=null,Ie.text=null),Ie}},props:{handleKeyDown(H,Z){var ee;const{active:oe,range:J}=V.getState(H.state);return oe&&((ee=z==null?void 0:z.onKeyDown)===null||ee===void 0?void 0:ee.call(z,{view:H,event:Z,range:J}))||!1},decorations(H){const{active:Z,range:ee,decorationId:oe}=V.getState(H);return Z?hi.create(H.doc,[Gr.inline(ee.from,ee.to,{nodeName:u,class:l,"data-decoration-id":oe})]):null}}});return V}const yV=new Mr("mention"),_V=xs.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",di(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:yV,command:({editor:t,range:e,props:n})=>{var i,r,a;const u=t.view.state.selection.$to.nodeAfter;((i=u==null?void 0:u.text)===null||i===void 0?void 0:i.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(a=(r=t.view.dom.ownerDocument.defaultView)===null||r===void 0?void 0:r.getSelection())===null||a===void 0||a.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),i=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(i)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",di({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=di({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:n,node:t});return typeof i=="string"?["span",di({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:i}=e,{empty:r,anchor:a}=i;return r?(e.doc.nodesBetween(a-1,a,(u,l)=>{if(u.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",l,l+u.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[gV({editor:this.editor,...this.options.suggestion})]}}),bV={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function xV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBlockquote&&a.toggleBlockquote(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[S.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)]))}const vV=_t(bV,[["render",xV]]),wV={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function kV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBulletList&&a.toggleBulletList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const SV=_t(wV,[["render",kV]]),EV={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function CV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleOrderedList&&a.toggleOrderedList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)]))}const TV=_t(EV,[["render",CV]]),MV={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function AV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleCodeBlock&&a.toggleCodeBlock(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)]))}const PV=_t(MV,[["render",AV]]),IV={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function DV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBold&&a.toggleBold(...u)),class:"p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),S.createElementVNode("span",{class:"sr-only"},"Bold",-1)]))}const OV=_t(IV,[["render",DV]]),zV={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function RV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleItalic&&a.toggleItalic(...u)),class:"p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),S.createElementVNode("span",{class:"sr-only"},"Italic",-1)]))}const LV={bold:OV,italic:_t(zV,[["render",RV]]),bullet_list:SV,ordered_list:TV,blockquote:vV,codeblock:PV},NV={components:{EditorContent:yF},props:{controls:{type:Array,default:()=>["bold","italic","blockquote","bullet_list","ordered_list","codeblock"]},options:{type:Array,default:()=>[]},modelValue:{type:String,default:()=>""}},data(){return{editor:null}},computed:{controlsList(){return Object.entries(LV).filter(([t])=>this.controls.includes(t)).map(([t,e])=>e)}},watch:{modelValue(t){this.editor&&this.editor.getHTML()!==t&&this.editor.commands.setContent(t)},editor(t){t&&this.editor.on("update",({editor:e})=>{const n=e.getHTML();n!==this.modelValue&&this.$emit("update:modelValue",n)})}},mounted(){this.editor&&this.editor.destroy(),this.initEditor()},beforeDestroy(){this.editor&&this.editor.destroy()},methods:{initEditor(){this.editor=new gF({content:this.modelValue,extensions:[pV,tS,_V.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:t})=>{const e=this.options.filter(n=>{var i,r;return(r=(i=n==null?void 0:n.email)==null?void 0:i.toLowerCase())==null?void 0:r.includes(t==null?void 0:t.toLowerCase())}).slice(0,5);return e.length?e:[{id:null,text:"Данні відсутні",email:null}]},render:()=>{let t,e;return{onStart:n=>{t=document.createElement("div"),t.className="mention-popup",n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)}),document.body.appendChild(t);const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.position="absolute",t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`,e=t},onUpdate:n=>{for(;t.firstChild;)t.removeChild(t.firstChild);n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)});const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`},onExit:()=>{e&&e.remove()}}}}})]})}}},BV={class:"editor-container w-full border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},FV={class:"editor-toolbar px-3 py-2 border-b dark:border-gray-600 flex items-center gap-2"},VV={class:"editor-content px-4 py-2 bg-white rounded-b-lg dark:bg-gray-800 relative"};function $V(t,e,n,i,r,a){const u=S.resolveComponent("EditorContent");return S.openBlock(),S.createElementBlock("div",BV,[S.createElementVNode("div",FV,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(a.controlsList,(l,g)=>(S.openBlock(),S.createBlock(S.resolveDynamicComponent(l),{key:g,editor:r.editor},null,8,["editor"]))),128))]),S.createElementVNode("div",VV,[S.createVNode(u,{editor:r.editor,class:"relative"},null,8,["editor"])])])}const cS=_t(NV,[["render",$V]]),jV=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},UV={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return jV(this.name)}}},HV={class:"mr-2"},qV=["src"],WV={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},GV={key:0},ZV={key:1,class:"text-sm"};function YV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",HV,[n.avatar?(S.openBlock(),S.createElementBlock("img",{key:0,src:n.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,qV)):n.name?(S.openBlock(),S.createElementBlock("div",WV,[a.inItials.length?(S.openBlock(),S.createElementBlock("span",GV,S.toDisplayString(a.inItials),1)):(S.openBlock(),S.createElementBlock("span",ZV,e[0]||(e[0]=[S.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):S.createCommentVNode("",!0)])}const XV={components:{VsWidgetCommentsAvatar:_t(UV,[["render",YV]]),VsTextEditor:cS},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""},options:Array},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const t=at(this.comment.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(t){t&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await wt.post(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isOpen=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async deleteComment(){try{await wt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},KV={class:"p-6 text-base bg-white dark:bg-gray-900"},JV={class:"flex justify-between items-center mb-2"},QV={class:"flex items-center"},e6={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},t6={class:"text-sm text-gray-600 dark:text-gray-400"},n6=["innerHTML"],i6={class:"flex items-center gap-[4px]"},r6={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},s6={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function o6(t,e,n,i,r,a){const u=S.resolveComponent("VsWidgetCommentsAvatar"),l=S.resolveComponent("VsTextEditor"),g=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("div",KV,[S.createElementVNode("div",JV,[S.createElementVNode("div",QV,[S.createElementVNode("p",e6,[S.createVNode(u,{name:n.comment.username,avatar:n.comment.avatar},null,8,["name","avatar"]),S.createTextVNode(S.toDisplayString(n.comment.username),1)]),S.createElementVNode("div",t6,S.toDisplayString(a.createDate),1)])]),S.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,n6),S.createElementVNode("div",i6,[S.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[0]||(e[0]=_=>r.isOpen=!0)}," Редагувати "),S.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[1]||(e[1]=_=>a.confirnDeleteComment())}," Видалити ")])]),S.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=_=>r.isOpen=_),title:"Редагувати",size:"small"},{footer:S.withCtx(()=>[S.createElementVNode("div",s6,[S.createElementVNode("button",{onClick:e[3]||(e[3]=_=>r.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),S.createElementVNode("button",{onClick:e[4]||(e[4]=(..._)=>a.updateComment&&a.updateComment(..._)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:S.withCtx(()=>[S.createElementVNode("div",r6,[e[6]||(e[6]=S.createTextVNode(" Коментар ")),S.createVNode(l,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=_=>r.textareaValue=_),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const a6={components:{VsWidgetCommentsItem:_t(XV,[["render",o6]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null},options:Array},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:t}=await wt.get(`/api/widget/comment/${this.id}`);this.comments=t.rows,this.user=t.user}catch(t){this.isLoadFailed=!0,console.error(t)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},l6={class:"flex flex-col divide-y"},c6={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},u6={key:1},h6={class:"p-4"},d6={class:"mt-1 text-gray-500 dark:text-neutral-500"},p6={class:"mt-4 flex justify-end gap-x-3"};function f6(t,e,n,i,r,a){const u=S.resolveComponent("VsErrorOnLoading"),l=S.resolveComponent("VsWidgetCommentsItem"),g=S.resolveComponent("VsLoader"),_=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock("div",l6,[r.isLoaded?(S.openBlock(),S.createElementBlock(S.Fragment,{key:0},[r.isLoadFailed?(S.openBlock(),S.createBlock(u,{key:0})):(S.openBlock(),S.createElementBlock(S.Fragment,{key:1},[r.comments.length?(S.openBlock(),S.createElementBlock("div",c6,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(r.comments,(k,E)=>(S.openBlock(),S.createBlock(l,{key:E,comment:k,user:r.user,options:n.options,index:E,id:n.id,onListUpdate:a.getComments,class:"border-top",onOpenModal:e[0]||(e[0]=T=>a.handleOpenModal(T))},null,8,["comment","user","options","index","id","onListUpdate"]))),128))])):(S.openBlock(),S.createElementBlock("div",u6,e[4]||(e[4]=[S.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"}," Коментарі відсутні ",-1)])))],64))],64)):(S.openBlock(),S.createBlock(g,{key:1,class:"justify-center",text:"Please wait..."})),S.createVNode(_,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[3]||(e[3]=k=>r.isModalVisible=k)},{default:S.withCtx(()=>[S.createElementVNode("div",h6,[S.createElementVNode("p",d6,S.toDisplayString(r.modal.message),1),S.createElementVNode("div",p6,[S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=(...k)=>r.modal.cancel&&r.modal.cancel(...k))},S.toDisplayString(r.modal.cancelButtonText),1),S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...k)=>r.modal.confirm&&r.modal.confirm(...k))},S.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const m6=_t(a6,[["render",f6]]),g6={components:{VsTextEditor:cS},props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0},options:Array},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await wt.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(t){console.error(t)}},setNewContent(t){this.commentContent=t}}},y6={class:"w-full widget-comment-form"},_6={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},b6={class:"flex justify-end"};function x6(t,e,n,i,r,a){const u=S.resolveComponent("VsTextEditor");return S.openBlock(),S.createElementBlock("div",y6,[S.createElementVNode("div",_6,[S.createVNode(u,{modelValue:r.commentContent,"onUpdate:modelValue":e[0]||(e[0]=l=>r.commentContent=l),options:n.options},null,8,["modelValue","options"])]),S.createElementVNode("div",b6,[S.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300",onClick:e[1]||(e[1]=(...l)=>a.addNewComment&&a.addNewComment(...l))}," Відправити коментар ",512)])])}const v6={components:{VsWidgetCommentsList:m6,VsWidgetCommentsAddForm:_t(g6,[["render",x6]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0",options:[]}},mounted(){this.comments=this.$refs.commentListRef.comments,this.getUsersList()},watch:{comments(t){this.$emit("count-change",t.length)}},methods:{async getUsersList(){try{const{data:t}=await wt.get("/api/suggest/core.user_mentioned");this.options=t}catch(t){console.log(t)}},listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},w6={class:"bg-white-200"};function k6(t,e,n,i,r,a){const u=S.resolveComponent("VsWidgetCommentsAddForm"),l=S.resolveComponent("VsWidgetCommentsList");return S.openBlock(),S.createElementBlock("div",w6,[e[2]||(e[2]=S.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),S.createVNode(u,{options:r.options,class:"mb-6",id:n.id,onListUpdate:e[0]||(e[0]=g=>a.listUpdate())},null,8,["options","id"]),S.createVNode(l,{options:r.options,id:n.id,onUpdateCommentCount:e[1]||(e[1]=g=>a.updateCommentCount()),"prefilled-data":n.prefilledData,ref:"commentListRef"},null,8,["options","id","prefilled-data"])])}const S6=_t(v6,[["render",k6]]),uS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),E6=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),C6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},T6=S.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return C6(this.username)}}}),M6={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function A6(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",M6,S.toDisplayString(t.inItials),1)}const P6=_t(T6,[["render",A6]]),G0={load(){try{const t=Array.from(arguments);window.headLoadedFiles||(window.headLoadedFiles=[]);const e=typeof arguments[arguments.length-1]=="function"?arguments[arguments.length-1]:null,n=t.filter(i=>typeof i!="function").reduce((i,r)=>i.concat(r),[]).filter(i=>i&&!window.headLoadedFiles[i.url||i.split("?")[0]]);Promise.all(n.map(i=>this.loadFile1(i))).then(()=>{e&&e()})}catch(t){console.log(t)}},promise(t){return new Promise((e,n)=>{G0.load(t,()=>{e()})})},loadFile1(t){let e=!1;typeof t=="object"&&(e=t.type,t=t.url);const n=t.split("?")[0];return new Promise((i,r)=>{function a(l){delete window.headLoadedFiles[`_${n}`],window.headLoadedFiles[n]=l.type,i(l.type)}let u;window.headLoadedFiles[`_${n}`]?u=window.headLoadedFiles[`_${n}`]:(n.includes(".css")?(u=document.createElement("link"),u.href=t,u.type="text/css",u.rel="stylesheet"):(u=document.createElement("script"),u.type="text/javascript",u.src=t,e&&(u.type=e)),window.headLoadedFiles[`_${n}`]=u,document.head.appendChild(u)),u.addEventListener("load",a),u.addEventListener("error",a)})}},I6={props:{point:{type:String,default:()=>""}},data(){return{zoom:18}},computed:{parsedPoint(){return JSON.parse(this.point)},tooltipText(){return this.parsedPoint.coordinates.join(", ")},coordinates(){return[...this.parsedPoint.coordinates].reverse()}},async mounted(){typeof window>"u"||(window!=null&&window.L||(await G0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await G0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js")),this.initMap())},methods:{initMap(){const t=window.L.map("map",{center:this.coordinates,zoom:this.zoom});window.L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(t),window.L.circle(this.coordinates,{color:"red",fillColor:"red",fillOpacity:.2,radius:10}).addTo(t).bindTooltip(this.tooltipText)}}},D6={id:"map",style:{height:"9rem",width:"24rem"}};function O6(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",D6)}const z6=_t(I6,[["render",O6]]),R6=S.defineComponent({components:{VsWidgetHistoryItemAvatar:P6,VsWidgetHistoryItemMap:z6},props:{item:{type:Object,default:()=>{}}},methods:{getTitle(t){return t.title||t.attr},getOldValue(t){return t.old||"Не вказано"},getNewValue(t){return t.new||"Не вказано"},getDate(t){return E6(t.cdate)}}}),L6={class:"relative [&_p]:m-0"},N6={class:"flex items-center gap-3"},B6={class:"w-full flex justify-between"},F6={class:"text-gray-500"},V6={class:"text-gray-800 font-medium"},$6={class:"text-gray-500 text-sm"},j6={class:"mt-2 pl-10"},U6={key:0},H6={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},q6={class:"font-medium"},W6={class:"font-medium"};function G6(t,e,n,i,r,a){const u=S.resolveComponent("VsWidgetHistoryItemAvatar"),l=S.resolveComponent("VsWidgetHistoryItemMap");return S.openBlock(),S.createElementBlock("div",L6,[S.createElementVNode("div",N6,[S.createVNode(u,{username:t.item.username},null,8,["username"]),S.createElementVNode("div",B6,[S.createElementVNode("p",F6,[S.createElementVNode("span",V6,S.toDisplayString(t.item.username),1),e[0]||(e[0]=S.createTextVNode(" змінив данні: "))]),S.createElementVNode("p",$6,S.toDisplayString(t.getDate(t.item)),1)])]),S.createElementVNode("div",j6,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(t.item.changes,(g,_)=>(S.openBlock(),S.createElementBlock("div",{key:_},[g.attr==="geom"?(S.openBlock(),S.createElementBlock("div",U6,[e[1]||(e[1]=S.createElementVNode("p",null,"Додана геометрія:",-1)),g.new?(S.openBlock(),S.createBlock(l,{key:0,point:g.new},null,8,["point"])):S.createCommentVNode("",!0)])):(S.openBlock(),S.createElementBlock("div",H6,[S.createElementVNode("p",null,S.toDisplayString(`- ${t.getTitle(g)}:`),1),S.createElementVNode("p",q6,S.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=S.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),S.createElementVNode("p",W6,S.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const Z6=_t(R6,[["render",G6]]),Y6=S.defineComponent({components:{VsWidgetHistoryItem:Z6,VsEmptyWidget:Sy},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?uS(this.history.data.cdate):""},lastEditDate(){return this.history.data?uS(this.history.data.edate):""},authorName(){return this.history.data?this.history.data.author:""}},methods:{async getHistoryData(){if(this.prefilledData){this.history=this.prefilledData;return}try{const{data:t}=await wt.get(`/api/widget/history/${this.id}`);this.history=t}catch(t){console.error(t)}}},async mounted(){await this.getHistoryData()},watch:{"history.rows":function(t){this.$emit("count-change",t.length)}}}),X6={class:"bg-white"},K6={key:0,class:"space-y-6 list-none relative !px-0 sm:before:absolute sm:before:top-2 sm:before:bottom-0 sm:before:w-0.5 sm:before:left-4 before:bg-gray-200 max-h-[400px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},J6={key:1,class:"w-full h-[330px] flex items-center justify-center"};function Q6(t,e,n,i,r,a){var l;const u=S.resolveComponent("VsWidgetHistoryItem");return S.openBlock(),S.createElementBlock("div",X6,[e[0]||(e[0]=S.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),(l=t.history.rows)!=null&&l.length?(S.openBlock(),S.createElementBlock("ul",K6,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(t.history.rows,g=>(S.openBlock(),S.createElementBlock("li",{class:"list-none",key:g.uid},[S.createVNode(u,{item:g},null,8,["item"])]))),128))])):(S.openBlock(),S.createElementBlock("div",J6," Історія відсутні "))])}const e$={"vs-widget-map":Sz,"vs-widget-gallery":HR,"vs-widget-comments":S6,"vs-widget-file":CR,"vs-widget-history":_t(Y6,[["render",Q6]])},t$={},n$={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},i$={...e$,...t$,"vs-dashboard":{__name:"vs-dashboard",setup(t){return(e,n)=>(S.openBlock(),S.createElementBlock("div",n$,n[0]||(n[0]=[S.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"mb-4 xl:mb-8"},[S.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),S.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),S.createElementVNode("div",{class:"space-y-5"},[S.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[S.createElementVNode("div",{class:"relative w-full"},[S.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[S.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),S.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),S.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),S.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[S.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[S.createElementVNode("span",{class:"sr-only"},"Close"),S.createElementVNode("svg",{class:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),S.createElementVNode("path",{d:"m15 9-6 6"}),S.createElementVNode("path",{d:"m9 9 6 6"})])])])]),S.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[S.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[S.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),S.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),S.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),S.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[S.createElementVNode("span",{class:"hidden sm:block"},"Send"),S.createTextVNode("Invite ")])])]),S.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),S.createElementVNode("div",{class:"flex items-center -space-x-2"},[S.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),S.createElementVNode("div",{class:"flex items-center -space-x-2"},[S.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),S.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),S.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),S.createElementVNode("div",{class:"hs-tooltip inline-block"},[S.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[S.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),S.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),S.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),S.createElementVNode("div",{class:"flex items-center -space-x-2"},[S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),S.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),S.createElementVNode("div",{class:"hs-tooltip inline-block"},[S.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[S.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),S.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),S.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),S.createElementVNode("div",{class:"flex items-center -space-x-2"})]),S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),S.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[S.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[S.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[S.createElementVNode("thead",null,[S.createElementVNode("tr",null,[S.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[S.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),S.createElementVNode("th",{scope:"col",class:"min-w-48"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),S.createElementVNode("th",{scope:"col"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),S.createElementVNode("th",{scope:"col",class:"min-w-36"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),S.createElementVNode("th",{scope:"col"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),S.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),S.createTextVNode(" Active ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),S.createTextVNode(" Inactive ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),S.createTextVNode(" Inactive ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),S.createTextVNode(" Active ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),S.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},r$={install(t,{componentsApp:e={},menu:n=[]}){var a;wt.defaults.baseURL&&(wt.defaults.baseURL=wt.defaults.baseURL);const i=(a=D1(n))==null?void 0:a.filter(u=>u==null?void 0:u.component).map(u=>({...u,component:e[u==null?void 0:u.component]})),{router:r}=iA(i);Object.entries({...i$,...e}).forEach(([u,l])=>{t.component(u,l)}),t.component("admin",kT),t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...$O,componentsApp:e},$router:r},t.use(r)}},Xr=S.ref(null),s$={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await wt.get(`/api/template/table/${n}`),{data:{rows:u}}=await wt.get(`/api/table-data/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.formValues=u==null?void 0:u[0];const{data:l}=await wt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async editObject(){var t,e;try{await this.$refs.form.doValidation(),await wt.put(`/api/table/${this.table}/${(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},o$={style:{width:"calc(100vw - 260px)"}},a$={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},l$={class:"flex items-center gap-[6px]"},c$={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},u$={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function h$(t,e,n,i,r,a){const u=S.resolveComponent("VsForm");return S.openBlock(),S.createElementBlock("div",o$,[S.createElementVNode("div",a$,[e[3]||(e[3]=S.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),S.createElementVNode("div",l$,[S.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),S.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.editObject&&a.editObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),S.createElementVNode("div",c$,[S.createElementVNode("div",u$,[r.scheme?(S.openBlock(),S.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):S.createCommentVNode("",!0)])])])}const d$=Object.freeze(Object.defineProperty({__proto__:null,default:_t(s$,[["render",h$]])},Symbol.toStringTag,{value:"Module"})),p$={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:i}}=await wt.get(`/api/template/table/${n}`),{data:r}=await wt.get(`/api/template/form/${i}`);this.scheme=(r==null?void 0:r.schema)||r}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await wt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},f$={style:{width:"calc(100vw - 260px)"}},m$={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},g$={class:"flex items-center gap-[6px]"},y$={style:{height:"calc(100vh - 150px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},_$={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function b$(t,e,n,i,r,a){const u=S.resolveComponent("VsForm");return S.openBlock(),S.createElementBlock("div",f$,[S.createElementVNode("div",m$,[e[3]||(e[3]=S.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),S.createElementVNode("div",g$,[S.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),S.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),S.createElementVNode("div",y$,[S.createElementVNode("div",_$,[r.scheme?(S.openBlock(),S.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):S.createCommentVNode("",!0)])])])}const x$=Object.freeze(Object.defineProperty({__proto__:null,default:_t(p$,[["render",b$]])},Symbol.toStringTag,{value:"Module"})),v$={};function w$(t,e,n,i,r,a){const u=S.resolveComponent("router-view");return S.openBlock(),S.createBlock(u)}const hS=Object.freeze(Object.defineProperty({__proto__:null,default:_t(v$,[["render",w$]])},Symbol.toStringTag,{value:"Module"})),k$={data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(n=>{var i,r;return(n==null?void 0:n.table)==((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.table)});return e||this.$router.replace("/404"),e==null?void 0:e.path},getTitle(){var t,e,n,i,r,a,u,l,g,_,k,E,T,I,z;if((n=(e=(t=this.objectData)==null?void 0:t.rows)==null?void 0:e[0])!=null&&n.name)return((u=(a=(r=(i=this.objectData)==null?void 0:i.rows)==null?void 0:r[0])==null?void 0:a.name)==null?void 0:u.length)<35?(_=(g=(l=this.objectData)==null?void 0:l.rows)==null?void 0:g[0])==null?void 0:_.name:((I=(T=(E=(k=this.objectData)==null?void 0:k.rows)==null?void 0:E[0])==null?void 0:T.name)==null?void 0:I.slice(0,35))+" ...";{const V=(z=this.flattenMenu(Xr.value))==null?void 0:z.find(H=>{var Z,ee;return(H==null?void 0:H.table)===((ee=(Z=this.$route)==null?void 0:Z.params)==null?void 0:ee.table)});return V==null?void 0:V.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})}},methods:{async getObjectData(){var n;const{table:t,id:e}=(n=this.$route)==null?void 0:n.params;(!t||!e)&&this.$router.replace("/404");try{const{data:i}=await wt.get(`/api/table-data/${t}/${e}`);this.objectData=i}catch(i){console.error(i)}},getColClass(t){return`col-span-${t||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var t,e,n,i,r,a,u,l,g;if((e=(t=this.$route)==null?void 0:t.query)!=null&&e.tab)this.component=(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.tab;else{const _=(a=(r=this.objectData)==null?void 0:r.panels)==null?void 0:a.find(k=>(k==null?void 0:k.type)==="tabs");(u=_==null?void 0:_.items)!=null&&u.length&&(this.component=((l=_.items[0])==null?void 0:l.component)||((g=_.items[0])==null?void 0:g.name))}},flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},S$={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},E$={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},C$={class:""},T$={class:"text-lg md:text-xl font-semibold text-stone-800 dark:text-neutral-200"},M$={class:"flex items-center gap-[6px]"},A$={key:0,class:"border rounded-xl bg-white"},P$={class:"p-[10px] pl-[20px] text-xl"},I$=["innerHTML"],D$={key:1},O$={class:"p-[10px] pl-[20px] text-xl"},z$={key:0,class:"p-[20px] border-t"},R$={key:1,class:"p-[20px] border-t"},L$=["innerHTML"],N$={class:"flex space-x-1 w-full bg-white border rounded-xl h-[60px] items-center pl-[20px]"},B$=["onClick"],F$={key:0,class:"border rounded-xl bg-white mt-[20px]"},V$={class:"p-[10px] pl-[20px] text-xl"},$$={key:0,class:"p-[20px] border-t"},j$={key:1,class:"p-[20px] border-t"},U$=["innerHTML"];function H$(t,e,n,i,r,a){var l,g,_;const u=S.resolveComponent("router-link");return S.openBlock(),S.createElementBlock("div",S$,[S.createElementVNode("div",E$,[S.createElementVNode("div",C$,[S.createElementVNode("button",{onClick:e[0]||(e[0]=k=>t.$router.back()),class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),S.createElementVNode("h2",T$,S.toDisplayString(a.getTitle),1)]),S.createElementVNode("div",M$,[S.createVNode(u,{to:`/edit?table=${a.getRoute}&id=${(g=(l=t.$route)==null?void 0:l.params)==null?void 0:g.id}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:S.withCtx(()=>e[1]||(e[1]=[S.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),S.createElementVNode("div",{class:S.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((_=r.objectData)==null?void 0:_.panels,(k,E)=>{var T;return S.openBlock(),S.createElementBlock("div",{key:E,class:S.normalizeClass([a.getColClass(k.col),"p-4"])},[k!=null&&k.name?(S.openBlock(),S.createElementBlock("div",A$,[S.createElementVNode("h2",P$,S.toDisplayString((k==null?void 0:k.title)||"Панель"),1),S.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(T=r.objectData)==null?void 0:T.data[k==null?void 0:k.name]},null,8,I$)])):k.type==="container"?(S.openBlock(),S.createElementBlock("div",D$,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(k.items,(I,z)=>{var V,H,Z,ee,oe;return S.openBlock(),S.createElementBlock("div",{key:z,class:"border rounded-xl bg-white mb-[20px]"},[S.createElementVNode("h2",O$,S.toDisplayString((I==null?void 0:I.title)||"Панель"),1),I!=null&&I.component?(S.openBlock(),S.createElementBlock("div",z$,[(S.openBlock(),S.createBlock(S.resolveDynamicComponent(I.component),{geometry:(H=(V=r.objectData)==null?void 0:V.rows[0])==null?void 0:H.geom,zoom:16,id:(ee=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ee.id},null,8,["geometry","id"]))])):S.createCommentVNode("",!0),I!=null&&I.name?(S.openBlock(),S.createElementBlock("div",R$,[S.createElementVNode("div",{innerHTML:(oe=r.objectData)==null?void 0:oe.data[I==null?void 0:I.name]},null,8,L$)])):S.createCommentVNode("",!0)])}),128))])):S.createCommentVNode("",!0),(k==null?void 0:k.type)==="tabs"?(S.openBlock(),S.createElementBlock(S.Fragment,{key:2},[S.createElementVNode("nav",N$,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(k==null?void 0:k.items,I=>(S.openBlock(),S.createElementBlock("button",{key:(I==null?void 0:I.name)||(I==null?void 0:I.component),onClick:z=>r.component=(I==null?void 0:I.component)||(I==null?void 0:I.name),class:S.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 text-gray-500 hover:bg-gray-100 focus:bg-gray-100 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg focus:outline-none",{" font-semibold after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":r.component===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name),"":r.component!==(I==null?void 0:I.component)&&r.component!==(I==null?void 0:I.name)}])},S.toDisplayString(I==null?void 0:I.title),11,B$))),128))]),(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(k.items,(I,z)=>{var V,H,Z,ee,oe;return S.openBlock(),S.createElementBlock(S.Fragment,{key:z},[r.component===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name)?(S.openBlock(),S.createElementBlock("div",F$,[S.createElementVNode("h2",V$,S.toDisplayString((I==null?void 0:I.title)||"Панель"),1),I!=null&&I.component?(S.openBlock(),S.createElementBlock("div",$$,[(S.openBlock(),S.createBlock(S.resolveDynamicComponent(I.component),{geometry:(H=(V=r.objectData)==null?void 0:V.rows[0])==null?void 0:H.geom,zoom:16,id:(ee=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ee.id},null,8,["geometry","id"]))])):S.createCommentVNode("",!0),I!=null&&I.name?(S.openBlock(),S.createElementBlock("div",j$,[S.createElementVNode("div",{innerHTML:(oe=r.objectData)==null?void 0:oe.data[I==null?void 0:I.name]},null,8,U$)])):S.createCommentVNode("",!0)])):S.createCommentVNode("",!0)],64)}),128))],64)):S.createCommentVNode("",!0)],2)}),128))],2)])}const q$=Object.freeze(Object.defineProperty({__proto__:null,default:_t(k$,[["render",H$],["__scopeId","data-v-e7d9ada1"]])},Symbol.toStringTag,{value:"Module"})),W$={},G$={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function Z$(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",G$,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),S.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),S.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const Y$=_t(W$,[["render",Z$]]),X$={},K$={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function J$(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",K$,e[0]||(e[0]=[S.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const Q$=_t(X$,[["render",J$]]),e8={},t8={class:"shrink-0 size-4 text-gray-400 dark:text-white/60",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function n8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",t8,e[0]||(e[0]=[S.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),S.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const dS=_t(e8,[["render",n8]]),i8={},r8={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function s8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",r8,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const o8={components:{IconChevronDown:_t(i8,[["render",s8]])},props:{route:Object},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},data(){return{isOpen:!1}}},a8={key:0,class:""},l8={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},c8={key:1};function u8(t,e,n,i,r,a){var g,_,k,E,T,I,z,V,H,Z;const u=S.resolveComponent("IconChevronDown"),l=S.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(S.openBlock(),S.createElementBlock("div",a8,[S.createElementVNode("button",{onClick:e[0]||(e[0]=ee=>r.isOpen=!r.isOpen),class:S.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((k=(_=n.route)==null?void 0:_.menu)==null?void 0:k.some(ee=>{var oe,J;return(ee==null?void 0:ee.path)===t.$route.path.replace("/","")||(ee==null?void 0:ee.table)===((J=(oe=t.$route)==null?void 0:oe.params)==null?void 0:J.table)&&(ee==null?void 0:ee.table)}))&&"bg-gray-100"]])},[S.createTextVNode(S.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),S.createVNode(u,{class:S.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),S.createVNode(S.Transition,{name:"fade"},{default:S.withCtx(()=>{var ee;return[S.withDirectives(S.createElementVNode("ul",l8,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((ee=n.route)==null?void 0:ee.menu,(oe,J)=>{var Ae,ke;return S.openBlock(),S.createElementBlock("li",{key:J,class:"w-full"},[S.createVNode(l,{to:"/"+(oe==null?void 0:oe.path),class:S.normalizeClass([[((oe==null?void 0:oe.path)===t.$route.path.replace("/","")||((ke=(Ae=t.$route)==null?void 0:Ae.params)==null?void 0:ke.table)===(oe==null?void 0:oe.table)&&(oe==null?void 0:oe.table))&&"bg-gray-100"],"flex gap-x-4 py-2 px-3 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},{default:S.withCtx(()=>[S.createTextVNode(S.toDisplayString(oe==null?void 0:oe.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[S.vShow,r.isOpen]])]}),_:1})])):(S.openBlock(),S.createElementBlock("div",c8,[S.createVNode(l,{to:(T=n.route)==null?void 0:T.path,class:S.normalizeClass([[(((I=n.route)==null?void 0:I.path.replace("/",""))===t.$route.path.replace("/","")||((V=(z=t.$route)==null?void 0:z.params)==null?void 0:V.table)===((H=n.route)==null?void 0:H.table)&&((Z=n.route)==null?void 0:Z.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:S.withCtx(()=>{var ee;return[S.createTextVNode(S.toDisplayString((ee=n.route)==null?void 0:ee.ua),1)]}),_:1},8,["to","class"])]))}const h8={components:{IconLogout:Y$,NavbarItem:_t(o8,[["render",u8]]),IconLogo:Q$,IconSearch:dS},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(Xr.value))==null?void 0:e.filter(n=>{var i,r,a;return(a=(i=n==null?void 0:n.ua)==null?void 0:i.toLowerCase())==null?void 0:a.includes((r=this.searchValue)==null?void 0:r.toLowerCase())}):Xr.value}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},d8={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},p8={class:"relative"},f8={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},m8={class:"pb-3 w-full flex flex-col flex-wrap"},g8={key:0,class:"flex flex-col gap-[6px]"},y8={key:1,class:"text-gray-800 text-lg mt-[20px]"};function _8(t,e,n,i,r,a){var k;const u=S.resolveComponent("IconLogo"),l=S.resolveComponent("IconSearch"),g=S.resolveComponent("VsText"),_=S.resolveComponent("NavbarItem");return S.openBlock(),S.createElementBlock("div",d8,[S.createVNode(u,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),S.createElementVNode("div",p8,[S.createVNode(l,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),S.createVNode(g,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=E=>r.searchValue=E),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),S.createElementVNode("div",f8,[S.createElementVNode("nav",m8,[(k=a.data)!=null&&k.length?(S.openBlock(),S.createElementBlock("ul",g8,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(a.data,(E,T)=>(S.openBlock(),S.createElementBlock("li",{key:T,class:"flex flex-col gap-[6px]"},[S.createVNode(_,{route:E},null,8,["route"])]))),128))])):(S.openBlock(),S.createElementBlock("div",y8,"Не знайдено"))])])])}const b8=_t(h8,[["render",_8]]),x8={},v8={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function w8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",v8,e[0]||(e[0]=[S.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),S.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),S.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const k8=_t(x8,[["render",w8]]),S8={},E8={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function C8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",E8,e[0]||(e[0]=[S.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),S.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const T8={components:{IconQuestion:k8,IconMessage:_t(S8,[["render",C8]])}},M8={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},A8={class:"flex items-center gap-[6px]"},P8={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},I8={class:"hs-tooltip [--placement:bottom] inline-block show"},D8={class:"hs-tooltip-toggle relative size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"};function O8(t,e,n,i,r,a){const u=S.resolveComponent("IconQuestion"),l=S.resolveComponent("IconMessage");return S.openBlock(),S.createElementBlock("div",M8,[S.createElementVNode("div",A8,[S.createElementVNode("a",P8,[S.createVNode(u,{height:"24",width:"24"})]),S.createElementVNode("div",I8,[S.createElementVNode("button",D8,[S.createVNode(l,{height:"24",width:"24"}),e[0]||(e[0]=S.createElementVNode("span",{class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},[S.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),S.createElementVNode("span",{class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"}," 1 ")],-1))]),e[1]||(e[1]=S.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),e[2]||(e[2]=S.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),e[3]||(e[3]=S.createElementVNode("img",{class:"flex-shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Image Description"},null,-1))])])}const z8={components:{navbar:b8,AdminHeader:_t(T8,[["render",O8]])},mounted(){this.getMenu()},computed:{isMenu(){return Xr.value}},methods:{async getMenu(){try{const{data:t}=await wt.get("/api/user-menu");Xr.value=t}catch{}}}},R8={class:"admin-wrapper"},L8={class:"flex flex-col"};function N8(t,e,n,i,r,a){const u=S.resolveComponent("navbar"),l=S.resolveComponent("admin-header"),g=S.resolveComponent("router-view");return S.openBlock(),S.createElementBlock("div",R8,[S.createVNode(u),S.createElementVNode("div",L8,[a.isMenu?(S.openBlock(),S.createElementBlock(S.Fragment,{key:0},[S.createVNode(l),S.createVNode(g)],64)):S.createCommentVNode("",!0)])])}const B8=Object.freeze(Object.defineProperty({__proto__:null,default:_t(z8,[["render",N8],["__scopeId","data-v-3d7ecdff"]])},Symbol.toStringTag,{value:"Module"})),F8={},V8={class:"h21yx vs0hq",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function $8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",V8,e[0]||(e[0]=[S.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const j8=_t(F8,[["render",$8]]),U8={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},H8={scope:"col",class:"text-start"},q8={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},W8={key:0,d:"m7 15 5 5 5-5"},G8={key:1,d:"m7 9 5-5 5 5"},Z8={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function Y8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("th",H8,[a.getVisibleIcon?(S.openBlock(),S.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[S.createTextVNode(S.toDisplayString(a.label)+" ",1),(S.openBlock(),S.createElementBlock("svg",q8,[r.currentSort==="asc"||r.currentSort===""?(S.openBlock(),S.createElementBlock("path",W8)):S.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(S.openBlock(),S.createElementBlock("path",G8)):S.createCommentVNode("",!0)]))])):(S.openBlock(),S.createElementBlock("p",Z8,S.toDisplayString(a.label),1))])}const X8=_t(U8,[["render",Y8]]),K8={},J8={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function Q8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",J8,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),S.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),S.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const ej=_t(K8,[["render",Q8]]),tj={},nj={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ij(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",nj,e[0]||(e[0]=[S.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const rj=_t(tj,[["render",ij]]),sj={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},oj={style:{display:"none"}},aj=["height","width","fill"];function lj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock(S.Fragment,null,[(S.openBlock(),S.createElementBlock("svg",oj,e[0]||(e[0]=[S.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[S.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(S.openBlock(),S.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[S.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,aj))],64)}const cj={components:{IconMore:ej,IconDelete:rj,IconEdit:_t(sj,[["render",lj]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await wt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{wt.delete(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},uj={class:"hs-dropdown [--placement:bottom-right] inline-flex"},hj={class:"gap-x-2 p-[4px] rounded-lg shadow-sm hover:border-transparent border focus:outline-none text-black hover:bg-gray-50"},dj={class:"flex flex-col items-start"},pj={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},fj={class:"p-4"},mj={class:"mt-4 flex justify-end gap-x-3"};function gj(t,e,n,i,r,a){const u=S.resolveComponent("IconMore"),l=S.resolveComponent("IconEdit"),g=S.resolveComponent("router-link"),_=S.resolveComponent("IconDelete"),k=S.resolveComponent("VsPopover"),E=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("div",uj,[S.createVNode(k,{trigger:"click",placement:"bottom-left"},{reference:S.withCtx(()=>[S.createElementVNode("button",hj,[S.createVNode(u,{height:"16",width:"16"})])]),default:S.withCtx(()=>{var T,I,z;return[S.createElementVNode("div",dj,[n.isForm?(S.openBlock(),S.createBlock(g,{key:0,to:`/edit?table=${(I=(T=t.$route)==null?void 0:T.params)==null?void 0:I.catchAll}&id=${(z=n.item)==null?void 0:z.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:S.withCtx(()=>[S.createVNode(l,{color:"#000"}),e[4]||(e[4]=S.createTextVNode(" Редагувати "))]),_:1},8,["to"])):S.createCommentVNode("",!0),n.isForm?(S.openBlock(),S.createElementBlock("div",pj)):S.createCommentVNode("",!0),S.createElementVNode("button",{onClick:e[0]||(e[0]=S.withModifiers((...V)=>a.openConfirm&&a.openConfirm(...V),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[S.createVNode(_),e[5]||(e[5]=S.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),S.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=T=>r.isDeleteConfirm=T),title:"Ви впевнені?"},{default:S.withCtx(()=>[S.createElementVNode("div",fj,[e[6]||(e[6]=S.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),S.createElementVNode("div",mj,[S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=T=>r.isDeleteConfirm=!1)}," Скасувати "),S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...T)=>a.deleteElement&&a.deleteElement(...T))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const yj=_t(cj,[["render",gj]]),_j={},bj={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function xj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",bj,e[0]||(e[0]=[S.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),S.createElementVNode("path",{d:"M7 20V4"},null,-1),S.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),S.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const vj={components:{IconExport:_t(_j,[["render",xj]])},props:{table:String,columns:Array},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const t=await wt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),e=new Blob([t.data],{type:"application/octet-stream"}),n=window.URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(t){console.error("Ошибка при экспорте файла:",t),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t}}},wj={class:"p-4"},kj={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},Sj={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},Ej={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},Cj={class:"mt-2 space-y-2"},Tj=["id","onChange"],Mj=["for"],Aj={class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function Pj(t,e,n,i,r,a){const u=S.resolveComponent("IconExport"),l=S.resolveComponent("VsCheckbox"),g=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("button",{onClick:e[0]||(e[0]=_=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[S.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=S.createTextVNode(" Експорт ")),e[5]||(e[5]=S.createElementVNode("svg",{class:"shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),S.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[3]||(e[3]=_=>r.isOpen=_),title:"Експорт таблиці",size:"small"},{footer:S.withCtx(()=>[S.createElementVNode("div",Aj,[e[8]||(e[8]=S.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700","data-hs-overlay":"#hs-pro-decm"}," Скасувати ",-1)),S.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[2]||(e[2]=(..._)=>a.exportTable&&a.exportTable(..._))}," Завантажити таблицю ")])]),default:S.withCtx(()=>[e[9]||(e[9]=S.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),S.createElementVNode("div",wj,[S.createElementVNode("div",kj,[e[6]||(e[6]=S.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),S.createElementVNode("div",Sj,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(n.columns,(_,k)=>(S.openBlock(),S.createElementBlock("div",{class:"flex items-center",key:k,style:{width:"calc((100% - 10px) / 2)"}},[S.createVNode(l,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=E=>r.cols=E),value:_==null?void 0:_.name,label:_==null?void 0:_.ua},null,8,["modelValue","value","label"])]))),128))])]),S.createElementVNode("div",Ej,[e[7]||(e[7]=S.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),S.createElementVNode("div",Cj,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(r.tableFormats,(_,k)=>(S.openBlock(),S.createElementBlock("div",{class:"flex items-center",key:k},[S.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:_,onChange:E=>a.selectFormat(_)},null,40,Tj),S.createElementVNode("label",{for:_,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+S.toDisplayString(_),9,Mj)]))),128))])])])]),_:1},8,["visible"])],64)}const Ij=_t(vj,[["render",Pj]]),Dj={},Oj={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function zj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",Oj,e[0]||(e[0]=[S.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const Rj=_t(Dj,[["render",zj]]),Lj={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},Nj={class:"flex w-full gap-[8px] items-centr"};function Bj(t,e,n,i,r,a){var u,l;return S.openBlock(),S.createElementBlock("label",Nj,[S.withDirectives(S.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[S.vModelCheckbox,r.value]]),S.createTextVNode(" "+S.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const Fj={components:{IconColumns:Rj,AdminTableColumnsHiddenItem:_t(Lj,[["render",Bj]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},Vj={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},$j={class:"py-[10px] px-[10px] w-[260px]"},jj={class:"flex flex-col gap-[3px] max-h-[400px] w-full overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function Uj(t,e,n,i,r,a){const u=S.resolveComponent("IconColumns"),l=S.resolveComponent("AdminTableColumnsHiddenItem"),g=S.resolveComponent("VsPopover");return S.openBlock(),S.createBlock(g,{trigger:"click",placement:"bottom"},{reference:S.withCtx(()=>[S.createElementVNode("button",Vj,[S.createVNode(u,{height:"20",width:"16"})])]),default:S.withCtx(()=>[S.createElementVNode("div",$j,[e[0]||(e[0]=S.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),S.createElementVNode("ul",jj,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(n.columns,(_,k)=>(S.openBlock(),S.createElementBlock("li",{key:k},[S.createVNode(l,{column:_,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const Hj=_t(Fj,[["render",Uj]]),qj={},Wj={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function Gj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",Wj,e[0]||(e[0]=[S.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const Zj=_t(qj,[["render",Gj]]),Yj={},Xj={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function Kj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",Xj,e[0]||(e[0]=[S.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const Jj={props:{table:String,title:String},components:{IconFilter:j8,AdminTableControl:yj,AdminTableExport:Ij,AdminTableColumnsHidden:Hj,AdminTableColumn:X8,AdminNodata:_t(Yj,[["render",Kj]]),IconPlus:Zj,IconSearch:dS},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",onFilters:0}},mounted(){var t,e,n,i;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.getTableData(),this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},getFilterScheme(){var t;return(t=this.tableData)==null?void 0:t.filters},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},rowWidth(){var t;return((t=this.tableData)==null?void 0:t.width)||"100px"}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue(){this.getTableData()},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.filterScheme=null,this.filters=null,this.onFilters=0,this.getFilters())},deep:!0},limit(t){var e;this.$router.push({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})}},methods:{async getTableData(){var t,e;try{const{data:n}=await wt.get(`/api/template/table/${this.table}`),i=await wt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null}});this.tableData={...n,...(i==null?void 0:i.data)||{}}}catch{}},async getFilters(){var t;try{const{data:e}=await wt.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)}}},Qj={class:"w-[calc(100vw - 320px)]"},e7={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},t7={class:"text-xl font-medium h-[20px]"},n7={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},i7={class:"bg-white w-full rounded-xl border p-[20px]"},r7={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative"},s7={class:"flex gap-[6px] ml-auto"},o7={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},a7={class:"space-y-5 flex items-start w-full justify-start"},l7={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},c7={class:"inline-block w-full align-middle"},u7={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},h7={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},d7={class:"border-stone-200 right-0 z-[1]"},p7={class:"divide-y divide-gray-200"},f7=["onClick"],m7={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},g7={class:"p-[20px] flex justify-end w-full"},y7={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function _7(t,e,n,i,r,a){var ee,oe,J,Ae,ke,Me;const u=S.resolveComponent("IconPlus"),l=S.resolveComponent("router-link"),g=S.resolveComponent("IconSearch"),_=S.resolveComponent("VsText"),k=S.resolveComponent("AdminTableColumnsHidden"),E=S.resolveComponent("AdminTableExport"),T=S.resolveComponent("IconFilter"),I=S.resolveComponent("AdminTableColumn"),z=S.resolveComponent("AdminTableControl"),V=S.resolveComponent("AdminNodata"),H=S.resolveComponent("VsPagination"),Z=S.resolveComponent("VsFilter");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("div",Qj,[S.createElementVNode("div",e7,[S.createElementVNode("h2",t7,S.toDisplayString(n.title),1),a.isForm?(S.openBlock(),S.createBlock(l,{key:0,to:`/add?table=${(oe=(ee=t.$route)==null?void 0:ee.params)==null?void 0:oe.catchAll}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:S.withCtx(()=>[S.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=S.createTextVNode(" Додати "))]),_:1},8,["to"])):S.createCommentVNode("",!0)]),S.createElementVNode("div",n7,[S.createElementVNode("div",i7,[S.createElementVNode("div",r7,[S.createVNode(g,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),S.createVNode(_,{modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=Le=>r.searchValue=Le),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),S.createElementVNode("div",s7,[S.createVNode(k,{columns:(J=r.tableData)==null?void 0:J.columns,onUpdateColumns:e[1]||(e[1]=Le=>r.tableData.columns=Le)},null,8,["columns"]),S.createVNode(E,{table:n.table,columns:(Ae=r.tableData)==null?void 0:Ae.columns},null,8,["table","columns"]),S.createElementVNode("button",{onClick:e[2]||(e[2]=Le=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[S.createVNode(T,{height:"16",width:"16"}),e[6]||(e[6]=S.createTextVNode(" Фільтри ")),r.onFilters?(S.openBlock(),S.createElementBlock("span",o7,S.toDisplayString(r.onFilters),1)):S.createCommentVNode("",!0)])])]),S.createElementVNode("div",a7,[S.createElementVNode("div",l7,[S.createElementVNode("div",c7,[a.isNoData?(S.openBlock(),S.createBlock(V,{key:1})):(S.openBlock(),S.createElementBlock("table",u7,[S.createElementVNode("thead",h7,[S.createElementVNode("tr",d7,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(a.columns,Le=>(S.openBlock(),S.createBlock(I,{key:Le.name,style:S.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),data:Le,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),e[7]||(e[7]=S.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),S.createElementVNode("tbody",p7,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((ke=r.tableData)==null?void 0:ke.rows,(Le,Ie)=>{var Ye,it,Nt,ht,Rt,Xt,nn,jt;return S.openBlock(),S.createElementBlock("tr",{key:Ie},[S.createElementVNode("td",{class:"text-sm text-gray-600",style:S.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth})},[S.createElementVNode("button",{onClick:()=>a.pushToCard(Le==null?void 0:Le.id),class:S.normalizeClass(["text-sm font-medium",[((Ye=r.tableData)==null?void 0:Ye.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[(S.openBlock(),S.createBlock(S.resolveDynamicComponent(((it=a.columns[0])==null?void 0:it.format)==="custom"?(Nt=a.columns[0])==null?void 0:Nt.component:t.$componentsConfig[`table-format-${((Rt=(ht=a.columns[0])==null?void 0:ht.format)==null?void 0:Rt.toLowerCase())||"text"}`]),{name:(Xt=a.columns[0])==null?void 0:Xt.name,data:Le,value:Le==null?void 0:Le[(nn=a.columns[0])==null?void 0:nn.name],table:n.table},null,8,["name","data","value","table"]))],10,f7)],4),(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((jt=a.columns)==null?void 0:jt.slice(1),Mt=>{var Sn,hn;return S.openBlock(),S.createElementBlock("td",{class:"text-start px-[4px] py-3 text-sm text-gray-600",style:S.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),key:Mt.name},[(S.openBlock(),S.createBlock(S.resolveDynamicComponent((Mt==null?void 0:Mt.format)==="custom"?Mt==null?void 0:Mt.component:t.$componentsConfig[`table-format-${((Sn=Mt==null?void 0:Mt.format)==null?void 0:Sn.toLowerCase())||"text"}`]),{onUpdateTable:a.getTableData,name:Mt==null?void 0:Mt.name,data:Le,value:Le==null?void 0:Le[Mt==null?void 0:Mt.name],table:n.table,inline:((hn=r.tableData)==null?void 0:hn.inline)||!1},null,40,["onUpdateTable","name","data","value","table","inline"]))],4)}),128)),S.createElementVNode("td",m7,[S.createVNode(z,{isForm:a.isForm,item:Le,table:n.table,onUpdateTable:a.getTableData},null,8,["isForm","item","table","onUpdateTable"])])])}),128))])]))])])]),S.createElementVNode("div",g7,[r.limit?(S.openBlock(),S.createBlock(H,{key:0,goTo:!1,class:"justify-end","default-page":a.defaultPage,total:((Me=r.tableData)==null?void 0:Me.total)||0,pageSize:r.limit,onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):S.createCommentVNode("",!0)])])])]),S.createVNode(S.Transition,{name:"fade"},{default:S.withCtx(()=>{var Le;return[S.withDirectives(S.createElementVNode("div",{onClick:e[4]||(e[4]=(...Ie)=>a.closeFilter&&a.closeFilter(...Ie)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[S.createElementVNode("div",y7,[(Le=r.filterScheme)!=null&&Le.length?(S.openBlock(),S.createBlock(Z,{key:0,ref:"filter",scheme:r.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:a.filterChange,closeFilterBtn:!0,onFilterClose:e[3]||(e[3]=Ie=>r.isFilters=!1)},null,8,["scheme","onFilterChange"])):S.createCommentVNode("",!0)])],512),[[S.vShow,r.isFilters]])]}),_:1})],64)}const b7={components:{AdminTable:_t(Jj,[["render",_7]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Xr!=null&&Xr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){t&&(document.title=t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getMenu(){try{const{data:t}=await wt.get("/api/user-menu");Xr.value=t}catch{}},async checkPageType(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await wt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},x7=["innerHTML"];function v7(t,e,n,i,r,a){const u=S.resolveComponent("AdminTable");return r.table?(S.openBlock(),S.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(S.openBlock(),S.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,x7))}const w7=Object.freeze(Object.defineProperty({__proto__:null,default:_t(b7,[["render",v7]])},Symbol.toStringTag,{value:"Module"}));return r$});
741
+ `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:i})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:a}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:u}=this.options,{splittableMarks:l}=i.extensionManager,g=a||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:_,dispatch:k})=>{if(k&&g&&u){const E=g.filter(T=>l.includes(T.type.name));_.ensureMarks(E)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),HF=xs.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,di(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>E0({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var qf=200,Ai=function(){};Ai.prototype.append=function(e){return e.length?(e=Ai.from(e),!this.length&&e||e.length<qf&&this.leafAppend(e)||this.length<qf&&e.leafPrepend(this)||this.appendInner(e)):this},Ai.prototype.prepend=function(e){return e.length?Ai.from(e).append(this):this},Ai.prototype.appendInner=function(e){return new qF(this,e)},Ai.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?Ai.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))},Ai.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Ai.prototype.forEach=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length),n<=i?this.forEachInner(e,n,i,0):this.forEachInvertedInner(e,n,i,0)},Ai.prototype.map=function(e,n,i){n===void 0&&(n=0),i===void 0&&(i=this.length);var r=[];return this.forEach(function(a,u){return r.push(e(a,u))},n,i),r},Ai.from=function(e){return e instanceof Ai?e:e&&e.length?new nS(e):Ai.empty};var nS=function(t){function e(i){t.call(this),this.values=i}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,a){return r==0&&a==this.length?this:new e(this.values.slice(r,a))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,a,u,l){for(var g=a;g<u;g++)if(r(this.values[g],l+g)===!1)return!1},e.prototype.forEachInvertedInner=function(r,a,u,l){for(var g=a-1;g>=u;g--)if(r(this.values[g],l+g)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=qf)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=qf)return new e(r.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(Ai);Ai.empty=new nS([]);var qF=function(t){function e(n,i){t.call(this),this.left=n,this.right=i,this.length=n.length+i.length,this.depth=Math.max(n.depth,i.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(i){return i<this.left.length?this.left.get(i):this.right.get(i-this.left.length)},e.prototype.forEachInner=function(i,r,a,u){var l=this.left.length;if(r<l&&this.left.forEachInner(i,r,Math.min(a,l),u)===!1||a>l&&this.right.forEachInner(i,Math.max(r-l,0),Math.min(this.length,a)-l,u+l)===!1)return!1},e.prototype.forEachInvertedInner=function(i,r,a,u){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(i,r-l,Math.max(a,l)-l,u+l)===!1||a<l&&this.left.forEachInvertedInner(i,Math.min(r,l),a,u)===!1)return!1},e.prototype.sliceInner=function(i,r){if(i==0&&r==this.length)return this;var a=this.left.length;return r<=a?this.left.slice(i,r):i>=a?this.right.slice(i-a,r-a):this.left.slice(i,a).append(this.right.slice(0,r-a))},e.prototype.leafAppend=function(i){var r=this.right.leafAppend(i);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(i){var r=this.left.leafPrepend(i);if(r)return new e(r,this.right)},e.prototype.appendInner=function(i){return this.left.depth>=Math.max(this.right.depth,i.depth)+1?new e(this.left,new e(this.right,i)):new e(this,i)},e}(Ai);const WF=500;class Us{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}let r,a;n&&(r=this.remapping(i,this.items.length),a=r.maps.length);let u=e.tr,l,g,_=[],k=[];return this.items.forEach((E,T)=>{if(!E.step){r||(r=this.remapping(i,T+1),a=r.maps.length),a--,k.push(E);return}if(r){k.push(new co(E.map));let I=E.step.map(r.slice(a)),z;I&&u.maybeStep(I).doc&&(z=u.mapping.maps[u.mapping.maps.length-1],_.push(new co(z,void 0,void 0,_.length+k.length))),a--,z&&r.appendMap(z,a)}else u.maybeStep(E.step);if(E.selection)return l=r?E.selection.map(r.slice(a)):E.selection,g=new Us(this.items.slice(0,i).append(k.reverse().concat(_)),this.eventCount-1),!1},this.items.length,0),{remaining:g,transform:u,selection:l}}addTransform(e,n,i,r){let a=[],u=this.eventCount,l=this.items,g=!r&&l.length?l.get(l.length-1):null;for(let k=0;k<e.steps.length;k++){let E=e.steps[k].invert(e.docs[k]),T=new co(e.mapping.maps[k],E,n),I;(I=g&&g.merge(T))&&(T=I,k?a.pop():l=l.slice(0,l.length-1)),a.push(T),n&&(u++,n=void 0),r||(g=T)}let _=u-i.depth;return _>ZF&&(l=GF(l,_),u-=_),new Us(l.append(a),u)}remapping(e,n){let i=new Pc;return this.items.forEach((r,a)=>{let u=r.mirrorOffset!=null&&a-r.mirrorOffset>=e?i.maps.length-r.mirrorOffset:void 0;i.appendMap(r.map,u)},e,n),i}addMaps(e){return this.eventCount==0?this:new Us(this.items.append(e.map(n=>new co(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let i=[],r=Math.max(0,this.items.length-n),a=e.mapping,u=e.steps.length,l=this.eventCount;this.items.forEach(T=>{T.selection&&l--},r);let g=n;this.items.forEach(T=>{let I=a.getMirror(--g);if(I==null)return;u=Math.min(u,I);let z=a.maps[I];if(T.step){let V=e.steps[I].invert(e.docs[I]),H=T.selection&&T.selection.map(a.slice(g+1,I));H&&l++,i.push(new co(z,V,H))}else i.push(new co(z))},r);let _=[];for(let T=n;T<u;T++)_.push(new co(a.maps[T]));let k=this.items.slice(0,r).append(_).append(i),E=new Us(k,l);return E.emptyItemCount()>WF&&(E=E.compress(this.items.length-i.length)),E}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),i=n.maps.length,r=[],a=0;return this.items.forEach((u,l)=>{if(l>=e)r.push(u),u.selection&&a++;else if(u.step){let g=u.step.map(n.slice(i)),_=g&&g.getMap();if(i--,_&&n.appendMap(_,i),g){let k=u.selection&&u.selection.map(n.slice(i));k&&a++;let E=new co(_.invert(),g,k),T,I=r.length-1;(T=r.length&&r[I].merge(E))?r[I]=T:r.push(E)}}else u.map&&i--},this.items.length,0),new Us(Ai.from(r.reverse()),a)}}Us.empty=new Us(Ai.empty,0);function GF(t,e){let n;return t.forEach((i,r)=>{if(i.selection&&e--==0)return n=r,!1}),t.slice(n)}class co{constructor(e,n,i,r){this.map=e,this.step=n,this.selection=i,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new co(n.getMap().invert(),n,this.selection)}}}class Ta{constructor(e,n,i,r,a){this.done=e,this.undone=n,this.prevRanges=i,this.prevTime=r,this.prevComposition=a}}const ZF=20;function YF(t,e,n,i){let r=n.getMeta(Ll),a;if(r)return r.historyState;n.getMeta(JF)&&(t=new Ta(t.done,t.undone,null,0,-1));let u=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(u&&u.getMeta(Ll))return u.getMeta(Ll).redo?new Ta(t.done.addTransform(n,void 0,i,Wf(e)),t.undone,iS(n.mapping.maps),t.prevTime,t.prevComposition):new Ta(t.done,t.undone.addTransform(n,void 0,i,Wf(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(u&&u.getMeta("addToHistory")===!1)){let l=n.getMeta("composition"),g=t.prevTime==0||!u&&t.prevComposition!=l&&(t.prevTime<(n.time||0)-i.newGroupDelay||!XF(n,t.prevRanges)),_=u?q0(t.prevRanges,n.mapping):iS(n.mapping.maps);return new Ta(t.done.addTransform(n,g?e.selection.getBookmark():void 0,i,Wf(e)),Us.empty,_,n.time,l??t.prevComposition)}else return(a=n.getMeta("rebased"))?new Ta(t.done.rebased(n,a),t.undone.rebased(n,a),q0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Ta(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),q0(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function XF(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((i,r)=>{for(let a=0;a<e.length;a+=2)i<=e[a+1]&&r>=e[a]&&(n=!0)}),n}function iS(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((i,r,a,u)=>e.push(a,u));return e}function q0(t,e){if(!t)return null;let n=[];for(let i=0;i<t.length;i+=2){let r=e.map(t[i],1),a=e.map(t[i+1],-1);r<=a&&n.push(r,a)}return n}function KF(t,e,n){let i=Wf(e),r=Ll.get(e).spec.config,a=(n?t.undone:t.done).popEvent(e,i);if(!a)return null;let u=a.selection.resolve(a.transform.doc),l=(n?t.done:t.undone).addTransform(a.transform,e.selection.getBookmark(),r,i),g=new Ta(n?l:a.remaining,n?a.remaining:l,null,0,-1);return a.transform.setSelection(u).setMeta(Ll,{redo:n,historyState:g})}let W0=!1,rS=null;function Wf(t){let e=t.plugins;if(rS!=e){W0=!1,rS=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){W0=!0;break}}return W0}const Ll=new Mr("history"),JF=new Mr("closeHistory");function QF(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Fi({key:Ll,state:{init(){return new Ta(Us.empty,Us.empty,null,0,-1)},apply(e,n,i){return YF(n,i,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let i=n.inputType,r=i=="historyUndo"?oS:i=="historyRedo"?aS:null;return r?(n.preventDefault(),r(e.state,e.dispatch)):!1}}}})}function sS(t,e){return(n,i)=>{let r=Ll.getState(n);if(!r||(t?r.undone:r.done).eventCount==0)return!1;if(i){let a=KF(r,n,t);a&&i(e?a.scrollIntoView():a)}return!0}}const oS=sS(!1,!0),aS=sS(!0,!0),eV=ji.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>oS(t,e),redo:()=>({state:t,dispatch:e})=>aS(t,e)}},addProseMirrorPlugins(){return[QF(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),tV=xs.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",di(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:i,$to:r}=n,a=t();return i.parentOffset===0?a.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},{type:this.name}):l2(n)?a.insertContentAt(r.pos,{type:this.name}):a.insertContent({type:this.name}),a.command(({tr:u,dispatch:l})=>{var g;if(l){const{$to:_}=u.selection,k=_.end();if(_.nodeAfter)_.nodeAfter.isTextblock?u.setSelection(Vt.create(u.doc,_.pos+1)):_.nodeAfter.isBlock?u.setSelection(zt.create(u.doc,_.pos)):u.setSelection(Vt.create(u.doc,_.pos));else{const E=(g=_.parent.type.contentMatch.defaultType)===null||g===void 0?void 0:g.create();E&&(u.insert(k,E),u.setSelection(Vt.create(u.doc,k+1)))}u.scrollIntoView()}return!0}).run()}}},addInputRules(){return[O5({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),nV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,iV=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,rV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,sV=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,oV=Lo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[qc({find:nV,type:this.type}),qc({find:rV,type:this.type})]},addPasteRules(){return[Wc({find:iV,type:this.type}),Wc({find:sV,type:this.type})]}}),lS=/^(\d+)\.\s$/,aV=xs.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",di(this.options.HTMLAttributes,n),0]:["ol",di(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(U0.name,this.editor.getAttributes(Uf.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Nh({find:lS,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Nh({find:lS,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Uf.name)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),lV=xs.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),cV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,uV=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,hV=Lo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",di(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[qc({find:cV,type:this.type})]},addPasteRules(){return[Wc({find:uV,type:this.type})]}}),dV=xs.create({name:"text",group:"inline"}),pV=ji.create({name:"starterKit",addExtensions(){var t,e,n,i,r,a,u,l,g,_,k,E,T,I,z,V,H,Z;const ee=[];return this.options.bold!==!1&&ee.push(SF.configure((t=this.options)===null||t===void 0?void 0:t.bold)),this.options.blockquote!==!1&&ee.push(bF.configure((e=this.options)===null||e===void 0?void 0:e.blockquote)),this.options.bulletList!==!1&&ee.push(EF.configure((n=this.options)===null||n===void 0?void 0:n.bulletList)),this.options.code!==!1&&ee.push(MF.configure((i=this.options)===null||i===void 0?void 0:i.code)),this.options.codeBlock!==!1&&ee.push(tS.configure((r=this.options)===null||r===void 0?void 0:r.codeBlock)),this.options.document!==!1&&ee.push(IF.configure((a=this.options)===null||a===void 0?void 0:a.document)),this.options.dropcursor!==!1&&ee.push(zF.configure((u=this.options)===null||u===void 0?void 0:u.dropcursor)),this.options.gapcursor!==!1&&ee.push(jF.configure((l=this.options)===null||l===void 0?void 0:l.gapcursor)),this.options.hardBreak!==!1&&ee.push(UF.configure((g=this.options)===null||g===void 0?void 0:g.hardBreak)),this.options.heading!==!1&&ee.push(HF.configure((_=this.options)===null||_===void 0?void 0:_.heading)),this.options.history!==!1&&ee.push(eV.configure((k=this.options)===null||k===void 0?void 0:k.history)),this.options.horizontalRule!==!1&&ee.push(tV.configure((E=this.options)===null||E===void 0?void 0:E.horizontalRule)),this.options.italic!==!1&&ee.push(oV.configure((T=this.options)===null||T===void 0?void 0:T.italic)),this.options.listItem!==!1&&ee.push(U0.configure((I=this.options)===null||I===void 0?void 0:I.listItem)),this.options.orderedList!==!1&&ee.push(aV.configure((z=this.options)===null||z===void 0?void 0:z.orderedList)),this.options.paragraph!==!1&&ee.push(lV.configure((V=this.options)===null||V===void 0?void 0:V.paragraph)),this.options.strike!==!1&&ee.push(hV.configure((H=this.options)===null||H===void 0?void 0:H.strike)),this.options.text!==!1&&ee.push(dV.configure((Z=this.options)===null||Z===void 0?void 0:Z.text)),ee}});function fV(t){var e;const{char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:u}=t,l=z5(n),g=new RegExp(`\\s${l}$`),_=a?"^":"",k=i?new RegExp(`${_}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${_}(?:^)?${l}[^\\s${l}]*`,"gm"),E=((e=u.nodeBefore)===null||e===void 0?void 0:e.isText)&&u.nodeBefore.text;if(!E)return null;const T=u.pos-E.length,I=Array.from(E.matchAll(k)).pop();if(!I||I.input===void 0||I.index===void 0)return null;const z=I.input.slice(Math.max(0,I.index-1),I.index),V=new RegExp(`^[${r==null?void 0:r.join("")}\0]?$`).test(z);if(r!==null&&!V)return null;const H=T+I.index;let Z=H+I[0].length;return i&&g.test(E.slice(Z-1,Z+1))&&(I[0]+=" ",Z+=1),H<u.pos&&Z>=u.pos?{range:{from:H,to:Z},query:I[0].slice(n.length),text:I[0]}:null}const mV=new Mr("suggestion");function gV({pluginKey:t=mV,editor:e,char:n="@",allowSpaces:i=!1,allowedPrefixes:r=[" "],startOfLine:a=!1,decorationTag:u="span",decorationClass:l="suggestion",command:g=()=>null,items:_=()=>[],render:k=()=>({}),allow:E=()=>!0,findSuggestionMatch:T=fV}){let I;const z=k==null?void 0:k(),V=new Fi({key:t,view(){return{update:async(H,Z)=>{var ee,oe,J,Ae,ke,Me,Le;const Ie=(ee=this.key)===null||ee===void 0?void 0:ee.getState(Z),Ye=(oe=this.key)===null||oe===void 0?void 0:oe.getState(H.state),it=Ie.active&&Ye.active&&Ie.range.from!==Ye.range.from,Nt=!Ie.active&&Ye.active,ht=Ie.active&&!Ye.active,Rt=!Nt&&!ht&&Ie.query!==Ye.query,Xt=Nt||it&&Rt,nn=Rt||it,jt=ht||it&&Rt;if(!Xt&&!nn&&!jt)return;const Mt=jt&&!Xt?Ie:Ye,Sn=H.dom.querySelector(`[data-decoration-id="${Mt.decorationId}"]`);I={editor:e,range:Mt.range,query:Mt.query,text:Mt.text,items:[],command:hn=>g({editor:e,range:Mt.range,props:hn}),decorationNode:Sn,clientRect:Sn?()=>{var hn;const{decorationId:In}=(hn=this.key)===null||hn===void 0?void 0:hn.getState(e.state),bn=H.dom.querySelector(`[data-decoration-id="${In}"]`);return(bn==null?void 0:bn.getBoundingClientRect())||null}:null},Xt&&((J=z==null?void 0:z.onBeforeStart)===null||J===void 0||J.call(z,I)),nn&&((Ae=z==null?void 0:z.onBeforeUpdate)===null||Ae===void 0||Ae.call(z,I)),(nn||Xt)&&(I.items=await _({editor:e,query:Mt.query})),jt&&((ke=z==null?void 0:z.onExit)===null||ke===void 0||ke.call(z,I)),nn&&((Me=z==null?void 0:z.onUpdate)===null||Me===void 0||Me.call(z,I)),Xt&&((Le=z==null?void 0:z.onStart)===null||Le===void 0||Le.call(z,I))},destroy:()=>{var H;I&&((H=z==null?void 0:z.onExit)===null||H===void 0||H.call(z,I))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(H,Z,ee,oe){const{isEditable:J}=e,{composing:Ae}=e.view,{selection:ke}=H,{empty:Me,from:Le}=ke,Ie={...Z};if(Ie.composing=Ae,J&&(Me||e.view.composing)){(Le<Z.range.from||Le>Z.range.to)&&!Ae&&!Z.composing&&(Ie.active=!1);const Ye=T({char:n,allowSpaces:i,allowedPrefixes:r,startOfLine:a,$position:ke.$from}),it=`id_${Math.floor(Math.random()*4294967295)}`;Ye&&E({editor:e,state:oe,range:Ye.range,isActive:Z.active})?(Ie.active=!0,Ie.decorationId=Z.decorationId?Z.decorationId:it,Ie.range=Ye.range,Ie.query=Ye.query,Ie.text=Ye.text):Ie.active=!1}else Ie.active=!1;return Ie.active||(Ie.decorationId=null,Ie.range={from:0,to:0},Ie.query=null,Ie.text=null),Ie}},props:{handleKeyDown(H,Z){var ee;const{active:oe,range:J}=V.getState(H.state);return oe&&((ee=z==null?void 0:z.onKeyDown)===null||ee===void 0?void 0:ee.call(z,{view:H,event:Z,range:J}))||!1},decorations(H){const{active:Z,range:ee,decorationId:oe}=V.getState(H);return Z?hi.create(H.doc,[Gr.inline(ee.from,ee.to,{nodeName:u,class:l,"data-decoration-id":oe})]):null}}});return V}const yV=new Mr("mention"),_V=xs.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderText({options:t,node:e}){var n;return`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e}){var n;return["span",di(this.HTMLAttributes,t.HTMLAttributes),`${t.suggestion.char}${(n=e.attrs.label)!==null&&n!==void 0?n:e.attrs.id}`]},suggestion:{char:"@",pluginKey:yV,command:({editor:t,range:e,props:n})=>{var i,r,a;const u=t.view.state.selection.$to.nodeAfter;((i=u==null?void 0:u.text)===null||i===void 0?void 0:i.startsWith(" "))&&(e.to+=1),t.chain().focus().insertContentAt(e,[{type:this.name,attrs:n},{type:"text",text:" "}]).run(),(a=(r=t.view.dom.ownerDocument.defaultView)===null||r===void 0?void 0:r.getSelection())===null||a===void 0||a.collapseToEnd()},allow:({state:t,range:e})=>{const n=t.doc.resolve(e.from),i=t.schema.nodes[this.name];return!!n.parent.type.contentMatch.matchType(i)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",di({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t})];const n={...this.options};n.HTMLAttributes=di({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:n,node:t});return typeof i=="string"?["span",di({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},renderText({node:t}){return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel({options:this.options,node:t})):this.options.renderText({options:this.options,node:t})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:i}=e,{empty:r,anchor:a}=i;return r?(e.doc.nodesBetween(a-1,a,(u,l)=>{if(u.type.name===this.name)return n=!0,t.insertText(this.options.deleteTriggerWithBackspace?"":this.options.suggestion.char||"",l,l+u.nodeSize),!1}),n):!1})}},addProseMirrorPlugins(){return[gV({editor:this.editor,...this.options.suggestion})]}}),bV={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function xV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBlockquote&&a.toggleBlockquote(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[S.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)]))}const vV=_t(bV,[["render",xV]]),wV={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function kV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBulletList&&a.toggleBulletList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)]))}const SV=_t(wV,[["render",kV]]),EV={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function CV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleOrderedList&&a.toggleOrderedList(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)]))}const TV=_t(EV,[["render",CV]]),MV={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function AV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleCodeBlock&&a.toggleCodeBlock(...u)),class:"p-1.5 text-gray-500 rounded hover:text-gray-900 dark:hover:text-white focus:outline-none"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)]))}const PV=_t(MV,[["render",AV]]),IV={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.chain().toggleBold().run()}}};function DV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleBold&&a.toggleBold(...u)),class:"p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),S.createElementVNode("span",{class:"sr-only"},"Bold",-1)]))}const OV=_t(IV,[["render",DV]]),zV={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function RV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("button",{onClick:e[0]||(e[0]=(...u)=>a.toggleItalic&&a.toggleItalic(...u)),class:"p-1.5 text-gray-500 rounded cursor-pointer hover:text-gray-900 hover:bg-gray-100 dark:text-gray-400 dark:hover:text-white dark:hover:bg-gray-600"},e[1]||(e[1]=[S.createElementVNode("svg",{class:"w-5 h-5","aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none",viewBox:"0 0 24 24"},[S.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),S.createElementVNode("span",{class:"sr-only"},"Italic",-1)]))}const LV={bold:OV,italic:_t(zV,[["render",RV]]),bullet_list:SV,ordered_list:TV,blockquote:vV,codeblock:PV},NV={components:{EditorContent:yF},props:{controls:{type:Array,default:()=>["bold","italic","blockquote","bullet_list","ordered_list","codeblock"]},options:{type:Array,default:()=>[]},modelValue:{type:String,default:()=>""}},data(){return{editor:null}},computed:{controlsList(){return Object.entries(LV).filter(([t])=>this.controls.includes(t)).map(([t,e])=>e)}},watch:{modelValue(t){this.editor&&this.editor.getHTML()!==t&&this.editor.commands.setContent(t)},editor(t){t&&this.editor.on("update",({editor:e})=>{const n=e.getHTML();n!==this.modelValue&&this.$emit("update:modelValue",n)})}},mounted(){this.editor&&this.editor.destroy(),this.initEditor()},beforeDestroy(){this.editor&&this.editor.destroy()},methods:{initEditor(){this.editor=new gF({content:this.modelValue,extensions:[pV,tS,_V.configure({HTMLAttributes:{class:"mention"},suggestion:{items:({query:t})=>{const e=this.options.filter(n=>{var i,r;return(r=(i=n==null?void 0:n.email)==null?void 0:i.toLowerCase())==null?void 0:r.includes(t==null?void 0:t.toLowerCase())}).slice(0,5);return e.length?e:[{id:null,text:"Данні відсутні",email:null}]},render:()=>{let t,e;return{onStart:n=>{t=document.createElement("div"),t.className="mention-popup",n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)}),document.body.appendChild(t);const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.position="absolute",t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`,e=t},onUpdate:n=>{for(;t.firstChild;)t.removeChild(t.firstChild);n.items.forEach(a=>{const u=document.createElement("div");u.className="mention-option",a.id===null?(u.textContent=a.text,u.style.pointerEvents="none",u.style.color="#999"):(u.textContent=a.text,u.addEventListener("click",()=>{n.command({id:a.id,label:a.email})})),t.appendChild(u)});const{from:i}=n.range,r=n.editor.view.coordsAtPos(i);t.style.left=`${r.left}px`,t.style.top=`${r.top-t.offsetHeight}px`},onExit:()=>{e&&e.remove()}}}}})]})}}},BV={class:"editor-container w-full border border-gray-200 rounded-lg bg-gray-50 dark:bg-gray-700 dark:border-gray-600"},FV={class:"editor-toolbar px-3 py-2 border-b dark:border-gray-600 flex items-center gap-2"},VV={class:"editor-content px-4 py-2 bg-white rounded-b-lg dark:bg-gray-800 relative"};function $V(t,e,n,i,r,a){const u=S.resolveComponent("EditorContent");return S.openBlock(),S.createElementBlock("div",BV,[S.createElementVNode("div",FV,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(a.controlsList,(l,g)=>(S.openBlock(),S.createBlock(S.resolveDynamicComponent(l),{key:g,editor:r.editor},null,8,["editor"]))),128))]),S.createElementVNode("div",VV,[S.createVNode(u,{editor:r.editor,class:"relative"},null,8,["editor"])])])}const cS=_t(NV,[["render",$V]]),jV=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},UV={props:{name:{type:String,default(){return""}},avatar:{type:String,default(){return""}}},computed:{inItials(){return jV(this.name)}}},HV={class:"mr-2"},qV=["src"],WV={key:1,class:"flex flex-shrink-0 items-center justify-center w-6 h-6 bg-gray-500 text-xs text-white rounded-full"},GV={key:0},ZV={key:1,class:"text-sm"};function YV(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",HV,[n.avatar?(S.openBlock(),S.createElementBlock("img",{key:0,src:n.avatar,alt:"avatar",class:"flex flex-shrink-0 items-center justify-center w-6 h-6 rounded-full"},null,8,qV)):n.name?(S.openBlock(),S.createElementBlock("div",WV,[a.inItials.length?(S.openBlock(),S.createElementBlock("span",GV,S.toDisplayString(a.inItials),1)):(S.openBlock(),S.createElementBlock("span",ZV,e[0]||(e[0]=[S.createElementVNode("i",{class:"ti ti-user"},null,-1)])))])):S.createCommentVNode("",!0)])}const XV={components:{VsWidgetCommentsAvatar:_t(UV,[["render",YV]]),VsTextEditor:cS},props:{comment:{type:Object,default:()=>({})},user:{type:Object,default:()=>({})},id:{type:String,default:""},options:Array},data(){return{commentContent:this.comment.body,isCommentActionVisible:!1,isOpen:!1,textareaValue:""}},computed:{isUserAutor(){return this.user.uid===this.comment.uid},createDate(){try{const t=at(this.comment.cdate,"YYYY-MM-DD");return new Date(t).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},watch:{isOpen(t){t&&(this.textareaValue=this.comment.body)}},methods:{confirnDeleteComment(){document.body.click(),this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей коментар?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteComment,updateListOnConfirm:!0})},async updateComment(){try{await wt.post(`/api/widget/comment/${this.id}/${this.comment.communication_id}`,{body:this.textareaValue}),this.$emit("list-update"),this.isOpen=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},async deleteComment(){try{await wt.delete(`/api/widget/comment/${this.id}/${this.comment.communication_id}`),this.$emit("list-update"),this.isCommentActionVisible=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}},toggleCommentAction(){this.isCommentActionVisible=!this.isCommentActionVisible}}},KV={class:"p-6 text-base bg-white dark:bg-gray-900"},JV={class:"flex justify-between items-center mb-2"},QV={class:"flex items-center"},e6={class:"inline-flex items-center mr-3 text-sm text-gray-900 dark:text-white font-semibold capitalize"},t6={class:"text-sm text-gray-600 dark:text-gray-400"},n6=["innerHTML"],i6={class:"flex items-center gap-[4px]"},r6={class:"flex flex-col gap-[8px] text-sm font-medium text-gray-500"},s6={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"};function o6(t,e,n,i,r,a){const u=S.resolveComponent("VsWidgetCommentsAvatar"),l=S.resolveComponent("VsTextEditor"),g=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("div",KV,[S.createElementVNode("div",JV,[S.createElementVNode("div",QV,[S.createElementVNode("p",e6,[S.createVNode(u,{name:n.comment.username,avatar:n.comment.avatar},null,8,["name","avatar"]),S.createTextVNode(S.toDisplayString(n.comment.username),1)]),S.createElementVNode("div",t6,S.toDisplayString(a.createDate),1)])]),S.createElementVNode("p",{class:"text-gray-500 dark:text-gray-400",innerHTML:n.comment.body},null,8,n6),S.createElementVNode("div",i6,[S.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[0]||(e[0]=_=>r.isOpen=!0)}," Редагувати "),S.createElementVNode("button",{type:"button",class:"block py-2 dark:hover:bg-gray-600 hover:underline dark:hover:text-white text-start duration-300",onClick:e[1]||(e[1]=_=>a.confirnDeleteComment())}," Видалити ")])]),S.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[5]||(e[5]=_=>r.isOpen=_),title:"Редагувати",size:"small"},{footer:S.withCtx(()=>[S.createElementVNode("div",s6,[S.createElementVNode("button",{onClick:e[3]||(e[3]=_=>r.isOpen=!1),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"}," Відмінити "),S.createElementVNode("button",{onClick:e[4]||(e[4]=(..._)=>a.updateComment&&a.updateComment(..._)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"}," Зберегти ")])]),default:S.withCtx(()=>[S.createElementVNode("div",r6,[e[6]||(e[6]=S.createTextVNode(" Коментар ")),S.createVNode(l,{modelValue:r.textareaValue,"onUpdate:modelValue":e[2]||(e[2]=_=>r.textareaValue=_),options:n.options},null,8,["modelValue","options"])])]),_:1},8,["visible"])],64)}const a6={components:{VsWidgetCommentsItem:_t(XV,[["render",o6]])},inject:["activeAddFormEditor"],props:{id:{type:String,default:()=>""},prefilledData:{type:Object,default:null},options:Array},data(){return{isLoaded:!1,isLoadFailed:!1,comments:[],user:{},modal:{title:"",message:"",cancel:"",confirm:"",cancelButtonText:"",confirmButtonText:""},isModalVisible:!1}},async created(){await this.getComments()},methods:{async getComments(){if(this.prefilledData){this.comments=this.prefilledData.rows,this.isLoaded=!0;return}try{const{data:t}=await wt.get(`/api/widget/comment/${this.id}`);this.comments=t.rows,this.user=t.user}catch(t){this.isLoadFailed=!0,console.error(t)}this.isLoaded=!0,this.$emit("update-comment-count")},prepareModal(t){const e={...t};return t.cancel||(e.cancel=()=>{this.isModalVisible=!1}),t.updateListOnConfirm&&(e.confirm=async()=>{await t.confirm(),this.isModalVisible=!1}),e},handleOpenModal(t){this.modal=this.prepareModal(t),this.isModalVisible=!0}}},l6={class:"flex flex-col divide-y"},c6={key:0,class:"max-h-[300px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},u6={key:1},h6={class:"p-4"},d6={class:"mt-1 text-gray-500 dark:text-neutral-500"},p6={class:"mt-4 flex justify-end gap-x-3"};function f6(t,e,n,i,r,a){const u=S.resolveComponent("VsErrorOnLoading"),l=S.resolveComponent("VsWidgetCommentsItem"),g=S.resolveComponent("VsLoader"),_=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock("div",l6,[r.isLoaded?(S.openBlock(),S.createElementBlock(S.Fragment,{key:0},[r.isLoadFailed?(S.openBlock(),S.createBlock(u,{key:0})):(S.openBlock(),S.createElementBlock(S.Fragment,{key:1},[r.comments.length?(S.openBlock(),S.createElementBlock("div",c6,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(r.comments,(k,E)=>(S.openBlock(),S.createBlock(l,{key:E,comment:k,user:r.user,options:n.options,index:E,id:n.id,onListUpdate:a.getComments,class:"border-top",onOpenModal:e[0]||(e[0]=T=>a.handleOpenModal(T))},null,8,["comment","user","options","index","id","onListUpdate"]))),128))])):(S.openBlock(),S.createElementBlock("div",u6,e[4]||(e[4]=[S.createElementVNode("p",{class:"pl-3 text-sm font-medium text-gray-600"}," Коментарі відсутні ",-1)])))],64))],64)):(S.openBlock(),S.createBlock(g,{key:1,class:"justify-center",text:"Please wait..."})),S.createVNode(_,{title:r.modal.title,size:"small",visible:r.isModalVisible,"onUpdate:visible":e[3]||(e[3]=k=>r.isModalVisible=k)},{default:S.withCtx(()=>[S.createElementVNode("div",h6,[S.createElementVNode("p",d6,S.toDisplayString(r.modal.message),1),S.createElementVNode("div",p6,[S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=(...k)=>r.modal.cancel&&r.modal.cancel(...k))},S.toDisplayString(r.modal.cancelButtonText),1),S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...k)=>r.modal.confirm&&r.modal.confirm(...k))},S.toDisplayString(r.modal.confirmButtonText),1)])])]),_:1},8,["title","visible"])])}const m6=_t(a6,[["render",f6]]),g6={components:{VsTextEditor:cS},props:{id:{type:String,default:()=>""},autofocus:{type:Boolean,default:()=>!0},options:Array},data(){return{isEditorOpen:!1,commentContent:""}},methods:{async addNewComment(){if(this.commentContent)try{await wt.post(`/api/widget/comment/${this.id}`,{body:this.commentContent}),this.commentContent="",this.$emit("list-update")}catch(t){console.error(t)}},setNewContent(t){this.commentContent=t}}},y6={class:"w-full widget-comment-form"},_6={class:"mb-4 bg-white border-gray-200 dark:bg-gray-800 dark:border-gray-700"},b6={class:"flex"};function x6(t,e,n,i,r,a){const u=S.resolveComponent("VsTextEditor");return S.openBlock(),S.createElementBlock("div",y6,[S.createElementVNode("div",_6,[S.createVNode(u,{modelValue:r.commentContent,"onUpdate:modelValue":e[0]||(e[0]=l=>r.commentContent=l),options:n.options},null,8,["modelValue","options"])]),S.createElementVNode("div",b6,[S.createElementVNode("button",{ref:"buttonAdd",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300",onClick:e[1]||(e[1]=(...l)=>a.addNewComment&&a.addNewComment(...l))}," Відправити коментар ",512)])])}const v6={components:{VsWidgetCommentsList:m6,VsWidgetCommentsAddForm:_t(g6,[["render",x6]])},props:{id:{type:String,default(){return""}},prefilledData:{type:Object,default:null}},data(){return{activeAddFormEditor:"",comments:[],totalComment:"0",options:[]}},mounted(){this.comments=this.$refs.commentListRef.comments,this.getUsersList()},watch:{comments(t){this.$emit("count-change",t.length)}},methods:{async getUsersList(){try{const{data:t}=await wt.get("/api/suggest/core.user_mentioned");this.options=t}catch(t){console.log(t)}},listUpdate(){this.$refs.commentListRef.getComments()},updateCommentCount(){this.totalComment=this.$refs.commentListRef.comments.length||"0"}}},w6={class:"bg-white-200"};function k6(t,e,n,i,r,a){const u=S.resolveComponent("VsWidgetCommentsAddForm"),l=S.resolveComponent("VsWidgetCommentsList");return S.openBlock(),S.createElementBlock("div",w6,[e[2]||(e[2]=S.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),S.createVNode(u,{options:r.options,class:"mb-6",id:n.id,onListUpdate:e[0]||(e[0]=g=>a.listUpdate())},null,8,["options","id"]),S.createVNode(l,{options:r.options,id:n.id,onUpdateCommentCount:e[1]||(e[1]=g=>a.updateCommentCount()),"prefilled-data":n.prefilledData,ref:"commentListRef"},null,8,["options","id","prefilled-data"])])}const S6=_t(v6,[["render",k6]]),uS=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"numeric"}),E6=t=>new Date(t).toLocaleDateString("uk-UK",{day:"numeric",month:"numeric",year:"numeric",hour:"numeric",minute:"numeric"}),C6=t=>{const e=/(\b\S)?/g,n=t.match(e);return n?n.join("").toUpperCase():""},T6=S.defineComponent({props:{username:{type:String,default:()=>""}},computed:{inItials(){return C6(this.username)}}}),M6={class:"flex flex-shrink-0 items-center justify-center w-8 h-8 bg-gray-500 text-xs text-white rounded-full"};function A6(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",M6,S.toDisplayString(t.inItials),1)}const P6=_t(T6,[["render",A6]]),G0={load(){try{const t=Array.from(arguments);window.headLoadedFiles||(window.headLoadedFiles=[]);const e=typeof arguments[arguments.length-1]=="function"?arguments[arguments.length-1]:null,n=t.filter(i=>typeof i!="function").reduce((i,r)=>i.concat(r),[]).filter(i=>i&&!window.headLoadedFiles[i.url||i.split("?")[0]]);Promise.all(n.map(i=>this.loadFile1(i))).then(()=>{e&&e()})}catch(t){console.log(t)}},promise(t){return new Promise((e,n)=>{G0.load(t,()=>{e()})})},loadFile1(t){let e=!1;typeof t=="object"&&(e=t.type,t=t.url);const n=t.split("?")[0];return new Promise((i,r)=>{function a(l){delete window.headLoadedFiles[`_${n}`],window.headLoadedFiles[n]=l.type,i(l.type)}let u;window.headLoadedFiles[`_${n}`]?u=window.headLoadedFiles[`_${n}`]:(n.includes(".css")?(u=document.createElement("link"),u.href=t,u.type="text/css",u.rel="stylesheet"):(u=document.createElement("script"),u.type="text/javascript",u.src=t,e&&(u.type=e)),window.headLoadedFiles[`_${n}`]=u,document.head.appendChild(u)),u.addEventListener("load",a),u.addEventListener("error",a)})}},I6={props:{point:{type:String,default:()=>""}},data(){return{zoom:18}},computed:{parsedPoint(){return JSON.parse(this.point)},tooltipText(){return this.parsedPoint.coordinates.join(", ")},coordinates(){return[...this.parsedPoint.coordinates].reverse()}},async mounted(){typeof window>"u"||(window!=null&&window.L||(await G0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js"),await G0.promise("https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.9.4/leaflet.js")),this.initMap())},methods:{initMap(){const t=window.L.map("map",{center:this.coordinates,zoom:this.zoom});window.L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png").addTo(t),window.L.circle(this.coordinates,{color:"red",fillColor:"red",fillOpacity:.2,radius:10}).addTo(t).bindTooltip(this.tooltipText)}}},D6={id:"map",style:{height:"9rem",width:"24rem"}};function O6(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",D6)}const z6=_t(I6,[["render",O6]]),R6=S.defineComponent({components:{VsWidgetHistoryItemAvatar:P6,VsWidgetHistoryItemMap:z6},props:{item:{type:Object,default:()=>{}}},methods:{getTitle(t){return t.title||t.attr},getOldValue(t){return t.old||"Не вказано"},getNewValue(t){return t.new||"Не вказано"},getDate(t){return E6(t.cdate)}}}),L6={class:"relative [&_p]:m-0"},N6={class:"flex items-center gap-3"},B6={class:"w-full flex justify-between"},F6={class:"text-gray-500"},V6={class:"text-gray-800 font-medium"},$6={class:"text-gray-500 text-sm"},j6={class:"mt-2 pl-10"},U6={key:0},H6={key:1,class:"flex items-center gap-2 text-gray-700 text-sm"},q6={class:"font-medium"},W6={class:"font-medium"};function G6(t,e,n,i,r,a){const u=S.resolveComponent("VsWidgetHistoryItemAvatar"),l=S.resolveComponent("VsWidgetHistoryItemMap");return S.openBlock(),S.createElementBlock("div",L6,[S.createElementVNode("div",N6,[S.createVNode(u,{username:t.item.username},null,8,["username"]),S.createElementVNode("div",B6,[S.createElementVNode("p",F6,[S.createElementVNode("span",V6,S.toDisplayString(t.item.username),1),e[0]||(e[0]=S.createTextVNode(" змінив данні: "))]),S.createElementVNode("p",$6,S.toDisplayString(t.getDate(t.item)),1)])]),S.createElementVNode("div",j6,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(t.item.changes,(g,_)=>(S.openBlock(),S.createElementBlock("div",{key:_},[g.attr==="geom"?(S.openBlock(),S.createElementBlock("div",U6,[e[1]||(e[1]=S.createElementVNode("p",null,"Додана геометрія:",-1)),g.new?(S.openBlock(),S.createBlock(l,{key:0,point:g.new},null,8,["point"])):S.createCommentVNode("",!0)])):(S.openBlock(),S.createElementBlock("div",H6,[S.createElementVNode("p",null,S.toDisplayString(`- ${t.getTitle(g)}:`),1),S.createElementVNode("p",q6,S.toDisplayString(t.getOldValue(g)),1),e[2]||(e[2]=S.createElementVNode("i",{class:"ti ti-arrow-right"},null,-1)),S.createElementVNode("p",W6,S.toDisplayString(t.getNewValue(g)),1)]))]))),128))])])}const Z6=_t(R6,[["render",G6]]),Y6=S.defineComponent({components:{VsWidgetHistoryItem:Z6,VsEmptyWidget:Sy},props:{id:{type:String,default:""},prefilledData:{type:Object,default:null}},data:()=>({history:{}}),computed:{createdDate(){return this.history.data?uS(this.history.data.cdate):""},lastEditDate(){return this.history.data?uS(this.history.data.edate):""},authorName(){return this.history.data?this.history.data.author:""}},methods:{async getHistoryData(){if(this.prefilledData){this.history=this.prefilledData;return}try{const{data:t}=await wt.get(`/api/widget/history/${this.id}`);this.history=t}catch(t){console.error(t)}}},async mounted(){await this.getHistoryData()},watch:{"history.rows":function(t){this.$emit("count-change",t.length)}}}),X6={class:"bg-white"},K6={key:0,class:"space-y-6 list-none relative !px-0 sm:before:absolute sm:before:top-2 sm:before:bottom-0 sm:before:w-0.5 sm:before:left-4 before:bg-gray-200 max-h-[400px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},J6={key:1,class:"w-full h-[330px] flex items-center justify-center"};function Q6(t,e,n,i,r,a){var l;const u=S.resolveComponent("VsWidgetHistoryItem");return S.openBlock(),S.createElementBlock("div",X6,[e[0]||(e[0]=S.createElementVNode("div",{class:"flex justify-between items-center gap-x-2 mb-4"},null,-1)),(l=t.history.rows)!=null&&l.length?(S.openBlock(),S.createElementBlock("ul",K6,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(t.history.rows,g=>(S.openBlock(),S.createElementBlock("li",{class:"list-none",key:g.uid},[S.createVNode(u,{item:g},null,8,["item"])]))),128))])):(S.openBlock(),S.createElementBlock("div",J6," Історія відсутні "))])}const e$={"vs-widget-map":Sz,"vs-widget-gallery":HR,"vs-widget-comments":S6,"vs-widget-file":CR,"vs-widget-history":_t(Y6,[["render",Q6]])},t$={},n$={style:{width:"calc(100vw - 300px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 flex items-center justify-center"},i$={...e$,...t$,"vs-dashboard":{__name:"vs-dashboard",setup(t){return(e,n)=>(S.openBlock(),S.createElementBlock("div",n$,n[0]||(n[0]=[S.createElementVNode("div",{class:"p-5 md:p-8 bg-white border border-gray-200 shadow-sm rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"mb-4 xl:mb-8"},[S.createElementVNode("h1",{class:"text-lg font-semibold text-gray-800 dark:text-neutral-200"}," Members "),S.createElementVNode("p",{class:"text-sm text-gray-500 dark:text-neutral-500"}," Manage members and users of your workspace and set their access level. ")]),S.createElementVNode("div",{class:"space-y-5"},[S.createElementVNode("div",{class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5"},[S.createElementVNode("div",{class:"relative w-full"},[S.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-20 ps-3.5"},[S.createElementVNode("svg",{class:"shrink-0 size-4 text-gray-500 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),S.createElementVNode("path",{d:"m21 21-4.3-4.3"})])]),S.createElementVNode("input",{type:"text",class:"py-2 ps-10 pe-8 block w-full bg-gray-100 border-transparent rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Search by name or email"}),S.createElementVNode("div",{class:"hidden absolute inset-y-0 end-0 flex items-center pointer-events-none z-20 pe-1"},[S.createElementVNode("button",{type:"button",class:"inline-flex shrink-0 justify-center items-center size-6 rounded-full text-gray-500 hover:text-blue-600 focus:outline-none focus:text-blue-600 dark:text-neutral-500 dark:hover:text-blue-500 dark:focus:text-blue-500","aria-label":"Close"},[S.createElementVNode("span",{class:"sr-only"},"Close"),S.createElementVNode("svg",{class:"shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),S.createElementVNode("path",{d:"m15 9-6 6"}),S.createElementVNode("path",{d:"m9 9 6 6"})])])])]),S.createElementVNode("div",{class:"flex justify-end items-center gap-x-2"},[S.createElementVNode("button",{type:"button",class:"p-2.5 sm:py-2 sm:px-3 inline-flex items-center text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[S.createElementVNode("svg",{class:"shrink-0 sm:me-2 size-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),S.createElementVNode("polyline",{points:"7 10 12 15 17 10"}),S.createElementVNode("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]),S.createElementVNode("span",{class:"hidden sm:block"}," Download CSV ")]),S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-1 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-2 focus:ring-blue-500","data-hs-overlay":"#hs-pro-dshm"},[S.createElementVNode("span",{class:"hidden sm:block"},"Send"),S.createTextVNode("Invite ")])])]),S.createElementVNode("div",{class:"grid sm:grid-cols-2 lg:grid-cols-4 gap-2 xl:gap-4"},[S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}),S.createElementVNode("div",{class:"flex items-center -space-x-2"},[S.createElementVNode("img",{class:"shrink-0 size-7 rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"})])]),S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Admin")]),S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 5 "),S.createElementVNode("div",{class:"flex items-center -space-x-2"},[S.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),S.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("img",{class:"shrink-0 size-7 shadow-md rounded-full",src:"https://images.unsplash.com/photo-1659482634023-2c4fda99ac0c?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O ")])]),S.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Members"),S.createElementVNode("div",{class:"hs-tooltip inline-block"},[S.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[S.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),S.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),S.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(689px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 2 "),S.createElementVNode("div",{class:"flex items-center -space-x-2"},[S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-7 bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," 0 ")])]),S.createElementVNode("div",{class:"inline-flex items-center gap-x-2"},[S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"}," Limited access members "),S.createElementVNode("div",{class:"hs-tooltip inline-block"},[S.createElementVNode("svg",{class:"hs-tooltip-toggle shrink-0 size-3.5 text-gray-500 dark:text-neutral-500",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 16 16"},[S.createElementVNode("path",{d:"M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"}),S.createElementVNode("path",{d:"m8.93 6.588-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588zM9 4.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0z"})]),S.createElementVNode("div",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 w-60 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded dark:bg-neutral-700",role:"tooltip","data-popper-placement":"top",style:{position:"fixed",inset:"auto auto 0px 0px",margin:"0px",transform:"translate(1198px, -708px)"}}," Limited Access Members can only access the projects, tasks, and messages explicitly shared with them. ")])])]),S.createElementVNode("div",{class:"p-4 flex flex-col bg-white border border-gray-200 rounded-xl dark:bg-neutral-800 dark:border-neutral-700"},[S.createElementVNode("div",{class:"flex justify-between items-center mb-1"},[S.createElementVNode("h2",{class:"text-4xl font-semibold text-gray-800 dark:text-neutral-200"}," 0 "),S.createElementVNode("div",{class:"flex items-center -space-x-2"})]),S.createElementVNode("h3",{class:"text-gray-500 dark:text-neutral-500"},"Pending invites")])]),S.createElementVNode("div",{class:"overflow-x-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},[S.createElementVNode("div",{class:"min-w-full inline-block align-middle"},[S.createElementVNode("table",{class:"min-w-full divide-y divide-gray-200 dark:divide-neutral-700"},[S.createElementVNode("thead",null,[S.createElementVNode("tr",null,[S.createElementVNode("th",{scope:"col",class:"min-w-[250px]"},[S.createElementVNode("div",{class:"pe-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Member ")]),S.createElementVNode("th",{scope:"col",class:"min-w-48"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Role ")]),S.createElementVNode("th",{scope:"col"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Email ")]),S.createElementVNode("th",{scope:"col",class:"min-w-36"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Last activity ")]),S.createElementVNode("th",{scope:"col"},[S.createElementVNode("div",{class:"px-4 py-3 text-start flex items-center gap-x-1 text-sm font-medium text-gray-800 dark:text-neutral-200"}," Status ")])])]),S.createElementVNode("tbody",{class:"divide-y divide-gray-200 dark:divide-neutral-700"},[S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Admin ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," james@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),S.createTextVNode(" Active ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," L "),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," James Collins ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," liza@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 2 days ago ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),S.createTextVNode(" Inactive ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1601935111741-ae98b2b230b0?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Daniel Hobbs ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," dhobbs@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Today ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),S.createTextVNode(" Inactive ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("img",{class:"shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1679412330254-90cb240038c5?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=2.5&w=320&h=320&q=80",alt:"Avatar"}),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Brian Warner ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can edit ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," brian@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 1 months ago ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-x-1.5 py-1.5 px-2.5 text-xs font-medium bg-teal-100 text-teal-800 rounded-full dark:bg-teal-500/10 dark:text-teal-500"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-200"}),S.createTextVNode(" Active ")])])]),S.createElementVNode("tr",null,[S.createElementVNode("td",{class:"size-px whitespace-nowrap pe-4 py-3"},[S.createElementVNode("div",{class:"w-full flex items-center gap-x-3"},[S.createElementVNode("span",{class:"flex shrink-0 justify-center items-center size-[38px] bg-white border border-gray-200 text-gray-700 text-xs font-medium uppercase rounded-full dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300"}," O "),S.createElementVNode("div",{class:"grow"},[S.createElementVNode("span",{class:"text-sm font-medium text-gray-800 dark:text-neutral-200"}," Ols Shols ")])])]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," Can view ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," olsshols@site.com ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"text-sm text-gray-600 dark:text-neutral-400"}," 6 days ago ")]),S.createElementVNode("td",{class:"size-px whitespace-nowrap px-4 py-3"},[S.createElementVNode("span",{class:"inline-flex items-center gap-1.5 py-1.5 px-2 text-xs font-medium bg-gray-100 text-gray-800 rounded-full dark:bg-neutral-500/20 dark:text-neutral-400"},[S.createElementVNode("span",{class:"size-1.5 inline-block bg-gray-800 rounded-full dark:bg-neutral-400"}),S.createTextVNode(" Inactive ")])])])])])])])])],-1)])))}}},r$={install(t,{componentsApp:e={},menu:n=[]}){var a;wt.defaults.baseURL&&(wt.defaults.baseURL=wt.defaults.baseURL);const i=(a=D1(n))==null?void 0:a.filter(u=>u==null?void 0:u.component).map(u=>({...u,component:e[u==null?void 0:u.component]})),{router:r}=iA(i);Object.entries({...i$,...e}).forEach(([u,l])=>{t.component(u,l)}),t.component("admin",kT),t.config.globalProperties={...t.config.globalProperties,$componentsConfig:{...$O,componentsApp:e},$router:r},t.use(r)}},Xr=S.ref(null),s$={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){var i,r;const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(a=>{var u,l;return(a==null?void 0:a.path)==((l=(u=this.$route)==null?void 0:u.query)==null?void 0:l.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:a}}=await wt.get(`/api/template/table/${n}`),{data:{rows:u}}=await wt.get(`/api/table-data/${this.table}/${(r=(i=this.$route)==null?void 0:i.query)==null?void 0:r.id}`);this.formValues=u==null?void 0:u[0];const{data:l}=await wt.get(`/api/template/form/${a}`);this.scheme=(l==null?void 0:l.schema)||l}catch{}},async editObject(){var t,e;try{await this.$refs.form.doValidation(),await wt.put(`/api/table/${this.table}/${(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.id}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},o$={style:{width:"calc(100vw - 260px)"}},a$={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},l$={class:"flex items-center gap-[6px]"},c$={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},u$={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function h$(t,e,n,i,r,a){const u=S.resolveComponent("VsForm");return S.openBlock(),S.createElementBlock("div",o$,[S.createElementVNode("div",a$,[e[3]||(e[3]=S.createElementVNode("h2",{class:"text-xl font-medium"},"Редагувати",-1)),S.createElementVNode("div",l$,[S.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),S.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.editObject&&a.editObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),S.createElementVNode("div",c$,[S.createElementVNode("div",u$,[r.scheme?(S.openBlock(),S.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):S.createCommentVNode("",!0)])])])}const d$=Object.freeze(Object.defineProperty({__proto__:null,default:_t(s$,[["render",h$]])},Symbol.toStringTag,{value:"Module"})),p$={data(){return{formValues:{},scheme:null,table:""}},mounted(){this.getFormScheme()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getFormScheme(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.query)==null?void 0:a.table)});e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n;try{const{data:{form:i}}=await wt.get(`/api/template/table/${n}`),{data:r}=await wt.get(`/api/template/form/${i}`);this.scheme=(r==null?void 0:r.schema)||r}catch{}},async createObject(){try{await this.$refs.form.doValidation(),await wt.post(`/api/table/${this.table}`,this.formValues),await this.$router.back(),await this.$notify({title:"Успішно!",message:"Об'єкт успішно створено",type:"success"})}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},f$={style:{width:"calc(100vw - 260px)"}},m$={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},g$={class:"flex items-center gap-[6px]"},y$={style:{height:"calc(100vh - 150px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex"},_$={class:"bg-white w-full rounded-xl border p-[20px] overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function b$(t,e,n,i,r,a){const u=S.resolveComponent("VsForm");return S.openBlock(),S.createElementBlock("div",f$,[S.createElementVNode("div",m$,[e[3]||(e[3]=S.createElementVNode("h2",{class:"text-xl font-medium"},"Створити",-1)),S.createElementVNode("div",g$,[S.createElementVNode("button",{onClick:e[0]||(e[0]=l=>t.$router.back()),class:"py-2 px-3 flex items-center gap-x-2 text-sm font-medium rounded-lg border bg-white border-gray-100 text-gray-800 shadow focus:outline-none hover:bg-gray-50 hover:border-gray-100 duration-300"}," Скасувати "),S.createElementVNode("button",{onClick:e[1]||(e[1]=(...l)=>a.createObject&&a.createObject(...l)),class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"}," Зберегти ")])]),S.createElementVNode("div",y$,[S.createElementVNode("div",_$,[r.scheme?(S.openBlock(),S.createBlock(u,{key:0,ref:"form",scheme:r.scheme,modelValue:r.formValues,"onUpdate:modelValue":e[2]||(e[2]=l=>r.formValues=l),class:"p-0 mt-[20px]"},null,8,["scheme","modelValue"])):S.createCommentVNode("",!0)])])])}const x$=Object.freeze(Object.defineProperty({__proto__:null,default:_t(p$,[["render",b$]])},Symbol.toStringTag,{value:"Module"})),v$={};function w$(t,e,n,i,r,a){const u=S.resolveComponent("router-view");return S.openBlock(),S.createBlock(u)}const hS=Object.freeze(Object.defineProperty({__proto__:null,default:_t(v$,[["render",w$]])},Symbol.toStringTag,{value:"Module"})),k$={data(){return{objectData:null,component:""}},computed:{getRoute(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(n=>{var i,r;return(n==null?void 0:n.table)==((r=(i=this.$route)==null?void 0:i.params)==null?void 0:r.table)});return e||this.$router.replace("/404"),e==null?void 0:e.path},getTitle(){var t,e,n,i,r,a,u,l,g,_,k,E,T,I,z;if((n=(e=(t=this.objectData)==null?void 0:t.rows)==null?void 0:e[0])!=null&&n.name)return((u=(a=(r=(i=this.objectData)==null?void 0:i.rows)==null?void 0:r[0])==null?void 0:a.name)==null?void 0:u.length)<35?(_=(g=(l=this.objectData)==null?void 0:l.rows)==null?void 0:g[0])==null?void 0:_.name:((I=(T=(E=(k=this.objectData)==null?void 0:k.rows)==null?void 0:E[0])==null?void 0:T.name)==null?void 0:I.slice(0,35))+" ...";{const V=(z=this.flattenMenu(Xr.value))==null?void 0:z.find(H=>{var Z,ee;return(H==null?void 0:H.table)===((ee=(Z=this.$route)==null?void 0:Z.params)==null?void 0:ee.table)});return V==null?void 0:V.ua}}},async mounted(){await this.getObjectData(),await this.checkActiveComponent()},watch:{component(t){this.$router.replace({...this.$route,query:{tab:t}})}},methods:{async getObjectData(){var n;const{table:t,id:e}=(n=this.$route)==null?void 0:n.params;(!t||!e)&&this.$router.replace("/404");try{const{data:i}=await wt.get(`/api/table-data/${t}/${e}`);this.objectData=i}catch(i){console.error(i)}},getColClass(t){return`col-span-${t||12}`},getGridClass(){return"grid-cols-12"},checkActiveComponent(){var t,e,n,i,r,a,u,l,g;if((e=(t=this.$route)==null?void 0:t.query)!=null&&e.tab)this.component=(i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.tab;else{const _=(a=(r=this.objectData)==null?void 0:r.panels)==null?void 0:a.find(k=>(k==null?void 0:k.type)==="tabs");(u=_==null?void 0:_.items)!=null&&u.length&&(this.component=((l=_.items[0])==null?void 0:l.component)||((g=_.items[0])==null?void 0:g.name))}},flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},S$={style:{width:"calc(100vw - 260px)",height:"calc(100vh - 60px)"},class:"bg-gray-50 overflow-y-auto"},E$={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},C$={class:""},T$={class:"text-lg md:text-xl font-semibold text-stone-800 dark:text-neutral-200"},M$={class:"flex items-center gap-[6px]"},A$={key:0,class:"border rounded-xl bg-white"},P$={class:"p-[10px] pl-[20px] text-xl"},I$=["innerHTML"],D$={key:1},O$={class:"p-[10px] pl-[20px] text-xl"},z$={key:0,class:"p-[20px] border-t"},R$={key:1,class:"p-[20px] border-t"},L$=["innerHTML"],N$={class:"flex space-x-1 w-full bg-white border border-b-0 rounded-tr-xl rounded-tl-xl h-[60px] items-center pl-[20px]"},B$=["onClick"],F$={key:0,class:"border rounded-bl-xl border-t-0 rounded-br-xl bg-white"},V$={key:0,class:"p-[20px] border-t"},$$={key:1,class:"p-[20px] border-t"},j$=["innerHTML"];function U$(t,e,n,i,r,a){var l,g,_;const u=S.resolveComponent("router-link");return S.openBlock(),S.createElementBlock("div",S$,[S.createElementVNode("div",E$,[S.createElementVNode("div",C$,[S.createElementVNode("button",{onClick:e[0]||(e[0]=k=>t.$router.back()),class:"text-sm h-[20px] text-blue-600 font-medium hover:border-b hover:border-b-2 hover:border-b-blue-500"}," До таблиці "),S.createElementVNode("h2",T$,S.toDisplayString(a.getTitle),1)]),S.createElementVNode("div",M$,[S.createVNode(u,{to:`/edit?table=${a.getRoute}&id=${(g=(l=t.$route)==null?void 0:l.params)==null?void 0:g.id}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:S.withCtx(()=>e[1]||(e[1]=[S.createTextVNode(" Редагувати ")])),_:1},8,["to"])])]),S.createElementVNode("div",{class:S.normalizeClass(["grid gap-[20px]",a.getGridClass()])},[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((_=r.objectData)==null?void 0:_.panels,(k,E)=>{var T;return S.openBlock(),S.createElementBlock("div",{key:E,class:S.normalizeClass([a.getColClass(k.col),"p-4"])},[k!=null&&k.name?(S.openBlock(),S.createElementBlock("div",A$,[S.createElementVNode("h2",P$,S.toDisplayString((k==null?void 0:k.title)||"Панель"),1),S.createElementVNode("div",{class:"p-[20px] border-t",innerHTML:(T=r.objectData)==null?void 0:T.data[k==null?void 0:k.name]},null,8,I$)])):k.type==="container"?(S.openBlock(),S.createElementBlock("div",D$,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(k.items,(I,z)=>{var V,H,Z,ee,oe;return S.openBlock(),S.createElementBlock("div",{key:z,class:"border rounded-xl bg-white mb-[20px]"},[S.createElementVNode("h2",O$,S.toDisplayString((I==null?void 0:I.title)||"Панель"),1),I!=null&&I.component?(S.openBlock(),S.createElementBlock("div",z$,[(S.openBlock(),S.createBlock(S.resolveDynamicComponent(I.component),{geometry:(H=(V=r.objectData)==null?void 0:V.rows[0])==null?void 0:H.geom,zoom:16,id:(ee=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ee.id},null,8,["geometry","id"]))])):S.createCommentVNode("",!0),I!=null&&I.name?(S.openBlock(),S.createElementBlock("div",R$,[S.createElementVNode("div",{innerHTML:(oe=r.objectData)==null?void 0:oe.data[I==null?void 0:I.name]},null,8,L$)])):S.createCommentVNode("",!0)])}),128))])):S.createCommentVNode("",!0),(k==null?void 0:k.type)==="tabs"?(S.openBlock(),S.createElementBlock(S.Fragment,{key:2},[S.createElementVNode("nav",N$,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(k==null?void 0:k.items,I=>(S.openBlock(),S.createElementBlock("button",{key:(I==null?void 0:I.name)||(I==null?void 0:I.component),onClick:z=>r.component=(I==null?void 0:I.component)||(I==null?void 0:I.name),class:S.normalizeClass(["px-2.5 h-[30px] py-1.5 relative inline-flex items-center gap-x-2 text-gray-500 hover:bg-gray-100 focus:bg-gray-100 hover:text-gray-800 text-sm whitespace-nowrap rounded-lg focus:outline-none",{" font-semibold after:absolute after:bottom-[-14px] after:left-2.5 after:right-2.5 after:z-10 after:h-0.5 after:bg-gray-800":r.component===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name),"":r.component!==(I==null?void 0:I.component)&&r.component!==(I==null?void 0:I.name)}])},S.toDisplayString(I==null?void 0:I.title),11,B$))),128))]),(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(k.items,(I,z)=>{var V,H,Z,ee,oe;return S.openBlock(),S.createElementBlock(S.Fragment,{key:z},[r.component===(I==null?void 0:I.component)||r.component===(I==null?void 0:I.name)?(S.openBlock(),S.createElementBlock("div",F$,[I!=null&&I.component?(S.openBlock(),S.createElementBlock("div",V$,[(S.openBlock(),S.createBlock(S.resolveDynamicComponent(I.component),{geometry:(H=(V=r.objectData)==null?void 0:V.rows[0])==null?void 0:H.geom,zoom:16,id:(ee=(Z=t.$route)==null?void 0:Z.params)==null?void 0:ee.id},null,8,["geometry","id"]))])):S.createCommentVNode("",!0),I!=null&&I.name?(S.openBlock(),S.createElementBlock("div",$$,[S.createElementVNode("div",{innerHTML:(oe=r.objectData)==null?void 0:oe.data[I==null?void 0:I.name]},null,8,j$)])):S.createCommentVNode("",!0)])):S.createCommentVNode("",!0)],64)}),128))],64)):S.createCommentVNode("",!0)],2)}),128))],2)])}const H$=Object.freeze(Object.defineProperty({__proto__:null,default:_t(k$,[["render",U$],["__scopeId","data-v-9b7dd8fb"]])},Symbol.toStringTag,{value:"Module"})),q$={},W$={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-logout"};function G$(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",W$,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M14 8v-2a2 2 0 0 0 -2 -2h-7a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h7a2 2 0 0 0 2 -2v-2"},null,-1),S.createElementVNode("path",{d:"M9 12h12l-3 -3"},null,-1),S.createElementVNode("path",{d:"M18 15l3 -3"},null,-1)]))}const Z$=_t(q$,[["render",G$]]),Y$={},X$={viewBox:"0 0 1823 249",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function K$(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",X$,e[0]||(e[0]=[S.createStaticVNode('<path d="M218.88 96.05C223.55 99.19 228.69 101.56 234.09 103.07V145.42C212.05 151.54 195.83 171.79 195.83 195.75C195.83 200.22 196.41 204.65 197.53 208.94L160.92 230.08C156.82 226.06 152.08 222.73 146.91 220.24V171.62C164.83 163.13 176.59 145.06 176.59 124.48C176.59 123.17 176.54 121.86 176.44 120.56L218.88 96.05ZM220.32 79.09L160.97 113.36C162.04 116.88 162.61 120.61 162.61 124.48C162.61 142.66 149.93 157.87 132.93 161.76V230.05C143.4 232.46 152.23 239.16 157.46 248.21L215 214.99C211.7 209.34 209.81 202.77 209.81 195.75C209.81 174.62 226.94 157.49 248.07 157.49V91.02C237.14 91.02 227.29 86.43 220.32 79.09Z" fill="#CE3936"></path><path d="M161.39 19.13L197.44 39.94C196.39 44.11 195.84 48.42 195.84 52.75C195.84 54.21 195.9 55.65 196.02 57.1L153.9 81.42C145.27 75.5 134.95 72.24 124.36 72.24C113.83 72.24 103.57 75.47 94.96 81.32L52.71 56.93C52.82 55.55 52.88 54.16 52.88 52.76C52.88 48.43 52.34 44.12 51.28 39.95L87.3 19.16C96.98 28.89 110.26 34.58 124.34 34.58C138.42 34.57 151.7 28.87 161.39 19.13ZM157.77 0.919983C151.24 12.66 138.71 20.6 124.33 20.6C109.95 20.6 97.44 12.67 90.9 0.939983L33.9 33.85C37.08 39.43 38.91 45.88 38.91 52.76C38.91 56.71 38.31 60.52 37.2 64.11L96.46 98.32C103.44 90.87 113.36 86.22 124.37 86.22C135.44 86.22 145.41 90.93 152.39 98.44L211.59 64.27C210.45 60.64 209.83 56.78 209.83 52.77C209.83 45.89 211.65 39.44 214.84 33.86L157.77 0.919983Z" fill="#CE3936"></path><path d="M29.97 95.95L72.28 120.38C72.17 121.74 72.12 123.1 72.12 124.47C72.12 145.02 83.86 163.08 101.74 171.58V220.23C96.58 222.71 91.84 226.04 87.75 230.05L51.17 208.93C52.29 204.64 52.87 200.21 52.87 195.74C52.87 171.78 36.65 151.53 14.61 145.41V103.06C20.07 101.55 25.27 99.14 29.97 95.95ZM28.5 78.97C21.52 86.38 11.63 91.02 0.640015 91.02V157.49C21.77 157.49 38.9 174.62 38.9 195.75C38.9 202.77 37 209.33 33.71 214.99L91.2 248.18C96.43 239.14 105.25 232.45 115.71 230.04V161.73C98.74 157.81 86.09 142.62 86.09 124.46C86.09 120.54 86.68 116.75 87.78 113.18L28.5 78.97Z" fill="#CE3936"></path><path d="M498.39 177.5V144.88C498.39 128.55 485.11 115.27 468.78 115.27H343.22C342.69 115.27 342.18 115.32 341.67 115.4H337.19C332.35 115.4 328.42 111.46 328.42 106.63V74C328.42 69.16 332.36 65.23 337.19 65.23H486.33C492.08 65.23 496.75 60.57 496.75 54.81C496.75 49.06 492.08 44.39 486.33 44.39H337.19C320.86 44.39 307.58 57.67 307.58 74V106.62C307.58 122.95 320.86 136.23 337.19 136.23H462.75C463.28 136.23 463.79 136.18 464.3 136.1H468.78C473.62 136.1 477.55 140.04 477.55 144.87V177.49C477.55 182.33 473.61 186.26 468.78 186.26H319.64C313.89 186.26 309.22 190.92 309.22 196.68C309.22 202.43 313.89 207.1 319.64 207.1H468.78C485.11 207.11 498.39 193.83 498.39 177.5Z" fill="#CE3935"></path><path d="M710.7 177.32V75.24C710.7 58.91 697.42 45.63 681.09 45.63H550.05C533.72 45.63 520.44 58.91 520.44 75.24V177.32C520.44 193.65 533.72 206.93 550.05 206.93H681.1C697.42 206.93 710.7 193.65 710.7 177.32ZM541.27 75.24C541.27 70.4 545.21 66.47 550.04 66.47H681.09C685.93 66.47 689.86 70.41 689.86 75.24V177.32C689.86 182.16 685.92 186.09 681.09 186.09H550.05C545.21 186.09 541.28 182.15 541.28 177.32V75.24H541.27Z" fill="#CE3935"></path><path d="M1823 177.32V75.24C1823 58.91 1809.72 45.63 1793.39 45.63H1662.34C1646.01 45.63 1632.73 58.91 1632.73 75.24V177.32C1632.73 193.65 1646.01 206.93 1662.34 206.93H1793.39C1809.72 206.93 1823 193.65 1823 177.32ZM1653.57 75.24C1653.57 70.4 1657.51 66.47 1662.34 66.47H1793.39C1798.23 66.47 1802.16 70.41 1802.16 75.24V177.32C1802.16 182.16 1798.22 186.09 1793.39 186.09H1662.34C1657.5 186.09 1653.57 182.15 1653.57 177.32V75.24Z" fill="#CE3935"></path><path d="M756.76 196.51V152H849.42C855.17 152 859.84 147.34 859.84 141.58C859.84 135.83 855.17 131.16 849.42 131.16H756.76V75.23C756.76 70.39 760.7 66.46 765.53 66.46H893.29C899.04 66.46 903.71 61.8 903.71 56.04C903.71 50.29 899.04 45.62 893.29 45.62H765.53C749.2 45.62 735.92 58.9 735.92 75.23V196.5C735.92 202.25 740.59 206.92 746.34 206.92C752.09 206.93 756.76 202.27 756.76 196.51Z" fill="#CE3935"></path><path d="M933.86 66.47H1006.51V194.32C1006.51 200.07 1011.18 204.74 1016.93 204.74C1022.68 204.74 1027.35 200.07 1027.35 194.32V66.47H1100C1105.75 66.47 1110.42 61.81 1110.42 56.05C1110.42 50.3 1105.76 45.63 1100 45.63H933.86C928.11 45.63 923.44 50.29 923.44 56.05C923.45 61.81 928.11 66.47 933.86 66.47Z" fill="#CE3935"></path><path d="M1218.44 204.19C1224.19 204.19 1228.86 199.53 1228.86 193.77V152H1368.13C1384.46 152 1397.74 138.72 1397.74 122.39V75.24C1397.74 58.91 1384.46 45.63 1368.13 45.63H1237.63C1221.3 45.63 1208.02 58.91 1208.02 75.24V193.77C1208.02 199.53 1212.68 204.19 1218.44 204.19ZM1237.63 66.47H1368.13C1372.97 66.47 1376.9 70.41 1376.9 75.24V122.39C1376.9 127.23 1372.96 131.16 1368.13 131.16H1228.86V75.23C1228.86 70.41 1232.79 66.47 1237.63 66.47Z" fill="#CE3935"></path><path d="M1430.64 204.19C1436.39 204.19 1441.06 199.53 1441.06 193.77V152H1523.95C1524.57 153.18 1525.42 154.26 1526.51 155.17L1581.89 201.23C1583.83 202.85 1586.2 203.64 1588.55 203.64C1591.54 203.64 1594.5 202.36 1596.57 199.88C1600.25 195.46 1599.64 188.89 1595.22 185.21L1555.29 152H1580.33C1596.66 152 1609.94 138.72 1609.94 122.39V75.24C1609.94 58.91 1596.66 45.63 1580.33 45.63H1449.83C1433.5 45.63 1420.22 58.91 1420.22 75.24V193.77C1420.22 199.53 1424.88 204.19 1430.64 204.19ZM1449.83 66.47H1580.33C1585.17 66.47 1589.1 70.41 1589.1 75.24V122.39C1589.1 127.23 1585.17 131.16 1580.33 131.16H1441.06V75.23C1441.05 70.41 1444.99 66.47 1449.83 66.47Z" fill="#CE3935"></path>',10)]))}const J$=_t(Y$,[["render",K$]]),Q$={},e8={class:"shrink-0 size-4 text-gray-400 dark:text-white/60",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function t8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",e8,e[0]||(e[0]=[S.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),S.createElementVNode("path",{d:"m21 21-4.3-4.3"},null,-1)]))}const dS=_t(Q$,[["render",t8]]),n8={},i8={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function r8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",i8,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const s8={components:{IconChevronDown:_t(n8,[["render",r8]])},props:{route:Object},mounted(){var t,e,n;(t=this.route)!=null&&t.menu&&(n=(e=this.route)==null?void 0:e.menu)!=null&&n.some(i=>{var r,a;return(i==null?void 0:i.path)===this.$route.path.replace("/","")||((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.table)===(i==null?void 0:i.table)&&(i==null?void 0:i.table)})&&(this.isOpen=!0)},data(){return{isOpen:!1}}},o8={key:0,class:""},a8={class:"ml-[30px] py-[6px] before:block before:absolute relative w-[196px] flex flex-col gap-[6px] inline-block before:w-[2px] before:h-[100%] before:bg-gray-100 before:left-[-14px] cursor-pointer"},l8={key:1};function c8(t,e,n,i,r,a){var g,_,k,E,T,I,z,V,H,Z;const u=S.resolveComponent("IconChevronDown"),l=S.resolveComponent("router-link");return(g=n.route)!=null&&g.menu?(S.openBlock(),S.createElementBlock("div",o8,[S.createElementVNode("button",{onClick:e[0]||(e[0]=ee=>r.isOpen=!r.isOpen),class:S.normalizeClass(["flex cursor-pointer gap-x-3 py-2 px-3 text-sm text-gray-800 justify-start w-full border-none focus:outline-none text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300",[((k=(_=n.route)==null?void 0:_.menu)==null?void 0:k.some(ee=>{var oe,J;return(ee==null?void 0:ee.path)===t.$route.path.replace("/","")||(ee==null?void 0:ee.table)===((J=(oe=t.$route)==null?void 0:oe.params)==null?void 0:J.table)&&(ee==null?void 0:ee.table)}))&&"bg-gray-100"]])},[S.createTextVNode(S.toDisplayString((E=n.route)==null?void 0:E.ua)+" ",1),S.createVNode(u,{class:S.normalizeClass([[r.isOpen&&"-rotate-180"],"ml-auto duration-300"]),width:"14",height:"14"},null,8,["class"])],2),S.createVNode(S.Transition,{name:"fade"},{default:S.withCtx(()=>{var ee;return[S.withDirectives(S.createElementVNode("ul",a8,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((ee=n.route)==null?void 0:ee.menu,(oe,J)=>{var Ae,ke;return S.openBlock(),S.createElementBlock("li",{key:J,class:"w-full"},[S.createVNode(l,{to:"/"+(oe==null?void 0:oe.path),class:S.normalizeClass([[((oe==null?void 0:oe.path)===t.$route.path.replace("/","")||((ke=(Ae=t.$route)==null?void 0:Ae.params)==null?void 0:ke.table)===(oe==null?void 0:oe.table)&&(oe==null?void 0:oe.table))&&"bg-gray-100"],"flex gap-x-4 py-2 px-3 text-sm text-gray-800 rounded-lg hover:bg-gray-100 focus:outline-none focus:bg-gray-100"])},{default:S.withCtx(()=>[S.createTextVNode(S.toDisplayString(oe==null?void 0:oe.ua),1)]),_:2},1032,["to","class"])])}),128))],512),[[S.vShow,r.isOpen]])]}),_:1})])):(S.openBlock(),S.createElementBlock("div",l8,[S.createVNode(l,{to:(T=n.route)==null?void 0:T.path,class:S.normalizeClass([[(((I=n.route)==null?void 0:I.path.replace("/",""))===t.$route.path.replace("/","")||((V=(z=t.$route)==null?void 0:z.params)==null?void 0:V.table)===((H=n.route)==null?void 0:H.table)&&((Z=n.route)==null?void 0:Z.table))&&"bg-gray-100"],"flex gap-x-3 py-2 w-full font-[400] px-3 text-sm text-gray-800 rounded-lg items-center hover:bg-gray-100 duration-300 hover:text-gray-800"])},{default:S.withCtx(()=>{var ee;return[S.createTextVNode(S.toDisplayString((ee=n.route)==null?void 0:ee.ua),1)]}),_:1},8,["to","class"])]))}const u8={components:{IconLogout:Z$,NavbarItem:_t(s8,[["render",c8]]),IconLogo:J$,IconSearch:dS},data(){return{activeIndex:null,data:null,searchValue:""}},computed:{data(){var t,e;return(t=this.searchValue)!=null&&t.trim()?(e=this.flattenMenu(Xr.value))==null?void 0:e.filter(n=>{var i,r,a;return(a=(i=n==null?void 0:n.ua)==null?void 0:i.toLowerCase())==null?void 0:a.includes((r=this.searchValue)==null?void 0:r.toLowerCase())}):Xr.value}},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e}}},h8={class:"flex flex-col h-[100vh] border-r w-[260px] shrink-0"},d8={class:"relative"},p8={class:"p-[16px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},f8={class:"pb-3 w-full flex flex-col flex-wrap"},m8={key:0,class:"flex flex-col gap-[6px]"},g8={key:1,class:"text-gray-800 text-lg mt-[20px]"};function y8(t,e,n,i,r,a){var k;const u=S.resolveComponent("IconLogo"),l=S.resolveComponent("IconSearch"),g=S.resolveComponent("VsText"),_=S.resolveComponent("NavbarItem");return S.openBlock(),S.createElementBlock("div",h8,[S.createVNode(u,{height:"40",width:"200",class:"my-[20px] ml-[20px]"}),S.createElementVNode("div",d8,[S.createVNode(l,{height:"16",width:"16",class:"absolute top-[12px] left-[30px] text-gray-500 z-[1]"}),S.createVNode(g,{type:"text",modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=E=>r.searchValue=E),clearable:!0,placeholder:"Пошук по меню",class:"[&>input]:h-[40px] [&>input]:block [&>input]:rounded-none [&>input]:border-x-0 [&>input]:pl-[60px] [&>input:focus]:outline-none [&>input:focus]:focus:ring-0 [&>input:focus]:border-y-gray-200 [&>input:focus]:border-y-1 [&>input:focus]:border-x-0"},null,8,["modelValue"])]),S.createElementVNode("div",p8,[S.createElementVNode("nav",f8,[(k=a.data)!=null&&k.length?(S.openBlock(),S.createElementBlock("ul",m8,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(a.data,(E,T)=>(S.openBlock(),S.createElementBlock("li",{key:T,class:"flex flex-col gap-[6px]"},[S.createVNode(_,{route:E},null,8,["route"])]))),128))])):(S.openBlock(),S.createElementBlock("div",g8,"Не знайдено"))])])])}const _8=_t(u8,[["render",y8]]),b8={},x8={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function v8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",x8,e[0]||(e[0]=[S.createElementVNode("circle",{cx:"12",cy:"12",r:"10"},null,-1),S.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"},null,-1),S.createElementVNode("path",{d:"M12 17h.01"},null,-1)]))}const w8=_t(b8,[["render",v8]]),k8={},S8={class:"flex-shrink-0 size-4",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function E8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",S8,e[0]||(e[0]=[S.createElementVNode("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"},null,-1),S.createElementVNode("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"},null,-1)]))}const C8={components:{IconQuestion:w8,IconMessage:_t(k8,[["render",E8]])}},T8={class:"h-[60px] border-b flex justify-end px-[20px]",style:{width:"calc(100vw - 260px)"}},M8={class:"flex items-center gap-[6px]"},A8={href:"docs-softpro.com",class:"size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},P8={class:"hs-tooltip [--placement:bottom] inline-block show"},I8={class:"hs-tooltip-toggle relative size-[38px] inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-100"};function D8(t,e,n,i,r,a){const u=S.resolveComponent("IconQuestion"),l=S.resolveComponent("IconMessage");return S.openBlock(),S.createElementBlock("div",T8,[S.createElementVNode("div",M8,[S.createElementVNode("a",A8,[S.createVNode(u,{height:"24",width:"24"})]),S.createElementVNode("div",P8,[S.createElementVNode("button",I8,[S.createVNode(l,{height:"24",width:"24"}),e[0]||(e[0]=S.createElementVNode("span",{class:"flex absolute top-0 end-0 -mt-1.5 -me-1.5"},[S.createElementVNode("span",{class:"animate-ping absolute inline-flex size-full rounded-full bg-red-400 opacity-75 dark:bg-red-600"}),S.createElementVNode("span",{class:"relative min-w-[18px] min-h-[18px] inline-flex justify-center items-center text-[10px] bg-red-500 text-white rounded-full px-1"}," 1 ")],-1))]),e[1]||(e[1]=S.createElementVNode("span",{class:"hs-tooltip-content hs-tooltip-shown:opacity-100 hs-tooltip-shown:visible opacity-0 inline-block absolute invisible z-20 py-1.5 px-2.5 bg-gray-900 text-xs text-white rounded-lg dark:bg-neutral-700 hidden",role:"tooltip","data-popper-placement":"bottom",style:{position:"fixed",inset:"0px auto auto 0px",margin:"0px",transform:"translate(1686px, 53px)"}},null,-1))]),e[2]||(e[2]=S.createElementVNode("div",{class:"h-[30px] w-[1px] bg-gray-200 ml-[10px] mr-[10px]"},null,-1)),e[3]||(e[3]=S.createElementVNode("img",{class:"flex-shrink-0 size-[38px] rounded-full",src:"https://images.unsplash.com/photo-1659482633369-9fe69af50bfb?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=facearea&facepad=3&w=320&h=320&q=80",alt:"Image Description"},null,-1))])])}const O8={components:{navbar:_8,AdminHeader:_t(C8,[["render",D8]])},mounted(){this.getMenu()},computed:{isMenu(){return Xr.value}},methods:{async getMenu(){try{const{data:t}=await wt.get("/api/user-menu");Xr.value=t}catch{}}}},z8={class:"admin-wrapper"},R8={class:"flex flex-col"};function L8(t,e,n,i,r,a){const u=S.resolveComponent("navbar"),l=S.resolveComponent("admin-header"),g=S.resolveComponent("router-view");return S.openBlock(),S.createElementBlock("div",z8,[S.createVNode(u),S.createElementVNode("div",R8,[a.isMenu?(S.openBlock(),S.createElementBlock(S.Fragment,{key:0},[S.createVNode(l),S.createVNode(g)],64)):S.createCommentVNode("",!0)])])}const N8=Object.freeze(Object.defineProperty({__proto__:null,default:_t(O8,[["render",L8],["__scopeId","data-v-3d7ecdff"]])},Symbol.toStringTag,{value:"Module"})),B8={},F8={class:"h21yx vs0hq",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function V8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",F8,e[0]||(e[0]=[S.createStaticVNode('<line x1="21" x2="14" y1="4" y2="4"></line><line x1="10" x2="3" y1="4" y2="4"></line><line x1="21" x2="12" y1="12" y2="12"></line><line x1="8" x2="3" y1="12" y2="12"></line><line x1="21" x2="16" y1="20" y2="20"></line><line x1="12" x2="3" y1="20" y2="20"></line><line x1="14" x2="14" y1="2" y2="6"></line><line x1="8" x2="8" y1="10" y2="14"></line><line x1="16" x2="16" y1="18" y2="22"></line>',9)]))}const $8=_t(B8,[["render",V8]]),j8={data(){return{currentSort:""}},props:{data:{type:Object,default:()=>null},activeColumn:{type:String}},computed:{label(){var t,e;return((t=this.data)==null?void 0:t.ua)||((e=this.data)==null?void 0:e.label)||this.data.title||"null"},selectedSortParam(){var t,e;return(e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort},getVisibleIcon(){return this.data.format!=="image"&&this.data.format!=="verify"}},watch:{activeColumn(t){t!==this.data.name&&(this.currentSort="")}},methods:{changeCurrentSort(t){switch(t){case"":return"asc";case"asc":return"desc";case"desc":return"";default:return""}},handleClickSortBtn(t){this.$emit("change-active",this.data.name),this.currentSort=this.changeCurrentSort(t);const e=this.$route.query,{sort:n,...i}=e,r=this.currentSort?`${this.data.name}-${this.currentSort}`:"";this.$router.replace({query:{...i,...r&&{sort:r}}})},isValueEqualToSelected(t){return`${this.data.name}-${t}`===this.selectedSortParam}}},U8={scope:"col",class:"text-start"},H8={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},q8={key:0,d:"m7 15 5 5 5-5"},W8={key:1,d:"m7 9 5-5 5 5"},G8={key:1,class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500"};function Z8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("th",U8,[a.getVisibleIcon?(S.openBlock(),S.createElementBlock("button",{key:0,type:"button",class:"text-sm text-gray-800 px-[4px] py-2.5 text-start font-normal text-gray-500 flex items-center gap-[6px]",onClick:e[0]||(e[0]=u=>a.handleClickSortBtn(r.currentSort))},[S.createTextVNode(S.toDisplayString(a.label)+" ",1),(S.openBlock(),S.createElementBlock("svg",H8,[r.currentSort==="asc"||r.currentSort===""?(S.openBlock(),S.createElementBlock("path",q8)):S.createCommentVNode("",!0),r.currentSort==="desc"||r.currentSort===""?(S.openBlock(),S.createElementBlock("path",W8)):S.createCommentVNode("",!0)]))])):(S.openBlock(),S.createElementBlock("p",G8,S.toDisplayString(a.label),1))])}const Y8=_t(j8,[["render",Z8]]),X8={},K8={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-dots-vertical"};function J8(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",K8,e[0]||(e[0]=[S.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),S.createElementVNode("path",{d:"M12 12m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),S.createElementVNode("path",{d:"M12 19m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1),S.createElementVNode("path",{d:"M12 5m-1 0a1 1 0 1 0 2 0a1 1 0 1 0 -2 0"},null,-1)]))}const Q8=_t(X8,[["render",J8]]),ej={},tj={class:"flex-shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function nj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",tj,e[0]||(e[0]=[S.createStaticVNode('<path d="M3 6h18"></path><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"></path><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"></path><line x1="10" x2="10" y1="11" y2="17"></line><line x1="14" x2="14" y1="11" y2="17"></line>',5)]))}const ij=_t(ej,[["render",nj]]),rj={props:{height:{type:String,default:"16"},width:{type:String,default:"12"},color:{type:String,default:"black"}}},sj={style:{display:"none"}},oj=["height","width","fill"];function aj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock(S.Fragment,null,[(S.openBlock(),S.createElementBlock("svg",sj,e[0]||(e[0]=[S.createElementVNode("symbol",{id:"icon-pencil",viewBox:"0 0 32 32"},[S.createElementVNode("path",{d:"M27 0c2.761 0 5 2.239 5 5 0 1.126-0.372 2.164-1 3l-2 2-7-7 2-2c0.836-0.628 1.874-1 3-1zM2 23l-2 9 9-2 18.5-18.5-7-7-18.5 18.5zM22.362 11.362l-14 14-1.724-1.724 14-14 1.724 1.724z"})],-1)]))),(S.openBlock(),S.createElementBlock("svg",{height:n.height,width:n.width,fill:n.color},e[1]||(e[1]=[S.createElementVNode("use",{"xlink:href":"#icon-pencil"},null,-1)]),8,oj))],64)}const lj={components:{IconMore:Q8,IconDelete:ij,IconEdit:_t(rj,[["render",aj]])},emits:["updateTable"],props:{item:Object,table:String,isForm:null},data(){return{formVisible:!1,isDeleteConfirm:!1,formValue:{},top:0,left:0}},methods:{openConfirm(){this.isDeleteConfirm=!0,document.querySelector("body").click()},async getData(){var t;try{const{data:e}=await wt.get(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`);this.formValue=e}catch(e){console.error(e)}},doSomethingOnCancel(){this.formVisible=!1},async deleteElement(){var t;try{wt.delete(`/api/table/${this.table}/${(t=this.item)==null?void 0:t.id}`),this.$notify({title:"Успішно!",message:"Об`єкт успішно видалeно",type:"success"}),await this.$emit("update-table"),this.isDeleteConfirm=!1}catch{this.$notify({title:"Помилка!",message:"Сталася помилка",type:"error"})}}}},cj={class:"hs-dropdown [--placement:bottom-right] inline-flex"},uj={class:"gap-x-2 p-[4px] rounded-lg shadow-sm hover:border-transparent border focus:outline-none text-black hover:bg-gray-50"},hj={class:"flex flex-col items-start"},dj={key:1,class:"h-[1px] w-[80%] bg-gray-200 ml-auto mr-auto"},pj={class:"p-4"},fj={class:"mt-4 flex justify-end gap-x-3"};function mj(t,e,n,i,r,a){const u=S.resolveComponent("IconMore"),l=S.resolveComponent("IconEdit"),g=S.resolveComponent("router-link"),_=S.resolveComponent("IconDelete"),k=S.resolveComponent("VsPopover"),E=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("div",cj,[S.createVNode(k,{trigger:"click",placement:"bottom-left"},{reference:S.withCtx(()=>[S.createElementVNode("button",uj,[S.createVNode(u,{height:"16",width:"16"})])]),default:S.withCtx(()=>{var T,I,z;return[S.createElementVNode("div",hj,[n.isForm?(S.openBlock(),S.createBlock(g,{key:0,to:`/edit?table=${(I=(T=t.$route)==null?void 0:T.params)==null?void 0:I.catchAll}&id=${(z=n.item)==null?void 0:z.id}`,class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},{default:S.withCtx(()=>[S.createVNode(l,{color:"#000"}),e[4]||(e[4]=S.createTextVNode(" Редагувати "))]),_:1},8,["to"])):S.createCommentVNode("",!0),n.isForm?(S.openBlock(),S.createElementBlock("div",dj)):S.createCommentVNode("",!0),S.createElementVNode("button",{onClick:e[0]||(e[0]=S.withModifiers((...V)=>a.openConfirm&&a.openConfirm(...V),["stop"])),class:"w-full flex items-center gap-x-3 py-1.5 px-2 rounded-lg text-[13px] text-stone-800 hover:bg-stone-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-stone-100"},[S.createVNode(_),e[5]||(e[5]=S.createElementVNode("span",{class:"text-gray-800"},"Видалити",-1))])])]}),_:1})]),S.createVNode(E,{visible:r.isDeleteConfirm,"onUpdate:visible":e[3]||(e[3]=T=>r.isDeleteConfirm=T),title:"Ви впевнені?"},{default:S.withCtx(()=>[S.createElementVNode("div",pj,[e[6]||(e[6]=S.createElementVNode("p",{class:"mt-1 text-gray-500 dark:text-neutral-500"}," Ви впевнені, що хочете видалити цей об'єкт? ",-1)),S.createElementVNode("div",fj,[S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:e[1]||(e[1]=T=>r.isDeleteConfirm=!1)}," Скасувати "),S.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-semibold rounded-lg border border-transparent bg-red-500 text-white hover:bg-red-600 disabled:opacity-50 disabled:pointer-events-none",onClick:e[2]||(e[2]=(...T)=>a.deleteElement&&a.deleteElement(...T))}," Так, я впевнена/ий ")])])]),_:1},8,["visible"])],64)}const gj=_t(lj,[["render",mj]]),yj={},_j={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function bj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",_j,e[0]||(e[0]=[S.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),S.createElementVNode("path",{d:"M7 20V4"},null,-1),S.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),S.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const xj={components:{IconExport:_t(yj,[["render",bj]])},props:{table:String,columns:Array},data(){return{isOpen:!1,tableFormats:["json","csv","xlsx"],format:"",cols:[]}},methods:{async exportTable(){try{const t=await wt.get("/api/export",{params:{table:this.table,format:this.format,cols:this.cols.join(",")},responseType:"blob"}),e=new Blob([t.data],{type:"application/octet-stream"}),n=window.URL.createObjectURL(e),i=document.createElement("a");i.href=n,i.setAttribute("download",`${this.table.split(".")[0]}.${this.format}`),document.body.appendChild(i),i.click(),document.body.removeChild(i),window.URL.revokeObjectURL(n),this.$notify({type:"success",title:"Експорт",message:"Файл успішно експортовано!"})}catch(t){console.error("Ошибка при экспорте файла:",t),this.$notify({type:"error",title:"Помилка",message:"Не вдалося експортувати файл."})}},selectFormat(t){this.format=t}}},vj={class:"p-4"},wj={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},kj={class:"mt-2 flex row flex-wrap gap-y-[5px] gap-x-[10px]"},Sj={class:"pb-5 mb-5 last:pb-0 last:mb-0 border-b last:border-b-0 border-gray-200 dark:border-neutral-700"},Ej={class:"mt-2 space-y-2"},Cj=["id","onChange"],Tj=["for"],Mj={class:"flex w-full justify-end p-[20px] gap-[6px] border-t"};function Aj(t,e,n,i,r,a){const u=S.resolveComponent("IconExport"),l=S.resolveComponent("VsCheckbox"),g=S.resolveComponent("VsDialog");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("button",{onClick:e[0]||(e[0]=_=>r.isOpen=!0),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[S.createVNode(u,{height:"16",width:"16"}),e[4]||(e[4]=S.createTextVNode(" Експорт ")),e[5]||(e[5]=S.createElementVNode("svg",{class:"shrink-0 size-3.5",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[S.createElementVNode("path",{d:"m6 9 6 6 6-6"})],-1))]),S.createVNode(g,{visible:r.isOpen,"onUpdate:visible":e[3]||(e[3]=_=>r.isOpen=_),title:"Експорт таблиці",size:"small"},{footer:S.withCtx(()=>[S.createElementVNode("div",Mj,[e[8]||(e[8]=S.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center text-start bg-white border border-gray-200 text-gray-800 text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700","data-hs-overlay":"#hs-pro-decm"}," Скасувати ",-1)),S.createElementVNode("button",{type:"button",class:"py-2 px-3 text-nowrap inline-flex justify-center items-center gap-x-2 text-start bg-blue-600 border border-blue-600 text-white text-sm font-medium rounded-lg shadow-sm align-middle hover:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:ring-1 focus:ring-blue-300 dark:focus:ring-blue-500",onClick:e[2]||(e[2]=(..._)=>a.exportTable&&a.exportTable(..._))}," Завантажити таблицю ")])]),default:S.withCtx(()=>[e[9]||(e[9]=S.createElementVNode("div",{class:"dark:border-neutral-700"},null,-1)),S.createElementVNode("div",vj,[S.createElementVNode("div",wj,[e[6]||(e[6]=S.createElementVNode("h2",{class:"text-sm text-gray-500"}," Виберіть стовпці таблиці для експорту: ",-1)),S.createElementVNode("div",kj,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(n.columns,(_,k)=>(S.openBlock(),S.createElementBlock("div",{class:"flex items-center",key:k,style:{width:"calc((100% - 10px) / 2)"}},[S.createVNode(l,{class:"[&>label]:text-sm [&>label]:text-gray-800 [&>label]:ms-3 !gap-x-[1px] !p-0",modelValue:r.cols,"onUpdate:modelValue":e[1]||(e[1]=E=>r.cols=E),value:_==null?void 0:_.name,label:_==null?void 0:_.ua},null,8,["modelValue","value","label"])]))),128))])]),S.createElementVNode("div",Sj,[e[7]||(e[7]=S.createElementVNode("h2",{class:"text-sm text-gray-500"},"Виберіть формат таблиці:",-1)),S.createElementVNode("div",Ej,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(r.tableFormats,(_,k)=>(S.openBlock(),S.createElementBlock("div",{class:"flex items-center",key:k},[S.createElementVNode("input",{type:"radio",name:"hs-pro-duecmfm",class:"shrink-0 border-gray-300 rounded-full text-blue-600 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-500 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800",id:_,onChange:E=>a.selectFormat(_)},null,40,Cj),S.createElementVNode("label",{for:_,class:"text-sm text-gray-800 ms-3 dark:text-neutral-400"}," Формат "+S.toDisplayString(_),9,Tj)]))),128))])])])]),_:1},8,["visible"])],64)}const Pj=_t(xj,[["render",Aj]]),Ij={},Dj={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-columns"};function Oj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",Dj,e[0]||(e[0]=[S.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 6l5.5 0"></path><path d="M4 10l5.5 0"></path><path d="M4 14l5.5 0"></path><path d="M4 18l5.5 0"></path><path d="M14.5 6l5.5 0"></path><path d="M14.5 10l5.5 0"></path><path d="M14.5 14l5.5 0"></path><path d="M14.5 18l5.5 0"></path>',9)]))}const zj=_t(Ij,[["render",Oj]]),Rj={props:{column:Object},emits:["update-column"],data(){return{value:!1}},watch:{value(t){this.$emit("update-column",{...this.column,hidden:!t})}},mounted(){var t;((t=this.column)==null?void 0:t.hidden)!==!0&&(this.value=!0)}},Lj={class:"flex w-full gap-[8px] items-centr"};function Nj(t,e,n,i,r,a){var u,l;return S.openBlock(),S.createElementBlock("label",Lj,[S.withDirectives(S.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=g=>r.value=g),type:"checkbox"},null,512),[[S.vModelCheckbox,r.value]]),S.createTextVNode(" "+S.toDisplayString(((u=n.column)==null?void 0:u.ua)||((l=n.column)==null?void 0:l.title)),1)])}const Bj={components:{IconColumns:zj,AdminTableColumnsHiddenItem:_t(Rj,[["render",Nj]])},emits:["update-columns"],props:{columns:Array},methods:{updateColumn(t){const e=this.columns.findIndex(i=>(i==null?void 0:i.name)===(t==null?void 0:t.name)),n=this.columns;n[e]=t,this.$emit("update-columns",[...n])}}},Fj={class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},Vj={class:"py-[10px] px-[10px] w-[260px]"},$j={class:"flex flex-col gap-[3px] max-h-[400px] w-full overflow-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function jj(t,e,n,i,r,a){const u=S.resolveComponent("IconColumns"),l=S.resolveComponent("AdminTableColumnsHiddenItem"),g=S.resolveComponent("VsPopover");return S.openBlock(),S.createBlock(g,{trigger:"click",placement:"bottom"},{reference:S.withCtx(()=>[S.createElementVNode("button",Fj,[S.createVNode(u,{height:"20",width:"16"})])]),default:S.withCtx(()=>[S.createElementVNode("div",Vj,[e[0]||(e[0]=S.createElementVNode("h2",{class:"text-sm mb-[8px]"},"Оберіть колонки, щоб приховати",-1)),S.createElementVNode("ul",$j,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(n.columns,(_,k)=>(S.openBlock(),S.createElementBlock("li",{key:k},[S.createVNode(l,{column:_,onUpdateColumn:a.updateColumn},null,8,["column","onUpdateColumn"])]))),128))])])]),_:1})}const Uj=_t(Bj,[["render",jj]]),Hj={},qj={class:"hidden sm:block shrink-0 size-3",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 16 16"};function Wj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("svg",qj,e[0]||(e[0]=[S.createElementVNode("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M8 1C8.55228 1 9 1.44772 9 2V7L14 7C14.5523 7 15 7.44771 15 8C15 8.55228 14.5523 9 14 9L9 9V14C9 14.5523 8.55228 15 8 15C7.44772 15 7 14.5523 7 14V9.00001L2 9.00001C1.44772 9.00001 1 8.5523 1 8.00001C0.999999 7.44773 1.44771 7.00001 2 7.00001L7 7.00001V2C7 1.44772 7.44772 1 8 1Z"},null,-1)]))}const Gj=_t(Hj,[["render",Wj]]),Zj={},Yj={class:"vs-table-interface__table-wrp w-full rounded h-fit overflow-hidden"};function Xj(t,e,n,i,r,a){return S.openBlock(),S.createElementBlock("div",Yj,e[0]||(e[0]=[S.createStaticVNode('<div><div class="p-5 min-h-[500px] flex flex-col justify-center items-center text-center"><svg class="w-48 mx-auto" viewBox="0 0 178 90" fill="none" xmlns="http://www.w3.org/2000/svg"><rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs></svg><div class="max-w-sm mx-auto mt-6"><p class="font-medium text-gray-800 dark:text-neutral-200"> Дані для відображення відсутні </p><p class="mt-2 text-sm text-gray-500 dark:text-neutral-500"> Змініть параметри пошуку або спробуйте пізніше </p></div></div></div>',1)]))}const Kj={props:{table:String,title:String},components:{IconFilter:$8,AdminTableControl:gj,AdminTableExport:Pj,AdminTableColumnsHidden:Uj,AdminTableColumn:Y8,AdminNodata:_t(Zj,[["render",Xj]]),IconPlus:Gj,IconSearch:dS},data(){return{tableData:{},isFilters:!1,filterScheme:[],page:1,searchValue:"",limit:0,filters:null,activeColumn:"",onFilters:0}},mounted(){var t,e,n,i;this.page=((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1,this.limit=((i=(n=this.$route)==null?void 0:n.query)==null?void 0:i.limit)||20,this.getTableData(),this.getFilters()},computed:{defaultPage(){var t,e;return((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.page)||1},getFilterScheme(){var t;return(t=this.tableData)==null?void 0:t.filters},columns(){var t,e;return(e=(t=this.tableData)==null?void 0:t.columns)==null?void 0:e.filter(n=>(n==null?void 0:n.hidden)!==!0)},isForm(){var t;return(t=this.tableData)==null?void 0:t.form},isNoData(){var t,e;return!((t=this.tableData)!=null&&t.rows)||!((e=this.columns)!=null&&e.length)},rowWidth(){var t;return((t=this.tableData)==null?void 0:t.width)||"100px"}},watch:{async table(){this.tableData=null,await this.getTableData()},searchValue(){this.getTableData()},$route:{handler(t,e){var n,i;((n=t==null?void 0:t.params)==null?void 0:n.catchAll)!==((i=e==null?void 0:e.params)==null?void 0:i.catchAll)&&(this.filterScheme=null,this.filters=null,this.onFilters=0,this.getFilters())},deep:!0},limit(t){var e;this.$router.push({query:{...(e=this.$route)==null?void 0:e.query,limit:t}})}},methods:{async getTableData(){var t,e;try{const{data:n}=await wt.get(`/api/template/table/${this.table}`),i=await wt.get(`/api/table-data/${this.table}`,{params:{page:this.page,search:this.searchValue||null,limit:this.limit,filter:this.filters||null,order:((e=(t=this.$route)==null?void 0:t.query)==null?void 0:e.sort)||null}});this.tableData={...n,...(i==null?void 0:i.data)||{}}}catch{}},async getFilters(){var t;try{const{data:e}=await wt.get(`/api/table-filter/${this.table}`);this.filterScheme=(t=e==null?void 0:e.list)==null?void 0:t.map(n=>({...n,label:(n==null?void 0:n.label)||(n==null?void 0:n.ua)}))}catch{}},async handlePageChange(t){const e=this.$route.query;this.page=t,!(!(e!=null&&e.page)&&t===1||e.page===t)&&(await this.$router.replace({query:{...e,page:t}}),await this.getTableData())},async changeLimit(t){this.limit=await t,this.defaultPage=1,await this.getTableData()},closeFilter({target:t}){this.isFilters&&t.classList.contains("filter-container")&&(this.isFilters=!1)},async filterChange({url:t,state:e}){var n;this.filters=t!=="no-url"?t:null,this.onFilters=(n=Object.entries(e))==null?void 0:n.length,this.page=1,await this.getTableData()},changeActiveColumn(t){this.activeColumn=t,this.getTableData()},pushToCard(t){var e;((e=this.tableData)==null?void 0:e.card)===!1||this.$router.push(`/card/${this.table}/${t}`)}}},Jj={class:"w-[calc(100vw - 320px)]"},Qj={class:"h-[76px] bg-gray-50 flex items-center justify-between px-[30px]"},e7={class:"text-xl font-medium h-[20px]"},t7={style:{height:"calc(100vh - 140px)",width:"calc(100vw - 260px)"},class:"bg-gray-50 p-[20px] flex pt-[10px]"},n7={class:"bg-white w-full rounded-xl border p-[20px]"},i7={class:"flex sm:grid sm:grid-cols-2 gap-x-2 sm:gap-x-5 mb-[10px] relative"},r7={class:"flex gap-[6px] ml-auto"},s7={key:0,class:"font-medium text-[10px] py-0.5 px-[5px] bg-gray-800 text-white leading-3 rounded-full dark:bg-neutral-500"},o7={class:"space-y-5 flex items-start w-full justify-start"},a7={style:{height:"calc(100vh - 310px)"},class:"overflow-x-auto w-full border-t [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},l7={class:"inline-block w-full align-middle"},c7={key:0,class:"divide-y divide-gray-200 min-w-full dark:divide-neutral-700 relative table-fixed"},u7={class:"sticky top-0 bg-white w-full relative after:absolute after:content-[''] after:block after:w-full after:h-px after:bg-stone-200"},h7={class:"border-stone-200 right-0 z-[1]"},d7={class:"divide-y divide-gray-200"},p7=["onClick"],f7={class:"text-center sticky right-0 bg-white w-[80px] px-[10px]"},m7={class:"p-[20px] flex justify-end w-full"},g7={class:"filter-content h-screen bg-white w-[400px] p-[20px] pt-[10px] overflow-x-auto bg-white [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar:horizontal]:h-[8px] [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"};function y7(t,e,n,i,r,a){var ee,oe,J,Ae,ke,Me;const u=S.resolveComponent("IconPlus"),l=S.resolveComponent("router-link"),g=S.resolveComponent("IconSearch"),_=S.resolveComponent("VsText"),k=S.resolveComponent("AdminTableColumnsHidden"),E=S.resolveComponent("AdminTableExport"),T=S.resolveComponent("IconFilter"),I=S.resolveComponent("AdminTableColumn"),z=S.resolveComponent("AdminTableControl"),V=S.resolveComponent("AdminNodata"),H=S.resolveComponent("VsPagination"),Z=S.resolveComponent("VsFilter");return S.openBlock(),S.createElementBlock(S.Fragment,null,[S.createElementVNode("div",Jj,[S.createElementVNode("div",Qj,[S.createElementVNode("h2",e7,S.toDisplayString(n.title),1),a.isForm?(S.openBlock(),S.createBlock(l,{key:0,to:`/add?table=${(oe=(ee=t.$route)==null?void 0:ee.params)==null?void 0:oe.catchAll}`,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 hover:text-white duration-300"},{default:S.withCtx(()=>[S.createVNode(u,{height:"16",width:"16"}),e[5]||(e[5]=S.createTextVNode(" Додати "))]),_:1},8,["to"])):S.createCommentVNode("",!0)]),S.createElementVNode("div",t7,[S.createElementVNode("div",n7,[S.createElementVNode("div",i7,[S.createVNode(g,{height:"14",width:"14",class:"absolute top-[10px] left-[14px] text-gray-500 z-[1]"}),S.createVNode(_,{modelValue:r.searchValue,"onUpdate:modelValue":e[0]||(e[0]=Le=>r.searchValue=Le),placeholder:"Пошук...",clearable:!0,class:"[&>input]:py-[7px] [&>input]:ps-10 [&>input]:pe-8 [&>input]:block [&>input]:w-full [&>input]:bg-gray-100 [&>input]:border-transparent [&>input]:rounded-lg [&>input]:text-sm [&>input]:focus:bg-white [&>input]:focus:border-blue-500 [&>input]:focus:ring-blue-500 [&>input]:disabled:opacity-50 [&>input]:disabled:pointer-events-none [&>input]:dark:bg-neutral-700 [&>input]:dark:border-transparent [&>input]:dark:text-neutral-400 [&>input]:dark:placeholder:text-neutral-400 dark:focus:bg-neutral-800 dark:focus:ring-neutral-600"},null,8,["modelValue"]),S.createElementVNode("div",r7,[S.createVNode(k,{columns:(J=r.tableData)==null?void 0:J.columns,onUpdateColumns:e[1]||(e[1]=Le=>r.tableData.columns=Le)},null,8,["columns"]),S.createVNode(E,{table:n.table,columns:(Ae=r.tableData)==null?void 0:Ae.columns},null,8,["table","columns"]),S.createElementVNode("button",{onClick:e[2]||(e[2]=Le=>r.isFilters=!r.isFilters),class:"py-2 px-2.5 inline-flex items-center gap-x-1.5 text-xs font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-gray-50 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},[S.createVNode(T,{height:"16",width:"16"}),e[6]||(e[6]=S.createTextVNode(" Фільтри ")),r.onFilters?(S.openBlock(),S.createElementBlock("span",s7,S.toDisplayString(r.onFilters),1)):S.createCommentVNode("",!0)])])]),S.createElementVNode("div",o7,[S.createElementVNode("div",a7,[S.createElementVNode("div",l7,[a.isNoData?(S.openBlock(),S.createBlock(V,{key:1})):(S.openBlock(),S.createElementBlock("table",c7,[S.createElementVNode("thead",u7,[S.createElementVNode("tr",h7,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList(a.columns,Le=>(S.openBlock(),S.createBlock(I,{key:Le.name,style:S.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),data:Le,activeColumn:r.activeColumn,onChangeActive:a.changeActiveColumn},null,8,["style","data","activeColumn","onChangeActive"]))),128)),e[7]||(e[7]=S.createElementVNode("th",{class:"w-[70px] sticky right-0 top-0 bg-white"},null,-1))])]),S.createElementVNode("tbody",d7,[(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((ke=r.tableData)==null?void 0:ke.rows,(Le,Ie)=>{var Ye,it,Nt,ht,Rt,Xt,nn,jt;return S.openBlock(),S.createElementBlock("tr",{key:Ie},[S.createElementVNode("td",{class:"text-sm text-gray-600",style:S.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth})},[S.createElementVNode("button",{onClick:()=>a.pushToCard(Le==null?void 0:Le.id),class:S.normalizeClass(["text-sm font-medium",[((Ye=r.tableData)==null?void 0:Ye.card)===!1?"":"text-blue-600 decoration-2 focus:outline-none focus:underline hover:text-blue-600 hover:underline"]])},[(S.openBlock(),S.createBlock(S.resolveDynamicComponent(((it=a.columns[0])==null?void 0:it.format)==="custom"?(Nt=a.columns[0])==null?void 0:Nt.component:t.$componentsConfig[`table-format-${((Rt=(ht=a.columns[0])==null?void 0:ht.format)==null?void 0:Rt.toLowerCase())||"text"}`]),{name:(Xt=a.columns[0])==null?void 0:Xt.name,data:Le,value:Le==null?void 0:Le[(nn=a.columns[0])==null?void 0:nn.name],table:n.table},null,8,["name","data","value","table"]))],10,p7)],4),(S.openBlock(!0),S.createElementBlock(S.Fragment,null,S.renderList((jt=a.columns)==null?void 0:jt.slice(1),Mt=>{var Sn,hn;return S.openBlock(),S.createElementBlock("td",{class:"text-start px-[4px] py-3 text-sm text-gray-600",style:S.normalizeStyle({minWidth:a.rowWidth,maxWidth:a.rowWidth}),key:Mt.name},[(S.openBlock(),S.createBlock(S.resolveDynamicComponent((Mt==null?void 0:Mt.format)==="custom"?Mt==null?void 0:Mt.component:t.$componentsConfig[`table-format-${((Sn=Mt==null?void 0:Mt.format)==null?void 0:Sn.toLowerCase())||"text"}`]),{onUpdateTable:a.getTableData,name:Mt==null?void 0:Mt.name,data:Le,value:Le==null?void 0:Le[Mt==null?void 0:Mt.name],table:n.table,inline:((hn=r.tableData)==null?void 0:hn.inline)||!1},null,40,["onUpdateTable","name","data","value","table","inline"]))],4)}),128)),S.createElementVNode("td",f7,[S.createVNode(z,{isForm:a.isForm,item:Le,table:n.table,onUpdateTable:a.getTableData},null,8,["isForm","item","table","onUpdateTable"])])])}),128))])]))])])]),S.createElementVNode("div",m7,[r.limit?(S.openBlock(),S.createBlock(H,{key:0,goTo:!1,class:"justify-end","default-page":a.defaultPage,total:((Me=r.tableData)==null?void 0:Me.total)||0,pageSize:r.limit,onPageChange:a.handlePageChange,pageSizes:[10,16,20],onPageSizeChange:a.changeLimit},null,8,["default-page","total","pageSize","onPageChange","onPageSizeChange"])):S.createCommentVNode("",!0)])])])]),S.createVNode(S.Transition,{name:"fade"},{default:S.withCtx(()=>{var Le;return[S.withDirectives(S.createElementVNode("div",{onClick:e[4]||(e[4]=(...Ie)=>a.closeFilter&&a.closeFilter(...Ie)),style:{height:"100vh"},class:"fixed filter-container top-0 flex justify-end items-center z-[2] right-0 left-0 bottom-0 bg-[rgba(0,0,0,0.5)]"},[S.createElementVNode("div",g7,[(Le=r.filterScheme)!=null&&Le.length?(S.openBlock(),S.createBlock(Z,{key:0,ref:"filter",scheme:r.filterScheme,layout:"default","apply-vue-router":"",history:"",name:"filter",onFilterChange:a.filterChange,closeFilterBtn:!0,onFilterClose:e[3]||(e[3]=Ie=>r.isFilters=!1)},null,8,["scheme","onFilterChange"])):S.createCommentVNode("",!0)])],512),[[S.vShow,r.isFilters]])]}),_:1})],64)}const _7={components:{AdminTable:_t(Kj,[["render",y7]])},data(){return{table:!1,interface:"",title:""}},watch:{$route:{async handler(){Xr!=null&&Xr.value||await this.getMenu(),await this.checkPageType()},deep:!0},title(t){t&&(document.title=t)}},async mounted(){await this.checkPageType()},methods:{flattenMenu(t){const e=[];return t.forEach(n=>{n.menu?e.push(...this.flattenMenu(n.menu)):e.push(n)}),e},async getMenu(){try{const{data:t}=await wt.get("/api/user-menu");Xr.value=t}catch{}},async checkPageType(){const t=this.flattenMenu(Xr.value);t!=null&&t.length||this.$router.replace("/404");const e=t==null?void 0:t.find(i=>{var r,a;return(i==null?void 0:i.path)==((a=(r=this.$route)==null?void 0:r.params)==null?void 0:a.catchAll)});this.title=e==null?void 0:e.ua,e||this.$router.replace("/404");const n=e==null?void 0:e.table;this.table=n||!1,!n&&this.getInterface()},async getInterface(){var t,e;try{const{data:n}=await wt.get(`/api/template/interface/${((e=(t=this.$route)==null?void 0:t.params)==null?void 0:e.catchAll)||""}`);this.interface=n||""}catch{this.interface=""}}}},b7=["innerHTML"];function x7(t,e,n,i,r,a){const u=S.resolveComponent("AdminTable");return r.table?(S.openBlock(),S.createBlock(u,{key:0,table:r.table,title:r.title},null,8,["table","title"])):(S.openBlock(),S.createElementBlock("div",{key:1,class:"w-full bg-gray-50",style:{height:"calc(100vh - 120px)"},innerHTML:r.interface},null,8,b7))}const v7=Object.freeze(Object.defineProperty({__proto__:null,default:_t(_7,[["render",x7]])},Symbol.toStringTag,{value:"Module"}));return r$});